laplus 0.1.5 → 0.1.7
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.
- package/package.json +6 -6
- package/ui/dist/assets/{DiffPanel-CmLwL5Y4.js → DiffPanel-DRLb5V2O.js} +2 -2
- package/ui/dist/assets/{DiffPanel-CmLwL5Y4.js.map → DiffPanel-DRLb5V2O.js.map} +1 -1
- package/ui/dist/assets/{FilePreviewPanel-7UYO5Mra.js → FilePreviewPanel-CNxX4J5k.js} +2 -2
- package/ui/dist/assets/{FilePreviewPanel-7UYO5Mra.js.map → FilePreviewPanel-CNxX4J5k.js.map} +1 -1
- package/ui/dist/assets/{PreviewPanel-VFr5-jjQ.js → PreviewPanel-D1RgBgdC.js} +2 -2
- package/ui/dist/assets/{PreviewPanel-VFr5-jjQ.js.map → PreviewPanel-D1RgBgdC.js.map} +1 -1
- package/ui/dist/assets/{fileCommentAnnotations-3602doIr.js → fileCommentAnnotations-CLPA7umr.js} +2 -2
- package/ui/dist/assets/{fileCommentAnnotations-3602doIr.js.map → fileCommentAnnotations-CLPA7umr.js.map} +1 -1
- package/ui/dist/assets/{index-BIRnPNNR.js → index-c0OLJn1C.js} +4 -4
- package/ui/dist/assets/{index-BIRnPNNR.js.map → index-c0OLJn1C.js.map} +1 -1
- package/ui/dist/index.html +1 -1
- package/ui/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{E as e,Ft as t,Gd as n,Jo as r,Ld as i,Mo as a,No as o,O as s,P as c,Qo as l,S as u,Xt as d,cf as f,df as p,go as m,j as h,ol as g,tn as _,w as v,x as y,yo as b}from"./textarea-Zwf6kD06.js";import{a as x,c as S,i as C,n as ee,o as w,r as T,s as E,t as te}from"./fileCommentAnnotations-3602doIr.js";import{A as ne,C as D,Cr as O,F as k,Gn as A,Ht as j,I as M,Jn as N,M as re,Mr as ie,N as ae,Ot as P,P as F,Rt as oe,S as se,Tn as ce,Un as le,Vn as ue,Wt as de,Xn as fe,Yn as pe,Zt as me,_ as he,_r as ge,b as _e,br as ve,bt as ye,cn as be,d as xe,dn as Se,dr as Ce,er as we,f as I,fn as Te,g as Ee,gr as De,h as Oe,hr as ke,jr as Ae,jt as je,kr as Me,l as Ne,ln as Pe,m as Fe,mr as Ie,p as Le,pn as Re,tn as ze,u as Be,un as Ve,vt as He,x as Ue,y as We,zt as Ge}from"./index-BIRnPNNR.js";var Ke=b(`code-xml`,[[`path`,{d:`m18 16 4-4-4-4`,key:`1inbqp`}],[`path`,{d:`m6 8-4 4 4 4`,key:`15zrgr`}],[`path`,{d:`m14.5 4-5 16`,key:`e7oirm`}]]),qe=b(`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`}]]),Je=`file-tree-container`,Ye=`data-file-tree-style`,Xe=`data-file-tree-unsafe-css`,Ze=`data-file-tree-scrollbar-measure`,Qe=`data-file-tree-scrollbar-gutter-measured`,$e=`--trees-scrollbar-gutter-measured`,et=`header`,tt=`context-menu`,nt=`context-menu-trigger`,rt=5,it=1<<rt,at=it*4;function ot(){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 lt(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 ut(e,t){e.childPositionById!=null&&e.childPositionById.set(t,e.childIds.length),e.childIds.push(t)}function L(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 R(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,mt(e,t)}function dt(e,t,n,r){if(e.totalChildSubtreeNodeCount+=n,e.totalChildVisibleSubtreeCount+=r,e.childVisibleChunkSums==null||r===0)return;let i=lt(e).get(t);if(i===void 0)return;let a=i>>rt;e.childVisibleChunkSums[a]+=r}function ft(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=ht(e,t,a,i);return{...r,childVisibleIndex:n-r.localVisibleIndex}}i-=o,a+=it}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 pt(e,t,n){let r=0,i=t.childVisibleChunkSums,a=0;if(i!=null){let e=n>>rt;for(let t=0;t<e;t+=1)r+=i[t]??0;a=e<<rt}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 mt(e,t){if(t.childIds.length<at){t.childVisibleChunkSums=null;return}let n=Math.ceil(t.childIds.length/it),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>>rt]+=a.visibleSubtreeCount)}t.childVisibleChunkSums=r}function ht(e,t,n,r){let i=Math.min(t.childIds.length,n+it),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 gt=7,_t=3,vt=1<<_t,yt=4;function z(e,t,n=0){return e<<yt|n<<_t|t}function bt(e){return e.depthAndFlags>>>yt}function B(e){return(e.depthAndFlags&vt)>>_t}function V(e){return(e.depthAndFlags&vt)!==0}function xt(e){return e.depthAndFlags>}function H(e,t){return(xt(e)&t)!==0}function St(e,t){e.depthAndFlags|=t}function Ct(e,t){e.depthAndFlags=z(t,xt(e),B(e))}var wt=Symbol(`benchmarkInstrumentation`);function Tt(e,t){return t==null||Object.defineProperty(e,wt,{configurable:!0,enumerable:!1,value:t,writable:!1}),e}function Et(e){return e==null?null:e[wt]??null}function U(e,t,n){return e==null?n():e.measurePhase(t,n)}function Dt(e,t,n){!Number.isFinite(n)||e==null||e.setCounter(t,n)}function Ot(e){return e>=48&&e<=57}function kt(e){let t=[],n=0,r=0;for(;r<e.length;){for(;r<e.length&&!Ot(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&&Ot(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 At(e){let t=e.toLowerCase();return{lowerValue:t,tokens:kt(t)}}function jt(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 Mt(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=jt(e.tokens,t.tokens);return n===0?e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1:n}function Nt(e,t,n){let r=Mt(n(e),n(t));return r===0?e===t?0:e<t?-1:1:r}function Pt(e,t){return Nt(e,t,At)}function Ft(e,t){return t===e.segments.length-1?+!!e.isDirectory:1}function It(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=Ft(e,r);return a===Ft(t,r)?Pt(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 Lt(e,t){return It(e,t)}function Rt(e,t,n){let r=e=>{let t=n.get(e);if(t!=null)return t;let r=At(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=Ft(e,n);return o===Ft(t,n)?Nt(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 zt(e,t){let n=e.sortKeyById[t];if(n!==void 0)return n;let r=e.valueById[t],i=At(r);return e.sortKeyById[t]=i,i}function Bt(e={}){return{flattenEmptyDirectories:e.flattenEmptyDirectories!==!1,sort:e.sort??`default`}}function Vt(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 Ht(e){let{hasTrailingSlash:t,segments:n}=Vt(e);return{basename:n[n.length-1]??``,isDirectory:t,path:e,segments:n}}function Ut(e){if(e.length===0)return{requiresDirectory:!1,segments:[]};let{hasTrailingSlash:t,segments:n}=Vt(e);return{requiresDirectory:t,segments:n}}var Wt=``;function Gt(){let e=new Map;return e.set(Wt,0),{idByValue:e,valueById:[Wt],sortKeyById:[At(Wt)]}}function Kt(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 qt(e,t){let n=e.valueById[t];if(n===void 0)throw Error(`Unknown segment ID: ${String(t)}`);return n}var Jt=Symbol(`pathStorePreparedInputKind`);function Yt(e,t){return e[Jt]=t,e}function Xt(e){return{basename:e.basename,depth:e.segments.length,isDirectory:e.isDirectory,path:e.path,segments:e.segments}}function Zt(e,t,n){return n==="default"?Lt(e,t):n(Xt(e),Xt(t))}function Qt(){return{depthAndFlags:z(0,3,1),nameId:0,parentId:0,subtreeNodeCount:1,visibleSubtreeCount:1}}function $t(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 en(e){return e.isDirectory?e.segments.length:e.segments.length-1}function tn(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 nn(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function rn(e,t={}){return un(e,t).map(e=>e.path)}function an(e,t={}){let n=un(e,t);return Yt({paths:n.map(e=>e.path),preparedPaths:n},`prepared`)}function on(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 Yt({paths:e,presortedPaths:e,presortedPathsContainDirectories:n},`presorted`)}function sn(e){let t=e,n=t.preparedPaths;if(t[Jt]===`prepared`&&n!=null)return n;if(!tn(n))throw Error(`preparedInput must come from PathStore.prepareInput()`);return n}function cn(e){let t=e;return t[Jt]===`presorted`&&t.presortedPaths!=null||nn(t.presortedPaths)?t.presortedPaths:null}function ln(e){let t=e;return typeof t.presortedPathsContainDirectories==`boolean`?t.presortedPathsContainDirectories:null}function un(e,t={}){let n=Bt(t),r=Et(t);Dt(r,`workload.inputFiles`,e.length);let i=U(r,`store.preparePathEntries.parse`,()=>e.map(e=>Ht(e)));return U(r,`store.preparePathEntries.sort`,()=>i.sort((e,t)=>Zt(e,t,n.sort))),i}var dn=class{directories=new Map;directoryStack=[0];presortedDirectoryNodeIds=[];initialExpandedPathSet;createdDirectoriesAllExpanded=!1;createdDirectoryCount=0;lastPreparedPath=null;nodes=[Qt()];options;instrumentation;segmentSortKeyCache=new Map;segmentTable=Gt();hasDeferredDirectoryIndexes=!1;constructor(e={}){this.instrumentation=Et(e),this.options=Bt(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,ot())}appendPaths(e){return U(this.instrumentation,`store.builder.appendPaths.parse`,()=>this.appendPreparedPaths(e.map(e=>Ht(e))))}appendPreparedPaths(e,t=!0){return this.createdDirectoriesAllExpanded=!1,U(this.instrumentation,`store.builder.appendPreparedPaths`,()=>{for(let n of e)this.appendPreparedPath(n,t)}),this}appendPresortedPaths(e,t=null){return U(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:z(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:z(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:z(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=Ht(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:z(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:z(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=Ht(t)),this.hasDeferredDirectoryIndexes=!0}finish(e={}){let t=e.skipSubtreeCountPass===!0;return this.hasDeferredDirectoryIndexes?(U(this.instrumentation,`store.builder.buildDirectoryIndexes`,()=>this.buildPresortedFinish(t)),this.hasDeferredDirectoryIndexes=!1):t||U(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"?Rt(this.lastPreparedPath,e,this.segmentSortKeyCache):Zt(this.lastPreparedPath,e,this.options.sort))>0)throw Error(`Builder input must be sorted before appendPaths(): "${e.path}"`)}let n=this.lastPreparedPath,r=en(e),i=n==null?0:en(n),a=n==null?0:$t(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=Kt(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:z(bt(o)+1,0),nameId:r,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),a?.set(r,s),ut(i,s),s}createFileChildUnchecked(e,t){let n=Kt(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:z(bt(i)+1,0),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),ut(r,a),a}getOrCreateDirectoryChild(e,t){let n=Kt(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&&!V(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:z(bt(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),ut(r,a),this.directories.set(a,ot()),a}createDirectoryChild(e,t){let n=Kt(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:z(bt(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),ut(r,a),this.directories.set(a,ot()),a}promoteDirectoryToExplicit(e,t){let n=this.nodes[e];if(n===void 0)throw Error(`Unknown directory node ID: ${String(e)}`);if(!V(n))throw Error(`Path is not a directory: "${t}"`);if(H(n,1))throw Error(`Duplicate path: "${t}"`);St(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(V(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;V(n)&&this.directories.set(t,ot());let r=this.directories.get(n.parentId);r!=null&&(r.childIdByNameId!=null&&r.childIdByNameId.set(n.nameId,t),ut(r,t))}}computeSubtreeCounts(e){let t=this.nodes[e];if(t===void 0)throw Error(`Unknown node ID: ${String(e)}`);if(!V(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 R(this.nodes,n),t.subtreeNodeCount=r,t.visibleSubtreeCount=r,r}};function fn(e,t=`closed`,n=null){let r=mn(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 pn(){return{affectedAncestorIds:new Set,affectedNodeIds:new Set,events:[]}}function mn(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 hn(e,t){return H(t,2)||e.defaultExpansion===`open`?!0:e.defaultExpansion===`closed`?!1:bt(t)<=e.defaultExpansion}function gn(e,t,n=e.snapshot.nodes[t]){return n==null||!V(n)?!1:e.directoriesOpenByDefault&&!e.hasCollapsedDirectoryOverrides?!0:e.collapsedDirectoryIds.has(t)?!1:e.expandedDirectoryIds.has(t)?!0:hn(e,n)}function _n(e,t,n,r=e.snapshot.nodes[t]){if(r==null||!V(r))return;let i=hn(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 vn(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 yn(e,t){return e.directoryLoadInfoById.get(t)?.state??`loaded`}function bn(e,t){let n=vn(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 xn(e,t){let n=vn(e,t);n.activeAttemptId=null,n.errorMessage=null,n.state=`unloaded`}function Sn(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 Cn(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 Tn(e,t){e.directoryLoadInfoById.delete(t)}function En(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 Dn(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`add`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function On(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`remove`,path:e.path,projectionChanged:e.projectionChanged,recursive:e.recursive,visibleCountDelta:null}}function kn(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,from:e.from,operation:`move`,projectionChanged:e.projectionChanged,to:e.to,visibleCountDelta:null}}function An(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`expand`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function jn(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`collapse`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function Mn(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`mark-directory-unloaded`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function Nn(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 Pn(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 Fn(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 In(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 Ln(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 Rn(e,t,n){return{...n,visibleCountDelta:Yn(e)-t}}function zn(e,t){let n=Yn(e),r=pn();e.transactionStack.push(r);try{t()}catch(t){throw Hn(e,r,!1),t}Hn(e,r,!0,Yn(e)-n)}function Bn(e,t){let n=e.instrumentation;if(n==null){Vn(e,t);return}U(n,`store.events.record`,()=>Vn(e,t))}function Vn(e,t){let n=e.transactionStack[e.transactionStack.length-1]??null;if(n==null){qn(e,t);return}n.events.push(t),Kn(n,t)}function Hn(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?Gn(i,t):U(n,`store.events.batch.merge`,()=>Gn(i,t));return}let a=Un(t,r),o=e.instrumentation;if(o==null){qn(e,a);return}U(o,`store.events.batch.commit`,()=>qn(e,a))}function Un(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 Wn(e,t){for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n);for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n)}function Gn(e,t){for(let n of t.events)e.events.push(n);Wn(e,t)}function Kn(e,t){for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n);for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n)}function qn(e,t){let n=e.instrumentation;if(n==null){Jn(e,t);return}U(n,`store.events.emit`,()=>Jn(e,t))}function Jn(e,t){e.listeners.get(t.operation)?.forEach(e=>e(t)),e.listeners.get(`*`)?.forEach(e=>e(t))}function Yn(e){return e.snapshot.nodes[e.snapshot.rootId]?.visibleSubtreeCount??0}function Xn(e,t){if(e.snapshot.options.flattenEmptyDirectories!==!0)return null;let n=e.snapshot.nodes[t];if(n==null||!V(n)||H(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||!V(a)?null:i}function Zn(e,t){let n=t;for(;;){let t=Xn(e,n);if(t==null)return n;n=t}}function Qn(e,t){let n=[t],r=t;for(;;){let t=Xn(e,r);if(t==null)return n;n.push(t),r=t}}function $n(e,t){let n=t==null?e.snapshot.rootId:cr(e,t);return n==null?[]:ur(e,n)}function er(e,t){let n=Ht(t),r=n.isDirectory?n.segments:n.segments.slice(0,-1),i=Tr(e,wr(e,r)),{createdNodeIds:a,directoryId:o}=dr(e,r),s=new Set(a),c=o;if(n.isDirectory){let n=K(e,o);if(H(n,1))throw Error(`Path already exists: "${t}"`);St(n,1),e.pathCacheByNodeId.set(o,{path:t,version:e.pathCacheVersion}),s.add(o)}else c=pr(e,o,n.basename),s.add(c);ar(e,o);let l=Tr(e,o);return Dn({affectedAncestorIds:sr(e,c),affectedNodeIds:[...s],path:t,projectionChanged:Er(i,l)})}function tr(e,t,n){let r=cr(e,t);if(r==null)throw Error(`Path does not exist: "${t}"`);let i=K(e,r);if(H(i,2))throw Error(`The root node cannot be removed`);if(V(i)&&G(e,r).childIds.length>0&&n.recursive!==!0)throw Error(`Cannot remove a non-empty directory without recursive: "${t}"`);let a=i.parentId,o=Tr(e,a),s=Sr(e,r);gr(e,a,r,i.nameId),Cr(e,a),ar(e,a);let c=Tr(e,a);return On({affectedAncestorIds:sr(e,a),affectedNodeIds:s,path:t,projectionChanged:Er(o,c),recursive:n.recursive===!0})}function nr(e,t,n,r){let i=cr(e,t);if(i==null)throw Error(`Source path does not exist: "${t}"`);let a=K(e,i);if(H(a,2))throw Error(`The root node cannot be moved`);let o=r.collision??`error`,s=br(e,i,n),c=Tr(e,a.parentId),l=Tr(e,s.parentId),u=qt(e.snapshot.segmentTable,a.nameId),d=Kt(e.snapshot.segmentTable,s.basename);if(s.parentId===a.parentId&&u===s.basename)return null;if(V(a)&&Ar(e,i,s.parentId))throw Error(`Cannot move a directory into one of its descendants`);let f=ct(e.snapshot.nodes,G(e,s.parentId)).get(d),p=s.existingNodeId??f??null;if(p!=null&&p!==i&&xr(e,p,o,B(a))===`skip`)return null;let m=a.parentId;gr(e,m,i,a.nameId),a.parentId=s.parentId,a.nameId=d,e.pathCacheByNodeId.delete(i),kr(e,i),hr(e,s.parentId,i),Cr(e,m),e.pathCacheVersion++,ar(e,m),s.parentId!==m&&ar(e,s.parentId);let h=Tr(e,m),g=Tr(e,s.parentId);return kn({affectedAncestorIds:[...new Set([...sr(e,m),...sr(e,s.parentId)])],affectedNodeIds:[i],from:t,projectionChanged:Dr([c,l],[h,g]),to:W(e,i)})}function rr(e,t){let n=e.pathCacheByNodeId.get(t);return n!=null&&n.version===e.pathCacheVersion?n.path:null}function ir(e,t,n){return e.pathCacheByNodeId.set(t,{path:n,version:e.pathCacheVersion}),n}function W(e,t){let n=K(e,t),r=rr(e,t);if(r!=null)return r;if(H(n,2))return ir(e,t,``);let i=W(e,n.parentId),a=qt(e.snapshot.segmentTable,n.nameId),o=i.length===0?a:`${i}${a}`;return ir(e,t,V(n)?`${o}/`:o)}function ar(e,t){let n=e.instrumentation;if(n==null){Mr(e,t);return}U(n,`store.recomputeCountsUpwardFrom`,()=>Mr(e,t))}function or(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||!V(o)){jr(e,a,o,!0),n.pop();continue}let s=i.get(a);if(s==null||t[1]>=s.childIds.length){jr(e,a,o,!0),n.pop();continue}let c=s.childIds[t[1]++];n.push([c,0])}}function sr(e,t){let n=[],r=t;for(;r!=null;){let t=K(e,r);if(n.push(r),r===e.snapshot.rootId)break;r=t.parentId}return n}function cr(e,t){if(t.length===0)return e.snapshot.rootId;let n=Ut(t);return lr(e,n.segments,n.requiresDirectory)}function lr(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=G(e,r),a=ct(e.snapshot.nodes,i).get(t);if(a===void 0)return null;r=a}let i=K(e,r);return n&&!V(i)?null:r}function G(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 K(e,t){let n=e.snapshot.nodes[t];if(n===void 0||H(n,4))throw Error(`Unknown node ID: ${String(t)}`);return n}function ur(e,t){let n=e.snapshot.nodes[t];if(n===void 0||H(n,4))return[];if(!V(n))return[W(e,t)];if(G(e,t).childIds.length===0)return H(n,1)&&!H(n,2)?[W(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||H(n,4)){i.pop();continue}if(!V(n)){r.push(W(e,t.nodeId)),i.pop();continue}let a=G(e,t.nodeId);if(a.childIds.length===0){H(n,1)&&!H(n,2)&&r.push(W(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 dr(e,t){let n=[],r=e.snapshot.rootId;for(let i of t){let t=Kt(e.snapshot.segmentTable,i),a=G(e,r),o=ct(e.snapshot.nodes,a).get(t);if(o!==void 0){if(!V(K(e,o)))throw Error(`Cannot create a directory that collides with an existing file: "${i}"`);r=o;continue}r=fr(e,r,t),n.push(r)}return{createdNodeIds:n,directoryId:r}}function fr(e,t,n){let r=K(e,t),i=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:z(bt(r)+1,0,1),nameId:n,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),e.snapshot.directories.set(i,ot()),hr(e,t,i),e.collapseNewDirectoriesByDefault&&(e.collapsedDirectoryIds.add(i),e.hasCollapsedDirectoryOverrides=!0),e.activeNodeCount++,i}function pr(e,t,n){let r=Kt(e.snapshot.segmentTable,n),i=G(e,t);if(ct(e.snapshot.nodes,i).has(r))throw Error(`Path already exists: "${Pr(e,t,n)}"`);let a=K(e,t),o=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:z(bt(a)+1,0),nameId:r,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),hr(e,t,o),e.activeNodeCount++,o}function mr(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}_r(e,n,o)<0?i=a:r=a+1}return r}function hr(e,t,n){let r=G(e,t),i=K(e,n);ct(e.snapshot.nodes,r).set(i.nameId,n),dt(r,n,i.subtreeNodeCount,i.visibleSubtreeCount);let a=mr(e,r,n);r.childIds.splice(a,0,n),L(r,a),mt(e.snapshot.nodes,r)}function gr(e,t,n,r){let i=G(e,t),a=lt(i),o=a.get(n)??-1;ct(e.snapshot.nodes,i).delete(r),a.delete(n);let s=e.snapshot.nodes[n];s!=null&&dt(i,n,-s.subtreeNodeCount,-s.visibleSubtreeCount),o>=0&&(i.childIds.splice(o,1),L(i,o),mt(e.snapshot.nodes,i))}function _r(e,t,n){let r=e.snapshot.options.sort;return r==="default"?vr(e,t,n):r(yr(e,t),yr(e,n))}function vr(e,t,n){let r=K(e,t),i=K(e,n),a=V(r);if(a!==V(i))return a?-1:1;let o=Mt(zt(e.snapshot.segmentTable,r.nameId),zt(e.snapshot.segmentTable,i.nameId));if(o!==0)return o;let s=qt(e.snapshot.segmentTable,r.nameId),c=qt(e.snapshot.segmentTable,i.nameId);return s===c?t<n?-1:1:s<c?-1:1}function yr(e,t){let n=K(e,t),r=W(e,t),i=V(n),a=i?r.slice(0,-1):r;return{basename:qt(e.snapshot.segmentTable,n.nameId),depth:bt(n),isDirectory:i,path:r,segments:a.length===0?[]:a.split(`/`)}}function br(e,t,n){let r=K(e,t),i=cr(e,n);if(i!=null){let t=K(e,i);if(V(t))return{basename:qt(e.snapshot.segmentTable,r.nameId),existingNodeId:null,parentId:i};let a=Ut(n).segments;return{basename:a[a.length-1]??``,existingNodeId:i,parentId:t.parentId}}let a=Ut(n),o=a.segments[a.segments.length-1]??``,s=a.segments.slice(0,-1),c=s.length===0?e.snapshot.rootId:lr(e,s,!0);if(c==null)throw Error(`Destination parent does not exist: "${n}"`);return{basename:o,existingNodeId:null,parentId:c}}function xr(e,t,n,r){if(n===`skip`)return`skip`;if(n===`error`)throw Error(`Destination already exists: "${W(e,t)}"`);let i=K(e,t);if(B(i)!==r)throw Error(`replace collision requires the same source and destination kinds`);if(V(i)&&G(e,t).childIds.length>0)throw Error(`replace collision does not support non-empty directories`);let a=i.parentId,o=i.nameId;return Sr(e,t),gr(e,a,t,o),Cr(e,a),ar(e,a),`handled`}function Sr(e,t){let n=[],r=[{nodeId:t,visitedChildren:!1}];for(;r.length>0;){let t=r.pop();if(t==null)break;let i=K(e,t.nodeId);if(t.visitedChildren||!V(i)){V(i)&&e.snapshot.directories.delete(t.nodeId),St(i,4),e.pathCacheByNodeId.delete(t.nodeId),e.collapsedDirectoryIds.delete(t.nodeId)&&(e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0),e.expandedDirectoryIds.delete(t.nodeId),Tn(e,t.nodeId),e.activeNodeCount--,n.push(t.nodeId);continue}r.push({nodeId:t.nodeId,visitedChildren:!0});let a=G(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 Cr(e,t){let n=t;for(;n!=null;){let t=K(e,n);if(!V(t)||H(t,2)||G(e,n).childIds.length>0)return;St(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,G(e,n)).get(t);if(i==null||!V(K(e,i)))break;n=i}return n}function Tr(e,t){let n=Or(e,t);if(n==null)return null;let r=Zn(e,n),i=K(e,r),a=n===r?null:Qn(e,n).map(t=>W(e,t));return JSON.stringify({flattenedSegmentPaths:a,hasChildren:G(e,r).childIds.length>0,path:W(e,r),terminalKind:B(i)})}function Er(e,t){return Dr([e],[t])}function Dr(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 Or(e,t){let n=t;for(;n!=null;){let t=K(e,n);if(!V(t)||H(t,2))return null;if(!gn(e,n,t))return n;n=t.parentId}return null}function kr(e,t){let n=K(e,t);if(Ct(n,(t===e.snapshot.rootId?-1:bt(K(e,n.parentId)))+1),!V(n))return;let r=G(e,t);for(let t of r.childIds)kr(e,t)}function Ar(e,t,n){let r=n;for(;r!=null;){if(r===t)return!0;let n=K(e,r);if(r===e.snapshot.rootId)return!1;r=n.parentId}return!1}function jr(e,t,n=K(e,t),r=!1){let i=e.instrumentation;if(i==null){Nr(e,t,n,r);return}U(i,`store.recomputeNodeCounts`,()=>Nr(e,t,n,r))}function Mr(e,t){let n=t;for(;n!=null;){let t=K(e,n),r=t.subtreeNodeCount,i=t.visibleSubtreeCount;if(jr(e,n,t),n===e.snapshot.rootId)return;let a=t.subtreeNodeCount-r,o=t.visibleSubtreeCount-i,s=t.parentId;(a!==0||o!==0)&&dt(G(e,s),n,a,o),n=s}}function Nr(e,t,n,r){if(!V(n)){n.subtreeNodeCount=1,n.visibleSubtreeCount=1;return}let i=G(e,t);if(r){let t=e.instrumentation;t==null?R(e.snapshot.nodes,i):U(t,`store.recomputeNodeCounts.rebuildChildAggregates`,()=>R(e.snapshot.nodes,i))}let a=1+i.totalChildSubtreeNodeCount,o=i.totalChildVisibleSubtreeCount;if(n.subtreeNodeCount=a,H(n,2)){n.visibleSubtreeCount=o;return}n.visibleSubtreeCount=Xn(e,t)==null?gn(e,t,n)?1+o:1:o}function Pr(e,t,n){let r=W(e,t);return r.length===0?n:`${r}${n}`}function Fr(e){return e!=null&&!H(e,4)}function Ir(e,t){let n=e.snapshot.nodes[t];return!Fr(n)||!V(n)||H(n,2)?null:n}function Lr(e){let t=0;for(let[n,r]of e.pathCacheByNodeId)r.version===e.pathCacheVersion&&Fr(e.snapshot.nodes[n])&&(t+=1);return t}function Rr(e){return Math.max(0,e.valueById.length-1)}function zr(e){return{activeNodeCount:e.activeNodeCount,cachedPathEntryCount:Lr(e),loadInfoEntryCount:e.directoryLoadInfoById.size,segmentCount:Rr(e.snapshot.segmentTable),totalNodeSlotCount:Math.max(0,e.snapshot.nodes.length-1)}}function Br(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 Vr(e){let t=[],n=[];for(let n of e.collapsedDirectoryIds)Ir(e,n)!=null&&t.push(W(e,n));for(let t of e.expandedDirectoryIds)Ir(e,t)!=null&&n.push(W(e,t));return{collapsedPaths:t,expandedPaths:n}}function Hr(e){let t=[];for(let[n,r]of e.directoryLoadInfoById)Ir(e,n)==null||yn(e,n)===`loaded`||t.push({info:{activeAttemptId:null,errorMessage:r.errorMessage,nextAttemptId:r.nextAttemptId,state:r.state},path:W(e,n)});return t}function Ur(e,t){e.collapsedDirectoryIds.clear(),e.hasCollapsedDirectoryOverrides=!1,e.expandedDirectoryIds.clear();for(let n of t.expandedPaths){let t=cr(e,n);t!=null&&_n(e,t,!0,K(e,t))}for(let n of t.collapsedPaths){let t=cr(e,n);t!=null&&_n(e,t,!1,K(e,t))}}function Wr(e,t){e.directoryLoadInfoById.clear();for(let n of t){let t=cr(e,n.path);t!=null&&Ir(e,t)!=null&&e.directoryLoadInfoById.set(t,{activeAttemptId:null,errorMessage:n.info.errorMessage,nextAttemptId:n.info.nextAttemptId,state:n.info.state})}}function Gr(e){e.pathCacheVersion+=1,e.pathCacheByNodeId.clear(),e.pathCacheByNodeId.set(e.snapshot.rootId,{path:``,version:e.pathCacheVersion})}function Kr(e){let t=e.snapshot.segmentTable,n=Gt();for(let r of e.snapshot.nodes)if(Fr(r)){if(H(r,2)){r.nameId=0;continue}r.nameId=Kt(n,qt(t,r.nameId))}e.snapshot.segmentTable=n}function qr(e){for(let[t,n]of e.snapshot.directories){let r=e.snapshot.nodes[t];if(!Fr(r)||!V(r)){e.snapshot.directories.delete(t);continue}let i=n.childIds.filter(n=>{let r=e.snapshot.nodes[n];return Fr(r)&&r.parentId===t});n.childIds=i,n.childIdByNameId=new Map(i.map(t=>[K(e,t).nameId,t])),n.childPositionById=new Map(i.map((e,t)=>[e,t])),R(e.snapshot.nodes,n)}}function Jr(e){let t=e.snapshot.nodes.length-1;for(;t>e.snapshot.rootId;){let n=e.snapshot.nodes[t];if(Fr(n))break;--t}e.snapshot.nodes.length=t+1}function Yr(e){let t=Vr(e),n=Hr(e);U(e.instrumentation,`store.cleanup.stable.clearPathCaches`,()=>Gr(e)),U(e.instrumentation,`store.cleanup.stable.rebuildSegmentTable`,()=>Kr(e)),U(e.instrumentation,`store.cleanup.stable.rebuildDirectoryIndexes`,()=>qr(e)),U(e.instrumentation,`store.cleanup.stable.trimTrailingRemovedNodeSlots`,()=>Jr(e)),U(e.instrumentation,`store.cleanup.stable.restoreExpansionOverrides`,()=>Ur(e,t)),U(e.instrumentation,`store.cleanup.stable.restoreDirectoryLoadInfos`,()=>Wr(e,n)),U(e.instrumentation,`store.cleanup.stable.recomputeCounts`,()=>or(e,e.snapshot.rootId))}function Xr(e){let t=Vr(e),n=Hr(e),r=U(e.instrumentation,`store.cleanup.aggressive.listPaths`,()=>$n(e)),i=Tt({...e.snapshot.options},e.instrumentation),a=U(e.instrumentation,`store.cleanup.aggressive.rebuildSnapshot`,()=>{let e=new dn(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,U(e.instrumentation,`store.cleanup.aggressive.restoreExpansionOverrides`,()=>Ur(e,t)),U(e.instrumentation,`store.cleanup.aggressive.restoreDirectoryLoadInfos`,()=>Wr(e,n)),U(e.instrumentation,`store.cleanup.aggressive.recomputeCounts`,()=>or(e,e.snapshot.rootId))}function Zr(e){for(let t of e.directoryLoadInfoById.values())if(t.state===`loading`&&t.activeAttemptId!=null)return!0;return!1}function Qr(e,t){let n=zr(e);t===`stable`?U(e.instrumentation,`store.cleanup.stable`,()=>Yr(e)):U(e.instrumentation,`store.cleanup.aggressive`,()=>Xr(e));let r=zr(e);return Br(t,t===`stable`,n,r)}var $r=64;function ei(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 ti(e){return K(e,e.snapshot.rootId).visibleSubtreeCount}function ni(e,t,n,r){let i=K(e,t.terminalNodeId),a=Math.max(1,i.visibleSubtreeCount);return Math.min(r-1,n+a-1)}function ri(e,t,n,r){return{ancestorPaths:r,index:t.index,posInSet:t.posInSet,row:Si(e,t.cursor),setSize:t.setSize,subtreeEndIndex:ni(e,t.cursor,t.index,n)}}function ii(e,t,n,r,i,a){let o=G(e,t),{childIndex:s,childVisibleIndex:c,localVisibleIndex:l}=ft(e.snapshot.nodes,o,n),u=o.childIds[s];if(u==null)throw Error(`Visible index ${String(n)} is out of range`);return ai(e,u,l,r+c,i+1,s,o.childIds.length,a)}function ai(e,t,n,r,i,a,o,s){if(!V(K(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=gi(e,t,i);if(n===0)return{ancestors:s,cursor:c,index:r,posInSet:a,setSize:o};let l=K(e,c.terminalNodeId);if(!V(l)||!gn(e,c.terminalNodeId,l))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return ii(e,c.terminalNodeId,n-1,r+1,c.visibleDepth,[...s,{cursor:c,index:r,posInSet:a,setSize:o}])}function oi(e,t){let n=ti(e);if(t<0||t>=n)return null;let r=ii(e,e.snapshot.rootId,t,0,-1,[]),i=r.ancestors.map(t=>W(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=ri(e,a,n,[...i]);t.push(r),i.push(r.row.path)}return a=t,a},index:r.index,posInSet:r.posInSet,row:Si(e,r.cursor),setSize:r.setSize,subtreeEndIndex:ni(e,r.cursor,r.index,n)}}function si(e,t,n){let r=e.instrumentation,i=ti(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 xi(e,o+1);let t=[],n=pi(e,a);for(let r=a;r<=o&&n!=null;r++){let r=Si(e,n);t.push(r),n=vi(e,n)}return t}let s=[],c=0,l=0,u=U(r,`store.getVisibleSlice.selectFirstRow`,()=>pi(e,a));for(let t=a;t<=o&&u!=null;t++){let t=U(r,`store.getVisibleSlice.materializeRow`,()=>Si(e,u));s.push(t),t.isFlattened&&(c++,l+=t.flattenedSegments?.length??0),u=U(r,`store.getVisibleSlice.advanceCursor`,()=>vi(e,u))}return Dt(r,`workload.visibleRowsRead`,s.length),Dt(r,`workload.flattenedRowsRead`,c),Dt(r,`workload.flattenedSegmentsRead`,l),s}function ci(e,t=ti(e)){let n=e.instrumentation;return n==null?bi(e,t):U(n,`store.getVisibleTreeProjection`,()=>bi(e,t))}function li(e){return yi(ci(e))}function ui(e,t){let n=cr(e,t);if(n==null||n===e.snapshot.rootId||V(K(e,n))&&Zn(e,n)!==n)return null;let r=0,i=n,{nodes:a,rootId:o}=e.snapshot;for(;i!==o;){let t=K(e,i).parentId,n=G(e,t),s=lt(n).get(i);if(s==null)throw Error(`Child ${String(i)} was not found in its parent index`);if(r+=pt(a,n,s),t!==o){let n=K(e,t),a=Xn(e,t);if(!gn(e,t,n)&&a!==i)return null;Zn(e,t)===t&&(r+=1)}i=t}return r}function di(e,t){let n=cr(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=K(e,n);if(!V(r))throw Error(`Path is not a directory: "${t}"`);return gn(e,n,r)?null:(_n(e,n,!0,r),ar(e,n),An({affectedAncestorIds:sr(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0}))}function fi(e,t){let n=cr(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=K(e,n);if(!V(r))throw Error(`Path is not a directory: "${t}"`);return gn(e,n,r)?(_n(e,n,!1,r),ar(e,n),jn({affectedAncestorIds:sr(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0})):null}function pi(e,t){return t<0||t>=ti(e)?null:mi(e,e.snapshot.rootId,t,-1)}function mi(e,t,n,r){let i=G(e,t),a=e.instrumentation,{childIndex:o,localVisibleIndex:s}=a==null?ft(e.snapshot.nodes,i,n):U(a,`store.getVisibleSlice.selectChildIndex`,()=>ft(e.snapshot.nodes,i,n)),c=i.childIds[o];if(c!=null)return hi(e,c,s,r+1);throw Error(`Visible index ${String(n)} is out of range`)}function hi(e,t,n,r){if(!V(K(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=gi(e,t,r);if(n===0)return i;let a=K(e,i.terminalNodeId);if(!V(a)||!gn(e,i.terminalNodeId,a))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return mi(e,i.terminalNodeId,n-1,i.visibleDepth)}function gi(e,t,n){return V(K(e,t))?e.instrumentation==null?{headNodeId:t,terminalNodeId:Zn(e,t),visibleDepth:n}:{headNodeId:t,terminalNodeId:U(e.instrumentation,`store.getVisibleSlice.flatten.resolveTerminalDirectory`,()=>Zn(e,t)),visibleDepth:n}:{headNodeId:t,terminalNodeId:t,visibleDepth:n}}function _i(e,t){let n=K(e,t);if(!V(n))return!0;let r=n.parentId;return r===e.snapshot.rootId?!0:Xn(e,r)!==t}function vi(e,t){let n=K(e,t.terminalNodeId);if(V(n)){let r=G(e,t.terminalNodeId);if(gn(e,t.terminalNodeId,n)&&r.childIds.length>0){let n=r.childIds[0];return n==null?null:hi(e,n,0,t.visibleDepth+1)}}let r=t.terminalNodeId,i=t.visibleDepth;for(;;){let t=K(e,r);if(r===e.snapshot.rootId)return null;let n=t.parentId,a=G(e,n),o=lt(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 hi(e,s,0,i);_i(e,r)&&i--,r=n}}function yi(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($r);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=ei(o,y);let x,S=_;if(V(v))S=f?Zn(e,_):_,x=S===_?`${b}${h[v.nameId]}/`:W(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&&V(C)&&gn(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 xi(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(!V(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:W(e,f)};continue}let h=l?Zn(e,f):f,g={headNodeId:f,terminalNodeId:h,visibleDepth:m};n[r++]=Si(e,g);let _=i[h];_!=null&&V(_)&&gn(e,h,_)&&s.push([a.get(h),0,m])}return r<t&&(n.length=r),n}function Si(e,t){let n=K(e,t.terminalNodeId),r=V(n)?Ci(e,t):null,i=W(e,t.terminalNodeId),a=qt(e.snapshot.segmentTable,n.nameId),o=V(n)&&G(e,t.terminalNodeId).childIds.length>0,s=t.headNodeId!==t.terminalNodeId,c=e.instrumentation,l=s?c==null?Qn(e,t.headNodeId).map(n=>{let r=K(e,n);return{isTerminal:n===t.terminalNodeId,name:qt(e.snapshot.segmentTable,r.nameId),nodeId:n,path:W(e,n)}}):U(c,`store.getVisibleSlice.flatten.collectSegments`,()=>Qn(e,t.headNodeId).map(n=>{let r=K(e,n);return{isTerminal:n===t.terminalNodeId,name:qt(e.snapshot.segmentTable,r.nameId),nodeId:n,path:W(e,n)}})):void 0;return{depth:t.visibleDepth,flattenedSegments:l,hasChildren:o,id:t.terminalNodeId,isExpanded:V(n)&&gn(e,t.terminalNodeId,n),isFlattened:s,isLoading:r===`loading`,kind:V(n)?`directory`:`file`,loadState:r==null||r===`loaded`?void 0:r,name:a,path:i}}function Ci(e,t){if(t.headNodeId===t.terminalNodeId)return yn(e,t.terminalNodeId);let n=Qn(e,t.headNodeId),r=!1,i=!1;for(let t of n){let n=yn(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||!V(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&&mt(n,i),r.subtreeNodeCount=1+c;let u;if(o&&s===1){let e=n[a[0]];u=e!=null&&V(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,mt(n,l),c.subtreeNodeCount=1+d,c.visibleSubtreeCount=f}function Ti(e){return e.initialExpansion===`open`&&(e.initialExpandedPaths==null||e.initialExpandedPaths.length===0)}var Ei=class e{#e;constructor(e={}){let t=Et(e),n=U(t,`store.builder.create`,()=>new dn(e));if(e.preparedInput!=null){let t=cn(e.preparedInput);t==null?n.appendPreparedPaths(sn(e.preparedInput),!1):n.appendPresortedPaths(t,ln(e.preparedInput))}else{let r=e.paths??[];e.presorted===!0?n.appendPaths(r):n.appendPreparedPaths(U(t,`store.preparePathEntries`,()=>un(r,e)))}let r=U(t,`store.builder.finish`,()=>n.finish({skipSubtreeCountPass:!0})),i=U(t,`store.state.detectAllDirectoriesExpanded`,()=>(e.initialExpansion??`closed`)===`closed`&&n.didMatchAllInitialExpandedPaths());this.#e=U(t,`store.state.create`,()=>fn(r,i?`open`:e.initialExpansion??`closed`,t)),i&&(this.#e.collapseNewDirectoriesByDefault=!0);let a=i?this.#e.snapshot.directories.size-1:U(t,`store.state.initializeExpandedPaths`,()=>this.initializeExpandedPaths(e.initialExpandedPaths));i||Ti(e)||(e.initialExpansion??`closed`)===`closed`&&a===this.#e.snapshot.directories.size-1||(e.initialExpandedPaths?.length??0)>0&&U(t,`store.state.checkAllDirectoriesExpanded`,()=>this.hasAllDirectoriesExpanded())?U(t,`store.state.initializeOpenVisibleCounts`,()=>wi(this.#e)):U(t,`store.state.recomputeCounts`,()=>or(this.#e,this.#e.snapshot.rootId))}static preparePaths(e,t={}){return rn(e,t)}static prepareInput(e,t={}){return an(e,t)}static preparePresortedInput(e){return on(e)}list(e){return U(this.#e.instrumentation,`store.list`,()=>$n(this.#e,e))}add(e){U(this.#e.instrumentation,`store.add`,()=>{let t=ti(this.#e);Bn(this.#e,Rn(this.#e,t,er(this.#e,e)))})}remove(e,t={}){U(this.#e.instrumentation,`store.remove`,()=>{let n=ti(this.#e);Bn(this.#e,Rn(this.#e,n,tr(this.#e,e,t)))})}move(e,t,n={}){U(this.#e.instrumentation,`store.move`,()=>{let r=ti(this.#e),i=nr(this.#e,e,t,n);i!=null&&Bn(this.#e,Rn(this.#e,r,i))})}batch(e){zn(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 U(this.#e.instrumentation,`store.getVisibleCount`,()=>ti(this.#e))}getVisibleSlice(e,t){return U(this.#e.instrumentation,`store.getVisibleSlice`,()=>si(this.#e,e,t))}getVisibleRowContext(e){return U(this.#e.instrumentation,`store.getVisibleRowContext`,()=>oi(this.#e,e))}getVisibleTreeProjection(){return li(this.#e)}getVisibleTreeProjectionData(e){return ci(this.#e,e)}getVisibleIndex(e){return U(this.#e.instrumentation,`store.getVisibleIndex`,()=>ui(this.#e,e))}getPathInfo(e){return U(this.#e.instrumentation,`store.getPathInfo`,()=>{let t=cr(this.#e,e);if(t==null)return null;let n=K(this.#e,t);return{depth:bt(n),kind:V(n)?`directory`:`file`,path:W(this.#e,t)}})}isExpanded(e){return U(this.#e.instrumentation,`store.isExpanded`,()=>{let t=this.requireDirectoryNodeId(e),n=K(this.#e,t);return gn(this.#e,t,n)})}expand(e){U(this.#e.instrumentation,`store.expand`,()=>{let t=ti(this.#e),n=di(this.#e,e);n!=null&&Bn(this.#e,Rn(this.#e,t,n))})}collapse(e){U(this.#e.instrumentation,`store.collapse`,()=>{let t=ti(this.#e),n=fi(this.#e,e);n!=null&&Bn(this.#e,Rn(this.#e,t,n))})}on(e,t){return En(this.#e,e,t)}getDirectoryLoadState(e){let t=this.requireDirectoryNodeId(e);return yn(this.#e,t)}markDirectoryUnloaded(e){U(this.#e.instrumentation,`store.markDirectoryUnloaded`,()=>{let t=this.requireDirectoryNodeId(e);if(G(this.#e,t).childIds.length>0)throw Error(`Cannot mark a directory with known children as unloaded: "${e}"`);let n=ti(this.#e);xn(this.#e,t),Bn(this.#e,Rn(this.#e,n,Mn({affectedAncestorIds:sr(this.#e,t),affectedNodeIds:[t],path:e,projectionChanged:this.isDirectoryProjectionVisible(t)})))})}beginChildLoad(e){return U(this.#e.instrumentation,`store.beginChildLoad`,()=>{let t=this.requireDirectoryNodeId(e),n=ti(this.#e),r=bn(this.#e,t);return Bn(this.#e,Rn(this.#e,n,Nn({affectedAncestorIds:sr(this.#e,t),affectedNodeIds:[t],attemptId:r.attemptId,path:e,projectionChanged:this.isDirectoryProjectionVisible(t),reused:r.reused}))),r})}applyChildPatch(e,t){return U(this.#e.instrumentation,`store.applyChildPatch`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null||yn(this.#e,n)!==`loading`||!Cn(this.#e,n,e.attemptId))return!1;let r=W(this.#e,n);this.validateChildPatch(r,t);let i=ti(this.#e),a=[];for(let e of t.operations){Di(r,e);let t=ti(this.#e);switch(e.type){case`add`:a.push(Rn(this.#e,t,er(this.#e,e.path)));break;case`remove`:a.push(Rn(this.#e,t,tr(this.#e,e.path,{recursive:e.recursive})));break;case`move`:{let n=nr(this.#e,e.from,e.to,{collision:e.collision});n!=null&&a.push(Rn(this.#e,t,n));break}}}let o=a.some(e=>e.projectionChanged)||this.isDirectoryProjectionVisible(n);return Bn(this.#e,Rn(this.#e,i,Pn({affectedAncestorIds:sr(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,childEvents:a,path:W(this.#e,n),projectionChanged:o}))),!0})}completeChildLoad(e){return U(this.#e.instrumentation,`store.completeChildLoad`,()=>{let t=this.resolveActiveDirectoryNodeId(e.nodeId);if(t==null)return!1;let n=ti(this.#e),r=Sn(this.#e,t,e.attemptId);return Bn(this.#e,Rn(this.#e,n,Fn({affectedAncestorIds:sr(this.#e,t),affectedNodeIds:[t],attemptId:e.attemptId,path:W(this.#e,t),projectionChanged:this.isDirectoryProjectionVisible(t),stale:!r}))),r})}failChildLoad(e,t){return U(this.#e.instrumentation,`store.failChildLoad`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null)return!1;let r=ti(this.#e),i=wn(this.#e,n,e.attemptId,t);return Bn(this.#e,Rn(this.#e,r,In({affectedAncestorIds:sr(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,errorMessage:t,path:W(this.#e,n),projectionChanged:this.isDirectoryProjectionVisible(n),stale:!i}))),i})}cleanup(e={}){return U(this.#e.instrumentation,`store.cleanup`,()=>{if(this.#e.transactionStack.length>0)throw Error(`Cleanup cannot run during an open batch or transaction.`);if(Zr(this.#e))throw Error(`Cleanup cannot run while directory loads are active.`);let t=ti(this.#e),n=Qr(this.#e,e.mode??`stable`);return Bn(this.#e,Rn(this.#e,t,Ln({...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=G(this.#e,p).childIds,_=m===d?n[m]??0:0,v=_,y,b=l.get(a)??At(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=Mt(zt(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(!V(K(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=K(this.#e,n);gn(this.#e,n,i)||(_n(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=K(this.#e,e);if(!gn(this.#e,e,t))return!1}return!0}requireDirectoryNodeId(e){let t=cr(this.#e,e);if(t==null)throw Error(`Path does not exist: "${e}"`);if(!V(K(this.#e,t)))throw Error(`Path is not a directory: "${e}"`);return t}resolveActiveDirectoryNodeId(e){try{if(!V(K(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=K(this.#e,t).parentId;if(e!==this.#e.snapshot.rootId){let n=K(this.#e,e),r=Xn(this.#e,e);if(!gn(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 Di(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 Oi={compact:{itemHeight:24,factor:.8},default:{itemHeight:30,factor:1},relaxed:{itemHeight:36,factor:1.2}};function ki(e,t){if(typeof e==`number`)return{itemHeight:t??Oi.default.itemHeight,factor:e};let n=Oi[e??`default`];return{itemHeight:t??n.itemHeight,factor:n.factor}}var Ai=Oi.default.itemHeight,ji=`@layer base, theme, unsafe;
|
|
1
|
+
import{E as e,Ft as t,Gd as n,Jo as r,Ld as i,Mo as a,No as o,O as s,P as c,Qo as l,S as u,Xt as d,cf as f,df as p,go as m,j as h,ol as g,tn as _,w as v,x as y,yo as b}from"./textarea-Zwf6kD06.js";import{a as x,c as S,i as C,n as ee,o as w,r as T,s as E,t as te}from"./fileCommentAnnotations-CLPA7umr.js";import{A as ne,C as D,Cr as O,F as k,Gn as A,Ht as j,I as M,Jn as N,M as re,Mr as ie,N as ae,Ot as P,P as F,Rt as oe,S as se,Tn as ce,Un as le,Vn as ue,Wt as de,Xn as fe,Yn as pe,Zt as me,_ as he,_r as ge,b as _e,br as ve,bt as ye,cn as be,d as xe,dn as Se,dr as Ce,er as we,f as I,fn as Te,g as Ee,gr as De,h as Oe,hr as ke,jr as Ae,jt as je,kr as Me,l as Ne,ln as Pe,m as Fe,mr as Ie,p as Le,pn as Re,tn as ze,u as Be,un as Ve,vt as He,x as Ue,y as We,zt as Ge}from"./index-c0OLJn1C.js";var Ke=b(`code-xml`,[[`path`,{d:`m18 16 4-4-4-4`,key:`1inbqp`}],[`path`,{d:`m6 8-4 4 4 4`,key:`15zrgr`}],[`path`,{d:`m14.5 4-5 16`,key:`e7oirm`}]]),qe=b(`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`}]]),Je=`file-tree-container`,Ye=`data-file-tree-style`,Xe=`data-file-tree-unsafe-css`,Ze=`data-file-tree-scrollbar-measure`,Qe=`data-file-tree-scrollbar-gutter-measured`,$e=`--trees-scrollbar-gutter-measured`,et=`header`,tt=`context-menu`,nt=`context-menu-trigger`,rt=5,it=1<<rt,at=it*4;function ot(){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 lt(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 ut(e,t){e.childPositionById!=null&&e.childPositionById.set(t,e.childIds.length),e.childIds.push(t)}function L(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 R(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,mt(e,t)}function dt(e,t,n,r){if(e.totalChildSubtreeNodeCount+=n,e.totalChildVisibleSubtreeCount+=r,e.childVisibleChunkSums==null||r===0)return;let i=lt(e).get(t);if(i===void 0)return;let a=i>>rt;e.childVisibleChunkSums[a]+=r}function ft(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=ht(e,t,a,i);return{...r,childVisibleIndex:n-r.localVisibleIndex}}i-=o,a+=it}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 pt(e,t,n){let r=0,i=t.childVisibleChunkSums,a=0;if(i!=null){let e=n>>rt;for(let t=0;t<e;t+=1)r+=i[t]??0;a=e<<rt}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 mt(e,t){if(t.childIds.length<at){t.childVisibleChunkSums=null;return}let n=Math.ceil(t.childIds.length/it),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>>rt]+=a.visibleSubtreeCount)}t.childVisibleChunkSums=r}function ht(e,t,n,r){let i=Math.min(t.childIds.length,n+it),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 gt=7,_t=3,vt=1<<_t,yt=4;function z(e,t,n=0){return e<<yt|n<<_t|t}function bt(e){return e.depthAndFlags>>>yt}function B(e){return(e.depthAndFlags&vt)>>_t}function V(e){return(e.depthAndFlags&vt)!==0}function xt(e){return e.depthAndFlags>}function H(e,t){return(xt(e)&t)!==0}function St(e,t){e.depthAndFlags|=t}function Ct(e,t){e.depthAndFlags=z(t,xt(e),B(e))}var wt=Symbol(`benchmarkInstrumentation`);function Tt(e,t){return t==null||Object.defineProperty(e,wt,{configurable:!0,enumerable:!1,value:t,writable:!1}),e}function Et(e){return e==null?null:e[wt]??null}function U(e,t,n){return e==null?n():e.measurePhase(t,n)}function Dt(e,t,n){!Number.isFinite(n)||e==null||e.setCounter(t,n)}function Ot(e){return e>=48&&e<=57}function kt(e){let t=[],n=0,r=0;for(;r<e.length;){for(;r<e.length&&!Ot(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&&Ot(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 At(e){let t=e.toLowerCase();return{lowerValue:t,tokens:kt(t)}}function jt(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 Mt(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=jt(e.tokens,t.tokens);return n===0?e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1:n}function Nt(e,t,n){let r=Mt(n(e),n(t));return r===0?e===t?0:e<t?-1:1:r}function Pt(e,t){return Nt(e,t,At)}function Ft(e,t){return t===e.segments.length-1?+!!e.isDirectory:1}function It(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=Ft(e,r);return a===Ft(t,r)?Pt(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 Lt(e,t){return It(e,t)}function Rt(e,t,n){let r=e=>{let t=n.get(e);if(t!=null)return t;let r=At(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=Ft(e,n);return o===Ft(t,n)?Nt(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 zt(e,t){let n=e.sortKeyById[t];if(n!==void 0)return n;let r=e.valueById[t],i=At(r);return e.sortKeyById[t]=i,i}function Bt(e={}){return{flattenEmptyDirectories:e.flattenEmptyDirectories!==!1,sort:e.sort??`default`}}function Vt(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 Ht(e){let{hasTrailingSlash:t,segments:n}=Vt(e);return{basename:n[n.length-1]??``,isDirectory:t,path:e,segments:n}}function Ut(e){if(e.length===0)return{requiresDirectory:!1,segments:[]};let{hasTrailingSlash:t,segments:n}=Vt(e);return{requiresDirectory:t,segments:n}}var Wt=``;function Gt(){let e=new Map;return e.set(Wt,0),{idByValue:e,valueById:[Wt],sortKeyById:[At(Wt)]}}function Kt(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 qt(e,t){let n=e.valueById[t];if(n===void 0)throw Error(`Unknown segment ID: ${String(t)}`);return n}var Jt=Symbol(`pathStorePreparedInputKind`);function Yt(e,t){return e[Jt]=t,e}function Xt(e){return{basename:e.basename,depth:e.segments.length,isDirectory:e.isDirectory,path:e.path,segments:e.segments}}function Zt(e,t,n){return n==="default"?Lt(e,t):n(Xt(e),Xt(t))}function Qt(){return{depthAndFlags:z(0,3,1),nameId:0,parentId:0,subtreeNodeCount:1,visibleSubtreeCount:1}}function $t(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 en(e){return e.isDirectory?e.segments.length:e.segments.length-1}function tn(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 nn(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function rn(e,t={}){return un(e,t).map(e=>e.path)}function an(e,t={}){let n=un(e,t);return Yt({paths:n.map(e=>e.path),preparedPaths:n},`prepared`)}function on(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 Yt({paths:e,presortedPaths:e,presortedPathsContainDirectories:n},`presorted`)}function sn(e){let t=e,n=t.preparedPaths;if(t[Jt]===`prepared`&&n!=null)return n;if(!tn(n))throw Error(`preparedInput must come from PathStore.prepareInput()`);return n}function cn(e){let t=e;return t[Jt]===`presorted`&&t.presortedPaths!=null||nn(t.presortedPaths)?t.presortedPaths:null}function ln(e){let t=e;return typeof t.presortedPathsContainDirectories==`boolean`?t.presortedPathsContainDirectories:null}function un(e,t={}){let n=Bt(t),r=Et(t);Dt(r,`workload.inputFiles`,e.length);let i=U(r,`store.preparePathEntries.parse`,()=>e.map(e=>Ht(e)));return U(r,`store.preparePathEntries.sort`,()=>i.sort((e,t)=>Zt(e,t,n.sort))),i}var dn=class{directories=new Map;directoryStack=[0];presortedDirectoryNodeIds=[];initialExpandedPathSet;createdDirectoriesAllExpanded=!1;createdDirectoryCount=0;lastPreparedPath=null;nodes=[Qt()];options;instrumentation;segmentSortKeyCache=new Map;segmentTable=Gt();hasDeferredDirectoryIndexes=!1;constructor(e={}){this.instrumentation=Et(e),this.options=Bt(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,ot())}appendPaths(e){return U(this.instrumentation,`store.builder.appendPaths.parse`,()=>this.appendPreparedPaths(e.map(e=>Ht(e))))}appendPreparedPaths(e,t=!0){return this.createdDirectoriesAllExpanded=!1,U(this.instrumentation,`store.builder.appendPreparedPaths`,()=>{for(let n of e)this.appendPreparedPath(n,t)}),this}appendPresortedPaths(e,t=null){return U(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:z(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:z(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:z(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=Ht(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:z(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:z(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=Ht(t)),this.hasDeferredDirectoryIndexes=!0}finish(e={}){let t=e.skipSubtreeCountPass===!0;return this.hasDeferredDirectoryIndexes?(U(this.instrumentation,`store.builder.buildDirectoryIndexes`,()=>this.buildPresortedFinish(t)),this.hasDeferredDirectoryIndexes=!1):t||U(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"?Rt(this.lastPreparedPath,e,this.segmentSortKeyCache):Zt(this.lastPreparedPath,e,this.options.sort))>0)throw Error(`Builder input must be sorted before appendPaths(): "${e.path}"`)}let n=this.lastPreparedPath,r=en(e),i=n==null?0:en(n),a=n==null?0:$t(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=Kt(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:z(bt(o)+1,0),nameId:r,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),a?.set(r,s),ut(i,s),s}createFileChildUnchecked(e,t){let n=Kt(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:z(bt(i)+1,0),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),ut(r,a),a}getOrCreateDirectoryChild(e,t){let n=Kt(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&&!V(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:z(bt(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),ut(r,a),this.directories.set(a,ot()),a}createDirectoryChild(e,t){let n=Kt(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:z(bt(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),ut(r,a),this.directories.set(a,ot()),a}promoteDirectoryToExplicit(e,t){let n=this.nodes[e];if(n===void 0)throw Error(`Unknown directory node ID: ${String(e)}`);if(!V(n))throw Error(`Path is not a directory: "${t}"`);if(H(n,1))throw Error(`Duplicate path: "${t}"`);St(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(V(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;V(n)&&this.directories.set(t,ot());let r=this.directories.get(n.parentId);r!=null&&(r.childIdByNameId!=null&&r.childIdByNameId.set(n.nameId,t),ut(r,t))}}computeSubtreeCounts(e){let t=this.nodes[e];if(t===void 0)throw Error(`Unknown node ID: ${String(e)}`);if(!V(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 R(this.nodes,n),t.subtreeNodeCount=r,t.visibleSubtreeCount=r,r}};function fn(e,t=`closed`,n=null){let r=mn(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 pn(){return{affectedAncestorIds:new Set,affectedNodeIds:new Set,events:[]}}function mn(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 hn(e,t){return H(t,2)||e.defaultExpansion===`open`?!0:e.defaultExpansion===`closed`?!1:bt(t)<=e.defaultExpansion}function gn(e,t,n=e.snapshot.nodes[t]){return n==null||!V(n)?!1:e.directoriesOpenByDefault&&!e.hasCollapsedDirectoryOverrides?!0:e.collapsedDirectoryIds.has(t)?!1:e.expandedDirectoryIds.has(t)?!0:hn(e,n)}function _n(e,t,n,r=e.snapshot.nodes[t]){if(r==null||!V(r))return;let i=hn(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 vn(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 yn(e,t){return e.directoryLoadInfoById.get(t)?.state??`loaded`}function bn(e,t){let n=vn(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 xn(e,t){let n=vn(e,t);n.activeAttemptId=null,n.errorMessage=null,n.state=`unloaded`}function Sn(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 Cn(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 Tn(e,t){e.directoryLoadInfoById.delete(t)}function En(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 Dn(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`add`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function On(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`remove`,path:e.path,projectionChanged:e.projectionChanged,recursive:e.recursive,visibleCountDelta:null}}function kn(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,from:e.from,operation:`move`,projectionChanged:e.projectionChanged,to:e.to,visibleCountDelta:null}}function An(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`expand`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function jn(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`collapse`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function Mn(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`mark-directory-unloaded`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function Nn(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 Pn(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 Fn(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 In(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 Ln(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 Rn(e,t,n){return{...n,visibleCountDelta:Yn(e)-t}}function zn(e,t){let n=Yn(e),r=pn();e.transactionStack.push(r);try{t()}catch(t){throw Hn(e,r,!1),t}Hn(e,r,!0,Yn(e)-n)}function Bn(e,t){let n=e.instrumentation;if(n==null){Vn(e,t);return}U(n,`store.events.record`,()=>Vn(e,t))}function Vn(e,t){let n=e.transactionStack[e.transactionStack.length-1]??null;if(n==null){qn(e,t);return}n.events.push(t),Kn(n,t)}function Hn(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?Gn(i,t):U(n,`store.events.batch.merge`,()=>Gn(i,t));return}let a=Un(t,r),o=e.instrumentation;if(o==null){qn(e,a);return}U(o,`store.events.batch.commit`,()=>qn(e,a))}function Un(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 Wn(e,t){for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n);for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n)}function Gn(e,t){for(let n of t.events)e.events.push(n);Wn(e,t)}function Kn(e,t){for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n);for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n)}function qn(e,t){let n=e.instrumentation;if(n==null){Jn(e,t);return}U(n,`store.events.emit`,()=>Jn(e,t))}function Jn(e,t){e.listeners.get(t.operation)?.forEach(e=>e(t)),e.listeners.get(`*`)?.forEach(e=>e(t))}function Yn(e){return e.snapshot.nodes[e.snapshot.rootId]?.visibleSubtreeCount??0}function Xn(e,t){if(e.snapshot.options.flattenEmptyDirectories!==!0)return null;let n=e.snapshot.nodes[t];if(n==null||!V(n)||H(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||!V(a)?null:i}function Zn(e,t){let n=t;for(;;){let t=Xn(e,n);if(t==null)return n;n=t}}function Qn(e,t){let n=[t],r=t;for(;;){let t=Xn(e,r);if(t==null)return n;n.push(t),r=t}}function $n(e,t){let n=t==null?e.snapshot.rootId:cr(e,t);return n==null?[]:ur(e,n)}function er(e,t){let n=Ht(t),r=n.isDirectory?n.segments:n.segments.slice(0,-1),i=Tr(e,wr(e,r)),{createdNodeIds:a,directoryId:o}=dr(e,r),s=new Set(a),c=o;if(n.isDirectory){let n=K(e,o);if(H(n,1))throw Error(`Path already exists: "${t}"`);St(n,1),e.pathCacheByNodeId.set(o,{path:t,version:e.pathCacheVersion}),s.add(o)}else c=pr(e,o,n.basename),s.add(c);ar(e,o);let l=Tr(e,o);return Dn({affectedAncestorIds:sr(e,c),affectedNodeIds:[...s],path:t,projectionChanged:Er(i,l)})}function tr(e,t,n){let r=cr(e,t);if(r==null)throw Error(`Path does not exist: "${t}"`);let i=K(e,r);if(H(i,2))throw Error(`The root node cannot be removed`);if(V(i)&&G(e,r).childIds.length>0&&n.recursive!==!0)throw Error(`Cannot remove a non-empty directory without recursive: "${t}"`);let a=i.parentId,o=Tr(e,a),s=Sr(e,r);gr(e,a,r,i.nameId),Cr(e,a),ar(e,a);let c=Tr(e,a);return On({affectedAncestorIds:sr(e,a),affectedNodeIds:s,path:t,projectionChanged:Er(o,c),recursive:n.recursive===!0})}function nr(e,t,n,r){let i=cr(e,t);if(i==null)throw Error(`Source path does not exist: "${t}"`);let a=K(e,i);if(H(a,2))throw Error(`The root node cannot be moved`);let o=r.collision??`error`,s=br(e,i,n),c=Tr(e,a.parentId),l=Tr(e,s.parentId),u=qt(e.snapshot.segmentTable,a.nameId),d=Kt(e.snapshot.segmentTable,s.basename);if(s.parentId===a.parentId&&u===s.basename)return null;if(V(a)&&Ar(e,i,s.parentId))throw Error(`Cannot move a directory into one of its descendants`);let f=ct(e.snapshot.nodes,G(e,s.parentId)).get(d),p=s.existingNodeId??f??null;if(p!=null&&p!==i&&xr(e,p,o,B(a))===`skip`)return null;let m=a.parentId;gr(e,m,i,a.nameId),a.parentId=s.parentId,a.nameId=d,e.pathCacheByNodeId.delete(i),kr(e,i),hr(e,s.parentId,i),Cr(e,m),e.pathCacheVersion++,ar(e,m),s.parentId!==m&&ar(e,s.parentId);let h=Tr(e,m),g=Tr(e,s.parentId);return kn({affectedAncestorIds:[...new Set([...sr(e,m),...sr(e,s.parentId)])],affectedNodeIds:[i],from:t,projectionChanged:Dr([c,l],[h,g]),to:W(e,i)})}function rr(e,t){let n=e.pathCacheByNodeId.get(t);return n!=null&&n.version===e.pathCacheVersion?n.path:null}function ir(e,t,n){return e.pathCacheByNodeId.set(t,{path:n,version:e.pathCacheVersion}),n}function W(e,t){let n=K(e,t),r=rr(e,t);if(r!=null)return r;if(H(n,2))return ir(e,t,``);let i=W(e,n.parentId),a=qt(e.snapshot.segmentTable,n.nameId),o=i.length===0?a:`${i}${a}`;return ir(e,t,V(n)?`${o}/`:o)}function ar(e,t){let n=e.instrumentation;if(n==null){Mr(e,t);return}U(n,`store.recomputeCountsUpwardFrom`,()=>Mr(e,t))}function or(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||!V(o)){jr(e,a,o,!0),n.pop();continue}let s=i.get(a);if(s==null||t[1]>=s.childIds.length){jr(e,a,o,!0),n.pop();continue}let c=s.childIds[t[1]++];n.push([c,0])}}function sr(e,t){let n=[],r=t;for(;r!=null;){let t=K(e,r);if(n.push(r),r===e.snapshot.rootId)break;r=t.parentId}return n}function cr(e,t){if(t.length===0)return e.snapshot.rootId;let n=Ut(t);return lr(e,n.segments,n.requiresDirectory)}function lr(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=G(e,r),a=ct(e.snapshot.nodes,i).get(t);if(a===void 0)return null;r=a}let i=K(e,r);return n&&!V(i)?null:r}function G(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 K(e,t){let n=e.snapshot.nodes[t];if(n===void 0||H(n,4))throw Error(`Unknown node ID: ${String(t)}`);return n}function ur(e,t){let n=e.snapshot.nodes[t];if(n===void 0||H(n,4))return[];if(!V(n))return[W(e,t)];if(G(e,t).childIds.length===0)return H(n,1)&&!H(n,2)?[W(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||H(n,4)){i.pop();continue}if(!V(n)){r.push(W(e,t.nodeId)),i.pop();continue}let a=G(e,t.nodeId);if(a.childIds.length===0){H(n,1)&&!H(n,2)&&r.push(W(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 dr(e,t){let n=[],r=e.snapshot.rootId;for(let i of t){let t=Kt(e.snapshot.segmentTable,i),a=G(e,r),o=ct(e.snapshot.nodes,a).get(t);if(o!==void 0){if(!V(K(e,o)))throw Error(`Cannot create a directory that collides with an existing file: "${i}"`);r=o;continue}r=fr(e,r,t),n.push(r)}return{createdNodeIds:n,directoryId:r}}function fr(e,t,n){let r=K(e,t),i=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:z(bt(r)+1,0,1),nameId:n,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),e.snapshot.directories.set(i,ot()),hr(e,t,i),e.collapseNewDirectoriesByDefault&&(e.collapsedDirectoryIds.add(i),e.hasCollapsedDirectoryOverrides=!0),e.activeNodeCount++,i}function pr(e,t,n){let r=Kt(e.snapshot.segmentTable,n),i=G(e,t);if(ct(e.snapshot.nodes,i).has(r))throw Error(`Path already exists: "${Pr(e,t,n)}"`);let a=K(e,t),o=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:z(bt(a)+1,0),nameId:r,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),hr(e,t,o),e.activeNodeCount++,o}function mr(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}_r(e,n,o)<0?i=a:r=a+1}return r}function hr(e,t,n){let r=G(e,t),i=K(e,n);ct(e.snapshot.nodes,r).set(i.nameId,n),dt(r,n,i.subtreeNodeCount,i.visibleSubtreeCount);let a=mr(e,r,n);r.childIds.splice(a,0,n),L(r,a),mt(e.snapshot.nodes,r)}function gr(e,t,n,r){let i=G(e,t),a=lt(i),o=a.get(n)??-1;ct(e.snapshot.nodes,i).delete(r),a.delete(n);let s=e.snapshot.nodes[n];s!=null&&dt(i,n,-s.subtreeNodeCount,-s.visibleSubtreeCount),o>=0&&(i.childIds.splice(o,1),L(i,o),mt(e.snapshot.nodes,i))}function _r(e,t,n){let r=e.snapshot.options.sort;return r==="default"?vr(e,t,n):r(yr(e,t),yr(e,n))}function vr(e,t,n){let r=K(e,t),i=K(e,n),a=V(r);if(a!==V(i))return a?-1:1;let o=Mt(zt(e.snapshot.segmentTable,r.nameId),zt(e.snapshot.segmentTable,i.nameId));if(o!==0)return o;let s=qt(e.snapshot.segmentTable,r.nameId),c=qt(e.snapshot.segmentTable,i.nameId);return s===c?t<n?-1:1:s<c?-1:1}function yr(e,t){let n=K(e,t),r=W(e,t),i=V(n),a=i?r.slice(0,-1):r;return{basename:qt(e.snapshot.segmentTable,n.nameId),depth:bt(n),isDirectory:i,path:r,segments:a.length===0?[]:a.split(`/`)}}function br(e,t,n){let r=K(e,t),i=cr(e,n);if(i!=null){let t=K(e,i);if(V(t))return{basename:qt(e.snapshot.segmentTable,r.nameId),existingNodeId:null,parentId:i};let a=Ut(n).segments;return{basename:a[a.length-1]??``,existingNodeId:i,parentId:t.parentId}}let a=Ut(n),o=a.segments[a.segments.length-1]??``,s=a.segments.slice(0,-1),c=s.length===0?e.snapshot.rootId:lr(e,s,!0);if(c==null)throw Error(`Destination parent does not exist: "${n}"`);return{basename:o,existingNodeId:null,parentId:c}}function xr(e,t,n,r){if(n===`skip`)return`skip`;if(n===`error`)throw Error(`Destination already exists: "${W(e,t)}"`);let i=K(e,t);if(B(i)!==r)throw Error(`replace collision requires the same source and destination kinds`);if(V(i)&&G(e,t).childIds.length>0)throw Error(`replace collision does not support non-empty directories`);let a=i.parentId,o=i.nameId;return Sr(e,t),gr(e,a,t,o),Cr(e,a),ar(e,a),`handled`}function Sr(e,t){let n=[],r=[{nodeId:t,visitedChildren:!1}];for(;r.length>0;){let t=r.pop();if(t==null)break;let i=K(e,t.nodeId);if(t.visitedChildren||!V(i)){V(i)&&e.snapshot.directories.delete(t.nodeId),St(i,4),e.pathCacheByNodeId.delete(t.nodeId),e.collapsedDirectoryIds.delete(t.nodeId)&&(e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0),e.expandedDirectoryIds.delete(t.nodeId),Tn(e,t.nodeId),e.activeNodeCount--,n.push(t.nodeId);continue}r.push({nodeId:t.nodeId,visitedChildren:!0});let a=G(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 Cr(e,t){let n=t;for(;n!=null;){let t=K(e,n);if(!V(t)||H(t,2)||G(e,n).childIds.length>0)return;St(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,G(e,n)).get(t);if(i==null||!V(K(e,i)))break;n=i}return n}function Tr(e,t){let n=Or(e,t);if(n==null)return null;let r=Zn(e,n),i=K(e,r),a=n===r?null:Qn(e,n).map(t=>W(e,t));return JSON.stringify({flattenedSegmentPaths:a,hasChildren:G(e,r).childIds.length>0,path:W(e,r),terminalKind:B(i)})}function Er(e,t){return Dr([e],[t])}function Dr(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 Or(e,t){let n=t;for(;n!=null;){let t=K(e,n);if(!V(t)||H(t,2))return null;if(!gn(e,n,t))return n;n=t.parentId}return null}function kr(e,t){let n=K(e,t);if(Ct(n,(t===e.snapshot.rootId?-1:bt(K(e,n.parentId)))+1),!V(n))return;let r=G(e,t);for(let t of r.childIds)kr(e,t)}function Ar(e,t,n){let r=n;for(;r!=null;){if(r===t)return!0;let n=K(e,r);if(r===e.snapshot.rootId)return!1;r=n.parentId}return!1}function jr(e,t,n=K(e,t),r=!1){let i=e.instrumentation;if(i==null){Nr(e,t,n,r);return}U(i,`store.recomputeNodeCounts`,()=>Nr(e,t,n,r))}function Mr(e,t){let n=t;for(;n!=null;){let t=K(e,n),r=t.subtreeNodeCount,i=t.visibleSubtreeCount;if(jr(e,n,t),n===e.snapshot.rootId)return;let a=t.subtreeNodeCount-r,o=t.visibleSubtreeCount-i,s=t.parentId;(a!==0||o!==0)&&dt(G(e,s),n,a,o),n=s}}function Nr(e,t,n,r){if(!V(n)){n.subtreeNodeCount=1,n.visibleSubtreeCount=1;return}let i=G(e,t);if(r){let t=e.instrumentation;t==null?R(e.snapshot.nodes,i):U(t,`store.recomputeNodeCounts.rebuildChildAggregates`,()=>R(e.snapshot.nodes,i))}let a=1+i.totalChildSubtreeNodeCount,o=i.totalChildVisibleSubtreeCount;if(n.subtreeNodeCount=a,H(n,2)){n.visibleSubtreeCount=o;return}n.visibleSubtreeCount=Xn(e,t)==null?gn(e,t,n)?1+o:1:o}function Pr(e,t,n){let r=W(e,t);return r.length===0?n:`${r}${n}`}function Fr(e){return e!=null&&!H(e,4)}function Ir(e,t){let n=e.snapshot.nodes[t];return!Fr(n)||!V(n)||H(n,2)?null:n}function Lr(e){let t=0;for(let[n,r]of e.pathCacheByNodeId)r.version===e.pathCacheVersion&&Fr(e.snapshot.nodes[n])&&(t+=1);return t}function Rr(e){return Math.max(0,e.valueById.length-1)}function zr(e){return{activeNodeCount:e.activeNodeCount,cachedPathEntryCount:Lr(e),loadInfoEntryCount:e.directoryLoadInfoById.size,segmentCount:Rr(e.snapshot.segmentTable),totalNodeSlotCount:Math.max(0,e.snapshot.nodes.length-1)}}function Br(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 Vr(e){let t=[],n=[];for(let n of e.collapsedDirectoryIds)Ir(e,n)!=null&&t.push(W(e,n));for(let t of e.expandedDirectoryIds)Ir(e,t)!=null&&n.push(W(e,t));return{collapsedPaths:t,expandedPaths:n}}function Hr(e){let t=[];for(let[n,r]of e.directoryLoadInfoById)Ir(e,n)==null||yn(e,n)===`loaded`||t.push({info:{activeAttemptId:null,errorMessage:r.errorMessage,nextAttemptId:r.nextAttemptId,state:r.state},path:W(e,n)});return t}function Ur(e,t){e.collapsedDirectoryIds.clear(),e.hasCollapsedDirectoryOverrides=!1,e.expandedDirectoryIds.clear();for(let n of t.expandedPaths){let t=cr(e,n);t!=null&&_n(e,t,!0,K(e,t))}for(let n of t.collapsedPaths){let t=cr(e,n);t!=null&&_n(e,t,!1,K(e,t))}}function Wr(e,t){e.directoryLoadInfoById.clear();for(let n of t){let t=cr(e,n.path);t!=null&&Ir(e,t)!=null&&e.directoryLoadInfoById.set(t,{activeAttemptId:null,errorMessage:n.info.errorMessage,nextAttemptId:n.info.nextAttemptId,state:n.info.state})}}function Gr(e){e.pathCacheVersion+=1,e.pathCacheByNodeId.clear(),e.pathCacheByNodeId.set(e.snapshot.rootId,{path:``,version:e.pathCacheVersion})}function Kr(e){let t=e.snapshot.segmentTable,n=Gt();for(let r of e.snapshot.nodes)if(Fr(r)){if(H(r,2)){r.nameId=0;continue}r.nameId=Kt(n,qt(t,r.nameId))}e.snapshot.segmentTable=n}function qr(e){for(let[t,n]of e.snapshot.directories){let r=e.snapshot.nodes[t];if(!Fr(r)||!V(r)){e.snapshot.directories.delete(t);continue}let i=n.childIds.filter(n=>{let r=e.snapshot.nodes[n];return Fr(r)&&r.parentId===t});n.childIds=i,n.childIdByNameId=new Map(i.map(t=>[K(e,t).nameId,t])),n.childPositionById=new Map(i.map((e,t)=>[e,t])),R(e.snapshot.nodes,n)}}function Jr(e){let t=e.snapshot.nodes.length-1;for(;t>e.snapshot.rootId;){let n=e.snapshot.nodes[t];if(Fr(n))break;--t}e.snapshot.nodes.length=t+1}function Yr(e){let t=Vr(e),n=Hr(e);U(e.instrumentation,`store.cleanup.stable.clearPathCaches`,()=>Gr(e)),U(e.instrumentation,`store.cleanup.stable.rebuildSegmentTable`,()=>Kr(e)),U(e.instrumentation,`store.cleanup.stable.rebuildDirectoryIndexes`,()=>qr(e)),U(e.instrumentation,`store.cleanup.stable.trimTrailingRemovedNodeSlots`,()=>Jr(e)),U(e.instrumentation,`store.cleanup.stable.restoreExpansionOverrides`,()=>Ur(e,t)),U(e.instrumentation,`store.cleanup.stable.restoreDirectoryLoadInfos`,()=>Wr(e,n)),U(e.instrumentation,`store.cleanup.stable.recomputeCounts`,()=>or(e,e.snapshot.rootId))}function Xr(e){let t=Vr(e),n=Hr(e),r=U(e.instrumentation,`store.cleanup.aggressive.listPaths`,()=>$n(e)),i=Tt({...e.snapshot.options},e.instrumentation),a=U(e.instrumentation,`store.cleanup.aggressive.rebuildSnapshot`,()=>{let e=new dn(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,U(e.instrumentation,`store.cleanup.aggressive.restoreExpansionOverrides`,()=>Ur(e,t)),U(e.instrumentation,`store.cleanup.aggressive.restoreDirectoryLoadInfos`,()=>Wr(e,n)),U(e.instrumentation,`store.cleanup.aggressive.recomputeCounts`,()=>or(e,e.snapshot.rootId))}function Zr(e){for(let t of e.directoryLoadInfoById.values())if(t.state===`loading`&&t.activeAttemptId!=null)return!0;return!1}function Qr(e,t){let n=zr(e);t===`stable`?U(e.instrumentation,`store.cleanup.stable`,()=>Yr(e)):U(e.instrumentation,`store.cleanup.aggressive`,()=>Xr(e));let r=zr(e);return Br(t,t===`stable`,n,r)}var $r=64;function ei(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 ti(e){return K(e,e.snapshot.rootId).visibleSubtreeCount}function ni(e,t,n,r){let i=K(e,t.terminalNodeId),a=Math.max(1,i.visibleSubtreeCount);return Math.min(r-1,n+a-1)}function ri(e,t,n,r){return{ancestorPaths:r,index:t.index,posInSet:t.posInSet,row:Si(e,t.cursor),setSize:t.setSize,subtreeEndIndex:ni(e,t.cursor,t.index,n)}}function ii(e,t,n,r,i,a){let o=G(e,t),{childIndex:s,childVisibleIndex:c,localVisibleIndex:l}=ft(e.snapshot.nodes,o,n),u=o.childIds[s];if(u==null)throw Error(`Visible index ${String(n)} is out of range`);return ai(e,u,l,r+c,i+1,s,o.childIds.length,a)}function ai(e,t,n,r,i,a,o,s){if(!V(K(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=gi(e,t,i);if(n===0)return{ancestors:s,cursor:c,index:r,posInSet:a,setSize:o};let l=K(e,c.terminalNodeId);if(!V(l)||!gn(e,c.terminalNodeId,l))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return ii(e,c.terminalNodeId,n-1,r+1,c.visibleDepth,[...s,{cursor:c,index:r,posInSet:a,setSize:o}])}function oi(e,t){let n=ti(e);if(t<0||t>=n)return null;let r=ii(e,e.snapshot.rootId,t,0,-1,[]),i=r.ancestors.map(t=>W(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=ri(e,a,n,[...i]);t.push(r),i.push(r.row.path)}return a=t,a},index:r.index,posInSet:r.posInSet,row:Si(e,r.cursor),setSize:r.setSize,subtreeEndIndex:ni(e,r.cursor,r.index,n)}}function si(e,t,n){let r=e.instrumentation,i=ti(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 xi(e,o+1);let t=[],n=pi(e,a);for(let r=a;r<=o&&n!=null;r++){let r=Si(e,n);t.push(r),n=vi(e,n)}return t}let s=[],c=0,l=0,u=U(r,`store.getVisibleSlice.selectFirstRow`,()=>pi(e,a));for(let t=a;t<=o&&u!=null;t++){let t=U(r,`store.getVisibleSlice.materializeRow`,()=>Si(e,u));s.push(t),t.isFlattened&&(c++,l+=t.flattenedSegments?.length??0),u=U(r,`store.getVisibleSlice.advanceCursor`,()=>vi(e,u))}return Dt(r,`workload.visibleRowsRead`,s.length),Dt(r,`workload.flattenedRowsRead`,c),Dt(r,`workload.flattenedSegmentsRead`,l),s}function ci(e,t=ti(e)){let n=e.instrumentation;return n==null?bi(e,t):U(n,`store.getVisibleTreeProjection`,()=>bi(e,t))}function li(e){return yi(ci(e))}function ui(e,t){let n=cr(e,t);if(n==null||n===e.snapshot.rootId||V(K(e,n))&&Zn(e,n)!==n)return null;let r=0,i=n,{nodes:a,rootId:o}=e.snapshot;for(;i!==o;){let t=K(e,i).parentId,n=G(e,t),s=lt(n).get(i);if(s==null)throw Error(`Child ${String(i)} was not found in its parent index`);if(r+=pt(a,n,s),t!==o){let n=K(e,t),a=Xn(e,t);if(!gn(e,t,n)&&a!==i)return null;Zn(e,t)===t&&(r+=1)}i=t}return r}function di(e,t){let n=cr(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=K(e,n);if(!V(r))throw Error(`Path is not a directory: "${t}"`);return gn(e,n,r)?null:(_n(e,n,!0,r),ar(e,n),An({affectedAncestorIds:sr(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0}))}function fi(e,t){let n=cr(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=K(e,n);if(!V(r))throw Error(`Path is not a directory: "${t}"`);return gn(e,n,r)?(_n(e,n,!1,r),ar(e,n),jn({affectedAncestorIds:sr(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0})):null}function pi(e,t){return t<0||t>=ti(e)?null:mi(e,e.snapshot.rootId,t,-1)}function mi(e,t,n,r){let i=G(e,t),a=e.instrumentation,{childIndex:o,localVisibleIndex:s}=a==null?ft(e.snapshot.nodes,i,n):U(a,`store.getVisibleSlice.selectChildIndex`,()=>ft(e.snapshot.nodes,i,n)),c=i.childIds[o];if(c!=null)return hi(e,c,s,r+1);throw Error(`Visible index ${String(n)} is out of range`)}function hi(e,t,n,r){if(!V(K(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=gi(e,t,r);if(n===0)return i;let a=K(e,i.terminalNodeId);if(!V(a)||!gn(e,i.terminalNodeId,a))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return mi(e,i.terminalNodeId,n-1,i.visibleDepth)}function gi(e,t,n){return V(K(e,t))?e.instrumentation==null?{headNodeId:t,terminalNodeId:Zn(e,t),visibleDepth:n}:{headNodeId:t,terminalNodeId:U(e.instrumentation,`store.getVisibleSlice.flatten.resolveTerminalDirectory`,()=>Zn(e,t)),visibleDepth:n}:{headNodeId:t,terminalNodeId:t,visibleDepth:n}}function _i(e,t){let n=K(e,t);if(!V(n))return!0;let r=n.parentId;return r===e.snapshot.rootId?!0:Xn(e,r)!==t}function vi(e,t){let n=K(e,t.terminalNodeId);if(V(n)){let r=G(e,t.terminalNodeId);if(gn(e,t.terminalNodeId,n)&&r.childIds.length>0){let n=r.childIds[0];return n==null?null:hi(e,n,0,t.visibleDepth+1)}}let r=t.terminalNodeId,i=t.visibleDepth;for(;;){let t=K(e,r);if(r===e.snapshot.rootId)return null;let n=t.parentId,a=G(e,n),o=lt(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 hi(e,s,0,i);_i(e,r)&&i--,r=n}}function yi(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($r);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=ei(o,y);let x,S=_;if(V(v))S=f?Zn(e,_):_,x=S===_?`${b}${h[v.nameId]}/`:W(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&&V(C)&&gn(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 xi(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(!V(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:W(e,f)};continue}let h=l?Zn(e,f):f,g={headNodeId:f,terminalNodeId:h,visibleDepth:m};n[r++]=Si(e,g);let _=i[h];_!=null&&V(_)&&gn(e,h,_)&&s.push([a.get(h),0,m])}return r<t&&(n.length=r),n}function Si(e,t){let n=K(e,t.terminalNodeId),r=V(n)?Ci(e,t):null,i=W(e,t.terminalNodeId),a=qt(e.snapshot.segmentTable,n.nameId),o=V(n)&&G(e,t.terminalNodeId).childIds.length>0,s=t.headNodeId!==t.terminalNodeId,c=e.instrumentation,l=s?c==null?Qn(e,t.headNodeId).map(n=>{let r=K(e,n);return{isTerminal:n===t.terminalNodeId,name:qt(e.snapshot.segmentTable,r.nameId),nodeId:n,path:W(e,n)}}):U(c,`store.getVisibleSlice.flatten.collectSegments`,()=>Qn(e,t.headNodeId).map(n=>{let r=K(e,n);return{isTerminal:n===t.terminalNodeId,name:qt(e.snapshot.segmentTable,r.nameId),nodeId:n,path:W(e,n)}})):void 0;return{depth:t.visibleDepth,flattenedSegments:l,hasChildren:o,id:t.terminalNodeId,isExpanded:V(n)&&gn(e,t.terminalNodeId,n),isFlattened:s,isLoading:r===`loading`,kind:V(n)?`directory`:`file`,loadState:r==null||r===`loaded`?void 0:r,name:a,path:i}}function Ci(e,t){if(t.headNodeId===t.terminalNodeId)return yn(e,t.terminalNodeId);let n=Qn(e,t.headNodeId),r=!1,i=!1;for(let t of n){let n=yn(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||!V(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&&mt(n,i),r.subtreeNodeCount=1+c;let u;if(o&&s===1){let e=n[a[0]];u=e!=null&&V(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,mt(n,l),c.subtreeNodeCount=1+d,c.visibleSubtreeCount=f}function Ti(e){return e.initialExpansion===`open`&&(e.initialExpandedPaths==null||e.initialExpandedPaths.length===0)}var Ei=class e{#e;constructor(e={}){let t=Et(e),n=U(t,`store.builder.create`,()=>new dn(e));if(e.preparedInput!=null){let t=cn(e.preparedInput);t==null?n.appendPreparedPaths(sn(e.preparedInput),!1):n.appendPresortedPaths(t,ln(e.preparedInput))}else{let r=e.paths??[];e.presorted===!0?n.appendPaths(r):n.appendPreparedPaths(U(t,`store.preparePathEntries`,()=>un(r,e)))}let r=U(t,`store.builder.finish`,()=>n.finish({skipSubtreeCountPass:!0})),i=U(t,`store.state.detectAllDirectoriesExpanded`,()=>(e.initialExpansion??`closed`)===`closed`&&n.didMatchAllInitialExpandedPaths());this.#e=U(t,`store.state.create`,()=>fn(r,i?`open`:e.initialExpansion??`closed`,t)),i&&(this.#e.collapseNewDirectoriesByDefault=!0);let a=i?this.#e.snapshot.directories.size-1:U(t,`store.state.initializeExpandedPaths`,()=>this.initializeExpandedPaths(e.initialExpandedPaths));i||Ti(e)||(e.initialExpansion??`closed`)===`closed`&&a===this.#e.snapshot.directories.size-1||(e.initialExpandedPaths?.length??0)>0&&U(t,`store.state.checkAllDirectoriesExpanded`,()=>this.hasAllDirectoriesExpanded())?U(t,`store.state.initializeOpenVisibleCounts`,()=>wi(this.#e)):U(t,`store.state.recomputeCounts`,()=>or(this.#e,this.#e.snapshot.rootId))}static preparePaths(e,t={}){return rn(e,t)}static prepareInput(e,t={}){return an(e,t)}static preparePresortedInput(e){return on(e)}list(e){return U(this.#e.instrumentation,`store.list`,()=>$n(this.#e,e))}add(e){U(this.#e.instrumentation,`store.add`,()=>{let t=ti(this.#e);Bn(this.#e,Rn(this.#e,t,er(this.#e,e)))})}remove(e,t={}){U(this.#e.instrumentation,`store.remove`,()=>{let n=ti(this.#e);Bn(this.#e,Rn(this.#e,n,tr(this.#e,e,t)))})}move(e,t,n={}){U(this.#e.instrumentation,`store.move`,()=>{let r=ti(this.#e),i=nr(this.#e,e,t,n);i!=null&&Bn(this.#e,Rn(this.#e,r,i))})}batch(e){zn(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 U(this.#e.instrumentation,`store.getVisibleCount`,()=>ti(this.#e))}getVisibleSlice(e,t){return U(this.#e.instrumentation,`store.getVisibleSlice`,()=>si(this.#e,e,t))}getVisibleRowContext(e){return U(this.#e.instrumentation,`store.getVisibleRowContext`,()=>oi(this.#e,e))}getVisibleTreeProjection(){return li(this.#e)}getVisibleTreeProjectionData(e){return ci(this.#e,e)}getVisibleIndex(e){return U(this.#e.instrumentation,`store.getVisibleIndex`,()=>ui(this.#e,e))}getPathInfo(e){return U(this.#e.instrumentation,`store.getPathInfo`,()=>{let t=cr(this.#e,e);if(t==null)return null;let n=K(this.#e,t);return{depth:bt(n),kind:V(n)?`directory`:`file`,path:W(this.#e,t)}})}isExpanded(e){return U(this.#e.instrumentation,`store.isExpanded`,()=>{let t=this.requireDirectoryNodeId(e),n=K(this.#e,t);return gn(this.#e,t,n)})}expand(e){U(this.#e.instrumentation,`store.expand`,()=>{let t=ti(this.#e),n=di(this.#e,e);n!=null&&Bn(this.#e,Rn(this.#e,t,n))})}collapse(e){U(this.#e.instrumentation,`store.collapse`,()=>{let t=ti(this.#e),n=fi(this.#e,e);n!=null&&Bn(this.#e,Rn(this.#e,t,n))})}on(e,t){return En(this.#e,e,t)}getDirectoryLoadState(e){let t=this.requireDirectoryNodeId(e);return yn(this.#e,t)}markDirectoryUnloaded(e){U(this.#e.instrumentation,`store.markDirectoryUnloaded`,()=>{let t=this.requireDirectoryNodeId(e);if(G(this.#e,t).childIds.length>0)throw Error(`Cannot mark a directory with known children as unloaded: "${e}"`);let n=ti(this.#e);xn(this.#e,t),Bn(this.#e,Rn(this.#e,n,Mn({affectedAncestorIds:sr(this.#e,t),affectedNodeIds:[t],path:e,projectionChanged:this.isDirectoryProjectionVisible(t)})))})}beginChildLoad(e){return U(this.#e.instrumentation,`store.beginChildLoad`,()=>{let t=this.requireDirectoryNodeId(e),n=ti(this.#e),r=bn(this.#e,t);return Bn(this.#e,Rn(this.#e,n,Nn({affectedAncestorIds:sr(this.#e,t),affectedNodeIds:[t],attemptId:r.attemptId,path:e,projectionChanged:this.isDirectoryProjectionVisible(t),reused:r.reused}))),r})}applyChildPatch(e,t){return U(this.#e.instrumentation,`store.applyChildPatch`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null||yn(this.#e,n)!==`loading`||!Cn(this.#e,n,e.attemptId))return!1;let r=W(this.#e,n);this.validateChildPatch(r,t);let i=ti(this.#e),a=[];for(let e of t.operations){Di(r,e);let t=ti(this.#e);switch(e.type){case`add`:a.push(Rn(this.#e,t,er(this.#e,e.path)));break;case`remove`:a.push(Rn(this.#e,t,tr(this.#e,e.path,{recursive:e.recursive})));break;case`move`:{let n=nr(this.#e,e.from,e.to,{collision:e.collision});n!=null&&a.push(Rn(this.#e,t,n));break}}}let o=a.some(e=>e.projectionChanged)||this.isDirectoryProjectionVisible(n);return Bn(this.#e,Rn(this.#e,i,Pn({affectedAncestorIds:sr(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,childEvents:a,path:W(this.#e,n),projectionChanged:o}))),!0})}completeChildLoad(e){return U(this.#e.instrumentation,`store.completeChildLoad`,()=>{let t=this.resolveActiveDirectoryNodeId(e.nodeId);if(t==null)return!1;let n=ti(this.#e),r=Sn(this.#e,t,e.attemptId);return Bn(this.#e,Rn(this.#e,n,Fn({affectedAncestorIds:sr(this.#e,t),affectedNodeIds:[t],attemptId:e.attemptId,path:W(this.#e,t),projectionChanged:this.isDirectoryProjectionVisible(t),stale:!r}))),r})}failChildLoad(e,t){return U(this.#e.instrumentation,`store.failChildLoad`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null)return!1;let r=ti(this.#e),i=wn(this.#e,n,e.attemptId,t);return Bn(this.#e,Rn(this.#e,r,In({affectedAncestorIds:sr(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,errorMessage:t,path:W(this.#e,n),projectionChanged:this.isDirectoryProjectionVisible(n),stale:!i}))),i})}cleanup(e={}){return U(this.#e.instrumentation,`store.cleanup`,()=>{if(this.#e.transactionStack.length>0)throw Error(`Cleanup cannot run during an open batch or transaction.`);if(Zr(this.#e))throw Error(`Cleanup cannot run while directory loads are active.`);let t=ti(this.#e),n=Qr(this.#e,e.mode??`stable`);return Bn(this.#e,Rn(this.#e,t,Ln({...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=G(this.#e,p).childIds,_=m===d?n[m]??0:0,v=_,y,b=l.get(a)??At(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=Mt(zt(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(!V(K(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=K(this.#e,n);gn(this.#e,n,i)||(_n(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=K(this.#e,e);if(!gn(this.#e,e,t))return!1}return!0}requireDirectoryNodeId(e){let t=cr(this.#e,e);if(t==null)throw Error(`Path does not exist: "${e}"`);if(!V(K(this.#e,t)))throw Error(`Path is not a directory: "${e}"`);return t}resolveActiveDirectoryNodeId(e){try{if(!V(K(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=K(this.#e,t).parentId;if(e!==this.#e.snapshot.rootId){let n=K(this.#e,e),r=Xn(this.#e,e);if(!gn(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 Di(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 Oi={compact:{itemHeight:24,factor:.8},default:{itemHeight:30,factor:1},relaxed:{itemHeight:36,factor:1.2}};function ki(e,t){if(typeof e==`number`)return{itemHeight:t??Oi.default.itemHeight,factor:e};let n=Oi[e??`default`];return{itemHeight:t??n.itemHeight,factor:n.factor}}var Ai=Oi.default.itemHeight,ji=`@layer base, theme, unsafe;
|
|
2
2
|
|
|
3
3
|
@layer base {
|
|
4
4
|
:host {
|
|
@@ -1775,4 +1775,4 @@ import{E as e,Ft as t,Gd as n,Jo as r,Ld as i,Mo as a,No as o,O as s,P as c,Qo a
|
|
|
1775
1775
|
color: var(--diffs-selection-number-fg) !important;
|
|
1776
1776
|
}
|
|
1777
1777
|
`;function gf(e){let t=(0,kl.c)(8),n;t[0]!==e.absolutePath||t[1]!==e.threadRef.threadId?(n={_tag:`workspace-file`,threadId:e.threadRef.threadId,path:e.absolutePath},t[0]=e.absolutePath,t[1]=e.threadRef.threadId,t[2]=n):n=t[2];let r=ke(e.environmentId,n),[i,a]=(0,X.useState)(null);if(r._tag===`Failure`||r._tag===`Success`&&i===r.url){let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.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 workspace image.`}),t[3]=e):e=t[3],e}let o;return t[4]!==r._tag||t[5]!==r.url||t[6]!==e.alt?(o=r._tag===`Success`?(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-auto p-4`,children:(0,Z.jsx)(`img`,{className:`max-h-full max-w-full object-contain`,src:r.url,alt:e.alt,onError:()=>a(r.url)})}):(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center text-muted-foreground`,children:(0,Z.jsx)(Me,{className:`size-5 animate-spin`})}),t[4]=r._tag,t[5]=r.url,t[6]=e.alt,t[7]=o):o=t[7],o}function _f(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 vf(e,t){let n=e.shadowRoot??e;for(let e of n.querySelectorAll(`[${mf}]`))e.removeAttribute(mf);t!==null&&(n.querySelector(`[data-line="${t}"]`)?.setAttribute(mf,``),n.querySelector(`[data-column-number="${t}"]`)?.setAttribute(mf,``))}function yf(e,t,n){let r=(0,kl.c)(7),[i]=(0,X.useState)(Sf),[a]=(0,X.useState)(xf),[o]=(0,X.useState)(bf),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:_f(s.file?.contents??``,t);if(vf(r,u),!(s instanceof w))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 bf(){return new Map}function xf(){return new Map}function Sf(){return new Map}function Cf(t){let n=(0,kl.c)(19),{environmentId:r,cwd:i,relativePath:a,onPendingChange:o}=t,s=e(Ie.writeFile),c;n[0]!==o||n[1]!==a?(c=e=>o(a,e),n[0]=o,n[1]=a,n[2]=c):c=n[2];let l;n[3]!==i||n[4]!==r||n[5]!==a||n[6]!==s?(l=e=>s({environmentId:r,input:{cwd:i,relativePath:a,contents:e}}),n[3]=i,n[4]=r,n[5]=a,n[6]=s,n[7]=l):l=n[7];let u;n[8]!==i||n[9]!==r||n[10]!==a?(u=e=>{Ne(r,i,a,e)},n[8]=i,n[9]=r,n[10]=a,n[11]=u):u=n[11];let d;n[12]!==c||n[13]!==l||n[14]!==u?(d=new df({debounceMs:pf,onPendingChange:c,persist:l,onConfirmed:u}),n[12]=c,n[13]=l,n[14]=u,n[15]=d):d=n[15];let f=d,p,m;return n[16]===f?(p=n[17],m=n[18]):(p=()=>()=>f.dispose(),m=[f],n[16]=f,n[17]=p,n[18]=m),(0,X.useEffect)(p,m),f}function wf(e){let t=(0,kl.c)(74),{environmentId:n,cwd:r,relativePath:i,composerDraftTarget:a,contents:o,resolvedTheme:s,revealRequestId:c,wordWrap:l,onPostRender:u,onPendingChange:f}=e,p=d(jf),m=d(Af),h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(h=[],t[0]=h):h=t[0];let[g,v]=(0,X.useState)(h),[y,b]=(0,X.useState)(null),S=y?.revealRequestId===c?y.range:null,w;t[1]===c?w=t[2]:(w=e=>{b({revealRequestId:c,range:e})},t[1]=c,t[2]=w);let E=w,D=(0,X.useRef)(null),O=(0,X.useRef)(null),A;t[3]!==r||t[4]!==n||t[5]!==f||t[6]!==i?(A={environmentId:n,cwd:r,relativePath:i,onPendingChange:f},t[3]=r,t[4]=n,t[5]=f,t[6]=i,t[7]=A):A=t[7];let j=Cf(A),M;t[8]!==p||t[9]!==a||t[10]!==r||t[11]!==n||t[12]!==i||t[13]!==j?(M=new Ud({onChange:(e,t)=>{if(xe(n,r,i,e.contents),j.change(e.contents),t){let n=C(t);v(n);for(let t of n)for(let n of t.metadata.entries)n.kind===`comment`&&p(a,_({id:n.id,filePath:i,startLine:n.startLine,endLine:n.endLine,text:n.text,contents:e.contents}))}}}),t[8]=p,t[9]=a,t[10]=r,t[11]=n,t[12]=i,t[13]=j,t[14]=M):M=t[14];let N=M,ie,ae;t[15]===N?(ie=t[16],ae=t[17]):(ie=()=>()=>{N.cleanUp()},ae=[N],t[15]=N,t[16]=ie,t[17]=ae),(0,X.useEffect)(ie,ae);let P;t[18]!==a||t[19]!==m||t[20]!==E?(P=e=>{E(null),m(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]=m,t[20]=E,t[21]=P):P=t[21];let F=P,oe;t[22]!==p||t[23]!==a||t[24]!==o||t[25]!==g||t[26]!==i||t[27]!==E?(oe=(e,t)=>{E(null);let n=g.flatMap(kf).find(t=>t.id===e);n&&p(a,_({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]=p,t[23]=a,t[24]=o,t[25]=g,t[26]=i,t[27]=E,t[28]=oe):oe=t[28];let se=oe,ce;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(ce=e=>{let{startLine:t,endLine:n}=T(e),r={id:ee(),kind:`draft`,startLine:t,endLine:n,text:``};v(e=>{let t=e.flatMap(Df),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]=ce):ce=t[29];let le=ce,ue;t[30]===g?ue=t[31]:(ue=g.some(Tf),t[30]=g,t[31]=ue);let de=ue,fe,pe;t[32]!==N||t[33]!==de||t[34]!==E?(fe=()=>{let e=D.current;if(e)return af({root:e,editor:N,isBlocked:()=>de,onDismiss:()=>E(null)})},pe=[N,de,E],t[32]=N,t[33]=de,t[34]=E,t[35]=fe,t[36]=pe):(fe=t[35],pe=t[36]),(0,X.useEffect)(fe,pe);let me;t[37]===E?me=t[38]:(me=e=>{E(e),e&&le(e)},t[37]=E,t[38]=me);let he=me,ge;t[39]!==u||t[40]!==S?(ge=(e,t,n)=>{u(e,t,n),O.current!==null&&(cancelAnimationFrame(O.current),O.current=null),n!==`unmount`&&(O.current=requestAnimationFrame(()=>{O.current=null,e.isConnected&&t.setSelectedLines(S,{notify:!1})}))},t[39]=u,t[40]=S,t[41]=ge):ge=t[41];let _e=ge,ve;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(ve={overscrollSize:600,intersectionObserverMargin:1200},t[42]=ve):ve=t[42];let ye;t[43]!==o||t[44]!==r||t[45]!==i?(ye=sf(r,i,o),t[43]=o,t[44]=r,t[45]=i,t[46]=ye):ye=t[46];let be;t[47]!==o||t[48]!==i||t[49]!==ye?(be={name:i,contents:o,cacheKey:ye},t[47]=o,t[48]=i,t[49]=ye,t[50]=be):be=t[50];let Se=!de,Ce=!de,we=l?`wrap`:`scroll`,I;t[51]===s?I=t[52]:(I=ne(s),t[51]=s,t[52]=I);let Te;t[53]!==he||t[54]!==_e||t[55]!==s||t[56]!==E||t[57]!==Se||t[58]!==Ce||t[59]!==we||t[60]!==I?(Te={disableFileHeader:!0,enableGutterUtility:Se,enableLineSelection:Ce,onGutterUtilityClick:E,onLineSelectionChange:E,onLineSelectionEnd:he,overflow:we,theme:I,themeType:s,unsafeCSS:hf,onPostRender:_e},t[53]=he,t[54]=_e,t[55]=s,t[56]=E,t[57]=Se,t[58]=Ce,t[59]=we,t[60]=I,t[61]=Te):Te=t[61];let Ee;t[62]!==F||t[63]!==se?(Ee=e=>(0,Z.jsx)(`div`,{className:`py-1`,children:e.metadata.entries.map(e=>(0,Z.jsx)(x,{kind:e.kind,rangeLabel:te(e.startLine,e.endLine),text:e.text,onCancel:()=>F(e.id),onComment:t=>se(e.id,t),onDelete:()=>F(e.id)},e.id))}),t[62]=F,t[63]=se,t[64]=Ee):Ee=t[64];let De;t[65]!==g||t[66]!==S||t[67]!==be||t[68]!==Te||t[69]!==Ee?(De=(0,Z.jsx)(`div`,{ref:D,className:`flex min-h-0 flex-1`,children:(0,Z.jsx)(re,{className:`file-preview-virtualizer min-h-0 flex-1 overflow-auto`,config:ve,children:(0,Z.jsx)(Ol,{file:be,options:Te,selectedLines:S,lineAnnotations:g,renderAnnotation:Ee,className:`min-h-full`,contentEditable:!0})})}),t[65]=g,t[66]=S,t[67]=be,t[68]=Te,t[69]=Ee,t[70]=De):De=t[70];let Oe;return t[71]!==N||t[72]!==De?(Oe=(0,Z.jsx)(k,{editor:N,children:De}),t[71]=N,t[72]=De,t[73]=Oe):Oe=t[73],Oe}function Tf(e){return e.metadata.entries.some(Ef)}function Ef(e){return e.kind===`draft`}function Df(e){let t=e.metadata.entries.filter(Of);return t.length>0?[{...e,metadata:{entries:t}}]:[]}function Of(e){return e.kind!==`draft`}function kf(e){return e.metadata.entries}function Af(e){return e.removeReviewComment}function jf(e){return e.addReviewComment}function Mf(e){let t=(0,kl.c)(16),{environmentId:n,cwd:r,relativePath:i,contents:a,threadRef:o,onPendingChange:s}=e,c;t[0]!==r||t[1]!==n||t[2]!==s||t[3]!==i?(c={environmentId:n,cwd:r,relativePath:i,onPendingChange:s},t[0]=r,t[1]=n,t[2]=s,t[3]=i,t[4]=c):c=t[4];let l=Cf(c),u;t[5]!==a||t[6]!==r||t[7]!==n||t[8]!==i||t[9]!==l?(u=e=>{let{markerOffset:t,checked:o}=e,s=Be(n,r,i)?.contents??a,c=uf(s,t,o);c!==s&&(xe(n,r,i,c),l.change(c))},t[5]=a,t[6]=r,t[7]=n,t[8]=i,t[9]=l,t[10]=u):u=t[10];let d;return t[11]!==a||t[12]!==r||t[13]!==u||t[14]!==o?(d=(0,Z.jsx)(A,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(We,{text:a,cwd:r,threadRef:o,className:`mx-auto max-w-4xl px-6 py-5`,onTaskListChange:u})}),t[11]=a,t[12]=r,t[13]=u,t[14]=o,t[15]=d):d=t[15],d}function Nf(){try{return a(ff,g)??!0}catch(e){return console.error(e),!0}}function Pf(n){let i=(0,kl.c)(78),{environmentId:a,cwd:o,projectName:c,relativePath:d,threadRef:f,composerDraftTarget:p,keybindings:g,availableEditors:_,revealLine:b,revealRequestId:x,onOpenFile:S,onPendingChange:C}=n,{resolvedTheme:ee}=ue(),w=ge(If),T=h(),E=s(a),te;i[0]===Symbol.for(`react.memo_cache_sentinel`)?(te={reportFailure:!1},i[0]=te):te=i[0];let O=se(De.createUrl,te),k;i[1]===Symbol.for(`react.memo_cache_sentinel`)?(k={reportFailure:!1},i[1]=k):k=i[1];let j=e(Ce.open,k),M;i[2]===d?M=i[3]:(M=d!==null&&Ml(d),i[2]=d,i[3]=M);let ae=M,P=Le(a,o,d,!ae),[F,oe]=(0,X.useState)(Nf),le;i[4]===Symbol.for(`react.memo_cache_sentinel`)?(le={path:null,revealRequestId:null},i[4]=le):le=i[4];let[de,fe]=(0,X.useState)(le),me=(0,X.useRef)(null),he;i[5]===d?he=i[6]:(he=d?lf(d):!1,i[5]=d,i[6]=he);let ve=he,ye=ve&&de.path===d&&(b===null||de.revealRequestId===x),be;i[7]===d?be=i[8]:(be=d!==null&&we()&&_e(d),i[7]=d,i[8]=be);let xe=be,Se;i[9]!==o||i[10]!==d?(Se=d?D(d,o):null,i[9]=o,i[10]=d,i[11]=Se):Se=i[11];let I=Se,Te;i[12]!==c||i[13]!==d?(Te=d?cf(c,d):[],i[12]=c,i[13]=d,i[14]=Te):Te=i[14];let Ee=Te,Oe=yf(d,b,x),ke;i[15]===Symbol.for(`react.memo_cache_sentinel`)?(ke=()=>{(me.current?.querySelector(`[data-current-file-crumb='true']`))?.scrollIntoView({block:`nearest`,inline:`end`})},i[15]=ke):ke=i[15];let je;i[16]===d?je=i[17]:(je=[d],i[16]=d,i[17]=je),(0,X.useEffect)(ke,je);let Ne;i[18]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=()=>{oe(Ff)},i[18]=Ne):Ne=i[18];let Pe=Ne,Ie;i[19]!==I||i[20]!==O||i[21]!==E||i[22]!==j||i[23]!==f?(Ie=()=>{!I||!E||(async()=>{let e=await Ue({threadRef:f,filePath:I,httpBaseUrl:E,createAssetUrl:O,openPreview:j});if(e._tag===`Success`||r(e))return;let t=l(e);N.add(pe({type:`error`,title:`Unable to open file in browser`,description:t instanceof Error?t.message:`An error occurred.`}))})()},i[19]=I,i[20]=O,i[21]=E,i[22]=j,i[23]=f,i[24]=Ie):Ie=i[24];let Re=Ie,ze;i[25]!==I||i[26]!==_||i[27]!==Ee||i[28]!==xe||i[29]!==a||i[30]!==F||i[31]!==Re||i[32]!==ve||i[33]!==g||i[34]!==T||i[35]!==c||i[36]!==d||i[37]!==ye||i[38]!==x?(ze=d?(0,Z.jsxs)(`div`,{className:`surface-subheader gap-2 px-3`,"data-surface-subheader":!0,children:[(0,Z.jsx)(A,{ref:me,hideScrollbars:!0,scrollFade:!0,className:`min-w-0 flex-1 rounded-none`,"data-file-breadcrumbs":!0,children:(0,Z.jsx)(`div`,{className:`flex h-full w-max min-w-full items-center text-xs`,children:Ee.map((e,n)=>(0,Z.jsxs)(`div`,{className:`flex min-w-0 shrink-0 items-center`,"data-current-file-crumb":e.kind===`file`,children:[n>0?(0,Z.jsx)(m,{className:`mx-1 size-3.5 shrink-0 text-muted-foreground/60`}):null,(0,Z.jsx)(`span`,{className:t(`max-w-40 truncate`,e.kind===`file`?`font-medium text-foreground`:`text-muted-foreground`),title:e.path||c,children:e.label})]},e.path||`project`))})}),I&&a===T?(0,Z.jsx)(Fe,{environmentId:a,keybindings:g,availableEditors:_,openInCwd:I,compact:!0,enableShortcut:!1}):null,ve?(0,Z.jsxs)(y,{children:[(0,Z.jsx)(v,{render:(0,Z.jsx)(ce,{className:`shrink-0`,pressed:ye,onPressedChange:e=>{fe({path:e?d:null,revealRequestId:e?x:null})},"aria-label":ye?`Show markdown source`:`Show rendered markdown`,variant:`ghost`,size:`sm`,children:ye?(0,Z.jsx)(Ke,{className:`size-3.5`}):(0,Z.jsx)(Ae,{className:`size-3.5`})})}),(0,Z.jsx)(u,{children:ye?`Show markdown source`:`Show rendered markdown`})]}):null,xe?(0,Z.jsxs)(y,{children:[(0,Z.jsx)(v,{render:(0,Z.jsx)(ce,{className:`shrink-0`,pressed:!1,onPressedChange:Re,"aria-label":`Open file in preview browser`,variant:`ghost`,size:`sm`,children:(0,Z.jsx)(ie,{className:`size-3.5`})})}),(0,Z.jsx)(u,{children:`Open file in preview browser`})]}):null,(0,Z.jsxs)(y,{children:[(0,Z.jsx)(v,{render:(0,Z.jsx)(ce,{className:`shrink-0`,pressed:F,onPressedChange:Pe,"aria-label":F?`Hide file explorer`:`Show file explorer`,variant:`ghost`,size:`sm`,children:(0,Z.jsx)(qe,{className:`size-3.5`})})}),(0,Z.jsx)(u,{children:F?`Hide file explorer`:`Show file explorer`})]})]}):null,i[25]=I,i[26]=_,i[27]=Ee,i[28]=xe,i[29]=a,i[30]=F,i[31]=Re,i[32]=ve,i[33]=g,i[34]=T,i[35]=c,i[36]=d,i[37]=ye,i[38]=x,i[39]=ze):ze=i[39];let Be;i[40]!==P||i[41]!==d?(Be=d&&P.data?.truncated?(0,Z.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 `,P.data.byteLength.toLocaleString(),` byte file.`]}):null,i[40]=P,i[41]=d,i[42]=Be):Be=i[42];let Ve=d?`flex`:`hidden`,He;i[43]===Ve?He=i[44]:(He=t(`min-w-0 flex-1 flex-col overflow-hidden`,Ve),i[43]=Ve,i[44]=He);let We;i[45]!==I||i[46]!==p||i[47]!==o||i[48]!==a||i[49]!==P||i[50]!==ae||i[51]!==ve||i[52]!==Oe||i[53]!==C||i[54]!==d||i[55]!==ye||i[56]!==ee||i[57]!==x||i[58]!==f||i[59]!==w?(We=d&&ae&&I?(0,Z.jsx)(gf,{environmentId:a,threadRef:f,absolutePath:I,alt:d},I):d&&P.error&&P.data===null?(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center px-6 text-center text-xs leading-relaxed text-destructive`,children:P.error}):d&&P.data===null?(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center text-muted-foreground`,children:(0,Z.jsx)(Me,{className:`size-5 animate-spin`})}):d&&P.data?ve&&ye?(0,Z.jsx)(Mf,{environmentId:a,cwd:o,relativePath:d,threadRef:f,contents:P.data.contents,onPendingChange:C}):P.data.truncated?(0,Z.jsx)(re,{className:`file-preview-virtualizer min-h-0 flex-1 overflow-auto`,config:{overscrollSize:600,intersectionObserverMargin:1200},children:(0,Z.jsx)(Ol,{file:{name:d,contents:P.data.contents,cacheKey:sf(o,d,P.data.contents)},options:{disableFileHeader:!0,overflow:w?`wrap`:`scroll`,theme:ne(ee),themeType:ee,unsafeCSS:hf,onPostRender:Oe},className:`min-h-full`})},`${d}:${ee}:${P.data.byteLength}`):(0,Z.jsx)(wf,{environmentId:a,cwd:o,relativePath:d,composerDraftTarget:p,contents:P.data.contents,resolvedTheme:ee,revealRequestId:x,wordWrap:w,onPostRender:Oe,onPendingChange:C},`${d}:${ee}`):null,i[45]=I,i[46]=p,i[47]=o,i[48]=a,i[49]=P,i[50]=ae,i[51]=ve,i[52]=Oe,i[53]=C,i[54]=d,i[55]=ye,i[56]=ee,i[57]=x,i[58]=f,i[59]=w,i[60]=We):We=i[60];let Ge;i[61]!==He||i[62]!==We?(Ge=(0,Z.jsx)(`div`,{className:He,children:We}),i[61]=He,i[62]=We,i[63]=Ge):Ge=i[63];let Je;i[64]!==o||i[65]!==a||i[66]!==F||i[67]!==S||i[68]!==c||i[69]!==d?(Je=F||d===null?(0,Z.jsx)(`aside`,{className:t(`flex min-h-0 shrink-0 bg-background`,d?`w-[min(22rem,46%)] min-w-64 border-l border-border/60`:`min-w-0 flex-1`),children:(0,Z.jsx)(tf,{environmentId:a,cwd:o,projectName:c,onOpenFile:S},`${a}:${o}`)}):null,i[64]=o,i[65]=a,i[66]=F,i[67]=S,i[68]=c,i[69]=d,i[70]=Je):Je=i[70];let Ye;i[71]!==Ge||i[72]!==Je?(Ye=(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 overflow-hidden`,children:[Ge,Je]}),i[71]=Ge,i[72]=Je,i[73]=Ye):Ye=i[73];let Xe;return i[74]!==ze||i[75]!==Be||i[76]!==Ye?(Xe=(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden bg-background`,children:[ze,Be,Ye]}),i[74]=ze,i[75]=Be,i[76]=Ye,i[77]=Xe):Xe=i[77],Xe}function Ff(e){let t=!e;try{o(ff,t,g)}catch(e){console.error(e)}return t}function If(e){return e.wordWrap}export{Pf as default};
|
|
1778
|
-
//# sourceMappingURL=FilePreviewPanel-
|
|
1778
|
+
//# sourceMappingURL=FilePreviewPanel-CNxX4J5k.js.map
|