@fungi.computer/inkcap 0.2.2 → 0.2.3

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.
@@ -0,0 +1,1267 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./FileTab-fuWnqfb6.js","./rolldown-runtime-hePW80VL.js","./dialog-jssrzu-h.js","./useForm-JWOEk10W.js","./InkcapFileTree-D95QfJxq.js"])))=>i.map(i=>d[i]);
2
+ import{r as e,t}from"./rolldown-runtime-hePW80VL.js";import{$i as n,$r as r,$t as i,Bn as a,Br as o,Cr as s,Fi as c,Gi as l,Gr as u,Hn as d,Hr as f,Ii as p,In as m,Ir as h,Ji as g,Ki as _,Kr as v,Ln as y,Lr as b,Nn as x,Qi as S,Qr as C,Rn as ee,Rr as te,Sr as ne,Ui as w,Ur as T,Vn as E,Wi as re,Wr as D,Xi as O,Xr as k,Yi as ie,Yr as A,Zi as ae,_i as oe,_r as se,a as ce,ai as le,ar as ue,bi as de,br as fe,c as pe,ci as me,cr as j,di as he,dr as ge,ei as _e,en as ve,fi as ye,fr as M,gi as be,gr as xe,hi as N,hr as P,i as Se,ii as Ce,ir as we,jn as Te,li as Ee,lr as F,mi as De,mr as I,n as Oe,o as ke,oi as Ae,or as je,pi as Me,pr as L,qi as Ne,qr as Pe,r as Fe,ri as R,rr as Ie,s as Le,si as Re,sr as ze,t as Be,ti as Ve,tn as He,tr as Ue,ui as We,ur as Ge,vi as Ke,vr as z,xr as qe,yi as Je,yr as B,zn as Ye,zr as Xe}from"./dialog-jssrzu-h.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var Ze=new WeakMap,Qe=`~effect/Redacted`,$e=e=>g(e,Qe),et=(e,t)=>{let n=Object.create(tt);return t?.label&&(n.label=t.label),Ze.set(n,e),n},tt={[Qe]:{_A:e=>e},label:void 0,...w,toJSON(){return this.toString()},toString(){return`<redacted${ae(this.label)?`:`+this.label:``}>`},[Ne](){return _(Ze.get(this))},[l](e){return $e(e)&&re(Ze.get(this),Ze.get(e))}},V=e(te(),1),H=b(),U=V.createContext(void 0),W=e=>{let t=V.useContext(U);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},nt=({client:e,children:t})=>(V.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,H.jsx)(U.Provider,{value:e,children:t})),rt={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},it=new class{#e=rt;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function at(e){setTimeout(e,0)}var ot=typeof window>`u`||`Deno`in globalThis;function st(){}function ct(e,t){return typeof e==`function`?e(t):e}function lt(e){return typeof e==`number`&&e>=0&&e!==1/0}function ut(e,t){return Math.max(e+(t||0)-Date.now(),0)}function G(e,t){return typeof e==`function`?e(t):e}function dt(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==pt(o,t.options))return!1}else if(!ht(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function ft(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(mt(t.options.mutationKey)!==mt(a))return!1}else if(!ht(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function pt(e,t){return(t?.queryKeyHashFn||mt)(e)}function mt(e){return JSON.stringify(e,(e,t)=>bt(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function ht(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){for(let n=0;n<t.length;n++)if(!ht(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!ht(e[r],t[r]))return!1;return!0}return!1}var gt=Object.prototype.hasOwnProperty;function _t(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=yt(e)&&yt(t);if(!r&&!(bt(e)&&bt(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:gt.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=_t(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function vt(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function yt(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function bt(e){if(!xt(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!xt(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function xt(e){return Object.prototype.toString.call(e)===`[object Object]`}function St(e){return new Promise(t=>{it.setTimeout(t,e)})}function Ct(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:_t(e,t)}function wt(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function Tt(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Et=Symbol();function Dt(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Et?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Ot(e,t){return typeof e==`function`?e(...t):!!e}function kt(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var At=()=>ot,jt=()=>At(),Mt=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Nt=new class extends Mt{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},Pt=at;function Ft(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=Pt,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var It=Ft(),Lt=new class extends Mt{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function Rt(e){return Math.min(1e3*2**e,3e4)}function zt(e){return(e??`online`)!==`online`||Lt.isOnline()}var Bt=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function Vt(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(st);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new Bt(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>Nt.isFocused()&&(e.networkMode===`always`||Lt.isOnline())&&e.canRun(),p=()=>zt(e.networkMode)&&e.canRun(),m=e=>{c()||(r?.(),i=`resolved`,a(e))},h=e=>{c()||(r?.(),i=`rejected`,o(e))},g=()=>new Promise(t=>{r=e=>{(c()||f())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,c()||e.onContinue?.()}),_=()=>{if(c())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(m).catch(r=>{if(c())return;let i=e.retry??(jt()?0:3),a=e.retryDelay??Rt,o=typeof a==`function`?a(n,r):a,s=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!s){h(r);return}n++,e.onFail?.(n,r),St(o).then(()=>f()?void 0:g()).then(()=>{t?h(r):_()})})};return{promise:s,status:()=>i,cancel:l,continue:()=>(r?.(),s),cancelRetry:u,continueRetry:d,canStart:p,start:()=>(p()?_():g().then(_),s)}}var Ht=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),lt(this.gcTime)&&(this.#e=it.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(jt()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(it.clearTimeout(this.#e),this.#e=void 0)}};function Ut(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{kt(e,()=>t.signal,()=>n=!0)},u=Dt(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?Tt:wt;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?Gt:Wt,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:Wt(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.fetchFn=t.options.persister?()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function Wt(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Gt(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var Kt=class extends Ht{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=Yt(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Yt(this.options);e.data!==void 0&&(this.setState(Jt(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=Ct(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#c({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(st).catch(st):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>G(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Et||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>G(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!ut(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){let t=this.observers.indexOf(e);t!==-1&&(this.observers.splice(t,1),this.observers.length||(this.#a&&(this.#s||this.state.fetchStatus===`paused`&&this.state.status===`pending`?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=Dt(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?Ut(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta});let o=this.#a=Vt({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof Bt&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await o.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof Bt){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.#a===o&&(this.#a=void 0),this.scheduleGc()}}#c(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...qt(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...Jt(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),It.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function qt(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:zt(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function Jt(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Yt(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var Xt=class extends Mt{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Qt(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return $t(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return $t(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof G(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!vt(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&en(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||G(this.options.enabled,this.#t)!==G(t.enabled,this.#t)||G(this.options.staleTime,this.#t)!==G(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||G(this.options.enabled,this.#t)!==G(t.enabled,this.#t)||i!==this.#f)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return vt(this.getCurrentResult(),n)||(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),Reflect.get(e,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch().then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(st)),t}#h(e){return!jt()&&G(this.options.enabled,this.#t)!==!1&&lt(e)}#g(){this.#b();let e=G(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=ut(this.#r.dataUpdatedAt,e)+1;this.#u=it.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#f=e,!(this.#f===0||!this.#h(this.#f))&&(this.#d=it.setInterval(()=>{(this.options.refetchIntervalInBackground||Nt.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(it.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(it.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&Qt(e,t),o=i&&en(e,n,t,r);(a||o)&&(l={...l,...qt(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(m=`success`,d=Ct(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h){if(i&&d===a?.data&&t.select===this.#s)d=this.#c;else try{this.#s=t.select,d=t.select(d),d=Ct(i?.data,d,t),this.#c=d,this.#o=null}catch(e){this.#o=e}}else d===void 0&&(this.#o=null);this.#o&&(f=this.#o,d=this.#c,p=Date.now(),m=`error`,u=!1);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0;return{status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:tn(e,t),refetch:this.refetch,isEnabled:G(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#l=this.#t),vt(t,e))return;this.#r=t;let n=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size)return!0;let r=new Set(n??this.#p);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})();It.batch(()=>{n&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}};function Zt(e,t){return G(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||G(t.retryOnMount,e)!==!1)}function Qt(e,t){return Zt(e,t)||e.state.data!==void 0&&$t(e,t,t.refetchOnMount)}function $t(e,t,n){if(G(t.enabled,e)!==!1&&G(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&tn(e,t)}return!1}function en(e,t,n,r){return(e!==t||G(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&tn(e,n)}function tn(e,t){return G(t.enabled,e)!==!1&&e.isStaleByTime(G(t.staleTime,e))}var nn=class extends Ht{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||rn(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??(this.state.status===`pending`?this.execute(this.state.variables):Promise.resolve())}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},r=this.#r=Vt({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),i=this.state.status===`pending`,a=!r.canStart();try{if(i)t();else{this.#i({type:`pending`,variables:e,isPaused:a}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:a})}let o=await r.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#i({type:`success`,data:o}),o}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#r===r&&(this.#r=void 0),this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),It.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function rn(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var an=class extends Mt{#e;#t;#n;constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}build(e,t,n){let r=new nn({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=on(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=on(e);if(typeof t==`string`){let n=this.#t.get(t);if(n){if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=on(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=on(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){It.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>ft(t,e))}findAll(e={}){return this.getAll().filter(t=>ft(e,t))}notify(e){It.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return It.batch(()=>Promise.all(e.map(e=>e.continue().catch(st))))}};function on(e){return e.options.scope?.id}var sn=class extends Mt{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??pt(r,t),a=this.get(i);return a||(a=new Kt({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){It.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>dt(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>dt(e,t)):t}notify(e){It.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){It.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){It.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},cn=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new sn,this.#t=e.mutationCache||new an,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=Nt.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Lt.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(G(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=ct(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return It.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;It.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return It.batch(()=>{let r=n.findAll(e),i=new Set(r);return r.forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,predicate:e=>i.has(e)},t)})}cancelQueries(e,t={}){let n={revert:!0,...t},r=It.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(st).catch(st)}invalidateQueries(e,t={}){return It.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=It.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(st)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(st)}async query(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t),r=n.isStaleByTime(G(t.staleTime,n))?await n.fetch(t):n.state.data,i=t.select;return i?i(r):r}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(G(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(st).catch(st)}infiniteQuery(e){return e._type=`infinite`,this.query(e)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(st).catch(st)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return Lt.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(mt(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{ht(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(mt(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{ht(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=pt(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===Et&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},ln=V.createContext(!1),un=()=>V.useContext(ln);ln.Provider;function dn(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var fn=V.createContext(dn()),pn=()=>V.useContext(fn),mn=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?Ot(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},hn=e=>{V.useEffect(()=>{e.clearReset()},[e])},gn=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||Ot(n,[e.error,r])),_n=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},vn=(e,t)=>e?.suspense&&t.isPending,yn=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function bn(e,t,n){let r=un(),i=pn(),a=W(n),o=a.defaultQueryOptions(e),s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,_n(o),mn(o,i,s),hn(i);let[l]=V.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&c;if(V.useSyncExternalStore(V.useCallback(e=>{let t=d?l.subscribe(It.batchCalls(e)):st;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),V.useEffect(()=>{l.setOptions(o)},[o,l]),vn(o,u))throw yn(o,l,i);if(gn({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return o.notifyOnChangeProps?u:l.trackResult(u)}function xn(e,t){return bn(e,Xt,t)}function Sn(e){return e}var Cn=class extends Error{code;details;constructor(e,t,n){super(t),this.code=e,this.details=n,this.name=`WhistleActionError`}},wn=class extends Error{constructor(){super(`Whistle runtime is closed`),this.name=`WhistleClosedError`}};function Tn(){let e=!1,t=rr,n=[],r=[],i=!1,a=[],o=new Set,s=()=>{for(let e of o)e()};return Object.freeze({close:()=>{e||(e=!0,n=[],a=[],r=[],t=rr,s(),o.clear())},contribute:t=>{if(Nn(t),e)throw new wn;Pn(t,n),Fn(t,n);let r=Symbol(`whistle-contribution`);Mn(t)||(n=[...n,{contribution:In(t),generation:r}],i=!0,s());let a=!0;return tr(o=>{if(!a||e)return;let c={...t,commands:o};Nn(c);let l=n.findIndex(e=>e.generation===r),u=n.filter(e=>e.generation!==r);Pn(c,u),Fn(c,u);let d=In(c);if(Mn(c)){if(l<0)return;n=u}else n=l<0?[...n,{contribution:d,generation:r}]:n.map(e=>e.generation===r?{contribution:d,generation:r}:e);i=!0,s()},()=>{a&&(a=!1,n.find(e=>e.generation===r)!==void 0&&(n=n.filter(e=>e.generation!==r),i=!0,s()))})},execute:async(t,r)=>{if(t.trim().length===0)return{status:`invalid`};if(e)return{status:`closed`};let i=jn(t,n);if(i===void 0)return{status:`missing`};let o;try{let e=ar(i);if(e.status===`unavailable`)return e;let n=a.at(-1)?.presenter;r.interaction===void 0&&n!==void 0&&En.has(r.origin)&&(o=n({commandId:t,title:i.title}));let s={...r,signal:r.signal??new AbortController().signal};o!==void 0&&(s.interaction=o.interaction,s.signal=AbortSignal.any([s.signal,o.interaction.signal]));let c=await i.handler(s);return o?.settle({status:`handled`}),c===void 0?{status:`handled`}:{status:`handled`,result:c}}catch(e){let t=sr(e instanceof Error?e:Error(`Command handler threw a non-Error value`));return o?.settle(o.interaction.signal.aborted?{status:`cancelled`}:{status:`failed`,message:t.message}),{status:`failed`,error:t}}},present:t=>{let n={presenter:t};return e||(a=[...a,n]),()=>{a=a.filter(e=>e!==n)}},snapshot:()=>{if(e)return rr;let a=n.flatMap(e=>e.contribution.commands.map(ar));return(i||a.some((e,t)=>!or(e,r[t])))&&(t=cr(n,a),r=a,i=!1),t},subscribe:t=>e?()=>void 0:(o.add(t),()=>{o.delete(t)})})}var En=new Set([`browser`,`keyboard`,`menu`,`palette`,`slash`,`terminal`]),Dn=16,On=32,kn=64,An=256;function jn(e,t){for(let n of t)for(let t of n.contribution.commands)if(`${n.contribution.namespace}:${t.id}`===e)return t}function Mn(e){return e.commands.length===0}function Nn(e){$n(e.sourceId,`source ID`),$n(e.namespace,`namespace`,!0),e.scope!==void 0&&$n(e.scope,`scope`);for(let t of e.commands)Jn(t)}function Pn(e,t){t.find(t=>t.contribution.namespace===e.namespace&&t.contribution.sourceId!==e.sourceId)!==void 0&&nr(`Namespace is already owned by another source`);let n=new Set,r=new Set;for(let i of t){let t=i.contribution.scope===e.scope;for(let e of i.contribution.commands)if(n.add(`${i.contribution.namespace}:${e.id}`),t)for(let t of e.projections?.slash?.aliases??[])r.add(t)}for(let t of e.commands){let i=`${e.namespace}:${t.id}`;n.has(i)&&nr(`Canonical command ID is already registered`),n.add(i);for(let e of t.projections?.slash?.aliases??[])r.has(e)&&nr(`Slash alias is already registered`),r.add(e)}}function Fn(e,t){t.length>=kn&&nr(`Live contribution capacity exceeded`),t.reduce((e,t)=>e+t.contribution.commands.length,0)+e.commands.length>An&&nr(`Live command capacity exceeded`)}function In(e){let t={sourceId:e.sourceId,namespace:e.namespace,commands:e.commands.map(Ln)};return e.scope===void 0?t:{...t,scope:e.scope}}function Ln(e){let t={id:e.id,title:e.title,category:e.category,handler:e.handler};return e.description!==void 0&&(t.description=e.description),e.action!==void 0&&(t.action=Rn(e.action)),e.availability!==void 0&&(t.availability=e.availability),e.projections!==void 0&&(t.projections=Hn(e.projections)),t}function Rn(e){let t={};return e.inputSchema!==void 0&&(t.inputSchema=zn(e.inputSchema)),e.outputSchema!==void 0&&(t.outputSchema=zn(e.outputSchema)),e.presentation!==void 0&&(t.presentation=Vn(e.presentation)),Object.freeze(t)}function zn(e){return Object.freeze(Object.fromEntries(Object.entries(e).map(([e,t])=>[e,Bn(t)])))}function Bn(e){return Array.isArray(e)?Object.freeze(e.map(Bn)):e!==null&&e instanceof Object?Object.freeze(Object.fromEntries(Object.entries(e).map(([e,t])=>[e,Bn(t)]))):e}function Vn(e){switch(e.type){case`action`:return Object.freeze({type:`action`});case`custom`:return Object.freeze({type:`custom`,data:zn(e.data)});case`choice`:return Object.freeze({type:`choice`,options:Object.freeze(e.options.map(e=>Object.freeze({...e,value:Bn(e.value)})))});case`form`:return Object.freeze({...e});case`confirmation`:return Object.freeze({...e})}}function Hn(e){let t={};return e.bindings!==void 0&&(t.bindings=Un(e.bindings)),e.agent!==void 0&&(t.agent=Wn(e.agent)),e.help!==void 0&&(t.help=Gn(e.help.order)),e.menu!==void 0&&(t.menu=Gn(e.menu.order)),e.palette!==void 0&&(t.palette=Gn(e.palette.order)),e.slash!==void 0&&(t.slash=Kn(e.slash)),t}function Un(e){let t={values:[...e.values]};return e.order!==void 0&&(t.order=e.order),t}function Wn(e){let t={};return e.keybind!==void 0&&(t.keybind=e.keybind),e.order!==void 0&&(t.order=e.order),t}function Gn(e){let t={};return e!==void 0&&(t.order=e),t}function Kn(e){let t={aliases:[...e.aliases]};return e.order!==void 0&&(t.order=e.order),e.consumesDraft!==void 0&&(t.consumesDraft=e.consumesDraft),e.arguments!==void 0&&(t.arguments=qn(e.arguments)),t}function qn(e){let t={hint:e.hint};return e.words!==void 0&&(t.words=Object.freeze(e.words.map(e=>Object.freeze({...e,arguments:zn(e.arguments)})))),e.text!==void 0&&(t.text=Object.freeze({...e.text,arguments:zn(e.text.arguments)})),Object.freeze(t)}function Jn(e){$n(e.id,`command ID`,!0),$n(e.title,`title`),$n(e.category,`category`),Yn(e.action),Xn(e.projections)}function Yn(e){if(e?.presentation!==void 0)switch(e.presentation.type){case`action`:case`custom`:return;case`choice`:for(let t of e.presentation.options)$n(t.label,`choice label`),t.description!==void 0&&$n(t.description,`choice description`);return;case`form`:e.presentation.submitLabel!==void 0&&$n(e.presentation.submitLabel,`submit label`);return;case`confirmation`:$n(e.presentation.message,`confirmation message`),e.presentation.confirmLabel!==void 0&&$n(e.presentation.confirmLabel,`confirmation label`),e.presentation.cancelLabel!==void 0&&$n(e.presentation.cancelLabel,`cancellation label`)}}function Xn(e){if(e!==void 0){for(let t of[e.bindings,e.palette,e.slash,e.help,e.menu,e.agent])t!==void 0&&er(t.order);if(e.bindings!==void 0&&Qn(e.bindings.values,`binding`),e.slash!==void 0){Qn(e.slash.aliases,`slash alias`);for(let t of e.slash.aliases)/\s/u.test(t)&&nr(`slash alias must not contain whitespace`);Zn(e.slash.arguments)}e.agent?.keybind!==void 0&&$n(e.agent.keybind,`agent keybind`)}}function Zn(e){if(e===void 0)return;$n(e.hint,`argument hint`),e.words===void 0&&e.text===void 0&&nr(`slash arguments need words or text`);let t=new Set;for(let n of e.words??[])$n(n.word,`argument word`),/\s/u.test(n.word)&&nr(`argument word must not contain whitespace`),t.has(n.word)&&nr(`argument word is repeated`),t.add(n.word),n.description!==void 0&&$n(n.description,`argument word description`);t.size>On&&nr(`argument word count exceeds 32`),e.text!==void 0&&($n(e.text.field,`argument text field`),e.text.requestIdField!==void 0&&$n(e.text.requestIdField,`request id field`))}function Qn(e,t){e.length>Dn&&nr(`${t} count exceeds 16`);for(let n of e)$n(n,t)}function $n(e,t,n=!1){e.trim().length===0&&nr(`${t} must not be blank`),n&&e.includes(`:`)&&nr(`${t} must not contain a colon`)}function er(e){e!==void 0&&!Number.isSafeInteger(e)&&nr(`order must be a safe integer`)}function tr(e=()=>void 0,t=()=>void 0){return Object.freeze({update:e,dispose:t})}function nr(e){throw Error(e)}var rr=Object.freeze({bindings:Object.freeze([]),palette:Object.freeze([]),slash:Object.freeze([]),help:Object.freeze([]),menu:Object.freeze([]),agent:Object.freeze([])}),ir=Object.freeze({status:`available`});function ar(e){let t=e.availability?.()??ir;return t.status===`available`?ir:Object.freeze({status:`unavailable`,reason:t.reason})}function or(e,t){return e.status===`available`?t?.status===`available`:t?.status===`unavailable`&&e.reason===t.reason}function sr(e){if(e instanceof Cn){let t={code:e.code,message:e.message};return Object.freeze(e.details===void 0?t:{...t,details:Bn(e.details)})}return Object.freeze({code:`command_failed`,message:e.message})}function cr(e,t){let n=[],r=[],i=[],a=[],o=[],s=[],c=0;for(let l of e){let e=l.contribution;for(let l of e.commands){let u=l.projections,d=t[c++]??ir;if(u?.bindings!==void 0)for(let t of u.bindings.values)n.push({...hr(e,l,u.bindings.order,d),binding:t});if(u?.palette!==void 0&&r.push({...hr(e,l,u.palette.order,d)}),u?.slash!==void 0)for(let t of u.slash.aliases){let n={...hr(e,l,u.slash.order,d),alias:t};u.slash.consumesDraft!==void 0&&(n={...n,consumesDraft:u.slash.consumesDraft}),u.slash.arguments!==void 0&&(n={...n,arguments:u.slash.arguments}),i.push(n)}u?.help!==void 0&&a.push({...hr(e,l,u.help.order,d)}),u?.menu!==void 0&&o.push({...hr(e,l,u.menu.order,d)}),u?.agent!==void 0&&s.push(_r(e,l,u.agent,d))}}return fr(n),pr(i),dr(r),dr(a),dr(o),dr(s),Object.freeze({bindings:mr(n),palette:mr(r),slash:mr(i),help:mr(a),menu:mr(o),agent:mr(s)})}var lr=new TextEncoder;function ur(e,t){let n=lr.encode(e),r=lr.encode(t),i=Math.min(n.length,r.length);for(let e=0;e<i;e+=1){let t=n[e]??0,i=r[e]??0;if(t!==i)return t<i?-1:1}return n.length<r.length?-1:+(n.length>r.length)}function dr(e){e.sort((e,t)=>e.order-t.order||ur(e.commandId,t.commandId))}function fr(e){e.sort((e,t)=>e.order-t.order||ur(e.commandId,t.commandId)||ur(e.binding,t.binding))}function pr(e){e.sort((e,t)=>e.order-t.order||ur(e.commandId,t.commandId)||ur(e.alias,t.alias))}function mr(e){return Object.freeze(e.map(e=>Object.freeze(e)))}function hr(e,t,n,r){let i=gr(e,t,n,r);return e.scope===void 0?i:{...i,scope:e.scope}}function gr(e,t,n,r){let i={commandId:`${e.namespace}:${t.id}`,sourceId:e.sourceId,title:t.title,category:t.category,order:n??0,availability:r},a=t.description===void 0?i:{...i,description:t.description};return t.action===void 0?a:{...a,action:t.action}}function _r(e,t,n,r){let i=hr(e,t,n.order,r),a=i.action===void 0?i:{...i,action:vr(i.action)};return n.keybind===void 0?a:{...a,keybind:n.keybind}}function vr(e){let t={};return e.inputSchema!==void 0&&(t.inputSchema=e.inputSchema),e.outputSchema!==void 0&&(t.outputSchema=e.outputSchema),Object.freeze(t)}var yr=ge(),br=M(()=>Ge(`status`,[P({status:L(`available`)}).strict(),P({status:L(`unavailable`),reason:B()}).strict()])),xr=yr,Sr=M(()=>se(B(),xr)),Cr=e=>xr.parse(e),wr=M(()=>P({code:B().min(1).max(160),message:B().min(1).max(512),details:xr.optional()}).strict()),Tr=e=>wr.parse(e),Er=Sr,Dr=M(()=>B().refine(e=>e.trim().length>0)),Or=br,kr=M(()=>fe([P({type:L(`action`)}).strict(),P({type:L(`custom`),data:Sr}).strict(),P({type:L(`choice`),options:ze(P({value:xr,label:Dr,description:Dr.optional()}))}).strict(),P({type:L(`form`),submitLabel:Dr.optional()}).strict(),P({type:L(`confirmation`),message:Dr,confirmLabel:Dr.optional(),cancelLabel:Dr.optional()}).strict()])),Ar=M(()=>P({inputSchema:Er.optional(),outputSchema:Er.optional(),presentation:kr.optional()}).strict()),jr=M(()=>I().int().refine(e=>Number.isSafeInteger(e))),Mr=M(()=>P({hint:Dr.pipe(B().max(120)),words:ze(P({word:B().regex(/^\S{1,64}$/u),description:Dr.pipe(B().max(512)).optional(),arguments:Sr}).strict()).max(32).optional(),text:P({field:Dr.pipe(B().max(120)),arguments:Sr,requestIdField:Dr.pipe(B().max(120)).optional()}).strict().optional()}).strict().refine(e=>e.words!==void 0||e.text!==void 0,`slash arguments need words or text`)),Nr=M(()=>P({order:jr.optional()}).strict()),Pr=M(()=>P({bindings:P({order:jr.optional(),values:ze(Dr).max(16)}).strict().optional(),agent:P({keybind:Dr.optional(),order:jr.optional()}).strict().optional(),help:Nr.optional(),menu:Nr.optional(),palette:Nr.optional(),slash:P({aliases:ze(Dr).max(16),consumesDraft:j().optional(),order:jr.optional(),arguments:Mr.optional()}).strict().optional()}).strict()),Fr=M(()=>P({id:Dr.refine(e=>!e.includes(`:`)),title:Dr,category:Dr,description:Dr.optional(),projections:Pr.optional(),action:Ar.optional(),availability:Or.optional()}).strict()),Ir=e=>Fr.parse(e),Lr=M(()=>P({inputSchema:Er.optional(),outputSchema:Er.optional()}).strict()),Rr=M(()=>P({commandId:B(),sourceId:B(),scope:B().optional(),title:B(),category:B(),description:B().optional(),order:I(),availability:br,action:Lr.optional(),keybind:B().optional()}).strict());ze(Rr);var zr=Dr.pipe(B().max(8192)),Br=Dr.pipe(B().max(60)),Vr=ne({protocol:/^https?$/u}),Hr=P({label:zr,value:zr}).strict(),Ur={summary:zr.optional(),facts:ze(Hr).max(4).optional(),body:zr.optional(),bodyLabel:zr.optional(),details:ze(Hr).max(24).optional()};Ge(`type`,[P({type:L(`choice`),message:Br,...Ur,current:zr.optional(),collapsedGroup:zr.optional(),options:ze(P({value:zr,label:zr,description:zr.optional(),group:zr.optional(),destructive:L(!0).optional()}).strict()).min(1).max(256)}).strict(),P({type:L(`text`),message:Br,...Ur,placeholder:zr.optional(),secret:j().optional()}).strict(),P({type:L(`confirmation`),message:Br,...Ur,confirmLabel:zr.optional(),cancelLabel:zr.optional(),destructive:L(!0).optional()}).strict()]),M(()=>Ge(`type`,[P({type:L(`info`),message:zr,links:ze(P({url:Vr,label:zr.optional()}).strict()).max(16).optional()}).strict(),P({type:L(`progress`),message:zr}).strict(),P({type:L(`handoff`),url:Vr,code:zr.optional(),message:zr.optional()}).strict(),P({type:L(`success`),message:zr}).strict()]));function Wr(e,t){let n=!1,r=[];for(let i of t){let{availability:t,handler:a,...o}=i,s=a,c=t===void 0?o:{...o,availability:t()};e.register(c,async({arguments:e,origin:t,signal:n})=>{let r=await s(e===void 0?{origin:t,signal:n}:{arguments:e,origin:t,signal:n});return r===void 0?void 0:Cr(r)}).then(e=>{n?e():r.push(e)},e=>{console.warn(`App command ${i.id} was not registered`,e)})}return()=>{if(!n){n=!0;for(let e of r.splice(0))e()}}}Ie(`light.dark.latte.mocha.readout.readout-night.field-guide.field-guide-night.embed.embed-dark.phosphor.codec.paper.ember.tide.tape.sunrise.pirate-radio.pirate-radio-night.consulting.consulting-ink.consulting-night.consulting-night-ink.consulting-riso-latte.consulting-riso-latte-ink.consulting-riso-glomzy.consulting-riso-glomzy-ink.vishnu.coin.coin-night.chamfer`.split(`.`));var Gr=`data-theme`;function Kr(e){return e||(globalThis.document?.documentElement??null)}function qr(e){let t=e.trim();if(t.length===0)throw TypeError(`Theme must be a non-empty string`);return t}function Jr(e,t){let n=qr(e),r=Kr(t);r&&r.setAttribute(Gr,n)}function Yr(e){return Kr(e)?.getAttribute(Gr)??null}function Xr(e,t){let n=Kr(t),r=globalThis,i=(n?.ownerDocument??null)?.defaultView?.MutationObserver??r.MutationObserver;if(!n||!i)return()=>void 0;let a=new i(t=>{if(!t.some(e=>e.type===`attributes`&&e.attributeName===Gr))return;let r=n.getAttribute(Gr);r&&e(r)});a.observe(n,{attributes:!0,attributeFilter:[Gr]});let o=!1;return()=>{o||(o=!0,a.disconnect())}}var Zr=t((e=>{var t=a();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot}))();function Qr(e,t){console.error(JSON.stringify({source:`agar`,operation:e,failureKind:t instanceof Error?`Error`:`NonErrorThrown`}),et(t))}var $r=Symbol(`workers-module`);Symbol.dispose||(Symbol.dispose=Symbol.for(`dispose`)),Symbol.asyncDispose||(Symbol.asyncDispose=Symbol.for(`asyncDispose`)),Promise.withResolvers||(Promise.withResolvers=function(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}});var ei=globalThis[$r],ti=ei?ei.RpcTarget:class{},ni=async function(){}.constructor,ri=typeof Buffer<`u`?Buffer.prototype:void 0;function ii(e){switch(typeof e){case`boolean`:case`number`:case`string`:return`primitive`;case`undefined`:return`undefined`;case`object`:case`function`:break;case`bigint`:return`bigint`;default:return`unsupported`}if(e===null)return`primitive`;let t=Object.getPrototypeOf(e);switch(t){case Object.prototype:return`object`;case Function.prototype:case ni.prototype:return`function`;case Array.prototype:return`array`;case Date.prototype:return`date`;case Uint8Array.prototype:case ri:case ArrayBuffer.prototype:case DataView.prototype:case Int8Array.prototype:case Uint8ClampedArray.prototype:case Int16Array.prototype:case Uint16Array.prototype:case Int32Array.prototype:case Uint32Array.prototype:case BigInt64Array.prototype:case BigUint64Array.prototype:case Float32Array.prototype:case Float64Array.prototype:return`bytes`;case WritableStream.prototype:return`writable`;case ReadableStream.prototype:return`readable`;case URL.prototype:return`url`;case Headers.prototype:return`headers`;case Request.prototype:return`request`;case Response.prototype:return`response`;case Blob.prototype:return`blob`;case gi.prototype:return`stub`;case _i.prototype:return`rpc-promise`;default:if(ei){if(t==ei.RpcStub.prototype||e instanceof ei.ServiceStub)return`rpc-target`;if(t==ei.RpcPromise.prototype||t==ei.RpcProperty.prototype)return`rpc-thenable`}return e instanceof ti?`rpc-target`:e instanceof Error?`error`:`unsupported`}}function ai(){throw Error(`RPC map() implementation was not loaded.`)}var oi={applyMap:ai,sendMap:ai};function si(){throw Error(`Stream implementation was not loaded.`)}var ci={createWritableStreamHook:si,createWritableStreamFromHook:si,createReadableStreamHook:si},li=class{stream(e,t){let n=this.call(e,t),r;try{r=n.pull()}catch(e){throw n.dispose(),e}let i;return r instanceof Promise?i=r.then(e=>{e.dispose()}):(r.dispose(),i=Promise.resolve()),{promise:i}}},ui=class extends li{error;constructor(e){super(),this.error=e}call(e,t){return t.dispose(),this}map(e,t,n){for(let e of t)e.dispose();return this}get(e){return this}dup(){return this}pull(){return Promise.reject(this.error)}ignoreUnhandledRejections(){}dispose(){}onBroken(e){try{e(this.error)}catch(e){Promise.resolve(e)}}},di=new ui(Error(`Attempted to use RPC stub after it has been disposed.`)),fi=(e,t,n)=>e.call(t,n);function pi(e,t){let n=fi;fi=e;try{return t()}finally{fi=n}}var mi=Symbol(`realStub`),hi={apply(e,t,n){let r=e.raw;return new _i(fi(r.hook,r.pathIfPromise||[],wi.fromAppParams(n)),[])},get(e,t,n){let r=e.raw;if(t===mi)return r;if(t in _i.prototype)return r[t];if(typeof t==`string`)return new _i(r.hook,r.pathIfPromise?[...r.pathIfPromise,t]:[t]);if(t===Symbol.dispose&&(!r.pathIfPromise||r.pathIfPromise.length==0))return()=>{r.hook.dispose(),r.hook=di}},has(e,t){let n=e.raw;return t===mi?!0:t in _i.prototype?t in n:typeof t==`string`||t===Symbol.dispose&&(!n.pathIfPromise||n.pathIfPromise.length==0)},construct(e,t){throw Error(`An RPC stub cannot be used as a constructor.`)},defineProperty(e,t,n){throw Error(`Can't define properties on RPC stubs.`)},deleteProperty(e,t){throw Error(`Can't delete properties on RPC stubs.`)},getOwnPropertyDescriptor(e,t){},getPrototypeOf(e){return Object.getPrototypeOf(e.raw)},isExtensible(e){return!1},ownKeys(e){return[]},preventExtensions(e){return!0},set(e,t,n,r){throw Error(`Can't assign properties on RPC stubs.`)},setPrototypeOf(e,t){throw Error(`Can't override prototype of RPC stubs.`)}},gi=class e extends ti{constructor(e,t){if(super(),!(e instanceof li)){let n=e;if(e=n instanceof ti||n instanceof Function?ki.create(n,void 0):new Di(wi.fromAppReturn(n)),t)throw TypeError(`RpcStub constructor expected one argument, received two.`)}this.hook=e,this.pathIfPromise=t;let n=()=>{};return n.raw=this,new Proxy(n,hi)}hook;pathIfPromise;dup(){let t=this[mi];return t.pathIfPromise?new e(t.hook.get(t.pathIfPromise)):new e(t.hook.dup())}onRpcBroken(e){this[mi].hook.onBroken(e)}map(e){let{hook:t,pathIfPromise:n}=this[mi];return oi.sendMap(t,n||[],e)}toString(){return`[object RpcStub]`}},_i=class extends gi{constructor(e,t){if(e instanceof li)super(e,t??[]);else{if(t!==void 0)throw TypeError(`RpcPromise constructor expected one argument, received two.`);let n=ii(e);if(n===`rpc-promise`){let t=Si(e);if(t.pathIfPromise.length>0)super(t.hook,t.pathIfPromise);else{let e=t.hook;t.hook=di,super(e,[])}}else if(n===`rpc-thenable`)super(ki.create(e,void 0),[]);else{let t=new Ai(Promise.resolve(e).then(e=>new Di(wi.fromAppReturn(e))));t.ignoreUnhandledRejections(),super(t,[])}}}then(e,t){return Ci(this).then(...arguments)}catch(e){return Ci(this).catch(...arguments)}finally(e){return Ci(this).finally(...arguments)}toString(){return`[object RpcPromise]`}};function vi(e){let{hook:t,pathIfPromise:n}=e[mi];return n&&n.length>0?t.get(n):t}function yi(e){let{hook:t,pathIfPromise:n}=e[mi];return n?t.get(n):t.dup()}function bi(e){let{hook:t,pathIfPromise:n}=e[mi];if(!(n&&n.length>0))return t}function xi(e){return e[mi].hook}function Si(e){return e[mi]}async function Ci(e){let{hook:t,pathIfPromise:n}=e[mi];return n.length>0&&(t=t.get(n)),(await t.pull()).deliverResolve()}var wi=class e{value;source;hooks;promises;static fromAppParams(t){return new e(t,`params`)}static fromAppReturn(t){return new e(t,`return`)}static fromArray(t){let n=[],r=[],i=[];for(let e of t){e.ensureDeepCopied();for(let t of e.hooks)n.push(t);for(let t of e.promises)t.parent===e&&(t={parent:i,property:i.length,promise:t.promise}),r.push(t);i.push(e.value)}return new e(i,`owned`,n,r)}static forEvaluate(t,n){return new e(null,`owned`,t,n)}static deepCopyFrom(t,n,r){let i=new e(null,`owned`,[],[]);return i.value=i.deepCopy(t,n,`value`,i,!0,r),i}constructor(e,t,n,r){this.value=e,this.source=t,this.hooks=n,this.promises=r}rpcTargets;getHookForRpcTarget(e,t,n=!0){if(this.source===`params`){if(n){let t=e;typeof t.dup==`function`&&(e=t.dup())}return ki.create(e,t)}if(this.source===`return`){let r=this.rpcTargets?.get(e);return r?n?r.dup():(this.rpcTargets?.delete(e),r):(r=ki.create(e,t),n?(this.rpcTargets||=new Map,this.rpcTargets.set(e,r),r.dup()):r)}throw Error(`owned payload shouldn't contain raw RpcTargets`)}getHookForWritableStream(e,t,n=!0){if(this.source===`params`)return ci.createWritableStreamHook(e);if(this.source===`return`){let t=this.rpcTargets?.get(e);return t?n?t.dup():(this.rpcTargets?.delete(e),t):(t=ci.createWritableStreamHook(e),n?(this.rpcTargets||=new Map,this.rpcTargets.set(e,t),t.dup()):t)}throw Error(`owned payload shouldn't contain raw WritableStreams`)}getHookForReadableStream(e,t,n=!0){if(this.source===`params`)return ci.createReadableStreamHook(e);if(this.source===`return`){let t=this.rpcTargets?.get(e);return t?n?t.dup():(this.rpcTargets?.delete(e),t):(t=ci.createReadableStreamHook(e),n?(this.rpcTargets||=new Map,this.rpcTargets.set(e,t),t.dup()):t)}throw Error(`owned payload shouldn't contain raw ReadableStreams`)}deepCopy(e,t,n,r,i,a){switch(ii(e)){case`unsupported`:return e;case`primitive`:case`bigint`:case`date`:case`bytes`:case`blob`:case`url`:case`error`:case`undefined`:return e;case`array`:{let t=e,n=t.length,r=Array(n);for(let e=0;e<n;e++)r[e]=this.deepCopy(t[e],t,e,r,i,a);return r}case`object`:{let t={},n=e;for(let e in n)t[e]=this.deepCopy(n[e],n,e,t,i,a);return t}case`stub`:case`rpc-promise`:{let t=e,a;if(a=i?yi(t):vi(t),t instanceof _i){let e=new _i(a,[]);return this.promises.push({parent:r,property:n,promise:e}),e}return this.hooks.push(a),new gi(a)}case`function`:case`rpc-target`:{let n=e,r;return r=a?a.getHookForRpcTarget(n,t,i):ki.create(n,t),this.hooks.push(r),new gi(r)}case`rpc-thenable`:{let o=e,s;return s=a?new _i(a.getHookForRpcTarget(o,t,i),[]):new _i(ki.create(o,t),[]),this.promises.push({parent:r,property:n,promise:s}),s}case`writable`:{let n=e,r;return r=a?a.getHookForWritableStream(n,t,i):ci.createWritableStreamHook(n),this.hooks.push(r),n}case`readable`:{let n=e,r;return r=a?a.getHookForReadableStream(n,t,i):ci.createReadableStreamHook(n),this.hooks.push(r),n}case`headers`:return new Headers(e);case`request`:{let t=e;return t.body&&this.deepCopy(t.body,t,`body`,t,i,a),new Request(t)}case`response`:{let t=e;return t.body&&this.deepCopy(t.body,t,`body`,t,i,a),new Response(t.body,t)}default:throw Error(`unreachable`)}}ensureDeepCopied(){if(this.source!==`owned`){let e=this.source===`params`;this.hooks=[],this.promises=[];try{this.value=this.deepCopy(this.value,void 0,`value`,this,e,this)}catch(e){throw this.hooks=void 0,this.promises=void 0,e}if(this.source=`owned`,this.rpcTargets&&this.rpcTargets.size>0)throw Error(`Not all rpcTargets were accounted for in deep-copy?`);this.rpcTargets=void 0}}deliverTo(t,n,r){if(this.ensureDeepCopied(),this.value instanceof _i)e.deliverRpcPromiseTo(this.value,t,n,r);else{t[n]=this.value;for(let t of this.promises)e.deliverRpcPromiseTo(t.promise,t.parent,t.property,r)}}static deliverRpcPromiseTo(t,n,r,i){let a=bi(t);if(!a)throw Error(`property promises should have been resolved earlier`);let o=a.pull();o instanceof e?o.deliverTo(n,r,i):i.push(o.then(e=>{let t=[];if(e.deliverTo(n,r,t),t.length>0)return Promise.all(t)}))}async deliverCall(t,n){try{let r=[];this.deliverTo(this,`value`,r),r.length>0&&await Promise.all(r);let i=Function.prototype.apply.call(t,n,this.value);return i instanceof _i?e.fromAppReturn(i):e.fromAppReturn(await i)}finally{this.dispose()}}async deliverStreamWrite(t){try{let n=[];this.deliverTo(this,`value`,n),n.length>0&&await Promise.all(n);let r=this.value[0];return(this.hooks.length>0||this.promises.length>0)&&r instanceof Object?(Symbol.dispose in r||Object.defineProperty(r,Symbol.dispose,{value:()=>this.dispose(),writable:!0,enumerable:!1,configurable:!0}),await t.write(r),e.fromAppReturn(void 0)):(await t.write(r),this.dispose(),e.fromAppReturn(void 0))}catch(e){throw this.dispose(),e}}async deliverResolve(){try{let e=[];this.deliverTo(this,`value`,e),e.length>0&&await Promise.all(e);let t=this.value;return t instanceof Object&&(Symbol.dispose in t||Object.defineProperty(t,Symbol.dispose,{value:()=>this.dispose(),writable:!0,enumerable:!1,configurable:!0})),t}catch(e){throw this.dispose(),e}}dispose(){if(this.source===`owned`)this.hooks.forEach(e=>e.dispose()),this.promises.forEach(e=>e.promise[Symbol.dispose]());else if(this.source===`return`&&(this.disposeImpl(this.value,void 0),this.rpcTargets&&this.rpcTargets.size>0))throw Error(`Not all rpcTargets were accounted for in disposeImpl()?`);this.source=`owned`,this.hooks=[],this.promises=[]}disposeImpl(e,t){switch(ii(e)){case`unsupported`:case`primitive`:case`bigint`:case`bytes`:case`blob`:case`date`:case`url`:case`error`:case`undefined`:return;case`array`:{let t=e,n=t.length;for(let e=0;e<n;e++)this.disposeImpl(t[e],t);return}case`object`:{let t=e;for(let e in t)this.disposeImpl(t[e],t);return}case`stub`:case`rpc-promise`:{let t=bi(e);t&&t.dispose();return}case`function`:case`rpc-target`:{let t=e,n=this.rpcTargets?.get(t);n?(n.dispose(),this.rpcTargets.delete(t)):Oi(t);return}case`rpc-thenable`:return;case`headers`:return;case`request`:{let t=e;t.body&&this.disposeImpl(t.body,t);return}case`response`:{let t=e;t.body&&this.disposeImpl(t.body,t);return}case`writable`:{let t=e,n=this.rpcTargets?.get(t);n?this.rpcTargets.delete(t):n=ci.createWritableStreamHook(t),n.dispose();return}case`readable`:{let t=e,n=this.rpcTargets?.get(t);n?this.rpcTargets.delete(t):n=ci.createReadableStreamHook(t),n.dispose();return}default:return}}ignoreUnhandledRejections(){this.hooks?(this.hooks.forEach(e=>{e.ignoreUnhandledRejections()}),this.promises.forEach(e=>xi(e.promise).ignoreUnhandledRejections())):this.ignoreUnhandledRejectionsImpl(this.value)}ignoreUnhandledRejectionsImpl(e){switch(ii(e)){case`unsupported`:case`primitive`:case`bigint`:case`bytes`:case`blob`:case`date`:case`error`:case`undefined`:case`function`:case`rpc-target`:case`writable`:case`readable`:case`url`:case`headers`:case`request`:case`response`:return;case`array`:{let t=e,n=t.length;for(let e=0;e<n;e++)this.ignoreUnhandledRejectionsImpl(t[e]);return}case`object`:{let t=e;for(let e in t)this.ignoreUnhandledRejectionsImpl(t[e]);return}case`stub`:case`rpc-promise`:xi(e).ignoreUnhandledRejections();return;case`rpc-thenable`:e.then(e=>{},e=>{});return;default:return}}};function Ti(e,t,n,r){for(let i=0;i<n.length;i++){t=e;let a=n[i];if(a in Object.prototype){e=void 0;continue}switch(ii(e)){case`object`:case`function`:e=Object.hasOwn(e,a)?e[a]:void 0;break;case`array`:e=Number.isInteger(a)&&a>=0?e[a]:void 0;break;case`rpc-target`:case`rpc-thenable`:if(Object.hasOwn(e,a))throw TypeError(`Attempted to access property '${a}', which is an instance property of the RpcTarget. To avoid leaking private internals, instance properties cannot be accessed over RPC. If you want to make this property available over RPC, define it as a method or getter on the class, instead of an instance property.`);e=e[a],r=null;break;case`stub`:case`rpc-promise`:{let{hook:t,pathIfPromise:r}=Si(e);return{hook:t,remainingPath:r?r.concat(n.slice(i)):n.slice(i)}}case`writable`:e=void 0;break;case`readable`:e=void 0;break;case`primitive`:case`bigint`:case`bytes`:case`blob`:case`date`:case`error`:case`url`:case`headers`:case`request`:case`response`:e=void 0;break;case`undefined`:e=e[a];break;case`unsupported`:if(i===0)throw TypeError(`RPC stub points at a non-serializable type.`);{let e=n.slice(0,i).join(`.`),t=n.slice(0,i).join(`.`);throw TypeError(`'${e}' is not a serializable type, so property ${t} cannot be accessed.`)}default:throw TypeError(`unreachable`)}}if(e instanceof _i){let{hook:t,pathIfPromise:n}=Si(e);return{hook:t,remainingPath:n||[]}}return{value:e,parent:t,owner:r}}var Ei=class extends li{call(e,t){let n;try{let{value:t,owner:r}=this.getValue();n=Ti(t,void 0,e,r)}catch(e){return t.dispose(),new ui(e)}return n.hook?n.hook.call(n.remainingPath,t):typeof n.value==`function`?new Ai(t.deliverCall(n.value,n.parent).then(e=>new Di(e))):(t.dispose(),new ui(TypeError(`'${e.join(`.`)}' is not a function.`)))}map(e,t,n){try{let r;try{let{value:t,owner:n}=this.getValue();r=Ti(t,void 0,e,n)}catch(e){for(let e of t)e.dispose();throw e}return r.hook?r.hook.map(r.remainingPath,t,n):oi.applyMap(r.value,r.parent,r.owner,t,n)}catch(e){return new ui(e)}}get(e){try{let{value:t,owner:n}=this.getValue();if(e.length===0&&n===null){if(t instanceof Object&&`then`in t)return this.dup();throw Error(`Can't dup an RpcTarget stub as a promise.`)}let r=Ti(t,void 0,e,n);return r.hook?r.hook.get(r.remainingPath):new Di(wi.deepCopyFrom(r.value,r.parent,r.owner))}catch(e){return new ui(e)}}},Di=class e extends Ei{constructor(e){super(),this.payload=e}payload;getPayload(){if(this.payload)return this.payload;throw Error(`Attempted to use an RPC StubHook after it was disposed.`)}getValue(){let e=this.getPayload();return{value:e.value,owner:e}}dup(){let t=this.getPayload();return new e(wi.deepCopyFrom(t.value,void 0,t))}pull(){return this.getPayload()}ignoreUnhandledRejections(){this.payload&&this.payload.ignoreUnhandledRejections()}dispose(){this.payload&&=(this.payload.dispose(),void 0)}onBroken(e){this.payload&&this.payload.value instanceof gi&&this.payload.value.onRpcBroken(e)}};function Oi(e){if(Symbol.dispose in e)try{e[Symbol.dispose]()}catch(e){Promise.reject(e)}}var ki=class e extends Ei{static create(t,n){return typeof t!=`function`&&(n=void 0),new e(t,n)}constructor(e,t,n){super(),this.target=e,this.parent=t,n?n.refcount&&(this.refcount=n.refcount,++this.refcount.count):Symbol.dispose in e&&(this.refcount={count:1})}target;parent;refcount;getTarget(){if(this.target)return this.target;throw Error(`Attempted to use an RPC StubHook after it was disposed.`)}getValue(){return{value:this.getTarget(),owner:null}}dup(){return new e(this.getTarget(),this.parent,this)}pull(){let e=this.getTarget();return`then`in e?Promise.resolve(e).then(e=>wi.fromAppReturn(e)):Promise.reject(Error(`Tried to resolve a non-promise stub.`))}ignoreUnhandledRejections(){}dispose(){this.target&&=(this.refcount&&--this.refcount.count==0&&Oi(this.target),void 0)}onBroken(e){let t=this.target;t&&`then`in t&&Promise.resolve(t).then(()=>{},e)}},Ai=class e extends li{promise;resolution;constructor(e){super(),this.promise=e.then(e=>(this.resolution=e,e))}call(t,n){return n.ensureDeepCopied(),new e(this.promise.then(e=>e.call(t,n),e=>{throw n.dispose(),e}))}stream(e,t){return t.ensureDeepCopied(),{promise:this.promise.then(n=>n.stream(e,t).promise,e=>{throw t.dispose(),e})}}map(t,n,r){return new e(this.promise.then(e=>e.map(t,n,r),e=>{for(let e of n)e.dispose();throw e}))}get(t){return new e(this.promise.then(e=>e.get(t)))}dup(){return this.resolution?this.resolution.dup():new e(this.promise.then(e=>e.dup()))}pull(){return this.resolution?this.resolution.pull():this.promise.then(e=>e.pull())}ignoreUnhandledRejections(){this.resolution?this.resolution.ignoreUnhandledRejections():this.promise.then(e=>{e.ignoreUnhandledRejections()},e=>{})}dispose(){this.promise.then(e=>e.dispose(),()=>{})}onBroken(e){this.resolution?this.resolution.onBroken(e):this.promise.then(t=>{t.onBroken(e)},e)}},ji={maxBigIntDigits:16384,maxDepth:256,maxMessageSize:33554432},Mi=new Uint8Array(new Uint16Array([1]).buffer)[0]===1,Ni=[`ArrayBuffer`,`DataView`,`Int8Array`,`Uint8Array`,`Uint8ClampedArray`,`Int16Array`,`Uint16Array`,`Int32Array`,`Uint32Array`,`BigInt64Array`,`BigUint64Array`,`Float32Array`,`Float64Array`];function Pi(e){return Ni.includes(e)}var Fi={ArrayBuffer:void 0,DataView:void 0,Int8Array:void 0,Uint8Array:void 0,Uint8ClampedArray:void 0,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,BigInt64Array:8,BigUint64Array:8,Float32Array:4,Float64Array:8},Ii={ArrayBuffer:ArrayBuffer.prototype,DataView:DataView.prototype,Int8Array:Int8Array.prototype,Uint8ClampedArray:Uint8ClampedArray.prototype,Int16Array:Int16Array.prototype,Uint16Array:Uint16Array.prototype,Int32Array:Int32Array.prototype,Uint32Array:Uint32Array.prototype,BigInt64Array:BigInt64Array.prototype,BigUint64Array:BigUint64Array.prototype,Float32Array:Float32Array.prototype,Float64Array:Float64Array.prototype},Li=new Map;for(let e of Object.keys(Ii))Li.set(Ii[e],e);function Ri(e,t){if(t!==2&&t!==4&&t!==8)throw RangeError(`Unsupported element size: ${t}`);let n=new DataView(e.buffer,e.byteOffset,e.byteLength);for(let r=0;r<e.byteLength;r+=t)switch(t){case 2:n.setUint16(r,n.getUint16(r,!1),!0);break;case 4:n.setUint32(r,n.getUint32(r,!1),!0);break;case 8:n.setBigUint64(r,n.getBigUint64(r,!1),!0)}}var zi=new class{exportStub(e){throw Error(`Cannot serialize RPC stubs without an RPC session.`)}exportPromise(e){throw Error(`Cannot serialize RPC stubs without an RPC session.`)}getImport(e){}unexport(e){}createPipe(e){throw Error(`Cannot create pipes without an RPC session.`)}onSendError(e){}};async function Bi(e,t){let n=await new Response(e).blob();return n.type===t?n:n.slice(0,n.size,t)}var Vi={__proto__:null,Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,AggregateError},Hi=class e{exporter;source;encodingLevel;constructor(e,t,n){this.exporter=e,this.source=t,this.encodingLevel=n}static devaluate(t,n,r=zi,i,a=`string`){let o=new e(r,i,a);try{return o.devaluateImpl(t,n,0)}catch(e){if(o.exports)try{r.unexport(o.exports)}catch{}throw e}}exports;devaluateImpl(e,t,n){if(n>=256)throw Error(`Serialization exceeded maximum allowed depth. (Does the message contain cycles?)`);switch(ii(e)){case`unsupported`:{let t;try{t=`Cannot serialize value: ${e}`}catch{t=`Cannot serialize value: (couldn't stringify value)`}throw TypeError(t)}case`primitive`:return typeof e==`number`&&!isFinite(e)?this.encodingLevel===`structuredClonable`?e:e===1/0?[`inf`]:e===-1/0?[`-inf`]:[`nan`]:e;case`object`:{let t=e,r={};for(let e in t)r[e]=this.devaluateImpl(t[e],t,n+1);return r}case`array`:{let t=e,r=t.length,i=Array(r);for(let e=0;e<r;e++)i[e]=this.devaluateImpl(t[e],t,n+1);return[i]}case`bigint`:return this.encodingLevel===`structuredClonable`?e:[`bigint`,e.toString()];case`date`:{if(this.encodingLevel===`structuredClonable`)return e;let t=e.getTime();return[`date`,Number.isNaN(t)?null:t]}case`bytes`:{let t=Li.get(Object.getPrototypeOf(e)),n;if(t===`ArrayBuffer`)n=new Uint8Array(e);else if(t===void 0)n=e;else{let r=e;n=new Uint8Array(r.buffer,r.byteOffset,r.byteLength);let i=Fi[t];!Mi&&i&&(n=n.slice(),Ri(n,i))}if(this.encodingLevel===`structuredClonable`||this.encodingLevel===`jsonCompatibleWithBytes`)return t===void 0?[`bytes`,n]:[`bytes`,n,t];let r;if(n.toBase64)r=n.toBase64({omitPadding:!0});else if(typeof Buffer<`u`)r=(n instanceof Buffer?n:Buffer.from(n.buffer,n.byteOffset,n.byteLength)).toString(`base64`);else{let e=``;for(let t=0;t<n.length;t++)e+=String.fromCharCode(n[t]);r=btoa(e)}return r=r.replace(/=+$/,``),t===void 0?[`bytes`,r]:[`bytes`,r,t]}case`url`:return[`url`,e.href];case`headers`:return[`headers`,[...e]];case`request`:{let t=e,r={};t.method!==`GET`&&(r.method=t.method);let i=[...t.headers];if(i.length>0&&(r.headers=i),t.body)r.body=this.devaluateImpl(t.body,t,n+1),r.duplex=t.duplex||`half`;else if(t.body===void 0&&![`GET`,`HEAD`,`OPTIONS`,`TRACE`,`DELETE`].includes(t.method)){let e=t.arrayBuffer(),n=new ReadableStream({async start(t){try{t.enqueue(new Uint8Array(await e)),t.close()}catch(e){t.error(e)}}}),i=ci.createReadableStreamHook(n);r.body=[`readable`,this.exporter.createPipe(n,i)],r.duplex=t.duplex||`half`}t.cache&&t.cache!=="default"&&(r.cache=t.cache),t.redirect!==`follow`&&(r.redirect=t.redirect),t.integrity&&(r.integrity=t.integrity),t.mode&&t.mode!==`cors`&&(r.mode=t.mode),t.credentials&&t.credentials!==`same-origin`&&(r.credentials=t.credentials),t.referrer&&t.referrer!==`about:client`&&(r.referrer=t.referrer),t.referrerPolicy&&(r.referrerPolicy=t.referrerPolicy),t.keepalive&&(r.keepalive=t.keepalive);let a=t;return a.cf&&(r.cf=a.cf),a.encodeResponseBody&&a.encodeResponseBody!==`automatic`&&(r.encodeResponseBody=a.encodeResponseBody),[`request`,t.url,r]}case`response`:{let t=e,r=this.devaluateImpl(t.body,t,n+1),i={};t.status!==200&&(i.status=t.status),t.statusText&&(i.statusText=t.statusText);let a=[...t.headers];a.length>0&&(i.headers=a);let o=t;if(o.cf&&(i.cf=o.cf),o.encodeBody&&o.encodeBody!==`automatic`&&(i.encodeBody=o.encodeBody),o.webSocket)throw TypeError(`Can't serialize a Response containing a webSocket.`);return[`response`,r,i]}case`blob`:{let t=e,n=t.stream(),r=ci.createReadableStreamHook(n),i=this.exporter.createPipe(n,r);return[`blob`,t.type,[`readable`,i]]}case`error`:{let t=e,r=this.exporter.onSendError(t);r&&(t=r);let i=t,a,o=(e,r)=>{let i=this.exports?.length??0;try{let i=this.devaluateImpl(r,t,n+1);a||={},a[e]=i}catch{if(this.exports&&this.exports.length>i){let e=this.exports.splice(i);try{this.exporter.unexport(e)}catch{}}}};for(let e of Object.keys(t))e!==`name`&&e!==`message`&&e!==`stack`&&o(e,i[e]);`cause`in t&&o(`cause`,i.cause),t instanceof AggregateError&&o(`errors`,t.errors);let s=[`error`,t.name,t.message];return a?(s.push(r&&r.stack?r.stack:null),s.push(a)):r&&r.stack&&s.push(r.stack),s}case`undefined`:return this.encodingLevel===`structuredClonable`?void 0:[`undefined`];case`stub`:case`rpc-promise`:{if(!this.source)throw Error(`Can't serialize RPC stubs in this context.`);let{hook:t,pathIfPromise:n}=Si(e),r=this.exporter.getImport(t);return r===void 0?(t=n?t.get(n):t.dup(),this.devaluateHook(n?`promise`:`export`,t)):n?n.length>0?[`pipeline`,r,n]:[`pipeline`,r]:[`import`,r]}case`function`:case`rpc-target`:{if(!this.source)throw Error(`Can't serialize RPC stubs in this context.`);let n=this.source.getHookForRpcTarget(e,t);return this.devaluateHook(`export`,n)}case`rpc-thenable`:{if(!this.source)throw Error(`Can't serialize RPC stubs in this context.`);let n=this.source.getHookForRpcTarget(e,t);return this.devaluateHook(`promise`,n)}case`writable`:{if(!this.source)throw Error(`Can't serialize WritableStream in this context.`);let n=this.source.getHookForWritableStream(e,t);return this.devaluateHook(`writable`,n)}case`readable`:{if(!this.source)throw Error(`Can't serialize ReadableStream in this context.`);let n=e,r=this.source.getHookForReadableStream(n,t);return[`readable`,this.exporter.createPipe(n,r)]}default:throw Error(`unreachable`)}}devaluateHook(e,t){this.exports||=[];let n=e===`promise`?this.exporter.exportPromise(t):this.exporter.exportStub(t);return this.exports.push(n),[e,n]}};new class{importStub(e){throw Error(`Cannot deserialize RPC stubs without an RPC session.`)}importPromise(e){throw Error(`Cannot deserialize RPC stubs without an RPC session.`)}getExport(e){}getPipeReadable(e){throw Error(`Cannot retrieve pipe readable without an RPC session.`)}getLimits(){return ji}};function Ui(e,t){return new _i(new Ai(new Response(t).arrayBuffer().then(t=>{let n=new Uint8Array(t),r=new Request(e,{body:n});return new Di(wi.fromAppReturn(r))})),[])}function Wi(e,t){return new _i(new Ai(Bi(e,t).then(e=>new Di(wi.fromAppReturn(e)))),[])}var Gi=class e{importer;encodingLevel;limits;constructor(e,t=`string`){this.importer=e,this.encodingLevel=t,this.limits=e.getLimits()}hooks=[];promises=[];evaluate(e){return this.evaluateWithDepth(e,0)}evaluateWithDepth(e,t){let n=wi.forEvaluate(this.hooks,this.promises);try{return n.value=this.evaluateImpl(e,n,`value`,t),n}catch(e){throw n.dispose(),e}}evaluateCopy(e){return this.evaluate(structuredClone(e))}evaluateImpl(t,n,r,i){let a=this.limits.maxDepth;if(i>=a)throw TypeError(`Deserialization exceeded maximum allowed message depth of ${a}.`);if(this.encodingLevel===`structuredClonable`&&(t instanceof Date||typeof t==`bigint`))return t;if(t instanceof Array){if(t.length==1&&t[0]instanceof Array){let e=t[0];for(let t=0;t<e.length;t++)e[t]=this.evaluateImpl(e[t],e,t,i+1);return e}switch(t[0]){case`bigint`:if(typeof t[1]==`string`){let e=t[1],n=this.limits.maxBigIntDigits;if(e.length>n)throw TypeError(`Deserialized bigint exceeds maximum length of ${n} digits.`);return BigInt(e)}break;case`date`:if(t[1]===null)return new Date(NaN);if(typeof t[1]==`number`)return new Date(t[1]);break;case`bytes`:{let e;if(t[1]instanceof Uint8Array)e=t[1];else if(typeof t[1]==`string`){if(typeof Buffer<`u`)e=Buffer.from(t[1],`base64`);else if(Uint8Array.fromBase64)e=Uint8Array.fromBase64(t[1]);else{let n=atob(t[1]),r=n.length;e=new Uint8Array(r);for(let t=0;t<r;t++)e[t]=n.charCodeAt(t)}}else break;if(t.length===2)return e;if(typeof t[2]!=`string`)throw TypeError(`Unknown bytes type marker type: ${typeof t[2]}`);if(!Pi(t[2])){let e=t[2].slice(0,64);throw TypeError(`Unknown bytes type marker: ${e}`)}let n=t[2],r=Fi[n];if(r!==void 0&&e.byteLength%r!==0)throw TypeError(`Invalid byte length ${e.byteLength} for ${n}; expected a multiple of ${r}`);let i=e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);switch(!Mi&&r!==void 0&&Ri(new Uint8Array(i),r),n){case`ArrayBuffer`:return i;case`DataView`:return new DataView(i);case`Int8Array`:return new Int8Array(i);case`Uint8Array`:return new Uint8Array(i);case`Uint8ClampedArray`:return new Uint8ClampedArray(i);case`Int16Array`:return new Int16Array(i);case`Uint16Array`:return new Uint16Array(i);case`Int32Array`:return new Int32Array(i);case`Uint32Array`:return new Uint32Array(i);case`BigInt64Array`:return new BigInt64Array(i);case`BigUint64Array`:return new BigUint64Array(i);case`Float32Array`:return new Float32Array(i);case`Float64Array`:return new Float64Array(i)}}case`error`:if(t.length>=3&&typeof t[1]==`string`&&typeof t[2]==`string`){let e=Vi[t[1]]||Error,n=e===AggregateError?new e([],t[2]):new e(t[2]);if(typeof t[3]==`string`&&(n.stack=t[3]),t.length>=5){let e=t[4];if(!e||typeof e!=`object`||Array.isArray(e))break;let r=n,a=e;for(let e of Object.keys(a))if(e!==`name`&&e!==`message`&&e!==`stack`){if(e in Object.prototype||e===`toJSON`){this.evaluateImpl(a[e],n,e,i+1);continue}r[e]=this.evaluateImpl(a[e],n,e,i+1)}}return n}break;case`undefined`:if(t.length===1)return;break;case`inf`:return 1/0;case`-inf`:return-1/0;case`nan`:return NaN;case`url`:if(t.length===2&&typeof t[1]==`string`)return new URL(t[1]);break;case`headers`:if(t.length===2&&t[1]instanceof Array)return new Headers(t[1]);break;case`request`:{if(t.length!==3||typeof t[1]!=`string`)break;let e=t[1],a=t[2];if(typeof a!=`object`||!a)break;if(a.body&&(a.body=this.evaluateImpl(a.body,a,`body`,i+1),!(a.body===null||typeof a.body==`string`||a.body instanceof Uint8Array||a.body instanceof ReadableStream)))throw TypeError(`Request body must be of type ReadableStream.`);if(a.signal&&(a.signal=this.evaluateImpl(a.signal,a,`signal`,i+1),!(a.signal instanceof AbortSignal)))throw TypeError(`Request siganl must be of type AbortSignal.`);if(a.headers&&!(a.headers instanceof Array))throw TypeError(`Request headers must be serialized as an array of pairs.`);let o=new Request(e,a);if(a.body instanceof ReadableStream&&o.body===void 0){let e=Ui(o,a.body);return this.promises.push({promise:e,parent:n,property:r}),e}return o}case`response`:{if(t.length!==3)break;let e=this.evaluateImpl(t[1],n,r,i+1);if(!(e===null||typeof e==`string`||e instanceof Uint8Array||e instanceof ReadableStream))throw TypeError(`Response body must be of type ReadableStream.`);let a=t[2];if(typeof a!=`object`||!a)break;if(a.webSocket)throw TypeError(`Can't deserialize a Response containing a webSocket.`);if(a.headers&&!(a.headers instanceof Array))throw TypeError(`Request headers must be serialized as an array of pairs.`);return new Response(e,a)}case`blob`:{if(t.length!==3||typeof t[1]!=`string`)break;let e=t[1],a=this.evaluateImpl(t[2],n,r,i+1);if(!(a instanceof ReadableStream))throw TypeError(`Blob content must be serialized as a ReadableStream.`);let o=Wi(a,e);return this.promises.push({promise:o,parent:n,property:r}),o}case`import`:case`pipeline`:{if(t.length<2||t.length>4||typeof t[1]!=`number`)break;let a=this.importer.getExport(t[1]);if(!a)throw Error(`no such entry on exports table: ${t[1]}`);let o=t[0]==`pipeline`,s=e=>{if(o){let t=new _i(e,[]);return this.promises.push({promise:t,parent:n,property:r}),t}return this.hooks.push(e),new _i(e,[])};if(t.length==2)return s(o?a.get([]):a.dup());let c=t[2];if(!(c instanceof Array)||!c.every(e=>typeof e==`string`||typeof e==`number`))break;if(t.length==3)return s(a.get(c));let l=t[3];if(!(l instanceof Array))break;return l=new e(this.importer).evaluateWithDepth([l],i),s(a.call(c,l))}case`remap`:{if(t.length!==5||typeof t[1]!=`number`||!(t[2]instanceof Array)||!(t[3]instanceof Array)||!(t[4]instanceof Array))break;let e=this.importer.getExport(t[1]);if(!e)throw Error(`no such entry on exports table: ${t[1]}`);let i=t[2];if(!i.every(e=>typeof e==`string`||typeof e==`number`))break;let a=t[3].map(e=>{if(!(e instanceof Array)||e.length!==2||e[0]!==`import`&&e[0]!==`export`||typeof e[1]!=`number`)throw TypeError(`unknown map capture: ${JSON.stringify(e)}`);if(e[0]===`export`)return this.importer.importStub(e[1]);{let t=this.importer.getExport(e[1]);if(!t)throw Error(`no such entry on exports table: ${e[1]}`);return t.dup()}}),o=t[4],s=new _i(e.map(i,a,o),[]);return this.promises.push({promise:s,parent:n,property:r}),s}case`export`:case`promise`:if(typeof t[1]==`number`){if(t[0]==`promise`){let e=new _i(this.importer.importPromise(t[1]),[]);return this.promises.push({parent:n,property:r,promise:e}),e}{let e=this.importer.importStub(t[1]);return this.hooks.push(e),new gi(e)}}break;case`writable`:if(typeof t[1]==`number`){let e=this.importer.importStub(t[1]),n=ci.createWritableStreamFromHook(e);return this.hooks.push(e),n}break;case`readable`:if(typeof t[1]==`number`){let e=this.importer.getPipeReadable(t[1]),n=ci.createReadableStreamHook(e);return this.hooks.push(n),e}}throw TypeError(`unknown special value: ${JSON.stringify(t)}`)}if(t instanceof Object){let e=t;for(let t in e)t in Object.prototype||t===`toJSON`?(this.evaluateImpl(e[t],e,t,i+1),delete e[t]):e[t]=this.evaluateImpl(e[t],e,t,i+1);return e}return t}},Ki=16,qi=8,Ji=16,Yi=64;function Xi(e){return 2+e.length*3}function Zi(e,t,n=0){if(n>=Yi)return qi;switch(typeof e){case`string`:return Xi(e);case`number`:return 16;case`bigint`:return 16;case`boolean`:return 8;case`undefined`:return 16;case`object`:{if(e===null)return 8;if(ArrayBuffer.isView(e)||e instanceof ArrayBuffer)return Ji+e.byteLength;if(typeof Blob<`u`&&e instanceof Blob)return Ji+e.size;if(e instanceof Date)return 16;if(t??=new WeakSet,t.has(e))return qi;if(t.add(e),e instanceof Array){let r=Ki;for(let i of e)r+=qi+Zi(i,t,n+1);return r}if(e instanceof Error){let r=Ki+Xi(e.name)+Xi(e.message)+Xi(e.stack??``);for(let i of Object.keys(e))r+=qi+Xi(i)+Zi(e[i],t,n+1);return r}let r=Ki;for(let i of Object.keys(e))r+=qi+Xi(i)+Zi(e[i],t,n+1);return r}default:return 16}}var Qi=class{session;importId;constructor(e,t,n){this.session=e,this.importId=t,n&&(this.activePull=Promise.withResolvers())}localRefcount=0;remoteRefcount=1;activePull;resolution;onBrokenRegistrations;resolve(e){if(this.localRefcount==0){e.dispose();return}if(this.resolution=e,this.sendRelease(),this.onBrokenRegistrations){for(let t of this.onBrokenRegistrations){let n=this.session.onBrokenCallbacks[t],r=this.session.onBrokenCallbacks.length;e.onBroken(n),this.session.onBrokenCallbacks[r]===n?delete this.session.onBrokenCallbacks[r]:delete this.session.onBrokenCallbacks[t]}this.onBrokenRegistrations=void 0}this.activePull&&=(this.activePull.resolve(),void 0)}async awaitResolution(){return this.activePull||=(this.session.sendPull(this.importId),Promise.withResolvers()),await this.activePull.promise,this.resolution.pull()}dispose(){this.resolution?this.resolution.dispose():(this.abort(Error(`RPC was canceled because the RpcPromise was disposed.`)),this.sendRelease())}abort(e){this.resolution||(this.resolution=new ui(e),this.activePull&&=(this.activePull.reject(e),void 0),this.onBrokenRegistrations=void 0)}onBroken(e){if(this.resolution)this.resolution.onBroken(e);else{let t=this.session.onBrokenCallbacks.length;this.session.onBrokenCallbacks.push(e),this.onBrokenRegistrations||=[],this.onBrokenRegistrations.push(t)}}sendRelease(){this.remoteRefcount>0&&(this.session.sendRelease(this.importId,this.remoteRefcount),this.remoteRefcount=0)}},$i=class e extends li{isPromise;entry;constructor(e,t){super(),this.isPromise=e,++t.localRefcount,this.entry=t}collectPath(e){return this}getEntry(){if(this.entry)return this.entry;throw Error(`This RpcImportHook was already disposed.`)}getEntryTakingOwnership(e){try{return this.getEntry()}catch(t){throw e(),t}}call(e,t){let n=this.getEntryTakingOwnership(()=>t.dispose());return n.resolution?n.resolution.call(e,t):n.session.sendCall(n.importId,e,t)}stream(e,t){let n=this.getEntryTakingOwnership(()=>t.dispose());return n.resolution?n.resolution.stream(e,t):n.session.sendStream(n.importId,e,t)}map(e,t,n){let r=this.getEntryTakingOwnership(()=>{for(let e of t)e.dispose()});return r.resolution?r.resolution.map(e,t,n):r.session.sendMap(r.importId,e,t,n)}get(e){let t=this.getEntry();return t.resolution?t.resolution.get(e):t.session.sendCall(t.importId,e)}dup(){return new e(!1,this.getEntry())}pull(){let e=this.getEntry();if(!this.isPromise)throw Error(`Can't pull this hook because it's not a promise hook.`);return e.resolution?e.resolution.pull():e.awaitResolution()}ignoreUnhandledRejections(){}dispose(){let e=this.entry;this.entry=void 0,e&&--e.localRefcount===0&&e.dispose()}onBroken(e){this.entry&&this.entry.onBroken(e)}},ea=class extends $i{session;constructor(e){super(!1,e),this.session=e.session}dispose(){if(this.session){let e=this.session;this.session=void 0,e.shutdown()}}},ta=class{transport;options;exports=[];reverseExports=new Map;imports=[];abortReason;cancelReadLoop;nextExportId=-1;onBatchDone;pullCount=0;onBrokenCallbacks=[];encodingLevel;limits;constructor(e,t,n){this.transport=e,this.options=n;let r=`string`;if(`encodingLevel`in e){let t=e.encodingLevel;if(t!==void 0){if(t!==`string`&&t!==`jsonCompatible`&&t!==`jsonCompatibleWithBytes`&&t!==`structuredClonable`)throw TypeError(`Unknown transport encodingLevel: ${String(t)}`);r=t}}this.encodingLevel=r,this.limits={...ji,...n.limits},this.exports.push({hook:t,refcount:1}),this.imports.push(new Qi(this,0,!1)),this.readLoop().catch(e=>this.abort(e))}getMainImport(){return new ea(this.imports[0])}shutdown(){this.abort(Error(`RPC session was shut down by disposing the main stub`),!1)}exportStub(e){if(this.abortReason)throw this.abortReason;let t=this.reverseExports.get(e);if(t!==void 0)return++this.exports[t].refcount,t;{let t=this.nextExportId--;return this.exports[t]={hook:e,refcount:1},this.reverseExports.set(e,t),t}}exportPromise(e){if(this.abortReason)throw this.abortReason;let t=this.nextExportId--;return this.exports[t]={hook:e,refcount:1},this.reverseExports.set(e,t),this.ensureResolvingExport(t),t}unexport(e){for(let t of e)this.releaseExport(t,1)}releaseExport(e,t){let n=this.exports[e];if(!n)throw Error(`no such export ID: ${e}`);if(n.refcount<t)throw Error(`refcount would go negative: ${n.refcount} < ${t}`);n.refcount-=t,n.refcount===0&&(delete this.exports[e],this.reverseExports.delete(n.hook),n.hook.dispose())}onSendError(e){if(this.options.onSendError)return this.options.onSendError(e)}ensureResolvingExport(e){let t=this.exports[e];if(!t)throw Error(`no such export ID: ${e}`);if(!t.pull){let n=async()=>{let e=t.hook;for(;;){let t=await e.pull();if(t.value instanceof gi){let{hook:n,pathIfPromise:r}=Si(t.value);if(r&&r.length==0&&this.getImport(e)===void 0){e=n;continue}}return t}},r=t.autoRelease;++this.pullCount,t.pull=n().then(t=>{let n=Hi.devaluate(t.value,void 0,this,t,this.encodingLevel);this.send([`resolve`,e,n]),r&&this.releaseExport(e,1)},t=>{this.send([`reject`,e,Hi.devaluate(t,void 0,this,void 0,this.encodingLevel)]),r&&this.releaseExport(e,1)}).catch(t=>{try{this.send([`reject`,e,Hi.devaluate(t,void 0,this,void 0,this.encodingLevel)]),r&&this.releaseExport(e,1)}catch(e){this.abort(e)}}).finally(()=>{--this.pullCount===0&&this.onBatchDone&&this.onBatchDone.resolve()})}}getImport(e){if(e instanceof $i&&e.entry&&e.entry.session===this)return e.entry.importId}importStub(e){if(this.abortReason)throw this.abortReason;let t=this.imports[e];return t||(t=new Qi(this,e,!1),this.imports[e]=t),new $i(!1,t)}importPromise(e){if(this.abortReason)throw this.abortReason;if(this.imports[e])return new ui(Error(`Bug in RPC system: The peer sent a promise reusing an existing export ID.`));let t=new Qi(this,e,!0);return this.imports[e]=t,new $i(!0,t)}getExport(e){return this.exports[e]?.hook}getPipeReadable(e){let t=this.exports[e];if(!t||!t.pipeReadable)throw Error(`Export ${e} is not a pipe or its readable end was already consumed.`);let n=t.pipeReadable;return t.pipeReadable=void 0,n}getLimits(){return this.limits}createPipe(e,t){if(this.abortReason)throw this.abortReason;this.send([`pipe`]);let n=this.imports.length,r=new Qi(this,n,!1);this.imports.push(r);let i=new $i(!1,r),a=ci.createWritableStreamFromHook(i);return e.pipeTo(a).catch(()=>{}).finally(()=>t.dispose()),n}send(e){if(this.abortReason!==void 0)return 0;if(this.encodingLevel===`string`){let t;try{t=JSON.stringify(e)}catch(e){try{this.abort(e)}catch{}throw e}try{let e=this.transport.send(t);e!==void 0&&typeof e.catch==`function`&&e.catch(e=>this.abort(e,!1))}catch(e){queueMicrotask(()=>this.abort(e,!1))}return t.length}try{let t=this.transport.send(e);if(typeof t==`number`)return t;let n=t;n&&typeof n.then==`function`&&Promise.resolve(n).catch(e=>this.abort(e,!1));return}catch(e){queueMicrotask(()=>this.abort(e,!1));return}}sendCall(e,t,n){if(this.abortReason)throw n?.dispose(),this.abortReason;let r=[`pipeline`,e,t];if(n){let e;try{e=Hi.devaluate(n.value,void 0,this,n,this.encodingLevel)}catch(e){throw n.dispose(),e}r.push(e[0])}this.send([`push`,r]);let i=new Qi(this,this.imports.length,!1);return this.imports.push(i),new $i(!0,i)}sendStream(e,t,n){if(this.abortReason)throw n.dispose(),this.abortReason;let r=[`pipeline`,e,t],i;try{i=Hi.devaluate(n.value,void 0,this,n,this.encodingLevel)}catch(e){throw n.dispose(),e}r.push(i[0]);let a=[`stream`,r],o=this.send(a);o===void 0&&(o=Zi(a));let s=this.imports.length,c=new Qi(this,s,!0);return c.remoteRefcount=0,c.localRefcount=1,this.imports.push(c),{promise:c.awaitResolution().then(e=>{e.dispose(),delete this.imports[s]},e=>{throw delete this.imports[s],e}),size:o}}sendMap(e,t,n,r){if(this.abortReason){for(let e of n)e.dispose();throw this.abortReason}let i=[`remap`,e,t,n.map(e=>{let t=this.getImport(e);return t===void 0?[`export`,this.exportStub(e)]:[`import`,t]}),r];this.send([`push`,i]);let a=new Qi(this,this.imports.length,!1);return this.imports.push(a),new $i(!0,a)}sendPull(e){if(this.abortReason)throw this.abortReason;this.send([`pull`,e])}sendRelease(e,t){this.abortReason||(this.send([`release`,e,t]),delete this.imports[e])}abort(e,t=!0){if(this.abortReason===void 0){if(this.cancelReadLoop?.(e),this.cancelReadLoop=void 0,t)try{let t=[`abort`,Hi.devaluate(e,void 0,this,void 0,this.encodingLevel)];if(this.encodingLevel===`string`){let e=this.transport.send(JSON.stringify(t));e!==void 0&&typeof e.catch==`function`&&e.catch(e=>{})}else{let e=this.transport.send(t);e&&typeof e.then==`function`&&Promise.resolve(e).catch(e=>{})}}catch{}if(e===void 0&&(e=`undefined`),this.abortReason=e,this.onBatchDone&&this.onBatchDone.reject(e),this.transport.abort)try{this.transport.abort(e)}catch(e){Promise.resolve(e)}for(let t in this.onBrokenCallbacks)try{this.onBrokenCallbacks[t](e)}catch(e){Promise.resolve(e)}for(let t in this.imports)this.imports[t].abort(e);for(let e in this.exports)this.exports[e].hook.dispose()}}async readLoop(){for(;!this.abortReason;){let e=Promise.withResolvers();this.cancelReadLoop=e.reject;let t;try{t=await Promise.race([this.transport.receive(),e.promise])}finally{this.cancelReadLoop===e.reject&&(this.cancelReadLoop=void 0)}if(this.encodingLevel===`string`&&t.length>this.limits.maxMessageSize)throw TypeError(`Incoming message exceeds maximum size of ${this.limits.maxMessageSize} UTF-16 code units.`);if(this.abortReason)break;let n=this.encodingLevel===`string`?JSON.parse(t):t;if(n instanceof Array)switch(n[0]){case`push`:if(n.length>1){let e=new Di(new Gi(this,this.encodingLevel).evaluate(n[1]));e.ignoreUnhandledRejections(),this.exports.push({hook:e,refcount:1});continue}break;case`stream`:if(n.length>1){let e=new Di(new Gi(this,this.encodingLevel).evaluate(n[1]));e.ignoreUnhandledRejections();let t=this.exports.length;this.exports.push({hook:e,refcount:1,autoRelease:!0}),this.ensureResolvingExport(t);continue}break;case`pipe`:{let{readable:e,writable:t}=new TransformStream,n=ci.createWritableStreamHook(t);this.exports.push({hook:n,refcount:1,pipeReadable:e});continue}case`pull`:{let e=n[1];if(typeof e==`number`){this.ensureResolvingExport(e);continue}break}case`resolve`:case`reject`:{let e=n[1];if(typeof e==`number`&&n.length>2){let t=this.imports[e];if(t){if(n[0]==`resolve`)t.resolve(new Di(new Gi(this,this.encodingLevel).evaluate(n[2])));else{let e=new Gi(this,this.encodingLevel).evaluate(n[2]);e.dispose(),t.resolve(new ui(e.value))}}else n[0]==`resolve`&&new Gi(this,this.encodingLevel).evaluate(n[2]).dispose();continue}break}case`release`:{let e=n[1],t=n[2];if(typeof e==`number`&&typeof t==`number`){this.releaseExport(e,t);continue}break}case`abort`:{let e=new Gi(this,this.encodingLevel).evaluate(n[1]);e.dispose(),this.abort(e.value,!1);break}}throw Error(`bad RPC message: ${JSON.stringify(n)}`)}}async drain(){if(this.abortReason)throw this.abortReason;if(this.pullCount>0){let{promise:e,resolve:t,reject:n}=Promise.withResolvers();this.onBatchDone={resolve:t,reject:n},await e}}getStats(){let e={imports:0,exports:0};for(let t in this.imports)++e.imports;for(let t in this.exports)++e.exports;return e}},na=class{#e;#t;constructor(e,t,n={}){let r;r=t?new Di(wi.fromAppReturn(t)):new ui(Error(`This connection has no main object.`)),this.#e=new ta(e,r,n),this.#t=new gi(this.#e.getMainImport())}getRemoteMain(){return this.#t}getStats(){return this.#e.getStats()}drain(){return this.#e.drain()}};function ra(e,t,n){return new na(new ia(e),t,n).getRemoteMain()}var ia=class{encodingLevel=`structuredClonable`;constructor(e){this.#e=e,e.start(),e.addEventListener(`message`,e=>{this.#i||(e.data===null?this.#a(Error(`Peer closed MessagePort connection.`)):this.#t?(this.#t(e.data),this.#t=void 0,this.#n=void 0):this.#r.push(e.data))}),e.addEventListener(`messageerror`,e=>{this.#a(Error(`MessagePort message error.`))})}#e;#t;#n;#r=[];#i;send(e){if(this.#i)throw this.#i;this.#e.postMessage(e)}async receive(){if(this.#r.length>0)return this.#r.shift();if(this.#i)throw this.#i;return new Promise((e,t)=>{this.#t=e,this.#n=t})}abort(e){try{this.#e.postMessage(null)}catch{}this.#e.close(),this.#i||=e}#a(e){this.#i||(this.#i=e,this.#n&&=(this.#n(e),this.#t=void 0,void 0))}},aa,oa=class{context;captureMap=new Map;instructions=[];constructor(e,t){this.context=aa?{parent:aa,captures:[],subject:aa.capture(e),path:t}:{parent:void 0,captures:[],subject:e,path:t},aa=this}unregister(){aa=this.context.parent}makeInput(){return new ca(this,0)}makeOutput(e){let t;try{t=Hi.devaluate(e.value,void 0,this,e)}finally{e.dispose()}return this.instructions.push(t),this.context.parent?(this.context.parent.instructions.push([`remap`,this.context.subject,this.context.path,this.context.captures.map(e=>[`import`,e]),this.instructions]),new ca(this.context.parent,this.context.parent.instructions.length)):this.context.subject.map(this.context.path,this.context.captures,this.instructions)}pushCall(e,t,n){let r=Hi.devaluate(n.value,void 0,this,n);r=r[0];let i=this.capture(e.dup());return this.instructions.push([`pipeline`,i,t,r]),new ca(this,this.instructions.length)}pushGet(e,t){let n=this.capture(e.dup());return this.instructions.push([`pipeline`,n,t]),new ca(this,this.instructions.length)}capture(e){if(e instanceof ca&&e.mapper===this)return e.idx;let t=this.captureMap.get(e);if(t===void 0){if(this.context.parent){let t=this.context.parent.capture(e);this.context.captures.push(t)}else this.context.captures.push(e);t=-this.context.captures.length,this.captureMap.set(e,t)}return t}exportStub(e){throw Error(`Can't construct an RpcTarget or RPC callback inside a mapper function. Try creating a new RpcStub outside the callback first, then using it inside the callback.`)}exportPromise(e){return this.exportStub(e)}getImport(e){return this.capture(e)}unexport(e){}createPipe(e){throw Error(`Cannot send ReadableStream inside a mapper function.`)}onSendError(e){}};oi.sendMap=(e,t,n)=>{let r=new oa(e,t),i;try{i=wi.fromAppReturn(pi(r.pushCall.bind(r),()=>n(new _i(r.makeInput(),[]))))}finally{r.unregister()}if(i instanceof Promise)throw i.catch(e=>{}),Error(`RPC map() callbacks cannot be async.`);return new _i(r.makeOutput(i),[])};function sa(){throw Error(`Attempted to use an abstract placeholder from a mapper function. Please make sure your map function has no side effects.`)}var ca=class extends li{mapper;idx;constructor(e,t){super(),this.mapper=e,this.idx=t}dup(){return this}dispose(){}get(e){if(e.length==0)return this;if(aa)return aa.pushGet(this,e);sa()}call(e,t){t.dispose(),sa()}map(e,t,n){for(let e of t)e.dispose();sa()}pull(){sa()}ignoreUnhandledRejections(){}onBroken(e){sa()}},la=class{captures;variables;constructor(e,t){this.captures=e,this.variables=[t]}dispose(){for(let e of this.variables)e.dispose()}apply(e){try{if(e.length<1)throw Error(`Invalid empty mapper function.`);for(let t of e.slice(0,-1)){let e=new Gi(this).evaluateCopy(t);if(e.value instanceof gi){let t=bi(e.value);if(t){this.variables.push(t);continue}}this.variables.push(new Di(e))}return new Gi(this).evaluateCopy(e[e.length-1])}finally{for(let e of this.variables)e.dispose()}}importStub(e){throw Error(`A mapper function cannot refer to exports.`)}importPromise(e){return this.importStub(e)}getExport(e){return e<0?this.captures[-e-1]:this.variables[e]}getPipeReadable(e){throw Error(`A mapper function cannot use pipe readables.`)}getLimits(){return ji}};function ua(e,t,n,r,i){let a=new la(r,new Di(wi.deepCopyFrom(e,t,n)));try{return a.apply(i)}finally{a.dispose()}}oi.applyMap=(e,t,n,r,i)=>{try{let a;if(e instanceof _i)throw Error(`applyMap() can't be called on RpcPromise`);if(e instanceof Array){let t=[];try{for(let a of e)t.push(ua(a,e,n,r,i))}catch(e){for(let e of t)e.dispose();throw e}a=wi.fromArray(t)}else a=e==null?wi.fromAppReturn(e):ua(e,t,n,r,i);return new Di(a)}finally{for(let e of r)e.dispose()}};var da=class e extends li{state;static create(t){let n=t.getWriter();return new e({refcount:1,writer:n,closed:!1})}constructor(e,t){super(),this.state=e,t&&++e.refcount}getState(){if(this.state)return this.state;throw Error(`Attempted to use a WritableStreamStubHook after it was disposed.`)}call(e,t){try{let n=this.getState();if(e.length!==1||typeof e[0]!=`string`)throw Error(`WritableStream stub only supports direct method calls`);let r=e[0];if(r!==`write`&&r!==`close`&&r!==`abort`)throw Error(`Unknown WritableStream method: ${r}`);return(r===`close`||r===`abort`)&&(n.closed=!0),new Ai((r===`write`?t.deliverStreamWrite(n.writer):t.deliverCall(n.writer[r],n.writer)).then(e=>new Di(e)))}catch(e){return t.dispose(),new ui(e)}}map(e,t,n){for(let e of t)e.dispose();return new ui(Error(`Cannot use map() on a WritableStream`))}get(e){return new ui(Error(`Cannot access properties on a WritableStream stub`))}dup(){let t=this.getState();return new e(t,this)}pull(){return Promise.reject(Error(`Cannot pull a WritableStream stub`))}ignoreUnhandledRejections(){}dispose(){let e=this.state;this.state=void 0,e&&--e.refcount===0&&(e.closed||e.writer.abort(Error(`WritableStream RPC stub was disposed without calling close()`)).catch(()=>{}),e.writer.releaseLock())}onBroken(e){}},fa=262144,pa=1073741824,ma=65536,ha=2,ga=1.25,_a=.9,va=3,ya=class{now;window=fa;bytesInFlight=0;inStartupPhase=!0;delivered=0;deliveredTime=0;firstAckTime=0;firstAckDelivered=0;minRtt=1/0;roundsWithoutIncrease=0;lastRoundWindow=0;roundStartTime=0;constructor(e){this.now=e}onSend(e){this.bytesInFlight+=e;let t={sentTime:this.now(),size:e,deliveredAtSend:this.delivered,deliveredTimeAtSend:this.deliveredTime,windowAtSend:this.window,windowFullAtSend:this.bytesInFlight>=this.window};return{token:t,shouldBlock:t.windowFullAtSend}}onError(e){this.bytesInFlight-=e.size}onAck(e){let t=this.now();this.delivered+=e.size,this.deliveredTime=t,this.bytesInFlight-=e.size;let n=t-e.sentTime;if(this.minRtt=Math.min(this.minRtt,n),this.firstAckTime===0)this.firstAckTime=t,this.firstAckDelivered=this.delivered;else{let n,r;e.deliveredTimeAtSend===0?(n=this.firstAckTime,r=this.firstAckDelivered):(n=e.deliveredTimeAtSend,r=e.deliveredAtSend);let i=t-n,a=(this.delivered-r)/i,o=this.inStartupPhase?ha:ga,s=a*this.minRtt*o;s=Math.min(s,e.windowAtSend*o),s=e.windowFullAtSend?Math.max(s,e.windowAtSend*_a):Math.max(s,this.window),this.window=Math.max(Math.min(s,pa),ma),this.inStartupPhase&&e.sentTime>=this.roundStartTime&&(this.window>this.lastRoundWindow*ga?this.roundsWithoutIncrease=0:++this.roundsWithoutIncrease>=va&&(this.inStartupPhase=!1),this.roundStartTime=t,this.lastRoundWindow=this.window)}return this.bytesInFlight<this.window}};function ba(e){let t,n=!1,r=new ya(()=>performance.now()),i,a,o=()=>{n||(n=!0,e.dispose())};return new WritableStream({write(n,s){if(t!==void 0)throw t;let c=wi.fromAppParams([n]),{promise:l,size:u}=e.stream([`write`],c);if(u===void 0)return l.catch(e=>{throw t===void 0&&(t=e),e});{let{token:e,shouldBlock:n}=r.onSend(u);if(l.then(()=>{r.onAck(e)&&i&&(i(),i=void 0,a=void 0)},n=>{r.onError(e),t===void 0&&(t=n,s.error(n),o()),a&&=(a(n),i=void 0,void 0)}),n)return new Promise((e,t)=>{i=e,a=t})}},async close(){if(t!==void 0)throw o(),t;let{promise:n}=e.stream([`close`],wi.fromAppParams([]));try{await n}catch(e){throw t??e}finally{o()}},abort(n){if(t!==void 0)return;t=n??Error(`WritableStream was aborted`),a&&=(a(t),i=void 0,void 0);let{promise:r}=e.stream([`abort`],wi.fromAppParams([n]));r.then(()=>o(),()=>o())}})}var xa=class e extends li{state;static create(t){return new e({refcount:1,stream:t,canceled:!1})}constructor(e,t){super(),this.state=e,t&&++e.refcount}call(e,t){return t.dispose(),new ui(Error(`Cannot call methods on a ReadableStream stub`))}map(e,t,n){for(let e of t)e.dispose();return new ui(Error(`Cannot use map() on a ReadableStream`))}get(e){return new ui(Error(`Cannot access properties on a ReadableStream stub`))}dup(){let t=this.state;if(!t)throw Error(`Attempted to dup a ReadableStreamStubHook after it was disposed.`);return new e(t,this)}pull(){return Promise.reject(Error(`Cannot pull a ReadableStream stub`))}ignoreUnhandledRejections(){}dispose(){let e=this.state;this.state=void 0,e&&--e.refcount===0&&(e.canceled||(e.canceled=!0,e.stream.locked||e.stream.cancel(Error(`ReadableStream RPC stub was disposed without being consumed`)).catch(()=>{})))}onBroken(e){}};ci.createWritableStreamHook=da.create,ci.createWritableStreamFromHook=ba,ci.createReadableStreamHook=xa.create;var Sa=gi,Ca=ti,wa=ra;function Ta(e){return e<32||e>=127&&e<=159||e===1564||e>=8203&&e<=8207||e===8232||e===8233||e>=8234&&e<=8238||e>=8294&&e<=8297||e===65279}function Ea(e,t){let n=e.find(e=>e.id===t.itemId);if(n===void 0||n.kind===`text`)return!1;if(n.kind===`menu`){let e=n.options.find(e=>e.id===t.optionId);return e!==void 0&&e.disabled!==!0}return t.optionId===void 0?n.kind!==`button`||n.disabled!==!0:!1}Object.freeze({publish:()=>Promise.resolve(),onBack:()=>()=>void 0,onActivate:()=>()=>void 0});function Da(e,t){if(t.kind===`action`){let n=[...e.primary??[],...e.menu??[]].find(e=>e.id===t.actionId);return n!==void 0&&n.disabled!==!0}let n=e.crumbs?.find(e=>e.id===t.crumbId);return n===void 0?!1:t.siblingId===void 0||n.siblings?.some(e=>e.id===t.siblingId)===!0}function Oa(e){let t=e.trim().toLowerCase();if(!t)throw Error(`Invalid keymap token: token cannot be empty`);return t}function ka(e){let t=e.trim().toLowerCase();if(!t)throw Error(`Invalid key name: key name cannot be empty`);return t}function Aa(e){return{name:ka(e.name),ctrl:e.ctrl??!1,shift:e.shift??!1,meta:e.meta??!1,super:e.super??!1,hyper:e.hyper||void 0}}function ja(e){return{name:e.name,ctrl:e.ctrl,shift:e.shift,meta:e.meta,super:e.super,hyper:e.hyper||void 0}}function Ma(e,t){let n=ja(Aa(e));return{stroke:n,display:t?.display??Ba(n),match:t?.match??Ia(n),tokenName:t?.tokenName?Oa(t.tokenName):void 0}}function Na(e){return{stroke:ja(e.stroke),display:e.display,match:e.match,tokenName:e.tokenName,patternName:e.patternName,payloadKey:e.payloadKey}}function Pa(e){return e.map(e=>Na(e))}function Fa(e){return`match`in e?e.match:`stroke`in e?Ia(e.stroke):Ia(e)}function Ia(e){return`key:${Va(Aa(e))}`}function La(e){let t=e.trim();if(!t)throw Error(`Invalid keymap match id: id cannot be empty`);return`text:${t}`}function Ra(e,t){return`stroke`in e?t?.preferDisplay&&e.display?e.display:Ba(e.stroke):Ba(Aa(e))}function za(e,t){return e.map(e=>Ra(e,t)).join(t?.separator??``)}function Ba(e){let t=[];return e.ctrl&&t.push(`ctrl`),e.shift&&t.push(`shift`),e.meta&&t.push(`meta`),e.super&&t.push(`super`),e.hyper&&t.push(`hyper`),t.push(e.name===`return`?`enter`:e.name),t.join(`+`)}function Va(e){return`${e.name}:${+!!e.ctrl}:${+!!e.shift}:${+!!e.meta}:${+!!e.super}:${+!!e.hyper}`}var Ha=Symbol(`keymap-extension-context`);function Ua(e){return e.isDestroyed?null:e.getFocusedTarget()}function Wa(e,t,n){let r=t??e.rootTarget,i=t!==null;for(;r;){if(n(r,i)===!1)return;r=e.getParentTarget(r),i=!1}}function Ga(e,t){let n=new Set;return Wa(e,t,e=>{n.add(e)}),n}function Ka(e,t,n){let r=[],i=Ga(t,n),a=Array.isArray(e)?e:qa(e);for(let e of a)Ja(t,e,n,i)&&r.push(e);return r}function qa(e){return[...e].sort((e,t)=>t.priority-e.priority||t.order-e.order)}function Ja(e,t,n,r=Ga(e,n)){let i=t.target;return i?e.isTargetDestroyed(i)?!1:t.targetMode===`focus`?i===n:r.has(i):!0}function Ya(e){let t=e.binding.sequence[e.index];if(!t?.patternName)return 0;let n=e.patterns?.at(-1);return n?.name===t.patternName?n.values.length:0}function Xa(e,t,n=!0){let r=e.binding.sequence[e.index];if(!r?.patternName)return!0;let i=t.get(r.patternName);return i?Ya(e)>=i.min:n}function Za(e,t,n=!0){let r=e.binding.sequence[e.index];if(r?.patternName){let n=t.get(r.patternName);if(n&&Ya(e)<n.max)return!0}return Xa(e,t,n)&&e.index+1<e.binding.sequence.length}function Qa(e,t){return e.index===e.binding.sequence.length-1&&Xa(e,t,!1)}function $a(e,t,n,r){return{parent:e,depth:e?e.depth+1:0,stroke:t,match:n,pattern:r,children:new Map,patternChildren:[],bindings:[],reachableBindings:[]}}function eo(e,t){let n=$a(null,null,null);for(let r of e){if(r.event!==`press`)continue;let e=n;for(let n of r.sequence){let i;if(n.patternName){let r=t.get(n.patternName);i=e.patternChildren.find(e=>e.pattern?.name===n.patternName),i||(i=$a(e,n.stroke,n.match,r),e.patternChildren.push(i))}else i=e.children.get(n.match),i||(i=$a(e,n.stroke,n.match),e.children.set(n.match,i));i.reachableBindings.push(r),e=i}e.bindings.push(r)}return n}function to(e,t){let n=[];for(let r of e){if(!Xa(r,t))continue;let e=r.index+1,i=r.binding.sequence[e];i&&n.push({part:i,binding:r.binding,index:e,exact:e===r.binding.sequence.length-1,continues:e<r.binding.sequence.length-1})}return n}function no(e,t,n,r){let i=n.patternName;if(!i)return{...e,index:t};let a=[...e.patterns??[]],o=a.at(-1);return o?.name===i?a[a.length-1]={...o,values:[...o.values,r],parts:[...o.parts,n]}:a.push({name:i,payloadKey:n.payloadKey??i,values:[r],parts:[n]}),{layer:e.layer,binding:e.binding,index:t,parts:[...e.parts,n],patterns:a}}function ro(e,t){let n=e.parts.at(-1);if(!n||n.patternName)return t.length;let r=t.indexOf(n.match);return r===-1?t.length:r}function io(e,t,n,r,i,a,o,s,c){let l=t.sequence[n];if(l){if(l.patternName){let a=s(l.patternName,o);if(!a)return;let u=c(o,l.patternName,a);return no({layer:e,binding:t,index:n,parts:r,patterns:i},n,u,a.value??o.name)}if(a.includes(l.match))return{layer:e,binding:t,index:n,parts:[...r,l],patterns:i}}}function ao(e,t,n,r,i,a){let o=e.binding.sequence[e.index];if(o?.patternName){let s=r.get(o.patternName);if(s&&Ya(e)<s.max){let t=i(s.name,n);if(t){let r=a(n,s.name,t);return no(e,e.index,r,t.value??n.name)}}return Xa(e,r,!1)?io(e.layer,e.binding,e.index+1,e.parts,e.patterns,t,n,i,a):void 0}return io(e.layer,e.binding,e.index+1,e.parts,e.patterns,t,n,i,a)}function oo(e,t,n,r,i){let a=[],o=1/0;for(let s of e.bindings){if(s.event!==`press`)continue;let c=io(e,s,0,[],void 0,t,n,r,i);if(!c)continue;let l=ro(c,t);l<o&&(o=l,a.length=0),l===o&&a.push(c)}return a}import.meta.require;function so(e){let t=Object.create(null),n=(e,n)=>{let r=t[e];if(!r)return;let i=r.filter(e=>e!==n);i.length===0?delete t[e]:i.length!==r.length&&(t[e]=i)};return{hook(e,r){return t[e]=[...t[e]??[],r],()=>n(e,r)},has(e){return(t[e]?.length??0)>0},emit(n,...r){let i=t[n];if(i)for(let t of i)try{r.length===0?t():t(r[0])}catch(t){e(n,t)}}}}function co(){let e=[];return{get:()=>e,set:t=>{e=t},remove(t){e=e.filter(e=>e!==t)},has:()=>e.length>0,clear:()=>{e=[]}}}function lo(){let e=co();return{append(t){return e.set([...e.get(),t]),()=>e.remove(t)},prepend(t){return e.set([t,...e.get()]),()=>e.remove(t)},values:e.get,has:e.has,clear:e.clear}}function uo(){let e=co(),t=0;return{register(n,r){let i={...r,listener:n,order:t++};return e.set([...e.get(),i].sort((e,t)=>t.priority-e.priority||e.order-t.order)),()=>e.remove(i)},entries:e.get,has:e.has,clear:e.clear}}function fo(e){return typeof e==`string`||!!e&&typeof e==`object`&&!Array.isArray(e)}function po(e){if(!Array.isArray(e))return{ok:!1,reason:`Invalid keymap bindings: expected an array of binding objects`};for(let[t,n]of e.entries()){if(!n||typeof n!=`object`||Array.isArray(n))return{ok:!1,reason:`Invalid keymap binding at index ${t}: expected a binding object`};if(!fo(n.key))return{ok:!1,reason:`Invalid keymap binding at index ${t}: expected "key" to be a string or keystroke object`}}return{ok:!0}}function mo(e){let t=po(e);if(!t.ok)throw Error(t.reason);return e.map(e=>({...e,key:typeof e.key==`string`?e.key:{...e.key}}))}function ho(e){return{...e,sequence:Pa(e.sequence)}}function go(e,t){let n=lo();return{prependLayerAnalyzer(e){return n.prepend(e)},appendLayerAnalyzer(e){return n.append(e)},clearLayerAnalyzers(){n.clear()},analyzeLayer(r){let i=n.values();if(i.length===0)return;let a=_o(r.bindings),o={target:r.target,order:r.order,sourceBindings:r.sourceBindings,bindings:a,hasTokenBindings:r.hasTokenBindings,checkCommandResolution(e){return t.getCommandResolutionStatus(e,r.commands)},warn(t,n,r){e.emitWarning(t,n,r)},warnOnce(t,n,r,i){e.warnOnce(t,n,r,i)},error(t,n,r){e.emitError(t,n,r)}};for(let t of i)try{t(o)}catch(t){e.emitError(`layer-analyzer-error`,t,`[Keymap] Error in layer analyzer:`)}}}}function _o(e){return e.map(t=>({sequence:Pa(t.sequence),command:t.command,attrs:t.attrs,event:t.event,preventDefault:t.preventDefault,fallthrough:t.fallthrough,parsedBinding:ho(t.parsedBinding),sourceTarget:t.sourceTarget,sourceLayerOrder:t.sourceLayerOrder,bindingIndex:t.bindingIndex,hasCommandAtSequence:e.some(e=>e.event===`press`&&e.command!==void 0&&vo(e,t)),hasContinuations:e.some(e=>e.event===`press`&&yo(t,e))}))}function vo(e,t){return e.sequence.length===t.sequence.length&&e.sequence.every((e,n)=>e.match===t.sequence[n]?.match)}function yo(e,t){return e.sequence.length<t.sequence.length&&e.sequence.every((e,n)=>e.match===t.sequence[n]?.match)}function bo(){return{version:-1,notifyVersion:-1,focused:void 0,value:[],targets:new WeakMap}}function xo(){return{plain:bo(),bindings:bo(),metadata:bo(),bindingsAndMetadata:bo()}}function So(e,t){if(t===void 0)return e.plain;let n=t.includeBindings===!0,r=t.includeMetadata===!0;return n?r?e.bindingsAndMetadata:e.bindings:r?e.metadata:e.plain}function Co(e,t,n){let r=n?e.targets.get(n):e.nullTarget;return r?.version===t?r:void 0}function wo(e,t,n,r){let i={version:t,value:r};n?e.targets.set(n,i):e.nullTarget=i}function To(e,t){if(e===t)return!0;if(!e||!t||e.captures.length!==t.captures.length)return!1;for(let n=0;n<e.captures.length;n+=1){let r=e.captures[n],i=t.captures[n];if(!r||!i||r.layer!==i.layer||r.binding!==i.binding||r.index!==i.index||r.parts.length!==i.parts.length)return!1;for(let e=0;e<r.parts.length;e+=1)if(r.parts[e]?.match!==i.parts[e]?.match)return!1;let a=r.patterns??[],o=i.patterns??[];if(a.length!==o.length)return!1;for(let e=0;e<a.length;e+=1){let t=a[e],n=o[e];if(!t||!n||t.name!==n.name||t.values.length!==n.values.length)return!1;for(let e=0;e<t.values.length;e+=1)if(!Object.is(t.values[e],n.values[e]))return!1}}return!0}function Eo(e){let t=e.parts.at(-1);if(!t||e.parts.length<=1)return;let n=e.index-1,r=e.patterns;if(t.patternName){let i=r?.at(-1);i?.name===t.patternName&&(i.values.length>1?(n=e.index,r=[...(r??[]).slice(0,-1),{...i,values:i.values.slice(0,-1),parts:i.parts.slice(0,-1)}]):r=(r??[]).slice(0,-1))}return{layer:e.layer,binding:e.binding,index:n,parts:e.parts.slice(0,-1),patterns:r}}function Do(e){let t=e.captures[0];if(!t||t.parts.length===0)return[];let n=[];for(let r=0;r<t.parts.length;r+=1){let i=t.parts[r];if(!i)continue;let a,o,s=!1,c=!1;for(let t of e.captures){let e=t.parts[r];if(e){if(a===void 0){a=e.display,o=e.tokenName;continue}!s&&a!==e.display&&(s=!0),!c&&o!==e.tokenName&&(c=!0)}}(a===void 0||s)&&(a=Ra(i.stroke)),c&&(o=void 0),n.push(Ma(i.stroke,{display:a,match:i.match,tokenName:o}))}return n}function Oo(e){if(e.isDestroyed)throw Error(`Cannot use a keymap after its host was destroyed`);return e}function ko(e,t,n,r,i,a,o={}){let s=xo(),c=-1,l=[],u=()=>Oo(t).getFocusedTarget(),d=()=>Ua(t),f=t=>{let n=e.pending;To(n,t)||(e.pending=t,o.onPendingSequenceChanged?.(n,t),me(),r.queueStateChange())},p=()=>{let t=e.pending;if(!t)return;let n=u(),r=a.getActiveCommandView(n),o=t.captures.filter(t=>e.layers.has(t.layer)&&C(t.layer,n)&&i.matchesConditions(t.layer)&&w(t.binding,n,r)&&Za(t,e.patterns));if(o.length===0){f(null);return}return o.length!==t.captures.length&&f({captures:o}),e.pending??void 0},m=()=>{t.isDestroyed||!e.pending||p()},h=()=>!t.isDestroyed&&e.pending!==null,g=()=>{if(c===e.cacheVersion)return l;let t=p(),n=t?Do(t):[];return(!t||te())&&(c=e.cacheVersion,l=n),n},_=()=>{let e=p();if(!e)return!1;let t=e.captures[0];if(!t||t.parts.length<=1)return f(null),!0;let n=[];for(let t of e.captures){let e=Eo(t);e&&n.push(e)}return n.length===0?(f(null),!0):(f({captures:n}),!0)},v=t=>{let n=t?.includeBindings===!0,r=t?.includeMetadata===!0,i=So(s,t);return i.notifyVersion===e.derivedVersion?i.value:y(i,n,r)},y=(n,r,i)=>{t.isDestroyed&&Oo(t);let o=u(),s=Co(n,e.cacheVersion,o);if(s)return n.notifyVersion=e.derivedVersion,n.version=e.cacheVersion,n.focused=o,n.value=s.value,s.value;let c=a.getActiveCommandView(o),l=p(),d=l?[]:S(o),f=l?A(l.captures,r,i,o,c):D(d,r,i,o,c);return(l?te():ee(d))&&(n.version=e.cacheVersion,n.notifyVersion=e.derivedVersion,n.focused=o,n.value=f,wo(n,e.cacheVersion,o,f)),f},b=(e,t)=>{let n=t?.includeBindings===!0,r=t?.includeMetadata===!0,i=u(),o=a.getActiveCommandView(i);return A(e,n,r,i,o)},x=(e,t)=>{let n=t?.includeBindings===!0,r=t?.includeMetadata===!0,i=e===d()?p():void 0,o=a.getActiveCommandView(e);return i?A(i.captures,n,r,e,o):D(S(e),n,r,e,o)},S=n=>e.activeLayersCacheVersion===e.cacheVersion&&e.activeLayersCacheFocused===n?e.activeLayersCache:(e.activeLayersCacheVersion=e.cacheVersion,e.activeLayersCacheFocused=n,e.activeLayersCache=Ka(e.sortedLayers,t,n),e.activeLayersCache),C=(e,n)=>Ja(t,e,n),ee=t=>!e.commandResolvers.has()&&e.activeKeyCacheBlockers===0,te=()=>!e.commandResolvers.has()&&e.activeKeyCacheBlockers===0,ne=(e,t,n)=>{let r=[];for(let o of e)i.matchesConditions(o)&&a.isBindingVisible(o,t,n)&&r.push(o);return r},w=(e,t,n)=>i.matchesConditions(e)&&a.isBindingVisible(e,t,n),T=(e,t)=>{let n,r,i=!1,a=!1;for(let o of e){let e=o.sequence[t];if(e){if(n===void 0){n=e.display,r=e.tokenName;continue}!i&&n!==e.display&&(i=!0),!a&&r!==e.tokenName&&(a=!0)}}if(n===void 0||i){let r=e[0]?.sequence[t]?.stroke;n=r?Ra(r):``}return a&&(r=void 0),{display:n,tokenName:r}},E=(e,t,n)=>({sequence:e.sequence,command:e.command,commandAttrs:a.getBindingCommandAttrs(e,t,n),attrs:e.attrs,event:e.event,preventDefault:e.preventDefault,fallthrough:e.fallthrough}),re=(e,t,n)=>e.map(e=>E(e,t,n)),D=(e,t,n,r,a)=>{let o=new Map,s=new Set;for(let n of e)n.root.children.size===0&&n.root.patternChildren.length===0||!i.matchesConditions(n)||(O(n.root.children.values(),o,s,t,r,a),O(n.root.patternChildren,o,s,t,r,a));return se(o,t,n,r,a)},O=(e,t,n,r,i,a)=>{for(let o of e){let e=o.match;if(!e||n.has(e)||!o.stroke)continue;let s=k(o,r,i,a);if(!s)continue;let c=t.get(e);c?fe(c,s,r):t.set(e,de(o.stroke,s,r)),s.stop&&n.add(e)}},k=(e,t,n,r)=>{if(!(e.children.size>0||e.patternChildren.length>0)){let i=ue(ie(e)?ne(e.bindings,n,r):e.bindings,n,r);if(!i)return;let a=T(i.bindings,e.depth-1);return{display:a.display,tokenName:a.tokenName,continues:!1,firstBinding:i.bindings[0],commandBinding:i.commandBinding,bindings:t?[...i.bindings]:void 0,stop:i.stop}}let i=ne(e.reachableBindings,n,r);if(i.length===0)return;let a=ue(e.bindings,n,r),o=T(i,e.depth-1);return{display:o.display,tokenName:o.tokenName,continues:!0,firstBinding:a?.bindings[0],commandBinding:a?.commandBinding,bindings:t&&a?[...a.bindings]:void 0,stop:!0}},ie=t=>{if(e.commandResolvers.has())return!0;for(let e of t.bindings)if(e.matchers.length>0)return!0;return!1},A=(t,n,r,i,a)=>{let o=new Map,s=new Set;return ae(to(t,e.patterns),o,s,n,i,a),se(o,n,r,i,a)},ae=(e,t,n,r,i,a)=>{let o=new Set;for(let s of e)o.has(s.part.match)||(o.add(s.part.match),oe(s,e,t,n,r,i,a))},oe=(e,t,n,r,i,a,o)=>{let s=e.part.match;if(r.has(s))return;let c=ce(e,t,i,a,o);if(!c)return;let l=n.get(s);l?fe(l,c,i):n.set(s,de(e.part.stroke,c,i)),c.stop&&r.add(s)},se=(e,t,n,r,i)=>{let a=[];for(let o of e.values()){let e=pe(o,t,n,r,i);e&&a.push(e)}return a},ce=(e,t,n,r,i)=>{let a=t.filter(t=>t.part.match===e.part.match),o=a.filter(e=>e.exact).map(e=>e.binding),s=ue(o,r,i),c=a.some(e=>e.continues);if(!c&&!s)return;let l=le(a);return{display:l.display,tokenName:l.tokenName,continues:c,firstBinding:s?.bindings[0],commandBinding:s?.commandBinding,bindings:n&&s?[...s.bindings]:void 0,stop:c||s?.stop===!0}},le=e=>{let t,n,r=!1,i=!1;for(let a of e){let e=a.part;if(t===void 0){t=e.display,n=e.tokenName;continue}!r&&t!==e.display&&(r=!0),!i&&n!==e.tokenName&&(i=!0)}let a=e[0]?.part;return(t===void 0||r)&&(t=a?Ra(a.stroke):``),i&&(n=void 0),{display:t,tokenName:n}},ue=(e,t,n)=>{let r=[],o;for(let s of e)if(!(!i.matchesConditions(s)||!a.isBindingVisible(s,t,n))&&(r.push(s),s.command!==void 0&&(o??=s,!s.fallthrough)))return{bindings:r,commandBinding:o,stop:!0};if(r.length!==0)return{bindings:r,commandBinding:o,stop:!1}},de=(e,t,n)=>({stroke:e,display:t.display,tokenName:t.tokenName,continues:t.continues,firstBinding:t.firstBinding,commandBinding:t.commandBinding,bindings:n&&t.bindings?[...t.bindings]:void 0}),fe=(e,t,n)=>{if(!e.firstBinding&&t.firstBinding&&(e.firstBinding=t.firstBinding),!e.commandBinding&&t.commandBinding&&(e.commandBinding=t.commandBinding),t.continues&&(e.continues=!0),!(!n||!t.bindings||t.bindings.length===0)){if(!e.bindings){e.bindings=[...t.bindings];return}e.bindings.push(...t.bindings)}},pe=(e,t,n,r,i)=>{if(!e.commandBinding&&!e.continues)return;let o={stroke:ja(e.stroke),display:e.display,continues:e.continues};if(e.tokenName&&(o.tokenName=e.tokenName),e.commandBinding&&(o.command=e.commandBinding.command),t&&e.bindings&&e.bindings.length>0&&(o.bindings=e.bindings.length===1?[E(e.bindings[0],r,i)]:re(e.bindings,r,i)),n){e.firstBinding?.attrs&&(o.bindingAttrs=e.firstBinding.attrs);let t=e.commandBinding?a.getBindingCommandAttrs(e.commandBinding,r,i):void 0;t&&(o.commandAttrs=t)}return o},me=()=>{n.has(`pendingSequence`)&&n.emit(`pendingSequence`,e.pending?Do(e.pending):[])};return{getFocusedTarget:u,getFocusedTargetIfAvailable:d,setPendingSequence:f,ensureValidPendingSequence:p,revalidatePendingSequenceIfNeeded:m,hasPendingSequenceState:h,getPendingSequence:g,popPendingSequence:_,getActiveKeys:v,getActiveKeysForCaptures:b,getActiveKeysForFocused:x,getActiveLayers:S,isLayerActiveForFocused:C,collectSequencePartsFromPending:Do,collectMatchingBindings:ne,collectActiveBindings:re}}var Ao=new Set([`name`,`run`,`fields`,`attrs`,`rejectedResult`]),jo=new Set([`key`,`cmd`,`event`,`preventDefault`,`fallthrough`]),Mo=new Set([`target`,`targetMode`,`priority`,`bindings`,`commands`]);function No(e){if(e===void 0||typeof e==`function`)return e;let t=e.trim();if(!t)throw Error(`Invalid keymap command: command cannot be empty`);return t}function Po(e){let t=e.trim();if(!t)throw Error(`Invalid keymap command name: name cannot be empty`);if(/\s/.test(t))throw Error(`Invalid keymap command name "${e}": command names cannot contain whitespace`);return t}function Fo(e,t,n){let r=e.get(t);r?r.push(n):e.set(t,[n])}function Io(e){let t=[],n=new Map;for(let r of e.layers)for(let e of r.commands){let i={layer:r,commandState:e};t.push(i),Fo(n,e.command.name,i)}return{entries:t,chainsByName:n}}function Lo(e,t,n){let r=[],i=[],a=new Map,o=new Map;for(let s of e)if(s.commands.length!==0&&!(n&&!t.matchesConditions(s)))for(let e of s.commands){if(!t.matchesConditions(e))continue;let n={layer:s,commandState:e};r.push(n),Fo(o,e.command.name,n),a.has(e.command.name)||(a.set(e.command.name,n),i.push(n))}return{layers:e,entries:r,reachable:i,reachableByName:a,chainsByName:o}}function Ro(e,t,n,r){return(e.activeLayersCacheVersion!==e.cacheVersion||e.activeLayersCacheFocused!==r)&&(e.activeLayersCacheVersion=e.cacheVersion,e.activeLayersCacheFocused=r,e.activeLayersCache=Ka(e.sortedLayers,t,r)),Lo(e.activeLayersCache,n,!0)}function zo(e,t,n,r){if(Object.prototype.hasOwnProperty.call(e,t)&&!Object.is(e[t],n))throw Error(`Conflicting keymap requirement for "${t}" from ${r}`);e[t]=n}function Bo(e,t,n,r){if(Object.prototype.hasOwnProperty.call(e,t)&&!Object.is(e[t],n))throw Error(`Conflicting keymap attribute for "${t}" from ${r}`);e[t]=n}function Vo(e){let t=`field ${e.fieldName}`;return{require(n,r){zo(e.requirements,n,r,t)},attr(n,r){if(!e.attrs)throw Error(`Keymap ${t} cannot publish attrs`);Bo(e.attrs,n,r,t)},activeWhen(n){e.matchers.push(e.conditions.buildRuntimeMatcher(n,t))}}}function Ho(e){let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function Uo(e,t){return e instanceof Error&&e.message?e.message:t}function Wo(e){return!e||typeof e!=`object`&&typeof e!=`function`?!1:typeof e.then==`function`}function Go(e,t){let n=t?.deep===!0,r=t?.freeze===!0,i=t?.preserveNonPlainObjects===!0;if(Array.isArray(e)){let i=n?e.map(e=>Go(e,t)):[...e];return r?Object.freeze(i):i}if(e&&typeof e==`object`){if(i&&!Ho(e))return e;let a={};for(let[r,i]of Object.entries(e))a[r]=n?Go(i,t):i;return r?Object.freeze(a):a}return e}var Ko=[`name`],qo=Object.freeze({}),Jo=new WeakMap;function Yo(e,t,n,r,i){let a=-1,o,s=-1,c,l,u=-1,d,f,p=-1,m,h=-1,g=new Map,_=t=>Zo({commands:t,commandFields:e.commandFields,conditions:r,onError:(e,t,r)=>{n.emitError(e,t,r)}}),v=t=>se(()=>e.commandResolvers.prepend(t),t),y=t=>se(()=>e.commandResolvers.append(t),t),b=()=>{e.commandResolvers.has()&&n.runWithStateChangeBatch(()=>{e.commandResolvers.clear(),i.onCommandResolversChanged(),n.queueStateChange()})},x=e=>he(e).map(e=>Xo(e.commandState)),S=e=>{let t=j(e),n=he(e,t);if(n.length===0)return[];let r=n.map(e=>({entry:e,command:Xo(e.commandState),commandAttrs:e.commandState.attrs,bindings:[]})),i=new Map;for(let[e,t]of r.entries()){let n=i.get(t.command.name);n?n.push(e):i.set(t.command.name,[e])}return i.size>0&&ge(r,i,t),r.map(e=>({command:e.command,bindings:e.bindings}))},C=t=>{if(t.visibility===`registered`&&u===e.derivedVersion&&d===t.commands&&f)return f;let n=new Map;for(let e of t.commands)n.has(e)||n.set(e,[]);return n.size===0?n:(_e(n,j(t)),t.visibility===`registered`&&(u=e.derivedVersion,d=t.commands,f=n),n)},ee=(e,t,n)=>{let r=O(t);if(n){let i=[],a=r.chainsByName.get(e);if(a)for(let e of a)i.push({target:e.layer.target,command:e.commandState.command,attrs:e.commandState.attrs,payload:n.payload});let o=N(e,t,{mode:`active`,execution:n});return o.resolved&&i.push(o.resolved),{entries:i.length>0?i:void 0,hadError:o.hadError}}let i=[];for(let t of r.chainsByName.get(e)??[])i.push({target:t.layer.target,command:t.commandState.command,attrs:t.commandState.attrs});let a=N(e,t,{mode:`active`});return a.resolved&&i.push(a.resolved),{entries:i.length>0?i:void 0,hadError:a.hadError}},te=t=>{if(h!==e.derivedVersion&&(h=e.derivedVersion,g=new Map),g.has(t))return g.get(t)??void 0;let n=de(ue(t));return g.set(t,n??null),n},ne=(e,t)=>de(O(t).chainsByName.get(e)),w=(e,t)=>N(e,null,{mode:`registered`,execution:t}),T=(e,t,n)=>N(e,t,{mode:`active`,execution:n}),E=(e,t)=>ce(e,t)?.command,re=e=>le(e)?.commandState.command,D=(e,n,i)=>{let a=k().chainsByName.get(e);if(!a||a.length===0)return;let o,s;for(let e of a){if(!Ja(t,e.layer,n)){o??=e;continue}(!r.matchesConditions(e.layer)||!r.matchesConditions(e.commandState))&&(s??=e)}let c=s??o;if(c)return{reason:s?`disabled`:`inactive`,command:i?c.commandState.command:void 0}},O=n=>{if(s===e.derivedVersion&&c===n&&l)return l;let i=Ro(e,t,r,n);return ie()&&(s=e.derivedVersion,c=n,l=i),i},k=()=>a===e.derivedVersion&&o?o:(a=e.derivedVersion,o=Io(e),o),ie=()=>e.activeCommandViewCacheBlockers===0,A=(e,t,n)=>e.command===void 0||e.run?!0:typeof e.command==`string`?n.reachableByName.has(e.command)?!0:fe(e.command,t,`active`)!==void 0:!1,ae=(e,t,n)=>{if(typeof e.command!=`string`)return;let r=n.reachableByName.get(e.command);return r?r.commandState.attrs:fe(e.command,t,`active`)?.attrs},oe=(e,n)=>{if(n?.some(t=>t.command.name===e)||k().chainsByName.has(e))return`resolved`;let r=N(e,Ua(t));return r.resolved||r.hadError?r.resolved?`resolved`:`error`:`unresolved`},se=(t,r)=>n.runWithStateChangeBatch(()=>{let a=t();return i.onCommandResolversChanged(),n.queueStateChange(),()=>{n.runWithStateChangeBatch(()=>{a(),!e.commandResolvers.values().includes(r)&&(i.onCommandResolversChanged(),n.queueStateChange())})}}),ce=(e,t)=>{let n=O(t).reachableByName.get(e);return n?{target:n.layer.target,command:n.commandState.command,attrs:n.commandState.attrs}:fe(e,t,`active`)},le=e=>ue(e)?.[0],ue=t=>{let n=[];for(let r of e.sortedLayers)for(let e of r.commands)e.command.name===t&&n.push({layer:r,commandState:e});return n.length>0?n:void 0},de=e=>{if(e?.length)return e.map(e=>({target:e.layer.target,command:e.commandState.command,attrs:e.commandState.attrs}))},fe=(e,t,n)=>N(e,t,{mode:n}).resolved,pe=()=>k().entries,me=()=>{if(p===e.derivedVersion&&m)return m;let t=new Map;for(let n of e.layers)for(let e of n.bindings){if(typeof e.command!=`string`)continue;let n=t.get(e.command);n?n.push(e):t.set(e.command,[e])}return p=e.derivedVersion,m=t,t},j=e=>{let n=e?.visibility??`reachable`,r=e&&Object.prototype.hasOwnProperty.call(e,`focused`)?e.focused??null:Ua(t);return n===`registered`?{visibility:n,focused:r}:{visibility:n,focused:r,activeView:O(r)}},he=(e,t=j(e))=>{let r;return r=t.visibility===`registered`?pe():t.visibility===`active`?t.activeView?.entries??[]:t.activeView?.reachable??[],ns({entries:r,query:e,getCommand:e=>Xo(e),onFilterError:e=>{n.emitError(`command-query-filter-error`,e,`[Keymap] Error in command query filter:`)}})},ge=(e,t,n)=>{ve(n,n=>{ye(e,t,n)})},_e=(e,t)=>{if(t.visibility===`registered`){let t=me();for(let[n,r]of e){let e=k().chainsByName.get(n)?.[0]?.commandState.attrs;for(let i of t.get(n)??[])r.push(be(i,e))}return}ve(t,n=>{M(e,n,t)})},ve=(t,n)=>{if(t.visibility===`registered`){for(let t of e.layers)for(let e of t.bindings)n(e);return}let i=t.activeView;if(i){for(let e of i.layers)if(!(e.bindings.length===0||!r.matchesConditions(e)))for(let a of e.bindings)r.matchesConditions(a)&&A(a,t.focused,i)&&n(a)}},ye=(e,t,n)=>{if(typeof n.command!=`string`)return;let r=t.get(n.command);if(!(!r||r.length===0))for(let t of r){let r=e[t];r&&r.bindings.push(be(n,r.commandAttrs))}},M=(e,t,n)=>{if(typeof t.command!=`string`)return;let r=e.get(t.command);r&&r.push(be(t,xe(t,n)))},be=(e,t)=>({sequence:e.sequence,command:e.command,commandAttrs:t,attrs:e.attrs,event:e.event,preventDefault:e.preventDefault,fallthrough:e.fallthrough}),xe=(e,t)=>{if(typeof e.command!=`string`)return;if(t.visibility===`registered`)return k().chainsByName.get(e.command)?.[0]?.commandState.attrs;let n=t.activeView;if(n)return ae(e,t.focused,n)},N=(t,r,i)=>{let a=i?.mode??`active`,o=i?.execution??{input:t},s=Qo(t,e.commandResolvers.values(),()=>Ce(r,a,o),e=>{n.emitError(`command-resolver-error`,e,`[Keymap] Error in command resolver for "${t}":`)}),c=s.resolved;if(c){let e=Se(c.command.name,r,a);e?.commandState.command===c.command&&c.target===void 0&&(c={...c,target:e.layer.target},s.resolved=c)}if(c&&!c.attrs){let e=P(c.command.name,r,a)??ts(c.command);e&&(s.resolved={...c,attrs:e})}return s},P=(e,t,n)=>n===`registered`?le(e)?.commandState.attrs:O(t).reachableByName.get(e)?.commandState.attrs,Se=(e,t,n)=>n===`registered`?le(e):O(t).reachableByName.get(e),Ce=(e,t,n)=>{let r=n.input,i=n.payload;return{context:{get input(){return r},get payload(){return i},setInput(e){r=e},setPayload(e){i=e},getCommand:n=>t===`registered`?re(n):E(n,e)},getExecutionFields(){return{input:r,payload:i}}}};return{normalizeCommands:_,prependCommandResolver:v,appendCommandResolver:y,clearCommandResolvers:b,getCommands:x,getCommandEntries:S,getCommandBindings:C,getResolvedCommandChain:ee,getRegisteredResolvedEntries:te,getActiveRegisteredResolvedEntries:ne,resolveRegisteredResolverFallback:w,resolveActiveResolverFallback:T,getTopCommand:E,getDispatchUnavailableCommandState:D,getActiveCommandView:O,isBindingVisible:A,getBindingCommandAttrs:ae,getCommandResolutionStatus:oe}}function Xo(e){return e.command}function Zo(e){let t=[],n=new Set;for(let r of e.commands)try{let i={},a=[],o=Po(r.name),s=$o(r),c={};if(n.has(o)){e.onError(`duplicate-command`,{command:o},`Duplicate keymap command "${o}" in the same layer`);continue}r.name=o;for(let[t,n]of Object.entries(s)){if(n===void 0)continue;let r=e.commandFields.get(t);r&&r(n,Vo({fieldName:t,conditions:e.conditions,requirements:i,matchers:a,attrs:c}))}let l={command:r,fields:s,attrs:Object.keys(c).length===0?void 0:c,requires:Object.entries(i),matchers:a};n.add(l.command.name),t.push(l)}catch(t){e.onError(`register-command-failed`,t,Uo(t,`Failed to register keymap command "${String(r.name)}"`));continue}return t}function Qo(e,t,n,r){if(t.length===0)return{hadError:!1};let i=!1;for(let a of t){let t,o=n();try{t=a(e,o.context)}catch(e){i=!0,r(e);continue}if(t)return{hadError:i,resolved:es(t,o.getExecutionFields())}}return{hadError:i}}function $o(e){let t={};for(let[n,r]of Object.entries(e))!Ao.has(n)&&r!==void 0&&(t[n]=r);return Object.keys(t).length===0?qo:t}function es(e,t){return{command:e,input:t.input,payload:t.payload}}function ts(e){let t=$o(e);return t===qo?void 0:t}function ns(e){let t=e.query?.namespace,n=rs(e.query?.limit);if(n===0)return[];let r=e.query?.search?.trim().toLowerCase()??``,i=Ko;e.query?.searchIn&&e.query.searchIn.length>0&&(i=e.query.searchIn);let a=e.query?.filter,o,s,c;if(typeof a==`function`)s=a;else if(a){let e=Object.entries(a),t=[];for(let[n,r]of e){if(n===`name`){if(typeof r==`string`){c=new Set([r]);continue}if(Array.isArray(r)){let e=new Set;for(let t of r)typeof t==`string`&&e.add(t);c=e;continue}}t.push([n,r])}o=t.length>0?t:void 0}let l=[];for(let a of e.entries){let u=a.commandState;if(as(u,t)&&is(u,r,i)&&!(c&&!c.has(u.command.name))&&os(u,o,e)){if(s){let t=!1;try{t=s(e.getCommand(u))}catch(t){e.onFilterError(t);continue}if(!t)continue}if(l.push(a),n!==void 0&&l.length>=n)break}}return l}function rs(e){if(e===void 0)return;let t=Math.floor(Number(e));return!Number.isFinite(t)||t<=0?0:t}function is(e,t,n){if(!t)return!0;for(let r of n)if(ss(e,r,t))return!0;return!1}function as(e,t){if(t===void 0)return!0;let n=e.fields;return Object.prototype.hasOwnProperty.call(n,`namespace`)?ms(n.namespace,t):!1}function os(e,t,n){if(!t)return!0;for(let[r,i]of t)if(!ds(e,r,i,n))return!1;return!0}function ss(e,t,n){return cs(e,t)?.includes(n)===!0}function cs(e,t){let n=Jo.get(e);if(n||(n=new Map,Jo.set(e,n)),n.has(t))return n.get(t);let r=e.fields,i=e.attrs,a;t===`name`?a=e.command.name:Object.prototype.hasOwnProperty.call(r,t)?a=r[t]:i&&Object.prototype.hasOwnProperty.call(i,t)&&(a=i[t]);let o=ls(a);return n.set(t,o),o}function ls(e){if(Array.isArray(e)){let t=[];for(let n of e){let e=ls(n);e!==void 0&&t.push(e)}return t.length>0?t.join(`\0`):void 0}if(typeof e==`string`)return e.toLowerCase();if(typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`)return String(e).toLowerCase()}function us(e,t,n,r){try{return e(t,n)}catch(e){return r(e),!1}}function ds(e,t,n,r){return typeof n==`function`?fs(e,t,n,r):ps(e,t,n)}function fs(e,t,n,r){let i=e.command,a=e.fields,o=e.attrs,s,c=!1,l=()=>s??=r.getCommand(e);return t===`name`&&(c=!0,us(n,i.name,l(),r.onFilterError))||Object.prototype.hasOwnProperty.call(a,t)&&(c=!0,us(n,a[t],l(),r.onFilterError))||o&&Object.prototype.hasOwnProperty.call(o,t)&&(c=!0,us(n,o[t],l(),r.onFilterError))?!0:!c&&us(n,void 0,l(),r.onFilterError)}function ps(e,t,n){let r=e.command,i=e.fields,a=e.attrs;return t===`name`&&ms(r.name,n)||Object.prototype.hasOwnProperty.call(i,t)&&ms(i[t],n)?!0:!!a&&Object.prototype.hasOwnProperty.call(a,t)&&ms(a[t],n)}function ms(e,t){return Array.isArray(t)?t.some(t=>hs(e,t)):hs(e,t)}function hs(e,t){return Array.isArray(e)?e.some(e=>hs(e,t)):Object.is(e,t)}function gs(e,t,n,r,i){let a=(e,t,n,r,a,o)=>({keymap:i.keymap,event:e,focused:t,target:n,data:r,input:a,payload:o}),o=(t,n,r,i)=>{let a=typeof n==`function`?void 0:n,o=typeof n==`function`?n:n.run,s=i?a:void 0,c;try{c=o(a?{...r,command:a}:r)}catch(n){return e.emitError(`command-execution-error`,n,`[Keymap] Error running command "${t}":`),{status:`error`,result:s?{ok:!1,reason:`error`,command:s}:{ok:!1,reason:`error`}}}if(Wo(c))return c.catch(n=>{e.emitError(`async-command-error`,n,`[Keymap] Async error in command "${t}":`)}),{status:`handled`,result:s?{ok:!0,command:s}:{ok:!0}};if(_s(c)){let e=c;return(!c.ok&&c.reason!==`not-found`&&i&&a&&!c.command||c.ok&&i&&a&&!c.command)&&(e={...c,command:a}),{status:c.ok?`handled`:`rejected`,result:e}}return c===!1?{status:`rejected`,result:s?{ok:!1,reason:`rejected`,command:s}:{ok:!1,reason:`rejected`}}:{status:`handled`,result:s?{ok:!0,command:s}:{ok:!0}}},s=(e,t,n,r,i,s,c,l)=>{let u;for(let d of t??[]){let t=o(e,d.command,a(n,r,i??d.target??null,s,e,c),l);if(t.status===`handled`||t.status===`error`)return[t.result,u];u=t.result}return[void 0,u]},c=(e,c,l)=>{let u;try{u=No(e)}catch{return{ok:!1,reason:`invalid-args`}}if(typeof u!=`string`)return{ok:!1,reason:`not-found`};let d=c?.includeCommand===!0,f=c?.focused??n.getFocusedTargetIfAvailable(),p=c?.event??i.createCommandEvent(),m=t.getReadonlyData(),h=c?.payload,g=l===`registered`?r.getRegisteredResolvedEntries(u):r.getActiveRegisteredResolvedEntries(u,f),[_,v]=s(u,g,p,f,c?.target,m,h,d);if(_)return _;let y=v,b=l===`registered`?r.resolveRegisteredResolverFallback(u,{input:u,payload:h}):r.resolveActiveResolverFallback(u,f,{input:u,payload:h});if(b.resolved){let e=o(u,b.resolved.command,a(p,f,c?.target??b.resolved.target??null,m,b.resolved.input??u,b.resolved.payload),d);if(e.status===`handled`||e.status===`error`)return e.result;y=e.result}if(b.hadError)return{ok:!1,reason:`error`};if(l===`active`){let e=r.getDispatchUnavailableCommandState(u,f,d);if(e)return e.command?{ok:!1,reason:e.reason,command:e.command}:{ok:!1,reason:e.reason}}return y??{ok:!1,reason:`not-found`}};return{runCommand(e,t){return c(e,t,`registered`)},dispatchCommand(e,t){return c(e,t,`active`)},runBinding(e,n,i,s,c){let l=t.getReadonlyData();if(n.run)return o(typeof n.command==`string`?n.command:`<function>`,n.run,a(i,s,e.target??null,l,typeof n.command==`string`?n.command:`<function>`,c),!1).status!==`rejected`&&(vs(n,i),!0);if(typeof n.command!=`string`)return!1;let u=r.getResolvedCommandChain(n.command,s,c===void 0?void 0:{input:n.command,payload:c}).entries;for(let t of u??[])if(o(n.command,t.command,a(i,s,t.target??e.target??null,l,t.input??n.command,t.payload),!1).status!==`rejected`)return vs(n,i),!0;return!1}}}function _s(e){return typeof e==`object`&&!!e&&`ok`in e}function vs(e,t){e.preventDefault&&(t.preventDefault(),t.stopPropagation())}var ys=Object.freeze({}),bs=[],xs=[];function Ss(e){if(Object.keys(e).length!==0)return Go(e,{freeze:!0})}function Cs(e,t,n,r){let i=t=>ks(t,e.bindingParsers.values(),{tokens:e.tokens,patterns:e.patterns,layer:ys,parseObjectKey:(e,t)=>c(e,t)}),a=t=>{if(typeof t!=`string`)return[c(t)];let n=Os(t,e.bindingParsers.values(),{tokens:e.tokens,patterns:e.patterns,layer:ys,parseObjectKey:(e,t)=>c(e,t)});for(let e of n.unknownTokens)r.warnUnknownToken(e,t);return n.unknownTokens.length>0?[]:n.parts},o=(e,t)=>za(a(e),t),s=(i,a,o,s,d)=>{let f=[],p=!1,m=e.bindingExpanders.values(),h=e.bindingParsers.values(),g=e.bindingFields,_=e.disambiguationResolvers.has(),v=r.warnUnknownField,y=r.warnUnknownToken;for(let[r,b]of i.entries()){let i;try{i=Es(b.key,m,{layer:d})}catch(e){t.emitError(`binding-expand-error`,e,Uo(e,`Failed to expand keymap binding`));continue}for(let m of i){let i=m.key,x;try{x=typeof i==`string`?Os(i,h,{tokens:a,patterns:e.patterns,layer:d,parseObjectKey:(e,t)=>c(e,t)}):{parts:[c(i)],usedTokens:[],unknownTokens:[],hasTokenBindings:!1},x=Ds(x,m)}catch(e){t.emitError(`binding-parse-error`,e,Uo(e,`Failed to parse keymap binding`));continue}let S=x.parts;p||=x.hasTokenBindings;for(let e of x.unknownTokens)y(e,typeof i==`string`?i:String(i.name));if(!(x.unknownTokens.length>0))for(let i of u(b,S,a,h,d))try{let t=l(i.event),a=i.sequence,c={},u={},d=[];for(let e in i){if(e===`sequence`||jo.has(e))continue;let t=i[e];if(t===void 0)continue;let r=g.get(e);if(!r){v(`binding`,e);continue}r(t,Vo({fieldName:e,conditions:n,requirements:c,matchers:d,attrs:u}))}let p=Object.keys(u).length>0?Ss(u):void 0,m=No(i.cmd),h={binding:b,sequence:a,command:m,event:t,parsedBinding:ho(i),sourceTarget:o,sourceLayerOrder:s,bindingIndex:r,requires:Object.keys(c).length>0?Object.entries(c):bs,matchers:d.length>0?d:xs,preventDefault:i.preventDefault!==!1,fallthrough:i.fallthrough??!1};if(p&&(h.attrs=p),typeof m==`function`&&(h.run=m),a.length===0)continue;if(t===`release`&&a.length>1)throw Error(`Keymap release bindings only support a single key stroke`);let y=a.at(-1);if(y?.patternName){let t=e.patterns.get(y.patternName);if(t&&t.max!==t.min)throw Error(`Keymap unbounded sequence patterns must be followed by a concrete continuation`)}t===`press`&&!_&&Ts(f,h),f.push(h)}catch(e){t.emitError(`binding-compile-error`,e,Uo(e,`Failed to compile keymap binding`))}}}return{bindings:f,hasTokenBindings:p}},c=(e,t)=>Ma(e,t),l=e=>{if(e===void 0||e===`press`)return`press`;if(e===`release`)return`release`;throw Error(`Invalid keymap binding event "${String(e)}": expected "press" or "release"`)},u=(n,r,i,a,o)=>{let s=e.bindingTransformers.values();if(s.length===0)return[{...n,sequence:Pa(r)}];let l={...n,sequence:Pa(r)},u=[],d=!0,f=o??ys;for(let n of s)try{n(l,{layer:f,parseKey:t=>ks(t,a,{tokens:i,patterns:e.patterns,layer:f,parseObjectKey:(e,t)=>c(e,t)}),add:e=>{u.push(ho(e))},skipOriginal:()=>{d=!1}})}catch(e){t.emitError(`binding-transformer-error`,e,`[Keymap] Error in binding transformer:`)}return d?u.length===0?[l]:[l,...u]:u};return{parseTokenKey:i,parseKeySequence:a,formatKey:o,compileBindings:s}}function ws(e,t){if(e.length>=t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]?.match!==t[n]?.match)return!1;return!0}function Ts(e,t){for(let n of e)if(n.event===`press`&&(n.command!==void 0&&ws(n.sequence,t.sequence)||t.command!==void 0&&ws(t.sequence,n.sequence)))throw Error(`Keymap bindings cannot use the same sequence as both an exact match and a prefix in the same layer`)}function Es(e,t,n){if(typeof e!=`string`||t.length===0)return[{key:e}];let r=n?.layer??ys,i=[{key:e}];for(let e of t){let t=[];for(let n of i){let i=e({input:n.key,displays:n.displays,layer:r});if(!i){t.push(n);continue}if(i.length===0)throw Error(`Keymap binding expander must return at least one key sequence for "${n.key}"`);for(let e of i){if(!e||typeof e!=`object`||Array.isArray(e)||typeof e.key!=`string`)throw Error(`Keymap binding expander must return expansion objects with string keys for "${n.key}"`);if(e.displays!==void 0){if(!Array.isArray(e.displays))throw Error(`Keymap binding expander displays must be an array of strings for "${n.key}"`);for(let t of e.displays)if(typeof t!=`string`)throw Error(`Keymap binding expander displays must be an array of strings for "${n.key}"`)}t.push(e)}}i=t}return i}function Ds(e,t){if(!t.displays)return e;if(t.displays.length!==e.parts.length)throw Error(`Keymap binding expansion displays length must match parsed sequence length for "${String(t.key)}"`);return{...e,parts:e.parts.map((e,n)=>({...e,display:t.displays[n]}))}}function Os(e,t,n){if(e.length===0)throw Error(`Invalid key sequence: sequence cannot be empty`);if(t.length===0)throw Error(`No keymap binding parsers are registered`);let r=n.tokens??new Map,i=n.patterns??new Map,a=n.layer??ys,o=n.parseObjectKey,s=[],c=new Set,l=new Set,u=0;for(;u<e.length;){let n=!1;for(let d of t){let t=d({input:e,index:u,layer:a,tokens:r,patterns:i,normalizeTokenName:Oa,createMatch:La,parseObjectKey:o});if(t){if(t.nextIndex<=u||t.nextIndex>e.length)throw Error(`Keymap binding parser must advance the input for "${e}" at index ${u}`);s.push(...t.parts);for(let e of t.usedTokens??[])c.add(e);for(let e of t.unknownTokens??[])l.add(e);u=t.nextIndex,n=!0;break}}if(!n)throw Error(`No keymap binding parser handled input at index ${u} in "${e}"`)}return{parts:s,usedTokens:[...c],unknownTokens:[...l],hasTokenBindings:c.size>0||l.size>0}}function ks(e,t,n){if(typeof e!=`string`)return n.parseObjectKey(e);let{parts:r}=Os(e,t,n),[i]=r;if(!i||r.length!==1)throw Error(`Invalid key "${String(e)}": expected a single key stroke`);return i}function As(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.get==`function`&&typeof t.subscribe==`function`}function js(e,t){let n=e=>e.requires.length===0&&e.matchers.length===0,r=e=>{try{return e.match()}catch(n){return t.emitError(`runtime-matcher-error`,n,`[Keymap] Error evaluating runtime matcher from ${e.source}:`),!1}},i=e=>{if(e.matchers.length===0)return!0;if(e.matchers.length===1){let[t]=e.matchers;return!t||r(t)}for(let t of e.matchers)if(!r(t))return!1;return!0},a=t=>{if(t.length===0)return!0;for(let[n,r]of t)if(!Object.is(e.data[n],r))return!1;return!0};return{buildRuntimeMatcher(e,t){if(typeof e==`function`)return{source:t,match:e};if(As(e))return{source:t,match:()=>e.get(),subscribe:t=>e.subscribe(t)};throw Error(`Keymap ${t} expected a function or a reactive matcher`)},matchesConditions:e=>n(e)||a(e.requires)&&i(e)}}var Ms=Symbol(`keymap-disambiguation-decision`),Ns=Symbol(`keymap-deferred-disambiguation-decision`);function Ps(e,t){return{[Ms]:!0,action:e,handler:t}}function Fs(e){return{[Ns]:!0,action:e}}function Is(e){return!!e&&typeof e==`object`&&e[Ms]===!0}function Ls(e){return!!e&&typeof e==`object`&&e[Ns]===!0}function Rs(e,t){return t.aborted?Promise.resolve(!1):new Promise(n=>{let r=setTimeout(()=>{t.removeEventListener(`abort`,i),n(!0)},Math.max(0,e)),i=()=>{clearTimeout(r),t.removeEventListener(`abort`,i),n(!1)};t.addEventListener(`abort`,i,{once:!0})})}function zs(e,t,n,r){let i=e.get(n);if(i)try{return i.matcher(r)}catch(e){t.emitError(`sequence-pattern-match-error`,e,`[Keymap] Error matching sequence pattern "${i.name}":`);return}}function Bs(e,t,n,r){let i=e.get(n)?.payloadKey??n;return{...Ma({name:t.name,ctrl:t.ctrl,shift:t.shift,meta:t.meta,super:t.super??!1,hyper:t.hyper||void 0},{display:r.display??String(r.value??t.name)}),patternName:n,payloadKey:i}}function Vs(e,t,n){if(!n?.patterns||n.patterns.length===0)return;let r={},i=!1;for(let a of n.patterns){let n=e.get(a.name),o;try{o=n?.finalize?n.finalize(a.values):a.values.length===1?a.values[0]:[...a.values]}catch(e){t.emitError(`sequence-pattern-finalize-error`,e,`[Keymap] Error finalizing sequence pattern "${a.name}":`);continue}let s=r[a.payloadKey];s===void 0?(r[a.payloadKey]=o,i=!0):Array.isArray(s)?s.push(o):r[a.payloadKey]=[s,o]}return i?r:void 0}function Hs(e,t,n,r,i,a,o,s,c,l){let u={resolveKey:e=>o.parseTokenKey(e).match},d=null,f=0;function p(t,n,r){if(t===`key`){let t=r;return e.keyHooks.register(n,{priority:t?.priority??0,release:t?.release??!1})}if(t===`key:after`){let t=r;return e.keyAfterHooks.register(n,{priority:t?.priority??0,release:t?.release??!1})}let i=r;return e.rawHooks.register(n,{priority:i?.priority??0})}function m(t){return e.eventMatchResolvers.prepend(t)}function h(t){return e.eventMatchResolvers.append(t)}function g(){e.eventMatchResolvers.clear()}function _(t){return oe(()=>e.disambiguationResolvers.prepend(t),t)}function v(t){return oe(()=>e.disambiguationResolvers.append(t),t)}function y(){e.disambiguationResolvers.has()&&t.runWithStateChangeBatch(()=>{e.disambiguationResolvers.clear(),c.recompileBindings()})}function b(e,t){d&&be()}function x(n){let r=e.rawHooks.entries();if(r.length===0)return!1;let i=!1,a={sequence:n,stop(){i=!0}};for(let e of r){try{e.listener(a)}catch(e){t.emitError(`raw-intercept-error`,e,`[Keymap] Error in raw intercept listener:`)}if(i)return!0}return!1}function S(e,t){return{sequence:Pa(e.sequence),command:e.command,commandAttrs:s.getBindingCommandAttrs(e,t,s.getActiveCommandView(t)),attrs:e.attrs,event:e.event,preventDefault:e.preventDefault,fallthrough:e.fallthrough,sourceLayerOrder:e.sourceLayerOrder,bindingIndex:e.bindingIndex}}function C(e){l.has(`dispatch`)&&l.emit(`dispatch`,e)}function ee(e,t,n,r){l.has(`dispatch`)&&C({phase:e,event:n.event,focused:r,layer:{order:t.order,priority:t.priority,target:t.target,targetMode:t.targetMode},binding:S(n,r),sequence:Pa(n.sequence),command:n.command})}function te(e,t,n){if(!l.has(`dispatch`))return;let i=t[0],a=t.length>0?r.collectSequencePartsFromPending({captures:t}):[];C({phase:e,event:`press`,focused:n,layer:i?{order:i.layer.order,priority:i.layer.priority,target:i.layer.target,targetMode:i.layer.targetMode}:void 0,sequence:a})}function ne(t){let n=e.keyAfterHooks.entries();for(let e of n)if(e.release===t)return n}function w(e){return e.sequence?Pa(e.sequence):e.captures?r.collectSequencePartsFromPending({captures:e.captures}):[]}function T(e,t){return{handled:e!==`sequence-miss`,reason:e,captures:t}}function E(e,t){return{handled:t,reason:t?`binding-handled`:`binding-rejected`,sequence:e.sequence}}function re(e,t){return t.handled||e.reason===`no-match`?t:e}function D(e,i,a,o,s){let c={event:i,eventType:a?`release`:`press`,focused:o,handled:s.handled,reason:s.reason,sequence:w(s),pendingSequence:r.getPendingSequence(),setData:(e,t)=>{n.setData(e,t)},getData:e=>n.getData(e),consume:e=>{let t=e?.preventDefault??!0,n=e?.stopPropagation??!0;t&&i.preventDefault(),n&&i.stopPropagation()}};for(let n of e)if(n.release===a)try{n.listener(c)}catch(e){t.emitError(`key-after-intercept-error`,e,`[Keymap] Error in key:after intercept listener:`)}}function O(){return{handled:!1,reason:`no-match`}}function k(e){e.preventDefault(),e.stopPropagation()}function ie(e,t,n,i){r.setPendingSequence({captures:t});let a=T(`sequence-pending`,t);return te(e,t,n),k(i),a}function A(e,t,n,i){let a=T(e,t);return te(`sequence-clear`,t,n),r.setPendingSequence(null),k(i),a}function ae(i,a){a||be();let o=ne(a),s=o?r.getFocusedTarget():null,c=e.keyHooks.entries(),l={event:i,setData:(e,t)=>{n.setData(e,t)},getData:e=>n.getData(e),consume:e=>{let t=e?.preventDefault??!0,n=e?.stopPropagation??!0;t&&i.preventDefault(),n&&i.stopPropagation()}};for(let e of c)if(e.release===a){try{e.listener(l)}catch(e){t.emitError(`key-intercept-error`,e,`[Keymap] Error in key intercept listener:`)}if(i.propagationStopped){o&&D(o,i,a,s,{handled:!0,reason:`intercept-consumed`,sequence:[]});return}}if(a){let e=se(i);o&&D(o,i,a,s,e);return}let u=ce(i);o&&D(o,i,a,s,u)}function oe(n,r){return t.runWithStateChangeBatch(()=>{let i=e.disambiguationResolvers.has(),a=n();return!i&&e.disambiguationResolvers.has()&&c.recompileBindings(),()=>{t.runWithStateChangeBatch(()=>{let t=e.disambiguationResolvers.has();a(),!e.disambiguationResolvers.values().includes(r)&&t&&!e.disambiguationResolvers.has()&&c.recompileBindings()})}})}function se(e){let t=r.getFocusedTarget(),n=r.getActiveLayers(t),a=we(e),o=O();for(let r of a)layerLoop:for(let a of n){if(a.bindings.length===0||!i.matchesConditions(a))continue;let n=Te(a,r,e,t);if(o=re(o,n.outcome),n.handled){if(n.stop)return o;continue layerLoop}}return o}function ce(e){let t=r.getFocusedTarget(),n=r.ensureValidPendingSequence(),i=we(e);if(n)return le(n,i,e,t);let a=r.getActiveLayers(t),o=O();for(let n of i){let r=de(a,[n],e,t);if(o=re(o,r),r.handled)return o}return o}function le(t,n,i,a){let o=s.getActiveCommandView(a),c=[];for(let r of t.captures){let t=ao(r,n,i,e.patterns,Ee,F);t&&c.push(t)}let l=c.reduce((e,t)=>Math.min(e,ro(t,n)),1/0),u=c.filter(e=>ro(e,n)===l);if(u.length===0||!u.some(e=>ke(e,a,o))){let e=T(`sequence-miss`,t.captures);return te(`sequence-clear`,t.captures,a),r.setPendingSequence(null),e}return ue(u,0,!1,i,a)}function ue(t,n,i,a,o){let s=i,c=O(),l=new Set;for(let i=n;i<t.length;i+=1){let n=t[i];if(!n||l.has(n))continue;let u=Se(t,i,n);if(u.length>0){if(s)continue;let e=Ce(t,n);return me(t,i,u,e,a,o,s)||ie(`sequence-advance`,u,o,a)}if(!Qa(n,e.patterns))continue;let d=Ce(t,n);for(let e of d)l.add(e);let f=Ae(n.layer,d,a,o);if(c=re(c,f.outcome),f.handled&&(s=!0,f.stop))return te(`sequence-clear`,t,o),r.setPendingSequence(null),c}return te(`sequence-clear`,t,o),r.setPendingSequence(null),c}function de(e,t,n,r){return fe(e,0,t,n,r)}function fe(t,n,r,a,o){let c=s.getActiveCommandView(o),l=O();for(let s=n;s<t.length;s+=1){let n=t[s];if(!n||!i.matchesConditions(n))continue;let u=De(n,r,a,o,c);if(u.length===0)continue;if(u.filter(t=>Za(t,e.patterns,!1)).length>0){let n=u.filter(t=>Qa(t,e.patterns)),i=P(t,s,r,a,o);return pe(t,s,r,i,n,a,o)||ie(`sequence-start`,i,o,a)}let d=Ae(n,u.filter(t=>Qa(t,e.patterns)),a,o);if(l=re(l,d.outcome),d.handled&&d.stop)return l}return l}function pe(e,t,n,i,a,o,s){return j({event:o,focused:s,continuationCaptures:i,exactBindingsSource:a.map(e=>e.binding),sequencePhase:`sequence-start`,runExact:()=>{r.setPendingSequence(null);let i=a[0]?.layer;if(!i)return O();let c=Ae(i,a,o,s);return c.stop?c.outcome:re(c.outcome,fe(e,t+1,n,o,s))}})}function me(e,t,n,i,a,o,s){return j({event:a,focused:o,continuationCaptures:n,exactBindingsSource:i.map(e=>e.binding),sequencePhase:`sequence-advance`,runExact:()=>{r.setPendingSequence(null);let n=i[0]?.layer;if(!n)return O();let c=Ae(n,i,a,o);return c.stop?c.outcome:re(c.outcome,ue(e,t+1,s||c.handled,a,o))}})}function j(t){let{event:n,focused:i,continuationCaptures:a,exactBindingsSource:o,sequencePhase:c,runExact:l}=t;if(!e.disambiguationResolvers.has()||a.length===0)return;let u=s.getActiveCommandView(i),d=r.collectMatchingBindings(o,i,u);if(!d.some(e=>e.command!==void 0))return;let f=()=>ie(c,a,i,n),p=()=>A(`sequence-cleared`,a,i,n),m,h=()=>(m??=r.collectSequencePartsFromPending({captures:a}),m),g=ge({event:n,focused:i,getSequence:h,exactBindings:d,continuationCaptures:a,activeView:u});return g?he(g,a,l,f,p,i,h):(N(h()),f())}function he(e,t,n,r,i,a,o){if(e.action===`run-exact`)return n();if(e.action===`continue-sequence`)return r();if(e.action===`clear`)return i();let s=r();return _e(t,e.handler,a,o(),e=>{if(e){if(e.action===`run-exact`){n();return}if(e.action===`continue-sequence`){r();return}i()}}),s}function ge(i){let a,o,s,c,l={event:i.event,focused:i.focused,get sequence(){return a??=Pa(i.getSequence()),a},get stroke(){let e=i.getSequence().at(-1);if(!e)throw Error(`Disambiguation context expected a non-empty sequence`);return c??={...e,stroke:ja(e.stroke)},c},get exact(){return o??=r.collectActiveBindings(i.exactBindings,i.focused,i.activeView).map(e=>({...e,sequence:Pa(e.sequence)})),o},get continuations(){return s??=r.getActiveKeysForCaptures(i.continuationCaptures,{includeBindings:!0,includeMetadata:!0}),s},getData:e=>n.getData(e),setData:(e,t)=>{n.setData(e,t)},runExact:()=>Ps(`run-exact`),continueSequence:()=>Ps(`continue-sequence`),clear:()=>Ps(`clear`),defer:e=>Ps(`defer`,e)};for(let n of e.disambiguationResolvers.values()){let e;try{e=n(l)}catch(e){t.emitError(`disambiguation-resolver-error`,e,`[Keymap] Error in disambiguation resolver:`);continue}if(e!==void 0){if(Wo(e)){t.emitError(`invalid-disambiguation-resolver-return`,e,`[Keymap] Disambiguation resolvers must return synchronously; use ctx.defer(...) for async handling`);continue}if(!Is(e)){t.emitError(`invalid-disambiguation-decision`,e,`[Keymap] Invalid disambiguation decision returned by resolver:`);continue}return e}}}function _e(e,t,n,r,i){be();let a=new AbortController,o={id:f++,controller:a,captures:e,apply:i};d=o,queueMicrotask(()=>{ve(o,t,n,r)})}function ve(e,n,r,i){if(!xe(e))return;let a={signal:e.controller.signal,sequence:Pa(i),focused:r,sleep:t=>Rs(t,e.controller.signal),runExact:()=>Fs(`run-exact`),continueSequence:()=>Fs(`continue-sequence`),clear:()=>Fs(`clear`)},o;try{o=n(a)}catch(n){xe(e)&&(t.emitError(`deferred-disambiguation-error`,n,`[Keymap] Error in deferred disambiguation handler:`),M(e));return}if(Wo(o)){o.then(t=>{ye(e,t)}).catch(n=>{xe(e)&&(t.emitError(`deferred-disambiguation-error`,n,`[Keymap] Error in deferred disambiguation handler:`),M(e))});return}ye(e,o)}function ye(e,n){if(xe(e)){if(n!==void 0&&!Ls(n)){t.emitError(`invalid-deferred-disambiguation-decision`,n,`[Keymap] Invalid deferred disambiguation decision returned by handler:`),M(e);return}M(e),e.apply(n)}}function M(e){xe(e)&&(d=null)}function be(){let e=d;e&&(d=null,e.controller.abort())}function xe(e){return d===e}function N(e){let n=za(e,{preferDisplay:!0});t.warnOnce(`unresolved-disambiguation:${n}`,`unresolved-disambiguation`,{sequence:n},`[Keymap] Ambiguous exact/prefix sequence "${n}" fell back to prefix handling because no disambiguation resolver resolved it`)}function P(t,n,r,a,o){let c=[],l=s.getActiveCommandView(o);for(let s=n;s<t.length;s+=1){let n=t[s];if(n&&i.matchesConditions(n))for(let t of De(n,r,a,o,l))Za(t,e.patterns,!1)&&c.push(t)}return c}function Se(t,n,r){return t.filter((t,i)=>i>=n&&Za(t,e.patterns,!1)&&Ws(t.parts,r.parts))}function Ce(t,n){return t.filter(t=>t.layer===n.layer&&Qa(t,e.patterns)&&Ws(t.parts,n.parts))}function we(n){let r=e.eventMatchResolvers.values();if(r.length===0)return[];if(r.length===1)return Us(r[0],n,u,t);let i=[],a=new Set;for(let e of r){let r;try{r=e(n,u)}catch(e){t.emitError(`event-match-resolver-error`,e,`[Keymap] Error in event match resolver:`);continue}if(!(!r||r.length===0))for(let e of r){if(typeof e!=`string`){t.emitError(`invalid-event-match-resolver-candidate`,e,`[Keymap] Invalid event match resolver candidate:`);continue}a.has(e)||(a.add(e),i.push(e))}}return i}function Te(e,t,n,r){let o=!1,s=O();for(let c of e.bindings){if(c.event!==`release`)continue;let l=c.sequence[0];if(!l||l.match!==t||!i.matchesConditions(c))continue;let u=a.runBinding(e,c,n,r);if(s=re(s,E(c,u)),!u){ee(`binding-reject`,e,c,r);continue}if(ee(`binding-execute`,e,c,r),o=!0,!c.fallthrough)return{handled:!0,stop:!0,outcome:s}}return{handled:o,stop:!1,outcome:s}}function Ee(n,r){return zs(e.patterns,t,n,r)}function F(t,n,r){return Bs(e.patterns,t,n,r)}function De(e,t,n,r,i){let a=oo(e,t,n,Ee,F);return a.some(e=>ke(e,r,i))?a:[]}function I(n){return Vs(e.patterns,t,n)}function Oe(e,t,n){return i.matchesConditions(e)&&s.isBindingVisible(e,t,n)}function ke(e,t,n){return Oe(e.binding,t,n)}function Ae(e,t,n,r){let o=!1,s=O();for(let c of t){let t=c.binding;if(!i.matchesConditions(t))continue;let l=a.runBinding(e,t,n,r,I(c));if(s=re(s,E(t,l)),!l){ee(`binding-reject`,e,t,r);continue}if(ee(`binding-execute`,e,t,r),o=!0,!t.fallthrough)return{handled:!0,stop:!0,outcome:s}}return{handled:o,stop:!1,outcome:s}}return{intercept:p,prependEventMatchResolver:m,appendEventMatchResolver:h,clearEventMatchResolvers:g,prependDisambiguationResolver:_,appendDisambiguationResolver:v,clearDisambiguationResolvers:y,handlePendingSequenceChange:b,handleRawSequence:x,handleKeyEvent:ae}}function Us(e,t,n,r){let i;try{i=e(t,n)}catch(e){return r.emitError(`event-match-resolver-error`,e,`[Keymap] Error in event match resolver:`),[]}if(!i||i.length===0)return[];if(i.length===1){let[e]=i;return typeof e==`string`?[e]:(r.emitError(`invalid-event-match-resolver-candidate`,e,`[Keymap] Invalid event match resolver candidate:`),[])}let a=[],o=new Set;for(let e of i){if(typeof e!=`string`){r.emitError(`invalid-event-match-resolver-candidate`,e,`[Keymap] Invalid event match resolver candidate:`);continue}o.has(e)||(o.add(e),a.push(e))}return a}function Ws(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]?.match!==t[n]?.match)return!1;return!0}var Gs=()=>{};function Ks(e,t,n,r){if(n===void 0)return r;if(typeof n!=`number`||!Number.isInteger(n)||n<0)throw Error(`Keymap sequence pattern "${e}" ${t} must be a non-negative integer`);return n}function qs(e,t){let{kind:n,reservedFields:r,registeredFields:i,emitError:a}=t,o=Object.entries(e),s=[];for(let[e,t]of o){if(r.has(e)){a(`reserved-${n}-field`,{field:e,kind:n},`Keymap ${n} field "${e}" is reserved`);continue}if(i.has(e)){a(`duplicate-${n}-field`,{field:e,kind:n},`Keymap ${n} field "${e}" is already registered`);continue}i.set(e,t),s.push([e,t])}return()=>{for(let[e,t]of s)i.get(e)===t&&i.delete(e)}}function Js(e,t,n,r,i){let a;try{a=Oa(i.name)}catch(e){return t.emitError(`token-name-normalize-error`,e,Uo(e,`Failed to register keymap token`)),Gs}if(e.tokens.has(a)||e.patterns.has(a))return t.emitError(`duplicate-token`,{token:a},`Keymap token "${a}" is already registered`),Gs;let o;try{if(o=n.parseTokenKey(i.key),o.patternName)throw Error(`Invalid key "${String(i.key)}": expected a concrete key stroke`)}catch(e){return t.emitError(`token-parse-error`,e,Uo(e,`Failed to register keymap token "${a}"`)),Gs}let s={stroke:o.stroke,match:o.match},c=new Map(e.tokens);c.set(a,s);try{r.applyTokenState(c)}catch(e){return t.emitError(`token-register-error`,e,Uo(e,`Failed to register keymap token "${a}"`)),Gs}return()=>{if(e.tokens.get(a)!==s)return;let n=new Map(e.tokens);n.delete(a);try{r.applyTokenState(n)}catch(e){t.emitError(`token-unregister-error`,e,Uo(e,`Failed to unregister keymap token "${a}"`))}}}function Ys(e,t,n,r){let i,a;try{i=Oa(r.name);let e=Ks(i,`min`,r.min,1),t=Ks(i,`max`,r.max,2**53-1);if(t<e)throw Error(`Keymap sequence pattern "${i}" max must be greater than or equal to min`);a={name:i,display:r.display,payloadKey:r.payloadKey??i,match:La(`pattern:${i}`),min:e,max:t,matcher:e=>r.match(e),finalize:r.finalize}}catch(e){return t.emitError(`sequence-pattern-register-error`,e,Uo(e,`Failed to register keymap sequence pattern`)),Gs}return e.tokens.has(i)||e.patterns.has(i)?(t.emitError(`duplicate-sequence-pattern`,{pattern:i},`Keymap sequence pattern "${i}" is already registered`),Gs):(e.patterns.set(i,a),n.recompileBindings(),()=>{e.patterns.get(i)===a&&(e.patterns.delete(i),n.recompileBindings())})}function Xs(e,t,n,r){return qs(r,{kind:n,reservedFields:n===`layer`?Mo:n===`binding`?jo:Ao,registeredFields:n===`layer`?e.layerFields:n===`binding`?e.bindingFields:e.commandFields,emitError:(e,n,r)=>t.emitError(e,n,r)})}var Zs=()=>{};function Qs(e,t){return t.priority-e.priority||t.order-e.order}function $s(e){if(e.matchers.length>0)return!0;for(let t of e.commands)if(t.matchers.length>0)return!0;for(let t of e.bindings)if(t.matchers.length>0)return!0;return!1}function ec(e){if(e.commands.length===0)return!1;if(e.matchers.length>0)return!0;for(let t of e.commands)if(t.matchers.length>0)return!0;return!1}function tc(e,t,n,r,i){let a=n=>t.runWithStateChangeBatch(()=>{let a=n.target;if(a&&i.host.isTargetDestroyed(a))return t.emitError(`destroyed-layer-target`,{target:a},`Cannot register a keymap layer for a destroyed keymap target`),Zs;let o,s,c,p,m,v,y;try{y=l(n),o=u(mo(n.bindings??[]),n);let e=d(n.commands??[],n);v=e.length===0?[]:i.commands.normalizeCommands(e),{requires:s,matchers:c,fields:p,attrs:m}=f(n)}catch(e){return t.emitError(`register-layer-failed`,e,Uo(e,`Failed to register keymap layer`)),Zs}let b=e.order++,x=i.compiler.compileBindings(o,e.tokens,a,b,p);if(x.bindings.length===0&&!x.hasTokenBindings&&v.length===0)return Zs;i.diagnostics?.analyzeLayer({target:a,order:b,commands:v,sourceBindings:o,bindings:x.bindings,hasTokenBindings:x.hasTokenBindings});let S={order:b,target:a,targetMode:y,priority:n.priority??0,requires:s,matchers:c,fields:p,attrs:m,commands:v,sourceBindings:o,bindings:x.bindings,root:eo(x.bindings,e.patterns),hasTokenBindings:x.hasTokenBindings,activeKeyCacheBlocked:!1,activeCommandViewCacheBlocked:!1};_(S),e.layers.add(S),e.sortedLayers=[...e.sortedLayers,S].sort(Qs),g(S);for(let e of S.commands)g(e);for(let e of S.bindings)g(e);return a&&(S.offTargetDestroy=i.host.onTargetDestroy(a,()=>{h(S)})),S.commands.length>0&&r.ensureValidPendingSequence(),t.queueStateChange(),()=>{h(S)}}),o=n=>{t.runWithStateChangeBatch(()=>{let i=new Map;for(let t of e.layers)t.hasTokenBindings&&i.set(t,p(t,n));e.tokens=n;let a=!1;for(let[e,t]of i)m(e,t)&&(a=!0);a&&r.setPendingSequence(null),i.size>0&&t.queueStateChange()})},s=()=>{t.runWithStateChangeBatch(()=>{let n=0,i=!1;for(let t of e.layers){if(t.sourceBindings.length===0)continue;let r=p(t,e.tokens);m(t,r)&&(i=!0),n+=1}i&&r.setPendingSequence(null),n>0&&t.queueStateChange()})},c=()=>{for(let t of e.layers){y(t);for(let e of t.commands)y(e);for(let e of t.bindings)y(e);t.offTargetDestroy?.(),t.offTargetDestroy=void 0}},l=e=>{if(e.targetMode){if(!e.target)throw Error(`Keymap targetMode "${e.targetMode}" requires a target`);return e.targetMode}return e.target?`focus-within`:void 0},u=(t,n)=>{let r=e.layerBindingsTransformers.values();if(r.length===0)return t;let i=t;for(let e of r){let t=e(i,{layer:n,validateBindings:e=>po(e)});t&&(i=mo(t))}return i},d=(n,r)=>{let i=e.commandTransformers.values();if(n.length===0||i.length===0)return n;let a=[];for(let e of n){let n={...e},o=[],s=!0;for(let e of i)try{e(n,{layer:r,add(e){o.push({...e})},skipOriginal(){s=!1}})}catch(e){t.emitError(`command-transformer-error`,e,`[Keymap] Error in command transformer:`)}s&&a.push(n),a.push(...o)}return a},f=t=>{let r={},a=[],o=Object.create(null),s={};for(let[c,l]of Object.entries(t)){if(Mo.has(c)||l===void 0)continue;o[c]=Go(l);let t=e.layerFields.get(c);if(!t){i.warnUnknownField(`layer`,c);continue}t(l,Vo({fieldName:c,conditions:n,requirements:r,matchers:a,attrs:s}))}return{requires:Object.entries(r),matchers:a,fields:Object.keys(o).length>0?Object.freeze(o):void 0,attrs:Object.keys(s).length>0?Go(s,{freeze:!0}):void 0}},p=(e,t)=>i.compiler.compileBindings(e.sourceBindings,t,e.target,e.order,e.fields),m=(t,n)=>{i.diagnostics?.analyzeLayer({target:t.target,order:t.order,commands:t.commands,sourceBindings:t.sourceBindings,bindings:n.bindings,hasTokenBindings:n.hasTokenBindings}),v(t);for(let e of t.bindings)y(e);t.bindings=n.bindings,t.root=eo(n.bindings,e.patterns),t.hasTokenBindings=n.hasTokenBindings,_(t);for(let e of t.bindings)g(e);return e.pending?.captures.some(e=>e.layer===t)??!1},h=n=>{t.runWithStateChangeBatch(()=>{if(e.layers.delete(n)){e.sortedLayers=e.sortedLayers.filter(e=>e!==n),v(n),y(n);for(let e of n.commands)y(e);for(let e of n.bindings)y(e);n.offTargetDestroy?.(),n.offTargetDestroy=void 0,e.pending?.captures.some(e=>e.layer===n)?r.setPendingSequence(null):n.commands.length>0&&!i.host.isDestroyed&&r.ensureValidPendingSequence(),t.queueStateChange()}})},g=e=>{for(let n of e.matchers)if(n.subscribe)try{n.dispose=n.subscribe(()=>{if(!r.hasPendingSequenceState()){t.queueStateChange();return}t.runWithStateChangeBatch(()=>{r.revalidatePendingSequenceIfNeeded(),t.queueStateChange()})})}catch(e){t.emitError(`reactive-matcher-subscribe-error`,e,Uo(e,`Failed to subscribe to reactive matcher from ${n.source}`))}},_=t=>{let n=$s(t),r=ec(t);t.activeKeyCacheBlocked=n,t.activeCommandViewCacheBlocked=r,n&&(e.activeKeyCacheBlockers+=1),r&&(e.activeCommandViewCacheBlockers+=1)},v=t=>{t.activeKeyCacheBlocked&&=(--e.activeKeyCacheBlockers,!1),t.activeCommandViewCacheBlocked&&=(--e.activeCommandViewCacheBlockers,!1)},y=e=>{for(let n of e.matchers)if(n.dispose){try{n.dispose()}catch(e){t.emitError(`reactive-matcher-dispose-error`,e,Uo(e,`Failed to dispose reactive matcher from ${n.source}`))}n.dispose=void 0}};return{registerLayer:a,applyTokenState:o,recompileBindings:s,cleanup:c}}var nc=1e3;function rc(e,t,n){let r=(e,n,r)=>{if(!t.has(`warning`)){let t=`[${e}] ${r}`;n instanceof Error?console.warn(t,n):console.warn(t);return}t.emit(`warning`,{code:e,message:r,warning:n})},i=(e,n,r)=>{if(!t.has(`error`)){let t=`[${e}] ${r}`;n instanceof Error?console.error(t,n):console.error(t);return}t.emit(`error`,{code:e,message:r,error:n})},a=()=>{if(!(!e.stateChangePending||e.stateChangeDepth>0||e.flushingStateChange)){e.flushingStateChange=!0;try{let t=0;for(;e.stateChangePending&&e.stateChangeDepth===0;){if(t>=nc){e.stateChangePending=!1,i(`state-change-feedback-loop`,{iterations:nc},`[Keymap] Possible infinite state listener feedback loop detected after ${nc} iterations; pending state notifications were dropped`);break}t+=1,e.stateChangePending=!1,n.emit(`state`)}}finally{e.flushingStateChange=!1}}};return{runWithStateChangeBatch(t){e.stateChangeDepth+=1;try{return t()}finally{--e.stateChangeDepth,e.stateChangeDepth===0&&a()}},queueStateChange(t){e.derivedVersion+=1,t?.invalidateCaches!==!1&&(e.cacheVersion+=1),n.has(`state`)&&(e.stateChangePending=!0,e.stateChangeDepth===0&&!e.flushingStateChange&&a())},emitWarning:r,emitError:i,reportListenerError(e,t){if(e===`state`){i(`state-listener-error`,t,`[Keymap] Error in state listener:`);return}if(e===`pendingSequence`){i(`pending-sequence-listener-error`,t,`[Keymap] Error in pending sequence listener:`);return}e===`dispatch`&&i(`dispatch-listener-error`,t,`[Keymap] Error in dispatch listener:`)},warnOnce(t,n,i,a){e.usedWarningKeys.has(t)||(e.usedWarningKeys.add(t),r(n,i,a))}}}function ic(e,t,n){return{getData(t){return e.data[t]},setData(r,i){t.runWithStateChangeBatch(()=>{if(i===void 0){if(!(r in e.data))return;delete e.data[r],e.dataVersion+=1,n.ensureValidPendingSequence(),t.queueStateChange();return}Object.is(e.data[r],i)||(e.data[r]=i,e.dataVersion+=1,n.ensureValidPendingSequence(),t.queueStateChange())})},getReadonlyData(){return e.readonlyDataVersion===e.dataVersion?e.readonlyData:(e.readonlyData=Object.freeze({...e.data}),e.readonlyDataVersion=e.dataVersion,e.readonlyData)}}}var ac=Object.freeze({});function oc(){return{order:0,tokens:new Map,patterns:new Map,layerFields:new Map,layerBindingsTransformers:lo(),bindingExpanders:lo(),bindingParsers:lo(),bindingTransformers:lo(),bindingFields:new Map,commandTransformers:lo(),commandFields:new Map,eventMatchResolvers:lo(),disambiguationResolvers:lo(),keyHooks:uo(),keyAfterHooks:uo(),rawHooks:uo(),layers:new Set,sortedLayers:[],activeLayersCacheVersion:-1,activeLayersCacheFocused:void 0,activeLayersCache:[],activeKeyCacheBlockers:0,activeCommandViewCacheBlockers:0,commandResolvers:lo(),pending:null,data:{},dataVersion:0,readonlyDataVersion:-1,readonlyData:ac,cacheVersion:0,derivedVersion:0,stateChangeDepth:0,stateChangePending:!1,flushingStateChange:!1,usedWarningKeys:new Set}}function sc(e){return Fa(e)}var cc=class{#e=oc();#t=!1;#n=new Map;#r=[];#i=so(()=>{});#a;#o;#s;#c;#l;#u;#d;#f;#p;#m;#h;#g;#_;#v;#y;#b;getPendingSequence;getActiveKeys;constructor(e){if(this.#b=e,e.isDestroyed)throw Error(`Cannot create a keymap for a destroyed host`);this.#a=so((e,t)=>{this.#o.reportListenerError(e,t)}),this.#o=rc(this.#e,this.#i,this.#a),this.#l=js(this.#e,this.#o),this.#u=Yo(this.#e,this.#b,this.#o,this.#l,{onCommandResolversChanged:()=>{this.#s.ensureValidPendingSequence()}}),this.#s=ko(this.#e,this.#b,this.#a,this.#o,this.#l,this.#u,{onPendingSequenceChanged:(e,t)=>{this.#p?.handlePendingSequenceChange(e,t)}}),this.#c=ic(this.#e,this.#o,this.#s),this.#d=gs(this.#o,this.#c,this.#s,this.#u,{keymap:this,createCommandEvent:()=>this.#b.createCommandEvent()}),this.#f=Cs(this.#e,this.#o,this.#l,{warnUnknownField:(e,t)=>{this.#C(e,t)},warnUnknownToken:(e,t)=>{this.#w(e,t)}}),this.#h=go(this.#o,this.#u),this.#m=tc(this.#e,this.#o,this.#l,this.#s,{compiler:this.#f,commands:this.#u,host:this.#b,diagnostics:this.#h,warnUnknownField:(e,t)=>{this.#C(e,t)}}),this.#p=Hs(this.#e,this.#o,this.#c,this.#s,this.#l,this.#d,this.#f,this.#u,this.#m,this.#a),this.getPendingSequence=this.#s.getPendingSequence,this.getActiveKeys=this.#s.getActiveKeys,this.#g=e=>{this.#p.handleKeyEvent(e,!1)},this.#_=e=>{this.#p.handleKeyEvent(e,!0)},this.#v=e=>this.#p.handleRawSequence(e),this.#y=e=>{this.#S(e)},this.#r.push(this.#b.onKeyPress(this.#g)),this.#r.push(this.#b.onKeyRelease(this.#_)),this.#b.onRawInput&&this.#r.push(this.#b.onRawInput(this.#v)),this.#r.push(this.#b.onFocusChange(this.#y)),this.#b.onDestroy&&this.#r.push(this.#b.onDestroy(()=>{this.#x()}))}[Ha](){return{state:this.#e,host:this.#b,conditions:this.#l,catalog:this.#u,activation:this.#s}}#x(){if(!this.#t){this.#t=!0,this.#s.setPendingSequence(null);for(let e of this.#n.values())e.dispose();this.#n.clear(),this.#m.cleanup();for(let e of this.#r.splice(0))e()}}setData(e,t){this.#c.setData(e,t)}getData(e){return this.#c.getData(e)}getHostMetadata(){return this.#b.metadata}hasPendingSequence(){return this.#s.ensureValidPendingSequence()!==void 0}createKeyMatcher(e){let t=this.#f.parseTokenKey(e).match;return e=>e?sc(e)===t:!1}parseKeySequence(e){return this.#f.parseKeySequence(e)}formatKey(e,t){return this.#f.formatKey(e,t)}clearPendingSequence(){this.#s.setPendingSequence(null)}popPendingSequence(){return this.#s.popPendingSequence()}getCommands(e){return this.#u.getCommands(e)}getCommandEntries(e){return this.#u.getCommandEntries(e)}getCommandBindings(e){return this.#u.getCommandBindings(e)}acquireResource(e,t){if(this.#t||this.#b.isDestroyed)throw Error(`Cannot use a keymap after its host was destroyed`);let n=this.#n.get(e);if(n)return n.count+=1,()=>{this.#T(e,n)};let r={count:1,dispose:t()};return this.#n.set(e,r),()=>{this.#T(e,r)}}runCommand(e,t){return this.#d.runCommand(e,t)}dispatchCommand(e,t){return this.#d.dispatchCommand(e,t)}on(e,t){return e===`warning`||e===`error`?this.#i.hook(e,t):this.#a.hook(e,t)}intercept(e,t,n){return this.#p.intercept(e,t,n)}registerLayer(e){return this.#m.registerLayer(e)}registerLayerFields(e){return Xs(this.#e,this.#o,`layer`,e)}prependLayerBindingsTransformer(e){return this.#e.layerBindingsTransformers.prepend(e)}appendLayerBindingsTransformer(e){return this.#e.layerBindingsTransformers.append(e)}clearLayerBindingsTransformers(){this.#e.layerBindingsTransformers.clear()}prependBindingTransformer(e){return this.#e.bindingTransformers.prepend(e)}appendBindingTransformer(e){return this.#e.bindingTransformers.append(e)}clearBindingTransformers(){this.#e.bindingTransformers.clear()}prependCommandTransformer(e){return this.#e.commandTransformers.prepend(e)}appendCommandTransformer(e){return this.#e.commandTransformers.append(e)}clearCommandTransformers(){this.#e.commandTransformers.clear()}prependBindingParser(e){return this.#e.bindingParsers.prepend(e)}appendBindingParser(e){return this.#e.bindingParsers.append(e)}clearBindingParsers(){this.#e.bindingParsers.clear()}registerToken(e){return Js(this.#e,this.#o,this.#f,this.#m,e)}registerSequencePattern(e){return Ys(this.#e,this.#o,this.#m,e)}prependBindingExpander(e){return this.#e.bindingExpanders.prepend(e)}appendBindingExpander(e){return this.#e.bindingExpanders.append(e)}clearBindingExpanders(){this.#e.bindingExpanders.clear()}registerBindingFields(e){return Xs(this.#e,this.#o,`binding`,e)}registerCommandFields(e){return Xs(this.#e,this.#o,`command`,e)}prependCommandResolver(e){return this.#u.prependCommandResolver(e)}appendCommandResolver(e){return this.#u.appendCommandResolver(e)}clearCommandResolvers(){this.#u.clearCommandResolvers()}prependLayerAnalyzer(e){return this.#h.prependLayerAnalyzer(e)}appendLayerAnalyzer(e){return this.#h.appendLayerAnalyzer(e)}clearLayerAnalyzers(){this.#h.clearLayerAnalyzers()}prependEventMatchResolver(e){return this.#p.prependEventMatchResolver(e)}appendEventMatchResolver(e){return this.#p.appendEventMatchResolver(e)}clearEventMatchResolvers(){this.#p.clearEventMatchResolvers()}prependDisambiguationResolver(e){return this.#p.prependDisambiguationResolver(e)}appendDisambiguationResolver(e){return this.#p.appendDisambiguationResolver(e)}clearDisambiguationResolvers(){this.#p.clearDisambiguationResolvers()}#S(e){this.#o.runWithStateChangeBatch(()=>{this.#s.setPendingSequence(null),this.#o.queueStateChange({invalidateCaches:!1})})}#C(e,t){this.#o.warnOnce(`${e}:${t}`,`unknown-${e}-field`,{field:t,kind:e},`[Keymap] Unknown ${e} field "${t}" was ignored`)}#w(e,t){this.#o.warnOnce(`token:${e}`,`unknown-token`,{token:e,sequence:t},`[Keymap] Unknown token "${e}" in key sequence "${t}"; binding was skipped until the token is registered`)}#T(e,t){this.#n.get(e)===t&&(--t.count,!(t.count>0)&&(t.dispose(),this.#n.delete(e)))}},lc=new Set(`up.down.left.right.clear.escape.return.linefeed.enter.tab.backspace.delete.insert.home.end.pageup.pagedown.space.lt.gt.plus.minus.equal.comma.period.slash.backslash.semicolon.quote.backquote.leftbracket.rightbracket.capslock.numlock.scrolllock.printscreen.pause.menu.apps.kp0.kp1.kp2.kp3.kp4.kp5.kp6.kp7.kp8.kp9.kpdecimal.kpdivide.kpmultiply.kpminus.kpplus.kpenter.kpequal.kpseparator.kpleft.kpright.kpup.kpdown.kppageup.kppagedown.kphome.kpend.kpinsert.kpdelete.mediaplay.mediapause.mediaplaypause.mediareverse.mediastop.mediafastforward.mediarewind.medianext.mediaprev.mediarecord.volumedown.volumeup.mute.leftshift.leftctrl.leftalt.leftsuper.lefthyper.leftmeta.rightshift.rightctrl.rightalt.rightsuper.righthyper.rightmeta.iso_level3_shift.iso_level5_shift.option.alt.meta.super.hyper.control.ctrl.shift`.split(`.`)),uc=new Set([`ctrl`,`control`,`shift`,`meta`,`alt`,`option`,`super`,`hyper`]),dc=pc(lc),fc=pc(uc);function pc(e){let t=new Map;for(let n of e){let e=n.charCodeAt(0);if(Number.isNaN(e))continue;let r=t.get(e);r||(r=[],t.set(e,r)),r.push(n)}for(let e of t.values())e.sort((e,t)=>t.length-e.length);return t}function mc(e){return e>=65&&e<=90?e+32:e}function hc(e){return e>=48&&e<=57}function gc(e,t,n){if(e.startsWith(t,n))return!0;if(n+t.length>e.length)return!1;for(let r=0;r<t.length;r+=1)if(mc(e.charCodeAt(n+r))!==t.charCodeAt(r))return!1;return!0}function _c(e,t,n){let r=t.charCodeAt(n);if(Number.isNaN(r))return;let i=e.get(mc(r));if(i){for(let e of i)if(gc(t,e,n))return e}}function vc(e,t,n,r,i){return e.parseObjectKey(t,{display:n,match:r,tokenName:i})}function yc(e,t){if(e===` `)return t.parseObjectKey({name:`space`},{display:`space`});if(e===`+`)return t.parseObjectKey({name:`+`},{display:`+`});let n=e.split(`+`),r=``,i=``,a=!1,o=!1,s=!1,c=!1,l=!1;for(let t of n){let n=t.trim();if(!n)continue;let u=n.toLowerCase();if(u===`ctrl`||u===`control`){a=!0;continue}if(u===`shift`){o=!0;continue}if(u===`meta`||u===`alt`||u===`option`){s=!0;continue}if(u===`super`){c=!0;continue}if(u===`hyper`){l=!0;continue}if(r)throw Error(`Invalid key "${e}": multiple key names are not supported`);r=n,i=u}if(!r)throw Error(`Invalid key "${e}": missing key name`);let u=[];return a&&u.push(`ctrl`),o&&u.push(`shift`),s&&u.push(`meta`),c&&u.push(`super`),l&&u.push(`hyper`),u.push(i),t.parseObjectKey({name:r,ctrl:a,shift:o,meta:s,super:c,hyper:l||void 0},{display:u.join(`+`)})}function bc(e,t){let n=e.trim().toLowerCase();return t.parseObjectKey({name:n},{display:n})}function xc(e,t){let n=_c(dc,e,t);if(n)return n;if(mc(e.charCodeAt(t))!==102||!hc(e.charCodeAt(t+1)))return;let r=hc(e.charCodeAt(t+2))?t+3:t+2;return e.slice(t,r).toLowerCase()}function Sc(e,t){return _c(fc,e,t)}function Cc(e,t,n){let r=t,i=!1,a=!1,o=!1,s=!1,c=!1;for(;r<e.length;){let t=Sc(e,r);if(!t)break;let n=r+t.length;if(e[n]!==`+`)break;t===`ctrl`||t===`control`?i=!0:t===`shift`?a=!0:t===`meta`||t===`alt`||t===`option`?o=!0:t===`super`?s=!0:t===`hyper`&&(c=!0),r=n+1}if(r===t)return;let l=e[r];if(l===void 0)throw Error(`Invalid key "${e.slice(t)}": missing key name`);let u=xc(e,r)??l,d=u===` `?`space`:u===`+`?`+`:u.toLowerCase(),f=[];return i&&f.push(`ctrl`),a&&f.push(`shift`),o&&f.push(`meta`),s&&f.push(`super`),c&&f.push(`hyper`),f.push(d),{part:n.parseObjectKey({name:u===` `?`space`:u,ctrl:i,shift:a,meta:o,super:s,hyper:c||void 0},{display:f.join(`+`)}),nextIndex:r+u.length}}var wc=e=>{let{input:t,index:n,tokens:r,normalizeTokenName:i}=e;if(n===0&&t.includes(`+`)&&/\s/.test(t))return{parts:[yc(t,e)],nextIndex:t.length};let a=t[n];if(a===void 0)return;if(a===`<`){let o=t.indexOf(`>`,n);if(o===-1)return{parts:[yc(a,e)],nextIndex:n+1};let s=i(t.slice(n+1,o)),c=r.get(s);return c?{parts:[vc(e,c.stroke,`<${s}>`,c.match,s)],nextIndex:o+1,usedTokens:[s]}:{parts:[],nextIndex:o+1,unknownTokens:[s]}}if(a===`{`){let r=t.indexOf(`}`,n);if(r===-1)return{parts:[yc(a,e)],nextIndex:n+1};let o=i(t.slice(n+1,r)),s=e.patterns.get(o);return s?{parts:[{...e.parseObjectKey({name:o,ctrl:!1,shift:!1,meta:!1,super:!1},{display:s.display??`{${o}}`,match:s.match}),patternName:s.name,payloadKey:s.payloadKey}],nextIndex:r+1,usedTokens:[o]}:{parts:[],nextIndex:r+1,unknownTokens:[o]}}let o=Cc(t,n,e);if(o)return{parts:[o.part],nextIndex:o.nextIndex};let s=xc(t,n);return s?{parts:[bc(s,e)],nextIndex:n+s.length}:{parts:[yc(a,e)],nextIndex:n+1}},Tc=(e,t)=>[t.resolveKey({name:e.name,ctrl:e.ctrl,shift:e.shift,meta:e.meta,super:e.super??!1,hyper:e.hyper||void 0})];function Ec(e){return e.appendBindingParser(e=>wc(e))}function Dc(e){return e.appendEventMatchResolver((e,t)=>Tc(e,t))}function Oc(e){let t=Ec(e),n=Dc(e);return()=>{n(),t()}}var kc=Symbol(`keymap:mod-bindings`),Ac=/(^|[+,\s])mod(?=\s*\+)/i,jc=/(^|[+,\s])mod(?=\s*\+)/gi;function Mc(e){let t=e.primaryModifier;return(t===`ctrl`||t===`super`)&&e.modifiers[t]!==`unsupported`?t:e.modifiers.ctrl===`unsupported`?`super`:`ctrl`}function Nc(e){if(e.includes(`,`))return[e];let t=e.trim();return t.includes(` `)?t.split(/\s+/):[e]}function Pc(e){return e.acquireResource(kc,()=>e.appendBindingExpander(({input:t,displays:n})=>{if(!Ac.test(t))return;let r=Mc(e.getHostMetadata());return[{key:t.replace(jc,(e,t)=>`${t}${r}`),displays:n??Nc(t)}]}))}var Fc=new Map([[` `,`space`],[`Spacebar`,`space`],[`ArrowUp`,`up`],[`ArrowDown`,`down`],[`ArrowLeft`,`left`],[`ArrowRight`,`right`],[`Escape`,`escape`],[`Esc`,`escape`],[`Enter`,`return`],[`Backspace`,`backspace`],[`Delete`,`delete`],[`Tab`,`tab`],[`Home`,`home`],[`End`,`end`],[`PageUp`,`pageup`],[`PageDown`,`pagedown`],[`Insert`,`insert`],[`CapsLock`,`capslock`],[`NumLock`,`numlock`],[`ScrollLock`,`scrolllock`],[`ContextMenu`,`menu`],[`Meta`,`super`],[`OS`,`super`],[`Alt`,`alt`],[`Control`,`control`],[`Shift`,`shift`]]);function Ic(e){let t=e?.trim().toLowerCase();return t?t.includes(`mac`)||t.includes(`darwin`)?`macos`:t.includes(`win`)?`windows`:t.includes(`linux`)||t.includes(`x11`)?`linux`:`unknown`:`unknown`}function Lc(){let e=globalThis.navigator,t=e?.userAgentData?.platform,n=Ic(t);return n===`unknown`?Ic(e?.platform??e?.userAgent):n}function Rc(){let e=Lc();return{platform:e,primaryModifier:e===`macos`?`super`:e===`unknown`?`unknown`:`ctrl`,modifiers:{ctrl:`supported`,shift:`supported`,meta:`supported`,super:`supported`,hyper:`unsupported`}}}function zc(e){return e.length===1&&!/^[a-z0-9]$/i.test(e)}function Bc(e){let t={name:e.name,ctrl:e.ctrl,shift:e.shift,meta:e.meta,super:e.super??!1,hyper:e.hyper||void 0};return!t.shift||!zc(t.name)?[t]:[t,{...t,shift:!1}]}var Vc=class{name;ctrl;shift;meta;superKey;originalEvent;propagationStopped=!1;constructor(e,t,n,r,i,a){this.name=e,this.ctrl=t,this.shift=n,this.meta=r,this.superKey=i,this.originalEvent=a}get super(){return this.superKey}preventDefault(){this.originalEvent?.preventDefault()}stopPropagation(){this.propagationStopped=!0,this.originalEvent?.stopPropagation()}};function Hc(){return globalThis.MutationObserver}function Uc(e){return Fc.get(e)||(/^F\d{1,2}$/i.test(e)||e.length===1?e.toLowerCase():e.trim().toLowerCase().replace(/\s+/g,``))}function Wc(e){if(!e)return new Vc(`command`,!1,!1,!1,!1);let t=globalThis.KeyboardEvent;return new Vc(Uc(e.key),e.ctrlKey,e.shiftKey,e.altKey,e.metaKey,t&&e instanceof t?e:void 0)}var Gc=class{metadata=Rc();rootTarget;isDestroyed=!1;observer;targetDestroyListeners=new Map;constructor(e){this.rootTarget=e}getFocusedTarget(){let e=this.rootTarget.ownerDocument.activeElement;return!e||typeof e!=`object`?null:e===this.rootTarget||this.rootTarget.contains(e)?e:null}getParentTarget(e){return e.parentElement}isTargetDestroyed(e){return e===this.rootTarget?!1:!e.isConnected||!this.rootTarget.contains(e)}onKeyPress(e){let t=t=>{e(Wc(t))};return this.rootTarget.addEventListener(`keydown`,t,{capture:!0}),()=>{this.rootTarget.removeEventListener(`keydown`,t,{capture:!0})}}onKeyRelease(e){let t=t=>{e(Wc(t))};return this.rootTarget.addEventListener(`keyup`,t,{capture:!0}),()=>{this.rootTarget.removeEventListener(`keyup`,t,{capture:!0})}}onFocusChange(e){let t=()=>{queueMicrotask(()=>{e(this.getFocusedTarget())})};return this.rootTarget.addEventListener(`focusin`,t,{capture:!0}),this.rootTarget.addEventListener(`focusout`,t,{capture:!0}),()=>{this.rootTarget.removeEventListener(`focusin`,t,{capture:!0}),this.rootTarget.removeEventListener(`focusout`,t,{capture:!0})}}onTargetDestroy(e,t){let n=this.targetDestroyListeners.get(e);return n||(n=new Set,this.targetDestroyListeners.set(e,n)),n.add(t),this.ensureObserver(),this.flushDisconnectedTargets(),()=>{let n=this.targetDestroyListeners.get(e);n&&(n.delete(t),n.size===0&&this.targetDestroyListeners.delete(e),this.targetDestroyListeners.size===0&&this.disconnectObserver())}}createCommandEvent(){return Wc()}ensureObserver(){if(this.observer||this.targetDestroyListeners.size===0)return;let e=Hc();e&&(this.observer=new e(()=>{this.flushDisconnectedTargets()}),this.observer.observe(this.rootTarget,{childList:!0,subtree:!0}))}disconnectObserver(){this.observer&&=(this.observer.disconnect(),void 0)}flushDisconnectedTargets(){for(let[e,t]of this.targetDestroyListeners)if(this.isTargetDestroyed(e)){this.targetDestroyListeners.delete(e);for(let e of[...t])e()}this.targetDestroyListeners.size===0&&this.disconnectObserver()}};function Kc(e){return new Gc(e)}var qc=(e,t)=>Bc(e).map(e=>t.resolveKey(e)),Jc=`fungi.app.ready`,Yc=`fungi.app.connect`,K=e=>A.pipe(R(be(1)),R(N(e))),Xc=e=>Je(K(e)),Zc=Pe.pipe(R(De()),R(Ke(Number.isSafeInteger,{message:`Expected a safe integer`}))),Qc=Zc.pipe(R(Me(0))),$c=Zc.pipe(R(ye(0))),el=k({appId:K(160),releaseId:K(160),surfaceId:K(160)}),tl=k({editing:o,surface:_e([K(160),u])}),nl=_e([k({kind:f(`compose`),requestId:K(160),text:K(2e3)}),k({kind:f(`navigate`),requestId:K(160),params:Xe(k({key:K(64),value:K(4096)})).pipe(R(N(16)))})]),rl=k({computerId:_e([K(256),u]),teamHasComputers:Je(v(o)),computerAccessGranted:Je(o),focus:tl,openRequest:_e([u,nl]),visibility:T([`visible`,`hidden`])}),il=T([`connecting`,`connected`,`suspended`,`disconnected`,`disposing`,`disposed`]),al=k({altKey:o,ctrlKey:o,id:K(160),key:K(64),metaKey:o,shiftKey:o}),ol=k({action:Je(Ve),availability:Je(Ve),category:K(160),description:Xc(512),id:K(160),projections:Je(Ve),title:K(160)}),sl=k({arguments:Je(Ve),commandId:K(321),origin:T([`agent`,`browser`,`keyboard`,`menu`,`palette`,`programmatic`,`slash`,`terminal`]),requestId:K(160)}),cl=_e([k({result:Je(Ve),status:f(`handled`)}),k({error:Ve,status:f(`failed`)})]),ll=e=>K(e).pipe(R(Ke(e=>{for(let t=0;t<e.length;t+=1)if(Ta(e.charCodeAt(t)))return!1;return!0},{message:`Expected one line of plain text`}))),ul={id:K(64),text:ll(80),end:de(o)},dl=de(Pe.pipe(R(De()),R(he({minimum:0,maximum:9999})))),fl=Xe(_e([k({...ul,kind:f(`text`),tone:de(T([`neutral`,`success`,`warning`,`error`]))}),k({...ul,kind:f(`button`),icon:de(T([`folder`,`ports`,`processes`,`access`])),count:dl,title:de(ll(1024)),disabled:de(o),opens:de(f(`dialog`)),expanded:de(o)}),k({...ul,kind:f(`toggle`),pressed:o}),k({...ul,kind:f(`menu`),count:dl,title:de(ll(1024)),options:Xe(k({id:K(64),text:ll(80),checked:de(o),disabled:de(o)})).pipe(R(N(16)),R(Ke(e=>new Set(e.map(e=>e.id)).size===e.length,{message:`Expected unique status option ids`})))})])).pipe(R(N(6)),R(Ke(e=>new Set(e.map(e=>e.id)).size===e.length,{message:`Expected unique status item ids`}))),pl=k({computerId:K(256),path:K(1024)}),ml=K(80).pipe(R(Ke(e=>e.trim()===e,{message:`Expected a trimmed title`}))),hl=K(64),gl=K(80),_l=e=>new Set(e.map(e=>e.id)).size===e.length,vl=k({id:hl,label:gl,siblings:Je(Xe(k({id:hl,label:gl})).pipe(R(N(16)),R(Ke(_l,{message:`Expected unique crumb sibling ids`}))))}),yl=k({id:hl,label:gl,icon:Je(f(`play`)),variant:Je(T([`primary`,`outline`,`ghost`])),tone:Je(f(`destructive`)),disabled:Je(o)}),bl=e=>Xe(yl).pipe(R(N(e)),R(Ke(_l,{message:`Expected unique header command ids`}))),xl=k({id:hl,label:gl,presentation:Je(f(`bead`)),tone:Je(T([`neutral`,`info`,`warning`,`success`,`error`]))}),Sl={status:Je(Xe(xl).pipe(R(N(4)),R(Ke(_l,{message:`Expected unique header status ids`})))),crumbs:Je(Xe(vl).pipe(R(N(8)),R(Ke(_l,{message:`Expected unique crumb ids`})))),primary:Je(bl(3)),menu:Je(bl(12))},Cl=k({contractVersion:f(1),canGoBack:o,title:Je(ml),...Sl}),wl=k({canGoBack:o,title:Je(A),...Sl}),Tl=_e([k({kind:f(`crumb`),crumbId:hl,siblingId:Je(hl)}),k({kind:f(`action`),actionId:hl})]),El=v(k({agentId:K(256),sessionId:K(256)})),Dl=k({agents:Je(Xe(T([`agent.list`,`agent.manage`,`agent.read`,`agent.send`])).pipe(R(N(4)))),computers:Je(Xe(T([`computer.list`,`computer.readFile`,`computer.writeFile`,`computer.execute`])).pipe(R(N(4))))}),Ol=T([`granted`,`declined`,`customize`]),kl=k({message:K(512),tone:Je(T([`info`,`success`,`warning`,`error`]))}),Al=T(d);k({code:Al.pick([`DELIVERY_PENDING`])});var jl=k({code:Al,message:K(512),retryable:o}),Ml=k({protocolVersion:f(2),type:f(Jc)}),Nl=k({epoch:K(160),protocolVersion:f(2),type:f(Yc)}),Pl=k({epoch:K(160),protocolVersion:f(2)}),Fl={[Symbol.dispose]:Je(Ve)},Il=_e([k({...Fl,ok:f(!0),value:Ve}),k({...Fl,error:jl,ok:f(!1)})]);function q(e,t,r=`PROTOCOL`){return n(Ae(e,{onExcessProperty:`error`}),p({onFailure:e=>{throw new E(`The peer sent malformed protocol data`,{cause:e,code:r,retryable:!1})},onSuccess:t}))}function J(e){return Object.freeze(e)}function Ll(e,t){let n=e.arguments===void 0?void 0:Cr(e.arguments),r={origin:e.origin,signal:t};return n!==void 0&&Object.assign(r,{arguments:n}),J(r)}var Rl=q(ol,e=>{let t={category:e.category,id:e.id,title:e.title};return e.action!==void 0&&Object.assign(t,{action:e.action}),e.availability!==void 0&&Object.assign(t,{availability:e.availability}),e.description!==void 0&&Object.assign(t,{description:e.description}),e.projections!==void 0&&Object.assign(t,{projections:e.projections}),J(Du(()=>Ir(t)))},`INVALID_ARGUMENT`),zl=q(K(321),e=>e),Bl=q(sl,e=>{let t=e.arguments===void 0?void 0:Cr(e.arguments),n={commandId:e.commandId,origin:e.origin,requestId:e.requestId};return t!==void 0&&Object.assign(n,{arguments:t}),J(n)}),Vl=q(_e([r,Ve]),e=>e===void 0?void 0:Cr(e)),Hl=q(Nl,e=>J(e));q(Pl,e=>J(e));var Ul=q(rl,e=>{let t={computerId:e.computerId,focus:J({...e.focus}),openRequest:e.openRequest===null?null:J({...e.openRequest}),visibility:e.visibility};return e.teamHasComputers!==void 0&&(t.teamHasComputers=e.teamHasComputers),e.computerAccessGranted!==void 0&&(t.computerAccessGranted=e.computerAccessGranted),J(t)}),Wl=q(jl,e=>J({...e})),Gl=q(tl,e=>J({...e}),`INVALID_ARGUMENT`),Kl=q(el,e=>J({...e})),ql=q(il,e=>e),Jl=q(fl,e=>J(e.map(e=>e.kind===`menu`?J({...e,options:J(e.options.map(e=>J(e)))}):J(e))),`INVALID_ARGUMENT`),Yl=q(k({itemId:K(64),optionId:de(K(64)),anchor:de(k({start:Pe.pipe(R(he({minimum:0,maximum:1e5}))),width:Pe.pipe(R(he({minimum:0,maximum:1e5})))}))}),e=>J(e.anchor===void 0?{...e}:{...e,anchor:J({...e.anchor})}),`INVALID_ARGUMENT`),Xl=q(pl,e=>J({...e}),`INVALID_ARGUMENT`);function Zl(e){let t={id:e.id,label:e.label};return e.presentation!==void 0&&(t={...t,presentation:e.presentation}),e.tone!==void 0&&(t={...t,tone:e.tone}),J(t)}function Ql(e){let t={id:e.id,label:e.label};return e.siblings===void 0?J(t):J({...t,siblings:J(e.siblings.map(e=>J({...e})))})}function $l(e){let t={id:e.id,label:e.label};return e.icon!==void 0&&(t={...t,icon:e.icon}),e.variant!==void 0&&(t={...t,variant:e.variant}),e.tone!==void 0&&(t={...t,tone:e.tone}),e.disabled!==void 0&&(t={...t,disabled:e.disabled}),J(t)}function eu(e){let t={canGoBack:e.canGoBack};return e.title!==void 0&&(t={...t,title:e.title}),e.crumbs!==void 0&&(t={...t,crumbs:J(e.crumbs.map(Ql))}),e.primary!==void 0&&(t={...t,primary:J(e.primary.map($l))}),e.menu!==void 0&&(t={...t,menu:J(e.menu.map($l))}),e.status!==void 0&&(t={...t,status:J(e.status.map(Zl))}),J(t)}var tu=q(Cl,eu,`INVALID_ARGUMENT`),nu=q(wl,e=>{let t=e.title?.trim();return ru({...eu({...e,title:t===void 0||t.length===0?void 0:t}),contractVersion:1})},`INVALID_ARGUMENT`),ru=q(Cl,e=>J({...eu(e),contractVersion:1}),`INVALID_ARGUMENT`),iu=q(Tl,e=>e.kind===`action`?J({...e}):J(e.siblingId===void 0?{kind:e.kind,crumbId:e.crumbId}:e),`INVALID_ARGUMENT`),au=q(El,e=>e===null?null:J({...e}),`INVALID_ARGUMENT`),ou=q(Dl,e=>J({agents:J([...new Set(e.agents??[])]),computers:J([...new Set(e.computers??[])])}),`INVALID_ARGUMENT`);q(Ml,e=>J(e));var su=q(K(512),e=>e),cu=q(kl,e=>J({...e}),`INVALID_ARGUMENT`);q(k({id:K(160),repeat:o}),e=>J(e));var lu=q(Xe(al).pipe(R(N(64))),e=>{if(new Set(e.map(e=>e.id)).size!==e.length)throw new E(`Reserved chords are invalid`,{code:`PROTOCOL`,retryable:!1});return J(e.map(e=>J({...e})))});function uu(e){return q(k({value:Ve,version:Qc}),t=>J({value:e(t.value),version:t.version}))}var du=uu(Ul),fu=q(k({capabilities:Xe(Ve).pipe(R(N(128))),context:Ve}),e=>J({capabilities:J(e.capabilities.map(e=>vu(e))),context:du(e.context)})),pu=uu(ql),mu=uu(lu),hu=uu(su),gu=n(pu,e=>{if(e.value!==`connected`&&e.value!==`suspended`)throw new E(`The host lifecycle is invalid`,{code:`PROTOCOL`,retryable:!1});return J({value:e.value,version:e.version})});function _u(e){return q(k({handle:Ve,id:K(160),version:$c}),t=>{if(!(t.handle instanceof Sa)&&!(e&&t.handle instanceof Ca))throw new E(`A capability handle is invalid`,{code:`PROTOCOL`,retryable:!1});return J({handle:t.handle,id:t.id,version:t.version})})}var vu=_u(!1),yu=_u(!0);function bu(e){let t=e?yu:vu;return q(k({capabilities:Xe(Ve).pipe(R(N(128))),context:Ve,identity:Ve,lifecycle:Ve,reservedChords:Ve,theme:Ve}),e=>J({capabilities:J(e.capabilities.map(e=>t(e))),context:du(e.context),identity:Kl(e.identity),lifecycle:gu(e.lifecycle),reservedChords:mu(e.reservedChords),theme:hu(e.theme)}))}var xu=bu(!1);bu(!0);function Su(e){return q(Il,t=>t.ok?J({ok:!0,value:e(t.value)}):J({ok:!1,error:Wl(t.error)}))}var Cu=Su(xu),wu=Su(q(k({commandId:K(321)}),e=>J(e)));Su(q(cl,e=>{if(e.status===`failed`)return J({status:`failed`,error:Du(()=>Tr(e.error))});let t=e.result===void 0?void 0:Cr(e.result);return J(t===void 0?{status:`handled`}:{status:`handled`,result:t})}));var Tu=Su(q(r,()=>void 0)),Eu=Su(q(Ol,e=>e));Su(q(o,e=>e)),Su(q(o,e=>e));function Du(e){try{return e()}catch(e){throw new E(`The command metadata is invalid`,{cause:e,code:`INVALID_ARGUMENT`,retryable:!1})}}var Ou=_e([k({kind:f(`saveFile`),name:K(255).pipe(R(oe(/^[^\p{Cc}/\\]+$/u))),mime:K(255),bytes:C}),k({kind:f(`copyText`),text:A})]);function ku(e){let t=Ae(Ou,{onExcessProperty:`error`})(e);if(c(t))return{kind:`refused`,reason:`invalid-request`};let n=t.success;return n.kind===`saveFile`?n.name===`.`||n.name===`..`?{kind:`refused`,reason:`invalid-request`}:n.bytes.byteLength>33554432?{kind:`refused`,reason:`too-large`}:{...n,bytes:new Uint8Array(n.bytes)}:n.text.length>1048576||new TextEncoder().encode(n.text).byteLength>1048576?{kind:`refused`,reason:`too-large`}:n}var Au=Su(q(_e([k({kind:f(`saved`)}),k({kind:f(`copied`)}),k({kind:f(`refused`),reason:T([`no-user-gesture`,`too-large`,`invalid-request`,`unavailable`,`denied`,`busy`])})]),e=>J(e)));function ju(e){return e instanceof E?{code:e.code,message:Nu(e.message),retryable:e.retryable}:{code:`HOST_FAILURE`,message:`Host operation failed`,retryable:!1}}function Mu(e){try{let t=Wl(e);return new E(t.message,{code:t.code,retryable:t.retryable})}catch(e){return new E(`The host returned a malformed error`,{cause:e,code:`PROTOCOL`,retryable:!1})}}function Nu(e){return e.trim().slice(0,512)||`Host operation failed`}var Pu=e=>({ok:!0,value:e}),Fu=e=>({error:ju(e),ok:!1});async function Iu(e,t){let n,r=new Set;try{return n=await e,Lu(t(n))}catch(e){throw Ru(e)&&zu(e,r),e instanceof E?e:new E(`The remote operation failed`,{cause:e,code:`HOST_FAILURE`,retryable:!0})}finally{n!==e&&Ru(n)&&zu(n,r)}}function Lu(e){if(e.ok)return e.value;throw Mu(e.error)}function Ru(e){return O(e)&&Symbol.dispose in e&&ie(e[Symbol.dispose])}function zu(e,t){if(!t.has(e)){t.add(e);try{e[Symbol.dispose]()}catch(e){console.warn(`RPC result disposal failed`,e)}}}function Bu(){let e=[],t=new Set;return{get:()=>e,subscribe:e=>(t.add(e),()=>t.delete(e)),update:n=>{e=n;for(let e of Array.from(t))try{e()}catch(e){console.warn(`App binding subscriber failed`,e)}}}}function Vu(e){let t=lu(e),n=new Set;return{get:()=>t,subscribe:e=>(n.add(e),()=>n.delete(e)),update:e=>{t=lu(e);for(let e of Array.from(n))try{e()}catch(e){console.warn(`Reserved chord subscriber failed`,e)}}}}function Hu(e){let t=!0,n,r=e.window.document.querySelector(`html`);if(!r)return()=>{t=!1};let i=Kc(r),a=new cc(i);Oc(a),Pc(a),a.prependEventMatchResolver(qc);let o=Wu(e.onBroken),s=Ju(a,e.chords,e.remote,o),c=Uu(e,o,()=>t,e=>{n=e},()=>n),l=i.onFocusChange(()=>{queueMicrotask(c)}),u=()=>{queueMicrotask(c)};e.window.addEventListener(`focus`,u),e.window.addEventListener(`blur`,u);let d=e.bindings,f=()=>Gu(e.window.document,e.identity.surfaceId).editing,p=d===void 0?()=>void 0:Ku(a,d,f),m=d===void 0?()=>void 0:d.subscribe(()=>{p(),p=Ku(a,d,f)}),h=e.chords.subscribe(()=>{s(),s=Ju(a,e.chords,e.remote,o)});return queueMicrotask(c),()=>{t&&(t=!1,l(),e.window.removeEventListener(`focus`,u),e.window.removeEventListener(`blur`,u),h(),s(),m(),p())}}function Uu(e,t,n,r,i){return()=>{if(!n())return;let a=Gu(e.window.document,e.identity.surfaceId),o=i();(a.editing!==o?.editing||a.surface!==o.surface)&&(r(a),t(()=>e.remote.reportFocus(a)))}}function Wu(e){return t=>{try{Iu(t(),Tu).catch(t=>{Qr(`browser-bridge.host-call`,t),e(t)})}catch(t){Qr(`browser-bridge.host-call`,t),e(t)}}}function Gu(e,t){let n=e.activeElement;return Gl({editing:!!(n?.matches(`input, textarea, select, [contenteditable='true']`)===!0||n?.closest(`[contenteditable='true']`)),surface:e.hasFocus()?t:null})}function Ku(e,t,n){let r=t.get();return e.registerLayer({bindings:r.map((e,t)=>({cmd:`app/${String(t)}`,key:e.key})),commands:r.map((e,t)=>({name:`app/${String(t)}`,run:t=>{let r=t.event.originalEvent;if(r?.defaultPrevented||r?.isComposing||qu(e.key)&&n())return!1;e.run()}})),priority:500})}function qu(e){return!/(?:^|\+)(?:ctrl|control|super|meta|cmd|alt|option|mod)\+/iu.test(e)}function Ju(e,t,n,r){let i=t.get();return e.registerLayer({bindings:i.map(e=>({cmd:`reserved/${e.id}`,key:{ctrl:e.ctrlKey,meta:e.altKey,name:Uc(e.key),shift:e.shiftKey,super:e.metaKey}})),commands:i.map(e=>({name:`reserved/${e.id}`,run:t=>{let i=t.event.originalEvent;if(i?.defaultPrevented||i?.isComposing)return!1;r(()=>n.invokeReservedChord(e.id,i?.repeat??!1))}})),priority:1e3})}function Yu(e){let t=t=>{if(t.defaultPrevented||t.isComposing)return;let n=Qu(t,e.mac);n!==null&&(t.preventDefault(),n===`back`&&!t.repeat&&e.canGoBack()&&e.back())},n=t=>{let n=Zu(t.button);if(n===null)return;let r=t.defaultPrevented;t.preventDefault(),t.type===`mouseup`&&n===`back`&&!r&&e.canGoBack()&&e.back()};e.window.addEventListener(`keydown`,t);for(let t of Xu)e.window.addEventListener(t,n);return()=>{e.window.removeEventListener(`keydown`,t);for(let t of Xu)e.window.removeEventListener(t,n)}}var Xu=[`mousedown`,`mouseup`,`auxclick`];function Zu(e){return e===3?`back`:e===4?`forward`:null}function Qu(e,t){return e.shiftKey||e.ctrlKey?null:t?!e.metaKey||e.altKey?null:e.key===`[`?`back`:e.key===`]`?`forward`:$u(e.target)?null:e.key===`ArrowLeft`?`back`:e.key===`ArrowRight`?`forward`:null:!e.altKey||e.metaKey?null:e.key===`ArrowLeft`?`back`:e.key===`ArrowRight`?`forward`:null}function $u(e){return e instanceof HTMLElement?e.isContentEditable||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement:!1}function ed(){return!S(globalThis.navigator)&&/Mac|iPhone|iPad/u.test(globalThis.navigator.userAgent)}function td(e){let t=e,n=new Set;return{get:()=>t,subscribe(e){n.add(e);let t=!0;return()=>{t&&(t=!1,n.delete(e))}},update(e){if(!Object.is(t,e)){t=e;for(let e of Array.from(n))try{e(t)}catch(e){console.warn(`App store subscriber failed`,e)}}}}}function nd(e){let t=new Map,n=td(0),r=!1,i=e=>{let t=new Map;try{for(let n of e){let e=vu(n),r=od(e.id,e.version);if(t.has(r))throw id(e.handle),new E(`Duplicate capability grant`,{code:`PROTOCOL`,retryable:!1});t.set(r,e.handle)}}catch(e){for(let e of t.values())id(e);throw e}return t};for(let[n,r]of i(e))t.set(n,r);let a=e=>{for(let t of e)id(t)},o=e=>{if(r)throw new E(`The app connection is disposed`,{code:`DISCONNECTED`,retryable:!0});let n=od(e.id,e.version);return t.get(n)};return{directory:Object.freeze({get version(){return n.get()},subscribe:e=>n.subscribe(e),has(e){return!!o(e)},require(e){let t=o(e);if(!t)throw new E(`The capability is not granted`,{code:`CAPABILITY_DENIED`,retryable:!1});try{return e.schema.parse(t)}catch(e){throw new E(`The capability interface is malformed`,{cause:e,code:`PROTOCOL`,retryable:!1})}}}),replace(e){if(r)throw new E(`The app connection is disposed`,{code:`DISCONNECTED`,retryable:!0});let o=i(e),s=[...t.values()];t.clear();for(let[e,n]of o)t.set(e,n);a(s.filter(e=>![...o.values()].includes(e))),n.update(n.get()+1)},disconnect(){r||(r=!0,a(t.values()),t.clear(),n.update(n.get()+1))}}}var rd=qe().transform(e=>{let t=ue(Object).safeParse(e);if(!t.success)return;let n=Object.create(t.data),r=Re(k({[Symbol.dispose]:Je(Ee(Function))}))(n);return{owner:t.data,dispose:r[Symbol.dispose]}});function id(e){try{let t=rd.parse(e);if(t===void 0||ad.has(t.owner))return;ad.add(t.owner),t.dispose?.call(t.owner)}catch(e){console.warn(`RPC value disposal failed`,e)}}var ad=new WeakSet;function od(e,t){return`${e}@${String(t)}`}var sd=class extends Ca{#e=!0;#t;#n=new Map;constructor(e){super(),this.#t=e}cancel(e){try{return this.#n.get(zl(e))?.abort(),Promise.resolve(Pu(void 0))}catch(e){return Promise.resolve(Fu(e))}}dispose(){if(this.#e){this.#e=!1;for(let e of this.#n.values())e.abort();this.#n.clear()}}async invoke(e){try{if(!this.#e)throw new E(`The command is disposed`,{code:`DISCONNECTED`,retryable:!0});let t=Bl(e);if(this.#n.has(t.requestId))throw new E(`Duplicate command request`,{code:`PROTOCOL`,retryable:!1});if(this.#n.size>=64)throw new E(`Too many command requests`,{code:`HOST_FAILURE`,retryable:!0});let n=new AbortController;this.#n.set(t.requestId,n);try{let e=Vl(await this.#t(Ll(t,n.signal)));return Pu(e===void 0?{status:`handled`}:{status:`handled`,result:e})}finally{this.#n.delete(t.requestId)}}catch(e){if(e instanceof Cn)try{return Pu({status:`failed`,error:Tr({code:e.code,message:e.message,details:e.details})})}catch(e){return Fu(e)}return Fu(e)}}[Symbol.dispose](){this.dispose()}};function cd(e){let t=[];for(let n of e.values()){let{definition:e,handler:r}=n;if(n.commandId===void 0)continue;let i=e.availability?.status!==`unavailable`;for(let n of e.projections?.bindings?.values??[])n.trim().includes(` `)||n.startsWith(`<`)||t.push({key:n,run:()=>{i&&Promise.resolve().then(()=>r({origin:`keyboard`,signal:new AbortController().signal})).catch(e=>{console.warn(`App key command failed`,e)})}})}return t}function ld(e,t,n,r){let i=new Map,a=!1,o=()=>{r?.update(a?[]:cd(i))},s=e=>{try{n()}catch(t){console.warn(`App command failure callback failed`,t,e)}},c=e=>{try{Iu(e(),Tu).catch(e=>{s(e)})}catch(e){console.warn(`App command RPC supervision failed`,e),s(e)}};return{commands:dd(e,t,i,()=>a,t=>{let n=i.get(t);if(!n)return;i.delete(t),n.target.dispose(),o();let r=n.commandId;!a&&r!==void 0&&c(()=>e.unregisterCommand(r))},o),dispose(){if(!a){a=!0;for(let e of i.values())e.target[Symbol.dispose]();i.clear(),o()}}}}function ud(e,t,n,r){let i=t.id;if(e.size>=128||e.has(i))throw r.dispose(),new E(`Command registration is unavailable`,{code:`INVALID_ARGUMENT`,retryable:!1});let a={commandId:void 0,definition:t,handler:n,target:r};e.set(i,a);let o=!1;return{commit(e){o||(a.commandId=e)},release(){o||(o=!0,e.get(i)===a&&e.delete(i),r.dispose())},target:r}}function dd(e,t,n,r,i,a){return Object.freeze({async register(o,s){if(t(),!ie(s))throw new E(`Command handler must be a function`,{code:`INVALID_ARGUMENT`,retryable:!1});let c=Rl(o),l=new sd(s),u=ud(n,c,s,l);try{let t=await fd(e,c,u.target);r()&&await pd(e,t.commandId,l),u.commit(t.commandId),a()}catch(e){throw u.release(),e}let d=!0;return()=>{d&&(d=!1,i(c.id))}}})}async function fd(e,t,n){return Iu(e.registerCommand(t,n),wu)}async function pd(e,t,n){throw n.dispose(),await Iu(e.unregisterCommand(t),Tu),new E(`The command controller is disposed`,{code:`DISCONNECTED`,retryable:!0})}var md=Ce(e=>e instanceof Sa),hd=class extends Ca{#e=!1;#t;constructor(e){super(),this.#t=e}disconnect(e){try{if(this.#e)throw Ed();let t=e===void 0?void 0:Wl(e);return setTimeout(()=>this.#t.disconnect?.(t??Ad()),0),Promise.resolve(Pu(void 0))}catch(e){return Promise.resolve(Fu(e))}}async requestClose(){try{if(this.#e)throw Ed();return Pu(await(this.#t.beforeClose?.()??!0))}catch(e){return Fu(e)}}async requestBack(){try{if(this.#e)throw Ed();return Pu(await(this.#t.back?.()??!1))}catch(e){return Fu(e)}}async activateNavigation(e){try{if(this.#e)throw Ed();let t=iu(e);return Da(this.#t.navigation,t)?Pu(await(this.#t.activate?.(t)??!1)):Pu(!1)}catch(e){return Fu(e)}}async activateStatus(e){try{if(this.#e)throw Ed();let t=Yl(e);return Ea(this.#t.statusItems,t)?Pu(await(this.#t.statusAction?.(t)??!1)):Pu(!1)}catch(e){return Fu(e)}}[Symbol.dispose](){this.#e=!0}async updateContext(e){return this.#e?Fu(Ed()):this.#n(e,`context`,Ul,e=>{this.#t.context.update(e)})}reconfigure(e){let t=[];try{if(this.#e)throw Ed();let n=fu(e);if(n.context.version<=this.#t.versions.context)return Promise.resolve(Pu(void 0));for(let e of n.capabilities)t.push({...e,handle:Re(md)(e.handle).dup()});if(!this.#t.capabilities)throw Ed();return this.#t.capabilities.replace(t),t=[],this.#t.versions.context=n.context.version,this.#t.context.update(n.context.value),Promise.resolve(Pu(void 0))}catch(e){for(let e of t)id(e.handle);return Promise.resolve(Fu(e))}}updateLifecycle(e){try{if(this.#e)throw Ed();let t=uu(ql)(e);if(t.version<=this.#t.versions.lifecycle)return Promise.resolve(Pu(void 0));if(!jd(this.#t.lifecycle.get(),t.value))throw new E(`The host sent an invalid lifecycle transition`,{code:`PROTOCOL`,retryable:!1});return this.#t.versions.lifecycle=t.version,this.#t.lifecycle.update(t.value),Promise.resolve(Pu(void 0))}catch(e){return Promise.resolve(Fu(e))}}async updateReservedChords(e){return this.#e?Fu(Ed()):this.#n(e,`chords`,lu,e=>{this.#t.chords.update(e)})}async updateTheme(e){return this.#e?Fu(Ed()):this.#n(e,`theme`,su,e=>{this.#t.theme.update(e)})}#n(e,t,n,r){try{let i=uu(n)(e);return i.version>this.#t.versions[t]&&(this.#t.versions[t]=i.version,r(i.value)),Promise.resolve(Pu(void 0))}catch(e){return Promise.resolve(Fu(e))}}};async function gd(e){let t=bd(),n=new hd(t),r=wa(e.port,n),i,a=yd(r);try{performance.mark(`fungi.app-open.agar-rpc-connect-start`);let o=await Promise.race([r.connect({epoch:e.epoch,protocolVersion:2}),a]);performance.mark(`fungi.app-open.agar-rpc-connect-ready`),i=o;let s=Lu(Cu(o));if(!e.isActive())throw vd();let c=xd({bootstrap:s,bootstrapOwner:i,options:e,remote:r,state:t,target:n});return performance.mark(`fungi.app-open.agar-root-created`),i=void 0,c}catch(t){return Nd(t,e,n,r,i)}}function _d(e,t){e.context.update(t.context.value),e.theme.update(t.theme.value),e.lifecycle.update(t.lifecycle.value),e.chords.update(t.chords.value),e.versions.context=t.context.version,e.versions.theme=t.theme.version,e.versions.lifecycle=t.lifecycle.version,e.versions.chords=t.chords.version}function vd(){return new E(`App connection was cancelled`,{code:`CANCELLED`,retryable:!1})}function yd(e){let t,n=new Promise((e,n)=>{t=n});return n.catch(e=>{Qr(`app-session.rpc-disconnect`,e)}),e.onRpcBroken(()=>t?.(new E(`The app host disconnected`,{code:`DISCONNECTED`,retryable:!0}))),n}function bd(){return{statusItems:[],navigation:{canGoBack:!1},bindings:Bu(),chords:Vu([]),context:td({computerId:null,focus:{editing:!1,surface:null},openRequest:null,visibility:`hidden`}),lifecycle:td(`connecting`),theme:td(`default`),canGoBack:!1,versions:{chords:-1,context:-1,lifecycle:-1,theme:-1}}}function xd(e){let t=Kl(e.bootstrap.identity),n=Md(e.bootstrap);_d(e.state,n);let r=nd(e.bootstrap.capabilities);return e.state.capabilities=r,Cd(e,t,r)}function Sd(e,t,n){return Hu({bindings:e.state.bindings,chords:e.state.chords,identity:t,onBroken:e=>{n({code:`DISCONNECTED`,message:e instanceof E?e.message:`The app host rejected a browser bridge operation`,retryable:!0})},remote:e.remote,window:e.options.window})}function Cd(e,t,n){let r=!1,i=t=>{r||(r=!0,Od([()=>{t&&e.state.lifecycle.update(`disconnected`)},()=>{e.state.lifecycle.update(`disposing`)},l,u,()=>{o.dispose()},()=>{e.state.beforeClose=void 0,e.state.back=void 0,e.state.activate=void 0,e.state.statusAction=void 0},()=>{n.disconnect()},()=>{e.target[Symbol.dispose]()},()=>{id(e.bootstrapOwner)},()=>{id(e.remote)},()=>{e.options.port.close()},()=>{e.state.lifecycle.update(`disposed`)},e.options.onDisposed],`app connection disposal`))},a=()=>{if(r)throw new E(`The app connection is disposed`,{code:`DISCONNECTED`,retryable:!0})},o=ld(e.remote,a,()=>{i({code:`DISCONNECTED`,message:`The app host rejected a terminal command operation`,retryable:!0})},e.state.bindings),s=Td(e.remote,a,e.state),c=wd(e.state,e.remote,a),l=Sd(e,t,i),u=Yu({window:e.options.window,mac:ed(),canGoBack:()=>e.state.canGoBack&&e.state.back!==void 0,back:()=>{let t=e.state.back;t&&Promise.resolve().then(t).catch(e=>{Qr(`app-window.back-input`,e)})}});return e.state.disconnect=i,e.remote.onRpcBroken(()=>{Dd(i)}),kd({capabilities:n.directory,commands:o.commands,context:e.state.context,dispose:i,identity:t,lifecycle:e.state.lifecycle,theme:e.state.theme,ui:s,window:c})}function wd(e,t,n){let r=Object.freeze({async publish(r){n();let i=nu(r);e.canGoBack=i.canGoBack,e.navigation=tu(i),await Iu(t.reportNavigation(i),Tu)},onActivate(t){if(n(),e.activate!==void 0)throw new E(`The App already owns navigation activations`,{code:`INVALID_ARGUMENT`,retryable:!1});e.activate=t;let r=!1;return()=>{r||(r=!0,e.activate===t&&(e.activate=void 0))}},onBack(t){if(n(),e.back!==void 0)throw new E(`The App already owns Back requests`,{code:`INVALID_ARGUMENT`,retryable:!1});e.back=t;let r=!1;return()=>{r||(r=!0,e.back===t&&(e.back=void 0))}}});return Object.freeze({navigation:r,onBeforeClose(t){if(n(),e.beforeClose!==void 0)throw new E(`The App already owns a close consultation`,{code:`INVALID_ARGUMENT`,retryable:!1});e.beforeClose=t;let r=!1;return()=>{r||(r=!0,e.beforeClose===t&&(e.beforeClose=void 0))}}})}function Td(e,t,n){return Object.freeze({async requestComputerChoice(){t(),await Iu(e.requestComputerChoice(),Tu)},async requestBrowserAction(n){t();let r=ku(n);return r.kind===`refused`?r:await Iu(e.requestBrowserAction(r),Au)},onStatusAction(e){if(t(),n.statusAction!==void 0)throw new E(`The App already owns its status actions`,{code:`INVALID_ARGUMENT`,retryable:!1});n.statusAction=e;let r=!1;return()=>{r||(r=!0,n.statusAction===e&&(n.statusAction=void 0))}},async requestAppPermissions(n){return t(),await Iu(e.requestAppPermissions(ou(n)),Eu)},async openDesktopSettings(){t(),await Iu(e.openDesktopSettings(),Tu)},async openTeamBilling(){t(),await Iu(e.openTeamBilling(),Tu)},async openNavigation(n){t(),await Iu(e.openNavigation(Xl(n)),Tu)},async reportStatus(r){t();let i=Jl(r);n.statusItems=i,await Iu(e.reportStatus(i),Tu)},async reportAgentSessionSelection(n){t(),await Iu(e.reportAgentSessionSelection(au(n)),Tu)},async showToast(n){t(),await Iu(e.showToast(cu(n)),Tu)}})}function Ed(){return new E(`The app connection is disposed`,{code:`DISCONNECTED`,retryable:!0})}function Dd(e){e({code:`DISCONNECTED`,message:`The app host disconnected`,retryable:!0})}function Od(e,t){for(let n of e)try{n()}catch(e){console.warn(`${t} cleanup failed`,e)}}function kd(e){return Object.freeze(e)}function Ad(){return{code:`DISCONNECTED`,message:`The app host disconnected`,retryable:!1}}function jd(e,t){return e===t||e===`connected`&&t===`suspended`||e===`suspended`&&t===`connected`}function Md(e){let t=uu(Ul)(e.context),n=uu(su)(e.theme),r=uu(ql)(e.lifecycle),i=uu(lu)(e.reservedChords);if(r.value!==`connected`&&r.value!==`suspended`)throw new E(`The bootstrap lifecycle is invalid`,{code:`PROTOCOL`,retryable:!1});return{chords:i,context:t,lifecycle:r,theme:n}}function Nd(e,t,n,r,i){throw Od([()=>{n[Symbol.dispose]()},()=>{i&&id(i)},()=>{id(r)},()=>{t.port.close()},t.onDisposed],`app connection rejection`),e instanceof E?e:new E(`Unable to establish the app RPC session`,{cause:e,code:`PROTOCOL`,retryable:!1})}var Pd=!1,Fd=class{options;#e;#t;#n=!1;#r;#i;constructor(e){this.options=e,this.#e=globalThis.window}start(){performance.mark(`fungi.app-open.agar-connect-start`);let e=this.#l();return e?Promise.reject(e):(Pd=!0,this.#a())}#a(){return new Promise((e,t)=>{let n=(n,a)=>{this.#o(n,a,i,r,e,t)},r=()=>{n(Ld())},i=e=>{this.#s(e,n,i)};this.#e.addEventListener(`message`,i),this.options.signal?.addEventListener(`abort`,r,{once:!0});let a=()=>{try{performance.mark(`fungi.app-open.agar-ready-sent`),this.#e.parent.postMessage({protocolVersion:2,type:Jc},`*`)}catch(e){Qr(`connect.notify-host`,e),n(Ud(e))}};this.#r=setInterval(a,200),this.#i=setTimeout(()=>{n(zd())},1e4),a()})}#o(e,t,n,r,i,a){if(!this.#n){if(this.#n=!0,this.#c(),this.#e.removeEventListener(`message`,n),this.options.signal?.removeEventListener(`abort`,r),e||!t){this.#t?.close(),Pd=!1,a(e??zd());return}i(t)}}#s(e,t,n){if(!Hd(e.data))return;if(performance.mark(`fungi.app-open.agar-connect-received`),e.source!==this.#e.parent||Bd(e.origin)===void 0){t(Vd());return}let r=Wd(e,t);if(!r)return;let i=e.ports.length===1?e.ports[0]:void 0;if(!i){t(Gd(`The app host did not transfer exactly one port`));return}this.#t=i,this.#c(),this.#e.removeEventListener(`message`,n),gd({epoch:r.epoch,isActive:()=>!this.#n,onDisposed:()=>{Pd=!1},port:i,window:this.#e}).then(e=>{performance.mark(`fungi.app-open.agar-root-ready`),t(void 0,e)},e=>{t(Rd(e))})}#c(){clearInterval(this.#r),clearTimeout(this.#i),this.#r=void 0,this.#i=void 0}#l(){if(this.options.signal?.aborted)return Ld();if(Pd)return new E(`An app connection is already live`,{code:`IDENTITY`,retryable:!1});if(S(globalThis.window)||this.#e.parent===this.#e)return new E(`The app host is unavailable`,{code:`DISCONNECTED`,retryable:!0})}};function Id(e){return new Fd(e).start()}function Ld(){return new E(`App connection was cancelled`,{code:`CANCELLED`,retryable:!1})}function Rd(e){return e instanceof E?e:new E(`Unable to connect to the app host`,{cause:e,code:`PROTOCOL`,retryable:!1})}function zd(){return new E(`The app host disconnected`,{code:`DISCONNECTED`,retryable:!0})}function Bd(e){if(!URL.canParse(e))return;let t=new URL(e).origin;return t===e?t:void 0}function Vd(){return new E(`The app connection identity is invalid`,{code:`IDENTITY`,retryable:!1})}var Hd=We(k({type:f(Yc)}));function Ud(e){return new E(`Unable to notify the app host`,{cause:e,code:`DISCONNECTED`,retryable:!0})}function Wd(e,t){try{return Hl(e.data)}catch(e){Qr(`connect.decode-message`,e),t(e instanceof E?e:new E(`Malformed app connection`,{cause:e,code:`PROTOCOL`,retryable:!1}));return}}function Gd(e){return new E(e,{code:`PROTOCOL`,retryable:!1})}function Kd(e,t,n){e.style.isolation=`isolate`;let r=(0,Zr.createRoot)(e),i=new AbortController,a=e.ownerDocument.documentElement,o=Yr(a),s,c,l,u=!1,d=e=>{let i=(0,V.createElement)(qd,{state:e,render:n});r.render(t.queryClient?(0,V.createElement)(nt,{client:t.queryClient},i):i)},f=()=>{l?.(),l=void 0,c?.(),c=void 0;let e=s;s=void 0,e?.dispose(),u&&=(o===null?a.removeAttribute(`data-theme`):Jr(o,a),!1)},{defaultView:p}=e.ownerDocument;return performance.mark(`fungi.app-open.react-root-render-start`),p?p.parent===p?d({app:null,status:`standalone`}):(d({app:null,status:`connecting`}),Id({host:`parent`,signal:i.signal}).then(e=>{if(i.signal.aborted){e.dispose();return}s=e;let t=()=>{let t=e.lifecycle.get();return t===`disposing`||t===`disconnected`||t===`disposed`?(f(),d({app:null,status:`ended`}),!0):!1};l=e.lifecycle.subscribe(t),!t()&&(u=!0,Jr(e.theme.get(),a),c=e.theme.subscribe(e=>{Jr(e,a)}),d({app:e,status:`live`}))}).catch(e=>{i.signal.aborted&&e instanceof E&&e.code===`CANCELLED`||(console.error(`${t.name} host connection failed`,e),f(),i.signal.aborted||d({app:null,status:`not-hosted`,error:e instanceof E?e:new E(`The App host is unavailable`,{cause:e,code:`HOST_FAILURE`,retryable:!0})}))})):d({app:null,status:`not-hosted`,error:new E(`The App document has no window`,{code:`DISCONNECTED`,retryable:!1})}),()=>{i.signal.aborted||(i.abort(),r.unmount(),f())}}function qd({state:e,render:t}){return(0,V.useLayoutEffect)(()=>{performance.mark(`fungi.app-open.react-initial-commit`)},[]),(0,V.useLayoutEffect)(()=>{e.app&&performance.mark(`fungi.app-open.react-connected-commit`)},[e.app]),(0,V.createElement)(V.Fragment,null,e.status===`not-hosted`?(0,V.createElement)(`p`,{role:`alert`},`App host connection unavailable. Open this App through its host to try again.`):null,t(e))}function Jd(e){let t=(0,V.useCallback)(t=>e?.subscribe(t)??(()=>void 0),[e]),n=(0,V.useCallback)(()=>e?.get(),[e]);return(0,V.useSyncExternalStore)(t,n,n)}function Yd(e){return Jd(e?.context)??null}function Xd(e){return Yd(e)?.computerId??null}function Zd(e,t,n,r){let i=(0,V.useRef)(t);i.current=t;let a=(0,V.useRef)(n);a.current=n;let o=(0,V.useRef)(r);o.current=r;let s=JSON.stringify(t),c=n!==void 0;(0,V.useEffect)(()=>{e&&e.ui.reportStatus(i.current).catch(e=>{o.current?o.current(e):console.error(`Window status report failed`,e)})},[e,s]),(0,V.useEffect)(()=>{if(!(!e||!c))return e.ui.onStatusAction(e=>a.current?.(e)??!1)},[e,c]),(0,V.useEffect)(()=>()=>{e?.ui.reportStatus([]).catch(e=>{console.error(`Window status report failed`,e)})},[e])}function Qd(e,{sourceId:t,namespace:n},r){let i=(0,V.useMemo)(()=>Tn(),[]),a=(0,V.useMemo)(r,[r]);return(0,V.useEffect)(()=>{let e=i.contribute({sourceId:t,namespace:n,commands:a});return()=>{e.dispose()}},[i,t,n,a]),(0,V.useEffect)(()=>e?Wr(e.commands,a):void 0,[e,a]),i}function $d(e,{canGoBack:t,title:n,crumbs:r,primary:i,menu:a,status:o,onBack:s,onCrumb:c,onAction:l}){let u=(0,V.useRef)(s),d=(0,V.useRef)(c),f=(0,V.useRef)(l);(0,V.useEffect)(()=>{u.current=s,d.current=c,f.current=l},[s,c,l]),(0,V.useEffect)(()=>{if(!e)return;let t=e.onBack(()=>u.current()),n=e.onActivate(e=>{if(e.kind===`action`){let t=f.current;return t?.(e.actionId),t!==void 0}let t=d.current;return e.siblingId===void 0?t?.(e.crumbId):t?.(e.crumbId,e.siblingId),t!==void 0});return()=>{t(),n(),ef(e,{canGoBack:!1})}},[e]);let p=JSON.stringify([r,i,a,o]),m=(0,V.useRef)({crumbs:r,primary:i,menu:a,status:o});(0,V.useEffect)(()=>{m.current={crumbs:r,primary:i,menu:a,status:o}},[r,i,a,o]),(0,V.useEffect)(()=>{if(!e)return;let r={canGoBack:t};n!==void 0&&(r={...r,title:n});let i=m.current;i.crumbs!==void 0&&(r={...r,crumbs:i.crumbs}),i.primary!==void 0&&(r={...r,primary:i.primary}),i.menu!==void 0&&(r={...r,menu:i.menu}),i.status!==void 0&&(r={...r,status:i.status}),ef(e,r)},[e,t,n,p])}function ef(e,t){e.publish(t).catch(e=>{e instanceof E&&e.code===`DISCONNECTED`||console.warn(`App navigation report failed`,e)})}var tf=class{id;version;#e;constructor(e,t,n){this.id=e,this.version=t,this.#e=n,Object.freeze(this)}get schema(){return this.#e}};function nf(e,t,n){return new tf(e,t,n)}function rf(e){let t=P(e),n=ue(Object),r=P(Object.fromEntries(Object.keys(e).map(e=>[e,qe().optional()])));return qe().transform(e=>{let i=n.parse(e),a=Object.create(i),o=r.parse(a),s=Object.fromEntries(Object.entries(o).map(([e,t])=>[e,we().parse(t).bind(i)]));return{...t.parse(s),[Symbol.dispose](){id(e)}}})}function af(e){return qe().transform(t=>{try{return e.parse(t)}catch(e){throw e instanceof E?e:new E(`The capability returned malformed data`,{cause:e,code:`PROTOCOL`,retryable:!1})}finally{id(t)}})}function of(e){return we({output:xe(qe().transform(t=>{try{return e.parse(t)}catch(e){throw id(t),e instanceof E?e:new E(`The capability returned a malformed result`,{cause:e,code:`PROTOCOL`,retryable:!1})}}))})}var sf=of(af(je()));rf({fetch:of(ue(Response)),close:sf});var cf=e=>crypto.getRandomValues(new Uint8Array(e)),lf=(e,t,n)=>{let r=256-256%e.length;if(r===256){let r=e.length-1;return(i=t)=>{if(!i)return``;let a=``;for(;;){let t=n(i),o=i;for(;o--;)if(a+=e[t[o]&r],a.length>=i)return a}}}let i=Math.ceil(409.6*t/r);return(a=t)=>{if(!a)return``;let o=``;for(;;){let t=n(i),s=i;for(;s--;)if(t[s]<r&&(o+=e[t[s]%e.length],o.length>=a))return o}}},uf=(e,t=21)=>lf(e,t|0,cf),df=`abcdefghijklmnopqrstuvwxyz0123456789`;function ff(e=21){if(e===1/0||e===-1/0)throw RangeError(`nanoid length must be finite`);return uf(df,e)()}var pf=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,mf=/^[a-z][a-z0-9]*(?:_[a-z][a-z0-9]*)*$/,hf=B().min(1).max(64).regex(pf),gf=B().min(1).max(64).regex(pf),_f=B().min(1).max(32).regex(mf),vf=P({prefix:_f}),yf=P({family:hf,version:L(1),kinds:se(gf,vf)}).superRefine((e,t)=>{let n=Object.entries(e.kinds);if(n.length<1||n.length>64){t.addIssue({code:`custom`,message:`Identifier families must declare between one and 64 kinds`});return}let r=new Set;for(let[,e]of n){if(r.has(e.prefix)){t.addIssue({code:`custom`,message:`Identifier kind prefixes must be distinct`});return}r.add(e.prefix)}}),bf=B(),xf=/^[a-z0-9]+$/,Sf=new TextEncoder;function Cf(e){return e===32||e>=9&&e<=13}function wf(e){let t=0,n=e.length;for(;t<n&&Cf(e.charCodeAt(t));)t+=1;for(;n>t&&Cf(e.charCodeAt(n-1));)--n;return e.slice(t,n).replace(/[A-Z]/g,e=>String.fromCharCode(e.charCodeAt(0)+32))}function Tf(e){let t=`${e.prefix}_`;function n(e){if(!e.startsWith(t))return!1;let n=e.slice(t.length);return n.length===21&&xf.test(n)}let r=M(()=>F(e=>{let t=bf.safeParse(e);return t.success&&n(t.data)}));function i(i){let a,o=i,s=Sf.encode(o).byteLength,c=r.safeParse(o),l=o.startsWith(t)?o.slice(t.length):void 0;if(s<3||s>96)a=`bounds`;else if(l!==void 0&&Array.from(l).length!==21)a=`bounds`;else if(c.success)return{ok:!0,value:c.data};else a=n(wf(o))?`non_canonical`:`grammar`;return{ok:!1,error:{code:`invalid_id`,family:e.family,kind:e.kind,version:1,reason:a}}}let a=M(()=>bf.transform((e,t)=>{let n=i(e);return n.ok?n.value:(t.addIssue({code:`custom`,message:n.error.reason}),h)}));function o(){let n;try{n=ff(21)}catch{throw e.entropyUnavailable()}return r.parse(`${t}${n}`)}return{family:e.family,kind:e.kind,version:1,generate:o,schema:a,parse:i,is:e=>i(e).ok}}var Ef=se(B(),P({family:B(),kind:B(),version:L(1),generate:we(),schema:ue(Ue),parse:we(),is:we()})),Df=class extends Error{name=`CairnDefinitionError`;code=`invalid_definition`;constructor(){super(`Cairn identifier family definition is invalid`)}},Of=class extends Error{name=`CairnGenerationError`;code=`entropy_unavailable`;family;kind;version=1;constructor(e){super(`Cairn entropy source is unavailable`),this.family=e.family,this.kind=e.kind}};function kf(e){let t;try{t=yf.safeParse(e)}catch{throw new Df}if(!t.success)throw new Df;let n=t.data,r={};for(let[t,i]of Object.entries(n.kinds)){let a=i.prefix;r[t]=Tf({family:e.family,kind:t,prefix:a,entropyUnavailable:()=>new Of({family:n.family,kind:t})})}let i=F(e=>{let t=Ef.safeParse(e);if(!t.success)return!1;let r=Object.entries(t.data);return r.length===Object.keys(n.kinds).length&&r.every(([e,t])=>Object.hasOwn(n.kinds,e)&&t.kind===e&&t.family===n.family)}).safeParse(r);if(!i.success)throw new Df;return i.data}function Af(e){return e instanceof E?e:new E(`App operation failed`,{cause:e,code:`HOST_FAILURE`,retryable:!1})}var jf=new WeakMap,Mf={of(e,...t){return[e?.identity.surfaceId??null,e?.context.get().computerId??null,...t]}};function Nf(e){let t={};return e&&jf.set(t,e),t}function Pf(){let e=new cn({defaultOptions:{queries:{retry:!1,staleTime:3e4,refetchOnWindowFocus:!1},mutations:{retry:!1}}}),t=new Map;return e.getQueryCache().subscribe(n=>{let r=n.query;if(n.type===`removed`){t.get(r.queryHash)?.release(),t.delete(r.queryHash);return}let i=r.meta&&jf.get(r.meta),a=t.get(r.queryHash);if(a?.app===i||(a?.release(),t.delete(r.queryHash),!i))return;let o=()=>{queueMicrotask(()=>{e.getQueryCache().get(r.queryHash)===r&&t.get(r.queryHash)?.app===i&&e.resetQueries({predicate:e=>e===r})})},s=i.capabilities.subscribe(o);t.set(r.queryHash,{app:i,release:s}),a&&o()}),e}function Ff(e,t,n,r){let i=e?.context.get().computerId;return Sn({queryKey:n,meta:Nf(e),enabled:e!==null,retry:!1,queryFn:async({signal:n})=>{try{if(!e)throw new E(`No App connection`,{code:`DISCONNECTED`,retryable:!0});if(e.context.get().computerId!==i)throw new E(`The selected Computer changed`,{code:`SELECTION_CHANGED`,retryable:!1});return await r(e.capabilities.require(t),n)}catch(e){throw Af(e)}}})}var If=_e([k({kind:f(`compose`),text:A.pipe(R(be(1)),R(N(2e3)))}),k({kind:f(`navigate`),params:Xe(k({key:A.pipe(R(be(1)),R(N(64))),value:A.pipe(R(N(1024)))})).pipe(R(N(16)))})]);_e([k({role:A.pipe(R(be(1)),R(N(80))),intent:If}),k({appId:A.pipe(R(be(1)),R(N(128))),intent:If})],{mode:`oneOf`});var Lf=z({displayName:B().min(1).max(80).nullable()}).nullable();nf(`apps.open`,1,M(()=>rf({open:sf,role:of(af(Lf))})));var Rf=nf(`apps.call`,1,M(()=>rf({call:of(af(qe().transform(e=>Cr(e))))}))),zf={neutral:`alert-neutral`,primary:`alert-primary`,secondary:`alert-secondary`,accent:`alert-accent`,success:`alert-success`,info:`alert-info`,warning:`alert-warning`,error:`alert-error`},Bf=(0,V.forwardRef)(function({action:e,children:t,className:n,description:r,title:i,tone:a=`neutral`,...o},s){return(0,H.jsxs)(`div`,{...o,className:Ye(`alert caps-alert`,zf[a],n),"data-tone":a,role:o.role??`alert`,ref:s,children:[(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[i?(0,H.jsx)(`h3`,{className:`font-semibold`,children:i}):null,r?(0,H.jsx)(`p`,{className:`text-sm`,children:r}):null,t]}),e?(0,H.jsx)(`div`,{className:`shrink-0`,children:e}):null]})}),Vf=M(()=>B().regex(/^(container|vm-[a-z0-9][a-z0-9-]{0,62}|local-[a-z2-7]{16})$/)),Hf=new TextEncoder,Uf=131072,Wf=16384,Gf=Object.freeze({maximumTimeMs:12e4}),Kf=ge(),qf=M(()=>B().min(1).max(128).regex(/^[A-Za-z][A-Za-z0-9_]*$/)),Jf=M(()=>I().int().min(1).max(65535));z({port:Jf}),M(()=>z({port:Jf,exposed:j()})),M(()=>z({port:Jf,removed:j()})),M(()=>z({ports:ze(Jf).max(64)}));var Yf=M(()=>se(B(),qe()).refine(e=>Kf.safeParse(e).success,`Capability schema must contain JSON values`));M(()=>ze(z({id:qf,name:qf,kind:B(),description:B(),parameters:Yf,output:Yf})));var Xf=B().min(1).max(4096).startsWith(`/`).refine(e=>!e.includes(`\0`),`Path cannot contain null bytes`),Zf=(e=0)=>B().min(e).refine(e=>Hf.encode(e).byteLength<=Uf,`Text exceeds the ${String(Uf)}-byte Computer bound`);z({path:Xf}),M(()=>z({path:Xf,content:Zf()}));var Qf=z({path:Xf,byteOffset:I().int().nonnegative().optional(),byteLength:I().int().positive().max(Uf).optional()});M(()=>z({path:Qf.shape.path,byteOffset:I().int().nonnegative(),content:B(),encoding:L(`base64`),truncated:j()})),M(()=>z({previewUrl:ne(),expiresAt:I().int().positive()}));var $f=I().int().min(1).max(256).default(100),ep=I().int().nonnegative().default(0);z({path:Xf.default(`/`),limit:$f,offset:ep});var tp=M(()=>z({name:B(),size:I().int().nonnegative(),modifiedAt:I(),type:Ie({file:`file`,directory:`directory`,symlink:`symlink`})}));M(()=>z({path:Xf,entries:ze(tp).max(256),nextOffset:I().int().nonnegative().nullable()}));var np=M(()=>B().refine(e=>Hf.encode(e).byteLength<=Uf,`File exceeds the Computer write bound`));z({path:Xf,content:np}),M(()=>z({path:Xf,bytes:I().int().nonnegative()})),z({path:Xf,expectedContent:np,content:np}),M(()=>z({path:Xf,pattern:B().min(1).max(512),limit:I().int().min(1).max(256).default(256)})),M(()=>z({path:Xf,matches:ze(Xf).max(256),truncated:j()})),M(()=>z({path:Xf,pattern:B().min(1).max(512),regex:j().default(!1),ignoreCase:j().default(!1),include:B().min(1).max(512).optional(),limit:I().int().min(1).max(256).default(256)})),M(()=>z({path:Xf,matches:ze(z({path:Xf,line:I().int().positive(),text:B()})).max(256),truncated:j()})),M(()=>z({path:Xf,oldText:Zf(1),newText:Zf()})),M(()=>z({path:Xf,bytes:I().int().nonnegative(),diff:B(),firstChangedLine:I().int().positive().nullable()})),M(()=>z({path:Xf,recursive:j().default(!0)})),z({path:Xf});var rp=s({version:`v7`});function ip(e){return z({command:B().min(1).max(Wf),cwd:Xf.optional(),backend:Vf.optional(),timeoutMs:I().int().min(1).max(e.maximumTimeMs).default(1e4)})}ip(Gf).extend({requestId:rp});var ap=z({stream:Ie({stdout:`stdout`,stderr:`stderr`}),keptBytes:I().int().nonnegative(),totalBytes:I().int().positive()}),op=z({status:Ie({completed:`completed`,failed:`failed`,cancelled:`cancelled`}),exitCode:I().int(),stdout:B(),stderr:B(),truncated:fe([L(!1),ze(ap).min(1)])}),sp=kf({family:`computer-process`,version:1,kinds:{process:{prefix:`computer_process`}}}).process,cp=M(()=>B().refine(e=>sp.is(e)));z({requestId:B().min(1).max(256),requestScope:B().min(1).max(512),port:Jf.optional(),command:B().min(1).max(Wf),cwd:Xf.optional()}).omit({requestId:!0,requestScope:!0}),z({id:cp});var lp=Ie({running:`running`,exited:`exited`,uncertain:`uncertain`}),up=Ie({synced:`synced`,pending:`pending`,unknown:`unknown`}),dp=z({id:cp,port:Jf.nullable(),command:B(),cwd:B().nullable(),state:lp,exitCode:I().int().nullable(),sync:up,startedAt:I().int(),endedAt:I().int().nullable()});z({processes:ze(dp).max(64)}),M(()=>z({process:dp,signalled:j()}));var fp=Ie({accepted:`accepted`,running:`running`,succeeded:`succeeded`,failed:`failed`,unknown:`unknown`,expired:`expired`});z({requestId:rp,status:fp,output:op.nullable()}).omit({requestId:!0}),Ie({"files.read":`files.read`,"files.readBytes":`files.readBytes`,"files.write":`files.write`,"files.writeBytes":`files.writeBytes`,"files.list":`files.list`,"files.glob":`files.glob`,"files.grep":`files.grep`,"files.edit":`files.edit`,"files.patch":`files.patch`,mkdir:`mkdir`,bash:`bash`,exec:`exec`});var pp=kf({family:`inkcap`,version:1,kinds:{document:{prefix:`inkcap_document`}}}),mp=I().int().positive().max(2**53-1),hp=z({computerId:B().min(1).max(256),path:Xf.refine(e=>!e.split(`/`).includes(`..`),`Parent path segments are not allowed`)}),gp=hp.extend({id:B().refine(e=>pp.document.is(e),`Invalid document identity`),activity:Ie([`opened`,`edited`]),occurredAt:I().int().nonnegative().max(2**53-1),sequence:mp});z({limit:I().int().min(1).max(50).default(20),after:z({before:mp}).optional()}),z({rows:ze(gp).max(50),next:z({before:mp}).nullable()});var _p=z({recorded:L(!0)}),vp=z({error:L(`not_granted`)});nf(`app.backend`,1,M(()=>rf({request:of(af(qe().transform(e=>Cr(e))))})));var yp=nf(`app.methods`,1,M(()=>rf({call:of(af(qe().transform(e=>Cr(e))))})));async function bp(e,t,n,r){try{let i=hp.parse({computerId:t,path:n}),a=await e.capabilities.require(yp).call(`documents.${r}`,JSON.stringify(i));if(vp.safeParse(a).success)throw Error(`Document activity was not admitted`);return _p.parse(a),!0}catch(e){return console.error(`Inkcap document activity could not be recorded`,et(e)),!1}}var xp=B().regex(/^[a-zA-Z0-9._-]{1,128}$/).refine(e=>e!==`.`&&e!==`..`),Sp=B().regex(/^[0-9a-f]{40}$/);z({ref:B().startsWith(`refs/`).max(1024),before:Sp,after:Sp}),M(()=>B().min(1).max(512));var Cp=z({name:B(),email:B()}),wp=z({hash:Sp,treeHash:Sp,message:B(),author:Cp,committer:Cp,parents:ze(Sp),authoredAt:I(),committedAt:I()}),Tp=z({name:B(),mode:B(),hash:Sp,type:Ie([`blob`,`tree`,`commit`])}),Ep=z({ref:B(),commit:wp,path:B(),entries:ze(Tp)}),Dp=65536,Op=B().min(1).max(1024).refine(e=>!e.startsWith(`/`)&&!e.includes(`\\`)&&!e.includes(`\0`)&&e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`&&e!==`.git`),`Choose a relative repository file path.`),kp=B().min(1).max(256),Ap={repo:xp,branch:kp,path:Op},jp=Ie([`pending`,`synced`,`conflict`,`failed`]),Mp=z({text:B(),revision:I().int().positive(),state:jp,theirs:z({blob:Sp.nullable(),commit:Sp}).optional(),failure:Ie([`branch_missing`,`access_changed`,`sync_failed`,`permanent_material`]).optional()}),Np=z({...Ap,baseBlob:Sp.nullable(),baseCommit:Sp,text:B().max(Dp),revision:I().int().positive().nullable()}),Pp=fe([z({kind:L(`saved`),revision:I().int().positive(),state:L(`pending`)}),z({kind:L(`synced`),revision:I().int().positive(),commit:Sp}),z({kind:L(`conflict`),revision:I().int().nonnegative(),theirs:Mp.shape.theirs.optional()}),z({kind:L(`failed`),revision:I().int().positive(),reason:Ie([`branch_missing`,`access_changed`,`sync_failed`,`permanent_material`])}),z({kind:L(`refused`),reason:Ie([`not-source-writer`,`background-unavailable`])})]),Fp=z({...Ap,revision:I().int().positive()}),Ip=fe([z({kind:Ie([`discarded`,`not_found`])}),z({kind:L(`conflict`),revision:I().int().positive()})]),Lp=z({settled:ze(z({...Ap,result:Pp})),more:j()}),Rp=z({version:I().int().positive().nullable(),commit:Sp,blob:Sp.nullable(),pending:Mp.optional(),ref:B(),path:B(),size:I(),binary:j(),text:B().nullable()}),zp=z({ref:B(),commits:ze(z({commit:wp,agent:B().nullable()})),next:B().optional()}),Bp=z({ref:B(),commit:wp,paths:ze(B()),truncated:j()}),Vp=z({kind:L(`rebuilding`)}),Hp=z({done:j(),cursor:B().nullable()}),Up=fe([z({repository:xp,branch:kp,path:Op}),z({path:B().min(1).max(1024)})]);function Wp(e){let t=Up.safeParse(Object.fromEntries(e.map(({key:e,value:t})=>[e,t])));return t.success?t.data:null}var Gp=le(me(k({error:f(`too_large`)})));async function Kp(e,t){let n,r=()=>n??=e.close(),i=()=>{r().catch(e=>{Qr(`files.read.abort-close`,e)})};t.signal?.addEventListener(`abort`,i,{once:!0});try{t.signal?.throwIfAborted();let n=await e.response();try{let e=Re(Ee(Response))(n);if(e.status===413){let t=Gp(await e.text());throw new E(`App file exceeds the read bound`,{code:t._tag===`Some`?`FILE_TOO_LARGE`:`PROTOCOL`,retryable:!1})}if(!e.ok)throw Error(`App file unavailable (${String(e.status)})`);let r=await e.blob();return t.signal?.throwIfAborted(),new File([r],t.name,{type:r.type,lastModified:0})}finally{id(n)}}finally{t.signal?.removeEventListener(`abort`,i);try{await r()}finally{e[Symbol.dispose]()}}}async function qp(e,t,n){let r,i=()=>r??=e.close(),a=()=>{i().catch(e=>{Qr(`files.write.abort-close`,e)})};n.signal?.addEventListener(`abort`,a,{once:!0});try{n.signal?.throwIfAborted(),await e.write(t.stream())}finally{n.signal?.removeEventListener(`abort`,a);try{await i()}catch(e){Qr(`files.write.remote-close`,e)}try{e[Symbol.dispose]()}catch(e){Qr(`files.write.local-dispose`,e)}}}var Jp=k({path:A,entries:Xe(k({name:A,type:T([`file`,`directory`,`symlink`]),size:Pe,modifiedAt:Pe})),nextOffset:v(Pe)}),Yp=nf(`computer.list`,1,M(()=>rf({list:of(af(qe().transform(e=>Re(Jp)(e))))}))),Xp=_e([k({state:T([`running`,`sleeping`,`starting`])}),k({state:f(`queued`),position:Pe.pipe(R(De()),R(ye(0)))})]),Zp=k({enabled:o,effective:o,blockedBy:v(T([`team`,`global`]))}),Qp=k({computerId:D,name:D,runtime:Xp,backends:Xe(k({id:D,kind:T([`platform-container`,`on-box-vm`,`local`]),status:T([`ready`,`queued`,`online`,`offline`]),queuePosition:v(Pe.pipe(R(De()),R(ye(0)))),hostId:v(A),hostLabel:v(A),folderLabel:v(A),detachable:o})),internet:Zp});nf(`computer.instrument.read`,1,M(()=>rf({read:of(af(qe().transform(e=>Re(Qp)(e))))}))),nf(`computer.instrument.control`,1,M(()=>rf({start:of(af(qe().transform(e=>Re(Xp)(e)))),setInternetAccess:of(af(qe().transform(e=>Re(Zp)(e)))),detachLocal:of(af(qe().transform(e=>Re(k({detached:o}))(e))))})));var $p=k({ports:Xe(k({port:Pe.pipe(R(De()),R(he({minimum:1,maximum:65535}))),previewUrl:D,openMode:T([`inline`,`external-only`]),expiresAt:Pe.pipe(R(De()),R(ye(0)))})).pipe(R(N(64)))}),em=_e([$p,k({error:f(`port_previews_not_configured`)})]),tm=k({port:Pe.annotate({message:`Use a port from 1 to 65535.`}).check(De({message:`Use a port from 1 to 65535.`}),he({minimum:1,maximum:65535},{message:`Use a port from 1 to 65535.`})),exposed:o}),nm=k({port:Pe.pipe(R(De()),R(he({minimum:1,maximum:65535}))),removed:o});nf(`computer.ports`,2,M(()=>rf({list:of(af(qe().transform(e=>Re(em)(e)))),expose:of(af(qe().transform(e=>Re(tm)(e)))),unexpose:of(af(qe().transform(e=>Re(nm)(e))))})));var rm=T([`synced`,`pending`,`unknown`]),im=k({port:v(tm.fields.port),id:D,command:D,cwd:v(A),startedAt:Pe.pipe(R(De()),R(Me(0))),state:T([`running`,`exited`,`uncertain`]),exitCode:v(Pe.pipe(R(De()))),sync:rm,endedAt:v(Pe.pipe(R(De()),R(Me(0))))}),am=k({processes:Xe(im)}),om=k({process:im,signalled:o});k({requestId:D.pipe(R(N(256))),command:D.pipe(R(N(16384))),cwd:de(A),port:de(tm.fields.port)}),nf(`computer.processes`,1,M(()=>rf({start:of(af(qe().transform(e=>Re(im)(e)))),list:of(af(qe().transform(e=>Re(am)(e)))),kill:of(af(qe().transform(e=>Re(om)(e))))})));var sm=nf(`computer.readFile`,1,M(()=>rf({open:of(rf({response:of(ue(Response)),close:sf}))})));async function cm(e,t,n){return await Kp(await e.require(sm).open(t),{...n,name:t.path.split(`/`).at(-1)??`file`})}async function lm(e,t){return Re(Jp)(await e.require(Yp).list(t))}var um=nf(`computer.writeFile`,3,M(()=>rf({open:of(rf({write:sf,close:sf})),mkdir:sf,replace:of(af(qe().transform(e=>Re(dm)(e))))}))),dm=_e([k({kind:f(`replaced`),path:D,bytes:Pe.pipe(R(De()),R(Me(0)))}),k({kind:f(`conflict`)})]);async function fm(e,t,n){n.signal?.throwIfAborted();let r=await e.require(um).replace(t);if(r.kind===`conflict`)throw new E(`Computer file changed since it was opened`,{code:`CONFLICT`,retryable:!1});return{path:r.path,bytes:r.bytes}}var pm=k({computerName:D.pipe(R(N(256))),teamName:D.pipe(R(N(256))),modelDoor:D.pipe(R(N(256))),uptimeSeconds:Pe.pipe(R(De()),R(Me(0))),version:D.pipe(R(N(64)))});nf(`computer.terminal`,2,M(()=>rf({open:of(rf({information:of(af(qe().transform(e=>Re(pm)(e)))),output:of(ue(ReadableStream).transform(e=>e.pipeThrough(new TransformStream({transform(e,t){t.enqueue(ue(Uint8Array).parse(e))}})))),input:of(ue(WritableStream)),resize:sf,close:sf}))})));async function mm(e,t,n){await qp(await e.require(um).open({path:t.path}),t.content,n)}var hm={entries:[],index:-1};function gm(e,t){if(t.type===`visit`){if(e.entries[e.index]===t.key)return e;let n=[...e.entries.slice(0,e.index+1),t.key];return{entries:n,index:n.length-1}}if(t.type===`remove`){let n=[],r=-1;return e.entries.forEach((i,a)=>{i!==t.key&&(n.at(-1)!==i&&n.push(i),a<=e.index&&(r=n.length-1))}),{entries:n,index:n.length?Math.max(0,r):-1}}let n=e.index-1;return n<0||n>=e.entries.length?e:{...e,index:n}}var _m={id:`new-draft`,title:`New Draft`,category:`File`,description:`Create a new draft in Inkcap`,projections:{bindings:{values:[`<leader>n`],order:0},menu:{order:0},palette:{order:0}},action:{presentation:{type:`action`}}},vm={id:`save`,title:`Save`,category:`File`,description:`Save the focused Inkcap document`,projections:{bindings:{values:[`mod+s`],order:1},menu:{order:1},palette:{order:1}},action:{presentation:{type:`action`}}},ym={id:`open-file`,title:`Open File`,category:`File`,description:`Open a file handed off by another App`,projections:{menu:{order:2}},action:{inputSchema:{type:`object`,properties:{computerId:{type:`string`},path:{type:`string`}},required:[`computerId`,`path`],additionalProperties:!1},presentation:{type:`action`}}},bm=k({computerId:A.check(be(1),N(256)),path:A.check(be(1),N(1024))});function xm(e,t){let n=(0,V.useRef)();(0,V.useEffect)(()=>(n.current={app:e,binding:t},()=>{n.current=void 0}),[e,t]);let r=t.save?.()?.availability(),i=r?.status??`unavailable`,a=r?.status===`unavailable`?r.reason:r?void 0:`No focused savable dirty document.`;Qd(e,{sourceId:`inkcap-file`,namespace:`inkcap`},(0,V.useCallback)(()=>{let t=t=>{if(!(!e||t?.aborted||n.current?.app!==e||!Sm(e)))return n.current.binding};return[{..._m,handler:({signal:e})=>{t(e)?.newDraft()}},{...vm,availability:()=>i===`available`?{status:`available`}:{status:`unavailable`,reason:a??`No focused savable dirty document.`},handler:async({signal:e})=>{let n=t(e);if(!n)return;let r=n.save?.();if(!r)throw Error(`No focused savable dirty document.`);let i=r.availability();if(i.status===`unavailable`)throw Error(i.reason);if(!await r.save())throw Error(`No focused savable dirty document.`)}},{...ym,handler:async({arguments:e,signal:n})=>{let r=t(n);if(!r)return;if(!r.openFile)throw Error(`Inkcap is not ready to open a handed-off file.`);let i;try{i=Re(bm,{onExcessProperty:`error`})(e)}catch(e){throw Error(`Inkcap open-file arguments are invalid.`,{cause:e})}await r.openFile(i)}}]},[e,i,a]))}function Sm(e){let t=e.lifecycle.get();return t!==`disposing`&&t!==`disposed`&&t!==`disconnected`}var Cm=new Map([[`png`,`image/png`],[`jpg`,`image/jpeg`],[`jpeg`,`image/jpeg`],[`gif`,`image/gif`],[`webp`,`image/webp`],[`svg`,`image/svg+xml`],[`avif`,`image/avif`]]),wm=new Map([[`mp4`,`video/mp4`],[`webm`,`video/webm`]]);function Tm(e){return Cm.get(e.split(`.`).pop()?.toLowerCase()??``)}function Em(e){return wm.get(e.split(`.`).pop()?.toLowerCase()??``)}function Dm(e){let t=Tm(e);if(t)return{kind:`image`,mediaType:t};let n=Em(e);if(n)return{kind:`video`,mediaType:n}}function Om(e){return e.toLowerCase().endsWith(`.md`)}async function km(e,t){let n=t?.revision,r=await(await e()).arrayBuffer();if(t?.closed)return{kind:`closed`};if(t&&t.revision!==n)return{kind:`changed`};try{return{kind:`ready`,contents:new TextDecoder(`utf-8`,{fatal:!0,ignoreBOM:!0}).decode(r)}}catch{return{kind:`invalid-text`}}}async function Am(e,t){let n=t?.revision,r=await e();return t?.closed?{kind:`closed`}:t&&t.revision!==n?{kind:`changed`}:{kind:`ready`,blob:r}}async function jm(e,t,n,r){let i=()=>cm(e.capabilities,{path:t},{signal:n}),a=Dm(t);if(a){let e=await Am(i,r);return e.kind===`ready`?{kind:a.kind,blob:e.blob.slice(0,e.blob.size,a.mediaType)}:e}let o=await km(i,r);return o.kind===`ready`?{kind:`text`,contents:o.contents}:o}var Mm=ee(`FileCode2`,[[`path`,{d:`M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4`,key:`1pf5j1`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`m5 12-3 3 3 3`,key:`oke12k`}],[`path`,{d:`m9 18 3-3-3-3`,key:`112psh`}]]),Nm=ee(`FilePlus2`,[[`path`,{d:`M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4`,key:`1pf5j1`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M3 15h6`,key:`4e2qda`}],[`path`,{d:`M6 12v6`,key:`1u72j0`}]]),Pm=ee(`FolderOpen`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]),Fm=ee(`GitBranch`,[[`line`,{x1:`6`,x2:`6`,y1:`3`,y2:`15`,key:`17qcm7`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}],[`path`,{d:`M18 9a9 9 0 0 1-9 9`,key:`n2h4wq`}]]),Im=ee(`History`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),Lm=ee(`PanelLeft`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),Rm={2:`h2`,3:`h3`,4:`h4`};function zm(e,t){let{reduced:n}=t,r=e&&!n,i=Te(t,600),[a,o]=(0,V.useState)(r);return(0,V.useEffect)(()=>{if(o(r),!r)return;let e=globalThis.setTimeout(()=>{o(!1)},i);return()=>{globalThis.clearTimeout(e)}},[r,i]),a}var Bm=(0,V.forwardRef)(function({actions:e,className:t,description:n,headingLevel:r=2,suggestions:i,thinking:a=!1,title:o,visual:s,renderVisual:c,variant:l=`plain`,...u},d){let f=(0,V.useId)(),p=(0,V.useRef)(null),m=x(p),h=zm(l===`speech`,m)&&!a,g=Rm[r],_=c?c({speaking:h,thinking:a}):s,v=(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(g,{ref:p,className:`empty-state-title`,id:u[`aria-labelledby`]?void 0:f,children:o}),(0,H.jsx)(`p`,{children:n}),i&&i.length>0?(0,H.jsx)(`ul`,{"aria-label":`Try one of these`,className:`empty-state-suggestions`,children:i.map(e=>(0,H.jsx)(`li`,{children:(0,H.jsx)(ve,{size:`sm`,variant:`outline`,onClick:e.onSelect,children:e.label})},e.label))}):null,e?(0,H.jsx)(`div`,{className:`empty-state-actions`,children:e}):null]});return(0,H.jsxs)(`section`,{...u,"aria-labelledby":u[`aria-labelledby`]??f,className:Ye(`empty-state`,l!==`plain`&&`empty-state-${l}`,t),ref:d,children:[_?(0,H.jsx)(`div`,{"aria-hidden":`true`,className:`empty-state-visual`,children:_}):null,l===`speech`?(0,H.jsx)(`div`,{className:`empty-state-bubble`,children:v}):v]})}),Vm=(0,V.createContext)(null),Hm=(0,V.forwardRef)(function({children:e,defaultValue:t,onValueChange:n,value:r,...i},a){let[o,s]=(0,V.useState)(t),c=r??o,l=(0,V.useId)(),u=e=>{r===void 0&&s(e),n?.(e)},d=(e,t)=>`${l}-${e}-${encodeURIComponent(t)}`;return(0,H.jsx)(Vm.Provider,{value:{onValueChange:u,panelId:e=>d(`panel`,e),selectedValue:c,tabId:e=>d(`tab`,e)},children:(0,H.jsx)(`div`,{...i,className:Ye(`w-full`,i.className),ref:a,children:e})})});function Um(){let e=(0,V.useContext)(Vm);if(!e)throw Error(`Tabs parts must be used inside <Tabs>`);return e}var Wm=(0,V.forwardRef)(function({className:e,variant:t=`bordered`,...n},r){return(0,H.jsx)(`div`,{...n,"aria-orientation":n[`aria-orientation`]??`horizontal`,className:Ye(t===`segmented`?`tabs caps-tabs-segmented w-full`:`tabs tabs-border flex w-full items-center gap-xs`,e),"data-variant":t,ref:r,role:`tablist`})}),Gm=(0,V.forwardRef)(function({className:e,disabled:t,onClick:n,onKeyDown:r,value:i,...a},o){let s=Um(),c=s.selectedValue===i,l=e=>{let t=e.currentTarget.closest(`[role="tablist"]`);if(!(t instanceof HTMLElement))return;let n=Array.from(t.querySelectorAll(`[role="tab"]`)).filter(e=>!e.disabled&&e.getAttribute(`aria-disabled`)!==`true`),r=n.indexOf(e.currentTarget);if(r<0||n.length===0)return;let a;if(e.key===`ArrowRight`)a=(r+1)%n.length;else if(e.key===`ArrowLeft`)a=(r-1+n.length)%n.length;else if(e.key===`Home`)a=0;else if(e.key===`End`)a=n.length-1;else return;e.preventDefault();let o=n[a];o?.focus(),o&&s.onValueChange(o.dataset.tabValue??i)};return(0,H.jsx)(`button`,{...a,"aria-controls":s.panelId(i),"aria-disabled":t?!0:void 0,"aria-selected":c,className:Ye(`tab whitespace-nowrap text-base-content transition-colors focus-visible:outline-none focus-visible:ring-2 caps-focus-color`,c&&`tab-active`,e),"data-tab-value":i,disabled:t,id:s.tabId(i),onClick:e=>{n?.(e),!e.defaultPrevented&&!t&&s.onValueChange(i)},onKeyDown:e=>{r?.(e),e.defaultPrevented||l(e)},ref:o,role:`tab`,tabIndex:t?-1:c?0:-1,type:a.type??`button`})}),Km=(0,V.forwardRef)(function({children:e,className:t,forceMount:n=!1,value:r,...i},a){let o=Um(),s=o.selectedValue===r;return!s&&!n?null:(0,H.jsx)(`div`,{...i,"aria-labelledby":o.tabId(r),className:Ye(`mt-md focus-visible:outline-none`,t),hidden:!s,id:o.panelId(r),ref:a,role:`tabpanel`,tabIndex:0,children:e})}),qm=(0,V.forwardRef)(function({tone:e=`neutral`,size:t=`md`,pressed:n=!1,className:r,...i},a){return(0,H.jsx)(`kbd`,{...i,ref:a,className:Ye(`caps-keycap`,r),"data-tone":e,"data-size":t,"data-pressed":n})});(0,V.forwardRef)(function({label:e,shortcut:t,icon:n,readout:r,tone:i=`neutral`,pressed:a,expanded:o,className:s,type:c=`button`,...l},u){let d=a??o;return(0,H.jsxs)(`button`,{...l,ref:u,type:c,className:Ye(`caps-keycap-button`,s),"data-tone":i,"aria-pressed":a,"aria-expanded":o,"aria-keyshortcuts":l[`aria-keyshortcuts`]??t,children:[d===void 0?null:(0,H.jsx)(`span`,{className:`caps-keycap-led`,"data-lit":d,"aria-hidden":`true`}),n?(0,H.jsx)(`span`,{className:`caps-keycap-button-icon`,"aria-hidden":`true`,children:n}):null,e===null?null:(0,H.jsx)(`span`,{className:`caps-keycap-button-label`,children:e}),r,t?(0,H.jsx)(qm,{size:`sm`,tone:`neutral`,"aria-hidden":`true`,children:t}):null]})});function Jm(e,t){let n=e.trim();return n.startsWith(`/`)?n:`${t.endsWith(`/`)?t:`${t}/`}${n}`}function Ym(e){if(e.endsWith(`/`))return e.replace(/\/+$/,``)||`/`;let t=e.lastIndexOf(`/`);return t<=0?`/`:e.slice(0,t)}var Xm=`modulepreload`,Zm=function(e,t){return new URL(e,t).href},Qm={},$m=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=Zm(t,n),t=s(t),t in Qm)return;Qm[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:Xm,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},eh=(0,V.lazy)(async()=>({default:(await $m(()=>import(`./FileTab-fuWnqfb6.js`),__vite__mapDeps([0,1,2,3]),import.meta.url)).FileTab})),th=(0,V.lazy)(async()=>({default:(await $m(()=>import(`./InkcapFileTree-D95QfJxq.js`),__vite__mapDeps([4,1,2,3]),import.meta.url)).InkcapFileTree}));function nh({model:e}){let[t,n]=(0,V.useState)(!0),[r,a]=(0,V.useState)(!1),[o,s]=(0,V.useState)(!1),c=(0,V.useRef)(null);(0,V.useEffect)(()=>{let e=c.current;if(!e||!(`ResizeObserver`in globalThis))return;let t=()=>{a(e.clientWidth<=576)},n=new ResizeObserver(t);return t(),n.observe(e),()=>{n.disconnect()}},[]);let[l,u]=(0,V.useState)(!1),[d,f]=(0,V.useState)(null),p=(0,V.useId)(),h=e.sourceLabel??e.context.computerName??`Computer`,g=e.tabs.filter(e=>e.dirty).length;Zd(e.connection?.app,[{kind:`text`,id:`documents`,text:`${String(e.tabs.length)} ${e.tabs.length===1?`open file`:`open files`}`},{kind:`text`,id:`save`,text:g?`${String(g)} unsaved`:e.downloadedFile?.tabKey===e.active?`Downloaded ${e.downloadedFile.name}`:e.repositoryStatus??(e.tabs.length?`All changes saved`:`Ready`),end:!0}]);let _=e.tabs.find(t=>t.tabKey===e.active);(0,V.useEffect)(()=>{f(null)},[e.selectedConnection?.app.identity.surfaceId,e.context.computerId,e.context.projectPath]),(0,V.useEffect)(()=>{t&&e.selectedConnection&&e.context.computerId!==null&&e.canList&&u(!0)},[t,e.canList,e.context.computerId,e.selectedConnection]);let v=e.fileTree?.(t=>{e.onOpenFile(t),s(!1)})??(0,H.jsx)(rh,{model:e,treeLoadRequested:l,active:_,computer:h,onOpenFile:t=>{e.onOpenFile(t),s(!1)},onSelectPath:f,onDismissExplorerDialog:()=>{s(!1)}});return(0,H.jsxs)(`main`,{ref:c,className:`inkcap-app`,"aria-label":`Inkcap editor`,onKeyDown:e=>{e.nativeEvent.composedPath().some(e=>e instanceof HTMLElement&&e.isContentEditable)&&e.stopPropagation()},children:[e.error?(0,H.jsx)(Bf,{className:`inkcap-notice`,tone:`error`,title:`Couldn't complete that action`,description:e.error}):null,(0,H.jsxs)(`div`,{className:`inkcap-work`,"data-explorer":t,children:[r?(0,H.jsx)(Be,{open:o,onOpenChange:s,children:(0,H.jsxs)(`div`,{className:`inkcap-explorer-rail`,children:[(0,H.jsx)(pe,{render:(0,H.jsx)(i,{size:`sm`,icon:(0,H.jsx)(Lm,{}),"aria-label":`Open file explorer`})}),(0,H.jsxs)(Fe,{className:`inkcap-explorer-dialog`,children:[(0,H.jsxs)(ke,{children:[(0,H.jsx)(Le,{children:`File explorer`}),(0,H.jsx)(Se,{children:`Browse files on ${e.sourceLabel??(!e.selectedConnection||e.context.computerId===null?`your Computer`:h)}.`})]}),v,(0,H.jsx)(ce,{children:(0,H.jsx)(Oe,{render:(0,H.jsx)(ve,{variant:`outline`}),children:`Close explorer`})})]})]})}):(0,H.jsx)(`div`,{className:`inkcap-explorer`,id:`${p}-explorer`,hidden:!t,children:v}),(0,H.jsxs)(Hm,{className:`inkcap-editors`,value:e.active===null?``:String(e.active),onValueChange:t=>{let n=e.tabs.find(e=>String(e.tabKey)===t);n&&e.onActivate(n.tabKey)},children:[(0,H.jsxs)(`div`,{className:`inkcap-tab-bar`,children:[r?null:(0,H.jsx)(i,{size:`xs`,variant:`ghost`,className:`inkcap-explorer-toggle`,icon:(0,H.jsx)(Lm,{}),"aria-label":`Toggle file explorer`,title:t?`Hide file explorer`:`Show file explorer`,"aria-expanded":t,"aria-controls":`${p}-explorer`,onClick:()=>{n(e=>!e)}}),(0,H.jsx)(Wm,{className:`inkcap-tabs gap-0`,"aria-label":`Editor tabs`,children:e.tabs.map(t=>(0,H.jsxs)(V.Fragment,{children:[(0,H.jsxs)(Gm,{className:`inkcap-tab`,value:String(t.tabKey),title:t.connection?.source?`${t.path} · ${t.connection.source.label}`:t.path,children:[(0,H.jsx)(Mm,{"aria-hidden":`true`}),(0,H.jsx)(`span`,{children:t.path.split(`/`).at(-1)}),t.dirty?(0,H.jsx)(`span`,{className:`inkcap-dirty`,"aria-label":`Unsaved changes`}):null]}),(0,H.jsx)(i,{size:`xs`,variant:`ghost`,icon:(0,H.jsx)(m,{}),"aria-label":`Close ${t.path}`,onClick:()=>{e.onClose(t.tabKey)}})]},t.tabKey))}),(0,H.jsx)(`div`,{className:`inkcap-tab-actions`,children:(0,H.jsx)(i,{icon:(0,H.jsx)(Nm,{}),"aria-label":`New draft`,title:`New draft (⌘K, then N)`,onClick:e.onNewDraft})})]}),e.tabs.map(t=>(0,H.jsx)(V.Suspense,{fallback:(0,H.jsx)(`p`,{role:`status`,children:`Opening editor…`}),children:(0,H.jsx)(eh,{activityNotice:e.activityNotice?.path===t.path&&e.activityNotice.computerId===t.computerId,onDismissActivityNotice:e.onDismissActivityNotice,path:t.path,initial:t.initial,active:e.active===t.tabKey,narrow:r,local:t.connection===null,savable:t.connection===null||ih(t.connection),sourceLabel:(t.connection??e.selectedConnection)?.source?.kind===`repository`?(t.connection??e.selectedConnection)?.source?.label:void 0,previewUrl:t.previewUrl,previewKind:t.previewKind,target:t.target,syncConflict:t.connection?.source!==void 0&&e.repositoryStates?.get(`${t.connection.source.id}:${t.path}`)?.kind===`conflict`,tabKey:t.tabKey,onSaveBinding:e.onSaveBinding,onReopen:t.connection===null?void 0:()=>{e.onReopen(t)},onSaveAs:async(n,r)=>{let i=d&&e.selectedConnection&&(t.connection===null||t.connection===e.selectedConnection)?Ym(d):t.path.startsWith(`/`)?Ym(t.path):e.context.projectPath,a=(t.connection??e.selectedConnection)?.source?.kind===`repository`?Op.parse(n.trim()):t.connection||e.selectedConnection?Jm(n,i):n.trim();return await e.onSaveAs(t,a,r),a},onPathChange:n=>{e.onPathChange(t,n)},onStatus:(n,r)=>{e.onStatus(t,n,r)},write:(n,r)=>e.onWrite(t,n,r),overwrite:n=>e.onOverwrite(t,n),readCurrent:n=>e.onReadCurrent(t,n)})},t.tabKey)),e.tabs.length===0?(0,H.jsx)(Bm,{className:`inkcap-empty`,variant:`panel`,visual:(0,H.jsx)(Mm,{className:`inkcap-empty-icon`}),title:`A little room to think.`,description:`Open a file${e.canList?` from the explorer`:``}, or start with a blank page.`,actions:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(ve,{size:`sm`,onClick:e.onNewDraft,children:`New draft`}),(0,H.jsxs)(`span`,{className:`inkcap-shortcut`,children:[(0,H.jsx)(qm,{size:`sm`,children:oh()}),(0,H.jsx)(`span`,{children:`then`}),(0,H.jsx)(qm,{size:`sm`,children:`N`})]})]})}):null]})]}),(0,H.jsx)(ah,{open:e.windowClosing||e.closing!==null,all:e.windowClosing,reviewWhileSaving:e.windowClosing?e.tabs.some(e=>e.connection?.source?.kind===`repository`):e.tabs.some(t=>t.tabKey===e.closing&&t.connection?.source?.kind===`repository`),busy:e.windowCloseSaving||e.tabs.some(t=>t.tabKey===e.closing&&t.target.saving),error:e.error,onSave:e.windowClosing?e.onSaveWindowClose:()=>{e.closing!==null&&e.onSaveClose(e.closing)},onDiscard:e.windowClosing?e.onDiscardWindowClose:()=>{e.closing!==null&&e.onDiscardClose(e.closing)},onCancel:e.windowClosing?e.onCancelWindowClose:e.onCancelClose})]})}function rh({model:e,treeLoadRequested:t,active:n,computer:r,onOpenFile:i,onSelectPath:a,onDismissExplorerDialog:o}){return!e.selectedConnection||e.context.computerId===null||!e.canList?(0,H.jsx)(Bm,{className:`inkcap-tree inkcap-access`,"aria-label":`File tree`,variant:`panel`,visual:(0,H.jsx)(Pm,{"aria-hidden":`true`}),title:e.selectedConnection?e.context.computerId===null?`No Computer selected`:`Files unavailable`:`No Computer connected`,description:e.selectedConnection?e.context.computerId===null?`No Computer is attached to this window. You can still write a draft.`:`File access isn't granted. Your open documents remain available.`:`No Computer is attached to this window. You can still write a draft.`,actions:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(ve,{className:`whitespace-nowrap`,size:`sm`,onClick:e.onNewDraft,children:`New draft`}),e.connection&&e.context.computerId===null&&(0,H.jsx)(ve,{className:`whitespace-nowrap`,size:`sm`,variant:`outline`,onClick:()=>{o(),e.onChooseComputer()},children:`Choose Computer`})]})}):t?(0,H.jsx)(V.Suspense,{fallback:(0,H.jsx)(`aside`,{className:`inkcap-tree inkcap-access`,role:`status`,children:`Loading files…`}),children:(0,H.jsx)(th,{app:e.selectedConnection.app,rootPath:e.context.projectPath,rootLabel:r,activePath:n?.connection===e.selectedConnection&&n.computerId===e.context.computerId?n.path:null,onOpenFile:i,onSelectPath:a},`${e.selectedConnection.app.identity.surfaceId}:${e.context.computerId}:${e.context.projectPath}`)}):(0,H.jsx)(`aside`,{className:`inkcap-tree inkcap-access`,role:`status`,children:`Loading files…`})}function ih(e){let t=e.app.lifecycle.get();return t!==`disposing`&&t!==`disposed`&&t!==`disconnected`}function ah({open:e,all:t,busy:n,reviewWhileSaving:r,error:i,onSave:a,onDiscard:o,onCancel:s}){return(0,H.jsx)(Be,{open:e&&!(r&&n),onOpenChange:e=>{!e&&!n&&s()},children:(0,H.jsxs)(Fe,{children:[(0,H.jsxs)(ke,{children:[(0,H.jsx)(Le,{children:t?`Close Inkcap with unsaved changes`:`Unsaved changes`}),(0,H.jsx)(Se,{children:t?`Save your changed documents before closing Inkcap?`:`Save your changes before closing this document?`})]}),i?(0,H.jsx)(Bf,{tone:`error`,title:`Couldn't save`,description:i}):null,(0,H.jsxs)(ce,{children:[(0,H.jsx)(ve,{variant:`ghost`,size:`sm`,disabled:n,onClick:s,children:`Cancel`}),(0,H.jsx)(ve,{variant:`ghost`,size:`sm`,disabled:n,onClick:o,children:`Discard`}),(0,H.jsx)(ve,{size:`sm`,disabled:n,onClick:a,children:n?`Saving…`:t?`Save all`:`Save`})]})]})})}function oh(){return/Mac|iPhone|iPad/u.test(navigator.userAgent)?`⌘ K`:`Ctrl K`}var sh={computerId:null,computerName:null,projectPath:`/`},ch={read:(e,t,n,r)=>jm(e,t,n,r),replace:async(e,t,n)=>{await fm(e.capabilities,t,{signal:n})},write:async(e,t,n,r)=>{await mm(e.capabilities,{path:t,content:new Blob([n],{type:`text/plain;charset=utf-8`})},{signal:r})}};function lh(e){let t=e.app.lifecycle.get();return t!==`disposing`&&t!==`disposed`&&t!==`disconnected`}function uh(e,t,n,r,i){return!e.aborted&&lh(t)&&(t.source?.kind===`repository`||t.app.context.get().computerId===i)&&(n!==void 0||r===t)}function dh(e,t,n,r){let i=t===void 0?void 0:n.find(e=>e.tabKey===t),a=i?.connection??r;if(!a||!lh(a))return null;let o=a.source?.kind===`repository`?null:a.app.context.get().computerId;if(i&&a.source?.kind!==`repository`&&i.computerId!==o)return null;let s=n.find(t=>t.path===e&&t.connection===a&&t.computerId===o);return t!==void 0&&!i?null:{selected:a,replacement:i,existing:s}}function fh(e,t,n,r,i,a,o,s,c){let l=ph(e,t,r,i);if(l){o(l);return}a!==void 0&&s(r,a),o(``),(e.kind===`image`||e.kind===`video`)&&c(t,``,n,URL.createObjectURL(e.blob),e.kind),e.kind===`text`&&c(t,e.contents,n)}function ph(e,t,n,r){if(e.kind===`changed`||e.kind===`closed`)return e.kind===`changed`?`Reopen cancelled because this tab changed during the read. Your edits remain open.`:`Reopen cancelled because this tab was closed.`;let i=n!==void 0&&n.target.revision!==r;if(n?.target.closed||i)return i?`Reopen cancelled because this tab changed during the read. Your edits remain open.`:`Reopen cancelled because this tab was closed.`;if(e.kind===`invalid-text`)return`The file ${t} is not valid UTF-8 text. Existing edits remain open.`}function mh({connection:e,context:t=sh,files:n=ch}){let r=W();function i(e){return e.source??{kind:`computer`,id:e.app.context.get().computerId??``,label:`Computer`,read:(t,r,i)=>n.read(e.app,t,r,i),replace:(t,r,i,a)=>n.replace(e.app,{path:t,content:r,expectedContent:i},a),write:(t,r,i)=>n.write(e.app,t,r,i)}}let a=Xd(e?.app),o=Yd(e?.app)?.openRequest,s=(0,V.useRef)(new Set),c=e?{...t,computerId:a,computerName:t.computerId===a?t.computerName:null}:t,[l,u]=(0,V.useState)([]),[d,f]=(0,V.useReducer)(gm,hm),p=d.entries[d.index]??null,m=(0,V.useCallback)(()=>d.index<=0?!1:(f({type:`back`}),!0),[d.index]);$d(e?.app.window.navigation,{canGoBack:d.index>0,onBack:m});let h=(0,V.useCallback)(e=>{f({type:`visit`,key:e})},[]),[g,_]=(0,V.useState)(null),[v,y]=(0,V.useState)(!1),[b,x]=(0,V.useState)(!1),[S,C]=(0,V.useState)(``),[ee,te]=(0,V.useState)(null),[ne,w]=(0,V.useState)(null),T=(0,V.useRef)([]),re=(0,V.useRef)(0),D=(0,V.useRef)(new Set),O=(0,V.useRef)(new Set),k=(0,V.useRef)(e),ie=(0,V.useRef)(null),A=(0,V.useRef)(new Map),ae=(0,V.useRef)(()=>Promise.reject(Error(`Inkcap is not ready to open a handed-off file.`))),oe=(0,V.useRef)(null);ie.current=p,(0,V.useEffect)(()=>{k.current=e,w(null);let t=e?.app.lifecycle.subscribe(t=>{(t===`disposing`||t===`disposed`||t===`disconnected`)&&k.current===e&&(k.current=null)});return()=>t?.()},[e,a]),(0,V.useEffect)(()=>()=>{oe.current?.resolve(!1),oe.current=null,k.current=null,A.current.clear();for(let e of D.current)e.abort();D.current.clear()},[]),T.current=l,(0,V.useEffect)(()=>()=>{for(let e of T.current)e.previewUrl&&URL.revokeObjectURL(e.previewUrl)},[]);let se=(0,V.useCallback)((e,t,n,r,i,a=!0)=>{let o=++re.current,s=n?.source?.kind===`repository`?null:n?.app.context.get().computerId??null;u(a=>[...a,{tabKey:o,path:e,initial:t,connection:n,computerId:s,previewUrl:r,previewKind:i,dirty:!1,target:{revision:0,closed:!1,dirty:!1,saving:!1}}]),a&&h(o)},[h]),ce=(0,V.useCallback)(()=>{se(`Untitled ${String(re.current+1)}`,``,null)},[se]),le=(0,V.useCallback)(()=>{let e=ie.current;return e===null?void 0:A.current.get(e)},[]);xm(e?.app??null,{newDraft:ce,save:le,openFile:e=>ae.current(e)});function ue(e){e.previewUrl&&URL.revokeObjectURL(e.previewUrl)}function de(e,t){e&&(e.target.closed=!0,ue(e),u(e=>e.filter(e=>e.tabKey!==t)),f({type:`remove`,key:t}))}async function fe(e,t,n,r){if(e.source?.kind===`repository`||t===null)return;let i=await bp(e.app,t,n,r);k.current===e&&e.app.context.get().computerId===t&&lh(e)&&w(i?null:{computerId:t,path:n})}async function pe(e,t,n=!1){let r=dh(e,t,l,k.current);if(!r)return;let{selected:a,replacement:o,existing:s}=r,c=a.source?.kind===`repository`?null:a.app.context.get().computerId;if(s&&t===void 0){h(s.tabKey);return}if(t!==void 0&&!o)return;let u=`${a.app.identity.surfaceId}:${a.source?.id??c??``}:${e}`;if(O.current.has(u))return;let d=o?.target.revision;O.current.add(u);let f=new AbortController;D.current.add(f);try{let r=await i(a).read(e,f.signal,o?.target);if(!uh(f.signal,a,t,k.current,c))return;let s=!ph(r,e,o,d);fh(r,e,a,o,d,t,C,de,(e,r,i,a,o)=>{se(e,r,i,a,o,!n||ie.current===t)}),!n&&s&&await fe(a,c,e,`opened`)}catch(t){console.error(`Inkcap file read failed`,t),f.signal.aborted||C(t instanceof E&&t.code===`FILE_TOO_LARGE`?a.source?.kind===`repository`?`This repository file is too large to edit in Inkcap. Choose a smaller file. Existing edits remain open.`:`This file is too large to preview in Inkcap. Choose a smaller file. Existing edits remain open.`:`Could not read ${e}. Access may be denied or ${a.source?.label??`the Computer`} unavailable. Existing edits remain open.`)}finally{D.current.delete(f),O.current.delete(u)}}ae.current=async({computerId:e,path:t})=>{if(k.current?.source?.kind===`repository`)throw Error(`Open Computer file handoffs in the Computer source.`);if(k.current?.app.context.get().computerId!==e)throw Error(`The handed-off file belongs to a different admitted Computer.`);await pe(t)};function me(e,t=!1){let n=l.find(t=>t.tabKey===e);if(n){if(n.target.saving){C(`Wait for this save to finish before closing. Your edits remain open.`);return}if(n.target.dirty&&!t){_(e),C(``);return}n.target.closed=!0,ue(n),_(t=>t===e?null:t),u(t=>t.filter(t=>t.tabKey!==e)),f({type:`remove`,key:e})}}(0,V.useEffect)(()=>{if(!e||o?.kind!==`navigate`)return;let t=Wp(o.params);if(t===null||`repository`in t)return;let n=JSON.stringify([e.app.identity.surfaceId,o.requestId]);if(s.current.has(n))return;if(s.current.add(n),s.current.size>64){let e=s.current.values().next().value;e!==void 0&&s.current.delete(e)}let r=hp.safeParse({computerId:a,path:t.path});if(!r.success||e.source?.kind===`repository`){C(`This Recent File is unavailable on the current Computer source.`);return}let i=!0;return ae.current(r.data).catch(t=>{console.error(`Inkcap Recent File could not be opened`,et(t)),i&&k.current===e&&C(`This Recent File could not be opened. Your existing documents remain open.`)}),()=>{i=!1}},[e,a,o]);async function j(e,t,n){if(!lh(e))throw Error(`${e.source?.label??`Computer`} disconnected`);if(e.source?.kind!==`repository`&&(t===null||e.app.context.get().computerId!==t)){let e=`Select this file's original Computer before saving or reloading. Your edits remain open.`;throw C(e),Error(e)}let r=new AbortController;D.current.add(r);try{return await n(r.signal)}finally{D.current.delete(r)}}function he(e,t,n,r){return j(e,t,async a=>{await i(e).write(n,r,a),await fe(e,t,n,`edited`)})}async function ge(e,t,n){let r=k.current?.app;if(!r)throw Error(`Download requires a connected App host.`);let i=t.split(`/`).at(-1)??t,a=/\.[^.]+$/.test(i)?i:`${i}.txt`,o=await r.ui.requestBrowserAction({kind:`saveFile`,name:a,mime:`text/plain;charset=utf-8`,bytes:new TextEncoder().encode(n)});if(o.kind===`refused`)throw Error(`Download refused: ${o.reason}`);if(o.kind!==`saved`)throw Error(`The App host did not accept this download.`);te({tabKey:e.tabKey,name:a})}function _e(e,t={}){let n=e.connection;if(n){if(e.target.saving){C(`Wait for this save to finish before reopening.`);return}if(e.target.dirty){C(`Save your edits before reopening this file.`);return}if(!lh(n)){C(`Computer disconnected. Existing edits remain open.`);return}if(n.source?.kind!==`repository`&&n.app.context.get().computerId!==e.computerId){C(`Select this file's original Computer before reopening. Existing edits remain open.`);return}pe(e.path,e.tabKey,t.background)}}let ve=e,ye=ve?.app.capabilities.has(Yp)??!1,M=(0,V.useCallback)((e,t)=>{t?A.current.set(e,t):A.current.delete(e)},[]),be=(0,V.useCallback)(e=>{let t=oe.current;oe.current=null,y(!1),x(!1),t?.resolve(e)},[]),xe=(0,V.useCallback)(()=>{let e=oe.current;if(e)return e.promise;if(!T.current.some(e=>e.target.dirty))return Promise.resolve(!0);if(T.current.some(e=>e.target.saving))return C(`Wait for the current save to finish before closing Inkcap.`),Promise.resolve(!1);let t,n=new Promise(e=>{t=e});return oe.current={promise:n,resolve:t},C(``),y(!0),n},[]),N=(0,V.useCallback)(async()=>{if(!(!oe.current||b)){x(!0);try{for(let e of T.current.filter(e=>e.target.dirty)){let t=A.current.get(e.tabKey);if(!t)throw Error(`A dirty document is unavailable to save.`);if(await t.save(),e.target.dirty)throw Error(`A dirty document could not be saved.`)}be(!0)}catch(e){C(e instanceof Error?`${e.message} Inkcap remains open.`:`A document could not be saved. Inkcap remains open.`),x(!1)}}},[be,b]);return{connection:e,selectedConnection:ve,canList:ye,context:c,error:S,downloadedFile:ee,activityNotice:ne,onDismissActivityNotice:()=>{w(null)},tabs:l,active:p,closing:g,windowClosing:v,windowCloseSaving:b,requestWindowClose:xe,onSaveWindowClose:()=>{N()},onDiscardWindowClose:()=>{be(!0)},onCancelWindowClose:()=>{be(!1)},onNewDraft:ce,onChooseComputer:()=>{let e=k.current?.app;if(!e){C(`The Computer picker requires a connected App host.`);return}e.ui.requestComputerChoice().catch(e=>{console.error(`Inkcap Computer choice failed`,et(e)),C(e instanceof Error?e.message:`Couldn't open the Computer picker.`)})},onOpenFile:e=>{pe(e)},onActivate:h,onClose:e=>{me(e)},onSaveClose:e=>{let t=A.current.get(e);if(!t){C(`This document is no longer available to save.`);return}t.save().catch(e=>{C(e instanceof Error?e.message:`Couldn't save. Your document remains open.`)})},onDiscardClose:e=>{me(e,!0)},onCancelClose:()=>{_(null)},onReopen:_e,onSaveAs:async(e,t,n)=>{let i=e.connection??k.current;if(!i||i.source?.kind!==`repository`&&i.app.context.get().computerId===null){await ge(e,t,n);return}let a=i.source?.kind===`repository`?null:e.connection?e.computerId:i.app.context.get().computerId,o=Mf.of(i.app,`tree`);await he(i,a,t,n),r.invalidateQueries({queryKey:o}),e.connection||u(t=>t.map(t=>t.tabKey===e.tabKey?{...t,connection:i,computerId:a}:t))},onPathChange:(e,t)=>{u(n=>n.map(n=>n.tabKey===e.tabKey?{...n,path:t}:n))},onStatus:(e,t,n)=>{t&&te(t=>t?.tabKey===e.tabKey?null:t),u(n=>n.map(n=>n.tabKey===e.tabKey?{...n,dirty:t}:n)),g===e.tabKey&&!t&&!n&&me(e.tabKey)},onSaveBinding:M,onWrite:async(e,t,n)=>{let r=e.connection;if(!r){await ge(e,e.path,t);return}await j(r,e.computerId,async a=>{await i(r).replace(e.path,t,n,a),await fe(r,e.computerId,e.path,`edited`)})},onOverwrite:async(e,t)=>{if(!e.connection){await ge(e,e.path,t);return}await he(e.connection,e.computerId,e.path,t)},onReadCurrent:async e=>{let t=e.connection;if(!t||e.target.closed)throw Error(`File is no longer open on ${t?.source?.label??`a Computer`}`);return j(t,e.computerId,async n=>{let r=await i(t).read(e.path,n);if(n.aborted||e.target.closed||!lh(t)||t.source?.kind!==`repository`&&t.app.context.get().computerId!==e.computerId)throw Error(`The original ${t.source?.label??`Computer`} is no longer available`);if(r.kind!==`text`)throw Error(`The ${t.source?.label??`Computer`} file could not be read as text`);return r.contents})}}}function hh({connection:e,context:t=sh,onReady:n}){let r=mh({connection:e,context:t});return(0,V.useEffect)(()=>{if(e)return e.app.window.onBeforeClose(r.requestWindowClose)},[e,r.requestWindowClose]),(0,V.useEffect)(()=>{n?.({requestWindowClose:r.requestWindowClose})},[n,r.requestWindowClose]),(0,H.jsx)(nh,{model:r})}var gh=(0,V.forwardRef)(function({className:e,message:t,...n},r){return(0,H.jsxs)(`div`,{...n,className:Ye(`caps-loading-state`,e),ref:r,role:`status`,children:[(0,H.jsx)(He,{decorative:!0,size:`sm`}),(0,H.jsx)(`span`,{children:t})]})}),_h=256;async function vh(e,t,n,r,i){r.throwIfAborted();let a=await n(e,t);if(!Vp.safeParse(a).success)return a;i(!0);try{let i=null,a=!1;for(let e=0;e<_h&&!a;e++){r.throwIfAborted();let e=Hp.parse(await n(`rebuildCopies`,{cursor:i}));a=e.done,i=e.cursor}if(!a)throw new E(`Bonsai is still preparing this repository. Try again shortly.`,{code:`TIMEOUT`,retryable:!0});r.throwIfAborted();let o=await n(e,t);if(Vp.safeParse(o).success)throw Error(`The repository changed while loading. Refresh to retry.`);return o}finally{i(!1)}}function yh({repository:e,branch:t,request:n,onSaved:r,onSaveState:i}){let a=new Map;async function o(r,i){i.throwIfAborted();let a=Rp.parse(await n(`files.read`,{repo:e,ref:t,path:r}));if(i.throwIfAborted(),a.binary)throw Error(`This Bonsai file is not a text document.`);if(a.text===null&&a.blob!==null)throw new E(`This Bonsai file is too large to edit.`,{code:`FILE_TOO_LARGE`,retryable:!1});return a}async function s(o,s){s.throwIfAborted();let c=Lp.parse(await n(`files.sync`,{}));s.throwIfAborted();let l=c.settled.find(n=>n.repo===e&&n.branch===t&&n.path===o);if(l){if(l.result.kind===`refused`)throw new E(`Bonsai refused sync: ${l.result.reason}`,{code:`CAPABILITY_DENIED`,retryable:l.result.reason===`background-unavailable`});let e=a.get(o);if(l.result.revision!==e?.version)throw new E(`Your saved file changed. Compare before syncing.`,{code:`CONFLICT`,retryable:!0});i(o,l.result)}r()}async function c(c,l,u,d){d.throwIfAborted();let f=a.get(c);if(u===void 0){let e=await o(c,d);f={file:e,contents:e.pending?.text??e.text??``,version:e.version}}if(!f)throw Error(`Reopen this Bonsai file before saving.`);if(u!==void 0&&f.contents!==u)throw new E(`The file baseline changed. Compare before saving.`,{code:`CONFLICT`,retryable:!0});if(u!==void 0){let e=await o(c,d);if(e.version!==f.version||(e.pending?.text??e.text??``)!==f.contents)throw new E(`The file changed. Compare before saving.`,{code:`CONFLICT`,retryable:!0});e.pending===void 0&&(f.file=e)}let p=Np.parse({repo:e,branch:t,path:c,baseCommit:f.file.commit,baseBlob:f.file.blob,text:l,revision:f.version}),m=Pp.parse(await n(`files.save`,p));if(m.kind===`refused`)throw new E(`Bonsai refused this save: ${m.reason}`,{code:`CAPABILITY_DENIED`,retryable:m.reason===`background-unavailable`});if(i(c,m),m.kind===`conflict`)throw new E(`Your saved file changed. Compare before saving.`,{code:`CONFLICT`,retryable:!0});a.set(c,{file:f.file,contents:l,version:m.revision}),r(),m.kind===`saved`&&s(c,d).catch(e=>{console.error(`Bonsai sync status could not be refreshed`,e),!(a.get(c)?.version!==m.revision||d.aborted)&&i(c,{kind:`failed`,revision:m.revision,reason:`sync_failed`})})}return{kind:`repository`,id:`${e}:${t}`,label:`${e} · ${t}`,async read(e,t,n){let r=n?.revision,s=await o(e,t);if(n?.closed)return{kind:`closed`};if(n&&n.revision!==r)return{kind:`changed`};let c=s.pending?.text??s.text??``;a.set(e,{file:s,contents:c,version:s.version});let l=s.pending;return l?.state===`pending`?i(e,{kind:`saved`,revision:l.revision,state:`pending`}):l?.state===`conflict`?i(e,{kind:`conflict`,revision:l.revision,theirs:l.theirs}):l?.state===`failed`?i(e,{kind:`failed`,revision:l.revision,reason:l.failure??`sync_failed`}):s.version!==null&&i(e,{kind:`synced`,revision:s.version,commit:s.commit}),{kind:`text`,contents:c}},replace:(e,t,n,r)=>c(e,t,n,r),write:(e,t,n)=>c(e,t,void 0,n),retry:s,async discard(o,s){s.throwIfAborted();let c=a.get(o);if(!c)throw Error(`Reopen this saved file before discarding it.`);if(c.version===null)return;let l=Fp.parse({repo:e,branch:t,path:o,revision:c.version}),u=Ip.parse(await n(`files.discard`,l));if(s.throwIfAborted(),u.kind===`conflict`)throw new E(`Your saved file changed. Refresh before discarding.`,{code:`CONFLICT`,retryable:!0});a.delete(o),i(o,null),r()},async readCommitted(e,t){let n=await o(e,t),r=n.text??``;return a.has(e)||a.set(e,{file:n,contents:r,version:n.version}),r}}}async function bh(e,t,n){let r={repo:t,ref:n},i=Ep.parse(await e(`files.tree`,{...r,path:``})),a=Bp.parse(await e(`files.list`,r)),o=zp.parse(await e(`commits.list`,{...r,limit:20}));if(i.commit.hash!==a.commit.hash)throw Error(`The repository changed while loading. Refresh to retry.`);return{head:i.commit.hash,branch:n,files:a.paths.map(e=>({path:e})),history:o.commits.map(e=>e.commit),truncated:a.truncated}}var xh=`file-tree-container`,Sh=`data-file-tree-style`,Ch=`data-file-tree-unsafe-css`,wh=`data-file-tree-scrollbar-measure`,Th=`data-file-tree-scrollbar-gutter-measured`,Eh=`--trees-scrollbar-gutter-measured`,Dh=`header`,Oh=`context-menu`,kh=`context-menu-trigger`,Ah=typeof window>`u`?V.useEffect:V.useLayoutEffect;function jh(e,t,n){let r=e==null?null:(0,H.jsx)(`div`,{slot:Dh,children:e}),i=t!=null&&n!=null?(0,H.jsx)(`div`,{slot:Oh,children:t(n.item,n.context)}):null;return r==null&&i==null?null:(0,H.jsxs)(H.Fragment,{children:[r,i]})}function Mh(e,t){return typeof window>`u`&&t!=null?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`template`,{shadowrootmode:`open`,dangerouslySetInnerHTML:{__html:t.shadowHtml}}),e]}):(0,H.jsx)(H.Fragment,{children:e})}function Nh(e){let t=e.shadowRoot;return t?.querySelector(`[data-file-tree-id]`)instanceof HTMLElement||t?.querySelector(`[data-file-tree-id]`)instanceof SVGElement||e.querySelector(`template[shadowrootmode="open"]`)instanceof HTMLTemplateElement}function Ph(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 Fh({header:e,id:t,model:n,preloadedData:r,renderContextMenu:i,...a}){let[o,s]=(0,V.useState)(null),[c,l]=(0,V.useState)(null),u=(0,V.useRef)(n.getComposition()),d=(0,V.useRef)(n);d.current!==n&&(d.current=n,u.current=n.getComposition());let f=i!=null,p=(0,V.useCallback)(()=>{s(null)},[]),m=(0,V.useCallback)((e,t)=>{s({context:t,item:e})},[]),h=u.current,g=(0,V.useMemo)(()=>Ph(h,e,f,p,m),[h,p,m,f,e]),_=(0,V.useCallback)(e=>{l(e)},[]);(0,V.useEffect)(()=>{f||s(null)},[f]),Ah(()=>{n.setComposition(g)},[g,n]),Ah(()=>{if(c!=null)return r!=null&&Nh(c)?n.hydrate({fileTreeContainer:c}):n.render({fileTreeContainer:c}),()=>{n.unmount(),n.setComposition(h)}},[h,c,n,r]);let v=Mh(jh(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,H.jsx)(xh,{...a,id:y,ref:_,style:b,suppressHydrationWarning:r!=null,children:v})}var Ih=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
3
+ <symbol id="file-tree-icon-chevron" viewBox="0 0 16 16">
4
+ <path d="M12.4697 5.46973C12.7626 5.17684 13.2374 5.17684 13.5303 5.46973C13.8232 5.76262 13.8232 6.23738 13.5303 6.53028L8.53028 11.5303C8.23738 11.8232 7.76262 11.8232 7.46973 11.5303L2.46973 6.53028C2.17684 6.23738 2.17684 5.76262 2.46973 5.46973C2.76262 5.17684 3.23738 5.17684 3.53028 5.46973L8 9.93946L12.4697 5.46973Z" fill="currentcolor"/>
5
+ </symbol>
6
+ <symbol id="file-tree-icon-dot" viewBox="0 0 6 6">
7
+ <circle cx="3" cy="3" r="3" />
8
+ </symbol>
9
+ <symbol id="file-tree-icon-file" viewBox="0 0 16 16">
10
+ <path fill="currentColor" d="M8 1v3a3 3 0 0 0 3 3h3v5.5a2.5 2.5 0 0 1-2.5 2.5h-7A2.5 2.5 0 0 1 2 12.5v-9A2.5 2.5 0 0 1 4.5 1z" class="bg" opacity=".5"/>
11
+ <path fill="currentColor" d="M9.5 1a.5.5 0 0 1 .354.146l4 4A.5.5 0 0 1 14 5.5V6h-3a2 2 0 0 1-2-2V1z" class="fg"/>
12
+ </symbol>
13
+ <symbol id="file-tree-icon-lock" viewBox="0 0 16 16">
14
+ <path fill="currentcolor" d="M4 5.336V4a4 4 0 1 1 8 0v1.336c1.586.54 2 1.843 2 4.664v1c0 4.118-.883 5-5 5H7c-4.117 0-5-.883-5-5v-1c0-2.821.414-4.124 2-4.664M5.5 4v1.054Q6.166 4.998 7 5h2q.834-.002 1.5.054V4a2.5 2.5 0 0 0-5 0m-2 6v1c0 .995.055 1.692.167 2.193.107.483.246.686.35.79s.307.243.79.35c.5.112 1.198.167 2.193.167h2c.995 0 1.692-.055 2.193-.166.483-.108.686-.247.79-.35.104-.105.243-.308.35-.791.112-.5.167-1.198.167-2.193v-1c0-.995-.055-1.692-.166-2.193-.108-.483-.247-.686-.35-.79-.105-.104-.308-.243-.791-.35C10.693 6.555 9.995 6.5 9 6.5H7c-.995 0-1.692.055-2.193.167-.483.107-.686.246-.79.35s-.243.307-.35.79C3.555 8.307 3.5 9.005 3.5 10" />
15
+ </symbol>
16
+ <symbol id="file-tree-icon-ellipsis" viewBox="0 0 16 16">
17
+ <path d="M5 8.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0M9.5 8.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0M14 8.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0" />
18
+ </symbol>
19
+ </svg>`,Lh=`<symbol id="file-tree-builtin-astro" viewBox="0 0 16 16">
20
+ <path fill="currentColor" d="M6.08 13.92c-.63-.57-.81-1.79-.55-2.67.45.56 1.08.73 1.73.83 1 .15 1.99.1 2.92-.37l.32-.19q.13.38.08.78a2.1 2.1 0 0 1-.9 1.5q-.3.24-.61.43c-.64.44-.81.95-.57 1.69l.02.08a1.7 1.7 0 0 1-.74-.64 2 2 0 0 1-.3-.98q0-.27-.02-.52-.07-.61-.61-.62a.7.7 0 0 0-.75.6z" class="bg" opacity=".6"/>
21
+ <path fill="currentColor" d="M2.5 11.1s1.86-.9 3.72-.9l1.4-4.39c.05-.21.2-.36.38-.36s.33.15.38.36l1.4 4.38c2.2 0 3.72.92 3.72.92l-3.16-8.69q-.13-.4-.45-.42H6.11q-.3.02-.45.42z" class="fg"/>
22
+ </symbol>`,Rh=`<symbol id="file-tree-builtin-babel" viewBox="0 0 16 16">
23
+ <path fill="currentColor" fill-rule="evenodd" d="M9.49.5q1.92.05 2.66.54 1.27.6 1.35 1.52v.23a4 4 0 0 1-.53 1.9l-1.38 1.24q-.74.38-.72.63c.77.82 1.33 1.29.85 2.42q-.47 1.1-2.04 2.28c-.5.32-1.88 1.35-2.96 1.86-1.64.77-3.1 1.4-4.65 1.89-.51.16-1.5.16-1.5.16L.5 15A76 76 0 0 0 5.76 3.49q-.1-.08-.1-.2.1 0 .32-.35l-.03-.09q-1.17.39-2.38 1.3l-.13.03q0-.1-.21-.16-.46.31-.82.7l-.13-.19.16-.06-.03-.16-.34.29L2 4.5q.36-.48.72-.54l.04-.1V3.8q.16 0 .15-.06l.13-.06a6 6 0 0 0 1.13-.9v-.03H4.1l-.12.07q0-.1-.1-.1l-.15.07-.04-.1q.93-.52 1.63-1.05Q7.89.65 9.5.5M8.46 7.83l-.32.04c-1.31.54-2.31.82-2.91.88a71 71 0 0 0-2.2 4.54h.07q.58-.04 3.04-1.42.13 0 1.66-1.05L9.18 9.7v.03q.45-.2.81-1.3v-.2q-.5-.46-1.53-.4m.28-5.75c-.5.1-.75.19-.72.38l-1.16 2.6q-.17.1-.34.95-.3.48-.25.77v.1l.22.05A15 15 0 0 1 8.86 6c1.1-.71 2.12-1.38 2.8-2.54q.24-.33.21-.54-.02-.33-.4-.54c-.54 0-1.07-.34-1.63-.28l-.94-.03z" clip-rule="evenodd"/>
24
+ </symbol>`,zh=`<symbol id="file-tree-builtin-bash" viewBox="0 0 16 16">
25
+ <path fill="currentColor" d="M8 1C2.24 1 1 2.24 1 8s1.24 7 7 7 7-1.24 7-7-1.24-7-7-7" class="bg" opacity=".2"/>
26
+ <path fill="currentColor" d="M11.5 11a.5.5 0 0 1 0 1h-3a.5.5 0 0 1 0-1zM7 6.75C7 6.42 6.64 6 6 6s-1 .42-1 .75q-.01.25.22.41.26.21.89.35.74.14 1.28.53c.37.29.61.7.61 1.21 0 .87-.68 1.5-1.5 1.7v.55a.5.5 0 0 1-1 0v-.56c-.82-.18-1.5-.82-1.5-1.69a.5.5 0 0 1 1 0c0 .33.36.75 1 .75s1-.42 1-.75q.01-.25-.22-.41a2 2 0 0 0-.89-.35q-.74-.14-1.28-.53A1.5 1.5 0 0 1 4 6.75c0-.87.68-1.5 1.5-1.7V4.5a.5.5 0 0 1 1 0v.56c.82.18 1.5.82 1.5 1.69a.5.5 0 0 1-1 0" class="fg-stroke"/>
27
+ </symbol>`,Bh=`<symbol id="file-tree-builtin-biome" viewBox="0 0 16 16">
28
+ <path fill="currentColor" d="M8 2 4.88 7.35a7 7 0 0 1 3.7-.13l1.04.25-.99 4.16-1.05-.25a2.7 2.7 0 0 0-3.07 1.45l-.98-.47a4 4 0 0 1 1.07-1.31 3.8 3.8 0 0 1 3.23-.71l.5-2.08a6 6 0 0 0-5.07 1.12A5.9 5.9 0 0 0 1 14h14z"/>
29
+ </symbol>`,Vh=`<symbol id="file-tree-builtin-bootstrap" viewBox="0 0 16 16">
30
+ <path fill="currentColor" fill-rule="evenodd" d="M11.72 1.5A2.5 2.5 0 0 1 14.2 4q.02 1.08.3 2.09c.22.73.56 1.24 1.08 1.45.22.08.4.27.4.5s-.18.43-.4.51q-.76.34-1.08 1.45c-.2.65-.27 1.32-.3 2a2.5 2.5 0 0 1-2.48 2.5H4.25A2.6 2.6 0 0 1 1.7 12c-.04-.85-.1-1.68-.22-2.04C1.26 9.23.92 8.7.4 8.5.18 8.42 0 8.23 0 8s.18-.42.4-.5q.77-.35 1.09-1.46c.1-.36.17-1.19.2-2.04a2.6 2.6 0 0 1 2.56-2.5z" class="bg" clip-rule="evenodd" opacity=".2"/>
31
+ <path fill="currentColor" fill-rule="evenodd" d="M8.47 4.54c1.23 0 2.04.68 2.04 1.73 0 .73-.55 1.39-1.24 1.5v.04c.94.1 1.58.77 1.58 1.7 0 1.2-.9 1.95-2.37 1.95H5.97a.3.3 0 0 1-.2-.08.3.3 0 0 1-.08-.2V4.82a.3.3 0 0 1 .08-.2.3.3 0 0 1 .2-.08zm-1.7 6.04h1.49q1.47-.01 1.49-1.15Q9.74 8.31 8.2 8.3H6.77zm0-5.16v2.06h1.21c.93 0 1.45-.38 1.45-1.06 0-.65-.44-1-1.22-1z" class="fg" clip-rule="evenodd"/>
32
+ </symbol>`,Hh=`<symbol id="file-tree-builtin-browserslist" viewBox="0 0 16 16">
33
+ <path fill="currentColor" d="M8.88 6.96c0 3.82 3.72 4.7 5.7 3.74-.23.9-1.04 1.67-2.35 1.93-.02.4.42 1.28.82 1.63-.9.35-1.94-.12-2.51-.48a5 5 0 0 0-.32 1.87c-.68 0-1.57-1-1.8-1.37-.3.18-.85 1.15-.96 1.72a2.4 2.4 0 0 1-.81-.86 2.4 2.4 0 0 1-.3-1.15c-.38.27-1.48.95-1.99 1.18-.25-.58-.15-1.3 0-2.06-.21.12-1.8.27-2.43.12.32-.36.75-1.19.94-1.57A4.5 4.5 0 0 1 .44 10.6c.48-.22.97-.53 1.49-1.06C1.26 9.17.24 8.64 0 7.7a6 6 0 0 0 1.79-.32C1.28 7.08.44 6.15.6 5.01c.42.21 1.3.37 1.73.3a3.4 3.4 0 0 1-.25-2.75 5 5 0 0 0 1.48 1c-.08-.8.3-2.31.8-2.71.2.46.73 1.21 1.08 1.4.09-.61.87-2.06 1.57-2.25 0 .5.27 1.4.5 1.67.51-.54 2.25-1.44 3.64-1.13-.43.45-.75.61-.86.98 1.05 0 2.78.34 4.27 1.93-2.34-.89-5.69.56-5.69 3.5" class="bg" opacity=".5"/>
34
+ <path fill="currentColor" d="M11.21 3.59a4.1 4.1 0 0 0 2.47 2.89c.24-.22.61-.38.95-.19.76.44.2 1.26-.34 1.66l-.07.06a13 13 0 0 1-4.49 1.61l-.3-.43a10.5 10.5 0 0 0 4.13-1.31 1 1 0 0 0 .23-.25.5.5 0 0 0-.21-.69l-.15-.06a4.5 4.5 0 0 1-1.77-1.31 4.5 4.5 0 0 1-.88-1.77q.2-.12.43-.21"/>
35
+ <path fill="currentColor" d="M10.36 5.18a.4.4 0 0 0-.03.38c.09.2.3.3.46.23s.24-.3.15-.5l-.01-.02q.23.13.34.39a.83.83 0 0 1-.43 1.08.8.8 0 0 1-1.08-.43.83.83 0 0 1 .6-1.13"/>
36
+ </symbol>`,Uh=`<symbol id="file-tree-builtin-bun" viewBox="0 0 16 16">
37
+ <path fill="currentColor" d="M8 14c3.87 0 7-2.46 7-5.49 0-1.88-1.2-3.53-3.04-4.52q-1.1-.61-1.84-1.07C9.2 2.35 8.64 2 8 2s-1.36.45-2.31 1.03A29 29 0 0 1 4.04 4C2.2 4.98 1 6.63 1 8.51 1 11.54 4.13 14 8 14M7.18 3.88q.3-.66.3-1.37c0-.08.11-.1.13-.01.38 1.57-.53 2.35-1.2 2.61-.08.03-.12-.07-.06-.12a3 3 0 0 0 .83-1.12m1.2-.05a3 3 0 0 0-.45-1.3V2.5c-.04-.07.05-.15.1-.1 1.15 1.2.77 2.3.33 2.87-.05.05-.13 0-.11-.08q.21-.67.13-1.37m1.04-.32a3 3 0 0 0-.94-1.02v-.01c-.06-.05-.01-.16.07-.12 1.51.61 1.61 1.8 1.43 2.5l-.03.03a.07.07 0 0 1-.1-.06 3 3 0 0 0-.43-1.32m-2.97.32c-.36.3-.74.43-1.2.56q-.11 0-.1-.1a3.5 3.5 0 0 0 1.76-1.57s.09-.07.1.04c0 .18-.2.76-.56 1.07m2.89 6.36q-.13.52-.55.88a1.3 1.3 0 0 1-.75.35 1.3 1.3 0 0 1-.77-.35 1.7 1.7 0 0 1-.54-.88.13.13 0 0 1 .15-.15h2.31a.14.14 0 0 1 .15.15M6.15 8.95a1.1 1.1 0 0 1-1.39-.14A1.1 1.1 0 0 1 5.12 7a1.1 1.1 0 0 1 1.2.25 1.1 1.1 0 0 1-.17 1.69m4.96 0a1.1 1.1 0 0 1-1.4-.14 1.1 1.1 0 0 1 .37-1.8 1.1 1.1 0 0 1 1.2.25 1.1 1.1 0 0 1 .24 1.2 1 1 0 0 1-.41.5"/>
38
+ </symbol>`,Wh=`<symbol id="file-tree-builtin-c" viewBox="0 0 16 16">
39
+ <path fill="currentColor" fill-rule="evenodd" d="M8 1q.084 0 .166.021.098.023.186.075c1.055.624 4.22 2.486 5.277 3.11.085.05.15.112.209.192h-.002l.028.037a.5.5 0 0 1 .103.21q.031.102.033.21v6.29a.71.71 0 0 1-.347.616l-5.307 3.144a.68.68 0 0 1-.693 0l-5.307-3.144A.72.72 0 0 1 2 11.145V4.832a.71.71 0 0 1 .346-.612l5.288-3.126A.7.7 0 0 1 7.992 1zm2.901 4.349a3.75 3.75 0 1 0 0 5.302l-1.06-1.06a2.25 2.25 0 1 1 0-3.182z" clip-rule="evenodd"/>
40
+ </symbol>`,Gh=`<symbol id="file-tree-builtin-claude" viewBox="0 0 16 16">
41
+ <path fill="currentColor" d="M3.75 10.31 6.5 8.77l.04-.14-.04-.07h-.14l-.46-.03-1.57-.04-1.38-.07-1.33-.07-.34-.07L1 7.86l.03-.21.28-.18.4.03.89.07 1.33.08.97.06 1.43.16h.22l.03-.1-.07-.05-.06-.06-1.39-.92-1.48-.98-.79-.57-.42-.28-.2-.28-.1-.6.39-.41.52.04.12.03.52.4 1.12.86L6.2 6.04l.2.17.09-.06.01-.04-.1-.15-.76-1.46-.85-1.46-.37-.6-.1-.36a1 1 0 0 1-.06-.42l.42-.59.25-.07.6.08.22.2.36.84.58 1.3.9 1.77.29.53.14.47.04.14h.1v-.07l.07-1 .14-1.22.14-1.57.04-.45.23-.53.42-.28.36.15.28.41-.04.25-.16 1.08-.36 1.7-.21 1.14h.12l.14-.15.58-.76.97-1.2.42-.5.5-.51.32-.25h.6l.44.66-.2.68-.61.79-.52.65-.74 1-.45.8.04.05h.1l1.68-.36.9-.16 1.06-.18.5.23.05.22-.2.48-1.15.28-1.34.28-2 .46-.04.01.03.04.9.09.4.03h.94l1.77.14.46.28.27.37-.04.28-.72.37-.95-.23-2.24-.53-.76-.18h-.11v.06l.64.63L12 10.86l1.48 1.35.07.34-.18.28-.2-.03-1.29-.98-.5-.42-1.12-.95h-.07v.1l.25.38 1.37 2.05.07.63-.1.2-.36.14-.38-.08-.8-1.12-.85-1.26-.66-1.15-.07.05-.4 4.23-.19.21-.42.17-.35-.28-.2-.42.2-.87.23-1.12.18-.9.17-1.1.1-.36v-.03h-.1l-.84 1.16-1.27 1.72-1 1.07-.24.1-.42-.22.04-.39.22-.32 1.4-1.8.84-1.1.57-.64-.02-.07h-.04l-3.7 2.4-.66.09-.28-.28.03-.42.14-.14 1.12-.77z"/>
42
+ </symbol>`,Kh=`<symbol id="file-tree-builtin-cpp" viewBox="0 0 16 16">
43
+ <path fill="currentColor" fill-rule="evenodd" d="M8 1q.084 0 .166.021.098.023.186.075c1.055.624 4.22 2.486 5.277 3.11.085.05.15.112.209.192h-.002l.028.037a.5.5 0 0 1 .103.21q.031.102.033.21v6.29a.71.71 0 0 1-.347.616l-5.307 3.144a.68.68 0 0 1-.693 0l-5.307-3.144A.72.72 0 0 1 2 11.145V4.832a.71.71 0 0 1 .346-.612l5.288-3.126A.7.7 0 0 1 7.992 1zm2.901 4.349a3.75 3.75 0 1 0 0 5.302l-1.06-1.06a2.25 2.25 0 1 1 0-3.182z" clip-rule="evenodd"/>
44
+ </symbol>`,qh=`<symbol id="file-tree-builtin-css" viewBox="0 0 16 16">
45
+ <path fill="currentColor" d="M8 15c-5.76 0-7-1.24-7-7V2a1 1 0 0 1 1-1h6c5.77 0 7 1.24 7 7s-1.24 7-7 7" class="vector" opacity=".2"/>
46
+ <path fill="currentColor" d="M10.1 9.19h.73c.03.49.22.6 1 .6.76 0 .93-.12.93-.68 0-.52-.17-.67-.94-.85-1.38-.3-1.68-.56-1.68-1.47 0-1.05.3-1.29 1.67-1.29 1.29 0 1.57.2 1.6 1.13h-.74c-.01-.34-.17-.42-.85-.42-.77 0-.94.1-.94.58 0 .42.17.55.96.73 1.36.3 1.66.58 1.66 1.59 0 1.14-.31 1.39-1.73 1.39-1.39 0-1.69-.24-1.67-1.31m-3.9 0h.74c.03.49.21.6.99.6.76 0 .93-.12.93-.68 0-.52-.17-.67-.93-.85-1.39-.3-1.69-.56-1.69-1.47 0-1.05.3-1.29 1.67-1.29 1.3 0 1.58.2 1.6 1.13h-.73c-.02-.34-.18-.42-.85-.42-.78 0-.95.1-.95.58 0 .42.17.55.96.73 1.37.3 1.67.58 1.67 1.59 0 1.14-.32 1.39-1.74 1.39-1.38 0-1.68-.24-1.66-1.31m-1.22 0h.75c-.09 1.07-.37 1.31-1.56 1.31-1.37 0-1.68-.45-1.68-2.5 0-1.96.36-2.5 1.68-2.5 1.16 0 1.44.25 1.52 1.35h-.76c-.08-.52-.22-.64-.76-.64-.74 0-.9.33-.9 1.78 0 1.47.16 1.8.9 1.8.58 0 .74-.11.8-.6"/>
47
+ </symbol>`,Jh=`<symbol id="file-tree-builtin-database" viewBox="0 0 16 16">
48
+ <path fill="currentColor" d="M14.953 9.733a12.4 12.4 0 0 1-.244 1.936c-.207.933-.532 1.58-.996 2.044s-1.11.789-2.044.996C10.73 14.918 9.533 15 8 15s-2.73-.082-3.669-.291c-.933-.207-1.58-.532-2.044-.996s-.789-1.11-.996-2.044c-.122-.547-.2-1.182-.244-1.92q.23.364.532.667c.64.639 1.482 1.031 2.533 1.265 1.046.232 2.33.315 3.884.315 1.555 0 2.838-.083 3.884-.315 1.051-.234 1.893-.626 2.532-1.265a4 4 0 0 0 .541-.683"/>
49
+ <path fill="currentColor" d="M14.93 5.924c-.046.663-.118 1.24-.23 1.743-.207.932-.532 1.579-.995 2.042s-1.11.789-2.042.996c-.938.209-2.135.291-3.667.291-1.531 0-2.729-.082-3.667-.29-.932-.208-1.579-.534-2.042-.997s-.789-1.11-.996-2.042a12 12 0 0 1-.227-1.683l.016-.188a4 4 0 0 0 .5.62c.638.639 1.48 1.031 2.532 1.265 1.046.232 2.33.315 3.884.315 1.555 0 2.838-.083 3.884-.315 1.051-.234 1.893-.626 2.532-1.265.192-.192.357-.404.506-.633z"/>
50
+ <path fill="currentColor" d="M8 1c1.533 0 2.73.082 3.669.291.933.207 1.58.533 2.044.996.403.404.904.944.91 1.695.004.764-.509 1.318-.918 1.727-.463.463-1.11.789-2.042.996-.938.209-2.135.291-3.667.291-1.531 0-2.729-.082-3.667-.29-.932-.208-1.579-.534-2.042-.997-.406-.406-.915-.953-.915-1.71 0-.758.509-1.305.915-1.712.464-.463 1.11-.789 2.044-.996C5.27 1.082 6.467 1 8 1"/>
51
+ </symbol>`,Yh=`<symbol id="file-tree-builtin-default" viewBox="0 0 16 16">
52
+ <path fill="currentColor" d="M8 1v3a3 3 0 0 0 3 3h3v5.5a2.5 2.5 0 0 1-2.5 2.5h-7A2.5 2.5 0 0 1 2 12.5v-9A2.5 2.5 0 0 1 4.5 1z" class="bg" opacity=".4"/>
53
+ <path fill="currentColor" d="M9.5 1a.5.5 0 0 1 .354.146l4 4A.5.5 0 0 1 14 5.5V6h-3a2 2 0 0 1-2-2V1z" class="fg"/>
54
+ </symbol>`,Xh=`<symbol id="file-tree-builtin-docker" viewBox="0 0 16 16">
55
+ <path fill="currentColor" d="M15.85 6.54c-.05-.04-.45-.36-1.31-.36q-.34 0-.68.06a2.7 2.7 0 0 0-1.14-1.79l-.23-.14-.15.23a3 3 0 0 0-.4 1q-.24 1.01.26 1.84c-.4.24-1.03.3-1.17.3H.5a.5.5 0 0 0-.5.52q-.01 1.46.46 2.83.55 1.5 1.6 2.18c.79.5 2.08.79 3.54.79q.96 0 1.94-.18a8 8 0 0 0 2.55-.97 7 7 0 0 0 1.73-1.5 10 10 0 0 0 1.7-3.06h.15a2.4 2.4 0 0 0 1.8-.7 2 2 0 0 0 .47-.74l.06-.2z"/>
56
+ <path fill="currentColor" d="M1.48 7.36h1.4a.14.14 0 0 0 .14-.13V5.91q-.01-.12-.13-.14H1.48a.13.13 0 0 0-.13.14v1.32q.02.13.13.13m1.94 0h1.41a.14.14 0 0 0 .13-.13V5.91q-.01-.12-.13-.14h-1.4a.13.13 0 0 0-.13.14v1.32q0 .13.12.13m1.98 0h1.4q.13 0 .14-.13V5.91a.13.13 0 0 0-.14-.14H5.4q-.1.01-.12.14v1.32q0 .13.12.13m1.95 0h1.42q.1 0 .12-.13V5.91q0-.12-.12-.14H7.35q-.1.01-.12.14v1.32q.01.13.12.13M3.42 5.5h1.41c.07 0 .13-.08.13-.15V4.03a.13.13 0 0 0-.13-.14h-1.4q-.12 0-.13.14v1.31q0 .13.12.15m1.98 0h1.4c.08 0 .14-.08.14-.15V4.03q0-.13-.14-.14H5.4q-.1 0-.12.14v1.31q0 .13.12.15m1.95 0h1.42c.06 0 .12-.08.12-.15V4.03q-.01-.13-.12-.14H7.35q-.1 0-.12.14v1.31q.01.13.12.15m0-1.9h1.42q.1-.02.12-.14v-1.3Q8.88 2 8.77 2H7.35q-.1 0-.12.14v1.3q.01.13.12.14m1.97 3.78h1.4a.13.13 0 0 0 .14-.13V5.91q-.01-.12-.13-.14H9.32q-.1.01-.12.14v1.32q.01.13.12.13" opacity=".5"/>
57
+ </symbol>`,Zh=`<symbol id="file-tree-builtin-eslint" viewBox="0 0 16 16">
58
+ <path fill="currentColor" d="M11.16 6.1 8.12 4.35a.3.3 0 0 0-.24 0L4.84 6.1a.3.3 0 0 0-.12.2v3.5q0 .14.12.22l3.04 1.74q.12.08.24 0l3.04-1.74a.2.2 0 0 0 .13-.22V6.3a.3.3 0 0 0-.13-.2" opacity=".5"/>
59
+ <path fill="currentColor" d="m.1 7.69 3.63-6.3A.8.8 0 0 1 4.37 1h7.26c.26 0 .5.17.64.4l3.63 6.27a.8.8 0 0 1 0 .75l-3.63 6.24a.7.7 0 0 1-.64.34H4.37a.7.7 0 0 1-.64-.34L.1 8.41a.7.7 0 0 1 0-.72m3 3.02q.01.15.14.23l4.63 2.66q.13.06.26 0l4.63-2.66a.3.3 0 0 0 .14-.23V5.4a.3.3 0 0 0-.14-.23L8.13 2.52a.3.3 0 0 0-.26 0L3.24 5.17a.3.3 0 0 0-.14.23z"/>
60
+ </symbol>`,Qh=`<symbol id="file-tree-builtin-font" viewBox="0 0 16 16">
61
+ <path fill="currentColor" d="M12.3 13c-1.59 0-2.68-.99-2.68-2.5 0-1.43 1-2.34 2.88-2.35h2.16v-.83c0-1.08-.62-1.68-1.73-1.68-1.05 0-1.66.54-1.73 1.36H9.93c.09-1.43 1.06-2.48 3.05-2.48 1.75 0 3.02.95 3.02 2.68v5.66h-1.29v-1.02h-.04c-.41.66-1.16 1.16-2.37 1.16m.36-1.12c1.14 0 2-.72 2-1.74v-.96H12.6c-1.12 0-1.6.54-1.6 1.28 0 .97.8 1.42 1.66 1.42m-11.24.98H0L3.8 2h1.39l3.8 10.86H7.54l-1.08-3.2H2.5zm3.09-9.25h-.04l-1.6 4.95H6.1z"/>
62
+ </symbol>`,$h=`<symbol id="file-tree-builtin-git" viewBox="0 0 16 16">
63
+ <path fill="currentColor" d="M14.74 7.38 8.62 1.26a.9.9 0 0 0-1.27 0L6.08 2.53l1.61 1.61a1.07 1.07 0 0 1 1.36 1.37l1.55 1.55a1.07 1.07 0 0 1 1.1 1.77 1.07 1.07 0 0 1-1.74-1.16L8.5 6.22v3.8a1.07 1.07 0 1 1-.89-.02V6.15a1.07 1.07 0 0 1-.58-1.4l-1.58-1.6-4.2 4.2a.9.9 0 0 0 0 1.27l6.12 6.12a.9.9 0 0 0 1.27 0l6.09-6.09a.9.9 0 0 0 0-1.27"/>
64
+ </symbol>`,eg=`<symbol id="file-tree-builtin-go" viewBox="0 0 16 16">
65
+ <path fill="currentColor" fill-rule="evenodd" d="M4.41 4.57A3.2 3.2 0 0 1 6.87 5q.74.49 1.08 1.29.08.12-.1.16l-1.55.4c-.14.03-.15.04-.27-.1a1 1 0 0 0-.44-.34 1.6 1.6 0 0 0-1.68.14q-.95.61-.94 1.73c0 .73.52 1.33 1.25 1.43q.95.1 1.58-.6l.25-.34h-1.8c-.19 0-.24-.12-.17-.27.12-.28.34-.76.47-1a.3.3 0 0 1 .24-.14h2.98a4 4 0 0 1 .64-1.19 4 4 0 0 1 2.6-1.52 3.5 3.5 0 0 1 2.64.46q1.13.73 1.31 2.04a3.5 3.5 0 0 1-1.06 3.09q-.93.92-2.23 1.17l-.74.08a3.5 3.5 0 0 1-2.27-.8 3 3 0 0 1-.93-1.42 4 4 0 0 1-.39.61 4 4 0 0 1-2.64 1.56 3.3 3.3 0 0 1-2.5-.6 3 3 0 0 1-1.18-2.03 3.5 3.5 0 0 1 .8-2.67 4 4 0 0 1 2.6-1.58M13.1 7.5a1.53 1.53 0 0 0-1.9-1.21q-1.3.3-1.62 1.59a1.5 1.5 0 0 0 .85 1.72q.77.33 1.52-.05a2 2 0 0 0 1.18-1.74q0-.17-.03-.3" clip-rule="evenodd"/>
66
+ </symbol>`,tg=`<symbol id="file-tree-builtin-graphql" viewBox="0 0 16 16">
67
+ <path fill="currentColor" fill-rule="evenodd" d="M8 1a1.25 1.25 0 0 1 1.18 1.65l2.8 1.61q.33-.25.77-.26a1.25 1.25 0 0 1 .48 2.4v3.2a1.25 1.25 0 1 1-1.25 2.13l-2.8 1.62A1.25 1.25 0 0 1 8 15a1.25 1.25 0 0 1-1.18-1.65l-2.8-1.62q-.33.26-.77.27a1.25 1.25 0 0 1-.48-2.4V6.4a1.25 1.25 0 1 1 1.25-2.14l2.8-1.61A1.25 1.25 0 0 1 8 1M4.44 11.14l-.06.13 2.75 1.58a1.25 1.25 0 0 1 1.74 0l2.74-1.58-.05-.13zm3.89-7.68a1.3 1.3 0 0 1-.66 0L4.03 9.77q.37.3.45.78h7.04q.08-.48.45-.78zM4.38 4.73a1.24 1.24 0 0 1-1.02 1.76v3.02l.13.01 3.67-6.35-.03-.02zm4.46-1.56 3.67 6.35.13-.01V6.49a1.25 1.25 0 0 1-1.03-1.76L8.87 3.15z" clip-rule="evenodd"/>
68
+ </symbol>`,ng=`<symbol id="file-tree-builtin-html" viewBox="0 0 16 16">
69
+ <path fill="currentColor" d="M8 1C2.24 1 1 2.24 1 8s1.24 7 7 7 7-1.24 7-7-1.24-7-7-7" class="bg" opacity=".2"/>
70
+ <path fill="currentColor" d="M10.48 3.76a.5.5 0 0 1 .4.58L10.6 5.8h1.14a.5.5 0 0 1 0 1h-1.32L10 9.2h1.08a.5.5 0 0 1 0 1H9.8l-.3 1.64a.5.5 0 1 1-.98-.18l.27-1.46H6.4l-.3 1.64a.5.5 0 1 1-.98-.18l.27-1.46H4.25a.5.5 0 0 1 0-1h1.32L6 6.8H4.93a.5.5 0 0 1 0-1H6.2l.3-1.64a.5.5 0 1 1 .98.18L7.2 5.8h2.4l.3-1.64a.5.5 0 0 1 .58-.4M6.58 9.2h2.4l.44-2.4h-2.4z" class="fg"/>
71
+ </symbol>`,rg=`<symbol id="file-tree-builtin-image" viewBox="0 0 16 16">
72
+ <path fill="currentColor" d="M12.5 2A2.5 2.5 0 0 1 15 4.5v4.67l-4.05-3.54-4.08 4.08-3-2L1 10.6V4.5A2.5 2.5 0 0 1 3.5 2z" opacity=".3"/>
73
+ <path fill="currentColor" d="M15 10.5v1a2.5 2.5 0 0 1-2.5 2.5h-9a2.5 2.5 0 0 1-2.46-2.04L4 9l3 2 4-4zm-7-5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0"/>
74
+ </symbol>`,ig=`<symbol id="file-tree-builtin-javascript" viewBox="0 0 16 16">
75
+ <path fill="currentColor" d="M8 1C2.24 1 1 2.24 1 8s1.24 7 7 7 7-1.24 7-7-1.24-7-7-7" class="bg" opacity=".2"/>
76
+ <path fill="currentColor" d="M8.1 9.64h.95c.04.62.28.76 1.28.76s1.2-.14 1.2-.85c0-.66-.2-.85-1.2-1.07-1.79-.38-2.18-.7-2.18-1.86C8.15 5.3 8.54 5 10.31 5c1.67 0 2.04.26 2.07 1.42h-.95c-.02-.43-.23-.53-1.1-.53-1 0-1.22.14-1.22.74 0 .52.22.7 1.24.92 1.76.38 2.15.73 2.15 2 0 1.44-.4 1.75-2.24 1.75-1.8 0-2.18-.3-2.15-1.66M3.5 9.5h.98c0 .76.15.92.85.92.77 0 .94-.18.94-1.02V5.1h1v4.34c0 1.54-.35 1.87-1.92 1.87-1.55 0-1.89-.32-1.86-1.8"/>
77
+ </symbol>`,ag=`<symbol id="file-tree-builtin-json" viewBox="0 0 16 16">
78
+ <path fill="currentColor" d="M13.25 11.5V9.75a.5.5 0 0 1 .36-.48l.55-.15a1.16 1.16 0 0 0 0-2.24l-.55-.15a.5.5 0 0 1-.36-.48V4.5a2.5 2.5 0 0 0-2.5-2.5h-.25a.5.5 0 0 0 0 1h.25a1.5 1.5 0 0 1 1.5 1.5v1.75a1.5 1.5 0 0 0 1.09 1.44l.54.15a.16.16 0 0 1 0 .32l-.54.15a1.5 1.5 0 0 0-1.09 1.44v1.75a1.5 1.5 0 0 1-1.5 1.5h-.25a.5.5 0 0 0 0 1h.25a2.5 2.5 0 0 0 2.5-2.5m-10.5 0V9.75a.5.5 0 0 0-.36-.48l-.55-.15a1.16 1.16 0 0 1 0-2.24l.55-.15a.5.5 0 0 0 .36-.48V4.5A2.5 2.5 0 0 1 5.25 2h.25a.5.5 0 0 1 0 1h-.25a1.5 1.5 0 0 0-1.5 1.5v1.75a1.5 1.5 0 0 1-1.09 1.44l-.54.15a.16.16 0 0 0 0 .32l.54.15a1.5 1.5 0 0 1 1.09 1.45v1.74a1.5 1.5 0 0 0 1.5 1.5h.25a.5.5 0 0 1 0 1h-.25a2.5 2.5 0 0 1-2.5-2.5"/>
79
+ </symbol>`,og=`<symbol id="file-tree-builtin-markdown" viewBox="0 0 16 16">
80
+ <path fill="currentColor" d="M1 12V4h2l2 2.5L7 4h2v8H7V7.5l-2 2-2-2V12zm9-3 3 3.5L16 9h-2V4h-2v5z"/>
81
+ </symbol>`,sg=`<symbol id="file-tree-builtin-mcp" viewBox="0 0 16 16">
82
+ <path fill="currentColor" d="M9.26-.04a3 3 0 0 1 2 .82 2.8 2.8 0 0 1 .8 2.35 2.9 2.9 0 0 1 2.41.8l.03.02a2.74 2.74 0 0 1 0 3.94l-5.8 5.69-.04.06-.02.07q0 .04.02.07.01.04.04.06l1.2 1.17a.55.55 0 0 1 0 .79.6.6 0 0 1-.81 0l-1.2-1.17a1.3 1.3 0 0 1 0-1.84L13.7 7.1a1.65 1.65 0 0 0 .37-1.82 2 2 0 0 0-.37-.54l-.03-.03a1.73 1.73 0 0 0-2.4 0L6.47 9.4l-.07.06a.58.58 0 0 1-.92-.18.6.6 0 0 1 .12-.6l4.85-4.76a1.65 1.65 0 0 0 0-2.36 1.73 1.73 0 0 0-2.4 0l-6.43 6.3a.6.6 0 0 1-.8 0 .55.55 0 0 1 0-.8L7.25.79a3 3 0 0 1 2-.82"/>
83
+ <path fill="currentColor" d="M9.26 2.19a.6.6 0 0 1 .52.34.6.6 0 0 1 0 .43l-.12.18L4.9 7.79a1.65 1.65 0 0 0 0 2.36 1.73 1.73 0 0 0 2.4 0l4.75-4.66a.58.58 0 0 1 .93.18.6.6 0 0 1-.12.61l-4.75 4.66a2.9 2.9 0 0 1-4.01 0 2.75 2.75 0 0 1-.62-3.04A3 3 0 0 1 4.1 7l4.74-4.65a.6.6 0 0 1 .4-.16"/>
84
+ </symbol>`,cg=`<symbol id="file-tree-builtin-nextjs" viewBox="0 0 16 16">
85
+ <defs>
86
+ <linearGradient id="a" x1="4.522" x2="14" y1="3.943" y2="16" gradientUnits="userSpaceOnUse">
87
+ <stop stop-color="currentColor"/>
88
+ <stop offset="1" stop-color="currentColor" stop-opacity="0"/>
89
+ </linearGradient>
90
+ </defs>
91
+ <path fill="currentColor" d="M3 2h1.522v9.09H3z"/>
92
+ <path fill="url(#a)" d="M4.903 2 15 15.075q-.565.5-1.195.925L4.522 3.943z"/>
93
+ <path fill="currentColor" d="M12.172 2h-1.508v9.094h1.508z"/>
94
+ </symbol>`,lg=`<symbol id="file-tree-builtin-npm" viewBox="0 0 16 16">
95
+ <path fill="currentColor" d="M2 1a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1z" class="vector" opacity=".2"/>
96
+ <path fill="currentColor" d="M10.5 13H13V3H3v10h5V5.5h2.5z"/>
97
+ </symbol>`,ug=`<symbol id="file-tree-builtin-oxc" viewBox="0 0 16 16">
98
+ <path fill="currentColor" d="M9.5 1a.5.5 0 0 1 .5.5V3h3.5a.5.5 0 0 1 .38.83L10.5 7.69v1.44q.41.04.95-.16a4 4 0 0 0 .72-.35l.04-.03h.01a.5.5 0 0 1 .67.1l2 2.5a.5.5 0 0 1 0 .62c-.76.96-3.14 2.69-6.89 2.69s-6.13-1.73-6.89-2.69a.5.5 0 0 1 0-.62l2-2.5a.5.5 0 0 1 .67-.1l.05.03.16.09q.22.13.56.26.54.2.95.16V7.69L2.12 3.83A.5.5 0 0 1 2.5 3H6V1.5a.5.5 0 0 1 .5-.5zM7 3.5a.5.5 0 0 1-.5.5H3.6l2.78 3.17a.5.5 0 0 1 .12.33v2a.5.5 0 0 1-.28.45c-.7.35-1.5.15-2.02-.05a5 5 0 0 1-.58-.26l-1.46 1.84c.82.78 2.8 2.02 5.84 2.02s5.02-1.24 5.84-2.02l-1.46-1.83a5 5 0 0 1-.58.26c-.52.2-1.33.39-2.02.04a.5.5 0 0 1-.28-.45v-2a.5.5 0 0 1 .12-.33L12.4 4H9.5a.5.5 0 0 1-.5-.5V2H7z"/>
99
+ </symbol>`,dg=`<symbol id="file-tree-builtin-postcss" viewBox="0 0 16 16">
100
+ <path fill="currentColor" d="M14.5 8a6.5 6.5 0 0 0-5.9-6.47l5.42 8.93A7 7 0 0 0 14.5 8M2.88 12A6.5 6.5 0 0 0 8 14.5c2.08 0 3.93-.98 5.12-2.5zm8.62-1h1.68L11.5 8.24zm-1-.55a4 4 0 0 1-.7.55h.7zM8 5.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5M5.5 11h.7a4 4 0 0 1-.7-.55zm-2.68 0H4.5V8.24zm3.76-6.2A4 4 0 0 1 8 4.5q.76 0 1.42.3L8 2.46zM1.5 8q0 1.31.48 2.46L7.4 1.53A6.5 6.5 0 0 0 1.5 8m14 0a7.5 7.5 0 0 1-.99 3.72l-.01.03-.02.03A7.5 7.5 0 0 1 8 15.5a7.5 7.5 0 0 1-6.5-3.75l-.01-.03A7.5 7.5 0 1 1 15.5 8"/>
101
+ </symbol>`,fg=`<symbol id="file-tree-builtin-prettier" viewBox="0 0 16 16">
102
+ <path fill="currentColor" d="M6 12v1H4.93v-1zm1-2v1H2v-1zm6-4v1h-3V6zm-1-4v1H9V2z"/>
103
+ <path fill="currentColor" d="M11.5 10v1H8v-1zM5 6v1H2V6zm5-2v1H9V4z" opacity=".8"/>
104
+ <path fill="currentColor" d="M6 14v1H2v-1zm-.5-6v1H2V8zM13 4v1h-3V4zM4.93 2v1H2V2z" opacity=".6"/>
105
+ <path fill="currentColor" d="M4.93 12v1H2v-1zM13 8v1H9V8zM5.5 4v1H2V4zM9 2v1H4.93V2z" opacity=".4"/>
106
+ </symbol>`,pg=`<symbol id="file-tree-builtin-python" viewBox="0 0 16 16">
107
+ <path fill="currentColor" d="M8.33 8.4H10c1.16 0 1.9-.73 1.9-1.86V5.08q0-.24.25-.24h.74c.75 0 1.33.32 1.66.97q.4.73.41 1.46c.09.9.09 1.78-.24 2.67-.25.73-.75 1.3-1.58 1.46h-4.8c-.08 0-.25 0-.25.08v.4s.17.09.25.09h2.82q.34-.02.33.32v1.06c0 .56-.25.97-.75 1.13-.41.16-.83.33-1.24.4a7 7 0 0 1-2.98-.07 3 3 0 0 1-1.16-.49c-.33-.32-.58-.65-.5-1.14v-2.91c0-1.13.67-1.78 1.82-1.78q.89-.1 1.66-.08m2.32 4.86a.65.65 0 0 0-.66-.65c-.34 0-.67.33-.67.65s.33.57.67.65a.65.65 0 0 0 .66-.65" class="bg" opacity=".8"/>
108
+ <path fill="currentColor" d="M7.67 7.6H6c-1.16 0-1.9.73-1.9 1.86v1.46q0 .24-.25.24h-.74c-.75 0-1.33-.32-1.66-.97a3 3 0 0 1-.41-1.46 6 6 0 0 1 .24-2.67c.25-.73.75-1.3 1.58-1.46h4.8c.08 0 .25 0 .25-.08v-.4s-.17-.09-.25-.09H4.85c-.24 0-.33-.08-.33-.32V2.65c0-.56.25-.97.75-1.13.41-.16.83-.33 1.24-.4a7 7 0 0 1 2.98.07c.41.09.83.25 1.16.49.33.32.58.65.5 1.13v2.92c0 1.14-.67 1.78-1.82 1.78-.58.08-1.16.08-1.66.08M5.35 2.73c0 .33.25.65.66.65.33 0 .66-.32.66-.65 0-.32-.33-.56-.66-.64a.65.65 0 0 0-.66.64" class="fg"/>
109
+ </symbol>`,mg=`<symbol id="file-tree-builtin-react" viewBox="0 0 16 16">
110
+ <path fill="currentColor" d="M8 6.65c.73 0 1.31.6 1.31 1.35S8.73 9.35 8 9.35 6.69 8.75 6.69 8 7.27 6.65 8 6.65"/>
111
+ <path fill="currentColor" fill-rule="evenodd" d="M8 2.55c1.3-.99 2.59-1.34 3.5-.8.92.55 1.27 1.87 1.08 3.53C14.06 5.94 15 6.9 15 8s-.94 2.06-2.42 2.72c.19 1.65-.16 2.98-1.08 3.52-.91.55-2.2.2-3.5-.8-1.3 1-2.58 1.35-3.5.8-.91-.54-1.27-1.87-1.08-3.52C1.94 10.06 1 9.1 1 8s.94-2.06 2.42-2.72c-.19-1.66.17-2.98 1.08-3.52s2.2-.2 3.5.8M4.26 11.2c-.08 1.34.28 2.03.68 2.26s1.15.22 2.25-.52l.11-.09a12 12 0 0 1-1.24-1.39 11 11 0 0 1-1.8-.41zm7.47-.15q-.83.27-1.79.41-.6.8-1.24 1.4l.11.08c1.1.74 1.86.76 2.25.52.4-.23.76-.92.68-2.26zm-3.04.54a14 14 0 0 1-1.38 0q.34.38.69.7.35-.32.7-.7M8 5.29q-.76 0-1.47.1A13 13 0 0 0 5.07 8a14 14 0 0 0 1.46 2.62 13 13 0 0 0 2.94 0A13 13 0 0 0 10.93 8a14 14 0 0 0-1.46-2.62A13 13 0 0 0 8 5.3M4.64 9.18q-.15.5-.25.96.44.16.94.27a15 15 0 0 1-.7-1.23m6.73 0a15 15 0 0 1-.7 1.23q.5-.11.95-.27a10 10 0 0 0-.25-.96M3.44 6.26C2.27 6.86 1.87 7.53 1.87 8s.4 1.14 1.57 1.74l.13.07q.18-.88.55-1.81a12 12 0 0 1-.55-1.8q-.07.02-.13.06m8.99-.07A12 12 0 0 1 11.88 8q.36.94.55 1.8l.13-.06c1.17-.6 1.56-1.27 1.56-1.74s-.39-1.14-1.56-1.74zm-7.1-.6q-.5.11-.94.27.1.46.25.96a15 15 0 0 1 .69-1.23m5.34 0a15 15 0 0 1 .7 1.23q.14-.5.24-.96-.44-.15-.94-.27M7.18 3.06c-1.09-.74-1.85-.76-2.24-.52s-.76.92-.69 2.26l.01.15a11 11 0 0 1 1.8-.41q.6-.8 1.24-1.4zm3.88-.52c-.4-.24-1.15-.22-2.25.52l-.12.08q.65.6 1.25 1.4.96.15 1.8.41v-.14c.08-1.35-.28-2.04-.68-2.27M8 3.7a10 10 0 0 0-.7.7 14 14 0 0 1 1.4 0 10 10 0 0 0-.7-.7" clip-rule="evenodd"/>
112
+ </symbol>`,hg=`<symbol id="file-tree-builtin-ruby" viewBox="0 0 16 16">
113
+ <path fill="currentColor" fill-rule="evenodd" d="M11.04 2c.48 0 .92.23 1.18.6l2.54 3.65c.37.52.3 1.23-.15 1.69l-5.58 5.64a1.47 1.47 0 0 1-2.06 0L1.39 7.94a1.3 1.3 0 0 1-.15-1.7l2.54-3.63q.2-.3.5-.45.33-.16.68-.16zm.84 2.17a.5.5 0 0 0-.7-.05L8 6.84 4.83 4.12a.5.5 0 0 0-.65.76L6.65 7H3.5a.5.5 0 0 0 0 1h9a.5.5 0 0 0 0-1H9.35l2.48-2.12a.5.5 0 0 0 .05-.7" clip-rule="evenodd"/>
114
+ </symbol>`,gg=`<symbol id="file-tree-builtin-rust" viewBox="0 0 16 16">
115
+ <path fill="currentColor" fill-rule="evenodd" d="M8 .8a.2.2 0 0 1 .18.1l.38.6.16.02.5-.53.01-.01a.2.2 0 0 1 .33.08l.25.68.16.05.59-.43h.02a.2.2 0 0 1 .3.14l.12.71.15.08.65-.3a.2.2 0 0 1 .2.02.2.2 0 0 1 .1.18l-.03.72.12.1.71-.16a.2.2 0 0 1 .25.25l-.17.7q.06.06.1.13l.73-.03A.2.2 0 0 1 14 4a.2.2 0 0 1 .02.2l-.3.66.08.14.71.12a.2.2 0 0 1 .14.32l-.43.59.05.16.68.25a.2.2 0 0 1 .07.35l-.53.49.01.16.62.38a.2.2 0 0 1 0 .36l-.62.38-.01.16.53.5a.2.2 0 0 1-.07.34l-.68.25-.05.16.43.59a.2.2 0 0 1-.14.32l-.72.12-.07.15.3.65a.2.2 0 0 1-.02.2.2.2 0 0 1-.18.1l-.72-.03-.1.13.16.7a.2.2 0 0 1-.25.25l-.7-.17-.13.1.03.73a.2.2 0 0 1-.1.18.2.2 0 0 1-.2.02l-.66-.3-.14.08-.12.71a.2.2 0 0 1-.32.14l-.59-.43-.16.05-.25.68a.2.2 0 0 1-.34.07l-.5-.53-.16.01-.38.62a.2.2 0 0 1-.36 0l-.38-.62-.16-.01-.5.53a.2.2 0 0 1-.34-.07l-.25-.68-.16-.05-.59.43a.2.2 0 0 1-.32-.14L5 13.78l-.15-.07-.65.3a.2.2 0 0 1-.2-.02.2.2 0 0 1-.1-.18l.03-.72-.13-.1-.7.16a.2.2 0 0 1-.25-.25l.17-.7-.1-.13-.73.03a.2.2 0 0 1-.2-.3l.3-.66-.08-.14-.71-.12a.2.2 0 0 1-.14-.32l.43-.59-.05-.16-.68-.25A.2.2 0 0 1 1 9.22l.53-.5-.02-.16-.6-.38A.2.2 0 0 1 .8 8a.2.2 0 0 1 .1-.18l.6-.38.02-.16-.53-.5a.2.2 0 0 1 .07-.34l.68-.25.05-.16-.43-.59a.2.2 0 0 1 .14-.32L2.2 5l.08-.15L2 4.2a.2.2 0 0 1 .2-.3l.72.03.1-.13-.16-.7a.2.2 0 0 1 .25-.25l.7.16.13-.1-.03-.72A.2.2 0 0 1 4 2a.2.2 0 0 1 .2-.02l.65.3L5 2.2l.12-.71v-.03a.2.2 0 0 1 .32-.1l.59.41.16-.04.25-.68.01-.02A.2.2 0 0 1 6.8.99l.49.53.16-.02.38-.61.02-.02A.2.2 0 0 1 8 .79M6.8 9.45h1.26l.06.01q.03.01.03.05v1.52q0 .07-.09.06h-4.5A5.4 5.4 0 0 0 8 13.42a5.4 5.4 0 0 0 4.45-2.33h-2.42c-.36 0-.68-.5-.77-.75-.08-.22-.2-.91-.25-1.12-.15-.61-.59-.71-.78-.73H6.8zM8 2.58a5.4 5.4 0 0 0-4.07 1.85h5.74l.17.02c.23.03.6.12.96.35.34.23.83.68.83 1.4 0 .66-.55 1.16-1.08 1.5.42.33.7.53.86 1.44.04.17.34.32.62.29.29-.03.62-.16.62-.75v-.24q0-.1.07-.1h.68A5.43 5.43 0 0 0 8 2.59M2.96 6.03a5.4 5.4 0 0 0-.19 3.37h1.66V6.03zM6.8 7.06h1.66c.35 0 .77-.12.77-.47 0-.42-.55-.53-.65-.53H6.8z" clip-rule="evenodd"/>
116
+ </symbol>`,_g=`<symbol id="file-tree-builtin-sass" viewBox="0 0 16 16">
117
+ <path fill="currentColor" fill-rule="evenodd" d="M8.08 1.44c2.41-.91 4.96-.37 5.35 1.27.39 1.62-.92 3.56-2.6 4.25a5 5 0 0 1-3.26.35c-.58-.2-.92-.62-1-.85-.03-.09-.09-.24 0-.3.05-.03.08-.02.22.15s.7.6 1.75.48c2.78-.34 4.45-2.64 3.92-3.88-.37-.87-2.5-1.26-5.18.16C4.03 4.81 3.85 6.24 3.82 6.8c-.08 1.5 1.73 2.28 2.7 3.4q.04.03.07.08c.3-.12.7-.19 1.35-.2 1.58-.03 2.47 1.08 2.43 2.08-.03.78-.7 1.1-.82 1.13-.1.01-.14.02-.15-.06q-.03-.06.13-.15c.16-.09.42-.3.48-.72.05-.43-.24-1.44-1.76-1.63a3 3 0 0 0-1.33.08c.27.62.32 1.87-.29 2.83-.63 1-1.8 1.61-2.93 1.27-.37-.1-.93-.92-.45-2.05.46-1.07 2.4-2.12 2.66-2.26-.9-.83-3.08-1.95-3.4-3.65-.08-.49.13-1.65 1.46-2.98a12 12 0 0 1 4.11-2.52m-1.88 9.7c-.01.01-.9.47-1.52 1.17-.59.66-.75 1.48-.43 1.69.3.18 1-.04 1.51-.62a3 3 0 0 0 .5-.9q.2-.64.02-1.39z" clip-rule="evenodd"/>
118
+ </symbol>`,vg=`<symbol id="file-tree-builtin-stylelint" viewBox="0 0 16 16">
119
+ <path fill="currentColor" d="M4 3v3.5l1.5-1L7 15 .5 6l1-1.5L0 3l2.5-2h1zm12 0-1.5 1.5 1 1.5L9 15l1.5-9.5 1.5 1V3l.5-2h1zm-8 8.5a.5.5 0 1 1 0 1 .5.5 0 0 1 0-1m0-3a.5.5 0 1 1 0 1 .5.5 0 0 1 0-1m0-3a.5.5 0 1 1 0 1 .5.5 0 0 1 0-1"/>
120
+ <path fill="currentColor" d="M6.5 2.5V4l-2 1.5v-4zm5 3L9.5 4V2.5l2-1zM9 4H7V2.5h2z"/>
121
+ </symbol>`,yg=`<symbol id="file-tree-builtin-svelte" viewBox="0 0 16 16">
122
+ <path fill="currentColor" d="m3.98 3.7 3.36-2.08a4.5 4.5 0 0 1 5.9 1.23 4 4 0 0 1 .7 3.02q-.16.75-.58 1.4c.42.77.56 1.66.4 2.52a3.7 3.7 0 0 1-1.57 2.4l-.17.1-3.36 2.09a4.5 4.5 0 0 1-5.9-1.23 4 4 0 0 1-.66-1.44 4 4 0 0 1-.04-1.58 4 4 0 0 1 .58-1.4 4 4 0 0 1-.4-2.52 3.7 3.7 0 0 1 1.57-2.4zl3.36-2.08zm7.87 0a2.7 2.7 0 0 0-1.26-.95 2.7 2.7 0 0 0-1.6-.07 3 3 0 0 0-.52.2l-.16.09-3.36 2.08a2 2 0 0 0-.69.64 2 2 0 0 0-.36.86 2.3 2.3 0 0 0 .42 1.81A2.7 2.7 0 0 0 7.18 9.4q.28-.06.53-.2l.16-.09 1.28-.79.2-.09a.8.8 0 0 1 .87.31.7.7 0 0 1 .13.55.7.7 0 0 1-.24.4l-.08.05-3.36 2.08-.2.09a1 1 0 0 1-.49-.02 1 1 0 0 1-.38-.3 1 1 0 0 1-.13-.37v-.1l.01-.13-.13-.03a4 4 0 0 1-1.1-.5l-.2-.14-.18-.12-.07.18-.08.3a2.3 2.3 0 0 0 .43 1.82q.45.64 1.19.93.73.28 1.51.14l.16-.04q.27-.07.52-.2l.16-.09 3.36-2.08q.4-.25.69-.64.27-.4.36-.86a2.3 2.3 0 0 0-.42-1.82 2.7 2.7 0 0 0-1.27-.95 2.7 2.7 0 0 0-1.6-.08q-.27.07-.52.2l-.16.1-1.28.79-.2.09a1 1 0 0 1-.49-.03 1 1 0 0 1-.38-.29.7.7 0 0 1-.13-.54.7.7 0 0 1 .24-.4l.08-.06L9.33 4.4l.2-.1a.8.8 0 0 1 .87.32 1 1 0 0 1 .13.38v.22l.11.04q.6.18 1.12.5l.2.14.17.12.06-.19.08-.3a2.3 2.3 0 0 0-.42-1.81z"/>
123
+ </symbol>`,bg=`<symbol id="file-tree-builtin-svg" viewBox="0 0 16 16">
124
+ <path fill="currentColor" d="M5 7a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2z"/>
125
+ <path fill="currentColor" d="M6 1a5 5 0 0 1 4.58 3H7a3 3 0 0 0-3 3v3.58A5 5 0 0 1 6 1" opacity=".5"/>
126
+ </symbol>`,xg=`<symbol id="file-tree-builtin-svgo" viewBox="0 0 16 16">
127
+ <path fill="currentColor" d="M9.43 4.8A.6.6 0 1 1 9.19 6l-.56.96a1.2 1.2 0 0 1 .32 1.58l.7.53a.89.89 0 1 1-.17.22l-.7-.52a1.2 1.2 0 0 1-1.4.25l-.56.87a.75.75 0 1 1-.57-.2 1 1 0 0 1 .32.05l.56-.87a1.2 1.2 0 0 1-.4-1.24l-1.2-.47a.56.56 0 1 1 .1-.28v.02l1.2.47a1.2 1.2 0 0 1 1.56-.55l.56-.97a.6.6 0 0 1-.15-.64.6.6 0 0 1 .63-.4"/>
128
+ <path fill="currentColor" fill-rule="evenodd" d="M9.17 1q.16.63.27 1.26a6 6 0 0 1 1.61.67q.52-.38 1.08-.71l1.65 1.64q-.32.56-.68 1.05.48.78.72 1.67.6.09 1.18.25v2.32q-.55.15-1.11.24a6 6 0 0 1-.7 1.82q.31.44.59.91l-1.65 1.65-.85-.55a6 6 0 0 1-1.9.83q-.08.47-.2.95H6.84q-.12-.46-.2-.93a6 6 0 0 1-1.96-.81q-.39.27-.8.51l-1.65-1.65q.25-.43.53-.84a6 6 0 0 1-.75-1.9L1 9.16V6.83q.54-.14 1.09-.24a6 6 0 0 1 .77-1.74q-.33-.47-.63-.98l1.65-1.65q.54.32 1.03.68a6 6 0 0 1 1.66-.66q.1-.61.26-1.24zM7.96 3.73a4 4 0 0 0-1.74.36 4.5 4.5 0 0 0-2.3 2.3 4.4 4.4 0 0 0-.1 3.29l.03.06a4.4 4.4 0 0 0 2.4 2.47 4.4 4.4 0 0 0 3.48-.02l.03-.02a4.4 4.4 0 0 0 2.3-2.42l.06-.14a4.4 4.4 0 0 0-.2-3.4 4.4 4.4 0 0 0-2.13-2.07L9.47 4a4 4 0 0 0-1.51-.27" clip-rule="evenodd"/>
129
+ </symbol>`,Sg=`<symbol id="file-tree-builtin-swift" viewBox="0 0 16 16">
130
+ <path fill="currentColor" d="M9.63 1c6.15 4.35 4.16 9.15 4.16 9.15s1.75 2.05 1.04 3.85c0 0-.72-1.26-1.93-1.26-1.17 0-1.85 1.26-4.2 1.26C3.47 14 1 9.46 1 9.46c4.71 3.22 7.93.94 7.93.94C6.8 9.12 2.29 3 2.29 3c3.93 3.47 5.63 4.39 5.63 4.39-1.01-.87-3.86-5.13-3.86-5.13C6.34 4.66 10.86 8 10.86 8c1.28-3.7-1.23-7-1.23-7"/>
131
+ </symbol>`,Cg=`<symbol id="file-tree-builtin-table" viewBox="0 0 16 16">
132
+ <path fill="currentColor" d="M8 4a3 3 0 0 0 3 3h3v5.5a2.5 2.5 0 0 1-2.5 2.5h-7A2.5 2.5 0 0 1 2 12.5v-9A2.5 2.5 0 0 1 4.5 1H8z" class="bg" opacity=".4"/>
133
+ <path fill="currentColor" d="M11.5 8a.5.5 0 0 1 .5.5v4a.5.5 0 0 1-.5.5h-7a.5.5 0 0 1-.5-.5v-4a.5.5 0 0 1 .5-.5zM5 12h2.5v-1H5zm3.5 0H11v-1H8.5zM5 10h2.5V9H5zm3.5 0H11V9H8.5zm1-9a.5.5 0 0 1 .354.146l4 4A.5.5 0 0 1 14 5.5V6h-3a2 2 0 0 1-2-2V1z" class="fg"/>
134
+ </symbol>`,wg=`<symbol id="file-tree-builtin-tailwind" viewBox="0 0 16 16">
135
+ <path fill="currentColor" fill-rule="evenodd" d="M8 4Q5.2 4 4.5 6.67q1.05-1.34 2.45-1c.53.12.91.5 1.33.9C8.98 7.23 9.77 8 11.5 8q2.8 0 3.5-2.67-1.05 1.34-2.45 1c-.53-.12-.91-.5-1.33-.9C10.52 4.77 9.73 4 8 4M4.5 8Q1.7 8 1 10.67q1.05-1.34 2.45-1c.53.12.91.5 1.33.9C5.48 11.23 6.26 12 8 12q2.8 0 3.5-2.67-1.05 1.34-2.45 1c-.53-.12-.91-.5-1.33-.9C7.02 8.77 6.24 8 4.5 8" clip-rule="evenodd"/>
136
+ </symbol>`,Tg=`<symbol id="file-tree-builtin-terraform" viewBox="0 0 16 16">
137
+ <path fill="currentColor" d="M1 0v5.05l4.35 2.53V2.53zm9.18 5.34L5.83 2.82v5.05l4.35 2.53zm.47 5.06V5.34L15 2.82v5.05zm-.48 5.6-4.35-2.53V8.42l4.35 2.53z"/>
138
+ </symbol>`,Eg=`<symbol id="file-tree-builtin-text" viewBox="0 0 16 16">
139
+ <path fill="currentColor" fill-rule="evenodd" d="M8 4a3 3 0 0 0 3 3h3v5.5a2.5 2.5 0 0 1-2.5 2.5h-7A2.5 2.5 0 0 1 2 12.5v-9A2.5 2.5 0 0 1 4.5 1H8z" class="bg" clip-rule="evenodd" opacity=".4"/>
140
+ <path fill="currentColor" d="M8.5 11a.5.5 0 0 1 0 1h-3a.5.5 0 0 1 0-1zm2-2a.5.5 0 0 1 0 1h-5a.5.5 0 0 1 0-1zm-1-8a.5.5 0 0 1 .354.146l4 4A.5.5 0 0 1 14 5.5V6h-3a2 2 0 0 1-2-2V1z"/>
141
+ </symbol>`,Dg=`<symbol id="file-tree-builtin-typescript" viewBox="0 0 16 16">
142
+ <path fill="currentColor" d="M8 1C2.24 1 1 2.24 1 8s1.24 7 7 7 7-1.24 7-7-1.24-7-7-7" class="bg" opacity=".2"/>
143
+ <path fill="currentColor" d="M8.1 9.64h.95c.04.62.28.76 1.28.76s1.2-.14 1.2-.85c0-.66-.2-.85-1.2-1.07-1.79-.38-2.18-.7-2.18-1.86C8.15 5.3 8.54 5 10.31 5c1.67 0 2.04.26 2.07 1.42h-.95c-.02-.43-.23-.53-1.1-.53-1 0-1.22.14-1.22.74 0 .52.22.7 1.24.92 1.76.38 2.15.73 2.15 2 0 1.44-.4 1.75-2.24 1.75-1.8 0-2.18-.3-2.15-1.66m-3 1.57V5.99H3.5v-.9h4.21v.9H6.1v5.22z"/>
144
+ </symbol>`,Og=`<symbol id="file-tree-builtin-vite" viewBox="0 0 16 16">
145
+ <path fill="currentColor" d="M8.57 14.87c-.18.26-.55.11-.55-.22v-3.18l-.05-.27-.13-.22-.2-.15-.24-.06H4.29c-.26 0-.4-.32-.26-.55L6.08 7c.3-.46 0-1.1-.5-1.1H1.8c-.25 0-.4-.32-.25-.56l2.65-4.2A.3.3 0 0 1 4.46 1h7.9c.26 0 .4.32.26.55l-2.05 3.23c-.29.46 0 1.1.5 1.1h3.12c.26 0 .4.34.24.57z"/>
146
+ </symbol>`,kg=`<symbol id="file-tree-builtin-vscode" viewBox="0 0 16 16">
147
+ <path fill="currentColor" d="m5.11 9.68-2.4 1.84a.6.6 0 0 1-.75-.04l-.77-.7a.6.6 0 0 1 0-.87L3.28 8zm5.52-8.42a.51.51 0 0 1 .87.36V4.8L7.32 8 5.1 6.32z" opacity=".75"/>
148
+ <path fill="currentColor" d="M11.1 14.99h.03zM1.96 4.52a.6.6 0 0 1 .75-.04l8.8 6.71v3.19a.51.51 0 0 1-.88.36L1.19 6.1a.6.6 0 0 1 0-.87z" opacity=".65"/>
149
+ <path fill="currentColor" d="M11.62 14.91a.9.9 0 0 1-1-.17.51.51 0 0 0 .88-.36V1.62a.51.51 0 0 0-.87-.36.9.9 0 0 1 1-.17l2.87 1.39a.9.9 0 0 1 .5.8v9.44a.9.9 0 0 1-.5.8z"/>
150
+ </symbol>`,Ag=`<symbol id="file-tree-builtin-vue" viewBox="0 0 16 16">
151
+ <path fill="currentColor" d="M9.62 2.25 8 5.02 6.38 2.25H1l7 12 7-12z" opacity=".5"/>
152
+ <path fill="currentColor" d="M9.54 2.25 8 4.95l-1.54-2.7H4l4 7 4-7z"/>
153
+ </symbol>`,jg=`<symbol id="file-tree-builtin-wasm" viewBox="0 0 16 16">
154
+ <path fill="currentColor" d="M13 1a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h3a2 2 0 1 0 4 0z" class="subtract" opacity=".2"/>
155
+ <path fill="currentColor" d="M4.64 11.4h.02l.8-3.4h.91l.73 3.45L7.88 8h.96l-1.25 5h-.97L5.9 9.6 5.1 13h-1L3 8h.98z"/>
156
+ <path fill="currentColor" fill-rule="evenodd" d="M13 13h-1.02l-.33-1.11H9.9L9.64 13h-.97l1.26-5h1.54zm-2.49-3.77-.42 1.84h1.32l-.49-1.84z" clip-rule="evenodd"/>
157
+ </symbol>`,Mg=`<symbol id="file-tree-builtin-webpack" viewBox="0 0 16 16">
158
+ <path fill="currentColor" d="M14.1 11.79 8.26 15v-2.5l3.64-1.94zm.4-.35V4.73l-2.14 1.2v4.3zm-12.6.35L7.74 15v-2.5L4.1 10.56zm-.4-.35V4.73l2.14 1.2v4.3zm.25-7.15 6-3.29v2.42L3.9 5.47l-.03.01zm12.5 0L8.25 1v2.42l3.85 2.05.03.01z" class="bg" opacity=".4"/>
159
+ <path fill="currentColor" d="m7.74 11.93-3.59-1.92v-3.8l3.6 2.02zm.52 0 3.59-1.92v-3.8l-3.6 2.02zM4.4 5.77 8 3.85l3.6 1.93L8 7.8z" class="fg"/>
160
+ </symbol>`,Ng=`<symbol id="file-tree-builtin-yml" viewBox="0 0 16 16">
161
+ <path fill="currentColor" d="M7.5 2A1.5 1.5 0 0 1 9 3.5v3A1.5 1.5 0 0 1 7.5 8h-2v2A1.5 1.5 0 0 0 7 11.5v-1A1.5 1.5 0 0 1 8.5 9h5a1.5 1.5 0 0 1 1.5 1.5v3a1.5 1.5 0 0 1-1.5 1.5h-5A1.5 1.5 0 0 1 7 13.5v-1A2.5 2.5 0 0 1 4.5 10V8h-2A1.5 1.5 0 0 1 1 6.5v-3A1.5 1.5 0 0 1 2.5 2zm1 8a.5.5 0 0 0-.5.5v3a.5.5 0 0 0 .5.5h5a.5.5 0 0 0 .5-.5v-3a.5.5 0 0 0-.5-.5zm-6-7a.5.5 0 0 0-.5.5v3a.5.5 0 0 0 .5.5h5a.5.5 0 0 0 .5-.5v-3a.5.5 0 0 0-.5-.5z"/>
162
+ </symbol>`,Pg=`<symbol id="file-tree-builtin-zig" viewBox="0 0 16 16">
163
+ <path fill="currentColor" d="m14.73 1.5-7.29 8.82h4.17l-1.73 2.04H5.76L1.27 14.5l7.3-8.91H4.39l1.73-2.05h4.12z"/>
164
+ <path fill="currentColor" d="M5.21 3.54 3.56 5.6h-.55v4.73h.83L2.1 12.36H1V3.54zm9.79 0v8.82h-4.3l1.74-2.04h.55V5.68h-.83l1.74-2.14z"/>
165
+ </symbol>`,Fg=[zh,Wh,Kh,qh,Jh,Yh,Qh,$h,eg,ng,rg,ig,ag,og,sg,pg,hg,gg,Sg,Cg,Eg,Dg,`<symbol id="file-tree-builtin-zip" viewBox="0 0 16 16">
166
+ <path fill="currentColor" d="M4.585 2a2 2 0 0 1 1.028.285l1.788 1.072a1 1 0 0 0 .514.143H12A2 2 0 0 1 13.935 5H0V4a2 2 0 0 1 2-2z" class="bg" opacity=".5"/>
167
+ <path fill="currentColor" fill-rule="evenodd" d="M14 12a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2v-1.25h1v-1H0V6h14zM9.9 8.25c-.883 0-1.9.5-1.9.5H7v1h1v1s1.017.5 1.9.5c.884 0 1.6-.672 1.6-1.5s-.716-1.5-1.6-1.5M2 9.75v1h1v-1zm2 0v1h1v-1zm2 0v1h1v-1zm-5-1v1h1v-1zm2 0v1h1v-1zm2 0v1h1v-1z" class="fg" clip-rule="evenodd"/>
168
+ </symbol>`],Ig=[Lh,Rh,Bh,Vh,Hh,Uh,Gh,Xh,Zh,tg,cg,lg,ug,dg,fg,mg,_g,vg,yg,bg,xg,wg,Tg,Og,kg,Ag,jg,Mg,Ng,Pg];function Lg(e,t){return t.length===0?e:e.replace(`</svg>`,`\n ${t.join(`
169
+ `)}\n</svg>`)}var Rg=Lg(Ih,Fg),zg={minimal:Ih,standard:Rg,complete:Lg(Rg,Ig)},Bg={".babelrc":`babel`,".babelrc.json":`babel`,".bash_profile":`bash`,".bashrc":`bash`,".browserslistrc":`browserslist`,".dockerignore":`docker`,".eslintignore":`eslint`,".eslintrc":`eslint`,".eslintrc.cjs":`eslint`,".eslintrc.js":`eslint`,".eslintrc.json":`eslint`,".eslintrc.yaml":`eslint`,".eslintrc.yml":`eslint`,".gitattributes":`git`,".gitignore":`git`,".gitkeep":`git`,".gitmodules":`git`,".oxlintrc.json":`oxc`,".postcssrc":`postcss`,".postcssrc.json":`postcss`,".postcssrc.yaml":`postcss`,".postcssrc.yml":`postcss`,".prettierignore":`prettier`,".prettierrc":`prettier`,".prettierrc.cjs":`prettier`,".prettierrc.js":`prettier`,".prettierrc.json":`prettier`,".prettierrc.mjs":`prettier`,".prettierrc.toml":`prettier`,".prettierrc.yaml":`prettier`,".prettierrc.yml":`prettier`,".stylelintignore":`stylelint`,".stylelintrc":`stylelint`,".stylelintrc.cjs":`stylelint`,".stylelintrc.js":`stylelint`,".stylelintrc.json":`stylelint`,".stylelintrc.mjs":`stylelint`,".stylelintrc.yaml":`stylelint`,".stylelintrc.yml":`stylelint`,".terraform.lock.hcl":`terraform`,".zprofile":`bash`,".zshenv":`bash`,".zshrc":`bash`,"babel.config.cjs":`babel`,"babel.config.js":`babel`,"babel.config.json":`babel`,"babel.config.mjs":`babel`,"biome.json":`biome`,"biome.jsonc":`biome`,"bootstrap.bundle.js":`bootstrap`,"bootstrap.bundle.min.js":`bootstrap`,"bootstrap.css":`bootstrap`,"bootstrap.js":`bootstrap`,"bootstrap.min.css":`bootstrap`,"bootstrap.min.js":`bootstrap`,"bun.lock":`bun`,"bun.lockb":`bun`,"bunfig.toml":`bun`,"claude.md":`claude`,"compose.yaml":`docker`,"compose.yml":`docker`,"docker-compose.override.yml":`docker`,"docker-compose.yaml":`docker`,"docker-compose.yml":`docker`,dockerfile:`docker`,"eslint.config.cjs":`eslint`,"eslint.config.js":`eslint`,"eslint.config.mjs":`eslint`,"eslint.config.mts":`eslint`,"eslint.config.ts":`eslint`,gemfile:`ruby`,"next.config.js":`nextjs`,"next.config.mjs":`nextjs`,"next.config.mts":`nextjs`,"next.config.ts":`nextjs`,"postcss.config.cjs":`postcss`,"postcss.config.js":`postcss`,"postcss.config.mjs":`postcss`,"postcss.config.ts":`postcss`,"prettier.config.cjs":`prettier`,"prettier.config.js":`prettier`,"prettier.config.mjs":`prettier`,rakefile:`ruby`,"readme.md":`markdown`,"stylelint.config.cjs":`stylelint`,"stylelint.config.js":`stylelint`,"stylelint.config.mjs":`stylelint`,"svgo.config.cjs":`svgo`,"svgo.config.js":`svgo`,"svgo.config.mjs":`svgo`,"svgo.config.ts":`svgo`,"tailwind.config.cjs":`tailwind`,"tailwind.config.js":`tailwind`,"tailwind.config.mjs":`tailwind`,"tailwind.config.ts":`tailwind`,"vite.config.js":`vite`,"vite.config.mjs":`vite`,"vite.config.mts":`vite`,"vite.config.ts":`vite`,"webpack.config.babel.js":`webpack`,"webpack.config.cjs":`webpack`,"webpack.config.js":`webpack`,"webpack.config.mjs":`webpack`,"webpack.config.ts":`webpack`},Vg={"7z":`zip`,astro:`astro`,AUTHORS:`text`,avif:`image`,bash:`bash`,bmp:`image`,bz2:`zip`,c:`c`,cc:`cpp`,cfg:`text`,CHANGELOG:`text`,cjs:`javascript`,"code-workspace":`vscode`,conf:`text`,CONTRIBUTORS:`text`,cpp:`cpp`,csh:`bash`,css:`css`,csv:`table`,cts:`typescript`,cxx:`cpp`,db:`database`,editorconfig:`text`,env:`text`,"env.development":`text`,"env.local":`text`,"env.production":`text`,eot:`font`,erb:`ruby`,fish:`bash`,gemspec:`ruby`,gif:`image`,go:`go`,gql:`graphql`,graphql:`graphql`,gz:`zip`,h:`c`,hh:`cpp`,hpp:`cpp`,htm:`html`,html:`html`,hxx:`cpp`,icns:`image`,ico:`image`,ini:`text`,inl:`cpp`,jar:`zip`,jpeg:`image`,jpg:`image`,js:`javascript`,json:`json`,json5:`json`,jsonc:`json`,jsonl:`json`,jsx:`javascript`,ksh:`bash`,less:`css`,LICENSE:`text`,log:`text`,markdown:`markdown`,mcp:`mcp`,md:`markdown`,mdx:`markdown`,"mdx.tsx":`markdown`,mjs:`javascript`,mm:`cpp`,mts:`typescript`,ods:`table`,otf:`font`,png:`image`,postcss:`css`,py:`python`,pyi:`python`,pyw:`python`,pyx:`python`,rake:`ruby`,rar:`zip`,rb:`ruby`,rs:`rust`,rst:`text`,rtf:`text`,sass:`css`,scss:`css`,sh:`bash`,sql:`database`,sqlite:`database`,sqlite3:`database`,styl:`css`,svelte:`svelte`,svg:`svg`,swift:`swift`,tar:`zip`,tf:`terraform`,tfstate:`terraform`,tfvars:`terraform`,tgz:`zip`,tif:`image`,tiff:`image`,ts:`typescript`,tsv:`table`,tsx:`typescript`,ttf:`font`,txt:`text`,vue:`vue`,war:`zip`,wasm:`wasm`,wast:`wasm`,wat:`wasm`,webp:`image`,woff:`font`,woff2:`font`,xhtml:`html`,xls:`table`,xlsx:`table`,xz:`zip`,yaml:`yml`,yml:`yml`,zig:`zig`,zip:`zip`,zsh:`bash`},Hg={jsx:`react`,sass:`sass`,scss:`sass`,tsx:`react`},Ug=new Set([`bash`,`c`,`cpp`,`css`,`database`,`default`,`font`,`git`,`go`,`html`,`image`,`javascript`,`json`,`markdown`,`mcp`,`python`,`ruby`,`rust`,`swift`,`table`,`text`,`typescript`,`zip`]),Wg=new Set([`complete`]);function Gg(e){return zg[e===`none`?`minimal`:e]}function Kg(e){return`file-tree-builtin-${e}`}function qg(e){return e!==`none`&&Wg.has(e)}function Jg(e,t,n){if(e===`minimal`||e===`none`)return;let r=e===`complete`,i=Bg[t.toLowerCase()];if(i!=null&&(r||Ug.has(i)))return i;for(let e of n){if(r){let t=Hg[e];if(t!=null)return t}let t=Vg[e];if(t!=null&&(r||Ug.has(t)))return t}return`default`}function Yg(e){return e.spriteSheet!=null||e.remap!=null||e.byFileName!=null||e.byFileExtension!=null||e.byFileNameContains!=null}function Xg(e){return e==null?{set:`complete`,colored:!0}:typeof e==`string`?{set:e,colored:!0}:{...e,set:e.set??(Yg(e)?`none`:`complete`),colored:e.colored??!0}}var Zg={compact:{itemHeight:24,factor:.8},default:{itemHeight:30,factor:1},relaxed:{itemHeight:36,factor:1.2}};function Qg(e,t){if(typeof e==`number`)return{itemHeight:t??Zg.default.itemHeight,factor:e};let n=Zg[e??`default`];return{itemHeight:t??n.itemHeight,factor:n.factor}}var $g=Zg.default.itemHeight,e_=`@layer base {
170
+ :host {
171
+ --trees-accent: var(--trees-accent-override, #009fff);
172
+ --trees-fg: var(--trees-fg-override, var(--trees-theme-sidebar-fg, light-dark(#6c6c71, #adadb1)));
173
+ --trees-fg-muted: var(--trees-fg-muted-override, var(--trees-theme-sidebar-header-fg, light-dark(#84848a, #84848a)));
174
+ --trees-bg: var(--trees-bg-override, var(--trees-theme-sidebar-bg, light-dark(#f8f8f8, #141415)));
175
+ --trees-bg-muted: var(--trees-bg-muted-override, var(--trees-theme-list-hover-bg, light-dark(color-mix(in lab,
176
+ var(--trees-accent) var(--trees-bg-alpha-light, 8%),
177
+ var(--trees-bg)), color-mix(in lab,
178
+ var(--trees-accent) var(--trees-bg-alpha-dark, 10%),
179
+ var(--trees-bg)))));
180
+ --trees-input-bg: var(--trees-input-bg-override, light-dark(#f8f8f8, #070707));
181
+ --trees-added-light: #16a994;
182
+ --trees-added-dark: #00cab1;
183
+ --trees-ignored-light: #adadb1;
184
+ --trees-ignored-dark: #4a4a4e;
185
+ --trees-modified-light: #1ca1c7;
186
+ --trees-modified-dark: #08c0ef;
187
+ --trees-renamed-light: #d5a910;
188
+ --trees-renamed-dark: #ffd452;
189
+ --trees-untracked-light: #16a994;
190
+ --trees-untracked-dark: #00cab1;
191
+ --trees-deleted-light: #ff2e3f;
192
+ --trees-deleted-dark: #ff6762;
193
+ --trees-border-color: var(--trees-border-color-override, var(--trees-theme-sidebar-border, light-dark(#eeeeef, #070707)));
194
+ --trees-indent-guide-bg: var(--trees-indent-guide-bg-override, color-mix(in lab, var(--trees-fg-muted) 25%, transparent));
195
+ --trees-density: var(--trees-density-override, 1);
196
+ --trees-border-radius: var(--trees-border-radius-override, calc(6px * var(--trees-density)));
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(--trees-font-weight-semibold-override, 600);
201
+ --trees-focus-ring-color: var(--trees-focus-ring-color-override, var(--trees-theme-focus-ring, var(--trees-accent)));
202
+ --trees-focus-ring-width: var(--trees-focus-ring-width-override, 1px);
203
+ --trees-focus-ring-offset: var(--trees-focus-ring-offset-override, -1px);
204
+ --trees-search-fg: var(--trees-search-fg-override, var(--trees-theme-input-fg, var(--trees-fg)));
205
+ --trees-search-font-weight: var(--trees-search-font-weight-override, 600);
206
+ --trees-search-bg: var(--trees-search-bg-override, var(--trees-theme-input-bg, var(--trees-input-bg)));
207
+ --trees-scrollbar-thumb: var(--trees-scrollbar-thumb-override, var(--trees-theme-scrollbar-thumb, color-mix(in lab, var(--trees-fg) 25%, var(--trees-bg))));
208
+ --trees-selected-fg: var(--trees-selected-fg-override, var(--trees-theme-list-active-selection-fg, var(--trees-fg)));
209
+ --trees-selected-bg: var(--trees-selected-bg-override, var(--trees-theme-list-active-selection-bg, light-dark(color-mix(in lab, var(--trees-accent) 12%, var(--trees-bg)), color-mix(in lab, var(--trees-accent) 15%, var(--trees-bg)))));
210
+ --trees-selected-focused-border-color: var(--trees-selected-focused-border-color-override, var(--trees-theme-focus-ring, var(--trees-accent)));
211
+ --trees-status-added: var(--trees-status-added-override, var(--trees-theme-git-added-fg, light-dark(var(--trees-added-light), var(--trees-added-dark))));
212
+ --trees-status-ignored: var(--trees-status-ignored-override, var(--trees-theme-git-ignored-fg, light-dark(var(--trees-ignored-light), var(--trees-ignored-dark))));
213
+ --trees-status-modified: var(--trees-status-modified-override, var(--trees-theme-git-modified-fg, light-dark(var(--trees-modified-light), var(--trees-modified-dark))));
214
+ --trees-status-renamed: var(--trees-status-renamed-override, var(--trees-theme-git-renamed-fg, light-dark(var(--trees-renamed-light), var(--trees-renamed-dark))));
215
+ --trees-status-untracked: var(--trees-status-untracked-override, var(--trees-theme-git-untracked-fg, light-dark(var(--trees-untracked-light), var(--trees-untracked-dark))));
216
+ --trees-status-deleted: var(--trees-status-deleted-override, var(--trees-theme-git-deleted-fg, light-dark(var(--trees-deleted-light), var(--trees-deleted-dark))));
217
+ --trees-git-modified-color: var(--trees-git-modified-color-override, var(--trees-status-modified));
218
+ --trees-git-added-color: var(--trees-git-added-color-override, var(--trees-status-added));
219
+ --trees-git-ignored-color: var(--trees-git-ignored-color-override, var(--trees-status-ignored));
220
+ --trees-git-deleted-color: var(--trees-git-deleted-color-override, var(--trees-status-deleted));
221
+ --trees-git-renamed-color: var(--trees-git-renamed-color-override, var(--trees-status-renamed));
222
+ --trees-git-untracked-color: var(--trees-git-untracked-color-override, var(--trees-status-untracked));
223
+ --trees-icon-gray: light-dark(#84848a, #adadb1);
224
+ --trees-icon-red: light-dark(#d52c36, #ff6762);
225
+ --trees-icon-vermilion: light-dark(#ff8c5b, #d5512f);
226
+ --trees-icon-orange: light-dark(#d47628, #ffa359);
227
+ --trees-icon-yellow: light-dark(#d5a910, #ffd452);
228
+ --trees-icon-green: light-dark(#199f43, #5ecc71);
229
+ --trees-icon-teal: light-dark(#17a5af, #64d1db);
230
+ --trees-icon-cyan: light-dark(#1ca1c7, #68cdf2);
231
+ --trees-icon-blue: light-dark(#1a85d4, #69b1ff);
232
+ --trees-icon-indigo: light-dark(#693acf, #9d6afb);
233
+ --trees-icon-purple: light-dark(#a631be, #d568ea);
234
+ --trees-icon-pink: light-dark(#d32a61, #ff678d);
235
+ --trees-icon-mauve: light-dark(#594c5b, #79697b);
236
+ --trees-file-icon-color-default: var(--trees-file-icon-color, var(--trees-icon-gray));
237
+ --trees-file-icon-color-astro: var(--trees-file-icon-color, var(--trees-icon-purple));
238
+ --trees-file-icon-color-babel: var(--trees-file-icon-color, var(--trees-icon-yellow));
239
+ --trees-file-icon-color-bash: var(--trees-file-icon-color, var(--trees-icon-green));
240
+ --trees-file-icon-color-biome: var(--trees-file-icon-color, var(--trees-icon-blue));
241
+ --trees-file-icon-color-bootstrap: var(--trees-file-icon-color, var(--trees-icon-indigo));
242
+ --trees-file-icon-color-browserslist: var(--trees-file-icon-color, var(--trees-icon-yellow));
243
+ --trees-file-icon-color-bun: var(--trees-file-icon-color, var(--trees-icon-mauve));
244
+ --trees-file-icon-color-c: var(--trees-file-icon-color, var(--trees-icon-blue));
245
+ --trees-file-icon-color-cpp: var(--trees-file-icon-color, var(--trees-icon-blue));
246
+ --trees-file-icon-color-claude: var(--trees-file-icon-color, var(--trees-icon-orange));
247
+ --trees-file-icon-color-css: var(--trees-file-icon-color, var(--trees-icon-indigo));
248
+ --trees-file-icon-color-database: var(--trees-file-icon-color, var(--trees-icon-purple));
249
+ --trees-file-icon-color-docker: var(--trees-file-icon-color, var(--trees-icon-blue));
250
+ --trees-file-icon-color-eslint: var(--trees-file-icon-color, var(--trees-icon-indigo));
251
+ --trees-file-icon-color-git: var(--trees-file-icon-vermilion, var(--trees-icon-vermilion));
252
+ --trees-file-icon-color-go: var(--trees-file-icon-color, var(--trees-icon-cyan));
253
+ --trees-file-icon-color-graphql: var(--trees-file-icon-color, var(--trees-icon-pink));
254
+ --trees-file-icon-color-html: var(--trees-file-icon-color, var(--trees-icon-orange));
255
+ --trees-file-icon-color-image: var(--trees-file-icon-color, var(--trees-icon-pink));
256
+ --trees-file-icon-color-javascript: var(--trees-file-icon-color, var(--trees-icon-yellow));
257
+ --trees-file-icon-color-json: var(--trees-file-icon-color, var(--trees-icon-orange));
258
+ --trees-file-icon-color-markdown: var(--trees-file-icon-color, var(--trees-icon-green));
259
+ --trees-file-icon-color-mcp: var(--trees-file-icon-color, var(--trees-icon-teal));
260
+ --trees-file-icon-color-npm: var(--trees-file-icon-color, var(--trees-icon-red));
261
+ --trees-file-icon-color-oxc: var(--trees-file-icon-cyan, var(--trees-icon-cyan));
262
+ --trees-file-icon-color-postcss: var(--trees-file-icon-color, var(--trees-icon-red));
263
+ --trees-file-icon-color-prettier: var(--trees-file-icon-color, var(--trees-icon-teal));
264
+ --trees-file-icon-color-python: var(--trees-file-icon-color, var(--trees-icon-blue));
265
+ --trees-file-icon-color-react: var(--trees-file-icon-color, var(--trees-icon-cyan));
266
+ --trees-file-icon-color-ruby: var(--trees-file-icon-color, var(--trees-icon-red));
267
+ --trees-file-icon-color-rust: var(--trees-file-icon-color, var(--trees-icon-orange));
268
+ --trees-file-icon-color-sass: var(--trees-file-icon-color, var(--trees-icon-pink));
269
+ --trees-file-icon-color-svg: var(--trees-file-icon-color, var(--trees-icon-orange));
270
+ --trees-file-icon-color-svelte: var(--trees-file-icon-color, var(--trees-icon-red));
271
+ --trees-file-icon-color-svgo: var(--trees-file-icon-color, var(--trees-icon-green));
272
+ --trees-file-icon-color-swift: var(--trees-file-icon-color, var(--trees-icon-orange));
273
+ --trees-file-icon-color-table: var(--trees-file-icon-color, var(--trees-icon-teal));
274
+ --trees-file-icon-color-text: var(--trees-file-icon-color, var(--trees-icon-gray));
275
+ --trees-file-icon-color-tailwind: var(--trees-file-icon-color, var(--trees-icon-cyan));
276
+ --trees-file-icon-color-terraform: var(--trees-file-icon-color, var(--trees-icon-indigo));
277
+ --trees-file-icon-color-typescript: var(--trees-file-icon-color, var(--trees-icon-blue));
278
+ --trees-file-icon-color-vite: var(--trees-file-icon-color, var(--trees-icon-purple));
279
+ --trees-file-icon-color-vscode: var(--trees-file-icon-color, var(--trees-icon-blue));
280
+ --trees-file-icon-color-vue: var(--trees-file-icon-color, var(--trees-icon-green));
281
+ --trees-file-icon-color-wasm: var(--trees-file-icon-color, var(--trees-icon-indigo));
282
+ --trees-file-icon-color-webpack: var(--trees-file-icon-color, var(--trees-icon-blue));
283
+ --trees-file-icon-color-yml: var(--trees-file-icon-color, var(--trees-icon-red));
284
+ --trees-file-icon-color-zig: var(--trees-file-icon-color, var(--trees-icon-orange));
285
+ --trees-file-icon-color-zip: var(--trees-file-icon-color, var(--trees-icon-orange));
286
+ --trees-level-gap: var(--trees-level-gap-override, calc(8px * var(--trees-density)));
287
+ --trees-item-padding-x: var(--trees-item-padding-x-override, calc(8px * var(--trees-density)));
288
+ --trees-item-margin-x: var(--trees-item-margin-x-override, calc(2px * var(--trees-density)));
289
+ --trees-item-row-gap: var(--trees-item-row-gap-override, calc(6px * var(--trees-density)));
290
+ --trees-icon-width: var(--trees-icon-width-override, 16px);
291
+ --trees-icon-nudge: var(--trees-icon-nudge-override, calc(1px * var(--trees-density)));
292
+ --trees-row-height: var(--trees-item-height, 30px);
293
+ --trees-git-lane-width: var(--trees-git-lane-width-override, 12px);
294
+ --trees-action-lane-width: var(--trees-action-lane-width-override, calc(var(--trees-icon-width) + 2px));
295
+ --trees-context-menu-trigger-inline-offset: calc(var(--trees-padding-inline) + var(--trees-item-padding-x) -
296
+ var(--trees-focus-ring-width));
297
+ --trees-scrollbar-gutter: var(--trees-scrollbar-gutter-override, 6px);
298
+ --trees-padding-inline: var(--trees-padding-inline-override, 16px);
299
+ color-scheme: light dark;
300
+ font-size: var(--trees-font-size);
301
+ color: var(--trees-fg);
302
+ background-color: var(--trees-bg);
303
+ --truncate-marker-background-color: var(--trees-bg);
304
+ --truncate-marker-background-overlay-color: transparent;
305
+ font-family: var(--trees-font-family);
306
+ font-weight: var(--trees-font-weight-regular);
307
+ flex-direction: column;
308
+ display: flex;
309
+ }
310
+
311
+ :host([data-file-tree-virtualized="true"]) {
312
+ height: 100%;
313
+ overflow: hidden;
314
+ }
315
+
316
+ [data-file-tree-virtualized-wrapper="true"], [data-file-tree-virtualized-root="true"] {
317
+ flex-direction: column;
318
+ height: 100%;
319
+ display: flex;
320
+ overflow: hidden;
321
+ }
322
+
323
+ [data-file-tree-virtualized-scroll="true"], [data-file-tree-scrollbar-measure="true"] {
324
+ --trees-scrollbar-thumb-current: transparent;
325
+ scrollbar-gutter: stable;
326
+ overflow-y: auto;
327
+
328
+ &:hover {
329
+ --trees-scrollbar-thumb-current: var(--trees-scrollbar-thumb);
330
+ }
331
+
332
+ &::-webkit-scrollbar {
333
+ width: var(--trees-scrollbar-gutter);
334
+ height: var(--trees-scrollbar-gutter);
335
+ }
336
+
337
+ &::-webkit-scrollbar-track {
338
+ background: none;
339
+ }
340
+
341
+ &::-webkit-scrollbar-thumb {
342
+ background-color: var(--trees-scrollbar-thumb-current);
343
+ border-radius: calc(var(--trees-scrollbar-gutter) / 2);
344
+ background-clip: content-box;
345
+ border: 1px solid #0000;
346
+ }
347
+
348
+ &::-webkit-scrollbar-corner {
349
+ background-color: #0000;
350
+ }
351
+ }
352
+
353
+ [data-file-tree-scrollbar-measure="true"] {
354
+ visibility: hidden;
355
+ pointer-events: none;
356
+ width: 100px;
357
+ height: 100px;
358
+ position: absolute;
359
+ top: 0;
360
+ left: 0;
361
+ }
362
+
363
+ @supports ((-moz-appearance: none)) {
364
+ [data-file-tree-virtualized-scroll="true"], [data-file-tree-scrollbar-measure="true"] {
365
+ scrollbar-width: thin;
366
+ scrollbar-color: var(--trees-scrollbar-thumb-current) transparent;
367
+ }
368
+ }
369
+
370
+ [data-file-tree-virtualized-scroll="true"] {
371
+ min-height: 0;
372
+ padding-inline: max(calc(var(--trees-padding-inline) - var(--trees-item-margin-x)),
373
+ 0px)
374
+ /* NOTE(amadeus): We can assume that all Webkit based browser gutters
375
+ * will align to the value of '--trees-scrollbar-gutter', however if not, then
376
+ * \`--trees-scrollbar-gutter-measured\` should correct it. Mostly we are
377
+ * hoping to avoid SSR alignment jumps if possible. In non-SSR'd environments
378
+ * \`--trees-scrollbar-gutter-measured\` should always be immediately available.
379
+ */
380
+ max(calc(var(--trees-padding-inline) - var(--trees-item-margin-x) -
381
+ var(--trees-scrollbar-gutter-measured, var(--trees-scrollbar-gutter))),
382
+ 0px);
383
+ flex: 1 1 0;
384
+ position: relative;
385
+ overflow-y: auto;
386
+ }
387
+
388
+ @supports ((-moz-appearance: none)) {
389
+ [data-file-tree-virtualized-scroll="true"] {
390
+ padding-inline: max(calc(var(--trees-padding-inline) - var(--trees-item-margin-x)),
391
+ 0px)
392
+ /* NOTE(amadeus): However on Firefox it can vary a little bit, but most
393
+ * likely the majority of cases will default to a 0px width scrollbar lets
394
+ * inherit that first to avoid SSR jumps. In non-SSR'd environments
395
+ * \`--trees-scrollbar-gutter-measured\` should always be immediately available.
396
+ */
397
+ max(calc(var(--trees-padding-inline) - var(--trees-item-margin-x) -
398
+ var(--trees-scrollbar-gutter-measured, 0px)),
399
+ 0px);
400
+ }
401
+ }
402
+
403
+ [data-file-tree-sticky-overlay="true"] {
404
+ z-index: 4;
405
+ pointer-events: none;
406
+ height: 0;
407
+ position: sticky;
408
+ top: 0;
409
+ overflow: visible;
410
+ }
411
+
412
+ [data-file-tree-virtualized-root="true"][data-scroll-at-top="true"]:not([data-overlay-reveal]) [data-file-tree-sticky-overlay="true"] {
413
+ visibility: hidden;
414
+ }
415
+
416
+ [data-file-tree-sticky-overlay-content="true"] {
417
+ background-color: var(--trees-bg);
418
+ pointer-events: none;
419
+ position: relative;
420
+ }
421
+
422
+ [data-file-tree-virtualized-list="true"] {
423
+ background-color: var(--trees-bg);
424
+ overflow-anchor: none;
425
+ width: 100%;
426
+ min-height: 100%;
427
+ position: relative;
428
+
429
+ &[data-is-scrolling] {
430
+ pointer-events: none;
431
+ }
432
+ }
433
+
434
+ [data-file-tree-virtualized-sticky-offset="true"] {
435
+ contain: layout size;
436
+ }
437
+
438
+ [data-file-tree-virtualized-sticky="true"] {
439
+ isolation: isolate;
440
+ will-change: transform;
441
+ flex-direction: column;
442
+ width: 100%;
443
+ display: flex;
444
+ position: sticky;
445
+ top: 0;
446
+ }
447
+
448
+ [data-file-tree-search-container] {
449
+ padding: 0;
450
+ padding-inline: var(--trees-padding-inline);
451
+ margin-bottom: var(--trees-item-row-gap);
452
+ display: flex;
453
+ }
454
+
455
+ [data-file-tree-search-input] {
456
+ --trees-focus-ring-width: 2px;
457
+ font-family: var(--trees-font-family);
458
+ font-size: var(--trees-font-size);
459
+ height: var(--trees-row-height);
460
+ padding-inline: var(--trees-item-padding-x);
461
+ line-height: var(--trees-row-height);
462
+ color: var(--trees-search-fg);
463
+ background-color: var(--trees-search-bg);
464
+ border: 1px solid var(--trees-border-color);
465
+ border-radius: var(--trees-border-radius);
466
+ outline: none;
467
+ flex: 1;
468
+ margin-block: 1px;
469
+
470
+ &::placeholder {
471
+ color: color-mix(in lab,
472
+ var(--trees-search-fg) 65%,
473
+ var(--trees-search-bg));
474
+ }
475
+
476
+ &:focus-visible, &[data-file-tree-search-input-fake-focus="true"] {
477
+ outline: var(--trees-focus-ring-width) solid var(--trees-focus-ring-color);
478
+ outline-offset: var(--trees-focus-ring-offset);
479
+ }
480
+ }
481
+
482
+ [role="tree"] {
483
+ gap: var(--trees-gap-override, 0);
484
+ flex-direction: column;
485
+ display: flex;
486
+ position: relative;
487
+ }
488
+
489
+ [data-type="item"] {
490
+ color: inherit;
491
+ font-family: var(--trees-font-family);
492
+ font-size: var(--trees-font-size);
493
+ text-align: start;
494
+ background-color: var(--trees-bg);
495
+ padding: 0 var(--trees-item-padding-x);
496
+ margin: 0 var(--trees-item-margin-x);
497
+ cursor: pointer;
498
+ user-select: none;
499
+ -webkit-touch-callout: none;
500
+ touch-action: manipulation;
501
+ flex: 0 0 var(--trees-row-height);
502
+ height: var(--trees-row-height);
503
+ line-height: var(--trees-row-height);
504
+ align-items: center;
505
+ gap: var(--trees-item-row-gap);
506
+ border-radius: var(--trees-border-radius);
507
+ --truncate-marker-background-color: var(--trees-bg);
508
+ --truncate-marker-background-overlay-color: transparent;
509
+ --truncate-marker-block-inset: 0px;
510
+ border: none;
511
+ outline: none;
512
+ display: flex;
513
+ position: relative;
514
+
515
+ &:hover, &[data-item-context-hover="true"] {
516
+ background-color: var(--trees-bg-muted);
517
+ --truncate-marker-background-overlay-color: var(--trees-bg-muted);
518
+ }
519
+
520
+ &[data-item-focused="true"], &:focus-visible {
521
+ z-index: 2;
522
+
523
+ & [data-item-flattened-subitems] {
524
+ --truncate-marker-block-inset: var(--trees-focus-ring-width);
525
+ }
526
+
527
+ &:before {
528
+ content: "";
529
+ border-radius: var(--trees-border-radius);
530
+ outline: var(--trees-focus-ring-width) solid
531
+ var(--trees-focus-ring-color);
532
+ outline-offset: var(--trees-focus-ring-offset);
533
+ pointer-events: none;
534
+ display: block;
535
+ position: absolute;
536
+ inset: 0;
537
+ }
538
+
539
+ &[data-item-selected="true"]:before {
540
+ outline-color: var(--trees-selected-focused-border-color);
541
+ }
542
+ }
543
+
544
+ &[data-item-selected="true"] {
545
+ color: var(--trees-selected-fg);
546
+ background-color: var(--trees-selected-bg);
547
+ --truncate-marker-background-overlay-color: var(--trees-selected-bg);
548
+ z-index: 3;
549
+
550
+ & [data-item-section="icon"] {
551
+ color: var(--trees-selected-fg);
552
+ }
553
+ }
554
+
555
+ &[data-item-search-match="true"] {
556
+ font-weight: var(--trees-search-font-weight);
557
+ }
558
+ }
559
+
560
+ [data-type="item"][data-file-tree-sticky-row="true"] {
561
+ pointer-events: auto;
562
+ }
563
+
564
+ [data-file-tree-virtualized-root="true"][data-is-scrolling] [data-type="item"][data-file-tree-sticky-row="true"] {
565
+ pointer-events: none;
566
+ }
567
+
568
+ [data-file-tree-virtualized-root="true"][data-is-scrolling] [data-type="item"][data-file-tree-sticky-row="true"]:hover:not([data-item-selected="true"]), [data-file-tree-virtualized-root="true"][data-is-scrolling] [data-type="item"][data-file-tree-sticky-row="true"][data-item-context-hover="true"]:not([data-item-selected="true"]) {
569
+ background-color: var(--trees-bg);
570
+ --truncate-marker-background-overlay-color: transparent;
571
+ }
572
+
573
+ [data-item-selected="true"]:has( + [data-item-selected="true"]) {
574
+ border-bottom-right-radius: 0;
575
+ border-bottom-left-radius: 0;
576
+ }
577
+
578
+ [data-item-selected="true"] + [data-item-selected="true"] {
579
+ border-top-left-radius: 0;
580
+ border-top-right-radius: 0;
581
+ }
582
+
583
+ [data-item-flattened-subitems] {
584
+ align-items: center;
585
+ gap: 2px;
586
+ display: inline-flex;
587
+ }
588
+
589
+ [data-item-flattened-subitem]:hover, [data-item-flattened-subitem-drag-target="true"] {
590
+ text-decoration: underline;
591
+ }
592
+
593
+ [data-item-section="icon"] {
594
+ color: var(--trees-fg-muted);
595
+ fill: currentColor;
596
+ width: var(--trees-icon-width);
597
+ flex-shrink: 0;
598
+ justify-content: center;
599
+ align-items: center;
600
+ display: flex;
601
+ }
602
+
603
+ :where([data-item-section="icon"] > [data-icon-token]) {
604
+ color: var(--trees-fg-muted);
605
+ }
606
+
607
+ [data-file-tree-colored-icons="true"] {
608
+ & [data-icon-token="astro"] {
609
+ color: var(--trees-file-icon-color-astro);
610
+ }
611
+
612
+ & [data-icon-token="babel"] {
613
+ color: var(--trees-file-icon-color-babel);
614
+ }
615
+
616
+ & [data-icon-token="bash"] {
617
+ color: var(--trees-file-icon-color-bash);
618
+ }
619
+
620
+ & [data-icon-token="biome"] {
621
+ color: var(--trees-file-icon-color-biome);
622
+ }
623
+
624
+ & [data-icon-token="bootstrap"] {
625
+ color: var(--trees-file-icon-color-bootstrap);
626
+ }
627
+
628
+ & [data-icon-token="browserslist"] {
629
+ color: var(--trees-file-icon-color-browserslist);
630
+ }
631
+
632
+ & [data-icon-token="bun"] {
633
+ color: var(--trees-file-icon-color-bun);
634
+ }
635
+
636
+ & [data-icon-token="c"] {
637
+ color: var(--trees-file-icon-color-c);
638
+ }
639
+
640
+ & [data-icon-token="cpp"] {
641
+ color: var(--trees-file-icon-color-cpp);
642
+ }
643
+
644
+ & [data-icon-token="claude"] {
645
+ color: var(--trees-file-icon-color-claude);
646
+ }
647
+
648
+ & [data-icon-token="css"] {
649
+ color: var(--trees-file-icon-color-css);
650
+ }
651
+
652
+ & [data-icon-token="database"] {
653
+ color: var(--trees-file-icon-color-database);
654
+ }
655
+
656
+ & [data-icon-token="default"] {
657
+ color: var(--trees-file-icon-color-default);
658
+ }
659
+
660
+ & [data-icon-token="docker"] {
661
+ color: var(--trees-file-icon-color-docker);
662
+ }
663
+
664
+ & [data-icon-token="eslint"] {
665
+ color: var(--trees-file-icon-color-eslint);
666
+ }
667
+
668
+ & [data-icon-token="git"] {
669
+ color: var(--trees-file-icon-color-git);
670
+ }
671
+
672
+ & [data-icon-token="go"] {
673
+ color: var(--trees-file-icon-color-go);
674
+ }
675
+
676
+ & [data-icon-token="graphql"] {
677
+ color: var(--trees-file-icon-color-graphql);
678
+ }
679
+
680
+ & [data-icon-token="html"] {
681
+ color: var(--trees-file-icon-color-html);
682
+ }
683
+
684
+ & [data-icon-token="image"] {
685
+ color: var(--trees-file-icon-color-image);
686
+ }
687
+
688
+ & [data-icon-token="javascript"] {
689
+ color: var(--trees-file-icon-color-javascript);
690
+ }
691
+
692
+ & [data-icon-token="json"] {
693
+ color: var(--trees-file-icon-color-json);
694
+ }
695
+
696
+ & [data-icon-token="markdown"] {
697
+ color: var(--trees-file-icon-color-markdown);
698
+ }
699
+
700
+ & [data-icon-token="mcp"] {
701
+ color: var(--trees-file-icon-color-mcp);
702
+ }
703
+
704
+ & [data-icon-token="npm"] {
705
+ color: var(--trees-file-icon-color-npm);
706
+ }
707
+
708
+ & [data-icon-token="oxc"] {
709
+ color: var(--trees-file-icon-color-oxc);
710
+ }
711
+
712
+ & [data-icon-token="postcss"] {
713
+ color: var(--trees-file-icon-color-postcss);
714
+ }
715
+
716
+ & [data-icon-token="prettier"] {
717
+ color: var(--trees-file-icon-color-prettier);
718
+ }
719
+
720
+ & [data-icon-token="python"] {
721
+ color: var(--trees-file-icon-color-python);
722
+ }
723
+
724
+ & [data-icon-token="react"] {
725
+ color: var(--trees-file-icon-color-react);
726
+ }
727
+
728
+ & [data-icon-token="ruby"] {
729
+ color: var(--trees-file-icon-color-ruby);
730
+ }
731
+
732
+ & [data-icon-token="rust"] {
733
+ color: var(--trees-file-icon-color-rust);
734
+ }
735
+
736
+ & [data-icon-token="sass"] {
737
+ color: var(--trees-file-icon-color-sass);
738
+ }
739
+
740
+ & [data-icon-token="svg"] {
741
+ color: var(--trees-file-icon-color-svg);
742
+ }
743
+
744
+ & [data-icon-token="svelte"] {
745
+ color: var(--trees-file-icon-color-svelte);
746
+ }
747
+
748
+ & [data-icon-token="svgo"] {
749
+ color: var(--trees-file-icon-color-svgo);
750
+ }
751
+
752
+ & [data-icon-token="swift"] {
753
+ color: var(--trees-file-icon-color-swift);
754
+ }
755
+
756
+ & [data-icon-token="table"] {
757
+ color: var(--trees-file-icon-color-table);
758
+ }
759
+
760
+ & [data-icon-token="text"] {
761
+ color: var(--trees-file-icon-color-text);
762
+ }
763
+
764
+ & [data-icon-token="tailwind"] {
765
+ color: var(--trees-file-icon-color-tailwind);
766
+ }
767
+
768
+ & [data-icon-token="terraform"] {
769
+ color: var(--trees-file-icon-color-terraform);
770
+ }
771
+
772
+ & [data-icon-token="typescript"] {
773
+ color: var(--trees-file-icon-color-typescript);
774
+ }
775
+
776
+ & [data-icon-token="vite"] {
777
+ color: var(--trees-file-icon-color-vite);
778
+ }
779
+
780
+ & [data-icon-token="vscode"] {
781
+ color: var(--trees-file-icon-color-vscode);
782
+ }
783
+
784
+ & [data-icon-token="vue"] {
785
+ color: var(--trees-file-icon-color-vue);
786
+ }
787
+
788
+ & [data-icon-token="wasm"] {
789
+ color: var(--trees-file-icon-color-wasm);
790
+ }
791
+
792
+ & [data-icon-token="webpack"] {
793
+ color: var(--trees-file-icon-color-webpack);
794
+ }
795
+
796
+ & [data-icon-token="yml"] {
797
+ color: var(--trees-file-icon-color-yml);
798
+ }
799
+
800
+ & [data-icon-token="zig"] {
801
+ color: var(--trees-file-icon-color-zig);
802
+ }
803
+
804
+ & [data-icon-token="zip"] {
805
+ color: var(--trees-file-icon-color-zip);
806
+ }
807
+ }
808
+
809
+ [data-icon-name="file-tree-icon-chevron"] {
810
+ &[data-align-capitals="false"] {
811
+ transform: translate(0, var(--trees-icon-nudge));
812
+ }
813
+
814
+ &[data-align-capitals="true"] {
815
+ transform: translate(0);
816
+ }
817
+ }
818
+
819
+ [data-item-section="content"] {
820
+ text-align: start;
821
+ text-overflow: ellipsis;
822
+ flex: 0 auto;
823
+ min-width: 0;
824
+ max-width: 100%;
825
+ overflow: hidden;
826
+ }
827
+
828
+ [data-item-section="decoration"] {
829
+ text-align: end;
830
+ min-width: 0;
831
+ color: var(--trees-fg-muted);
832
+ flex: 1 1 0;
833
+ justify-content: flex-end;
834
+ display: flex;
835
+ overflow: hidden;
836
+ }
837
+
838
+ [data-item-section="decoration"] > span {
839
+ text-overflow: ellipsis;
840
+ white-space: nowrap;
841
+ justify-content: flex-end;
842
+ align-items: center;
843
+ min-width: 0;
844
+ max-width: 100%;
845
+ display: inline-flex;
846
+ overflow: hidden;
847
+ }
848
+
849
+ [data-item-section="git"], [data-item-section="action"] {
850
+ flex: none;
851
+ justify-content: center;
852
+ align-items: center;
853
+ display: flex;
854
+ }
855
+
856
+ [data-item-section="git"] {
857
+ width: var(--trees-git-lane-width);
858
+ }
859
+
860
+ [data-item-section="action"] {
861
+ width: var(--trees-action-lane-width);
862
+ color: var(--trees-fg-muted);
863
+ fill: currentColor;
864
+ pointer-events: none;
865
+ }
866
+
867
+ [data-item-section="git"] > span, [data-item-section="action"] > span {
868
+ justify-content: center;
869
+ align-items: center;
870
+ width: 100%;
871
+ display: inline-flex;
872
+ }
873
+
874
+ [data-item-action-affordance="decorative"] {
875
+ opacity: .85;
876
+ }
877
+
878
+ [data-item-rename-input] {
879
+ appearance: none;
880
+ width: 100%;
881
+ min-width: 0;
882
+ height: calc(var(--trees-row-height) - 4px);
883
+ font-family: inherit;
884
+ font-size: inherit;
885
+ color: inherit;
886
+ box-sizing: border-box;
887
+ background-color: #0000;
888
+ border: 0;
889
+ outline: none;
890
+ padding-inline: 6px;
891
+ }
892
+
893
+ [data-item-section="content"]:has([data-item-rename-input]) ~ [data-item-section="action"], [data-item-section="content"]:has([data-item-rename-input]) ~ [data-item-section="decoration"] {
894
+ display: none;
895
+ }
896
+
897
+ [aria-expanded="false"][data-item-type="folder"] > [data-item-section="icon"] > [data-icon-name="file-tree-icon-chevron"] {
898
+ &[data-align-capitals="true"] {
899
+ transform: rotate(-90deg)
900
+ translate(calc(var(--trees-icon-nudge) / 2),
901
+ calc(var(--trees-icon-nudge) / 2));
902
+ }
903
+
904
+ &[data-align-capitals="false"] {
905
+ transform: rotate(-90deg)
906
+ translate(calc(var(--trees-icon-nudge) / 2 * -1),
907
+ calc(var(--trees-icon-nudge) / 2));
908
+ }
909
+ }
910
+
911
+ [data-item-section="spacing"] {
912
+ height: var(--trees-row-height);
913
+ padding-left: calc(calc(var(--trees-icon-width) / 2) - .5px);
914
+ flex-direction: row;
915
+ justify-content: center;
916
+ align-items: center;
917
+ display: flex;
918
+
919
+ &:empty {
920
+ padding-left: 0;
921
+ }
922
+ }
923
+
924
+ [data-item-section="spacing-item"] {
925
+ border-left: 1px solid var(--trees-indent-guide-bg);
926
+ height: 100%;
927
+ margin-right: calc(var(--trees-level-gap) - 1px);
928
+ opacity: 0;
929
+ transition: opacity .15s;
930
+ display: inline-block;
931
+ transform: translateX(-.25px);
932
+
933
+ & + & {
934
+ margin-left: calc(var(--trees-item-row-gap) + calc(var(--trees-icon-width) / 2) - .5px);
935
+ }
936
+ }
937
+
938
+ :host(:hover) [data-item-section="spacing-item"] {
939
+ opacity: .75;
940
+ }
941
+
942
+ [data-item-contains-git-change="true"] > [data-item-section="git"] {
943
+ color: var(--trees-git-modified-color);
944
+ opacity: .5;
945
+ fill: currentColor;
946
+ }
947
+
948
+ [data-item-git-status] {
949
+ & > :where([data-item-section="icon"]) > :where(:not([data-icon-name="file-tree-icon-chevron"])), & > [data-item-section="content"] {
950
+ color: var(--trees-item-git-status-color);
951
+ }
952
+
953
+ & > [data-item-section="git"] {
954
+ color: var(--trees-item-git-status-color);
955
+ font-weight: var(--trees-font-weight-semibold);
956
+ }
957
+ }
958
+
959
+ [data-item-git-status="added"] {
960
+ --trees-item-git-status-color: var(--trees-git-added-color);
961
+ }
962
+
963
+ [data-item-git-status="deleted"] {
964
+ --trees-item-git-status-color: var(--trees-git-deleted-color);
965
+ }
966
+
967
+ [data-item-git-status="ignored"] {
968
+ --trees-item-git-status-color: var(--trees-git-ignored-color);
969
+
970
+ & > [data-item-section="icon"] {
971
+ opacity: .5;
972
+ }
973
+ }
974
+
975
+ [data-item-section="git"] [data-icon-name="file-tree-icon-dot"] {
976
+ transform: translateY(calc(.65ex - 50%));
977
+ }
978
+
979
+ [data-item-git-status="modified"] {
980
+ --trees-item-git-status-color: var(--trees-git-modified-color);
981
+ }
982
+
983
+ [data-item-git-status="renamed"] {
984
+ --trees-item-git-status-color: var(--trees-git-renamed-color);
985
+ }
986
+
987
+ [data-item-git-status="untracked"] {
988
+ --trees-item-git-status-color: var(--trees-git-untracked-color);
989
+ }
990
+
991
+ [data-item-drag-target="true"] {
992
+ background-color: var(--trees-selected-bg);
993
+ }
994
+
995
+ [data-item-dragging="true"] {
996
+ opacity: .5;
997
+ }
998
+
999
+ [data-item-section="lock"] {
1000
+ color: var(--trees-fg-muted);
1001
+ flex: none;
1002
+ align-items: center;
1003
+ margin-left: auto;
1004
+ display: flex;
1005
+ }
1006
+
1007
+ [data-item-section="lock"] svg {
1008
+ display: block;
1009
+ }
1010
+
1011
+ [data-type="header-slot"] {
1012
+ flex: none;
1013
+ display: block;
1014
+ }
1015
+
1016
+ [data-type="context-menu-wash"] {
1017
+ z-index: 3;
1018
+ touch-action: none;
1019
+ background-color: #0000;
1020
+ position: absolute;
1021
+ inset: 0;
1022
+ }
1023
+
1024
+ [data-type="context-menu-anchor"] {
1025
+ top: 0;
1026
+ right: var(--trees-context-menu-trigger-inline-offset);
1027
+ z-index: 4;
1028
+ align-items: center;
1029
+ display: none;
1030
+ position: absolute;
1031
+
1032
+ &[data-visible="true"] {
1033
+ display: flex;
1034
+ }
1035
+ }
1036
+
1037
+ [data-file-tree-virtualized-root="true"][data-is-scrolling] [data-type="context-menu-anchor"] {
1038
+ display: none;
1039
+ }
1040
+
1041
+ [data-type="context-menu-anchor"] > slot[name="context-menu"] {
1042
+ flex: 0 0 0;
1043
+ width: 0;
1044
+ min-width: 0;
1045
+ display: block;
1046
+ overflow: visible;
1047
+ }
1048
+
1049
+ [data-type="context-menu-trigger"] {
1050
+ all: unset;
1051
+ width: var(--trees-action-lane-width);
1052
+ color: var(--trees-fg-muted);
1053
+ fill: currentColor;
1054
+ cursor: pointer;
1055
+ font-family: var(--trees-font-family);
1056
+ font-size: var(--trees-font-size);
1057
+ border-top-right-radius: var(--trees-border-radius);
1058
+ border-bottom-right-radius: var(--trees-border-radius);
1059
+ margin: var(--trees-focus-ring-width);
1060
+ height: calc(var(--trees-row-height) - var(--trees-focus-ring-width) * 2);
1061
+ border-width: 0;
1062
+ justify-content: center;
1063
+ align-items: center;
1064
+ transition: color .12s;
1065
+ display: flex;
1066
+ }
1067
+
1068
+ [data-type="context-menu-trigger"]:hover, [data-type="context-menu-trigger"][aria-expanded="true"] {
1069
+ color: var(--trees-fg);
1070
+ }
1071
+
1072
+ [data-truncate-container] {
1073
+ --truncate-internal-marker-fade-width: var(--truncate-marker-fade-width, 2px);
1074
+ --truncate-internal-marker-gap: var(--truncate-marker-gap, 0px);
1075
+ --truncate-internal-marker-opacity: var(--truncate-marker-opacity, 50%);
1076
+ --truncate-internal-middle-marker-opacity: var(--truncate-middle-marker-opacity, 80%);
1077
+ --truncate-internal-marker-background-color: var(--truncate-marker-background-color, light-dark(#fff, #000));
1078
+ --truncate-internal-marker-background-overlay-color: var(--truncate-marker-background-overlay-color, transparent);
1079
+ --truncate-internal-marker-block-inset: var(--truncate-marker-block-inset, 0px);
1080
+ --truncate-internal-marker-fade-out-duration: var(--truncate-marker-fade-out-duration, 0s);
1081
+ --truncate-internal-marker-fade-in-duration: var(--truncate-marker-fade-in-duration, .1s);
1082
+ --truncate-internal-fade-marker-color: var(--truncate-fade-marker-color, #000);
1083
+ --truncate-internal-fade-marker-width: var(--truncate-fade-marker-width, .2lh);
1084
+ --truncate-internal-single-line-height: 1lh;
1085
+ height: var(--truncate-internal-single-line-height);
1086
+ min-width: 0;
1087
+ margin-top: -1px;
1088
+ margin-bottom: -1px;
1089
+ overflow: hidden;
1090
+ }
1091
+
1092
+ [data-truncate-marker] {
1093
+ height: var(--truncate-internal-single-line-height);
1094
+ padding-block: var(--truncate-internal-marker-block-inset);
1095
+ box-sizing: border-box;
1096
+ z-index: 2;
1097
+ color: color-mix(in srgb,
1098
+ currentColor var(--truncate-internal-marker-opacity),
1099
+ transparent);
1100
+ opacity: 0;
1101
+ transition: opacity var(--truncate-internal-marker-fade-out-duration)
1102
+ ease-in-out;
1103
+ background-clip: content-box;
1104
+ align-items: center;
1105
+ display: flex;
1106
+ position: absolute;
1107
+ }
1108
+
1109
+ @container measure (height > 1lh) {
1110
+ [data-truncate-marker] {
1111
+ opacity: 1;
1112
+ transition: opacity var(--truncate-internal-marker-fade-in-duration)
1113
+ ease-in-out;
1114
+ }
1115
+ }
1116
+
1117
+ [data-truncate-grid] {
1118
+ display: grid;
1119
+ position: relative;
1120
+ }
1121
+
1122
+ [data-truncate-content="visible"] {
1123
+ white-space: nowrap;
1124
+ }
1125
+
1126
+ [data-truncate-content="overflow"] {
1127
+ opacity: 0;
1128
+ pointer-events: none;
1129
+ user-select: none;
1130
+ word-break: break-all;
1131
+ margin-top: calc(-1 * var(--truncate-internal-single-line-height));
1132
+ }
1133
+
1134
+ [data-truncate-marker-cell] {
1135
+ user-select: none;
1136
+ pointer-events: none;
1137
+ overflow: visible;
1138
+ container: measure / size;
1139
+ }
1140
+
1141
+ [data-truncate-container="truncate"] {
1142
+ & [data-truncate-grid] {
1143
+ grid-template-columns: minmax(0, max-content) 0;
1144
+ }
1145
+
1146
+ & [data-truncate-marker] {
1147
+ right: 0;
1148
+ }
1149
+
1150
+ & [data-truncate-fade] {
1151
+ margin-right: calc(-2 * var(--truncate-internal-fade-marker-width));
1152
+ }
1153
+ }
1154
+
1155
+ [data-truncate-container="fruncate"] {
1156
+ & [data-truncate-grid] {
1157
+ grid-template-columns: 0 minmax(0, max-content) auto;
1158
+ }
1159
+
1160
+ & [data-truncate-content] {
1161
+ direction: rtl;
1162
+ }
1163
+
1164
+ & [data-truncate-content] > span {
1165
+ unicode-bidi: plaintext;
1166
+ }
1167
+
1168
+ & [data-truncate-fade] {
1169
+ margin-left: calc(-2 * var(--truncate-internal-fade-marker-width));
1170
+ }
1171
+ }
1172
+
1173
+ [data-truncate-variant="default"] {
1174
+ & [data-truncate-marker] {
1175
+ background-color: var(--truncate-internal-marker-background-color);
1176
+ background-image: linear-gradient(var(--truncate-internal-marker-background-overlay-color),
1177
+ var(--truncate-internal-marker-background-overlay-color));
1178
+ }
1179
+
1180
+ & [data-truncate-marker]:after, & [data-truncate-marker]:before {
1181
+ content: "";
1182
+ width: calc(var(--truncate-internal-marker-fade-width) +
1183
+ var(--truncate-internal-marker-gap));
1184
+ height: max(0px,
1185
+ calc(var(--truncate-internal-single-line-height) -
1186
+ var(--truncate-internal-marker-block-inset) * 2));
1187
+ background-color: var(--truncate-internal-marker-background-color);
1188
+ background-image: linear-gradient(var(--truncate-internal-marker-background-overlay-color),
1189
+ var(--truncate-internal-marker-background-overlay-color));
1190
+ -webkit-mask-image: linear-gradient(var(--truncate-internal-fade-dir),
1191
+ #000 0%,
1192
+ #000 var(--truncate-internal-marker-gap),
1193
+ transparent 100%);
1194
+ mask-image: linear-gradient(var(--truncate-internal-fade-dir),
1195
+ #000 0%,
1196
+ #000 var(--truncate-internal-marker-gap),
1197
+ transparent 100%);
1198
+ position: absolute;
1199
+ inset-block-start: var(--truncate-internal-marker-block-inset);
1200
+ }
1201
+
1202
+ & [data-truncate-marker]:after {
1203
+ --truncate-internal-fade-dir: to right;
1204
+ right: calc(-1 *
1205
+ (
1206
+ var(--truncate-internal-marker-fade-width) +
1207
+ var(--truncate-internal-marker-gap)
1208
+ ));
1209
+ }
1210
+
1211
+ & [data-truncate-marker]:before {
1212
+ --truncate-internal-fade-dir: to left;
1213
+ left: calc(-1 *
1214
+ (
1215
+ var(--truncate-internal-marker-fade-width) +
1216
+ var(--truncate-internal-marker-gap)
1217
+ ));
1218
+ }
1219
+ }
1220
+
1221
+ [data-truncate-variant="fade"] {
1222
+ & [data-truncate-marker] {
1223
+ background: none;
1224
+ }
1225
+ }
1226
+
1227
+ [data-truncate-fade] {
1228
+ box-shadow: 0 0 calc(var(--truncate-internal-fade-marker-width) / 2)
1229
+ var(--truncate-internal-fade-marker-color),
1230
+ 0 0 var(--truncate-internal-fade-marker-width)
1231
+ var(--truncate-internal-fade-marker-color);
1232
+ width: calc(var(--truncate-internal-fade-marker-width) * 2);
1233
+ height: calc(var(--truncate-internal-single-line-height) -
1234
+ (var(--truncate-internal-fade-marker-width) * 2));
1235
+ margin: var(--truncate-internal-fade-marker-width) 0;
1236
+ }
1237
+
1238
+ [data-truncate-group-container="middle"] {
1239
+ & [data-truncate-container] {
1240
+ --truncate-marker-opacity: var(--truncate-internal-middle-marker-opacity);
1241
+ }
1242
+
1243
+ min-width: 0;
1244
+ display: flex;
1245
+
1246
+ & > div {
1247
+ min-width: 0;
1248
+ }
1249
+
1250
+ & > div[data-truncate-segment-priority="1"] {
1251
+ flex: 0 1 max-content;
1252
+ }
1253
+
1254
+ & > div[data-truncate-segment-priority="2"] {
1255
+ flex: 0 999999 max-content;
1256
+ }
1257
+ }
1258
+ }
1259
+
1260
+ @layer theme, unsafe;
1261
+ `,t_=`@layer base, unsafe;`;function n_(e){return`${t_}
1262
+ @layer base {
1263
+ ${e}
1264
+ }`}function r_(e){return`${t_}
1265
+ @layer unsafe {
1266
+ ${e}
1267
+ }`}var i_=new WeakMap;function a_(e){let t=i_.get(e);if(t!=null)return t;let n=document.createElement(`div`);n.setAttribute(wh,`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(),i_.set(e,i),i}function o_(e,t){if(!e.isConnected)return;let n=a_(t);if(n==null)return;let r=t.querySelector(`style[${Th}]`),i=r instanceof HTMLStyleElement?r:document.createElement(`style`);r instanceof HTMLStyleElement||(i.setAttribute(Th,``),t.appendChild(i)),i.textContent=`:host { ${Eh}: ${n}px; }`}var s_;function c_(e){if(typeof CSSStyleSheet<`u`&&typeof CSSStyleSheet.prototype.replaceSync==`function`&&`adoptedStyleSheets`in e){s_??(s_=new CSSStyleSheet,s_.replaceSync(n_(e_)));let t=!1;try{e.adoptedStyleSheets=[s_],t=!0}catch{}if(t){e.querySelector(`style[${Sh}]`)?.remove();return}}if(e.querySelector(`style[data-file-tree-style]`)==null){let t=document.createElement(`style`);t.setAttribute(Sh,``),t.textContent=n_(e_),e.prepend(t)}}function l_(e,t){u_(e,t),c_(t),o_(e,t)}function u_(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`});l_(this,e)}}if(customElements.define(xh,e),typeof document<`u`)for(let e of Array.from(document.querySelectorAll(xh)))e instanceof HTMLElement&&l_(e,e.shadowRoot??e.attachShadow({mode:`open`}))}var d_=5,f_=32,p_=128;function m_(){return{childIdByNameId:new Map,childIds:[],childPositionById:new Map,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function h_(){return{childIdByNameId:null,childIds:[],childPositionById:null,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function g_(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 __(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 v_(e,t){e.childPositionById!=null&&e.childPositionById.set(t,e.childIds.length),e.childIds.push(t)}function y_(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 b_(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,w_(e,t)}function x_(e,t,n,r){if(e.totalChildSubtreeNodeCount+=n,e.totalChildVisibleSubtreeCount+=r,e.childVisibleChunkSums==null||r===0)return;let i=__(e).get(t);if(i===void 0)return;let a=i>>d_;e.childVisibleChunkSums[a]+=r}function S_(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=T_(e,t,a,i);return{...r,childVisibleIndex:n-r.localVisibleIndex}}i-=o,a+=f_}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 C_(e,t,n){let r=0,i=t.childVisibleChunkSums,a=0;if(i!=null){let e=n>>d_;for(let t=0;t<e;t+=1)r+=i[t]??0;a=e<<d_}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 w_(e,t){if(t.childIds.length<p_){t.childVisibleChunkSums=null;return}let n=Math.ceil(t.childIds.length/f_),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>>d_]+=a.visibleSubtreeCount)}t.childVisibleChunkSums=r}function T_(e,t,n,r){let i=Math.min(t.childIds.length,n+f_),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 E_=7,D_=3,O_=8,k_=4;function A_(e,t,n=0){return e<<k_|n<<D_|t}function j_(e){return e.depthAndFlags>>>k_}function M_(e){return(e.depthAndFlags&O_)>>D_}function Y(e){return(e.depthAndFlags&O_)!==0}function N_(e){return e.depthAndFlags&E_}function P_(e,t){return(N_(e)&t)!==0}function F_(e,t){e.depthAndFlags|=t}function I_(e,t){e.depthAndFlags=A_(t,N_(e),M_(e))}var L_=Symbol(`benchmarkInstrumentation`);function R_(e,t){return t==null||Object.defineProperty(e,L_,{configurable:!0,enumerable:!1,value:t,writable:!1}),e}function z_(e){return e==null?null:e[L_]??null}function X(e,t,n){return e==null?n():e.measurePhase(t,n)}function B_(e,t,n){!Number.isFinite(n)||e==null||e.setCounter(t,n)}function V_(e){return e>=48&&e<=57}function H_(e){let t=[],n=0,r=0;for(;r<e.length;){for(;r<e.length&&!V_(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&&V_(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 U_(e){let t=e.toLowerCase();return{lowerValue:t,tokens:H_(t)}}function W_(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 G_(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=W_(e.tokens,t.tokens);return n===0?e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1:n}function K_(e,t,n){let r=G_(n(e),n(t));return r===0?e===t?0:e<t?-1:1:r}function q_(e,t){return K_(e,t,U_)}function J_(e,t){return t===e.segments.length-1?+!!e.isDirectory:1}function Y_(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=J_(e,r);return a===J_(t,r)?q_(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 X_(e,t){return Y_(e,t)}function Z_(e,t,n){let r=e=>{let t=n.get(e);if(t!=null)return t;let r=U_(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=J_(e,n);return o===J_(t,n)?K_(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 Q_(e,t){let n=e.sortKeyById[t];if(n!==void 0)return n;let r=e.valueById[t],i=U_(r);return e.sortKeyById[t]=i,i}function $_(e={}){return{flattenEmptyDirectories:e.flattenEmptyDirectories!==!1,sort:e.sort??`default`}}function ev(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 tv(e){let{hasTrailingSlash:t,segments:n}=ev(e);return{basename:n[n.length-1]??``,isDirectory:t,path:e,segments:n}}function nv(e){if(e.length===0)return{requiresDirectory:!1,segments:[]};let{hasTrailingSlash:t,segments:n}=ev(e);return{requiresDirectory:t,segments:n}}function rv(){let e=new Map;return e.set(``,0),{idByValue:e,valueById:[``],sortKeyById:[U_(``)]}}function iv(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 av(e,t){let n=e.valueById[t];if(n===void 0)throw Error(`Unknown segment ID: ${String(t)}`);return n}var ov=Symbol(`pathStorePreparedInputKind`);function sv(e,t){return e[ov]=t,e}function cv(e){return{basename:e.basename,depth:e.segments.length,isDirectory:e.isDirectory,path:e.path,segments:e.segments}}function lv(e,t,n){return n==="default"?X_(e,t):n(cv(e),cv(t))}function uv(){return{depthAndFlags:A_(0,3,1),nameId:0,parentId:0,subtreeNodeCount:1,visibleSubtreeCount:1}}function dv(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 fv(e){return e.isDirectory?e.segments.length:e.segments.length-1}function pv(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 mv(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function hv(e,t={}){return xv(e,t).map(e=>e.path)}function gv(e,t={}){let n=xv(e,t);return sv({paths:n.map(e=>e.path),preparedPaths:n},`prepared`)}function _v(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 sv({paths:e,presortedPaths:e,presortedPathsContainDirectories:n},`presorted`)}function vv(e){let t=e,n=t.preparedPaths;if(t[ov]===`prepared`&&n!=null)return n;if(!pv(n))throw Error(`preparedInput must come from PathStore.prepareInput()`);return n}function yv(e){let t=e;return t[ov]===`presorted`&&t.presortedPaths!=null||mv(t.presortedPaths)?t.presortedPaths:null}function bv(e){let t=e;return typeof t.presortedPathsContainDirectories==`boolean`?t.presortedPathsContainDirectories:null}function xv(e,t={}){let n=$_(t),r=z_(t);B_(r,`workload.inputFiles`,e.length);let i=X(r,`store.preparePathEntries.parse`,()=>e.map(e=>tv(e)));return X(r,`store.preparePathEntries.sort`,()=>i.sort((e,t)=>lv(e,t,n.sort))),i}var Sv=class{directories=new Map;directoryStack=[0];presortedDirectoryNodeIds=[];initialExpandedPathSet;createdDirectoriesAllExpanded=!1;createdDirectoryCount=0;lastPreparedPath=null;nodes=[uv()];options;instrumentation;segmentSortKeyCache=new Map;segmentTable=rv();hasDeferredDirectoryIndexes=!1;constructor(e={}){this.instrumentation=z_(e),this.options=$_(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,m_())}appendPaths(e){return X(this.instrumentation,`store.builder.appendPaths.parse`,()=>this.appendPreparedPaths(e.map(e=>tv(e))))}appendPreparedPaths(e,t=!0){return this.createdDirectoriesAllExpanded=!1,X(this.instrumentation,`store.builder.appendPreparedPaths`,()=>{for(let n of e)this.appendPreparedPath(n,t)}),this}appendPresortedPaths(e,t=null){return X(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:A_(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:A_(r,0,1),nameId:u,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),l++,c[l]=d,m=a+1}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:A_(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=tv(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:A_(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:A_(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=tv(t)),this.hasDeferredDirectoryIndexes=!0}finish(e={}){let t=e.skipSubtreeCountPass===!0;return this.hasDeferredDirectoryIndexes?(X(this.instrumentation,`store.builder.buildDirectoryIndexes`,()=>this.buildPresortedFinish(t)),this.hasDeferredDirectoryIndexes=!1):t||X(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"?Z_(this.lastPreparedPath,e,this.segmentSortKeyCache):lv(this.lastPreparedPath,e,this.options.sort))>0)throw Error(`Builder input must be sorted before appendPaths(): "${e.path}"`)}let n=this.lastPreparedPath,r=fv(e),i=n==null?0:fv(n),a=n==null?0:dv(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=iv(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:A_(j_(o)+1,0),nameId:r,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),a?.set(r,s),v_(i,s),s}createFileChildUnchecked(e,t){let n=iv(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:A_(j_(i)+1,0),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),v_(r,a),a}getOrCreateDirectoryChild(e,t){let n=iv(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&&!Y(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:A_(j_(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),v_(r,a),this.directories.set(a,m_()),a}createDirectoryChild(e,t){let n=iv(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:A_(j_(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),v_(r,a),this.directories.set(a,m_()),a}promoteDirectoryToExplicit(e,t){let n=this.nodes[e];if(n===void 0)throw Error(`Unknown directory node ID: ${String(e)}`);if(!Y(n))throw Error(`Path is not a directory: "${t}"`);if(P_(n,1))throw Error(`Duplicate path: "${t}"`);F_(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,h_());let r=-1,i=null;for(let e=1;e<t.length;e++){let a=t[e];if(a==null)continue;if(Y(a)){let t=h_();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;Y(n)&&this.directories.set(t,m_());let r=this.directories.get(n.parentId);r!=null&&(r.childIdByNameId!=null&&r.childIdByNameId.set(n.nameId,t),v_(r,t))}}computeSubtreeCounts(e){let t=this.nodes[e];if(t===void 0)throw Error(`Unknown node ID: ${String(e)}`);if(!Y(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 b_(this.nodes,n),t.subtreeNodeCount=r,t.visibleSubtreeCount=r,r}};function Cv(e,t=`closed`,n=null){let r=Tv(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 wv(){return{affectedAncestorIds:new Set,affectedNodeIds:new Set,events:[]}}function Tv(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 Ev(e,t){return P_(t,2)||e.defaultExpansion===`open`?!0:e.defaultExpansion!==`closed`&&j_(t)<=e.defaultExpansion}function Dv(e,t,n=e.snapshot.nodes[t]){return n==null||!Y(n)?!1:e.directoriesOpenByDefault&&!e.hasCollapsedDirectoryOverrides?!0:e.collapsedDirectoryIds.has(t)?!1:e.expandedDirectoryIds.has(t)?!0:Ev(e,n)}function Ov(e,t,n,r=e.snapshot.nodes[t]){if(r==null||!Y(r))return;let i=Ev(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 kv(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 Av(e,t){return e.directoryLoadInfoById.get(t)?.state??`loaded`}function jv(e,t){let n=kv(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 Mv(e,t){let n=kv(e,t);n.activeAttemptId=null,n.errorMessage=null,n.state=`unloaded`}function Nv(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 Pv(e,t,n){return e.directoryLoadInfoById.get(t)?.activeAttemptId===n}function Fv(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 Iv(e,t){e.directoryLoadInfoById.delete(t)}function Lv(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 Rv(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`add`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function zv(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`remove`,path:e.path,projectionChanged:e.projectionChanged,recursive:e.recursive,visibleCountDelta:null}}function Bv(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,from:e.from,operation:`move`,projectionChanged:e.projectionChanged,to:e.to,visibleCountDelta:null}}function Vv(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`expand`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function Hv(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`collapse`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function Uv(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`mark-directory-unloaded`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function Wv(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 Gv(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 Kv(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 qv(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 Jv(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 Yv(e,t,n){return{...n,visibleCountDelta:oy(e)-t}}function Xv(e,t){let n=oy(e),r=wv();e.transactionStack.push(r);try{t()}catch(t){throw $v(e,r,!1),t}$v(e,r,!0,oy(e)-n)}function Zv(e,t){let n=e.instrumentation;if(n==null){Qv(e,t);return}X(n,`store.events.record`,()=>Qv(e,t))}function Qv(e,t){let n=e.transactionStack[e.transactionStack.length-1]??null;if(n==null){iy(e,t);return}n.events.push(t),ry(n,t)}function $v(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?ny(i,t):X(n,`store.events.batch.merge`,()=>ny(i,t));return}let a=ey(t,r),o=e.instrumentation;if(o==null){iy(e,a);return}X(o,`store.events.batch.commit`,()=>iy(e,a))}function ey(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 ty(e,t){for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n);for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n)}function ny(e,t){for(let n of t.events)e.events.push(n);ty(e,t)}function ry(e,t){for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n);for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n)}function iy(e,t){let n=e.instrumentation;if(n==null){ay(e,t);return}X(n,`store.events.emit`,()=>ay(e,t))}function ay(e,t){e.listeners.get(t.operation)?.forEach(e=>e(t)),e.listeners.get(`*`)?.forEach(e=>e(t))}function oy(e){return e.snapshot.nodes[e.snapshot.rootId]?.visibleSubtreeCount??0}function sy(e,t){if(e.snapshot.options.flattenEmptyDirectories!==!0)return null;let n=e.snapshot.nodes[t];if(n==null||!Y(n)||P_(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||!Y(a)?null:i}function cy(e,t){let n=t;for(;;){let t=sy(e,n);if(t==null)return n;n=t}}function ly(e,t){let n=[t],r=t;for(;;){let t=sy(e,r);if(t==null)return n;n.push(t),r=t}}function uy(e,t){let n=t==null?e.snapshot.rootId:by(e,t);return n==null?[]:Cy(e,n)}function dy(e,t){let n=tv(t),r=n.isDirectory?n.segments:n.segments.slice(0,-1),i=Ry(e,Ly(e,r)),{createdNodeIds:a,directoryId:o}=wy(e,r),s=new Set(a),c=o;if(n.isDirectory){let n=Z(e,o);if(P_(n,1))throw Error(`Path already exists: "${t}"`);F_(n,1),e.pathCacheByNodeId.set(o,{path:t,version:e.pathCacheVersion}),s.add(o)}else c=Ey(e,o,n.basename),s.add(c);_y(e,o);let l=Ry(e,o);return Rv({affectedAncestorIds:yy(e,c),affectedNodeIds:[...s],path:t,projectionChanged:zy(i,l)})}function fy(e,t,n){let r=by(e,t);if(r==null)throw Error(`Path does not exist: "${t}"`);let i=Z(e,r);if(P_(i,2))throw Error(`The root node cannot be removed`);if(Y(i)&&Sy(e,r).childIds.length>0&&n.recursive!==!0)throw Error(`Cannot remove a non-empty directory without recursive: "${t}"`);let a=i.parentId,o=Ry(e,a),s=Fy(e,r);ky(e,a,r,i.nameId),Iy(e,a),_y(e,a);let c=Ry(e,a);return zv({affectedAncestorIds:yy(e,a),affectedNodeIds:s,path:t,projectionChanged:zy(o,c),recursive:n.recursive===!0})}function py(e,t,n,r){let i=by(e,t);if(i==null)throw Error(`Source path does not exist: "${t}"`);let a=Z(e,i);if(P_(a,2))throw Error(`The root node cannot be moved`);let o=r.collision??`error`,s=Ny(e,i,n),c=Ry(e,a.parentId),l=Ry(e,s.parentId),u=av(e.snapshot.segmentTable,a.nameId),d=iv(e.snapshot.segmentTable,s.basename);if(s.parentId===a.parentId&&u===s.basename)return null;if(Y(a)&&Uy(e,i,s.parentId))throw Error(`Cannot move a directory into one of its descendants`);let f=g_(e.snapshot.nodes,Sy(e,s.parentId)).get(d),p=s.existingNodeId??f??null;if(p!=null&&p!==i&&Py(e,p,o,M_(a))===`skip`)return null;let m=a.parentId;ky(e,m,i,a.nameId),a.parentId=s.parentId,a.nameId=d,e.pathCacheByNodeId.delete(i),Hy(e,i),Oy(e,s.parentId,i),Iy(e,m),e.pathCacheVersion++,_y(e,m),s.parentId!==m&&_y(e,s.parentId);let h=Ry(e,m),g=Ry(e,s.parentId);return Bv({affectedAncestorIds:[...new Set([...yy(e,m),...yy(e,s.parentId)])],affectedNodeIds:[i],from:t,projectionChanged:By([c,l],[h,g]),to:gy(e,i)})}function my(e,t){let n=e.pathCacheByNodeId.get(t);return n!=null&&n.version===e.pathCacheVersion?n.path:null}function hy(e,t,n){return e.pathCacheByNodeId.set(t,{path:n,version:e.pathCacheVersion}),n}function gy(e,t){let n=Z(e,t),r=my(e,t);if(r!=null)return r;if(P_(n,2))return hy(e,t,``);let i=gy(e,n.parentId),a=av(e.snapshot.segmentTable,n.nameId),o=i.length===0?a:`${i}${a}`;return hy(e,t,Y(n)?`${o}/`:o)}function _y(e,t){let n=e.instrumentation;if(n==null){Gy(e,t);return}X(n,`store.recomputeCountsUpwardFrom`,()=>Gy(e,t))}function vy(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||!Y(o)){Wy(e,a,o,!0),n.pop();continue}let s=i.get(a);if(s==null||t[1]>=s.childIds.length){Wy(e,a,o,!0),n.pop();continue}let c=s.childIds[t[1]++];n.push([c,0])}}function yy(e,t){let n=[],r=t;for(;r!=null;){let t=Z(e,r);if(n.push(r),r===e.snapshot.rootId)break;r=t.parentId}return n}function by(e,t){if(t.length===0)return e.snapshot.rootId;let n=nv(t);return xy(e,n.segments,n.requiresDirectory)}function xy(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=Sy(e,r),a=g_(e.snapshot.nodes,i).get(t);if(a===void 0)return null;r=a}let i=Z(e,r);return n&&!Y(i)?null:r}function Sy(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 Z(e,t){let n=e.snapshot.nodes[t];if(n===void 0||P_(n,4))throw Error(`Unknown node ID: ${String(t)}`);return n}function Cy(e,t){let n=e.snapshot.nodes[t];if(n===void 0||P_(n,4))return[];if(!Y(n))return[gy(e,t)];if(Sy(e,t).childIds.length===0)return P_(n,1)&&!P_(n,2)?[gy(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||P_(n,4)){i.pop();continue}if(!Y(n)){r.push(gy(e,t.nodeId)),i.pop();continue}let a=Sy(e,t.nodeId);if(a.childIds.length===0){P_(n,1)&&!P_(n,2)&&r.push(gy(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 wy(e,t){let n=[],r=e.snapshot.rootId;for(let i of t){let t=iv(e.snapshot.segmentTable,i),a=Sy(e,r),o=g_(e.snapshot.nodes,a).get(t);if(o!==void 0){if(!Y(Z(e,o)))throw Error(`Cannot create a directory that collides with an existing file: "${i}"`);r=o;continue}r=Ty(e,r,t),n.push(r)}return{createdNodeIds:n,directoryId:r}}function Ty(e,t,n){let r=Z(e,t),i=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:A_(j_(r)+1,0,1),nameId:n,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),e.snapshot.directories.set(i,m_()),Oy(e,t,i),e.collapseNewDirectoriesByDefault&&(e.collapsedDirectoryIds.add(i),e.hasCollapsedDirectoryOverrides=!0),e.activeNodeCount++,i}function Ey(e,t,n){let r=iv(e.snapshot.segmentTable,n),i=Sy(e,t);if(g_(e.snapshot.nodes,i).has(r))throw Error(`Path already exists: "${qy(e,t,n)}"`);let a=Z(e,t),o=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:A_(j_(a)+1,0),nameId:r,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),Oy(e,t,o),e.activeNodeCount++,o}function Dy(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}Ay(e,n,o)<0?i=a:r=a+1}return r}function Oy(e,t,n){let r=Sy(e,t),i=Z(e,n);g_(e.snapshot.nodes,r).set(i.nameId,n),x_(r,n,i.subtreeNodeCount,i.visibleSubtreeCount);let a=Dy(e,r,n);r.childIds.splice(a,0,n),y_(r,a),w_(e.snapshot.nodes,r)}function ky(e,t,n,r){let i=Sy(e,t),a=__(i),o=a.get(n)??-1;g_(e.snapshot.nodes,i).delete(r),a.delete(n);let s=e.snapshot.nodes[n];s!=null&&x_(i,n,-s.subtreeNodeCount,-s.visibleSubtreeCount),o>=0&&(i.childIds.splice(o,1),y_(i,o),w_(e.snapshot.nodes,i))}function Ay(e,t,n){let r=e.snapshot.options.sort;return r==="default"?jy(e,t,n):r(My(e,t),My(e,n))}function jy(e,t,n){let r=Z(e,t),i=Z(e,n),a=Y(r);if(a!==Y(i))return a?-1:1;let o=G_(Q_(e.snapshot.segmentTable,r.nameId),Q_(e.snapshot.segmentTable,i.nameId));if(o!==0)return o;let s=av(e.snapshot.segmentTable,r.nameId),c=av(e.snapshot.segmentTable,i.nameId);return s===c?t<n?-1:1:s<c?-1:1}function My(e,t){let n=Z(e,t),r=gy(e,t),i=Y(n),a=i?r.slice(0,-1):r;return{basename:av(e.snapshot.segmentTable,n.nameId),depth:j_(n),isDirectory:i,path:r,segments:a.length===0?[]:a.split(`/`)}}function Ny(e,t,n){let r=Z(e,t),i=by(e,n);if(i!=null){let t=Z(e,i);if(Y(t))return{basename:av(e.snapshot.segmentTable,r.nameId),existingNodeId:null,parentId:i};let a=nv(n).segments;return{basename:a[a.length-1]??``,existingNodeId:i,parentId:t.parentId}}let a=nv(n),o=a.segments[a.segments.length-1]??``,s=a.segments.slice(0,-1),c=s.length===0?e.snapshot.rootId:xy(e,s,!0);if(c==null)throw Error(`Destination parent does not exist: "${n}"`);return{basename:o,existingNodeId:null,parentId:c}}function Py(e,t,n,r){if(n===`skip`)return`skip`;if(n===`error`)throw Error(`Destination already exists: "${gy(e,t)}"`);let i=Z(e,t);if(M_(i)!==r)throw Error(`replace collision requires the same source and destination kinds`);if(Y(i)&&Sy(e,t).childIds.length>0)throw Error(`replace collision does not support non-empty directories`);let a=i.parentId,o=i.nameId;return Fy(e,t),ky(e,a,t,o),Iy(e,a),_y(e,a),`handled`}function Fy(e,t){let n=[],r=[{nodeId:t,visitedChildren:!1}];for(;r.length>0;){let t=r.pop();if(t==null)break;let i=Z(e,t.nodeId);if(t.visitedChildren||!Y(i)){Y(i)&&e.snapshot.directories.delete(t.nodeId),F_(i,4),e.pathCacheByNodeId.delete(t.nodeId),e.collapsedDirectoryIds.delete(t.nodeId)&&(e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0),e.expandedDirectoryIds.delete(t.nodeId),Iv(e,t.nodeId),e.activeNodeCount--,n.push(t.nodeId);continue}r.push({nodeId:t.nodeId,visitedChildren:!0});let a=Sy(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 Iy(e,t){let n=t;for(;n!=null;){let t=Z(e,n);if(!Y(t)||P_(t,2)||Sy(e,n).childIds.length>0)return;F_(t,1),n=t.parentId===n?null:t.parentId}}function Ly(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=g_(e.snapshot.nodes,Sy(e,n)).get(t);if(i==null||!Y(Z(e,i)))break;n=i}return n}function Ry(e,t){let n=Vy(e,t);if(n==null)return null;let r=cy(e,n),i=Z(e,r),a=n===r?null:ly(e,n).map(t=>gy(e,t));return JSON.stringify({flattenedSegmentPaths:a,hasChildren:Sy(e,r).childIds.length>0,path:gy(e,r),terminalKind:M_(i)})}function zy(e,t){return By([e],[t])}function By(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 Vy(e,t){let n=t;for(;n!=null;){let t=Z(e,n);if(!Y(t)||P_(t,2))return null;if(!Dv(e,n,t))return n;n=t.parentId}return null}function Hy(e,t){let n=Z(e,t);if(I_(n,(t===e.snapshot.rootId?-1:j_(Z(e,n.parentId)))+1),!Y(n))return;let r=Sy(e,t);for(let t of r.childIds)Hy(e,t)}function Uy(e,t,n){let r=n;for(;r!=null;){if(r===t)return!0;let n=Z(e,r);if(r===e.snapshot.rootId)return!1;r=n.parentId}return!1}function Wy(e,t,n=Z(e,t),r=!1){let i=e.instrumentation;if(i==null){Ky(e,t,n,r);return}X(i,`store.recomputeNodeCounts`,()=>Ky(e,t,n,r))}function Gy(e,t){let n=t;for(;n!=null;){let t=Z(e,n),r=t.subtreeNodeCount,i=t.visibleSubtreeCount;if(Wy(e,n,t),n===e.snapshot.rootId)return;let a=t.subtreeNodeCount-r,o=t.visibleSubtreeCount-i,s=t.parentId;(a!==0||o!==0)&&x_(Sy(e,s),n,a,o),n=s}}function Ky(e,t,n,r){if(!Y(n)){n.subtreeNodeCount=1,n.visibleSubtreeCount=1;return}let i=Sy(e,t);if(r){let t=e.instrumentation;t==null?b_(e.snapshot.nodes,i):X(t,`store.recomputeNodeCounts.rebuildChildAggregates`,()=>b_(e.snapshot.nodes,i))}let a=1+i.totalChildSubtreeNodeCount,o=i.totalChildVisibleSubtreeCount;if(n.subtreeNodeCount=a,P_(n,2)){n.visibleSubtreeCount=o;return}n.visibleSubtreeCount=sy(e,t)==null?Dv(e,t,n)?1+o:1:o}function qy(e,t,n){let r=gy(e,t);return r.length===0?n:`${r}${n}`}function Jy(e){return e!=null&&!P_(e,4)}function Yy(e,t){let n=e.snapshot.nodes[t];return!Jy(n)||!Y(n)||P_(n,2)?null:n}function Xy(e){let t=0;for(let[n,r]of e.pathCacheByNodeId)r.version===e.pathCacheVersion&&Jy(e.snapshot.nodes[n])&&(t+=1);return t}function Zy(e){return Math.max(0,e.valueById.length-1)}function Qy(e){return{activeNodeCount:e.activeNodeCount,cachedPathEntryCount:Xy(e),loadInfoEntryCount:e.directoryLoadInfoById.size,segmentCount:Zy(e.snapshot.segmentTable),totalNodeSlotCount:Math.max(0,e.snapshot.nodes.length-1)}}function $y(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 eb(e){let t=[],n=[];for(let n of e.collapsedDirectoryIds)Yy(e,n)!=null&&t.push(gy(e,n));for(let t of e.expandedDirectoryIds)Yy(e,t)!=null&&n.push(gy(e,t));return{collapsedPaths:t,expandedPaths:n}}function tb(e){let t=[];for(let[n,r]of e.directoryLoadInfoById)Yy(e,n)!=null&&Av(e,n)!==`loaded`&&t.push({info:{activeAttemptId:null,errorMessage:r.errorMessage,nextAttemptId:r.nextAttemptId,state:r.state},path:gy(e,n)});return t}function nb(e,t){e.collapsedDirectoryIds.clear(),e.hasCollapsedDirectoryOverrides=!1,e.expandedDirectoryIds.clear();for(let n of t.expandedPaths){let t=by(e,n);t!=null&&Ov(e,t,!0,Z(e,t))}for(let n of t.collapsedPaths){let t=by(e,n);t!=null&&Ov(e,t,!1,Z(e,t))}}function rb(e,t){e.directoryLoadInfoById.clear();for(let n of t){let t=by(e,n.path);t!=null&&Yy(e,t)!=null&&e.directoryLoadInfoById.set(t,{activeAttemptId:null,errorMessage:n.info.errorMessage,nextAttemptId:n.info.nextAttemptId,state:n.info.state})}}function ib(e){e.pathCacheVersion+=1,e.pathCacheByNodeId.clear(),e.pathCacheByNodeId.set(e.snapshot.rootId,{path:``,version:e.pathCacheVersion})}function ab(e){let t=e.snapshot.segmentTable,n=rv();for(let r of e.snapshot.nodes)if(Jy(r)){if(P_(r,2)){r.nameId=0;continue}r.nameId=iv(n,av(t,r.nameId))}e.snapshot.segmentTable=n}function ob(e){for(let[t,n]of e.snapshot.directories){let r=e.snapshot.nodes[t];if(!Jy(r)||!Y(r)){e.snapshot.directories.delete(t);continue}let i=n.childIds.filter(n=>{let r=e.snapshot.nodes[n];return Jy(r)&&r.parentId===t});n.childIds=i,n.childIdByNameId=new Map(i.map(t=>[Z(e,t).nameId,t])),n.childPositionById=new Map(i.map((e,t)=>[e,t])),b_(e.snapshot.nodes,n)}}function sb(e){let t=e.snapshot.nodes.length-1;for(;t>e.snapshot.rootId;){let n=e.snapshot.nodes[t];if(Jy(n))break;--t}e.snapshot.nodes.length=t+1}function cb(e){let t=eb(e),n=tb(e);X(e.instrumentation,`store.cleanup.stable.clearPathCaches`,()=>ib(e)),X(e.instrumentation,`store.cleanup.stable.rebuildSegmentTable`,()=>ab(e)),X(e.instrumentation,`store.cleanup.stable.rebuildDirectoryIndexes`,()=>ob(e)),X(e.instrumentation,`store.cleanup.stable.trimTrailingRemovedNodeSlots`,()=>sb(e)),X(e.instrumentation,`store.cleanup.stable.restoreExpansionOverrides`,()=>nb(e,t)),X(e.instrumentation,`store.cleanup.stable.restoreDirectoryLoadInfos`,()=>rb(e,n)),X(e.instrumentation,`store.cleanup.stable.recomputeCounts`,()=>vy(e,e.snapshot.rootId))}function lb(e){let t=eb(e),n=tb(e),r=X(e.instrumentation,`store.cleanup.aggressive.listPaths`,()=>uy(e)),i=R_({...e.snapshot.options},e.instrumentation),a=X(e.instrumentation,`store.cleanup.aggressive.rebuildSnapshot`,()=>{let e=new Sv(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,X(e.instrumentation,`store.cleanup.aggressive.restoreExpansionOverrides`,()=>nb(e,t)),X(e.instrumentation,`store.cleanup.aggressive.restoreDirectoryLoadInfos`,()=>rb(e,n)),X(e.instrumentation,`store.cleanup.aggressive.recomputeCounts`,()=>vy(e,e.snapshot.rootId))}function ub(e){for(let t of e.directoryLoadInfoById.values())if(t.state===`loading`&&t.activeAttemptId!=null)return!0;return!1}function db(e,t){let n=Qy(e);t===`stable`?X(e.instrumentation,`store.cleanup.stable`,()=>cb(e)):X(e.instrumentation,`store.cleanup.aggressive`,()=>lb(e));let r=Qy(e);return $y(t,t===`stable`,n,r)}var fb=64;function pb(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 mb(e){return Z(e,e.snapshot.rootId).visibleSubtreeCount}function hb(e,t,n,r){let i=Z(e,t.terminalNodeId),a=Math.max(1,i.visibleSubtreeCount);return Math.min(r-1,n+a-1)}function gb(e,t,n,r){return{ancestorPaths:r,index:t.index,posInSet:t.posInSet,row:Fb(e,t.cursor),setSize:t.setSize,subtreeEndIndex:hb(e,t.cursor,t.index,n)}}function _b(e,t,n,r,i,a){let o=Sy(e,t),{childIndex:s,childVisibleIndex:c,localVisibleIndex:l}=S_(e.snapshot.nodes,o,n),u=o.childIds[s];if(u==null)throw Error(`Visible index ${String(n)} is out of range`);return vb(e,u,l,r+c,i+1,s,o.childIds.length,a)}function vb(e,t,n,r,i,a,o,s){if(!Y(Z(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=kb(e,t,i);if(n===0)return{ancestors:s,cursor:c,index:r,posInSet:a,setSize:o};let l=Z(e,c.terminalNodeId);if(!Y(l)||!Dv(e,c.terminalNodeId,l))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return _b(e,c.terminalNodeId,n-1,r+1,c.visibleDepth,[...s,{cursor:c,index:r,posInSet:a,setSize:o}])}function yb(e,t){let n=mb(e);if(t<0||t>=n)return null;let r=_b(e,e.snapshot.rootId,t,0,-1,[]),i=r.ancestors.map(t=>gy(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=gb(e,a,n,[...i]);t.push(r),i.push(r.row.path)}return a=t,a},index:r.index,posInSet:r.posInSet,row:Fb(e,r.cursor),setSize:r.setSize,subtreeEndIndex:hb(e,r.cursor,r.index,n)}}function bb(e,t,n){let r=e.instrumentation,i=mb(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 Pb(e,o+1);let t=[],n=Eb(e,a);for(let r=a;r<=o&&n!=null;r++){let r=Fb(e,n);t.push(r),n=jb(e,n)}return t}let s=[],c=0,l=0,u=X(r,`store.getVisibleSlice.selectFirstRow`,()=>Eb(e,a));for(let t=a;t<=o&&u!=null;t++){let t=X(r,`store.getVisibleSlice.materializeRow`,()=>Fb(e,u));s.push(t),t.isFlattened&&(c++,l+=t.flattenedSegments?.length??0),u=X(r,`store.getVisibleSlice.advanceCursor`,()=>jb(e,u))}return B_(r,`workload.visibleRowsRead`,s.length),B_(r,`workload.flattenedRowsRead`,c),B_(r,`workload.flattenedSegmentsRead`,l),s}function xb(e,t=mb(e)){let n=e.instrumentation;return n==null?Nb(e,t):X(n,`store.getVisibleTreeProjection`,()=>Nb(e,t))}function Sb(e){return Mb(xb(e))}function Cb(e,t){let n=by(e,t);if(n==null||n===e.snapshot.rootId||Y(Z(e,n))&&cy(e,n)!==n)return null;let r=0,i=n,{nodes:a,rootId:o}=e.snapshot;for(;i!==o;){let t=Z(e,i).parentId,n=Sy(e,t),s=__(n).get(i);if(s==null)throw Error(`Child ${String(i)} was not found in its parent index`);if(r+=C_(a,n,s),t!==o){let n=Z(e,t),a=sy(e,t);if(!Dv(e,t,n)&&a!==i)return null;cy(e,t)===t&&(r+=1)}i=t}return r}function wb(e,t){let n=by(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=Z(e,n);if(!Y(r))throw Error(`Path is not a directory: "${t}"`);return Dv(e,n,r)?null:(Ov(e,n,!0,r),_y(e,n),Vv({affectedAncestorIds:yy(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0}))}function Tb(e,t){let n=by(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=Z(e,n);if(!Y(r))throw Error(`Path is not a directory: "${t}"`);return Dv(e,n,r)?(Ov(e,n,!1,r),_y(e,n),Hv({affectedAncestorIds:yy(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0})):null}function Eb(e,t){return t<0||t>=mb(e)?null:Db(e,e.snapshot.rootId,t,-1)}function Db(e,t,n,r){let i=Sy(e,t),a=e.instrumentation,{childIndex:o,localVisibleIndex:s}=a==null?S_(e.snapshot.nodes,i,n):X(a,`store.getVisibleSlice.selectChildIndex`,()=>S_(e.snapshot.nodes,i,n)),c=i.childIds[o];if(c!=null)return Ob(e,c,s,r+1);throw Error(`Visible index ${String(n)} is out of range`)}function Ob(e,t,n,r){if(!Y(Z(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=kb(e,t,r);if(n===0)return i;let a=Z(e,i.terminalNodeId);if(!Y(a)||!Dv(e,i.terminalNodeId,a))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return Db(e,i.terminalNodeId,n-1,i.visibleDepth)}function kb(e,t,n){return Y(Z(e,t))?e.instrumentation==null?{headNodeId:t,terminalNodeId:cy(e,t),visibleDepth:n}:{headNodeId:t,terminalNodeId:X(e.instrumentation,`store.getVisibleSlice.flatten.resolveTerminalDirectory`,()=>cy(e,t)),visibleDepth:n}:{headNodeId:t,terminalNodeId:t,visibleDepth:n}}function Ab(e,t){let n=Z(e,t);if(!Y(n))return!0;let r=n.parentId;return r===e.snapshot.rootId||sy(e,r)!==t}function jb(e,t){let n=Z(e,t.terminalNodeId);if(Y(n)){let r=Sy(e,t.terminalNodeId);if(Dv(e,t.terminalNodeId,n)&&r.childIds.length>0){let n=r.childIds[0];return n==null?null:Ob(e,n,0,t.visibleDepth+1)}}let r=t.terminalNodeId,i=t.visibleDepth;for(;;){let t=Z(e,r);if(r===e.snapshot.rootId)return null;let n=t.parentId,a=Sy(e,n),o=__(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 Ob(e,s,0,i);Ab(e,r)&&i--,r=n}}function Mb(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 Nb(e,t){let n=Array(t),r=new Int32Array(t),i=new Int32Array(t),a=new Int32Array(t),o=new Int32Array(fb);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=pb(o,y);let x,S=_;if(Y(v))S=f?cy(e,_):_,x=S===_?`${b}${h[v.nameId]}/`:gy(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&&Y(C)&&Dv(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 Pb(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(!Y(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:gy(e,f)};continue}let h=l?cy(e,f):f,g={headNodeId:f,terminalNodeId:h,visibleDepth:m};n[r++]=Fb(e,g);let _=i[h];_!=null&&Y(_)&&Dv(e,h,_)&&s.push([a.get(h),0,m])}return r<t&&(n.length=r),n}function Fb(e,t){let n=Z(e,t.terminalNodeId),r=Y(n)?Ib(e,t):null,i=gy(e,t.terminalNodeId),a=av(e.snapshot.segmentTable,n.nameId),o=Y(n)&&Sy(e,t.terminalNodeId).childIds.length>0,s=t.headNodeId!==t.terminalNodeId,c=e.instrumentation,l=s?c==null?ly(e,t.headNodeId).map(n=>{let r=Z(e,n);return{isTerminal:n===t.terminalNodeId,name:av(e.snapshot.segmentTable,r.nameId),nodeId:n,path:gy(e,n)}}):X(c,`store.getVisibleSlice.flatten.collectSegments`,()=>ly(e,t.headNodeId).map(n=>{let r=Z(e,n);return{isTerminal:n===t.terminalNodeId,name:av(e.snapshot.segmentTable,r.nameId),nodeId:n,path:gy(e,n)}})):void 0;return{depth:t.visibleDepth,flattenedSegments:l,hasChildren:o,id:t.terminalNodeId,isExpanded:Y(n)&&Dv(e,t.terminalNodeId,n),isFlattened:s,isLoading:r===`loading`,kind:Y(n)?`directory`:`file`,loadState:r==null||r===`loaded`?void 0:r,name:a,path:i}}function Ib(e,t){if(t.headNodeId===t.terminalNodeId)return Av(e,t.terminalNodeId);let n=ly(e,t.headNodeId),r=!1,i=!1;for(let t of n){let n=Av(e,t);if(n===`loading`)return`loading`;if(n===`error`){i=!0;continue}n===`unloaded`&&(r=!0)}return i?`error`:r?`unloaded`:`loaded`}var Lb=8;function Rb(e){let{nodes:t,directories:n,rootId:r,options:i}=e,a=t.length,o=new Int32Array(a),s=new Int32Array(a),c=new Int32Array(a),l=new Int32Array(a),u=new Int32Array(a),d=new Int32Array(a),f=new Int32Array(a);for(let e=0;e<a;e+=1){let n=t[e];n!=null&&(o[e]=n.parentId,s[e]=n.nameId,c[e]=n.depthAndFlags,l[e]=n.subtreeNodeCount,u[e]=n.visibleSubtreeCount)}let p=0;for(let e of n.values())p+=e.childIds.length;let m=new Int32Array(p),h=0;for(let[e,t]of n){let n=t.childIds;d[e]=h,f[e]=n.length;for(let e=0;e<n.length;e+=1)m[h]=n[e],h+=1}return{nodeCount:a,rootId:r,flattenEmptyDirectories:i.flattenEmptyDirectories===!0,parentId:o,nameId:s,depthAndFlags:c,subtreeNodeCount:l,visibleSubtreeCount:u,childStart:d,childCount:f,childIdsFlat:m}}function zb(e){let{nodeCount:t,rootId:n,flattenEmptyDirectories:r,depthAndFlags:i,subtreeNodeCount:a,visibleSubtreeCount:o,childStart:s,childCount:c,childIdsFlat:l}=e;for(let e=t-1;e>=1;--e){if((i[e]&Lb)===0)continue;let t=s[e],n=c[e],u=0,d=0;for(let e=0;e<n;e+=1){let n=l[t+e];u+=a[n],d+=o[n]}a[e]=1+u;let f;f=r&&n===1?(i[l[t]]&Lb)===0?1+d:d:1+d,o[e]=f}let u=s[n],d=c[n],f=0,p=0;for(let e=0;e<d;e+=1){let t=l[u+e];f+=a[t],p+=o[t]}a[n]=1+f,o[n]=p}function Bb(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||!Y(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&&w_(n,i),r.subtreeNodeCount=1+c;let u;if(o&&s===1){let e=n[a[0]];u=e!=null&&Y(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,w_(n,l),c.subtreeNodeCount=1+d,c.visibleSubtreeCount=f}function Vb(e){let{directories:t,nodes:n,rootId:r}=e.snapshot,i=Rb(e.snapshot);zb(i);let a=i.subtreeNodeCount,o=i.visibleSubtreeCount;for(let e=0;e<n.length;e+=1){let t=n[e];t!=null&&(t.subtreeNodeCount=a[e],t.visibleSubtreeCount=o[e])}for(let[e,i]of t){let t=i.childIds,a=t.length,o=0,s=0;for(let e=0;e<a;e++){let r=t[e];if(r==null)continue;let i=n[r];o+=i.subtreeNodeCount,s+=i.visibleSubtreeCount}i.totalChildSubtreeNodeCount=o,i.totalChildVisibleSubtreeCount=s,(e===r||a>=128)&&w_(n,i)}}function Hb(e){return e.initialExpansion===`open`&&(e.initialExpandedPaths==null||e.initialExpandedPaths.length===0)}var Ub=class e{#e;constructor(e={}){let t=z_(e),n=X(t,`store.builder.create`,()=>new Sv(e));if(e.preparedInput!=null){let t=yv(e.preparedInput);t==null?n.appendPreparedPaths(vv(e.preparedInput),!1):n.appendPresortedPaths(t,bv(e.preparedInput))}else{let r=e.paths??[];e.presorted===!0?n.appendPaths(r):n.appendPreparedPaths(X(t,`store.preparePathEntries`,()=>xv(r,e)))}let r=X(t,`store.builder.finish`,()=>n.finish({skipSubtreeCountPass:!0})),i=X(t,`store.state.detectAllDirectoriesExpanded`,()=>(e.initialExpansion??`closed`)===`closed`&&n.didMatchAllInitialExpandedPaths());this.#e=X(t,`store.state.create`,()=>Cv(r,i?`open`:e.initialExpansion??`closed`,t)),i&&(this.#e.collapseNewDirectoriesByDefault=!0);let a=i?this.#e.snapshot.directories.size-1:X(t,`store.state.initializeExpandedPaths`,()=>this.initializeExpandedPaths(e.initialExpandedPaths));i||Hb(e)||(e.initialExpansion??`closed`)===`closed`&&a===this.#e.snapshot.directories.size-1||(e.initialExpandedPaths?.length??0)>0&&X(t,`store.state.checkAllDirectoriesExpanded`,()=>this.hasAllDirectoriesExpanded())?e.useSoaCountSweep===!0?X(t,`store.state.initializeOpenVisibleCountsViaSoa`,()=>Vb(this.#e)):X(t,`store.state.initializeOpenVisibleCounts`,()=>Bb(this.#e)):X(t,`store.state.recomputeCounts`,()=>vy(this.#e,this.#e.snapshot.rootId))}static preparePaths(e,t={}){return hv(e,t)}static prepareInput(e,t={}){return gv(e,t)}static preparePresortedInput(e){return _v(e)}list(e){return X(this.#e.instrumentation,`store.list`,()=>uy(this.#e,e))}add(e){X(this.#e.instrumentation,`store.add`,()=>{let t=mb(this.#e);Zv(this.#e,Yv(this.#e,t,dy(this.#e,e)))})}remove(e,t={}){X(this.#e.instrumentation,`store.remove`,()=>{let n=mb(this.#e);Zv(this.#e,Yv(this.#e,n,fy(this.#e,e,t)))})}move(e,t,n={}){X(this.#e.instrumentation,`store.move`,()=>{let r=mb(this.#e),i=py(this.#e,e,t,n);i!=null&&Zv(this.#e,Yv(this.#e,r,i))})}batch(e){Xv(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})}})}getVisibleCount(){return X(this.#e.instrumentation,`store.getVisibleCount`,()=>mb(this.#e))}getVisibleSlice(e,t){return X(this.#e.instrumentation,`store.getVisibleSlice`,()=>bb(this.#e,e,t))}getVisibleRowContext(e){return X(this.#e.instrumentation,`store.getVisibleRowContext`,()=>yb(this.#e,e))}getVisibleTreeProjection(){return Sb(this.#e)}getVisibleTreeProjectionData(e){return xb(this.#e,e)}getVisibleIndex(e){return X(this.#e.instrumentation,`store.getVisibleIndex`,()=>Cb(this.#e,e))}getPathInfo(e){return X(this.#e.instrumentation,`store.getPathInfo`,()=>{let t=by(this.#e,e);if(t==null)return null;let n=Z(this.#e,t);return{depth:j_(n),kind:Y(n)?`directory`:`file`,path:gy(this.#e,t)}})}isExpanded(e){return X(this.#e.instrumentation,`store.isExpanded`,()=>{let t=this.requireDirectoryNodeId(e),n=Z(this.#e,t);return Dv(this.#e,t,n)})}expand(e){X(this.#e.instrumentation,`store.expand`,()=>{let t=mb(this.#e),n=wb(this.#e,e);n!=null&&Zv(this.#e,Yv(this.#e,t,n))})}collapse(e){X(this.#e.instrumentation,`store.collapse`,()=>{let t=mb(this.#e),n=Tb(this.#e,e);n!=null&&Zv(this.#e,Yv(this.#e,t,n))})}on(e,t){return Lv(this.#e,e,t)}getDirectoryLoadState(e){let t=this.requireDirectoryNodeId(e);return Av(this.#e,t)}markDirectoryUnloaded(e){X(this.#e.instrumentation,`store.markDirectoryUnloaded`,()=>{let t=this.requireDirectoryNodeId(e);if(Sy(this.#e,t).childIds.length>0)throw Error(`Cannot mark a directory with known children as unloaded: "${e}"`);let n=mb(this.#e);Mv(this.#e,t),Zv(this.#e,Yv(this.#e,n,Uv({affectedAncestorIds:yy(this.#e,t),affectedNodeIds:[t],path:e,projectionChanged:this.isDirectoryProjectionVisible(t)})))})}beginChildLoad(e){return X(this.#e.instrumentation,`store.beginChildLoad`,()=>{let t=this.requireDirectoryNodeId(e),n=mb(this.#e),r=jv(this.#e,t);return Zv(this.#e,Yv(this.#e,n,Wv({affectedAncestorIds:yy(this.#e,t),affectedNodeIds:[t],attemptId:r.attemptId,path:e,projectionChanged:this.isDirectoryProjectionVisible(t),reused:r.reused}))),r})}applyChildPatch(e,t){return X(this.#e.instrumentation,`store.applyChildPatch`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null||Av(this.#e,n)!==`loading`||!Pv(this.#e,n,e.attemptId))return!1;let r=gy(this.#e,n);this.validateChildPatch(r,t);let i=mb(this.#e),a=[];for(let e of t.operations){Wb(r,e);let t=mb(this.#e);switch(e.type){case`add`:a.push(Yv(this.#e,t,dy(this.#e,e.path)));break;case`remove`:a.push(Yv(this.#e,t,fy(this.#e,e.path,{recursive:e.recursive})));break;case`move`:{let n=py(this.#e,e.from,e.to,{collision:e.collision});n!=null&&a.push(Yv(this.#e,t,n));break}}}let o=a.some(e=>e.projectionChanged)||this.isDirectoryProjectionVisible(n);return Zv(this.#e,Yv(this.#e,i,Gv({affectedAncestorIds:yy(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,childEvents:a,path:gy(this.#e,n),projectionChanged:o}))),!0})}completeChildLoad(e){return X(this.#e.instrumentation,`store.completeChildLoad`,()=>{let t=this.resolveActiveDirectoryNodeId(e.nodeId);if(t==null)return!1;let n=mb(this.#e),r=Nv(this.#e,t,e.attemptId);return Zv(this.#e,Yv(this.#e,n,Kv({affectedAncestorIds:yy(this.#e,t),affectedNodeIds:[t],attemptId:e.attemptId,path:gy(this.#e,t),projectionChanged:this.isDirectoryProjectionVisible(t),stale:!r}))),r})}failChildLoad(e,t){return X(this.#e.instrumentation,`store.failChildLoad`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null)return!1;let r=mb(this.#e),i=Fv(this.#e,n,e.attemptId,t);return Zv(this.#e,Yv(this.#e,r,qv({affectedAncestorIds:yy(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,errorMessage:t,path:gy(this.#e,n),projectionChanged:this.isDirectoryProjectionVisible(n),stale:!i}))),i})}cleanup(e={}){return X(this.#e.instrumentation,`store.cleanup`,()=>{if(this.#e.transactionStack.length>0)throw Error(`Cleanup cannot run during an open batch or transaction.`);if(ub(this.#e))throw Error(`Cleanup cannot run while directory loads are active.`);let t=mb(this.#e),n=db(this.#e,e.mode??`stable`);return Zv(this.#e,Yv(this.#e,t,Jv({...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=Sy(this.#e,p).childIds,_=m===d?n[m]??0:0,v=_,y,b=l.get(a)??U_(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=G_(Q_(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(!Y(Z(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=Z(this.#e,n);Dv(this.#e,n,i)||(Ov(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=Z(this.#e,e);if(!Dv(this.#e,e,t))return!1}return!0}requireDirectoryNodeId(e){let t=by(this.#e,e);if(t==null)throw Error(`Path does not exist: "${e}"`);if(!Y(Z(this.#e,t)))throw Error(`Path is not a directory: "${e}"`);return t}resolveActiveDirectoryNodeId(e){try{if(!Y(Z(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=Z(this.#e,t).parentId;if(e!==this.#e.snapshot.rootId){let n=Z(this.#e,e),r=sy(this.#e,e);if(!Dv(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 Wb(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}"`)}}var Gb=e=>e.startsWith(`f::`)?e.slice(3):e;function Kb(e){let t=e.lastIndexOf(`/`);return t<0?{parentPath:``,baseName:e}:{parentPath:e.slice(0,t),baseName:e.slice(t+1)}}function qb(e,t){return e===``?t:`${e}/${t}`}function Jb({files:e,path:t,isFolder:n,nextBasename:r}){let i=Gb(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}=Kb(i);if(a===s)return{nextFiles:e,sourcePath:i,destinationPath:i,isFolder:n};let c=qb(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 Yb(e){return e.endsWith(`/`)}function Xb(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 Zb(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 Qb(e,t){return t.includes(e)?Zb(t):[e]}function $b(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 ex(e,t){return{draggedPaths:e,target:t}}function tx(e,t){if(t.kind!==`directory`||t.directoryPath==null)return!1;for(let n of e)if(Yb(n)&&(t.directoryPath===n||t.directoryPath.startsWith(n)))return!0;return!1}function nx(e,t){return t.kind===`root`||t.directoryPath==null?Xb(e):t.directoryPath}function rx(e,t){let n=e.map(e=>{let n=nx(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 ix(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 ax(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(!ix(Ub.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 ox(e){return e.operation===`add`||e.operation===`remove`||e.operation===`move`||e.operation===`batch`}function sx(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 cx(e,t){if(e===t)return!0;let n=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(n)}function lx(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 cx(e,t.path)?n?e:null:e;case`move`:return sx(e,t.from,t.to);case`batch`:{let r=e;for(let e of t.events)if(r=lx(r,e,n),r==null)return null;return r}}}function ux(e){return{canonicalChanged:e.canonicalChanged,projectionChanged:e.projectionChanged,visibleCountDelta:e.visibleCountDelta}}function dx(e){switch(e.operation){case`add`:return{...ux(e),operation:`add`,path:e.path};case`remove`:return{...ux(e),operation:`remove`,path:e.path,recursive:e.recursive};case`move`:return{...ux(e),from:e.from,operation:`move`,to:e.to}}}function fx(e){return{...ux(e),events:e.events.filter(e=>e.operation===`add`||e.operation===`remove`||e.operation===`move`).map(e=>dx(e)),operation:`batch`}}function px(e){switch(e.operation){case`add`:case`remove`:case`move`:return dx(e);case`batch`:return fx(e);default:return null}}function mx(e,t){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}function hx(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 gx(e){return hx(e).at(-1)??null}function _x(e,t){return t==null?e:e.startsWith(t)?e.slice(t.length):e}function vx(e){return e.endsWith(`/`)}var yx=e=>e.toLowerCase();function bx(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`);return n<0?t:t.slice(n+1)}function xx(e){return e.endsWith(`/`)?e.slice(0,-1):e}function Sx(e,t){return t&&!e.endsWith(`/`)?`${e}/`:e}var Cx=e=>{let t=e.trim();return t.length===0?``:(t.includes(`\\`)?t.replaceAll(`\\`,`/`):t).toLowerCase()},wx=Symbol(`FILE_TREE_RENAME_VIEW`),Tx=512,Ex=512;function Dx(e){return e===`top`||e===`center`?e:`nearest`}function Ox(e,t,n){if(e===0)return-1;if(n!=null){let e=t(n);if(e!=null)return e;let r=hx(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 kx(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:Ox(e.paths.length,r,t),getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex}}var Ax=class e{static{Object.defineProperty(e.prototype,wx,{configurable:!0,value(){return{cancel:()=>{this.#q()},commit:()=>{this.#J()},getPath:()=>this.#T,getValue:()=>this.#E,isActive:()=>this.#T!=null,setValue:e=>{this.#Y(e)}}},writable:!0})}#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=ax({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=gx(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:Dx(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<=Ex){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=Qb(t,n);return this.#r.canDrag?.(r)!==!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=ex(t.draggedPaths,n);(tx(t.draggedPaths,n)||this.#r?.canDrop?.(e)===!1)&&(n=null)}$b(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=ex(e.draggedPaths,t);if(tx(e.draggedPaths,t)||this.#r?.canDrop?.(n)===!1)return this.#De(),!1;let r=rx(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=vx(r),a=xx(r);if(this.#C?.({isFolder:i,path:a})===!1)return!1;for(let e of hx(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=bx(r),this.#D=t.removeIfCanceled??!1,this.#De(),!0}#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,vx(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,vx(e)?{recursive:!0}:void 0);return}let t=vx(e),n=Jb({files:this.#H.list(),isFolder:t,nextBasename:this.#E,path:xx(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(Sx(n.sourcePath,t),Sx(n.destinationPath,t))}#Y(e){this.#T!=null&&this.#E!==e&&(this.#E=e,this.#De())}resetPaths(e,t={}){let n=!Array.isArray(e),r=n?void 0:e,i=n?e:t,a=this.#H.list().length,o=this.#G,s=ax({paths:r,preparedInput:i.preparedInput},`resetPaths`,this.#e.sort),c=this.#le(s.paths,s.preparedInput,i.initialExpandedPaths),l=this.#c,u=this.#T,d=this.getSelectedPaths(),f=this.#z;this.#K?.(),this.#H=c,this.#d.clear(),this.#he();let p=d.map(e=>c.getPathInfo(e)?.path??null).filter(e=>e!=null),m=!mx(this.#B,p);this.#B=new Set(p),m&&(this.#V+=1),this.#z=f==null?null:c.getPathInfo(f)?.path??null,this.#T=u==null?null:c.getPathInfo(u)?.path??null,this.#T??(this.#E=``,this.#D=!1),this.#je(l,l!=null||p.length>0||this.#z!=null),this.#K=this.#Re(),this.#De(),this.#Oe({canonicalChanged:!0,operation:`reset`,pathCountAfter:s.paths.length,pathCountBefore:a,projectionChanged:!0,usedPreparedInput:i.preparedInput!=null,visibleCountDelta:this.#G-o})}#X(e){this.#Ie();let t=gx(e),n=_x(e,t),r=null,i=null;for(let e of this.#be()){if(gx(e)!==t)continue;let a=_x(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=hx(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=!mx(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 Ub({...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 hx(t))e.add(n)}return this.#m=[...e].sort(),this.#m}#fe(){return this.#g??=this.#ue().map(yx),this.#g}#pe(){return this.#f??=this.#de().filter(e=>e.endsWith(`/`)),this.#f}#me(){return this.#p??=this.#pe().map(yx),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 hx(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:Cx(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 hx(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 hx(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=kx(this.#H.getVisibleTreeProjectionData(t?void 0:Math.min(n,Tx)),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=lx(this.#T,e);t==null&&this.#T!=null&&(this.#E=``),this.#T=t;let n=lx(this.#c,e,!0),r=[...this.#B].map(t=>lx(t,e)).filter(e=>e!=null).map(e=>this.#H.getPathInfo(e)?.path??null).filter(e=>e!=null),i=lx(this.#z,e),a=i==null?null:this.#H.getPathInfo(i)?.path??null,o=[...new Set(r)];return mx(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&&ox(e)&&(this.#i=null);let t=ox(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=px(e);i!=null&&this.#Oe(i)})}#ze(e){if(this.#H.isExpanded(e)){this.#ie(e);return}this.#ke(e)}},jx=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 Mx(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 Nx(e){let t=e.endsWith(`/`)?e.slice(0,-1):e;if(t.length===0)return[];let n=[],r=0;for(;;){let e=t.indexOf(`/`,r);if(e===-1)break;n.push(t.slice(0,e+1)),r=e+1}return n}function Px(e,t){return t?`${e}/`:e}function Fx(e,t=null){let n=jx(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,o=new Map;for(let t of e??[]){let e=Lx(t);e!=null&&Bx({canonicalPath:e.canonicalPath,changeCountByDirectoryPath:o,directoriesWithChanges:i,ignoredDirectoryPaths:a,isDirectory:e.isDirectory,status:t.status,statusByPath:r})}return r.size===0?null:{changeCountByDirectoryPath:o,directoriesWithChanges:i,ignoredDirectoryPaths:a,signature:n,statusByPath:r}}function Ix(e,t){let n=t?.remove??[],r=t?.set??[];if(n.length===0&&r.length===0)return e;let i=new Map(e?.statusByPath),a=new Set(e?.directoriesWithChanges),o=new Set(e?.ignoredDirectoryPaths),s=new Map(e?.changeCountByDirectoryPath),c=!1;for(let e of n){let t=Rx(e);t!=null&&(c=zx({canonicalPath:t.canonicalPath,changeCountByDirectoryPath:s,directoriesWithChanges:a,ignoredDirectoryPaths:o,statusByPath:i})||c)}for(let e of r){let t=Lx(e);t!=null&&(c=Bx({canonicalPath:t.canonicalPath,changeCountByDirectoryPath:s,directoriesWithChanges:a,ignoredDirectoryPaths:o,isDirectory:t.isDirectory,status:e.status,statusByPath:i})||c)}return c?i.size===0?null:{changeCountByDirectoryPath:s,directoriesWithChanges:a,ignoredDirectoryPaths:o,signature:Ux(i),statusByPath:i}:e}function Lx(e){return Rx(e.path)}function Rx(e){let t=Mx(e);if(t!=null)return{canonicalPath:Px(t.path,t.isDirectory),isDirectory:t.isDirectory}}function zx({canonicalPath:e,changeCountByDirectoryPath:t,directoriesWithChanges:n,ignoredDirectoryPaths:r,statusByPath:i}){let a=i.get(e);return a!=null&&(i.delete(e),a===`ignored`&&e.endsWith(`/`)&&r.delete(e),Hx(t,n,e),!0)}function Bx({canonicalPath:e,changeCountByDirectoryPath:t,directoriesWithChanges:n,ignoredDirectoryPaths:r,isDirectory:i,status:a,statusByPath:o}){let s=o.get(e);return s!==a&&(s??Vx(t,n,e),o.set(e,a),a===`ignored`&&i?r.add(e):i&&r.delete(e),!0)}function Vx(e,t,n){for(let r of Nx(n))e.set(r,(e.get(r)??0)+1),t.add(r)}function Hx(e,t,n){for(let r of Nx(n)){let n=(e.get(r)??0)-1;n>0?e.set(r,n):(e.delete(r),t.delete(r))}}function Ux(e){let t=`${e.size}`;for(let[n,r]of e)t+=`\0${n}\0${r}`;return t}var Wx=e=>e.trim().toLowerCase(),Gx=e=>e.split(`/`).at(-1)??e,Kx=e=>{let t=e.toLowerCase().split(`.`),n=[];for(let e=1;e<t.length;e+=1)n.push(t.slice(e).join(`.`));return n};function qx(e,t){return typeof e==`string`?{name:e,remappedFrom:t}:{...e,remappedFrom:t}}function Jx(e){let t=Xg(e),n=t.remap,r=new Map;for(let[e,n]of Object.entries(t.byFileName??{}))r.set(e.toLowerCase(),n);let i=new Map;for(let[e,n]of Object.entries(t.byFileExtension??{}))i.set(Wx(e),n);let a=Object.entries(t.byFileNameContains??{}).map(([e,t])=>[e.toLowerCase(),t]);return{resolveIcon:(e,o)=>{if(e===`file-tree-icon-file`&&o!=null){let s=Gx(o),c=s.toLowerCase(),l=r.get(c);if(l!=null)return qx(l,e);for(let[t,n]of a)if(c.includes(t))return qx(n,e);let u=Kx(s);for(let t of u){let n=i.get(t);if(n!=null)return qx(n,e)}let d=Jg(t.set,s,u);if(d!=null&&t.set!==`none`){if(d==="default"){let t=n?.[e];if(t!=null)return qx(t,e)}return{name:Kg(d),remappedFrom:e,token:d}}}let s=n?.[e];return s==null?{name:e}:qx(s,e)}}}var Yx,Xx,Zx,Qx,$x,eS,tS,nS,rS,iS,aS={},oS=[],sS=Array.isArray,cS=oS.slice,lS=Object.assign;function uS(e){e&&e.parentNode&&e.remove()}function dS(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?cS.call(arguments,2):n),fS(e,o,r,i,null)}function fS(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??++Xx,__i:-1,__u:0};return i==null&&Yx.vnode!=null&&Yx.vnode(a),a}function pS(e){return e.children}function mS(e,t){this.props=e,this.context=t,this.__g=0}function hS(e,t){if(t==null)return e.__?hS(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`?hS(e):null}function gS(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 gS(e)}}function _S(e){(8&e.__g||!(e.__g|=8)||!Zx.push(e)||$x++)&&Qx==Yx.debounceRendering||((Qx=Yx.debounceRendering)||queueMicrotask)(vS)}function vS(){for(var e,t,n,r,i,a,o,s,c=1;Zx.length;)Zx.length>c&&Zx.sort(eS),e=Zx.shift(),c=Zx.length,8&e.__g&&(n=void 0,i=(r=(t=e).__v).__e,a=[],o=[],(s=t.__P)&&((n=lS({},r)).__v=r.__v+1,Yx.vnode&&Yx.vnode(n),ES(s,n,r,t.__n,s.namespaceURI,32&r.__u?[i]:null,a,i??hS(r),!!(32&r.__u),o,s.ownerDocument),n.__v=r.__v,n.__.__k[n.__i]=n,OS(a,n,o),n.__e!=i&&gS(n)));$x=0}function yS(e,t,n,r,i,a,o,s,c,l,u,d){var f,p,m,h,g,_,v,y=r&&r.__k||oS,b=t.length;for(c=bS(n,t,y,c,b),f=0;f<b;f++)(m=n.__k[f])!=null&&(p=m.__i==-1?aS:y[m.__i]||aS,m.__i=f,_=ES(e,m,p,i,a,o,s,c,l,u,d),h=m.__e,m.ref&&p.ref!=m.ref&&(p.ref&&jS(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=xS(m,c,e,v):typeof m.type==`function`&&_!==void 0?c=_:h&&(c=h.nextSibling),m.__u&=-7);return n.__e=g,c}function bS(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?fS(null,o,null,null,null):sS(o)?fS(pS,{children:o},null,null,null):o.constructor==null&&o.__b>0?fS(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=SS(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=hS(s)),MS(s,s));return r}function xS(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=xS(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=hS(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function SS(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&!(2&l.__u);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 CS(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n??``}function wS(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||CS(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||CS(e.style,t,n[t])}}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(tS,`$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=nS,e.addEventListener(t,a?iS:rS,a)):e.removeEventListener(t,a?iS:rS,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 TS(e){return function(t){if(this.__l){var n=this.__l[t.type+e];if(t.u==null)t.u=nS++;else if(t.u<n.l)return;return n(Yx.event?Yx.event(t):t)}}}function ES(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,_,v,y,b,x,S,C,ee,te,ne,w,T,E,re,D,O=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=Yx.__b)&&d(t);n:if(typeof O==`function`)try{if(v=t.props,y=`prototype`in O&&O.prototype.render,b=(d=O.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 O(v,x):(t.__c=f=new mS(v,x),f.constructor=O,f.render=NS),b&&b.sub(f),f.props=v,f.state||(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&&O.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=lS({},f.__s)),lS(f.__s,O.getDerivedStateFromProps(v,f.__s))),m=f.props,h=f.state,f.__v=t,p)y&&O.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),y&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(y&&O.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=Yx.__r,ee=0,y){for(f.state=f.__s,f.__g&=-9,C&&C(t),d=f.render(f.props,f.state,f.context),te=0;te<f._sb.length;te++)f.__h.push(f._sb[te]);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&&++ee<25);f.state=f.__s,f.getChildContext!=null&&(r=lS({},r,f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),ne=d,d!=null&&d.type===pS&&d.key==null&&(ne=kS(d.props.children)),s=yS(e,sS(ne)?ne:[ne],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(w=0,T=!1,t.__u|=c?160:128,t.__c.__z=[],E=0;E<a.length;E++)(re=a[E])==null||T||(re.nodeType==8&&re.data==`$s`?(w>0&&t.__c.__z.push(re),w++,a[E]=null):re.nodeType==8&&re.data==`/$s`?(--w>0&&t.__c.__z.push(re),T=w===0,s=a[E],a[E]=null):w>0&&(t.__c.__z.push(re),a[E]=null));if(!T){for(;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;a[a.indexOf(s)]=null,t.__c.__z=[s]}t.__e=s}else{for(D=a.length;D--;)uS(a[D]);DS(t)}}else t.__e=n.__e,t.__k=n.__k,e.then||DS(t);Yx.__e(e,t,n)}else s=t.__e=AS(n.__e,t,n,r,i,a,o,c,l,u);return(d=Yx.diffed)&&d(t),128&t.__u?void 0:s}function DS(e){e&&e.__c&&(e.__c.__g|=4),e&&e.__k&&e.__k.forEach(DS)}function OS(e,t,n){for(var r=0;r<n.length;r++)jS(n[r],n[++r],n[++r]);Yx.__c&&Yx.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){Yx.__e(e,t.__v)}})}function kS(e){return typeof e!=`object`||!e||e.__b&&e.__b>0?e:sS(e)?e.map(kS):lS({},e)}function AS(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&&=(Yx.__m&&Yx.__m(t,a),!1),a=null}if(b==null)v===y||s&&e.data==y||(e.data=y);else{if(a&&=cS.call(e.childNodes),v=n.props||aS,!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;wS(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&&!_||wS(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=``),yS(b==`template`?e.content:e,sS(p)?p:[p],t,n,r,b==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&hS(n,0),s,c,l),a!=null)for(u=a.length;u--;)uS(a[u]);s||(u=`value`,b==`progress`&&h==null?e.removeAttribute(`value`):h==null||h===e[u]&&(b!==`progress`||h)||wS(e,u,h,v[u],i),u=`checked`,g!=null&&g!=e[u]&&wS(e,u,g,v[u],i))}return e}function jS(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){Yx.__e(e,n)}}function MS(e,t,n){var r,i;if(Yx.unmount&&Yx.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||jS(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){Yx.__e(e,t)}r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&MS(r[i],t,n||typeof e.type!=`function`);n||uS(e.__e),e.__e&&e.__e.__l&&(e.__e.__l=null),e.__e=e.__c=e.__=null}function NS(e,t,n){return this.constructor(e,n)}function PS(e,t){var n,r,i,a;t==document&&(t=document.documentElement),Yx.__&&Yx.__(e,t),r=(n=!!(e&&32&e.__u))?null:t.__k,e=t.__k=dS(pS,null,[e]),i=[],a=[],ES(t,e,r||aS,aS,t.namespaceURI,r?null:t.firstChild?cS.call(t.childNodes):null,i,r?r.__e:t.firstChild,n,a,t.ownerDocument),OS(i,e,a)}function FS(e,t){e.__u|=32,PS(e,t)}Yx={__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 $x=0,e}},Xx=0,mS.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=lS({},this.state);typeof e==`function`&&(e=e(lS({},n),this.props)),e&&lS(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),_S(this))},mS.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),_S(this))},mS.prototype.render=pS,Zx=[],$x=0,eS=function(e,t){return e.__v.__b-t.__v.__b},tS=/(PointerCapture)$|Capture$/i,nS=0,rS=TS(!1),iS=TS(!0);var IS=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:--IS,__i:-1,__u:0,__source:i,__self:a};return Yx.vnode&&Yx.vnode(l),l}var LS=16,RS=16,zS={};function BS({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}=zS[e]??{width:LS,height:RS},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 VS=e=>e!==void 0&&/\s/.test(e),HS=(e,t)=>{let n=t=>VS(e[t-1])||VS(e[t]);if(!n(t))return t;for(let r=1;r<e.length;r++){let i=t-r;if(i>0&&!n(i))return i;let a=t+r;if(a<e.length&&!n(a))return a}return t},US=e=>HS(e,Math.ceil(e.length/2)),WS=e=>{if(e.length<2)return[e,``];let t=US(e);return[e.slice(0,t),e.slice(t)]},GS=e=>{if(e.length<4)return[e,``];let t=e.lastIndexOf(`.`)+1,n=e.length-t>10,r=t>=1&&!n?t:US(e);return[e.slice(0,r),e.slice(r)]},KS=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)]},qS=(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)]},JS=(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)]},YS=(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 XS({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 ZS(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 QS({children:e,mode:t=`truncate`,marker:n=`…`,variant:r=`default`,...i}){"use no memo";let a=Q(ZS,{mode:t,children:e},`content`),o=Q(XS,{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 $S({children:e,...t}){"use no memo";return Q(QS,{mode:`truncate`,...t,children:e})}function eC({children:e,...t}){"use no memo";return Q(QS,{mode:`fruncate`,...t,children:e})}function tC({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($S,{...s,children:t[0]}),l=Q(eC,{...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`?eC:$S,{...s,className:a,style:o,children:e});let t=null,u=null,d=null;if(typeof r==`string`)r===`center`?t=WS:r===`extension`?t=GS:r===`leaf-path`&&(t=KS);else if(typeof r==`number`)t=qS,u=r;else if(Array.isArray(r)){let[e,n]=r;d=n,e===`last`?t=JS:e===`first`&&(t=YS)}else typeof r==`function`&&(t=r);t??=WS;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($S,{...s,..._,children:f}),l=Q(eC,{...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 nC={endIndex:-1,startIndex:-1};function rC(e,t,n){return Math.min(Math.max(e,t),n)}function iC(e,t){return e<0||t<e?nC:{endIndex:t,startIndex:e}}function aC(e){return e.startIndex<0||e.endIndex<e.startIndex}function oC(e,t){return aC(e)?0:(e.endIndex-e.startIndex+1)*t}function sC(e,t,n){if(t<=0)return-1;let r=t*n;return e<=0?0:e>=r?t:Math.floor(e/n)}function cC(e,t,n){return t<=0||e<=0?-1:e>=t*n?t-1:Math.ceil(e/n)-1}function lC(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 uC(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 dC(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 fC(e,t,n){if(e.length===0||t<=0)return[];let r=dC(e),i=lC(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=uC(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 pC(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=rC(t.scrollTop,0,o),c=t.stickyRows??fC(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=sC(s,n,t.itemHeight),m=sC(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?nC:iC(m,cC(u+d,n,t.itemHeight)),y=g+1,b=aC(v)?nC:iC(Math.max(y,v.startIndex-a),Math.min(n-1,v.endIndex+a)),x=oC(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:aC(b)?0:b.startIndex*t.itemHeight,startIndex:b.startIndex}}}var mC={added:`A`,deleted:`D`,ignored:null,modified:`M`,renamed:`R`,untracked:`U`},hC={added:`Git status: added`,deleted:`Git status: deleted`,ignored:`Git status: ignored`,modified:`Git status: modified`,renamed:`Git status: renamed`,untracked:`Git status: untracked`},gC=`Contains git status items`;function _C(e){return e.current?!0:(e.current=!0,!1)}function vC(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 yC(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,offset:i,topInset:a=0,totalHeight:o,viewportHeight:s}=e;if(i===`nearest`)return vC({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 bC(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 xC(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 SC(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 CC(e,t){if(e==null)return t;let n=e.getBoundingClientRect().height;return n>0?n:e.clientHeight>0?e.clientHeight:t}function wC(e,t){return e!=null&&e>0?e:t}function TC(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 EC(e,t,n,r,i=0){let a=vC({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,topInset:i,viewportHeight:r});return a!=null&&(e.scrollTop=a,!0)}function DC(e,t,n,r,i,a,o=0){let s=yC({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,offset:a,topInset:o,totalHeight:i,viewportHeight:r});return s!=null&&(e.scrollTop=s,!0)}function OC(e,t,n,r,i,a){let o=bC({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,targetViewportOffset:a,totalHeight:i,viewportHeight:r});return o!=null&&(e.scrollTop=o,!0)}function kC(e,t,n,r){return n.end<n.start?null:e<n.start?-t:e>n.end?r:null}function AC(e){let{renamingPath:t,previousRenamingPath:n,hasRenderedInput:r}=e;return t==null?`reset`:r?n===t?`ignore`:`focus-input`:`reveal-canonical`}function jC({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 MC(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 NC(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 PC,FC,IC,LC,RC=Object.is,zC=0,BC=[],VC=Yx,HC=VC.__b,UC=VC.__r,WC=VC.diffed,GC=VC.__c,KC=VC.unmount,qC=VC.__;function JC(e,t){VC.__h&&VC.__h(FC,e,zC||t),zC=0;var n=FC.__H||(FC.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function YC(e){return zC=1,XC(sw,e)}function XC(e,t,n){var r=JC(PC++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):sw(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);RC(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=FC,!FC.__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,RC(t,e.__[0])||(o=!0)}}),a&&a.call(this,e,t,n)||o};FC.__f=!0;var a=FC.shouldComponentUpdate,o=FC.componentWillUpdate;FC.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)},FC.shouldComponentUpdate=i}return r.__N||r.__}function ZC(e,t){var n=JC(PC++,3);!VC.__s&&ow(n.__H,t)&&(n.__=e,n.u=t,FC.__H.__h.push(n))}function QC(e,t){var n=JC(PC++,4);!VC.__s&&ow(n.__H,t)&&(n.__=e,n.u=t,FC.__h.push(n))}function $(e){return zC=5,$C(function(){return{current:e}},[])}function $C(e,t){var n=JC(PC++,7);return ow(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function ew(e,t){return zC=8,$C(function(){return e},t)}function tw(){for(var e;e=BC.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(iw),e.__H.__h.forEach(aw),e.__H.__h=[]}catch(t){e.__H.__h=[],VC.__e(t,e.__v)}}VC.__b=function(e){FC=null,HC&&HC(e)},VC.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),qC&&qC(e,t)},VC.__r=function(e){UC&&UC(e),PC=0;var t=(FC=e.__c).__H;t&&(IC===FC?(t.__h=[],FC.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(iw),t.__h.forEach(aw),t.__h=[],PC=0)),IC=FC},VC.diffed=function(e){WC&&WC(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(BC.push(t)!==1&&LC===VC.requestAnimationFrame||((LC=VC.requestAnimationFrame)||rw)(tw)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),IC=FC=null},VC.__c=function(e,t){t.some(function(e){try{e.__h.forEach(iw),e.__h=e.__h.filter(function(e){return!e.__||aw(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],VC.__e(n,e.__v)}}),GC&&GC(e,t)},VC.unmount=function(e){KC&&KC(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{iw(e)}catch(e){t=e}}),n.__H=void 0,t&&VC.__e(t,n.__v))};var nw=typeof requestAnimationFrame==`function`;function rw(e){var t,n=function(){clearTimeout(r),nw&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);nw&&(t=requestAnimationFrame(n))}function iw(e){var t=FC,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),FC=t}function aw(e){var t=FC;e.__c=e.__(),FC=t}function ow(e,t){return!e||e.length!==t.length||t.some(function(t,n){return!RC(t,e[n])})}function sw(e,t){return typeof t==`function`?t(e):t}function cw(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(pS,{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($S,{children:e.name})}),i<r.length-1?` / `:``]},e.path)})})}function lw(e){return e.isFlattened?e.flattenedSegments?.findLast(e=>e.isTerminal)?.path??e.path:e.path}function uw(e){let t=e.flattenedSegments;return t==null||t.length===0?e.name:t.map(e=>e.name).join(` / `)}function dw(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 fw({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=pC(c,{itemHeight:t,overscan:n,scrollTop:r,stickyRows:s==null?void 0:dw(s,r,t,o),totalRowCount:o,viewportHeight:a}),u=i&&r<=0&&o>0?e.getStickyRowCandidates(1,t):[],d=u!=null&&r<=0?dw(u,1,t,o):i&&r<=0&&c.length>0?fC(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 pw=400,mw=40,hw=18;function gw(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))?_w(e,t,n):a instanceof HTMLElement?a:null}function _w(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 vw(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 yw(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 bw(){return navigator.vendor!==`Apple Computer, Inc.`}function xw(e,t){let n=e-t.top;if(n<mw)return-Math.ceil((mw-Math.max(0,n))/mw*hw);let r=t.bottom-e;return r<mw?Math.ceil((mw-Math.max(0,r))/mw*hw):0}function Sw(e,t){if(e!=null){let t=mC[e];return t==null?null:{text:t,title:hC[e]}}return t?{icon:{name:`file-tree-icon-dot`,width:6,height:6},title:gC}:null}function Cw(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 ww(e){return e!=null&&`toggle`in e}function Tw(e){return e.code===`Space`||e.key===` `||e.key===`Spacebar`}function Ew(e){return e.key.length===1&&/^[\p{L}\p{N}]$/u.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey}function Dw(e){return e==null?``:`[data-item-section="spacing-item"][data-ancestor-path="${e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}"] { opacity: 1; }`}function Ow(e){return e.shiftKey&&e.key===`F10`||e.key===`ContextMenu`}function kw(e,t){return t&&Ow(e)||(e.ctrlKey||e.metaKey)&&Tw(e)?!0:e.key===`ArrowDown`||e.key===`ArrowLeft`||e.key===`ArrowRight`||e.key===`ArrowUp`}var Aw=new Set([`ArrowDown`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`]);function jw(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 Mw(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 Nw(e,t){return{bottom:t,height:0,left:e,right:e,top:t,width:0,x:e,y:t}}function Pw(e,t){if(e==null)return t.offsetTop;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.top-r.top}function Fw(e,t,n){if(n==null){e.delete(t);return}e.set(t,n)}function Iw(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 Lw(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 Rw(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 zw(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=Rw(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 Bw(e,t){return{kind:e.kind,name:uw(e),path:t}}function Vw(e){return e==null?void 0:`${e}__tree`}function Hw(e,t,n){if(e!=null)return`${e}__focused-item-${encodeURIComponent(t)}${n?`__parked`:``}`}function Uw(e){return e===`file-tree-icon-chevron`||e===`file-tree-icon-dot`||e===`file-tree-icon-file`||e===`file-tree-icon-lock`}function Ww(e,t){if(e==null)return null;if(`text`in e)return e.parts==null?Q(`span`,{title:e.title,children:e.text}):Q(`span`,{title:e.title,children:e.parts.map((e,t)=>Q(`span`,{style:{color:e.color},children:e.text},t))});let n=typeof e.icon==`string`?Uw(e.icon)?t(e.icon):{name:e.icon}:Uw(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(BS,{...n})})}function Gw(e){e!=null&&xC(e.querySelector([`button:not([disabled])`,`[href]`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`, `))??e)}function Kw(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=lw(e);return Q(pS,{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(BS,{...t(`file-tree-icon-chevron`)}):Q(BS,{...t(`file-tree-icon-file`,u)})}),Q(`div`,{"data-item-section":`content`,children:e.isFlattened?cw(e,c,a):c??Q(tC,{minimumLength:5,split:`extension`,children:e.name})}),i?Q(`div`,{"data-item-section":`decoration`,children:r==null?null:Ww(r,t)}):null,s?Q(`div`,{"data-item-section":`git`,children:Ww(o,t)}):null,n?Q(`div`,{"data-item-section":`action`,children:l?Q(`span`,{"aria-hidden":`true`,"data-item-action-affordance":`decorative`,children:Q(BS,{...t(`file-tree-icon-ellipsis`)})}):null}):null]})}function qw(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:ee,contextMenuButtonVisibility:te,contextMenuRightClickEnabled:ne,registerRenameInput:w,registerButton:T,resolveIcon:E,renderDecorationForRow:re,openContextMenuForRow:D,onRowClick:O,onKeyDown:k}=e,ie=lw(t),{isParked:A=!1,mode:ae=`flow`,style:oe}=r,se=ae===`sticky`,ce=_?.get(ie)??null??Cw(t.ancestorPaths,v,y),le=t.kind===`directory`&&(b?.has(ie)??!1),ue=re(t,ie),de=Sw(ce,le),fe=S&&ee,pe=ue!=null||x||fe,me=fe&&te===`always`,j=a.getPath()===ie,he=j?a.getValue():``,ge=se||!j?null:Q(jC,{ref:w,ariaLabel:`Rename ${uw(t)}`,isFlattened:t.isFlattened,value:he,onBlur:()=>{a.commit()},onInput:e=>{a.setValue(e.currentTarget.value)}}),_e=Kw(t,E,{actionLaneEnabled:fe,customDecoration:ue,decorationLaneEnabled:pe,dragTargetFlattenedSegmentPath:l?.flattenedSegmentPath??null,gitDecoration:de,gitLaneActive:x,renameInput:ge,showDecorativeActionAffordance:me}),ve={...MC({ariaLabel:uw(t),domId:t.isFocused?Hw(h,ie,A):void 0,extraStyle:oe,features:{actionLaneEnabled:fe,contextMenuButtonVisibility:fe?te:null,contextMenuEnabled:S,contextMenuTriggerMode:S?C:null,gitLaneActive:x},isParked:A,itemHeight:g,mode:ae,row:t,state:{containsGitChange:le,effectiveGitStatus:ce,isContextHovered:s===ie,isDragTarget:l?.kind===`directory`&&l.directoryPath===ie,isDragging:c?.has(ie)===!0,isFocusRinged:t.isFocused&&o===ie},targetPath:ie}),key:n,onContextMenu:S||u?e=>{if(d()){e.preventDefault();return}S&&(e.preventDefault(),ne&&(i.focusMountedPathFromInput(ie),D(t,ie,{anchorRect:Nw(e.clientX,e.clientY),source:`right-click`})))}:void 0,onFocus:se?void 0:()=>{i.focusMountedPathFromInput(ie)},onKeyDown:se?void 0:k,ref:e=>{T(ie,e)}};return!se&&j?Q(`div`,{...ve,children:_e}):Q(`button`,{...ve,type:`button`,draggable:u&&!A,onDragEnd:u&&!A?p:void 0,onDragStart:u&&!A?e=>{f(e,t,ie)}:void 0,onMouseDown:e=>{if(se){e.preventDefault();return}i.isSearchOpen()&&e.preventDefault()},onTouchStart:u&&!A?e=>{m(e,t,ie)}:void 0,onClick:e=>{O(e,t,ie,ae)},children:_e})}function Jw(e,t,n){return t.end<t.start?[]:e.controller.getVisibleRows(t.start,t.end).filter(e=>!n.has(lw(e))).map((n,r)=>qw(e,n,t.start+r))}function Yw({composition:e,controller:t,gitStatusByPath:n,ignoredGitDirectories:r,directoriesWithGitChanges:i,icons:a,instanceId:o,itemHeight:s=$g,overscan:c=10,renamingEnabled:l=!1,renderRowDecoration:u,searchBlurBehavior:d=`close`,searchEnabled:f=!1,searchFakeFocus:p=!1,slotHost:m,stickyFolders:h=!1,initialViewportHeight:g=420}){"use no memo";let _=$(null),v=$(null),y=$(!1),b=$(null),x=$(null),S=$(null),C=$(null),ee=$(null),te=$(new Map),ne=$(new Map),w=$(()=>{}),T=$(null),E=$(0),re=$(!1),D=$(null);D.current!==t&&(re.current=!1,D.current=t);let O=$(!1),k=$(null),ie=$(null),A=$(!1),ae=$(null),oe=$(null),se=$(null),ce=$(null),le=$(null),ue=$(null),de=$(null),fe=$(null),pe=$(!1),me=$(null),j=$(null),he=$(null),ge=$(null),_e=$C(()=>new Map,[]),[,ve]=YC(0),ye=$(!1),[M,be]=YC(null),[xe,N]=YC(null),[P,Se]=YC(null),[Ce,we]=YC(null),[Te,Ee]=YC(0),[F,De]=YC(null),I=$(F);I.current=F;let Oe=$(null),ke=$(null),Ae=$(null),je=$(null),Me=$(null),L=$(!1),Ne=()=>{ke.current=null,Ae.current=null,je.current=null},Pe=(e,t)=>{ke.current=e,Ae.current=null,je.current=t==null?null:{path:e,scrollTop:t}},Fe=(e,t)=>{ke.current=null,Ae.current={path:e,viewportOffset:t},je.current=null},R=$(d===`retain`&&t.isSearchOpen()),[Ie,Le]=YC(p);ZC(()=>{p||Le(!1)},[p]);let Re=$(!1),ze=ew(()=>{Re.current=!0,Le(e=>e&&!1)},[]),[Be,Ve]=YC(()=>fw({controller:t,itemHeight:s,overscan:c,scrollTop:0,stickyFolders:h,viewportHeight:g})),[He,Ue]=YC(!1);ZC(()=>{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`,z=e?.contextMenu?.buttonVisibility??`when-needed`,qe=Ge===`both`||Ge===`right-click`;QC(()=>{let e=S.current;if(e==null)return;let t=e=>{if(!(e instanceof CustomEvent))return;let t=e.detail?.path??null;Me.current=t,N(t),we(t==null?null:`pointer`)},n=e=>{e instanceof CustomEvent&&(L.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 Je=ew((e,t)=>{Fw(te.current,e,t)},[]),B=ew((e,t)=>{Fw(ne.current,e,t)},[]),Ye=ew(e=>{x.current=e},[]),Xe=ew(e=>Iw(e,ne.current,te.current),[]),Ze=n!=null||r!=null||i!=null,{resolveIcon:Qe}=$C(()=>Jx(a),[a]),$e=t[wx](),et=$e.getPath(),tt=et!=null,V=t.isSearchOpen(),H=t.getSearchValue(),U=t.getFocusedPath(),W=t.getFocusedIndex(),nt=t.getScrollRequest(),rt=t.isDragAndDropEnabled(),it=t.getDragSession(),at=$C(()=>it==null?null:new Set(it.draggedPaths),[it]),ot=it?.target??null,st=it?.primaryPath??null,ct=Vw(o),{overlayHeight:lt,overlayRows:ut,snapshot:G,visibleRows:dt}=Be,ft=G.physical.viewportHeight,pt=$C(()=>({end:G.window.endIndex,start:G.window.startIndex}),[G.window.endIndex,G.window.startIndex]),mt=ut,ht=G.sticky.rows,gt=G.physical.totalHeight,_t=G.sticky.height,vt=$C(()=>new Set(ht.map(e=>lw(e.row))),[ht]),yt=W>=0&&W>=pt.start&&W<=pt.end,bt=ew((e,t)=>u?.({item:Bw(e,t),row:e})??null,[u]),xt=ew(e=>xC(e==null?null:te.current.get(e)??null)?!0:xC(S.current),[]),St=ew(e=>{xt(t.focusNearestPath(e))},[t,xt]),Ct=$(St);Ct.current=St;let wt=$(!0),Tt=$(()=>{}),Et=ew((t=!0)=>{let n=I.current;n!=null&&(wt.current=wt.current&&t,De(null),e?.contextMenu?.onClose?.(),wt.current&&St(n.path))},[e?.contextMenu,St]);Tt.current=Et;let Dt=ew(e=>{let t=e==null?null:Pw(S.current,e);Se(e=>e===t?e:t)},[]),Ot=ew((e,n,r)=>{let i=t.getItem(n);if(i==null)return;let a=Xe(n);if(a?.dataset.fileTreeStickyRow===`true`){let e=C.current;Pe(n,e?.scrollTop??null),O.current=!0,be(e=>e===n?e:n)}i.focus(),Dt(a),wt.current=!0,De({anchorRect:r?.anchorRect??null,item:Bw(e,n),path:n,source:r?.source??`keyboard`})},[t,Xe,Dt]),kt=ew(e=>{if(l){if(t.isSearchOpen()){let e=C.current,t=CC(e,ft);ae.current=W<0||e==null?null:Math.max(0,Math.min(W*s-e.scrollTop,Math.max(0,t-s))),A.current=!0}t.startRenaming(e)!==!1&&(we(`focus`),ve(e=>e+1))}},[t,W,s,l,ft]),At=ew((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=CC(i,ft),u=t.getVisibleCount()*s,d=r===`sticky-parents`?o.ancestorPaths.length*s:fw({controller:t,itemHeight:s,overscan:c,scrollTop:i.scrollTop,stickyFolders:h,viewportHeight:l}).snapshot.sticky.height;return O.current=!0,OC(i,a,s,l,u,d),w.current(),Oe.current=n?e:null,!0},[t,s,c,ft,h]),jt=()=>y.current===!0||ge.current!=null||pe.current===!0,Mt=e=>typeof window.requestAnimationFrame==`function`?window.requestAnimationFrame(()=>{e()}):window.setTimeout(e,16),Nt=e=>{if(e!=null){if(typeof window.cancelAnimationFrame==`function`){window.cancelAnimationFrame(e);return}window.clearTimeout(e)}},Pt=()=>{ce.current!=null&&(clearTimeout(ce.current),ce.current=null),se.current=null},Ft=()=>{ue.current?.remove(),ue.current=null},It=()=>{Nt(oe.current),oe.current=null,le.current=null},Lt=e=>{let t=S.current?.getRootNode();if(t instanceof ShadowRoot){t.append(e);return}document.body.append(e)},Rt=()=>{fe.current?.(),fe.current=null,ge.current!=null&&(clearTimeout(ge.current),ge.current=null),pe.current=!1,me.current=null,he.current=null,j.current!=null&&(j.current.setAttribute(`draggable`,`true`),j.current.style.removeProperty(`touch-action`),j.current=null),Ft(),Pt(),It(),de.current=null},zt=(e,n)=>{let r=S.current?.getRootNode(),i=vw(gw(r instanceof ShadowRoot?r:document,e,n));return t.setDragTarget(i),t.getDragSession()?.target??null},Bt=e=>{let n=t.getDragAndDropConfig()?.openOnDropDelay??800;if(e==null||e.kind!==`directory`||e.directoryPath==null||n<=0){Pt();return}let r=t.getItem(e.directoryPath),i=ww(r)?r:null;if(i==null||i.isExpanded()){Pt();return}let a=`${e.directoryPath}::${e.flattenedSegmentPath??``}`;se.current!==a&&(Pt(),se.current=a,ce.current=setTimeout(()=>{let n=t.getDragSession()?.target;n?.kind===`directory`&&n.directoryPath===e.directoryPath&&n.flattenedSegmentPath===e.flattenedSegmentPath&&i.expand()},n))},Vt=()=>{oe.current=null;let e=le.current,n=C.current;if(e==null||n==null||t.getDragSession()==null)return;let r=n.getBoundingClientRect(),i=xw(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,w.current()),Bt(zt(e.clientX,e.clientY)),oe.current=Mt(Vt)},Ht=(e,t)=>{le.current={clientX:e,clientY:t},oe.current??=Mt(Vt)},Ut=(e,n,r)=>{let i=e.currentTarget;if(i!=null){if(Rt(),Ft(),Pt(),It(),t.startDrag(r)===!1){e.preventDefault();return}if(de.current=n,e.dataTransfer!=null&&(e.dataTransfer.effectAllowed=`move`,e.dataTransfer.dropEffect=`move`,e.dataTransfer.setData(`text/plain`,r),bw())){let t=yw(i),n=i.getBoundingClientRect();Object.assign(t.style,{height:`${n.height}px`,opacity:`0.85`,transform:`translate3d(-9999px, 0px, 0)`,width:`${n.width}px`}),Lt(t),ue.current=t,e.dataTransfer.setDragImage(t,Math.max(0,e.clientX-n.left),Math.max(0,e.clientY-n.top))}}},Wt=()=>{Ft(),Pt(),It(),de.current=null,t.cancelDrag()},Gt=(e,n,r)=>{if(ge.current!=null||pe.current)return;let i=e.touches[0],a=e.currentTarget;if(i==null||a==null)return;he.current={clientX:i.clientX,clientY:i.clientY},j.current=a,a.setAttribute(`draggable`,`false`);let o=(e={})=>{let t=e.restoreNativeDraggable??!pe.current;ge.current!=null&&(clearTimeout(ge.current),ge.current=null),document.removeEventListener(`touchmove`,s),document.removeEventListener(`touchend`,c),document.removeEventListener(`touchcancel`,c),fe.current===o&&(fe.current=null),t&&(a.setAttribute(`draggable`,`true`),j.current===a&&(j.current=null),he.current=null)},s=e=>{let t=e.touches[0],n=he.current;if(t==null||n==null)return;let r=t.clientX-n.clientX,i=t.clientY-n.clientY;r*r+i*i<=100||o()},c=()=>{o()};document.addEventListener(`touchmove`,s,{passive:!0}),document.addEventListener(`touchend`,c),document.addEventListener(`touchcancel`,c),fe.current=o,ge.current=setTimeout(()=>{if(o({restoreNativeDraggable:!1}),t.startDrag(r)===!1){a.setAttribute(`draggable`,`true`),j.current===a&&(j.current=null),he.current=null;return}pe.current=!0,j.current=a,a.setAttribute(`draggable`,`false`),a.style.setProperty(`touch-action`,`none`),de.current=n;let e=a.getBoundingClientRect(),s=yw(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`}),Lt(s),ue.current=s,me.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=me.current;n!=null&&ue.current!=null&&(ue.current.style.transform=`translate3d(${t.clientX-n.x}px, ${t.clientY-n.y}px, 0)`),Bt(zt(t.clientX,t.clientY)),Ht(t.clientX,t.clientY)},l=e=>{let n=e.changedTouches[0];n!=null&&zt(n.clientX,n.clientY),t.completeDrag(),Rt()},u=()=>{t.cancelDrag(),Rt()};fe.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)},pw)},Kt=e=>{if(F!=null){if(e.key===`Escape`){Et(),e.preventDefault(),e.stopPropagation();return}Aw.has(e.key)&&(e.preventDefault(),e.stopPropagation());return}if($e.isActive()){if(e.isComposing||e.keyCode===229)return;if(e.key===`Escape`)$e.cancel();else if(e.key===`Enter`)$e.commit();else return;we(`focus`),ve(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(l&&e.key===`F2`){kt(U??void 0),e.preventDefault(),e.stopPropagation();return}if(V){if(e.key===`Escape`)A.current=!1,ae.current=null,t.closeSearch();else if(e.key===`Enter`){let e=t.getFocusedPath();e!=null&&t.selectOnlyPath(e);let n=C.current,r=CC(n,ft);ae.current=W<0||n==null?null:Math.max(0,Math.min(W*s-n.scrollTop,Math.max(0,r-s))),A.current=!0,t.closeSearch()}else if(e.key===`ArrowDown`)t.focusNextSearchMatch();else if(e.key===`ArrowUp`)t.focusPreviousSearchMatch();else return;we(`focus`),ve(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(f&&Ew(e)){t.openSearch(e.key),ve(e=>e+1),e.preventDefault(),e.stopPropagation();return}let n=We&&Ow(e),r=kw(e,We),i=r&&S.current!=null?SC(S.current):null,a=r?new Set(Lw(S.current)):new Set,o=i?.dataset.fileTreeStickyPath??null,c=i?.dataset.fileTreeStickyRow===`true`&&o!=null;if(c&&o!==U&&a.has(o)){let e=C.current;Pe(o,e?.scrollTop??null),t.focusPath(o)}let u=t.getFocusedPath(),d=t.getFocusedIndex(),p=t.getFocusedItem();if(p==null)return;let m=ww(p)?p:null,h=u!=null&&(vt.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=Iw(u,ne.current,te.current);e==null||n==null?y=!1:Ot(e,u)}else if((e.ctrlKey||e.metaKey)&&Tw(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;we(`focus`);let b=t.getFocusedPath(),x=b!=null&&(vt.has(b)||a.has(b)),ee=g&&b!==u,w=n&&c&&o===u&&b===u;if((h||w)&&b!=null&&(ee&&x||w))Pe(b,v?.scrollTop??null),O.current=!0,be(e=>e===b?e:b);else{let t=e.key===`ArrowUp`&&h&&b!==u;b!=null&&(t||_&&b===u)?(Fe(b,zw(S.current,v,i,u,s,_t,ft)),O.current=!0,be(e=>e===b?e:b)):Ne()}ve(e=>e+1),e.preventDefault(),e.stopPropagation()};QC(()=>{if(!(!f||!V)){if(R.current){R.current=!1;return}xC(ee.current)}},[V,f]),QC(()=>{let e=x.current;switch(AC({hasRenderedInput:e!=null,previousRenamingPath:ie.current,renamingPath:et})){case`reset`:ie.current=null;return;case`reveal-canonical`:et!=null&&At(et,{restoreTreeFocus:!1,targetOffset:`live-overlay`});return;case`ignore`:return;case`focus-input`:e!=null&&(Oe.current=null,ie.current=et,xC(e),e.select());return}},[pt.end,pt.start,et,At,vt]),QC(()=>{let e=S.current;if(e==null)return;let t=null,n=()=>{t!=null&&(clearTimeout(t),t=null)},r=()=>{let t=SC(e)?.dataset.itemPath??null;be(e=>e===t?e:t)},i=()=>{n(),O.current=!0,r()},a=i=>{let a=i.relatedTarget;if(a==null){n(),t=setTimeout(()=>{if(t=null,SC(e)!=null){r();return}O.current=!1,be(null)},0);return}if(!(a instanceof Node)||!e.contains(a)){n(),O.current=!1,be(null);return}let o=a instanceof HTMLElement?a.dataset.itemPath??null:null;be(e=>e===o?e:o)};return e.addEventListener(`focusin`,i),e.addEventListener(`focusout`,a),()=>{n(),e.removeEventListener(`focusin`,i),e.removeEventListener(`focusout`,a)}},[]),QC(()=>{let e=S.current;e!=null&&(G.physical.scrollTop<=0?e.dataset.scrollAtTop=`true`:delete e.dataset.scrollAtTop)},[G.physical.scrollTop]),QC(()=>{let e=null,n=C.current,r=b.current,i=S.current;if(n==null)return;T.current=CC(n,g);let a=()=>{let e=t.getVisibleCount(),r=wC(T.current,g),i=Math.max(0,e*s-r);n.scrollTop>i&&(n.scrollTop=i),Ve(fw({controller:t,itemHeight:s,overscan:c,scrollTop:Math.min(n.scrollTop,i),stickyFolders:h,viewportHeight:r}))};if(!re.current){re.current=!0;let e=t.getFocusedIndex();if(e>=0){let r=wC(T.current,g),i=t.getVisibleRows(e,e)[0]??null;EC(n,e,s,r,h&&i!=null?Math.max(0,Math.min(i.ancestorPaths.length*s,Math.max(0,r-s))):0)}}w.current=a;let o=t.subscribe(()=>{_C(ye)&&ve(e=>e+1),a()}),l=()=>{L.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,Ee(e=>e+1),e=null},50))},u=null,d=()=>{i!=null&&delete i.dataset.overlayReveal,u!=null&&(clearTimeout(u),u=null)},f=()=>{i!=null&&L.current!==!0&&(n.scrollTop>0||(i.dataset.overlayReveal=`true`,u!=null&&clearTimeout(u),u=setTimeout(()=>{d()},200)))},p=()=>{if(a(),n.scrollTop>0&&d(),I.current!=null&&y.current&&Tt.current(),L.current===!0){y.current=!1;return}N(e=>e==null?e:null),l()},m=()=>{l(),f()},_=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`PageUp`,`PageDown`,`Home`,`End`,` `,`Spacebar`]),v=e=>{_.has(e.key)&&m()};n.addEventListener(`scroll`,p,{passive:!0}),n.addEventListener(`wheel`,m,{passive:!0}),n.addEventListener(`touchmove`,m,{passive:!0}),n.addEventListener(`keydown`,v);let x=typeof ResizeObserver<`u`?new ResizeObserver(e=>{T.current=(e[0]==null?null:TC(e[0]))??CC(n,g),a()}):null;return x?.observe(n),()=>{w.current=()=>{},o(),n.removeEventListener(`scroll`,p),n.removeEventListener(`wheel`,m),n.removeEventListener(`touchmove`,m),n.removeEventListener(`keydown`,v),e!=null&&clearTimeout(e),u!=null&&clearTimeout(u),r!=null&&delete r.dataset.isScrolling,i!=null&&(delete i.dataset.isScrolling,delete i.dataset.overlayReveal),y.current=!1,T.current=null,x?.disconnect()}},[t,g,s,c,h]),QC(()=>{We||F==null||Et(!1)},[Et,We,F]);let qt=$C(()=>F==null?null:`${F.path}::${F.source}`,[F]);QC(()=>{if(qt==null){m?.clearSlotContent(Oh);return}let t=I.current;if(t==null)return;let n=v.current??_.current;if(n==null)return;let r={anchorElement:n,anchorRect:t.anchorRect??Mw(n.getBoundingClientRect()),close:e=>{Tt.current(e?.restoreFocus??!0)},restoreFocus:()=>{wt.current&&Ct.current(I.current?.path??null)}},i=e?.contextMenu?.render?.(t.item,r)??null;return m?.setSlotContent(Oh,i),e?.contextMenu?.onOpen?.(t.item,r),Gw(i),queueMicrotask(()=>{i==null||!i.isConnected||document.activeElement===i&&Gw(i)}),()=>{m?.clearSlotContent(Oh)}},[qt,e?.contextMenu,m]),QC(()=>{F!=null&&t.getItem(F.path)==null&&Et()},[Et,F,t]),QC(()=>{if(F==null)return;let e=S.current?.getRootNode(),t=e instanceof ShadowRoot?e.host:S.current,n=e=>{let n=e.target;n instanceof Node&&(jw(e)||_.current?.contains(n)!==!0&&t?.contains(n)!==!0&&Et())},r=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),Et())};return document.addEventListener(`mousedown`,n,!0),document.addEventListener(`keydown`,r,!0),()=>{document.removeEventListener(`mousedown`,n,!0),document.removeEventListener(`keydown`,r,!0)}},[Et,F]),QC(()=>{let e=C.current,n=S.current;if(e==null||n==null){k.current=U;return}let r=U==null?null:te.current.get(U)??null,i=SC(n),a=i?.dataset.itemPath??null,o=tt&&x.current===i,c=f&&ee.current===i,l=A.current&&!V,u=ae.current??0,d=Oe.current,p=ke.current,m=Ae.current,g=je.current,_=i!=null,v=O.current||_,y=k.current!==U,b=p!=null&&p===U&&U!=null,ne=!1,T=!1;if(nt!=null&&nt.id!==E.current){E.current=nt.id;let n=nt.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,ft-s))):_t;ne=!0,T=DC(e,n,s,ft,gt,nt.offset,t)}t.clearScrollRequest(nt.id)}let re=!ne&&l&&OC(e,W,s,ft,gt,u),D=!ne&&d!=null&&d===U&&OC(e,W,s,ft,gt,_t),ie=!ne&&m!=null&&m.path===U&&OC(e,W,s,ft,gt,m.viewportOffset),oe=!ne&&g!=null&&g.path===U&&e.scrollTop!==g.scrollTop;if(oe&&(e.scrollTop=g.scrollTop),(oe||T||D||ie||re||v&&y&&d!==U&&!b&&EC(e,W,s,ft,_t))&&w.current(),ne){k.current=U;return}if(!v){k.current=U;return}if(o){k.current=U;return}if(c&&!l){k.current=U;return}if(r==null){l&&W>=0&&(OC(e,W,s,ft,gt,u),w.current()),k.current=U;return}(y||l||d===U||p===U||m?.path===U||g?.path===U||a==null||a!==U)&&(xC(r),d===U&&(Oe.current=null),p===U&&(ke.current=null),m?.path===U&&(Ae.current=null),g?.path===U&&(je.current=null),A.current=!1,ae.current=null),k.current=U},[t,W,U,yt,s,tt,V,pt,ft,f,nt,h,_t,gt,dt]);let Jt=W>=0&&W>=G.visible.startIndex&&W<=G.visible.endIndex,Yt=U!=null&&mt.some(e=>lw(e.row)===U),Xt=Jt||Yt,Zt=Ke&&O.current===!0&&Xt?U:null,Qt=Ce===`pointer`?xe:null,$t=F?.path??Me.current??Qt??Zt??xe,en=F?.source===`right-click`;QC(()=>{y.current&&F==null||Dt(Xe($t))},[F,Xe,pt,ft,Te,mt,$t,Dt,dt]);let tn=ew(e=>{if(y.current||jw(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&&we(e=>e===`pointer`?e:`pointer`),N(e=>e===i?e:i)},[]),nn=ew(()=>{N(null)},[]);QC(()=>{if(!rt)return;let e=()=>{Rt(),t.cancelDrag()};return window.addEventListener(`dragend`,e),()=>{window.removeEventListener(`dragend`,e),Rt(),t.cancelDrag()}},[t,rt]);let rn=e=>{if(!rt||t.getDragSession()==null||pe.current)return;let n=vw(e.target instanceof HTMLElement?e.target:null);t.setDragTarget(n),Bt(t.getDragSession()?.target??null),Ht(e.clientX,e.clientY),e.dataTransfer!=null&&(e.dataTransfer.dropEffect=`move`),e.preventDefault()},an=e=>{if(!rt||t.getDragSession()==null||pe.current)return;let n=e.relatedTarget;n instanceof Node&&S.current?.contains(n)===!0||(Pt(),It(),t.setDragTarget(null))},on=e=>{!rt||t.getDragSession()==null||pe.current||(e.preventDefault(),zt(e.clientX,e.clientY),t.completeDrag(),Ft(),Pt(),It(),de.current=null)},sn=G.window.height,cn=G.window.offsetTop,ln=Math.min(0,ft-sn),un=Math.min(0,ft-sn-_t),dn=M===U||A.current,fn=U!=null&&dn&&!yt&&W>=0?dt[W]??t.getVisibleRows(W,W)[0]??null:null,pn=fn==null?null:kC(W,s,pt,sn),mn=de.current,hn=st!=null&&mn!=null&&mn.path===st&&mn.index>=pt.start&&mn.index<=pt.end,gn=st!=null&&mn!=null&&mn.path===st&&!hn&&mn.path!==fn?.path?mn:null,_n=gn==null?null:kC(gn.index,s,pt,sn),vn=Dw((W>=0?dt[W]??t.getVisibleRows(W,W)[0]??null:null)?.ancestorPaths.at(-1)??null),yn=V&&U!=null?Hw(o,U,!yt):void 0,bn=F?.path??(V?U:M),xn=F?.path??xe,Sn=Xe($t),Cn=We&&Ke&&!en&&!tt&&Sn!=null&&P!=null&&$t!=null,wn=We&&(Cn||F!=null),Tn=F?.anchorRect,En=Tn==null&&Sn!=null&&P!=null&&(F!=null||Cn)?P:null,Dn=Tn==null?En==null?void 0:{top:`${En}px`}:{left:`${Tn.left}px`,position:`fixed`,right:`auto`,top:`${Tn.top}px`},On=en?{opacity:`0`}:void 0,kn=ew((e,n,r,i)=>{let a=NC({event:{ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey},isDirectory:n.kind===`directory`,isSearchOpen:V,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)}let l=e.currentTarget instanceof HTMLElement?e.currentTarget:null,u=n.index>=G.visible.startIndex&&n.index<=G.visible.endIndex,d=i===`flow`&&u&&l!=null&&l.dataset.itemParked!==`true`;t.focusMountedPathFromInput(c),d&&(O.current=!0,be(e=>e===c?e:c),we(`focus`)),o&&t.toggleMountedDirectoryFromInput(c),a.closeSearch&&t.closeSearch(),a.revealCanonical&&At(c,{targetOffset:`sticky-parents`})},[t,V,G.visible.endIndex,G.visible.startIndex,At]),An=()=>{if(y.current||!Ke||$t==null||Sn==null)return;let e=t.getItem($t);e!=null&&(Dt(Sn),wt.current=!0,De({anchorRect:null,item:{kind:e.isDirectory()?`directory`:`file`,name:Sn.getAttribute(`aria-label`)??$t,path:e.getPath()},path:e.getPath(),source:`button`}))},jn={contextHoverPath:xn,contextMenuButtonTriggerEnabled:Ke,contextMenuButtonVisibility:z,contextMenuEnabled:We,contextMenuRightClickEnabled:qe,contextMenuTriggerMode:Ge,controller:t,directoriesWithGitChanges:i,dragAndDropEnabled:rt,draggedPathSet:at,dragTarget:ot,gitLaneActive:Ze,gitStatusByPath:n,handleRowDragEnd:Wt,handleRowDragStart:Ut,handleRowTouchStart:Gt,ignoredGitDirectories:r,ignoredInheritanceCache:_e,instanceId:o,itemHeight:s,onKeyDown:Kt,onRowClick:kn,openContextMenuForRow:Ot,registerButton:Je,registerRenameInput:Ye,renameView:$e,renderDecorationForRow:bt,resolveIcon:Qe,shouldSuppressContextMenu:jt,visualFocusPath:bn},Mn={...jn,registerButton:B};return Q(`div`,{ref:S,id:ct,"data-file-tree-context-menu-button-visibility":We&&Ke?z: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":Ze?`true`:void 0,"data-file-tree-virtualized-root":`true`,onDragLeave:rt?an:void 0,onDragOver:rt?rn:void 0,onDrop:rt?on:void 0,onKeyDown:Kt,onPointerLeave:We?nn:void 0,onPointerOver:We?tn:void 0,role:`tree`,tabIndex:-1,style:{outline:`none`,position:`relative`},children:[Q(`style`,{"data-file-tree-guide-style":`true`,dangerouslySetInnerHTML:{__html:vn}}),Q(`slot`,{name:Dh,"data-type":`header-slot`}),f?Q(`div`,{"data-file-tree-search-container":!0,"data-open":V?`true`:`false`,children:Q(`input`,{ref:ee,"aria-activedescendant":yn,"aria-controls":ct,placeholder:`Search…`,"data-file-tree-search-input":!0,"data-file-tree-search-input-fake-focus":Ie?`true`:void 0,value:H,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&&mt.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:`${lt}px`},children:mt.map((e,t)=>qw(Mn,e.row,`sticky:${lw(e.row)}`,{mode:`sticky`,style:{left:`0`,position:`absolute`,right:`0`,top:`${e.top}px`,zIndex:`${mt.length-t}`}}))})}):null,Q(`div`,{ref:b,"data-file-tree-virtualized-list":`true`,style:{height:`${gt}px`},children:[Q(`div`,{"data-file-tree-virtualized-sticky-offset":`true`,"aria-hidden":`true`,style:{height:`${cn}px`}}),Q(`div`,{"data-file-tree-virtualized-sticky":`true`,style:{height:`${sn}px`,top:`${ln}px`,bottom:`${un}px`},children:[Jw(jn,pt,vt),fn!=null&&pn!=null?qw(jn,fn,`parked:${fn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:st===fn.path?`none`:void 0,position:`absolute`,right:`0`,top:`${pn}px`}}):null,gn!=null&&_n!=null?qw(jn,gn,`parked-drag:${gn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:`none`,position:`absolute`,right:`0`,top:`${_n}px`}}):null]})]})]}),We?Q(`div`,{ref:_,"data-type":`context-menu-anchor`,"data-visible":wn?`true`:`false`,style:Dn,children:[Q(`button`,{ref:v,type:`button`,"data-type":kh,"aria-label":`Options`,"aria-haspopup":`menu`,"aria-expanded":F==null?`false`:`true`,"data-visible":Cn?`true`:`false`,onMouseDown:e=>{e.preventDefault()},onClick:e=>{if(e.preventDefault(),e.stopPropagation(),F!=null){Et();return}An()},tabIndex:-1,style:On,children:Q(BS,{...Qe(`file-tree-icon-ellipsis`)})}),F==null?null:Q(`slot`,{name:Oh})]}):null,F==null?null:Q(`div`,{"data-type":`context-menu-wash`,"aria-hidden":`true`,onMouseDownCapture:e=>{e.preventDefault(),Et()},onTouchStartCapture:e=>{e.preventDefault(),e.stopPropagation(),Et()},onTouchMoveCapture:e=>{e.preventDefault(),e.stopPropagation()},onWheelCapture:e=>{e.preventDefault(),e.stopPropagation()}})]})}var Xw={hydrateRoot:(e,t)=>{FS(dS(Yw,t),e)},renderRoot:(e,t)=>{PS(dS(Yw,t),e)},unmountRoot:e=>{PS(null,e)}};function Zw(e,t){Xw.renderRoot(e,t)}function Qw(e,t){Xw.hydrateRoot(e,t)}function $w(e){Xw.unmountRoot(e)}var eT=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)}}};Array.isArray;var tT=0;function nT(e){return e!=null&&e.length>0?e:(tT+=1,`pst_ft_${tT}`)}function rT({initialVisibleRowCount:e,itemHeight:t}){return e==null?420:Math.max(0,e)*(t??$g)}function iT(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 aT(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 oT(e){return Array.from(e.children).filter(e=>e instanceof SVGElement)}var sT=class{static LoadedCustomComponent=!0;#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=new eT;#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=nT(a),this.#p=Fx(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=Qg(n,c),this.#d={itemHeight:this.#u.itemHeight,overscan:d,stickyFolders:_,initialVisibleRowCount:y},this.#t=new Ax({...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&&($w(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()}getFocusedIndex(){return this.#t.getFocusedIndex()}getVisibleCount(){return this.#t.getVisibleCount()}getVisibleRows(e,t){return this.#t.getVisibleRows(e,t)}getSelectedPaths(){return this.#t.getSelectedPaths()}getComposition(){return this.#e}getItemHeight(){return this.#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)}focusFirstItem(){this.#t.focusFirstItem()}focusLastItem(){this.#t.focusLastItem()}focusNextItem(){this.#t.focusNextItem()}focusPreviousItem(){this.#t.focusPreviousItem()}focusParentItem(){this.#t.focusParentItem()}scrollToPath(e,t){this.#t.scrollToPath(e,t)}focusNearestPath(e){return this.#t.focusNearestPath(e)}add(e){this.#t.add(e)}batch(e){this.#t.batch(e)}applyGitStatusPatch(e){let t=Ix(this.#p,e);if(t===this.#p)return;this.#p=t;let n=this.#T();n!=null&&Zw(n.wrapper,this.#w())}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){Array.isArray(e)?this.#t.resetPaths(e,t):this.#t.resetPaths(e)}setComposition(e){this.#e=e;let t=this.#T();t!=null&&(this.#O(),Zw(t.wrapper,this.#w()))}setGitStatus(e){let t=Fx(e,this.#p);if(t===this.#p)return;this.#p=t;let n=this.#T();n!=null&&Zw(n.wrapper,this.#w())}setIcons(e){this.#m=e;let t=this.#T();t!=null&&(this.#E(t.host,t.wrapper),Zw(t.wrapper,this.#w()))}hydrate({fileTreeContainer:e}){let t=this.#P(e),n=this.#N(t);this.#O(),Qw(n,this.#w())}render({containerWrapper:e,fileTreeContainer:t}){let n=this.#P(t??this.#f,e),r=this.#N(n);this.#O(),Zw(r,this.#w())}#C(){return{initialViewportHeight:rT({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(Dh,e());return}this.#l.setSlotHtml(Dh,this.#e?.header?.html??null)}#k(e){let t=oT(e).find(e=>aT(e)),n=iT(Gg(Xg(this.#m).set));n!=null&&(t==null||t.outerHTML!==n.outerHTML)&&(t==null?e.prepend(n):t.replaceWith(n))}#A(e){let t=oT(e),n=t.find(e=>aT(e)),r=t.filter(e=>e!==n),i=Xg(this.#m).spriteSheet?.trim()??``;if(i.length===0){for(let e of r)e.remove();return}let a=iT(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=Xg(this.#m);t.colored&&qg(t.set)?e.dataset.fileTreeColoredIcons=`true`:delete e.dataset.fileTreeColoredIcons}#M(e){let t=e.querySelector(`style[${Ch}]`);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(Ch,``),this.#g.parentNode!==e&&e.appendChild(this.#g),this.#g.textContent=r_(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 l_(n,r),this.#M(r),n.dataset.fileTreeVirtualized=`true`,n.style.display=`flex`,this.#F(n),this.#l.setHost(n),this.#f=n,n}#F(e){e.style.getPropertyValue(`--trees-item-height`)===``&&(e.style.setProperty(`--trees-item-height`,`${String(this.#u.itemHeight)}px`),this.#x=!0),e.style.getPropertyValue(`--trees-density-override`)===``&&(e.style.setProperty(`--trees-density-override`,String(this.#u.factor)),this.#S=!0)}#I(e){this.#x&&=(e.style.removeProperty(`--trees-item-height`),!1),this.#S&&=(e.style.removeProperty(`--trees-density-override`),!1)}};function cT(e){let[t]=(0,V.useState)(()=>new sT(e)),n=(0,V.useRef)({timeout:null,model:t});return(0,V.useEffect)(()=>{let{current:e}=n;return e.timeout!=null&&(clearTimeout(e.timeout),e.timeout=null),()=>{e.timeout=setTimeout(()=>e.model.cleanUp(),1)}},[]),{model:t}}function lT({files:e,dirtyPaths:t,activePath:n,busy:r,onRefresh:a,onOpenFile:o}){let s=(0,V.useRef)({files:e,onOpenFile:o});s.current={files:e,onOpenFile:o};let{model:c}=cT({paths:[],initialExpansion:`open`,itemHeight:32,onSelectionChange(e){let t=e[0];t&&!t.endsWith(`/`)&&s.current.files.some(e=>e.path===t)&&s.current.onOpenFile(t)}}),l=(0,V.useMemo)(()=>{let n=new Set(t);return e.flatMap(e=>n.has(e.path)?[{path:e.path,status:`modified`}]:[])},[e,t]);return(0,V.useEffect)(()=>{c.resetPaths(e.map(e=>e.path))},[c,e]),(0,V.useEffect)(()=>{c.setGitStatus(l)},[c,l]),(0,V.useEffect)(()=>{for(let e of c.getSelectedPaths())e!==n&&c.getItem(e)?.deselect();n&&c.getItem(n)?.select()},[c,n]),(0,H.jsxs)(`aside`,{className:`inkcap-tree`,"aria-label":`Repository files`,children:[(0,H.jsxs)(`div`,{className:`inkcap-tree-toolbar`,children:[(0,H.jsxs)(`span`,{children:[(0,H.jsx)(Pm,{"aria-hidden":`true`}),` Explorer`]}),(0,H.jsx)(i,{icon:(0,H.jsx)(y,{}),"aria-label":`Refresh repository`,variant:`ghost`,size:`xs`,disabled:r,onClick:a})]}),(0,H.jsx)(`p`,{className:`inkcap-repository-legend`,children:`Changes in latest commit · drafts marked modified`}),(0,H.jsx)(Fh,{model:c,style:{flex:`1`,"--trees-item-height":`32px`,"--trees-padding-inline-override":`var(--spacing-xs)`,"--trees-item-margin-x-override":`0px`,"--trees-item-padding-x-override":`var(--spacing-xs)`,"--trees-item-row-gap-override":`var(--spacing-xs)`,"--trees-border-radius-override":`var(--radius-field)`,"--trees-bg-override":`var(--color-base-100)`,"--trees-fg-override":`var(--color-base-content)`,"--trees-bg-muted-override":`var(--color-base-200)`,"--trees-selected-bg-override":`var(--color-base-300)`,"--trees-font-family-override":`var(--font-sans)`,"--trees-font-size-override":`12px`}})]})}var uT={all:(e,t)=>[`inkcap-repository`,e,t],branch:(e,t,n)=>[...uT.all(e,t),n]};function dT({connection:e,repository:t,initialBranch:n,initialPath:r,openRequestId:i,transport:a,onReady:o}){let s=W(),[c,l]=(0,V.useState)(!1),[u,d]=(0,V.useState)(0),[f,p]=(0,V.useState)(new Map),[m,h]=(0,V.useState)(``),g=(0,V.useRef)(new AbortController);(0,V.useEffect)(()=>{let e=new AbortController;return g.current=e,()=>{e.abort()}},[]);let _=(0,V.useCallback)((t,n)=>a?a(t,n):e.app.capabilities.require(Rf).call(`app_bonsai`,t,JSON.stringify(n)),[e.app,a]),v=(0,V.useCallback)((e,t)=>vh(e,t,_,g.current.signal,e=>{d(t=>t+(e?1:-1))}),[_]),y=(0,V.useCallback)(()=>{s.invalidateQueries({queryKey:uT.all(e.app.identity.surfaceId,t)})},[s,e.app,t]),b=(0,V.useRef)(new Map),x=(0,V.useMemo)(()=>{let r=`${e.app.identity.surfaceId}:${t}:${n}`,i=b.current.get(r);if(i?.app===e.app)return i;let a=yh({repository:t,branch:n,request:v,onSaved:y,onSaveState:(e,r)=>{g.current.signal.aborted||p(i=>{let a=new Map(i),o=`${t}:${n}:${e}`;return r===null?a.delete(o):a.set(o,r),a})}}),o={app:e.app,source:a};return b.current.set(r,o),o},[t,n,v,y,e.app]),S=mh({connection:x}),C=xn({queryKey:uT.branch(e.app.identity.surfaceId,t,n),queryFn:()=>bh(v,t,n),refetchInterval:15e3});(0,V.useEffect)(()=>e.app.window.onBeforeClose(S.requestWindowClose),[e.app,S.requestWindowClose]),(0,V.useEffect)(()=>{o?.({requestWindowClose:S.requestWindowClose})},[o,S.requestWindowClose]);let ee=(0,V.useRef)(),te=(0,V.useRef)(new Map),ne=(0,V.useRef)(new Set);(0,V.useEffect)(()=>{if(!C.data)return;let e=`${x.app.identity.surfaceId}:${x.source.id}:${i}`;ee.current!==e&&(ee.current=e,S.onOpenFile(r));let t=te.current.get(x.source.id),n=t!==void 0&&t!==C.data.head;te.current.set(x.source.id,C.data.head);let a=new Set(S.tabs.map(e=>e.tabKey));for(let e of ne.current)a.has(e)||ne.current.delete(e);for(let e of S.tabs)if(!(e.target.closed||e.connection!==x||!n&&!ne.current.has(e.tabKey))){if(e.target.saving){ne.current.add(e.tabKey);continue}ne.current.delete(e.tabKey),e.target.dirty||S.onReopen(e,{background:!0})}},[C.data,x,r,i,S]);let w=S.tabs.find(e=>e.tabKey===S.active),T=w?.connection?.source?f.get(`${w.connection.source.id}:${w.path}`):void 0,E=T?.kind===`saved`?`Saved · syncing`:T?.kind===`synced`?`Synced · ${T.commit.slice(0,7)}`:T?.kind===`conflict`?`Sync conflict · Compare`:T?.kind===`failed`?`Sync failed · Retry`:void 0;async function re(){if(!w?.connection?.source)return;let e=b.current.get(`${w.connection.app.identity.surfaceId}:${w.connection.source.id}`);if(e)try{h(``),await e.source.retry(w.path,g.current.signal)}catch(e){console.error(`Bonsai sync retry failed`,e),h(`Could not retry sync. Your saved text remains in Bonsai.`)}}async function D(){if(!w?.connection?.source)return;let e=()=>!w.target.dirty&&!w.target.saving&&!w.target.closed;if(!e())return;let t=b.current.get(`${w.connection.app.identity.surfaceId}:${w.connection.source.id}`);if(t)try{h(``);let n=await t.source.read(w.path,g.current.signal);if(n.kind!==`text`)throw Error(`This saved text is unavailable.`);if(!e())return;await t.source.replace(w.path,n.contents,n.contents,g.current.signal)}catch(e){console.error(`Bonsai explicit re-save failed`,e),h(`Could not save again. Your saved text and open edits remain available.`)}}return(0,H.jsxs)(`div`,{className:`inkcap-repository`,children:[(0,H.jsxs)(`div`,{className:`inkcap-repository-toolbar`,children:[(0,H.jsxs)(`span`,{className:`inkcap-repository-name`,children:[(0,H.jsx)(Fm,{"aria-hidden":`true`}),` `,t,` · `,n]}),(0,H.jsxs)(ve,{size:`sm`,variant:`ghost`,onClick:()=>{l(!0)},children:[(0,H.jsx)(Im,{"aria-hidden":`true`}),` History`]})]}),u>0&&(0,H.jsx)(gh,{message:`Loading this repository…`}),C.data?.truncated&&(0,H.jsx)(Bf,{tone:`info`,title:`Only the indexed files are shown`}),m&&(0,H.jsx)(Bf,{tone:`error`,title:`Sync unavailable`,description:m}),T?.kind===`failed`&&(0,H.jsx)(Bf,{tone:`warning`,title:T.reason===`permanent_material`?`Sync needs a new save`:`Sync failed`,description:T.reason===`permanent_material`?`Your text is saved. Save again using the current repository state to retry sync.`:`Your file is saved in Bonsai. Retry when access is available.`,action:(0,H.jsx)(ve,{size:`sm`,disabled:T.reason===`permanent_material`&&w!==void 0&&(w.target.dirty||w.target.saving),onClick:()=>void(T.reason===`permanent_material`?D():re()),children:T.reason===`permanent_material`?`Save again`:`Retry`})}),(0,H.jsx)(nh,{model:{...S,repositoryStatus:E,repositoryStates:f,canList:!0,sourceLabel:x.source.label,onReadCurrent:async(e,t)=>{if(e.connection?.source?.kind!==`repository`)return S.onReadCurrent(e);let n=b.current.get(`${e.connection.app.identity.surfaceId}:${e.connection.source.id}`);if(!n||e.target.closed)throw Error(`This Bonsai file is no longer open.`);return t&&await n.source.discard(e.path,g.current.signal),n.source.readCommitted(e.path,g.current.signal)},error:C.error?`Could not refresh this repository. Your open edits remain available.`:S.error,fileTree:e=>(0,H.jsx)(lT,{files:C.data?.files??[],dirtyPaths:S.tabs.filter(e=>e.connection===x&&e.dirty).map(e=>e.path),activePath:w?.connection===x?w.path:null,busy:C.isFetching,onRefresh:y,onOpenFile:e})}}),(0,H.jsx)(Be,{open:c,onOpenChange:l,children:(0,H.jsxs)(Fe,{children:[(0,H.jsxs)(ke,{children:[(0,H.jsx)(Le,{children:`Commit history`}),(0,H.jsxs)(Se,{children:[t,` · `,n]})]}),(0,H.jsx)(`ol`,{className:`inkcap-repository-history`,children:C.data?.history.map(e=>(0,H.jsxs)(`li`,{children:[(0,H.jsx)(`code`,{children:e.hash.slice(0,7)}),` `,e.message,(0,H.jsx)(`span`,{className:`text-dim`,children:e.author.name})]},e.hash))})]})})]})}function fT(e){if(e?.kind!==`navigate`||!e.params.some(({key:e})=>e===`repository`))return null;let t=Wp(e.params);return t===null||!(`repository`in t)?`invalid`:{repository:t.repository,initialBranch:t.branch,initialPath:t.path,openRequestId:e.requestId}}function pT(e,t){return e.kind===`computer`||t.kind===`computer`?e.kind===t.kind:e.repository===t.repository&&e.initialBranch===t.initialBranch&&e.initialPath===t.initialPath&&e.openRequestId===t.openRequestId}function mT(e){let[t,n]=(0,V.useState)(e),r=(0,V.useRef)(null),i=(0,V.useRef)(!1);return(0,V.useEffect)(()=>{if(!pT(e,t)){if(e.kind===t.kind){n(e);return}i.current||(i.current=!0,(r.current??(()=>Promise.resolve(!0)))().then(t=>{i.current=!1,t&&n(e)}))}},[e,t]),{mounted:t,registerHandle:(0,V.useCallback)(e=>{r.current=e},[])}}function hT({app:e,computerName:t,projectPath:n}){let r=Yd(e),i=fT(r?.openRequest??null),a=e?.capabilities.has(Rf)??!1,{mounted:o,registerHandle:s}=mT(i!==null&&i!==`invalid`&&a?{kind:`repository`,...i}:{kind:`computer`}),c=(0,V.useCallback)(e=>{s(e.requestWindowClose)},[s]);return o.kind===`repository`&&e!==null?(0,H.jsx)(dT,{connection:{app:e},repository:o.repository,initialBranch:o.initialBranch,initialPath:o.initialPath,openRequestId:o.openRequestId,onReady:c}):(0,H.jsxs)(H.Fragment,{children:[i===`invalid`?(0,H.jsx)(Bf,{tone:`warning`,title:`This repository link cannot be opened`,description:`Open the file again from Bonsai. Computer files and local drafts are still available.`}):i!==null&&!a&&(0,H.jsx)(Bf,{tone:`info`,title:`Repositories open from Bonsai`,description:`This host can still open Computer files and local drafts.`}),(0,H.jsx)(hh,{connection:e?{app:e}:null,context:{computerId:r?.computerId??null,computerName:t,projectPath:n},onReady:c})]})}var gT=document.getElementById(`inkcap-root`);if(!gT)throw Error(`Inkcap root is missing`);var _T=new URLSearchParams(window.location.search),vT=Re(k({project:v(A),computerName:v(A)}))({project:_T.get(`project`),computerName:_T.get(`computerName`)}),yT=vT.project?.trim()??`/`;Kd(gT,{name:`Inkcap`,queryClient:Pf()},({app:e})=>(0,V.createElement)(hT,{app:e,computerName:vT.computerName,projectPath:yT.startsWith(`/`)?yT:`/${yT}`}));export{It as A,vn as C,pn as D,hn as E,W as F,et as I,st as M,_t as N,un as O,vt as P,yn as S,gn as T,Mf as _,Jm as a,Xr as b,Nm as c,Yp as d,um as f,Ff as g,Bf as h,Ym as i,Mt as j,Xt as k,Tm as l,mm as m,Fh as n,Km as o,lm as p,$m as r,Pm as s,cT as t,Om as u,Xd as v,mn as w,_n as x,Yr as y};