@p4code/cli 0.4.9 → 0.4.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{n as t,r as n,t as r}from"./compiler-runtime-CLAvuQ-D.js";import{At as i,Dl as a,Jf as o,Ol as s,Ot as c,Q as l,U as u,Ur as d,Yl as f,Yr as p,b as m,dt as h,eu as g,fl as _,ft as v,gt as y,h as b,ht as x,mt as S,n as C,no as w,o as T,vl as E,vt as D,wt as ee,xl as O,xt as k,yt as A,za as j}from"./previewAssetResource-DoQeyCSk.js";import{n as M,r as N,t as P}from"./renderFileChildren-UOFwKVtT.js";import{$ as te,Ar as ne,Bn as re,Cn as ie,D as ae,Dr as oe,E as se,Er as ce,Fn as le,Fr as ue,Gn as de,Gt as fe,Hn as pe,Hr as me,Ht as F,Jr as he,Jt as I,Kn as ge,Kt as _e,Mn as ve,Or as ye,Pr as be,T as xe,Tr as Se,Un as Ce,Ut as L,Vn as we,Wn as Te,Z as Ee,Zr as De,_t as Oe,an as ke,b as Ae,bn as je,ct as Me,d as Ne,ei as Pe,et as Fe,f as Ie,fn as Le,gr as Re,gt as ze,ii as Be,kr as Ve,l as He,m as Ue,mr as We,on as Ge,p as Ke,qn as qe,ri as Je,ti as Ye,tt as Xe,u as Ze,v as Qe,w as $e,wn as et,x as tt,y as nt,zr as rt}from"./index-BMtTA7Do.js";import{a as it,i as at,n as ot,r as R,t as z}from"./fileCommentAnnotations-CfmoUfij.js";var st=O(`file-question-mark`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}],[`path`,{d:`M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3`,key:`mhlwft`}]]),ct=O(`folder-tree`,[[`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`}]]),lt=`file-tree-container`,ut=`data-file-tree-style`,dt=`data-file-tree-unsafe-css`,ft=`data-file-tree-scrollbar-measure`,pt=`data-file-tree-scrollbar-gutter-measured`,mt=`--trees-scrollbar-gutter-measured`,ht=`header`,gt=`context-menu`,_t=`context-menu-trigger`,vt=5,yt=1<<vt,bt=yt*4;function xt(){return{childIdByNameId:new Map,childIds:[],childPositionById:new Map,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function St(){return{childIdByNameId:null,childIds:[],childPositionById:null,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function Ct(e,t){if(t.childIdByNameId!=null)return t.childIdByNameId;let n=new Map;for(let r of t.childIds){let t=e[r];t!=null&&n.set(t.nameId,r)}return t.childIdByNameId=n,n}function wt(e){if(e.childPositionById!=null)return e.childPositionById;let t=new Map;for(let n=0;n<e.childIds.length;n++){let r=e.childIds[n];r!=null&&t.set(r,n)}return e.childPositionById=t,t}function Tt(e,t){e.childPositionById!=null&&e.childPositionById.set(t,e.childIds.length),e.childIds.push(t)}function Et(e,t){if(e.childPositionById!=null)for(let n=t;n<e.childIds.length;n++){let t=e.childIds[n];t!=null&&e.childPositionById.set(t,n)}}function Dt(e,t){let n=0,r=0;for(let i of t.childIds){let t=e[i];t!=null&&(n+=t.subtreeNodeCount,r+=t.visibleSubtreeCount)}t.totalChildSubtreeNodeCount=n,t.totalChildVisibleSubtreeCount=r,jt(e,t)}function Ot(e,t,n,r){if(e.totalChildSubtreeNodeCount+=n,e.totalChildVisibleSubtreeCount+=r,e.childVisibleChunkSums==null||r===0)return;let i=wt(e).get(t);if(i===void 0)return;let a=i>>vt;e.childVisibleChunkSums[a]+=r}function kt(e,t,n){let r=t.childVisibleChunkSums;if(r!=null){let i=n,a=0;for(let o of r){if(i<o){let r=Mt(e,t,a,i);return{...r,childVisibleIndex:n-r.localVisibleIndex}}i-=o,a+=yt}throw Error(`Visible child index ${String(n)} is out of range`)}let i=n;for(let r=0;r<t.childIds.length;r++){let a=t.childIds[r];if(a==null)continue;let o=e[a];if(o!=null){if(i<o.visibleSubtreeCount)return{childIndex:r,childVisibleIndex:n-i,localVisibleIndex:i};i-=o.visibleSubtreeCount}}throw Error(`Visible child index ${String(n)} is out of range`)}function At(e,t,n){let r=0,i=t.childVisibleChunkSums,a=0;if(i!=null){let e=n>>vt;for(let t=0;t<e;t+=1)r+=i[t]??0;a=e<<vt}for(let i=a;i<n;i+=1){let n=t.childIds[i];if(n==null)continue;let a=e[n];a!=null&&(r+=a.visibleSubtreeCount)}return r}function jt(e,t){if(t.childIds.length<bt){t.childVisibleChunkSums=null;return}let n=Math.ceil(t.childIds.length/yt),r=new Int32Array(n);for(let n=0;n<t.childIds.length;n++){let i=t.childIds[n];if(i==null)continue;let a=e[i];a!=null&&(r[n>>vt]+=a.visibleSubtreeCount)}t.childVisibleChunkSums=r}function Mt(e,t,n,r){let i=Math.min(t.childIds.length,n+yt),a=r;for(let r=n;r<i;r++){let n=t.childIds[r];if(n==null)continue;let i=e[n];if(i!=null){if(a<i.visibleSubtreeCount)return{childIndex:r,localVisibleIndex:a};a-=i.visibleSubtreeCount}}throw Error(`Visible child index ${String(r)} is out of range`)}var Nt=7,Pt=3,Ft=1<<Pt,It=4;function Lt(e,t,n=0){return e<<It|n<<Pt|t}function Rt(e){return e.depthAndFlags>>>It}function zt(e){return(e.depthAndFlags&Ft)>>Pt}function B(e){return(e.depthAndFlags&Ft)!==0}function Bt(e){return e.depthAndFlags&Nt}function Vt(e,t){return(Bt(e)&t)!==0}function Ht(e,t){e.depthAndFlags|=t}function Ut(e,t){e.depthAndFlags=Lt(t,Bt(e),zt(e))}var Wt=Symbol(`benchmarkInstrumentation`);function Gt(e,t){return t==null||Object.defineProperty(e,Wt,{configurable:!0,enumerable:!1,value:t,writable:!1}),e}function Kt(e){return e==null?null:e[Wt]??null}function V(e,t,n){return e==null?n():e.measurePhase(t,n)}function qt(e,t,n){!Number.isFinite(n)||e==null||e.setCounter(t,n)}function Jt(e){return e>=48&&e<=57}function Yt(e){let t=[],n=0,r=0;for(;r<e.length;){for(;r<e.length&&!Jt(e.charCodeAt(r));)r+=1;if(r>=e.length)break;r>n&&t.push(e.slice(n,r));let i=0;for(;r<e.length&&Jt(e.charCodeAt(r));)i=i*10+(e.charCodeAt(r)-48),r+=1;t.push(i),n=r}return(n<e.length||t.length===0)&&t.push(e.slice(n)),t}function Xt(e){let t=e.toLowerCase();return{lowerValue:t,tokens:Yt(t)}}function Zt(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++){let n=e[r],i=t[r];if(n===i)continue;if(typeof n==`number`&&typeof i==`number`)return n<i?-1:1;let a=String(n),o=String(i);if(a!==o)return a<o?-1:1}return e.length===t.length?0:e.length<t.length?-1:1}function Qt(e,t){if(e.tokens.length===1&&t.tokens.length===1&&typeof e.tokens[0]==`string`&&typeof t.tokens[0]==`string`)return e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1;let n=Zt(e.tokens,t.tokens);return n===0?e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1:n}function $t(e,t,n){let r=Qt(n(e),n(t));return r===0?e===t?0:e<t?-1:1:r}function en(e,t){return $t(e,t,Xt)}function tn(e,t){return t===e.segments.length-1?+!!e.isDirectory:1}function nn(e,t){let n=Math.min(e.segments.length,t.segments.length);for(let r=0;r<n;r++){let n=e.segments[r],i=t.segments[r];if(n===i)continue;let a=tn(e,r);return a===tn(t,r)?en(n,i):a===1?-1:1}return e.segments.length===t.segments.length?e.isDirectory===t.isDirectory?0:e.isDirectory?-1:1:e.segments.length<t.segments.length?-1:1}function rn(e,t){return nn(e,t)}function an(e,t,n){let r=e=>{let t=n.get(e);if(t!=null)return t;let r=Xt(e);return n.set(e,r),r},i=Math.min(e.segments.length,t.segments.length);for(let n=0;n<i;n++){let i=e.segments[n],a=t.segments[n];if(i===a)continue;let o=tn(e,n);return o===tn(t,n)?$t(i,a,r):o===1?-1:1}return e.segments.length===t.segments.length?e.isDirectory===t.isDirectory?0:e.isDirectory?-1:1:e.segments.length<t.segments.length?-1:1}function on(e,t){let n=e.sortKeyById[t];if(n!==void 0)return n;let r=e.valueById[t],i=Xt(r);return e.sortKeyById[t]=i,i}function sn(e={}){return{flattenEmptyDirectories:e.flattenEmptyDirectories!==!1,sort:e.sort??`default`}}function cn(e){let t=e.length>0&&e.charCodeAt(e.length-1)===47,n=t?e.length-1:e.length,r=[],i=0;for(let t=0;t<n;t++)e.charCodeAt(t)===47&&(r.push(e.slice(i,t)),i=t+1);return r.push(e.slice(i,n)),{hasTrailingSlash:t,segments:r}}function ln(e){let{hasTrailingSlash:t,segments:n}=cn(e);return{basename:n[n.length-1]??``,isDirectory:t,path:e,segments:n}}function un(e){if(e.length===0)return{requiresDirectory:!1,segments:[]};let{hasTrailingSlash:t,segments:n}=cn(e);return{requiresDirectory:t,segments:n}}var dn=``;function fn(){let e=new Map;return e.set(dn,0),{idByValue:e,valueById:[dn],sortKeyById:[Xt(dn)]}}function pn(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 mn(e,t){let n=e.valueById[t];if(n===void 0)throw Error(`Unknown segment ID: ${String(t)}`);return n}var hn=Symbol(`pathStorePreparedInputKind`);function gn(e,t){return e[hn]=t,e}function _n(e){return{basename:e.basename,depth:e.segments.length,isDirectory:e.isDirectory,path:e.path,segments:e.segments}}function vn(e,t,n){return n==="default"?rn(e,t):n(_n(e),_n(t))}function yn(){return{depthAndFlags:Lt(0,3,1),nameId:0,parentId:0,subtreeNodeCount:1,visibleSubtreeCount:1}}function bn(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 xn(e){return e.isDirectory?e.segments.length:e.segments.length-1}function Sn(e){return Array.isArray(e)&&e.every(e=>typeof e==`object`&&!!e&&typeof e.path==`string`&&Array.isArray(e.segments)&&typeof e.basename==`string`&&typeof e.isDirectory==`boolean`)}function Cn(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function wn(e,t={}){return An(e,t).map(e=>e.path)}function Tn(e,t={}){let n=An(e,t);return gn({paths:n.map(e=>e.path),preparedPaths:n},`prepared`)}function En(e){let t=e.length,n=!1;for(let r=0;r<t;r+=1){let t=e[r];if(t.length>0&&t.charCodeAt(t.length-1)===47){n=!0;break}}return gn({paths:e,presortedPaths:e,presortedPathsContainDirectories:n},`presorted`)}function Dn(e){let t=e,n=t.preparedPaths;if(t[hn]===`prepared`&&n!=null)return n;if(!Sn(n))throw Error(`preparedInput must come from PathStore.prepareInput()`);return n}function On(e){let t=e;return t[hn]===`presorted`&&t.presortedPaths!=null||Cn(t.presortedPaths)?t.presortedPaths:null}function kn(e){let t=e;return typeof t.presortedPathsContainDirectories==`boolean`?t.presortedPathsContainDirectories:null}function An(e,t={}){let n=sn(t),r=Kt(t);qt(r,`workload.inputFiles`,e.length);let i=V(r,`store.preparePathEntries.parse`,()=>e.map(e=>ln(e)));return V(r,`store.preparePathEntries.sort`,()=>i.sort((e,t)=>vn(e,t,n.sort))),i}var jn=class{directories=new Map;directoryStack=[0];presortedDirectoryNodeIds=[];initialExpandedPathSet;createdDirectoriesAllExpanded=!1;createdDirectoryCount=0;lastPreparedPath=null;nodes=[yn()];options;instrumentation;segmentSortKeyCache=new Map;segmentTable=fn();hasDeferredDirectoryIndexes=!1;constructor(e={}){this.instrumentation=Kt(e),this.options=sn(e);let t=e.initialExpandedPaths??null;if(t==null||t.length===0)this.initialExpandedPathSet=null;else{let e=new Set,n=t.length;for(let r=0;r<n;r+=1){let n=t[r],i=n.length;e.add(i>0&&n.charCodeAt(i-1)===47?n.slice(0,i-1):n)}this.initialExpandedPathSet=e,this.createdDirectoriesAllExpanded=!0}this.directories.set(0,xt())}appendPaths(e){return V(this.instrumentation,`store.builder.appendPaths.parse`,()=>this.appendPreparedPaths(e.map(e=>ln(e))))}appendPreparedPaths(e,t=!0){return this.createdDirectoriesAllExpanded=!1,V(this.instrumentation,`store.builder.appendPreparedPaths`,()=>{for(let n of e)this.appendPreparedPath(n,t)}),this}appendPresortedPaths(e,t=null){return V(this.instrumentation,`store.builder.appendPresortedPaths`,()=>{if(t===!1){this.appendPresortedFilePaths(e);return}this.createdDirectoriesAllExpanded=!1;let n=null,r=0,i=this.nodes,a=this.segmentTable,o=a.idByValue,s=a.valueById,c=this.directoryStack,l=0,u=``,d=0;for(let t of e){if(n===t)throw Error(`Duplicate path: "${t}"`);let e=t.length>0&&t.charCodeAt(t.length-1)===47,a=e?t.length-1:t.length,f=0,p=0;if(n!=null)if(u.length>0&&t.length>u.length&&t.startsWith(u))f=d,p=u.length;else{let r=Math.min(a,n.length),i=!0;for(let e=0;e<r;e++){let r=t.charCodeAt(e);if(r!==n.charCodeAt(e)){i=!1;break}r===47&&(f++,p=e+1)}i&&e&&r===a&&n.length>a&&n.charCodeAt(a)===47&&(f++,p=a+1)}l=f,r=f;let m=p,h=t.indexOf(`/`,m);for(;h>=0&&h<a;){let e=c[l];if(e===void 0)throw Error(`Directory stack underflow while building the path store`);r++;let n=t.slice(m,h),a=o.get(n);a===void 0&&(a=s.length,o.set(n,a),s.push(n));let u=i.length;i.push({depthAndFlags:Lt(r,0,1),nameId:a,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),this.recordCreatedDirectoryPath(t.slice(0,h)),l++,c[l]=u,m=h+1,h=t.indexOf(`/`,m)}if(e){if(m<a){let e=c[l];if(e===void 0)throw Error(`Unable to resolve directory parent for "${t}"`);r++;let n=t.slice(m,a),u=o.get(n);u===void 0&&(u=s.length,o.set(n,u),s.push(n));let d=i.length;i.push({depthAndFlags:Lt(r,0,1),nameId:u,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),l++,c[l]=d}let e=c[l];if(e===void 0)throw Error(`Unable to resolve directory node for "${t}"`);this.promoteDirectoryToExplicit(e,t)}else{let e=c[l];if(e===void 0)throw Error(`Unable to resolve file parent for "${t}"`);let n=t.slice(m),a=o.get(n);a===void 0&&(a=s.length,o.set(n,a),s.push(n)),i.push({depthAndFlags:Lt(r+1,0),nameId:a,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1})}m!==u.length&&(u=t.substring(0,m),d=r),n=t}c.length=l+1,n!=null&&(this.lastPreparedPath=ln(n)),this.hasDeferredDirectoryIndexes=!0}),this}appendPresortedFilePaths(e){let t=null,n=0,r=this.nodes,i=this.segmentTable,a=i.idByValue,o=i.valueById,s=this.directoryStack,c=0,l=``,u=0;for(let i of e){if(t===i)throw Error(`Duplicate path: "${i}"`);let e=i.length,d=0,f=0;if(t!=null)if(l.length>0&&i.length>l.length&&i.startsWith(l))d=u,f=l.length;else{let n=Math.min(e,t.length);for(let e=0;e<n;e++){let n=i.charCodeAt(e);if(n!==t.charCodeAt(e))break;n===47&&(d++,f=e+1)}}c=d,n=d;let p=f,m=i.indexOf(`/`,p);for(;m>=0;){let e=s[c];if(e===void 0)throw Error(`Directory stack underflow while building the path store`);n++;let t=i.slice(p,m),l=a.get(t);l===void 0&&(l=o.length,a.set(t,l),o.push(t));let u=r.length;r.push({depthAndFlags:Lt(n,0,1),nameId:l,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),this.recordCreatedDirectoryPath(i.slice(0,m)),this.presortedDirectoryNodeIds.push(u),c++,s[c]=u,p=m+1,m=i.indexOf(`/`,p)}let h=s[c];if(h===void 0)throw Error(`Unable to resolve file parent for "${i}"`);let g=i.slice(p),_=a.get(g);_===void 0&&(_=o.length,a.set(g,_),o.push(g)),r.push({depthAndFlags:Lt(n+1,0),nameId:_,parentId:h,subtreeNodeCount:1,visibleSubtreeCount:1}),p!==l.length&&(l=i.substring(0,p),u=n),t=i}s.length=c+1,t!=null&&(this.lastPreparedPath=ln(t)),this.hasDeferredDirectoryIndexes=!0}finish(e={}){let t=e.skipSubtreeCountPass===!0;return this.hasDeferredDirectoryIndexes?(V(this.instrumentation,`store.builder.buildDirectoryIndexes`,()=>this.buildPresortedFinish(t)),this.hasDeferredDirectoryIndexes=!1):t||V(this.instrumentation,`store.builder.computeSubtreeCounts`,()=>this.computeSubtreeCounts(0)),{directories:this.directories,nodes:this.nodes,options:this.options,rootId:0,segmentTable:this.segmentTable,presortedDirectoryNodeIds:this.presortedDirectoryNodeIds.length>0?this.presortedDirectoryNodeIds:null}}didMatchAllInitialExpandedPaths(){return this.createdDirectoriesAllExpanded&&this.initialExpandedPathSet!=null&&this.createdDirectoryCount===this.initialExpandedPathSet.size}appendPreparedPath(e,t){if(this.hasDeferredDirectoryIndexes&&=(this.buildDirectoryIndexes(),!1),this.lastPreparedPath!=null){if(e.path===this.lastPreparedPath.path)throw Error(`Duplicate path: "${e.path}"`);if(t&&(this.options.sort==="default"?an(this.lastPreparedPath,e,this.segmentSortKeyCache):vn(this.lastPreparedPath,e,this.options.sort))>0)throw Error(`Builder input must be sorted before appendPaths(): "${e.path}"`)}let n=this.lastPreparedPath,r=xn(e),i=n==null?0:xn(n),a=n==null?0:bn(n.segments,e.segments),o=Math.min(a,r,i);this.directoryStack.length=o+1;for(let n=o;n<r;n++){let r=this.directoryStack[this.directoryStack.length-1];if(r===void 0)throw Error(`Directory stack underflow while building the path store`);let i=t?this.getOrCreateDirectoryChild(r,e.segments[n]):this.createDirectoryChild(r,e.segments[n]);this.directoryStack.push(i)}if(e.isDirectory){let t=this.directoryStack[this.directoryStack.length-1];if(t===void 0)throw Error(`Unable to resolve directory node for "${e.path}"`);this.promoteDirectoryToExplicit(t,e.path),this.lastPreparedPath=e;return}let s=this.directoryStack[this.directoryStack.length-1];if(s===void 0)throw Error(`Unable to resolve file parent for "${e.path}"`);t?this.createFileChild(s,e.basename,e.path):this.createFileChildUnchecked(s,e.basename),this.lastPreparedPath=e}recordCreatedDirectoryPath(e){!this.createdDirectoriesAllExpanded||this.initialExpandedPathSet==null||(this.createdDirectoryCount+=1,this.initialExpandedPathSet.has(e)||(this.createdDirectoriesAllExpanded=!1))}createFileChild(e,t,n){let r=pn(this.segmentTable,t),i=this.getDirectoryIndex(e),a=i.childIdByNameId;if(a!=null&&a.get(r)!==void 0)throw Error(`Path collides with an existing entry: "${n}"`);let o=this.nodes[e];if(o===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let s=this.nodes.length;return this.nodes.push({depthAndFlags:Lt(Rt(o)+1,0),nameId:r,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),a?.set(r,s),Tt(i,s),s}createFileChildUnchecked(e,t){let n=pn(this.segmentTable,t),r=this.getDirectoryIndex(e),i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:Lt(Rt(i)+1,0),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),Tt(r,a),a}getOrCreateDirectoryChild(e,t){let n=pn(this.segmentTable,t),r=this.getDirectoryIndex(e);if(r.childIdByNameId!=null){let e=r.childIdByNameId.get(n);if(e!==void 0){let n=this.nodes[e];if(n!=null&&!B(n))throw Error(`Path collides with an existing file while creating directory "${t}"`);return e}}let i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:Lt(Rt(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),Tt(r,a),this.directories.set(a,xt()),a}createDirectoryChild(e,t){let n=pn(this.segmentTable,t),r=this.getDirectoryIndex(e),i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:Lt(Rt(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),Tt(r,a),this.directories.set(a,xt()),a}promoteDirectoryToExplicit(e,t){let n=this.nodes[e];if(n===void 0)throw Error(`Unknown directory node ID: ${String(e)}`);if(!B(n))throw Error(`Path is not a directory: "${t}"`);if(Vt(n,1))throw Error(`Duplicate path: "${t}"`);Ht(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,St());let r=-1,i=null;for(let e=1;e<t.length;e++){let a=t[e];if(a==null)continue;if(B(a)){let t=St();n.set(e,t),r=e,i=t}let o;a.parentId===r?o=i:(o=n.get(a.parentId),r=a.parentId,i=o??null),o?.childIds.push(e)}if(!e)for(let e=t.length-1;e>=1;e--){let n=t[e];if(n==null)continue;let r=t[n.parentId];r!=null&&(r.subtreeNodeCount+=n.subtreeNodeCount,r.visibleSubtreeCount+=n.visibleSubtreeCount)}}buildDirectoryIndexes(){let e=this.nodes;for(let t=1;t<e.length;t++){let n=e[t];if(n==null)continue;B(n)&&this.directories.set(t,xt());let r=this.directories.get(n.parentId);r!=null&&(r.childIdByNameId!=null&&r.childIdByNameId.set(n.nameId,t),Tt(r,t))}}computeSubtreeCounts(e){let t=this.nodes[e];if(t===void 0)throw Error(`Unknown node ID: ${String(e)}`);if(!B(t))return t.subtreeNodeCount=1,t.visibleSubtreeCount=1,1;let n=this.getDirectoryIndex(e),r=1;for(let e of n.childIds)r+=this.computeSubtreeCounts(e);return Dt(this.nodes,n),t.subtreeNodeCount=r,t.visibleSubtreeCount=r,r}};function Mn(e,t=`closed`,n=null){let r=Pn(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 Nn(){return{affectedAncestorIds:new Set,affectedNodeIds:new Set,events:[]}}function Pn(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 Fn(e,t){return Vt(t,2)||e.defaultExpansion===`open`?!0:e.defaultExpansion===`closed`?!1:Rt(t)<=e.defaultExpansion}function In(e,t,n=e.snapshot.nodes[t]){return n==null||!B(n)?!1:e.directoriesOpenByDefault&&!e.hasCollapsedDirectoryOverrides?!0:e.collapsedDirectoryIds.has(t)?!1:e.expandedDirectoryIds.has(t)?!0:Fn(e,n)}function Ln(e,t,n,r=e.snapshot.nodes[t]){if(r==null||!B(r))return;let i=Fn(e,r);if(n){if(i){e.collapsedDirectoryIds.delete(t),e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0;return}e.expandedDirectoryIds.add(t);return}if(i){e.collapsedDirectoryIds.add(t),e.hasCollapsedDirectoryOverrides=!0;return}e.expandedDirectoryIds.delete(t)}function Rn(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 zn(e,t){return e.directoryLoadInfoById.get(t)?.state??`loaded`}function Bn(e,t){let n=Rn(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 Vn(e,t){let n=Rn(e,t);n.activeAttemptId=null,n.errorMessage=null,n.state=`unloaded`}function Hn(e,t,n){let r=e.directoryLoadInfoById.get(t);return r==null||r.activeAttemptId!==n?!1:(r.activeAttemptId=null,r.errorMessage=null,r.state=`loaded`,!0)}function Un(e,t,n){return e.directoryLoadInfoById.get(t)?.activeAttemptId===n}function Wn(e,t,n,r){let i=e.directoryLoadInfoById.get(t);return i==null||i.activeAttemptId!==n?!1:(i.activeAttemptId=null,i.errorMessage=r??null,i.state=`error`,!0)}function Gn(e,t){e.directoryLoadInfoById.delete(t)}function Kn(e,t,n){let r=n,i=e.listeners.get(t);return i==null?e.listeners.set(t,new Set([r])):i.add(r),()=>{let n=e.listeners.get(t);n!=null&&(n.delete(r),n.size===0&&e.listeners.delete(t))}}function qn(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`add`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function Jn(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`remove`,path:e.path,projectionChanged:e.projectionChanged,recursive:e.recursive,visibleCountDelta:null}}function Yn(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,from:e.from,operation:`move`,projectionChanged:e.projectionChanged,to:e.to,visibleCountDelta:null}}function Xn(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`expand`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function Zn(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`collapse`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function Qn(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`mark-directory-unloaded`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function $n(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 er(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:e.childEvents.some(e=>e.canonicalChanged),childEvents:e.childEvents,operation:`apply-child-patch`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function tr(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 nr(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 rr(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 ir(e,t,n){return{...n,visibleCountDelta:hr(e)-t}}function ar(e,t){let n=hr(e),r=Nn();e.transactionStack.push(r);try{t()}catch(t){throw cr(e,r,!1),t}cr(e,r,!0,hr(e)-n)}function or(e,t){let n=e.instrumentation;if(n==null){sr(e,t);return}V(n,`store.events.record`,()=>sr(e,t))}function sr(e,t){let n=e.transactionStack[e.transactionStack.length-1]??null;if(n==null){pr(e,t);return}n.events.push(t),fr(n,t)}function cr(e,t,n,r=null){if(e.transactionStack.pop()!==t)throw Error(`Transaction stack underflow`);if(!n)return;let i=e.transactionStack[e.transactionStack.length-1]??null;if(i!=null){let n=e.instrumentation;n==null?dr(i,t):V(n,`store.events.batch.merge`,()=>dr(i,t));return}let a=lr(t,r),o=e.instrumentation;if(o==null){pr(e,a);return}V(o,`store.events.batch.commit`,()=>pr(e,a))}function lr(e,t){return{affectedAncestorIds:[...e.affectedAncestorIds],affectedNodeIds:[...e.affectedNodeIds],canonicalChanged:e.events.some(e=>e.canonicalChanged),events:[...e.events],operation:`batch`,projectionChanged:e.events.some(e=>e.projectionChanged),visibleCountDelta:t}}function ur(e,t){for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n);for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n)}function dr(e,t){for(let n of t.events)e.events.push(n);ur(e,t)}function fr(e,t){for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n);for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n)}function pr(e,t){let n=e.instrumentation;if(n==null){mr(e,t);return}V(n,`store.events.emit`,()=>mr(e,t))}function mr(e,t){e.listeners.get(t.operation)?.forEach(e=>e(t)),e.listeners.get(`*`)?.forEach(e=>e(t))}function hr(e){return e.snapshot.nodes[e.snapshot.rootId]?.visibleSubtreeCount??0}function gr(e,t){if(e.snapshot.options.flattenEmptyDirectories!==!0)return null;let n=e.snapshot.nodes[t];if(n==null||!B(n)||Vt(n,2))return null;let r=e.snapshot.directories.get(t);if(r==null||r.childIds.length!==1)return null;let i=r.childIds[0];if(i==null)return null;let a=e.snapshot.nodes[i];return a==null||!B(a)?null:i}function _r(e,t){let n=t;for(;;){let t=gr(e,n);if(t==null)return n;n=t}}function vr(e,t){let n=[t],r=t;for(;;){let t=gr(e,r);if(t==null)return n;n.push(t),r=t}}function yr(e,t){let n=t==null?e.snapshot.rootId:Or(e,t);return n==null?[]:Ar(e,n)}function br(e,t){let n=ln(t),r=n.isDirectory?n.segments:n.segments.slice(0,-1),i=Gr(e,Wr(e,r)),{createdNodeIds:a,directoryId:o}=jr(e,r),s=new Set(a),c=o;if(n.isDirectory){let n=W(e,o);if(Vt(n,1))throw Error(`Path already exists: "${t}"`);Ht(n,1),e.pathCacheByNodeId.set(o,{path:t,version:e.pathCacheVersion}),s.add(o)}else c=Nr(e,o,n.basename),s.add(c);Tr(e,o);let l=Gr(e,o);return qn({affectedAncestorIds:Dr(e,c),affectedNodeIds:[...s],path:t,projectionChanged:Kr(i,l)})}function xr(e,t,n){let r=Or(e,t);if(r==null)throw Error(`Path does not exist: "${t}"`);let i=W(e,r);if(Vt(i,2))throw Error(`The root node cannot be removed`);if(B(i)&&U(e,r).childIds.length>0&&n.recursive!==!0)throw Error(`Cannot remove a non-empty directory without recursive: "${t}"`);let a=i.parentId,o=Gr(e,a),s=Hr(e,r);Ir(e,a,r,i.nameId),Ur(e,a),Tr(e,a);let c=Gr(e,a);return Jn({affectedAncestorIds:Dr(e,a),affectedNodeIds:s,path:t,projectionChanged:Kr(o,c),recursive:n.recursive===!0})}function Sr(e,t,n,r){let i=Or(e,t);if(i==null)throw Error(`Source path does not exist: "${t}"`);let a=W(e,i);if(Vt(a,2))throw Error(`The root node cannot be moved`);let o=r.collision??`error`,s=Br(e,i,n),c=Gr(e,a.parentId),l=Gr(e,s.parentId),u=mn(e.snapshot.segmentTable,a.nameId),d=pn(e.snapshot.segmentTable,s.basename);if(s.parentId===a.parentId&&u===s.basename)return null;if(B(a)&&Xr(e,i,s.parentId))throw Error(`Cannot move a directory into one of its descendants`);let f=Ct(e.snapshot.nodes,U(e,s.parentId)).get(d),p=s.existingNodeId??f??null;if(p!=null&&p!==i&&Vr(e,p,o,zt(a))===`skip`)return null;let m=a.parentId;Ir(e,m,i,a.nameId),a.parentId=s.parentId,a.nameId=d,e.pathCacheByNodeId.delete(i),Yr(e,i),Fr(e,s.parentId,i),Ur(e,m),e.pathCacheVersion++,Tr(e,m),s.parentId!==m&&Tr(e,s.parentId);let h=Gr(e,m),g=Gr(e,s.parentId);return Yn({affectedAncestorIds:[...new Set([...Dr(e,m),...Dr(e,s.parentId)])],affectedNodeIds:[i],from:t,projectionChanged:qr([c,l],[h,g]),to:H(e,i)})}function Cr(e,t){let n=e.pathCacheByNodeId.get(t);return n!=null&&n.version===e.pathCacheVersion?n.path:null}function wr(e,t,n){return e.pathCacheByNodeId.set(t,{path:n,version:e.pathCacheVersion}),n}function H(e,t){let n=W(e,t),r=Cr(e,t);if(r!=null)return r;if(Vt(n,2))return wr(e,t,``);let i=H(e,n.parentId),a=mn(e.snapshot.segmentTable,n.nameId),o=i.length===0?a:`${i}${a}`;return wr(e,t,B(n)?`${o}/`:o)}function Tr(e,t){let n=e.instrumentation;if(n==null){Qr(e,t);return}V(n,`store.recomputeCountsUpwardFrom`,()=>Qr(e,t))}function Er(e,t){let n=[[t,0]],{nodes:r,directories:i}=e.snapshot;for(;n.length>0;){let t=n[n.length-1],a=t[0],o=r[a];if(o==null||!B(o)){Zr(e,a,o,!0),n.pop();continue}let s=i.get(a);if(s==null||t[1]>=s.childIds.length){Zr(e,a,o,!0),n.pop();continue}let c=s.childIds[t[1]++];n.push([c,0])}}function Dr(e,t){let n=[],r=t;for(;r!=null;){let t=W(e,r);if(n.push(r),r===e.snapshot.rootId)break;r=t.parentId}return n}function Or(e,t){if(t.length===0)return e.snapshot.rootId;let n=un(t);return kr(e,n.segments,n.requiresDirectory)}function kr(e,t,n){let r=e.snapshot.rootId;for(let n of t){let t=e.snapshot.segmentTable.idByValue.get(n);if(t===void 0)return null;let i=U(e,r),a=Ct(e.snapshot.nodes,i).get(t);if(a===void 0)return null;r=a}let i=W(e,r);return n&&!B(i)?null:r}function U(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 W(e,t){let n=e.snapshot.nodes[t];if(n===void 0||Vt(n,4))throw Error(`Unknown node ID: ${String(t)}`);return n}function Ar(e,t){let n=e.snapshot.nodes[t];if(n===void 0||Vt(n,4))return[];if(!B(n))return[H(e,t)];if(U(e,t).childIds.length===0)return Vt(n,1)&&!Vt(n,2)?[H(e,t)]:[];let r=[],i=[{childIndex:0,nodeId:t}];for(;i.length>0;){let t=i[i.length-1];if(t==null)break;let n=e.snapshot.nodes[t.nodeId];if(n===void 0||Vt(n,4)){i.pop();continue}if(!B(n)){r.push(H(e,t.nodeId)),i.pop();continue}let a=U(e,t.nodeId);if(a.childIds.length===0){Vt(n,1)&&!Vt(n,2)&&r.push(H(e,t.nodeId)),i.pop();continue}let o=a.childIds[t.childIndex];if(o==null){i.pop();continue}t.childIndex++,i.push({childIndex:0,nodeId:o})}return r}function jr(e,t){let n=[],r=e.snapshot.rootId;for(let i of t){let t=pn(e.snapshot.segmentTable,i),a=U(e,r),o=Ct(e.snapshot.nodes,a).get(t);if(o!==void 0){if(!B(W(e,o)))throw Error(`Cannot create a directory that collides with an existing file: "${i}"`);r=o;continue}r=Mr(e,r,t),n.push(r)}return{createdNodeIds:n,directoryId:r}}function Mr(e,t,n){let r=W(e,t),i=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:Lt(Rt(r)+1,0,1),nameId:n,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),e.snapshot.directories.set(i,xt()),Fr(e,t,i),e.collapseNewDirectoriesByDefault&&(e.collapsedDirectoryIds.add(i),e.hasCollapsedDirectoryOverrides=!0),e.activeNodeCount++,i}function Nr(e,t,n){let r=pn(e.snapshot.segmentTable,n),i=U(e,t);if(Ct(e.snapshot.nodes,i).has(r))throw Error(`Path already exists: "${ei(e,t,n)}"`);let a=W(e,t),o=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:Lt(Rt(a)+1,0),nameId:r,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),Fr(e,t,o),e.activeNodeCount++,o}function Pr(e,t,n){let r=0,i=t.childIds.length;for(;r<i;){let a=r+i>>>1,o=t.childIds[a];if(o==null){i=a;continue}Lr(e,n,o)<0?i=a:r=a+1}return r}function Fr(e,t,n){let r=U(e,t),i=W(e,n);Ct(e.snapshot.nodes,r).set(i.nameId,n),Ot(r,n,i.subtreeNodeCount,i.visibleSubtreeCount);let a=Pr(e,r,n);r.childIds.splice(a,0,n),Et(r,a),jt(e.snapshot.nodes,r)}function Ir(e,t,n,r){let i=U(e,t),a=wt(i),o=a.get(n)??-1;Ct(e.snapshot.nodes,i).delete(r),a.delete(n);let s=e.snapshot.nodes[n];s!=null&&Ot(i,n,-s.subtreeNodeCount,-s.visibleSubtreeCount),o>=0&&(i.childIds.splice(o,1),Et(i,o),jt(e.snapshot.nodes,i))}function Lr(e,t,n){let r=e.snapshot.options.sort;return r==="default"?Rr(e,t,n):r(zr(e,t),zr(e,n))}function Rr(e,t,n){let r=W(e,t),i=W(e,n),a=B(r);if(a!==B(i))return a?-1:1;let o=Qt(on(e.snapshot.segmentTable,r.nameId),on(e.snapshot.segmentTable,i.nameId));if(o!==0)return o;let s=mn(e.snapshot.segmentTable,r.nameId),c=mn(e.snapshot.segmentTable,i.nameId);return s===c?t<n?-1:1:s<c?-1:1}function zr(e,t){let n=W(e,t),r=H(e,t),i=B(n),a=i?r.slice(0,-1):r;return{basename:mn(e.snapshot.segmentTable,n.nameId),depth:Rt(n),isDirectory:i,path:r,segments:a.length===0?[]:a.split(`/`)}}function Br(e,t,n){let r=W(e,t),i=Or(e,n);if(i!=null){let t=W(e,i);if(B(t))return{basename:mn(e.snapshot.segmentTable,r.nameId),existingNodeId:null,parentId:i};let a=un(n).segments;return{basename:a[a.length-1]??``,existingNodeId:i,parentId:t.parentId}}let a=un(n),o=a.segments[a.segments.length-1]??``,s=a.segments.slice(0,-1),c=s.length===0?e.snapshot.rootId:kr(e,s,!0);if(c==null)throw Error(`Destination parent does not exist: "${n}"`);return{basename:o,existingNodeId:null,parentId:c}}function Vr(e,t,n,r){if(n===`skip`)return`skip`;if(n===`error`)throw Error(`Destination already exists: "${H(e,t)}"`);let i=W(e,t);if(zt(i)!==r)throw Error(`replace collision requires the same source and destination kinds`);if(B(i)&&U(e,t).childIds.length>0)throw Error(`replace collision does not support non-empty directories`);let a=i.parentId,o=i.nameId;return Hr(e,t),Ir(e,a,t,o),Ur(e,a),Tr(e,a),`handled`}function Hr(e,t){let n=[],r=[{nodeId:t,visitedChildren:!1}];for(;r.length>0;){let t=r.pop();if(t==null)break;let i=W(e,t.nodeId);if(t.visitedChildren||!B(i)){B(i)&&e.snapshot.directories.delete(t.nodeId),Ht(i,4),e.pathCacheByNodeId.delete(t.nodeId),e.collapsedDirectoryIds.delete(t.nodeId)&&(e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0),e.expandedDirectoryIds.delete(t.nodeId),Gn(e,t.nodeId),e.activeNodeCount--,n.push(t.nodeId);continue}r.push({nodeId:t.nodeId,visitedChildren:!0});let a=U(e,t.nodeId);for(let e=a.childIds.length-1;e>=0;e--){let t=a.childIds[e];t!=null&&r.push({nodeId:t,visitedChildren:!1})}}return n}function Ur(e,t){let n=t;for(;n!=null;){let t=W(e,n);if(!B(t)||Vt(t,2)||U(e,n).childIds.length>0)return;Ht(t,1),n=t.parentId===n?null:t.parentId}}function Wr(e,t){let n=e.snapshot.rootId;for(let r of t){let t=e.snapshot.segmentTable.idByValue.get(r);if(t==null)break;let i=Ct(e.snapshot.nodes,U(e,n)).get(t);if(i==null||!B(W(e,i)))break;n=i}return n}function Gr(e,t){let n=Jr(e,t);if(n==null)return null;let r=_r(e,n),i=W(e,r),a=n===r?null:vr(e,n).map(t=>H(e,t));return JSON.stringify({flattenedSegmentPaths:a,hasChildren:U(e,r).childIds.length>0,path:H(e,r),terminalKind:zt(i)})}function Kr(e,t){return qr([e],[t])}function qr(e,t){for(let n=0;n<e.length;n+=1){let r=e[n],i=t[n];if(r==null||i==null||r!==i)return!0}return!1}function Jr(e,t){let n=t;for(;n!=null;){let t=W(e,n);if(!B(t)||Vt(t,2))return null;if(!In(e,n,t))return n;n=t.parentId}return null}function Yr(e,t){let n=W(e,t);if(Ut(n,(t===e.snapshot.rootId?-1:Rt(W(e,n.parentId)))+1),!B(n))return;let r=U(e,t);for(let t of r.childIds)Yr(e,t)}function Xr(e,t,n){let r=n;for(;r!=null;){if(r===t)return!0;let n=W(e,r);if(r===e.snapshot.rootId)return!1;r=n.parentId}return!1}function Zr(e,t,n=W(e,t),r=!1){let i=e.instrumentation;if(i==null){$r(e,t,n,r);return}V(i,`store.recomputeNodeCounts`,()=>$r(e,t,n,r))}function Qr(e,t){let n=t;for(;n!=null;){let t=W(e,n),r=t.subtreeNodeCount,i=t.visibleSubtreeCount;if(Zr(e,n,t),n===e.snapshot.rootId)return;let a=t.subtreeNodeCount-r,o=t.visibleSubtreeCount-i,s=t.parentId;(a!==0||o!==0)&&Ot(U(e,s),n,a,o),n=s}}function $r(e,t,n,r){if(!B(n)){n.subtreeNodeCount=1,n.visibleSubtreeCount=1;return}let i=U(e,t);if(r){let t=e.instrumentation;t==null?Dt(e.snapshot.nodes,i):V(t,`store.recomputeNodeCounts.rebuildChildAggregates`,()=>Dt(e.snapshot.nodes,i))}let a=1+i.totalChildSubtreeNodeCount,o=i.totalChildVisibleSubtreeCount;if(n.subtreeNodeCount=a,Vt(n,2)){n.visibleSubtreeCount=o;return}n.visibleSubtreeCount=gr(e,t)==null?In(e,t,n)?1+o:1:o}function ei(e,t,n){let r=H(e,t);return r.length===0?n:`${r}${n}`}function ti(e){return e!=null&&!Vt(e,4)}function ni(e,t){let n=e.snapshot.nodes[t];return!ti(n)||!B(n)||Vt(n,2)?null:n}function ri(e){let t=0;for(let[n,r]of e.pathCacheByNodeId)r.version===e.pathCacheVersion&&ti(e.snapshot.nodes[n])&&(t+=1);return t}function ii(e){return Math.max(0,e.valueById.length-1)}function ai(e){return{activeNodeCount:e.activeNodeCount,cachedPathEntryCount:ri(e),loadInfoEntryCount:e.directoryLoadInfoById.size,segmentCount:ii(e.snapshot.segmentTable),totalNodeSlotCount:Math.max(0,e.snapshot.nodes.length-1)}}function oi(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 si(e){let t=[],n=[];for(let n of e.collapsedDirectoryIds)ni(e,n)!=null&&t.push(H(e,n));for(let t of e.expandedDirectoryIds)ni(e,t)!=null&&n.push(H(e,t));return{collapsedPaths:t,expandedPaths:n}}function ci(e){let t=[];for(let[n,r]of e.directoryLoadInfoById)ni(e,n)==null||zn(e,n)===`loaded`||t.push({info:{activeAttemptId:null,errorMessage:r.errorMessage,nextAttemptId:r.nextAttemptId,state:r.state},path:H(e,n)});return t}function li(e,t){e.collapsedDirectoryIds.clear(),e.hasCollapsedDirectoryOverrides=!1,e.expandedDirectoryIds.clear();for(let n of t.expandedPaths){let t=Or(e,n);t!=null&&Ln(e,t,!0,W(e,t))}for(let n of t.collapsedPaths){let t=Or(e,n);t!=null&&Ln(e,t,!1,W(e,t))}}function ui(e,t){e.directoryLoadInfoById.clear();for(let n of t){let t=Or(e,n.path);t!=null&&ni(e,t)!=null&&e.directoryLoadInfoById.set(t,{activeAttemptId:null,errorMessage:n.info.errorMessage,nextAttemptId:n.info.nextAttemptId,state:n.info.state})}}function di(e){e.pathCacheVersion+=1,e.pathCacheByNodeId.clear(),e.pathCacheByNodeId.set(e.snapshot.rootId,{path:``,version:e.pathCacheVersion})}function fi(e){let t=e.snapshot.segmentTable,n=fn();for(let r of e.snapshot.nodes)if(ti(r)){if(Vt(r,2)){r.nameId=0;continue}r.nameId=pn(n,mn(t,r.nameId))}e.snapshot.segmentTable=n}function pi(e){for(let[t,n]of e.snapshot.directories){let r=e.snapshot.nodes[t];if(!ti(r)||!B(r)){e.snapshot.directories.delete(t);continue}let i=n.childIds.filter(n=>{let r=e.snapshot.nodes[n];return ti(r)&&r.parentId===t});n.childIds=i,n.childIdByNameId=new Map(i.map(t=>[W(e,t).nameId,t])),n.childPositionById=new Map(i.map((e,t)=>[e,t])),Dt(e.snapshot.nodes,n)}}function mi(e){let t=e.snapshot.nodes.length-1;for(;t>e.snapshot.rootId;){let n=e.snapshot.nodes[t];if(ti(n))break;--t}e.snapshot.nodes.length=t+1}function hi(e){let t=si(e),n=ci(e);V(e.instrumentation,`store.cleanup.stable.clearPathCaches`,()=>di(e)),V(e.instrumentation,`store.cleanup.stable.rebuildSegmentTable`,()=>fi(e)),V(e.instrumentation,`store.cleanup.stable.rebuildDirectoryIndexes`,()=>pi(e)),V(e.instrumentation,`store.cleanup.stable.trimTrailingRemovedNodeSlots`,()=>mi(e)),V(e.instrumentation,`store.cleanup.stable.restoreExpansionOverrides`,()=>li(e,t)),V(e.instrumentation,`store.cleanup.stable.restoreDirectoryLoadInfos`,()=>ui(e,n)),V(e.instrumentation,`store.cleanup.stable.recomputeCounts`,()=>Er(e,e.snapshot.rootId))}function gi(e){let t=si(e),n=ci(e),r=V(e.instrumentation,`store.cleanup.aggressive.listPaths`,()=>yr(e)),i=Gt({...e.snapshot.options},e.instrumentation),a=V(e.instrumentation,`store.cleanup.aggressive.rebuildSnapshot`,()=>{let e=new jn(i);return e.appendPaths(r),e.finish()});e.snapshot=a,e.activeNodeCount=a.nodes.length-1,e.pathCacheByNodeId=new Map([[a.rootId,{path:``,version:0}]]),e.pathCacheVersion=0,V(e.instrumentation,`store.cleanup.aggressive.restoreExpansionOverrides`,()=>li(e,t)),V(e.instrumentation,`store.cleanup.aggressive.restoreDirectoryLoadInfos`,()=>ui(e,n)),V(e.instrumentation,`store.cleanup.aggressive.recomputeCounts`,()=>Er(e,e.snapshot.rootId))}function _i(e){for(let t of e.directoryLoadInfoById.values())if(t.state===`loading`&&t.activeAttemptId!=null)return!0;return!1}function vi(e,t){let n=ai(e);t===`stable`?V(e.instrumentation,`store.cleanup.stable`,()=>hi(e)):V(e.instrumentation,`store.cleanup.aggressive`,()=>gi(e));let r=ai(e);return oi(t,t===`stable`,n,r)}var yi=64;function bi(e,t){let n=t+2;if(n<=e.length)return e;let r=e.length;for(;r<n;)r*=2;let i=new Int32Array(r);return i.fill(-1),i.set(e),i}function xi(e){return W(e,e.snapshot.rootId).visibleSubtreeCount}function Si(e,t,n,r){let i=W(e,t.terminalNodeId),a=Math.max(1,i.visibleSubtreeCount);return Math.min(r-1,n+a-1)}function Ci(e,t,n,r){return{ancestorPaths:r,index:t.index,posInSet:t.posInSet,row:Hi(e,t.cursor),setSize:t.setSize,subtreeEndIndex:Si(e,t.cursor,t.index,n)}}function wi(e,t,n,r,i,a){let o=U(e,t),{childIndex:s,childVisibleIndex:c,localVisibleIndex:l}=kt(e.snapshot.nodes,o,n),u=o.childIds[s];if(u==null)throw Error(`Visible index ${String(n)} is out of range`);return Ti(e,u,l,r+c,i+1,s,o.childIds.length,a)}function Ti(e,t,n,r,i,a,o,s){if(!B(W(e,t))){if(n===0)return{ancestors:s,cursor:{headNodeId:t,terminalNodeId:t,visibleDepth:i},index:r,posInSet:a,setSize:o};throw Error(`Visible index ${String(n)} is out of range for file`)}let c=Ii(e,t,i);if(n===0)return{ancestors:s,cursor:c,index:r,posInSet:a,setSize:o};let l=W(e,c.terminalNodeId);if(!B(l)||!In(e,c.terminalNodeId,l))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return wi(e,c.terminalNodeId,n-1,r+1,c.visibleDepth,[...s,{cursor:c,index:r,posInSet:a,setSize:o}])}function Ei(e,t){let n=xi(e);if(t<0||t>=n)return null;let r=wi(e,e.snapshot.rootId,t,0,-1,[]),i=r.ancestors.map(t=>H(e,t.cursor.terminalNodeId)),a=null;return{ancestorPaths:i,get ancestorRows(){if(a!=null)return a;let t=[],i=[];for(let a of r.ancestors){let r=Ci(e,a,n,[...i]);t.push(r),i.push(r.row.path)}return a=t,a},index:r.index,posInSet:r.posInSet,row:Hi(e,r.cursor),setSize:r.setSize,subtreeEndIndex:Si(e,r.cursor,r.index,n)}}function Di(e,t,n){let r=e.instrumentation,i=xi(e);if(i<=0||n<t)return[];let a=Math.max(0,Math.min(t,i-1)),o=Math.max(a,Math.min(n,i-1));if(r==null){if(a===0)return Vi(e,o+1);let t=[],n=Ni(e,a);for(let r=a;r<=o&&n!=null;r++){let r=Hi(e,n);t.push(r),n=Ri(e,n)}return t}let s=[],c=0,l=0,u=V(r,`store.getVisibleSlice.selectFirstRow`,()=>Ni(e,a));for(let t=a;t<=o&&u!=null;t++){let t=V(r,`store.getVisibleSlice.materializeRow`,()=>Hi(e,u));s.push(t),t.isFlattened&&(c++,l+=t.flattenedSegments?.length??0),u=V(r,`store.getVisibleSlice.advanceCursor`,()=>Ri(e,u))}return qt(r,`workload.visibleRowsRead`,s.length),qt(r,`workload.flattenedRowsRead`,c),qt(r,`workload.flattenedSegmentsRead`,l),s}function Oi(e,t=xi(e)){let n=e.instrumentation;return n==null?Bi(e,t):V(n,`store.getVisibleTreeProjection`,()=>Bi(e,t))}function ki(e){return zi(Oi(e))}function Ai(e,t){let n=Or(e,t);if(n==null||n===e.snapshot.rootId||B(W(e,n))&&_r(e,n)!==n)return null;let r=0,i=n,{nodes:a,rootId:o}=e.snapshot;for(;i!==o;){let t=W(e,i).parentId,n=U(e,t),s=wt(n).get(i);if(s==null)throw Error(`Child ${String(i)} was not found in its parent index`);if(r+=At(a,n,s),t!==o){let n=W(e,t),a=gr(e,t);if(!In(e,t,n)&&a!==i)return null;_r(e,t)===t&&(r+=1)}i=t}return r}function ji(e,t){let n=Or(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=W(e,n);if(!B(r))throw Error(`Path is not a directory: "${t}"`);return In(e,n,r)?null:(Ln(e,n,!0,r),Tr(e,n),Xn({affectedAncestorIds:Dr(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0}))}function Mi(e,t){let n=Or(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=W(e,n);if(!B(r))throw Error(`Path is not a directory: "${t}"`);return In(e,n,r)?(Ln(e,n,!1,r),Tr(e,n),Zn({affectedAncestorIds:Dr(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0})):null}function Ni(e,t){return t<0||t>=xi(e)?null:Pi(e,e.snapshot.rootId,t,-1)}function Pi(e,t,n,r){let i=U(e,t),a=e.instrumentation,{childIndex:o,localVisibleIndex:s}=a==null?kt(e.snapshot.nodes,i,n):V(a,`store.getVisibleSlice.selectChildIndex`,()=>kt(e.snapshot.nodes,i,n)),c=i.childIds[o];if(c!=null)return Fi(e,c,s,r+1);throw Error(`Visible index ${String(n)} is out of range`)}function Fi(e,t,n,r){if(!B(W(e,t))){if(n===0)return{headNodeId:t,terminalNodeId:t,visibleDepth:r};throw Error(`Visible index ${String(n)} is out of range for file`)}let i=Ii(e,t,r);if(n===0)return i;let a=W(e,i.terminalNodeId);if(!B(a)||!In(e,i.terminalNodeId,a))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return Pi(e,i.terminalNodeId,n-1,i.visibleDepth)}function Ii(e,t,n){return B(W(e,t))?e.instrumentation==null?{headNodeId:t,terminalNodeId:_r(e,t),visibleDepth:n}:{headNodeId:t,terminalNodeId:V(e.instrumentation,`store.getVisibleSlice.flatten.resolveTerminalDirectory`,()=>_r(e,t)),visibleDepth:n}:{headNodeId:t,terminalNodeId:t,visibleDepth:n}}function Li(e,t){let n=W(e,t);if(!B(n))return!0;let r=n.parentId;return r===e.snapshot.rootId?!0:gr(e,r)!==t}function Ri(e,t){let n=W(e,t.terminalNodeId);if(B(n)){let r=U(e,t.terminalNodeId);if(In(e,t.terminalNodeId,n)&&r.childIds.length>0){let n=r.childIds[0];return n==null?null:Fi(e,n,0,t.visibleDepth+1)}}let r=t.terminalNodeId,i=t.visibleDepth;for(;;){let t=W(e,r);if(r===e.snapshot.rootId)return null;let n=t.parentId,a=U(e,n),o=wt(a).get(r)??-1;if(o<0)throw Error(`Child ${String(r)} was not found in its parent index`);let s=a.childIds[o+1]??null;if(s!=null)return Fi(e,s,0,i);Li(e,r)&&i--,r=n}}function zi(e){let t=e.paths.length,n=Array(t);for(let r=0;r<t;r+=1){let t=e.getParentIndex(r);n[r]={index:r,parentPath:t>=0?e.paths[t]??null:null,path:e.paths[r]??``,posInSet:e.posInSetByIndex[r]??0,setSize:e.setSizeByIndex[r]??0}}return{getParentIndex:e.getParentIndex,rows:n,get visibleIndexByPath(){return e.visibleIndexByPath}}}function Bi(e,t){let n=Array(t),r=new Int32Array(t),i=new Int32Array(t),a=new Int32Array(t),o=new Int32Array(yi);o.fill(-1);let s=0,{nodes:c,directories:l,segmentTable:u}=e.snapshot,d=[[l.get(e.snapshot.rootId),0,-1,``]],f=e.snapshot.options.flattenEmptyDirectories,p=e.pathCacheByNodeId,m=e.pathCacheVersion,h=u.valueById;for(;d.length>0&&s<t;){let t=d[d.length-1],u=t[0];if(t[1]>=u.childIds.length){d.pop();continue}let g=t[1],_=u.childIds[t[1]++],v=c[_],y=t[2]+1,b=t[3];o=bi(o,y);let x,S=_;if(B(v))S=f?_r(e,_):_,x=S===_?`${b}${h[v.nameId]}/`:H(e,S);else{let e=p.get(_);x=e!=null&&e.version===m?e.path:`${b}${h[v.nameId]}`}r[s]=o[y],n[s]=x,i[s]=g,a[s]=u.childIds.length,o[y+1]=s,s+=1;let C=c[S];C!=null&&B(C)&&In(e,S,C)&&d.push([l.get(S),0,y,x])}s<t&&(n.length=s);let g=r.subarray(0,s),_=i.subarray(0,s),v=a.subarray(0,s),y=null;return{getParentIndex(e){return e<0||e>=s?-1:g[e]??-1},paths:n,posInSetByIndex:_,setSizeByIndex:v,get visibleIndexByPath(){if(y==null){y=new Map;for(let e=0;e<s;e+=1)y.set(n[e]??``,e)}return y}}}function Vi(e,t){let n=Array(t),r=0,{nodes:i,directories:a,segmentTable:o}=e.snapshot,s=[[a.get(e.snapshot.rootId),0,-1]],c=o.valueById,l=e.snapshot.options.flattenEmptyDirectories,u=e.pathCacheByNodeId,d=e.pathCacheVersion;for(;s.length>0&&r<t;){let t=s[s.length-1],o=t[0];if(t[1]>=o.childIds.length){s.pop();continue}let f=o.childIds[t[1]++],p=i[f],m=t[2]+1;if(!B(p)){let t=u.get(f);n[r++]={depth:m,flattenedSegments:void 0,hasChildren:!1,id:f,isExpanded:!1,isFlattened:!1,isLoading:!1,kind:`file`,loadState:void 0,name:c[p.nameId],path:t!=null&&t.version===d?t.path:H(e,f)};continue}let h=l?_r(e,f):f,g={headNodeId:f,terminalNodeId:h,visibleDepth:m};n[r++]=Hi(e,g);let _=i[h];_!=null&&B(_)&&In(e,h,_)&&s.push([a.get(h),0,m])}return r<t&&(n.length=r),n}function Hi(e,t){let n=W(e,t.terminalNodeId),r=B(n)?Ui(e,t):null,i=H(e,t.terminalNodeId),a=mn(e.snapshot.segmentTable,n.nameId),o=B(n)&&U(e,t.terminalNodeId).childIds.length>0,s=t.headNodeId!==t.terminalNodeId,c=e.instrumentation,l=s?c==null?vr(e,t.headNodeId).map(n=>{let r=W(e,n);return{isTerminal:n===t.terminalNodeId,name:mn(e.snapshot.segmentTable,r.nameId),nodeId:n,path:H(e,n)}}):V(c,`store.getVisibleSlice.flatten.collectSegments`,()=>vr(e,t.headNodeId).map(n=>{let r=W(e,n);return{isTerminal:n===t.terminalNodeId,name:mn(e.snapshot.segmentTable,r.nameId),nodeId:n,path:H(e,n)}})):void 0;return{depth:t.visibleDepth,flattenedSegments:l,hasChildren:o,id:t.terminalNodeId,isExpanded:B(n)&&In(e,t.terminalNodeId,n),isFlattened:s,isLoading:r===`loading`,kind:B(n)?`directory`:`file`,loadState:r==null||r===`loaded`?void 0:r,name:a,path:i}}function Ui(e,t){if(t.headNodeId===t.terminalNodeId)return zn(e,t.terminalNodeId);let n=vr(e,t.headNodeId),r=!1,i=!1;for(let t of n){let n=zn(e,t);if(n===`loading`)return`loading`;if(n===`error`){i=!0;continue}n===`unloaded`&&(r=!0)}return i?`error`:r?`unloaded`:`loaded`}function Wi(e){let{directories:t,nodes:n,options:r,rootId:i,presortedDirectoryNodeIds:a}=e.snapshot,o=r.flattenEmptyDirectories===!0,s=e=>{let r=n[e];if(r==null||!B(r))return;let i=t.get(e);if(i==null)throw Error(`Unknown directory child index for node ${String(e)}`);let a=i.childIds,s=a.length,c=0,l=0;for(let e=0;e<s;e++){let t=a[e];if(t==null)continue;let r=n[t];c+=r.subtreeNodeCount,l+=r.visibleSubtreeCount}i.totalChildSubtreeNodeCount=c,i.totalChildVisibleSubtreeCount=l,s>=128&&jt(n,i),r.subtreeNodeCount=1+c;let u;if(o&&s===1){let e=n[a[0]];u=e!=null&&B(e)?l:1+l}else u=1+l;r.visibleSubtreeCount=u};if(a!=null)for(let e=a.length-1;e>=0;e--)s(a[e]);else for(let e=n.length-1;e>=1;e--)s(e);let c=n[i],l=t.get(i);if(c==null||l==null)return;let u=l.childIds,d=0,f=0;for(let e=0;e<u.length;e++){let t=u[e];if(t==null)continue;let r=n[t];d+=r.subtreeNodeCount,f+=r.visibleSubtreeCount}l.totalChildSubtreeNodeCount=d,l.totalChildVisibleSubtreeCount=f,jt(n,l),c.subtreeNodeCount=1+d,c.visibleSubtreeCount=f}function Gi(e){return e.initialExpansion===`open`&&(e.initialExpandedPaths==null||e.initialExpandedPaths.length===0)}var Ki=class e{#e;constructor(e={}){let t=Kt(e),n=V(t,`store.builder.create`,()=>new jn(e));if(e.preparedInput!=null){let t=On(e.preparedInput);t==null?n.appendPreparedPaths(Dn(e.preparedInput),!1):n.appendPresortedPaths(t,kn(e.preparedInput))}else{let r=e.paths??[];e.presorted===!0?n.appendPaths(r):n.appendPreparedPaths(V(t,`store.preparePathEntries`,()=>An(r,e)))}let r=V(t,`store.builder.finish`,()=>n.finish({skipSubtreeCountPass:!0})),i=V(t,`store.state.detectAllDirectoriesExpanded`,()=>(e.initialExpansion??`closed`)===`closed`&&n.didMatchAllInitialExpandedPaths());this.#e=V(t,`store.state.create`,()=>Mn(r,i?`open`:e.initialExpansion??`closed`,t)),i&&(this.#e.collapseNewDirectoriesByDefault=!0);let a=i?this.#e.snapshot.directories.size-1:V(t,`store.state.initializeExpandedPaths`,()=>this.initializeExpandedPaths(e.initialExpandedPaths));i||Gi(e)||(e.initialExpansion??`closed`)===`closed`&&a===this.#e.snapshot.directories.size-1||(e.initialExpandedPaths?.length??0)>0&&V(t,`store.state.checkAllDirectoriesExpanded`,()=>this.hasAllDirectoriesExpanded())?V(t,`store.state.initializeOpenVisibleCounts`,()=>Wi(this.#e)):V(t,`store.state.recomputeCounts`,()=>Er(this.#e,this.#e.snapshot.rootId))}static preparePaths(e,t={}){return wn(e,t)}static prepareInput(e,t={}){return Tn(e,t)}static preparePresortedInput(e){return En(e)}list(e){return V(this.#e.instrumentation,`store.list`,()=>yr(this.#e,e))}add(e){V(this.#e.instrumentation,`store.add`,()=>{let t=xi(this.#e);or(this.#e,ir(this.#e,t,br(this.#e,e)))})}remove(e,t={}){V(this.#e.instrumentation,`store.remove`,()=>{let n=xi(this.#e);or(this.#e,ir(this.#e,n,xr(this.#e,e,t)))})}move(e,t,n={}){V(this.#e.instrumentation,`store.move`,()=>{let r=xi(this.#e),i=Sr(this.#e,e,t,n);i!=null&&or(this.#e,ir(this.#e,r,i))})}batch(e){ar(this.#e,()=>{if(typeof e==`function`){e(this);return}for(let t of e)switch(t.type){case`add`:this.add(t.path);break;case`remove`:this.remove(t.path,{recursive:t.recursive});break;case`move`:this.move(t.from,t.to,{collision:t.collision});break}})}getVisibleCount(){return V(this.#e.instrumentation,`store.getVisibleCount`,()=>xi(this.#e))}getVisibleSlice(e,t){return V(this.#e.instrumentation,`store.getVisibleSlice`,()=>Di(this.#e,e,t))}getVisibleRowContext(e){return V(this.#e.instrumentation,`store.getVisibleRowContext`,()=>Ei(this.#e,e))}getVisibleTreeProjection(){return ki(this.#e)}getVisibleTreeProjectionData(e){return Oi(this.#e,e)}getVisibleIndex(e){return V(this.#e.instrumentation,`store.getVisibleIndex`,()=>Ai(this.#e,e))}getPathInfo(e){return V(this.#e.instrumentation,`store.getPathInfo`,()=>{let t=Or(this.#e,e);if(t==null)return null;let n=W(this.#e,t);return{depth:Rt(n),kind:B(n)?`directory`:`file`,path:H(this.#e,t)}})}isExpanded(e){return V(this.#e.instrumentation,`store.isExpanded`,()=>{let t=this.requireDirectoryNodeId(e),n=W(this.#e,t);return In(this.#e,t,n)})}expand(e){V(this.#e.instrumentation,`store.expand`,()=>{let t=xi(this.#e),n=ji(this.#e,e);n!=null&&or(this.#e,ir(this.#e,t,n))})}collapse(e){V(this.#e.instrumentation,`store.collapse`,()=>{let t=xi(this.#e),n=Mi(this.#e,e);n!=null&&or(this.#e,ir(this.#e,t,n))})}on(e,t){return Kn(this.#e,e,t)}getDirectoryLoadState(e){let t=this.requireDirectoryNodeId(e);return zn(this.#e,t)}markDirectoryUnloaded(e){V(this.#e.instrumentation,`store.markDirectoryUnloaded`,()=>{let t=this.requireDirectoryNodeId(e);if(U(this.#e,t).childIds.length>0)throw Error(`Cannot mark a directory with known children as unloaded: "${e}"`);let n=xi(this.#e);Vn(this.#e,t),or(this.#e,ir(this.#e,n,Qn({affectedAncestorIds:Dr(this.#e,t),affectedNodeIds:[t],path:e,projectionChanged:this.isDirectoryProjectionVisible(t)})))})}beginChildLoad(e){return V(this.#e.instrumentation,`store.beginChildLoad`,()=>{let t=this.requireDirectoryNodeId(e),n=xi(this.#e),r=Bn(this.#e,t);return or(this.#e,ir(this.#e,n,$n({affectedAncestorIds:Dr(this.#e,t),affectedNodeIds:[t],attemptId:r.attemptId,path:e,projectionChanged:this.isDirectoryProjectionVisible(t),reused:r.reused}))),r})}applyChildPatch(e,t){return V(this.#e.instrumentation,`store.applyChildPatch`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null||zn(this.#e,n)!==`loading`||!Un(this.#e,n,e.attemptId))return!1;let r=H(this.#e,n);this.validateChildPatch(r,t);let i=xi(this.#e),a=[];for(let e of t.operations){qi(r,e);let t=xi(this.#e);switch(e.type){case`add`:a.push(ir(this.#e,t,br(this.#e,e.path)));break;case`remove`:a.push(ir(this.#e,t,xr(this.#e,e.path,{recursive:e.recursive})));break;case`move`:{let n=Sr(this.#e,e.from,e.to,{collision:e.collision});n!=null&&a.push(ir(this.#e,t,n));break}}}let o=a.some(e=>e.projectionChanged)||this.isDirectoryProjectionVisible(n);return or(this.#e,ir(this.#e,i,er({affectedAncestorIds:Dr(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,childEvents:a,path:H(this.#e,n),projectionChanged:o}))),!0})}completeChildLoad(e){return V(this.#e.instrumentation,`store.completeChildLoad`,()=>{let t=this.resolveActiveDirectoryNodeId(e.nodeId);if(t==null)return!1;let n=xi(this.#e),r=Hn(this.#e,t,e.attemptId);return or(this.#e,ir(this.#e,n,tr({affectedAncestorIds:Dr(this.#e,t),affectedNodeIds:[t],attemptId:e.attemptId,path:H(this.#e,t),projectionChanged:this.isDirectoryProjectionVisible(t),stale:!r}))),r})}failChildLoad(e,t){return V(this.#e.instrumentation,`store.failChildLoad`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null)return!1;let r=xi(this.#e),i=Wn(this.#e,n,e.attemptId,t);return or(this.#e,ir(this.#e,r,nr({affectedAncestorIds:Dr(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,errorMessage:t,path:H(this.#e,n),projectionChanged:this.isDirectoryProjectionVisible(n),stale:!i}))),i})}cleanup(e={}){return V(this.#e.instrumentation,`store.cleanup`,()=>{if(this.#e.transactionStack.length>0)throw Error(`Cleanup cannot run during an open batch or transaction.`);if(_i(this.#e))throw Error(`Cleanup cannot run while directory loads are active.`);let t=xi(this.#e),n=vi(this.#e,e.mode??`stable`);return or(this.#e,ir(this.#e,t,rr({...n,affectedAncestorIds:[],affectedNodeIds:[],projectionChanged:n.idsPreserved===!1}))),n})}getNodeCount(){return this.#e.activeNodeCount}initializeExpandedPaths(e){if(e==null||e.length===0)return 0;let t=0,n=[],r=[],i=0,a=null,o=this.#e.snapshot.segmentTable,s=o.valueById,c=this.#e.snapshot.nodes,l=new Map;for(let u of e){a!=null&&u<a&&(a=null,i=0,n.length=0,r.length=0);let e=u.length>0&&u.charCodeAt(u.length-1)===47?u.length-1:u.length;if(e===0){a=u,i=e,n.length=0,r.length=0;continue}let d=0,f=0;if(a!=null){let t=Math.min(e,i),n=!0;for(let e=0;e<t;e+=1){let t=u.charCodeAt(e);if(t!==a.charCodeAt(e)){n=!1;break}t===47&&(d+=1,f=e+1)}n&&(t===i&&e>t&&u.charCodeAt(t)===47?(d+=1,f=t+1):t===e&&i>t&&a.charCodeAt(t)===47&&(d+=1,f=e+1)),d=Math.min(d,r.length)}let p=d===0?this.#e.snapshot.rootId:r[d-1]??this.#e.snapshot.rootId,m=d,h=!0,g=f;for(;g<=e;){let t=u.indexOf(`/`,g),i=t===-1||t>e?e:t,a=u.slice(g,i),f=U(this.#e,p).childIds,_=m===d?n[m]??0:0,v=_,y,b=l.get(a)??Xt(a);l.set(a,b);let x=(e,t)=>{for(v=e;v<t;v+=1){let e=f[v],t=c[e],n=s[t.nameId];if(n===a)return y=e,!0;let r=Qt(on(o,t.nameId),b);if(r>0||r===0&&n>a)return!1}return!1};if(!x(_,f.length)&&_>0&&x(0,_),y===void 0){h=!1;break}if(!B(W(this.#e,y))){h=!1;break}if(n[m]=v,r[m]=y,p=y,m+=1,i===e)break;g=i+1}if(a=u,i=e,n.length=m,r.length=m,!h){a=null,i=0,n.length=0,r.length=0;continue}for(let e=d;e<m;e+=1){let n=r[e];if(n==null)continue;let i=W(this.#e,n);In(this.#e,n,i)||(Ln(this.#e,n,!0,i),t+=1)}}return t}hasAllDirectoriesExpanded(){for(let e of this.#e.snapshot.directories.keys()){if(e===this.#e.snapshot.rootId)continue;let t=W(this.#e,e);if(!In(this.#e,e,t))return!1}return!0}requireDirectoryNodeId(e){let t=Or(this.#e,e);if(t==null)throw Error(`Path does not exist: "${e}"`);if(!B(W(this.#e,t)))throw Error(`Path is not a directory: "${e}"`);return t}resolveActiveDirectoryNodeId(e){try{if(!B(W(this.#e,e)))throw Error(`Node is not a directory: ${String(e)}`);return e}catch{return null}}isDirectoryProjectionVisible(e){let t=e;for(;t!==this.#e.snapshot.rootId;){let e=W(this.#e,t).parentId;if(e!==this.#e.snapshot.rootId){let n=W(this.#e,e),r=gr(this.#e,e);if(!In(this.#e,e,n)&&r!==t)return!1}t=e}return!0}validateChildPatch(t,n){new e({paths:this.list(t),presorted:!0,sort:this.#e.snapshot.options.sort}).batch(n.operations)}};function qi(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 Ji={compact:{itemHeight:24,factor:.8},default:{itemHeight:30,factor:1},relaxed:{itemHeight:36,factor:1.2}};function Yi(e,t){if(typeof e==`number`)return{itemHeight:t??Ji.default.itemHeight,factor:e};let n=Ji[e??`default`];return{itemHeight:t??n.itemHeight,factor:n.factor}}var Xi=Ji.default.itemHeight,Zi=`@layer base, theme, unsafe;
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{n as t,r as n,t as r}from"./compiler-runtime-CLAvuQ-D.js";import{At as i,Br as a,Ga as o,Oa as s,Ot as c,Pr as l,Q as u,U as d,Yf as f,Yl as p,_l as m,b as h,dt as g,eu as _,ft as v,gl as y,gt as b,h as x,ht as S,mt as C,n as w,o as T,sl as E,tl as D,ul as O,vt as k,wt as A,xt as ee,yt as j}from"./previewAssetResource-CVDZ-YAw.js";import{n as M,r as N,t as P}from"./renderFileChildren-cnLyJS2T.js";import{$ as te,Ar as ne,Bn as re,Cn as ie,D as ae,Dr as oe,E as se,Er as ce,Fn as le,Fr as ue,Gn as de,Gt as fe,Hn as pe,Hr as me,Ht as F,Jr as he,Jt as I,Kn as ge,Kt as _e,Mn as ve,Or as ye,Pr as be,T as xe,Tr as Se,Un as Ce,Ut as L,Vn as we,Wn as Te,Z as Ee,Zr as De,_t as Oe,an as ke,b as Ae,bn as je,ct as Me,d as Ne,ei as Pe,et as Fe,f as Ie,fn as Le,gr as Re,gt as ze,ii as Be,kr as Ve,l as He,m as Ue,mr as We,on as Ge,p as Ke,qn as qe,ri as Je,ti as Ye,tt as Xe,u as Ze,v as Qe,w as $e,wn as et,x as tt,y as nt,zr as rt}from"./index-BWxnfRz6.js";import{a as it,i as at,n as ot,r as R,t as z}from"./fileCommentAnnotations-CxfDb72Y.js";var st=O(`file-question-mark`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}],[`path`,{d:`M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3`,key:`mhlwft`}]]),ct=O(`folder-tree`,[[`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`}]]),lt=`file-tree-container`,ut=`data-file-tree-style`,dt=`data-file-tree-unsafe-css`,ft=`data-file-tree-scrollbar-measure`,pt=`data-file-tree-scrollbar-gutter-measured`,mt=`--trees-scrollbar-gutter-measured`,ht=`header`,gt=`context-menu`,_t=`context-menu-trigger`,vt=5,yt=1<<vt,bt=yt*4;function xt(){return{childIdByNameId:new Map,childIds:[],childPositionById:new Map,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function St(){return{childIdByNameId:null,childIds:[],childPositionById:null,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function Ct(e,t){if(t.childIdByNameId!=null)return t.childIdByNameId;let n=new Map;for(let r of t.childIds){let t=e[r];t!=null&&n.set(t.nameId,r)}return t.childIdByNameId=n,n}function wt(e){if(e.childPositionById!=null)return e.childPositionById;let t=new Map;for(let n=0;n<e.childIds.length;n++){let r=e.childIds[n];r!=null&&t.set(r,n)}return e.childPositionById=t,t}function Tt(e,t){e.childPositionById!=null&&e.childPositionById.set(t,e.childIds.length),e.childIds.push(t)}function Et(e,t){if(e.childPositionById!=null)for(let n=t;n<e.childIds.length;n++){let t=e.childIds[n];t!=null&&e.childPositionById.set(t,n)}}function Dt(e,t){let n=0,r=0;for(let i of t.childIds){let t=e[i];t!=null&&(n+=t.subtreeNodeCount,r+=t.visibleSubtreeCount)}t.totalChildSubtreeNodeCount=n,t.totalChildVisibleSubtreeCount=r,jt(e,t)}function Ot(e,t,n,r){if(e.totalChildSubtreeNodeCount+=n,e.totalChildVisibleSubtreeCount+=r,e.childVisibleChunkSums==null||r===0)return;let i=wt(e).get(t);if(i===void 0)return;let a=i>>vt;e.childVisibleChunkSums[a]+=r}function kt(e,t,n){let r=t.childVisibleChunkSums;if(r!=null){let i=n,a=0;for(let o of r){if(i<o){let r=Mt(e,t,a,i);return{...r,childVisibleIndex:n-r.localVisibleIndex}}i-=o,a+=yt}throw Error(`Visible child index ${String(n)} is out of range`)}let i=n;for(let r=0;r<t.childIds.length;r++){let a=t.childIds[r];if(a==null)continue;let o=e[a];if(o!=null){if(i<o.visibleSubtreeCount)return{childIndex:r,childVisibleIndex:n-i,localVisibleIndex:i};i-=o.visibleSubtreeCount}}throw Error(`Visible child index ${String(n)} is out of range`)}function At(e,t,n){let r=0,i=t.childVisibleChunkSums,a=0;if(i!=null){let e=n>>vt;for(let t=0;t<e;t+=1)r+=i[t]??0;a=e<<vt}for(let i=a;i<n;i+=1){let n=t.childIds[i];if(n==null)continue;let a=e[n];a!=null&&(r+=a.visibleSubtreeCount)}return r}function jt(e,t){if(t.childIds.length<bt){t.childVisibleChunkSums=null;return}let n=Math.ceil(t.childIds.length/yt),r=new Int32Array(n);for(let n=0;n<t.childIds.length;n++){let i=t.childIds[n];if(i==null)continue;let a=e[i];a!=null&&(r[n>>vt]+=a.visibleSubtreeCount)}t.childVisibleChunkSums=r}function Mt(e,t,n,r){let i=Math.min(t.childIds.length,n+yt),a=r;for(let r=n;r<i;r++){let n=t.childIds[r];if(n==null)continue;let i=e[n];if(i!=null){if(a<i.visibleSubtreeCount)return{childIndex:r,localVisibleIndex:a};a-=i.visibleSubtreeCount}}throw Error(`Visible child index ${String(r)} is out of range`)}var Nt=7,Pt=3,Ft=1<<Pt,It=4;function Lt(e,t,n=0){return e<<It|n<<Pt|t}function Rt(e){return e.depthAndFlags>>>It}function zt(e){return(e.depthAndFlags&Ft)>>Pt}function B(e){return(e.depthAndFlags&Ft)!==0}function Bt(e){return e.depthAndFlags&Nt}function Vt(e,t){return(Bt(e)&t)!==0}function Ht(e,t){e.depthAndFlags|=t}function Ut(e,t){e.depthAndFlags=Lt(t,Bt(e),zt(e))}var Wt=Symbol(`benchmarkInstrumentation`);function Gt(e,t){return t==null||Object.defineProperty(e,Wt,{configurable:!0,enumerable:!1,value:t,writable:!1}),e}function Kt(e){return e==null?null:e[Wt]??null}function V(e,t,n){return e==null?n():e.measurePhase(t,n)}function qt(e,t,n){!Number.isFinite(n)||e==null||e.setCounter(t,n)}function Jt(e){return e>=48&&e<=57}function Yt(e){let t=[],n=0,r=0;for(;r<e.length;){for(;r<e.length&&!Jt(e.charCodeAt(r));)r+=1;if(r>=e.length)break;r>n&&t.push(e.slice(n,r));let i=0;for(;r<e.length&&Jt(e.charCodeAt(r));)i=i*10+(e.charCodeAt(r)-48),r+=1;t.push(i),n=r}return(n<e.length||t.length===0)&&t.push(e.slice(n)),t}function Xt(e){let t=e.toLowerCase();return{lowerValue:t,tokens:Yt(t)}}function Zt(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++){let n=e[r],i=t[r];if(n===i)continue;if(typeof n==`number`&&typeof i==`number`)return n<i?-1:1;let a=String(n),o=String(i);if(a!==o)return a<o?-1:1}return e.length===t.length?0:e.length<t.length?-1:1}function Qt(e,t){if(e.tokens.length===1&&t.tokens.length===1&&typeof e.tokens[0]==`string`&&typeof t.tokens[0]==`string`)return e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1;let n=Zt(e.tokens,t.tokens);return n===0?e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1:n}function $t(e,t,n){let r=Qt(n(e),n(t));return r===0?e===t?0:e<t?-1:1:r}function en(e,t){return $t(e,t,Xt)}function tn(e,t){return t===e.segments.length-1?+!!e.isDirectory:1}function nn(e,t){let n=Math.min(e.segments.length,t.segments.length);for(let r=0;r<n;r++){let n=e.segments[r],i=t.segments[r];if(n===i)continue;let a=tn(e,r);return a===tn(t,r)?en(n,i):a===1?-1:1}return e.segments.length===t.segments.length?e.isDirectory===t.isDirectory?0:e.isDirectory?-1:1:e.segments.length<t.segments.length?-1:1}function rn(e,t){return nn(e,t)}function an(e,t,n){let r=e=>{let t=n.get(e);if(t!=null)return t;let r=Xt(e);return n.set(e,r),r},i=Math.min(e.segments.length,t.segments.length);for(let n=0;n<i;n++){let i=e.segments[n],a=t.segments[n];if(i===a)continue;let o=tn(e,n);return o===tn(t,n)?$t(i,a,r):o===1?-1:1}return e.segments.length===t.segments.length?e.isDirectory===t.isDirectory?0:e.isDirectory?-1:1:e.segments.length<t.segments.length?-1:1}function on(e,t){let n=e.sortKeyById[t];if(n!==void 0)return n;let r=e.valueById[t],i=Xt(r);return e.sortKeyById[t]=i,i}function sn(e={}){return{flattenEmptyDirectories:e.flattenEmptyDirectories!==!1,sort:e.sort??`default`}}function cn(e){let t=e.length>0&&e.charCodeAt(e.length-1)===47,n=t?e.length-1:e.length,r=[],i=0;for(let t=0;t<n;t++)e.charCodeAt(t)===47&&(r.push(e.slice(i,t)),i=t+1);return r.push(e.slice(i,n)),{hasTrailingSlash:t,segments:r}}function ln(e){let{hasTrailingSlash:t,segments:n}=cn(e);return{basename:n[n.length-1]??``,isDirectory:t,path:e,segments:n}}function un(e){if(e.length===0)return{requiresDirectory:!1,segments:[]};let{hasTrailingSlash:t,segments:n}=cn(e);return{requiresDirectory:t,segments:n}}var dn=``;function fn(){let e=new Map;return e.set(dn,0),{idByValue:e,valueById:[dn],sortKeyById:[Xt(dn)]}}function pn(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 mn(e,t){let n=e.valueById[t];if(n===void 0)throw Error(`Unknown segment ID: ${String(t)}`);return n}var hn=Symbol(`pathStorePreparedInputKind`);function gn(e,t){return e[hn]=t,e}function _n(e){return{basename:e.basename,depth:e.segments.length,isDirectory:e.isDirectory,path:e.path,segments:e.segments}}function vn(e,t,n){return n==="default"?rn(e,t):n(_n(e),_n(t))}function yn(){return{depthAndFlags:Lt(0,3,1),nameId:0,parentId:0,subtreeNodeCount:1,visibleSubtreeCount:1}}function bn(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 xn(e){return e.isDirectory?e.segments.length:e.segments.length-1}function Sn(e){return Array.isArray(e)&&e.every(e=>typeof e==`object`&&!!e&&typeof e.path==`string`&&Array.isArray(e.segments)&&typeof e.basename==`string`&&typeof e.isDirectory==`boolean`)}function Cn(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function wn(e,t={}){return An(e,t).map(e=>e.path)}function Tn(e,t={}){let n=An(e,t);return gn({paths:n.map(e=>e.path),preparedPaths:n},`prepared`)}function En(e){let t=e.length,n=!1;for(let r=0;r<t;r+=1){let t=e[r];if(t.length>0&&t.charCodeAt(t.length-1)===47){n=!0;break}}return gn({paths:e,presortedPaths:e,presortedPathsContainDirectories:n},`presorted`)}function Dn(e){let t=e,n=t.preparedPaths;if(t[hn]===`prepared`&&n!=null)return n;if(!Sn(n))throw Error(`preparedInput must come from PathStore.prepareInput()`);return n}function On(e){let t=e;return t[hn]===`presorted`&&t.presortedPaths!=null||Cn(t.presortedPaths)?t.presortedPaths:null}function kn(e){let t=e;return typeof t.presortedPathsContainDirectories==`boolean`?t.presortedPathsContainDirectories:null}function An(e,t={}){let n=sn(t),r=Kt(t);qt(r,`workload.inputFiles`,e.length);let i=V(r,`store.preparePathEntries.parse`,()=>e.map(e=>ln(e)));return V(r,`store.preparePathEntries.sort`,()=>i.sort((e,t)=>vn(e,t,n.sort))),i}var jn=class{directories=new Map;directoryStack=[0];presortedDirectoryNodeIds=[];initialExpandedPathSet;createdDirectoriesAllExpanded=!1;createdDirectoryCount=0;lastPreparedPath=null;nodes=[yn()];options;instrumentation;segmentSortKeyCache=new Map;segmentTable=fn();hasDeferredDirectoryIndexes=!1;constructor(e={}){this.instrumentation=Kt(e),this.options=sn(e);let t=e.initialExpandedPaths??null;if(t==null||t.length===0)this.initialExpandedPathSet=null;else{let e=new Set,n=t.length;for(let r=0;r<n;r+=1){let n=t[r],i=n.length;e.add(i>0&&n.charCodeAt(i-1)===47?n.slice(0,i-1):n)}this.initialExpandedPathSet=e,this.createdDirectoriesAllExpanded=!0}this.directories.set(0,xt())}appendPaths(e){return V(this.instrumentation,`store.builder.appendPaths.parse`,()=>this.appendPreparedPaths(e.map(e=>ln(e))))}appendPreparedPaths(e,t=!0){return this.createdDirectoriesAllExpanded=!1,V(this.instrumentation,`store.builder.appendPreparedPaths`,()=>{for(let n of e)this.appendPreparedPath(n,t)}),this}appendPresortedPaths(e,t=null){return V(this.instrumentation,`store.builder.appendPresortedPaths`,()=>{if(t===!1){this.appendPresortedFilePaths(e);return}this.createdDirectoriesAllExpanded=!1;let n=null,r=0,i=this.nodes,a=this.segmentTable,o=a.idByValue,s=a.valueById,c=this.directoryStack,l=0,u=``,d=0;for(let t of e){if(n===t)throw Error(`Duplicate path: "${t}"`);let e=t.length>0&&t.charCodeAt(t.length-1)===47,a=e?t.length-1:t.length,f=0,p=0;if(n!=null)if(u.length>0&&t.length>u.length&&t.startsWith(u))f=d,p=u.length;else{let r=Math.min(a,n.length),i=!0;for(let e=0;e<r;e++){let r=t.charCodeAt(e);if(r!==n.charCodeAt(e)){i=!1;break}r===47&&(f++,p=e+1)}i&&e&&r===a&&n.length>a&&n.charCodeAt(a)===47&&(f++,p=a+1)}l=f,r=f;let m=p,h=t.indexOf(`/`,m);for(;h>=0&&h<a;){let e=c[l];if(e===void 0)throw Error(`Directory stack underflow while building the path store`);r++;let n=t.slice(m,h),a=o.get(n);a===void 0&&(a=s.length,o.set(n,a),s.push(n));let u=i.length;i.push({depthAndFlags:Lt(r,0,1),nameId:a,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),this.recordCreatedDirectoryPath(t.slice(0,h)),l++,c[l]=u,m=h+1,h=t.indexOf(`/`,m)}if(e){if(m<a){let e=c[l];if(e===void 0)throw Error(`Unable to resolve directory parent for "${t}"`);r++;let n=t.slice(m,a),u=o.get(n);u===void 0&&(u=s.length,o.set(n,u),s.push(n));let d=i.length;i.push({depthAndFlags:Lt(r,0,1),nameId:u,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),l++,c[l]=d}let e=c[l];if(e===void 0)throw Error(`Unable to resolve directory node for "${t}"`);this.promoteDirectoryToExplicit(e,t)}else{let e=c[l];if(e===void 0)throw Error(`Unable to resolve file parent for "${t}"`);let n=t.slice(m),a=o.get(n);a===void 0&&(a=s.length,o.set(n,a),s.push(n)),i.push({depthAndFlags:Lt(r+1,0),nameId:a,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1})}m!==u.length&&(u=t.substring(0,m),d=r),n=t}c.length=l+1,n!=null&&(this.lastPreparedPath=ln(n)),this.hasDeferredDirectoryIndexes=!0}),this}appendPresortedFilePaths(e){let t=null,n=0,r=this.nodes,i=this.segmentTable,a=i.idByValue,o=i.valueById,s=this.directoryStack,c=0,l=``,u=0;for(let i of e){if(t===i)throw Error(`Duplicate path: "${i}"`);let e=i.length,d=0,f=0;if(t!=null)if(l.length>0&&i.length>l.length&&i.startsWith(l))d=u,f=l.length;else{let n=Math.min(e,t.length);for(let e=0;e<n;e++){let n=i.charCodeAt(e);if(n!==t.charCodeAt(e))break;n===47&&(d++,f=e+1)}}c=d,n=d;let p=f,m=i.indexOf(`/`,p);for(;m>=0;){let e=s[c];if(e===void 0)throw Error(`Directory stack underflow while building the path store`);n++;let t=i.slice(p,m),l=a.get(t);l===void 0&&(l=o.length,a.set(t,l),o.push(t));let u=r.length;r.push({depthAndFlags:Lt(n,0,1),nameId:l,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),this.recordCreatedDirectoryPath(i.slice(0,m)),this.presortedDirectoryNodeIds.push(u),c++,s[c]=u,p=m+1,m=i.indexOf(`/`,p)}let h=s[c];if(h===void 0)throw Error(`Unable to resolve file parent for "${i}"`);let g=i.slice(p),_=a.get(g);_===void 0&&(_=o.length,a.set(g,_),o.push(g)),r.push({depthAndFlags:Lt(n+1,0),nameId:_,parentId:h,subtreeNodeCount:1,visibleSubtreeCount:1}),p!==l.length&&(l=i.substring(0,p),u=n),t=i}s.length=c+1,t!=null&&(this.lastPreparedPath=ln(t)),this.hasDeferredDirectoryIndexes=!0}finish(e={}){let t=e.skipSubtreeCountPass===!0;return this.hasDeferredDirectoryIndexes?(V(this.instrumentation,`store.builder.buildDirectoryIndexes`,()=>this.buildPresortedFinish(t)),this.hasDeferredDirectoryIndexes=!1):t||V(this.instrumentation,`store.builder.computeSubtreeCounts`,()=>this.computeSubtreeCounts(0)),{directories:this.directories,nodes:this.nodes,options:this.options,rootId:0,segmentTable:this.segmentTable,presortedDirectoryNodeIds:this.presortedDirectoryNodeIds.length>0?this.presortedDirectoryNodeIds:null}}didMatchAllInitialExpandedPaths(){return this.createdDirectoriesAllExpanded&&this.initialExpandedPathSet!=null&&this.createdDirectoryCount===this.initialExpandedPathSet.size}appendPreparedPath(e,t){if(this.hasDeferredDirectoryIndexes&&=(this.buildDirectoryIndexes(),!1),this.lastPreparedPath!=null){if(e.path===this.lastPreparedPath.path)throw Error(`Duplicate path: "${e.path}"`);if(t&&(this.options.sort==="default"?an(this.lastPreparedPath,e,this.segmentSortKeyCache):vn(this.lastPreparedPath,e,this.options.sort))>0)throw Error(`Builder input must be sorted before appendPaths(): "${e.path}"`)}let n=this.lastPreparedPath,r=xn(e),i=n==null?0:xn(n),a=n==null?0:bn(n.segments,e.segments),o=Math.min(a,r,i);this.directoryStack.length=o+1;for(let n=o;n<r;n++){let r=this.directoryStack[this.directoryStack.length-1];if(r===void 0)throw Error(`Directory stack underflow while building the path store`);let i=t?this.getOrCreateDirectoryChild(r,e.segments[n]):this.createDirectoryChild(r,e.segments[n]);this.directoryStack.push(i)}if(e.isDirectory){let t=this.directoryStack[this.directoryStack.length-1];if(t===void 0)throw Error(`Unable to resolve directory node for "${e.path}"`);this.promoteDirectoryToExplicit(t,e.path),this.lastPreparedPath=e;return}let s=this.directoryStack[this.directoryStack.length-1];if(s===void 0)throw Error(`Unable to resolve file parent for "${e.path}"`);t?this.createFileChild(s,e.basename,e.path):this.createFileChildUnchecked(s,e.basename),this.lastPreparedPath=e}recordCreatedDirectoryPath(e){!this.createdDirectoriesAllExpanded||this.initialExpandedPathSet==null||(this.createdDirectoryCount+=1,this.initialExpandedPathSet.has(e)||(this.createdDirectoriesAllExpanded=!1))}createFileChild(e,t,n){let r=pn(this.segmentTable,t),i=this.getDirectoryIndex(e),a=i.childIdByNameId;if(a!=null&&a.get(r)!==void 0)throw Error(`Path collides with an existing entry: "${n}"`);let o=this.nodes[e];if(o===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let s=this.nodes.length;return this.nodes.push({depthAndFlags:Lt(Rt(o)+1,0),nameId:r,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),a?.set(r,s),Tt(i,s),s}createFileChildUnchecked(e,t){let n=pn(this.segmentTable,t),r=this.getDirectoryIndex(e),i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:Lt(Rt(i)+1,0),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),Tt(r,a),a}getOrCreateDirectoryChild(e,t){let n=pn(this.segmentTable,t),r=this.getDirectoryIndex(e);if(r.childIdByNameId!=null){let e=r.childIdByNameId.get(n);if(e!==void 0){let n=this.nodes[e];if(n!=null&&!B(n))throw Error(`Path collides with an existing file while creating directory "${t}"`);return e}}let i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:Lt(Rt(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),Tt(r,a),this.directories.set(a,xt()),a}createDirectoryChild(e,t){let n=pn(this.segmentTable,t),r=this.getDirectoryIndex(e),i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:Lt(Rt(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),Tt(r,a),this.directories.set(a,xt()),a}promoteDirectoryToExplicit(e,t){let n=this.nodes[e];if(n===void 0)throw Error(`Unknown directory node ID: ${String(e)}`);if(!B(n))throw Error(`Path is not a directory: "${t}"`);if(Vt(n,1))throw Error(`Duplicate path: "${t}"`);Ht(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,St());let r=-1,i=null;for(let e=1;e<t.length;e++){let a=t[e];if(a==null)continue;if(B(a)){let t=St();n.set(e,t),r=e,i=t}let o;a.parentId===r?o=i:(o=n.get(a.parentId),r=a.parentId,i=o??null),o?.childIds.push(e)}if(!e)for(let e=t.length-1;e>=1;e--){let n=t[e];if(n==null)continue;let r=t[n.parentId];r!=null&&(r.subtreeNodeCount+=n.subtreeNodeCount,r.visibleSubtreeCount+=n.visibleSubtreeCount)}}buildDirectoryIndexes(){let e=this.nodes;for(let t=1;t<e.length;t++){let n=e[t];if(n==null)continue;B(n)&&this.directories.set(t,xt());let r=this.directories.get(n.parentId);r!=null&&(r.childIdByNameId!=null&&r.childIdByNameId.set(n.nameId,t),Tt(r,t))}}computeSubtreeCounts(e){let t=this.nodes[e];if(t===void 0)throw Error(`Unknown node ID: ${String(e)}`);if(!B(t))return t.subtreeNodeCount=1,t.visibleSubtreeCount=1,1;let n=this.getDirectoryIndex(e),r=1;for(let e of n.childIds)r+=this.computeSubtreeCounts(e);return Dt(this.nodes,n),t.subtreeNodeCount=r,t.visibleSubtreeCount=r,r}};function Mn(e,t=`closed`,n=null){let r=Pn(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 Nn(){return{affectedAncestorIds:new Set,affectedNodeIds:new Set,events:[]}}function Pn(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 Fn(e,t){return Vt(t,2)||e.defaultExpansion===`open`?!0:e.defaultExpansion===`closed`?!1:Rt(t)<=e.defaultExpansion}function In(e,t,n=e.snapshot.nodes[t]){return n==null||!B(n)?!1:e.directoriesOpenByDefault&&!e.hasCollapsedDirectoryOverrides?!0:e.collapsedDirectoryIds.has(t)?!1:e.expandedDirectoryIds.has(t)?!0:Fn(e,n)}function Ln(e,t,n,r=e.snapshot.nodes[t]){if(r==null||!B(r))return;let i=Fn(e,r);if(n){if(i){e.collapsedDirectoryIds.delete(t),e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0;return}e.expandedDirectoryIds.add(t);return}if(i){e.collapsedDirectoryIds.add(t),e.hasCollapsedDirectoryOverrides=!0;return}e.expandedDirectoryIds.delete(t)}function Rn(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 zn(e,t){return e.directoryLoadInfoById.get(t)?.state??`loaded`}function Bn(e,t){let n=Rn(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 Vn(e,t){let n=Rn(e,t);n.activeAttemptId=null,n.errorMessage=null,n.state=`unloaded`}function Hn(e,t,n){let r=e.directoryLoadInfoById.get(t);return r==null||r.activeAttemptId!==n?!1:(r.activeAttemptId=null,r.errorMessage=null,r.state=`loaded`,!0)}function Un(e,t,n){return e.directoryLoadInfoById.get(t)?.activeAttemptId===n}function Wn(e,t,n,r){let i=e.directoryLoadInfoById.get(t);return i==null||i.activeAttemptId!==n?!1:(i.activeAttemptId=null,i.errorMessage=r??null,i.state=`error`,!0)}function Gn(e,t){e.directoryLoadInfoById.delete(t)}function Kn(e,t,n){let r=n,i=e.listeners.get(t);return i==null?e.listeners.set(t,new Set([r])):i.add(r),()=>{let n=e.listeners.get(t);n!=null&&(n.delete(r),n.size===0&&e.listeners.delete(t))}}function qn(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`add`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function Jn(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`remove`,path:e.path,projectionChanged:e.projectionChanged,recursive:e.recursive,visibleCountDelta:null}}function Yn(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,from:e.from,operation:`move`,projectionChanged:e.projectionChanged,to:e.to,visibleCountDelta:null}}function Xn(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`expand`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function Zn(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`collapse`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function Qn(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`mark-directory-unloaded`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function $n(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 er(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:e.childEvents.some(e=>e.canonicalChanged),childEvents:e.childEvents,operation:`apply-child-patch`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function tr(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 nr(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 rr(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 ir(e,t,n){return{...n,visibleCountDelta:hr(e)-t}}function ar(e,t){let n=hr(e),r=Nn();e.transactionStack.push(r);try{t()}catch(t){throw cr(e,r,!1),t}cr(e,r,!0,hr(e)-n)}function or(e,t){let n=e.instrumentation;if(n==null){sr(e,t);return}V(n,`store.events.record`,()=>sr(e,t))}function sr(e,t){let n=e.transactionStack[e.transactionStack.length-1]??null;if(n==null){pr(e,t);return}n.events.push(t),fr(n,t)}function cr(e,t,n,r=null){if(e.transactionStack.pop()!==t)throw Error(`Transaction stack underflow`);if(!n)return;let i=e.transactionStack[e.transactionStack.length-1]??null;if(i!=null){let n=e.instrumentation;n==null?dr(i,t):V(n,`store.events.batch.merge`,()=>dr(i,t));return}let a=lr(t,r),o=e.instrumentation;if(o==null){pr(e,a);return}V(o,`store.events.batch.commit`,()=>pr(e,a))}function lr(e,t){return{affectedAncestorIds:[...e.affectedAncestorIds],affectedNodeIds:[...e.affectedNodeIds],canonicalChanged:e.events.some(e=>e.canonicalChanged),events:[...e.events],operation:`batch`,projectionChanged:e.events.some(e=>e.projectionChanged),visibleCountDelta:t}}function ur(e,t){for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n);for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n)}function dr(e,t){for(let n of t.events)e.events.push(n);ur(e,t)}function fr(e,t){for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n);for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n)}function pr(e,t){let n=e.instrumentation;if(n==null){mr(e,t);return}V(n,`store.events.emit`,()=>mr(e,t))}function mr(e,t){e.listeners.get(t.operation)?.forEach(e=>e(t)),e.listeners.get(`*`)?.forEach(e=>e(t))}function hr(e){return e.snapshot.nodes[e.snapshot.rootId]?.visibleSubtreeCount??0}function gr(e,t){if(e.snapshot.options.flattenEmptyDirectories!==!0)return null;let n=e.snapshot.nodes[t];if(n==null||!B(n)||Vt(n,2))return null;let r=e.snapshot.directories.get(t);if(r==null||r.childIds.length!==1)return null;let i=r.childIds[0];if(i==null)return null;let a=e.snapshot.nodes[i];return a==null||!B(a)?null:i}function _r(e,t){let n=t;for(;;){let t=gr(e,n);if(t==null)return n;n=t}}function vr(e,t){let n=[t],r=t;for(;;){let t=gr(e,r);if(t==null)return n;n.push(t),r=t}}function yr(e,t){let n=t==null?e.snapshot.rootId:Or(e,t);return n==null?[]:Ar(e,n)}function br(e,t){let n=ln(t),r=n.isDirectory?n.segments:n.segments.slice(0,-1),i=Gr(e,Wr(e,r)),{createdNodeIds:a,directoryId:o}=jr(e,r),s=new Set(a),c=o;if(n.isDirectory){let n=W(e,o);if(Vt(n,1))throw Error(`Path already exists: "${t}"`);Ht(n,1),e.pathCacheByNodeId.set(o,{path:t,version:e.pathCacheVersion}),s.add(o)}else c=Nr(e,o,n.basename),s.add(c);Tr(e,o);let l=Gr(e,o);return qn({affectedAncestorIds:Dr(e,c),affectedNodeIds:[...s],path:t,projectionChanged:Kr(i,l)})}function xr(e,t,n){let r=Or(e,t);if(r==null)throw Error(`Path does not exist: "${t}"`);let i=W(e,r);if(Vt(i,2))throw Error(`The root node cannot be removed`);if(B(i)&&U(e,r).childIds.length>0&&n.recursive!==!0)throw Error(`Cannot remove a non-empty directory without recursive: "${t}"`);let a=i.parentId,o=Gr(e,a),s=Hr(e,r);Ir(e,a,r,i.nameId),Ur(e,a),Tr(e,a);let c=Gr(e,a);return Jn({affectedAncestorIds:Dr(e,a),affectedNodeIds:s,path:t,projectionChanged:Kr(o,c),recursive:n.recursive===!0})}function Sr(e,t,n,r){let i=Or(e,t);if(i==null)throw Error(`Source path does not exist: "${t}"`);let a=W(e,i);if(Vt(a,2))throw Error(`The root node cannot be moved`);let o=r.collision??`error`,s=Br(e,i,n),c=Gr(e,a.parentId),l=Gr(e,s.parentId),u=mn(e.snapshot.segmentTable,a.nameId),d=pn(e.snapshot.segmentTable,s.basename);if(s.parentId===a.parentId&&u===s.basename)return null;if(B(a)&&Xr(e,i,s.parentId))throw Error(`Cannot move a directory into one of its descendants`);let f=Ct(e.snapshot.nodes,U(e,s.parentId)).get(d),p=s.existingNodeId??f??null;if(p!=null&&p!==i&&Vr(e,p,o,zt(a))===`skip`)return null;let m=a.parentId;Ir(e,m,i,a.nameId),a.parentId=s.parentId,a.nameId=d,e.pathCacheByNodeId.delete(i),Yr(e,i),Fr(e,s.parentId,i),Ur(e,m),e.pathCacheVersion++,Tr(e,m),s.parentId!==m&&Tr(e,s.parentId);let h=Gr(e,m),g=Gr(e,s.parentId);return Yn({affectedAncestorIds:[...new Set([...Dr(e,m),...Dr(e,s.parentId)])],affectedNodeIds:[i],from:t,projectionChanged:qr([c,l],[h,g]),to:H(e,i)})}function Cr(e,t){let n=e.pathCacheByNodeId.get(t);return n!=null&&n.version===e.pathCacheVersion?n.path:null}function wr(e,t,n){return e.pathCacheByNodeId.set(t,{path:n,version:e.pathCacheVersion}),n}function H(e,t){let n=W(e,t),r=Cr(e,t);if(r!=null)return r;if(Vt(n,2))return wr(e,t,``);let i=H(e,n.parentId),a=mn(e.snapshot.segmentTable,n.nameId),o=i.length===0?a:`${i}${a}`;return wr(e,t,B(n)?`${o}/`:o)}function Tr(e,t){let n=e.instrumentation;if(n==null){Qr(e,t);return}V(n,`store.recomputeCountsUpwardFrom`,()=>Qr(e,t))}function Er(e,t){let n=[[t,0]],{nodes:r,directories:i}=e.snapshot;for(;n.length>0;){let t=n[n.length-1],a=t[0],o=r[a];if(o==null||!B(o)){Zr(e,a,o,!0),n.pop();continue}let s=i.get(a);if(s==null||t[1]>=s.childIds.length){Zr(e,a,o,!0),n.pop();continue}let c=s.childIds[t[1]++];n.push([c,0])}}function Dr(e,t){let n=[],r=t;for(;r!=null;){let t=W(e,r);if(n.push(r),r===e.snapshot.rootId)break;r=t.parentId}return n}function Or(e,t){if(t.length===0)return e.snapshot.rootId;let n=un(t);return kr(e,n.segments,n.requiresDirectory)}function kr(e,t,n){let r=e.snapshot.rootId;for(let n of t){let t=e.snapshot.segmentTable.idByValue.get(n);if(t===void 0)return null;let i=U(e,r),a=Ct(e.snapshot.nodes,i).get(t);if(a===void 0)return null;r=a}let i=W(e,r);return n&&!B(i)?null:r}function U(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 W(e,t){let n=e.snapshot.nodes[t];if(n===void 0||Vt(n,4))throw Error(`Unknown node ID: ${String(t)}`);return n}function Ar(e,t){let n=e.snapshot.nodes[t];if(n===void 0||Vt(n,4))return[];if(!B(n))return[H(e,t)];if(U(e,t).childIds.length===0)return Vt(n,1)&&!Vt(n,2)?[H(e,t)]:[];let r=[],i=[{childIndex:0,nodeId:t}];for(;i.length>0;){let t=i[i.length-1];if(t==null)break;let n=e.snapshot.nodes[t.nodeId];if(n===void 0||Vt(n,4)){i.pop();continue}if(!B(n)){r.push(H(e,t.nodeId)),i.pop();continue}let a=U(e,t.nodeId);if(a.childIds.length===0){Vt(n,1)&&!Vt(n,2)&&r.push(H(e,t.nodeId)),i.pop();continue}let o=a.childIds[t.childIndex];if(o==null){i.pop();continue}t.childIndex++,i.push({childIndex:0,nodeId:o})}return r}function jr(e,t){let n=[],r=e.snapshot.rootId;for(let i of t){let t=pn(e.snapshot.segmentTable,i),a=U(e,r),o=Ct(e.snapshot.nodes,a).get(t);if(o!==void 0){if(!B(W(e,o)))throw Error(`Cannot create a directory that collides with an existing file: "${i}"`);r=o;continue}r=Mr(e,r,t),n.push(r)}return{createdNodeIds:n,directoryId:r}}function Mr(e,t,n){let r=W(e,t),i=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:Lt(Rt(r)+1,0,1),nameId:n,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),e.snapshot.directories.set(i,xt()),Fr(e,t,i),e.collapseNewDirectoriesByDefault&&(e.collapsedDirectoryIds.add(i),e.hasCollapsedDirectoryOverrides=!0),e.activeNodeCount++,i}function Nr(e,t,n){let r=pn(e.snapshot.segmentTable,n),i=U(e,t);if(Ct(e.snapshot.nodes,i).has(r))throw Error(`Path already exists: "${ei(e,t,n)}"`);let a=W(e,t),o=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:Lt(Rt(a)+1,0),nameId:r,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),Fr(e,t,o),e.activeNodeCount++,o}function Pr(e,t,n){let r=0,i=t.childIds.length;for(;r<i;){let a=r+i>>>1,o=t.childIds[a];if(o==null){i=a;continue}Lr(e,n,o)<0?i=a:r=a+1}return r}function Fr(e,t,n){let r=U(e,t),i=W(e,n);Ct(e.snapshot.nodes,r).set(i.nameId,n),Ot(r,n,i.subtreeNodeCount,i.visibleSubtreeCount);let a=Pr(e,r,n);r.childIds.splice(a,0,n),Et(r,a),jt(e.snapshot.nodes,r)}function Ir(e,t,n,r){let i=U(e,t),a=wt(i),o=a.get(n)??-1;Ct(e.snapshot.nodes,i).delete(r),a.delete(n);let s=e.snapshot.nodes[n];s!=null&&Ot(i,n,-s.subtreeNodeCount,-s.visibleSubtreeCount),o>=0&&(i.childIds.splice(o,1),Et(i,o),jt(e.snapshot.nodes,i))}function Lr(e,t,n){let r=e.snapshot.options.sort;return r==="default"?Rr(e,t,n):r(zr(e,t),zr(e,n))}function Rr(e,t,n){let r=W(e,t),i=W(e,n),a=B(r);if(a!==B(i))return a?-1:1;let o=Qt(on(e.snapshot.segmentTable,r.nameId),on(e.snapshot.segmentTable,i.nameId));if(o!==0)return o;let s=mn(e.snapshot.segmentTable,r.nameId),c=mn(e.snapshot.segmentTable,i.nameId);return s===c?t<n?-1:1:s<c?-1:1}function zr(e,t){let n=W(e,t),r=H(e,t),i=B(n),a=i?r.slice(0,-1):r;return{basename:mn(e.snapshot.segmentTable,n.nameId),depth:Rt(n),isDirectory:i,path:r,segments:a.length===0?[]:a.split(`/`)}}function Br(e,t,n){let r=W(e,t),i=Or(e,n);if(i!=null){let t=W(e,i);if(B(t))return{basename:mn(e.snapshot.segmentTable,r.nameId),existingNodeId:null,parentId:i};let a=un(n).segments;return{basename:a[a.length-1]??``,existingNodeId:i,parentId:t.parentId}}let a=un(n),o=a.segments[a.segments.length-1]??``,s=a.segments.slice(0,-1),c=s.length===0?e.snapshot.rootId:kr(e,s,!0);if(c==null)throw Error(`Destination parent does not exist: "${n}"`);return{basename:o,existingNodeId:null,parentId:c}}function Vr(e,t,n,r){if(n===`skip`)return`skip`;if(n===`error`)throw Error(`Destination already exists: "${H(e,t)}"`);let i=W(e,t);if(zt(i)!==r)throw Error(`replace collision requires the same source and destination kinds`);if(B(i)&&U(e,t).childIds.length>0)throw Error(`replace collision does not support non-empty directories`);let a=i.parentId,o=i.nameId;return Hr(e,t),Ir(e,a,t,o),Ur(e,a),Tr(e,a),`handled`}function Hr(e,t){let n=[],r=[{nodeId:t,visitedChildren:!1}];for(;r.length>0;){let t=r.pop();if(t==null)break;let i=W(e,t.nodeId);if(t.visitedChildren||!B(i)){B(i)&&e.snapshot.directories.delete(t.nodeId),Ht(i,4),e.pathCacheByNodeId.delete(t.nodeId),e.collapsedDirectoryIds.delete(t.nodeId)&&(e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0),e.expandedDirectoryIds.delete(t.nodeId),Gn(e,t.nodeId),e.activeNodeCount--,n.push(t.nodeId);continue}r.push({nodeId:t.nodeId,visitedChildren:!0});let a=U(e,t.nodeId);for(let e=a.childIds.length-1;e>=0;e--){let t=a.childIds[e];t!=null&&r.push({nodeId:t,visitedChildren:!1})}}return n}function Ur(e,t){let n=t;for(;n!=null;){let t=W(e,n);if(!B(t)||Vt(t,2)||U(e,n).childIds.length>0)return;Ht(t,1),n=t.parentId===n?null:t.parentId}}function Wr(e,t){let n=e.snapshot.rootId;for(let r of t){let t=e.snapshot.segmentTable.idByValue.get(r);if(t==null)break;let i=Ct(e.snapshot.nodes,U(e,n)).get(t);if(i==null||!B(W(e,i)))break;n=i}return n}function Gr(e,t){let n=Jr(e,t);if(n==null)return null;let r=_r(e,n),i=W(e,r),a=n===r?null:vr(e,n).map(t=>H(e,t));return JSON.stringify({flattenedSegmentPaths:a,hasChildren:U(e,r).childIds.length>0,path:H(e,r),terminalKind:zt(i)})}function Kr(e,t){return qr([e],[t])}function qr(e,t){for(let n=0;n<e.length;n+=1){let r=e[n],i=t[n];if(r==null||i==null||r!==i)return!0}return!1}function Jr(e,t){let n=t;for(;n!=null;){let t=W(e,n);if(!B(t)||Vt(t,2))return null;if(!In(e,n,t))return n;n=t.parentId}return null}function Yr(e,t){let n=W(e,t);if(Ut(n,(t===e.snapshot.rootId?-1:Rt(W(e,n.parentId)))+1),!B(n))return;let r=U(e,t);for(let t of r.childIds)Yr(e,t)}function Xr(e,t,n){let r=n;for(;r!=null;){if(r===t)return!0;let n=W(e,r);if(r===e.snapshot.rootId)return!1;r=n.parentId}return!1}function Zr(e,t,n=W(e,t),r=!1){let i=e.instrumentation;if(i==null){$r(e,t,n,r);return}V(i,`store.recomputeNodeCounts`,()=>$r(e,t,n,r))}function Qr(e,t){let n=t;for(;n!=null;){let t=W(e,n),r=t.subtreeNodeCount,i=t.visibleSubtreeCount;if(Zr(e,n,t),n===e.snapshot.rootId)return;let a=t.subtreeNodeCount-r,o=t.visibleSubtreeCount-i,s=t.parentId;(a!==0||o!==0)&&Ot(U(e,s),n,a,o),n=s}}function $r(e,t,n,r){if(!B(n)){n.subtreeNodeCount=1,n.visibleSubtreeCount=1;return}let i=U(e,t);if(r){let t=e.instrumentation;t==null?Dt(e.snapshot.nodes,i):V(t,`store.recomputeNodeCounts.rebuildChildAggregates`,()=>Dt(e.snapshot.nodes,i))}let a=1+i.totalChildSubtreeNodeCount,o=i.totalChildVisibleSubtreeCount;if(n.subtreeNodeCount=a,Vt(n,2)){n.visibleSubtreeCount=o;return}n.visibleSubtreeCount=gr(e,t)==null?In(e,t,n)?1+o:1:o}function ei(e,t,n){let r=H(e,t);return r.length===0?n:`${r}${n}`}function ti(e){return e!=null&&!Vt(e,4)}function ni(e,t){let n=e.snapshot.nodes[t];return!ti(n)||!B(n)||Vt(n,2)?null:n}function ri(e){let t=0;for(let[n,r]of e.pathCacheByNodeId)r.version===e.pathCacheVersion&&ti(e.snapshot.nodes[n])&&(t+=1);return t}function ii(e){return Math.max(0,e.valueById.length-1)}function ai(e){return{activeNodeCount:e.activeNodeCount,cachedPathEntryCount:ri(e),loadInfoEntryCount:e.directoryLoadInfoById.size,segmentCount:ii(e.snapshot.segmentTable),totalNodeSlotCount:Math.max(0,e.snapshot.nodes.length-1)}}function oi(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 si(e){let t=[],n=[];for(let n of e.collapsedDirectoryIds)ni(e,n)!=null&&t.push(H(e,n));for(let t of e.expandedDirectoryIds)ni(e,t)!=null&&n.push(H(e,t));return{collapsedPaths:t,expandedPaths:n}}function ci(e){let t=[];for(let[n,r]of e.directoryLoadInfoById)ni(e,n)==null||zn(e,n)===`loaded`||t.push({info:{activeAttemptId:null,errorMessage:r.errorMessage,nextAttemptId:r.nextAttemptId,state:r.state},path:H(e,n)});return t}function li(e,t){e.collapsedDirectoryIds.clear(),e.hasCollapsedDirectoryOverrides=!1,e.expandedDirectoryIds.clear();for(let n of t.expandedPaths){let t=Or(e,n);t!=null&&Ln(e,t,!0,W(e,t))}for(let n of t.collapsedPaths){let t=Or(e,n);t!=null&&Ln(e,t,!1,W(e,t))}}function ui(e,t){e.directoryLoadInfoById.clear();for(let n of t){let t=Or(e,n.path);t!=null&&ni(e,t)!=null&&e.directoryLoadInfoById.set(t,{activeAttemptId:null,errorMessage:n.info.errorMessage,nextAttemptId:n.info.nextAttemptId,state:n.info.state})}}function di(e){e.pathCacheVersion+=1,e.pathCacheByNodeId.clear(),e.pathCacheByNodeId.set(e.snapshot.rootId,{path:``,version:e.pathCacheVersion})}function fi(e){let t=e.snapshot.segmentTable,n=fn();for(let r of e.snapshot.nodes)if(ti(r)){if(Vt(r,2)){r.nameId=0;continue}r.nameId=pn(n,mn(t,r.nameId))}e.snapshot.segmentTable=n}function pi(e){for(let[t,n]of e.snapshot.directories){let r=e.snapshot.nodes[t];if(!ti(r)||!B(r)){e.snapshot.directories.delete(t);continue}let i=n.childIds.filter(n=>{let r=e.snapshot.nodes[n];return ti(r)&&r.parentId===t});n.childIds=i,n.childIdByNameId=new Map(i.map(t=>[W(e,t).nameId,t])),n.childPositionById=new Map(i.map((e,t)=>[e,t])),Dt(e.snapshot.nodes,n)}}function mi(e){let t=e.snapshot.nodes.length-1;for(;t>e.snapshot.rootId;){let n=e.snapshot.nodes[t];if(ti(n))break;--t}e.snapshot.nodes.length=t+1}function hi(e){let t=si(e),n=ci(e);V(e.instrumentation,`store.cleanup.stable.clearPathCaches`,()=>di(e)),V(e.instrumentation,`store.cleanup.stable.rebuildSegmentTable`,()=>fi(e)),V(e.instrumentation,`store.cleanup.stable.rebuildDirectoryIndexes`,()=>pi(e)),V(e.instrumentation,`store.cleanup.stable.trimTrailingRemovedNodeSlots`,()=>mi(e)),V(e.instrumentation,`store.cleanup.stable.restoreExpansionOverrides`,()=>li(e,t)),V(e.instrumentation,`store.cleanup.stable.restoreDirectoryLoadInfos`,()=>ui(e,n)),V(e.instrumentation,`store.cleanup.stable.recomputeCounts`,()=>Er(e,e.snapshot.rootId))}function gi(e){let t=si(e),n=ci(e),r=V(e.instrumentation,`store.cleanup.aggressive.listPaths`,()=>yr(e)),i=Gt({...e.snapshot.options},e.instrumentation),a=V(e.instrumentation,`store.cleanup.aggressive.rebuildSnapshot`,()=>{let e=new jn(i);return e.appendPaths(r),e.finish()});e.snapshot=a,e.activeNodeCount=a.nodes.length-1,e.pathCacheByNodeId=new Map([[a.rootId,{path:``,version:0}]]),e.pathCacheVersion=0,V(e.instrumentation,`store.cleanup.aggressive.restoreExpansionOverrides`,()=>li(e,t)),V(e.instrumentation,`store.cleanup.aggressive.restoreDirectoryLoadInfos`,()=>ui(e,n)),V(e.instrumentation,`store.cleanup.aggressive.recomputeCounts`,()=>Er(e,e.snapshot.rootId))}function _i(e){for(let t of e.directoryLoadInfoById.values())if(t.state===`loading`&&t.activeAttemptId!=null)return!0;return!1}function vi(e,t){let n=ai(e);t===`stable`?V(e.instrumentation,`store.cleanup.stable`,()=>hi(e)):V(e.instrumentation,`store.cleanup.aggressive`,()=>gi(e));let r=ai(e);return oi(t,t===`stable`,n,r)}var yi=64;function bi(e,t){let n=t+2;if(n<=e.length)return e;let r=e.length;for(;r<n;)r*=2;let i=new Int32Array(r);return i.fill(-1),i.set(e),i}function xi(e){return W(e,e.snapshot.rootId).visibleSubtreeCount}function Si(e,t,n,r){let i=W(e,t.terminalNodeId),a=Math.max(1,i.visibleSubtreeCount);return Math.min(r-1,n+a-1)}function Ci(e,t,n,r){return{ancestorPaths:r,index:t.index,posInSet:t.posInSet,row:Hi(e,t.cursor),setSize:t.setSize,subtreeEndIndex:Si(e,t.cursor,t.index,n)}}function wi(e,t,n,r,i,a){let o=U(e,t),{childIndex:s,childVisibleIndex:c,localVisibleIndex:l}=kt(e.snapshot.nodes,o,n),u=o.childIds[s];if(u==null)throw Error(`Visible index ${String(n)} is out of range`);return Ti(e,u,l,r+c,i+1,s,o.childIds.length,a)}function Ti(e,t,n,r,i,a,o,s){if(!B(W(e,t))){if(n===0)return{ancestors:s,cursor:{headNodeId:t,terminalNodeId:t,visibleDepth:i},index:r,posInSet:a,setSize:o};throw Error(`Visible index ${String(n)} is out of range for file`)}let c=Ii(e,t,i);if(n===0)return{ancestors:s,cursor:c,index:r,posInSet:a,setSize:o};let l=W(e,c.terminalNodeId);if(!B(l)||!In(e,c.terminalNodeId,l))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return wi(e,c.terminalNodeId,n-1,r+1,c.visibleDepth,[...s,{cursor:c,index:r,posInSet:a,setSize:o}])}function Ei(e,t){let n=xi(e);if(t<0||t>=n)return null;let r=wi(e,e.snapshot.rootId,t,0,-1,[]),i=r.ancestors.map(t=>H(e,t.cursor.terminalNodeId)),a=null;return{ancestorPaths:i,get ancestorRows(){if(a!=null)return a;let t=[],i=[];for(let a of r.ancestors){let r=Ci(e,a,n,[...i]);t.push(r),i.push(r.row.path)}return a=t,a},index:r.index,posInSet:r.posInSet,row:Hi(e,r.cursor),setSize:r.setSize,subtreeEndIndex:Si(e,r.cursor,r.index,n)}}function Di(e,t,n){let r=e.instrumentation,i=xi(e);if(i<=0||n<t)return[];let a=Math.max(0,Math.min(t,i-1)),o=Math.max(a,Math.min(n,i-1));if(r==null){if(a===0)return Vi(e,o+1);let t=[],n=Ni(e,a);for(let r=a;r<=o&&n!=null;r++){let r=Hi(e,n);t.push(r),n=Ri(e,n)}return t}let s=[],c=0,l=0,u=V(r,`store.getVisibleSlice.selectFirstRow`,()=>Ni(e,a));for(let t=a;t<=o&&u!=null;t++){let t=V(r,`store.getVisibleSlice.materializeRow`,()=>Hi(e,u));s.push(t),t.isFlattened&&(c++,l+=t.flattenedSegments?.length??0),u=V(r,`store.getVisibleSlice.advanceCursor`,()=>Ri(e,u))}return qt(r,`workload.visibleRowsRead`,s.length),qt(r,`workload.flattenedRowsRead`,c),qt(r,`workload.flattenedSegmentsRead`,l),s}function Oi(e,t=xi(e)){let n=e.instrumentation;return n==null?Bi(e,t):V(n,`store.getVisibleTreeProjection`,()=>Bi(e,t))}function ki(e){return zi(Oi(e))}function Ai(e,t){let n=Or(e,t);if(n==null||n===e.snapshot.rootId||B(W(e,n))&&_r(e,n)!==n)return null;let r=0,i=n,{nodes:a,rootId:o}=e.snapshot;for(;i!==o;){let t=W(e,i).parentId,n=U(e,t),s=wt(n).get(i);if(s==null)throw Error(`Child ${String(i)} was not found in its parent index`);if(r+=At(a,n,s),t!==o){let n=W(e,t),a=gr(e,t);if(!In(e,t,n)&&a!==i)return null;_r(e,t)===t&&(r+=1)}i=t}return r}function ji(e,t){let n=Or(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=W(e,n);if(!B(r))throw Error(`Path is not a directory: "${t}"`);return In(e,n,r)?null:(Ln(e,n,!0,r),Tr(e,n),Xn({affectedAncestorIds:Dr(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0}))}function Mi(e,t){let n=Or(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=W(e,n);if(!B(r))throw Error(`Path is not a directory: "${t}"`);return In(e,n,r)?(Ln(e,n,!1,r),Tr(e,n),Zn({affectedAncestorIds:Dr(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0})):null}function Ni(e,t){return t<0||t>=xi(e)?null:Pi(e,e.snapshot.rootId,t,-1)}function Pi(e,t,n,r){let i=U(e,t),a=e.instrumentation,{childIndex:o,localVisibleIndex:s}=a==null?kt(e.snapshot.nodes,i,n):V(a,`store.getVisibleSlice.selectChildIndex`,()=>kt(e.snapshot.nodes,i,n)),c=i.childIds[o];if(c!=null)return Fi(e,c,s,r+1);throw Error(`Visible index ${String(n)} is out of range`)}function Fi(e,t,n,r){if(!B(W(e,t))){if(n===0)return{headNodeId:t,terminalNodeId:t,visibleDepth:r};throw Error(`Visible index ${String(n)} is out of range for file`)}let i=Ii(e,t,r);if(n===0)return i;let a=W(e,i.terminalNodeId);if(!B(a)||!In(e,i.terminalNodeId,a))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return Pi(e,i.terminalNodeId,n-1,i.visibleDepth)}function Ii(e,t,n){return B(W(e,t))?e.instrumentation==null?{headNodeId:t,terminalNodeId:_r(e,t),visibleDepth:n}:{headNodeId:t,terminalNodeId:V(e.instrumentation,`store.getVisibleSlice.flatten.resolveTerminalDirectory`,()=>_r(e,t)),visibleDepth:n}:{headNodeId:t,terminalNodeId:t,visibleDepth:n}}function Li(e,t){let n=W(e,t);if(!B(n))return!0;let r=n.parentId;return r===e.snapshot.rootId?!0:gr(e,r)!==t}function Ri(e,t){let n=W(e,t.terminalNodeId);if(B(n)){let r=U(e,t.terminalNodeId);if(In(e,t.terminalNodeId,n)&&r.childIds.length>0){let n=r.childIds[0];return n==null?null:Fi(e,n,0,t.visibleDepth+1)}}let r=t.terminalNodeId,i=t.visibleDepth;for(;;){let t=W(e,r);if(r===e.snapshot.rootId)return null;let n=t.parentId,a=U(e,n),o=wt(a).get(r)??-1;if(o<0)throw Error(`Child ${String(r)} was not found in its parent index`);let s=a.childIds[o+1]??null;if(s!=null)return Fi(e,s,0,i);Li(e,r)&&i--,r=n}}function zi(e){let t=e.paths.length,n=Array(t);for(let r=0;r<t;r+=1){let t=e.getParentIndex(r);n[r]={index:r,parentPath:t>=0?e.paths[t]??null:null,path:e.paths[r]??``,posInSet:e.posInSetByIndex[r]??0,setSize:e.setSizeByIndex[r]??0}}return{getParentIndex:e.getParentIndex,rows:n,get visibleIndexByPath(){return e.visibleIndexByPath}}}function Bi(e,t){let n=Array(t),r=new Int32Array(t),i=new Int32Array(t),a=new Int32Array(t),o=new Int32Array(yi);o.fill(-1);let s=0,{nodes:c,directories:l,segmentTable:u}=e.snapshot,d=[[l.get(e.snapshot.rootId),0,-1,``]],f=e.snapshot.options.flattenEmptyDirectories,p=e.pathCacheByNodeId,m=e.pathCacheVersion,h=u.valueById;for(;d.length>0&&s<t;){let t=d[d.length-1],u=t[0];if(t[1]>=u.childIds.length){d.pop();continue}let g=t[1],_=u.childIds[t[1]++],v=c[_],y=t[2]+1,b=t[3];o=bi(o,y);let x,S=_;if(B(v))S=f?_r(e,_):_,x=S===_?`${b}${h[v.nameId]}/`:H(e,S);else{let e=p.get(_);x=e!=null&&e.version===m?e.path:`${b}${h[v.nameId]}`}r[s]=o[y],n[s]=x,i[s]=g,a[s]=u.childIds.length,o[y+1]=s,s+=1;let C=c[S];C!=null&&B(C)&&In(e,S,C)&&d.push([l.get(S),0,y,x])}s<t&&(n.length=s);let g=r.subarray(0,s),_=i.subarray(0,s),v=a.subarray(0,s),y=null;return{getParentIndex(e){return e<0||e>=s?-1:g[e]??-1},paths:n,posInSetByIndex:_,setSizeByIndex:v,get visibleIndexByPath(){if(y==null){y=new Map;for(let e=0;e<s;e+=1)y.set(n[e]??``,e)}return y}}}function Vi(e,t){let n=Array(t),r=0,{nodes:i,directories:a,segmentTable:o}=e.snapshot,s=[[a.get(e.snapshot.rootId),0,-1]],c=o.valueById,l=e.snapshot.options.flattenEmptyDirectories,u=e.pathCacheByNodeId,d=e.pathCacheVersion;for(;s.length>0&&r<t;){let t=s[s.length-1],o=t[0];if(t[1]>=o.childIds.length){s.pop();continue}let f=o.childIds[t[1]++],p=i[f],m=t[2]+1;if(!B(p)){let t=u.get(f);n[r++]={depth:m,flattenedSegments:void 0,hasChildren:!1,id:f,isExpanded:!1,isFlattened:!1,isLoading:!1,kind:`file`,loadState:void 0,name:c[p.nameId],path:t!=null&&t.version===d?t.path:H(e,f)};continue}let h=l?_r(e,f):f,g={headNodeId:f,terminalNodeId:h,visibleDepth:m};n[r++]=Hi(e,g);let _=i[h];_!=null&&B(_)&&In(e,h,_)&&s.push([a.get(h),0,m])}return r<t&&(n.length=r),n}function Hi(e,t){let n=W(e,t.terminalNodeId),r=B(n)?Ui(e,t):null,i=H(e,t.terminalNodeId),a=mn(e.snapshot.segmentTable,n.nameId),o=B(n)&&U(e,t.terminalNodeId).childIds.length>0,s=t.headNodeId!==t.terminalNodeId,c=e.instrumentation,l=s?c==null?vr(e,t.headNodeId).map(n=>{let r=W(e,n);return{isTerminal:n===t.terminalNodeId,name:mn(e.snapshot.segmentTable,r.nameId),nodeId:n,path:H(e,n)}}):V(c,`store.getVisibleSlice.flatten.collectSegments`,()=>vr(e,t.headNodeId).map(n=>{let r=W(e,n);return{isTerminal:n===t.terminalNodeId,name:mn(e.snapshot.segmentTable,r.nameId),nodeId:n,path:H(e,n)}})):void 0;return{depth:t.visibleDepth,flattenedSegments:l,hasChildren:o,id:t.terminalNodeId,isExpanded:B(n)&&In(e,t.terminalNodeId,n),isFlattened:s,isLoading:r===`loading`,kind:B(n)?`directory`:`file`,loadState:r==null||r===`loaded`?void 0:r,name:a,path:i}}function Ui(e,t){if(t.headNodeId===t.terminalNodeId)return zn(e,t.terminalNodeId);let n=vr(e,t.headNodeId),r=!1,i=!1;for(let t of n){let n=zn(e,t);if(n===`loading`)return`loading`;if(n===`error`){i=!0;continue}n===`unloaded`&&(r=!0)}return i?`error`:r?`unloaded`:`loaded`}function Wi(e){let{directories:t,nodes:n,options:r,rootId:i,presortedDirectoryNodeIds:a}=e.snapshot,o=r.flattenEmptyDirectories===!0,s=e=>{let r=n[e];if(r==null||!B(r))return;let i=t.get(e);if(i==null)throw Error(`Unknown directory child index for node ${String(e)}`);let a=i.childIds,s=a.length,c=0,l=0;for(let e=0;e<s;e++){let t=a[e];if(t==null)continue;let r=n[t];c+=r.subtreeNodeCount,l+=r.visibleSubtreeCount}i.totalChildSubtreeNodeCount=c,i.totalChildVisibleSubtreeCount=l,s>=128&&jt(n,i),r.subtreeNodeCount=1+c;let u;if(o&&s===1){let e=n[a[0]];u=e!=null&&B(e)?l:1+l}else u=1+l;r.visibleSubtreeCount=u};if(a!=null)for(let e=a.length-1;e>=0;e--)s(a[e]);else for(let e=n.length-1;e>=1;e--)s(e);let c=n[i],l=t.get(i);if(c==null||l==null)return;let u=l.childIds,d=0,f=0;for(let e=0;e<u.length;e++){let t=u[e];if(t==null)continue;let r=n[t];d+=r.subtreeNodeCount,f+=r.visibleSubtreeCount}l.totalChildSubtreeNodeCount=d,l.totalChildVisibleSubtreeCount=f,jt(n,l),c.subtreeNodeCount=1+d,c.visibleSubtreeCount=f}function Gi(e){return e.initialExpansion===`open`&&(e.initialExpandedPaths==null||e.initialExpandedPaths.length===0)}var Ki=class e{#e;constructor(e={}){let t=Kt(e),n=V(t,`store.builder.create`,()=>new jn(e));if(e.preparedInput!=null){let t=On(e.preparedInput);t==null?n.appendPreparedPaths(Dn(e.preparedInput),!1):n.appendPresortedPaths(t,kn(e.preparedInput))}else{let r=e.paths??[];e.presorted===!0?n.appendPaths(r):n.appendPreparedPaths(V(t,`store.preparePathEntries`,()=>An(r,e)))}let r=V(t,`store.builder.finish`,()=>n.finish({skipSubtreeCountPass:!0})),i=V(t,`store.state.detectAllDirectoriesExpanded`,()=>(e.initialExpansion??`closed`)===`closed`&&n.didMatchAllInitialExpandedPaths());this.#e=V(t,`store.state.create`,()=>Mn(r,i?`open`:e.initialExpansion??`closed`,t)),i&&(this.#e.collapseNewDirectoriesByDefault=!0);let a=i?this.#e.snapshot.directories.size-1:V(t,`store.state.initializeExpandedPaths`,()=>this.initializeExpandedPaths(e.initialExpandedPaths));i||Gi(e)||(e.initialExpansion??`closed`)===`closed`&&a===this.#e.snapshot.directories.size-1||(e.initialExpandedPaths?.length??0)>0&&V(t,`store.state.checkAllDirectoriesExpanded`,()=>this.hasAllDirectoriesExpanded())?V(t,`store.state.initializeOpenVisibleCounts`,()=>Wi(this.#e)):V(t,`store.state.recomputeCounts`,()=>Er(this.#e,this.#e.snapshot.rootId))}static preparePaths(e,t={}){return wn(e,t)}static prepareInput(e,t={}){return Tn(e,t)}static preparePresortedInput(e){return En(e)}list(e){return V(this.#e.instrumentation,`store.list`,()=>yr(this.#e,e))}add(e){V(this.#e.instrumentation,`store.add`,()=>{let t=xi(this.#e);or(this.#e,ir(this.#e,t,br(this.#e,e)))})}remove(e,t={}){V(this.#e.instrumentation,`store.remove`,()=>{let n=xi(this.#e);or(this.#e,ir(this.#e,n,xr(this.#e,e,t)))})}move(e,t,n={}){V(this.#e.instrumentation,`store.move`,()=>{let r=xi(this.#e),i=Sr(this.#e,e,t,n);i!=null&&or(this.#e,ir(this.#e,r,i))})}batch(e){ar(this.#e,()=>{if(typeof e==`function`){e(this);return}for(let t of e)switch(t.type){case`add`:this.add(t.path);break;case`remove`:this.remove(t.path,{recursive:t.recursive});break;case`move`:this.move(t.from,t.to,{collision:t.collision});break}})}getVisibleCount(){return V(this.#e.instrumentation,`store.getVisibleCount`,()=>xi(this.#e))}getVisibleSlice(e,t){return V(this.#e.instrumentation,`store.getVisibleSlice`,()=>Di(this.#e,e,t))}getVisibleRowContext(e){return V(this.#e.instrumentation,`store.getVisibleRowContext`,()=>Ei(this.#e,e))}getVisibleTreeProjection(){return ki(this.#e)}getVisibleTreeProjectionData(e){return Oi(this.#e,e)}getVisibleIndex(e){return V(this.#e.instrumentation,`store.getVisibleIndex`,()=>Ai(this.#e,e))}getPathInfo(e){return V(this.#e.instrumentation,`store.getPathInfo`,()=>{let t=Or(this.#e,e);if(t==null)return null;let n=W(this.#e,t);return{depth:Rt(n),kind:B(n)?`directory`:`file`,path:H(this.#e,t)}})}isExpanded(e){return V(this.#e.instrumentation,`store.isExpanded`,()=>{let t=this.requireDirectoryNodeId(e),n=W(this.#e,t);return In(this.#e,t,n)})}expand(e){V(this.#e.instrumentation,`store.expand`,()=>{let t=xi(this.#e),n=ji(this.#e,e);n!=null&&or(this.#e,ir(this.#e,t,n))})}collapse(e){V(this.#e.instrumentation,`store.collapse`,()=>{let t=xi(this.#e),n=Mi(this.#e,e);n!=null&&or(this.#e,ir(this.#e,t,n))})}on(e,t){return Kn(this.#e,e,t)}getDirectoryLoadState(e){let t=this.requireDirectoryNodeId(e);return zn(this.#e,t)}markDirectoryUnloaded(e){V(this.#e.instrumentation,`store.markDirectoryUnloaded`,()=>{let t=this.requireDirectoryNodeId(e);if(U(this.#e,t).childIds.length>0)throw Error(`Cannot mark a directory with known children as unloaded: "${e}"`);let n=xi(this.#e);Vn(this.#e,t),or(this.#e,ir(this.#e,n,Qn({affectedAncestorIds:Dr(this.#e,t),affectedNodeIds:[t],path:e,projectionChanged:this.isDirectoryProjectionVisible(t)})))})}beginChildLoad(e){return V(this.#e.instrumentation,`store.beginChildLoad`,()=>{let t=this.requireDirectoryNodeId(e),n=xi(this.#e),r=Bn(this.#e,t);return or(this.#e,ir(this.#e,n,$n({affectedAncestorIds:Dr(this.#e,t),affectedNodeIds:[t],attemptId:r.attemptId,path:e,projectionChanged:this.isDirectoryProjectionVisible(t),reused:r.reused}))),r})}applyChildPatch(e,t){return V(this.#e.instrumentation,`store.applyChildPatch`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null||zn(this.#e,n)!==`loading`||!Un(this.#e,n,e.attemptId))return!1;let r=H(this.#e,n);this.validateChildPatch(r,t);let i=xi(this.#e),a=[];for(let e of t.operations){qi(r,e);let t=xi(this.#e);switch(e.type){case`add`:a.push(ir(this.#e,t,br(this.#e,e.path)));break;case`remove`:a.push(ir(this.#e,t,xr(this.#e,e.path,{recursive:e.recursive})));break;case`move`:{let n=Sr(this.#e,e.from,e.to,{collision:e.collision});n!=null&&a.push(ir(this.#e,t,n));break}}}let o=a.some(e=>e.projectionChanged)||this.isDirectoryProjectionVisible(n);return or(this.#e,ir(this.#e,i,er({affectedAncestorIds:Dr(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,childEvents:a,path:H(this.#e,n),projectionChanged:o}))),!0})}completeChildLoad(e){return V(this.#e.instrumentation,`store.completeChildLoad`,()=>{let t=this.resolveActiveDirectoryNodeId(e.nodeId);if(t==null)return!1;let n=xi(this.#e),r=Hn(this.#e,t,e.attemptId);return or(this.#e,ir(this.#e,n,tr({affectedAncestorIds:Dr(this.#e,t),affectedNodeIds:[t],attemptId:e.attemptId,path:H(this.#e,t),projectionChanged:this.isDirectoryProjectionVisible(t),stale:!r}))),r})}failChildLoad(e,t){return V(this.#e.instrumentation,`store.failChildLoad`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null)return!1;let r=xi(this.#e),i=Wn(this.#e,n,e.attemptId,t);return or(this.#e,ir(this.#e,r,nr({affectedAncestorIds:Dr(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,errorMessage:t,path:H(this.#e,n),projectionChanged:this.isDirectoryProjectionVisible(n),stale:!i}))),i})}cleanup(e={}){return V(this.#e.instrumentation,`store.cleanup`,()=>{if(this.#e.transactionStack.length>0)throw Error(`Cleanup cannot run during an open batch or transaction.`);if(_i(this.#e))throw Error(`Cleanup cannot run while directory loads are active.`);let t=xi(this.#e),n=vi(this.#e,e.mode??`stable`);return or(this.#e,ir(this.#e,t,rr({...n,affectedAncestorIds:[],affectedNodeIds:[],projectionChanged:n.idsPreserved===!1}))),n})}getNodeCount(){return this.#e.activeNodeCount}initializeExpandedPaths(e){if(e==null||e.length===0)return 0;let t=0,n=[],r=[],i=0,a=null,o=this.#e.snapshot.segmentTable,s=o.valueById,c=this.#e.snapshot.nodes,l=new Map;for(let u of e){a!=null&&u<a&&(a=null,i=0,n.length=0,r.length=0);let e=u.length>0&&u.charCodeAt(u.length-1)===47?u.length-1:u.length;if(e===0){a=u,i=e,n.length=0,r.length=0;continue}let d=0,f=0;if(a!=null){let t=Math.min(e,i),n=!0;for(let e=0;e<t;e+=1){let t=u.charCodeAt(e);if(t!==a.charCodeAt(e)){n=!1;break}t===47&&(d+=1,f=e+1)}n&&(t===i&&e>t&&u.charCodeAt(t)===47?(d+=1,f=t+1):t===e&&i>t&&a.charCodeAt(t)===47&&(d+=1,f=e+1)),d=Math.min(d,r.length)}let p=d===0?this.#e.snapshot.rootId:r[d-1]??this.#e.snapshot.rootId,m=d,h=!0,g=f;for(;g<=e;){let t=u.indexOf(`/`,g),i=t===-1||t>e?e:t,a=u.slice(g,i),f=U(this.#e,p).childIds,_=m===d?n[m]??0:0,v=_,y,b=l.get(a)??Xt(a);l.set(a,b);let x=(e,t)=>{for(v=e;v<t;v+=1){let e=f[v],t=c[e],n=s[t.nameId];if(n===a)return y=e,!0;let r=Qt(on(o,t.nameId),b);if(r>0||r===0&&n>a)return!1}return!1};if(!x(_,f.length)&&_>0&&x(0,_),y===void 0){h=!1;break}if(!B(W(this.#e,y))){h=!1;break}if(n[m]=v,r[m]=y,p=y,m+=1,i===e)break;g=i+1}if(a=u,i=e,n.length=m,r.length=m,!h){a=null,i=0,n.length=0,r.length=0;continue}for(let e=d;e<m;e+=1){let n=r[e];if(n==null)continue;let i=W(this.#e,n);In(this.#e,n,i)||(Ln(this.#e,n,!0,i),t+=1)}}return t}hasAllDirectoriesExpanded(){for(let e of this.#e.snapshot.directories.keys()){if(e===this.#e.snapshot.rootId)continue;let t=W(this.#e,e);if(!In(this.#e,e,t))return!1}return!0}requireDirectoryNodeId(e){let t=Or(this.#e,e);if(t==null)throw Error(`Path does not exist: "${e}"`);if(!B(W(this.#e,t)))throw Error(`Path is not a directory: "${e}"`);return t}resolveActiveDirectoryNodeId(e){try{if(!B(W(this.#e,e)))throw Error(`Node is not a directory: ${String(e)}`);return e}catch{return null}}isDirectoryProjectionVisible(e){let t=e;for(;t!==this.#e.snapshot.rootId;){let e=W(this.#e,t).parentId;if(e!==this.#e.snapshot.rootId){let n=W(this.#e,e),r=gr(this.#e,e);if(!In(this.#e,e,n)&&r!==t)return!1}t=e}return!0}validateChildPatch(t,n){new e({paths:this.list(t),presorted:!0,sort:this.#e.snapshot.options.sort}).batch(n.operations)}};function qi(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 Ji={compact:{itemHeight:24,factor:.8},default:{itemHeight:30,factor:1},relaxed:{itemHeight:36,factor:1.2}};function Yi(e,t){if(typeof e==`number`)return{itemHeight:t??Ji.default.itemHeight,factor:e};let n=Ji[e??`default`];return{itemHeight:t??n.itemHeight,factor:n.factor}}var Xi=Ji.default.itemHeight,Zi=`@layer base, theme, unsafe;
2
2
 
3
3
  @layer base {
4
4
  :host {
@@ -1668,7 +1668,7 @@ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{n as t,r as n,t as r}f
1668
1668
  }`}function ea(e){return`${Qi}
1669
1669
  @layer unsafe {
1670
1670
  ${e}
1671
- }`}var ta=new WeakMap;function na(e){let t=ta.get(e);if(t!=null)return t;let n=document.createElement(`div`);n.setAttribute(ft,`true`);let r=document.createElement(`div`);r.style.position=`relative`,r.style.height=`200%`,n.appendChild(r),e.appendChild(n);let i=Math.max(n.offsetWidth-n.clientWidth,0);return n.remove(),ta.set(e,i),i}function ra(e,t){if(!e.isConnected)return;let n=na(t);if(n==null)return;let r=t.querySelector(`style[${pt}]`),i=r instanceof HTMLStyleElement?r:document.createElement(`style`);r instanceof HTMLStyleElement||(i.setAttribute(pt,``),t.appendChild(i)),i.textContent=`:host { ${mt}: ${n}px; }`}var ia;function aa(e){if(typeof CSSStyleSheet<`u`&&typeof CSSStyleSheet.prototype.replaceSync==`function`&&`adoptedStyleSheets`in e){ia??(ia=new CSSStyleSheet,ia.replaceSync($i(Zi)));let t=!1;try{e.adoptedStyleSheets=[ia],t=!0}catch{}if(t){e.querySelector(`style[${ut}]`)?.remove();return}}if(e.querySelector(`style[data-file-tree-style]`)==null){let t=document.createElement(`style`);t.setAttribute(ut,``),t.textContent=$i(Zi),e.prepend(t)}}function oa(e,t){sa(e,t),aa(t),ra(e,t)}function sa(e,t){let n=e.querySelector(`template[shadowrootmode="open"], template[data-file-tree-shadowrootmode="open"]`);n instanceof HTMLTemplateElement&&(t.childNodes.length>0||(t.appendChild(n.content.cloneNode(!0)),n.hasAttribute(`shadowrootmode`)&&n.remove()))}if(typeof HTMLElement<`u`&&customElements.get(`file-tree-container`)==null){class e extends HTMLElement{constructor(){super()}connectedCallback(){let e=this.shadowRoot??this.attachShadow({mode:`open`});oa(this,e)}}if(customElements.define(lt,e),typeof document<`u`)for(let e of Array.from(document.querySelectorAll(lt)))e instanceof HTMLElement&&oa(e,e.shadowRoot??e.attachShadow({mode:`open`}))}var ca=e=>e.startsWith(`f::`)?e.slice(3):e;function la(e){let t=e.lastIndexOf(`/`);return t<0?{parentPath:``,baseName:e}:{parentPath:e.slice(0,t),baseName:e.slice(t+1)}}function ua(e,t){return e===``?t:`${e}/${t}`}function da({files:e,path:t,isFolder:n,nextBasename:r}){let i=ca(t),a=r.trim();if(a.length===0)return{error:`Name cannot be empty.`};if(a.includes(`/`))return{error:`Name cannot include "/".`};let{parentPath:o,baseName:s}=la(i);if(a===s)return{nextFiles:e,sourcePath:i,destinationPath:i,isFolder:n};let c=ua(o,a),l=Array(e.length),u=new Set;if(!n){let t=`${c}/`,r=!1;for(let n=0;n<e.length;n++){let a=e[n];if(a!==i&&a.startsWith(t))return{error:`"${c}" already exists.`};let o=a===i?c:a;if(u.has(o))return{error:`"${c}" already exists.`};u.add(o),l[n]=o,a===i&&(r=!0)}return r?{nextFiles:l,sourcePath:i,destinationPath:c,isFolder:n}:{error:`Could not find the selected file to rename.`}}let d=`${i}/`,f=`${c}/`,p=0;for(let t=0;t<e.length;t++){let n=e[t],r=n===i||n.startsWith(d);if(!r&&(n===c||n.startsWith(f)))return{error:`"${c}" already exists.`};let a=r?`${c}${n.slice(i.length)}`:n;if(u.has(a))return{error:`"${c}" already exists.`};u.add(a),l[t]=a,r&&p++}return p===0?{error:`Could not find the selected folder to rename.`}:{nextFiles:l,sourcePath:i,destinationPath:c,isFolder:n}}function fa(e){return e.endsWith(`/`)}function pa(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 ma(e){let t=[],n=new Set;for(let r of e)n.has(r)||(n.add(r),t.push(r));let r=new Set;for(let e of t.toSorted((e,t)=>e.length===t.length?e.localeCompare(t):e.length-t.length)){let t=(e.endsWith(`/`)?e.slice(0,-1):e).split(`/`),n=!1;for(let e=0;e<t.length-1;e+=1){let i=`${t.slice(0,e+1).join(`/`)}/`;if(r.has(i)){n=!0;break}}n||r.add(e)}return t.filter(e=>r.has(e))}function ha(e,t){return t.includes(e)?ma(t):[e]}function ga(e,t){return e===t?!0:e==null||t==null?!1:e.kind===t.kind&&e.directoryPath===t.directoryPath&&e.flattenedSegmentPath===t.flattenedSegmentPath&&e.hoveredPath===t.hoveredPath}function _a(e,t){return{draggedPaths:e,target:t}}function va(e,t){if(t.kind!==`directory`||t.directoryPath==null)return!1;for(let n of e)if(fa(n)&&(t.directoryPath===n||t.directoryPath.startsWith(n)))return!0;return!1}function ya(e,t){return t.kind===`root`||t.directoryPath==null?pa(e):t.directoryPath}function ba(e,t){let n=e.map(e=>{let n=ya(e,t);return n===e?null:{from:e,to:n,type:`move`}}).filter(e=>e!=null);return n.length===0?null:{operations:n,result:{draggedPaths:e,operation:n.length===1?`move`:`batch`,target:t}}}function xa(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 Sa(e,t,n){let{paths:r,preparedInput:i}=e;if(i==null){if(r==null)throw Error(`FileTree requires paths or preparedInput`);return{paths:r,preparedInput:void 0}}let a=i.paths;if(r==null)return{paths:a,preparedInput:i};if(!xa(Ki.preparePaths(r,n==null?{}:{sort:n}),a))throw Error(`FileTree ${t} received paths and preparedInput for different path lists`);return{paths:a,preparedInput:i}}function Ca(e){return e.operation===`add`||e.operation===`remove`||e.operation===`move`||e.operation===`batch`}function wa(e,t,n){if(e===t)return n;let r=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(r)?`${n.endsWith(`/`)?n:`${n}/`}${e.slice(r.length)}`:e}function Ta(e,t){if(e===t)return!0;let n=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(n)}function Ea(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 Ta(e,t.path)?n?e:null:e;case`move`:return wa(e,t.from,t.to);case`batch`:{let r=e;for(let e of t.events)if(r=Ea(r,e,n),r==null)return null;return r}}}function Da(e){return{canonicalChanged:e.canonicalChanged,projectionChanged:e.projectionChanged,visibleCountDelta:e.visibleCountDelta}}function Oa(e){switch(e.operation){case`add`:return{...Da(e),operation:`add`,path:e.path};case`remove`:return{...Da(e),operation:`remove`,path:e.path,recursive:e.recursive};case`move`:return{...Da(e),from:e.from,operation:`move`,to:e.to}}}function ka(e){return{...Da(e),events:e.events.filter(e=>e.operation===`add`||e.operation===`remove`||e.operation===`move`).map(e=>Oa(e)),operation:`batch`}}function Aa(e){switch(e.operation){case`add`:case`remove`:case`move`:return Oa(e);case`batch`:return ka(e);default:return null}}function ja(e,t){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}function Ma(e){let t=e.endsWith(`/`)?e.slice(0,-1):e;if(t.length===0)return[];let n=t.split(`/`);return n.slice(0,-1).map((e,t)=>`${n.slice(0,t+1).join(`/`)}/`)}function Na(e){return Ma(e).at(-1)??null}function Pa(e,t){return t==null?e:e.startsWith(t)?e.slice(t.length):e}function Fa(e){return e.endsWith(`/`)}var Ia=e=>e.toLowerCase();function La(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`);return n<0?t:t.slice(n+1)}function Ra(e){return e.endsWith(`/`)?e.slice(0,-1):e}function za(e,t){return t&&!e.endsWith(`/`)?`${e}/`:e}var Ba=e=>{let t=e.trim();return t.length===0?``:(t.includes(`\\`)?t.replaceAll(`\\`,`/`):t).toLowerCase()},Va=Symbol(`FILE_TREE_RENAME_VIEW`),Ha=512,Ua=512;function Wa(e){return e===`top`||e===`center`?e:`nearest`}function Ga(e,t,n){if(e===0)return-1;if(n!=null){let e=t(n);if(e!=null)return e;let r=Ma(n);for(let e=r.length-1;e>=0;--e){let n=r[e];if(n==null)continue;let i=t(n);if(i!=null)return i}}return 0}function Ka(e,t,n){if(e.paths.length===0)return{focusedIndex:-1,getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex};if(t==null)return{focusedIndex:0,getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex};let r=n??(t=>e.visibleIndexByPath.get(t)??null);return{focusedIndex:Ga(e.paths.length,r,t),getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex}}var qa=class{#e;#t=new Set;#n=new Map;#r=null;#i=null;#a=new Map;#o=new Map;#s=-1;#c=null;#l=!1;#u=e=>-1;#d=new Map;#f=null;#p=null;#m=null;#h=null;#g=null;#_;#v;#y;#b=[];#x=new Int32Array;#S=new Int32Array;#C=void 0;#w=!1;#T=null;#E=``;#D=!1;#O=new Set;#k=[];#A;#j=null;#M=null;#N=null;#P=null;#F=null;#I=null;#L=null;#R=0;#z=null;#B=new Set;#V=0;#H;#U=0;#W=!1;#G=0;#K;constructor(e){let{dragAndDrop:t,fileTreeSearchMode:n,initialSearchQuery:r,initialSelectedPaths:i,renaming:a,onSearchChange:o,paths:s,preparedInput:c,...l}=e,u=Sa({paths:s,preparedInput:c},`constructor`,l.sort);this.#e=l,t!=null&&t!==!1&&(this.#r=t===!0?{}:t),this.#w=a!=null&&a!==!1,a!=null&&a!==!1&&a!==!0&&(this.#C=a.canRename,this.#v=a.onError,this.#_=a.onRename),this.#y=o,this.#A=n??`hide-non-matches`,this.#H=this.#le(u.paths,u.preparedInput);let d=i?.map(e=>this.#Ne(e)).filter(e=>e!=null)??[],f=d.at(-1)??null;d.length>0&&(this.#B=new Set(d),this.#z=f,this.#V=1),this.#je(f,!1),r!=null&&this.#Te(r,!1),this.#K=this.#Re()}destroy(){this.#K?.(),this.#K=null,this.#n.clear(),this.#t.clear(),this.#d.clear(),this.#i=null,this.#he()}focusFirstItem(){this.#be().length>0&&this.#Fe(0)}focusLastItem(){this.#G<=0||(this.#Ie(),this.#Fe(this.#G-1))}focusNextItem(){this.#Ae(1)}focusParentItem(){if(this.#c==null)return;let e=Na(this.#c);if(e==null)return;let t=this.#Z(e);t>=0&&this.#Fe(t)}focusPath(e){let t=this.#H.getPathInfo(e)?.path??null;if(t==null)return;this.#Ie();let n=this.#Z(t);n>=0&&this.#Fe(n)}scrollToPath(e,t){let n=this.#H.getPathInfo(e)?.path??null;if(n==null)return;this.#Ie();let r=this.#xe(n);r<0||this.#Me(r)!=null&&(t?.focus!==!1&&this.#Fe(r,!1),this.#L={id:this.#R+=1,offset:Wa(t?.offset),visibleIndex:r},this.#De())}focusMountedPathFromInput(e){let t=this.#H.getPathInfo(e)?.path??null;if(t==null)return;let n=this.#Z(t);n>=0&&this.#Fe(n)}focusNearestPath(e){let t=this.resolveNearestVisiblePath(e);if(t==null)return null;let n=this.#Z(t);return n>=0?(this.#Fe(n),this.#be()[n]??t):null}focusPreviousItem(){this.#Ae(-1)}getFocusedIndex(){return this.#s}getFocusedItem(){return this.#c==null?null:this.#Q(this.#c)}getFocusedPath(){return this.#c}getScrollRequest(){return this.#L}clearScrollRequest(e){this.#L?.id===e&&(this.#L=null)}resolveNearestVisiblePath(e){let t=this.#be();if(this.#G===0)return null;if(e==null)return this.#c??t[0]??null;let n=this.#H.getPathInfo(e)?.path??e,r=this.#Z(n);return r>=0?t[r]??n:this.#X(n)??this.#c??t[0]??null}getSelectedPaths(){return[...this.#B]}getSelectionVersion(){return this.#V}getVisibleCount(){return this.#G}getVisibleRows(e,t){if(t<e||this.#G===0)return[];let n=Math.max(0,e),r=Math.min(this.#G-1,t);if(r<n)return[];let i=r-n+1;if(this.#F==null&&!this.#l&&r>=this.#b.length&&i<=Ua){let e=[];for(let t=n;t<=r;t+=1){let n=this.#H.getVisibleRowContext(t);if(n==null)break;e.push(this.#ee(n))}return e}if(!this.#l&&r>=this.#b.length&&this.#Ie(),this.#F!=null){let e=Array.from({length:r-n+1},(e,t)=>this.#Se(n+t)),t=new Map,i=e[0]??-1,a=i;for(let n=1;n<=e.length;n+=1){let r=e[n];if(r!=null&&r===a+1){a=r;continue}if(i>=0&&this.#H.getVisibleSlice(i,a).forEach((e,n)=>{t.set(i+n,e)}),r==null){i=-1,a=-1;continue}i=r,a=r}return Array.from({length:r-n+1},(e,r)=>{let i=n+r,a=this.#Se(i),o=t.get(a),s=this.#b[a];if(o==null||s==null)throw Error(`Missing projection row for filtered visible index ${String(i)}`);return this.#$(o,i,a,{ancestorPaths:this.#re(a),path:s})})}return this.#H.getVisibleSlice(n,r).map((e,t)=>{let r=n+t,i=this.#b[r];if(i==null)throw Error(`Missing projection path for visible index ${String(r)}`);return this.#$(e,r,r,{ancestorPaths:this.#re(r),path:i})})}getStickyRowCandidates(e,t){if(this.#F!=null)return null;if(this.#G===0||e<=0||t<=0)return[];let n=[];for(let r=0;r<this.#G;r+=1){let i=e+r*t,a=Math.min(this.#G-1,Math.floor(i/t)),o=this.#te(a,r)??(a>0?this.#te(a-1,r):void 0);if(o==null)break;n.push({row:this.#ee(o),subtreeEndIndex:o.subtreeEndIndex})}return n}getItem(e){let t=this.#H.getPathInfo(e);return t==null?null:this.#Q(t.path,t)}resolveMountedDirectoryPathFromInput(e){let t=this.#H.getPathInfo(e);return t?.kind===`directory`?t.path:null}toggleMountedDirectoryFromInput(e){let t=this.resolveMountedDirectoryPathFromInput(e);t!=null&&this.#ze(t)}selectAllVisiblePaths(){this.#Ie();let e=[...this.#be()];this.#ae(e,this.#c??this.#z)}selectOnlyPath(e){let t=this.#Ne(e);t!=null&&this.#ae([t],t)}selectOnlyMountedPathFromInput(e){this.#ae([e],e)}selectPath(e){let t=this.#Ne(e);t==null||this.#B.has(t)||this.#ae([...this.#B,t])}deselectPath(e){let t=this.#Ne(e);t==null||!this.#B.has(t)||this.#ae([...this.#B].filter(e=>e!==t))}toggleFocusedSelection(){this.#c!=null&&this.togglePathSelectionFromInput(this.#c)}togglePathSelection(e){let t=this.#Ne(e);if(t!=null){if(this.#B.has(t)){this.deselectPath(t);return}this.selectPath(t)}}togglePathSelectionFromInput(e){let t=this.#Ne(e);if(t!=null){if(this.#B.has(t)){this.#ae([...this.#B].filter(e=>e!==t),t);return}this.#ae([...this.#B,t],t)}}selectPathRange(e,t){let n=this.#Ne(e);if(n==null)return;this.#Ie();let r=this.#z,i=r==null?-1:this.#Ce(r),a=this.#Ce(n);if(i===-1||a===-1){let e=t?[...this.#B,n]:[n];this.#ae(e,n);return}let[o,s]=i<=a?[i,a]:[a,i],c=this.#be().slice(o,s+1),l=t?[...this.#B,...c]:c;this.#ae(l,r)}extendSelectionFromFocused(e){if(this.#c==null)return;let t=this.#s;if(t===-1)return;let n=Math.min(this.#G-1,Math.max(0,t+e));if(n===t)return;!this.#l&&n>=this.#b.length&&this.#Ie();let r=this.#be(),i=r[t]??null,a=r[n]??null;if(i==null||a==null)return;let o=new Set(this.#B);o.has(i)&&o.has(a)?o.delete(i):o.add(a),this.#ae([...o],this.#z??i,!1),this.#Fe(n)}getDragAndDropConfig(){return this.#r}isDragAndDropEnabled(){return this.#r!=null}getDragSession(){return this.#i==null?null:{draggedPaths:[...this.#i.draggedPaths],primaryPath:this.#i.primaryPath,target:this.#i.target==null?null:{...this.#i.target}}}startDrag(e){if(this.#r==null)return!1;let t=this.#Ne(e);if(t==null||this.#M!=null&&this.#M.length>0)return!1;let n=this.getSelectedPaths(),r=ha(t,n);return this.#r.canDrag?.(r)===!1?!1:(n.includes(t)||this.#ae([t],t,!1),this.#Pe(t),this.#i={draggedPaths:r,primaryPath:t,target:null},this.#De(),!0)}setDragTarget(e){let t=this.#i;if(t==null)return;let n=e;if(n!=null){let e=_a(t.draggedPaths,n);(va(t.draggedPaths,n)||this.#r?.canDrop?.(e)===!1)&&(n=null)}ga(t.target,n)||(this.#i={...t,target:n},this.#De())}cancelDrag(){this.#i!=null&&(this.#i=null,this.#De())}completeDrag(){let e=this.#i;if(e==null)return!1;this.#i=null;let t=e.target==null?null:{...e.target};if(t==null)return this.#De(),!1;let n=_a(e.draggedPaths,t);if(va(e.draggedPaths,t)||this.#r?.canDrop?.(n)===!1)return this.#De(),!1;let r=ba(e.draggedPaths,t);if(r==null)return this.#De(),!1;try{if(r.operations.length===1){let e=r.operations[0];if(e==null||e.type!==`move`)throw Error(`Expected a single move operation for one-item drops`);this.#H.move(e.from,e.to,{collision:e.collision})}else this.#ce(r.operations),this.#H.batch(r.operations)}catch(e){return this.#De(),this.#r?.onDropError?.(e instanceof Error?e.message:String(e),n),!1}return this.#r?.onDropComplete?.(r.result),!0}subscribe(e){return this.#t.add(e),e(),()=>{this.#t.delete(e)}}add(e){this.#H.add(e)}remove(e,t={}){this.#H.remove(e,t)}move(e,t,n={}){this.#H.move(e,t,n)}batch(e){this.#H.batch(e)}onMutation(e,t){let n=e,r=t,i=this.#n.get(n);return i??(i=new Set,this.#n.set(n,i)),i.add(r),()=>{let e=this.#n.get(n);e?.delete(r),e?.size===0&&this.#n.delete(n)}}setSearch(e){this.#Te(e,!0)}openSearch(e=``){this.#Te(e,!0)}closeSearch(){this.#Te(null,!0)}isSearchOpen(){return this.#M!==null}getSearchValue(){return this.#M??``}getSearchMatchingPaths(){return this.#k}focusNextSearchMatch(){this.#we(1)}focusPreviousSearchMatch(){this.#we(-1)}startRenaming(e=this.#c??``,t={}){if(!this.#w)return!1;let n=this.#H.getPathInfo(e);if(n==null)return!1;let r=n.path,i=Fa(r),a=Ra(r);if(this.#C?.({isFolder:i,path:a})===!1)return!1;for(let e of Ma(r))this.#H.isExpanded(e)||this.#H.expand(e);return this.#ae([r],r,!1),this.#M!=null&&(this.#Te(null,!1),this.#y?.(this.#M)),this.#Pe(r),this.#T=r,this.#E=La(r),this.#D=t.removeIfCanceled??!1,this.#De(),!0}[Va](){return{cancel:()=>{this.#q()},commit:()=>{this.#J()},getPath:()=>this.#T,getValue:()=>this.#E,isActive:()=>this.#T!=null,setValue:e=>{this.#Y(e)}}}#q(){if(this.#T==null)return;let e=this.#T,t=this.#D;if(this.#T=null,this.#E=``,this.#D=!1,t){this.remove(e,Fa(e)?{recursive:!0}:void 0);return}this.#Pe(e),this.#De()}#J(){let e=this.#T;if(e==null)return;if(this.#D&&this.#E.trim().length===0){this.#T=null,this.#E=``,this.#D=!1,this.remove(e,Fa(e)?{recursive:!0}:void 0);return}let t=Fa(e),n=da({files:this.#H.list(),isFolder:t,nextBasename:this.#E,path:Ra(e)});if(this.#T=null,this.#E=``,this.#D=!1,`error`in n){this.#Pe(e),this.#v?.(n.error),this.#De();return}if(n.sourcePath===n.destinationPath){this.#Pe(e),this.#De();return}this.#_?.({destinationPath:n.destinationPath,isFolder:n.isFolder,sourcePath:n.sourcePath}),this.move(za(n.sourcePath,t),za(n.destinationPath,t))}#Y(e){this.#T==null||this.#E===e||(this.#E=e,this.#De())}resetPaths(e,t={}){let n=this.#H.list().length,r=this.#G,i=Sa({paths:e,preparedInput:t.preparedInput},`resetPaths`,this.#e.sort),a=this.#le(i.paths,i.preparedInput,t.initialExpandedPaths),o=this.#c,s=this.#T,c=this.getSelectedPaths(),l=this.#z;this.#K?.(),this.#H=a,this.#d.clear(),this.#he();let u=c.map(e=>a.getPathInfo(e)?.path??null).filter(e=>e!=null),d=!ja(this.#B,u);this.#B=new Set(u),d&&(this.#V+=1),this.#z=l==null?null:a.getPathInfo(l)?.path??null,this.#T=s==null?null:a.getPathInfo(s)?.path??null,this.#T??(this.#E=``,this.#D=!1),this.#je(o,o!=null||u.length>0||this.#z!=null),this.#K=this.#Re(),this.#De(),this.#Oe({canonicalChanged:!0,operation:`reset`,pathCountAfter:i.paths.length,pathCountBefore:n,projectionChanged:!0,usedPreparedInput:t.preparedInput!=null,visibleCountDelta:this.#G-r})}#X(e){this.#Ie();let t=Na(e),n=Pa(e,t),r=null,i=null;for(let e of this.#be()){if(Na(e)!==t)continue;let a=Pa(e,t);if(a<n){r=e;continue}if(a>n){i=e;break}}return r??i}#Z(e){let t=this.#Ce(e);if(t!==-1)return t;let n=Ma(e);for(let e=n.length-1;e>=0;--e){let t=n[e];if(t==null)continue;let r=this.#Ce(t);if(r!==-1)return r}return this.#be().length>0?0:-1}#Q(e,t){let n=this.#d.get(e);if(n!=null)return n;let r=t??this.#H.getPathInfo(e);if(r==null)return null;let i=r.kind===`directory`?this.#oe(r.path):this.#se(r.path);return this.#d.set(r.path,i),i}#$(e,t,n,r){return{ancestorPaths:r.ancestorPaths,depth:e.depth,flattenedSegments:e.flattenedSegments?.map(e=>({isTerminal:e.isTerminal,name:e.name,path:e.path})),hasChildren:e.hasChildren,index:t,isExpanded:e.isExpanded,isFlattened:e.isFlattened,isFocused:r.path===this.#c,isSelected:this.#B.has(r.path),kind:e.kind,level:e.depth,name:e.name,path:r.path,posInSet:r.posInSet??this.#x[n]??0,setSize:r.setSize??this.#S[n]??0}}#ee(e){return this.#$(e.row,e.index,e.index,{ancestorPaths:e.ancestorPaths,path:e.row.path,posInSet:e.posInSet,setSize:e.setSize})}#te(e,t){let n=this.#H.getVisibleRowContext(e);return n==null?void 0:n.ancestorRows[t]??(t===n.ancestorRows.length&&n.row.kind===`directory`&&n.row.isExpanded?n:void 0)}#ne(e){let t=this.#a.get(e);if(t!=null)return t;let n=this.#u(e),r=n<0?[]:[...this.#ne(n),n];return this.#a.set(e,r),r}#re(e){let t=this.#o.get(e);if(t!=null)return t;let n=this.#ne(e).map(e=>this.#b[e]??``).filter(e=>e!==``);return this.#o.set(e,n),n}#ie(e){this.#H.collapse(e)}#ae(e,t=this.#z,n=!0){let r=[...new Set(e)],i=!ja(this.#B,r),a=this.#z!==t;!i&&!a||(this.#B=new Set(r),this.#z=t,i&&(this.#V+=1),n&&this.#De())}#oe(e){return{collapse:()=>{this.#ie(e)},deselect:()=>{this.deselectPath(e)},expand:()=>{this.#ke(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!0,isExpanded:()=>this.#H.isExpanded(e),isFocused:()=>this.#c===e,isSelected:()=>this.#B.has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)},toggle:()=>{this.#ze(e)}}}#se(e){return{deselect:()=>{this.deselectPath(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!1,isFocused:()=>this.#c===e,isSelected:()=>this.#B.has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)}}}#ce(e){let t=this.#H.list();this.#le(t).batch(e)}#le(e,t,n){return new Ki({...this.#e,paths:e,preparedInput:t??void 0,...n===void 0?{}:{initialExpandedPaths:n}})}#ue(){return this.#h??=this.#H.list(),this.#h}#de(){if(this.#m!=null)return this.#m;let e=new Set;for(let t of this.#ue()){e.add(t);for(let n of Ma(t))e.add(n)}return this.#m=[...e].sort(),this.#m}#fe(){return this.#g??=this.#ue().map(Ia),this.#g}#pe(){return this.#f??=this.#de().filter(e=>e.endsWith(`/`)),this.#f}#me(){return this.#p??=this.#pe().map(Ia),this.#p}#he(){this.#f=null,this.#p=null,this.#m=null,this.#h=null,this.#g=null}#ge(){return this.#pe().filter(e=>this.#H.isExpanded(e))}#_e(e){let t=new Set(this.#j??[]);if(e)for(let e of this.#B)for(let n of Ma(e))t.add(n);this.#ve(t)}#ve(e){this.#W=!0;try{for(let t of this.#pe()){let n=e.has(t),r=this.#H.isExpanded(t);n&&!r?this.#H.expand(t):!n&&r&&this.#H.collapse(t)}}finally{this.#W=!1}}#ye(){if(this.#M==null||this.#M.length===0){this.#k=[],this.#F=null,this.#I=null,this.#P=null,this.#G=this.#U;return}let e=this.#b;if(this.#k=e.filter(e=>this.#O.has(e)),this.#A!==`hide-non-matches`||this.#O.size===0){this.#F=null,this.#I=null,this.#P=null,this.#G=this.#U;return}let t=[],n=[],r=new Map;for(let[i,a]of e.entries())this.#N?.has(a)===!0&&(r.set(a,n.length),t.push(i),n.push(a));this.#F=t,this.#I=n,this.#P=r,this.#G=n.length}#be(){return this.#I??this.#b}#xe(e){return this.#I==null?this.#H.getVisibleIndex(e)??-1:this.#P?.get(e)??-1}#Se(e){return this.#F?.[e]??e}#Ce(e){return this.#P?.get(e)??this.#H.getVisibleIndex(e)??-1}#we(e){let t=this.#k;if(t.length===0)return;let n=this.#c,r=n==null?-1:t.indexOf(n),i=t[r<0?e>0?0:t.length-1:Math.min(t.length-1,Math.max(0,r+e))];i!=null&&this.focusPath(i)}#Te(e,t){let n=e==null?null:Ba(e),r=this.#M;if(r!==n){if(r==null&&n!=null&&(this.#j=this.#ge()),this.#M=n,n==null)this.#_e(!0),this.#j=null,this.#O.clear(),this.#N=null,this.#je(this.#c,!0);else if(n.length===0)this.#_e(!1),this.#O.clear(),this.#N=null,this.#je(this.#c,!0);else{let e=this.#Ee();this.#je(e,!0)}t&&(this.#y?.(this.#M),this.#De())}}#Ee(){if(this.#M==null||this.#M.length===0)return this.#O.clear(),this.#c;let e=this.#M,t=this.#ue(),n=this.#fe(),r=[],i=new Set,a=null;for(let o=0;o<t.length;o+=1){if(!n[o].includes(e))continue;let s=t[o];r.push(s),i.add(s),a??=s}let o=this.#pe(),s=this.#me();for(let t=0;t<o.length;t+=1){if(!s[t].includes(e))continue;let n=o[t];i.has(n)||(r.push(n),i.add(n),a??=n)}this.#O=i;let c=this.#A===`hide-non-matches`&&r.length>0?new Set:null;this.#N=c;let l=this.#A===`expand-matches`?new Set(this.#j??[]):new Set;for(let e of r){c?.add(e),e.endsWith(`/`)&&l.add(e);for(let t of Ma(e))l.add(t),c?.add(t)}return this.#ve(l),a??this.#c}#De(){for(let e of this.#t)e()}#Oe(e){this.#n.get(e.operation)?.forEach(t=>{t(e)}),this.#n.get(`*`)?.forEach(t=>{t(e)})}#ke(e){for(let t of Ma(e))this.#H.isExpanded(t)||this.#H.expand(t);this.#H.isExpanded(e)||this.#H.expand(e)}#Ae(e){let t=this.#G;if(t===0)return;let n=this.#s===-1?0:this.#s,r=Math.min(t-1,Math.max(0,n+e));(r!==n||this.#s===-1)&&(!this.#l&&this.#F==null&&r>=this.#b.length&&this.#Ie(),this.#Fe(r))}#je(e,t=!0){let n=this.#H.getVisibleCount();this.#U=n;let r=Ka(this.#H.getVisibleTreeProjectionData(t?void 0:Math.min(n,Ha)),e,t?e=>this.#H.getVisibleIndex(e):void 0);this.#a.clear(),this.#o.clear(),this.#l=r.paths.length>=n,this.#u=r.getParentIndex,this.#b=r.paths,this.#x=r.posInSetByIndex,this.#S=r.setSizeByIndex,this.#ye(),this.#s=e==null?this.#be().length>0?0:-1:this.#Z(e),this.#c=this.#s<0?null:this.#Me(this.#s)}#Me(e){return this.#be()[e]??(this.#F==null?this.#H.getVisibleRowContext(e)?.row.path??null:null)}#Ne(e){return this.#H.getPathInfo(e)?.path??null}#Pe(e){if(e==null)return;let t=this.#Z(e);t>=0&&this.#Fe(t,!1)}#Fe(e,t=!0){let n=this.#Me(e);n!=null&&(this.#s===e&&this.#c===n||(this.#s=e,this.#c=n,t&&this.#De()))}#Ie(){this.#l||this.#je(this.#c,!0)}#Le(e){let t=Ea(this.#T,e);t==null&&this.#T!=null&&(this.#E=``),this.#T=t;let n=Ea(this.#c,e,!0),r=[...this.#B].map(t=>Ea(t,e)).filter(e=>e!=null).map(e=>this.#H.getPathInfo(e)?.path??null).filter(e=>e!=null),i=Ea(this.#z,e),a=i==null?null:this.#H.getPathInfo(i)?.path??null,o=[...new Set(r)];return ja(this.#B,o)||(this.#B=new Set(o),this.#V+=1),this.#z=a,n}#Re(){return this.#H.on(`*`,e=>{if(this.#W)return;e.canonicalChanged&&(this.#d.clear(),this.#he()),this.#i!=null&&Ca(e)&&(this.#i=null);let t=Ca(e)?this.#Le(e):this.#c,n=this.#M!=null&&this.#M.length>0?this.#Ee():this.#M===``?this.#c:t,r=this.#M!=null||e.operation!==`expand`&&e.operation!==`collapse`;this.#je(n,r),this.#De();let i=Aa(e);i!=null&&this.#Oe(i)})}#ze(e){if(this.#H.isExpanded(e)){this.#ie(e);return}this.#ke(e)}},Ja=e=>{if(e==null||e.length===0)return`0`;let t=`${e.length}`;for(let n of e)t+=`\0${n.path}\0${n.status}`;return t};function Ya(e){let t=e.endsWith(`/`),n=``,r=-1;for(let t=0;t<=e.length;t+=1){if(!(e[t]===`/`||t===e.length)){r===-1&&(r=t);continue}r!==-1&&(n!==``&&(n+=`/`),n+=e.slice(r,t),r=-1)}return n===``?null:{isDirectory:t,path:n}}function Xa(e){let t=e.endsWith(`/`)?e.slice(0,-1):e;if(t.length===0)return[];let n=t.split(`/`);return n.slice(0,-1).map((e,t)=>`${n.slice(0,t+1).join(`/`)}/`)}function Za(e,t){return t?`${e}/`:e}function Qa(e,t=null){let n=Ja(e==null?void 0:[...e]);if(n===`0`)return null;if(t?.signature===n)return t;let r=new Map,i=new Set,a=new Set;for(let t of e??[]){let e=Ya(t.path);if(e==null)continue;let n=Za(e.path,e.isDirectory);r.set(n,t.status),t.status===`ignored`&&e.isDirectory?a.add(n):e.isDirectory&&a.delete(n);for(let t of Xa(e.path))i.add(t)}return{directoriesWithChanges:i,ignoredDirectoryPaths:a,signature:n,statusByPath:r}}var G,$a,eo,to,no,ro,io,ao,oo,so,co={},lo=[],uo=Array.isArray,fo=lo.slice,po=Object.assign;function mo(e){e&&e.parentNode&&e.remove()}function ho(e,t,n){var r,i,a,o={};for(a in t)a==`key`?r=t[a]:a==`ref`&&typeof e!=`function`?i=t[a]:o[a]=t[a];return arguments.length>2&&(o.children=arguments.length>3?fo.call(arguments,2):n),go(e,o,r,i,null)}function go(e,t,n,r,i){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++$a,__i:-1,__u:0};return i==null&&G.vnode!=null&&G.vnode(a),a}function _o(e){return e.children}function vo(e,t){this.props=e,this.context=t,this.__g=0}function yo(e,t){if(t==null)return e.__?yo(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`?yo(e):null}function bo(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 bo(e)}}function xo(e){(8&e.__g||!(e.__g|=8)||!eo.push(e)||no++)&&to==G.debounceRendering||((to=G.debounceRendering)||queueMicrotask)(So)}function So(){for(var e,t,n,r,i,a,o,s,c=1;eo.length;)eo.length>c&&eo.sort(ro),e=eo.shift(),c=eo.length,8&e.__g&&(n=void 0,i=(r=(t=e).__v).__e,a=[],o=[],(s=t.__P)&&((n=po({},r)).__v=r.__v+1,G.vnode&&G.vnode(n),Ao(s,n,r,t.__n,s.namespaceURI,32&r.__u?[i]:null,a,i??yo(r),!!(32&r.__u),o,s.ownerDocument),n.__v=r.__v,n.__.__k[n.__i]=n,Mo(a,n,o),n.__e!=i&&bo(n)));no=0}function Co(e,t,n,r,i,a,o,s,c,l,u,d){var f,p,m,h,g,_,v,y=r&&r.__k||lo,b=t.length;for(c=wo(n,t,y,c,b),f=0;f<b;f++)(m=n.__k[f])!=null&&(p=m.__i==-1?co:y[m.__i]||co,m.__i=f,_=Ao(e,m,p,i,a,o,s,c,l,u,d),h=m.__e,m.ref&&p.ref!=m.ref&&(p.ref&&Fo(p.ref,null,m),u.push(m.ref,m.__c||h,m)),g==null&&h!=null&&(g=h),(v=!!(4&m.__u))||p.__k===m.__k?c=To(m,c,e,v):typeof m.type==`function`&&_!==void 0?c=_:h&&(c=h.nextSibling),m.__u&=-7);return n.__e=g,c}function wo(e,t,n,r,i){var a,o,s,c,l,u=n.length,d=u,f=0;for(e.__k=Array(i),a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(c=a+f,(o=e.__k[a]=typeof o==`string`||typeof o==`number`||typeof o==`bigint`||o.constructor==String?go(null,o,null,null,null):uo(o)?go(_o,{children:o},null,null,null):o.constructor==null&&o.__b>0?go(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o).__=e,o.__b=e.__b+1,s=null,(l=o.__i=Eo(o,n,c,d))!=-1&&(d--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(i>u?f--:i<u&&f++),typeof o.type!=`function`&&(o.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,o.__u|=4))):e.__k[a]=null;if(d)for(a=0;a<u;a++)(s=n[a])!=null&&!(2&s.__u)&&(s.__e==r&&(r=yo(s)),Io(s,s));return r}function To(e,t,n,r){var i,a;if(typeof e.type==`function`){for(i=e.__k,a=0;i&&a<i.length;a++)i[a]&&(i[a].__=e,t=To(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=yo(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function Eo(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&(2&l.__u)==0;if(l===null&&e.key==null||u&&s==l.key&&c==l.type)return n;if(r>+!!u){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])!=null&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function Do(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n??``}function Oo(e,t,n,r,i){var a;n:if(t==`style`)if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||Do(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||Do(e.style,t,n[t])}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(io,`$1`)),(t=t.slice(2))[0].toLowerCase()!=t[0]&&(t=t.toLowerCase()),e.__l||={},e.__l[t+a]=n,n?r?n.l=r.l:(n.l=ao,e.addEventListener(t,a?so:oo,a)):e.removeEventListener(t,a?so:oo,a);else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n??``;break n}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function ko(e){return function(t){if(this.__l){var n=this.__l[t.type+e];if(t.u==null)t.u=ao++;else if(t.u<n.l)return;return n(G.event?G.event(t):t)}}}function Ao(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,ee,O,k,A,j=t.type;if(t.constructor!=null)return null;128&n.__u&&(c=!!(32&n.__u),n.__c.__z&&(s=t.__e=n.__e=(a=n.__c.__z)[0],n.__c.__z=null)),(d=G.__b)&&d(t);n:if(typeof j==`function`)try{if(v=t.props,y=`prototype`in j&&j.prototype.render,b=(d=j.contextType)&&r[d.__c],x=d?b?b.props.value:d.__:r,n.__c?2&(f=t.__c=n.__c).__g&&(f.__g|=1,_=!0):(y?t.__c=f=new j(v,x):(t.__c=f=new vo(v,x),f.constructor=j,f.render=Lo),b&&b.sub(f),f.props=v,f.state||={},f.context=x,f.__n=r,p=!0,f.__g|=8,f.__h=[],f._sb=[]),y&&f.__s==null&&(f.__s=f.state),y&&j.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=po({},f.__s)),po(f.__s,j.getDerivedStateFromProps(v,f.__s))),m=f.props,h=f.state,f.__v=t,p)y&&j.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),y&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(y&&j.getDerivedStateFromProps==null&&v!==m&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(v,x),!(4&f.__g)&&f.shouldComponentUpdate!=null&&!1===f.shouldComponentUpdate(v,f.__s,x)||t.__v==n.__v){for(t.__v!=n.__v&&(f.props=v,f.state=f.__s,f.__g&=-9),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),S=0;S<f._sb.length;S++)f.__h.push(f._sb[S]);f._sb=[],f.__h.length&&o.push(f);break n}f.componentWillUpdate!=null&&f.componentWillUpdate(v,f.__s,x),y&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(m,h,g)})}if(f.context=x,f.props=v,f.__P=e,f.__g&=-5,C=G.__r,w=0,y){for(f.state=f.__s,f.__g&=-9,C&&C(t),d=f.render(f.props,f.state,f.context),T=0;T<f._sb.length;T++)f.__h.push(f._sb[T]);f._sb=[]}else do f.__g&=-9,C&&C(t),d=f.render(f.props,f.state,f.context),f.state=f.__s;while(8&f.__g&&++w<25);f.state=f.__s,f.getChildContext!=null&&(r=po({},r,f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),E=d,d!=null&&d.type===_o&&d.key==null&&(E=No(d.props.children)),s=Co(e,uo(E)?E:[E],t,n,r,i,a,o,s,c,l,u),t.__u&=-161,f.__h.length&&o.push(f),_&&(f.__g&=-4)}catch(e){if(t.__v=null,c||a!=null)if(e.then){for(D=0,ee=!1,t.__u|=c?160:128,t.__c.__z=[],O=0;O<a.length;O++)(k=a[O])==null||ee||(k.nodeType==8&&k.data==`$s`?(D>0&&t.__c.__z.push(k),D++,a[O]=null):k.nodeType==8&&k.data==`/$s`?(--D>0&&t.__c.__z.push(k),ee=D===0,s=a[O],a[O]=null):D>0&&(t.__c.__z.push(k),a[O]=null));if(!ee){for(;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;a[a.indexOf(s)]=null,t.__c.__z=[s]}t.__e=s}else{for(A=a.length;A--;)mo(a[A]);jo(t)}else t.__e=n.__e,t.__k=n.__k,e.then||jo(t);G.__e(e,t,n)}else s=t.__e=Po(n.__e,t,n,r,i,a,o,c,l,u);return(d=G.diffed)&&d(t),128&t.__u?void 0:s}function jo(e){e&&e.__c&&(e.__c.__g|=4),e&&e.__k&&e.__k.forEach(jo)}function Mo(e,t,n){for(var r=0;r<n.length;r++)Fo(n[r],n[++r],n[++r]);G.__c&&G.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){G.__e(e,t.__v)}})}function No(e){return typeof e!=`object`||!e||e.__b&&e.__b>0?e:uo(e)?e.map(No):po({},e)}function Po(e,t,n,r,i,a,o,s,c,l){var u,d,f,p,m,h,g,_,v=n.props,y=t.props,b=t.type;if(b==`svg`?i=`http://www.w3.org/2000/svg`:b==`math`?i=`http://www.w3.org/1998/Math/MathML`:i||=`http://www.w3.org/1999/xhtml`,a!=null){for(u=0;u<a.length;u++)if((m=a[u])&&`setAttribute`in m==!!b&&(b?m.localName==b:m.nodeType==3)){e=m,a[u]=null;break}}if(e==null){if(b==null)return l.createTextNode(y);e=l.createElementNS(i,b,y.is&&y),s&&=(G.__m&&G.__m(t,a),!1),a=null}if(b==null)v===y||s&&e.data==y||(e.data=y);else{if(a&&=fo.call(e.childNodes),v=n.props||co,!s&&a!=null)for(v={},u=0;u<e.attributes.length;u++)v[(m=e.attributes[u]).name]=m.value;for(u in v)if(m=v[u],u!=`children`){if(u==`dangerouslySetInnerHTML`)f=m;else if(!(u in y)){if(u==`value`&&`defaultValue`in y||u==`checked`&&`defaultChecked`in y)continue;Oo(e,u,null,m,i)}}for(u in _=1&n.__u,y)m=y[u],u==`children`?p=m:u==`dangerouslySetInnerHTML`?d=m:u==`value`?h=m:u==`checked`?g=m:s&&typeof m!=`function`||v[u]===m&&!_||Oo(e,u,m,v[u],i);if(d)s||f&&(d.__html==f.__html||d.__html==e.innerHTML)||(e.innerHTML=d.__html),t.__k=[];else if(f&&(e.innerHTML=``),Co(b==`template`?e.content:e,uo(p)?p:[p],t,n,r,b==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&yo(n,0),s,c,l),a!=null)for(u=a.length;u--;)mo(a[u]);s||(u=`value`,b==`progress`&&h==null?e.removeAttribute(`value`):h==null||h===e[u]&&(b!==`progress`||h)||Oo(e,u,h,v[u],i),u=`checked`,g!=null&&g!=e[u]&&Oo(e,u,g,v[u],i))}return e}function Fo(e,t,n){try{if(typeof e==`function`){var r=typeof e.__u==`function`;r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(e){G.__e(e,n)}}function Io(e,t,n){var r,i;if(G.unmount&&G.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||Fo(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){G.__e(e,t)}r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&Io(r[i],t,n||typeof e.type!=`function`);n||mo(e.__e),e.__e&&e.__e.__l&&(e.__e.__l=null),e.__e=e.__c=e.__=null}function Lo(e,t,n){return this.constructor(e,n)}function Ro(e,t){var n,r,i,a;t==document&&(t=document.documentElement),G.__&&G.__(e,t),r=(n=!!(e&&32&e.__u))?null:t.__k,e=t.__k=ho(_o,null,[e]),i=[],a=[],Ao(t,e,r||co,co,t.namespaceURI,r?null:t.firstChild?fo.call(t.childNodes):null,i,r?r.__e:t.firstChild,n,a,t.ownerDocument),Mo(i,e,a)}function zo(e,t){e.__u|=32,Ro(e,t)}G={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!(1&i.__g)){i.__g|=4;try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),o=8&i.__g),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),o=8&i.__g),o)return void(i.__g|=2)}catch(t){e=t}}throw no=0,e}},$a=0,vo.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=po({},this.state);typeof e==`function`&&(e=e(po({},n),this.props)),e&&po(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),xo(this))},vo.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),xo(this))},vo.prototype.render=_o,eo=[],no=0,ro=function(e,t){return e.__v.__b-t.__v.__b},io=/(PointerCapture)$|Capture$/i,ao=0,oo=ko(!1),so=ko(!0);var Bo=0;Array.isArray;function K(e,t,n,r,i,a){t||={};var o,s,c=t;if(`ref`in c&&typeof e!=`function`)for(s in c={},t)s==`ref`?o=t[s]:c[s]=t[s];var l={type:e,props:c,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Bo,__i:-1,__u:0,__source:i,__self:a};return G.vnode&&G.vnode(l),l}var Vo=16,Ho=16,Uo={};function Wo({name:e,remappedFrom:t,token:n,width:r,height:i,viewBox:a,label:o,alignCapitals:s=!1}){"use no memo";let c=`#${e.replace(/^#/,``)}`,{width:l,height:u,viewBox:d}=Uo[e]??{width:Vo,height:Ho},f=r??l,p=i??u,m=a??d??`0 0 ${l} ${u}`;return K(`svg`,{"data-icon-name":t??e,"data-icon-token":n,"data-align-capitals":s,...o==null?{"aria-hidden":!0}:{"aria-label":o,role:`img`},viewBox:m,width:f,height:p,children:K(`use`,{href:c})})}var Go=e=>{if(e.length<2)return[e,``];let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]},Ko=e=>{if(e.length<4)return[e,``];let t=e.lastIndexOf(`.`)+1,n=e.length-t>10,r=t>=1&&!n?t:Math.ceil(e.length/2);return[e.slice(0,r),e.slice(r)]},qo=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)]},Jo=(e,{splitIndex:t}={})=>{if(typeof t!=`number`){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}return[e.slice(0,t),e.slice(t)]},Yo=(e,{splitOffset:t}={})=>{if(typeof t!=`number`||t<=0||t>=e.length){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}let n=e.length-t;return[e.slice(0,n),e.slice(n)]},Xo=(e,{splitOffset:t}={})=>{if(typeof t!=`number`||t<=0||t>=e.length){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}let n=t;return[e.slice(0,n),e.slice(n)]};function Zo({children:e,marker:t,variant:n=`default`}){"use no memo";return K(`div`,{"aria-hidden":!0,"data-truncate-marker-cell":!0,children:K(`div`,{"data-truncate-marker":!0,children:typeof t==`function`?t({children:e}):n===`fade`?K(`span`,{"data-truncate-fade":!0}):t})})}function Qo(e){"use no memo";let{mode:t,children:n}=e;return K(`div`,{children:[K(`div`,{"data-truncate-content":`visible`,children:t===`fruncate`?K(`span`,{children:n}):n}),K(`div`,{"data-truncate-content":`overflow`,"aria-hidden":!0,children:t===`fruncate`?K(`span`,{children:n}):n})]})}function $o({children:e,mode:t=`truncate`,marker:n=`…`,variant:r=`default`,...i}){"use no memo";let a=K(Qo,{mode:t,children:e},`content`),o=K(Zo,{marker:n,mode:t,variant:r},`marker`),s=K(`div`,{"data-truncate-fill":!0},`fill`);return K(`div`,{"data-truncate-container":t,"data-truncate-variant":r,...i,children:K(`div`,{"data-truncate-grid":!0,children:t===`truncate`?[a,o]:[o,a,s]})})}function es({children:e,...t}){"use no memo";return K($o,{mode:`truncate`,...t,children:e})}function ts({children:e,...t}){"use no memo";return K($o,{mode:`fruncate`,...t,children:e})}function ns({children:e,contents:t,priority:n=`end`,split:r=`center`,minimumLength:i=12,className:a,style:o,...s}){"use no memo";let c=null,l=null;if(Array.isArray(t)){if(t.length!==2)return console.error(`MiddleTruncate: contents must be an array of two items`),null;c=K(es,{...s,children:t[0]}),l=K(ts,{...s,children:t[1]})}else{if(typeof e!=`string`)return console.error(`MiddleTruncate: children must be a string`),null;if(e.length===0)return K(`div`,{className:a,style:o});if(e.length<i)return K(n===`end`?ts:es,{...s,className:a,style:o,children:e});let t=null,u=null,d=null;if(typeof r==`string`)r===`center`?t=Go:r===`extension`?t=Ko:r===`leaf-path`&&(t=qo);else if(typeof r==`number`)t=Jo,u=r;else if(Array.isArray(r)){let[e,n]=r;d=n,e===`last`?t=Yo:e===`first`&&(t=Xo)}else typeof r==`function`&&(t=r);t??=Go;let[f,p]=t(e,{priority:n,variant:s.variant,splitIndex:typeof u==`number`?u:void 0,splitOffset:typeof d==`number`?d:void 0}),m=f.length>=p.length,h=n===`equal`&&!m,g=n===`equal`&&m,_={},v={};h&&(_.marker=``),g&&(v.marker=``),c=K(es,{...s,..._,children:f}),l=K(ts,{...s,...v,children:p})}return K(`div`,{"data-truncate-group-container":`middle`,className:a,style:o,children:[K(`div`,{"data-truncate-segment-priority":n===`start`||n===`equal`?`1`:`2`,children:c}),K(`div`,{"data-truncate-segment-priority":n===`end`||n===`equal`?`1`:`2`,children:l})]})}var rs={endIndex:-1,startIndex:-1};function is(e,t,n){return Math.min(Math.max(e,t),n)}function as(e,t){return e<0||t<e?rs:{endIndex:t,startIndex:e}}function os(e){return e.startIndex<0||e.endIndex<e.startIndex}function ss(e,t){return os(e)?0:(e.endIndex-e.startIndex+1)*t}function cs(e,t,n){if(t<=0)return-1;let r=t*n;return e<=0?0:e>=r?t:Math.floor(e/n)}function ls(e,t,n){return t<=0||e<=0?-1:e>=t*n?t-1:Math.ceil(e/n)-1}function us(e){let t=new Map;return e.forEach((e,n)=>{if(e.kind!==`directory`||!e.isExpanded)return;let r=e.ancestorPaths.length,i=t.get(r);if(i==null){t.set(r,[n]);return}i.push(n)}),t}function ds(e,t){let n=0,r=e.length-1,i=-1;for(;n<=r;){let a=Math.floor((n+r)/2),o=e[a];if(o==null)break;if(o<=t){i=a,n=a+1;continue}r=a-1}return i}function fs(e){let t=new Map,n=[];for(let r=0;r<e.length;r+=1){let i=e[r];if(i==null)continue;let a=i.kind===`directory`&&i.isExpanded?[...i.ancestorPaths,i.path]:i.ancestorPaths,o=0;for(;o<n.length&&o<a.length&&n[o]===a[o];)o+=1;for(let e=n.length-1;e>=o;--e){let i=n[e];i!=null&&t.set(i,r-1)}n.length=o;for(let e=o;e<a.length;e+=1){let t=a[e];t!=null&&n.push(t)}}let r=e.length-1;for(let e of n)t.set(e,r);return t}function ps(e,t,n){if(e.length===0||t<=0)return[];let r=fs(e),i=us(e),a=[];for(let r=0;r<e.length;r+=1){let o=i.get(r);if(o==null||o.length===0)break;let s=t+r*n,c=ds(o,Math.min(e.length-1,Math.floor(s/n))),l=null;for(;c>=0;){let t=o[c],n=t==null?null:e[t]??null;if(n!=null&&(r===0||n.ancestorPaths[r-1]===a[r-1]?.path)){l=n;break}--c}if(l==null)break;a.push(l)}return a.map((i,a)=>{let o=a*n,s=(r.get(i.path)??e.length-1)+1;if(s>=e.length)return{row:i,top:o};let c=s*n-t;return{row:i,top:Math.min(o,c-n)}}).filter(e=>e.top+n>0)}function ms(e,t){let n=t.totalRowCount??e.length,r=n*t.itemHeight,i=Math.max(0,t.viewportHeight),a=Math.max(0,Math.floor(t.overscan)),o=Math.max(0,r-i),s=is(t.scrollTop,0,o),c=t.stickyRows??ps(e,s,t.itemHeight),l=c.reduce((e,n)=>Math.max(e,n.top+t.itemHeight),0),u=Math.min(r,s+l),d=Math.max(0,i-l),f=Math.max(0,r-u),p=cs(s,n,t.itemHeight),m=cs(u,n,t.itemHeight),h=l<=0||p<0||p>=n?-1:p,g=h===-1?-1:Math.min(n-1,m-1),_=h===-1||g<h?0:g-h+1,v=d<=0||m>=n?rs:as(m,ls(u+d,n,t.itemHeight)),y=g+1,b=os(v)?rs:as(Math.max(y,v.startIndex-a),Math.min(n-1,v.endIndex+a)),x=ss(b,t.itemHeight);return{occlusion:{firstOccludedIndex:h,lastOccludedIndex:g,occludedCount:_},physical:{itemHeight:t.itemHeight,maxScrollTop:o,overscan:a,scrollTop:s,totalHeight:r,totalRowCount:n,viewportHeight:i},projected:{contentHeight:f,paneHeight:d,paneTop:u},sticky:{height:l,rows:c},visible:v,window:{endIndex:b.endIndex,height:x,offsetTop:os(b)?0:b.startIndex*t.itemHeight,startIndex:b.startIndex}}}var hs={added:`A`,deleted:`D`,ignored:null,modified:`M`,renamed:`R`,untracked:`U`},gs={added:`Git status: added`,deleted:`Git status: deleted`,ignored:`Git status: ignored`,modified:`Git status: modified`,renamed:`Git status: renamed`,untracked:`Git status: untracked`},_s=`Contains git status items`;function vs(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,topInset:i=0,viewportHeight:a}=e;if(n<0)return null;let o=Math.max(0,i),s=n*r,c=s+r;if(s<t+o){let e=Math.max(0,s-o);return e===t?null:e}if(c>t+a){let e=c-a;return e===t?null:e}return null}function ys(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,offset:i,topInset:a=0,totalHeight:o,viewportHeight:s}=e;if(i===`nearest`)return vs({currentScrollTop:t,focusedIndex:n,itemHeight:r,topInset:a,viewportHeight:s});if(n<0)return null;let c=Math.max(0,a),l=n*r,u=Math.max(0,s-c),d=i===`center`?c+Math.max(0,(u-r)/2):c,f=Math.max(0,o-s),p=Math.max(0,Math.min(l-d,f));return p===t?null:p}function bs(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,targetViewportOffset:i,totalHeight:a,viewportHeight:o}=e;if(n<0)return null;let s=Math.max(0,i),c=n*r,l=c+r,u=t+s,d=t+o;if(c>=u&&l<=d)return null;let f=Math.max(0,a-o),p=Math.max(0,Math.min(c-s,f));return p===t?null:p}function xs(e){if(e==null||!e.isConnected||e===document.body||e===document.documentElement)return!1;e.focus({preventScroll:!0});let t=e.getRootNode();return t instanceof ShadowRoot?t.activeElement===e:document.activeElement===e}function Ss(e){let t=e.getRootNode();if(t instanceof ShadowRoot){let e=t.activeElement;return e instanceof HTMLElement?e:null}let n=document.activeElement;return n instanceof HTMLElement&&e.contains(n)?n:null}function Cs(e,t){if(e==null)return t;let n=e.getBoundingClientRect().height;return n>0?n:e.clientHeight>0?e.clientHeight:t}function ws(e,t){return e!=null&&e>0?e:t}function Ts(e){let t=e.borderBoxSize,n=Array.isArray(t)?t[0]:t;return n!=null&&Number.isFinite(n.blockSize)&&n.blockSize>0?n.blockSize:e.contentRect.height>0?e.contentRect.height:null}function Es(e,t,n,r,i=0){let a=vs({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,topInset:i,viewportHeight:r});return a==null?!1:(e.scrollTop=a,!0)}function Ds(e,t,n,r,i,a,o=0){let s=ys({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,offset:a,topInset:o,totalHeight:i,viewportHeight:r});return s==null?!1:(e.scrollTop=s,!0)}function Os(e,t,n,r,i,a){let o=bs({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,targetViewportOffset:a,totalHeight:i,viewportHeight:r});return o==null?!1:(e.scrollTop=o,!0)}function ks(e,t,n,r){return n.end<n.start?null:e<n.start?-t:e>n.end?r:null}function As(e){let{renamingPath:t,previousRenamingPath:n,hasRenderedInput:r}=e;return t==null?`reset`:r?n===t?`ignore`:`focus-input`:`reveal-canonical`}function js({ariaLabel:e,isFlattened:t=!1,ref:n,value:r,onBlur:i,onInput:a}){return K(`input`,{ref:n,"data-item-rename-input":!0,...t?{"data-item-flattened-rename-input":!0}:{},"aria-label":e,value:r,onBlur:i,onInput:a,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation()})}function Ms(e){let{row:t,mode:n,targetPath:r,ariaLabel:i,domId:a,isParked:o,itemHeight:s,features:c,state:l,extraStyle:u}=e,d=n===`sticky`,f=t.ancestorPaths.at(-1)??``,p={};return l.isFocusRinged&&(p[`data-item-focused`]=!0),t.isSelected&&(p[`data-item-selected`]=!0),l.isContextHovered&&(p[`data-item-context-hover`]=`true`),l.isDragTarget&&(p[`data-item-drag-target`]=!0),l.isDragging&&(p[`data-item-dragging`]=!0),l.effectiveGitStatus!=null&&(p[`data-item-git-status`]=l.effectiveGitStatus),l.containsGitChange&&(p[`data-item-contains-git-change`]=`true`),{"aria-expanded":!d&&t.kind===`directory`?t.isExpanded:void 0,"aria-haspopup":c.contextMenuEnabled?`menu`:void 0,"aria-label":i,"aria-level":d?void 0:t.level+1,"aria-posinset":d?void 0:t.posInSet+1,"aria-selected":d?void 0:t.isSelected?`true`:`false`,"aria-setsize":d?void 0:t.setSize,"data-file-tree-sticky-path":d?r:void 0,"data-file-tree-sticky-row":d?`true`:void 0,"data-item-context-menu-button-visibility":c.actionLaneEnabled?c.contextMenuButtonVisibility:void 0,"data-item-context-menu-trigger-mode":c.contextMenuEnabled?c.contextMenuTriggerMode:void 0,"data-item-has-context-menu-action-lane":c.actionLaneEnabled?`true`:void 0,"data-item-has-git-lane":c.gitLaneActive?`true`:void 0,"data-item-parent-path":f.length>0?f:void 0,"data-item-parked":o?`true`:void 0,"data-item-path":r,"data-item-type":t.kind===`directory`?`folder`:`file`,"data-type":`item`,id:d?void 0:a,role:d?void 0:`treeitem`,style:{minHeight:`${s}px`,...u},tabIndex:!d&&t.isFocused?0:-1,...p}}function Ns(e){let{event:t,mode:n,isSearchOpen:r,isDirectory:i}=e,a=t.ctrlKey||t.metaKey,o=t.shiftKey||a,s=t.shiftKey?{additive:a,kind:`range`}:a?{kind:`toggle`}:{kind:`single`};return{closeSearch:r,revealCanonical:n===`sticky`,selection:s,toggleDirectory:!o&&i}}var Ps,Fs,Is,Ls,Rs=Object.is,zs=0,Bs=[],Vs=G,Hs=Vs.__b,Us=Vs.__r,Ws=Vs.diffed,Gs=Vs.__c,Ks=Vs.unmount,qs=Vs.__;function Js(e,t){Vs.__h&&Vs.__h(Fs,e,zs||t),zs=0;var n=Fs.__H||={__:[],__h:[]};return e>=n.__.length&&n.__.push({}),n.__[e]}function Ys(e){return zs=1,Xs(sc,e)}function Xs(e,t,n){var r=Js(Ps++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):sc(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);Rs(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=Fs,!Fs.__f)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=r.__c.__H.__.filter(function(e){return!!e.__c});if(i.every(function(e){return!e.__N}))return!a||a.call(this,e,t,n);var o=r.__c.props!==e;return i.forEach(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,Rs(t,e.__[0])||(o=!0)}}),a&&a.call(this,e,t,n)||o};Fs.__f=!0;var a=Fs.shouldComponentUpdate,o=Fs.componentWillUpdate;Fs.componentWillUpdate=function(e,t,n){if(4&this.__g){var r=a;a=void 0,i(e,t,n),a=r}o&&o.call(this,e,t,n)},Fs.shouldComponentUpdate=i}return r.__N||r.__}function Zs(e,t){var n=Js(Ps++,3);!Vs.__s&&oc(n.__H,t)&&(n.__=e,n.u=t,Fs.__H.__h.push(n))}function Qs(e,t){var n=Js(Ps++,4);!Vs.__s&&oc(n.__H,t)&&(n.__=e,n.u=t,Fs.__h.push(n))}function q(e){return zs=5,$s(function(){return{current:e}},[])}function $s(e,t){var n=Js(Ps++,7);return oc(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function ec(e,t){return zs=8,$s(function(){return e},t)}function tc(){for(var e;e=Bs.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(ic),e.__H.__h.forEach(ac),e.__H.__h=[]}catch(t){e.__H.__h=[],Vs.__e(t,e.__v)}}Vs.__b=function(e){Fs=null,Hs&&Hs(e)},Vs.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),qs&&qs(e,t)},Vs.__r=function(e){Us&&Us(e),Ps=0;var t=(Fs=e.__c).__H;t&&(Is===Fs?(t.__h=[],Fs.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(ic),t.__h.forEach(ac),t.__h=[],Ps=0)),Is=Fs},Vs.diffed=function(e){Ws&&Ws(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Bs.push(t)!==1&&Ls===Vs.requestAnimationFrame||((Ls=Vs.requestAnimationFrame)||rc)(tc)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),Is=Fs=null},Vs.__c=function(e,t){t.some(function(e){try{e.__h.forEach(ic),e.__h=e.__h.filter(function(e){return!e.__||ac(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],Vs.__e(n,e.__v)}}),Gs&&Gs(e,t)},Vs.unmount=function(e){Ks&&Ks(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{ic(e)}catch(e){t=e}}),n.__H=void 0,t&&Vs.__e(t,n.__v))};var nc=typeof requestAnimationFrame==`function`;function rc(e){var t,n=function(){clearTimeout(r),nc&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);nc&&(t=requestAnimationFrame(n))}function ic(e){var t=Fs,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),Fs=t}function ac(e){var t=Fs;e.__c=e.__(),Fs=t}function oc(e,t){return!e||e.length!==t.length||t.some(function(t,n){return!Rs(t,e[n])})}function sc(e,t){return typeof t==`function`?t(e):t}function cc(e,t=null,n=null){"use no memo";let r=e.flattenedSegments;return r==null||r.length===0?t??e.name:K(`span`,{"data-item-flattened-subitems":!0,children:r.map((e,i)=>{let a=i===r.length-1;return K(_o,{children:[K(`span`,{"data-item-flattened-subitem":e.path,"data-item-flattened-subitem-drag-target":n===e.path?`true`:void 0,children:a&&t!=null?t:K(es,{children:e.name})}),i<r.length-1?` / `:``]},e.path)})})}function lc(e){return e.isFlattened?e.flattenedSegments?.findLast(e=>e.isTerminal)?.path??e.path:e.path}function uc(e){let t=e.flattenedSegments;return t==null||t.length===0?e.name:t.map(e=>e.name).join(` / `)}function dc(e,t,n,r){return e.map((e,i)=>{let a=i*n,o=e.subtreeEndIndex+1;if(o>=r)return{row:e.row,top:a};let s=o*n-t;return{row:e.row,top:Math.min(a,s-n)}}).filter(e=>e.top+n>0)}function fc({controller:e,itemHeight:t,overscan:n,scrollTop:r,stickyFolders:i,viewportHeight:a}){let o=e.getVisibleCount(),s=i&&o>0?e.getStickyRowCandidates(r,t):[],c=s==null&&i&&o>0?e.getVisibleRows(0,o-1):[],l=ms(c,{itemHeight:t,overscan:n,scrollTop:r,stickyRows:s==null?void 0:dc(s,r,t,o),totalRowCount:o,viewportHeight:a}),u=i&&r<=0&&o>0?e.getStickyRowCandidates(1,t):[],d=u!=null&&r<=0?dc(u,1,t,o):i&&r<=0&&c.length>0?ps(c,1,t):l.sticky.rows;return{overlayHeight:d.reduce((e,n)=>Math.max(e,n.top+t),0),overlayRows:d,snapshot:l,visibleRows:c}}var pc=400,mc=10,hc=40,gc=18;function _c(e,t,n){let r=e,i=document.elementFromPoint?.bind(document)??null,a=r.elementFromPoint?.(t,n)??i?.(t,n)??null;return e instanceof ShadowRoot&&(a==null||!e.contains(a))?vc(e,t,n):a instanceof HTMLElement?a:null}function vc(e,t,n){let r=Array.from(e.querySelectorAll(`[data-type="item"], [data-item-flattened-subitem]`));for(let e=r.length-1;e>=0;e--){let i=r[e],a=i.getBoundingClientRect();if(t>=a.left&&t<=a.right&&n>=a.top&&n<=a.bottom)return i}return null}function yc(e){let t=e?.closest?.(`[data-type="item"]`);if(!(t instanceof HTMLElement))return null;let n=t.dataset.itemPath??null;if(n==null)return null;let r=e?.closest?.(`[data-item-flattened-subitem]`),i=r instanceof HTMLElement?r.getAttribute(`data-item-flattened-subitem`)??null:null;if(i!=null&&i.endsWith(`/`))return{directoryPath:i,flattenedSegmentPath:i,hoveredPath:n,kind:`directory`};if(t.dataset.itemType===`folder`)return{directoryPath:n,flattenedSegmentPath:null,hoveredPath:n,kind:`directory`};let a=t.dataset.itemParentPath??null;return a==null||a.length===0?{directoryPath:null,flattenedSegmentPath:null,hoveredPath:n,kind:`root`}:{directoryPath:a,flattenedSegmentPath:null,hoveredPath:n,kind:`directory`}}function bc(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 xc(){return navigator.vendor!==`Apple Computer, Inc.`}function Sc(e,t){let n=e-t.top;if(n<hc)return-Math.ceil((hc-Math.max(0,n))/hc*gc);let r=t.bottom-e;return r<hc?Math.ceil((hc-Math.max(0,r))/hc*gc):0}function Cc(e,t){if(e!=null){let t=hs[e];return t==null?null:{text:t,title:gs[e]}}return t?{icon:{name:`file-tree-icon-dot`,width:6,height:6},title:_s}:null}function wc(e,t,n){if(t==null||t.size===0)return null;let r=[];for(let i=e.length-1;i>=0;--i){let a=e[i],o=n.get(a);if(o!=null){for(let e of r)n.set(e,o);return o?`ignored`:null}if(t.has(a)){n.set(a,!0);for(let e of r)n.set(e,!0);return`ignored`}r.push(a)}for(let e of r)n.set(e,!1);return null}function Tc(e){return e!=null&&`toggle`in e}function Ec(e){return e.code===`Space`||e.key===` `||e.key===`Spacebar`}function Dc(e){return e.key.length===1&&/^[\p{L}\p{N}]$/u.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey}function Oc(e){return e==null?``:`[data-item-section="spacing-item"][data-ancestor-path="${e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}"] { opacity: 1; }`}function kc(e){return e.shiftKey&&e.key===`F10`||e.key===`ContextMenu`}function Ac(e,t){return t&&kc(e)||(e.ctrlKey||e.metaKey)&&Ec(e)?!0:e.key===`ArrowDown`||e.key===`ArrowLeft`||e.key===`ArrowRight`||e.key===`ArrowUp`}var jc=new Set([`ArrowDown`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`]);function Mc(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&(t.dataset.fileTreeContextMenuRoot===`true`||t.dataset.type===`context-menu-anchor`||t.dataset.type===`context-menu-trigger`||t.getAttribute(`slot`)===`context-menu`))return!0;return!1}function Nc(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 Pc(e,t){return{bottom:t,height:0,left:e,right:e,top:t,width:0,x:e,y:t}}function Fc(e,t){if(e==null)return t.offsetTop;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.top-r.top}function Ic(e,t,n){if(n==null){e.delete(t);return}e.set(t,n)}function Lc(e,t,n){if(e==null)return null;let r=t.get(e)??null;if(r!=null)return r;let i=n.get(e)??null;return i?.dataset.itemParked===`true`?null:i}function Rc(e){if(e==null)return[];let t=[];for(let n of e.querySelectorAll(`button[data-file-tree-sticky-row="true"]`)){if(!(n instanceof HTMLElement))continue;let e=n.dataset.fileTreeStickyPath;e!=null&&t.push(e)}return t}function zc(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 Bc(e,t,n,r,i,a,o){let s=Math.max(0,a-i),c=t?.getBoundingClientRect()??null,l=c==null||n==null?null:n.getBoundingClientRect().top-c.top,u=zc(e,r),d=c==null||u==null?null:u.getBoundingClientRect().top-c.top;return Math.max(0,Math.min(d??Math.max(l??0,s),Math.max(0,o-i)))}function Vc(e,t){return{kind:e.kind,name:uc(e),path:t}}function Hc(e){return e==null?void 0:`${e}__tree`}function Uc(e,t,n){if(e!=null)return`${e}__focused-item-${encodeURIComponent(t)}${n?`__parked`:``}`}function Wc(e){return e===`file-tree-icon-chevron`||e===`file-tree-icon-dot`||e===`file-tree-icon-file`||e===`file-tree-icon-lock`}function Gc(e,t){if(e==null)return null;if(`text`in e)return K(`span`,{title:e.title,children:e.text});let n=typeof e.icon==`string`?Wc(e.icon)?t(e.icon):{name:e.icon}:Wc(e.icon.name)?(()=>{let n=t(e.icon.name),{name:r,...i}=e.icon;return{...n,...i}})():e.icon;return K(`span`,{title:e.title,children:K(Wo,{...n})})}function Kc(e){e!=null&&xs(e.querySelector([`button:not([disabled])`,`[href]`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`, `))??e)}function qc(e,t,{actionLaneEnabled:n=!1,customDecoration:r=null,decorationLaneEnabled:i=!1,dragTargetFlattenedSegmentPath:a=null,gitDecoration:o=null,gitLaneActive:s=!1,renameInput:c=null,showDecorativeActionAffordance:l=!1}={}){let u=lc(e);return K(_o,{children:[e.depth>0?K(`div`,{"data-item-section":`spacing`,children:Array.from({length:e.depth}).map((t,n)=>K(`div`,{"data-item-section":`spacing-item`,"data-ancestor-path":e.ancestorPaths[n]},n))}):null,K(`div`,{"data-item-section":`icon`,children:e.kind===`directory`?K(Wo,{...t(`file-tree-icon-chevron`)}):K(Wo,{...t(`file-tree-icon-file`,u)})}),K(`div`,{"data-item-section":`content`,children:e.isFlattened?cc(e,c,a):c??K(ns,{minimumLength:5,split:`extension`,children:e.name})}),i?K(`div`,{"data-item-section":`decoration`,children:r==null?null:Gc(r,t)}):null,s?K(`div`,{"data-item-section":`git`,children:Gc(o,t)}):null,n?K(`div`,{"data-item-section":`action`,children:l?K(`span`,{"aria-hidden":`true`,"data-item-action-affordance":`decorative`,children:K(Wo,{...t(`file-tree-icon-ellipsis`)})}):null}):null]})}function Jc(e,t,n,r={}){let{controller:i,renameView:a,visualFocusPath:o,contextHoverPath:s,draggedPathSet:c,dragTarget:l,dragAndDropEnabled:u,shouldSuppressContextMenu:d,handleRowDragStart:f,handleRowDragEnd:p,handleRowTouchStart:m,instanceId:h,itemHeight:g,gitStatusByPath:_,ignoredGitDirectories:v,ignoredInheritanceCache:y,directoriesWithGitChanges:b,gitLaneActive:x,contextMenuEnabled:S,contextMenuTriggerMode:C,contextMenuButtonTriggerEnabled:w,contextMenuButtonVisibility:T,contextMenuRightClickEnabled:E,registerRenameInput:D,registerButton:ee,resolveIcon:O,renderDecorationForRow:k,openContextMenuForRow:A,onRowClick:j,onKeyDown:M}=e,N=lc(t),{isParked:P=!1,mode:te=`flow`,style:ne}=r,re=te===`sticky`,ie=_?.get(N)??null??wc(t.ancestorPaths,v,y),ae=t.kind===`directory`&&(b?.has(N)??!1),oe=k(t,N),se=Cc(ie,ae),ce=S&&w,le=oe!=null||x||ce,ue=ce&&T===`always`,de=a.getPath()===N,fe=de?a.getValue():``,pe=re||!de?null:K(js,{ref:D,ariaLabel:`Rename ${uc(t)}`,isFlattened:t.isFlattened,value:fe,onBlur:()=>{a.commit()},onInput:e=>{a.setValue(e.currentTarget.value)}}),me=qc(t,O,{actionLaneEnabled:ce,customDecoration:oe,decorationLaneEnabled:le,dragTargetFlattenedSegmentPath:l?.flattenedSegmentPath??null,gitDecoration:se,gitLaneActive:x,renameInput:pe,showDecorativeActionAffordance:ue}),F={...Ms({ariaLabel:uc(t),domId:t.isFocused?Uc(h,N,P):void 0,extraStyle:ne,features:{actionLaneEnabled:ce,contextMenuButtonVisibility:ce?T:null,contextMenuEnabled:S,contextMenuTriggerMode:S?C:null,gitLaneActive:x},isParked:P,itemHeight:g,mode:te,row:t,state:{containsGitChange:ae,effectiveGitStatus:ie,isContextHovered:s===N,isDragTarget:l?.kind===`directory`&&l.directoryPath===N,isDragging:c?.has(N)===!0,isFocusRinged:t.isFocused&&o===N},targetPath:N}),key:n,onContextMenu:S||u?e=>{if(d()){e.preventDefault();return}S&&(e.preventDefault(),E&&(i.focusMountedPathFromInput(N),A(t,N,{anchorRect:Pc(e.clientX,e.clientY),source:`right-click`})))}:void 0,onFocus:re?void 0:()=>{i.focusMountedPathFromInput(N)},onKeyDown:re?void 0:M,ref:e=>{ee(N,e)}};return!re&&de?K(`div`,{...F,children:me}):K(`button`,{...F,type:`button`,draggable:u&&!P,onDragEnd:u&&!P?p:void 0,onDragStart:u&&!P?e=>{f(e,t,N)}:void 0,onMouseDown:e=>{if(re){e.preventDefault();return}i.isSearchOpen()&&e.preventDefault()},onTouchStart:u&&!P?e=>{m(e,t,N)}:void 0,onClick:e=>{j(e,t,N,te)},children:me})}function Yc(e,t,n){return t.end<t.start?[]:e.controller.getVisibleRows(t.start,t.end).filter(e=>!n.has(lc(e))).map((n,r)=>Jc(e,n,t.start+r))}function Xc({composition:e,controller:t,gitStatusByPath:n,ignoredGitDirectories:r,directoriesWithGitChanges:i,icons:a,instanceId:o,itemHeight:s=Xi,overscan:c=10,renamingEnabled:l=!1,renderRowDecoration:u,searchBlurBehavior:d=`close`,searchEnabled:f=!1,searchFakeFocus:p=!1,slotHost:m,stickyFolders:h=!1,initialViewportHeight:g=420}){"use no memo";let _=q(null),v=q(null),y=q(!1),b=q(null),x=q(null),S=q(null),C=q(null),w=q(null),T=q(new Map),E=q(new Map),D=q(()=>{}),ee=q(null),O=q(0),k=q(!1),A=q(null);A.current!==t&&(k.current=!1,A.current=t);let j=q(!1),M=q(null),N=q(null),P=q(!1),te=q(null),ne=q(null),re=q(null),ie=q(null),ae=q(null),oe=q(null),se=q(null),ce=q(null),le=q(!1),ue=q(null),de=q(null),fe=q(null),pe=q(null),me=$s(()=>new Map,[]),[,F]=Ys(0),[he,I]=Ys(null),[ge,_e]=Ys(null),[ve,ye]=Ys(null),[be,xe]=Ys(null),[Se,Ce]=Ys(0),[L,Te]=Ys(null),Ee=q(L);Ee.current=L;let De=q(null),Oe=q(null),ke=q(null),Ae=q(null),je=q(null),Me=q(!1),Ne=()=>{Oe.current=null,ke.current=null,Ae.current=null},Pe=(e,t)=>{Oe.current=e,ke.current=null,Ae.current=t==null?null:{path:e,scrollTop:t}},Fe=(e,t)=>{Oe.current=null,ke.current={path:e,viewportOffset:t},Ae.current=null},Ie=q(d===`retain`&&t.isSearchOpen()),[Le,Re]=Ys(p);Zs(()=>{p||Re(!1)},[p]);let ze=q(!1),Be=ec(()=>{ze.current=!0,Re(e=>e&&!1)},[]),[Ve,He]=Ys(()=>fc({controller:t,itemHeight:s,overscan:c,scrollTop:0,stickyFolders:h,viewportHeight:g})),[Ue,We]=Ys(!1);Zs(()=>{We(!0)},[]);let Ge=e?.contextMenu?.enabled===!0||e?.contextMenu?.render!=null||e?.contextMenu?.onOpen!=null||e?.contextMenu?.onClose!=null,Ke=e?.contextMenu?.triggerMode??(Ge?`right-click`:`both`),qe=Ke===`both`||Ke===`button`,Je=e?.contextMenu?.buttonVisibility??`when-needed`,Ye=Ke===`both`||Ke===`right-click`;Qs(()=>{let e=S.current;if(e==null)return;let t=e=>{if(!(e instanceof CustomEvent))return;let t=e.detail?.path??null;je.current=t,_e(t),xe(t==null?null:`pointer`)},n=e=>{e instanceof CustomEvent&&(Me.current=e.detail?.disabled===!0)};return e.addEventListener(`file-tree-debug-set-context-menu-trigger`,t),e.addEventListener(`file-tree-debug-set-scroll-suppression`,n),()=>{e.removeEventListener(`file-tree-debug-set-context-menu-trigger`,t),e.removeEventListener(`file-tree-debug-set-scroll-suppression`,n)}},[]);let Xe=ec((e,t)=>{Ic(T.current,e,t)},[]),Ze=ec((e,t)=>{Ic(E.current,e,t)},[]),Qe=ec(e=>{x.current=e},[]),$e=ec(e=>Lc(e,E.current,T.current),[]),et=n!=null||r!=null||i!=null,{resolveIcon:tt}=$s(()=>we(a),[a]),nt=t[Va](),rt=nt.getPath(),it=rt!=null,at=t.isSearchOpen(),ot=t.getSearchValue(),R=t.getFocusedPath(),z=t.getFocusedIndex(),st=t.getScrollRequest(),ct=t.isDragAndDropEnabled(),lt=t.getDragSession(),ut=$s(()=>lt==null?null:new Set(lt.draggedPaths),[lt]),dt=lt?.target??null,ft=lt?.primaryPath??null,pt=Hc(o),{overlayHeight:mt,overlayRows:vt,snapshot:yt,visibleRows:bt}=Ve,xt=yt.physical.viewportHeight,St=$s(()=>({end:yt.window.endIndex,start:yt.window.startIndex}),[yt.window.endIndex,yt.window.startIndex]),Ct=vt,wt=yt.sticky.rows,Tt=yt.physical.totalHeight,Et=yt.sticky.height,Dt=$s(()=>new Set(wt.map(e=>lc(e.row))),[wt]),Ot=z>=0&&z>=St.start&&z<=St.end,kt=ec((e,t)=>u?.({item:Vc(e,t),row:e})??null,[u]),At=ec(e=>xs(e==null?null:T.current.get(e)??null)?!0:xs(S.current),[]),jt=ec(e=>{At(t.focusNearestPath(e))},[t,At]),Mt=q(jt);Mt.current=jt;let Nt=q(!0),Pt=q(()=>{}),Ft=ec((t=!0)=>{let n=Ee.current;n!=null&&(Nt.current=Nt.current&&t,Te(null),e?.contextMenu?.onClose?.(),Nt.current&&jt(n.path))},[e?.contextMenu,jt]);Pt.current=Ft;let It=ec(e=>{let t=e==null?null:Fc(S.current,e);ye(e=>e===t?e:t)},[]),Lt=ec((e,n,r)=>{let i=t.getItem(n);if(i==null)return;let a=$e(n);if(a?.dataset.fileTreeStickyRow===`true`){let e=C.current;Pe(n,e?.scrollTop??null),j.current=!0,I(e=>e===n?e:n)}i.focus(),It(a),Nt.current=!0,Te({anchorRect:r?.anchorRect??null,item:Vc(e,n),path:n,source:r?.source??`keyboard`})},[t,$e,It]),Rt=ec(e=>{if(l){if(t.isSearchOpen()){let e=C.current,t=Cs(e,xt);te.current=z<0||e==null?null:Math.max(0,Math.min(z*s-e.scrollTop,Math.max(0,t-s))),P.current=!0}t.startRenaming(e)!==!1&&(xe(`focus`),F(e=>e+1))}},[t,z,s,l,xt]),zt=ec((e,{restoreTreeFocus:n=!0,targetOffset:r=`live-overlay`}={})=>{let i=C.current;if(i==null)return!1;t.focusPath(e);let a=t.getFocusedIndex();if(a<0)return!1;let o=t.getVisibleRows(a,a)[0]??null;if(o==null)return!1;let l=Cs(i,xt),u=t.getVisibleCount()*s,d=r===`sticky-parents`?o.ancestorPaths.length*s:fc({controller:t,itemHeight:s,overscan:c,scrollTop:i.scrollTop,stickyFolders:h,viewportHeight:l}).snapshot.sticky.height;return j.current=!0,Os(i,a,s,l,u,d),D.current(),De.current=n?e:null,!0},[t,s,c,xt,h]),B=()=>y.current===!0||pe.current!=null||le.current===!0,Bt=e=>typeof window.requestAnimationFrame==`function`?window.requestAnimationFrame(()=>{e()}):window.setTimeout(e,16),Vt=e=>{if(e!=null){if(typeof window.cancelAnimationFrame==`function`){window.cancelAnimationFrame(e);return}window.clearTimeout(e)}},Ht=()=>{ie.current!=null&&(clearTimeout(ie.current),ie.current=null),re.current=null},Ut=()=>{oe.current?.remove(),oe.current=null},Wt=()=>{Vt(ne.current),ne.current=null,ae.current=null},Gt=e=>{let t=S.current?.getRootNode();if(t instanceof ShadowRoot){t.append(e);return}document.body.append(e)},Kt=()=>{ce.current?.(),ce.current=null,pe.current!=null&&(clearTimeout(pe.current),pe.current=null),le.current=!1,ue.current=null,fe.current=null,de.current!=null&&(de.current.setAttribute(`draggable`,`true`),de.current.style.removeProperty(`touch-action`),de.current=null),Ut(),Ht(),Wt(),se.current=null},V=(e,n)=>{let r=S.current?.getRootNode(),i=yc(_c(r instanceof ShadowRoot?r:document,e,n));return t.setDragTarget(i),t.getDragSession()?.target??null},qt=e=>{let n=t.getDragAndDropConfig()?.openOnDropDelay??800;if(e==null||e.kind!==`directory`||e.directoryPath==null||n<=0){Ht();return}let r=t.getItem(e.directoryPath),i=Tc(r)?r:null;if(i==null||i.isExpanded()){Ht();return}let a=`${e.directoryPath}::${e.flattenedSegmentPath??``}`;re.current!==a&&(Ht(),re.current=a,ie.current=setTimeout(()=>{let n=t.getDragSession()?.target;n?.kind!==`directory`||n.directoryPath!==e.directoryPath||n.flattenedSegmentPath!==e.flattenedSegmentPath||i.expand()},n))},Jt=()=>{ne.current=null;let e=ae.current,n=C.current;if(e==null||n==null||t.getDragSession()==null)return;let r=n.getBoundingClientRect(),i=Sc(e.clientY,r);if(i===0)return;let a=Math.max(0,n.scrollHeight-n.clientHeight),o=Math.max(0,Math.min(a,n.scrollTop+i));o!==n.scrollTop&&(n.scrollTop=o,D.current()),qt(V(e.clientX,e.clientY)),ne.current=Bt(Jt)},Yt=(e,t)=>{ae.current={clientX:e,clientY:t},ne.current??=Bt(Jt)},Xt=(e,n,r)=>{let i=e.currentTarget;if(i!=null){if(Kt(),Ut(),Ht(),Wt(),t.startDrag(r)===!1){e.preventDefault();return}if(se.current=n,e.dataTransfer!=null&&(e.dataTransfer.effectAllowed=`move`,e.dataTransfer.dropEffect=`move`,e.dataTransfer.setData(`text/plain`,r),xc())){let t=bc(i),n=i.getBoundingClientRect();Object.assign(t.style,{height:`${n.height}px`,opacity:`0.85`,transform:`translate3d(-9999px, 0px, 0)`,width:`${n.width}px`}),Gt(t),oe.current=t,e.dataTransfer.setDragImage(t,Math.max(0,e.clientX-n.left),Math.max(0,e.clientY-n.top))}}},Zt=()=>{Ut(),Ht(),Wt(),se.current=null,t.cancelDrag()},Qt=(e,n,r)=>{if(pe.current!=null||le.current)return;let i=e.touches[0],a=e.currentTarget;if(i==null||a==null)return;fe.current={clientX:i.clientX,clientY:i.clientY},de.current=a,a.setAttribute(`draggable`,`false`);let o=(e={})=>{let t=e.restoreNativeDraggable??!le.current;pe.current!=null&&(clearTimeout(pe.current),pe.current=null),document.removeEventListener(`touchmove`,s),document.removeEventListener(`touchend`,c),document.removeEventListener(`touchcancel`,c),ce.current===o&&(ce.current=null),t&&(a.setAttribute(`draggable`,`true`),de.current===a&&(de.current=null),fe.current=null)},s=e=>{let t=e.touches[0],n=fe.current;if(t==null||n==null)return;let r=t.clientX-n.clientX,i=t.clientY-n.clientY;r*r+i*i<=mc*mc||o()},c=()=>{o()};document.addEventListener(`touchmove`,s,{passive:!0}),document.addEventListener(`touchend`,c),document.addEventListener(`touchcancel`,c),ce.current=o,pe.current=setTimeout(()=>{if(o({restoreNativeDraggable:!1}),t.startDrag(r)===!1){a.setAttribute(`draggable`,`true`),de.current===a&&(de.current=null),fe.current=null;return}le.current=!0,de.current=a,a.setAttribute(`draggable`,`false`),a.style.setProperty(`touch-action`,`none`),se.current=n;let e=a.getBoundingClientRect(),s=bc(a);Object.assign(s.style,{height:`${e.height}px`,opacity:`0.85`,transform:`translate3d(${e.left}px, ${e.top}px, 0)`,width:`${e.width}px`}),Gt(s),oe.current=s,ue.current={x:i.clientX-e.left,y:i.clientY-e.top};let c=e=>{let t=e.touches[0];if(t==null)return;e.preventDefault();let n=ue.current;n!=null&&oe.current!=null&&(oe.current.style.transform=`translate3d(${t.clientX-n.x}px, ${t.clientY-n.y}px, 0)`),qt(V(t.clientX,t.clientY)),Yt(t.clientX,t.clientY)},l=e=>{let n=e.changedTouches[0];n!=null&&V(n.clientX,n.clientY),t.completeDrag(),Kt()},u=()=>{t.cancelDrag(),Kt()};ce.current=()=>{document.removeEventListener(`touchmove`,c),document.removeEventListener(`touchend`,l),document.removeEventListener(`touchcancel`,u)},document.addEventListener(`touchmove`,c,{passive:!1}),document.addEventListener(`touchend`,l),document.addEventListener(`touchcancel`,u)},pc)},$t=e=>{if(L!=null){if(e.key===`Escape`){Ft(),e.preventDefault(),e.stopPropagation();return}jc.has(e.key)&&(e.preventDefault(),e.stopPropagation());return}if(nt.isActive()){if(e.key===`Escape`)nt.cancel();else if(e.key===`Enter`)nt.commit();else return;xe(`focus`),F(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(l&&e.key===`F2`){Rt(R??void 0),e.preventDefault(),e.stopPropagation();return}if(at){if(e.key===`Escape`)P.current=!1,te.current=null,t.closeSearch();else if(e.key===`Enter`){let e=t.getFocusedPath();e!=null&&t.selectOnlyPath(e);let n=C.current,r=Cs(n,xt);te.current=z<0||n==null?null:Math.max(0,Math.min(z*s-n.scrollTop,Math.max(0,r-s))),P.current=!0,t.closeSearch()}else if(e.key===`ArrowDown`)t.focusNextSearchMatch();else if(e.key===`ArrowUp`)t.focusPreviousSearchMatch();else return;xe(`focus`),F(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(f&&Dc(e)){t.openSearch(e.key),F(e=>e+1),e.preventDefault(),e.stopPropagation();return}let n=Ge&&kc(e),r=Ac(e,Ge),i=r&&S.current!=null?Ss(S.current):null,a=r?new Set(Rc(S.current)):new Set,o=i?.dataset.fileTreeStickyPath??null,c=i?.dataset.fileTreeStickyRow===`true`&&o!=null;if(c&&o!==R&&a.has(o)){let e=C.current;Pe(o,e?.scrollTop??null),t.focusPath(o)}let u=t.getFocusedPath(),d=t.getFocusedIndex(),p=t.getFocusedItem();if(p==null)return;let m=Tc(p)?p:null,h=u!=null&&(Dt.has(u)||c&&o===u&&a.has(u)),g=e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`ArrowRight`&&m!=null&&m.isExpanded(),_=e.key===`ArrowLeft`&&h&&m!=null&&m.isExpanded(),v=C.current,y=!0;if(e.shiftKey&&e.key===`ArrowDown`)t.extendSelectionFromFocused(1);else if(e.shiftKey&&e.key===`ArrowUp`)t.extendSelectionFromFocused(-1);else if(n&&u!=null&&d>=0){let e=t.getVisibleRows(d,d)[0]??null,n=Lc(u,E.current,T.current);e==null||n==null?y=!1:Lt(e,u)}else if((e.ctrlKey||e.metaKey)&&Ec(e))t.toggleFocusedSelection();else if((e.ctrlKey||e.metaKey)&&e.key.toLowerCase()===`a`)t.selectAllVisiblePaths();else switch(e.key){case`ArrowDown`:t.focusNextItem();break;case`ArrowUp`:t.focusPreviousItem();break;case`ArrowRight`:m==null||m.isExpanded()?t.focusNextItem():m.expand();break;case`ArrowLeft`:m!=null&&m.isExpanded()?m.collapse():t.focusParentItem();break;case`Home`:t.focusFirstItem();break;case`End`:t.focusLastItem();break;default:y=!1}if(!y)return;xe(`focus`);let b=t.getFocusedPath(),x=b!=null&&(Dt.has(b)||a.has(b)),w=g&&b!==u,D=n&&c&&o===u&&b===u;if((h||D)&&b!=null&&(w&&x||D))Pe(b,v?.scrollTop??null),j.current=!0,I(e=>e===b?e:b);else{let t=e.key===`ArrowUp`&&h&&b!==u;b!=null&&(t||_&&b===u)?(Fe(b,Bc(S.current,v,i,u,s,Et,xt)),j.current=!0,I(e=>e===b?e:b)):Ne()}F(e=>e+1),e.preventDefault(),e.stopPropagation()};Qs(()=>{if(!(!f||!at)){if(Ie.current){Ie.current=!1;return}xs(w.current)}},[at,f]),Qs(()=>{let e=x.current;switch(As({hasRenderedInput:e!=null,previousRenamingPath:N.current,renamingPath:rt})){case`reset`:N.current=null;return;case`reveal-canonical`:rt!=null&&zt(rt,{restoreTreeFocus:!1,targetOffset:`live-overlay`});return;case`ignore`:return;case`focus-input`:e!=null&&(De.current=null,N.current=rt,xs(e),e.select());return}},[St.end,St.start,rt,zt,Dt]),Qs(()=>{let e=S.current;if(e==null)return;let t=null,n=()=>{t!=null&&(clearTimeout(t),t=null)},r=()=>{let t=Ss(e)?.dataset.itemPath??null;I(e=>e===t?e:t)},i=()=>{n(),j.current=!0,r()},a=i=>{let a=i.relatedTarget;if(a==null){n(),t=setTimeout(()=>{if(t=null,Ss(e)!=null){r();return}j.current=!1,I(null)},0);return}if(!(a instanceof Node)||!e.contains(a)){n(),j.current=!1,I(null);return}let o=a instanceof HTMLElement?a.dataset.itemPath??null:null;I(e=>e===o?e:o)};return e.addEventListener(`focusin`,i),e.addEventListener(`focusout`,a),()=>{n(),e.removeEventListener(`focusin`,i),e.removeEventListener(`focusout`,a)}},[]),Qs(()=>{let e=S.current;e!=null&&(yt.physical.scrollTop<=0?e.dataset.scrollAtTop=`true`:delete e.dataset.scrollAtTop)},[yt.physical.scrollTop]),Qs(()=>{let e=null,n=C.current,r=b.current,i=S.current;if(n==null)return;ee.current=Cs(n,g);let a=()=>{let e=t.getVisibleCount(),r=ws(ee.current,g),i=Math.max(0,e*s-r);n.scrollTop>i&&(n.scrollTop=i),He(fc({controller:t,itemHeight:s,overscan:c,scrollTop:Math.min(n.scrollTop,i),stickyFolders:h,viewportHeight:r}))};if(!k.current){k.current=!0;let e=t.getFocusedIndex();if(e>=0){let r=ws(ee.current,g),i=t.getVisibleRows(e,e)[0]??null;Es(n,e,s,r,h&&i!=null?Math.max(0,Math.min(i.ancestorPaths.length*s,Math.max(0,r-s))):0)}}D.current=a;let o=!1,l=t.subscribe(()=>{o?F(e=>e+1):o=!0,a()}),u=()=>{Me.current!==!0&&(r!=null&&(r.dataset.isScrolling??=``),i!=null&&(i.dataset.isScrolling??=``),y.current=!0,e!=null&&clearTimeout(e),e=setTimeout(()=>{r!=null&&delete r.dataset.isScrolling,i!=null&&delete i.dataset.isScrolling,y.current=!1,Ce(e=>e+1),e=null},50))},d=null,f=()=>{i!=null&&delete i.dataset.overlayReveal,d!=null&&(clearTimeout(d),d=null)},p=()=>{i==null||Me.current===!0||n.scrollTop>0||(i.dataset.overlayReveal=`true`,d!=null&&clearTimeout(d),d=setTimeout(()=>{f()},200))},m=()=>{if(a(),n.scrollTop>0&&f(),Ee.current!=null&&y.current&&Pt.current(),Me.current===!0){y.current=!1;return}_e(e=>e==null?e:null),u()},_=()=>{u(),p()},v=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`PageUp`,`PageDown`,`Home`,`End`,` `,`Spacebar`]),x=e=>{v.has(e.key)&&_()};n.addEventListener(`scroll`,m,{passive:!0}),n.addEventListener(`wheel`,_,{passive:!0}),n.addEventListener(`touchmove`,_,{passive:!0}),n.addEventListener(`keydown`,x);let w=typeof ResizeObserver<`u`?new ResizeObserver(e=>{ee.current=(e[0]==null?null:Ts(e[0]))??Cs(n,g),a()}):null;return w?.observe(n),()=>{D.current=()=>{},l(),n.removeEventListener(`scroll`,m),n.removeEventListener(`wheel`,_),n.removeEventListener(`touchmove`,_),n.removeEventListener(`keydown`,x),e!=null&&clearTimeout(e),d!=null&&clearTimeout(d),r!=null&&delete r.dataset.isScrolling,i!=null&&(delete i.dataset.isScrolling,delete i.dataset.overlayReveal),y.current=!1,ee.current=null,w?.disconnect()}},[t,g,s,c,h]),Qs(()=>{Ge||L==null||Ft(!1)},[Ft,Ge,L]);let en=$s(()=>L==null?null:`${L.path}::${L.source}`,[L]);Qs(()=>{if(en==null){m?.clearSlotContent(gt);return}let t=Ee.current;if(t==null)return;let n=v.current??_.current;if(n==null)return;let r={anchorElement:n,anchorRect:t.anchorRect??Nc(n.getBoundingClientRect()),close:e=>{Pt.current(e?.restoreFocus??!0)},restoreFocus:()=>{Nt.current&&Mt.current(Ee.current?.path??null)}},i=e?.contextMenu?.render?.(t.item,r)??null;return m?.setSlotContent(gt,i),e?.contextMenu?.onOpen?.(t.item,r),Kc(i),queueMicrotask(()=>{i==null||!i.isConnected||document.activeElement===i&&Kc(i)}),()=>{m?.clearSlotContent(gt)}},[en,e?.contextMenu,m]),Qs(()=>{L!=null&&t.getItem(L.path)==null&&Ft()},[Ft,L,t]),Qs(()=>{if(L==null)return;let e=S.current?.getRootNode(),t=e instanceof ShadowRoot?e.host:S.current,n=e=>{let n=e.target;n instanceof Node&&(Mc(e)||_.current?.contains(n)!==!0&&t?.contains(n)!==!0&&Ft())},r=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),Ft())};return document.addEventListener(`mousedown`,n,!0),document.addEventListener(`keydown`,r,!0),()=>{document.removeEventListener(`mousedown`,n,!0),document.removeEventListener(`keydown`,r,!0)}},[Ft,L]),Qs(()=>{let e=C.current,n=S.current;if(e==null||n==null){M.current=R;return}let r=R==null?null:T.current.get(R)??null,i=Ss(n),a=i?.dataset.itemPath??null,o=it&&x.current===i,c=f&&w.current===i,l=P.current&&!at,u=te.current??0,d=De.current,p=Oe.current,m=ke.current,g=Ae.current,_=i!=null,v=j.current||_,y=M.current!==R,b=p!=null&&p===R&&R!=null,E=!1,ee=!1;if(st!=null&&st.id!==O.current){O.current=st.id;let n=st.visibleIndex,r=t.getVisibleRows(n,n)[0]??null;if(r!=null){let t=h?Math.max(0,Math.min(r.ancestorPaths.length*s,Math.max(0,xt-s))):Et;E=!0,ee=Ds(e,n,s,xt,Tt,st.offset,t)}t.clearScrollRequest(st.id)}let k=!E&&l&&Os(e,z,s,xt,Tt,u),A=!E&&d!=null&&d===R&&Os(e,z,s,xt,Tt,Et),N=!E&&m!=null&&m.path===R&&Os(e,z,s,xt,Tt,m.viewportOffset),ne=!E&&g!=null&&g.path===R&&e.scrollTop!==g.scrollTop;if(ne&&(e.scrollTop=g.scrollTop),(ne||ee||A||N||k||v&&y&&d!==R&&!b&&Es(e,z,s,xt,Et))&&D.current(),E){M.current=R;return}if(!v){M.current=R;return}if(o){M.current=R;return}if(c&&!l){M.current=R;return}if(r==null){l&&z>=0&&(Os(e,z,s,xt,Tt,u),D.current()),M.current=R;return}(y||l||d===R||p===R||m?.path===R||g?.path===R||a==null||a!==R)&&(xs(r),d===R&&(De.current=null),p===R&&(Oe.current=null),m?.path===R&&(ke.current=null),g?.path===R&&(Ae.current=null),P.current=!1,te.current=null),M.current=R},[t,z,R,Ot,s,it,at,St,xt,f,st,h,Et,Tt,bt]);let tn=z>=0&&z>=yt.visible.startIndex&&z<=yt.visible.endIndex,nn=R!=null&&Ct.some(e=>lc(e.row)===R),rn=tn||nn,an=qe&&j.current===!0&&rn?R:null,on=be===`pointer`?ge:null,sn=L?.path??je.current??on??an??ge,cn=L?.source===`right-click`;Qs(()=>{y.current&&L==null||It($e(sn))},[L,$e,St,xt,Se,Ct,sn,It,bt]);let ln=ec(e=>{if(y.current||Mc(e))return;let t=e.target;if(!(t instanceof HTMLElement)||t.closest?.(`[data-type="context-menu-trigger"]`)!=null)return;let n=t.closest?.(`[data-file-tree-sticky-row="true"]`),r=t.closest?.(`[data-type="item"]`),i=n instanceof HTMLElement?n.dataset.fileTreeStickyPath??null:r instanceof HTMLElement?r.dataset.itemPath??null:null;i!=null&&xe(e=>e===`pointer`?e:`pointer`),_e(e=>e===i?e:i)},[]),un=ec(()=>{_e(null)},[]);Qs(()=>{if(!ct)return;let e=()=>{Kt(),t.cancelDrag()};return window.addEventListener(`dragend`,e),()=>{window.removeEventListener(`dragend`,e),Kt(),t.cancelDrag()}},[t,ct]);let dn=e=>{if(!ct||t.getDragSession()==null||le.current)return;let n=yc(e.target instanceof HTMLElement?e.target:null);t.setDragTarget(n),qt(t.getDragSession()?.target??null),Yt(e.clientX,e.clientY),e.dataTransfer!=null&&(e.dataTransfer.dropEffect=`move`),e.preventDefault()},fn=e=>{if(!ct||t.getDragSession()==null||le.current)return;let n=e.relatedTarget;n instanceof Node&&S.current?.contains(n)===!0||(Ht(),Wt(),t.setDragTarget(null))},pn=e=>{!ct||t.getDragSession()==null||le.current||(e.preventDefault(),V(e.clientX,e.clientY),t.completeDrag(),Ut(),Ht(),Wt(),se.current=null)},mn=yt.window.height,hn=yt.window.offsetTop,gn=Math.min(0,xt-mn),_n=Math.min(0,xt-mn-Et),vn=he===R||P.current,yn=R!=null&&vn&&!Ot&&z>=0?bt[z]??t.getVisibleRows(z,z)[0]??null:null,bn=yn==null?null:ks(z,s,St,mn),xn=se.current,Sn=ft!=null&&xn!=null&&xn.path===ft&&xn.index>=St.start&&xn.index<=St.end,Cn=ft!=null&&xn!=null&&xn.path===ft&&!Sn&&xn.path!==yn?.path?xn:null,wn=Cn==null?null:ks(Cn.index,s,St,mn),Tn=Oc((z>=0?bt[z]??t.getVisibleRows(z,z)[0]??null:null)?.ancestorPaths.at(-1)??null),En=at&&R!=null?Uc(o,R,!Ot):void 0,Dn=L?.path??(at?R:he),On=L?.path??ge,kn=$e(sn),An=Ge&&qe&&!cn&&!it&&kn!=null&&ve!=null&&sn!=null,jn=Ge&&(An||L!=null),Mn=L?.anchorRect,Nn=Mn==null&&kn!=null&&ve!=null&&(L!=null||An)?ve:null,Pn=Mn==null?Nn==null?void 0:{top:`${Nn}px`}:{left:`${Mn.left}px`,position:`fixed`,right:`auto`,top:`${Mn.top}px`},Fn=cn?{opacity:`0`}:void 0,In=ec((e,n,r,i)=>{let a=Ns({event:{ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey},isDirectory:n.kind===`directory`,isSearchOpen:at,mode:i}),o=a.toggleDirectory&&n.kind===`directory`,s=o?t.resolveMountedDirectoryPathFromInput(r):null;if(o&&s==null)return;let c=s??r;switch(a.selection.kind){case`range`:t.selectPathRange(c,a.selection.additive);break;case`toggle`:t.togglePathSelectionFromInput(c);break;case`single`:t.selectOnlyMountedPathFromInput(c);break}let l=e.currentTarget instanceof HTMLElement?e.currentTarget:null,u=n.index>=yt.visible.startIndex&&n.index<=yt.visible.endIndex,d=i===`flow`&&u&&l!=null&&l.dataset.itemParked!==`true`;t.focusMountedPathFromInput(c),d&&(j.current=!0,I(e=>e===c?e:c),xe(`focus`)),o&&t.toggleMountedDirectoryFromInput(c),a.closeSearch&&t.closeSearch(),a.revealCanonical&&zt(c,{targetOffset:`sticky-parents`})},[t,at,yt.visible.endIndex,yt.visible.startIndex,zt]),Ln=()=>{if(y.current||!qe||sn==null||kn==null)return;let e=t.getItem(sn);e!=null&&(It(kn),Nt.current=!0,Te({anchorRect:null,item:{kind:e.isDirectory()?`directory`:`file`,name:kn.getAttribute(`aria-label`)??sn,path:e.getPath()},path:e.getPath(),source:`button`}))},Rn={contextHoverPath:On,contextMenuButtonTriggerEnabled:qe,contextMenuButtonVisibility:Je,contextMenuEnabled:Ge,contextMenuRightClickEnabled:Ye,contextMenuTriggerMode:Ke,controller:t,directoriesWithGitChanges:i,dragAndDropEnabled:ct,draggedPathSet:ut,dragTarget:dt,gitLaneActive:et,gitStatusByPath:n,handleRowDragEnd:Zt,handleRowDragStart:Xt,handleRowTouchStart:Qt,ignoredGitDirectories:r,ignoredInheritanceCache:me,instanceId:o,itemHeight:s,onKeyDown:$t,onRowClick:In,openContextMenuForRow:Lt,registerButton:Xe,registerRenameInput:Qe,renameView:nt,renderDecorationForRow:kt,resolveIcon:tt,shouldSuppressContextMenu:B,visualFocusPath:Dn},zn={...Rn,registerButton:Ze};return K(`div`,{ref:S,id:pt,"data-file-tree-context-menu-button-visibility":Ge&&qe?Je:void 0,"data-file-tree-context-menu-trigger-mode":Ge?Ke:void 0,"data-file-tree-has-context-menu-action-lane":Ge&&qe?`true`:void 0,"data-file-tree-has-git-lane":et?`true`:void 0,"data-file-tree-virtualized-root":`true`,onDragLeave:ct?fn:void 0,onDragOver:ct?dn:void 0,onDrop:ct?pn:void 0,onKeyDown:$t,onPointerLeave:Ge?un:void 0,onPointerOver:Ge?ln:void 0,role:`tree`,tabIndex:-1,style:{outline:`none`,position:`relative`},children:[K(`style`,{"data-file-tree-guide-style":`true`,dangerouslySetInnerHTML:{__html:Tn}}),K(`slot`,{name:ht,"data-type":`header-slot`}),f?K(`div`,{"data-file-tree-search-container":!0,"data-open":at?`true`:`false`,children:K(`input`,{ref:w,"aria-activedescendant":En,"aria-controls":pt,placeholder:`Search…`,"data-file-tree-search-input":!0,"data-file-tree-search-input-fake-focus":Le?`true`:void 0,value:ot,onBlur:()=>{d===`retain`&&!ze.current||t.closeSearch()},onFocus:Be,onPointerDown:Be,onInput:e=>{Be();let n=e.currentTarget;t.setSearch(n.value)}})}):null,K(`div`,{ref:C,"data-file-tree-virtualized-scroll":`true`,children:[h&&Ue&&Ct.length>0?K(`div`,{"aria-hidden":`true`,"data-file-tree-sticky-overlay":`true`,children:K(`div`,{"data-file-tree-sticky-overlay-content":`true`,style:{height:`${mt}px`},children:Ct.map((e,t)=>Jc(zn,e.row,`sticky:${lc(e.row)}`,{mode:`sticky`,style:{left:`0`,position:`absolute`,right:`0`,top:`${e.top}px`,zIndex:`${Ct.length-t}`}}))})}):null,K(`div`,{ref:b,"data-file-tree-virtualized-list":`true`,style:{height:`${Tt}px`},children:[K(`div`,{"data-file-tree-virtualized-sticky-offset":`true`,"aria-hidden":`true`,style:{height:`${hn}px`}}),K(`div`,{"data-file-tree-virtualized-sticky":`true`,style:{height:`${mn}px`,top:`${gn}px`,bottom:`${_n}px`},children:[Yc(Rn,St,Dt),yn!=null&&bn!=null?Jc(Rn,yn,`parked:${yn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:ft===yn.path?`none`:void 0,position:`absolute`,right:`0`,top:`${bn}px`}}):null,Cn!=null&&wn!=null?Jc(Rn,Cn,`parked-drag:${Cn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:`none`,position:`absolute`,right:`0`,top:`${wn}px`}}):null]})]})]}),Ge?K(`div`,{ref:_,"data-type":`context-menu-anchor`,"data-visible":jn?`true`:`false`,style:Pn,children:[K(`button`,{ref:v,type:`button`,"data-type":_t,"aria-label":`Options`,"aria-haspopup":`menu`,"aria-expanded":L==null?`false`:`true`,"data-visible":An?`true`:`false`,onMouseDown:e=>{e.preventDefault()},onClick:e=>{if(e.preventDefault(),e.stopPropagation(),L!=null){Ft();return}Ln()},tabIndex:-1,style:Fn,children:K(Wo,{...tt(`file-tree-icon-ellipsis`)})}),L==null?null:K(`slot`,{name:gt})]}):null,L==null?null:K(`div`,{"data-type":`context-menu-wash`,"aria-hidden":`true`,onMouseDownCapture:e=>{e.preventDefault(),Ft()},onTouchStartCapture:e=>{e.preventDefault(),e.stopPropagation(),Ft()},onTouchMoveCapture:e=>{e.preventDefault(),e.stopPropagation()},onWheelCapture:e=>{e.preventDefault(),e.stopPropagation()}})]})}var Zc={hydrateRoot:(e,t)=>{zo(ho(Xc,t),e)},renderRoot:(e,t)=>{Ro(ho(Xc,t),e)},unmountRoot:e=>{Ro(null,e)}};function Qc(e,t){Zc.renderRoot(e,t)}function $c(e,t){Zc.hydrateRoot(e,t)}function el(e){Zc.unmountRoot(e)}var tl=class{#e=new Map;#t=null;clearAll(){for(let e of this.#e.values())e.remove();this.#e.clear()}clearSlotContent(e){let t=this.#n(e);t!=null&&(t.remove(),this.#e.delete(e))}setHost(e){if(this.#t=e,e!=null){this.#i(e);for(let[e,t]of this.#e)this.#r(e,t)}}setSlotContent(e,t){let n=this.#n(e);if(n===t){t!=null&&(this.#e.set(e,t),this.#r(e,t));return}if(n?.remove(),t==null){this.#e.delete(e);return}this.#e.set(e,t),this.#r(e,t)}setSlotHtml(e,t){let n=t?.trim()??``;if(n.length===0){this.setSlotContent(e,null);return}let r=this.#n(e);if(r!=null&&r.innerHTML===n){this.#e.set(e,r),this.#r(e,r);return}let i=document.createElement(`div`);i.innerHTML=n,this.setSlotContent(e,i)}#n(e){let t=this.#e.get(e)??null;if(t!=null)return t;let n=this.#t;if(n==null)return null;for(let t of Array.from(n.children))if(t instanceof HTMLElement&&t.dataset.fileTreeManagedSlot===e)return t;return null}#r(e,t){t.slot=e,t.dataset.fileTreeManagedSlot=e,this.#t!=null&&t.parentNode!==this.#t&&this.#t.appendChild(t)}#i(e){for(let t of Array.from(e.children)){if(!(t instanceof HTMLElement))continue;let e=t.dataset.fileTreeManagedSlot;e==null||this.#e.has(e)||this.#e.set(e,t)}}},nl=`__c`,rl=`__k`,il=`__d`,al=`__s`,ol=/[\s\n\\/='"\0<>]/,sl=/^(xlink|xmlns|xml)([A-Z])/,cl=/^(?:accessK|auto[A-Z]|cell|ch|col|cont|cross|dateT|encT|form[A-Z]|frame|hrefL|inputM|maxL|minL|noV|playsI|popoverT|readO|rowS|src[A-Z]|tabI|useM|item[A-Z])/,ll=/^ac|^ali|arabic|basel|cap|clipPath$|clipRule$|color|dominant|enable|fill|flood|font|glyph[^R]|horiz|image|letter|lighting|marker[^WUH]|overline|panose|pointe|paint|rendering|shape|stop|strikethrough|stroke|text[^L]|transform|underline|unicode|units|^v[^i]|^w|^xH/,ul=new Set([`draggable`,`spellcheck`]);function dl(e){e.__g===void 0?e[il]=!0:e.__g|=8}function fl(e){e.__g===void 0?e[il]=!1:e.__g&=-9}function pl(e){return e.__g===void 0?!0===e[il]:!!(8&e.__g)}var ml=/["&<]/;function hl(e){if(e.length===0||!1===ml.test(e))return e;for(var t=0,n=0,r=``,i=``;n<e.length;n++){switch(e.charCodeAt(n)){case 34:i=`&quot;`;break;case 38:i=`&amp;`;break;case 60:i=`&lt;`;break;default:continue}n!==t&&(r+=e.slice(t,n)),r+=i,t=n+1}return n!==t&&(r+=e.slice(t,n)),r}var gl={},_l=new Set(`animation-iteration-count.border-image-outset.border-image-slice.border-image-width.box-flex.box-flex-group.box-ordinal-group.column-count.fill-opacity.flex.flex-grow.flex-negative.flex-order.flex-positive.flex-shrink.flood-opacity.font-weight.grid-column.grid-row.line-clamp.line-height.opacity.order.orphans.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-miterlimit.stroke-opacity.stroke-width.tab-size.widows.z-index.zoom`.split(`.`)),vl=/[A-Z]/g;function yl(e){var t=``;for(var n in e){var r=e[n];if(r!=null&&r!==``){var i=n[0]==`-`?n:gl[n]||(gl[n]=n.replace(vl,`-$&`).toLowerCase()),a=`;`;typeof r!=`number`||i.startsWith(`--`)||_l.has(i)||(a=`px;`),t=t+i+`:`+r+a}}return t||void 0}function bl(){this.__d=!0}function xl(e,t){return{__v:e,context:t,props:e.props,setState:bl,forceUpdate:bl,__d:!0,__h:[]}}function Sl(e,t,n){if(!e.s){if(n instanceof Cl){if(!n.s)return void(n.o=Sl.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(Sl.bind(null,e,t),Sl.bind(null,e,2));e.s=t,e.v=n;let r=e.o;r&&r(e)}}var Cl=function(){function e(){}return e.prototype.then=function(t,n){var r=new e,i=this.s;if(i){var a=1&i?t:n;if(a){try{Sl(r,1,a(this.v))}catch(e){Sl(r,2,e)}return r}return this}return this.o=function(e){try{var i=e.v;1&e.s?Sl(r,1,t?t(i):i):n?Sl(r,1,n(i)):Sl(r,2,i)}catch(e){Sl(r,2,e)}},r},e}(),wl,Tl,El,Dl,Ol={},kl=Array.isArray,Al=Object.assign,jl=``,Ml=`<!--$s-->`,Nl=`<!--/$s-->`;function Pl(e,t){var n,r=e.type,i=!0;return e[nl]?(i=!1,(n=e[nl]).state=n[al]):n=new r(e.props,t),e[nl]=n,n.__v=e,n.props=e.props,n.context=t,dl(n),n.state??=Ol,n[al]??(n[al]=n.state),r.getDerivedStateFromProps?n.state=Al({},n.state,r.getDerivedStateFromProps(n.props,n.state)):i&&n.componentWillMount?(n.componentWillMount(),n.state=n[al]===n.state?n.state:n[al]):!i&&n.componentWillUpdate&&n.componentWillUpdate(),El&&El(e),n.render(n.props,n.state,t)}function Fl(e,t,n,r,i,a,o){if(e==null||!0===e||!1===e||e===jl)return jl;var s=typeof e;if(s!=`object`)return s==`function`?jl:s==`string`?hl(e):e+jl;if(kl(e)){var c,l=jl;i[rl]=e;for(var u=e.length,d=0;d<u;d++){var f=e[d];if(f!=null&&typeof f!=`boolean`){var p,m=Fl(f,t,n,r,i,a,o);typeof m==`string`?l+=m:(c||=Array(u),l&&c.push(l),l=jl,kl(m)?(p=c).push.apply(p,m):c.push(m))}}return c?(l&&c.push(l),c):l}if(e.constructor!==void 0)return jl;e.__=i,wl&&wl(e);var h=e.type,g=e.props;if(typeof h==`function`){var _,v,y,b=t;if(h===_o){if(`tpl`in g){for(var x=jl,S=0;S<g.tpl.length;S++)if(x+=g.tpl[S],g.exprs&&S<g.exprs.length){var C=g.exprs[S];if(C==null)continue;typeof C!=`object`||C.constructor!==void 0&&!kl(C)?x+=C:x+=Fl(C,t,n,r,e,a,o)}return x}if(`UNSTABLE_comment`in g)return`<!--`+hl(g.UNSTABLE_comment)+`-->`;v=g.children}else{if((_=h.contextType)!=null){var w=t[_.__c];b=w?w.props.value:_.__}var T=h.prototype&&typeof h.prototype.render==`function`;if(T)v=Pl(e,b),y=e[nl];else{e[nl]=y=xl(e,b);for(var E=0;pl(y)&&E++<25;){fl(y),El&&El(e);try{v=h.call(y,g,b)}catch(t){throw a&&t&&typeof t.then==`function`&&(e._suspended=!0),t}}dl(y)}if(y.getChildContext!=null&&(t=Al({},t,y.getChildContext())),T&&G.errorBoundaries&&(h.getDerivedStateFromError||y.componentDidCatch)){v=v!=null&&v.type===_o&&v.key==null&&v.props.tpl==null?v.props.children:v;try{return Fl(v,t,n,r,e,a,!1)}catch(i){return h.getDerivedStateFromError&&(y[al]=h.getDerivedStateFromError(i)),y.componentDidCatch&&y.componentDidCatch(i,Ol),pl(y)?(v=Pl(e,t),(y=e[nl]).getChildContext!=null&&(t=Al({},t,y.getChildContext())),Fl(v=v!=null&&v.type===_o&&v.key==null&&v.props.tpl==null?v.props.children:v,t,n,r,e,a,o)):jl}finally{Tl&&Tl(e),Dl&&Dl(e)}}}v=v!=null&&v.type===_o&&v.key==null&&v.props.tpl==null?v.props.children:v;try{var D=Fl(v,t,n,r,e,a,o);return Tl&&Tl(e),G.unmount&&G.unmount(e),e._suspended?typeof D==`string`?Ml+D+Nl:kl(D)?(D.unshift(Ml),D.push(Nl),D):D.then(function(e){return Ml+e+Nl}):D}catch(i){if(!a&&o&&o.onError){var ee=function i(s){return o.onError(s,e,function(e,s){try{return Fl(e,t,n,r,s,a,o)}catch(e){return i(e)}})}(i);if(ee!==void 0)return ee;var O=G.__e;return O&&O(i,e),jl}if(!a||!i||typeof i.then!=`function`)throw i;return i.then(function i(){try{var s=Fl(v,t,n,r,e,a,o);return e._suspended?Ml+s+Nl:s}catch(e){if(!e||typeof e.then!=`function`)throw e;return e.then(i)}})}}var k,A=`<`+h,j=jl;for(var M in g){var N=g[M];if(typeof(N=Ll(N)?N.value:N)!=`function`||M===`class`||M===`className`){switch(M){case`children`:k=N;continue;case`key`:case`ref`:case`__self`:case`__source`:continue;case`htmlFor`:if(`for`in g)continue;M=`for`;break;case`className`:if(`class`in g)continue;M=`class`;break;case`defaultChecked`:M=`checked`;break;case`defaultSelected`:M=`selected`;break;case`defaultValue`:case`value`:switch(M=`value`,h){case`textarea`:k=N;continue;case`select`:r=N;continue;case`option`:r!=N||`selected`in g||(A+=` selected`)}break;case`dangerouslySetInnerHTML`:j=N&&N.__html;continue;case`style`:typeof N==`object`&&(N=yl(N));break;case`acceptCharset`:M=`accept-charset`;break;case`httpEquiv`:M=`http-equiv`;break;default:if(sl.test(M))M=M.replace(sl,`$1:$2`).toLowerCase();else{if(ol.test(M))continue;M[4]!==`-`&&!ul.has(M)||N==null?n?ll.test(M)&&(M=M===`panose1`?`panose-1`:M.replace(/([A-Z])/g,`-$1`).toLowerCase()):cl.test(M)&&(M=M.toLowerCase()):N+=jl}}N!=null&&!1!==N&&(A=!0===N||N===jl?A+` `+M:A+` `+M+`="`+(typeof N==`string`?hl(N):N+jl)+`"`)}}if(ol.test(h))throw Error(h+` is not a valid HTML tag name in `+A+`>`);if(j||(typeof k==`string`?j=hl(k):k!=null&&!1!==k&&!0!==k&&(j=Fl(k,t,h===`svg`||h!==`foreignObject`&&n,r,e,a,o))),Tl&&Tl(e),Dl&&Dl(e),!j&&Il.has(h))return A+`/>`;var P=`</`+h+`>`,te=A+`>`;return kl(j)?[te].concat(j,[P]):typeof j==`string`?te+j+P:[te,j,P]}var Il=new Set([`area`,`base`,`br`,`col`,`command`,`embed`,`hr`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`]);function Ll(e){return typeof e==`object`&&!!e&&typeof e.peek==`function`&&`value`in e}var Rl=0;function zl(e){return e!=null&&e.length>0?e:(Rl+=1,`pst_ft_${Rl}`)}function Bl({initialVisibleRowCount:e,itemHeight:t}){return e==null?420:Math.max(0,e)*(t??Xi)}function Vl(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 Hl(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 Ul(e){return Array.from(e.children).filter(e=>e instanceof SVGElement)}var Wl=class{static LoadedCustomComponent=!0;#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=new tl;#u;#d;#f;#p;#m;#h;#g;#_;#v;#y=null;#b;#x=!1;#S=!1;constructor(e){let{composition:t,density:n,fileTreeSearchMode:r,gitStatus:i,id:a,initialSearchQuery:o,icons:s,itemHeight:c,onSearchChange:l,onSelectionChange:u,overscan:d,renderRowDecoration:f,renaming:p,search:m,searchBlurBehavior:h,searchFakeFocus:g,stickyFolders:_,unsafeCSS:v,initialVisibleRowCount:y,...b}=e;this.#e=t,this.#n=zl(a),this.#p=Qa(i),this.#m=s,this.#h=v,this.#r=u,this.#i=f,this.#a=p!=null&&p!==!1,this.#o=h,this.#s=m===!0,this.#c=g===!0,this.#u=Yi(n,c),this.#d={itemHeight:this.#u.itemHeight,overscan:d,stickyFolders:_,initialVisibleRowCount:y},this.#t=new qa({...b,fileTreeSearchMode:r,initialSearchQuery:o,onSearchChange:l,renaming:p}),this.#v=this.#t.getSelectionVersion(),this.#y=this.#r==null?null:this.subscribe(()=>{this.#D()})}unmount(){this.#b!=null&&(el(this.#b),delete this.#b.dataset.fileTreeVirtualizedWrapper,this.#b=void 0),this.#l.clearAll(),this.#l.setHost(null),this.#f!=null&&(delete this.#f.dataset.fileTreeVirtualized,this.#I(this.#f),this.#f=void 0)}cleanUp(){this.unmount(),this.#y?.(),this.#y=null,this.#t.destroy()}getFileTreeContainer(){return this.#f}getItem(e){return this.#t.getItem(e)}getFocusedItem(){return this.#t.getFocusedItem()}getFocusedPath(){return this.#t.getFocusedPath()}getSelectedPaths(){return this.#t.getSelectedPaths()}getComposition(){return this.#e}getItemHeight(){return this.#u.itemHeight}getDensityFactor(){return this.#u.factor}subscribe(e){let t=!1;return this.#t.subscribe(()=>{if(!t){t=!0;return}e()})}focusPath(e){this.#t.focusPath(e)}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)}move(e,t,n){this.#t.move(e,t,n)}onMutation(e,t){return this.#t.onMutation(e,t)}setSearch(e){this.#t.setSearch(e)}openSearch(e){this.#t.openSearch(e)}closeSearch(){this.#t.closeSearch()}isSearchOpen(){return this.#t.isSearchOpen()}getSearchValue(){return this.#t.getSearchValue()}getSearchMatchingPaths(){return this.#t.getSearchMatchingPaths()}focusNextSearchMatch(){this.#t.focusNextSearchMatch()}focusPreviousSearchMatch(){this.#t.focusPreviousSearchMatch()}startRenaming(e,t){return this.#t.startRenaming(e,t)}remove(e,t){this.#t.remove(e,t)}resetPaths(e,t){this.#t.resetPaths(e,t)}setComposition(e){this.#e=e;let t=this.#T();t!=null&&(this.#O(),Qc(t.wrapper,this.#w()))}setGitStatus(e){this.#p=Qa(e,this.#p);let t=this.#T();t!=null&&Qc(t.wrapper,this.#w())}setIcons(e){this.#m=e;let t=this.#T();t!=null&&(this.#E(t.host,t.wrapper),Qc(t.wrapper,this.#w()))}hydrate({fileTreeContainer:e}){let t=this.#P(e),n=this.#N(t);this.#O(),$c(n,this.#w())}render({containerWrapper:e,fileTreeContainer:t}){let n=this.#P(t??this.#f,e),r=this.#N(n);this.#O(),Qc(r,this.#w())}#C(){return{initialViewportHeight:Bl({initialVisibleRowCount:this.#d.initialVisibleRowCount,itemHeight:this.#d.itemHeight}),itemHeight:this.#d.itemHeight,overscan:this.#d.overscan,stickyFolders:this.#d.stickyFolders}}#w(){return{composition:this.#e,controller:this.#t,gitStatusByPath:this.#p?.statusByPath,ignoredGitDirectories:this.#p?.ignoredDirectoryPaths,directoriesWithGitChanges:this.#p?.directoriesWithChanges,icons:this.#m,instanceId:this.#n,renamingEnabled:this.#a,renderRowDecoration:this.#i,searchBlurBehavior:this.#o,searchEnabled:this.#s,searchFakeFocus:this.#c,slotHost:this.#l,...this.#C()}}#T(){let e=this.#f,t=this.#b;return e==null||t==null?null:{host:e,wrapper:t}}#E(e,t){let n=e.shadowRoot;n!=null&&(this.#k(n),this.#A(n)),this.#j(t)}#D(){let e=this.#r;if(e==null)return;let t=this.#t.getSelectionVersion();t!==this.#v&&(this.#v=t,e(this.#t.getSelectedPaths()))}#O(){let e=this.#e?.header?.render;if(e!=null){this.#l.setSlotContent(ht,e());return}this.#l.setSlotHtml(ht,this.#e?.header?.html??null)}#k(e){let t=Ul(e).find(e=>Hl(e)),n=Vl(Ce(pe(this.#m).set));n!=null&&(t!=null&&t.outerHTML===n.outerHTML||(t==null?e.prepend(n):t.replaceWith(n)))}#A(e){let t=Ul(e),n=t.find(e=>Hl(e)),r=t.filter(e=>e!==n),i=pe(this.#m).spriteSheet?.trim()??``;if(i.length===0){for(let e of r)e.remove();return}let a=Vl(i);if(a==null){for(let e of r)e.remove();return}if(!(r.length===1&&r[0].outerHTML===a.outerHTML)){for(let e of r)e.remove();e.appendChild(a)}}#j(e){let t=pe(this.#m);t.colored&&Te(t.set)?e.dataset.fileTreeColoredIcons=`true`:delete e.dataset.fileTreeColoredIcons}#M(e){let t=e.querySelector(`style[${dt}]`);if(this.#g==null&&t instanceof HTMLStyleElement&&(this.#g=t),this.#h==null||this.#h===``){this.#g?.remove(),this.#g=void 0,this.#_=void 0;return}this.#g?.parentNode===e&&this.#_===this.#h||(this.#g??=document.createElement(`style`),this.#g.setAttribute(dt,``),this.#g.parentNode!==e&&e.appendChild(this.#g),this.#g.textContent=ea(this.#h),this.#_=this.#h)}#N(e){if(this.#b!=null)return this.#b;let t=e.shadowRoot;if(t==null)throw Error(`FileTree requires a shadow root`);let n=Array.from(t.children).filter(e=>e instanceof HTMLDivElement&&typeof e.dataset.fileTreeId==`string`&&e.dataset.fileTreeId.length>0),r=n.find(e=>e.dataset.fileTreeId===this.#n)??n[0];return r!=null&&(this.#n=r.dataset.fileTreeId??this.#n),this.#b=r??document.createElement(`div`),this.#b.dataset.fileTreeId=this.#n,this.#b.dataset.fileTreeVirtualizedWrapper=`true`,this.#E(e,this.#b),this.#b.parentNode!==t&&t.appendChild(this.#b),this.#b}#P(e,t){let n=e??this.#f??document.createElement(`file-tree-container`);t!=null&&n.parentNode!==t&&t.appendChild(n);let r=n.shadowRoot??n.attachShadow({mode:`open`});return oa(n,r),this.#M(r),n.dataset.fileTreeVirtualized=`true`,n.style.display=`flex`,this.#F(n),this.#l.setHost(n),this.#f=n,n}#F(e){e.style.getPropertyValue(`--trees-item-height`)===``&&(e.style.setProperty(`--trees-item-height`,`${String(this.#u.itemHeight)}px`),this.#x=!0),e.style.getPropertyValue(`--trees-density-override`)===``&&(e.style.setProperty(`--trees-density-override`,String(this.#u.factor)),this.#S=!0)}#I(e){this.#x&&=(e.style.removeProperty(`--trees-item-height`),!1),this.#S&&=(e.style.removeProperty(`--trees-density-override`),!1)}},J=e(n(),1),Gl=typeof window>`u`?J.useEffect:J.useLayoutEffect;function Kl({file:e,options:t,editorOptions:n,lineAnnotations:r,selectedLines:i,prerenderedHTML:a,metrics:o,hasGutterRenderUtility:s,hasCustomHeader:c,disableWorkerPool:l,edit:u}){let d=nt(),f=i!==void 0,p=(0,J.useContext)(tt),m=se(),h=(0,J.useRef)(null),g=ae(n=>{if(n!=null){if(h.current!=null)throw Error(`File: An instance should not already exist when a node is created`);d==null?h.current=new N(ql({controlledSelection:f,hasCustomHeader:c,hasGutterRenderUtility:s,options:t}),l?void 0:p,!0):h.current=new M(ql({controlledSelection:f,hasCustomHeader:c,hasGutterRenderUtility:s,options:t}),d,o,l?void 0:p,!0),h.current.hydrate({file:e,fileContainer:n,lineAnnotations:r,prerenderedHTML:a})}else{if(h.current==null)throw Error(`File: A File instance should exist when unmounting`);h.current.cleanUp(),h.current=null}});return Gl(()=>{if(h.current==null)return;let n=ql({controlledSelection:f,hasCustomHeader:c,hasGutterRenderUtility:s,options:t}),a=n!==void 0&&!je(h.current.options,n);h.current.setOptions(n),h.current.render({file:e,lineAnnotations:r,forceRender:a}),i!==void 0&&h.current.setSelectedLines(i)}),Gl(()=>{if(u&&h.current!=null){if(m===void 0)throw Error(`File: EditContext is not attached`);let e=m(n??{});if(e==null)throw Error(`File: EditProvider.createEditor must return an editor instance`);try{return e.edit(h.current)}catch(t){throw e.cleanUp(),t}}},[u]),{ref:g,getHoveredLine:(0,J.useCallback)(()=>h.current?.getHoveredLine(),[])}}function ql({options:e,controlledSelection:t,hasCustomHeader:n,hasGutterRenderUtility:r}){return t||r||n?{...e,controlledSelection:t,renderCustomHeader:n?$e:e?.renderCustomHeader,renderGutterUtility:r?$e:e?.renderGutterUtility}:e}var Y=t();function Jl({file:e,lineAnnotations:t,selectedLines:n,options:r,editorOptions:i,metrics:a,className:o,style:s,renderAnnotation:c,renderCustomHeader:l,renderHeaderPrefix:u,renderHeaderFilenameSuffix:d,renderHeaderMetadata:f,prerenderedHTML:p,renderGutterUtility:m,disableWorkerPool:h=!1,edit:g=!1}){let{ref:_,getHoveredLine:v}=Kl({file:e,options:r,editorOptions:i,metrics:a,lineAnnotations:t,selectedLines:n,prerenderedHTML:p,hasGutterRenderUtility:m!=null,hasCustomHeader:l!=null,disableWorkerPool:h,edit:g});return(0,Y.jsx)(le,{ref:_,className:o,style:s,children:Ae(P({file:e,renderAnnotation:c,renderCustomHeader:l,renderHeaderPrefix:u,renderHeaderFilenameSuffix:d,renderHeaderMetadata:f,renderGutterUtility:m,lineAnnotations:t,getHoveredLine:v}),p)})}var Yl=100,Xl=1,Zl=2,Ql=3,$l=class{#e=[];#t=[];#n;#r=!1;constructor(e){this.#n=Math.max(1,e?.maxEntries??Yl)}get canUndo(){return this.#e.length>0}get canRedo(){return this.#t.length>0}clear(){this.#e.length=0,this.#t.length=0,this.#r=!1}clearRedo(){this.#t.length=0}push(e){this.#e.push(e),this.clearRedo(),this.#r=!0,this.#e.length>this.#n&&this.#e.shift()}setLastUndoSelectionsAfter(e){let t=this.#e[this.#e.length-1];t!==void 0&&(t.selectionsAfter=e.map(e=>({...e})))}setLastUndoLineAnnotations(e,t){let n=this.#e[this.#e.length-1];n!==void 0&&(n.lineAnnotationsBefore=e.slice(),n.lineAnnotationsAfter=t.slice())}peekUndo(){return this.#e[this.#e.length-1]}peekUndoForCoalescing(){return this.#r?this.peekUndo():void 0}replaceLastUndo(e){if(this.#e.length===0){this.push(e);return}this.#e[this.#e.length-1]=e,this.clearRedo(),this.#r=!0}popUndoToRedo(){let e=this.#e.pop();if(e!==void 0)return this.#t.push(e),this.#r=!1,e}popRedoToUndo(){let e=this.#t.pop();if(e!==void 0)return this.#e.push(e),this.#r=!1,e}};function eu(e,t,n,r,i,a,o,s){let c=[...t].sort((e,t)=>e.start-t.start),l=[],u;if(i?.length===c.length){let t=[];for(let n of i){if(n.start.line!==n.end.line||n.start.character!==n.end.character)break;t.push(e.offsetAt(n.start))}if(t.length===c.length){t.sort((e,t)=>e-t);let e=!0,n=!0;for(let r=0;r<c.length;r++){let i=c[r];if(i.text.length>0||i.start===i.end){e=!1,n=!1;break}e&&=t[r]===i.end,n&&=t[r]===i.start}u=e?Zl:n?Ql:void 0}}for(let t=0,n=0;t<c.length;t++){let r=c[t],i=e.getTextSlice(r.start,r.end),a=r.start+n;l.push({start:a,end:a+r.text.length,text:i}),n+=r.text.length-(r.end-r.start)}return{forwardEdits:c.map(e=>({...e})),inverseEdits:l,versionBefore:n,versionAfter:r,selectionsBefore:i?.map(e=>({...e})),selectionsAfter:a?.map(e=>({...e})),lineAnnotationsBefore:o?.slice(),lineAnnotationsAfter:s?.slice(),coalescingMode:u}}function tu(e,t){if(e===void 0||e.undoBoundary===!0||t.undoBoundary===!0||e.forwardEdits.length===0||e.forwardEdits.length!==e.inverseEdits.length||e.forwardEdits.length!==t.forwardEdits.length||t.forwardEdits.length!==t.inverseEdits.length)return!1;let n;for(let r=0;r<e.forwardEdits.length;r++){let i=e.forwardEdits[r],a=e.inverseEdits[r],o=t.forwardEdits[r],s=t.inverseEdits[r],c=iu(o.start,e.forwardEdits),l=i.start<=i.end&&i.text.length>0&&!i.text.includes(`
1671
+ }`}var ta=new WeakMap;function na(e){let t=ta.get(e);if(t!=null)return t;let n=document.createElement(`div`);n.setAttribute(ft,`true`);let r=document.createElement(`div`);r.style.position=`relative`,r.style.height=`200%`,n.appendChild(r),e.appendChild(n);let i=Math.max(n.offsetWidth-n.clientWidth,0);return n.remove(),ta.set(e,i),i}function ra(e,t){if(!e.isConnected)return;let n=na(t);if(n==null)return;let r=t.querySelector(`style[${pt}]`),i=r instanceof HTMLStyleElement?r:document.createElement(`style`);r instanceof HTMLStyleElement||(i.setAttribute(pt,``),t.appendChild(i)),i.textContent=`:host { ${mt}: ${n}px; }`}var ia;function aa(e){if(typeof CSSStyleSheet<`u`&&typeof CSSStyleSheet.prototype.replaceSync==`function`&&`adoptedStyleSheets`in e){ia??(ia=new CSSStyleSheet,ia.replaceSync($i(Zi)));let t=!1;try{e.adoptedStyleSheets=[ia],t=!0}catch{}if(t){e.querySelector(`style[${ut}]`)?.remove();return}}if(e.querySelector(`style[data-file-tree-style]`)==null){let t=document.createElement(`style`);t.setAttribute(ut,``),t.textContent=$i(Zi),e.prepend(t)}}function oa(e,t){sa(e,t),aa(t),ra(e,t)}function sa(e,t){let n=e.querySelector(`template[shadowrootmode="open"], template[data-file-tree-shadowrootmode="open"]`);n instanceof HTMLTemplateElement&&(t.childNodes.length>0||(t.appendChild(n.content.cloneNode(!0)),n.hasAttribute(`shadowrootmode`)&&n.remove()))}if(typeof HTMLElement<`u`&&customElements.get(`file-tree-container`)==null){class e extends HTMLElement{constructor(){super()}connectedCallback(){let e=this.shadowRoot??this.attachShadow({mode:`open`});oa(this,e)}}if(customElements.define(lt,e),typeof document<`u`)for(let e of Array.from(document.querySelectorAll(lt)))e instanceof HTMLElement&&oa(e,e.shadowRoot??e.attachShadow({mode:`open`}))}var ca=e=>e.startsWith(`f::`)?e.slice(3):e;function la(e){let t=e.lastIndexOf(`/`);return t<0?{parentPath:``,baseName:e}:{parentPath:e.slice(0,t),baseName:e.slice(t+1)}}function ua(e,t){return e===``?t:`${e}/${t}`}function da({files:e,path:t,isFolder:n,nextBasename:r}){let i=ca(t),a=r.trim();if(a.length===0)return{error:`Name cannot be empty.`};if(a.includes(`/`))return{error:`Name cannot include "/".`};let{parentPath:o,baseName:s}=la(i);if(a===s)return{nextFiles:e,sourcePath:i,destinationPath:i,isFolder:n};let c=ua(o,a),l=Array(e.length),u=new Set;if(!n){let t=`${c}/`,r=!1;for(let n=0;n<e.length;n++){let a=e[n];if(a!==i&&a.startsWith(t))return{error:`"${c}" already exists.`};let o=a===i?c:a;if(u.has(o))return{error:`"${c}" already exists.`};u.add(o),l[n]=o,a===i&&(r=!0)}return r?{nextFiles:l,sourcePath:i,destinationPath:c,isFolder:n}:{error:`Could not find the selected file to rename.`}}let d=`${i}/`,f=`${c}/`,p=0;for(let t=0;t<e.length;t++){let n=e[t],r=n===i||n.startsWith(d);if(!r&&(n===c||n.startsWith(f)))return{error:`"${c}" already exists.`};let a=r?`${c}${n.slice(i.length)}`:n;if(u.has(a))return{error:`"${c}" already exists.`};u.add(a),l[t]=a,r&&p++}return p===0?{error:`Could not find the selected folder to rename.`}:{nextFiles:l,sourcePath:i,destinationPath:c,isFolder:n}}function fa(e){return e.endsWith(`/`)}function pa(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 ma(e){let t=[],n=new Set;for(let r of e)n.has(r)||(n.add(r),t.push(r));let r=new Set;for(let e of t.toSorted((e,t)=>e.length===t.length?e.localeCompare(t):e.length-t.length)){let t=(e.endsWith(`/`)?e.slice(0,-1):e).split(`/`),n=!1;for(let e=0;e<t.length-1;e+=1){let i=`${t.slice(0,e+1).join(`/`)}/`;if(r.has(i)){n=!0;break}}n||r.add(e)}return t.filter(e=>r.has(e))}function ha(e,t){return t.includes(e)?ma(t):[e]}function ga(e,t){return e===t?!0:e==null||t==null?!1:e.kind===t.kind&&e.directoryPath===t.directoryPath&&e.flattenedSegmentPath===t.flattenedSegmentPath&&e.hoveredPath===t.hoveredPath}function _a(e,t){return{draggedPaths:e,target:t}}function va(e,t){if(t.kind!==`directory`||t.directoryPath==null)return!1;for(let n of e)if(fa(n)&&(t.directoryPath===n||t.directoryPath.startsWith(n)))return!0;return!1}function ya(e,t){return t.kind===`root`||t.directoryPath==null?pa(e):t.directoryPath}function ba(e,t){let n=e.map(e=>{let n=ya(e,t);return n===e?null:{from:e,to:n,type:`move`}}).filter(e=>e!=null);return n.length===0?null:{operations:n,result:{draggedPaths:e,operation:n.length===1?`move`:`batch`,target:t}}}function xa(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 Sa(e,t,n){let{paths:r,preparedInput:i}=e;if(i==null){if(r==null)throw Error(`FileTree requires paths or preparedInput`);return{paths:r,preparedInput:void 0}}let a=i.paths;if(r==null)return{paths:a,preparedInput:i};if(!xa(Ki.preparePaths(r,n==null?{}:{sort:n}),a))throw Error(`FileTree ${t} received paths and preparedInput for different path lists`);return{paths:a,preparedInput:i}}function Ca(e){return e.operation===`add`||e.operation===`remove`||e.operation===`move`||e.operation===`batch`}function wa(e,t,n){if(e===t)return n;let r=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(r)?`${n.endsWith(`/`)?n:`${n}/`}${e.slice(r.length)}`:e}function Ta(e,t){if(e===t)return!0;let n=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(n)}function Ea(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 Ta(e,t.path)?n?e:null:e;case`move`:return wa(e,t.from,t.to);case`batch`:{let r=e;for(let e of t.events)if(r=Ea(r,e,n),r==null)return null;return r}}}function Da(e){return{canonicalChanged:e.canonicalChanged,projectionChanged:e.projectionChanged,visibleCountDelta:e.visibleCountDelta}}function Oa(e){switch(e.operation){case`add`:return{...Da(e),operation:`add`,path:e.path};case`remove`:return{...Da(e),operation:`remove`,path:e.path,recursive:e.recursive};case`move`:return{...Da(e),from:e.from,operation:`move`,to:e.to}}}function ka(e){return{...Da(e),events:e.events.filter(e=>e.operation===`add`||e.operation===`remove`||e.operation===`move`).map(e=>Oa(e)),operation:`batch`}}function Aa(e){switch(e.operation){case`add`:case`remove`:case`move`:return Oa(e);case`batch`:return ka(e);default:return null}}function ja(e,t){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}function Ma(e){let t=e.endsWith(`/`)?e.slice(0,-1):e;if(t.length===0)return[];let n=t.split(`/`);return n.slice(0,-1).map((e,t)=>`${n.slice(0,t+1).join(`/`)}/`)}function Na(e){return Ma(e).at(-1)??null}function Pa(e,t){return t==null?e:e.startsWith(t)?e.slice(t.length):e}function Fa(e){return e.endsWith(`/`)}var Ia=e=>e.toLowerCase();function La(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`);return n<0?t:t.slice(n+1)}function Ra(e){return e.endsWith(`/`)?e.slice(0,-1):e}function za(e,t){return t&&!e.endsWith(`/`)?`${e}/`:e}var Ba=e=>{let t=e.trim();return t.length===0?``:(t.includes(`\\`)?t.replaceAll(`\\`,`/`):t).toLowerCase()},Va=Symbol(`FILE_TREE_RENAME_VIEW`),Ha=512,Ua=512;function Wa(e){return e===`top`||e===`center`?e:`nearest`}function Ga(e,t,n){if(e===0)return-1;if(n!=null){let e=t(n);if(e!=null)return e;let r=Ma(n);for(let e=r.length-1;e>=0;--e){let n=r[e];if(n==null)continue;let i=t(n);if(i!=null)return i}}return 0}function Ka(e,t,n){if(e.paths.length===0)return{focusedIndex:-1,getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex};if(t==null)return{focusedIndex:0,getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex};let r=n??(t=>e.visibleIndexByPath.get(t)??null);return{focusedIndex:Ga(e.paths.length,r,t),getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex}}var qa=class{#e;#t=new Set;#n=new Map;#r=null;#i=null;#a=new Map;#o=new Map;#s=-1;#c=null;#l=!1;#u=e=>-1;#d=new Map;#f=null;#p=null;#m=null;#h=null;#g=null;#_;#v;#y;#b=[];#x=new Int32Array;#S=new Int32Array;#C=void 0;#w=!1;#T=null;#E=``;#D=!1;#O=new Set;#k=[];#A;#j=null;#M=null;#N=null;#P=null;#F=null;#I=null;#L=null;#R=0;#z=null;#B=new Set;#V=0;#H;#U=0;#W=!1;#G=0;#K;constructor(e){let{dragAndDrop:t,fileTreeSearchMode:n,initialSearchQuery:r,initialSelectedPaths:i,renaming:a,onSearchChange:o,paths:s,preparedInput:c,...l}=e,u=Sa({paths:s,preparedInput:c},`constructor`,l.sort);this.#e=l,t!=null&&t!==!1&&(this.#r=t===!0?{}:t),this.#w=a!=null&&a!==!1,a!=null&&a!==!1&&a!==!0&&(this.#C=a.canRename,this.#v=a.onError,this.#_=a.onRename),this.#y=o,this.#A=n??`hide-non-matches`,this.#H=this.#le(u.paths,u.preparedInput);let d=i?.map(e=>this.#Ne(e)).filter(e=>e!=null)??[],f=d.at(-1)??null;d.length>0&&(this.#B=new Set(d),this.#z=f,this.#V=1),this.#je(f,!1),r!=null&&this.#Te(r,!1),this.#K=this.#Re()}destroy(){this.#K?.(),this.#K=null,this.#n.clear(),this.#t.clear(),this.#d.clear(),this.#i=null,this.#he()}focusFirstItem(){this.#be().length>0&&this.#Fe(0)}focusLastItem(){this.#G<=0||(this.#Ie(),this.#Fe(this.#G-1))}focusNextItem(){this.#Ae(1)}focusParentItem(){if(this.#c==null)return;let e=Na(this.#c);if(e==null)return;let t=this.#Z(e);t>=0&&this.#Fe(t)}focusPath(e){let t=this.#H.getPathInfo(e)?.path??null;if(t==null)return;this.#Ie();let n=this.#Z(t);n>=0&&this.#Fe(n)}scrollToPath(e,t){let n=this.#H.getPathInfo(e)?.path??null;if(n==null)return;this.#Ie();let r=this.#xe(n);r<0||this.#Me(r)!=null&&(t?.focus!==!1&&this.#Fe(r,!1),this.#L={id:this.#R+=1,offset:Wa(t?.offset),visibleIndex:r},this.#De())}focusMountedPathFromInput(e){let t=this.#H.getPathInfo(e)?.path??null;if(t==null)return;let n=this.#Z(t);n>=0&&this.#Fe(n)}focusNearestPath(e){let t=this.resolveNearestVisiblePath(e);if(t==null)return null;let n=this.#Z(t);return n>=0?(this.#Fe(n),this.#be()[n]??t):null}focusPreviousItem(){this.#Ae(-1)}getFocusedIndex(){return this.#s}getFocusedItem(){return this.#c==null?null:this.#Q(this.#c)}getFocusedPath(){return this.#c}getScrollRequest(){return this.#L}clearScrollRequest(e){this.#L?.id===e&&(this.#L=null)}resolveNearestVisiblePath(e){let t=this.#be();if(this.#G===0)return null;if(e==null)return this.#c??t[0]??null;let n=this.#H.getPathInfo(e)?.path??e,r=this.#Z(n);return r>=0?t[r]??n:this.#X(n)??this.#c??t[0]??null}getSelectedPaths(){return[...this.#B]}getSelectionVersion(){return this.#V}getVisibleCount(){return this.#G}getVisibleRows(e,t){if(t<e||this.#G===0)return[];let n=Math.max(0,e),r=Math.min(this.#G-1,t);if(r<n)return[];let i=r-n+1;if(this.#F==null&&!this.#l&&r>=this.#b.length&&i<=Ua){let e=[];for(let t=n;t<=r;t+=1){let n=this.#H.getVisibleRowContext(t);if(n==null)break;e.push(this.#ee(n))}return e}if(!this.#l&&r>=this.#b.length&&this.#Ie(),this.#F!=null){let e=Array.from({length:r-n+1},(e,t)=>this.#Se(n+t)),t=new Map,i=e[0]??-1,a=i;for(let n=1;n<=e.length;n+=1){let r=e[n];if(r!=null&&r===a+1){a=r;continue}if(i>=0&&this.#H.getVisibleSlice(i,a).forEach((e,n)=>{t.set(i+n,e)}),r==null){i=-1,a=-1;continue}i=r,a=r}return Array.from({length:r-n+1},(e,r)=>{let i=n+r,a=this.#Se(i),o=t.get(a),s=this.#b[a];if(o==null||s==null)throw Error(`Missing projection row for filtered visible index ${String(i)}`);return this.#$(o,i,a,{ancestorPaths:this.#re(a),path:s})})}return this.#H.getVisibleSlice(n,r).map((e,t)=>{let r=n+t,i=this.#b[r];if(i==null)throw Error(`Missing projection path for visible index ${String(r)}`);return this.#$(e,r,r,{ancestorPaths:this.#re(r),path:i})})}getStickyRowCandidates(e,t){if(this.#F!=null)return null;if(this.#G===0||e<=0||t<=0)return[];let n=[];for(let r=0;r<this.#G;r+=1){let i=e+r*t,a=Math.min(this.#G-1,Math.floor(i/t)),o=this.#te(a,r)??(a>0?this.#te(a-1,r):void 0);if(o==null)break;n.push({row:this.#ee(o),subtreeEndIndex:o.subtreeEndIndex})}return n}getItem(e){let t=this.#H.getPathInfo(e);return t==null?null:this.#Q(t.path,t)}resolveMountedDirectoryPathFromInput(e){let t=this.#H.getPathInfo(e);return t?.kind===`directory`?t.path:null}toggleMountedDirectoryFromInput(e){let t=this.resolveMountedDirectoryPathFromInput(e);t!=null&&this.#ze(t)}selectAllVisiblePaths(){this.#Ie();let e=[...this.#be()];this.#ae(e,this.#c??this.#z)}selectOnlyPath(e){let t=this.#Ne(e);t!=null&&this.#ae([t],t)}selectOnlyMountedPathFromInput(e){this.#ae([e],e)}selectPath(e){let t=this.#Ne(e);t==null||this.#B.has(t)||this.#ae([...this.#B,t])}deselectPath(e){let t=this.#Ne(e);t==null||!this.#B.has(t)||this.#ae([...this.#B].filter(e=>e!==t))}toggleFocusedSelection(){this.#c!=null&&this.togglePathSelectionFromInput(this.#c)}togglePathSelection(e){let t=this.#Ne(e);if(t!=null){if(this.#B.has(t)){this.deselectPath(t);return}this.selectPath(t)}}togglePathSelectionFromInput(e){let t=this.#Ne(e);if(t!=null){if(this.#B.has(t)){this.#ae([...this.#B].filter(e=>e!==t),t);return}this.#ae([...this.#B,t],t)}}selectPathRange(e,t){let n=this.#Ne(e);if(n==null)return;this.#Ie();let r=this.#z,i=r==null?-1:this.#Ce(r),a=this.#Ce(n);if(i===-1||a===-1){let e=t?[...this.#B,n]:[n];this.#ae(e,n);return}let[o,s]=i<=a?[i,a]:[a,i],c=this.#be().slice(o,s+1),l=t?[...this.#B,...c]:c;this.#ae(l,r)}extendSelectionFromFocused(e){if(this.#c==null)return;let t=this.#s;if(t===-1)return;let n=Math.min(this.#G-1,Math.max(0,t+e));if(n===t)return;!this.#l&&n>=this.#b.length&&this.#Ie();let r=this.#be(),i=r[t]??null,a=r[n]??null;if(i==null||a==null)return;let o=new Set(this.#B);o.has(i)&&o.has(a)?o.delete(i):o.add(a),this.#ae([...o],this.#z??i,!1),this.#Fe(n)}getDragAndDropConfig(){return this.#r}isDragAndDropEnabled(){return this.#r!=null}getDragSession(){return this.#i==null?null:{draggedPaths:[...this.#i.draggedPaths],primaryPath:this.#i.primaryPath,target:this.#i.target==null?null:{...this.#i.target}}}startDrag(e){if(this.#r==null)return!1;let t=this.#Ne(e);if(t==null||this.#M!=null&&this.#M.length>0)return!1;let n=this.getSelectedPaths(),r=ha(t,n);return this.#r.canDrag?.(r)===!1?!1:(n.includes(t)||this.#ae([t],t,!1),this.#Pe(t),this.#i={draggedPaths:r,primaryPath:t,target:null},this.#De(),!0)}setDragTarget(e){let t=this.#i;if(t==null)return;let n=e;if(n!=null){let e=_a(t.draggedPaths,n);(va(t.draggedPaths,n)||this.#r?.canDrop?.(e)===!1)&&(n=null)}ga(t.target,n)||(this.#i={...t,target:n},this.#De())}cancelDrag(){this.#i!=null&&(this.#i=null,this.#De())}completeDrag(){let e=this.#i;if(e==null)return!1;this.#i=null;let t=e.target==null?null:{...e.target};if(t==null)return this.#De(),!1;let n=_a(e.draggedPaths,t);if(va(e.draggedPaths,t)||this.#r?.canDrop?.(n)===!1)return this.#De(),!1;let r=ba(e.draggedPaths,t);if(r==null)return this.#De(),!1;try{if(r.operations.length===1){let e=r.operations[0];if(e==null||e.type!==`move`)throw Error(`Expected a single move operation for one-item drops`);this.#H.move(e.from,e.to,{collision:e.collision})}else this.#ce(r.operations),this.#H.batch(r.operations)}catch(e){return this.#De(),this.#r?.onDropError?.(e instanceof Error?e.message:String(e),n),!1}return this.#r?.onDropComplete?.(r.result),!0}subscribe(e){return this.#t.add(e),e(),()=>{this.#t.delete(e)}}add(e){this.#H.add(e)}remove(e,t={}){this.#H.remove(e,t)}move(e,t,n={}){this.#H.move(e,t,n)}batch(e){this.#H.batch(e)}onMutation(e,t){let n=e,r=t,i=this.#n.get(n);return i??(i=new Set,this.#n.set(n,i)),i.add(r),()=>{let e=this.#n.get(n);e?.delete(r),e?.size===0&&this.#n.delete(n)}}setSearch(e){this.#Te(e,!0)}openSearch(e=``){this.#Te(e,!0)}closeSearch(){this.#Te(null,!0)}isSearchOpen(){return this.#M!==null}getSearchValue(){return this.#M??``}getSearchMatchingPaths(){return this.#k}focusNextSearchMatch(){this.#we(1)}focusPreviousSearchMatch(){this.#we(-1)}startRenaming(e=this.#c??``,t={}){if(!this.#w)return!1;let n=this.#H.getPathInfo(e);if(n==null)return!1;let r=n.path,i=Fa(r),a=Ra(r);if(this.#C?.({isFolder:i,path:a})===!1)return!1;for(let e of Ma(r))this.#H.isExpanded(e)||this.#H.expand(e);return this.#ae([r],r,!1),this.#M!=null&&(this.#Te(null,!1),this.#y?.(this.#M)),this.#Pe(r),this.#T=r,this.#E=La(r),this.#D=t.removeIfCanceled??!1,this.#De(),!0}[Va](){return{cancel:()=>{this.#q()},commit:()=>{this.#J()},getPath:()=>this.#T,getValue:()=>this.#E,isActive:()=>this.#T!=null,setValue:e=>{this.#Y(e)}}}#q(){if(this.#T==null)return;let e=this.#T,t=this.#D;if(this.#T=null,this.#E=``,this.#D=!1,t){this.remove(e,Fa(e)?{recursive:!0}:void 0);return}this.#Pe(e),this.#De()}#J(){let e=this.#T;if(e==null)return;if(this.#D&&this.#E.trim().length===0){this.#T=null,this.#E=``,this.#D=!1,this.remove(e,Fa(e)?{recursive:!0}:void 0);return}let t=Fa(e),n=da({files:this.#H.list(),isFolder:t,nextBasename:this.#E,path:Ra(e)});if(this.#T=null,this.#E=``,this.#D=!1,`error`in n){this.#Pe(e),this.#v?.(n.error),this.#De();return}if(n.sourcePath===n.destinationPath){this.#Pe(e),this.#De();return}this.#_?.({destinationPath:n.destinationPath,isFolder:n.isFolder,sourcePath:n.sourcePath}),this.move(za(n.sourcePath,t),za(n.destinationPath,t))}#Y(e){this.#T==null||this.#E===e||(this.#E=e,this.#De())}resetPaths(e,t={}){let n=this.#H.list().length,r=this.#G,i=Sa({paths:e,preparedInput:t.preparedInput},`resetPaths`,this.#e.sort),a=this.#le(i.paths,i.preparedInput,t.initialExpandedPaths),o=this.#c,s=this.#T,c=this.getSelectedPaths(),l=this.#z;this.#K?.(),this.#H=a,this.#d.clear(),this.#he();let u=c.map(e=>a.getPathInfo(e)?.path??null).filter(e=>e!=null),d=!ja(this.#B,u);this.#B=new Set(u),d&&(this.#V+=1),this.#z=l==null?null:a.getPathInfo(l)?.path??null,this.#T=s==null?null:a.getPathInfo(s)?.path??null,this.#T??(this.#E=``,this.#D=!1),this.#je(o,o!=null||u.length>0||this.#z!=null),this.#K=this.#Re(),this.#De(),this.#Oe({canonicalChanged:!0,operation:`reset`,pathCountAfter:i.paths.length,pathCountBefore:n,projectionChanged:!0,usedPreparedInput:t.preparedInput!=null,visibleCountDelta:this.#G-r})}#X(e){this.#Ie();let t=Na(e),n=Pa(e,t),r=null,i=null;for(let e of this.#be()){if(Na(e)!==t)continue;let a=Pa(e,t);if(a<n){r=e;continue}if(a>n){i=e;break}}return r??i}#Z(e){let t=this.#Ce(e);if(t!==-1)return t;let n=Ma(e);for(let e=n.length-1;e>=0;--e){let t=n[e];if(t==null)continue;let r=this.#Ce(t);if(r!==-1)return r}return this.#be().length>0?0:-1}#Q(e,t){let n=this.#d.get(e);if(n!=null)return n;let r=t??this.#H.getPathInfo(e);if(r==null)return null;let i=r.kind===`directory`?this.#oe(r.path):this.#se(r.path);return this.#d.set(r.path,i),i}#$(e,t,n,r){return{ancestorPaths:r.ancestorPaths,depth:e.depth,flattenedSegments:e.flattenedSegments?.map(e=>({isTerminal:e.isTerminal,name:e.name,path:e.path})),hasChildren:e.hasChildren,index:t,isExpanded:e.isExpanded,isFlattened:e.isFlattened,isFocused:r.path===this.#c,isSelected:this.#B.has(r.path),kind:e.kind,level:e.depth,name:e.name,path:r.path,posInSet:r.posInSet??this.#x[n]??0,setSize:r.setSize??this.#S[n]??0}}#ee(e){return this.#$(e.row,e.index,e.index,{ancestorPaths:e.ancestorPaths,path:e.row.path,posInSet:e.posInSet,setSize:e.setSize})}#te(e,t){let n=this.#H.getVisibleRowContext(e);return n==null?void 0:n.ancestorRows[t]??(t===n.ancestorRows.length&&n.row.kind===`directory`&&n.row.isExpanded?n:void 0)}#ne(e){let t=this.#a.get(e);if(t!=null)return t;let n=this.#u(e),r=n<0?[]:[...this.#ne(n),n];return this.#a.set(e,r),r}#re(e){let t=this.#o.get(e);if(t!=null)return t;let n=this.#ne(e).map(e=>this.#b[e]??``).filter(e=>e!==``);return this.#o.set(e,n),n}#ie(e){this.#H.collapse(e)}#ae(e,t=this.#z,n=!0){let r=[...new Set(e)],i=!ja(this.#B,r),a=this.#z!==t;!i&&!a||(this.#B=new Set(r),this.#z=t,i&&(this.#V+=1),n&&this.#De())}#oe(e){return{collapse:()=>{this.#ie(e)},deselect:()=>{this.deselectPath(e)},expand:()=>{this.#ke(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!0,isExpanded:()=>this.#H.isExpanded(e),isFocused:()=>this.#c===e,isSelected:()=>this.#B.has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)},toggle:()=>{this.#ze(e)}}}#se(e){return{deselect:()=>{this.deselectPath(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!1,isFocused:()=>this.#c===e,isSelected:()=>this.#B.has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)}}}#ce(e){let t=this.#H.list();this.#le(t).batch(e)}#le(e,t,n){return new Ki({...this.#e,paths:e,preparedInput:t??void 0,...n===void 0?{}:{initialExpandedPaths:n}})}#ue(){return this.#h??=this.#H.list(),this.#h}#de(){if(this.#m!=null)return this.#m;let e=new Set;for(let t of this.#ue()){e.add(t);for(let n of Ma(t))e.add(n)}return this.#m=[...e].sort(),this.#m}#fe(){return this.#g??=this.#ue().map(Ia),this.#g}#pe(){return this.#f??=this.#de().filter(e=>e.endsWith(`/`)),this.#f}#me(){return this.#p??=this.#pe().map(Ia),this.#p}#he(){this.#f=null,this.#p=null,this.#m=null,this.#h=null,this.#g=null}#ge(){return this.#pe().filter(e=>this.#H.isExpanded(e))}#_e(e){let t=new Set(this.#j??[]);if(e)for(let e of this.#B)for(let n of Ma(e))t.add(n);this.#ve(t)}#ve(e){this.#W=!0;try{for(let t of this.#pe()){let n=e.has(t),r=this.#H.isExpanded(t);n&&!r?this.#H.expand(t):!n&&r&&this.#H.collapse(t)}}finally{this.#W=!1}}#ye(){if(this.#M==null||this.#M.length===0){this.#k=[],this.#F=null,this.#I=null,this.#P=null,this.#G=this.#U;return}let e=this.#b;if(this.#k=e.filter(e=>this.#O.has(e)),this.#A!==`hide-non-matches`||this.#O.size===0){this.#F=null,this.#I=null,this.#P=null,this.#G=this.#U;return}let t=[],n=[],r=new Map;for(let[i,a]of e.entries())this.#N?.has(a)===!0&&(r.set(a,n.length),t.push(i),n.push(a));this.#F=t,this.#I=n,this.#P=r,this.#G=n.length}#be(){return this.#I??this.#b}#xe(e){return this.#I==null?this.#H.getVisibleIndex(e)??-1:this.#P?.get(e)??-1}#Se(e){return this.#F?.[e]??e}#Ce(e){return this.#P?.get(e)??this.#H.getVisibleIndex(e)??-1}#we(e){let t=this.#k;if(t.length===0)return;let n=this.#c,r=n==null?-1:t.indexOf(n),i=t[r<0?e>0?0:t.length-1:Math.min(t.length-1,Math.max(0,r+e))];i!=null&&this.focusPath(i)}#Te(e,t){let n=e==null?null:Ba(e),r=this.#M;if(r!==n){if(r==null&&n!=null&&(this.#j=this.#ge()),this.#M=n,n==null)this.#_e(!0),this.#j=null,this.#O.clear(),this.#N=null,this.#je(this.#c,!0);else if(n.length===0)this.#_e(!1),this.#O.clear(),this.#N=null,this.#je(this.#c,!0);else{let e=this.#Ee();this.#je(e,!0)}t&&(this.#y?.(this.#M),this.#De())}}#Ee(){if(this.#M==null||this.#M.length===0)return this.#O.clear(),this.#c;let e=this.#M,t=this.#ue(),n=this.#fe(),r=[],i=new Set,a=null;for(let o=0;o<t.length;o+=1){if(!n[o].includes(e))continue;let s=t[o];r.push(s),i.add(s),a??=s}let o=this.#pe(),s=this.#me();for(let t=0;t<o.length;t+=1){if(!s[t].includes(e))continue;let n=o[t];i.has(n)||(r.push(n),i.add(n),a??=n)}this.#O=i;let c=this.#A===`hide-non-matches`&&r.length>0?new Set:null;this.#N=c;let l=this.#A===`expand-matches`?new Set(this.#j??[]):new Set;for(let e of r){c?.add(e),e.endsWith(`/`)&&l.add(e);for(let t of Ma(e))l.add(t),c?.add(t)}return this.#ve(l),a??this.#c}#De(){for(let e of this.#t)e()}#Oe(e){this.#n.get(e.operation)?.forEach(t=>{t(e)}),this.#n.get(`*`)?.forEach(t=>{t(e)})}#ke(e){for(let t of Ma(e))this.#H.isExpanded(t)||this.#H.expand(t);this.#H.isExpanded(e)||this.#H.expand(e)}#Ae(e){let t=this.#G;if(t===0)return;let n=this.#s===-1?0:this.#s,r=Math.min(t-1,Math.max(0,n+e));(r!==n||this.#s===-1)&&(!this.#l&&this.#F==null&&r>=this.#b.length&&this.#Ie(),this.#Fe(r))}#je(e,t=!0){let n=this.#H.getVisibleCount();this.#U=n;let r=Ka(this.#H.getVisibleTreeProjectionData(t?void 0:Math.min(n,Ha)),e,t?e=>this.#H.getVisibleIndex(e):void 0);this.#a.clear(),this.#o.clear(),this.#l=r.paths.length>=n,this.#u=r.getParentIndex,this.#b=r.paths,this.#x=r.posInSetByIndex,this.#S=r.setSizeByIndex,this.#ye(),this.#s=e==null?this.#be().length>0?0:-1:this.#Z(e),this.#c=this.#s<0?null:this.#Me(this.#s)}#Me(e){return this.#be()[e]??(this.#F==null?this.#H.getVisibleRowContext(e)?.row.path??null:null)}#Ne(e){return this.#H.getPathInfo(e)?.path??null}#Pe(e){if(e==null)return;let t=this.#Z(e);t>=0&&this.#Fe(t,!1)}#Fe(e,t=!0){let n=this.#Me(e);n!=null&&(this.#s===e&&this.#c===n||(this.#s=e,this.#c=n,t&&this.#De()))}#Ie(){this.#l||this.#je(this.#c,!0)}#Le(e){let t=Ea(this.#T,e);t==null&&this.#T!=null&&(this.#E=``),this.#T=t;let n=Ea(this.#c,e,!0),r=[...this.#B].map(t=>Ea(t,e)).filter(e=>e!=null).map(e=>this.#H.getPathInfo(e)?.path??null).filter(e=>e!=null),i=Ea(this.#z,e),a=i==null?null:this.#H.getPathInfo(i)?.path??null,o=[...new Set(r)];return ja(this.#B,o)||(this.#B=new Set(o),this.#V+=1),this.#z=a,n}#Re(){return this.#H.on(`*`,e=>{if(this.#W)return;e.canonicalChanged&&(this.#d.clear(),this.#he()),this.#i!=null&&Ca(e)&&(this.#i=null);let t=Ca(e)?this.#Le(e):this.#c,n=this.#M!=null&&this.#M.length>0?this.#Ee():this.#M===``?this.#c:t,r=this.#M!=null||e.operation!==`expand`&&e.operation!==`collapse`;this.#je(n,r),this.#De();let i=Aa(e);i!=null&&this.#Oe(i)})}#ze(e){if(this.#H.isExpanded(e)){this.#ie(e);return}this.#ke(e)}},Ja=e=>{if(e==null||e.length===0)return`0`;let t=`${e.length}`;for(let n of e)t+=`\0${n.path}\0${n.status}`;return t};function Ya(e){let t=e.endsWith(`/`),n=``,r=-1;for(let t=0;t<=e.length;t+=1){if(!(e[t]===`/`||t===e.length)){r===-1&&(r=t);continue}r!==-1&&(n!==``&&(n+=`/`),n+=e.slice(r,t),r=-1)}return n===``?null:{isDirectory:t,path:n}}function Xa(e){let t=e.endsWith(`/`)?e.slice(0,-1):e;if(t.length===0)return[];let n=t.split(`/`);return n.slice(0,-1).map((e,t)=>`${n.slice(0,t+1).join(`/`)}/`)}function Za(e,t){return t?`${e}/`:e}function Qa(e,t=null){let n=Ja(e==null?void 0:[...e]);if(n===`0`)return null;if(t?.signature===n)return t;let r=new Map,i=new Set,a=new Set;for(let t of e??[]){let e=Ya(t.path);if(e==null)continue;let n=Za(e.path,e.isDirectory);r.set(n,t.status),t.status===`ignored`&&e.isDirectory?a.add(n):e.isDirectory&&a.delete(n);for(let t of Xa(e.path))i.add(t)}return{directoriesWithChanges:i,ignoredDirectoryPaths:a,signature:n,statusByPath:r}}var G,$a,eo,to,no,ro,io,ao,oo,so,co={},lo=[],uo=Array.isArray,fo=lo.slice,po=Object.assign;function mo(e){e&&e.parentNode&&e.remove()}function ho(e,t,n){var r,i,a,o={};for(a in t)a==`key`?r=t[a]:a==`ref`&&typeof e!=`function`?i=t[a]:o[a]=t[a];return arguments.length>2&&(o.children=arguments.length>3?fo.call(arguments,2):n),go(e,o,r,i,null)}function go(e,t,n,r,i){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++$a,__i:-1,__u:0};return i==null&&G.vnode!=null&&G.vnode(a),a}function _o(e){return e.children}function vo(e,t){this.props=e,this.context=t,this.__g=0}function yo(e,t){if(t==null)return e.__?yo(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`?yo(e):null}function bo(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 bo(e)}}function xo(e){(8&e.__g||!(e.__g|=8)||!eo.push(e)||no++)&&to==G.debounceRendering||((to=G.debounceRendering)||queueMicrotask)(So)}function So(){for(var e,t,n,r,i,a,o,s,c=1;eo.length;)eo.length>c&&eo.sort(ro),e=eo.shift(),c=eo.length,8&e.__g&&(n=void 0,i=(r=(t=e).__v).__e,a=[],o=[],(s=t.__P)&&((n=po({},r)).__v=r.__v+1,G.vnode&&G.vnode(n),Ao(s,n,r,t.__n,s.namespaceURI,32&r.__u?[i]:null,a,i??yo(r),!!(32&r.__u),o,s.ownerDocument),n.__v=r.__v,n.__.__k[n.__i]=n,Mo(a,n,o),n.__e!=i&&bo(n)));no=0}function Co(e,t,n,r,i,a,o,s,c,l,u,d){var f,p,m,h,g,_,v,y=r&&r.__k||lo,b=t.length;for(c=wo(n,t,y,c,b),f=0;f<b;f++)(m=n.__k[f])!=null&&(p=m.__i==-1?co:y[m.__i]||co,m.__i=f,_=Ao(e,m,p,i,a,o,s,c,l,u,d),h=m.__e,m.ref&&p.ref!=m.ref&&(p.ref&&Fo(p.ref,null,m),u.push(m.ref,m.__c||h,m)),g==null&&h!=null&&(g=h),(v=!!(4&m.__u))||p.__k===m.__k?c=To(m,c,e,v):typeof m.type==`function`&&_!==void 0?c=_:h&&(c=h.nextSibling),m.__u&=-7);return n.__e=g,c}function wo(e,t,n,r,i){var a,o,s,c,l,u=n.length,d=u,f=0;for(e.__k=Array(i),a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(c=a+f,(o=e.__k[a]=typeof o==`string`||typeof o==`number`||typeof o==`bigint`||o.constructor==String?go(null,o,null,null,null):uo(o)?go(_o,{children:o},null,null,null):o.constructor==null&&o.__b>0?go(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o).__=e,o.__b=e.__b+1,s=null,(l=o.__i=Eo(o,n,c,d))!=-1&&(d--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(i>u?f--:i<u&&f++),typeof o.type!=`function`&&(o.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,o.__u|=4))):e.__k[a]=null;if(d)for(a=0;a<u;a++)(s=n[a])!=null&&!(2&s.__u)&&(s.__e==r&&(r=yo(s)),Io(s,s));return r}function To(e,t,n,r){var i,a;if(typeof e.type==`function`){for(i=e.__k,a=0;i&&a<i.length;a++)i[a]&&(i[a].__=e,t=To(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=yo(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function Eo(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&(2&l.__u)==0;if(l===null&&e.key==null||u&&s==l.key&&c==l.type)return n;if(r>+!!u){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])!=null&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function Do(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n??``}function Oo(e,t,n,r,i){var a;n:if(t==`style`)if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||Do(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||Do(e.style,t,n[t])}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(io,`$1`)),(t=t.slice(2))[0].toLowerCase()!=t[0]&&(t=t.toLowerCase()),e.__l||={},e.__l[t+a]=n,n?r?n.l=r.l:(n.l=ao,e.addEventListener(t,a?so:oo,a)):e.removeEventListener(t,a?so:oo,a);else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n??``;break n}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function ko(e){return function(t){if(this.__l){var n=this.__l[t.type+e];if(t.u==null)t.u=ao++;else if(t.u<n.l)return;return n(G.event?G.event(t):t)}}}function Ao(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k,A,ee,j=t.type;if(t.constructor!=null)return null;128&n.__u&&(c=!!(32&n.__u),n.__c.__z&&(s=t.__e=n.__e=(a=n.__c.__z)[0],n.__c.__z=null)),(d=G.__b)&&d(t);n:if(typeof j==`function`)try{if(v=t.props,y=`prototype`in j&&j.prototype.render,b=(d=j.contextType)&&r[d.__c],x=d?b?b.props.value:d.__:r,n.__c?2&(f=t.__c=n.__c).__g&&(f.__g|=1,_=!0):(y?t.__c=f=new j(v,x):(t.__c=f=new vo(v,x),f.constructor=j,f.render=Lo),b&&b.sub(f),f.props=v,f.state||={},f.context=x,f.__n=r,p=!0,f.__g|=8,f.__h=[],f._sb=[]),y&&f.__s==null&&(f.__s=f.state),y&&j.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=po({},f.__s)),po(f.__s,j.getDerivedStateFromProps(v,f.__s))),m=f.props,h=f.state,f.__v=t,p)y&&j.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),y&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(y&&j.getDerivedStateFromProps==null&&v!==m&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(v,x),!(4&f.__g)&&f.shouldComponentUpdate!=null&&!1===f.shouldComponentUpdate(v,f.__s,x)||t.__v==n.__v){for(t.__v!=n.__v&&(f.props=v,f.state=f.__s,f.__g&=-9),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),S=0;S<f._sb.length;S++)f.__h.push(f._sb[S]);f._sb=[],f.__h.length&&o.push(f);break n}f.componentWillUpdate!=null&&f.componentWillUpdate(v,f.__s,x),y&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(m,h,g)})}if(f.context=x,f.props=v,f.__P=e,f.__g&=-5,C=G.__r,w=0,y){for(f.state=f.__s,f.__g&=-9,C&&C(t),d=f.render(f.props,f.state,f.context),T=0;T<f._sb.length;T++)f.__h.push(f._sb[T]);f._sb=[]}else do f.__g&=-9,C&&C(t),d=f.render(f.props,f.state,f.context),f.state=f.__s;while(8&f.__g&&++w<25);f.state=f.__s,f.getChildContext!=null&&(r=po({},r,f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),E=d,d!=null&&d.type===_o&&d.key==null&&(E=No(d.props.children)),s=Co(e,uo(E)?E:[E],t,n,r,i,a,o,s,c,l,u),t.__u&=-161,f.__h.length&&o.push(f),_&&(f.__g&=-4)}catch(e){if(t.__v=null,c||a!=null)if(e.then){for(D=0,O=!1,t.__u|=c?160:128,t.__c.__z=[],k=0;k<a.length;k++)(A=a[k])==null||O||(A.nodeType==8&&A.data==`$s`?(D>0&&t.__c.__z.push(A),D++,a[k]=null):A.nodeType==8&&A.data==`/$s`?(--D>0&&t.__c.__z.push(A),O=D===0,s=a[k],a[k]=null):D>0&&(t.__c.__z.push(A),a[k]=null));if(!O){for(;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;a[a.indexOf(s)]=null,t.__c.__z=[s]}t.__e=s}else{for(ee=a.length;ee--;)mo(a[ee]);jo(t)}else t.__e=n.__e,t.__k=n.__k,e.then||jo(t);G.__e(e,t,n)}else s=t.__e=Po(n.__e,t,n,r,i,a,o,c,l,u);return(d=G.diffed)&&d(t),128&t.__u?void 0:s}function jo(e){e&&e.__c&&(e.__c.__g|=4),e&&e.__k&&e.__k.forEach(jo)}function Mo(e,t,n){for(var r=0;r<n.length;r++)Fo(n[r],n[++r],n[++r]);G.__c&&G.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){G.__e(e,t.__v)}})}function No(e){return typeof e!=`object`||!e||e.__b&&e.__b>0?e:uo(e)?e.map(No):po({},e)}function Po(e,t,n,r,i,a,o,s,c,l){var u,d,f,p,m,h,g,_,v=n.props,y=t.props,b=t.type;if(b==`svg`?i=`http://www.w3.org/2000/svg`:b==`math`?i=`http://www.w3.org/1998/Math/MathML`:i||=`http://www.w3.org/1999/xhtml`,a!=null){for(u=0;u<a.length;u++)if((m=a[u])&&`setAttribute`in m==!!b&&(b?m.localName==b:m.nodeType==3)){e=m,a[u]=null;break}}if(e==null){if(b==null)return l.createTextNode(y);e=l.createElementNS(i,b,y.is&&y),s&&=(G.__m&&G.__m(t,a),!1),a=null}if(b==null)v===y||s&&e.data==y||(e.data=y);else{if(a&&=fo.call(e.childNodes),v=n.props||co,!s&&a!=null)for(v={},u=0;u<e.attributes.length;u++)v[(m=e.attributes[u]).name]=m.value;for(u in v)if(m=v[u],u!=`children`){if(u==`dangerouslySetInnerHTML`)f=m;else if(!(u in y)){if(u==`value`&&`defaultValue`in y||u==`checked`&&`defaultChecked`in y)continue;Oo(e,u,null,m,i)}}for(u in _=1&n.__u,y)m=y[u],u==`children`?p=m:u==`dangerouslySetInnerHTML`?d=m:u==`value`?h=m:u==`checked`?g=m:s&&typeof m!=`function`||v[u]===m&&!_||Oo(e,u,m,v[u],i);if(d)s||f&&(d.__html==f.__html||d.__html==e.innerHTML)||(e.innerHTML=d.__html),t.__k=[];else if(f&&(e.innerHTML=``),Co(b==`template`?e.content:e,uo(p)?p:[p],t,n,r,b==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&yo(n,0),s,c,l),a!=null)for(u=a.length;u--;)mo(a[u]);s||(u=`value`,b==`progress`&&h==null?e.removeAttribute(`value`):h==null||h===e[u]&&(b!==`progress`||h)||Oo(e,u,h,v[u],i),u=`checked`,g!=null&&g!=e[u]&&Oo(e,u,g,v[u],i))}return e}function Fo(e,t,n){try{if(typeof e==`function`){var r=typeof e.__u==`function`;r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(e){G.__e(e,n)}}function Io(e,t,n){var r,i;if(G.unmount&&G.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||Fo(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){G.__e(e,t)}r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&Io(r[i],t,n||typeof e.type!=`function`);n||mo(e.__e),e.__e&&e.__e.__l&&(e.__e.__l=null),e.__e=e.__c=e.__=null}function Lo(e,t,n){return this.constructor(e,n)}function Ro(e,t){var n,r,i,a;t==document&&(t=document.documentElement),G.__&&G.__(e,t),r=(n=!!(e&&32&e.__u))?null:t.__k,e=t.__k=ho(_o,null,[e]),i=[],a=[],Ao(t,e,r||co,co,t.namespaceURI,r?null:t.firstChild?fo.call(t.childNodes):null,i,r?r.__e:t.firstChild,n,a,t.ownerDocument),Mo(i,e,a)}function zo(e,t){e.__u|=32,Ro(e,t)}G={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!(1&i.__g)){i.__g|=4;try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),o=8&i.__g),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),o=8&i.__g),o)return void(i.__g|=2)}catch(t){e=t}}throw no=0,e}},$a=0,vo.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=po({},this.state);typeof e==`function`&&(e=e(po({},n),this.props)),e&&po(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),xo(this))},vo.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),xo(this))},vo.prototype.render=_o,eo=[],no=0,ro=function(e,t){return e.__v.__b-t.__v.__b},io=/(PointerCapture)$|Capture$/i,ao=0,oo=ko(!1),so=ko(!0);var Bo=0;Array.isArray;function K(e,t,n,r,i,a){t||={};var o,s,c=t;if(`ref`in c&&typeof e!=`function`)for(s in c={},t)s==`ref`?o=t[s]:c[s]=t[s];var l={type:e,props:c,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Bo,__i:-1,__u:0,__source:i,__self:a};return G.vnode&&G.vnode(l),l}var Vo=16,Ho=16,Uo={};function Wo({name:e,remappedFrom:t,token:n,width:r,height:i,viewBox:a,label:o,alignCapitals:s=!1}){"use no memo";let c=`#${e.replace(/^#/,``)}`,{width:l,height:u,viewBox:d}=Uo[e]??{width:Vo,height:Ho},f=r??l,p=i??u,m=a??d??`0 0 ${l} ${u}`;return K(`svg`,{"data-icon-name":t??e,"data-icon-token":n,"data-align-capitals":s,...o==null?{"aria-hidden":!0}:{"aria-label":o,role:`img`},viewBox:m,width:f,height:p,children:K(`use`,{href:c})})}var Go=e=>{if(e.length<2)return[e,``];let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]},Ko=e=>{if(e.length<4)return[e,``];let t=e.lastIndexOf(`.`)+1,n=e.length-t>10,r=t>=1&&!n?t:Math.ceil(e.length/2);return[e.slice(0,r),e.slice(r)]},qo=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)]},Jo=(e,{splitIndex:t}={})=>{if(typeof t!=`number`){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}return[e.slice(0,t),e.slice(t)]},Yo=(e,{splitOffset:t}={})=>{if(typeof t!=`number`||t<=0||t>=e.length){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}let n=e.length-t;return[e.slice(0,n),e.slice(n)]},Xo=(e,{splitOffset:t}={})=>{if(typeof t!=`number`||t<=0||t>=e.length){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}let n=t;return[e.slice(0,n),e.slice(n)]};function Zo({children:e,marker:t,variant:n=`default`}){"use no memo";return K(`div`,{"aria-hidden":!0,"data-truncate-marker-cell":!0,children:K(`div`,{"data-truncate-marker":!0,children:typeof t==`function`?t({children:e}):n===`fade`?K(`span`,{"data-truncate-fade":!0}):t})})}function Qo(e){"use no memo";let{mode:t,children:n}=e;return K(`div`,{children:[K(`div`,{"data-truncate-content":`visible`,children:t===`fruncate`?K(`span`,{children:n}):n}),K(`div`,{"data-truncate-content":`overflow`,"aria-hidden":!0,children:t===`fruncate`?K(`span`,{children:n}):n})]})}function $o({children:e,mode:t=`truncate`,marker:n=`…`,variant:r=`default`,...i}){"use no memo";let a=K(Qo,{mode:t,children:e},`content`),o=K(Zo,{marker:n,mode:t,variant:r},`marker`),s=K(`div`,{"data-truncate-fill":!0},`fill`);return K(`div`,{"data-truncate-container":t,"data-truncate-variant":r,...i,children:K(`div`,{"data-truncate-grid":!0,children:t===`truncate`?[a,o]:[o,a,s]})})}function es({children:e,...t}){"use no memo";return K($o,{mode:`truncate`,...t,children:e})}function ts({children:e,...t}){"use no memo";return K($o,{mode:`fruncate`,...t,children:e})}function ns({children:e,contents:t,priority:n=`end`,split:r=`center`,minimumLength:i=12,className:a,style:o,...s}){"use no memo";let c=null,l=null;if(Array.isArray(t)){if(t.length!==2)return console.error(`MiddleTruncate: contents must be an array of two items`),null;c=K(es,{...s,children:t[0]}),l=K(ts,{...s,children:t[1]})}else{if(typeof e!=`string`)return console.error(`MiddleTruncate: children must be a string`),null;if(e.length===0)return K(`div`,{className:a,style:o});if(e.length<i)return K(n===`end`?ts:es,{...s,className:a,style:o,children:e});let t=null,u=null,d=null;if(typeof r==`string`)r===`center`?t=Go:r===`extension`?t=Ko:r===`leaf-path`&&(t=qo);else if(typeof r==`number`)t=Jo,u=r;else if(Array.isArray(r)){let[e,n]=r;d=n,e===`last`?t=Yo:e===`first`&&(t=Xo)}else typeof r==`function`&&(t=r);t??=Go;let[f,p]=t(e,{priority:n,variant:s.variant,splitIndex:typeof u==`number`?u:void 0,splitOffset:typeof d==`number`?d:void 0}),m=f.length>=p.length,h=n===`equal`&&!m,g=n===`equal`&&m,_={},v={};h&&(_.marker=``),g&&(v.marker=``),c=K(es,{...s,..._,children:f}),l=K(ts,{...s,...v,children:p})}return K(`div`,{"data-truncate-group-container":`middle`,className:a,style:o,children:[K(`div`,{"data-truncate-segment-priority":n===`start`||n===`equal`?`1`:`2`,children:c}),K(`div`,{"data-truncate-segment-priority":n===`end`||n===`equal`?`1`:`2`,children:l})]})}var rs={endIndex:-1,startIndex:-1};function is(e,t,n){return Math.min(Math.max(e,t),n)}function as(e,t){return e<0||t<e?rs:{endIndex:t,startIndex:e}}function os(e){return e.startIndex<0||e.endIndex<e.startIndex}function ss(e,t){return os(e)?0:(e.endIndex-e.startIndex+1)*t}function cs(e,t,n){if(t<=0)return-1;let r=t*n;return e<=0?0:e>=r?t:Math.floor(e/n)}function ls(e,t,n){return t<=0||e<=0?-1:e>=t*n?t-1:Math.ceil(e/n)-1}function us(e){let t=new Map;return e.forEach((e,n)=>{if(e.kind!==`directory`||!e.isExpanded)return;let r=e.ancestorPaths.length,i=t.get(r);if(i==null){t.set(r,[n]);return}i.push(n)}),t}function ds(e,t){let n=0,r=e.length-1,i=-1;for(;n<=r;){let a=Math.floor((n+r)/2),o=e[a];if(o==null)break;if(o<=t){i=a,n=a+1;continue}r=a-1}return i}function fs(e){let t=new Map,n=[];for(let r=0;r<e.length;r+=1){let i=e[r];if(i==null)continue;let a=i.kind===`directory`&&i.isExpanded?[...i.ancestorPaths,i.path]:i.ancestorPaths,o=0;for(;o<n.length&&o<a.length&&n[o]===a[o];)o+=1;for(let e=n.length-1;e>=o;--e){let i=n[e];i!=null&&t.set(i,r-1)}n.length=o;for(let e=o;e<a.length;e+=1){let t=a[e];t!=null&&n.push(t)}}let r=e.length-1;for(let e of n)t.set(e,r);return t}function ps(e,t,n){if(e.length===0||t<=0)return[];let r=fs(e),i=us(e),a=[];for(let r=0;r<e.length;r+=1){let o=i.get(r);if(o==null||o.length===0)break;let s=t+r*n,c=ds(o,Math.min(e.length-1,Math.floor(s/n))),l=null;for(;c>=0;){let t=o[c],n=t==null?null:e[t]??null;if(n!=null&&(r===0||n.ancestorPaths[r-1]===a[r-1]?.path)){l=n;break}--c}if(l==null)break;a.push(l)}return a.map((i,a)=>{let o=a*n,s=(r.get(i.path)??e.length-1)+1;if(s>=e.length)return{row:i,top:o};let c=s*n-t;return{row:i,top:Math.min(o,c-n)}}).filter(e=>e.top+n>0)}function ms(e,t){let n=t.totalRowCount??e.length,r=n*t.itemHeight,i=Math.max(0,t.viewportHeight),a=Math.max(0,Math.floor(t.overscan)),o=Math.max(0,r-i),s=is(t.scrollTop,0,o),c=t.stickyRows??ps(e,s,t.itemHeight),l=c.reduce((e,n)=>Math.max(e,n.top+t.itemHeight),0),u=Math.min(r,s+l),d=Math.max(0,i-l),f=Math.max(0,r-u),p=cs(s,n,t.itemHeight),m=cs(u,n,t.itemHeight),h=l<=0||p<0||p>=n?-1:p,g=h===-1?-1:Math.min(n-1,m-1),_=h===-1||g<h?0:g-h+1,v=d<=0||m>=n?rs:as(m,ls(u+d,n,t.itemHeight)),y=g+1,b=os(v)?rs:as(Math.max(y,v.startIndex-a),Math.min(n-1,v.endIndex+a)),x=ss(b,t.itemHeight);return{occlusion:{firstOccludedIndex:h,lastOccludedIndex:g,occludedCount:_},physical:{itemHeight:t.itemHeight,maxScrollTop:o,overscan:a,scrollTop:s,totalHeight:r,totalRowCount:n,viewportHeight:i},projected:{contentHeight:f,paneHeight:d,paneTop:u},sticky:{height:l,rows:c},visible:v,window:{endIndex:b.endIndex,height:x,offsetTop:os(b)?0:b.startIndex*t.itemHeight,startIndex:b.startIndex}}}var hs={added:`A`,deleted:`D`,ignored:null,modified:`M`,renamed:`R`,untracked:`U`},gs={added:`Git status: added`,deleted:`Git status: deleted`,ignored:`Git status: ignored`,modified:`Git status: modified`,renamed:`Git status: renamed`,untracked:`Git status: untracked`},_s=`Contains git status items`;function vs(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,topInset:i=0,viewportHeight:a}=e;if(n<0)return null;let o=Math.max(0,i),s=n*r,c=s+r;if(s<t+o){let e=Math.max(0,s-o);return e===t?null:e}if(c>t+a){let e=c-a;return e===t?null:e}return null}function ys(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,offset:i,topInset:a=0,totalHeight:o,viewportHeight:s}=e;if(i===`nearest`)return vs({currentScrollTop:t,focusedIndex:n,itemHeight:r,topInset:a,viewportHeight:s});if(n<0)return null;let c=Math.max(0,a),l=n*r,u=Math.max(0,s-c),d=i===`center`?c+Math.max(0,(u-r)/2):c,f=Math.max(0,o-s),p=Math.max(0,Math.min(l-d,f));return p===t?null:p}function bs(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,targetViewportOffset:i,totalHeight:a,viewportHeight:o}=e;if(n<0)return null;let s=Math.max(0,i),c=n*r,l=c+r,u=t+s,d=t+o;if(c>=u&&l<=d)return null;let f=Math.max(0,a-o),p=Math.max(0,Math.min(c-s,f));return p===t?null:p}function xs(e){if(e==null||!e.isConnected||e===document.body||e===document.documentElement)return!1;e.focus({preventScroll:!0});let t=e.getRootNode();return t instanceof ShadowRoot?t.activeElement===e:document.activeElement===e}function Ss(e){let t=e.getRootNode();if(t instanceof ShadowRoot){let e=t.activeElement;return e instanceof HTMLElement?e:null}let n=document.activeElement;return n instanceof HTMLElement&&e.contains(n)?n:null}function Cs(e,t){if(e==null)return t;let n=e.getBoundingClientRect().height;return n>0?n:e.clientHeight>0?e.clientHeight:t}function ws(e,t){return e!=null&&e>0?e:t}function Ts(e){let t=e.borderBoxSize,n=Array.isArray(t)?t[0]:t;return n!=null&&Number.isFinite(n.blockSize)&&n.blockSize>0?n.blockSize:e.contentRect.height>0?e.contentRect.height:null}function Es(e,t,n,r,i=0){let a=vs({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,topInset:i,viewportHeight:r});return a==null?!1:(e.scrollTop=a,!0)}function Ds(e,t,n,r,i,a,o=0){let s=ys({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,offset:a,topInset:o,totalHeight:i,viewportHeight:r});return s==null?!1:(e.scrollTop=s,!0)}function Os(e,t,n,r,i,a){let o=bs({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,targetViewportOffset:a,totalHeight:i,viewportHeight:r});return o==null?!1:(e.scrollTop=o,!0)}function ks(e,t,n,r){return n.end<n.start?null:e<n.start?-t:e>n.end?r:null}function As(e){let{renamingPath:t,previousRenamingPath:n,hasRenderedInput:r}=e;return t==null?`reset`:r?n===t?`ignore`:`focus-input`:`reveal-canonical`}function js({ariaLabel:e,isFlattened:t=!1,ref:n,value:r,onBlur:i,onInput:a}){return K(`input`,{ref:n,"data-item-rename-input":!0,...t?{"data-item-flattened-rename-input":!0}:{},"aria-label":e,value:r,onBlur:i,onInput:a,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation()})}function Ms(e){let{row:t,mode:n,targetPath:r,ariaLabel:i,domId:a,isParked:o,itemHeight:s,features:c,state:l,extraStyle:u}=e,d=n===`sticky`,f=t.ancestorPaths.at(-1)??``,p={};return l.isFocusRinged&&(p[`data-item-focused`]=!0),t.isSelected&&(p[`data-item-selected`]=!0),l.isContextHovered&&(p[`data-item-context-hover`]=`true`),l.isDragTarget&&(p[`data-item-drag-target`]=!0),l.isDragging&&(p[`data-item-dragging`]=!0),l.effectiveGitStatus!=null&&(p[`data-item-git-status`]=l.effectiveGitStatus),l.containsGitChange&&(p[`data-item-contains-git-change`]=`true`),{"aria-expanded":!d&&t.kind===`directory`?t.isExpanded:void 0,"aria-haspopup":c.contextMenuEnabled?`menu`:void 0,"aria-label":i,"aria-level":d?void 0:t.level+1,"aria-posinset":d?void 0:t.posInSet+1,"aria-selected":d?void 0:t.isSelected?`true`:`false`,"aria-setsize":d?void 0:t.setSize,"data-file-tree-sticky-path":d?r:void 0,"data-file-tree-sticky-row":d?`true`:void 0,"data-item-context-menu-button-visibility":c.actionLaneEnabled?c.contextMenuButtonVisibility:void 0,"data-item-context-menu-trigger-mode":c.contextMenuEnabled?c.contextMenuTriggerMode:void 0,"data-item-has-context-menu-action-lane":c.actionLaneEnabled?`true`:void 0,"data-item-has-git-lane":c.gitLaneActive?`true`:void 0,"data-item-parent-path":f.length>0?f:void 0,"data-item-parked":o?`true`:void 0,"data-item-path":r,"data-item-type":t.kind===`directory`?`folder`:`file`,"data-type":`item`,id:d?void 0:a,role:d?void 0:`treeitem`,style:{minHeight:`${s}px`,...u},tabIndex:!d&&t.isFocused?0:-1,...p}}function Ns(e){let{event:t,mode:n,isSearchOpen:r,isDirectory:i}=e,a=t.ctrlKey||t.metaKey,o=t.shiftKey||a,s=t.shiftKey?{additive:a,kind:`range`}:a?{kind:`toggle`}:{kind:`single`};return{closeSearch:r,revealCanonical:n===`sticky`,selection:s,toggleDirectory:!o&&i}}var Ps,Fs,Is,Ls,Rs=Object.is,zs=0,Bs=[],Vs=G,Hs=Vs.__b,Us=Vs.__r,Ws=Vs.diffed,Gs=Vs.__c,Ks=Vs.unmount,qs=Vs.__;function Js(e,t){Vs.__h&&Vs.__h(Fs,e,zs||t),zs=0;var n=Fs.__H||={__:[],__h:[]};return e>=n.__.length&&n.__.push({}),n.__[e]}function Ys(e){return zs=1,Xs(sc,e)}function Xs(e,t,n){var r=Js(Ps++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):sc(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);Rs(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=Fs,!Fs.__f)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=r.__c.__H.__.filter(function(e){return!!e.__c});if(i.every(function(e){return!e.__N}))return!a||a.call(this,e,t,n);var o=r.__c.props!==e;return i.forEach(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,Rs(t,e.__[0])||(o=!0)}}),a&&a.call(this,e,t,n)||o};Fs.__f=!0;var a=Fs.shouldComponentUpdate,o=Fs.componentWillUpdate;Fs.componentWillUpdate=function(e,t,n){if(4&this.__g){var r=a;a=void 0,i(e,t,n),a=r}o&&o.call(this,e,t,n)},Fs.shouldComponentUpdate=i}return r.__N||r.__}function Zs(e,t){var n=Js(Ps++,3);!Vs.__s&&oc(n.__H,t)&&(n.__=e,n.u=t,Fs.__H.__h.push(n))}function Qs(e,t){var n=Js(Ps++,4);!Vs.__s&&oc(n.__H,t)&&(n.__=e,n.u=t,Fs.__h.push(n))}function q(e){return zs=5,$s(function(){return{current:e}},[])}function $s(e,t){var n=Js(Ps++,7);return oc(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function ec(e,t){return zs=8,$s(function(){return e},t)}function tc(){for(var e;e=Bs.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(ic),e.__H.__h.forEach(ac),e.__H.__h=[]}catch(t){e.__H.__h=[],Vs.__e(t,e.__v)}}Vs.__b=function(e){Fs=null,Hs&&Hs(e)},Vs.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),qs&&qs(e,t)},Vs.__r=function(e){Us&&Us(e),Ps=0;var t=(Fs=e.__c).__H;t&&(Is===Fs?(t.__h=[],Fs.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(ic),t.__h.forEach(ac),t.__h=[],Ps=0)),Is=Fs},Vs.diffed=function(e){Ws&&Ws(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Bs.push(t)!==1&&Ls===Vs.requestAnimationFrame||((Ls=Vs.requestAnimationFrame)||rc)(tc)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),Is=Fs=null},Vs.__c=function(e,t){t.some(function(e){try{e.__h.forEach(ic),e.__h=e.__h.filter(function(e){return!e.__||ac(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],Vs.__e(n,e.__v)}}),Gs&&Gs(e,t)},Vs.unmount=function(e){Ks&&Ks(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{ic(e)}catch(e){t=e}}),n.__H=void 0,t&&Vs.__e(t,n.__v))};var nc=typeof requestAnimationFrame==`function`;function rc(e){var t,n=function(){clearTimeout(r),nc&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);nc&&(t=requestAnimationFrame(n))}function ic(e){var t=Fs,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),Fs=t}function ac(e){var t=Fs;e.__c=e.__(),Fs=t}function oc(e,t){return!e||e.length!==t.length||t.some(function(t,n){return!Rs(t,e[n])})}function sc(e,t){return typeof t==`function`?t(e):t}function cc(e,t=null,n=null){"use no memo";let r=e.flattenedSegments;return r==null||r.length===0?t??e.name:K(`span`,{"data-item-flattened-subitems":!0,children:r.map((e,i)=>{let a=i===r.length-1;return K(_o,{children:[K(`span`,{"data-item-flattened-subitem":e.path,"data-item-flattened-subitem-drag-target":n===e.path?`true`:void 0,children:a&&t!=null?t:K(es,{children:e.name})}),i<r.length-1?` / `:``]},e.path)})})}function lc(e){return e.isFlattened?e.flattenedSegments?.findLast(e=>e.isTerminal)?.path??e.path:e.path}function uc(e){let t=e.flattenedSegments;return t==null||t.length===0?e.name:t.map(e=>e.name).join(` / `)}function dc(e,t,n,r){return e.map((e,i)=>{let a=i*n,o=e.subtreeEndIndex+1;if(o>=r)return{row:e.row,top:a};let s=o*n-t;return{row:e.row,top:Math.min(a,s-n)}}).filter(e=>e.top+n>0)}function fc({controller:e,itemHeight:t,overscan:n,scrollTop:r,stickyFolders:i,viewportHeight:a}){let o=e.getVisibleCount(),s=i&&o>0?e.getStickyRowCandidates(r,t):[],c=s==null&&i&&o>0?e.getVisibleRows(0,o-1):[],l=ms(c,{itemHeight:t,overscan:n,scrollTop:r,stickyRows:s==null?void 0:dc(s,r,t,o),totalRowCount:o,viewportHeight:a}),u=i&&r<=0&&o>0?e.getStickyRowCandidates(1,t):[],d=u!=null&&r<=0?dc(u,1,t,o):i&&r<=0&&c.length>0?ps(c,1,t):l.sticky.rows;return{overlayHeight:d.reduce((e,n)=>Math.max(e,n.top+t),0),overlayRows:d,snapshot:l,visibleRows:c}}var pc=400,mc=10,hc=40,gc=18;function _c(e,t,n){let r=e,i=document.elementFromPoint?.bind(document)??null,a=r.elementFromPoint?.(t,n)??i?.(t,n)??null;return e instanceof ShadowRoot&&(a==null||!e.contains(a))?vc(e,t,n):a instanceof HTMLElement?a:null}function vc(e,t,n){let r=Array.from(e.querySelectorAll(`[data-type="item"], [data-item-flattened-subitem]`));for(let e=r.length-1;e>=0;e--){let i=r[e],a=i.getBoundingClientRect();if(t>=a.left&&t<=a.right&&n>=a.top&&n<=a.bottom)return i}return null}function yc(e){let t=e?.closest?.(`[data-type="item"]`);if(!(t instanceof HTMLElement))return null;let n=t.dataset.itemPath??null;if(n==null)return null;let r=e?.closest?.(`[data-item-flattened-subitem]`),i=r instanceof HTMLElement?r.getAttribute(`data-item-flattened-subitem`)??null:null;if(i!=null&&i.endsWith(`/`))return{directoryPath:i,flattenedSegmentPath:i,hoveredPath:n,kind:`directory`};if(t.dataset.itemType===`folder`)return{directoryPath:n,flattenedSegmentPath:null,hoveredPath:n,kind:`directory`};let a=t.dataset.itemParentPath??null;return a==null||a.length===0?{directoryPath:null,flattenedSegmentPath:null,hoveredPath:n,kind:`root`}:{directoryPath:a,flattenedSegmentPath:null,hoveredPath:n,kind:`directory`}}function bc(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 xc(){return navigator.vendor!==`Apple Computer, Inc.`}function Sc(e,t){let n=e-t.top;if(n<hc)return-Math.ceil((hc-Math.max(0,n))/hc*gc);let r=t.bottom-e;return r<hc?Math.ceil((hc-Math.max(0,r))/hc*gc):0}function Cc(e,t){if(e!=null){let t=hs[e];return t==null?null:{text:t,title:gs[e]}}return t?{icon:{name:`file-tree-icon-dot`,width:6,height:6},title:_s}:null}function wc(e,t,n){if(t==null||t.size===0)return null;let r=[];for(let i=e.length-1;i>=0;--i){let a=e[i],o=n.get(a);if(o!=null){for(let e of r)n.set(e,o);return o?`ignored`:null}if(t.has(a)){n.set(a,!0);for(let e of r)n.set(e,!0);return`ignored`}r.push(a)}for(let e of r)n.set(e,!1);return null}function Tc(e){return e!=null&&`toggle`in e}function Ec(e){return e.code===`Space`||e.key===` `||e.key===`Spacebar`}function Dc(e){return e.key.length===1&&/^[\p{L}\p{N}]$/u.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey}function Oc(e){return e==null?``:`[data-item-section="spacing-item"][data-ancestor-path="${e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}"] { opacity: 1; }`}function kc(e){return e.shiftKey&&e.key===`F10`||e.key===`ContextMenu`}function Ac(e,t){return t&&kc(e)||(e.ctrlKey||e.metaKey)&&Ec(e)?!0:e.key===`ArrowDown`||e.key===`ArrowLeft`||e.key===`ArrowRight`||e.key===`ArrowUp`}var jc=new Set([`ArrowDown`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`]);function Mc(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&(t.dataset.fileTreeContextMenuRoot===`true`||t.dataset.type===`context-menu-anchor`||t.dataset.type===`context-menu-trigger`||t.getAttribute(`slot`)===`context-menu`))return!0;return!1}function Nc(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 Pc(e,t){return{bottom:t,height:0,left:e,right:e,top:t,width:0,x:e,y:t}}function Fc(e,t){if(e==null)return t.offsetTop;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.top-r.top}function Ic(e,t,n){if(n==null){e.delete(t);return}e.set(t,n)}function Lc(e,t,n){if(e==null)return null;let r=t.get(e)??null;if(r!=null)return r;let i=n.get(e)??null;return i?.dataset.itemParked===`true`?null:i}function Rc(e){if(e==null)return[];let t=[];for(let n of e.querySelectorAll(`button[data-file-tree-sticky-row="true"]`)){if(!(n instanceof HTMLElement))continue;let e=n.dataset.fileTreeStickyPath;e!=null&&t.push(e)}return t}function zc(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 Bc(e,t,n,r,i,a,o){let s=Math.max(0,a-i),c=t?.getBoundingClientRect()??null,l=c==null||n==null?null:n.getBoundingClientRect().top-c.top,u=zc(e,r),d=c==null||u==null?null:u.getBoundingClientRect().top-c.top;return Math.max(0,Math.min(d??Math.max(l??0,s),Math.max(0,o-i)))}function Vc(e,t){return{kind:e.kind,name:uc(e),path:t}}function Hc(e){return e==null?void 0:`${e}__tree`}function Uc(e,t,n){if(e!=null)return`${e}__focused-item-${encodeURIComponent(t)}${n?`__parked`:``}`}function Wc(e){return e===`file-tree-icon-chevron`||e===`file-tree-icon-dot`||e===`file-tree-icon-file`||e===`file-tree-icon-lock`}function Gc(e,t){if(e==null)return null;if(`text`in e)return K(`span`,{title:e.title,children:e.text});let n=typeof e.icon==`string`?Wc(e.icon)?t(e.icon):{name:e.icon}:Wc(e.icon.name)?(()=>{let n=t(e.icon.name),{name:r,...i}=e.icon;return{...n,...i}})():e.icon;return K(`span`,{title:e.title,children:K(Wo,{...n})})}function Kc(e){e!=null&&xs(e.querySelector([`button:not([disabled])`,`[href]`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`, `))??e)}function qc(e,t,{actionLaneEnabled:n=!1,customDecoration:r=null,decorationLaneEnabled:i=!1,dragTargetFlattenedSegmentPath:a=null,gitDecoration:o=null,gitLaneActive:s=!1,renameInput:c=null,showDecorativeActionAffordance:l=!1}={}){let u=lc(e);return K(_o,{children:[e.depth>0?K(`div`,{"data-item-section":`spacing`,children:Array.from({length:e.depth}).map((t,n)=>K(`div`,{"data-item-section":`spacing-item`,"data-ancestor-path":e.ancestorPaths[n]},n))}):null,K(`div`,{"data-item-section":`icon`,children:e.kind===`directory`?K(Wo,{...t(`file-tree-icon-chevron`)}):K(Wo,{...t(`file-tree-icon-file`,u)})}),K(`div`,{"data-item-section":`content`,children:e.isFlattened?cc(e,c,a):c??K(ns,{minimumLength:5,split:`extension`,children:e.name})}),i?K(`div`,{"data-item-section":`decoration`,children:r==null?null:Gc(r,t)}):null,s?K(`div`,{"data-item-section":`git`,children:Gc(o,t)}):null,n?K(`div`,{"data-item-section":`action`,children:l?K(`span`,{"aria-hidden":`true`,"data-item-action-affordance":`decorative`,children:K(Wo,{...t(`file-tree-icon-ellipsis`)})}):null}):null]})}function Jc(e,t,n,r={}){let{controller:i,renameView:a,visualFocusPath:o,contextHoverPath:s,draggedPathSet:c,dragTarget:l,dragAndDropEnabled:u,shouldSuppressContextMenu:d,handleRowDragStart:f,handleRowDragEnd:p,handleRowTouchStart:m,instanceId:h,itemHeight:g,gitStatusByPath:_,ignoredGitDirectories:v,ignoredInheritanceCache:y,directoriesWithGitChanges:b,gitLaneActive:x,contextMenuEnabled:S,contextMenuTriggerMode:C,contextMenuButtonTriggerEnabled:w,contextMenuButtonVisibility:T,contextMenuRightClickEnabled:E,registerRenameInput:D,registerButton:O,resolveIcon:k,renderDecorationForRow:A,openContextMenuForRow:ee,onRowClick:j,onKeyDown:M}=e,N=lc(t),{isParked:P=!1,mode:te=`flow`,style:ne}=r,re=te===`sticky`,ie=_?.get(N)??null??wc(t.ancestorPaths,v,y),ae=t.kind===`directory`&&(b?.has(N)??!1),oe=A(t,N),se=Cc(ie,ae),ce=S&&w,le=oe!=null||x||ce,ue=ce&&T===`always`,de=a.getPath()===N,fe=de?a.getValue():``,pe=re||!de?null:K(js,{ref:D,ariaLabel:`Rename ${uc(t)}`,isFlattened:t.isFlattened,value:fe,onBlur:()=>{a.commit()},onInput:e=>{a.setValue(e.currentTarget.value)}}),me=qc(t,k,{actionLaneEnabled:ce,customDecoration:oe,decorationLaneEnabled:le,dragTargetFlattenedSegmentPath:l?.flattenedSegmentPath??null,gitDecoration:se,gitLaneActive:x,renameInput:pe,showDecorativeActionAffordance:ue}),F={...Ms({ariaLabel:uc(t),domId:t.isFocused?Uc(h,N,P):void 0,extraStyle:ne,features:{actionLaneEnabled:ce,contextMenuButtonVisibility:ce?T:null,contextMenuEnabled:S,contextMenuTriggerMode:S?C:null,gitLaneActive:x},isParked:P,itemHeight:g,mode:te,row:t,state:{containsGitChange:ae,effectiveGitStatus:ie,isContextHovered:s===N,isDragTarget:l?.kind===`directory`&&l.directoryPath===N,isDragging:c?.has(N)===!0,isFocusRinged:t.isFocused&&o===N},targetPath:N}),key:n,onContextMenu:S||u?e=>{if(d()){e.preventDefault();return}S&&(e.preventDefault(),E&&(i.focusMountedPathFromInput(N),ee(t,N,{anchorRect:Pc(e.clientX,e.clientY),source:`right-click`})))}:void 0,onFocus:re?void 0:()=>{i.focusMountedPathFromInput(N)},onKeyDown:re?void 0:M,ref:e=>{O(N,e)}};return!re&&de?K(`div`,{...F,children:me}):K(`button`,{...F,type:`button`,draggable:u&&!P,onDragEnd:u&&!P?p:void 0,onDragStart:u&&!P?e=>{f(e,t,N)}:void 0,onMouseDown:e=>{if(re){e.preventDefault();return}i.isSearchOpen()&&e.preventDefault()},onTouchStart:u&&!P?e=>{m(e,t,N)}:void 0,onClick:e=>{j(e,t,N,te)},children:me})}function Yc(e,t,n){return t.end<t.start?[]:e.controller.getVisibleRows(t.start,t.end).filter(e=>!n.has(lc(e))).map((n,r)=>Jc(e,n,t.start+r))}function Xc({composition:e,controller:t,gitStatusByPath:n,ignoredGitDirectories:r,directoriesWithGitChanges:i,icons:a,instanceId:o,itemHeight:s=Xi,overscan:c=10,renamingEnabled:l=!1,renderRowDecoration:u,searchBlurBehavior:d=`close`,searchEnabled:f=!1,searchFakeFocus:p=!1,slotHost:m,stickyFolders:h=!1,initialViewportHeight:g=420}){"use no memo";let _=q(null),v=q(null),y=q(!1),b=q(null),x=q(null),S=q(null),C=q(null),w=q(null),T=q(new Map),E=q(new Map),D=q(()=>{}),O=q(null),k=q(0),A=q(!1),ee=q(null);ee.current!==t&&(A.current=!1,ee.current=t);let j=q(!1),M=q(null),N=q(null),P=q(!1),te=q(null),ne=q(null),re=q(null),ie=q(null),ae=q(null),oe=q(null),se=q(null),ce=q(null),le=q(!1),ue=q(null),de=q(null),fe=q(null),pe=q(null),me=$s(()=>new Map,[]),[,F]=Ys(0),[he,I]=Ys(null),[ge,_e]=Ys(null),[ve,ye]=Ys(null),[be,xe]=Ys(null),[Se,Ce]=Ys(0),[L,Te]=Ys(null),Ee=q(L);Ee.current=L;let De=q(null),Oe=q(null),ke=q(null),Ae=q(null),je=q(null),Me=q(!1),Ne=()=>{Oe.current=null,ke.current=null,Ae.current=null},Pe=(e,t)=>{Oe.current=e,ke.current=null,Ae.current=t==null?null:{path:e,scrollTop:t}},Fe=(e,t)=>{Oe.current=null,ke.current={path:e,viewportOffset:t},Ae.current=null},Ie=q(d===`retain`&&t.isSearchOpen()),[Le,Re]=Ys(p);Zs(()=>{p||Re(!1)},[p]);let ze=q(!1),Be=ec(()=>{ze.current=!0,Re(e=>e&&!1)},[]),[Ve,He]=Ys(()=>fc({controller:t,itemHeight:s,overscan:c,scrollTop:0,stickyFolders:h,viewportHeight:g})),[Ue,We]=Ys(!1);Zs(()=>{We(!0)},[]);let Ge=e?.contextMenu?.enabled===!0||e?.contextMenu?.render!=null||e?.contextMenu?.onOpen!=null||e?.contextMenu?.onClose!=null,Ke=e?.contextMenu?.triggerMode??(Ge?`right-click`:`both`),qe=Ke===`both`||Ke===`button`,Je=e?.contextMenu?.buttonVisibility??`when-needed`,Ye=Ke===`both`||Ke===`right-click`;Qs(()=>{let e=S.current;if(e==null)return;let t=e=>{if(!(e instanceof CustomEvent))return;let t=e.detail?.path??null;je.current=t,_e(t),xe(t==null?null:`pointer`)},n=e=>{e instanceof CustomEvent&&(Me.current=e.detail?.disabled===!0)};return e.addEventListener(`file-tree-debug-set-context-menu-trigger`,t),e.addEventListener(`file-tree-debug-set-scroll-suppression`,n),()=>{e.removeEventListener(`file-tree-debug-set-context-menu-trigger`,t),e.removeEventListener(`file-tree-debug-set-scroll-suppression`,n)}},[]);let Xe=ec((e,t)=>{Ic(T.current,e,t)},[]),Ze=ec((e,t)=>{Ic(E.current,e,t)},[]),Qe=ec(e=>{x.current=e},[]),$e=ec(e=>Lc(e,E.current,T.current),[]),et=n!=null||r!=null||i!=null,{resolveIcon:tt}=$s(()=>we(a),[a]),nt=t[Va](),rt=nt.getPath(),it=rt!=null,at=t.isSearchOpen(),ot=t.getSearchValue(),R=t.getFocusedPath(),z=t.getFocusedIndex(),st=t.getScrollRequest(),ct=t.isDragAndDropEnabled(),lt=t.getDragSession(),ut=$s(()=>lt==null?null:new Set(lt.draggedPaths),[lt]),dt=lt?.target??null,ft=lt?.primaryPath??null,pt=Hc(o),{overlayHeight:mt,overlayRows:vt,snapshot:yt,visibleRows:bt}=Ve,xt=yt.physical.viewportHeight,St=$s(()=>({end:yt.window.endIndex,start:yt.window.startIndex}),[yt.window.endIndex,yt.window.startIndex]),Ct=vt,wt=yt.sticky.rows,Tt=yt.physical.totalHeight,Et=yt.sticky.height,Dt=$s(()=>new Set(wt.map(e=>lc(e.row))),[wt]),Ot=z>=0&&z>=St.start&&z<=St.end,kt=ec((e,t)=>u?.({item:Vc(e,t),row:e})??null,[u]),At=ec(e=>xs(e==null?null:T.current.get(e)??null)?!0:xs(S.current),[]),jt=ec(e=>{At(t.focusNearestPath(e))},[t,At]),Mt=q(jt);Mt.current=jt;let Nt=q(!0),Pt=q(()=>{}),Ft=ec((t=!0)=>{let n=Ee.current;n!=null&&(Nt.current=Nt.current&&t,Te(null),e?.contextMenu?.onClose?.(),Nt.current&&jt(n.path))},[e?.contextMenu,jt]);Pt.current=Ft;let It=ec(e=>{let t=e==null?null:Fc(S.current,e);ye(e=>e===t?e:t)},[]),Lt=ec((e,n,r)=>{let i=t.getItem(n);if(i==null)return;let a=$e(n);if(a?.dataset.fileTreeStickyRow===`true`){let e=C.current;Pe(n,e?.scrollTop??null),j.current=!0,I(e=>e===n?e:n)}i.focus(),It(a),Nt.current=!0,Te({anchorRect:r?.anchorRect??null,item:Vc(e,n),path:n,source:r?.source??`keyboard`})},[t,$e,It]),Rt=ec(e=>{if(l){if(t.isSearchOpen()){let e=C.current,t=Cs(e,xt);te.current=z<0||e==null?null:Math.max(0,Math.min(z*s-e.scrollTop,Math.max(0,t-s))),P.current=!0}t.startRenaming(e)!==!1&&(xe(`focus`),F(e=>e+1))}},[t,z,s,l,xt]),zt=ec((e,{restoreTreeFocus:n=!0,targetOffset:r=`live-overlay`}={})=>{let i=C.current;if(i==null)return!1;t.focusPath(e);let a=t.getFocusedIndex();if(a<0)return!1;let o=t.getVisibleRows(a,a)[0]??null;if(o==null)return!1;let l=Cs(i,xt),u=t.getVisibleCount()*s,d=r===`sticky-parents`?o.ancestorPaths.length*s:fc({controller:t,itemHeight:s,overscan:c,scrollTop:i.scrollTop,stickyFolders:h,viewportHeight:l}).snapshot.sticky.height;return j.current=!0,Os(i,a,s,l,u,d),D.current(),De.current=n?e:null,!0},[t,s,c,xt,h]),B=()=>y.current===!0||pe.current!=null||le.current===!0,Bt=e=>typeof window.requestAnimationFrame==`function`?window.requestAnimationFrame(()=>{e()}):window.setTimeout(e,16),Vt=e=>{if(e!=null){if(typeof window.cancelAnimationFrame==`function`){window.cancelAnimationFrame(e);return}window.clearTimeout(e)}},Ht=()=>{ie.current!=null&&(clearTimeout(ie.current),ie.current=null),re.current=null},Ut=()=>{oe.current?.remove(),oe.current=null},Wt=()=>{Vt(ne.current),ne.current=null,ae.current=null},Gt=e=>{let t=S.current?.getRootNode();if(t instanceof ShadowRoot){t.append(e);return}document.body.append(e)},Kt=()=>{ce.current?.(),ce.current=null,pe.current!=null&&(clearTimeout(pe.current),pe.current=null),le.current=!1,ue.current=null,fe.current=null,de.current!=null&&(de.current.setAttribute(`draggable`,`true`),de.current.style.removeProperty(`touch-action`),de.current=null),Ut(),Ht(),Wt(),se.current=null},V=(e,n)=>{let r=S.current?.getRootNode(),i=yc(_c(r instanceof ShadowRoot?r:document,e,n));return t.setDragTarget(i),t.getDragSession()?.target??null},qt=e=>{let n=t.getDragAndDropConfig()?.openOnDropDelay??800;if(e==null||e.kind!==`directory`||e.directoryPath==null||n<=0){Ht();return}let r=t.getItem(e.directoryPath),i=Tc(r)?r:null;if(i==null||i.isExpanded()){Ht();return}let a=`${e.directoryPath}::${e.flattenedSegmentPath??``}`;re.current!==a&&(Ht(),re.current=a,ie.current=setTimeout(()=>{let n=t.getDragSession()?.target;n?.kind!==`directory`||n.directoryPath!==e.directoryPath||n.flattenedSegmentPath!==e.flattenedSegmentPath||i.expand()},n))},Jt=()=>{ne.current=null;let e=ae.current,n=C.current;if(e==null||n==null||t.getDragSession()==null)return;let r=n.getBoundingClientRect(),i=Sc(e.clientY,r);if(i===0)return;let a=Math.max(0,n.scrollHeight-n.clientHeight),o=Math.max(0,Math.min(a,n.scrollTop+i));o!==n.scrollTop&&(n.scrollTop=o,D.current()),qt(V(e.clientX,e.clientY)),ne.current=Bt(Jt)},Yt=(e,t)=>{ae.current={clientX:e,clientY:t},ne.current??=Bt(Jt)},Xt=(e,n,r)=>{let i=e.currentTarget;if(i!=null){if(Kt(),Ut(),Ht(),Wt(),t.startDrag(r)===!1){e.preventDefault();return}if(se.current=n,e.dataTransfer!=null&&(e.dataTransfer.effectAllowed=`move`,e.dataTransfer.dropEffect=`move`,e.dataTransfer.setData(`text/plain`,r),xc())){let t=bc(i),n=i.getBoundingClientRect();Object.assign(t.style,{height:`${n.height}px`,opacity:`0.85`,transform:`translate3d(-9999px, 0px, 0)`,width:`${n.width}px`}),Gt(t),oe.current=t,e.dataTransfer.setDragImage(t,Math.max(0,e.clientX-n.left),Math.max(0,e.clientY-n.top))}}},Zt=()=>{Ut(),Ht(),Wt(),se.current=null,t.cancelDrag()},Qt=(e,n,r)=>{if(pe.current!=null||le.current)return;let i=e.touches[0],a=e.currentTarget;if(i==null||a==null)return;fe.current={clientX:i.clientX,clientY:i.clientY},de.current=a,a.setAttribute(`draggable`,`false`);let o=(e={})=>{let t=e.restoreNativeDraggable??!le.current;pe.current!=null&&(clearTimeout(pe.current),pe.current=null),document.removeEventListener(`touchmove`,s),document.removeEventListener(`touchend`,c),document.removeEventListener(`touchcancel`,c),ce.current===o&&(ce.current=null),t&&(a.setAttribute(`draggable`,`true`),de.current===a&&(de.current=null),fe.current=null)},s=e=>{let t=e.touches[0],n=fe.current;if(t==null||n==null)return;let r=t.clientX-n.clientX,i=t.clientY-n.clientY;r*r+i*i<=mc*mc||o()},c=()=>{o()};document.addEventListener(`touchmove`,s,{passive:!0}),document.addEventListener(`touchend`,c),document.addEventListener(`touchcancel`,c),ce.current=o,pe.current=setTimeout(()=>{if(o({restoreNativeDraggable:!1}),t.startDrag(r)===!1){a.setAttribute(`draggable`,`true`),de.current===a&&(de.current=null),fe.current=null;return}le.current=!0,de.current=a,a.setAttribute(`draggable`,`false`),a.style.setProperty(`touch-action`,`none`),se.current=n;let e=a.getBoundingClientRect(),s=bc(a);Object.assign(s.style,{height:`${e.height}px`,opacity:`0.85`,transform:`translate3d(${e.left}px, ${e.top}px, 0)`,width:`${e.width}px`}),Gt(s),oe.current=s,ue.current={x:i.clientX-e.left,y:i.clientY-e.top};let c=e=>{let t=e.touches[0];if(t==null)return;e.preventDefault();let n=ue.current;n!=null&&oe.current!=null&&(oe.current.style.transform=`translate3d(${t.clientX-n.x}px, ${t.clientY-n.y}px, 0)`),qt(V(t.clientX,t.clientY)),Yt(t.clientX,t.clientY)},l=e=>{let n=e.changedTouches[0];n!=null&&V(n.clientX,n.clientY),t.completeDrag(),Kt()},u=()=>{t.cancelDrag(),Kt()};ce.current=()=>{document.removeEventListener(`touchmove`,c),document.removeEventListener(`touchend`,l),document.removeEventListener(`touchcancel`,u)},document.addEventListener(`touchmove`,c,{passive:!1}),document.addEventListener(`touchend`,l),document.addEventListener(`touchcancel`,u)},pc)},$t=e=>{if(L!=null){if(e.key===`Escape`){Ft(),e.preventDefault(),e.stopPropagation();return}jc.has(e.key)&&(e.preventDefault(),e.stopPropagation());return}if(nt.isActive()){if(e.key===`Escape`)nt.cancel();else if(e.key===`Enter`)nt.commit();else return;xe(`focus`),F(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(l&&e.key===`F2`){Rt(R??void 0),e.preventDefault(),e.stopPropagation();return}if(at){if(e.key===`Escape`)P.current=!1,te.current=null,t.closeSearch();else if(e.key===`Enter`){let e=t.getFocusedPath();e!=null&&t.selectOnlyPath(e);let n=C.current,r=Cs(n,xt);te.current=z<0||n==null?null:Math.max(0,Math.min(z*s-n.scrollTop,Math.max(0,r-s))),P.current=!0,t.closeSearch()}else if(e.key===`ArrowDown`)t.focusNextSearchMatch();else if(e.key===`ArrowUp`)t.focusPreviousSearchMatch();else return;xe(`focus`),F(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(f&&Dc(e)){t.openSearch(e.key),F(e=>e+1),e.preventDefault(),e.stopPropagation();return}let n=Ge&&kc(e),r=Ac(e,Ge),i=r&&S.current!=null?Ss(S.current):null,a=r?new Set(Rc(S.current)):new Set,o=i?.dataset.fileTreeStickyPath??null,c=i?.dataset.fileTreeStickyRow===`true`&&o!=null;if(c&&o!==R&&a.has(o)){let e=C.current;Pe(o,e?.scrollTop??null),t.focusPath(o)}let u=t.getFocusedPath(),d=t.getFocusedIndex(),p=t.getFocusedItem();if(p==null)return;let m=Tc(p)?p:null,h=u!=null&&(Dt.has(u)||c&&o===u&&a.has(u)),g=e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`ArrowRight`&&m!=null&&m.isExpanded(),_=e.key===`ArrowLeft`&&h&&m!=null&&m.isExpanded(),v=C.current,y=!0;if(e.shiftKey&&e.key===`ArrowDown`)t.extendSelectionFromFocused(1);else if(e.shiftKey&&e.key===`ArrowUp`)t.extendSelectionFromFocused(-1);else if(n&&u!=null&&d>=0){let e=t.getVisibleRows(d,d)[0]??null,n=Lc(u,E.current,T.current);e==null||n==null?y=!1:Lt(e,u)}else if((e.ctrlKey||e.metaKey)&&Ec(e))t.toggleFocusedSelection();else if((e.ctrlKey||e.metaKey)&&e.key.toLowerCase()===`a`)t.selectAllVisiblePaths();else switch(e.key){case`ArrowDown`:t.focusNextItem();break;case`ArrowUp`:t.focusPreviousItem();break;case`ArrowRight`:m==null||m.isExpanded()?t.focusNextItem():m.expand();break;case`ArrowLeft`:m!=null&&m.isExpanded()?m.collapse():t.focusParentItem();break;case`Home`:t.focusFirstItem();break;case`End`:t.focusLastItem();break;default:y=!1}if(!y)return;xe(`focus`);let b=t.getFocusedPath(),x=b!=null&&(Dt.has(b)||a.has(b)),w=g&&b!==u,D=n&&c&&o===u&&b===u;if((h||D)&&b!=null&&(w&&x||D))Pe(b,v?.scrollTop??null),j.current=!0,I(e=>e===b?e:b);else{let t=e.key===`ArrowUp`&&h&&b!==u;b!=null&&(t||_&&b===u)?(Fe(b,Bc(S.current,v,i,u,s,Et,xt)),j.current=!0,I(e=>e===b?e:b)):Ne()}F(e=>e+1),e.preventDefault(),e.stopPropagation()};Qs(()=>{if(!(!f||!at)){if(Ie.current){Ie.current=!1;return}xs(w.current)}},[at,f]),Qs(()=>{let e=x.current;switch(As({hasRenderedInput:e!=null,previousRenamingPath:N.current,renamingPath:rt})){case`reset`:N.current=null;return;case`reveal-canonical`:rt!=null&&zt(rt,{restoreTreeFocus:!1,targetOffset:`live-overlay`});return;case`ignore`:return;case`focus-input`:e!=null&&(De.current=null,N.current=rt,xs(e),e.select());return}},[St.end,St.start,rt,zt,Dt]),Qs(()=>{let e=S.current;if(e==null)return;let t=null,n=()=>{t!=null&&(clearTimeout(t),t=null)},r=()=>{let t=Ss(e)?.dataset.itemPath??null;I(e=>e===t?e:t)},i=()=>{n(),j.current=!0,r()},a=i=>{let a=i.relatedTarget;if(a==null){n(),t=setTimeout(()=>{if(t=null,Ss(e)!=null){r();return}j.current=!1,I(null)},0);return}if(!(a instanceof Node)||!e.contains(a)){n(),j.current=!1,I(null);return}let o=a instanceof HTMLElement?a.dataset.itemPath??null:null;I(e=>e===o?e:o)};return e.addEventListener(`focusin`,i),e.addEventListener(`focusout`,a),()=>{n(),e.removeEventListener(`focusin`,i),e.removeEventListener(`focusout`,a)}},[]),Qs(()=>{let e=S.current;e!=null&&(yt.physical.scrollTop<=0?e.dataset.scrollAtTop=`true`:delete e.dataset.scrollAtTop)},[yt.physical.scrollTop]),Qs(()=>{let e=null,n=C.current,r=b.current,i=S.current;if(n==null)return;O.current=Cs(n,g);let a=()=>{let e=t.getVisibleCount(),r=ws(O.current,g),i=Math.max(0,e*s-r);n.scrollTop>i&&(n.scrollTop=i),He(fc({controller:t,itemHeight:s,overscan:c,scrollTop:Math.min(n.scrollTop,i),stickyFolders:h,viewportHeight:r}))};if(!A.current){A.current=!0;let e=t.getFocusedIndex();if(e>=0){let r=ws(O.current,g),i=t.getVisibleRows(e,e)[0]??null;Es(n,e,s,r,h&&i!=null?Math.max(0,Math.min(i.ancestorPaths.length*s,Math.max(0,r-s))):0)}}D.current=a;let o=!1,l=t.subscribe(()=>{o?F(e=>e+1):o=!0,a()}),u=()=>{Me.current!==!0&&(r!=null&&(r.dataset.isScrolling??=``),i!=null&&(i.dataset.isScrolling??=``),y.current=!0,e!=null&&clearTimeout(e),e=setTimeout(()=>{r!=null&&delete r.dataset.isScrolling,i!=null&&delete i.dataset.isScrolling,y.current=!1,Ce(e=>e+1),e=null},50))},d=null,f=()=>{i!=null&&delete i.dataset.overlayReveal,d!=null&&(clearTimeout(d),d=null)},p=()=>{i==null||Me.current===!0||n.scrollTop>0||(i.dataset.overlayReveal=`true`,d!=null&&clearTimeout(d),d=setTimeout(()=>{f()},200))},m=()=>{if(a(),n.scrollTop>0&&f(),Ee.current!=null&&y.current&&Pt.current(),Me.current===!0){y.current=!1;return}_e(e=>e==null?e:null),u()},_=()=>{u(),p()},v=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`PageUp`,`PageDown`,`Home`,`End`,` `,`Spacebar`]),x=e=>{v.has(e.key)&&_()};n.addEventListener(`scroll`,m,{passive:!0}),n.addEventListener(`wheel`,_,{passive:!0}),n.addEventListener(`touchmove`,_,{passive:!0}),n.addEventListener(`keydown`,x);let w=typeof ResizeObserver<`u`?new ResizeObserver(e=>{O.current=(e[0]==null?null:Ts(e[0]))??Cs(n,g),a()}):null;return w?.observe(n),()=>{D.current=()=>{},l(),n.removeEventListener(`scroll`,m),n.removeEventListener(`wheel`,_),n.removeEventListener(`touchmove`,_),n.removeEventListener(`keydown`,x),e!=null&&clearTimeout(e),d!=null&&clearTimeout(d),r!=null&&delete r.dataset.isScrolling,i!=null&&(delete i.dataset.isScrolling,delete i.dataset.overlayReveal),y.current=!1,O.current=null,w?.disconnect()}},[t,g,s,c,h]),Qs(()=>{Ge||L==null||Ft(!1)},[Ft,Ge,L]);let en=$s(()=>L==null?null:`${L.path}::${L.source}`,[L]);Qs(()=>{if(en==null){m?.clearSlotContent(gt);return}let t=Ee.current;if(t==null)return;let n=v.current??_.current;if(n==null)return;let r={anchorElement:n,anchorRect:t.anchorRect??Nc(n.getBoundingClientRect()),close:e=>{Pt.current(e?.restoreFocus??!0)},restoreFocus:()=>{Nt.current&&Mt.current(Ee.current?.path??null)}},i=e?.contextMenu?.render?.(t.item,r)??null;return m?.setSlotContent(gt,i),e?.contextMenu?.onOpen?.(t.item,r),Kc(i),queueMicrotask(()=>{i==null||!i.isConnected||document.activeElement===i&&Kc(i)}),()=>{m?.clearSlotContent(gt)}},[en,e?.contextMenu,m]),Qs(()=>{L!=null&&t.getItem(L.path)==null&&Ft()},[Ft,L,t]),Qs(()=>{if(L==null)return;let e=S.current?.getRootNode(),t=e instanceof ShadowRoot?e.host:S.current,n=e=>{let n=e.target;n instanceof Node&&(Mc(e)||_.current?.contains(n)!==!0&&t?.contains(n)!==!0&&Ft())},r=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),Ft())};return document.addEventListener(`mousedown`,n,!0),document.addEventListener(`keydown`,r,!0),()=>{document.removeEventListener(`mousedown`,n,!0),document.removeEventListener(`keydown`,r,!0)}},[Ft,L]),Qs(()=>{let e=C.current,n=S.current;if(e==null||n==null){M.current=R;return}let r=R==null?null:T.current.get(R)??null,i=Ss(n),a=i?.dataset.itemPath??null,o=it&&x.current===i,c=f&&w.current===i,l=P.current&&!at,u=te.current??0,d=De.current,p=Oe.current,m=ke.current,g=Ae.current,_=i!=null,v=j.current||_,y=M.current!==R,b=p!=null&&p===R&&R!=null,E=!1,O=!1;if(st!=null&&st.id!==k.current){k.current=st.id;let n=st.visibleIndex,r=t.getVisibleRows(n,n)[0]??null;if(r!=null){let t=h?Math.max(0,Math.min(r.ancestorPaths.length*s,Math.max(0,xt-s))):Et;E=!0,O=Ds(e,n,s,xt,Tt,st.offset,t)}t.clearScrollRequest(st.id)}let A=!E&&l&&Os(e,z,s,xt,Tt,u),ee=!E&&d!=null&&d===R&&Os(e,z,s,xt,Tt,Et),N=!E&&m!=null&&m.path===R&&Os(e,z,s,xt,Tt,m.viewportOffset),ne=!E&&g!=null&&g.path===R&&e.scrollTop!==g.scrollTop;if(ne&&(e.scrollTop=g.scrollTop),(ne||O||ee||N||A||v&&y&&d!==R&&!b&&Es(e,z,s,xt,Et))&&D.current(),E){M.current=R;return}if(!v){M.current=R;return}if(o){M.current=R;return}if(c&&!l){M.current=R;return}if(r==null){l&&z>=0&&(Os(e,z,s,xt,Tt,u),D.current()),M.current=R;return}(y||l||d===R||p===R||m?.path===R||g?.path===R||a==null||a!==R)&&(xs(r),d===R&&(De.current=null),p===R&&(Oe.current=null),m?.path===R&&(ke.current=null),g?.path===R&&(Ae.current=null),P.current=!1,te.current=null),M.current=R},[t,z,R,Ot,s,it,at,St,xt,f,st,h,Et,Tt,bt]);let tn=z>=0&&z>=yt.visible.startIndex&&z<=yt.visible.endIndex,nn=R!=null&&Ct.some(e=>lc(e.row)===R),rn=tn||nn,an=qe&&j.current===!0&&rn?R:null,on=be===`pointer`?ge:null,sn=L?.path??je.current??on??an??ge,cn=L?.source===`right-click`;Qs(()=>{y.current&&L==null||It($e(sn))},[L,$e,St,xt,Se,Ct,sn,It,bt]);let ln=ec(e=>{if(y.current||Mc(e))return;let t=e.target;if(!(t instanceof HTMLElement)||t.closest?.(`[data-type="context-menu-trigger"]`)!=null)return;let n=t.closest?.(`[data-file-tree-sticky-row="true"]`),r=t.closest?.(`[data-type="item"]`),i=n instanceof HTMLElement?n.dataset.fileTreeStickyPath??null:r instanceof HTMLElement?r.dataset.itemPath??null:null;i!=null&&xe(e=>e===`pointer`?e:`pointer`),_e(e=>e===i?e:i)},[]),un=ec(()=>{_e(null)},[]);Qs(()=>{if(!ct)return;let e=()=>{Kt(),t.cancelDrag()};return window.addEventListener(`dragend`,e),()=>{window.removeEventListener(`dragend`,e),Kt(),t.cancelDrag()}},[t,ct]);let dn=e=>{if(!ct||t.getDragSession()==null||le.current)return;let n=yc(e.target instanceof HTMLElement?e.target:null);t.setDragTarget(n),qt(t.getDragSession()?.target??null),Yt(e.clientX,e.clientY),e.dataTransfer!=null&&(e.dataTransfer.dropEffect=`move`),e.preventDefault()},fn=e=>{if(!ct||t.getDragSession()==null||le.current)return;let n=e.relatedTarget;n instanceof Node&&S.current?.contains(n)===!0||(Ht(),Wt(),t.setDragTarget(null))},pn=e=>{!ct||t.getDragSession()==null||le.current||(e.preventDefault(),V(e.clientX,e.clientY),t.completeDrag(),Ut(),Ht(),Wt(),se.current=null)},mn=yt.window.height,hn=yt.window.offsetTop,gn=Math.min(0,xt-mn),_n=Math.min(0,xt-mn-Et),vn=he===R||P.current,yn=R!=null&&vn&&!Ot&&z>=0?bt[z]??t.getVisibleRows(z,z)[0]??null:null,bn=yn==null?null:ks(z,s,St,mn),xn=se.current,Sn=ft!=null&&xn!=null&&xn.path===ft&&xn.index>=St.start&&xn.index<=St.end,Cn=ft!=null&&xn!=null&&xn.path===ft&&!Sn&&xn.path!==yn?.path?xn:null,wn=Cn==null?null:ks(Cn.index,s,St,mn),Tn=Oc((z>=0?bt[z]??t.getVisibleRows(z,z)[0]??null:null)?.ancestorPaths.at(-1)??null),En=at&&R!=null?Uc(o,R,!Ot):void 0,Dn=L?.path??(at?R:he),On=L?.path??ge,kn=$e(sn),An=Ge&&qe&&!cn&&!it&&kn!=null&&ve!=null&&sn!=null,jn=Ge&&(An||L!=null),Mn=L?.anchorRect,Nn=Mn==null&&kn!=null&&ve!=null&&(L!=null||An)?ve:null,Pn=Mn==null?Nn==null?void 0:{top:`${Nn}px`}:{left:`${Mn.left}px`,position:`fixed`,right:`auto`,top:`${Mn.top}px`},Fn=cn?{opacity:`0`}:void 0,In=ec((e,n,r,i)=>{let a=Ns({event:{ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey},isDirectory:n.kind===`directory`,isSearchOpen:at,mode:i}),o=a.toggleDirectory&&n.kind===`directory`,s=o?t.resolveMountedDirectoryPathFromInput(r):null;if(o&&s==null)return;let c=s??r;switch(a.selection.kind){case`range`:t.selectPathRange(c,a.selection.additive);break;case`toggle`:t.togglePathSelectionFromInput(c);break;case`single`:t.selectOnlyMountedPathFromInput(c);break}let l=e.currentTarget instanceof HTMLElement?e.currentTarget:null,u=n.index>=yt.visible.startIndex&&n.index<=yt.visible.endIndex,d=i===`flow`&&u&&l!=null&&l.dataset.itemParked!==`true`;t.focusMountedPathFromInput(c),d&&(j.current=!0,I(e=>e===c?e:c),xe(`focus`)),o&&t.toggleMountedDirectoryFromInput(c),a.closeSearch&&t.closeSearch(),a.revealCanonical&&zt(c,{targetOffset:`sticky-parents`})},[t,at,yt.visible.endIndex,yt.visible.startIndex,zt]),Ln=()=>{if(y.current||!qe||sn==null||kn==null)return;let e=t.getItem(sn);e!=null&&(It(kn),Nt.current=!0,Te({anchorRect:null,item:{kind:e.isDirectory()?`directory`:`file`,name:kn.getAttribute(`aria-label`)??sn,path:e.getPath()},path:e.getPath(),source:`button`}))},Rn={contextHoverPath:On,contextMenuButtonTriggerEnabled:qe,contextMenuButtonVisibility:Je,contextMenuEnabled:Ge,contextMenuRightClickEnabled:Ye,contextMenuTriggerMode:Ke,controller:t,directoriesWithGitChanges:i,dragAndDropEnabled:ct,draggedPathSet:ut,dragTarget:dt,gitLaneActive:et,gitStatusByPath:n,handleRowDragEnd:Zt,handleRowDragStart:Xt,handleRowTouchStart:Qt,ignoredGitDirectories:r,ignoredInheritanceCache:me,instanceId:o,itemHeight:s,onKeyDown:$t,onRowClick:In,openContextMenuForRow:Lt,registerButton:Xe,registerRenameInput:Qe,renameView:nt,renderDecorationForRow:kt,resolveIcon:tt,shouldSuppressContextMenu:B,visualFocusPath:Dn},zn={...Rn,registerButton:Ze};return K(`div`,{ref:S,id:pt,"data-file-tree-context-menu-button-visibility":Ge&&qe?Je:void 0,"data-file-tree-context-menu-trigger-mode":Ge?Ke:void 0,"data-file-tree-has-context-menu-action-lane":Ge&&qe?`true`:void 0,"data-file-tree-has-git-lane":et?`true`:void 0,"data-file-tree-virtualized-root":`true`,onDragLeave:ct?fn:void 0,onDragOver:ct?dn:void 0,onDrop:ct?pn:void 0,onKeyDown:$t,onPointerLeave:Ge?un:void 0,onPointerOver:Ge?ln:void 0,role:`tree`,tabIndex:-1,style:{outline:`none`,position:`relative`},children:[K(`style`,{"data-file-tree-guide-style":`true`,dangerouslySetInnerHTML:{__html:Tn}}),K(`slot`,{name:ht,"data-type":`header-slot`}),f?K(`div`,{"data-file-tree-search-container":!0,"data-open":at?`true`:`false`,children:K(`input`,{ref:w,"aria-activedescendant":En,"aria-controls":pt,placeholder:`Search…`,"data-file-tree-search-input":!0,"data-file-tree-search-input-fake-focus":Le?`true`:void 0,value:ot,onBlur:()=>{d===`retain`&&!ze.current||t.closeSearch()},onFocus:Be,onPointerDown:Be,onInput:e=>{Be();let n=e.currentTarget;t.setSearch(n.value)}})}):null,K(`div`,{ref:C,"data-file-tree-virtualized-scroll":`true`,children:[h&&Ue&&Ct.length>0?K(`div`,{"aria-hidden":`true`,"data-file-tree-sticky-overlay":`true`,children:K(`div`,{"data-file-tree-sticky-overlay-content":`true`,style:{height:`${mt}px`},children:Ct.map((e,t)=>Jc(zn,e.row,`sticky:${lc(e.row)}`,{mode:`sticky`,style:{left:`0`,position:`absolute`,right:`0`,top:`${e.top}px`,zIndex:`${Ct.length-t}`}}))})}):null,K(`div`,{ref:b,"data-file-tree-virtualized-list":`true`,style:{height:`${Tt}px`},children:[K(`div`,{"data-file-tree-virtualized-sticky-offset":`true`,"aria-hidden":`true`,style:{height:`${hn}px`}}),K(`div`,{"data-file-tree-virtualized-sticky":`true`,style:{height:`${mn}px`,top:`${gn}px`,bottom:`${_n}px`},children:[Yc(Rn,St,Dt),yn!=null&&bn!=null?Jc(Rn,yn,`parked:${yn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:ft===yn.path?`none`:void 0,position:`absolute`,right:`0`,top:`${bn}px`}}):null,Cn!=null&&wn!=null?Jc(Rn,Cn,`parked-drag:${Cn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:`none`,position:`absolute`,right:`0`,top:`${wn}px`}}):null]})]})]}),Ge?K(`div`,{ref:_,"data-type":`context-menu-anchor`,"data-visible":jn?`true`:`false`,style:Pn,children:[K(`button`,{ref:v,type:`button`,"data-type":_t,"aria-label":`Options`,"aria-haspopup":`menu`,"aria-expanded":L==null?`false`:`true`,"data-visible":An?`true`:`false`,onMouseDown:e=>{e.preventDefault()},onClick:e=>{if(e.preventDefault(),e.stopPropagation(),L!=null){Ft();return}Ln()},tabIndex:-1,style:Fn,children:K(Wo,{...tt(`file-tree-icon-ellipsis`)})}),L==null?null:K(`slot`,{name:gt})]}):null,L==null?null:K(`div`,{"data-type":`context-menu-wash`,"aria-hidden":`true`,onMouseDownCapture:e=>{e.preventDefault(),Ft()},onTouchStartCapture:e=>{e.preventDefault(),e.stopPropagation(),Ft()},onTouchMoveCapture:e=>{e.preventDefault(),e.stopPropagation()},onWheelCapture:e=>{e.preventDefault(),e.stopPropagation()}})]})}var Zc={hydrateRoot:(e,t)=>{zo(ho(Xc,t),e)},renderRoot:(e,t)=>{Ro(ho(Xc,t),e)},unmountRoot:e=>{Ro(null,e)}};function Qc(e,t){Zc.renderRoot(e,t)}function $c(e,t){Zc.hydrateRoot(e,t)}function el(e){Zc.unmountRoot(e)}var tl=class{#e=new Map;#t=null;clearAll(){for(let e of this.#e.values())e.remove();this.#e.clear()}clearSlotContent(e){let t=this.#n(e);t!=null&&(t.remove(),this.#e.delete(e))}setHost(e){if(this.#t=e,e!=null){this.#i(e);for(let[e,t]of this.#e)this.#r(e,t)}}setSlotContent(e,t){let n=this.#n(e);if(n===t){t!=null&&(this.#e.set(e,t),this.#r(e,t));return}if(n?.remove(),t==null){this.#e.delete(e);return}this.#e.set(e,t),this.#r(e,t)}setSlotHtml(e,t){let n=t?.trim()??``;if(n.length===0){this.setSlotContent(e,null);return}let r=this.#n(e);if(r!=null&&r.innerHTML===n){this.#e.set(e,r),this.#r(e,r);return}let i=document.createElement(`div`);i.innerHTML=n,this.setSlotContent(e,i)}#n(e){let t=this.#e.get(e)??null;if(t!=null)return t;let n=this.#t;if(n==null)return null;for(let t of Array.from(n.children))if(t instanceof HTMLElement&&t.dataset.fileTreeManagedSlot===e)return t;return null}#r(e,t){t.slot=e,t.dataset.fileTreeManagedSlot=e,this.#t!=null&&t.parentNode!==this.#t&&this.#t.appendChild(t)}#i(e){for(let t of Array.from(e.children)){if(!(t instanceof HTMLElement))continue;let e=t.dataset.fileTreeManagedSlot;e==null||this.#e.has(e)||this.#e.set(e,t)}}},nl=`__c`,rl=`__k`,il=`__d`,al=`__s`,ol=/[\s\n\\/='"\0<>]/,sl=/^(xlink|xmlns|xml)([A-Z])/,cl=/^(?:accessK|auto[A-Z]|cell|ch|col|cont|cross|dateT|encT|form[A-Z]|frame|hrefL|inputM|maxL|minL|noV|playsI|popoverT|readO|rowS|src[A-Z]|tabI|useM|item[A-Z])/,ll=/^ac|^ali|arabic|basel|cap|clipPath$|clipRule$|color|dominant|enable|fill|flood|font|glyph[^R]|horiz|image|letter|lighting|marker[^WUH]|overline|panose|pointe|paint|rendering|shape|stop|strikethrough|stroke|text[^L]|transform|underline|unicode|units|^v[^i]|^w|^xH/,ul=new Set([`draggable`,`spellcheck`]);function dl(e){e.__g===void 0?e[il]=!0:e.__g|=8}function fl(e){e.__g===void 0?e[il]=!1:e.__g&=-9}function pl(e){return e.__g===void 0?!0===e[il]:!!(8&e.__g)}var ml=/["&<]/;function hl(e){if(e.length===0||!1===ml.test(e))return e;for(var t=0,n=0,r=``,i=``;n<e.length;n++){switch(e.charCodeAt(n)){case 34:i=`&quot;`;break;case 38:i=`&amp;`;break;case 60:i=`&lt;`;break;default:continue}n!==t&&(r+=e.slice(t,n)),r+=i,t=n+1}return n!==t&&(r+=e.slice(t,n)),r}var gl={},_l=new Set(`animation-iteration-count.border-image-outset.border-image-slice.border-image-width.box-flex.box-flex-group.box-ordinal-group.column-count.fill-opacity.flex.flex-grow.flex-negative.flex-order.flex-positive.flex-shrink.flood-opacity.font-weight.grid-column.grid-row.line-clamp.line-height.opacity.order.orphans.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-miterlimit.stroke-opacity.stroke-width.tab-size.widows.z-index.zoom`.split(`.`)),vl=/[A-Z]/g;function yl(e){var t=``;for(var n in e){var r=e[n];if(r!=null&&r!==``){var i=n[0]==`-`?n:gl[n]||(gl[n]=n.replace(vl,`-$&`).toLowerCase()),a=`;`;typeof r!=`number`||i.startsWith(`--`)||_l.has(i)||(a=`px;`),t=t+i+`:`+r+a}}return t||void 0}function bl(){this.__d=!0}function xl(e,t){return{__v:e,context:t,props:e.props,setState:bl,forceUpdate:bl,__d:!0,__h:[]}}function Sl(e,t,n){if(!e.s){if(n instanceof Cl){if(!n.s)return void(n.o=Sl.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(Sl.bind(null,e,t),Sl.bind(null,e,2));e.s=t,e.v=n;let r=e.o;r&&r(e)}}var Cl=function(){function e(){}return e.prototype.then=function(t,n){var r=new e,i=this.s;if(i){var a=1&i?t:n;if(a){try{Sl(r,1,a(this.v))}catch(e){Sl(r,2,e)}return r}return this}return this.o=function(e){try{var i=e.v;1&e.s?Sl(r,1,t?t(i):i):n?Sl(r,1,n(i)):Sl(r,2,i)}catch(e){Sl(r,2,e)}},r},e}(),wl,Tl,El,Dl,Ol={},kl=Array.isArray,Al=Object.assign,jl=``,Ml=`<!--$s-->`,Nl=`<!--/$s-->`;function Pl(e,t){var n,r=e.type,i=!0;return e[nl]?(i=!1,(n=e[nl]).state=n[al]):n=new r(e.props,t),e[nl]=n,n.__v=e,n.props=e.props,n.context=t,dl(n),n.state??=Ol,n[al]??(n[al]=n.state),r.getDerivedStateFromProps?n.state=Al({},n.state,r.getDerivedStateFromProps(n.props,n.state)):i&&n.componentWillMount?(n.componentWillMount(),n.state=n[al]===n.state?n.state:n[al]):!i&&n.componentWillUpdate&&n.componentWillUpdate(),El&&El(e),n.render(n.props,n.state,t)}function Fl(e,t,n,r,i,a,o){if(e==null||!0===e||!1===e||e===jl)return jl;var s=typeof e;if(s!=`object`)return s==`function`?jl:s==`string`?hl(e):e+jl;if(kl(e)){var c,l=jl;i[rl]=e;for(var u=e.length,d=0;d<u;d++){var f=e[d];if(f!=null&&typeof f!=`boolean`){var p,m=Fl(f,t,n,r,i,a,o);typeof m==`string`?l+=m:(c||=Array(u),l&&c.push(l),l=jl,kl(m)?(p=c).push.apply(p,m):c.push(m))}}return c?(l&&c.push(l),c):l}if(e.constructor!==void 0)return jl;e.__=i,wl&&wl(e);var h=e.type,g=e.props;if(typeof h==`function`){var _,v,y,b=t;if(h===_o){if(`tpl`in g){for(var x=jl,S=0;S<g.tpl.length;S++)if(x+=g.tpl[S],g.exprs&&S<g.exprs.length){var C=g.exprs[S];if(C==null)continue;typeof C!=`object`||C.constructor!==void 0&&!kl(C)?x+=C:x+=Fl(C,t,n,r,e,a,o)}return x}if(`UNSTABLE_comment`in g)return`<!--`+hl(g.UNSTABLE_comment)+`-->`;v=g.children}else{if((_=h.contextType)!=null){var w=t[_.__c];b=w?w.props.value:_.__}var T=h.prototype&&typeof h.prototype.render==`function`;if(T)v=Pl(e,b),y=e[nl];else{e[nl]=y=xl(e,b);for(var E=0;pl(y)&&E++<25;){fl(y),El&&El(e);try{v=h.call(y,g,b)}catch(t){throw a&&t&&typeof t.then==`function`&&(e._suspended=!0),t}}dl(y)}if(y.getChildContext!=null&&(t=Al({},t,y.getChildContext())),T&&G.errorBoundaries&&(h.getDerivedStateFromError||y.componentDidCatch)){v=v!=null&&v.type===_o&&v.key==null&&v.props.tpl==null?v.props.children:v;try{return Fl(v,t,n,r,e,a,!1)}catch(i){return h.getDerivedStateFromError&&(y[al]=h.getDerivedStateFromError(i)),y.componentDidCatch&&y.componentDidCatch(i,Ol),pl(y)?(v=Pl(e,t),(y=e[nl]).getChildContext!=null&&(t=Al({},t,y.getChildContext())),Fl(v=v!=null&&v.type===_o&&v.key==null&&v.props.tpl==null?v.props.children:v,t,n,r,e,a,o)):jl}finally{Tl&&Tl(e),Dl&&Dl(e)}}}v=v!=null&&v.type===_o&&v.key==null&&v.props.tpl==null?v.props.children:v;try{var D=Fl(v,t,n,r,e,a,o);return Tl&&Tl(e),G.unmount&&G.unmount(e),e._suspended?typeof D==`string`?Ml+D+Nl:kl(D)?(D.unshift(Ml),D.push(Nl),D):D.then(function(e){return Ml+e+Nl}):D}catch(i){if(!a&&o&&o.onError){var O=function i(s){return o.onError(s,e,function(e,s){try{return Fl(e,t,n,r,s,a,o)}catch(e){return i(e)}})}(i);if(O!==void 0)return O;var k=G.__e;return k&&k(i,e),jl}if(!a||!i||typeof i.then!=`function`)throw i;return i.then(function i(){try{var s=Fl(v,t,n,r,e,a,o);return e._suspended?Ml+s+Nl:s}catch(e){if(!e||typeof e.then!=`function`)throw e;return e.then(i)}})}}var A,ee=`<`+h,j=jl;for(var M in g){var N=g[M];if(typeof(N=Ll(N)?N.value:N)!=`function`||M===`class`||M===`className`){switch(M){case`children`:A=N;continue;case`key`:case`ref`:case`__self`:case`__source`:continue;case`htmlFor`:if(`for`in g)continue;M=`for`;break;case`className`:if(`class`in g)continue;M=`class`;break;case`defaultChecked`:M=`checked`;break;case`defaultSelected`:M=`selected`;break;case`defaultValue`:case`value`:switch(M=`value`,h){case`textarea`:A=N;continue;case`select`:r=N;continue;case`option`:r!=N||`selected`in g||(ee+=` selected`)}break;case`dangerouslySetInnerHTML`:j=N&&N.__html;continue;case`style`:typeof N==`object`&&(N=yl(N));break;case`acceptCharset`:M=`accept-charset`;break;case`httpEquiv`:M=`http-equiv`;break;default:if(sl.test(M))M=M.replace(sl,`$1:$2`).toLowerCase();else{if(ol.test(M))continue;M[4]!==`-`&&!ul.has(M)||N==null?n?ll.test(M)&&(M=M===`panose1`?`panose-1`:M.replace(/([A-Z])/g,`-$1`).toLowerCase()):cl.test(M)&&(M=M.toLowerCase()):N+=jl}}N!=null&&!1!==N&&(ee=!0===N||N===jl?ee+` `+M:ee+` `+M+`="`+(typeof N==`string`?hl(N):N+jl)+`"`)}}if(ol.test(h))throw Error(h+` is not a valid HTML tag name in `+ee+`>`);if(j||(typeof A==`string`?j=hl(A):A!=null&&!1!==A&&!0!==A&&(j=Fl(A,t,h===`svg`||h!==`foreignObject`&&n,r,e,a,o))),Tl&&Tl(e),Dl&&Dl(e),!j&&Il.has(h))return ee+`/>`;var P=`</`+h+`>`,te=ee+`>`;return kl(j)?[te].concat(j,[P]):typeof j==`string`?te+j+P:[te,j,P]}var Il=new Set([`area`,`base`,`br`,`col`,`command`,`embed`,`hr`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`]);function Ll(e){return typeof e==`object`&&!!e&&typeof e.peek==`function`&&`value`in e}var Rl=0;function zl(e){return e!=null&&e.length>0?e:(Rl+=1,`pst_ft_${Rl}`)}function Bl({initialVisibleRowCount:e,itemHeight:t}){return e==null?420:Math.max(0,e)*(t??Xi)}function Vl(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 Hl(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 Ul(e){return Array.from(e.children).filter(e=>e instanceof SVGElement)}var Wl=class{static LoadedCustomComponent=!0;#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=new tl;#u;#d;#f;#p;#m;#h;#g;#_;#v;#y=null;#b;#x=!1;#S=!1;constructor(e){let{composition:t,density:n,fileTreeSearchMode:r,gitStatus:i,id:a,initialSearchQuery:o,icons:s,itemHeight:c,onSearchChange:l,onSelectionChange:u,overscan:d,renderRowDecoration:f,renaming:p,search:m,searchBlurBehavior:h,searchFakeFocus:g,stickyFolders:_,unsafeCSS:v,initialVisibleRowCount:y,...b}=e;this.#e=t,this.#n=zl(a),this.#p=Qa(i),this.#m=s,this.#h=v,this.#r=u,this.#i=f,this.#a=p!=null&&p!==!1,this.#o=h,this.#s=m===!0,this.#c=g===!0,this.#u=Yi(n,c),this.#d={itemHeight:this.#u.itemHeight,overscan:d,stickyFolders:_,initialVisibleRowCount:y},this.#t=new qa({...b,fileTreeSearchMode:r,initialSearchQuery:o,onSearchChange:l,renaming:p}),this.#v=this.#t.getSelectionVersion(),this.#y=this.#r==null?null:this.subscribe(()=>{this.#D()})}unmount(){this.#b!=null&&(el(this.#b),delete this.#b.dataset.fileTreeVirtualizedWrapper,this.#b=void 0),this.#l.clearAll(),this.#l.setHost(null),this.#f!=null&&(delete this.#f.dataset.fileTreeVirtualized,this.#I(this.#f),this.#f=void 0)}cleanUp(){this.unmount(),this.#y?.(),this.#y=null,this.#t.destroy()}getFileTreeContainer(){return this.#f}getItem(e){return this.#t.getItem(e)}getFocusedItem(){return this.#t.getFocusedItem()}getFocusedPath(){return this.#t.getFocusedPath()}getSelectedPaths(){return this.#t.getSelectedPaths()}getComposition(){return this.#e}getItemHeight(){return this.#u.itemHeight}getDensityFactor(){return this.#u.factor}subscribe(e){let t=!1;return this.#t.subscribe(()=>{if(!t){t=!0;return}e()})}focusPath(e){this.#t.focusPath(e)}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)}move(e,t,n){this.#t.move(e,t,n)}onMutation(e,t){return this.#t.onMutation(e,t)}setSearch(e){this.#t.setSearch(e)}openSearch(e){this.#t.openSearch(e)}closeSearch(){this.#t.closeSearch()}isSearchOpen(){return this.#t.isSearchOpen()}getSearchValue(){return this.#t.getSearchValue()}getSearchMatchingPaths(){return this.#t.getSearchMatchingPaths()}focusNextSearchMatch(){this.#t.focusNextSearchMatch()}focusPreviousSearchMatch(){this.#t.focusPreviousSearchMatch()}startRenaming(e,t){return this.#t.startRenaming(e,t)}remove(e,t){this.#t.remove(e,t)}resetPaths(e,t){this.#t.resetPaths(e,t)}setComposition(e){this.#e=e;let t=this.#T();t!=null&&(this.#O(),Qc(t.wrapper,this.#w()))}setGitStatus(e){this.#p=Qa(e,this.#p);let t=this.#T();t!=null&&Qc(t.wrapper,this.#w())}setIcons(e){this.#m=e;let t=this.#T();t!=null&&(this.#E(t.host,t.wrapper),Qc(t.wrapper,this.#w()))}hydrate({fileTreeContainer:e}){let t=this.#P(e),n=this.#N(t);this.#O(),$c(n,this.#w())}render({containerWrapper:e,fileTreeContainer:t}){let n=this.#P(t??this.#f,e),r=this.#N(n);this.#O(),Qc(r,this.#w())}#C(){return{initialViewportHeight:Bl({initialVisibleRowCount:this.#d.initialVisibleRowCount,itemHeight:this.#d.itemHeight}),itemHeight:this.#d.itemHeight,overscan:this.#d.overscan,stickyFolders:this.#d.stickyFolders}}#w(){return{composition:this.#e,controller:this.#t,gitStatusByPath:this.#p?.statusByPath,ignoredGitDirectories:this.#p?.ignoredDirectoryPaths,directoriesWithGitChanges:this.#p?.directoriesWithChanges,icons:this.#m,instanceId:this.#n,renamingEnabled:this.#a,renderRowDecoration:this.#i,searchBlurBehavior:this.#o,searchEnabled:this.#s,searchFakeFocus:this.#c,slotHost:this.#l,...this.#C()}}#T(){let e=this.#f,t=this.#b;return e==null||t==null?null:{host:e,wrapper:t}}#E(e,t){let n=e.shadowRoot;n!=null&&(this.#k(n),this.#A(n)),this.#j(t)}#D(){let e=this.#r;if(e==null)return;let t=this.#t.getSelectionVersion();t!==this.#v&&(this.#v=t,e(this.#t.getSelectedPaths()))}#O(){let e=this.#e?.header?.render;if(e!=null){this.#l.setSlotContent(ht,e());return}this.#l.setSlotHtml(ht,this.#e?.header?.html??null)}#k(e){let t=Ul(e).find(e=>Hl(e)),n=Vl(Ce(pe(this.#m).set));n!=null&&(t!=null&&t.outerHTML===n.outerHTML||(t==null?e.prepend(n):t.replaceWith(n)))}#A(e){let t=Ul(e),n=t.find(e=>Hl(e)),r=t.filter(e=>e!==n),i=pe(this.#m).spriteSheet?.trim()??``;if(i.length===0){for(let e of r)e.remove();return}let a=Vl(i);if(a==null){for(let e of r)e.remove();return}if(!(r.length===1&&r[0].outerHTML===a.outerHTML)){for(let e of r)e.remove();e.appendChild(a)}}#j(e){let t=pe(this.#m);t.colored&&Te(t.set)?e.dataset.fileTreeColoredIcons=`true`:delete e.dataset.fileTreeColoredIcons}#M(e){let t=e.querySelector(`style[${dt}]`);if(this.#g==null&&t instanceof HTMLStyleElement&&(this.#g=t),this.#h==null||this.#h===``){this.#g?.remove(),this.#g=void 0,this.#_=void 0;return}this.#g?.parentNode===e&&this.#_===this.#h||(this.#g??=document.createElement(`style`),this.#g.setAttribute(dt,``),this.#g.parentNode!==e&&e.appendChild(this.#g),this.#g.textContent=ea(this.#h),this.#_=this.#h)}#N(e){if(this.#b!=null)return this.#b;let t=e.shadowRoot;if(t==null)throw Error(`FileTree requires a shadow root`);let n=Array.from(t.children).filter(e=>e instanceof HTMLDivElement&&typeof e.dataset.fileTreeId==`string`&&e.dataset.fileTreeId.length>0),r=n.find(e=>e.dataset.fileTreeId===this.#n)??n[0];return r!=null&&(this.#n=r.dataset.fileTreeId??this.#n),this.#b=r??document.createElement(`div`),this.#b.dataset.fileTreeId=this.#n,this.#b.dataset.fileTreeVirtualizedWrapper=`true`,this.#E(e,this.#b),this.#b.parentNode!==t&&t.appendChild(this.#b),this.#b}#P(e,t){let n=e??this.#f??document.createElement(`file-tree-container`);t!=null&&n.parentNode!==t&&t.appendChild(n);let r=n.shadowRoot??n.attachShadow({mode:`open`});return oa(n,r),this.#M(r),n.dataset.fileTreeVirtualized=`true`,n.style.display=`flex`,this.#F(n),this.#l.setHost(n),this.#f=n,n}#F(e){e.style.getPropertyValue(`--trees-item-height`)===``&&(e.style.setProperty(`--trees-item-height`,`${String(this.#u.itemHeight)}px`),this.#x=!0),e.style.getPropertyValue(`--trees-density-override`)===``&&(e.style.setProperty(`--trees-density-override`,String(this.#u.factor)),this.#S=!0)}#I(e){this.#x&&=(e.style.removeProperty(`--trees-item-height`),!1),this.#S&&=(e.style.removeProperty(`--trees-density-override`),!1)}},J=e(n(),1),Gl=typeof window>`u`?J.useEffect:J.useLayoutEffect;function Kl({file:e,options:t,editorOptions:n,lineAnnotations:r,selectedLines:i,prerenderedHTML:a,metrics:o,hasGutterRenderUtility:s,hasCustomHeader:c,disableWorkerPool:l,edit:u}){let d=nt(),f=i!==void 0,p=(0,J.useContext)(tt),m=se(),h=(0,J.useRef)(null),g=ae(n=>{if(n!=null){if(h.current!=null)throw Error(`File: An instance should not already exist when a node is created`);d==null?h.current=new N(ql({controlledSelection:f,hasCustomHeader:c,hasGutterRenderUtility:s,options:t}),l?void 0:p,!0):h.current=new M(ql({controlledSelection:f,hasCustomHeader:c,hasGutterRenderUtility:s,options:t}),d,o,l?void 0:p,!0),h.current.hydrate({file:e,fileContainer:n,lineAnnotations:r,prerenderedHTML:a})}else{if(h.current==null)throw Error(`File: A File instance should exist when unmounting`);h.current.cleanUp(),h.current=null}});return Gl(()=>{if(h.current==null)return;let n=ql({controlledSelection:f,hasCustomHeader:c,hasGutterRenderUtility:s,options:t}),a=n!==void 0&&!je(h.current.options,n);h.current.setOptions(n),h.current.render({file:e,lineAnnotations:r,forceRender:a}),i!==void 0&&h.current.setSelectedLines(i)}),Gl(()=>{if(u&&h.current!=null){if(m===void 0)throw Error(`File: EditContext is not attached`);let e=m(n??{});if(e==null)throw Error(`File: EditProvider.createEditor must return an editor instance`);try{return e.edit(h.current)}catch(t){throw e.cleanUp(),t}}},[u]),{ref:g,getHoveredLine:(0,J.useCallback)(()=>h.current?.getHoveredLine(),[])}}function ql({options:e,controlledSelection:t,hasCustomHeader:n,hasGutterRenderUtility:r}){return t||r||n?{...e,controlledSelection:t,renderCustomHeader:n?$e:e?.renderCustomHeader,renderGutterUtility:r?$e:e?.renderGutterUtility}:e}var Y=t();function Jl({file:e,lineAnnotations:t,selectedLines:n,options:r,editorOptions:i,metrics:a,className:o,style:s,renderAnnotation:c,renderCustomHeader:l,renderHeaderPrefix:u,renderHeaderFilenameSuffix:d,renderHeaderMetadata:f,prerenderedHTML:p,renderGutterUtility:m,disableWorkerPool:h=!1,edit:g=!1}){let{ref:_,getHoveredLine:v}=Kl({file:e,options:r,editorOptions:i,metrics:a,lineAnnotations:t,selectedLines:n,prerenderedHTML:p,hasGutterRenderUtility:m!=null,hasCustomHeader:l!=null,disableWorkerPool:h,edit:g});return(0,Y.jsx)(le,{ref:_,className:o,style:s,children:Ae(P({file:e,renderAnnotation:c,renderCustomHeader:l,renderHeaderPrefix:u,renderHeaderFilenameSuffix:d,renderHeaderMetadata:f,renderGutterUtility:m,lineAnnotations:t,getHoveredLine:v}),p)})}var Yl=100,Xl=1,Zl=2,Ql=3,$l=class{#e=[];#t=[];#n;#r=!1;constructor(e){this.#n=Math.max(1,e?.maxEntries??Yl)}get canUndo(){return this.#e.length>0}get canRedo(){return this.#t.length>0}clear(){this.#e.length=0,this.#t.length=0,this.#r=!1}clearRedo(){this.#t.length=0}push(e){this.#e.push(e),this.clearRedo(),this.#r=!0,this.#e.length>this.#n&&this.#e.shift()}setLastUndoSelectionsAfter(e){let t=this.#e[this.#e.length-1];t!==void 0&&(t.selectionsAfter=e.map(e=>({...e})))}setLastUndoLineAnnotations(e,t){let n=this.#e[this.#e.length-1];n!==void 0&&(n.lineAnnotationsBefore=e.slice(),n.lineAnnotationsAfter=t.slice())}peekUndo(){return this.#e[this.#e.length-1]}peekUndoForCoalescing(){return this.#r?this.peekUndo():void 0}replaceLastUndo(e){if(this.#e.length===0){this.push(e);return}this.#e[this.#e.length-1]=e,this.clearRedo(),this.#r=!0}popUndoToRedo(){let e=this.#e.pop();if(e!==void 0)return this.#t.push(e),this.#r=!1,e}popRedoToUndo(){let e=this.#t.pop();if(e!==void 0)return this.#e.push(e),this.#r=!1,e}};function eu(e,t,n,r,i,a,o,s){let c=[...t].sort((e,t)=>e.start-t.start),l=[],u;if(i?.length===c.length){let t=[];for(let n of i){if(n.start.line!==n.end.line||n.start.character!==n.end.character)break;t.push(e.offsetAt(n.start))}if(t.length===c.length){t.sort((e,t)=>e-t);let e=!0,n=!0;for(let r=0;r<c.length;r++){let i=c[r];if(i.text.length>0||i.start===i.end){e=!1,n=!1;break}e&&=t[r]===i.end,n&&=t[r]===i.start}u=e?Zl:n?Ql:void 0}}for(let t=0,n=0;t<c.length;t++){let r=c[t],i=e.getTextSlice(r.start,r.end),a=r.start+n;l.push({start:a,end:a+r.text.length,text:i}),n+=r.text.length-(r.end-r.start)}return{forwardEdits:c.map(e=>({...e})),inverseEdits:l,versionBefore:n,versionAfter:r,selectionsBefore:i?.map(e=>({...e})),selectionsAfter:a?.map(e=>({...e})),lineAnnotationsBefore:o?.slice(),lineAnnotationsAfter:s?.slice(),coalescingMode:u}}function tu(e,t){if(e===void 0||e.undoBoundary===!0||t.undoBoundary===!0||e.forwardEdits.length===0||e.forwardEdits.length!==e.inverseEdits.length||e.forwardEdits.length!==t.forwardEdits.length||t.forwardEdits.length!==t.inverseEdits.length)return!1;let n;for(let r=0;r<e.forwardEdits.length;r++){let i=e.forwardEdits[r],a=e.inverseEdits[r],o=t.forwardEdits[r],s=t.inverseEdits[r],c=iu(o.start,e.forwardEdits),l=i.start<=i.end&&i.text.length>0&&!i.text.includes(`
1672
1672
  `)&&!a.text.includes(`
1673
1673
  `),u=o.start===o.end&&o.text.length>0&&!o.text.includes(`
1674
1674
  `)&&s.text.length===0;if(l&&u){if(o.start!==a.end||(n??=Xl,n!==Xl||e.coalescingMode!==void 0&&e.coalescingMode!==Xl||t.coalescingMode!==void 0&&t.coalescingMode!==Xl))return!1;continue}let d=i.text.length===0&&i.end>i.start&&a.text.length>0,f=o.text.length===0&&o.end>o.start&&s.text.length>0;if(d&&f){let r;if(c===i.end)r=Ql;else if(c+(o.end-o.start)!==i.start)return!1;else r=Zl;if(n??=r,n!==r||e.coalescingMode!==void 0&&e.coalescingMode!==r||t.coalescingMode!==void 0&&t.coalescingMode!==r)return!1;continue}return!1}return n!==void 0}function nu(e,t){let n=[],r=[],i;for(let a=0;a<e.forwardEdits.length;a++){let o=e.forwardEdits[a],s=e.inverseEdits[a],c=t.forwardEdits[a],l=t.inverseEdits[a],u=iu(c.start,e.forwardEdits);if(o.text.length>0){i??=Xl,n.push({start:o.start,end:o.end,text:o.text+c.text}),r.push(s.text);continue}if(u===o.end){i??=Ql,n.push({start:o.start,end:u+(c.end-c.start),text:``}),r.push(s.text+l.text);continue}i??=Zl,n.push({start:Math.min(o.start,u),end:o.end,text:``}),r.push(l.text+s.text)}return{forwardEdits:n,inverseEdits:ru(n,r),versionBefore:e.versionBefore,versionAfter:t.versionAfter,selectionsBefore:e.selectionsBefore?.slice(),selectionsAfter:t.selectionsAfter?.slice(),lineAnnotationsBefore:e.lineAnnotationsBefore?.slice(),lineAnnotationsAfter:t.lineAnnotationsAfter?.slice(),coalescingMode:i}}function ru(e,t){let n=[];for(let r=0,i=0;r<e.length;r++){let a=e[r],o=a.start+i;n.push({start:o,end:o+a.text.length,text:t[r]}),i+=a.text.length-(a.end-a.start)}return n}function iu(e,t){let n=e;for(let e of t){let t=e.end-e.start,r=e.text.length,i=r-t;if(!(n<e.start)){if(n>=e.start+r){n-=i;continue}n=e.start+Math.min(n-e.start,t)}}return n}var au=1e5,ou=10,su=13,cu=`\`~!@#$%^&*()-=+[{]}\\|;:'",.<>/?`,lu=class{source;offset;length;lineOffsetStart;lineOffsetEnd;hasVirtualTrailingCRBreak;firstCharCode;lastCharCode;static Original=0;static Added=1;constructor(e,t,n,r,i,a,o,s){this.source=e,this.offset=t,this.length=n,this.lineOffsetStart=r,this.lineOffsetEnd=i,this.hasVirtualTrailingCRBreak=a,this.firstCharCode=o,this.lastCharCode=s}get lineBreakCount(){return this.lineOffsetEnd-this.lineOffsetStart+ +!!this.hasVirtualTrailingCRBreak}},uu=class{text;lineOffsets;constructor(e){this.text=e,this.lineOffsets=F(e)}append(e){let t=this.text.length;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);r!==ou&&r!==su||(r===su&&e.charCodeAt(n+1)===ou&&n++,this.lineOffsets.push(t+n+1))}return this.text+=e,t}},du=class{piece;subtreeLength;subtreeLineBreakCount;subtreeFirstCharCode;subtreeLastCharCode;left=null;right=null;parent=null;priority=0;constructor(e,t=e.length,n=e.lineBreakCount,r=e.firstCharCode,i=e.lastCharCode){this.piece=e,this.subtreeLength=t,this.subtreeLineBreakCount=n,this.subtreeFirstCharCode=r,this.subtreeLastCharCode=i}updateSubtreeLength(){this.subtreeLength=(this.left?.subtreeLength??0)+this.piece.length+(this.right?.subtreeLength??0),this.subtreeLineBreakCount=(this.left?.subtreeLineBreakCount??0)+this.piece.lineBreakCount+(this.right?.subtreeLineBreakCount??0)-+!!bu(this.left?.subtreeLastCharCode,this.piece.firstCharCode)-!!bu(this.piece.lastCharCode,this.right?.subtreeFirstCharCode),this.subtreeFirstCharCode=this.left?.subtreeFirstCharCode??this.piece.firstCharCode,this.subtreeLastCharCode=this.right?.subtreeLastCharCode??this.piece.lastCharCode}},fu=class{#e;#t=new uu(``);#n=null;#r=0;#i=0;#a=null;#o=null;#s=null;#c=2654435769;constructor(e){this.#e=new uu(e);let t=this.#y(lu.Original,0,e.length);this.#n=t.length>0?this.#C(t):null,this.#r=this.#n?.subtreeLength??0,this.#i=(this.#n?.subtreeLineBreakCount??0)+1}get lineCount(){return this.#i}getText(e){if(e===void 0)return this.#g();let t=this.offsetAt(e.start),n=this.offsetAt(e.end);return this.getTextSlice(t,n)}getLineText(e,t=!1){if(this.#a!==null&&this.#a[0]===e&&this.#a[1]===t)return this.#a[2];let n=this.#f(e);if(n===void 0)throw Error(`Line index out of range: ${e}`);let r=this.getTextSlice(n[0],n[1],!t);return this.#a=[e,t,r],this.#o=[e,t,r.length],r}getLineLength(e,t=!1){let n=this.#o,r=this.#a;if(n!==null&&n[0]===e&&n[1]===t)return n[2];if(r!==null&&r[0]===e&&r[1]===t){let n=r[2].length;return this.#o=[e,t,n],n}let i=this.#f(e);if(i===void 0)throw Error(`Line index out of range: ${e}`);let[a,o]=i,s=o-a;if(!t)for(;s>0&&pu(this.charAt(a+s-1).charCodeAt(0));)s--;return this.#o=[e,t,s],s}getTextSlice(e,t,n=!1){if(e>=t)return``;let r=mu(e,0,this.#r),i=mu(t,r,this.#r);if(r>=i)return``;let a=this.#u(r);if(a===void 0)return``;let o=[],[s,c]=a,l=i-r;for(;s!==null&&l>0;){let e=Math.min(s.piece.length-c,l),t=this.#v(s.piece.source),r=s.piece.offset+c,i=r+e;if(n)for(;i>r&&pu(t.text.charCodeAt(i-1));)i--;o.push(t.text.slice(r,i)),l-=e,c=0,s=this.#d(s)}return o.join(``)}charAt(e){let t=this.#u(e);if(t===void 0)return``;let[n,r]=t;return this.#v(n.piece.source).text.charAt(n.piece.offset+r)}includes(e){if(e.length===0)return!0;let t=hu(e),n=0,r=!1;return this.#_(i=>{for(let a=i.start;a<i.end;a++){let o=i.text.charCodeAt(a);for(;n>0&&o!==e.charCodeAt(n);)n=t[n-1];if(o===e.charCodeAt(n)&&n++,n===e.length)return r=!0,!1}return!0}),r}findNextNonOverlappingSubstring(e,t){if(e.length===0||e.length>this.#r)return;let n=gu(t,this.#r),r=n.reduce((e,[,t])=>Math.max(e,t),0),i=hu(e),a=0,o=0,s,c;return this.#_(t=>{for(let l=t.start;l<t.end;l++){let u=t.text.charCodeAt(l);for(;a>0&&u!==e.charCodeAt(a);)a=i[a-1];if(u===e.charCodeAt(a)&&a++,a===e.length){let t=o-e.length+1;if(!_u(n,t,t+e.length)){if(t>=r)return c=t,!1;s??=t}a=i[a-1]}o++}return!0}),c??s}search(e){if(e.text.length===0||this.#r===0||e.text.includes(`
@@ -2164,7 +2164,7 @@ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{n as t,r as n,t as r}f
2164
2164
  </symbol>
2165
2165
  </svg>`,cp=()=>{let e=document.createElement(`div`);e.innerHTML=sp;let t=e.firstElementChild;if(t===null||!(t instanceof SVGSVGElement))throw Error(`Failed to create sprite element`);return t},lp=(e,t=16)=>`<svg width="${t}" height="${t}" aria-hidden="true" focusable="false">
2166
2166
  <use href="#diffs-editor-icon-${e}"></use>
2167
- </svg>`,up=class{#e;#t;#n;#r;#i;#a;constructor(e){let{textDocument:t,containerElement:n,defaultQuery:r,mode:i=`find`,initialMatch:a,scrollToMatch:o,applyReplace:s,onUpdate:c,onClose:l}=e,u={text:r,replaceText:``,caseSensitive:!1,wholeWord:!1,regex:!1},d={all:[],current:void 0},f=X(`div`,{dataset:{matches:``,noMatches:``},textContent:`No results`}),p=e=>{d.all=u.text===``?[]:t.search(u);let n=d.all.length===0;if(A.disabled=n,j.disabled=n,n){f.textContent=`No results`,f.dataset.noMatches=``,d.current=void 0,c([]);return}if(delete f.dataset.noMatches,e?.syncSelection===!1){m(c(d.all,{syncSelection:!1}));return}m(c(d.all))};this.#n=p;let m=e=>{if(e===void 0)f.textContent=`${d.all.length} results`;else{let[t,n]=e;f.textContent=`${d.all.findIndex(e=>e[0]===t&&e[1]===n)+1} of ${d.all.length}`}d.current=e},h=(e,t)=>{u[e]=t,p()},g=(e=!1,t=!1)=>{let n=d.all,r=n[0];if(n.length>0)if(e){let e=d.current?.[0]??0;r=n.at(-1);for(let t of n)if(t[1]<=e)r=t;else break}else{let e=d.current?.[1]??0;for(let t of n)if(t[0]>=e){r=t;break}}r!==void 0&&(m(r),o(r,t)),d.current=r};this.#i=e=>g(e,!0);let _=(e,n)=>({start:e,end:n,text:Du(e=>t.positionAt(e),e=>t.offsetAt(e),e=>t.getLineText(e),u,e,n)}),v=()=>{if(u.text===``||d.all.length===0)return;let e=d.current;if(e===void 0&&(g(!1,!0),e=d.current,e===void 0))return;let[t,n]=e,r=_(t,n);s([r]),o([t+r.text.length,t+r.text.length],!0),d.current=void 0,p()},y=()=>{u.text===``||d.all.length===0||(s(d.all.map(([e,t])=>_(e,t))),d.current=void 0,p())},b=()=>{this.cleanup(),l()};this.#a=b;let x=e=>X(`button`,{type:`button`,title:e.label,ariaLabel:e.label,dataset:{searchIcon:``,...e.dataset},innerHTML:lp(e.icon,e.size??16),onclick:e.onClick}),S=(e,t,n)=>{let r=x({icon:e,label:t,size:14,onClick:()=>{let e=!u[n];r.ariaPressed=String(e),h(n,e)}});return r.ariaPressed=String(u[n]),r},C=S(`case`,`Match Case`,`caseSensitive`),w=S(`whole-word`,`Whole Word`,`wholeWord`),T=S(`regex`,`Regexp`,`regex`),E=X(`input`,{type:`text`,placeholder:`Replace`,dataset:`replace`,value:``,oninput:e=>{u.replaceText=e.target.value},onkeydown:e=>{if(e.isComposing)return;let t=Lu(e);e.key===`Escape`?(e.preventDefault(),b()):e.key===`Enter`?(e.preventDefault(),v()):t!==void 0&&(e.preventDefault(),g(t===`previous`,!0))}});this.#t=X(`input`,{type:`text`,placeholder:`Search`,dataset:`search`,value:r,oninput:e=>{u.text=e.target.value,d.current=void 0,p()},onkeydown:e=>{let t=Lu(e);e.key===`Escape`?(e.preventDefault(),b()):e.key===`Enter`?(e.preventDefault(),g(e.shiftKey,!0)):t===void 0?Au(e)&&(e.key===`f`||e.code===`KeyF`)&&(e.preventDefault(),te(e.altKey?`replace`:`find`)):(e.preventDefault(),g(t===`previous`,!0))}});let D=X(`div`,{dataset:`searchToggles`,children:[C,w,T]}),ee=X(`div`,{dataset:{inputBox:``,find:``},children:[this.#t,D]}),O=X(`div`,{dataset:{inputBox:``,replace:``,replaceCell:``},children:[E]}),k=X(`div`,{dataset:{replaceActions:``,replaceCell:``},children:[x({icon:`replace`,label:`Replace`,onClick:v}),x({icon:`replace-all`,label:`Replace All`,onClick:y})]}),A=x({icon:`arrow-up`,label:`Previous`,onClick:()=>{g(!0)}}),j=x({icon:`arrow-down`,label:`Next`,onClick:()=>{g()}});A.disabled=!0,j.disabled=!0;let M=X(`div`,{dataset:`searchNav`,children:[A,j]}),N=x({icon:`close`,label:`Close`,onClick:b,dataset:{searchClose:``}}),P=X(`div`,{dataset:{searchGrid:``,mode:i},children:[ee,O,k,f,M,N]}),te=e=>{P.dataset.mode=e,this.#t.focus(),this.#t.select()};this.#r=te,this.#e=X(`div`,{dataset:`searchPanel`,children:[X(`div`,{dataset:`editorWidget`,children:[P]})]}),d.current=a,n.before(this.#e),requestAnimationFrame(()=>{a===void 0?c([]):p(),this.#t.select()})}focus(){this.#t.focus()}navigate(e){this.#i?.(e)}updateMatches(e){this.#n?.(e)}setMode(e){this.#r?.(e)}close(){this.#a?.()}cleanup(){this.#e.remove()}},dp=class{#e;#t;#n;constructor(e,t,n){this.#e=X(`div`,{dataset:{editorWidget:``,selectionActionPopover:``},contentEditable:`false`,children:[e]},t),this.#t=this.#e.offsetHeight,this.#n=new ResizeObserver(()=>{let e=this.#e.offsetHeight;e!==this.#t&&(this.#t=e,n())}),this.#n.observe(this.#e)}reposition(e,t,n,r,i,a){this.#e.style.visibility=i?``:`hidden`,vd(this.#e,{gutterWidth:n,placeAbove:r,viewport:a,x:e,y:t})}get height(){return this.#t}cleanup(){this.#n.disconnect(),this.#e.remove()}};function fp(e){return{selections:e.selections?.map(e=>({start:{...e.start},end:{...e.end},direction:e.direction})),view:e.view===void 0?void 0:{...e.view}}}function pp(e){return typeof e==`object`?e:e===`indexedDB`?new vp:new mp}var mp=class{#e=new Map;get(e){let t=this.#e.get(e);return t===void 0?void 0:fp(t)}set(e,t){this.#e.set(e,fp(t))}},hp=`pierre-diffs-editor-state`,gp=1,_p=`states`,vp=class{#e=yp();async get(e){let t=await this.#e;if(t===void 0)return;let n=await bp(t.transaction(_p,`readonly`).objectStore(_p).get(e));return n===void 0?void 0:fp(n)}async set(e,t){let n=await this.#e;n!==void 0&&await bp(n.transaction(_p,`readwrite`).objectStore(_p).put(fp(t),e))}};function yp(){try{let e=globalThis.indexedDB;if(e===void 0)return Promise.resolve(void 0);let t=e.open(hp,gp);return t.onupgradeneeded=()=>{let e=t.result;e.objectStoreNames.contains(_p)||e.createObjectStore(_p)},bp(t)}catch{return Promise.resolve(void 0)}}function bp(e){return new Promise((t,n)=>{e.onsuccess=()=>t(e.result),e.onerror=()=>n(e.error)})}var xp=4096,Sp=/\p{Mark}/u,Cp=class{#e;#t;#n;#r=new Map;ch=-1;tabSize=2;lineHeight=20;paddingTop=0;init(e){if(this.#e===e&&this.#t!==void 0&&this.ch!==-1)return;if(this.#e=e,this.#t??=document.createElement(`canvas`).getContext(`2d`)??void 0,this.#t===void 0)throw Error(`Could not get canvas context`);let t=e.parentElement;if(t!==null){let{paddingTop:e}=getComputedStyle(t);e.endsWith(`px`)&&(this.paddingTop=parseFloat(e.slice(0,-2)))}let{fontSize:n,fontFamily:r,tabSize:i,lineHeight:a}=getComputedStyle(e);a.endsWith(`px`)?this.lineHeight=parseFloat(a.slice(0,-2)):n.endsWith(`px`)&&(this.lineHeight=Qu(parseFloat(n.slice(0,-2))*parseFloat(a)));let o=n+` `+r;(this.#n!==o||this.ch===-1)&&(this.#n=o,this.#t.font=o,this.ch=this.canvasMeasureTextWidth(`0`),this.clearTextWidthCache());let s=parseInt(i,10);Number.isNaN(s)||(this.tabSize=s)}remeasureCharacterWidth(){if(this.#t===void 0||this.#n===void 0)return!1;this.#t.font=this.#n;let e=this.canvasMeasureTextWidth(`0`),t=e!==this.ch;t&&(this.ch=e);let n=this.#a();return t||n}measureTextWidth(e){if(!e.includes(` `))return this.#i(e);if(this.#t===void 0)throw Error(`Metrics not initialized`);let t=Dp(e,this.tabSize);if(t!==-1)return t*this.ch;let n=0,r=0,i=this.tabSize*this.ch;for(let t=0;t<e.length;t++)if(e.charCodeAt(t)===9){if(t>r&&(n+=this.#i(e.slice(r,t))),i>0){let e=n%i;n+=e===0?i:i-e}r=t+1}return r<e.length&&(n+=this.#i(e.slice(r))),Qu(n)}#i(e){return wp(e)?this.domMeasureTextWidth(e):this.canvasMeasureTextWidth(e)}canvasMeasureTextWidth(e){if(this.#t===void 0)throw Error(`Metrics not initialized`);return Qu(this.#t.measureText(e).width)}domMeasureTextWidth(e){if(this.#e===void 0)throw Error(`Metrics not initialized`);let t=e+`|`+this.#n,n=this.#r.get(t);if(n!==void 0)return n;let r=X(`span`,{style:{position:`absolute`,top:`0`,left:`0`,visibility:`hidden`,pointerEvents:`none`,whiteSpace:`pre`,font:`inherit`},textContent:e},this.#e),i;try{i=Qu(r.getBoundingClientRect().width)}finally{r.remove()}if(this.#r.size>=xp){let e=this.#r.keys().next().value;e!==void 0&&this.#r.delete(e)}return this.#r.set(t,i),i}clearTextWidthCache(){this.#a()}#a(){let e=this.#r.size>0;return this.#r.clear(),e}};function wp(e){for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n>=55296&&n<=57343||n===8205||n===65038||n===65039||n>127&&Sp.test(e.charAt(t)))return!0}return!1}function Tp(e,t){let n=Math.max(0,Math.min(t,e.length));if(n===0||n===e.length||!wp(e))return n;let r=rd();if(r!==void 0){for(let t of r.segment(e)){let e=t.index,r=e+t.segment.length;if(n>e&&n<r)return r;if(n<=e)break}return n}let i=0;for(let t of e){let e=i+t.length;if(n>i&&n<e)return e;if(n<=i)break;i=e}return n}function Ep(e){if(!wp(e))return;let t=[0],n=rd();if(n!==void 0){for(let r of n.segment(e))t.push(r.index+r.segment.length);return t}let r=0;for(let n of e)r+=n.length,t.push(r);return t}function Dp(e,t){let n=0;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);if(i>127)return-1;n+=i===9?t-n%t:1}return n}var Op=500,kp=0,Ap=class{#e;#t;#n;#r=`dark`;#i=``;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=!1;#h=[Ge];#g=[];#_=0;#v=[];#y=-1;#b=!0;#x=!1;#S=0;#C=++kp;#w=-1;#T=-1;#E;#D=0;#O=[];#k=!1;#A=Zu(async e=>{if(this.#m)return;let{startingLine:t=0,totalLines:n=1/0}=e??{},r=Math.min(n===1/0?1/0:t+n,this.#o.lineCount);if(this.#t===void 0&&!Np(this.#o.languageId)){if(await this.#e.loadLanguage(this.#o.languageId),this.#m)return;this.#t=this.#e.getLanguage(this.#o.languageId)}this.#F(),this.#V(r)},500);#j=({data:e})=>{if(typeof e!=`object`||!e)return;let{type:t,tokenizerId:n,jobId:r}=e;t===`tokenize`&&n===this.#C&&typeof r==`number`&&r===this.#S&&(this.#w>=0?this.#q(r):this.#J(r))};get themeType(){return this.#r}getStringCommentRegexpRangesInLine(e){if(!this.#d||e<0||e>=this.#o.lineCount||(this.#I(),this.#t===void 0))return null;if(this.#O[e]===void 0){this.#K(e);let t=this.#h[e]??Ge,n=this.#H(e,t);this.#h[e+1]=n.state}return this.#O[e]??null}constructor({codeOptions:e,highlighter:t,textDocument:n,matchBrackets:r,setStyle:i,onDeferTokenize:a,onThemeChange:o,__debug:s}){let{themeType:c=`system`,theme:l=ve,tokenizeMaxLineLength:u=1e3}=e;this.#n=window.matchMedia(`(prefers-color-scheme: dark)`);let d;if(d=c===`system`?this.#N():c,typeof l!=`string`&&c===`system`){let e=new MutationObserver(e=>{for(let{type:t,attributeName:n}of e)if(t===`attributes`&&n!==null&&(n===`class`||n.startsWith(`data-`))){let e=this.#N();this.#M(l[e],e);break}});e.observe(document.documentElement,{attributes:!0}),e.observe(document.body,{attributes:!0}),this.#p=[Z(this.#n,`change`,()=>{let e=this.#N();this.#M(l[e],e)}),()=>e.disconnect()]}this.#e=t,this.#o=n,this.#s=u,this.#c=i,this.#l=a,this.#u=o,this.#d=r!==!1,this.#f=s??!1,this.#I(),this.#a=[],this.#P(typeof l==`string`?l:l[d],typeof l==`string`?void 0:d)}#M(e,t){e===this.#i&&t===this.#r||(this.#P(e,t),this.stopBackgroundTokenize(),this.#h=[Ge],this.#g=[],this.#_=0,this.#v=[],this.#t!==void 0&&this.#o.lineCount>0&&this.#B(0),this.#u?.())}#N(){try{if(typeof document<`u`&&typeof getComputedStyle==`function`&&document.body!=null){let e=getComputedStyle(document.body).colorScheme.split(/\s+/),t=e.includes(`dark`);if(t!==e.includes(`light`))return t?`dark`:`light`}}catch{}return this.#n.matches?`dark`:`light`}syncTheme(e){let{themeType:t=`system`,theme:n=ve}=e;if(typeof n==`string`){let e=this.#e.getTheme(n).type;if(n===this.#i&&e===this.#r)return;this.#M(n,e);return}let r=t===`system`?this.#N():t,i=n[r];r===this.#r&&i===this.#i||this.#M(i,r)}#P(e,t){let{theme:n,colorMap:r}=this.#e.setTheme(e),{colors:i={}}=this.#e.getTheme(e),a=i[`editor.selectionBackground`],o=i[`editor.lineHighlightBackground`],s=o!=null&&o.trim()!==``&&!fe.isFullyTransparent(o)?o:void 0,c=i[`editor.lineHighlightBorder`]??(s==null?`color-mix(in lab, var(--diffs-bg) 70%, var(--diffs-fg))`:`transparent`),l=s==null?`100%`:`85%`,u=i[`editorCursor.foreground`],d=i[`editor.findMatchBackground`],f=i[`editor.findMatchHighlightBackground`],p=i[`editorBracketMatch.background`],m=i[`editorBracketMatch.border`],h=i[`editorHint.foreground`],g=i[`editorInfo.foreground`],_=i[`editorWarning.foreground`],v=i[`editorError.foreground`];this.#c(`:host {
2167
+ </svg>`,up=class{#e;#t;#n;#r;#i;#a;constructor(e){let{textDocument:t,containerElement:n,defaultQuery:r,mode:i=`find`,initialMatch:a,scrollToMatch:o,applyReplace:s,onUpdate:c,onClose:l}=e,u={text:r,replaceText:``,caseSensitive:!1,wholeWord:!1,regex:!1},d={all:[],current:void 0},f=X(`div`,{dataset:{matches:``,noMatches:``},textContent:`No results`}),p=e=>{d.all=u.text===``?[]:t.search(u);let n=d.all.length===0;if(ee.disabled=n,j.disabled=n,n){f.textContent=`No results`,f.dataset.noMatches=``,d.current=void 0,c([]);return}if(delete f.dataset.noMatches,e?.syncSelection===!1){m(c(d.all,{syncSelection:!1}));return}m(c(d.all))};this.#n=p;let m=e=>{if(e===void 0)f.textContent=`${d.all.length} results`;else{let[t,n]=e;f.textContent=`${d.all.findIndex(e=>e[0]===t&&e[1]===n)+1} of ${d.all.length}`}d.current=e},h=(e,t)=>{u[e]=t,p()},g=(e=!1,t=!1)=>{let n=d.all,r=n[0];if(n.length>0)if(e){let e=d.current?.[0]??0;r=n.at(-1);for(let t of n)if(t[1]<=e)r=t;else break}else{let e=d.current?.[1]??0;for(let t of n)if(t[0]>=e){r=t;break}}r!==void 0&&(m(r),o(r,t)),d.current=r};this.#i=e=>g(e,!0);let _=(e,n)=>({start:e,end:n,text:Du(e=>t.positionAt(e),e=>t.offsetAt(e),e=>t.getLineText(e),u,e,n)}),v=()=>{if(u.text===``||d.all.length===0)return;let e=d.current;if(e===void 0&&(g(!1,!0),e=d.current,e===void 0))return;let[t,n]=e,r=_(t,n);s([r]),o([t+r.text.length,t+r.text.length],!0),d.current=void 0,p()},y=()=>{u.text===``||d.all.length===0||(s(d.all.map(([e,t])=>_(e,t))),d.current=void 0,p())},b=()=>{this.cleanup(),l()};this.#a=b;let x=e=>X(`button`,{type:`button`,title:e.label,ariaLabel:e.label,dataset:{searchIcon:``,...e.dataset},innerHTML:lp(e.icon,e.size??16),onclick:e.onClick}),S=(e,t,n)=>{let r=x({icon:e,label:t,size:14,onClick:()=>{let e=!u[n];r.ariaPressed=String(e),h(n,e)}});return r.ariaPressed=String(u[n]),r},C=S(`case`,`Match Case`,`caseSensitive`),w=S(`whole-word`,`Whole Word`,`wholeWord`),T=S(`regex`,`Regexp`,`regex`),E=X(`input`,{type:`text`,placeholder:`Replace`,dataset:`replace`,value:``,oninput:e=>{u.replaceText=e.target.value},onkeydown:e=>{if(e.isComposing)return;let t=Lu(e);e.key===`Escape`?(e.preventDefault(),b()):e.key===`Enter`?(e.preventDefault(),v()):t!==void 0&&(e.preventDefault(),g(t===`previous`,!0))}});this.#t=X(`input`,{type:`text`,placeholder:`Search`,dataset:`search`,value:r,oninput:e=>{u.text=e.target.value,d.current=void 0,p()},onkeydown:e=>{let t=Lu(e);e.key===`Escape`?(e.preventDefault(),b()):e.key===`Enter`?(e.preventDefault(),g(e.shiftKey,!0)):t===void 0?Au(e)&&(e.key===`f`||e.code===`KeyF`)&&(e.preventDefault(),te(e.altKey?`replace`:`find`)):(e.preventDefault(),g(t===`previous`,!0))}});let D=X(`div`,{dataset:`searchToggles`,children:[C,w,T]}),O=X(`div`,{dataset:{inputBox:``,find:``},children:[this.#t,D]}),k=X(`div`,{dataset:{inputBox:``,replace:``,replaceCell:``},children:[E]}),A=X(`div`,{dataset:{replaceActions:``,replaceCell:``},children:[x({icon:`replace`,label:`Replace`,onClick:v}),x({icon:`replace-all`,label:`Replace All`,onClick:y})]}),ee=x({icon:`arrow-up`,label:`Previous`,onClick:()=>{g(!0)}}),j=x({icon:`arrow-down`,label:`Next`,onClick:()=>{g()}});ee.disabled=!0,j.disabled=!0;let M=X(`div`,{dataset:`searchNav`,children:[ee,j]}),N=x({icon:`close`,label:`Close`,onClick:b,dataset:{searchClose:``}}),P=X(`div`,{dataset:{searchGrid:``,mode:i},children:[O,k,A,f,M,N]}),te=e=>{P.dataset.mode=e,this.#t.focus(),this.#t.select()};this.#r=te,this.#e=X(`div`,{dataset:`searchPanel`,children:[X(`div`,{dataset:`editorWidget`,children:[P]})]}),d.current=a,n.before(this.#e),requestAnimationFrame(()=>{a===void 0?c([]):p(),this.#t.select()})}focus(){this.#t.focus()}navigate(e){this.#i?.(e)}updateMatches(e){this.#n?.(e)}setMode(e){this.#r?.(e)}close(){this.#a?.()}cleanup(){this.#e.remove()}},dp=class{#e;#t;#n;constructor(e,t,n){this.#e=X(`div`,{dataset:{editorWidget:``,selectionActionPopover:``},contentEditable:`false`,children:[e]},t),this.#t=this.#e.offsetHeight,this.#n=new ResizeObserver(()=>{let e=this.#e.offsetHeight;e!==this.#t&&(this.#t=e,n())}),this.#n.observe(this.#e)}reposition(e,t,n,r,i,a){this.#e.style.visibility=i?``:`hidden`,vd(this.#e,{gutterWidth:n,placeAbove:r,viewport:a,x:e,y:t})}get height(){return this.#t}cleanup(){this.#n.disconnect(),this.#e.remove()}};function fp(e){return{selections:e.selections?.map(e=>({start:{...e.start},end:{...e.end},direction:e.direction})),view:e.view===void 0?void 0:{...e.view}}}function pp(e){return typeof e==`object`?e:e===`indexedDB`?new vp:new mp}var mp=class{#e=new Map;get(e){let t=this.#e.get(e);return t===void 0?void 0:fp(t)}set(e,t){this.#e.set(e,fp(t))}},hp=`pierre-diffs-editor-state`,gp=1,_p=`states`,vp=class{#e=yp();async get(e){let t=await this.#e;if(t===void 0)return;let n=await bp(t.transaction(_p,`readonly`).objectStore(_p).get(e));return n===void 0?void 0:fp(n)}async set(e,t){let n=await this.#e;n!==void 0&&await bp(n.transaction(_p,`readwrite`).objectStore(_p).put(fp(t),e))}};function yp(){try{let e=globalThis.indexedDB;if(e===void 0)return Promise.resolve(void 0);let t=e.open(hp,gp);return t.onupgradeneeded=()=>{let e=t.result;e.objectStoreNames.contains(_p)||e.createObjectStore(_p)},bp(t)}catch{return Promise.resolve(void 0)}}function bp(e){return new Promise((t,n)=>{e.onsuccess=()=>t(e.result),e.onerror=()=>n(e.error)})}var xp=4096,Sp=/\p{Mark}/u,Cp=class{#e;#t;#n;#r=new Map;ch=-1;tabSize=2;lineHeight=20;paddingTop=0;init(e){if(this.#e===e&&this.#t!==void 0&&this.ch!==-1)return;if(this.#e=e,this.#t??=document.createElement(`canvas`).getContext(`2d`)??void 0,this.#t===void 0)throw Error(`Could not get canvas context`);let t=e.parentElement;if(t!==null){let{paddingTop:e}=getComputedStyle(t);e.endsWith(`px`)&&(this.paddingTop=parseFloat(e.slice(0,-2)))}let{fontSize:n,fontFamily:r,tabSize:i,lineHeight:a}=getComputedStyle(e);a.endsWith(`px`)?this.lineHeight=parseFloat(a.slice(0,-2)):n.endsWith(`px`)&&(this.lineHeight=Qu(parseFloat(n.slice(0,-2))*parseFloat(a)));let o=n+` `+r;(this.#n!==o||this.ch===-1)&&(this.#n=o,this.#t.font=o,this.ch=this.canvasMeasureTextWidth(`0`),this.clearTextWidthCache());let s=parseInt(i,10);Number.isNaN(s)||(this.tabSize=s)}remeasureCharacterWidth(){if(this.#t===void 0||this.#n===void 0)return!1;this.#t.font=this.#n;let e=this.canvasMeasureTextWidth(`0`),t=e!==this.ch;t&&(this.ch=e);let n=this.#a();return t||n}measureTextWidth(e){if(!e.includes(` `))return this.#i(e);if(this.#t===void 0)throw Error(`Metrics not initialized`);let t=Dp(e,this.tabSize);if(t!==-1)return t*this.ch;let n=0,r=0,i=this.tabSize*this.ch;for(let t=0;t<e.length;t++)if(e.charCodeAt(t)===9){if(t>r&&(n+=this.#i(e.slice(r,t))),i>0){let e=n%i;n+=e===0?i:i-e}r=t+1}return r<e.length&&(n+=this.#i(e.slice(r))),Qu(n)}#i(e){return wp(e)?this.domMeasureTextWidth(e):this.canvasMeasureTextWidth(e)}canvasMeasureTextWidth(e){if(this.#t===void 0)throw Error(`Metrics not initialized`);return Qu(this.#t.measureText(e).width)}domMeasureTextWidth(e){if(this.#e===void 0)throw Error(`Metrics not initialized`);let t=e+`|`+this.#n,n=this.#r.get(t);if(n!==void 0)return n;let r=X(`span`,{style:{position:`absolute`,top:`0`,left:`0`,visibility:`hidden`,pointerEvents:`none`,whiteSpace:`pre`,font:`inherit`},textContent:e},this.#e),i;try{i=Qu(r.getBoundingClientRect().width)}finally{r.remove()}if(this.#r.size>=xp){let e=this.#r.keys().next().value;e!==void 0&&this.#r.delete(e)}return this.#r.set(t,i),i}clearTextWidthCache(){this.#a()}#a(){let e=this.#r.size>0;return this.#r.clear(),e}};function wp(e){for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n>=55296&&n<=57343||n===8205||n===65038||n===65039||n>127&&Sp.test(e.charAt(t)))return!0}return!1}function Tp(e,t){let n=Math.max(0,Math.min(t,e.length));if(n===0||n===e.length||!wp(e))return n;let r=rd();if(r!==void 0){for(let t of r.segment(e)){let e=t.index,r=e+t.segment.length;if(n>e&&n<r)return r;if(n<=e)break}return n}let i=0;for(let t of e){let e=i+t.length;if(n>i&&n<e)return e;if(n<=i)break;i=e}return n}function Ep(e){if(!wp(e))return;let t=[0],n=rd();if(n!==void 0){for(let r of n.segment(e))t.push(r.index+r.segment.length);return t}let r=0;for(let n of e)r+=n.length,t.push(r);return t}function Dp(e,t){let n=0;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);if(i>127)return-1;n+=i===9?t-n%t:1}return n}var Op=500,kp=0,Ap=class{#e;#t;#n;#r=`dark`;#i=``;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=!1;#h=[Ge];#g=[];#_=0;#v=[];#y=-1;#b=!0;#x=!1;#S=0;#C=++kp;#w=-1;#T=-1;#E;#D=0;#O=[];#k=!1;#A=Zu(async e=>{if(this.#m)return;let{startingLine:t=0,totalLines:n=1/0}=e??{},r=Math.min(n===1/0?1/0:t+n,this.#o.lineCount);if(this.#t===void 0&&!Np(this.#o.languageId)){if(await this.#e.loadLanguage(this.#o.languageId),this.#m)return;this.#t=this.#e.getLanguage(this.#o.languageId)}this.#F(),this.#V(r)},500);#j=({data:e})=>{if(typeof e!=`object`||!e)return;let{type:t,tokenizerId:n,jobId:r}=e;t===`tokenize`&&n===this.#C&&typeof r==`number`&&r===this.#S&&(this.#w>=0?this.#q(r):this.#J(r))};get themeType(){return this.#r}getStringCommentRegexpRangesInLine(e){if(!this.#d||e<0||e>=this.#o.lineCount||(this.#I(),this.#t===void 0))return null;if(this.#O[e]===void 0){this.#K(e);let t=this.#h[e]??Ge,n=this.#H(e,t);this.#h[e+1]=n.state}return this.#O[e]??null}constructor({codeOptions:e,highlighter:t,textDocument:n,matchBrackets:r,setStyle:i,onDeferTokenize:a,onThemeChange:o,__debug:s}){let{themeType:c=`system`,theme:l=ve,tokenizeMaxLineLength:u=1e3}=e;this.#n=window.matchMedia(`(prefers-color-scheme: dark)`);let d;if(d=c===`system`?this.#N():c,typeof l!=`string`&&c===`system`){let e=new MutationObserver(e=>{for(let{type:t,attributeName:n}of e)if(t===`attributes`&&n!==null&&(n===`class`||n.startsWith(`data-`))){let e=this.#N();this.#M(l[e],e);break}});e.observe(document.documentElement,{attributes:!0}),e.observe(document.body,{attributes:!0}),this.#p=[Z(this.#n,`change`,()=>{let e=this.#N();this.#M(l[e],e)}),()=>e.disconnect()]}this.#e=t,this.#o=n,this.#s=u,this.#c=i,this.#l=a,this.#u=o,this.#d=r!==!1,this.#f=s??!1,this.#I(),this.#a=[],this.#P(typeof l==`string`?l:l[d],typeof l==`string`?void 0:d)}#M(e,t){e===this.#i&&t===this.#r||(this.#P(e,t),this.stopBackgroundTokenize(),this.#h=[Ge],this.#g=[],this.#_=0,this.#v=[],this.#t!==void 0&&this.#o.lineCount>0&&this.#B(0),this.#u?.())}#N(){try{if(typeof document<`u`&&typeof getComputedStyle==`function`&&document.body!=null){let e=getComputedStyle(document.body).colorScheme.split(/\s+/),t=e.includes(`dark`);if(t!==e.includes(`light`))return t?`dark`:`light`}}catch{}return this.#n.matches?`dark`:`light`}syncTheme(e){let{themeType:t=`system`,theme:n=ve}=e;if(typeof n==`string`){let e=this.#e.getTheme(n).type;if(n===this.#i&&e===this.#r)return;this.#M(n,e);return}let r=t===`system`?this.#N():t,i=n[r];r===this.#r&&i===this.#i||this.#M(i,r)}#P(e,t){let{theme:n,colorMap:r}=this.#e.setTheme(e),{colors:i={}}=this.#e.getTheme(e),a=i[`editor.selectionBackground`],o=i[`editor.lineHighlightBackground`],s=o!=null&&o.trim()!==``&&!fe.isFullyTransparent(o)?o:void 0,c=i[`editor.lineHighlightBorder`]??(s==null?`color-mix(in lab, var(--diffs-bg) 70%, var(--diffs-fg))`:`transparent`),l=s==null?`100%`:`85%`,u=i[`editorCursor.foreground`],d=i[`editor.findMatchBackground`],f=i[`editor.findMatchHighlightBackground`],p=i[`editorBracketMatch.background`],m=i[`editorBracketMatch.border`],h=i[`editorHint.foreground`],g=i[`editorInfo.foreground`],_=i[`editorWarning.foreground`],v=i[`editorError.foreground`];this.#c(`:host {
2168
2168
  --diffs-editor-selection-bg: ${a??`var(--diffs-line-bg)`};
2169
2169
  --diffs-editor-line-highlight-border: ${c};
2170
2170
  --diffs-editor-active-line-source-mix: ${l};
@@ -2195,7 +2195,7 @@ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{n as t,r as n,t as r}f
2195
2195
  --trees-font-size-override: 12px;
2196
2196
  }
2197
2197
  button[data-type='item'] { border-radius: 5px; }
2198
- `;function $p(e){return e.kind===`directory`?`${e.path}/`:e.path}function em({environmentId:e,cwd:t,projectName:n,onOpenFile:r}){let{resolvedTheme:a}=m(),o=We(),s=Ie(e,t),c=s.data?.entries??[],l=(0,J.useMemo)(()=>new Map(c.map(e=>[e.path,e.kind])),[c]),u=(0,J.useRef)(l),d=(0,J.useMemo)(()=>c.map($p),[c]),f=(0,J.useRef)([]),p=(0,J.useRef)(null);(0,J.useEffect)(()=>{let e=e=>{p.current={x:e.clientX,y:e.clientY,at:e.timeStamp}};return document.addEventListener(`contextmenu`,e,!0),()=>document.removeEventListener(`contextmenu`,e,!0)},[]);let g=async(e,t)=>{let n=i();if(!n){t.close();return}let r=e.path.replace(/\/$/,``),a=qe(r),s=p.current,c=s!==null&&performance.now()-s.at<1e3,l=t.anchorElement.getBoundingClientRect(),u=c?{x:s.x,y:s.y}:{x:l.left,y:l.bottom};try{let e=await n.contextMenu.show([{id:`copy-mention`,label:`Copy mention`},{id:`add-to-chat`,label:`Add to chat`}],u);if(e===`copy-mention`){try{await S(a),h.add({type:`success`,title:`Mention copied`,description:r})}catch(e){h.add({type:`error`,title:`Failed to copy mention`,description:e instanceof Error?e.message:`An error occurred.`})}return}if(e===`add-to-chat`){let e=o?.current;if(!e){h.add({type:`error`,title:`Unable to add to chat`,description:`Open a chat for this project and try again.`});return}e.insertTextAtEnd(`${a} `,{ensureLeadingBoundary:!0})||h.add({type:`error`,title:`Unable to add to chat`,description:`The chat isn't ready to accept input right now.`})}}finally{t.close()}},_=(0,J.useRef)(g);(0,J.useEffect)(()=>{_.current=g});let v=(0,J.useRef)(null),y=(0,J.useMemo)(()=>Zp({deselect:e=>v.current?.getItem(e)?.deselect()}),[]),{model:b}=Jp({composition:{contextMenu:{triggerMode:`right-click`,onOpen:(e,t)=>{_.current(e,t)}}},dragAndDrop:{canDrop:()=>!1},density:`compact`,fileTreeSearchMode:`hide-non-matches`,flattenEmptyDirectories:!0,initialExpansion:1,icons:re,onSelectionChange:e=>{if(y.handleSelectionChange(e),y.isDragInProgress())return;let t=e.at(-1)?.replace(/\/$/,``);t&&u.current.get(t)===`file`&&r(t)},paths:[],search:!0,unsafeCSS:Qp});(0,J.useEffect)(()=>{f.current!==d&&(u.current=l,f.current=d,b.resetPaths(d))},[l,b,d]);let x=(0,J.useMemo)(()=>c.reduce((e,t)=>e+ +(t.kind===`file`),0),[c]),C=(0,J.useRef)(null);return(0,J.useEffect)(()=>{v.current=b},[b]),(0,J.useEffect)(()=>{let e=C.current;if(e===null)return;let t=e=>y.handleDragStart(e),n=()=>y.handleDragEnd();return e.addEventListener(`dragstart`,t,!0),e.addEventListener(`dragend`,n),()=>{e.removeEventListener(`dragstart`,t,!0),e.removeEventListener(`dragend`,n)}},[y]),(0,Y.jsxs)(`div`,{ref:C,className:`flex min-h-0 flex-1 flex-col bg-background`,"data-file-browser-panel":`${e}:${t}`,children:[(0,Y.jsxs)(`div`,{className:`flex h-9 shrink-0 items-center gap-2 border-b border-border/60 px-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`div`,{className:`truncate text-xs font-medium text-foreground`,children:n}),(0,Y.jsxs)(`div`,{className:`truncate text-[10px] leading-none text-muted-foreground`,children:[s.isPending&&s.data===null?`Indexing…`:`${x.toLocaleString()} files`,s.data?.truncated?` · partial`:``]})]}),(0,Y.jsx)(`button`,{type:`button`,className:`rounded-md p-1.5 text-muted-foreground hover:bg-accent hover:text-foreground`,"aria-label":`Search workspace files`,onClick:()=>b.openSearch(),children:(0,Y.jsx)(rt,{className:`size-3.5`})}),(0,Y.jsx)(`button`,{type:`button`,className:`rounded-md p-1.5 text-muted-foreground hover:bg-accent hover:text-foreground`,"aria-label":`Refresh workspace files`,onClick:s.refresh,children:(0,Y.jsx)(me,{className:w(`size-3.5`,s.isPending&&`animate-spin`)})})]}),s.error&&s.data===null?(0,Y.jsx)(`div`,{className:`p-4 text-xs leading-relaxed text-destructive`,children:s.error}):(0,Y.jsx)(qp,{model:b,"aria-label":`${n} files`,className:`min-h-0 flex-1 overflow-hidden`,style:{colorScheme:a,"--trees-fg-override":`var(--foreground)`}})]})}function tm(e){let t=(0,Yp.c)(11),{open:n,title:r,onOpenChange:i,children:a}=e,o;t[0]===r?o=t[1]:(o=(0,Y.jsx)(oe,{className:`shrink-0 border-b border-border/60 px-4 py-2.5 pe-12 text-sm font-medium`,children:r}),t[0]=r,t[1]=o);let s;t[2]===a?s=t[3]:(s=(0,Y.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:a}),t[2]=a,t[3]=s);let c;t[4]!==o||t[5]!==s?(c=(0,Y.jsxs)(ce,{className:`row-start-1 row-end-4 flex h-full max-h-full w-full max-w-none flex-col overflow-hidden p-0`,bottomStickOnMobile:!1,children:[o,s]}),t[4]=o,t[5]=s,t[6]=c):c=t[6];let l;return t[7]!==i||t[8]!==n||t[9]!==c?(l=(0,Y.jsx)(Se,{open:n,onOpenChange:i,children:c}),t[7]=i,t[8]=n,t[9]=c,t[10]=l):l=t[10],l}var nm=1024,rm=[`B`,`KB`,`MB`,`GB`,`TB`];function im(e){if(!Number.isFinite(e)||e<0)return`unknown size`;let t=e,n=0;for(;t>=nm&&n<rm.length-1;)t/=nm,n+=1;return`${n===0?t:Math.round(t*10)/10} ${rm[n]}`}function am(e){let t=e.lastIndexOf(`.`);return t<=0||t===e.length-1?`File`:`${e.slice(t+1).toUpperCase()} file`}function om(e){let t=(0,Yp.c)(35),{environmentId:n,keybindings:r,availableEditors:a,absolutePath:o,name:s,byteLength:c,canRevealInFileManager:l}=e,u;t[0]===o?u=t[1]:(u=()=>{let e=i();e&&e.shell.showItemInFolder(o).catch(cm)},t[0]=o,t[1]=u);let d=u,f;t[2]===o?f=t[3]:(f=()=>{if(!navigator.clipboard?.writeText){h.add(v({type:`error`,title:`Failed to copy path`,description:`Clipboard API unavailable.`}));return}navigator.clipboard.writeText(o).then(()=>h.add({type:`success`,title:`Path copied`,description:o}),sm)},t[2]=o,t[3]=f);let p=f,m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Y.jsx)(st,{className:`mt-0.5 size-5 shrink-0 text-muted-foreground`}),t[4]=m):m=t[4];let g;t[5]===s?g=t[6]:(g=(0,Y.jsx)(`div`,{className:`truncate text-sm font-medium`,title:s,children:s}),t[5]=s,t[6]=g);let _;t[7]===s?_=t[8]:(_=am(s),t[7]=s,t[8]=_);let y;t[9]===c?y=t[10]:(y=im(c),t[9]=c,t[10]=y);let b;t[11]!==_||t[12]!==y?(b=(0,Y.jsxs)(`div`,{className:`mt-0.5 text-xs text-muted-foreground`,children:[_,` · `,y]}),t[11]=_,t[12]=y,t[13]=b):b=t[13];let x;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Y.jsx)(`div`,{className:`mt-1 text-xs leading-relaxed text-muted-foreground`,children:`This file cannot be shown here.`}),t[14]=x):x=t[14];let S;t[15]!==g||t[16]!==b?(S=(0,Y.jsxs)(`div`,{className:`flex items-start gap-3`,children:[m,(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[g,b,x]})]}),t[15]=g,t[16]=b,t[17]=S):S=t[17];let C;t[18]!==o||t[19]!==a||t[20]!==n||t[21]!==r?(C=(0,Y.jsx)(Ue,{environmentId:n,keybindings:r,availableEditors:a,openInCwd:o,compact:!0,enableShortcut:!1}),t[18]=o,t[19]=a,t[20]=n,t[21]=r,t[22]=C):C=t[22];let w;t[23]!==l||t[24]!==d?(w=l?(0,Y.jsxs)(j,{variant:`outline`,size:`sm`,onClick:d,children:[(0,Y.jsx)(Pe,{className:`size-3.5`}),`Reveal in Finder`]}):null,t[23]=l,t[24]=d,t[25]=w):w=t[25];let T;t[26]===p?T=t[27]:(T=(0,Y.jsx)(j,{variant:`outline`,size:`sm`,onClick:p,children:`Copy path`}),t[26]=p,t[27]=T);let E;t[28]!==C||t[29]!==w||t[30]!==T?(E=(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[C,w,T]}),t[28]=C,t[29]=w,t[30]=T,t[31]=E):E=t[31];let D;return t[32]!==E||t[33]!==S?(D=(0,Y.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-6`,children:(0,Y.jsxs)(`div`,{className:`flex w-full max-w-md flex-col gap-4 rounded-lg border border-border/60 bg-card p-5`,children:[S,E]})}),t[32]=E,t[33]=S,t[34]=D):D=t[34],D}function sm(e){return h.add(v({type:`error`,title:`Failed to copy path`,description:e instanceof Error?e.message:`An error occurred.`}))}function cm(e){h.add(v({type:`error`,title:`Unable to reveal file`,description:e instanceof Error?e.message:`An error occurred.`}))}function lm({root:e,resolveEditor:t,onDismiss:n}){n(),t()?.setSelections([]);let r=e.querySelector(`diffs-container`)?.shadowRoot?.activeElement;r instanceof HTMLElement&&r.blur()}function um(e){return e.querySelector(`diffs-container`)?.shadowRoot?.activeElement?.hasAttribute(`data-content`)===!0}function dm({root:e,resolveEditor:t,isBlocked:n,onDismiss:r}){let i=i=>{n()||i.composedPath().includes(e)||lm({root:e,resolveEditor:t,onDismiss:r})},a=i=>{i.key!==`Escape`||n()||!um(e)||(i.preventDefault(),i.stopImmediatePropagation(),lm({root:e,resolveEditor:t,onDismiss:r}))};return document.addEventListener(`pointerdown`,i,!0),document.addEventListener(`keydown`,a,!0),()=>{document.removeEventListener(`pointerdown`,i,!0),document.removeEventListener(`keydown`,a,!0)}}function fm(e){let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return`${e.length}:${(t>>>0).toString(36)}`}function pm(e,t,n){return`${e}:${t}:${fm(n)}`}function mm(e,t){let n=t.split(`/`).filter(Boolean);return[{label:e,path:``,kind:`project`},...n.map((e,t)=>({label:e,path:n.slice(0,t+1).join(`/`),kind:t===n.length-1?`file`:`directory`}))]}var hm=e=>/\.(?:md|mdx)$/i.test(e);function gm(e,t,n){return t<0||e[t]!==`[`||!/[ xX]/.test(e[t+1]??``)||e[t+2]!==`]`?e:`${e.slice(0,t+1)}${n?`x`:` `}${e.slice(t+2)}`}var _m=class{options;timer=null;latestContents=``;latestRevision=0;lastChangeAt=0;saving=!1;disposed=!1;constructor(e){this.options=e}change(e){this.latestContents=e,this.latestRevision+=1,this.lastChangeAt=Date.now(),this.options.onPendingChange(!0),this.schedule(this.options.debounceMs)}dispose(){this.disposed=!0,this.clearTimer(),this.latestRevision>0&&this.persistLatest()}schedule(e){this.clearTimer(),this.timer=setTimeout(()=>{this.timer=null,this.persistLatest()},e)}clearTimer(){this.timer!==null&&(clearTimeout(this.timer),this.timer=null)}async persistLatest(){if(this.saving||this.latestRevision===0)return;this.saving=!0;let e=this.latestContents,t=this.latestRevision,n=(await this.options.persist(e))._tag===`Success`;if(n&&this.options.onConfirmed(e),this.saving=!1,t===this.latestRevision){n&&this.options.onPendingChange(!1);return}let r=Math.max(0,this.options.debounceMs-(Date.now()-this.lastChangeAt));this.disposed?this.persistLatest():this.schedule(r)}},vm=`p4code.fileExplorerOpen`,ym=500,bm=`data-file-link-reveal`,xm=`
2198
+ `;function $p(e){return e.kind===`directory`?`${e.path}/`:e.path}function em({environmentId:e,cwd:t,projectName:n,onOpenFile:r}){let{resolvedTheme:a}=h(),s=We(),c=Ie(e,t),l=c.data?.entries??[],u=(0,J.useMemo)(()=>new Map(l.map(e=>[e.path,e.kind])),[l]),d=(0,J.useRef)(u),f=(0,J.useMemo)(()=>l.map($p),[l]),p=(0,J.useRef)([]),m=(0,J.useRef)(null);(0,J.useEffect)(()=>{let e=e=>{m.current={x:e.clientX,y:e.clientY,at:e.timeStamp}};return document.addEventListener(`contextmenu`,e,!0),()=>document.removeEventListener(`contextmenu`,e,!0)},[]);let _=async(e,t)=>{let n=i();if(!n){t.close();return}let r=e.path.replace(/\/$/,``),a=qe(r),o=m.current,c=o!==null&&performance.now()-o.at<1e3,l=t.anchorElement.getBoundingClientRect(),u=c?{x:o.x,y:o.y}:{x:l.left,y:l.bottom};try{let e=await n.contextMenu.show([{id:`copy-mention`,label:`Copy mention`},{id:`add-to-chat`,label:`Add to chat`}],u);if(e===`copy-mention`){try{await C(a),g.add({type:`success`,title:`Mention copied`,description:r})}catch(e){g.add({type:`error`,title:`Failed to copy mention`,description:e instanceof Error?e.message:`An error occurred.`})}return}if(e===`add-to-chat`){let e=s?.current;if(!e){g.add({type:`error`,title:`Unable to add to chat`,description:`Open a chat for this project and try again.`});return}e.insertTextAtEnd(`${a} `,{ensureLeadingBoundary:!0})||g.add({type:`error`,title:`Unable to add to chat`,description:`The chat isn't ready to accept input right now.`})}}finally{t.close()}},v=(0,J.useRef)(_);(0,J.useEffect)(()=>{v.current=_});let y=(0,J.useRef)(null),b=(0,J.useMemo)(()=>Zp({deselect:e=>y.current?.getItem(e)?.deselect()}),[]),{model:x}=Jp({composition:{contextMenu:{triggerMode:`right-click`,onOpen:(e,t)=>{v.current(e,t)}}},dragAndDrop:{canDrop:()=>!1},density:`compact`,fileTreeSearchMode:`hide-non-matches`,flattenEmptyDirectories:!0,initialExpansion:1,icons:re,onSelectionChange:e=>{if(b.handleSelectionChange(e),b.isDragInProgress())return;let t=e.at(-1)?.replace(/\/$/,``);t&&d.current.get(t)===`file`&&r(t)},paths:[],search:!0,unsafeCSS:Qp});(0,J.useEffect)(()=>{p.current!==f&&(d.current=u,p.current=f,x.resetPaths(f))},[u,x,f]);let S=(0,J.useMemo)(()=>l.reduce((e,t)=>e+ +(t.kind===`file`),0),[l]),w=(0,J.useRef)(null);return(0,J.useEffect)(()=>{y.current=x},[x]),(0,J.useEffect)(()=>{let e=w.current;if(e===null)return;let t=e=>b.handleDragStart(e),n=()=>b.handleDragEnd();return e.addEventListener(`dragstart`,t,!0),e.addEventListener(`dragend`,n),()=>{e.removeEventListener(`dragstart`,t,!0),e.removeEventListener(`dragend`,n)}},[b]),(0,Y.jsxs)(`div`,{ref:w,className:`flex min-h-0 flex-1 flex-col bg-background`,"data-file-browser-panel":`${e}:${t}`,children:[(0,Y.jsxs)(`div`,{className:`flex h-9 shrink-0 items-center gap-2 border-b border-border/60 px-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`div`,{className:`truncate text-xs font-medium text-foreground`,children:n}),(0,Y.jsxs)(`div`,{className:`truncate text-[10px] leading-none text-muted-foreground`,children:[c.isPending&&c.data===null?`Indexing…`:`${S.toLocaleString()} files`,c.data?.truncated?` · partial`:``]})]}),(0,Y.jsx)(`button`,{type:`button`,className:`rounded-md p-1.5 text-muted-foreground hover:bg-accent hover:text-foreground`,"aria-label":`Search workspace files`,onClick:()=>x.openSearch(),children:(0,Y.jsx)(rt,{className:`size-3.5`})}),(0,Y.jsx)(`button`,{type:`button`,className:`rounded-md p-1.5 text-muted-foreground hover:bg-accent hover:text-foreground`,"aria-label":`Refresh workspace files`,onClick:c.refresh,children:(0,Y.jsx)(me,{className:o(`size-3.5`,c.isPending&&`animate-spin`)})})]}),c.error&&c.data===null?(0,Y.jsx)(`div`,{className:`p-4 text-xs leading-relaxed text-destructive`,children:c.error}):(0,Y.jsx)(qp,{model:x,"aria-label":`${n} files`,className:`min-h-0 flex-1 overflow-hidden`,style:{colorScheme:a,"--trees-fg-override":`var(--foreground)`}})]})}function tm(e){let t=(0,Yp.c)(11),{open:n,title:r,onOpenChange:i,children:a}=e,o;t[0]===r?o=t[1]:(o=(0,Y.jsx)(oe,{className:`shrink-0 border-b border-border/60 px-4 py-2.5 pe-12 text-sm font-medium`,children:r}),t[0]=r,t[1]=o);let s;t[2]===a?s=t[3]:(s=(0,Y.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:a}),t[2]=a,t[3]=s);let c;t[4]!==o||t[5]!==s?(c=(0,Y.jsxs)(ce,{className:`row-start-1 row-end-4 flex h-full max-h-full w-full max-w-none flex-col overflow-hidden p-0`,bottomStickOnMobile:!1,children:[o,s]}),t[4]=o,t[5]=s,t[6]=c):c=t[6];let l;return t[7]!==i||t[8]!==n||t[9]!==c?(l=(0,Y.jsx)(Se,{open:n,onOpenChange:i,children:c}),t[7]=i,t[8]=n,t[9]=c,t[10]=l):l=t[10],l}var nm=1024,rm=[`B`,`KB`,`MB`,`GB`,`TB`];function im(e){if(!Number.isFinite(e)||e<0)return`unknown size`;let t=e,n=0;for(;t>=nm&&n<rm.length-1;)t/=nm,n+=1;return`${n===0?t:Math.round(t*10)/10} ${rm[n]}`}function am(e){let t=e.lastIndexOf(`.`);return t<=0||t===e.length-1?`File`:`${e.slice(t+1).toUpperCase()} file`}function om(e){let t=(0,Yp.c)(35),{environmentId:n,keybindings:r,availableEditors:a,absolutePath:o,name:c,byteLength:l,canRevealInFileManager:u}=e,d;t[0]===o?d=t[1]:(d=()=>{let e=i();e&&e.shell.showItemInFolder(o).catch(cm)},t[0]=o,t[1]=d);let f=d,p;t[2]===o?p=t[3]:(p=()=>{if(!navigator.clipboard?.writeText){g.add(v({type:`error`,title:`Failed to copy path`,description:`Clipboard API unavailable.`}));return}navigator.clipboard.writeText(o).then(()=>g.add({type:`success`,title:`Path copied`,description:o}),sm)},t[2]=o,t[3]=p);let m=p,h;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Y.jsx)(st,{className:`mt-0.5 size-5 shrink-0 text-muted-foreground`}),t[4]=h):h=t[4];let _;t[5]===c?_=t[6]:(_=(0,Y.jsx)(`div`,{className:`truncate text-sm font-medium`,title:c,children:c}),t[5]=c,t[6]=_);let y;t[7]===c?y=t[8]:(y=am(c),t[7]=c,t[8]=y);let b;t[9]===l?b=t[10]:(b=im(l),t[9]=l,t[10]=b);let x;t[11]!==y||t[12]!==b?(x=(0,Y.jsxs)(`div`,{className:`mt-0.5 text-xs text-muted-foreground`,children:[y,` · `,b]}),t[11]=y,t[12]=b,t[13]=x):x=t[13];let S;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Y.jsx)(`div`,{className:`mt-1 text-xs leading-relaxed text-muted-foreground`,children:`This file cannot be shown here.`}),t[14]=S):S=t[14];let C;t[15]!==_||t[16]!==x?(C=(0,Y.jsxs)(`div`,{className:`flex items-start gap-3`,children:[h,(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[_,x,S]})]}),t[15]=_,t[16]=x,t[17]=C):C=t[17];let w;t[18]!==o||t[19]!==a||t[20]!==n||t[21]!==r?(w=(0,Y.jsx)(Ue,{environmentId:n,keybindings:r,availableEditors:a,openInCwd:o,compact:!0,enableShortcut:!1}),t[18]=o,t[19]=a,t[20]=n,t[21]=r,t[22]=w):w=t[22];let T;t[23]!==u||t[24]!==f?(T=u?(0,Y.jsxs)(s,{variant:`outline`,size:`sm`,onClick:f,children:[(0,Y.jsx)(Pe,{className:`size-3.5`}),`Reveal in Finder`]}):null,t[23]=u,t[24]=f,t[25]=T):T=t[25];let E;t[26]===m?E=t[27]:(E=(0,Y.jsx)(s,{variant:`outline`,size:`sm`,onClick:m,children:`Copy path`}),t[26]=m,t[27]=E);let D;t[28]!==w||t[29]!==T||t[30]!==E?(D=(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[w,T,E]}),t[28]=w,t[29]=T,t[30]=E,t[31]=D):D=t[31];let O;return t[32]!==D||t[33]!==C?(O=(0,Y.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-6`,children:(0,Y.jsxs)(`div`,{className:`flex w-full max-w-md flex-col gap-4 rounded-lg border border-border/60 bg-card p-5`,children:[C,D]})}),t[32]=D,t[33]=C,t[34]=O):O=t[34],O}function sm(e){return g.add(v({type:`error`,title:`Failed to copy path`,description:e instanceof Error?e.message:`An error occurred.`}))}function cm(e){g.add(v({type:`error`,title:`Unable to reveal file`,description:e instanceof Error?e.message:`An error occurred.`}))}function lm({root:e,resolveEditor:t,onDismiss:n}){n(),t()?.setSelections([]);let r=e.querySelector(`diffs-container`)?.shadowRoot?.activeElement;r instanceof HTMLElement&&r.blur()}function um(e){return e.querySelector(`diffs-container`)?.shadowRoot?.activeElement?.hasAttribute(`data-content`)===!0}function dm({root:e,resolveEditor:t,isBlocked:n,onDismiss:r}){let i=i=>{n()||i.composedPath().includes(e)||lm({root:e,resolveEditor:t,onDismiss:r})},a=i=>{i.key!==`Escape`||n()||!um(e)||(i.preventDefault(),i.stopImmediatePropagation(),lm({root:e,resolveEditor:t,onDismiss:r}))};return document.addEventListener(`pointerdown`,i,!0),document.addEventListener(`keydown`,a,!0),()=>{document.removeEventListener(`pointerdown`,i,!0),document.removeEventListener(`keydown`,a,!0)}}function fm(e){let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return`${e.length}:${(t>>>0).toString(36)}`}function pm(e,t,n){return`${e}:${t}:${fm(n)}`}function mm(e,t){let n=t.split(`/`).filter(Boolean);return[{label:e,path:``,kind:`project`},...n.map((e,t)=>({label:e,path:n.slice(0,t+1).join(`/`),kind:t===n.length-1?`file`:`directory`}))]}var hm=e=>/\.(?:md|mdx)$/i.test(e);function gm(e,t,n){return t<0||e[t]!==`[`||!/[ xX]/.test(e[t+1]??``)||e[t+2]!==`]`?e:`${e.slice(0,t+1)}${n?`x`:` `}${e.slice(t+2)}`}var _m=class{options;timer=null;latestContents=``;latestRevision=0;lastChangeAt=0;saving=!1;disposed=!1;constructor(e){this.options=e}change(e){this.latestContents=e,this.latestRevision+=1,this.lastChangeAt=Date.now(),this.options.onPendingChange(!0),this.schedule(this.options.debounceMs)}dispose(){this.disposed=!0,this.clearTimer(),this.latestRevision>0&&this.persistLatest()}schedule(e){this.clearTimer(),this.timer=setTimeout(()=>{this.timer=null,this.persistLatest()},e)}clearTimer(){this.timer!==null&&(clearTimeout(this.timer),this.timer=null)}async persistLatest(){if(this.saving||this.latestRevision===0)return;this.saving=!0;let e=this.latestContents,t=this.latestRevision,n=(await this.options.persist(e))._tag===`Success`;if(n&&this.options.onConfirmed(e),this.saving=!1,t===this.latestRevision){n&&this.options.onPendingChange(!1);return}let r=Math.max(0,this.options.debounceMs-(Date.now()-this.lastChangeAt));this.disposed?this.persistLatest():this.schedule(r)}},vm=`p4code.fileExplorerOpen`,ym=500,bm=`data-file-link-reveal`,xm=`
2199
2199
  [${bm}][data-line] {
2200
2200
  background-color: light-dark(
2201
2201
  color-mix(
@@ -2226,5 +2226,5 @@ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{n as t,r as n,t as r}f
2226
2226
  ) !important;
2227
2227
  color: var(--diffs-selection-number-fg) !important;
2228
2228
  }
2229
- `;function Sm(e){let t=(0,Yp.c)(5),n=Ve(e.environmentId,e.resource),[r,i]=(0,J.useState)(null);if(n._tag===`Failure`||n._tag===`Success`&&r===n.url){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center px-6 text-center text-xs leading-relaxed text-destructive`,children:`Unable to load image.`}),t[0]=e):e=t[0],e}let a;return t[1]!==n._tag||t[2]!==n.url||t[3]!==e.alt?(a=n._tag===`Success`?(0,Y.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-auto p-4`,children:(0,Y.jsx)(`img`,{className:`max-h-full max-w-full object-contain`,src:n.url,alt:e.alt,onError:()=>i(n.url)})}):(0,Y.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center text-muted-foreground`,children:(0,Y.jsx)(_,{className:`size-5 animate-spin`})}),t[1]=n._tag,t[2]=n.url,t[3]=e.alt,t[4]=a):a=t[4],a}function Cm(e,t){let n=1;for(let t=0;t<e.length;t+=1){let r=e.charCodeAt(t);r===10?n+=1:r===13&&(n+=1,e.charCodeAt(t+1)===10&&(t+=1))}return Math.min(Math.max(1,t),n)}function wm(e,t){let n=e.shadowRoot??e;for(let e of n.querySelectorAll(`[${bm}]`))e.removeAttribute(bm);t!==null&&(n.querySelector(`[data-line="${t}"]`)?.setAttribute(bm,``),n.querySelector(`[data-column-number="${t}"]`)?.setAttribute(bm,``))}function Tm(e,t,n){let r=(0,Yp.c)(7),[i]=(0,J.useState)(Om),[a]=(0,J.useState)(Dm),[o]=(0,J.useState)(Em),s;return r[0]!==i||r[1]!==a||r[2]!==o||r[3]!==e||r[4]!==t||r[5]!==n?(s=(r,s,c)=>{if(e===null)return;let l=()=>{let t=o.get(e);t!==void 0&&(cancelAnimationFrame(t),o.delete(e))};if(c===`unmount`){l();return}let u=t===null?null:Cm(s.file?.contents??``,t);if(wm(r,u),!(s instanceof M))return;if(a.get(e)!==n&&(l(),a.set(e,n)),u===null){r.style.minHeight=``;return}let d=r.closest(`.file-preview-virtualizer`);!d||(r.style.minHeight=`${Math.ceil(Math.max(s.height,d.clientHeight))}px`,i.get(e)===n||o.has(e))||o.set(e,requestAnimationFrame(()=>{if(o.delete(e),a.get(e)!==n||!r.isConnected)return;let t=s.getLinePosition(u);if(!t)return;let c=d.scrollTop+r.getBoundingClientRect().top-d.getBoundingClientRect().top,l=Math.max(0,c+t.top-Math.max(0,(d.clientHeight-t.height)/2)),f=Math.max(0,d.scrollHeight-d.clientHeight);d.scrollTop=Math.min(l,f),i.set(e,n)}))},r[0]=i,r[1]=a,r[2]=o,r[3]=e,r[4]=t,r[5]=n,r[6]=s):s=r[6],s}function Em(){return new Map}function Dm(){return new Map}function Om(){return new Map}function km(e){let t=(0,Yp.c)(19),{environmentId:n,cwd:r,relativePath:i,onPendingChange:a}=e,o=A(be.writeFile),s;t[0]!==a||t[1]!==i?(s=e=>a(i,e),t[0]=a,t[1]=i,t[2]=s):s=t[2];let c;t[3]!==r||t[4]!==n||t[5]!==i||t[6]!==o?(c=e=>o({environmentId:n,input:{cwd:r,relativePath:i,contents:e}}),t[3]=r,t[4]=n,t[5]=i,t[6]=o,t[7]=c):c=t[7];let l;t[8]!==r||t[9]!==n||t[10]!==i?(l=e=>{He(n,r,i,e)},t[8]=r,t[9]=n,t[10]=i,t[11]=l):l=t[11];let u;t[12]!==s||t[13]!==c||t[14]!==l?(u=new _m({debounceMs:ym,onPendingChange:s,persist:c,onConfirmed:l}),t[12]=s,t[13]=c,t[14]=l,t[15]=u):u=t[15];let d=u,f,p;return t[16]===d?(f=t[17],p=t[18]):(f=()=>()=>d.dispose(),p=[d],t[16]=d,t[17]=f,t[18]=p),(0,J.useEffect)(f,p),d}function Am(e){let t=(0,Yp.c)(73),{environmentId:n,cwd:r,relativePath:i,composerDraftTarget:a,contents:o,resolvedTheme:s,revealRequestId:c,wordWrap:l,onPostRender:u,onPendingChange:f}=e,m=d(Lm),h=d(Im),g;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(g=[],t[0]=g):g=t[0];let[_,v]=(0,J.useState)(g),[y,b]=(0,J.useState)(null),x=y?.revealRequestId===c?y.range:null,S;t[1]===c?S=t[2]:(S=e=>{b({revealRequestId:c,range:e})},t[1]=c,t[2]=S);let C=S,w=(0,J.useRef)(null),T=(0,J.useRef)(null),E;t[3]!==r||t[4]!==n||t[5]!==f||t[6]!==i?(E={environmentId:n,cwd:r,relativePath:i,onPendingChange:f},t[3]=r,t[4]=n,t[5]=f,t[6]=i,t[7]=E):E=t[7];let D=km(E),ee=(0,J.useRef)(null),O;t[8]!==m||t[9]!==a||t[10]!==r||t[11]!==n||t[12]!==i||t[13]!==D?(O=(e,t)=>{if(Ne(n,r,i,e.contents),D.change(e.contents),t){let n=at(t);v(n);for(let t of n)for(let n of t.metadata.entries)n.kind===`comment`&&m(a,p({id:n.id,filePath:i,startLine:n.startLine,endLine:n.endLine,text:n.text,contents:e.contents}))}},t[8]=m,t[9]=a,t[10]=r,t[11]=n,t[12]=i,t[13]=D,t[14]=O):O=t[14];let k=O,A;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(A=e=>{let t=new Vp(e);return ee.current=t,t},t[15]=A):A=t[15];let j=A,M,N;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(M=()=>()=>{ee.current?.cleanUp(),ee.current=null},N=[],t[16]=M,t[17]=N):(M=t[16],N=t[17]),(0,J.useEffect)(M,N);let P;t[18]!==a||t[19]!==h||t[20]!==C?(P=e=>{C(null),h(a,e),v(t=>t.flatMap(t=>{let n=t.metadata.entries.filter(t=>t.id!==e);return n.length>0?[{...t,metadata:{entries:n}}]:[]}))},t[18]=a,t[19]=h,t[20]=C,t[21]=P):P=t[21];let te=P,ne;t[22]!==m||t[23]!==a||t[24]!==o||t[25]!==_||t[26]!==i||t[27]!==C?(ne=(e,t)=>{C(null);let n=_.flatMap(Fm).find(t=>t.id===e);n&&m(a,p({id:n.id,filePath:i,startLine:n.startLine,endLine:n.endLine,text:t,contents:o})),v(n=>n.map(n=>({...n,metadata:{entries:n.metadata.entries.map(n=>n.id===e?{...n,kind:`comment`,text:t}:n)}})))},t[22]=m,t[23]=a,t[24]=o,t[25]=_,t[26]=i,t[27]=C,t[28]=ne):ne=t[28];let re=ne,ie;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(ie=e=>{let{startLine:t,endLine:n}=R(e),r={id:ot(),kind:`draft`,startLine:t,endLine:n,text:``};v(e=>{let t=e.flatMap(Nm),i=t.findIndex(e=>e.lineNumber===n);return i<0?[...t,{lineNumber:n,metadata:{entries:[r]}}]:t.map((e,t)=>t===i?{...e,metadata:{entries:[...e.metadata.entries,r]}}:e)})},t[29]=ie):ie=t[29];let ae=ie,oe;t[30]===_?oe=t[31]:(oe=_.some(jm),t[30]=_,t[31]=oe);let se=oe,ce,le;t[32]!==se||t[33]!==C?(ce=()=>{let e=w.current;if(e)return dm({root:e,resolveEditor:()=>ee.current,isBlocked:()=>se,onDismiss:()=>C(null)})},le=[se,C],t[32]=se,t[33]=C,t[34]=ce,t[35]=le):(ce=t[34],le=t[35]),(0,J.useEffect)(ce,le);let ue;t[36]===C?ue=t[37]:(ue=e=>{C(e),e&&ae(e)},t[36]=C,t[37]=ue);let de=ue,fe;t[38]!==u||t[39]!==x?(fe=(e,t,n)=>{u(e,t,n),T.current!==null&&(cancelAnimationFrame(T.current),T.current=null),n!==`unmount`&&(T.current=requestAnimationFrame(()=>{T.current=null,e.isConnected&&t.setSelectedLines(x,{notify:!1})}))},t[38]=u,t[39]=x,t[40]=fe):fe=t[40];let pe=fe,me;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(me={overscrollSize:600,intersectionObserverMargin:1200},t[41]=me):me=t[41];let F;t[42]!==o||t[43]!==r||t[44]!==i?(F=pm(r,i,o),t[42]=o,t[43]=r,t[44]=i,t[45]=F):F=t[45];let he;t[46]!==o||t[47]!==i||t[48]!==F?(he={name:i,contents:o,cacheKey:F},t[46]=o,t[47]=i,t[48]=F,t[49]=he):he=t[49];let I=!se,ge=!se,_e=l?`wrap`:`scroll`,ve;t[50]===s?ve=t[51]:(ve=Me(s),t[50]=s,t[51]=ve);let ye;t[52]!==de||t[53]!==pe||t[54]!==s||t[55]!==C||t[56]!==I||t[57]!==ge||t[58]!==_e||t[59]!==ve?(ye={disableFileHeader:!0,enableGutterUtility:I,enableLineSelection:ge,onGutterUtilityClick:C,onLineSelectionChange:C,onLineSelectionEnd:de,overflow:_e,theme:ve,themeType:s,unsafeCSS:xm,onPostRender:pe},t[52]=de,t[53]=pe,t[54]=s,t[55]=C,t[56]=I,t[57]=ge,t[58]=_e,t[59]=ve,t[60]=ye):ye=t[60];let be;t[61]!==te||t[62]!==re?(be=e=>(0,Y.jsx)(`div`,{className:`py-1`,children:e.metadata.entries.map(e=>(0,Y.jsx)(it,{kind:e.kind,rangeLabel:z(e.startLine,e.endLine),text:e.text,onCancel:()=>te(e.id),onComment:t=>re(e.id,t),onDelete:()=>te(e.id)},e.id))}),t[61]=te,t[62]=re,t[63]=be):be=t[63];let Se;t[64]===k?Se=t[65]:(Se={onChange:k},t[64]=k,t[65]=Se);let Ce;return t[66]!==_||t[67]!==x||t[68]!==he||t[69]!==ye||t[70]!==be||t[71]!==Se?(Ce=(0,Y.jsx)(xe,{createEditor:j,children:(0,Y.jsx)(`div`,{ref:w,className:`flex min-h-0 flex-1`,children:(0,Y.jsx)(Qe,{className:`file-preview-virtualizer min-h-0 flex-1 overflow-auto`,config:me,children:(0,Y.jsx)(Jl,{file:he,options:ye,selectedLines:x,lineAnnotations:_,renderAnnotation:be,className:`min-h-full`,edit:!0,editorOptions:Se})})})}),t[66]=_,t[67]=x,t[68]=he,t[69]=ye,t[70]=be,t[71]=Se,t[72]=Ce):Ce=t[72],Ce}function jm(e){return e.metadata.entries.some(Mm)}function Mm(e){return e.kind===`draft`}function Nm(e){let t=e.metadata.entries.filter(Pm);return t.length>0?[{...e,metadata:{entries:t}}]:[]}function Pm(e){return e.kind!==`draft`}function Fm(e){return e.metadata.entries}function Im(e){return e.removeReviewComment}function Lm(e){return e.addReviewComment}function Rm(e){let t=(0,Yp.c)(17),{environmentId:n,cwd:r,relativePath:i,contents:a,threadRef:o,readOnly:s,onPendingChange:c}=e,l;t[0]!==r||t[1]!==n||t[2]!==c||t[3]!==i?(l={environmentId:n,cwd:r,relativePath:i,onPendingChange:c},t[0]=r,t[1]=n,t[2]=c,t[3]=i,t[4]=l):l=t[4];let u=km(l),d;t[5]!==a||t[6]!==r||t[7]!==n||t[8]!==s||t[9]!==i||t[10]!==u?(d=s?{}:{onTaskListChange:e=>{let{markerOffset:t,checked:o}=e,s=Ze(n,r,i)?.contents??a,c=gm(s,t,o);c!==s&&(Ne(n,r,i,c),u.change(c))}},t[5]=a,t[6]=r,t[7]=n,t[8]=s,t[9]=i,t[10]=u,t[11]=d):d=t[11];let f;return t[12]!==a||t[13]!==r||t[14]!==d||t[15]!==o?(f=(0,Y.jsx)(ye,{className:`min-h-0 flex-1`,children:(0,Y.jsx)(te,{text:a,cwd:r,threadRef:o,className:`mx-auto max-w-4xl px-6 py-5`,...d})}),t[12]=a,t[13]=r,t[14]=d,t[15]=o,t[16]=f):f=t[16],f}function zm(){try{return a(vm,o)??!0}catch(e){return console.error(e),!0}}function Bm(e){let t=(0,Yp.c)(103),{environmentId:n,cwd:r,projectName:i,workspaceRoot:a,relativePath:o,absolutePath:s,isOutsideWorkspace:d,threadRef:p,composerDraftTarget:S,keybindings:O,availableEditors:j,revealLine:M,revealRequestId:N,onOpenFile:P,onPendingChange:te}=e,{resolvedTheme:re}=m(),ie=ue(Hm),ae=ee(),oe=k(n),se;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(se={reportFailure:!1},t[0]=se):se=t[0];let ce=Re(ne.createUrl,se),le;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(le={reportFailure:!1},t[1]=le):le=t[1];let de=A(l.open,le),fe=n===ae,pe;t[2]===o?pe=t[3]:(pe=o!==null&&T(o),t[2]=o,t[3]=pe);let me=pe,F=Ke(n,r,o,!me,s),[I,ge]=(0,J.useState)(zm),[_e,ve]=(0,J.useState)(!1),be;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(be={path:null,revealRequestId:null},t[4]=be):be=t[4];let[xe,Se]=(0,J.useState)(be),Ce=(0,J.useRef)(null),L;t[5]===o?L=t[6]:(L=o?hm(o):!1,t[5]=o,t[6]=L);let we=L,Te=we&&xe.path===o&&(M===null||xe.revealRequestId===N),Oe;t[7]===o?Oe=t[8]:(Oe=o!==null&&u()&&Fe(o),t[7]=o,t[8]=Oe);let ke=Oe,Ae;t[9]!==r||t[10]!==s||t[11]!==o?(Ae=s??(o?b(o,r):null),t[9]=r,t[10]=s,t[11]=o,t[12]=Ae):Ae=t[12];let je=Ae,Ne;t[13]!==je||t[14]!==fe||t[15]!==p.threadId||t[16]!==a?(Ne=je===null?null:C({filePath:je,threadId:p.threadId,workspaceRoot:a,allowLocalFiles:fe}),t[13]=je,t[14]=fe,t[15]=p.threadId,t[16]=a,t[17]=Ne):Ne=t[17];let Pe=Ne,Ie;t[18]!==r||t[19]!==d||t[20]!==i||t[21]!==o?(Ie=o?mm(d?r:i,o):[],t[18]=r,t[19]=d,t[20]=i,t[21]=o,t[22]=Ie):Ie=t[22];let Le=Ie,ze=Tm(o,M,N),Ve;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(Ve=()=>{(Ce.current?.querySelector(`[data-current-file-crumb='true']`))?.scrollIntoView({block:`nearest`,inline:`end`})},t[23]=Ve):Ve=t[23];let He;t[24]===o?He=t[25]:(He=[o],t[24]=o,t[25]=He),(0,J.useEffect)(Ve,He);let We;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(We=()=>{ge(Vm)},t[26]=We):We=t[26];let Ge=We,qe;t[27]!==je||t[28]!==fe||t[29]!==ce||t[30]!==oe||t[31]!==de||t[32]!==re||t[33]!==p||t[34]!==a?(qe=()=>{!je||!oe||(async()=>{let e=await Xe({threadRef:p,filePath:je,httpBaseUrl:oe,workspaceRoot:a,allowLocalFiles:fe,theme:re,createAssetUrl:ce,openPreview:de});if(e._tag===`Success`||f(e))return;let t=g(e);h.add(v({type:`error`,title:`Unable to open file in browser`,description:t instanceof Error?t.message:`An error occurred.`}))})()},t[27]=je,t[28]=fe,t[29]=ce,t[30]=oe,t[31]=de,t[32]=re,t[33]=p,t[34]=a,t[35]=qe):qe=t[35];let Ze=qe,$e;t[36]!==je||t[37]!==fe||t[38]!==j||t[39]!==S||t[40]!==r||t[41]!==n||t[42]!==F||t[43]!==Pe||t[44]!==me||t[45]!==we||t[46]!==d||t[47]!==O||t[48]!==ze||t[49]!==te||t[50]!==o||t[51]!==Te||t[52]!==re||t[53]!==N||t[54]!==p||t[55]!==ie?($e=o&&me&&Pe?(0,Y.jsx)(Sm,{environmentId:n,resource:Pe,alt:o},je??o):o&&F.error&&F.data===null?(0,Y.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center px-6 text-center text-xs leading-relaxed text-destructive`,children:F.error}):o&&F.data===null?(0,Y.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center text-muted-foreground`,children:(0,Y.jsx)(_,{className:`size-5 animate-spin`})}):o&&F.data?F.data.binary&&je?(0,Y.jsx)(om,{environmentId:n,keybindings:O,availableEditors:j,absolutePath:je,name:o.slice(o.lastIndexOf(`/`)+1),byteLength:F.data.byteLength,canRevealInFileManager:fe&&c()}):we&&Te?(0,Y.jsx)(Rm,{environmentId:n,cwd:r,relativePath:o,threadRef:p,contents:F.data.contents,readOnly:d,onPendingChange:te}):F.data.truncated||d?(0,Y.jsx)(Qe,{className:`file-preview-virtualizer min-h-0 flex-1 overflow-auto`,config:{overscrollSize:600,intersectionObserverMargin:1200},children:(0,Y.jsx)(Jl,{file:{name:o,contents:F.data.contents,cacheKey:pm(r,o,F.data.contents)},options:{disableFileHeader:!0,overflow:ie?`wrap`:`scroll`,theme:Me(re),themeType:re,unsafeCSS:xm,onPostRender:ze},className:`min-h-full`})},`${o}:${re}:${F.data.byteLength}`):(0,Y.jsx)(Am,{environmentId:n,cwd:r,relativePath:o,composerDraftTarget:S,contents:F.data.contents,resolvedTheme:re,revealRequestId:N,wordWrap:ie,onPostRender:ze,onPendingChange:te},`${o}:${re}`):null,t[36]=je,t[37]=fe,t[38]=j,t[39]=S,t[40]=r,t[41]=n,t[42]=F,t[43]=Pe,t[44]=me,t[45]=we,t[46]=d,t[47]=O,t[48]=ze,t[49]=te,t[50]=o,t[51]=Te,t[52]=re,t[53]=N,t[54]=p,t[55]=ie,t[56]=$e):$e=t[56];let et=$e,tt;t[57]!==je||t[58]!==j||t[59]!==Le||t[60]!==ke||t[61]!==n||t[62]!==_e||t[63]!==I||t[64]!==Ze||t[65]!==we||t[66]!==O||t[67]!==ae||t[68]!==i||t[69]!==o||t[70]!==Te||t[71]!==N?(tt=o?(0,Y.jsxs)(`div`,{className:`surface-subheader gap-2 px-3`,"data-surface-subheader":!0,children:[(0,Y.jsx)(ye,{ref:Ce,hideScrollbars:!0,scrollFade:!0,className:`min-w-0 flex-1 rounded-none`,"data-file-breadcrumbs":!0,children:(0,Y.jsx)(`div`,{className:`flex h-full w-max min-w-full items-center text-xs`,children:Le.map((e,t)=>(0,Y.jsxs)(`div`,{className:`flex min-w-0 shrink-0 items-center`,"data-current-file-crumb":e.kind===`file`,children:[t>0?(0,Y.jsx)(E,{className:`mx-1 size-3.5 shrink-0 text-muted-foreground/60`}):null,(0,Y.jsx)(`span`,{className:w(`max-w-40 truncate`,e.kind===`file`?`font-medium text-foreground`:`text-muted-foreground`),title:e.path||i,children:e.label})]},e.path||`project`))})}),je&&n===ae?(0,Y.jsx)(Ue,{environmentId:n,keybindings:O,availableEditors:j,openInCwd:je,compact:!0,enableShortcut:!1}):null,we?(0,Y.jsxs)(x,{children:[(0,Y.jsx)(D,{render:(0,Y.jsx)(Ee,{className:`shrink-0`,pressed:Te,onPressedChange:e=>{Se({path:e?o:null,revealRequestId:e?N:null})},"aria-label":Te?`Show markdown source`:`Show rendered markdown`,variant:`ghost`,size:`sm`,children:Te?(0,Y.jsx)(Be,{className:`size-3.5`}):(0,Y.jsx)(Ye,{className:`size-3.5`})})}),(0,Y.jsx)(y,{children:Te?`Show markdown source`:`Show rendered markdown`})]}):null,ke?(0,Y.jsxs)(x,{children:[(0,Y.jsx)(D,{render:(0,Y.jsx)(Ee,{className:`shrink-0`,pressed:!1,onPressedChange:Ze,"aria-label":`Open file in preview browser`,variant:`ghost`,size:`sm`,children:(0,Y.jsx)(Je,{className:`size-3.5`})})}),(0,Y.jsx)(y,{children:`Open file in preview browser`})]}):null,(0,Y.jsxs)(x,{children:[(0,Y.jsx)(D,{render:(0,Y.jsx)(Ee,{className:`shrink-0`,pressed:_e,onPressedChange:ve,"aria-label":_e?`Collapse file preview`:`Expand file preview`,variant:`ghost`,size:`sm`,children:_e?(0,Y.jsx)(he,{className:`size-3.5`}):(0,Y.jsx)(De,{className:`size-3.5`})})}),(0,Y.jsx)(y,{children:_e?`Collapse file preview`:`Expand file preview`})]}),(0,Y.jsxs)(x,{children:[(0,Y.jsx)(D,{render:(0,Y.jsx)(Ee,{className:`shrink-0`,pressed:I,onPressedChange:Ge,"aria-label":I?`Hide file explorer`:`Show file explorer`,variant:`ghost`,size:`sm`,children:(0,Y.jsx)(ct,{className:`size-3.5`})})}),(0,Y.jsx)(y,{children:I?`Hide file explorer`:`Show file explorer`})]})]}):null,t[57]=je,t[58]=j,t[59]=Le,t[60]=ke,t[61]=n,t[62]=_e,t[63]=I,t[64]=Ze,t[65]=we,t[66]=O,t[67]=ae,t[68]=i,t[69]=o,t[70]=Te,t[71]=N,t[72]=tt):tt=t[72];let nt;t[73]!==F||t[74]!==o?(nt=o&&F.data?.truncated?(0,Y.jsxs)(`div`,{className:`shrink-0 border-b border-amber-500/20 bg-amber-500/8 px-3 py-1.5 text-[11px] text-amber-700 dark:text-amber-300`,children:[`Preview limited to the first 1 MB of a `,F.data.byteLength.toLocaleString(),` byte file.`]}):null,t[73]=F,t[74]=o,t[75]=nt):nt=t[75];let rt=o?`flex`:`hidden`,it;t[76]===rt?it=t[77]:(it=w(`min-w-0 flex-1 flex-col overflow-hidden`,rt),t[76]=rt,t[77]=it);let at;t[78]!==_e||t[79]!==et?(at=_e?(0,Y.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center px-6 text-center text-xs text-muted-foreground`,children:`Shown in the expanded view.`}):et,t[78]=_e,t[79]=et,t[80]=at):at=t[80];let ot;t[81]!==it||t[82]!==at?(ot=(0,Y.jsx)(`div`,{className:it,children:at}),t[81]=it,t[82]=at,t[83]=ot):ot=t[83];let R;t[84]!==r||t[85]!==n||t[86]!==I||t[87]!==P||t[88]!==i||t[89]!==o?(R=I||o===null?(0,Y.jsx)(`aside`,{className:w(`flex min-h-0 shrink-0 bg-background`,o?`w-[min(22rem,46%)] min-w-64 border-l border-border/60`:`min-w-0 flex-1`),children:(0,Y.jsx)(em,{environmentId:n,cwd:r,projectName:i,onOpenFile:P},`${n}:${r}`)}):null,t[84]=r,t[85]=n,t[86]=I,t[87]=P,t[88]=i,t[89]=o,t[90]=R):R=t[90];let z;t[91]!==ot||t[92]!==R?(z=(0,Y.jsxs)(`div`,{className:`flex min-h-0 flex-1 overflow-hidden`,children:[ot,R]}),t[91]=ot,t[92]=R,t[93]=z):z=t[93];let st=_e&&o!==null,lt=o??``,ut;t[94]!==et||t[95]!==st||t[96]!==lt?(ut=(0,Y.jsx)(tm,{open:st,title:lt,onOpenChange:ve,children:et}),t[94]=et,t[95]=st,t[96]=lt,t[97]=ut):ut=t[97];let dt;return t[98]!==tt||t[99]!==nt||t[100]!==z||t[101]!==ut?(dt=(0,Y.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden bg-background`,children:[tt,nt,z,ut]}),t[98]=tt,t[99]=nt,t[100]=z,t[101]=ut,t[102]=dt):dt=t[102],dt}function Vm(e){let t=!e;try{s(vm,t,o)}catch(e){console.error(e)}return t}function Hm(e){return e.wordWrap}export{Bm as default};
2230
- //# sourceMappingURL=FilePreviewPanel-CSGuz1fr.js.map
2229
+ `;function Sm(e){let t=(0,Yp.c)(5),n=Ve(e.environmentId,e.resource),[r,i]=(0,J.useState)(null);if(n._tag===`Failure`||n._tag===`Success`&&r===n.url){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center px-6 text-center text-xs leading-relaxed text-destructive`,children:`Unable to load image.`}),t[0]=e):e=t[0],e}let a;return t[1]!==n._tag||t[2]!==n.url||t[3]!==e.alt?(a=n._tag===`Success`?(0,Y.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-auto p-4`,children:(0,Y.jsx)(`img`,{className:`max-h-full max-w-full object-contain`,src:n.url,alt:e.alt,onError:()=>i(n.url)})}):(0,Y.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center text-muted-foreground`,children:(0,Y.jsx)(D,{className:`size-5 animate-spin`})}),t[1]=n._tag,t[2]=n.url,t[3]=e.alt,t[4]=a):a=t[4],a}function Cm(e,t){let n=1;for(let t=0;t<e.length;t+=1){let r=e.charCodeAt(t);r===10?n+=1:r===13&&(n+=1,e.charCodeAt(t+1)===10&&(t+=1))}return Math.min(Math.max(1,t),n)}function wm(e,t){let n=e.shadowRoot??e;for(let e of n.querySelectorAll(`[${bm}]`))e.removeAttribute(bm);t!==null&&(n.querySelector(`[data-line="${t}"]`)?.setAttribute(bm,``),n.querySelector(`[data-column-number="${t}"]`)?.setAttribute(bm,``))}function Tm(e,t,n){let r=(0,Yp.c)(7),[i]=(0,J.useState)(Om),[a]=(0,J.useState)(Dm),[o]=(0,J.useState)(Em),s;return r[0]!==i||r[1]!==a||r[2]!==o||r[3]!==e||r[4]!==t||r[5]!==n?(s=(r,s,c)=>{if(e===null)return;let l=()=>{let t=o.get(e);t!==void 0&&(cancelAnimationFrame(t),o.delete(e))};if(c===`unmount`){l();return}let u=t===null?null:Cm(s.file?.contents??``,t);if(wm(r,u),!(s instanceof M))return;if(a.get(e)!==n&&(l(),a.set(e,n)),u===null){r.style.minHeight=``;return}let d=r.closest(`.file-preview-virtualizer`);!d||(r.style.minHeight=`${Math.ceil(Math.max(s.height,d.clientHeight))}px`,i.get(e)===n||o.has(e))||o.set(e,requestAnimationFrame(()=>{if(o.delete(e),a.get(e)!==n||!r.isConnected)return;let t=s.getLinePosition(u);if(!t)return;let c=d.scrollTop+r.getBoundingClientRect().top-d.getBoundingClientRect().top,l=Math.max(0,c+t.top-Math.max(0,(d.clientHeight-t.height)/2)),f=Math.max(0,d.scrollHeight-d.clientHeight);d.scrollTop=Math.min(l,f),i.set(e,n)}))},r[0]=i,r[1]=a,r[2]=o,r[3]=e,r[4]=t,r[5]=n,r[6]=s):s=r[6],s}function Em(){return new Map}function Dm(){return new Map}function Om(){return new Map}function km(e){let t=(0,Yp.c)(19),{environmentId:n,cwd:r,relativePath:i,onPendingChange:a}=e,o=j(be.writeFile),s;t[0]!==a||t[1]!==i?(s=e=>a(i,e),t[0]=a,t[1]=i,t[2]=s):s=t[2];let c;t[3]!==r||t[4]!==n||t[5]!==i||t[6]!==o?(c=e=>o({environmentId:n,input:{cwd:r,relativePath:i,contents:e}}),t[3]=r,t[4]=n,t[5]=i,t[6]=o,t[7]=c):c=t[7];let l;t[8]!==r||t[9]!==n||t[10]!==i?(l=e=>{He(n,r,i,e)},t[8]=r,t[9]=n,t[10]=i,t[11]=l):l=t[11];let u;t[12]!==s||t[13]!==c||t[14]!==l?(u=new _m({debounceMs:ym,onPendingChange:s,persist:c,onConfirmed:l}),t[12]=s,t[13]=c,t[14]=l,t[15]=u):u=t[15];let d=u,f,p;return t[16]===d?(f=t[17],p=t[18]):(f=()=>()=>d.dispose(),p=[d],t[16]=d,t[17]=f,t[18]=p),(0,J.useEffect)(f,p),d}function Am(e){let t=(0,Yp.c)(73),{environmentId:n,cwd:r,relativePath:i,composerDraftTarget:o,contents:s,resolvedTheme:c,revealRequestId:u,wordWrap:d,onPostRender:f,onPendingChange:p}=e,m=l(Lm),h=l(Im),g;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(g=[],t[0]=g):g=t[0];let[_,v]=(0,J.useState)(g),[y,b]=(0,J.useState)(null),x=y?.revealRequestId===u?y.range:null,S;t[1]===u?S=t[2]:(S=e=>{b({revealRequestId:u,range:e})},t[1]=u,t[2]=S);let C=S,w=(0,J.useRef)(null),T=(0,J.useRef)(null),E;t[3]!==r||t[4]!==n||t[5]!==p||t[6]!==i?(E={environmentId:n,cwd:r,relativePath:i,onPendingChange:p},t[3]=r,t[4]=n,t[5]=p,t[6]=i,t[7]=E):E=t[7];let D=km(E),O=(0,J.useRef)(null),k;t[8]!==m||t[9]!==o||t[10]!==r||t[11]!==n||t[12]!==i||t[13]!==D?(k=(e,t)=>{if(Ne(n,r,i,e.contents),D.change(e.contents),t){let n=at(t);v(n);for(let t of n)for(let n of t.metadata.entries)n.kind===`comment`&&m(o,a({id:n.id,filePath:i,startLine:n.startLine,endLine:n.endLine,text:n.text,contents:e.contents}))}},t[8]=m,t[9]=o,t[10]=r,t[11]=n,t[12]=i,t[13]=D,t[14]=k):k=t[14];let A=k,ee;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(ee=e=>{let t=new Vp(e);return O.current=t,t},t[15]=ee):ee=t[15];let j=ee,M,N;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(M=()=>()=>{O.current?.cleanUp(),O.current=null},N=[],t[16]=M,t[17]=N):(M=t[16],N=t[17]),(0,J.useEffect)(M,N);let P;t[18]!==o||t[19]!==h||t[20]!==C?(P=e=>{C(null),h(o,e),v(t=>t.flatMap(t=>{let n=t.metadata.entries.filter(t=>t.id!==e);return n.length>0?[{...t,metadata:{entries:n}}]:[]}))},t[18]=o,t[19]=h,t[20]=C,t[21]=P):P=t[21];let te=P,ne;t[22]!==m||t[23]!==o||t[24]!==s||t[25]!==_||t[26]!==i||t[27]!==C?(ne=(e,t)=>{C(null);let n=_.flatMap(Fm).find(t=>t.id===e);n&&m(o,a({id:n.id,filePath:i,startLine:n.startLine,endLine:n.endLine,text:t,contents:s})),v(n=>n.map(n=>({...n,metadata:{entries:n.metadata.entries.map(n=>n.id===e?{...n,kind:`comment`,text:t}:n)}})))},t[22]=m,t[23]=o,t[24]=s,t[25]=_,t[26]=i,t[27]=C,t[28]=ne):ne=t[28];let re=ne,ie;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(ie=e=>{let{startLine:t,endLine:n}=R(e),r={id:ot(),kind:`draft`,startLine:t,endLine:n,text:``};v(e=>{let t=e.flatMap(Nm),i=t.findIndex(e=>e.lineNumber===n);return i<0?[...t,{lineNumber:n,metadata:{entries:[r]}}]:t.map((e,t)=>t===i?{...e,metadata:{entries:[...e.metadata.entries,r]}}:e)})},t[29]=ie):ie=t[29];let ae=ie,oe;t[30]===_?oe=t[31]:(oe=_.some(jm),t[30]=_,t[31]=oe);let se=oe,ce,le;t[32]!==se||t[33]!==C?(ce=()=>{let e=w.current;if(e)return dm({root:e,resolveEditor:()=>O.current,isBlocked:()=>se,onDismiss:()=>C(null)})},le=[se,C],t[32]=se,t[33]=C,t[34]=ce,t[35]=le):(ce=t[34],le=t[35]),(0,J.useEffect)(ce,le);let ue;t[36]===C?ue=t[37]:(ue=e=>{C(e),e&&ae(e)},t[36]=C,t[37]=ue);let de=ue,fe;t[38]!==f||t[39]!==x?(fe=(e,t,n)=>{f(e,t,n),T.current!==null&&(cancelAnimationFrame(T.current),T.current=null),n!==`unmount`&&(T.current=requestAnimationFrame(()=>{T.current=null,e.isConnected&&t.setSelectedLines(x,{notify:!1})}))},t[38]=f,t[39]=x,t[40]=fe):fe=t[40];let pe=fe,me;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(me={overscrollSize:600,intersectionObserverMargin:1200},t[41]=me):me=t[41];let F;t[42]!==s||t[43]!==r||t[44]!==i?(F=pm(r,i,s),t[42]=s,t[43]=r,t[44]=i,t[45]=F):F=t[45];let he;t[46]!==s||t[47]!==i||t[48]!==F?(he={name:i,contents:s,cacheKey:F},t[46]=s,t[47]=i,t[48]=F,t[49]=he):he=t[49];let I=!se,ge=!se,_e=d?`wrap`:`scroll`,ve;t[50]===c?ve=t[51]:(ve=Me(c),t[50]=c,t[51]=ve);let ye;t[52]!==de||t[53]!==pe||t[54]!==c||t[55]!==C||t[56]!==I||t[57]!==ge||t[58]!==_e||t[59]!==ve?(ye={disableFileHeader:!0,enableGutterUtility:I,enableLineSelection:ge,onGutterUtilityClick:C,onLineSelectionChange:C,onLineSelectionEnd:de,overflow:_e,theme:ve,themeType:c,unsafeCSS:xm,onPostRender:pe},t[52]=de,t[53]=pe,t[54]=c,t[55]=C,t[56]=I,t[57]=ge,t[58]=_e,t[59]=ve,t[60]=ye):ye=t[60];let be;t[61]!==te||t[62]!==re?(be=e=>(0,Y.jsx)(`div`,{className:`py-1`,children:e.metadata.entries.map(e=>(0,Y.jsx)(it,{kind:e.kind,rangeLabel:z(e.startLine,e.endLine),text:e.text,onCancel:()=>te(e.id),onComment:t=>re(e.id,t),onDelete:()=>te(e.id)},e.id))}),t[61]=te,t[62]=re,t[63]=be):be=t[63];let Se;t[64]===A?Se=t[65]:(Se={onChange:A},t[64]=A,t[65]=Se);let Ce;return t[66]!==_||t[67]!==x||t[68]!==he||t[69]!==ye||t[70]!==be||t[71]!==Se?(Ce=(0,Y.jsx)(xe,{createEditor:j,children:(0,Y.jsx)(`div`,{ref:w,className:`flex min-h-0 flex-1`,children:(0,Y.jsx)(Qe,{className:`file-preview-virtualizer min-h-0 flex-1 overflow-auto`,config:me,children:(0,Y.jsx)(Jl,{file:he,options:ye,selectedLines:x,lineAnnotations:_,renderAnnotation:be,className:`min-h-full`,edit:!0,editorOptions:Se})})})}),t[66]=_,t[67]=x,t[68]=he,t[69]=ye,t[70]=be,t[71]=Se,t[72]=Ce):Ce=t[72],Ce}function jm(e){return e.metadata.entries.some(Mm)}function Mm(e){return e.kind===`draft`}function Nm(e){let t=e.metadata.entries.filter(Pm);return t.length>0?[{...e,metadata:{entries:t}}]:[]}function Pm(e){return e.kind!==`draft`}function Fm(e){return e.metadata.entries}function Im(e){return e.removeReviewComment}function Lm(e){return e.addReviewComment}function Rm(e){let t=(0,Yp.c)(17),{environmentId:n,cwd:r,relativePath:i,contents:a,threadRef:o,readOnly:s,onPendingChange:c}=e,l;t[0]!==r||t[1]!==n||t[2]!==c||t[3]!==i?(l={environmentId:n,cwd:r,relativePath:i,onPendingChange:c},t[0]=r,t[1]=n,t[2]=c,t[3]=i,t[4]=l):l=t[4];let u=km(l),d;t[5]!==a||t[6]!==r||t[7]!==n||t[8]!==s||t[9]!==i||t[10]!==u?(d=s?{}:{onTaskListChange:e=>{let{markerOffset:t,checked:o}=e,s=Ze(n,r,i)?.contents??a,c=gm(s,t,o);c!==s&&(Ne(n,r,i,c),u.change(c))}},t[5]=a,t[6]=r,t[7]=n,t[8]=s,t[9]=i,t[10]=u,t[11]=d):d=t[11];let f;return t[12]!==a||t[13]!==r||t[14]!==d||t[15]!==o?(f=(0,Y.jsx)(ye,{className:`min-h-0 flex-1`,children:(0,Y.jsx)(te,{text:a,cwd:r,threadRef:o,className:`mx-auto max-w-4xl px-6 py-5`,...d})}),t[12]=a,t[13]=r,t[14]=d,t[15]=o,t[16]=f):f=t[16],f}function zm(){try{return y(vm,f)??!0}catch(e){return console.error(e),!0}}function Bm(e){let t=(0,Yp.c)(103),{environmentId:n,cwd:r,projectName:i,workspaceRoot:a,relativePath:s,absolutePath:l,isOutsideWorkspace:f,threadRef:m,composerDraftTarget:y,keybindings:C,availableEditors:O,revealLine:M,revealRequestId:N,onOpenFile:P,onPendingChange:te}=e,{resolvedTheme:re}=h(),ie=ue(Hm),ae=A(),oe=ee(n),se;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(se={reportFailure:!1},t[0]=se):se=t[0];let ce=Re(ne.createUrl,se),le;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(le={reportFailure:!1},t[1]=le):le=t[1];let de=j(u.open,le),fe=n===ae,pe;t[2]===s?pe=t[3]:(pe=s!==null&&T(s),t[2]=s,t[3]=pe);let me=pe,F=Ke(n,r,s,!me,l),[I,ge]=(0,J.useState)(zm),[_e,ve]=(0,J.useState)(!1),be;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(be={path:null,revealRequestId:null},t[4]=be):be=t[4];let[xe,Se]=(0,J.useState)(be),Ce=(0,J.useRef)(null),L;t[5]===s?L=t[6]:(L=s?hm(s):!1,t[5]=s,t[6]=L);let we=L,Te=we&&xe.path===s&&(M===null||xe.revealRequestId===N),Oe;t[7]===s?Oe=t[8]:(Oe=s!==null&&d()&&Fe(s),t[7]=s,t[8]=Oe);let ke=Oe,Ae;t[9]!==r||t[10]!==l||t[11]!==s?(Ae=l??(s?x(s,r):null),t[9]=r,t[10]=l,t[11]=s,t[12]=Ae):Ae=t[12];let je=Ae,Ne;t[13]!==je||t[14]!==fe||t[15]!==m.threadId||t[16]!==a?(Ne=je===null?null:w({filePath:je,threadId:m.threadId,workspaceRoot:a,allowLocalFiles:fe}),t[13]=je,t[14]=fe,t[15]=m.threadId,t[16]=a,t[17]=Ne):Ne=t[17];let Pe=Ne,Ie;t[18]!==r||t[19]!==f||t[20]!==i||t[21]!==s?(Ie=s?mm(f?r:i,s):[],t[18]=r,t[19]=f,t[20]=i,t[21]=s,t[22]=Ie):Ie=t[22];let Le=Ie,ze=Tm(s,M,N),Ve;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(Ve=()=>{(Ce.current?.querySelector(`[data-current-file-crumb='true']`))?.scrollIntoView({block:`nearest`,inline:`end`})},t[23]=Ve):Ve=t[23];let He;t[24]===s?He=t[25]:(He=[s],t[24]=s,t[25]=He),(0,J.useEffect)(Ve,He);let We;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(We=()=>{ge(Vm)},t[26]=We):We=t[26];let Ge=We,qe;t[27]!==je||t[28]!==fe||t[29]!==ce||t[30]!==oe||t[31]!==de||t[32]!==re||t[33]!==m||t[34]!==a?(qe=()=>{!je||!oe||(async()=>{let e=await Xe({threadRef:m,filePath:je,httpBaseUrl:oe,workspaceRoot:a,allowLocalFiles:fe,theme:re,createAssetUrl:ce,openPreview:de});if(e._tag===`Success`||p(e))return;let t=_(e);g.add(v({type:`error`,title:`Unable to open file in browser`,description:t instanceof Error?t.message:`An error occurred.`}))})()},t[27]=je,t[28]=fe,t[29]=ce,t[30]=oe,t[31]=de,t[32]=re,t[33]=m,t[34]=a,t[35]=qe):qe=t[35];let Ze=qe,$e;t[36]!==je||t[37]!==fe||t[38]!==O||t[39]!==y||t[40]!==r||t[41]!==n||t[42]!==F||t[43]!==Pe||t[44]!==me||t[45]!==we||t[46]!==f||t[47]!==C||t[48]!==ze||t[49]!==te||t[50]!==s||t[51]!==Te||t[52]!==re||t[53]!==N||t[54]!==m||t[55]!==ie?($e=s&&me&&Pe?(0,Y.jsx)(Sm,{environmentId:n,resource:Pe,alt:s},je??s):s&&F.error&&F.data===null?(0,Y.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center px-6 text-center text-xs leading-relaxed text-destructive`,children:F.error}):s&&F.data===null?(0,Y.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center text-muted-foreground`,children:(0,Y.jsx)(D,{className:`size-5 animate-spin`})}):s&&F.data?F.data.binary&&je?(0,Y.jsx)(om,{environmentId:n,keybindings:C,availableEditors:O,absolutePath:je,name:s.slice(s.lastIndexOf(`/`)+1),byteLength:F.data.byteLength,canRevealInFileManager:fe&&c()}):we&&Te?(0,Y.jsx)(Rm,{environmentId:n,cwd:r,relativePath:s,threadRef:m,contents:F.data.contents,readOnly:f,onPendingChange:te}):F.data.truncated||f?(0,Y.jsx)(Qe,{className:`file-preview-virtualizer min-h-0 flex-1 overflow-auto`,config:{overscrollSize:600,intersectionObserverMargin:1200},children:(0,Y.jsx)(Jl,{file:{name:s,contents:F.data.contents,cacheKey:pm(r,s,F.data.contents)},options:{disableFileHeader:!0,overflow:ie?`wrap`:`scroll`,theme:Me(re),themeType:re,unsafeCSS:xm,onPostRender:ze},className:`min-h-full`})},`${s}:${re}:${F.data.byteLength}`):(0,Y.jsx)(Am,{environmentId:n,cwd:r,relativePath:s,composerDraftTarget:y,contents:F.data.contents,resolvedTheme:re,revealRequestId:N,wordWrap:ie,onPostRender:ze,onPendingChange:te},`${s}:${re}`):null,t[36]=je,t[37]=fe,t[38]=O,t[39]=y,t[40]=r,t[41]=n,t[42]=F,t[43]=Pe,t[44]=me,t[45]=we,t[46]=f,t[47]=C,t[48]=ze,t[49]=te,t[50]=s,t[51]=Te,t[52]=re,t[53]=N,t[54]=m,t[55]=ie,t[56]=$e):$e=t[56];let et=$e,tt;t[57]!==je||t[58]!==O||t[59]!==Le||t[60]!==ke||t[61]!==n||t[62]!==_e||t[63]!==I||t[64]!==Ze||t[65]!==we||t[66]!==C||t[67]!==ae||t[68]!==i||t[69]!==s||t[70]!==Te||t[71]!==N?(tt=s?(0,Y.jsxs)(`div`,{className:`surface-subheader gap-2 px-3`,"data-surface-subheader":!0,children:[(0,Y.jsx)(ye,{ref:Ce,hideScrollbars:!0,scrollFade:!0,className:`min-w-0 flex-1 rounded-none`,"data-file-breadcrumbs":!0,children:(0,Y.jsx)(`div`,{className:`flex h-full w-max min-w-full items-center text-xs`,children:Le.map((e,t)=>(0,Y.jsxs)(`div`,{className:`flex min-w-0 shrink-0 items-center`,"data-current-file-crumb":e.kind===`file`,children:[t>0?(0,Y.jsx)(E,{className:`mx-1 size-3.5 shrink-0 text-muted-foreground/60`}):null,(0,Y.jsx)(`span`,{className:o(`max-w-40 truncate`,e.kind===`file`?`font-medium text-foreground`:`text-muted-foreground`),title:e.path||i,children:e.label})]},e.path||`project`))})}),je&&n===ae?(0,Y.jsx)(Ue,{environmentId:n,keybindings:C,availableEditors:O,openInCwd:je,compact:!0,enableShortcut:!1}):null,we?(0,Y.jsxs)(S,{children:[(0,Y.jsx)(k,{render:(0,Y.jsx)(Ee,{className:`shrink-0`,pressed:Te,onPressedChange:e=>{Se({path:e?s:null,revealRequestId:e?N:null})},"aria-label":Te?`Show markdown source`:`Show rendered markdown`,variant:`ghost`,size:`sm`,children:Te?(0,Y.jsx)(Be,{className:`size-3.5`}):(0,Y.jsx)(Ye,{className:`size-3.5`})})}),(0,Y.jsx)(b,{children:Te?`Show markdown source`:`Show rendered markdown`})]}):null,ke?(0,Y.jsxs)(S,{children:[(0,Y.jsx)(k,{render:(0,Y.jsx)(Ee,{className:`shrink-0`,pressed:!1,onPressedChange:Ze,"aria-label":`Open file in preview browser`,variant:`ghost`,size:`sm`,children:(0,Y.jsx)(Je,{className:`size-3.5`})})}),(0,Y.jsx)(b,{children:`Open file in preview browser`})]}):null,(0,Y.jsxs)(S,{children:[(0,Y.jsx)(k,{render:(0,Y.jsx)(Ee,{className:`shrink-0`,pressed:_e,onPressedChange:ve,"aria-label":_e?`Collapse file preview`:`Expand file preview`,variant:`ghost`,size:`sm`,children:_e?(0,Y.jsx)(he,{className:`size-3.5`}):(0,Y.jsx)(De,{className:`size-3.5`})})}),(0,Y.jsx)(b,{children:_e?`Collapse file preview`:`Expand file preview`})]}),(0,Y.jsxs)(S,{children:[(0,Y.jsx)(k,{render:(0,Y.jsx)(Ee,{className:`shrink-0`,pressed:I,onPressedChange:Ge,"aria-label":I?`Hide file explorer`:`Show file explorer`,variant:`ghost`,size:`sm`,children:(0,Y.jsx)(ct,{className:`size-3.5`})})}),(0,Y.jsx)(b,{children:I?`Hide file explorer`:`Show file explorer`})]})]}):null,t[57]=je,t[58]=O,t[59]=Le,t[60]=ke,t[61]=n,t[62]=_e,t[63]=I,t[64]=Ze,t[65]=we,t[66]=C,t[67]=ae,t[68]=i,t[69]=s,t[70]=Te,t[71]=N,t[72]=tt):tt=t[72];let nt;t[73]!==F||t[74]!==s?(nt=s&&F.data?.truncated?(0,Y.jsxs)(`div`,{className:`shrink-0 border-b border-amber-500/20 bg-amber-500/8 px-3 py-1.5 text-[11px] text-amber-700 dark:text-amber-300`,children:[`Preview limited to the first 1 MB of a `,F.data.byteLength.toLocaleString(),` byte file.`]}):null,t[73]=F,t[74]=s,t[75]=nt):nt=t[75];let rt=s?`flex`:`hidden`,it;t[76]===rt?it=t[77]:(it=o(`min-w-0 flex-1 flex-col overflow-hidden`,rt),t[76]=rt,t[77]=it);let at;t[78]!==_e||t[79]!==et?(at=_e?(0,Y.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center px-6 text-center text-xs text-muted-foreground`,children:`Shown in the expanded view.`}):et,t[78]=_e,t[79]=et,t[80]=at):at=t[80];let ot;t[81]!==it||t[82]!==at?(ot=(0,Y.jsx)(`div`,{className:it,children:at}),t[81]=it,t[82]=at,t[83]=ot):ot=t[83];let R;t[84]!==r||t[85]!==n||t[86]!==I||t[87]!==P||t[88]!==i||t[89]!==s?(R=I||s===null?(0,Y.jsx)(`aside`,{className:o(`flex min-h-0 shrink-0 bg-background`,s?`w-[min(22rem,46%)] min-w-64 border-l border-border/60`:`min-w-0 flex-1`),children:(0,Y.jsx)(em,{environmentId:n,cwd:r,projectName:i,onOpenFile:P},`${n}:${r}`)}):null,t[84]=r,t[85]=n,t[86]=I,t[87]=P,t[88]=i,t[89]=s,t[90]=R):R=t[90];let z;t[91]!==ot||t[92]!==R?(z=(0,Y.jsxs)(`div`,{className:`flex min-h-0 flex-1 overflow-hidden`,children:[ot,R]}),t[91]=ot,t[92]=R,t[93]=z):z=t[93];let st=_e&&s!==null,lt=s??``,ut;t[94]!==et||t[95]!==st||t[96]!==lt?(ut=(0,Y.jsx)(tm,{open:st,title:lt,onOpenChange:ve,children:et}),t[94]=et,t[95]=st,t[96]=lt,t[97]=ut):ut=t[97];let dt;return t[98]!==tt||t[99]!==nt||t[100]!==z||t[101]!==ut?(dt=(0,Y.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden bg-background`,children:[tt,nt,z,ut]}),t[98]=tt,t[99]=nt,t[100]=z,t[101]=ut,t[102]=dt):dt=t[102],dt}function Vm(e){let t=!e;try{m(vm,t,f)}catch(e){console.error(e)}return t}function Hm(e){return e.wordWrap}export{Bm as default};
2230
+ //# sourceMappingURL=FilePreviewPanel-CcQBW0Vz.js.map