@p4code/cli 0.4.14 → 0.4.16
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/dist/{NodeSqliteClient-BxR7Cn_r.mjs → NodeSqliteClient-C-sL6Qcc.mjs} +3 -3
- package/dist/bin.mjs +114205 -93036
- package/dist/client/assets/DiffPanel-tsLZVSg6.js +98 -0
- package/dist/client/assets/FilePreviewPanel-B-Nmz0HL.js +2230 -0
- package/dist/client/assets/PreviewPanel-D2u1DYbz.js +2 -0
- package/dist/client/assets/PullRequestCodeTab-DuIvmetg.js +251 -0
- package/dist/client/assets/{fileCommentAnnotations-84VIRBlS.js → fileCommentAnnotations-lQZwvGUk.js} +2 -2
- package/dist/client/assets/index-JYVF4HEF.js +2807 -0
- package/dist/client/assets/{index-Cna1WN04.css → index-cqm4-bHh.css} +1 -1
- package/dist/client/assets/previewAssetResource-DdooihFl.js +48 -0
- package/dist/client/assets/{renderFileChildren-C6gKA6Vk.js → renderFileChildren-B35v3AOr.js} +2 -2
- package/dist/client/assets/{toggle-group-DMQ6zako.js → toggle-group-Dx-iwRbq.js} +2 -2
- package/dist/client/index.html +3 -3
- package/dist/resource-monitor/darwin-arm64/p4-resource-monitor +0 -0
- package/dist/resource-monitor/darwin-x64/p4-resource-monitor +0 -0
- package/dist/resource-monitor/linux-x64/p4-resource-monitor +0 -0
- package/dist/resource-monitor/win32-x64/p4-resource-monitor.exe +0 -0
- package/package.json +3 -2
- package/dist/client/assets/DiffPanel-MM5YsTnU.js +0 -98
- package/dist/client/assets/FilePreviewPanel-iQlsalIt.js +0 -2230
- package/dist/client/assets/PreviewPanel-Bf3g60N9.js +0 -2
- package/dist/client/assets/PullRequestCodeTab-CN7XcZJK.js +0 -251
- package/dist/client/assets/index-C1TVFsV3.js +0 -2793
- package/dist/client/assets/previewAssetResource-CVDZ-YAw.js +0 -48
|
@@ -0,0 +1,2230 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{n as t,r as n,t as r}from"./compiler-runtime-CLAvuQ-D.js";import{At as i,Ja as a,Lr as o,Ot as s,Q as c,U as l,Ur as u,b as d,bl as f,cu as p,dt as m,ft as h,gt as g,h as _,ht as v,il as y,ja as b,mp as x,mt as S,n as C,o as w,pl as T,ru as E,ul as D,vt as O,wt as ee,xt as k,yl as A,yt as j}from"./previewAssetResource-DdooihFl.js";import{n as M,r as N,t as P}from"./renderFileChildren-B35v3AOr.js";import{$ as te,$r as F,Ar as ne,Bn as re,Cn as ie,D as ae,Dr as oe,E as se,Er as ce,Fn as le,Fr as ue,Gn as de,Gt as fe,Hn as pe,Ht as I,Jt as me,Kn as he,Kt as ge,Mn as _e,Or as ve,Pr as ye,Rr as be,T as xe,Tr as Se,Un as Ce,Ut as L,Vn as we,Vr as Te,Wn as Ee,Xr as De,Z as Oe,_t as ke,an as R,b as Ae,bn as je,ct as Me,d as Ne,ei as Pe,et as Fe,f as Ie,fn as Le,gr as Re,gt as ze,kr as Be,l as Ve,m as He,mr as Ue,ni as We,on as Ge,p as Ke,qn as qe,qr as Je,ri as Ye,tt as Xe,u as Ze,v as Qe,w as $e,wn as et,x as tt,y as nt}from"./index-JYVF4HEF.js";import{a as rt,i as it,n as at,r as z,t as B}from"./fileCommentAnnotations-lQZwvGUk.js";var ot=T(`file-question-mark`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}],[`path`,{d:`M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3`,key:`mhlwft`}]]),st=T(`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`}]]),ct=`file-tree-container`,lt=`data-file-tree-style`,ut=`data-file-tree-unsafe-css`,dt=`data-file-tree-scrollbar-measure`,ft=`data-file-tree-scrollbar-gutter-measured`,pt=`--trees-scrollbar-gutter-measured`,mt=`header`,ht=`context-menu`,gt=`context-menu-trigger`,_t=5,vt=1<<_t,yt=vt*4;function bt(){return{childIdByNameId:new Map,childIds:[],childPositionById:new Map,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function xt(){return{childIdByNameId:null,childIds:[],childPositionById:null,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function St(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 Ct(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 wt(e,t){e.childPositionById!=null&&e.childPositionById.set(t,e.childIds.length),e.childIds.push(t)}function Tt(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 Et(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,At(e,t)}function Dt(e,t,n,r){if(e.totalChildSubtreeNodeCount+=n,e.totalChildVisibleSubtreeCount+=r,e.childVisibleChunkSums==null||r===0)return;let i=Ct(e).get(t);if(i===void 0)return;let a=i>>_t;e.childVisibleChunkSums[a]+=r}function Ot(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=jt(e,t,a,i);return{...r,childVisibleIndex:n-r.localVisibleIndex}}i-=o,a+=vt}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 kt(e,t,n){let r=0,i=t.childVisibleChunkSums,a=0;if(i!=null){let e=n>>_t;for(let t=0;t<e;t+=1)r+=i[t]??0;a=e<<_t}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 At(e,t){if(t.childIds.length<yt){t.childVisibleChunkSums=null;return}let n=Math.ceil(t.childIds.length/vt),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>>_t]+=a.visibleSubtreeCount)}t.childVisibleChunkSums=r}function jt(e,t,n,r){let i=Math.min(t.childIds.length,n+vt),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 Mt=7,Nt=3,Pt=1<<Nt,Ft=4;function It(e,t,n=0){return e<<Ft|n<<Nt|t}function Lt(e){return e.depthAndFlags>>>Ft}function Rt(e){return(e.depthAndFlags&Pt)>>Nt}function V(e){return(e.depthAndFlags&Pt)!==0}function zt(e){return e.depthAndFlags&Mt}function Bt(e,t){return(zt(e)&t)!==0}function Vt(e,t){e.depthAndFlags|=t}function Ht(e,t){e.depthAndFlags=It(t,zt(e),Rt(e))}var Ut=Symbol(`benchmarkInstrumentation`);function Wt(e,t){return t==null||Object.defineProperty(e,Ut,{configurable:!0,enumerable:!1,value:t,writable:!1}),e}function Gt(e){return e==null?null:e[Ut]??null}function H(e,t,n){return e==null?n():e.measurePhase(t,n)}function Kt(e,t,n){!Number.isFinite(n)||e==null||e.setCounter(t,n)}function qt(e){return e>=48&&e<=57}function Jt(e){let t=[],n=0,r=0;for(;r<e.length;){for(;r<e.length&&!qt(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&&qt(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 Yt(e){let t=e.toLowerCase();return{lowerValue:t,tokens:Jt(t)}}function Xt(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 Zt(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=Xt(e.tokens,t.tokens);return n===0?e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1:n}function Qt(e,t,n){let r=Zt(n(e),n(t));return r===0?e===t?0:e<t?-1:1:r}function $t(e,t){return Qt(e,t,Yt)}function en(e,t){return t===e.segments.length-1?+!!e.isDirectory:1}function tn(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=en(e,r);return a===en(t,r)?$t(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 nn(e,t){return tn(e,t)}function rn(e,t,n){let r=e=>{let t=n.get(e);if(t!=null)return t;let r=Yt(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=en(e,n);return o===en(t,n)?Qt(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 an(e,t){let n=e.sortKeyById[t];if(n!==void 0)return n;let r=e.valueById[t],i=Yt(r);return e.sortKeyById[t]=i,i}function on(e={}){return{flattenEmptyDirectories:e.flattenEmptyDirectories!==!1,sort:e.sort??`default`}}function sn(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 cn(e){let{hasTrailingSlash:t,segments:n}=sn(e);return{basename:n[n.length-1]??``,isDirectory:t,path:e,segments:n}}function ln(e){if(e.length===0)return{requiresDirectory:!1,segments:[]};let{hasTrailingSlash:t,segments:n}=sn(e);return{requiresDirectory:t,segments:n}}var un=``;function dn(){let e=new Map;return e.set(un,0),{idByValue:e,valueById:[un],sortKeyById:[Yt(un)]}}function fn(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 pn(e,t){let n=e.valueById[t];if(n===void 0)throw Error(`Unknown segment ID: ${String(t)}`);return n}var mn=Symbol(`pathStorePreparedInputKind`);function hn(e,t){return e[mn]=t,e}function gn(e){return{basename:e.basename,depth:e.segments.length,isDirectory:e.isDirectory,path:e.path,segments:e.segments}}function _n(e,t,n){return n==="default"?nn(e,t):n(gn(e),gn(t))}function vn(){return{depthAndFlags:It(0,3,1),nameId:0,parentId:0,subtreeNodeCount:1,visibleSubtreeCount:1}}function yn(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 bn(e){return e.isDirectory?e.segments.length:e.segments.length-1}function xn(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 Sn(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function Cn(e,t={}){return kn(e,t).map(e=>e.path)}function wn(e,t={}){let n=kn(e,t);return hn({paths:n.map(e=>e.path),preparedPaths:n},`prepared`)}function Tn(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 hn({paths:e,presortedPaths:e,presortedPathsContainDirectories:n},`presorted`)}function En(e){let t=e,n=t.preparedPaths;if(t[mn]===`prepared`&&n!=null)return n;if(!xn(n))throw Error(`preparedInput must come from PathStore.prepareInput()`);return n}function Dn(e){let t=e;return t[mn]===`presorted`&&t.presortedPaths!=null||Sn(t.presortedPaths)?t.presortedPaths:null}function On(e){let t=e;return typeof t.presortedPathsContainDirectories==`boolean`?t.presortedPathsContainDirectories:null}function kn(e,t={}){let n=on(t),r=Gt(t);Kt(r,`workload.inputFiles`,e.length);let i=H(r,`store.preparePathEntries.parse`,()=>e.map(e=>cn(e)));return H(r,`store.preparePathEntries.sort`,()=>i.sort((e,t)=>_n(e,t,n.sort))),i}var An=class{directories=new Map;directoryStack=[0];presortedDirectoryNodeIds=[];initialExpandedPathSet;createdDirectoriesAllExpanded=!1;createdDirectoryCount=0;lastPreparedPath=null;nodes=[vn()];options;instrumentation;segmentSortKeyCache=new Map;segmentTable=dn();hasDeferredDirectoryIndexes=!1;constructor(e={}){this.instrumentation=Gt(e),this.options=on(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,bt())}appendPaths(e){return H(this.instrumentation,`store.builder.appendPaths.parse`,()=>this.appendPreparedPaths(e.map(e=>cn(e))))}appendPreparedPaths(e,t=!0){return this.createdDirectoriesAllExpanded=!1,H(this.instrumentation,`store.builder.appendPreparedPaths`,()=>{for(let n of e)this.appendPreparedPath(n,t)}),this}appendPresortedPaths(e,t=null){return H(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:It(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:It(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:It(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=cn(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:It(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:It(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=cn(t)),this.hasDeferredDirectoryIndexes=!0}finish(e={}){let t=e.skipSubtreeCountPass===!0;return this.hasDeferredDirectoryIndexes?(H(this.instrumentation,`store.builder.buildDirectoryIndexes`,()=>this.buildPresortedFinish(t)),this.hasDeferredDirectoryIndexes=!1):t||H(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"?rn(this.lastPreparedPath,e,this.segmentSortKeyCache):_n(this.lastPreparedPath,e,this.options.sort))>0)throw Error(`Builder input must be sorted before appendPaths(): "${e.path}"`)}let n=this.lastPreparedPath,r=bn(e),i=n==null?0:bn(n),a=n==null?0:yn(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=fn(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:It(Lt(o)+1,0),nameId:r,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),a?.set(r,s),wt(i,s),s}createFileChildUnchecked(e,t){let n=fn(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:It(Lt(i)+1,0),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),wt(r,a),a}getOrCreateDirectoryChild(e,t){let n=fn(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:It(Lt(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),wt(r,a),this.directories.set(a,bt()),a}createDirectoryChild(e,t){let n=fn(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:It(Lt(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),wt(r,a),this.directories.set(a,bt()),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(Bt(n,1))throw Error(`Duplicate path: "${t}"`);Vt(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,xt());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=xt();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,bt());let r=this.directories.get(n.parentId);r!=null&&(r.childIdByNameId!=null&&r.childIdByNameId.set(n.nameId,t),wt(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 Et(this.nodes,n),t.subtreeNodeCount=r,t.visibleSubtreeCount=r,r}};function jn(e,t=`closed`,n=null){let r=Nn(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 Mn(){return{affectedAncestorIds:new Set,affectedNodeIds:new Set,events:[]}}function Nn(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 Pn(e,t){return Bt(t,2)||e.defaultExpansion===`open`?!0:e.defaultExpansion===`closed`?!1:Lt(t)<=e.defaultExpansion}function Fn(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:Pn(e,n)}function In(e,t,n,r=e.snapshot.nodes[t]){if(r==null||!V(r))return;let i=Pn(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 Ln(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 Rn(e,t){return e.directoryLoadInfoById.get(t)?.state??`loaded`}function zn(e,t){let n=Ln(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 Bn(e,t){let n=Ln(e,t);n.activeAttemptId=null,n.errorMessage=null,n.state=`unloaded`}function Vn(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 Hn(e,t,n){return e.directoryLoadInfoById.get(t)?.activeAttemptId===n}function Un(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 Wn(e,t){e.directoryLoadInfoById.delete(t)}function Gn(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 Kn(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`add`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function qn(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`remove`,path:e.path,projectionChanged:e.projectionChanged,recursive:e.recursive,visibleCountDelta:null}}function Jn(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,from:e.from,operation:`move`,projectionChanged:e.projectionChanged,to:e.to,visibleCountDelta:null}}function Yn(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`expand`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function Xn(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`collapse`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function Zn(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`mark-directory-unloaded`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function Qn(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 $n(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 er(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 tr(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 nr(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 rr(e,t,n){return{...n,visibleCountDelta:mr(e)-t}}function ir(e,t){let n=mr(e),r=Mn();e.transactionStack.push(r);try{t()}catch(t){throw sr(e,r,!1),t}sr(e,r,!0,mr(e)-n)}function ar(e,t){let n=e.instrumentation;if(n==null){or(e,t);return}H(n,`store.events.record`,()=>or(e,t))}function or(e,t){let n=e.transactionStack[e.transactionStack.length-1]??null;if(n==null){fr(e,t);return}n.events.push(t),dr(n,t)}function sr(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?ur(i,t):H(n,`store.events.batch.merge`,()=>ur(i,t));return}let a=cr(t,r),o=e.instrumentation;if(o==null){fr(e,a);return}H(o,`store.events.batch.commit`,()=>fr(e,a))}function cr(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 lr(e,t){for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n);for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n)}function ur(e,t){for(let n of t.events)e.events.push(n);lr(e,t)}function dr(e,t){for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n);for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n)}function fr(e,t){let n=e.instrumentation;if(n==null){pr(e,t);return}H(n,`store.events.emit`,()=>pr(e,t))}function pr(e,t){e.listeners.get(t.operation)?.forEach(e=>e(t)),e.listeners.get(`*`)?.forEach(e=>e(t))}function mr(e){return e.snapshot.nodes[e.snapshot.rootId]?.visibleSubtreeCount??0}function hr(e,t){if(e.snapshot.options.flattenEmptyDirectories!==!0)return null;let n=e.snapshot.nodes[t];if(n==null||!V(n)||Bt(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 gr(e,t){let n=t;for(;;){let t=hr(e,n);if(t==null)return n;n=t}}function _r(e,t){let n=[t],r=t;for(;;){let t=hr(e,r);if(t==null)return n;n.push(t),r=t}}function vr(e,t){let n=t==null?e.snapshot.rootId:Dr(e,t);return n==null?[]:kr(e,n)}function yr(e,t){let n=cn(t),r=n.isDirectory?n.segments:n.segments.slice(0,-1),i=Wr(e,Ur(e,r)),{createdNodeIds:a,directoryId:o}=Ar(e,r),s=new Set(a),c=o;if(n.isDirectory){let n=G(e,o);if(Bt(n,1))throw Error(`Path already exists: "${t}"`);Vt(n,1),e.pathCacheByNodeId.set(o,{path:t,version:e.pathCacheVersion}),s.add(o)}else c=Mr(e,o,n.basename),s.add(c);wr(e,o);let l=Wr(e,o);return Kn({affectedAncestorIds:Er(e,c),affectedNodeIds:[...s],path:t,projectionChanged:Gr(i,l)})}function br(e,t,n){let r=Dr(e,t);if(r==null)throw Error(`Path does not exist: "${t}"`);let i=G(e,r);if(Bt(i,2))throw Error(`The root node cannot be removed`);if(V(i)&&W(e,r).childIds.length>0&&n.recursive!==!0)throw Error(`Cannot remove a non-empty directory without recursive: "${t}"`);let a=i.parentId,o=Wr(e,a),s=Vr(e,r);Fr(e,a,r,i.nameId),Hr(e,a),wr(e,a);let c=Wr(e,a);return qn({affectedAncestorIds:Er(e,a),affectedNodeIds:s,path:t,projectionChanged:Gr(o,c),recursive:n.recursive===!0})}function xr(e,t,n,r){let i=Dr(e,t);if(i==null)throw Error(`Source path does not exist: "${t}"`);let a=G(e,i);if(Bt(a,2))throw Error(`The root node cannot be moved`);let o=r.collision??`error`,s=zr(e,i,n),c=Wr(e,a.parentId),l=Wr(e,s.parentId),u=pn(e.snapshot.segmentTable,a.nameId),d=fn(e.snapshot.segmentTable,s.basename);if(s.parentId===a.parentId&&u===s.basename)return null;if(V(a)&&Yr(e,i,s.parentId))throw Error(`Cannot move a directory into one of its descendants`);let f=St(e.snapshot.nodes,W(e,s.parentId)).get(d),p=s.existingNodeId??f??null;if(p!=null&&p!==i&&Br(e,p,o,Rt(a))===`skip`)return null;let m=a.parentId;Fr(e,m,i,a.nameId),a.parentId=s.parentId,a.nameId=d,e.pathCacheByNodeId.delete(i),Jr(e,i),Pr(e,s.parentId,i),Hr(e,m),e.pathCacheVersion++,wr(e,m),s.parentId!==m&&wr(e,s.parentId);let h=Wr(e,m),g=Wr(e,s.parentId);return Jn({affectedAncestorIds:[...new Set([...Er(e,m),...Er(e,s.parentId)])],affectedNodeIds:[i],from:t,projectionChanged:Kr([c,l],[h,g]),to:U(e,i)})}function Sr(e,t){let n=e.pathCacheByNodeId.get(t);return n!=null&&n.version===e.pathCacheVersion?n.path:null}function Cr(e,t,n){return e.pathCacheByNodeId.set(t,{path:n,version:e.pathCacheVersion}),n}function U(e,t){let n=G(e,t),r=Sr(e,t);if(r!=null)return r;if(Bt(n,2))return Cr(e,t,``);let i=U(e,n.parentId),a=pn(e.snapshot.segmentTable,n.nameId),o=i.length===0?a:`${i}${a}`;return Cr(e,t,V(n)?`${o}/`:o)}function wr(e,t){let n=e.instrumentation;if(n==null){Zr(e,t);return}H(n,`store.recomputeCountsUpwardFrom`,()=>Zr(e,t))}function Tr(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)){Xr(e,a,o,!0),n.pop();continue}let s=i.get(a);if(s==null||t[1]>=s.childIds.length){Xr(e,a,o,!0),n.pop();continue}let c=s.childIds[t[1]++];n.push([c,0])}}function Er(e,t){let n=[],r=t;for(;r!=null;){let t=G(e,r);if(n.push(r),r===e.snapshot.rootId)break;r=t.parentId}return n}function Dr(e,t){if(t.length===0)return e.snapshot.rootId;let n=ln(t);return Or(e,n.segments,n.requiresDirectory)}function Or(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=W(e,r),a=St(e.snapshot.nodes,i).get(t);if(a===void 0)return null;r=a}let i=G(e,r);return n&&!V(i)?null:r}function W(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 G(e,t){let n=e.snapshot.nodes[t];if(n===void 0||Bt(n,4))throw Error(`Unknown node ID: ${String(t)}`);return n}function kr(e,t){let n=e.snapshot.nodes[t];if(n===void 0||Bt(n,4))return[];if(!V(n))return[U(e,t)];if(W(e,t).childIds.length===0)return Bt(n,1)&&!Bt(n,2)?[U(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||Bt(n,4)){i.pop();continue}if(!V(n)){r.push(U(e,t.nodeId)),i.pop();continue}let a=W(e,t.nodeId);if(a.childIds.length===0){Bt(n,1)&&!Bt(n,2)&&r.push(U(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 Ar(e,t){let n=[],r=e.snapshot.rootId;for(let i of t){let t=fn(e.snapshot.segmentTable,i),a=W(e,r),o=St(e.snapshot.nodes,a).get(t);if(o!==void 0){if(!V(G(e,o)))throw Error(`Cannot create a directory that collides with an existing file: "${i}"`);r=o;continue}r=jr(e,r,t),n.push(r)}return{createdNodeIds:n,directoryId:r}}function jr(e,t,n){let r=G(e,t),i=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:It(Lt(r)+1,0,1),nameId:n,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),e.snapshot.directories.set(i,bt()),Pr(e,t,i),e.collapseNewDirectoriesByDefault&&(e.collapsedDirectoryIds.add(i),e.hasCollapsedDirectoryOverrides=!0),e.activeNodeCount++,i}function Mr(e,t,n){let r=fn(e.snapshot.segmentTable,n),i=W(e,t);if(St(e.snapshot.nodes,i).has(r))throw Error(`Path already exists: "${$r(e,t,n)}"`);let a=G(e,t),o=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:It(Lt(a)+1,0),nameId:r,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),Pr(e,t,o),e.activeNodeCount++,o}function Nr(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}Ir(e,n,o)<0?i=a:r=a+1}return r}function Pr(e,t,n){let r=W(e,t),i=G(e,n);St(e.snapshot.nodes,r).set(i.nameId,n),Dt(r,n,i.subtreeNodeCount,i.visibleSubtreeCount);let a=Nr(e,r,n);r.childIds.splice(a,0,n),Tt(r,a),At(e.snapshot.nodes,r)}function Fr(e,t,n,r){let i=W(e,t),a=Ct(i),o=a.get(n)??-1;St(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),Tt(i,o),At(e.snapshot.nodes,i))}function Ir(e,t,n){let r=e.snapshot.options.sort;return r==="default"?Lr(e,t,n):r(Rr(e,t),Rr(e,n))}function Lr(e,t,n){let r=G(e,t),i=G(e,n),a=V(r);if(a!==V(i))return a?-1:1;let o=Zt(an(e.snapshot.segmentTable,r.nameId),an(e.snapshot.segmentTable,i.nameId));if(o!==0)return o;let s=pn(e.snapshot.segmentTable,r.nameId),c=pn(e.snapshot.segmentTable,i.nameId);return s===c?t<n?-1:1:s<c?-1:1}function Rr(e,t){let n=G(e,t),r=U(e,t),i=V(n),a=i?r.slice(0,-1):r;return{basename:pn(e.snapshot.segmentTable,n.nameId),depth:Lt(n),isDirectory:i,path:r,segments:a.length===0?[]:a.split(`/`)}}function zr(e,t,n){let r=G(e,t),i=Dr(e,n);if(i!=null){let t=G(e,i);if(V(t))return{basename:pn(e.snapshot.segmentTable,r.nameId),existingNodeId:null,parentId:i};let a=ln(n).segments;return{basename:a[a.length-1]??``,existingNodeId:i,parentId:t.parentId}}let a=ln(n),o=a.segments[a.segments.length-1]??``,s=a.segments.slice(0,-1),c=s.length===0?e.snapshot.rootId:Or(e,s,!0);if(c==null)throw Error(`Destination parent does not exist: "${n}"`);return{basename:o,existingNodeId:null,parentId:c}}function Br(e,t,n,r){if(n===`skip`)return`skip`;if(n===`error`)throw Error(`Destination already exists: "${U(e,t)}"`);let i=G(e,t);if(Rt(i)!==r)throw Error(`replace collision requires the same source and destination kinds`);if(V(i)&&W(e,t).childIds.length>0)throw Error(`replace collision does not support non-empty directories`);let a=i.parentId,o=i.nameId;return Vr(e,t),Fr(e,a,t,o),Hr(e,a),wr(e,a),`handled`}function Vr(e,t){let n=[],r=[{nodeId:t,visitedChildren:!1}];for(;r.length>0;){let t=r.pop();if(t==null)break;let i=G(e,t.nodeId);if(t.visitedChildren||!V(i)){V(i)&&e.snapshot.directories.delete(t.nodeId),Vt(i,4),e.pathCacheByNodeId.delete(t.nodeId),e.collapsedDirectoryIds.delete(t.nodeId)&&(e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0),e.expandedDirectoryIds.delete(t.nodeId),Wn(e,t.nodeId),e.activeNodeCount--,n.push(t.nodeId);continue}r.push({nodeId:t.nodeId,visitedChildren:!0});let a=W(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 Hr(e,t){let n=t;for(;n!=null;){let t=G(e,n);if(!V(t)||Bt(t,2)||W(e,n).childIds.length>0)return;Vt(t,1),n=t.parentId===n?null:t.parentId}}function Ur(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=St(e.snapshot.nodes,W(e,n)).get(t);if(i==null||!V(G(e,i)))break;n=i}return n}function Wr(e,t){let n=qr(e,t);if(n==null)return null;let r=gr(e,n),i=G(e,r),a=n===r?null:_r(e,n).map(t=>U(e,t));return JSON.stringify({flattenedSegmentPaths:a,hasChildren:W(e,r).childIds.length>0,path:U(e,r),terminalKind:Rt(i)})}function Gr(e,t){return Kr([e],[t])}function Kr(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 qr(e,t){let n=t;for(;n!=null;){let t=G(e,n);if(!V(t)||Bt(t,2))return null;if(!Fn(e,n,t))return n;n=t.parentId}return null}function Jr(e,t){let n=G(e,t);if(Ht(n,(t===e.snapshot.rootId?-1:Lt(G(e,n.parentId)))+1),!V(n))return;let r=W(e,t);for(let t of r.childIds)Jr(e,t)}function Yr(e,t,n){let r=n;for(;r!=null;){if(r===t)return!0;let n=G(e,r);if(r===e.snapshot.rootId)return!1;r=n.parentId}return!1}function Xr(e,t,n=G(e,t),r=!1){let i=e.instrumentation;if(i==null){Qr(e,t,n,r);return}H(i,`store.recomputeNodeCounts`,()=>Qr(e,t,n,r))}function Zr(e,t){let n=t;for(;n!=null;){let t=G(e,n),r=t.subtreeNodeCount,i=t.visibleSubtreeCount;if(Xr(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(W(e,s),n,a,o),n=s}}function Qr(e,t,n,r){if(!V(n)){n.subtreeNodeCount=1,n.visibleSubtreeCount=1;return}let i=W(e,t);if(r){let t=e.instrumentation;t==null?Et(e.snapshot.nodes,i):H(t,`store.recomputeNodeCounts.rebuildChildAggregates`,()=>Et(e.snapshot.nodes,i))}let a=1+i.totalChildSubtreeNodeCount,o=i.totalChildVisibleSubtreeCount;if(n.subtreeNodeCount=a,Bt(n,2)){n.visibleSubtreeCount=o;return}n.visibleSubtreeCount=hr(e,t)==null?Fn(e,t,n)?1+o:1:o}function $r(e,t,n){let r=U(e,t);return r.length===0?n:`${r}${n}`}function ei(e){return e!=null&&!Bt(e,4)}function ti(e,t){let n=e.snapshot.nodes[t];return!ei(n)||!V(n)||Bt(n,2)?null:n}function ni(e){let t=0;for(let[n,r]of e.pathCacheByNodeId)r.version===e.pathCacheVersion&&ei(e.snapshot.nodes[n])&&(t+=1);return t}function ri(e){return Math.max(0,e.valueById.length-1)}function ii(e){return{activeNodeCount:e.activeNodeCount,cachedPathEntryCount:ni(e),loadInfoEntryCount:e.directoryLoadInfoById.size,segmentCount:ri(e.snapshot.segmentTable),totalNodeSlotCount:Math.max(0,e.snapshot.nodes.length-1)}}function ai(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 oi(e){let t=[],n=[];for(let n of e.collapsedDirectoryIds)ti(e,n)!=null&&t.push(U(e,n));for(let t of e.expandedDirectoryIds)ti(e,t)!=null&&n.push(U(e,t));return{collapsedPaths:t,expandedPaths:n}}function si(e){let t=[];for(let[n,r]of e.directoryLoadInfoById)ti(e,n)==null||Rn(e,n)===`loaded`||t.push({info:{activeAttemptId:null,errorMessage:r.errorMessage,nextAttemptId:r.nextAttemptId,state:r.state},path:U(e,n)});return t}function ci(e,t){e.collapsedDirectoryIds.clear(),e.hasCollapsedDirectoryOverrides=!1,e.expandedDirectoryIds.clear();for(let n of t.expandedPaths){let t=Dr(e,n);t!=null&&In(e,t,!0,G(e,t))}for(let n of t.collapsedPaths){let t=Dr(e,n);t!=null&&In(e,t,!1,G(e,t))}}function li(e,t){e.directoryLoadInfoById.clear();for(let n of t){let t=Dr(e,n.path);t!=null&&ti(e,t)!=null&&e.directoryLoadInfoById.set(t,{activeAttemptId:null,errorMessage:n.info.errorMessage,nextAttemptId:n.info.nextAttemptId,state:n.info.state})}}function ui(e){e.pathCacheVersion+=1,e.pathCacheByNodeId.clear(),e.pathCacheByNodeId.set(e.snapshot.rootId,{path:``,version:e.pathCacheVersion})}function di(e){let t=e.snapshot.segmentTable,n=dn();for(let r of e.snapshot.nodes)if(ei(r)){if(Bt(r,2)){r.nameId=0;continue}r.nameId=fn(n,pn(t,r.nameId))}e.snapshot.segmentTable=n}function fi(e){for(let[t,n]of e.snapshot.directories){let r=e.snapshot.nodes[t];if(!ei(r)||!V(r)){e.snapshot.directories.delete(t);continue}let i=n.childIds.filter(n=>{let r=e.snapshot.nodes[n];return ei(r)&&r.parentId===t});n.childIds=i,n.childIdByNameId=new Map(i.map(t=>[G(e,t).nameId,t])),n.childPositionById=new Map(i.map((e,t)=>[e,t])),Et(e.snapshot.nodes,n)}}function pi(e){let t=e.snapshot.nodes.length-1;for(;t>e.snapshot.rootId;){let n=e.snapshot.nodes[t];if(ei(n))break;--t}e.snapshot.nodes.length=t+1}function mi(e){let t=oi(e),n=si(e);H(e.instrumentation,`store.cleanup.stable.clearPathCaches`,()=>ui(e)),H(e.instrumentation,`store.cleanup.stable.rebuildSegmentTable`,()=>di(e)),H(e.instrumentation,`store.cleanup.stable.rebuildDirectoryIndexes`,()=>fi(e)),H(e.instrumentation,`store.cleanup.stable.trimTrailingRemovedNodeSlots`,()=>pi(e)),H(e.instrumentation,`store.cleanup.stable.restoreExpansionOverrides`,()=>ci(e,t)),H(e.instrumentation,`store.cleanup.stable.restoreDirectoryLoadInfos`,()=>li(e,n)),H(e.instrumentation,`store.cleanup.stable.recomputeCounts`,()=>Tr(e,e.snapshot.rootId))}function hi(e){let t=oi(e),n=si(e),r=H(e.instrumentation,`store.cleanup.aggressive.listPaths`,()=>vr(e)),i=Wt({...e.snapshot.options},e.instrumentation),a=H(e.instrumentation,`store.cleanup.aggressive.rebuildSnapshot`,()=>{let e=new An(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,H(e.instrumentation,`store.cleanup.aggressive.restoreExpansionOverrides`,()=>ci(e,t)),H(e.instrumentation,`store.cleanup.aggressive.restoreDirectoryLoadInfos`,()=>li(e,n)),H(e.instrumentation,`store.cleanup.aggressive.recomputeCounts`,()=>Tr(e,e.snapshot.rootId))}function gi(e){for(let t of e.directoryLoadInfoById.values())if(t.state===`loading`&&t.activeAttemptId!=null)return!0;return!1}function _i(e,t){let n=ii(e);t===`stable`?H(e.instrumentation,`store.cleanup.stable`,()=>mi(e)):H(e.instrumentation,`store.cleanup.aggressive`,()=>hi(e));let r=ii(e);return ai(t,t===`stable`,n,r)}var vi=64;function yi(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 bi(e){return G(e,e.snapshot.rootId).visibleSubtreeCount}function xi(e,t,n,r){let i=G(e,t.terminalNodeId),a=Math.max(1,i.visibleSubtreeCount);return Math.min(r-1,n+a-1)}function Si(e,t,n,r){return{ancestorPaths:r,index:t.index,posInSet:t.posInSet,row:Vi(e,t.cursor),setSize:t.setSize,subtreeEndIndex:xi(e,t.cursor,t.index,n)}}function Ci(e,t,n,r,i,a){let o=W(e,t),{childIndex:s,childVisibleIndex:c,localVisibleIndex:l}=Ot(e.snapshot.nodes,o,n),u=o.childIds[s];if(u==null)throw Error(`Visible index ${String(n)} is out of range`);return wi(e,u,l,r+c,i+1,s,o.childIds.length,a)}function wi(e,t,n,r,i,a,o,s){if(!V(G(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=Fi(e,t,i);if(n===0)return{ancestors:s,cursor:c,index:r,posInSet:a,setSize:o};let l=G(e,c.terminalNodeId);if(!V(l)||!Fn(e,c.terminalNodeId,l))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return Ci(e,c.terminalNodeId,n-1,r+1,c.visibleDepth,[...s,{cursor:c,index:r,posInSet:a,setSize:o}])}function Ti(e,t){let n=bi(e);if(t<0||t>=n)return null;let r=Ci(e,e.snapshot.rootId,t,0,-1,[]),i=r.ancestors.map(t=>U(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=Si(e,a,n,[...i]);t.push(r),i.push(r.row.path)}return a=t,a},index:r.index,posInSet:r.posInSet,row:Vi(e,r.cursor),setSize:r.setSize,subtreeEndIndex:xi(e,r.cursor,r.index,n)}}function Ei(e,t,n){let r=e.instrumentation,i=bi(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 Bi(e,o+1);let t=[],n=Mi(e,a);for(let r=a;r<=o&&n!=null;r++){let r=Vi(e,n);t.push(r),n=Li(e,n)}return t}let s=[],c=0,l=0,u=H(r,`store.getVisibleSlice.selectFirstRow`,()=>Mi(e,a));for(let t=a;t<=o&&u!=null;t++){let t=H(r,`store.getVisibleSlice.materializeRow`,()=>Vi(e,u));s.push(t),t.isFlattened&&(c++,l+=t.flattenedSegments?.length??0),u=H(r,`store.getVisibleSlice.advanceCursor`,()=>Li(e,u))}return Kt(r,`workload.visibleRowsRead`,s.length),Kt(r,`workload.flattenedRowsRead`,c),Kt(r,`workload.flattenedSegmentsRead`,l),s}function Di(e,t=bi(e)){let n=e.instrumentation;return n==null?zi(e,t):H(n,`store.getVisibleTreeProjection`,()=>zi(e,t))}function Oi(e){return Ri(Di(e))}function ki(e,t){let n=Dr(e,t);if(n==null||n===e.snapshot.rootId||V(G(e,n))&&gr(e,n)!==n)return null;let r=0,i=n,{nodes:a,rootId:o}=e.snapshot;for(;i!==o;){let t=G(e,i).parentId,n=W(e,t),s=Ct(n).get(i);if(s==null)throw Error(`Child ${String(i)} was not found in its parent index`);if(r+=kt(a,n,s),t!==o){let n=G(e,t),a=hr(e,t);if(!Fn(e,t,n)&&a!==i)return null;gr(e,t)===t&&(r+=1)}i=t}return r}function Ai(e,t){let n=Dr(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=G(e,n);if(!V(r))throw Error(`Path is not a directory: "${t}"`);return Fn(e,n,r)?null:(In(e,n,!0,r),wr(e,n),Yn({affectedAncestorIds:Er(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0}))}function ji(e,t){let n=Dr(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=G(e,n);if(!V(r))throw Error(`Path is not a directory: "${t}"`);return Fn(e,n,r)?(In(e,n,!1,r),wr(e,n),Xn({affectedAncestorIds:Er(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0})):null}function Mi(e,t){return t<0||t>=bi(e)?null:Ni(e,e.snapshot.rootId,t,-1)}function Ni(e,t,n,r){let i=W(e,t),a=e.instrumentation,{childIndex:o,localVisibleIndex:s}=a==null?Ot(e.snapshot.nodes,i,n):H(a,`store.getVisibleSlice.selectChildIndex`,()=>Ot(e.snapshot.nodes,i,n)),c=i.childIds[o];if(c!=null)return Pi(e,c,s,r+1);throw Error(`Visible index ${String(n)} is out of range`)}function Pi(e,t,n,r){if(!V(G(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=Fi(e,t,r);if(n===0)return i;let a=G(e,i.terminalNodeId);if(!V(a)||!Fn(e,i.terminalNodeId,a))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return Ni(e,i.terminalNodeId,n-1,i.visibleDepth)}function Fi(e,t,n){return V(G(e,t))?e.instrumentation==null?{headNodeId:t,terminalNodeId:gr(e,t),visibleDepth:n}:{headNodeId:t,terminalNodeId:H(e.instrumentation,`store.getVisibleSlice.flatten.resolveTerminalDirectory`,()=>gr(e,t)),visibleDepth:n}:{headNodeId:t,terminalNodeId:t,visibleDepth:n}}function Ii(e,t){let n=G(e,t);if(!V(n))return!0;let r=n.parentId;return r===e.snapshot.rootId?!0:hr(e,r)!==t}function Li(e,t){let n=G(e,t.terminalNodeId);if(V(n)){let r=W(e,t.terminalNodeId);if(Fn(e,t.terminalNodeId,n)&&r.childIds.length>0){let n=r.childIds[0];return n==null?null:Pi(e,n,0,t.visibleDepth+1)}}let r=t.terminalNodeId,i=t.visibleDepth;for(;;){let t=G(e,r);if(r===e.snapshot.rootId)return null;let n=t.parentId,a=W(e,n),o=Ct(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 Pi(e,s,0,i);Ii(e,r)&&i--,r=n}}function Ri(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 zi(e,t){let n=Array(t),r=new Int32Array(t),i=new Int32Array(t),a=new Int32Array(t),o=new Int32Array(vi);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=yi(o,y);let x,S=_;if(V(v))S=f?gr(e,_):_,x=S===_?`${b}${h[v.nameId]}/`:U(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)&&Fn(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 Bi(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:U(e,f)};continue}let h=l?gr(e,f):f,g={headNodeId:f,terminalNodeId:h,visibleDepth:m};n[r++]=Vi(e,g);let _=i[h];_!=null&&V(_)&&Fn(e,h,_)&&s.push([a.get(h),0,m])}return r<t&&(n.length=r),n}function Vi(e,t){let n=G(e,t.terminalNodeId),r=V(n)?Hi(e,t):null,i=U(e,t.terminalNodeId),a=pn(e.snapshot.segmentTable,n.nameId),o=V(n)&&W(e,t.terminalNodeId).childIds.length>0,s=t.headNodeId!==t.terminalNodeId,c=e.instrumentation,l=s?c==null?_r(e,t.headNodeId).map(n=>{let r=G(e,n);return{isTerminal:n===t.terminalNodeId,name:pn(e.snapshot.segmentTable,r.nameId),nodeId:n,path:U(e,n)}}):H(c,`store.getVisibleSlice.flatten.collectSegments`,()=>_r(e,t.headNodeId).map(n=>{let r=G(e,n);return{isTerminal:n===t.terminalNodeId,name:pn(e.snapshot.segmentTable,r.nameId),nodeId:n,path:U(e,n)}})):void 0;return{depth:t.visibleDepth,flattenedSegments:l,hasChildren:o,id:t.terminalNodeId,isExpanded:V(n)&&Fn(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 Hi(e,t){if(t.headNodeId===t.terminalNodeId)return Rn(e,t.terminalNodeId);let n=_r(e,t.headNodeId),r=!1,i=!1;for(let t of n){let n=Rn(e,t);if(n===`loading`)return`loading`;if(n===`error`){i=!0;continue}n===`unloaded`&&(r=!0)}return i?`error`:r?`unloaded`:`loaded`}function Ui(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&&At(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,At(n,l),c.subtreeNodeCount=1+d,c.visibleSubtreeCount=f}function Wi(e){return e.initialExpansion===`open`&&(e.initialExpandedPaths==null||e.initialExpandedPaths.length===0)}var Gi=class e{#e;constructor(e={}){let t=Gt(e),n=H(t,`store.builder.create`,()=>new An(e));if(e.preparedInput!=null){let t=Dn(e.preparedInput);t==null?n.appendPreparedPaths(En(e.preparedInput),!1):n.appendPresortedPaths(t,On(e.preparedInput))}else{let r=e.paths??[];e.presorted===!0?n.appendPaths(r):n.appendPreparedPaths(H(t,`store.preparePathEntries`,()=>kn(r,e)))}let r=H(t,`store.builder.finish`,()=>n.finish({skipSubtreeCountPass:!0})),i=H(t,`store.state.detectAllDirectoriesExpanded`,()=>(e.initialExpansion??`closed`)===`closed`&&n.didMatchAllInitialExpandedPaths());this.#e=H(t,`store.state.create`,()=>jn(r,i?`open`:e.initialExpansion??`closed`,t)),i&&(this.#e.collapseNewDirectoriesByDefault=!0);let a=i?this.#e.snapshot.directories.size-1:H(t,`store.state.initializeExpandedPaths`,()=>this.initializeExpandedPaths(e.initialExpandedPaths));i||Wi(e)||(e.initialExpansion??`closed`)===`closed`&&a===this.#e.snapshot.directories.size-1||(e.initialExpandedPaths?.length??0)>0&&H(t,`store.state.checkAllDirectoriesExpanded`,()=>this.hasAllDirectoriesExpanded())?H(t,`store.state.initializeOpenVisibleCounts`,()=>Ui(this.#e)):H(t,`store.state.recomputeCounts`,()=>Tr(this.#e,this.#e.snapshot.rootId))}static preparePaths(e,t={}){return Cn(e,t)}static prepareInput(e,t={}){return wn(e,t)}static preparePresortedInput(e){return Tn(e)}list(e){return H(this.#e.instrumentation,`store.list`,()=>vr(this.#e,e))}add(e){H(this.#e.instrumentation,`store.add`,()=>{let t=bi(this.#e);ar(this.#e,rr(this.#e,t,yr(this.#e,e)))})}remove(e,t={}){H(this.#e.instrumentation,`store.remove`,()=>{let n=bi(this.#e);ar(this.#e,rr(this.#e,n,br(this.#e,e,t)))})}move(e,t,n={}){H(this.#e.instrumentation,`store.move`,()=>{let r=bi(this.#e),i=xr(this.#e,e,t,n);i!=null&&ar(this.#e,rr(this.#e,r,i))})}batch(e){ir(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 H(this.#e.instrumentation,`store.getVisibleCount`,()=>bi(this.#e))}getVisibleSlice(e,t){return H(this.#e.instrumentation,`store.getVisibleSlice`,()=>Ei(this.#e,e,t))}getVisibleRowContext(e){return H(this.#e.instrumentation,`store.getVisibleRowContext`,()=>Ti(this.#e,e))}getVisibleTreeProjection(){return Oi(this.#e)}getVisibleTreeProjectionData(e){return Di(this.#e,e)}getVisibleIndex(e){return H(this.#e.instrumentation,`store.getVisibleIndex`,()=>ki(this.#e,e))}getPathInfo(e){return H(this.#e.instrumentation,`store.getPathInfo`,()=>{let t=Dr(this.#e,e);if(t==null)return null;let n=G(this.#e,t);return{depth:Lt(n),kind:V(n)?`directory`:`file`,path:U(this.#e,t)}})}isExpanded(e){return H(this.#e.instrumentation,`store.isExpanded`,()=>{let t=this.requireDirectoryNodeId(e),n=G(this.#e,t);return Fn(this.#e,t,n)})}expand(e){H(this.#e.instrumentation,`store.expand`,()=>{let t=bi(this.#e),n=Ai(this.#e,e);n!=null&&ar(this.#e,rr(this.#e,t,n))})}collapse(e){H(this.#e.instrumentation,`store.collapse`,()=>{let t=bi(this.#e),n=ji(this.#e,e);n!=null&&ar(this.#e,rr(this.#e,t,n))})}on(e,t){return Gn(this.#e,e,t)}getDirectoryLoadState(e){let t=this.requireDirectoryNodeId(e);return Rn(this.#e,t)}markDirectoryUnloaded(e){H(this.#e.instrumentation,`store.markDirectoryUnloaded`,()=>{let t=this.requireDirectoryNodeId(e);if(W(this.#e,t).childIds.length>0)throw Error(`Cannot mark a directory with known children as unloaded: "${e}"`);let n=bi(this.#e);Bn(this.#e,t),ar(this.#e,rr(this.#e,n,Zn({affectedAncestorIds:Er(this.#e,t),affectedNodeIds:[t],path:e,projectionChanged:this.isDirectoryProjectionVisible(t)})))})}beginChildLoad(e){return H(this.#e.instrumentation,`store.beginChildLoad`,()=>{let t=this.requireDirectoryNodeId(e),n=bi(this.#e),r=zn(this.#e,t);return ar(this.#e,rr(this.#e,n,Qn({affectedAncestorIds:Er(this.#e,t),affectedNodeIds:[t],attemptId:r.attemptId,path:e,projectionChanged:this.isDirectoryProjectionVisible(t),reused:r.reused}))),r})}applyChildPatch(e,t){return H(this.#e.instrumentation,`store.applyChildPatch`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null||Rn(this.#e,n)!==`loading`||!Hn(this.#e,n,e.attemptId))return!1;let r=U(this.#e,n);this.validateChildPatch(r,t);let i=bi(this.#e),a=[];for(let e of t.operations){Ki(r,e);let t=bi(this.#e);switch(e.type){case`add`:a.push(rr(this.#e,t,yr(this.#e,e.path)));break;case`remove`:a.push(rr(this.#e,t,br(this.#e,e.path,{recursive:e.recursive})));break;case`move`:{let n=xr(this.#e,e.from,e.to,{collision:e.collision});n!=null&&a.push(rr(this.#e,t,n));break}}}let o=a.some(e=>e.projectionChanged)||this.isDirectoryProjectionVisible(n);return ar(this.#e,rr(this.#e,i,$n({affectedAncestorIds:Er(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,childEvents:a,path:U(this.#e,n),projectionChanged:o}))),!0})}completeChildLoad(e){return H(this.#e.instrumentation,`store.completeChildLoad`,()=>{let t=this.resolveActiveDirectoryNodeId(e.nodeId);if(t==null)return!1;let n=bi(this.#e),r=Vn(this.#e,t,e.attemptId);return ar(this.#e,rr(this.#e,n,er({affectedAncestorIds:Er(this.#e,t),affectedNodeIds:[t],attemptId:e.attemptId,path:U(this.#e,t),projectionChanged:this.isDirectoryProjectionVisible(t),stale:!r}))),r})}failChildLoad(e,t){return H(this.#e.instrumentation,`store.failChildLoad`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null)return!1;let r=bi(this.#e),i=Un(this.#e,n,e.attemptId,t);return ar(this.#e,rr(this.#e,r,tr({affectedAncestorIds:Er(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,errorMessage:t,path:U(this.#e,n),projectionChanged:this.isDirectoryProjectionVisible(n),stale:!i}))),i})}cleanup(e={}){return H(this.#e.instrumentation,`store.cleanup`,()=>{if(this.#e.transactionStack.length>0)throw Error(`Cleanup cannot run during an open batch or transaction.`);if(gi(this.#e))throw Error(`Cleanup cannot run while directory loads are active.`);let t=bi(this.#e),n=_i(this.#e,e.mode??`stable`);return ar(this.#e,rr(this.#e,t,nr({...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=W(this.#e,p).childIds,_=m===d?n[m]??0:0,v=_,y,b=l.get(a)??Yt(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=Zt(an(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(G(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=G(this.#e,n);Fn(this.#e,n,i)||(In(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=G(this.#e,e);if(!Fn(this.#e,e,t))return!1}return!0}requireDirectoryNodeId(e){let t=Dr(this.#e,e);if(t==null)throw Error(`Path does not exist: "${e}"`);if(!V(G(this.#e,t)))throw Error(`Path is not a directory: "${e}"`);return t}resolveActiveDirectoryNodeId(e){try{if(!V(G(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=G(this.#e,t).parentId;if(e!==this.#e.snapshot.rootId){let n=G(this.#e,e),r=hr(this.#e,e);if(!Fn(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 Ki(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 qi={compact:{itemHeight:24,factor:.8},default:{itemHeight:30,factor:1},relaxed:{itemHeight:36,factor:1.2}};function Ji(e,t){if(typeof e==`number`)return{itemHeight:t??qi.default.itemHeight,factor:e};let n=qi[e??`default`];return{itemHeight:t??n.itemHeight,factor:n.factor}}var Yi=qi.default.itemHeight,Xi=`@layer base, theme, unsafe;
|
|
2
|
+
|
|
3
|
+
@layer base {
|
|
4
|
+
:host {
|
|
5
|
+
/*
|
|
6
|
+
CSS variables use a fallback stack to ensure user and theme colors slot
|
|
7
|
+
in with ease. User colors take precedence over theme colors, which take
|
|
8
|
+
precedence over defaults.
|
|
9
|
+
|
|
10
|
+
Fallback order:
|
|
11
|
+
|
|
12
|
+
1. --trees-*-override (explicit)
|
|
13
|
+
2. --trees-theme-* (e.g. Shiki/VS Code tokens)
|
|
14
|
+
3. defaults
|
|
15
|
+
|
|
16
|
+
Theme variable names mirror Shiki/VS Code theme file JSON tokens.
|
|
17
|
+
|
|
18
|
+
// Available CSS Color Overrides
|
|
19
|
+
--trees-fg-override
|
|
20
|
+
--trees-fg-muted-override
|
|
21
|
+
--trees-bg-override
|
|
22
|
+
--trees-bg-muted-override
|
|
23
|
+
--trees-accent-override
|
|
24
|
+
--trees-border-color-override
|
|
25
|
+
|
|
26
|
+
--trees-focus-ring-color-override
|
|
27
|
+
--trees-focus-ring-width-override
|
|
28
|
+
--trees-focus-ring-offset-override
|
|
29
|
+
|
|
30
|
+
--trees-search-fg-override
|
|
31
|
+
--trees-search-font-weight-override
|
|
32
|
+
--trees-search-bg-override
|
|
33
|
+
|
|
34
|
+
--trees-selected-fg-override
|
|
35
|
+
--trees-selected-bg-override
|
|
36
|
+
--trees-selected-focused-border-color-override
|
|
37
|
+
|
|
38
|
+
// Git Status Color Overrides
|
|
39
|
+
--trees-status-added-override
|
|
40
|
+
--trees-status-ignored-override
|
|
41
|
+
--trees-status-modified-override
|
|
42
|
+
--trees-status-renamed-override
|
|
43
|
+
--trees-status-untracked-override
|
|
44
|
+
--trees-status-deleted-override
|
|
45
|
+
--trees-git-added-color-override
|
|
46
|
+
--trees-git-ignored-color-override
|
|
47
|
+
--trees-git-modified-color-override
|
|
48
|
+
--trees-git-renamed-color-override
|
|
49
|
+
--trees-git-untracked-color-override
|
|
50
|
+
--trees-git-deleted-color-override
|
|
51
|
+
|
|
52
|
+
// Built-in File Icon Color Overrides
|
|
53
|
+
--trees-file-icon-color
|
|
54
|
+
--trees-file-icon-color-astro
|
|
55
|
+
--trees-file-icon-color-babel
|
|
56
|
+
--trees-file-icon-color-bash
|
|
57
|
+
--trees-file-icon-color-biome
|
|
58
|
+
--trees-file-icon-color-bootstrap
|
|
59
|
+
--trees-file-icon-color-browserslist
|
|
60
|
+
--trees-file-icon-color-bun
|
|
61
|
+
--trees-file-icon-color-c
|
|
62
|
+
--trees-file-icon-color-cpp
|
|
63
|
+
--trees-file-icon-color-claude
|
|
64
|
+
--trees-file-icon-color-css
|
|
65
|
+
--trees-file-icon-color-database
|
|
66
|
+
--trees-file-icon-color-default
|
|
67
|
+
--trees-file-icon-color-docker
|
|
68
|
+
--trees-file-icon-color-eslint
|
|
69
|
+
--trees-file-icon-color-git
|
|
70
|
+
--trees-file-icon-color-go
|
|
71
|
+
--trees-file-icon-color-graphql
|
|
72
|
+
--trees-file-icon-color-html
|
|
73
|
+
--trees-file-icon-color-image
|
|
74
|
+
--trees-file-icon-color-javascript
|
|
75
|
+
--trees-file-icon-color-json
|
|
76
|
+
--trees-file-icon-color-markdown
|
|
77
|
+
--trees-file-icon-color-mcp
|
|
78
|
+
--trees-file-icon-color-npm
|
|
79
|
+
--trees-file-icon-color-oxc
|
|
80
|
+
--trees-file-icon-color-postcss
|
|
81
|
+
--trees-file-icon-color-prettier
|
|
82
|
+
--trees-file-icon-color-python
|
|
83
|
+
--trees-file-icon-color-react
|
|
84
|
+
--trees-file-icon-color-ruby
|
|
85
|
+
--trees-file-icon-color-rust
|
|
86
|
+
--trees-file-icon-color-sass
|
|
87
|
+
--trees-file-icon-color-svg
|
|
88
|
+
--trees-file-icon-color-svelte
|
|
89
|
+
--trees-file-icon-color-svgo
|
|
90
|
+
--trees-file-icon-color-swift
|
|
91
|
+
--trees-file-icon-color-table
|
|
92
|
+
--trees-file-icon-color-text
|
|
93
|
+
--trees-file-icon-color-tailwind
|
|
94
|
+
--trees-file-icon-color-terraform
|
|
95
|
+
--trees-file-icon-color-typescript
|
|
96
|
+
--trees-file-icon-color-vite
|
|
97
|
+
--trees-file-icon-color-vscode
|
|
98
|
+
--trees-file-icon-color-vue
|
|
99
|
+
--trees-file-icon-color-wasm
|
|
100
|
+
--trees-file-icon-color-webpack
|
|
101
|
+
--trees-file-icon-color-yml
|
|
102
|
+
--trees-file-icon-color-zig
|
|
103
|
+
--trees-file-icon-color-zip
|
|
104
|
+
|
|
105
|
+
// Density
|
|
106
|
+
//
|
|
107
|
+
// A unitless scale factor for padding, gaps, and indentation. Usually
|
|
108
|
+
// set via \`density\` on useFileTree. Individual overrides take precedence.
|
|
109
|
+
//
|
|
110
|
+
// Compact: 0.8
|
|
111
|
+
// Default: 1
|
|
112
|
+
// Relaxed: 1.2
|
|
113
|
+
//
|
|
114
|
+
--trees-density-override
|
|
115
|
+
|
|
116
|
+
// Available CSS Layout Overrides
|
|
117
|
+
--trees-gap-override
|
|
118
|
+
--trees-border-radius-override
|
|
119
|
+
--trees-font-family-override
|
|
120
|
+
--trees-font-size-override
|
|
121
|
+
--trees-font-weight-regular-override
|
|
122
|
+
--trees-font-weight-semibold-override
|
|
123
|
+
--trees-level-gap-override
|
|
124
|
+
--trees-item-padding-x-override
|
|
125
|
+
--trees-item-margin-x-override
|
|
126
|
+
--trees-item-row-gap-override
|
|
127
|
+
--trees-icon-width-override
|
|
128
|
+
--trees-icon-nudge-override
|
|
129
|
+
--trees-scrollbar-gutter-override
|
|
130
|
+
--trees-padding-inline-override
|
|
131
|
+
*/
|
|
132
|
+
|
|
133
|
+
--trees-accent: var(--trees-accent-override, #009fff);
|
|
134
|
+
--trees-fg: var(
|
|
135
|
+
--trees-fg-override,
|
|
136
|
+
var(--trees-theme-sidebar-fg, light-dark(#6c6c71, #adadb1))
|
|
137
|
+
);
|
|
138
|
+
--trees-fg-muted: var(
|
|
139
|
+
--trees-fg-muted-override,
|
|
140
|
+
var(--trees-theme-sidebar-header-fg, light-dark(#84848a, #84848a))
|
|
141
|
+
);
|
|
142
|
+
--trees-bg: var(
|
|
143
|
+
--trees-bg-override,
|
|
144
|
+
var(--trees-theme-sidebar-bg, light-dark(#f8f8f8, #141415))
|
|
145
|
+
);
|
|
146
|
+
/* var(--trees-theme-list-hover-bg, light-dark(#dfebff59, #19283c59)) */
|
|
147
|
+
--trees-bg-muted: var(
|
|
148
|
+
--trees-bg-muted-override,
|
|
149
|
+
var(
|
|
150
|
+
--trees-theme-list-hover-bg,
|
|
151
|
+
light-dark(
|
|
152
|
+
color-mix(
|
|
153
|
+
in lab,
|
|
154
|
+
var(--trees-accent) var(--trees-bg-alpha-light, 8%),
|
|
155
|
+
var(--trees-bg)
|
|
156
|
+
),
|
|
157
|
+
color-mix(
|
|
158
|
+
in lab,
|
|
159
|
+
var(--trees-accent) var(--trees-bg-alpha-dark, 10%),
|
|
160
|
+
var(--trees-bg)
|
|
161
|
+
)
|
|
162
|
+
)
|
|
163
|
+
)
|
|
164
|
+
);
|
|
165
|
+
--trees-input-bg: var(
|
|
166
|
+
--trees-input-bg-override,
|
|
167
|
+
light-dark(#f8f8f8, #070707)
|
|
168
|
+
);
|
|
169
|
+
|
|
170
|
+
--trees-added-light: #16a994;
|
|
171
|
+
--trees-added-dark: #00cab1;
|
|
172
|
+
--trees-ignored-light: #adadb1;
|
|
173
|
+
--trees-ignored-dark: #4a4a4e;
|
|
174
|
+
--trees-modified-light: #1ca1c7;
|
|
175
|
+
--trees-modified-dark: #08c0ef;
|
|
176
|
+
--trees-renamed-light: #d5a910;
|
|
177
|
+
--trees-renamed-dark: #ffd452;
|
|
178
|
+
--trees-untracked-light: #16a994;
|
|
179
|
+
--trees-untracked-dark: #00cab1;
|
|
180
|
+
--trees-deleted-light: #ff2e3f;
|
|
181
|
+
--trees-deleted-dark: #ff6762;
|
|
182
|
+
|
|
183
|
+
--trees-border-color: var(
|
|
184
|
+
--trees-border-color-override,
|
|
185
|
+
var(--trees-theme-sidebar-border, light-dark(#eeeeef, #070707))
|
|
186
|
+
);
|
|
187
|
+
--trees-indent-guide-bg: var(
|
|
188
|
+
--trees-indent-guide-bg-override,
|
|
189
|
+
color-mix(in lab, var(--trees-fg-muted) 25%, transparent)
|
|
190
|
+
);
|
|
191
|
+
--trees-density: var(--trees-density-override, 1);
|
|
192
|
+
--trees-border-radius: var(
|
|
193
|
+
--trees-border-radius-override,
|
|
194
|
+
calc(6px * var(--trees-density))
|
|
195
|
+
);
|
|
196
|
+
|
|
197
|
+
--trees-font-family: var(--trees-font-family-override, system-ui);
|
|
198
|
+
--trees-font-size: var(--trees-font-size-override, 13px);
|
|
199
|
+
--trees-font-weight-regular: var(--trees-font-weight-regular-override, 400);
|
|
200
|
+
--trees-font-weight-semibold: var(
|
|
201
|
+
--trees-font-weight-semibold-override,
|
|
202
|
+
600
|
|
203
|
+
);
|
|
204
|
+
|
|
205
|
+
--trees-focus-ring-color: var(
|
|
206
|
+
--trees-focus-ring-color-override,
|
|
207
|
+
var(--trees-theme-focus-ring, var(--trees-accent))
|
|
208
|
+
);
|
|
209
|
+
--trees-focus-ring-width: var(--trees-focus-ring-width-override, 1px);
|
|
210
|
+
--trees-focus-ring-offset: var(--trees-focus-ring-offset-override, -1px);
|
|
211
|
+
|
|
212
|
+
--trees-search-fg: var(
|
|
213
|
+
--trees-search-fg-override,
|
|
214
|
+
var(--trees-theme-input-fg, var(--trees-fg))
|
|
215
|
+
);
|
|
216
|
+
--trees-search-font-weight: var(--trees-search-font-weight-override, 600);
|
|
217
|
+
--trees-search-bg: var(
|
|
218
|
+
--trees-search-bg-override,
|
|
219
|
+
var(--trees-theme-input-bg, var(--trees-input-bg))
|
|
220
|
+
);
|
|
221
|
+
|
|
222
|
+
--trees-scrollbar-thumb: var(
|
|
223
|
+
--trees-scrollbar-thumb-override,
|
|
224
|
+
var(
|
|
225
|
+
--trees-theme-scrollbar-thumb,
|
|
226
|
+
color-mix(in lab, var(--trees-fg) 25%, var(--trees-bg))
|
|
227
|
+
)
|
|
228
|
+
);
|
|
229
|
+
|
|
230
|
+
--trees-selected-fg: var(
|
|
231
|
+
--trees-selected-fg-override,
|
|
232
|
+
var(--trees-theme-list-active-selection-fg, var(--trees-fg))
|
|
233
|
+
);
|
|
234
|
+
--trees-selected-bg: var(
|
|
235
|
+
--trees-selected-bg-override,
|
|
236
|
+
var(
|
|
237
|
+
--trees-theme-list-active-selection-bg,
|
|
238
|
+
light-dark(
|
|
239
|
+
color-mix(in lab, var(--trees-accent) 12%, var(--trees-bg)),
|
|
240
|
+
color-mix(in lab, var(--trees-accent) 15%, var(--trees-bg))
|
|
241
|
+
)
|
|
242
|
+
)
|
|
243
|
+
);
|
|
244
|
+
--trees-selected-focused-border-color: var(
|
|
245
|
+
--trees-selected-focused-border-color-override,
|
|
246
|
+
var(--trees-theme-focus-ring, var(--trees-accent))
|
|
247
|
+
);
|
|
248
|
+
|
|
249
|
+
/* Git status (e.g. from Shiki theme gitDecoration.*) */
|
|
250
|
+
--trees-status-added: var(
|
|
251
|
+
--trees-status-added-override,
|
|
252
|
+
var(
|
|
253
|
+
--trees-theme-git-added-fg,
|
|
254
|
+
light-dark(var(--trees-added-light), var(--trees-added-dark))
|
|
255
|
+
)
|
|
256
|
+
);
|
|
257
|
+
--trees-status-ignored: var(
|
|
258
|
+
--trees-status-ignored-override,
|
|
259
|
+
var(
|
|
260
|
+
--trees-theme-git-ignored-fg,
|
|
261
|
+
light-dark(var(--trees-ignored-light), var(--trees-ignored-dark))
|
|
262
|
+
)
|
|
263
|
+
);
|
|
264
|
+
--trees-status-modified: var(
|
|
265
|
+
--trees-status-modified-override,
|
|
266
|
+
var(
|
|
267
|
+
--trees-theme-git-modified-fg,
|
|
268
|
+
light-dark(var(--trees-modified-light), var(--trees-modified-dark))
|
|
269
|
+
)
|
|
270
|
+
);
|
|
271
|
+
--trees-status-renamed: var(
|
|
272
|
+
--trees-status-renamed-override,
|
|
273
|
+
var(
|
|
274
|
+
--trees-theme-git-renamed-fg,
|
|
275
|
+
light-dark(var(--trees-renamed-light), var(--trees-renamed-dark))
|
|
276
|
+
)
|
|
277
|
+
);
|
|
278
|
+
--trees-status-untracked: var(
|
|
279
|
+
--trees-status-untracked-override,
|
|
280
|
+
var(
|
|
281
|
+
--trees-theme-git-untracked-fg,
|
|
282
|
+
light-dark(var(--trees-untracked-light), var(--trees-untracked-dark))
|
|
283
|
+
)
|
|
284
|
+
);
|
|
285
|
+
--trees-status-deleted: var(
|
|
286
|
+
--trees-status-deleted-override,
|
|
287
|
+
var(
|
|
288
|
+
--trees-theme-git-deleted-fg,
|
|
289
|
+
light-dark(var(--trees-deleted-light), var(--trees-deleted-dark))
|
|
290
|
+
)
|
|
291
|
+
);
|
|
292
|
+
--trees-git-modified-color: var(
|
|
293
|
+
--trees-git-modified-color-override,
|
|
294
|
+
var(--trees-status-modified)
|
|
295
|
+
);
|
|
296
|
+
--trees-git-added-color: var(
|
|
297
|
+
--trees-git-added-color-override,
|
|
298
|
+
var(--trees-status-added)
|
|
299
|
+
);
|
|
300
|
+
--trees-git-ignored-color: var(
|
|
301
|
+
--trees-git-ignored-color-override,
|
|
302
|
+
var(--trees-status-ignored)
|
|
303
|
+
);
|
|
304
|
+
--trees-git-deleted-color: var(
|
|
305
|
+
--trees-git-deleted-color-override,
|
|
306
|
+
var(--trees-status-deleted)
|
|
307
|
+
);
|
|
308
|
+
--trees-git-renamed-color: var(
|
|
309
|
+
--trees-git-renamed-color-override,
|
|
310
|
+
var(--trees-status-renamed)
|
|
311
|
+
);
|
|
312
|
+
--trees-git-untracked-color: var(
|
|
313
|
+
--trees-git-untracked-color-override,
|
|
314
|
+
var(--trees-status-untracked)
|
|
315
|
+
);
|
|
316
|
+
|
|
317
|
+
--trees-icon-gray: light-dark(#84848a, #adadb1);
|
|
318
|
+
--trees-icon-red: light-dark(#d52c36, #ff6762);
|
|
319
|
+
--trees-icon-vermilion: light-dark(#ff8c5b, #d5512f);
|
|
320
|
+
--trees-icon-orange: light-dark(#d47628, #ffa359);
|
|
321
|
+
--trees-icon-yellow: light-dark(#d5a910, #ffd452);
|
|
322
|
+
--trees-icon-green: light-dark(#199f43, #5ecc71);
|
|
323
|
+
--trees-icon-teal: light-dark(#17a5af, #64d1db);
|
|
324
|
+
--trees-icon-cyan: light-dark(#1ca1c7, #68cdf2);
|
|
325
|
+
--trees-icon-blue: light-dark(#1a85d4, #69b1ff);
|
|
326
|
+
--trees-icon-indigo: light-dark(#693acf, #9d6afb);
|
|
327
|
+
--trees-icon-purple: light-dark(#a631be, #d568ea);
|
|
328
|
+
--trees-icon-pink: light-dark(#d32a61, #ff678d);
|
|
329
|
+
--trees-icon-mauve: light-dark(#594c5b, #79697b);
|
|
330
|
+
|
|
331
|
+
--trees-file-icon-color-default: var(
|
|
332
|
+
--trees-file-icon-color,
|
|
333
|
+
var(--trees-icon-gray)
|
|
334
|
+
);
|
|
335
|
+
--trees-file-icon-color-astro: var(
|
|
336
|
+
--trees-file-icon-color,
|
|
337
|
+
var(--trees-icon-purple)
|
|
338
|
+
);
|
|
339
|
+
--trees-file-icon-color-babel: var(
|
|
340
|
+
--trees-file-icon-color,
|
|
341
|
+
var(--trees-icon-yellow)
|
|
342
|
+
);
|
|
343
|
+
--trees-file-icon-color-bash: var(
|
|
344
|
+
--trees-file-icon-color,
|
|
345
|
+
var(--trees-icon-green)
|
|
346
|
+
);
|
|
347
|
+
--trees-file-icon-color-biome: var(
|
|
348
|
+
--trees-file-icon-color,
|
|
349
|
+
var(--trees-icon-blue)
|
|
350
|
+
);
|
|
351
|
+
--trees-file-icon-color-bootstrap: var(
|
|
352
|
+
--trees-file-icon-color,
|
|
353
|
+
var(--trees-icon-indigo)
|
|
354
|
+
);
|
|
355
|
+
--trees-file-icon-color-browserslist: var(
|
|
356
|
+
--trees-file-icon-color,
|
|
357
|
+
var(--trees-icon-yellow)
|
|
358
|
+
);
|
|
359
|
+
--trees-file-icon-color-bun: var(
|
|
360
|
+
--trees-file-icon-color,
|
|
361
|
+
var(--trees-icon-mauve)
|
|
362
|
+
);
|
|
363
|
+
--trees-file-icon-color-c: var(
|
|
364
|
+
--trees-file-icon-color,
|
|
365
|
+
var(--trees-icon-blue)
|
|
366
|
+
);
|
|
367
|
+
--trees-file-icon-color-cpp: var(
|
|
368
|
+
--trees-file-icon-color,
|
|
369
|
+
var(--trees-icon-blue)
|
|
370
|
+
);
|
|
371
|
+
--trees-file-icon-color-claude: var(
|
|
372
|
+
--trees-file-icon-color,
|
|
373
|
+
var(--trees-icon-orange)
|
|
374
|
+
);
|
|
375
|
+
--trees-file-icon-color-css: var(
|
|
376
|
+
--trees-file-icon-color,
|
|
377
|
+
var(--trees-icon-indigo)
|
|
378
|
+
);
|
|
379
|
+
--trees-file-icon-color-database: var(
|
|
380
|
+
--trees-file-icon-color,
|
|
381
|
+
var(--trees-icon-purple)
|
|
382
|
+
);
|
|
383
|
+
--trees-file-icon-color-docker: var(
|
|
384
|
+
--trees-file-icon-color,
|
|
385
|
+
var(--trees-icon-blue)
|
|
386
|
+
);
|
|
387
|
+
--trees-file-icon-color-eslint: var(
|
|
388
|
+
--trees-file-icon-color,
|
|
389
|
+
var(--trees-icon-indigo)
|
|
390
|
+
);
|
|
391
|
+
--trees-file-icon-color-git: var(
|
|
392
|
+
--trees-file-icon-vermilion,
|
|
393
|
+
var(--trees-icon-vermilion)
|
|
394
|
+
);
|
|
395
|
+
--trees-file-icon-color-go: var(
|
|
396
|
+
--trees-file-icon-color,
|
|
397
|
+
var(--trees-icon-cyan)
|
|
398
|
+
);
|
|
399
|
+
--trees-file-icon-color-graphql: var(
|
|
400
|
+
--trees-file-icon-color,
|
|
401
|
+
var(--trees-icon-pink)
|
|
402
|
+
);
|
|
403
|
+
--trees-file-icon-color-html: var(
|
|
404
|
+
--trees-file-icon-color,
|
|
405
|
+
var(--trees-icon-orange)
|
|
406
|
+
);
|
|
407
|
+
--trees-file-icon-color-image: var(
|
|
408
|
+
--trees-file-icon-color,
|
|
409
|
+
var(--trees-icon-pink)
|
|
410
|
+
);
|
|
411
|
+
--trees-file-icon-color-javascript: var(
|
|
412
|
+
--trees-file-icon-color,
|
|
413
|
+
var(--trees-icon-yellow)
|
|
414
|
+
);
|
|
415
|
+
--trees-file-icon-color-json: var(
|
|
416
|
+
--trees-file-icon-color,
|
|
417
|
+
var(--trees-icon-orange)
|
|
418
|
+
);
|
|
419
|
+
--trees-file-icon-color-markdown: var(
|
|
420
|
+
--trees-file-icon-color,
|
|
421
|
+
var(--trees-icon-green)
|
|
422
|
+
);
|
|
423
|
+
--trees-file-icon-color-mcp: var(
|
|
424
|
+
--trees-file-icon-color,
|
|
425
|
+
var(--trees-icon-teal)
|
|
426
|
+
);
|
|
427
|
+
--trees-file-icon-color-npm: var(
|
|
428
|
+
--trees-file-icon-color,
|
|
429
|
+
var(--trees-icon-red)
|
|
430
|
+
);
|
|
431
|
+
--trees-file-icon-color-oxc: var(
|
|
432
|
+
--trees-file-icon-cyan,
|
|
433
|
+
var(--trees-icon-cyan)
|
|
434
|
+
);
|
|
435
|
+
--trees-file-icon-color-postcss: var(
|
|
436
|
+
--trees-file-icon-color,
|
|
437
|
+
var(--trees-icon-red)
|
|
438
|
+
);
|
|
439
|
+
--trees-file-icon-color-prettier: var(
|
|
440
|
+
--trees-file-icon-color,
|
|
441
|
+
var(--trees-icon-teal)
|
|
442
|
+
);
|
|
443
|
+
--trees-file-icon-color-python: var(
|
|
444
|
+
--trees-file-icon-color,
|
|
445
|
+
var(--trees-icon-blue)
|
|
446
|
+
);
|
|
447
|
+
--trees-file-icon-color-react: var(
|
|
448
|
+
--trees-file-icon-color,
|
|
449
|
+
var(--trees-icon-cyan)
|
|
450
|
+
);
|
|
451
|
+
--trees-file-icon-color-ruby: var(
|
|
452
|
+
--trees-file-icon-color,
|
|
453
|
+
var(--trees-icon-red)
|
|
454
|
+
);
|
|
455
|
+
--trees-file-icon-color-rust: var(
|
|
456
|
+
--trees-file-icon-color,
|
|
457
|
+
var(--trees-icon-orange)
|
|
458
|
+
);
|
|
459
|
+
--trees-file-icon-color-sass: var(
|
|
460
|
+
--trees-file-icon-color,
|
|
461
|
+
var(--trees-icon-pink)
|
|
462
|
+
);
|
|
463
|
+
--trees-file-icon-color-svg: var(
|
|
464
|
+
--trees-file-icon-color,
|
|
465
|
+
var(--trees-icon-orange)
|
|
466
|
+
);
|
|
467
|
+
--trees-file-icon-color-svelte: var(
|
|
468
|
+
--trees-file-icon-color,
|
|
469
|
+
var(--trees-icon-red)
|
|
470
|
+
);
|
|
471
|
+
--trees-file-icon-color-svgo: var(
|
|
472
|
+
--trees-file-icon-color,
|
|
473
|
+
var(--trees-icon-green)
|
|
474
|
+
);
|
|
475
|
+
--trees-file-icon-color-swift: var(
|
|
476
|
+
--trees-file-icon-color,
|
|
477
|
+
var(--trees-icon-orange)
|
|
478
|
+
);
|
|
479
|
+
--trees-file-icon-color-table: var(
|
|
480
|
+
--trees-file-icon-color,
|
|
481
|
+
var(--trees-icon-teal)
|
|
482
|
+
);
|
|
483
|
+
--trees-file-icon-color-text: var(
|
|
484
|
+
--trees-file-icon-color,
|
|
485
|
+
var(--trees-icon-gray)
|
|
486
|
+
);
|
|
487
|
+
--trees-file-icon-color-tailwind: var(
|
|
488
|
+
--trees-file-icon-color,
|
|
489
|
+
var(--trees-icon-cyan)
|
|
490
|
+
);
|
|
491
|
+
--trees-file-icon-color-terraform: var(
|
|
492
|
+
--trees-file-icon-color,
|
|
493
|
+
var(--trees-icon-indigo)
|
|
494
|
+
);
|
|
495
|
+
--trees-file-icon-color-typescript: var(
|
|
496
|
+
--trees-file-icon-color,
|
|
497
|
+
var(--trees-icon-blue)
|
|
498
|
+
);
|
|
499
|
+
--trees-file-icon-color-vite: var(
|
|
500
|
+
--trees-file-icon-color,
|
|
501
|
+
var(--trees-icon-purple)
|
|
502
|
+
);
|
|
503
|
+
--trees-file-icon-color-vscode: var(
|
|
504
|
+
--trees-file-icon-color,
|
|
505
|
+
var(--trees-icon-blue)
|
|
506
|
+
);
|
|
507
|
+
--trees-file-icon-color-vue: var(
|
|
508
|
+
--trees-file-icon-color,
|
|
509
|
+
var(--trees-icon-green)
|
|
510
|
+
);
|
|
511
|
+
--trees-file-icon-color-wasm: var(
|
|
512
|
+
--trees-file-icon-color,
|
|
513
|
+
var(--trees-icon-indigo)
|
|
514
|
+
);
|
|
515
|
+
--trees-file-icon-color-webpack: var(
|
|
516
|
+
--trees-file-icon-color,
|
|
517
|
+
var(--trees-icon-blue)
|
|
518
|
+
);
|
|
519
|
+
--trees-file-icon-color-yml: var(
|
|
520
|
+
--trees-file-icon-color,
|
|
521
|
+
var(--trees-icon-red)
|
|
522
|
+
);
|
|
523
|
+
--trees-file-icon-color-zig: var(
|
|
524
|
+
--trees-file-icon-color,
|
|
525
|
+
var(--trees-icon-orange)
|
|
526
|
+
);
|
|
527
|
+
--trees-file-icon-color-zip: var(
|
|
528
|
+
--trees-file-icon-color,
|
|
529
|
+
var(--trees-icon-orange)
|
|
530
|
+
);
|
|
531
|
+
|
|
532
|
+
--trees-level-gap: var(
|
|
533
|
+
--trees-level-gap-override,
|
|
534
|
+
calc(8px * var(--trees-density))
|
|
535
|
+
);
|
|
536
|
+
--trees-item-padding-x: var(
|
|
537
|
+
--trees-item-padding-x-override,
|
|
538
|
+
calc(8px * var(--trees-density))
|
|
539
|
+
);
|
|
540
|
+
--trees-item-margin-x: var(
|
|
541
|
+
--trees-item-margin-x-override,
|
|
542
|
+
calc(2px * var(--trees-density))
|
|
543
|
+
);
|
|
544
|
+
--trees-item-row-gap: var(
|
|
545
|
+
--trees-item-row-gap-override,
|
|
546
|
+
calc(6px * var(--trees-density))
|
|
547
|
+
);
|
|
548
|
+
--trees-icon-width: var(--trees-icon-width-override, 16px);
|
|
549
|
+
--trees-icon-nudge: var(
|
|
550
|
+
--trees-icon-nudge-override,
|
|
551
|
+
calc(1px * var(--trees-density))
|
|
552
|
+
);
|
|
553
|
+
--trees-row-height: var(--trees-item-height, 30px);
|
|
554
|
+
--trees-git-lane-width: var(--trees-git-lane-width-override, 12px);
|
|
555
|
+
--trees-action-lane-width: var(
|
|
556
|
+
--trees-action-lane-width-override,
|
|
557
|
+
calc(var(--trees-icon-width) + 2px)
|
|
558
|
+
);
|
|
559
|
+
/* Keep the floating trigger aligned with the row's action lane. Going in
|
|
560
|
+
from the root's right edge: the scroll container reserves
|
|
561
|
+
\`--trees-padding-inline\` of effective inset on each side (its asymmetric
|
|
562
|
+
padding formula cancels the scrollbar gutter on the right), the row
|
|
563
|
+
sits inside that inset, and its trailing \`--trees-item-padding-x\` is the
|
|
564
|
+
action lane itself. The trigger's own focus-ring margin then trims one
|
|
565
|
+
pixel back so the button's visible right edge lines up with the lane. */
|
|
566
|
+
--trees-context-menu-trigger-inline-offset: calc(
|
|
567
|
+
var(--trees-padding-inline) + var(--trees-item-padding-x) -
|
|
568
|
+
var(--trees-focus-ring-width)
|
|
569
|
+
);
|
|
570
|
+
|
|
571
|
+
--trees-scrollbar-gutter: var(--trees-scrollbar-gutter-override, 6px);
|
|
572
|
+
--trees-padding-inline: var(--trees-padding-inline-override, 16px);
|
|
573
|
+
|
|
574
|
+
color-scheme: light dark;
|
|
575
|
+
display: flex;
|
|
576
|
+
flex-direction: column;
|
|
577
|
+
font-size: var(--trees-font-size);
|
|
578
|
+
color: var(--trees-fg);
|
|
579
|
+
background-color: var(--trees-bg);
|
|
580
|
+
--truncate-marker-background-color: var(--trees-bg);
|
|
581
|
+
--truncate-marker-background-overlay-color: transparent;
|
|
582
|
+
font-family: var(--trees-font-family);
|
|
583
|
+
font-weight: var(--trees-font-weight-regular);
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
:host([data-file-tree-virtualized='true']) {
|
|
587
|
+
height: 100%;
|
|
588
|
+
overflow: hidden;
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
[data-file-tree-virtualized-wrapper='true'] {
|
|
592
|
+
height: 100%;
|
|
593
|
+
overflow: hidden;
|
|
594
|
+
display: flex;
|
|
595
|
+
flex-direction: column;
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
[data-file-tree-virtualized-root='true'] {
|
|
599
|
+
height: 100%;
|
|
600
|
+
display: flex;
|
|
601
|
+
flex-direction: column;
|
|
602
|
+
overflow: hidden;
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
[data-file-tree-virtualized-scroll='true'],
|
|
606
|
+
[data-file-tree-scrollbar-measure='true'] {
|
|
607
|
+
--trees-scrollbar-thumb-current: transparent;
|
|
608
|
+
overflow-y: auto;
|
|
609
|
+
scrollbar-gutter: stable;
|
|
610
|
+
|
|
611
|
+
&:hover {
|
|
612
|
+
--trees-scrollbar-thumb-current: var(--trees-scrollbar-thumb);
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
&::-webkit-scrollbar {
|
|
616
|
+
width: var(--trees-scrollbar-gutter);
|
|
617
|
+
height: var(--trees-scrollbar-gutter);
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
&::-webkit-scrollbar-track {
|
|
621
|
+
background: transparent;
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
&::-webkit-scrollbar-thumb {
|
|
625
|
+
background-color: var(--trees-scrollbar-thumb-current);
|
|
626
|
+
border: 1px solid transparent;
|
|
627
|
+
background-clip: content-box;
|
|
628
|
+
border-radius: calc(var(--trees-scrollbar-gutter) / 2);
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
&::-webkit-scrollbar-corner {
|
|
632
|
+
background-color: transparent;
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
/* These are styles for a temporarily generated element to measure the size
|
|
637
|
+
* of the scrollbar. It's intended to be somewhat similar in scrollbar style
|
|
638
|
+
* scope to the scrollable tree so \`--trees-scrollbar-gutter-measured\` is an
|
|
639
|
+
* accurate reflection of the size the scrollbar gutter takes up. */
|
|
640
|
+
[data-file-tree-scrollbar-measure='true'] {
|
|
641
|
+
position: absolute;
|
|
642
|
+
top: 0;
|
|
643
|
+
left: 0;
|
|
644
|
+
visibility: hidden;
|
|
645
|
+
pointer-events: none;
|
|
646
|
+
width: 100px;
|
|
647
|
+
height: 100px;
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
@supports (-moz-appearance: none) {
|
|
651
|
+
[data-file-tree-virtualized-scroll='true'],
|
|
652
|
+
[data-file-tree-scrollbar-measure='true'] {
|
|
653
|
+
scrollbar-width: thin;
|
|
654
|
+
scrollbar-color: var(--trees-scrollbar-thumb-current) transparent;
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
[data-file-tree-virtualized-scroll='true'] {
|
|
659
|
+
position: relative;
|
|
660
|
+
overflow-y: auto;
|
|
661
|
+
flex: 1 1 0;
|
|
662
|
+
min-height: 0;
|
|
663
|
+
padding-inline: max(
|
|
664
|
+
calc(var(--trees-padding-inline) - var(--trees-item-margin-x)),
|
|
665
|
+
0px
|
|
666
|
+
)
|
|
667
|
+
/* NOTE(amadeus): We can assume that all Webkit based browser gutters
|
|
668
|
+
* will align to the value of '--trees-scrollbar-gutter', however if not, then
|
|
669
|
+
* \`--trees-scrollbar-gutter-measured\` should correct it. Mostly we are
|
|
670
|
+
* hoping to avoid SSR alignment jumps if possible. In non-SSR'd environments
|
|
671
|
+
* \`--trees-scrollbar-gutter-measured\` should always be immediately available.
|
|
672
|
+
*/
|
|
673
|
+
max(
|
|
674
|
+
calc(
|
|
675
|
+
var(--trees-padding-inline) - var(--trees-item-margin-x) -
|
|
676
|
+
var(
|
|
677
|
+
--trees-scrollbar-gutter-measured,
|
|
678
|
+
var(--trees-scrollbar-gutter)
|
|
679
|
+
)
|
|
680
|
+
),
|
|
681
|
+
0px
|
|
682
|
+
);
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
@supports (-moz-appearance: none) {
|
|
686
|
+
[data-file-tree-virtualized-scroll='true'] {
|
|
687
|
+
padding-inline: max(
|
|
688
|
+
calc(var(--trees-padding-inline) - var(--trees-item-margin-x)),
|
|
689
|
+
0px
|
|
690
|
+
)
|
|
691
|
+
/* NOTE(amadeus): However on Firefox it can vary a little bit, but most
|
|
692
|
+
* likely the majority of cases will default to a 0px width scrollbar lets
|
|
693
|
+
* inherit that first to avoid SSR jumps. In non-SSR'd environments
|
|
694
|
+
* \`--trees-scrollbar-gutter-measured\` should always be immediately available.
|
|
695
|
+
*/
|
|
696
|
+
max(
|
|
697
|
+
calc(
|
|
698
|
+
var(--trees-padding-inline) - var(--trees-item-margin-x) -
|
|
699
|
+
var(--trees-scrollbar-gutter-measured, 0px)
|
|
700
|
+
),
|
|
701
|
+
0px
|
|
702
|
+
);
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
[data-file-tree-sticky-overlay='true'] {
|
|
707
|
+
position: sticky;
|
|
708
|
+
top: 0;
|
|
709
|
+
height: 0;
|
|
710
|
+
z-index: 4;
|
|
711
|
+
overflow: visible;
|
|
712
|
+
pointer-events: none;
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
/* The overlay DOM is kept populated even at scrollTop=0 so the browser has
|
|
716
|
+
* the rendered rows on hand the moment scrolling begins — otherwise the
|
|
717
|
+
* compositor paints a scrolled frame before React can mount the overlay,
|
|
718
|
+
* and the topmost sticky folder jumps up by a couple of pixels before it
|
|
719
|
+
* "snaps" into its pinned position. We hide it via CSS whenever the scroll
|
|
720
|
+
* is at the top and no scroll is in progress, so the preview doesn't leak
|
|
721
|
+
* through at rest. \`data-overlay-reveal\` is stamped on the root only when
|
|
722
|
+
* the user initiates a scroll while already at the top — exactly the case
|
|
723
|
+
* where we need the pre-mounted overlay to be visible through the first
|
|
724
|
+
* compositor frame. It is deliberately distinct from the general
|
|
725
|
+
* \`data-is-scrolling\` flag so a scroll that ends at the top (e.g. ArrowUp
|
|
726
|
+
* navigation) re-hides the overlay the instant the scroll lands, rather
|
|
727
|
+
* than waiting for the hover-suppression timer to elapse. */
|
|
728
|
+
[data-file-tree-virtualized-root='true'][data-scroll-at-top='true']:not(
|
|
729
|
+
[data-overlay-reveal]
|
|
730
|
+
)
|
|
731
|
+
[data-file-tree-sticky-overlay='true'] {
|
|
732
|
+
visibility: hidden;
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
[data-file-tree-sticky-overlay-content='true'] {
|
|
736
|
+
background-color: var(--trees-bg);
|
|
737
|
+
position: relative;
|
|
738
|
+
pointer-events: none;
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
[data-file-tree-virtualized-list='true'] {
|
|
742
|
+
background-color: var(--trees-bg);
|
|
743
|
+
position: relative;
|
|
744
|
+
min-height: 100%;
|
|
745
|
+
width: 100%;
|
|
746
|
+
overflow-anchor: none;
|
|
747
|
+
|
|
748
|
+
&[data-is-scrolling] {
|
|
749
|
+
pointer-events: none;
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
[data-file-tree-virtualized-sticky-offset='true'] {
|
|
754
|
+
contain: layout size;
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
[data-file-tree-virtualized-sticky='true'] {
|
|
758
|
+
position: sticky;
|
|
759
|
+
top: 0;
|
|
760
|
+
width: 100%;
|
|
761
|
+
display: flex;
|
|
762
|
+
flex-direction: column;
|
|
763
|
+
isolation: isolate;
|
|
764
|
+
/* Promote to its own compositor layer so text inside the window is
|
|
765
|
+
* rasterized once and GPU-translated during scroll. Without this, the
|
|
766
|
+
* browser re-paints the window (and its text) at every scroll frame,
|
|
767
|
+
* which produces visible 1px shake / character tearing. */
|
|
768
|
+
will-change: transform;
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
[data-file-tree-search-container] {
|
|
772
|
+
display: flex;
|
|
773
|
+
padding: 0;
|
|
774
|
+
padding-inline: var(--trees-padding-inline);
|
|
775
|
+
margin-bottom: var(--trees-item-row-gap);
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
[data-file-tree-search-input] {
|
|
779
|
+
--trees-focus-ring-width: 2px;
|
|
780
|
+
font-family: var(--trees-font-family);
|
|
781
|
+
font-size: var(--trees-font-size);
|
|
782
|
+
flex: 1;
|
|
783
|
+
height: var(--trees-row-height);
|
|
784
|
+
/* 1px breathing room so the focus-visible outline isn't clipped when the
|
|
785
|
+
* input sits flush against the top of the scroll container. */
|
|
786
|
+
margin-block: 1px;
|
|
787
|
+
padding-inline: var(--trees-item-padding-x);
|
|
788
|
+
line-height: var(--trees-row-height);
|
|
789
|
+
color: var(--trees-search-fg);
|
|
790
|
+
background-color: var(--trees-search-bg);
|
|
791
|
+
border: 1px solid var(--trees-border-color);
|
|
792
|
+
border-radius: var(--trees-border-radius);
|
|
793
|
+
outline: none;
|
|
794
|
+
|
|
795
|
+
&::placeholder {
|
|
796
|
+
color: color-mix(
|
|
797
|
+
in lab,
|
|
798
|
+
var(--trees-search-fg) 65%,
|
|
799
|
+
var(--trees-search-bg)
|
|
800
|
+
);
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
&:focus-visible,
|
|
804
|
+
&[data-file-tree-search-input-fake-focus='true'] {
|
|
805
|
+
outline: var(--trees-focus-ring-width) solid var(--trees-focus-ring-color);
|
|
806
|
+
outline-offset: var(--trees-focus-ring-offset);
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
/* The wrapper for the tree items */
|
|
811
|
+
[role='tree'] {
|
|
812
|
+
position: relative;
|
|
813
|
+
display: flex;
|
|
814
|
+
flex-direction: column;
|
|
815
|
+
gap: var(--trees-gap-override, 0);
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
/* LIST ITEM */
|
|
819
|
+
[data-type='item'] {
|
|
820
|
+
color: inherit;
|
|
821
|
+
font-family: var(--trees-font-family);
|
|
822
|
+
font-size: var(--trees-font-size);
|
|
823
|
+
text-align: start;
|
|
824
|
+
outline: none;
|
|
825
|
+
background-color: var(--trees-bg);
|
|
826
|
+
border: none;
|
|
827
|
+
position: relative;
|
|
828
|
+
|
|
829
|
+
padding: 0 var(--trees-item-padding-x);
|
|
830
|
+
margin: 0 var(--trees-item-margin-x);
|
|
831
|
+
cursor: pointer;
|
|
832
|
+
-webkit-user-select: none;
|
|
833
|
+
user-select: none;
|
|
834
|
+
-webkit-touch-callout: none;
|
|
835
|
+
touch-action: manipulation;
|
|
836
|
+
display: flex;
|
|
837
|
+
flex: 0 0 var(--trees-row-height);
|
|
838
|
+
align-items: center;
|
|
839
|
+
height: var(--trees-row-height);
|
|
840
|
+
line-height: var(--trees-row-height);
|
|
841
|
+
gap: var(--trees-item-row-gap);
|
|
842
|
+
border-radius: var(--trees-border-radius);
|
|
843
|
+
/* Row states may be translucent, so markers paint the tree background first
|
|
844
|
+
* and then the state color on top to avoid compositing the same alpha twice. */
|
|
845
|
+
--truncate-marker-background-color: var(--trees-bg);
|
|
846
|
+
--truncate-marker-background-overlay-color: transparent;
|
|
847
|
+
--truncate-marker-block-inset: 0px;
|
|
848
|
+
|
|
849
|
+
&:hover,
|
|
850
|
+
&[data-item-context-hover='true'] {
|
|
851
|
+
background-color: var(--trees-bg-muted);
|
|
852
|
+
--truncate-marker-background-overlay-color: var(--trees-bg-muted);
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
&[data-item-focused='true'],
|
|
856
|
+
&:focus-visible {
|
|
857
|
+
z-index: 2;
|
|
858
|
+
|
|
859
|
+
/* Flattened segment markers sit high enough to cover the row outline unless
|
|
860
|
+
* their painted background is inset by the focus ring width. */
|
|
861
|
+
[data-item-flattened-subitems] {
|
|
862
|
+
--truncate-marker-block-inset: var(--trees-focus-ring-width);
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
&::before {
|
|
866
|
+
position: absolute;
|
|
867
|
+
inset: 0;
|
|
868
|
+
content: '';
|
|
869
|
+
display: block;
|
|
870
|
+
border-radius: var(--trees-border-radius);
|
|
871
|
+
outline: var(--trees-focus-ring-width) solid
|
|
872
|
+
var(--trees-focus-ring-color);
|
|
873
|
+
outline-offset: var(--trees-focus-ring-offset);
|
|
874
|
+
pointer-events: none;
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
&[data-item-selected='true']::before {
|
|
878
|
+
outline-color: var(--trees-selected-focused-border-color);
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
&[data-item-selected='true'] {
|
|
883
|
+
color: var(--trees-selected-fg);
|
|
884
|
+
background-color: var(--trees-selected-bg);
|
|
885
|
+
--truncate-marker-background-overlay-color: var(--trees-selected-bg);
|
|
886
|
+
z-index: 3;
|
|
887
|
+
|
|
888
|
+
[data-item-section='icon'] {
|
|
889
|
+
color: var(--trees-selected-fg);
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
&[data-item-search-match='true'] {
|
|
894
|
+
font-weight: var(--trees-search-font-weight);
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
[data-type='item'][data-file-tree-sticky-row='true'] {
|
|
899
|
+
pointer-events: auto;
|
|
900
|
+
}
|
|
901
|
+
|
|
902
|
+
/* Sticky rows opt back into pointer events because the overlay wrapper is
|
|
903
|
+
* inert. During scroll, put them back under the same hover suppression as
|
|
904
|
+
* the virtualized list so translucent hover states and menu triggers do not
|
|
905
|
+
* paint over rows moving beneath the sticky stack. */
|
|
906
|
+
[data-file-tree-virtualized-root='true'][data-is-scrolling]
|
|
907
|
+
[data-type='item'][data-file-tree-sticky-row='true'] {
|
|
908
|
+
pointer-events: none;
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
[data-file-tree-virtualized-root='true'][data-is-scrolling]
|
|
912
|
+
[data-type='item'][data-file-tree-sticky-row='true']:hover:not(
|
|
913
|
+
[data-item-selected='true']
|
|
914
|
+
),
|
|
915
|
+
[data-file-tree-virtualized-root='true'][data-is-scrolling]
|
|
916
|
+
[data-type='item'][data-file-tree-sticky-row='true'][data-item-context-hover='true']:not(
|
|
917
|
+
[data-item-selected='true']
|
|
918
|
+
) {
|
|
919
|
+
background-color: var(--trees-bg);
|
|
920
|
+
--truncate-marker-background-overlay-color: transparent;
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
[data-item-selected='true']:has(+ [data-item-selected='true']) {
|
|
924
|
+
border-bottom-left-radius: 0;
|
|
925
|
+
border-bottom-right-radius: 0;
|
|
926
|
+
}
|
|
927
|
+
|
|
928
|
+
[data-item-selected='true'] + [data-item-selected='true'] {
|
|
929
|
+
border-top-left-radius: 0;
|
|
930
|
+
border-top-right-radius: 0;
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
/* Flattened Directory Parts */
|
|
934
|
+
[data-item-flattened-subitems] {
|
|
935
|
+
display: inline-flex;
|
|
936
|
+
align-items: center;
|
|
937
|
+
gap: 2px;
|
|
938
|
+
}
|
|
939
|
+
[data-item-flattened-subitem]:hover,
|
|
940
|
+
[data-item-flattened-subitem-drag-target='true'] {
|
|
941
|
+
text-decoration: underline;
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
/* Icon for each item */
|
|
945
|
+
[data-item-section='icon'] {
|
|
946
|
+
flex-shrink: 0;
|
|
947
|
+
display: flex;
|
|
948
|
+
align-items: center;
|
|
949
|
+
justify-content: center;
|
|
950
|
+
color: var(--trees-fg-muted);
|
|
951
|
+
fill: currentColor;
|
|
952
|
+
width: var(--trees-icon-width);
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
:where([data-item-section='icon'] > [data-icon-token]) {
|
|
956
|
+
color: var(--trees-fg-muted);
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
[data-file-tree-colored-icons='true'] {
|
|
960
|
+
[data-icon-token='astro'] {
|
|
961
|
+
color: var(--trees-file-icon-color-astro);
|
|
962
|
+
}
|
|
963
|
+
[data-icon-token='babel'] {
|
|
964
|
+
color: var(--trees-file-icon-color-babel);
|
|
965
|
+
}
|
|
966
|
+
[data-icon-token='bash'] {
|
|
967
|
+
color: var(--trees-file-icon-color-bash);
|
|
968
|
+
}
|
|
969
|
+
[data-icon-token='biome'] {
|
|
970
|
+
color: var(--trees-file-icon-color-biome);
|
|
971
|
+
}
|
|
972
|
+
[data-icon-token='bootstrap'] {
|
|
973
|
+
color: var(--trees-file-icon-color-bootstrap);
|
|
974
|
+
}
|
|
975
|
+
[data-icon-token='browserslist'] {
|
|
976
|
+
color: var(--trees-file-icon-color-browserslist);
|
|
977
|
+
}
|
|
978
|
+
[data-icon-token='bun'] {
|
|
979
|
+
color: var(--trees-file-icon-color-bun);
|
|
980
|
+
}
|
|
981
|
+
[data-icon-token='c'] {
|
|
982
|
+
color: var(--trees-file-icon-color-c);
|
|
983
|
+
}
|
|
984
|
+
[data-icon-token='cpp'] {
|
|
985
|
+
color: var(--trees-file-icon-color-cpp);
|
|
986
|
+
}
|
|
987
|
+
[data-icon-token='claude'] {
|
|
988
|
+
color: var(--trees-file-icon-color-claude);
|
|
989
|
+
}
|
|
990
|
+
[data-icon-token='css'] {
|
|
991
|
+
color: var(--trees-file-icon-color-css);
|
|
992
|
+
}
|
|
993
|
+
[data-icon-token='database'] {
|
|
994
|
+
color: var(--trees-file-icon-color-database);
|
|
995
|
+
}
|
|
996
|
+
[data-icon-token='default'] {
|
|
997
|
+
color: var(--trees-file-icon-color-default);
|
|
998
|
+
}
|
|
999
|
+
[data-icon-token='docker'] {
|
|
1000
|
+
color: var(--trees-file-icon-color-docker);
|
|
1001
|
+
}
|
|
1002
|
+
[data-icon-token='eslint'] {
|
|
1003
|
+
color: var(--trees-file-icon-color-eslint);
|
|
1004
|
+
}
|
|
1005
|
+
[data-icon-token='git'] {
|
|
1006
|
+
color: var(--trees-file-icon-color-git);
|
|
1007
|
+
}
|
|
1008
|
+
[data-icon-token='go'] {
|
|
1009
|
+
color: var(--trees-file-icon-color-go);
|
|
1010
|
+
}
|
|
1011
|
+
[data-icon-token='graphql'] {
|
|
1012
|
+
color: var(--trees-file-icon-color-graphql);
|
|
1013
|
+
}
|
|
1014
|
+
[data-icon-token='html'] {
|
|
1015
|
+
color: var(--trees-file-icon-color-html);
|
|
1016
|
+
}
|
|
1017
|
+
[data-icon-token='image'] {
|
|
1018
|
+
color: var(--trees-file-icon-color-image);
|
|
1019
|
+
}
|
|
1020
|
+
[data-icon-token='javascript'] {
|
|
1021
|
+
color: var(--trees-file-icon-color-javascript);
|
|
1022
|
+
}
|
|
1023
|
+
[data-icon-token='json'] {
|
|
1024
|
+
color: var(--trees-file-icon-color-json);
|
|
1025
|
+
}
|
|
1026
|
+
[data-icon-token='markdown'] {
|
|
1027
|
+
color: var(--trees-file-icon-color-markdown);
|
|
1028
|
+
}
|
|
1029
|
+
[data-icon-token='mcp'] {
|
|
1030
|
+
color: var(--trees-file-icon-color-mcp);
|
|
1031
|
+
}
|
|
1032
|
+
[data-icon-token='npm'] {
|
|
1033
|
+
color: var(--trees-file-icon-color-npm);
|
|
1034
|
+
}
|
|
1035
|
+
[data-icon-token='oxc'] {
|
|
1036
|
+
color: var(--trees-file-icon-color-oxc);
|
|
1037
|
+
}
|
|
1038
|
+
[data-icon-token='postcss'] {
|
|
1039
|
+
color: var(--trees-file-icon-color-postcss);
|
|
1040
|
+
}
|
|
1041
|
+
[data-icon-token='prettier'] {
|
|
1042
|
+
color: var(--trees-file-icon-color-prettier);
|
|
1043
|
+
}
|
|
1044
|
+
[data-icon-token='python'] {
|
|
1045
|
+
color: var(--trees-file-icon-color-python);
|
|
1046
|
+
}
|
|
1047
|
+
[data-icon-token='react'] {
|
|
1048
|
+
color: var(--trees-file-icon-color-react);
|
|
1049
|
+
}
|
|
1050
|
+
[data-icon-token='ruby'] {
|
|
1051
|
+
color: var(--trees-file-icon-color-ruby);
|
|
1052
|
+
}
|
|
1053
|
+
[data-icon-token='rust'] {
|
|
1054
|
+
color: var(--trees-file-icon-color-rust);
|
|
1055
|
+
}
|
|
1056
|
+
[data-icon-token='sass'] {
|
|
1057
|
+
color: var(--trees-file-icon-color-sass);
|
|
1058
|
+
}
|
|
1059
|
+
[data-icon-token='svg'] {
|
|
1060
|
+
color: var(--trees-file-icon-color-svg);
|
|
1061
|
+
}
|
|
1062
|
+
[data-icon-token='svelte'] {
|
|
1063
|
+
color: var(--trees-file-icon-color-svelte);
|
|
1064
|
+
}
|
|
1065
|
+
[data-icon-token='svgo'] {
|
|
1066
|
+
color: var(--trees-file-icon-color-svgo);
|
|
1067
|
+
}
|
|
1068
|
+
[data-icon-token='swift'] {
|
|
1069
|
+
color: var(--trees-file-icon-color-swift);
|
|
1070
|
+
}
|
|
1071
|
+
[data-icon-token='table'] {
|
|
1072
|
+
color: var(--trees-file-icon-color-table);
|
|
1073
|
+
}
|
|
1074
|
+
[data-icon-token='text'] {
|
|
1075
|
+
color: var(--trees-file-icon-color-text);
|
|
1076
|
+
}
|
|
1077
|
+
[data-icon-token='tailwind'] {
|
|
1078
|
+
color: var(--trees-file-icon-color-tailwind);
|
|
1079
|
+
}
|
|
1080
|
+
[data-icon-token='terraform'] {
|
|
1081
|
+
color: var(--trees-file-icon-color-terraform);
|
|
1082
|
+
}
|
|
1083
|
+
[data-icon-token='typescript'] {
|
|
1084
|
+
color: var(--trees-file-icon-color-typescript);
|
|
1085
|
+
}
|
|
1086
|
+
[data-icon-token='vite'] {
|
|
1087
|
+
color: var(--trees-file-icon-color-vite);
|
|
1088
|
+
}
|
|
1089
|
+
[data-icon-token='vscode'] {
|
|
1090
|
+
color: var(--trees-file-icon-color-vscode);
|
|
1091
|
+
}
|
|
1092
|
+
[data-icon-token='vue'] {
|
|
1093
|
+
color: var(--trees-file-icon-color-vue);
|
|
1094
|
+
}
|
|
1095
|
+
[data-icon-token='wasm'] {
|
|
1096
|
+
color: var(--trees-file-icon-color-wasm);
|
|
1097
|
+
}
|
|
1098
|
+
[data-icon-token='webpack'] {
|
|
1099
|
+
color: var(--trees-file-icon-color-webpack);
|
|
1100
|
+
}
|
|
1101
|
+
[data-icon-token='yml'] {
|
|
1102
|
+
color: var(--trees-file-icon-color-yml);
|
|
1103
|
+
}
|
|
1104
|
+
[data-icon-token='zig'] {
|
|
1105
|
+
color: var(--trees-file-icon-color-zig);
|
|
1106
|
+
}
|
|
1107
|
+
[data-icon-token='zip'] {
|
|
1108
|
+
color: var(--trees-file-icon-color-zip);
|
|
1109
|
+
}
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1112
|
+
/* Chevron rotation and visual alignment */
|
|
1113
|
+
/* Chevron pointing down */
|
|
1114
|
+
[data-icon-name='file-tree-icon-chevron'] {
|
|
1115
|
+
&[data-align-capitals='false'] {
|
|
1116
|
+
transform: translate(0, var(--trees-icon-nudge));
|
|
1117
|
+
}
|
|
1118
|
+
&[data-align-capitals='true'] {
|
|
1119
|
+
transform: translate(0, 0);
|
|
1120
|
+
}
|
|
1121
|
+
}
|
|
1122
|
+
|
|
1123
|
+
[data-item-section='content'] {
|
|
1124
|
+
flex: 0 1 auto;
|
|
1125
|
+
text-align: start;
|
|
1126
|
+
min-width: 0;
|
|
1127
|
+
max-width: 100%;
|
|
1128
|
+
overflow: hidden;
|
|
1129
|
+
text-overflow: ellipsis;
|
|
1130
|
+
/* Breaks middle truncate component to also set this */
|
|
1131
|
+
/* white-space: nowrap; */
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
[data-item-section='decoration'] {
|
|
1135
|
+
flex: 1 1 0;
|
|
1136
|
+
min-width: 0;
|
|
1137
|
+
display: flex;
|
|
1138
|
+
justify-content: flex-end;
|
|
1139
|
+
text-align: end;
|
|
1140
|
+
overflow: hidden;
|
|
1141
|
+
color: var(--trees-fg-muted);
|
|
1142
|
+
}
|
|
1143
|
+
|
|
1144
|
+
[data-item-section='decoration'] > span {
|
|
1145
|
+
min-width: 0;
|
|
1146
|
+
max-width: 100%;
|
|
1147
|
+
display: inline-flex;
|
|
1148
|
+
align-items: center;
|
|
1149
|
+
justify-content: flex-end;
|
|
1150
|
+
overflow: hidden;
|
|
1151
|
+
text-overflow: ellipsis;
|
|
1152
|
+
white-space: nowrap;
|
|
1153
|
+
}
|
|
1154
|
+
|
|
1155
|
+
[data-item-section='git'],
|
|
1156
|
+
[data-item-section='action'] {
|
|
1157
|
+
flex: 0 0 auto;
|
|
1158
|
+
display: flex;
|
|
1159
|
+
align-items: center;
|
|
1160
|
+
justify-content: center;
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1163
|
+
[data-item-section='git'] {
|
|
1164
|
+
width: var(--trees-git-lane-width);
|
|
1165
|
+
}
|
|
1166
|
+
|
|
1167
|
+
[data-item-section='action'] {
|
|
1168
|
+
width: var(--trees-action-lane-width);
|
|
1169
|
+
color: var(--trees-fg-muted);
|
|
1170
|
+
fill: currentColor;
|
|
1171
|
+
pointer-events: none;
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1174
|
+
[data-item-section='git'] > span,
|
|
1175
|
+
[data-item-section='action'] > span {
|
|
1176
|
+
width: 100%;
|
|
1177
|
+
display: inline-flex;
|
|
1178
|
+
align-items: center;
|
|
1179
|
+
justify-content: center;
|
|
1180
|
+
}
|
|
1181
|
+
|
|
1182
|
+
[data-item-action-affordance='decorative'] {
|
|
1183
|
+
opacity: 0.85;
|
|
1184
|
+
}
|
|
1185
|
+
|
|
1186
|
+
[data-item-rename-input] {
|
|
1187
|
+
appearance: none;
|
|
1188
|
+
width: 100%;
|
|
1189
|
+
min-width: 0;
|
|
1190
|
+
height: calc(var(--trees-row-height) - 4px);
|
|
1191
|
+
font-family: inherit;
|
|
1192
|
+
font-size: inherit;
|
|
1193
|
+
/* line-height: calc(var(--trees-row-height) - 8px); */
|
|
1194
|
+
color: inherit;
|
|
1195
|
+
background-color: transparent;
|
|
1196
|
+
border: 0;
|
|
1197
|
+
padding-inline: 6px;
|
|
1198
|
+
outline: none;
|
|
1199
|
+
box-sizing: border-box;
|
|
1200
|
+
}
|
|
1201
|
+
|
|
1202
|
+
[data-item-section='content']:has([data-item-rename-input])
|
|
1203
|
+
~ [data-item-section='action'],
|
|
1204
|
+
[data-item-section='content']:has([data-item-rename-input])
|
|
1205
|
+
~ [data-item-section='decoration'] {
|
|
1206
|
+
display: none;
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1209
|
+
/* Chevron pointing right */
|
|
1210
|
+
[aria-expanded='false'][data-item-type='folder']
|
|
1211
|
+
> [data-item-section='icon']
|
|
1212
|
+
> [data-icon-name='file-tree-icon-chevron'] {
|
|
1213
|
+
&[data-align-capitals='true'] {
|
|
1214
|
+
transform: rotate(-90deg)
|
|
1215
|
+
translate(
|
|
1216
|
+
calc(var(--trees-icon-nudge) / 2),
|
|
1217
|
+
calc(var(--trees-icon-nudge) / 2)
|
|
1218
|
+
);
|
|
1219
|
+
}
|
|
1220
|
+
&[data-align-capitals='false'] {
|
|
1221
|
+
transform: rotate(-90deg)
|
|
1222
|
+
translate(
|
|
1223
|
+
calc(var(--trees-icon-nudge) / 2 * -1),
|
|
1224
|
+
calc(var(--trees-icon-nudge) / 2)
|
|
1225
|
+
);
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
1228
|
+
|
|
1229
|
+
/* LIST IDENTATION */
|
|
1230
|
+
/* Spacing container */
|
|
1231
|
+
[data-item-section='spacing'] {
|
|
1232
|
+
display: flex;
|
|
1233
|
+
flex-direction: row;
|
|
1234
|
+
align-items: center;
|
|
1235
|
+
justify-content: center;
|
|
1236
|
+
height: var(--trees-row-height);
|
|
1237
|
+
padding-left: calc(calc(var(--trees-icon-width) / 2) - 0.5px);
|
|
1238
|
+
|
|
1239
|
+
&:empty {
|
|
1240
|
+
padding-left: 0;
|
|
1241
|
+
}
|
|
1242
|
+
}
|
|
1243
|
+
|
|
1244
|
+
/* Spacing per level */
|
|
1245
|
+
[data-item-section='spacing-item'] {
|
|
1246
|
+
transform: translateX(-0.25px);
|
|
1247
|
+
display: inline-block;
|
|
1248
|
+
border-left: 1px solid var(--trees-indent-guide-bg);
|
|
1249
|
+
height: 100%;
|
|
1250
|
+
margin-right: calc(var(--trees-level-gap) - 1px);
|
|
1251
|
+
opacity: 0;
|
|
1252
|
+
transition: opacity 150ms ease;
|
|
1253
|
+
|
|
1254
|
+
& + & {
|
|
1255
|
+
margin-left: calc(
|
|
1256
|
+
var(--trees-item-row-gap) + calc(var(--trees-icon-width) / 2) - 0.5px
|
|
1257
|
+
);
|
|
1258
|
+
}
|
|
1259
|
+
}
|
|
1260
|
+
|
|
1261
|
+
:host(:hover) [data-item-section='spacing-item'] {
|
|
1262
|
+
opacity: 0.75;
|
|
1263
|
+
}
|
|
1264
|
+
|
|
1265
|
+
/* Git status indicator */
|
|
1266
|
+
|
|
1267
|
+
/* This is a folder that contains a git change */
|
|
1268
|
+
[data-item-contains-git-change='true'] > [data-item-section='git'] {
|
|
1269
|
+
color: var(--trees-git-modified-color);
|
|
1270
|
+
opacity: 0.5;
|
|
1271
|
+
fill: currentColor;
|
|
1272
|
+
}
|
|
1273
|
+
|
|
1274
|
+
/* These are files that have a git change */
|
|
1275
|
+
[data-item-git-status] {
|
|
1276
|
+
&
|
|
1277
|
+
> :where([data-item-section='icon'])
|
|
1278
|
+
> :where(:not([data-icon-name='file-tree-icon-chevron'])) {
|
|
1279
|
+
color: var(--trees-item-git-status-color);
|
|
1280
|
+
}
|
|
1281
|
+
& > [data-item-section='content'] {
|
|
1282
|
+
color: var(--trees-item-git-status-color);
|
|
1283
|
+
}
|
|
1284
|
+
& > [data-item-section='git'] {
|
|
1285
|
+
color: var(--trees-item-git-status-color);
|
|
1286
|
+
font-weight: var(--trees-font-weight-semibold);
|
|
1287
|
+
}
|
|
1288
|
+
}
|
|
1289
|
+
|
|
1290
|
+
[data-item-git-status='added'] {
|
|
1291
|
+
--trees-item-git-status-color: var(--trees-git-added-color);
|
|
1292
|
+
}
|
|
1293
|
+
|
|
1294
|
+
[data-item-git-status='deleted'] {
|
|
1295
|
+
--trees-item-git-status-color: var(--trees-git-deleted-color);
|
|
1296
|
+
}
|
|
1297
|
+
|
|
1298
|
+
[data-item-git-status='ignored'] {
|
|
1299
|
+
--trees-item-git-status-color: var(--trees-git-ignored-color);
|
|
1300
|
+
|
|
1301
|
+
& > [data-item-section='icon'] {
|
|
1302
|
+
opacity: 0.5;
|
|
1303
|
+
}
|
|
1304
|
+
}
|
|
1305
|
+
|
|
1306
|
+
[data-item-section='git'] [data-icon-name='file-tree-icon-dot'] {
|
|
1307
|
+
/* this is a nudge to align the dot with the likely lowercase text. it's slightly
|
|
1308
|
+
generalizable, but other fonts are gonna need other nudges i assume */
|
|
1309
|
+
transform: translateY(calc(0.65ex - 50%));
|
|
1310
|
+
}
|
|
1311
|
+
|
|
1312
|
+
[data-item-git-status='modified'] {
|
|
1313
|
+
--trees-item-git-status-color: var(--trees-git-modified-color);
|
|
1314
|
+
}
|
|
1315
|
+
|
|
1316
|
+
[data-item-git-status='renamed'] {
|
|
1317
|
+
--trees-item-git-status-color: var(--trees-git-renamed-color);
|
|
1318
|
+
}
|
|
1319
|
+
|
|
1320
|
+
[data-item-git-status='untracked'] {
|
|
1321
|
+
--trees-item-git-status-color: var(--trees-git-untracked-color);
|
|
1322
|
+
}
|
|
1323
|
+
|
|
1324
|
+
/* Drag and drop */
|
|
1325
|
+
[data-item-drag-target='true'] {
|
|
1326
|
+
background-color: var(--trees-selected-bg);
|
|
1327
|
+
}
|
|
1328
|
+
|
|
1329
|
+
[data-item-dragging='true'] {
|
|
1330
|
+
opacity: 0.5;
|
|
1331
|
+
}
|
|
1332
|
+
|
|
1333
|
+
/* Lock icon for locked paths (sibling of content) */
|
|
1334
|
+
[data-item-section='lock'] {
|
|
1335
|
+
flex: 0 0 auto;
|
|
1336
|
+
margin-left: auto;
|
|
1337
|
+
display: flex;
|
|
1338
|
+
align-items: center;
|
|
1339
|
+
color: var(--trees-fg-muted);
|
|
1340
|
+
}
|
|
1341
|
+
[data-item-section='lock'] svg {
|
|
1342
|
+
display: block;
|
|
1343
|
+
}
|
|
1344
|
+
|
|
1345
|
+
[data-type='header-slot'] {
|
|
1346
|
+
display: block;
|
|
1347
|
+
flex: 0 0 auto;
|
|
1348
|
+
}
|
|
1349
|
+
|
|
1350
|
+
[data-type='context-menu-wash'] {
|
|
1351
|
+
position: absolute;
|
|
1352
|
+
inset: 0;
|
|
1353
|
+
z-index: 3;
|
|
1354
|
+
background-color: transparent;
|
|
1355
|
+
touch-action: none;
|
|
1356
|
+
}
|
|
1357
|
+
|
|
1358
|
+
[data-type='context-menu-anchor'] {
|
|
1359
|
+
position: absolute;
|
|
1360
|
+
top: 0;
|
|
1361
|
+
right: var(--trees-context-menu-trigger-inline-offset);
|
|
1362
|
+
z-index: 4;
|
|
1363
|
+
display: none;
|
|
1364
|
+
align-items: center;
|
|
1365
|
+
|
|
1366
|
+
&[data-visible='true'] {
|
|
1367
|
+
display: flex;
|
|
1368
|
+
}
|
|
1369
|
+
}
|
|
1370
|
+
|
|
1371
|
+
/* Hide the floating trigger while the scroll container is actively moving.
|
|
1372
|
+
* The anchor is positioned against the root, not the scroll content, so its
|
|
1373
|
+
* \`top\` follows the row via a React state update — one frame behind the
|
|
1374
|
+
* compositor. That delay is visible as the trigger hovering over the wrong
|
|
1375
|
+
* row during the first frame of a scroll. The \`data-is-scrolling\` flag on
|
|
1376
|
+
* the root is flipped synchronously on \`wheel\`/\`touchmove\`/\`keydown\` before
|
|
1377
|
+
* the compositor commits the next paint, so this selector hides the anchor
|
|
1378
|
+
* in the same frame the scroll begins. */
|
|
1379
|
+
[data-file-tree-virtualized-root='true'][data-is-scrolling]
|
|
1380
|
+
[data-type='context-menu-anchor'] {
|
|
1381
|
+
display: none;
|
|
1382
|
+
}
|
|
1383
|
+
|
|
1384
|
+
[data-type='context-menu-anchor'] > slot[name='context-menu'] {
|
|
1385
|
+
display: block;
|
|
1386
|
+
width: 0;
|
|
1387
|
+
min-width: 0;
|
|
1388
|
+
flex: 0 0 0;
|
|
1389
|
+
overflow: visible;
|
|
1390
|
+
}
|
|
1391
|
+
|
|
1392
|
+
/* Single floating context menu trigger */
|
|
1393
|
+
[data-type='context-menu-trigger'] {
|
|
1394
|
+
all: unset;
|
|
1395
|
+
align-items: center;
|
|
1396
|
+
justify-content: center;
|
|
1397
|
+
width: var(--trees-action-lane-width);
|
|
1398
|
+
color: var(--trees-fg-muted);
|
|
1399
|
+
fill: currentColor;
|
|
1400
|
+
cursor: pointer;
|
|
1401
|
+
font-family: var(--trees-font-family);
|
|
1402
|
+
font-size: var(--trees-font-size);
|
|
1403
|
+
border-top-right-radius: var(--trees-border-radius);
|
|
1404
|
+
border-bottom-right-radius: var(--trees-border-radius);
|
|
1405
|
+
margin: var(--trees-focus-ring-width);
|
|
1406
|
+
height: calc(var(--trees-row-height) - var(--trees-focus-ring-width) * 2);
|
|
1407
|
+
border-width: 0;
|
|
1408
|
+
transition: color 120ms ease;
|
|
1409
|
+
|
|
1410
|
+
display: flex;
|
|
1411
|
+
}
|
|
1412
|
+
|
|
1413
|
+
[data-type='context-menu-trigger']:hover,
|
|
1414
|
+
[data-type='context-menu-trigger'][aria-expanded='true'] {
|
|
1415
|
+
color: var(--trees-fg);
|
|
1416
|
+
}
|
|
1417
|
+
|
|
1418
|
+
/** @pierre/truncate css here, manually copy pasted for now */
|
|
1419
|
+
[data-truncate-container] {
|
|
1420
|
+
/* CUSTOM TO TREES, TO SUPPORT THE OUTLINE */
|
|
1421
|
+
margin-top: -1px;
|
|
1422
|
+
margin-bottom: -1px;
|
|
1423
|
+
|
|
1424
|
+
/* Width of the fade from default marker to text */
|
|
1425
|
+
--truncate-internal-marker-fade-width: var(
|
|
1426
|
+
--truncate-marker-fade-width,
|
|
1427
|
+
2px
|
|
1428
|
+
);
|
|
1429
|
+
/* Width of the solid color between the fade from the default marker to the text */
|
|
1430
|
+
--truncate-internal-marker-gap: var(--truncate-marker-gap, 0px);
|
|
1431
|
+
/* Opacity of the marker 'color' property, not of the element itself */
|
|
1432
|
+
--truncate-internal-marker-opacity: var(--truncate-marker-opacity, 50%);
|
|
1433
|
+
/* Opacity of the marker 'color' property specifically for the middle truncate, not opacity of the element itself */
|
|
1434
|
+
--truncate-internal-middle-marker-opacity: var(
|
|
1435
|
+
--truncate-middle-marker-opacity,
|
|
1436
|
+
80%
|
|
1437
|
+
);
|
|
1438
|
+
/* Background color of the default marker */
|
|
1439
|
+
--truncate-internal-marker-background-color: var(
|
|
1440
|
+
--truncate-marker-background-color,
|
|
1441
|
+
light-dark(white, black)
|
|
1442
|
+
);
|
|
1443
|
+
--truncate-internal-marker-background-overlay-color: var(
|
|
1444
|
+
--truncate-marker-background-overlay-color,
|
|
1445
|
+
transparent
|
|
1446
|
+
);
|
|
1447
|
+
--truncate-internal-marker-block-inset: var(
|
|
1448
|
+
--truncate-marker-block-inset,
|
|
1449
|
+
0px
|
|
1450
|
+
);
|
|
1451
|
+
/* Duration of the fade out animation for the marker */
|
|
1452
|
+
--truncate-internal-marker-fade-out-duration: var(
|
|
1453
|
+
--truncate-marker-fade-out-duration,
|
|
1454
|
+
0ms
|
|
1455
|
+
);
|
|
1456
|
+
/* Duration of the fade in animation for the marker */
|
|
1457
|
+
--truncate-internal-marker-fade-in-duration: var(
|
|
1458
|
+
--truncate-marker-fade-in-duration,
|
|
1459
|
+
100ms
|
|
1460
|
+
);
|
|
1461
|
+
|
|
1462
|
+
/* FADE Variant specifics */
|
|
1463
|
+
--truncate-internal-fade-marker-color: var(
|
|
1464
|
+
--truncate-fade-marker-color,
|
|
1465
|
+
#000
|
|
1466
|
+
);
|
|
1467
|
+
--truncate-internal-fade-marker-width: var(
|
|
1468
|
+
--truncate-fade-marker-width,
|
|
1469
|
+
0.2lh
|
|
1470
|
+
);
|
|
1471
|
+
|
|
1472
|
+
/*
|
|
1473
|
+
In some special cases people might be adding spacing in other ways
|
|
1474
|
+
that would benefit from being able to override this, however the container
|
|
1475
|
+
query below can't use this and would need to be redeclared with the overridden
|
|
1476
|
+
value. It's a bad time, but better than nothing.
|
|
1477
|
+
*/
|
|
1478
|
+
--truncate-internal-single-line-height: 1lh;
|
|
1479
|
+
|
|
1480
|
+
height: var(--truncate-internal-single-line-height);
|
|
1481
|
+
min-width: 0;
|
|
1482
|
+
overflow: hidden;
|
|
1483
|
+
}
|
|
1484
|
+
|
|
1485
|
+
[data-truncate-marker] {
|
|
1486
|
+
display: flex;
|
|
1487
|
+
position: absolute;
|
|
1488
|
+
height: var(--truncate-internal-single-line-height);
|
|
1489
|
+
padding-block: var(--truncate-internal-marker-block-inset);
|
|
1490
|
+
box-sizing: border-box;
|
|
1491
|
+
align-items: center;
|
|
1492
|
+
background-clip: content-box;
|
|
1493
|
+
z-index: 2;
|
|
1494
|
+
color: color-mix(
|
|
1495
|
+
in srgb,
|
|
1496
|
+
currentColor var(--truncate-internal-marker-opacity),
|
|
1497
|
+
transparent
|
|
1498
|
+
);
|
|
1499
|
+
|
|
1500
|
+
/* Core trick for hiding the marker until overflow occurs */
|
|
1501
|
+
opacity: 0;
|
|
1502
|
+
transition: opacity var(--truncate-internal-marker-fade-out-duration)
|
|
1503
|
+
ease-in-out;
|
|
1504
|
+
}
|
|
1505
|
+
|
|
1506
|
+
@container measure (height > 1lh) {
|
|
1507
|
+
[data-truncate-marker] {
|
|
1508
|
+
opacity: 1;
|
|
1509
|
+
transition: opacity var(--truncate-internal-marker-fade-in-duration)
|
|
1510
|
+
ease-in-out;
|
|
1511
|
+
}
|
|
1512
|
+
}
|
|
1513
|
+
|
|
1514
|
+
[data-truncate-grid] {
|
|
1515
|
+
display: grid;
|
|
1516
|
+
position: relative;
|
|
1517
|
+
}
|
|
1518
|
+
|
|
1519
|
+
[data-truncate-content='visible'] {
|
|
1520
|
+
white-space: nowrap;
|
|
1521
|
+
}
|
|
1522
|
+
|
|
1523
|
+
[data-truncate-content='overflow'] {
|
|
1524
|
+
opacity: 0;
|
|
1525
|
+
pointer-events: none;
|
|
1526
|
+
-webkit-user-select: none;
|
|
1527
|
+
user-select: none;
|
|
1528
|
+
word-break: break-all;
|
|
1529
|
+
margin-top: calc(-1 * var(--truncate-internal-single-line-height));
|
|
1530
|
+
}
|
|
1531
|
+
|
|
1532
|
+
[data-truncate-marker-cell] {
|
|
1533
|
+
container: measure / size;
|
|
1534
|
+
overflow: visible;
|
|
1535
|
+
-webkit-user-select: none;
|
|
1536
|
+
user-select: none;
|
|
1537
|
+
pointer-events: none;
|
|
1538
|
+
}
|
|
1539
|
+
|
|
1540
|
+
[data-truncate-container='truncate'] {
|
|
1541
|
+
& [data-truncate-grid] {
|
|
1542
|
+
grid-template-columns: minmax(0, max-content) 0;
|
|
1543
|
+
}
|
|
1544
|
+
& [data-truncate-marker] {
|
|
1545
|
+
right: 0;
|
|
1546
|
+
}
|
|
1547
|
+
& [data-truncate-fade] {
|
|
1548
|
+
margin-right: calc(-2 * var(--truncate-internal-fade-marker-width));
|
|
1549
|
+
}
|
|
1550
|
+
}
|
|
1551
|
+
|
|
1552
|
+
[data-truncate-container='fruncate'] {
|
|
1553
|
+
& [data-truncate-grid] {
|
|
1554
|
+
grid-template-columns: 0 minmax(0, max-content) auto;
|
|
1555
|
+
}
|
|
1556
|
+
& [data-truncate-content] {
|
|
1557
|
+
direction: rtl;
|
|
1558
|
+
}
|
|
1559
|
+
& [data-truncate-content] > span {
|
|
1560
|
+
unicode-bidi: plaintext;
|
|
1561
|
+
}
|
|
1562
|
+
& [data-truncate-fade] {
|
|
1563
|
+
margin-left: calc(-2 * var(--truncate-internal-fade-marker-width));
|
|
1564
|
+
}
|
|
1565
|
+
}
|
|
1566
|
+
|
|
1567
|
+
[data-truncate-variant='default'] {
|
|
1568
|
+
& [data-truncate-marker] {
|
|
1569
|
+
background-color: var(--truncate-internal-marker-background-color);
|
|
1570
|
+
background-image: linear-gradient(
|
|
1571
|
+
var(--truncate-internal-marker-background-overlay-color),
|
|
1572
|
+
var(--truncate-internal-marker-background-overlay-color)
|
|
1573
|
+
);
|
|
1574
|
+
}
|
|
1575
|
+
& [data-truncate-marker]::after,
|
|
1576
|
+
& [data-truncate-marker]::before {
|
|
1577
|
+
content: '';
|
|
1578
|
+
position: absolute;
|
|
1579
|
+
width: calc(
|
|
1580
|
+
var(--truncate-internal-marker-fade-width) +
|
|
1581
|
+
var(--truncate-internal-marker-gap)
|
|
1582
|
+
);
|
|
1583
|
+
inset-block-start: var(--truncate-internal-marker-block-inset);
|
|
1584
|
+
height: max(
|
|
1585
|
+
0px,
|
|
1586
|
+
calc(
|
|
1587
|
+
var(--truncate-internal-single-line-height) -
|
|
1588
|
+
var(--truncate-internal-marker-block-inset) * 2
|
|
1589
|
+
)
|
|
1590
|
+
);
|
|
1591
|
+
background-color: var(--truncate-internal-marker-background-color);
|
|
1592
|
+
background-image: linear-gradient(
|
|
1593
|
+
var(--truncate-internal-marker-background-overlay-color),
|
|
1594
|
+
var(--truncate-internal-marker-background-overlay-color)
|
|
1595
|
+
);
|
|
1596
|
+
mask-image: linear-gradient(
|
|
1597
|
+
var(--truncate-internal-fade-dir),
|
|
1598
|
+
#000 0%,
|
|
1599
|
+
#000 var(--truncate-internal-marker-gap),
|
|
1600
|
+
transparent 100%
|
|
1601
|
+
);
|
|
1602
|
+
}
|
|
1603
|
+
& [data-truncate-marker]::after {
|
|
1604
|
+
--truncate-internal-fade-dir: to right;
|
|
1605
|
+
right: calc(
|
|
1606
|
+
-1 *
|
|
1607
|
+
(
|
|
1608
|
+
var(--truncate-internal-marker-fade-width) +
|
|
1609
|
+
var(--truncate-internal-marker-gap)
|
|
1610
|
+
)
|
|
1611
|
+
);
|
|
1612
|
+
}
|
|
1613
|
+
& [data-truncate-marker]::before {
|
|
1614
|
+
--truncate-internal-fade-dir: to left;
|
|
1615
|
+
left: calc(
|
|
1616
|
+
-1 *
|
|
1617
|
+
(
|
|
1618
|
+
var(--truncate-internal-marker-fade-width) +
|
|
1619
|
+
var(--truncate-internal-marker-gap)
|
|
1620
|
+
)
|
|
1621
|
+
);
|
|
1622
|
+
}
|
|
1623
|
+
}
|
|
1624
|
+
|
|
1625
|
+
[data-truncate-variant='fade'] {
|
|
1626
|
+
& [data-truncate-marker] {
|
|
1627
|
+
background: transparent;
|
|
1628
|
+
}
|
|
1629
|
+
}
|
|
1630
|
+
|
|
1631
|
+
[data-truncate-fade] {
|
|
1632
|
+
box-shadow:
|
|
1633
|
+
0 0 calc(var(--truncate-internal-fade-marker-width) / 2)
|
|
1634
|
+
var(--truncate-internal-fade-marker-color),
|
|
1635
|
+
0 0 var(--truncate-internal-fade-marker-width)
|
|
1636
|
+
var(--truncate-internal-fade-marker-color);
|
|
1637
|
+
width: calc(var(--truncate-internal-fade-marker-width) * 2);
|
|
1638
|
+
height: calc(
|
|
1639
|
+
var(--truncate-internal-single-line-height) -
|
|
1640
|
+
(var(--truncate-internal-fade-marker-width) * 2)
|
|
1641
|
+
);
|
|
1642
|
+
margin: var(--truncate-internal-fade-marker-width) 0;
|
|
1643
|
+
}
|
|
1644
|
+
|
|
1645
|
+
[data-truncate-group-container='middle'] {
|
|
1646
|
+
& [data-truncate-container] {
|
|
1647
|
+
--truncate-marker-opacity: var(--truncate-internal-middle-marker-opacity);
|
|
1648
|
+
}
|
|
1649
|
+
|
|
1650
|
+
display: flex;
|
|
1651
|
+
min-width: 0;
|
|
1652
|
+
|
|
1653
|
+
& > div {
|
|
1654
|
+
min-width: 0;
|
|
1655
|
+
}
|
|
1656
|
+
|
|
1657
|
+
& > div[data-truncate-segment-priority='1'] {
|
|
1658
|
+
flex: 0 1 max-content;
|
|
1659
|
+
}
|
|
1660
|
+
& > div[data-truncate-segment-priority='2'] {
|
|
1661
|
+
flex: 0 999999 max-content;
|
|
1662
|
+
}
|
|
1663
|
+
}
|
|
1664
|
+
}
|
|
1665
|
+
`,Zi=`@layer base, unsafe;`;function Qi(e){return`${Zi}
|
|
1666
|
+
@layer base {
|
|
1667
|
+
${e}
|
|
1668
|
+
}`}function $i(e){return`${Zi}
|
|
1669
|
+
@layer unsafe {
|
|
1670
|
+
${e}
|
|
1671
|
+
}`}var ea=new WeakMap;function ta(e){let t=ea.get(e);if(t!=null)return t;let n=document.createElement(`div`);n.setAttribute(dt,`true`);let r=document.createElement(`div`);r.style.position=`relative`,r.style.height=`200%`,n.appendChild(r),e.appendChild(n);let i=Math.max(n.offsetWidth-n.clientWidth,0);return n.remove(),ea.set(e,i),i}function na(e,t){if(!e.isConnected)return;let n=ta(t);if(n==null)return;let r=t.querySelector(`style[${ft}]`),i=r instanceof HTMLStyleElement?r:document.createElement(`style`);r instanceof HTMLStyleElement||(i.setAttribute(ft,``),t.appendChild(i)),i.textContent=`:host { ${pt}: ${n}px; }`}var ra;function ia(e){if(typeof CSSStyleSheet<`u`&&typeof CSSStyleSheet.prototype.replaceSync==`function`&&`adoptedStyleSheets`in e){ra??(ra=new CSSStyleSheet,ra.replaceSync(Qi(Xi)));let t=!1;try{e.adoptedStyleSheets=[ra],t=!0}catch{}if(t){e.querySelector(`style[${lt}]`)?.remove();return}}if(e.querySelector(`style[data-file-tree-style]`)==null){let t=document.createElement(`style`);t.setAttribute(lt,``),t.textContent=Qi(Xi),e.prepend(t)}}function aa(e,t){oa(e,t),ia(t),na(e,t)}function oa(e,t){let n=e.querySelector(`template[shadowrootmode="open"], template[data-file-tree-shadowrootmode="open"]`);n instanceof HTMLTemplateElement&&(t.childNodes.length>0||(t.appendChild(n.content.cloneNode(!0)),n.hasAttribute(`shadowrootmode`)&&n.remove()))}if(typeof HTMLElement<`u`&&customElements.get(`file-tree-container`)==null){class e extends HTMLElement{constructor(){super()}connectedCallback(){let e=this.shadowRoot??this.attachShadow({mode:`open`});aa(this,e)}}if(customElements.define(ct,e),typeof document<`u`)for(let e of Array.from(document.querySelectorAll(ct)))e instanceof HTMLElement&&aa(e,e.shadowRoot??e.attachShadow({mode:`open`}))}var sa=e=>e.startsWith(`f::`)?e.slice(3):e;function ca(e){let t=e.lastIndexOf(`/`);return t<0?{parentPath:``,baseName:e}:{parentPath:e.slice(0,t),baseName:e.slice(t+1)}}function la(e,t){return e===``?t:`${e}/${t}`}function ua({files:e,path:t,isFolder:n,nextBasename:r}){let i=sa(t),a=r.trim();if(a.length===0)return{error:`Name cannot be empty.`};if(a.includes(`/`))return{error:`Name cannot include "/".`};let{parentPath:o,baseName:s}=ca(i);if(a===s)return{nextFiles:e,sourcePath:i,destinationPath:i,isFolder:n};let c=la(o,a),l=Array(e.length),u=new Set;if(!n){let t=`${c}/`,r=!1;for(let n=0;n<e.length;n++){let a=e[n];if(a!==i&&a.startsWith(t))return{error:`"${c}" already exists.`};let o=a===i?c:a;if(u.has(o))return{error:`"${c}" already exists.`};u.add(o),l[n]=o,a===i&&(r=!0)}return r?{nextFiles:l,sourcePath:i,destinationPath:c,isFolder:n}:{error:`Could not find the selected file to rename.`}}let d=`${i}/`,f=`${c}/`,p=0;for(let t=0;t<e.length;t++){let n=e[t],r=n===i||n.startsWith(d);if(!r&&(n===c||n.startsWith(f)))return{error:`"${c}" already exists.`};let a=r?`${c}${n.slice(i.length)}`:n;if(u.has(a))return{error:`"${c}" already exists.`};u.add(a),l[t]=a,r&&p++}return p===0?{error:`Could not find the selected folder to rename.`}:{nextFiles:l,sourcePath:i,destinationPath:c,isFolder:n}}function da(e){return e.endsWith(`/`)}function fa(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`),r=n<0?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function pa(e){let t=[],n=new Set;for(let r of e)n.has(r)||(n.add(r),t.push(r));let r=new Set;for(let e of t.toSorted((e,t)=>e.length===t.length?e.localeCompare(t):e.length-t.length)){let t=(e.endsWith(`/`)?e.slice(0,-1):e).split(`/`),n=!1;for(let e=0;e<t.length-1;e+=1){let i=`${t.slice(0,e+1).join(`/`)}/`;if(r.has(i)){n=!0;break}}n||r.add(e)}return t.filter(e=>r.has(e))}function ma(e,t){return t.includes(e)?pa(t):[e]}function ha(e,t){return e===t?!0:e==null||t==null?!1:e.kind===t.kind&&e.directoryPath===t.directoryPath&&e.flattenedSegmentPath===t.flattenedSegmentPath&&e.hoveredPath===t.hoveredPath}function ga(e,t){return{draggedPaths:e,target:t}}function _a(e,t){if(t.kind!==`directory`||t.directoryPath==null)return!1;for(let n of e)if(da(n)&&(t.directoryPath===n||t.directoryPath.startsWith(n)))return!0;return!1}function va(e,t){return t.kind===`root`||t.directoryPath==null?fa(e):t.directoryPath}function ya(e,t){let n=e.map(e=>{let n=va(e,t);return n===e?null:{from:e,to:n,type:`move`}}).filter(e=>e!=null);return n.length===0?null:{operations:n,result:{draggedPaths:e,operation:n.length===1?`move`:`batch`,target:t}}}function ba(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function xa(e,t,n){let{paths:r,preparedInput:i}=e;if(i==null){if(r==null)throw Error(`FileTree requires paths or preparedInput`);return{paths:r,preparedInput:void 0}}let a=i.paths;if(r==null)return{paths:a,preparedInput:i};if(!ba(Gi.preparePaths(r,n==null?{}:{sort:n}),a))throw Error(`FileTree ${t} received paths and preparedInput for different path lists`);return{paths:a,preparedInput:i}}function Sa(e){return e.operation===`add`||e.operation===`remove`||e.operation===`move`||e.operation===`batch`}function Ca(e,t,n){if(e===t)return n;let r=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(r)?`${n.endsWith(`/`)?n:`${n}/`}${e.slice(r.length)}`:e}function wa(e,t){if(e===t)return!0;let n=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(n)}function Ta(e,t,n=!1){if(e==null)return null;switch(t.operation){case`add`:case`expand`:case`collapse`:case`mark-directory-unloaded`:case`begin-child-load`:case`apply-child-patch`:case`complete-child-load`:case`fail-child-load`:case`cleanup`:return e;case`remove`:return wa(e,t.path)?n?e:null:e;case`move`:return Ca(e,t.from,t.to);case`batch`:{let r=e;for(let e of t.events)if(r=Ta(r,e,n),r==null)return null;return r}}}function Ea(e){return{canonicalChanged:e.canonicalChanged,projectionChanged:e.projectionChanged,visibleCountDelta:e.visibleCountDelta}}function Da(e){switch(e.operation){case`add`:return{...Ea(e),operation:`add`,path:e.path};case`remove`:return{...Ea(e),operation:`remove`,path:e.path,recursive:e.recursive};case`move`:return{...Ea(e),from:e.from,operation:`move`,to:e.to}}}function Oa(e){return{...Ea(e),events:e.events.filter(e=>e.operation===`add`||e.operation===`remove`||e.operation===`move`).map(e=>Da(e)),operation:`batch`}}function ka(e){switch(e.operation){case`add`:case`remove`:case`move`:return Da(e);case`batch`:return Oa(e);default:return null}}function Aa(e,t){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}function ja(e){let t=e.endsWith(`/`)?e.slice(0,-1):e;if(t.length===0)return[];let n=t.split(`/`);return n.slice(0,-1).map((e,t)=>`${n.slice(0,t+1).join(`/`)}/`)}function Ma(e){return ja(e).at(-1)??null}function Na(e,t){return t==null?e:e.startsWith(t)?e.slice(t.length):e}function Pa(e){return e.endsWith(`/`)}var Fa=e=>e.toLowerCase();function Ia(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`);return n<0?t:t.slice(n+1)}function La(e){return e.endsWith(`/`)?e.slice(0,-1):e}function Ra(e,t){return t&&!e.endsWith(`/`)?`${e}/`:e}var za=e=>{let t=e.trim();return t.length===0?``:(t.includes(`\\`)?t.replaceAll(`\\`,`/`):t).toLowerCase()},Ba=Symbol(`FILE_TREE_RENAME_VIEW`),Va=512,Ha=512;function Ua(e){return e===`top`||e===`center`?e:`nearest`}function Wa(e,t,n){if(e===0)return-1;if(n!=null){let e=t(n);if(e!=null)return e;let r=ja(n);for(let e=r.length-1;e>=0;--e){let n=r[e];if(n==null)continue;let i=t(n);if(i!=null)return i}}return 0}function Ga(e,t,n){if(e.paths.length===0)return{focusedIndex:-1,getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex};if(t==null)return{focusedIndex:0,getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex};let r=n??(t=>e.visibleIndexByPath.get(t)??null);return{focusedIndex:Wa(e.paths.length,r,t),getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex}}var Ka=class{#e;#t=new Set;#n=new Map;#r=null;#i=null;#a=new Map;#o=new Map;#s=-1;#c=null;#l=!1;#u=e=>-1;#d=new Map;#f=null;#p=null;#m=null;#h=null;#g=null;#_;#v;#y;#b=[];#x=new Int32Array;#S=new Int32Array;#C=void 0;#w=!1;#T=null;#E=``;#D=!1;#O=new Set;#k=[];#A;#j=null;#M=null;#N=null;#P=null;#F=null;#I=null;#L=null;#R=0;#z=null;#B=new Set;#V=0;#H;#U=0;#W=!1;#G=0;#K;constructor(e){let{dragAndDrop:t,fileTreeSearchMode:n,initialSearchQuery:r,initialSelectedPaths:i,renaming:a,onSearchChange:o,paths:s,preparedInput:c,...l}=e,u=xa({paths:s,preparedInput:c},`constructor`,l.sort);this.#e=l,t!=null&&t!==!1&&(this.#r=t===!0?{}:t),this.#w=a!=null&&a!==!1,a!=null&&a!==!1&&a!==!0&&(this.#C=a.canRename,this.#v=a.onError,this.#_=a.onRename),this.#y=o,this.#A=n??`hide-non-matches`,this.#H=this.#le(u.paths,u.preparedInput);let d=i?.map(e=>this.#Ne(e)).filter(e=>e!=null)??[],f=d.at(-1)??null;d.length>0&&(this.#B=new Set(d),this.#z=f,this.#V=1),this.#je(f,!1),r!=null&&this.#Te(r,!1),this.#K=this.#Re()}destroy(){this.#K?.(),this.#K=null,this.#n.clear(),this.#t.clear(),this.#d.clear(),this.#i=null,this.#he()}focusFirstItem(){this.#be().length>0&&this.#Fe(0)}focusLastItem(){this.#G<=0||(this.#Ie(),this.#Fe(this.#G-1))}focusNextItem(){this.#Ae(1)}focusParentItem(){if(this.#c==null)return;let e=Ma(this.#c);if(e==null)return;let t=this.#Z(e);t>=0&&this.#Fe(t)}focusPath(e){let t=this.#H.getPathInfo(e)?.path??null;if(t==null)return;this.#Ie();let n=this.#Z(t);n>=0&&this.#Fe(n)}scrollToPath(e,t){let n=this.#H.getPathInfo(e)?.path??null;if(n==null)return;this.#Ie();let r=this.#xe(n);r<0||this.#Me(r)!=null&&(t?.focus!==!1&&this.#Fe(r,!1),this.#L={id:this.#R+=1,offset:Ua(t?.offset),visibleIndex:r},this.#De())}focusMountedPathFromInput(e){let t=this.#H.getPathInfo(e)?.path??null;if(t==null)return;let n=this.#Z(t);n>=0&&this.#Fe(n)}focusNearestPath(e){let t=this.resolveNearestVisiblePath(e);if(t==null)return null;let n=this.#Z(t);return n>=0?(this.#Fe(n),this.#be()[n]??t):null}focusPreviousItem(){this.#Ae(-1)}getFocusedIndex(){return this.#s}getFocusedItem(){return this.#c==null?null:this.#Q(this.#c)}getFocusedPath(){return this.#c}getScrollRequest(){return this.#L}clearScrollRequest(e){this.#L?.id===e&&(this.#L=null)}resolveNearestVisiblePath(e){let t=this.#be();if(this.#G===0)return null;if(e==null)return this.#c??t[0]??null;let n=this.#H.getPathInfo(e)?.path??e,r=this.#Z(n);return r>=0?t[r]??n:this.#X(n)??this.#c??t[0]??null}getSelectedPaths(){return[...this.#B]}getSelectionVersion(){return this.#V}getVisibleCount(){return this.#G}getVisibleRows(e,t){if(t<e||this.#G===0)return[];let n=Math.max(0,e),r=Math.min(this.#G-1,t);if(r<n)return[];let i=r-n+1;if(this.#F==null&&!this.#l&&r>=this.#b.length&&i<=Ha){let e=[];for(let t=n;t<=r;t+=1){let n=this.#H.getVisibleRowContext(t);if(n==null)break;e.push(this.#ee(n))}return e}if(!this.#l&&r>=this.#b.length&&this.#Ie(),this.#F!=null){let e=Array.from({length:r-n+1},(e,t)=>this.#Se(n+t)),t=new Map,i=e[0]??-1,a=i;for(let n=1;n<=e.length;n+=1){let r=e[n];if(r!=null&&r===a+1){a=r;continue}if(i>=0&&this.#H.getVisibleSlice(i,a).forEach((e,n)=>{t.set(i+n,e)}),r==null){i=-1,a=-1;continue}i=r,a=r}return Array.from({length:r-n+1},(e,r)=>{let i=n+r,a=this.#Se(i),o=t.get(a),s=this.#b[a];if(o==null||s==null)throw Error(`Missing projection row for filtered visible index ${String(i)}`);return this.#$(o,i,a,{ancestorPaths:this.#re(a),path:s})})}return this.#H.getVisibleSlice(n,r).map((e,t)=>{let r=n+t,i=this.#b[r];if(i==null)throw Error(`Missing projection path for visible index ${String(r)}`);return this.#$(e,r,r,{ancestorPaths:this.#re(r),path:i})})}getStickyRowCandidates(e,t){if(this.#F!=null)return null;if(this.#G===0||e<=0||t<=0)return[];let n=[];for(let r=0;r<this.#G;r+=1){let i=e+r*t,a=Math.min(this.#G-1,Math.floor(i/t)),o=this.#te(a,r)??(a>0?this.#te(a-1,r):void 0);if(o==null)break;n.push({row:this.#ee(o),subtreeEndIndex:o.subtreeEndIndex})}return n}getItem(e){let t=this.#H.getPathInfo(e);return t==null?null:this.#Q(t.path,t)}resolveMountedDirectoryPathFromInput(e){let t=this.#H.getPathInfo(e);return t?.kind===`directory`?t.path:null}toggleMountedDirectoryFromInput(e){let t=this.resolveMountedDirectoryPathFromInput(e);t!=null&&this.#ze(t)}selectAllVisiblePaths(){this.#Ie();let e=[...this.#be()];this.#ae(e,this.#c??this.#z)}selectOnlyPath(e){let t=this.#Ne(e);t!=null&&this.#ae([t],t)}selectOnlyMountedPathFromInput(e){this.#ae([e],e)}selectPath(e){let t=this.#Ne(e);t==null||this.#B.has(t)||this.#ae([...this.#B,t])}deselectPath(e){let t=this.#Ne(e);t==null||!this.#B.has(t)||this.#ae([...this.#B].filter(e=>e!==t))}toggleFocusedSelection(){this.#c!=null&&this.togglePathSelectionFromInput(this.#c)}togglePathSelection(e){let t=this.#Ne(e);if(t!=null){if(this.#B.has(t)){this.deselectPath(t);return}this.selectPath(t)}}togglePathSelectionFromInput(e){let t=this.#Ne(e);if(t!=null){if(this.#B.has(t)){this.#ae([...this.#B].filter(e=>e!==t),t);return}this.#ae([...this.#B,t],t)}}selectPathRange(e,t){let n=this.#Ne(e);if(n==null)return;this.#Ie();let r=this.#z,i=r==null?-1:this.#Ce(r),a=this.#Ce(n);if(i===-1||a===-1){let e=t?[...this.#B,n]:[n];this.#ae(e,n);return}let[o,s]=i<=a?[i,a]:[a,i],c=this.#be().slice(o,s+1),l=t?[...this.#B,...c]:c;this.#ae(l,r)}extendSelectionFromFocused(e){if(this.#c==null)return;let t=this.#s;if(t===-1)return;let n=Math.min(this.#G-1,Math.max(0,t+e));if(n===t)return;!this.#l&&n>=this.#b.length&&this.#Ie();let r=this.#be(),i=r[t]??null,a=r[n]??null;if(i==null||a==null)return;let o=new Set(this.#B);o.has(i)&&o.has(a)?o.delete(i):o.add(a),this.#ae([...o],this.#z??i,!1),this.#Fe(n)}getDragAndDropConfig(){return this.#r}isDragAndDropEnabled(){return this.#r!=null}getDragSession(){return this.#i==null?null:{draggedPaths:[...this.#i.draggedPaths],primaryPath:this.#i.primaryPath,target:this.#i.target==null?null:{...this.#i.target}}}startDrag(e){if(this.#r==null)return!1;let t=this.#Ne(e);if(t==null||this.#M!=null&&this.#M.length>0)return!1;let n=this.getSelectedPaths(),r=ma(t,n);return this.#r.canDrag?.(r)===!1?!1:(n.includes(t)||this.#ae([t],t,!1),this.#Pe(t),this.#i={draggedPaths:r,primaryPath:t,target:null},this.#De(),!0)}setDragTarget(e){let t=this.#i;if(t==null)return;let n=e;if(n!=null){let e=ga(t.draggedPaths,n);(_a(t.draggedPaths,n)||this.#r?.canDrop?.(e)===!1)&&(n=null)}ha(t.target,n)||(this.#i={...t,target:n},this.#De())}cancelDrag(){this.#i!=null&&(this.#i=null,this.#De())}completeDrag(){let e=this.#i;if(e==null)return!1;this.#i=null;let t=e.target==null?null:{...e.target};if(t==null)return this.#De(),!1;let n=ga(e.draggedPaths,t);if(_a(e.draggedPaths,t)||this.#r?.canDrop?.(n)===!1)return this.#De(),!1;let r=ya(e.draggedPaths,t);if(r==null)return this.#De(),!1;try{if(r.operations.length===1){let e=r.operations[0];if(e==null||e.type!==`move`)throw Error(`Expected a single move operation for one-item drops`);this.#H.move(e.from,e.to,{collision:e.collision})}else this.#ce(r.operations),this.#H.batch(r.operations)}catch(e){return this.#De(),this.#r?.onDropError?.(e instanceof Error?e.message:String(e),n),!1}return this.#r?.onDropComplete?.(r.result),!0}subscribe(e){return this.#t.add(e),e(),()=>{this.#t.delete(e)}}add(e){this.#H.add(e)}remove(e,t={}){this.#H.remove(e,t)}move(e,t,n={}){this.#H.move(e,t,n)}batch(e){this.#H.batch(e)}onMutation(e,t){let n=e,r=t,i=this.#n.get(n);return i??(i=new Set,this.#n.set(n,i)),i.add(r),()=>{let e=this.#n.get(n);e?.delete(r),e?.size===0&&this.#n.delete(n)}}setSearch(e){this.#Te(e,!0)}openSearch(e=``){this.#Te(e,!0)}closeSearch(){this.#Te(null,!0)}isSearchOpen(){return this.#M!==null}getSearchValue(){return this.#M??``}getSearchMatchingPaths(){return this.#k}focusNextSearchMatch(){this.#we(1)}focusPreviousSearchMatch(){this.#we(-1)}startRenaming(e=this.#c??``,t={}){if(!this.#w)return!1;let n=this.#H.getPathInfo(e);if(n==null)return!1;let r=n.path,i=Pa(r),a=La(r);if(this.#C?.({isFolder:i,path:a})===!1)return!1;for(let e of ja(r))this.#H.isExpanded(e)||this.#H.expand(e);return this.#ae([r],r,!1),this.#M!=null&&(this.#Te(null,!1),this.#y?.(this.#M)),this.#Pe(r),this.#T=r,this.#E=Ia(r),this.#D=t.removeIfCanceled??!1,this.#De(),!0}[Ba](){return{cancel:()=>{this.#q()},commit:()=>{this.#J()},getPath:()=>this.#T,getValue:()=>this.#E,isActive:()=>this.#T!=null,setValue:e=>{this.#Y(e)}}}#q(){if(this.#T==null)return;let e=this.#T,t=this.#D;if(this.#T=null,this.#E=``,this.#D=!1,t){this.remove(e,Pa(e)?{recursive:!0}:void 0);return}this.#Pe(e),this.#De()}#J(){let e=this.#T;if(e==null)return;if(this.#D&&this.#E.trim().length===0){this.#T=null,this.#E=``,this.#D=!1,this.remove(e,Pa(e)?{recursive:!0}:void 0);return}let t=Pa(e),n=ua({files:this.#H.list(),isFolder:t,nextBasename:this.#E,path:La(e)});if(this.#T=null,this.#E=``,this.#D=!1,`error`in n){this.#Pe(e),this.#v?.(n.error),this.#De();return}if(n.sourcePath===n.destinationPath){this.#Pe(e),this.#De();return}this.#_?.({destinationPath:n.destinationPath,isFolder:n.isFolder,sourcePath:n.sourcePath}),this.move(Ra(n.sourcePath,t),Ra(n.destinationPath,t))}#Y(e){this.#T==null||this.#E===e||(this.#E=e,this.#De())}resetPaths(e,t={}){let n=this.#H.list().length,r=this.#G,i=xa({paths:e,preparedInput:t.preparedInput},`resetPaths`,this.#e.sort),a=this.#le(i.paths,i.preparedInput,t.initialExpandedPaths),o=this.#c,s=this.#T,c=this.getSelectedPaths(),l=this.#z;this.#K?.(),this.#H=a,this.#d.clear(),this.#he();let u=c.map(e=>a.getPathInfo(e)?.path??null).filter(e=>e!=null),d=!Aa(this.#B,u);this.#B=new Set(u),d&&(this.#V+=1),this.#z=l==null?null:a.getPathInfo(l)?.path??null,this.#T=s==null?null:a.getPathInfo(s)?.path??null,this.#T??(this.#E=``,this.#D=!1),this.#je(o,o!=null||u.length>0||this.#z!=null),this.#K=this.#Re(),this.#De(),this.#Oe({canonicalChanged:!0,operation:`reset`,pathCountAfter:i.paths.length,pathCountBefore:n,projectionChanged:!0,usedPreparedInput:t.preparedInput!=null,visibleCountDelta:this.#G-r})}#X(e){this.#Ie();let t=Ma(e),n=Na(e,t),r=null,i=null;for(let e of this.#be()){if(Ma(e)!==t)continue;let a=Na(e,t);if(a<n){r=e;continue}if(a>n){i=e;break}}return r??i}#Z(e){let t=this.#Ce(e);if(t!==-1)return t;let n=ja(e);for(let e=n.length-1;e>=0;--e){let t=n[e];if(t==null)continue;let r=this.#Ce(t);if(r!==-1)return r}return this.#be().length>0?0:-1}#Q(e,t){let n=this.#d.get(e);if(n!=null)return n;let r=t??this.#H.getPathInfo(e);if(r==null)return null;let i=r.kind===`directory`?this.#oe(r.path):this.#se(r.path);return this.#d.set(r.path,i),i}#$(e,t,n,r){return{ancestorPaths:r.ancestorPaths,depth:e.depth,flattenedSegments:e.flattenedSegments?.map(e=>({isTerminal:e.isTerminal,name:e.name,path:e.path})),hasChildren:e.hasChildren,index:t,isExpanded:e.isExpanded,isFlattened:e.isFlattened,isFocused:r.path===this.#c,isSelected:this.#B.has(r.path),kind:e.kind,level:e.depth,name:e.name,path:r.path,posInSet:r.posInSet??this.#x[n]??0,setSize:r.setSize??this.#S[n]??0}}#ee(e){return this.#$(e.row,e.index,e.index,{ancestorPaths:e.ancestorPaths,path:e.row.path,posInSet:e.posInSet,setSize:e.setSize})}#te(e,t){let n=this.#H.getVisibleRowContext(e);return n==null?void 0:n.ancestorRows[t]??(t===n.ancestorRows.length&&n.row.kind===`directory`&&n.row.isExpanded?n:void 0)}#ne(e){let t=this.#a.get(e);if(t!=null)return t;let n=this.#u(e),r=n<0?[]:[...this.#ne(n),n];return this.#a.set(e,r),r}#re(e){let t=this.#o.get(e);if(t!=null)return t;let n=this.#ne(e).map(e=>this.#b[e]??``).filter(e=>e!==``);return this.#o.set(e,n),n}#ie(e){this.#H.collapse(e)}#ae(e,t=this.#z,n=!0){let r=[...new Set(e)],i=!Aa(this.#B,r),a=this.#z!==t;!i&&!a||(this.#B=new Set(r),this.#z=t,i&&(this.#V+=1),n&&this.#De())}#oe(e){return{collapse:()=>{this.#ie(e)},deselect:()=>{this.deselectPath(e)},expand:()=>{this.#ke(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!0,isExpanded:()=>this.#H.isExpanded(e),isFocused:()=>this.#c===e,isSelected:()=>this.#B.has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)},toggle:()=>{this.#ze(e)}}}#se(e){return{deselect:()=>{this.deselectPath(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!1,isFocused:()=>this.#c===e,isSelected:()=>this.#B.has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)}}}#ce(e){let t=this.#H.list();this.#le(t).batch(e)}#le(e,t,n){return new Gi({...this.#e,paths:e,preparedInput:t??void 0,...n===void 0?{}:{initialExpandedPaths:n}})}#ue(){return this.#h??=this.#H.list(),this.#h}#de(){if(this.#m!=null)return this.#m;let e=new Set;for(let t of this.#ue()){e.add(t);for(let n of ja(t))e.add(n)}return this.#m=[...e].sort(),this.#m}#fe(){return this.#g??=this.#ue().map(Fa),this.#g}#pe(){return this.#f??=this.#de().filter(e=>e.endsWith(`/`)),this.#f}#me(){return this.#p??=this.#pe().map(Fa),this.#p}#he(){this.#f=null,this.#p=null,this.#m=null,this.#h=null,this.#g=null}#ge(){return this.#pe().filter(e=>this.#H.isExpanded(e))}#_e(e){let t=new Set(this.#j??[]);if(e)for(let e of this.#B)for(let n of ja(e))t.add(n);this.#ve(t)}#ve(e){this.#W=!0;try{for(let t of this.#pe()){let n=e.has(t),r=this.#H.isExpanded(t);n&&!r?this.#H.expand(t):!n&&r&&this.#H.collapse(t)}}finally{this.#W=!1}}#ye(){if(this.#M==null||this.#M.length===0){this.#k=[],this.#F=null,this.#I=null,this.#P=null,this.#G=this.#U;return}let e=this.#b;if(this.#k=e.filter(e=>this.#O.has(e)),this.#A!==`hide-non-matches`||this.#O.size===0){this.#F=null,this.#I=null,this.#P=null,this.#G=this.#U;return}let t=[],n=[],r=new Map;for(let[i,a]of e.entries())this.#N?.has(a)===!0&&(r.set(a,n.length),t.push(i),n.push(a));this.#F=t,this.#I=n,this.#P=r,this.#G=n.length}#be(){return this.#I??this.#b}#xe(e){return this.#I==null?this.#H.getVisibleIndex(e)??-1:this.#P?.get(e)??-1}#Se(e){return this.#F?.[e]??e}#Ce(e){return this.#P?.get(e)??this.#H.getVisibleIndex(e)??-1}#we(e){let t=this.#k;if(t.length===0)return;let n=this.#c,r=n==null?-1:t.indexOf(n),i=t[r<0?e>0?0:t.length-1:Math.min(t.length-1,Math.max(0,r+e))];i!=null&&this.focusPath(i)}#Te(e,t){let n=e==null?null:za(e),r=this.#M;if(r!==n){if(r==null&&n!=null&&(this.#j=this.#ge()),this.#M=n,n==null)this.#_e(!0),this.#j=null,this.#O.clear(),this.#N=null,this.#je(this.#c,!0);else if(n.length===0)this.#_e(!1),this.#O.clear(),this.#N=null,this.#je(this.#c,!0);else{let e=this.#Ee();this.#je(e,!0)}t&&(this.#y?.(this.#M),this.#De())}}#Ee(){if(this.#M==null||this.#M.length===0)return this.#O.clear(),this.#c;let e=this.#M,t=this.#ue(),n=this.#fe(),r=[],i=new Set,a=null;for(let o=0;o<t.length;o+=1){if(!n[o].includes(e))continue;let s=t[o];r.push(s),i.add(s),a??=s}let o=this.#pe(),s=this.#me();for(let t=0;t<o.length;t+=1){if(!s[t].includes(e))continue;let n=o[t];i.has(n)||(r.push(n),i.add(n),a??=n)}this.#O=i;let c=this.#A===`hide-non-matches`&&r.length>0?new Set:null;this.#N=c;let l=this.#A===`expand-matches`?new Set(this.#j??[]):new Set;for(let e of r){c?.add(e),e.endsWith(`/`)&&l.add(e);for(let t of ja(e))l.add(t),c?.add(t)}return this.#ve(l),a??this.#c}#De(){for(let e of this.#t)e()}#Oe(e){this.#n.get(e.operation)?.forEach(t=>{t(e)}),this.#n.get(`*`)?.forEach(t=>{t(e)})}#ke(e){for(let t of ja(e))this.#H.isExpanded(t)||this.#H.expand(t);this.#H.isExpanded(e)||this.#H.expand(e)}#Ae(e){let t=this.#G;if(t===0)return;let n=this.#s===-1?0:this.#s,r=Math.min(t-1,Math.max(0,n+e));(r!==n||this.#s===-1)&&(!this.#l&&this.#F==null&&r>=this.#b.length&&this.#Ie(),this.#Fe(r))}#je(e,t=!0){let n=this.#H.getVisibleCount();this.#U=n;let r=Ga(this.#H.getVisibleTreeProjectionData(t?void 0:Math.min(n,Va)),e,t?e=>this.#H.getVisibleIndex(e):void 0);this.#a.clear(),this.#o.clear(),this.#l=r.paths.length>=n,this.#u=r.getParentIndex,this.#b=r.paths,this.#x=r.posInSetByIndex,this.#S=r.setSizeByIndex,this.#ye(),this.#s=e==null?this.#be().length>0?0:-1:this.#Z(e),this.#c=this.#s<0?null:this.#Me(this.#s)}#Me(e){return this.#be()[e]??(this.#F==null?this.#H.getVisibleRowContext(e)?.row.path??null:null)}#Ne(e){return this.#H.getPathInfo(e)?.path??null}#Pe(e){if(e==null)return;let t=this.#Z(e);t>=0&&this.#Fe(t,!1)}#Fe(e,t=!0){let n=this.#Me(e);n!=null&&(this.#s===e&&this.#c===n||(this.#s=e,this.#c=n,t&&this.#De()))}#Ie(){this.#l||this.#je(this.#c,!0)}#Le(e){let t=Ta(this.#T,e);t==null&&this.#T!=null&&(this.#E=``),this.#T=t;let n=Ta(this.#c,e,!0),r=[...this.#B].map(t=>Ta(t,e)).filter(e=>e!=null).map(e=>this.#H.getPathInfo(e)?.path??null).filter(e=>e!=null),i=Ta(this.#z,e),a=i==null?null:this.#H.getPathInfo(i)?.path??null,o=[...new Set(r)];return Aa(this.#B,o)||(this.#B=new Set(o),this.#V+=1),this.#z=a,n}#Re(){return this.#H.on(`*`,e=>{if(this.#W)return;e.canonicalChanged&&(this.#d.clear(),this.#he()),this.#i!=null&&Sa(e)&&(this.#i=null);let t=Sa(e)?this.#Le(e):this.#c,n=this.#M!=null&&this.#M.length>0?this.#Ee():this.#M===``?this.#c:t,r=this.#M!=null||e.operation!==`expand`&&e.operation!==`collapse`;this.#je(n,r),this.#De();let i=ka(e);i!=null&&this.#Oe(i)})}#ze(e){if(this.#H.isExpanded(e)){this.#ie(e);return}this.#ke(e)}},qa=e=>{if(e==null||e.length===0)return`0`;let t=`${e.length}`;for(let n of e)t+=`\0${n.path}\0${n.status}`;return t};function Ja(e){let t=e.endsWith(`/`),n=``,r=-1;for(let t=0;t<=e.length;t+=1){if(!(e[t]===`/`||t===e.length)){r===-1&&(r=t);continue}r!==-1&&(n!==``&&(n+=`/`),n+=e.slice(r,t),r=-1)}return n===``?null:{isDirectory:t,path:n}}function Ya(e){let t=e.endsWith(`/`)?e.slice(0,-1):e;if(t.length===0)return[];let n=t.split(`/`);return n.slice(0,-1).map((e,t)=>`${n.slice(0,t+1).join(`/`)}/`)}function Xa(e,t){return t?`${e}/`:e}function Za(e,t=null){let n=qa(e==null?void 0:[...e]);if(n===`0`)return null;if(t?.signature===n)return t;let r=new Map,i=new Set,a=new Set;for(let t of e??[]){let e=Ja(t.path);if(e==null)continue;let n=Xa(e.path,e.isDirectory);r.set(n,t.status),t.status===`ignored`&&e.isDirectory?a.add(n):e.isDirectory&&a.delete(n);for(let t of Ya(e.path))i.add(t)}return{directoriesWithChanges:i,ignoredDirectoryPaths:a,signature:n,statusByPath:r}}var K,Qa,$a,eo,to,no,ro,io,ao,oo,so={},co=[],lo=Array.isArray,uo=co.slice,fo=Object.assign;function po(e){e&&e.parentNode&&e.remove()}function mo(e,t,n){var r,i,a,o={};for(a in t)a==`key`?r=t[a]:a==`ref`&&typeof e!=`function`?i=t[a]:o[a]=t[a];return arguments.length>2&&(o.children=arguments.length>3?uo.call(arguments,2):n),ho(e,o,r,i,null)}function ho(e,t,n,r,i){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++Qa,__i:-1,__u:0};return i==null&&K.vnode!=null&&K.vnode(a),a}function go(e){return e.children}function _o(e,t){this.props=e,this.context=t,this.__g=0}function vo(e,t){if(t==null)return e.__?vo(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type==`function`?vo(e):null}function yo(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=n.__e;break}return yo(e)}}function bo(e){(8&e.__g||!(e.__g|=8)||!$a.push(e)||to++)&&eo==K.debounceRendering||((eo=K.debounceRendering)||queueMicrotask)(xo)}function xo(){for(var e,t,n,r,i,a,o,s,c=1;$a.length;)$a.length>c&&$a.sort(no),e=$a.shift(),c=$a.length,8&e.__g&&(n=void 0,i=(r=(t=e).__v).__e,a=[],o=[],(s=t.__P)&&((n=fo({},r)).__v=r.__v+1,K.vnode&&K.vnode(n),ko(s,n,r,t.__n,s.namespaceURI,32&r.__u?[i]:null,a,i??vo(r),!!(32&r.__u),o,s.ownerDocument),n.__v=r.__v,n.__.__k[n.__i]=n,jo(a,n,o),n.__e!=i&&yo(n)));to=0}function So(e,t,n,r,i,a,o,s,c,l,u,d){var f,p,m,h,g,_,v,y=r&&r.__k||co,b=t.length;for(c=Co(n,t,y,c,b),f=0;f<b;f++)(m=n.__k[f])!=null&&(p=m.__i==-1?so:y[m.__i]||so,m.__i=f,_=ko(e,m,p,i,a,o,s,c,l,u,d),h=m.__e,m.ref&&p.ref!=m.ref&&(p.ref&&Po(p.ref,null,m),u.push(m.ref,m.__c||h,m)),g==null&&h!=null&&(g=h),(v=!!(4&m.__u))||p.__k===m.__k?c=wo(m,c,e,v):typeof m.type==`function`&&_!==void 0?c=_:h&&(c=h.nextSibling),m.__u&=-7);return n.__e=g,c}function Co(e,t,n,r,i){var a,o,s,c,l,u=n.length,d=u,f=0;for(e.__k=Array(i),a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(c=a+f,(o=e.__k[a]=typeof o==`string`||typeof o==`number`||typeof o==`bigint`||o.constructor==String?ho(null,o,null,null,null):lo(o)?ho(go,{children:o},null,null,null):o.constructor==null&&o.__b>0?ho(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o).__=e,o.__b=e.__b+1,s=null,(l=o.__i=To(o,n,c,d))!=-1&&(d--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(i>u?f--:i<u&&f++),typeof o.type!=`function`&&(o.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,o.__u|=4))):e.__k[a]=null;if(d)for(a=0;a<u;a++)(s=n[a])!=null&&!(2&s.__u)&&(s.__e==r&&(r=vo(s)),Fo(s,s));return r}function wo(e,t,n,r){var i,a;if(typeof e.type==`function`){for(i=e.__k,a=0;i&&a<i.length;a++)i[a]&&(i[a].__=e,t=wo(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=vo(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function To(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&(2&l.__u)==0;if(l===null&&e.key==null||u&&s==l.key&&c==l.type)return n;if(r>+!!u){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])!=null&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function Eo(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n??``}function Do(e,t,n,r,i){var a;n:if(t==`style`)if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||Eo(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||Eo(e.style,t,n[t])}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(ro,`$1`)),(t=t.slice(2))[0].toLowerCase()!=t[0]&&(t=t.toLowerCase()),e.__l||={},e.__l[t+a]=n,n?r?n.l=r.l:(n.l=io,e.addEventListener(t,a?oo:ao,a)):e.removeEventListener(t,a?oo:ao,a);else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n??``;break n}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function Oo(e){return function(t){if(this.__l){var n=this.__l[t.type+e];if(t.u==null)t.u=io++;else if(t.u<n.l)return;return n(K.event?K.event(t):t)}}}function ko(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,ee,k,A,j=t.type;if(t.constructor!=null)return null;128&n.__u&&(c=!!(32&n.__u),n.__c.__z&&(s=t.__e=n.__e=(a=n.__c.__z)[0],n.__c.__z=null)),(d=K.__b)&&d(t);n:if(typeof j==`function`)try{if(v=t.props,y=`prototype`in j&&j.prototype.render,b=(d=j.contextType)&&r[d.__c],x=d?b?b.props.value:d.__:r,n.__c?2&(f=t.__c=n.__c).__g&&(f.__g|=1,_=!0):(y?t.__c=f=new j(v,x):(t.__c=f=new _o(v,x),f.constructor=j,f.render=Io),b&&b.sub(f),f.props=v,f.state||={},f.context=x,f.__n=r,p=!0,f.__g|=8,f.__h=[],f._sb=[]),y&&f.__s==null&&(f.__s=f.state),y&&j.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=fo({},f.__s)),fo(f.__s,j.getDerivedStateFromProps(v,f.__s))),m=f.props,h=f.state,f.__v=t,p)y&&j.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),y&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(y&&j.getDerivedStateFromProps==null&&v!==m&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(v,x),!(4&f.__g)&&f.shouldComponentUpdate!=null&&!1===f.shouldComponentUpdate(v,f.__s,x)||t.__v==n.__v){for(t.__v!=n.__v&&(f.props=v,f.state=f.__s,f.__g&=-9),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),S=0;S<f._sb.length;S++)f.__h.push(f._sb[S]);f._sb=[],f.__h.length&&o.push(f);break n}f.componentWillUpdate!=null&&f.componentWillUpdate(v,f.__s,x),y&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(m,h,g)})}if(f.context=x,f.props=v,f.__P=e,f.__g&=-5,C=K.__r,w=0,y){for(f.state=f.__s,f.__g&=-9,C&&C(t),d=f.render(f.props,f.state,f.context),T=0;T<f._sb.length;T++)f.__h.push(f._sb[T]);f._sb=[]}else do f.__g&=-9,C&&C(t),d=f.render(f.props,f.state,f.context),f.state=f.__s;while(8&f.__g&&++w<25);f.state=f.__s,f.getChildContext!=null&&(r=fo({},r,f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),E=d,d!=null&&d.type===go&&d.key==null&&(E=Mo(d.props.children)),s=So(e,lo(E)?E:[E],t,n,r,i,a,o,s,c,l,u),t.__u&=-161,f.__h.length&&o.push(f),_&&(f.__g&=-4)}catch(e){if(t.__v=null,c||a!=null)if(e.then){for(D=0,O=!1,t.__u|=c?160:128,t.__c.__z=[],ee=0;ee<a.length;ee++)(k=a[ee])==null||O||(k.nodeType==8&&k.data==`$s`?(D>0&&t.__c.__z.push(k),D++,a[ee]=null):k.nodeType==8&&k.data==`/$s`?(--D>0&&t.__c.__z.push(k),O=D===0,s=a[ee],a[ee]=null):D>0&&(t.__c.__z.push(k),a[ee]=null));if(!O){for(;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;a[a.indexOf(s)]=null,t.__c.__z=[s]}t.__e=s}else{for(A=a.length;A--;)po(a[A]);Ao(t)}else t.__e=n.__e,t.__k=n.__k,e.then||Ao(t);K.__e(e,t,n)}else s=t.__e=No(n.__e,t,n,r,i,a,o,c,l,u);return(d=K.diffed)&&d(t),128&t.__u?void 0:s}function Ao(e){e&&e.__c&&(e.__c.__g|=4),e&&e.__k&&e.__k.forEach(Ao)}function jo(e,t,n){for(var r=0;r<n.length;r++)Po(n[r],n[++r],n[++r]);K.__c&&K.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){K.__e(e,t.__v)}})}function Mo(e){return typeof e!=`object`||!e||e.__b&&e.__b>0?e:lo(e)?e.map(Mo):fo({},e)}function No(e,t,n,r,i,a,o,s,c,l){var u,d,f,p,m,h,g,_,v=n.props,y=t.props,b=t.type;if(b==`svg`?i=`http://www.w3.org/2000/svg`:b==`math`?i=`http://www.w3.org/1998/Math/MathML`:i||=`http://www.w3.org/1999/xhtml`,a!=null){for(u=0;u<a.length;u++)if((m=a[u])&&`setAttribute`in m==!!b&&(b?m.localName==b:m.nodeType==3)){e=m,a[u]=null;break}}if(e==null){if(b==null)return l.createTextNode(y);e=l.createElementNS(i,b,y.is&&y),s&&=(K.__m&&K.__m(t,a),!1),a=null}if(b==null)v===y||s&&e.data==y||(e.data=y);else{if(a&&=uo.call(e.childNodes),v=n.props||so,!s&&a!=null)for(v={},u=0;u<e.attributes.length;u++)v[(m=e.attributes[u]).name]=m.value;for(u in v)if(m=v[u],u!=`children`){if(u==`dangerouslySetInnerHTML`)f=m;else if(!(u in y)){if(u==`value`&&`defaultValue`in y||u==`checked`&&`defaultChecked`in y)continue;Do(e,u,null,m,i)}}for(u in _=1&n.__u,y)m=y[u],u==`children`?p=m:u==`dangerouslySetInnerHTML`?d=m:u==`value`?h=m:u==`checked`?g=m:s&&typeof m!=`function`||v[u]===m&&!_||Do(e,u,m,v[u],i);if(d)s||f&&(d.__html==f.__html||d.__html==e.innerHTML)||(e.innerHTML=d.__html),t.__k=[];else if(f&&(e.innerHTML=``),So(b==`template`?e.content:e,lo(p)?p:[p],t,n,r,b==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&vo(n,0),s,c,l),a!=null)for(u=a.length;u--;)po(a[u]);s||(u=`value`,b==`progress`&&h==null?e.removeAttribute(`value`):h==null||h===e[u]&&(b!==`progress`||h)||Do(e,u,h,v[u],i),u=`checked`,g!=null&&g!=e[u]&&Do(e,u,g,v[u],i))}return e}function Po(e,t,n){try{if(typeof e==`function`){var r=typeof e.__u==`function`;r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(e){K.__e(e,n)}}function Fo(e,t,n){var r,i;if(K.unmount&&K.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||Po(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){K.__e(e,t)}r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&Fo(r[i],t,n||typeof e.type!=`function`);n||po(e.__e),e.__e&&e.__e.__l&&(e.__e.__l=null),e.__e=e.__c=e.__=null}function Io(e,t,n){return this.constructor(e,n)}function Lo(e,t){var n,r,i,a;t==document&&(t=document.documentElement),K.__&&K.__(e,t),r=(n=!!(e&&32&e.__u))?null:t.__k,e=t.__k=mo(go,null,[e]),i=[],a=[],ko(t,e,r||so,so,t.namespaceURI,r?null:t.firstChild?uo.call(t.childNodes):null,i,r?r.__e:t.firstChild,n,a,t.ownerDocument),jo(i,e,a)}function Ro(e,t){e.__u|=32,Lo(e,t)}K={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!(1&i.__g)){i.__g|=4;try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),o=8&i.__g),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),o=8&i.__g),o)return void(i.__g|=2)}catch(t){e=t}}throw to=0,e}},Qa=0,_o.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=fo({},this.state);typeof e==`function`&&(e=e(fo({},n),this.props)),e&&fo(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),bo(this))},_o.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),bo(this))},_o.prototype.render=go,$a=[],to=0,no=function(e,t){return e.__v.__b-t.__v.__b},ro=/(PointerCapture)$|Capture$/i,io=0,ao=Oo(!1),oo=Oo(!0);var zo=0;Array.isArray;function q(e,t,n,r,i,a){t||={};var o,s,c=t;if(`ref`in c&&typeof e!=`function`)for(s in c={},t)s==`ref`?o=t[s]:c[s]=t[s];var l={type:e,props:c,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--zo,__i:-1,__u:0,__source:i,__self:a};return K.vnode&&K.vnode(l),l}var Bo=16,Vo=16,Ho={};function Uo({name:e,remappedFrom:t,token:n,width:r,height:i,viewBox:a,label:o,alignCapitals:s=!1}){"use no memo";let c=`#${e.replace(/^#/,``)}`,{width:l,height:u,viewBox:d}=Ho[e]??{width:Bo,height:Vo},f=r??l,p=i??u,m=a??d??`0 0 ${l} ${u}`;return q(`svg`,{"data-icon-name":t??e,"data-icon-token":n,"data-align-capitals":s,...o==null?{"aria-hidden":!0}:{"aria-label":o,role:`img`},viewBox:m,width:f,height:p,children:q(`use`,{href:c})})}var Wo=e=>{if(e.length<2)return[e,``];let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]},Go=e=>{if(e.length<4)return[e,``];let t=e.lastIndexOf(`.`)+1,n=e.length-t>10,r=t>=1&&!n?t:Math.ceil(e.length/2);return[e.slice(0,r),e.slice(r)]},Ko=e=>{if(e.length<4)return[e,``];let t=e.lastIndexOf(`/`)+1,n=e.length-t>25,r=t>=1&&!n?t:Math.ceil(e.length/2);return[e.slice(0,r),e.slice(r)]},qo=(e,{splitIndex:t}={})=>{if(typeof t!=`number`){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}return[e.slice(0,t),e.slice(t)]},Jo=(e,{splitOffset:t}={})=>{if(typeof t!=`number`||t<=0||t>=e.length){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}let n=e.length-t;return[e.slice(0,n),e.slice(n)]},Yo=(e,{splitOffset:t}={})=>{if(typeof t!=`number`||t<=0||t>=e.length){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}let n=t;return[e.slice(0,n),e.slice(n)]};function Xo({children:e,marker:t,variant:n=`default`}){"use no memo";return q(`div`,{"aria-hidden":!0,"data-truncate-marker-cell":!0,children:q(`div`,{"data-truncate-marker":!0,children:typeof t==`function`?t({children:e}):n===`fade`?q(`span`,{"data-truncate-fade":!0}):t})})}function Zo(e){"use no memo";let{mode:t,children:n}=e;return q(`div`,{children:[q(`div`,{"data-truncate-content":`visible`,children:t===`fruncate`?q(`span`,{children:n}):n}),q(`div`,{"data-truncate-content":`overflow`,"aria-hidden":!0,children:t===`fruncate`?q(`span`,{children:n}):n})]})}function Qo({children:e,mode:t=`truncate`,marker:n=`…`,variant:r=`default`,...i}){"use no memo";let a=q(Zo,{mode:t,children:e},`content`),o=q(Xo,{marker:n,mode:t,variant:r},`marker`),s=q(`div`,{"data-truncate-fill":!0},`fill`);return q(`div`,{"data-truncate-container":t,"data-truncate-variant":r,...i,children:q(`div`,{"data-truncate-grid":!0,children:t===`truncate`?[a,o]:[o,a,s]})})}function $o({children:e,...t}){"use no memo";return q(Qo,{mode:`truncate`,...t,children:e})}function es({children:e,...t}){"use no memo";return q(Qo,{mode:`fruncate`,...t,children:e})}function ts({children:e,contents:t,priority:n=`end`,split:r=`center`,minimumLength:i=12,className:a,style:o,...s}){"use no memo";let c=null,l=null;if(Array.isArray(t)){if(t.length!==2)return console.error(`MiddleTruncate: contents must be an array of two items`),null;c=q($o,{...s,children:t[0]}),l=q(es,{...s,children:t[1]})}else{if(typeof e!=`string`)return console.error(`MiddleTruncate: children must be a string`),null;if(e.length===0)return q(`div`,{className:a,style:o});if(e.length<i)return q(n===`end`?es:$o,{...s,className:a,style:o,children:e});let t=null,u=null,d=null;if(typeof r==`string`)r===`center`?t=Wo:r===`extension`?t=Go:r===`leaf-path`&&(t=Ko);else if(typeof r==`number`)t=qo,u=r;else if(Array.isArray(r)){let[e,n]=r;d=n,e===`last`?t=Jo:e===`first`&&(t=Yo)}else typeof r==`function`&&(t=r);t??=Wo;let[f,p]=t(e,{priority:n,variant:s.variant,splitIndex:typeof u==`number`?u:void 0,splitOffset:typeof d==`number`?d:void 0}),m=f.length>=p.length,h=n===`equal`&&!m,g=n===`equal`&&m,_={},v={};h&&(_.marker=``),g&&(v.marker=``),c=q($o,{...s,..._,children:f}),l=q(es,{...s,...v,children:p})}return q(`div`,{"data-truncate-group-container":`middle`,className:a,style:o,children:[q(`div`,{"data-truncate-segment-priority":n===`start`||n===`equal`?`1`:`2`,children:c}),q(`div`,{"data-truncate-segment-priority":n===`end`||n===`equal`?`1`:`2`,children:l})]})}var ns={endIndex:-1,startIndex:-1};function rs(e,t,n){return Math.min(Math.max(e,t),n)}function is(e,t){return e<0||t<e?ns:{endIndex:t,startIndex:e}}function as(e){return e.startIndex<0||e.endIndex<e.startIndex}function os(e,t){return as(e)?0:(e.endIndex-e.startIndex+1)*t}function ss(e,t,n){if(t<=0)return-1;let r=t*n;return e<=0?0:e>=r?t:Math.floor(e/n)}function cs(e,t,n){return t<=0||e<=0?-1:e>=t*n?t-1:Math.ceil(e/n)-1}function ls(e){let t=new Map;return e.forEach((e,n)=>{if(e.kind!==`directory`||!e.isExpanded)return;let r=e.ancestorPaths.length,i=t.get(r);if(i==null){t.set(r,[n]);return}i.push(n)}),t}function us(e,t){let n=0,r=e.length-1,i=-1;for(;n<=r;){let a=Math.floor((n+r)/2),o=e[a];if(o==null)break;if(o<=t){i=a,n=a+1;continue}r=a-1}return i}function ds(e){let t=new Map,n=[];for(let r=0;r<e.length;r+=1){let i=e[r];if(i==null)continue;let a=i.kind===`directory`&&i.isExpanded?[...i.ancestorPaths,i.path]:i.ancestorPaths,o=0;for(;o<n.length&&o<a.length&&n[o]===a[o];)o+=1;for(let e=n.length-1;e>=o;--e){let i=n[e];i!=null&&t.set(i,r-1)}n.length=o;for(let e=o;e<a.length;e+=1){let t=a[e];t!=null&&n.push(t)}}let r=e.length-1;for(let e of n)t.set(e,r);return t}function fs(e,t,n){if(e.length===0||t<=0)return[];let r=ds(e),i=ls(e),a=[];for(let r=0;r<e.length;r+=1){let o=i.get(r);if(o==null||o.length===0)break;let s=t+r*n,c=us(o,Math.min(e.length-1,Math.floor(s/n))),l=null;for(;c>=0;){let t=o[c],n=t==null?null:e[t]??null;if(n!=null&&(r===0||n.ancestorPaths[r-1]===a[r-1]?.path)){l=n;break}--c}if(l==null)break;a.push(l)}return a.map((i,a)=>{let o=a*n,s=(r.get(i.path)??e.length-1)+1;if(s>=e.length)return{row:i,top:o};let c=s*n-t;return{row:i,top:Math.min(o,c-n)}}).filter(e=>e.top+n>0)}function ps(e,t){let n=t.totalRowCount??e.length,r=n*t.itemHeight,i=Math.max(0,t.viewportHeight),a=Math.max(0,Math.floor(t.overscan)),o=Math.max(0,r-i),s=rs(t.scrollTop,0,o),c=t.stickyRows??fs(e,s,t.itemHeight),l=c.reduce((e,n)=>Math.max(e,n.top+t.itemHeight),0),u=Math.min(r,s+l),d=Math.max(0,i-l),f=Math.max(0,r-u),p=ss(s,n,t.itemHeight),m=ss(u,n,t.itemHeight),h=l<=0||p<0||p>=n?-1:p,g=h===-1?-1:Math.min(n-1,m-1),_=h===-1||g<h?0:g-h+1,v=d<=0||m>=n?ns:is(m,cs(u+d,n,t.itemHeight)),y=g+1,b=as(v)?ns:is(Math.max(y,v.startIndex-a),Math.min(n-1,v.endIndex+a)),x=os(b,t.itemHeight);return{occlusion:{firstOccludedIndex:h,lastOccludedIndex:g,occludedCount:_},physical:{itemHeight:t.itemHeight,maxScrollTop:o,overscan:a,scrollTop:s,totalHeight:r,totalRowCount:n,viewportHeight:i},projected:{contentHeight:f,paneHeight:d,paneTop:u},sticky:{height:l,rows:c},visible:v,window:{endIndex:b.endIndex,height:x,offsetTop:as(b)?0:b.startIndex*t.itemHeight,startIndex:b.startIndex}}}var ms={added:`A`,deleted:`D`,ignored:null,modified:`M`,renamed:`R`,untracked:`U`},hs={added:`Git status: added`,deleted:`Git status: deleted`,ignored:`Git status: ignored`,modified:`Git status: modified`,renamed:`Git status: renamed`,untracked:`Git status: untracked`},gs=`Contains git status items`;function _s(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,topInset:i=0,viewportHeight:a}=e;if(n<0)return null;let o=Math.max(0,i),s=n*r,c=s+r;if(s<t+o){let e=Math.max(0,s-o);return e===t?null:e}if(c>t+a){let e=c-a;return e===t?null:e}return null}function vs(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,offset:i,topInset:a=0,totalHeight:o,viewportHeight:s}=e;if(i===`nearest`)return _s({currentScrollTop:t,focusedIndex:n,itemHeight:r,topInset:a,viewportHeight:s});if(n<0)return null;let c=Math.max(0,a),l=n*r,u=Math.max(0,s-c),d=i===`center`?c+Math.max(0,(u-r)/2):c,f=Math.max(0,o-s),p=Math.max(0,Math.min(l-d,f));return p===t?null:p}function ys(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,targetViewportOffset:i,totalHeight:a,viewportHeight:o}=e;if(n<0)return null;let s=Math.max(0,i),c=n*r,l=c+r,u=t+s,d=t+o;if(c>=u&&l<=d)return null;let f=Math.max(0,a-o),p=Math.max(0,Math.min(c-s,f));return p===t?null:p}function bs(e){if(e==null||!e.isConnected||e===document.body||e===document.documentElement)return!1;e.focus({preventScroll:!0});let t=e.getRootNode();return t instanceof ShadowRoot?t.activeElement===e:document.activeElement===e}function xs(e){let t=e.getRootNode();if(t instanceof ShadowRoot){let e=t.activeElement;return e instanceof HTMLElement?e:null}let n=document.activeElement;return n instanceof HTMLElement&&e.contains(n)?n:null}function Ss(e,t){if(e==null)return t;let n=e.getBoundingClientRect().height;return n>0?n:e.clientHeight>0?e.clientHeight:t}function Cs(e,t){return e!=null&&e>0?e:t}function ws(e){let t=e.borderBoxSize,n=Array.isArray(t)?t[0]:t;return n!=null&&Number.isFinite(n.blockSize)&&n.blockSize>0?n.blockSize:e.contentRect.height>0?e.contentRect.height:null}function Ts(e,t,n,r,i=0){let a=_s({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,topInset:i,viewportHeight:r});return a==null?!1:(e.scrollTop=a,!0)}function Es(e,t,n,r,i,a,o=0){let s=vs({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,offset:a,topInset:o,totalHeight:i,viewportHeight:r});return s==null?!1:(e.scrollTop=s,!0)}function Ds(e,t,n,r,i,a){let o=ys({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,targetViewportOffset:a,totalHeight:i,viewportHeight:r});return o==null?!1:(e.scrollTop=o,!0)}function Os(e,t,n,r){return n.end<n.start?null:e<n.start?-t:e>n.end?r:null}function ks(e){let{renamingPath:t,previousRenamingPath:n,hasRenderedInput:r}=e;return t==null?`reset`:r?n===t?`ignore`:`focus-input`:`reveal-canonical`}function As({ariaLabel:e,isFlattened:t=!1,ref:n,value:r,onBlur:i,onInput:a}){return q(`input`,{ref:n,"data-item-rename-input":!0,...t?{"data-item-flattened-rename-input":!0}:{},"aria-label":e,value:r,onBlur:i,onInput:a,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation()})}function js(e){let{row:t,mode:n,targetPath:r,ariaLabel:i,domId:a,isParked:o,itemHeight:s,features:c,state:l,extraStyle:u}=e,d=n===`sticky`,f=t.ancestorPaths.at(-1)??``,p={};return l.isFocusRinged&&(p[`data-item-focused`]=!0),t.isSelected&&(p[`data-item-selected`]=!0),l.isContextHovered&&(p[`data-item-context-hover`]=`true`),l.isDragTarget&&(p[`data-item-drag-target`]=!0),l.isDragging&&(p[`data-item-dragging`]=!0),l.effectiveGitStatus!=null&&(p[`data-item-git-status`]=l.effectiveGitStatus),l.containsGitChange&&(p[`data-item-contains-git-change`]=`true`),{"aria-expanded":!d&&t.kind===`directory`?t.isExpanded:void 0,"aria-haspopup":c.contextMenuEnabled?`menu`:void 0,"aria-label":i,"aria-level":d?void 0:t.level+1,"aria-posinset":d?void 0:t.posInSet+1,"aria-selected":d?void 0:t.isSelected?`true`:`false`,"aria-setsize":d?void 0:t.setSize,"data-file-tree-sticky-path":d?r:void 0,"data-file-tree-sticky-row":d?`true`:void 0,"data-item-context-menu-button-visibility":c.actionLaneEnabled?c.contextMenuButtonVisibility:void 0,"data-item-context-menu-trigger-mode":c.contextMenuEnabled?c.contextMenuTriggerMode:void 0,"data-item-has-context-menu-action-lane":c.actionLaneEnabled?`true`:void 0,"data-item-has-git-lane":c.gitLaneActive?`true`:void 0,"data-item-parent-path":f.length>0?f:void 0,"data-item-parked":o?`true`:void 0,"data-item-path":r,"data-item-type":t.kind===`directory`?`folder`:`file`,"data-type":`item`,id:d?void 0:a,role:d?void 0:`treeitem`,style:{minHeight:`${s}px`,...u},tabIndex:!d&&t.isFocused?0:-1,...p}}function Ms(e){let{event:t,mode:n,isSearchOpen:r,isDirectory:i}=e,a=t.ctrlKey||t.metaKey,o=t.shiftKey||a,s=t.shiftKey?{additive:a,kind:`range`}:a?{kind:`toggle`}:{kind:`single`};return{closeSearch:r,revealCanonical:n===`sticky`,selection:s,toggleDirectory:!o&&i}}var Ns,Ps,Fs,Is,Ls=Object.is,Rs=0,zs=[],Bs=K,Vs=Bs.__b,Hs=Bs.__r,Us=Bs.diffed,Ws=Bs.__c,Gs=Bs.unmount,Ks=Bs.__;function qs(e,t){Bs.__h&&Bs.__h(Ps,e,Rs||t),Rs=0;var n=Ps.__H||={__:[],__h:[]};return e>=n.__.length&&n.__.push({}),n.__[e]}function Js(e){return Rs=1,Ys(oc,e)}function Ys(e,t,n){var r=qs(Ns++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):oc(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);Ls(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=Ps,!Ps.__f)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=r.__c.__H.__.filter(function(e){return!!e.__c});if(i.every(function(e){return!e.__N}))return!a||a.call(this,e,t,n);var o=r.__c.props!==e;return i.forEach(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,Ls(t,e.__[0])||(o=!0)}}),a&&a.call(this,e,t,n)||o};Ps.__f=!0;var a=Ps.shouldComponentUpdate,o=Ps.componentWillUpdate;Ps.componentWillUpdate=function(e,t,n){if(4&this.__g){var r=a;a=void 0,i(e,t,n),a=r}o&&o.call(this,e,t,n)},Ps.shouldComponentUpdate=i}return r.__N||r.__}function Xs(e,t){var n=qs(Ns++,3);!Bs.__s&&ac(n.__H,t)&&(n.__=e,n.u=t,Ps.__H.__h.push(n))}function Zs(e,t){var n=qs(Ns++,4);!Bs.__s&&ac(n.__H,t)&&(n.__=e,n.u=t,Ps.__h.push(n))}function J(e){return Rs=5,Qs(function(){return{current:e}},[])}function Qs(e,t){var n=qs(Ns++,7);return ac(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function $s(e,t){return Rs=8,Qs(function(){return e},t)}function ec(){for(var e;e=zs.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(rc),e.__H.__h.forEach(ic),e.__H.__h=[]}catch(t){e.__H.__h=[],Bs.__e(t,e.__v)}}Bs.__b=function(e){Ps=null,Vs&&Vs(e)},Bs.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Ks&&Ks(e,t)},Bs.__r=function(e){Hs&&Hs(e),Ns=0;var t=(Ps=e.__c).__H;t&&(Fs===Ps?(t.__h=[],Ps.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(rc),t.__h.forEach(ic),t.__h=[],Ns=0)),Fs=Ps},Bs.diffed=function(e){Us&&Us(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(zs.push(t)!==1&&Is===Bs.requestAnimationFrame||((Is=Bs.requestAnimationFrame)||nc)(ec)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),Fs=Ps=null},Bs.__c=function(e,t){t.some(function(e){try{e.__h.forEach(rc),e.__h=e.__h.filter(function(e){return!e.__||ic(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],Bs.__e(n,e.__v)}}),Ws&&Ws(e,t)},Bs.unmount=function(e){Gs&&Gs(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{rc(e)}catch(e){t=e}}),n.__H=void 0,t&&Bs.__e(t,n.__v))};var tc=typeof requestAnimationFrame==`function`;function nc(e){var t,n=function(){clearTimeout(r),tc&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);tc&&(t=requestAnimationFrame(n))}function rc(e){var t=Ps,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),Ps=t}function ic(e){var t=Ps;e.__c=e.__(),Ps=t}function ac(e,t){return!e||e.length!==t.length||t.some(function(t,n){return!Ls(t,e[n])})}function oc(e,t){return typeof t==`function`?t(e):t}function sc(e,t=null,n=null){"use no memo";let r=e.flattenedSegments;return r==null||r.length===0?t??e.name:q(`span`,{"data-item-flattened-subitems":!0,children:r.map((e,i)=>{let a=i===r.length-1;return q(go,{children:[q(`span`,{"data-item-flattened-subitem":e.path,"data-item-flattened-subitem-drag-target":n===e.path?`true`:void 0,children:a&&t!=null?t:q($o,{children:e.name})}),i<r.length-1?` / `:``]},e.path)})})}function cc(e){return e.isFlattened?e.flattenedSegments?.findLast(e=>e.isTerminal)?.path??e.path:e.path}function lc(e){let t=e.flattenedSegments;return t==null||t.length===0?e.name:t.map(e=>e.name).join(` / `)}function uc(e,t,n,r){return e.map((e,i)=>{let a=i*n,o=e.subtreeEndIndex+1;if(o>=r)return{row:e.row,top:a};let s=o*n-t;return{row:e.row,top:Math.min(a,s-n)}}).filter(e=>e.top+n>0)}function dc({controller:e,itemHeight:t,overscan:n,scrollTop:r,stickyFolders:i,viewportHeight:a}){let o=e.getVisibleCount(),s=i&&o>0?e.getStickyRowCandidates(r,t):[],c=s==null&&i&&o>0?e.getVisibleRows(0,o-1):[],l=ps(c,{itemHeight:t,overscan:n,scrollTop:r,stickyRows:s==null?void 0:uc(s,r,t,o),totalRowCount:o,viewportHeight:a}),u=i&&r<=0&&o>0?e.getStickyRowCandidates(1,t):[],d=u!=null&&r<=0?uc(u,1,t,o):i&&r<=0&&c.length>0?fs(c,1,t):l.sticky.rows;return{overlayHeight:d.reduce((e,n)=>Math.max(e,n.top+t),0),overlayRows:d,snapshot:l,visibleRows:c}}var fc=400,pc=10,mc=40,hc=18;function gc(e,t,n){let r=e,i=document.elementFromPoint?.bind(document)??null,a=r.elementFromPoint?.(t,n)??i?.(t,n)??null;return e instanceof ShadowRoot&&(a==null||!e.contains(a))?_c(e,t,n):a instanceof HTMLElement?a:null}function _c(e,t,n){let r=Array.from(e.querySelectorAll(`[data-type="item"], [data-item-flattened-subitem]`));for(let e=r.length-1;e>=0;e--){let i=r[e],a=i.getBoundingClientRect();if(t>=a.left&&t<=a.right&&n>=a.top&&n<=a.bottom)return i}return null}function vc(e){let t=e?.closest?.(`[data-type="item"]`);if(!(t instanceof HTMLElement))return null;let n=t.dataset.itemPath??null;if(n==null)return null;let r=e?.closest?.(`[data-item-flattened-subitem]`),i=r instanceof HTMLElement?r.getAttribute(`data-item-flattened-subitem`)??null:null;if(i!=null&&i.endsWith(`/`))return{directoryPath:i,flattenedSegmentPath:i,hoveredPath:n,kind:`directory`};if(t.dataset.itemType===`folder`)return{directoryPath:n,flattenedSegmentPath:null,hoveredPath:n,kind:`directory`};let a=t.dataset.itemParentPath??null;return a==null||a.length===0?{directoryPath:null,flattenedSegmentPath:null,hoveredPath:n,kind:`root`}:{directoryPath:a,flattenedSegmentPath:null,hoveredPath:n,kind:`directory`}}function yc(e){let t=e.cloneNode(!0);return t.removeAttribute(`id`),t.dataset.fileTreeDragPreview=`true`,t.setAttribute(`aria-hidden`,`true`),t.tabIndex=-1,Object.assign(t.style,{boxShadow:`0 4px 12px rgba(0, 0, 0, 0.15)`,left:`0px`,margin:`0`,pointerEvents:`none`,position:`fixed`,top:`0px`,willChange:`transform`,zIndex:`10000`}),t}function bc(){return navigator.vendor!==`Apple Computer, Inc.`}function xc(e,t){let n=e-t.top;if(n<mc)return-Math.ceil((mc-Math.max(0,n))/mc*hc);let r=t.bottom-e;return r<mc?Math.ceil((mc-Math.max(0,r))/mc*hc):0}function Sc(e,t){if(e!=null){let t=ms[e];return t==null?null:{text:t,title:hs[e]}}return t?{icon:{name:`file-tree-icon-dot`,width:6,height:6},title:gs}:null}function Cc(e,t,n){if(t==null||t.size===0)return null;let r=[];for(let i=e.length-1;i>=0;--i){let a=e[i],o=n.get(a);if(o!=null){for(let e of r)n.set(e,o);return o?`ignored`:null}if(t.has(a)){n.set(a,!0);for(let e of r)n.set(e,!0);return`ignored`}r.push(a)}for(let e of r)n.set(e,!1);return null}function wc(e){return e!=null&&`toggle`in e}function Tc(e){return e.code===`Space`||e.key===` `||e.key===`Spacebar`}function Ec(e){return e.key.length===1&&/^[\p{L}\p{N}]$/u.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey}function Dc(e){return e==null?``:`[data-item-section="spacing-item"][data-ancestor-path="${e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}"] { opacity: 1; }`}function Oc(e){return e.shiftKey&&e.key===`F10`||e.key===`ContextMenu`}function kc(e,t){return t&&Oc(e)||(e.ctrlKey||e.metaKey)&&Tc(e)?!0:e.key===`ArrowDown`||e.key===`ArrowLeft`||e.key===`ArrowRight`||e.key===`ArrowUp`}var Ac=new Set([`ArrowDown`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`]);function jc(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&(t.dataset.fileTreeContextMenuRoot===`true`||t.dataset.type===`context-menu-anchor`||t.dataset.type===`context-menu-trigger`||t.getAttribute(`slot`)===`context-menu`))return!0;return!1}function Mc(e){return{bottom:e.bottom,height:e.height,left:e.left,right:e.right,top:e.top,width:e.width,x:e.x,y:e.y}}function Nc(e,t){return{bottom:t,height:0,left:e,right:e,top:t,width:0,x:e,y:t}}function Pc(e,t){if(e==null)return t.offsetTop;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.top-r.top}function Fc(e,t,n){if(n==null){e.delete(t);return}e.set(t,n)}function Ic(e,t,n){if(e==null)return null;let r=t.get(e)??null;if(r!=null)return r;let i=n.get(e)??null;return i?.dataset.itemParked===`true`?null:i}function Lc(e){if(e==null)return[];let t=[];for(let n of e.querySelectorAll(`button[data-file-tree-sticky-row="true"]`)){if(!(n instanceof HTMLElement))continue;let e=n.dataset.fileTreeStickyPath;e!=null&&t.push(e)}return t}function Rc(e,t){if(e==null||t==null)return null;for(let n of e.querySelectorAll(`button[data-item-focused="true"][data-item-parked="true"]`))if(n instanceof HTMLElement&&n.dataset.itemPath===t)return n;return null}function zc(e,t,n,r,i,a,o){let s=Math.max(0,a-i),c=t?.getBoundingClientRect()??null,l=c==null||n==null?null:n.getBoundingClientRect().top-c.top,u=Rc(e,r),d=c==null||u==null?null:u.getBoundingClientRect().top-c.top;return Math.max(0,Math.min(d??Math.max(l??0,s),Math.max(0,o-i)))}function Bc(e,t){return{kind:e.kind,name:lc(e),path:t}}function Vc(e){return e==null?void 0:`${e}__tree`}function Hc(e,t,n){if(e!=null)return`${e}__focused-item-${encodeURIComponent(t)}${n?`__parked`:``}`}function Uc(e){return e===`file-tree-icon-chevron`||e===`file-tree-icon-dot`||e===`file-tree-icon-file`||e===`file-tree-icon-lock`}function Wc(e,t){if(e==null)return null;if(`text`in e)return q(`span`,{title:e.title,children:e.text});let n=typeof e.icon==`string`?Uc(e.icon)?t(e.icon):{name:e.icon}:Uc(e.icon.name)?(()=>{let n=t(e.icon.name),{name:r,...i}=e.icon;return{...n,...i}})():e.icon;return q(`span`,{title:e.title,children:q(Uo,{...n})})}function Gc(e){e!=null&&bs(e.querySelector([`button:not([disabled])`,`[href]`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`, `))??e)}function Kc(e,t,{actionLaneEnabled:n=!1,customDecoration:r=null,decorationLaneEnabled:i=!1,dragTargetFlattenedSegmentPath:a=null,gitDecoration:o=null,gitLaneActive:s=!1,renameInput:c=null,showDecorativeActionAffordance:l=!1}={}){let u=cc(e);return q(go,{children:[e.depth>0?q(`div`,{"data-item-section":`spacing`,children:Array.from({length:e.depth}).map((t,n)=>q(`div`,{"data-item-section":`spacing-item`,"data-ancestor-path":e.ancestorPaths[n]},n))}):null,q(`div`,{"data-item-section":`icon`,children:e.kind===`directory`?q(Uo,{...t(`file-tree-icon-chevron`)}):q(Uo,{...t(`file-tree-icon-file`,u)})}),q(`div`,{"data-item-section":`content`,children:e.isFlattened?sc(e,c,a):c??q(ts,{minimumLength:5,split:`extension`,children:e.name})}),i?q(`div`,{"data-item-section":`decoration`,children:r==null?null:Wc(r,t)}):null,s?q(`div`,{"data-item-section":`git`,children:Wc(o,t)}):null,n?q(`div`,{"data-item-section":`action`,children:l?q(`span`,{"aria-hidden":`true`,"data-item-action-affordance":`decorative`,children:q(Uo,{...t(`file-tree-icon-ellipsis`)})}):null}):null]})}function qc(e,t,n,r={}){let{controller:i,renameView:a,visualFocusPath:o,contextHoverPath:s,draggedPathSet:c,dragTarget:l,dragAndDropEnabled:u,shouldSuppressContextMenu:d,handleRowDragStart:f,handleRowDragEnd:p,handleRowTouchStart:m,instanceId:h,itemHeight:g,gitStatusByPath:_,ignoredGitDirectories:v,ignoredInheritanceCache:y,directoriesWithGitChanges:b,gitLaneActive:x,contextMenuEnabled:S,contextMenuTriggerMode:C,contextMenuButtonTriggerEnabled:w,contextMenuButtonVisibility:T,contextMenuRightClickEnabled:E,registerRenameInput:D,registerButton:O,resolveIcon:ee,renderDecorationForRow:k,openContextMenuForRow:A,onRowClick:j,onKeyDown:M}=e,N=cc(t),{isParked:P=!1,mode:te=`flow`,style:F}=r,ne=te===`sticky`,re=_?.get(N)??null??Cc(t.ancestorPaths,v,y),ie=t.kind===`directory`&&(b?.has(N)??!1),ae=k(t,N),oe=Sc(re,ie),se=S&&w,ce=ae!=null||x||se,le=se&&T===`always`,ue=a.getPath()===N,de=ue?a.getValue():``,fe=ne||!ue?null:q(As,{ref:D,ariaLabel:`Rename ${lc(t)}`,isFlattened:t.isFlattened,value:de,onBlur:()=>{a.commit()},onInput:e=>{a.setValue(e.currentTarget.value)}}),pe=Kc(t,ee,{actionLaneEnabled:se,customDecoration:ae,decorationLaneEnabled:ce,dragTargetFlattenedSegmentPath:l?.flattenedSegmentPath??null,gitDecoration:oe,gitLaneActive:x,renameInput:fe,showDecorativeActionAffordance:le}),I={...js({ariaLabel:lc(t),domId:t.isFocused?Hc(h,N,P):void 0,extraStyle:F,features:{actionLaneEnabled:se,contextMenuButtonVisibility:se?T:null,contextMenuEnabled:S,contextMenuTriggerMode:S?C:null,gitLaneActive:x},isParked:P,itemHeight:g,mode:te,row:t,state:{containsGitChange:ie,effectiveGitStatus:re,isContextHovered:s===N,isDragTarget:l?.kind===`directory`&&l.directoryPath===N,isDragging:c?.has(N)===!0,isFocusRinged:t.isFocused&&o===N},targetPath:N}),key:n,onContextMenu:S||u?e=>{if(d()){e.preventDefault();return}S&&(e.preventDefault(),E&&(i.focusMountedPathFromInput(N),A(t,N,{anchorRect:Nc(e.clientX,e.clientY),source:`right-click`})))}:void 0,onFocus:ne?void 0:()=>{i.focusMountedPathFromInput(N)},onKeyDown:ne?void 0:M,ref:e=>{O(N,e)}};return!ne&&ue?q(`div`,{...I,children:pe}):q(`button`,{...I,type:`button`,draggable:u&&!P,onDragEnd:u&&!P?p:void 0,onDragStart:u&&!P?e=>{f(e,t,N)}:void 0,onMouseDown:e=>{if(ne){e.preventDefault();return}i.isSearchOpen()&&e.preventDefault()},onTouchStart:u&&!P?e=>{m(e,t,N)}:void 0,onClick:e=>{j(e,t,N,te)},children:pe})}function Jc(e,t,n){return t.end<t.start?[]:e.controller.getVisibleRows(t.start,t.end).filter(e=>!n.has(cc(e))).map((n,r)=>qc(e,n,t.start+r))}function Yc({composition:e,controller:t,gitStatusByPath:n,ignoredGitDirectories:r,directoriesWithGitChanges:i,icons:a,instanceId:o,itemHeight:s=Yi,overscan:c=10,renamingEnabled:l=!1,renderRowDecoration:u,searchBlurBehavior:d=`close`,searchEnabled:f=!1,searchFakeFocus:p=!1,slotHost:m,stickyFolders:h=!1,initialViewportHeight:g=420}){"use no memo";let _=J(null),v=J(null),y=J(!1),b=J(null),x=J(null),S=J(null),C=J(null),w=J(null),T=J(new Map),E=J(new Map),D=J(()=>{}),O=J(null),ee=J(0),k=J(!1),A=J(null);A.current!==t&&(k.current=!1,A.current=t);let j=J(!1),M=J(null),N=J(null),P=J(!1),te=J(null),F=J(null),ne=J(null),re=J(null),ie=J(null),ae=J(null),oe=J(null),se=J(null),ce=J(!1),le=J(null),ue=J(null),de=J(null),fe=J(null),pe=Qs(()=>new Map,[]),[,I]=Js(0),[me,he]=Js(null),[ge,_e]=Js(null),[ve,ye]=Js(null),[be,xe]=Js(null),[Se,Ce]=Js(0),[L,Te]=Js(null),Ee=J(L);Ee.current=L;let De=J(null),Oe=J(null),ke=J(null),R=J(null),Ae=J(null),je=J(!1),Me=()=>{Oe.current=null,ke.current=null,R.current=null},Ne=(e,t)=>{Oe.current=e,ke.current=null,R.current=t==null?null:{path:e,scrollTop:t}},Pe=(e,t)=>{Oe.current=null,ke.current={path:e,viewportOffset:t},R.current=null},Fe=J(d===`retain`&&t.isSearchOpen()),[Ie,Le]=Js(p);Xs(()=>{p||Le(!1)},[p]);let Re=J(!1),ze=$s(()=>{Re.current=!0,Le(e=>e&&!1)},[]),[Be,Ve]=Js(()=>dc({controller:t,itemHeight:s,overscan:c,scrollTop:0,stickyFolders:h,viewportHeight:g})),[He,Ue]=Js(!1);Xs(()=>{Ue(!0)},[]);let We=e?.contextMenu?.enabled===!0||e?.contextMenu?.render!=null||e?.contextMenu?.onOpen!=null||e?.contextMenu?.onClose!=null,Ge=e?.contextMenu?.triggerMode??(We?`right-click`:`both`),Ke=Ge===`both`||Ge===`button`,qe=e?.contextMenu?.buttonVisibility??`when-needed`,Je=Ge===`both`||Ge===`right-click`;Zs(()=>{let e=S.current;if(e==null)return;let t=e=>{if(!(e instanceof CustomEvent))return;let t=e.detail?.path??null;Ae.current=t,_e(t),xe(t==null?null:`pointer`)},n=e=>{e instanceof CustomEvent&&(je.current=e.detail?.disabled===!0)};return e.addEventListener(`file-tree-debug-set-context-menu-trigger`,t),e.addEventListener(`file-tree-debug-set-scroll-suppression`,n),()=>{e.removeEventListener(`file-tree-debug-set-context-menu-trigger`,t),e.removeEventListener(`file-tree-debug-set-scroll-suppression`,n)}},[]);let Ye=$s((e,t)=>{Fc(T.current,e,t)},[]),Xe=$s((e,t)=>{Fc(E.current,e,t)},[]),Ze=$s(e=>{x.current=e},[]),Qe=$s(e=>Ic(e,E.current,T.current),[]),$e=n!=null||r!=null||i!=null,{resolveIcon:et}=Qs(()=>we(a),[a]),tt=t[Ba](),nt=tt.getPath(),rt=nt!=null,it=t.isSearchOpen(),at=t.getSearchValue(),z=t.getFocusedPath(),B=t.getFocusedIndex(),ot=t.getScrollRequest(),st=t.isDragAndDropEnabled(),ct=t.getDragSession(),lt=Qs(()=>ct==null?null:new Set(ct.draggedPaths),[ct]),ut=ct?.target??null,dt=ct?.primaryPath??null,ft=Vc(o),{overlayHeight:pt,overlayRows:_t,snapshot:vt,visibleRows:yt}=Be,bt=vt.physical.viewportHeight,xt=Qs(()=>({end:vt.window.endIndex,start:vt.window.startIndex}),[vt.window.endIndex,vt.window.startIndex]),St=_t,Ct=vt.sticky.rows,wt=vt.physical.totalHeight,Tt=vt.sticky.height,Et=Qs(()=>new Set(Ct.map(e=>cc(e.row))),[Ct]),Dt=B>=0&&B>=xt.start&&B<=xt.end,Ot=$s((e,t)=>u?.({item:Bc(e,t),row:e})??null,[u]),kt=$s(e=>bs(e==null?null:T.current.get(e)??null)?!0:bs(S.current),[]),At=$s(e=>{kt(t.focusNearestPath(e))},[t,kt]),jt=J(At);jt.current=At;let Mt=J(!0),Nt=J(()=>{}),Pt=$s((t=!0)=>{let n=Ee.current;n!=null&&(Mt.current=Mt.current&&t,Te(null),e?.contextMenu?.onClose?.(),Mt.current&&At(n.path))},[e?.contextMenu,At]);Nt.current=Pt;let Ft=$s(e=>{let t=e==null?null:Pc(S.current,e);ye(e=>e===t?e:t)},[]),It=$s((e,n,r)=>{let i=t.getItem(n);if(i==null)return;let a=Qe(n);if(a?.dataset.fileTreeStickyRow===`true`){let e=C.current;Ne(n,e?.scrollTop??null),j.current=!0,he(e=>e===n?e:n)}i.focus(),Ft(a),Mt.current=!0,Te({anchorRect:r?.anchorRect??null,item:Bc(e,n),path:n,source:r?.source??`keyboard`})},[t,Qe,Ft]),Lt=$s(e=>{if(l){if(t.isSearchOpen()){let e=C.current,t=Ss(e,bt);te.current=B<0||e==null?null:Math.max(0,Math.min(B*s-e.scrollTop,Math.max(0,t-s))),P.current=!0}t.startRenaming(e)!==!1&&(xe(`focus`),I(e=>e+1))}},[t,B,s,l,bt]),Rt=$s((e,{restoreTreeFocus:n=!0,targetOffset:r=`live-overlay`}={})=>{let i=C.current;if(i==null)return!1;t.focusPath(e);let a=t.getFocusedIndex();if(a<0)return!1;let o=t.getVisibleRows(a,a)[0]??null;if(o==null)return!1;let l=Ss(i,bt),u=t.getVisibleCount()*s,d=r===`sticky-parents`?o.ancestorPaths.length*s:dc({controller:t,itemHeight:s,overscan:c,scrollTop:i.scrollTop,stickyFolders:h,viewportHeight:l}).snapshot.sticky.height;return j.current=!0,Ds(i,a,s,l,u,d),D.current(),De.current=n?e:null,!0},[t,s,c,bt,h]),V=()=>y.current===!0||fe.current!=null||ce.current===!0,zt=e=>typeof window.requestAnimationFrame==`function`?window.requestAnimationFrame(()=>{e()}):window.setTimeout(e,16),Bt=e=>{if(e!=null){if(typeof window.cancelAnimationFrame==`function`){window.cancelAnimationFrame(e);return}window.clearTimeout(e)}},Vt=()=>{re.current!=null&&(clearTimeout(re.current),re.current=null),ne.current=null},Ht=()=>{ae.current?.remove(),ae.current=null},Ut=()=>{Bt(F.current),F.current=null,ie.current=null},Wt=e=>{let t=S.current?.getRootNode();if(t instanceof ShadowRoot){t.append(e);return}document.body.append(e)},Gt=()=>{se.current?.(),se.current=null,fe.current!=null&&(clearTimeout(fe.current),fe.current=null),ce.current=!1,le.current=null,de.current=null,ue.current!=null&&(ue.current.setAttribute(`draggable`,`true`),ue.current.style.removeProperty(`touch-action`),ue.current=null),Ht(),Vt(),Ut(),oe.current=null},H=(e,n)=>{let r=S.current?.getRootNode(),i=vc(gc(r instanceof ShadowRoot?r:document,e,n));return t.setDragTarget(i),t.getDragSession()?.target??null},Kt=e=>{let n=t.getDragAndDropConfig()?.openOnDropDelay??800;if(e==null||e.kind!==`directory`||e.directoryPath==null||n<=0){Vt();return}let r=t.getItem(e.directoryPath),i=wc(r)?r:null;if(i==null||i.isExpanded()){Vt();return}let a=`${e.directoryPath}::${e.flattenedSegmentPath??``}`;ne.current!==a&&(Vt(),ne.current=a,re.current=setTimeout(()=>{let n=t.getDragSession()?.target;n?.kind!==`directory`||n.directoryPath!==e.directoryPath||n.flattenedSegmentPath!==e.flattenedSegmentPath||i.expand()},n))},qt=()=>{F.current=null;let e=ie.current,n=C.current;if(e==null||n==null||t.getDragSession()==null)return;let r=n.getBoundingClientRect(),i=xc(e.clientY,r);if(i===0)return;let a=Math.max(0,n.scrollHeight-n.clientHeight),o=Math.max(0,Math.min(a,n.scrollTop+i));o!==n.scrollTop&&(n.scrollTop=o,D.current()),Kt(H(e.clientX,e.clientY)),F.current=zt(qt)},Jt=(e,t)=>{ie.current={clientX:e,clientY:t},F.current??=zt(qt)},Yt=(e,n,r)=>{let i=e.currentTarget;if(i!=null){if(Gt(),Ht(),Vt(),Ut(),t.startDrag(r)===!1){e.preventDefault();return}if(oe.current=n,e.dataTransfer!=null&&(e.dataTransfer.effectAllowed=`move`,e.dataTransfer.dropEffect=`move`,e.dataTransfer.setData(`text/plain`,r),bc())){let t=yc(i),n=i.getBoundingClientRect();Object.assign(t.style,{height:`${n.height}px`,opacity:`0.85`,transform:`translate3d(-9999px, 0px, 0)`,width:`${n.width}px`}),Wt(t),ae.current=t,e.dataTransfer.setDragImage(t,Math.max(0,e.clientX-n.left),Math.max(0,e.clientY-n.top))}}},Xt=()=>{Ht(),Vt(),Ut(),oe.current=null,t.cancelDrag()},Zt=(e,n,r)=>{if(fe.current!=null||ce.current)return;let i=e.touches[0],a=e.currentTarget;if(i==null||a==null)return;de.current={clientX:i.clientX,clientY:i.clientY},ue.current=a,a.setAttribute(`draggable`,`false`);let o=(e={})=>{let t=e.restoreNativeDraggable??!ce.current;fe.current!=null&&(clearTimeout(fe.current),fe.current=null),document.removeEventListener(`touchmove`,s),document.removeEventListener(`touchend`,c),document.removeEventListener(`touchcancel`,c),se.current===o&&(se.current=null),t&&(a.setAttribute(`draggable`,`true`),ue.current===a&&(ue.current=null),de.current=null)},s=e=>{let t=e.touches[0],n=de.current;if(t==null||n==null)return;let r=t.clientX-n.clientX,i=t.clientY-n.clientY;r*r+i*i<=pc*pc||o()},c=()=>{o()};document.addEventListener(`touchmove`,s,{passive:!0}),document.addEventListener(`touchend`,c),document.addEventListener(`touchcancel`,c),se.current=o,fe.current=setTimeout(()=>{if(o({restoreNativeDraggable:!1}),t.startDrag(r)===!1){a.setAttribute(`draggable`,`true`),ue.current===a&&(ue.current=null),de.current=null;return}ce.current=!0,ue.current=a,a.setAttribute(`draggable`,`false`),a.style.setProperty(`touch-action`,`none`),oe.current=n;let e=a.getBoundingClientRect(),s=yc(a);Object.assign(s.style,{height:`${e.height}px`,opacity:`0.85`,transform:`translate3d(${e.left}px, ${e.top}px, 0)`,width:`${e.width}px`}),Wt(s),ae.current=s,le.current={x:i.clientX-e.left,y:i.clientY-e.top};let c=e=>{let t=e.touches[0];if(t==null)return;e.preventDefault();let n=le.current;n!=null&&ae.current!=null&&(ae.current.style.transform=`translate3d(${t.clientX-n.x}px, ${t.clientY-n.y}px, 0)`),Kt(H(t.clientX,t.clientY)),Jt(t.clientX,t.clientY)},l=e=>{let n=e.changedTouches[0];n!=null&&H(n.clientX,n.clientY),t.completeDrag(),Gt()},u=()=>{t.cancelDrag(),Gt()};se.current=()=>{document.removeEventListener(`touchmove`,c),document.removeEventListener(`touchend`,l),document.removeEventListener(`touchcancel`,u)},document.addEventListener(`touchmove`,c,{passive:!1}),document.addEventListener(`touchend`,l),document.addEventListener(`touchcancel`,u)},fc)},Qt=e=>{if(L!=null){if(e.key===`Escape`){Pt(),e.preventDefault(),e.stopPropagation();return}Ac.has(e.key)&&(e.preventDefault(),e.stopPropagation());return}if(tt.isActive()){if(e.key===`Escape`)tt.cancel();else if(e.key===`Enter`)tt.commit();else return;xe(`focus`),I(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(l&&e.key===`F2`){Lt(z??void 0),e.preventDefault(),e.stopPropagation();return}if(it){if(e.key===`Escape`)P.current=!1,te.current=null,t.closeSearch();else if(e.key===`Enter`){let e=t.getFocusedPath();e!=null&&t.selectOnlyPath(e);let n=C.current,r=Ss(n,bt);te.current=B<0||n==null?null:Math.max(0,Math.min(B*s-n.scrollTop,Math.max(0,r-s))),P.current=!0,t.closeSearch()}else if(e.key===`ArrowDown`)t.focusNextSearchMatch();else if(e.key===`ArrowUp`)t.focusPreviousSearchMatch();else return;xe(`focus`),I(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(f&&Ec(e)){t.openSearch(e.key),I(e=>e+1),e.preventDefault(),e.stopPropagation();return}let n=We&&Oc(e),r=kc(e,We),i=r&&S.current!=null?xs(S.current):null,a=r?new Set(Lc(S.current)):new Set,o=i?.dataset.fileTreeStickyPath??null,c=i?.dataset.fileTreeStickyRow===`true`&&o!=null;if(c&&o!==z&&a.has(o)){let e=C.current;Ne(o,e?.scrollTop??null),t.focusPath(o)}let u=t.getFocusedPath(),d=t.getFocusedIndex(),p=t.getFocusedItem();if(p==null)return;let m=wc(p)?p:null,h=u!=null&&(Et.has(u)||c&&o===u&&a.has(u)),g=e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`ArrowRight`&&m!=null&&m.isExpanded(),_=e.key===`ArrowLeft`&&h&&m!=null&&m.isExpanded(),v=C.current,y=!0;if(e.shiftKey&&e.key===`ArrowDown`)t.extendSelectionFromFocused(1);else if(e.shiftKey&&e.key===`ArrowUp`)t.extendSelectionFromFocused(-1);else if(n&&u!=null&&d>=0){let e=t.getVisibleRows(d,d)[0]??null,n=Ic(u,E.current,T.current);e==null||n==null?y=!1:It(e,u)}else if((e.ctrlKey||e.metaKey)&&Tc(e))t.toggleFocusedSelection();else if((e.ctrlKey||e.metaKey)&&e.key.toLowerCase()===`a`)t.selectAllVisiblePaths();else switch(e.key){case`ArrowDown`:t.focusNextItem();break;case`ArrowUp`:t.focusPreviousItem();break;case`ArrowRight`:m==null||m.isExpanded()?t.focusNextItem():m.expand();break;case`ArrowLeft`:m!=null&&m.isExpanded()?m.collapse():t.focusParentItem();break;case`Home`:t.focusFirstItem();break;case`End`:t.focusLastItem();break;default:y=!1}if(!y)return;xe(`focus`);let b=t.getFocusedPath(),x=b!=null&&(Et.has(b)||a.has(b)),w=g&&b!==u,D=n&&c&&o===u&&b===u;if((h||D)&&b!=null&&(w&&x||D))Ne(b,v?.scrollTop??null),j.current=!0,he(e=>e===b?e:b);else{let t=e.key===`ArrowUp`&&h&&b!==u;b!=null&&(t||_&&b===u)?(Pe(b,zc(S.current,v,i,u,s,Tt,bt)),j.current=!0,he(e=>e===b?e:b)):Me()}I(e=>e+1),e.preventDefault(),e.stopPropagation()};Zs(()=>{if(!(!f||!it)){if(Fe.current){Fe.current=!1;return}bs(w.current)}},[it,f]),Zs(()=>{let e=x.current;switch(ks({hasRenderedInput:e!=null,previousRenamingPath:N.current,renamingPath:nt})){case`reset`:N.current=null;return;case`reveal-canonical`:nt!=null&&Rt(nt,{restoreTreeFocus:!1,targetOffset:`live-overlay`});return;case`ignore`:return;case`focus-input`:e!=null&&(De.current=null,N.current=nt,bs(e),e.select());return}},[xt.end,xt.start,nt,Rt,Et]),Zs(()=>{let e=S.current;if(e==null)return;let t=null,n=()=>{t!=null&&(clearTimeout(t),t=null)},r=()=>{let t=xs(e)?.dataset.itemPath??null;he(e=>e===t?e:t)},i=()=>{n(),j.current=!0,r()},a=i=>{let a=i.relatedTarget;if(a==null){n(),t=setTimeout(()=>{if(t=null,xs(e)!=null){r();return}j.current=!1,he(null)},0);return}if(!(a instanceof Node)||!e.contains(a)){n(),j.current=!1,he(null);return}let o=a instanceof HTMLElement?a.dataset.itemPath??null:null;he(e=>e===o?e:o)};return e.addEventListener(`focusin`,i),e.addEventListener(`focusout`,a),()=>{n(),e.removeEventListener(`focusin`,i),e.removeEventListener(`focusout`,a)}},[]),Zs(()=>{let e=S.current;e!=null&&(vt.physical.scrollTop<=0?e.dataset.scrollAtTop=`true`:delete e.dataset.scrollAtTop)},[vt.physical.scrollTop]),Zs(()=>{let e=null,n=C.current,r=b.current,i=S.current;if(n==null)return;O.current=Ss(n,g);let a=()=>{let e=t.getVisibleCount(),r=Cs(O.current,g),i=Math.max(0,e*s-r);n.scrollTop>i&&(n.scrollTop=i),Ve(dc({controller:t,itemHeight:s,overscan:c,scrollTop:Math.min(n.scrollTop,i),stickyFolders:h,viewportHeight:r}))};if(!k.current){k.current=!0;let e=t.getFocusedIndex();if(e>=0){let r=Cs(O.current,g),i=t.getVisibleRows(e,e)[0]??null;Ts(n,e,s,r,h&&i!=null?Math.max(0,Math.min(i.ancestorPaths.length*s,Math.max(0,r-s))):0)}}D.current=a;let o=!1,l=t.subscribe(()=>{o?I(e=>e+1):o=!0,a()}),u=()=>{je.current!==!0&&(r!=null&&(r.dataset.isScrolling??=``),i!=null&&(i.dataset.isScrolling??=``),y.current=!0,e!=null&&clearTimeout(e),e=setTimeout(()=>{r!=null&&delete r.dataset.isScrolling,i!=null&&delete i.dataset.isScrolling,y.current=!1,Ce(e=>e+1),e=null},50))},d=null,f=()=>{i!=null&&delete i.dataset.overlayReveal,d!=null&&(clearTimeout(d),d=null)},p=()=>{i==null||je.current===!0||n.scrollTop>0||(i.dataset.overlayReveal=`true`,d!=null&&clearTimeout(d),d=setTimeout(()=>{f()},200))},m=()=>{if(a(),n.scrollTop>0&&f(),Ee.current!=null&&y.current&&Nt.current(),je.current===!0){y.current=!1;return}_e(e=>e==null?e:null),u()},_=()=>{u(),p()},v=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`PageUp`,`PageDown`,`Home`,`End`,` `,`Spacebar`]),x=e=>{v.has(e.key)&&_()};n.addEventListener(`scroll`,m,{passive:!0}),n.addEventListener(`wheel`,_,{passive:!0}),n.addEventListener(`touchmove`,_,{passive:!0}),n.addEventListener(`keydown`,x);let w=typeof ResizeObserver<`u`?new ResizeObserver(e=>{O.current=(e[0]==null?null:ws(e[0]))??Ss(n,g),a()}):null;return w?.observe(n),()=>{D.current=()=>{},l(),n.removeEventListener(`scroll`,m),n.removeEventListener(`wheel`,_),n.removeEventListener(`touchmove`,_),n.removeEventListener(`keydown`,x),e!=null&&clearTimeout(e),d!=null&&clearTimeout(d),r!=null&&delete r.dataset.isScrolling,i!=null&&(delete i.dataset.isScrolling,delete i.dataset.overlayReveal),y.current=!1,O.current=null,w?.disconnect()}},[t,g,s,c,h]),Zs(()=>{We||L==null||Pt(!1)},[Pt,We,L]);let $t=Qs(()=>L==null?null:`${L.path}::${L.source}`,[L]);Zs(()=>{if($t==null){m?.clearSlotContent(ht);return}let t=Ee.current;if(t==null)return;let n=v.current??_.current;if(n==null)return;let r={anchorElement:n,anchorRect:t.anchorRect??Mc(n.getBoundingClientRect()),close:e=>{Nt.current(e?.restoreFocus??!0)},restoreFocus:()=>{Mt.current&&jt.current(Ee.current?.path??null)}},i=e?.contextMenu?.render?.(t.item,r)??null;return m?.setSlotContent(ht,i),e?.contextMenu?.onOpen?.(t.item,r),Gc(i),queueMicrotask(()=>{i==null||!i.isConnected||document.activeElement===i&&Gc(i)}),()=>{m?.clearSlotContent(ht)}},[$t,e?.contextMenu,m]),Zs(()=>{L!=null&&t.getItem(L.path)==null&&Pt()},[Pt,L,t]),Zs(()=>{if(L==null)return;let e=S.current?.getRootNode(),t=e instanceof ShadowRoot?e.host:S.current,n=e=>{let n=e.target;n instanceof Node&&(jc(e)||_.current?.contains(n)!==!0&&t?.contains(n)!==!0&&Pt())},r=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),Pt())};return document.addEventListener(`mousedown`,n,!0),document.addEventListener(`keydown`,r,!0),()=>{document.removeEventListener(`mousedown`,n,!0),document.removeEventListener(`keydown`,r,!0)}},[Pt,L]),Zs(()=>{let e=C.current,n=S.current;if(e==null||n==null){M.current=z;return}let r=z==null?null:T.current.get(z)??null,i=xs(n),a=i?.dataset.itemPath??null,o=rt&&x.current===i,c=f&&w.current===i,l=P.current&&!it,u=te.current??0,d=De.current,p=Oe.current,m=ke.current,g=R.current,_=i!=null,v=j.current||_,y=M.current!==z,b=p!=null&&p===z&&z!=null,E=!1,O=!1;if(ot!=null&&ot.id!==ee.current){ee.current=ot.id;let n=ot.visibleIndex,r=t.getVisibleRows(n,n)[0]??null;if(r!=null){let t=h?Math.max(0,Math.min(r.ancestorPaths.length*s,Math.max(0,bt-s))):Tt;E=!0,O=Es(e,n,s,bt,wt,ot.offset,t)}t.clearScrollRequest(ot.id)}let k=!E&&l&&Ds(e,B,s,bt,wt,u),A=!E&&d!=null&&d===z&&Ds(e,B,s,bt,wt,Tt),N=!E&&m!=null&&m.path===z&&Ds(e,B,s,bt,wt,m.viewportOffset),F=!E&&g!=null&&g.path===z&&e.scrollTop!==g.scrollTop;if(F&&(e.scrollTop=g.scrollTop),(F||O||A||N||k||v&&y&&d!==z&&!b&&Ts(e,B,s,bt,Tt))&&D.current(),E){M.current=z;return}if(!v){M.current=z;return}if(o){M.current=z;return}if(c&&!l){M.current=z;return}if(r==null){l&&B>=0&&(Ds(e,B,s,bt,wt,u),D.current()),M.current=z;return}(y||l||d===z||p===z||m?.path===z||g?.path===z||a==null||a!==z)&&(bs(r),d===z&&(De.current=null),p===z&&(Oe.current=null),m?.path===z&&(ke.current=null),g?.path===z&&(R.current=null),P.current=!1,te.current=null),M.current=z},[t,B,z,Dt,s,rt,it,xt,bt,f,ot,h,Tt,wt,yt]);let en=B>=0&&B>=vt.visible.startIndex&&B<=vt.visible.endIndex,tn=z!=null&&St.some(e=>cc(e.row)===z),nn=en||tn,rn=Ke&&j.current===!0&&nn?z:null,an=be===`pointer`?ge:null,on=L?.path??Ae.current??an??rn??ge,sn=L?.source===`right-click`;Zs(()=>{y.current&&L==null||Ft(Qe(on))},[L,Qe,xt,bt,Se,St,on,Ft,yt]);let cn=$s(e=>{if(y.current||jc(e))return;let t=e.target;if(!(t instanceof HTMLElement)||t.closest?.(`[data-type="context-menu-trigger"]`)!=null)return;let n=t.closest?.(`[data-file-tree-sticky-row="true"]`),r=t.closest?.(`[data-type="item"]`),i=n instanceof HTMLElement?n.dataset.fileTreeStickyPath??null:r instanceof HTMLElement?r.dataset.itemPath??null:null;i!=null&&xe(e=>e===`pointer`?e:`pointer`),_e(e=>e===i?e:i)},[]),ln=$s(()=>{_e(null)},[]);Zs(()=>{if(!st)return;let e=()=>{Gt(),t.cancelDrag()};return window.addEventListener(`dragend`,e),()=>{window.removeEventListener(`dragend`,e),Gt(),t.cancelDrag()}},[t,st]);let un=e=>{if(!st||t.getDragSession()==null||ce.current)return;let n=vc(e.target instanceof HTMLElement?e.target:null);t.setDragTarget(n),Kt(t.getDragSession()?.target??null),Jt(e.clientX,e.clientY),e.dataTransfer!=null&&(e.dataTransfer.dropEffect=`move`),e.preventDefault()},dn=e=>{if(!st||t.getDragSession()==null||ce.current)return;let n=e.relatedTarget;n instanceof Node&&S.current?.contains(n)===!0||(Vt(),Ut(),t.setDragTarget(null))},fn=e=>{!st||t.getDragSession()==null||ce.current||(e.preventDefault(),H(e.clientX,e.clientY),t.completeDrag(),Ht(),Vt(),Ut(),oe.current=null)},pn=vt.window.height,mn=vt.window.offsetTop,hn=Math.min(0,bt-pn),gn=Math.min(0,bt-pn-Tt),_n=me===z||P.current,vn=z!=null&&_n&&!Dt&&B>=0?yt[B]??t.getVisibleRows(B,B)[0]??null:null,yn=vn==null?null:Os(B,s,xt,pn),bn=oe.current,xn=dt!=null&&bn!=null&&bn.path===dt&&bn.index>=xt.start&&bn.index<=xt.end,Sn=dt!=null&&bn!=null&&bn.path===dt&&!xn&&bn.path!==vn?.path?bn:null,Cn=Sn==null?null:Os(Sn.index,s,xt,pn),wn=Dc((B>=0?yt[B]??t.getVisibleRows(B,B)[0]??null:null)?.ancestorPaths.at(-1)??null),Tn=it&&z!=null?Hc(o,z,!Dt):void 0,En=L?.path??(it?z:me),Dn=L?.path??ge,On=Qe(on),kn=We&&Ke&&!sn&&!rt&&On!=null&&ve!=null&&on!=null,An=We&&(kn||L!=null),jn=L?.anchorRect,Mn=jn==null&&On!=null&&ve!=null&&(L!=null||kn)?ve:null,Nn=jn==null?Mn==null?void 0:{top:`${Mn}px`}:{left:`${jn.left}px`,position:`fixed`,right:`auto`,top:`${jn.top}px`},Pn=sn?{opacity:`0`}:void 0,Fn=$s((e,n,r,i)=>{let a=Ms({event:{ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey},isDirectory:n.kind===`directory`,isSearchOpen:it,mode:i}),o=a.toggleDirectory&&n.kind===`directory`,s=o?t.resolveMountedDirectoryPathFromInput(r):null;if(o&&s==null)return;let c=s??r;switch(a.selection.kind){case`range`:t.selectPathRange(c,a.selection.additive);break;case`toggle`:t.togglePathSelectionFromInput(c);break;case`single`:t.selectOnlyMountedPathFromInput(c);break}let l=e.currentTarget instanceof HTMLElement?e.currentTarget:null,u=n.index>=vt.visible.startIndex&&n.index<=vt.visible.endIndex,d=i===`flow`&&u&&l!=null&&l.dataset.itemParked!==`true`;t.focusMountedPathFromInput(c),d&&(j.current=!0,he(e=>e===c?e:c),xe(`focus`)),o&&t.toggleMountedDirectoryFromInput(c),a.closeSearch&&t.closeSearch(),a.revealCanonical&&Rt(c,{targetOffset:`sticky-parents`})},[t,it,vt.visible.endIndex,vt.visible.startIndex,Rt]),In=()=>{if(y.current||!Ke||on==null||On==null)return;let e=t.getItem(on);e!=null&&(Ft(On),Mt.current=!0,Te({anchorRect:null,item:{kind:e.isDirectory()?`directory`:`file`,name:On.getAttribute(`aria-label`)??on,path:e.getPath()},path:e.getPath(),source:`button`}))},Ln={contextHoverPath:Dn,contextMenuButtonTriggerEnabled:Ke,contextMenuButtonVisibility:qe,contextMenuEnabled:We,contextMenuRightClickEnabled:Je,contextMenuTriggerMode:Ge,controller:t,directoriesWithGitChanges:i,dragAndDropEnabled:st,draggedPathSet:lt,dragTarget:ut,gitLaneActive:$e,gitStatusByPath:n,handleRowDragEnd:Xt,handleRowDragStart:Yt,handleRowTouchStart:Zt,ignoredGitDirectories:r,ignoredInheritanceCache:pe,instanceId:o,itemHeight:s,onKeyDown:Qt,onRowClick:Fn,openContextMenuForRow:It,registerButton:Ye,registerRenameInput:Ze,renameView:tt,renderDecorationForRow:Ot,resolveIcon:et,shouldSuppressContextMenu:V,visualFocusPath:En},Rn={...Ln,registerButton:Xe};return q(`div`,{ref:S,id:ft,"data-file-tree-context-menu-button-visibility":We&&Ke?qe:void 0,"data-file-tree-context-menu-trigger-mode":We?Ge:void 0,"data-file-tree-has-context-menu-action-lane":We&&Ke?`true`:void 0,"data-file-tree-has-git-lane":$e?`true`:void 0,"data-file-tree-virtualized-root":`true`,onDragLeave:st?dn:void 0,onDragOver:st?un:void 0,onDrop:st?fn:void 0,onKeyDown:Qt,onPointerLeave:We?ln:void 0,onPointerOver:We?cn:void 0,role:`tree`,tabIndex:-1,style:{outline:`none`,position:`relative`},children:[q(`style`,{"data-file-tree-guide-style":`true`,dangerouslySetInnerHTML:{__html:wn}}),q(`slot`,{name:mt,"data-type":`header-slot`}),f?q(`div`,{"data-file-tree-search-container":!0,"data-open":it?`true`:`false`,children:q(`input`,{ref:w,"aria-activedescendant":Tn,"aria-controls":ft,placeholder:`Search…`,"data-file-tree-search-input":!0,"data-file-tree-search-input-fake-focus":Ie?`true`:void 0,value:at,onBlur:()=>{d===`retain`&&!Re.current||t.closeSearch()},onFocus:ze,onPointerDown:ze,onInput:e=>{ze();let n=e.currentTarget;t.setSearch(n.value)}})}):null,q(`div`,{ref:C,"data-file-tree-virtualized-scroll":`true`,children:[h&&He&&St.length>0?q(`div`,{"aria-hidden":`true`,"data-file-tree-sticky-overlay":`true`,children:q(`div`,{"data-file-tree-sticky-overlay-content":`true`,style:{height:`${pt}px`},children:St.map((e,t)=>qc(Rn,e.row,`sticky:${cc(e.row)}`,{mode:`sticky`,style:{left:`0`,position:`absolute`,right:`0`,top:`${e.top}px`,zIndex:`${St.length-t}`}}))})}):null,q(`div`,{ref:b,"data-file-tree-virtualized-list":`true`,style:{height:`${wt}px`},children:[q(`div`,{"data-file-tree-virtualized-sticky-offset":`true`,"aria-hidden":`true`,style:{height:`${mn}px`}}),q(`div`,{"data-file-tree-virtualized-sticky":`true`,style:{height:`${pn}px`,top:`${hn}px`,bottom:`${gn}px`},children:[Jc(Ln,xt,Et),vn!=null&&yn!=null?qc(Ln,vn,`parked:${vn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:dt===vn.path?`none`:void 0,position:`absolute`,right:`0`,top:`${yn}px`}}):null,Sn!=null&&Cn!=null?qc(Ln,Sn,`parked-drag:${Sn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:`none`,position:`absolute`,right:`0`,top:`${Cn}px`}}):null]})]})]}),We?q(`div`,{ref:_,"data-type":`context-menu-anchor`,"data-visible":An?`true`:`false`,style:Nn,children:[q(`button`,{ref:v,type:`button`,"data-type":gt,"aria-label":`Options`,"aria-haspopup":`menu`,"aria-expanded":L==null?`false`:`true`,"data-visible":kn?`true`:`false`,onMouseDown:e=>{e.preventDefault()},onClick:e=>{if(e.preventDefault(),e.stopPropagation(),L!=null){Pt();return}In()},tabIndex:-1,style:Pn,children:q(Uo,{...et(`file-tree-icon-ellipsis`)})}),L==null?null:q(`slot`,{name:ht})]}):null,L==null?null:q(`div`,{"data-type":`context-menu-wash`,"aria-hidden":`true`,onMouseDownCapture:e=>{e.preventDefault(),Pt()},onTouchStartCapture:e=>{e.preventDefault(),e.stopPropagation(),Pt()},onTouchMoveCapture:e=>{e.preventDefault(),e.stopPropagation()},onWheelCapture:e=>{e.preventDefault(),e.stopPropagation()}})]})}var Xc={hydrateRoot:(e,t)=>{Ro(mo(Yc,t),e)},renderRoot:(e,t)=>{Lo(mo(Yc,t),e)},unmountRoot:e=>{Lo(null,e)}};function Zc(e,t){Xc.renderRoot(e,t)}function Qc(e,t){Xc.hydrateRoot(e,t)}function $c(e){Xc.unmountRoot(e)}var el=class{#e=new Map;#t=null;clearAll(){for(let e of this.#e.values())e.remove();this.#e.clear()}clearSlotContent(e){let t=this.#n(e);t!=null&&(t.remove(),this.#e.delete(e))}setHost(e){if(this.#t=e,e!=null){this.#i(e);for(let[e,t]of this.#e)this.#r(e,t)}}setSlotContent(e,t){let n=this.#n(e);if(n===t){t!=null&&(this.#e.set(e,t),this.#r(e,t));return}if(n?.remove(),t==null){this.#e.delete(e);return}this.#e.set(e,t),this.#r(e,t)}setSlotHtml(e,t){let n=t?.trim()??``;if(n.length===0){this.setSlotContent(e,null);return}let r=this.#n(e);if(r!=null&&r.innerHTML===n){this.#e.set(e,r),this.#r(e,r);return}let i=document.createElement(`div`);i.innerHTML=n,this.setSlotContent(e,i)}#n(e){let t=this.#e.get(e)??null;if(t!=null)return t;let n=this.#t;if(n==null)return null;for(let t of Array.from(n.children))if(t instanceof HTMLElement&&t.dataset.fileTreeManagedSlot===e)return t;return null}#r(e,t){t.slot=e,t.dataset.fileTreeManagedSlot=e,this.#t!=null&&t.parentNode!==this.#t&&this.#t.appendChild(t)}#i(e){for(let t of Array.from(e.children)){if(!(t instanceof HTMLElement))continue;let e=t.dataset.fileTreeManagedSlot;e==null||this.#e.has(e)||this.#e.set(e,t)}}},tl=`__c`,nl=`__k`,rl=`__d`,il=`__s`,al=/[\s\n\\/='"\0<>]/,ol=/^(xlink|xmlns|xml)([A-Z])/,sl=/^(?:accessK|auto[A-Z]|cell|ch|col|cont|cross|dateT|encT|form[A-Z]|frame|hrefL|inputM|maxL|minL|noV|playsI|popoverT|readO|rowS|src[A-Z]|tabI|useM|item[A-Z])/,cl=/^ac|^ali|arabic|basel|cap|clipPath$|clipRule$|color|dominant|enable|fill|flood|font|glyph[^R]|horiz|image|letter|lighting|marker[^WUH]|overline|panose|pointe|paint|rendering|shape|stop|strikethrough|stroke|text[^L]|transform|underline|unicode|units|^v[^i]|^w|^xH/,ll=new Set([`draggable`,`spellcheck`]);function ul(e){e.__g===void 0?e[rl]=!0:e.__g|=8}function dl(e){e.__g===void 0?e[rl]=!1:e.__g&=-9}function fl(e){return e.__g===void 0?!0===e[rl]:!!(8&e.__g)}var pl=/["&<]/;function ml(e){if(e.length===0||!1===pl.test(e))return e;for(var t=0,n=0,r=``,i=``;n<e.length;n++){switch(e.charCodeAt(n)){case 34:i=`"`;break;case 38:i=`&`;break;case 60:i=`<`;break;default:continue}n!==t&&(r+=e.slice(t,n)),r+=i,t=n+1}return n!==t&&(r+=e.slice(t,n)),r}var hl={},gl=new Set(`animation-iteration-count.border-image-outset.border-image-slice.border-image-width.box-flex.box-flex-group.box-ordinal-group.column-count.fill-opacity.flex.flex-grow.flex-negative.flex-order.flex-positive.flex-shrink.flood-opacity.font-weight.grid-column.grid-row.line-clamp.line-height.opacity.order.orphans.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-miterlimit.stroke-opacity.stroke-width.tab-size.widows.z-index.zoom`.split(`.`)),_l=/[A-Z]/g;function vl(e){var t=``;for(var n in e){var r=e[n];if(r!=null&&r!==``){var i=n[0]==`-`?n:hl[n]||(hl[n]=n.replace(_l,`-$&`).toLowerCase()),a=`;`;typeof r!=`number`||i.startsWith(`--`)||gl.has(i)||(a=`px;`),t=t+i+`:`+r+a}}return t||void 0}function yl(){this.__d=!0}function bl(e,t){return{__v:e,context:t,props:e.props,setState:yl,forceUpdate:yl,__d:!0,__h:[]}}function xl(e,t,n){if(!e.s){if(n instanceof Sl){if(!n.s)return void(n.o=xl.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(xl.bind(null,e,t),xl.bind(null,e,2));e.s=t,e.v=n;let r=e.o;r&&r(e)}}var Sl=function(){function e(){}return e.prototype.then=function(t,n){var r=new e,i=this.s;if(i){var a=1&i?t:n;if(a){try{xl(r,1,a(this.v))}catch(e){xl(r,2,e)}return r}return this}return this.o=function(e){try{var i=e.v;1&e.s?xl(r,1,t?t(i):i):n?xl(r,1,n(i)):xl(r,2,i)}catch(e){xl(r,2,e)}},r},e}(),Cl,wl,Tl,El,Dl={},Ol=Array.isArray,kl=Object.assign,Al=``,jl=`<!--$s-->`,Ml=`<!--/$s-->`;function Nl(e,t){var n,r=e.type,i=!0;return e[tl]?(i=!1,(n=e[tl]).state=n[il]):n=new r(e.props,t),e[tl]=n,n.__v=e,n.props=e.props,n.context=t,ul(n),n.state??=Dl,n[il]??(n[il]=n.state),r.getDerivedStateFromProps?n.state=kl({},n.state,r.getDerivedStateFromProps(n.props,n.state)):i&&n.componentWillMount?(n.componentWillMount(),n.state=n[il]===n.state?n.state:n[il]):!i&&n.componentWillUpdate&&n.componentWillUpdate(),Tl&&Tl(e),n.render(n.props,n.state,t)}function Pl(e,t,n,r,i,a,o){if(e==null||!0===e||!1===e||e===Al)return Al;var s=typeof e;if(s!=`object`)return s==`function`?Al:s==`string`?ml(e):e+Al;if(Ol(e)){var c,l=Al;i[nl]=e;for(var u=e.length,d=0;d<u;d++){var f=e[d];if(f!=null&&typeof f!=`boolean`){var p,m=Pl(f,t,n,r,i,a,o);typeof m==`string`?l+=m:(c||=Array(u),l&&c.push(l),l=Al,Ol(m)?(p=c).push.apply(p,m):c.push(m))}}return c?(l&&c.push(l),c):l}if(e.constructor!==void 0)return Al;e.__=i,Cl&&Cl(e);var h=e.type,g=e.props;if(typeof h==`function`){var _,v,y,b=t;if(h===go){if(`tpl`in g){for(var x=Al,S=0;S<g.tpl.length;S++)if(x+=g.tpl[S],g.exprs&&S<g.exprs.length){var C=g.exprs[S];if(C==null)continue;typeof C!=`object`||C.constructor!==void 0&&!Ol(C)?x+=C:x+=Pl(C,t,n,r,e,a,o)}return x}if(`UNSTABLE_comment`in g)return`<!--`+ml(g.UNSTABLE_comment)+`-->`;v=g.children}else{if((_=h.contextType)!=null){var w=t[_.__c];b=w?w.props.value:_.__}var T=h.prototype&&typeof h.prototype.render==`function`;if(T)v=Nl(e,b),y=e[tl];else{e[tl]=y=bl(e,b);for(var E=0;fl(y)&&E++<25;){dl(y),Tl&&Tl(e);try{v=h.call(y,g,b)}catch(t){throw a&&t&&typeof t.then==`function`&&(e._suspended=!0),t}}ul(y)}if(y.getChildContext!=null&&(t=kl({},t,y.getChildContext())),T&&K.errorBoundaries&&(h.getDerivedStateFromError||y.componentDidCatch)){v=v!=null&&v.type===go&&v.key==null&&v.props.tpl==null?v.props.children:v;try{return Pl(v,t,n,r,e,a,!1)}catch(i){return h.getDerivedStateFromError&&(y[il]=h.getDerivedStateFromError(i)),y.componentDidCatch&&y.componentDidCatch(i,Dl),fl(y)?(v=Nl(e,t),(y=e[tl]).getChildContext!=null&&(t=kl({},t,y.getChildContext())),Pl(v=v!=null&&v.type===go&&v.key==null&&v.props.tpl==null?v.props.children:v,t,n,r,e,a,o)):Al}finally{wl&&wl(e),El&&El(e)}}}v=v!=null&&v.type===go&&v.key==null&&v.props.tpl==null?v.props.children:v;try{var D=Pl(v,t,n,r,e,a,o);return wl&&wl(e),K.unmount&&K.unmount(e),e._suspended?typeof D==`string`?jl+D+Ml:Ol(D)?(D.unshift(jl),D.push(Ml),D):D.then(function(e){return jl+e+Ml}):D}catch(i){if(!a&&o&&o.onError){var O=function i(s){return o.onError(s,e,function(e,s){try{return Pl(e,t,n,r,s,a,o)}catch(e){return i(e)}})}(i);if(O!==void 0)return O;var ee=K.__e;return ee&&ee(i,e),Al}if(!a||!i||typeof i.then!=`function`)throw i;return i.then(function i(){try{var s=Pl(v,t,n,r,e,a,o);return e._suspended?jl+s+Ml:s}catch(e){if(!e||typeof e.then!=`function`)throw e;return e.then(i)}})}}var k,A=`<`+h,j=Al;for(var M in g){var N=g[M];if(typeof(N=Il(N)?N.value:N)!=`function`||M===`class`||M===`className`){switch(M){case`children`:k=N;continue;case`key`:case`ref`:case`__self`:case`__source`:continue;case`htmlFor`:if(`for`in g)continue;M=`for`;break;case`className`:if(`class`in g)continue;M=`class`;break;case`defaultChecked`:M=`checked`;break;case`defaultSelected`:M=`selected`;break;case`defaultValue`:case`value`:switch(M=`value`,h){case`textarea`:k=N;continue;case`select`:r=N;continue;case`option`:r!=N||`selected`in g||(A+=` selected`)}break;case`dangerouslySetInnerHTML`:j=N&&N.__html;continue;case`style`:typeof N==`object`&&(N=vl(N));break;case`acceptCharset`:M=`accept-charset`;break;case`httpEquiv`:M=`http-equiv`;break;default:if(ol.test(M))M=M.replace(ol,`$1:$2`).toLowerCase();else{if(al.test(M))continue;M[4]!==`-`&&!ll.has(M)||N==null?n?cl.test(M)&&(M=M===`panose1`?`panose-1`:M.replace(/([A-Z])/g,`-$1`).toLowerCase()):sl.test(M)&&(M=M.toLowerCase()):N+=Al}}N!=null&&!1!==N&&(A=!0===N||N===Al?A+` `+M:A+` `+M+`="`+(typeof N==`string`?ml(N):N+Al)+`"`)}}if(al.test(h))throw Error(h+` is not a valid HTML tag name in `+A+`>`);if(j||(typeof k==`string`?j=ml(k):k!=null&&!1!==k&&!0!==k&&(j=Pl(k,t,h===`svg`||h!==`foreignObject`&&n,r,e,a,o))),wl&&wl(e),El&&El(e),!j&&Fl.has(h))return A+`/>`;var P=`</`+h+`>`,te=A+`>`;return Ol(j)?[te].concat(j,[P]):typeof j==`string`?te+j+P:[te,j,P]}var Fl=new Set([`area`,`base`,`br`,`col`,`command`,`embed`,`hr`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`]);function Il(e){return typeof e==`object`&&!!e&&typeof e.peek==`function`&&`value`in e}var Ll=0;function Rl(e){return e!=null&&e.length>0?e:(Ll+=1,`pst_ft_${Ll}`)}function zl({initialVisibleRowCount:e,itemHeight:t}){return e==null?420:Math.max(0,e)*(t??Yi)}function Bl(e){if(typeof document>`u`)return;let t=document.createElement(`div`);t.innerHTML=e;let n=t.querySelector(`svg`);return n instanceof SVGElement?n:void 0}function Vl(e){return e.querySelector(`#file-tree-icon-chevron`)instanceof SVGElement&&e.querySelector(`#file-tree-icon-file`)instanceof SVGElement&&e.querySelector(`#file-tree-icon-dot`)instanceof SVGElement&&e.querySelector(`#file-tree-icon-lock`)instanceof SVGElement}function Hl(e){return Array.from(e.children).filter(e=>e instanceof SVGElement)}var Ul=class{static LoadedCustomComponent=!0;#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=new el;#u;#d;#f;#p;#m;#h;#g;#_;#v;#y=null;#b;#x=!1;#S=!1;constructor(e){let{composition:t,density:n,fileTreeSearchMode:r,gitStatus:i,id:a,initialSearchQuery:o,icons:s,itemHeight:c,onSearchChange:l,onSelectionChange:u,overscan:d,renderRowDecoration:f,renaming:p,search:m,searchBlurBehavior:h,searchFakeFocus:g,stickyFolders:_,unsafeCSS:v,initialVisibleRowCount:y,...b}=e;this.#e=t,this.#n=Rl(a),this.#p=Za(i),this.#m=s,this.#h=v,this.#r=u,this.#i=f,this.#a=p!=null&&p!==!1,this.#o=h,this.#s=m===!0,this.#c=g===!0,this.#u=Ji(n,c),this.#d={itemHeight:this.#u.itemHeight,overscan:d,stickyFolders:_,initialVisibleRowCount:y},this.#t=new Ka({...b,fileTreeSearchMode:r,initialSearchQuery:o,onSearchChange:l,renaming:p}),this.#v=this.#t.getSelectionVersion(),this.#y=this.#r==null?null:this.subscribe(()=>{this.#D()})}unmount(){this.#b!=null&&($c(this.#b),delete this.#b.dataset.fileTreeVirtualizedWrapper,this.#b=void 0),this.#l.clearAll(),this.#l.setHost(null),this.#f!=null&&(delete this.#f.dataset.fileTreeVirtualized,this.#I(this.#f),this.#f=void 0)}cleanUp(){this.unmount(),this.#y?.(),this.#y=null,this.#t.destroy()}getFileTreeContainer(){return this.#f}getItem(e){return this.#t.getItem(e)}getFocusedItem(){return this.#t.getFocusedItem()}getFocusedPath(){return this.#t.getFocusedPath()}getSelectedPaths(){return this.#t.getSelectedPaths()}getComposition(){return this.#e}getItemHeight(){return this.#u.itemHeight}getDensityFactor(){return this.#u.factor}subscribe(e){let t=!1;return this.#t.subscribe(()=>{if(!t){t=!0;return}e()})}focusPath(e){this.#t.focusPath(e)}scrollToPath(e,t){this.#t.scrollToPath(e,t)}focusNearestPath(e){return this.#t.focusNearestPath(e)}add(e){this.#t.add(e)}batch(e){this.#t.batch(e)}move(e,t,n){this.#t.move(e,t,n)}onMutation(e,t){return this.#t.onMutation(e,t)}setSearch(e){this.#t.setSearch(e)}openSearch(e){this.#t.openSearch(e)}closeSearch(){this.#t.closeSearch()}isSearchOpen(){return this.#t.isSearchOpen()}getSearchValue(){return this.#t.getSearchValue()}getSearchMatchingPaths(){return this.#t.getSearchMatchingPaths()}focusNextSearchMatch(){this.#t.focusNextSearchMatch()}focusPreviousSearchMatch(){this.#t.focusPreviousSearchMatch()}startRenaming(e,t){return this.#t.startRenaming(e,t)}remove(e,t){this.#t.remove(e,t)}resetPaths(e,t){this.#t.resetPaths(e,t)}setComposition(e){this.#e=e;let t=this.#T();t!=null&&(this.#O(),Zc(t.wrapper,this.#w()))}setGitStatus(e){this.#p=Za(e,this.#p);let t=this.#T();t!=null&&Zc(t.wrapper,this.#w())}setIcons(e){this.#m=e;let t=this.#T();t!=null&&(this.#E(t.host,t.wrapper),Zc(t.wrapper,this.#w()))}hydrate({fileTreeContainer:e}){let t=this.#P(e),n=this.#N(t);this.#O(),Qc(n,this.#w())}render({containerWrapper:e,fileTreeContainer:t}){let n=this.#P(t??this.#f,e),r=this.#N(n);this.#O(),Zc(r,this.#w())}#C(){return{initialViewportHeight:zl({initialVisibleRowCount:this.#d.initialVisibleRowCount,itemHeight:this.#d.itemHeight}),itemHeight:this.#d.itemHeight,overscan:this.#d.overscan,stickyFolders:this.#d.stickyFolders}}#w(){return{composition:this.#e,controller:this.#t,gitStatusByPath:this.#p?.statusByPath,ignoredGitDirectories:this.#p?.ignoredDirectoryPaths,directoriesWithGitChanges:this.#p?.directoriesWithChanges,icons:this.#m,instanceId:this.#n,renamingEnabled:this.#a,renderRowDecoration:this.#i,searchBlurBehavior:this.#o,searchEnabled:this.#s,searchFakeFocus:this.#c,slotHost:this.#l,...this.#C()}}#T(){let e=this.#f,t=this.#b;return e==null||t==null?null:{host:e,wrapper:t}}#E(e,t){let n=e.shadowRoot;n!=null&&(this.#k(n),this.#A(n)),this.#j(t)}#D(){let e=this.#r;if(e==null)return;let t=this.#t.getSelectionVersion();t!==this.#v&&(this.#v=t,e(this.#t.getSelectedPaths()))}#O(){let e=this.#e?.header?.render;if(e!=null){this.#l.setSlotContent(mt,e());return}this.#l.setSlotHtml(mt,this.#e?.header?.html??null)}#k(e){let t=Hl(e).find(e=>Vl(e)),n=Bl(Ce(pe(this.#m).set));n!=null&&(t!=null&&t.outerHTML===n.outerHTML||(t==null?e.prepend(n):t.replaceWith(n)))}#A(e){let t=Hl(e),n=t.find(e=>Vl(e)),r=t.filter(e=>e!==n),i=pe(this.#m).spriteSheet?.trim()??``;if(i.length===0){for(let e of r)e.remove();return}let a=Bl(i);if(a==null){for(let e of r)e.remove();return}if(!(r.length===1&&r[0].outerHTML===a.outerHTML)){for(let e of r)e.remove();e.appendChild(a)}}#j(e){let t=pe(this.#m);t.colored&&Ee(t.set)?e.dataset.fileTreeColoredIcons=`true`:delete e.dataset.fileTreeColoredIcons}#M(e){let t=e.querySelector(`style[${ut}]`);if(this.#g==null&&t instanceof HTMLStyleElement&&(this.#g=t),this.#h==null||this.#h===``){this.#g?.remove(),this.#g=void 0,this.#_=void 0;return}this.#g?.parentNode===e&&this.#_===this.#h||(this.#g??=document.createElement(`style`),this.#g.setAttribute(ut,``),this.#g.parentNode!==e&&e.appendChild(this.#g),this.#g.textContent=$i(this.#h),this.#_=this.#h)}#N(e){if(this.#b!=null)return this.#b;let t=e.shadowRoot;if(t==null)throw Error(`FileTree requires a shadow root`);let n=Array.from(t.children).filter(e=>e instanceof HTMLDivElement&&typeof e.dataset.fileTreeId==`string`&&e.dataset.fileTreeId.length>0),r=n.find(e=>e.dataset.fileTreeId===this.#n)??n[0];return r!=null&&(this.#n=r.dataset.fileTreeId??this.#n),this.#b=r??document.createElement(`div`),this.#b.dataset.fileTreeId=this.#n,this.#b.dataset.fileTreeVirtualizedWrapper=`true`,this.#E(e,this.#b),this.#b.parentNode!==t&&t.appendChild(this.#b),this.#b}#P(e,t){let n=e??this.#f??document.createElement(`file-tree-container`);t!=null&&n.parentNode!==t&&t.appendChild(n);let r=n.shadowRoot??n.attachShadow({mode:`open`});return aa(n,r),this.#M(r),n.dataset.fileTreeVirtualized=`true`,n.style.display=`flex`,this.#F(n),this.#l.setHost(n),this.#f=n,n}#F(e){e.style.getPropertyValue(`--trees-item-height`)===``&&(e.style.setProperty(`--trees-item-height`,`${String(this.#u.itemHeight)}px`),this.#x=!0),e.style.getPropertyValue(`--trees-density-override`)===``&&(e.style.setProperty(`--trees-density-override`,String(this.#u.factor)),this.#S=!0)}#I(e){this.#x&&=(e.style.removeProperty(`--trees-item-height`),!1),this.#S&&=(e.style.removeProperty(`--trees-density-override`),!1)}},Y=e(n(),1),Wl=typeof window>`u`?Y.useEffect:Y.useLayoutEffect;function Gl({file:e,options:t,editorOptions:n,lineAnnotations:r,selectedLines:i,prerenderedHTML:a,metrics:o,hasGutterRenderUtility:s,hasCustomHeader:c,disableWorkerPool:l,edit:u}){let d=nt(),f=i!==void 0,p=(0,Y.useContext)(tt),m=se(),h=(0,Y.useRef)(null),g=ae(n=>{if(n!=null){if(h.current!=null)throw Error(`File: An instance should not already exist when a node is created`);d==null?h.current=new N(Kl({controlledSelection:f,hasCustomHeader:c,hasGutterRenderUtility:s,options:t}),l?void 0:p,!0):h.current=new M(Kl({controlledSelection:f,hasCustomHeader:c,hasGutterRenderUtility:s,options:t}),d,o,l?void 0:p,!0),h.current.hydrate({file:e,fileContainer:n,lineAnnotations:r,prerenderedHTML:a})}else{if(h.current==null)throw Error(`File: A File instance should exist when unmounting`);h.current.cleanUp(),h.current=null}});return Wl(()=>{if(h.current==null)return;let n=Kl({controlledSelection:f,hasCustomHeader:c,hasGutterRenderUtility:s,options:t}),a=n!==void 0&&!je(h.current.options,n);h.current.setOptions(n),h.current.render({file:e,lineAnnotations:r,forceRender:a}),i!==void 0&&h.current.setSelectedLines(i)}),Wl(()=>{if(u&&h.current!=null){if(m===void 0)throw Error(`File: EditContext is not attached`);let e=m(n??{});if(e==null)throw Error(`File: EditProvider.createEditor must return an editor instance`);try{return e.edit(h.current)}catch(t){throw e.cleanUp(),t}}},[u]),{ref:g,getHoveredLine:(0,Y.useCallback)(()=>h.current?.getHoveredLine(),[])}}function Kl({options:e,controlledSelection:t,hasCustomHeader:n,hasGutterRenderUtility:r}){return t||r||n?{...e,controlledSelection:t,renderCustomHeader:n?$e:e?.renderCustomHeader,renderGutterUtility:r?$e:e?.renderGutterUtility}:e}var X=t();function ql({file:e,lineAnnotations:t,selectedLines:n,options:r,editorOptions:i,metrics:a,className:o,style:s,renderAnnotation:c,renderCustomHeader:l,renderHeaderPrefix:u,renderHeaderFilenameSuffix:d,renderHeaderMetadata:f,prerenderedHTML:p,renderGutterUtility:m,disableWorkerPool:h=!1,edit:g=!1}){let{ref:_,getHoveredLine:v}=Gl({file:e,options:r,editorOptions:i,metrics:a,lineAnnotations:t,selectedLines:n,prerenderedHTML:p,hasGutterRenderUtility:m!=null,hasCustomHeader:l!=null,disableWorkerPool:h,edit:g});return(0,X.jsx)(le,{ref:_,className:o,style:s,children:Ae(P({file:e,renderAnnotation:c,renderCustomHeader:l,renderHeaderPrefix:u,renderHeaderFilenameSuffix:d,renderHeaderMetadata:f,renderGutterUtility:m,lineAnnotations:t,getHoveredLine:v}),p)})}var Jl=100,Yl=1,Xl=2,Zl=3,Ql=class{#e=[];#t=[];#n;#r=!1;constructor(e){this.#n=Math.max(1,e?.maxEntries??Jl)}get canUndo(){return this.#e.length>0}get canRedo(){return this.#t.length>0}clear(){this.#e.length=0,this.#t.length=0,this.#r=!1}clearRedo(){this.#t.length=0}push(e){this.#e.push(e),this.clearRedo(),this.#r=!0,this.#e.length>this.#n&&this.#e.shift()}setLastUndoSelectionsAfter(e){let t=this.#e[this.#e.length-1];t!==void 0&&(t.selectionsAfter=e.map(e=>({...e})))}setLastUndoLineAnnotations(e,t){let n=this.#e[this.#e.length-1];n!==void 0&&(n.lineAnnotationsBefore=e.slice(),n.lineAnnotationsAfter=t.slice())}peekUndo(){return this.#e[this.#e.length-1]}peekUndoForCoalescing(){return this.#r?this.peekUndo():void 0}replaceLastUndo(e){if(this.#e.length===0){this.push(e);return}this.#e[this.#e.length-1]=e,this.clearRedo(),this.#r=!0}popUndoToRedo(){let e=this.#e.pop();if(e!==void 0)return this.#t.push(e),this.#r=!1,e}popRedoToUndo(){let e=this.#t.pop();if(e!==void 0)return this.#e.push(e),this.#r=!1,e}};function $l(e,t,n,r,i,a,o,s){let c=[...t].sort((e,t)=>e.start-t.start),l=[],u;if(i?.length===c.length){let t=[];for(let n of i){if(n.start.line!==n.end.line||n.start.character!==n.end.character)break;t.push(e.offsetAt(n.start))}if(t.length===c.length){t.sort((e,t)=>e-t);let e=!0,n=!0;for(let r=0;r<c.length;r++){let i=c[r];if(i.text.length>0||i.start===i.end){e=!1,n=!1;break}e&&=t[r]===i.end,n&&=t[r]===i.start}u=e?Xl:n?Zl:void 0}}for(let t=0,n=0;t<c.length;t++){let r=c[t],i=e.getTextSlice(r.start,r.end),a=r.start+n;l.push({start:a,end:a+r.text.length,text:i}),n+=r.text.length-(r.end-r.start)}return{forwardEdits:c.map(e=>({...e})),inverseEdits:l,versionBefore:n,versionAfter:r,selectionsBefore:i?.map(e=>({...e})),selectionsAfter:a?.map(e=>({...e})),lineAnnotationsBefore:o?.slice(),lineAnnotationsAfter:s?.slice(),coalescingMode:u}}function eu(e,t){if(e===void 0||e.undoBoundary===!0||t.undoBoundary===!0||e.forwardEdits.length===0||e.forwardEdits.length!==e.inverseEdits.length||e.forwardEdits.length!==t.forwardEdits.length||t.forwardEdits.length!==t.inverseEdits.length)return!1;let n;for(let r=0;r<e.forwardEdits.length;r++){let i=e.forwardEdits[r],a=e.inverseEdits[r],o=t.forwardEdits[r],s=t.inverseEdits[r],c=ru(o.start,e.forwardEdits),l=i.start<=i.end&&i.text.length>0&&!i.text.includes(`
|
|
1672
|
+
`)&&!a.text.includes(`
|
|
1673
|
+
`),u=o.start===o.end&&o.text.length>0&&!o.text.includes(`
|
|
1674
|
+
`)&&s.text.length===0;if(l&&u){if(o.start!==a.end||(n??=Yl,n!==Yl||e.coalescingMode!==void 0&&e.coalescingMode!==Yl||t.coalescingMode!==void 0&&t.coalescingMode!==Yl))return!1;continue}let d=i.text.length===0&&i.end>i.start&&a.text.length>0,f=o.text.length===0&&o.end>o.start&&s.text.length>0;if(d&&f){let r;if(c===i.end)r=Zl;else if(c+(o.end-o.start)!==i.start)return!1;else r=Xl;if(n??=r,n!==r||e.coalescingMode!==void 0&&e.coalescingMode!==r||t.coalescingMode!==void 0&&t.coalescingMode!==r)return!1;continue}return!1}return n!==void 0}function tu(e,t){let n=[],r=[],i;for(let a=0;a<e.forwardEdits.length;a++){let o=e.forwardEdits[a],s=e.inverseEdits[a],c=t.forwardEdits[a],l=t.inverseEdits[a],u=ru(c.start,e.forwardEdits);if(o.text.length>0){i??=Yl,n.push({start:o.start,end:o.end,text:o.text+c.text}),r.push(s.text);continue}if(u===o.end){i??=Zl,n.push({start:o.start,end:u+(c.end-c.start),text:``}),r.push(s.text+l.text);continue}i??=Xl,n.push({start:Math.min(o.start,u),end:o.end,text:``}),r.push(l.text+s.text)}return{forwardEdits:n,inverseEdits:nu(n,r),versionBefore:e.versionBefore,versionAfter:t.versionAfter,selectionsBefore:e.selectionsBefore?.slice(),selectionsAfter:t.selectionsAfter?.slice(),lineAnnotationsBefore:e.lineAnnotationsBefore?.slice(),lineAnnotationsAfter:t.lineAnnotationsAfter?.slice(),coalescingMode:i}}function nu(e,t){let n=[];for(let r=0,i=0;r<e.length;r++){let a=e[r],o=a.start+i;n.push({start:o,end:o+a.text.length,text:t[r]}),i+=a.text.length-(a.end-a.start)}return n}function ru(e,t){let n=e;for(let e of t){let t=e.end-e.start,r=e.text.length,i=r-t;if(!(n<e.start)){if(n>=e.start+r){n-=i;continue}n=e.start+Math.min(n-e.start,t)}}return n}var iu=1e5,au=10,ou=13,su=`\`~!@#$%^&*()-=+[{]}\\|;:'",.<>/?`,cu=class{source;offset;length;lineOffsetStart;lineOffsetEnd;hasVirtualTrailingCRBreak;firstCharCode;lastCharCode;static Original=0;static Added=1;constructor(e,t,n,r,i,a,o,s){this.source=e,this.offset=t,this.length=n,this.lineOffsetStart=r,this.lineOffsetEnd=i,this.hasVirtualTrailingCRBreak=a,this.firstCharCode=o,this.lastCharCode=s}get lineBreakCount(){return this.lineOffsetEnd-this.lineOffsetStart+ +!!this.hasVirtualTrailingCRBreak}},lu=class{text;lineOffsets;constructor(e){this.text=e,this.lineOffsets=I(e)}append(e){let t=this.text.length;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);r!==au&&r!==ou||(r===ou&&e.charCodeAt(n+1)===au&&n++,this.lineOffsets.push(t+n+1))}return this.text+=e,t}},uu=class{piece;subtreeLength;subtreeLineBreakCount;subtreeFirstCharCode;subtreeLastCharCode;left=null;right=null;parent=null;priority=0;constructor(e,t=e.length,n=e.lineBreakCount,r=e.firstCharCode,i=e.lastCharCode){this.piece=e,this.subtreeLength=t,this.subtreeLineBreakCount=n,this.subtreeFirstCharCode=r,this.subtreeLastCharCode=i}updateSubtreeLength(){this.subtreeLength=(this.left?.subtreeLength??0)+this.piece.length+(this.right?.subtreeLength??0),this.subtreeLineBreakCount=(this.left?.subtreeLineBreakCount??0)+this.piece.lineBreakCount+(this.right?.subtreeLineBreakCount??0)-+!!yu(this.left?.subtreeLastCharCode,this.piece.firstCharCode)-!!yu(this.piece.lastCharCode,this.right?.subtreeFirstCharCode),this.subtreeFirstCharCode=this.left?.subtreeFirstCharCode??this.piece.firstCharCode,this.subtreeLastCharCode=this.right?.subtreeLastCharCode??this.piece.lastCharCode}},du=class{#e;#t=new lu(``);#n=null;#r=0;#i=0;#a=null;#o=null;#s=null;#c=2654435769;constructor(e){this.#e=new lu(e);let t=this.#y(cu.Original,0,e.length);this.#n=t.length>0?this.#C(t):null,this.#r=this.#n?.subtreeLength??0,this.#i=(this.#n?.subtreeLineBreakCount??0)+1}get lineCount(){return this.#i}getText(e){if(e===void 0)return this.#g();let t=this.offsetAt(e.start),n=this.offsetAt(e.end);return this.getTextSlice(t,n)}getLineText(e,t=!1){if(this.#a!==null&&this.#a[0]===e&&this.#a[1]===t)return this.#a[2];let n=this.#f(e);if(n===void 0)throw Error(`Line index out of range: ${e}`);let r=this.getTextSlice(n[0],n[1],!t);return this.#a=[e,t,r],this.#o=[e,t,r.length],r}getLineLength(e,t=!1){let n=this.#o,r=this.#a;if(n!==null&&n[0]===e&&n[1]===t)return n[2];if(r!==null&&r[0]===e&&r[1]===t){let n=r[2].length;return this.#o=[e,t,n],n}let i=this.#f(e);if(i===void 0)throw Error(`Line index out of range: ${e}`);let[a,o]=i,s=o-a;if(!t)for(;s>0&&fu(this.charAt(a+s-1).charCodeAt(0));)s--;return this.#o=[e,t,s],s}getTextSlice(e,t,n=!1){if(e>=t)return``;let r=pu(e,0,this.#r),i=pu(t,r,this.#r);if(r>=i)return``;let a=this.#u(r);if(a===void 0)return``;let o=[],[s,c]=a,l=i-r;for(;s!==null&&l>0;){let e=Math.min(s.piece.length-c,l),t=this.#v(s.piece.source),r=s.piece.offset+c,i=r+e;if(n)for(;i>r&&fu(t.text.charCodeAt(i-1));)i--;o.push(t.text.slice(r,i)),l-=e,c=0,s=this.#d(s)}return o.join(``)}charAt(e){let t=this.#u(e);if(t===void 0)return``;let[n,r]=t;return this.#v(n.piece.source).text.charAt(n.piece.offset+r)}includes(e){if(e.length===0)return!0;let t=mu(e),n=0,r=!1;return this.#_(i=>{for(let a=i.start;a<i.end;a++){let o=i.text.charCodeAt(a);for(;n>0&&o!==e.charCodeAt(n);)n=t[n-1];if(o===e.charCodeAt(n)&&n++,n===e.length)return r=!0,!1}return!0}),r}findNextNonOverlappingSubstring(e,t){if(e.length===0||e.length>this.#r)return;let n=hu(t,this.#r),r=n.reduce((e,[,t])=>Math.max(e,t),0),i=mu(e),a=0,o=0,s,c;return this.#_(t=>{for(let l=t.start;l<t.end;l++){let u=t.text.charCodeAt(l);for(;a>0&&u!==e.charCodeAt(a);)a=i[a-1];if(u===e.charCodeAt(a)&&a++,a===e.length){let t=o-e.length+1;if(!gu(n,t,t+e.length)){if(t>=r)return c=t,!1;s??=t}a=i[a-1]}o++}return!0}),c??s}search(e){if(e.text.length===0||this.#r===0||e.text.includes(`
|
|
1675
|
+
`)||e.text.includes(`\r`)||e.regex&&(e.text.includes(`\\n`)||e.text.includes(`\\r`)))return[];let t;try{t=wu(e.text,e.regex,e.caseSensitive)}catch{return[]}return this.#l(t,e.wholeWord,iu)}#l(e,t,n){let r=[],i=this.#g(),a=i.length,o=I(i);for(let s=0;s<o.length;s++){let c=o[s],l=o[s+1]??a;for(;l>c&&fu(i.charCodeAt(l-1));)l--;let u=i.slice(c,l);e.lastIndex=0;let d;for(;(d=e.exec(u))!==null;){let a=d.index,o=d[0];if(o.length===0){e.lastIndex=Du(u,a);continue}let s=c+a;if((!t||Cu(i,s,o.length))&&(r.push([s,s+o.length]),r.length>=n))return r;a===e.lastIndex&&(e.lastIndex=Du(u,a))}}return r}insert(e,t){if(e.length===0)return;let n=pu(t,0,this.#r);this.#b(n,n,e),this.#x()}delete(e,t){if(t<=0||this.#r===0)return;let n=pu(e,0,this.#r),r=pu(n+t,n,this.#r);n!==r&&(this.#b(n,r,``),this.#x())}applyEdits(e){if(e.length!==0){for(let t=e.length-1;t>=0;t--){let n=e[t],r=pu(n.start,0,this.#r),i=pu(n.end,r,this.#r);this.#b(r,i,n.text)}this.#x()}}positionAt(e){let t=pu(e,0,this.#r);if(this.#r===0)return{line:0,character:0};let n=this.#p(t),r=t-(n===0?0:this.#m(n-1));return this.#s=[n,r,t],{line:n,character:r}}positionsAt(e){let t=Array.from({length:e.length});if(e.length===0)return t;if(this.#r===0)return t.fill({line:0,character:0});for(let n=0;n<e.length;n++)t[n]=this.positionAt(e[n]);return t}offsetAt(e){if(e.line<0||this.#r===0)return 0;if(e.line>=this.#i)throw Error(`Line index out of range: ${e.line}`);let t=this.#s;if(t!==null&&t[0]===e.line&&t[1]===e.character)return t[2];let n=this.#f(e.line);if(n===void 0)throw Error(`Line index out of range: ${e.line}`);let r=pu(e.character,0,n[1]-n[0]);return n[0]+r}#u(e){if(e<0||e>=this.#r)return;let t=this.#n,n=e;for(;t!==null;){let e=t.left?.subtreeLength??0;if(n<e){t=t.left;continue}if(n-=e,n<t.piece.length)return[t,n];n-=t.piece.length,t=t.right}}#d(e){if(e.right!==null){let t=e.right;for(;t.left!==null;)t=t.left;return t}let t=e;for(;t.parent!==null&&t===t.parent.right;)t=t.parent;return t.parent}#f(e){if(e<0)throw Error(`Line index out of range: ${e}`);if(this.#r===0){if(e===0)return[0,0];throw Error(`Line index out of range: ${e}`)}if(e>=this.#i)throw Error(`Line index out of range: ${e}`);return[e===0?0:this.#m(e-1),e<this.#i-1?this.#m(e):this.#r]}#p(e){let t=this.#n,n=pu(e,0,this.#r),r=0;for(;t!==null;){let e=t.left?.subtreeLength??0;if(n<e){t=t.left;continue}if(r+=(t.left?.subtreeLineBreakCount??0)-+!!yu(t.left?.subtreeLastCharCode,t.piece.firstCharCode),n-=e,n<=t.piece.length){let e=this.#v(t.piece.source),i=Math.min(bu(e.lineOffsets,t.piece.offset+n),t.piece.lineOffsetEnd);return r+=i-t.piece.lineOffsetStart,n===t.piece.length&&t.piece.hasVirtualTrailingCRBreak&&r++,n===t.piece.length&&yu(t.piece.lastCharCode,this.#d(t)?.piece.firstCharCode)&&r--,r}r+=t.piece.lineBreakCount-+!!yu(t.piece.lastCharCode,t.right?.subtreeFirstCharCode),n-=t.piece.length,t=t.right}return this.#i-1}#m(e){let t=this.#n,n=e,r=0,i;for(;t!==null;){let e=(t.left?.subtreeLineBreakCount??0)-+!!yu(t.left?.subtreeLastCharCode,t.piece.firstCharCode);if(n<e){i=t.piece.firstCharCode,t=t.left;continue}let a=t.left?.subtreeLength??0;r+=a,n-=e;let o=t.right?.subtreeFirstCharCode??i,s=t.piece.lineBreakCount-+!!yu(t.piece.lastCharCode,o);if(n<s)return r+this.#h(t.piece,n);r+=t.piece.length,n-=s,t=t.right}return this.#r}#h(e,t){return t<e.lineOffsetEnd-e.lineOffsetStart?this.#v(e.source).lineOffsets[e.lineOffsetStart+t]-e.offset:e.length}#g(){let e=[];return this.#_(t=>{e.push(t.text.slice(t.start,t.end))}),e.join(``)}#_(e){this.#j(this.#n,t=>{let n=this.#v(t.piece.source);return e({text:n.text,lineOffsets:n.lineOffsets,lineOffsetStart:t.piece.lineOffsetStart,lineOffsetEnd:t.piece.lineOffsetEnd,start:t.piece.offset,end:t.piece.offset+t.piece.length})})}#v(e){return e===cu.Original?this.#e:this.#t}#y(e,t,n){let r=this.#v(e),i=t+n,a=bu(r.lineOffsets,t),o=bu(r.lineOffsets,i),s=r.text.charCodeAt(i-1);return new cu(e,t,n,a,o,s===ou&&r.lineOffsets[o-1]!==i,r.text.charCodeAt(t),s)}#b(e,t,n){if(e===t&&n.length===0)return;let[r,i]=this.#E(this.#n,e),a=this.#D(i,t-e),o;if(n.length>0){let e=this.#y(cu.Added,this.#t.append(n),n.length);o=this.#O(this.#k(r,e),a)}else{let[e,t]=this.#A(a);o=e===void 0?r:this.#O(this.#k(r,e),t)}o!==null&&(o.parent=null),this.#n=o,this.#r=o?.subtreeLength??0,this.#i=(o?.subtreeLineBreakCount??0)+1}#x(){this.#a=null,this.#o=null,this.#s=null}#S(){return this.#c=Math.imul(this.#c,1664525)+1013904223>>>0,this.#c}#C(e){let t=new uu(e);return t.priority=this.#S(),t}#w(e,t){e.left=t,t!==null&&(t.parent=e)}#T(e,t){e.right=t,t!==null&&(t.parent=e)}#E(e,t){if(e===null)return[null,null];if(t<=0)return[null,e];if(t>=e.subtreeLength)return[e,null];let n=e.left?.subtreeLength??0;if(t<=n){let[n,r]=this.#E(e.left,t);return this.#w(e,r),e.updateSubtreeLength(),[n,e]}let r=e.piece.length;if(t>=n+r){let[i,a]=this.#E(e.right,t-n-r);return this.#T(e,i),e.updateSubtreeLength(),[e,a]}let i=t-n,a=new uu(this.#y(e.piece.source,e.piece.offset,i)),o=new uu(this.#y(e.piece.source,e.piece.offset+i,r-i));return a.priority=e.priority,o.priority=e.priority,this.#w(a,e.left),this.#T(o,e.right),a.updateSubtreeLength(),o.updateSubtreeLength(),[a,o]}#D(e,t){if(e===null||t>=e.subtreeLength)return null;if(t<=0)return e;let n=e.left?.subtreeLength??0;if(t<=n)return this.#w(e,this.#D(e.left,t)),e.updateSubtreeLength(),e;let r=n+e.piece.length;if(t>=r)return this.#D(e.right,t-r);let i=t-n,a=new uu(this.#y(e.piece.source,e.piece.offset+i,e.piece.length-i));return a.priority=e.priority,this.#T(a,e.right),a.updateSubtreeLength(),a}#O(e,t){return e===null?t:t===null?e:e.priority>=t.priority?(this.#T(e,this.#O(e.right,t)),e.updateSubtreeLength(),e):(this.#w(t,this.#O(e,t.left)),t.updateSubtreeLength(),t)}#k(e,t){if(e===null)return this.#C(t);let n=e;for(;n.right!==null;)n=n.right;if(_u(n.piece,t)){n.piece=vu(n.piece,t);for(let t=n;t!==null&&(t.updateSubtreeLength(),t!==e);)t=t.parent;return e}return this.#O(e,this.#C(t))}#A(e){if(e===null)return[void 0,null];if(e.left===null)return[e.piece,e.right];let[t,n]=this.#A(e.left);return this.#w(e,n),e.updateSubtreeLength(),[t,e]}#j(e,t){return e===null?!0:!this.#j(e.left,t)||t(e)===!1?!1:this.#j(e.right,t)}};function fu(e){return e===10||e===13}function pu(e,t,n){return Math.min(Math.max(e,t),n)}function mu(e){let t=Array.from({length:e.length}).fill(0),n=0;for(let r=1;r<e.length;r++){let i=e.charCodeAt(r);for(;n>0&&i!==e.charCodeAt(n);)n=t[n-1];i===e.charCodeAt(n)&&n++,t[r]=n}return t}function hu(e,t){let n=[];for(let[r,i]of e){let e=pu(r,0,t),a=pu(i,e,t);e<a&&n.push([e,a])}n.sort((e,t)=>e[0]-t[0]);let r=[];for(let e of n){let t=r[r.length-1];if(t!==void 0&&e[0]<=t[1]){t[1]=Math.max(t[1],e[1]);continue}r.push(e)}return r}function gu(e,t,n){let r=0,i=e.length;for(;r<i;){let n=r+Math.floor((i-r)/2);e[n][1]<=t?r=n+1:i=n}let a=e[r];return a!==void 0&&a[0]<n}function _u(e,t){return e.source===t.source&&e.offset+e.length===t.offset&&!yu(e.lastCharCode,t.firstCharCode)}function vu(e,t){return new cu(e.source,e.offset,e.length+t.length,e.lineOffsetStart,t.lineOffsetEnd,t.hasVirtualTrailingCRBreak,e.firstCharCode,t.lastCharCode)}function yu(e,t){return e===ou&&t===au}function bu(e,t){let n=0,r=e.length;for(;n<r;){let i=n+Math.floor((r-n)/2);e[i]<=t?n=i+1:r=i}return n}function xu(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Su(e){if(e<=32||e===127)return!0;let t=String.fromCharCode(e);return su.includes(t)}function Cu(e,t,n){let r=t<=0||Su(e.charCodeAt(t-1)),i=t+n>=e.length||Su(e.charCodeAt(t+n));return r&&i}function wu(e,t,n){let r=t?e:xu(e);return new RegExp(r,`g${n?``:`i`}${t?`m`:``}`)}function Tu(e,t){return e.replace(/\$([$&]|\d+)/g,(e,n)=>n===`$`?`$`:n===`&`?t[0]??``:t[Number(n)]??``)}function Eu(e,t,n,r,i,a){if(!r.regex)return r.replaceText;let o=e(i),s=n(o.line),c=i-t({line:o.line,character:0}),l;try{l=wu(r.text,!0,r.caseSensitive)}catch{return r.replaceText}l.lastIndex=c;let u=l.exec(s);return u===null||u.index!==c||u[0].length!==a-i?r.replaceText:Tu(r.replaceText,u)}function Du(e,t){if(t+1<e.length){let n=e.charCodeAt(t),r=e.charCodeAt(t+1);if(n>=55296&&n<=56319&&r>=56320&&r<=57343)return t+2}return t+1}var Ou=class e{#e;#t;#n;#r;#i;#a;constructor(e,t,n=`text`,r=0,i=new Ql){this.#e=new URL(e,`file://`).toString(),this.#t=n,this.#n=r,this.#r=new du(t),this.#i=i;let a=this.#r.getLineText(0,!0);a.endsWith(`\r
|
|
1676
|
+
`)?this.#a=`\r
|
|
1677
|
+
`:a.endsWith(`\r`)?this.#a=`\r`:this.#a=`
|
|
1678
|
+
`}get uri(){return this.#e}get languageId(){return this.#t}get version(){return this.#n}get lineCount(){return this.#r.lineCount}get eol(){return this.#a}get canUndo(){return this.#i.canUndo}get canRedo(){return this.#i.canRedo}positionAt(e){return this.normalizePosition(this.#r.positionAt(e))}positionsAt(e){let t=this.#r.positionsAt(e);for(let e=0;e<t.length;e++)t[e]=this.normalizePosition(t[e]);return t}offsetAt(e){return this.#r.offsetAt(this.normalizePosition(e))}getText(e){return e===void 0?this.#r.getText():this.#r.getText({start:this.normalizePosition(e.start),end:this.normalizePosition(e.end)})}getLineText(e,t){return this.#r.getLineText(e,t)}normalizeEol(e){return e.replace(/\r\n|\r|\n/g,this.eol)}getLineLength(e,t){return this.#r.getLineLength(e,t)}charAt(e){return typeof e==`number`?this.#r.charAt(e):this.#r.charAt(this.offsetAt(e))}getTextSlice(e,t){return this.#r.getTextSlice(e,t)}findNextNonOverlappingSubstring(e,t){return this.#r.findNextNonOverlappingSubstring(e,t)}search(e){return this.#r.search(e)}applyEdits(e,t=!0,n,r,i=!1){if(e.length!==0)return this.#o(this.#d(this.resolveEdits(e)),t,n,r,i)}resolveEdits(e){return e.map(e=>this.#c(e))}applyResolvedEdits(e,t=!0,n,r,i=!1){if(e.length!==0)return this.#o(this.#d(e.map(e=>this.#l(e))),t,n,r,i)}#o(e,t,n,r,i){let a=$l(this,e,this.#n,this.#n+1,t?n:void 0,t?r:void 0);t&&i&&(a.undoBoundary=!0);let o=this.#i.peekUndoForCoalescing(),s=this.#f(e);return this.#n++,s.lineDelta===0&&eu(o,a)?this.#i.replaceLastUndo(tu(o,a)):this.#i.push(a),s}setLastUndoSelectionsAfter(e){this.#i.setLastUndoSelectionsAfter(e)}setLastUndoLineAnnotations(e,t){this.#i.setLastUndoLineAnnotations(e,t)}undo(){let e=this.#i.popUndoToRedo();if(e===void 0)return;let t=this.#f(e.inverseEdits);if(t===void 0)return;this.#n=e.versionBefore;let n=e.selectionsBefore?.slice();return[t,n,e.lineAnnotationsBefore?.slice(),n===void 0?e.inverseEdits.map(e=>({...e})):void 0]}redo(){let e=this.#i.popRedoToUndo();if(e===void 0)return;let t=this.#f(e.forwardEdits);if(t===void 0)return;this.#n=e.versionAfter;let n=e.selectionsAfter?.slice();return[t,n,e.lineAnnotationsAfter?.slice(),n===void 0?e.forwardEdits.map(e=>({...e})):void 0]}normalizePosition(t){let n=e.#s(t.line,this.lineCount-1);return{line:n,character:e.#s(t.character,this.getLineLength(n))}}static#s(e,t){return Number.isNaN(e)?0:Math.max(0,Math.min(Math.floor(e),t))}#c(e){let t=this.offsetAt(e.range.start),n=this.offsetAt(e.range.end);if(t>n){let e=t;t=n,n=e}return this.#l({start:t,end:n,text:e.newText})}#l(e){let{start:t,end:n}=e,r=t===n;return this.#u(t)&&t--,r?n=t:this.#u(n)&&n++,{start:t,end:n,text:e.text}}#u(e){let t=this.#r.charAt(e-1).charCodeAt(0),n=this.#r.charAt(e).charCodeAt(0);return t>=55296&&t<=56319&&n>=56320&&n<=57343}#d(e){let t=[...e].sort((e,t)=>{let n=e.start-t.start;return n===0?e.end-t.end:n});for(let e=0;e<t.length-1;e++)if(t[e].end>t[e+1].start)throw Error(`Overlapping text edits are not supported`);return t}#f(e){let t=this.#r.lineCount,n=this.positionsAt(e.flatMap(e=>[e.start,e.end])),r=this.#p(e,n),i=n[0],a=n[n.length-1],o=a.line===t-1&&a.character===this.#r.getLineLength(a.line);this.#r.applyEdits(e);let s=this.#r.lineCount;return{changes:e.map((e,t)=>({...e,range:{start:n[t*2],end:n[t*2+1]}})),startLine:r.startLine,startCharacter:i.character,endCharacter:a.character,endLine:Math.min(r.endLine,Math.max(0,s-1)),endedAtDocumentEnd:o,previousLineCount:t,lineCount:s,lineDelta:s-t,changedLineRanges:r.ranges,changedLineChanges:r.changes}}#p(e,t){let n=1/0,r=0,i=0,a=[],o=[],s=this.#r.lineCount-1,c=this.#r.getLineLength(s);for(let l=0;l<e.length;l++){let u=e[l],d=t[l*2],f=t[l*2+1],p=d.line,m=f.line,h=L(u.text),g=p+i,_=g+h,v=h-(m-p);n=Math.min(n,p),r=Math.max(r,_);let y=a[a.length-1];y!==void 0&&g<=y[1]+1?a[a.length-1]=[y[0],Math.max(y[1],_)]:a.push([g,_]),o.push([g,_,v,d.character,f.character,m===s&&f.character===c]),i+=v}return n===1/0?{startLine:0,endLine:0,ranges:[[0,0]],changes:[[0,0,0,0,0,!1]]}:{startLine:n,endLine:r,ranges:a,changes:o}}};function ku({metaKey:e,ctrlKey:t},n=ze()){return n?e&&!t:t&&!e}function Au(e){if(ze()&&e.ctrlKey&&!e.altKey&&!e.metaKey)switch(e.key){case`a`:return`start`;case`e`:return`end`;case`p`:return`up`;case`n`:return`down`;case`f`:return`right`;case`b`:return`left`}if(!e.altKey&&!e.ctrlKey&&!e.metaKey){if(e.key===`ArrowUp`)return`up`;if(e.key===`ArrowDown`)return`down`;if(e.key===`ArrowLeft`)return`left`;if(e.key===`ArrowRight`)return`right`;if(e.key===`Home`)return`start`;if(e.key===`End`)return`end`}if(ku(e)){if(e.key===`ArrowLeft`)return`textStart`;if(e.key===`ArrowRight`)return`end`}}var ju=new WeakMap,Mu=Pu([{bindings:{Tab:`indent`,"shift+Tab":`outdent`,"cmdOrCtrl+[":`indentLess`,"cmdOrCtrl+]":`indentMore`,"cmdOrCtrl+z":`undo`,"cmdOrCtrl+shift+z":`redo`,"cmdOrCtrl+a":`selectAll`,"cmdOrCtrl+d":`findNextMatch`,"cmdOrCtrl+f":`openSearchPanel`,"cmdOrCtrl+alt+f":`openSearchReplacePanel`,"alt+ArrowUp":`moveLineUp`,"alt+ArrowDown":`moveLineDown`,"shift+alt+ArrowUp":`copyLineUp`,"shift+alt+ArrowDown":`copyLineDown`,Escape:`simplifySelection`,"cmdOrCtrl+Enter":`insertBlankLine`,"cmdOrCtrl+/":`toggleComment`,"shift+alt+a":`toggleBlockComment`,"cmdOrCtrl+Home":`moveCursorToDocStart`,"cmdOrCtrl+End":`moveCursorToDocEnd`,"cmdOrCtrl+shift+Home":`expandSelectionDocStart`,"cmdOrCtrl+shift+End":`expandSelectionDocEnd`}},{platform:`mac`,bindings:{"ctrl+k":`deleteHardLineForward`,"ctrl+alt+p":`moveLineUp`,"ctrl+alt+n":`moveLineDown`,"cmd+ArrowUp":`moveCursorToDocStart`,"cmd+ArrowDown":`moveCursorToDocEnd`,"cmd+shift+ArrowUp":`expandSelectionDocStart`,"cmd+shift+ArrowDown":`expandSelectionDocEnd`}},{platform:`windows`,bindings:{"ctrl+y":`redo`}},{platform:`linux`,bindings:{"ctrl+y":`redo`,"ctrl+alt+p":`moveLineUp`,"ctrl+alt+n":`moveLineDown`}}]),Nu={Backquote:"`",Minus:`-`,Equal:`=`,Comma:`,`,Period:`.`,Slash:`/`,Semicolon:`;`,Quote:`'`,BracketLeft:`[`,BracketRight:`]`,Backslash:`\\`,Space:`Space`};function Pu(e){let t=ju.get(e);if(t===void 0){t={mac:new Map,windows:new Map,linux:new Map};for(let n of e)for(let e of Object.keys(n.bindings)){let r=n.bindings[e];if(r===void 0)continue;let i=e.split(`+`),a=i.pop();for(let e of[`mac`,`windows`,`linux`]){if(n.platform!==void 0&&n.platform!==e)continue;let o=0;for(let t of i)t===`alt`?o|=1:t===`ctrl`?o|=2:t===`cmd`?o|=4:t===`shift`?o|=8:t===`cmdOrCtrl`&&(o|=e===`mac`?4:2);let s=t[e].get(o);s===void 0&&(s=new Map,t[e].set(o,s)),s.set(a,r)}}ju.set(e,t)}return t}function Fu(e,t,n=ze()){let r=e.key===` `?`Space`:e.key.length===1?e.key.toLowerCase():e.key,i=e.code??``,a=i.startsWith(`Key`)&&i.length===4?i.slice(3).toLowerCase():i.startsWith(`Digit`)&&i.length===6?i.slice(5):Nu[i],o=n?`mac`:globalThis.navigator?.platform.includes(`Linux`)===!0?`linux`:`windows`,s=!!e.altKey|(e.ctrlKey?2:0)|(e.metaKey?4:0)|(e.shiftKey?8:0);if(t!==void 0){let e=Pu(t)[o].get(s),n=e?.get(r)??(a===void 0?void 0:e?.get(a));if(n!==void 0)return n}let c=Mu[o].get(s);return c?.get(r)??(a===void 0?void 0:c?.get(a))}function Iu(e,t=ze()){if(!e.altKey&&ku(e,t)&&((e.key.length===1?e.key.toLowerCase():e.key)===`g`||e.code===`KeyG`))return e.shiftKey?`previous`:`next`}var Lu=`::selection {
|
|
1679
|
+
background-color: #0000;
|
|
1680
|
+
}
|
|
1681
|
+
|
|
1682
|
+
[data-deleted-text-selection] [data-deletions] ::selection, [data-deleted-text-selection] [data-line-type="change-deletion"] ::selection {
|
|
1683
|
+
background-color: var(--diffs-editor-selection-bg);
|
|
1684
|
+
}
|
|
1685
|
+
|
|
1686
|
+
@keyframes blinking {
|
|
1687
|
+
0% {
|
|
1688
|
+
opacity: 1;
|
|
1689
|
+
}
|
|
1690
|
+
|
|
1691
|
+
50% {
|
|
1692
|
+
opacity: 0;
|
|
1693
|
+
}
|
|
1694
|
+
|
|
1695
|
+
100% {
|
|
1696
|
+
opacity: 1;
|
|
1697
|
+
}
|
|
1698
|
+
}
|
|
1699
|
+
|
|
1700
|
+
:host, [data-code], [data-content], [data-diff-type="split"][data-overflow="wrap"] {
|
|
1701
|
+
position: relative;
|
|
1702
|
+
}
|
|
1703
|
+
|
|
1704
|
+
[data-code] {
|
|
1705
|
+
container-type: inline-size;
|
|
1706
|
+
}
|
|
1707
|
+
|
|
1708
|
+
[data-content] {
|
|
1709
|
+
cursor: text;
|
|
1710
|
+
caret-color: var(--diffs-bg-caret);
|
|
1711
|
+
background-color: #0000;
|
|
1712
|
+
outline: none;
|
|
1713
|
+
}
|
|
1714
|
+
|
|
1715
|
+
[data-line] {
|
|
1716
|
+
cursor: text;
|
|
1717
|
+
background-color: #0000;
|
|
1718
|
+
}
|
|
1719
|
+
|
|
1720
|
+
[data-line]:after {
|
|
1721
|
+
content: "";
|
|
1722
|
+
z-index: -20;
|
|
1723
|
+
background-color: var(--diffs-line-bg);
|
|
1724
|
+
pointer-events: none;
|
|
1725
|
+
position: absolute;
|
|
1726
|
+
inset: 0;
|
|
1727
|
+
}
|
|
1728
|
+
|
|
1729
|
+
[data-line][data-editor-active-line]:after {
|
|
1730
|
+
box-shadow: inset 0 0 0 1px var(--diffs-editor-line-highlight-border);
|
|
1731
|
+
}
|
|
1732
|
+
|
|
1733
|
+
[data-editor-overlay] {
|
|
1734
|
+
display: contents;
|
|
1735
|
+
}
|
|
1736
|
+
|
|
1737
|
+
[data-caret], [data-selection-range], [data-match-range], [data-bracket-match-range], [data-marker-range] {
|
|
1738
|
+
height: 1lh;
|
|
1739
|
+
line-height: var(--diffs-line-height);
|
|
1740
|
+
pointer-events: none;
|
|
1741
|
+
position: absolute;
|
|
1742
|
+
top: 0;
|
|
1743
|
+
left: 0;
|
|
1744
|
+
}
|
|
1745
|
+
|
|
1746
|
+
[data-caret] {
|
|
1747
|
+
background-color: var(--diffs-bg-caret-override, var(--diffs-editor-cursor-fg, light-dark(color-mix(in lab, var(--diffs-fg) 50%, var(--diffs-bg)), color-mix(in lab, var(--diffs-fg) 75%, var(--diffs-bg)))));
|
|
1748
|
+
visibility: hidden;
|
|
1749
|
+
width: 2px;
|
|
1750
|
+
}
|
|
1751
|
+
|
|
1752
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
1753
|
+
[data-caret] {
|
|
1754
|
+
animation: 1.2s .8s infinite blinking;
|
|
1755
|
+
}
|
|
1756
|
+
}
|
|
1757
|
+
|
|
1758
|
+
[data-selection-range] {
|
|
1759
|
+
z-index: -10;
|
|
1760
|
+
background-color: var(--diffs-editor-selection-bg);
|
|
1761
|
+
}
|
|
1762
|
+
|
|
1763
|
+
[data-selection-corner] {
|
|
1764
|
+
background-color: var(--diffs-selection-corner-bg, var(--diffs-bg));
|
|
1765
|
+
width: 100%;
|
|
1766
|
+
height: 100%;
|
|
1767
|
+
}
|
|
1768
|
+
|
|
1769
|
+
[data-match-range] {
|
|
1770
|
+
z-index: -10;
|
|
1771
|
+
background-color: var(--diffs-editor-match-bg, var(--diffs-editor-selection-bg));
|
|
1772
|
+
}
|
|
1773
|
+
|
|
1774
|
+
[data-match-range]:not([data-focus]) {
|
|
1775
|
+
background-color: var(--diffs-editor-match-highlight-bg, light-dark(#ff963288, #ff963266));
|
|
1776
|
+
}
|
|
1777
|
+
|
|
1778
|
+
[data-bracket-match-range] {
|
|
1779
|
+
z-index: -9;
|
|
1780
|
+
box-sizing: border-box;
|
|
1781
|
+
border-bottom: 1px solid
|
|
1782
|
+
var(--diffs-editor-bracket-match-border, color-mix(in lab, var(--diffs-fg) 60%, transparent));
|
|
1783
|
+
background-color: var(--diffs-editor-bracket-match-bg, color-mix(in lab, var(--diffs-fg) 5%, transparent));
|
|
1784
|
+
}
|
|
1785
|
+
|
|
1786
|
+
[data-rtl] {
|
|
1787
|
+
border-top-left-radius: 3px;
|
|
1788
|
+
}
|
|
1789
|
+
|
|
1790
|
+
[data-rtr] {
|
|
1791
|
+
border-top-right-radius: 3px;
|
|
1792
|
+
}
|
|
1793
|
+
|
|
1794
|
+
[data-rbl] {
|
|
1795
|
+
border-bottom-left-radius: 3px;
|
|
1796
|
+
}
|
|
1797
|
+
|
|
1798
|
+
[data-rbr] {
|
|
1799
|
+
border-bottom-right-radius: 3px;
|
|
1800
|
+
}
|
|
1801
|
+
|
|
1802
|
+
[data-marker-range] {
|
|
1803
|
+
z-index: 1;
|
|
1804
|
+
background-color: var(--diffs-marker-bg);
|
|
1805
|
+
mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI2IiBoZWlnaHQ9IjMiPjxwYXRoIGQ9Im0wIDIuNSBsMiAtMS41IGwxIDAgbDIgMS41IGwxIDAiIHN0cm9rZT0iI2ZmZiIgZmlsbD0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIi8+PC9zdmc+");
|
|
1806
|
+
mask-position: 0 100%;
|
|
1807
|
+
mask-size: 6px 3px;
|
|
1808
|
+
mask-repeat: repeat-x;
|
|
1809
|
+
}
|
|
1810
|
+
|
|
1811
|
+
[data-marker-error] {
|
|
1812
|
+
--diffs-marker-contrast: light-dark(#fff, #000);
|
|
1813
|
+
--diffs-marker-bg: var(--diffs-editor-error-fg, var(--diffs-deletion-base));
|
|
1814
|
+
}
|
|
1815
|
+
|
|
1816
|
+
[data-marker-warning] {
|
|
1817
|
+
--diffs-marker-contrast: #000;
|
|
1818
|
+
--diffs-marker-bg: var(--diffs-editor-warning-fg, light-dark(var(--diffs-warning-light), var(--diffs-warning-dark)));
|
|
1819
|
+
}
|
|
1820
|
+
|
|
1821
|
+
[data-marker-info] {
|
|
1822
|
+
--diffs-marker-contrast: #000;
|
|
1823
|
+
--diffs-marker-bg: var(--diffs-editor-info-fg, var(--diffs-modified-base));
|
|
1824
|
+
}
|
|
1825
|
+
|
|
1826
|
+
[data-marker-hint] {
|
|
1827
|
+
--diffs-marker-contrast: light-dark(#fff, #000);
|
|
1828
|
+
--diffs-marker-bg: var(--diffs-editor-hint-fg, var(--diffs-fg-number));
|
|
1829
|
+
}
|
|
1830
|
+
|
|
1831
|
+
@media (width >= 480px) {
|
|
1832
|
+
[data-content] {
|
|
1833
|
+
caret-color: #0000;
|
|
1834
|
+
}
|
|
1835
|
+
|
|
1836
|
+
[data-content]:focus ~ [data-editor-overlay] [data-caret] {
|
|
1837
|
+
visibility: visible;
|
|
1838
|
+
}
|
|
1839
|
+
}
|
|
1840
|
+
|
|
1841
|
+
[data-editor-widget] {
|
|
1842
|
+
--diffs-widget-fg: var(--diffs-fg);
|
|
1843
|
+
--diffs-widget-bg: color-mix(in lab, var(--diffs-fg) 4%, var(--diffs-bg));
|
|
1844
|
+
--diffs-widget-border: color-mix(in lab, var(--diffs-fg) 20%, transparent);
|
|
1845
|
+
--diffs-widget-shadow: inset 0 0 0 1px var(--diffs-bg), 0 4px 8px #00000013,
|
|
1846
|
+
0 6px 18px #00000013;
|
|
1847
|
+
z-index: 100;
|
|
1848
|
+
width: fit-content;
|
|
1849
|
+
max-width: calc(100% - 24px);
|
|
1850
|
+
font: 14px/20px var(--diffs-header-font-fallback);
|
|
1851
|
+
border: 1px solid var(--diffs-widget-border);
|
|
1852
|
+
background-color: var(--diffs-widget-bg);
|
|
1853
|
+
box-shadow: var(--diffs-widget-shadow);
|
|
1854
|
+
background-clip: padding-box;
|
|
1855
|
+
border-radius: 9px;
|
|
1856
|
+
position: absolute;
|
|
1857
|
+
top: 0;
|
|
1858
|
+
left: 0;
|
|
1859
|
+
}
|
|
1860
|
+
|
|
1861
|
+
[data-marker-popover], [data-selection-action-popover] {
|
|
1862
|
+
--popover-gap: var(--diffs-popover-gap, var(--diffs-gap-fallback, 8px));
|
|
1863
|
+
--popover-viewport-left: 0px;
|
|
1864
|
+
--popover-viewport-right: 100cqw;
|
|
1865
|
+
--popover-viewport-top: -99999px;
|
|
1866
|
+
--popover-viewport-bottom: 99999px;
|
|
1867
|
+
--popover-min-left: calc(var(--popover-viewport-left) + var(--gutter-width, 0px) + var(--popover-gap));
|
|
1868
|
+
--popover-available-width: max(0px,
|
|
1869
|
+
calc(var(--popover-viewport-right) - var(--popover-min-left) -
|
|
1870
|
+
var(--popover-gap)));
|
|
1871
|
+
max-width: min(640px, var(--popover-available-width));
|
|
1872
|
+
translate: clamp(var(--popover-min-left),
|
|
1873
|
+
var(--popover-x, var(--popover-min-left)),
|
|
1874
|
+
calc(var(--popover-viewport-right) - var(--popover-gap) - 100%))
|
|
1875
|
+
/* Clamp into the scrollport so a popover with no fitting side stays in view. */
|
|
1876
|
+
clamp(var(--popover-viewport-top),
|
|
1877
|
+
calc(var(--popover-y, 0px) + var(--popover-y-shift, 0px)),
|
|
1878
|
+
calc(var(--popover-viewport-bottom) - var(--popover-gap) - 100%));
|
|
1879
|
+
}
|
|
1880
|
+
|
|
1881
|
+
[data-marker-popover] {
|
|
1882
|
+
--diffs-widget-bg: var(--diffs-marker-bg);
|
|
1883
|
+
--diffs-widget-shadow: 0 4px 8px #00000026, 0 6px 18px #00000026;
|
|
1884
|
+
min-width: min(180px, var(--popover-available-width));
|
|
1885
|
+
overflow-wrap: anywhere;
|
|
1886
|
+
color: var(--diffs-marker-contrast);
|
|
1887
|
+
white-space: normal;
|
|
1888
|
+
pointer-events: auto;
|
|
1889
|
+
border: 0;
|
|
1890
|
+
padding: 8px 12px;
|
|
1891
|
+
|
|
1892
|
+
@supports (color: contrast-color(red)) {
|
|
1893
|
+
color: contrast-color(var(--diffs-marker-bg, var(--diffs-bg)));
|
|
1894
|
+
}
|
|
1895
|
+
|
|
1896
|
+
& [data-marker-message] {
|
|
1897
|
+
white-space: normal;
|
|
1898
|
+
overflow-wrap: anywhere;
|
|
1899
|
+
|
|
1900
|
+
& code {
|
|
1901
|
+
white-space: normal;
|
|
1902
|
+
color: inherit;
|
|
1903
|
+
background-color: #0000;
|
|
1904
|
+
display: inline;
|
|
1905
|
+
}
|
|
1906
|
+
}
|
|
1907
|
+
}
|
|
1908
|
+
|
|
1909
|
+
[data-selection-action-popover] {
|
|
1910
|
+
pointer-events: auto;
|
|
1911
|
+
flex-wrap: wrap;
|
|
1912
|
+
align-items: center;
|
|
1913
|
+
gap: 4px;
|
|
1914
|
+
width: max-content;
|
|
1915
|
+
padding: 4px;
|
|
1916
|
+
display: flex;
|
|
1917
|
+
}
|
|
1918
|
+
|
|
1919
|
+
[data-search-panel] {
|
|
1920
|
+
z-index: 100;
|
|
1921
|
+
flex-direction: column;
|
|
1922
|
+
justify-content: right;
|
|
1923
|
+
width: 100%;
|
|
1924
|
+
height: 0;
|
|
1925
|
+
display: flex;
|
|
1926
|
+
position: sticky;
|
|
1927
|
+
top: 16px;
|
|
1928
|
+
right: 16px;
|
|
1929
|
+
container: search-panel / inline-size;
|
|
1930
|
+
|
|
1931
|
+
& [data-editor-widget] {
|
|
1932
|
+
z-index: 100;
|
|
1933
|
+
flex-shrink: 0;
|
|
1934
|
+
align-items: stretch;
|
|
1935
|
+
gap: 8px;
|
|
1936
|
+
min-width: 260px;
|
|
1937
|
+
max-width: 100%;
|
|
1938
|
+
margin-inline: auto 16px;
|
|
1939
|
+
padding: 4px;
|
|
1940
|
+
display: flex;
|
|
1941
|
+
position: relative;
|
|
1942
|
+
}
|
|
1943
|
+
|
|
1944
|
+
& svg {
|
|
1945
|
+
fill: currentColor;
|
|
1946
|
+
width: 12px;
|
|
1947
|
+
height: 12px;
|
|
1948
|
+
display: block;
|
|
1949
|
+
}
|
|
1950
|
+
}
|
|
1951
|
+
|
|
1952
|
+
[data-search-grid] {
|
|
1953
|
+
grid-template-columns: auto auto auto;
|
|
1954
|
+
grid-template-areas: "find matches nav"
|
|
1955
|
+
"replace actions .";
|
|
1956
|
+
align-items: center;
|
|
1957
|
+
gap: 4px 6px;
|
|
1958
|
+
width: 100%;
|
|
1959
|
+
display: grid;
|
|
1960
|
+
}
|
|
1961
|
+
|
|
1962
|
+
[data-input-box][data-find] {
|
|
1963
|
+
grid-area: find;
|
|
1964
|
+
}
|
|
1965
|
+
|
|
1966
|
+
[data-search-nav] {
|
|
1967
|
+
grid-area: nav;
|
|
1968
|
+
}
|
|
1969
|
+
|
|
1970
|
+
[data-input-box][data-replace] {
|
|
1971
|
+
grid-area: replace;
|
|
1972
|
+
}
|
|
1973
|
+
|
|
1974
|
+
[data-replace-actions] {
|
|
1975
|
+
grid-area: actions;
|
|
1976
|
+
}
|
|
1977
|
+
|
|
1978
|
+
[data-search-grid][data-mode="find"] {
|
|
1979
|
+
grid-template-areas: "find matches nav";
|
|
1980
|
+
}
|
|
1981
|
+
|
|
1982
|
+
[data-search-grid][data-mode="find"] [data-replace-cell] {
|
|
1983
|
+
display: none;
|
|
1984
|
+
}
|
|
1985
|
+
|
|
1986
|
+
@container search-panel (width < 400px) {
|
|
1987
|
+
[data-search-panel] [data-editor-widget] {
|
|
1988
|
+
padding: 10px;
|
|
1989
|
+
}
|
|
1990
|
+
|
|
1991
|
+
[data-search-grid][data-mode="replace"] {
|
|
1992
|
+
grid-template-columns: auto 1fr auto;
|
|
1993
|
+
grid-template-areas: "find find find"
|
|
1994
|
+
"replace replace replace"
|
|
1995
|
+
"nav matches actions";
|
|
1996
|
+
}
|
|
1997
|
+
|
|
1998
|
+
[data-search-grid][data-mode="find"] {
|
|
1999
|
+
grid-template-columns: auto 1fr auto;
|
|
2000
|
+
grid-template-areas: "find find find"
|
|
2001
|
+
"nav matches matches";
|
|
2002
|
+
}
|
|
2003
|
+
|
|
2004
|
+
[data-replace-actions] {
|
|
2005
|
+
justify-self: end;
|
|
2006
|
+
}
|
|
2007
|
+
|
|
2008
|
+
[data-search-grid] [data-input-box] {
|
|
2009
|
+
width: auto;
|
|
2010
|
+
}
|
|
2011
|
+
}
|
|
2012
|
+
|
|
2013
|
+
[data-input-box] {
|
|
2014
|
+
align-items: center;
|
|
2015
|
+
width: 200px;
|
|
2016
|
+
display: flex;
|
|
2017
|
+
position: relative;
|
|
2018
|
+
|
|
2019
|
+
& input {
|
|
2020
|
+
width: 100%;
|
|
2021
|
+
min-width: 0;
|
|
2022
|
+
color: var(--diffs-fg);
|
|
2023
|
+
background-color: var(--diffs-bg);
|
|
2024
|
+
border: 1px solid color-mix(in lab, var(--diffs-fg) 12%, var(--diffs-bg));
|
|
2025
|
+
border-radius: 6px;
|
|
2026
|
+
outline: none;
|
|
2027
|
+
flex-grow: 1;
|
|
2028
|
+
padding-inline: 6px;
|
|
2029
|
+
font-size: 13px;
|
|
2030
|
+
line-height: 24px;
|
|
2031
|
+
|
|
2032
|
+
&::selection {
|
|
2033
|
+
background-color: color-mix(in lab, var(--diffs-fg) 8%, var(--diffs-bg));
|
|
2034
|
+
}
|
|
2035
|
+
|
|
2036
|
+
&:focus-visible {
|
|
2037
|
+
outline: 1px solid var(--diffs-modified-base);
|
|
2038
|
+
}
|
|
2039
|
+
}
|
|
2040
|
+
|
|
2041
|
+
&[data-find] input {
|
|
2042
|
+
padding-inline-end: 72px;
|
|
2043
|
+
}
|
|
2044
|
+
|
|
2045
|
+
& [data-search-icon] {
|
|
2046
|
+
--diffs-search-icon-size: 20px;
|
|
2047
|
+
}
|
|
2048
|
+
}
|
|
2049
|
+
|
|
2050
|
+
[data-search-toggles] {
|
|
2051
|
+
align-items: center;
|
|
2052
|
+
gap: 1px;
|
|
2053
|
+
display: flex;
|
|
2054
|
+
position: absolute;
|
|
2055
|
+
top: 50%;
|
|
2056
|
+
right: 4px;
|
|
2057
|
+
transform: translateY(-50%);
|
|
2058
|
+
}
|
|
2059
|
+
|
|
2060
|
+
[data-matches] {
|
|
2061
|
+
white-space: nowrap;
|
|
2062
|
+
min-width: 50px;
|
|
2063
|
+
color: color-mix(in lab, var(--diffs-fg) 50%, var(--diffs-bg));
|
|
2064
|
+
flex-shrink: 0;
|
|
2065
|
+
grid-area: matches;
|
|
2066
|
+
font-size: 12px;
|
|
2067
|
+
font-weight: 500;
|
|
2068
|
+
line-height: 20px;
|
|
2069
|
+
|
|
2070
|
+
&[data-no-matches] {
|
|
2071
|
+
color: color-mix(in lab, var(--diffs-fg) 35%, var(--diffs-bg));
|
|
2072
|
+
}
|
|
2073
|
+
}
|
|
2074
|
+
|
|
2075
|
+
[data-replace-actions], [data-search-nav] {
|
|
2076
|
+
align-items: center;
|
|
2077
|
+
display: flex;
|
|
2078
|
+
}
|
|
2079
|
+
|
|
2080
|
+
[data-search-icon] {
|
|
2081
|
+
appearance: none;
|
|
2082
|
+
width: var(--diffs-search-icon-size, 24px);
|
|
2083
|
+
height: var(--diffs-search-icon-size, 24px);
|
|
2084
|
+
color: color-mix(in lab, var(--diffs-fg) 65%, var(--diffs-bg));
|
|
2085
|
+
border-radius: var(--diffs-search-icon-radius, 4px);
|
|
2086
|
+
cursor: pointer;
|
|
2087
|
+
background: none;
|
|
2088
|
+
border: 0;
|
|
2089
|
+
flex-shrink: 0;
|
|
2090
|
+
justify-content: center;
|
|
2091
|
+
align-items: center;
|
|
2092
|
+
margin: 0;
|
|
2093
|
+
padding: 0;
|
|
2094
|
+
transition: background-color .1s ease-in-out, color .1s ease-in-out;
|
|
2095
|
+
display: flex;
|
|
2096
|
+
|
|
2097
|
+
&:disabled {
|
|
2098
|
+
opacity: .25;
|
|
2099
|
+
cursor: default;
|
|
2100
|
+
}
|
|
2101
|
+
|
|
2102
|
+
&:not(:disabled):hover {
|
|
2103
|
+
color: var(--diffs-fg);
|
|
2104
|
+
}
|
|
2105
|
+
|
|
2106
|
+
&:focus-visible {
|
|
2107
|
+
outline: 1px solid var(--diffs-modified-base);
|
|
2108
|
+
}
|
|
2109
|
+
|
|
2110
|
+
&[aria-pressed="true"] {
|
|
2111
|
+
color: var(--diffs-modified-base);
|
|
2112
|
+
}
|
|
2113
|
+
}
|
|
2114
|
+
|
|
2115
|
+
[data-search-close] {
|
|
2116
|
+
--diffs-search-icon-size: 20px;
|
|
2117
|
+
--diffs-search-icon-radius: 50%;
|
|
2118
|
+
color: var(--diffs-widget-bg);
|
|
2119
|
+
background-color: color-mix(in lab,
|
|
2120
|
+
var(--diffs-widget-fg) 50%,
|
|
2121
|
+
var(--diffs-bg));
|
|
2122
|
+
position: absolute;
|
|
2123
|
+
top: 0;
|
|
2124
|
+
right: 0;
|
|
2125
|
+
transform: translate(50%, -50%);
|
|
2126
|
+
|
|
2127
|
+
&:not(:disabled):hover {
|
|
2128
|
+
opacity: 1;
|
|
2129
|
+
color: var(--diffs-widget-bg);
|
|
2130
|
+
background-color: var(--diffs-widget-fg);
|
|
2131
|
+
}
|
|
2132
|
+
}
|
|
2133
|
+
`,Ru=`//`,zu=[`/*`,`*/`],Bu={sql:{lineComment:`--`},ruby:{lineComment:`#`,blockComment:[`=begin`,`=end`]},rst:{lineComment:`..`},coffeescript:{lineComment:`#`,blockComment:[`###`,`###`]},cmd:{lineComment:`@REM`},julia:{lineComment:`#`,blockComment:[`#=`,`=#`]},yaml:{lineComment:`#`},yml:{lineComment:`#`},markdown:{lineComment:null,blockComment:[`<!--`,`-->`]},zsh:{lineComment:`#`},makefile:{lineComment:`#`},handlebars:{lineComment:null,blockComment:[`{{!--`,`--}}`]},ini:{lineComment:`;`,blockComment:[`;`,` `]},powershell:{lineComment:`#`,blockComment:[`<#`,`#>`]},vb:{lineComment:`'`},xml:{lineComment:null,blockComment:[`<!--`,`-->`]},lua:{lineComment:`--`,blockComment:[`--[[`,`]]`]},html:{lineComment:null,blockComment:[`<!--`,`-->`]},diff:{lineComment:`#`,blockComment:[`#`,` `]},r:{lineComment:`#`},fsharp:{blockComment:[`(*`,`*)`]},pug:{lineComment:`//-`},perl:{lineComment:`#`},tex:{lineComment:`%`},clojure:{lineComment:`;;`},css:{lineComment:null},python:{lineComment:`#`,blockComment:[`"""`,`"""`]},dotenv:{lineComment:`#`},dockerfile:{lineComment:`#`},razor:{lineComment:null,blockComment:[`<!--`,`-->`]},prompt:{lineComment:null,blockComment:[`<!--`,`-->`]}};function Vu(e,t){let n={...Bu[e],...t?.[e]};return{lineComment:n.lineComment===void 0?Ru:n.lineComment,blockComment:n.blockComment??zu}}function Hu(e,t,n){let r=[],i=new Set;for(let a of t){let t=a.end.line;a.start.line<t&&a.end.character===0&&t--;let o=r.length,s=1/0;for(let o=a.start.line;o<=t;o++){if(i.has(o))continue;i.add(o);let t=e.getLineText(o),a=t.length-t.trimStart().length,c=a===t.length;c||(s=Math.min(s,a)),r.push({line:o,comment:t.slice(a,a+n.length)===n?a:-1,empty:c,indent:a,single:!1})}if(s!==1/0)for(let e=o;e<r.length;e++)r[e].empty||(r[e].indent=s);r.length===o+1&&(r[o].single=!0)}let a=r.some(e=>e.comment<0&&(!e.empty||e.single)),o=[];if(a){for(let e of r){if(e.empty&&!e.single)continue;let t={line:e.line,character:e.indent};o.push({range:{start:t,end:t},newText:n+` `})}return o}for(let t of r){if(t.comment<0)continue;let r=e.getLineText(t.line),i=t.comment,a=i+n.length+ +(r[i+n.length]===` `);o.push({range:{start:{line:t.line,character:i},end:{line:t.line,character:a}},newText:``})}return o}var Uu=50;function Wu(e,t,n,r,i){let a=Math.max(0,r-Uu),o=e.getTextSlice(a,r),s=e.getTextSlice(i,i+Uu),c=o.length-o.trimEnd().length,l=s.length-s.trimStart().length,u=o.length-c;if(o.slice(u-t.length,u)===t&&s.slice(l,l+n.length)===n)return{open:{start:r-c-t.length,end:r-c+ +(c>0),text:``},close:{start:i+l-+(l>0),end:i+l+n.length,text:``},contentStart:r,contentEnd:i};let d=i-r<=Uu*2?e.getTextSlice(r,i):void 0,f=d??e.getTextSlice(r,r+Uu),p=d??e.getTextSlice(i-Uu,i),m=f.length-f.trimStart().length,h=i-(p.length-p.trimEnd().length)-n.length;if(f.slice(m,m+t.length)!==t||e.getTextSlice(h,h+n.length)!==n)return;let g=r+m,_=g+t.length+ +!!/\s/.test(f[t.length+m]??``),v=h-+!!/\s/.test(e.getTextSlice(h-1,h));return{open:{start:g,end:_,text:``},close:{start:v,end:h+n.length,text:``},contentStart:_,contentEnd:v}}function Gu(e,t,n,r){let i=0,a=t.length;for(;i<a;){let n=i+a>>>1;t[n].end<e?i=n+1:a=n}let o=n[i];for(let n=i;n<t.length;n++){let i=t[n];if(e<i.start)break;if(i.start===i.end&&e===i.start){if(r<0)break;o+=i.text.length;continue}if(e>i.end){o+=i.text.length-(i.end-i.start);continue}return e===i.end?i.start+o+i.text.length:i.start+o+(r>0?i.text.length:0)}return e+o}function Ku(e,t,[n,r],i=!1){let a=t.map(t=>{let{start:n,end:r}=t;if(i){let t=r.line;n.line<t&&r.character===0&&t--;let i=e.getLineText(n.line),a=i.length-i.trimStart().length;n={line:n.line,character:a},r={line:t,character:e.getLineLength(t)}}return{from:e.offsetAt(n),to:e.offsetAt(r),direction:t.direction,comment:void 0}});if(i&&a.length>1){a.sort((e,t)=>{let n=e.from-t.from;return n===0?e.to-t.to:n});let e=0;for(let t=1;t<a.length;t++){let n=a[e],r=a[t];r.from<=n.to?n.to=Math.max(n.to,r.to):a[++e]=r}a.length=e+1}for(let t of a)t.comment=Wu(e,n,r,t.from,t.to);let o=a.every(e=>e.comment!==void 0),s=[];for(let e of a){let t=e.comment;if(o&&t!==void 0){s.push(t.open,t.close);continue}if(t===void 0){if(e.from===e.to){s.push({start:e.from,end:e.to,text:n+` `+r});continue}s.push({start:e.from,end:e.from,text:n+` `},{start:e.to,end:e.to,text:` `+r})}}if(s.length===0)return;s.sort((e,t)=>{let n=e.start-t.start;return n===0?e.end-t.end:n});let c=s.map(t=>({range:{start:e.positionAt(t.start),end:e.positionAt(t.end)},newText:t.text}));if(i)return{edits:c,nextSelectionOffsets:[]};let l=a.map(e=>{let t=e.comment;return o&&t!==void 0?{start:t.contentStart,end:t.contentEnd,startAssociation:1,endAssociation:-1}:t===void 0?e.from===e.to?{start:e.from,end:e.to,startAssociation:-1,endAssociation:-1,collapsedInset:n.length+1}:{start:e.from,end:e.to,startAssociation:1,endAssociation:-1}:{start:e.from,end:e.to,startAssociation:1,endAssociation:1}}),u=Array(s.length+1);u[0]=0;for(let e=0;e<s.length;e++){let t=s[e];u[e+1]=u[e]+t.text.length-(t.end-t.start)}return{edits:c,nextSelectionOffsets:l.map((e,t)=>{let n=Gu(e.start,s,u,e.startAssociation)+(e.collapsedInset??0);return[n,e.collapsedInset===void 0?Gu(e.end,s,u,e.endAssociation):n,a[t].direction]})}}function Z(e,t,n){let{style:r,dataset:i,children:a,...o}=t??{},s=document.createElement(e);return Object.assign(s,o),r!==void 0&&(typeof r==`string`?s.style.cssText=r:Object.assign(s.style,r)),i!==void 0&&(typeof i==`string`?s.dataset[i]=``:Array.isArray(i)?i.forEach(e=>{s.dataset[e]=``}):Object.assign(s.dataset,i)),a!==void 0&&s.replaceChildren(...a),n!==void 0&&n.appendChild(s),s}function Q(e,t,n,r){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}function qu(e,t=`line`){let n=e.dataset[t];if(n===void 0)return;let r=parseInt(n,10);if(!Number.isNaN(r))return r}function Ju(e,t){if(e.nodeType===3){let n=e.textContent?.length??0;return Math.max(0,Math.min(t,n))}return e.nodeType===1?Math.max(0,Math.min(t,e.childNodes.length)):0}function Yu(e,t){return Object.assign(e,t)}function Xu(e,t){let n;return function(...r){clearTimeout(n),n=setTimeout(()=>e.apply(this,r),t)}}function Zu(e,t=1e3){return Math.round(e*t)/t}function Qu(e){return e.endsWith(`
|
|
2134
|
+
`)||e.endsWith(`\r`)}function $u(e){if(!(typeof Intl>`u`||typeof Intl.Segmenter!=`function`))return new Intl.Segmenter(void 0,e)}var ed,td=!1;function nd(){return td||=(ed=$u({granularity:`grapheme`}),!0),ed}function rd(e){let t=e.ownerDocument,n=e.parentElement;for(;n!=null&&n!==t.body&&n!==t.documentElement;){let e=n.ownerDocument.defaultView?.getComputedStyle(n).overflowY;if(e===`auto`||e===`scroll`||e===`overlay`)return n;n=n.parentElement}return t}function id(e,t){let n=ad(e);if(n.length===0)return;let r=[],i=!1;for(let a of t){if(a.side===`deletions`||a.lineNumber<=0){r.push(a);continue}let t=a.lineNumber-1,o=e.previousLineCount,s=!1;for(let e of n){let n=Math.max(1,o+e.lineDelta),r=od(t,e,n);if(r===void 0){s=!0,t=void 0;break}(r!==t||cd(t,e))&&(s=!0),t=r,o=n}if(t===void 0){i=!0;continue}let c=t+1;if(s){r.push(c===a.lineNumber?a:{...a,lineNumber:c}),i=!0;continue}r.push(a)}return i?r:void 0}function ad(e){if(e.changedLineChanges!==void 0)return e.changedLineChanges.flatMap(([e,t,n,r=0,i=0,a=!1])=>{if(n===0)return[];let o=Math.max(0,t-e);return[{startLine:e,startCharacter:r,endLine:e+Math.max(0,o-n),deletesEndLine:n<0&&a,insertedLineBreaks:o,lineDelta:n}]});if(e.lineDelta===0)return e.changedLineRanges.flatMap(([e,t])=>{let n=t-e;return n<=0?[]:[{startLine:e,startCharacter:0,endLine:e,deletesEndLine:!1,insertedLineBreaks:n,lineDelta:n}]});let t=Math.max(0,-e.lineDelta),n=e.endedAtDocumentEnd&&e.startLine+t===e.previousLineCount-1;return[{startLine:e.startLine,startCharacter:e.startCharacter,endLine:e.startLine+t,deletesEndLine:n,insertedLineBreaks:Math.max(0,e.lineDelta),lineDelta:e.lineDelta}]}function od(e,t,n){if(e<t.startLine)return e;if(e>t.endLine||t.endLine>t.startLine&&e===t.endLine&&!t.deletesEndLine)return e+t.lineDelta;if(t.startLine===t.endLine)return t.startCharacter===0?e+t.insertedLineBreaks:e;if(sd(e,t))return;let r=Math.min(Math.max(0,e-t.startLine),t.insertedLineBreaks);return ld(t.startLine+r,n)}function sd(e,t){return!(t.lineDelta>=0||e<t.startLine||e>t.endLine||e===t.startLine&&t.startCharacter>0||e===t.endLine&&!t.deletesEndLine)}function cd(e,t){return t.lineDelta===0||e<t.startLine||e>t.endLine?!1:!(t.endLine>t.startLine&&e===t.endLine&&!t.deletesEndLine)}function ld(e,t){return Math.max(0,Math.min(e,Math.max(0,t-1)))}function ud(e,t,n){let r=new Map,i=new Map;for(let t of e){let e=t.lineNumber;r.has(e)||r.set(e,[]),i.has(e)||i.set(e,[]),(t.side===`deletions`?i:r).get(e).push(ge(t))}let a=t.parentElement?.previousElementSibling,o,s;if(a!=null&&a instanceof HTMLElement&&a.dataset.deletions!==void 0)for(let e of a.children){let t=e,{gutter:n,content:r}=t.dataset;n===void 0?r!==void 0&&(s=t):o=t}dd(t,n),s!==void 0&&dd(s,o);let c=fd(r,t,n);if(s===void 0)return;let l=fd(i,s,o);requestAnimationFrame(()=>{pd(r,i,c,l)})}function dd(e,t){let n=[];for(let r=1;r<e.childElementCount;r++){let i=e.children[r];i.dataset.lineAnnotation!==void 0&&(n.push(i),t!==void 0&&n.push(t.children[r]))}for(let e of n)e.remove()}function fd(e,t,n){let r=new Map;for(let n of t.children){let t=qu(n);if(t!==void 0){let i=e.get(t);if(i!==void 0){let e=Z(`div`,{dataset:{lineAnnotation:`0,`+(t-1)},children:[Z(`div`,{dataset:`annotationContent`,children:i.map(e=>Z(`slot`,{name:e}))})]});n.after(e),r.set(t,e)}}}if(n!==void 0)for(let t of n.children){let n=qu(t,`columnNumber`);if(n!==void 0&&e.has(n)){let e=Z(`div`,{dataset:{gutterBuffer:`annotation`,bufferSize:`1`},style:{gridRow:`span 1`}});t.after(e)}}return r}function pd(e,t,n,r){let i=new Map;for(let[t,n]of e.entries()){let e=r.get(t);if(n.length===0&&e!==void 0){let n=md(e);n>0&&i.set(t,n)}}for(let[e,r]of t.entries()){let t=n.get(e);if(r.length===0&&t!==void 0){let n=md(t);n>0&&i.set(e,n)}}hd(e,n,i),hd(t,r,i)}function md(e){let t=e.firstElementChild;return t instanceof HTMLElement?t.getBoundingClientRect().height:0}function hd(e,t,n){for(let[r,i]of t.entries()){let t=e.get(r),a=n.get(r);t?.length===0&&a!==void 0&&i.style.setProperty(`--diffs-annotation-min-height`,`${a}px`)}}var gd=class{#e;#t;#n;#r;#i;#a;#o=0;#s=0;#c=0;#l=!0;#u;#d=new Map;#f;#p;constructor(e){this.#f=e.hasActivePopover,this.#p=e.updateActivePopover}setViewportElements(e,t){let n=this.#e!==e||this.#t!==t;this.#e=e,n&&(this.#t=t,this.#l=!0,this.#u?.forEach(e=>e()),this.#u=void 0)}cleanUp(){this.#t=void 0,this.#e=void 0,this.#n=void 0,this.#r=void 0,this.#i=void 0,this.#a=void 0,this.#o=0,this.#s=0,this.#c=0,this.#l=!0,this.#u?.forEach(e=>e()),this.#u=void 0,this.#d.clear()}resetPlacement(e=`default`){this.#d.delete(e)}setPlacement(e,t=`default`){this.#d.set(t,e)}choosePlacement(e){let{preferred:t,fallback:n,viewport:r,popoverHeight:i,atDocumentEdge:a,placementKey:o=`default`}=e,s=this.#d.get(o),c;if(r!==void 0&&i>0){let e=(e,t=0)=>e.top>=r.top+t&&e.bottom<=r.bottom-t;c=s===`fallback`&&e(n)&&!e(t,4)||!e(t)&&e(n)?`fallback`:`preferred`}else c=a?`fallback`:`preferred`;return this.#d.set(o,c),c}getPlacementBounds(){let e=this.#g();if(e===void 0)return;let t=this.#_(),n,r;if(t===void 0?(n=0,r=window.innerHeight):(n=t.top,r=t.bottom),n=Math.max(n,e.top),r=Math.min(r,e.bottom),r<=n)return;let i=this.#o,a=this.#s,o=this.#c>0?this.#c:e.width,s=t===void 0?0:t.left,c=t===void 0?window.innerWidth:t.right,l=i,u=i+o,d=Math.max(l,s-e.left+i),f=Math.min(u,c-e.left+i);return{top:n-e.top+a,bottom:r-e.top+a,left:d,right:Math.max(d,f)}}#m(){let e=this.#e;if(e===void 0)return;if(this.#r===e&&(this.#n===void 0||this.#n.isConnected))return this.#n;let t=e.parentElement;for(;t!==null;){let n=getComputedStyle(t).overflowY;if(n===`auto`||n===`scroll`||n===`overlay`)return this.#n=t,this.#r=e,t;t=t.parentElement}this.#n=void 0,this.#r=e}#h(){if(!this.#l)return;this.#v();let e=this.#t;this.#i=e?.getBoundingClientRect(),this.#o=e?.scrollLeft??0,this.#s=e?.scrollTop??0,this.#c=e?.clientWidth??0,this.#a=this.#m()?.getBoundingClientRect(),this.#l=!1}#g(){return this.#h(),this.#i}#_(){return this.#h(),this.#a}#v(){if(this.#u!==void 0)return;let e,t=()=>{this.#l=!0,!(!this.#f()||e!==void 0)&&(e=requestAnimationFrame(()=>{e=void 0,this.#p()}))},n=this.#m(),r=this.#t;this.#u=[Q(n===void 0?window:n,`scroll`,t,{passive:!0}),...r===void 0?[]:[Q(r,`scroll`,t,{passive:!0})],Q(window,`resize`,t,{passive:!0}),()=>{e!==void 0&&(cancelAnimationFrame(e),e=void 0)}]}};function _d(e,{gutterWidth:t,placeAbove:n,viewport:r,x:i,y:a}){if(e.style.setProperty(`--gutter-width`,t+`px`),e.style.setProperty(`--popover-x`,i+`px`),e.style.setProperty(`--popover-y`,a+`px`),e.style.setProperty(`--popover-y-shift`,n?`-100%`:`0px`),r===void 0){e.style.removeProperty(`--popover-viewport-left`),e.style.removeProperty(`--popover-viewport-right`),e.style.removeProperty(`--popover-viewport-top`),e.style.removeProperty(`--popover-viewport-bottom`);return}e.style.setProperty(`--popover-viewport-left`,r.left+`px`),e.style.setProperty(`--popover-viewport-right`,r.right+`px`),e.style.setProperty(`--popover-viewport-top`,r.top+`px`),e.style.setProperty(`--popover-viewport-bottom`,r.bottom+`px`)}var vd=new Map([[`'`,`'`],[`"`,`"`],["`","`"],[`{`,`}`],[`[`,`]`],[`<`,`>`],[`(`,`)`]]),yd=new Set([`'`,`"`,"`"]),bd=new Set([`{`,`[`,`(`,`<`]);function xd(e,t=0){let n=Df(e.startContainer,e.startOffset),r=Df(e.endContainer,e.endOffset);if(!(n===null||r===null))return{start:n,end:r,direction:t}}function Sd(e,t,n,r){if(e===void 0)return[[],t];let{start:i,end:a}=t,o=[],s={...t},c=i.line!==a.line,l=a.line;i.line<a.line&&a.character===0&&l--;for(let t=i.line;t<=l;t++){let l=e.getLineText(t);if(l===void 0||c&&l.trim().length===0)continue;let u=l.startsWith(` `)?` `:` `.repeat(n),d=0,f=u;if(r){if(l.startsWith(` `))d=1;else if(l.startsWith(` `)){let e=l.length-l.trimStart().length;d=Math.min(u.length,e)}if(d===0)continue;f=``}o.push({range:{start:{line:t,character:0},end:{line:t,character:d}},newText:f});let p=f.length-d;t===i.line&&(s={...s,start:{...i,character:Math.max(0,i.character+p)}}),t===a.line&&(s={...s,end:{...a,character:Math.max(0,a.character+p)}})}return[o,s]}function Cd(e,t,n,r={}){let i=e.lineCount;return t.map(t=>{let{line:a,character:o}=n===`up`||n===`left`?t.start:t.end;if(n===`textStart`||n===`start`||n===`end`){let i=Ud(t);a=i.line,o=i.character;let s=Ed(e,a,o,r);if(n===`textStart`){let t=e.getLineText(a).slice(s.start,s.end),n=s.start+wf(t);o=o===n?s.start:n}else o=n===`start`?s.start:s.end}else if(n===`up`){let t=wd(e,a,o,-1,r);t===void 0?a>0&&(a=r.resolveRenderableLine==null?a-1:r.resolveRenderableLine(a-1,`up`)??a):(a=t.line,o=t.character)}else if(n===`down`){let t=wd(e,a,o,1,r);if(t!==void 0)a=t.line,o=t.character;else{let e=Math.max(i-1,0);a<e&&(a=r.resolveRenderableLine==null?a+1:Math.min(r.resolveRenderableLine(a+1,`down`)??a,e))}}else if(Hd(t)){let t=e.getLineLength(a);if(o=Math.min(o,t),n===`left`){if(o>0)o=bf(e,a,o,!1);else if(a>0){let t=r.resolveRenderableLine==null?a-1:r.resolveRenderableLine(a-1,`up`);t!==void 0&&(a=t,o=e.getLineLength(a))}}else if(o<t)o=bf(e,a,o,!0);else if(a<i-1){let e=r.resolveRenderableLine==null?a+1:r.resolveRenderableLine(a+1,`down`);e!==void 0&&(a=Math.min(e,i-1),o=0)}}let s={line:a,character:o};return{start:s,end:s,direction:0}})}function wd(e,t,n,r,i){if(i.getSoftLineOffsets===void 0)return;let a=Ed(e,t,n,i),o=a.index+r,s=t,c;if(o>=0&&o<a.count)c=Od(e,s,o,i);else{let a=t+r;if(a<0||a>=e.lineCount)return{line:t,character:n};let o=i.resolveRenderableLine==null?a:i.resolveRenderableLine(a,r<0?`up`:`down`);if(o===void 0)return{line:t,character:n};s=Math.min(o,e.lineCount-1);let l=Dd(e,s,i);c=Od(e,s,r<0?l-1:0,i)}let l=Math.max(0,n-a.start),u=c.start+l,d=c.index===c.count-1?u:Math.min(u,c.end),f=e.getLineText(s);return{line:s,character:d>f.length?d:Td(f,d)}}function Td(e,t){if(t<=0||t>=e.length)return t;let n=nd();if(n!==void 0){for(let r of n.segment(e)){if(t<=r.index)return t;let e=r.index+r.segment.length;if(t<e)return e}return t}let r=0;for(let n of e){if(t<=r)return t;let e=r+n.length;if(t<e)return e;r=e}return t}function Ed(e,t,n,r){let i=e.getLineLength(t),a=r.getSoftLineOffsets?.(t);if(a===void 0||a.length<2)return{start:0,end:i,index:0,count:1};for(let i=0;i+1<a.length;i++){let a=Od(e,t,i,r);if(n>=a.start&&n<=a.end)return a}return Od(e,t,n<(a[0]??0)?0:a.length-2,r)}function Dd(e,t,n){let r=n.getSoftLineOffsets?.(t);return r===void 0||r.length<2?1:r.length-1}function Od(e,t,n,r){let i=e.getLineLength(t),a=r.getSoftLineOffsets?.(t);if(a===void 0||a.length<2)return{start:0,end:i,index:0,count:1};let o=a.length-1,s=Math.max(0,Math.min(n,o-1)),c=Math.max(0,Math.min(i,a[s]??0));return{start:c,end:Math.max(c,Math.min(i,a[s+1]??i)),index:s,count:o}}function kd(e,t,n,r={}){return t.map(t=>{let i=t.direction===-1?t.start:t.end,[a]=Cd(e,[{start:i,end:i,direction:0}],n,r);return Yd(t,a)})}function Ad(e,t,n,r,i=2,a=!1){if(t[t.length-1]===void 0)return{nextSelections:[]};let o=[];for(let e of t)o.push(e.start,e.end);let s=o.map(t=>e.offsetAt(t)),c=s[(t.length-1)*2],l=s[(t.length-1)*2+1],u=[],d=!0;for(let e=0;e<t.length;e++){let t={index:e,start:s[e*2],end:s[e*2+1]},n=u[u.length-1];n!==void 0&&(t.start<n.start||t.start===n.start&&t.end<n.end)&&(d=!1),u.push(t)}d||u.sort((e,t)=>{let n=e.start-t.start;if(n!==0)return n;let r=e.end-t.end;return r===0?e.index-t.index:r});let f=Ef(e,n,i),p=[],m=Array.from({length:t.length}),h=0,g,_=()=>{if(g===void 0)return;let t=Ef(e,{start:g.start,end:g.end,text:f.text},i),n=Cf(e,t.text,t.start);p.push({start:t.start,end:t.end,text:n});let r=[g.start+h+n.length,g.start+h+n.length];for(let e of g.indices)m[e]=r;h+=n.length-(t.end-t.start),g=void 0};for(let e of u){let t=Math.max(0,e.start+(f.start-c)),n=Math.max(t,e.end+(f.end-l));if(g!==void 0&&t<g.end){g.end=Math.max(g.end,n),g.indices.push(e.index);continue}_(),g={start:t,end:n,indices:[e.index]}}_();let v=e.applyResolvedEdits(p,!0,t,void 0,a),y=Tf(e,m.map(e=>{if(e===void 0)throw Error(`Missing next selection offsets`);return e}));if(e.setLastUndoSelectionsAfter(y),v!==void 0&&r!==void 0){let t=id(v,r);t!==void 0&&e.setLastUndoLineAnnotations(r,t)}return{nextSelections:y,change:v}}function jd(e,t){if(t.length!==e.length+2)return;let n=vd.get(t[0]);if(!(n===void 0||t[t.length-1]!==n||t.slice(1,-1)!==e))return 1}function Md(e,t,n,r){let i=t.start+n,a=i+r.length;if(t.end-t.start>0){let n=e.getTextSlice(t.start,t.end),a=jd(n,r)??r.indexOf(n);if(a!==-1&&a+n.length<=r.length){let e=i+a;return[e,e+n.length]}}return[a,a]}function Nd(e,t,n,r,i=!1,a=`selection`){if(t.length!==n.length)throw Error(`Selection text replacements must match the selection count`);let o=[];for(let e of t)o.push(e.start,e.end);let s=o.map(t=>e.offsetAt(t)),c=[],l=!0;for(let e=0;e<t.length;e++){let t={index:e,start:s[e*2],end:s[e*2+1]},n=c[c.length-1];n!==void 0&&(t.start<n.start||t.start===n.start&&t.end<n.end)&&(l=!1),c.push(t)}l||c.sort((e,t)=>{let n=e.start-t.start;if(n!==0)return n;let r=e.end-t.end;return r===0?e.index-t.index:r});let u=n.every(e=>e===``),d,f=Array.from({length:t.length});if(u){d=[];let e=!1;for(let t of c){if(f[t.index]=[t.end,t.end],t.start>=t.end)continue;e=!0;let n=d[d.length-1];n!==void 0&&t.start<n.end?d[d.length-1]={start:n.start,end:Math.max(n.end,t.end),text:``}:d.push({start:t.start,end:t.end,text:``})}if(!e)return{nextSelections:t};for(let e of c){let t=e.end,n=0,r=t;for(let e of d){if(t<=e.start)break;if(t>=e.end){n-=e.end-e.start;continue}r=e.start+n;break}r===t&&(r+=n),f[e.index]=[r,r]}}else{d=[];let t=0,r=-1;for(let i=0;i<c.length;i++){let o=c[i];if(o.start<r)throw Error(`Overlapping multi-selection edits are not supported`);r=o.end;let s=Cf(e,n[a===`document`?i:o.index],o.start);d.push({start:o.start,end:o.end,text:s}),f[o.index]=Md(e,o,t,s),t+=s.length-(o.end-o.start)}}let p=e.applyResolvedEdits(d,!0,t,void 0,i),m=Tf(e,f.map(e=>{if(e===void 0)throw Error(`Missing next selection offsets`);return e}));if(e.setLastUndoSelectionsAfter(m),p!==void 0&&r!==void 0){let t=id(p,r);t!==void 0&&e.setLastUndoLineAnnotations(r,t)}return{nextSelections:m,change:p}}function Pd(e,t){return e===`never`?!1:e===`brackets`?bd.has(t):e===`quotes`?yd.has(t):!0}function Fd(e,t,n,r){if(n.length!==1||t.length===0)return;let i=vd.get(n);if(i===void 0||!Pd(r,n))return;let a=[];for(let r of t){if(Hd(r))return;a.push(n+e.getText(r)+i)}return a}function Id(e,t,n){let r=[],i=[];for(let n of t){let[t,a]=xf(e,n);if(!Hd(n)){i.push([t,a]);continue}let{line:o,character:s}=n.start,c=t,l=e.getLineText(o),u=l.length,d=c-s,f=yf(l),p;if(s>0&&s<u){let e=vf(l,s,!1,f),t=vf(l,s,!0,f);p={start:d+e,end:d+t,text:l.slice(s,t)+l.slice(e,s)},i.push([d+t,d+t])}else if(s===u&&f.length>=2){let e=f[f.length-1],t=f[f.length-2];p={start:d+t,end:c,text:l.slice(e,u)+l.slice(t,e)},i.push([c,c])}else if(s===0&&o>0&&u>0){let t=o-1,n=e.getLineText(t),r=n.length,a=e.offsetAt({line:t,character:r}),s=r>0?vf(n,r,!1,yf(n)):r,u=vf(l,0,!0,f),d=a-(r-s),m=l.slice(0,u)+e.getTextSlice(a,c)+n.slice(s,r);p={start:d,end:c+u,text:m};let h=d+m.length;i.push([h,h])}else{i.push([t,a]);continue}r.push(p)}if(r.length===0)return{nextSelections:t};r.sort((e,t)=>e.start-t.start);for(let e=1;e<r.length;e++)if(r[e].start<r[e-1].end)throw Error(`Overlapping multi-selection edits are not supported`);let a=e.applyResolvedEdits(r,!0,t),o=Tf(e,i);if(e.setLastUndoSelectionsAfter(o),a!==void 0&&n!==void 0){let t=id(a,n);t!==void 0&&e.setLastUndoLineAnnotations(n,t)}return{nextSelections:o,change:a}}function Ld(e,t,n){let r=t.map(t=>{let n=Sf(e,t);return{start:n.start,end:n.end,direction:0}});return Nd(e,r,r.map(()=>``),n)}function Rd(e,t,n,r){let i=t.map(t=>{if(!Hd(t))return{start:t.start,end:t.end,direction:0};let r=Ud(t),{line:i,character:a}=r,o=n?.(i,a)??0;if(a>o)return{start:{line:i,character:o},end:{line:i,character:a},direction:0};if(i===0)return{start:r,end:r,direction:0};let s=e.getLineLength(i-1);return{start:{line:i-1,character:s},end:{line:i,character:0},direction:0}});return Nd(e,i,i.map(()=>``),r)}function zd(e,t,n){let r=t.map(t=>{let[n,r]=_f(e,t);return{start:n,end:r,direction:0}});return Nd(e,r,r.map(()=>``),n)}function Bd(e,t,n){if(!Hd(t))return[t.start,t.end];let r=Ud(t),{line:i,character:a}=r,o=e.getLineLength(i),s=e.lineCount;if(a=Math.min(a,o),n)return a<o?[{line:i,character:a},{line:i,character:bf(e,i,a,!0)}]:i<s-1?[{line:i,character:o},{line:i+1,character:0}]:[r,r];if(a>0)return[{line:i,character:bf(e,i,a,!1)},{line:i,character:a}];if(i>0){let t=e.getLineLength(i-1);return[{line:i-1,character:t},{line:i,character:0}]}return[r,r]}function Vd(e,t,n,r,i=2){let a=t.map(t=>{let[r,a]=Bd(e,t,n);if(!n&&Hd(t)){let t=Ef(e,{start:e.offsetAt(r),end:e.offsetAt(a),text:``},i);r=e.positionAt(t.start),a=e.positionAt(t.end)}return{start:r,end:a,direction:0}});return Nd(e,a,a.map(()=>``),r)}function Hd(e){return e.start.line===e.end.line&&e.start.character===e.end.character}function Ud(e){let{start:t,end:n,direction:r}=e;return r===-1?t:n}function Wd(e){return e===`context`||e===`context-expanded`||e===`change-addition`}function Gd(e,t){let n=Hd(e),r=Hd(t);return n&&r?$(e.start,t.start)===0:n?$(t.start,e.start)<=0&&$(e.start,t.end)<=0:r?$(e.start,t.start)<=0&&$(t.start,e.end)<=0:$(e.start,t.end)<0&&$(t.start,e.end)<0}function $(e,t){return e.line===t.line?e.character-t.character:e.line-t.line}function Kd(e,t,n){let r=t===n?0:t<n?1:-1,i=Math.min(t,n),a=Math.max(t,n);return{start:e.positionAt(i),end:e.positionAt(a),direction:r}}function qd(e,t){let n=0;for(let r of t){if(e<r.start)break;if(e>=r.end)n+=r.text.length-(r.end-r.start);else return r.start+n+r.text.length}return e+n}function Jd(e,t,n,r){return t.map((t,i)=>{let[a,o]=n[i],s=qd(a,r),c=qd(o,r);return Kd(e,t.direction===-1?c:s,t.direction===-1?s:c)})}function Yd(e,t){let n=e.direction===-1?e.end:e.start,r=$(n,t.start),i=$(n,t.end),a=t.end;a=r<=0?t.end:i>=0?t.start:r===0?t.end:t.start;let o=$(n,a);return{start:o<=0?n:a,end:o<=0?a:n,direction:o===0?0:o<0?1:-1}}function Xd(e,t){let n=$(t.start,e.start)<0,r=$(t.end,e.end)>0;return n&&!r?{start:t.start,end:e.end,direction:-1}:r&&!n?{start:e.start,end:t.end,direction:1}:e.direction===-1?{start:t.start,end:e.end,direction:$(t.start,e.end)===0?0:-1}:{start:e.start,end:t.end,direction:$(e.start,t.end)===0?0:1}}function Zd(e,t){return Qd(e.map(e=>Xd(e,t)))}function Qd(e){if(e.length<=1)return e;let t=e.map((e,t)=>({index:t,selection:e})).sort((e,t)=>{let n=$(e.selection.start,t.selection.start);if(n!==0)return n;let r=$(e.selection.end,t.selection.end);return r===0?e.index-t.index:r}),n=[],r=t[0];for(let e of t.slice(1)){if(Gd(r.selection,e.selection)){let t=e.index>r.index?e:r,n=$(e.selection.start,r.selection.start)<0?e.selection.start:r.selection.start,i=$(e.selection.end,r.selection.end)>0?e.selection.end:r.selection.end,a=t.selection.direction;a===0&&$(n,i)!==0&&(a=$(t.selection.start,n)===0?-1:1),r={index:t.index,selection:{direction:a,end:i,start:n}};continue}n.push(r),r=e}return n.push(r),n.sort((e,t)=>e.index-t.index).map(({selection:e})=>e)}function $d(e){let t=e.map(e=>{let t=e.end.line;return e.end.character===0&&$(e.start,e.end)!==0&&t--,{startLine:e.start.line,endLine:Math.max(e.start.line,t)}}).sort((e,t)=>{let n=e.startLine-t.startLine;return n===0?e.endLine-t.endLine:n}),n=[];for(let e of t){let t=n.at(-1);t!==void 0&&e.startLine<=t.endLine+1?t.endLine=Math.max(t.endLine,e.endLine):n.push({...e})}return n}function ef(e,t,n,r){let i=e=>{let i=e.line+t;if(i>=n){let e=Math.max(0,n-1);return{line:e,character:r(e)}}return i<0?{line:0,character:0}:{line:i,character:e.character}};return{start:i(e.start),end:i(e.end),direction:e.direction}}function tf(e,t){if(t.length===0)return;let n=t.map(t=>Hd(t)?hf(e,t):t),r=n.map(t=>e.getText(t)),i=r[0];if(i.length===0||r.some(e=>e!==i))return;let a=n.map(t=>[e.offsetAt(t.start),e.offsetAt(t.end)]),o=e.findNextNonOverlappingSubstring(i,a);if(o===void 0)return n.some((e,n)=>{let r=t[n];return $(e.start,r.start)!==0||$(e.end,r.end)!==0||e.direction!==r.direction})?n:void 0;let s=Kd(e,o,o+i.length);return[...n,s]}function nf(e){let t=e.lineCount-1;return{start:{line:0,character:0},end:{line:t,character:e.getLineLength(t)},direction:1}}function rf(e,t,n){let r=0;if(t){let t=e.lineCount-1;r=n===!0&&t>0&&e.getLineLength(t)===0?t-1:t}let i=t?e.getLineLength(r):0,a={line:r,character:i};return{start:a,end:a,direction:1}}function af(e,t){if(Hd(t)){let n=t.start.line;return{start:e.offsetAt({line:n,character:0}),end:n<e.lineCount-1?e.offsetAt({line:n+1,character:0}):e.offsetAt({line:n,character:e.getLineLength(n)})}}let n=e.offsetAt(t.start),r=e.offsetAt(t.end);return n<=r?{start:n,end:r}:{start:r,end:n}}function of(e,t){return t.map(t=>af(e,t)).sort((e,t)=>{let n=e.start-t.start;return n===0?e.end-t.end:n})}function sf(e,t){return of(e,t).map(({start:t,end:n})=>e.getTextSlice(t,n))}function cf(e,t){let n=of(e,t),r=e.eol,i=``,a=-1;for(let t of n)if(!(t.end<=t.start)){if(t.start<=a){t.end>a&&(i+=e.getTextSlice(a,t.end),a=t.end);continue}i.length>0&&!Qu(i)&&(i+=r),i+=e.getTextSlice(t.start,t.end),a=t.end}return i}function lf(e,t){if(Hd(t))return uf(e,t);let[n,r]=$(t.start,t.end)<=0?[t.start,t.end]:[t.end,t.start];return{start:e.offsetAt(n),end:e.offsetAt(r),text:``}}function uf(e,t){let n=t.start.line,r=e.offsetAt({line:n,character:0}),i=e.offsetAt({line:n,character:e.getLineLength(n)});return n<e.lineCount-1?{start:r,end:e.offsetAt({line:n+1,character:0}),text:``}:n>0?{start:e.offsetAt({line:n-1,character:e.getLineLength(n-1)}),end:i,text:``}:{start:r,end:i,text:``}}function df(e){let t=[];for(let{edit:n}of e){if(n.start>=n.end)continue;let e=t.at(-1);e!==void 0&&n.start<=e.end?t[t.length-1]={start:e.start,end:Math.max(e.end,n.end),text:``}:t.push(n)}return t}function ff(e,t){let n=Array.from({length:e.length}),r=0,i=0;for(let a of e){for(;r<t.length&&a.edit.start>t[r].end;){let e=t[r];i-=e.end-e.start,r++}let e=t[r];e!==void 0&&a.edit.start>=e.start&&a.edit.start<=e.end?n[a.index]=e.start+i:n[a.index]=a.edit.start+i}return n}function pf(e,t){let n=[...t.map((t,n)=>({index:n,edit:lf(e,t)}))].sort((e,t)=>{let n=e.edit.start-t.edit.start;if(n!==0)return n;let r=e.edit.end-t.edit.end;return r===0?e.index-t.index:r}),r=df(n);return{text:cf(e,t),edits:r,nextSelectionOffsets:ff(n,r)}}function mf(e,t){let n=Math.max(0,t),r=Of(e),i=null;for(let e of r){i=e;let t=If(e);if(n<=t+(e.textContent?.length??0)){let r=kf(e,n<t?0:n-t);if(r!==null)return r}}if(i!==null){let e=kf(i,i.textContent?.length??0);return e===null?[i,0]:e}let a=0,o=null;for(let t of e.childNodes){if(t.nodeType===1&&t.tagName===`BR`)return[t,0];if(t.nodeType!==3)continue;o=t;let e=Lf(o.textContent,o.textContent?.length??0);if(n<=a+e)return[o,Lf(o.textContent,n-a)];a+=e}return o===null?[e,0]:[o,Lf(o.textContent,o.textContent?.length??0)]}function hf(e,t){let{line:n,character:r}=t.start,i=e.getLineText(n),a=gf(i,Math.max(0,Math.min(r,i.length)));return a===void 0?t:{start:{line:n,character:a.start},end:{line:n,character:a.end},direction:1}}function gf(e,t){let n=$u({granularity:`word`});if(n!==void 0){for(let r of n.segment(e)){if(r.isWordLike!==!0)continue;let e=r.index,n=e+r.segment.length;if(t>=e&&t<=n)return{start:e,end:n}}return}let r=/[\p{Alphabetic}\p{Number}_]+/gu,i;for(;(i=r.exec(e))!==null;){let e=i.index,n=e+i[0].length;if(t>=e&&t<=n)return{start:e,end:n}}}function _f(e,t){if(!Hd(t))return[t.start,t.end];let n=Ud(t),{line:r,character:i}=n;if(i===0){if(r===0)return[n,n];let t=e.getLineLength(r-1);return[{line:r-1,character:t},{line:r,character:0}]}let a=e.getLineText(r),o=yf(a),s=i,c;for(;s>0;){let e=vf(a,s,!1,o),t=a.slice(e,s),n=/\S/.test(t)?/\p{Alphabetic}|\p{Number}|_/u.test(t)?1:2:0;if(c!==void 0&&n!==c)break;(n!==0||s!==i)&&(c=n),s=e}return[{line:r,character:s},{line:r,character:i}]}function vf(e,t,n,r){if(n){for(let e of r)if(e>t)return e;return e.length}for(let e=r.length-1;e>=0;e--){let n=r[e];if(n<t)return n}return 0}function yf(e){let t=[0],n=nd();if(n!==void 0){for(let r of n.segment(e))r.index>0&&t.push(r.index);return t}let r=0;for(let n of e)r>0&&t.push(r),r+=n.length;return t}function bf(e,t,n,r){let i=e.getLineLength(t);if(r){if(n>=i)return i;let r=e.offsetAt({line:t,character:0}),a=e.getTextSlice(r+n,r+i),o=nd();if(o!==void 0){for(let e of o.segment(a))return n+e.segment.length;return i}for(let e of a)return n+e.length;return i}if(n<=0)return 0;let a=e.offsetAt({line:t,character:0}),o=e.getTextSlice(a,a+n),s=0,c=nd();if(c!==void 0){for(let e of c.segment(o))s=e.index;return s}let l=0;for(let e of o)s=l,l+=e.length;return s}function xf(e,t){let n=t.direction===-1;return[e.offsetAt(n?t.end:t.start),e.offsetAt(Ud(t))]}function Sf(e,t){if(!Hd(t))return{start:t.start,end:t.end};let{line:n,character:r}=t.start,i=e.getLineText(n).length;return r<i?{start:{line:n,character:r},end:{line:n,character:i}}:n<e.lineCount-1?{start:{line:n,character:r},end:{line:n+1,character:0}}:{start:{line:n,character:r},end:{line:n,character:r}}}function Cf(e,t,n){if(t!==`
|
|
2135
|
+
`&&t!==`\r`&&t!==`\r
|
|
2136
|
+
`)return t;let r=e.positionAt(n).line,i=e.getLineText(r),a=wf(i);return a===0?t:t+i.slice(0,a)}function wf(e){let t=0;for(;t<e.length;t++){let n=e.charCodeAt(t);if(n!==32&&n!==9)break}return t}function Tf(e,t){let n=[];for(let[e,r]of t)n.push(Math.min(e,r),Math.max(e,r));let r=e.positionsAt(n);return t.map(([e,t],n)=>{let i=e===t?0:e<t?1:-1;return{start:r[n*2],end:r[n*2+1],direction:i}})}function Ef(e,t,n){if(t.text!==``||t.start!==t.end-1)return t;let r=e.positionAt(t.end);if(r.character===0)return t;let i=e.getLineText(r.line),a=i.slice(0,r.character);if(/[^ \t]/.test(a)||i[r.character-1]===` `)return t;let o=Math.max(0,r.character-n),s=i.slice(o,r.character);return s.length===n&&/^ +$/.test(s)?{...t,start:t.end-s.length}:t}function Df(e,t){let n=e.nodeType===1?e:e.parentElement;for(;n!==null&&Ff(n)===void 0;)n=n.parentElement;if(n===null)return null;let r=Ff(n);if(r===void 0)return null;if(e.nodeType===3)return e.parentElement===null?null:Nf(e.parentElement)===null?{line:r,character:Mf(n,e)+Lf(e.textContent,t)}:{line:r,character:Pf(e,t)};if(e.nodeType===1){let i=e;if(i.tagName===`DIV`){let e=0;for(let n=0;n<t;n++)e=Pf(i.childNodes[n]);return{line:r,character:e}}if(i.tagName===`BR`)return{line:r,character:0};if(i.tagName===`SPAN`){if(t<i.childNodes.length){let e=i.childNodes[t];if(e?.nodeType===1){let t=If(e);if(t!==void 0)return{line:r,character:t};let n=Nf(e),i=n===null?void 0:If(n);if(i!==void 0)return{line:r,character:i}}}return{line:r,character:t>0?Pf(i.childNodes[t-1]):Mf(n,i)}}return{line:r,character:Mf(n,i)}}return null}function Of(e){let t=[];for(let n of e.childNodes){if(n.nodeType!==1)continue;let e=n;if(e.tagName===`SPAN`){if(If(e)!==void 0){t.push(e);continue}for(let n of e.childNodes)n.nodeType===1&&If(n)!==void 0&&t.push(n)}}return t}function kf(e,t){let n=Math.max(0,t),r=[{container:e,index:0}];for(;r.length>0;){let e=r[r.length-1];if(e.index>=e.container.childNodes.length){r.pop();continue}let t=e.container.childNodes[e.index];if(e.index++,t.nodeType===3){let e=Lf(t.textContent,t.textContent?.length??0);if(n<=e)return[t,n];n-=e}else t.nodeType===1&&r.push({container:t,index:0})}return null}function Af(e,t){let n=0,r=[{container:e,index:0}];for(;r.length>0;){let e=r[r.length-1];if(e.index>=e.container.childNodes.length){r.pop();continue}let i=e.container.childNodes[e.index];if(i===t)return n;e.index++,i.nodeType===3?n+=Lf(i.textContent,i.textContent?.length??0):i.nodeType===1&&r.push({container:i,index:0})}return n}function jf(e,t){let n=t;for(;n!==null;){if(n===e)return!0;n=n.parentElement}return!1}function Mf(e,t){if(t.parentElement===e){let n=0,r=Array.prototype.indexOf.call(e.childNodes,t);for(let t=0;t<r;t++)n=Pf(e.childNodes[t]);return n}for(let n of Of(e))if(jf(n,t))return If(n)+(t.nodeType===3?Af(n,t):0);let n=0,r=t.nodeType===1?t:t.parentElement;for(;r!==null&&r.parentElement!==null&&Ff(r.parentElement)===void 0;){let e=r.parentElement,t=Array.prototype.indexOf.call(e.childNodes,r);for(let r=0;r<t;r++)n=Pf(e.childNodes[r]);r=e}return n}function Nf(e){let t=e;for(;t!==null;){if(Ff(t)!==void 0)return null;if(If(t)!==void 0)return t;t=t.parentElement}return null}function Pf(e,t){if(e===void 0)return 0;if(e.nodeType===3){let n=e.parentElement;if(n===null)return 0;let r=Nf(n);if(r===null)return 0;let i=If(r);if(i===void 0)return 0;let a=t===void 0?Lf(e.textContent,e.textContent?.length??0):Lf(e.textContent,t);return i+Af(r,e)+a}if(e.nodeType!==1)return 0;let n=e;if(n.tagName!==`SPAN`&&n.tagName!==`BR`)return 0;let r=If(n);if(r!==void 0)return r+(n.textContent?.length??0);let i=0;for(let e of n.childNodes)i=Math.max(i,Pf(e));return i}function Ff(e){let{line:t,lineType:n}=e.dataset;if(t!==void 0&&n!==`change-deletion`){let e=parseInt(t,10);if(!Number.isNaN(e))return e-1}}function If(e){let{char:t}=e.dataset;if(t!==void 0){let e=parseInt(t,10);if(!Number.isNaN(e))return e}}function Lf(e,t){let n=e??``,r=n.search(/[\r\n]/);return Math.min(t,r===-1?n.length:r)}var Rf=300,zf=100,Bf=`marker-popover`,Vf=class{#e;#t=[];#n=0;#r;#i;#a;#o;#s;#c;#l;#u=!1;constructor(e){this.#e=e}get markers(){return this.#t}isPopoverVisible(){return this.#l!==void 0}updatePopoverPosition(){let e=this.#l,t=this.#r;if(e===void 0||t===void 0)return;let n=this.#t[e];if(n===void 0){this.removePopover();return}this.#_(t,n.start.line,n.start.character)}setMarkers(e,t){this.#n=t.lineCount,this.#t=e.map(e=>({...e,start:t.normalizePosition(e.start),end:t.normalizePosition(e.end)})),this.removePopover()}listenHover(e){this.#a?.forEach(e=>e()),this.#a=void 0,this.#t.length!==0&&(this.#a=[Q(e,`mouseover`,e=>{if(this.#e.isMouseDown())return;let t=e.composedPath()[0];if(t===void 0)return;let n=this.#d(t);n===void 0?(this.#f(),this.#h()):this.#m(n)}),Q(e,`mouseleave`,()=>{this.#f(),this.#h()})])}removePopover(){this.#f(),this.#p(),this.#v()}cleanup(){this.#a?.forEach(e=>e()),this.#a=void 0,this.removePopover(),this.#t=[]}#d(e){let t=e.closest(`[data-line]`);if(t==null)return;let n=qu(t);if(n===void 0)return;let r;if(e.tagName===`SPAN`){let t=e.dataset.char;if(t===void 0||(r=parseInt(t,10),Number.isNaN(r)))return}else if(e.tagName===`BR`)r=0;else return;let i={line:n-1,character:r};for(let e=this.#t.length-1;e>=0;e--)if(Gd({start:i,end:i},this.#t[e]))return e}#f(){this.#o!==void 0&&(clearTimeout(this.#o),this.#o=void 0),this.#c=void 0}#p(){this.#s!==void 0&&(clearTimeout(this.#s),this.#s=void 0)}#m(e){if(e===this.#l||e===this.#c){this.#p();return}if(this.#f(),this.#p(),this.#r!==void 0){this.#y(e);return}this.#c=e,this.#o=setTimeout(()=>{this.#o=void 0,this.#c=void 0,this.#y(e)},Rf)}#h(){this.#u||(this.#p(),this.#s=setTimeout(()=>{this.#s=void 0,this.#u||this.removePopover()},zf))}#g(e,t,n,r,i=this.#e.popoverManager.getPlacementBounds()){_d(e,{gutterWidth:this.#e.getGutterWidth(),placeAbove:r,viewport:i,x:t,y:n})}#_(e,t,n){let{getCharX:r,getLineY:i,getLineHeight:a,popoverManager:o}=this.#e,[s,c]=r(t,n),l=a(),u=i(t)+c*l,d=e.offsetHeight,f={top:u+l,bottom:u+l+d},p={top:u-d,bottom:u},m=t>=this.#n-3,h=o.getPlacementBounds(),g=o.choosePlacement({preferred:f,fallback:p,viewport:h,popoverHeight:d,atDocumentEdge:m,placementKey:Bf})===`fallback`;this.#g(e,s,g?u:u+l,g,h)}#v(){this.#i?.forEach(e=>e()),this.#i=void 0,this.#r?.remove(),this.#r=void 0,this.#l=void 0,this.#u=!1,this.#e.popoverManager.resetPlacement(Bf)}#y(e){if(e===this.#l)return;let t=this.#e.getOverlayElement();if(e>=this.#t.length||t==null)return;let{start:n,message:r,severity:i}=this.#t[e],{line:a,character:o}=n,s=this.#r;if(this.#e.popoverManager.resetPlacement(Bf),s!==void 0){Uf(s,i);let t=s.firstElementChild;t?.dataset.markerMessage!==void 0&&(typeof r==`string`?t.textContent=r:r instanceof HTMLElement?t.replaceChildren(r):t.innerHTML=r.html),this.#_(s,a,o),this.#l=e;return}this.#r=Z(`div`,{dataset:{editorWidget:``,markerPopover:``,[Wf(i)]:``},children:[Z(`div`,{dataset:`markerMessage`,...typeof r==`string`?{textContent:r}:r instanceof HTMLElement?{children:[r]}:{innerHTML:r.html}})]},t),this.#_(this.#r,a,o),this.#l=e,this.#i=[Q(this.#r,`mouseenter`,()=>{this.#u=!0,this.#p()}),Q(this.#r,`mouseleave`,()=>{this.#u=!1,this.#h()})]}},Hf=[`error`,`warning`,`info`,`hint`];function Uf(e,t){for(let t of Hf)delete e.dataset[Wf(t)];e.dataset[Wf(t)]=``}function Wf(e){switch(e){case`error`:return`markerError`;case`warning`:return`markerWarning`;case`info`:return`markerInfo`;case`hint`:return`markerHint`}}var Gf=new Map([[`(`,`)`],[`[`,`]`],[`{`,`}`]]),Kf=new Map([...Gf].map(([e,t])=>[t,e])),qf=1e3,Jf=5e4;function Yf(e,t,n){let r=Xf(e,t,e.normalizePosition(n));if(r===void 0)return;let i=Gf.get(r.char),a=Kf.get(r.char);if(i!==void 0)return ap(r,$f(e,t,r,i));if(a!==void 0)return ap(ep(e,t,r,a),r)}function Xf(e,t,n){let r=Zf(n);if(r!==void 0){let n=Qf(e,t,r);if(n!==void 0)return n}return Qf(e,t,n)}function Zf(e){if(e.character>0)return{line:e.line,character:e.character-1}}function Qf(e,t,n){let r=e.getLineText(n.line)[n.character];if(!(r===void 0||!Gf.has(r)&&!Kf.has(r)||tp(t,n)))return{...n,char:r}}function $f(e,t,n,r){let i=0,a=0,o=0;for(let s=n.line;s<e.lineCount;s++){if(a>=qf)return;a++;let c=e.getLineText(s),l=t.getStringCommentRegexpRangesInLine(s),u={index:0},d=s===n.line?n.character:0;for(let e=d;e<c.length;e++){if(o>=Jf)return;if(o++,rp(l,e,u))continue;let t=c[e];if(t===n.char)i++;else if(t===r&&(i--,i===0))return{line:s,character:e,char:t}}}}function ep(e,t,n,r){let i=0,a=0,o=0;for(let s=n.line;s>=0;s--){if(a>=qf)return;a++;let c=e.getLineText(s),l=t.getStringCommentRegexpRangesInLine(s),u={index:l===null?-1:l.length-1},d=s===n.line?n.character:c.length-1;for(let e=d;e>=0;e--){if(o>=Jf)return;if(o++,ip(l,e,u))continue;let t=c[e];if(t===n.char)i++;else if(t===r&&(i--,i===0))return{line:s,character:e,char:t}}}}function tp(e,t){return np(e.getStringCommentRegexpRangesInLine(t.line),t.character)}function np(e,t){if(e===null)return!1;for(let[n,r]of e){if(t<n)return!1;if(t<r)return!0}return!1}function rp(e,t,n){if(e===null)return!1;for(;n.index<e.length&&t>=e[n.index][1];)n.index++;let r=e[n.index];return r!==void 0&&t>=r[0]}function ip(e,t,n){if(e===null)return!1;for(;n.index>=0&&t<e[n.index][0];)n.index--;let r=e[n.index];return r!==void 0&&t<r[1]}function ap(e,t){if(!(e===void 0||t===void 0))return[op(e),op(t)]}function op(e){return{start:{line:e.line,character:e.character},end:{line:e.line,character:e.character+1}}}var sp=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
|
|
2137
|
+
<symbol id="diffs-editor-icon-close" viewBox="0 0 16 16">
|
|
2138
|
+
<path fill="currentColor" d="M3.21967 3.21967C3.51256 2.92678 3.98744 2.92678 4.28033 3.21967L8 6.93934L11.7197 3.21967C12.0126 2.92678 12.4874 2.92678 12.7803 3.21967C13.0732 3.51256 13.0732 3.98744 12.7803 4.28033L9.06066 8L12.7803 11.7197C13.0732 12.0126 13.0732 12.4874 12.7803 12.7803C12.4874 13.0732 12.0126 13.0732 11.7197 12.7803L8 9.06066L4.28033 12.7803C3.98744 13.0732 3.51256 13.0732 3.21967 12.7803C2.92678 12.4874 2.92678 12.0126 3.21967 11.7197L6.93934 8L3.21967 4.28033C2.92678 3.98744 2.92678 3.51256 3.21967 3.21967Z"></path>
|
|
2139
|
+
</symbol>
|
|
2140
|
+
<symbol id="diffs-editor-icon-arrow-up" viewBox="0 0 16 16">
|
|
2141
|
+
<path fill="currentColor" transform="rotate(-90 8 8)" d="M8.46967 2.21967C8.17678 2.51256 8.17678 2.98744 8.46967 3.28033L12.4393 7.25H1.75C1.33579 7.25 1 7.58579 1 8C1 8.41421 1.33579 8.75 1.75 8.75H12.4393L8.46967 12.7197C8.17678 13.0126 8.17678 13.4874 8.46967 13.7803C8.76256 14.0732 9.23744 14.0732 9.53033 13.7803L14.7803 8.53033C15.0732 8.23744 15.0732 7.76256 14.7803 7.46967L9.53033 2.21967C9.23744 1.92678 8.76256 1.92678 8.46967 2.21967Z"></path>
|
|
2142
|
+
</symbol>
|
|
2143
|
+
<symbol id="diffs-editor-icon-arrow-down" viewBox="0 0 16 16">
|
|
2144
|
+
<path fill="currentColor" transform="rotate(90 8 8)" d="M8.46967 2.21967C8.17678 2.51256 8.17678 2.98744 8.46967 3.28033L12.4393 7.25H1.75C1.33579 7.25 1 7.58579 1 8C1 8.41421 1.33579 8.75 1.75 8.75H12.4393L8.46967 12.7197C8.17678 13.0126 8.17678 13.4874 8.46967 13.7803C8.76256 14.0732 9.23744 14.0732 9.53033 13.7803L14.7803 8.53033C15.0732 8.23744 15.0732 7.76256 14.7803 7.46967L9.53033 2.21967C9.23744 1.92678 8.76256 1.92678 8.46967 2.21967Z"></path>
|
|
2145
|
+
</symbol>
|
|
2146
|
+
<symbol id="diffs-editor-icon-case" viewBox="0 0 16 16">
|
|
2147
|
+
<path fill="currentColor" d="M12.2969 12.9969C10.7109 12.9969 9.61719 12.0125 9.61719 10.5047C9.61719 9.06719 10.6172 8.16094 12.5 8.15312H14.6641V7.31719C14.6641 6.23906 14.0391 5.64531 12.9297 5.64531C11.875 5.64531 11.2734 6.18437 11.1953 7.00469H9.92969C10.0156 5.56719 10.9922 4.52031 12.9766 4.52031C14.7266 4.52031 16 5.47344 16 7.2V12.8641H14.7109V11.8406H14.6719C14.2578 12.5047 13.5078 12.9969 12.2969 12.9969ZM12.6562 11.8797C13.8047 11.8797 14.6641 11.1609 14.6641 10.1375V9.18437H12.6016C11.4766 9.18437 10.9922 9.71562 10.9922 10.4578C10.9922 11.4266 11.7969 11.8797 12.6562 11.8797Z"></path>
|
|
2148
|
+
<path fill="currentColor" d="M1.42188 12.8641H0L3.79688 2H5.1875L8.98438 12.8641H7.54688L6.46875 9.66094H2.5L1.42188 12.8641ZM4.50781 3.60938H4.46875L2.86719 8.55937H6.10156L4.50781 3.60938Z"></path>
|
|
2149
|
+
</symbol>
|
|
2150
|
+
<symbol id="diffs-editor-icon-whole-word" viewBox="0 0 16 16">
|
|
2151
|
+
<path fill="currentColor" d="M11.4089 9.99449C11.1417 9.99449 10.8961 9.95595 10.6722 9.87887C10.4519 9.80179 10.2605 9.69167 10.098 9.54852C9.93551 9.40537 9.81453 9.23469 9.73508 9.03648H9.67007V9.91191H8.5V2H9.70258V5.01721H9.76758C9.81092 4.86671 9.88314 4.7309 9.98426 4.60977C10.089 4.48497 10.2136 4.37853 10.358 4.29043C10.5025 4.19867 10.6668 4.13076 10.851 4.08672C11.0352 4.039 11.2302 4.01514 11.436 4.01514C11.8802 4.01514 12.2648 4.11792 12.5898 4.32347C12.9149 4.52535 13.164 4.81532 13.3374 5.19339C13.5107 5.57146 13.5974 6.02478 13.5974 6.55334V7.45079C13.5974 7.97568 13.5089 8.429 13.332 8.81074C13.1586 9.1888 12.9076 9.48061 12.579 9.68617C12.2504 9.89172 11.8604 9.99449 11.4089 9.99449ZM11.0785 8.99243C11.353 8.99243 11.5859 8.92636 11.7773 8.79422C11.9723 8.66208 12.1204 8.46937 12.2215 8.2161C12.3226 7.95916 12.3732 7.65267 12.3732 7.29663V6.73503C12.3732 6.37164 12.3208 6.06332 12.2161 5.81005C12.115 5.55311 11.9669 5.35673 11.7719 5.22092C11.5769 5.08511 11.3385 5.01721 11.0568 5.01721C10.7824 5.01721 10.5422 5.08328 10.3364 5.21542C10.1341 5.34389 9.97704 5.52925 9.86509 5.77151C9.75675 6.01009 9.70258 6.2964 9.70258 6.63042V7.47281C9.70258 7.77013 9.76036 8.03441 9.87592 8.26566C9.99509 8.49323 10.1576 8.67125 10.3635 8.79972C10.5729 8.92819 10.8113 8.99243 11.0785 8.99243Z"></path>
|
|
2152
|
+
<path fill="currentColor" d="M4.70482 9.99449C4.15229 9.99449 3.70087 9.83482 3.35057 9.51548C3.00388 9.19247 2.83054 8.75935 2.83054 8.2161C2.83054 7.70223 3.00207 7.28745 3.34515 6.97178C3.69184 6.65244 4.19562 6.49277 4.8565 6.49277H6.30284V5.94769C6.30284 5.61367 6.20533 5.36774 6.01032 5.20991C5.81531 5.04841 5.55349 4.96765 5.22485 4.96765C5.00817 4.96765 4.82941 4.99702 4.68857 5.05575C4.54773 5.11081 4.43758 5.18789 4.35813 5.28699C4.27868 5.38243 4.22271 5.49621 4.19021 5.62835H3.04722C3.06527 5.3861 3.12305 5.16586 3.22056 4.96765C3.32168 4.76577 3.46252 4.59326 3.64309 4.4501C3.82727 4.30328 4.05297 4.19133 4.32021 4.11425C4.59106 4.03716 4.90525 3.99862 5.26277 3.99862C5.67086 3.99862 6.04463 4.06286 6.38409 4.19133C6.72356 4.31613 6.99441 4.52168 7.19665 4.80798C7.39888 5.09429 7.5 5.4797 7.5 5.96421V9.9064H6.35701V9.1521H6.30284C6.21978 9.29892 6.10783 9.43657 5.96698 9.56504C5.82614 9.69351 5.65099 9.79812 5.44153 9.87887C5.23569 9.95595 4.99012 9.99449 4.70482 9.99449ZM5.07318 9.04749C5.3043 9.04749 5.51196 8.99977 5.69613 8.90434C5.88031 8.80523 6.02657 8.67309 6.13491 8.50791C6.24686 8.34274 6.30284 8.1537 6.30284 7.94081V7.31314H5.04609C4.69579 7.31314 4.43939 7.39206 4.27688 7.5499C4.11798 7.70773 4.03853 7.90961 4.03853 8.15554C4.03853 8.4602 4.14326 8.68594 4.35272 8.83276C4.56578 8.97591 4.80594 9.04749 5.07318 9.04749Z"></path>
|
|
2153
|
+
<path fill="currentColor" d="M2.5 12.5L13.5 12.5C14.3284 12.5 15 11.8284 15 11V9.5C15 9.22386 15.2239 9 15.5 9C15.7761 9 16 9.22386 16 9.5V11C16 12.3807 14.8807 13.5 13.5 13.5L2.5 13.5C1.11929 13.5 -7.56324e-07 12.3807 0 11L6.55675e-08 9.5C3.58362e-07 9.22386 0.223858 9 0.5 9C0.776142 9 1 9.22386 1 9.5L1 11C0.999999 11.8284 1.67157 12.5 2.5 12.5Z"></path>
|
|
2154
|
+
</symbol>
|
|
2155
|
+
<symbol id="diffs-editor-icon-regex" viewBox="0 0 16 16">
|
|
2156
|
+
<path fill="currentColor" d="M8.60788 6.59074C8.78227 6.46701 9.02141 6.60508 9.00146 6.81797L8.77564 9.22666C8.76189 9.37331 8.87726 9.5 9.02455 9.5H9.97548C10.1228 9.5 10.2381 9.37331 10.2244 9.22667L9.99858 6.81801C9.97862 6.60513 10.2178 6.46706 10.3922 6.59079L12.3652 7.99066C12.4853 8.07589 12.6527 8.03932 12.7264 7.91177L13.2018 7.08823C13.2755 6.96068 13.2234 6.79742 13.0896 6.73601L10.8907 5.72723C10.6963 5.63807 10.6963 5.36193 10.8907 5.27277L13.0896 4.264C13.2234 4.20258 13.2755 4.03932 13.2018 3.91177L12.7263 3.08824C12.6527 2.96068 12.4853 2.92411 12.3652 3.00934L10.3922 4.40921C10.2178 4.53294 9.97862 4.39486 9.99858 4.18198L10.2244 1.77334C10.2381 1.62669 10.1228 1.5 9.97548 1.5H9.02455C8.87726 1.5 8.76189 1.62669 8.77564 1.77334L9.00146 4.18203C9.02141 4.39491 8.78227 4.53298 8.60788 4.40926L6.63479 3.00934C6.51466 2.92411 6.34726 2.96068 6.27362 3.08823L5.79815 3.91177C5.72451 4.03932 5.77654 4.20258 5.91041 4.26399L8.10929 5.27277C8.30363 5.36193 8.30363 5.63807 8.10929 5.72723L5.91041 6.73601C5.77653 6.79742 5.7245 6.96068 5.79814 7.08824L6.27361 7.91177C6.34725 8.03932 6.51466 8.07589 6.63478 7.99066L8.60788 6.59074Z"></path>
|
|
2157
|
+
<path fill="currentColor" d="M4 11C3.44772 11 3 11.4477 3 12V13C3 13.5523 3.44772 14 4 14H5C5.55228 14 6 13.5523 6 13V12C6 11.4477 5.55228 11 5 11H4Z"></path>
|
|
2158
|
+
</symbol>
|
|
2159
|
+
<symbol id="diffs-editor-icon-replace" viewBox="0 0 16 16">
|
|
2160
|
+
<path fill="currentColor" fill-rule="evenodd" clip-rule="evenodd" d="M5.28033 5.71967C5.57322 6.01256 5.57322 6.48744 5.28033 6.78033L3.56066 8.5H11.75C12.7165 8.5 13.5 7.7165 13.5 6.75V2.75C13.5 2.33579 13.8358 2 14.25 2C14.6642 2 15 2.33579 15 2.75V6.75C15 8.54493 13.5449 10 11.75 10H3.56066L5.28033 11.7197C5.57322 12.0126 5.57322 12.4874 5.28033 12.7803C4.98744 13.0732 4.51256 13.0732 4.21967 12.7803L1.21967 9.78033C0.926777 9.48744 0.926777 9.01256 1.21967 8.71967L4.21967 5.71967C4.51256 5.42678 4.98744 5.42678 5.28033 5.71967Z"></path>
|
|
2161
|
+
</symbol>
|
|
2162
|
+
<symbol id="diffs-editor-icon-replace-all" viewBox="0 0 16 16">
|
|
2163
|
+
<path fill="currentColor" fill-rule="evenodd" clip-rule="evenodd" d="M10.7197 0.21967C11.0126 -0.0732233 11.4874 -0.0732233 11.7803 0.21967L14.7803 3.21967C15.0732 3.51256 15.0732 3.98744 14.7803 4.28033L11.7803 7.28033C11.4874 7.57322 11.0126 7.57322 10.7197 7.28033C10.4268 6.98744 10.4268 6.51256 10.7197 6.21967L12.4393 4.5H4.25C3.2835 4.5 2.5 5.2835 2.5 6.25V6.875C2.5 7.28921 2.16421 7.625 1.75 7.625C1.33579 7.625 1 7.28921 1 6.875V6.25C1 4.45507 2.45508 3 4.25 3H12.4393L10.7197 1.28033C10.4268 0.987437 10.4268 0.512563 10.7197 0.21967ZM5.28033 8.71967C5.57322 9.01256 5.57322 9.48744 5.28033 9.78033L3.56066 11.5H11.75C12.7165 11.5 13.5 10.7165 13.5 9.75V9.125C13.5 8.71079 13.8358 8.375 14.25 8.375C14.6642 8.375 15 8.71079 15 9.125V9.75C15 11.5449 13.5449 13 11.75 13H3.56066L5.28033 14.7197C5.57322 15.0126 5.57322 15.4874 5.28033 15.7803C4.98744 16.0732 4.51256 16.0732 4.21967 15.7803L1.21967 12.7803C0.926777 12.4874 0.926777 12.0126 1.21967 11.7197L4.21967 8.71967C4.51256 8.42678 4.98744 8.42678 5.28033 8.71967Z"></path>
|
|
2164
|
+
</symbol>
|
|
2165
|
+
</svg>`,cp=()=>{let e=document.createElement(`div`);e.innerHTML=sp;let t=e.firstElementChild;if(t===null||!(t instanceof SVGSVGElement))throw Error(`Failed to create sprite element`);return t},lp=(e,t=16)=>`<svg width="${t}" height="${t}" aria-hidden="true" focusable="false">
|
|
2166
|
+
<use href="#diffs-editor-icon-${e}"></use>
|
|
2167
|
+
</svg>`,up=class{#e;#t;#n;#r;#i;#a;constructor(e){let{textDocument:t,containerElement:n,defaultQuery:r,mode:i=`find`,initialMatch:a,scrollToMatch:o,applyReplace:s,onUpdate:c,onClose:l}=e,u={text:r,replaceText:``,caseSensitive:!1,wholeWord:!1,regex:!1},d={all:[],current:void 0},f=Z(`div`,{dataset:{matches:``,noMatches:``},textContent:`No results`}),p=e=>{d.all=u.text===``?[]:t.search(u);let n=d.all.length===0;if(A.disabled=n,j.disabled=n,n){f.textContent=`No results`,f.dataset.noMatches=``,d.current=void 0,c([]);return}if(delete f.dataset.noMatches,e?.syncSelection===!1){m(c(d.all,{syncSelection:!1}));return}m(c(d.all))};this.#n=p;let m=e=>{if(e===void 0)f.textContent=`${d.all.length} results`;else{let[t,n]=e;f.textContent=`${d.all.findIndex(e=>e[0]===t&&e[1]===n)+1} of ${d.all.length}`}d.current=e},h=(e,t)=>{u[e]=t,p()},g=(e=!1,t=!1)=>{let n=d.all,r=n[0];if(n.length>0)if(e){let e=d.current?.[0]??0;r=n.at(-1);for(let t of n)if(t[1]<=e)r=t;else break}else{let e=d.current?.[1]??0;for(let t of n)if(t[0]>=e){r=t;break}}r!==void 0&&(m(r),o(r,t)),d.current=r};this.#i=e=>g(e,!0);let _=(e,n)=>({start:e,end:n,text:Eu(e=>t.positionAt(e),e=>t.offsetAt(e),e=>t.getLineText(e),u,e,n)}),v=()=>{if(u.text===``||d.all.length===0)return;let e=d.current;if(e===void 0&&(g(!1,!0),e=d.current,e===void 0))return;let[t,n]=e,r=_(t,n);s([r]),o([t+r.text.length,t+r.text.length],!0),d.current=void 0,p()},y=()=>{u.text===``||d.all.length===0||(s(d.all.map(([e,t])=>_(e,t))),d.current=void 0,p())},b=()=>{this.cleanup(),l()};this.#a=b;let x=e=>Z(`button`,{type:`button`,title:e.label,ariaLabel:e.label,dataset:{searchIcon:``,...e.dataset},innerHTML:lp(e.icon,e.size??16),onclick:e.onClick}),S=(e,t,n)=>{let r=x({icon:e,label:t,size:14,onClick:()=>{let e=!u[n];r.ariaPressed=String(e),h(n,e)}});return r.ariaPressed=String(u[n]),r},C=S(`case`,`Match Case`,`caseSensitive`),w=S(`whole-word`,`Whole Word`,`wholeWord`),T=S(`regex`,`Regexp`,`regex`),E=Z(`input`,{type:`text`,placeholder:`Replace`,dataset:`replace`,value:``,oninput:e=>{u.replaceText=e.target.value},onkeydown:e=>{if(e.isComposing)return;let t=Iu(e);e.key===`Escape`?(e.preventDefault(),b()):e.key===`Enter`?(e.preventDefault(),v()):t!==void 0&&(e.preventDefault(),g(t===`previous`,!0))}});this.#t=Z(`input`,{type:`text`,placeholder:`Search`,dataset:`search`,value:r,oninput:e=>{u.text=e.target.value,d.current=void 0,p()},onkeydown:e=>{let t=Iu(e);e.key===`Escape`?(e.preventDefault(),b()):e.key===`Enter`?(e.preventDefault(),g(e.shiftKey,!0)):t===void 0?ku(e)&&(e.key===`f`||e.code===`KeyF`)&&(e.preventDefault(),te(e.altKey?`replace`:`find`)):(e.preventDefault(),g(t===`previous`,!0))}});let D=Z(`div`,{dataset:`searchToggles`,children:[C,w,T]}),O=Z(`div`,{dataset:{inputBox:``,find:``},children:[this.#t,D]}),ee=Z(`div`,{dataset:{inputBox:``,replace:``,replaceCell:``},children:[E]}),k=Z(`div`,{dataset:{replaceActions:``,replaceCell:``},children:[x({icon:`replace`,label:`Replace`,onClick:v}),x({icon:`replace-all`,label:`Replace All`,onClick:y})]}),A=x({icon:`arrow-up`,label:`Previous`,onClick:()=>{g(!0)}}),j=x({icon:`arrow-down`,label:`Next`,onClick:()=>{g()}});A.disabled=!0,j.disabled=!0;let M=Z(`div`,{dataset:`searchNav`,children:[A,j]}),N=x({icon:`close`,label:`Close`,onClick:b,dataset:{searchClose:``}}),P=Z(`div`,{dataset:{searchGrid:``,mode:i},children:[O,ee,k,f,M,N]}),te=e=>{P.dataset.mode=e,this.#t.focus(),this.#t.select()};this.#r=te,this.#e=Z(`div`,{dataset:`searchPanel`,children:[Z(`div`,{dataset:`editorWidget`,children:[P]})]}),d.current=a,n.before(this.#e),requestAnimationFrame(()=>{a===void 0?c([]):p(),this.#t.select()})}focus(){this.#t.focus()}navigate(e){this.#i?.(e)}updateMatches(e){this.#n?.(e)}setMode(e){this.#r?.(e)}close(){this.#a?.()}cleanup(){this.#e.remove()}},dp=class{#e;#t;#n;constructor(e,t,n){this.#e=Z(`div`,{dataset:{editorWidget:``,selectionActionPopover:``},contentEditable:`false`,children:[e]},t),this.#t=this.#e.offsetHeight,this.#n=new ResizeObserver(()=>{let e=this.#e.offsetHeight;e!==this.#t&&(this.#t=e,n())}),this.#n.observe(this.#e)}reposition(e,t,n,r,i,a){this.#e.style.visibility=i?``:`hidden`,_d(this.#e,{gutterWidth:n,placeAbove:r,viewport:a,x:e,y:t})}get height(){return this.#t}cleanup(){this.#n.disconnect(),this.#e.remove()}};function fp(e){return{selections:e.selections?.map(e=>({start:{...e.start},end:{...e.end},direction:e.direction})),view:e.view===void 0?void 0:{...e.view}}}function pp(e){return typeof e==`object`?e:e===`indexedDB`?new vp:new mp}var mp=class{#e=new Map;get(e){let t=this.#e.get(e);return t===void 0?void 0:fp(t)}set(e,t){this.#e.set(e,fp(t))}},hp=`pierre-diffs-editor-state`,gp=1,_p=`states`,vp=class{#e=yp();async get(e){let t=await this.#e;if(t===void 0)return;let n=await bp(t.transaction(_p,`readonly`).objectStore(_p).get(e));return n===void 0?void 0:fp(n)}async set(e,t){let n=await this.#e;n!==void 0&&await bp(n.transaction(_p,`readwrite`).objectStore(_p).put(fp(t),e))}};function yp(){try{let e=globalThis.indexedDB;if(e===void 0)return Promise.resolve(void 0);let t=e.open(hp,gp);return t.onupgradeneeded=()=>{let e=t.result;e.objectStoreNames.contains(_p)||e.createObjectStore(_p)},bp(t)}catch{return Promise.resolve(void 0)}}function bp(e){return new Promise((t,n)=>{e.onsuccess=()=>t(e.result),e.onerror=()=>n(e.error)})}var xp=4096,Sp=/\p{Mark}/u,Cp=class{#e;#t;#n;#r=new Map;ch=-1;tabSize=2;lineHeight=20;paddingTop=0;init(e){if(this.#e===e&&this.#t!==void 0&&this.ch!==-1)return;if(this.#e=e,this.#t??=document.createElement(`canvas`).getContext(`2d`)??void 0,this.#t===void 0)throw Error(`Could not get canvas context`);let t=e.parentElement;if(t!==null){let{paddingTop:e}=getComputedStyle(t);e.endsWith(`px`)&&(this.paddingTop=parseFloat(e.slice(0,-2)))}let{fontSize:n,fontFamily:r,tabSize:i,lineHeight:a}=getComputedStyle(e);a.endsWith(`px`)?this.lineHeight=parseFloat(a.slice(0,-2)):n.endsWith(`px`)&&(this.lineHeight=Zu(parseFloat(n.slice(0,-2))*parseFloat(a)));let o=n+` `+r;(this.#n!==o||this.ch===-1)&&(this.#n=o,this.#t.font=o,this.ch=this.canvasMeasureTextWidth(`0`),this.clearTextWidthCache());let s=parseInt(i,10);Number.isNaN(s)||(this.tabSize=s)}remeasureCharacterWidth(){if(this.#t===void 0||this.#n===void 0)return!1;this.#t.font=this.#n;let e=this.canvasMeasureTextWidth(`0`),t=e!==this.ch;t&&(this.ch=e);let n=this.#a();return t||n}measureTextWidth(e){if(!e.includes(` `))return this.#i(e);if(this.#t===void 0)throw Error(`Metrics not initialized`);let t=Dp(e,this.tabSize);if(t!==-1)return t*this.ch;let n=0,r=0,i=this.tabSize*this.ch;for(let t=0;t<e.length;t++)if(e.charCodeAt(t)===9){if(t>r&&(n+=this.#i(e.slice(r,t))),i>0){let e=n%i;n+=e===0?i:i-e}r=t+1}return r<e.length&&(n+=this.#i(e.slice(r))),Zu(n)}#i(e){return wp(e)?this.domMeasureTextWidth(e):this.canvasMeasureTextWidth(e)}canvasMeasureTextWidth(e){if(this.#t===void 0)throw Error(`Metrics not initialized`);return Zu(this.#t.measureText(e).width)}domMeasureTextWidth(e){if(this.#e===void 0)throw Error(`Metrics not initialized`);let t=e+`|`+this.#n,n=this.#r.get(t);if(n!==void 0)return n;let r=Z(`span`,{style:{position:`absolute`,top:`0`,left:`0`,visibility:`hidden`,pointerEvents:`none`,whiteSpace:`pre`,font:`inherit`},textContent:e},this.#e),i;try{i=Zu(r.getBoundingClientRect().width)}finally{r.remove()}if(this.#r.size>=xp){let e=this.#r.keys().next().value;e!==void 0&&this.#r.delete(e)}return this.#r.set(t,i),i}clearTextWidthCache(){this.#a()}#a(){let e=this.#r.size>0;return this.#r.clear(),e}};function wp(e){for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n>=55296&&n<=57343||n===8205||n===65038||n===65039||n>127&&Sp.test(e.charAt(t)))return!0}return!1}function Tp(e,t){let n=Math.max(0,Math.min(t,e.length));if(n===0||n===e.length||!wp(e))return n;let r=nd();if(r!==void 0){for(let t of r.segment(e)){let e=t.index,r=e+t.segment.length;if(n>e&&n<r)return r;if(n<=e)break}return n}let i=0;for(let t of e){let e=i+t.length;if(n>i&&n<e)return e;if(n<=i)break;i=e}return n}function Ep(e){if(!wp(e))return;let t=[0],n=nd();if(n!==void 0){for(let r of n.segment(e))t.push(r.index+r.segment.length);return t}let r=0;for(let n of e)r+=n.length,t.push(r);return t}function Dp(e,t){let n=0;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);if(i>127)return-1;n+=i===9?t-n%t:1}return n}var Op=500,kp=0,Ap=class{#e;#t;#n;#r=`dark`;#i=``;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=!1;#h=[Ge];#g=[];#_=0;#v=[];#y=-1;#b=!0;#x=!1;#S=0;#C=++kp;#w=-1;#T=-1;#E;#D=0;#O=[];#k=!1;#A=Xu(async e=>{if(this.#m)return;let{startingLine:t=0,totalLines:n=1/0}=e??{},r=Math.min(n===1/0?1/0:t+n,this.#o.lineCount);if(this.#t===void 0&&!Np(this.#o.languageId)){if(await this.#e.loadLanguage(this.#o.languageId),this.#m)return;this.#t=this.#e.getLanguage(this.#o.languageId)}this.#F(),this.#V(r)},500);#j=({data:e})=>{if(typeof e!=`object`||!e)return;let{type:t,tokenizerId:n,jobId:r}=e;t===`tokenize`&&n===this.#C&&typeof r==`number`&&r===this.#S&&(this.#w>=0?this.#q(r):this.#J(r))};get themeType(){return this.#r}getStringCommentRegexpRangesInLine(e){if(!this.#d||e<0||e>=this.#o.lineCount||(this.#I(),this.#t===void 0))return null;if(this.#O[e]===void 0){this.#K(e);let t=this.#h[e]??Ge,n=this.#H(e,t);this.#h[e+1]=n.state}return this.#O[e]??null}constructor({codeOptions:e,highlighter:t,textDocument:n,matchBrackets:r,setStyle:i,onDeferTokenize:a,onThemeChange:o,__debug:s}){let{themeType:c=`system`,theme:l=_e,tokenizeMaxLineLength:u=1e3}=e;this.#n=window.matchMedia(`(prefers-color-scheme: dark)`);let d;if(d=c===`system`?this.#N():c,typeof l!=`string`&&c===`system`){let e=new MutationObserver(e=>{for(let{type:t,attributeName:n}of e)if(t===`attributes`&&n!==null&&(n===`class`||n.startsWith(`data-`))){let e=this.#N();this.#M(l[e],e);break}});e.observe(document.documentElement,{attributes:!0}),e.observe(document.body,{attributes:!0}),this.#p=[Q(this.#n,`change`,()=>{let e=this.#N();this.#M(l[e],e)}),()=>e.disconnect()]}this.#e=t,this.#o=n,this.#s=u,this.#c=i,this.#l=a,this.#u=o,this.#d=r!==!1,this.#f=s??!1,this.#I(),this.#a=[],this.#P(typeof l==`string`?l:l[d],typeof l==`string`?void 0:d)}#M(e,t){e===this.#i&&t===this.#r||(this.#P(e,t),this.stopBackgroundTokenize(),this.#h=[Ge],this.#g=[],this.#_=0,this.#v=[],this.#t!==void 0&&this.#o.lineCount>0&&this.#B(0),this.#u?.())}#N(){try{if(typeof document<`u`&&typeof getComputedStyle==`function`&&document.body!=null){let e=getComputedStyle(document.body).colorScheme.split(/\s+/),t=e.includes(`dark`);if(t!==e.includes(`light`))return t?`dark`:`light`}}catch{}return this.#n.matches?`dark`:`light`}syncTheme(e){let{themeType:t=`system`,theme:n=_e}=e;if(typeof n==`string`){let e=this.#e.getTheme(n).type;if(n===this.#i&&e===this.#r)return;this.#M(n,e);return}let r=t===`system`?this.#N():t,i=n[r];r===this.#r&&i===this.#i||this.#M(i,r)}#P(e,t){let{theme:n,colorMap:r}=this.#e.setTheme(e),{colors:i={}}=this.#e.getTheme(e),a=i[`editor.selectionBackground`],o=i[`editor.lineHighlightBackground`],s=o!=null&&o.trim()!==``&&!fe.isFullyTransparent(o)?o:void 0,c=i[`editor.lineHighlightBorder`]??(s==null?`color-mix(in lab, var(--diffs-bg) 70%, var(--diffs-fg))`:`transparent`),l=s==null?`100%`:`85%`,u=i[`editorCursor.foreground`],d=i[`editor.findMatchBackground`],f=i[`editor.findMatchHighlightBackground`],p=i[`editorBracketMatch.background`],m=i[`editorBracketMatch.border`],h=i[`editorHint.foreground`],g=i[`editorInfo.foreground`],_=i[`editorWarning.foreground`],v=i[`editorError.foreground`];this.#c(`:host {
|
|
2168
|
+
--diffs-editor-selection-bg: ${a??`var(--diffs-line-bg)`};
|
|
2169
|
+
--diffs-editor-line-highlight-border: ${c};
|
|
2170
|
+
--diffs-editor-active-line-source-mix: ${l};
|
|
2171
|
+
--diffs-editor-match-bg: ${d??`initial`};
|
|
2172
|
+
--diffs-editor-match-highlight-bg: ${f??`initial`};
|
|
2173
|
+
--diffs-editor-bracket-match-bg: ${p??`initial`};
|
|
2174
|
+
--diffs-editor-bracket-match-border: ${m??`initial`};
|
|
2175
|
+
--diffs-editor-cursor-fg: ${u??`initial`};
|
|
2176
|
+
--diffs-editor-hint-fg: ${h??`initial`};
|
|
2177
|
+
--diffs-editor-info-fg: ${g??`initial`};
|
|
2178
|
+
--diffs-editor-warning-fg: ${_??`initial`};
|
|
2179
|
+
--diffs-editor-error-fg: ${v??`initial`};
|
|
2180
|
+
}`),this.#i=e,this.#r=t??n.type,this.#a=r}#F(){if(this.#i===``)return;let{colorMap:e}=this.#e.setTheme(this.#i);this.#a=e}cleanUp(){this.#m=!0,this.stopBackgroundTokenize(),this.#R(),this.#p?.forEach(e=>e()),this.#p=void 0}tokenize(e,t,n=!1){if(this.#I(),this.#F(),this.#t===void 0&&!Np(this.#o.languageId))throw Error(`Grammar for language "${this.#o.languageId}" not loaded`);this.#d&&(this.#O.length=Math.min(this.#O.length,e.startLine));let{lineCount:r}=this.#o,{startingLine:i=0,totalLines:a=1/0}=t??{},o=a===1/0?r:Math.min(i+a,r),s=e.startLine,c=Math.max(i,s),l=t!==void 0&&a!==1/0&&e.lineDelta>0&&s<o&&e.endLine>=o,u=e.lineDelta===0&&(e.changedLineChanges?.every(([,,e])=>e===0)??!0),d=n&&e.lineDelta!==0&&s>=i,f=u||t===void 0||s>=c,p=e.changedLineRanges??[[s,e.endLine]];this.#g=[],this.#_=0,this.#v=[];let m=-1;if(s<c)for(let[e,t]of p)e<c&&(m=Math.max(m,Math.min(t,c-1)));let h=m>=s&&(u||e.lineDelta<0);u?this.#K(s):(this.#W(e),(t===void 0||s>=c)&&this.#K(c));let g=0,_=p[g][1],v,y=0,b=u?p[g][0]:c,x=!1,S=new Map,C=h?new Map:void 0;if(C!==void 0&&!u){let e=Math.min(m+1,c,o);if(e>s){this.#K(e);let t=s,n=this.#h[t]??Ge;for(;t<e;t++){let e=this.#H(t,n);n=e.state,C.set(t,e.resolvedTokens)}this.#h[e]=n}}let w=this.#h[b]??Ge;for(;b<o;){let e=u?this.#h[b+1]:d?this.#G(b+1):void 0;f&&(this.#h[b]=w);let{resolvedTokens:t,state:n}=this.#H(b,w);if(w=n,b>=c?S.set(b,t):C?.set(b,t),f&&(this.#h[b+1]=w),x=b>=_&&(u||d)&&e!==void 0&&w.equals(e),x){g++;let e=p[g];if(e===void 0)break;if(e[0]>=o){v=e[0],y=g;break}let t=this.#h[e[0]];if(d)for(let n=b+2;n<=e[0]&&(t=this.#G(n),t!==void 0);n++)this.#h[n]=t;t===void 0?(_=e[1],b++):(b=e[0],w=t,_=e[1]),x=!1;continue}b++}if(f&&(b<o?this.#h[b+1]=w:this.#h[b]=w),x&&d&&v===void 0){for(let e=b+2;e<=r;e++){let t=this.#G(e);if(t===void 0)break;this.#h[e]=t}this.#g=[],this.#_=0,this.#v=[]}if(C!==void 0&&C.size>0&&this.#l(C,this.#r),v!==void 0)this.#B(v,p,y);else if(!x&&b<r){let e=l&&s>=c?o:s<c&&!u?s:b;this.#B(e,p,g)}return S}prebuildStateStack(e){this.#I(),this.#A(e)}stopBackgroundTokenize(){this.#T=-1,!this.#b&&(this.#b=!0,this.#x=!1,this.#y=-1,this.#w=-1,this.#E=void 0,this.#D=0,this.#g=[],this.#_=0,this.#v=[],this.#R())}pauseBackgroundTokenize(){this.#b||this.#x||(this.#f&&console.log(`[diffs/editor] background tokenization paused`,{jobId:this.#S}),this.#x=!0)}resumeBackgroundTokenize(){this.#b||!this.#x||this.#t===void 0||this.#y<0||(this.#f&&console.log(`[diffs/editor] background tokenization resumed`,{jobId:this.#S}),this.#x=!1,this.#z(this.#S))}#I(){this.#t===void 0&&!Np(this.#o.languageId)&&this.#e.getLoadedLanguages().includes(this.#o.languageId)&&(this.#t=this.#e.getLanguage(this.#o.languageId))}#L(){this.#k||=(globalThis.addEventListener(`message`,this.#j),!0)}#R(){this.#k&&=(globalThis.removeEventListener(`message`,this.#j),!1)}#z(e){globalThis.postMessage({type:`tokenize`,tokenizerId:this.#C,jobId:e})}#B(e,t,n=0){if(Np(this.#o.languageId))return;let r=++this.#S;this.#f&&console.log(`[diffs/editor] background tokenization scheduled`,{jobId:r,startLine:e,changedLineRanges:t,changedRangeIndex:n}),this.#b=!1,this.#x=!1,this.#y=e,this.#w>=0&&(this.#T=Math.max(this.#T,this.#w)),this.#w=-1,this.#E=t,this.#D=n,this.#L(),this.#z(r)}#V(e){if(this.#t===void 0||this.#h.length>e)return;if(!this.#b){this.#w>=0?this.#w=Math.max(this.#w,e):this.#T=Math.max(this.#T,e);return}let t=++this.#S;this.#b=!1,this.#x=!1,this.#y=this.#h.length-1,this.#w=e,this.#T=-1,this.#E=void 0,this.#D=0,this.#L(),this.#z(t)}#H(e,t){let n=this.#o.getLineText(e);if(n.length>this.#s)return console.warn(`[diffs] Line(${e}) too long to tokenize: ${n.length}`),this.#U(e,null),{resolvedTokens:[[0,``,n]],state:t};if(this.#t===void 0||n===``||n.trim()===``)return this.#U(e,null),{resolvedTokens:[[0,``,n]],state:t};let r=jp(this.#t,this.#a,n,t,Op,this.#d);return this.#U(e,r.bracketIgnoredRanges),{resolvedTokens:r.resolvedTokens,state:r.ruleStack}}#U(e,t){this.#d&&(this.#O[e]=t)}#W(e){let t=e.changedLineChanges??[[e.startLine,e.endLine,e.lineDelta]],n=e.startLine+1;n<=this.#h.length-n?(this.#g=this.#h,this.#_=0,this.#h=this.#h.slice(0,n)):(this.#_=n,this.#g=this.#h.slice(n),this.#h.length=Math.min(this.#h.length,n)),this.#v=t}#G(e){let t=e;for(let n=this.#v.length-1;n>=0;n--){let[r,i,a]=this.#v[n];if(a!==0){if(t>i)t-=a;else if(t>r)return this.#h[e]}}return this.#g[t-this.#_]??this.#h[e]}#K(e,t){let n=Math.min(Math.max(0,e),this.#o.lineCount);if(this.#h.length>n||this.#t===void 0)return!0;let r=t===void 0?0:performance.now(),i=this.#h.length-1,a=this.#h[i]??Ge;for(;i<n;){this.#h[i]=a;let e=this.#o.getLineText(i);if(e.length<=this.#s&&e!==``&&e.trim()!==``){let t=jp(this.#t,this.#a,e,a,Op,this.#d,!1);this.#U(i,t.bracketIgnoredRanges),a=t.ruleStack}else this.#U(i,null);if(i++,this.#h[i]=a,t!==void 0&&performance.now()-r>t)break}return i>=n}#q(e){if(this.#b||this.#x||this.#t===void 0||e!==this.#S)return;this.#F();let t=this.#K(this.#w,1);if(!(this.#b||this.#x||e!==this.#S)){if(t){this.stopBackgroundTokenize();return}this.#y=this.#h.length-1,this.#z(e)}}#J(e){if(this.#b||this.#x||this.#t===void 0||e!==this.#S)return;this.#F();let t=performance.now(),n=new Map,r=this.#o.lineCount,i=this.#E,a=this.#y,o=this.#h[a]??Ge,s=!1,c=this.#D,l=i?.[c]?.[1];for(;a<r;){this.#h[a]=o;let e=l===void 0?void 0:this.#G(a+1),r=this.#o.getLineText(a);if(r.length>this.#s)console.warn(`[diffs] Line(${a}) too long to tokenize: ${r.length}`),n.set(a,[[0,``,r]]),this.#U(a,null);else if(r===``||r.trim()===``)n.set(a,[[0,``,r]]),this.#U(a,null);else{let e=jp(this.#t,this.#a,r,o,Op,this.#d);n.set(a,e.resolvedTokens),this.#U(a,e.bracketIgnoredRanges),o=e.ruleStack}if(this.#h[a+1]=o,s=l!==void 0&&a>=l&&e!==void 0&&o.equals(e),a++,s){c++;let e=i?.[c];if(e===void 0)break;if(l=e[1],this.#h[e[0]]===void 0)s=!1;else{a=e[0],o=this.#h[a]??o,s=!1;continue}}if(performance.now()-t>1)break}if(this.#l(n,this.#r),!(this.#b||this.#x||e!==this.#S)){if(s||a>=r){let e=this.#T;this.stopBackgroundTokenize(),e>=0&&this.#V(e);return}this.#y=a,this.#D=c,this.#z(e)}}};function jp(e,t,n,r,i,a=!0,o=!0){let s=e.tokenizeLine2(n,r,i);s.stoppedEarly&&console.warn(`[diffs] Time limit reached when tokenizing line: ${n.substring(0,100)}`);let c=s.tokens,l=c.length/2,u=[],d=[];if(!o&&!a)return{ruleStack:s.ruleStack,resolvedTokens:u,bracketIgnoredRanges:d};for(let e=0;e<l;e++){let r=c[2*e],i=e+1<l?c[2*e+2]:n.length;if(r===i)continue;let s=c[2*e+1];if(o){let e=R.getForeground(s);u.push([r,t[e],n.slice(r,i)])}a&&R.getTokenType(s)>0&&d.push([r,i])}return{ruleStack:s.ruleStack,resolvedTokens:u,bracketIgnoredRanges:d}}function Mp(e){return e.map(([e,t,n])=>e===0&&t===``?n===``?Z(`br`):n:Z(`span`,{dataset:{char:e.toString()},style:`color:${t};`,textContent:n}))}function Np(e){return e===`text`||e===`ansi`}function Pp(e){let t=e.getSelection?.();if(t==null||t.rangeCount===0)return;let n=t.getRangeAt(0);return{collapsed:n.collapsed,startContainer:n.startContainer,startOffset:n.startOffset,endContainer:n.endContainer,endOffset:n.endOffset}}function Fp(e){if(typeof e.cacheKey!=`string`||e.cacheKey.length===0)throw Error(`Editor persistState requires a non-empty file.cacheKey for "${e.name}". Provide a unique, stable cacheKey for every editable file.`);return e.cacheKey}function Ip(e){return typeof e==`object`&&!!e&&`then`in e&&typeof e.then==`function`}var Lp=2,Rp=1e4,zp=`selection-action`,Bp=`application/vnd.pierre.diffs-selections+json`,Vp=class{#e;#t=new Cp;#n;#r;#i=new Map;#a;#o;#s=new Map;#c;#l=0;#u=!1;#d;#f;#p;#m;#h={generation:0,callback:void 0,delivered:!1};#g;#_;#v;#y=new Map;#b=new Map;#x=new Map;#S;#C;#w;#T;#E;#D;#O;#k;#A;#j;#M;#N;#P;#F;#I;#L;#R;#z;#B;#V;#H;#U=!0;#W=!1;#G=!1;#K=!1;#q;#J=!1;#Y=!1;#X=!1;#Z=!1;#Q;#$=``;#ee;#te;#ne;#re;#ie;#ae;#oe=!1;#se=!1;#ce=!1;#le=!1;#ue;#de=(e,t)=>{if(this.#P?.updateRenderCache(e,t),this.#R!==void 0&&this.#R.totalLines!==1/0){let{startingLine:t,totalLines:n}=this.#R,r=Math.min(t+n,this.#L?.lineCount??0);for(let[n,i]of e)if(n>=t&&n<r){let e=this.#zt(n);e!==void 0&&e.replaceChildren(...Mp(i))}}};constructor(e={}){this.#e=e}setOptions(e){let t=this.#e.persistStateStorage??`inMemory`,n={...this.#e,...e};if(n.persistState===!0&&this.#P?.type===`file`){let e=this.#P.__getCurrentFile?.()??this.#F;e!==void 0&&Fp(e)}this.#e=n,this.#e.persistState!==!0&&(this.#i.clear(),this.#l++,this.#u=!1),(this.#e.persistStateStorage??`inMemory`)!==t&&(this.#l++,this.#a=void 0,this.#o=void 0,this.#s.clear())}edit(e){if(this.#e.persistState===!0&&e.type===`file`){let t=e.__getCurrentFile?.();t!==void 0&&Fp(t)}return this.#Oe(),this.#P=e,this.#Ne(),this.#m=e.attachEditor(this),()=>this.cleanUp()}applyEdits(e,t=!0){let n=this.#L;if(n==null)throw Error(`Editor is not attached`);let r=this.#K,i=this.#ne,a=i?.map(e=>[n.offsetAt(e.start),n.offsetAt(e.end)]),o=i===void 0?void 0:n.resolveEdits(e).sort((e,t)=>e.start-t.start),s=n.applyEdits(e,t,i);if(s===void 0)return;let c;i!==void 0&&a!==void 0&&o!==void 0&&(c=Jd(n,i,a,o),t&&n.setLastUndoSelectionsAfter(c)),this.#It(s,c,this.#Lt(s),{skipFocus:!r})}get canUndo(){return this.#L?.canUndo??!1}get canRedo(){return this.#L?.canRedo??!1}undo(){this.#Ve(`undo`)}redo(){this.#Ve(`redo`)}getFile(){let e=this.#F,t=this.#L;if(e===void 0||t===void 0)return;let n={...e};return Object.defineProperty(n,"contents",{enumerable:!0,get:()=>t.getText()}),n}getText(){return this.#L?.getText()??``}getState(){let e=this.#P;return{selections:this.#ne,view:e==null?void 0:{scrollLeft:e.getCodeScrollLeft(),scrollTop:this.#je()}}}setState({selections:e,view:t}){if(this.#P===void 0||this.#L===void 0)throw Error(`Editor is not attached`);if(this.#U=!1,this.#gt(e??[]),t!=null){this.#P.setCodeScrollLeft(t.scrollLeft),t.scrollTop!==void 0&&this.#Me(t.scrollTop);return}this.#rt()}setSelections(e){let t=this.#L;if(t===void 0)throw Error(`Text document is not initialized`);let n=e.map(e=>{let n=t.normalizePosition(e.start),r=t.normalizePosition(e.end),i=e.direction===`none`?0:e.direction===`backward`?-1:1;return $(n,r)>0&&([n,r]=[r,n],i!==0&&(i=i===1?-1:1)),{direction:i,start:n,end:r}});this.#U=!1,this.#gt(n);let r=n.at(-1);r!==void 0&&this.#xe(Ud(r).line),this.#rt()}setMarkers(e){let t=this.#L;if(t===void 0)throw Error(`Text document is not initialized`);if(e.length===0){this.#B?.cleanup(),this.#B=void 0,this.#gt(this.#ne??[]);return}this.#B??=new Vf({popoverManager:this.#Te(),getLineHeight:()=>this.#t.lineHeight,getOverlayElement:()=>this.#A,getGutterWidth:()=>this.#Bt(),getCharX:(e,t)=>this.#Ut(e,t),getLineY:e=>this.#Ht(e),isMouseDown:()=>this.#X||this.#Y}),this.#B.setMarkers(e,t),this.#k!==void 0&&this.#B.listenHover(this.#k),this.#gt(this.#ne??[])}focus(e){let t=e?.preventScroll??!1,n=e?.lineNumber;if(n===`first-visible`||typeof n==`number`){let r=this.#L;if(r==null||this.#P==null)return;let i=n===`first-visible`?this.#et(e?.offset):n;if(i==null)return;let a=r.normalizePosition({line:i-1,character:n===`first-visible`?0:e?.character??0});this.#tt(a,t);return}let r=this.#ne?.at(-1);if(r!==void 0){let e=r.direction===-1?r.end:r.start;this.#Ze(e,t)}else this.#Ze(void 0,t)}blur(){this.#q=void 0,this.#K=!1,this.#W=!1,this.#k?.blur()}cleanUp(e=!1){this.#Oe(),e||(this.#h.delivered=!1);let t=this.#P!=null,n=this.#e.persistState===!0;this.#l++,this.#me(),t&&(this.#u=n),ie(this.#Re),this.#n?.cleanUp(),this.#n=void 0,e||(this.#L=void 0,this.#F=void 0),this.#f?.forEach(e=>e()),this.#f=void 0,this.#d?.forEach(e=>e()),this.#d=void 0,this.#p?.forEach(e=>e()),this.#p=void 0,this.#m?.(e),this.#m=void 0,this.#_=void 0,this.#v=void 0,this.#y.clear(),this.#b.clear(),this.#x.clear(),this.#S=void 0,this.#C?.remove(),this.#C=void 0,this.#w?.remove(),this.#w=void 0,this.#T?.remove(),this.#T=void 0,this.#E?.remove(),this.#E=void 0,this.#D=void 0,this.#r?.cleanUp(),this.#r=void 0,this.#O=void 0,this.#k?.removeAttribute(`contentEditable`),this.#k=void 0,this.#q=void 0,this.#K=!1,this.#A?.remove(),this.#A=void 0,this.#N?.disconnect(),this.#N=void 0,this.#le=!1,this.#ue!==void 0&&(cancelAnimationFrame(this.#ue),this.#ue=void 0),this.#De(),this.#P=void 0}__prepareFile(e){if(this.#e.persistState!==!0)return e;let t=Fp(e),n=this.#F,r=e.lang??me(e.name);n!==void 0&&(Fp(n)!==t||n.name!==e.name||this.#L?.languageId!==r)&&(this.#l++,this.#me());let i=this.#fe(e,t);return i===void 0||i.getText()===e.contents?e:{...e,contents:i.getText()}}__postponeBgTokenizeToNextFrame(){let e=this.#n;e!==void 0&&(e.pauseBackgroundTokenize(),requestAnimationFrame(()=>{e.resumeBackgroundTokenize()}))}__captureFocusForDOMReplacement(){let e=this.#k,t=this.#D?.shadowRoot?.activeElement;e!=null&&(this.#K||t===e||t!=null&&e.contains(t))&&(this.#q={})}__syncRenderView=(e,t,n,r,i)=>{let a=this.#P;if(a==null)return;let o=t.shadowRoot;if(o==null){console.error(`[editor] Could not find the shadow root.`);return}let s,c,l;for(let e of o.querySelectorAll(`[data-code]`))if(e.dataset.deletions===void 0){s=e;for(let t of e.children){let e=t,{gutter:n,content:r}=e.dataset;n===void 0?r!==void 0&&(l=e):c=e}break}if(s===void 0||l===void 0){this.#q=void 0;return}this.#Te().setViewportElements(t,s),this.#D!==t&&(this.#D=t,this.#C!==void 0&&t.appendChild(this.#C),this.#w!==void 0&&o.appendChild(this.#w),this.#T!==void 0&&o.appendChild(this.#T),this.#E!==void 0&&o.prepend(this.#E));let u=this.#L===void 0||this.#F===void 0||this.#F.name!==n.name||this.#F.lang!==n.lang||this.#F.cacheKey!==n.cacheKey,d=this.#e.persistState===!0?Fp(n):void 0,f;if(u){this.#Oe();let e=``;e=`contents`in n?n.contents:n.additionLines.join(``);let t=new Ql({maxEntries:this.#e.historyMaxEntries}),{name:r,lang:i,cacheKey:o}=n,s=i??me(n.name),c=d===void 0?void 0:this.#fe(n,d),l=a.type===`file`||c?.getText()===e?c:void 0,u=l??new Ou(n.name,e,s,0,t);this.#F={name:r,lang:i,cacheKey:o},this.#L=u,d!==void 0&&(this.#i.set(d,u),f={cacheKey:d,textDocument:u}),this.#n?.cleanUp(),this.#n=void 0,this.#De(),this.#b.clear(),this.#ne=this.#te,this.#e.__debug===!0&&console.log(l===void 0?`[diffs/editor] text document rebuilt from`:`[diffs/editor] cached text document reused for`,n.name)}f===void 0&&this.#u&&d!==void 0&&this.#L!==void 0&&(f={cacheKey:d,textDocument:this.#L});let p=this.#L;if(this.#n==null&&p!=null&&(this.#n=new Ap({highlighter:e,textDocument:p,codeOptions:this.#P?.__getEffectiveCodeOptions()??{},matchBrackets:this.#e.matchBrackets,onDeferTokenize:this.#de,onThemeChange:()=>this.#ht(),setStyle:e=>{this.#T.textContent=e},__debug:this.#e.__debug})),this.#k!==l&&(this.#O=c,this.#k=Yu(l,{contentEditable:`true`,role:`textbox`,ariaMultiLine:`true`,autocapitalize:`off`,writingSuggestions:`off`,autocorrect:!1,spellcheck:!1,translate:!1}),this.#A!==void 0&&l.after(this.#A),this.#t.init(l),this.#Je(),this.#Le(l,c),this.#k!==void 0&&this.#e.__debug===!0&&console.log(`[diffs/editor] full re-render triggered !!!`)),this.#q!=null&&(this.#q.target=l),l.ariaLabel!==n.name&&(l.ariaLabel=n.name),r!==void 0&&r.length>0||this.#Ce)for(let e of this.#k.children){let t=e,{lineAnnotation:n,lineType:r,separator:i}=t.dataset;(n!==void 0||i!==void 0||r===`change-deletion`)&&t.setAttribute(`contenteditable`,`false`)}if(this.#Ee(),this.#n?.syncTheme(this.#P?.__getEffectiveCodeOptions()??{}),this.#I=r,this.#R=i,this.#z=i?.totalLines,this.#n?.prebuildStateStack(i),this.#B?.removePopover(),(this.#ne!==void 0||this.#re!==void 0||this.#B!==void 0)&&this.#gt(this.#ne??[]),this.#te!==void 0&&this.#M!==void 0?(this.#te=void 0,this.#rt(!1,`center`)):this.#ie===void 0?this.#q===void 0?this.#ne!==void 0&&this.#ne.length>0&&this.#K&&!this.#ce&&this.focus({preventScroll:!0}):this.#Qe():this.#at(this.#ie,this.#ae,this.#se),this.#ce&&this.#V?.focus(),this.#e.__debug===!0&&i!==void 0){let{startingLine:e,totalLines:t}=i;console.log(`[diffs/editor] render file:`,n.name,`RenderRange:`,e+`-`+(e+t),`of`,this.#L?.lineCount,`lines`)}f!==void 0&&(this.#u=!1,this.#_e(f.cacheKey,f.textDocument)),this.#ke(a)};#fe(e,t){let n=this.#i.get(t),r=e.lang??me(e.name);return n?.languageId===r?n:void 0}#pe(){let e=this.#e.persistStateStorage??`inMemory`;return(this.#a===void 0||this.#o!==e)&&(this.#a=pp(e),this.#o=e),this.#a}#me(){let e=this.#F,t=this.#L;if(this.#e.persistState!==!0||this.#P===void 0||e===void 0||t===void 0)return;let n=Fp(e);this.#i.set(n,t);let r;try{r=this.#pe()}catch{return}let i=fp(this.getState()),a=this.#c;if(a?.cacheKey===n&&a.textDocument===t){if(this.#c=void 0,t.version===a.documentVersion&&this.#ne===a.selections&&i.view?.scrollLeft===a.view?.scrollLeft&&i.view?.scrollTop===a.view?.scrollTop)return;this.#he(r,n,i,a.completion);return}this.#he(r,n,i)}#he(e,t,n,r){let i=this.#s.get(t);if(r!==void 0||i!==void 0){let a=r??Promise.resolve();i!==void 0&&(a=a.then(()=>i)),this.#ge(t,a.then(()=>e.set(t,n)));return}let a;try{a=e.set(t,n)}catch{return}Ip(a)&&this.#ge(t,a)}#ge(e,t){let n=t.catch(()=>{});this.#s.set(e,n),n.finally(()=>{this.#s.get(e)===n&&this.#s.delete(e)})}#_e(e,t){let n=++this.#l,r=t.version,i=this.#ne,a=this.getState().view,o,s=s=>{let c=this.getState().view;if(n!==this.#l||this.#L!==t||t.version!==r||this.#ne!==i||c?.scrollLeft!==a?.scrollLeft||this.#F===void 0||Fp(this.#F)!==e)return;let l=o?.userScrolled()===!0;if(s===void 0){this.#P?.setCodeScrollLeft(0),l||this.#Me(0);return}let u=fp(s);l&&u.view!==void 0&&(u.view={scrollLeft:u.view.scrollLeft}),this.setState(u)},c=()=>{let t;try{t=this.#pe().get(e)}catch{return}if(Ip(t))return t.then(s).catch(()=>{});try{s(t)}catch{}},l=this.#s.get(e),u=l===void 0?c():l.then(c);if(Ip(u)){o=this.#ve();let n={cacheKey:e,textDocument:t,documentVersion:r,selections:i,view:a,completion:u.catch(()=>{})};this.#c=n,n.completion.finally(()=>{o?.dispose(),this.#c===n&&(this.#c=void 0)})}}#ve(){let e=this.#Ae();if(!(e instanceof HTMLElement))return;let t=!1,n=[`wheel`,`touchstart`,`mousedown`],r=()=>{for(let t of n)e.removeEventListener(t,i,{capture:!0})},i=()=>{t=!0,r()};for(let t of n)e.addEventListener(t,i,{capture:!0,passive:!0});return{userScrolled:()=>t,dispose:r}}#ye(e){return this.#P?.isLineRenderable?.(e+1)??!0}get#be(){let e=this.#P;if(e?.getNearestRenderableLine!=null)return(t,n)=>{let r=e.getNearestRenderableLine(t+1,n);return r==null?void 0:r-1}}#xe(e){this.#ye(e)||this.#P?.revealLine?.(e+1)}get#Se(){return this.#P?.options.diffStyle??`split`}get#Ce(){return this.#P?.type===`file-diff`}get#we(){return this.#P?.options.overflow===`wrap`}#Te(){return this.#r??=new gd({hasActivePopover:()=>this.#H!==void 0||this.#B?.isPopoverVisible()===!0,updateActivePopover:()=>{this.#St(),this.#B?.updatePopoverPosition()}})}#Ee(){this.#y.clear(),this.#x.clear(),this.#S=void 0}#De(){this.#mt(null),this.#_=void 0,this.#v=void 0,this.#W=!1,this.#G=!1,this.#j?.forEach(e=>e.remove()),this.#j=void 0,this.#ne=void 0,this.#ee=void 0,this.#ie=void 0,this.#B?.cleanup(),this.#B=void 0,this.#V?.cleanup(),this.#V=void 0,this.#H?.cleanup(),this.#H=void 0,this.#U=!0}#Oe(){let e=this.#h;e.generation++,e.callback!=null&&(ie(e.callback),e.callback=void 0)}#ke(e){let t=this.#h,n=this.#L;if(t.delivered||t.callback!=null||n==null)return;let{generation:r}=t,i=()=>{if(t.callback!==i||(t.callback=void 0,r!==t.generation||this.#P!==e||this.#L!==n))return;let a=this.#k,o=this.#D?.shadowRoot;a==null||o==null||!o.contains(a)||(t.delivered=!0,this.#e.onAttach?.(this,e))};t.callback=i,et(i)}#Ae(){let e=this.#P?.getEditorViewport?.();if(e!==void 0)return e;let t=this.#D;if(!(this.#P==null||t==null))return rd(t)}#je(){let e=this.#Ae();return e instanceof HTMLElement?e.scrollTop:e?.defaultView?.scrollY??0}#Me(e){let t=this.#Ae();t instanceof HTMLElement?t.scrollTop=e:t instanceof Document&&t.defaultView?.scrollTo({top:e})}#Ne(){this.#C=Z(`style`,{dataset:`editorGlobalCss`,textContent:`
|
|
2181
|
+
[data-annotation-slot] {
|
|
2182
|
+
user-select: none;
|
|
2183
|
+
-webkit-user-select: none;
|
|
2184
|
+
}
|
|
2185
|
+
`}),this.#w=Z(`style`,{dataset:`editorCss`,textContent:Lu}),this.#T=Z(`style`,{dataset:`editorThemeCss`}),this.#E=cp(),this.#A=Z(`div`,{dataset:`editorOverlay`});let e=e=>{let t=e.composedPath()[0];return t instanceof Node&&this.#k?.contains(t)===!0},t=()=>{this.#q!=null&&(this.#q=void 0,this.#K=!1,this.#W=!1)};this.#f=[Q(document,`focusin`,n=>{e(n)||t()},{passive:!0}),Q(document,`pointerdown`,n=>{e(n)||queueMicrotask(t)},{capture:!0,passive:!0}),Q(document,`selectionchange`,()=>{let e=this.#D?.shadowRoot;if(this.#W||this.#G||e==null||!this.#K||this.#ne!==void 0&&this.#ne.length>1&&!this.#X)return;let t=document.getSelection();if(t==null)return;let n=typeof t.getComposedRanges==`function`?t.getComposedRanges({shadowRoots:[e]})?.[0]:Pp(e);if(n===void 0||!this.#Kt(n))return;let r=xd(n,0);if(r!==void 0){if(this.#X&&this.#Z&&this.#ne!==void 0&&this.#ne.length>0){let e=this.#ne.at(-1);this.#gt([Xd(e,r)]);return}if(this.#X)this.#Q===void 0?this.#Q=r:r=Yd(this.#Q,r);else if(this.#Q!==void 0)r.direction=Yd(this.#Q,r).direction;else if(this.#ne!==void 0&&this.#ne.length===1){let e=this.#ne[0];$(e.start,r.start)===0&&$(e.end,r.end)===0&&(r.direction=e.direction)}this.#ee===void 0?this.#gt([r]):this.#gt([...this.#ee.filter(e=>!Gd(e,r)),r])}},{passive:!0}),Q(document,`pointerup`,e=>{e.pointerType===`mouse`&&(this.#p?.forEach(e=>e()),this.#p=void 0,this.#Y&&(this.#Y=!1,this.#Ze()),this.#W=!1,this.#X=!1,this.#Z=!1,this.#Q=void 0,this.#ee=void 0,this.#e.enabledSelectionAction===!0&&this.#ne!==void 0&&this.#ne.length>0&&!Hd(this.#ne.at(-1))&&this.#gt(this.#ne))},{passive:!0}),Q(document,`keydown`,e=>{e.key===`Shift`&&(this.#Q=this.#ne?.at(-1))},{passive:!0}),Q(document,`keyup`,e=>{e.key===`Shift`&&(this.#Q=void 0)},{passive:!0})]}#Pe(e){this.#p?.forEach(e=>e()),this.#p=e}#Fe(){return this.#P?.options.enableLineSelection===!0}#Ie(){this.#G=this.#ne!==void 0}#Le(e,t){let{onFocus:n,onBlur:r}=this.#e,i=t=>{let n=t.composedPath()[0];return n!==void 0&&(n===e||e.contains(n))};this.#d?.forEach(e=>e()),this.#d=[Q(e,`focus`,()=>{this.#K=!0,n?.(),!this.#X&&!this.#W&&this.#ne!==void 0&&this.#ne.length>0&&this.#nt(this.#ne.at(-1))},{passive:!0}),Q(e,`blur`,()=>{this.#q?.target===e&&(this.#q=void 0,this.#W=!1),this.#K=!1,r?.()},{passive:!0}),Q(e,`pointerdown`,t=>{if(this.#U=!0,this.#G=!1,t.pointerType===`mouse`){if(this.#st(t)){this.#pt(!0),this.#ne!==void 0&&this.#gt([]);return}if(this.#pt(!1),this.#B?.removePopover(),ke()&&this.#I!==void 0&&this.#I.length>0){let t=[...e.querySelectorAll(`[data-line-annotation]`)].map(e=>[Q(e,`mouseenter`,()=>{this.#W=!0}),Q(e,`mouseleave`,()=>{this.#W=!1})]).flat();this.#Pe(t)}if(this.#X=!0,this.#Q=void 0,t.button===0&&ku(t)&&(this.#ee=this.#ne?.map(e=>({...e}))),t.shiftKey){let e=this.#ne?.at(-1);if(e!==void 0){let t=e.direction===-1?e.end:e.start;this.#nt({start:t,end:t,direction:0})}this.#Z=!0}}},{passive:!0}),Q(e,`keydown`,e=>{if(!i(e))return;this.#U=!0,this.#G=!1;let t=Fu(e,this.#e.keymap);if(t!==void 0){e.preventDefault(),t===`simplifySelection`&&(this.#V?.close(),this.#V=void 0,this.#ce=!1,this.#H?.cleanup(),this.#H=void 0),this.#Ve(t);return}let n=Au(e),r=this.#L;if(this.#ne!==void 0&&this.#ne.length>0&&n!==void 0&&r!==void 0){let t={getSoftLineOffsets:this.#we?e=>this.#Gt(e):void 0,resolveRenderableLine:this.#be};e.shiftKey?this.#gt(kd(r,this.#ne,n,t)):this.#gt(Cd(r,this.#ne,n,t)),this.#rt(),e.preventDefault();return}if((e.key.length===1?e.key.toLowerCase():e.key)===`v`&&ku(e)){if(e.repeat&&this.#Ce){e.preventDefault();return}if(this.#e.clipboard!==void 0){e.preventDefault(),et(this.#Re);return}}if(this.#V!==void 0){let t=Iu(e);if(t!==void 0){e.preventDefault(),this.#V.navigate(t===`previous`);return}}}),Q(e,`copy`,e=>{i(e)&&(e.preventDefault(),this.#dt()?e.clipboardData?.setData(`text`,this.#ft()):this.#Dt(e.clipboardData,this.#Tt(),this.#Et()))}),Q(e,`cut`,e=>{if(i(e))if(e.preventDefault(),this.#dt())e.clipboardData?.setData(`text`,this.#ft());else{let t=this.#Et();this.#Dt(e.clipboardData,this.#Ot(),t)}}),Q(e,`paste`,e=>{if(!i(e))return;e.preventDefault();let t=e.clipboardData,n=this.#L;if(t===null||n===void 0)return;let r=t.getData(`text`),a=this.#ne?.length??0;if(a>1){let e=t.getData(Bp);if(e!==void 0)try{let t=JSON.parse(e);Array.isArray(t)&&t.length===a&&(r=t)}catch{}}this.#At(Array.isArray(r)?r.map(e=>n.normalizeEol(e)):n.normalizeEol(r),void 0,!0,`document`)}),Q(e,`beforeinput`,e=>{i(e)&&e.inputType!==`insertCompositionText`&&(e.preventDefault(),this.#Xe(e.inputType,e.data))}),Q(e,`drop`,e=>{i(e)&&e.preventDefault()}),Q(e,`compositionstart`,e=>{i(e)&&(this.#J=!0,this.#W=!0)},{passive:!0}),Q(e,`compositionend`,e=>{if(!i(e))return;this.#W=!1;let t=this.#J;this.#J=!1,(e.data!==``||!t)&&this.#Xe(`insertText`,e.data)},{passive:!0})];let a=this.#D?.shadowRoot?.querySelector(`[data-deletions]`);if(a!=null&&this.#d.push(Q(a,`pointerdown`,e=>{let t=e.composedPath();if(Le(t)){this.#Ie();return}let n=t[0],r=n instanceof HTMLElement?n.closest(`[data-column-number]`):null;if(r instanceof HTMLElement){if(this.#Fe()){this.#Ie();return}if(this.#ut(r,a,e.pointerType===`mouse`))return}this.#pt(!0),this.#ne!==void 0&&this.#gt([])},{passive:!0})),t!==void 0){let e=(e,t=!1)=>{let n=e;return n?.dataset.lineNumberContent===void 0?t&&n?.tagName===`SPAN`&&(n=n.closest(`[data-line]`)):n=n.parentElement??void 0,n},n=e=>{if(e===void 0)return;let t=e.dataset.lineType,n=qu(e)??qu(e,`columnNumber`);if(!(n===void 0||t===void 0||!Wd(t)))return n-1};this.#d.push(Q(t,`pointerdown`,t=>{let r=t.composedPath();if(Le(r)){this.#Ie();return}let i=e(r[0]);if(i!==void 0&&this.#Fe()){this.#Ie();return}if(i?.dataset.lineType===`change-deletion`){let e=i.closest(`[data-code]`);e!=null&&this.#ut(i,e,t.pointerType===`mouse`);return}if(t.pointerType!==`mouse`)return;let a=this.#L,o=n(i);if(o===void 0||a===void 0)return;this.#U=!0,this.#B?.removePopover();let s=this.#ot(o,o,a);this.#Y=!0,this.#Q=s,this.#gt([s]),this.#nt(s),this.#Ze(),this.#Pe([Q(document,`mousemove`,t=>{if(!this.#Y)return;let r=this.#L,i=n(e(t.composedPath()[0],!0));if(i===void 0||r===void 0)return;let a=this.#Q?.start.line??i,o=this.#ot(a,i,r);this.#Q??=o,this.#gt([o]),this.#Ze(o.direction===-1?o.start:o.end)},{passive:!0})])},{passive:!0}))}this.#B?.listenHover(e),this.#N?.disconnect(),this.#N=new ResizeObserver(this.#qe),this.#N.observe(e),this.#N.observe(e.parentElement),this.#ze(e)}#Re=async()=>{let e=this.#e.clipboard;if(e!==void 0){let t=await e.readText(),n=this.#ne?.length??0;if(n>1){let r=await e.readText(Bp);try{let e=JSON.parse(r);Array.isArray(e)&&e.length===n&&(t=e)}catch{}}let r=this.#L;r!==void 0&&this.#At(Array.isArray(t)?t.map(e=>r.normalizeEol(e)):r.normalizeEol(t),void 0,!0,`document`)}};#ze(e){this.#Ce&&this.#Se===`split`&&this.#we&&(this.#g={top:e.offsetTop,left:e.offsetLeft-this.#Bt()},this.#e.__debug===!0&&console.log(`[diffs/editor] content offset:`,this.#g))}get#Be(){if(this.#Ce&&this.#Se===`split`&&this.#we)return this.#g}#Ve(e){let t=this.#L;if(t!==void 0)switch(e){case`openSearchPanel`:this.#Ct(`find`);break;case`openSearchReplacePanel`:this.#Ct(`replace`);break;case`findNextMatch`:{let e=this.#ne;if(e===void 0)break;if(e.some(Hd)){let n=e.map(e=>Hd(e)?hf(t,e):e);this.#gt(n),this.focus()}else{let n=tf(t,e);if(n!==void 0){this.#gt(n);let e=n.at(-1);e!==void 0&&this.#xe(Ud(e).line),this.#rt()}}break}case`moveLineUp`:case`moveLineDown`:this.#Ke(e===`moveLineUp`?-1:1);break;case`copyLineUp`:case`copyLineDown`:this.#We(e===`copyLineUp`?-1:1);break;case`simplifySelection`:{let e=this.#ne,t=e?.at(-1);if(e===void 0||t===void 0)break;if(e.length>1)this.#gt([t]),this.#Ze(Ud(t));else if(!Hd(t)){let e=Ud(t);this.#gt([{start:e,end:e,direction:0}]),this.#Ze(e)}break}case`insertBlankLine`:this.#Ge();break;case`deleteHardLineForward`:this.#Pt();break;case`toggleComment`:case`toggleBlockComment`:{let n=this.#ne;if(n===void 0)break;let{lineComment:r,blockComment:i}=Vu(t.languageId,this.#e.languageCommentConfig);if(e===`toggleComment`&&r!==null){this.#Ue(Hu(t,n,r));break}let a=e===`toggleComment`,o=Ku(t,n,i,a);o!==void 0&&this.#Ue(o.edits,a?void 0:e=>o.nextSelectionOffsets.map(([t,n,r])=>({start:e.positionAt(t),end:e.positionAt(n),direction:r})));break}case`indent`:case`outdent`:case`indentLess`:case`indentMore`:if(this.#ne!==void 0){let n=[],r=[],i=new Set,a=[];for(let o of this.#ne){let s=o.start.line,c=e===`outdent`||e===`indentLess`,l=e===`indentLess`||e===`indentMore`;if(s!==o.end.line||c||l){let e=Sd(t,o,this.#t.tabSize,c);for(let t of e[0]){let e=t.range.start.line;i.has(e)||(i.add(e),n.push(t))}r.push(e[1])}else{let e=t.charAt({line:s,character:0})===` `?` `:` `.repeat(this.#t.tabSize);n.push({range:o,newText:e}),a.push({line:s,startCharacter:o.start.character,addedLength:e.length-(o.end.character-o.start.character),selectionIndex:r.length});let i={line:o.start.line,character:o.start.character+e.length};r.push({start:i,end:i,direction:0})}}for(let e of a){let t=0;for(let n of a)n.line===e.line&&n.startCharacter<e.startCharacter&&(t+=n.addedLength);if(t!==0){let n=r[e.selectionIndex],i={line:e.line,character:n.start.character+t};r[e.selectionIndex]={start:i,end:i,direction:0}}}let o=t.applyEdits(n,!0,this.#ne,r);o!==void 0&&this.#It(o,r)}break;case`selectAll`:{let e=nf(t);this.#gt([e]),this.focus();let n=this.#Rt(),r=n[0]?.[0],i=n.at(-1)?.[1];r!==void 0&&i!==void 0&&(this.#G=!0,this.#nt({start:{line:r,character:0},end:{line:i,character:t.getLineLength(i)},direction:1}));break}case`moveCursorToDocStart`:case`moveCursorToDocEnd`:{let n=rf(t,e===`moveCursorToDocEnd`,this.#Ce);this.#gt([n]),this.#xe(Ud(n).line),this.#rt()}break;case`expandSelectionDocStart`:case`expandSelectionDocEnd`:{let n=e===`expandSelectionDocEnd`,r=this.#ne;if(r!==void 0){let e=rf(t,n,this.#Ce);this.#gt(Zd(r,e)),this.#xe(Ud(e).line),this.#rt()}}break;case`undo`:case`redo`:this.#He(e);break}}#He(e){let t=this.#L;if(t===void 0||e===`undo`&&!t.canUndo||e===`redo`&&!t.canRedo)return;let n=this.#ne,r=n?.map(e=>[t.offsetAt(e.start),t.offsetAt(e.end)]),i=e===`undo`?t.undo():t.redo();if(i===void 0)return;let[a,o,s,c]=i,l=o??(n!==void 0&&r!==void 0&&c!==void 0?Jd(t,n,r,c):void 0);this.#It(a,l,s)}#Ue(e,t){let n=this.#L,r=this.#ne;if(n===void 0||r===void 0)return;let i=t===void 0,a=i?r.map(e=>[n.offsetAt(e.start),n.offsetAt(e.end)]):void 0,o=i?e.map(e=>{let t=n.offsetAt(e.range.start),r=n.offsetAt(e.range.end);return{start:Math.min(t,r),end:Math.max(t,r),text:e.newText}}).sort((e,t)=>{let n=e.start-t.start;return n===0?e.end-t.end:n}):void 0,s=n.applyEdits(e,!0,r,void 0,!0);if(s===void 0)return;let c=i?Jd(n,r,a,o):t(n);n.setLastUndoSelectionsAfter(c),this.#It(s,c,this.#Lt(s))}#We(e){let t=this.#L,n=this.#ne;if(t===void 0||n===void 0)return;let r=$d(n);if(r.length===0)return;let i=[],a=0,o=[];for(let n of r){i.push(a);let r=n.endLine-n.startLine+1;a+=r;let s=t.getText({start:{line:n.startLine,character:0},end:{line:n.endLine,character:t.getLineLength(n.endLine)}});if(e>0){let e={line:n.startLine,character:0};o.push({range:{start:e,end:e},newText:s+t.eol})}else if(n.endLine<t.lineCount-1){let e={line:n.endLine+1,character:0};o.push({range:{start:e,end:e},newText:s+t.eol})}else{let e={line:n.endLine,character:t.getLineLength(n.endLine)};o.push({range:{start:e,end:e},newText:t.eol+s})}}let s=n.map(t=>{let n=t.start.line,a=0,o=r.length-1;for(;a<=o;){let e=a+o>>>1,t=r[e];if(n<t.startLine)o=e-1;else if(n>t.endLine)a=e+1;else{a=e;break}}let s=Math.max(0,a<=o?a:o),c=r[s],l=i[s]+(e>0?c.endLine-c.startLine+1:0);return{start:{...t.start,line:t.start.line+l},end:{...t.end,line:t.end.line+l},direction:t.direction}});this.#Ue(o,()=>s)}#Ge(){let e=this.#L,t=this.#ne;if(e===void 0||t===void 0)return;let n=t.map(e=>Ud(e).line),r=Array.from(new Set(n)).sort((e,t)=>e-t),i=new Map,a=new Map,o=[];for(let t=0;t<r.length;t++){let n=r[t],s=e.getLineText(n),c=/^\s*/.exec(s)?.[0]??``;i.set(n,t),a.set(n,c);let l={line:n,character:e.getLineLength(n)};o.push({range:{start:l,end:l},newText:e.eol+c})}let s=t.map((e,t)=>{let r=n[t],o={line:r+1+i.get(r),character:a.get(r).length};return{start:o,end:o,direction:0}});this.#Ue(o,()=>s)}#Ke(e){let t=this.#L,n=this.#ne;if(t===void 0||n===void 0)return;let r=$d(n);if(r.length===0||e<0&&r[0].startLine===0||e>0&&r.at(-1).endLine>=t.lineCount-1)return;let i=t.lineCount,a=e=>e<i-1?{line:e+1,character:0}:{line:e,character:t.getLineLength(e)},o=(e,n)=>{let r=e.map(e=>t.getLineText(e)).join(t.eol);return n?r+t.eol:r},s=[];if(e<0)for(let e of r){let t=e.startLine-1,n=[];for(let t=e.startLine;t<=e.endLine;t++)n.push(t);s.push({range:{start:{line:t,character:0},end:a(e.endLine)},newText:o([...n,t],e.endLine<i-1)})}else for(let e=r.length-1;e>=0;e--){let t=r[e],n=t.endLine+1,c=[];for(let e=t.startLine;e<=t.endLine;e++)c.push(e);s.push({range:{start:{line:t.startLine,character:0},end:a(n)},newText:o([n,...c],n<i-1)})}let c=r.at(-1),l=e>0&&c.endLine===i-2?t.getLineLength(c.endLine):t.getLineLength(i-1),u=n.map(n=>ef(n,e,i,e=>e===i-1?l:t.getLineLength(e))),d=t.applyEdits(s,!0,n,u,!0);d!==void 0&&this.#It(d,u)}#qe=()=>{let e=this.#I?.length??0,t=this.#_,n=this.#v;this.#_=void 0,this.#v=void 0;let r=this.#Bt()!==t,i=this.#Vt()!==n;!r&&!i||(this.#x.clear(),this.#S=void 0,this.#t.clearTextWidthCache(),i&&(this.#b.clear(),(this.#we||e>0)&&this.#y.clear()),(this.#ne!==void 0||this.#re!==void 0||this.#B!==void 0)&&(this.#gt(this.#ne??[]),this.#ne!==void 0&&this.#K&&this.focus()),this.#B?.removePopover(),this.#ze(this.#k))};#Je(){if(this.#le)return;let e=document.fonts;e!==void 0&&(this.#le=!0,e.ready.then(()=>{this.#k===void 0||!this.#t.remeasureCharacterWidth()||(this.#_=void 0,this.#v=void 0,this.#Ee(),this.#b.clear(),(this.#ne!==void 0||this.#re!==void 0||this.#B!==void 0)&&this.#gt(this.#ne??[]),this.#B?.removePopover())}))}#Ye(e,t,n=this.#R,r){let i=this.#n,a=this.#P,o=this.#L,s=this.#O,c=this.#k;if(i===void 0||a===void 0||o===void 0||c===void 0)return;i.stopBackgroundTokenize();let l=performance.now(),u=i.tokenize(e,n,!this.#Ce),d=performance.now();if(u.size>0){let e=c.children,t=new Set;for(let e of u.keys())this.#ye(e)&&t.add(e);for(let n=0;n<e.length;n++){let r=e[n];if(r!==void 0){let e=qu(r),n=r.dataset.lineType;if(e===void 0||n===`change-deletion`)continue;let i=e-1;if(t.has(i)){let e=u.get(i);if(r.replaceChildren(...Mp(e)),t.delete(i),t.size===0)break}}}if(t.size>0){let n=0;for(let t=e.length-1;t>=0;t--){let r=e[t],i=qu(r);if(i!==void 0&&r.dataset.lineType!==`change-deletion`){n=i;break}}for(let e of t){if(e<n)continue;let t=u.get(e),r=String(e+1);Z(`div`,{dataset:{line:r,lineType:`context`,lineIndex:e.toString()},children:Mp(t)},c),s!==void 0&&Z(`div`,{dataset:{lineType:`context`,columnNumber:r,lineIndex:e.toString()},children:[Z(`span`,{dataset:{lineNumberContent:``},textContent:r})]},s)}}}if(e.lineDelta<0)for(let t of[c.children,s?.children??[]])for(let n=t.length-1;n>=0;n--){let r=t[n],i=qu(r)??qu(r,`columnNumber`),a=r.dataset.lineType;if(!(i===void 0||a===`change-deletion`)){if(i-1<e.lineCount)break;r.remove()}}let f=e.lineDelta!==0;if(f){let e=c.children.length;for(let t of c.children){let{bufferSize:n}=t.dataset;n!==void 0&&(e+=parseInt(n)-1)}c.style.gridRow=`span `+e,s!==void 0&&(s.style.gridRow=`span `+e)}a.updateRenderCache(u,i.themeType,{shouldRefreshDiffsView:this.#Ce&&!f,lineCountChangeInFlight:f}),f&&a.applyDocumentChange(o,t,r),(f||this.#Ce&&this.#Se===`unified`)&&this.#Ee(),t!==void 0&&(this.#I=t,ud(t,c,s)),this.#e.__debug===!0&&console.log(`[diffs/editor] re-render in: ${Zu(performance.now()-d)}ms,`,`tokenize in: ${Zu(d-l)}ms (${u.size} dirty lines)`)}#Xe(e,t){switch(e){case`insertText`:{let e=t??``,n=this.#L,r=this.#ne,i=n!==void 0&&r!==void 0?Fd(n,r,e,this.#e.autoSurround):void 0;this.#At(i??e);break}case`insertCompositionText`:break;case`insertLineBreak`:case`insertParagraph`:this.#At(this.#L?.eol??`
|
|
2186
|
+
`);break;case`deleteContentBackward`:this.#jt();break;case`deleteContentForward`:this.#jt(!0);break;case`deleteSoftLineBackward`:case`deleteHardLineBackward`:this.#Mt();break;case`deleteWordBackward`:this.#Nt();break;case`insertTranspose`:this.#Ft();break;default:console.warn(`[diffs] Unknown input type: ${e}`,t);break}}#Ze(e,t=!0,n){this.#K=!0,e===void 0?n?.()===!1?this.#K=!1:this.#k?.focus({preventScroll:t}):(this.#W=!0,this.#nt({start:e,end:e,direction:0}),et(()=>{if(n?.()===!1||!this.#K){this.#W=!1;return}this.#k?.focus({preventScroll:t}),et(()=>{this.#W=!1})}))}#Qe(e){let t=this.#q;if(t==null)return;if(this.#ce){this.#q=void 0,this.#K=!1,this.#W=!1;return}let n=this.#k;if(n==null||!this.#$e(n)){this.#q=void 0,this.#K=!1;return}let r=()=>{if(this.#q!==t)return!1;let e=this.#$e(n);return this.#q=void 0,e};if(e!=null){this.#Ze(e,!0,r);return}let i=this.#ne?.at(-1);if(i==null){this.#Ze(void 0,!0,r);return}let a=i.direction===-1?i.end:i.start;this.#Ze(a,!0,r)}#$e(e){let t=this.#D,n=t?.shadowRoot;if(t==null||n==null||this.#k!==e||!n.contains(e))return!1;let{activeElement:r}=n;if(r===e||r!=null&&e.contains(r))return!0;if(r!=null)return!1;let{ownerDocument:i}=t,{activeElement:a}=i;return a==null||a===i.body||a===i.documentElement||a===t}#et(e=0){let t=this.#k,n=this.#D;if(this.#L==null||t==null||n==null)return;let r=this.#Ae();if(r===void 0)return;let i,a;if(r instanceof HTMLElement){let e=r.getBoundingClientRect();i=e.top,a=e.bottom}else i=0,a=r.defaultView?.innerHeight??0;let o=n.shadowRoot?.querySelector(`[data-diffs-header][data-sticky]`);if(o!=null&&(i=Math.max(i,o.getBoundingClientRect().bottom)),Number.isFinite(e)&&(i+=Math.max(0,e)),!(a<=i))for(let e of t.children){let t=e,n=qu(t),r=t.dataset.lineType;if(n==null||r==null||!Wd(r))continue;let o=t.getBoundingClientRect();if(!(o.bottom<=o.top)&&o.top>=i&&o.top<a)return n}}#tt(e,t){let n={start:e,end:e,direction:0};this.#U=!1,this.#gt([n]),this.#xe(e.line),t?this.#Ze(e,!0):this.#rt()}#nt(e){let t=window.getSelection();if(t===null)return;let{start:n,end:r,direction:i}=e;$(n,r)>0&&([n,r]=[r,n]);let a=this.#zt(n.line),o=this.#zt(r.line);if(a===void 0||o===void 0)return;let[s,c]=mf(a,n.character),[l,u]=mf(o,r.character);i===-1&&([s,c,l,u]=[l,u,s,c]);try{t.setBaseAndExtent(s,Ju(s,c),l,Ju(l,u))}catch(e){console.error(`[diffs/editor] failed to update window selection:`,e)}}#rt(e=!1,t=`nearest`){let n=this.#ne?.at(-1);if(n===void 0)return;let r=this.#M;if(r!==void 0){if(r.scrollIntoView({block:t,inline:`nearest`}),!e){let e=n.direction===-1?n.end:n.start;this.#q===void 0?this.#Ze(e):this.#Qe(e)}}else{let t=Ud(n);this.#at(t.line,t.character,e)}}#it(){let e=this.#V===void 0?0:48,t=this.#Bt()+this.#t.ch;return`${e}px ${this.#t.ch}px 0 ${t}px`}#at(e,t=0,n=!1){this.__postponeBgTokenizeToNextFrame();let r=Z(`div`,{style:{position:`absolute`,left:`0`,width:`2px`,height:this.#t.lineHeight+`px`,scrollMargin:this.#it()}});if(this.#zt(e)!==void 0){let[i,a]=this.#Ut(e,t),o=this.#Ht(e)+a*this.#t.lineHeight;if(r.style.top=o+`px`,r.style.left=i+`px`,this.#A?.appendChild(r),r.scrollIntoView({block:`center`,inline:`nearest`}),!n){let n={line:e,character:t};this.#q===void 0?this.#Ze(n):this.#Qe(n)}this.#ie=void 0,this.#ae=void 0,this.#oe=!1,this.#se=!1}else{let i=this.#P?.getLinePosition?.(e+1);if(i!==void 0)r.style.top=i.top+`px`,this.#D?.shadowRoot?.appendChild(r),r.scrollIntoView({block:`center`,inline:`nearest`}),i.height>0&&this.#ye(e)?(this.#ie=e,this.#ae=t,this.#se=n):(this.#ie=void 0,this.#ae=void 0,this.#se=!1);else{let i=0;if(this.#ie===e&&this.#k!==void 0)for(let t=this.#k.childElementCount-1;t>=0;t--){let n=this.#k.children[t],r=n.dataset.lineType,a=qu(n);if(r!==void 0&&Wd(r)&&a!==void 0){i=(e-(a-1))*this.#t.lineHeight;break}}let a=((this.#I??[]).filter(t=>t.lineNumber<e).length+e)*this.#t.lineHeight+i;r.style.top=a+`px`,this.#D?.shadowRoot?.appendChild(r),r.scrollIntoView({block:`center`,inline:`nearest`}),this.#ie===e&&(i===0||this.#oe)||!this.#ye(e)?(this.#ie=void 0,this.#ae=void 0,this.#oe=!1,this.#se=!1):(this.#ie=e,this.#ae=t,this.#oe=i!==0,this.#se=n)}}r.remove()}#ot(e,t,n){let r=e=>({line:e,character:0}),i=e=>({line:e,character:n.getLineText(e).length});return t<e?{start:r(t),end:i(e),direction:-1}:{start:r(e),end:i(t),direction:1}}#st(e){let t=e.composedPath()[0];return t instanceof HTMLElement&&t.closest(`[data-line]`)?.getAttribute(`data-line-type`)===`change-deletion`}#ct(e,t,n){let r=[...n.querySelectorAll(`[data-content] > [data-line]`)],i=r.indexOf(e),a=r.indexOf(t),[o,s]=a<i?[t,e]:[e,t],c=window.getSelection();if(c!==null){let e=document.createRange();e.setStart(o,0),e.setEnd(s,s.childNodes.length),c.removeAllRanges(),c.addRange(e)}this.#pt(!0),this.#gt([]),this.#mt(qu(t)??null,!0,`deletions`);let l=Math.min(i,a),u=Math.max(i,a);this.#$=l<0?``:r.slice(l,u+1).filter(e=>e.getAttribute(`data-line-type`)===`change-deletion`).map(e=>e.textContent??``).join(`
|
|
2187
|
+
`)}#lt(e,t){let n=e.parentElement;if(n==null||t==null)return;let r=[...n.children].indexOf(e),i=t.children[r];return i instanceof HTMLElement?i:void 0}#ut(e,t,n){let r=t.querySelector(`[data-content]`),i=this.#lt(e,r);return i===void 0?!1:(this.#ct(i,i,t),n&&this.#Pe([Q(document,`mousemove`,e=>{let n=e.composedPath()[0],a=n instanceof HTMLElement?n.closest(`[data-column-number]`):null;if(a instanceof HTMLElement&&t.contains(a)){let e=this.#lt(a,r);e!==void 0&&this.#ct(i,e,t)}},{passive:!0})]),!0)}#dt(){return this.#D?.shadowRoot?.querySelector(`pre`)?.hasAttribute(`data-deleted-text-selection`)??!1}#ft(){return this.#$===``?window.getSelection()?.toString()??``:this.#$}#pt(e){let t=this.#D?.shadowRoot?.querySelector(`pre`);t!=null&&(e?(t.setAttribute(`data-deleted-text-selection`,``),this.#mt(null),this.#$=``):(t.removeAttribute(`data-deleted-text-selection`),this.#$=``))}#mt(e,t=!1,n=`additions`){try{this.#P?.setEditorActiveLine(e,{lineNumberOnly:t,side:n})}catch{}}#ht(){this.#ue===void 0&&(this.#ue=requestAnimationFrame(()=>{this.#ue=void 0,(this.#ne!==void 0||this.#re!==void 0||this.#B!==void 0)&&this.#gt(this.#ne??[])}))}#gt(e){if(this.__postponeBgTokenizeToNextFrame(),this.#M=void 0,this.#mt(null),e.length===0&&this.#re===void 0&&this.#B===void 0){this.#ne=void 0,this.#j?.forEach(e=>e.remove()),this.#j?.clear(),this.#H?.cleanup(),this.#H=void 0;return}let t=document.createDocumentFragment(),n={fragment:t,elements:new Map};if(e.length>0){let t=Qd(e),r=t.at(-1);this.#ne=t;let i=t.some(e=>!Hd(e)),a=Ud(r).line+1;this.#mt(a,i);for(let e of t)Hd(e)||this.#_t(n,`selection`,e),this.#xt(n,e,e===r);let o=this.#e.matchBrackets!==!1&&this.#L!==void 0&&this.#n!==void 0&&Hd(r)?Yf(this.#L,this.#n,r.start):void 0;if(o!==void 0)for(let e of o)this.#_t(n,`bracketMatch`,e)}let r=this.#L;if(this.#re!==void 0&&r!==void 0){let e=this.#re,t=this.#R,i=t!==void 0&&Number.isFinite(t.totalLines)||this.#Ce&&this.#P?.options.expandUnchanged!==!0?this.#Rt():void 0,a=this.#ne?.at(-1),o=a===void 0?-1:r.offsetAt(a.start),s=a===void 0?-1:r.offsetAt(a.end),c=0,l=i?.length??1;for(let t=0;t<l;t++){let a=1/0,l=i?.[t];if(l!==void 0){let[t,n]=l,i=r.offsetAt({line:t,character:0}),o=n+1;a=o<r.lineCount?r.offsetAt({line:o,character:0}):r.offsetAt({line:o-1,character:r.getLineLength(o-1)});let s=c,u=e.length;for(;s<u;){let t=s+Math.floor((u-s)/2);e[t][1]<=i?s=t+1:u=t}c=s}for(;c<e.length;c++){let[t,i]=e[c];if(t>=a)break;let l={start:r.positionAt(t),end:r.positionAt(i)},u=o===t&&s===i;this.#_t(n,`match`,l,u?`focus`:void 0)}}}if(this.#B!==void 0&&r!==void 0)for(let e of this.#B.markers)this.#_t(n,`marker`,e,Wf(e.severity));this.#A?.appendChild(t),this.#j?.forEach(e=>e.remove()),this.#j?.clear(),this.#j=n.elements,this.#St()}#_t(e,t,n,r){if(this.#L===void 0)return;let{start:i,end:a}=n,o=i.line,s=a.line+1;if(this.#R!==void 0){let{startingLine:e,totalLines:t}=this.#R;o=Math.max(o,e),s=Math.min(s,e+t)}for(let n=o;n<s;n++){if(!this.#qt(n))continue;let o=n===a.line,s=n===i.line?i.character:0,c=o?a.character:this.#L.getLineLength(n);if(this.#we){let i=this.#Vt(),a=this.#L.getLineText(n);if(2*this.#t.ch+this.#t.measureTextWidth(a)>i){this.#vt(e,n,a,s,c,o,t,r);continue}}let l=0,u=0,d=0;l=s===0?this.#Bt()+this.#t.ch+(this.#Be?.left??0):this.#Ut(n,s)[0],!o&&t===`selection`&&(d=this.#t.ch),u=s===c?d:this.#Ut(n,c)[0]-l+d,this.#bt(e,t,n,0,l,u,r)}}#vt(e,t,n,r,i,a,o,s){let c=this.#Gt(t),l=c.length-1,u=this.#Bt()+this.#t.ch+(this.#Be?.left??0);for(let d=0;d<l;d++){let f=c[d],p=c[d+1],m=Math.max(r,f),h=Math.min(i,p);if(m>h)continue;let g=this.#yt(n,f,m),_=u+g,v=0;!a&&d===l-1&&o===`selection`&&(v=this.#t.ch);let y=m===h?v:this.#yt(n,f,h)-g+v;this.#bt(e,o,t,d,_,y,s)}}#yt(e,t,n){if(n<=t)return 0;let r=e.slice(t,n),i=Dp(r,this.#t.tabSize);return i===-1?this.#t.measureTextWidth(r):i*this.#t.ch}#bt(e,t,n,r,i,a,o){if(a===0)return;let{ch:s,lineHeight:c}=this.#t,l=this.#Ht(n)+r*c,u=`${t}-${n}/${r}-${i}-${a} ${o??``}`,d=this.#j,f=(this.#e.roundedSelection??!0)&&t===`selection`,p=(n,r,i,a)=>{let o=this.#Ht(n)+r*c,l=this.#zt(n),u=`initial`;l!==void 0&&(l.dataset.lineType===`change-addition`||l.dataset.selectedLine!==void 0)&&(u=getComputedStyle(l).getPropertyValue(`--diffs-line-bg`));let f=`width:${s}px;transform:translateX(${i}px) translateY(${o}px);--diffs-selection-corner-bg:${u}`,p={selectionCorner:``,[a]:``},m=`${t}-block-${n}/${r}-${i}-1ch`,h=m+`-`+a;if(a===`rbl`){let t=m+`-rtl`,n=e.elements.get(t);n!==void 0&&(n.remove(),e.elements.delete(t),h+=`-rtl`,p.rtl=``)}let g=e.elements.get(h);g===void 0&&(d?.has(h)===!0?(g=d.get(h),g.style.cssText=f,d.delete(h)):g=Z(`div`,{dataset:`selectionRange`,style:{cssText:f},children:[Z(`div`,{dataset:p})]},e.fragment),e.elements.set(h,g))},m=t=>{let o=i+a,c=t.dataset,l=e.previousSelectionRange;if((l===void 0||l.line!==n||l.wrapLine!==r)&&(e.previousSelectionRange={element:t,line:n,wrapLine:r,left:i,width:a}),l===void 0||o<=l.left)[`rtl`,`rtr`,`rbl`,`rbr`].forEach(e=>{c[e]=``});else{let e=l.line,t=l.wrapLine,a=l.left,u=l.element.dataset,d=a+l.width;a>i&&p(e,t,a-s,`rbr`),delete u.rbl,delete c.rtl,delete c.rtr,o>=d&&delete u.rbr,o>d&&(p(e,t,d,`rbl`),c.rtr=``),o<d&&p(n,r,o,`rtl`),i<a&&(c.rtl=``),c.rbl=``,c.rbr=``}},h=e.elements.get(u);if(h!==void 0){f&&m(h);return}d?.has(u)===!0?(h=d.get(u),d.delete(u)):h=Z(`div`,{dataset:o?[t+`Range`,o]:t+`Range`},e.fragment),h.style.width=`${a}px`,h.style.transform=`translateX(${i}px) translateY(${l}px)`,f&&m(h),e.elements.set(u,h)}#xt(e,t,n){let{line:r,character:i}=Ud(t);if(!this.#qt(r))return;let[a,o]=this.#Ut(r,i),s=`caret-`+r+`/`+o+`:`+i;if(e.elements.has(s))return;let c=Z(`div`,{dataset:`caret`,style:{transform:`translateX(${a-1}px) translateY(${this.#Ht(r)+o*this.#t.lineHeight}px)`}},e.fragment);e.elements.set(s,c),n&&(c.style.scrollMargin=this.#it(),this.#M=c)}#St(){let e=this.#ne?.at(-1),t=this.#A,n=this.#L,r=this.#e.renderSelectionAction,i=()=>{this.#H?.cleanup(),this.#H=void 0};if(this.#e.enabledSelectionAction!==!0||r===void 0||e===void 0||Hd(e)||this.#X||t===void 0||n===void 0){i();return}let a=Ud(e);if(!this.#qt(a.line)){i();return}if(this.#H===void 0){if(!this.#U)return;let a=()=>this.#ne?.at(-1)??e,o=r({textDocument:n,get selection(){return a()},applyEdits:e=>this.applyEdits(e),getSelectionText:()=>this.#L?.getText(a())??``,replaceSelectionText:e=>{this.#At(e,[a()])},close:()=>{i(),this.#rt()}});this.#H=new dp(o,t,()=>this.#St()),this.#Te().resetPlacement(zp)}let o=this.#t.lineHeight,s=e.direction===-1,c={placeAbove:s,anchor:a},l=s?{placeAbove:!1,anchor:e.end}:{placeAbove:!0,anchor:e.start},u=this.#H.height,d=e=>{let[t,n]=this.#Ut(e.anchor.line,e.anchor.character),r=this.#Ht(e.anchor.line)+n*o,i=e.placeAbove?r:r+o,a=e.placeAbove?i-u:i;return{top:a,bottom:a+u,left:t,anchorTop:i,rowTop:r}},f=d(c),p=n.lineCount,m=s?a.line<3:a.line>=p-3,h=this.#qt(l.anchor.line)?d(l):void 0,g=this.#Te(),_=g.getPlacementBounds(),v=h!==void 0&&g.choosePlacement({preferred:f,fallback:h,viewport:_,popoverHeight:u,atDocumentEdge:m,placementKey:zp})===`fallback`;h===void 0&&g.setPlacement(`preferred`,zp);let{placeAbove:y}=v?l:c,{left:b,anchorTop:x}=v&&h!==void 0?h:f,S=s?f.rowTop:h?.rowTop??-1/0,C=(s?h?.rowTop??1/0:f.rowTop)+(e.end.line>e.start.line&&e.end.character===0?0:o),w=_===void 0||C>_.top&&S<_.bottom;this.#H.reposition(b,x,this.#Bt(),y,w,_)}#Ct(e){if(this.#V!==void 0){this.#V.setMode(e);return}this.#wt(e)}#wt(e){this.#V?.cleanup();let t=this.#L,n=this.#D?.shadowRoot?.querySelector(`pre`),r=this.#ne;if(t===void 0||n==null)return;let i=``,a;if(r!==void 0&&r.length>0){let e=r.at(-1);if(Hd(e)){e=hf(t,e),this.#gt([...r.slice(0,-1),e]);let n=t.getText(e);n!==``&&!n.includes(`
|
|
2188
|
+
`)&&(i=n,a=[t.offsetAt(e.start),t.offsetAt(e.end)])}}let o=([e,n],r)=>{let i=Kd(t,e,n);this.#gt([i]),this.#xe(Ud(i).line),this.#rt(!0),this.#ce=r},s=new up({textDocument:t,containerElement:n,defaultQuery:i,mode:e,initialMatch:a,scrollToMatch:o,applyReplace:e=>{if(e.length===0)return;let n=t.applyEdits(e.map(e=>({range:{start:t.positionAt(e.start),end:t.positionAt(e.end)},newText:e.text})),!0,this.#ne);n!==void 0&&this.#It(n,void 0,this.#Lt(n),{skipSearchRefresh:!0})},onUpdate:(e,n)=>{if(e.length===0){this.#re=void 0,this.#gt(this.#ne??[]);return}if(this.#re=e,n?.syncSelection===!1){this.#gt(this.#ne??[]);let n=this.#ne?.at(-1);if(n!==void 0){let r=t.offsetAt(n.start),i=t.offsetAt(n.end);for(let t of e)if(t[0]===r&&t[1]===i)return t}return}let r=this.#ne?.at(-1),i=0,a;r!==void 0&&(i=t.offsetAt(r.start));for(let t of e)if(t[0]>=i){a=t;break}return a===void 0?this.#gt(this.#ne??[]):o(a,!0),a},onClose:()=>{this.#V=void 0,this.#ce=!1,this.#re=void 0,this.#gt(this.#ne??[])}});this.#V=s,this.#ce=!1}#Tt(){let e=this.#L,t=this.#ne;return e===void 0||t===void 0?``:cf(e,t)}#Et(){let e=this.#L,t=this.#ne;return e===void 0||t===void 0?[]:sf(e,t)}#Dt(e,t,n){e!==null&&(e.setData(`text`,t),n.length>1&&e.setData(Bp,JSON.stringify(n)))}#Ot(){let e=this.#L,t=this.#ne;if(e===void 0||t===void 0||t.length===0)return``;if(t.some(e=>Hd(e))){let n=pf(e,t);return this.#kt(n.edits,n.nextSelectionOffsets),n.text}let n=cf(e,t);return this.#At(``,void 0,!0),n}#kt(e,t){let n=this.#L,r=this.#ne;if(n===void 0||r===void 0||e.length===0)return;let i=n.applyResolvedEdits(e,!0,r,void 0,!0);if(i===void 0)return;let a=t.map(e=>{let t=n.positionAt(e);return{start:t,end:t,direction:0}});n.setLastUndoSelectionsAfter(a),this.#It(i,a,this.#Lt(i))}#At(e,t=this.#ne,n=!1,r=`selection`){if(t===void 0)return;let i=this.#L,a=t.at(-1);if(i===void 0||a===void 0)return;let{nextSelections:o,change:s}=Array.isArray(e)&&e.length===t.length?Nd(i,t,e,this.#I,n,r):Ad(i,t,{start:i.offsetAt(a.start),end:i.offsetAt(a.end),text:Array.isArray(e)?e.join(i.eol):e},this.#I,void 0,n);s!==void 0&&this.#It(s,o,this.#Lt(s))}#jt(e=!1){let t=this.#ne,n=this.#L;if(t===void 0||n===void 0)return;let{nextSelections:r,change:i}=Vd(n,t,e,this.#I,this.#t.tabSize);i!==void 0&&this.#It(i,r,this.#Lt(i))}#Mt(){let e=this.#ne,t=this.#L;if(e===void 0||t===void 0)return;let{nextSelections:n,change:r}=Rd(t,e,this.#we?(e,t)=>{let n=this.#Gt(e);for(let e=0;e+1<n.length;e++){let r=n[e],i=n[e+1];if(t>=r&&t<=i)return r}return 0}:void 0,this.#I);r!==void 0&&this.#It(r,n,this.#Lt(r))}#Nt(){let e=this.#ne,t=this.#L;if(e===void 0||t===void 0)return;let{nextSelections:n,change:r}=zd(t,e,this.#I);r!==void 0&&this.#It(r,n,this.#Lt(r))}#Pt(){let e=this.#ne,t=this.#L;if(e===void 0||t===void 0)return;let{nextSelections:n,change:r}=Ld(t,e,this.#I);r!==void 0&&this.#It(r,n,this.#Lt(r))}#Ft(){let e=this.#ne,t=this.#L;if(e===void 0||t===void 0)return;let{nextSelections:n,change:r}=Id(t,e,this.#I);r!==void 0&&this.#It(r,n,this.#Lt(r))}#It(e,t,n,r){let i=this.getFile(),a=this.#e.onChange;if(i!==void 0&&a!==void 0){let t=n??this.#I;a(i,t,{changes:e.changes,file:i,lineAnnotations:t})}if(e.lineDelta!==0||this.#we)for(let t of this.#y.keys())t>=e.startLine&&this.#y.delete(t);if(this.#b.size>0)if(e.lineDelta===0&&(e.changedLineRanges.length===1||e.changedLineChanges?.every(([,,e])=>e===0)===!0))for(let[t,n]of e.changedLineRanges)for(let e=t;e<=n;e++)this.#b.delete(e);else for(let t of this.#b.keys())t>=e.startLine&&this.#b.delete(t);this.#S=void 0;let o=this.#R,s;if(o!==void 0&&t!==void 0&&t.length>0){let n=t.at(-1),r=o.startingLine+o.totalLines;if(n.end.line>=r){let t=n.end.line-o.startingLine+1,i=this.#z===void 0||this.#z===1/0?1/0:this.#z*Lp;e.startLine<=r&&t<=i&&this.#ye(n.end.line)?(n.end.line>r&&(s=!0),o={...o,totalLines:t},this.#R=o):s=!0}}if(this.#Ye(e,n,o,s),r?.skipSearchRefresh!==!0&&this.#V!==void 0&&this.#re!==void 0&&this.#V.updateMatches({syncSelection:!1}),t!==void 0&&(this.#gt(t),r?.skipFocus!==!0)){let e=t.at(-1);if(e!==void 0&&this.#xe(Ud(e).line),this.#M!==void 0)requestAnimationFrame(()=>{this.#M?.scrollIntoView({block:`nearest`,inline:`nearest`})});else if(t.length>0){let e=Ud(t.at(-1));this.#at(e.line,e.character)}this.focus({preventScroll:!0})}}#Lt(e){if(this.#I!==void 0){let t=id(e,this.#I);if(t!==void 0)return this.#L?.setLastUndoLineAnnotations(this.#I,t),t}}#Rt(){let e=this.#k;if(e===void 0)return[];let t=[];for(let n of e.children){let e=n,r=e.dataset.lineType,i=qu(e);if(i===void 0||r===void 0||!Wd(r))continue;let a=i-1,o=t.at(-1);o!==void 0&&a<=o[1]+1?o[1]=Math.max(o[1],a):t.push([a,a])}return t}#zt(e){let t=this.#x.get(e);if(t!==void 0)return t??void 0;let n=this.#R;if(n!==void 0&&(e<n.startingLine||e>=n.startingLine+n.totalLines))return;let r=this.#k;if(r!==void 0){if(n!==void 0){let{startingLine:i}=n,{children:a}=r;for(let n=e-i;n<=a.length;n++){let r=a[n];if(r===void 0)break;let i=qu(r),o=r.dataset.lineType;if(i!==void 0&&i===e+1&&o!==void 0&&Wd(o)){t=r;break}}}return t??=r.querySelector(`[data-line="${e+1}"]`+(this.#Se===`unified`?`:not([data-line-type="change-deletion"])`:``)),t!==void 0&&this.#x.set(e,t),t??void 0}}#Bt(){if(this.#O===void 0)return 0;if(this.#_===void 0){let e=this.#k?.parentElement?.style.getPropertyValue(`--diffs-column-number-width`);e!==void 0&&e.length>2&&e.endsWith(`px`)?this.#_=parseInt(e.slice(0,-2),10):this.#_=this.#O.offsetWidth}return this.#_}#Vt(){if(this.#k===void 0)return 0;if(this.#v===void 0){let e=this.#k.parentElement?.style.getPropertyValue(`--diffs-column-content-width`);e!==void 0&&e.length>2&&e.endsWith(`px`)?this.#v=parseFloat(e.slice(0,-2)):this.#v=this.#k.offsetWidth}return this.#v}#Ht(e){let t=this.#y.get(e);if(t!==void 0)return t;let n=this.#zt(e);if(n===void 0)return-1;let r=n.offsetTop+this.#t.paddingTop;return r+=this.#Be?.top??0,this.#y.set(e,r),r}#Ut(e,t){if(this.#S!==void 0&&this.#S[0]===e&&this.#S[1]===t)return[this.#S[2],this.#S[3]];let n=this.#L?.getLineText(e),r=this.#Bt()+this.#t.ch;if(n===void 0||n.length===0||t<=0)return[r+(this.#Be?.left??0),0];let i=Tp(n,Math.min(t,n.length)),a=n.slice(0,i),o=Dp(a,this.#t.tabSize),s=0,c=0;if(s=o===-1?r+this.#t.measureTextWidth(a):r+o*this.#t.ch,this.#we){let t=this.#Vt();if(2*this.#t.ch+this.#t.measureTextWidth(n)>t){let t=this.#Wt(e);if(t==null)return[s+(this.#Be?.left??0),0];for(let e=0;e+1<t.length;e++){let a=t[e];if(i<=t[e+1]){c=e;let t=n.slice(a,i),o=Dp(t,this.#t.tabSize);s=o===-1?r+this.#t.measureTextWidth(t):r+o*this.#t.ch;break}}}s+=this.#Be?.left??0}return this.#S===void 0?this.#S=[e,t,s,c]:(this.#S[0]=e,this.#S[1]=t,this.#S[2]=s,this.#S[3]=c),[s,c]}#Wt(e){let t=this.#b.get(e);if(t!==void 0)return t;this.#b.size>=Rp&&this.#b.clear();let n=this.#L?.getLineText(e);if(n===void 0||n.length===0){let t=new Uint32Array([0]);return this.#b.set(e,t),t}let r=this.#k;if(r==null||!r.isConnected)return;let i=Z(`div`,{style:{position:`absolute`,top:`0`,left:`0`,width:`100%`,boxSizing:`border-box`,visibility:`hidden`,pointerEvents:`none`,whiteSpace:`pre-wrap`,wordBreak:`break-word`,font:`inherit`,paddingInline:`1ch`,tabSize:this.#t.tabSize.toString()},textContent:n},r),a=i.firstChild,o=document.createRange(),s=[];try{let t=i.getBoundingClientRect();if(t.width===0)return;let r=Ep(n),c=t.left+this.#t.ch,l=r===void 0?n.length:r.length-1,u=e=>r===void 0?e:r[e],d=e=>(o.setStart(a,u(e)),o.setEnd(a,u(e+1)),o.getBoundingClientRect());s.push(0);let f=d(0).top,p=1;for(;p<l;){let e=p,t=l;for(;e<t;){let n=e+t>>1;d(n).top>f?t=n:e=n+1}if(e>=l)break;let{left:n,top:r}=d(e),i=ke()&&n-c>this.#t.ch/2;s.push(u(i?e-1:e)),f=r,p=e+1}let m=new Uint32Array(s.length+1);for(let e=0;e<s.length;e++)m[e]=s[e];return m[s.length]=n.length,this.#b.set(e,m),m}finally{i.remove()}}#Gt(e){let t=this.#Wt(e);if(t!==void 0)return t;let n=this.#L?.getLineText(e)?.length??0;return Uint32Array.of(0,n)}#Kt({startContainer:e,endContainer:t}){let n=this.#k;return n===void 0?!1:n.contains(e)&&n.contains(t)}#qt(e){let t=this.#L?.lineCount??0;return e<0||e>=t?!1:this.#zt(e)!==void 0}},Hp=typeof window>`u`?Y.useEffect:Y.useLayoutEffect;function Up(e,t,n){let r=e==null?null:(0,X.jsx)(`div`,{slot:mt,children:e}),i=t!=null&&n!=null?(0,X.jsx)(`div`,{slot:ht,children:t(n.item,n.context)}):null;return r==null&&i==null?null:(0,X.jsxs)(X.Fragment,{children:[r,i]})}function Wp(e,t){return typeof window>`u`&&t!=null?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`template`,{shadowrootmode:`open`,dangerouslySetInnerHTML:{__html:t.shadowHtml}}),e]}):(0,X.jsx)(X.Fragment,{children:e})}function Gp(e){let t=e.shadowRoot;return t?.querySelector(`[data-file-tree-id]`)instanceof HTMLElement||t?.querySelector(`[data-file-tree-id]`)instanceof SVGElement?!0:e.querySelector(`template[shadowrootmode="open"]`)instanceof HTMLTemplateElement}function Kp(e,t,n,r,i){let a={...e??{}};if(t!=null&&delete a.header,n){let t=e?.contextMenu,n=t?.onClose,o=t?.onOpen;a.contextMenu={...t??{},enabled:!0,onClose:()=>{n?.(),r()},onOpen:(e,t)=>{i(e,t),o?.(e,t)}},delete a.contextMenu.render}return a.header!=null||a.contextMenu!=null?a:void 0}function qp({header:e,id:t,model:n,preloadedData:r,renderContextMenu:i,...a}){let[o,s]=(0,Y.useState)(null),[c,l]=(0,Y.useState)(null),u=(0,Y.useRef)(n.getComposition()),d=(0,Y.useRef)(n);d.current!==n&&(d.current=n,u.current=n.getComposition());let f=i!=null,p=(0,Y.useCallback)(()=>{s(null)},[]),m=(0,Y.useCallback)((e,t)=>{s({context:t,item:e})},[]),h=u.current,g=(0,Y.useMemo)(()=>Kp(h,e,f,p,m),[h,p,m,f,e]),_=(0,Y.useCallback)(e=>{l(e)},[]);(0,Y.useEffect)(()=>{f||s(null)},[f]),Hp(()=>{n.setComposition(g)},[g,n]),Hp(()=>{if(c!=null)return r!=null&&Gp(c)?n.hydrate({fileTreeContainer:c}):n.render({fileTreeContainer:c}),()=>{n.unmount(),n.setComposition(h)}},[h,c,n,r]);let v=Wp(Up(e,i,o),r),y=t??r?.id,b={"--trees-item-height":`${String(n.getItemHeight())}px`,"--trees-density-override":n.getDensityFactor(),...a.style};return(0,X.jsx)(ct,{...a,id:y,ref:_,style:b,suppressHydrationWarning:r!=null,children:v})}function Jp(e){let[t]=(0,Y.useState)(()=>new Ul(e)),n=(0,Y.useRef)({timeout:null,model:t});return(0,Y.useEffect)(()=>{let{current:e}=n;return e.timeout!=null&&(clearTimeout(e.timeout),e.timeout=null),()=>{e.timeout=setTimeout(()=>e.model.cleanUp(),1)}},[]),{model:t}}var Yp=r(),Xp=e=>{if(typeof e!=`object`||!e)return null;let t=e;return typeof t.getAttribute==`function`?t.getAttribute(`data-item-path`):null};function Zp(e){let t=[],n=[];return{isDragInProgress:()=>n.length>0,handleSelectionChange(e){t=e},handleDragStart(e){if(e.dataTransfer===null)return;let r=null;for(let t of e.composedPath())if(r=Xp(t),r!==null)break;if(r===null)return;let i=t.includes(r)?t:[r],a=i.map(e=>he(e)).filter(e=>e!==null);a.length!==0&&(n=i,e.dataTransfer.setData(de,a.join(` `)))},handleDragEnd(){if(n.length!==0){for(let t of n)e.deselect(t);n=[]}}}}var Qp=`
|
|
2189
|
+
:host {
|
|
2190
|
+
--trees-bg-override: transparent;
|
|
2191
|
+
--trees-selected-bg-override: color-mix(in srgb, currentColor 12%, transparent);
|
|
2192
|
+
--trees-hover-bg-override: color-mix(in srgb, currentColor 7%, transparent);
|
|
2193
|
+
--trees-border-color-override: color-mix(in srgb, currentColor 14%, transparent);
|
|
2194
|
+
--trees-font-family-override: var(--font-sans);
|
|
2195
|
+
--trees-font-size-override: 12px;
|
|
2196
|
+
}
|
|
2197
|
+
button[data-type='item'] { border-radius: 5px; }
|
|
2198
|
+
`;function $p(e){return e.kind===`directory`?`${e.path}/`:e.path}function em({environmentId:e,cwd:t,projectName:n,onOpenFile:r}){let{resolvedTheme:o}=d(),s=Ue(),c=Ie(e,t),l=c.data?.entries??[],u=(0,Y.useMemo)(()=>new Map(l.map(e=>[e.path,e.kind])),[l]),f=(0,Y.useRef)(u),p=(0,Y.useMemo)(()=>l.map($p),[l]),h=(0,Y.useRef)([]),g=(0,Y.useRef)(null);(0,Y.useEffect)(()=>{let e=e=>{g.current={x:e.clientX,y:e.clientY,at:e.timeStamp}};return document.addEventListener(`contextmenu`,e,!0),()=>document.removeEventListener(`contextmenu`,e,!0)},[]);let _=async(e,t)=>{let n=i();if(!n){t.close();return}let r=e.path.replace(/\/$/,``),a=qe(r),o=g.current,c=o!==null&&performance.now()-o.at<1e3,l=t.anchorElement.getBoundingClientRect(),u=c?{x:o.x,y:o.y}:{x:l.left,y:l.bottom};try{let e=await n.contextMenu.show([{id:`copy-mention`,label:`Copy mention`},{id:`add-to-chat`,label:`Add to chat`}],u);if(e===`copy-mention`){try{await S(a),m.add({type:`success`,title:`Mention copied`,description:r})}catch(e){m.add({type:`error`,title:`Failed to copy mention`,description:e instanceof Error?e.message:`An error occurred.`})}return}if(e===`add-to-chat`){let e=s?.current;if(!e){m.add({type:`error`,title:`Unable to add to chat`,description:`Open a chat for this project and try again.`});return}e.insertTextAtEnd(`${a} `,{ensureLeadingBoundary:!0})||m.add({type:`error`,title:`Unable to add to chat`,description:`The chat isn't ready to accept input right now.`})}}finally{t.close()}},v=(0,Y.useRef)(_);(0,Y.useEffect)(()=>{v.current=_});let y=(0,Y.useRef)(null),b=(0,Y.useMemo)(()=>Zp({deselect:e=>y.current?.getItem(e)?.deselect()}),[]),{model:x}=Jp({composition:{contextMenu:{triggerMode:`right-click`,onOpen:(e,t)=>{v.current(e,t)}}},dragAndDrop:{canDrop:()=>!1},density:`compact`,fileTreeSearchMode:`hide-non-matches`,flattenEmptyDirectories:!0,initialExpansion:1,icons:re,onSelectionChange:e=>{if(b.handleSelectionChange(e),b.isDragInProgress())return;let t=e.at(-1)?.replace(/\/$/,``);t&&f.current.get(t)===`file`&&r(t)},paths:[],search:!0,unsafeCSS:Qp});(0,Y.useEffect)(()=>{h.current!==p&&(f.current=u,h.current=p,x.resetPaths(p))},[u,x,p]);let C=(0,Y.useMemo)(()=>l.reduce((e,t)=>e+ +(t.kind===`file`),0),[l]),w=(0,Y.useRef)(null);return(0,Y.useEffect)(()=>{y.current=x},[x]),(0,Y.useEffect)(()=>{let e=w.current;if(e===null)return;let t=e=>b.handleDragStart(e),n=()=>b.handleDragEnd();return e.addEventListener(`dragstart`,t,!0),e.addEventListener(`dragend`,n),()=>{e.removeEventListener(`dragstart`,t,!0),e.removeEventListener(`dragend`,n)}},[b]),(0,X.jsxs)(`div`,{ref:w,className:`flex min-h-0 flex-1 flex-col bg-background`,"data-file-browser-panel":`${e}:${t}`,children:[(0,X.jsxs)(`div`,{className:`flex h-9 shrink-0 items-center gap-2 border-b border-border/60 px-3`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`div`,{className:`truncate text-xs font-medium text-foreground`,children:n}),(0,X.jsxs)(`div`,{className:`truncate text-[10px] leading-none text-muted-foreground`,children:[c.isPending&&c.data===null?`Indexing…`:`${C.toLocaleString()} files`,c.data?.truncated?` · partial`:``]})]}),(0,X.jsx)(`button`,{type:`button`,className:`rounded-md p-1.5 text-muted-foreground hover:bg-accent hover:text-foreground`,"aria-label":`Search workspace files`,onClick:()=>x.openSearch(),children:(0,X.jsx)(be,{className:`size-3.5`})}),(0,X.jsx)(`button`,{type:`button`,className:`rounded-md p-1.5 text-muted-foreground hover:bg-accent hover:text-foreground`,"aria-label":`Refresh workspace files`,onClick:c.refresh,children:(0,X.jsx)(Te,{className:a(`size-3.5`,c.isPending&&`animate-spin`)})})]}),c.error&&c.data===null?(0,X.jsx)(`div`,{className:`p-4 text-xs leading-relaxed text-destructive`,children:c.error}):(0,X.jsx)(qp,{model:x,"aria-label":`${n} files`,className:`min-h-0 flex-1 overflow-hidden`,style:{colorScheme:o,"--trees-fg-override":`var(--foreground)`}})]})}function tm(e){let t=(0,Yp.c)(11),{open:n,title:r,onOpenChange:i,children:a}=e,o;t[0]===r?o=t[1]:(o=(0,X.jsx)(oe,{className:`shrink-0 border-b border-border/60 px-4 py-2.5 pe-12 text-sm font-medium`,children:r}),t[0]=r,t[1]=o);let s;t[2]===a?s=t[3]:(s=(0,X.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:a}),t[2]=a,t[3]=s);let c;t[4]!==o||t[5]!==s?(c=(0,X.jsxs)(ce,{className:`row-start-1 row-end-4 flex h-full max-h-full w-full max-w-none flex-col overflow-hidden p-0`,bottomStickOnMobile:!1,children:[o,s]}),t[4]=o,t[5]=s,t[6]=c):c=t[6];let l;return t[7]!==i||t[8]!==n||t[9]!==c?(l=(0,X.jsx)(Se,{open:n,onOpenChange:i,children:c}),t[7]=i,t[8]=n,t[9]=c,t[10]=l):l=t[10],l}var nm=1024,rm=[`B`,`KB`,`MB`,`GB`,`TB`];function im(e){if(!Number.isFinite(e)||e<0)return`unknown size`;let t=e,n=0;for(;t>=nm&&n<rm.length-1;)t/=nm,n+=1;return`${n===0?t:Math.round(t*10)/10} ${rm[n]}`}function am(e){let t=e.lastIndexOf(`.`);return t<=0||t===e.length-1?`File`:`${e.slice(t+1).toUpperCase()} file`}function om(e){let t=(0,Yp.c)(35),{environmentId:n,keybindings:r,availableEditors:a,absolutePath:o,name:s,byteLength:c,canRevealInFileManager:l}=e,u;t[0]===o?u=t[1]:(u=()=>{let e=i();e&&e.shell.showItemInFolder(o).catch(cm)},t[0]=o,t[1]=u);let d=u,f;t[2]===o?f=t[3]:(f=()=>{if(!navigator.clipboard?.writeText){m.add(h({type:`error`,title:`Failed to copy path`,description:`Clipboard API unavailable.`}));return}navigator.clipboard.writeText(o).then(()=>m.add({type:`success`,title:`Path copied`,description:o}),sm)},t[2]=o,t[3]=f);let p=f,g;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,X.jsx)(ot,{className:`mt-0.5 size-5 shrink-0 text-muted-foreground`}),t[4]=g):g=t[4];let _;t[5]===s?_=t[6]:(_=(0,X.jsx)(`div`,{className:`truncate text-sm font-medium`,title:s,children:s}),t[5]=s,t[6]=_);let v;t[7]===s?v=t[8]:(v=am(s),t[7]=s,t[8]=v);let y;t[9]===c?y=t[10]:(y=im(c),t[9]=c,t[10]=y);let x;t[11]!==v||t[12]!==y?(x=(0,X.jsxs)(`div`,{className:`mt-0.5 text-xs text-muted-foreground`,children:[v,` · `,y]}),t[11]=v,t[12]=y,t[13]=x):x=t[13];let S;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,X.jsx)(`div`,{className:`mt-1 text-xs leading-relaxed text-muted-foreground`,children:`This file cannot be shown here.`}),t[14]=S):S=t[14];let C;t[15]!==_||t[16]!==x?(C=(0,X.jsxs)(`div`,{className:`flex items-start gap-3`,children:[g,(0,X.jsxs)(`div`,{className:`min-w-0`,children:[_,x,S]})]}),t[15]=_,t[16]=x,t[17]=C):C=t[17];let w;t[18]!==o||t[19]!==a||t[20]!==n||t[21]!==r?(w=(0,X.jsx)(He,{environmentId:n,keybindings:r,availableEditors:a,openInCwd:o,compact:!0,enableShortcut:!1}),t[18]=o,t[19]=a,t[20]=n,t[21]=r,t[22]=w):w=t[22];let T;t[23]!==l||t[24]!==d?(T=l?(0,X.jsxs)(b,{variant:`outline`,size:`sm`,onClick:d,children:[(0,X.jsx)(F,{className:`size-3.5`}),`Reveal in Finder`]}):null,t[23]=l,t[24]=d,t[25]=T):T=t[25];let E;t[26]===p?E=t[27]:(E=(0,X.jsx)(b,{variant:`outline`,size:`sm`,onClick:p,children:`Copy path`}),t[26]=p,t[27]=E);let D;t[28]!==w||t[29]!==T||t[30]!==E?(D=(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[w,T,E]}),t[28]=w,t[29]=T,t[30]=E,t[31]=D):D=t[31];let O;return t[32]!==D||t[33]!==C?(O=(0,X.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-6`,children:(0,X.jsxs)(`div`,{className:`flex w-full max-w-md flex-col gap-4 rounded-lg border border-border/60 bg-card p-5`,children:[C,D]})}),t[32]=D,t[33]=C,t[34]=O):O=t[34],O}function sm(e){return m.add(h({type:`error`,title:`Failed to copy path`,description:e instanceof Error?e.message:`An error occurred.`}))}function cm(e){m.add(h({type:`error`,title:`Unable to reveal file`,description:e instanceof Error?e.message:`An error occurred.`}))}function lm({root:e,resolveEditor:t,onDismiss:n}){n(),t()?.setSelections([]);let r=e.querySelector(`diffs-container`)?.shadowRoot?.activeElement;r instanceof HTMLElement&&r.blur()}function um(e){return e.querySelector(`diffs-container`)?.shadowRoot?.activeElement?.hasAttribute(`data-content`)===!0}function dm({root:e,resolveEditor:t,isBlocked:n,onDismiss:r}){let i=i=>{n()||i.composedPath().includes(e)||lm({root:e,resolveEditor:t,onDismiss:r})},a=i=>{i.key!==`Escape`||n()||!um(e)||(i.preventDefault(),i.stopImmediatePropagation(),lm({root:e,resolveEditor:t,onDismiss:r}))};return document.addEventListener(`pointerdown`,i,!0),document.addEventListener(`keydown`,a,!0),()=>{document.removeEventListener(`pointerdown`,i,!0),document.removeEventListener(`keydown`,a,!0)}}function fm(e){let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return`${e.length}:${(t>>>0).toString(36)}`}function pm(e,t,n){return`${e}:${t}:${fm(n)}`}function mm(e,t){let n=t.split(`/`).filter(Boolean);return[{label:e,path:``,kind:`project`},...n.map((e,t)=>({label:e,path:n.slice(0,t+1).join(`/`),kind:t===n.length-1?`file`:`directory`}))]}var hm=e=>/\.(?:md|mdx)$/i.test(e);function gm(e,t,n){return t<0||e[t]!==`[`||!/[ xX]/.test(e[t+1]??``)||e[t+2]!==`]`?e:`${e.slice(0,t+1)}${n?`x`:` `}${e.slice(t+2)}`}var _m=class{options;timer=null;latestContents=``;latestRevision=0;lastChangeAt=0;saving=!1;disposed=!1;constructor(e){this.options=e}change(e){this.latestContents=e,this.latestRevision+=1,this.lastChangeAt=Date.now(),this.options.onPendingChange(!0),this.schedule(this.options.debounceMs)}dispose(){this.disposed=!0,this.clearTimer(),this.latestRevision>0&&this.persistLatest()}schedule(e){this.clearTimer(),this.timer=setTimeout(()=>{this.timer=null,this.persistLatest()},e)}clearTimer(){this.timer!==null&&(clearTimeout(this.timer),this.timer=null)}async persistLatest(){if(this.saving||this.latestRevision===0)return;this.saving=!0;let e=this.latestContents,t=this.latestRevision,n=(await this.options.persist(e))._tag===`Success`;if(n&&this.options.onConfirmed(e),this.saving=!1,t===this.latestRevision){n&&this.options.onPendingChange(!1);return}let r=Math.max(0,this.options.debounceMs-(Date.now()-this.lastChangeAt));this.disposed?this.persistLatest():this.schedule(r)}},vm=`p4code.fileExplorerOpen`,ym=500,bm=`data-file-link-reveal`,xm=`
|
|
2199
|
+
[${bm}][data-line] {
|
|
2200
|
+
background-color: light-dark(
|
|
2201
|
+
color-mix(
|
|
2202
|
+
in lab,
|
|
2203
|
+
var(--diffs-computed-diff-line-bg) 82%,
|
|
2204
|
+
var(--diffs-bg-selection-override, var(--diffs-selection-base))
|
|
2205
|
+
),
|
|
2206
|
+
color-mix(
|
|
2207
|
+
in lab,
|
|
2208
|
+
var(--diffs-computed-diff-line-bg) 75%,
|
|
2209
|
+
var(--diffs-bg-selection-override, var(--diffs-selection-base))
|
|
2210
|
+
)
|
|
2211
|
+
) !important;
|
|
2212
|
+
}
|
|
2213
|
+
|
|
2214
|
+
[${bm}][data-column-number] {
|
|
2215
|
+
background-color: light-dark(
|
|
2216
|
+
color-mix(
|
|
2217
|
+
in lab,
|
|
2218
|
+
var(--diffs-computed-diff-line-bg) 75%,
|
|
2219
|
+
var(--diffs-bg-selection-number-override, var(--diffs-selection-base))
|
|
2220
|
+
),
|
|
2221
|
+
color-mix(
|
|
2222
|
+
in lab,
|
|
2223
|
+
var(--diffs-computed-diff-line-bg) 60%,
|
|
2224
|
+
var(--diffs-bg-selection-number-override, var(--diffs-selection-base))
|
|
2225
|
+
)
|
|
2226
|
+
) !important;
|
|
2227
|
+
color: var(--diffs-selection-number-fg) !important;
|
|
2228
|
+
}
|
|
2229
|
+
`;function Sm(e){let t=(0,Yp.c)(5),n=Be(e.environmentId,e.resource),[r,i]=(0,Y.useState)(null);if(n._tag===`Failure`||n._tag===`Success`&&r===n.url){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center px-6 text-center text-xs leading-relaxed text-destructive`,children:`Unable to load image.`}),t[0]=e):e=t[0],e}let a;return t[1]!==n._tag||t[2]!==n.url||t[3]!==e.alt?(a=n._tag===`Success`?(0,X.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-auto p-4`,children:(0,X.jsx)(`img`,{className:`max-h-full max-w-full object-contain`,src:n.url,alt:e.alt,onError:()=>i(n.url)})}):(0,X.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center text-muted-foreground`,children:(0,X.jsx)(y,{className:`size-5 animate-spin`})}),t[1]=n._tag,t[2]=n.url,t[3]=e.alt,t[4]=a):a=t[4],a}function Cm(e,t){let n=1;for(let t=0;t<e.length;t+=1){let r=e.charCodeAt(t);r===10?n+=1:r===13&&(n+=1,e.charCodeAt(t+1)===10&&(t+=1))}return Math.min(Math.max(1,t),n)}function wm(e,t){let n=e.shadowRoot??e;for(let e of n.querySelectorAll(`[${bm}]`))e.removeAttribute(bm);t!==null&&(n.querySelector(`[data-line="${t}"]`)?.setAttribute(bm,``),n.querySelector(`[data-column-number="${t}"]`)?.setAttribute(bm,``))}function Tm(e,t,n){let r=(0,Yp.c)(7),[i]=(0,Y.useState)(Om),[a]=(0,Y.useState)(Dm),[o]=(0,Y.useState)(Em),s;return r[0]!==i||r[1]!==a||r[2]!==o||r[3]!==e||r[4]!==t||r[5]!==n?(s=(r,s,c)=>{if(e===null)return;let l=()=>{let t=o.get(e);t!==void 0&&(cancelAnimationFrame(t),o.delete(e))};if(c===`unmount`){l();return}let u=t===null?null:Cm(s.file?.contents??``,t);if(wm(r,u),!(s instanceof M))return;if(a.get(e)!==n&&(l(),a.set(e,n)),u===null){r.style.minHeight=``;return}let d=r.closest(`.file-preview-virtualizer`);!d||(r.style.minHeight=`${Math.ceil(Math.max(s.height,d.clientHeight))}px`,i.get(e)===n||o.has(e))||o.set(e,requestAnimationFrame(()=>{if(o.delete(e),a.get(e)!==n||!r.isConnected)return;let t=s.getLinePosition(u);if(!t)return;let c=d.scrollTop+r.getBoundingClientRect().top-d.getBoundingClientRect().top,l=Math.max(0,c+t.top-Math.max(0,(d.clientHeight-t.height)/2)),f=Math.max(0,d.scrollHeight-d.clientHeight);d.scrollTop=Math.min(l,f),i.set(e,n)}))},r[0]=i,r[1]=a,r[2]=o,r[3]=e,r[4]=t,r[5]=n,r[6]=s):s=r[6],s}function Em(){return new Map}function Dm(){return new Map}function Om(){return new Map}function km(e){let t=(0,Yp.c)(19),{environmentId:n,cwd:r,relativePath:i,onPendingChange:a}=e,o=j(ye.writeFile),s;t[0]!==a||t[1]!==i?(s=e=>a(i,e),t[0]=a,t[1]=i,t[2]=s):s=t[2];let c;t[3]!==r||t[4]!==n||t[5]!==i||t[6]!==o?(c=e=>o({environmentId:n,input:{cwd:r,relativePath:i,contents:e}}),t[3]=r,t[4]=n,t[5]=i,t[6]=o,t[7]=c):c=t[7];let l;t[8]!==r||t[9]!==n||t[10]!==i?(l=e=>{Ve(n,r,i,e)},t[8]=r,t[9]=n,t[10]=i,t[11]=l):l=t[11];let u;t[12]!==s||t[13]!==c||t[14]!==l?(u=new _m({debounceMs:ym,onPendingChange:s,persist:c,onConfirmed:l}),t[12]=s,t[13]=c,t[14]=l,t[15]=u):u=t[15];let d=u,f,p;return t[16]===d?(f=t[17],p=t[18]):(f=()=>()=>d.dispose(),p=[d],t[16]=d,t[17]=f,t[18]=p),(0,Y.useEffect)(f,p),d}function Am(e){let t=(0,Yp.c)(73),{environmentId:n,cwd:r,relativePath:i,composerDraftTarget:a,contents:s,resolvedTheme:c,revealRequestId:l,wordWrap:d,onPostRender:f,onPendingChange:p}=e,m=o(Lm),h=o(Im),g;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(g=[],t[0]=g):g=t[0];let[_,v]=(0,Y.useState)(g),[y,b]=(0,Y.useState)(null),x=y?.revealRequestId===l?y.range:null,S;t[1]===l?S=t[2]:(S=e=>{b({revealRequestId:l,range:e})},t[1]=l,t[2]=S);let C=S,w=(0,Y.useRef)(null),T=(0,Y.useRef)(null),E;t[3]!==r||t[4]!==n||t[5]!==p||t[6]!==i?(E={environmentId:n,cwd:r,relativePath:i,onPendingChange:p},t[3]=r,t[4]=n,t[5]=p,t[6]=i,t[7]=E):E=t[7];let D=km(E),O=(0,Y.useRef)(null),ee;t[8]!==m||t[9]!==a||t[10]!==r||t[11]!==n||t[12]!==i||t[13]!==D?(ee=(e,t)=>{if(Ne(n,r,i,e.contents),D.change(e.contents),t){let n=it(t);v(n);for(let t of n)for(let n of t.metadata.entries)n.kind===`comment`&&m(a,u({id:n.id,filePath:i,startLine:n.startLine,endLine:n.endLine,text:n.text,contents:e.contents}))}},t[8]=m,t[9]=a,t[10]=r,t[11]=n,t[12]=i,t[13]=D,t[14]=ee):ee=t[14];let k=ee,A;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(A=e=>{let t=new Vp(e);return O.current=t,t},t[15]=A):A=t[15];let j=A,M,N;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(M=()=>()=>{O.current?.cleanUp(),O.current=null},N=[],t[16]=M,t[17]=N):(M=t[16],N=t[17]),(0,Y.useEffect)(M,N);let P;t[18]!==a||t[19]!==h||t[20]!==C?(P=e=>{C(null),h(a,e),v(t=>t.flatMap(t=>{let n=t.metadata.entries.filter(t=>t.id!==e);return n.length>0?[{...t,metadata:{entries:n}}]:[]}))},t[18]=a,t[19]=h,t[20]=C,t[21]=P):P=t[21];let te=P,F;t[22]!==m||t[23]!==a||t[24]!==s||t[25]!==_||t[26]!==i||t[27]!==C?(F=(e,t)=>{C(null);let n=_.flatMap(Fm).find(t=>t.id===e);n&&m(a,u({id:n.id,filePath:i,startLine:n.startLine,endLine:n.endLine,text:t,contents:s})),v(n=>n.map(n=>({...n,metadata:{entries:n.metadata.entries.map(n=>n.id===e?{...n,kind:`comment`,text:t}:n)}})))},t[22]=m,t[23]=a,t[24]=s,t[25]=_,t[26]=i,t[27]=C,t[28]=F):F=t[28];let ne=F,re;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(re=e=>{let{startLine:t,endLine:n}=z(e),r={id:at(),kind:`draft`,startLine:t,endLine:n,text:``};v(e=>{let t=e.flatMap(Nm),i=t.findIndex(e=>e.lineNumber===n);return i<0?[...t,{lineNumber:n,metadata:{entries:[r]}}]:t.map((e,t)=>t===i?{...e,metadata:{entries:[...e.metadata.entries,r]}}:e)})},t[29]=re):re=t[29];let ie=re,ae;t[30]===_?ae=t[31]:(ae=_.some(jm),t[30]=_,t[31]=ae);let oe=ae,se,ce;t[32]!==oe||t[33]!==C?(se=()=>{let e=w.current;if(e)return dm({root:e,resolveEditor:()=>O.current,isBlocked:()=>oe,onDismiss:()=>C(null)})},ce=[oe,C],t[32]=oe,t[33]=C,t[34]=se,t[35]=ce):(se=t[34],ce=t[35]),(0,Y.useEffect)(se,ce);let le;t[36]===C?le=t[37]:(le=e=>{C(e),e&&ie(e)},t[36]=C,t[37]=le);let ue=le,de;t[38]!==f||t[39]!==x?(de=(e,t,n)=>{f(e,t,n),T.current!==null&&(cancelAnimationFrame(T.current),T.current=null),n!==`unmount`&&(T.current=requestAnimationFrame(()=>{T.current=null,e.isConnected&&t.setSelectedLines(x,{notify:!1})}))},t[38]=f,t[39]=x,t[40]=de):de=t[40];let fe=de,pe;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(pe={overscrollSize:600,intersectionObserverMargin:1200},t[41]=pe):pe=t[41];let I;t[42]!==s||t[43]!==r||t[44]!==i?(I=pm(r,i,s),t[42]=s,t[43]=r,t[44]=i,t[45]=I):I=t[45];let me;t[46]!==s||t[47]!==i||t[48]!==I?(me={name:i,contents:s,cacheKey:I},t[46]=s,t[47]=i,t[48]=I,t[49]=me):me=t[49];let he=!oe,ge=!oe,_e=d?`wrap`:`scroll`,ve;t[50]===c?ve=t[51]:(ve=Me(c),t[50]=c,t[51]=ve);let ye;t[52]!==ue||t[53]!==fe||t[54]!==c||t[55]!==C||t[56]!==he||t[57]!==ge||t[58]!==_e||t[59]!==ve?(ye={disableFileHeader:!0,enableGutterUtility:he,enableLineSelection:ge,onGutterUtilityClick:C,onLineSelectionChange:C,onLineSelectionEnd:ue,overflow:_e,theme:ve,themeType:c,unsafeCSS:xm,onPostRender:fe},t[52]=ue,t[53]=fe,t[54]=c,t[55]=C,t[56]=he,t[57]=ge,t[58]=_e,t[59]=ve,t[60]=ye):ye=t[60];let be;t[61]!==te||t[62]!==ne?(be=e=>(0,X.jsx)(`div`,{className:`py-1`,children:e.metadata.entries.map(e=>(0,X.jsx)(rt,{kind:e.kind,rangeLabel:B(e.startLine,e.endLine),text:e.text,onCancel:()=>te(e.id),onComment:t=>ne(e.id,t),onDelete:()=>te(e.id)},e.id))}),t[61]=te,t[62]=ne,t[63]=be):be=t[63];let Se;t[64]===k?Se=t[65]:(Se={onChange:k},t[64]=k,t[65]=Se);let Ce;return t[66]!==_||t[67]!==x||t[68]!==me||t[69]!==ye||t[70]!==be||t[71]!==Se?(Ce=(0,X.jsx)(xe,{createEditor:j,children:(0,X.jsx)(`div`,{ref:w,className:`flex min-h-0 flex-1`,children:(0,X.jsx)(Qe,{className:`file-preview-virtualizer min-h-0 flex-1 overflow-auto`,config:pe,children:(0,X.jsx)(ql,{file:me,options:ye,selectedLines:x,lineAnnotations:_,renderAnnotation:be,className:`min-h-full`,edit:!0,editorOptions:Se})})})}),t[66]=_,t[67]=x,t[68]=me,t[69]=ye,t[70]=be,t[71]=Se,t[72]=Ce):Ce=t[72],Ce}function jm(e){return e.metadata.entries.some(Mm)}function Mm(e){return e.kind===`draft`}function Nm(e){let t=e.metadata.entries.filter(Pm);return t.length>0?[{...e,metadata:{entries:t}}]:[]}function Pm(e){return e.kind!==`draft`}function Fm(e){return e.metadata.entries}function Im(e){return e.removeReviewComment}function Lm(e){return e.addReviewComment}function Rm(e){let t=(0,Yp.c)(17),{environmentId:n,cwd:r,relativePath:i,contents:a,threadRef:o,readOnly:s,onPendingChange:c}=e,l;t[0]!==r||t[1]!==n||t[2]!==c||t[3]!==i?(l={environmentId:n,cwd:r,relativePath:i,onPendingChange:c},t[0]=r,t[1]=n,t[2]=c,t[3]=i,t[4]=l):l=t[4];let u=km(l),d;t[5]!==a||t[6]!==r||t[7]!==n||t[8]!==s||t[9]!==i||t[10]!==u?(d=s?{}:{onTaskListChange:e=>{let{markerOffset:t,checked:o}=e,s=Ze(n,r,i)?.contents??a,c=gm(s,t,o);c!==s&&(Ne(n,r,i,c),u.change(c))}},t[5]=a,t[6]=r,t[7]=n,t[8]=s,t[9]=i,t[10]=u,t[11]=d):d=t[11];let f;return t[12]!==a||t[13]!==r||t[14]!==d||t[15]!==o?(f=(0,X.jsx)(ve,{className:`min-h-0 flex-1`,children:(0,X.jsx)(te,{text:a,cwd:r,threadRef:o,className:`mx-auto max-w-4xl px-6 py-5`,...d})}),t[12]=a,t[13]=r,t[14]=d,t[15]=o,t[16]=f):f=t[16],f}function zm(){try{return A(vm,x)??!0}catch(e){return console.error(e),!0}}function Bm(e){let t=(0,Yp.c)(103),{environmentId:n,cwd:r,projectName:i,workspaceRoot:o,relativePath:u,absolutePath:f,isOutsideWorkspace:b,threadRef:x,composerDraftTarget:S,keybindings:T,availableEditors:A,revealLine:M,revealRequestId:N,onOpenFile:P,onPendingChange:te}=e,{resolvedTheme:F}=d(),re=ue(Hm),ie=ee(),ae=k(n),oe;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(oe={reportFailure:!1},t[0]=oe):oe=t[0];let se=Re(ne.createUrl,oe),ce;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(ce={reportFailure:!1},t[1]=ce):ce=t[1];let le=j(c.open,ce),de=n===ie,fe;t[2]===u?fe=t[3]:(fe=u!==null&&w(u),t[2]=u,t[3]=fe);let pe=fe,I=Ke(n,r,u,!pe,f),[me,he]=(0,Y.useState)(zm),[ge,_e]=(0,Y.useState)(!1),ye;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(ye={path:null,revealRequestId:null},t[4]=ye):ye=t[4];let[be,xe]=(0,Y.useState)(ye),Se=(0,Y.useRef)(null),Ce;t[5]===u?Ce=t[6]:(Ce=u?hm(u):!1,t[5]=u,t[6]=Ce);let L=Ce,we=L&&be.path===u&&(M===null||be.revealRequestId===N),Te;t[7]===u?Te=t[8]:(Te=u!==null&&l()&&Fe(u),t[7]=u,t[8]=Te);let Ee=Te,ke;t[9]!==r||t[10]!==f||t[11]!==u?(ke=f??(u?_(u,r):null),t[9]=r,t[10]=f,t[11]=u,t[12]=ke):ke=t[12];let R=ke,Ae;t[13]!==R||t[14]!==de||t[15]!==x.threadId||t[16]!==o?(Ae=R===null?null:C({filePath:R,threadId:x.threadId,workspaceRoot:o,allowLocalFiles:de}),t[13]=R,t[14]=de,t[15]=x.threadId,t[16]=o,t[17]=Ae):Ae=t[17];let je=Ae,Ne;t[18]!==r||t[19]!==b||t[20]!==i||t[21]!==u?(Ne=u?mm(b?r:i,u):[],t[18]=r,t[19]=b,t[20]=i,t[21]=u,t[22]=Ne):Ne=t[22];let Ie=Ne,Le=Tm(u,M,N),ze;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(ze=()=>{(Se.current?.querySelector(`[data-current-file-crumb='true']`))?.scrollIntoView({block:`nearest`,inline:`end`})},t[23]=ze):ze=t[23];let Be;t[24]===u?Be=t[25]:(Be=[u],t[24]=u,t[25]=Be),(0,Y.useEffect)(ze,Be);let Ve;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(Ve=()=>{he(Vm)},t[26]=Ve):Ve=t[26];let Ue=Ve,Ge;t[27]!==R||t[28]!==de||t[29]!==se||t[30]!==ae||t[31]!==le||t[32]!==F||t[33]!==x||t[34]!==o?(Ge=()=>{!R||!ae||(async()=>{let e=await Xe({threadRef:x,filePath:R,httpBaseUrl:ae,workspaceRoot:o,allowLocalFiles:de,theme:F,createAssetUrl:se,openPreview:le});if(e._tag===`Success`||E(e))return;let t=p(e);m.add(h({type:`error`,title:`Unable to open file in browser`,description:t instanceof Error?t.message:`An error occurred.`}))})()},t[27]=R,t[28]=de,t[29]=se,t[30]=ae,t[31]=le,t[32]=F,t[33]=x,t[34]=o,t[35]=Ge):Ge=t[35];let qe=Ge,Ze;t[36]!==R||t[37]!==de||t[38]!==A||t[39]!==S||t[40]!==r||t[41]!==n||t[42]!==I||t[43]!==je||t[44]!==pe||t[45]!==L||t[46]!==b||t[47]!==T||t[48]!==Le||t[49]!==te||t[50]!==u||t[51]!==we||t[52]!==F||t[53]!==N||t[54]!==x||t[55]!==re?(Ze=u&&pe&&je?(0,X.jsx)(Sm,{environmentId:n,resource:je,alt:u},R??u):u&&I.error&&I.data===null?(0,X.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center px-6 text-center text-xs leading-relaxed text-destructive`,children:I.error}):u&&I.data===null?(0,X.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center text-muted-foreground`,children:(0,X.jsx)(y,{className:`size-5 animate-spin`})}):u&&I.data?I.data.binary&&R?(0,X.jsx)(om,{environmentId:n,keybindings:T,availableEditors:A,absolutePath:R,name:u.slice(u.lastIndexOf(`/`)+1),byteLength:I.data.byteLength,canRevealInFileManager:de&&s()}):L&&we?(0,X.jsx)(Rm,{environmentId:n,cwd:r,relativePath:u,threadRef:x,contents:I.data.contents,readOnly:b,onPendingChange:te}):I.data.truncated||b?(0,X.jsx)(Qe,{className:`file-preview-virtualizer min-h-0 flex-1 overflow-auto`,config:{overscrollSize:600,intersectionObserverMargin:1200},children:(0,X.jsx)(ql,{file:{name:u,contents:I.data.contents,cacheKey:pm(r,u,I.data.contents)},options:{disableFileHeader:!0,overflow:re?`wrap`:`scroll`,theme:Me(F),themeType:F,unsafeCSS:xm,onPostRender:Le},className:`min-h-full`})},`${u}:${F}:${I.data.byteLength}`):(0,X.jsx)(Am,{environmentId:n,cwd:r,relativePath:u,composerDraftTarget:S,contents:I.data.contents,resolvedTheme:F,revealRequestId:N,wordWrap:re,onPostRender:Le,onPendingChange:te},`${u}:${F}`):null,t[36]=R,t[37]=de,t[38]=A,t[39]=S,t[40]=r,t[41]=n,t[42]=I,t[43]=je,t[44]=pe,t[45]=L,t[46]=b,t[47]=T,t[48]=Le,t[49]=te,t[50]=u,t[51]=we,t[52]=F,t[53]=N,t[54]=x,t[55]=re,t[56]=Ze):Ze=t[56];let $e=Ze,et;t[57]!==R||t[58]!==A||t[59]!==Ie||t[60]!==Ee||t[61]!==n||t[62]!==ge||t[63]!==me||t[64]!==qe||t[65]!==L||t[66]!==T||t[67]!==ie||t[68]!==i||t[69]!==u||t[70]!==we||t[71]!==N?(et=u?(0,X.jsxs)(`div`,{className:`surface-subheader gap-2 px-3`,"data-surface-subheader":!0,children:[(0,X.jsx)(ve,{ref:Se,hideScrollbars:!0,scrollFade:!0,className:`min-w-0 flex-1 rounded-none`,"data-file-breadcrumbs":!0,children:(0,X.jsx)(`div`,{className:`flex h-full w-max min-w-full items-center text-xs`,children:Ie.map((e,t)=>(0,X.jsxs)(`div`,{className:`flex min-w-0 shrink-0 items-center`,"data-current-file-crumb":e.kind===`file`,children:[t>0?(0,X.jsx)(D,{className:`mx-1 size-3.5 shrink-0 text-muted-foreground/60`}):null,(0,X.jsx)(`span`,{className:a(`max-w-40 truncate`,e.kind===`file`?`font-medium text-foreground`:`text-muted-foreground`),title:e.path||i,children:e.label})]},e.path||`project`))})}),R&&n===ie?(0,X.jsx)(He,{environmentId:n,keybindings:T,availableEditors:A,openInCwd:R,compact:!0,enableShortcut:!1}):null,L?(0,X.jsxs)(v,{children:[(0,X.jsx)(O,{render:(0,X.jsx)(Oe,{className:`shrink-0`,pressed:we,onPressedChange:e=>{xe({path:e?u:null,revealRequestId:e?N:null})},"aria-label":we?`Show markdown source`:`Show rendered markdown`,variant:`ghost`,size:`sm`,children:we?(0,X.jsx)(Ye,{className:`size-3.5`}):(0,X.jsx)(Pe,{className:`size-3.5`})})}),(0,X.jsx)(g,{children:we?`Show markdown source`:`Show rendered markdown`})]}):null,Ee?(0,X.jsxs)(v,{children:[(0,X.jsx)(O,{render:(0,X.jsx)(Oe,{className:`shrink-0`,pressed:!1,onPressedChange:qe,"aria-label":`Open file in preview browser`,variant:`ghost`,size:`sm`,children:(0,X.jsx)(We,{className:`size-3.5`})})}),(0,X.jsx)(g,{children:`Open file in preview browser`})]}):null,(0,X.jsxs)(v,{children:[(0,X.jsx)(O,{render:(0,X.jsx)(Oe,{className:`shrink-0`,pressed:ge,onPressedChange:_e,"aria-label":ge?`Collapse file preview`:`Expand file preview`,variant:`ghost`,size:`sm`,children:ge?(0,X.jsx)(Je,{className:`size-3.5`}):(0,X.jsx)(De,{className:`size-3.5`})})}),(0,X.jsx)(g,{children:ge?`Collapse file preview`:`Expand file preview`})]}),(0,X.jsxs)(v,{children:[(0,X.jsx)(O,{render:(0,X.jsx)(Oe,{className:`shrink-0`,pressed:me,onPressedChange:Ue,"aria-label":me?`Hide file explorer`:`Show file explorer`,variant:`ghost`,size:`sm`,children:(0,X.jsx)(st,{className:`size-3.5`})})}),(0,X.jsx)(g,{children:me?`Hide file explorer`:`Show file explorer`})]})]}):null,t[57]=R,t[58]=A,t[59]=Ie,t[60]=Ee,t[61]=n,t[62]=ge,t[63]=me,t[64]=qe,t[65]=L,t[66]=T,t[67]=ie,t[68]=i,t[69]=u,t[70]=we,t[71]=N,t[72]=et):et=t[72];let tt;t[73]!==I||t[74]!==u?(tt=u&&I.data?.truncated?(0,X.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 `,I.data.byteLength.toLocaleString(),` byte file.`]}):null,t[73]=I,t[74]=u,t[75]=tt):tt=t[75];let nt=u?`flex`:`hidden`,rt;t[76]===nt?rt=t[77]:(rt=a(`min-w-0 flex-1 flex-col overflow-hidden`,nt),t[76]=nt,t[77]=rt);let it;t[78]!==ge||t[79]!==$e?(it=ge?(0,X.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center px-6 text-center text-xs text-muted-foreground`,children:`Shown in the expanded view.`}):$e,t[78]=ge,t[79]=$e,t[80]=it):it=t[80];let at;t[81]!==rt||t[82]!==it?(at=(0,X.jsx)(`div`,{className:rt,children:it}),t[81]=rt,t[82]=it,t[83]=at):at=t[83];let z;t[84]!==r||t[85]!==n||t[86]!==me||t[87]!==P||t[88]!==i||t[89]!==u?(z=me||u===null?(0,X.jsx)(`aside`,{className:a(`flex min-h-0 shrink-0 bg-background`,u?`w-[min(22rem,46%)] min-w-64 border-l border-border/60`:`min-w-0 flex-1`),children:(0,X.jsx)(em,{environmentId:n,cwd:r,projectName:i,onOpenFile:P},`${n}:${r}`)}):null,t[84]=r,t[85]=n,t[86]=me,t[87]=P,t[88]=i,t[89]=u,t[90]=z):z=t[90];let B;t[91]!==at||t[92]!==z?(B=(0,X.jsxs)(`div`,{className:`flex min-h-0 flex-1 overflow-hidden`,children:[at,z]}),t[91]=at,t[92]=z,t[93]=B):B=t[93];let ot=ge&&u!==null,ct=u??``,lt;t[94]!==$e||t[95]!==ot||t[96]!==ct?(lt=(0,X.jsx)(tm,{open:ot,title:ct,onOpenChange:_e,children:$e}),t[94]=$e,t[95]=ot,t[96]=ct,t[97]=lt):lt=t[97];let ut;return t[98]!==et||t[99]!==tt||t[100]!==B||t[101]!==lt?(ut=(0,X.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden bg-background`,children:[et,tt,B,lt]}),t[98]=et,t[99]=tt,t[100]=B,t[101]=lt,t[102]=ut):ut=t[102],ut}function Vm(e){let t=!e;try{f(vm,t,x)}catch(e){console.error(e)}return t}function Hm(e){return e.wordWrap}export{Bm as default};
|
|
2230
|
+
//# sourceMappingURL=FilePreviewPanel-B-Nmz0HL.js.map
|