@inkeep/open-knowledge 0.16.0-beta.8 → 0.16.0-beta.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/skills/discovery/SKILL.md +1 -1
- package/dist/assets/skills/project/SKILL.md +1 -1
- package/dist/cli.mjs +6 -6
- package/dist/constants-CskWj3B2.mjs +2 -0
- package/dist/{dist-D-pHt8v5.mjs → dist-OkE9CWV7.mjs} +4 -4
- package/dist/{dist-DqAE3WJF.mjs → dist-VlbtUCrL.mjs} +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{init-B7jb-4vJ.mjs → init-Cptu2scc.mjs} +4 -4
- package/dist/init-Dj7AdInx.mjs +1 -0
- package/dist/loader-BQSQ22vQ.mjs +1 -0
- package/dist/{loader-CwF0NImR.mjs → loader-C2qB5tLx.mjs} +2 -2
- package/dist/preview-C-gKbR7n.mjs +1 -0
- package/dist/{preview-BH7vYylY.mjs → preview-DlZZLAeI.mjs} +2 -2
- package/dist/public/assets/{TerminalPanel-CeisyLzZ.js → TerminalPanel-DcDjQXhj.js} +2 -1
- package/dist/public/assets/{index-0FQ5zrL_.js → index-DFeQw4o4.js} +87 -87
- package/dist/public/index.html +1 -1
- package/dist/{repair-launch-json-CRBjS8is.mjs → repair-launch-json-Caz9kRDS.mjs} +2 -2
- package/dist/{repair-mcp-configs-D0eELNX5.mjs → repair-mcp-configs-BU9eFi8F.mjs} +2 -2
- package/dist/{repair-skills-DTHPnNw2.mjs → repair-skills-DXJ3J6ZY.mjs} +2 -2
- package/dist/repair-skills-cN5SmgIr.mjs +1 -0
- package/dist/{src-AM7i2BoX.mjs → src-Db0hco2E.mjs} +2 -2
- package/dist/{start-Jyo69OnN.mjs → start-Bo58FRzd.mjs} +2 -2
- package/dist/start-CkLleuVO.mjs +1 -0
- package/dist/{write-project-skill-Dhcde0pz.mjs → write-project-skill-CqF_h3dw.mjs} +2 -2
- package/package.json +1 -1
- package/dist/constants-DUfUMDIj.mjs +0 -2
- package/dist/init-Pw5xQLSM.mjs +0 -1
- package/dist/loader-B_itRulW.mjs +0 -1
- package/dist/preview-B9uFRo_2.mjs +0 -1
- package/dist/repair-skills-D0bc5uKB.mjs +0 -1
- package/dist/start-YqhEjdBV.mjs +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./telemetry-impl-B69NnnZ-.js","./chunk-CFjPhJqf.js","./preload-helper-2ej06EnG.js","./trace-api-DPMyR1_m.js","./propagation-api-qAYD7s-v.js","./ConsentDialogBody-C3cfuPKS.js","./compiler-runtime-Cs91PcD2.js","./checkbox-LNtTTZgr.js","./dist-CUqyztDT.js","./button-CNAPefQE.js","./dialog-CtMCOb1V.js","./dist-rFfpDyC7.js","./collapsible-CiYR1NR5.js","./textarea-BeqA3EKD.js","./tooltip-Bp4cM4E8.js","./dist-qcpgtxJO.js","./project-paths-By95zyI0.js","./McpConsentDialogBody-CG9ncDqv.js","./mcp-consent-store-BmlKYN7O.js","./ActivityPanelDiffView-InYkbArk.js","./ActivityPanelDiffView-legcy4jI.css","./GraphPanel-DyflXJJp.js","./dist-BD6tLdRV.js","./w3c-keyname-nBRha8PK.js","./prop-types-BODc2m6A.js","./toggle-group-Df7XaPvr.js","./panel-B_EgE6h3.js","./min-C7ZjdWf5.js","./src-DXWvEiD2.js","./colors-CzI3Rf3d.js","./ordinal-C2dFitP3.js","./init-Cvjgvi8K.js","./isObjectLike-BWNDxuxw.js","./now-F1RJRIcM.js","./isSymbol-W-l9JIco.js","./target-navigation-intent-C6og7F5u.js","./ActivityModeContent-DUAxBa3K.js","./DocumentContext-DbtJW9Gq.js","./dist-Mxq-zflt.js","./dist-C0jOOVYt.js","./dist-B-IVhlJQ.js","./dist-Bn0QvNGs.js","./dist-Bui1BhSw.js","./dist-j3LJSXW6.js","./dist-Debx6b6u.js","./dist-B9B58-J_.js","./dist-pSQcUvmU.js","./stex-CGHNatva.js","./DocumentContext-B0sQn39F.css","./agent-presence-CarzuseD.js","./dist-D1rVZYi52.js","./dist-CjXb6uie.js","./SettingsDialogBody-B797RBJT.js","./config-validation-events-DIHaBC6e.js","./keyboard-shortcuts-ClXLEPJw.js","./SourceEditor-Ddk4Onbm.js","./OpenInAgentMenuRequestContext-CQnJKj7m.js","./TerminalPanel-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./telemetry-impl-B69NnnZ-.js","./chunk-CFjPhJqf.js","./preload-helper-2ej06EnG.js","./trace-api-DPMyR1_m.js","./propagation-api-qAYD7s-v.js","./ConsentDialogBody-C3cfuPKS.js","./compiler-runtime-Cs91PcD2.js","./checkbox-LNtTTZgr.js","./dist-CUqyztDT.js","./button-CNAPefQE.js","./dialog-CtMCOb1V.js","./dist-rFfpDyC7.js","./collapsible-CiYR1NR5.js","./textarea-BeqA3EKD.js","./tooltip-Bp4cM4E8.js","./dist-qcpgtxJO.js","./project-paths-By95zyI0.js","./McpConsentDialogBody-CG9ncDqv.js","./mcp-consent-store-BmlKYN7O.js","./ActivityPanelDiffView-InYkbArk.js","./ActivityPanelDiffView-legcy4jI.css","./GraphPanel-DyflXJJp.js","./dist-BD6tLdRV.js","./w3c-keyname-nBRha8PK.js","./prop-types-BODc2m6A.js","./toggle-group-Df7XaPvr.js","./panel-B_EgE6h3.js","./min-C7ZjdWf5.js","./src-DXWvEiD2.js","./colors-CzI3Rf3d.js","./ordinal-C2dFitP3.js","./init-Cvjgvi8K.js","./isObjectLike-BWNDxuxw.js","./now-F1RJRIcM.js","./isSymbol-W-l9JIco.js","./target-navigation-intent-C6og7F5u.js","./ActivityModeContent-DUAxBa3K.js","./DocumentContext-DbtJW9Gq.js","./dist-Mxq-zflt.js","./dist-C0jOOVYt.js","./dist-B-IVhlJQ.js","./dist-Bn0QvNGs.js","./dist-Bui1BhSw.js","./dist-j3LJSXW6.js","./dist-Debx6b6u.js","./dist-B9B58-J_.js","./dist-pSQcUvmU.js","./stex-CGHNatva.js","./DocumentContext-B0sQn39F.css","./agent-presence-CarzuseD.js","./dist-D1rVZYi52.js","./dist-CjXb6uie.js","./SettingsDialogBody-B797RBJT.js","./config-validation-events-DIHaBC6e.js","./keyboard-shortcuts-ClXLEPJw.js","./SourceEditor-Ddk4Onbm.js","./OpenInAgentMenuRequestContext-CQnJKj7m.js","./TerminalPanel-DcDjQXhj.js","./terminal-theme-BhdZI3O9.js","./TerminalPanel-BrP-ENHg.css"])))=>i.map(i=>d[i]);
|
|
2
2
|
import{o as e,t}from"./chunk-CFjPhJqf.js";import{t as n}from"./preload-helper-2ej06EnG.js";import{a as r,i,n as a,o,r as s,t as c}from"./compiler-runtime-Cs91PcD2.js";import{$ as l,$n as u,$t as d,A as f,An as p,At as m,Bn as h,Bt as g,C as _,Cn as v,Ct as y,Dn as b,Dt as x,En as S,Et as C,F as w,Fn as T,Ft as E,Gn as D,Gt as O,Hn as k,Ht as A,I as j,In as M,It as N,J as P,Jn as F,Jt as I,K as L,Kn as R,Kt as z,L as B,Ln as V,Lt as H,M as U,Mt as W,N as G,Nn as K,Nt as q,On as J,Ot as ee,P as te,Pn as ne,Pt as re,Q as Y,Qn as ie,Qt as ae,R as oe,Rn as se,Rt as ce,S as le,Sn as ue,St as de,T as fe,Tn as pe,Tt as me,Un as he,Ut as ge,Vn as _e,Vt as ve,W as ye,Wn as be,Wt as xe,X as Se,Xn as Ce,Xt as we,Y as Te,Yn as Ee,Yt as De,Z as Oe,Zn as ke,Zt as Ae,_n as je,_t as Me,a as Ne,an as Pe,ar as Fe,at as Ie,bn as Le,c as Re,cr as ze,ct as Be,d as Ve,dr as He,dt as Ue,en as We,er as Ge,et as Ke,f as qe,fr as Je,ft as Ye,g as Xe,gt as Ze,h as Qe,hr as $e,ht as et,i as tt,ir as nt,it as rt,j as it,jn as at,jt as ot,k as st,kn as ct,kt as lt,l as ut,lt as dt,m as ft,mr as pt,mt,n as ht,nn as gt,nr as _t,nt as vt,o as yt,or as bt,ot as xt,p as St,pr as Ct,pt as wt,q as Tt,qn as Et,qt as Dt,r as Ot,rn as kt,rt as At,s as jt,st as Mt,t as Nt,tn as Pt,tt as Ft,u as It,ur as Lt,ut as Rt,v as zt,vn as Bt,vt as Vt,w as Ht,wn as Ut,wt as Wt,xn as Gt,y as Kt,yn as qt,yt as Jt,z as Yt,zn as Xt,zt as Zt}from"./DocumentContext-DbtJW9Gq.js";import{A as Qt,C as $t,D as en,E as tn,O as nn,S as rn,T as an,_ as on,a as sn,b as cn,c as ln,d as un,f as dn,g as fn,h as pn,i as mn,k as hn,l as gn,m as _n,n as vn,o as yn,p as bn,r as xn,s as Sn,t as Cn,u as wn,v as Tn,w as En,x as Dn,y as On}from"./panel-B_EgE6h3.js";import{$n as kn,A as An,An as jn,Ar as Mn,At as Nn,B as Pn,C as Fn,Dn as In,Dt as Ln,F as Rn,Ft as zn,Gn as Bn,Gr as Vn,Gt as Hn,Ir as Un,Jt as Wn,Kt as Gn,Lt as Kn,M as qn,N as Jn,Nn as Yn,Nr as Xn,Nt as Zn,O as Qn,Pr as $n,Pt as er,Qt as tr,St as nr,Un as rr,Ur as ir,Vr as ar,Wr as or,Wt as sr,X as cr,Xn as lr,Xt as ur,Yt as dr,Zt as fr,an as pr,ar as mr,at as hr,b as gr,br as _r,c as vr,ci as yr,cn as br,dn as xr,dr as Sr,er as Cr,fn as wr,fr as Tr,gn as Er,hr as Dr,i as Or,in as kr,ir as Ar,j as jr,jn as Mr,kr as Nr,li as Pr,ln as Fr,lr as Ir,mn as Lr,mr as Rr,mt as zr,n as Br,ni as Vr,nn as Hr,or as Ur,pt as Wr,qt as Gr,rn as Kr,rr as qr,sr as Jr,t as Yr,tn as Xr,un as Zr,ut as Qr,vn as $r,w as ei,xr as ti,xt as ni,z as ri,zt as ii}from"./dist-BD6tLdRV.js";import{c as ai,d as oi,l as si,r as ci,t as li,u as ui}from"./button-CNAPefQE.js";import{a as di,c as fi,d as pi,f as mi,i as hi,l as gi,m as _i,n as vi,o as yi,p as bi,r as xi,s as Si,t as Ci,u as wi}from"./agent-presence-CarzuseD.js";import{$ as Ti,$t as Ei,A as Di,At as Oi,B as ki,Bt as Ai,C as ji,Ct as Mi,D as Ni,Dt as Pi,E as Fi,Et as Ii,F as Li,Ft as Ri,G as zi,Gt as Bi,H as Vi,Ht as Hi,I as Ui,It as Wi,J as Gi,Jt as Ki,K as qi,Kt as Ji,L as Yi,Lt as Xi,M as Zi,Mt as Qi,N as $i,Nt as ea,O as ta,Ot as na,P as ra,Pt as ia,Q as aa,Qt as oa,R as sa,Rt as ca,S as la,St as ua,T as da,Tt as fa,U as pa,Ut as ma,V as ha,Vt as ga,W as _a,Wt as va,X as ya,Xt as ba,Y as xa,Yt as Sa,Z as Ca,Zt as wa,_t as Ta,an as Ea,at as Da,b as Oa,bt as ka,ct as Aa,dt as ja,en as Ma,et as Na,ft as Pa,gt as Fa,ht as Ia,in as La,it as Ra,j as za,jt as Ba,k as Va,kt as Ha,lt as Ua,m as Wa,mt as Ga,nn as Ka,nt as qa,o as Ja,on as Ya,ot as Xa,p as Za,q as Qa,qt as $a,r as eo,rt as to,sn as no,st as ro,t as io,tn as ao,tt as oo,u as so,ut as co,vt as lo,w as uo,wt as fo,x as po,xt as mo,y as ho,yt as go,z as _o,zt as vo}from"./config-validation-events-DIHaBC6e.js";import{i as yo,n as bo,r as xo,t as So}from"./toggle-group-Df7XaPvr.js";import{a as Co,c as wo,i as To,n as Eo,o as Do,s as Oo,t as ko,v as Ao}from"./dialog-CtMCOb1V.js";import{a as jo,i as Mo,n as No,o as Po,r as Fo,t as Io}from"./collapsible-CiYR1NR5.js";import{A as Lo,B as Ro,C as zo,D as Bo,E as Vo,F as Ho,H as Uo,I as Wo,L as Go,M as Ko,N as qo,O as Jo,P as Yo,R as Xo,S as Zo,T as Qo,V as $o,_ as es,a as ts,c as ns,g as rs,i as is,j as as,k as os,l as ss,m as cs,n as ls,o as us,s as ds,v as fs,w as ps,x as ms,z as hs}from"./prop-types-BODc2m6A.js";import{n as X,r as gs,t as _s}from"./dist-rFfpDyC7.js";import{a as vs,d as ys,f as bs,i as xs,l as Ss,o as Cs,s as ws}from"./dist-CUqyztDT.js";import{_ as Ts,b as Es,d as Ds,f as Os,g as ks,h as As,i as js,m as Ms,n as Ns,p as Ps,r as Fs,t as Is,u as Ls,v as Rs,y as zs}from"./tooltip-Bp4cM4E8.js";import{n as Bs,t as Vs}from"./checkbox-LNtTTZgr.js";import{n as Hs,r as Us,t as Ws}from"./dist-qcpgtxJO.js";import{n as Gs,r as Ks,t as qs}from"./textarea-BeqA3EKD.js";import{a as Js,i as Ys,n as Xs,r as Zs}from"./project-paths-By95zyI0.js";import{n as Qs,t as $s}from"./mcp-consent-store-BmlKYN7O.js";import{c as ec,i as tc,l as nc,o as rc}from"./keyboard-shortcuts-ClXLEPJw.js";import{$ as ic,At as ac,Ct as oc,Dt as sc,Ft as cc,I as lc,It as uc,J as dc,Mt as fc,Ot as pc,Pt as mc,Q as hc,Tt as gc,X as _c,Z as vc,at as yc,bt as bc,jt as xc,k as Sc,w as Cc}from"./dist-C0jOOVYt.js";import{n as wc}from"./dist-B9B58-J_.js";import{c as Tc,d as Ec,f as Dc,h as Oc,i as kc,l as Ac,o as jc,r as Mc,s as Nc,t as Pc,u as Fc}from"./OpenInAgentMenuRequestContext-CQnJKj7m.js";import{t as Ic}from"./target-navigation-intent-C6og7F5u.js";import{t as Lc}from"./terminal-theme-BhdZI3O9.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),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();function Rc(){({BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_APP_VERSION:`0.15.0`})?.VITE_OTEL_ENABLED===`true`&&n(()=>import(`./telemetry-impl-B69NnnZ-.js`).then(e=>e.install()),__vite__mapDeps([0,1,2,3,4]),import.meta.url)}function zc(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=>{fn(e,()=>t.signal,()=>n=!0)},u=On(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject();if(r==null&&e.pages.length)return Promise.resolve(e);let a=await u((()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})()),{maxPages:o}=t.options,s=i?Tn:on;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?Vc:Bc,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:Bc(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function Bc(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 Vc(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var Hc=class extends dn{#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||Uc(),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.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=bn({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)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),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:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}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.#n.runNext(this)}}#i(e){this.state=(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),pn.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Uc(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Wc=class extends Qt{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new Hc({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=Gc(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=Gc(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=Gc(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=Gc(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){pn.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=>$t(t,e))}findAll(e={}){return this.getAll().filter(t=>$t(e,t))}notify(e){pn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return pn.batch(()=>Promise.all(e.map(e=>e.continue().catch(an))))}};function Gc(e){return e.options.scope?.id}var Kc=class extends Qt{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??rn(r,t),a=this.get(i);return a||(a=new un({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(){pn.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=>En(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>En(e,t)):t}notify(e){pn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){pn.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){pn.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},qc=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Kc,this.#t=e.mutationCache||new Wc,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=hn.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=_n.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(en(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=cn(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return pn.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;pn.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return pn.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=pn.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(an).catch(an)}invalidateQueries(e,t={}){return pn.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=pn.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(an)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(an)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(en(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(an).catch(an)}fetchInfiniteQuery(e){return e.behavior=zc(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(an).catch(an)}ensureInfiniteQueryData(e){return e.behavior=zc(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return _n.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(Dn(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{tn(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(Dn(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{tn(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||=rn(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===nn&&(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()}},Jc=t((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),Yc=t(((e,t)=>{t.exports=Jc()})),Xc=t((e=>{var t=Yc(),n=r(),i=oi();function a(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function o(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function s(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function c(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function u(e){if(s(e)!==e)throw Error(a(188))}function d(e){var t=e.alternate;if(!t){if(t=s(e),t===null)throw Error(a(188));return t===e?e:null}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var o=i.alternate;if(o===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===o.child){for(o=i.child;o;){if(o===n)return u(i),e;if(o===r)return u(i),t;o=o.sibling}throw Error(a(188))}if(n.return!==r.return)n=i,r=o;else{for(var c=!1,l=i.child;l;){if(l===n){c=!0,n=i,r=o;break}if(l===r){c=!0,r=i,n=o;break}l=l.sibling}if(!c){for(l=o.child;l;){if(l===n){c=!0,n=o,r=i;break}if(l===r){c=!0,r=o,n=i;break}l=l.sibling}if(!c)throw Error(a(189))}}if(n.alternate!==r)throw Error(a(190))}if(n.tag!==3)throw Error(a(188));return n.stateNode.current===n?e:t}function f(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=f(e),t!==null)return t;e=e.sibling}return null}var p=Object.assign,m=Symbol.for(`react.element`),h=Symbol.for(`react.transitional.element`),g=Symbol.for(`react.portal`),_=Symbol.for(`react.fragment`),v=Symbol.for(`react.strict_mode`),y=Symbol.for(`react.profiler`),b=Symbol.for(`react.consumer`),x=Symbol.for(`react.context`),S=Symbol.for(`react.forward_ref`),C=Symbol.for(`react.suspense`),w=Symbol.for(`react.suspense_list`),T=Symbol.for(`react.memo`),E=Symbol.for(`react.lazy`),D=Symbol.for(`react.activity`),O=Symbol.for(`react.memo_cache_sentinel`),k=Symbol.iterator;function A(e){return typeof e!=`object`||!e?null:(e=k&&e[k]||e[`@@iterator`],typeof e==`function`?e:null)}var j=Symbol.for(`react.client.reference`);function M(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===j?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case _:return`Fragment`;case y:return`Profiler`;case v:return`StrictMode`;case C:return`Suspense`;case w:return`SuspenseList`;case D:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case g:return`Portal`;case x:return e.displayName||`Context`;case b:return(e._context.displayName||`Context`)+`.Consumer`;case S:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case T:return t=e.displayName||null,t===null?M(e.type)||`Memo`:t;case E:t=e._payload,e=e._init;try{return M(e(t))}catch{}}return null}var N=Array.isArray,P=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,I={pending:!1,data:null,method:null,action:null},L=[],R=-1;function z(e){return{current:e}}function B(e){0>R||(e.current=L[R],L[R]=null,R--)}function V(e,t){R++,L[R]=e.current,e.current=t}var H=z(null),U=z(null),W=z(null),G=z(null);function K(e,t){switch(V(W,t),V(U,e),V(H,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}B(H),V(H,e)}function q(){B(H),B(U),B(W)}function J(e){e.memoizedState!==null&&V(G,e);var t=H.current,n=Hd(t,e.type);t!==n&&(V(U,e),V(H,n))}function ee(e){U.current===e&&(B(H),B(U)),G.current===e&&(B(G),Qf._currentValue=I)}var te,ne;function re(e){if(te===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);te=t&&t[1]||``,ne=-1<e.stack.indexOf(`
|
|
3
3
|
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
4
4
|
`+te+e+ne}var Y=!1;function ie(e,t){if(!e||Y)return``;Y=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,`props`,{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,`name`,{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
|
@@ -26,7 +26,7 @@ Error generating stack: `+e.message+`
|
|
|
26
26
|
`).trim();return i.length===0||i.length>ew||i.includes(`
|
|
27
27
|
`)?null:i}function aw(e){let t=Be(e.state);return{current:t.matches.length===0?0:t.activeIndex+1,total:t.matches.length}}function ow(e,t){return e.current===t.current&&e.total===t.total}function sw(e,t,n){e&&!e.isDestroyed&&(e.commands.clearFindMatches(),e.commands.focus()),t(e=>({...e,open:!1,activeIndex:0})),n($C)}function cw(e){!e||e.isDestroyed||typeof window>`u`||window.requestAnimationFrame(()=>{if(e.isDestroyed)return;let t=w(e);if(!t)return;let n=t.dom.querySelector(`.ok-find-match-active`);n instanceof HTMLElement&&n.scrollIntoView({block:`center`,inline:`nearest`,behavior:`auto`})})}function lw(e){let t=(0,$.c)(81),{activeDocName:n,isSourceMode:r}=e,i=nw(n),a=(0,Q.useRef)(null),o=(0,Q.useRef)(null),s=(0,Q.useRef)(n),c=(0,Q.useRef)(0),l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l={open:!1,replaceOpen:!1,query:``,replacement:``,caseSensitive:!1,wholeWord:!1,activeIndex:0},t[0]=l):l=t[0];let[u,d]=(0,Q.useState)(l),[f,p]=(0,Q.useState)($C),m,h;t[1]===n?(m=t[2],h=t[3]):(m=()=>{s.current!==n&&(s.current=n,d(dw))},h=[n],t[1]=n,t[2]=m,t[3]=h),(0,Q.useEffect)(m,h);let g,_;t[4]===u.activeIndex?(g=t[5],_=t[6]):(g=()=>{c.current=u.activeIndex},_=[u.activeIndex],t[4]=u.activeIndex,t[5]=g,t[6]=_),(0,Q.useEffect)(g,_);let v,y;t[7]===i?(v=t[8],y=t[9]):(v=()=>{let e=o.current;e&&e!==i&&!e.isDestroyed&&e.commands.clearFindMatches(),o.current=i},y=[i],t[7]=i,t[8]=v,t[9]=y),(0,Q.useEffect)(v,y);let b,x;t[10]===u.open?(b=t[11],x=t[12]):(b=()=>{if(!u.open||!a.current)return;let e=requestAnimationFrame(()=>{a.current?.focus(),a.current?.select()});return()=>cancelAnimationFrame(e)},x=[u.open],t[10]=u.open,t[11]=b,t[12]=x),(0,Q.useEffect)(b,x);let S,C;t[13]!==u.open||t[14]!==r?(S=()=>{!u.open||!r||d(uw)},C=[u.open,r],t[13]=u.open,t[14]=r,t[15]=S,t[16]=C):(S=t[15],C=t[16]),(0,Q.useEffect)(S,C);let w,T;t[17]!==i||t[18]!==u.caseSensitive||t[19]!==u.open||t[20]!==u.query||t[21]!==u.wholeWord||t[22]!==r?(w=()=>{if(!i||i.isDestroyed){p($C);return}if(!u.open||r){i.commands.clearFindMatches(),p($C);return}let e=window.setTimeout(()=>{if(i.isDestroyed)return;i.commands.setFindQuery(u.query,{options:{caseSensitive:u.caseSensitive,wholeWord:u.wholeWord},activeIndex:c.current});let e=aw(i);p(t=>ow(t,e)?t:e)},tw);return()=>window.clearTimeout(e)},T=[i,u.open,u.query,u.caseSensitive,u.wholeWord,r],t[17]=i,t[18]=u.caseSensitive,t[19]=u.open,t[20]=u.query,t[21]=u.wholeWord,t[22]=r,t[23]=w,t[24]=T):(w=t[23],T=t[24]),(0,Q.useEffect)(w,T);let E,D;t[25]!==i||t[26]!==u.open||t[27]!==r?(E=()=>{if(!i||i.isDestroyed||!u.open||r)return;let e=()=>{let e=Be(i.state),t=aw(i);p(e=>ow(e,t)?e:t),d(t=>t.activeIndex===e.activeIndex?t:{...t,activeIndex:e.activeIndex})};return i.on(`transaction`,e),()=>{i.off(`transaction`,e)}},D=[i,u.open,r],t[25]=i,t[26]=u.open,t[27]=r,t[28]=E,t[29]=D):(E=t[28],D=t[29]),(0,Q.useEffect)(E,D);let O,k;t[30]!==n||t[31]!==i||t[32]!==u.open||t[33]!==r?(O=()=>{let e=function(e){let t=iw(i);d(n=>({...n,open:!0,replaceOpen:e,query:t??n.query,activeIndex:0}))},t=function(t){if(!(!n||r||t.defaultPrevented)){if(nc(t,`find`)){t.preventDefault(),u.open?sw(i,d,p):e(!1);return}if(nc(t,`replace`)){t.preventDefault(),e(!0);return}if(u.open){let e=nc(t,`find-next`),n=nc(t,`find-previous`);if(e||n){t.preventDefault(),(n?i?.commands.selectPreviousFindMatch():i?.commands.selectNextFindMatch())&&cw(i);return}}t.key===`Escape`&&u.open&&(t.preventDefault(),sw(i,d,p))}};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},k=[n,i,u.open,r],t[30]=n,t[31]=i,t[32]=u.open,t[33]=r,t[34]=O,t[35]=k):(O=t[34],k=t[35]),(0,Q.useEffect)(O,k);let A;t[36]!==i||t[37]!==u.caseSensitive||t[38]!==u.query||t[39]!==u.wholeWord?(A=function(){return!i||i.isDestroyed?!1:(i.commands.setFindQuery(u.query,{options:{caseSensitive:u.caseSensitive,wholeWord:u.wholeWord},activeIndex:c.current}),!0)},t[36]=i,t[37]=u.caseSensitive,t[38]=u.query,t[39]=u.wholeWord,t[40]=A):A=t[40];let j=A,M;t[41]===i?M=t[42]:(M=function(){if(!i||i.isDestroyed)return;let e=Be(i.state),t=aw(i);p(e=>ow(e,t)?e:t),d(t=>t.activeIndex===e.activeIndex?t:{...t,activeIndex:e.activeIndex})},t[41]=i,t[42]=M);let N=M,P;t[43]===i?P=t[44]:(P=function(){sw(i,d,p)},t[43]=i,t[44]=P);let F=P,I;t[45]!==j||t[46]!==i||t[47]!==N?(I=function(){!i||i.isDestroyed||(j(),i.commands.selectNextFindMatch()&&cw(i),N())},t[45]=j,t[46]=i,t[47]=N,t[48]=I):I=t[48];let L=I,R;t[49]!==j||t[50]!==i||t[51]!==N?(R=function(){!i||i.isDestroyed||(j(),i.commands.selectPreviousFindMatch()&&cw(i),N())},t[49]=j,t[50]=i,t[51]=N,t[52]=R):R=t[52];let z=R,B;t[53]!==j||t[54]!==i||t[55]!==u.replacement||t[56]!==N?(B=function(){!i||i.isDestroyed||(j(),i.commands.replaceCurrentFindMatch(u.replacement)&&cw(i),N())},t[53]=j,t[54]=i,t[55]=u.replacement,t[56]=N,t[57]=B):B=t[57];let V=B,H;t[58]!==j||t[59]!==i||t[60]!==u.replacement||t[61]!==N?(H=function(){!i||i.isDestroyed||(j(),i.commands.replaceAllFindMatches(u.replacement)&&cw(i),N())},t[58]=j,t[59]=i,t[60]=u.replacement,t[61]=N,t[62]=H):H=t[62];let U=H;if(!u.open||!n||r)return null;let W,G,K,q,J;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(W=e=>d(t=>({...t,query:e,activeIndex:0})),G=e=>d(t=>({...t,replacement:e})),K=e=>d(t=>({...t,replaceOpen:e})),q=e=>d(t=>({...t,caseSensitive:e})),J=e=>d(t=>({...t,wholeWord:e})),t[63]=W,t[64]=G,t[65]=K,t[66]=q,t[67]=J):(W=t[63],G=t[64],K=t[65],q=t[66],J=t[67]);let ee;return t[68]!==F||t[69]!==u.caseSensitive||t[70]!==u.query||t[71]!==u.replaceOpen||t[72]!==u.replacement||t[73]!==u.wholeWord||t[74]!==f.current||t[75]!==f.total||t[76]!==U||t[77]!==V||t[78]!==L||t[79]!==z?(ee=(0,Z.jsx)(`div`,{className:`editor-content-aligned pointer-events-none absolute inset-x-0 top-2 z-30 px-2`,children:(0,Z.jsx)(`div`,{className:`flex justify-end`,children:(0,Z.jsx)(QC,{findInputRef:a,query:u.query,replacement:u.replacement,replaceOpen:u.replaceOpen,caseSensitive:u.caseSensitive,wholeWord:u.wholeWord,current:f.current,total:f.total,onQueryChange:W,onReplacementChange:G,onReplaceOpenChange:K,onCaseSensitiveChange:q,onWholeWordChange:J,onNext:L,onPrevious:z,onReplaceCurrent:V,onReplaceAll:U,onClose:F})})}),t[68]=F,t[69]=u.caseSensitive,t[70]=u.query,t[71]=u.replaceOpen,t[72]=u.replacement,t[73]=u.wholeWord,t[74]=f.current,t[75]=f.total,t[76]=U,t[77]=V,t[78]=L,t[79]=z,t[80]=ee):ee=t[80],ee}function uw(e){return{...e,open:!1,activeIndex:0}}function dw(e){return{...e,activeIndex:0}}var fw=300;function pw(e,t){let n=(0,$.c)(4),[r,i]=(0,Q.useState)(Tc),a,o;return n[0]!==t||n[1]!==e?(a=()=>{if(!e||!t){i(Tc);return}let n=e.document.getText(`source`),r=!1,a=null,o=function(){r||i(Ac(n.toString()))};o();let s=function(){a&&clearTimeout(a),a=setTimeout(o,fw)};return n.observe(s),()=>{r=!0,n.unobserve(s),a&&clearTimeout(a)}},o=[e,t],n[0]=t,n[1]=e,n[2]=a,n[3]=o):(a=n[2],o=n[3]),(0,Q.useEffect)(a,o),r}function mw(e){return e&&e.document.getMap(`lifecycle`).get(`status`)===`conflict`?`conflict`:null}function hw(e){let t=(0,$.c)(8),{poolEntries:n}=ht(),r;t[0]!==e||t[1]!==n?(r=e?n.find(t=>t.docName===e)??null:null,t[0]=e,t[1]=n,t[2]=r):r=t[2];let i=r?.provider??null,a;t[3]===i?a=t[4]:(a=()=>mw(i),t[3]=i,t[4]=a);let[o,s]=(0,Q.useState)(a),c,l;return t[5]===i?(c=t[6],l=t[7]):(c=()=>{if(!i){s(null);return}let e=i.document.getMap(`lifecycle`);s(mw(i));let t=()=>s(mw(i));return e.observe(t),()=>{e.unobserve(t)}},l=[i],t[5]=i,t[6]=c,t[7]=l),(0,Q.useEffect)(c,l),o}function gw(e,t){let n=(0,$.c)(3),r;return n[0]!==e||n[1]!==t?(r=()=>Mc(e,t),n[0]=e,n[1]=t,n[2]=r):r=n[2],(0,Q.useSyncExternalStore)(Nc,r)}var _w=`ok-doc-panel-width-v1`;function vw(e){return Number.isFinite(e)?e<300?300:e>600?600:Math.round(e):320}function yw(e){try{let t=(e??localStorage).getItem(_w);if(t==null)return 320;let n=Number.parseInt(t,10);return Number.isFinite(n)?vw(n):320}catch{return 320}}function bw(e,t){try{(t??localStorage).setItem(_w,String(vw(e)))}catch{}}function xw(){try{return typeof localStorage>`u`?320:yw()}catch{return 320}}var Sw=1024,Cw=1280,ww={left:Sw,right:Cw};function Tw(e,t,n){return e==null?t>=ww[n]?`above`:`below`:`embedded`}function Ew(e){return e===`above`?`open`:`collapsed`}var Dw=`ok-sidebar-pins-v2`;function Ow(e){return e===`open`||e===`collapsed`}function kw(e){return e===`above`||e===`below`||e===`embedded`}function Aw(e){if(typeof e!=`object`||!e)return!1;let t=e;for(let e of Object.keys(t))if(!kw(e)||!Ow(t[e]))return!1;return!0}function jw(e){let t=JSON.parse(e);if(typeof t!=`object`||!t)return{};let n=t,r={};return Aw(n.left)&&(r.left=n.left),Aw(n.right)&&(r.right=n.right),r}function Mw(e){try{let t=(e??localStorage).getItem(Dw);return t==null?{}:jw(t)}catch{return{}}}function Nw(e,t){try{t.setItem(Dw,JSON.stringify(e))}catch{}}function Pw(e,t,n){return n[e]?.[t]??Ew(t)}function Fw(e,t,n,r){let i=r??localStorage,a=Mw(i);return a[e]={...a[e],[t]:n},Nw(a,i),a}function Iw(e){let t=(0,$.c)(3),[n,r]=(0,Q.useState)(`connecting`),i,a;return t[0]===e?(i=t[1],a=t[2]):(i=()=>{if(!e){r(`connecting`);return}let t=e.configuration.websocketProvider.status;e.isSynced?r(`synced`):r(t===`connected`?`connected`:t===`disconnected`?`disconnected`:`connecting`);let n=e=>{let{status:t}=e;r(t===`connected`?Lw:t===`disconnected`?`disconnected`:`connecting`)},i=e=>{let{state:t}=e;r(t?`synced`:`connected`)},a=()=>r(`disconnected`);return e.on(`status`,n),e.on(`synced`,i),e.on(`disconnect`,a),()=>{e.off(`status`,n),e.off(`synced`,i),e.off(`disconnect`,a)}},a=[e],t[0]=e,t[1]=i,t[2]=a),(0,Q.useEffect)(i,a),n}function Lw(e){return e===`synced`?`synced`:`connected`}var Rw=Rr;function zw(e,t={}){let n=Oe(e.componentName);return n.name===`*`?t.unregisteredSuffix?`${e.componentName} (unregistered)`:e.componentName:n.displayName??n.name}var Bw=200,Vw=`Outside any block`;function Hw(e){let t=(0,$.c)(5),{editor:n}=e,r=Kt(n),i=(0,Q.useRef)(null),a=(0,Q.useRef)(null),o=(0,Q.useRef)(!1),s,c;t[0]!==r||t[1]!==n?(s=()=>{if(a.current!==null&&(window.clearTimeout(a.current),a.current=null),!n||!i.current)return;let e=r!==null&&r.ancestorChain.length>0,t;return t=e?Uw(n,r):o.current?Vw:``,a.current=window.setTimeout(()=>{i.current&&(i.current.textContent=``,i.current.textContent=t),o.current=e,a.current=null},Bw),()=>{a.current!==null&&(window.clearTimeout(a.current),a.current=null)}},c=[n,r],t[0]=r,t[1]=n,t[2]=s,t[3]=c):(s=t[2],c=t[3]),(0,Q.useEffect)(s,c);let l;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(`div`,{ref:i,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`sr-only`}),t[4]=l):l=t[4],l}function Uw(e,t){if(!t||t.ancestorChain.length===0)return``;let n=t.ancestorChain,r=n[n.length-1],i=zw(r,{unregisteredSuffix:!0});if(n.length===1)return`Selected: ${i}`;let a=n[n.length-2],o=zw(a);try{let t=e.state.doc.resolve(r.pos),n=t.index(t.depth),a=t.parent.childCount;return`Selected: ${i}, ${n+1} of ${a} in ${o}`}catch{return`Selected: ${i} in ${o}`}}function Ww(){let[e]=(0,Q.useState)(Lr);return e}function Gw({principal:e,identity:t}){return e&&e.source===`git-config`?{type:`human`,name:xr(e.display_name),color:Gn(e.id,Pn),coeditor:t.coeditor,tabId:t.tabId,principalId:e.id}:e&&e.source===`synthesized`?{type:`human`,name:t.name,color:Gn(e.id,Pn),coeditor:t.coeditor,tabId:t.tabId}:{type:`human`,name:t.name,color:t.color,coeditor:t.coeditor,tabId:t.tabId}}function Kw(e,t){return e>t}function qw(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.isChangeOrigin===!0?!0:`snapshot`in t&&`prevSnapshot`in t&&t.snapshot===null&&t.prevSnapshot===null}var Jw=3,Yw=6e4;function Xw(e,t){let n=0;for(let r of e)t-r<Yw&&(n+=1);return n<Jw}var Zw=new Map;function Qw(e,t){for(let n of e.changed.keys()){let e=n;for(;e!=null;){if(e===t)return!0;let n=e._item;e=n==null?null:n.parent}}return!1}function $w(e){let t=kt.getState(e);return t?.snapshot!=null||t?.prevSnapshot!=null}function eT(e){let{fragment:t,docName:n,onWedged:r}=e,i=0,a=0,o=!1,s=!1,c=!1,l=null,u=new WeakSet,d=e=>{let t=kt.getState(e)?.binding;if(!t)return;if(typeof t._prosemirrorChanged!=`function`){ue.count(`ok/editor/binding-guard-disarmed`,{docName:n,reason:`no-prosemirror-changed`}),console.warn(`[binding-staleness-guard] ySync binding on "${n}" exposes no _prosemirrorChanged — write-back gate disarmed (vendored y-tiptap contract change?)`);return}if(u.has(t))return;u.add(t);let r=t._prosemirrorChanged.bind(t);t._prosemirrorChanged=e=>{Kw(i,a)||r(e)}},f=()=>{if(c=!1,!s||o||!Kw(i,a)||l!==null&&$w(l.state))return;o=!0;let e=Date.now();for(let[t,n]of Zw)n.every(t=>e-t>=Yw)&&Zw.delete(t);let t=(Zw.get(n)??[]).filter(t=>e-t<Yw);if(!Xw(t,e)){Zw.set(n,t),ue.count(`ok/editor/binding-wedge-rate-capped`,{docName:n}),console.warn(`[binding-staleness-guard] wedge on "${n}" rate-capped (externalSeq=${i}, appliedSeq=${a}) — publication gate stays closed, no further recycle`);return}t.push(e),Zw.set(n,t),console.warn(`[binding-staleness-guard] wedged binding on "${n}" — Y→PM apply missing (externalSeq=${i}, appliedSeq=${a})`);try{r({externalSeq:i,appliedSeq:a})}catch(e){o=!1,ue.count(`ok/editor/binding-wedge-recovery-error`,{docName:n}),console.error(`[binding-staleness-guard] wedge recovery threw for "${n}":`,e)}},p=e=>{e.origin!==kt&&Qw(e,t)&&(i+=1,c||(c=!0,queueMicrotask(f)))};return new or({state:{init:()=>null,apply:e=>(qw(e.getMeta(kt))&&(a=i,o&&ue.count(`ok/editor/binding-wedge-recovered`,{docName:n}),o=!1),null)},filterTransaction:(e,t)=>!Kw(i,a)||$w(t)?!0:e.getMeta(kt)!==void 0,view:e=>{let r=t.doc;return r==null?(ue.count(`ok/editor/binding-guard-disarmed`,{docName:n,reason:`no-ydoc`}),console.error(`[binding-staleness-guard] fragment has no Y.Doc for "${n}" — staleness guard disarmed`),{}):(s=!0,l=e,d(e.state),r.off(`beforeObserverCalls`,p),r.on(`beforeObserverCalls`,p),{destroy:()=>{s=!1,l=null,r.off(`beforeObserverCalls`,p)}})}})}function tT(e,t){let n=Math.min(e.top,t.top),r=Math.max(e.bottom,t.bottom),i=Math.min(e.left,t.left),a=Math.max(e.right,t.right)-i,o=r-n;return new DOMRect(i,n,a,o)}var nT=class{constructor({editor:e,element:t,view:n,pluginKey:r=`bubbleMenu`,updateDelay:i=250,resizeDelay:a=60,shouldShow:o,appendTo:s,getReferencedVirtualElement:c,options:l}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.floatingUIOptions={strategy:`absolute`,placement:`top`,offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1,onShow:void 0,onHide:void 0,onUpdate:void 0,onDestroy:void 0},this.shouldShow=({view:e,state:t,from:n,to:r})=>{let{doc:i,selection:a}=t,{empty:o}=a,s=!i.textBetween(n,r).length&&$n(t.selection),c=this.element.contains(document.activeElement);return!(!(e.hasFocus()||c)||o||s||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:e})=>{if(this.editor.isDestroyed){this.destroy();return}if(this.preventHide){this.preventHide=!1;return}e?.relatedTarget&&this.element.parentNode?.contains(e.relatedTarget)||e?.relatedTarget!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(e,t)=>{let n=!t?.selection.eq(e.state.selection),r=!t?.doc.eq(e.state.doc);!n&&!r||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(e,n,r,t)},this.updateDelay))},this.updateHandler=(e,t,n,r)=>{let{composing:i}=e;if(!(i||!t&&!n)){if(!this.getShouldShow(r)){this.hide();return}this.show(),this.updatePosition()}},this.transactionHandler=({transaction:e})=>{let t=e.getMeta(this.pluginKey);t===`updatePosition`?this.updatePosition():t&&typeof t==`object`&&t.type===`updateOptions`?this.updateOptions(t.options):t===`hide`?this.hide():t===`show`&&(this.updatePosition(),this.show())},this.editor=e,this.element=t,this.view=n,this.pluginKey=r,this.updateDelay=i,this.resizeDelay=a,this.appendTo=s,this.scrollTarget=l?.scrollTarget??window,this.getReferencedVirtualElement=c,this.floatingUIOptions={...this.floatingUIOptions,...l},this.element.tabIndex=0,o&&(this.shouldShow=o),this.element.addEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener(`dragstart`,this.dragstartHandler),this.editor.on(`focus`,this.focusHandler),this.editor.on(`blur`,this.blurHandler),this.editor.on(`transaction`,this.transactionHandler),window.addEventListener(`resize`,this.resizeHandler),this.scrollTarget.addEventListener(`scroll`,this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(Ms(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(Rs(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(Ts(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(Ls(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(zs(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(Ds(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(As(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(ks(typeof this.floatingUIOptions.inline==`boolean`?void 0:this.floatingUIOptions.inline)),e}get virtualElement(){let{selection:e}=this.editor.state,t=this.getReferencedVirtualElement?.call(this);if(t)return t;if(!this.view?.dom?.parentNode)return;let n=Un(this.view,e.from,e.to),r={getBoundingClientRect:()=>n,getClientRects:()=>[n]};if(e instanceof ir){let t=this.view.nodeDOM(e.from),n=t.dataset.nodeViewWrapper?t:t.querySelector(`[data-node-view-wrapper]`);n&&(t=n),t&&(r={getBoundingClientRect:()=>t.getBoundingClientRect(),getClientRects:()=>[t.getBoundingClientRect()]})}if(e instanceof Dr){let{$anchorCell:t,$headCell:n}=e,i=t?t.pos:n.pos,a=n?n.pos:t.pos,o=this.view.nodeDOM(i),s=this.view.nodeDOM(a);if(!o||!s)return;let c=o===s?o.getBoundingClientRect():tT(o.getBoundingClientRect(),s.getBoundingClientRect());r={getBoundingClientRect:()=>c,getClientRects:()=>[c]}}return r}updatePosition(){if(!this.isVisible)return;let e=this.virtualElement;e&&Ps(e,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:t,strategy:n,middlewareData:r})=>{if(!(!this.isVisible||this.editor.isDestroyed||!this.element.isConnected)){if(r.hide?.referenceHidden||r.hide?.escaped){this.element.style.visibility=`hidden`;return}this.element.style.visibility=`visible`,this.element.style.width=`max-content`,this.element.style.position=n,this.element.style.left=`${e}px`,this.element.style.top=`${t}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()}})}update(e,t){let{state:n}=e,r=n.selection.from!==n.selection.to;if(this.updateDelay>0&&r){this.handleDebouncedUpdate(e,t);return}let i=!t?.selection.eq(e.state.selection),a=!t?.doc.eq(e.state.doc);this.updateHandler(e,i,a,t)}getShouldShow(e){let{state:t}=this.view,{selection:n}=t,{ranges:r}=n,i=Math.min(...r.map(e=>e.$from.pos)),a=Math.max(...r.map(e=>e.$to.pos));return this.shouldShow?.call(this,{editor:this.editor,element:this.element,view:this.view,state:t,oldState:e,from:i,to:a})||!1}show(){var e;this.isVisible||(this.element.style.visibility=`visible`,this.element.style.opacity=`1`,(e=(typeof this.appendTo==`function`?this.appendTo():this.appendTo)??this.view.dom.parentElement)==null||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0)}hide(){this.isVisible&&=(this.element.style.visibility=`hidden`,this.element.style.opacity=`0`,this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),!1)}updateOptions(e){if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.getReferencedVirtualElement!==void 0&&(this.getReferencedVirtualElement=e.getReferencedVirtualElement),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){let t=e.options.scrollTarget??window;t!==this.scrollTarget&&(this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.scrollTarget=t,this.scrollTarget.addEventListener(`scroll`,this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}destroy(){this.hide(),this.element.removeEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener(`dragstart`,this.dragstartHandler),window.removeEventListener(`resize`,this.resizeHandler),this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.editor.off(`focus`,this.focusHandler),this.editor.off(`blur`,this.blurHandler),this.editor.off(`transaction`,this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},rT=e=>new or({key:typeof e.pluginKey==`string`?new Vn(e.pluginKey):e.pluginKey,view:t=>new nT({view:t,...e})});ti.create({name:`bubbleMenu`,addOptions(){return{element:null,pluginKey:`bubbleMenu`,updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[rT({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,options:this.options.options,appendTo:this.options.appendTo,getReferencedVirtualElement:this.options.getReferencedVirtualElement,shouldShow:this.options.shouldShow})]:[]}});var iT=class{constructor({editor:e,element:t,view:n,pluginKey:r=`floatingMenu`,updateDelay:i=250,resizeDelay:a=60,options:o,appendTo:s,shouldShow:c}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.shouldShow=({view:e,state:t})=>{let{selection:n}=t,{$anchor:r,empty:i}=n,a=r.depth===1,o=r.parent.isTextblock&&!r.parent.type.spec.code&&!r.parent.textContent&&r.parent.childCount===0&&!this.getTextContent(r.parent);return!(!e.hasFocus()||!i||!a||!o||!this.editor.isEditable)},this.floatingUIOptions={strategy:`absolute`,placement:`right`,offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1},this.updateHandler=(e,t,n,r)=>{let{composing:i}=e;if(!(i||!t&&!n)){if(!this.getShouldShow(r)){this.hide();return}this.updatePosition(),this.show()}},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:e})=>{if(this.preventHide){this.preventHide=!1;return}e?.relatedTarget&&this.element.parentNode?.contains(e.relatedTarget)||e?.relatedTarget!==this.editor.view.dom&&this.hide()},this.transactionHandler=({transaction:e})=>{let t=e.getMeta(this.pluginKey);t===`updatePosition`?this.updatePosition():t&&typeof t==`object`&&t.type===`updateOptions`?this.updateOptions(t.options):t===`hide`?this.hide():t===`show`&&(this.updatePosition(),this.show())},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.editor=e,this.element=t,this.view=n,this.pluginKey=r,this.updateDelay=i,this.resizeDelay=a,this.appendTo=s,this.scrollTarget=o?.scrollTarget??window,this.floatingUIOptions={...this.floatingUIOptions,...o},this.element.tabIndex=0,c&&(this.shouldShow=c),this.element.addEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.editor.on(`focus`,this.focusHandler),this.editor.on(`blur`,this.blurHandler),this.editor.on(`transaction`,this.transactionHandler),window.addEventListener(`resize`,this.resizeHandler),this.scrollTarget.addEventListener(`scroll`,this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}getTextContent(e){return Nr(e,{textSerializers:Mn(this.editor.schema)})}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(Ms(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(Rs(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(Ts(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(Ls(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(zs(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(Ds(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(As(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(ks(typeof this.floatingUIOptions.inline==`boolean`?void 0:this.floatingUIOptions.inline)),e}getShouldShow(e){let{state:t}=this.view,{selection:n}=t,{ranges:r}=n,i=Math.min(...r.map(e=>e.$from.pos)),a=Math.max(...r.map(e=>e.$to.pos));return this.shouldShow?.call(this,{editor:this.editor,view:this.view,state:t,oldState:e,from:i,to:a})}updateOptions(e){if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){let t=e.options.scrollTarget??window;t!==this.scrollTarget&&(this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.scrollTarget=t,this.scrollTarget.addEventListener(`scroll`,this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}updatePosition(){let{selection:e}=this.editor.state,t=Un(this.view,e.from,e.to);Ps({getBoundingClientRect:()=>t,getClientRects:()=>[t]},this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:t,strategy:n,middlewareData:r})=>{if(r.hide?.referenceHidden||r.hide?.escaped){this.element.style.visibility=`hidden`;return}this.element.style.visibility=`visible`,this.element.style.width=`max-content`,this.element.style.position=n,this.element.style.left=`${e}px`,this.element.style.top=`${t}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(e,t){let n=!t?.selection.eq(e.state.selection),r=!t?.doc.eq(e.state.doc);this.updateHandler(e,n,r,t)}show(){var e;this.isVisible||(this.element.style.visibility=`visible`,this.element.style.opacity=`1`,(e=(typeof this.appendTo==`function`?this.appendTo():this.appendTo)??this.view.dom.parentElement)==null||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0)}hide(){this.isVisible&&=(this.element.style.visibility=`hidden`,this.element.style.opacity=`0`,this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),!1)}destroy(){this.hide(),this.element.removeEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),window.removeEventListener(`resize`,this.resizeHandler),this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.editor.off(`focus`,this.focusHandler),this.editor.off(`blur`,this.blurHandler),this.editor.off(`transaction`,this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},aT=e=>new or({key:typeof e.pluginKey==`string`?new Vn(e.pluginKey):e.pluginKey,view:t=>new iT({view:t,...e})});ti.create({name:`floatingMenu`,addOptions(){return{element:null,options:{},pluginKey:`floatingMenu`,updateDelay:void 0,resizeDelay:void 0,appendTo:void 0,shouldShow:null}},addCommands(){return{updateFloatingMenuPosition:()=>({tr:e,dispatch:t})=>(t&&e.setMeta(this.options.pluginKey,`updatePosition`),!0)}},addProseMirrorPlugins(){return this.options.element?[aT({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,resizeDelay:this.options.resizeDelay,options:this.options.options,appendTo:this.options.appendTo,shouldShow:this.options.shouldShow})]:[]}});function oT(e,t){return e??new Vn(t)}var sT=typeof window<`u`?Q.useLayoutEffect:Q.useEffect,cT=new Set([`left`,`opacity`,`position`,`top`,`visibility`,`width`]),lT=new Set(`animationIterationCount.aspectRatio.borderImageOutset.borderImageSlice.borderImageWidth.columnCount.columns.fillOpacity.flex.flexGrow.flexShrink.fontWeight.gridArea.gridColumn.gridColumnEnd.gridColumnStart.gridRow.gridRowEnd.gridRowStart.lineClamp.lineHeight.opacity.order.orphans.scale.stopOpacity.strokeDasharray.strokeDashoffset.strokeMiterlimit.strokeOpacity.strokeWidth.tabSize.widows.zIndex.zoom`.split(`.`)),uT=new Set([`children`,`className`,`style`]),dT=new Set([`tabIndex`]),fT=new Set([`accessKey`,`autoCapitalize`,`contentEditable`,`contextMenu`,`dir`,`draggable`,`enterKeyHint`,`hidden`,`id`,`lang`,`nonce`,`role`,`slot`,`spellCheck`,`tabIndex`,`title`,`translate`]),pT={Blur:`focusout`,DoubleClick:`dblclick`,Focus:`focusin`,MouseEnter:`mouseenter`,MouseLeave:`mouseleave`};function mT(e,t){return/^on[A-Z]/.test(e)&&typeof t==`function`}function hT(e){return e.startsWith(`aria-`)||e.startsWith(`data-`),e}function gT(e){return e.startsWith(`aria-`)||e.startsWith(`data-`)||fT.has(e)}function _T(e){return e.startsWith(`--`)?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function vT(e){let t=e.endsWith(`Capture`),n=(t?e.slice(0,-7):e).slice(2);return{eventName:pT[n]??n.toLowerCase(),options:t?{capture:!0}:void 0}}function yT(e,t){let n=t.defaultPrevented,r=!1,i=Object.create(t);return Object.defineProperties(i,{nativeEvent:{value:t},currentTarget:{value:e},target:{value:t.target},persist:{value:()=>void 0},isDefaultPrevented:{value:()=>n},isPropagationStopped:{value:()=>r},preventDefault:{value:()=>{n=!0,t.preventDefault()}},stopPropagation:{value:()=>{r=!0,t.stopPropagation()}}}),i}function bT(e){return dT.has(e)}function xT(e,t,n){if(t===`tabIndex`){e.tabIndex=Number(n);return}e[t]=n}function ST(e,t){if(t===`tabIndex`){e.removeAttribute(`tabindex`);return}let n=e[t];if(typeof n==`boolean`){e[t]=!1;return}if(typeof n==`number`){e[t]=0;return}e[t]=``}function CT(e,t){return typeof t!=`number`||t===0||e.startsWith(`--`)||lT.has(e)?String(t):`${t}px`}function wT(e,t){cT.has(t)||e.style.removeProperty(_T(t))}function TT(e,t,n){cT.has(t)||e.style.setProperty(_T(t),CT(t,n))}function ET(e,t,n){new Set([...Object.keys(t),...Object.keys(n)]).forEach(r=>{if(uT.has(r)||!gT(r)||mT(r,t[r])||mT(r,n[r]))return;let i=t[r],a=n[r];if(i===a)return;let o=hT(r);if(a==null||a===!1){bT(r)&&ST(e,r),e.removeAttribute(o);return}if(a===!0){bT(r)&&xT(e,r,!0),e.setAttribute(o,``);return}if(bT(r)){xT(e,r,a);return}e.setAttribute(o,String(a))})}function DT(e,t,n){if(t!==n){if(n){e.className=n;return}e.removeAttribute(`class`)}}function OT(e,t,n){let r=t??{},i=n??{};new Set([...Object.keys(r),...Object.keys(i)]).forEach(t=>{let n=r[t],a=i[t];if(n!==a){if(a==null){wT(e,t);return}TT(e,t,a)}})}function kT(e,t,n){t.forEach(({eventName:t,listener:n,options:r})=>{e.removeEventListener(t,n,r)});let r=[];return Object.entries(n).forEach(([t,n])=>{if(!mT(t,n))return;let{eventName:i,options:a}=vT(t),o=t=>{n(yT(e,t))};e.addEventListener(i,o,a),r.push({eventName:i,listener:o,options:a})}),r}function AT(e,t){let n=(0,Q.useRef)({}),r=(0,Q.useRef)([]);sT(()=>{let i=n.current;return DT(e,i.className,t.className),OT(e,i.style,t.style),ET(e,i,t),r.current=kT(e,r.current,t),n.current=t,()=>{r.current.forEach(({eventName:t,listener:n,options:r})=>{e.removeEventListener(t,n,r)}),r.current=[]}},[e,t])}var jT=Q.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:r,appendTo:i,shouldShow:a=null,getReferencedVirtualElement:o,options:s,children:c,...l},u)=>{let d=(0,Q.useRef)(document.createElement(`div`)),f=(0,Q.useRef)(oT(e,`bubbleMenu`)).current;AT(d.current,l),typeof u==`function`?u(d.current):u&&(u.current=d.current);let{editor:p}=qt(),m=t||p,h={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:f,shouldShow:a,getReferencedVirtualElement:o,options:s},g=(0,Q.useRef)(h);g.current=h;let[_,v]=(0,Q.useState)(!1),y=(0,Q.useRef)(!0);return(0,Q.useEffect)(()=>{if(m?.isDestroyed)return;if(!m){console.warn(`BubbleMenu component is not rendered inside of an editor component or does not have editor prop.`);return}let e=d.current;e.style.visibility=`hidden`,e.style.position=`absolute`;let t=rT({...g.current,editor:m,element:e});m.registerPlugin(t);let n=g.current.pluginKey;return y.current=!0,v(!0),()=>{v(!1),m.unregisterPlugin(n),window.requestAnimationFrame(()=>{e.parentNode&&e.parentNode.removeChild(e)})}},[m]),(0,Q.useEffect)(()=>{if(!(!_||!m||m.isDestroyed)){if(y.current){y.current=!1;return}m.view.dispatch(m.state.tr.setMeta(f,{type:`updateOptions`,options:g.current}))}},[_,m,n,r,a,s,i,o,f]),(0,rl.createPortal)(c,d.current)});Q.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:r,appendTo:i,shouldShow:a=null,options:o,children:s,...c},l)=>{let u=(0,Q.useRef)(document.createElement(`div`)),d=(0,Q.useRef)(oT(e,`floatingMenu`)).current;AT(u.current,c),typeof l==`function`?l(u.current):l&&(l.current=u.current);let{editor:f}=qt(),p=t||f,m={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:d,shouldShow:a,options:o},h=(0,Q.useRef)(m);h.current=m;let[g,_]=(0,Q.useState)(!1),v=(0,Q.useRef)(!0);return(0,Q.useEffect)(()=>{if(p?.isDestroyed)return;if(!p){console.warn(`FloatingMenu component is not rendered inside of an editor component or does not have editor prop.`);return}let e=u.current;e.style.visibility=`hidden`,e.style.position=`absolute`;let t=aT({...h.current,editor:p,element:e});p.registerPlugin(t);let n=h.current.pluginKey;return v.current=!0,_(!0),()=>{_(!1),p.unregisterPlugin(n),window.requestAnimationFrame(()=>{e.parentNode&&e.parentNode.removeChild(e)})}},[p]),(0,Q.useEffect)(()=>{if(!(!g||!p||p.isDestroyed)){if(v.current){v.current=!1;return}p.view.dispatch(p.state.tr.setMeta(d,{type:`updateOptions`,options:h.current}))}},[g,p,n,r,a,o,i,d]),(0,rl.createPortal)(s,u.current)});var MT=[{name:`paragraph`,label:`Text`,icon:Wl,isActive:e=>e.isActive(`paragraph`)&&!e.isActive(`list`),command:e=>e.chain().focus().setParagraph().run()},{name:`heading1`,label:`Heading 1`,icon:Ee,isActive:e=>e.isActive(`heading`,{level:1}),command:e=>e.chain().focus().toggleHeading({level:1}).run()},{name:`heading2`,label:`Heading 2`,icon:F,isActive:e=>e.isActive(`heading`,{level:2}),command:e=>e.chain().focus().toggleHeading({level:2}).run()},{name:`heading3`,label:`Heading 3`,icon:Et,isActive:e=>e.isActive(`heading`,{level:3}),command:e=>e.chain().focus().toggleHeading({level:3}).run()},{name:`bulletList`,label:`Bullet List`,icon:_e,isActive:e=>e.isActive(`list`,{ordered:!1})&&!e.isActive(`listItem`,{checked:!0})&&!e.isActive(`listItem`,{checked:!1}),command:e=>e.chain().focus().toggleBulletList().run()},{name:`orderedList`,label:`Ordered List`,icon:he,isActive:e=>e.isActive(`list`,{ordered:!0}),command:e=>e.chain().focus().toggleOrderedList().run()},{name:`taskList`,label:`Task List`,icon:k,isActive:e=>e.isActive(`listItem`,{checked:!0})||e.isActive(`listItem`,{checked:!1}),command:e=>e.chain().focus().toggleTaskList().run()},{name:`blockquote`,label:`Quote`,icon:M,isActive:e=>e.isActive(`blockquote`),command:e=>e.chain().focus().toggleBlockquote().run()},{name:`codeBlock`,label:`Code Block`,icon:tu,isActive:e=>e.isActive(`codeBlock`),command:e=>e.chain().focus().toggleCodeBlock({language:`js`}).run()}];function NT(e){let t=(0,$.c)(18),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:PT},t[0]=n,t[1]=r);let{current:i,activeStates:a}=Le(r),o=i.icon,s;t[2]===o?s=t[3]:(s=(0,Z.jsx)(o,{className:`size-3.5`}),t[2]=o,t[3]=s);let c;t[4]===i.label?c=t[5]:(c=(0,Z.jsx)(`span`,{children:i.label}),t[4]=i.label,t[5]=c);let l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(He,{className:`size-3 opacity-50`}),t[6]=l):l=t[6];let u;t[7]!==s||t[8]!==c?(u=(0,Z.jsx)(ja,{asChild:!0,children:(0,Z.jsxs)(li,{variant:`ghost`,size:`sm`,className:`gap-1 px-2 text-sm font-medium text-accent-foreground/80`,children:[s,c,l]})}),t[7]=s,t[8]=c,t[9]=u):u=t[9];let d;t[10]!==a||t[11]!==n?(d=MT.map(e=>{let t=e.icon,r=a[e.name];return(0,Z.jsxs)(Da,{className:r?`bg-accent text-accent-foreground`:``,onSelect:()=>{e.command(n)},children:[(0,Z.jsx)(t,{className:`size-4`}),(0,Z.jsx)(`span`,{children:e.label})]},e.name)}),t[10]=a,t[11]=n,t[12]=d):d=t[12];let f;t[13]===d?f=t[14]:(f=(0,Z.jsx)(to,{align:`start`,sideOffset:8,className:`w-44 max-h-(--radix-dropdown-menu-content-available-height) overflow-y-auto subtle-scrollbar`,children:d}),t[13]=d,t[14]=f);let p;return t[15]!==u||t[16]!==f?(p=(0,Z.jsxs)(oo,{children:[u,f]}),t[15]=u,t[16]=f,t[17]=p):p=t[17],p}function PT(e){let t=Object.fromEntries(MT.map(t=>[t.name,t.isActive(e.editor)]));return{current:MT.find(e=>t[e.name])??MT[0],activeStates:t}}function FT(e){let t=(0,$.c)(17),{installStates:n,onPick:r}=e,{_:a}=i(),[o,c]=(0,Q.useState)(``),l;if(t[0]!==a||t[1]!==n||t[2]!==o||t[3]!==r){let e;t[5]===n?e=t[6]:(e=e=>n[e.id]?.installed===!0,t[5]=n,t[6]=e);let i=gg.filter(e),u=gg.some(e=>n[e.id]?.installed==null),d;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(`div`,{className:`font-mono text-xs uppercase tracking-wide text-muted-foreground`,children:(0,Z.jsx)(s,{id:`EVnzPs`})}),t[7]=d):d=t[7];let f;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(f=e=>c(e.target.value),t[8]=f):f=t[8];let p;t[9]===a?p=t[10]:(p=a({id:`Rah7yq`}),t[9]=a,t[10]=p);let m;t[11]===a?m=t[12]:(m=a({id:`ZBt4rI`}),t[11]=a,t[12]=m);let h;t[13]!==o||t[14]!==p||t[15]!==m?(h=(0,Z.jsx)(Mo,{value:o,onChange:f,placeholder:p,"aria-label":m,"data-testid":`edit-with-ai-instruction`}),t[13]=o,t[14]=p,t[15]=m,t[16]=h):h=t[16],l=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[d,h,i.length>0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`text-muted-foreground text-xs`,"data-testid":`edit-with-ai-send-label`,children:(0,Z.jsx)(s,{id:`C37Zkt`})}),(0,Z.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:i.map(e=>(0,Z.jsxs)(li,{type:`button`,variant:`ghost`,className:`w-full justify-start gap-2`,"data-testid":`edit-with-ai-target-${e.id}`,onClick:()=>r(e,o),children:[(0,Z.jsx)(Vx,{id:e.id,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:e.displayName})]},e.id))})]}):(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,"data-testid":`edit-with-ai-empty`,"aria-live":`polite`,children:u?(0,Z.jsx)(s,{id:`EcR0fl`}):(0,Z.jsx)(s,{id:`l6OXqI`})})]}),t[0]=a,t[1]=n,t[2]=o,t[3]=r,t[4]=l}else l=t[4];return l}function IT(e){let t=(0,$.c)(27),{open:n,onOpenChange:r,snapshot:a,children:o}=e,{_:s}=i(),{states:c,refresh:l}=D_(),{dispatch:u}=g_(),d;t[0]===l?d=t[1]:(d=()=>{l()},t[0]=l,t[1]=d);let f=(0,Q.useEffectEvent)(d),p;t[2]!==n||t[3]!==f?(p=()=>{n&&f()},t[2]=n,t[3]=f,t[4]=p):p=t[4];let m;t[5]===n?m=t[6]:(m=[n],t[5]=n,t[6]=m),(0,Q.useEffect)(p,m);let h;t[7]!==s||t[8]!==u||t[9]!==r||t[10]!==a?(h=(e,t)=>{if(a!==null){let n=a_({docName:a.docName,workspace:a.workspace,instruction:t,selectionMarkdown:a.selectionMarkdown});n===null?X.error(s({id:`_VRtd7`})):u(e.id,n)}r(!1)},t[7]=s,t[8]=u,t[9]=r,t[10]=a,t[11]=h):h=t[11];let g=h,_;t[12]===o?_=t[13]:(_=(0,Z.jsx)(J,{asChild:!0,children:o}),t[12]=o,t[13]=_);let v;t[14]===s?v=t[15]:(v=s({id:`EVnzPs`}),t[14]=s,t[15]=v);let y;t[16]!==g||t[17]!==c?(y=(0,Z.jsx)(FT,{installStates:c,onPick:g}),t[16]=g,t[17]=c,t[18]=y):y=t[18];let x;t[19]!==v||t[20]!==y?(x=(0,Z.jsx)(b,{align:`start`,"aria-label":v,"data-testid":`edit-with-ai-popover`,children:y}),t[19]=v,t[20]=y,t[21]=x):x=t[21];let S;return t[22]!==r||t[23]!==n||t[24]!==_||t[25]!==x?(S=(0,Z.jsxs)(pe,{open:n,onOpenChange:r,children:[_,x]}),t[22]=r,t[23]=n,t[24]=_,t[25]=x,t[26]=S):S=t[26],S}function LT(e){let t=P(e.state.selection.content(),e.state.schema);return l().serialize(t).trim()}function RT(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName.toUpperCase();return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`}function zT(e){let t=(0,$.c)(3),{editor:n,shortcutEnabled:r}=e,i=r===void 0?!1:r,a=Xn(),o=pg();if(!a||o)return null;let s;return t[0]!==n||t[1]!==i?(s=(0,Z.jsx)(BT,{editor:n,shortcutEnabled:i}),t[0]=n,t[1]=i,t[2]=s):s=t[2],s}function BT(e){let t=(0,$.c)(19),{editor:n,shortcutEnabled:r}=e,{_:a}=i(),o=ka(),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(null),f;if(t[0]!==a||t[1]!==n||t[2]!==o){let e=()=>{let e;try{e=LT(n)}catch(e){return console.error(`Edit with AI: could not read the selection`,e),X.error(a({id:`-RXIMO`})),null}return{docName:xt(n),workspace:o,selectionMarkdown:e}};f=()=>{let t=e();t!==null&&(d(t),l(!0))},t[0]=a,t[1]=n,t[2]=o,t[3]=f}else f=t[3];let p=f,m;t[4]===p?m=t[5]:(m=e=>{if(e){p();return}l(!1),d(null)},t[4]=p,t[5]=m);let h=m,g;t[6]===p?g=t[7]:(g=()=>{p()},t[6]=p,t[7]=g);let _=(0,Q.useEffectEvent)(g),v;t[8]!==_||t[9]!==r?(v=()=>{let e=e=>{r&&nc(e,`edit-with-ai`)&&(RT(e.target)||(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),_()))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},t[8]=_,t[9]=r,t[10]=v):v=t[10];let y;t[11]===r?y=t[12]:(y=[r],t[11]=r,t[12]=y),(0,Q.useEffect)(v,y);let b;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(Pi,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),t[13]=b):b=t[13];let x;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsxs)(li,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`edit-with-ai-bubble-button`,className:`gap-1 px-2 text-sm font-medium text-accent-foreground/80`,children:[(0,Z.jsx)(bi,{className:`size-3.5`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`EVnzPs`})})]}),t[14]=x):x=t[14];let S;return t[15]!==h||t[16]!==c||t[17]!==u?(S=(0,Z.jsxs)(Z.Fragment,{children:[b,(0,Z.jsx)(IT,{open:c,onOpenChange:h,snapshot:u,children:x})]}),t[15]=h,t[16]=c,t[17]=u,t[18]=S):S=t[18],S}function VT(e){let t=e.state.selection.node;if(!t||t.type.name!==`jsxComponent`)return null;let n=t.attrs.componentName;if(n!==`File`&&n!==`WikiEmbedFile`)return null;let r=(t.attrs.props??{}).src;return typeof r!=`string`||r.length===0?null:r}function HT(e){let t=e.state.selection.node;if(!t)return``;let n=t.attrs.props??{},r=typeof n.alias==`string`?n.alias:``;if(r.length>0)return r;let i=typeof n.name==`string`?n.name:``;return i.length>0?i:Ft(typeof n.src==`string`?n.src:``)}function UT(e,t){let n=document.createElement(`a`);n.href=e,n.download=t,n.rel=`noopener noreferrer`,n.style.display=`none`,document.body.appendChild(n),n.click(),n.remove()}function WT(e){let t=(0,$.c)(13),{editor:n}=e,{_:r}=i(),a;if(t[0]===n?a=t[1]:(a={editor:n,selector:GT},t[0]=n,t[1]=a),Le(a)===null)return null;let o;t[2]===r?o=t[3]:(o=r({id:`WcWS__`}),t[2]=r,t[3]=o);let c;t[4]===n?c=t[5]:(c=e=>{e.preventDefault();let t=VT(n);t&&UT(t,HT(n))},t[4]=n,t[5]=c);let l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(Ya,{className:`size-3.5`}),t[6]=l):l=t[6];let u;t[7]!==o||t[8]!==c?(u=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(li,{variant:`ghost`,size:`icon-xs`,"aria-label":o,className:`text-accent-foreground`,onMouseDown:c,children:l})}),t[7]=o,t[8]=c,t[9]=u):u=t[9];let d;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Ns,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(s,{id:`WcWS__`})}),t[10]=d):d=t[10];let f;return t[11]===u?f=t[12]:(f=(0,Z.jsx)(`div`,{className:`flex items-center gap-0.5`,children:(0,Z.jsxs)(Is,{children:[u,d]})}),t[11]=u,t[12]=f),f}function GT(e){return VT(e.editor)}function KT(e){return VT(e)!==null}function qT(e){let t=e.schema.nodes;return!!(t.footnoteReference&&t.footnoteDefinition)}function JT(e){let{from:t,to:n}=e.state.selection,r=!1;return e.state.doc.nodesBetween(t,n,e=>e.type.name===`footnoteReference`?(r=!0,!1):!0),r}function YT(e){let{$from:t,$to:n}=e.state.selection;return!t.sameParent(n)}function XT(e){let t=(0,$.c)(21),{editor:n}=e,{_:r}=i(),a;t[0]===n?a=t[1]:(a={editor:n,selector:ZT},t[0]=n,t[1]=a);let o=Le(a),s;t[2]!==o||t[3]!==n?(s=()=>{if(o||!qT(n)||n.state.selection.empty||YT(n)||JT(n))return;let{from:e,to:t}=n.state.selection,r=n.state.doc.textBetween(e,t,` `);if(!r.trim())return;let i=Bn(Hn(n.state.doc)),a=Fr(n.state.doc)+1-(t-e);n.chain().focus().deleteSelection().insertFootnoteReference(i).insertContentAt(a,{type:`footnoteDefinition`,attrs:{identifier:i,label:i},content:[{type:`paragraph`,content:[{type:`text`,text:r}]}]}).run()},t[2]=o,t[3]=n,t[4]=s):s=t[4];let c=s,l;t[5]===r?l=t[6]:(l=r({id:`sIGbBZ`}),t[5]=r,t[6]=l);let u;t[7]===c?u=t[8]:(u=e=>{e.preventDefault(),c()},t[7]=c,t[8]=u);let d;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(ne,{className:`size-3.5`,"aria-hidden":`true`}),t[9]=d):d=t[9];let f;t[10]!==o||t[11]!==l||t[12]!==u?(f=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(li,{type:`button`,variant:`ghost`,size:`icon-xs`,"data-testid":`footnote-bubble-button`,className:`text-accent-foreground/80`,"aria-label":l,onMouseDown:u,disabled:o,children:d})}),t[10]=o,t[11]=l,t[12]=u,t[13]=f):f=t[13];let p;t[14]===r?p=t[15]:(p=r({id:`sIGbBZ`}),t[14]=r,t[15]=p);let m;t[16]===p?m=t[17]:(m=(0,Z.jsx)(Ns,{side:`bottom`,sideOffset:8,children:p}),t[16]=p,t[17]=m);let h;return t[18]!==f||t[19]!==m?(h=(0,Z.jsxs)(Is,{children:[f,m]}),t[18]=f,t[19]=m,t[20]=h):h=t[20],h}function ZT(e){let t=e.editor;return!!(!qT(t)||t.state.selection.empty||YT(t)||JT(t))}var QT=`img, .ok-embed, .ok-video`,$T=220,eE=`cubic-bezier(0.23, 1, 0.32, 1)`,tE=`ok-image-align-flip`,nE=.5;function rE(){return typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function iE(){return typeof requestAnimationFrame==`function`}function aE(e){return e?e.querySelector(QT):null}function oE(e,t){if(rE()||!iE()){t();return}let n=aE(e);if(!n){t();return}let r=n.getBoundingClientRect().left;t(),requestAnimationFrame(()=>{let t=aE(e);if(!t)return;for(let e of t.getAnimations())e.id===tE&&e.cancel();let n=r-t.getBoundingClientRect().left;if(Math.abs(n)<nE)return;let i=t.animate([{transform:`translateX(${n}px)`},{transform:`translateX(0)`}],{duration:$T,easing:eE,fill:`none`});i.id=tE})}var sE=[{value:`left`,label:`Align left`,icon:du},{value:`center`,label:`Align center`,icon:lu},{value:`right`,label:`Align right`,icon:uu}];function cE(e){let t=e.state.selection.node;if(!t||t.type.name!==`jsxComponent`)return null;let n=t.attrs.componentName;if(!zt.has(String(n)))return null;let r=(t.attrs.props??{}).align;return r===`left`||r===`right`||r===`center`?r:`center`}function lE(e){let t=(0,$.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:uE},t[0]=n,t[1]=r);let i=Le(r);if(i===null)return null;let a;t[2]!==i||t[3]!==n?(a=sE.map(e=>{let{value:t,label:r,icon:a}=e,o=i===t;return(0,Z.jsxs)(Is,{children:[(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(li,{variant:`ghost`,size:`icon-xs`,"aria-label":r,"aria-pressed":o,className:o?`bg-accent text-primary`:`text-accent-foreground`,onMouseDown:e=>{e.preventDefault();let r=n.state.selection,i=r.node;if(!i||i.type.name!==`jsxComponent`)return;let a=String(i.attrs.componentName??``);if(!zt.has(a)||i.attrs.kind!==`element`)return;let o=a===`CommonMarkImage`,s=r.from,c={...i.attrs.props??{},align:t},l=o?{...i.attrs,componentName:`img`,props:c,sourceDirty:!0}:{...i.attrs,props:c,sourceDirty:!0},u=n.state.tr.setNodeMarkup(s,null,l);u.setSelection(ir.create(u.doc,s)),oE(n.view.nodeDOM(s),()=>{n.view.dispatch(u)})},children:(0,Z.jsx)(a,{className:`size-3.5`})})}),(0,Z.jsx)(Ns,{side:`bottom`,sideOffset:8,children:r})]},t)}),t[2]=i,t[3]=n,t[4]=a):a=t[4];let o;return t[5]===a?o=t[6]:(o=(0,Z.jsx)(`div`,{className:`flex items-center gap-0.5`,children:a}),t[5]=a,t[6]=o),o}function uE(e){return cE(e.editor)}function dE(e){return cE(e)!==null}var fE=[{name:`bold`,icon:nl,command:e=>e.chain().focus().toggleBold().run(),isActive:e=>e.isActive(`strong`),shortcutId:`format-bold`},{name:`italic`,icon:kl,command:e=>e.chain().focus().toggleItalic().run(),isActive:e=>e.isActive(`emphasis`),shortcutId:`format-italic`},{name:`underline`,icon:pu,command:e=>e.chain().focus().toggleUnderline().run(),isActive:e=>e.isActive(`underline`),shortcutId:`format-underline`},{name:`strikethrough`,icon:ou,command:e=>e.chain().focus().toggleStrike().run(),isActive:e=>e.isActive(`strike`),shortcutId:`format-strike`},{name:`code`,icon:bt,command:e=>e.chain().focus().toggleCode().run(),isActive:e=>e.isActive(`code`),shortcutId:`format-inline-code`},{name:`highlight`,icon:Dl,command:e=>e.chain().focus().toggleHighlight().run(),isActive:e=>e.isActive(`highlight`),shortcutId:`format-highlight`}];function pE(e){let t=(0,$.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:mE},t[0]=n,t[1]=r);let i=Le(r),a;t[2]!==i||t[3]!==n?(a=fE.map(e=>{let t=e.icon,r=i[e.name];return(0,Z.jsxs)(Is,{children:[(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(li,{variant:`ghost`,size:`icon-xs`,"aria-label":e.name,className:r?`bg-accent text-primary`:`text-accent-foreground`,onMouseDown:t=>{t.preventDefault(),e.command(n)},children:(0,Z.jsx)(t,{className:`size-3.5`})})}),(0,Z.jsxs)(Ns,{side:`bottom`,sideOffset:8,children:[(0,Z.jsx)(`span`,{className:`capitalize`,children:e.name}),(0,Z.jsx)(Yt,{"aria-label":rc(e.shortcutId),children:tc(e.shortcutId)})]})]},e.name)}),t[2]=i,t[3]=n,t[4]=a):a=t[4];let o;return t[5]===a?o=t[6]:(o=(0,Z.jsx)(`div`,{className:`flex items-center gap-0.5`,children:a}),t[5]=a,t[6]=o),o}function mE(e){return Object.fromEntries(fE.map(t=>[t.name,t.isActive(e.editor)]))}function hE(e){let t=(0,$.c)(66),{editor:n}=e,{_:r}=i(),[a,o]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(``),u=(0,Q.useRef)(null),{folderPaths:d,loading:p,pages:m}=is(),h;t[0]===n?h=t[1]:(h=n.state.selection.empty&&n.isActive(`link`),t[0]=n,t[1]=h);let g=h,v;t[2]===n?v=t[3]:(v=n.getAttributes(`link`).href??``,t[2]=n,t[3]=v);let y=v,b;t[4]===n?b=t[5]:(b=function(){return n.state.selection.empty&&n.isActive(`link`)?n.getAttributes(`link`).href??``:``},t[4]=n,t[5]=b);let x=b,S,C;t[6]===n?(S=t[7],C=t[8]):(S=()=>{let e=function(){n.state.selection.empty&&o(!1)};return n.on(`selectionUpdate`,e),()=>{n.off(`selectionUpdate`,e)}},C=[n],t[6]=n,t[7]=S,t[8]=C),(0,Q.useEffect)(S,C);let w,T;t[9]===a?(w=t[10],T=t[11]):(w=()=>{a&&requestAnimationFrame(()=>u.current?.focus())},T=[a],t[9]=a,t[10]=w,t[11]=T),(0,Q.useEffect)(w,T);let E;t[12]!==n||t[13]!==g||t[14]!==c?(E=function(){c.trim()?n.chain().focus().setLink({href:c.trim()}).run():g&&n.chain().focus().unsetLink().run(),o(!1)},t[12]=n,t[13]=g,t[14]=c,t[15]=E):E=t[15];let D=E,O;t[16]===n?O=t[17]:(O=function(){n.chain().focus().unsetLink().run(),o(!1)},t[16]=n,t[17]=O);let k=O,A;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(e){l(st(e.path,null))},t[18]=A):A=t[18];let j=A,M;t[19]!==D||t[20]!==n?(M=function(e){e.key===`Enter`&&(e.preventDefault(),D()),e.key===`Escape`&&(e.preventDefault(),o(!1),n.chain().focus().run())},t[19]=D,t[20]=n,t[21]=M):M=t[21];let N=M;if(a){let e;t[22]===r?e=t[23]:(e=r({id:`ZsGpr_`}),t[22]=r,t[23]=e);let n;t[24]===r?n=t[25]:(n=r({id:`roAe2K`}),t[24]=r,t[25]=n);let i;t[26]!==d||t[27]!==N||t[28]!==p||t[29]!==m||t[30]!==e||t[31]!==n||t[32]!==c?(i=(0,Z.jsx)(_,{ref:u,type:`text`,placeholder:e,value:c,pages:m,folderPaths:d,loading:p,onValueChange:l,onSuggestionSelect:j,onKeyDown:N,"aria-label":n,className:`h-5 w-44 rounded-none border-none bg-transparent px-0 py-0 text-sm placeholder:text-muted-foreground focus-visible:border-transparent focus-visible:ring-0 dark:bg-transparent`}),t[26]=d,t[27]=N,t[28]=p,t[29]=m,t[30]=e,t[31]=n,t[32]=c,t[33]=i):i=t[33];let a;t[34]===r?a=t[35]:(a=r({id:`tP5DDk`}),t[34]=r,t[35]=a);let o;t[36]===D?o=t[37]:(o=()=>{D()},t[36]=D,t[37]=o);let h;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(pl,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[38]=h):h=t[38];let v;t[39]!==a||t[40]!==o?(v=(0,Z.jsx)(li,{variant:`ghost`,size:`icon-xs`,"aria-label":a,onClick:o,children:h}),t[39]=a,t[40]=o,t[41]=v):v=t[41];let b;t[42]!==i||t[43]!==v?(b=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5 rounded-md border bg-background px-2 py-1 focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50`,children:[i,v]}),t[42]=i,t[43]=v,t[44]=b):b=t[44];let x;t[45]!==r||t[46]!==y||t[47]!==g||t[48]!==k?(x=g&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Is,{children:[(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(li,{variant:`ghost`,size:`icon-xs`,"aria-label":r({id:`2vIPtm`}),onMouseDown:e=>{e.preventDefault(),f(y)},children:(0,Z.jsx)(yo,{className:`size-3.5`})})}),(0,Z.jsx)(Ns,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(s,{id:`2vIPtm`})})]}),(0,Z.jsxs)(Is,{children:[(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(li,{variant:`ghost`,size:`icon-xs`,"aria-label":r({id:`484LKL`}),onMouseDown:e=>{e.preventDefault(),k()},children:(0,Z.jsx)(K,{className:`size-3.5`})})}),(0,Z.jsx)(Ns,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(s,{id:`484LKL`})})]})]}),t[45]=r,t[46]=y,t[47]=g,t[48]=k,t[49]=x):x=t[49];let S;return t[50]!==b||t[51]!==x?(S=(0,Z.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[b,x]}),t[50]=b,t[51]=x,t[52]=S):S=t[52],S}let P;t[53]===r?P=t[54]:(P=r({id:`p0Iq25`}),t[53]=r,t[54]=P);let F=g?`bg-accent text-primary`:`text-accent-foreground`,I;t[55]===x?I=t[56]:(I=e=>{e.preventDefault(),l(x()),o(!0)},t[55]=x,t[56]=I);let L;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(jl,{className:`size-3.5`}),t[57]=L):L=t[57];let R;t[58]!==P||t[59]!==F||t[60]!==I?(R=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(li,{variant:`ghost`,size:`icon-xs`,"aria-label":P,className:F,onMouseDown:I,children:L})}),t[58]=P,t[59]=F,t[60]=I,t[61]=R):R=t[61];let z;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Z.jsx)(s,{id:`yzF66j`}),t[62]=z):z=t[62];let B;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsxs)(Ns,{side:`bottom`,sideOffset:8,children:[z,(0,Z.jsx)(Yt,{children:tc(`command-palette`)})]}),t[63]=B):B=t[63];let V;return t[64]===R?V=t[65]:(V=(0,Z.jsxs)(Is,{children:[R,B]}),t[64]=R,t[65]=V),V}function gE({editor:e}){if(Be(e.state).query||e.isActive(`codeBlock`))return!1;if(dE(e)||KT(e))return!0;if(e.state.selection.empty)return!1;let{from:t,to:n}=e.state.selection;return!!e.state.doc.textBetween(t,n,` `).trim()}function _E(e){let t=(0,$.c)(23),{editor:n,shortcutEnabled:r}=e,i=r===void 0?!0:r,a=(0,Q.useRef)(null),[o,s]=(0,Q.useState)(0),c=(0,Q.useRef)(null),l;t[0]===n?l=t[1]:(l={editor:n,selector:SE},t[0]=n,t[1]=l);let u=Le(l),d;t[2]===n?d=t[3]:(d={editor:n,selector:xE},t[2]=n,t[3]=d);let f=Le(d),p;t[4]!==n.state||t[5]!==n.view?(p=()=>{try{let{from:e,to:t}=n.state.selection;return Un(n.view,e,t)}catch{return new DOMRect}},t[4]=n.state,t[5]=n.view,t[6]=p):p=t[6];let m;if(t[7]!==n.view.dom||t[8]!==p){let e={getBoundingClientRect:p,contextElement:n.view.dom};m=()=>{let t=a.current;t&&(c.current?.(),c.current=Os(e,t,()=>{Ps(e,t,{placement:`top`,strategy:`fixed`,middleware:[Ts(8),Ms(),Rs({padding:8})]}).then(e=>{let{x:n,y:r}=e;t.isConnected&&(t.style.position=`fixed`,t.style.left=`${n}px`,t.style.top=`${r}px`)}).catch(bE)}))},t[7]=n.view.dom,t[8]=p,t[9]=m}else m=t[9];let h=m,g;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>{c.current?.(),c.current=null,s(yE)},t[10]=g):g=t[10];let _=g,v;t[11]===h?v=t[12]:(v={onShow:h,onHide:_,strategy:`fixed`},t[11]=h,t[12]=v);let y;t[13]!==n||t[14]!==f||t[15]!==u||t[16]!==i||t[17]!==o?(y=u?(0,Z.jsx)(lE,{editor:n},`${o}-img-align`):f?(0,Z.jsx)(WT,{editor:n},`${o}-file`):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(NT,{editor:n}),(0,Z.jsx)(Pi,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(pE,{editor:n},o),(0,Z.jsx)(Pi,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(hE,{editor:n},`${o}-link`),(0,Z.jsx)(XT,{editor:n},`${o}-footnote`),(0,Z.jsx)(zT,{editor:n,shortcutEnabled:i},`${o}-edit-ai`)]}),t[13]=n,t[14]=f,t[15]=u,t[16]=i,t[17]=o,t[18]=y):y=t[18];let b;return t[19]!==n||t[20]!==v||t[21]!==y?(b=(0,Z.jsx)(jT,{ref:a,editor:n,"data-testid":`bubble-menu-bar`,appendTo:vE,shouldShow:gE,updateDelay:250,options:v,className:`z-50 flex items-center gap-0.5 rounded-lg border bg-background p-1 shadow-md`,children:y}),t[19]=n,t[20]=v,t[21]=y,t[22]=b):b=t[22],b}function vE(){return document.body}function yE(e){return e+1}function bE(){}function xE(e){return KT(e.editor)}function SE(e){return dE(e.editor)}var CE=56,wE=`0 2px 4px rgba(0, 0, 0, 0.08)`,TE=150,EE=globalThis.ScrollTimeline;function DE(e,t,n,r,i){let a=r-i;if(a<=0)return null;let o=e+n-(t+CE);return{startOffset:o,endOffset:o+a,maxShift:a}}var OE=new WeakMap;function kE(e){let t=OE.get(e);if(t){for(let e of t.animations)e.cancel();OE.delete(e)}}function AE(e){for(let t of Array.from(e.cells))kE(t)}var jE=e=>e.cellIndex===0?`3`:`2`;function ME(e,t){return NE(e,t,e=>({transform:`translateY(${e}px)`}))}function NE(e,t,n){if(!(t>0))return[{offset:0,...n(0)},{offset:1,...n(0)}];let r=t=>Math.max(0,Math.min(t-e.startOffset,e.maxShift));return Array.from(new Set([0,e.startOffset/t,e.endOffset/t,1].map(e=>Math.max(0,Math.min(e,1))))).sort((e,t)=>e-t).map(e=>({offset:e,...n(r(e*t))}))}function PE(e,t,n,r){if(!(t>0))return[{...n,offset:0},{...n,offset:1}];let i=e.startOffset/t;if(i<=0)return[{...r,offset:0},{...r,offset:1}];if(i>=1)return[{...n,offset:0},{...n,offset:1}];let a=Math.min(i+1/t,1);return[{...n,offset:0},{...n,offset:i},{...r,offset:a},{...r,offset:1}]}function FE(e,t,n){return PE(e,t,{zIndex:`auto`,boxShadow:`none`},{zIndex:n,boxShadow:wE})}function IE(e,t){return PE(e,t,{opacity:`0`},{opacity:`1`})}function LE(e,t,n,r){let i=jE(e),a=`sd|${n.startOffset}|${n.maxShift}|${r}|${i}`,o=OE.get(e);if(o?.key===a)return;if(o)for(let e of o.animations)e.cancel();let s={timeline:t,fill:`both`,easing:`linear`},c=e.animate(ME(n,r),s),l=e.animate(FE(n,r,i),s),u=e.animate(IE(n,r),{...s,pseudoElement:`::before`});OE.set(e,{key:a,animations:[c,l,u]})}function RE(e,t){let n=jE(e),r=`in|${t}|${n}`,i=OE.get(e);if(i?.key===r)return;if(i)for(let e of i.animations)e.cancel();let a=e.animate([{transform:`translateY(${t}px)`,zIndex:n,boxShadow:wE}],{duration:0,fill:`forwards`}),o=e.animate([{opacity:`1`}],{duration:0,fill:`forwards`,pseudoElement:`::before`});OE.set(e,{key:r,animations:[a,o]})}function zE(e,t,n,r){let i=e.getBoundingClientRect().top,a=e.scrollTop,o=e.scrollHeight-e.clientHeight,s=t.querySelectorAll(`.tableWrapper`);for(let e of s){r?.(e);let t=e.querySelector(`table`);if(!t)continue;let s=t.querySelector(`tbody`)?.rows[0];if(!s||!Array.from(s.cells).some(e=>e.tagName===`TH`))continue;let c=t.getBoundingClientRect(),l=s.getBoundingClientRect(),u=DE(a,i,c.top,c.height,l.height);if(!u){AE(s);continue}if(n){if(o<=0){AE(s);continue}for(let e of Array.from(s.cells))LE(e,n,u,o);continue}let d=Math.max(0,Math.min(a-u.startOffset,u.maxShift));if(d<=0||c.bottom<=i+CE){AE(s);continue}for(let e of Array.from(s.cells))RE(e,d)}}var BE=ti.create({name:`frozenTableHeaders`,addProseMirrorPlugins(){return[new or({key:new Vn(`frozenTableHeaders`),view(e){let t=null,n=null,r=null,i=null,a=null,o=!1,s=new Set,c=()=>{o||!t||zE(t,e.dom,n,u)},l=()=>{r??=requestAnimationFrame(()=>{r=null,c()})};function u(e){s.has(e)||(s.add(e),e.addEventListener(`contentvisibilityautostatechange`,l))}let d=()=>{if(n){i??l(),i!=null&&clearTimeout(i),i=setTimeout(()=>{i=null,c()},TE);return}l()};return requestAnimationFrame(()=>{if(!o){if(t=e.dom.closest(`[data-testid="editor-scroll-container"]`),t&&EE)try{n=new EE({source:t,axis:`block`})}catch{n=null}t?.addEventListener(`scroll`,d,{passive:!0}),t&&typeof ResizeObserver<`u`&&(a=new ResizeObserver(l),a.observe(t),a.observe(e.dom)),c()}}),{update(e,t){t.doc.eq(e.state.doc)||c()},destroy(){o=!0,t?.removeEventListener(`scroll`,d),a?.disconnect(),r!=null&&cancelAnimationFrame(r),i!=null&&clearTimeout(i);for(let e of s)e.removeEventListener(`contentvisibilityautostatechange`,l);s.clear();for(let t of e.dom.querySelectorAll(`.tableWrapper > table > tbody > tr:first-child`))AE(t)}}}})]}}),VE=`application/x-open-knowledge-sidebar-item+json`,HE={image:!0,video:!0,audio:!0,pdf:!0,text:!0};function UE(e){return JSON.stringify(e)}function WE(e){return e.kind===`folder`?{target:{kind:`folder`,target:e.folderPath,folderPath:e.folderPath},hash:Wo(e.folderPath)}:e.kind===`asset`?{target:{kind:`asset`,target:e.assetPath,assetPath:e.assetPath,mediaKind:e.mediaKind},hash:Yo(e.assetPath)}:{target:ds(e.docName,e.size)??{kind:`doc`,target:e.docName,docName:e.docName},hash:Ho(e.docName)}}function GE(e){if(!e||!Array.from(e.types).includes(`application/x-open-knowledge-sidebar-item+json`))return null;let t=e.getData(VE);if(!t)return null;let n;try{n=JSON.parse(t)}catch{return null}if(!KE(n)||n.v!==1||typeof n.kind!=`string`)return null;if(n.kind===`doc`){if(typeof n.docName!=`string`||n.docName.length===0)return null;let e=n.size;return e!==null&&typeof e!=`number`?null:{v:1,kind:`doc`,docName:n.docName,size:e}}if(n.kind===`folder`)return typeof n.folderPath==`string`?{v:1,kind:`folder`,folderPath:n.folderPath}:null;if(n.kind===`asset`){if(typeof n.assetPath!=`string`||n.assetPath.length===0)return null;let e=n.mediaKind;return e!==null&&!qE(e)?null:{v:1,kind:`asset`,assetPath:n.assetPath,mediaKind:e}}return null}function KE(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function qE(e){return typeof e==`string`&&Object.hasOwn(HE,e)}function JE(e,t){return(n,r)=>{let i=r,a=GE(i.dataTransfer);return a?(i.preventDefault(),t?.(a),!0):e(n,i)}}function YE(e,t){let n=WE(e);t(n.target,{tabBehavior:`append`}),Xo(n.hash)}function XE(e){return[...e?[{label:`Toggle header column`,icon:dl,run:e=>e.chain().focus().toggleHeaderColumn().run()}]:[],{label:`Insert column left`,icon:_i,run:e=>e.chain().focus().addColumnBefore().run()},{label:`Insert column right`,icon:no,run:e=>e.chain().focus().addColumnAfter().run()},{label:`Delete column`,icon:K,separatorBefore:!0,run:e=>e.chain().focus().deleteColumn().run()},{label:`Delete table`,icon:Tl,run:e=>e.chain().focus().deleteTable().run()}]}function ZE(e){return[...e?[{label:`Toggle header row`,icon:su,run:e=>e.chain().focus().toggleHeaderRow().run()}]:[],{label:`Insert row above`,icon:pt,run:e=>e.chain().focus().addRowBefore().run()},{label:`Insert row below`,icon:$e,run:e=>e.chain().focus().addRowAfter().run()},{label:`Delete row`,icon:K,separatorBefore:!0,run:e=>e.chain().focus().deleteRow().run()},{label:`Delete table`,icon:Tl,run:e=>e.chain().focus().deleteTable().run()}]}function QE(e){if(!e.isEditable||Be(e.state).query)return null;let{state:t,view:n}=e,r=t.selection.$from,i=-1;for(let e=r.depth;e>0;e--){let t=r.node(e).type.spec.tableRole;if(t===`cell`||t===`header_cell`){i=r.before(e);break}}if(i<0)return null;let a=n.nodeDOM(i);if(!(a instanceof HTMLTableCellElement))return null;let o=a.closest(`table`),s=a.closest(`tr`),c=a.closest(`.ProseMirror`);if(!o||!s||!c)return null;let l=Array.prototype.indexOf.call(o.rows,s),u=a.cellIndex,d=o.rows[0]?.cells[u],f=o.rows[l]?.cells[0];return!d||!f?null:{columnAnchor:d,rowAnchor:f,isFirstColumn:u===0,isFirstRow:l===0}}function $E(e){let t=(0,$.c)(22),{editor:n,anchor:r,axis:i,items:a}=e,o=(0,Q.useRef)(null),s,c;t[0]!==r||t[1]!==i?(s=()=>{let e=o.current;if(!e)return;let t=i===`column`?`top`:`left`,n=i===`column`?-14:-6;return Os(r,e,()=>{Ps(r,e,{strategy:`absolute`,placement:t,middleware:[Ts(n)]}).then(t=>{let{x:n,y:r}=t;e.style.left=`${n}px`,e.style.top=`${r}px`,e.style.opacity=`1`}).catch(eD)})},c=[r,i],t[0]=r,t[1]=i,t[2]=s,t[3]=c):(s=t[2],c=t[3]),(0,Q.useEffect)(s,c);let l=i===`column`?hl:Ea,u=i===`column`?`h-3 w-7 rounded-full p-0 text-gray-700 dark:text-muted-foreground bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 hover:text-foreground dark:hover:bg-gray-600 dark:hover:text-gray-100 relative before:absolute before:-inset-[6px] before:content-[""]`:`h-7 w-3 rounded-full p-0 text-gray-700 dark:text-muted-foreground bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 hover:text-foreground dark:hover:bg-gray-600 dark:hover:text-gray-100 relative before:absolute before:-inset-[6px] before:content-[""]`,d=i===`column`?`Column options`:`Row options`,f;t[4]===l?f=t[5]:(f=(0,Z.jsx)(l,{className:`size-3.5`,"aria-hidden":!0}),t[4]=l,t[5]=f);let p;t[6]!==u||t[7]!==d||t[8]!==f?(p=(0,Z.jsx)(ja,{asChild:!0,children:(0,Z.jsx)(li,{variant:`secondary`,className:u,"aria-label":d,children:f})}),t[6]=u,t[7]=d,t[8]=f,t[9]=p):p=t[9];let m=i===`column`?`center`:`start`,h=i===`column`?`bottom`:`right`,g;if(t[10]!==n||t[11]!==a){let e;t[13]===n?e=t[14]:(e=e=>(0,Z.jsxs)(Q.Fragment,{children:[e.separatorBefore&&(0,Z.jsx)(ro,{}),(0,Z.jsxs)(Da,{onSelect:()=>e.run(n),children:[(0,Z.jsx)(e.icon,{"aria-hidden":!0}),e.label]})]},e.label),t[13]=n,t[14]=e),g=a.map(e),t[10]=n,t[11]=a,t[12]=g}else g=t[12];let _;t[15]!==m||t[16]!==h||t[17]!==g?(_=(0,Z.jsx)(to,{align:m,side:h,className:`w-auto min-w-44 whitespace-nowrap`,children:g}),t[15]=m,t[16]=h,t[17]=g,t[18]=_):_=t[18];let v;return t[19]!==_||t[20]!==p?(v=(0,Z.jsx)(`div`,{ref:o,"data-testid":`table-cell-handle`,className:`absolute left-0 top-0 z-10 opacity-0`,children:(0,Z.jsxs)(oo,{children:[p,_]})}),t[19]=_,t[20]=p,t[21]=v):v=t[21],v}function eD(){}function tD(e){let t=(0,$.c)(18),{editor:n}=e,[r,i]=(0,Q.useState)(null),a,o;if(t[0]===n?(a=t[1],o=t[2]):(a=()=>{let e=()=>i(e=>{let t=QE(n);return e&&t&&e.columnAnchor===t.columnAnchor&&e.rowAnchor===t.rowAnchor?e:t});return e(),n.on(`selectionUpdate`,e),n.on(`update`,e),()=>{n.off(`selectionUpdate`,e),n.off(`update`,e)}},o=[n],t[0]=n,t[1]=a,t[2]=o),(0,Q.useEffect)(a,o),!r)return null;let s=r.columnAnchor,c;t[3]===r.isFirstColumn?c=t[4]:(c=XE(r.isFirstColumn),t[3]=r.isFirstColumn,t[4]=c);let l;t[5]!==r.columnAnchor||t[6]!==n||t[7]!==c?(l=(0,Z.jsx)($E,{editor:n,anchor:s,axis:`column`,items:c}),t[5]=r.columnAnchor,t[6]=n,t[7]=c,t[8]=l):l=t[8];let u=r.rowAnchor,d;t[9]===r.isFirstRow?d=t[10]:(d=ZE(r.isFirstRow),t[9]=r.isFirstRow,t[10]=d);let f;t[11]!==r.rowAnchor||t[12]!==n||t[13]!==d?(f=(0,Z.jsx)($E,{editor:n,anchor:u,axis:`row`,items:d}),t[11]=r.rowAnchor,t[12]=n,t[13]=d,t[14]=f):f=t[14];let p;return t[15]!==l||t[16]!==f?(p=(0,Z.jsxs)(`div`,{className:`ok-table-cell-handle-layer`,children:[l,f]}),t[15]=l,t[16]=f,t[17]=p):p=t[17],p}function nD(e){let{fragment:t,docName:n}=e,r=!1,i=!1,a=!1,o=()=>{r=!0},s=e=>{console.warn(`[walk-currency] ${e} at view init — stale pre-warm cannot be invalidated: a remote edit that landed in the construct→mount gap will not render, and the first local transaction may silently erase it from the CRDT for every peer and disk (vendored y-tiptap contract change? re-verify y-tiptap.cjs:263-268)`)},c=()=>{i&&(i=!1,t.unobserveDeep(o))},l=e=>{let t=kt.getState(e.state)?.binding;if(!t){ue.count(`ok/editor/walk-currency-disarmed`,{docName:n,reason:`no-binding`}),s(`no ySync binding on "${n}"`);return}if(typeof t._forceRerender!=`function`){ue.count(`ok/editor/walk-currency-disarmed`,{docName:n,reason:`no-force-rerender`}),s(`ySync binding on "${n}" exposes no _forceRerender`);return}ue.count(`ok/editor/pattern-d-stale-prewarm`,{docName:n}),t._forceRerender()};return ti.create({name:`walkCurrency`,onBeforeCreate(){t.observeDeep(o),i=!0},onDestroy(){c()},addProseMirrorPlugins(){return[new or({view:e=>(a||(a=!0,c(),r&&l(e)),{})})]}})}var rD=new WeakMap;function iD(e){let t=document.createElement(`span`);t.classList.add(`collaboration-cursor__caret`),t.style.borderColor=e.color;let n=document.createElement(`div`);return n.classList.add(`collaboration-cursor__label`),n.style.backgroundColor=e.color,n.style.color=Kr(e.color),n.textContent=e.name,t.append(n),t}var aD={state:`idle`,count:0,lastFiredAt:null,position:`append`,lastAgentId:null},oD=100,sD=100,cD=3,lD=250;function uD(e){return`contentComponent`in e&&`isEditorContentInitialized`in e}function dD(e,t){let n=w(e);if(!n||t.contains(n.dom))return!1;if(!uD(e))return console.warn(`[TiptapEditor] TipTap EditorContent binding fields missing; detached editor repair skipped`),!1;let r=e;if(r.contentComponent==null)return!1;try{n.setProps({nodeViews:{}})}catch{}return r.contentComponent=null,r.isEditorContentInitialized=!1,!0}function fD(){let e=new cr({extensions:mr});return{mdManager:e,text:Tt({mdManager:e}),html:L({mdManager:e}),paste:Se({mdManager:e}),drop:Te({mdManager:e})}}function pD(e,t){return t?{collaboration:fe.configure({document:e.document,ySyncOptions:{mapping:t}}),guard:[nD({fragment:e.document.getXmlFragment(`default`),docName:e.configuration.name??``})]}:{collaboration:fe.configure({document:e.document}),guard:[]}}function mD(e){let{provider:t,placeholder:n,prebuiltMapping:r,onWedged:i}=e,{collaboration:a,guard:o}=pD(t,r);return[...St.map(e=>e.name===`link`||e.name===`wikiLink`||e.name===`jsxComponent`?e.configure({docName:t.configuration.name??``}):e),Rw.configure({placeholder:n??`Type '/' for commands`,showOnlyCurrent:!0}),a,ti.create({name:`imageUploadDecoration`,addProseMirrorPlugins(){return[rt]}}),ti.create({name:`collaborationCursor`,addProseMirrorPlugins(){let e=t.awareness;if(!e)throw Error(`[TiptapEditor] HocuspocusProvider has no awareness instance — cursor plugin cannot initialize`);return[gt(e,{cursorBuilder:iD})]}}),ti.create({name:`bindingStalenessGuard`,addProseMirrorPlugins(){return[eT({fragment:t.document.getXmlFragment(`default`),docName:t.configuration.name??``,onWedged:i??(()=>{})})]}}),...o,BE]}function hD(e){let{provider:t,clipboard:n,ctorStart:r}=e;return{onBeforeCreate:({editor:e})=>{rD.set(e,r)},onCreate:({editor:e})=>{n.html.setView(e.view);let r=rD.get(e);if(rD.delete(e),r==null)return;let i=performance.now();ue(`ok/editor/create-tiptap`,{docName:t.configuration.name??`unknown`,ytextLength:t.document.getText(`source`).length},{startTime:r,duration:Math.max(0,i-r)})},editorProps:{attributes:{class:`pt-4 pb-4 h-full`},clipboardTextParser:(e,t,r,i)=>{let a=n.mdManager.parse(e);return i.state.schema.nodeFromJSON(a).content},clipboardTextSerializer:(e,t)=>n.text(e,t),clipboardSerializer:n.html.serializer,handlePaste:(e,t)=>n.paste(e,t),handleDrop:JE(n.drop,e.onSidebarDrop)},extensions:Zp(mD(e))}}function gD(e){let{provider:t,placeholder:n,clipboard:r,ctorStart:i,onWedged:a,onSidebarDrop:o}=e,s=t.document.getXmlFragment(`default`),c=new Map,l=hD({provider:t,placeholder:n,clipboard:r,ctorStart:i,prebuiltMapping:c,onWedged:a,onSidebarDrop:o}),u=l.onBeforeCreate;return{...l,onBeforeCreate:e=>{u?.(e);let{editor:t}=e,{doc:n,mapping:r}=Pt(s,t.schema);r.forEach((e,t)=>{c.set(t,e)}),t.options.content=n.toJSON()},element:null}}var _D=e=>{let t=(0,$.c)(24),{provider:n,placeholder:r,isSourceMode:i,portalTarget:a}=e,o=(0,Q.useRef)(null),s=(0,Q.useRef)(aD),c=Ww(),{principal:l,activeDocName:u,recycleDocument:d,openTarget:f}=ht(),p=n.configuration.name??``,[m]=(0,Q.useState)(fD),h;t[0]!==m||t[1]!==p||t[2]!==f||t[3]!==r||t[4]!==n||t[5]!==d?(h=()=>()=>({editor:new _r(gD({provider:n,placeholder:r,clipboard:m,ctorStart:performance.now(),onWedged:e=>{let{externalSeq:t,appliedSeq:n}=e;ue(`ok/editor/binding-wedge-recycle`,{docName:p,externalSeq:t,appliedSeq:n}),d(p)},onSidebarDrop:e=>{YE(e,f)}})),ydoc:n.document,ytext:n.document.getText(`source`),provider:n}),t[0]=m,t[1]=p,t[2]=f,t[3]=r,t[4]=n,t[5]=d,t[6]=h):h=t[6];let[g]=(0,Q.useState)(h),_,v;if(t[7]!==g||t[8]!==p||t[9]!==n.document){let e={viewCount:0,bytes:n.document.getText(`source`).length},r=ot(p)??crypto.randomUUID();_=Q.use,v=ee({docName:p,mountId:r,construct:g,sizeStats:e}),t[7]=g,t[8]=p,t[9]=n.document,t[10]=_,t[11]=v}else _=t[10],v=t[11];let y=_(v),b=y.editor,x,S;t[12]===y?(x=t[13],S=t[14]):(x=()=>()=>{de(y)},S=[y],t[12]=y,t[13]=x,t[14]=S),(0,Q.useEffect)(x,S);let C;return t[15]!==u||t[16]!==p||t[17]!==b||t[18]!==c||t[19]!==i||t[20]!==a||t[21]!==l||t[22]!==n?(C=(0,Z.jsx)(vD,{provider:n,isSourceMode:i,docName:p,activeDocName:u,identity:c,principal:l,editor:b,wrapperRef:o,flashStateRef:s,portalTarget:a}),t[15]=u,t[16]=p,t[17]=b,t[18]=c,t[19]=i,t[20]=a,t[21]=l,t[22]=n,t[23]=C):C=t[23],C},vD=e=>{let t=(0,$.c)(98),{provider:n,isSourceMode:r,docName:i,activeDocName:a,identity:o,principal:s,editor:c,wrapperRef:l,flashStateRef:u,portalTarget:f}=e,p=(0,Q.useRef)(null),[m,h]=(0,Q.useState)(0),g,_;t[0]===f?(g=t[1],_=t[2]):(g=()=>{let e=p.current;if(e)return e.appendChild(f),()=>{f.parentNode===e&&e.removeChild(f)}},_=[f],t[0]=f,t[1]=g,t[2]=_),(0,Q.useLayoutEffect)(g,_);let v,b;t[3]!==c||t[4]!==f?(v=()=>{dD(c,f)&&h(yD)},b=[c,f],t[3]=c,t[4]=f,t[5]=v,t[6]=b):(v=t[5],b=t[6]),(0,Q.useEffect)(v,b);let x;t[7]!==c||t[8]!==n.configuration.name?(x=()=>(Mt(c,n.configuration.name??null),()=>{Mt(c,null)}),t[7]=c,t[8]=n.configuration.name,t[9]=x):x=t[9];let S;t[10]!==c||t[11]!==n?(S=[c,n],t[10]=c,t[11]=n,t[12]=S):S=t[12],(0,Q.useEffect)(x,S);let C;t[13]!==c||t[14]!==n.configuration.name?(C=()=>{let e=n.configuration.name;if(e)return re(e,c),()=>N(e,c)},t[13]=c,t[14]=n.configuration.name,t[15]=C):C=t[15];let T;t[16]!==c||t[17]!==n?(T=[c,n],t[16]=c,t[17]=n,t[18]=T):T=t[18],(0,Q.useEffect)(C,T);let E;t[19]!==c||t[20]!==n.configuration.name?(E=()=>{let e=n.configuration.name;if(!e)return;let t=null,r=()=>{t=null,kc(e,`wysiwyg`,jc(c))},i=()=>{t&&clearTimeout(t),t=setTimeout(r,120)};return r(),c.on(`selectionUpdate`,i),c.on(`update`,i),()=>{t&&clearTimeout(t),c.off(`selectionUpdate`,i),c.off(`update`,i),kc(e,`wysiwyg`,null)}},t[19]=c,t[20]=n.configuration.name,t[21]=E):E=t[21];let D;t[22]!==c||t[23]!==n?(D=[c,n],t[22]=c,t[23]=n,t[24]=D):D=t[24],(0,Q.useEffect)(E,D);let O;t[25]!==c||t[26]!==n.configuration.name?(O=()=>{},t[25]=c,t[26]=n.configuration.name,t[27]=O):O=t[27];let k;t[28]!==c||t[29]!==n?(k=[c,n],t[28]=c,t[29]=n,t[30]=k):k=t[30],(0,Q.useEffect)(O,k);let A,j;t[31]===c?(A=t[32],j=t[33]):(A=()=>{let e=bD,t=null,n=()=>{if(t||c.isDestroyed)return;let n=w(c);n&&(t=n.dom,t.addEventListener(`keydown`,e),t.addEventListener(`paste`,e),t.addEventListener(`drop`,e),t.addEventListener(`cut`,e))},r=()=>{t&&=(t.removeEventListener(`keydown`,e),t.removeEventListener(`paste`,e),t.removeEventListener(`drop`,e),t.removeEventListener(`cut`,e),null)};return w(c)?n():c.on(`create`,n),()=>{c.off(`create`,n),r()}},j=[c],t[31]=c,t[32]=A,t[33]=j),(0,Q.useEffect)(A,j);let M,P;t[34]!==i||t[35]!==c?(M=()=>{let e=!1,t=()=>{if(e||c.isDestroyed||!w(c))return;e=!0;let t=y(i)?.selection??null;if(t)try{let e=c.state.doc.content.size;if(t.type===`text`){let n=Math.max(0,Math.min(t.anchor,e)),r=Math.max(0,Math.min(t.head,e));c.commands.setTextSelection({from:n,to:r})}else{let n=Math.max(0,Math.min(t.from,e));c.commands.setNodeSelection(n)}}catch(e){let t=e,n=t instanceof Error?t.message:String(t);console.warn(JSON.stringify({event:`ok-editor-selection-restore-failed`,docName:i,message:n})),ue(`ok/editor/selection-restore-failed`,{docName:i,message:n})}Jt(i)};if(w(c)){t();return}return c.on(`create`,t),()=>{c.off(`create`,t)}},P=[c,i],t[34]=i,t[35]=c,t[36]=M,t[37]=P):(M=t[36],P=t[37]),(0,Q.useEffect)(M,P);let F,I;t[38]!==u||t[39]!==n.document||t[40]!==l?(F=()=>{let e=n.document.getMap(`agent-flash`),t=Date.now(),r=0,i=null,a=null,o=null,s=()=>{let t=null;for(let[,n]of e.entries()){let e=n;e.timestamp&&(!t||e.timestamp>t.timestamp)&&(t={agentId:e.agentId??`unknown`,timestamp:e.timestamp,type:e.type??`insert`,description:e.description})}return t},c=e=>{u.current=e;let t=l.current;t&&(t.setAttribute(`data-agent-flash-state`,e.state),t.setAttribute(`data-agent-flash-count`,String(e.count)),t.setAttribute(`data-agent-flash-position`,e.position),t.setAttribute(`data-agent-flash-agent-id`,e.lastAgentId??``))},d=()=>{let e=s(),t=e?.description?.toLowerCase().includes(`prepend`)?`prepend`:`append`,n={state:`editing`,count:(u.current?.count??0)+1,lastFiredAt:Date.now(),position:t,lastAgentId:e?.agentId??null};c(n),document.dispatchEvent(new CustomEvent(`agent-flash`,{detail:n})),a&&clearTimeout(a),o&&clearTimeout(o),a=window.setTimeout(()=>{let e={...n,state:`settled`};c(e),document.dispatchEvent(new CustomEvent(`agent-flash-end`,{detail:e})),o=window.setTimeout(()=>{c({...e,state:`idle`})},300)},Rn)};c(aD);let f=()=>{if(pr(e),!Er(e,t)||document.visibilityState!==`visible`)return;let n=Date.now();if(t=n,n-r<500){if(!i){let e=500-(n-r);i=window.setTimeout(()=>{i=null,r=Date.now(),d()},e)}return}r=n,d()};e.observe(f);let p=()=>{document.visibilityState===`visible`?Er(e,t)&&(t=Date.now(),r=Date.now(),d()):t=Date.now()};return document.addEventListener(`visibilitychange`,p),()=>{e.unobserve(f),document.removeEventListener(`visibilitychange`,p),i&&clearTimeout(i),a&&clearTimeout(a),o&&clearTimeout(o)}},I=[n.document,u,l],t[38]=u,t[39]=n.document,t[40]=l,t[41]=F,t[42]=I):(F=t[41],I=t[42]),(0,Q.useEffect)(F,I);let L,R;t[43]!==a||t[44]!==i||t[45]!==c||t[46]!==n?(L=()=>{let e=0,t,r=null,o=null,s=null,l=function(){if(e<oD){e+=1,t=window.setTimeout(p,sD);return}r=null,o=null,e=0},u=function(e){let t=w(c);if(!t)return null;let n=CSS.escape(e);return t.dom.querySelector(`#${n}`)??t.dom.querySelector(`[data-mirror-source-id="${n}"]`)},d=function(e){let t=u(e);return t?(t.scrollIntoView({behavior:`smooth`,block:`start`}),!0):!1},f=function(e,n){let r=cD,o=()=>{t=void 0,!(i!==a||window.location.hash!==n)&&(d(e),--r,r>0&&(t=window.setTimeout(o,lD)))};t=window.setTimeout(o,lD)};function p(){if(!r||i!==a)return;let t=r,n=o;if(!n){l();return}d(t)?(s=n,r=null,o=null,e=0,f(t,n)):l()}let m=function(){if(i!==a)return;let n=window.location.hash;if(!r&&s===n)return;let c=os(n);if(!c){s=n;return}r=c,o=n,e=0,t!==void 0&&(clearTimeout(t),t=void 0),p()},h=function(){if(i===a){if(r){p();return}m()}};return m(),n.on(`synced`,h),c.on(`transaction`,h),window.addEventListener(`hashchange`,m),()=>{t!==void 0&&clearTimeout(t),n.off(`synced`,h),c.off(`transaction`,h),window.removeEventListener(`hashchange`,m)}},R=[n,c,i,a],t[43]=a,t[44]=i,t[45]=c,t[46]=n,t[47]=L,t[48]=R):(L=t[47],R=t[48]),(0,Q.useEffect)(L,R);let z,B;t[49]===c?(z=t[50],B=t[51]):(z=()=>{let e=function(e){let t=e.detail;if(!t||t.mode!==`wysiwyg`||c.isDestroyed)return;let n=w(c);if(!n)return;let r=n.dom.querySelectorAll(`h1, h2, h3, h4, h5, h6`)[t.index];r&&r.scrollIntoView({behavior:`smooth`,block:`start`})};return window.addEventListener(Ec,e),()=>window.removeEventListener(Ec,e)},B=[c],t[49]=c,t[50]=z,t[51]=B),(0,Q.useEffect)(z,B);let V;t[52]!==a||t[53]!==i||t[54]!==o||t[55]!==r||t[56]!==s||t[57]!==n.awareness?(V=()=>{let e=n.awareness;if(e){if(i!==a){e.setLocalState(null);return}e.setLocalState({user:Gw({principal:s,identity:o}),mode:r?`source`:`wysiwyg`})}},t[52]=a,t[53]=i,t[54]=o,t[55]=r,t[56]=s,t[57]=n.awareness,t[58]=V):V=t[58];let H;t[59]!==a||t[60]!==i||t[61]!==o||t[62]!==r||t[63]!==s||t[64]!==n?(H=[n,i,a,o,s,r],t[59]=a,t[60]=i,t[61]=o,t[62]=r,t[63]=s,t[64]=n,t[65]=H):H=t[65],(0,Q.useEffect)(V,H);let U,W;t[66]!==c||t[67]!==r?(U=()=>(d(c,r),()=>{d(c,!1)}),W=[c,r],t[66]=c,t[67]=r,t[68]=U,t[69]=W):(U=t[68],W=t[69]),(0,Q.useEffect)(U,W);let G;t[70]!==a||t[71]!==i||t[72]!==c||t[73]!==r?(G=!r&&(0,Z.jsx)(_E,{editor:c,shortcutEnabled:i===a}),t[70]=a,t[71]=i,t[72]=c,t[73]=r,t[74]=G):G=t[74];let K;t[75]!==c||t[76]!==r?(K=!r&&(0,Z.jsx)(tD,{editor:c}),t[75]=c,t[76]=r,t[77]=K):K=t[77];let q;t[78]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,Z.jsx)(`div`,{ref:p,style:{display:`contents`}}),t[78]=q):q=t[78];let J;t[79]!==c||t[80]!==m?(J=(0,Z.jsx)(je,{editor:c,className:`tiptap-editor-portal-content h-full`},m),t[79]=c,t[80]=m,t[81]=J):J=t[81];let ee;t[82]!==f||t[83]!==J?(ee=(0,rl.createPortal)(J,f),t[82]=f,t[83]=J,t[84]=ee):ee=t[84];let te;t[85]===c?te=t[86]:(te=(0,Z.jsx)(Hw,{editor:c}),t[85]=c,t[86]=te);let ne;t[87]===c?ne=t[88]:(ne=vt(c),t[87]=c,t[88]=ne);let Y;t[89]===ne.store?Y=t[90]:(Y=(0,Z.jsx)(At,{store:ne.store}),t[89]=ne.store,t[90]=Y);let ie;return t[91]!==G||t[92]!==K||t[93]!==ee||t[94]!==te||t[95]!==Y||t[96]!==l?(ie=(0,Z.jsxs)(`div`,{ref:l,className:`tiptap-editor h-full`,"data-agent-flash-state":`idle`,"data-agent-flash-count":`0`,"data-agent-flash-position":`append`,"data-agent-flash-agent-id":``,children:[G,K,q,ee,te,Y]}),t[91]=G,t[92]=K,t[93]=ee,t[94]=te,t[95]=Y,t[96]=l,t[97]=ie):ie=t[97],ie};function yD(e){return e+1}function bD(){return j()}var xD=class e{constructor(e,t,n,r){this.fromA=e,this.toA=t,this.fromB=n,this.toB=r}offset(t,n=t){return new e(this.fromA+t,this.toA+t,this.fromB+n,this.toB+n)}};function SD(e,t,n,r,i,a){if(e==r)return[];let o=MD(e,t,n,r,i,a),s=ND(e,t+o,n,r,i+o,a);t+=o,n-=s,i+=o,a-=s;let c=n-t,l=a-i;if(!c||!l)return[new xD(t,n,i,a)];if(c>l){let o=e.slice(t,n).indexOf(r.slice(i,a));if(o>-1)return[new xD(t,t+o,i,i),new xD(t+o+l,n,a,a)]}else if(l>c){let o=r.slice(i,a).indexOf(e.slice(t,n));if(o>-1)return[new xD(t,t,i,i+o),new xD(n,n,i+o+c,a)]}if(c==1||l==1)return[new xD(t,n,i,a)];let u=FD(e,t,n,r,i,a);if(u){let[o,s,c]=u;return SD(e,t,o,r,i,s).concat(SD(e,o+c,n,r,s+c,a))}return ED(e,t,n,r,i,a)}var CD=1e9,wD=0,TD=!1;function ED(e,t,n,r,i,a){let o=n-t,s=a-i;if(CD<1e9&&Math.min(o,s)>CD*16||wD>0&&Date.now()>wD)return Math.min(o,s)>CD*64?[new xD(t,n,i,a)]:ID(e,t,n,r,i,a);let c=Math.ceil((o+s)/2);OD.reset(c),kD.reset(c);let l=(n,a)=>e.charCodeAt(t+n)==r.charCodeAt(i+a),u=(t,i)=>e.charCodeAt(n-t-1)==r.charCodeAt(a-i-1),d=(o-s)%2==0?null:kD,f=d?null:OD;for(let p=0;p<c;p++){if(p>CD||wD>0&&!(p&63)&&Date.now()>wD)return ID(e,t,n,r,i,a);let m=OD.advance(p,o,s,c,d,!1,l)||kD.advance(p,o,s,c,f,!0,u);if(m)return AD(e,t,n,t+m[0],r,i,a,i+m[1])}return[new xD(t,n,i,a)]}var DD=class{constructor(){this.vec=[]}reset(e){this.len=e<<1;for(let e=0;e<this.len;e++)this.vec[e]=-1;this.vec[e+1]=0,this.start=this.end=0}advance(e,t,n,r,i,a,o){for(let s=-e+this.start;s<=e-this.end;s+=2){let c=r+s,l=s==-e||s!=e&&this.vec[c-1]<this.vec[c+1]?this.vec[c+1]:this.vec[c-1]+1,u=l-s;for(;l<t&&u<n&&o(l,u);)l++,u++;if(this.vec[c]=l,l>t)this.end+=2;else if(u>n)this.start+=2;else if(i){let e=r+(t-n)-s;if(e>=0&&e<this.len&&i.vec[e]!=-1)if(a){let n=i.vec[e];if(n>=t-l)return[n,r+n-e]}else{let n=t-i.vec[e];if(l>=n)return[l,u]}}}return null}},OD=new DD,kD=new DD;function AD(e,t,n,r,i,a,o,s){let c=!1;return!ZD(e,r)&&++r==n&&(c=!0),!ZD(i,s)&&++s==o&&(c=!0),c?[new xD(t,n,a,o)]:SD(e,t,r,i,a,s).concat(SD(e,r,n,i,s,o))}function jD(e,t){let n=1,r=Math.min(e,t);for(;n<r;)n<<=1;return n}function MD(e,t,n,r,i,a){if(t==n||t==a||e.charCodeAt(t)!=r.charCodeAt(i))return 0;let o=jD(n-t,a-i);for(let s=t,c=i;;){let i=s+o,l=c+o;if(i>n||l>a||e.slice(s,i)!=r.slice(c,l)){if(o==1)return s-t-+!ZD(e,s);o>>=1}else if(i==n||l==a)return i-t;else s=i,c=l}}function ND(e,t,n,r,i,a){if(t==n||i==a||e.charCodeAt(n-1)!=r.charCodeAt(a-1))return 0;let o=jD(n-t,a-i);for(let s=n,c=a;;){let a=s-o,l=c-o;if(a<t||l<i||e.slice(a,s)!=r.slice(l,c)){if(o==1)return n-s-+!ZD(e,s);o>>=1}else if(a==t||l==i)return n-a;else s=a,c=l}}function PD(e,t,n,r,i,a,o,s){let c=r.slice(i,a),l=null;for(;;){if(l||o<s)return l;for(let s=t+o;;){ZD(e,s)||s++;let u=s+o;if(ZD(e,u)||(u+=u==s+1?1:-1),u>=n)break;let d=e.slice(s,u),f=-1;for(;(f=c.indexOf(d,f+1))!=-1;){let o=MD(e,u,n,r,i+f+d.length,a),c=ND(e,t,s,r,i,i+f),p=d.length+o+c;(!l||l[2]<p)&&(l=[s-c,i+f-c,p])}s=u}if(s<0)return l;o>>=1}}function FD(e,t,n,r,i,a){let o=n-t,s=a-i;if(o<s){let o=FD(r,i,a,e,t,n);return o&&[o[1],o[0],o[2]]}return o<4||s*2<o?null:PD(e,t,n,r,i,a,Math.floor(o/4),-1)}function ID(e,t,n,r,i,a){TD=!0;let o=n-t,s=a-i,c;if(o<s){let s=PD(r,i,a,e,t,n,Math.floor(o/6),50);c=s&&[s[1],s[0],s[2]]}else c=PD(e,t,n,r,i,a,Math.floor(s/6),50);if(!c)return[new xD(t,n,i,a)];let[l,u,d]=c;return SD(e,t,l,r,i,u).concat(SD(e,l+d,n,r,u+d,a))}function LD(e,t){for(let n=1;n<e.length;n++){let r=e[n-1],i=e[n];r.toA>i.fromA-t&&r.toB>i.fromB-t&&(e[n-1]=new xD(r.fromA,i.toA,r.fromB,i.toB),e.splice(n--,1))}}function RD(e,t,n){for(;;){LD(n,1);let r=!1;for(let i=0;i<n.length;i++){let a=n[i],o,s;(o=MD(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new xD(a.fromA+o,a.toA,a.fromB+o,a.toB)),(s=ND(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new xD(a.fromA,a.toA-s,a.fromB,a.toB-s));let c=a.toA-a.fromA,l=a.toB-a.fromB;if(c&&l)continue;let u=a.fromA-(i?n[i-1].toA:0),d=(i<n.length-1?n[i+1].fromA:e.length)-a.toA;if(!u||!d)continue;let f=c?e.slice(a.fromA,a.toA):t.slice(a.fromB,a.toB);u<=f.length&&e.slice(a.fromA-u,a.fromA)==f.slice(f.length-u)?(n[i]=new xD(a.fromA-u,a.toA-u,a.fromB-u,a.toB-u),r=!0):d<=f.length&&e.slice(a.toA,a.toA+d)==f.slice(0,d)&&(n[i]=new xD(a.fromA+d,a.toA+d,a.fromB+d,a.toB+d),r=!0)}if(!r)break}return n}function zD(e,t,n){for(let r=0,i=0;i<e.length;i++){let a=e[i],o=a.toA-a.fromA,s=a.toB-a.fromB;if(o&&s||o>3||s>3){let c=i==e.length-1?t.length:e[i+1].fromA,l=a.fromA-r,u=c-a.toA,d=KD(t,a.fromA,l),f=GD(t,a.toA,u),p=a.fromA-d,m=f-a.toA;if((!o||!s)&&p&&m){let l=Math.max(o,s),[u,h,g]=o?[t,a.fromA,a.toA]:[n,a.fromB,a.toB];l>p&&t.slice(d,a.fromA)==u.slice(g-p,g)?(a=e[i]=new xD(d,d+o,a.fromB-p,a.toB-p),d=a.fromA,f=GD(t,a.toA,c-a.toA)):l>m&&t.slice(a.toA,f)==u.slice(h,h+m)&&(a=e[i]=new xD(f-o,f,a.fromB+m,a.toB+m),f=a.toA,d=KD(t,a.fromA,a.fromA-r)),p=a.fromA-d,m=f-a.toA}if(p||m)a=e[i]=new xD(a.fromA-p,a.toA+m,a.fromB-p,a.toB+m);else if(!o){let t=JD(n,a.fromB,a.toB),r,o=t<0?-1:qD(n,a.toB,a.fromB);t>-1&&(r=t-a.fromB)<=u&&n.slice(a.fromB,t)==n.slice(a.toB,a.toB+r)?a=e[i]=a.offset(r):o>-1&&(r=a.toB-o)<=l&&n.slice(a.fromB-r,a.fromB)==n.slice(o,a.toB)&&(a=e[i]=a.offset(-r))}else if(!s){let n=JD(t,a.fromA,a.toA),r,o=n<0?-1:qD(t,a.toA,a.fromA);n>-1&&(r=n-a.fromA)<=u&&t.slice(a.fromA,n)==t.slice(a.toA,a.toA+r)?a=e[i]=a.offset(r):o>-1&&(r=a.toA-o)<=l&&t.slice(a.fromA-r,a.fromA)==t.slice(o,a.toA)&&(a=e[i]=a.offset(-r))}}r=a.toA}return LD(e,3),e}var BD;try{BD=RegExp(`[\\p{Alphabetic}\\p{Number}]`,`u`)}catch{}function VD(e){return e>48&&e<58||e>64&&e<91||e>96&&e<123}function HD(e,t){if(t==e.length)return 0;let n=e.charCodeAt(t);return n<192?+!!VD(n):BD?!YD(n)||t==e.length-1?+!!BD.test(String.fromCharCode(n)):BD.test(e.slice(t,t+2))?2:0:0}function UD(e,t){if(!t)return 0;let n=e.charCodeAt(t-1);return n<192?+!!VD(n):BD?!XD(n)||t==1?+!!BD.test(String.fromCharCode(n)):BD.test(e.slice(t-2,t))?2:0:0}var WD=8;function GD(e,t,n){if(t==e.length||!UD(e,t))return t;for(let r=t,i=t+n,a=0;a<WD;a++){let t=HD(e,r);if(!t||r+t>i)return r;r+=t}return t}function KD(e,t,n){if(!t||!HD(e,t))return t;for(let r=t,i=t-n,a=0;a<WD;a++){let t=UD(e,r);if(!t||r-t<i)return r;r-=t}return t}function qD(e,t,n){for(;t!=n;t--)if(e.charCodeAt(t-1)==10)return t;return-1}function JD(e,t,n){for(;t!=n;t++)if(e.charCodeAt(t)==10)return t;return-1}var YD=e=>e>=55296&&e<=56319,XD=e=>e>=56320&&e<=57343;function ZD(e,t){return!t||t==e.length||!YD(e.charCodeAt(t-1))||!XD(e.charCodeAt(t))}function QD(e,t,n){let r=n?.override;return r?r(e,t):(CD=(n?.scanLimit??1e9)>>1,wD=n?.timeout?Date.now()+n.timeout:0,TD=!1,RD(e,t,SD(e,0,e.length,t,0,t.length)))}function $D(){return!TD}function eO(e,t,n){return zD(QD(e,t,n),e,t)}var tO=pc.define({combine:e=>e[0]}),nO=mc.define(),rO=pc.define(),iO=cc.define({create(e){return null},update(e,t){for(let n of t.effects)n.is(nO)&&(e=n.value);for(let n of t.state.facet(rO))e=n(e,t);return e}});function aO(e){let t=e.field(iO,!1);if(!t)return null;let n=e.facet(tO);return{chunks:t,side:n?n.side:null}}var oO=class e{constructor(e,t,n,r,i,a=!0){this.changes=e,this.fromA=t,this.toA=n,this.fromB=r,this.toB=i,this.precise=a}offset(t,n){return t||n?new e(this.changes,this.fromA+t,this.toA+t,this.fromB+n,this.toB+n,this.precise):this}get endA(){return Math.max(this.fromA,this.toA-1)}get endB(){return Math.max(this.fromB,this.toB-1)}static build(e,t,n){return lO(eO(e.toString(),t.toString(),n),e,t,0,0,$D())}static updateA(e,t,n,r,i){return pO(fO(e,r,!0,n.length),e,t,n,i)}static updateB(e,t,n,r,i){return pO(fO(e,r,!1,t.length),e,t,n,i)}};function sO(e,t,n,r){let i=n.lineAt(e),a=r.lineAt(t);return i.to==e&&a.to==t&&e<n.length&&t<r.length?[e+1,t+1]:[i.from,a.from]}function cO(e,t,n,r){let i=n.lineAt(e),a=r.lineAt(t);return i.from==e&&a.from==t?[e,t]:[i.to+1,a.to+1]}function lO(e,t,n,r,i,a){let o=[];for(let s=0;s<e.length;s++){let c=e[s],[l,u]=sO(c.fromA+r,c.fromB+i,t,n),[d,f]=cO(c.toA+r,c.toB+i,t,n),p=[c.offset(-l+r,-u+i)];for(;s<e.length-1;){let a=e[s+1],[o,c]=sO(a.fromA+r,a.fromB+i,t,n);if(o>d+1&&c>f+1)break;p.push(a.offset(-l+r,-u+i)),[d,f]=cO(a.toA+r,a.toB+i,t,n),s++}o.push(new oO(p,l,Math.max(l,d),u,Math.max(u,f),a))}return o}var uO=1e3;function dO(e,t,n,r){let i=0,a=e.length;for(;;){if(i==a){let r=0,a=0;i&&({toA:r,toB:a}=e[i-1]);let o=t-(n?r:a);return[r+o,a+o]}let o=i+a>>1,s=e[o],[c,l]=n?[s.fromA,s.toA]:[s.fromB,s.toB];if(c>t)a=o;else if(l<=t)i=o+1;else return r?[s.fromA,s.fromB]:[s.toA,s.toB]}}function fO(e,t,n,r){let i=[];return t.iterChangedRanges((a,o,s,c)=>{let l=0,u=n?t.length:r,d=0,f=n?r:t.length;a>uO&&([l,d]=dO(e,a-uO,n,!0)),o<t.length-uO&&([u,f]=dO(e,o+uO,n,!1));let p=c-s-(o-a),m,[h,g]=n?[p,0]:[0,p];i.length&&(m=i[i.length-1]).toA>=l?i[i.length-1]={fromA:m.fromA,fromB:m.fromB,toA:u,toB:f,diffA:m.diffA+h,diffB:m.diffB+g}:i.push({fromA:l,toA:u,fromB:d,toB:f,diffA:h,diffB:g})}),i}function pO(e,t,n,r,i){if(!e.length)return t;let a=[];for(let o=0,s=0,c=0,l=0;;o++){let u=o==e.length?null:e[o],d=u?u.fromA+s:n.length,f=u?u.fromB+c:r.length;for(;l<t.length;){let e=t[l];if(u&&(e.toA+s>d||e.toB+c>f))break;a.push(e.offset(s,c)),l++}if(!u)break;let p=u.toA+s+u.diffA,m=u.toB+c+u.diffB,h=eO(n.sliceString(d,p),r.sliceString(f,m),i);for(let e of lO(h,n,r,d,f,$D()))a.push(e);for(s+=u.diffA,c+=u.diffB;l<t.length;){let e=t[l];if(e.fromA+s>p&&e.fromB+c>m)break;l++}}return a}var mO={scanLimit:500},hO=hc.fromClass(class{constructor(e){({deco:this.deco,gutter:this.gutter}=TO(e))}update(e){(e.docChanged||e.viewportChanged||_O(e.startState,e.state)||vO(e.startState,e.state))&&({deco:this.deco,gutter:this.gutter}=TO(e.view))}},{decorations:e=>e.deco}),gO=ac.low(yc({class:`cm-changeGutter`,markers:e=>e.plugin(hO)?.gutter||xc.empty}));function _O(e,t){return e.field(iO,!1)!=t.field(iO,!1)}function vO(e,t){return e.facet(tO)!=t.facet(tO)}var yO=dc.line({class:`cm-changedLine`}),bO=dc.mark({class:`cm-changedText`}),xO=dc.mark({tagName:`ins`,class:`cm-insertedLine`}),SO=dc.mark({tagName:`del`,class:`cm-deletedLine`}),CO=new class extends vc{constructor(){super(...arguments),this.elementClass=`cm-changedLineGutter`}};function wO(e,t,n,r,i,a){let o=n?e.fromA:e.fromB,s=n?e.toA:e.toB,c=0;if(o!=s){i.add(o,o,yO),i.add(o,s,n?SO:xO),a&&a.add(o,o,CO);for(let l=t.iterRange(o,s-1),u=o;!l.next().done;){if(l.lineBreak){u++,i.add(u,u,yO),a&&a.add(u,u,CO);continue}let t=u+l.value.length;if(r)for(;c<e.changes.length;){let r=e.changes[c],a=o+(n?r.fromA:r.fromB),s=o+(n?r.toA:r.toB),l=Math.max(u,a),d=Math.min(t,s);if(l<d&&i.add(l,d,bO),s<t)c++;else break}u=t}}}function TO(e){let t=e.state.field(iO),{side:n,highlightChanges:r,markGutter:i,overrideChunk:a}=e.state.facet(tO),o=n==`a`,s=new fc,c=i?new fc:null,{from:l,to:u}=e.viewport;for(let n of t){if((o?n.fromA:n.fromB)>=u)break;(o?n.toA:n.toB)>l&&(!a||!a(e.state,n,s,c))&&wO(n,e.state.doc,o,r,s,c)}return{deco:s.finish(),gutter:c&&c.finish()}}var EO=class extends ic{constructor(e){super(),this.height=e}eq(e){return this.height==e.height}toDOM(){let e=document.createElement(`div`);return e.className=`cm-mergeSpacer`,e.style.height=this.height+`px`,e}updateDOM(e){return e.style.height=this.height+`px`,!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}},DO=mc.define({map:(e,t)=>e.map(t)}),OO=cc.define({create:()=>dc.none,update:(e,t)=>{for(let e of t.effects)if(e.is(DO))return e.value;return e.map(t.changes)},provide:e=>_c.decorations.from(e)}),kO=.01;function AO(e,t){if(e.size!=t.size)return!1;let n=e.iter(),r=t.iter();for(;n.value;){if(n.from!=r.from||Math.abs(n.value.spec.widget.height-r.value.spec.widget.height)>1)return!1;n.next(),r.next()}return!0}function jO(e,t,n){let r=new fc,i=new fc,a=e.state.field(OO).iter(),o=t.state.field(OO).iter(),s=0,c=0,l=0,u=0,d=e.viewport,f=t.viewport;for(let p=0;;p++){let m=p<n.length?n[p]:null,h=m?m.fromA:e.state.doc.length,g=m?m.fromB:t.state.doc.length;if(s<h){let n=e.lineBlockAt(s).top+l-(t.lineBlockAt(c).top+u);n<-kO?(l-=n,r.add(s,s,dc.widget({widget:new EO(-n),block:!0,side:-1}))):n>kO&&(u+=n,i.add(c,c,dc.widget({widget:new EO(n),block:!0,side:-1})))}if(h>s+1e3&&s<d.from&&h>d.from&&c<f.from&&g>f.from){let e=Math.min(d.from-s,f.from-c);s+=e,c+=e,p--}else if(m)s=m.toA,c=m.toB;else break;for(;a.value&&a.from<s;)l-=a.value.spec.widget.height,a.next();for(;o.value&&o.from<c;)u-=o.value.spec.widget.height,o.next()}for(;a.value;)l-=a.value.spec.widget.height,a.next();for(;o.value;)u-=o.value.spec.widget.height,o.next();let p=e.contentHeight+l-(t.contentHeight+u);p<kO?r.add(e.state.doc.length,e.state.doc.length,dc.widget({widget:new EO(-p),block:!0,side:1})):p>kO&&i.add(t.state.doc.length,t.state.doc.length,dc.widget({widget:new EO(p),block:!0,side:1}));let m=r.finish(),h=i.finish();AO(m,e.state.field(OO))||e.dispatch({effects:DO.of(m)}),AO(h,t.state.field(OO))||t.dispatch({effects:DO.of(h)})}var MO=mc.define({map:(e,t)=>t.mapPos(e)}),NO=class extends ic{constructor(e){super(),this.lines=e}eq(e){return this.lines==e.lines}toDOM(e){let t=document.createElement(`div`);return t.className=`cm-collapsedLines`,t.textContent=e.state.phrase(`$ unchanged lines`,this.lines),t.addEventListener(`click`,t=>{let n=e.posAtDOM(t.target);e.dispatch({effects:MO.of(n)});let{side:r,sibling:i}=e.state.facet(tO);i&&i().dispatch({effects:MO.of(PO(n,e.state.field(iO),r==`a`))})}),t}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return`collapsed-unchanged-code`}};function PO(e,t,n){let r=0,i=0;for(let a=0;;a++){let o=a<t.length?t[a]:null;if(!o||(n?o.fromA:o.fromB)>=e)return i+(e-r);[r,i]=n?[o.toA,o.toB]:[o.toB,o.toA]}}var FO=cc.define({create(e){return dc.none},update(e,t){e=e.map(t.changes);for(let n of t.effects)n.is(MO)&&(e=e.update({filter:e=>e!=n.value}));return e},provide:e=>_c.decorations.from(e)});function IO({margin:e=3,minSize:t=4}){return FO.init(n=>LO(n,e,t))}function LO(e,t,n){let r=new fc,i=e.facet(tO).side==`a`,a=e.field(iO),o=1;for(let s=0;;s++){let c=s<a.length?a[s]:null,l=s?o+t:1,u=c?e.doc.lineAt(i?c.fromA:c.fromB).number-1-t:e.doc.lines,d=u-l+1;if(d>=n&&r.add(e.doc.line(l).from,e.doc.line(u).to,dc.replace({widget:new NO(d),block:!0})),!c)break;o=e.doc.lineAt(Math.min(e.doc.length,i?c.toA:c.toB)).number}return r.finish()}var RO=_c.styleModule.of(new bc({".cm-mergeView":{overflowY:`auto`},".cm-mergeViewEditors":{display:`flex`,alignItems:`stretch`},".cm-mergeViewEditor":{flexGrow:1,flexBasis:0,overflow:`hidden`},".cm-merge-revert":{width:`1.6em`,flexGrow:0,flexShrink:0,position:`relative`},".cm-merge-revert button":{position:`absolute`,display:`block`,width:`100%`,boxSizing:`border-box`,textAlign:`center`,background:`none`,border:`none`,font:`inherit`,cursor:`pointer`}})),zO=_c.baseTheme({".cm-mergeView & .cm-scroller, .cm-mergeView &":{height:`auto !important`,overflowY:`visible !important`},"&.cm-merge-a .cm-changedLine, .cm-deletedChunk":{backgroundColor:`rgba(160, 128, 100, .08)`},"&.cm-merge-b .cm-changedLine, .cm-inlineChangedLine":{backgroundColor:`rgba(100, 160, 128, .08)`},"&light.cm-merge-a .cm-changedText, &light .cm-deletedChunk .cm-deletedText":{background:`linear-gradient(#ee443366, #ee443366) bottom/100% 2px no-repeat`},"&dark.cm-merge-a .cm-changedText, &dark .cm-deletedChunk .cm-deletedText":{background:`linear-gradient(#ffaa9966, #ffaa9966) bottom/100% 2px no-repeat`},"&light.cm-merge-b .cm-changedText":{background:`linear-gradient(#22bb22aa, #22bb22aa) bottom/100% 2px no-repeat`},"&dark.cm-merge-b .cm-changedText":{background:`linear-gradient(#88ff88aa, #88ff88aa) bottom/100% 2px no-repeat`},"&.cm-merge-b .cm-deletedText":{background:`#ff000033`},".cm-insertedLine, .cm-deletedLine, .cm-deletedLine del":{textDecoration:`none`},".cm-deletedChunk":{paddingLeft:`6px`,"& .cm-chunkButtons":{position:`absolute`,insetInlineEnd:`5px`},"& button":{border:`none`,cursor:`pointer`,color:`white`,margin:`0 2px`,borderRadius:`3px`,"&[name=accept]":{background:`#2a2`},"&[name=reject]":{background:`#d43`}}},".cm-collapsedLines":{padding:`5px 5px 5px 10px`,cursor:`pointer`,"&:before":{content:`"⦚"`,marginInlineEnd:`7px`},"&:after":{content:`"⦚"`,marginInlineStart:`7px`}},"&light .cm-collapsedLines":{color:`#444`,background:`linear-gradient(to bottom, transparent 0, #f3f3f3 30%, #f3f3f3 70%, transparent 100%)`},"&dark .cm-collapsedLines":{color:`#ddd`,background:`linear-gradient(to bottom, transparent 0, #222 30%, #222 70%, transparent 100%)`},".cm-changeGutter":{width:`3px`,paddingLeft:`1px`},"&light.cm-merge-a .cm-changedLineGutter, &light .cm-deletedLineGutter":{background:`#e43`},"&dark.cm-merge-a .cm-changedLineGutter, &dark .cm-deletedLineGutter":{background:`#fa9`},"&light.cm-merge-b .cm-changedLineGutter":{background:`#2b2`},"&dark.cm-merge-b .cm-changedLineGutter":{background:`#8f8`},".cm-inlineChangedLineGutter":{background:`#75d`}}),BO=new gc,VO=new gc,HO=class{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig||mO;let t=[ac.low(hO),zO,RO,OO,_c.updateListener.of(e=>{this.measuring<0&&(e.heightChanged||e.viewportChanged)&&!e.transactions.some(e=>e.effects.some(e=>e.is(DO)))&&this.measure()})],n=[tO.of({side:`a`,sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&n.push(gO);let r=sc.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],_c.editorAttributes.of({class:`cm-merge-a`}),VO.of(n),t]}),i=[tO.of({side:`b`,sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&i.push(gO);let a=sc.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],_c.editorAttributes.of({class:`cm-merge-b`}),VO.of(i),t]});this.chunks=oO.build(r.doc,a.doc,this.diffConf);let o=[iO.init(()=>this.chunks),BO.of(e.collapseUnchanged?IO(e.collapseUnchanged):[])];r=r.update({effects:mc.appendConfig.of(o)}).state,a=a.update({effects:mc.appendConfig.of(o)}).state,this.dom=document.createElement(`div`),this.dom.className=`cm-mergeView`,this.editorDOM=this.dom.appendChild(document.createElement(`div`)),this.editorDOM.className=`cm-mergeViewEditors`;let s=e.orientation||`a-b`,c=document.createElement(`div`);c.className=`cm-mergeViewEditor`;let l=document.createElement(`div`);l.className=`cm-mergeViewEditor`,this.editorDOM.appendChild(s==`a-b`?c:l),this.editorDOM.appendChild(s==`a-b`?l:c),this.a=new _c({state:r,parent:c,root:e.root,dispatchTransactions:e=>this.dispatch(e,this.a)}),this.b=new _c({state:a,parent:l,root:e.root,dispatchTransactions:e=>this.dispatch(e,this.b)}),this.setupRevertControls(!!e.revertControls,e.revertControls==`b-to-a`,e.renderRevertControl),e.parent&&e.parent.appendChild(this.dom),this.scheduleMeasure()}dispatch(e,t){if(e.some(e=>e.docChanged)){let n=e[e.length-1],r=e.reduce((e,t)=>e.compose(t.changes),oc.empty(e[0].startState.doc.length));this.chunks=t==this.a?oO.updateA(this.chunks,n.newDoc,this.b.state.doc,r,this.diffConf):oO.updateB(this.chunks,this.a.state.doc,n.newDoc,r,this.diffConf),t.update([...e,n.state.update({effects:nO.of(this.chunks)})]);let i=t==this.a?this.b:this.a;i.update([i.state.update({effects:nO.of(this.chunks)})]),this.scheduleMeasure()}else t.update(e)}reconfigure(e){if(`diffConfig`in e&&(this.diffConf=e.diffConfig),`orientation`in e){let t=e.orientation!=`b-a`;if(t!=(this.editorDOM.firstChild==this.a.dom.parentNode)){let e=this.a.dom.parentNode,n=this.b.dom.parentNode;e.remove(),n.remove(),this.editorDOM.insertBefore(t?e:n,this.editorDOM.firstChild),this.editorDOM.appendChild(t?n:e),this.revertToLeft=!this.revertToLeft,this.revertDOM&&(this.revertDOM.textContent=``)}}if(`revertControls`in e||`renderRevertControl`in e){let t=!!this.revertDOM,n=this.revertToA,r=this.renderRevert;`revertControls`in e&&(t=!!e.revertControls,n=e.revertControls==`b-to-a`),`renderRevertControl`in e&&(r=e.renderRevertControl),this.setupRevertControls(t,n,r)}let t=`highlightChanges`in e,n=`gutter`in e,r=`collapseUnchanged`in e;if(t||n||r){let i=[],a=[];if(t||n){let r=this.a.state.facet(tO),o=n?e.gutter!==!1:r.markGutter,s=t?e.highlightChanges!==!1:r.highlightChanges;i.push(VO.reconfigure([tO.of({side:`a`,sibling:()=>this.b,highlightChanges:s,markGutter:o}),o?gO:[]])),a.push(VO.reconfigure([tO.of({side:`b`,sibling:()=>this.a,highlightChanges:s,markGutter:o}),o?gO:[]]))}if(r){let t=BO.reconfigure(e.collapseUnchanged?IO(e.collapseUnchanged):[]);i.push(t),a.push(t)}this.a.dispatch({effects:i}),this.b.dispatch({effects:a})}this.scheduleMeasure()}setupRevertControls(e,t,n){this.revertToA=t,this.revertToLeft=this.revertToA==(this.editorDOM.firstChild==this.a.dom.parentNode),this.renderRevert=n,!e&&this.revertDOM?(this.revertDOM.remove(),this.revertDOM=null):e&&!this.revertDOM?(this.revertDOM=this.editorDOM.insertBefore(document.createElement(`div`),this.editorDOM.firstChild.nextSibling),this.revertDOM.addEventListener(`mousedown`,e=>this.revertClicked(e)),this.revertDOM.className=`cm-merge-revert`):this.revertDOM&&(this.revertDOM.textContent=``)}scheduleMeasure(){this.measuring<0&&(this.measuring=(this.dom.ownerDocument.defaultView||window).requestAnimationFrame(()=>{this.measuring=-1,this.measure()}))}measure(){jO(this.a,this.b,this.chunks),this.revertDOM&&this.updateRevertButtons()}updateRevertButtons(){let e=this.revertDOM,t=e.firstChild,n=this.a.viewport,r=this.b.viewport;for(let i=0;i<this.chunks.length;i++){let a=this.chunks[i];if(a.fromA>n.to||a.fromB>r.to)break;if(a.fromA<n.from||a.fromB<r.from)continue;let o=this.a.lineBlockAt(a.fromA).top+`px`;for(;t&&+t.dataset.chunk<i;)t=UO(t);t&&t.dataset.chunk==String(i)?(t.style.top!=o&&(t.style.top=o),t=t.nextSibling):e.insertBefore(this.renderRevertButton(o,i),t)}for(;t;)t=UO(t)}renderRevertButton(e,t){let n;if(this.renderRevert)n=this.renderRevert();else{n=document.createElement(`button`);let e=this.a.state.phrase(`Revert this chunk`);n.setAttribute(`aria-label`,e),n.setAttribute(`title`,e),n.textContent=this.revertToLeft?`⇜`:`⇝`}return n.style.top=e,n.setAttribute(`data-chunk`,String(t)),n}revertClicked(e){let t=e.target,n;for(;t&&t.parentNode!=this.revertDOM;)t=t.parentNode;if(t&&(n=this.chunks[t.dataset.chunk])){let[t,r,i,a,o,s]=this.revertToA?[this.b,this.a,n.fromB,n.toB,n.fromA,n.toA]:[this.a,this.b,n.fromA,n.toA,n.fromB,n.toB],c=t.state.sliceDoc(i,Math.max(i,a-1));i!=a&&s<=r.state.doc.length&&(c+=t.state.lineBreak),r.dispatch({changes:{from:o,to:Math.min(r.state.doc.length,s),insert:c},userEvent:`revert`}),e.preventDefault()}}destroy(){this.a.destroy(),this.b.destroy(),this.measuring>-1&&(this.dom.ownerDocument.defaultView||window).cancelAnimationFrame(this.measuring),this.dom.remove()}};function UO(e){let t=e.nextSibling;return e.remove(),t}var WO=new class extends vc{constructor(){super(...arguments),this.elementClass=`cm-deletedLineGutter`}},GO=ac.low(yc({class:`cm-changeGutter`,markers:e=>e.plugin(hO)?.gutter||xc.empty,widgetMarker:(e,t)=>t instanceof XO?WO:null}));function KO(e){let t=typeof e.original==`string`?uc.of(e.original.split(/\r?\n/)):e.original,n=e.diffConfig||mO;return[ac.low(hO),tk,zO,_c.editorAttributes.of({class:`cm-merge-b`}),rO.of((e,t)=>{let r=t.effects.find(e=>e.is(qO));return r&&(e=oO.updateA(e,r.value.doc,t.startState.doc,r.value.changes,n)),t.docChanged&&(e=oO.updateB(e,t.state.field(JO),t.newDoc,t.changes,n)),e}),tO.of({highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1,syntaxHighlightDeletions:e.syntaxHighlightDeletions!==!1,syntaxHighlightDeletionsMaxLength:3e3,mergeControls:e.mergeControls??!0,overrideChunk:e.allowInlineDiffs?sk:void 0,side:`b`}),JO.init(()=>t),e.gutter===!1?[]:GO,e.collapseUnchanged?IO(e.collapseUnchanged):[],iO.init(e=>oO.build(t,e.doc,n))]}var qO=mc.define(),JO=cc.define({create:()=>uc.empty,update(e,t){for(let n of t.effects)n.is(qO)&&(e=n.value.doc);return e}}),YO=new WeakMap,XO=class extends ic{constructor(e){super(),this.buildDOM=e,this.dom=null}eq(e){return this.dom==e.dom}toDOM(e){return this.dom||=this.buildDOM(e)}};function ZO(e,t,n){let r=YO.get(t.changes);if(r)return r;let i=dc.widget({block:!0,side:-1,widget:new XO(r=>{let{highlightChanges:i,syntaxHighlightDeletions:a,syntaxHighlightDeletionsMaxLength:o,mergeControls:s}=e.facet(tO),c=document.createElement(`div`);if(c.className=`cm-deletedChunk`,s){let t=c.appendChild(document.createElement(`div`));t.className=`cm-chunkButtons`;let n=e=>{e.preventDefault(),QO(r,r.posAtDOM(c))},i=e=>{e.preventDefault(),$O(r,r.posAtDOM(c))};if(typeof s==`function`)t.appendChild(s(`accept`,n)),t.appendChild(s(`reject`,i));else{let r=t.appendChild(document.createElement(`button`));r.name=`accept`,r.textContent=e.phrase(`Accept`),r.onmousedown=n;let a=t.appendChild(document.createElement(`button`));a.name=`reject`,a.textContent=e.phrase(`Reject`),a.onmousedown=i}}if(n||t.fromA>=t.toA)return c;let l=r.state.field(JO).sliceString(t.fromA,t.endA),u=a&&e.facet(Sc),d=h(),f=t.changes,p=0,m=!1;function h(){let e=c.appendChild(document.createElement(`div`));return e.className=`cm-deletedLine`,e.appendChild(document.createElement(`del`))}function g(e,t,n){for(let r=e;r<t;){if(l.charAt(r)==`
|
|
28
28
|
`){d.firstChild||d.appendChild(document.createElement(`br`)),d=h(),r++;continue}let e=t,a=n+(m?` cm-deletedText`:``),o=!1,s=l.indexOf(`
|
|
29
|
-
`,r);if(s>-1&&s<t&&(e=s),i&&p<f.length){let t=Math.max(0,m?f[p].toA:f[p].fromA);t<=e&&(e=t,m&&p++,o=!0)}if(e>r){let t=document.createTextNode(l.slice(r,e));if(a){let e=d.appendChild(document.createElement(`span`));e.className=a,e.appendChild(t)}else d.appendChild(t);r=e}o&&(m=!m)}}if(u&&t.toA-t.fromA<=o){let t=u.parser.parse(l),n=0;lc(t,{style:t=>Cc(e,t)},(e,t,r)=>{e>n&&g(n,e,``),g(e,t,r),n=t}),g(n,l.length,``)}else g(0,l.length,``);return d.firstChild||d.appendChild(document.createElement(`br`)),c})});return YO.set(t.changes,i),i}function QO(e,t){let{state:n}=e,r=t??n.selection.main.head,i=e.state.field(iO).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=e.state.sliceDoc(i.fromB,Math.max(i.fromB,i.toB-1)),o=e.state.field(JO);i.fromB!=i.toB&&i.toA<=o.length&&(a+=e.state.lineBreak);let s=oc.of({from:i.fromA,to:Math.min(o.length,i.toA),insert:a},o.length);return e.dispatch({effects:qO.of({doc:s.apply(o),changes:s}),userEvent:`accept`}),!0}function $O(e,t){let{state:n}=e,r=t??n.selection.main.head,i=n.field(iO).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=n.field(JO).sliceString(i.fromA,Math.max(i.fromA,i.toA-1));return i.fromA!=i.toA&&i.toB<=n.doc.length&&(a+=n.lineBreak),e.dispatch({changes:{from:i.fromB,to:Math.min(n.doc.length,i.toB),insert:a},userEvent:`revert`}),!0}function ek(e){let t=new fc;for(let n of e.field(iO)){let r=e.facet(tO).overrideChunk&&rk(e,n);t.add(n.fromB,n.fromB,ZO(e,n,!!r))}return t.finish()}var tk=cc.define({create:e=>ek(e),update(e,t){return t.state.field(iO,!1)==t.startState.field(iO,!1)?e:ek(t.state)},provide:e=>_c.decorations.from(e)}),nk=new WeakMap;function rk(e,t){let n=nk.get(t);if(n!==void 0)return n;n=null;let r=e.field(JO),i=e.doc,a=r.lineAt(t.endA).number-r.lineAt(t.fromA).number+1,o=i.lineAt(t.endB).number-i.lineAt(t.fromB).number+1;abort:if(a==o&&a<10){let e=[],i=0,o=t.fromA,s=t.fromB;for(let n of t.changes){if(n.fromA<n.toA){i+=n.toA-n.fromA;let t=r.sliceString(o+n.fromA,o+n.toA);if(/\n/.test(t))break abort;e.push(dc.widget({widget:new ik(t),side:-1}).range(s+n.fromB))}n.fromB<n.toB&&e.push(bO.range(s+n.fromB,s+n.toB))}i<t.endA-t.fromA-a*2&&(n=e)}return nk.set(t,n),n}var ik=class extends ic{constructor(e){super(),this.text=e}eq(e){return this.text==e.text}toDOM(e){let t=document.createElement(`del`);return t.className=`cm-deletedText`,t.textContent=this.text,t}},ak=new class extends vc{constructor(){super(...arguments),this.elementClass=`cm-inlineChangedLineGutter`}},ok=dc.line({class:`cm-inlineChangedLine`});function sk(e,t,n,r){let i=rk(e,t),a=0;if(!i)return!1;for(let o=e.doc.lineAt(t.fromB);;){for(r&&r.add(o.from,o.from,ak),n.add(o.from,o.from,ok);a<i.length&&i[a].to<=o.to;){let e=i[a++];n.add(e.from,e.to,e.value)}if(o.to>=t.endB)break;o=e.doc.lineAt(o.to+1)}return!0}var ck=te({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),lk=G({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),uk=_c.theme({".cm-deletedChunk .cm-chunkButtons":{display:`flex`,gap:`0.25rem`},".cm-deletedChunk .cm-chunkButtons button[data-slot='button']":{margin:`0`,border:`1px solid transparent`,borderRadius:`min(var(--radius-md), 10px)`,color:`var(--primary-foreground)`},".cm-deletedChunk .cm-chunkButtons button[data-slot='button'][data-variant='destructive']":{color:`var(--destructive)`}});function dk({addControl:e,nextId:t,removeControl:n,root:r}){return(i,a)=>{let o=document.createElement(`span`);o.className=`inline-flex`;let s=t();return e({id:s,host:o,type:i,action:a}),queueMicrotask(()=>{r.contains(o)||n(s)}),o}}function fk(e){let t=(0,$.c)(32),{oldContent:n,newContent:r,layout:a,conflictMode:o,previewMode:c,oursOverride:l,onResolve:u,onAbort:d}=e,{_:f}=i(),p=l??r,m=(0,Q.useRef)(null),h=(0,Q.useRef)(null),g=(0,Q.useRef)(0),{resolvedTheme:_}=Pr(),v=(0,Q.useRef)(u),y=(0,Q.useRef)(d),[b,x]=(0,Q.useState)(null),S;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(S=[],t[0]=S):S=t[0];let[C,w]=(0,Q.useState)(S),T;t[1]!==d||t[2]!==u?(T=()=>{v.current=u,y.current=d},t[1]=d,t[2]=u,t[3]=T):T=t[3],(0,Q.useEffect)(T);let E,D;t[4]!==o||t[5]!==p||t[6]!==a||t[7]!==n||t[8]!==c||t[9]!==_?(E=()=>{let e=m.current;if(!e)return;w([]);let t=new Map,r=!1,i=e=>{r||!t.delete(e)||w(t=>t.filter(t=>t.id!==e))},s=new MutationObserver(()=>{for(let[n,r]of t)e.contains(r)||i(n)});s.observe(e,{childList:!0,subtree:!0});let l=_===`dark`?ck:lk,u=[_c.editable.of(!1),sc.readOnly.of(!0)],d=[Fc,wc(),...u,l,_c.lineWrapping];if(h.current&&=(h.current.destroy(),null),c)h.current=new _c({doc:p,extensions:d,parent:e}),x(null);else if(o){let a=dk({addControl:e=>{r||(t.set(e.id,e.host),w(t=>[...t,e]))},nextId:()=>(g.current+=1,g.current),removeControl:i,root:e}),o=new _c({doc:p,extensions:[Fc,wc(),_c.editable.of(!1),l,uk,_c.lineWrapping,KO({original:n,highlightChanges:!0,gutter:!0,mergeControls:a,collapseUnchanged:{margin:3,minSize:4}}),_c.updateListener.of(e=>{let t=aO(e.state);x(t?t.chunks.length:0)})],parent:e});h.current=o;let s=aO(o.state);x(s?s.chunks.length:0)}else a===`split`?h.current=new HO({a:{doc:n,extensions:d},b:{doc:p,extensions:d},parent:e,highlightChanges:!0,gutter:!0,collapseUnchanged:{margin:3,minSize:4}}):h.current=new _c({doc:p,extensions:[...d,KO({original:n,highlightChanges:!0,gutter:!0,mergeControls:!1,collapseUnchanged:{margin:3,minSize:4}})],parent:e});return()=>{r=!0,s.disconnect(),h.current&&=(h.current.destroy(),null)}},D=[n,p,a,_,o,c],t[4]=o,t[5]=p,t[6]=a,t[7]=n,t[8]=c,t[9]=_,t[10]=E,t[11]=D):(E=t[10],D=t[11]),(0,Q.useEffect)(E,D);let O;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(O=function(){let e=h.current;!e||!(e instanceof _c)||v.current?.(e.state.doc.toString())},t[12]=O):O=t[12];let k=O,A;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(){let e=h.current;!e||!(e instanceof _c)||ye(e)},t[13]=A):A=t[13];let j=A,M=b===0,N;t[14]!==f||t[15]!==b?(N=b===null?``:b===0?f({id:`lPzyrU`}):hs._({id:`8FqTCr`,values:{chunksRemaining:b}}),t[14]=f,t[15]=b,t[16]=N):N=t[16];let P=N,F;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(`div`,{ref:m,className:`diff-view min-h-0 flex-1 overflow-y-auto subtle-scrollbar`}),t[17]=F):F=t[17];let I;if(t[18]!==f||t[19]!==C){let e;t[21]===f?e=t[22]:(e=e=>(0,rl.createPortal)((0,Z.jsx)(li,{type:`button`,variant:e.type===`accept`?`default`:`destructive`,size:`xs`,onClick:t=>{e.action(t.nativeEvent)},children:e.type===`accept`?f({id:`g3UF2V`}):f({id:`1t_NnN`})}),e.host,e.id),t[21]=f,t[22]=e),I=C.map(e),t[18]=f,t[19]=C,t[20]=I}else I=t[20];let L;t[23]!==M||t[24]!==o||t[25]!==P||t[26]!==d||t[27]!==u?(L=o&&(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-3 py-2 border-t shrink-0`,children:[(0,Z.jsx)(`span`,{className:`text-xs ${M?`text-emerald-600 dark:text-emerald-400`:`text-muted-foreground`}`,children:P}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[d&&(0,Z.jsx)(li,{className:`uppercase font-mono`,variant:`ghost`,size:`sm`,onClick:d,children:(0,Z.jsx)(s,{id:`XyOUTJ`})}),(0,Z.jsx)(li,{className:`uppercase font-mono`,variant:`outline`,size:`sm`,onClick:j,children:`Undo`}),u&&(0,Z.jsx)(li,{variant:`default`,size:`sm`,disabled:!M,onClick:k,children:(0,Z.jsx)(s,{id:`Lcehxn`})})]})]}),t[23]=M,t[24]=o,t[25]=P,t[26]=d,t[27]=u,t[28]=L):L=t[28];let R;return t[29]!==L||t[30]!==I?(R=(0,Z.jsxs)(`div`,{className:`flex flex-col h-full`,children:[F,I,L]}),t[29]=L,t[30]=I,t[31]=R):R=t[31],R}async function pk(e,t,n){try{let r={file:e,strategy:t};n!==void 0&&(r.content=n);let i=await fetch(`/api/sync/resolve-conflict`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(r)});if(i.ok)return{ok:!0};let a;try{let e=await i.json();typeof e.detail==`string`?a=e.detail:typeof e.title==`string`&&(a=e.title)}catch{}return{ok:!1,detail:a}}catch(n){let r=n instanceof Error?n.message:String(n);return console.warn(JSON.stringify({event:`conflict-resolve-dispatch-failed`,file:e,strategy:t,detail:r})),{ok:!1,detail:r}}}async function mk(e,t){return pk(e,`content`,t)}async function hk(e){return pk(e,`mine`)}async function gk(e){return pk(e,`theirs`)}async function _k(e){return pk(e,`delete`)}async function vk(e){try{let t=await fetch(`/api/sync/conflict-content?file=${encodeURIComponent(e)}&source=ytext`);if(!t.ok){let n;try{let e=await t.json();typeof e.detail==`string`?n=e.detail:typeof e.title==`string`&&(n=e.title)}catch{}return console.warn(JSON.stringify({event:`conflict-content-fetch-failed`,file:e,status:t.status,detail:n})),null}let n=await t.json(),r=n.kind===`delete-modify`||n.kind===`modify-delete`||n.kind===`both-modified`?n.kind:`both-modified`;return n.kind!==r&&console.warn(JSON.stringify({event:`conflict-kind-missing-fallback`,file:e,receivedKind:n.kind??null})),{base:n.base??``,ours:n.ours??``,theirs:n.theirs??``,kind:r}}catch(t){return console.warn(JSON.stringify({event:`conflict-content-fetch-failed`,file:e,status:null,detail:t instanceof Error?t.message:String(t)})),null}}function yk(e){let t=(0,$.c)(84),{docName:n}=e,{_:r}=i(),{conflicts:a,loading:o}=Fi(),c;if(t[0]!==a||t[1]!==n){let e;t[3]===n?e=t[4]:(e=e=>qo(e.file)===n,t[3]=n,t[4]=e),c=a.find(e),t[0]=a,t[1]=n,t[2]=c}else c=t[2];let l=c,u=l?.file??`${n}.md`,[d,f]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(!1),_,v;t[5]===n?(_=t[6],v=t[7]):(_=()=>(console.warn(JSON.stringify({event:`editor-area-swap-to-diffview`,"doc.name":n})),()=>{console.warn(JSON.stringify({event:`editor-area-swap-from-diffview`,"doc.name":n}))}),v=[n],t[5]=n,t[6]=_,t[7]=v),(0,Q.useEffect)(_,v);let y=o||l===void 0,b,x;t[8]!==y||t[9]!==u?(b=()=>{if(y)return;let e=!1;return f(null),m(!1),vk(u).then(t=>{e||(t===null?m(!0):f(t))}),()=>{e=!0}},x=[u,y],t[8]=y,t[9]=u,t[10]=b,t[11]=x):(b=t[10],x=t[11]),(0,Q.useEffect)(b,x);let S;t[12]!==r||t[13]!==u?(S=async function(e){let t=await mk(u,e);t.ok||X.error(r({id:`K-h9cT`,values:{filePath:u}}),{description:t.detail})},t[12]=r,t[13]=u,t[14]=S):S=t[14];let C=S,w;t[15]!==r||t[16]!==u?(w=async function(e){g(!0);let t=await e(u);t.ok||(g(!1),X.error(r({id:`jPUPvG`,values:{filePath:u}}),{description:t.detail}))},t[15]=r,t[16]=u,t[17]=w):w=t[17];let T=w;if(p){let e;return t[18]===u?e=t[19]:(e=(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`ajz9F8`,values:{filePath:u}})}),t[18]=u,t[19]=e),e}if(d===null){let e;return t[20]===u?e=t[21]:(e=(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`DF1MtZ`,values:{filePath:u}})}),t[20]=u,t[21]=e),e}if(d.kind===`delete-modify`){let e;t[22]===d.theirs?e=t[23]:(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(fk,{oldContent:``,newContent:d.theirs,layout:`unified`,previewMode:!0})}),t[22]=d.theirs,t[23]=e);let n;t[24]===u?n=t[25]:(n={filePath:u},t[24]=u,t[25]=n);let r;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(r={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[26]=r):r=t[26];let i;t[27]===n?i=t[28]:(i=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`V48OUT`,values:n,components:r})}),t[27]=n,t[28]=i);let a;t[29]===T?a=t[30]:(a=()=>void T(_k),t[29]=T,t[30]=a);let o;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(s,{id:`Vlc75q`}),t[31]=o):o=t[31];let c;t[32]!==h||t[33]!==a?(c=(0,Z.jsx)(li,{type:`button`,variant:`destructive`,disabled:h,onClick:a,children:o}),t[32]=h,t[33]=a,t[34]=c):c=t[34];let l;t[35]===T?l=t[36]:(l=()=>void T(gk),t[35]=T,t[36]=l);let f;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(s,{id:`3mFsc3`}),t[37]=f):f=t[37];let p;t[38]!==h||t[39]!==l?(p=(0,Z.jsx)(li,{type:`button`,variant:`default`,disabled:h,onClick:l,children:f}),t[38]=h,t[39]=l,t[40]=p):p=t[40];let m;t[41]!==c||t[42]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-3`,children:[c,p]}),t[41]=c,t[42]=p,t[43]=m):m=t[43];let g;t[44]!==i||t[45]!==m?(g=(0,Z.jsxs)(`div`,{className:`flex flex-shrink-0 flex-wrap items-center justify-between gap-x-6 gap-y-3 border-t px-6 py-4`,children:[i,m]}),t[44]=i,t[45]=m,t[46]=g):g=t[46];let _;return t[47]!==g||t[48]!==e?(_=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[e,g]}),t[47]=g,t[48]=e,t[49]=_):_=t[49],_}if(d.kind===`modify-delete`){let e;t[50]===d.ours?e=t[51]:(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(fk,{oldContent:``,newContent:d.ours,layout:`unified`,previewMode:!0})}),t[50]=d.ours,t[51]=e);let n;t[52]===u?n=t[53]:(n={filePath:u},t[52]=u,t[53]=n);let r;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(r={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[54]=r):r=t[54];let i;t[55]===n?i=t[56]:(i=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`EhDLBx`,values:n,components:r})}),t[55]=n,t[56]=i);let a;t[57]===T?a=t[58]:(a=()=>void T(hk),t[57]=T,t[58]=a);let o;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(s,{id:`0NA4b3`}),t[59]=o):o=t[59];let c;t[60]!==h||t[61]!==a?(c=(0,Z.jsx)(li,{type:`button`,variant:`default`,disabled:h,onClick:a,children:o}),t[60]=h,t[61]=a,t[62]=c):c=t[62];let l;t[63]===T?l=t[64]:(l=()=>void T(_k),t[63]=T,t[64]=l);let f;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(s,{id:`qSxaOz`}),t[65]=f):f=t[65];let p;t[66]!==h||t[67]!==l?(p=(0,Z.jsx)(li,{type:`button`,variant:`destructive`,disabled:h,onClick:l,children:f}),t[66]=h,t[67]=l,t[68]=p):p=t[68];let m;t[69]!==c||t[70]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-3`,children:[c,p]}),t[69]=c,t[70]=p,t[71]=m):m=t[71];let g;t[72]!==i||t[73]!==m?(g=(0,Z.jsxs)(`div`,{className:`flex flex-shrink-0 flex-wrap items-center justify-between gap-x-6 gap-y-3 border-t px-6 py-4`,children:[i,m]}),t[72]=i,t[73]=m,t[74]=g):g=t[74];let _;return t[75]!==g||t[76]!==e?(_=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[e,g]}),t[75]=g,t[76]=e,t[77]=_):_=t[77],_}let E;t[78]===C?E=t[79]:(E=e=>void C(e),t[78]=C,t[79]=E);let D;return t[80]!==d.ours||t[81]!==d.theirs||t[82]!==E?(D=(0,Z.jsx)(fk,{oldContent:d.theirs,newContent:d.ours,layout:`unified`,conflictMode:!0,onResolve:E}),t[80]=d.ours,t[81]=d.theirs,t[82]=E,t[83]=D):D=t[83],D}function bk(e){let t=(0,$.c)(2),{docName:n,provider:r,children:i}=e;(0,Q.use)(It(n,r));let a;return t[0]===i?a=t[1]:(a=(0,Z.jsx)(Z.Fragment,{children:i}),t[0]=i,t[1]=a),a}var xk=`__back-nav__`;function Sk(e){return e instanceof Re||e instanceof yt||e instanceof Ne||e instanceof tt||e instanceof jt||e instanceof me?e.docName:null}function Ck(e){if(e instanceof Re){let t=e.docName;return{title:hs._({id:`Jejur6`}),summary:hs._({id:`jSY41h`,values:{docName:t}})}}if(e instanceof yt){let t=e.docName;return{title:hs._({id:`V7QxyT`}),summary:hs._({id:`xG4tb6`,values:{docName:t}})}}if(e instanceof Ne){let t=e.docName;return{title:hs._({id:`1di5fu`}),summary:hs._({id:`PQCdtv`,values:{docName:t}})}}if(e instanceof tt){let t=e.docName;return{title:hs._({id:`wvbc1r`}),summary:hs._({id:`IX7-sq`,values:{docName:t}})}}if(e instanceof jt)return{title:hs._({id:`Gfr4fu`}),summary:hs._({id:`j6LB7S`})};if(e instanceof me){let t=e.docName;return{title:hs._({id:`vv7kpg`}),summary:hs._({id:`mdKFEy`,values:{docName:t}})}}let t=e instanceof Error&&e.message?e.message:hs._({id:`W5A0Ly`});return{title:hs._({id:`29VNqC`}),summary:t}}function wk(e){let t=(0,$.c)(28),{error:n,resetErrorBoundary:r,activeDocName:i,previousDocName:a,onNavigateBack:o}=e,c;t[0]===n?c=t[1]:(c=Ck(n),t[0]=n,t[1]=c);let{title:l,summary:u}=c,d=!!a&&!!o,f=(0,Q.useRef)(null),p,m;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(p=()=>{f.current?.focus()},m=[],t[2]=p,t[3]=m):(p=t[2],m=t[3]),(0,Q.useEffect)(p,m);let h;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(TS,{size:80,variant:`sleeping`}),t[4]=h):h=t[4];let g;t[5]===l?g=t[6]:(g=(0,Z.jsx)(`h2`,{id:`document-error-title`,className:`text-2xl font-light tracking-tighter text-balance`,children:l}),t[5]=l,t[6]=g);let _;t[7]===u?_=t[8]:(_=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-muted-foreground`,children:u}),t[7]=u,t[8]=_);let v;t[9]!==g||t[10]!==_?(v=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[g,_]}),t[9]=g,t[10]=_,t[11]=v):v=t[11];let y;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(s,{id:`KDw4GX`}),t[12]=y):y=t[12];let b;t[13]===r?b=t[14]:(b=(0,Z.jsx)(li,{ref:f,variant:`default`,onClick:r,children:y}),t[13]=r,t[14]=b);let x;t[15]!==i||t[16]!==d||t[17]!==n||t[18]!==o||t[19]!==a||t[20]!==r?(x=d?(0,Z.jsx)(li,{variant:`ghost`,className:`font-mono uppercase`,onClick:()=>{!a||!o||(ut(Sk(n)??i),o(a),r(xk))},children:(0,Z.jsx)(s,{id:`CKyk7Q`})}):null,t[15]=i,t[16]=d,t[17]=n,t[18]=o,t[19]=a,t[20]=r,t[21]=x):x=t[21];let S;t[22]!==x||t[23]!==b?(S=(0,Z.jsxs)(`div`,{className:`mt-1 flex gap-2`,children:[b,x]}),t[22]=x,t[23]=b,t[24]=S):S=t[24];let C;return t[25]!==S||t[26]!==v?(C=(0,Z.jsxs)(`div`,{role:`alert`,"aria-labelledby":`document-error-title`,"data-slot":`document-error-boundary`,className:`flex h-full flex-col items-center justify-center gap-8 p-8 text-center`,children:[h,v,S]}),t[25]=S,t[26]=v,t[27]=C):C=t[27],C}function Tk(e){let t=(0,$.c)(17),{activeDocName:n,previousDocName:r,onNavigateBack:i,onRecycle:a,children:o}=e,s;t[0]!==n||t[1]!==i||t[2]!==r?(s=e=>(0,Z.jsx)(wk,{...e,activeDocName:n,previousDocName:r,onNavigateBack:i}),t[0]=n,t[1]=i,t[2]=r,t[3]=s):s=t[3];let c;t[4]===n?c=t[5]:(c=[n],t[4]=n,t[5]=c);let l;t[6]!==n||t[7]!==a?(l=e=>{if(e.reason===`imperative-api`){if(Array.isArray(e.args)&&e.args[0]===xk){console.warn(`[DocumentErrorBoundary] back-nav reset (no recycle)`);return}a(n),console.warn(`[DocumentErrorBoundary] retry recycled ${n}`)}else console.warn(`[DocumentErrorBoundary] reset by key change (${e.prev?.[0]} → ${e.next?.[0]})`)},t[6]=n,t[7]=a,t[8]=l):l=t[8];let u;t[9]===n?u=t[10]:(u=e=>{console.error(`[DocumentErrorBoundary] rendered fallback for ${n}: ${Ck(e).title}`,e)},t[9]=n,t[10]=u);let d;return t[11]!==o||t[12]!==s||t[13]!==c||t[14]!==l||t[15]!==u?(d=(0,Z.jsx)(le,{fallbackRender:s,resetKeys:c,onReset:l,onError:u,children:o}),t[11]=o,t[12]=s,t[13]=c,t[14]=l,t[15]=u,t[16]=d):d=t[16],d}function Ek(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=Cr(t);return{map:n,keys:kn(t),parseError:r}}function Dk(e){let t=(0,$.c)(21),{provider:n}=e,r;t[0]===n?r=t[1]:(r=()=>Ek(n),t[0]=n,t[1]=r);let[i,a]=(0,Q.useState)(r),o,s;t[2]===n?(o=t[3],s=t[4]):(o=()=>{let e=Nn(n);a(e.current());let t=e.subscribe(e=>{a(e)});return()=>{t(),e.dispose()}},s=[n],t[2]=n,t[3]=o,t[4]=s),(0,Q.useEffect)(o,s);let c;t[5]===i.map.icon?c=t[6]:(c=Qe(i.map.icon),t[5]=i.map.icon,t[6]=c);let l=c,u;t[7]===i.map.cover?u=t[8]:(u=ft(i.map.cover),t[7]=i.map.cover,t[8]=u);let d=u,f=d.kind===`url`||d.kind===`path`,p=l.kind!==`unsupported`;if(!f&&!p)return null;let m=f?`true`:`false`,h=p?`true`:`false`,g;t[9]!==d||t[10]!==f?(g=f?(0,Z.jsx)(Ok,{cover:d}):null,t[9]=d,t[10]=f,t[11]=g):g=t[11];let _;t[12]!==f||t[13]!==p||t[14]!==l?(_=p?(0,Z.jsx)(kk,{icon:l,hasCover:f}):null,t[12]=f,t[13]=p,t[14]=l,t[15]=_):_=t[15];let v;return t[16]!==m||t[17]!==h||t[18]!==g||t[19]!==_?(v=(0,Z.jsxs)(`div`,{className:`page-header editor-content-aligned`,"data-has-cover":m,"data-has-icon":h,"aria-hidden":`true`,"data-testid":`page-header`,children:[g,_]}),t[16]=m,t[17]=h,t[18]=g,t[19]=_,t[20]=v):v=t[20],v}function Ok(e){let t=(0,$.c)(2),{cover:n}=e,r;return t[0]===n.value?r=t[1]:(r=(0,Z.jsx)(`div`,{className:`page-header-cover`,"data-testid":`page-header-cover`,children:(0,Z.jsx)(`img`,{src:n.value,alt:``,draggable:!1,loading:`lazy`,referrerPolicy:`no-referrer`,className:`page-header-cover-img`})}),t[0]=n.value,t[1]=r),r}function kk(e){let t=(0,$.c)(9),{icon:n,hasCover:r}=e,i=r?`page-header-icon page-header-icon--with-cover`:`page-header-icon`;if(n.kind===`emoji`){let e;return t[0]!==n.value||t[1]!==i?(e=(0,Z.jsx)(`span`,{className:i,"data-testid":`page-header-icon`,"data-kind":`emoji`,children:n.value}),t[0]=n.value,t[1]=i,t[2]=e):e=t[2],e}let a;t[3]===n.value?a=t[4]:(a=(0,Z.jsx)(`img`,{src:n.value,alt:``,draggable:!1,referrerPolicy:`no-referrer`,className:`page-header-icon-img`}),t[3]=n.value,t[4]=a);let o;return t[5]!==n.kind||t[6]!==i||t[7]!==a?(o=(0,Z.jsx)(`span`,{className:i,"data-testid":`page-header-icon`,"data-kind":n.kind,children:a}),t[5]=n.kind,t[6]=i,t[7]=a,t[8]=o):o=t[8],o}function Ak(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=Cr(t);return{map:n,keys:kn(t),parseError:r}}function jk(e){let t=(0,$.c)(127),{provider:n}=e,{_:r}=i(),[a,o]=(0,Q.useState)(null),c;t[0]===n?c=t[1]:(c=()=>Ak(n),t[0]=n,t[1]=c);let[l,u]=(0,Q.useState)(c),d,f;t[2]===n?(d=t[3],f=t[4]):(d=()=>{let e=Nn(n);o(e),u(e.current());let t=e.subscribe(e=>{u(e)});return()=>{t(),e.dispose(),o(t=>t===e?null:t)}},f=[n],t[2]=n,t[3]=d,t[4]=f),(0,Q.useEffect)(d,f);let p=l.map,m=l.keys,h=l.parseError,[g,_]=(0,Q.useState)(!1),v;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(v={},t[5]=v):v=t[5];let[y,b]=(0,Q.useState)(v),[x,S]=(0,Q.useState)(null),[C,w]=(0,Q.useState)(null),T;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(T={},t[6]=T):T=t[6];let[E,D]=(0,Q.useState)(T),O;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(O={},t[7]=O):O=t[7];let[k,A]=(0,Q.useState)(O),j=n.configuration.name??``,M;t[8]!==r||t[9]!==a?(M=function(e){if(!a)return{ok:!1,error:r({id:`9zb2WA`})};let t=a.patch(e);if(t.ok)return{ok:!0};if(t.error.code===`WRITE_ERROR`)return console.warn(`[PropertyPanel] binding write error:`,t.error.detail),{ok:!1,error:t.error.detail};let n=br(t.error);return{ok:!1,error:t.error.issues[0]?.message??r({id:`8fRyLo`}),fieldErrors:Object.keys(n).length>0?n:void 0}},t[8]=r,t[9]=a,t[10]=M):M=t[10];let N=M,P;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(P=function(e){D(t=>{if(!Object.hasOwn(t,e))return t;let n={...t};return delete n[e],n})},t[11]=P):P=t[11];let F=P,I;t[12]===r?I=t[13]:(I=function(e,t){if(e.ok)return;let n=e.error??r({id:`4g19V6`}),i=e.fieldErrors??{};D(e=>{let r={...e};for(let e of t)r[e]=i[e]??n;return r}),A(e=>{let n={...e};for(let e of t)n[e]=(n[e]??0)+1;return n})},t[12]=r,t[13]=I);let L=I,R;t[14]!==N||t[15]!==L?(R=function(e,t){F(e),L(N({[e]:t}),[e])},t[14]=N,t[15]=L,t[16]=R):R=t[16];let z=R,B;t[17]!==N||t[18]!==L?(B=function(e){F(e),L(N({[e]:null}),[e])},t[17]=N,t[18]=L,t[19]=B):B=t[19];let H=B,U;t[20]!==r||t[21]!==a?(U=function(e,t){if(!a)return{ok:!1,error:r({id:`9zb2WA`})};if(e===t)return{ok:!0};let n=a.rename(e,t);if(n.ok)return{ok:!0};if(n.error.code===`WRITE_ERROR`)return{ok:!1,error:n.error.detail};let i=br(n.error);return{ok:!1,error:n.error.issues[0]?.message??r({id:`I1gRhX`}),fieldErrors:Object.keys(i).length>0?i:void 0}},t[20]=r,t[21]=a,t[22]=U):U=t[22];let W=U,G;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(G=function(e,t){return`${e} ${t}`},t[23]=G):G=t[23];let K=G,q;t[24]!==a||t[25]!==m?(q=function(e){if(!a)return;let t=String(e.active.id),n=e.over?String(e.over.id):null;if(!n||t===n)return;let r=m.map((e,t)=>K(e,t)),i=r.indexOf(t),o=r.indexOf(n);if(i<0||o<0)return;let s=m.slice(),[c]=s.splice(i,1);if(!c)return;s.splice(o,0,c);let l=a.reorder(s);l.ok||console.warn(`[PropertyPanel] reorder failed:`,l.error)},t[24]=a,t[25]=m,t[26]=q):q=t[26];let J=q,ee;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(ee={activationConstraint:{distance:4}},t[27]=ee):ee=t[27];let te;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(te={coordinateGetter:_a},t[28]=te):te=t[28];let ne=Ti(aa(ya,ee),aa(xa,te)),re;t[29]!==z||t[30]!==p?(re=function(e,t){let n=p[e];if(n===void 0)return;b(n=>({...n,[e]:t}));let r=sa(n,t);(!Object.hasOwn(p,e)||!wr(n,r))&&z(e,r)},t[29]=z,t[30]=p,t[31]=re):re=t[31];let Y=re,ie;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(ie=function(){S({name:``,type:`text`,value:``,error:null}),_(!1)},t[32]=ie):ie=t[32];let ae=ie,{addPropertySignal:oe,clearAddProperty:se}=kC(),ce;t[33]!==oe||t[34]!==j?(ce=oe.get(j)??0,t[33]=oe,t[34]=j,t[35]=ce):ce=t[35];let le=ce,ue,de;t[36]===le?(ue=t[37],de=t[38]):(ue=()=>{le>0&&(S({name:``,type:`text`,value:``,error:null}),_(!1))},de=[le],t[36]=le,t[37]=ue,t[38]=de),(0,Q.useEffect)(ue,de);let fe,pe;t[39]!==se||t[40]!==j?(fe=()=>()=>se(j),pe=[j,se],t[39]=se,t[40]=j,t[41]=fe,t[42]=pe):(fe=t[41],pe=t[42]),(0,Q.useEffect)(fe,pe);let me;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(me=function(e){S(t=>{if(!t)return t;let n=e===`date`?new Date().toISOString().slice(0,10):Yi[e];return{...t,type:e,value:n,error:null}})},t[43]=me):me=t[43];let he=me,ge;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(ge=function(e){S(t=>t&&{...t,value:e})},t[44]=ge):ge=t[44];let _e=ge,ve;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(ve=function(e){S(t=>t&&{...t,name:e,error:null})},t[45]=ve):ve=t[45];let ye=ve,be;t[46]!==r||t[47]!==x||t[48]!==N||t[49]!==p?(be=function(){if(!x)return;let e=x.name.trim();if(!e){S({...x,error:r({id:`8_brI5`})});return}if(e===`frontmatter`){S({...x,error:r({id:`dURmlQ`})});return}if(Object.hasOwn(p,e)){S({...x,error:r({id:`njU86j`,values:{trimmed:e}})});return}let t=N({[e]:x.value});if(t.ok){S(null);return}let n=t.fieldErrors?.[e],i=t.error??r({id:`OJeiSH`});S({...x,error:n??i})},t[46]=r,t[47]=x,t[48]=N,t[49]=p,t[50]=be):be=t[50];let xe=be,Se;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(Se=function(){S(null)},t[51]=Se):Se=t[51];let Ce=Se,we;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(we=function(e){w({key:e,draft:e,error:null})},t[52]=we):we=t[52];let Te=we,Ee;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=function(e){w(t=>t&&{...t,draft:e,error:null})},t[53]=Ee):Ee=t[53];let De=Ee,Oe;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=function(){w(null)},t[54]=Oe):Oe=t[54];let ke=Oe,Ae;t[55]!==r||t[56]!==p||t[57]!==W||t[58]!==C?(Ae=function(){if(!C)return;let e=C.draft.trim();if(!e){w(null);return}if(e===C.key){w(null);return}if(e===`frontmatter`){w({...C,error:r({id:`dURmlQ`})});return}if(Object.hasOwn(p,e)){w({...C,error:r({id:`njU86j`,values:{trimmed:e}})});return}let t=W(C.key,e);if(t.ok){b(t=>{if(!Object.hasOwn(t,C.key))return t;let n={...t};return n[e]=n[C.key],delete n[C.key],n}),F(C.key),w(null);return}let n=t.fieldErrors?.[e]??t.fieldErrors?.[C.key]??t.error??r({id:`2ryd91`});w({...C,error:n})},t[55]=r,t[56]=p,t[57]=W,t[58]=C,t[59]=Ae):Ae=t[59];let je=Ae,Me;t[60]!==p||t[61]!==m?(Me=m.length>0?m:Object.keys(p),t[60]=p,t[61]=m,t[62]=Me):Me=t[62];let Ne=Me,Pe;if(t[63]!==Ne){Pe=new Map;for(let e of Ne)Pe.set(e,(Pe.get(e)??0)+1);t[63]=Ne,t[64]=Pe}else Pe=t[64];if(Ne.length===0&&!x&&!h)return null;let Fe=!g,Ie;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=e=>_(!e),t[65]=Ie):Ie=t[65];let Le=!g,Re;t[66]===Le?Re=t[67]:(Re=(0,Z.jsx)(Po,{"data-expanded":Le,className:`size-3.5 shrink-0 text-muted-foreground transition-transform duration-150 ease-out data-[expanded=true]:rotate-90`}),t[66]=Le,t[67]=Re);let ze;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(ze=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`l_UFPv`})}),t[68]=ze):ze=t[68];let Be;t[69]===Re?Be=t[70]:(Be=(0,Z.jsx)(Fo,{asChild:!0,children:(0,Z.jsxs)(li,{type:`button`,variant:`ghost`,className:`mb-1.5 flex h-auto w-fit bg-transparent! items-center gap-1 px-1 py-0.5 text-base font-medium text-foreground hover:bg-transparent hover:text-foreground`,children:[Re,ze]})}),t[69]=Re,t[70]=Be);let Ve;t[71]===h?Ve=t[72]:(Ve=h?(0,Z.jsxs)(`div`,{role:`alert`,"data-testid":`property-panel-yaml-error`,className:`mb-1 flex items-start gap-1.5 rounded border border-destructive/30 bg-destructive/5 px-2 py-1.5 text-[11px] text-destructive`,children:[(0,Z.jsx)(Ro,{className:`size-3.5 shrink-0 mt-0.5`}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(s,{id:`zaXlhf`}),(0,Z.jsx)(`span`,{className:`block text-[10px] opacity-80`,children:h})]})]}):null,t[71]=h,t[72]=Ve);let He;if(t[73]!==Ne){let e;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(e=(e,t)=>K(e,t),t[75]=e):e=t[75],He=Ne.map(e),t[73]=Ne,t[74]=He}else He=t[74];let Ue;if(t[76]!==z||t[77]!==je||t[78]!==Pe||t[79]!==E||t[80]!==p||t[81]!==y||t[82]!==H||t[83]!==C||t[84]!==Ne||t[85]!==k||t[86]!==Y){let e;t[88]!==z||t[89]!==je||t[90]!==Pe||t[91]!==E||t[92]!==p||t[93]!==y||t[94]!==H||t[95]!==C||t[96]!==k||t[97]!==Y?(e=(e,t)=>{let n=p[e];if(n===void 0)return null;let r=y[e]??jn(n),i=C?.key===e?C:null,a=(Pe.get(e)??0)>1;return(0,Z.jsx)(Li,{sortableId:K(e,t),keyName:e,value:n,declared:r,error:E[e]??null,resetCounter:k[e]??0,isDuplicate:a,rename:{state:i,onBegin:()=>Te(e),onChangeDraft:De,onCommit:je,onCancel:ke},onCommit:t=>z(e,t),onChangeType:t=>Y(e,t),onRemove:()=>H(e)},`${e}-${t}`)},t[88]=z,t[89]=je,t[90]=Pe,t[91]=E,t[92]=p,t[93]=y,t[94]=H,t[95]=C,t[96]=k,t[97]=Y,t[98]=e):e=t[98],Ue=Ne.map(e),t[76]=z,t[77]=je,t[78]=Pe,t[79]=E,t[80]=p,t[81]=y,t[82]=H,t[83]=C,t[84]=Ne,t[85]=k,t[86]=Y,t[87]=Ue}else Ue=t[87];let We;t[99]!==He||t[100]!==Ue?(We=(0,Z.jsx)(ha,{items:He,strategy:qi,children:Ue}),t[99]=He,t[100]=Ue,t[101]=We):We=t[101];let Ge;t[102]!==J||t[103]!==ne||t[104]!==We?(Ge=(0,Z.jsx)(Qa,{sensors:ne,collisionDetection:Ca,onDragEnd:J,children:We}),t[102]=J,t[103]=ne,t[104]=We,t[105]=Ge):Ge=t[105];let Ke;t[106]!==z||t[107]!==E||t[108]!==p||t[109]!==k?(Ke=Object.hasOwn(p,`tags`)?null:(0,Z.jsx)(Li,{keyName:`tags`,value:[],declared:`list`,error:E.tags??null,resetCounter:k.tags??0,isPlaceholder:!0,onCommit:e=>z(`tags`,e),onChangeType:Mk},`virtual-tags`),t[106]=z,t[107]=E,t[108]=p,t[109]=k,t[110]=Ke):Ke=t[110];let qe;t[111]!==r||t[112]!==x||t[113]!==xe?(qe=x?(0,Z.jsx)(ra,{draft:x,onChangeName:ye,onChangeType:he,onChangeValue:_e,onCommit:xe,onCancel:Ce}):(0,Z.jsxs)(`div`,{className:`mt-1 flex items-center gap-1`,children:[(0,Z.jsx)(`span`,{"aria-hidden":!0,className:`h-7 w-4 shrink-0`}),(0,Z.jsxs)(li,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`add-property-trigger`,onClick:ae,"aria-label":r({id:`F-NRCj`}),className:`flex items-center gap-1.5 rounded px-2 py-1 font-medium text-sm hover:bg-muted/50 hover:text-foreground`,children:[(0,Z.jsx)(V,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`m16xKo`})})]})]}),t[111]=r,t[112]=x,t[113]=xe,t[114]=qe):qe=t[114];let Je;t[115]!==Ve||t[116]!==Ge||t[117]!==Ke||t[118]!==qe?(Je=(0,Z.jsxs)(No,{className:`overflow-hidden data-[state=open]:animate-[collapsible-down_150ms_ease-out] data-[state=closed]:animate-[collapsible-up_150ms_ease-in]`,children:[Ve,Ge,Ke,qe]}),t[115]=Ve,t[116]=Ge,t[117]=Ke,t[118]=qe,t[119]=Je):Je=t[119];let Ye;t[120]!==Fe||t[121]!==Be||t[122]!==Je?(Ye=(0,Z.jsx)(`div`,{className:`property-panel editor-content-aligned pt-4 pb-4 text-sm`,"data-testid":`property-panel`,children:(0,Z.jsxs)(Io,{open:Fe,onOpenChange:Ie,children:[Be,Je]})}),t[120]=Fe,t[121]=Be,t[122]=Je,t[123]=Ye):Ye=t[123];let Xe;return t[124]!==a||t[125]!==Ye?(Xe=(0,Z.jsx)(ki,{binding:a,children:Ye}),t[124]=a,t[125]=Ye,t[126]=Xe):Xe=t[126],Xe}function Mk(){}var Nk=v(`LARGE_DOC_CHAR_THRESHOLD`,5e5);function Pk(e){let t=e.threshold??Nk;return e.ytextLength>t?{renderSource:e.isSourceMode||e.visitedSource,renderVisual:!e.isSourceMode||e.visitedVisual,isLarge:!0}:{renderSource:!0,renderVisual:!0,isLarge:!1}}function Fk(e){return e.hasEmittedFirstToggle||!e.isLarge?!1:e.renderSource&&e.renderVisual}var Ik=v(`ACTIVITY_MOUNT_LIMIT`,3);function Lk(){return n(()=>import(`./SourceEditor-Ddk4Onbm.js`),__vite__mapDeps([55,1,37,2,38,39,23,40,41,42,43,44,45,46,47,14,6,8,9,22,3,24,4,12,10,11,48,56,26,54]),import.meta.url)}var Rk=(0,Q.lazy)(async()=>({default:(await Lk()).SourceEditor}));function zk(e,t,n){if(n<=0)return[];let r=e.filter(e=>!qe(e.docName)),i=[...r].sort((e,t)=>t.lastAccessedAt-e.lastAccessedAt).slice(0,n);if(t===null||i.some(e=>e.docName===t))return i;let a=r.find(e=>e.docName===t);return a?[...i.slice(0,n-1),a]:i}function Bk(e,t){return t.kind===`idle`?null:t.kind===`failed`&&t.failedDocNames.includes(e)?{kind:`failed`,title:hs._({id:`MTs6g3`}),summary:t.reason===`clear-data-timeout`?hs._({id:`Sc1bKE`,values:{docName:e}}):hs._({id:`ovIGrT`,values:{docName:e}}),actionLabel:hs._({id:`HpK_8d`})}:t.kind===`recovering`&&t.docNames.includes(e)?{kind:`recovering`,title:hs._({id:`cF9DyA`}),summary:t.phase===`clearing-local-cache`?hs._({id:`bmC18N`,values:{docName:e}}):hs._({id:`pAgkuZ`,values:{docName:e}})}:null}function Vk(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(Gt,{name:`activity-pool`,children:(0,Z.jsx)(Hk,{...e})}),t[0]=e,t[1]=n),n}function Hk(e){let t=(0,$.c)(15),{activeDocName:n,isSourceMode:r,editorPlaceholder:i,previousDocName:a,onNavigateBack:o,onRecycle:s}=e,{poolEntries:c,serverRestartRecovery:l}=ht(),{pages:u,loading:d}=is(),f=zk(c,n,Ik),p=(0,Q.useRef)(``),h=f.map(Uk).join(`,`),g=(0,Q.useRef)(c),_,v;t[0]===c?(_=t[1],v=t[2]):(_=()=>{g.current=c},v=[c],t[0]=c,t[1]=_,t[2]=v),(0,Q.useLayoutEffect)(_,v),(0,Q.useLayoutEffect)(()=>{if(p.current===h)return;let e=p.current?p.current.split(`,`):[],t=h?h.split(`,`):[],r=e.filter(e=>!t.includes(e)),i=t.filter(t=>!e.includes(t));for(let e of r)m(e);for(let e of i){let t=g.current.find(t=>t.docName===e)?.poolEventId;W(e,t&&t.length>0?t:crypto.randomUUID())}ue(`ok/activity/mount-list-change`,{active:n,mounted:t,evicted:r}),p.current=h,Wt(t)},[h,n]);let y;t[3]!==n||t[4]!==i||t[5]!==r||t[6]!==d||t[7]!==o||t[8]!==s||t[9]!==u||t[10]!==a||t[11]!==l?(y=e=>(0,Z.jsx)(Yk,{entry:e,isActive:e.docName===n,isSourceMode:r,editorPlaceholder:i,isNewDoc:!d&&!u.has(e.docName),previousDocName:a,onNavigateBack:o,onRecycle:s,serverRestartRecovery:l},e.docName),t[3]=n,t[4]=i,t[5]=r,t[6]=d,t[7]=o,t[8]=s,t[9]=u,t[10]=a,t[11]=l,t[12]=y):y=t[12];let b=f.map(y),x;return t[13]===b?x=t[14]:(x=(0,Z.jsx)(Z.Fragment,{children:b}),t[13]=b,t[14]=x),x}function Uk(e){return e.docName}function Wk(e){let t=(0,$.c)(8),{isActive:n,initialScrollTop:r,children:i}=e,a=(0,Q.useRef)(null),o=(0,Q.useRef)(r??0),s,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{let e=a.current;if(!e)return;let t=()=>{e.scrollTop>0&&(o.current=e.scrollTop)};return e.addEventListener(`scroll`,t,{passive:!0}),()=>e.removeEventListener(`scroll`,t)},c=[],t[0]=s,t[1]=c):(s=t[0],c=t[1]),(0,Q.useEffect)(s,c);let l,u;t[2]===n?(l=t[3],u=t[4]):(l=()=>{if(!n)return;let e=a.current;if(!e)return;let t=o.current;if(t===0)return;let r=performance.now(),i=!1;e.scrollTop=t,e.scrollTop===t&&e.scrollHeight>t&&ue(`ok/scroll-restore/phase1-success`,{target:t,elapsedMs:performance.now()-r});let s=!1,c=0,l=()=>{s||(s=!0,cancelAnimationFrame(c),clearTimeout(f),e.removeEventListener(`wheel`,u),e.removeEventListener(`touchstart`,u))},u=()=>l();e.addEventListener(`wheel`,u,{passive:!0}),e.addEventListener(`touchstart`,u,{passive:!0});let d=()=>{s||(e.scrollTop!==t&&e.scrollHeight>t&&(e.scrollTop=t,e.scrollTop===t&&!i&&(ue(`ok/scroll-restore/phase2-success`,{target:t,elapsedMs:performance.now()-r}),i=!0)),c=requestAnimationFrame(d))};c=requestAnimationFrame(d);let f=setTimeout(()=>{s||(e.scrollTop!==t&&e.scrollHeight>t&&ue(`ok/scroll-restore/abandoned`,{target:t,elapsedMs:performance.now()-r,scrollHeight:e.scrollHeight,finalScrollTop:e.scrollTop}),l())},2e3);return l},u=[n],t[2]=n,t[3]=l,t[4]=u),(0,Q.useLayoutEffect)(l,u);let d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(d={overflowAnchor:`auto`},t[5]=d):d=t[5];let f;return t[6]===i?f=t[7]:(f=(0,Z.jsx)(`div`,{ref:a,"data-testid":`editor-scroll-container`,className:`subtle-scrollbar h-full overflow-y-auto pt-14 scroll-pt-14`,style:d,children:i}),t[6]=i,t[7]=f),f}function Gk(e){let t=(0,$.c)(12),{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a}=e,o=r&&i,[s,c]=(0,Q.useState)(o),l,u;if(t[0]===o?(l=t[1],u=t[2]):(l=()=>{o&&c(!0)},u=[o],t[0]=o,t[1]=l,t[2]=u),(0,Q.useEffect)(l,u),!s&&!o)return null;let d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Ix,{}),t[3]=d):d=t[3];let f=n.docName,p;t[4]===n.provider.document?p=t[5]:(p=n.provider.document.getText(`source`),t[4]=n.provider.document,t[5]=p);let m;return t[6]!==a||t[7]!==n.docName||t[8]!==n.provider||t[9]!==o||t[10]!==p?(m=(0,Z.jsx)(Q.Suspense,{fallback:d,children:(0,Z.jsx)(Rk,{docName:f,ytext:p,provider:n.provider,placeholder:a,isSourceModeActive:o})}),t[6]=a,t[7]=n.docName,t[8]=n.provider,t[9]=o,t[10]=p,t[11]=m):m=t[11],m}function Kk(e){let t=(0,$.c)(18),{view:n}=e,r=n.kind===`failed`,i=r?`alert`:`status`,a=!r,o;t[0]===r?o=t[1]:(o=(0,Z.jsx)(`div`,{className:`flex size-12 items-center justify-center rounded-full border bg-muted text-muted-foreground`,children:r?(0,Z.jsx)(Ka,{className:`size-5`,"aria-hidden":`true`}):(0,Z.jsx)(h,{className:`size-5 animate-spin`,"aria-hidden":`true`})}),t[0]=r,t[1]=o);let s;t[2]===n.title?s=t[3]:(s=(0,Z.jsx)(`h2`,{className:`text-lg font-medium`,children:n.title}),t[2]=n.title,t[3]=s);let c;t[4]===n.summary?c=t[5]:(c=(0,Z.jsx)(`p`,{className:`max-w-md text-sm text-muted-foreground`,children:n.summary}),t[4]=n.summary,t[5]=c);let l;t[6]!==s||t[7]!==c?(l=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;t[9]!==r||t[10]!==n.actionLabel?(u=r?(0,Z.jsxs)(li,{type:`button`,onClick:qk,children:[(0,Z.jsx)(Ka,{className:`size-4`,"aria-hidden":`true`}),n.actionLabel]}):null,t[9]=r,t[10]=n.actionLabel,t[11]=u):u=t[11];let d;return t[12]!==i||t[13]!==a||t[14]!==o||t[15]!==l||t[16]!==u?(d=(0,Z.jsxs)(`div`,{"data-slot":`server-restart-recovery`,role:i,"aria-busy":a,className:`flex h-full flex-col items-center justify-center gap-6 p-8 text-center`,children:[o,l,u]}),t[12]=i,t[13]=a,t[14]=o,t[15]=l,t[16]=u,t[17]=d):d=t[17],d}function qk(){return window.location.reload()}function Jk(e){let t=(0,$.c)(2),{html:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(`div`,{className:`tiptap-editor h-full pointer-events-none`,"aria-hidden":`true`,children:(0,Z.jsx)(`div`,{className:`tiptap ProseMirror tiptap-editor-portal-content`,dangerouslySetInnerHTML:{__html:n}})}),t[0]=n,t[1]=r),r}function Yk(e){let t=(0,$.c)(53),{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a,isNewDoc:o,previousDocName:s,onNavigateBack:c,onRecycle:l,serverRestartRecovery:u}=e,d;t[0]!==n.docName||t[1]!==u?(d=Bk(n.docName,u),t[0]=n.docName,t[1]=u,t[2]=d):d=t[2];let f=d,p=hw(n.docName)===`conflict`,m;t[3]===n.docName?m=t[4]:(m=()=>{let e=document.createElement(`div`);return e.setAttribute(`data-ok-editor-portal`,n.docName),e.style.display=`contents`,e},t[3]=n.docName,t[4]=m);let[h]=(0,Q.useState)(m),g=n.provider.document.getText(`source`).length,[_,v]=(0,Q.useState)(i),[b,x]=(0,Q.useState)(!i),S,C;t[5]!==i||t[6]!==_||t[7]!==b?(S=()=>{i&&!_?v(!0):!i&&!b&&x(!0)},C=[i,_,b],t[5]=i,t[6]=_,t[7]=b,t[8]=S,t[9]=C):(S=t[8],C=t[9]),(0,Q.useEffect)(S,C);let w=Pk({ytextLength:g,isSourceMode:i,visitedSource:_,visitedVisual:b}),T=(0,Q.useRef)(``),E=`${w.isLarge}-${w.renderSource}-${w.renderVisual}`,D,O;t[10]!==n.docName||t[11]!==w.isLarge||t[12]!==w.renderSource||t[13]!==w.renderVisual||t[14]!==E||t[15]!==i||t[16]!==g?(D=()=>{T.current!==E&&(T.current=E,w.isLarge&&ue(`ok/activity/defer-mount`,{docName:n.docName,ytextLength:g,isSourceMode:i,renderSource:w.renderSource,renderVisual:w.renderVisual}))},O=[E,w.isLarge,w.renderSource,w.renderVisual,n.docName,g,i],t[10]=n.docName,t[11]=w.isLarge,t[12]=w.renderSource,t[13]=w.renderVisual,t[14]=E,t[15]=i,t[16]=g,t[17]=D,t[18]=O):(D=t[17],O=t[18]),(0,Q.useEffect)(D,O);let k;t[19]===n.docName?k=t[20]:(k=()=>y(n.docName),t[19]=n.docName,t[20]=k);let[A]=(0,Q.useState)(k),j=A?.html??null,[M,N]=(0,Q.useState)(!1),P,F;t[21]!==n.docName||t[22]!==w.isLarge||t[23]!==w.renderSource||t[24]!==w.renderVisual||t[25]!==M||t[26]!==i||t[27]!==g?(P=()=>{Fk({isLarge:w.isLarge,renderSource:w.renderSource,renderVisual:w.renderVisual,hasEmittedFirstToggle:M})&&(ue(`ok/cold/first-toggle`,{docName:n.docName,mountId:ot(n.docName),ytextLength:g,modeEnteredFirst:i?`source`:`visual`}),N(!0))},F=[M,w.isLarge,w.renderSource,w.renderVisual,n.docName,g,i],t[21]=n.docName,t[22]=w.isLarge,t[23]=w.renderSource,t[24]=w.renderVisual,t[25]=M,t[26]=i,t[27]=g,t[28]=P,t[29]=F):(P=t[28],F=t[29]),(0,Q.useEffect)(P,F);let I=r?`visible`:`hidden`,L=`editor:${n.docName}`,R=A?.scrollTop,z;t[30]!==a||t[31]!==n||t[32]!==w.renderSource||t[33]!==w.renderVisual||t[34]!==r||t[35]!==p||t[36]!==o||t[37]!==i||t[38]!==c||t[39]!==l||t[40]!==h||t[41]!==s||t[42]!==f||t[43]!==j?(z=f?(0,Z.jsx)(Kk,{view:f}):(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsx)(Tk,{activeDocName:n.docName,previousDocName:s,onNavigateBack:c,onRecycle:l,children:(0,Z.jsx)(Q.Suspense,{fallback:j?(0,Z.jsx)(Jk,{html:j}):(0,Z.jsx)(Ix,{}),children:(0,Z.jsx)(bk,{docName:n.docName,provider:n.provider,children:p?(0,Z.jsx)(yk,{docName:n.docName,provider:n.provider}):(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[!i&&(0,Z.jsx)(Dk,{provider:n.provider}),!i&&(0,Z.jsx)(jk,{provider:n.provider}),(0,Z.jsxs)(`div`,{className:`relative flex-1`,children:[w.renderSource?(0,Z.jsx)(`div`,{className:i?`h-full`:`ok-mode-hidden h-full`,children:(0,Z.jsx)(Gk,{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a})}):null,w.renderVisual?(0,Z.jsx)(`div`,{className:i?`ok-mode-hidden h-full`:`h-full`,children:(0,Z.jsx)(_D,{provider:n.provider,placeholder:a,isSourceMode:i,portalTarget:h},`${n.docName}-${String(o)}-${n.poolEventId}`)}):null]})]})})})})}),t[30]=a,t[31]=n,t[32]=w.renderSource,t[33]=w.renderVisual,t[34]=r,t[35]=p,t[36]=o,t[37]=i,t[38]=c,t[39]=l,t[40]=h,t[41]=s,t[42]=f,t[43]=j,t[44]=z):z=t[44];let B;t[45]!==r||t[46]!==R||t[47]!==z?(B=(0,Z.jsx)(Wk,{isActive:r,initialScrollTop:R,children:z}),t[45]=r,t[46]=R,t[47]=z,t[48]=B):B=t[48];let V;return t[49]!==I||t[50]!==L||t[51]!==B?(V=(0,Z.jsx)(Q.Activity,{mode:I,name:L,children:B}),t[49]=I,t[50]=L,t[51]=B,t[52]=V):V=t[52],V}function Xk(e){let t=e.endsWith(`rem`)?`rem`:`px`;return{value:Number.parseFloat(e),unit:t}}function Zk(e){let{value:t,unit:n}=Xk(e);return n===`rem`?t*16:t}function Qk(e,t){return`${t===`rem`?e.toFixed(1):Math.round(e)}${t}`}var $k=3600*24*7;function eA(e){let t=(0,$.c)(28),{direction:n,currentWidth:r,onResize:i,onToggle:a,isCollapsed:o,minResizeWidth:s,maxResizeWidth:c,enableToggle:l,enableAutoCollapse:u,autoCollapseThreshold:d,expandThreshold:f,enableDrag:p,setIsDraggingRail:m,widthCookieName:h,widthCookieMaxAge:g,isNested:_}=e,v=n===void 0?`right`:n,y=o===void 0?!1:o,b=s===void 0?`14rem`:s,x=c===void 0?`24rem`:c,S=l===void 0?!0:l,C=u===void 0?!0:u,w=d===void 0?1.5:d,T=f===void 0?.2:f,E=p===void 0?!0:p,D=m===void 0?tA:m,O=g===void 0?$k:g,k=_===void 0?!1:_,A=(0,Q.useRef)(null),j=(0,Q.useRef)(0),M=(0,Q.useRef)(0),N=(0,Q.useRef)(!1),P=(0,Q.useRef)(!1),F=(0,Q.useRef)(null),I=(0,Q.useRef)(0),L=(0,Q.useRef)(!1),R=(0,Q.useRef)(0),z=(0,Q.useRef)(0),B=(0,Q.useRef)(null),V=(0,Q.useRef)(r),H=(0,Q.useRef)(y),U,W;t[0]===r?(U=t[1],W=t[2]):(U=()=>{V.current=r},W=[r],t[0]=r,t[1]=U,t[2]=W),(0,Q.useEffect)(U,W);let G,K;t[3]===y?(G=t[4],K=t[5]):(G=()=>{H.current=y},K=[y],t[3]=y,t[4]=G,t[5]=K),(0,Q.useEffect)(G,K);let q=Zk(b),J;t[6]===x?J=t[7]:(J=Zk(x),t[6]=x,t[7]=J);let ee=J,te;t[8]!==E||t[9]!==k?(te=function(e){E&&(P.current=!0,j.current=H.current?0:Zk(V.current),M.current=e.clientX,I.current=e.clientX,F.current=null,L.current=!1,R.current=0,z.current=0,B.current=k&&A.current?A.current.getBoundingClientRect():null,e.preventDefault())},t[8]=E,t[9]=k,t[10]=te):te=t[10];let ne=te,re,Y;t[11]!==w||t[12]!==v||t[13]!==C||t[14]!==S||t[15]!==T||t[16]!==k||t[17]!==ee||t[18]!==q||t[19]!==i||t[20]!==a||t[21]!==D||t[22]!==O||t[23]!==h?(re=()=>{let e=function(e){h&&(document.cookie=`${h}=${e}; path=/; max-age=${O}`)},t=function(e,t){return v===`left`?e<t:e>t},n=function(e,t,n,r){if(k&&r){let r=e.clientX-t;return v===`left`?n-r:n+r}return v===`left`?window.innerWidth-e.clientX:e.clientX},r=function(r){if(!P.current)return;let o=Math.abs(r.clientX-M.current);if(!N.current&&o>5&&(N.current=!0,D(!0)),N.current){let{unit:o}=Xk(V.current),s=B.current;k&&A.current&&(s=A.current.getBoundingClientRect());let c=t(r.clientX,I.current)?`expand`:`collapse`;F.current!==c&&(F.current=c),z.current=Math.abs(r.clientX-I.current);let l=Date.now();if(L.current&&l-R.current>200&&(L.current=!1),!L.current){if(C&&a&&!H.current){let e=n(r,M.current,j.current,s),t=!1;if(w<=1)t=e<=q*w;else if(e<=q){let n=q*(w-1);t=q-e>=n}if(c===`collapse`&&t){a(),I.current=r.clientX,L.current=!0,R.current=l;return}}if(a&&H.current&&c===`expand`&&z.current>q*T){a();let t=n(r,M.current,j.current,s),c=Math.max(q,Math.min(ee,t)),u=Qk(o===`rem`?c/16:c,o);i(u),e(u),I.current=r.clientX,L.current=!0,R.current=l;return}}if(H.current)return;let u=n(r,M.current,j.current,s),d=Math.max(q,Math.min(ee,u)),f=Qk(o===`rem`?d/16:d,o);i(f),e(f)}},o=function(){P.current&&(!N.current&&a&&S&&a(),N.current=!1,P.current=!1,F.current=null,I.current=0,L.current=!1,R.current=0,z.current=0,B.current=null,D(!1))};return document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,o),()=>{document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,o)}},Y=[i,a,D,q,ee,k,C,w,T,S,h,O,v],t[11]=w,t[12]=v,t[13]=C,t[14]=S,t[15]=T,t[16]=k,t[17]=ee,t[18]=q,t[19]=i,t[20]=a,t[21]=D,t[22]=O,t[23]=h,t[24]=re,t[25]=Y):(re=t[24],Y=t[25]),(0,Q.useEffect)(re,Y);let ie;return t[26]===ne?ie=t[27]:(ie={dragRef:A,isDragging:N,handleMouseDown:ne},t[26]=ne,t[27]=ie),ie}function tA(){}var nA=3600*24*7,rA=`18rem`,iA=`3rem`,aA=`app-file-sidebar`,oA=`14.625rem`,sA=`32rem`,cA=`sidebar_width`,lA=/^\d+(?:\.\d+)?(?:rem|px)$/,uA=Q.createContext(null);function dA(e){if(typeof document>`u`)return e;let t=document.cookie.split(`; `).find(e=>e.startsWith(`${cA}=`))?.split(`=`)[1];if(!t)return e;let n;try{n=decodeURIComponent(t)}catch{return e}return lA.test(n)?n:e}function fA(){let e=Q.use(uA);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function pA(e){let t=(0,$.c)(58),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({open:i,onOpenChange:o,className:r,style:s,children:n,defaultWidth:c,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=c===void 0?rA:c,[u]=Q.useState(hA),d;t[8]===u?d=t[9]:(d=()=>Tw(u,window.innerWidth,`left`),t[8]=u,t[9]=d);let[f,p]=Q.useState(d),m;t[10]===l?m=t[11]:(m=()=>dA(l),t[10]=l,t[11]=m);let[h,g]=Q.useState(m),[_,v]=Q.useState(!1),[y,b]=Q.useState(!1),x;t[12]===u?x=t[13]:(x=()=>{let e=Mw();return Pw(`left`,Tw(u,window.innerWidth,`left`),e)===`open`},t[12]=u,t[13]=x);let[S,C]=Q.useState(x),w=i??S,T;t[14]!==w||t[15]!==f||t[16]!==o?(T=e=>{let t=typeof e==`function`?e(w):e;o?o(t):C(t),Fw(`left`,f,t?`open`:`collapsed`)},t[14]=w,t[15]=f,t[16]=o,t[17]=T):T=t[17];let E=T,D;t[18]===E?D=t[19]:(D=function(){E(mA)},t[18]=E,t[19]=D);let O=D,k=Q.useRef(w),A;t[20]===w?A=t[21]:(A=()=>{k.current=w},t[20]=w,t[21]=A),Q.useLayoutEffect(A);let j;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(j=function(){window.innerWidth>=1024||k.current&&(window.matchMedia(`(prefers-reduced-motion: reduce)`).matches||b(!0))},t[22]=j):j=t[22];let M=j,N,P;t[23]===u?(N=t[24],P=t[25]):(P=()=>{let e=window.matchMedia(`(min-width: ${Sw}px)`),t=()=>{let e=Tw(u,window.innerWidth,`left`);p(e),C(Pw(`left`,e,Mw())===`open`)};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},N=[u],t[23]=u,t[24]=N,t[25]=P),Q.useEffect(P,N);let F,I;t[26]===w?(F=t[27],I=t[28]):(F=()=>{w||document.getElementById(aA)?.contains(document.activeElement)&&document.querySelector(`[data-sidebar="trigger"]`)?.focus()},I=[w],t[26]=w,t[27]=F,t[28]=I),Q.useLayoutEffect(F,I);let L,R;t[29]!==w||t[30]!==f||t[31]!==E?(L=()=>{if(f===`above`||!w)return;let e=e=>{e.key===`Escape`&&(document.querySelector(`[data-state="open"][role="dialog"], [data-state="open"][role="alertdialog"], [data-state="open"][role="menu"], [data-state="open"][role="listbox"], [data-radix-popper-content-wrapper] [data-state="open"]`)||E(!1))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},R=[f,w,E],t[29]=w,t[30]=f,t[31]=E,t[32]=L,t[33]=R):(L=t[32],R=t[33]),Q.useEffect(L,R);let z,B;t[34]===O?(z=t[35],B=t[36]):(z=()=>{if(typeof window<`u`&&window.okDesktop!=null)return;let e=e=>{nc(e,`toggle-files-sidebar`)&&(e.preventDefault(),O())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},B=[O],t[34]=O,t[35]=z,t[36]=B),Q.useEffect(z,B);let V=w?`expanded`:`collapsed`,H;t[37]!==_||t[38]!==w||t[39]!==E||t[40]!==y||t[41]!==V||t[42]!==O||t[43]!==h?(H={state:V,open:w,setOpen:E,toggleSidebar:O,width:h,setWidth:g,isDraggingRail:_,setIsDraggingRail:v,showPushPulse:y,setShowPushPulse:b,notifySidebarFileSelected:M},t[37]=_,t[38]=w,t[39]=E,t[40]=y,t[41]=V,t[42]=O,t[43]=h,t[44]=H):H=t[44];let U;t[45]!==s||t[46]!==h?(U={"--sidebar-width":h,"--sidebar-width-icon":iA,...s},t[45]=s,t[46]=h,t[47]=U):U=t[47];let W=U,G;t[48]===r?G=t[49]:(G=si(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),t[48]=r,t[49]=G);let K;t[50]!==n||t[51]!==a||t[52]!==W||t[53]!==G?(K=(0,Z.jsx)(`div`,{"data-slot":`sidebar-wrapper`,style:W,className:G,...a,children:n}),t[50]=n,t[51]=a,t[52]=W,t[53]=G,t[54]=K):K=t[54];let q;return t[55]!==H||t[56]!==K?(q=(0,Z.jsx)(uA.Provider,{value:H,children:K}),t[55]=H,t[56]=K,t[57]=q):q=t[57],q}function mA(e){return!e}function hA(){return kr()}function gA(e){let t=(0,$.c)(39),n,r,a,o,s,c;t[0]===e?(n=t[1],r=t[2],a=t[3],o=t[4],s=t[5],c=t[6]):({side:o,variant:s,collapsible:c,className:r,children:n,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=a,t[4]=o,t[5]=s,t[6]=c);let l=o===void 0?`left`:o,u=s===void 0?`sidebar`:s,d=c===void 0?`offcanvas`:c,{_:f}=i(),{state:p,isDraggingRail:m}=fA();if(d===`none`){let e;t[7]===r?e=t[8]:(e=si(`flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground`,r),t[7]=r,t[8]=e);let i;return t[9]!==n||t[10]!==a||t[11]!==e||t[12]!==u?(i=(0,Z.jsx)(`div`,{"data-slot":`sidebar`,"data-variant":u,className:e,...a,children:n}),t[9]=n,t[10]=a,t[11]=e,t[12]=u,t[13]=i):i=t[13],i}let h=p===`collapsed`?d:``,g=u===`floating`||u===`inset`?`group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon)`,_;t[14]===g?_=t[15]:(_=si(`relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear`,`group-data-[collapsible=offcanvas]:w-0`,`group-data-[side=right]:rotate-180`,g,`group-data-[dragging=true]:duration-0! group-data-[dragging=true]_*:!duration-0`),t[14]=g,t[15]=_);let v;t[16]===_?v=t[17]:(v=(0,Z.jsx)(`div`,{"data-slot":`sidebar-gap`,className:_}),t[16]=_,t[17]=v);let y;t[18]===f?y=t[19]:(y=f({id:`07q4Qk`}),t[18]=f,t[19]=y);let b=u===`floating`||u===`inset`?`p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l`,x;t[20]!==r||t[21]!==b?(x=si(`fixed inset-y-0 z-10 flex h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear motion-reduce:transition-none motion-reduce:duration-0 data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]`,b,`group-data-[dragging=true]:duration-0! group-data-[dragging=true]_*:!duration-0`,r),t[20]=r,t[21]=b,t[22]=x):x=t[22];let S;t[23]===n?S=t[24]:(S=(0,Z.jsx)(`div`,{"data-sidebar":`sidebar`,"data-slot":`sidebar-inner`,className:`flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border`,children:n}),t[23]=n,t[24]=S);let C;t[25]!==a||t[26]!==l||t[27]!==x||t[28]!==S||t[29]!==y?(C=(0,Z.jsx)(`nav`,{id:aA,"aria-label":y,"data-slot":`sidebar-container`,"data-side":l,className:x,...a,children:S}),t[25]=a,t[26]=l,t[27]=x,t[28]=S,t[29]=y,t[30]=C):C=t[30];let w;return t[31]!==m||t[32]!==l||t[33]!==p||t[34]!==C||t[35]!==h||t[36]!==v||t[37]!==u?(w=(0,Z.jsxs)(`div`,{className:`group peer text-sidebar-foreground`,"data-state":p,"data-collapsible":h,"data-variant":u,"data-side":l,"data-slot":`sidebar`,"data-dragging":m,children:[v,C]}),t[31]=m,t[32]=l,t[33]=p,t[34]=C,t[35]=h,t[36]=v,t[37]=u,t[38]=w):w=t[38],w}function _A(e){let t=(0,$.c)(34),n,r,a;t[0]===e?(n=t[1],r=t[2],a=t[3]):({className:n,onClick:r,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=a);let{_:o}=i(),{toggleSidebar:s,state:c}=fA(),l,u,d,f,p,m,h,g;if(t[4]!==o||t[5]!==c){let e=rc(`toggle-files-sidebar`);l=li,u=`trigger`,d=`sidebar-trigger`,f=`ghost`,p=`icon-sm`,m=c===`expanded`,h=aA,g=o(c===`expanded`?{id:`4PYsOz`,values:{sidebarShortcutLabel:e}}:{id:`jbSG8V`,values:{sidebarShortcutLabel:e}}),t[4]=o,t[5]=c,t[6]=l,t[7]=u,t[8]=d,t[9]=f,t[10]=p,t[11]=m,t[12]=h,t[13]=g}else l=t[6],u=t[7],d=t[8],f=t[9],p=t[10],m=t[11],h=t[12],g=t[13];let _;t[14]===n?_=t[15]:(_=si(n),t[14]=n,t[15]=_);let v;t[16]!==r||t[17]!==s?(v=e=>{r?.(e),s()},t[16]=r,t[17]=s,t[18]=v):v=t[18];let y;t[19]===c?y=t[20]:(y=c===`expanded`?(0,Z.jsx)(Xt,{}):(0,Z.jsx)(Bl,{}),t[19]=c,t[20]=y);let b;return t[21]!==l||t[22]!==a||t[23]!==u||t[24]!==y||t[25]!==d||t[26]!==f||t[27]!==p||t[28]!==m||t[29]!==h||t[30]!==g||t[31]!==_||t[32]!==v?(b=(0,Z.jsx)(l,{"data-sidebar":u,"data-slot":d,variant:f,size:p,"aria-expanded":m,"aria-controls":h,"aria-label":g,className:_,onClick:v,...a,children:y}),t[21]=l,t[22]=a,t[23]=u,t[24]=y,t[25]=d,t[26]=f,t[27]=p,t[28]=m,t[29]=h,t[30]=g,t[31]=_,t[32]=v,t[33]=b):b=t[33],b}function vA(e){let t=(0,$.c)(32),n,r,a,o,s;t[0]===e?(n=t[1],r=t[2],a=t[3],o=t[4],s=t[5]):({className:n,enableDrag:o,enableToggle:s,onMouseDown:r,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=a,t[4]=o,t[5]=s);let c=o===void 0?!0:o,l=s===void 0?!0:s,{_:u}=i(),{toggleSidebar:d,setWidth:f,state:p,width:m,setIsDraggingRail:h}=fA(),g=p===`collapsed`,_;t[6]!==c||t[7]!==l||t[8]!==h||t[9]!==f||t[10]!==g||t[11]!==d||t[12]!==m?(_={direction:`right`,enableDrag:c,enableToggle:l,onResize:f,onToggle:d,currentWidth:m,isCollapsed:g,minResizeWidth:oA,maxResizeWidth:sA,setIsDraggingRail:h,widthCookieName:cA,widthCookieMaxAge:nA},t[6]=c,t[7]=l,t[8]=h,t[9]=f,t[10]=g,t[11]=d,t[12]=m,t[13]=_):_=t[13];let{dragRef:v,handleMouseDown:y}=eA(_),b;t[14]!==u||t[15]!==p?(b=u(p===`expanded`?{id:`w3vFfL`}:{id:`e8zRrb`}),t[14]=u,t[15]=p,t[16]=b):b=t[16];let x;t[17]!==y||t[18]!==r?(x=e=>{r?.(e),e.defaultPrevented||y(e)},t[17]=y,t[18]=r,t[19]=x):x=t[19];let S;t[20]!==u||t[21]!==p?(S=u(p===`expanded`?{id:`w3vFfL`}:{id:`e8zRrb`}),t[20]=u,t[21]=p,t[22]=S):S=t[22];let C;t[23]===n?C=t[24]:(C=si(`absolute inset-y-0 z-20 hidden w-4 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:start-1/2 after:w-[2px] hover:after:bg-sidebar-border sm:flex ltr:-translate-x-1/2 rtl:-translate-x-1/2`,`in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize`,`[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize`,`group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full hover:group-data-[collapsible=offcanvas]:bg-sidebar`,`[[data-side=left][data-collapsible=offcanvas]_&]:-right-2`,`[[data-side=right][data-collapsible=offcanvas]_&]:-left-2`,`md:group-data-[variant=inset]:after:inset-y-5`,n),t[23]=n,t[24]=C);let w;return t[25]!==v||t[26]!==a||t[27]!==b||t[28]!==x||t[29]!==S||t[30]!==C?(w=(0,Z.jsx)(`button`,{ref:v,"data-sidebar":`rail`,"data-slot":`sidebar-rail`,"aria-label":b,tabIndex:-1,onMouseDown:x,title:S,className:C,...a}),t[25]=v,t[26]=a,t[27]=b,t[28]=x,t[29]=S,t[30]=C,t[31]=w):w=t[31],w}function yA(e){let t=(0,$.c)(14),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,onAnimationEnd:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let{showPushPulse:a,setShowPushPulse:o}=fA(),s;t[4]!==r||t[5]!==o?(s=e=>{r?.(e),e.animationName===`sidebar-push-pulse`&&o(!1)},t[4]=r,t[5]=o,t[6]=s):s=t[6];let c=s,l=a?``:void 0,u;t[7]===n?u=t[8]:(u=si(`relative flex w-full flex-1 flex-col bg-background peer-data-[variant=inset]:m-2 peer-data-[variant=inset]:ml-0 peer-data-[variant=inset]:rounded-xl peer-data-[variant=inset]:shadow-sm peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2`,n),t[7]=n,t[8]=u);let d;return t[9]!==c||t[10]!==i||t[11]!==l||t[12]!==u?(d=(0,Z.jsx)(`main`,{"data-slot":`sidebar-inset`,"data-push-pulse":l,onAnimationEnd:c,className:u,...i}),t[9]=c,t[10]=i,t[11]=l,t[12]=u,t[13]=d):d=t[13],d}function bA(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=si(`flex flex-col gap-2 p-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-header`,"data-sidebar":`header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function xA(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=si(`flex flex-col gap-2 p-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-footer`,"data-sidebar":`footer`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function SA(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=si(`no-scrollbar flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-content`,"data-sidebar":`content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function CA(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=si(`flex w-full min-w-0 flex-col gap-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`ul`,{"data-slot":`sidebar-menu`,"data-sidebar":`menu`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function wA(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=si(`group/menu-item relative`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`li`,{"data-slot":`sidebar-menu-item`,"data-sidebar":`menu-item`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var TA=ai(`peer/menu-button group/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-hover hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-hover active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-open:hover:bg-sidebar-hover data-open:hover:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground data-active:hover:bg-sidebar-accent [&_svg]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate`,{variants:{variant:{default:`hover:bg-sidebar-hover hover:text-sidebar-accent-foreground`,outline:`bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-hover hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]`},size:{default:`h-8 text-sm`,sm:`h-7 text-xs`,lg:`h-12 text-sm group-data-[collapsible=icon]:p-0!`}},defaultVariants:{variant:`default`,size:`default`}});function EA(e){let t=(0,$.c)(28),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({asChild:i,isActive:a,variant:o,size:s,tooltip:c,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=i===void 0?!1:i,u=a===void 0?!1:a,d=o===void 0?`default`:o,f=s===void 0?`default`:s,p=l?ci:`button`,{state:m}=fA(),h;t[8]!==n||t[9]!==f||t[10]!==d?(h=si(TA({variant:d,size:f}),n),t[8]=n,t[9]=f,t[10]=d,t[11]=h):h=t[11];let g;t[12]!==p||t[13]!==u||t[14]!==r||t[15]!==f||t[16]!==h?(g=(0,Z.jsx)(p,{"data-slot":`sidebar-menu-button`,"data-sidebar":`menu-button`,"data-size":f,"data-active":u,className:h,...r}),t[12]=p,t[13]=u,t[14]=r,t[15]=f,t[16]=h,t[17]=g):g=t[17];let _=g;if(!c)return _;if(typeof c==`string`){let e;t[18]===c?e=t[19]:(e={children:c},t[18]=c,t[19]=e),c=e}let v;t[20]===_?v=t[21]:(v=(0,Z.jsx)(js,{asChild:!0,children:_}),t[20]=_,t[21]=v);let y=m!==`collapsed`,b;t[22]!==y||t[23]!==c?(b=(0,Z.jsx)(Ns,{side:`right`,align:`center`,hidden:y,...c}),t[22]=y,t[23]=c,t[24]=b):b=t[24];let x;return t[25]!==v||t[26]!==b?(x=(0,Z.jsxs)(Is,{children:[v,b]}),t[25]=v,t[26]=b,t[27]=x):x=t[27],x}function DA(e){let t=null,n=!1,r=new Set;function i(e){if(e!==t){t=e;for(let e of r)e()}}e.subscribeToEvent(i);async function a(){if(!n){n=!0;try{i(await e.fetchBranch())}catch{}}}return{getSnapshot:()=>t,subscribe(e){return r.add(e),a(),()=>{r.delete(e)}}}}async function OA(){let e=await fetch(`/api/server-info`,{signal:AbortSignal.timeout(5e3)});if(!e.ok)return null;let t=await e.json(),n=zr.safeParse(t);return n.success?n.data.currentBranch??null:null}var kA=typeof window>`u`?{getSnapshot:()=>null,subscribe:()=>()=>{}}:DA({fetchBranch:OA,subscribeToEvent:rs}),AA=kA.subscribe,jA=kA.getSnapshot;function MA(){return(0,Q.useSyncExternalStore)(AA,jA,jA)}function NA(){let e=(0,$.c)(6),t=MA(),n=ka(),{state:r}=fA(),i=typeof window<`u`?window.okDesktop:void 0;if(i&&r===`expanded`)return null;let a;e[0]===n?a=e[1]:(a=i?.config.projectName??(n&&da(n.contentDir)||null),e[0]=n,e[1]=a);let o=a,s=i?.config.projectPath??n?.contentDir??null;if(o===null&&t===null)return null;let c;return e[2]!==t||e[3]!==o||e[4]!==s?(c={projectName:o,projectPath:s,branch:t},e[2]=t,e[3]=o,e[4]=s,e[5]=c):c=e[5],c}function PA(e){let t=(0,$.c)(23),{stats:n,selectionStats:r,showStats:a}=e,o=a===void 0?!0:a,{_:c}=i(),l=NA();if(!o&&l===null)return null;let u=r??n,d=r!=null,{words:f,chars:p,tokens:m}=u,h;t[0]!==c||t[1]!==d||t[2]!==o?(h=c(o?d?{id:`Bv5a9_`}:{id:`L1ZE3M`}:{id:`goO4Ll`}),t[0]=c,t[1]=d,t[2]=o,t[3]=h):h=t[3];let g;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-full h-2 bg-linear-to-t from-background to-transparent`}),t[4]=g):g=t[4];let _;t[5]===l?_=t[6]:(_=l===null?null:(0,Z.jsx)(FA,{identity:l}),t[5]=l,t[6]=_);let v;t[7]===_?v=t[8]:(v=(0,Z.jsx)(`span`,{className:`flex min-w-0 items-center gap-3`,children:_}),t[7]=_,t[8]=v);let y;t[9]!==c||t[10]!==u.chars||t[11]!==u.tokens||t[12]!==u.words||t[13]!==p||t[14]!==d||t[15]!==o||t[16]!==m||t[17]!==f?(y=o?(0,Z.jsxs)(`span`,{className:`flex items-center shrink-0 gap-3`,children:[d?(0,Z.jsx)(`span`,{className:`font-medium text-foreground/70`,"data-testid":`editor-footer-selected-label`,children:c({id:`ylXj1N`})}):null,(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:u.words.toLocaleString()}),` `,(0,Z.jsx)(s,{id:`gljvbT`,values:{words:f}})]}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:u.chars.toLocaleString()}),` `,(0,Z.jsx)(s,{id:`d5rK4X`,values:{chars:p}})]}),(0,Z.jsxs)(`span`,{children:[u.tokens>0?`~`:``,(0,Z.jsx)(`span`,{className:`tabular-nums`,children:u.tokens.toLocaleString()}),` `,(0,Z.jsx)(s,{id:`uynXup`,values:{tokens:m}})]})]}):null,t[9]=c,t[10]=u.chars,t[11]=u.tokens,t[12]=u.words,t[13]=p,t[14]=d,t[15]=o,t[16]=m,t[17]=f,t[18]=y):y=t[18];let b;return t[19]!==h||t[20]!==v||t[21]!==y?(b=(0,Z.jsxs)(`section`,{"aria-label":h,className:`relative flex h-6 shrink-0 items-center justify-between gap-3 bg-background px-3 text-2xs text-muted-foreground`,children:[g,v,y]}),t[19]=h,t[20]=v,t[21]=y,t[22]=b):b=t[22],b}function FA(e){let t=(0,$.c)(8),{identity:n}=e,{projectName:r,projectPath:i,branch:a}=n,o;t[0]!==r||t[1]!==i?(o=r===null?null:i?(0,Z.jsxs)(Is,{children:[(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(`span`,{tabIndex:0,className:`truncate`,"data-testid":`editor-footer-project-name`,children:r})}),(0,Z.jsx)(Ns,{side:`top`,className:`max-w-xs break-all`,children:i})]}):(0,Z.jsx)(`span`,{className:`truncate`,"data-testid":`editor-footer-project-name`,children:r}),t[0]=r,t[1]=i,t[2]=o):o=t[2];let s;t[3]===a?s=t[4]:(s=a===null?null:(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,"data-testid":`editor-footer-branch`,children:[(0,Z.jsx)(ke,{"aria-hidden":`true`,className:`size-3 shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:a})]}),t[3]=a,t[4]=s);let c;return t[5]!==o||t[6]!==s?(c=(0,Z.jsxs)(Z.Fragment,{children:[o,s]}),t[5]=o,t[6]=s,t[7]=c):c=t[7],c}function IA(e){let t=(0,$.c)(11),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let{_:a}=i(),o;t[3]===a?o=t[4]:(o=a({id:`3__SjS`}),t[3]=a,t[4]=o);let s;t[5]===n?s=t[6]:(s=si(n),t[5]=n,t[6]=s);let c;return t[7]!==r||t[8]!==o||t[9]!==s?(c=(0,Z.jsx)(`nav`,{"aria-label":o,"data-slot":`breadcrumb`,className:s,...r}),t[7]=r,t[8]=o,t[9]=s,t[10]=c):c=t[10],c}function LA(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=si(`flex flex-wrap items-center gap-1.5 text-sm wrap-break-word text-muted-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`ol`,{"data-slot":`breadcrumb-list`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function RA(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=si(`inline-flex items-center gap-1`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`li`,{"data-slot":`breadcrumb-item`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function zA(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({current:i,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0||i?`page`:void 0,o;t[4]===n?o=t[5]:(o=si(`font-normal text-foreground`,n),t[4]=n,t[5]=o);let s;return t[6]!==r||t[7]!==a||t[8]!==o?(s=(0,Z.jsx)(`span`,{"data-slot":`breadcrumb-page`,"aria-current":a,className:o,...r}),t[6]=r,t[7]=a,t[8]=o,t[9]=s):s=t[9],s}function BA(e){let t=(0,$.c)(12),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({children:n,className:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=si(`[&>svg]:size-3.5`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=n??(0,Z.jsx)(Po,{}),t[6]=n,t[7]=o);let s;return t[8]!==i||t[9]!==a||t[10]!==o?(s=(0,Z.jsx)(`li`,{"data-slot":`breadcrumb-separator`,role:`presentation`,"aria-hidden":`true`,className:a,...i,children:o}),t[8]=i,t[9]=a,t[10]=o,t[11]=s):s=t[11],s}var VA=1,HA=2,UA=4;function WA(e){let t=(0,$.c)(18),{docName:n,className:r}=e;if(!n)return null;let i,a,o,s,c,l;if(t[0]!==r||t[1]!==n){l=Symbol.for(`react.early_return_sentinel`);bb0:{let{prefix:e}=Me(n,``);if(!e){l=null;break bb0}let u=e.replace(/\/$/,``).split(`/`).filter(Boolean);if(u.length===0){l=null;break bb0}let d=(e,t)=>({kind:`segment`,value:e,key:u.slice(0,t+1).join(`/`)}),f=u.length>UA?[...u.slice(0,VA).map((e,t)=>d(e,t)),{kind:`ellipsis`,hidden:u.slice(VA,-HA)},...u.slice(-HA).map((e,t)=>d(e,u.length-HA+t))]:u.map((e,t)=>d(e,t));a=IA,t[8]===r?c=t[9]:(c=si(`flex min-w-0 items-center`,r),t[8]=r,t[9]=c),i=LA,o=`min-w-0 flex-nowrap gap-1 overflow-hidden text-muted-foreground/70 text-xs`,s=f.map(GA)}t[0]=r,t[1]=n,t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l}else i=t[2],a=t[3],o=t[4],s=t[5],c=t[6],l=t[7];if(l!==Symbol.for(`react.early_return_sentinel`))return l;let u;t[10]!==i||t[11]!==o||t[12]!==s?(u=(0,Z.jsx)(i,{className:o,children:s}),t[10]=i,t[11]=o,t[12]=s,t[13]=u):u=t[13];let d;return t[14]!==a||t[15]!==c||t[16]!==u?(d=(0,Z.jsx)(a,{className:c,children:u}),t[14]=a,t[15]=c,t[16]=u,t[17]=d):d=t[17],d}function GA(e,t){let n=e.kind===`segment`?e.key:`ellipsis`;return(0,Z.jsxs)(Q.Fragment,{children:[t>0&&(0,Z.jsx)(BA,{className:`shrink-0 text-muted-foreground/70 [&>svg]:size-3`}),e.kind===`ellipsis`?(0,Z.jsxs)(RA,{className:`shrink-0`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,title:e.hidden.join(` / `),className:`flex size-4 items-center justify-center text-muted-foreground/70`,children:(0,Z.jsx)(hl,{className:`size-3.5`})}),(0,Z.jsx)(`span`,{className:`sr-only`,children:e.hidden.join(` / `)})]}):(0,Z.jsx)(RA,{className:`min-w-0`,children:(0,Z.jsx)(zA,{current:!1,className:`min-w-0 truncate font-normal text-muted-foreground/70`,title:e.value,children:e.value})})]},n)}var KA={fill:`none`,height:24,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,viewBox:`0 0 24 24`,width:24,xmlns:`http://www.w3.org/2000/svg`},qA=e=>{let t=(0,$.c)(15),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({color:a,size:o,strokeWidth:s,absoluteStrokeWidth:n,className:c,children:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=a===void 0?`currentColor`:a,u=o===void 0?24:o,d=s===void 0?2:s,f=c===void 0?``:c,p=n?Number(d)*24/Number(u):d,m;return t[8]!==r||t[9]!==f||t[10]!==l||t[11]!==i||t[12]!==u||t[13]!==p?(m=(0,Z.jsx)(`svg`,{"aria-hidden":`true`,...KA,className:f,height:u,stroke:l,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:p,width:u,...i,children:r}),t[8]=r,t[9]=f,t[10]=l,t[11]=i,t[12]=u,t[13]=p,t[14]=m):m=t[14],m},JA=e=>{let t=(0,$.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`Markdown`}),r=(0,Z.jsx)(`path`,{d:`M232,48H24A16,16,0,0,0,8,64V192a16,16,0,0,0,16,16H232a16,16,0,0,0,16-16V64A16,16,0,0,0,232,48Zm0,144H24V64H232V192ZM128,104v48a8,8,0,0,1-16,0V123.31L93.66,141.66a8,8,0,0,1-11.32,0L64,123.31V152a8,8,0,0,1-16,0V104a8,8,0,0,1,13.66-5.66L88,124.69l26.34-26.35A8,8,0,0,1,128,104Zm77.66,18.34a8,8,0,0,1,0,11.32l-24,24a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L168,132.69V104a8,8,0,0,1,16,0v28.69l10.34-10.35A8,8,0,0,1,205.66,122.34Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,Z.jsxs)(qA,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i},YA=e=>{let t=(0,$.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`Textbox`}),r=(0,Z.jsx)(`path`,{d:`M112,40a8,8,0,0,0-8,8V64H24A16,16,0,0,0,8,80v96a16,16,0,0,0,16,16h80v16a8,8,0,0,0,16,0V48A8,8,0,0,0,112,40ZM24,176V80h80v96ZM248,80v96a16,16,0,0,1-16,16H144a8,8,0,0,1,0-16h88V80H144a8,8,0,0,1,0-16h88A16,16,0,0,1,248,80ZM88,112a8,8,0,0,1-8,8H72v24a8,8,0,0,1-16,0V120H48a8,8,0,0,1,0-16H80A8,8,0,0,1,88,112Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,Z.jsxs)(qA,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i};function XA(e){let t=(0,$.c)(90),{activeDocName:n,isSourceMode:r,sourceDisabled:a,onModeChange:o,showAddPropertyButton:c,onAddProperty:l,isPanelCollapsed:u,onTogglePanel:d}=e,{_:f}=i(),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=tc(`toggle-document-panel`),t[0]=p):p=t[0];let m=p,h,g,_,v,y,b,x,S,C,w,T,E,D,O;if(t[1]!==f||t[2]!==n||t[3]!==u||t[4]!==r||t[5]!==l||t[6]!==o||t[7]!==d||t[8]!==c||t[9]!==a){let e=rc(`toggle-document-panel`);v=`editor-toolbar`,y=`pointer-events-none absolute inset-x-0 top-0 z-10`;let i;t[24]===n?i=t[25]:(i=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex min-w-0 items-center`,children:(0,Z.jsx)(WA,{docName:n})}),t[24]=n,t[25]=i);let p=r?`source`:`wysiwyg`,m;t[26]===o?m=t[27]:(m=e=>{e&&o(e)},t[26]=o,t[27]=m);let k;t[28]===f?k=t[29]:(k=f({id:`n7aopT`}),t[28]=f,t[29]=k);let A;t[30]===f?A=t[31]:(A=f({id:`ur2XSb`}),t[30]=f,t[31]=A);let j;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Z.jsx)(js,{children:(0,Z.jsx)(YA,{className:`size-4`})}),t[32]=j):j=t[32];let M;t[33]===A?M=t[34]:(M=(0,Z.jsx)(bo,{value:`wysiwyg`,"aria-label":A,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,asChild:!0,children:j}),t[33]=A,t[34]=M);let N;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsx)(Ns,{side:`bottom`,children:(0,Z.jsx)(s,{id:`Mb_20S`})}),t[35]=N):N=t[35];let P;t[36]===M?P=t[37]:(P=(0,Z.jsxs)(Is,{children:[M,N]}),t[36]=M,t[37]=P);let F;t[38]===f?F=t[39]:(F=f({id:`xbdtfY`}),t[38]=f,t[39]=F);let I;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(JA,{className:`size-4`}),t[40]=I):I=t[40];let L;t[41]!==a||t[42]!==F?(L=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(`div`,{children:(0,Z.jsx)(bo,{value:`source`,"aria-label":F,disabled:a,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,children:I})})}),t[41]=a,t[42]=F,t[43]=L):L=t[43];let R;t[44]===a?R=t[45]:(R=(0,Z.jsx)(Ns,{side:`bottom`,children:a?(0,Z.jsx)(s,{id:`G-JBA1`}):(0,Z.jsx)(s,{id:`u6Hp4N`})}),t[44]=a,t[45]=R);let z;t[46]!==L||t[47]!==R?(z=(0,Z.jsxs)(Is,{children:[L,R]}),t[46]=L,t[47]=R,t[48]=z):z=t[48];let B;t[49]!==p||t[50]!==m||t[51]!==k||t[52]!==P||t[53]!==z?(B=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex justify-center`,children:(0,Z.jsxs)(So,{type:`single`,value:p,onValueChange:m,"aria-label":k,variant:`segmented`,size:`sm`,spacing:1,className:`shrink-0 data-[size=sm]:rounded-[10px] bg-muted p-0.5`,children:[P,z]})}),t[49]=p,t[50]=m,t[51]=k,t[52]=P,t[53]=z,t[54]=B):B=t[54],t[55]!==i||t[56]!==B?(b=(0,Z.jsx)(`div`,{className:`editor-content-aligned bg-background py-2`,children:(0,Z.jsxs)(`div`,{className:`grid grid-cols-3 items-center`,children:[i,B]})}),t[55]=i,t[56]=B,t[57]=b):b=t[57],O=`pointer-events-auto absolute top-0 right-0 flex items-center justify-end gap-1 py-2 pr-2`,t[58]!==f||t[59]!==l||t[60]!==c?(_=c&&(0,Z.jsxs)(Is,{children:[(0,Z.jsx)(li,{variant:`ghost`,size:`icon`,"aria-label":f({id:`81H_23`}),onClick:l,"data-testid":`add-properties-button`,asChild:!0,children:(0,Z.jsx)(js,{children:(0,Z.jsx)(Nl,{})})}),(0,Z.jsx)(Ns,{side:`bottom`,children:(0,Z.jsx)(s,{id:`81H_23`})})]}),t[58]=f,t[59]=l,t[60]=c,t[61]=_):_=t[61],g=Is,h=li,x=``,S=`ghost`,C=`icon`,w=d,T=!u,E=`doc-panel`,D=f(u?{id:`u7H-Wn`,values:{panelShortcutLabel:e}}:{id:`2hpdRq`,values:{panelShortcutLabel:e}}),t[1]=f,t[2]=n,t[3]=u,t[4]=r,t[5]=l,t[6]=o,t[7]=d,t[8]=c,t[9]=a,t[10]=h,t[11]=g,t[12]=_,t[13]=v,t[14]=y,t[15]=b,t[16]=x,t[17]=S,t[18]=C,t[19]=w,t[20]=T,t[21]=E,t[22]=D,t[23]=O}else h=t[10],g=t[11],_=t[12],v=t[13],y=t[14],b=t[15],x=t[16],S=t[17],C=t[18],w=t[19],T=t[20],E=t[21],D=t[22],O=t[23];let k;t[62]===u?k=t[63]:(k=(0,Z.jsx)(js,{children:u?(0,Z.jsx)(Hl,{}):(0,Z.jsx)(Vl,{})}),t[62]=u,t[63]=k);let A;t[64]!==h||t[65]!==k||t[66]!==x||t[67]!==S||t[68]!==C||t[69]!==w||t[70]!==T||t[71]!==E||t[72]!==D?(A=(0,Z.jsx)(h,{"data-doc-panel-toggle":x,variant:S,size:C,onClick:w,"aria-expanded":T,"aria-controls":E,"aria-label":D,asChild:!0,children:k}),t[64]=h,t[65]=k,t[66]=x,t[67]=S,t[68]=C,t[69]=w,t[70]=T,t[71]=E,t[72]=D,t[73]=A):A=t[73];let j;t[74]===u?j=t[75]:(j=(0,Z.jsx)(Ns,{side:`bottom`,children:u?(0,Z.jsx)(s,{id:`KFdXwz`,values:{panelShortcut:m}}):(0,Z.jsx)(s,{id:`MsuXaI`,values:{panelShortcut:m}})}),t[74]=u,t[75]=j);let M;t[76]!==g||t[77]!==A||t[78]!==j?(M=(0,Z.jsxs)(g,{children:[A,j]}),t[76]=g,t[77]=A,t[78]=j,t[79]=M):M=t[79];let N;t[80]!==_||t[81]!==M||t[82]!==O?(N=(0,Z.jsxs)(`div`,{className:O,children:[_,M]}),t[80]=_,t[81]=M,t[82]=O,t[83]=N):N=t[83];let P;t[84]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none h-2 bg-linear-to-b from-background to-transparent`}),t[84]=P):P=t[84];let F;return t[85]!==v||t[86]!==y||t[87]!==b||t[88]!==N?(F=(0,Z.jsxs)(`div`,{"data-testid":v,className:y,children:[b,N,P]}),t[85]=v,t[86]=y,t[87]=b,t[88]=N,t[89]=F):F=t[89],F}function ZA(e){let{activeDocName:t,deferredActiveDocName:n,mountResolved:r,syncResolved:i}=e;return t===null||t===n?!1:!(r&&i)}function QA(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,orientation:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`horizontal`:i,o;t[4]===n?o=t[5]:(o=si(`group/tabs flex gap-2 data-horizontal:flex-col`,n),t[4]=n,t[5]=o);let s;return t[6]!==a||t[7]!==r||t[8]!==o?(s=(0,Z.jsx)(Vd,{"data-slot":`tabs`,"data-orientation":a,className:o,...r}),t[6]=a,t[7]=r,t[8]=o,t[9]=s):s=t[9],s}var $A=ai(`group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function ej(e){let t=(0,$.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,variant:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`default`:i,o;t[4]!==n||t[5]!==a?(o=si($A({variant:a}),n),t[4]=n,t[5]=a,t[6]=o):o=t[6];let s;return t[7]!==r||t[8]!==o||t[9]!==a?(s=(0,Z.jsx)(Hd,{"data-slot":`tabs-list`,"data-variant":a,className:o,...r}),t[7]=r,t[8]=o,t[9]=a,t[10]=s):s=t[10],s}function tj(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=si(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent`,`data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Ud,{"data-slot":`tabs-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function nj(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=si(`flex-1 text-sm outline-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Wd,{"data-slot":`tabs-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var rj=`ok-terminal-height-v1`,ij=.5;function aj(e){return Math.max(120,Math.round((Number.isFinite(e)?e:0)*ij))}function oj(e,t){let n=aj(t);return Number.isFinite(e)?e<120?120:e>n?n:Math.round(e):Math.min(240,n)}function sj(){return typeof window>`u`?0:window.innerHeight}function cj(e,t){try{let n=e??localStorage,r=t??sj(),i=n.getItem(rj);if(i==null)return oj(240,r);let a=Number.parseInt(i,10);return oj(Number.isFinite(a)?a:240,r)}catch{return 240}}function lj(e,t,n){try{let r=t??localStorage,i=n??sj();r.setItem(rj,String(oj(e,i)))}catch{}}function uj(){try{return typeof localStorage>`u`?240:cj()}catch{return 240}}var dj=(0,Q.lazy)(()=>n(()=>import(`./TerminalPanel-CeisyLzZ.js`).then(e=>({default:e.TerminalPanel})),__vite__mapDeps([57,1,22,6,3,23,9,11,58,59]),import.meta.url));function fj(e){let t=(0,$.c)(11),{bridge:n,onClose:r,launch:a}=e,o=a===void 0?null:a,{enabled:s,synced:c}=ji(),l=uo(),{_:u}=i(),d=c&&s===!1,f;t[0]!==u||t[1]!==l?(f=function(){if(l===null){X.error(u({id:`V_6bJ4`}));return}let e=l(!0);e.ok||X.error(u({id:`jKd3AP`,values:{0:e.error}}))},t[0]=u,t[1]=l,t[2]=f):f=t[2];let p=f;if(c&&!d){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(`div`,{className:`h-full w-full bg-background`,"aria-hidden":`true`}),t[3]=e):e=t[3];let i;return t[4]!==n||t[5]!==o||t[6]!==r?(i=(0,Z.jsx)(le,{fallbackRender:mj,onError:pj,children:(0,Z.jsx)(Q.Suspense,{fallback:e,children:(0,Z.jsx)(dj,{bridge:n,className:`h-full`,onClose:r,launch:o})})}),t[4]=n,t[5]=o,t[6]=r,t[7]=i):i=t[7],i}let m;return t[8]!==p||t[9]!==d?(m=d?(0,Z.jsx)(_j,{onEnable:p}):(0,Z.jsx)(`div`,{className:`h-full w-full bg-background`,"aria-hidden":`true`}),t[8]=p,t[9]=d,t[10]=m):m=t[10],m}function pj(e,t){console.error(`[TerminalGate] rendered fallback for the terminal panel`,e,t.componentStack)}function mj(e){return(0,Z.jsx)(hj,{...e})}function hj(e){let t=(0,$.c)(15),{error:n}=e,{_:r}=i(),a;t[0]!==r||t[1]!==n?(a=n instanceof Error&&/dynamically imported module|Failed to fetch/i.test(n.message)?r({id:`Y8ViJx`}):r({id:`fbsiBw`}),t[0]=r,t[1]=n,t[2]=a):a=t[2];let o=a,s;t[3]===r?s=t[4]:(s=r({id:`6MnZEC`}),t[3]=r,t[4]=s);let c;t[5]===o?c=t[6]:(c=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-foreground`,children:o}),t[5]=o,t[6]=c);let l;t[7]===r?l=t[8]:(l=r({id:`HpK_8d`}),t[7]=r,t[8]=l);let u;t[9]===l?u=t[10]:(u=(0,Z.jsx)(li,{onClick:gj,children:l}),t[9]=l,t[10]=u);let d;return t[11]!==s||t[12]!==c||t[13]!==u?(d=(0,Z.jsxs)(`section`,{"aria-label":s,className:`flex h-full w-full flex-col items-center justify-center gap-3 bg-background p-6 text-center`,role:`alert`,children:[c,u]}),t[11]=s,t[12]=c,t[13]=u,t[14]=d):d=t[14],d}function gj(){return window.location.reload()}function _j(e){let t=(0,$.c)(20),{onEnable:n}=e,{_:r}=i(),a;t[0]===r?a=t[1]:(a=r({id:`_XWY2J`}),t[0]=r,t[1]=a);let o;t[2]===r?o=t[3]:(o=r({id:`oYepHb`}),t[2]=r,t[3]=o);let s;t[4]===o?s=t[5]:(s=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-foreground`,children:o}),t[4]=o,t[5]=s);let c;t[6]===r?c=t[7]:(c=r({id:`v2ZW0K`}),t[6]=r,t[7]=c);let l;t[8]!==n||t[9]!==c?(l=(0,Z.jsx)(li,{onClick:n,children:c}),t[8]=n,t[9]=c,t[10]=l):l=t[10];let u;t[11]===r?u=t[12]:(u=r({id:`ICoNYz`}),t[11]=r,t[12]=u);let d;t[13]===u?d=t[14]:(d=(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:u}),t[13]=u,t[14]=d);let f;return t[15]!==a||t[16]!==s||t[17]!==l||t[18]!==d?(f=(0,Z.jsxs)(`section`,{"aria-label":a,className:`flex h-full w-full flex-col items-center justify-center gap-3 bg-background p-6 text-center`,children:[s,l,d]}),t[15]=a,t[16]=s,t[17]=l,t[18]=d,t[19]=f):f=t[19],f}function vj(e){let t=(0,$.c)(33),{sessions:n,activeSessionId:r,onSelect:a,onTabActivate:o,onNew:s,onClose:c,children:l,className:u}=e,{_:d}=i(),f;t[0]===u?f=t[1]:(f=si(`flex min-h-0 min-w-0 flex-1 flex-col`,u),t[0]=u,t[1]=f);let p;t[2]===d?p=t[3]:(p=d({id:`1MGRQl`}),t[2]=d,t[3]=p);let m;if(t[4]!==d||t[5]!==r||t[6]!==c||t[7]!==o||t[8]!==n){let e;t[10]!==d||t[11]!==r||t[12]!==c||t[13]!==o?(e=e=>{let t=e.id===r;return(0,Z.jsxs)(`div`,{className:si(`flex shrink-0 items-center rounded-md pr-0.5 transition-colors`,t?`bg-muted`:`hover:bg-muted/50`),children:[(0,Z.jsx)(tj,{value:e.id,onClick:()=>o?.(e.id),className:`h-7 flex-none rounded-md px-2 text-xs`,children:(0,Z.jsx)(`span`,{className:`max-w-40 truncate`,children:e.label})}),(0,Z.jsx)(li,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":d({id:`nzHlj8`,values:{0:e.label}}),tabIndex:t?0:-1,className:`text-muted-foreground hover:text-foreground`,onClick:t=>{t.stopPropagation(),c(e.id)},children:(0,Z.jsx)(gs,{"aria-hidden":`true`})})]},e.id)},t[10]=d,t[11]=r,t[12]=c,t[13]=o,t[14]=e):e=t[14],m=n.map(e),t[4]=d,t[5]=r,t[6]=c,t[7]=o,t[8]=n,t[9]=m}else m=t[9];let h;t[15]!==p||t[16]!==m?(h=(0,Z.jsx)(ej,{variant:`line`,"aria-label":p,className:`flex h-auto min-w-0 flex-1 items-center justify-start gap-0.5 overflow-x-auto bg-transparent p-0 [scrollbar-width:none]`,children:m}),t[15]=p,t[16]=m,t[17]=h):h=t[17];let g;t[18]===d?g=t[19]:(g=d({id:`ZBxvV3`}),t[18]=d,t[19]=g);let _;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(V,{"aria-hidden":`true`}),t[20]=_):_=t[20];let v;t[21]!==s||t[22]!==g?(v=(0,Z.jsx)(li,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":g,className:`shrink-0 text-muted-foreground hover:text-foreground`,onClick:s,children:_}),t[21]=s,t[22]=g,t[23]=v):v=t[23];let y;t[24]!==h||t[25]!==v?(y=(0,Z.jsxs)(`div`,{className:`flex shrink-0 flex-row items-center gap-1 px-1.5 py-1`,children:[h,v]}),t[24]=h,t[25]=v,t[26]=y):y=t[26];let b;return t[27]!==r||t[28]!==l||t[29]!==a||t[30]!==f||t[31]!==y?(b=(0,Z.jsxs)(QA,{value:r,onValueChange:a,className:f,children:[y,l]}),t[27]=r,t[28]=l,t[29]=a,t[30]=f,t[31]=y,t[32]=b):b=t[32],b}var yj=`terminal-dock-panel`;function bj(e){return`terminal-session-${e}`}function xj(e){e!==``&&document.querySelector(`[data-terminal-session="${e}"] .xterm-helper-textarea`)?.focus()}function Sj(e){let t=(0,$.c)(77),{bridge:n,children:r,visible:a,onVisibleChange:o,launch:s}=e,c=s===void 0?null:s,{_:l}=i(),{resolvedTheme:u}=Pr(),d=Sx(),f=(0,Q.useRef)(null),[p,m]=(0,Q.useState)(!a),h;t[0]!==c||t[1]!==a?(h=()=>a?[{id:bj(1),launch:c}]:[],t[0]=c,t[1]=a,t[2]=h):h=t[2];let[g,_]=(0,Q.useState)(h),v;t[3]===a?v=t[4]:(v=()=>a?bj(1):``,t[3]=a,t[4]=v);let[y,b]=(0,Q.useState)(v),x=(0,Q.useRef)(y),S=(0,Q.useRef)(g),C=(0,Q.useRef)(+!!a),w=(0,Q.useRef)(a&&c?c.nonce:null),T=(0,Q.useRef)(a),E;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(E=function(e){C.current+=1;let t=bj(C.current);_(n=>[...n,{id:t,launch:e}]),b(t)},t[5]=E):E=t[5];let D=E,O=(0,Q.useRef)(D),k;t[6]!==y||t[7]!==o?(k=function(e){let t=S.current,n=t.findIndex(t=>t.id===e);if(n===-1)return;let r=t.filter(t=>t.id!==e);if(e===y){let e=(t[n-1]??t[n+1])?.id??``;b(e),e!==``&&queueMicrotask(()=>xj(e))}_(r),r.length===0&&(o(!1),f.current?.focus())},t[6]=y,t[7]=o,t[8]=k):k=t[8];let A=k,j=(0,Q.useRef)(Tj),M;t[9]!==y||t[10]!==A||t[11]!==g?(M=()=>{O.current=D,x.current=y,S.current=g,j.current=()=>{y!==``&&A(y)}},t[9]=y,t[10]=A,t[11]=g,t[12]=M):M=t[12],(0,Q.useEffect)(M);let[N]=(0,Q.useState)(wj),P=(0,Q.useRef)(N),[F,I]=(0,Q.useState)(!1),L=(0,Q.useRef)(!1),R=(0,Q.useRef)(null),z;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(z=function(e){R.current!=null&&clearTimeout(R.current),R.current=setTimeout(()=>{lj(e),R.current=null},100)},t[13]=z):z=t[13];let B=z,V=(0,Q.useRef)(null),H,U;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(H=()=>()=>{R.current!=null&&clearTimeout(R.current),V.current!=null&&(window.removeEventListener(`pointerup`,V.current),V.current=null)},U=[],t[14]=H,t[15]=U):(H=t[14],U=t[15]),(0,Q.useEffect)(H,U);let W,G;t[16]!==c||t[17]!==g.length||t[18]!==a?(W=()=>{let e=T.current;if(T.current=a,c!=null&&c.nonce!==w.current){w.current=c.nonce,O.current(c);return}a&&!e&&g.length===0&&O.current(null)},G=[a,c,g.length],t[16]=c,t[17]=g.length,t[18]=a,t[19]=W,t[20]=G):(W=t[19],G=t[20]),(0,Q.useEffect)(W,G);let K,q;t[21]===n?(K=t[22],q=t[23]):(K=()=>n.onMenuAction(e=>{e===`new-terminal`?O.current(null):e===`kill-terminal`&&j.current()}),q=[n],t[21]=n,t[22]=K,t[23]=q),(0,Q.useEffect)(K,q);let J,ee;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(J=()=>{let e=function(e){if(!e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||!/^[1-9]$/.test(e.key)||!document.getElementById(yj)?.contains(document.activeElement))return;let t=S.current[Number(e.key)-1];t!=null&&(e.preventDefault(),e.stopPropagation(),b(t.id),queueMicrotask(()=>xj(t.id)))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},ee=[],t[24]=J,t[25]=ee):(J=t[24],ee=t[25]),(0,Q.useEffect)(J,ee);let te;t[26]!==n.editor||t[27]!==g.length?(te=()=>{n.editor.notifyViewMenuStateChanged({terminalLive:g.length>0})},t[26]=n.editor,t[27]=g.length,t[28]=te):te=t[28];let ne;t[29]!==n||t[30]!==g.length?(ne=[n,g.length],t[29]=n,t[30]=g.length,t[31]=ne):ne=t[31],(0,Q.useEffect)(te,ne);let re,Y;t[32]!==d||t[33]!==a?(re=()=>{let e=d.current;e!=null&&(a?e.resize(`${P.current}px`):e.collapse())},Y=[a,d],t[32]=d,t[33]=a,t[34]=re,t[35]=Y):(re=t[34],Y=t[35]),(0,Q.useEffect)(re,Y);let ie,ae;t[36]===p?(ie=t[37],ae=t[38]):(ie=()=>{p&&document.getElementById(yj)?.contains(document.activeElement)&&f.current?.focus()},ae=[p],t[36]=p,t[37]=ie,t[38]=ae),(0,Q.useLayoutEffect)(ie,ae);let oe,se;t[39]===p?(oe=t[40],se=t[41]):(oe=()=>{p||xj(x.current)},se=[p],t[39]=p,t[40]=oe,t[41]=se),(0,Q.useEffect)(oe,se);let ce;if(t[42]!==l||t[43]!==g){let e;t[45]===l?e=t[46]:(e=(e,t)=>({id:e.id,label:l({id:`OVjNeX`,values:{0:t+1}})}),t[45]=l,t[46]=e),ce=g.map(e),t[42]=l,t[43]=g,t[44]=ce}else ce=t[44];let le=ce,ue=F||void 0,de;t[47]===r?de=t[48]:(de=(0,Z.jsx)(WC,{minSize:`20%`,className:`flex min-h-0 flex-col`,children:(0,Z.jsx)(`div`,{ref:f,tabIndex:-1,className:`flex h-full min-h-0 flex-col outline-none`,children:r})}),t[47]=r,t[48]=de);let fe;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(fe=(0,Z.jsx)(GC,{withHandle:!0,onPointerDown:()=>{I(!0),L.current=!0;let e=()=>{I(!1),L.current=!1,window.removeEventListener(`pointerup`,e),V.current=null};V.current=e,window.addEventListener(`pointerup`,e)}}),t[49]=fe):fe=t[49];let pe;t[50]===u?pe=t[51]:(pe=Lc(u),t[50]=u,t[51]=pe);let me;t[52]===pe.background?me=t[53]:(me={backgroundColor:pe.background},t[52]=pe.background,t[53]=me);let he=a?`${N}px`:0,ge;t[54]!==o||t[55]!==a?(ge=e=>{let t=e.asPercentage===0;m(t),L.current&&(t&&a?o(!1):!t&&!a&&o(!0),e.inPixels>0&&(P.current=e.inPixels,B(e.inPixels)))},t[54]=o,t[55]=a,t[56]=ge):ge=t[56];let _e=!F&&`transition-[flex-grow] duration-150 ease-out motion-reduce:transition-none motion-reduce:duration-0`,ve;t[57]===_e?ve=t[58]:(ve=si(`flex flex-col`,_e),t[57]=_e,t[58]=ve);let ye;t[59]!==y||t[60]!==n||t[61]!==A||t[62]!==g||t[63]!==le?(ye=g.length>0?(0,Z.jsx)(vj,{sessions:le,activeSessionId:y,onSelect:b,onTabActivate:Cj,onNew:()=>D(null),onClose:A,className:`h-full`,children:g.map(e=>(0,Z.jsx)(nj,{value:e.id,forceMount:!0,"data-terminal-session":e.id,className:`m-0 flex min-h-0 flex-1 flex-col overflow-hidden data-[state=inactive]:hidden`,children:(0,Z.jsx)(fj,{bridge:n,launch:e.launch,onClose:()=>A(e.id)})},e.id))}):null,t[59]=y,t[60]=n,t[61]=A,t[62]=g,t[63]=le,t[64]=ye):ye=t[64];let be;t[65]!==p||t[66]!==d||t[67]!==me||t[68]!==he||t[69]!==ge||t[70]!==ve||t[71]!==ye?(be=(0,Z.jsx)(WC,{id:yj,style:me,panelRef:d,defaultSize:he,minSize:`120px`,maxSize:`50%`,collapsible:!0,collapsedSize:0,onResize:ge,inert:p,className:ve,children:ye}),t[65]=p,t[66]=d,t[67]=me,t[68]=he,t[69]=ge,t[70]=ve,t[71]=ye,t[72]=be):be=t[72];let xe;return t[73]!==ue||t[74]!==de||t[75]!==be?(xe=(0,Z.jsxs)(UC,{orientation:`vertical`,className:`min-h-0 flex-1`,"data-dragging":ue,children:[de,fe,be]}),t[73]=ue,t[74]=de,t[75]=be,t[76]=xe):xe=t[76],xe}function Cj(e){return queueMicrotask(()=>xj(e))}function wj(){return uj()}function Tj(){}var Ej=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-DUAxBa3K.js`),__vite__mapDeps([36,1,2,37,38,39,23,40,41,42,43,44,45,46,47,14,6,8,9,22,3,24,4,12,10,11,48,49]),import.meta.url)).ActivityModeContent}));function Dj(e){let t=(0,$.c)(5),n;t[0]===e?n=t[1]:(n=(0,Z.jsx)(kj,{...e}),t[0]=e,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(Oj,{}),t[2]=r):r=t[2];let i;return t[3]===n?i=t[4]:(i=(0,Z.jsx)(Gt,{name:`editor-area`,children:(0,Z.jsxs)(DC,{children:[n,r]})}),t[3]=n,t[4]=i),i}function Oj(){let e=(0,$.c)(5),t=Eg(),n;e[0]===t?n=e[1]:(n=e=>{e||t.close()},e[0]=t,e[1]=n);let r;return e[2]!==t.open||e[3]!==n?(r=(0,Z.jsx)(RC,{open:t.open,onOpenChange:n}),e[2]=t.open,e[3]=n,e[4]=r):r=e[4],r}function kj(e){let t=(0,$.c)(156),{editorMode:n,onModeChange:r,activeTab:a,onActiveTabChange:o,terminalBridge:c,terminalVisible:l,onTerminalVisibleChange:u,terminalLaunch:d}=e,f=l===void 0?!1:l,p=d===void 0?null:d,{_:m}=i(),{activeDocName:h,activeProvider:g,activeTarget:_,recycleDocument:v,docPanelMode:y,docPanelAgentId:b,docPanelExpandSignal:S}=ht(),{openDocumentTransition:C}=Ot(),{requestAddProperty:w}=kC(),T=pw(g,h),E=gw(h,n===`source`?`source`:`wysiwyg`),D=Iw(g),O=D===`connected`||D===`synced`,k=hw(h)===`conflict`,A=(0,Q.useDeferredValue)(h),j=_?.kind===`missing`,M=!!h&&_?.kind!==`folder`,N;t[0]!==m||t[1]!==j?(N=j?m({id:`K-a33w`}):void 0,t[0]=m,t[1]=j,t[2]=N):N=t[2];let P=N,[F]=(0,Q.useState)(Nj),I=F!==null,L;t[3]===F?L=t[4]:(L=()=>Tw(F,window.innerWidth,`right`),t[3]=F,t[4]=L);let[R,z]=(0,Q.useState)(L),B=(0,Q.useRef)(R),V,H;t[5]===R?(V=t[6],H=t[7]):(V=()=>{B.current=R},H=[R],t[5]=R,t[6]=V,t[7]=H),(0,Q.useEffect)(V,H);let U=Sx(),W;t[8]===R?W=t[9]:(W=()=>Pw(`right`,R,Mw())===`collapsed`,t[8]=R,t[9]=W);let[G]=(0,Q.useState)(W),[K,q]=(0,Q.useState)(G),J=(0,Q.useRef)(K),ee,te;t[10]===K?(ee=t[11],te=t[12]):(ee=()=>{J.current=K},te=[K],t[10]=K,t[11]=ee,t[12]=te),(0,Q.useEffect)(ee,te);let[ne,re]=(0,Q.useState)(!1),Y=(0,Q.useRef)(!1),[ie]=(0,Q.useState)(Mj),ae=(0,Q.useRef)(ie),oe=(0,Q.useRef)(null),se;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(se=function(e){oe.current!=null&&clearTimeout(oe.current),oe.current=setTimeout(()=>{bw(e),oe.current=null},100)},t[13]=se):se=t[13];let ce=se,le,ue;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(le=()=>()=>{oe.current!=null&&clearTimeout(oe.current)},ue=[],t[14]=le,t[15]=ue):(le=t[14],ue=t[15]),(0,Q.useEffect)(le,ue);let[de,fe]=(0,Q.useState)(null),pe;t[16]!==K||t[17]!==U?(pe=function(){if(U.current==null)return;let e=B.current;K?(Fw(`right`,e,`open`),U.current?.expand()):(Fw(`right`,e,`collapsed`),U.current?.collapse())},t[16]=K,t[17]=U,t[18]=pe):pe=t[18];let me=pe,he,ge;t[19]!==F||t[20]!==U?(he=()=>{let e=window.matchMedia(`(min-width: ${Cw}px)`),t=()=>{let e=Tw(F,window.innerWidth,`right`);z(e);let t=Pw(`right`,e,Mw())===`collapsed`;q(t),t?U.current?.collapse():U.current?.expand()};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},ge=[F,U],t[19]=F,t[20]=U,t[21]=he,t[22]=ge):(he=t[21],ge=t[22]),(0,Q.useEffect)(he,ge);let _e,ve;t[23]!==de||t[24]!==I||t[25]!==U?(_e=()=>{if(de==null||I)return;let e=new ResizeObserver(()=>{J.current||Y.current||U.current?.resize(`${ae.current}px`)});return e.observe(de),()=>e.disconnect()},ve=[de,I,U],t[23]=de,t[24]=I,t[25]=U,t[26]=_e,t[27]=ve):(_e=t[26],ve=t[27]),(0,Q.useEffect)(_e,ve);let ye,be;t[28]!==o||t[29]!==U?(ye=()=>{let e=e=>{o(e),U.current?.expand()},t=Eh();return t&&e(t),Oh(t=>{Eh(),e(t)})},be=[o,U],t[28]=o,t[29]=U,t[30]=ye,t[31]=be):(ye=t[30],be=t[31]),(0,Q.useEffect)(ye,be);let xe,Se;t[32]!==S||t[33]!==U?(xe=()=>{S!==0&&U.current?.expand()},Se=[S,U],t[32]=S,t[33]=U,t[34]=xe,t[35]=Se):(xe=t[34],Se=t[35]),(0,Q.useEffect)(xe,Se);let Ce,we;t[36]===K?(Ce=t[37],we=t[38]):(Ce=()=>{if(!K||!document.getElementById(`doc-panel`)?.contains(document.activeElement))return;let e=document.querySelector(`[data-doc-panel-toggle]`);if(e){e.focus();return}document.querySelector(`[data-sidebar="trigger"]`)?.focus()},we=[K],t[36]=K,t[37]=Ce,t[38]=we),(0,Q.useLayoutEffect)(Ce,we);let Te,Ee;t[39]===K?(Te=t[40],Ee=t[41]):(Te=()=>{window.okDesktop!=null&&window.okDesktop.editor.notifyViewMenuStateChanged({docPanelVisible:!K})},Ee=[K],t[39]=K,t[40]=Te,t[41]=Ee),(0,Q.useEffect)(Te,Ee);let De,Oe;t[42]===me?(De=t[43],Oe=t[44]):(De=()=>{if(window.okDesktop!=null)return window.okDesktop.onMenuAction(e=>{e===`toggle-doc-panel`&&me()})},Oe=[me],t[42]=me,t[43]=De,t[44]=Oe),(0,Q.useEffect)(De,Oe);let ke,Ae;t[45]===me?(ke=t[46],Ae=t[47]):(ke=()=>{if(window.okDesktop!=null)return;let e=e=>{nc(e,`toggle-document-panel`)&&(e.preventDefault(),me())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},Ae=[me],t[45]=me,t[46]=ke,t[47]=Ae),(0,Q.useEffect)(ke,Ae);let je=(0,Q.useRef)(null),[Me,Ne]=(0,Q.useState)(null),Pe=_?.kind===`large-file`?_.docName:h,Fe,Ie;t[48]===Pe?(Fe=t[49],Ie=t[50]):(Fe=()=>{if(Pe&&Pe!==je.current){let e=je.current;je.current=Pe,Ne(e)}},Ie=[Pe],t[48]=Pe,t[49]=Fe,t[50]=Ie),(0,Q.useEffect)(Fe,Ie);let Le;t[51]===C?Le=t[52]:(Le=function(e){let t=Ho(e);window.location.hash===t?C(e):window.location.hash=t},t[51]=C,t[52]=Le);let Re=Le;if(_?.kind===`large-file`){let e;t[53]!==Re||t[54]!==Me?(e=Me?{previousDocName:Me,onNavigateBack:Re}:void 0,t[53]=Re,t[54]=Me,t[55]=e):e=t[55];let n;return t[56]!==_.docName||t[57]!==_.limit||t[58]!==_.size||t[59]!==e?(n=(0,Z.jsx)(CC,{docName:_.docName,size:_.size,limit:_.limit,backNav:e}),t[56]=_.docName,t[57]=_.limit,t[58]=_.size,t[59]=e,t[60]=n):n=t[60],n}if(_?.kind===`folder`){if(!(y===`agent`&&b!==null)){let e;return t[61]===_.folderPath?e=t[62]:(e=(0,Z.jsx)(yC,{folderPath:_.folderPath}),t[61]=_.folderPath,t[62]=e),e}let e;t[63]===_.folderPath?e=t[64]:(e=(0,Z.jsx)(WC,{minSize:`30%`,defaultSize:`75%`,children:(0,Z.jsx)(yC,{folderPath:_.folderPath})}),t[63]=_.folderPath,t[64]=e);let n;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(GC,{withHandle:!0}),t[65]=n):n=t[65];let r;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(WC,{defaultSize:`25%`,minSize:`300px`,maxSize:`40%`,className:`flex flex-col bg-muted/20`,children:(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(`div`,{role:`status`,"aria-busy":`true`,className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`ONPvOb`})}),children:(0,Z.jsx)(Ej,{showBackButton:!1})})}),t[66]=r):r=t[66];let i;return t[67]===e?i=t[68]:(i=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1`,children:(0,Z.jsxs)(UC,{orientation:`horizontal`,children:[e,n,r]})}),t[67]=e,t[68]=i),i}if(_?.kind===`asset`){let e;return t[69]!==_.assetPath||t[70]!==_.mediaKind?(e=(0,Z.jsx)(Fx,{assetPath:_.assetPath,mediaKind:_.mediaKind},_.assetPath),t[69]=_.assetPath,t[70]=_.mediaKind,t[71]=e):e=t[71],e}if(!g||!h){if((typeof window<`u`?as(window.location.hash):null)!==null){let e;return t[72]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Ix,{}),t[72]=e):e=t[72],e}if(c!=null){let e=u??jj,n;t[73]===f?n=t[74]:(n=(0,Z.jsx)(zS,{terminalVisible:f}),t[73]=f,t[74]=n);let r;return t[75]!==e||t[76]!==n||t[77]!==c||t[78]!==p||t[79]!==f?(r=(0,Z.jsx)(Sj,{bridge:c,visible:f,onVisibleChange:e,launch:p,children:n}),t[75]=e,t[76]=n,t[77]=c,t[78]=p,t[79]=f,t[80]=r):r=t[80],r}let e;return t[81]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(zS,{}),t[81]=e):e=t[81],e}let ze=n===`source`,Be=!O,He=K,Ue;t[82]!==h||t[83]!==w?(Ue=function(){h&&w(h)},t[82]=h,t[83]=w,t[84]=Ue):Ue=t[84];let We=Ue,Ge=A??h,Ke=Me??void 0,qe;t[85]!==P||t[86]!==ze||t[87]!==Re||t[88]!==v||t[89]!==Ge||t[90]!==Ke?(qe=(0,Z.jsx)(Vk,{activeDocName:Ge,isSourceMode:ze,editorPlaceholder:P,previousDocName:Ke,onNavigateBack:Re,onRecycle:v}),t[85]=P,t[86]=ze,t[87]=Re,t[88]=v,t[89]=Ge,t[90]=Ke,t[91]=qe):qe=t[91];let Je;t[92]!==h||t[93]!==ze?(Je=(0,Z.jsx)(lw,{activeDocName:h,isSourceMode:ze}),t[92]=h,t[93]=ze,t[94]=Je):Je=t[94];let Ye;t[95]!==h||t[96]!==A?(Ye=ZA({activeDocName:h,deferredActiveDocName:A,mountResolved:h!==null&&x(h),syncResolved:h!==null&&Ve(h)})?(0,Z.jsxs)(`div`,{className:`absolute inset-0 z-10 bg-background`,children:[(0,Z.jsx)(Ix,{}),h===null?null:(0,Z.jsx)(wC,{docName:h})]}):null,t[95]=h,t[96]=A,t[97]=Ye):Ye=t[97];let Xe;t[98]!==qe||t[99]!==Je||t[100]!==Ye?(Xe=(0,Z.jsxs)(`div`,{className:`relative h-full`,children:[qe,Je,Ye]}),t[98]=qe,t[99]=Je,t[100]=Ye,t[101]=Xe):Xe=t[101];let Ze;t[102]!==h||t[103]!==k||t[104]!==He||t[105]!==ze||t[106]!==r||t[107]!==We||t[108]!==Be||t[109]!==me?(Ze=!k&&(0,Z.jsx)(XA,{activeDocName:h,isSourceMode:ze,sourceDisabled:Be,onModeChange:r,showAddPropertyButton:!ze,onAddProperty:We,isPanelCollapsed:He,onTogglePanel:me}),t[102]=h,t[103]=k,t[104]=He,t[105]=ze,t[106]=r,t[107]=We,t[108]=Be,t[109]=me,t[110]=Ze):Ze=t[110];let Qe;t[111]!==Xe||t[112]!==Ze?(Qe=(0,Z.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[Xe,Ze]}),t[111]=Xe,t[112]=Ze,t[113]=Qe):Qe=t[113];let $e;t[114]!==E||t[115]!==M||t[116]!==T?($e=(0,Z.jsx)(PA,{stats:T,selectionStats:E,showStats:M}),t[114]=E,t[115]=M,t[116]=T,t[117]=$e):$e=t[117];let et;t[118]!==Qe||t[119]!==$e?(et=(0,Z.jsxs)(`div`,{className:`relative flex h-full flex-col`,children:[Qe,$e]}),t[118]=Qe,t[119]=$e,t[120]=et):et=t[120];let tt=et,nt;t[121]!==tt||t[122]!==u||t[123]!==c||t[124]!==p||t[125]!==f?(nt=c==null?tt:(0,Z.jsx)(Sj,{bridge:c,visible:f,onVisibleChange:u??Aj,launch:p,children:tt}),t[121]=tt,t[122]=u,t[123]=c,t[124]=p,t[125]=f,t[126]=nt):nt=t[126];let rt=nt,it=ne||void 0,at;t[127]===G?at=t[128]:(at=G?{defaultSize:`100%`}:{},t[127]=G,t[128]=at);let ot=ne?void 0:`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,st;t[129]!==rt||t[130]!==at||t[131]!==ot?(st=(0,Z.jsx)(WC,{minSize:`30%`,...at,className:ot,children:rt}),t[129]=rt,t[130]=at,t[131]=ot,t[132]=st):st=t[132];let ct=I&&K,lt;t[133]===Symbol.for(`react.memo_cache_sentinel`)?(lt=()=>{re(!0),Y.current=!0;let e=()=>{re(!1),Y.current=!1,window.removeEventListener(`pointerup`,e)};window.addEventListener(`pointerup`,e)},t[133]=lt):lt=t[133];let ut;t[134]===ct?ut=t[135]:(ut=(0,Z.jsx)(GC,{withHandle:!0,disabled:ct,onPointerDown:lt}),t[134]=ct,t[135]=ut);let dt=G?0:`${ie}px`,ft;t[136]===Symbol.for(`react.memo_cache_sentinel`)?(ft=e=>{q(e.asPercentage===0),e.inPixels>0&&Y.current&&(ae.current=e.inPixels,ce(e.inPixels))},t[136]=ft):ft=t[136];let pt=!ne&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,mt;t[137]===pt?mt=t[138]:(mt=si(`flex flex-col bg-muted/20`,pt),t[137]=pt,t[138]=mt);let gt;t[139]!==h||t[140]!==a||t[141]!==y||t[142]!==ze||t[143]!==o?(gt=(0,Z.jsx)(Oy,{docName:h,isSourceMode:ze,activeTab:a,onActiveTabChange:o,mode:y}),t[139]=h,t[140]=a,t[141]=y,t[142]=ze,t[143]=o,t[144]=gt):gt=t[144];let _t;t[145]!==K||t[146]!==U||t[147]!==dt||t[148]!==mt||t[149]!==gt?(_t=(0,Z.jsx)(WC,{id:`doc-panel`,panelRef:U,defaultSize:dt,minSize:`300px`,maxSize:`600px`,collapsible:!0,collapsedSize:0,onResize:ft,inert:K,className:mt,children:gt}),t[145]=K,t[146]=U,t[147]=dt,t[148]=mt,t[149]=gt,t[150]=_t):_t=t[150];let vt;return t[151]!==it||t[152]!==st||t[153]!==ut||t[154]!==_t?(vt=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1`,ref:fe,children:(0,Z.jsxs)(UC,{orientation:`horizontal`,"data-dragging":it,children:[st,ut,_t]})}),t[151]=it,t[152]=st,t[153]=ut,t[154]=_t,t[155]=vt):vt=t[155],vt}function Aj(){}function jj(){}function Mj(){return xw()}function Nj(){return kr()}function Pj(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r.kind!==i.kind)return!1;if(r.kind===`human`&&i.kind===`human`){if(r.clientId!==i.clientId||r.mode!==i.mode||r.tabCount!==i.tabCount)return!1;let e=r.user,t=i.user;if(e.name!==t.name||e.color!==t.color||e.icon!==t.icon)return!1}else if(r.kind===`agent`&&i.kind===`agent`){if(r.agentId!==i.agentId)return!1;let e=r.presence,t=i.presence;if(e.displayName!==t.displayName||e.icon!==t.icon||e.color!==t.color||e.currentDoc!==t.currentDoc||e.mode!==t.mode)return!1}}return!0}function Fj(e){let t=new Map;for(let n of e){let e=n.user.principalId;if(typeof e==`string`&&e.length>0){let r=t.get(e);r?r.push(n):t.set(e,[n])}}let n=new Map;for(let[e,r]of t){let t=r.reduce((e,t)=>Math.min(e,t.clientId),1/0);n.set(e,{repClientId:t,count:r.length})}let r=[];for(let t of e){let e=t.user.principalId;if(typeof e==`string`&&e.length>0){let i=n.get(e);i&&i.repClientId===t.clientId&&r.push({...t,tabCount:i.count})}else r.push({...t,tabCount:1})}return r}var Ij=1e3,Lj=!1;function Rj(e){return!!(e.localPrincipalId&&e.entryPrincipalId===e.localPrincipalId||!e.localPrincipalId&&e.entryClientId===e.localClientId)}function zj(e,t,n){let r=(0,$.c)(9),i;r[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={current:[],crossDoc:[]},r[0]=i):i=r[0];let[a,o]=(0,Q.useState)(i),s;r[1]!==n||r[2]!==e?.awareness||r[3]!==t?.awareness?(s=()=>{let r=e?.awareness,i=t?.awareness,a;i==null?a=void 0:Ci(i)?a=i:(a=void 0,Lj||(Lj=!0,console.warn(`[agent-presence] __system__ provider awareness missing getStates() — presence bar will render without agent peers`)));let s=()=>{let e=(r?.getLocalState())?.user?.principalId??null,t=r?.clientID??null,i=[];if(r)for(let[n,a]of r.getStates().entries()){let r=a;if(!r.user||typeof r.user!=`object`)continue;let o=r.user;o.type===`human`&&(Rj({entryPrincipalId:o.principalId,entryClientId:n,localPrincipalId:e,localClientId:t})||i.push({kind:`human`,clientId:n,user:o,mode:r.mode??`wysiwyg`,tabCount:1}))}let s=Fj(i),{current:c,crossDoc:l}=a?vi(a,n,Date.now()):{current:[],crossDoc:[]},u=Bj,d=c.map(u),f=l.map(u),p=[...s,...d],m=f;o(e=>Pj(e.current,p)&&Pj(e.crossDoc,m)?e:{current:p,crossDoc:m})};s();let c=()=>s(),l=()=>s();r?.on(`change`,c),t?.awareness?.on(`change`,l);let u=setInterval(s,Ij);return()=>{r?.off(`change`,c),t?.awareness?.off(`change`,l),clearInterval(u)}},r[1]=n,r[2]=e?.awareness,r[3]=t?.awareness,r[4]=s):s=r[4];let c;return r[5]!==n||r[6]!==e||r[7]!==t?(c=[e,t,n],r[5]=n,r[6]=e,r[7]=t,r[8]=c):c=r[8],(0,Q.useEffect)(s,c),a}function Bj(e){let{agentId:t,entry:n}=e;return{kind:`agent`,agentId:t,presence:n}}var Vj=`sync-status`;function Hj(e,t){let n=(0,$.c)(6),{_:r}=i(),a=cm(),o=(0,Q.useRef)(!1),s=(0,Q.useRef)(!1),c=(0,Q.useRef)(t),l,u;n[0]!==r||n[1]!==t||n[2]!==a||n[3]!==e?(l=()=>{if(c.current!==t&&(c.current=t,o.current=!1,s.current=!1),t)if(e===`synced`&&(o.current=!0),e===`disconnected`&&o.current){if(a){X.dismiss(Vj);return}s.current=!0,X.warning(r({id:`HGNCsl`}),{id:Vj,duration:1/0})}else s.current&&e===`synced`&&(s.current=!1,X.success(r({id:`GhjUB_`}),{id:Vj,duration:3e3}))},u=[e,t,r,a],n[0]=r,n[1]=t,n[2]=a,n[3]=e,n[4]=l,n[5]=u):(l=n[4],u=n[5]),(0,Q.useEffect)(l,u)}var Uj=4,Wj=3,Gj={Bird:tl,Cat:sl,Dog:ml,Fish:bl,Mouse:ql,Rabbit:Kl,Shrimp:$l,Snail:eu,Squirrel:iu,Turtle:fu};Object.freeze(Object.keys(Gj));function Kj(e){if(typeof e.principalId==`string`&&e.principalId.length>0)return{kind:`initials`};let t=e.name.split(` `)[1];return t&&Object.hasOwn(Gj,t)?{kind:`animal`,animal:t}:{kind:`initials`}}var qj={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`,bot:`Agent`};function Jj(e){let t=(0,$.c)(28),{user:n,mode:r,tabCount:a}=e,{_:o}=i(),s=Kj(n),c=s.kind===`animal`?Gj[s.animal]:void 0,l;t[0]===n.name?l=t[1]:(l=tr(n.name),t[0]=n.name,t[1]=l);let u=l,d;t[2]===n.color?d=t[3]:(d=Kr(n.color),t[2]=n.color,t[3]=d);let f=d,p=n.name,m;t[4]!==o||t[5]!==a||t[6]!==p?(m=a>1?o({id:`qAhFeg`,values:{userName:p,tabCount:a}}):p,t[4]=o,t[5]=a,t[6]=p,t[7]=m):m=t[7];let h=m,g;t[8]!==o||t[9]!==a||t[10]!==p?(g=a>1?o({id:`BEkF-P`,values:{userName:p,tabCount:a}}):p,t[8]=o,t[9]=a,t[10]=p,t[11]=g):g=t[11];let _=g,v;t[12]===n.color?v=t[13]:(v={backgroundColor:n.color},t[12]=n.color,t[13]=v);let y;t[14]!==c||t[15]!==f||t[16]!==u?(y=c?(0,Z.jsx)(c,{size:18,color:f,strokeWidth:1.5}):(0,Z.jsx)(`span`,{className:`font-mono text-2xs font-semibold leading-none`,style:{color:f},children:u}),t[14]=c,t[15]=f,t[16]=u,t[17]=y):y=t[17];let b;t[18]!==_||t[19]!==r||t[20]!==v||t[21]!==y?(b=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(`div`,{"data-presence-badge":`human`,"data-presence-mode":r,role:`img`,"aria-label":_,className:`inline-flex size-7 shrink-0 cursor-default items-center justify-center rounded-full ring-2 ring-background`,style:v,children:y})}),t[18]=_,t[19]=r,t[20]=v,t[21]=y,t[22]=b):b=t[22];let x;t[23]===h?x=t[24]:(x=(0,Z.jsx)(Ns,{children:h}),t[23]=h,t[24]=x);let S;return t[25]!==b||t[26]!==x?(S=(0,Z.jsxs)(Is,{children:[b,x]}),t[25]=b,t[26]=x,t[27]=S):S=t[27],S}function Yj(e){let t=qj[e.icon];return e.displayName||t||hs._({id:`iEQQyu`})}function Xj(e){let t=(0,$.c)(3),[n,r]=(0,Q.useState)(e===`writing`),i=(0,Q.useRef)(null),a,o;return t[0]===e?(a=t[1],o=t[2]):(a=()=>{if(e===`writing`){i.current!==null&&(clearTimeout(i.current),i.current=null),r(!0);return}return i.current!==null&&clearTimeout(i.current),i.current=setTimeout(()=>{i.current=null,r(!1)},600),()=>{i.current!==null&&(clearTimeout(i.current),i.current=null)}},o=[e],t[0]=e,t[1]=a,t[2]=o),(0,Q.useEffect)(a,o),n}function Zj(e){let t=(0,$.c)(33),{participant:n,crossDoc:r,scoped:a,onClickAgent:o}=e,{_:c}=i(),{activeDocName:l}=ht(),{presence:u,agentId:d}=n,f=Yj(u),p=Xj(u.mode),m=!r&&p,h=u.currentDoc&&u.currentDoc!==`(connected)`?u.currentDoc:null,g=l!==null||h!==null,_=g?`cursor-pointer`:`cursor-default opacity-50`,v=a?`ring-primary ring-offset-2 ring-offset-background`:`ring-background`,y=m&&!a?`ring-primary/40 animate-pulse`:``,b;t[0]!==_||t[1]!==v||t[2]!==y?(b=[`inline-flex size-7 shrink-0 items-center justify-center rounded-full ring-2`,_,v,y].filter(Boolean),t[0]=_,t[1]=v,t[2]=y,t[3]=b):b=t[3];let x=b.join(` `),S=r?`true`:void 0,C=a?`true`:void 0,w=g?void 0:`true`,T;t[4]!==u.mode||t[5]!==S||t[6]!==C||t[7]!==w?(T={"data-presence-badge":`agent`,"data-presence-mode":u.mode,"data-presence-crossdoc":S,"data-presence-scoped":C,"data-presence-inert":w},t[4]=u.mode,t[5]=S,t[6]=C,t[7]=w,t[8]=T):T=t[8];let E=T,D=c(r&&h?{id:`b4AQFK`,values:{tooltipName:f,realCurrentDoc:h}}:{id:`RfHNf8`,values:{tooltipName:f}}),O;t[9]!==d||t[10]!==D||t[11]!==E||t[12]!==g||t[13]!==o||t[14]!==u.color||t[15]!==u.icon||t[16]!==h||t[17]!==x||t[18]!==f?(O=g?(0,Z.jsx)(`button`,{type:`button`,...E,"aria-label":D,className:x,style:{backgroundColor:u.color},onClick:()=>o(d,h),children:(0,Z.jsx)(xi,{icon:u.icon,width:16,height:16,className:`text-white`,"aria-hidden":!0})}):(0,Z.jsx)(`div`,{...E,role:`img`,"aria-label":f,className:x,style:{backgroundColor:u.color},children:(0,Z.jsx)(xi,{icon:u.icon,width:16,height:16,className:`text-white`,"aria-hidden":!0})}),t[9]=d,t[10]=D,t[11]=E,t[12]=g,t[13]=o,t[14]=u.color,t[15]=u.icon,t[16]=h,t[17]=x,t[18]=f,t[19]=O):O=t[19];let k=O,A;t[20]===k?A=t[21]:(A=(0,Z.jsx)(js,{asChild:!0,children:k}),t[20]=k,t[21]=A);let j;t[22]===f?j=t[23]:(j=(0,Z.jsx)(`span`,{className:`font-medium`,children:f}),t[22]=f,t[23]=j);let M;t[24]!==r||t[25]!==h?(M=r&&h?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(s,{id:`Wh0im4`,values:{realCurrentDoc:h}})}):null,t[24]=r,t[25]=h,t[26]=M):M=t[26];let N;t[27]!==j||t[28]!==M?(N=(0,Z.jsxs)(Ns,{className:`flex flex-col gap-0.5`,children:[j,M]}),t[27]=j,t[28]=M,t[29]=N):N=t[29];let P;return t[30]!==A||t[31]!==N?(P=(0,Z.jsxs)(Is,{children:[A,N]}),t[30]=A,t[31]=N,t[32]=P):P=t[32],P}function Qj(e){let t=(0,$.c)(21),{count:n,remainder:r,crossDoc:i,scopedAgentId:a,onClickAgent:o}=e,s;t[0]!==n||t[1]!==i?(s=i?hs._({id:`9euN0m`,values:{count:n}}):hs._({id:`uhJEA2`,values:{count:n}}),t[0]=n,t[1]=i,t[2]=s):s=t[2];let c=s,l=i?`true`:void 0,u;t[3]!==n||t[4]!==c||t[5]!==l?(u=(0,Z.jsx)(J,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`presence-overflow`,"data-presence-crossdoc":l,className:`inline-flex size-7 shrink-0 cursor-pointer items-center justify-center rounded-full bg-muted font-medium text-muted-foreground text-xs ring-2 ring-background hover:bg-muted/80`,"aria-label":c,children:[`+`,n]})}),t[3]=n,t[4]=c,t[5]=l,t[6]=u):u=t[6];let d;if(t[7]!==i||t[8]!==o||t[9]!==r||t[10]!==a){let e;t[12]!==i||t[13]!==o||t[14]!==a?(e=e=>e.kind===`human`?(0,Z.jsx)(Jj,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(Zj,{participant:e,crossDoc:i,scoped:a===e.agentId,onClickAgent:o},e.agentId),t[12]=i,t[13]=o,t[14]=a,t[15]=e):e=t[15],d=r.map(e),t[7]=i,t[8]=o,t[9]=r,t[10]=a,t[11]=d}else d=t[11];let f;t[16]===d?f=t[17]:(f=(0,Z.jsx)(b,{align:`end`,className:`w-auto max-w-xs p-2`,children:(0,Z.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:d})}),t[16]=d,t[17]=f);let p;return t[18]!==u||t[19]!==f?(p=(0,Z.jsxs)(pe,{children:[u,f]}),t[18]=u,t[19]=f,t[20]=p):p=t[20],p}function $j(e,t,n,r){return e.kind===`human`?(0,Z.jsx)(Jj,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(Zj,{participant:e,crossDoc:n,scoped:r===e.agentId,onClickAgent:t},e.agentId)}function eM(){let e=(0,$.c)(20),{activeProvider:t,activeDocName:n,systemProvider:r,openActivityPanel:i,docPanelMode:a,docPanelAgentId:o}=ht(),{current:s,crossDoc:c}=zj(t,r,n);if(Hj(Iw(t),n),s.length===0&&c.length===0)return null;let l;if(e[0]!==c||e[1]!==s||e[2]!==o||e[3]!==a||e[4]!==i){let t=s.slice(0,Uj),n;e[6]===s?n=e[7]:(n=s.slice(Uj),e[6]=s,e[7]=n);let r=n,u=c.slice(0,Wj),d;e[8]===c?d=e[9]:(d=c.slice(Wj),e[8]=c,e[9]=d);let f=d,p=i,m=a===`agent`?o:null,h;e[10]!==p||e[11]!==m?(h=e=>$j(e,p,!1,m),e[10]=p,e[11]=m,e[12]=h):h=e[12];let g=t.map(h),_;e[13]!==r||e[14]!==p||e[15]!==m?(_=r.length>0?(0,Z.jsx)(Qj,{count:r.length,remainder:r,crossDoc:!1,scopedAgentId:m,onClickAgent:p}):null,e[13]=r,e[14]=p,e[15]=m,e[16]=_):_=e[16];let v;e[17]!==g||e[18]!==_?(v=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,"data-presence-section":`current`,children:[g,_]}),e[17]=g,e[18]=_,e[19]=v):v=e[19],l=(0,Z.jsxs)(`div`,{"data-slot":`presence-bar`,className:`flex items-center px-1 py-1.5`,children:[v,c.length>0?(0,Z.jsxs)(`div`,{className:`ml-1.5 flex items-center gap-1.5`,"data-presence-section":`crossdoc`,children:[u.map(e=>$j(e,p,!0,m)),f.length>0?(0,Z.jsx)(Qj,{count:f.length,remainder:f,crossDoc:!0,scopedAgentId:m,onClickAgent:p}):null]}):null]}),e[0]=c,e[1]=s,e[2]=o,e[3]=a,e[4]=i,e[5]=l}else l=e[5];return l}var tM=new Set([`.md`,`.mdx`]);function nM(e){let t=e.lastIndexOf(`/`),n=t<0?e:e.slice(t+1),r=n.lastIndexOf(`.`);return r<=0?``:n.slice(r)}function rM(e,t){let n=e.lastIndexOf(`/`),r=n<0?``:e.slice(0,n+1),i=n<0?e:e.slice(n+1),a=i.lastIndexOf(`.`);return`${r}${a<=0?i:i.slice(0,a)}${t}`}function iM(e){return tM.has(nM(e).toLowerCase())}function aM(e,t,n){if(n)return{kind:`allow`,destinationPath:t};let r=nM(e);return r===``?{kind:`allow`,destinationPath:t}:{kind:`allow`,destinationPath:nM(t)?t:rM(t,r)}}var oM=`.md`,sM=/\.(md|mdx)$/i;function cM(e,t=oM){return`${e}${t}`}function lM(e){return IM(e).replace(sM,``)}function uM(e){return Qo(e)?pM(e.path):zo(e)?e.path:cM(e.docName,e.docExt)}function dM(e){let t=IM(e).match(sM);return t?`.${t[1].toLowerCase()}`:void 0}function fM(e){return IM(e)}function pM(e){let t=IM(e.trim());return t?`${t}/`:``}function mM(e){return e.endsWith(`/`)?fM(e):lM(e)}function hM(e){return e.map(uM)}function gM(e){return[...e].sort().join(`\0`)}function _M(e){return gM(hM(e))}function vM(e){let t=new Set;for(let n of e){if(Qo(n)){let e=pM(n.path);e&&t.add(e)}let e=(Qo(n)||zo(n)?n.path:n.docName).split(`/`).filter(Boolean),r=Qo(n)?e.length:e.length-1;for(let n=1;n<=r;n++)t.add(`${e.slice(0,n).join(`/`)}/`)}return[...t].sort()}function yM(e){if(!e)return[];let t=IM(e.replace(sM,``)).split(`/`).filter(Boolean),n=[],r=e.endsWith(`/`)?t.length:t.length-1;for(let e=1;e<=r;e++)n.push(`${t.slice(0,e).join(`/`)}/`);return n}function bM(e,t,n){let r=dM(e);if(r)return r;let i=n.find(e=>ps(e)&&e.docName===t);return i?i.docExt??oM:FM(e).includes(`.`)?void 0:oM}function xM(e,t){let n=e.lastIndexOf(`/`),r=n===-1?``:e.slice(0,n+1),i=n===-1?e:e.slice(n+1),a=t.filter(e=>{if(!zo(e)||!e.path.startsWith(r))return!1;let t=e.path.slice(r.length);return!t.includes(`/`)&&t.startsWith(`${i}.`)});return a.length===1?a[0].path:null}function SM(e,t,n){if(dM(e))return null;let r=n.find(e=>zo(e)&&e.path===t);return r?r.path:FM(e).includes(`.`)?t:xM(t,n)}function CM(e,t){let n=e.kind===`directory`,r=n?fM(e.path):lM(e.path);if(n)return{kind:`folder`,name:IM(FM(e.path)).replace(sM,``),path:r,treePath:TM(e.path,!0)};let i=SM(e.path,r,t);if(i)return{kind:`asset`,name:IM(FM(i)),path:i,treePath:i};let a=bM(e.path,r,t);return{kind:`file`,name:IM(FM(e.path)).replace(sM,``),path:r,treePath:TM(e.path,!1),docExt:a}}function wM(e){return e.kind===`directory`?fM(e.path):e.path}function TM(e,t){return t?pM(e):sM.test(e)?e:`${e}${oM}`}function EM(e,t,n){let r=pM(t),i=new Set(n);for(let t=0;t<100;t++){let n=t===0?``:` ${t+1}`;if(e===`file`){let e=`${r}Untitled${n}${oM}`;if(!i.has(e))return{addPath:e,renamePath:e};continue}let a=`${r}New Folder${n}/`;if(!i.has(a))return{addPath:a,renamePath:a}}throw Error(`Could not allocate a unique tree placeholder`)}function DM(e,t){return e===`file`?TM(t,!1):`${fM(t)}/index${oM}`}function OM(e,t){return t.kind===`root`||t.directoryPath==null?FM(e):`${t.directoryPath}${FM(e)}`}function kM(e,t){if(t)return fM(pM(e));let n=lM(e),r=n.lastIndexOf(`/`);return r===-1?``:n.slice(0,r)}function AM(e,t){let n=fM(pM(e));return n?`${n}/${t}`:t}function jM(e,t){return(t.path??AM(e,t.src)).replace(/^\/+/,``)}function MM(e){let t=e.dataTransfer?.types;if(!t)return!1;let n=Array.from(t);return n.includes(`Files`)&&!n.includes(`application/x-open-knowledge-sidebar-item+json`)}function NM(e){return Array.from(e.dataTransfer?.files??[]).filter(e=>e.name.length>0||e.size>0)}function PM(e,t){let n=nM(e).toLowerCase();if(n===``)return null;let r=new Date().toISOString();if(n===`.md`||n===`.mdx`)return{kind:`document`,docName:lM(e),docExt:n,modified:r,size:t.size};let i=n.startsWith(`.`)?n.slice(1):n;return{kind:`asset`,path:e,assetExt:i,mediaKind:rr(i),modified:r,size:t.size}}function FM(e){let t=IM(e),n=t.lastIndexOf(`/`),r=n===-1?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function IM(e){return e.endsWith(`/`)?e.slice(0,-1):e}function LM(e,t){return t.trim()}function RM(e){return![``,`.`,`..`].includes(e)&&!e.includes(`/`)&&!e.includes(`\\`)&&!e.includes(`\0`)}function zM(e,t){let n=LM(e.kind,t),r=e.path.split(`/`);return r[r.length-1]=n,r.join(`/`)}function BM(e,t,n=[],r=[],i=[]){if(t.length===0&&n.length===0&&r.length===0&&i.length===0)return e;let a=new Map(t.map(e=>[e.fromDocName,e.toDocName])),o=new Map(i.map(e=>[e.toDocName,e.docExt])),s=new Map(r.map(e=>[e.fromPath,e.toPath]));return e.map(e=>{if(ps(e)){let t=s.get(cM(e.docName,e.docExt));if(t){let n=Vo(t);return{kind:`asset`,path:t,assetExt:n,mediaKind:rr(n),size:e.size,modified:e.modified,referencedBy:[]}}let n=a.get(e.docName)??e.docName;return{...e,docName:n,docExt:o.get(n)??e.docExt}}if(Qo(e))return{...e,path:qM(e.path,n)};if(zo(e)){let t=s.get(e.path);return t&&iM(t)?{kind:`document`,docName:lM(t),docExt:nM(t),size:e.size,modified:e.modified}:{...e,path:t??qM(e.path,n)}}return e})}function VM(e,t,n,r=[]){if(t.length===0&&!n&&r.length===0)return e;let i=new Set(t),a=new Set(r);return e.filter(e=>ps(e)?!i.has(e.docName)&&!ZM(e.docName,n):Qo(e)?!ZM(e.path,n):zo(e)?!a.has(e.path)&&!ZM(e.path,n):!0)}function HM(e,t){if(e.kind!==`asset`||t.some(t=>zo(t)&&t.path===e.path))return e;let n=xM(e.path,t);return n?{...e,path:n,name:n.split(`/`).pop()??n}:e}function UM(e,t,n,r=new Date().toISOString()){let i=!1,a=[...e],o=e=>{a.some(t=>JM(t,e))||(a.push(e),i=!0)};if(n.kind===`file`){let s=e.find(e=>ps(e)&&e.docName===t.path);return o({kind:`document`,docName:n.path,docExt:s?.docExt??t.docExt,size:s?.size??0,modified:r}),i?a:e}let s=e.find(e=>Qo(e)&&e.path===t.path);o({kind:`folder`,path:n.path,size:s?.size??0,modified:r});let c=new Set(n.duplicatedDocNames);for(let i of e){if(ps(i)){let e=XM(i.docName,t.path,n.path);e&&c.has(e)&&o({...i,docName:e,modified:r});continue}if(Qo(i)){let e=YM(i.path,t.path,n.path);e&&o({...i,path:e,modified:r})}}return i?a:e}function WM(e,t){return e?t.find(t=>t.fromDocName===e)?.toDocName??e:null}function GM(e,t,n){return e.flatMap(e=>t===e.toDocName||!n(e.toDocName)?[e.fromDocName]:[e.fromDocName,e.toDocName])}function KM(e,t){let n=e.kind===`file`?cM(e.path,e.docExt):e.path;return Zg(t.contentDir,n,t.pathSeparator)}function qM(e,t){for(let{fromPath:n,toPath:r}of t){if(e===n)return r;if(e.startsWith(`${n}/`))return`${r}${e.slice(n.length)}`}return e}function JM(e,t){return ps(e)&&ps(t)?e.docName===t.docName:Qo(e)&&Qo(t)||zo(e)&&zo(t)?e.path===t.path:!1}function YM(e,t,n){return e===t?n:XM(e,t,n)}function XM(e,t,n){return e.startsWith(`${t}/`)?`${n}${e.slice(t.length)}`:null}function ZM(e,t){return!!t&&(e===t||e.startsWith(`${t}/`))}function QM(e){let t=(0,$.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,Z.jsx)(pd,{"data-slot":`context-menu`,...n}),t[2]=n,t[3]=r),r}function $M(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=si(`select-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(md,{"data-slot":`context-menu-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function eN(e){let t=(0,$.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,Z.jsx)(_d,{"data-slot":`context-menu-group`,...n}),t[2]=n,t[3]=r),r}function tN(e){let t=(0,$.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,Z.jsx)(Cd,{"data-slot":`context-menu-sub`,...n}),t[2]=n,t[3]=r),r}function nN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=si(`z-50 max-h-(--radix-context-menu-content-available-height) min-w-36 origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 motion-reduce:data-open:animate-none motion-reduce:data-closed:animate-none motion-reduce:duration-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(hd,{children:(0,Z.jsx)(gd,{"data-slot":`context-menu-content`,className:i,...r})}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function rN(e){let t=(0,$.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,inset:r,variant:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?`default`:a,s;t[5]===n?s=t[6]:(s=si(`group/context-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 focus:*:[svg]:text-accent-foreground data-[variant=destructive]:*:[svg]:text-destructive`,n),t[5]=n,t[6]=s);let c;return t[7]!==r||t[8]!==i||t[9]!==s||t[10]!==o?(c=(0,Z.jsx)(yd,{"data-slot":`context-menu-item`,"data-inset":r,"data-variant":o,className:s,...i}),t[7]=r,t[8]=i,t[9]=s,t[10]=o,t[11]=c):c=t[11],c}function iN(e){let t=(0,$.c)(13),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,inset:i,children:n,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;t[5]===r?o=t[6]:(o=si(`flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,r),t[5]=r,t[6]=o);let s;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(Po,{className:`ml-auto`}),t[7]=s):s=t[7];let c;return t[8]!==n||t[9]!==i||t[10]!==a||t[11]!==o?(c=(0,Z.jsxs)(wd,{"data-slot":`context-menu-sub-trigger`,"data-inset":i,className:o,...a,children:[n,s]}),t[8]=n,t[9]=i,t[10]=a,t[11]=o,t[12]=c):c=t[12],c}function aN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=si(`z-50 max-h-(--radix-context-menu-content-available-height) min-w-32 origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg border bg-popover p-1 text-popover-foreground shadow-lg data-[state=closed]:overflow-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 motion-reduce:data-open:animate-none motion-reduce:data-closed:animate-none motion-reduce:duration-0 subtle-scrollbar`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Td,{"data-slot":`context-menu-sub-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function oN(e){let t=(0,$.c)(15),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:i,children:r,checked:n,inset:a,...o}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s;t[6]===i?s=t[7]:(s=si(`relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,i),t[6]=i,t[7]=s);let c;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(`span`,{className:`pointer-events-none absolute right-2`,children:(0,Z.jsx)(xd,{children:(0,Z.jsx)(Ao,{})})}),t[8]=c):c=t[8];let l;return t[9]!==n||t[10]!==r||t[11]!==a||t[12]!==o||t[13]!==s?(l=(0,Z.jsxs)(bd,{"data-slot":`context-menu-checkbox-item`,"data-inset":a,className:s,checked:n,...o,children:[c,r]}),t[9]=n,t[10]=r,t[11]=a,t[12]=o,t[13]=s,t[14]=l):l=t[14],l}function sN(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,inset:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=si(`px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7`,n),t[4]=n,t[5]=a);let o;return t[6]!==r||t[7]!==i||t[8]!==a?(o=(0,Z.jsx)(vd,{"data-slot":`context-menu-label`,"data-inset":r,className:a,...i}),t[6]=r,t[7]=i,t[8]=a,t[9]=o):o=t[9],o}function cN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=si(`-mx-1 my-1 h-px bg-border`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Sd,{"data-slot":`context-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var lN=`mr-1.5 flex size-5 shrink-0 cursor-pointer items-center justify-center rounded-sm text-muted-foreground outline-none transition hover:bg-foreground/10 hover:text-foreground hover:opacity-100 focus-visible:ring-2 focus-visible:ring-ring/50`,uN=`border-border bg-background text-foreground hover:bg-background focus-visible:bg-background`,dN={start:[Gi.Space],cancel:[Gi.Esc],end:[Gi.Space,Gi.Enter]};function fN(e){return si(lN,e?`opacity-100`:`pointer-events-none opacity-0 group-hover:pointer-events-auto group-hover:opacity-100`)}function pN(e){return e?void 0:-1}function mN({className:e,isDragging:t}){return si(e,t&&uN)}function hN(e){return e.code===Gi.Enter&&e.target===e.currentTarget}function gN({event:e,hasKeyboardActivation:t,isDragging:n}){return e.defaultPrevented?`ignore`:!n&&t&&hN(e)?`activate-tab`:`delegate-sortable`}function _N({activeWidth:e,isDragging:t,outerStyle:n,transform:r,transition:i}){let a=t&&e?e:void 0;return{...n,transform:Na.Transform.toString(r?{...r,scaleX:1,scaleY:1}:null),transition:i,flexBasis:a??n?.flexBasis,maxWidth:a??n?.maxWidth,minWidth:a??n?.minWidth,opacity:n?.opacity,width:a??n?.width,zIndex:t?20:n?.zIndex}}function vN(e){let t=e?.querySelectorAll(`[data-editor-tab-sortable]`)??[],n=1/0,r=-1/0;for(let e of t){let t=e.getBoundingClientRect();n=Math.min(n,t.left),r=Math.max(r,t.right)}return Number.isFinite(n)&&Number.isFinite(r)?{left:n,right:r}:null}function yN(e){return({activeNodeRect:t,transform:n})=>{let r={...n,y:0};if(!e||!t)return r;let i=e.left-t.left,a=e.right-t.right;return r.x=Math.min(Math.max(r.x,i),a),r}}var bN=e=>{let{droppableContainers:t,droppableRects:n,pointerCoordinates:r}=e;if(r){let e=1/0,i=-1/0,a=null,o=null;for(let r of t){let t=n.get(r.id);t&&(t.left<e&&(e=t.left,a=r),t.right>i&&(i=t.right,o=r))}if(!Number.isFinite(e)||!Number.isFinite(i))return[];let s=r.x<e?a:r.x>i?o:null;if(s)return[{id:s.id,data:{droppableContainer:s,value:0}}]}return Ca(e)},xN=[`.md`,`.mdx`],SN=`group relative -mb-px flex h-10 min-w-28 max-w-64 shrink-0 cursor-pointer items-center overflow-hidden border border-transparent font-medium transition-colors`,CN=`z-10 rounded-t-lg rounded-b-none border-border border-b-0 bg-background text-foreground`,wN=si(CN,`bg-transparent hover:bg-muted focus-visible:bg-muted border-transparent hover:border-border focus-visible:border-border`),TN=`flex h-full min-w-0 flex-1 cursor-pointer items-center overflow-hidden px-3 text-left text-[13px]`;function EN(e){return e.replace(/[^A-Za-z0-9_-]/g,`-`)}function DN(e){let t=Ho(e);window.location.hash!==t&&(window.location.hash=t)}function ON(e){Math.abs(e.deltaX)>=Math.abs(e.deltaY)||e.currentTarget.scrollWidth<=e.currentTarget.clientWidth||(e.preventDefault(),e.currentTarget.scrollLeft+=e.deltaY)}function kN(e,t){let n=[t,...xN].filter((e,t,n)=>e&&n.indexOf(e)===t),r=e.toLowerCase(),i=n.find(t=>e.length>t.length&&r.endsWith(t.toLowerCase()));return i?e.slice(0,-i.length):e}function AN(e){let t=(0,$.c)(37),n,r,i,a,o,s,c,l;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8]):({activateFromKeyboard:n,className:r,tabId:l,disabled:i,onKeyDown:a,ref:o,style:s,...c}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l);let u;t[9]!==i||t[10]!==l?(u={id:l,disabled:i},t[9]=i,t[10]=l,t[11]=u):u=t[11];let{attributes:d,listeners:f,rect:p,setNodeRef:m,transform:h,transition:g,isDragging:_}=zi(u),v=p.current?.width,y;t[12]!==_||t[13]!==s||t[14]!==v||t[15]!==h||t[16]!==g?(y=_N({activeWidth:v,isDragging:_,outerStyle:s,transform:h,transition:g}),t[12]=_,t[13]=s,t[14]=v,t[15]=h,t[16]=g,t[17]=y):y=t[17];let b=y,x;t[18]!==o||t[19]!==m?(x=function(e){m(e),typeof o==`function`?o(e):o&&`current`in o&&(o.current=e)},t[18]=o,t[19]=m,t[20]=x):x=t[20];let S=x,C=f?.onKeyDown,w;t[21]!==n||t[22]!==_||t[23]!==a||t[24]!==C?(w=function(e){a?.(e);let t=gN({event:e,hasKeyboardActivation:!!n,isDragging:_});if(t!==`ignore`){if(t===`activate-tab`&&n){e.preventDefault(),n();return}C?.(e)}},t[21]=n,t[22]=_,t[23]=a,t[24]=C,t[25]=w):w=t[25];let T=w,E;t[26]!==r||t[27]!==_?(E=mN({className:r,isDragging:_}),t[26]=r,t[27]=_,t[28]=E):E=t[28];let D;return t[29]!==d||t[30]!==S||t[31]!==T||t[32]!==f||t[33]!==c||t[34]!==b||t[35]!==E?(D=(0,Z.jsx)(`div`,{ref:S,"data-editor-tab-sortable":``,className:E,style:b,...c,...d,...f,onKeyDown:T}),t[29]=d,t[30]=S,t[31]=T,t[32]=f,t[33]=c,t[34]=b,t[35]=E,t[36]=D):D=t[36],D}function jN(e){let t=(0,$.c)(52),{children:n,closeTab:r,closeTabs:i,canPin:a,disabled:o,openTabs:c,pinTab:l,pinnedTabIds:u,tabId:d,unpinTab:f}=e,p=a===void 0?!0:a;if(o!==void 0&&o)return n;let m;t[0]!==p||t[1]!==u||t[2]!==d?(m=p&&u.includes(d),t[0]=p,t[1]=u,t[2]=d,t[3]=m):m=t[3];let h=m,g;if(t[4]!==c||t[5]!==u||t[6]!==d){let e;t[8]===d?e=t[9]:(e=e=>e!==d,t[8]=d,t[9]=e),g=Ye(c.filter(e),u),t[4]=c,t[5]=u,t[6]=d,t[7]=g}else g=t[7];let _=g,v;t[10]!==c||t[11]!==u?(v=Ye(c,u),t[10]=c,t[11]=u,t[12]=v):v=t[12];let y=v,b;t[13]===n?b=t[14]:(b=(0,Z.jsx)($M,{asChild:!0,children:n}),t[13]=n,t[14]=b);let x;t[15]!==r||t[16]!==d?(x=()=>r(d),t[15]=r,t[16]=d,t[17]=x):x=t[17];let S;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(s,{id:`yz7wBu`}),t[18]=S):S=t[18];let C;t[19]!==h||t[20]!==x?(C=(0,Z.jsx)(rN,{disabled:h,onSelect:x,children:S}),t[19]=h,t[20]=x,t[21]=C):C=t[21];let w=_.length===0,T;t[22]!==i||t[23]!==_?(T=()=>{i(_)},t[22]=i,t[23]=_,t[24]=T):T=t[24];let E;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Z.jsx)(s,{id:`omXJcU`}),t[25]=E):E=t[25];let D;t[26]!==w||t[27]!==T?(D=(0,Z.jsx)(rN,{disabled:w,onSelect:T,children:E}),t[26]=w,t[27]=T,t[28]=D):D=t[28];let O=y.length===0,k;t[29]!==y||t[30]!==i?(k=()=>{i(y)},t[29]=y,t[30]=i,t[31]=k):k=t[31];let A;t[32]===u.length?A=t[33]:(A=u.length?(0,Z.jsx)(s,{id:`U2Kx6T`}):(0,Z.jsx)(s,{id:`WyXG7w`}),t[32]=u.length,t[33]=A);let j;t[34]!==O||t[35]!==k||t[36]!==A?(j=(0,Z.jsx)(rN,{disabled:O,"data-testid":`editor-tab-context-close-all`,onSelect:k,children:A}),t[34]=O,t[35]=k,t[36]=A,t[37]=j):j=t[37];let M;t[38]!==p||t[39]!==h||t[40]!==l||t[41]!==d||t[42]!==f?(M=p&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(cN,{}),(0,Z.jsx)(rN,{"data-testid":`editor-tab-context-pin-toggle`,onSelect:()=>h?f(d):l(d),children:h?(0,Z.jsx)(s,{id:`SYfHmN`}):(0,Z.jsx)(s,{id:`3pU8e-`})})]}),t[38]=p,t[39]=h,t[40]=l,t[41]=d,t[42]=f,t[43]=M):M=t[43];let N;t[44]!==D||t[45]!==j||t[46]!==M||t[47]!==C?(N=(0,Z.jsxs)(nN,{className:`min-w-40`,children:[C,D,j,M]}),t[44]=D,t[45]=j,t[46]=M,t[47]=C,t[48]=N):N=t[48];let P;return t[49]!==N||t[50]!==b?(P=(0,Z.jsxs)(QM,{children:[b,N]}),t[49]=N,t[50]=b,t[51]=P):P=t[51],P}function MN(e){let t=(0,$.c)(26),{accessibleLabel:n,closeTab:r,isActive:a,isPinned:o,tabId:s,unpinTab:c}=e,{_:l}=i();if(o){let e;t[0]!==l||t[1]!==n?(e=l({id:`t18QYR`,values:{accessibleLabel:n}}),t[0]=l,t[1]=n,t[2]=e):e=t[2];let r;t[3]!==s||t[4]!==c?(r=e=>{e.stopPropagation(),c(s)},t[3]=s,t[4]=c,t[5]=r):r=t[5];let i;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(Gl,{"aria-hidden":`true`}),t[6]=i):i=t[6];let a;return t[7]!==e||t[8]!==r?(a=(0,Z.jsx)(li,{variant:`ghost`,size:`icon-xs`,type:`button`,"aria-label":e,"data-testid":`editor-tab-unpin-button`,className:`mr-1.5 text-primary! hover:bg-primary/10!`,onClick:r,children:i}),t[7]=e,t[8]=r,t[9]=a):a=t[9],a}let u;t[10]!==l||t[11]!==n?(u=l({id:`JLzQi_`,values:{accessibleLabel:n}}),t[10]=l,t[11]=n,t[12]=u):u=t[12];let d;t[13]===a?d=t[14]:(d=fN(a),t[13]=a,t[14]=d);let f;t[15]===a?f=t[16]:(f=pN(a),t[15]=a,t[16]=f);let p;t[17]!==r||t[18]!==s?(p=e=>{e.stopPropagation(),r(s)},t[17]=r,t[18]=s,t[19]=p):p=t[19];let m;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(gs,{"aria-hidden":`true`}),t[20]=m):m=t[20];let h;return t[21]!==u||t[22]!==d||t[23]!==f||t[24]!==p?(h=(0,Z.jsx)(li,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":u,"data-testid":`editor-tab-close-button`,className:d,tabIndex:f,onClick:p,children:m}),t[21]=u,t[22]=d,t[23]=f,t[24]=p,t[25]=h):h=t[25],h}function NN(e){let t=(0,$.c)(1),{docName:n}=e;if(hw(n)!==`conflict`)return null;let r;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(Ro,{"aria-label":`Conflict`,"data-testid":`editor-tab-conflict-badge`,className:`mr-1 size-3.5 shrink-0 text-amber-500`}),t[0]=r):r=t[0],r}function PN(){let e=(0,$.c)(80),{activeDocName:t,activeTabId:n,activeNewTabId:r,activeTarget:a,activateTab:o,activateNewTab:c,closeAndClearForRename:l,closeNewTab:u,closeTab:d,closeTabs:f,getPoolActiveDocName:p,poolHas:m,isNewTabActive:h,newTabIds:g,openNewTab:_,openTabs:v,pinTab:y,pinnedTabIds:b,remapTabsForRename:x,reorderTabs:S,unpinTab:C,visibleTabIds:w}=ht(),{_:T}=i(),{pageMeta:E}=is(),D=(0,Q.useRef)(null),[O,k]=(0,Q.useState)(null),[j,M]=(0,Q.useState)(null),[N,P]=(0,Q.useState)(``),[F,I]=(0,Q.useState)(null),[L,R]=(0,Q.useState)(!1),z=(0,Q.useRef)(null),B=(0,Q.useRef)(!1),H=(0,Q.useRef)(!1),U=(0,Q.useRef)(null),W=(0,Q.useRef)(t),G;e[0]!==n||e[1]!==t||e[2]!==a?(G=n??(a?Ze(a):t?Ue(t):null),e[0]=n,e[1]=t,e[2]=a,e[3]=G):G=e[3];let K=G,q;e[4]!==r||e[5]!==K||e[6]!==h||e[7]!==g||e[8]!==v?(q=h?`${r??`__new-tab__`}\u0000${v.join(`\0`)}\u0000${g.join(`\0`)}`:K?`${K}\u0000${v.join(`\0`)}`:``,e[4]=r,e[5]=K,e[6]=h,e[7]=g,e[8]=v,e[9]=q):q=e[9];let J=q,ee,te;e[10]===t?(ee=e[11],te=e[12]):(ee=()=>{W.current=t},te=[t],e[10]=t,e[11]=ee,e[12]=te),(0,Q.useEffect)(ee,te);let ne,re;e[13]===J?(ne=e[14],re=e[15]):(ne=()=>{J&&(D.current?.querySelector(`[data-active-tab="true"]`))?.scrollIntoView({block:`nearest`,inline:`nearest`})},re=[J],e[13]=J,e[14]=ne,e[15]=re),(0,Q.useEffect)(ne,re);let Y,ie;e[16]===j?(Y=e[17],ie=e[18]):(Y=()=>{j&&(z.current?.focus(),z.current?.select())},ie=[j],e[16]=j,e[17]=Y,e[18]=ie),(0,Q.useEffect)(Y,ie);let ae,oe;e[19]!==v||e[20]!==j?(ae=()=>{!j||v.includes(j.tabId)||(H.current=!0,U.current=null,M(null),P(``),I(null),R(!1))},oe=[v,j],e[19]=v,e[20]=j,e[21]=ae,e[22]=oe):(ae=e[21],oe=e[22]),(0,Q.useEffect)(ae,oe);let se=function(e,t){let n=t.split(`/`);H.current=!1,U.current=null,M({docName:t,tabId:e}),P(n[n.length-1]),I(null)},ce=function(){H.current=!0,U.current=null,M(null),P(``),I(null),R(!1)},le=async function(){if(H.current){H.current=!1;return}if(B.current)return;let e=j?.docName;if(!e){ce();return}let t=LM(`file`,kN(N,E.get(e)?.docExt??`.md`)),n=e.split(`/`),r=n[n.length-1];if(t===r){ce();return}if(t===U.current){z.current?.focus();return}if(!RM(t)){I(T({id:`P8yDjG`})),z.current?.focus();return}let i=zM({kind:`file`,path:e,name:r},t);B.current=!0,R(!0),I(null);try{let n=await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:`file`,fromPath:e,toPath:i})});if(H.current){R(!1),B.current=!1;return}let r=await ve(n,`Server error (HTTP ${n.status})`);if(!r.ok){I(r.title),R(!1),B.current=!1,U.current=t,z.current?.focus();return}let a=A(Qr,r.body,`rename-path:tab`,{renamed:[],renamedAssets:[]}).renamed,o=W.current,s=WM(o,a);Vt(a);let c=!0;try{let e=GM(a,p(),m);await Promise.all(e.map(e=>l(e))),x(a),cs([`files`,`backlinks`,`graph`])}catch(n){let r=n;c=!1,console.warn(`[EditorTabs] post-rename reconciliation failed`,{err:r,docName:e,newDocName:i,normalized:t}),X.error(T({id:`MUBR8r`}))}H.current=!0,M(null),P(``),I(null),R(!1),B.current=!1,U.current=null,c&&s&&s!==o&&DN(s)}catch(n){console.warn(`[EditorTabs] rename failed`,{err:n,docName:e,newDocName:i,normalized:t}),I(T({id:`HIb0vl`})),R(!1),B.current=!1,U.current=t,z.current?.focus()}},ue=typeof window<`u`&&window.okDesktop!=null,de;e[23]===g?de=e[24]:(de=new Set(g),e[23]=g,e[24]=de);let fe=de,pe;e[25]===O?pe=e[26]:(pe=yN(O),e[25]=O,e[26]=pe);let me;e[27]===pe?me=e[28]:(me=[pe],e[27]=pe,e[28]=me);let he=me,ge;e[29]!==u||e[30]!==f||e[31]!==fe?(ge=function(e){let t=[],n=[];for(let r of e)fe.has(r)?n.push(r):t.push(r);t.length>0&&f(t);for(let e of n)u(e)},e[29]=u,e[30]=f,e[31]=fe,e[32]=ge):ge=e[32];let _e=ge,ye;e[33]===Symbol.for(`react.memo_cache_sentinel`)?(ye={activationConstraint:{distance:8}},e[33]=ye):ye=e[33];let be;e[34]===Symbol.for(`react.memo_cache_sentinel`)?(be={coordinateGetter:_a,keyboardCodes:dN},e[34]=be):be=e[34];let xe=Ti(aa(ya,ye),aa(xa,be)),Se;e[35]===Symbol.for(`react.memo_cache_sentinel`)?(Se=function(){k(vN(D.current))},e[35]=Se):Se=e[35];let Ce=Se,we;e[36]===Symbol.for(`react.memo_cache_sentinel`)?(we=function(){k(null)},e[36]=we):we=e[36];let Te=we,Ee;e[37]!==Te||e[38]!==S||e[39]!==w?(Ee=function(e){Te();let t=String(e.active.id),n=e.over?String(e.over.id):null;if(!n||t===n)return;let r=w.indexOf(t),i=w.indexOf(n);r<0||i<0||r===i||S(Vi([...w],r,i),t)},e[37]=Te,e[38]=S,e[39]=w,e[40]=Ee):Ee=e[40];let De=Ee,Oe=ue?``:void 0,ke;e[41]===Symbol.for(`react.memo_cache_sentinel`)?(ke=si(`pl-2 flex h-12 min-w-0 touch-manipulation flex-1 items-end overflow-x-auto overflow-y-hidden overscroll-x-contain scroll-fade-mask-x [scrollbar-width:none]`,ue&&`[-webkit-app-region:drag]`),e[41]=ke):ke=e[41];let Ae=ON,je;e[42]===Symbol.for(`react.memo_cache_sentinel`)?(je=si(`flex items-end gap-1`,ue&&`[-webkit-app-region:no-drag]`),e[42]=je):je=e[42];let Ne=Qa,Pe=bN,Fe;e[43]===Symbol.for(`react.memo_cache_sentinel`)?(Fe={container:typeof document<`u`?document.body:void 0},e[43]=Fe):Fe=e[43];let Ie=ha,Le;e[44]===w?Le=e[45]:(Le=[...w],e[44]=w,e[45]=Le);let Re=pa,ze=w.map(e=>{if(fe.has(e)){let t=e===r;return(0,Z.jsx)(jN,{tabId:e,canPin:!1,openTabs:w,closeTab:u,closeTabs:_e,pinTab:y,pinnedTabIds:b,unpinTab:C,children:(0,Z.jsxs)(AN,{tabId:e,activateFromKeyboard:()=>c(e),"aria-current":t?`page`:void 0,"data-active-tab":t?`true`:void 0,className:si(SN,t?CN:wN),onAuxClick:t=>{t.button===1&&(t.preventDefault(),u(e))},onClick:t=>{t.target===t.currentTarget&&c(e)},children:[(0,Z.jsx)(`button`,{type:`button`,"aria-label":T({id:`zLak8b`}),"data-testid":`editor-new-tab-placeholder-button`,className:TN,onClick:()=>c(e),tabIndex:-1,children:(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:(0,Z.jsx)(s,{id:`3YvS-c`})})}),(0,Z.jsx)(`button`,{type:`button`,"aria-label":T({id:`xCdTnb`}),"data-testid":`editor-new-tab-placeholder-close`,className:fN(t),tabIndex:pN(t),onClick:t=>{t.stopPropagation(),u(e)},children:(0,Z.jsx)(gs,{"aria-hidden":`true`,className:`size-3.5`})})]})},e)}let t=mt(e),n=e===K,i=b.includes(e);if(t.kind===`folder`){let{baseName:r,label:a,prefix:s}=Me(t.folderPath,`/`),c=`${s}${a}`;return(0,Z.jsx)(jN,{tabId:e,openTabs:w,closeTab:d,closeTabs:_e,pinTab:y,pinnedTabIds:b,unpinTab:C,children:(0,Z.jsxs)(AN,{tabId:e,activateFromKeyboard:()=>o(e),"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:si(SN,n?CN:wN),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&d(e))},onClick:t=>{t.target===t.currentTarget&&o(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":c,title:c,className:TN,onClick:()=>{o(e)},tabIndex:-1,children:[s&&(0,Z.jsx)(`span`,{className:si(`min-w-0 flex-1 truncate`,n&&`text-muted-foreground`),children:s}),(0,Z.jsxs)(`span`,{className:si(`flex min-w-0 items-center`,s?`max-w-[70%] shrink-0`:`flex-1`),children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:r}),(0,Z.jsx)(`span`,{className:`shrink-0`,children:`/`})]})]}),(0,Z.jsx)(MN,{accessibleLabel:c,closeTab:d,isActive:n,isPinned:i,tabId:e,unpinTab:C})]})},e)}if(t.kind===`asset`){let{baseName:r,label:a,prefix:s}=Me(t.assetPath,``),c=`${s}${a}`;return(0,Z.jsx)(jN,{tabId:e,openTabs:w,closeTab:d,closeTabs:_e,pinTab:y,pinnedTabIds:b,unpinTab:C,children:(0,Z.jsxs)(AN,{tabId:e,activateFromKeyboard:()=>o(e),"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:si(SN,n?CN:wN),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&d(e))},onClick:t=>{t.target===t.currentTarget&&o(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":c,className:TN,onClick:()=>{o(e)},tabIndex:-1,children:[s?(0,Z.jsx)(`span`,{className:si(`min-w-0 flex-1 truncate text-muted-foreground/60`,n&&`text-muted-foreground`),children:s}):null,(0,Z.jsx)(`span`,{className:si(`min-w-0 truncate`,s?`max-w-[70%] shrink-0`:`flex-1`),children:r})]}),(0,Z.jsx)(MN,{accessibleLabel:c,closeTab:d,isActive:n,isPinned:i,tabId:e,unpinTab:C})]})},e)}let a=t.docName,l=E.get(a)?.docExt??`.md`,{baseName:f,extension:p,label:m,prefix:h}=Me(a,l),g=`${h}${m}`,_=l===`.md`||l===`.mdx`,v=j?.tabId===e,x=`editor-tab-rename-error-${EN(a)}`;return(0,Z.jsx)(jN,{disabled:v,tabId:e,openTabs:w,closeTab:d,closeTabs:_e,pinTab:y,pinnedTabIds:b,unpinTab:C,children:(0,Z.jsx)(AN,{tabId:e,activateFromKeyboard:()=>o(e),disabled:v,"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:si(SN,n?CN:wN,v&&F&&`border-destructive`),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&d(e))},onClick:t=>{t.target===t.currentTarget&&o(e)},children:v?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(KC,{className:`h-full min-w-0 flex-1 rounded-none border-0 bg-transparent dark:bg-transparent`,children:[(0,Z.jsx)(ZC,{ref:z,value:N,disabled:L,"aria-label":T({id:`Dw1T_W`,values:{label:m}}),"data-testid":`editor-tab-rename-input`,"aria-invalid":F?!0:void 0,"aria-describedby":F?x:void 0,"aria-busy":L||void 0,title:F??a,className:`h-full min-w-0 px-2 py-0 font-medium text-foreground text-xs selection:bg-primary selection:text-primary-foreground`,onChange:e=>{P(kN(e.target.value,l)),I(null),U.current=null},onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),le()):e.key===`Escape`&&(e.preventDefault(),ce())},onBlur:le}),(0,Z.jsx)(JC,{align:`inline-end`,"aria-hidden":`true`,className:`pr-2 text-xs`,children:(0,Z.jsx)(XC,{className:`text-muted-foreground/60 text-xs`,children:l})})]}),F?(0,Z.jsx)(`span`,{id:x,role:`alert`,className:`sr-only`,children:F}):null]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":g,title:g,className:TN,onClick:()=>{o(e)},onDoubleClick:t=>{t.preventDefault(),t.stopPropagation(),se(e,a)},tabIndex:-1,children:[(0,Z.jsx)(NN,{docName:a}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:f}),!_&&(0,Z.jsx)(`span`,{className:`shrink-0`,children:p})]})]}),(0,Z.jsx)(MN,{accessibleLabel:g,closeTab:d,isActive:n,isPinned:i,tabId:e,unpinTab:C})]})})},e)}),Be;e[46]!==Ie||e[47]!==Le||e[48]!==Re||e[49]!==ze?(Be=(0,Z.jsx)(Ie,{items:Le,strategy:Re,children:ze}),e[46]=Ie,e[47]=Le,e[48]=Re,e[49]=ze,e[50]=Be):Be=e[50];let Ve;e[51]!==Ne||e[52]!==Te||e[53]!==De||e[54]!==Ce||e[55]!==xe||e[56]!==!1||e[57]!==Pe||e[58]!==Fe||e[59]!==Be||e[60]!==he?(Ve=(0,Z.jsx)(Ne,{sensors:xe,autoScroll:!1,collisionDetection:Pe,modifiers:he,onDragStart:Ce,onDragEnd:De,onDragCancel:Te,accessibility:Fe,children:Be}),e[51]=Ne,e[52]=Te,e[53]=De,e[54]=Ce,e[55]=xe,e[56]=!1,e[57]=Pe,e[58]=Fe,e[59]=Be,e[60]=he,e[61]=Ve):Ve=e[61];let He;e[62]===T?He=e[63]:(He=T({id:`3YvS-c`}),e[62]=T,e[63]=He);let We;e[64]===Symbol.for(`react.memo_cache_sentinel`)?(We=(0,Z.jsx)(V,{"aria-hidden":`true`}),e[64]=We):We=e[64];let Ge;e[65]!==_||e[66]!==He?(Ge=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(li,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":He,"data-testid":`editor-new-tab-button`,className:`first:mb-3 mb-1.5`,onClick:_,children:We})}),e[65]=_,e[66]=He,e[67]=Ge):Ge=e[67];let Ke;e[68]===Symbol.for(`react.memo_cache_sentinel`)?(Ke=(0,Z.jsx)(Ns,{children:(0,Z.jsx)(s,{id:`3YvS-c`})}),e[68]=Ke):Ke=e[68];let qe;e[69]===Ge?qe=e[70]:(qe=(0,Z.jsxs)(Is,{children:[Ge,Ke]}),e[69]=Ge,e[70]=qe);let Je;e[71]!==je||e[72]!==Ve||e[73]!==qe?(Je=(0,Z.jsxs)(`div`,{className:je,children:[Ve,qe]}),e[71]=je,e[72]=Ve,e[73]=qe,e[74]=Je):Je=e[74];let Ye;return e[75]!==Oe||e[76]!==ke||e[77]!==Ae||e[78]!==Je?(Ye=(0,Z.jsx)(`div`,{ref:D,"data-electron-drag":Oe,className:ke,onWheel:Ae,children:Je}),e[75]=Oe,e[76]=ke,e[77]=Ae,e[78]=Je,e[79]=Ye):Ye=e[79],Ye}function FN(e){let t=(0,$.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`Discord`}),r=(0,Z.jsx)(`path`,{d:`M20.317 4.3698a19.7913 19.7913 0 00-4.8851-1.5152.0741.0741 0 00-.0785.0371c-.211.3753-.4447.8648-.6083 1.2495-1.8447-.2762-3.68-.2762-5.4868 0-.1636-.3933-.4058-.8742-.6177-1.2495a.077.077 0 00-.0785-.037 19.7363 19.7363 0 00-4.8852 1.515.0699.0699 0 00-.0321.0277C.5334 9.0458-.319 13.5799.0992 18.0578a.0824.0824 0 00.0312.0561c2.0528 1.5076 4.0413 2.4228 5.9929 3.0294a.0777.0777 0 00.0842-.0276c.4616-.6304.8731-1.2952 1.226-1.9942a.076.076 0 00-.0416-.1057c-.6528-.2476-1.2743-.5495-1.8722-.8923a.077.077 0 01-.0076-.1277c.1258-.0943.2517-.1923.3718-.2914a.0743.0743 0 01.0776-.0105c3.9278 1.7933 8.18 1.7933 12.0614 0a.0739.0739 0 01.0785.0095c.1202.099.246.1981.3728.2924a.077.077 0 01-.0066.1276 12.2986 12.2986 0 01-1.873.8914.0766.0766 0 00-.0407.1067c.3604.698.7719 1.3628 1.225 1.9932a.076.076 0 00.0842.0286c1.961-.6067 3.9495-1.5219 6.0023-3.0294a.077.077 0 00.0313-.0552c.5004-5.177-.8382-9.6739-3.5485-13.6604a.061.061 0 00-.0312-.0286zM8.02 15.3312c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9555-2.4189 2.157-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9555 2.4189-2.1569 2.4189zm7.9748 0c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9554-2.4189 2.1569-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9554 2.4189-2.1568 2.4189Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,Z.jsxs)(`svg`,{role:`img`,fill:`currentColor`,height:24,width:24,viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[n,r]}),t[2]=e,t[3]=i),i}function IN(e){let t=(0,$.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`X (Twitter)`}),r=(0,Z.jsx)(`path`,{d:`M18.901 1.153h3.68l-8.04 9.19L24 22.846h-7.406l-5.8-7.584-6.638 7.584H.474l8.6-9.83L0 1.154h7.594l5.243 6.932ZM17.61 20.644h2.039L6.486 3.24H4.298Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,Z.jsxs)(`svg`,{role:`img`,fill:`currentColor`,height:24,width:24,viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[n,r]}),t[2]=e,t[3]=i),i}var LN=[{label:{id:`TvY_XA`},href:`https://openknowledge.ai/docs`,icon:Ct},{label:`GitHub`,href:`https://github.com/inkeep/open-knowledge`,icon:wf},{label:{id:`On0aF2`},href:`https://openknowledge.ai/`,icon:$o},{label:`Discord`,href:`https://discord.com/invite/YujKpFN49`,icon:FN},{label:`Twitter`,href:`https://x.com/inkeep`,icon:IN}],RN=()=>{let e=(0,$.c)(16),{_:t}=i(),[n,r]=(0,Q.useState)(!1),a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(ze,{className:`size-4`}),e[0]=a):a=e[0];let o;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(J,{asChild:!0,children:(0,Z.jsxs)(li,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,children:[a,(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`s-MGs7`})})]})})}),e[1]=o):o=e[1];let c;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsxs)(Is,{children:[o,(0,Z.jsx)(Ns,{children:(0,Z.jsx)(s,{id:`s-MGs7`})})]}),e[2]=c):c=e[2];let l;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(`p`,{className:`font-mono tracking-wide uppercase text-muted-foreground text-xs mb-1`,children:(0,Z.jsx)(s,{id:`s-MGs7`})}),e[3]=l):l=e[3];let u;e[4]===t?u=e[5]:(u=t({id:`s-MGs7`}),e[4]=t,e[5]=u);let d;e[6]===t?d=e[7]:(d=LN.map(e=>{let{label:n,href:r,icon:i}=e;return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`a`,{href:r,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>wa(e,r),onAuxClick:e=>wa(e,r),className:`flex items-center gap-2.5 rounded-md px-2 py-1.5 text-sm text-muted-foreground transition-colors hover:bg-azure-900/5 dark:hover:bg-white/20 hover:text-primary`,children:[(0,Z.jsx)(i,{"aria-hidden":`true`,className:`size-4 shrink-0`}),typeof n==`string`?n:t(n)]})},r)}),e[6]=t,e[7]=d);let f;e[8]===d?f=e[9]:(f=(0,Z.jsx)(`ul`,{className:`space-y-0.5`,children:d}),e[8]=d,e[9]=f);let p;e[10]!==u||e[11]!==f?(p=(0,Z.jsxs)(b,{align:`end`,className:`w-64 p-3`,children:[l,(0,Z.jsx)(`nav`,{"aria-label":u,children:f})]}),e[10]=u,e[11]=f,e[12]=p):p=e[12];let m;return e[13]!==n||e[14]!==p?(m=(0,Z.jsxs)(pe,{open:n,onOpenChange:r,children:[c,p]}),e[13]=n,e[14]=p,e[15]=m):m=e[15],m};function zN(e){let t=(0,$.c)(19),{installStates:n,terminalLaunch:r,disabled:a,onPick:o,onLaunchTerminal:c}=e,{_:l}=i(),[u,d]=(0,Q.useState)(``),f;if(t[0]!==l||t[1]!==a||t[2]!==n||t[3]!==u||t[4]!==c||t[5]!==o||t[6]!==r){let e;t[8]===n?e=t[9]:(e=e=>n[e.id]?.installed===!0,t[8]=n,t[9]=e);let i=gg.filter(e),p=gg.some(e=>n[e.id]?.installed==null),m=i.length>0,h=r!==null,g=m||h,_;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(_=e=>d(e.target.value),t[10]=_):_=t[10];let v;t[11]===l?v=t[12]:(v=l({id:`Rah7yq`}),t[11]=l,t[12]=v);let y;t[13]===l?y=t[14]:(y=l({id:`ZBt4rI`}),t[13]=l,t[14]=y);let b;t[15]!==u||t[16]!==v||t[17]!==y?(b=(0,Z.jsx)(Mo,{value:u,onChange:_,placeholder:v,"aria-label":y,"data-testid":`open-in-agent-instruction`}),t[15]=u,t[16]=v,t[17]=y,t[18]=b):b=t[18],f=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[b,g?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[m?(0,Z.jsxs)(`fieldset`,{className:`m-0 flex min-w-0 flex-col gap-0.5 border-0 p-0`,children:[(0,Z.jsx)(`legend`,{className:`text-muted-foreground text-xs`,"data-testid":`open-in-agent-desktop-label`,children:(0,Z.jsx)(s,{id:`BBqGS9`})}),i.map(e=>{let{displayName:t}=e;return(0,Z.jsxs)(li,{type:`button`,variant:`ghost`,className:`w-full justify-start gap-2`,disabled:a,"data-testid":`open-in-agent-item-${e.id}`,"aria-label":l({id:`WqLq6M`,values:{displayName:t}}),onClick:()=>o(e,u),children:[(0,Z.jsx)(Vx,{id:e.id,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:t})]},e.id)})]}):null,h?(0,Z.jsxs)(Z.Fragment,{children:[m?(0,Z.jsx)(Pi,{className:`my-1`}):null,(0,Z.jsxs)(`fieldset`,{className:`m-0 flex min-w-0 flex-col gap-0.5 border-0 p-0`,children:[(0,Z.jsx)(`legend`,{className:`text-muted-foreground text-xs`,"data-testid":`open-in-agent-terminal-label`,children:(0,Z.jsx)(s,{id:`ALhMYW`})}),(0,Z.jsxs)(li,{type:`button`,variant:`ghost`,className:`w-full justify-start gap-2`,disabled:a,"data-testid":`open-in-agent-terminal`,"aria-label":l({id:`AcK_r0`}),onClick:()=>c(u),children:[(0,Z.jsx)(ru,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`fcgvCA`})})]})]})]}):null]}):(0,Z.jsx)(`p`,{className:`text-muted-foreground text-sm`,"data-testid":`open-in-agent-empty`,"aria-live":`polite`,children:p?(0,Z.jsx)(s,{id:`EcR0fl`}):(0,Z.jsx)(s,{id:`l6OXqI`})})]}),t[0]=l,t[1]=a,t[2]=n,t[3]=u,t[4]=c,t[5]=o,t[6]=r,t[7]=f}else f=t[7];return f}function BN(e){let t=(0,$.c)(44),{input:n,open:r,onOpenChange:a}=e,{_:o}=i(),{states:c,refresh:l}=D_(),{dispatch:u}=g_(),d=Wx(),[f,p]=(0,Q.useState)(!1),m=(0,Q.useRef)(!1),h=pg(),g=r??f,_;t[0]===l?_=t[1]:(_=()=>{l()},t[0]=l,t[1]=_);let v=(0,Q.useEffectEvent)(_),y;t[2]!==g||t[3]!==v?(y=()=>{g&&v()},t[2]=g,t[3]=v,t[4]=y):y=t[4];let x;if(t[5]===g?x=t[6]:(x=[g],t[5]=g,t[6]=x),(0,Q.useEffect)(y,x),h)return null;let S=typeof window<`u`&&window.okDesktop!=null,C;t[7]!==a||t[8]!==r?(C=e=>{r===void 0&&p(e),a?.(e)},t[7]=a,t[8]=r,t[9]=C):C=t[9];let w=C,T=n===null,E;t[10]===n?E=t[11]:(E=e=>{if(n===null)return null;let t=e.trim();return t?{...n,instruction:t}:n},t[10]=n,t[11]=E);let D=E,O;t[12]!==u||t[13]!==w||t[14]!==D?(O=(e,t)=>{let n=D(t);n!==null&&(u(e.id,n),w(!1))},t[12]=u,t[13]=w,t[14]=D,t[15]=O):O=t[15];let k=O,A;t[16]!==w||t[17]!==D||t[18]!==d?(A=e=>{let t=D(e);t===null||d===null||(d.launchInTerminal(t),w(!1))},t[16]=w,t[17]=D,t[18]=d,t[19]=A):A=t[19];let j=A,M;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(M=S?()=>{m.current=!0}:void 0,t[20]=M):M=t[20];let N;t[21]===w?N=t[22]:(N=S?()=>{if(m.current){m.current=!1;return}w(!0)}:void 0,t[21]=w,t[22]=N);let P,F;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(bi,{className:`size-3.5`,"aria-hidden":`true`}),F=(0,Z.jsx)(s,{id:`O7_W_a`}),t[23]=P,t[24]=F):(P=t[23],F=t[24]);let I;t[25]!==N||t[26]!==T?(I=(0,Z.jsx)(J,{asChild:!0,children:(0,Z.jsxs)(li,{variant:`ghost`,size:`sm`,disabled:T,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`open-in-agent-trigger`,onPointerDown:M,onClick:N,children:[P,F]})}),t[25]=N,t[26]=T,t[27]=I):I=t[27];let L;t[28]===o?L=t[29]:(L=o({id:`O7_W_a`}),t[28]=o,t[29]=L);let R=n===null,z;t[30]!==j||t[31]!==k||t[32]!==c||t[33]!==R||t[34]!==d?(z=(0,Z.jsx)(zN,{installStates:c,terminalLaunch:d,disabled:R,onPick:k,onLaunchTerminal:j}),t[30]=j,t[31]=k,t[32]=c,t[33]=R,t[34]=d,t[35]=z):z=t[35];let B;t[36]!==L||t[37]!==z?(B=(0,Z.jsx)(b,{align:`end`,"aria-label":L,"data-testid":`open-in-agent-menu`,children:z}),t[36]=L,t[37]=z,t[38]=B):B=t[38];let V;return t[39]!==w||t[40]!==g||t[41]!==I||t[42]!==B?(V=(0,Z.jsxs)(pe,{open:g,onOpenChange:w,children:[I,B]}),t[39]=w,t[40]=g,t[41]=I,t[42]=B,t[43]=V):V=t[43],V}var VN=50,HN=()=>{let e=(0,$.c)(8),t=(0,Q.useRef)(null),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=()=>{t.current===null&&(t.current=setTimeout(()=>{t.current=null,jC.preload()},VN))},e[0]=n):n=e[0];let r=n,i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{t.current!==null&&(clearTimeout(t.current),t.current=null)},e[1]=i):i=e[1];let a=i,o,c;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>()=>{t.current!==null&&clearTimeout(t.current)},c=[],e[2]=o,e[3]=c):(o=e[2],c=e[3]),(0,Q.useEffect)(o,c);let l,u;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>{a(),window.location.hash!==`#settings`&&(window.location.hash=Sg)},u=(0,Z.jsx)(Zl,{className:`size-4`}),e[4]=l,e[5]=u):(l=e[4],u=e[5]);let d;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsxs)(li,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,"data-testid":`header-settings-button`,onMouseEnter:r,onMouseLeave:a,onFocus:r,onBlur:a,onClick:l,children:[u,(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`Tz0i8g`})})]})}),e[6]=d):d=e[6];let f;return e[7]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsxs)(Is,{children:[d,(0,Z.jsx)(Ns,{children:(0,Z.jsx)(s,{id:`Tz0i8g`})})]}),e[7]=f):f=e[7],f};function UN(e){let t=(0,$.c)(30),{input:n,onClickWhenNoRemote:r}=e,{_:a}=i(),{status:o}=go(),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(null),f=(0,Q.useRef)(null),p,m;t[0]===u?(p=t[1],m=t[2]):(p=()=>{!u||!f.current||(f.current.focus(),f.current.select())},m=[u],t[0]=u,t[1]=p,t[2]=m),(0,Q.useEffect)(p,m);let h=o?.hasRemote===!0,g=n===null,_;t[3]!==a||t[4]!==c||t[5]!==h||t[6]!==n||t[7]!==r?(_=async function(){if(!c&&n!==null){l(!0),d(null);try{let e=await la({...n,hasRemote:h,onClickWhenNoRemote:r},{clipboardWrite:Pa,toastSuccess:YN,toastError:JN,logEvent:qN});e.kind===`clipboard-failed`&&d(e.shareUrl)}catch{X.error(a({id:`u3YnKw`}))}l(!1)}},t[3]=a,t[4]=c,t[5]=h,t[6]=n,t[7]=r,t[8]=_):_=t[8];let v=_,y=u!==null,x;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(x=e=>{e||d(null)},t[9]=x):x=t[9];let C;t[10]!==a||t[11]!==n?.kind?(C=n?.kind===`folder`?a({id:`WR0y2O`}):a({id:`F4IYWe`}),t[10]=a,t[11]=n?.kind,t[12]=C):C=t[12];let w=c||g,T,E;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(Ql,{className:`size-3.5`,"aria-hidden":!0}),E=(0,Z.jsx)(s,{id:`Z8lGw6`}),t[13]=T,t[14]=E):(T=t[13],E=t[14]);let D;t[15]!==v||t[16]!==C||t[17]!==w?(D=(0,Z.jsx)(S,{asChild:!0,children:(0,Z.jsxs)(li,{variant:`ghost`,size:`sm`,"aria-label":C,onClick:v,disabled:w,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`share-button`,children:[T,E]})}),t[15]=v,t[16]=C,t[17]=w,t[18]=D):D=t[18];let O;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:(0,Z.jsx)(s,{id:`I1m158`})}),t[19]=O):O=t[19];let k;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(s,{id:`ndeI89`})}),t[20]=k):k=t[20];let A=u??``,j;t[21]===a?j=t[22]:(j=a({id:`5-FeN2`}),t[21]=a,t[22]=j);let M;t[23]!==A||t[24]!==j?(M=(0,Z.jsxs)(b,{className:`flex w-80 flex-col gap-2`,"data-testid":`share-button-fallback-popover`,children:[O,k,(0,Z.jsx)(Mo,{ref:f,readOnly:!0,value:A,onFocus:KN,onClick:GN,onContextMenu:WN,className:`font-mono text-xs`,"data-testid":`share-button-fallback-url`,"aria-label":j})]}),t[23]=A,t[24]=j,t[25]=M):M=t[25];let N;return t[26]!==D||t[27]!==M||t[28]!==y?(N=(0,Z.jsxs)(pe,{open:y,onOpenChange:x,children:[D,M]}),t[26]=D,t[27]=M,t[28]=y,t[29]=N):N=t[29],N}function WN(e){return e.currentTarget.select()}function GN(e){return e.currentTarget.select()}function KN(e){return e.currentTarget.select()}function qN(e){return console.log(e)}function JN(e){e!==`Link ready but could not copy to clipboard.`&&X.error(e)}function YN(e){return X.success(e)}function XN(e){let t=(0,$.c)(45),{onSignIn:n,onSetIdentity:r,onOpenSearch:a,openInAgentMenuOpen:o,openInAgentMenuInput:c,onOpenInAgentMenuOpenChange:l}=e,{_:u}=i(),{activeDocName:d,activeTarget:f}=ht(),{state:p,isDraggingRail:m}=fA(),h=xg(),g;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(g=tc(`toggle-files-sidebar`),t[0]=g):g=t[0];let _=g,v=tc(`command-palette`),y=ka(),[b,x]=(0,Q.useState)(!1),S;bb0:{if(f===null){let e;t[1]===y?e=t[2]:(e=e_({workspace:y}),t[1]=y,t[2]=e),S=e;break bb0}if(f.kind===`folder`){if(!y){S=null;break bb0}let e;t[3]!==f.folderPath||t[4]!==y?(e=r_({folderRelativePath:f.folderPath,workspace:y}),t[3]=f.folderPath,t[4]=y,t[5]=e):e=t[5],S=e;break bb0}let e;t[6]!==d||t[7]!==y?(e=$g({docName:d,workspace:y}),t[6]=d,t[7]=y,t[8]=e):e=t[8],S=e}let C=c??S,w;bb1:{if(f?.kind===`folder`){let e;t[9]===f.folderPath?e=t[10]:(e=po(f.folderPath),t[9]=f.folderPath,t[10]=e),w=e;break bb1}if(d){let e;t[11]===d?e=t[12]:(e=Oa(d),t[11]=d,t[12]=e),w=e;break bb1}w=null}let E=w,D=typeof window<`u`&&window.okDesktop!=null,O=p===`collapsed`,k=D?``:void 0,A=D&&O&&`pl-[var(--ok-titlebar-reserve-left,1rem)]`,j=D&&!m&&`motion-safe:transition-[padding] motion-safe:duration-200 motion-safe:ease-linear`,M;t[13]!==A||t[14]!==j?(M=si(`flex h-12 shrink-0 items-center bg-muted/35 shadow-[inset_0_-1px_0_var(--border)]`,D&&`[-webkit-app-region:drag]`,A,j),t[13]=A,t[14]=j,t[15]=M):M=t[15];let N=!h&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Is,{children:[(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(_A,{className:si(`-ml-1 shrink-0 text-muted-foreground`,D&&`[-webkit-app-region:no-drag]`)})}),(0,Z.jsx)(Ns,{children:p===`expanded`?(0,Z.jsx)(s,{id:`ZxXhLY`,values:{sidebarShortcut:_}}):(0,Z.jsx)(s,{id:`Zz25kq`,values:{sidebarShortcut:_}})})]}),O&&a&&(0,Z.jsxs)(Is,{children:[(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(li,{variant:`ghost`,size:`icon-sm`,onClick:a,"aria-label":u({id:`IN4UX8`,values:{searchShortcut:v}}),"data-telemetry-event":`ok.editor_header.search.click`,className:si(`shrink-0 text-muted-foreground`,D&&`[-webkit-app-region:no-drag]`),children:(0,Z.jsx)(T,{"aria-hidden":`true`})})}),(0,Z.jsx)(Ns,{children:(0,Z.jsx)(s,{id:`IN4UX8`,values:{searchShortcut:v}})})]}),(0,Z.jsx)(Pi,{orientation:`vertical`,className:`mr-1 h-4 shrink-0 data-vertical:self-center`}),(0,Z.jsx)(PN,{})]}),P;t[16]===N?P=t[17]:(P=(0,Z.jsx)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1 px-3`,children:N}),t[16]=N,t[17]=P);let F;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(F=si(`flex shrink-0 items-center justify-end gap-2 px-3`,D&&`[&>*]:[-webkit-app-region:no-drag]`),t[18]=F):F=t[18];let I;t[19]!==C||t[20]!==l||t[21]!==o||t[22]!==b||t[23]!==x||t[24]!==E||t[25]!==h?(I=!h&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(BN,{input:C,open:o,onOpenChange:l}),(0,Z.jsx)(UN,{input:E,onClickWhenNoRemote:()=>x(!0)}),(0,Z.jsx)(ho,{open:b,onOpenChange:x})]}),t[19]=C,t[20]=l,t[21]=o,t[22]=b,t[23]=x,t[24]=E,t[25]=h,t[26]=I):I=t[26];let L;t[27]!==r||t[28]!==n?(L=(0,Z.jsx)(Wa,{onSignIn:n,onSetIdentity:r}),t[27]=r,t[28]=n,t[29]=L):L=t[29];let R,z,B;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Z.jsx)(eM,{}),z=(0,Z.jsx)(Pi,{orientation:`vertical`,className:`h-4 shrink-0 data-vertical:self-center`}),B=(0,Z.jsx)(qd,{}),t[30]=R,t[31]=z,t[32]=B):(R=t[30],z=t[31],B=t[32]);let V;t[33]===h?V=t[34]:(V=!h&&(0,Z.jsx)(HN,{}),t[33]=h,t[34]=V);let H;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Z.jsx)(RN,{}),t[35]=H):H=t[35];let U;t[36]!==I||t[37]!==L||t[38]!==V?(U=(0,Z.jsxs)(`div`,{className:F,children:[I,L,R,z,B,V,H]}),t[36]=I,t[37]=L,t[38]=V,t[39]=U):U=t[39];let W;return t[40]!==P||t[41]!==U||t[42]!==k||t[43]!==M?(W=(0,Z.jsxs)(`header`,{"data-electron-drag":k,className:M,children:[P,U]}),t[40]=P,t[41]=U,t[42]=k,t[43]=M,t[44]=W):W=t[44],W}var ZN=`open-knowledge:terminal-launch`;function QN(e,t=typeof window>`u`?new EventTarget:window){t.dispatchEvent(new CustomEvent(ZN,{detail:{prompt:e}}))}function $N(e,t=typeof window>`u`?new EventTarget:window){let n=t=>{let n=t instanceof CustomEvent?t.detail?.prompt:void 0;typeof n==`string`&&e(n)};return t.addEventListener(ZN,n),()=>t.removeEventListener(ZN,n)}function eP(e){let t=(0,$.c)(61),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{onOpenSearch:r}=n,{_:a}=i(),[o,s]=ov(),[c,l]=(0,Q.useState)(o),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(`auth`),[m,h]=(0,Q.useState)(Cy[0].id),[g,_]=(0,Q.useState)(!1),[v,y]=(0,Q.useState)(!1),[b,x]=(0,Q.useState)(null),S=typeof window<`u`?window.okDesktop??null:null,[C,w]=(0,Q.useState)(!1),[T,E]=(0,Q.useState)(null),D=(0,Q.useRef)(0),O=lo(),{projectLocalConfig:k,projectLocalSynced:A}=oe(),j=ka(),{activeDocName:M}=ht(),N=O?.hasRemote,P=O?.pushPermission?.checkStatus,F;t[2]!==g||t[3]!==k||t[4]!==A||t[5]!==N||t[6]!==P?(F=uv({autoSyncOnboardingDismissed:g,hasRemote:N,projectLocalSynced:A,projectLocalConfig:k,pushPermissionCheckStatus:P}),t[2]=g,t[3]=k,t[4]=A,t[5]=N,t[6]=P,t[7]=F):F=t[7];let I=F,L,R;t[8]===M?(L=t[9],R=t[10]):(L=()=>{let e=function(e){let t=e.detail;t&&M&&Oc(M,{kind:`raw-mdx`,detail:t}),l(`source`)};return window.addEventListener(Q_,e),()=>window.removeEventListener(Q_,e)},R=[M],t[8]=M,t[9]=L,t[10]=R),(0,Q.useEffect)(L,R);let z,B;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(z=()=>{let e=window.okDesktop;if(e!=null)return e.onMenuAction(e=>{e===`toggle-terminal`?w(nP):e===`new-terminal`&&w(!0)})},B=[],t[11]=z,t[12]=B):(z=t[11],B=t[12]),(0,Q.useEffect)(z,B);let V,H;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(H=()=>{if(window.okDesktop!=null)return;let e=function(e){nc(e,`toggle-terminal-panel`)&&(e.preventDefault(),w(tP))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},V=[],t[13]=V,t[14]=H):(V=t[13],H=t[14]),(0,Q.useEffect)(H,V);let U,W;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(U=()=>$N(e=>{w(!0),D.current+=1,E({prompt:e,nonce:D.current})}),W=[],t[15]=U,t[16]=W):(U=t[15],W=t[16]),(0,Q.useEffect)(U,W);let G,K;t[17]===C?(G=t[18],K=t[19]):(G=()=>{C||E(null)},K=[C],t[17]=C,t[18]=G,t[19]=K),(0,Q.useEffect)(G,K);let q,J;t[20]===C?(q=t[21],J=t[22]):(q=()=>{window.okDesktop!=null&&window.okDesktop.editor.notifyViewMenuStateChanged({terminalVisible:C})},J=[C],t[20]=C,t[21]=q,t[22]=J),(0,Q.useEffect)(q,J);let ee,te;t[23]===C?(ee=t[24],te=t[25]):(ee=()=>{window.okDesktop!=null&&C&&Ta()},te=[C],t[23]=C,t[24]=ee,t[25]=te),(0,Q.useEffect)(ee,te),sv(O?.pausedReason);let ne;t[26]===s?ne=t[27]:(ne=function(e){l(e),s(e)},t[26]=s,t[27]=ne);let re=ne,Y;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(Y=function(e){y(e),e||x(null)},t[28]=Y):Y=t[28];let ie=Y,ae;t[29]!==a||t[30]!==M||t[31]!==j?(ae={openSelection(e){let t=a_({docName:e.docName??M,workspace:j,instruction:e.instruction,selectionMarkdown:e.selectionMarkdown});return t===null?(X.error(a({id:`_VRtd7`})),!1):(x(t),y(!0),!0)}},t[29]=a,t[30]=M,t[31]=j,t[32]=ae):ae=t[32];let se,ce;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(se=()=>{p(`auth`),d(!0)},ce=()=>{p(`identity`),d(!0)},t[33]=se,t[34]=ce):(se=t[33],ce=t[34]);let le;t[35]!==r||t[36]!==b||t[37]!==v?(le=(0,Z.jsx)(XN,{onSignIn:se,onSetIdentity:ce,onOpenSearch:r,openInAgentMenuOpen:v,openInAgentMenuInput:b,onOpenInAgentMenuOpenChange:ie}),t[35]=r,t[36]=b,t[37]=v,t[38]=le):le=t[38];let ue;t[39]!==m||t[40]!==c||t[41]!==re||t[42]!==T||t[43]!==C?(ue=(0,Z.jsx)(Dj,{editorMode:c,onModeChange:re,activeTab:m,onActiveTabChange:h,terminalBridge:S,terminalVisible:C,onTerminalVisibleChange:w,terminalLaunch:T}),t[39]=m,t[40]=c,t[41]=re,t[42]=T,t[43]=C,t[44]=ue):ue=t[44];let de;t[45]!==ae||t[46]!==le||t[47]!==ue?(de=(0,Z.jsxs)(Pc,{value:ae,children:[le,ue]}),t[45]=ae,t[46]=le,t[47]=ue,t[48]=de):de=t[48];let fe=f===`identity`,pe;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(pe=()=>{d(!1)},t[49]=pe):pe=t[49];let me;t[50]!==u||t[51]!==fe?(me=(0,Z.jsx)(ea,{open:u,onOpenChange:d,identityPrompt:fe,onSuccess:pe}),t[50]=u,t[51]=fe,t[52]=me):me=t[52];let he;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(he=()=>_(!0),t[53]=he):he=t[53];let ge;t[54]===I?ge=t[55]:(ge=(0,Z.jsx)(cv,{open:I,onResolved:he}),t[54]=I,t[55]=ge);let _e;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(_e=(0,Z.jsx)(Y_,{}),t[56]=_e):_e=t[56];let ve;return t[57]!==de||t[58]!==me||t[59]!==ge?(ve=(0,Z.jsxs)(Z.Fragment,{children:[de,me,ge,_e]}),t[57]=de,t[58]=me,t[59]=ge,t[60]=ve):ve=t[60],ve}function tP(e){return!e}function nP(e){return!e}function rP(e){let t=Ho(qo(e));typeof window>`u`||window.location.hash!==t&&(window.location.hash=t)}function iP(){let e=(0,$.c)(11),{conflicts:t,loading:n,error:r}=Fi();if(n)return null;if(r===`server`){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`section`,{"data-testid":`conflicts-section`,"aria-label":`Conflicted files`,className:`border-b border-amber-200/60 bg-amber-50/40 px-2 py-2 dark:border-amber-900/40 dark:bg-amber-950/20`,children:(0,Z.jsxs)(`p`,{"data-testid":`conflicts-section-error`,className:`px-2 py-1.5 text-[12px] text-amber-700 dark:text-amber-400`,children:[(0,Z.jsx)(Ro,{"aria-hidden":`true`,className:`mr-1.5 inline size-3`}),`Couldn't load conflicts — reload to retry.`]})}),e[0]=t):t=e[0],t}if(t.length===0)return null;let i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 font-mono text-[11px] uppercase tracking-wider text-amber-700 dark:text-amber-400`,children:[(0,Z.jsx)(Ro,{"aria-hidden":`true`,className:`size-3`}),`Conflicts`]}),e[1]=i):i=e[1];let a;e[2]===t.length?a=e[3]:(a=(0,Z.jsxs)(`header`,{className:`flex items-center justify-between px-2 pb-1.5`,children:[i,(0,Z.jsx)(`span`,{"data-testid":`conflicts-section-count`,className:`rounded-full bg-amber-500 px-1.5 py-0.5 font-mono text-[10px] font-medium leading-none text-white`,children:t.length})]}),e[2]=t.length,e[3]=a);let o;e[4]===t?o=e[5]:(o=t.map(aP),e[4]=t,e[5]=o);let s;e[6]===o?s=e[7]:(s=(0,Z.jsx)(`ul`,{className:`flex flex-col gap-px`,children:o}),e[6]=o,e[7]=s);let c;return e[8]!==a||e[9]!==s?(c=(0,Z.jsxs)(`section`,{"data-testid":`conflicts-section`,"aria-label":`Conflicted files`,className:`border-b border-amber-200/60 bg-amber-50/40 px-2 py-2 dark:border-amber-900/40 dark:bg-amber-950/20`,children:[a,s]}),e[8]=a,e[9]=s,e[10]=c):c=e[10],c}function aP(e){return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(li,{variant:`ghost`,size:`sm`,"data-testid":`conflicts-section-row`,"data-file":e.file,title:e.file,className:`h-7 w-full justify-start gap-1.5 px-2 font-normal text-[13px] text-amber-800 hover:bg-amber-100/60 hover:text-amber-900 dark:text-amber-300 dark:hover:bg-amber-900/30 dark:hover:text-amber-200`,onClick:()=>rP(e.file),children:[(0,Z.jsx)(Ro,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:e.file})]})},e.file)}var oP=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
|
|
29
|
+
`,r);if(s>-1&&s<t&&(e=s),i&&p<f.length){let t=Math.max(0,m?f[p].toA:f[p].fromA);t<=e&&(e=t,m&&p++,o=!0)}if(e>r){let t=document.createTextNode(l.slice(r,e));if(a){let e=d.appendChild(document.createElement(`span`));e.className=a,e.appendChild(t)}else d.appendChild(t);r=e}o&&(m=!m)}}if(u&&t.toA-t.fromA<=o){let t=u.parser.parse(l),n=0;lc(t,{style:t=>Cc(e,t)},(e,t,r)=>{e>n&&g(n,e,``),g(e,t,r),n=t}),g(n,l.length,``)}else g(0,l.length,``);return d.firstChild||d.appendChild(document.createElement(`br`)),c})});return YO.set(t.changes,i),i}function QO(e,t){let{state:n}=e,r=t??n.selection.main.head,i=e.state.field(iO).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=e.state.sliceDoc(i.fromB,Math.max(i.fromB,i.toB-1)),o=e.state.field(JO);i.fromB!=i.toB&&i.toA<=o.length&&(a+=e.state.lineBreak);let s=oc.of({from:i.fromA,to:Math.min(o.length,i.toA),insert:a},o.length);return e.dispatch({effects:qO.of({doc:s.apply(o),changes:s}),userEvent:`accept`}),!0}function $O(e,t){let{state:n}=e,r=t??n.selection.main.head,i=n.field(iO).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=n.field(JO).sliceString(i.fromA,Math.max(i.fromA,i.toA-1));return i.fromA!=i.toA&&i.toB<=n.doc.length&&(a+=n.lineBreak),e.dispatch({changes:{from:i.fromB,to:Math.min(n.doc.length,i.toB),insert:a},userEvent:`revert`}),!0}function ek(e){let t=new fc;for(let n of e.field(iO)){let r=e.facet(tO).overrideChunk&&rk(e,n);t.add(n.fromB,n.fromB,ZO(e,n,!!r))}return t.finish()}var tk=cc.define({create:e=>ek(e),update(e,t){return t.state.field(iO,!1)==t.startState.field(iO,!1)?e:ek(t.state)},provide:e=>_c.decorations.from(e)}),nk=new WeakMap;function rk(e,t){let n=nk.get(t);if(n!==void 0)return n;n=null;let r=e.field(JO),i=e.doc,a=r.lineAt(t.endA).number-r.lineAt(t.fromA).number+1,o=i.lineAt(t.endB).number-i.lineAt(t.fromB).number+1;abort:if(a==o&&a<10){let e=[],i=0,o=t.fromA,s=t.fromB;for(let n of t.changes){if(n.fromA<n.toA){i+=n.toA-n.fromA;let t=r.sliceString(o+n.fromA,o+n.toA);if(/\n/.test(t))break abort;e.push(dc.widget({widget:new ik(t),side:-1}).range(s+n.fromB))}n.fromB<n.toB&&e.push(bO.range(s+n.fromB,s+n.toB))}i<t.endA-t.fromA-a*2&&(n=e)}return nk.set(t,n),n}var ik=class extends ic{constructor(e){super(),this.text=e}eq(e){return this.text==e.text}toDOM(e){let t=document.createElement(`del`);return t.className=`cm-deletedText`,t.textContent=this.text,t}},ak=new class extends vc{constructor(){super(...arguments),this.elementClass=`cm-inlineChangedLineGutter`}},ok=dc.line({class:`cm-inlineChangedLine`});function sk(e,t,n,r){let i=rk(e,t),a=0;if(!i)return!1;for(let o=e.doc.lineAt(t.fromB);;){for(r&&r.add(o.from,o.from,ak),n.add(o.from,o.from,ok);a<i.length&&i[a].to<=o.to;){let e=i[a++];n.add(e.from,e.to,e.value)}if(o.to>=t.endB)break;o=e.doc.lineAt(o.to+1)}return!0}var ck=te({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),lk=G({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),uk=_c.theme({".cm-deletedChunk .cm-chunkButtons":{display:`flex`,gap:`0.25rem`},".cm-deletedChunk .cm-chunkButtons button[data-slot='button']":{margin:`0`,border:`1px solid transparent`,borderRadius:`min(var(--radius-md), 10px)`,color:`var(--primary-foreground)`},".cm-deletedChunk .cm-chunkButtons button[data-slot='button'][data-variant='destructive']":{color:`var(--destructive)`}});function dk({addControl:e,nextId:t,removeControl:n,root:r}){return(i,a)=>{let o=document.createElement(`span`);o.className=`inline-flex`;let s=t();return e({id:s,host:o,type:i,action:a}),queueMicrotask(()=>{r.contains(o)||n(s)}),o}}function fk(e){let t=(0,$.c)(32),{oldContent:n,newContent:r,layout:a,conflictMode:o,previewMode:c,oursOverride:l,onResolve:u,onAbort:d}=e,{_:f}=i(),p=l??r,m=(0,Q.useRef)(null),h=(0,Q.useRef)(null),g=(0,Q.useRef)(0),{resolvedTheme:_}=Pr(),v=(0,Q.useRef)(u),y=(0,Q.useRef)(d),[b,x]=(0,Q.useState)(null),S;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(S=[],t[0]=S):S=t[0];let[C,w]=(0,Q.useState)(S),T;t[1]!==d||t[2]!==u?(T=()=>{v.current=u,y.current=d},t[1]=d,t[2]=u,t[3]=T):T=t[3],(0,Q.useEffect)(T);let E,D;t[4]!==o||t[5]!==p||t[6]!==a||t[7]!==n||t[8]!==c||t[9]!==_?(E=()=>{let e=m.current;if(!e)return;w([]);let t=new Map,r=!1,i=e=>{r||!t.delete(e)||w(t=>t.filter(t=>t.id!==e))},s=new MutationObserver(()=>{for(let[n,r]of t)e.contains(r)||i(n)});s.observe(e,{childList:!0,subtree:!0});let l=_===`dark`?ck:lk,u=[_c.editable.of(!1),sc.readOnly.of(!0)],d=[Fc,wc(),...u,l,_c.lineWrapping];if(h.current&&=(h.current.destroy(),null),c)h.current=new _c({doc:p,extensions:d,parent:e}),x(null);else if(o){let a=dk({addControl:e=>{r||(t.set(e.id,e.host),w(t=>[...t,e]))},nextId:()=>(g.current+=1,g.current),removeControl:i,root:e}),o=new _c({doc:p,extensions:[Fc,wc(),_c.editable.of(!1),l,uk,_c.lineWrapping,KO({original:n,highlightChanges:!0,gutter:!0,mergeControls:a,collapseUnchanged:{margin:3,minSize:4}}),_c.updateListener.of(e=>{let t=aO(e.state);x(t?t.chunks.length:0)})],parent:e});h.current=o;let s=aO(o.state);x(s?s.chunks.length:0)}else a===`split`?h.current=new HO({a:{doc:n,extensions:d},b:{doc:p,extensions:d},parent:e,highlightChanges:!0,gutter:!0,collapseUnchanged:{margin:3,minSize:4}}):h.current=new _c({doc:p,extensions:[...d,KO({original:n,highlightChanges:!0,gutter:!0,mergeControls:!1,collapseUnchanged:{margin:3,minSize:4}})],parent:e});return()=>{r=!0,s.disconnect(),h.current&&=(h.current.destroy(),null)}},D=[n,p,a,_,o,c],t[4]=o,t[5]=p,t[6]=a,t[7]=n,t[8]=c,t[9]=_,t[10]=E,t[11]=D):(E=t[10],D=t[11]),(0,Q.useEffect)(E,D);let O;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(O=function(){let e=h.current;!e||!(e instanceof _c)||v.current?.(e.state.doc.toString())},t[12]=O):O=t[12];let k=O,A;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(){let e=h.current;!e||!(e instanceof _c)||ye(e)},t[13]=A):A=t[13];let j=A,M=b===0,N;t[14]!==f||t[15]!==b?(N=b===null?``:b===0?f({id:`lPzyrU`}):hs._({id:`8FqTCr`,values:{chunksRemaining:b}}),t[14]=f,t[15]=b,t[16]=N):N=t[16];let P=N,F;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(`div`,{ref:m,className:`diff-view min-h-0 flex-1 overflow-y-auto subtle-scrollbar`}),t[17]=F):F=t[17];let I;if(t[18]!==f||t[19]!==C){let e;t[21]===f?e=t[22]:(e=e=>(0,rl.createPortal)((0,Z.jsx)(li,{type:`button`,variant:e.type===`accept`?`default`:`destructive`,size:`xs`,onClick:t=>{e.action(t.nativeEvent)},children:e.type===`accept`?f({id:`g3UF2V`}):f({id:`1t_NnN`})}),e.host,e.id),t[21]=f,t[22]=e),I=C.map(e),t[18]=f,t[19]=C,t[20]=I}else I=t[20];let L;t[23]!==M||t[24]!==o||t[25]!==P||t[26]!==d||t[27]!==u?(L=o&&(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-3 py-2 border-t shrink-0`,children:[(0,Z.jsx)(`span`,{className:`text-xs ${M?`text-emerald-600 dark:text-emerald-400`:`text-muted-foreground`}`,children:P}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[d&&(0,Z.jsx)(li,{className:`uppercase font-mono`,variant:`ghost`,size:`sm`,onClick:d,children:(0,Z.jsx)(s,{id:`XyOUTJ`})}),(0,Z.jsx)(li,{className:`uppercase font-mono`,variant:`outline`,size:`sm`,onClick:j,children:`Undo`}),u&&(0,Z.jsx)(li,{variant:`default`,size:`sm`,disabled:!M,onClick:k,children:(0,Z.jsx)(s,{id:`Lcehxn`})})]})]}),t[23]=M,t[24]=o,t[25]=P,t[26]=d,t[27]=u,t[28]=L):L=t[28];let R;return t[29]!==L||t[30]!==I?(R=(0,Z.jsxs)(`div`,{className:`flex flex-col h-full`,children:[F,I,L]}),t[29]=L,t[30]=I,t[31]=R):R=t[31],R}async function pk(e,t,n){try{let r={file:e,strategy:t};n!==void 0&&(r.content=n);let i=await fetch(`/api/sync/resolve-conflict`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(r)});if(i.ok)return{ok:!0};let a;try{let e=await i.json();typeof e.detail==`string`?a=e.detail:typeof e.title==`string`&&(a=e.title)}catch{}return{ok:!1,detail:a}}catch(n){let r=n instanceof Error?n.message:String(n);return console.warn(JSON.stringify({event:`conflict-resolve-dispatch-failed`,file:e,strategy:t,detail:r})),{ok:!1,detail:r}}}async function mk(e,t){return pk(e,`content`,t)}async function hk(e){return pk(e,`mine`)}async function gk(e){return pk(e,`theirs`)}async function _k(e){return pk(e,`delete`)}async function vk(e){try{let t=await fetch(`/api/sync/conflict-content?file=${encodeURIComponent(e)}&source=ytext`);if(!t.ok){let n;try{let e=await t.json();typeof e.detail==`string`?n=e.detail:typeof e.title==`string`&&(n=e.title)}catch{}return console.warn(JSON.stringify({event:`conflict-content-fetch-failed`,file:e,status:t.status,detail:n})),null}let n=await t.json(),r=n.kind===`delete-modify`||n.kind===`modify-delete`||n.kind===`both-modified`?n.kind:`both-modified`;return n.kind!==r&&console.warn(JSON.stringify({event:`conflict-kind-missing-fallback`,file:e,receivedKind:n.kind??null})),{base:n.base??``,ours:n.ours??``,theirs:n.theirs??``,kind:r}}catch(t){return console.warn(JSON.stringify({event:`conflict-content-fetch-failed`,file:e,status:null,detail:t instanceof Error?t.message:String(t)})),null}}function yk(e){let t=(0,$.c)(84),{docName:n}=e,{_:r}=i(),{conflicts:a,loading:o}=Fi(),c;if(t[0]!==a||t[1]!==n){let e;t[3]===n?e=t[4]:(e=e=>qo(e.file)===n,t[3]=n,t[4]=e),c=a.find(e),t[0]=a,t[1]=n,t[2]=c}else c=t[2];let l=c,u=l?.file??`${n}.md`,[d,f]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(!1),_,v;t[5]===n?(_=t[6],v=t[7]):(_=()=>(console.warn(JSON.stringify({event:`editor-area-swap-to-diffview`,"doc.name":n})),()=>{console.warn(JSON.stringify({event:`editor-area-swap-from-diffview`,"doc.name":n}))}),v=[n],t[5]=n,t[6]=_,t[7]=v),(0,Q.useEffect)(_,v);let y=o||l===void 0,b,x;t[8]!==y||t[9]!==u?(b=()=>{if(y)return;let e=!1;return f(null),m(!1),vk(u).then(t=>{e||(t===null?m(!0):f(t))}),()=>{e=!0}},x=[u,y],t[8]=y,t[9]=u,t[10]=b,t[11]=x):(b=t[10],x=t[11]),(0,Q.useEffect)(b,x);let S;t[12]!==r||t[13]!==u?(S=async function(e){let t=await mk(u,e);t.ok||X.error(r({id:`K-h9cT`,values:{filePath:u}}),{description:t.detail})},t[12]=r,t[13]=u,t[14]=S):S=t[14];let C=S,w;t[15]!==r||t[16]!==u?(w=async function(e){g(!0);let t=await e(u);t.ok||(g(!1),X.error(r({id:`jPUPvG`,values:{filePath:u}}),{description:t.detail}))},t[15]=r,t[16]=u,t[17]=w):w=t[17];let T=w;if(p){let e;return t[18]===u?e=t[19]:(e=(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`ajz9F8`,values:{filePath:u}})}),t[18]=u,t[19]=e),e}if(d===null){let e;return t[20]===u?e=t[21]:(e=(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`DF1MtZ`,values:{filePath:u}})}),t[20]=u,t[21]=e),e}if(d.kind===`delete-modify`){let e;t[22]===d.theirs?e=t[23]:(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(fk,{oldContent:``,newContent:d.theirs,layout:`unified`,previewMode:!0})}),t[22]=d.theirs,t[23]=e);let n;t[24]===u?n=t[25]:(n={filePath:u},t[24]=u,t[25]=n);let r;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(r={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[26]=r):r=t[26];let i;t[27]===n?i=t[28]:(i=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`V48OUT`,values:n,components:r})}),t[27]=n,t[28]=i);let a;t[29]===T?a=t[30]:(a=()=>void T(_k),t[29]=T,t[30]=a);let o;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(s,{id:`Vlc75q`}),t[31]=o):o=t[31];let c;t[32]!==h||t[33]!==a?(c=(0,Z.jsx)(li,{type:`button`,variant:`destructive`,disabled:h,onClick:a,children:o}),t[32]=h,t[33]=a,t[34]=c):c=t[34];let l;t[35]===T?l=t[36]:(l=()=>void T(gk),t[35]=T,t[36]=l);let f;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(s,{id:`3mFsc3`}),t[37]=f):f=t[37];let p;t[38]!==h||t[39]!==l?(p=(0,Z.jsx)(li,{type:`button`,variant:`default`,disabled:h,onClick:l,children:f}),t[38]=h,t[39]=l,t[40]=p):p=t[40];let m;t[41]!==c||t[42]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-3`,children:[c,p]}),t[41]=c,t[42]=p,t[43]=m):m=t[43];let g;t[44]!==i||t[45]!==m?(g=(0,Z.jsxs)(`div`,{className:`flex flex-shrink-0 flex-wrap items-center justify-between gap-x-6 gap-y-3 border-t px-6 py-4`,children:[i,m]}),t[44]=i,t[45]=m,t[46]=g):g=t[46];let _;return t[47]!==g||t[48]!==e?(_=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[e,g]}),t[47]=g,t[48]=e,t[49]=_):_=t[49],_}if(d.kind===`modify-delete`){let e;t[50]===d.ours?e=t[51]:(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(fk,{oldContent:``,newContent:d.ours,layout:`unified`,previewMode:!0})}),t[50]=d.ours,t[51]=e);let n;t[52]===u?n=t[53]:(n={filePath:u},t[52]=u,t[53]=n);let r;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(r={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[54]=r):r=t[54];let i;t[55]===n?i=t[56]:(i=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`EhDLBx`,values:n,components:r})}),t[55]=n,t[56]=i);let a;t[57]===T?a=t[58]:(a=()=>void T(hk),t[57]=T,t[58]=a);let o;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(s,{id:`0NA4b3`}),t[59]=o):o=t[59];let c;t[60]!==h||t[61]!==a?(c=(0,Z.jsx)(li,{type:`button`,variant:`default`,disabled:h,onClick:a,children:o}),t[60]=h,t[61]=a,t[62]=c):c=t[62];let l;t[63]===T?l=t[64]:(l=()=>void T(_k),t[63]=T,t[64]=l);let f;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(s,{id:`qSxaOz`}),t[65]=f):f=t[65];let p;t[66]!==h||t[67]!==l?(p=(0,Z.jsx)(li,{type:`button`,variant:`destructive`,disabled:h,onClick:l,children:f}),t[66]=h,t[67]=l,t[68]=p):p=t[68];let m;t[69]!==c||t[70]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-3`,children:[c,p]}),t[69]=c,t[70]=p,t[71]=m):m=t[71];let g;t[72]!==i||t[73]!==m?(g=(0,Z.jsxs)(`div`,{className:`flex flex-shrink-0 flex-wrap items-center justify-between gap-x-6 gap-y-3 border-t px-6 py-4`,children:[i,m]}),t[72]=i,t[73]=m,t[74]=g):g=t[74];let _;return t[75]!==g||t[76]!==e?(_=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[e,g]}),t[75]=g,t[76]=e,t[77]=_):_=t[77],_}let E;t[78]===C?E=t[79]:(E=e=>void C(e),t[78]=C,t[79]=E);let D;return t[80]!==d.ours||t[81]!==d.theirs||t[82]!==E?(D=(0,Z.jsx)(fk,{oldContent:d.theirs,newContent:d.ours,layout:`unified`,conflictMode:!0,onResolve:E}),t[80]=d.ours,t[81]=d.theirs,t[82]=E,t[83]=D):D=t[83],D}function bk(e){let t=(0,$.c)(2),{docName:n,provider:r,children:i}=e;(0,Q.use)(It(n,r));let a;return t[0]===i?a=t[1]:(a=(0,Z.jsx)(Z.Fragment,{children:i}),t[0]=i,t[1]=a),a}var xk=`__back-nav__`;function Sk(e){return e instanceof Re||e instanceof yt||e instanceof Ne||e instanceof tt||e instanceof jt||e instanceof me?e.docName:null}function Ck(e){if(e instanceof Re){let t=e.docName;return{title:hs._({id:`Jejur6`}),summary:hs._({id:`jSY41h`,values:{docName:t}})}}if(e instanceof yt){let t=e.docName;return{title:hs._({id:`V7QxyT`}),summary:hs._({id:`xG4tb6`,values:{docName:t}})}}if(e instanceof Ne){let t=e.docName;return{title:hs._({id:`1di5fu`}),summary:hs._({id:`PQCdtv`,values:{docName:t}})}}if(e instanceof tt){let t=e.docName;return{title:hs._({id:`wvbc1r`}),summary:hs._({id:`IX7-sq`,values:{docName:t}})}}if(e instanceof jt)return{title:hs._({id:`Gfr4fu`}),summary:hs._({id:`j6LB7S`})};if(e instanceof me){let t=e.docName;return{title:hs._({id:`vv7kpg`}),summary:hs._({id:`mdKFEy`,values:{docName:t}})}}let t=e instanceof Error&&e.message?e.message:hs._({id:`W5A0Ly`});return{title:hs._({id:`29VNqC`}),summary:t}}function wk(e){let t=(0,$.c)(28),{error:n,resetErrorBoundary:r,activeDocName:i,previousDocName:a,onNavigateBack:o}=e,c;t[0]===n?c=t[1]:(c=Ck(n),t[0]=n,t[1]=c);let{title:l,summary:u}=c,d=!!a&&!!o,f=(0,Q.useRef)(null),p,m;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(p=()=>{f.current?.focus()},m=[],t[2]=p,t[3]=m):(p=t[2],m=t[3]),(0,Q.useEffect)(p,m);let h;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(TS,{size:80,variant:`sleeping`}),t[4]=h):h=t[4];let g;t[5]===l?g=t[6]:(g=(0,Z.jsx)(`h2`,{id:`document-error-title`,className:`text-2xl font-light tracking-tighter text-balance`,children:l}),t[5]=l,t[6]=g);let _;t[7]===u?_=t[8]:(_=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-muted-foreground`,children:u}),t[7]=u,t[8]=_);let v;t[9]!==g||t[10]!==_?(v=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[g,_]}),t[9]=g,t[10]=_,t[11]=v):v=t[11];let y;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(s,{id:`KDw4GX`}),t[12]=y):y=t[12];let b;t[13]===r?b=t[14]:(b=(0,Z.jsx)(li,{ref:f,variant:`default`,onClick:r,children:y}),t[13]=r,t[14]=b);let x;t[15]!==i||t[16]!==d||t[17]!==n||t[18]!==o||t[19]!==a||t[20]!==r?(x=d?(0,Z.jsx)(li,{variant:`ghost`,className:`font-mono uppercase`,onClick:()=>{!a||!o||(ut(Sk(n)??i),o(a),r(xk))},children:(0,Z.jsx)(s,{id:`CKyk7Q`})}):null,t[15]=i,t[16]=d,t[17]=n,t[18]=o,t[19]=a,t[20]=r,t[21]=x):x=t[21];let S;t[22]!==x||t[23]!==b?(S=(0,Z.jsxs)(`div`,{className:`mt-1 flex gap-2`,children:[b,x]}),t[22]=x,t[23]=b,t[24]=S):S=t[24];let C;return t[25]!==S||t[26]!==v?(C=(0,Z.jsxs)(`div`,{role:`alert`,"aria-labelledby":`document-error-title`,"data-slot":`document-error-boundary`,className:`flex h-full flex-col items-center justify-center gap-8 p-8 text-center`,children:[h,v,S]}),t[25]=S,t[26]=v,t[27]=C):C=t[27],C}function Tk(e){let t=(0,$.c)(17),{activeDocName:n,previousDocName:r,onNavigateBack:i,onRecycle:a,children:o}=e,s;t[0]!==n||t[1]!==i||t[2]!==r?(s=e=>(0,Z.jsx)(wk,{...e,activeDocName:n,previousDocName:r,onNavigateBack:i}),t[0]=n,t[1]=i,t[2]=r,t[3]=s):s=t[3];let c;t[4]===n?c=t[5]:(c=[n],t[4]=n,t[5]=c);let l;t[6]!==n||t[7]!==a?(l=e=>{if(e.reason===`imperative-api`){if(Array.isArray(e.args)&&e.args[0]===xk){console.warn(`[DocumentErrorBoundary] back-nav reset (no recycle)`);return}a(n),console.warn(`[DocumentErrorBoundary] retry recycled ${n}`)}else console.warn(`[DocumentErrorBoundary] reset by key change (${e.prev?.[0]} → ${e.next?.[0]})`)},t[6]=n,t[7]=a,t[8]=l):l=t[8];let u;t[9]===n?u=t[10]:(u=e=>{console.error(`[DocumentErrorBoundary] rendered fallback for ${n}: ${Ck(e).title}`,e)},t[9]=n,t[10]=u);let d;return t[11]!==o||t[12]!==s||t[13]!==c||t[14]!==l||t[15]!==u?(d=(0,Z.jsx)(le,{fallbackRender:s,resetKeys:c,onReset:l,onError:u,children:o}),t[11]=o,t[12]=s,t[13]=c,t[14]=l,t[15]=u,t[16]=d):d=t[16],d}function Ek(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=Cr(t);return{map:n,keys:kn(t),parseError:r}}function Dk(e){let t=(0,$.c)(21),{provider:n}=e,r;t[0]===n?r=t[1]:(r=()=>Ek(n),t[0]=n,t[1]=r);let[i,a]=(0,Q.useState)(r),o,s;t[2]===n?(o=t[3],s=t[4]):(o=()=>{let e=Nn(n);a(e.current());let t=e.subscribe(e=>{a(e)});return()=>{t(),e.dispose()}},s=[n],t[2]=n,t[3]=o,t[4]=s),(0,Q.useEffect)(o,s);let c;t[5]===i.map.icon?c=t[6]:(c=Qe(i.map.icon),t[5]=i.map.icon,t[6]=c);let l=c,u;t[7]===i.map.cover?u=t[8]:(u=ft(i.map.cover),t[7]=i.map.cover,t[8]=u);let d=u,f=d.kind===`url`||d.kind===`path`,p=l.kind!==`unsupported`;if(!f&&!p)return null;let m=f?`true`:`false`,h=p?`true`:`false`,g;t[9]!==d||t[10]!==f?(g=f?(0,Z.jsx)(Ok,{cover:d}):null,t[9]=d,t[10]=f,t[11]=g):g=t[11];let _;t[12]!==f||t[13]!==p||t[14]!==l?(_=p?(0,Z.jsx)(kk,{icon:l,hasCover:f}):null,t[12]=f,t[13]=p,t[14]=l,t[15]=_):_=t[15];let v;return t[16]!==m||t[17]!==h||t[18]!==g||t[19]!==_?(v=(0,Z.jsxs)(`div`,{className:`page-header editor-content-aligned`,"data-has-cover":m,"data-has-icon":h,"aria-hidden":`true`,"data-testid":`page-header`,children:[g,_]}),t[16]=m,t[17]=h,t[18]=g,t[19]=_,t[20]=v):v=t[20],v}function Ok(e){let t=(0,$.c)(2),{cover:n}=e,r;return t[0]===n.value?r=t[1]:(r=(0,Z.jsx)(`div`,{className:`page-header-cover`,"data-testid":`page-header-cover`,children:(0,Z.jsx)(`img`,{src:n.value,alt:``,draggable:!1,loading:`lazy`,referrerPolicy:`no-referrer`,className:`page-header-cover-img`})}),t[0]=n.value,t[1]=r),r}function kk(e){let t=(0,$.c)(9),{icon:n,hasCover:r}=e,i=r?`page-header-icon page-header-icon--with-cover`:`page-header-icon`;if(n.kind===`emoji`){let e;return t[0]!==n.value||t[1]!==i?(e=(0,Z.jsx)(`span`,{className:i,"data-testid":`page-header-icon`,"data-kind":`emoji`,children:n.value}),t[0]=n.value,t[1]=i,t[2]=e):e=t[2],e}let a;t[3]===n.value?a=t[4]:(a=(0,Z.jsx)(`img`,{src:n.value,alt:``,draggable:!1,referrerPolicy:`no-referrer`,className:`page-header-icon-img`}),t[3]=n.value,t[4]=a);let o;return t[5]!==n.kind||t[6]!==i||t[7]!==a?(o=(0,Z.jsx)(`span`,{className:i,"data-testid":`page-header-icon`,"data-kind":n.kind,children:a}),t[5]=n.kind,t[6]=i,t[7]=a,t[8]=o):o=t[8],o}function Ak(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=Cr(t);return{map:n,keys:kn(t),parseError:r}}function jk(e){let t=(0,$.c)(127),{provider:n}=e,{_:r}=i(),[a,o]=(0,Q.useState)(null),c;t[0]===n?c=t[1]:(c=()=>Ak(n),t[0]=n,t[1]=c);let[l,u]=(0,Q.useState)(c),d,f;t[2]===n?(d=t[3],f=t[4]):(d=()=>{let e=Nn(n);o(e),u(e.current());let t=e.subscribe(e=>{u(e)});return()=>{t(),e.dispose(),o(t=>t===e?null:t)}},f=[n],t[2]=n,t[3]=d,t[4]=f),(0,Q.useEffect)(d,f);let p=l.map,m=l.keys,h=l.parseError,[g,_]=(0,Q.useState)(!1),v;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(v={},t[5]=v):v=t[5];let[y,b]=(0,Q.useState)(v),[x,S]=(0,Q.useState)(null),[C,w]=(0,Q.useState)(null),T;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(T={},t[6]=T):T=t[6];let[E,D]=(0,Q.useState)(T),O;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(O={},t[7]=O):O=t[7];let[k,A]=(0,Q.useState)(O),j=n.configuration.name??``,M;t[8]!==r||t[9]!==a?(M=function(e){if(!a)return{ok:!1,error:r({id:`9zb2WA`})};let t=a.patch(e);if(t.ok)return{ok:!0};if(t.error.code===`WRITE_ERROR`)return console.warn(`[PropertyPanel] binding write error:`,t.error.detail),{ok:!1,error:t.error.detail};let n=br(t.error);return{ok:!1,error:t.error.issues[0]?.message??r({id:`8fRyLo`}),fieldErrors:Object.keys(n).length>0?n:void 0}},t[8]=r,t[9]=a,t[10]=M):M=t[10];let N=M,P;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(P=function(e){D(t=>{if(!Object.hasOwn(t,e))return t;let n={...t};return delete n[e],n})},t[11]=P):P=t[11];let F=P,I;t[12]===r?I=t[13]:(I=function(e,t){if(e.ok)return;let n=e.error??r({id:`4g19V6`}),i=e.fieldErrors??{};D(e=>{let r={...e};for(let e of t)r[e]=i[e]??n;return r}),A(e=>{let n={...e};for(let e of t)n[e]=(n[e]??0)+1;return n})},t[12]=r,t[13]=I);let L=I,R;t[14]!==N||t[15]!==L?(R=function(e,t){F(e),L(N({[e]:t}),[e])},t[14]=N,t[15]=L,t[16]=R):R=t[16];let z=R,B;t[17]!==N||t[18]!==L?(B=function(e){F(e),L(N({[e]:null}),[e])},t[17]=N,t[18]=L,t[19]=B):B=t[19];let H=B,U;t[20]!==r||t[21]!==a?(U=function(e,t){if(!a)return{ok:!1,error:r({id:`9zb2WA`})};if(e===t)return{ok:!0};let n=a.rename(e,t);if(n.ok)return{ok:!0};if(n.error.code===`WRITE_ERROR`)return{ok:!1,error:n.error.detail};let i=br(n.error);return{ok:!1,error:n.error.issues[0]?.message??r({id:`I1gRhX`}),fieldErrors:Object.keys(i).length>0?i:void 0}},t[20]=r,t[21]=a,t[22]=U):U=t[22];let W=U,G;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(G=function(e,t){return`${e} ${t}`},t[23]=G):G=t[23];let K=G,q;t[24]!==a||t[25]!==m?(q=function(e){if(!a)return;let t=String(e.active.id),n=e.over?String(e.over.id):null;if(!n||t===n)return;let r=m.map((e,t)=>K(e,t)),i=r.indexOf(t),o=r.indexOf(n);if(i<0||o<0)return;let s=m.slice(),[c]=s.splice(i,1);if(!c)return;s.splice(o,0,c);let l=a.reorder(s);l.ok||console.warn(`[PropertyPanel] reorder failed:`,l.error)},t[24]=a,t[25]=m,t[26]=q):q=t[26];let J=q,ee;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(ee={activationConstraint:{distance:4}},t[27]=ee):ee=t[27];let te;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(te={coordinateGetter:_a},t[28]=te):te=t[28];let ne=Ti(aa(ya,ee),aa(xa,te)),re;t[29]!==z||t[30]!==p?(re=function(e,t){let n=p[e];if(n===void 0)return;b(n=>({...n,[e]:t}));let r=sa(n,t);(!Object.hasOwn(p,e)||!wr(n,r))&&z(e,r)},t[29]=z,t[30]=p,t[31]=re):re=t[31];let Y=re,ie;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(ie=function(){S({name:``,type:`text`,value:``,error:null}),_(!1)},t[32]=ie):ie=t[32];let ae=ie,{addPropertySignal:oe,clearAddProperty:se}=kC(),ce;t[33]!==oe||t[34]!==j?(ce=oe.get(j)??0,t[33]=oe,t[34]=j,t[35]=ce):ce=t[35];let le=ce,ue,de;t[36]===le?(ue=t[37],de=t[38]):(ue=()=>{le>0&&(S({name:``,type:`text`,value:``,error:null}),_(!1))},de=[le],t[36]=le,t[37]=ue,t[38]=de),(0,Q.useEffect)(ue,de);let fe,pe;t[39]!==se||t[40]!==j?(fe=()=>()=>se(j),pe=[j,se],t[39]=se,t[40]=j,t[41]=fe,t[42]=pe):(fe=t[41],pe=t[42]),(0,Q.useEffect)(fe,pe);let me;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(me=function(e){S(t=>{if(!t)return t;let n=e===`date`?new Date().toISOString().slice(0,10):Yi[e];return{...t,type:e,value:n,error:null}})},t[43]=me):me=t[43];let he=me,ge;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(ge=function(e){S(t=>t&&{...t,value:e})},t[44]=ge):ge=t[44];let _e=ge,ve;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(ve=function(e){S(t=>t&&{...t,name:e,error:null})},t[45]=ve):ve=t[45];let ye=ve,be;t[46]!==r||t[47]!==x||t[48]!==N||t[49]!==p?(be=function(){if(!x)return;let e=x.name.trim();if(!e){S({...x,error:r({id:`8_brI5`})});return}if(e===`frontmatter`){S({...x,error:r({id:`dURmlQ`})});return}if(Object.hasOwn(p,e)){S({...x,error:r({id:`njU86j`,values:{trimmed:e}})});return}let t=N({[e]:x.value});if(t.ok){S(null);return}let n=t.fieldErrors?.[e],i=t.error??r({id:`OJeiSH`});S({...x,error:n??i})},t[46]=r,t[47]=x,t[48]=N,t[49]=p,t[50]=be):be=t[50];let xe=be,Se;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(Se=function(){S(null)},t[51]=Se):Se=t[51];let Ce=Se,we;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(we=function(e){w({key:e,draft:e,error:null})},t[52]=we):we=t[52];let Te=we,Ee;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=function(e){w(t=>t&&{...t,draft:e,error:null})},t[53]=Ee):Ee=t[53];let De=Ee,Oe;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=function(){w(null)},t[54]=Oe):Oe=t[54];let ke=Oe,Ae;t[55]!==r||t[56]!==p||t[57]!==W||t[58]!==C?(Ae=function(){if(!C)return;let e=C.draft.trim();if(!e){w(null);return}if(e===C.key){w(null);return}if(e===`frontmatter`){w({...C,error:r({id:`dURmlQ`})});return}if(Object.hasOwn(p,e)){w({...C,error:r({id:`njU86j`,values:{trimmed:e}})});return}let t=W(C.key,e);if(t.ok){b(t=>{if(!Object.hasOwn(t,C.key))return t;let n={...t};return n[e]=n[C.key],delete n[C.key],n}),F(C.key),w(null);return}let n=t.fieldErrors?.[e]??t.fieldErrors?.[C.key]??t.error??r({id:`2ryd91`});w({...C,error:n})},t[55]=r,t[56]=p,t[57]=W,t[58]=C,t[59]=Ae):Ae=t[59];let je=Ae,Me;t[60]!==p||t[61]!==m?(Me=m.length>0?m:Object.keys(p),t[60]=p,t[61]=m,t[62]=Me):Me=t[62];let Ne=Me,Pe;if(t[63]!==Ne){Pe=new Map;for(let e of Ne)Pe.set(e,(Pe.get(e)??0)+1);t[63]=Ne,t[64]=Pe}else Pe=t[64];if(Ne.length===0&&!x&&!h)return null;let Fe=!g,Ie;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=e=>_(!e),t[65]=Ie):Ie=t[65];let Le=!g,Re;t[66]===Le?Re=t[67]:(Re=(0,Z.jsx)(Po,{"data-expanded":Le,className:`size-3.5 shrink-0 text-muted-foreground transition-transform duration-150 ease-out data-[expanded=true]:rotate-90`}),t[66]=Le,t[67]=Re);let ze;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(ze=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`l_UFPv`})}),t[68]=ze):ze=t[68];let Be;t[69]===Re?Be=t[70]:(Be=(0,Z.jsx)(Fo,{asChild:!0,children:(0,Z.jsxs)(li,{type:`button`,variant:`ghost`,className:`mb-1.5 flex h-auto w-fit bg-transparent! items-center gap-1 px-1 py-0.5 text-base font-medium text-foreground hover:bg-transparent hover:text-foreground`,children:[Re,ze]})}),t[69]=Re,t[70]=Be);let Ve;t[71]===h?Ve=t[72]:(Ve=h?(0,Z.jsxs)(`div`,{role:`alert`,"data-testid":`property-panel-yaml-error`,className:`mb-1 flex items-start gap-1.5 rounded border border-destructive/30 bg-destructive/5 px-2 py-1.5 text-[11px] text-destructive`,children:[(0,Z.jsx)(Ro,{className:`size-3.5 shrink-0 mt-0.5`}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(s,{id:`zaXlhf`}),(0,Z.jsx)(`span`,{className:`block text-[10px] opacity-80`,children:h})]})]}):null,t[71]=h,t[72]=Ve);let He;if(t[73]!==Ne){let e;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(e=(e,t)=>K(e,t),t[75]=e):e=t[75],He=Ne.map(e),t[73]=Ne,t[74]=He}else He=t[74];let Ue;if(t[76]!==z||t[77]!==je||t[78]!==Pe||t[79]!==E||t[80]!==p||t[81]!==y||t[82]!==H||t[83]!==C||t[84]!==Ne||t[85]!==k||t[86]!==Y){let e;t[88]!==z||t[89]!==je||t[90]!==Pe||t[91]!==E||t[92]!==p||t[93]!==y||t[94]!==H||t[95]!==C||t[96]!==k||t[97]!==Y?(e=(e,t)=>{let n=p[e];if(n===void 0)return null;let r=y[e]??jn(n),i=C?.key===e?C:null,a=(Pe.get(e)??0)>1;return(0,Z.jsx)(Li,{sortableId:K(e,t),keyName:e,value:n,declared:r,error:E[e]??null,resetCounter:k[e]??0,isDuplicate:a,rename:{state:i,onBegin:()=>Te(e),onChangeDraft:De,onCommit:je,onCancel:ke},onCommit:t=>z(e,t),onChangeType:t=>Y(e,t),onRemove:()=>H(e)},`${e}-${t}`)},t[88]=z,t[89]=je,t[90]=Pe,t[91]=E,t[92]=p,t[93]=y,t[94]=H,t[95]=C,t[96]=k,t[97]=Y,t[98]=e):e=t[98],Ue=Ne.map(e),t[76]=z,t[77]=je,t[78]=Pe,t[79]=E,t[80]=p,t[81]=y,t[82]=H,t[83]=C,t[84]=Ne,t[85]=k,t[86]=Y,t[87]=Ue}else Ue=t[87];let We;t[99]!==He||t[100]!==Ue?(We=(0,Z.jsx)(ha,{items:He,strategy:qi,children:Ue}),t[99]=He,t[100]=Ue,t[101]=We):We=t[101];let Ge;t[102]!==J||t[103]!==ne||t[104]!==We?(Ge=(0,Z.jsx)(Qa,{sensors:ne,collisionDetection:Ca,onDragEnd:J,children:We}),t[102]=J,t[103]=ne,t[104]=We,t[105]=Ge):Ge=t[105];let Ke;t[106]!==z||t[107]!==E||t[108]!==p||t[109]!==k?(Ke=Object.hasOwn(p,`tags`)?null:(0,Z.jsx)(Li,{keyName:`tags`,value:[],declared:`list`,error:E.tags??null,resetCounter:k.tags??0,isPlaceholder:!0,onCommit:e=>z(`tags`,e),onChangeType:Mk},`virtual-tags`),t[106]=z,t[107]=E,t[108]=p,t[109]=k,t[110]=Ke):Ke=t[110];let qe;t[111]!==r||t[112]!==x||t[113]!==xe?(qe=x?(0,Z.jsx)(ra,{draft:x,onChangeName:ye,onChangeType:he,onChangeValue:_e,onCommit:xe,onCancel:Ce}):(0,Z.jsxs)(`div`,{className:`mt-1 flex items-center gap-1`,children:[(0,Z.jsx)(`span`,{"aria-hidden":!0,className:`h-7 w-4 shrink-0`}),(0,Z.jsxs)(li,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`add-property-trigger`,onClick:ae,"aria-label":r({id:`F-NRCj`}),className:`flex items-center gap-1.5 rounded px-2 py-1 font-medium text-sm hover:bg-muted/50 hover:text-foreground`,children:[(0,Z.jsx)(V,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`m16xKo`})})]})]}),t[111]=r,t[112]=x,t[113]=xe,t[114]=qe):qe=t[114];let Je;t[115]!==Ve||t[116]!==Ge||t[117]!==Ke||t[118]!==qe?(Je=(0,Z.jsxs)(No,{className:`overflow-hidden data-[state=open]:animate-[collapsible-down_150ms_ease-out] data-[state=closed]:animate-[collapsible-up_150ms_ease-in]`,children:[Ve,Ge,Ke,qe]}),t[115]=Ve,t[116]=Ge,t[117]=Ke,t[118]=qe,t[119]=Je):Je=t[119];let Ye;t[120]!==Fe||t[121]!==Be||t[122]!==Je?(Ye=(0,Z.jsx)(`div`,{className:`property-panel editor-content-aligned pt-4 pb-4 text-sm`,"data-testid":`property-panel`,children:(0,Z.jsxs)(Io,{open:Fe,onOpenChange:Ie,children:[Be,Je]})}),t[120]=Fe,t[121]=Be,t[122]=Je,t[123]=Ye):Ye=t[123];let Xe;return t[124]!==a||t[125]!==Ye?(Xe=(0,Z.jsx)(ki,{binding:a,children:Ye}),t[124]=a,t[125]=Ye,t[126]=Xe):Xe=t[126],Xe}function Mk(){}var Nk=v(`LARGE_DOC_CHAR_THRESHOLD`,5e5);function Pk(e){let t=e.threshold??Nk;return e.ytextLength>t?{renderSource:e.isSourceMode||e.visitedSource,renderVisual:!e.isSourceMode||e.visitedVisual,isLarge:!0}:{renderSource:!0,renderVisual:!0,isLarge:!1}}function Fk(e){return e.hasEmittedFirstToggle||!e.isLarge?!1:e.renderSource&&e.renderVisual}var Ik=v(`ACTIVITY_MOUNT_LIMIT`,3);function Lk(){return n(()=>import(`./SourceEditor-Ddk4Onbm.js`),__vite__mapDeps([55,1,37,2,38,39,23,40,41,42,43,44,45,46,47,14,6,8,9,22,3,24,4,12,10,11,48,56,26,54]),import.meta.url)}var Rk=(0,Q.lazy)(async()=>({default:(await Lk()).SourceEditor}));function zk(e,t,n){if(n<=0)return[];let r=e.filter(e=>!qe(e.docName)),i=[...r].sort((e,t)=>t.lastAccessedAt-e.lastAccessedAt).slice(0,n);if(t===null||i.some(e=>e.docName===t))return i;let a=r.find(e=>e.docName===t);return a?[...i.slice(0,n-1),a]:i}function Bk(e,t){return t.kind===`idle`?null:t.kind===`failed`&&t.failedDocNames.includes(e)?{kind:`failed`,title:hs._({id:`MTs6g3`}),summary:t.reason===`clear-data-timeout`?hs._({id:`Sc1bKE`,values:{docName:e}}):hs._({id:`ovIGrT`,values:{docName:e}}),actionLabel:hs._({id:`HpK_8d`})}:t.kind===`recovering`&&t.docNames.includes(e)?{kind:`recovering`,title:hs._({id:`cF9DyA`}),summary:t.phase===`clearing-local-cache`?hs._({id:`bmC18N`,values:{docName:e}}):hs._({id:`pAgkuZ`,values:{docName:e}})}:null}function Vk(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(Gt,{name:`activity-pool`,children:(0,Z.jsx)(Hk,{...e})}),t[0]=e,t[1]=n),n}function Hk(e){let t=(0,$.c)(15),{activeDocName:n,isSourceMode:r,editorPlaceholder:i,previousDocName:a,onNavigateBack:o,onRecycle:s}=e,{poolEntries:c,serverRestartRecovery:l}=ht(),{pages:u,loading:d}=is(),f=zk(c,n,Ik),p=(0,Q.useRef)(``),h=f.map(Uk).join(`,`),g=(0,Q.useRef)(c),_,v;t[0]===c?(_=t[1],v=t[2]):(_=()=>{g.current=c},v=[c],t[0]=c,t[1]=_,t[2]=v),(0,Q.useLayoutEffect)(_,v),(0,Q.useLayoutEffect)(()=>{if(p.current===h)return;let e=p.current?p.current.split(`,`):[],t=h?h.split(`,`):[],r=e.filter(e=>!t.includes(e)),i=t.filter(t=>!e.includes(t));for(let e of r)m(e);for(let e of i){let t=g.current.find(t=>t.docName===e)?.poolEventId;W(e,t&&t.length>0?t:crypto.randomUUID())}ue(`ok/activity/mount-list-change`,{active:n,mounted:t,evicted:r}),p.current=h,Wt(t)},[h,n]);let y;t[3]!==n||t[4]!==i||t[5]!==r||t[6]!==d||t[7]!==o||t[8]!==s||t[9]!==u||t[10]!==a||t[11]!==l?(y=e=>(0,Z.jsx)(Yk,{entry:e,isActive:e.docName===n,isSourceMode:r,editorPlaceholder:i,isNewDoc:!d&&!u.has(e.docName),previousDocName:a,onNavigateBack:o,onRecycle:s,serverRestartRecovery:l},e.docName),t[3]=n,t[4]=i,t[5]=r,t[6]=d,t[7]=o,t[8]=s,t[9]=u,t[10]=a,t[11]=l,t[12]=y):y=t[12];let b=f.map(y),x;return t[13]===b?x=t[14]:(x=(0,Z.jsx)(Z.Fragment,{children:b}),t[13]=b,t[14]=x),x}function Uk(e){return e.docName}function Wk(e){let t=(0,$.c)(8),{isActive:n,initialScrollTop:r,children:i}=e,a=(0,Q.useRef)(null),o=(0,Q.useRef)(r??0),s,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{let e=a.current;if(!e)return;let t=()=>{e.scrollTop>0&&(o.current=e.scrollTop)};return e.addEventListener(`scroll`,t,{passive:!0}),()=>e.removeEventListener(`scroll`,t)},c=[],t[0]=s,t[1]=c):(s=t[0],c=t[1]),(0,Q.useEffect)(s,c);let l,u;t[2]===n?(l=t[3],u=t[4]):(l=()=>{if(!n)return;let e=a.current;if(!e)return;let t=o.current;if(t===0)return;let r=performance.now(),i=!1;e.scrollTop=t,e.scrollTop===t&&e.scrollHeight>t&&ue(`ok/scroll-restore/phase1-success`,{target:t,elapsedMs:performance.now()-r});let s=!1,c=0,l=()=>{s||(s=!0,cancelAnimationFrame(c),clearTimeout(f),e.removeEventListener(`wheel`,u),e.removeEventListener(`touchstart`,u))},u=()=>l();e.addEventListener(`wheel`,u,{passive:!0}),e.addEventListener(`touchstart`,u,{passive:!0});let d=()=>{s||(e.scrollTop!==t&&e.scrollHeight>t&&(e.scrollTop=t,e.scrollTop===t&&!i&&(ue(`ok/scroll-restore/phase2-success`,{target:t,elapsedMs:performance.now()-r}),i=!0)),c=requestAnimationFrame(d))};c=requestAnimationFrame(d);let f=setTimeout(()=>{s||(e.scrollTop!==t&&e.scrollHeight>t&&ue(`ok/scroll-restore/abandoned`,{target:t,elapsedMs:performance.now()-r,scrollHeight:e.scrollHeight,finalScrollTop:e.scrollTop}),l())},2e3);return l},u=[n],t[2]=n,t[3]=l,t[4]=u),(0,Q.useLayoutEffect)(l,u);let d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(d={overflowAnchor:`auto`},t[5]=d):d=t[5];let f;return t[6]===i?f=t[7]:(f=(0,Z.jsx)(`div`,{ref:a,"data-testid":`editor-scroll-container`,className:`subtle-scrollbar h-full overflow-y-auto pt-14 scroll-pt-14`,style:d,children:i}),t[6]=i,t[7]=f),f}function Gk(e){let t=(0,$.c)(12),{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a}=e,o=r&&i,[s,c]=(0,Q.useState)(o),l,u;if(t[0]===o?(l=t[1],u=t[2]):(l=()=>{o&&c(!0)},u=[o],t[0]=o,t[1]=l,t[2]=u),(0,Q.useEffect)(l,u),!s&&!o)return null;let d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Ix,{}),t[3]=d):d=t[3];let f=n.docName,p;t[4]===n.provider.document?p=t[5]:(p=n.provider.document.getText(`source`),t[4]=n.provider.document,t[5]=p);let m;return t[6]!==a||t[7]!==n.docName||t[8]!==n.provider||t[9]!==o||t[10]!==p?(m=(0,Z.jsx)(Q.Suspense,{fallback:d,children:(0,Z.jsx)(Rk,{docName:f,ytext:p,provider:n.provider,placeholder:a,isSourceModeActive:o})}),t[6]=a,t[7]=n.docName,t[8]=n.provider,t[9]=o,t[10]=p,t[11]=m):m=t[11],m}function Kk(e){let t=(0,$.c)(18),{view:n}=e,r=n.kind===`failed`,i=r?`alert`:`status`,a=!r,o;t[0]===r?o=t[1]:(o=(0,Z.jsx)(`div`,{className:`flex size-12 items-center justify-center rounded-full border bg-muted text-muted-foreground`,children:r?(0,Z.jsx)(Ka,{className:`size-5`,"aria-hidden":`true`}):(0,Z.jsx)(h,{className:`size-5 animate-spin`,"aria-hidden":`true`})}),t[0]=r,t[1]=o);let s;t[2]===n.title?s=t[3]:(s=(0,Z.jsx)(`h2`,{className:`text-lg font-medium`,children:n.title}),t[2]=n.title,t[3]=s);let c;t[4]===n.summary?c=t[5]:(c=(0,Z.jsx)(`p`,{className:`max-w-md text-sm text-muted-foreground`,children:n.summary}),t[4]=n.summary,t[5]=c);let l;t[6]!==s||t[7]!==c?(l=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;t[9]!==r||t[10]!==n.actionLabel?(u=r?(0,Z.jsxs)(li,{type:`button`,onClick:qk,children:[(0,Z.jsx)(Ka,{className:`size-4`,"aria-hidden":`true`}),n.actionLabel]}):null,t[9]=r,t[10]=n.actionLabel,t[11]=u):u=t[11];let d;return t[12]!==i||t[13]!==a||t[14]!==o||t[15]!==l||t[16]!==u?(d=(0,Z.jsxs)(`div`,{"data-slot":`server-restart-recovery`,role:i,"aria-busy":a,className:`flex h-full flex-col items-center justify-center gap-6 p-8 text-center`,children:[o,l,u]}),t[12]=i,t[13]=a,t[14]=o,t[15]=l,t[16]=u,t[17]=d):d=t[17],d}function qk(){return window.location.reload()}function Jk(e){let t=(0,$.c)(2),{html:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(`div`,{className:`tiptap-editor h-full pointer-events-none`,"aria-hidden":`true`,children:(0,Z.jsx)(`div`,{className:`tiptap ProseMirror tiptap-editor-portal-content`,dangerouslySetInnerHTML:{__html:n}})}),t[0]=n,t[1]=r),r}function Yk(e){let t=(0,$.c)(53),{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a,isNewDoc:o,previousDocName:s,onNavigateBack:c,onRecycle:l,serverRestartRecovery:u}=e,d;t[0]!==n.docName||t[1]!==u?(d=Bk(n.docName,u),t[0]=n.docName,t[1]=u,t[2]=d):d=t[2];let f=d,p=hw(n.docName)===`conflict`,m;t[3]===n.docName?m=t[4]:(m=()=>{let e=document.createElement(`div`);return e.setAttribute(`data-ok-editor-portal`,n.docName),e.style.display=`contents`,e},t[3]=n.docName,t[4]=m);let[h]=(0,Q.useState)(m),g=n.provider.document.getText(`source`).length,[_,v]=(0,Q.useState)(i),[b,x]=(0,Q.useState)(!i),S,C;t[5]!==i||t[6]!==_||t[7]!==b?(S=()=>{i&&!_?v(!0):!i&&!b&&x(!0)},C=[i,_,b],t[5]=i,t[6]=_,t[7]=b,t[8]=S,t[9]=C):(S=t[8],C=t[9]),(0,Q.useEffect)(S,C);let w=Pk({ytextLength:g,isSourceMode:i,visitedSource:_,visitedVisual:b}),T=(0,Q.useRef)(``),E=`${w.isLarge}-${w.renderSource}-${w.renderVisual}`,D,O;t[10]!==n.docName||t[11]!==w.isLarge||t[12]!==w.renderSource||t[13]!==w.renderVisual||t[14]!==E||t[15]!==i||t[16]!==g?(D=()=>{T.current!==E&&(T.current=E,w.isLarge&&ue(`ok/activity/defer-mount`,{docName:n.docName,ytextLength:g,isSourceMode:i,renderSource:w.renderSource,renderVisual:w.renderVisual}))},O=[E,w.isLarge,w.renderSource,w.renderVisual,n.docName,g,i],t[10]=n.docName,t[11]=w.isLarge,t[12]=w.renderSource,t[13]=w.renderVisual,t[14]=E,t[15]=i,t[16]=g,t[17]=D,t[18]=O):(D=t[17],O=t[18]),(0,Q.useEffect)(D,O);let k;t[19]===n.docName?k=t[20]:(k=()=>y(n.docName),t[19]=n.docName,t[20]=k);let[A]=(0,Q.useState)(k),j=A?.html??null,[M,N]=(0,Q.useState)(!1),P,F;t[21]!==n.docName||t[22]!==w.isLarge||t[23]!==w.renderSource||t[24]!==w.renderVisual||t[25]!==M||t[26]!==i||t[27]!==g?(P=()=>{Fk({isLarge:w.isLarge,renderSource:w.renderSource,renderVisual:w.renderVisual,hasEmittedFirstToggle:M})&&(ue(`ok/cold/first-toggle`,{docName:n.docName,mountId:ot(n.docName),ytextLength:g,modeEnteredFirst:i?`source`:`visual`}),N(!0))},F=[M,w.isLarge,w.renderSource,w.renderVisual,n.docName,g,i],t[21]=n.docName,t[22]=w.isLarge,t[23]=w.renderSource,t[24]=w.renderVisual,t[25]=M,t[26]=i,t[27]=g,t[28]=P,t[29]=F):(P=t[28],F=t[29]),(0,Q.useEffect)(P,F);let I=r?`visible`:`hidden`,L=`editor:${n.docName}`,R=A?.scrollTop,z;t[30]!==a||t[31]!==n||t[32]!==w.renderSource||t[33]!==w.renderVisual||t[34]!==r||t[35]!==p||t[36]!==o||t[37]!==i||t[38]!==c||t[39]!==l||t[40]!==h||t[41]!==s||t[42]!==f||t[43]!==j?(z=f?(0,Z.jsx)(Kk,{view:f}):(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsx)(Tk,{activeDocName:n.docName,previousDocName:s,onNavigateBack:c,onRecycle:l,children:(0,Z.jsx)(Q.Suspense,{fallback:j?(0,Z.jsx)(Jk,{html:j}):(0,Z.jsx)(Ix,{}),children:(0,Z.jsx)(bk,{docName:n.docName,provider:n.provider,children:p?(0,Z.jsx)(yk,{docName:n.docName,provider:n.provider}):(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[!i&&(0,Z.jsx)(Dk,{provider:n.provider}),!i&&(0,Z.jsx)(jk,{provider:n.provider}),(0,Z.jsxs)(`div`,{className:`relative flex-1`,children:[w.renderSource?(0,Z.jsx)(`div`,{className:i?`h-full`:`ok-mode-hidden h-full`,children:(0,Z.jsx)(Gk,{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a})}):null,w.renderVisual?(0,Z.jsx)(`div`,{className:i?`ok-mode-hidden h-full`:`h-full`,children:(0,Z.jsx)(_D,{provider:n.provider,placeholder:a,isSourceMode:i,portalTarget:h},`${n.docName}-${String(o)}-${n.poolEventId}`)}):null]})]})})})})}),t[30]=a,t[31]=n,t[32]=w.renderSource,t[33]=w.renderVisual,t[34]=r,t[35]=p,t[36]=o,t[37]=i,t[38]=c,t[39]=l,t[40]=h,t[41]=s,t[42]=f,t[43]=j,t[44]=z):z=t[44];let B;t[45]!==r||t[46]!==R||t[47]!==z?(B=(0,Z.jsx)(Wk,{isActive:r,initialScrollTop:R,children:z}),t[45]=r,t[46]=R,t[47]=z,t[48]=B):B=t[48];let V;return t[49]!==I||t[50]!==L||t[51]!==B?(V=(0,Z.jsx)(Q.Activity,{mode:I,name:L,children:B}),t[49]=I,t[50]=L,t[51]=B,t[52]=V):V=t[52],V}function Xk(e){let t=e.endsWith(`rem`)?`rem`:`px`;return{value:Number.parseFloat(e),unit:t}}function Zk(e){let{value:t,unit:n}=Xk(e);return n===`rem`?t*16:t}function Qk(e,t){return`${t===`rem`?e.toFixed(1):Math.round(e)}${t}`}var $k=3600*24*7;function eA(e){let t=(0,$.c)(28),{direction:n,currentWidth:r,onResize:i,onToggle:a,isCollapsed:o,minResizeWidth:s,maxResizeWidth:c,enableToggle:l,enableAutoCollapse:u,autoCollapseThreshold:d,expandThreshold:f,enableDrag:p,setIsDraggingRail:m,widthCookieName:h,widthCookieMaxAge:g,isNested:_}=e,v=n===void 0?`right`:n,y=o===void 0?!1:o,b=s===void 0?`14rem`:s,x=c===void 0?`24rem`:c,S=l===void 0?!0:l,C=u===void 0?!0:u,w=d===void 0?1.5:d,T=f===void 0?.2:f,E=p===void 0?!0:p,D=m===void 0?tA:m,O=g===void 0?$k:g,k=_===void 0?!1:_,A=(0,Q.useRef)(null),j=(0,Q.useRef)(0),M=(0,Q.useRef)(0),N=(0,Q.useRef)(!1),P=(0,Q.useRef)(!1),F=(0,Q.useRef)(null),I=(0,Q.useRef)(0),L=(0,Q.useRef)(!1),R=(0,Q.useRef)(0),z=(0,Q.useRef)(0),B=(0,Q.useRef)(null),V=(0,Q.useRef)(r),H=(0,Q.useRef)(y),U,W;t[0]===r?(U=t[1],W=t[2]):(U=()=>{V.current=r},W=[r],t[0]=r,t[1]=U,t[2]=W),(0,Q.useEffect)(U,W);let G,K;t[3]===y?(G=t[4],K=t[5]):(G=()=>{H.current=y},K=[y],t[3]=y,t[4]=G,t[5]=K),(0,Q.useEffect)(G,K);let q=Zk(b),J;t[6]===x?J=t[7]:(J=Zk(x),t[6]=x,t[7]=J);let ee=J,te;t[8]!==E||t[9]!==k?(te=function(e){E&&(P.current=!0,j.current=H.current?0:Zk(V.current),M.current=e.clientX,I.current=e.clientX,F.current=null,L.current=!1,R.current=0,z.current=0,B.current=k&&A.current?A.current.getBoundingClientRect():null,e.preventDefault())},t[8]=E,t[9]=k,t[10]=te):te=t[10];let ne=te,re,Y;t[11]!==w||t[12]!==v||t[13]!==C||t[14]!==S||t[15]!==T||t[16]!==k||t[17]!==ee||t[18]!==q||t[19]!==i||t[20]!==a||t[21]!==D||t[22]!==O||t[23]!==h?(re=()=>{let e=function(e){h&&(document.cookie=`${h}=${e}; path=/; max-age=${O}`)},t=function(e,t){return v===`left`?e<t:e>t},n=function(e,t,n,r){if(k&&r){let r=e.clientX-t;return v===`left`?n-r:n+r}return v===`left`?window.innerWidth-e.clientX:e.clientX},r=function(r){if(!P.current)return;let o=Math.abs(r.clientX-M.current);if(!N.current&&o>5&&(N.current=!0,D(!0)),N.current){let{unit:o}=Xk(V.current),s=B.current;k&&A.current&&(s=A.current.getBoundingClientRect());let c=t(r.clientX,I.current)?`expand`:`collapse`;F.current!==c&&(F.current=c),z.current=Math.abs(r.clientX-I.current);let l=Date.now();if(L.current&&l-R.current>200&&(L.current=!1),!L.current){if(C&&a&&!H.current){let e=n(r,M.current,j.current,s),t=!1;if(w<=1)t=e<=q*w;else if(e<=q){let n=q*(w-1);t=q-e>=n}if(c===`collapse`&&t){a(),I.current=r.clientX,L.current=!0,R.current=l;return}}if(a&&H.current&&c===`expand`&&z.current>q*T){a();let t=n(r,M.current,j.current,s),c=Math.max(q,Math.min(ee,t)),u=Qk(o===`rem`?c/16:c,o);i(u),e(u),I.current=r.clientX,L.current=!0,R.current=l;return}}if(H.current)return;let u=n(r,M.current,j.current,s),d=Math.max(q,Math.min(ee,u)),f=Qk(o===`rem`?d/16:d,o);i(f),e(f)}},o=function(){P.current&&(!N.current&&a&&S&&a(),N.current=!1,P.current=!1,F.current=null,I.current=0,L.current=!1,R.current=0,z.current=0,B.current=null,D(!1))};return document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,o),()=>{document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,o)}},Y=[i,a,D,q,ee,k,C,w,T,S,h,O,v],t[11]=w,t[12]=v,t[13]=C,t[14]=S,t[15]=T,t[16]=k,t[17]=ee,t[18]=q,t[19]=i,t[20]=a,t[21]=D,t[22]=O,t[23]=h,t[24]=re,t[25]=Y):(re=t[24],Y=t[25]),(0,Q.useEffect)(re,Y);let ie;return t[26]===ne?ie=t[27]:(ie={dragRef:A,isDragging:N,handleMouseDown:ne},t[26]=ne,t[27]=ie),ie}function tA(){}var nA=3600*24*7,rA=`18rem`,iA=`3rem`,aA=`app-file-sidebar`,oA=`14.625rem`,sA=`32rem`,cA=`sidebar_width`,lA=/^\d+(?:\.\d+)?(?:rem|px)$/,uA=Q.createContext(null);function dA(e){if(typeof document>`u`)return e;let t=document.cookie.split(`; `).find(e=>e.startsWith(`${cA}=`))?.split(`=`)[1];if(!t)return e;let n;try{n=decodeURIComponent(t)}catch{return e}return lA.test(n)?n:e}function fA(){let e=Q.use(uA);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function pA(e){let t=(0,$.c)(58),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({open:i,onOpenChange:o,className:r,style:s,children:n,defaultWidth:c,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=c===void 0?rA:c,[u]=Q.useState(hA),d;t[8]===u?d=t[9]:(d=()=>Tw(u,window.innerWidth,`left`),t[8]=u,t[9]=d);let[f,p]=Q.useState(d),m;t[10]===l?m=t[11]:(m=()=>dA(l),t[10]=l,t[11]=m);let[h,g]=Q.useState(m),[_,v]=Q.useState(!1),[y,b]=Q.useState(!1),x;t[12]===u?x=t[13]:(x=()=>{let e=Mw();return Pw(`left`,Tw(u,window.innerWidth,`left`),e)===`open`},t[12]=u,t[13]=x);let[S,C]=Q.useState(x),w=i??S,T;t[14]!==w||t[15]!==f||t[16]!==o?(T=e=>{let t=typeof e==`function`?e(w):e;o?o(t):C(t),Fw(`left`,f,t?`open`:`collapsed`)},t[14]=w,t[15]=f,t[16]=o,t[17]=T):T=t[17];let E=T,D;t[18]===E?D=t[19]:(D=function(){E(mA)},t[18]=E,t[19]=D);let O=D,k=Q.useRef(w),A;t[20]===w?A=t[21]:(A=()=>{k.current=w},t[20]=w,t[21]=A),Q.useLayoutEffect(A);let j;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(j=function(){window.innerWidth>=1024||k.current&&(window.matchMedia(`(prefers-reduced-motion: reduce)`).matches||b(!0))},t[22]=j):j=t[22];let M=j,N,P;t[23]===u?(N=t[24],P=t[25]):(P=()=>{let e=window.matchMedia(`(min-width: ${Sw}px)`),t=()=>{let e=Tw(u,window.innerWidth,`left`);p(e),C(Pw(`left`,e,Mw())===`open`)};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},N=[u],t[23]=u,t[24]=N,t[25]=P),Q.useEffect(P,N);let F,I;t[26]===w?(F=t[27],I=t[28]):(F=()=>{w||document.getElementById(aA)?.contains(document.activeElement)&&document.querySelector(`[data-sidebar="trigger"]`)?.focus()},I=[w],t[26]=w,t[27]=F,t[28]=I),Q.useLayoutEffect(F,I);let L,R;t[29]!==w||t[30]!==f||t[31]!==E?(L=()=>{if(f===`above`||!w)return;let e=e=>{e.key===`Escape`&&(document.querySelector(`[data-state="open"][role="dialog"], [data-state="open"][role="alertdialog"], [data-state="open"][role="menu"], [data-state="open"][role="listbox"], [data-radix-popper-content-wrapper] [data-state="open"]`)||E(!1))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},R=[f,w,E],t[29]=w,t[30]=f,t[31]=E,t[32]=L,t[33]=R):(L=t[32],R=t[33]),Q.useEffect(L,R);let z,B;t[34]===O?(z=t[35],B=t[36]):(z=()=>{if(typeof window<`u`&&window.okDesktop!=null)return;let e=e=>{nc(e,`toggle-files-sidebar`)&&(e.preventDefault(),O())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},B=[O],t[34]=O,t[35]=z,t[36]=B),Q.useEffect(z,B);let V=w?`expanded`:`collapsed`,H;t[37]!==_||t[38]!==w||t[39]!==E||t[40]!==y||t[41]!==V||t[42]!==O||t[43]!==h?(H={state:V,open:w,setOpen:E,toggleSidebar:O,width:h,setWidth:g,isDraggingRail:_,setIsDraggingRail:v,showPushPulse:y,setShowPushPulse:b,notifySidebarFileSelected:M},t[37]=_,t[38]=w,t[39]=E,t[40]=y,t[41]=V,t[42]=O,t[43]=h,t[44]=H):H=t[44];let U;t[45]!==s||t[46]!==h?(U={"--sidebar-width":h,"--sidebar-width-icon":iA,...s},t[45]=s,t[46]=h,t[47]=U):U=t[47];let W=U,G;t[48]===r?G=t[49]:(G=si(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),t[48]=r,t[49]=G);let K;t[50]!==n||t[51]!==a||t[52]!==W||t[53]!==G?(K=(0,Z.jsx)(`div`,{"data-slot":`sidebar-wrapper`,style:W,className:G,...a,children:n}),t[50]=n,t[51]=a,t[52]=W,t[53]=G,t[54]=K):K=t[54];let q;return t[55]!==H||t[56]!==K?(q=(0,Z.jsx)(uA.Provider,{value:H,children:K}),t[55]=H,t[56]=K,t[57]=q):q=t[57],q}function mA(e){return!e}function hA(){return kr()}function gA(e){let t=(0,$.c)(39),n,r,a,o,s,c;t[0]===e?(n=t[1],r=t[2],a=t[3],o=t[4],s=t[5],c=t[6]):({side:o,variant:s,collapsible:c,className:r,children:n,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=a,t[4]=o,t[5]=s,t[6]=c);let l=o===void 0?`left`:o,u=s===void 0?`sidebar`:s,d=c===void 0?`offcanvas`:c,{_:f}=i(),{state:p,isDraggingRail:m}=fA();if(d===`none`){let e;t[7]===r?e=t[8]:(e=si(`flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground`,r),t[7]=r,t[8]=e);let i;return t[9]!==n||t[10]!==a||t[11]!==e||t[12]!==u?(i=(0,Z.jsx)(`div`,{"data-slot":`sidebar`,"data-variant":u,className:e,...a,children:n}),t[9]=n,t[10]=a,t[11]=e,t[12]=u,t[13]=i):i=t[13],i}let h=p===`collapsed`?d:``,g=u===`floating`||u===`inset`?`group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon)`,_;t[14]===g?_=t[15]:(_=si(`relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear`,`group-data-[collapsible=offcanvas]:w-0`,`group-data-[side=right]:rotate-180`,g,`group-data-[dragging=true]:duration-0! group-data-[dragging=true]_*:!duration-0`),t[14]=g,t[15]=_);let v;t[16]===_?v=t[17]:(v=(0,Z.jsx)(`div`,{"data-slot":`sidebar-gap`,className:_}),t[16]=_,t[17]=v);let y;t[18]===f?y=t[19]:(y=f({id:`07q4Qk`}),t[18]=f,t[19]=y);let b=u===`floating`||u===`inset`?`p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l`,x;t[20]!==r||t[21]!==b?(x=si(`fixed inset-y-0 z-10 flex h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear motion-reduce:transition-none motion-reduce:duration-0 data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]`,b,`group-data-[dragging=true]:duration-0! group-data-[dragging=true]_*:!duration-0`,r),t[20]=r,t[21]=b,t[22]=x):x=t[22];let S;t[23]===n?S=t[24]:(S=(0,Z.jsx)(`div`,{"data-sidebar":`sidebar`,"data-slot":`sidebar-inner`,className:`flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border`,children:n}),t[23]=n,t[24]=S);let C;t[25]!==a||t[26]!==l||t[27]!==x||t[28]!==S||t[29]!==y?(C=(0,Z.jsx)(`nav`,{id:aA,"aria-label":y,"data-slot":`sidebar-container`,"data-side":l,className:x,...a,children:S}),t[25]=a,t[26]=l,t[27]=x,t[28]=S,t[29]=y,t[30]=C):C=t[30];let w;return t[31]!==m||t[32]!==l||t[33]!==p||t[34]!==C||t[35]!==h||t[36]!==v||t[37]!==u?(w=(0,Z.jsxs)(`div`,{className:`group peer text-sidebar-foreground`,"data-state":p,"data-collapsible":h,"data-variant":u,"data-side":l,"data-slot":`sidebar`,"data-dragging":m,children:[v,C]}),t[31]=m,t[32]=l,t[33]=p,t[34]=C,t[35]=h,t[36]=v,t[37]=u,t[38]=w):w=t[38],w}function _A(e){let t=(0,$.c)(34),n,r,a;t[0]===e?(n=t[1],r=t[2],a=t[3]):({className:n,onClick:r,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=a);let{_:o}=i(),{toggleSidebar:s,state:c}=fA(),l,u,d,f,p,m,h,g;if(t[4]!==o||t[5]!==c){let e=rc(`toggle-files-sidebar`);l=li,u=`trigger`,d=`sidebar-trigger`,f=`ghost`,p=`icon-sm`,m=c===`expanded`,h=aA,g=o(c===`expanded`?{id:`4PYsOz`,values:{sidebarShortcutLabel:e}}:{id:`jbSG8V`,values:{sidebarShortcutLabel:e}}),t[4]=o,t[5]=c,t[6]=l,t[7]=u,t[8]=d,t[9]=f,t[10]=p,t[11]=m,t[12]=h,t[13]=g}else l=t[6],u=t[7],d=t[8],f=t[9],p=t[10],m=t[11],h=t[12],g=t[13];let _;t[14]===n?_=t[15]:(_=si(n),t[14]=n,t[15]=_);let v;t[16]!==r||t[17]!==s?(v=e=>{r?.(e),s()},t[16]=r,t[17]=s,t[18]=v):v=t[18];let y;t[19]===c?y=t[20]:(y=c===`expanded`?(0,Z.jsx)(Xt,{}):(0,Z.jsx)(Bl,{}),t[19]=c,t[20]=y);let b;return t[21]!==l||t[22]!==a||t[23]!==u||t[24]!==y||t[25]!==d||t[26]!==f||t[27]!==p||t[28]!==m||t[29]!==h||t[30]!==g||t[31]!==_||t[32]!==v?(b=(0,Z.jsx)(l,{"data-sidebar":u,"data-slot":d,variant:f,size:p,"aria-expanded":m,"aria-controls":h,"aria-label":g,className:_,onClick:v,...a,children:y}),t[21]=l,t[22]=a,t[23]=u,t[24]=y,t[25]=d,t[26]=f,t[27]=p,t[28]=m,t[29]=h,t[30]=g,t[31]=_,t[32]=v,t[33]=b):b=t[33],b}function vA(e){let t=(0,$.c)(32),n,r,a,o,s;t[0]===e?(n=t[1],r=t[2],a=t[3],o=t[4],s=t[5]):({className:n,enableDrag:o,enableToggle:s,onMouseDown:r,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=a,t[4]=o,t[5]=s);let c=o===void 0?!0:o,l=s===void 0?!0:s,{_:u}=i(),{toggleSidebar:d,setWidth:f,state:p,width:m,setIsDraggingRail:h}=fA(),g=p===`collapsed`,_;t[6]!==c||t[7]!==l||t[8]!==h||t[9]!==f||t[10]!==g||t[11]!==d||t[12]!==m?(_={direction:`right`,enableDrag:c,enableToggle:l,onResize:f,onToggle:d,currentWidth:m,isCollapsed:g,minResizeWidth:oA,maxResizeWidth:sA,setIsDraggingRail:h,widthCookieName:cA,widthCookieMaxAge:nA},t[6]=c,t[7]=l,t[8]=h,t[9]=f,t[10]=g,t[11]=d,t[12]=m,t[13]=_):_=t[13];let{dragRef:v,handleMouseDown:y}=eA(_),b;t[14]!==u||t[15]!==p?(b=u(p===`expanded`?{id:`w3vFfL`}:{id:`e8zRrb`}),t[14]=u,t[15]=p,t[16]=b):b=t[16];let x;t[17]!==y||t[18]!==r?(x=e=>{r?.(e),e.defaultPrevented||y(e)},t[17]=y,t[18]=r,t[19]=x):x=t[19];let S;t[20]!==u||t[21]!==p?(S=u(p===`expanded`?{id:`w3vFfL`}:{id:`e8zRrb`}),t[20]=u,t[21]=p,t[22]=S):S=t[22];let C;t[23]===n?C=t[24]:(C=si(`absolute inset-y-0 z-20 hidden w-4 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:start-1/2 after:w-[2px] hover:after:bg-sidebar-border sm:flex ltr:-translate-x-1/2 rtl:-translate-x-1/2`,`in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize`,`[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize`,`group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full hover:group-data-[collapsible=offcanvas]:bg-sidebar`,`[[data-side=left][data-collapsible=offcanvas]_&]:-right-2`,`[[data-side=right][data-collapsible=offcanvas]_&]:-left-2`,`md:group-data-[variant=inset]:after:inset-y-5`,n),t[23]=n,t[24]=C);let w;return t[25]!==v||t[26]!==a||t[27]!==b||t[28]!==x||t[29]!==S||t[30]!==C?(w=(0,Z.jsx)(`button`,{ref:v,"data-sidebar":`rail`,"data-slot":`sidebar-rail`,"aria-label":b,tabIndex:-1,onMouseDown:x,title:S,className:C,...a}),t[25]=v,t[26]=a,t[27]=b,t[28]=x,t[29]=S,t[30]=C,t[31]=w):w=t[31],w}function yA(e){let t=(0,$.c)(14),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,onAnimationEnd:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let{showPushPulse:a,setShowPushPulse:o}=fA(),s;t[4]!==r||t[5]!==o?(s=e=>{r?.(e),e.animationName===`sidebar-push-pulse`&&o(!1)},t[4]=r,t[5]=o,t[6]=s):s=t[6];let c=s,l=a?``:void 0,u;t[7]===n?u=t[8]:(u=si(`relative flex w-full flex-1 flex-col bg-background peer-data-[variant=inset]:m-2 peer-data-[variant=inset]:ml-0 peer-data-[variant=inset]:rounded-xl peer-data-[variant=inset]:shadow-sm peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2`,n),t[7]=n,t[8]=u);let d;return t[9]!==c||t[10]!==i||t[11]!==l||t[12]!==u?(d=(0,Z.jsx)(`main`,{"data-slot":`sidebar-inset`,"data-push-pulse":l,onAnimationEnd:c,className:u,...i}),t[9]=c,t[10]=i,t[11]=l,t[12]=u,t[13]=d):d=t[13],d}function bA(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=si(`flex flex-col gap-2 p-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-header`,"data-sidebar":`header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function xA(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=si(`flex flex-col gap-2 p-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-footer`,"data-sidebar":`footer`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function SA(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=si(`no-scrollbar flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-content`,"data-sidebar":`content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function CA(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=si(`flex w-full min-w-0 flex-col gap-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`ul`,{"data-slot":`sidebar-menu`,"data-sidebar":`menu`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function wA(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=si(`group/menu-item relative`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`li`,{"data-slot":`sidebar-menu-item`,"data-sidebar":`menu-item`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var TA=ai(`peer/menu-button group/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-hover hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-hover active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-open:hover:bg-sidebar-hover data-open:hover:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground data-active:hover:bg-sidebar-accent [&_svg]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate`,{variants:{variant:{default:`hover:bg-sidebar-hover hover:text-sidebar-accent-foreground`,outline:`bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-hover hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]`},size:{default:`h-8 text-sm`,sm:`h-7 text-xs`,lg:`h-12 text-sm group-data-[collapsible=icon]:p-0!`}},defaultVariants:{variant:`default`,size:`default`}});function EA(e){let t=(0,$.c)(28),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({asChild:i,isActive:a,variant:o,size:s,tooltip:c,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=i===void 0?!1:i,u=a===void 0?!1:a,d=o===void 0?`default`:o,f=s===void 0?`default`:s,p=l?ci:`button`,{state:m}=fA(),h;t[8]!==n||t[9]!==f||t[10]!==d?(h=si(TA({variant:d,size:f}),n),t[8]=n,t[9]=f,t[10]=d,t[11]=h):h=t[11];let g;t[12]!==p||t[13]!==u||t[14]!==r||t[15]!==f||t[16]!==h?(g=(0,Z.jsx)(p,{"data-slot":`sidebar-menu-button`,"data-sidebar":`menu-button`,"data-size":f,"data-active":u,className:h,...r}),t[12]=p,t[13]=u,t[14]=r,t[15]=f,t[16]=h,t[17]=g):g=t[17];let _=g;if(!c)return _;if(typeof c==`string`){let e;t[18]===c?e=t[19]:(e={children:c},t[18]=c,t[19]=e),c=e}let v;t[20]===_?v=t[21]:(v=(0,Z.jsx)(js,{asChild:!0,children:_}),t[20]=_,t[21]=v);let y=m!==`collapsed`,b;t[22]!==y||t[23]!==c?(b=(0,Z.jsx)(Ns,{side:`right`,align:`center`,hidden:y,...c}),t[22]=y,t[23]=c,t[24]=b):b=t[24];let x;return t[25]!==v||t[26]!==b?(x=(0,Z.jsxs)(Is,{children:[v,b]}),t[25]=v,t[26]=b,t[27]=x):x=t[27],x}function DA(e){let t=null,n=!1,r=new Set;function i(e){if(e!==t){t=e;for(let e of r)e()}}e.subscribeToEvent(i);async function a(){if(!n){n=!0;try{i(await e.fetchBranch())}catch{}}}return{getSnapshot:()=>t,subscribe(e){return r.add(e),a(),()=>{r.delete(e)}}}}async function OA(){let e=await fetch(`/api/server-info`,{signal:AbortSignal.timeout(5e3)});if(!e.ok)return null;let t=await e.json(),n=zr.safeParse(t);return n.success?n.data.currentBranch??null:null}var kA=typeof window>`u`?{getSnapshot:()=>null,subscribe:()=>()=>{}}:DA({fetchBranch:OA,subscribeToEvent:rs}),AA=kA.subscribe,jA=kA.getSnapshot;function MA(){return(0,Q.useSyncExternalStore)(AA,jA,jA)}function NA(){let e=(0,$.c)(6),t=MA(),n=ka(),{state:r}=fA(),i=typeof window<`u`?window.okDesktop:void 0;if(i&&r===`expanded`)return null;let a;e[0]===n?a=e[1]:(a=i?.config.projectName??(n&&da(n.contentDir)||null),e[0]=n,e[1]=a);let o=a,s=i?.config.projectPath??n?.contentDir??null;if(o===null&&t===null)return null;let c;return e[2]!==t||e[3]!==o||e[4]!==s?(c={projectName:o,projectPath:s,branch:t},e[2]=t,e[3]=o,e[4]=s,e[5]=c):c=e[5],c}function PA(e){let t=(0,$.c)(23),{stats:n,selectionStats:r,showStats:a}=e,o=a===void 0?!0:a,{_:c}=i(),l=NA();if(!o&&l===null)return null;let u=r??n,d=r!=null,{words:f,chars:p,tokens:m}=u,h;t[0]!==c||t[1]!==d||t[2]!==o?(h=c(o?d?{id:`Bv5a9_`}:{id:`L1ZE3M`}:{id:`goO4Ll`}),t[0]=c,t[1]=d,t[2]=o,t[3]=h):h=t[3];let g;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-full h-2 bg-linear-to-t from-background to-transparent`}),t[4]=g):g=t[4];let _;t[5]===l?_=t[6]:(_=l===null?null:(0,Z.jsx)(FA,{identity:l}),t[5]=l,t[6]=_);let v;t[7]===_?v=t[8]:(v=(0,Z.jsx)(`span`,{className:`flex min-w-0 items-center gap-3`,children:_}),t[7]=_,t[8]=v);let y;t[9]!==c||t[10]!==u.chars||t[11]!==u.tokens||t[12]!==u.words||t[13]!==p||t[14]!==d||t[15]!==o||t[16]!==m||t[17]!==f?(y=o?(0,Z.jsxs)(`span`,{className:`flex items-center shrink-0 gap-3`,children:[d?(0,Z.jsx)(`span`,{className:`font-medium text-foreground/70`,"data-testid":`editor-footer-selected-label`,children:c({id:`ylXj1N`})}):null,(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:u.words.toLocaleString()}),` `,(0,Z.jsx)(s,{id:`gljvbT`,values:{words:f}})]}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:u.chars.toLocaleString()}),` `,(0,Z.jsx)(s,{id:`d5rK4X`,values:{chars:p}})]}),(0,Z.jsxs)(`span`,{children:[u.tokens>0?`~`:``,(0,Z.jsx)(`span`,{className:`tabular-nums`,children:u.tokens.toLocaleString()}),` `,(0,Z.jsx)(s,{id:`uynXup`,values:{tokens:m}})]})]}):null,t[9]=c,t[10]=u.chars,t[11]=u.tokens,t[12]=u.words,t[13]=p,t[14]=d,t[15]=o,t[16]=m,t[17]=f,t[18]=y):y=t[18];let b;return t[19]!==h||t[20]!==v||t[21]!==y?(b=(0,Z.jsxs)(`section`,{"aria-label":h,className:`relative flex h-6 shrink-0 items-center justify-between gap-3 bg-background px-3 text-2xs text-muted-foreground`,children:[g,v,y]}),t[19]=h,t[20]=v,t[21]=y,t[22]=b):b=t[22],b}function FA(e){let t=(0,$.c)(8),{identity:n}=e,{projectName:r,projectPath:i,branch:a}=n,o;t[0]!==r||t[1]!==i?(o=r===null?null:i?(0,Z.jsxs)(Is,{children:[(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(`span`,{tabIndex:0,className:`truncate`,"data-testid":`editor-footer-project-name`,children:r})}),(0,Z.jsx)(Ns,{side:`top`,className:`max-w-xs break-all`,children:i})]}):(0,Z.jsx)(`span`,{className:`truncate`,"data-testid":`editor-footer-project-name`,children:r}),t[0]=r,t[1]=i,t[2]=o):o=t[2];let s;t[3]===a?s=t[4]:(s=a===null?null:(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,"data-testid":`editor-footer-branch`,children:[(0,Z.jsx)(ke,{"aria-hidden":`true`,className:`size-3 shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:a})]}),t[3]=a,t[4]=s);let c;return t[5]!==o||t[6]!==s?(c=(0,Z.jsxs)(Z.Fragment,{children:[o,s]}),t[5]=o,t[6]=s,t[7]=c):c=t[7],c}function IA(e){let t=(0,$.c)(11),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let{_:a}=i(),o;t[3]===a?o=t[4]:(o=a({id:`3__SjS`}),t[3]=a,t[4]=o);let s;t[5]===n?s=t[6]:(s=si(n),t[5]=n,t[6]=s);let c;return t[7]!==r||t[8]!==o||t[9]!==s?(c=(0,Z.jsx)(`nav`,{"aria-label":o,"data-slot":`breadcrumb`,className:s,...r}),t[7]=r,t[8]=o,t[9]=s,t[10]=c):c=t[10],c}function LA(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=si(`flex flex-wrap items-center gap-1.5 text-sm wrap-break-word text-muted-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`ol`,{"data-slot":`breadcrumb-list`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function RA(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=si(`inline-flex items-center gap-1`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`li`,{"data-slot":`breadcrumb-item`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function zA(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({current:i,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0||i?`page`:void 0,o;t[4]===n?o=t[5]:(o=si(`font-normal text-foreground`,n),t[4]=n,t[5]=o);let s;return t[6]!==r||t[7]!==a||t[8]!==o?(s=(0,Z.jsx)(`span`,{"data-slot":`breadcrumb-page`,"aria-current":a,className:o,...r}),t[6]=r,t[7]=a,t[8]=o,t[9]=s):s=t[9],s}function BA(e){let t=(0,$.c)(12),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({children:n,className:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=si(`[&>svg]:size-3.5`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=n??(0,Z.jsx)(Po,{}),t[6]=n,t[7]=o);let s;return t[8]!==i||t[9]!==a||t[10]!==o?(s=(0,Z.jsx)(`li`,{"data-slot":`breadcrumb-separator`,role:`presentation`,"aria-hidden":`true`,className:a,...i,children:o}),t[8]=i,t[9]=a,t[10]=o,t[11]=s):s=t[11],s}var VA=1,HA=2,UA=4;function WA(e){let t=(0,$.c)(18),{docName:n,className:r}=e;if(!n)return null;let i,a,o,s,c,l;if(t[0]!==r||t[1]!==n){l=Symbol.for(`react.early_return_sentinel`);bb0:{let{prefix:e}=Me(n,``);if(!e){l=null;break bb0}let u=e.replace(/\/$/,``).split(`/`).filter(Boolean);if(u.length===0){l=null;break bb0}let d=(e,t)=>({kind:`segment`,value:e,key:u.slice(0,t+1).join(`/`)}),f=u.length>UA?[...u.slice(0,VA).map((e,t)=>d(e,t)),{kind:`ellipsis`,hidden:u.slice(VA,-HA)},...u.slice(-HA).map((e,t)=>d(e,u.length-HA+t))]:u.map((e,t)=>d(e,t));a=IA,t[8]===r?c=t[9]:(c=si(`flex min-w-0 items-center`,r),t[8]=r,t[9]=c),i=LA,o=`min-w-0 flex-nowrap gap-1 overflow-hidden text-muted-foreground/70 text-xs`,s=f.map(GA)}t[0]=r,t[1]=n,t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l}else i=t[2],a=t[3],o=t[4],s=t[5],c=t[6],l=t[7];if(l!==Symbol.for(`react.early_return_sentinel`))return l;let u;t[10]!==i||t[11]!==o||t[12]!==s?(u=(0,Z.jsx)(i,{className:o,children:s}),t[10]=i,t[11]=o,t[12]=s,t[13]=u):u=t[13];let d;return t[14]!==a||t[15]!==c||t[16]!==u?(d=(0,Z.jsx)(a,{className:c,children:u}),t[14]=a,t[15]=c,t[16]=u,t[17]=d):d=t[17],d}function GA(e,t){let n=e.kind===`segment`?e.key:`ellipsis`;return(0,Z.jsxs)(Q.Fragment,{children:[t>0&&(0,Z.jsx)(BA,{className:`shrink-0 text-muted-foreground/70 [&>svg]:size-3`}),e.kind===`ellipsis`?(0,Z.jsxs)(RA,{className:`shrink-0`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,title:e.hidden.join(` / `),className:`flex size-4 items-center justify-center text-muted-foreground/70`,children:(0,Z.jsx)(hl,{className:`size-3.5`})}),(0,Z.jsx)(`span`,{className:`sr-only`,children:e.hidden.join(` / `)})]}):(0,Z.jsx)(RA,{className:`min-w-0`,children:(0,Z.jsx)(zA,{current:!1,className:`min-w-0 truncate font-normal text-muted-foreground/70`,title:e.value,children:e.value})})]},n)}var KA={fill:`none`,height:24,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,viewBox:`0 0 24 24`,width:24,xmlns:`http://www.w3.org/2000/svg`},qA=e=>{let t=(0,$.c)(15),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({color:a,size:o,strokeWidth:s,absoluteStrokeWidth:n,className:c,children:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=a===void 0?`currentColor`:a,u=o===void 0?24:o,d=s===void 0?2:s,f=c===void 0?``:c,p=n?Number(d)*24/Number(u):d,m;return t[8]!==r||t[9]!==f||t[10]!==l||t[11]!==i||t[12]!==u||t[13]!==p?(m=(0,Z.jsx)(`svg`,{"aria-hidden":`true`,...KA,className:f,height:u,stroke:l,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:p,width:u,...i,children:r}),t[8]=r,t[9]=f,t[10]=l,t[11]=i,t[12]=u,t[13]=p,t[14]=m):m=t[14],m},JA=e=>{let t=(0,$.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`Markdown`}),r=(0,Z.jsx)(`path`,{d:`M232,48H24A16,16,0,0,0,8,64V192a16,16,0,0,0,16,16H232a16,16,0,0,0,16-16V64A16,16,0,0,0,232,48Zm0,144H24V64H232V192ZM128,104v48a8,8,0,0,1-16,0V123.31L93.66,141.66a8,8,0,0,1-11.32,0L64,123.31V152a8,8,0,0,1-16,0V104a8,8,0,0,1,13.66-5.66L88,124.69l26.34-26.35A8,8,0,0,1,128,104Zm77.66,18.34a8,8,0,0,1,0,11.32l-24,24a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L168,132.69V104a8,8,0,0,1,16,0v28.69l10.34-10.35A8,8,0,0,1,205.66,122.34Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,Z.jsxs)(qA,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i},YA=e=>{let t=(0,$.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`Textbox`}),r=(0,Z.jsx)(`path`,{d:`M112,40a8,8,0,0,0-8,8V64H24A16,16,0,0,0,8,80v96a16,16,0,0,0,16,16h80v16a8,8,0,0,0,16,0V48A8,8,0,0,0,112,40ZM24,176V80h80v96ZM248,80v96a16,16,0,0,1-16,16H144a8,8,0,0,1,0-16h88V80H144a8,8,0,0,1,0-16h88A16,16,0,0,1,248,80ZM88,112a8,8,0,0,1-8,8H72v24a8,8,0,0,1-16,0V120H48a8,8,0,0,1,0-16H80A8,8,0,0,1,88,112Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,Z.jsxs)(qA,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i};function XA(e){let t=(0,$.c)(90),{activeDocName:n,isSourceMode:r,sourceDisabled:a,onModeChange:o,showAddPropertyButton:c,onAddProperty:l,isPanelCollapsed:u,onTogglePanel:d}=e,{_:f}=i(),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=tc(`toggle-document-panel`),t[0]=p):p=t[0];let m=p,h,g,_,v,y,b,x,S,C,w,T,E,D,O;if(t[1]!==f||t[2]!==n||t[3]!==u||t[4]!==r||t[5]!==l||t[6]!==o||t[7]!==d||t[8]!==c||t[9]!==a){let e=rc(`toggle-document-panel`);v=`editor-toolbar`,y=`pointer-events-none absolute inset-x-0 top-0 z-10`;let i;t[24]===n?i=t[25]:(i=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex min-w-0 items-center`,children:(0,Z.jsx)(WA,{docName:n})}),t[24]=n,t[25]=i);let p=r?`source`:`wysiwyg`,m;t[26]===o?m=t[27]:(m=e=>{e&&o(e)},t[26]=o,t[27]=m);let k;t[28]===f?k=t[29]:(k=f({id:`n7aopT`}),t[28]=f,t[29]=k);let A;t[30]===f?A=t[31]:(A=f({id:`ur2XSb`}),t[30]=f,t[31]=A);let j;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Z.jsx)(js,{children:(0,Z.jsx)(YA,{className:`size-4`})}),t[32]=j):j=t[32];let M;t[33]===A?M=t[34]:(M=(0,Z.jsx)(bo,{value:`wysiwyg`,"aria-label":A,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,asChild:!0,children:j}),t[33]=A,t[34]=M);let N;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsx)(Ns,{side:`bottom`,children:(0,Z.jsx)(s,{id:`Mb_20S`})}),t[35]=N):N=t[35];let P;t[36]===M?P=t[37]:(P=(0,Z.jsxs)(Is,{children:[M,N]}),t[36]=M,t[37]=P);let F;t[38]===f?F=t[39]:(F=f({id:`xbdtfY`}),t[38]=f,t[39]=F);let I;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(JA,{className:`size-4`}),t[40]=I):I=t[40];let L;t[41]!==a||t[42]!==F?(L=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(`div`,{children:(0,Z.jsx)(bo,{value:`source`,"aria-label":F,disabled:a,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,children:I})})}),t[41]=a,t[42]=F,t[43]=L):L=t[43];let R;t[44]===a?R=t[45]:(R=(0,Z.jsx)(Ns,{side:`bottom`,children:a?(0,Z.jsx)(s,{id:`G-JBA1`}):(0,Z.jsx)(s,{id:`u6Hp4N`})}),t[44]=a,t[45]=R);let z;t[46]!==L||t[47]!==R?(z=(0,Z.jsxs)(Is,{children:[L,R]}),t[46]=L,t[47]=R,t[48]=z):z=t[48];let B;t[49]!==p||t[50]!==m||t[51]!==k||t[52]!==P||t[53]!==z?(B=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex justify-center`,children:(0,Z.jsxs)(So,{type:`single`,value:p,onValueChange:m,"aria-label":k,variant:`segmented`,size:`sm`,spacing:1,className:`shrink-0 data-[size=sm]:rounded-[10px] bg-muted p-0.5`,children:[P,z]})}),t[49]=p,t[50]=m,t[51]=k,t[52]=P,t[53]=z,t[54]=B):B=t[54],t[55]!==i||t[56]!==B?(b=(0,Z.jsx)(`div`,{className:`editor-content-aligned bg-background py-2`,children:(0,Z.jsxs)(`div`,{className:`grid grid-cols-3 items-center`,children:[i,B]})}),t[55]=i,t[56]=B,t[57]=b):b=t[57],O=`pointer-events-auto absolute top-0 right-0 flex items-center justify-end gap-1 py-2 pr-2`,t[58]!==f||t[59]!==l||t[60]!==c?(_=c&&(0,Z.jsxs)(Is,{children:[(0,Z.jsx)(li,{variant:`ghost`,size:`icon`,"aria-label":f({id:`81H_23`}),onClick:l,"data-testid":`add-properties-button`,asChild:!0,children:(0,Z.jsx)(js,{children:(0,Z.jsx)(Nl,{})})}),(0,Z.jsx)(Ns,{side:`bottom`,children:(0,Z.jsx)(s,{id:`81H_23`})})]}),t[58]=f,t[59]=l,t[60]=c,t[61]=_):_=t[61],g=Is,h=li,x=``,S=`ghost`,C=`icon`,w=d,T=!u,E=`doc-panel`,D=f(u?{id:`u7H-Wn`,values:{panelShortcutLabel:e}}:{id:`2hpdRq`,values:{panelShortcutLabel:e}}),t[1]=f,t[2]=n,t[3]=u,t[4]=r,t[5]=l,t[6]=o,t[7]=d,t[8]=c,t[9]=a,t[10]=h,t[11]=g,t[12]=_,t[13]=v,t[14]=y,t[15]=b,t[16]=x,t[17]=S,t[18]=C,t[19]=w,t[20]=T,t[21]=E,t[22]=D,t[23]=O}else h=t[10],g=t[11],_=t[12],v=t[13],y=t[14],b=t[15],x=t[16],S=t[17],C=t[18],w=t[19],T=t[20],E=t[21],D=t[22],O=t[23];let k;t[62]===u?k=t[63]:(k=(0,Z.jsx)(js,{children:u?(0,Z.jsx)(Hl,{}):(0,Z.jsx)(Vl,{})}),t[62]=u,t[63]=k);let A;t[64]!==h||t[65]!==k||t[66]!==x||t[67]!==S||t[68]!==C||t[69]!==w||t[70]!==T||t[71]!==E||t[72]!==D?(A=(0,Z.jsx)(h,{"data-doc-panel-toggle":x,variant:S,size:C,onClick:w,"aria-expanded":T,"aria-controls":E,"aria-label":D,asChild:!0,children:k}),t[64]=h,t[65]=k,t[66]=x,t[67]=S,t[68]=C,t[69]=w,t[70]=T,t[71]=E,t[72]=D,t[73]=A):A=t[73];let j;t[74]===u?j=t[75]:(j=(0,Z.jsx)(Ns,{side:`bottom`,children:u?(0,Z.jsx)(s,{id:`KFdXwz`,values:{panelShortcut:m}}):(0,Z.jsx)(s,{id:`MsuXaI`,values:{panelShortcut:m}})}),t[74]=u,t[75]=j);let M;t[76]!==g||t[77]!==A||t[78]!==j?(M=(0,Z.jsxs)(g,{children:[A,j]}),t[76]=g,t[77]=A,t[78]=j,t[79]=M):M=t[79];let N;t[80]!==_||t[81]!==M||t[82]!==O?(N=(0,Z.jsxs)(`div`,{className:O,children:[_,M]}),t[80]=_,t[81]=M,t[82]=O,t[83]=N):N=t[83];let P;t[84]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none h-2 bg-linear-to-b from-background to-transparent`}),t[84]=P):P=t[84];let F;return t[85]!==v||t[86]!==y||t[87]!==b||t[88]!==N?(F=(0,Z.jsxs)(`div`,{"data-testid":v,className:y,children:[b,N,P]}),t[85]=v,t[86]=y,t[87]=b,t[88]=N,t[89]=F):F=t[89],F}function ZA(e){let{activeDocName:t,deferredActiveDocName:n,mountResolved:r,syncResolved:i}=e;return t===null||t===n?!1:!(r&&i)}function QA(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,orientation:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`horizontal`:i,o;t[4]===n?o=t[5]:(o=si(`group/tabs flex gap-2 data-horizontal:flex-col`,n),t[4]=n,t[5]=o);let s;return t[6]!==a||t[7]!==r||t[8]!==o?(s=(0,Z.jsx)(Vd,{"data-slot":`tabs`,"data-orientation":a,className:o,...r}),t[6]=a,t[7]=r,t[8]=o,t[9]=s):s=t[9],s}var $A=ai(`group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function ej(e){let t=(0,$.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,variant:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`default`:i,o;t[4]!==n||t[5]!==a?(o=si($A({variant:a}),n),t[4]=n,t[5]=a,t[6]=o):o=t[6];let s;return t[7]!==r||t[8]!==o||t[9]!==a?(s=(0,Z.jsx)(Hd,{"data-slot":`tabs-list`,"data-variant":a,className:o,...r}),t[7]=r,t[8]=o,t[9]=a,t[10]=s):s=t[10],s}function tj(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=si(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent`,`data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Ud,{"data-slot":`tabs-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function nj(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=si(`flex-1 text-sm outline-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Wd,{"data-slot":`tabs-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var rj=`ok-terminal-height-v1`,ij=.5;function aj(e){return Math.max(120,Math.round((Number.isFinite(e)?e:0)*ij))}function oj(e,t){let n=aj(t);return Number.isFinite(e)?e<120?120:e>n?n:Math.round(e):Math.min(240,n)}function sj(){return typeof window>`u`?0:window.innerHeight}function cj(e,t){try{let n=e??localStorage,r=t??sj(),i=n.getItem(rj);if(i==null)return oj(240,r);let a=Number.parseInt(i,10);return oj(Number.isFinite(a)?a:240,r)}catch{return 240}}function lj(e,t,n){try{let r=t??localStorage,i=n??sj();r.setItem(rj,String(oj(e,i)))}catch{}}function uj(){try{return typeof localStorage>`u`?240:cj()}catch{return 240}}var dj=(0,Q.lazy)(()=>n(()=>import(`./TerminalPanel-DcDjQXhj.js`).then(e=>({default:e.TerminalPanel})),__vite__mapDeps([57,1,22,6,3,23,9,11,58,59]),import.meta.url));function fj(e){let t=(0,$.c)(11),{bridge:n,onClose:r,launch:a}=e,o=a===void 0?null:a,{enabled:s,synced:c}=ji(),l=uo(),{_:u}=i(),d=c&&s===!1,f;t[0]!==u||t[1]!==l?(f=function(){if(l===null){X.error(u({id:`V_6bJ4`}));return}let e=l(!0);e.ok||X.error(u({id:`jKd3AP`,values:{0:e.error}}))},t[0]=u,t[1]=l,t[2]=f):f=t[2];let p=f;if(c&&!d){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(`div`,{className:`h-full w-full bg-background`,"aria-hidden":`true`}),t[3]=e):e=t[3];let i;return t[4]!==n||t[5]!==o||t[6]!==r?(i=(0,Z.jsx)(le,{fallbackRender:mj,onError:pj,children:(0,Z.jsx)(Q.Suspense,{fallback:e,children:(0,Z.jsx)(dj,{bridge:n,className:`h-full`,onClose:r,launch:o})})}),t[4]=n,t[5]=o,t[6]=r,t[7]=i):i=t[7],i}let m;return t[8]!==p||t[9]!==d?(m=d?(0,Z.jsx)(_j,{onEnable:p}):(0,Z.jsx)(`div`,{className:`h-full w-full bg-background`,"aria-hidden":`true`}),t[8]=p,t[9]=d,t[10]=m):m=t[10],m}function pj(e,t){console.error(`[TerminalGate] rendered fallback for the terminal panel`,e,t.componentStack)}function mj(e){return(0,Z.jsx)(hj,{...e})}function hj(e){let t=(0,$.c)(15),{error:n}=e,{_:r}=i(),a;t[0]!==r||t[1]!==n?(a=n instanceof Error&&/dynamically imported module|Failed to fetch/i.test(n.message)?r({id:`Y8ViJx`}):r({id:`fbsiBw`}),t[0]=r,t[1]=n,t[2]=a):a=t[2];let o=a,s;t[3]===r?s=t[4]:(s=r({id:`6MnZEC`}),t[3]=r,t[4]=s);let c;t[5]===o?c=t[6]:(c=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-foreground`,children:o}),t[5]=o,t[6]=c);let l;t[7]===r?l=t[8]:(l=r({id:`HpK_8d`}),t[7]=r,t[8]=l);let u;t[9]===l?u=t[10]:(u=(0,Z.jsx)(li,{onClick:gj,children:l}),t[9]=l,t[10]=u);let d;return t[11]!==s||t[12]!==c||t[13]!==u?(d=(0,Z.jsxs)(`section`,{"aria-label":s,className:`flex h-full w-full flex-col items-center justify-center gap-3 bg-background p-6 text-center`,role:`alert`,children:[c,u]}),t[11]=s,t[12]=c,t[13]=u,t[14]=d):d=t[14],d}function gj(){return window.location.reload()}function _j(e){let t=(0,$.c)(20),{onEnable:n}=e,{_:r}=i(),a;t[0]===r?a=t[1]:(a=r({id:`_XWY2J`}),t[0]=r,t[1]=a);let o;t[2]===r?o=t[3]:(o=r({id:`oYepHb`}),t[2]=r,t[3]=o);let s;t[4]===o?s=t[5]:(s=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-foreground`,children:o}),t[4]=o,t[5]=s);let c;t[6]===r?c=t[7]:(c=r({id:`v2ZW0K`}),t[6]=r,t[7]=c);let l;t[8]!==n||t[9]!==c?(l=(0,Z.jsx)(li,{onClick:n,children:c}),t[8]=n,t[9]=c,t[10]=l):l=t[10];let u;t[11]===r?u=t[12]:(u=r({id:`ICoNYz`}),t[11]=r,t[12]=u);let d;t[13]===u?d=t[14]:(d=(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:u}),t[13]=u,t[14]=d);let f;return t[15]!==a||t[16]!==s||t[17]!==l||t[18]!==d?(f=(0,Z.jsxs)(`section`,{"aria-label":a,className:`flex h-full w-full flex-col items-center justify-center gap-3 bg-background p-6 text-center`,children:[s,l,d]}),t[15]=a,t[16]=s,t[17]=l,t[18]=d,t[19]=f):f=t[19],f}function vj(e){let t=(0,$.c)(33),{sessions:n,activeSessionId:r,onSelect:a,onTabActivate:o,onNew:s,onClose:c,children:l,className:u}=e,{_:d}=i(),f;t[0]===u?f=t[1]:(f=si(`flex min-h-0 min-w-0 flex-1 flex-col`,u),t[0]=u,t[1]=f);let p;t[2]===d?p=t[3]:(p=d({id:`1MGRQl`}),t[2]=d,t[3]=p);let m;if(t[4]!==d||t[5]!==r||t[6]!==c||t[7]!==o||t[8]!==n){let e;t[10]!==d||t[11]!==r||t[12]!==c||t[13]!==o?(e=e=>{let t=e.id===r;return(0,Z.jsxs)(`div`,{className:si(`flex shrink-0 items-center rounded-md pr-0.5 transition-colors`,t?`bg-muted`:`hover:bg-muted/50`),children:[(0,Z.jsx)(tj,{value:e.id,onClick:()=>o?.(e.id),className:`h-7 flex-none rounded-md px-2 text-xs`,children:(0,Z.jsx)(`span`,{className:`max-w-40 truncate`,children:e.label})}),(0,Z.jsx)(li,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":d({id:`nzHlj8`,values:{0:e.label}}),tabIndex:t?0:-1,className:`text-muted-foreground hover:text-foreground`,onClick:t=>{t.stopPropagation(),c(e.id)},children:(0,Z.jsx)(gs,{"aria-hidden":`true`})})]},e.id)},t[10]=d,t[11]=r,t[12]=c,t[13]=o,t[14]=e):e=t[14],m=n.map(e),t[4]=d,t[5]=r,t[6]=c,t[7]=o,t[8]=n,t[9]=m}else m=t[9];let h;t[15]!==p||t[16]!==m?(h=(0,Z.jsx)(ej,{variant:`line`,"aria-label":p,className:`flex h-auto min-w-0 flex-1 items-center justify-start gap-0.5 overflow-x-auto bg-transparent p-0 [scrollbar-width:none]`,children:m}),t[15]=p,t[16]=m,t[17]=h):h=t[17];let g;t[18]===d?g=t[19]:(g=d({id:`ZBxvV3`}),t[18]=d,t[19]=g);let _;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(V,{"aria-hidden":`true`}),t[20]=_):_=t[20];let v;t[21]!==s||t[22]!==g?(v=(0,Z.jsx)(li,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":g,className:`shrink-0 text-muted-foreground hover:text-foreground`,onClick:s,children:_}),t[21]=s,t[22]=g,t[23]=v):v=t[23];let y;t[24]!==h||t[25]!==v?(y=(0,Z.jsxs)(`div`,{className:`flex shrink-0 flex-row items-center gap-1 px-1.5 py-1`,children:[h,v]}),t[24]=h,t[25]=v,t[26]=y):y=t[26];let b;return t[27]!==r||t[28]!==l||t[29]!==a||t[30]!==f||t[31]!==y?(b=(0,Z.jsxs)(QA,{value:r,onValueChange:a,className:f,children:[y,l]}),t[27]=r,t[28]=l,t[29]=a,t[30]=f,t[31]=y,t[32]=b):b=t[32],b}var yj=`terminal-dock-panel`;function bj(e){return`terminal-session-${e}`}function xj(e){e!==``&&document.querySelector(`[data-terminal-session="${e}"] .xterm-helper-textarea`)?.focus()}function Sj(e){let t=(0,$.c)(77),{bridge:n,children:r,visible:a,onVisibleChange:o,launch:s}=e,c=s===void 0?null:s,{_:l}=i(),{resolvedTheme:u}=Pr(),d=Sx(),f=(0,Q.useRef)(null),[p,m]=(0,Q.useState)(!a),h;t[0]!==c||t[1]!==a?(h=()=>a?[{id:bj(1),launch:c}]:[],t[0]=c,t[1]=a,t[2]=h):h=t[2];let[g,_]=(0,Q.useState)(h),v;t[3]===a?v=t[4]:(v=()=>a?bj(1):``,t[3]=a,t[4]=v);let[y,b]=(0,Q.useState)(v),x=(0,Q.useRef)(y),S=(0,Q.useRef)(g),C=(0,Q.useRef)(+!!a),w=(0,Q.useRef)(a&&c?c.nonce:null),T=(0,Q.useRef)(a),E;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(E=function(e){C.current+=1;let t=bj(C.current);_(n=>[...n,{id:t,launch:e}]),b(t)},t[5]=E):E=t[5];let D=E,O=(0,Q.useRef)(D),k;t[6]!==y||t[7]!==o?(k=function(e){let t=S.current,n=t.findIndex(t=>t.id===e);if(n===-1)return;let r=t.filter(t=>t.id!==e);if(e===y){let e=(t[n-1]??t[n+1])?.id??``;b(e),e!==``&&queueMicrotask(()=>xj(e))}_(r),r.length===0&&(o(!1),f.current?.focus())},t[6]=y,t[7]=o,t[8]=k):k=t[8];let A=k,j=(0,Q.useRef)(Tj),M;t[9]!==y||t[10]!==A||t[11]!==g?(M=()=>{O.current=D,x.current=y,S.current=g,j.current=()=>{y!==``&&A(y)}},t[9]=y,t[10]=A,t[11]=g,t[12]=M):M=t[12],(0,Q.useEffect)(M);let[N]=(0,Q.useState)(wj),P=(0,Q.useRef)(N),[F,I]=(0,Q.useState)(!1),L=(0,Q.useRef)(!1),R=(0,Q.useRef)(null),z;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(z=function(e){R.current!=null&&clearTimeout(R.current),R.current=setTimeout(()=>{lj(e),R.current=null},100)},t[13]=z):z=t[13];let B=z,V=(0,Q.useRef)(null),H,U;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(H=()=>()=>{R.current!=null&&clearTimeout(R.current),V.current!=null&&(window.removeEventListener(`pointerup`,V.current),V.current=null)},U=[],t[14]=H,t[15]=U):(H=t[14],U=t[15]),(0,Q.useEffect)(H,U);let W,G;t[16]!==c||t[17]!==g.length||t[18]!==a?(W=()=>{let e=T.current;if(T.current=a,c!=null&&c.nonce!==w.current){w.current=c.nonce,O.current(c);return}a&&!e&&g.length===0&&O.current(null)},G=[a,c,g.length],t[16]=c,t[17]=g.length,t[18]=a,t[19]=W,t[20]=G):(W=t[19],G=t[20]),(0,Q.useEffect)(W,G);let K,q;t[21]===n?(K=t[22],q=t[23]):(K=()=>n.onMenuAction(e=>{e===`new-terminal`?O.current(null):e===`kill-terminal`&&j.current()}),q=[n],t[21]=n,t[22]=K,t[23]=q),(0,Q.useEffect)(K,q);let J,ee;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(J=()=>{let e=function(e){if(!e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||!/^[1-9]$/.test(e.key)||!document.getElementById(yj)?.contains(document.activeElement))return;let t=S.current[Number(e.key)-1];t!=null&&(e.preventDefault(),e.stopPropagation(),b(t.id),queueMicrotask(()=>xj(t.id)))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},ee=[],t[24]=J,t[25]=ee):(J=t[24],ee=t[25]),(0,Q.useEffect)(J,ee);let te;t[26]!==n.editor||t[27]!==g.length?(te=()=>{n.editor.notifyViewMenuStateChanged({terminalLive:g.length>0})},t[26]=n.editor,t[27]=g.length,t[28]=te):te=t[28];let ne;t[29]!==n||t[30]!==g.length?(ne=[n,g.length],t[29]=n,t[30]=g.length,t[31]=ne):ne=t[31],(0,Q.useEffect)(te,ne);let re,Y;t[32]!==d||t[33]!==a?(re=()=>{let e=d.current;e!=null&&(a?e.resize(`${P.current}px`):e.collapse())},Y=[a,d],t[32]=d,t[33]=a,t[34]=re,t[35]=Y):(re=t[34],Y=t[35]),(0,Q.useEffect)(re,Y);let ie,ae;t[36]===p?(ie=t[37],ae=t[38]):(ie=()=>{p&&document.getElementById(yj)?.contains(document.activeElement)&&f.current?.focus()},ae=[p],t[36]=p,t[37]=ie,t[38]=ae),(0,Q.useLayoutEffect)(ie,ae);let oe,se;t[39]===p?(oe=t[40],se=t[41]):(oe=()=>{p||xj(x.current)},se=[p],t[39]=p,t[40]=oe,t[41]=se),(0,Q.useEffect)(oe,se);let ce;if(t[42]!==l||t[43]!==g){let e;t[45]===l?e=t[46]:(e=(e,t)=>({id:e.id,label:l({id:`OVjNeX`,values:{0:t+1}})}),t[45]=l,t[46]=e),ce=g.map(e),t[42]=l,t[43]=g,t[44]=ce}else ce=t[44];let le=ce,ue=F||void 0,de;t[47]===r?de=t[48]:(de=(0,Z.jsx)(WC,{minSize:`5%`,className:`flex min-h-0 flex-col`,children:(0,Z.jsx)(`div`,{ref:f,tabIndex:-1,className:`flex h-full min-h-0 flex-col outline-none`,children:r})}),t[47]=r,t[48]=de);let fe;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(fe=(0,Z.jsx)(GC,{withHandle:!0,onPointerDown:()=>{I(!0),L.current=!0;let e=()=>{I(!1),L.current=!1,window.removeEventListener(`pointerup`,e),V.current=null};V.current=e,window.addEventListener(`pointerup`,e)}}),t[49]=fe):fe=t[49];let pe;t[50]===u?pe=t[51]:(pe=Lc(u),t[50]=u,t[51]=pe);let me;t[52]===pe.background?me=t[53]:(me={backgroundColor:pe.background},t[52]=pe.background,t[53]=me);let he=a?`${N}px`:0,ge;t[54]!==o||t[55]!==a?(ge=e=>{let t=e.asPercentage===0;m(t),L.current&&(t&&a?o(!1):!t&&!a&&o(!0),e.inPixels>0&&(P.current=e.inPixels,B(e.inPixels)))},t[54]=o,t[55]=a,t[56]=ge):ge=t[56];let _e=!F&&`transition-[flex-grow] duration-150 ease-out motion-reduce:transition-none motion-reduce:duration-0`,ve;t[57]===_e?ve=t[58]:(ve=si(`flex flex-col`,_e),t[57]=_e,t[58]=ve);let ye;t[59]!==y||t[60]!==n||t[61]!==A||t[62]!==g||t[63]!==le?(ye=g.length>0?(0,Z.jsx)(vj,{sessions:le,activeSessionId:y,onSelect:b,onTabActivate:Cj,onNew:()=>D(null),onClose:A,className:`h-full`,children:g.map(e=>(0,Z.jsx)(nj,{value:e.id,forceMount:!0,"data-terminal-session":e.id,className:`m-0 flex min-h-0 flex-1 flex-col overflow-hidden data-[state=inactive]:hidden`,children:(0,Z.jsx)(fj,{bridge:n,launch:e.launch,onClose:()=>A(e.id)})},e.id))}):null,t[59]=y,t[60]=n,t[61]=A,t[62]=g,t[63]=le,t[64]=ye):ye=t[64];let be;t[65]!==p||t[66]!==d||t[67]!==me||t[68]!==he||t[69]!==ge||t[70]!==ve||t[71]!==ye?(be=(0,Z.jsx)(WC,{id:yj,style:me,panelRef:d,defaultSize:he,minSize:`120px`,maxSize:`95%`,collapsible:!0,collapsedSize:0,onResize:ge,inert:p,className:ve,children:ye}),t[65]=p,t[66]=d,t[67]=me,t[68]=he,t[69]=ge,t[70]=ve,t[71]=ye,t[72]=be):be=t[72];let xe;return t[73]!==ue||t[74]!==de||t[75]!==be?(xe=(0,Z.jsxs)(UC,{orientation:`vertical`,className:`min-h-0 flex-1`,"data-dragging":ue,children:[de,fe,be]}),t[73]=ue,t[74]=de,t[75]=be,t[76]=xe):xe=t[76],xe}function Cj(e){return queueMicrotask(()=>xj(e))}function wj(){return uj()}function Tj(){}var Ej=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-DUAxBa3K.js`),__vite__mapDeps([36,1,2,37,38,39,23,40,41,42,43,44,45,46,47,14,6,8,9,22,3,24,4,12,10,11,48,49]),import.meta.url)).ActivityModeContent}));function Dj(e){let t=(0,$.c)(5),n;t[0]===e?n=t[1]:(n=(0,Z.jsx)(kj,{...e}),t[0]=e,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(Oj,{}),t[2]=r):r=t[2];let i;return t[3]===n?i=t[4]:(i=(0,Z.jsx)(Gt,{name:`editor-area`,children:(0,Z.jsxs)(DC,{children:[n,r]})}),t[3]=n,t[4]=i),i}function Oj(){let e=(0,$.c)(5),t=Eg(),n;e[0]===t?n=e[1]:(n=e=>{e||t.close()},e[0]=t,e[1]=n);let r;return e[2]!==t.open||e[3]!==n?(r=(0,Z.jsx)(RC,{open:t.open,onOpenChange:n}),e[2]=t.open,e[3]=n,e[4]=r):r=e[4],r}function kj(e){let t=(0,$.c)(148),{editorMode:n,onModeChange:r,activeTab:a,onActiveTabChange:o,terminalBridge:c,terminalVisible:l,onTerminalVisibleChange:u,terminalLaunch:d}=e,f=l===void 0?!1:l,p=d===void 0?null:d,{_:m}=i(),{activeDocName:h,activeProvider:g,activeTarget:_,recycleDocument:v,docPanelMode:y,docPanelAgentId:b,docPanelExpandSignal:S}=ht(),{openDocumentTransition:C}=Ot(),{requestAddProperty:w}=kC(),T=pw(g,h),E=gw(h,n===`source`?`source`:`wysiwyg`),D=Iw(g),O=D===`connected`||D===`synced`,k=hw(h)===`conflict`,A=(0,Q.useDeferredValue)(h),j=_?.kind===`missing`,M=!!h&&_?.kind!==`folder`,N;t[0]!==m||t[1]!==j?(N=j?m({id:`K-a33w`}):void 0,t[0]=m,t[1]=j,t[2]=N):N=t[2];let P=N,[F]=(0,Q.useState)(Mj),I=F!==null,L;t[3]===F?L=t[4]:(L=()=>Tw(F,window.innerWidth,`right`),t[3]=F,t[4]=L);let[R,z]=(0,Q.useState)(L),B=(0,Q.useRef)(R),V,H;t[5]===R?(V=t[6],H=t[7]):(V=()=>{B.current=R},H=[R],t[5]=R,t[6]=V,t[7]=H),(0,Q.useEffect)(V,H);let U=Sx(),W;t[8]===R?W=t[9]:(W=()=>Pw(`right`,R,Mw())===`collapsed`,t[8]=R,t[9]=W);let[G]=(0,Q.useState)(W),[K,q]=(0,Q.useState)(G),J=(0,Q.useRef)(K),ee,te;t[10]===K?(ee=t[11],te=t[12]):(ee=()=>{J.current=K},te=[K],t[10]=K,t[11]=ee,t[12]=te),(0,Q.useEffect)(ee,te);let[ne,re]=(0,Q.useState)(!1),Y=(0,Q.useRef)(!1),[ie]=(0,Q.useState)(jj),ae=(0,Q.useRef)(ie),oe=(0,Q.useRef)(null),se;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(se=function(e){oe.current!=null&&clearTimeout(oe.current),oe.current=setTimeout(()=>{bw(e),oe.current=null},100)},t[13]=se):se=t[13];let ce=se,le,ue;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(le=()=>()=>{oe.current!=null&&clearTimeout(oe.current)},ue=[],t[14]=le,t[15]=ue):(le=t[14],ue=t[15]),(0,Q.useEffect)(le,ue);let[de,fe]=(0,Q.useState)(null),pe;t[16]!==K||t[17]!==U?(pe=function(){if(U.current==null)return;let e=B.current;K?(Fw(`right`,e,`open`),U.current?.expand()):(Fw(`right`,e,`collapsed`),U.current?.collapse())},t[16]=K,t[17]=U,t[18]=pe):pe=t[18];let me=pe,he,ge;t[19]!==F||t[20]!==U?(he=()=>{let e=window.matchMedia(`(min-width: ${Cw}px)`),t=()=>{let e=Tw(F,window.innerWidth,`right`);z(e);let t=Pw(`right`,e,Mw())===`collapsed`;q(t),t?U.current?.collapse():U.current?.expand()};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},ge=[F,U],t[19]=F,t[20]=U,t[21]=he,t[22]=ge):(he=t[21],ge=t[22]),(0,Q.useEffect)(he,ge);let _e,ve;t[23]!==de||t[24]!==I||t[25]!==U?(_e=()=>{if(de==null||I)return;let e=new ResizeObserver(()=>{J.current||Y.current||U.current?.resize(`${ae.current}px`)});return e.observe(de),()=>e.disconnect()},ve=[de,I,U],t[23]=de,t[24]=I,t[25]=U,t[26]=_e,t[27]=ve):(_e=t[26],ve=t[27]),(0,Q.useEffect)(_e,ve);let ye,be;t[28]!==o||t[29]!==U?(ye=()=>{let e=e=>{o(e),U.current?.expand()},t=Eh();return t&&e(t),Oh(t=>{Eh(),e(t)})},be=[o,U],t[28]=o,t[29]=U,t[30]=ye,t[31]=be):(ye=t[30],be=t[31]),(0,Q.useEffect)(ye,be);let xe,Se;t[32]!==S||t[33]!==U?(xe=()=>{S!==0&&U.current?.expand()},Se=[S,U],t[32]=S,t[33]=U,t[34]=xe,t[35]=Se):(xe=t[34],Se=t[35]),(0,Q.useEffect)(xe,Se);let Ce,we;t[36]===K?(Ce=t[37],we=t[38]):(Ce=()=>{if(!K||!document.getElementById(`doc-panel`)?.contains(document.activeElement))return;let e=document.querySelector(`[data-doc-panel-toggle]`);if(e){e.focus();return}document.querySelector(`[data-sidebar="trigger"]`)?.focus()},we=[K],t[36]=K,t[37]=Ce,t[38]=we),(0,Q.useLayoutEffect)(Ce,we);let Te,Ee;t[39]===K?(Te=t[40],Ee=t[41]):(Te=()=>{window.okDesktop!=null&&window.okDesktop.editor.notifyViewMenuStateChanged({docPanelVisible:!K})},Ee=[K],t[39]=K,t[40]=Te,t[41]=Ee),(0,Q.useEffect)(Te,Ee);let De,Oe;t[42]===me?(De=t[43],Oe=t[44]):(De=()=>{if(window.okDesktop!=null)return window.okDesktop.onMenuAction(e=>{e===`toggle-doc-panel`&&me()})},Oe=[me],t[42]=me,t[43]=De,t[44]=Oe),(0,Q.useEffect)(De,Oe);let ke,Ae;t[45]===me?(ke=t[46],Ae=t[47]):(ke=()=>{if(window.okDesktop!=null)return;let e=e=>{nc(e,`toggle-document-panel`)&&(e.preventDefault(),me())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},Ae=[me],t[45]=me,t[46]=ke,t[47]=Ae),(0,Q.useEffect)(ke,Ae);let je=(0,Q.useRef)(null),[Me,Ne]=(0,Q.useState)(null),Pe=_?.kind===`large-file`?_.docName:h,Fe,Ie;t[48]===Pe?(Fe=t[49],Ie=t[50]):(Fe=()=>{if(Pe&&Pe!==je.current){let e=je.current;je.current=Pe,Ne(e)}},Ie=[Pe],t[48]=Pe,t[49]=Fe,t[50]=Ie),(0,Q.useEffect)(Fe,Ie);let Le;t[51]===C?Le=t[52]:(Le=function(e){let t=Ho(e);window.location.hash===t?C(e):window.location.hash=t},t[51]=C,t[52]=Le);let Re=Le,ze,Be=null;if(_?.kind===`large-file`){let e;t[53]!==Re||t[54]!==Me?(e=Me?{previousDocName:Me,onNavigateBack:Re}:void 0,t[53]=Re,t[54]=Me,t[55]=e):e=t[55];let n;t[56]!==_.docName||t[57]!==_.limit||t[58]!==_.size||t[59]!==e?(n=(0,Z.jsx)(CC,{docName:_.docName,size:_.size,limit:_.limit,backNav:e}),t[56]=_.docName,t[57]=_.limit,t[58]=_.size,t[59]=e,t[60]=n):n=t[60],ze=n}else if(_?.kind===`folder`){let e;if(t[61]===_.folderPath?e=t[62]:(e=(0,Z.jsx)(yC,{folderPath:_.folderPath}),t[61]=_.folderPath,t[62]=e),ze=e,y===`agent`&&b!==null){let e;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(GC,{withHandle:!0}),t[63]=e):e=t[63];let n;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(Z.Fragment,{children:[e,(0,Z.jsx)(WC,{id:`agent-panel`,defaultSize:`25%`,minSize:`300px`,maxSize:`40%`,className:`flex flex-col bg-muted/20`,children:(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(`div`,{role:`status`,"aria-busy":`true`,className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`ONPvOb`})}),children:(0,Z.jsx)(Ej,{showBackButton:!1})})})]}),t[64]=n):n=t[64],Be=n}}else if(_?.kind===`asset`){let e;t[65]!==_.assetPath||t[66]!==_.mediaKind?(e=(0,Z.jsx)(Fx,{assetPath:_.assetPath,mediaKind:_.mediaKind},_.assetPath),t[65]=_.assetPath,t[66]=_.mediaKind,t[67]=e):e=t[67],ze=e}else if(!g||!h){if((typeof window<`u`?as(window.location.hash):null)!==null){let e;return t[68]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Ix,{}),t[68]=e):e=t[68],e}let e;t[69]===f?e=t[70]:(e=(0,Z.jsx)(zS,{terminalVisible:f}),t[69]=f,t[70]=e),ze=e}else{let e=n===`source`,i=!O,s=K,c;t[71]!==h||t[72]!==w?(c=function(){h&&w(h)},t[71]=h,t[72]=w,t[73]=c):c=t[73];let l=c,u=A??h,d=Me??void 0,f;t[74]!==P||t[75]!==e||t[76]!==Re||t[77]!==v||t[78]!==u||t[79]!==d?(f=(0,Z.jsx)(Vk,{activeDocName:u,isSourceMode:e,editorPlaceholder:P,previousDocName:d,onNavigateBack:Re,onRecycle:v}),t[74]=P,t[75]=e,t[76]=Re,t[77]=v,t[78]=u,t[79]=d,t[80]=f):f=t[80];let p;t[81]!==h||t[82]!==e?(p=(0,Z.jsx)(lw,{activeDocName:h,isSourceMode:e}),t[81]=h,t[82]=e,t[83]=p):p=t[83];let m;t[84]!==h||t[85]!==A?(m=ZA({activeDocName:h,deferredActiveDocName:A,mountResolved:h!==null&&x(h),syncResolved:h!==null&&Ve(h)})?(0,Z.jsxs)(`div`,{className:`absolute inset-0 z-10 bg-background`,children:[(0,Z.jsx)(Ix,{}),h===null?null:(0,Z.jsx)(wC,{docName:h})]}):null,t[84]=h,t[85]=A,t[86]=m):m=t[86];let g;t[87]!==f||t[88]!==p||t[89]!==m?(g=(0,Z.jsxs)(`div`,{className:`relative h-full`,children:[f,p,m]}),t[87]=f,t[88]=p,t[89]=m,t[90]=g):g=t[90];let _;t[91]!==h||t[92]!==k||t[93]!==s||t[94]!==e||t[95]!==r||t[96]!==l||t[97]!==i||t[98]!==me?(_=!k&&(0,Z.jsx)(XA,{activeDocName:h,isSourceMode:e,sourceDisabled:i,onModeChange:r,showAddPropertyButton:!e,onAddProperty:l,isPanelCollapsed:s,onTogglePanel:me}),t[91]=h,t[92]=k,t[93]=s,t[94]=e,t[95]=r,t[96]=l,t[97]=i,t[98]=me,t[99]=_):_=t[99];let b;t[100]!==g||t[101]!==_?(b=(0,Z.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[g,_]}),t[100]=g,t[101]=_,t[102]=b):b=t[102];let S;t[103]!==E||t[104]!==M||t[105]!==T?(S=(0,Z.jsx)(PA,{stats:T,selectionStats:E,showStats:M}),t[103]=E,t[104]=M,t[105]=T,t[106]=S):S=t[106];let C;t[107]!==b||t[108]!==S?(C=(0,Z.jsxs)(`div`,{className:`relative flex h-full flex-col`,children:[b,S]}),t[107]=b,t[108]=S,t[109]=C):C=t[109],ze=C;let D=I&&K,j;t[110]===Symbol.for(`react.memo_cache_sentinel`)?(j=()=>{re(!0),Y.current=!0;let e=()=>{re(!1),Y.current=!1,window.removeEventListener(`pointerup`,e)};window.addEventListener(`pointerup`,e)},t[110]=j):j=t[110];let N;t[111]===D?N=t[112]:(N=(0,Z.jsx)(GC,{withHandle:!0,disabled:D,onPointerDown:j}),t[111]=D,t[112]=N);let F=G?0:`${ie}px`,L;t[113]===Symbol.for(`react.memo_cache_sentinel`)?(L=e=>{q(e.asPercentage===0),e.inPixels>0&&Y.current&&(ae.current=e.inPixels,ce(e.inPixels))},t[113]=L):L=t[113];let R=!ne&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,z;t[114]===R?z=t[115]:(z=si(`flex flex-col bg-muted/20`,R),t[114]=R,t[115]=z);let B;t[116]!==h||t[117]!==a||t[118]!==y||t[119]!==e||t[120]!==o?(B=(0,Z.jsx)(Oy,{docName:h,isSourceMode:e,activeTab:a,onActiveTabChange:o,mode:y}),t[116]=h,t[117]=a,t[118]=y,t[119]=e,t[120]=o,t[121]=B):B=t[121];let V;t[122]!==K||t[123]!==U||t[124]!==F||t[125]!==z||t[126]!==B?(V=(0,Z.jsx)(WC,{id:`doc-panel`,panelRef:U,defaultSize:F,minSize:`300px`,maxSize:`600px`,collapsible:!0,collapsedSize:0,onResize:L,inert:K,className:z,children:B}),t[122]=K,t[123]=U,t[124]=F,t[125]=z,t[126]=B,t[127]=V):V=t[127];let H;t[128]!==N||t[129]!==V?(H=(0,Z.jsxs)(Z.Fragment,{children:[N,V]}),t[128]=N,t[129]=V,t[130]=H):H=t[130],Be=H}let He;t[131]!==u||t[132]!==c||t[133]!==p||t[134]!==f||t[135]!==ze?(He=c==null?ze:(0,Z.jsx)(Sj,{bridge:c,visible:f,onVisibleChange:u??Aj,launch:p,children:ze}),t[131]=u,t[132]=c,t[133]=p,t[134]=f,t[135]=ze,t[136]=He):He=t[136];let Ue=He,We=ne||void 0,Ge;t[137]!==G||t[138]!==Be?(Ge=Be!=null&&!G?{}:{defaultSize:`100%`},t[137]=G,t[138]=Be,t[139]=Ge):Ge=t[139];let Ke=ne?void 0:`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,qe;t[140]!==Ue||t[141]!==Ge||t[142]!==Ke?(qe=(0,Z.jsx)(WC,{minSize:`30%`,...Ge,className:Ke,children:Ue}),t[140]=Ue,t[141]=Ge,t[142]=Ke,t[143]=qe):qe=t[143];let Je;return t[144]!==Be||t[145]!==We||t[146]!==qe?(Je=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1`,ref:fe,children:(0,Z.jsxs)(UC,{orientation:`horizontal`,"data-dragging":We,children:[qe,Be]})}),t[144]=Be,t[145]=We,t[146]=qe,t[147]=Je):Je=t[147],Je}function Aj(){}function jj(){return xw()}function Mj(){return kr()}function Nj(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r.kind!==i.kind)return!1;if(r.kind===`human`&&i.kind===`human`){if(r.clientId!==i.clientId||r.mode!==i.mode||r.tabCount!==i.tabCount)return!1;let e=r.user,t=i.user;if(e.name!==t.name||e.color!==t.color||e.icon!==t.icon)return!1}else if(r.kind===`agent`&&i.kind===`agent`){if(r.agentId!==i.agentId)return!1;let e=r.presence,t=i.presence;if(e.displayName!==t.displayName||e.icon!==t.icon||e.color!==t.color||e.currentDoc!==t.currentDoc||e.mode!==t.mode)return!1}}return!0}function Pj(e){let t=new Map;for(let n of e){let e=n.user.principalId;if(typeof e==`string`&&e.length>0){let r=t.get(e);r?r.push(n):t.set(e,[n])}}let n=new Map;for(let[e,r]of t){let t=r.reduce((e,t)=>Math.min(e,t.clientId),1/0);n.set(e,{repClientId:t,count:r.length})}let r=[];for(let t of e){let e=t.user.principalId;if(typeof e==`string`&&e.length>0){let i=n.get(e);i&&i.repClientId===t.clientId&&r.push({...t,tabCount:i.count})}else r.push({...t,tabCount:1})}return r}var Fj=1e3,Ij=!1;function Lj(e){return!!(e.localPrincipalId&&e.entryPrincipalId===e.localPrincipalId||!e.localPrincipalId&&e.entryClientId===e.localClientId)}function Rj(e,t,n){let r=(0,$.c)(9),i;r[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={current:[],crossDoc:[]},r[0]=i):i=r[0];let[a,o]=(0,Q.useState)(i),s;r[1]!==n||r[2]!==e?.awareness||r[3]!==t?.awareness?(s=()=>{let r=e?.awareness,i=t?.awareness,a;i==null?a=void 0:Ci(i)?a=i:(a=void 0,Ij||(Ij=!0,console.warn(`[agent-presence] __system__ provider awareness missing getStates() — presence bar will render without agent peers`)));let s=()=>{let e=(r?.getLocalState())?.user?.principalId??null,t=r?.clientID??null,i=[];if(r)for(let[n,a]of r.getStates().entries()){let r=a;if(!r.user||typeof r.user!=`object`)continue;let o=r.user;o.type===`human`&&(Lj({entryPrincipalId:o.principalId,entryClientId:n,localPrincipalId:e,localClientId:t})||i.push({kind:`human`,clientId:n,user:o,mode:r.mode??`wysiwyg`,tabCount:1}))}let s=Pj(i),{current:c,crossDoc:l}=a?vi(a,n,Date.now()):{current:[],crossDoc:[]},u=zj,d=c.map(u),f=l.map(u),p=[...s,...d],m=f;o(e=>Nj(e.current,p)&&Nj(e.crossDoc,m)?e:{current:p,crossDoc:m})};s();let c=()=>s(),l=()=>s();r?.on(`change`,c),t?.awareness?.on(`change`,l);let u=setInterval(s,Fj);return()=>{r?.off(`change`,c),t?.awareness?.off(`change`,l),clearInterval(u)}},r[1]=n,r[2]=e?.awareness,r[3]=t?.awareness,r[4]=s):s=r[4];let c;return r[5]!==n||r[6]!==e||r[7]!==t?(c=[e,t,n],r[5]=n,r[6]=e,r[7]=t,r[8]=c):c=r[8],(0,Q.useEffect)(s,c),a}function zj(e){let{agentId:t,entry:n}=e;return{kind:`agent`,agentId:t,presence:n}}var Bj=`sync-status`;function Vj(e,t){let n=(0,$.c)(6),{_:r}=i(),a=cm(),o=(0,Q.useRef)(!1),s=(0,Q.useRef)(!1),c=(0,Q.useRef)(t),l,u;n[0]!==r||n[1]!==t||n[2]!==a||n[3]!==e?(l=()=>{if(c.current!==t&&(c.current=t,o.current=!1,s.current=!1),t)if(e===`synced`&&(o.current=!0),e===`disconnected`&&o.current){if(a){X.dismiss(Bj);return}s.current=!0,X.warning(r({id:`HGNCsl`}),{id:Bj,duration:1/0})}else s.current&&e===`synced`&&(s.current=!1,X.success(r({id:`GhjUB_`}),{id:Bj,duration:3e3}))},u=[e,t,r,a],n[0]=r,n[1]=t,n[2]=a,n[3]=e,n[4]=l,n[5]=u):(l=n[4],u=n[5]),(0,Q.useEffect)(l,u)}var Hj=4,Uj=3,Wj={Bird:tl,Cat:sl,Dog:ml,Fish:bl,Mouse:ql,Rabbit:Kl,Shrimp:$l,Snail:eu,Squirrel:iu,Turtle:fu};Object.freeze(Object.keys(Wj));function Gj(e){if(typeof e.principalId==`string`&&e.principalId.length>0)return{kind:`initials`};let t=e.name.split(` `)[1];return t&&Object.hasOwn(Wj,t)?{kind:`animal`,animal:t}:{kind:`initials`}}var Kj={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`,bot:`Agent`};function qj(e){let t=(0,$.c)(28),{user:n,mode:r,tabCount:a}=e,{_:o}=i(),s=Gj(n),c=s.kind===`animal`?Wj[s.animal]:void 0,l;t[0]===n.name?l=t[1]:(l=tr(n.name),t[0]=n.name,t[1]=l);let u=l,d;t[2]===n.color?d=t[3]:(d=Kr(n.color),t[2]=n.color,t[3]=d);let f=d,p=n.name,m;t[4]!==o||t[5]!==a||t[6]!==p?(m=a>1?o({id:`qAhFeg`,values:{userName:p,tabCount:a}}):p,t[4]=o,t[5]=a,t[6]=p,t[7]=m):m=t[7];let h=m,g;t[8]!==o||t[9]!==a||t[10]!==p?(g=a>1?o({id:`BEkF-P`,values:{userName:p,tabCount:a}}):p,t[8]=o,t[9]=a,t[10]=p,t[11]=g):g=t[11];let _=g,v;t[12]===n.color?v=t[13]:(v={backgroundColor:n.color},t[12]=n.color,t[13]=v);let y;t[14]!==c||t[15]!==f||t[16]!==u?(y=c?(0,Z.jsx)(c,{size:18,color:f,strokeWidth:1.5}):(0,Z.jsx)(`span`,{className:`font-mono text-2xs font-semibold leading-none`,style:{color:f},children:u}),t[14]=c,t[15]=f,t[16]=u,t[17]=y):y=t[17];let b;t[18]!==_||t[19]!==r||t[20]!==v||t[21]!==y?(b=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(`div`,{"data-presence-badge":`human`,"data-presence-mode":r,role:`img`,"aria-label":_,className:`inline-flex size-7 shrink-0 cursor-default items-center justify-center rounded-full ring-2 ring-background`,style:v,children:y})}),t[18]=_,t[19]=r,t[20]=v,t[21]=y,t[22]=b):b=t[22];let x;t[23]===h?x=t[24]:(x=(0,Z.jsx)(Ns,{children:h}),t[23]=h,t[24]=x);let S;return t[25]!==b||t[26]!==x?(S=(0,Z.jsxs)(Is,{children:[b,x]}),t[25]=b,t[26]=x,t[27]=S):S=t[27],S}function Jj(e){let t=Kj[e.icon];return e.displayName||t||hs._({id:`iEQQyu`})}function Yj(e){let t=(0,$.c)(3),[n,r]=(0,Q.useState)(e===`writing`),i=(0,Q.useRef)(null),a,o;return t[0]===e?(a=t[1],o=t[2]):(a=()=>{if(e===`writing`){i.current!==null&&(clearTimeout(i.current),i.current=null),r(!0);return}return i.current!==null&&clearTimeout(i.current),i.current=setTimeout(()=>{i.current=null,r(!1)},600),()=>{i.current!==null&&(clearTimeout(i.current),i.current=null)}},o=[e],t[0]=e,t[1]=a,t[2]=o),(0,Q.useEffect)(a,o),n}function Xj(e){let t=(0,$.c)(33),{participant:n,crossDoc:r,scoped:a,onClickAgent:o}=e,{_:c}=i(),{activeDocName:l}=ht(),{presence:u,agentId:d}=n,f=Jj(u),p=Yj(u.mode),m=!r&&p,h=u.currentDoc&&u.currentDoc!==`(connected)`?u.currentDoc:null,g=l!==null||h!==null,_=g?`cursor-pointer`:`cursor-default opacity-50`,v=a?`ring-primary ring-offset-2 ring-offset-background`:`ring-background`,y=m&&!a?`ring-primary/40 animate-pulse`:``,b;t[0]!==_||t[1]!==v||t[2]!==y?(b=[`inline-flex size-7 shrink-0 items-center justify-center rounded-full ring-2`,_,v,y].filter(Boolean),t[0]=_,t[1]=v,t[2]=y,t[3]=b):b=t[3];let x=b.join(` `),S=r?`true`:void 0,C=a?`true`:void 0,w=g?void 0:`true`,T;t[4]!==u.mode||t[5]!==S||t[6]!==C||t[7]!==w?(T={"data-presence-badge":`agent`,"data-presence-mode":u.mode,"data-presence-crossdoc":S,"data-presence-scoped":C,"data-presence-inert":w},t[4]=u.mode,t[5]=S,t[6]=C,t[7]=w,t[8]=T):T=t[8];let E=T,D=c(r&&h?{id:`b4AQFK`,values:{tooltipName:f,realCurrentDoc:h}}:{id:`RfHNf8`,values:{tooltipName:f}}),O;t[9]!==d||t[10]!==D||t[11]!==E||t[12]!==g||t[13]!==o||t[14]!==u.color||t[15]!==u.icon||t[16]!==h||t[17]!==x||t[18]!==f?(O=g?(0,Z.jsx)(`button`,{type:`button`,...E,"aria-label":D,className:x,style:{backgroundColor:u.color},onClick:()=>o(d,h),children:(0,Z.jsx)(xi,{icon:u.icon,width:16,height:16,className:`text-white`,"aria-hidden":!0})}):(0,Z.jsx)(`div`,{...E,role:`img`,"aria-label":f,className:x,style:{backgroundColor:u.color},children:(0,Z.jsx)(xi,{icon:u.icon,width:16,height:16,className:`text-white`,"aria-hidden":!0})}),t[9]=d,t[10]=D,t[11]=E,t[12]=g,t[13]=o,t[14]=u.color,t[15]=u.icon,t[16]=h,t[17]=x,t[18]=f,t[19]=O):O=t[19];let k=O,A;t[20]===k?A=t[21]:(A=(0,Z.jsx)(js,{asChild:!0,children:k}),t[20]=k,t[21]=A);let j;t[22]===f?j=t[23]:(j=(0,Z.jsx)(`span`,{className:`font-medium`,children:f}),t[22]=f,t[23]=j);let M;t[24]!==r||t[25]!==h?(M=r&&h?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(s,{id:`Wh0im4`,values:{realCurrentDoc:h}})}):null,t[24]=r,t[25]=h,t[26]=M):M=t[26];let N;t[27]!==j||t[28]!==M?(N=(0,Z.jsxs)(Ns,{className:`flex flex-col gap-0.5`,children:[j,M]}),t[27]=j,t[28]=M,t[29]=N):N=t[29];let P;return t[30]!==A||t[31]!==N?(P=(0,Z.jsxs)(Is,{children:[A,N]}),t[30]=A,t[31]=N,t[32]=P):P=t[32],P}function Zj(e){let t=(0,$.c)(21),{count:n,remainder:r,crossDoc:i,scopedAgentId:a,onClickAgent:o}=e,s;t[0]!==n||t[1]!==i?(s=i?hs._({id:`9euN0m`,values:{count:n}}):hs._({id:`uhJEA2`,values:{count:n}}),t[0]=n,t[1]=i,t[2]=s):s=t[2];let c=s,l=i?`true`:void 0,u;t[3]!==n||t[4]!==c||t[5]!==l?(u=(0,Z.jsx)(J,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`presence-overflow`,"data-presence-crossdoc":l,className:`inline-flex size-7 shrink-0 cursor-pointer items-center justify-center rounded-full bg-muted font-medium text-muted-foreground text-xs ring-2 ring-background hover:bg-muted/80`,"aria-label":c,children:[`+`,n]})}),t[3]=n,t[4]=c,t[5]=l,t[6]=u):u=t[6];let d;if(t[7]!==i||t[8]!==o||t[9]!==r||t[10]!==a){let e;t[12]!==i||t[13]!==o||t[14]!==a?(e=e=>e.kind===`human`?(0,Z.jsx)(qj,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(Xj,{participant:e,crossDoc:i,scoped:a===e.agentId,onClickAgent:o},e.agentId),t[12]=i,t[13]=o,t[14]=a,t[15]=e):e=t[15],d=r.map(e),t[7]=i,t[8]=o,t[9]=r,t[10]=a,t[11]=d}else d=t[11];let f;t[16]===d?f=t[17]:(f=(0,Z.jsx)(b,{align:`end`,className:`w-auto max-w-xs p-2`,children:(0,Z.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:d})}),t[16]=d,t[17]=f);let p;return t[18]!==u||t[19]!==f?(p=(0,Z.jsxs)(pe,{children:[u,f]}),t[18]=u,t[19]=f,t[20]=p):p=t[20],p}function Qj(e,t,n,r){return e.kind===`human`?(0,Z.jsx)(qj,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(Xj,{participant:e,crossDoc:n,scoped:r===e.agentId,onClickAgent:t},e.agentId)}function $j(){let e=(0,$.c)(20),{activeProvider:t,activeDocName:n,systemProvider:r,openActivityPanel:i,docPanelMode:a,docPanelAgentId:o}=ht(),{current:s,crossDoc:c}=Rj(t,r,n);if(Vj(Iw(t),n),s.length===0&&c.length===0)return null;let l;if(e[0]!==c||e[1]!==s||e[2]!==o||e[3]!==a||e[4]!==i){let t=s.slice(0,Hj),n;e[6]===s?n=e[7]:(n=s.slice(Hj),e[6]=s,e[7]=n);let r=n,u=c.slice(0,Uj),d;e[8]===c?d=e[9]:(d=c.slice(Uj),e[8]=c,e[9]=d);let f=d,p=i,m=a===`agent`?o:null,h;e[10]!==p||e[11]!==m?(h=e=>Qj(e,p,!1,m),e[10]=p,e[11]=m,e[12]=h):h=e[12];let g=t.map(h),_;e[13]!==r||e[14]!==p||e[15]!==m?(_=r.length>0?(0,Z.jsx)(Zj,{count:r.length,remainder:r,crossDoc:!1,scopedAgentId:m,onClickAgent:p}):null,e[13]=r,e[14]=p,e[15]=m,e[16]=_):_=e[16];let v;e[17]!==g||e[18]!==_?(v=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,"data-presence-section":`current`,children:[g,_]}),e[17]=g,e[18]=_,e[19]=v):v=e[19],l=(0,Z.jsxs)(`div`,{"data-slot":`presence-bar`,className:`flex items-center px-1 py-1.5`,children:[v,c.length>0?(0,Z.jsxs)(`div`,{className:`ml-1.5 flex items-center gap-1.5`,"data-presence-section":`crossdoc`,children:[u.map(e=>Qj(e,p,!0,m)),f.length>0?(0,Z.jsx)(Zj,{count:f.length,remainder:f,crossDoc:!0,scopedAgentId:m,onClickAgent:p}):null]}):null]}),e[0]=c,e[1]=s,e[2]=o,e[3]=a,e[4]=i,e[5]=l}else l=e[5];return l}var eM=new Set([`.md`,`.mdx`]);function tM(e){let t=e.lastIndexOf(`/`),n=t<0?e:e.slice(t+1),r=n.lastIndexOf(`.`);return r<=0?``:n.slice(r)}function nM(e,t){let n=e.lastIndexOf(`/`),r=n<0?``:e.slice(0,n+1),i=n<0?e:e.slice(n+1),a=i.lastIndexOf(`.`);return`${r}${a<=0?i:i.slice(0,a)}${t}`}function rM(e){return eM.has(tM(e).toLowerCase())}function iM(e,t,n){if(n)return{kind:`allow`,destinationPath:t};let r=tM(e);return r===``?{kind:`allow`,destinationPath:t}:{kind:`allow`,destinationPath:tM(t)?t:nM(t,r)}}var aM=`.md`,oM=/\.(md|mdx)$/i;function sM(e,t=aM){return`${e}${t}`}function cM(e){return FM(e).replace(oM,``)}function lM(e){return Qo(e)?fM(e.path):zo(e)?e.path:sM(e.docName,e.docExt)}function uM(e){let t=FM(e).match(oM);return t?`.${t[1].toLowerCase()}`:void 0}function dM(e){return FM(e)}function fM(e){let t=FM(e.trim());return t?`${t}/`:``}function pM(e){return e.endsWith(`/`)?dM(e):cM(e)}function mM(e){return e.map(lM)}function hM(e){return[...e].sort().join(`\0`)}function gM(e){return hM(mM(e))}function _M(e){let t=new Set;for(let n of e){if(Qo(n)){let e=fM(n.path);e&&t.add(e)}let e=(Qo(n)||zo(n)?n.path:n.docName).split(`/`).filter(Boolean),r=Qo(n)?e.length:e.length-1;for(let n=1;n<=r;n++)t.add(`${e.slice(0,n).join(`/`)}/`)}return[...t].sort()}function vM(e){if(!e)return[];let t=FM(e.replace(oM,``)).split(`/`).filter(Boolean),n=[],r=e.endsWith(`/`)?t.length:t.length-1;for(let e=1;e<=r;e++)n.push(`${t.slice(0,e).join(`/`)}/`);return n}function yM(e,t,n){let r=uM(e);if(r)return r;let i=n.find(e=>ps(e)&&e.docName===t);return i?i.docExt??aM:PM(e).includes(`.`)?void 0:aM}function bM(e,t){let n=e.lastIndexOf(`/`),r=n===-1?``:e.slice(0,n+1),i=n===-1?e:e.slice(n+1),a=t.filter(e=>{if(!zo(e)||!e.path.startsWith(r))return!1;let t=e.path.slice(r.length);return!t.includes(`/`)&&t.startsWith(`${i}.`)});return a.length===1?a[0].path:null}function xM(e,t,n){if(uM(e))return null;let r=n.find(e=>zo(e)&&e.path===t);return r?r.path:PM(e).includes(`.`)?t:bM(t,n)}function SM(e,t){let n=e.kind===`directory`,r=n?dM(e.path):cM(e.path);if(n)return{kind:`folder`,name:FM(PM(e.path)).replace(oM,``),path:r,treePath:wM(e.path,!0)};let i=xM(e.path,r,t);if(i)return{kind:`asset`,name:FM(PM(i)),path:i,treePath:i};let a=yM(e.path,r,t);return{kind:`file`,name:FM(PM(e.path)).replace(oM,``),path:r,treePath:wM(e.path,!1),docExt:a}}function CM(e){return e.kind===`directory`?dM(e.path):e.path}function wM(e,t){return t?fM(e):oM.test(e)?e:`${e}${aM}`}function TM(e,t,n){let r=fM(t),i=new Set(n);for(let t=0;t<100;t++){let n=t===0?``:` ${t+1}`;if(e===`file`){let e=`${r}Untitled${n}${aM}`;if(!i.has(e))return{addPath:e,renamePath:e};continue}let a=`${r}New Folder${n}/`;if(!i.has(a))return{addPath:a,renamePath:a}}throw Error(`Could not allocate a unique tree placeholder`)}function EM(e,t){return e===`file`?wM(t,!1):`${dM(t)}/index${aM}`}function DM(e,t){return t.kind===`root`||t.directoryPath==null?PM(e):`${t.directoryPath}${PM(e)}`}function OM(e,t){if(t)return dM(fM(e));let n=cM(e),r=n.lastIndexOf(`/`);return r===-1?``:n.slice(0,r)}function kM(e,t){let n=dM(fM(e));return n?`${n}/${t}`:t}function AM(e,t){return(t.path??kM(e,t.src)).replace(/^\/+/,``)}function jM(e){let t=e.dataTransfer?.types;if(!t)return!1;let n=Array.from(t);return n.includes(`Files`)&&!n.includes(`application/x-open-knowledge-sidebar-item+json`)}function MM(e){return Array.from(e.dataTransfer?.files??[]).filter(e=>e.name.length>0||e.size>0)}function NM(e,t){let n=tM(e).toLowerCase();if(n===``)return null;let r=new Date().toISOString();if(n===`.md`||n===`.mdx`)return{kind:`document`,docName:cM(e),docExt:n,modified:r,size:t.size};let i=n.startsWith(`.`)?n.slice(1):n;return{kind:`asset`,path:e,assetExt:i,mediaKind:rr(i),modified:r,size:t.size}}function PM(e){let t=FM(e),n=t.lastIndexOf(`/`),r=n===-1?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function FM(e){return e.endsWith(`/`)?e.slice(0,-1):e}function IM(e,t){return t.trim()}function LM(e){return![``,`.`,`..`].includes(e)&&!e.includes(`/`)&&!e.includes(`\\`)&&!e.includes(`\0`)}function RM(e,t){let n=IM(e.kind,t),r=e.path.split(`/`);return r[r.length-1]=n,r.join(`/`)}function zM(e,t,n=[],r=[],i=[]){if(t.length===0&&n.length===0&&r.length===0&&i.length===0)return e;let a=new Map(t.map(e=>[e.fromDocName,e.toDocName])),o=new Map(i.map(e=>[e.toDocName,e.docExt])),s=new Map(r.map(e=>[e.fromPath,e.toPath]));return e.map(e=>{if(ps(e)){let t=s.get(sM(e.docName,e.docExt));if(t){let n=Vo(t);return{kind:`asset`,path:t,assetExt:n,mediaKind:rr(n),size:e.size,modified:e.modified,referencedBy:[]}}let n=a.get(e.docName)??e.docName;return{...e,docName:n,docExt:o.get(n)??e.docExt}}if(Qo(e))return{...e,path:KM(e.path,n)};if(zo(e)){let t=s.get(e.path);return t&&rM(t)?{kind:`document`,docName:cM(t),docExt:tM(t),size:e.size,modified:e.modified}:{...e,path:t??KM(e.path,n)}}return e})}function BM(e,t,n,r=[]){if(t.length===0&&!n&&r.length===0)return e;let i=new Set(t),a=new Set(r);return e.filter(e=>ps(e)?!i.has(e.docName)&&!XM(e.docName,n):Qo(e)?!XM(e.path,n):zo(e)?!a.has(e.path)&&!XM(e.path,n):!0)}function VM(e,t){if(e.kind!==`asset`||t.some(t=>zo(t)&&t.path===e.path))return e;let n=bM(e.path,t);return n?{...e,path:n,name:n.split(`/`).pop()??n}:e}function HM(e,t,n,r=new Date().toISOString()){let i=!1,a=[...e],o=e=>{a.some(t=>qM(t,e))||(a.push(e),i=!0)};if(n.kind===`file`){let s=e.find(e=>ps(e)&&e.docName===t.path);return o({kind:`document`,docName:n.path,docExt:s?.docExt??t.docExt,size:s?.size??0,modified:r}),i?a:e}let s=e.find(e=>Qo(e)&&e.path===t.path);o({kind:`folder`,path:n.path,size:s?.size??0,modified:r});let c=new Set(n.duplicatedDocNames);for(let i of e){if(ps(i)){let e=YM(i.docName,t.path,n.path);e&&c.has(e)&&o({...i,docName:e,modified:r});continue}if(Qo(i)){let e=JM(i.path,t.path,n.path);e&&o({...i,path:e,modified:r})}}return i?a:e}function UM(e,t){return e?t.find(t=>t.fromDocName===e)?.toDocName??e:null}function WM(e,t,n){return e.flatMap(e=>t===e.toDocName||!n(e.toDocName)?[e.fromDocName]:[e.fromDocName,e.toDocName])}function GM(e,t){let n=e.kind===`file`?sM(e.path,e.docExt):e.path;return Zg(t.contentDir,n,t.pathSeparator)}function KM(e,t){for(let{fromPath:n,toPath:r}of t){if(e===n)return r;if(e.startsWith(`${n}/`))return`${r}${e.slice(n.length)}`}return e}function qM(e,t){return ps(e)&&ps(t)?e.docName===t.docName:Qo(e)&&Qo(t)||zo(e)&&zo(t)?e.path===t.path:!1}function JM(e,t,n){return e===t?n:YM(e,t,n)}function YM(e,t,n){return e.startsWith(`${t}/`)?`${n}${e.slice(t.length)}`:null}function XM(e,t){return!!t&&(e===t||e.startsWith(`${t}/`))}function ZM(e){let t=(0,$.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,Z.jsx)(pd,{"data-slot":`context-menu`,...n}),t[2]=n,t[3]=r),r}function QM(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=si(`select-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(md,{"data-slot":`context-menu-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function $M(e){let t=(0,$.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,Z.jsx)(_d,{"data-slot":`context-menu-group`,...n}),t[2]=n,t[3]=r),r}function eN(e){let t=(0,$.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,Z.jsx)(Cd,{"data-slot":`context-menu-sub`,...n}),t[2]=n,t[3]=r),r}function tN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=si(`z-50 max-h-(--radix-context-menu-content-available-height) min-w-36 origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 motion-reduce:data-open:animate-none motion-reduce:data-closed:animate-none motion-reduce:duration-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(hd,{children:(0,Z.jsx)(gd,{"data-slot":`context-menu-content`,className:i,...r})}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function nN(e){let t=(0,$.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,inset:r,variant:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?`default`:a,s;t[5]===n?s=t[6]:(s=si(`group/context-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 focus:*:[svg]:text-accent-foreground data-[variant=destructive]:*:[svg]:text-destructive`,n),t[5]=n,t[6]=s);let c;return t[7]!==r||t[8]!==i||t[9]!==s||t[10]!==o?(c=(0,Z.jsx)(yd,{"data-slot":`context-menu-item`,"data-inset":r,"data-variant":o,className:s,...i}),t[7]=r,t[8]=i,t[9]=s,t[10]=o,t[11]=c):c=t[11],c}function rN(e){let t=(0,$.c)(13),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,inset:i,children:n,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;t[5]===r?o=t[6]:(o=si(`flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,r),t[5]=r,t[6]=o);let s;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(Po,{className:`ml-auto`}),t[7]=s):s=t[7];let c;return t[8]!==n||t[9]!==i||t[10]!==a||t[11]!==o?(c=(0,Z.jsxs)(wd,{"data-slot":`context-menu-sub-trigger`,"data-inset":i,className:o,...a,children:[n,s]}),t[8]=n,t[9]=i,t[10]=a,t[11]=o,t[12]=c):c=t[12],c}function iN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=si(`z-50 max-h-(--radix-context-menu-content-available-height) min-w-32 origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg border bg-popover p-1 text-popover-foreground shadow-lg data-[state=closed]:overflow-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 motion-reduce:data-open:animate-none motion-reduce:data-closed:animate-none motion-reduce:duration-0 subtle-scrollbar`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Td,{"data-slot":`context-menu-sub-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function aN(e){let t=(0,$.c)(15),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:i,children:r,checked:n,inset:a,...o}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s;t[6]===i?s=t[7]:(s=si(`relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,i),t[6]=i,t[7]=s);let c;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(`span`,{className:`pointer-events-none absolute right-2`,children:(0,Z.jsx)(xd,{children:(0,Z.jsx)(Ao,{})})}),t[8]=c):c=t[8];let l;return t[9]!==n||t[10]!==r||t[11]!==a||t[12]!==o||t[13]!==s?(l=(0,Z.jsxs)(bd,{"data-slot":`context-menu-checkbox-item`,"data-inset":a,className:s,checked:n,...o,children:[c,r]}),t[9]=n,t[10]=r,t[11]=a,t[12]=o,t[13]=s,t[14]=l):l=t[14],l}function oN(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,inset:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=si(`px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7`,n),t[4]=n,t[5]=a);let o;return t[6]!==r||t[7]!==i||t[8]!==a?(o=(0,Z.jsx)(vd,{"data-slot":`context-menu-label`,"data-inset":r,className:a,...i}),t[6]=r,t[7]=i,t[8]=a,t[9]=o):o=t[9],o}function sN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=si(`-mx-1 my-1 h-px bg-border`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Sd,{"data-slot":`context-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var cN=`mr-1.5 flex size-5 shrink-0 cursor-pointer items-center justify-center rounded-sm text-muted-foreground outline-none transition hover:bg-foreground/10 hover:text-foreground hover:opacity-100 focus-visible:ring-2 focus-visible:ring-ring/50`,lN=`border-border bg-background text-foreground hover:bg-background focus-visible:bg-background`,uN={start:[Gi.Space],cancel:[Gi.Esc],end:[Gi.Space,Gi.Enter]};function dN(e){return si(cN,e?`opacity-100`:`pointer-events-none opacity-0 group-hover:pointer-events-auto group-hover:opacity-100`)}function fN(e){return e?void 0:-1}function pN({className:e,isDragging:t}){return si(e,t&&lN)}function mN(e){return e.code===Gi.Enter&&e.target===e.currentTarget}function hN({event:e,hasKeyboardActivation:t,isDragging:n}){return e.defaultPrevented?`ignore`:!n&&t&&mN(e)?`activate-tab`:`delegate-sortable`}function gN({activeWidth:e,isDragging:t,outerStyle:n,transform:r,transition:i}){let a=t&&e?e:void 0;return{...n,transform:Na.Transform.toString(r?{...r,scaleX:1,scaleY:1}:null),transition:i,flexBasis:a??n?.flexBasis,maxWidth:a??n?.maxWidth,minWidth:a??n?.minWidth,opacity:n?.opacity,width:a??n?.width,zIndex:t?20:n?.zIndex}}function _N(e){let t=e?.querySelectorAll(`[data-editor-tab-sortable]`)??[],n=1/0,r=-1/0;for(let e of t){let t=e.getBoundingClientRect();n=Math.min(n,t.left),r=Math.max(r,t.right)}return Number.isFinite(n)&&Number.isFinite(r)?{left:n,right:r}:null}function vN(e){return({activeNodeRect:t,transform:n})=>{let r={...n,y:0};if(!e||!t)return r;let i=e.left-t.left,a=e.right-t.right;return r.x=Math.min(Math.max(r.x,i),a),r}}var yN=e=>{let{droppableContainers:t,droppableRects:n,pointerCoordinates:r}=e;if(r){let e=1/0,i=-1/0,a=null,o=null;for(let r of t){let t=n.get(r.id);t&&(t.left<e&&(e=t.left,a=r),t.right>i&&(i=t.right,o=r))}if(!Number.isFinite(e)||!Number.isFinite(i))return[];let s=r.x<e?a:r.x>i?o:null;if(s)return[{id:s.id,data:{droppableContainer:s,value:0}}]}return Ca(e)},bN=[`.md`,`.mdx`],xN=`group relative -mb-px flex h-10 min-w-28 max-w-64 shrink-0 cursor-pointer items-center overflow-hidden border border-transparent font-medium transition-colors`,SN=`z-10 rounded-t-lg rounded-b-none border-border border-b-0 bg-background text-foreground`,CN=si(SN,`bg-transparent hover:bg-muted focus-visible:bg-muted border-transparent hover:border-border focus-visible:border-border`),wN=`flex h-full min-w-0 flex-1 cursor-pointer items-center overflow-hidden px-3 text-left text-[13px]`;function TN(e){return e.replace(/[^A-Za-z0-9_-]/g,`-`)}function EN(e){let t=Ho(e);window.location.hash!==t&&(window.location.hash=t)}function DN(e){Math.abs(e.deltaX)>=Math.abs(e.deltaY)||e.currentTarget.scrollWidth<=e.currentTarget.clientWidth||(e.preventDefault(),e.currentTarget.scrollLeft+=e.deltaY)}function ON(e,t){let n=[t,...bN].filter((e,t,n)=>e&&n.indexOf(e)===t),r=e.toLowerCase(),i=n.find(t=>e.length>t.length&&r.endsWith(t.toLowerCase()));return i?e.slice(0,-i.length):e}function kN(e){let t=(0,$.c)(37),n,r,i,a,o,s,c,l;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8]):({activateFromKeyboard:n,className:r,tabId:l,disabled:i,onKeyDown:a,ref:o,style:s,...c}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l);let u;t[9]!==i||t[10]!==l?(u={id:l,disabled:i},t[9]=i,t[10]=l,t[11]=u):u=t[11];let{attributes:d,listeners:f,rect:p,setNodeRef:m,transform:h,transition:g,isDragging:_}=zi(u),v=p.current?.width,y;t[12]!==_||t[13]!==s||t[14]!==v||t[15]!==h||t[16]!==g?(y=gN({activeWidth:v,isDragging:_,outerStyle:s,transform:h,transition:g}),t[12]=_,t[13]=s,t[14]=v,t[15]=h,t[16]=g,t[17]=y):y=t[17];let b=y,x;t[18]!==o||t[19]!==m?(x=function(e){m(e),typeof o==`function`?o(e):o&&`current`in o&&(o.current=e)},t[18]=o,t[19]=m,t[20]=x):x=t[20];let S=x,C=f?.onKeyDown,w;t[21]!==n||t[22]!==_||t[23]!==a||t[24]!==C?(w=function(e){a?.(e);let t=hN({event:e,hasKeyboardActivation:!!n,isDragging:_});if(t!==`ignore`){if(t===`activate-tab`&&n){e.preventDefault(),n();return}C?.(e)}},t[21]=n,t[22]=_,t[23]=a,t[24]=C,t[25]=w):w=t[25];let T=w,E;t[26]!==r||t[27]!==_?(E=pN({className:r,isDragging:_}),t[26]=r,t[27]=_,t[28]=E):E=t[28];let D;return t[29]!==d||t[30]!==S||t[31]!==T||t[32]!==f||t[33]!==c||t[34]!==b||t[35]!==E?(D=(0,Z.jsx)(`div`,{ref:S,"data-editor-tab-sortable":``,className:E,style:b,...c,...d,...f,onKeyDown:T}),t[29]=d,t[30]=S,t[31]=T,t[32]=f,t[33]=c,t[34]=b,t[35]=E,t[36]=D):D=t[36],D}function AN(e){let t=(0,$.c)(52),{children:n,closeTab:r,closeTabs:i,canPin:a,disabled:o,openTabs:c,pinTab:l,pinnedTabIds:u,tabId:d,unpinTab:f}=e,p=a===void 0?!0:a;if(o!==void 0&&o)return n;let m;t[0]!==p||t[1]!==u||t[2]!==d?(m=p&&u.includes(d),t[0]=p,t[1]=u,t[2]=d,t[3]=m):m=t[3];let h=m,g;if(t[4]!==c||t[5]!==u||t[6]!==d){let e;t[8]===d?e=t[9]:(e=e=>e!==d,t[8]=d,t[9]=e),g=Ye(c.filter(e),u),t[4]=c,t[5]=u,t[6]=d,t[7]=g}else g=t[7];let _=g,v;t[10]!==c||t[11]!==u?(v=Ye(c,u),t[10]=c,t[11]=u,t[12]=v):v=t[12];let y=v,b;t[13]===n?b=t[14]:(b=(0,Z.jsx)(QM,{asChild:!0,children:n}),t[13]=n,t[14]=b);let x;t[15]!==r||t[16]!==d?(x=()=>r(d),t[15]=r,t[16]=d,t[17]=x):x=t[17];let S;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(s,{id:`yz7wBu`}),t[18]=S):S=t[18];let C;t[19]!==h||t[20]!==x?(C=(0,Z.jsx)(nN,{disabled:h,onSelect:x,children:S}),t[19]=h,t[20]=x,t[21]=C):C=t[21];let w=_.length===0,T;t[22]!==i||t[23]!==_?(T=()=>{i(_)},t[22]=i,t[23]=_,t[24]=T):T=t[24];let E;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Z.jsx)(s,{id:`omXJcU`}),t[25]=E):E=t[25];let D;t[26]!==w||t[27]!==T?(D=(0,Z.jsx)(nN,{disabled:w,onSelect:T,children:E}),t[26]=w,t[27]=T,t[28]=D):D=t[28];let O=y.length===0,k;t[29]!==y||t[30]!==i?(k=()=>{i(y)},t[29]=y,t[30]=i,t[31]=k):k=t[31];let A;t[32]===u.length?A=t[33]:(A=u.length?(0,Z.jsx)(s,{id:`U2Kx6T`}):(0,Z.jsx)(s,{id:`WyXG7w`}),t[32]=u.length,t[33]=A);let j;t[34]!==O||t[35]!==k||t[36]!==A?(j=(0,Z.jsx)(nN,{disabled:O,"data-testid":`editor-tab-context-close-all`,onSelect:k,children:A}),t[34]=O,t[35]=k,t[36]=A,t[37]=j):j=t[37];let M;t[38]!==p||t[39]!==h||t[40]!==l||t[41]!==d||t[42]!==f?(M=p&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(sN,{}),(0,Z.jsx)(nN,{"data-testid":`editor-tab-context-pin-toggle`,onSelect:()=>h?f(d):l(d),children:h?(0,Z.jsx)(s,{id:`SYfHmN`}):(0,Z.jsx)(s,{id:`3pU8e-`})})]}),t[38]=p,t[39]=h,t[40]=l,t[41]=d,t[42]=f,t[43]=M):M=t[43];let N;t[44]!==D||t[45]!==j||t[46]!==M||t[47]!==C?(N=(0,Z.jsxs)(tN,{className:`min-w-40`,children:[C,D,j,M]}),t[44]=D,t[45]=j,t[46]=M,t[47]=C,t[48]=N):N=t[48];let P;return t[49]!==N||t[50]!==b?(P=(0,Z.jsxs)(ZM,{children:[b,N]}),t[49]=N,t[50]=b,t[51]=P):P=t[51],P}function jN(e){let t=(0,$.c)(26),{accessibleLabel:n,closeTab:r,isActive:a,isPinned:o,tabId:s,unpinTab:c}=e,{_:l}=i();if(o){let e;t[0]!==l||t[1]!==n?(e=l({id:`t18QYR`,values:{accessibleLabel:n}}),t[0]=l,t[1]=n,t[2]=e):e=t[2];let r;t[3]!==s||t[4]!==c?(r=e=>{e.stopPropagation(),c(s)},t[3]=s,t[4]=c,t[5]=r):r=t[5];let i;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(Gl,{"aria-hidden":`true`}),t[6]=i):i=t[6];let a;return t[7]!==e||t[8]!==r?(a=(0,Z.jsx)(li,{variant:`ghost`,size:`icon-xs`,type:`button`,"aria-label":e,"data-testid":`editor-tab-unpin-button`,className:`mr-1.5 text-primary! hover:bg-primary/10!`,onClick:r,children:i}),t[7]=e,t[8]=r,t[9]=a):a=t[9],a}let u;t[10]!==l||t[11]!==n?(u=l({id:`JLzQi_`,values:{accessibleLabel:n}}),t[10]=l,t[11]=n,t[12]=u):u=t[12];let d;t[13]===a?d=t[14]:(d=dN(a),t[13]=a,t[14]=d);let f;t[15]===a?f=t[16]:(f=fN(a),t[15]=a,t[16]=f);let p;t[17]!==r||t[18]!==s?(p=e=>{e.stopPropagation(),r(s)},t[17]=r,t[18]=s,t[19]=p):p=t[19];let m;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(gs,{"aria-hidden":`true`}),t[20]=m):m=t[20];let h;return t[21]!==u||t[22]!==d||t[23]!==f||t[24]!==p?(h=(0,Z.jsx)(li,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":u,"data-testid":`editor-tab-close-button`,className:d,tabIndex:f,onClick:p,children:m}),t[21]=u,t[22]=d,t[23]=f,t[24]=p,t[25]=h):h=t[25],h}function MN(e){let t=(0,$.c)(1),{docName:n}=e;if(hw(n)!==`conflict`)return null;let r;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(Ro,{"aria-label":`Conflict`,"data-testid":`editor-tab-conflict-badge`,className:`mr-1 size-3.5 shrink-0 text-amber-500`}),t[0]=r):r=t[0],r}function NN(){let e=(0,$.c)(80),{activeDocName:t,activeTabId:n,activeNewTabId:r,activeTarget:a,activateTab:o,activateNewTab:c,closeAndClearForRename:l,closeNewTab:u,closeTab:d,closeTabs:f,getPoolActiveDocName:p,poolHas:m,isNewTabActive:h,newTabIds:g,openNewTab:_,openTabs:v,pinTab:y,pinnedTabIds:b,remapTabsForRename:x,reorderTabs:S,unpinTab:C,visibleTabIds:w}=ht(),{_:T}=i(),{pageMeta:E}=is(),D=(0,Q.useRef)(null),[O,k]=(0,Q.useState)(null),[j,M]=(0,Q.useState)(null),[N,P]=(0,Q.useState)(``),[F,I]=(0,Q.useState)(null),[L,R]=(0,Q.useState)(!1),z=(0,Q.useRef)(null),B=(0,Q.useRef)(!1),H=(0,Q.useRef)(!1),U=(0,Q.useRef)(null),W=(0,Q.useRef)(t),G;e[0]!==n||e[1]!==t||e[2]!==a?(G=n??(a?Ze(a):t?Ue(t):null),e[0]=n,e[1]=t,e[2]=a,e[3]=G):G=e[3];let K=G,q;e[4]!==r||e[5]!==K||e[6]!==h||e[7]!==g||e[8]!==v?(q=h?`${r??`__new-tab__`}\u0000${v.join(`\0`)}\u0000${g.join(`\0`)}`:K?`${K}\u0000${v.join(`\0`)}`:``,e[4]=r,e[5]=K,e[6]=h,e[7]=g,e[8]=v,e[9]=q):q=e[9];let J=q,ee,te;e[10]===t?(ee=e[11],te=e[12]):(ee=()=>{W.current=t},te=[t],e[10]=t,e[11]=ee,e[12]=te),(0,Q.useEffect)(ee,te);let ne,re;e[13]===J?(ne=e[14],re=e[15]):(ne=()=>{J&&(D.current?.querySelector(`[data-active-tab="true"]`))?.scrollIntoView({block:`nearest`,inline:`nearest`})},re=[J],e[13]=J,e[14]=ne,e[15]=re),(0,Q.useEffect)(ne,re);let Y,ie;e[16]===j?(Y=e[17],ie=e[18]):(Y=()=>{j&&(z.current?.focus(),z.current?.select())},ie=[j],e[16]=j,e[17]=Y,e[18]=ie),(0,Q.useEffect)(Y,ie);let ae,oe;e[19]!==v||e[20]!==j?(ae=()=>{!j||v.includes(j.tabId)||(H.current=!0,U.current=null,M(null),P(``),I(null),R(!1))},oe=[v,j],e[19]=v,e[20]=j,e[21]=ae,e[22]=oe):(ae=e[21],oe=e[22]),(0,Q.useEffect)(ae,oe);let se=function(e,t){let n=t.split(`/`);H.current=!1,U.current=null,M({docName:t,tabId:e}),P(n[n.length-1]),I(null)},ce=function(){H.current=!0,U.current=null,M(null),P(``),I(null),R(!1)},le=async function(){if(H.current){H.current=!1;return}if(B.current)return;let e=j?.docName;if(!e){ce();return}let t=IM(`file`,ON(N,E.get(e)?.docExt??`.md`)),n=e.split(`/`),r=n[n.length-1];if(t===r){ce();return}if(t===U.current){z.current?.focus();return}if(!LM(t)){I(T({id:`P8yDjG`})),z.current?.focus();return}let i=RM({kind:`file`,path:e,name:r},t);B.current=!0,R(!0),I(null);try{let n=await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:`file`,fromPath:e,toPath:i})});if(H.current){R(!1),B.current=!1;return}let r=await ve(n,`Server error (HTTP ${n.status})`);if(!r.ok){I(r.title),R(!1),B.current=!1,U.current=t,z.current?.focus();return}let a=A(Qr,r.body,`rename-path:tab`,{renamed:[],renamedAssets:[]}).renamed,o=W.current,s=UM(o,a);Vt(a);let c=!0;try{let e=WM(a,p(),m);await Promise.all(e.map(e=>l(e))),x(a),cs([`files`,`backlinks`,`graph`])}catch(n){let r=n;c=!1,console.warn(`[EditorTabs] post-rename reconciliation failed`,{err:r,docName:e,newDocName:i,normalized:t}),X.error(T({id:`MUBR8r`}))}H.current=!0,M(null),P(``),I(null),R(!1),B.current=!1,U.current=null,c&&s&&s!==o&&EN(s)}catch(n){console.warn(`[EditorTabs] rename failed`,{err:n,docName:e,newDocName:i,normalized:t}),I(T({id:`HIb0vl`})),R(!1),B.current=!1,U.current=t,z.current?.focus()}},ue=typeof window<`u`&&window.okDesktop!=null,de;e[23]===g?de=e[24]:(de=new Set(g),e[23]=g,e[24]=de);let fe=de,pe;e[25]===O?pe=e[26]:(pe=vN(O),e[25]=O,e[26]=pe);let me;e[27]===pe?me=e[28]:(me=[pe],e[27]=pe,e[28]=me);let he=me,ge;e[29]!==u||e[30]!==f||e[31]!==fe?(ge=function(e){let t=[],n=[];for(let r of e)fe.has(r)?n.push(r):t.push(r);t.length>0&&f(t);for(let e of n)u(e)},e[29]=u,e[30]=f,e[31]=fe,e[32]=ge):ge=e[32];let _e=ge,ye;e[33]===Symbol.for(`react.memo_cache_sentinel`)?(ye={activationConstraint:{distance:8}},e[33]=ye):ye=e[33];let be;e[34]===Symbol.for(`react.memo_cache_sentinel`)?(be={coordinateGetter:_a,keyboardCodes:uN},e[34]=be):be=e[34];let xe=Ti(aa(ya,ye),aa(xa,be)),Se;e[35]===Symbol.for(`react.memo_cache_sentinel`)?(Se=function(){k(_N(D.current))},e[35]=Se):Se=e[35];let Ce=Se,we;e[36]===Symbol.for(`react.memo_cache_sentinel`)?(we=function(){k(null)},e[36]=we):we=e[36];let Te=we,Ee;e[37]!==Te||e[38]!==S||e[39]!==w?(Ee=function(e){Te();let t=String(e.active.id),n=e.over?String(e.over.id):null;if(!n||t===n)return;let r=w.indexOf(t),i=w.indexOf(n);r<0||i<0||r===i||S(Vi([...w],r,i),t)},e[37]=Te,e[38]=S,e[39]=w,e[40]=Ee):Ee=e[40];let De=Ee,Oe=ue?``:void 0,ke;e[41]===Symbol.for(`react.memo_cache_sentinel`)?(ke=si(`pl-2 flex h-12 min-w-0 touch-manipulation flex-1 items-end overflow-x-auto overflow-y-hidden overscroll-x-contain scroll-fade-mask-x [scrollbar-width:none]`,ue&&`[-webkit-app-region:drag]`),e[41]=ke):ke=e[41];let Ae=DN,je;e[42]===Symbol.for(`react.memo_cache_sentinel`)?(je=si(`flex items-end gap-1`,ue&&`[-webkit-app-region:no-drag]`),e[42]=je):je=e[42];let Ne=Qa,Pe=yN,Fe;e[43]===Symbol.for(`react.memo_cache_sentinel`)?(Fe={container:typeof document<`u`?document.body:void 0},e[43]=Fe):Fe=e[43];let Ie=ha,Le;e[44]===w?Le=e[45]:(Le=[...w],e[44]=w,e[45]=Le);let Re=pa,ze=w.map(e=>{if(fe.has(e)){let t=e===r;return(0,Z.jsx)(AN,{tabId:e,canPin:!1,openTabs:w,closeTab:u,closeTabs:_e,pinTab:y,pinnedTabIds:b,unpinTab:C,children:(0,Z.jsxs)(kN,{tabId:e,activateFromKeyboard:()=>c(e),"aria-current":t?`page`:void 0,"data-active-tab":t?`true`:void 0,className:si(xN,t?SN:CN),onAuxClick:t=>{t.button===1&&(t.preventDefault(),u(e))},onClick:t=>{t.target===t.currentTarget&&c(e)},children:[(0,Z.jsx)(`button`,{type:`button`,"aria-label":T({id:`zLak8b`}),"data-testid":`editor-new-tab-placeholder-button`,className:wN,onClick:()=>c(e),tabIndex:-1,children:(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:(0,Z.jsx)(s,{id:`3YvS-c`})})}),(0,Z.jsx)(`button`,{type:`button`,"aria-label":T({id:`xCdTnb`}),"data-testid":`editor-new-tab-placeholder-close`,className:dN(t),tabIndex:fN(t),onClick:t=>{t.stopPropagation(),u(e)},children:(0,Z.jsx)(gs,{"aria-hidden":`true`,className:`size-3.5`})})]})},e)}let t=mt(e),n=e===K,i=b.includes(e);if(t.kind===`folder`){let{baseName:r,label:a,prefix:s}=Me(t.folderPath,`/`),c=`${s}${a}`;return(0,Z.jsx)(AN,{tabId:e,openTabs:w,closeTab:d,closeTabs:_e,pinTab:y,pinnedTabIds:b,unpinTab:C,children:(0,Z.jsxs)(kN,{tabId:e,activateFromKeyboard:()=>o(e),"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:si(xN,n?SN:CN),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&d(e))},onClick:t=>{t.target===t.currentTarget&&o(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":c,title:c,className:wN,onClick:()=>{o(e)},tabIndex:-1,children:[s&&(0,Z.jsx)(`span`,{className:si(`min-w-0 flex-1 truncate`,n&&`text-muted-foreground`),children:s}),(0,Z.jsxs)(`span`,{className:si(`flex min-w-0 items-center`,s?`max-w-[70%] shrink-0`:`flex-1`),children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:r}),(0,Z.jsx)(`span`,{className:`shrink-0`,children:`/`})]})]}),(0,Z.jsx)(jN,{accessibleLabel:c,closeTab:d,isActive:n,isPinned:i,tabId:e,unpinTab:C})]})},e)}if(t.kind===`asset`){let{baseName:r,label:a,prefix:s}=Me(t.assetPath,``),c=`${s}${a}`;return(0,Z.jsx)(AN,{tabId:e,openTabs:w,closeTab:d,closeTabs:_e,pinTab:y,pinnedTabIds:b,unpinTab:C,children:(0,Z.jsxs)(kN,{tabId:e,activateFromKeyboard:()=>o(e),"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:si(xN,n?SN:CN),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&d(e))},onClick:t=>{t.target===t.currentTarget&&o(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":c,className:wN,onClick:()=>{o(e)},tabIndex:-1,children:[s?(0,Z.jsx)(`span`,{className:si(`min-w-0 flex-1 truncate text-muted-foreground/60`,n&&`text-muted-foreground`),children:s}):null,(0,Z.jsx)(`span`,{className:si(`min-w-0 truncate`,s?`max-w-[70%] shrink-0`:`flex-1`),children:r})]}),(0,Z.jsx)(jN,{accessibleLabel:c,closeTab:d,isActive:n,isPinned:i,tabId:e,unpinTab:C})]})},e)}let a=t.docName,l=E.get(a)?.docExt??`.md`,{baseName:f,extension:p,label:m,prefix:h}=Me(a,l),g=`${h}${m}`,_=l===`.md`||l===`.mdx`,v=j?.tabId===e,x=`editor-tab-rename-error-${TN(a)}`;return(0,Z.jsx)(AN,{disabled:v,tabId:e,openTabs:w,closeTab:d,closeTabs:_e,pinTab:y,pinnedTabIds:b,unpinTab:C,children:(0,Z.jsx)(kN,{tabId:e,activateFromKeyboard:()=>o(e),disabled:v,"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:si(xN,n?SN:CN,v&&F&&`border-destructive`),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&d(e))},onClick:t=>{t.target===t.currentTarget&&o(e)},children:v?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(KC,{className:`h-full min-w-0 flex-1 rounded-none border-0 bg-transparent dark:bg-transparent`,children:[(0,Z.jsx)(ZC,{ref:z,value:N,disabled:L,"aria-label":T({id:`Dw1T_W`,values:{label:m}}),"data-testid":`editor-tab-rename-input`,"aria-invalid":F?!0:void 0,"aria-describedby":F?x:void 0,"aria-busy":L||void 0,title:F??a,className:`h-full min-w-0 px-2 py-0 font-medium text-foreground text-xs selection:bg-primary selection:text-primary-foreground`,onChange:e=>{P(ON(e.target.value,l)),I(null),U.current=null},onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),le()):e.key===`Escape`&&(e.preventDefault(),ce())},onBlur:le}),(0,Z.jsx)(JC,{align:`inline-end`,"aria-hidden":`true`,className:`pr-2 text-xs`,children:(0,Z.jsx)(XC,{className:`text-muted-foreground/60 text-xs`,children:l})})]}),F?(0,Z.jsx)(`span`,{id:x,role:`alert`,className:`sr-only`,children:F}):null]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":g,title:g,className:wN,onClick:()=>{o(e)},onDoubleClick:t=>{t.preventDefault(),t.stopPropagation(),se(e,a)},tabIndex:-1,children:[(0,Z.jsx)(MN,{docName:a}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:f}),!_&&(0,Z.jsx)(`span`,{className:`shrink-0`,children:p})]})]}),(0,Z.jsx)(jN,{accessibleLabel:g,closeTab:d,isActive:n,isPinned:i,tabId:e,unpinTab:C})]})})},e)}),Be;e[46]!==Ie||e[47]!==Le||e[48]!==Re||e[49]!==ze?(Be=(0,Z.jsx)(Ie,{items:Le,strategy:Re,children:ze}),e[46]=Ie,e[47]=Le,e[48]=Re,e[49]=ze,e[50]=Be):Be=e[50];let Ve;e[51]!==Ne||e[52]!==Te||e[53]!==De||e[54]!==Ce||e[55]!==xe||e[56]!==!1||e[57]!==Pe||e[58]!==Fe||e[59]!==Be||e[60]!==he?(Ve=(0,Z.jsx)(Ne,{sensors:xe,autoScroll:!1,collisionDetection:Pe,modifiers:he,onDragStart:Ce,onDragEnd:De,onDragCancel:Te,accessibility:Fe,children:Be}),e[51]=Ne,e[52]=Te,e[53]=De,e[54]=Ce,e[55]=xe,e[56]=!1,e[57]=Pe,e[58]=Fe,e[59]=Be,e[60]=he,e[61]=Ve):Ve=e[61];let He;e[62]===T?He=e[63]:(He=T({id:`3YvS-c`}),e[62]=T,e[63]=He);let We;e[64]===Symbol.for(`react.memo_cache_sentinel`)?(We=(0,Z.jsx)(V,{"aria-hidden":`true`}),e[64]=We):We=e[64];let Ge;e[65]!==_||e[66]!==He?(Ge=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(li,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":He,"data-testid":`editor-new-tab-button`,className:`first:mb-3 mb-1.5`,onClick:_,children:We})}),e[65]=_,e[66]=He,e[67]=Ge):Ge=e[67];let Ke;e[68]===Symbol.for(`react.memo_cache_sentinel`)?(Ke=(0,Z.jsx)(Ns,{children:(0,Z.jsx)(s,{id:`3YvS-c`})}),e[68]=Ke):Ke=e[68];let qe;e[69]===Ge?qe=e[70]:(qe=(0,Z.jsxs)(Is,{children:[Ge,Ke]}),e[69]=Ge,e[70]=qe);let Je;e[71]!==je||e[72]!==Ve||e[73]!==qe?(Je=(0,Z.jsxs)(`div`,{className:je,children:[Ve,qe]}),e[71]=je,e[72]=Ve,e[73]=qe,e[74]=Je):Je=e[74];let Ye;return e[75]!==Oe||e[76]!==ke||e[77]!==Ae||e[78]!==Je?(Ye=(0,Z.jsx)(`div`,{ref:D,"data-electron-drag":Oe,className:ke,onWheel:Ae,children:Je}),e[75]=Oe,e[76]=ke,e[77]=Ae,e[78]=Je,e[79]=Ye):Ye=e[79],Ye}function PN(e){let t=(0,$.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`Discord`}),r=(0,Z.jsx)(`path`,{d:`M20.317 4.3698a19.7913 19.7913 0 00-4.8851-1.5152.0741.0741 0 00-.0785.0371c-.211.3753-.4447.8648-.6083 1.2495-1.8447-.2762-3.68-.2762-5.4868 0-.1636-.3933-.4058-.8742-.6177-1.2495a.077.077 0 00-.0785-.037 19.7363 19.7363 0 00-4.8852 1.515.0699.0699 0 00-.0321.0277C.5334 9.0458-.319 13.5799.0992 18.0578a.0824.0824 0 00.0312.0561c2.0528 1.5076 4.0413 2.4228 5.9929 3.0294a.0777.0777 0 00.0842-.0276c.4616-.6304.8731-1.2952 1.226-1.9942a.076.076 0 00-.0416-.1057c-.6528-.2476-1.2743-.5495-1.8722-.8923a.077.077 0 01-.0076-.1277c.1258-.0943.2517-.1923.3718-.2914a.0743.0743 0 01.0776-.0105c3.9278 1.7933 8.18 1.7933 12.0614 0a.0739.0739 0 01.0785.0095c.1202.099.246.1981.3728.2924a.077.077 0 01-.0066.1276 12.2986 12.2986 0 01-1.873.8914.0766.0766 0 00-.0407.1067c.3604.698.7719 1.3628 1.225 1.9932a.076.076 0 00.0842.0286c1.961-.6067 3.9495-1.5219 6.0023-3.0294a.077.077 0 00.0313-.0552c.5004-5.177-.8382-9.6739-3.5485-13.6604a.061.061 0 00-.0312-.0286zM8.02 15.3312c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9555-2.4189 2.157-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9555 2.4189-2.1569 2.4189zm7.9748 0c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9554-2.4189 2.1569-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9554 2.4189-2.1568 2.4189Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,Z.jsxs)(`svg`,{role:`img`,fill:`currentColor`,height:24,width:24,viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[n,r]}),t[2]=e,t[3]=i),i}function FN(e){let t=(0,$.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`X (Twitter)`}),r=(0,Z.jsx)(`path`,{d:`M18.901 1.153h3.68l-8.04 9.19L24 22.846h-7.406l-5.8-7.584-6.638 7.584H.474l8.6-9.83L0 1.154h7.594l5.243 6.932ZM17.61 20.644h2.039L6.486 3.24H4.298Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,Z.jsxs)(`svg`,{role:`img`,fill:`currentColor`,height:24,width:24,viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[n,r]}),t[2]=e,t[3]=i),i}var IN=[{label:{id:`TvY_XA`},href:`https://openknowledge.ai/docs`,icon:Ct},{label:`GitHub`,href:`https://github.com/inkeep/open-knowledge`,icon:wf},{label:{id:`On0aF2`},href:`https://openknowledge.ai/`,icon:$o},{label:`Discord`,href:`https://discord.com/invite/YujKpFN49`,icon:PN},{label:`Twitter`,href:`https://x.com/inkeep`,icon:FN}],LN=()=>{let e=(0,$.c)(16),{_:t}=i(),[n,r]=(0,Q.useState)(!1),a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(ze,{className:`size-4`}),e[0]=a):a=e[0];let o;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(J,{asChild:!0,children:(0,Z.jsxs)(li,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,children:[a,(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`s-MGs7`})})]})})}),e[1]=o):o=e[1];let c;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsxs)(Is,{children:[o,(0,Z.jsx)(Ns,{children:(0,Z.jsx)(s,{id:`s-MGs7`})})]}),e[2]=c):c=e[2];let l;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(`p`,{className:`font-mono tracking-wide uppercase text-muted-foreground text-xs mb-1`,children:(0,Z.jsx)(s,{id:`s-MGs7`})}),e[3]=l):l=e[3];let u;e[4]===t?u=e[5]:(u=t({id:`s-MGs7`}),e[4]=t,e[5]=u);let d;e[6]===t?d=e[7]:(d=IN.map(e=>{let{label:n,href:r,icon:i}=e;return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`a`,{href:r,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>wa(e,r),onAuxClick:e=>wa(e,r),className:`flex items-center gap-2.5 rounded-md px-2 py-1.5 text-sm text-muted-foreground transition-colors hover:bg-azure-900/5 dark:hover:bg-white/20 hover:text-primary`,children:[(0,Z.jsx)(i,{"aria-hidden":`true`,className:`size-4 shrink-0`}),typeof n==`string`?n:t(n)]})},r)}),e[6]=t,e[7]=d);let f;e[8]===d?f=e[9]:(f=(0,Z.jsx)(`ul`,{className:`space-y-0.5`,children:d}),e[8]=d,e[9]=f);let p;e[10]!==u||e[11]!==f?(p=(0,Z.jsxs)(b,{align:`end`,className:`w-64 p-3`,children:[l,(0,Z.jsx)(`nav`,{"aria-label":u,children:f})]}),e[10]=u,e[11]=f,e[12]=p):p=e[12];let m;return e[13]!==n||e[14]!==p?(m=(0,Z.jsxs)(pe,{open:n,onOpenChange:r,children:[c,p]}),e[13]=n,e[14]=p,e[15]=m):m=e[15],m};function RN(e){let t=(0,$.c)(19),{installStates:n,terminalLaunch:r,disabled:a,onPick:o,onLaunchTerminal:c}=e,{_:l}=i(),[u,d]=(0,Q.useState)(``),f;if(t[0]!==l||t[1]!==a||t[2]!==n||t[3]!==u||t[4]!==c||t[5]!==o||t[6]!==r){let e;t[8]===n?e=t[9]:(e=e=>n[e.id]?.installed===!0,t[8]=n,t[9]=e);let i=gg.filter(e),p=gg.some(e=>n[e.id]?.installed==null),m=i.length>0,h=r!==null,g=m||h,_;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(_=e=>d(e.target.value),t[10]=_):_=t[10];let v;t[11]===l?v=t[12]:(v=l({id:`Rah7yq`}),t[11]=l,t[12]=v);let y;t[13]===l?y=t[14]:(y=l({id:`ZBt4rI`}),t[13]=l,t[14]=y);let b;t[15]!==u||t[16]!==v||t[17]!==y?(b=(0,Z.jsx)(Mo,{value:u,onChange:_,placeholder:v,"aria-label":y,"data-testid":`open-in-agent-instruction`}),t[15]=u,t[16]=v,t[17]=y,t[18]=b):b=t[18],f=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[b,g?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[m?(0,Z.jsxs)(`fieldset`,{className:`m-0 flex min-w-0 flex-col gap-0.5 border-0 p-0`,children:[(0,Z.jsx)(`legend`,{className:`text-muted-foreground text-xs`,"data-testid":`open-in-agent-desktop-label`,children:(0,Z.jsx)(s,{id:`BBqGS9`})}),i.map(e=>{let{displayName:t}=e;return(0,Z.jsxs)(li,{type:`button`,variant:`ghost`,className:`w-full justify-start gap-2`,disabled:a,"data-testid":`open-in-agent-item-${e.id}`,"aria-label":l({id:`WqLq6M`,values:{displayName:t}}),onClick:()=>o(e,u),children:[(0,Z.jsx)(Vx,{id:e.id,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:t})]},e.id)})]}):null,h?(0,Z.jsxs)(Z.Fragment,{children:[m?(0,Z.jsx)(Pi,{className:`my-1`}):null,(0,Z.jsxs)(`fieldset`,{className:`m-0 flex min-w-0 flex-col gap-0.5 border-0 p-0`,children:[(0,Z.jsx)(`legend`,{className:`text-muted-foreground text-xs`,"data-testid":`open-in-agent-terminal-label`,children:(0,Z.jsx)(s,{id:`ALhMYW`})}),(0,Z.jsxs)(li,{type:`button`,variant:`ghost`,className:`w-full justify-start gap-2`,disabled:a,"data-testid":`open-in-agent-terminal`,"aria-label":l({id:`AcK_r0`}),onClick:()=>c(u),children:[(0,Z.jsx)(ru,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`fcgvCA`})})]})]})]}):null]}):(0,Z.jsx)(`p`,{className:`text-muted-foreground text-sm`,"data-testid":`open-in-agent-empty`,"aria-live":`polite`,children:p?(0,Z.jsx)(s,{id:`EcR0fl`}):(0,Z.jsx)(s,{id:`l6OXqI`})})]}),t[0]=l,t[1]=a,t[2]=n,t[3]=u,t[4]=c,t[5]=o,t[6]=r,t[7]=f}else f=t[7];return f}function zN(e){let t=(0,$.c)(44),{input:n,open:r,onOpenChange:a}=e,{_:o}=i(),{states:c,refresh:l}=D_(),{dispatch:u}=g_(),d=Wx(),[f,p]=(0,Q.useState)(!1),m=(0,Q.useRef)(!1),h=pg(),g=r??f,_;t[0]===l?_=t[1]:(_=()=>{l()},t[0]=l,t[1]=_);let v=(0,Q.useEffectEvent)(_),y;t[2]!==g||t[3]!==v?(y=()=>{g&&v()},t[2]=g,t[3]=v,t[4]=y):y=t[4];let x;if(t[5]===g?x=t[6]:(x=[g],t[5]=g,t[6]=x),(0,Q.useEffect)(y,x),h)return null;let S=typeof window<`u`&&window.okDesktop!=null,C;t[7]!==a||t[8]!==r?(C=e=>{r===void 0&&p(e),a?.(e)},t[7]=a,t[8]=r,t[9]=C):C=t[9];let w=C,T=n===null,E;t[10]===n?E=t[11]:(E=e=>{if(n===null)return null;let t=e.trim();return t?{...n,instruction:t}:n},t[10]=n,t[11]=E);let D=E,O;t[12]!==u||t[13]!==w||t[14]!==D?(O=(e,t)=>{let n=D(t);n!==null&&(u(e.id,n),w(!1))},t[12]=u,t[13]=w,t[14]=D,t[15]=O):O=t[15];let k=O,A;t[16]!==w||t[17]!==D||t[18]!==d?(A=e=>{let t=D(e);t===null||d===null||(d.launchInTerminal(t),w(!1))},t[16]=w,t[17]=D,t[18]=d,t[19]=A):A=t[19];let j=A,M;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(M=S?()=>{m.current=!0}:void 0,t[20]=M):M=t[20];let N;t[21]===w?N=t[22]:(N=S?()=>{if(m.current){m.current=!1;return}w(!0)}:void 0,t[21]=w,t[22]=N);let P,F;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(bi,{className:`size-3.5`,"aria-hidden":`true`}),F=(0,Z.jsx)(s,{id:`O7_W_a`}),t[23]=P,t[24]=F):(P=t[23],F=t[24]);let I;t[25]!==N||t[26]!==T?(I=(0,Z.jsx)(J,{asChild:!0,children:(0,Z.jsxs)(li,{variant:`ghost`,size:`sm`,disabled:T,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`open-in-agent-trigger`,onPointerDown:M,onClick:N,children:[P,F]})}),t[25]=N,t[26]=T,t[27]=I):I=t[27];let L;t[28]===o?L=t[29]:(L=o({id:`O7_W_a`}),t[28]=o,t[29]=L);let R=n===null,z;t[30]!==j||t[31]!==k||t[32]!==c||t[33]!==R||t[34]!==d?(z=(0,Z.jsx)(RN,{installStates:c,terminalLaunch:d,disabled:R,onPick:k,onLaunchTerminal:j}),t[30]=j,t[31]=k,t[32]=c,t[33]=R,t[34]=d,t[35]=z):z=t[35];let B;t[36]!==L||t[37]!==z?(B=(0,Z.jsx)(b,{align:`end`,"aria-label":L,"data-testid":`open-in-agent-menu`,children:z}),t[36]=L,t[37]=z,t[38]=B):B=t[38];let V;return t[39]!==w||t[40]!==g||t[41]!==I||t[42]!==B?(V=(0,Z.jsxs)(pe,{open:g,onOpenChange:w,children:[I,B]}),t[39]=w,t[40]=g,t[41]=I,t[42]=B,t[43]=V):V=t[43],V}var BN=50,VN=()=>{let e=(0,$.c)(8),t=(0,Q.useRef)(null),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=()=>{t.current===null&&(t.current=setTimeout(()=>{t.current=null,jC.preload()},BN))},e[0]=n):n=e[0];let r=n,i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{t.current!==null&&(clearTimeout(t.current),t.current=null)},e[1]=i):i=e[1];let a=i,o,c;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>()=>{t.current!==null&&clearTimeout(t.current)},c=[],e[2]=o,e[3]=c):(o=e[2],c=e[3]),(0,Q.useEffect)(o,c);let l,u;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>{a(),window.location.hash!==`#settings`&&(window.location.hash=Sg)},u=(0,Z.jsx)(Zl,{className:`size-4`}),e[4]=l,e[5]=u):(l=e[4],u=e[5]);let d;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsxs)(li,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,"data-testid":`header-settings-button`,onMouseEnter:r,onMouseLeave:a,onFocus:r,onBlur:a,onClick:l,children:[u,(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`Tz0i8g`})})]})}),e[6]=d):d=e[6];let f;return e[7]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsxs)(Is,{children:[d,(0,Z.jsx)(Ns,{children:(0,Z.jsx)(s,{id:`Tz0i8g`})})]}),e[7]=f):f=e[7],f};function HN(e){let t=(0,$.c)(30),{input:n,onClickWhenNoRemote:r}=e,{_:a}=i(),{status:o}=go(),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(null),f=(0,Q.useRef)(null),p,m;t[0]===u?(p=t[1],m=t[2]):(p=()=>{!u||!f.current||(f.current.focus(),f.current.select())},m=[u],t[0]=u,t[1]=p,t[2]=m),(0,Q.useEffect)(p,m);let h=o?.hasRemote===!0,g=n===null,_;t[3]!==a||t[4]!==c||t[5]!==h||t[6]!==n||t[7]!==r?(_=async function(){if(!c&&n!==null){l(!0),d(null);try{let e=await la({...n,hasRemote:h,onClickWhenNoRemote:r},{clipboardWrite:Pa,toastSuccess:JN,toastError:qN,logEvent:KN});e.kind===`clipboard-failed`&&d(e.shareUrl)}catch{X.error(a({id:`u3YnKw`}))}l(!1)}},t[3]=a,t[4]=c,t[5]=h,t[6]=n,t[7]=r,t[8]=_):_=t[8];let v=_,y=u!==null,x;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(x=e=>{e||d(null)},t[9]=x):x=t[9];let C;t[10]!==a||t[11]!==n?.kind?(C=n?.kind===`folder`?a({id:`WR0y2O`}):a({id:`F4IYWe`}),t[10]=a,t[11]=n?.kind,t[12]=C):C=t[12];let w=c||g,T,E;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(Ql,{className:`size-3.5`,"aria-hidden":!0}),E=(0,Z.jsx)(s,{id:`Z8lGw6`}),t[13]=T,t[14]=E):(T=t[13],E=t[14]);let D;t[15]!==v||t[16]!==C||t[17]!==w?(D=(0,Z.jsx)(S,{asChild:!0,children:(0,Z.jsxs)(li,{variant:`ghost`,size:`sm`,"aria-label":C,onClick:v,disabled:w,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`share-button`,children:[T,E]})}),t[15]=v,t[16]=C,t[17]=w,t[18]=D):D=t[18];let O;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:(0,Z.jsx)(s,{id:`I1m158`})}),t[19]=O):O=t[19];let k;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(s,{id:`ndeI89`})}),t[20]=k):k=t[20];let A=u??``,j;t[21]===a?j=t[22]:(j=a({id:`5-FeN2`}),t[21]=a,t[22]=j);let M;t[23]!==A||t[24]!==j?(M=(0,Z.jsxs)(b,{className:`flex w-80 flex-col gap-2`,"data-testid":`share-button-fallback-popover`,children:[O,k,(0,Z.jsx)(Mo,{ref:f,readOnly:!0,value:A,onFocus:GN,onClick:WN,onContextMenu:UN,className:`font-mono text-xs`,"data-testid":`share-button-fallback-url`,"aria-label":j})]}),t[23]=A,t[24]=j,t[25]=M):M=t[25];let N;return t[26]!==D||t[27]!==M||t[28]!==y?(N=(0,Z.jsxs)(pe,{open:y,onOpenChange:x,children:[D,M]}),t[26]=D,t[27]=M,t[28]=y,t[29]=N):N=t[29],N}function UN(e){return e.currentTarget.select()}function WN(e){return e.currentTarget.select()}function GN(e){return e.currentTarget.select()}function KN(e){return console.log(e)}function qN(e){e!==`Link ready but could not copy to clipboard.`&&X.error(e)}function JN(e){return X.success(e)}function YN(e){let t=(0,$.c)(45),{onSignIn:n,onSetIdentity:r,onOpenSearch:a,openInAgentMenuOpen:o,openInAgentMenuInput:c,onOpenInAgentMenuOpenChange:l}=e,{_:u}=i(),{activeDocName:d,activeTarget:f}=ht(),{state:p,isDraggingRail:m}=fA(),h=xg(),g;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(g=tc(`toggle-files-sidebar`),t[0]=g):g=t[0];let _=g,v=tc(`command-palette`),y=ka(),[b,x]=(0,Q.useState)(!1),S;bb0:{if(f===null){let e;t[1]===y?e=t[2]:(e=e_({workspace:y}),t[1]=y,t[2]=e),S=e;break bb0}if(f.kind===`folder`){if(!y){S=null;break bb0}let e;t[3]!==f.folderPath||t[4]!==y?(e=r_({folderRelativePath:f.folderPath,workspace:y}),t[3]=f.folderPath,t[4]=y,t[5]=e):e=t[5],S=e;break bb0}let e;t[6]!==d||t[7]!==y?(e=$g({docName:d,workspace:y}),t[6]=d,t[7]=y,t[8]=e):e=t[8],S=e}let C=c??S,w;bb1:{if(f?.kind===`folder`){let e;t[9]===f.folderPath?e=t[10]:(e=po(f.folderPath),t[9]=f.folderPath,t[10]=e),w=e;break bb1}if(d){let e;t[11]===d?e=t[12]:(e=Oa(d),t[11]=d,t[12]=e),w=e;break bb1}w=null}let E=w,D=typeof window<`u`&&window.okDesktop!=null,O=p===`collapsed`,k=D?``:void 0,A=D&&O&&`pl-[var(--ok-titlebar-reserve-left,1rem)]`,j=D&&!m&&`motion-safe:transition-[padding] motion-safe:duration-200 motion-safe:ease-linear`,M;t[13]!==A||t[14]!==j?(M=si(`flex h-12 shrink-0 items-center bg-muted/35 shadow-[inset_0_-1px_0_var(--border)]`,D&&`[-webkit-app-region:drag]`,A,j),t[13]=A,t[14]=j,t[15]=M):M=t[15];let N=!h&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Is,{children:[(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(_A,{className:si(`-ml-1 shrink-0 text-muted-foreground`,D&&`[-webkit-app-region:no-drag]`)})}),(0,Z.jsx)(Ns,{children:p===`expanded`?(0,Z.jsx)(s,{id:`ZxXhLY`,values:{sidebarShortcut:_}}):(0,Z.jsx)(s,{id:`Zz25kq`,values:{sidebarShortcut:_}})})]}),O&&a&&(0,Z.jsxs)(Is,{children:[(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(li,{variant:`ghost`,size:`icon-sm`,onClick:a,"aria-label":u({id:`IN4UX8`,values:{searchShortcut:v}}),"data-telemetry-event":`ok.editor_header.search.click`,className:si(`shrink-0 text-muted-foreground`,D&&`[-webkit-app-region:no-drag]`),children:(0,Z.jsx)(T,{"aria-hidden":`true`})})}),(0,Z.jsx)(Ns,{children:(0,Z.jsx)(s,{id:`IN4UX8`,values:{searchShortcut:v}})})]}),(0,Z.jsx)(Pi,{orientation:`vertical`,className:`mr-1 h-4 shrink-0 data-vertical:self-center`}),(0,Z.jsx)(NN,{})]}),P;t[16]===N?P=t[17]:(P=(0,Z.jsx)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1 px-3`,children:N}),t[16]=N,t[17]=P);let F;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(F=si(`flex shrink-0 items-center justify-end gap-2 px-3`,D&&`[&>*]:[-webkit-app-region:no-drag]`),t[18]=F):F=t[18];let I;t[19]!==C||t[20]!==l||t[21]!==o||t[22]!==b||t[23]!==x||t[24]!==E||t[25]!==h?(I=!h&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(zN,{input:C,open:o,onOpenChange:l}),(0,Z.jsx)(HN,{input:E,onClickWhenNoRemote:()=>x(!0)}),(0,Z.jsx)(ho,{open:b,onOpenChange:x})]}),t[19]=C,t[20]=l,t[21]=o,t[22]=b,t[23]=x,t[24]=E,t[25]=h,t[26]=I):I=t[26];let L;t[27]!==r||t[28]!==n?(L=(0,Z.jsx)(Wa,{onSignIn:n,onSetIdentity:r}),t[27]=r,t[28]=n,t[29]=L):L=t[29];let R,z,B;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Z.jsx)($j,{}),z=(0,Z.jsx)(Pi,{orientation:`vertical`,className:`h-4 shrink-0 data-vertical:self-center`}),B=(0,Z.jsx)(qd,{}),t[30]=R,t[31]=z,t[32]=B):(R=t[30],z=t[31],B=t[32]);let V;t[33]===h?V=t[34]:(V=!h&&(0,Z.jsx)(VN,{}),t[33]=h,t[34]=V);let H;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Z.jsx)(LN,{}),t[35]=H):H=t[35];let U;t[36]!==I||t[37]!==L||t[38]!==V?(U=(0,Z.jsxs)(`div`,{className:F,children:[I,L,R,z,B,V,H]}),t[36]=I,t[37]=L,t[38]=V,t[39]=U):U=t[39];let W;return t[40]!==P||t[41]!==U||t[42]!==k||t[43]!==M?(W=(0,Z.jsxs)(`header`,{"data-electron-drag":k,className:M,children:[P,U]}),t[40]=P,t[41]=U,t[42]=k,t[43]=M,t[44]=W):W=t[44],W}var XN=`open-knowledge:terminal-launch`;function ZN(e,t=typeof window>`u`?new EventTarget:window){t.dispatchEvent(new CustomEvent(XN,{detail:{prompt:e}}))}function QN(e,t=typeof window>`u`?new EventTarget:window){let n=t=>{let n=t instanceof CustomEvent?t.detail?.prompt:void 0;typeof n==`string`&&e(n)};return t.addEventListener(XN,n),()=>t.removeEventListener(XN,n)}function $N(e){let t=(0,$.c)(61),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{onOpenSearch:r}=n,{_:a}=i(),[o,s]=ov(),[c,l]=(0,Q.useState)(o),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(`auth`),[m,h]=(0,Q.useState)(Cy[0].id),[g,_]=(0,Q.useState)(!1),[v,y]=(0,Q.useState)(!1),[b,x]=(0,Q.useState)(null),S=typeof window<`u`?window.okDesktop??null:null,[C,w]=(0,Q.useState)(!1),[T,E]=(0,Q.useState)(null),D=(0,Q.useRef)(0),O=lo(),{projectLocalConfig:k,projectLocalSynced:A}=oe(),j=ka(),{activeDocName:M}=ht(),N=O?.hasRemote,P=O?.pushPermission?.checkStatus,F;t[2]!==g||t[3]!==k||t[4]!==A||t[5]!==N||t[6]!==P?(F=uv({autoSyncOnboardingDismissed:g,hasRemote:N,projectLocalSynced:A,projectLocalConfig:k,pushPermissionCheckStatus:P}),t[2]=g,t[3]=k,t[4]=A,t[5]=N,t[6]=P,t[7]=F):F=t[7];let I=F,L,R;t[8]===M?(L=t[9],R=t[10]):(L=()=>{let e=function(e){let t=e.detail;t&&M&&Oc(M,{kind:`raw-mdx`,detail:t}),l(`source`)};return window.addEventListener(Q_,e),()=>window.removeEventListener(Q_,e)},R=[M],t[8]=M,t[9]=L,t[10]=R),(0,Q.useEffect)(L,R);let z,B;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(z=()=>{let e=window.okDesktop;if(e!=null)return e.onMenuAction(e=>{e===`toggle-terminal`?w(tP):e===`new-terminal`&&w(!0)})},B=[],t[11]=z,t[12]=B):(z=t[11],B=t[12]),(0,Q.useEffect)(z,B);let V,H;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(H=()=>{if(window.okDesktop!=null)return;let e=function(e){nc(e,`toggle-terminal-panel`)&&(e.preventDefault(),w(eP))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},V=[],t[13]=V,t[14]=H):(V=t[13],H=t[14]),(0,Q.useEffect)(H,V);let U,W;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(U=()=>QN(e=>{w(!0),D.current+=1,E({prompt:e,nonce:D.current})}),W=[],t[15]=U,t[16]=W):(U=t[15],W=t[16]),(0,Q.useEffect)(U,W);let G,K;t[17]===C?(G=t[18],K=t[19]):(G=()=>{C||E(null)},K=[C],t[17]=C,t[18]=G,t[19]=K),(0,Q.useEffect)(G,K);let q,J;t[20]===C?(q=t[21],J=t[22]):(q=()=>{window.okDesktop!=null&&window.okDesktop.editor.notifyViewMenuStateChanged({terminalVisible:C})},J=[C],t[20]=C,t[21]=q,t[22]=J),(0,Q.useEffect)(q,J);let ee,te;t[23]===C?(ee=t[24],te=t[25]):(ee=()=>{window.okDesktop!=null&&C&&Ta()},te=[C],t[23]=C,t[24]=ee,t[25]=te),(0,Q.useEffect)(ee,te),sv(O?.pausedReason);let ne;t[26]===s?ne=t[27]:(ne=function(e){l(e),s(e)},t[26]=s,t[27]=ne);let re=ne,Y;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(Y=function(e){y(e),e||x(null)},t[28]=Y):Y=t[28];let ie=Y,ae;t[29]!==a||t[30]!==M||t[31]!==j?(ae={openSelection(e){let t=a_({docName:e.docName??M,workspace:j,instruction:e.instruction,selectionMarkdown:e.selectionMarkdown});return t===null?(X.error(a({id:`_VRtd7`})),!1):(x(t),y(!0),!0)}},t[29]=a,t[30]=M,t[31]=j,t[32]=ae):ae=t[32];let se,ce;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(se=()=>{p(`auth`),d(!0)},ce=()=>{p(`identity`),d(!0)},t[33]=se,t[34]=ce):(se=t[33],ce=t[34]);let le;t[35]!==r||t[36]!==b||t[37]!==v?(le=(0,Z.jsx)(YN,{onSignIn:se,onSetIdentity:ce,onOpenSearch:r,openInAgentMenuOpen:v,openInAgentMenuInput:b,onOpenInAgentMenuOpenChange:ie}),t[35]=r,t[36]=b,t[37]=v,t[38]=le):le=t[38];let ue;t[39]!==m||t[40]!==c||t[41]!==re||t[42]!==T||t[43]!==C?(ue=(0,Z.jsx)(Dj,{editorMode:c,onModeChange:re,activeTab:m,onActiveTabChange:h,terminalBridge:S,terminalVisible:C,onTerminalVisibleChange:w,terminalLaunch:T}),t[39]=m,t[40]=c,t[41]=re,t[42]=T,t[43]=C,t[44]=ue):ue=t[44];let de;t[45]!==ae||t[46]!==le||t[47]!==ue?(de=(0,Z.jsxs)(Pc,{value:ae,children:[le,ue]}),t[45]=ae,t[46]=le,t[47]=ue,t[48]=de):de=t[48];let fe=f===`identity`,pe;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(pe=()=>{d(!1)},t[49]=pe):pe=t[49];let me;t[50]!==u||t[51]!==fe?(me=(0,Z.jsx)(ea,{open:u,onOpenChange:d,identityPrompt:fe,onSuccess:pe}),t[50]=u,t[51]=fe,t[52]=me):me=t[52];let he;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(he=()=>_(!0),t[53]=he):he=t[53];let ge;t[54]===I?ge=t[55]:(ge=(0,Z.jsx)(cv,{open:I,onResolved:he}),t[54]=I,t[55]=ge);let _e;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(_e=(0,Z.jsx)(Y_,{}),t[56]=_e):_e=t[56];let ve;return t[57]!==de||t[58]!==me||t[59]!==ge?(ve=(0,Z.jsxs)(Z.Fragment,{children:[de,me,ge,_e]}),t[57]=de,t[58]=me,t[59]=ge,t[60]=ve):ve=t[60],ve}function eP(e){return!e}function tP(e){return!e}function nP(e){let t=Ho(qo(e));typeof window>`u`||window.location.hash!==t&&(window.location.hash=t)}function rP(){let e=(0,$.c)(11),{conflicts:t,loading:n,error:r}=Fi();if(n)return null;if(r===`server`){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`section`,{"data-testid":`conflicts-section`,"aria-label":`Conflicted files`,className:`border-b border-amber-200/60 bg-amber-50/40 px-2 py-2 dark:border-amber-900/40 dark:bg-amber-950/20`,children:(0,Z.jsxs)(`p`,{"data-testid":`conflicts-section-error`,className:`px-2 py-1.5 text-[12px] text-amber-700 dark:text-amber-400`,children:[(0,Z.jsx)(Ro,{"aria-hidden":`true`,className:`mr-1.5 inline size-3`}),`Couldn't load conflicts — reload to retry.`]})}),e[0]=t):t=e[0],t}if(t.length===0)return null;let i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 font-mono text-[11px] uppercase tracking-wider text-amber-700 dark:text-amber-400`,children:[(0,Z.jsx)(Ro,{"aria-hidden":`true`,className:`size-3`}),`Conflicts`]}),e[1]=i):i=e[1];let a;e[2]===t.length?a=e[3]:(a=(0,Z.jsxs)(`header`,{className:`flex items-center justify-between px-2 pb-1.5`,children:[i,(0,Z.jsx)(`span`,{"data-testid":`conflicts-section-count`,className:`rounded-full bg-amber-500 px-1.5 py-0.5 font-mono text-[10px] font-medium leading-none text-white`,children:t.length})]}),e[2]=t.length,e[3]=a);let o;e[4]===t?o=e[5]:(o=t.map(iP),e[4]=t,e[5]=o);let s;e[6]===o?s=e[7]:(s=(0,Z.jsx)(`ul`,{className:`flex flex-col gap-px`,children:o}),e[6]=o,e[7]=s);let c;return e[8]!==a||e[9]!==s?(c=(0,Z.jsxs)(`section`,{"data-testid":`conflicts-section`,"aria-label":`Conflicted files`,className:`border-b border-amber-200/60 bg-amber-50/40 px-2 py-2 dark:border-amber-900/40 dark:bg-amber-950/20`,children:[a,s]}),e[8]=a,e[9]=s,e[10]=c):c=e[10],c}function iP(e){return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(li,{variant:`ghost`,size:`sm`,"data-testid":`conflicts-section-row`,"data-file":e.file,title:e.file,className:`h-7 w-full justify-start gap-1.5 px-2 font-normal text-[13px] text-amber-800 hover:bg-amber-100/60 hover:text-amber-900 dark:text-amber-300 dark:hover:bg-amber-900/30 dark:hover:text-amber-200`,onClick:()=>nP(e.file),children:[(0,Z.jsx)(Ro,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:e.file})]})},e.file)}var aP=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
|
|
30
30
|
<symbol id="file-tree-icon-chevron" viewBox="0 0 16 16">
|
|
31
31
|
<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"/>
|
|
32
32
|
</symbol>
|
|
@@ -43,72 +43,72 @@ Error generating stack: `+e.message+`
|
|
|
43
43
|
<symbol id="file-tree-icon-ellipsis" viewBox="0 0 16 16">
|
|
44
44
|
<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" />
|
|
45
45
|
</symbol>
|
|
46
|
-
</svg>`,
|
|
46
|
+
</svg>`,oP=`<symbol id="file-tree-builtin-astro" viewBox="0 0 16 16">
|
|
47
47
|
<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"/>
|
|
48
48
|
<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"/>
|
|
49
|
-
</symbol>`,
|
|
49
|
+
</symbol>`,sP=`<symbol id="file-tree-builtin-babel" viewBox="0 0 16 16">
|
|
50
50
|
<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"/>
|
|
51
|
-
</symbol>`,
|
|
51
|
+
</symbol>`,cP=`<symbol id="file-tree-builtin-bash" viewBox="0 0 16 16">
|
|
52
52
|
<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"/>
|
|
53
53
|
<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"/>
|
|
54
|
-
</symbol>`,
|
|
54
|
+
</symbol>`,lP=`<symbol id="file-tree-builtin-biome" viewBox="0 0 16 16">
|
|
55
55
|
<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"/>
|
|
56
|
-
</symbol>`,
|
|
56
|
+
</symbol>`,uP=`<symbol id="file-tree-builtin-bootstrap" viewBox="0 0 16 16">
|
|
57
57
|
<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"/>
|
|
58
58
|
<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"/>
|
|
59
|
-
</symbol>`,
|
|
59
|
+
</symbol>`,dP=`<symbol id="file-tree-builtin-browserslist" viewBox="0 0 16 16">
|
|
60
60
|
<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"/>
|
|
61
61
|
<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"/>
|
|
62
62
|
<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"/>
|
|
63
|
-
</symbol>`,
|
|
63
|
+
</symbol>`,fP=`<symbol id="file-tree-builtin-bun" viewBox="0 0 16 16">
|
|
64
64
|
<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"/>
|
|
65
|
-
</symbol>`,
|
|
65
|
+
</symbol>`,pP=`<symbol id="file-tree-builtin-c" viewBox="0 0 16 16">
|
|
66
66
|
<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"/>
|
|
67
|
-
</symbol>`,
|
|
67
|
+
</symbol>`,mP=`<symbol id="file-tree-builtin-claude" viewBox="0 0 16 16">
|
|
68
68
|
<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"/>
|
|
69
|
-
</symbol>`,
|
|
69
|
+
</symbol>`,hP=`<symbol id="file-tree-builtin-cpp" viewBox="0 0 16 16">
|
|
70
70
|
<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"/>
|
|
71
|
-
</symbol>`,
|
|
71
|
+
</symbol>`,gP=`<symbol id="file-tree-builtin-css" viewBox="0 0 16 16">
|
|
72
72
|
<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"/>
|
|
73
73
|
<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"/>
|
|
74
|
-
</symbol>`,
|
|
74
|
+
</symbol>`,_P=`<symbol id="file-tree-builtin-database" viewBox="0 0 16 16">
|
|
75
75
|
<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"/>
|
|
76
76
|
<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"/>
|
|
77
77
|
<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"/>
|
|
78
|
-
</symbol>`,
|
|
78
|
+
</symbol>`,vP=`<symbol id="file-tree-builtin-default" viewBox="0 0 16 16">
|
|
79
79
|
<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"/>
|
|
80
80
|
<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"/>
|
|
81
|
-
</symbol>`,
|
|
81
|
+
</symbol>`,yP=`<symbol id="file-tree-builtin-docker" viewBox="0 0 16 16">
|
|
82
82
|
<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"/>
|
|
83
83
|
<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"/>
|
|
84
|
-
</symbol>`,
|
|
84
|
+
</symbol>`,bP=`<symbol id="file-tree-builtin-eslint" viewBox="0 0 16 16">
|
|
85
85
|
<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"/>
|
|
86
86
|
<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"/>
|
|
87
|
-
</symbol>`,
|
|
87
|
+
</symbol>`,xP=`<symbol id="file-tree-builtin-font" viewBox="0 0 16 16">
|
|
88
88
|
<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"/>
|
|
89
|
-
</symbol>`,
|
|
89
|
+
</symbol>`,SP=`<symbol id="file-tree-builtin-git" viewBox="0 0 16 16">
|
|
90
90
|
<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"/>
|
|
91
|
-
</symbol>`,
|
|
91
|
+
</symbol>`,CP=`<symbol id="file-tree-builtin-go" viewBox="0 0 16 16">
|
|
92
92
|
<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"/>
|
|
93
|
-
</symbol>`,
|
|
93
|
+
</symbol>`,wP=`<symbol id="file-tree-builtin-graphql" viewBox="0 0 16 16">
|
|
94
94
|
<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"/>
|
|
95
|
-
</symbol>`,
|
|
95
|
+
</symbol>`,TP=`<symbol id="file-tree-builtin-html" viewBox="0 0 16 16">
|
|
96
96
|
<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"/>
|
|
97
97
|
<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"/>
|
|
98
|
-
</symbol>`,
|
|
98
|
+
</symbol>`,EP=`<symbol id="file-tree-builtin-image" viewBox="0 0 16 16">
|
|
99
99
|
<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"/>
|
|
100
100
|
<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"/>
|
|
101
|
-
</symbol>`,
|
|
101
|
+
</symbol>`,DP=`<symbol id="file-tree-builtin-javascript" viewBox="0 0 16 16">
|
|
102
102
|
<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"/>
|
|
103
103
|
<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"/>
|
|
104
|
-
</symbol>`,
|
|
104
|
+
</symbol>`,OP=`<symbol id="file-tree-builtin-json" viewBox="0 0 16 16">
|
|
105
105
|
<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"/>
|
|
106
|
-
</symbol>`,
|
|
106
|
+
</symbol>`,kP=`<symbol id="file-tree-builtin-markdown" viewBox="0 0 16 16">
|
|
107
107
|
<path fill="currentColor" d="M1 12V4h2l2 2.5L7 4h2v8H7V7.5l-2 2-2-2V12zm9-3 3 3.5L16 9h-2V4h-2v5z"/>
|
|
108
|
-
</symbol>`,
|
|
108
|
+
</symbol>`,AP=`<symbol id="file-tree-builtin-mcp" viewBox="0 0 16 16">
|
|
109
109
|
<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"/>
|
|
110
110
|
<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"/>
|
|
111
|
-
</symbol>`,
|
|
111
|
+
</symbol>`,jP=`<symbol id="file-tree-builtin-nextjs" viewBox="0 0 16 16">
|
|
112
112
|
<defs>
|
|
113
113
|
<linearGradient id="a" x1="4.522" x2="14" y1="3.943" y2="16" gradientUnits="userSpaceOnUse">
|
|
114
114
|
<stop stop-color="currentColor"/>
|
|
@@ -118,82 +118,82 @@ Error generating stack: `+e.message+`
|
|
|
118
118
|
<path fill="currentColor" d="M3 2h1.522v9.09H3z"/>
|
|
119
119
|
<path fill="url(#a)" d="M4.903 2 15 15.075q-.565.5-1.195.925L4.522 3.943z"/>
|
|
120
120
|
<path fill="currentColor" d="M12.172 2h-1.508v9.094h1.508z"/>
|
|
121
|
-
</symbol>`,
|
|
121
|
+
</symbol>`,MP=`<symbol id="file-tree-builtin-npm" viewBox="0 0 16 16">
|
|
122
122
|
<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"/>
|
|
123
123
|
<path fill="currentColor" d="M10.5 13H13V3H3v10h5V5.5h2.5z"/>
|
|
124
|
-
</symbol>`,
|
|
124
|
+
</symbol>`,NP=`<symbol id="file-tree-builtin-oxc" viewBox="0 0 16 16">
|
|
125
125
|
<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"/>
|
|
126
|
-
</symbol>`,
|
|
126
|
+
</symbol>`,PP=`<symbol id="file-tree-builtin-postcss" viewBox="0 0 16 16">
|
|
127
127
|
<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"/>
|
|
128
|
-
</symbol>`,
|
|
128
|
+
</symbol>`,FP=`<symbol id="file-tree-builtin-prettier" viewBox="0 0 16 16">
|
|
129
129
|
<path fill="currentColor" d="M6 12v1H4.93v-1zm1-2v1H2v-1zm6-4v1h-3V6zm-1-4v1H9V2z"/>
|
|
130
130
|
<path fill="currentColor" d="M11.5 10v1H8v-1zM5 6v1H2V6zm5-2v1H9V4z" opacity=".8"/>
|
|
131
131
|
<path fill="currentColor" d="M6 14v1H2v-1zm-.5-6v1H2V8zM13 4v1h-3V4zM4.93 2v1H2V2z" opacity=".6"/>
|
|
132
132
|
<path fill="currentColor" d="M4.93 12v1H2v-1zM13 8v1H9V8zM5.5 4v1H2V4zM9 2v1H4.93V2z" opacity=".4"/>
|
|
133
|
-
</symbol>`,
|
|
133
|
+
</symbol>`,IP=`<symbol id="file-tree-builtin-python" viewBox="0 0 16 16">
|
|
134
134
|
<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"/>
|
|
135
135
|
<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"/>
|
|
136
|
-
</symbol>`,
|
|
136
|
+
</symbol>`,LP=`<symbol id="file-tree-builtin-react" viewBox="0 0 16 16">
|
|
137
137
|
<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"/>
|
|
138
138
|
<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"/>
|
|
139
|
-
</symbol>`,
|
|
139
|
+
</symbol>`,RP=`<symbol id="file-tree-builtin-ruby" viewBox="0 0 16 16">
|
|
140
140
|
<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"/>
|
|
141
|
-
</symbol>`,
|
|
141
|
+
</symbol>`,zP=`<symbol id="file-tree-builtin-rust" viewBox="0 0 16 16">
|
|
142
142
|
<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"/>
|
|
143
|
-
</symbol>`,
|
|
143
|
+
</symbol>`,BP=`<symbol id="file-tree-builtin-sass" viewBox="0 0 16 16">
|
|
144
144
|
<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"/>
|
|
145
|
-
</symbol>`,
|
|
145
|
+
</symbol>`,VP=`<symbol id="file-tree-builtin-stylelint" viewBox="0 0 16 16">
|
|
146
146
|
<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"/>
|
|
147
147
|
<path fill="currentColor" d="M6.5 2.5V4l-2 1.5v-4zm5 3L9.5 4V2.5l2-1zM9 4H7V2.5h2z"/>
|
|
148
|
-
</symbol>`,
|
|
148
|
+
</symbol>`,HP=`<symbol id="file-tree-builtin-svelte" viewBox="0 0 16 16">
|
|
149
149
|
<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"/>
|
|
150
|
-
</symbol>`,
|
|
150
|
+
</symbol>`,UP=`<symbol id="file-tree-builtin-svg" viewBox="0 0 16 16">
|
|
151
151
|
<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"/>
|
|
152
152
|
<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"/>
|
|
153
|
-
</symbol>`,
|
|
153
|
+
</symbol>`,WP=`<symbol id="file-tree-builtin-svgo" viewBox="0 0 16 16">
|
|
154
154
|
<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"/>
|
|
155
155
|
<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"/>
|
|
156
|
-
</symbol>`,
|
|
156
|
+
</symbol>`,GP=`<symbol id="file-tree-builtin-swift" viewBox="0 0 16 16">
|
|
157
157
|
<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"/>
|
|
158
|
-
</symbol>`,
|
|
158
|
+
</symbol>`,KP=`<symbol id="file-tree-builtin-table" viewBox="0 0 16 16">
|
|
159
159
|
<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"/>
|
|
160
160
|
<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"/>
|
|
161
|
-
</symbol>`,
|
|
161
|
+
</symbol>`,qP=`<symbol id="file-tree-builtin-tailwind" viewBox="0 0 16 16">
|
|
162
162
|
<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"/>
|
|
163
|
-
</symbol>`,
|
|
163
|
+
</symbol>`,JP=`<symbol id="file-tree-builtin-terraform" viewBox="0 0 16 16">
|
|
164
164
|
<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"/>
|
|
165
|
-
</symbol>`,
|
|
165
|
+
</symbol>`,YP=`<symbol id="file-tree-builtin-text" viewBox="0 0 16 16">
|
|
166
166
|
<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"/>
|
|
167
167
|
<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"/>
|
|
168
|
-
</symbol>`,
|
|
168
|
+
</symbol>`,XP=`<symbol id="file-tree-builtin-typescript" viewBox="0 0 16 16">
|
|
169
169
|
<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"/>
|
|
170
170
|
<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"/>
|
|
171
|
-
</symbol>`,
|
|
171
|
+
</symbol>`,ZP=`<symbol id="file-tree-builtin-vite" viewBox="0 0 16 16">
|
|
172
172
|
<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"/>
|
|
173
|
-
</symbol
|
|
173
|
+
</symbol>`,QP=`<symbol id="file-tree-builtin-vscode" viewBox="0 0 16 16">
|
|
174
174
|
<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"/>
|
|
175
175
|
<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"/>
|
|
176
176
|
<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"/>
|
|
177
|
-
</symbol
|
|
177
|
+
</symbol>`,$P=`<symbol id="file-tree-builtin-vue" viewBox="0 0 16 16">
|
|
178
178
|
<path fill="currentColor" d="M9.62 2.25 8 5.02 6.38 2.25H1l7 12 7-12z" opacity=".5"/>
|
|
179
179
|
<path fill="currentColor" d="M9.54 2.25 8 4.95l-1.54-2.7H4l4 7 4-7z"/>
|
|
180
|
-
</symbol>`,
|
|
180
|
+
</symbol>`,eF=`<symbol id="file-tree-builtin-wasm" viewBox="0 0 16 16">
|
|
181
181
|
<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"/>
|
|
182
182
|
<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"/>
|
|
183
183
|
<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"/>
|
|
184
|
-
</symbol>`,
|
|
184
|
+
</symbol>`,tF=`<symbol id="file-tree-builtin-webpack" viewBox="0 0 16 16">
|
|
185
185
|
<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"/>
|
|
186
186
|
<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"/>
|
|
187
|
-
</symbol>`,
|
|
187
|
+
</symbol>`,nF=`<symbol id="file-tree-builtin-yml" viewBox="0 0 16 16">
|
|
188
188
|
<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"/>
|
|
189
|
-
</symbol>`,
|
|
189
|
+
</symbol>`,rF=`<symbol id="file-tree-builtin-zig" viewBox="0 0 16 16">
|
|
190
190
|
<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"/>
|
|
191
191
|
<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"/>
|
|
192
|
-
</symbol>`,
|
|
192
|
+
</symbol>`,iF=[cP,pP,hP,gP,_P,vP,xP,SP,CP,TP,EP,DP,OP,kP,AP,IP,RP,zP,GP,KP,YP,XP,`<symbol id="file-tree-builtin-zip" viewBox="0 0 16 16">
|
|
193
193
|
<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"/>
|
|
194
194
|
<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"/>
|
|
195
|
-
</symbol>`],
|
|
196
|
-
`)}\n</svg>`)}var cF=sF(oP,aF),lF={minimal:oP,standard:cF,complete:sF(cF,oF)},uF={".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`},dF={"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`},fF={jsx:`react`,sass:`sass`,scss:`sass`,tsx:`react`},pF=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`]),mF=new Set([`complete`]);function hF(e){return lF[e===`none`?`minimal`:e]}function gF(e){return`file-tree-builtin-${e}`}function _F(e){return e!==`none`&&mF.has(e)}function vF(e,t,n){if(e===`minimal`||e===`none`)return;let r=e===`complete`,i=uF[t.toLowerCase()];if(i!=null&&(r||pF.has(i)))return i;for(let e of n){if(r){let t=fF[e];if(t!=null)return t}let t=dF[e];if(t!=null&&(r||pF.has(t)))return t}return`default`}var yF=`file-tree-container`,bF=`data-file-tree-style`,xF=`data-file-tree-unsafe-css`,SF=`data-file-tree-scrollbar-measure`,CF=`data-file-tree-scrollbar-gutter-measured`,wF=`--trees-scrollbar-gutter-measured`,TF=`header`,EF=`context-menu`,DF=`context-menu-trigger`;function OF(e){return e.spriteSheet!=null||e.remap!=null||e.byFileName!=null||e.byFileExtension!=null||e.byFileNameContains!=null}function kF(e){return e==null?{set:`complete`,colored:!0}:typeof e==`string`?{set:e,colored:!0}:{...e,set:e.set??(OF(e)?`none`:`complete`),colored:e.colored??!0}}var AF=e=>e.trim().toLowerCase(),jF=e=>e.split(`/`).at(-1)??e,MF=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 NF(e,t){return typeof e==`string`?{name:e,remappedFrom:t}:{...e,remappedFrom:t}}function PF(e){let t=kF(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(AF(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 n=jF(o),s=n.toLowerCase(),c=r.get(s);if(c!=null)return NF(c,e);for(let[t,n]of a)if(s.includes(t))return NF(n,e);let l=MF(n);for(let t of l){let n=i.get(t);if(n!=null)return NF(n,e)}let u=vF(t.set,n,l);if(u!=null&&t.set!==`none`)return{name:gF(u),remappedFrom:e,token:u}}let s=n?.[e];return s==null?{name:e}:NF(s,e)}}}var FF=/^#(?:[0-9a-f]{3}0|[0-9a-f]{6}00)$/i,IF=/^0(?:\.0+)?%?$/;function LF(e){let t=e.indexOf(`(`);if(t<=0||!e.endsWith(`)`))return;let n=e.slice(0,t).trim();if(!/^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color)$/i.test(n))return;let r=e.slice(t+1,-1).trim();if(r.length===0)return;let i=r.lastIndexOf(`/`);if(i!==-1)return r.slice(i+1).trim();if(/^(?:rgba|hsla)$/i.test(n)){let e=r.split(`,`);if(e.length===4)return e[3]?.trim()}}function RF(e){if(e==null)return!1;let t=e.trim().toLowerCase();if(t===`transparent`||FF.test(t))return!0;let n=LF(t);return n!=null&&IF.test(n)}function zF(e){return RF(e)?void 0:e}function BF(e){let t=e.colors??{},n=t[`sideBar.background`]??t[`editor.background`]??e.bg,r=t[`sideBar.foreground`]??t[`editor.foreground`]??e.fg,i=t[`sideBar.border`],a=t[`list.activeSelectionForeground`]??t[`sideBar.foreground`],o=n?.toLowerCase(),s=t[`list.hoverBackground`],c=s?.toLowerCase()===o?void 0:s,l=t[`list.activeSelectionBackground`],u=l?.toLowerCase()===o?t[`list.focusBackground`]??t[`editor.selectionBackground`]:l??t[`editor.selectionBackground`],d=zF(t[`list.focusOutline`])??zF(t.focusBorder),f=t[`input.background`]??n,p=t[`input.border`],m=t[`scrollbarSlider.background`],h=t[`sideBarSectionHeader.foreground`]??r,g=t[`gitDecoration.addedResourceForeground`]??t[`terminal.ansiGreen`]??t[`editorGutter.addedBackground`],_=t[`gitDecoration.modifiedResourceForeground`]??t[`terminal.ansiBlue`]??t[`editorGutter.modifiedBackground`],v=t[`gitDecoration.deletedResourceForeground`]??t[`terminal.ansiRed`]??t[`editorGutter.deletedBackground`],y=e.type===`dark`,b={colorScheme:y?`dark`:`light`,backgroundColor:n??``,color:r??``,borderColor:`var(--trees-theme-sidebar-border, light-dark(oklch(0% 0 0 / 0.15), oklch(100% 0 0 / 0.15)))`,"--trees-theme-sidebar-bg":n??``,"--trees-theme-sidebar-fg":r??``,"--trees-theme-sidebar-header-fg":h??``,"--trees-theme-list-active-selection-fg":a??r??``,"--trees-theme-list-hover-bg":c??(y?`rgba(255,255,255,0.08)`:`rgba(0,0,0,0.06)`),"--trees-theme-list-active-selection-bg":u??`transparent`,"--trees-theme-focus-ring":d??r??``,"--trees-theme-input-bg":f??``};return i!=null&&i!==``&&(b[`--trees-theme-sidebar-border`]=i),p!=null&&p!==``&&(b[`--trees-theme-input-border`]=p),m!=null&&m!==``&&(b[`--trees-theme-scrollbar-thumb`]=m),g!=null&&g!==``&&(b[`--trees-theme-git-added-fg`]=g),_!=null&&_!==``&&(b[`--trees-theme-git-modified-fg`]=_),v!=null&&v!==``&&(b[`--trees-theme-git-deleted-fg`]=v),b}var VF=5,HF=1<<VF,UF=HF*4;function WF(){return{childIdByNameId:new Map,childIds:[],childPositionById:new Map,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function GF(){return{childIdByNameId:null,childIds:[],childPositionById:null,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function KF(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 qF(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 JF(e,t){e.childPositionById!=null&&e.childPositionById.set(t,e.childIds.length),e.childIds.push(t)}function YF(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 XF(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,eI(e,t)}function ZF(e,t,n,r){if(e.totalChildSubtreeNodeCount+=n,e.totalChildVisibleSubtreeCount+=r,e.childVisibleChunkSums==null||r===0)return;let i=qF(e).get(t);if(i===void 0)return;let a=i>>VF;e.childVisibleChunkSums[a]+=r}function QF(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=tI(e,t,a,i);return{...r,childVisibleIndex:n-r.localVisibleIndex}}i-=o,a+=HF}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 $F(e,t,n){let r=0,i=t.childVisibleChunkSums,a=0;if(i!=null){let e=n>>VF;for(let t=0;t<e;t+=1)r+=i[t]??0;a=e<<VF}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 eI(e,t){if(t.childIds.length<UF){t.childVisibleChunkSums=null;return}let n=Math.ceil(t.childIds.length/HF),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>>VF]+=a.visibleSubtreeCount)}t.childVisibleChunkSums=r}function tI(e,t,n,r){let i=Math.min(t.childIds.length,n+HF),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 nI=7,rI=3,iI=1<<rI,aI=4;function oI(e,t,n=0){return e<<aI|n<<rI|t}function sI(e){return e.depthAndFlags>>>aI}function cI(e){return(e.depthAndFlags&iI)>>rI}function lI(e){return(e.depthAndFlags&iI)!==0}function uI(e){return e.depthAndFlags&nI}function dI(e,t){return(uI(e)&t)!==0}function fI(e,t){e.depthAndFlags|=t}function pI(e,t){e.depthAndFlags=oI(t,uI(e),cI(e))}var mI=Symbol(`benchmarkInstrumentation`);function hI(e,t){return t==null||Object.defineProperty(e,mI,{configurable:!0,enumerable:!1,value:t,writable:!1}),e}function gI(e){return e==null?null:e[mI]??null}function _I(e,t,n){return e==null?n():e.measurePhase(t,n)}function vI(e,t,n){!Number.isFinite(n)||e==null||e.setCounter(t,n)}function yI(e){return e>=48&&e<=57}function bI(e){let t=[],n=0,r=0;for(;r<e.length;){for(;r<e.length&&!yI(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&&yI(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 xI(e){let t=e.toLowerCase();return{lowerValue:t,tokens:bI(t)}}function SI(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 CI(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=SI(e.tokens,t.tokens);return n===0?e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1:n}function wI(e,t,n){let r=CI(n(e),n(t));return r===0?e===t?0:e<t?-1:1:r}function TI(e,t){return wI(e,t,xI)}function EI(e,t){return t===e.segments.length-1?+!!e.isDirectory:1}function DI(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=EI(e,r);return a===EI(t,r)?TI(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 OI(e,t){return DI(e,t)}function kI(e,t,n){let r=e=>{let t=n.get(e);if(t!=null)return t;let r=xI(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=EI(e,n);return o===EI(t,n)?wI(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 AI(e,t){let n=e.sortKeyById[t];if(n!==void 0)return n;let r=e.valueById[t],i=xI(r);return e.sortKeyById[t]=i,i}function jI(e={}){return{flattenEmptyDirectories:e.flattenEmptyDirectories!==!1,sort:e.sort??`default`}}function MI(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 NI(e){let{hasTrailingSlash:t,segments:n}=MI(e);return{basename:n[n.length-1]??``,isDirectory:t,path:e,segments:n}}function PI(e){if(e.length===0)return{requiresDirectory:!1,segments:[]};let{hasTrailingSlash:t,segments:n}=MI(e);return{requiresDirectory:t,segments:n}}var FI=``;function II(){let e=new Map;return e.set(FI,0),{idByValue:e,valueById:[FI],sortKeyById:[xI(FI)]}}function LI(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 RI(e,t){let n=e.valueById[t];if(n===void 0)throw Error(`Unknown segment ID: ${String(t)}`);return n}var zI=Symbol(`pathStorePreparedInputKind`);function BI(e,t){return e[zI]=t,e}function VI(e){return{basename:e.basename,depth:e.segments.length,isDirectory:e.isDirectory,path:e.path,segments:e.segments}}function HI(e,t,n){return n===`default`?OI(e,t):n(VI(e),VI(t))}function UI(){return{depthAndFlags:oI(0,3,1),nameId:0,parentId:0,subtreeNodeCount:1,visibleSubtreeCount:1}}function WI(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 GI(e){return e.isDirectory?e.segments.length:e.segments.length-1}function KI(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 qI(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function JI(e,t={}){return eL(e,t).map(e=>e.path)}function YI(e,t={}){let n=eL(e,t);return BI({paths:n.map(e=>e.path),preparedPaths:n},`prepared`)}function XI(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 BI({paths:e,presortedPaths:e,presortedPathsContainDirectories:n},`presorted`)}function ZI(e){let t=e,n=t.preparedPaths;if(t[zI]===`prepared`&&n!=null)return n;if(!KI(n))throw Error(`preparedInput must come from PathStore.prepareInput()`);return n}function QI(e){let t=e;return t[zI]===`presorted`&&t.presortedPaths!=null||qI(t.presortedPaths)?t.presortedPaths:null}function $I(e){let t=e;return typeof t.presortedPathsContainDirectories==`boolean`?t.presortedPathsContainDirectories:null}function eL(e,t={}){let n=jI(t),r=gI(t);vI(r,`workload.inputFiles`,e.length);let i=_I(r,`store.preparePathEntries.parse`,()=>e.map(e=>NI(e)));return _I(r,`store.preparePathEntries.sort`,()=>i.sort((e,t)=>HI(e,t,n.sort))),i}var tL=class{directories=new Map;directoryStack=[0];presortedDirectoryNodeIds=[];initialExpandedPathSet;createdDirectoriesAllExpanded=!1;createdDirectoryCount=0;lastPreparedPath=null;nodes=[UI()];options;instrumentation;segmentSortKeyCache=new Map;segmentTable=II();hasDeferredDirectoryIndexes=!1;constructor(e={}){this.instrumentation=gI(e),this.options=jI(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,WF())}appendPaths(e){return _I(this.instrumentation,`store.builder.appendPaths.parse`,()=>this.appendPreparedPaths(e.map(e=>NI(e))))}appendPreparedPaths(e,t=!0){return this.createdDirectoriesAllExpanded=!1,_I(this.instrumentation,`store.builder.appendPreparedPaths`,()=>{for(let n of e)this.appendPreparedPath(n,t)}),this}appendPresortedPaths(e,t=null){return _I(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:oI(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:oI(r,0,1),nameId:u,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),l++,c[l]=d}let e=c[l];if(e===void 0)throw Error(`Unable to resolve directory node for "${t}"`);this.promoteDirectoryToExplicit(e,t)}else{let e=c[l];if(e===void 0)throw Error(`Unable to resolve file parent for "${t}"`);let n=t.slice(m),a=o.get(n);a===void 0&&(a=s.length,o.set(n,a),s.push(n)),i.push({depthAndFlags:oI(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=NI(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:oI(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:oI(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=NI(t)),this.hasDeferredDirectoryIndexes=!0}finish(e={}){let t=e.skipSubtreeCountPass===!0;return this.hasDeferredDirectoryIndexes?(_I(this.instrumentation,`store.builder.buildDirectoryIndexes`,()=>this.buildPresortedFinish(t)),this.hasDeferredDirectoryIndexes=!1):t||_I(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`?kI(this.lastPreparedPath,e,this.segmentSortKeyCache):HI(this.lastPreparedPath,e,this.options.sort))>0)throw Error(`Builder input must be sorted before appendPaths(): "${e.path}"`)}let n=this.lastPreparedPath,r=GI(e),i=n==null?0:GI(n),a=n==null?0:WI(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=LI(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:oI(sI(o)+1,0),nameId:r,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),a?.set(r,s),JF(i,s),s}createFileChildUnchecked(e,t){let n=LI(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:oI(sI(i)+1,0),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),JF(r,a),a}getOrCreateDirectoryChild(e,t){let n=LI(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&&!lI(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:oI(sI(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),JF(r,a),this.directories.set(a,WF()),a}createDirectoryChild(e,t){let n=LI(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:oI(sI(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),JF(r,a),this.directories.set(a,WF()),a}promoteDirectoryToExplicit(e,t){let n=this.nodes[e];if(n===void 0)throw Error(`Unknown directory node ID: ${String(e)}`);if(!lI(n))throw Error(`Path is not a directory: "${t}"`);if(dI(n,1))throw Error(`Duplicate path: "${t}"`);fI(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,GF());let r=-1,i=null;for(let e=1;e<t.length;e++){let a=t[e];if(a==null)continue;if(lI(a)){let t=GF();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;lI(n)&&this.directories.set(t,WF());let r=this.directories.get(n.parentId);r!=null&&(r.childIdByNameId!=null&&r.childIdByNameId.set(n.nameId,t),JF(r,t))}}computeSubtreeCounts(e){let t=this.nodes[e];if(t===void 0)throw Error(`Unknown node ID: ${String(e)}`);if(!lI(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 XF(this.nodes,n),t.subtreeNodeCount=r,t.visibleSubtreeCount=r,r}};function nL(e,t=`closed`,n=null){let r=iL(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 rL(){return{affectedAncestorIds:new Set,affectedNodeIds:new Set,events:[]}}function iL(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 aL(e,t){return dI(t,2)||e.defaultExpansion===`open`?!0:e.defaultExpansion===`closed`?!1:sI(t)<=e.defaultExpansion}function oL(e,t,n=e.snapshot.nodes[t]){return n==null||!lI(n)?!1:e.directoriesOpenByDefault&&!e.hasCollapsedDirectoryOverrides?!0:e.collapsedDirectoryIds.has(t)?!1:e.expandedDirectoryIds.has(t)?!0:aL(e,n)}function sL(e,t,n,r=e.snapshot.nodes[t]){if(r==null||!lI(r))return;let i=aL(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 cL(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 lL(e,t){return e.directoryLoadInfoById.get(t)?.state??`loaded`}function uL(e,t){let n=cL(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 dL(e,t){let n=cL(e,t);n.activeAttemptId=null,n.errorMessage=null,n.state=`unloaded`}function fL(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 pL(e,t,n){return e.directoryLoadInfoById.get(t)?.activeAttemptId===n}function mL(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 hL(e,t){e.directoryLoadInfoById.delete(t)}function gL(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 _L(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`add`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function vL(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`remove`,path:e.path,projectionChanged:e.projectionChanged,recursive:e.recursive,visibleCountDelta:null}}function yL(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,from:e.from,operation:`move`,projectionChanged:e.projectionChanged,to:e.to,visibleCountDelta:null}}function bL(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`expand`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function xL(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`collapse`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function SL(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`mark-directory-unloaded`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function CL(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 wL(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 TL(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 EL(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 DL(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 OL(e,t,n){return{...n,visibleCountDelta:zL(e)-t}}function kL(e,t){let n=zL(e),r=rL();e.transactionStack.push(r);try{t()}catch(t){throw ML(e,r,!1),t}ML(e,r,!0,zL(e)-n)}function AL(e,t){let n=e.instrumentation;if(n==null){jL(e,t);return}_I(n,`store.events.record`,()=>jL(e,t))}function jL(e,t){let n=e.transactionStack[e.transactionStack.length-1]??null;if(n==null){LL(e,t);return}n.events.push(t),IL(n,t)}function ML(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?FL(i,t):_I(n,`store.events.batch.merge`,()=>FL(i,t));return}let a=NL(t,r),o=e.instrumentation;if(o==null){LL(e,a);return}_I(o,`store.events.batch.commit`,()=>LL(e,a))}function NL(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 PL(e,t){for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n);for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n)}function FL(e,t){for(let n of t.events)e.events.push(n);PL(e,t)}function IL(e,t){for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n);for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n)}function LL(e,t){let n=e.instrumentation;if(n==null){RL(e,t);return}_I(n,`store.events.emit`,()=>RL(e,t))}function RL(e,t){e.listeners.get(t.operation)?.forEach(e=>e(t)),e.listeners.get(`*`)?.forEach(e=>e(t))}function zL(e){return e.snapshot.nodes[e.snapshot.rootId]?.visibleSubtreeCount??0}function BL(e,t){if(e.snapshot.options.flattenEmptyDirectories!==!0)return null;let n=e.snapshot.nodes[t];if(n==null||!lI(n)||dI(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||!lI(a)?null:i}function VL(e,t){let n=t;for(;;){let t=BL(e,n);if(t==null)return n;n=t}}function HL(e,t){let n=[t],r=t;for(;;){let t=BL(e,r);if(t==null)return n;n.push(t),r=t}}function UL(e,t){let n=t==null?e.snapshot.rootId:$L(e,t);return n==null?[]:rR(e,n)}function WL(e,t){let n=NI(t),r=n.isDirectory?n.segments:n.segments.slice(0,-1),i=vR(e,_R(e,r)),{createdNodeIds:a,directoryId:o}=iR(e,r),s=new Set(a),c=o;if(n.isDirectory){let n=nR(e,o);if(dI(n,1))throw Error(`Path already exists: "${t}"`);fI(n,1),e.pathCacheByNodeId.set(o,{path:t,version:e.pathCacheVersion}),s.add(o)}else c=oR(e,o,n.basename),s.add(c);XL(e,o);let l=vR(e,o);return _L({affectedAncestorIds:QL(e,c),affectedNodeIds:[...s],path:t,projectionChanged:yR(i,l)})}function GL(e,t,n){let r=$L(e,t);if(r==null)throw Error(`Path does not exist: "${t}"`);let i=nR(e,r);if(dI(i,2))throw Error(`The root node cannot be removed`);if(lI(i)&&tR(e,r).childIds.length>0&&n.recursive!==!0)throw Error(`Cannot remove a non-empty directory without recursive: "${t}"`);let a=i.parentId,o=vR(e,a),s=hR(e,r);lR(e,a,r,i.nameId),gR(e,a),XL(e,a);let c=vR(e,a);return vL({affectedAncestorIds:QL(e,a),affectedNodeIds:s,path:t,projectionChanged:yR(o,c),recursive:n.recursive===!0})}function KL(e,t,n,r){let i=$L(e,t);if(i==null)throw Error(`Source path does not exist: "${t}"`);let a=nR(e,i);if(dI(a,2))throw Error(`The root node cannot be moved`);let o=r.collision??`error`,s=pR(e,i,n),c=vR(e,a.parentId),l=vR(e,s.parentId),u=RI(e.snapshot.segmentTable,a.nameId),d=LI(e.snapshot.segmentTable,s.basename);if(s.parentId===a.parentId&&u===s.basename)return null;if(lI(a)&&CR(e,i,s.parentId))throw Error(`Cannot move a directory into one of its descendants`);let f=KF(e.snapshot.nodes,tR(e,s.parentId)).get(d),p=s.existingNodeId??f??null;if(p!=null&&p!==i&&mR(e,p,o,cI(a))===`skip`)return null;let m=a.parentId;lR(e,m,i,a.nameId),a.parentId=s.parentId,a.nameId=d,e.pathCacheByNodeId.delete(i),SR(e,i),cR(e,s.parentId,i),gR(e,m),e.pathCacheVersion++,XL(e,m),s.parentId!==m&&XL(e,s.parentId);let h=vR(e,m),g=vR(e,s.parentId);return yL({affectedAncestorIds:[...new Set([...QL(e,m),...QL(e,s.parentId)])],affectedNodeIds:[i],from:t,projectionChanged:bR([c,l],[h,g]),to:YL(e,i)})}function qL(e,t){let n=e.pathCacheByNodeId.get(t);return n!=null&&n.version===e.pathCacheVersion?n.path:null}function JL(e,t,n){return e.pathCacheByNodeId.set(t,{path:n,version:e.pathCacheVersion}),n}function YL(e,t){let n=nR(e,t),r=qL(e,t);if(r!=null)return r;if(dI(n,2))return JL(e,t,``);let i=YL(e,n.parentId),a=RI(e.snapshot.segmentTable,n.nameId),o=i.length===0?a:`${i}${a}`;return JL(e,t,lI(n)?`${o}/`:o)}function XL(e,t){let n=e.instrumentation;if(n==null){TR(e,t);return}_I(n,`store.recomputeCountsUpwardFrom`,()=>TR(e,t))}function ZL(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||!lI(o)){wR(e,a,o,!0),n.pop();continue}let s=i.get(a);if(s==null||t[1]>=s.childIds.length){wR(e,a,o,!0),n.pop();continue}let c=s.childIds[t[1]++];n.push([c,0])}}function QL(e,t){let n=[],r=t;for(;r!=null;){let t=nR(e,r);if(n.push(r),r===e.snapshot.rootId)break;r=t.parentId}return n}function $L(e,t){if(t.length===0)return e.snapshot.rootId;let n=PI(t);return eR(e,n.segments,n.requiresDirectory)}function eR(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=tR(e,r),a=KF(e.snapshot.nodes,i).get(t);if(a===void 0)return null;r=a}let i=nR(e,r);return n&&!lI(i)?null:r}function tR(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 nR(e,t){let n=e.snapshot.nodes[t];if(n===void 0||dI(n,4))throw Error(`Unknown node ID: ${String(t)}`);return n}function rR(e,t){let n=e.snapshot.nodes[t];if(n===void 0||dI(n,4))return[];if(!lI(n))return[YL(e,t)];if(tR(e,t).childIds.length===0)return dI(n,1)&&!dI(n,2)?[YL(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||dI(n,4)){i.pop();continue}if(!lI(n)){r.push(YL(e,t.nodeId)),i.pop();continue}let a=tR(e,t.nodeId);if(a.childIds.length===0){dI(n,1)&&!dI(n,2)&&r.push(YL(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 iR(e,t){let n=[],r=e.snapshot.rootId;for(let i of t){let t=LI(e.snapshot.segmentTable,i),a=tR(e,r),o=KF(e.snapshot.nodes,a).get(t);if(o!==void 0){if(!lI(nR(e,o)))throw Error(`Cannot create a directory that collides with an existing file: "${i}"`);r=o;continue}r=aR(e,r,t),n.push(r)}return{createdNodeIds:n,directoryId:r}}function aR(e,t,n){let r=nR(e,t),i=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:oI(sI(r)+1,0,1),nameId:n,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),e.snapshot.directories.set(i,WF()),cR(e,t,i),e.collapseNewDirectoriesByDefault&&(e.collapsedDirectoryIds.add(i),e.hasCollapsedDirectoryOverrides=!0),e.activeNodeCount++,i}function oR(e,t,n){let r=LI(e.snapshot.segmentTable,n),i=tR(e,t);if(KF(e.snapshot.nodes,i).has(r))throw Error(`Path already exists: "${DR(e,t,n)}"`);let a=nR(e,t),o=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:oI(sI(a)+1,0),nameId:r,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),cR(e,t,o),e.activeNodeCount++,o}function sR(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}uR(e,n,o)<0?i=a:r=a+1}return r}function cR(e,t,n){let r=tR(e,t),i=nR(e,n);KF(e.snapshot.nodes,r).set(i.nameId,n),ZF(r,n,i.subtreeNodeCount,i.visibleSubtreeCount);let a=sR(e,r,n);r.childIds.splice(a,0,n),YF(r,a),eI(e.snapshot.nodes,r)}function lR(e,t,n,r){let i=tR(e,t),a=qF(i),o=a.get(n)??-1;KF(e.snapshot.nodes,i).delete(r),a.delete(n);let s=e.snapshot.nodes[n];s!=null&&ZF(i,n,-s.subtreeNodeCount,-s.visibleSubtreeCount),o>=0&&(i.childIds.splice(o,1),YF(i,o),eI(e.snapshot.nodes,i))}function uR(e,t,n){let r=e.snapshot.options.sort;return r===`default`?dR(e,t,n):r(fR(e,t),fR(e,n))}function dR(e,t,n){let r=nR(e,t),i=nR(e,n),a=lI(r);if(a!==lI(i))return a?-1:1;let o=CI(AI(e.snapshot.segmentTable,r.nameId),AI(e.snapshot.segmentTable,i.nameId));if(o!==0)return o;let s=RI(e.snapshot.segmentTable,r.nameId),c=RI(e.snapshot.segmentTable,i.nameId);return s===c?t<n?-1:1:s<c?-1:1}function fR(e,t){let n=nR(e,t),r=YL(e,t),i=lI(n),a=i?r.slice(0,-1):r;return{basename:RI(e.snapshot.segmentTable,n.nameId),depth:sI(n),isDirectory:i,path:r,segments:a.length===0?[]:a.split(`/`)}}function pR(e,t,n){let r=nR(e,t),i=$L(e,n);if(i!=null){let t=nR(e,i);if(lI(t))return{basename:RI(e.snapshot.segmentTable,r.nameId),existingNodeId:null,parentId:i};let a=PI(n).segments;return{basename:a[a.length-1]??``,existingNodeId:i,parentId:t.parentId}}let a=PI(n),o=a.segments[a.segments.length-1]??``,s=a.segments.slice(0,-1),c=s.length===0?e.snapshot.rootId:eR(e,s,!0);if(c==null)throw Error(`Destination parent does not exist: "${n}"`);return{basename:o,existingNodeId:null,parentId:c}}function mR(e,t,n,r){if(n===`skip`)return`skip`;if(n===`error`)throw Error(`Destination already exists: "${YL(e,t)}"`);let i=nR(e,t);if(cI(i)!==r)throw Error(`replace collision requires the same source and destination kinds`);if(lI(i)&&tR(e,t).childIds.length>0)throw Error(`replace collision does not support non-empty directories`);let a=i.parentId,o=i.nameId;return hR(e,t),lR(e,a,t,o),gR(e,a),XL(e,a),`handled`}function hR(e,t){let n=[],r=[{nodeId:t,visitedChildren:!1}];for(;r.length>0;){let t=r.pop();if(t==null)break;let i=nR(e,t.nodeId);if(t.visitedChildren||!lI(i)){lI(i)&&e.snapshot.directories.delete(t.nodeId),fI(i,4),e.pathCacheByNodeId.delete(t.nodeId),e.collapsedDirectoryIds.delete(t.nodeId)&&(e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0),e.expandedDirectoryIds.delete(t.nodeId),hL(e,t.nodeId),e.activeNodeCount--,n.push(t.nodeId);continue}r.push({nodeId:t.nodeId,visitedChildren:!0});let a=tR(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 gR(e,t){let n=t;for(;n!=null;){let t=nR(e,n);if(!lI(t)||dI(t,2)||tR(e,n).childIds.length>0)return;fI(t,1),n=t.parentId===n?null:t.parentId}}function _R(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=KF(e.snapshot.nodes,tR(e,n)).get(t);if(i==null||!lI(nR(e,i)))break;n=i}return n}function vR(e,t){let n=xR(e,t);if(n==null)return null;let r=VL(e,n),i=nR(e,r),a=n===r?null:HL(e,n).map(t=>YL(e,t));return JSON.stringify({flattenedSegmentPaths:a,hasChildren:tR(e,r).childIds.length>0,path:YL(e,r),terminalKind:cI(i)})}function yR(e,t){return bR([e],[t])}function bR(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 xR(e,t){let n=t;for(;n!=null;){let t=nR(e,n);if(!lI(t)||dI(t,2))return null;if(!oL(e,n,t))return n;n=t.parentId}return null}function SR(e,t){let n=nR(e,t);if(pI(n,(t===e.snapshot.rootId?-1:sI(nR(e,n.parentId)))+1),!lI(n))return;let r=tR(e,t);for(let t of r.childIds)SR(e,t)}function CR(e,t,n){let r=n;for(;r!=null;){if(r===t)return!0;let n=nR(e,r);if(r===e.snapshot.rootId)return!1;r=n.parentId}return!1}function wR(e,t,n=nR(e,t),r=!1){let i=e.instrumentation;if(i==null){ER(e,t,n,r);return}_I(i,`store.recomputeNodeCounts`,()=>ER(e,t,n,r))}function TR(e,t){let n=t;for(;n!=null;){let t=nR(e,n),r=t.subtreeNodeCount,i=t.visibleSubtreeCount;if(wR(e,n,t),n===e.snapshot.rootId)return;let a=t.subtreeNodeCount-r,o=t.visibleSubtreeCount-i,s=t.parentId;(a!==0||o!==0)&&ZF(tR(e,s),n,a,o),n=s}}function ER(e,t,n,r){if(!lI(n)){n.subtreeNodeCount=1,n.visibleSubtreeCount=1;return}let i=tR(e,t);if(r){let t=e.instrumentation;t==null?XF(e.snapshot.nodes,i):_I(t,`store.recomputeNodeCounts.rebuildChildAggregates`,()=>XF(e.snapshot.nodes,i))}let a=1+i.totalChildSubtreeNodeCount,o=i.totalChildVisibleSubtreeCount;if(n.subtreeNodeCount=a,dI(n,2)){n.visibleSubtreeCount=o;return}n.visibleSubtreeCount=BL(e,t)==null?oL(e,t,n)?1+o:1:o}function DR(e,t,n){let r=YL(e,t);return r.length===0?n:`${r}${n}`}function OR(e){return e!=null&&!dI(e,4)}function kR(e,t){let n=e.snapshot.nodes[t];return!OR(n)||!lI(n)||dI(n,2)?null:n}function AR(e){let t=0;for(let[n,r]of e.pathCacheByNodeId)r.version===e.pathCacheVersion&&OR(e.snapshot.nodes[n])&&(t+=1);return t}function jR(e){return Math.max(0,e.valueById.length-1)}function MR(e){return{activeNodeCount:e.activeNodeCount,cachedPathEntryCount:AR(e),loadInfoEntryCount:e.directoryLoadInfoById.size,segmentCount:jR(e.snapshot.segmentTable),totalNodeSlotCount:Math.max(0,e.snapshot.nodes.length-1)}}function NR(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 PR(e){let t=[],n=[];for(let n of e.collapsedDirectoryIds)kR(e,n)!=null&&t.push(YL(e,n));for(let t of e.expandedDirectoryIds)kR(e,t)!=null&&n.push(YL(e,t));return{collapsedPaths:t,expandedPaths:n}}function FR(e){let t=[];for(let[n,r]of e.directoryLoadInfoById)kR(e,n)==null||lL(e,n)===`loaded`||t.push({info:{activeAttemptId:null,errorMessage:r.errorMessage,nextAttemptId:r.nextAttemptId,state:r.state},path:YL(e,n)});return t}function IR(e,t){e.collapsedDirectoryIds.clear(),e.hasCollapsedDirectoryOverrides=!1,e.expandedDirectoryIds.clear();for(let n of t.expandedPaths){let t=$L(e,n);t!=null&&sL(e,t,!0,nR(e,t))}for(let n of t.collapsedPaths){let t=$L(e,n);t!=null&&sL(e,t,!1,nR(e,t))}}function LR(e,t){e.directoryLoadInfoById.clear();for(let n of t){let t=$L(e,n.path);t!=null&&kR(e,t)!=null&&e.directoryLoadInfoById.set(t,{activeAttemptId:null,errorMessage:n.info.errorMessage,nextAttemptId:n.info.nextAttemptId,state:n.info.state})}}function RR(e){e.pathCacheVersion+=1,e.pathCacheByNodeId.clear(),e.pathCacheByNodeId.set(e.snapshot.rootId,{path:``,version:e.pathCacheVersion})}function zR(e){let t=e.snapshot.segmentTable,n=II();for(let r of e.snapshot.nodes)if(OR(r)){if(dI(r,2)){r.nameId=0;continue}r.nameId=LI(n,RI(t,r.nameId))}e.snapshot.segmentTable=n}function BR(e){for(let[t,n]of e.snapshot.directories){let r=e.snapshot.nodes[t];if(!OR(r)||!lI(r)){e.snapshot.directories.delete(t);continue}let i=n.childIds.filter(n=>{let r=e.snapshot.nodes[n];return OR(r)&&r.parentId===t});n.childIds=i,n.childIdByNameId=new Map(i.map(t=>[nR(e,t).nameId,t])),n.childPositionById=new Map(i.map((e,t)=>[e,t])),XF(e.snapshot.nodes,n)}}function VR(e){let t=e.snapshot.nodes.length-1;for(;t>e.snapshot.rootId;){let n=e.snapshot.nodes[t];if(OR(n))break;--t}e.snapshot.nodes.length=t+1}function HR(e){let t=PR(e),n=FR(e);_I(e.instrumentation,`store.cleanup.stable.clearPathCaches`,()=>RR(e)),_I(e.instrumentation,`store.cleanup.stable.rebuildSegmentTable`,()=>zR(e)),_I(e.instrumentation,`store.cleanup.stable.rebuildDirectoryIndexes`,()=>BR(e)),_I(e.instrumentation,`store.cleanup.stable.trimTrailingRemovedNodeSlots`,()=>VR(e)),_I(e.instrumentation,`store.cleanup.stable.restoreExpansionOverrides`,()=>IR(e,t)),_I(e.instrumentation,`store.cleanup.stable.restoreDirectoryLoadInfos`,()=>LR(e,n)),_I(e.instrumentation,`store.cleanup.stable.recomputeCounts`,()=>ZL(e,e.snapshot.rootId))}function UR(e){let t=PR(e),n=FR(e),r=_I(e.instrumentation,`store.cleanup.aggressive.listPaths`,()=>UL(e)),i=hI({...e.snapshot.options},e.instrumentation),a=_I(e.instrumentation,`store.cleanup.aggressive.rebuildSnapshot`,()=>{let e=new tL(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,_I(e.instrumentation,`store.cleanup.aggressive.restoreExpansionOverrides`,()=>IR(e,t)),_I(e.instrumentation,`store.cleanup.aggressive.restoreDirectoryLoadInfos`,()=>LR(e,n)),_I(e.instrumentation,`store.cleanup.aggressive.recomputeCounts`,()=>ZL(e,e.snapshot.rootId))}function WR(e){for(let t of e.directoryLoadInfoById.values())if(t.state===`loading`&&t.activeAttemptId!=null)return!0;return!1}function GR(e,t){let n=MR(e);t===`stable`?_I(e.instrumentation,`store.cleanup.stable`,()=>HR(e)):_I(e.instrumentation,`store.cleanup.aggressive`,()=>UR(e));let r=MR(e);return NR(t,t===`stable`,n,r)}var KR=64;function qR(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 JR(e){return nR(e,e.snapshot.rootId).visibleSubtreeCount}function YR(e,t,n,r){let i=nR(e,t.terminalNodeId),a=Math.max(1,i.visibleSubtreeCount);return Math.min(r-1,n+a-1)}function XR(e,t,n,r){return{ancestorPaths:r,index:t.index,posInSet:t.posInSet,row:hz(e,t.cursor),setSize:t.setSize,subtreeEndIndex:YR(e,t.cursor,t.index,n)}}function ZR(e,t,n,r,i,a){let o=tR(e,t),{childIndex:s,childVisibleIndex:c,localVisibleIndex:l}=QF(e.snapshot.nodes,o,n),u=o.childIds[s];if(u==null)throw Error(`Visible index ${String(n)} is out of range`);return QR(e,u,l,r+c,i+1,s,o.childIds.length,a)}function QR(e,t,n,r,i,a,o,s){if(!lI(nR(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=lz(e,t,i);if(n===0)return{ancestors:s,cursor:c,index:r,posInSet:a,setSize:o};let l=nR(e,c.terminalNodeId);if(!lI(l)||!oL(e,c.terminalNodeId,l))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return ZR(e,c.terminalNodeId,n-1,r+1,c.visibleDepth,[...s,{cursor:c,index:r,posInSet:a,setSize:o}])}function $R(e,t){let n=JR(e);if(t<0||t>=n)return null;let r=ZR(e,e.snapshot.rootId,t,0,-1,[]),i=r.ancestors.map(t=>YL(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=XR(e,a,n,[...i]);t.push(r),i.push(r.row.path)}return a=t,a},index:r.index,posInSet:r.posInSet,row:hz(e,r.cursor),setSize:r.setSize,subtreeEndIndex:YR(e,r.cursor,r.index,n)}}function ez(e,t,n){let r=e.instrumentation,i=JR(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 mz(e,o+1);let t=[],n=oz(e,a);for(let r=a;r<=o&&n!=null;r++){let r=hz(e,n);t.push(r),n=dz(e,n)}return t}let s=[],c=0,l=0,u=_I(r,`store.getVisibleSlice.selectFirstRow`,()=>oz(e,a));for(let t=a;t<=o&&u!=null;t++){let t=_I(r,`store.getVisibleSlice.materializeRow`,()=>hz(e,u));s.push(t),t.isFlattened&&(c++,l+=t.flattenedSegments?.length??0),u=_I(r,`store.getVisibleSlice.advanceCursor`,()=>dz(e,u))}return vI(r,`workload.visibleRowsRead`,s.length),vI(r,`workload.flattenedRowsRead`,c),vI(r,`workload.flattenedSegmentsRead`,l),s}function tz(e,t=JR(e)){let n=e.instrumentation;return n==null?pz(e,t):_I(n,`store.getVisibleTreeProjection`,()=>pz(e,t))}function nz(e){return fz(tz(e))}function rz(e,t){let n=$L(e,t);if(n==null||n===e.snapshot.rootId||lI(nR(e,n))&&VL(e,n)!==n)return null;let r=0,i=n,{nodes:a,rootId:o}=e.snapshot;for(;i!==o;){let t=nR(e,i).parentId,n=tR(e,t),s=qF(n).get(i);if(s==null)throw Error(`Child ${String(i)} was not found in its parent index`);if(r+=$F(a,n,s),t!==o){let n=nR(e,t),a=BL(e,t);if(!oL(e,t,n)&&a!==i)return null;VL(e,t)===t&&(r+=1)}i=t}return r}function iz(e,t){let n=$L(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=nR(e,n);if(!lI(r))throw Error(`Path is not a directory: "${t}"`);return oL(e,n,r)?null:(sL(e,n,!0,r),XL(e,n),bL({affectedAncestorIds:QL(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0}))}function az(e,t){let n=$L(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=nR(e,n);if(!lI(r))throw Error(`Path is not a directory: "${t}"`);return oL(e,n,r)?(sL(e,n,!1,r),XL(e,n),xL({affectedAncestorIds:QL(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0})):null}function oz(e,t){return t<0||t>=JR(e)?null:sz(e,e.snapshot.rootId,t,-1)}function sz(e,t,n,r){let i=tR(e,t),a=e.instrumentation,{childIndex:o,localVisibleIndex:s}=a==null?QF(e.snapshot.nodes,i,n):_I(a,`store.getVisibleSlice.selectChildIndex`,()=>QF(e.snapshot.nodes,i,n)),c=i.childIds[o];if(c!=null)return cz(e,c,s,r+1);throw Error(`Visible index ${String(n)} is out of range`)}function cz(e,t,n,r){if(!lI(nR(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=lz(e,t,r);if(n===0)return i;let a=nR(e,i.terminalNodeId);if(!lI(a)||!oL(e,i.terminalNodeId,a))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return sz(e,i.terminalNodeId,n-1,i.visibleDepth)}function lz(e,t,n){return lI(nR(e,t))?e.instrumentation==null?{headNodeId:t,terminalNodeId:VL(e,t),visibleDepth:n}:{headNodeId:t,terminalNodeId:_I(e.instrumentation,`store.getVisibleSlice.flatten.resolveTerminalDirectory`,()=>VL(e,t)),visibleDepth:n}:{headNodeId:t,terminalNodeId:t,visibleDepth:n}}function uz(e,t){let n=nR(e,t);if(!lI(n))return!0;let r=n.parentId;return r===e.snapshot.rootId?!0:BL(e,r)!==t}function dz(e,t){let n=nR(e,t.terminalNodeId);if(lI(n)){let r=tR(e,t.terminalNodeId);if(oL(e,t.terminalNodeId,n)&&r.childIds.length>0){let n=r.childIds[0];return n==null?null:cz(e,n,0,t.visibleDepth+1)}}let r=t.terminalNodeId,i=t.visibleDepth;for(;;){let t=nR(e,r);if(r===e.snapshot.rootId)return null;let n=t.parentId,a=tR(e,n),o=qF(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 cz(e,s,0,i);uz(e,r)&&i--,r=n}}function fz(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 pz(e,t){let n=Array(t),r=new Int32Array(t),i=new Int32Array(t),a=new Int32Array(t),o=new Int32Array(KR);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=qR(o,y);let x,S=_;if(lI(v))S=f?VL(e,_):_,x=S===_?`${b}${h[v.nameId]}/`:YL(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&&lI(C)&&oL(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 mz(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(!lI(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:YL(e,f)};continue}let h=l?VL(e,f):f,g={headNodeId:f,terminalNodeId:h,visibleDepth:m};n[r++]=hz(e,g);let _=i[h];_!=null&&lI(_)&&oL(e,h,_)&&s.push([a.get(h),0,m])}return r<t&&(n.length=r),n}function hz(e,t){let n=nR(e,t.terminalNodeId),r=lI(n)?gz(e,t):null,i=YL(e,t.terminalNodeId),a=RI(e.snapshot.segmentTable,n.nameId),o=lI(n)&&tR(e,t.terminalNodeId).childIds.length>0,s=t.headNodeId!==t.terminalNodeId,c=e.instrumentation,l=s?c==null?HL(e,t.headNodeId).map(n=>{let r=nR(e,n);return{isTerminal:n===t.terminalNodeId,name:RI(e.snapshot.segmentTable,r.nameId),nodeId:n,path:YL(e,n)}}):_I(c,`store.getVisibleSlice.flatten.collectSegments`,()=>HL(e,t.headNodeId).map(n=>{let r=nR(e,n);return{isTerminal:n===t.terminalNodeId,name:RI(e.snapshot.segmentTable,r.nameId),nodeId:n,path:YL(e,n)}})):void 0;return{depth:t.visibleDepth,flattenedSegments:l,hasChildren:o,id:t.terminalNodeId,isExpanded:lI(n)&&oL(e,t.terminalNodeId,n),isFlattened:s,isLoading:r===`loading`,kind:lI(n)?`directory`:`file`,loadState:r==null||r===`loaded`?void 0:r,name:a,path:i}}function gz(e,t){if(t.headNodeId===t.terminalNodeId)return lL(e,t.terminalNodeId);let n=HL(e,t.headNodeId),r=!1,i=!1;for(let t of n){let n=lL(e,t);if(n===`loading`)return`loading`;if(n===`error`){i=!0;continue}n===`unloaded`&&(r=!0)}return i?`error`:r?`unloaded`:`loaded`}function _z(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||!lI(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&&eI(n,i),r.subtreeNodeCount=1+c;let u;if(o&&s===1){let e=n[a[0]];u=e!=null&&lI(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,eI(n,l),c.subtreeNodeCount=1+d,c.visibleSubtreeCount=f}function vz(e){return e.initialExpansion===`open`&&(e.initialExpandedPaths==null||e.initialExpandedPaths.length===0)}var yz=class e{#e;constructor(e={}){let t=gI(e),n=_I(t,`store.builder.create`,()=>new tL(e));if(e.preparedInput!=null){let t=QI(e.preparedInput);t==null?n.appendPreparedPaths(ZI(e.preparedInput),!1):n.appendPresortedPaths(t,$I(e.preparedInput))}else{let r=e.paths??[];e.presorted===!0?n.appendPaths(r):n.appendPreparedPaths(_I(t,`store.preparePathEntries`,()=>eL(r,e)))}let r=_I(t,`store.builder.finish`,()=>n.finish({skipSubtreeCountPass:!0})),i=_I(t,`store.state.detectAllDirectoriesExpanded`,()=>(e.initialExpansion??`closed`)===`closed`&&n.didMatchAllInitialExpandedPaths());this.#e=_I(t,`store.state.create`,()=>nL(r,i?`open`:e.initialExpansion??`closed`,t)),i&&(this.#e.collapseNewDirectoriesByDefault=!0);let a=i?this.#e.snapshot.directories.size-1:_I(t,`store.state.initializeExpandedPaths`,()=>this.initializeExpandedPaths(e.initialExpandedPaths));i||vz(e)||(e.initialExpansion??`closed`)===`closed`&&a===this.#e.snapshot.directories.size-1||(e.initialExpandedPaths?.length??0)>0&&_I(t,`store.state.checkAllDirectoriesExpanded`,()=>this.hasAllDirectoriesExpanded())?_I(t,`store.state.initializeOpenVisibleCounts`,()=>_z(this.#e)):_I(t,`store.state.recomputeCounts`,()=>ZL(this.#e,this.#e.snapshot.rootId))}static preparePaths(e,t={}){return JI(e,t)}static prepareInput(e,t={}){return YI(e,t)}static preparePresortedInput(e){return XI(e)}list(e){return _I(this.#e.instrumentation,`store.list`,()=>UL(this.#e,e))}add(e){_I(this.#e.instrumentation,`store.add`,()=>{let t=JR(this.#e);AL(this.#e,OL(this.#e,t,WL(this.#e,e)))})}remove(e,t={}){_I(this.#e.instrumentation,`store.remove`,()=>{let n=JR(this.#e);AL(this.#e,OL(this.#e,n,GL(this.#e,e,t)))})}move(e,t,n={}){_I(this.#e.instrumentation,`store.move`,()=>{let r=JR(this.#e),i=KL(this.#e,e,t,n);i!=null&&AL(this.#e,OL(this.#e,r,i))})}batch(e){kL(this.#e,()=>{if(typeof e==`function`){e(this);return}for(let t of e)switch(t.type){case`add`:this.add(t.path);break;case`remove`:this.remove(t.path,{recursive:t.recursive});break;case`move`:this.move(t.from,t.to,{collision:t.collision});break}})}getVisibleCount(){return _I(this.#e.instrumentation,`store.getVisibleCount`,()=>JR(this.#e))}getVisibleSlice(e,t){return _I(this.#e.instrumentation,`store.getVisibleSlice`,()=>ez(this.#e,e,t))}getVisibleRowContext(e){return _I(this.#e.instrumentation,`store.getVisibleRowContext`,()=>$R(this.#e,e))}getVisibleTreeProjection(){return nz(this.#e)}getVisibleTreeProjectionData(e){return tz(this.#e,e)}getVisibleIndex(e){return _I(this.#e.instrumentation,`store.getVisibleIndex`,()=>rz(this.#e,e))}getPathInfo(e){return _I(this.#e.instrumentation,`store.getPathInfo`,()=>{let t=$L(this.#e,e);if(t==null)return null;let n=nR(this.#e,t);return{depth:sI(n),kind:lI(n)?`directory`:`file`,path:YL(this.#e,t)}})}isExpanded(e){return _I(this.#e.instrumentation,`store.isExpanded`,()=>{let t=this.requireDirectoryNodeId(e),n=nR(this.#e,t);return oL(this.#e,t,n)})}expand(e){_I(this.#e.instrumentation,`store.expand`,()=>{let t=JR(this.#e),n=iz(this.#e,e);n!=null&&AL(this.#e,OL(this.#e,t,n))})}collapse(e){_I(this.#e.instrumentation,`store.collapse`,()=>{let t=JR(this.#e),n=az(this.#e,e);n!=null&&AL(this.#e,OL(this.#e,t,n))})}on(e,t){return gL(this.#e,e,t)}getDirectoryLoadState(e){let t=this.requireDirectoryNodeId(e);return lL(this.#e,t)}markDirectoryUnloaded(e){_I(this.#e.instrumentation,`store.markDirectoryUnloaded`,()=>{let t=this.requireDirectoryNodeId(e);if(tR(this.#e,t).childIds.length>0)throw Error(`Cannot mark a directory with known children as unloaded: "${e}"`);let n=JR(this.#e);dL(this.#e,t),AL(this.#e,OL(this.#e,n,SL({affectedAncestorIds:QL(this.#e,t),affectedNodeIds:[t],path:e,projectionChanged:this.isDirectoryProjectionVisible(t)})))})}beginChildLoad(e){return _I(this.#e.instrumentation,`store.beginChildLoad`,()=>{let t=this.requireDirectoryNodeId(e),n=JR(this.#e),r=uL(this.#e,t);return AL(this.#e,OL(this.#e,n,CL({affectedAncestorIds:QL(this.#e,t),affectedNodeIds:[t],attemptId:r.attemptId,path:e,projectionChanged:this.isDirectoryProjectionVisible(t),reused:r.reused}))),r})}applyChildPatch(e,t){return _I(this.#e.instrumentation,`store.applyChildPatch`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null||lL(this.#e,n)!==`loading`||!pL(this.#e,n,e.attemptId))return!1;let r=YL(this.#e,n);this.validateChildPatch(r,t);let i=JR(this.#e),a=[];for(let e of t.operations){bz(r,e);let t=JR(this.#e);switch(e.type){case`add`:a.push(OL(this.#e,t,WL(this.#e,e.path)));break;case`remove`:a.push(OL(this.#e,t,GL(this.#e,e.path,{recursive:e.recursive})));break;case`move`:{let n=KL(this.#e,e.from,e.to,{collision:e.collision});n!=null&&a.push(OL(this.#e,t,n));break}}}let o=a.some(e=>e.projectionChanged)||this.isDirectoryProjectionVisible(n);return AL(this.#e,OL(this.#e,i,wL({affectedAncestorIds:QL(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,childEvents:a,path:YL(this.#e,n),projectionChanged:o}))),!0})}completeChildLoad(e){return _I(this.#e.instrumentation,`store.completeChildLoad`,()=>{let t=this.resolveActiveDirectoryNodeId(e.nodeId);if(t==null)return!1;let n=JR(this.#e),r=fL(this.#e,t,e.attemptId);return AL(this.#e,OL(this.#e,n,TL({affectedAncestorIds:QL(this.#e,t),affectedNodeIds:[t],attemptId:e.attemptId,path:YL(this.#e,t),projectionChanged:this.isDirectoryProjectionVisible(t),stale:!r}))),r})}failChildLoad(e,t){return _I(this.#e.instrumentation,`store.failChildLoad`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null)return!1;let r=JR(this.#e),i=mL(this.#e,n,e.attemptId,t);return AL(this.#e,OL(this.#e,r,EL({affectedAncestorIds:QL(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,errorMessage:t,path:YL(this.#e,n),projectionChanged:this.isDirectoryProjectionVisible(n),stale:!i}))),i})}cleanup(e={}){return _I(this.#e.instrumentation,`store.cleanup`,()=>{if(this.#e.transactionStack.length>0)throw Error(`Cleanup cannot run during an open batch or transaction.`);if(WR(this.#e))throw Error(`Cleanup cannot run while directory loads are active.`);let t=JR(this.#e),n=GR(this.#e,e.mode??`stable`);return AL(this.#e,OL(this.#e,t,DL({...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=tR(this.#e,p).childIds,_=m===d?n[m]??0:0,v=_,y,b=l.get(a)??xI(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=CI(AI(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(!lI(nR(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=nR(this.#e,n);oL(this.#e,n,i)||(sL(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=nR(this.#e,e);if(!oL(this.#e,e,t))return!1}return!0}requireDirectoryNodeId(e){let t=$L(this.#e,e);if(t==null)throw Error(`Path does not exist: "${e}"`);if(!lI(nR(this.#e,t)))throw Error(`Path is not a directory: "${e}"`);return t}resolveActiveDirectoryNodeId(e){try{if(!lI(nR(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=nR(this.#e,t).parentId;if(e!==this.#e.snapshot.rootId){let n=nR(this.#e,e),r=BL(this.#e,e);if(!oL(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 bz(e,t){switch(t.type){case`add`:case`remove`:if(!t.path.startsWith(e)||t.path===e)throw Error(`Child patch operation must stay within ${e}: "${t.path}"`);break;case`move`:if(!t.from.startsWith(e)||!t.to.startsWith(e)||t.from===e||t.to===e)throw Error(`Child patch move must stay within ${e}: "${t.from}" -> "${t.to}"`);break}}var xz={compact:{itemHeight:24,factor:.8},default:{itemHeight:30,factor:1},relaxed:{itemHeight:36,factor:1.2}};function Sz(e,t){if(typeof e==`number`)return{itemHeight:t??xz.default.itemHeight,factor:e};let n=xz[e??`default`];return{itemHeight:t??n.itemHeight,factor:n.factor}}var Cz=xz.default.itemHeight,wz=`@layer base, theme, unsafe;
|
|
195
|
+
</symbol>`],aF=[oP,sP,lP,uP,dP,fP,mP,yP,bP,wP,jP,MP,NP,PP,FP,LP,BP,VP,HP,UP,WP,qP,JP,ZP,QP,$P,eF,tF,nF,rF];function oF(e,t){return t.length===0?e:e.replace(`</svg>`,`\n ${t.join(`
|
|
196
|
+
`)}\n</svg>`)}var sF=oF(aP,iF),cF={minimal:aP,standard:sF,complete:oF(sF,aF)},lF={".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`},uF={"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`},dF={jsx:`react`,sass:`sass`,scss:`sass`,tsx:`react`},fF=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`]),pF=new Set([`complete`]);function mF(e){return cF[e===`none`?`minimal`:e]}function hF(e){return`file-tree-builtin-${e}`}function gF(e){return e!==`none`&&pF.has(e)}function _F(e,t,n){if(e===`minimal`||e===`none`)return;let r=e===`complete`,i=lF[t.toLowerCase()];if(i!=null&&(r||fF.has(i)))return i;for(let e of n){if(r){let t=dF[e];if(t!=null)return t}let t=uF[e];if(t!=null&&(r||fF.has(t)))return t}return`default`}var vF=`file-tree-container`,yF=`data-file-tree-style`,bF=`data-file-tree-unsafe-css`,xF=`data-file-tree-scrollbar-measure`,SF=`data-file-tree-scrollbar-gutter-measured`,CF=`--trees-scrollbar-gutter-measured`,wF=`header`,TF=`context-menu`,EF=`context-menu-trigger`;function DF(e){return e.spriteSheet!=null||e.remap!=null||e.byFileName!=null||e.byFileExtension!=null||e.byFileNameContains!=null}function OF(e){return e==null?{set:`complete`,colored:!0}:typeof e==`string`?{set:e,colored:!0}:{...e,set:e.set??(DF(e)?`none`:`complete`),colored:e.colored??!0}}var kF=e=>e.trim().toLowerCase(),AF=e=>e.split(`/`).at(-1)??e,jF=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 MF(e,t){return typeof e==`string`?{name:e,remappedFrom:t}:{...e,remappedFrom:t}}function NF(e){let t=OF(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(kF(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 n=AF(o),s=n.toLowerCase(),c=r.get(s);if(c!=null)return MF(c,e);for(let[t,n]of a)if(s.includes(t))return MF(n,e);let l=jF(n);for(let t of l){let n=i.get(t);if(n!=null)return MF(n,e)}let u=_F(t.set,n,l);if(u!=null&&t.set!==`none`)return{name:hF(u),remappedFrom:e,token:u}}let s=n?.[e];return s==null?{name:e}:MF(s,e)}}}var PF=/^#(?:[0-9a-f]{3}0|[0-9a-f]{6}00)$/i,FF=/^0(?:\.0+)?%?$/;function IF(e){let t=e.indexOf(`(`);if(t<=0||!e.endsWith(`)`))return;let n=e.slice(0,t).trim();if(!/^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color)$/i.test(n))return;let r=e.slice(t+1,-1).trim();if(r.length===0)return;let i=r.lastIndexOf(`/`);if(i!==-1)return r.slice(i+1).trim();if(/^(?:rgba|hsla)$/i.test(n)){let e=r.split(`,`);if(e.length===4)return e[3]?.trim()}}function LF(e){if(e==null)return!1;let t=e.trim().toLowerCase();if(t===`transparent`||PF.test(t))return!0;let n=IF(t);return n!=null&&FF.test(n)}function RF(e){return LF(e)?void 0:e}function zF(e){let t=e.colors??{},n=t[`sideBar.background`]??t[`editor.background`]??e.bg,r=t[`sideBar.foreground`]??t[`editor.foreground`]??e.fg,i=t[`sideBar.border`],a=t[`list.activeSelectionForeground`]??t[`sideBar.foreground`],o=n?.toLowerCase(),s=t[`list.hoverBackground`],c=s?.toLowerCase()===o?void 0:s,l=t[`list.activeSelectionBackground`],u=l?.toLowerCase()===o?t[`list.focusBackground`]??t[`editor.selectionBackground`]:l??t[`editor.selectionBackground`],d=RF(t[`list.focusOutline`])??RF(t.focusBorder),f=t[`input.background`]??n,p=t[`input.border`],m=t[`scrollbarSlider.background`],h=t[`sideBarSectionHeader.foreground`]??r,g=t[`gitDecoration.addedResourceForeground`]??t[`terminal.ansiGreen`]??t[`editorGutter.addedBackground`],_=t[`gitDecoration.modifiedResourceForeground`]??t[`terminal.ansiBlue`]??t[`editorGutter.modifiedBackground`],v=t[`gitDecoration.deletedResourceForeground`]??t[`terminal.ansiRed`]??t[`editorGutter.deletedBackground`],y=e.type===`dark`,b={colorScheme:y?`dark`:`light`,backgroundColor:n??``,color:r??``,borderColor:`var(--trees-theme-sidebar-border, light-dark(oklch(0% 0 0 / 0.15), oklch(100% 0 0 / 0.15)))`,"--trees-theme-sidebar-bg":n??``,"--trees-theme-sidebar-fg":r??``,"--trees-theme-sidebar-header-fg":h??``,"--trees-theme-list-active-selection-fg":a??r??``,"--trees-theme-list-hover-bg":c??(y?`rgba(255,255,255,0.08)`:`rgba(0,0,0,0.06)`),"--trees-theme-list-active-selection-bg":u??`transparent`,"--trees-theme-focus-ring":d??r??``,"--trees-theme-input-bg":f??``};return i!=null&&i!==``&&(b[`--trees-theme-sidebar-border`]=i),p!=null&&p!==``&&(b[`--trees-theme-input-border`]=p),m!=null&&m!==``&&(b[`--trees-theme-scrollbar-thumb`]=m),g!=null&&g!==``&&(b[`--trees-theme-git-added-fg`]=g),_!=null&&_!==``&&(b[`--trees-theme-git-modified-fg`]=_),v!=null&&v!==``&&(b[`--trees-theme-git-deleted-fg`]=v),b}var BF=5,VF=1<<BF,HF=VF*4;function UF(){return{childIdByNameId:new Map,childIds:[],childPositionById:new Map,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function WF(){return{childIdByNameId:null,childIds:[],childPositionById:null,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function GF(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 KF(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 qF(e,t){e.childPositionById!=null&&e.childPositionById.set(t,e.childIds.length),e.childIds.push(t)}function JF(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 YF(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,$F(e,t)}function XF(e,t,n,r){if(e.totalChildSubtreeNodeCount+=n,e.totalChildVisibleSubtreeCount+=r,e.childVisibleChunkSums==null||r===0)return;let i=KF(e).get(t);if(i===void 0)return;let a=i>>BF;e.childVisibleChunkSums[a]+=r}function ZF(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=eI(e,t,a,i);return{...r,childVisibleIndex:n-r.localVisibleIndex}}i-=o,a+=VF}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 QF(e,t,n){let r=0,i=t.childVisibleChunkSums,a=0;if(i!=null){let e=n>>BF;for(let t=0;t<e;t+=1)r+=i[t]??0;a=e<<BF}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 $F(e,t){if(t.childIds.length<HF){t.childVisibleChunkSums=null;return}let n=Math.ceil(t.childIds.length/VF),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>>BF]+=a.visibleSubtreeCount)}t.childVisibleChunkSums=r}function eI(e,t,n,r){let i=Math.min(t.childIds.length,n+VF),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 tI=7,nI=3,rI=1<<nI,iI=4;function aI(e,t,n=0){return e<<iI|n<<nI|t}function oI(e){return e.depthAndFlags>>>iI}function sI(e){return(e.depthAndFlags&rI)>>nI}function cI(e){return(e.depthAndFlags&rI)!==0}function lI(e){return e.depthAndFlags&tI}function uI(e,t){return(lI(e)&t)!==0}function dI(e,t){e.depthAndFlags|=t}function fI(e,t){e.depthAndFlags=aI(t,lI(e),sI(e))}var pI=Symbol(`benchmarkInstrumentation`);function mI(e,t){return t==null||Object.defineProperty(e,pI,{configurable:!0,enumerable:!1,value:t,writable:!1}),e}function hI(e){return e==null?null:e[pI]??null}function gI(e,t,n){return e==null?n():e.measurePhase(t,n)}function _I(e,t,n){!Number.isFinite(n)||e==null||e.setCounter(t,n)}function vI(e){return e>=48&&e<=57}function yI(e){let t=[],n=0,r=0;for(;r<e.length;){for(;r<e.length&&!vI(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&&vI(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 bI(e){let t=e.toLowerCase();return{lowerValue:t,tokens:yI(t)}}function xI(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 SI(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=xI(e.tokens,t.tokens);return n===0?e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1:n}function CI(e,t,n){let r=SI(n(e),n(t));return r===0?e===t?0:e<t?-1:1:r}function wI(e,t){return CI(e,t,bI)}function TI(e,t){return t===e.segments.length-1?+!!e.isDirectory:1}function EI(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=TI(e,r);return a===TI(t,r)?wI(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 DI(e,t){return EI(e,t)}function OI(e,t,n){let r=e=>{let t=n.get(e);if(t!=null)return t;let r=bI(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=TI(e,n);return o===TI(t,n)?CI(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 kI(e,t){let n=e.sortKeyById[t];if(n!==void 0)return n;let r=e.valueById[t],i=bI(r);return e.sortKeyById[t]=i,i}function AI(e={}){return{flattenEmptyDirectories:e.flattenEmptyDirectories!==!1,sort:e.sort??`default`}}function jI(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 MI(e){let{hasTrailingSlash:t,segments:n}=jI(e);return{basename:n[n.length-1]??``,isDirectory:t,path:e,segments:n}}function NI(e){if(e.length===0)return{requiresDirectory:!1,segments:[]};let{hasTrailingSlash:t,segments:n}=jI(e);return{requiresDirectory:t,segments:n}}var PI=``;function FI(){let e=new Map;return e.set(PI,0),{idByValue:e,valueById:[PI],sortKeyById:[bI(PI)]}}function II(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 LI(e,t){let n=e.valueById[t];if(n===void 0)throw Error(`Unknown segment ID: ${String(t)}`);return n}var RI=Symbol(`pathStorePreparedInputKind`);function zI(e,t){return e[RI]=t,e}function BI(e){return{basename:e.basename,depth:e.segments.length,isDirectory:e.isDirectory,path:e.path,segments:e.segments}}function VI(e,t,n){return n===`default`?DI(e,t):n(BI(e),BI(t))}function HI(){return{depthAndFlags:aI(0,3,1),nameId:0,parentId:0,subtreeNodeCount:1,visibleSubtreeCount:1}}function UI(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 WI(e){return e.isDirectory?e.segments.length:e.segments.length-1}function GI(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 KI(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function qI(e,t={}){return $I(e,t).map(e=>e.path)}function JI(e,t={}){let n=$I(e,t);return zI({paths:n.map(e=>e.path),preparedPaths:n},`prepared`)}function YI(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 zI({paths:e,presortedPaths:e,presortedPathsContainDirectories:n},`presorted`)}function XI(e){let t=e,n=t.preparedPaths;if(t[RI]===`prepared`&&n!=null)return n;if(!GI(n))throw Error(`preparedInput must come from PathStore.prepareInput()`);return n}function ZI(e){let t=e;return t[RI]===`presorted`&&t.presortedPaths!=null||KI(t.presortedPaths)?t.presortedPaths:null}function QI(e){let t=e;return typeof t.presortedPathsContainDirectories==`boolean`?t.presortedPathsContainDirectories:null}function $I(e,t={}){let n=AI(t),r=hI(t);_I(r,`workload.inputFiles`,e.length);let i=gI(r,`store.preparePathEntries.parse`,()=>e.map(e=>MI(e)));return gI(r,`store.preparePathEntries.sort`,()=>i.sort((e,t)=>VI(e,t,n.sort))),i}var eL=class{directories=new Map;directoryStack=[0];presortedDirectoryNodeIds=[];initialExpandedPathSet;createdDirectoriesAllExpanded=!1;createdDirectoryCount=0;lastPreparedPath=null;nodes=[HI()];options;instrumentation;segmentSortKeyCache=new Map;segmentTable=FI();hasDeferredDirectoryIndexes=!1;constructor(e={}){this.instrumentation=hI(e),this.options=AI(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,UF())}appendPaths(e){return gI(this.instrumentation,`store.builder.appendPaths.parse`,()=>this.appendPreparedPaths(e.map(e=>MI(e))))}appendPreparedPaths(e,t=!0){return this.createdDirectoriesAllExpanded=!1,gI(this.instrumentation,`store.builder.appendPreparedPaths`,()=>{for(let n of e)this.appendPreparedPath(n,t)}),this}appendPresortedPaths(e,t=null){return gI(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:aI(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:aI(r,0,1),nameId:u,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),l++,c[l]=d}let e=c[l];if(e===void 0)throw Error(`Unable to resolve directory node for "${t}"`);this.promoteDirectoryToExplicit(e,t)}else{let e=c[l];if(e===void 0)throw Error(`Unable to resolve file parent for "${t}"`);let n=t.slice(m),a=o.get(n);a===void 0&&(a=s.length,o.set(n,a),s.push(n)),i.push({depthAndFlags:aI(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=MI(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:aI(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:aI(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=MI(t)),this.hasDeferredDirectoryIndexes=!0}finish(e={}){let t=e.skipSubtreeCountPass===!0;return this.hasDeferredDirectoryIndexes?(gI(this.instrumentation,`store.builder.buildDirectoryIndexes`,()=>this.buildPresortedFinish(t)),this.hasDeferredDirectoryIndexes=!1):t||gI(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`?OI(this.lastPreparedPath,e,this.segmentSortKeyCache):VI(this.lastPreparedPath,e,this.options.sort))>0)throw Error(`Builder input must be sorted before appendPaths(): "${e.path}"`)}let n=this.lastPreparedPath,r=WI(e),i=n==null?0:WI(n),a=n==null?0:UI(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=II(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:aI(oI(o)+1,0),nameId:r,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),a?.set(r,s),qF(i,s),s}createFileChildUnchecked(e,t){let n=II(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:aI(oI(i)+1,0),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),qF(r,a),a}getOrCreateDirectoryChild(e,t){let n=II(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&&!cI(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:aI(oI(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),qF(r,a),this.directories.set(a,UF()),a}createDirectoryChild(e,t){let n=II(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:aI(oI(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),qF(r,a),this.directories.set(a,UF()),a}promoteDirectoryToExplicit(e,t){let n=this.nodes[e];if(n===void 0)throw Error(`Unknown directory node ID: ${String(e)}`);if(!cI(n))throw Error(`Path is not a directory: "${t}"`);if(uI(n,1))throw Error(`Duplicate path: "${t}"`);dI(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,WF());let r=-1,i=null;for(let e=1;e<t.length;e++){let a=t[e];if(a==null)continue;if(cI(a)){let t=WF();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;cI(n)&&this.directories.set(t,UF());let r=this.directories.get(n.parentId);r!=null&&(r.childIdByNameId!=null&&r.childIdByNameId.set(n.nameId,t),qF(r,t))}}computeSubtreeCounts(e){let t=this.nodes[e];if(t===void 0)throw Error(`Unknown node ID: ${String(e)}`);if(!cI(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 YF(this.nodes,n),t.subtreeNodeCount=r,t.visibleSubtreeCount=r,r}};function tL(e,t=`closed`,n=null){let r=rL(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 nL(){return{affectedAncestorIds:new Set,affectedNodeIds:new Set,events:[]}}function rL(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 iL(e,t){return uI(t,2)||e.defaultExpansion===`open`?!0:e.defaultExpansion===`closed`?!1:oI(t)<=e.defaultExpansion}function aL(e,t,n=e.snapshot.nodes[t]){return n==null||!cI(n)?!1:e.directoriesOpenByDefault&&!e.hasCollapsedDirectoryOverrides?!0:e.collapsedDirectoryIds.has(t)?!1:e.expandedDirectoryIds.has(t)?!0:iL(e,n)}function oL(e,t,n,r=e.snapshot.nodes[t]){if(r==null||!cI(r))return;let i=iL(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 sL(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 cL(e,t){return e.directoryLoadInfoById.get(t)?.state??`loaded`}function lL(e,t){let n=sL(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 uL(e,t){let n=sL(e,t);n.activeAttemptId=null,n.errorMessage=null,n.state=`unloaded`}function dL(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 fL(e,t,n){return e.directoryLoadInfoById.get(t)?.activeAttemptId===n}function pL(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 mL(e,t){e.directoryLoadInfoById.delete(t)}function hL(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 gL(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`add`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function _L(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`remove`,path:e.path,projectionChanged:e.projectionChanged,recursive:e.recursive,visibleCountDelta:null}}function vL(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,from:e.from,operation:`move`,projectionChanged:e.projectionChanged,to:e.to,visibleCountDelta:null}}function yL(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`expand`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function bL(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`collapse`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function xL(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`mark-directory-unloaded`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function SL(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 CL(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 wL(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 TL(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 EL(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 DL(e,t,n){return{...n,visibleCountDelta:RL(e)-t}}function OL(e,t){let n=RL(e),r=nL();e.transactionStack.push(r);try{t()}catch(t){throw jL(e,r,!1),t}jL(e,r,!0,RL(e)-n)}function kL(e,t){let n=e.instrumentation;if(n==null){AL(e,t);return}gI(n,`store.events.record`,()=>AL(e,t))}function AL(e,t){let n=e.transactionStack[e.transactionStack.length-1]??null;if(n==null){IL(e,t);return}n.events.push(t),FL(n,t)}function jL(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?PL(i,t):gI(n,`store.events.batch.merge`,()=>PL(i,t));return}let a=ML(t,r),o=e.instrumentation;if(o==null){IL(e,a);return}gI(o,`store.events.batch.commit`,()=>IL(e,a))}function ML(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 NL(e,t){for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n);for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n)}function PL(e,t){for(let n of t.events)e.events.push(n);NL(e,t)}function FL(e,t){for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n);for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n)}function IL(e,t){let n=e.instrumentation;if(n==null){LL(e,t);return}gI(n,`store.events.emit`,()=>LL(e,t))}function LL(e,t){e.listeners.get(t.operation)?.forEach(e=>e(t)),e.listeners.get(`*`)?.forEach(e=>e(t))}function RL(e){return e.snapshot.nodes[e.snapshot.rootId]?.visibleSubtreeCount??0}function zL(e,t){if(e.snapshot.options.flattenEmptyDirectories!==!0)return null;let n=e.snapshot.nodes[t];if(n==null||!cI(n)||uI(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||!cI(a)?null:i}function BL(e,t){let n=t;for(;;){let t=zL(e,n);if(t==null)return n;n=t}}function VL(e,t){let n=[t],r=t;for(;;){let t=zL(e,r);if(t==null)return n;n.push(t),r=t}}function HL(e,t){let n=t==null?e.snapshot.rootId:QL(e,t);return n==null?[]:nR(e,n)}function UL(e,t){let n=MI(t),r=n.isDirectory?n.segments:n.segments.slice(0,-1),i=_R(e,gR(e,r)),{createdNodeIds:a,directoryId:o}=rR(e,r),s=new Set(a),c=o;if(n.isDirectory){let n=tR(e,o);if(uI(n,1))throw Error(`Path already exists: "${t}"`);dI(n,1),e.pathCacheByNodeId.set(o,{path:t,version:e.pathCacheVersion}),s.add(o)}else c=aR(e,o,n.basename),s.add(c);YL(e,o);let l=_R(e,o);return gL({affectedAncestorIds:ZL(e,c),affectedNodeIds:[...s],path:t,projectionChanged:vR(i,l)})}function WL(e,t,n){let r=QL(e,t);if(r==null)throw Error(`Path does not exist: "${t}"`);let i=tR(e,r);if(uI(i,2))throw Error(`The root node cannot be removed`);if(cI(i)&&eR(e,r).childIds.length>0&&n.recursive!==!0)throw Error(`Cannot remove a non-empty directory without recursive: "${t}"`);let a=i.parentId,o=_R(e,a),s=mR(e,r);cR(e,a,r,i.nameId),hR(e,a),YL(e,a);let c=_R(e,a);return _L({affectedAncestorIds:ZL(e,a),affectedNodeIds:s,path:t,projectionChanged:vR(o,c),recursive:n.recursive===!0})}function GL(e,t,n,r){let i=QL(e,t);if(i==null)throw Error(`Source path does not exist: "${t}"`);let a=tR(e,i);if(uI(a,2))throw Error(`The root node cannot be moved`);let o=r.collision??`error`,s=fR(e,i,n),c=_R(e,a.parentId),l=_R(e,s.parentId),u=LI(e.snapshot.segmentTable,a.nameId),d=II(e.snapshot.segmentTable,s.basename);if(s.parentId===a.parentId&&u===s.basename)return null;if(cI(a)&&SR(e,i,s.parentId))throw Error(`Cannot move a directory into one of its descendants`);let f=GF(e.snapshot.nodes,eR(e,s.parentId)).get(d),p=s.existingNodeId??f??null;if(p!=null&&p!==i&&pR(e,p,o,sI(a))===`skip`)return null;let m=a.parentId;cR(e,m,i,a.nameId),a.parentId=s.parentId,a.nameId=d,e.pathCacheByNodeId.delete(i),xR(e,i),sR(e,s.parentId,i),hR(e,m),e.pathCacheVersion++,YL(e,m),s.parentId!==m&&YL(e,s.parentId);let h=_R(e,m),g=_R(e,s.parentId);return vL({affectedAncestorIds:[...new Set([...ZL(e,m),...ZL(e,s.parentId)])],affectedNodeIds:[i],from:t,projectionChanged:yR([c,l],[h,g]),to:JL(e,i)})}function KL(e,t){let n=e.pathCacheByNodeId.get(t);return n!=null&&n.version===e.pathCacheVersion?n.path:null}function qL(e,t,n){return e.pathCacheByNodeId.set(t,{path:n,version:e.pathCacheVersion}),n}function JL(e,t){let n=tR(e,t),r=KL(e,t);if(r!=null)return r;if(uI(n,2))return qL(e,t,``);let i=JL(e,n.parentId),a=LI(e.snapshot.segmentTable,n.nameId),o=i.length===0?a:`${i}${a}`;return qL(e,t,cI(n)?`${o}/`:o)}function YL(e,t){let n=e.instrumentation;if(n==null){wR(e,t);return}gI(n,`store.recomputeCountsUpwardFrom`,()=>wR(e,t))}function XL(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||!cI(o)){CR(e,a,o,!0),n.pop();continue}let s=i.get(a);if(s==null||t[1]>=s.childIds.length){CR(e,a,o,!0),n.pop();continue}let c=s.childIds[t[1]++];n.push([c,0])}}function ZL(e,t){let n=[],r=t;for(;r!=null;){let t=tR(e,r);if(n.push(r),r===e.snapshot.rootId)break;r=t.parentId}return n}function QL(e,t){if(t.length===0)return e.snapshot.rootId;let n=NI(t);return $L(e,n.segments,n.requiresDirectory)}function $L(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=eR(e,r),a=GF(e.snapshot.nodes,i).get(t);if(a===void 0)return null;r=a}let i=tR(e,r);return n&&!cI(i)?null:r}function eR(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 tR(e,t){let n=e.snapshot.nodes[t];if(n===void 0||uI(n,4))throw Error(`Unknown node ID: ${String(t)}`);return n}function nR(e,t){let n=e.snapshot.nodes[t];if(n===void 0||uI(n,4))return[];if(!cI(n))return[JL(e,t)];if(eR(e,t).childIds.length===0)return uI(n,1)&&!uI(n,2)?[JL(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||uI(n,4)){i.pop();continue}if(!cI(n)){r.push(JL(e,t.nodeId)),i.pop();continue}let a=eR(e,t.nodeId);if(a.childIds.length===0){uI(n,1)&&!uI(n,2)&&r.push(JL(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 rR(e,t){let n=[],r=e.snapshot.rootId;for(let i of t){let t=II(e.snapshot.segmentTable,i),a=eR(e,r),o=GF(e.snapshot.nodes,a).get(t);if(o!==void 0){if(!cI(tR(e,o)))throw Error(`Cannot create a directory that collides with an existing file: "${i}"`);r=o;continue}r=iR(e,r,t),n.push(r)}return{createdNodeIds:n,directoryId:r}}function iR(e,t,n){let r=tR(e,t),i=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:aI(oI(r)+1,0,1),nameId:n,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),e.snapshot.directories.set(i,UF()),sR(e,t,i),e.collapseNewDirectoriesByDefault&&(e.collapsedDirectoryIds.add(i),e.hasCollapsedDirectoryOverrides=!0),e.activeNodeCount++,i}function aR(e,t,n){let r=II(e.snapshot.segmentTable,n),i=eR(e,t);if(GF(e.snapshot.nodes,i).has(r))throw Error(`Path already exists: "${ER(e,t,n)}"`);let a=tR(e,t),o=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:aI(oI(a)+1,0),nameId:r,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),sR(e,t,o),e.activeNodeCount++,o}function oR(e,t,n){let r=0,i=t.childIds.length;for(;r<i;){let a=r+i>>>1,o=t.childIds[a];if(o==null){i=a;continue}lR(e,n,o)<0?i=a:r=a+1}return r}function sR(e,t,n){let r=eR(e,t),i=tR(e,n);GF(e.snapshot.nodes,r).set(i.nameId,n),XF(r,n,i.subtreeNodeCount,i.visibleSubtreeCount);let a=oR(e,r,n);r.childIds.splice(a,0,n),JF(r,a),$F(e.snapshot.nodes,r)}function cR(e,t,n,r){let i=eR(e,t),a=KF(i),o=a.get(n)??-1;GF(e.snapshot.nodes,i).delete(r),a.delete(n);let s=e.snapshot.nodes[n];s!=null&&XF(i,n,-s.subtreeNodeCount,-s.visibleSubtreeCount),o>=0&&(i.childIds.splice(o,1),JF(i,o),$F(e.snapshot.nodes,i))}function lR(e,t,n){let r=e.snapshot.options.sort;return r===`default`?uR(e,t,n):r(dR(e,t),dR(e,n))}function uR(e,t,n){let r=tR(e,t),i=tR(e,n),a=cI(r);if(a!==cI(i))return a?-1:1;let o=SI(kI(e.snapshot.segmentTable,r.nameId),kI(e.snapshot.segmentTable,i.nameId));if(o!==0)return o;let s=LI(e.snapshot.segmentTable,r.nameId),c=LI(e.snapshot.segmentTable,i.nameId);return s===c?t<n?-1:1:s<c?-1:1}function dR(e,t){let n=tR(e,t),r=JL(e,t),i=cI(n),a=i?r.slice(0,-1):r;return{basename:LI(e.snapshot.segmentTable,n.nameId),depth:oI(n),isDirectory:i,path:r,segments:a.length===0?[]:a.split(`/`)}}function fR(e,t,n){let r=tR(e,t),i=QL(e,n);if(i!=null){let t=tR(e,i);if(cI(t))return{basename:LI(e.snapshot.segmentTable,r.nameId),existingNodeId:null,parentId:i};let a=NI(n).segments;return{basename:a[a.length-1]??``,existingNodeId:i,parentId:t.parentId}}let a=NI(n),o=a.segments[a.segments.length-1]??``,s=a.segments.slice(0,-1),c=s.length===0?e.snapshot.rootId:$L(e,s,!0);if(c==null)throw Error(`Destination parent does not exist: "${n}"`);return{basename:o,existingNodeId:null,parentId:c}}function pR(e,t,n,r){if(n===`skip`)return`skip`;if(n===`error`)throw Error(`Destination already exists: "${JL(e,t)}"`);let i=tR(e,t);if(sI(i)!==r)throw Error(`replace collision requires the same source and destination kinds`);if(cI(i)&&eR(e,t).childIds.length>0)throw Error(`replace collision does not support non-empty directories`);let a=i.parentId,o=i.nameId;return mR(e,t),cR(e,a,t,o),hR(e,a),YL(e,a),`handled`}function mR(e,t){let n=[],r=[{nodeId:t,visitedChildren:!1}];for(;r.length>0;){let t=r.pop();if(t==null)break;let i=tR(e,t.nodeId);if(t.visitedChildren||!cI(i)){cI(i)&&e.snapshot.directories.delete(t.nodeId),dI(i,4),e.pathCacheByNodeId.delete(t.nodeId),e.collapsedDirectoryIds.delete(t.nodeId)&&(e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0),e.expandedDirectoryIds.delete(t.nodeId),mL(e,t.nodeId),e.activeNodeCount--,n.push(t.nodeId);continue}r.push({nodeId:t.nodeId,visitedChildren:!0});let a=eR(e,t.nodeId);for(let e=a.childIds.length-1;e>=0;e--){let t=a.childIds[e];t!=null&&r.push({nodeId:t,visitedChildren:!1})}}return n}function hR(e,t){let n=t;for(;n!=null;){let t=tR(e,n);if(!cI(t)||uI(t,2)||eR(e,n).childIds.length>0)return;dI(t,1),n=t.parentId===n?null:t.parentId}}function gR(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=GF(e.snapshot.nodes,eR(e,n)).get(t);if(i==null||!cI(tR(e,i)))break;n=i}return n}function _R(e,t){let n=bR(e,t);if(n==null)return null;let r=BL(e,n),i=tR(e,r),a=n===r?null:VL(e,n).map(t=>JL(e,t));return JSON.stringify({flattenedSegmentPaths:a,hasChildren:eR(e,r).childIds.length>0,path:JL(e,r),terminalKind:sI(i)})}function vR(e,t){return yR([e],[t])}function yR(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 bR(e,t){let n=t;for(;n!=null;){let t=tR(e,n);if(!cI(t)||uI(t,2))return null;if(!aL(e,n,t))return n;n=t.parentId}return null}function xR(e,t){let n=tR(e,t);if(fI(n,(t===e.snapshot.rootId?-1:oI(tR(e,n.parentId)))+1),!cI(n))return;let r=eR(e,t);for(let t of r.childIds)xR(e,t)}function SR(e,t,n){let r=n;for(;r!=null;){if(r===t)return!0;let n=tR(e,r);if(r===e.snapshot.rootId)return!1;r=n.parentId}return!1}function CR(e,t,n=tR(e,t),r=!1){let i=e.instrumentation;if(i==null){TR(e,t,n,r);return}gI(i,`store.recomputeNodeCounts`,()=>TR(e,t,n,r))}function wR(e,t){let n=t;for(;n!=null;){let t=tR(e,n),r=t.subtreeNodeCount,i=t.visibleSubtreeCount;if(CR(e,n,t),n===e.snapshot.rootId)return;let a=t.subtreeNodeCount-r,o=t.visibleSubtreeCount-i,s=t.parentId;(a!==0||o!==0)&&XF(eR(e,s),n,a,o),n=s}}function TR(e,t,n,r){if(!cI(n)){n.subtreeNodeCount=1,n.visibleSubtreeCount=1;return}let i=eR(e,t);if(r){let t=e.instrumentation;t==null?YF(e.snapshot.nodes,i):gI(t,`store.recomputeNodeCounts.rebuildChildAggregates`,()=>YF(e.snapshot.nodes,i))}let a=1+i.totalChildSubtreeNodeCount,o=i.totalChildVisibleSubtreeCount;if(n.subtreeNodeCount=a,uI(n,2)){n.visibleSubtreeCount=o;return}n.visibleSubtreeCount=zL(e,t)==null?aL(e,t,n)?1+o:1:o}function ER(e,t,n){let r=JL(e,t);return r.length===0?n:`${r}${n}`}function DR(e){return e!=null&&!uI(e,4)}function OR(e,t){let n=e.snapshot.nodes[t];return!DR(n)||!cI(n)||uI(n,2)?null:n}function kR(e){let t=0;for(let[n,r]of e.pathCacheByNodeId)r.version===e.pathCacheVersion&&DR(e.snapshot.nodes[n])&&(t+=1);return t}function AR(e){return Math.max(0,e.valueById.length-1)}function jR(e){return{activeNodeCount:e.activeNodeCount,cachedPathEntryCount:kR(e),loadInfoEntryCount:e.directoryLoadInfoById.size,segmentCount:AR(e.snapshot.segmentTable),totalNodeSlotCount:Math.max(0,e.snapshot.nodes.length-1)}}function MR(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 NR(e){let t=[],n=[];for(let n of e.collapsedDirectoryIds)OR(e,n)!=null&&t.push(JL(e,n));for(let t of e.expandedDirectoryIds)OR(e,t)!=null&&n.push(JL(e,t));return{collapsedPaths:t,expandedPaths:n}}function PR(e){let t=[];for(let[n,r]of e.directoryLoadInfoById)OR(e,n)==null||cL(e,n)===`loaded`||t.push({info:{activeAttemptId:null,errorMessage:r.errorMessage,nextAttemptId:r.nextAttemptId,state:r.state},path:JL(e,n)});return t}function FR(e,t){e.collapsedDirectoryIds.clear(),e.hasCollapsedDirectoryOverrides=!1,e.expandedDirectoryIds.clear();for(let n of t.expandedPaths){let t=QL(e,n);t!=null&&oL(e,t,!0,tR(e,t))}for(let n of t.collapsedPaths){let t=QL(e,n);t!=null&&oL(e,t,!1,tR(e,t))}}function IR(e,t){e.directoryLoadInfoById.clear();for(let n of t){let t=QL(e,n.path);t!=null&&OR(e,t)!=null&&e.directoryLoadInfoById.set(t,{activeAttemptId:null,errorMessage:n.info.errorMessage,nextAttemptId:n.info.nextAttemptId,state:n.info.state})}}function LR(e){e.pathCacheVersion+=1,e.pathCacheByNodeId.clear(),e.pathCacheByNodeId.set(e.snapshot.rootId,{path:``,version:e.pathCacheVersion})}function RR(e){let t=e.snapshot.segmentTable,n=FI();for(let r of e.snapshot.nodes)if(DR(r)){if(uI(r,2)){r.nameId=0;continue}r.nameId=II(n,LI(t,r.nameId))}e.snapshot.segmentTable=n}function zR(e){for(let[t,n]of e.snapshot.directories){let r=e.snapshot.nodes[t];if(!DR(r)||!cI(r)){e.snapshot.directories.delete(t);continue}let i=n.childIds.filter(n=>{let r=e.snapshot.nodes[n];return DR(r)&&r.parentId===t});n.childIds=i,n.childIdByNameId=new Map(i.map(t=>[tR(e,t).nameId,t])),n.childPositionById=new Map(i.map((e,t)=>[e,t])),YF(e.snapshot.nodes,n)}}function BR(e){let t=e.snapshot.nodes.length-1;for(;t>e.snapshot.rootId;){let n=e.snapshot.nodes[t];if(DR(n))break;--t}e.snapshot.nodes.length=t+1}function VR(e){let t=NR(e),n=PR(e);gI(e.instrumentation,`store.cleanup.stable.clearPathCaches`,()=>LR(e)),gI(e.instrumentation,`store.cleanup.stable.rebuildSegmentTable`,()=>RR(e)),gI(e.instrumentation,`store.cleanup.stable.rebuildDirectoryIndexes`,()=>zR(e)),gI(e.instrumentation,`store.cleanup.stable.trimTrailingRemovedNodeSlots`,()=>BR(e)),gI(e.instrumentation,`store.cleanup.stable.restoreExpansionOverrides`,()=>FR(e,t)),gI(e.instrumentation,`store.cleanup.stable.restoreDirectoryLoadInfos`,()=>IR(e,n)),gI(e.instrumentation,`store.cleanup.stable.recomputeCounts`,()=>XL(e,e.snapshot.rootId))}function HR(e){let t=NR(e),n=PR(e),r=gI(e.instrumentation,`store.cleanup.aggressive.listPaths`,()=>HL(e)),i=mI({...e.snapshot.options},e.instrumentation),a=gI(e.instrumentation,`store.cleanup.aggressive.rebuildSnapshot`,()=>{let e=new eL(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,gI(e.instrumentation,`store.cleanup.aggressive.restoreExpansionOverrides`,()=>FR(e,t)),gI(e.instrumentation,`store.cleanup.aggressive.restoreDirectoryLoadInfos`,()=>IR(e,n)),gI(e.instrumentation,`store.cleanup.aggressive.recomputeCounts`,()=>XL(e,e.snapshot.rootId))}function UR(e){for(let t of e.directoryLoadInfoById.values())if(t.state===`loading`&&t.activeAttemptId!=null)return!0;return!1}function WR(e,t){let n=jR(e);t===`stable`?gI(e.instrumentation,`store.cleanup.stable`,()=>VR(e)):gI(e.instrumentation,`store.cleanup.aggressive`,()=>HR(e));let r=jR(e);return MR(t,t===`stable`,n,r)}var GR=64;function KR(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 qR(e){return tR(e,e.snapshot.rootId).visibleSubtreeCount}function JR(e,t,n,r){let i=tR(e,t.terminalNodeId),a=Math.max(1,i.visibleSubtreeCount);return Math.min(r-1,n+a-1)}function YR(e,t,n,r){return{ancestorPaths:r,index:t.index,posInSet:t.posInSet,row:mz(e,t.cursor),setSize:t.setSize,subtreeEndIndex:JR(e,t.cursor,t.index,n)}}function XR(e,t,n,r,i,a){let o=eR(e,t),{childIndex:s,childVisibleIndex:c,localVisibleIndex:l}=ZF(e.snapshot.nodes,o,n),u=o.childIds[s];if(u==null)throw Error(`Visible index ${String(n)} is out of range`);return ZR(e,u,l,r+c,i+1,s,o.childIds.length,a)}function ZR(e,t,n,r,i,a,o,s){if(!cI(tR(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=cz(e,t,i);if(n===0)return{ancestors:s,cursor:c,index:r,posInSet:a,setSize:o};let l=tR(e,c.terminalNodeId);if(!cI(l)||!aL(e,c.terminalNodeId,l))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return XR(e,c.terminalNodeId,n-1,r+1,c.visibleDepth,[...s,{cursor:c,index:r,posInSet:a,setSize:o}])}function QR(e,t){let n=qR(e);if(t<0||t>=n)return null;let r=XR(e,e.snapshot.rootId,t,0,-1,[]),i=r.ancestors.map(t=>JL(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=YR(e,a,n,[...i]);t.push(r),i.push(r.row.path)}return a=t,a},index:r.index,posInSet:r.posInSet,row:mz(e,r.cursor),setSize:r.setSize,subtreeEndIndex:JR(e,r.cursor,r.index,n)}}function $R(e,t,n){let r=e.instrumentation,i=qR(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 pz(e,o+1);let t=[],n=az(e,a);for(let r=a;r<=o&&n!=null;r++){let r=mz(e,n);t.push(r),n=uz(e,n)}return t}let s=[],c=0,l=0,u=gI(r,`store.getVisibleSlice.selectFirstRow`,()=>az(e,a));for(let t=a;t<=o&&u!=null;t++){let t=gI(r,`store.getVisibleSlice.materializeRow`,()=>mz(e,u));s.push(t),t.isFlattened&&(c++,l+=t.flattenedSegments?.length??0),u=gI(r,`store.getVisibleSlice.advanceCursor`,()=>uz(e,u))}return _I(r,`workload.visibleRowsRead`,s.length),_I(r,`workload.flattenedRowsRead`,c),_I(r,`workload.flattenedSegmentsRead`,l),s}function ez(e,t=qR(e)){let n=e.instrumentation;return n==null?fz(e,t):gI(n,`store.getVisibleTreeProjection`,()=>fz(e,t))}function tz(e){return dz(ez(e))}function nz(e,t){let n=QL(e,t);if(n==null||n===e.snapshot.rootId||cI(tR(e,n))&&BL(e,n)!==n)return null;let r=0,i=n,{nodes:a,rootId:o}=e.snapshot;for(;i!==o;){let t=tR(e,i).parentId,n=eR(e,t),s=KF(n).get(i);if(s==null)throw Error(`Child ${String(i)} was not found in its parent index`);if(r+=QF(a,n,s),t!==o){let n=tR(e,t),a=zL(e,t);if(!aL(e,t,n)&&a!==i)return null;BL(e,t)===t&&(r+=1)}i=t}return r}function rz(e,t){let n=QL(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=tR(e,n);if(!cI(r))throw Error(`Path is not a directory: "${t}"`);return aL(e,n,r)?null:(oL(e,n,!0,r),YL(e,n),yL({affectedAncestorIds:ZL(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0}))}function iz(e,t){let n=QL(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=tR(e,n);if(!cI(r))throw Error(`Path is not a directory: "${t}"`);return aL(e,n,r)?(oL(e,n,!1,r),YL(e,n),bL({affectedAncestorIds:ZL(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0})):null}function az(e,t){return t<0||t>=qR(e)?null:oz(e,e.snapshot.rootId,t,-1)}function oz(e,t,n,r){let i=eR(e,t),a=e.instrumentation,{childIndex:o,localVisibleIndex:s}=a==null?ZF(e.snapshot.nodes,i,n):gI(a,`store.getVisibleSlice.selectChildIndex`,()=>ZF(e.snapshot.nodes,i,n)),c=i.childIds[o];if(c!=null)return sz(e,c,s,r+1);throw Error(`Visible index ${String(n)} is out of range`)}function sz(e,t,n,r){if(!cI(tR(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=cz(e,t,r);if(n===0)return i;let a=tR(e,i.terminalNodeId);if(!cI(a)||!aL(e,i.terminalNodeId,a))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return oz(e,i.terminalNodeId,n-1,i.visibleDepth)}function cz(e,t,n){return cI(tR(e,t))?e.instrumentation==null?{headNodeId:t,terminalNodeId:BL(e,t),visibleDepth:n}:{headNodeId:t,terminalNodeId:gI(e.instrumentation,`store.getVisibleSlice.flatten.resolveTerminalDirectory`,()=>BL(e,t)),visibleDepth:n}:{headNodeId:t,terminalNodeId:t,visibleDepth:n}}function lz(e,t){let n=tR(e,t);if(!cI(n))return!0;let r=n.parentId;return r===e.snapshot.rootId?!0:zL(e,r)!==t}function uz(e,t){let n=tR(e,t.terminalNodeId);if(cI(n)){let r=eR(e,t.terminalNodeId);if(aL(e,t.terminalNodeId,n)&&r.childIds.length>0){let n=r.childIds[0];return n==null?null:sz(e,n,0,t.visibleDepth+1)}}let r=t.terminalNodeId,i=t.visibleDepth;for(;;){let t=tR(e,r);if(r===e.snapshot.rootId)return null;let n=t.parentId,a=eR(e,n),o=KF(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 sz(e,s,0,i);lz(e,r)&&i--,r=n}}function dz(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 fz(e,t){let n=Array(t),r=new Int32Array(t),i=new Int32Array(t),a=new Int32Array(t),o=new Int32Array(GR);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=KR(o,y);let x,S=_;if(cI(v))S=f?BL(e,_):_,x=S===_?`${b}${h[v.nameId]}/`:JL(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&&cI(C)&&aL(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 pz(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(!cI(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:JL(e,f)};continue}let h=l?BL(e,f):f,g={headNodeId:f,terminalNodeId:h,visibleDepth:m};n[r++]=mz(e,g);let _=i[h];_!=null&&cI(_)&&aL(e,h,_)&&s.push([a.get(h),0,m])}return r<t&&(n.length=r),n}function mz(e,t){let n=tR(e,t.terminalNodeId),r=cI(n)?hz(e,t):null,i=JL(e,t.terminalNodeId),a=LI(e.snapshot.segmentTable,n.nameId),o=cI(n)&&eR(e,t.terminalNodeId).childIds.length>0,s=t.headNodeId!==t.terminalNodeId,c=e.instrumentation,l=s?c==null?VL(e,t.headNodeId).map(n=>{let r=tR(e,n);return{isTerminal:n===t.terminalNodeId,name:LI(e.snapshot.segmentTable,r.nameId),nodeId:n,path:JL(e,n)}}):gI(c,`store.getVisibleSlice.flatten.collectSegments`,()=>VL(e,t.headNodeId).map(n=>{let r=tR(e,n);return{isTerminal:n===t.terminalNodeId,name:LI(e.snapshot.segmentTable,r.nameId),nodeId:n,path:JL(e,n)}})):void 0;return{depth:t.visibleDepth,flattenedSegments:l,hasChildren:o,id:t.terminalNodeId,isExpanded:cI(n)&&aL(e,t.terminalNodeId,n),isFlattened:s,isLoading:r===`loading`,kind:cI(n)?`directory`:`file`,loadState:r==null||r===`loaded`?void 0:r,name:a,path:i}}function hz(e,t){if(t.headNodeId===t.terminalNodeId)return cL(e,t.terminalNodeId);let n=VL(e,t.headNodeId),r=!1,i=!1;for(let t of n){let n=cL(e,t);if(n===`loading`)return`loading`;if(n===`error`){i=!0;continue}n===`unloaded`&&(r=!0)}return i?`error`:r?`unloaded`:`loaded`}function gz(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||!cI(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&&$F(n,i),r.subtreeNodeCount=1+c;let u;if(o&&s===1){let e=n[a[0]];u=e!=null&&cI(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,$F(n,l),c.subtreeNodeCount=1+d,c.visibleSubtreeCount=f}function _z(e){return e.initialExpansion===`open`&&(e.initialExpandedPaths==null||e.initialExpandedPaths.length===0)}var vz=class e{#e;constructor(e={}){let t=hI(e),n=gI(t,`store.builder.create`,()=>new eL(e));if(e.preparedInput!=null){let t=ZI(e.preparedInput);t==null?n.appendPreparedPaths(XI(e.preparedInput),!1):n.appendPresortedPaths(t,QI(e.preparedInput))}else{let r=e.paths??[];e.presorted===!0?n.appendPaths(r):n.appendPreparedPaths(gI(t,`store.preparePathEntries`,()=>$I(r,e)))}let r=gI(t,`store.builder.finish`,()=>n.finish({skipSubtreeCountPass:!0})),i=gI(t,`store.state.detectAllDirectoriesExpanded`,()=>(e.initialExpansion??`closed`)===`closed`&&n.didMatchAllInitialExpandedPaths());this.#e=gI(t,`store.state.create`,()=>tL(r,i?`open`:e.initialExpansion??`closed`,t)),i&&(this.#e.collapseNewDirectoriesByDefault=!0);let a=i?this.#e.snapshot.directories.size-1:gI(t,`store.state.initializeExpandedPaths`,()=>this.initializeExpandedPaths(e.initialExpandedPaths));i||_z(e)||(e.initialExpansion??`closed`)===`closed`&&a===this.#e.snapshot.directories.size-1||(e.initialExpandedPaths?.length??0)>0&&gI(t,`store.state.checkAllDirectoriesExpanded`,()=>this.hasAllDirectoriesExpanded())?gI(t,`store.state.initializeOpenVisibleCounts`,()=>gz(this.#e)):gI(t,`store.state.recomputeCounts`,()=>XL(this.#e,this.#e.snapshot.rootId))}static preparePaths(e,t={}){return qI(e,t)}static prepareInput(e,t={}){return JI(e,t)}static preparePresortedInput(e){return YI(e)}list(e){return gI(this.#e.instrumentation,`store.list`,()=>HL(this.#e,e))}add(e){gI(this.#e.instrumentation,`store.add`,()=>{let t=qR(this.#e);kL(this.#e,DL(this.#e,t,UL(this.#e,e)))})}remove(e,t={}){gI(this.#e.instrumentation,`store.remove`,()=>{let n=qR(this.#e);kL(this.#e,DL(this.#e,n,WL(this.#e,e,t)))})}move(e,t,n={}){gI(this.#e.instrumentation,`store.move`,()=>{let r=qR(this.#e),i=GL(this.#e,e,t,n);i!=null&&kL(this.#e,DL(this.#e,r,i))})}batch(e){OL(this.#e,()=>{if(typeof e==`function`){e(this);return}for(let t of e)switch(t.type){case`add`:this.add(t.path);break;case`remove`:this.remove(t.path,{recursive:t.recursive});break;case`move`:this.move(t.from,t.to,{collision:t.collision});break}})}getVisibleCount(){return gI(this.#e.instrumentation,`store.getVisibleCount`,()=>qR(this.#e))}getVisibleSlice(e,t){return gI(this.#e.instrumentation,`store.getVisibleSlice`,()=>$R(this.#e,e,t))}getVisibleRowContext(e){return gI(this.#e.instrumentation,`store.getVisibleRowContext`,()=>QR(this.#e,e))}getVisibleTreeProjection(){return tz(this.#e)}getVisibleTreeProjectionData(e){return ez(this.#e,e)}getVisibleIndex(e){return gI(this.#e.instrumentation,`store.getVisibleIndex`,()=>nz(this.#e,e))}getPathInfo(e){return gI(this.#e.instrumentation,`store.getPathInfo`,()=>{let t=QL(this.#e,e);if(t==null)return null;let n=tR(this.#e,t);return{depth:oI(n),kind:cI(n)?`directory`:`file`,path:JL(this.#e,t)}})}isExpanded(e){return gI(this.#e.instrumentation,`store.isExpanded`,()=>{let t=this.requireDirectoryNodeId(e),n=tR(this.#e,t);return aL(this.#e,t,n)})}expand(e){gI(this.#e.instrumentation,`store.expand`,()=>{let t=qR(this.#e),n=rz(this.#e,e);n!=null&&kL(this.#e,DL(this.#e,t,n))})}collapse(e){gI(this.#e.instrumentation,`store.collapse`,()=>{let t=qR(this.#e),n=iz(this.#e,e);n!=null&&kL(this.#e,DL(this.#e,t,n))})}on(e,t){return hL(this.#e,e,t)}getDirectoryLoadState(e){let t=this.requireDirectoryNodeId(e);return cL(this.#e,t)}markDirectoryUnloaded(e){gI(this.#e.instrumentation,`store.markDirectoryUnloaded`,()=>{let t=this.requireDirectoryNodeId(e);if(eR(this.#e,t).childIds.length>0)throw Error(`Cannot mark a directory with known children as unloaded: "${e}"`);let n=qR(this.#e);uL(this.#e,t),kL(this.#e,DL(this.#e,n,xL({affectedAncestorIds:ZL(this.#e,t),affectedNodeIds:[t],path:e,projectionChanged:this.isDirectoryProjectionVisible(t)})))})}beginChildLoad(e){return gI(this.#e.instrumentation,`store.beginChildLoad`,()=>{let t=this.requireDirectoryNodeId(e),n=qR(this.#e),r=lL(this.#e,t);return kL(this.#e,DL(this.#e,n,SL({affectedAncestorIds:ZL(this.#e,t),affectedNodeIds:[t],attemptId:r.attemptId,path:e,projectionChanged:this.isDirectoryProjectionVisible(t),reused:r.reused}))),r})}applyChildPatch(e,t){return gI(this.#e.instrumentation,`store.applyChildPatch`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null||cL(this.#e,n)!==`loading`||!fL(this.#e,n,e.attemptId))return!1;let r=JL(this.#e,n);this.validateChildPatch(r,t);let i=qR(this.#e),a=[];for(let e of t.operations){yz(r,e);let t=qR(this.#e);switch(e.type){case`add`:a.push(DL(this.#e,t,UL(this.#e,e.path)));break;case`remove`:a.push(DL(this.#e,t,WL(this.#e,e.path,{recursive:e.recursive})));break;case`move`:{let n=GL(this.#e,e.from,e.to,{collision:e.collision});n!=null&&a.push(DL(this.#e,t,n));break}}}let o=a.some(e=>e.projectionChanged)||this.isDirectoryProjectionVisible(n);return kL(this.#e,DL(this.#e,i,CL({affectedAncestorIds:ZL(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,childEvents:a,path:JL(this.#e,n),projectionChanged:o}))),!0})}completeChildLoad(e){return gI(this.#e.instrumentation,`store.completeChildLoad`,()=>{let t=this.resolveActiveDirectoryNodeId(e.nodeId);if(t==null)return!1;let n=qR(this.#e),r=dL(this.#e,t,e.attemptId);return kL(this.#e,DL(this.#e,n,wL({affectedAncestorIds:ZL(this.#e,t),affectedNodeIds:[t],attemptId:e.attemptId,path:JL(this.#e,t),projectionChanged:this.isDirectoryProjectionVisible(t),stale:!r}))),r})}failChildLoad(e,t){return gI(this.#e.instrumentation,`store.failChildLoad`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null)return!1;let r=qR(this.#e),i=pL(this.#e,n,e.attemptId,t);return kL(this.#e,DL(this.#e,r,TL({affectedAncestorIds:ZL(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,errorMessage:t,path:JL(this.#e,n),projectionChanged:this.isDirectoryProjectionVisible(n),stale:!i}))),i})}cleanup(e={}){return gI(this.#e.instrumentation,`store.cleanup`,()=>{if(this.#e.transactionStack.length>0)throw Error(`Cleanup cannot run during an open batch or transaction.`);if(UR(this.#e))throw Error(`Cleanup cannot run while directory loads are active.`);let t=qR(this.#e),n=WR(this.#e,e.mode??`stable`);return kL(this.#e,DL(this.#e,t,EL({...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=eR(this.#e,p).childIds,_=m===d?n[m]??0:0,v=_,y,b=l.get(a)??bI(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=SI(kI(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(!cI(tR(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=tR(this.#e,n);aL(this.#e,n,i)||(oL(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=tR(this.#e,e);if(!aL(this.#e,e,t))return!1}return!0}requireDirectoryNodeId(e){let t=QL(this.#e,e);if(t==null)throw Error(`Path does not exist: "${e}"`);if(!cI(tR(this.#e,t)))throw Error(`Path is not a directory: "${e}"`);return t}resolveActiveDirectoryNodeId(e){try{if(!cI(tR(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=tR(this.#e,t).parentId;if(e!==this.#e.snapshot.rootId){let n=tR(this.#e,e),r=zL(this.#e,e);if(!aL(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 yz(e,t){switch(t.type){case`add`:case`remove`:if(!t.path.startsWith(e)||t.path===e)throw Error(`Child patch operation must stay within ${e}: "${t.path}"`);break;case`move`:if(!t.from.startsWith(e)||!t.to.startsWith(e)||t.from===e||t.to===e)throw Error(`Child patch move must stay within ${e}: "${t.from}" -> "${t.to}"`);break}}var bz={compact:{itemHeight:24,factor:.8},default:{itemHeight:30,factor:1},relaxed:{itemHeight:36,factor:1.2}};function xz(e,t){if(typeof e==`number`)return{itemHeight:t??bz.default.itemHeight,factor:e};let n=bz[e??`default`];return{itemHeight:t??n.itemHeight,factor:n.factor}}var Sz=bz.default.itemHeight,Cz=`@layer base, theme, unsafe;
|
|
197
197
|
|
|
198
198
|
@layer base {
|
|
199
199
|
:host {
|
|
@@ -1857,20 +1857,20 @@ Error generating stack: `+e.message+`
|
|
|
1857
1857
|
}
|
|
1858
1858
|
}
|
|
1859
1859
|
}
|
|
1860
|
-
`,
|
|
1860
|
+
`,wz=`@layer base, unsafe;`;function Tz(e){return`${wz}
|
|
1861
1861
|
@layer base {
|
|
1862
1862
|
${e}
|
|
1863
|
-
}`}function
|
|
1863
|
+
}`}function Ez(e){return`${wz}
|
|
1864
1864
|
@layer unsafe {
|
|
1865
1865
|
${e}
|
|
1866
|
-
}`}var Oz=new WeakMap;function kz(e){let t=Oz.get(e);if(t!=null)return t;let n=document.createElement(`div`);n.setAttribute(SF,`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(),Oz.set(e,i),i}function Az(e,t){if(!e.isConnected)return;let n=kz(t);if(n==null)return;let r=t.querySelector(`style[${CF}]`),i=r instanceof HTMLStyleElement?r:document.createElement(`style`);r instanceof HTMLStyleElement||(i.setAttribute(CF,``),t.appendChild(i)),i.textContent=`:host { ${wF}: ${n}px; }`}var jz;function Mz(e){if(typeof CSSStyleSheet<`u`&&typeof CSSStyleSheet.prototype.replaceSync==`function`&&`adoptedStyleSheets`in e){jz??(jz=new CSSStyleSheet,jz.replaceSync(Ez(wz)));let t=!1;try{e.adoptedStyleSheets=[jz],t=!0}catch{}if(t){e.querySelector(`style[${bF}]`)?.remove();return}}if(e.querySelector(`style[data-file-tree-style]`)==null){let t=document.createElement(`style`);t.setAttribute(bF,``),t.textContent=Ez(wz),e.prepend(t)}}function Nz(e,t){Pz(e,t),Mz(t),Az(e,t)}function Pz(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`});Nz(this,e)}}if(customElements.define(yF,e),typeof document<`u`)for(let e of Array.from(document.querySelectorAll(yF)))e instanceof HTMLElement&&Nz(e,e.shadowRoot??e.attachShadow({mode:`open`}))}var Fz=e=>e.startsWith(`f::`)?e.slice(3):e;function Iz(e){let t=e.lastIndexOf(`/`);return t<0?{parentPath:``,baseName:e}:{parentPath:e.slice(0,t),baseName:e.slice(t+1)}}function Lz(e,t){return e===``?t:`${e}/${t}`}function Rz({files:e,path:t,isFolder:n,nextBasename:r}){let i=Fz(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}=Iz(i);if(a===s)return{nextFiles:e,sourcePath:i,destinationPath:i,isFolder:n};let c=Lz(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 zz(e){return e.endsWith(`/`)}function Bz(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 Vz(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 Hz(e,t){return t.includes(e)?Vz(t):[e]}function Uz(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 Wz(e,t){return{draggedPaths:e,target:t}}function Gz(e,t){if(t.kind!==`directory`||t.directoryPath==null)return!1;for(let n of e)if(zz(n)&&(t.directoryPath===n||t.directoryPath.startsWith(n)))return!0;return!1}function Kz(e,t){return t.kind===`root`||t.directoryPath==null?Bz(e):t.directoryPath}function qz(e,t){let n=e.map(e=>{let n=Kz(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 Jz(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 Yz(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(!Jz(yz.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 Xz(e){return e.operation===`add`||e.operation===`remove`||e.operation===`move`||e.operation===`batch`}function Zz(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 Qz(e,t){if(e===t)return!0;let n=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(n)}function $z(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 Qz(e,t.path)?n?e:null:e;case`move`:return Zz(e,t.from,t.to);case`batch`:{let r=e;for(let e of t.events)if(r=$z(r,e,n),r==null)return null;return r}}}function eB(e){return{canonicalChanged:e.canonicalChanged,projectionChanged:e.projectionChanged,visibleCountDelta:e.visibleCountDelta}}function tB(e){switch(e.operation){case`add`:return{...eB(e),operation:`add`,path:e.path};case`remove`:return{...eB(e),operation:`remove`,path:e.path,recursive:e.recursive};case`move`:return{...eB(e),from:e.from,operation:`move`,to:e.to}}}function nB(e){return{...eB(e),events:e.events.filter(e=>e.operation===`add`||e.operation===`remove`||e.operation===`move`).map(e=>tB(e)),operation:`batch`}}function rB(e){switch(e.operation){case`add`:case`remove`:case`move`:return tB(e);case`batch`:return nB(e);default:return null}}function iB(e,t){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}function aB(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 oB(e){return aB(e).at(-1)??null}function sB(e,t){return t==null?e:e.startsWith(t)?e.slice(t.length):e}function cB(e){return e.endsWith(`/`)}var lB=e=>e.toLowerCase();function uB(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`);return n<0?t:t.slice(n+1)}function dB(e){return e.endsWith(`/`)?e.slice(0,-1):e}function fB(e,t){return t&&!e.endsWith(`/`)?`${e}/`:e}var pB=e=>{let t=e.trim();return t.length===0?``:(t.includes(`\\`)?t.replaceAll(`\\`,`/`):t).toLowerCase()},mB=Symbol(`FILE_TREE_RENAME_VIEW`),hB=512,gB=512;function _B(e){return e===`top`||e===`center`?e:`nearest`}function vB(e,t,n){if(e===0)return-1;if(n!=null){let e=t(n);if(e!=null)return e;let r=aB(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 yB(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:vB(e.paths.length,r,t),getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex}}var bB=class{#e;#t=new Set;#n=new Map;#r=null;#i=null;#a=new Map;#o=new Map;#s=-1;#c=null;#l=!1;#u=e=>-1;#d=new Map;#f=null;#p=null;#m=null;#h=null;#g=null;#_;#v;#y;#b=[];#x=new Int32Array;#S=new Int32Array;#C=void 0;#w=!1;#T=null;#E=``;#D=!1;#O=new Set;#k=[];#A;#j=null;#M=null;#N=null;#P=null;#F=null;#I=null;#L=null;#R=0;#z=null;#B=new Set;#V=0;#H;#U=0;#W=!1;#G=0;#K;constructor(e){let{dragAndDrop:t,fileTreeSearchMode:n,initialSearchQuery:r,initialSelectedPaths:i,renaming:a,onSearchChange:o,paths:s,preparedInput:c,...l}=e,u=Yz({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=oB(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:_B(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<=gB){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=Hz(t,n);return this.#r.canDrag?.(r)===!1?!1:(n.includes(t)||this.#ae([t],t,!1),this.#Pe(t),this.#i={draggedPaths:r,primaryPath:t,target:null},this.#De(),!0)}setDragTarget(e){let t=this.#i;if(t==null)return;let n=e;if(n!=null){let e=Wz(t.draggedPaths,n);(Gz(t.draggedPaths,n)||this.#r?.canDrop?.(e)===!1)&&(n=null)}Uz(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=Wz(e.draggedPaths,t);if(Gz(e.draggedPaths,t)||this.#r?.canDrop?.(n)===!1)return this.#De(),!1;let r=qz(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=cB(r),a=dB(r);if(this.#C?.({isFolder:i,path:a})===!1)return!1;for(let e of aB(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=uB(r),this.#D=t.removeIfCanceled??!1,this.#De(),!0}[mB](){return{cancel:()=>{this.#q()},commit:()=>{this.#J()},getPath:()=>this.#T,getValue:()=>this.#E,isActive:()=>this.#T!=null,setValue:e=>{this.#Y(e)}}}#q(){if(this.#T==null)return;let e=this.#T,t=this.#D;if(this.#T=null,this.#E=``,this.#D=!1,t){this.remove(e,cB(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,cB(e)?{recursive:!0}:void 0);return}let t=cB(e),n=Rz({files:this.#H.list(),isFolder:t,nextBasename:this.#E,path:dB(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(fB(n.sourcePath,t),fB(n.destinationPath,t))}#Y(e){this.#T==null||this.#E===e||(this.#E=e,this.#De())}resetPaths(e,t={}){let n=this.#H.list().length,r=this.#G,i=Yz({paths:e,preparedInput:t.preparedInput},`resetPaths`,this.#e.sort),a=this.#le(i.paths,i.preparedInput,t.initialExpandedPaths),o=this.#c,s=this.#T,c=this.getSelectedPaths(),l=this.#z;this.#K?.(),this.#H=a,this.#d.clear(),this.#he();let u=c.map(e=>a.getPathInfo(e)?.path??null).filter(e=>e!=null),d=!iB(this.#B,u);this.#B=new Set(u),d&&(this.#V+=1),this.#z=l==null?null:a.getPathInfo(l)?.path??null,this.#T=s==null?null:a.getPathInfo(s)?.path??null,this.#T??(this.#E=``,this.#D=!1),this.#je(o,o!=null||u.length>0||this.#z!=null),this.#K=this.#Re(),this.#De(),this.#Oe({canonicalChanged:!0,operation:`reset`,pathCountAfter:i.paths.length,pathCountBefore:n,projectionChanged:!0,usedPreparedInput:t.preparedInput!=null,visibleCountDelta:this.#G-r})}#X(e){this.#Ie();let t=oB(e),n=sB(e,t),r=null,i=null;for(let e of this.#be()){if(oB(e)!==t)continue;let a=sB(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=aB(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=!iB(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 yz({...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 aB(t))e.add(n)}return this.#m=[...e].sort(),this.#m}#fe(){return this.#g??=this.#ue().map(lB),this.#g}#pe(){return this.#f??=this.#de().filter(e=>e.endsWith(`/`)),this.#f}#me(){return this.#p??=this.#pe().map(lB),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 aB(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:pB(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 aB(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 aB(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=yB(this.#H.getVisibleTreeProjectionData(t?void 0:Math.min(n,hB)),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=$z(this.#T,e);t==null&&this.#T!=null&&(this.#E=``),this.#T=t;let n=$z(this.#c,e,!0),r=[...this.#B].map(t=>$z(t,e)).filter(e=>e!=null).map(e=>this.#H.getPathInfo(e)?.path??null).filter(e=>e!=null),i=$z(this.#z,e),a=i==null?null:this.#H.getPathInfo(i)?.path??null,o=[...new Set(r)];return iB(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&&Xz(e)&&(this.#i=null);let t=Xz(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=rB(e);i!=null&&this.#Oe(i)})}#ze(e){if(this.#H.isExpanded(e)){this.#ie(e);return}this.#ke(e)}},xB=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 SB(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 CB(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 wB(e,t){return t?`${e}/`:e}function TB(e,t=null){let n=xB(e==null?void 0:[...e]);if(n===`0`)return null;if(t?.signature===n)return t;let r=new Map,i=new Set,a=new Set;for(let t of e??[]){let e=SB(t.path);if(e==null)continue;let n=wB(e.path,e.isDirectory);r.set(n,t.status),t.status===`ignored`&&e.isDirectory?a.add(n):e.isDirectory&&a.delete(n);for(let t of CB(e.path))i.add(t)}return{directoriesWithChanges:i,ignoredDirectoryPaths:a,signature:n,statusByPath:r}}var EB,DB,OB,kB,AB,jB,MB,NB,PB,FB,IB={},LB=[],RB=Array.isArray,zB=LB.slice,BB=Object.assign;function VB(e){e&&e.parentNode&&e.remove()}function HB(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?zB.call(arguments,2):n),UB(e,o,r,i,null)}function UB(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??++DB,__i:-1,__u:0};return i==null&&EB.vnode!=null&&EB.vnode(a),a}function WB(e){return e.children}function GB(e,t){this.props=e,this.context=t,this.__g=0}function KB(e,t){if(t==null)return e.__?KB(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`?KB(e):null}function qB(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 qB(e)}}function JB(e){(8&e.__g||!(e.__g|=8)||!OB.push(e)||AB++)&&kB==EB.debounceRendering||((kB=EB.debounceRendering)||queueMicrotask)(YB)}function YB(){for(var e,t,n,r,i,a,o,s,c=1;OB.length;)OB.length>c&&OB.sort(jB),e=OB.shift(),c=OB.length,8&e.__g&&(n=void 0,i=(r=(t=e).__v).__e,a=[],o=[],(s=t.__P)&&((n=BB({},r)).__v=r.__v+1,EB.vnode&&EB.vnode(n),rV(s,n,r,t.__n,s.namespaceURI,32&r.__u?[i]:null,a,i??KB(r),!!(32&r.__u),o,s.ownerDocument),n.__v=r.__v,n.__.__k[n.__i]=n,aV(a,n,o),n.__e!=i&&qB(n)));AB=0}function XB(e,t,n,r,i,a,o,s,c,l,u,d){var f,p,m,h,g,_,v,y=r&&r.__k||LB,b=t.length;for(c=ZB(n,t,y,c,b),f=0;f<b;f++)(m=n.__k[f])!=null&&(p=m.__i==-1?IB:y[m.__i]||IB,m.__i=f,_=rV(e,m,p,i,a,o,s,c,l,u,d),h=m.__e,m.ref&&p.ref!=m.ref&&(p.ref&&cV(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=QB(m,c,e,v):typeof m.type==`function`&&_!==void 0?c=_:h&&(c=h.nextSibling),m.__u&=-7);return n.__e=g,c}function ZB(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?UB(null,o,null,null,null):RB(o)?UB(WB,{children:o},null,null,null):o.constructor==null&&o.__b>0?UB(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=$B(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=KB(s)),lV(s,s));return r}function QB(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=QB(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=KB(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function $B(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&(2&l.__u)==0;if(l===null&&e.key==null||u&&s==l.key&&c==l.type)return n;if(r>+!!u){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])!=null&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function eV(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n??``}function tV(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||eV(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||eV(e.style,t,n[t])}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(MB,`$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=NB,e.addEventListener(t,a?FB:PB,a)):e.removeEventListener(t,a?FB:PB,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 nV(e){return function(t){if(this.__l){var n=this.__l[t.type+e];if(t.u==null)t.u=NB++;else if(t.u<n.l)return;return n(EB.event?EB.event(t):t)}}}function rV(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k,A,j,M=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=EB.__b)&&d(t);n:if(typeof M==`function`)try{if(v=t.props,y=`prototype`in M&&M.prototype.render,b=(d=M.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 M(v,x):(t.__c=f=new GB(v,x),f.constructor=M,f.render=uV),b&&b.sub(f),f.props=v,f.state||={},f.context=x,f.__n=r,p=!0,f.__g|=8,f.__h=[],f._sb=[]),y&&f.__s==null&&(f.__s=f.state),y&&M.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=BB({},f.__s)),BB(f.__s,M.getDerivedStateFromProps(v,f.__s))),m=f.props,h=f.state,f.__v=t,p)y&&M.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),y&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(y&&M.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=EB.__r,w=0,y){for(f.state=f.__s,f.__g&=-9,C&&C(t),d=f.render(f.props,f.state,f.context),T=0;T<f._sb.length;T++)f.__h.push(f._sb[T]);f._sb=[]}else do f.__g&=-9,C&&C(t),d=f.render(f.props,f.state,f.context),f.state=f.__s;while(8&f.__g&&++w<25);f.state=f.__s,f.getChildContext!=null&&(r=BB({},r,f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),E=d,d!=null&&d.type===WB&&d.key==null&&(E=oV(d.props.children)),s=XB(e,RB(E)?E:[E],t,n,r,i,a,o,s,c,l,u),t.__u&=-161,f.__h.length&&o.push(f),_&&(f.__g&=-4)}catch(e){if(t.__v=null,c||a!=null)if(e.then){for(D=0,O=!1,t.__u|=c?160:128,t.__c.__z=[],k=0;k<a.length;k++)(A=a[k])==null||O||(A.nodeType==8&&A.data==`$s`?(D>0&&t.__c.__z.push(A),D++,a[k]=null):A.nodeType==8&&A.data==`/$s`?(--D>0&&t.__c.__z.push(A),O=D===0,s=a[k],a[k]=null):D>0&&(t.__c.__z.push(A),a[k]=null));if(!O){for(;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;a[a.indexOf(s)]=null,t.__c.__z=[s]}t.__e=s}else{for(j=a.length;j--;)VB(a[j]);iV(t)}else t.__e=n.__e,t.__k=n.__k,e.then||iV(t);EB.__e(e,t,n)}else s=t.__e=sV(n.__e,t,n,r,i,a,o,c,l,u);return(d=EB.diffed)&&d(t),128&t.__u?void 0:s}function iV(e){e&&e.__c&&(e.__c.__g|=4),e&&e.__k&&e.__k.forEach(iV)}function aV(e,t,n){for(var r=0;r<n.length;r++)cV(n[r],n[++r],n[++r]);EB.__c&&EB.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){EB.__e(e,t.__v)}})}function oV(e){return typeof e!=`object`||!e||e.__b&&e.__b>0?e:RB(e)?e.map(oV):BB({},e)}function sV(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&&=(EB.__m&&EB.__m(t,a),!1),a=null}if(b==null)v===y||s&&e.data==y||(e.data=y);else{if(a&&=zB.call(e.childNodes),v=n.props||IB,!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;tV(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&&!_||tV(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=``),XB(b==`template`?e.content:e,RB(p)?p:[p],t,n,r,b==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&KB(n,0),s,c,l),a!=null)for(u=a.length;u--;)VB(a[u]);s||(u=`value`,b==`progress`&&h==null?e.removeAttribute(`value`):h==null||h===e[u]&&(b!==`progress`||h)||tV(e,u,h,v[u],i),u=`checked`,g!=null&&g!=e[u]&&tV(e,u,g,v[u],i))}return e}function cV(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){EB.__e(e,n)}}function lV(e,t,n){var r,i;if(EB.unmount&&EB.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||cV(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){EB.__e(e,t)}r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&lV(r[i],t,n||typeof e.type!=`function`);n||VB(e.__e),e.__e&&e.__e.__l&&(e.__e.__l=null),e.__e=e.__c=e.__=null}function uV(e,t,n){return this.constructor(e,n)}function dV(e,t){var n,r,i,a;t==document&&(t=document.documentElement),EB.__&&EB.__(e,t),r=(n=!!(e&&32&e.__u))?null:t.__k,e=t.__k=HB(WB,null,[e]),i=[],a=[],rV(t,e,r||IB,IB,t.namespaceURI,r?null:t.firstChild?zB.call(t.childNodes):null,i,r?r.__e:t.firstChild,n,a,t.ownerDocument),aV(i,e,a)}function fV(e,t){e.__u|=32,dV(e,t)}EB={__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 AB=0,e}},DB=0,GB.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=BB({},this.state);typeof e==`function`&&(e=e(BB({},n),this.props)),e&&BB(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),JB(this))},GB.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),JB(this))},GB.prototype.render=WB,OB=[],AB=0,jB=function(e,t){return e.__v.__b-t.__v.__b},MB=/(PointerCapture)$|Capture$/i,NB=0,PB=nV(!1),FB=nV(!0);var pV=0;Array.isArray;function mV(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:--pV,__i:-1,__u:0,__source:i,__self:a};return EB.vnode&&EB.vnode(l),l}var hV=16,gV=16,_V={};function vV({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}=_V[e]??{width:hV,height:gV},f=r??l,p=i??u,m=a??d??`0 0 ${l} ${u}`;return mV(`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:mV(`use`,{href:c})})}var yV=e=>{if(e.length<2)return[e,``];let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]},bV=e=>{if(e.length<4)return[e,``];let t=e.lastIndexOf(`.`)+1,n=e.length-t>10,r=t>=1&&!n?t:Math.ceil(e.length/2);return[e.slice(0,r),e.slice(r)]},xV=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)]},SV=(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)]},CV=(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)]},wV=(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 TV({children:e,marker:t,variant:n=`default`}){"use no memo";return mV(`div`,{"aria-hidden":!0,"data-truncate-marker-cell":!0,children:mV(`div`,{"data-truncate-marker":!0,children:typeof t==`function`?t({children:e}):n===`fade`?mV(`span`,{"data-truncate-fade":!0}):t})})}function EV(e){"use no memo";let{mode:t,children:n}=e;return mV(`div`,{children:[mV(`div`,{"data-truncate-content":`visible`,children:t===`fruncate`?mV(`span`,{children:n}):n}),mV(`div`,{"data-truncate-content":`overflow`,"aria-hidden":!0,children:t===`fruncate`?mV(`span`,{children:n}):n})]})}function DV({children:e,mode:t=`truncate`,marker:n=`…`,variant:r=`default`,...i}){"use no memo";let a=mV(EV,{mode:t,children:e},`content`),o=mV(TV,{marker:n,mode:t,variant:r},`marker`),s=mV(`div`,{"data-truncate-fill":!0},`fill`);return mV(`div`,{"data-truncate-container":t,"data-truncate-variant":r,...i,children:mV(`div`,{"data-truncate-grid":!0,children:t===`truncate`?[a,o]:[o,a,s]})})}function OV({children:e,...t}){"use no memo";return mV(DV,{mode:`truncate`,...t,children:e})}function kV({children:e,...t}){"use no memo";return mV(DV,{mode:`fruncate`,...t,children:e})}function AV({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=mV(OV,{...s,children:t[0]}),l=mV(kV,{...s,children:t[1]})}else{if(typeof e!=`string`)return console.error(`MiddleTruncate: children must be a string`),null;if(e.length===0)return mV(`div`,{className:a,style:o});if(e.length<i)return mV(n===`end`?kV:OV,{...s,className:a,style:o,children:e});let t=null,u=null,d=null;if(typeof r==`string`)r===`center`?t=yV:r===`extension`?t=bV:r===`leaf-path`&&(t=xV);else if(typeof r==`number`)t=SV,u=r;else if(Array.isArray(r)){let[e,n]=r;d=n,e===`last`?t=CV:e===`first`&&(t=wV)}else typeof r==`function`&&(t=r);t??=yV;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=mV(OV,{...s,..._,children:f}),l=mV(kV,{...s,...v,children:p})}return mV(`div`,{"data-truncate-group-container":`middle`,className:a,style:o,children:[mV(`div`,{"data-truncate-segment-priority":n===`start`||n===`equal`?`1`:`2`,children:c}),mV(`div`,{"data-truncate-segment-priority":n===`end`||n===`equal`?`1`:`2`,children:l})]})}var jV={endIndex:-1,startIndex:-1};function MV(e,t,n){return Math.min(Math.max(e,t),n)}function NV(e,t){return e<0||t<e?jV:{endIndex:t,startIndex:e}}function PV(e){return e.startIndex<0||e.endIndex<e.startIndex}function FV(e,t){return PV(e)?0:(e.endIndex-e.startIndex+1)*t}function IV(e,t,n){if(t<=0)return-1;let r=t*n;return e<=0?0:e>=r?t:Math.floor(e/n)}function LV(e,t,n){return t<=0||e<=0?-1:e>=t*n?t-1:Math.ceil(e/n)-1}function RV(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 zV(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 BV(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 VV(e,t,n){if(e.length===0||t<=0)return[];let r=BV(e),i=RV(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=zV(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 HV(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=MV(t.scrollTop,0,o),c=t.stickyRows??VV(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=IV(s,n,t.itemHeight),m=IV(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?jV:NV(m,LV(u+d,n,t.itemHeight)),y=g+1,b=PV(v)?jV:NV(Math.max(y,v.startIndex-a),Math.min(n-1,v.endIndex+a)),x=FV(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:PV(b)?0:b.startIndex*t.itemHeight,startIndex:b.startIndex}}}var UV={added:`A`,deleted:`D`,ignored:null,modified:`M`,renamed:`R`,untracked:`U`},WV={added:`Git status: added`,deleted:`Git status: deleted`,ignored:`Git status: ignored`,modified:`Git status: modified`,renamed:`Git status: renamed`,untracked:`Git status: untracked`},GV=`Contains git status items`;function KV(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 qV(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,offset:i,topInset:a=0,totalHeight:o,viewportHeight:s}=e;if(i===`nearest`)return KV({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 JV(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 YV(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 XV(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 ZV(e,t){if(e==null)return t;let n=e.getBoundingClientRect().height;return n>0?n:e.clientHeight>0?e.clientHeight:t}function QV(e,t){return e!=null&&e>0?e:t}function $V(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 eH(e,t,n,r,i=0){let a=KV({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,topInset:i,viewportHeight:r});return a==null?!1:(e.scrollTop=a,!0)}function tH(e,t,n,r,i,a,o=0){let s=qV({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,offset:a,topInset:o,totalHeight:i,viewportHeight:r});return s==null?!1:(e.scrollTop=s,!0)}function nH(e,t,n,r,i,a){let o=JV({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,targetViewportOffset:a,totalHeight:i,viewportHeight:r});return o==null?!1:(e.scrollTop=o,!0)}function rH(e,t,n,r){return n.end<n.start?null:e<n.start?-t:e>n.end?r:null}function iH(e){let{renamingPath:t,previousRenamingPath:n,hasRenderedInput:r}=e;return t==null?`reset`:r?n===t?`ignore`:`focus-input`:`reveal-canonical`}function aH({ariaLabel:e,isFlattened:t=!1,ref:n,value:r,onBlur:i,onInput:a}){return mV(`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 oH(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 sH(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 cH,lH,uH,dH,fH=Object.is,pH=0,mH=[],hH=EB,gH=hH.__b,_H=hH.__r,vH=hH.diffed,yH=hH.__c,bH=hH.unmount,xH=hH.__;function SH(e,t){hH.__h&&hH.__h(lH,e,pH||t),pH=0;var n=lH.__H||={__:[],__h:[]};return e>=n.__.length&&n.__.push({}),n.__[e]}function CH(e){return pH=1,wH(IH,e)}function wH(e,t,n){var r=SH(cH++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):IH(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);fH(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=lH,!lH.__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,fH(t,e.__[0])||(o=!0)}}),a&&a.call(this,e,t,n)||o};lH.__f=!0;var a=lH.shouldComponentUpdate,o=lH.componentWillUpdate;lH.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)},lH.shouldComponentUpdate=i}return r.__N||r.__}function TH(e,t){var n=SH(cH++,3);!hH.__s&&FH(n.__H,t)&&(n.__=e,n.u=t,lH.__H.__h.push(n))}function EH(e,t){var n=SH(cH++,4);!hH.__s&&FH(n.__H,t)&&(n.__=e,n.u=t,lH.__h.push(n))}function DH(e){return pH=5,OH(function(){return{current:e}},[])}function OH(e,t){var n=SH(cH++,7);return FH(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function kH(e,t){return pH=8,OH(function(){return e},t)}function AH(){for(var e;e=mH.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(NH),e.__H.__h.forEach(PH),e.__H.__h=[]}catch(t){e.__H.__h=[],hH.__e(t,e.__v)}}hH.__b=function(e){lH=null,gH&&gH(e)},hH.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),xH&&xH(e,t)},hH.__r=function(e){_H&&_H(e),cH=0;var t=(lH=e.__c).__H;t&&(uH===lH?(t.__h=[],lH.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(NH),t.__h.forEach(PH),t.__h=[],cH=0)),uH=lH},hH.diffed=function(e){vH&&vH(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(mH.push(t)!==1&&dH===hH.requestAnimationFrame||((dH=hH.requestAnimationFrame)||MH)(AH)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),uH=lH=null},hH.__c=function(e,t){t.some(function(e){try{e.__h.forEach(NH),e.__h=e.__h.filter(function(e){return!e.__||PH(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],hH.__e(n,e.__v)}}),yH&&yH(e,t)},hH.unmount=function(e){bH&&bH(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{NH(e)}catch(e){t=e}}),n.__H=void 0,t&&hH.__e(t,n.__v))};var jH=typeof requestAnimationFrame==`function`;function MH(e){var t,n=function(){clearTimeout(r),jH&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);jH&&(t=requestAnimationFrame(n))}function NH(e){var t=lH,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),lH=t}function PH(e){var t=lH;e.__c=e.__(),lH=t}function FH(e,t){return!e||e.length!==t.length||t.some(function(t,n){return!fH(t,e[n])})}function IH(e,t){return typeof t==`function`?t(e):t}function LH(e,t=null,n=null){"use no memo";let r=e.flattenedSegments;return r==null||r.length===0?t??e.name:mV(`span`,{"data-item-flattened-subitems":!0,children:r.map((e,i)=>{let a=i===r.length-1;return mV(WB,{children:[mV(`span`,{"data-item-flattened-subitem":e.path,"data-item-flattened-subitem-drag-target":n===e.path?`true`:void 0,children:a&&t!=null?t:mV(OV,{children:e.name})}),i<r.length-1?` / `:``]},e.path)})})}function RH(e){return e.isFlattened?e.flattenedSegments?.findLast(e=>e.isTerminal)?.path??e.path:e.path}function zH(e){let t=e.flattenedSegments;return t==null||t.length===0?e.name:t.map(e=>e.name).join(` / `)}function BH(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 VH({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=HV(c,{itemHeight:t,overscan:n,scrollTop:r,stickyRows:s==null?void 0:BH(s,r,t,o),totalRowCount:o,viewportHeight:a}),u=i&&r<=0&&o>0?e.getStickyRowCandidates(1,t):[],d=u!=null&&r<=0?BH(u,1,t,o):i&&r<=0&&c.length>0?VV(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 HH=400,UH=10,WH=40,GH=18;function KH(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))?qH(e,t,n):a instanceof HTMLElement?a:null}function qH(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 JH(e){let t=e?.closest?.(`[data-type="item"]`);if(!(t instanceof HTMLElement))return e?.closest?.(`[data-file-tree-virtualized-scroll]`)instanceof HTMLElement?{directoryPath:null,flattenedSegmentPath:null,hoveredPath:null,kind:`root`}: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 YH(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 XH(){return navigator.vendor!==`Apple Computer, Inc.`}function ZH(e,t){let n=e-t.top;if(n<WH)return-Math.ceil((WH-Math.max(0,n))/WH*GH);let r=t.bottom-e;return r<WH?Math.ceil((WH-Math.max(0,r))/WH*GH):0}function QH(e,t){if(e!=null){let t=UV[e];return t==null?null:{text:t,title:WV[e]}}return t?{icon:{name:`file-tree-icon-dot`,width:6,height:6},title:GV}:null}function $H(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 eU(e){return e!=null&&`toggle`in e}function tU(e){return e.code===`Space`||e.key===` `||e.key===`Spacebar`}function nU(e){return e.key.length===1&&/^[\p{L}\p{N}]$/u.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey}function rU(e){return e==null?``:`[data-item-section="spacing-item"][data-ancestor-path="${e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}"] { opacity: 1; }`}function iU(e){return e.shiftKey&&e.key===`F10`||e.key===`ContextMenu`}function aU(e,t){return t&&iU(e)||(e.ctrlKey||e.metaKey)&&tU(e)?!0:e.key===`ArrowDown`||e.key===`ArrowLeft`||e.key===`ArrowRight`||e.key===`ArrowUp`}var oU=new Set([`ArrowDown`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`]);function sU(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 cU(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 lU(e,t){return{bottom:t,height:0,left:e,right:e,top:t,width:0,x:e,y:t}}function uU(e,t){if(e==null)return t.offsetTop;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.top-r.top}function dU(e,t,n){if(n==null){e.delete(t);return}e.set(t,n)}function fU(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 pU(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 mU(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 hU(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=mU(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 gU(e,t){return{kind:e.kind,name:zH(e),path:t}}function _U(e){return e==null?void 0:`${e}__tree`}function vU(e,t,n){if(e!=null)return`${e}__focused-item-${encodeURIComponent(t)}${n?`__parked`:``}`}function yU(e){return e===`file-tree-icon-chevron`||e===`file-tree-icon-dot`||e===`file-tree-icon-file`||e===`file-tree-icon-lock`}function bU(e,t){if(e==null)return null;if(`text`in e)return mV(`span`,{title:e.title,children:e.text});let n=typeof e.icon==`string`?yU(e.icon)?t(e.icon):{name:e.icon}:yU(e.icon.name)?(()=>{let n=t(e.icon.name),{name:r,...i}=e.icon;return{...n,...i}})():e.icon;return mV(`span`,{title:e.title,children:mV(vV,{...n})})}function xU(e){e!=null&&YV(e.querySelector([`button:not([disabled])`,`[href]`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`, `))??e)}function SU(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=RH(e);return mV(WB,{children:[e.depth>0?mV(`div`,{"data-item-section":`spacing`,children:Array.from({length:e.depth}).map((t,n)=>mV(`div`,{"data-item-section":`spacing-item`,"data-ancestor-path":e.ancestorPaths[n]},n))}):null,mV(`div`,{"data-item-section":`icon`,children:e.kind===`directory`?mV(vV,{...t(`file-tree-icon-chevron`)}):mV(vV,{...t(`file-tree-icon-file`,u)})}),mV(`div`,{"data-item-section":`content`,children:e.isFlattened?LH(e,c,a):c??mV(AV,{minimumLength:5,split:`extension`,children:e.name})}),i?mV(`div`,{"data-item-section":`decoration`,children:r==null?null:bU(r,t)}):null,s?mV(`div`,{"data-item-section":`git`,children:bU(o,t)}):null,n?mV(`div`,{"data-item-section":`action`,children:l?mV(`span`,{"aria-hidden":`true`,"data-item-action-affordance":`decorative`,children:mV(vV,{...t(`file-tree-icon-ellipsis`)})}):null}):null]})}function CU(e,t,n,r={}){let{controller:i,renameView:a,visualFocusPath:o,contextHoverPath:s,draggedPathSet:c,dragTarget:l,dragAndDropEnabled:u,shouldSuppressContextMenu:d,handleRowDragStart:f,handleRowDragEnd:p,handleRowTouchStart:m,instanceId:h,itemHeight:g,gitStatusByPath:_,ignoredGitDirectories:v,ignoredInheritanceCache:y,directoriesWithGitChanges:b,gitLaneActive:x,contextMenuEnabled:S,contextMenuTriggerMode:C,contextMenuButtonTriggerEnabled:w,contextMenuButtonVisibility:T,contextMenuRightClickEnabled:E,registerRenameInput:D,registerButton:O,resolveIcon:k,renderDecorationForRow:A,openContextMenuForRow:j,onRowClick:M,onKeyDown:N}=e,P=RH(t),{isParked:F=!1,mode:I=`flow`,style:L}=r,R=I===`sticky`,z=_?.get(P)??null??$H(t.ancestorPaths,v,y),B=t.kind===`directory`&&(b?.has(P)??!1),V=A(t,P),H=QH(z,B),U=S&&w,W=V!=null||x||U,G=U&&T===`always`,K=a.getPath()===P,q=K?a.getValue():``,J=R||!K?null:mV(aH,{ref:D,ariaLabel:`Rename ${zH(t)}`,isFlattened:t.isFlattened,value:q,onBlur:()=>{a.commit()},onInput:e=>{a.setValue(e.currentTarget.value)}}),ee=SU(t,k,{actionLaneEnabled:U,customDecoration:V,decorationLaneEnabled:W,dragTargetFlattenedSegmentPath:l?.flattenedSegmentPath??null,gitDecoration:H,gitLaneActive:x,renameInput:J,showDecorativeActionAffordance:G}),te={...oH({ariaLabel:zH(t),domId:t.isFocused?vU(h,P,F):void 0,extraStyle:L,features:{actionLaneEnabled:U,contextMenuButtonVisibility:U?T:null,contextMenuEnabled:S,contextMenuTriggerMode:S?C:null,gitLaneActive:x},isParked:F,itemHeight:g,mode:I,row:t,state:{containsGitChange:B,effectiveGitStatus:z,isContextHovered:s===P,isDragTarget:l?.kind===`directory`&&l.directoryPath===P,isDragging:c?.has(P)===!0,isFocusRinged:t.isFocused&&o===P},targetPath:P}),key:n,onContextMenu:S||u?e=>{if(d()){e.preventDefault();return}S&&(e.preventDefault(),E&&(i.focusMountedPathFromInput(P),j(t,P,{anchorRect:lU(e.clientX,e.clientY),source:`right-click`})))}:void 0,onFocus:R?void 0:()=>{i.focusMountedPathFromInput(P)},onKeyDown:R?void 0:N,ref:e=>{O(P,e)}};return!R&&K?mV(`div`,{...te,children:ee}):mV(`button`,{...te,type:`button`,draggable:u&&!F,onDragEnd:u&&!F?p:void 0,onDragStart:u&&!F?e=>{f(e,t,P)}:void 0,onMouseDown:e=>{if(R){e.preventDefault();return}i.isSearchOpen()&&e.preventDefault()},onTouchStart:u&&!F?e=>{m(e,t,P)}:void 0,onClick:e=>{M(e,t,P,I)},children:ee})}function wU(e,t,n){return t.end<t.start?[]:e.controller.getVisibleRows(t.start,t.end).filter(e=>!n.has(RH(e))).map((n,r)=>CU(e,n,t.start+r))}function TU({composition:e,controller:t,gitStatusByPath:n,ignoredGitDirectories:r,directoriesWithGitChanges:i,icons:a,instanceId:o,itemHeight:s=Cz,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 _=DH(null),v=DH(null),y=DH(!1),b=DH(null),x=DH(null),S=DH(null),C=DH(null),w=DH(null),T=DH(new Map),E=DH(new Map),D=DH(()=>{}),O=DH(null),k=DH(0),A=DH(!1),j=DH(null);j.current!==t&&(A.current=!1,j.current=t);let M=DH(!1),N=DH(null),P=DH(null),F=DH(!1),I=DH(null),L=DH(null),R=DH(null),z=DH(null),B=DH(null),V=DH(null),H=DH(null),U=DH(null),W=DH(!1),G=DH(null),K=DH(null),q=DH(null),J=DH(null),ee=OH(()=>new Map,[]),[,te]=CH(0),[ne,re]=CH(null),[Y,ie]=CH(null),[ae,oe]=CH(null),[se,ce]=CH(null),[le,ue]=CH(0),[de,fe]=CH(null),pe=DH(de);pe.current=de;let me=DH(null),he=DH(null),ge=DH(null),_e=DH(null),ve=DH(null),ye=DH(!1),be=()=>{he.current=null,ge.current=null,_e.current=null},xe=(e,t)=>{he.current=e,ge.current=null,_e.current=t==null?null:{path:e,scrollTop:t}},Se=(e,t)=>{he.current=null,ge.current={path:e,viewportOffset:t},_e.current=null},Ce=DH(d===`retain`&&t.isSearchOpen()),[we,Te]=CH(p);TH(()=>{p||Te(!1)},[p]);let Ee=DH(!1),De=kH(()=>{Ee.current=!0,Te(e=>e&&!1)},[]),[Oe,ke]=CH(()=>VH({controller:t,itemHeight:s,overscan:c,scrollTop:0,stickyFolders:h,viewportHeight:g})),[Ae,je]=CH(!1);TH(()=>{je(!0)},[]);let Me=e?.contextMenu?.enabled===!0||e?.contextMenu?.render!=null||e?.contextMenu?.onOpen!=null||e?.contextMenu?.onClose!=null,Ne=e?.contextMenu?.triggerMode??(Me?`right-click`:`both`),Pe=Ne===`both`||Ne===`button`,Fe=e?.contextMenu?.buttonVisibility??`when-needed`,Ie=Ne===`both`||Ne===`right-click`;EH(()=>{let e=S.current;if(e==null)return;let t=e=>{if(!(e instanceof CustomEvent))return;let t=e.detail?.path??null;ve.current=t,ie(t),ce(t==null?null:`pointer`)},n=e=>{e instanceof CustomEvent&&(ye.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 Le=kH((e,t)=>{dU(T.current,e,t)},[]),Re=kH((e,t)=>{dU(E.current,e,t)},[]),ze=kH(e=>{x.current=e},[]),Be=kH(e=>fU(e,E.current,T.current),[]),Ve=n!=null||r!=null||i!=null,{resolveIcon:He}=OH(()=>PF(a),[a]),Ue=t[mB](),We=Ue.getPath(),Ge=We!=null,Ke=t.isSearchOpen(),qe=t.getSearchValue(),Je=t.getFocusedPath(),Ye=t.getFocusedIndex(),Xe=t.getScrollRequest(),Ze=t.isDragAndDropEnabled(),Qe=t.getDragSession(),$e=OH(()=>Qe==null?null:new Set(Qe.draggedPaths),[Qe]),et=Qe?.target??null,tt=Qe?.primaryPath??null,nt=_U(o),{overlayHeight:rt,overlayRows:it,snapshot:at,visibleRows:ot}=Oe,st=at.physical.viewportHeight,ct=OH(()=>({end:at.window.endIndex,start:at.window.startIndex}),[at.window.endIndex,at.window.startIndex]),lt=it,ut=at.sticky.rows,dt=at.physical.totalHeight,ft=at.sticky.height,pt=OH(()=>new Set(ut.map(e=>RH(e.row))),[ut]),mt=Ye>=0&&Ye>=ct.start&&Ye<=ct.end,ht=kH((e,t)=>u?.({item:gU(e,t),row:e})??null,[u]),gt=kH(e=>YV(e==null?null:T.current.get(e)??null)?!0:YV(S.current),[]),_t=kH(e=>{gt(t.focusNearestPath(e))},[t,gt]),vt=DH(_t);vt.current=_t;let yt=DH(!0),bt=DH(()=>{}),xt=kH((t=!0)=>{let n=pe.current;n!=null&&(yt.current=yt.current&&t,fe(null),e?.contextMenu?.onClose?.(),yt.current&&_t(n.path))},[e?.contextMenu,_t]);bt.current=xt;let St=kH(e=>{let t=e==null?null:uU(S.current,e);oe(e=>e===t?e:t)},[]),Ct=kH((e,n,r)=>{let i=t.getItem(n);if(i==null)return;let a=Be(n);if(a?.dataset.fileTreeStickyRow===`true`){let e=C.current;xe(n,e?.scrollTop??null),M.current=!0,re(e=>e===n?e:n)}i.focus(),St(a),yt.current=!0,fe({anchorRect:r?.anchorRect??null,item:gU(e,n),path:n,source:r?.source??`keyboard`})},[t,Be,St]),wt=kH(e=>{if(l){if(t.isSearchOpen()){let e=C.current,t=ZV(e,st);I.current=Ye<0||e==null?null:Math.max(0,Math.min(Ye*s-e.scrollTop,Math.max(0,t-s))),F.current=!0}t.startRenaming(e)!==!1&&(ce(`focus`),te(e=>e+1))}},[t,Ye,s,l,st]),Tt=kH((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=ZV(i,st),u=t.getVisibleCount()*s,d=r===`sticky-parents`?o.ancestorPaths.length*s:VH({controller:t,itemHeight:s,overscan:c,scrollTop:i.scrollTop,stickyFolders:h,viewportHeight:l}).snapshot.sticky.height;return M.current=!0,nH(i,a,s,l,u,d),D.current(),me.current=n?e:null,!0},[t,s,c,st,h]),Et=()=>y.current===!0||J.current!=null||W.current===!0,Dt=e=>typeof window.requestAnimationFrame==`function`?window.requestAnimationFrame(()=>{e()}):window.setTimeout(e,16),Ot=e=>{if(e!=null){if(typeof window.cancelAnimationFrame==`function`){window.cancelAnimationFrame(e);return}window.clearTimeout(e)}},kt=()=>{z.current!=null&&(clearTimeout(z.current),z.current=null),R.current=null},At=()=>{V.current?.remove(),V.current=null},jt=()=>{Ot(L.current),L.current=null,B.current=null},Mt=e=>{let t=S.current?.getRootNode();if(t instanceof ShadowRoot){t.append(e);return}document.body.append(e)},Nt=()=>{U.current?.(),U.current=null,J.current!=null&&(clearTimeout(J.current),J.current=null),W.current=!1,G.current=null,q.current=null,K.current!=null&&(K.current.setAttribute(`draggable`,`true`),K.current.style.removeProperty(`touch-action`),K.current=null),At(),kt(),jt(),H.current=null},Pt=(e,n)=>{let r=S.current?.getRootNode(),i=JH(KH(r instanceof ShadowRoot?r:document,e,n));return t.setDragTarget(i),t.getDragSession()?.target??null},Ft=e=>{let n=t.getDragAndDropConfig()?.openOnDropDelay??800;if(e==null||e.kind!==`directory`||e.directoryPath==null||n<=0){kt();return}let r=t.getItem(e.directoryPath),i=eU(r)?r:null;if(i==null||i.isExpanded()){kt();return}let a=`${e.directoryPath}::${e.flattenedSegmentPath??``}`;R.current!==a&&(kt(),R.current=a,z.current=setTimeout(()=>{let n=t.getDragSession()?.target;n?.kind!==`directory`||n.directoryPath!==e.directoryPath||n.flattenedSegmentPath!==e.flattenedSegmentPath||i.expand()},n))},It=()=>{L.current=null;let e=B.current,n=C.current;if(e==null||n==null||t.getDragSession()==null)return;let r=n.getBoundingClientRect(),i=ZH(e.clientY,r);if(i===0)return;let a=Math.max(0,n.scrollHeight-n.clientHeight),o=Math.max(0,Math.min(a,n.scrollTop+i));o!==n.scrollTop&&(n.scrollTop=o,D.current()),Ft(Pt(e.clientX,e.clientY)),L.current=Dt(It)},Lt=(e,t)=>{B.current={clientX:e,clientY:t},L.current??=Dt(It)},Rt=(e,n,r)=>{let i=e.currentTarget;if(i!=null){if(Nt(),At(),kt(),jt(),t.startDrag(r)===!1){e.preventDefault();return}if(H.current=n,e.dataTransfer!=null&&(e.dataTransfer.effectAllowed=`move`,e.dataTransfer.dropEffect=`move`,e.dataTransfer.setData(`text/plain`,r),XH())){let t=YH(i),n=i.getBoundingClientRect();Object.assign(t.style,{height:`${n.height}px`,opacity:`0.85`,transform:`translate3d(-9999px, 0px, 0)`,width:`${n.width}px`}),Mt(t),V.current=t,e.dataTransfer.setDragImage(t,Math.max(0,e.clientX-n.left),Math.max(0,e.clientY-n.top))}}},zt=()=>{At(),kt(),jt(),H.current=null,t.cancelDrag()},Bt=(e,n,r)=>{if(J.current!=null||W.current)return;let i=e.touches[0],a=e.currentTarget;if(i==null||a==null)return;q.current={clientX:i.clientX,clientY:i.clientY},K.current=a,a.setAttribute(`draggable`,`false`);let o=(e={})=>{let t=e.restoreNativeDraggable??!W.current;J.current!=null&&(clearTimeout(J.current),J.current=null),document.removeEventListener(`touchmove`,s),document.removeEventListener(`touchend`,c),document.removeEventListener(`touchcancel`,c),U.current===o&&(U.current=null),t&&(a.setAttribute(`draggable`,`true`),K.current===a&&(K.current=null),q.current=null)},s=e=>{let t=e.touches[0],n=q.current;if(t==null||n==null)return;let r=t.clientX-n.clientX,i=t.clientY-n.clientY;r*r+i*i<=UH*UH||o()},c=()=>{o()};document.addEventListener(`touchmove`,s,{passive:!0}),document.addEventListener(`touchend`,c),document.addEventListener(`touchcancel`,c),U.current=o,J.current=setTimeout(()=>{if(o({restoreNativeDraggable:!1}),t.startDrag(r)===!1){a.setAttribute(`draggable`,`true`),K.current===a&&(K.current=null),q.current=null;return}W.current=!0,K.current=a,a.setAttribute(`draggable`,`false`),a.style.setProperty(`touch-action`,`none`),H.current=n;let e=a.getBoundingClientRect(),s=YH(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`}),Mt(s),V.current=s,G.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=G.current;n!=null&&V.current!=null&&(V.current.style.transform=`translate3d(${t.clientX-n.x}px, ${t.clientY-n.y}px, 0)`),Ft(Pt(t.clientX,t.clientY)),Lt(t.clientX,t.clientY)},l=e=>{let n=e.changedTouches[0];n!=null&&Pt(n.clientX,n.clientY),t.completeDrag(),Nt()},u=()=>{t.cancelDrag(),Nt()};U.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)},HH)},Vt=e=>{if(de!=null){if(e.key===`Escape`){xt(),e.preventDefault(),e.stopPropagation();return}oU.has(e.key)&&(e.preventDefault(),e.stopPropagation());return}if(Ue.isActive()){if(e.key===`Escape`)Ue.cancel();else if(e.key===`Enter`)Ue.commit();else return;ce(`focus`),te(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(l&&e.key===`F2`){wt(Je??void 0),e.preventDefault(),e.stopPropagation();return}if(Ke){if(e.key===`Escape`)F.current=!1,I.current=null,t.closeSearch();else if(e.key===`Enter`){let e=t.getFocusedPath();e!=null&&t.selectOnlyPath(e);let n=C.current,r=ZV(n,st);I.current=Ye<0||n==null?null:Math.max(0,Math.min(Ye*s-n.scrollTop,Math.max(0,r-s))),F.current=!0,t.closeSearch()}else if(e.key===`ArrowDown`)t.focusNextSearchMatch();else if(e.key===`ArrowUp`)t.focusPreviousSearchMatch();else return;ce(`focus`),te(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(f&&nU(e)){t.openSearch(e.key),te(e=>e+1),e.preventDefault(),e.stopPropagation();return}let n=Me&&iU(e),r=aU(e,Me),i=r&&S.current!=null?XV(S.current):null,a=r?new Set(pU(S.current)):new Set,o=i?.dataset.fileTreeStickyPath??null,c=i?.dataset.fileTreeStickyRow===`true`&&o!=null;if(c&&o!==Je&&a.has(o)){let e=C.current;xe(o,e?.scrollTop??null),t.focusPath(o)}let u=t.getFocusedPath(),d=t.getFocusedIndex(),p=t.getFocusedItem();if(p==null)return;let m=eU(p)?p:null,h=u!=null&&(pt.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=fU(u,E.current,T.current);e==null||n==null?y=!1:Ct(e,u)}else if((e.ctrlKey||e.metaKey)&&tU(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;ce(`focus`);let b=t.getFocusedPath(),x=b!=null&&(pt.has(b)||a.has(b)),w=g&&b!==u,D=n&&c&&o===u&&b===u;if((h||D)&&b!=null&&(w&&x||D))xe(b,v?.scrollTop??null),M.current=!0,re(e=>e===b?e:b);else{let t=e.key===`ArrowUp`&&h&&b!==u;b!=null&&(t||_&&b===u)?(Se(b,hU(S.current,v,i,u,s,ft,st)),M.current=!0,re(e=>e===b?e:b)):be()}te(e=>e+1),e.preventDefault(),e.stopPropagation()};EH(()=>{if(!(!f||!Ke)){if(Ce.current){Ce.current=!1;return}YV(w.current)}},[Ke,f]),EH(()=>{let e=x.current;switch(iH({hasRenderedInput:e!=null,previousRenamingPath:P.current,renamingPath:We})){case`reset`:P.current=null;return;case`reveal-canonical`:We!=null&&Tt(We,{restoreTreeFocus:!1,targetOffset:`live-overlay`});return;case`ignore`:return;case`focus-input`:e!=null&&(me.current=null,P.current=We,YV(e),e.select());return}},[ct.end,ct.start,We,Tt,pt]),EH(()=>{let e=S.current;if(e==null)return;let t=null,n=()=>{t!=null&&(clearTimeout(t),t=null)},r=()=>{let t=XV(e)?.dataset.itemPath??null;re(e=>e===t?e:t)},i=()=>{n(),M.current=!0,r()},a=i=>{let a=i.relatedTarget;if(a==null){n(),t=setTimeout(()=>{if(t=null,XV(e)!=null){r();return}M.current=!1,re(null)},0);return}if(!(a instanceof Node)||!e.contains(a)){n(),M.current=!1,re(null);return}let o=a instanceof HTMLElement?a.dataset.itemPath??null:null;re(e=>e===o?e:o)};return e.addEventListener(`focusin`,i),e.addEventListener(`focusout`,a),()=>{n(),e.removeEventListener(`focusin`,i),e.removeEventListener(`focusout`,a)}},[]),EH(()=>{let e=S.current;e!=null&&(at.physical.scrollTop<=0?e.dataset.scrollAtTop=`true`:delete e.dataset.scrollAtTop)},[at.physical.scrollTop]),EH(()=>{let e=null,n=C.current,r=b.current,i=S.current;if(n==null)return;O.current=ZV(n,g);let a=()=>{let e=t.getVisibleCount(),r=QV(O.current,g),i=Math.max(0,e*s-r);n.scrollTop>i&&(n.scrollTop=i),ke(VH({controller:t,itemHeight:s,overscan:c,scrollTop:Math.min(n.scrollTop,i),stickyFolders:h,viewportHeight:r}))};if(!A.current){A.current=!0;let e=t.getFocusedIndex();if(e>=0){let r=QV(O.current,g),i=t.getVisibleRows(e,e)[0]??null;eH(n,e,s,r,h&&i!=null?Math.max(0,Math.min(i.ancestorPaths.length*s,Math.max(0,r-s))):0)}}D.current=a;let o=!1,l=t.subscribe(()=>{o?te(e=>e+1):o=!0,a()}),u=()=>{ye.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,ue(e=>e+1),e=null},50))},d=null,f=()=>{i!=null&&delete i.dataset.overlayReveal,d!=null&&(clearTimeout(d),d=null)},p=()=>{i==null||ye.current===!0||n.scrollTop>0||(i.dataset.overlayReveal=`true`,d!=null&&clearTimeout(d),d=setTimeout(()=>{f()},200))},m=()=>{if(a(),n.scrollTop>0&&f(),pe.current!=null&&y.current&&bt.current(),ye.current===!0){y.current=!1;return}ie(e=>e==null?e:null),u()},_=()=>{u(),p()},v=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`PageUp`,`PageDown`,`Home`,`End`,` `,`Spacebar`]),x=e=>{v.has(e.key)&&_()};n.addEventListener(`scroll`,m,{passive:!0}),n.addEventListener(`wheel`,_,{passive:!0}),n.addEventListener(`touchmove`,_,{passive:!0}),n.addEventListener(`keydown`,x);let w=typeof ResizeObserver<`u`?new ResizeObserver(e=>{O.current=(e[0]==null?null:$V(e[0]))??ZV(n,g),a()}):null;return w?.observe(n),()=>{D.current=()=>{},l(),n.removeEventListener(`scroll`,m),n.removeEventListener(`wheel`,_),n.removeEventListener(`touchmove`,_),n.removeEventListener(`keydown`,x),e!=null&&clearTimeout(e),d!=null&&clearTimeout(d),r!=null&&delete r.dataset.isScrolling,i!=null&&(delete i.dataset.isScrolling,delete i.dataset.overlayReveal),y.current=!1,O.current=null,w?.disconnect()}},[t,g,s,c,h]),EH(()=>{Me||de==null||xt(!1)},[xt,Me,de]);let Ht=OH(()=>de==null?null:`${de.path}::${de.source}`,[de]);EH(()=>{if(Ht==null){m?.clearSlotContent(EF);return}let t=pe.current;if(t==null)return;let n=v.current??_.current;if(n==null)return;let r={anchorElement:n,anchorRect:t.anchorRect??cU(n.getBoundingClientRect()),close:e=>{bt.current(e?.restoreFocus??!0)},restoreFocus:()=>{yt.current&&vt.current(pe.current?.path??null)}},i=e?.contextMenu?.render?.(t.item,r)??null;return m?.setSlotContent(EF,i),e?.contextMenu?.onOpen?.(t.item,r),xU(i),queueMicrotask(()=>{i==null||!i.isConnected||document.activeElement===i&&xU(i)}),()=>{m?.clearSlotContent(EF)}},[Ht,e?.contextMenu,m]),EH(()=>{de!=null&&t.getItem(de.path)==null&&xt()},[xt,de,t]),EH(()=>{if(de==null)return;let e=S.current?.getRootNode(),t=e instanceof ShadowRoot?e.host:S.current,n=e=>{let n=e.target;n instanceof Node&&(sU(e)||_.current?.contains(n)!==!0&&t?.contains(n)!==!0&&xt())},r=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),xt())};return document.addEventListener(`mousedown`,n,!0),document.addEventListener(`keydown`,r,!0),()=>{document.removeEventListener(`mousedown`,n,!0),document.removeEventListener(`keydown`,r,!0)}},[xt,de]),EH(()=>{let e=C.current,n=S.current;if(e==null||n==null){N.current=Je;return}let r=Je==null?null:T.current.get(Je)??null,i=XV(n),a=i?.dataset.itemPath??null,o=Ge&&x.current===i,c=f&&w.current===i,l=F.current&&!Ke,u=I.current??0,d=me.current,p=he.current,m=ge.current,g=_e.current,_=i!=null,v=M.current||_,y=N.current!==Je,b=p!=null&&p===Je&&Je!=null,E=!1,O=!1;if(Xe!=null&&Xe.id!==k.current){k.current=Xe.id;let n=Xe.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,st-s))):ft;E=!0,O=tH(e,n,s,st,dt,Xe.offset,t)}t.clearScrollRequest(Xe.id)}let A=!E&&l&&nH(e,Ye,s,st,dt,u),j=!E&&d!=null&&d===Je&&nH(e,Ye,s,st,dt,ft),P=!E&&m!=null&&m.path===Je&&nH(e,Ye,s,st,dt,m.viewportOffset),L=!E&&g!=null&&g.path===Je&&e.scrollTop!==g.scrollTop;if(L&&(e.scrollTop=g.scrollTop),(L||O||j||P||A||v&&y&&d!==Je&&!b&&eH(e,Ye,s,st,ft))&&D.current(),E){N.current=Je;return}if(!v){N.current=Je;return}if(o){N.current=Je;return}if(c&&!l){N.current=Je;return}if(r==null){l&&Ye>=0&&(nH(e,Ye,s,st,dt,u),D.current()),N.current=Je;return}(y||l||d===Je||p===Je||m?.path===Je||g?.path===Je||a==null||a!==Je)&&(YV(r),d===Je&&(me.current=null),p===Je&&(he.current=null),m?.path===Je&&(ge.current=null),g?.path===Je&&(_e.current=null),F.current=!1,I.current=null),N.current=Je},[t,Ye,Je,mt,s,Ge,Ke,ct,st,f,Xe,h,ft,dt,ot]);let Ut=Ye>=0&&Ye>=at.visible.startIndex&&Ye<=at.visible.endIndex,Wt=Je!=null&<.some(e=>RH(e.row)===Je),Gt=Ut||Wt,Kt=Pe&&M.current===!0&&Gt?Je:null,qt=se===`pointer`?Y:null,Jt=de?.path??ve.current??qt??Kt??Y,Yt=de?.source===`right-click`;EH(()=>{y.current&&de==null||St(Be(Jt))},[de,Be,ct,st,le,lt,Jt,St,ot]);let Xt=kH(e=>{if(y.current||sU(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&&ce(e=>e===`pointer`?e:`pointer`),ie(e=>e===i?e:i)},[]),Zt=kH(()=>{ie(null)},[]);EH(()=>{if(!Ze)return;let e=()=>{Nt(),t.cancelDrag()};return window.addEventListener(`dragend`,e),()=>{window.removeEventListener(`dragend`,e),Nt(),t.cancelDrag()}},[t,Ze]);let Qt=e=>{if(!Ze||t.getDragSession()==null||W.current)return;let n=JH(e.target instanceof HTMLElement?e.target:null);t.setDragTarget(n),Ft(t.getDragSession()?.target??null),Lt(e.clientX,e.clientY),e.dataTransfer!=null&&(e.dataTransfer.dropEffect=`move`),e.preventDefault()},$t=e=>{if(!Ze||t.getDragSession()==null||W.current)return;let n=e.relatedTarget;n instanceof Node&&S.current?.contains(n)===!0||(kt(),jt(),t.setDragTarget(null))},en=e=>{!Ze||t.getDragSession()==null||W.current||(e.preventDefault(),Pt(e.clientX,e.clientY),t.completeDrag(),At(),kt(),jt(),H.current=null)},tn=at.window.height,nn=at.window.offsetTop,rn=Math.min(0,st-tn),an=Math.min(0,st-tn-ft),on=ne===Je||F.current,sn=Je!=null&&on&&!mt&&Ye>=0?ot[Ye]??t.getVisibleRows(Ye,Ye)[0]??null:null,cn=sn==null?null:rH(Ye,s,ct,tn),ln=H.current,un=tt!=null&&ln!=null&&ln.path===tt&&ln.index>=ct.start&&ln.index<=ct.end,dn=tt!=null&&ln!=null&&ln.path===tt&&!un&&ln.path!==sn?.path?ln:null,fn=dn==null?null:rH(dn.index,s,ct,tn),pn=rU((Ye>=0?ot[Ye]??t.getVisibleRows(Ye,Ye)[0]??null:null)?.ancestorPaths.at(-1)??null),mn=Ke&&Je!=null?vU(o,Je,!mt):void 0,hn=de?.path??(Ke?Je:ne),gn=de?.path??Y,_n=Be(Jt),vn=Me&&Pe&&!Yt&&!Ge&&_n!=null&&ae!=null&&Jt!=null,yn=Me&&(vn||de!=null),bn=de?.anchorRect,xn=bn==null&&_n!=null&&ae!=null&&(de!=null||vn)?ae:null,Sn=bn==null?xn==null?void 0:{top:`${xn}px`}:{left:`${bn.left}px`,position:`fixed`,right:`auto`,top:`${bn.top}px`},Cn=Yt?{opacity:`0`}:void 0,wn=kH((e,n,r,i)=>{let a=sH({event:{ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey},isDirectory:n.kind===`directory`,isSearchOpen:Ke,mode:i}),o=a.toggleDirectory&&n.kind===`directory`,s=o?t.resolveMountedDirectoryPathFromInput(r):null;if(o&&s==null)return;let c=s??r;switch(a.selection.kind){case`range`:t.selectPathRange(c,a.selection.additive);break;case`toggle`:t.togglePathSelectionFromInput(c);break;case`single`:t.selectOnlyMountedPathFromInput(c);break}let l=e.currentTarget instanceof HTMLElement?e.currentTarget:null,u=n.index>=at.visible.startIndex&&n.index<=at.visible.endIndex,d=i===`flow`&&u&&l!=null&&l.dataset.itemParked!==`true`;t.focusMountedPathFromInput(c),d&&(M.current=!0,re(e=>e===c?e:c),ce(`focus`)),o&&t.toggleMountedDirectoryFromInput(c),a.closeSearch&&t.closeSearch(),a.revealCanonical&&Tt(c,{targetOffset:`sticky-parents`})},[t,Ke,at.visible.endIndex,at.visible.startIndex,Tt]),Tn=()=>{if(y.current||!Pe||Jt==null||_n==null)return;let e=t.getItem(Jt);e!=null&&(St(_n),yt.current=!0,fe({anchorRect:null,item:{kind:e.isDirectory()?`directory`:`file`,name:_n.getAttribute(`aria-label`)??Jt,path:e.getPath()},path:e.getPath(),source:`button`}))},En={contextHoverPath:gn,contextMenuButtonTriggerEnabled:Pe,contextMenuButtonVisibility:Fe,contextMenuEnabled:Me,contextMenuRightClickEnabled:Ie,contextMenuTriggerMode:Ne,controller:t,directoriesWithGitChanges:i,dragAndDropEnabled:Ze,draggedPathSet:$e,dragTarget:et,gitLaneActive:Ve,gitStatusByPath:n,handleRowDragEnd:zt,handleRowDragStart:Rt,handleRowTouchStart:Bt,ignoredGitDirectories:r,ignoredInheritanceCache:ee,instanceId:o,itemHeight:s,onKeyDown:Vt,onRowClick:wn,openContextMenuForRow:Ct,registerButton:Le,registerRenameInput:ze,renameView:Ue,renderDecorationForRow:ht,resolveIcon:He,shouldSuppressContextMenu:Et,visualFocusPath:hn},Dn={...En,registerButton:Re};return mV(`div`,{ref:S,id:nt,"data-file-tree-context-menu-button-visibility":Me&&Pe?Fe:void 0,"data-file-tree-context-menu-trigger-mode":Me?Ne:void 0,"data-file-tree-has-context-menu-action-lane":Me&&Pe?`true`:void 0,"data-file-tree-has-git-lane":Ve?`true`:void 0,"data-file-tree-virtualized-root":`true`,"data-file-tree-root-drag-target":et?.kind===`root`?`true`:void 0,onDragLeave:Ze?$t:void 0,onDragOver:Ze?Qt:void 0,onDrop:Ze?en:void 0,onKeyDown:Vt,onPointerLeave:Me?Zt:void 0,onPointerOver:Me?Xt:void 0,role:`tree`,tabIndex:-1,style:{outline:`none`,position:`relative`},children:[mV(`style`,{"data-file-tree-guide-style":`true`,dangerouslySetInnerHTML:{__html:pn}}),mV(`slot`,{name:TF,"data-type":`header-slot`}),f?mV(`div`,{"data-file-tree-search-container":!0,"data-open":Ke?`true`:`false`,children:mV(`input`,{ref:w,"aria-activedescendant":mn,"aria-controls":nt,placeholder:`Search…`,"data-file-tree-search-input":!0,"data-file-tree-search-input-fake-focus":we?`true`:void 0,value:qe,onBlur:()=>{d===`retain`&&!Ee.current||t.closeSearch()},onFocus:De,onPointerDown:De,onInput:e=>{De();let n=e.currentTarget;t.setSearch(n.value)}})}):null,mV(`div`,{ref:C,"data-file-tree-virtualized-scroll":`true`,children:[h&&Ae&<.length>0?mV(`div`,{"aria-hidden":`true`,"data-file-tree-sticky-overlay":`true`,children:mV(`div`,{"data-file-tree-sticky-overlay-content":`true`,style:{height:`${rt}px`},children:lt.map((e,t)=>CU(Dn,e.row,`sticky:${RH(e.row)}`,{mode:`sticky`,style:{left:`0`,position:`absolute`,right:`0`,top:`${e.top}px`,zIndex:`${lt.length-t}`}}))})}):null,mV(`div`,{ref:b,"data-file-tree-virtualized-list":`true`,style:{height:`${dt}px`},children:[mV(`div`,{"data-file-tree-virtualized-sticky-offset":`true`,"aria-hidden":`true`,style:{height:`${nn}px`}}),mV(`div`,{"data-file-tree-virtualized-sticky":`true`,style:{height:`${tn}px`,top:`${rn}px`,bottom:`${an}px`},children:[wU(En,ct,pt),sn!=null&&cn!=null?CU(En,sn,`parked:${sn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:tt===sn.path?`none`:void 0,position:`absolute`,right:`0`,top:`${cn}px`}}):null,dn!=null&&fn!=null?CU(En,dn,`parked-drag:${dn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:`none`,position:`absolute`,right:`0`,top:`${fn}px`}}):null]})]})]}),Me?mV(`div`,{ref:_,"data-type":`context-menu-anchor`,"data-visible":yn?`true`:`false`,style:Sn,children:[mV(`button`,{ref:v,type:`button`,"data-type":DF,"aria-label":`Options`,"aria-haspopup":`menu`,"aria-expanded":de==null?`false`:`true`,"data-visible":vn?`true`:`false`,onMouseDown:e=>{e.preventDefault()},onClick:e=>{if(e.preventDefault(),e.stopPropagation(),de!=null){xt();return}Tn()},tabIndex:-1,style:Cn,children:mV(vV,{...He(`file-tree-icon-ellipsis`)})}),de==null?null:mV(`slot`,{name:EF})]}):null,de==null?null:mV(`div`,{"data-type":`context-menu-wash`,"aria-hidden":`true`,onMouseDownCapture:e=>{e.preventDefault(),xt()},onTouchStartCapture:e=>{e.preventDefault(),e.stopPropagation(),xt()},onTouchMoveCapture:e=>{e.preventDefault(),e.stopPropagation()},onWheelCapture:e=>{e.preventDefault(),e.stopPropagation()}})]})}var EU={hydrateRoot:(e,t)=>{fV(HB(TU,t),e)},renderRoot:(e,t)=>{dV(HB(TU,t),e)},unmountRoot:e=>{dV(null,e)}};function DU(e,t){EU.renderRoot(e,t)}function OU(e,t){EU.hydrateRoot(e,t)}function kU(e){EU.unmountRoot(e)}var AU=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)}}},jU=`__c`,MU=`__k`,NU=`__d`,PU=`__s`,FU=/[\s\n\\/='"\0<>]/,IU=/^(xlink|xmlns|xml)([A-Z])/,LU=/^(?:accessK|auto[A-Z]|cell|ch|col|cont|cross|dateT|encT|form[A-Z]|frame|hrefL|inputM|maxL|minL|noV|playsI|popoverT|readO|rowS|src[A-Z]|tabI|useM|item[A-Z])/,RU=/^ac|^ali|arabic|basel|cap|clipPath$|clipRule$|color|dominant|enable|fill|flood|font|glyph[^R]|horiz|image|letter|lighting|marker[^WUH]|overline|panose|pointe|paint|rendering|shape|stop|strikethrough|stroke|text[^L]|transform|underline|unicode|units|^v[^i]|^w|^xH/,zU=new Set([`draggable`,`spellcheck`]);function BU(e){e.__g===void 0?e[NU]=!0:e.__g|=8}function VU(e){e.__g===void 0?e[NU]=!1:e.__g&=-9}function HU(e){return e.__g===void 0?!0===e[NU]:!!(8&e.__g)}var UU=/["&<]/;function WU(e){if(e.length===0||!1===UU.test(e))return e;for(var t=0,n=0,r=``,i=``;n<e.length;n++){switch(e.charCodeAt(n)){case 34:i=`"`;break;case 38:i=`&`;break;case 60:i=`<`;break;default:continue}n!==t&&(r+=e.slice(t,n)),r+=i,t=n+1}return n!==t&&(r+=e.slice(t,n)),r}var GU={},KU=new Set(`animation-iteration-count.border-image-outset.border-image-slice.border-image-width.box-flex.box-flex-group.box-ordinal-group.column-count.fill-opacity.flex.flex-grow.flex-negative.flex-order.flex-positive.flex-shrink.flood-opacity.font-weight.grid-column.grid-row.line-clamp.line-height.opacity.order.orphans.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-miterlimit.stroke-opacity.stroke-width.tab-size.widows.z-index.zoom`.split(`.`)),qU=/[A-Z]/g;function JU(e){var t=``;for(var n in e){var r=e[n];if(r!=null&&r!==``){var i=n[0]==`-`?n:GU[n]||(GU[n]=n.replace(qU,`-$&`).toLowerCase()),a=`;`;typeof r!=`number`||i.startsWith(`--`)||KU.has(i)||(a=`px;`),t=t+i+`:`+r+a}}return t||void 0}function YU(){this.__d=!0}function XU(e,t){return{__v:e,context:t,props:e.props,setState:YU,forceUpdate:YU,__d:!0,__h:[]}}function ZU(e,t,n){if(!e.s){if(n instanceof QU){if(!n.s)return void(n.o=ZU.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(ZU.bind(null,e,t),ZU.bind(null,e,2));e.s=t,e.v=n;let r=e.o;r&&r(e)}}var QU=function(){function e(){}return e.prototype.then=function(t,n){var r=new e,i=this.s;if(i){var a=1&i?t:n;if(a){try{ZU(r,1,a(this.v))}catch(e){ZU(r,2,e)}return r}return this}return this.o=function(e){try{var i=e.v;1&e.s?ZU(r,1,t?t(i):i):n?ZU(r,1,n(i)):ZU(r,2,i)}catch(e){ZU(r,2,e)}},r},e}(),$U,eW,tW,nW,rW={},iW=Array.isArray,aW=Object.assign,oW=``,sW=`<!--$s-->`,cW=`<!--/$s-->`;function lW(e,t){var n,r=e.type,i=!0;return e[jU]?(i=!1,(n=e[jU]).state=n[PU]):n=new r(e.props,t),e[jU]=n,n.__v=e,n.props=e.props,n.context=t,BU(n),n.state??=rW,n[PU]??(n[PU]=n.state),r.getDerivedStateFromProps?n.state=aW({},n.state,r.getDerivedStateFromProps(n.props,n.state)):i&&n.componentWillMount?(n.componentWillMount(),n.state=n[PU]===n.state?n.state:n[PU]):!i&&n.componentWillUpdate&&n.componentWillUpdate(),tW&&tW(e),n.render(n.props,n.state,t)}function uW(e,t,n,r,i,a,o){if(e==null||!0===e||!1===e||e===oW)return oW;var s=typeof e;if(s!=`object`)return s==`function`?oW:s==`string`?WU(e):e+oW;if(iW(e)){var c,l=oW;i[MU]=e;for(var u=e.length,d=0;d<u;d++){var f=e[d];if(f!=null&&typeof f!=`boolean`){var p,m=uW(f,t,n,r,i,a,o);typeof m==`string`?l+=m:(c||=Array(u),l&&c.push(l),l=oW,iW(m)?(p=c).push.apply(p,m):c.push(m))}}return c?(l&&c.push(l),c):l}if(e.constructor!==void 0)return oW;e.__=i,$U&&$U(e);var h=e.type,g=e.props;if(typeof h==`function`){var _,v,y,b=t;if(h===WB){if(`tpl`in g){for(var x=oW,S=0;S<g.tpl.length;S++)if(x+=g.tpl[S],g.exprs&&S<g.exprs.length){var C=g.exprs[S];if(C==null)continue;typeof C!=`object`||C.constructor!==void 0&&!iW(C)?x+=C:x+=uW(C,t,n,r,e,a,o)}return x}if(`UNSTABLE_comment`in g)return`<!--`+WU(g.UNSTABLE_comment)+`-->`;v=g.children}else{if((_=h.contextType)!=null){var w=t[_.__c];b=w?w.props.value:_.__}var T=h.prototype&&typeof h.prototype.render==`function`;if(T)v=lW(e,b),y=e[jU];else{e[jU]=y=XU(e,b);for(var E=0;HU(y)&&E++<25;){VU(y),tW&&tW(e);try{v=h.call(y,g,b)}catch(t){throw a&&t&&typeof t.then==`function`&&(e._suspended=!0),t}}BU(y)}if(y.getChildContext!=null&&(t=aW({},t,y.getChildContext())),T&&EB.errorBoundaries&&(h.getDerivedStateFromError||y.componentDidCatch)){v=v!=null&&v.type===WB&&v.key==null&&v.props.tpl==null?v.props.children:v;try{return uW(v,t,n,r,e,a,!1)}catch(i){return h.getDerivedStateFromError&&(y[PU]=h.getDerivedStateFromError(i)),y.componentDidCatch&&y.componentDidCatch(i,rW),HU(y)?(v=lW(e,t),(y=e[jU]).getChildContext!=null&&(t=aW({},t,y.getChildContext())),uW(v=v!=null&&v.type===WB&&v.key==null&&v.props.tpl==null?v.props.children:v,t,n,r,e,a,o)):oW}finally{eW&&eW(e),nW&&nW(e)}}}v=v!=null&&v.type===WB&&v.key==null&&v.props.tpl==null?v.props.children:v;try{var D=uW(v,t,n,r,e,a,o);return eW&&eW(e),EB.unmount&&EB.unmount(e),e._suspended?typeof D==`string`?sW+D+cW:iW(D)?(D.unshift(sW),D.push(cW),D):D.then(function(e){return sW+e+cW}):D}catch(i){if(!a&&o&&o.onError){var O=function i(s){return o.onError(s,e,function(e,s){try{return uW(e,t,n,r,s,a,o)}catch(e){return i(e)}})}(i);if(O!==void 0)return O;var k=EB.__e;return k&&k(i,e),oW}if(!a||!i||typeof i.then!=`function`)throw i;return i.then(function i(){try{var s=uW(v,t,n,r,e,a,o);return e._suspended?sW+s+cW:s}catch(e){if(!e||typeof e.then!=`function`)throw e;return e.then(i)}})}}var A,j=`<`+h,M=oW;for(var N in g){var P=g[N];if(typeof(P=fW(P)?P.value:P)!=`function`||N===`class`||N===`className`){switch(N){case`children`:A=P;continue;case`key`:case`ref`:case`__self`:case`__source`:continue;case`htmlFor`:if(`for`in g)continue;N=`for`;break;case`className`:if(`class`in g)continue;N=`class`;break;case`defaultChecked`:N=`checked`;break;case`defaultSelected`:N=`selected`;break;case`defaultValue`:case`value`:switch(N=`value`,h){case`textarea`:A=P;continue;case`select`:r=P;continue;case`option`:r!=P||`selected`in g||(j+=` selected`)}break;case`dangerouslySetInnerHTML`:M=P&&P.__html;continue;case`style`:typeof P==`object`&&(P=JU(P));break;case`acceptCharset`:N=`accept-charset`;break;case`httpEquiv`:N=`http-equiv`;break;default:if(IU.test(N))N=N.replace(IU,`$1:$2`).toLowerCase();else{if(FU.test(N))continue;N[4]!==`-`&&!zU.has(N)||P==null?n?RU.test(N)&&(N=N===`panose1`?`panose-1`:N.replace(/([A-Z])/g,`-$1`).toLowerCase()):LU.test(N)&&(N=N.toLowerCase()):P+=oW}}P!=null&&!1!==P&&(j=!0===P||P===oW?j+` `+N:j+` `+N+`="`+(typeof P==`string`?WU(P):P+oW)+`"`)}}if(FU.test(h))throw Error(h+` is not a valid HTML tag name in `+j+`>`);if(M||(typeof A==`string`?M=WU(A):A!=null&&!1!==A&&!0!==A&&(M=uW(A,t,h===`svg`||h!==`foreignObject`&&n,r,e,a,o))),eW&&eW(e),nW&&nW(e),!M&&dW.has(h))return j+`/>`;var F=`</`+h+`>`,I=j+`>`;return iW(M)?[I].concat(M,[F]):typeof M==`string`?I+M+F:[I,M,F]}var dW=new Set([`area`,`base`,`br`,`col`,`command`,`embed`,`hr`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`]);function fW(e){return typeof e==`object`&&!!e&&typeof e.peek==`function`&&`value`in e}var pW=0;function mW(e){return e!=null&&e.length>0?e:(pW+=1,`pst_ft_${pW}`)}function hW({initialVisibleRowCount:e,itemHeight:t}){return e==null?420:Math.max(0,e)*(t??Cz)}function gW(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 _W(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 vW(e){return Array.from(e.children).filter(e=>e instanceof SVGElement)}var yW=class{static LoadedCustomComponent=!0;#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=new AU;#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=mW(a),this.#p=TB(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=Sz(n,c),this.#d={itemHeight:this.#u.itemHeight,overscan:d,stickyFolders:_,initialVisibleRowCount:y},this.#t=new bB({...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&&(kU(this.#b),delete this.#b.dataset.fileTreeVirtualizedWrapper,this.#b=void 0),this.#l.clearAll(),this.#l.setHost(null),this.#f!=null&&(delete this.#f.dataset.fileTreeVirtualized,this.#I(this.#f),this.#f=void 0)}cleanUp(){this.unmount(),this.#y?.(),this.#y=null,this.#t.destroy()}getFileTreeContainer(){return this.#f}getItem(e){return this.#t.getItem(e)}getFocusedItem(){return this.#t.getFocusedItem()}getFocusedPath(){return this.#t.getFocusedPath()}getSelectedPaths(){return this.#t.getSelectedPaths()}getComposition(){return this.#e}getItemHeight(){return this.#u.itemHeight}getDensityFactor(){return this.#u.factor}subscribe(e){let t=!1;return this.#t.subscribe(()=>{if(!t){t=!0;return}e()})}focusPath(e){this.#t.focusPath(e)}scrollToPath(e,t){this.#t.scrollToPath(e,t)}focusNearestPath(e){return this.#t.focusNearestPath(e)}add(e){this.#t.add(e)}batch(e){this.#t.batch(e)}move(e,t,n){this.#t.move(e,t,n)}onMutation(e,t){return this.#t.onMutation(e,t)}setSearch(e){this.#t.setSearch(e)}openSearch(e){this.#t.openSearch(e)}closeSearch(){this.#t.closeSearch()}isSearchOpen(){return this.#t.isSearchOpen()}getSearchValue(){return this.#t.getSearchValue()}getSearchMatchingPaths(){return this.#t.getSearchMatchingPaths()}focusNextSearchMatch(){this.#t.focusNextSearchMatch()}focusPreviousSearchMatch(){this.#t.focusPreviousSearchMatch()}startRenaming(e,t){return this.#t.startRenaming(e,t)}remove(e,t){this.#t.remove(e,t)}resetPaths(e,t){this.#t.resetPaths(e,t)}setComposition(e){this.#e=e;let t=this.#T();t!=null&&(this.#O(),DU(t.wrapper,this.#w()))}setGitStatus(e){this.#p=TB(e,this.#p);let t=this.#T();t!=null&&DU(t.wrapper,this.#w())}setIcons(e){this.#m=e;let t=this.#T();t!=null&&(this.#E(t.host,t.wrapper),DU(t.wrapper,this.#w()))}hydrate({fileTreeContainer:e}){let t=this.#P(e),n=this.#N(t);this.#O(),OU(n,this.#w())}render({containerWrapper:e,fileTreeContainer:t}){let n=this.#P(t??this.#f,e),r=this.#N(n);this.#O(),DU(r,this.#w())}#C(){return{initialViewportHeight:hW({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(TF,e());return}this.#l.setSlotHtml(TF,this.#e?.header?.html??null)}#k(e){let t=vW(e).find(e=>_W(e)),n=gW(hF(kF(this.#m).set));n!=null&&(t!=null&&t.outerHTML===n.outerHTML||(t==null?e.prepend(n):t.replaceWith(n)))}#A(e){let t=vW(e),n=t.find(e=>_W(e)),r=t.filter(e=>e!==n),i=kF(this.#m).spriteSheet?.trim()??``;if(i.length===0){for(let e of r)e.remove();return}let a=gW(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=kF(this.#m);t.colored&&_F(t.set)?e.dataset.fileTreeColoredIcons=`true`:delete e.dataset.fileTreeColoredIcons}#M(e){let t=e.querySelector(`style[${xF}]`);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(xF,``),this.#g.parentNode!==e&&e.appendChild(this.#g),this.#g.textContent=Dz(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 Nz(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)}},bW=typeof window>`u`?Q.useEffect:Q.useLayoutEffect;function xW(e,t,n){let r=e==null?null:(0,Z.jsx)(`div`,{slot:TF,children:e}),i=t!=null&&n!=null?(0,Z.jsx)(`div`,{slot:EF,children:t(n.item,n.context)}):null;return r==null&&i==null?null:(0,Z.jsxs)(Z.Fragment,{children:[r,i]})}function SW(e,t){return typeof window>`u`&&t!=null?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`template`,{shadowrootmode:`open`,dangerouslySetInnerHTML:{__html:t.shadowHtml}}),e]}):(0,Z.jsx)(Z.Fragment,{children:e})}function CW(e){let t=e.shadowRoot;return t?.querySelector(`[data-file-tree-id]`)instanceof HTMLElement||t?.querySelector(`[data-file-tree-id]`)instanceof SVGElement?!0:e.querySelector(`template[shadowrootmode="open"]`)instanceof HTMLTemplateElement}function wW(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 TW({header:e,id:t,model:n,preloadedData:r,renderContextMenu:i,...a}){let[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(null),u=(0,Q.useRef)(n.getComposition()),d=(0,Q.useRef)(n);d.current!==n&&(d.current=n,u.current=n.getComposition());let f=i!=null,p=(0,Q.useCallback)(()=>{s(null)},[]),m=(0,Q.useCallback)((e,t)=>{s({context:t,item:e})},[]),h=u.current,g=(0,Q.useMemo)(()=>wW(h,e,f,p,m),[h,p,m,f,e]),_=(0,Q.useCallback)(e=>{l(e)},[]);(0,Q.useEffect)(()=>{f||s(null)},[f]),bW(()=>{n.setComposition(g)},[g,n]),bW(()=>{if(c!=null)return r!=null&&CW(c)?n.hydrate({fileTreeContainer:c}):n.render({fileTreeContainer:c}),()=>{n.unmount(),n.setComposition(h)}},[h,c,n,r]);let v=SW(xW(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,Z.jsx)(yF,{...a,id:y,ref:_,style:b,suppressHydrationWarning:r!=null,children:v})}function EW(e){let[t]=(0,Q.useState)(()=>new yW(e)),n=(0,Q.useRef)({timeout:null,model:t});return(0,Q.useEffect)(()=>{let{current:e}=n;return e.timeout!=null&&(clearTimeout(e.timeout),e.timeout=null),()=>{e.timeout=setTimeout(()=>e.model.cleanUp(),1)}},[]),{model:t}}var DW={density:`compact`,flattenEmptyDirectories:!1},OW={"--trees-level-gap-override":`3px`,"--trees-item-row-gap-override":`2px`,"--trees-icon-width-override":`14px`,"--trees-item-height":`24px`,"--trees-indent-guide-bg-override":`color-mix(in oklab, var(--trees-fg-muted) 30%, transparent)`},kW=`
|
|
1866
|
+
}`}var Dz=new WeakMap;function Oz(e){let t=Dz.get(e);if(t!=null)return t;let n=document.createElement(`div`);n.setAttribute(xF,`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(),Dz.set(e,i),i}function kz(e,t){if(!e.isConnected)return;let n=Oz(t);if(n==null)return;let r=t.querySelector(`style[${SF}]`),i=r instanceof HTMLStyleElement?r:document.createElement(`style`);r instanceof HTMLStyleElement||(i.setAttribute(SF,``),t.appendChild(i)),i.textContent=`:host { ${CF}: ${n}px; }`}var Az;function jz(e){if(typeof CSSStyleSheet<`u`&&typeof CSSStyleSheet.prototype.replaceSync==`function`&&`adoptedStyleSheets`in e){Az??(Az=new CSSStyleSheet,Az.replaceSync(Tz(Cz)));let t=!1;try{e.adoptedStyleSheets=[Az],t=!0}catch{}if(t){e.querySelector(`style[${yF}]`)?.remove();return}}if(e.querySelector(`style[data-file-tree-style]`)==null){let t=document.createElement(`style`);t.setAttribute(yF,``),t.textContent=Tz(Cz),e.prepend(t)}}function Mz(e,t){Nz(e,t),jz(t),kz(e,t)}function Nz(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`});Mz(this,e)}}if(customElements.define(vF,e),typeof document<`u`)for(let e of Array.from(document.querySelectorAll(vF)))e instanceof HTMLElement&&Mz(e,e.shadowRoot??e.attachShadow({mode:`open`}))}var Pz=e=>e.startsWith(`f::`)?e.slice(3):e;function Fz(e){let t=e.lastIndexOf(`/`);return t<0?{parentPath:``,baseName:e}:{parentPath:e.slice(0,t),baseName:e.slice(t+1)}}function Iz(e,t){return e===``?t:`${e}/${t}`}function Lz({files:e,path:t,isFolder:n,nextBasename:r}){let i=Pz(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}=Fz(i);if(a===s)return{nextFiles:e,sourcePath:i,destinationPath:i,isFolder:n};let c=Iz(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 Rz(e){return e.endsWith(`/`)}function zz(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 Bz(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 Vz(e,t){return t.includes(e)?Bz(t):[e]}function Hz(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 Uz(e,t){return{draggedPaths:e,target:t}}function Wz(e,t){if(t.kind!==`directory`||t.directoryPath==null)return!1;for(let n of e)if(Rz(n)&&(t.directoryPath===n||t.directoryPath.startsWith(n)))return!0;return!1}function Gz(e,t){return t.kind===`root`||t.directoryPath==null?zz(e):t.directoryPath}function Kz(e,t){let n=e.map(e=>{let n=Gz(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 qz(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 Jz(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(!qz(vz.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 Yz(e){return e.operation===`add`||e.operation===`remove`||e.operation===`move`||e.operation===`batch`}function Xz(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 Zz(e,t){if(e===t)return!0;let n=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(n)}function Qz(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 Zz(e,t.path)?n?e:null:e;case`move`:return Xz(e,t.from,t.to);case`batch`:{let r=e;for(let e of t.events)if(r=Qz(r,e,n),r==null)return null;return r}}}function $z(e){return{canonicalChanged:e.canonicalChanged,projectionChanged:e.projectionChanged,visibleCountDelta:e.visibleCountDelta}}function eB(e){switch(e.operation){case`add`:return{...$z(e),operation:`add`,path:e.path};case`remove`:return{...$z(e),operation:`remove`,path:e.path,recursive:e.recursive};case`move`:return{...$z(e),from:e.from,operation:`move`,to:e.to}}}function tB(e){return{...$z(e),events:e.events.filter(e=>e.operation===`add`||e.operation===`remove`||e.operation===`move`).map(e=>eB(e)),operation:`batch`}}function nB(e){switch(e.operation){case`add`:case`remove`:case`move`:return eB(e);case`batch`:return tB(e);default:return null}}function rB(e,t){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}function iB(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 aB(e){return iB(e).at(-1)??null}function oB(e,t){return t==null?e:e.startsWith(t)?e.slice(t.length):e}function sB(e){return e.endsWith(`/`)}var cB=e=>e.toLowerCase();function lB(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`);return n<0?t:t.slice(n+1)}function uB(e){return e.endsWith(`/`)?e.slice(0,-1):e}function dB(e,t){return t&&!e.endsWith(`/`)?`${e}/`:e}var fB=e=>{let t=e.trim();return t.length===0?``:(t.includes(`\\`)?t.replaceAll(`\\`,`/`):t).toLowerCase()},pB=Symbol(`FILE_TREE_RENAME_VIEW`),mB=512,hB=512;function gB(e){return e===`top`||e===`center`?e:`nearest`}function _B(e,t,n){if(e===0)return-1;if(n!=null){let e=t(n);if(e!=null)return e;let r=iB(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 vB(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:_B(e.paths.length,r,t),getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex}}var yB=class{#e;#t=new Set;#n=new Map;#r=null;#i=null;#a=new Map;#o=new Map;#s=-1;#c=null;#l=!1;#u=e=>-1;#d=new Map;#f=null;#p=null;#m=null;#h=null;#g=null;#_;#v;#y;#b=[];#x=new Int32Array;#S=new Int32Array;#C=void 0;#w=!1;#T=null;#E=``;#D=!1;#O=new Set;#k=[];#A;#j=null;#M=null;#N=null;#P=null;#F=null;#I=null;#L=null;#R=0;#z=null;#B=new Set;#V=0;#H;#U=0;#W=!1;#G=0;#K;constructor(e){let{dragAndDrop:t,fileTreeSearchMode:n,initialSearchQuery:r,initialSelectedPaths:i,renaming:a,onSearchChange:o,paths:s,preparedInput:c,...l}=e,u=Jz({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=aB(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:gB(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<=hB){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=Vz(t,n);return this.#r.canDrag?.(r)===!1?!1:(n.includes(t)||this.#ae([t],t,!1),this.#Pe(t),this.#i={draggedPaths:r,primaryPath:t,target:null},this.#De(),!0)}setDragTarget(e){let t=this.#i;if(t==null)return;let n=e;if(n!=null){let e=Uz(t.draggedPaths,n);(Wz(t.draggedPaths,n)||this.#r?.canDrop?.(e)===!1)&&(n=null)}Hz(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=Uz(e.draggedPaths,t);if(Wz(e.draggedPaths,t)||this.#r?.canDrop?.(n)===!1)return this.#De(),!1;let r=Kz(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=sB(r),a=uB(r);if(this.#C?.({isFolder:i,path:a})===!1)return!1;for(let e of iB(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=lB(r),this.#D=t.removeIfCanceled??!1,this.#De(),!0}[pB](){return{cancel:()=>{this.#q()},commit:()=>{this.#J()},getPath:()=>this.#T,getValue:()=>this.#E,isActive:()=>this.#T!=null,setValue:e=>{this.#Y(e)}}}#q(){if(this.#T==null)return;let e=this.#T,t=this.#D;if(this.#T=null,this.#E=``,this.#D=!1,t){this.remove(e,sB(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,sB(e)?{recursive:!0}:void 0);return}let t=sB(e),n=Lz({files:this.#H.list(),isFolder:t,nextBasename:this.#E,path:uB(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(dB(n.sourcePath,t),dB(n.destinationPath,t))}#Y(e){this.#T==null||this.#E===e||(this.#E=e,this.#De())}resetPaths(e,t={}){let n=this.#H.list().length,r=this.#G,i=Jz({paths:e,preparedInput:t.preparedInput},`resetPaths`,this.#e.sort),a=this.#le(i.paths,i.preparedInput,t.initialExpandedPaths),o=this.#c,s=this.#T,c=this.getSelectedPaths(),l=this.#z;this.#K?.(),this.#H=a,this.#d.clear(),this.#he();let u=c.map(e=>a.getPathInfo(e)?.path??null).filter(e=>e!=null),d=!rB(this.#B,u);this.#B=new Set(u),d&&(this.#V+=1),this.#z=l==null?null:a.getPathInfo(l)?.path??null,this.#T=s==null?null:a.getPathInfo(s)?.path??null,this.#T??(this.#E=``,this.#D=!1),this.#je(o,o!=null||u.length>0||this.#z!=null),this.#K=this.#Re(),this.#De(),this.#Oe({canonicalChanged:!0,operation:`reset`,pathCountAfter:i.paths.length,pathCountBefore:n,projectionChanged:!0,usedPreparedInput:t.preparedInput!=null,visibleCountDelta:this.#G-r})}#X(e){this.#Ie();let t=aB(e),n=oB(e,t),r=null,i=null;for(let e of this.#be()){if(aB(e)!==t)continue;let a=oB(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=iB(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=!rB(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 vz({...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 iB(t))e.add(n)}return this.#m=[...e].sort(),this.#m}#fe(){return this.#g??=this.#ue().map(cB),this.#g}#pe(){return this.#f??=this.#de().filter(e=>e.endsWith(`/`)),this.#f}#me(){return this.#p??=this.#pe().map(cB),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 iB(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:fB(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 iB(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 iB(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=vB(this.#H.getVisibleTreeProjectionData(t?void 0:Math.min(n,mB)),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=Qz(this.#T,e);t==null&&this.#T!=null&&(this.#E=``),this.#T=t;let n=Qz(this.#c,e,!0),r=[...this.#B].map(t=>Qz(t,e)).filter(e=>e!=null).map(e=>this.#H.getPathInfo(e)?.path??null).filter(e=>e!=null),i=Qz(this.#z,e),a=i==null?null:this.#H.getPathInfo(i)?.path??null,o=[...new Set(r)];return rB(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&&Yz(e)&&(this.#i=null);let t=Yz(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=nB(e);i!=null&&this.#Oe(i)})}#ze(e){if(this.#H.isExpanded(e)){this.#ie(e);return}this.#ke(e)}},bB=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 xB(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 SB(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 CB(e,t){return t?`${e}/`:e}function wB(e,t=null){let n=bB(e==null?void 0:[...e]);if(n===`0`)return null;if(t?.signature===n)return t;let r=new Map,i=new Set,a=new Set;for(let t of e??[]){let e=xB(t.path);if(e==null)continue;let n=CB(e.path,e.isDirectory);r.set(n,t.status),t.status===`ignored`&&e.isDirectory?a.add(n):e.isDirectory&&a.delete(n);for(let t of SB(e.path))i.add(t)}return{directoriesWithChanges:i,ignoredDirectoryPaths:a,signature:n,statusByPath:r}}var TB,EB,DB,OB,kB,AB,jB,MB,NB,PB,FB={},IB=[],LB=Array.isArray,RB=IB.slice,zB=Object.assign;function BB(e){e&&e.parentNode&&e.remove()}function VB(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?RB.call(arguments,2):n),HB(e,o,r,i,null)}function HB(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??++EB,__i:-1,__u:0};return i==null&&TB.vnode!=null&&TB.vnode(a),a}function UB(e){return e.children}function WB(e,t){this.props=e,this.context=t,this.__g=0}function GB(e,t){if(t==null)return e.__?GB(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`?GB(e):null}function KB(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 KB(e)}}function qB(e){(8&e.__g||!(e.__g|=8)||!DB.push(e)||kB++)&&OB==TB.debounceRendering||((OB=TB.debounceRendering)||queueMicrotask)(JB)}function JB(){for(var e,t,n,r,i,a,o,s,c=1;DB.length;)DB.length>c&&DB.sort(AB),e=DB.shift(),c=DB.length,8&e.__g&&(n=void 0,i=(r=(t=e).__v).__e,a=[],o=[],(s=t.__P)&&((n=zB({},r)).__v=r.__v+1,TB.vnode&&TB.vnode(n),nV(s,n,r,t.__n,s.namespaceURI,32&r.__u?[i]:null,a,i??GB(r),!!(32&r.__u),o,s.ownerDocument),n.__v=r.__v,n.__.__k[n.__i]=n,iV(a,n,o),n.__e!=i&&KB(n)));kB=0}function YB(e,t,n,r,i,a,o,s,c,l,u,d){var f,p,m,h,g,_,v,y=r&&r.__k||IB,b=t.length;for(c=XB(n,t,y,c,b),f=0;f<b;f++)(m=n.__k[f])!=null&&(p=m.__i==-1?FB:y[m.__i]||FB,m.__i=f,_=nV(e,m,p,i,a,o,s,c,l,u,d),h=m.__e,m.ref&&p.ref!=m.ref&&(p.ref&&sV(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=ZB(m,c,e,v):typeof m.type==`function`&&_!==void 0?c=_:h&&(c=h.nextSibling),m.__u&=-7);return n.__e=g,c}function XB(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?HB(null,o,null,null,null):LB(o)?HB(UB,{children:o},null,null,null):o.constructor==null&&o.__b>0?HB(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=QB(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=GB(s)),cV(s,s));return r}function ZB(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=ZB(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=GB(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function QB(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&(2&l.__u)==0;if(l===null&&e.key==null||u&&s==l.key&&c==l.type)return n;if(r>+!!u){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])!=null&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function $B(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n??``}function eV(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||$B(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||$B(e.style,t,n[t])}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(jB,`$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=MB,e.addEventListener(t,a?PB:NB,a)):e.removeEventListener(t,a?PB:NB,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 tV(e){return function(t){if(this.__l){var n=this.__l[t.type+e];if(t.u==null)t.u=MB++;else if(t.u<n.l)return;return n(TB.event?TB.event(t):t)}}}function nV(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k,A,j,M=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=TB.__b)&&d(t);n:if(typeof M==`function`)try{if(v=t.props,y=`prototype`in M&&M.prototype.render,b=(d=M.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 M(v,x):(t.__c=f=new WB(v,x),f.constructor=M,f.render=lV),b&&b.sub(f),f.props=v,f.state||={},f.context=x,f.__n=r,p=!0,f.__g|=8,f.__h=[],f._sb=[]),y&&f.__s==null&&(f.__s=f.state),y&&M.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=zB({},f.__s)),zB(f.__s,M.getDerivedStateFromProps(v,f.__s))),m=f.props,h=f.state,f.__v=t,p)y&&M.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),y&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(y&&M.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=TB.__r,w=0,y){for(f.state=f.__s,f.__g&=-9,C&&C(t),d=f.render(f.props,f.state,f.context),T=0;T<f._sb.length;T++)f.__h.push(f._sb[T]);f._sb=[]}else do f.__g&=-9,C&&C(t),d=f.render(f.props,f.state,f.context),f.state=f.__s;while(8&f.__g&&++w<25);f.state=f.__s,f.getChildContext!=null&&(r=zB({},r,f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),E=d,d!=null&&d.type===UB&&d.key==null&&(E=aV(d.props.children)),s=YB(e,LB(E)?E:[E],t,n,r,i,a,o,s,c,l,u),t.__u&=-161,f.__h.length&&o.push(f),_&&(f.__g&=-4)}catch(e){if(t.__v=null,c||a!=null)if(e.then){for(D=0,O=!1,t.__u|=c?160:128,t.__c.__z=[],k=0;k<a.length;k++)(A=a[k])==null||O||(A.nodeType==8&&A.data==`$s`?(D>0&&t.__c.__z.push(A),D++,a[k]=null):A.nodeType==8&&A.data==`/$s`?(--D>0&&t.__c.__z.push(A),O=D===0,s=a[k],a[k]=null):D>0&&(t.__c.__z.push(A),a[k]=null));if(!O){for(;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;a[a.indexOf(s)]=null,t.__c.__z=[s]}t.__e=s}else{for(j=a.length;j--;)BB(a[j]);rV(t)}else t.__e=n.__e,t.__k=n.__k,e.then||rV(t);TB.__e(e,t,n)}else s=t.__e=oV(n.__e,t,n,r,i,a,o,c,l,u);return(d=TB.diffed)&&d(t),128&t.__u?void 0:s}function rV(e){e&&e.__c&&(e.__c.__g|=4),e&&e.__k&&e.__k.forEach(rV)}function iV(e,t,n){for(var r=0;r<n.length;r++)sV(n[r],n[++r],n[++r]);TB.__c&&TB.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){TB.__e(e,t.__v)}})}function aV(e){return typeof e!=`object`||!e||e.__b&&e.__b>0?e:LB(e)?e.map(aV):zB({},e)}function oV(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&&=(TB.__m&&TB.__m(t,a),!1),a=null}if(b==null)v===y||s&&e.data==y||(e.data=y);else{if(a&&=RB.call(e.childNodes),v=n.props||FB,!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;eV(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&&!_||eV(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=``),YB(b==`template`?e.content:e,LB(p)?p:[p],t,n,r,b==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&GB(n,0),s,c,l),a!=null)for(u=a.length;u--;)BB(a[u]);s||(u=`value`,b==`progress`&&h==null?e.removeAttribute(`value`):h==null||h===e[u]&&(b!==`progress`||h)||eV(e,u,h,v[u],i),u=`checked`,g!=null&&g!=e[u]&&eV(e,u,g,v[u],i))}return e}function sV(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){TB.__e(e,n)}}function cV(e,t,n){var r,i;if(TB.unmount&&TB.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||sV(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){TB.__e(e,t)}r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&cV(r[i],t,n||typeof e.type!=`function`);n||BB(e.__e),e.__e&&e.__e.__l&&(e.__e.__l=null),e.__e=e.__c=e.__=null}function lV(e,t,n){return this.constructor(e,n)}function uV(e,t){var n,r,i,a;t==document&&(t=document.documentElement),TB.__&&TB.__(e,t),r=(n=!!(e&&32&e.__u))?null:t.__k,e=t.__k=VB(UB,null,[e]),i=[],a=[],nV(t,e,r||FB,FB,t.namespaceURI,r?null:t.firstChild?RB.call(t.childNodes):null,i,r?r.__e:t.firstChild,n,a,t.ownerDocument),iV(i,e,a)}function dV(e,t){e.__u|=32,uV(e,t)}TB={__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 kB=0,e}},EB=0,WB.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=zB({},this.state);typeof e==`function`&&(e=e(zB({},n),this.props)),e&&zB(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),qB(this))},WB.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),qB(this))},WB.prototype.render=UB,DB=[],kB=0,AB=function(e,t){return e.__v.__b-t.__v.__b},jB=/(PointerCapture)$|Capture$/i,MB=0,NB=tV(!1),PB=tV(!0);var fV=0;Array.isArray;function pV(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:--fV,__i:-1,__u:0,__source:i,__self:a};return TB.vnode&&TB.vnode(l),l}var mV=16,hV=16,gV={};function _V({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}=gV[e]??{width:mV,height:hV},f=r??l,p=i??u,m=a??d??`0 0 ${l} ${u}`;return pV(`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:pV(`use`,{href:c})})}var vV=e=>{if(e.length<2)return[e,``];let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]},yV=e=>{if(e.length<4)return[e,``];let t=e.lastIndexOf(`.`)+1,n=e.length-t>10,r=t>=1&&!n?t:Math.ceil(e.length/2);return[e.slice(0,r),e.slice(r)]},bV=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)]},xV=(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)]},SV=(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)]},CV=(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 wV({children:e,marker:t,variant:n=`default`}){"use no memo";return pV(`div`,{"aria-hidden":!0,"data-truncate-marker-cell":!0,children:pV(`div`,{"data-truncate-marker":!0,children:typeof t==`function`?t({children:e}):n===`fade`?pV(`span`,{"data-truncate-fade":!0}):t})})}function TV(e){"use no memo";let{mode:t,children:n}=e;return pV(`div`,{children:[pV(`div`,{"data-truncate-content":`visible`,children:t===`fruncate`?pV(`span`,{children:n}):n}),pV(`div`,{"data-truncate-content":`overflow`,"aria-hidden":!0,children:t===`fruncate`?pV(`span`,{children:n}):n})]})}function EV({children:e,mode:t=`truncate`,marker:n=`…`,variant:r=`default`,...i}){"use no memo";let a=pV(TV,{mode:t,children:e},`content`),o=pV(wV,{marker:n,mode:t,variant:r},`marker`),s=pV(`div`,{"data-truncate-fill":!0},`fill`);return pV(`div`,{"data-truncate-container":t,"data-truncate-variant":r,...i,children:pV(`div`,{"data-truncate-grid":!0,children:t===`truncate`?[a,o]:[o,a,s]})})}function DV({children:e,...t}){"use no memo";return pV(EV,{mode:`truncate`,...t,children:e})}function OV({children:e,...t}){"use no memo";return pV(EV,{mode:`fruncate`,...t,children:e})}function kV({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=pV(DV,{...s,children:t[0]}),l=pV(OV,{...s,children:t[1]})}else{if(typeof e!=`string`)return console.error(`MiddleTruncate: children must be a string`),null;if(e.length===0)return pV(`div`,{className:a,style:o});if(e.length<i)return pV(n===`end`?OV:DV,{...s,className:a,style:o,children:e});let t=null,u=null,d=null;if(typeof r==`string`)r===`center`?t=vV:r===`extension`?t=yV:r===`leaf-path`&&(t=bV);else if(typeof r==`number`)t=xV,u=r;else if(Array.isArray(r)){let[e,n]=r;d=n,e===`last`?t=SV:e===`first`&&(t=CV)}else typeof r==`function`&&(t=r);t??=vV;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=pV(DV,{...s,..._,children:f}),l=pV(OV,{...s,...v,children:p})}return pV(`div`,{"data-truncate-group-container":`middle`,className:a,style:o,children:[pV(`div`,{"data-truncate-segment-priority":n===`start`||n===`equal`?`1`:`2`,children:c}),pV(`div`,{"data-truncate-segment-priority":n===`end`||n===`equal`?`1`:`2`,children:l})]})}var AV={endIndex:-1,startIndex:-1};function jV(e,t,n){return Math.min(Math.max(e,t),n)}function MV(e,t){return e<0||t<e?AV:{endIndex:t,startIndex:e}}function NV(e){return e.startIndex<0||e.endIndex<e.startIndex}function PV(e,t){return NV(e)?0:(e.endIndex-e.startIndex+1)*t}function FV(e,t,n){if(t<=0)return-1;let r=t*n;return e<=0?0:e>=r?t:Math.floor(e/n)}function IV(e,t,n){return t<=0||e<=0?-1:e>=t*n?t-1:Math.ceil(e/n)-1}function LV(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 RV(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 zV(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 BV(e,t,n){if(e.length===0||t<=0)return[];let r=zV(e),i=LV(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=RV(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 VV(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=jV(t.scrollTop,0,o),c=t.stickyRows??BV(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=FV(s,n,t.itemHeight),m=FV(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?AV:MV(m,IV(u+d,n,t.itemHeight)),y=g+1,b=NV(v)?AV:MV(Math.max(y,v.startIndex-a),Math.min(n-1,v.endIndex+a)),x=PV(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:NV(b)?0:b.startIndex*t.itemHeight,startIndex:b.startIndex}}}var HV={added:`A`,deleted:`D`,ignored:null,modified:`M`,renamed:`R`,untracked:`U`},UV={added:`Git status: added`,deleted:`Git status: deleted`,ignored:`Git status: ignored`,modified:`Git status: modified`,renamed:`Git status: renamed`,untracked:`Git status: untracked`},WV=`Contains git status items`;function GV(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 KV(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,offset:i,topInset:a=0,totalHeight:o,viewportHeight:s}=e;if(i===`nearest`)return GV({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 qV(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 JV(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 YV(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 XV(e,t){if(e==null)return t;let n=e.getBoundingClientRect().height;return n>0?n:e.clientHeight>0?e.clientHeight:t}function ZV(e,t){return e!=null&&e>0?e:t}function QV(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 $V(e,t,n,r,i=0){let a=GV({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,topInset:i,viewportHeight:r});return a==null?!1:(e.scrollTop=a,!0)}function eH(e,t,n,r,i,a,o=0){let s=KV({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,offset:a,topInset:o,totalHeight:i,viewportHeight:r});return s==null?!1:(e.scrollTop=s,!0)}function tH(e,t,n,r,i,a){let o=qV({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,targetViewportOffset:a,totalHeight:i,viewportHeight:r});return o==null?!1:(e.scrollTop=o,!0)}function nH(e,t,n,r){return n.end<n.start?null:e<n.start?-t:e>n.end?r:null}function rH(e){let{renamingPath:t,previousRenamingPath:n,hasRenderedInput:r}=e;return t==null?`reset`:r?n===t?`ignore`:`focus-input`:`reveal-canonical`}function iH({ariaLabel:e,isFlattened:t=!1,ref:n,value:r,onBlur:i,onInput:a}){return pV(`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 aH(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 oH(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 sH,cH,lH,uH,dH=Object.is,fH=0,pH=[],mH=TB,hH=mH.__b,gH=mH.__r,_H=mH.diffed,vH=mH.__c,yH=mH.unmount,bH=mH.__;function xH(e,t){mH.__h&&mH.__h(cH,e,fH||t),fH=0;var n=cH.__H||={__:[],__h:[]};return e>=n.__.length&&n.__.push({}),n.__[e]}function SH(e){return fH=1,CH(FH,e)}function CH(e,t,n){var r=xH(sH++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):FH(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);dH(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=cH,!cH.__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,dH(t,e.__[0])||(o=!0)}}),a&&a.call(this,e,t,n)||o};cH.__f=!0;var a=cH.shouldComponentUpdate,o=cH.componentWillUpdate;cH.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)},cH.shouldComponentUpdate=i}return r.__N||r.__}function wH(e,t){var n=xH(sH++,3);!mH.__s&&PH(n.__H,t)&&(n.__=e,n.u=t,cH.__H.__h.push(n))}function TH(e,t){var n=xH(sH++,4);!mH.__s&&PH(n.__H,t)&&(n.__=e,n.u=t,cH.__h.push(n))}function EH(e){return fH=5,DH(function(){return{current:e}},[])}function DH(e,t){var n=xH(sH++,7);return PH(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function OH(e,t){return fH=8,DH(function(){return e},t)}function kH(){for(var e;e=pH.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(MH),e.__H.__h.forEach(NH),e.__H.__h=[]}catch(t){e.__H.__h=[],mH.__e(t,e.__v)}}mH.__b=function(e){cH=null,hH&&hH(e)},mH.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),bH&&bH(e,t)},mH.__r=function(e){gH&&gH(e),sH=0;var t=(cH=e.__c).__H;t&&(lH===cH?(t.__h=[],cH.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(MH),t.__h.forEach(NH),t.__h=[],sH=0)),lH=cH},mH.diffed=function(e){_H&&_H(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(pH.push(t)!==1&&uH===mH.requestAnimationFrame||((uH=mH.requestAnimationFrame)||jH)(kH)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),lH=cH=null},mH.__c=function(e,t){t.some(function(e){try{e.__h.forEach(MH),e.__h=e.__h.filter(function(e){return!e.__||NH(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],mH.__e(n,e.__v)}}),vH&&vH(e,t)},mH.unmount=function(e){yH&&yH(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{MH(e)}catch(e){t=e}}),n.__H=void 0,t&&mH.__e(t,n.__v))};var AH=typeof requestAnimationFrame==`function`;function jH(e){var t,n=function(){clearTimeout(r),AH&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);AH&&(t=requestAnimationFrame(n))}function MH(e){var t=cH,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),cH=t}function NH(e){var t=cH;e.__c=e.__(),cH=t}function PH(e,t){return!e||e.length!==t.length||t.some(function(t,n){return!dH(t,e[n])})}function FH(e,t){return typeof t==`function`?t(e):t}function IH(e,t=null,n=null){"use no memo";let r=e.flattenedSegments;return r==null||r.length===0?t??e.name:pV(`span`,{"data-item-flattened-subitems":!0,children:r.map((e,i)=>{let a=i===r.length-1;return pV(UB,{children:[pV(`span`,{"data-item-flattened-subitem":e.path,"data-item-flattened-subitem-drag-target":n===e.path?`true`:void 0,children:a&&t!=null?t:pV(DV,{children:e.name})}),i<r.length-1?` / `:``]},e.path)})})}function LH(e){return e.isFlattened?e.flattenedSegments?.findLast(e=>e.isTerminal)?.path??e.path:e.path}function RH(e){let t=e.flattenedSegments;return t==null||t.length===0?e.name:t.map(e=>e.name).join(` / `)}function zH(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 BH({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=VV(c,{itemHeight:t,overscan:n,scrollTop:r,stickyRows:s==null?void 0:zH(s,r,t,o),totalRowCount:o,viewportHeight:a}),u=i&&r<=0&&o>0?e.getStickyRowCandidates(1,t):[],d=u!=null&&r<=0?zH(u,1,t,o):i&&r<=0&&c.length>0?BV(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 VH=400,HH=10,UH=40,WH=18;function GH(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))?KH(e,t,n):a instanceof HTMLElement?a:null}function KH(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 qH(e){let t=e?.closest?.(`[data-type="item"]`);if(!(t instanceof HTMLElement))return e?.closest?.(`[data-file-tree-virtualized-scroll]`)instanceof HTMLElement?{directoryPath:null,flattenedSegmentPath:null,hoveredPath:null,kind:`root`}: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 JH(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 YH(){return navigator.vendor!==`Apple Computer, Inc.`}function XH(e,t){let n=e-t.top;if(n<UH)return-Math.ceil((UH-Math.max(0,n))/UH*WH);let r=t.bottom-e;return r<UH?Math.ceil((UH-Math.max(0,r))/UH*WH):0}function ZH(e,t){if(e!=null){let t=HV[e];return t==null?null:{text:t,title:UV[e]}}return t?{icon:{name:`file-tree-icon-dot`,width:6,height:6},title:WV}:null}function QH(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 $H(e){return e!=null&&`toggle`in e}function eU(e){return e.code===`Space`||e.key===` `||e.key===`Spacebar`}function tU(e){return e.key.length===1&&/^[\p{L}\p{N}]$/u.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey}function nU(e){return e==null?``:`[data-item-section="spacing-item"][data-ancestor-path="${e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}"] { opacity: 1; }`}function rU(e){return e.shiftKey&&e.key===`F10`||e.key===`ContextMenu`}function iU(e,t){return t&&rU(e)||(e.ctrlKey||e.metaKey)&&eU(e)?!0:e.key===`ArrowDown`||e.key===`ArrowLeft`||e.key===`ArrowRight`||e.key===`ArrowUp`}var aU=new Set([`ArrowDown`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`]);function oU(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 sU(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 cU(e,t){return{bottom:t,height:0,left:e,right:e,top:t,width:0,x:e,y:t}}function lU(e,t){if(e==null)return t.offsetTop;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.top-r.top}function uU(e,t,n){if(n==null){e.delete(t);return}e.set(t,n)}function dU(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 fU(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 pU(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 mU(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=pU(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 hU(e,t){return{kind:e.kind,name:RH(e),path:t}}function gU(e){return e==null?void 0:`${e}__tree`}function _U(e,t,n){if(e!=null)return`${e}__focused-item-${encodeURIComponent(t)}${n?`__parked`:``}`}function vU(e){return e===`file-tree-icon-chevron`||e===`file-tree-icon-dot`||e===`file-tree-icon-file`||e===`file-tree-icon-lock`}function yU(e,t){if(e==null)return null;if(`text`in e)return pV(`span`,{title:e.title,children:e.text});let n=typeof e.icon==`string`?vU(e.icon)?t(e.icon):{name:e.icon}:vU(e.icon.name)?(()=>{let n=t(e.icon.name),{name:r,...i}=e.icon;return{...n,...i}})():e.icon;return pV(`span`,{title:e.title,children:pV(_V,{...n})})}function bU(e){e!=null&&JV(e.querySelector([`button:not([disabled])`,`[href]`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`, `))??e)}function xU(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=LH(e);return pV(UB,{children:[e.depth>0?pV(`div`,{"data-item-section":`spacing`,children:Array.from({length:e.depth}).map((t,n)=>pV(`div`,{"data-item-section":`spacing-item`,"data-ancestor-path":e.ancestorPaths[n]},n))}):null,pV(`div`,{"data-item-section":`icon`,children:e.kind===`directory`?pV(_V,{...t(`file-tree-icon-chevron`)}):pV(_V,{...t(`file-tree-icon-file`,u)})}),pV(`div`,{"data-item-section":`content`,children:e.isFlattened?IH(e,c,a):c??pV(kV,{minimumLength:5,split:`extension`,children:e.name})}),i?pV(`div`,{"data-item-section":`decoration`,children:r==null?null:yU(r,t)}):null,s?pV(`div`,{"data-item-section":`git`,children:yU(o,t)}):null,n?pV(`div`,{"data-item-section":`action`,children:l?pV(`span`,{"aria-hidden":`true`,"data-item-action-affordance":`decorative`,children:pV(_V,{...t(`file-tree-icon-ellipsis`)})}):null}):null]})}function SU(e,t,n,r={}){let{controller:i,renameView:a,visualFocusPath:o,contextHoverPath:s,draggedPathSet:c,dragTarget:l,dragAndDropEnabled:u,shouldSuppressContextMenu:d,handleRowDragStart:f,handleRowDragEnd:p,handleRowTouchStart:m,instanceId:h,itemHeight:g,gitStatusByPath:_,ignoredGitDirectories:v,ignoredInheritanceCache:y,directoriesWithGitChanges:b,gitLaneActive:x,contextMenuEnabled:S,contextMenuTriggerMode:C,contextMenuButtonTriggerEnabled:w,contextMenuButtonVisibility:T,contextMenuRightClickEnabled:E,registerRenameInput:D,registerButton:O,resolveIcon:k,renderDecorationForRow:A,openContextMenuForRow:j,onRowClick:M,onKeyDown:N}=e,P=LH(t),{isParked:F=!1,mode:I=`flow`,style:L}=r,R=I===`sticky`,z=_?.get(P)??null??QH(t.ancestorPaths,v,y),B=t.kind===`directory`&&(b?.has(P)??!1),V=A(t,P),H=ZH(z,B),U=S&&w,W=V!=null||x||U,G=U&&T===`always`,K=a.getPath()===P,q=K?a.getValue():``,J=R||!K?null:pV(iH,{ref:D,ariaLabel:`Rename ${RH(t)}`,isFlattened:t.isFlattened,value:q,onBlur:()=>{a.commit()},onInput:e=>{a.setValue(e.currentTarget.value)}}),ee=xU(t,k,{actionLaneEnabled:U,customDecoration:V,decorationLaneEnabled:W,dragTargetFlattenedSegmentPath:l?.flattenedSegmentPath??null,gitDecoration:H,gitLaneActive:x,renameInput:J,showDecorativeActionAffordance:G}),te={...aH({ariaLabel:RH(t),domId:t.isFocused?_U(h,P,F):void 0,extraStyle:L,features:{actionLaneEnabled:U,contextMenuButtonVisibility:U?T:null,contextMenuEnabled:S,contextMenuTriggerMode:S?C:null,gitLaneActive:x},isParked:F,itemHeight:g,mode:I,row:t,state:{containsGitChange:B,effectiveGitStatus:z,isContextHovered:s===P,isDragTarget:l?.kind===`directory`&&l.directoryPath===P,isDragging:c?.has(P)===!0,isFocusRinged:t.isFocused&&o===P},targetPath:P}),key:n,onContextMenu:S||u?e=>{if(d()){e.preventDefault();return}S&&(e.preventDefault(),E&&(i.focusMountedPathFromInput(P),j(t,P,{anchorRect:cU(e.clientX,e.clientY),source:`right-click`})))}:void 0,onFocus:R?void 0:()=>{i.focusMountedPathFromInput(P)},onKeyDown:R?void 0:N,ref:e=>{O(P,e)}};return!R&&K?pV(`div`,{...te,children:ee}):pV(`button`,{...te,type:`button`,draggable:u&&!F,onDragEnd:u&&!F?p:void 0,onDragStart:u&&!F?e=>{f(e,t,P)}:void 0,onMouseDown:e=>{if(R){e.preventDefault();return}i.isSearchOpen()&&e.preventDefault()},onTouchStart:u&&!F?e=>{m(e,t,P)}:void 0,onClick:e=>{M(e,t,P,I)},children:ee})}function CU(e,t,n){return t.end<t.start?[]:e.controller.getVisibleRows(t.start,t.end).filter(e=>!n.has(LH(e))).map((n,r)=>SU(e,n,t.start+r))}function wU({composition:e,controller:t,gitStatusByPath:n,ignoredGitDirectories:r,directoriesWithGitChanges:i,icons:a,instanceId:o,itemHeight:s=Sz,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 _=EH(null),v=EH(null),y=EH(!1),b=EH(null),x=EH(null),S=EH(null),C=EH(null),w=EH(null),T=EH(new Map),E=EH(new Map),D=EH(()=>{}),O=EH(null),k=EH(0),A=EH(!1),j=EH(null);j.current!==t&&(A.current=!1,j.current=t);let M=EH(!1),N=EH(null),P=EH(null),F=EH(!1),I=EH(null),L=EH(null),R=EH(null),z=EH(null),B=EH(null),V=EH(null),H=EH(null),U=EH(null),W=EH(!1),G=EH(null),K=EH(null),q=EH(null),J=EH(null),ee=DH(()=>new Map,[]),[,te]=SH(0),[ne,re]=SH(null),[Y,ie]=SH(null),[ae,oe]=SH(null),[se,ce]=SH(null),[le,ue]=SH(0),[de,fe]=SH(null),pe=EH(de);pe.current=de;let me=EH(null),he=EH(null),ge=EH(null),_e=EH(null),ve=EH(null),ye=EH(!1),be=()=>{he.current=null,ge.current=null,_e.current=null},xe=(e,t)=>{he.current=e,ge.current=null,_e.current=t==null?null:{path:e,scrollTop:t}},Se=(e,t)=>{he.current=null,ge.current={path:e,viewportOffset:t},_e.current=null},Ce=EH(d===`retain`&&t.isSearchOpen()),[we,Te]=SH(p);wH(()=>{p||Te(!1)},[p]);let Ee=EH(!1),De=OH(()=>{Ee.current=!0,Te(e=>e&&!1)},[]),[Oe,ke]=SH(()=>BH({controller:t,itemHeight:s,overscan:c,scrollTop:0,stickyFolders:h,viewportHeight:g})),[Ae,je]=SH(!1);wH(()=>{je(!0)},[]);let Me=e?.contextMenu?.enabled===!0||e?.contextMenu?.render!=null||e?.contextMenu?.onOpen!=null||e?.contextMenu?.onClose!=null,Ne=e?.contextMenu?.triggerMode??(Me?`right-click`:`both`),Pe=Ne===`both`||Ne===`button`,Fe=e?.contextMenu?.buttonVisibility??`when-needed`,Ie=Ne===`both`||Ne===`right-click`;TH(()=>{let e=S.current;if(e==null)return;let t=e=>{if(!(e instanceof CustomEvent))return;let t=e.detail?.path??null;ve.current=t,ie(t),ce(t==null?null:`pointer`)},n=e=>{e instanceof CustomEvent&&(ye.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 Le=OH((e,t)=>{uU(T.current,e,t)},[]),Re=OH((e,t)=>{uU(E.current,e,t)},[]),ze=OH(e=>{x.current=e},[]),Be=OH(e=>dU(e,E.current,T.current),[]),Ve=n!=null||r!=null||i!=null,{resolveIcon:He}=DH(()=>NF(a),[a]),Ue=t[pB](),We=Ue.getPath(),Ge=We!=null,Ke=t.isSearchOpen(),qe=t.getSearchValue(),Je=t.getFocusedPath(),Ye=t.getFocusedIndex(),Xe=t.getScrollRequest(),Ze=t.isDragAndDropEnabled(),Qe=t.getDragSession(),$e=DH(()=>Qe==null?null:new Set(Qe.draggedPaths),[Qe]),et=Qe?.target??null,tt=Qe?.primaryPath??null,nt=gU(o),{overlayHeight:rt,overlayRows:it,snapshot:at,visibleRows:ot}=Oe,st=at.physical.viewportHeight,ct=DH(()=>({end:at.window.endIndex,start:at.window.startIndex}),[at.window.endIndex,at.window.startIndex]),lt=it,ut=at.sticky.rows,dt=at.physical.totalHeight,ft=at.sticky.height,pt=DH(()=>new Set(ut.map(e=>LH(e.row))),[ut]),mt=Ye>=0&&Ye>=ct.start&&Ye<=ct.end,ht=OH((e,t)=>u?.({item:hU(e,t),row:e})??null,[u]),gt=OH(e=>JV(e==null?null:T.current.get(e)??null)?!0:JV(S.current),[]),_t=OH(e=>{gt(t.focusNearestPath(e))},[t,gt]),vt=EH(_t);vt.current=_t;let yt=EH(!0),bt=EH(()=>{}),xt=OH((t=!0)=>{let n=pe.current;n!=null&&(yt.current=yt.current&&t,fe(null),e?.contextMenu?.onClose?.(),yt.current&&_t(n.path))},[e?.contextMenu,_t]);bt.current=xt;let St=OH(e=>{let t=e==null?null:lU(S.current,e);oe(e=>e===t?e:t)},[]),Ct=OH((e,n,r)=>{let i=t.getItem(n);if(i==null)return;let a=Be(n);if(a?.dataset.fileTreeStickyRow===`true`){let e=C.current;xe(n,e?.scrollTop??null),M.current=!0,re(e=>e===n?e:n)}i.focus(),St(a),yt.current=!0,fe({anchorRect:r?.anchorRect??null,item:hU(e,n),path:n,source:r?.source??`keyboard`})},[t,Be,St]),wt=OH(e=>{if(l){if(t.isSearchOpen()){let e=C.current,t=XV(e,st);I.current=Ye<0||e==null?null:Math.max(0,Math.min(Ye*s-e.scrollTop,Math.max(0,t-s))),F.current=!0}t.startRenaming(e)!==!1&&(ce(`focus`),te(e=>e+1))}},[t,Ye,s,l,st]),Tt=OH((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=XV(i,st),u=t.getVisibleCount()*s,d=r===`sticky-parents`?o.ancestorPaths.length*s:BH({controller:t,itemHeight:s,overscan:c,scrollTop:i.scrollTop,stickyFolders:h,viewportHeight:l}).snapshot.sticky.height;return M.current=!0,tH(i,a,s,l,u,d),D.current(),me.current=n?e:null,!0},[t,s,c,st,h]),Et=()=>y.current===!0||J.current!=null||W.current===!0,Dt=e=>typeof window.requestAnimationFrame==`function`?window.requestAnimationFrame(()=>{e()}):window.setTimeout(e,16),Ot=e=>{if(e!=null){if(typeof window.cancelAnimationFrame==`function`){window.cancelAnimationFrame(e);return}window.clearTimeout(e)}},kt=()=>{z.current!=null&&(clearTimeout(z.current),z.current=null),R.current=null},At=()=>{V.current?.remove(),V.current=null},jt=()=>{Ot(L.current),L.current=null,B.current=null},Mt=e=>{let t=S.current?.getRootNode();if(t instanceof ShadowRoot){t.append(e);return}document.body.append(e)},Nt=()=>{U.current?.(),U.current=null,J.current!=null&&(clearTimeout(J.current),J.current=null),W.current=!1,G.current=null,q.current=null,K.current!=null&&(K.current.setAttribute(`draggable`,`true`),K.current.style.removeProperty(`touch-action`),K.current=null),At(),kt(),jt(),H.current=null},Pt=(e,n)=>{let r=S.current?.getRootNode(),i=qH(GH(r instanceof ShadowRoot?r:document,e,n));return t.setDragTarget(i),t.getDragSession()?.target??null},Ft=e=>{let n=t.getDragAndDropConfig()?.openOnDropDelay??800;if(e==null||e.kind!==`directory`||e.directoryPath==null||n<=0){kt();return}let r=t.getItem(e.directoryPath),i=$H(r)?r:null;if(i==null||i.isExpanded()){kt();return}let a=`${e.directoryPath}::${e.flattenedSegmentPath??``}`;R.current!==a&&(kt(),R.current=a,z.current=setTimeout(()=>{let n=t.getDragSession()?.target;n?.kind!==`directory`||n.directoryPath!==e.directoryPath||n.flattenedSegmentPath!==e.flattenedSegmentPath||i.expand()},n))},It=()=>{L.current=null;let e=B.current,n=C.current;if(e==null||n==null||t.getDragSession()==null)return;let r=n.getBoundingClientRect(),i=XH(e.clientY,r);if(i===0)return;let a=Math.max(0,n.scrollHeight-n.clientHeight),o=Math.max(0,Math.min(a,n.scrollTop+i));o!==n.scrollTop&&(n.scrollTop=o,D.current()),Ft(Pt(e.clientX,e.clientY)),L.current=Dt(It)},Lt=(e,t)=>{B.current={clientX:e,clientY:t},L.current??=Dt(It)},Rt=(e,n,r)=>{let i=e.currentTarget;if(i!=null){if(Nt(),At(),kt(),jt(),t.startDrag(r)===!1){e.preventDefault();return}if(H.current=n,e.dataTransfer!=null&&(e.dataTransfer.effectAllowed=`move`,e.dataTransfer.dropEffect=`move`,e.dataTransfer.setData(`text/plain`,r),YH())){let t=JH(i),n=i.getBoundingClientRect();Object.assign(t.style,{height:`${n.height}px`,opacity:`0.85`,transform:`translate3d(-9999px, 0px, 0)`,width:`${n.width}px`}),Mt(t),V.current=t,e.dataTransfer.setDragImage(t,Math.max(0,e.clientX-n.left),Math.max(0,e.clientY-n.top))}}},zt=()=>{At(),kt(),jt(),H.current=null,t.cancelDrag()},Bt=(e,n,r)=>{if(J.current!=null||W.current)return;let i=e.touches[0],a=e.currentTarget;if(i==null||a==null)return;q.current={clientX:i.clientX,clientY:i.clientY},K.current=a,a.setAttribute(`draggable`,`false`);let o=(e={})=>{let t=e.restoreNativeDraggable??!W.current;J.current!=null&&(clearTimeout(J.current),J.current=null),document.removeEventListener(`touchmove`,s),document.removeEventListener(`touchend`,c),document.removeEventListener(`touchcancel`,c),U.current===o&&(U.current=null),t&&(a.setAttribute(`draggable`,`true`),K.current===a&&(K.current=null),q.current=null)},s=e=>{let t=e.touches[0],n=q.current;if(t==null||n==null)return;let r=t.clientX-n.clientX,i=t.clientY-n.clientY;r*r+i*i<=HH*HH||o()},c=()=>{o()};document.addEventListener(`touchmove`,s,{passive:!0}),document.addEventListener(`touchend`,c),document.addEventListener(`touchcancel`,c),U.current=o,J.current=setTimeout(()=>{if(o({restoreNativeDraggable:!1}),t.startDrag(r)===!1){a.setAttribute(`draggable`,`true`),K.current===a&&(K.current=null),q.current=null;return}W.current=!0,K.current=a,a.setAttribute(`draggable`,`false`),a.style.setProperty(`touch-action`,`none`),H.current=n;let e=a.getBoundingClientRect(),s=JH(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`}),Mt(s),V.current=s,G.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=G.current;n!=null&&V.current!=null&&(V.current.style.transform=`translate3d(${t.clientX-n.x}px, ${t.clientY-n.y}px, 0)`),Ft(Pt(t.clientX,t.clientY)),Lt(t.clientX,t.clientY)},l=e=>{let n=e.changedTouches[0];n!=null&&Pt(n.clientX,n.clientY),t.completeDrag(),Nt()},u=()=>{t.cancelDrag(),Nt()};U.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)},VH)},Vt=e=>{if(de!=null){if(e.key===`Escape`){xt(),e.preventDefault(),e.stopPropagation();return}aU.has(e.key)&&(e.preventDefault(),e.stopPropagation());return}if(Ue.isActive()){if(e.key===`Escape`)Ue.cancel();else if(e.key===`Enter`)Ue.commit();else return;ce(`focus`),te(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(l&&e.key===`F2`){wt(Je??void 0),e.preventDefault(),e.stopPropagation();return}if(Ke){if(e.key===`Escape`)F.current=!1,I.current=null,t.closeSearch();else if(e.key===`Enter`){let e=t.getFocusedPath();e!=null&&t.selectOnlyPath(e);let n=C.current,r=XV(n,st);I.current=Ye<0||n==null?null:Math.max(0,Math.min(Ye*s-n.scrollTop,Math.max(0,r-s))),F.current=!0,t.closeSearch()}else if(e.key===`ArrowDown`)t.focusNextSearchMatch();else if(e.key===`ArrowUp`)t.focusPreviousSearchMatch();else return;ce(`focus`),te(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(f&&tU(e)){t.openSearch(e.key),te(e=>e+1),e.preventDefault(),e.stopPropagation();return}let n=Me&&rU(e),r=iU(e,Me),i=r&&S.current!=null?YV(S.current):null,a=r?new Set(fU(S.current)):new Set,o=i?.dataset.fileTreeStickyPath??null,c=i?.dataset.fileTreeStickyRow===`true`&&o!=null;if(c&&o!==Je&&a.has(o)){let e=C.current;xe(o,e?.scrollTop??null),t.focusPath(o)}let u=t.getFocusedPath(),d=t.getFocusedIndex(),p=t.getFocusedItem();if(p==null)return;let m=$H(p)?p:null,h=u!=null&&(pt.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=dU(u,E.current,T.current);e==null||n==null?y=!1:Ct(e,u)}else if((e.ctrlKey||e.metaKey)&&eU(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;ce(`focus`);let b=t.getFocusedPath(),x=b!=null&&(pt.has(b)||a.has(b)),w=g&&b!==u,D=n&&c&&o===u&&b===u;if((h||D)&&b!=null&&(w&&x||D))xe(b,v?.scrollTop??null),M.current=!0,re(e=>e===b?e:b);else{let t=e.key===`ArrowUp`&&h&&b!==u;b!=null&&(t||_&&b===u)?(Se(b,mU(S.current,v,i,u,s,ft,st)),M.current=!0,re(e=>e===b?e:b)):be()}te(e=>e+1),e.preventDefault(),e.stopPropagation()};TH(()=>{if(!(!f||!Ke)){if(Ce.current){Ce.current=!1;return}JV(w.current)}},[Ke,f]),TH(()=>{let e=x.current;switch(rH({hasRenderedInput:e!=null,previousRenamingPath:P.current,renamingPath:We})){case`reset`:P.current=null;return;case`reveal-canonical`:We!=null&&Tt(We,{restoreTreeFocus:!1,targetOffset:`live-overlay`});return;case`ignore`:return;case`focus-input`:e!=null&&(me.current=null,P.current=We,JV(e),e.select());return}},[ct.end,ct.start,We,Tt,pt]),TH(()=>{let e=S.current;if(e==null)return;let t=null,n=()=>{t!=null&&(clearTimeout(t),t=null)},r=()=>{let t=YV(e)?.dataset.itemPath??null;re(e=>e===t?e:t)},i=()=>{n(),M.current=!0,r()},a=i=>{let a=i.relatedTarget;if(a==null){n(),t=setTimeout(()=>{if(t=null,YV(e)!=null){r();return}M.current=!1,re(null)},0);return}if(!(a instanceof Node)||!e.contains(a)){n(),M.current=!1,re(null);return}let o=a instanceof HTMLElement?a.dataset.itemPath??null:null;re(e=>e===o?e:o)};return e.addEventListener(`focusin`,i),e.addEventListener(`focusout`,a),()=>{n(),e.removeEventListener(`focusin`,i),e.removeEventListener(`focusout`,a)}},[]),TH(()=>{let e=S.current;e!=null&&(at.physical.scrollTop<=0?e.dataset.scrollAtTop=`true`:delete e.dataset.scrollAtTop)},[at.physical.scrollTop]),TH(()=>{let e=null,n=C.current,r=b.current,i=S.current;if(n==null)return;O.current=XV(n,g);let a=()=>{let e=t.getVisibleCount(),r=ZV(O.current,g),i=Math.max(0,e*s-r);n.scrollTop>i&&(n.scrollTop=i),ke(BH({controller:t,itemHeight:s,overscan:c,scrollTop:Math.min(n.scrollTop,i),stickyFolders:h,viewportHeight:r}))};if(!A.current){A.current=!0;let e=t.getFocusedIndex();if(e>=0){let r=ZV(O.current,g),i=t.getVisibleRows(e,e)[0]??null;$V(n,e,s,r,h&&i!=null?Math.max(0,Math.min(i.ancestorPaths.length*s,Math.max(0,r-s))):0)}}D.current=a;let o=!1,l=t.subscribe(()=>{o?te(e=>e+1):o=!0,a()}),u=()=>{ye.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,ue(e=>e+1),e=null},50))},d=null,f=()=>{i!=null&&delete i.dataset.overlayReveal,d!=null&&(clearTimeout(d),d=null)},p=()=>{i==null||ye.current===!0||n.scrollTop>0||(i.dataset.overlayReveal=`true`,d!=null&&clearTimeout(d),d=setTimeout(()=>{f()},200))},m=()=>{if(a(),n.scrollTop>0&&f(),pe.current!=null&&y.current&&bt.current(),ye.current===!0){y.current=!1;return}ie(e=>e==null?e:null),u()},_=()=>{u(),p()},v=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`PageUp`,`PageDown`,`Home`,`End`,` `,`Spacebar`]),x=e=>{v.has(e.key)&&_()};n.addEventListener(`scroll`,m,{passive:!0}),n.addEventListener(`wheel`,_,{passive:!0}),n.addEventListener(`touchmove`,_,{passive:!0}),n.addEventListener(`keydown`,x);let w=typeof ResizeObserver<`u`?new ResizeObserver(e=>{O.current=(e[0]==null?null:QV(e[0]))??XV(n,g),a()}):null;return w?.observe(n),()=>{D.current=()=>{},l(),n.removeEventListener(`scroll`,m),n.removeEventListener(`wheel`,_),n.removeEventListener(`touchmove`,_),n.removeEventListener(`keydown`,x),e!=null&&clearTimeout(e),d!=null&&clearTimeout(d),r!=null&&delete r.dataset.isScrolling,i!=null&&(delete i.dataset.isScrolling,delete i.dataset.overlayReveal),y.current=!1,O.current=null,w?.disconnect()}},[t,g,s,c,h]),TH(()=>{Me||de==null||xt(!1)},[xt,Me,de]);let Ht=DH(()=>de==null?null:`${de.path}::${de.source}`,[de]);TH(()=>{if(Ht==null){m?.clearSlotContent(TF);return}let t=pe.current;if(t==null)return;let n=v.current??_.current;if(n==null)return;let r={anchorElement:n,anchorRect:t.anchorRect??sU(n.getBoundingClientRect()),close:e=>{bt.current(e?.restoreFocus??!0)},restoreFocus:()=>{yt.current&&vt.current(pe.current?.path??null)}},i=e?.contextMenu?.render?.(t.item,r)??null;return m?.setSlotContent(TF,i),e?.contextMenu?.onOpen?.(t.item,r),bU(i),queueMicrotask(()=>{i==null||!i.isConnected||document.activeElement===i&&bU(i)}),()=>{m?.clearSlotContent(TF)}},[Ht,e?.contextMenu,m]),TH(()=>{de!=null&&t.getItem(de.path)==null&&xt()},[xt,de,t]),TH(()=>{if(de==null)return;let e=S.current?.getRootNode(),t=e instanceof ShadowRoot?e.host:S.current,n=e=>{let n=e.target;n instanceof Node&&(oU(e)||_.current?.contains(n)!==!0&&t?.contains(n)!==!0&&xt())},r=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),xt())};return document.addEventListener(`mousedown`,n,!0),document.addEventListener(`keydown`,r,!0),()=>{document.removeEventListener(`mousedown`,n,!0),document.removeEventListener(`keydown`,r,!0)}},[xt,de]),TH(()=>{let e=C.current,n=S.current;if(e==null||n==null){N.current=Je;return}let r=Je==null?null:T.current.get(Je)??null,i=YV(n),a=i?.dataset.itemPath??null,o=Ge&&x.current===i,c=f&&w.current===i,l=F.current&&!Ke,u=I.current??0,d=me.current,p=he.current,m=ge.current,g=_e.current,_=i!=null,v=M.current||_,y=N.current!==Je,b=p!=null&&p===Je&&Je!=null,E=!1,O=!1;if(Xe!=null&&Xe.id!==k.current){k.current=Xe.id;let n=Xe.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,st-s))):ft;E=!0,O=eH(e,n,s,st,dt,Xe.offset,t)}t.clearScrollRequest(Xe.id)}let A=!E&&l&&tH(e,Ye,s,st,dt,u),j=!E&&d!=null&&d===Je&&tH(e,Ye,s,st,dt,ft),P=!E&&m!=null&&m.path===Je&&tH(e,Ye,s,st,dt,m.viewportOffset),L=!E&&g!=null&&g.path===Je&&e.scrollTop!==g.scrollTop;if(L&&(e.scrollTop=g.scrollTop),(L||O||j||P||A||v&&y&&d!==Je&&!b&&$V(e,Ye,s,st,ft))&&D.current(),E){N.current=Je;return}if(!v){N.current=Je;return}if(o){N.current=Je;return}if(c&&!l){N.current=Je;return}if(r==null){l&&Ye>=0&&(tH(e,Ye,s,st,dt,u),D.current()),N.current=Je;return}(y||l||d===Je||p===Je||m?.path===Je||g?.path===Je||a==null||a!==Je)&&(JV(r),d===Je&&(me.current=null),p===Je&&(he.current=null),m?.path===Je&&(ge.current=null),g?.path===Je&&(_e.current=null),F.current=!1,I.current=null),N.current=Je},[t,Ye,Je,mt,s,Ge,Ke,ct,st,f,Xe,h,ft,dt,ot]);let Ut=Ye>=0&&Ye>=at.visible.startIndex&&Ye<=at.visible.endIndex,Wt=Je!=null&<.some(e=>LH(e.row)===Je),Gt=Ut||Wt,Kt=Pe&&M.current===!0&&Gt?Je:null,qt=se===`pointer`?Y:null,Jt=de?.path??ve.current??qt??Kt??Y,Yt=de?.source===`right-click`;TH(()=>{y.current&&de==null||St(Be(Jt))},[de,Be,ct,st,le,lt,Jt,St,ot]);let Xt=OH(e=>{if(y.current||oU(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&&ce(e=>e===`pointer`?e:`pointer`),ie(e=>e===i?e:i)},[]),Zt=OH(()=>{ie(null)},[]);TH(()=>{if(!Ze)return;let e=()=>{Nt(),t.cancelDrag()};return window.addEventListener(`dragend`,e),()=>{window.removeEventListener(`dragend`,e),Nt(),t.cancelDrag()}},[t,Ze]);let Qt=e=>{if(!Ze||t.getDragSession()==null||W.current)return;let n=qH(e.target instanceof HTMLElement?e.target:null);t.setDragTarget(n),Ft(t.getDragSession()?.target??null),Lt(e.clientX,e.clientY),e.dataTransfer!=null&&(e.dataTransfer.dropEffect=`move`),e.preventDefault()},$t=e=>{if(!Ze||t.getDragSession()==null||W.current)return;let n=e.relatedTarget;n instanceof Node&&S.current?.contains(n)===!0||(kt(),jt(),t.setDragTarget(null))},en=e=>{!Ze||t.getDragSession()==null||W.current||(e.preventDefault(),Pt(e.clientX,e.clientY),t.completeDrag(),At(),kt(),jt(),H.current=null)},tn=at.window.height,nn=at.window.offsetTop,rn=Math.min(0,st-tn),an=Math.min(0,st-tn-ft),on=ne===Je||F.current,sn=Je!=null&&on&&!mt&&Ye>=0?ot[Ye]??t.getVisibleRows(Ye,Ye)[0]??null:null,cn=sn==null?null:nH(Ye,s,ct,tn),ln=H.current,un=tt!=null&&ln!=null&&ln.path===tt&&ln.index>=ct.start&&ln.index<=ct.end,dn=tt!=null&&ln!=null&&ln.path===tt&&!un&&ln.path!==sn?.path?ln:null,fn=dn==null?null:nH(dn.index,s,ct,tn),pn=nU((Ye>=0?ot[Ye]??t.getVisibleRows(Ye,Ye)[0]??null:null)?.ancestorPaths.at(-1)??null),mn=Ke&&Je!=null?_U(o,Je,!mt):void 0,hn=de?.path??(Ke?Je:ne),gn=de?.path??Y,_n=Be(Jt),vn=Me&&Pe&&!Yt&&!Ge&&_n!=null&&ae!=null&&Jt!=null,yn=Me&&(vn||de!=null),bn=de?.anchorRect,xn=bn==null&&_n!=null&&ae!=null&&(de!=null||vn)?ae:null,Sn=bn==null?xn==null?void 0:{top:`${xn}px`}:{left:`${bn.left}px`,position:`fixed`,right:`auto`,top:`${bn.top}px`},Cn=Yt?{opacity:`0`}:void 0,wn=OH((e,n,r,i)=>{let a=oH({event:{ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey},isDirectory:n.kind===`directory`,isSearchOpen:Ke,mode:i}),o=a.toggleDirectory&&n.kind===`directory`,s=o?t.resolveMountedDirectoryPathFromInput(r):null;if(o&&s==null)return;let c=s??r;switch(a.selection.kind){case`range`:t.selectPathRange(c,a.selection.additive);break;case`toggle`:t.togglePathSelectionFromInput(c);break;case`single`:t.selectOnlyMountedPathFromInput(c);break}let l=e.currentTarget instanceof HTMLElement?e.currentTarget:null,u=n.index>=at.visible.startIndex&&n.index<=at.visible.endIndex,d=i===`flow`&&u&&l!=null&&l.dataset.itemParked!==`true`;t.focusMountedPathFromInput(c),d&&(M.current=!0,re(e=>e===c?e:c),ce(`focus`)),o&&t.toggleMountedDirectoryFromInput(c),a.closeSearch&&t.closeSearch(),a.revealCanonical&&Tt(c,{targetOffset:`sticky-parents`})},[t,Ke,at.visible.endIndex,at.visible.startIndex,Tt]),Tn=()=>{if(y.current||!Pe||Jt==null||_n==null)return;let e=t.getItem(Jt);e!=null&&(St(_n),yt.current=!0,fe({anchorRect:null,item:{kind:e.isDirectory()?`directory`:`file`,name:_n.getAttribute(`aria-label`)??Jt,path:e.getPath()},path:e.getPath(),source:`button`}))},En={contextHoverPath:gn,contextMenuButtonTriggerEnabled:Pe,contextMenuButtonVisibility:Fe,contextMenuEnabled:Me,contextMenuRightClickEnabled:Ie,contextMenuTriggerMode:Ne,controller:t,directoriesWithGitChanges:i,dragAndDropEnabled:Ze,draggedPathSet:$e,dragTarget:et,gitLaneActive:Ve,gitStatusByPath:n,handleRowDragEnd:zt,handleRowDragStart:Rt,handleRowTouchStart:Bt,ignoredGitDirectories:r,ignoredInheritanceCache:ee,instanceId:o,itemHeight:s,onKeyDown:Vt,onRowClick:wn,openContextMenuForRow:Ct,registerButton:Le,registerRenameInput:ze,renameView:Ue,renderDecorationForRow:ht,resolveIcon:He,shouldSuppressContextMenu:Et,visualFocusPath:hn},Dn={...En,registerButton:Re};return pV(`div`,{ref:S,id:nt,"data-file-tree-context-menu-button-visibility":Me&&Pe?Fe:void 0,"data-file-tree-context-menu-trigger-mode":Me?Ne:void 0,"data-file-tree-has-context-menu-action-lane":Me&&Pe?`true`:void 0,"data-file-tree-has-git-lane":Ve?`true`:void 0,"data-file-tree-virtualized-root":`true`,"data-file-tree-root-drag-target":et?.kind===`root`?`true`:void 0,onDragLeave:Ze?$t:void 0,onDragOver:Ze?Qt:void 0,onDrop:Ze?en:void 0,onKeyDown:Vt,onPointerLeave:Me?Zt:void 0,onPointerOver:Me?Xt:void 0,role:`tree`,tabIndex:-1,style:{outline:`none`,position:`relative`},children:[pV(`style`,{"data-file-tree-guide-style":`true`,dangerouslySetInnerHTML:{__html:pn}}),pV(`slot`,{name:wF,"data-type":`header-slot`}),f?pV(`div`,{"data-file-tree-search-container":!0,"data-open":Ke?`true`:`false`,children:pV(`input`,{ref:w,"aria-activedescendant":mn,"aria-controls":nt,placeholder:`Search…`,"data-file-tree-search-input":!0,"data-file-tree-search-input-fake-focus":we?`true`:void 0,value:qe,onBlur:()=>{d===`retain`&&!Ee.current||t.closeSearch()},onFocus:De,onPointerDown:De,onInput:e=>{De();let n=e.currentTarget;t.setSearch(n.value)}})}):null,pV(`div`,{ref:C,"data-file-tree-virtualized-scroll":`true`,children:[h&&Ae&<.length>0?pV(`div`,{"aria-hidden":`true`,"data-file-tree-sticky-overlay":`true`,children:pV(`div`,{"data-file-tree-sticky-overlay-content":`true`,style:{height:`${rt}px`},children:lt.map((e,t)=>SU(Dn,e.row,`sticky:${LH(e.row)}`,{mode:`sticky`,style:{left:`0`,position:`absolute`,right:`0`,top:`${e.top}px`,zIndex:`${lt.length-t}`}}))})}):null,pV(`div`,{ref:b,"data-file-tree-virtualized-list":`true`,style:{height:`${dt}px`},children:[pV(`div`,{"data-file-tree-virtualized-sticky-offset":`true`,"aria-hidden":`true`,style:{height:`${nn}px`}}),pV(`div`,{"data-file-tree-virtualized-sticky":`true`,style:{height:`${tn}px`,top:`${rn}px`,bottom:`${an}px`},children:[CU(En,ct,pt),sn!=null&&cn!=null?SU(En,sn,`parked:${sn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:tt===sn.path?`none`:void 0,position:`absolute`,right:`0`,top:`${cn}px`}}):null,dn!=null&&fn!=null?SU(En,dn,`parked-drag:${dn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:`none`,position:`absolute`,right:`0`,top:`${fn}px`}}):null]})]})]}),Me?pV(`div`,{ref:_,"data-type":`context-menu-anchor`,"data-visible":yn?`true`:`false`,style:Sn,children:[pV(`button`,{ref:v,type:`button`,"data-type":EF,"aria-label":`Options`,"aria-haspopup":`menu`,"aria-expanded":de==null?`false`:`true`,"data-visible":vn?`true`:`false`,onMouseDown:e=>{e.preventDefault()},onClick:e=>{if(e.preventDefault(),e.stopPropagation(),de!=null){xt();return}Tn()},tabIndex:-1,style:Cn,children:pV(_V,{...He(`file-tree-icon-ellipsis`)})}),de==null?null:pV(`slot`,{name:TF})]}):null,de==null?null:pV(`div`,{"data-type":`context-menu-wash`,"aria-hidden":`true`,onMouseDownCapture:e=>{e.preventDefault(),xt()},onTouchStartCapture:e=>{e.preventDefault(),e.stopPropagation(),xt()},onTouchMoveCapture:e=>{e.preventDefault(),e.stopPropagation()},onWheelCapture:e=>{e.preventDefault(),e.stopPropagation()}})]})}var TU={hydrateRoot:(e,t)=>{dV(VB(wU,t),e)},renderRoot:(e,t)=>{uV(VB(wU,t),e)},unmountRoot:e=>{uV(null,e)}};function EU(e,t){TU.renderRoot(e,t)}function DU(e,t){TU.hydrateRoot(e,t)}function OU(e){TU.unmountRoot(e)}var kU=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)}}},AU=`__c`,jU=`__k`,MU=`__d`,NU=`__s`,PU=/[\s\n\\/='"\0<>]/,FU=/^(xlink|xmlns|xml)([A-Z])/,IU=/^(?:accessK|auto[A-Z]|cell|ch|col|cont|cross|dateT|encT|form[A-Z]|frame|hrefL|inputM|maxL|minL|noV|playsI|popoverT|readO|rowS|src[A-Z]|tabI|useM|item[A-Z])/,LU=/^ac|^ali|arabic|basel|cap|clipPath$|clipRule$|color|dominant|enable|fill|flood|font|glyph[^R]|horiz|image|letter|lighting|marker[^WUH]|overline|panose|pointe|paint|rendering|shape|stop|strikethrough|stroke|text[^L]|transform|underline|unicode|units|^v[^i]|^w|^xH/,RU=new Set([`draggable`,`spellcheck`]);function zU(e){e.__g===void 0?e[MU]=!0:e.__g|=8}function BU(e){e.__g===void 0?e[MU]=!1:e.__g&=-9}function VU(e){return e.__g===void 0?!0===e[MU]:!!(8&e.__g)}var HU=/["&<]/;function UU(e){if(e.length===0||!1===HU.test(e))return e;for(var t=0,n=0,r=``,i=``;n<e.length;n++){switch(e.charCodeAt(n)){case 34:i=`"`;break;case 38:i=`&`;break;case 60:i=`<`;break;default:continue}n!==t&&(r+=e.slice(t,n)),r+=i,t=n+1}return n!==t&&(r+=e.slice(t,n)),r}var WU={},GU=new Set(`animation-iteration-count.border-image-outset.border-image-slice.border-image-width.box-flex.box-flex-group.box-ordinal-group.column-count.fill-opacity.flex.flex-grow.flex-negative.flex-order.flex-positive.flex-shrink.flood-opacity.font-weight.grid-column.grid-row.line-clamp.line-height.opacity.order.orphans.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-miterlimit.stroke-opacity.stroke-width.tab-size.widows.z-index.zoom`.split(`.`)),KU=/[A-Z]/g;function qU(e){var t=``;for(var n in e){var r=e[n];if(r!=null&&r!==``){var i=n[0]==`-`?n:WU[n]||(WU[n]=n.replace(KU,`-$&`).toLowerCase()),a=`;`;typeof r!=`number`||i.startsWith(`--`)||GU.has(i)||(a=`px;`),t=t+i+`:`+r+a}}return t||void 0}function JU(){this.__d=!0}function YU(e,t){return{__v:e,context:t,props:e.props,setState:JU,forceUpdate:JU,__d:!0,__h:[]}}function XU(e,t,n){if(!e.s){if(n instanceof ZU){if(!n.s)return void(n.o=XU.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(XU.bind(null,e,t),XU.bind(null,e,2));e.s=t,e.v=n;let r=e.o;r&&r(e)}}var ZU=function(){function e(){}return e.prototype.then=function(t,n){var r=new e,i=this.s;if(i){var a=1&i?t:n;if(a){try{XU(r,1,a(this.v))}catch(e){XU(r,2,e)}return r}return this}return this.o=function(e){try{var i=e.v;1&e.s?XU(r,1,t?t(i):i):n?XU(r,1,n(i)):XU(r,2,i)}catch(e){XU(r,2,e)}},r},e}(),QU,$U,eW,tW,nW={},rW=Array.isArray,iW=Object.assign,aW=``,oW=`<!--$s-->`,sW=`<!--/$s-->`;function cW(e,t){var n,r=e.type,i=!0;return e[AU]?(i=!1,(n=e[AU]).state=n[NU]):n=new r(e.props,t),e[AU]=n,n.__v=e,n.props=e.props,n.context=t,zU(n),n.state??=nW,n[NU]??(n[NU]=n.state),r.getDerivedStateFromProps?n.state=iW({},n.state,r.getDerivedStateFromProps(n.props,n.state)):i&&n.componentWillMount?(n.componentWillMount(),n.state=n[NU]===n.state?n.state:n[NU]):!i&&n.componentWillUpdate&&n.componentWillUpdate(),eW&&eW(e),n.render(n.props,n.state,t)}function lW(e,t,n,r,i,a,o){if(e==null||!0===e||!1===e||e===aW)return aW;var s=typeof e;if(s!=`object`)return s==`function`?aW:s==`string`?UU(e):e+aW;if(rW(e)){var c,l=aW;i[jU]=e;for(var u=e.length,d=0;d<u;d++){var f=e[d];if(f!=null&&typeof f!=`boolean`){var p,m=lW(f,t,n,r,i,a,o);typeof m==`string`?l+=m:(c||=Array(u),l&&c.push(l),l=aW,rW(m)?(p=c).push.apply(p,m):c.push(m))}}return c?(l&&c.push(l),c):l}if(e.constructor!==void 0)return aW;e.__=i,QU&&QU(e);var h=e.type,g=e.props;if(typeof h==`function`){var _,v,y,b=t;if(h===UB){if(`tpl`in g){for(var x=aW,S=0;S<g.tpl.length;S++)if(x+=g.tpl[S],g.exprs&&S<g.exprs.length){var C=g.exprs[S];if(C==null)continue;typeof C!=`object`||C.constructor!==void 0&&!rW(C)?x+=C:x+=lW(C,t,n,r,e,a,o)}return x}if(`UNSTABLE_comment`in g)return`<!--`+UU(g.UNSTABLE_comment)+`-->`;v=g.children}else{if((_=h.contextType)!=null){var w=t[_.__c];b=w?w.props.value:_.__}var T=h.prototype&&typeof h.prototype.render==`function`;if(T)v=cW(e,b),y=e[AU];else{e[AU]=y=YU(e,b);for(var E=0;VU(y)&&E++<25;){BU(y),eW&&eW(e);try{v=h.call(y,g,b)}catch(t){throw a&&t&&typeof t.then==`function`&&(e._suspended=!0),t}}zU(y)}if(y.getChildContext!=null&&(t=iW({},t,y.getChildContext())),T&&TB.errorBoundaries&&(h.getDerivedStateFromError||y.componentDidCatch)){v=v!=null&&v.type===UB&&v.key==null&&v.props.tpl==null?v.props.children:v;try{return lW(v,t,n,r,e,a,!1)}catch(i){return h.getDerivedStateFromError&&(y[NU]=h.getDerivedStateFromError(i)),y.componentDidCatch&&y.componentDidCatch(i,nW),VU(y)?(v=cW(e,t),(y=e[AU]).getChildContext!=null&&(t=iW({},t,y.getChildContext())),lW(v=v!=null&&v.type===UB&&v.key==null&&v.props.tpl==null?v.props.children:v,t,n,r,e,a,o)):aW}finally{$U&&$U(e),tW&&tW(e)}}}v=v!=null&&v.type===UB&&v.key==null&&v.props.tpl==null?v.props.children:v;try{var D=lW(v,t,n,r,e,a,o);return $U&&$U(e),TB.unmount&&TB.unmount(e),e._suspended?typeof D==`string`?oW+D+sW:rW(D)?(D.unshift(oW),D.push(sW),D):D.then(function(e){return oW+e+sW}):D}catch(i){if(!a&&o&&o.onError){var O=function i(s){return o.onError(s,e,function(e,s){try{return lW(e,t,n,r,s,a,o)}catch(e){return i(e)}})}(i);if(O!==void 0)return O;var k=TB.__e;return k&&k(i,e),aW}if(!a||!i||typeof i.then!=`function`)throw i;return i.then(function i(){try{var s=lW(v,t,n,r,e,a,o);return e._suspended?oW+s+sW:s}catch(e){if(!e||typeof e.then!=`function`)throw e;return e.then(i)}})}}var A,j=`<`+h,M=aW;for(var N in g){var P=g[N];if(typeof(P=dW(P)?P.value:P)!=`function`||N===`class`||N===`className`){switch(N){case`children`:A=P;continue;case`key`:case`ref`:case`__self`:case`__source`:continue;case`htmlFor`:if(`for`in g)continue;N=`for`;break;case`className`:if(`class`in g)continue;N=`class`;break;case`defaultChecked`:N=`checked`;break;case`defaultSelected`:N=`selected`;break;case`defaultValue`:case`value`:switch(N=`value`,h){case`textarea`:A=P;continue;case`select`:r=P;continue;case`option`:r!=P||`selected`in g||(j+=` selected`)}break;case`dangerouslySetInnerHTML`:M=P&&P.__html;continue;case`style`:typeof P==`object`&&(P=qU(P));break;case`acceptCharset`:N=`accept-charset`;break;case`httpEquiv`:N=`http-equiv`;break;default:if(FU.test(N))N=N.replace(FU,`$1:$2`).toLowerCase();else{if(PU.test(N))continue;N[4]!==`-`&&!RU.has(N)||P==null?n?LU.test(N)&&(N=N===`panose1`?`panose-1`:N.replace(/([A-Z])/g,`-$1`).toLowerCase()):IU.test(N)&&(N=N.toLowerCase()):P+=aW}}P!=null&&!1!==P&&(j=!0===P||P===aW?j+` `+N:j+` `+N+`="`+(typeof P==`string`?UU(P):P+aW)+`"`)}}if(PU.test(h))throw Error(h+` is not a valid HTML tag name in `+j+`>`);if(M||(typeof A==`string`?M=UU(A):A!=null&&!1!==A&&!0!==A&&(M=lW(A,t,h===`svg`||h!==`foreignObject`&&n,r,e,a,o))),$U&&$U(e),tW&&tW(e),!M&&uW.has(h))return j+`/>`;var F=`</`+h+`>`,I=j+`>`;return rW(M)?[I].concat(M,[F]):typeof M==`string`?I+M+F:[I,M,F]}var uW=new Set([`area`,`base`,`br`,`col`,`command`,`embed`,`hr`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`]);function dW(e){return typeof e==`object`&&!!e&&typeof e.peek==`function`&&`value`in e}var fW=0;function pW(e){return e!=null&&e.length>0?e:(fW+=1,`pst_ft_${fW}`)}function mW({initialVisibleRowCount:e,itemHeight:t}){return e==null?420:Math.max(0,e)*(t??Sz)}function hW(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 gW(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 _W(e){return Array.from(e.children).filter(e=>e instanceof SVGElement)}var vW=class{static LoadedCustomComponent=!0;#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=new kU;#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=pW(a),this.#p=wB(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=xz(n,c),this.#d={itemHeight:this.#u.itemHeight,overscan:d,stickyFolders:_,initialVisibleRowCount:y},this.#t=new yB({...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&&(OU(this.#b),delete this.#b.dataset.fileTreeVirtualizedWrapper,this.#b=void 0),this.#l.clearAll(),this.#l.setHost(null),this.#f!=null&&(delete this.#f.dataset.fileTreeVirtualized,this.#I(this.#f),this.#f=void 0)}cleanUp(){this.unmount(),this.#y?.(),this.#y=null,this.#t.destroy()}getFileTreeContainer(){return this.#f}getItem(e){return this.#t.getItem(e)}getFocusedItem(){return this.#t.getFocusedItem()}getFocusedPath(){return this.#t.getFocusedPath()}getSelectedPaths(){return this.#t.getSelectedPaths()}getComposition(){return this.#e}getItemHeight(){return this.#u.itemHeight}getDensityFactor(){return this.#u.factor}subscribe(e){let t=!1;return this.#t.subscribe(()=>{if(!t){t=!0;return}e()})}focusPath(e){this.#t.focusPath(e)}scrollToPath(e,t){this.#t.scrollToPath(e,t)}focusNearestPath(e){return this.#t.focusNearestPath(e)}add(e){this.#t.add(e)}batch(e){this.#t.batch(e)}move(e,t,n){this.#t.move(e,t,n)}onMutation(e,t){return this.#t.onMutation(e,t)}setSearch(e){this.#t.setSearch(e)}openSearch(e){this.#t.openSearch(e)}closeSearch(){this.#t.closeSearch()}isSearchOpen(){return this.#t.isSearchOpen()}getSearchValue(){return this.#t.getSearchValue()}getSearchMatchingPaths(){return this.#t.getSearchMatchingPaths()}focusNextSearchMatch(){this.#t.focusNextSearchMatch()}focusPreviousSearchMatch(){this.#t.focusPreviousSearchMatch()}startRenaming(e,t){return this.#t.startRenaming(e,t)}remove(e,t){this.#t.remove(e,t)}resetPaths(e,t){this.#t.resetPaths(e,t)}setComposition(e){this.#e=e;let t=this.#T();t!=null&&(this.#O(),EU(t.wrapper,this.#w()))}setGitStatus(e){this.#p=wB(e,this.#p);let t=this.#T();t!=null&&EU(t.wrapper,this.#w())}setIcons(e){this.#m=e;let t=this.#T();t!=null&&(this.#E(t.host,t.wrapper),EU(t.wrapper,this.#w()))}hydrate({fileTreeContainer:e}){let t=this.#P(e),n=this.#N(t);this.#O(),DU(n,this.#w())}render({containerWrapper:e,fileTreeContainer:t}){let n=this.#P(t??this.#f,e),r=this.#N(n);this.#O(),EU(r,this.#w())}#C(){return{initialViewportHeight:mW({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(wF,e());return}this.#l.setSlotHtml(wF,this.#e?.header?.html??null)}#k(e){let t=_W(e).find(e=>gW(e)),n=hW(mF(OF(this.#m).set));n!=null&&(t!=null&&t.outerHTML===n.outerHTML||(t==null?e.prepend(n):t.replaceWith(n)))}#A(e){let t=_W(e),n=t.find(e=>gW(e)),r=t.filter(e=>e!==n),i=OF(this.#m).spriteSheet?.trim()??``;if(i.length===0){for(let e of r)e.remove();return}let a=hW(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=OF(this.#m);t.colored&&gF(t.set)?e.dataset.fileTreeColoredIcons=`true`:delete e.dataset.fileTreeColoredIcons}#M(e){let t=e.querySelector(`style[${bF}]`);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(bF,``),this.#g.parentNode!==e&&e.appendChild(this.#g),this.#g.textContent=Ez(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 Mz(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)}},yW=typeof window>`u`?Q.useEffect:Q.useLayoutEffect;function bW(e,t,n){let r=e==null?null:(0,Z.jsx)(`div`,{slot:wF,children:e}),i=t!=null&&n!=null?(0,Z.jsx)(`div`,{slot:TF,children:t(n.item,n.context)}):null;return r==null&&i==null?null:(0,Z.jsxs)(Z.Fragment,{children:[r,i]})}function xW(e,t){return typeof window>`u`&&t!=null?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`template`,{shadowrootmode:`open`,dangerouslySetInnerHTML:{__html:t.shadowHtml}}),e]}):(0,Z.jsx)(Z.Fragment,{children:e})}function SW(e){let t=e.shadowRoot;return t?.querySelector(`[data-file-tree-id]`)instanceof HTMLElement||t?.querySelector(`[data-file-tree-id]`)instanceof SVGElement?!0:e.querySelector(`template[shadowrootmode="open"]`)instanceof HTMLTemplateElement}function CW(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 wW({header:e,id:t,model:n,preloadedData:r,renderContextMenu:i,...a}){let[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(null),u=(0,Q.useRef)(n.getComposition()),d=(0,Q.useRef)(n);d.current!==n&&(d.current=n,u.current=n.getComposition());let f=i!=null,p=(0,Q.useCallback)(()=>{s(null)},[]),m=(0,Q.useCallback)((e,t)=>{s({context:t,item:e})},[]),h=u.current,g=(0,Q.useMemo)(()=>CW(h,e,f,p,m),[h,p,m,f,e]),_=(0,Q.useCallback)(e=>{l(e)},[]);(0,Q.useEffect)(()=>{f||s(null)},[f]),yW(()=>{n.setComposition(g)},[g,n]),yW(()=>{if(c!=null)return r!=null&&SW(c)?n.hydrate({fileTreeContainer:c}):n.render({fileTreeContainer:c}),()=>{n.unmount(),n.setComposition(h)}},[h,c,n,r]);let v=xW(bW(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,Z.jsx)(vF,{...a,id:y,ref:_,style:b,suppressHydrationWarning:r!=null,children:v})}function TW(e){let[t]=(0,Q.useState)(()=>new vW(e)),n=(0,Q.useRef)({timeout:null,model:t});return(0,Q.useEffect)(()=>{let{current:e}=n;return e.timeout!=null&&(clearTimeout(e.timeout),e.timeout=null),()=>{e.timeout=setTimeout(()=>e.model.cleanUp(),1)}},[]),{model:t}}var EW={density:`compact`,flattenEmptyDirectories:!1},DW={"--trees-level-gap-override":`3px`,"--trees-item-row-gap-override":`2px`,"--trees-icon-width-override":`14px`,"--trees-item-height":`24px`,"--trees-indent-guide-bg-override":`color-mix(in oklab, var(--trees-fg-muted) 30%, transparent)`},OW=`
|
|
1867
1867
|
[data-item-section='spacing-item'] {
|
|
1868
1868
|
opacity: 0.5;
|
|
1869
1869
|
}
|
|
1870
1870
|
:host(:hover) [data-item-section='spacing-item'] {
|
|
1871
1871
|
opacity: 0.85;
|
|
1872
1872
|
}
|
|
1873
|
-
`,
|
|
1873
|
+
`,kW=`
|
|
1874
1874
|
[data-file-tree-sticky-overlay-content='true'] {
|
|
1875
1875
|
--trees-bg: color-mix(in oklab, var(--sidebar) 92%, var(--sidebar-foreground) 8%);
|
|
1876
1876
|
box-shadow: 0 1px 0 0 var(--sidebar-border);
|
|
@@ -1884,17 +1884,17 @@ Error generating stack: `+e.message+`
|
|
|
1884
1884
|
border-bottom: 1px solid CanvasText;
|
|
1885
1885
|
}
|
|
1886
1886
|
}
|
|
1887
|
-
`;function
|
|
1887
|
+
`;function AW(e){return{...zF({type:e===`dark`?`dark`:`light`,colors:{"sideBar.background":`var(--sidebar)`,"sideBar.foreground":`var(--sidebar-foreground)`,"sideBar.border":`var(--sidebar-border)`,"list.activeSelectionBackground":`var(--sidebar-accent)`,"list.activeSelectionForeground":`var(--sidebar-accent-foreground)`,"list.hoverBackground":`var(--sidebar-hover)`,focusBorder:`var(--color-primary)`,"input.background":`var(--input)`,"input.border":`var(--border)`}}),"--trees-font-family-override":`var(--font-sans)`,"--trees-font-size-override":`0.875rem`,"--trees-item-padding-x-override":`0.5rem`,"--trees-padding-inline-override":`0.5rem`,"--trees-border-radius-override":`0.375rem`,"--trees-selected-fg":`var(--color-primary)`,"--truncate-marker-fade-in-duration":`0s`,"--trees-file-icon-color-markdown":`light-dark(var(--color-gray-400), var(--color-gray-500))`,"--trees-file-icon-color-image":`light-dark(var(--color-gray-400), var(--color-gray-500))`,"--trees-fg-muted":`light-dark(var(--color-gray-400), var(--color-gray-500))`,...DW}}var jW=`data-ok-ext-badge`,MW=`data-ok-ext-row`,NW=`data-ok-fullname-row`,PW=`
|
|
1888
1888
|
[data-item-selected='true'] [data-icon-token='markdown'] {
|
|
1889
1889
|
color: var(--trees-selected-fg);
|
|
1890
1890
|
}
|
|
1891
|
-
[data-type='item'][${
|
|
1891
|
+
[data-type='item'][${MW}] [data-truncate-segment-priority]:last-child {
|
|
1892
1892
|
display: none;
|
|
1893
1893
|
}
|
|
1894
|
-
[data-type='item'][${
|
|
1894
|
+
[data-type='item'][${NW}] [data-truncate-segment-priority]:last-child {
|
|
1895
1895
|
display: none;
|
|
1896
1896
|
}
|
|
1897
|
-
[${
|
|
1897
|
+
[${jW}] {
|
|
1898
1898
|
display: inline-block;
|
|
1899
1899
|
margin-left: 0.375rem;
|
|
1900
1900
|
margin-right: 0.25rem;
|
|
@@ -1906,7 +1906,7 @@ Error generating stack: `+e.message+`
|
|
|
1906
1906
|
pointer-events: none;
|
|
1907
1907
|
user-select: none;
|
|
1908
1908
|
}
|
|
1909
|
-
`;function
|
|
1909
|
+
`;function FW(e){let t=e.querySelectorAll(`[data-type="item"][data-item-path]`);for(let e of t){let t=e.dataset.itemPath;if(!t){LW(e);continue}if(t.endsWith(`/`)){zW(e,t);continue}let n=tM(t);if(!n){LW(e);continue}let r=RW(e);if(r){if(e.setAttribute(MW,``),e.removeAttribute(NW),UW(r),n.toLowerCase()===`.md`){IW(e);continue}WW(e,n.slice(1).toUpperCase())}}}function IW(e){let t=e.querySelector(`[${jW}]`);t&&t.remove()}function LW(e){e.removeAttribute(MW),e.removeAttribute(NW),IW(e)}function RW(e){let t=e.querySelector(`[data-truncate-group-container="middle"]`);if(!t)return null;let n=t.querySelectorAll(`[data-truncate-segment-priority]`);return n.length<2?null:n[0]??null}function zW(e,t){e.removeAttribute(MW),IW(e);let n=RW(e),r=BW(t);if(!n||!r){e.removeAttribute(NW);return}HW(n,r),e.setAttribute(NW,``)}function BW(e){let t=e.replace(/\/+$/,``),n=t.lastIndexOf(`/`);return n>=0?t.slice(n+1):t}function VW(e,t){let n=e.querySelectorAll(`[data-truncate-content]`);for(let e of n){let n=e.firstChild;if(!n||n.nodeType!==Node.TEXT_NODE)continue;let r=n.textContent??``,i=t(r);i!==r&&(n.textContent=i)}}function HW(e,t){VW(e,()=>t)}function UW(e){VW(e,e=>e.replace(/\.+$/,``))}function WW(e,t){let n=e.querySelector(`[${jW}]`);if(!n){n=e.ownerDocument.createElement(`span`),n.setAttribute(jW,``),n.setAttribute(`aria-hidden`,`true`);let t=e.querySelector(`[data-item-section="action"]`);t?t.before(n):e.appendChild(n)}n.textContent!==t&&(n.textContent=t)}function GW(e){return e.replace(/\\/g,`\\\\`).replace(/\[/g,`\\[`).replace(/\]/g,`\\]`).replace(/\*/g,`\\*`)}function KW(e){let t=GW(e.path);return e.kind===`folder`?`/${t}/`:`/${t}${e.docExt??`.md`}`}var qW=`data-ok-renaming`,JW=`data-ok-rename-selection-applied`,YW=null,XW=null,ZW=5e3,QW=`
|
|
1910
1910
|
/* Pierre's icon decoration keys off the row's data-item-path. If the user
|
|
1911
1911
|
deletes the extension before commit, Pierre can temporarily key the row
|
|
1912
1912
|
by an extensionless path and swap [data-icon-token] from 'markdown' to
|
|
@@ -1917,16 +1917,16 @@ Error generating stack: `+e.message+`
|
|
|
1917
1917
|
the row to an extensionless path, then clears it when the path next
|
|
1918
1918
|
includes the saved extension (settle / cancel / row recycle to a settled
|
|
1919
1919
|
file). */
|
|
1920
|
-
[${
|
|
1921
|
-
[${
|
|
1920
|
+
[${qW}='.md'] [data-item-section="icon"],
|
|
1921
|
+
[${qW}='.mdx'] [data-item-section="icon"] {
|
|
1922
1922
|
position: relative;
|
|
1923
1923
|
}
|
|
1924
|
-
[${
|
|
1925
|
-
[${
|
|
1924
|
+
[${qW}='.md'] [data-item-section="icon"] [data-icon-token]:not([data-icon-token='markdown']),
|
|
1925
|
+
[${qW}='.mdx'] [data-item-section="icon"] [data-icon-token]:not([data-icon-token='markdown']) {
|
|
1926
1926
|
visibility: hidden;
|
|
1927
1927
|
}
|
|
1928
|
-
[${
|
|
1929
|
-
[${
|
|
1928
|
+
[${qW}='.md'] [data-item-section="icon"]::before,
|
|
1929
|
+
[${qW}='.mdx'] [data-item-section="icon"]::before {
|
|
1930
1930
|
content: '';
|
|
1931
1931
|
display: block;
|
|
1932
1932
|
position: absolute;
|
|
@@ -1938,14 +1938,14 @@ Error generating stack: `+e.message+`
|
|
|
1938
1938
|
mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path d='M1 12V4h2l2 2.5L7 4h2v8H7V7.5l-2 2-2-2V12zm9-3 3 3.5L16 9h-2V4h-2v5z'/></svg>") center / contain no-repeat;
|
|
1939
1939
|
pointer-events: none;
|
|
1940
1940
|
}
|
|
1941
|
-
`;function eG(e){rG(e);let t=e.querySelector(`[data-item-rename-input]`);if(!t)return;let n=t.closest(`[data-type="item"]`);if(!n)return;let r=n.dataset.itemPath??``;if(r.endsWith(`/`))return;let i=nM(r);iM(r)&&tG(i),!t.hasAttribute(YW)&&(iG(t),t.setAttribute(YW,``))}function tG(e){XW=e,ZW!==null&&clearTimeout(ZW),ZW=setTimeout(nG,QW)}function nG(){XW=null,ZW!==null&&(clearTimeout(ZW),ZW=null)}function rG(e){let t=e.querySelectorAll(`[${JW}]`);for(let e of t){if(e.querySelector(`[data-item-rename-input]`))continue;let t=e.getAttribute(JW);if(!t){e.removeAttribute(JW);continue}let n=e.dataset.itemPath??``;if(n.toLowerCase().endsWith(t.toLowerCase())){e.removeAttribute(JW);continue}let r=nM(n);r&&r.toLowerCase()!==t.toLowerCase()&&e.removeAttribute(JW)}if(XW===null)return;let n=e.querySelectorAll(`[data-type="item"][data-item-path]`),r=!1;for(let e of n){let t=e.dataset.itemPath??``;!t||t.endsWith(`/`)||nM(t)||(r=!0,e.getAttribute(`data-item-selected`)===`true`&&e.getAttribute(`data-ok-renaming`)!==XW&&e.setAttribute(JW,XW))}let i=!!e.querySelector(`[data-item-rename-input]`);!r&&!i&&nG()}function iG(e){let t=nM(e.value),n=t?e.value.length-t.length:e.value.length;e.setSelectionRange(0,n)}function aG(e){let t=e.getFocusedPath();t&&e.scrollToPath(t,{offset:`nearest`,focus:!1})}function oG(e){return{selectedFilePath:e,selectedFolderPath:null,navigationPath:e}}function sG(e,t,n={}){if(!e)return oG(t);let r=ts(e);if(t&&r!==t)return oG(t);switch(e.kind){case`doc`:return oG(t??e.docName);case`large-file`:return oG(e.docName);case`folder`:case`folder-index`:return{selectedFilePath:null,selectedFolderPath:e.folderPath,navigationPath:e.folderPath};case`missing`:return t&&n.isKnownDocument?.(t)?oG(t):{selectedFilePath:null,selectedFolderPath:null,navigationPath:null};case`asset`:return{selectedFilePath:null,selectedFolderPath:null,navigationPath:null}}}function cG(e,t){if(!e)return{kind:`none`};let n=t.find(t=>uM(t)===e);if(n&&zo(n))return{kind:`asset`,path:n.path,hash:Yo(n.path),mediaKind:n.mediaKind};let r=mM(e);return e.endsWith(`/`)?t.some(e=>Qo(e)?e.path===r||e.path.startsWith(`${r}/`):(zo(e)?e.path:e.docName).startsWith(`${r}/`))?{kind:`folder`,path:r}:{kind:`none`}:t.some(e=>ps(e)&&e.docName===r)?{kind:`document`,path:r}:{kind:`none`}}var lG=`You can restore this file from the Trash.`;function uG(e){let t=lG,n=`Move to Trash`,r=`Moving`;if(e.length===0)return{title:`Are you sure you want to delete the selected items?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r};if(e.length===1){let i=e[0];return i?i.kind===`folder`?{title:`Are you sure you want to delete '${i.name}' and its contents?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r}:{title:`Are you sure you want to delete '${i.name}'?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r}:{title:`Are you sure you want to delete the selected item?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r}}let i=e.some(e=>e.kind===`folder`),a=e.some(e=>e.kind!==`folder`);return i&&a?{title:`Are you sure you want to delete the following ${e.length} files/directories and their contents?`,detail:t,listedTargets:e,confirmLabel:n,confirmLabelBusy:r}:i?{title:`Are you sure you want to delete the following ${e.length} directories and their contents?`,detail:t,listedTargets:e,confirmLabel:n,confirmLabelBusy:r}:{title:`Are you sure you want to delete the following ${e.length} files?`,detail:t,listedTargets:e,confirmLabel:n,confirmLabelBusy:r}}function dG(e,t){return e===`web`?null:uG(t)}function fG(e){return e.kind===`folder`?`${e.name}/`:e.kind===`asset`?e.name:e.docExt?`${e.name}${e.docExt}`:e.name}function pG(e,t,n){let r=cG(e,t);if(r.kind===`none`)return null;if(r.kind===`asset`)return{v:1,kind:`asset`,assetPath:r.path,mediaKind:r.mediaKind};if(r.kind===`folder`)return{v:1,kind:`folder`,folderPath:r.path};let i=t.find(e=>ps(e)&&e.docName===r.path);return{v:1,kind:`doc`,docName:r.path,size:i?.size??n?.get(r.path)?.size??null}}var mG=[`not-found`,`permission-denied`,`system-error`,`path-escape`];function hG(e){return typeof e==`string`&&mG.includes(e)?e:`system-error`}function gG(e){switch(e){case`not-found`:return hs._({id:`v41fCm`});case`permission-denied`:return hs._({id:`sJK6pq`});case`system-error`:return hs._({id:`Jqqevv`});case`path-escape`:return hs._({id:`WL6puM`})}}function _G(e){let t=gG(e.reason),n=e.detail;return n?hs._({id:`Z2M5XM`,values:{reason:t,osDetail:n}}):hs._({id:`dTaauv`,values:{reason:t}})}function vG(e){return e.kind===`folder`?`${e.name}/`:e.name}function yG(e){let t=(0,$.c)(34),{failedTargets:n,isSubmitting:r,onDeletePermanently:i,onRetry:a,onCancel:o}=e,c=n.length>1,l=n[0],u=n.length,d;if(t[0]!==u||t[1]!==c||t[2]!==l){let e=l?vG(l):``;d=c?hs._({id:`5qNxOe`,values:{count:u}}):l?`${hs._({id:`E_BHoD`,values:{targetName:e}})}\n${_G(l)}`:hs._({id:`kolRU1`}),t[0]=u,t[1]=c,t[2]=l,t[3]=d}else d=t[3];let f=d,p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(wo,{children:(0,Z.jsx)(s,{id:`aOp3hw`})}),t[4]=p):p=t[4];let m;t[5]===f?m=t[6]:(m=(0,Z.jsxs)(Oo,{children:[p,(0,Z.jsx)(Co,{className:`whitespace-pre-wrap`,children:f})]}),t[5]=f,t[6]=m);let g;t[7]!==n||t[8]!==c?(g=c?(0,Z.jsx)(Eo,{children:(0,Z.jsx)(`ul`,{className:`flex flex-col gap-2 text-xs`,children:n.map(bG)})}):null,t[7]=n,t[8]=c,t[9]=g):g=t[9];let _;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(s,{id:`dEgA5A`}),t[10]=_):_=t[10];let v;t[11]!==r||t[12]!==o?(v=(0,Z.jsx)(li,{variant:`outline`,className:`font-mono uppercase`,onClick:o,disabled:r,"data-testid":`trash-failure-modal-cancel`,children:_}),t[11]=r,t[12]=o,t[13]=v):v=t[13];let y;t[14]===r?y=t[15]:(y=r?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(h,{className:`size-4 animate-spin`}),` `,(0,Z.jsx)(s,{id:`mf37rL`})]}):(0,Z.jsx)(s,{id:`6gRgw8`}),t[14]=r,t[15]=y);let b;t[16]!==r||t[17]!==a||t[18]!==y?(b=(0,Z.jsx)(li,{variant:`outline`,className:`font-mono uppercase`,onClick:a,disabled:r,"data-testid":`trash-failure-modal-retry`,children:y}),t[16]=r,t[17]=a,t[18]=y,t[19]=b):b=t[19];let x;t[20]===r?x=t[21]:(x=r?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(h,{className:`size-4 animate-spin`}),` `,(0,Z.jsx)(s,{id:`s3caR3`})]}):(0,Z.jsx)(s,{id:`UBv8UK`}),t[20]=r,t[21]=x);let S;t[22]!==r||t[23]!==i||t[24]!==x?(S=(0,Z.jsx)(li,{variant:`destructive`,onClick:i,disabled:r,"data-testid":`trash-failure-modal-delete-permanently`,children:x}),t[22]=r,t[23]=i,t[24]=x,t[25]=S):S=t[25];let C;t[26]!==S||t[27]!==v||t[28]!==b?(C=(0,Z.jsxs)(Do,{children:[v,b,S]}),t[26]=S,t[27]=v,t[28]=b,t[29]=C):C=t[29];let w;return t[30]!==C||t[31]!==m||t[32]!==g?(w=(0,Z.jsxs)(To,{className:`sm:max-w-md`,children:[m,g,C]}),t[30]=C,t[31]=m,t[32]=g,t[33]=w):w=t[33],w}function bG(e){return(0,Z.jsxs)(`li`,{"data-testid":`trash-failure-modal-target`,children:[(0,Z.jsx)(`div`,{className:`font-mono text-foreground`,children:vG(e)}),(0,Z.jsx)(`div`,{className:`text-muted-foreground`,children:_G(e)})]},e.path)}function xG(e){let t=(0,$.c)(21),{parentDir:n,onSelectTemplate:r,ItemComponent:i}=e,{state:a}=Ha(n);if(a.status===`idle`||a.status===`loading`){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(s,{id:`Hl89Qd`}),t[0]=e):e=t[0];let n;return t[1]===i?n=t[2]:(n=(0,Z.jsx)(i,{disabled:!0,className:`text-muted-foreground`,children:e}),t[1]=i,t[2]=n),n}if(a.status===`error`){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(s,{id:`AQ-Lfg`}),t[3]=e):e=t[3];let n;return t[4]===i?n=t[5]:(n=(0,Z.jsx)(i,{disabled:!0,className:`text-muted-foreground`,children:e}),t[4]=i,t[5]=n),n}let o,c;if(t[6]!==i||t[7]!==r||t[8]!==a.data.folder.templates_available){c=Symbol.for(`react.early_return_sentinel`);bb0:{let e;t[11]===a.data.folder.templates_available?e=t[12]:(e=a.data.folder.templates_available??[],t[11]=a.data.folder.templates_available,t[12]=e);let n=Mh(e);if(n.length===0){let e;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(s,{id:`iGCs04`}),t[13]=e):e=t[13];let n;t[14]===i?n=t[15]:(n=(0,Z.jsx)(i,{disabled:!0,className:`text-muted-foreground`,children:e}),t[14]=i,t[15]=n),c=n;break bb0}let l;t[16]!==i||t[17]!==r?(l=e=>(0,Z.jsx)(i,{onSelect:()=>r(e.name),children:e.title??e.name},`${e.scope}:${e.source_folder}:${e.name}`),t[16]=i,t[17]=r,t[18]=l):l=t[18],o=n.map(l)}t[6]=i,t[7]=r,t[8]=a.data.folder.templates_available,t[9]=o,t[10]=c}else o=t[9],c=t[10];if(c!==Symbol.for(`react.early_return_sentinel`))return c;let l;return t[19]===o?l=t[20]:(l=(0,Z.jsx)(Z.Fragment,{children:o}),t[19]=o,t[20]=l),l}function SG(e){return e?.isDirectory()?e:null}function CG(e,t){let n=t.getPath();for(let t of e.getSelectedPaths())t!==n&&e.getItem(t)?.deselect();t.isSelected()||t.select()}function wG(e,t,n,r,i){let a=(0,$.c)(11),o;a[0]!==n||a[1]!==t||a[2]!==e||a[3]!==r?(o=()=>{let i=()=>{queueMicrotask(()=>{r.current=!1})};if(r.current=!0,!t){for(let t of e.getSelectedPaths())e.getItem(t)?.deselect();i();return}let a=n?n.split(`\0`):[];for(let t of a){let n=SG(e.getItem(t));n&&!n.isExpanded()&&n.expand()}let o=e.getItem(t);if(!o){i();return}if(e.getSelectedPaths().length>1&&o.isSelected()){o.focus(),i();return}CG(e,o),o.focus(),i()},a[0]=n,a[1]=t,a[2]=e,a[3]=r,a[4]=o):o=a[4];let s;a[5]!==n||a[6]!==t||a[7]!==e||a[8]!==r||a[9]!==i?(s=[n,t,e,r,i],a[5]=n,a[6]=t,a[7]=e,a[8]=r,a[9]=i,a[10]=s):s=a[10],(0,Q.useEffect)(o,s)}var TG=`open-knowledge:file-tree-menu-action-delete`,EG=`open-knowledge:file-tree-menu-action-rename`,DG=`open-knowledge:file-tree-menu-action-duplicate`;function OG(e){window.dispatchEvent(new CustomEvent(TG,{detail:{target:e}}))}function kG(e){let t=t=>{let n=t.detail;n?.target&&e(n.target)};return window.addEventListener(TG,t),()=>window.removeEventListener(TG,t)}function AG(e){window.dispatchEvent(new CustomEvent(EG,{detail:{target:e}}))}function jG(e){let t=t=>{let n=t.detail;n?.target&&e(n.target)};return window.addEventListener(EG,t),()=>window.removeEventListener(EG,t)}function MG(e){window.dispatchEvent(new CustomEvent(DG,{detail:{target:e}}))}function NG(e){let t=t=>{let n=t.detail;n?.target&&e(n.target)};return window.addEventListener(DG,t),()=>window.removeEventListener(DG,t)}function PG(e,t){let n=!1,r=!1,i=!1;async function a(){if(!i){n=!0;try{await e()}finally{n=!1,i?r=!1:r&&(r=!1,a())}}}return{request(){if(!i){if(n){r=!0,t?.();return}a()}},dispose(){i=!0,r=!1,t?.()}}}var FG={Accept:`application/x-ndjson, application/json`};function IG(e){return!e.ok||!e.body?!1:(e.headers.get(`content-type`)??``).includes(`application/x-ndjson`)}var LG=class extends Error{};function RG(e){return typeof e==`object`&&!!e&&`type`in e}async function zG(e){let t=e.body;if(!t)throw new LG(`Show All Files stream had no response body.`);let n=t.getReader(),r=new TextDecoder,i=[],a=!1,o=``,s=e=>{let t=e.trim();if(t.length===0)return!1;let n;try{n=JSON.parse(t)}catch{return console.warn(`[show-all-stream] dropping unparseable NDJSON line:`,t.slice(0,200)),!1}if(RG(n)){if(n.type===`error`)throw new LG(typeof n.problem?.title==`string`?n.problem.title:`Show All Files stream failed.`);return a=n.truncated===!0,!0}let r=An.safeParse(n);return r.success?i.push(r.data):console.warn(`[show-all-stream] dropping schema-divergent entry line:`,r.error.issues),!1};try{let e=!1;for(;!e;){let t=await n.read();if(t.done)break;o+=r.decode(t.value,{stream:!0});let i=o.indexOf(`
|
|
1941
|
+
`;function $W(e){nG(e);let t=e.querySelector(`[data-item-rename-input]`);if(!t)return;let n=t.closest(`[data-type="item"]`);if(!n)return;let r=n.dataset.itemPath??``;if(r.endsWith(`/`))return;let i=tM(r);rM(r)&&eG(i),!t.hasAttribute(JW)&&(rG(t),t.setAttribute(JW,``))}function eG(e){YW=e,XW!==null&&clearTimeout(XW),XW=setTimeout(tG,ZW)}function tG(){YW=null,XW!==null&&(clearTimeout(XW),XW=null)}function nG(e){let t=e.querySelectorAll(`[${qW}]`);for(let e of t){if(e.querySelector(`[data-item-rename-input]`))continue;let t=e.getAttribute(qW);if(!t){e.removeAttribute(qW);continue}let n=e.dataset.itemPath??``;if(n.toLowerCase().endsWith(t.toLowerCase())){e.removeAttribute(qW);continue}let r=tM(n);r&&r.toLowerCase()!==t.toLowerCase()&&e.removeAttribute(qW)}if(YW===null)return;let n=e.querySelectorAll(`[data-type="item"][data-item-path]`),r=!1;for(let e of n){let t=e.dataset.itemPath??``;!t||t.endsWith(`/`)||tM(t)||(r=!0,e.getAttribute(`data-item-selected`)===`true`&&e.getAttribute(`data-ok-renaming`)!==YW&&e.setAttribute(qW,YW))}let i=!!e.querySelector(`[data-item-rename-input]`);!r&&!i&&tG()}function rG(e){let t=tM(e.value),n=t?e.value.length-t.length:e.value.length;e.setSelectionRange(0,n)}function iG(e){let t=e.getFocusedPath();t&&e.scrollToPath(t,{offset:`nearest`,focus:!1})}function aG(e){return{selectedFilePath:e,selectedFolderPath:null,navigationPath:e}}function oG(e,t,n={}){if(!e)return aG(t);let r=ts(e);if(t&&r!==t)return aG(t);switch(e.kind){case`doc`:return aG(t??e.docName);case`large-file`:return aG(e.docName);case`folder`:case`folder-index`:return{selectedFilePath:null,selectedFolderPath:e.folderPath,navigationPath:e.folderPath};case`missing`:return t&&n.isKnownDocument?.(t)?aG(t):{selectedFilePath:null,selectedFolderPath:null,navigationPath:null};case`asset`:return{selectedFilePath:null,selectedFolderPath:null,navigationPath:null}}}function sG(e,t){if(!e)return{kind:`none`};let n=t.find(t=>lM(t)===e);if(n&&zo(n))return{kind:`asset`,path:n.path,hash:Yo(n.path),mediaKind:n.mediaKind};let r=pM(e);return e.endsWith(`/`)?t.some(e=>Qo(e)?e.path===r||e.path.startsWith(`${r}/`):(zo(e)?e.path:e.docName).startsWith(`${r}/`))?{kind:`folder`,path:r}:{kind:`none`}:t.some(e=>ps(e)&&e.docName===r)?{kind:`document`,path:r}:{kind:`none`}}var cG=`You can restore this file from the Trash.`;function lG(e){let t=cG,n=`Move to Trash`,r=`Moving`;if(e.length===0)return{title:`Are you sure you want to delete the selected items?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r};if(e.length===1){let i=e[0];return i?i.kind===`folder`?{title:`Are you sure you want to delete '${i.name}' and its contents?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r}:{title:`Are you sure you want to delete '${i.name}'?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r}:{title:`Are you sure you want to delete the selected item?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r}}let i=e.some(e=>e.kind===`folder`),a=e.some(e=>e.kind!==`folder`);return i&&a?{title:`Are you sure you want to delete the following ${e.length} files/directories and their contents?`,detail:t,listedTargets:e,confirmLabel:n,confirmLabelBusy:r}:i?{title:`Are you sure you want to delete the following ${e.length} directories and their contents?`,detail:t,listedTargets:e,confirmLabel:n,confirmLabelBusy:r}:{title:`Are you sure you want to delete the following ${e.length} files?`,detail:t,listedTargets:e,confirmLabel:n,confirmLabelBusy:r}}function uG(e,t){return e===`web`?null:lG(t)}function dG(e){return e.kind===`folder`?`${e.name}/`:e.kind===`asset`?e.name:e.docExt?`${e.name}${e.docExt}`:e.name}function fG(e,t,n){let r=sG(e,t);if(r.kind===`none`)return null;if(r.kind===`asset`)return{v:1,kind:`asset`,assetPath:r.path,mediaKind:r.mediaKind};if(r.kind===`folder`)return{v:1,kind:`folder`,folderPath:r.path};let i=t.find(e=>ps(e)&&e.docName===r.path);return{v:1,kind:`doc`,docName:r.path,size:i?.size??n?.get(r.path)?.size??null}}var pG=[`not-found`,`permission-denied`,`system-error`,`path-escape`];function mG(e){return typeof e==`string`&&pG.includes(e)?e:`system-error`}function hG(e){switch(e){case`not-found`:return hs._({id:`v41fCm`});case`permission-denied`:return hs._({id:`sJK6pq`});case`system-error`:return hs._({id:`Jqqevv`});case`path-escape`:return hs._({id:`WL6puM`})}}function gG(e){let t=hG(e.reason),n=e.detail;return n?hs._({id:`Z2M5XM`,values:{reason:t,osDetail:n}}):hs._({id:`dTaauv`,values:{reason:t}})}function _G(e){return e.kind===`folder`?`${e.name}/`:e.name}function vG(e){let t=(0,$.c)(34),{failedTargets:n,isSubmitting:r,onDeletePermanently:i,onRetry:a,onCancel:o}=e,c=n.length>1,l=n[0],u=n.length,d;if(t[0]!==u||t[1]!==c||t[2]!==l){let e=l?_G(l):``;d=c?hs._({id:`5qNxOe`,values:{count:u}}):l?`${hs._({id:`E_BHoD`,values:{targetName:e}})}\n${gG(l)}`:hs._({id:`kolRU1`}),t[0]=u,t[1]=c,t[2]=l,t[3]=d}else d=t[3];let f=d,p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(wo,{children:(0,Z.jsx)(s,{id:`aOp3hw`})}),t[4]=p):p=t[4];let m;t[5]===f?m=t[6]:(m=(0,Z.jsxs)(Oo,{children:[p,(0,Z.jsx)(Co,{className:`whitespace-pre-wrap`,children:f})]}),t[5]=f,t[6]=m);let g;t[7]!==n||t[8]!==c?(g=c?(0,Z.jsx)(Eo,{children:(0,Z.jsx)(`ul`,{className:`flex flex-col gap-2 text-xs`,children:n.map(yG)})}):null,t[7]=n,t[8]=c,t[9]=g):g=t[9];let _;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(s,{id:`dEgA5A`}),t[10]=_):_=t[10];let v;t[11]!==r||t[12]!==o?(v=(0,Z.jsx)(li,{variant:`outline`,className:`font-mono uppercase`,onClick:o,disabled:r,"data-testid":`trash-failure-modal-cancel`,children:_}),t[11]=r,t[12]=o,t[13]=v):v=t[13];let y;t[14]===r?y=t[15]:(y=r?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(h,{className:`size-4 animate-spin`}),` `,(0,Z.jsx)(s,{id:`mf37rL`})]}):(0,Z.jsx)(s,{id:`6gRgw8`}),t[14]=r,t[15]=y);let b;t[16]!==r||t[17]!==a||t[18]!==y?(b=(0,Z.jsx)(li,{variant:`outline`,className:`font-mono uppercase`,onClick:a,disabled:r,"data-testid":`trash-failure-modal-retry`,children:y}),t[16]=r,t[17]=a,t[18]=y,t[19]=b):b=t[19];let x;t[20]===r?x=t[21]:(x=r?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(h,{className:`size-4 animate-spin`}),` `,(0,Z.jsx)(s,{id:`s3caR3`})]}):(0,Z.jsx)(s,{id:`UBv8UK`}),t[20]=r,t[21]=x);let S;t[22]!==r||t[23]!==i||t[24]!==x?(S=(0,Z.jsx)(li,{variant:`destructive`,onClick:i,disabled:r,"data-testid":`trash-failure-modal-delete-permanently`,children:x}),t[22]=r,t[23]=i,t[24]=x,t[25]=S):S=t[25];let C;t[26]!==S||t[27]!==v||t[28]!==b?(C=(0,Z.jsxs)(Do,{children:[v,b,S]}),t[26]=S,t[27]=v,t[28]=b,t[29]=C):C=t[29];let w;return t[30]!==C||t[31]!==m||t[32]!==g?(w=(0,Z.jsxs)(To,{className:`sm:max-w-md`,children:[m,g,C]}),t[30]=C,t[31]=m,t[32]=g,t[33]=w):w=t[33],w}function yG(e){return(0,Z.jsxs)(`li`,{"data-testid":`trash-failure-modal-target`,children:[(0,Z.jsx)(`div`,{className:`font-mono text-foreground`,children:_G(e)}),(0,Z.jsx)(`div`,{className:`text-muted-foreground`,children:gG(e)})]},e.path)}function bG(e){let t=(0,$.c)(21),{parentDir:n,onSelectTemplate:r,ItemComponent:i}=e,{state:a}=Ha(n);if(a.status===`idle`||a.status===`loading`){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(s,{id:`Hl89Qd`}),t[0]=e):e=t[0];let n;return t[1]===i?n=t[2]:(n=(0,Z.jsx)(i,{disabled:!0,className:`text-muted-foreground`,children:e}),t[1]=i,t[2]=n),n}if(a.status===`error`){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(s,{id:`AQ-Lfg`}),t[3]=e):e=t[3];let n;return t[4]===i?n=t[5]:(n=(0,Z.jsx)(i,{disabled:!0,className:`text-muted-foreground`,children:e}),t[4]=i,t[5]=n),n}let o,c;if(t[6]!==i||t[7]!==r||t[8]!==a.data.folder.templates_available){c=Symbol.for(`react.early_return_sentinel`);bb0:{let e;t[11]===a.data.folder.templates_available?e=t[12]:(e=a.data.folder.templates_available??[],t[11]=a.data.folder.templates_available,t[12]=e);let n=Mh(e);if(n.length===0){let e;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(s,{id:`iGCs04`}),t[13]=e):e=t[13];let n;t[14]===i?n=t[15]:(n=(0,Z.jsx)(i,{disabled:!0,className:`text-muted-foreground`,children:e}),t[14]=i,t[15]=n),c=n;break bb0}let l;t[16]!==i||t[17]!==r?(l=e=>(0,Z.jsx)(i,{onSelect:()=>r(e.name),children:e.title??e.name},`${e.scope}:${e.source_folder}:${e.name}`),t[16]=i,t[17]=r,t[18]=l):l=t[18],o=n.map(l)}t[6]=i,t[7]=r,t[8]=a.data.folder.templates_available,t[9]=o,t[10]=c}else o=t[9],c=t[10];if(c!==Symbol.for(`react.early_return_sentinel`))return c;let l;return t[19]===o?l=t[20]:(l=(0,Z.jsx)(Z.Fragment,{children:o}),t[19]=o,t[20]=l),l}function xG(e){return e?.isDirectory()?e:null}function SG(e,t){let n=t.getPath();for(let t of e.getSelectedPaths())t!==n&&e.getItem(t)?.deselect();t.isSelected()||t.select()}function CG(e,t,n,r,i){let a=(0,$.c)(11),o;a[0]!==n||a[1]!==t||a[2]!==e||a[3]!==r?(o=()=>{let i=()=>{queueMicrotask(()=>{r.current=!1})};if(r.current=!0,!t){for(let t of e.getSelectedPaths())e.getItem(t)?.deselect();i();return}let a=n?n.split(`\0`):[];for(let t of a){let n=xG(e.getItem(t));n&&!n.isExpanded()&&n.expand()}let o=e.getItem(t);if(!o){i();return}if(e.getSelectedPaths().length>1&&o.isSelected()){o.focus(),i();return}SG(e,o),o.focus(),i()},a[0]=n,a[1]=t,a[2]=e,a[3]=r,a[4]=o):o=a[4];let s;a[5]!==n||a[6]!==t||a[7]!==e||a[8]!==r||a[9]!==i?(s=[n,t,e,r,i],a[5]=n,a[6]=t,a[7]=e,a[8]=r,a[9]=i,a[10]=s):s=a[10],(0,Q.useEffect)(o,s)}var wG=`open-knowledge:file-tree-menu-action-delete`,TG=`open-knowledge:file-tree-menu-action-rename`,EG=`open-knowledge:file-tree-menu-action-duplicate`;function DG(e){window.dispatchEvent(new CustomEvent(wG,{detail:{target:e}}))}function OG(e){let t=t=>{let n=t.detail;n?.target&&e(n.target)};return window.addEventListener(wG,t),()=>window.removeEventListener(wG,t)}function kG(e){window.dispatchEvent(new CustomEvent(TG,{detail:{target:e}}))}function AG(e){let t=t=>{let n=t.detail;n?.target&&e(n.target)};return window.addEventListener(TG,t),()=>window.removeEventListener(TG,t)}function jG(e){window.dispatchEvent(new CustomEvent(EG,{detail:{target:e}}))}function MG(e){let t=t=>{let n=t.detail;n?.target&&e(n.target)};return window.addEventListener(EG,t),()=>window.removeEventListener(EG,t)}function NG(e,t){let n=!1,r=!1,i=!1;async function a(){if(!i){n=!0;try{await e()}finally{n=!1,i?r=!1:r&&(r=!1,a())}}}return{request(){if(!i){if(n){r=!0,t?.();return}a()}},dispose(){i=!0,r=!1,t?.()}}}var PG={Accept:`application/x-ndjson, application/json`};function FG(e){return!e.ok||!e.body?!1:(e.headers.get(`content-type`)??``).includes(`application/x-ndjson`)}var IG=class extends Error{};function LG(e){return typeof e==`object`&&!!e&&`type`in e}async function RG(e){let t=e.body;if(!t)throw new IG(`Show All Files stream had no response body.`);let n=t.getReader(),r=new TextDecoder,i=[],a=!1,o=``,s=e=>{let t=e.trim();if(t.length===0)return!1;let n;try{n=JSON.parse(t)}catch{return console.warn(`[show-all-stream] dropping unparseable NDJSON line:`,t.slice(0,200)),!1}if(LG(n)){if(n.type===`error`)throw new IG(typeof n.problem?.title==`string`?n.problem.title:`Show All Files stream failed.`);return a=n.truncated===!0,!0}let r=An.safeParse(n);return r.success?i.push(r.data):console.warn(`[show-all-stream] dropping schema-divergent entry line:`,r.error.issues),!1};try{let e=!1;for(;!e;){let t=await n.read();if(t.done)break;o+=r.decode(t.value,{stream:!0});let i=o.indexOf(`
|
|
1942
1942
|
`);for(;i!==-1;){let t=s(o.slice(0,i));if(o=o.slice(i+1),t){e=!0;break}i=o.indexOf(`
|
|
1943
1943
|
`)}}o+=r.decode(),o.includes(`
|
|
1944
|
-
`)||s(o)}finally{n.releaseLock()}return{entries:i,truncated:a}}function
|
|
1945
|
-
${
|
|
1946
|
-
${
|
|
1947
|
-
${
|
|
1948
|
-
</svg>`,
|
|
1944
|
+
`)||s(o)}finally{n.releaseLock()}return{entries:i,truncated:a}}function zG(e,t,n,r=Date.now()){if(n.size===0)return[...e];let i=new Set(e.map(e=>lM(e))),a=[];for(let e of t){let t=lM(e);if(i.has(t)){n.delete(t);continue}let o=n.get(t);if(o!==void 0){if(r-o>5e3){n.delete(t);continue}a.push(e)}}return a.length===0?[...e]:[...e,...a]}function BG(e,t,n,r,i=Date.now()){if(t!==``&&!e.some(e=>lM(e)===t))return[...e];let a=[],o=[];for(let n of e)VG(t,lM(n))?a.push(n):o.push(n);let s=zG(n,a,r,i),c=new Set(s.map(e=>lM(e)).filter(e=>e.endsWith(`/`)));return[...o.filter(e=>{let n=lM(e);if(!n.startsWith(t))return!0;let r=n.slice(t.length),i=r.indexOf(`/`);return i===-1?!0:c.has(t+r.slice(0,i+1))}),...s]}function VG(e,t){if(!t.startsWith(e))return!1;let n=t.slice(e.length);if(n===``)return!1;let r=n.endsWith(`/`)?n.slice(0,-1):n;return r!==``&&!r.includes(`/`)}function HG(e){return e?hs._({id:`wTcjov`}):null}function UG(e){let t=(0,$.c)(29),{_:n}=i(),r=pg(),a=Wx();if(r)return null;let{input:o,installStates:c,dispatch:l}=e,u=o===null,d,f,p,m,h,g;if(t[0]!==n||t[1]!==l||t[2]!==o||t[3]!==u||t[4]!==c||t[5]!==a){let e=HG(u),r;t[12]===c?r=t[13]:(r=e=>c[e.id]?.installed===!0,t[12]=c,t[13]=r);let i=gg.filter(r),_;t[14]===c?_=t[15]:(_=gg.some(e=>c[e.id]?.installed==null),t[14]=c,t[15]=_);let v=_,y=i.length>0,b=a!==null,x=!y&&!b;f=Aa,t[16]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsxs)(co,{children:[(0,Z.jsx)(bi,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`O7_W_a`})]}),t[16]=g):g=t[16],d=Ua,p=y?(0,Z.jsxs)(Ra,{"aria-label":n({id:`BBqGS9`}),children:[(0,Z.jsx)(Xa,{children:(0,Z.jsx)(s,{id:`BBqGS9`})}),i.map(t=>{let r=!u,{displayName:i}=t,a=n(e?{id:`1ZpfyB`,values:{displayName:i,hint:e}}:{id:`WqLq6M`,values:{displayName:i}});return(0,Z.jsxs)(Da,{disabled:!r,onSelect:()=>{o&&l(t.id,o)},"data-testid":`file-tree-open-in-${t.id}`,"aria-label":a,children:[(0,Z.jsx)(Vx,{id:t.id,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:t.displayName}),e?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t.id)})]}):null,t[17]!==v||t[18]!==x?(m=x?(0,Z.jsx)(Da,{disabled:!0,"data-testid":`file-tree-open-in-empty`,children:v?(0,Z.jsx)(s,{id:`EcR0fl`}):(0,Z.jsx)(s,{id:`l6OXqI`})}):null,t[17]=v,t[18]=x,t[19]=m):m=t[19],h=b?(0,Z.jsxs)(Z.Fragment,{children:[y?(0,Z.jsx)(ro,{}):null,(0,Z.jsxs)(Ra,{"aria-label":n({id:`ALhMYW`}),children:[(0,Z.jsx)(Xa,{children:(0,Z.jsx)(s,{id:`ALhMYW`})}),(0,Z.jsxs)(Da,{onSelect:()=>{o!==null&&a.launchInTerminal(o)},disabled:u,"data-testid":`file-tree-open-in-terminal`,"aria-label":n(e?{id:`LtVw4J`,values:{hint:e}}:{id:`AcK_r0`}),children:[(0,Z.jsx)(ru,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`fcgvCA`})}),e?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]})]})]}):null,t[0]=n,t[1]=l,t[2]=o,t[3]=u,t[4]=c,t[5]=a,t[6]=d,t[7]=f,t[8]=p,t[9]=m,t[10]=h,t[11]=g}else d=t[6],f=t[7],p=t[8],m=t[9],h=t[10],g=t[11];let _;t[20]!==d||t[21]!==p||t[22]!==m||t[23]!==h?(_=(0,Z.jsxs)(d,{children:[p,m,h]}),t[20]=d,t[21]=p,t[22]=m,t[23]=h,t[24]=_):_=t[24];let v;return t[25]!==f||t[26]!==g||t[27]!==_?(v=(0,Z.jsxs)(f,{children:[g,_]}),t[25]=f,t[26]=g,t[27]=_,t[28]=v):v=t[28],v}var WG=v(`HOVER_INTENT_MS`,80),GG=3,KG=20,qG=new Map,JG=new Set,YG=[],XG=new Map;function ZG(e){for(XG.delete(e),XG.set(e,!0);XG.size>KG;){let e=XG.keys().next().value;if(e===void 0)break;XG.delete(e)}}function QG(e){JG.delete(e),eK()}function $G(e,t){let n=Date.now();ue(`ok/sidebar/prewarm-success`,{docName:e,t:n,poolEventId:t}),g(e,t,n)}function eK(){for(;JG.size<GG&&YG.length>0;){let e=YG.shift();if(!e)break;if(!XG.has(e.docName)){JG.add(e.docName),ZG(e.docName);try{let t=e.prewarm(e.docName);t&&$G(e.docName,t)}catch(t){ue(`ok/sidebar/prewarm-failed`,{docName:e.docName,message:t instanceof Error?t.message:String(t)})}finally{QG(e.docName)}}}}function tK(e,t){if(qe(e)||XG.has(e))return;let n=qG.get(e);n&&clearTimeout(n.timer);let r=setTimeout(()=>{if(qG.delete(e),JG.size>=GG){YG.push({docName:e,prewarm:t});return}ZG(e),JG.add(e);try{let n=t(e);n&&$G(e,n)}catch(t){ue(`ok/sidebar/prewarm-failed`,{docName:e,message:t instanceof Error?t.message:String(t)})}finally{QG(e)}},WG);qG.set(e,{timer:r,prewarm:t})}function nK(e){let t=qG.get(e);t&&(clearTimeout(t.timer),qG.delete(e))}var rK=/\.(md|mdx)$/i;function iK(e){let t=e.match(/^"(.+)" already exists\.$/);return t?t[1]:null}function aK(e){let t=e.match(rK);return t?t[0]:null}function oK(e){window.requestAnimationFrame(()=>{let t=q(e);if(!(!t||t.isDestroyed))try{t.commands.focus()}catch{}})}function sK(e){let t=e.current;t.row?.removeAttribute(bK),t.root?.removeAttribute(xK),e.current={row:null,root:null}}function cK(e,t){let n=e.current;n.row===t.row&&n.root===t.root||(sK(e),t.row?.setAttribute(bK,`true`),t.root?.setAttribute(xK,`true`),e.current={row:t.row,root:t.root})}async function lK(e,t){try{await navigator.clipboard.writeText(e),X.success(t===`full`?hs._({id:`6_ZOw4`}):hs._({id:`haHgQj`}),{description:e})}catch(e){console.warn(`[FileTree] clipboard write failed:`,e),X.error(t===`full`?hs._({id:`vfRlCI`}):hs._({id:`5QGTaA`}))}}var uK=new Set([`agents`,`agent`,`claude`,`skill`]),dK=`ok-file-tree-link-decoration`,fK=`ok-file-tree-agent-decoration`,pK=`ok-file-tree-markdown`,mK=`0 0 48 48`,hK=`<symbol id="${pK}" viewBox="${mK}" fill="none" stroke="currentColor" stroke-width="4.62651" stroke-linecap="round" stroke-linejoin="round"><path d="M3.18066 33.4398V13.5603L12.4337 22.8133L21.6867 13.5603V33.4398"/><path d="M38 13.5L38 33"/><path d="M44.8195 26.5L37.8797 33.4398L30.9399 26.5"/></symbol>`;function gK(e){return e.map(([e,{key:t,...n}])=>`<${e} ${Object.entries(n).map(([e,t])=>`${e}="${t}"`).join(` `)} />`).join(``)}function _K(e,t){return`<symbol id="${e}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${gK(t)}</symbol>`}var vK=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
|
|
1945
|
+
${_K(dK,D)}
|
|
1946
|
+
${_K(fK,al)}
|
|
1947
|
+
${hK}
|
|
1948
|
+
</svg>`,yK=`
|
|
1949
1949
|
[data-file-tree-virtualized-root][data-file-tree-root-drag-target="true"] {
|
|
1950
1950
|
position: relative;
|
|
1951
1951
|
}
|
|
@@ -1968,15 +1968,15 @@ Error generating stack: `+e.message+`
|
|
|
1968
1968
|
border: 2px solid Highlight;
|
|
1969
1969
|
}
|
|
1970
1970
|
}
|
|
1971
|
-
`,
|
|
1972
|
-
[data-type="item"][${
|
|
1971
|
+
`,bK=`data-ok-external-file-drop-target`,xK=`data-ok-external-file-drop-root-target`,SK=`__external-file-drop__`,CK=2e3,wK=`
|
|
1972
|
+
[data-type="item"][${bK}="true"] {
|
|
1973
1973
|
background: color-mix(in oklab, var(--color-primary) 10%, transparent);
|
|
1974
1974
|
box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--color-primary) 72%, transparent);
|
|
1975
1975
|
}
|
|
1976
|
-
[data-file-tree-virtualized-root][${
|
|
1976
|
+
[data-file-tree-virtualized-root][${xK}="true"] {
|
|
1977
1977
|
position: relative;
|
|
1978
1978
|
}
|
|
1979
|
-
[data-file-tree-virtualized-root][${
|
|
1979
|
+
[data-file-tree-virtualized-root][${xK}="true"]::after {
|
|
1980
1980
|
content: "";
|
|
1981
1981
|
position: absolute;
|
|
1982
1982
|
inset: 0;
|
|
@@ -1987,16 +1987,16 @@ Error generating stack: `+e.message+`
|
|
|
1987
1987
|
pointer-events: none;
|
|
1988
1988
|
}
|
|
1989
1989
|
@media (forced-colors: active) {
|
|
1990
|
-
[data-type="item"][${
|
|
1990
|
+
[data-type="item"][${bK}="true"] {
|
|
1991
1991
|
outline: 2px solid Highlight;
|
|
1992
1992
|
outline-offset: -2px;
|
|
1993
1993
|
}
|
|
1994
|
-
[data-file-tree-virtualized-root][${
|
|
1994
|
+
[data-file-tree-virtualized-root][${xK}="true"]::after {
|
|
1995
1995
|
border: 2px solid Highlight;
|
|
1996
1996
|
}
|
|
1997
1997
|
}
|
|
1998
|
-
`,
|
|
1999
|
-
:host([${
|
|
1998
|
+
`,TK=`data-ok-creation-cleared`,EK=`${PW}\n${QW}\n${yK}\n${wK}\n${`
|
|
1999
|
+
:host([${TK}]) [data-item-focused="true"] {
|
|
2000
2000
|
--trees-focus-ring-color: transparent;
|
|
2001
2001
|
}
|
|
2002
|
-
`}\n${kW}\n${AW}`;function OK(e){let t=e.split(`/`).pop()?.replace(/\.md$/i,``).toLowerCase();return!!t&&dK.has(t)}function kK(e){return e===`darwin`?hs._({id:`LtSYdi`}):e===`win32`?hs._({id:`qi1F96`}):hs._({id:`e1Rn_k`})}function AK(e){let t=(0,$.c)(18),{item:n,workspace:r,onClose:a}=e,{_:o}=i(),s=typeof window<`u`?window.okDesktop:void 0;if(!s)return null;let c=s.platform,l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=kK(c),t[0]=l):l=t[0];let u=l,d,f;t[1]!==o||t[2]!==r?(d=r?null:o({id:`wTcjov`}),f=o(c===`darwin`?d?{id:`FvpFSZ`,values:{hint:d}}:{id:`LtSYdi`}:c===`win32`?d?{id:`o4dcAf`,values:{hint:d}}:{id:`qi1F96`}:d?{id:`zUhPuR`,values:{hint:d}}:{id:`e1Rn_k`}),t[1]=o,t[2]=r,t[3]=d,t[4]=f):(d=t[3],f=t[4]);let p=f,m=!r,h;t[5]!==n||t[6]!==a||t[7]!==r?(h=()=>{if(!r)return;a();let e=Zg(r.contentDir,wM(n),r.pathSeparator);s.shell.showItemInFolder(e)},t[5]=n,t[6]=a,t[7]=r,t[8]=h):h=t[8];let g,_;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(ie,{"aria-hidden":`true`}),_=(0,Z.jsx)(`span`,{className:`flex-1`,children:u}),t[9]=g,t[10]=_):(g=t[9],_=t[10]);let v;t[11]===d?v=t[12]:(v=d?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:d}):null,t[11]=d,t[12]=v);let y;return t[13]!==p||t[14]!==m||t[15]!==h||t[16]!==v?(y=(0,Z.jsxs)(Da,{disabled:m,onSelect:h,"aria-label":p,children:[g,_,v]}),t[13]=p,t[14]=m,t[15]=h,t[16]=v,t[17]=y):y=t[17],y}function jK(e,t){return CM({kind:e.endsWith(`/`)?`directory`:`file`,name:e,path:e},t)}function MK(e,t){return e!==t&&e.startsWith(t)}function NK(e,t){let n=[...new Set(e)],r=n.filter(e=>e.endsWith(`/`));return n.filter(e=>!r.some(t=>MK(e,t))).map(e=>jK(e,t))}function PK(e,t){return e===t||e.startsWith(`${t}/`)}function FK(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName;return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`||e.isContentEditable||e.closest(`[contenteditable="true"]`)!==null}function IK(e,t,n){let r=new Set,i=new Set,a=new Set;for(let o of e){if(o.kind===`file`){r.add(o.path);continue}if(o.kind===`asset`){a.add(o.path);continue}i.add(o.path);for(let e of t)ps(e)&&e.docName.startsWith(`${o.path}/`)?r.add(e.docName):zo(e)&&e.path.startsWith(`${o.path}/`)&&a.add(e.path);for(let e of n){let t=fM(e);PK(t,o.path)&&i.add(t)}}return{docNames:r,folderPaths:i,assetPaths:a}}function LK(e,t){return e.kind===`file`?t.kind===`file`&&e.path===t.createdPath:e.kind===`asset`?!1:PK(t.createdPath,e.path)}function RK(e){let t=(0,$.c)(60),{item:n,context:r,anyActionBusy:a,workspace:o,handoff:c,model:l,okignoreBinding:u,projectLocalBinding:d,mergedConfig:f,onStartCreating:p,onCreateFromTemplate:m,onDuplicate:h,onDelete:g,onExpandSubtree:_,onCollapseSubtree:v,folderTreePaths:y,isAsset:b,documents:x}=e,{_:S}=i(),C=CM(n,x),w=n.kind===`directory`,T=C.kind===`asset`?null:C,E=T!==null&&u!==null,D;t[0]!==S||t[1]!==w?(D=S(w?{id:`5D3Ior`}:{id:`dbhUX1`}),t[0]=S,t[1]=w,t[2]=D):D=t[2];let O=D,k=f?.appearance?.sidebar?.showHiddenFiles??!1,A=f?.appearance?.sidebar?.showAllFiles??!0,j=d!==null,M;t[3]!==w||t[4]!==n.path?(M=w?fM(n.path):null,t[3]=w,t[4]=n.path,t[5]=M):M=t[5];let N=Ha(M),P=N.state.status===`ready`?(N.state.data.folder.templates_available?.length??0)>0:!0,F=l.getSelectedPaths(),I=F.includes(C.treePath)?NK(F,x):[],L=I.length>1?I:[C],R=L.length,z=hs._({id:`djjdjr`,values:{deleteCount:R}}),B;t[6]!==b||t[7]!==w||t[8]!==n||t[9]!==o?(B=b?null:w?r_({folderRelativePath:wM(n),workspace:o}):$g({docName:lM(n.path),workspace:o}),t[6]=b,t[7]=w,t[8]=n,t[9]=o,t[10]=B):B=t[10];let V=B,H;t[11]===r?H=t[12]:(H=()=>r.close({restoreFocus:!1}),t[11]=r,t[12]=H);let U=H,W;t[13]===r?W=t[14]:(W=()=>r.close(),t[13]=r,t[14]=W);let G=W,q;t[15]!==S||t[16]!==d?(q=e=>{if(d===null)return;let t=d.patch({appearance:{sidebar:{showHiddenFiles:e}}});t.ok||(console.warn(`[FileTree] showHiddenFiles toggle rejected:`,Vr(t.error)),X.error(S({id:`P47EWZ`}),{description:Vr(t.error)}))},t[15]=S,t[16]=d,t[17]=q):q=t[17];let J=q,ee;t[18]!==S||t[19]!==d?(ee=e=>{if(d===null)return;let t=d.patch({appearance:{sidebar:{showAllFiles:e}}});t.ok||(console.warn(`[FileTree] showAllFiles toggle rejected:`,Vr(t.error)),X.error(S({id:`P47EWZ`}),{description:Vr(t.error)}))},t[18]=S,t[19]=d,t[20]=ee):ee=t[20];let te=ee,ne=0,re=0;if(w){let e=pM(n.path);for(let t of y)(t===e||t.startsWith(e))&&(ne++,SG(l.getItem(t))?.isExpanded()&&re++)}let Y=w&&re<ne,ie=w&&re>0,ae;t[21]===G?ae=t[22]:(ae=e=>{e||G()},t[21]=G,t[22]=ae);let oe;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,Z.jsx)(ja,{asChild:!0,children:(0,Z.jsx)(`span`,{"aria-hidden":`true`,"data-file-tree-context-menu-root":`true`,className:`block size-px`})}),t[23]=oe):oe=t[23];let ce;t[24]!==S||t[25]!==a||t[26]!==E||t[27]!==j||t[28]!==G||t[29]!==U||t[30]!==z||t[31]!==L||t[32]!==P||t[33]!==te||t[34]!==J||t[35]!==c||t[36]!==V||t[37]!==O||t[38]!==b||t[39]!==w||t[40]!==n||t[41]!==l||t[42]!==u||t[43]!==T||t[44]!==v||t[45]!==m||t[46]!==g||t[47]!==h||t[48]!==_||t[49]!==p||t[50]!==A||t[51]!==k||t[52]!==ie||t[53]!==Y||t[54]!==C||t[55]!==o?(ce=(0,Z.jsx)(to,{sideOffset:0,align:`start`,"data-file-tree-context-menu-root":`true`,className:`min-w-52`,children:w?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Da,{disabled:a,onSelect:()=>{U(),p(`file`,fM(n.path))},children:[(0,Z.jsx)(nu,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`HdkSiO`})]}),P?(0,Z.jsxs)(Aa,{children:[(0,Z.jsxs)(co,{disabled:a,children:[(0,Z.jsx)(La,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`Uuj_R4`})]}),(0,Z.jsx)(Ua,{children:(0,Z.jsx)(xG,{parentDir:fM(n.path),onSelectTemplate:e=>{U(),m(fM(n.path),e)},ItemComponent:Da})})]}):null,(0,Z.jsxs)(Da,{disabled:a,onSelect:()=>{U(),p(`folder`,fM(n.path))},children:[(0,Z.jsx)(Cl,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`96G6Re`})]}),(0,Z.jsx)(ro,{}),(0,Z.jsx)(AK,{item:n,workspace:o,onClose:G}),(0,Z.jsx)(WG,{input:V,installStates:c.installStates,isElectronHost:c.isElectronHost,dispatch:c.dispatch}),(0,Z.jsxs)(Aa,{children:[(0,Z.jsxs)(co,{children:[(0,Z.jsx)(nt,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`oCZkaG`})]}),(0,Z.jsxs)(Ua,{children:[(0,Z.jsx)(Da,{disabled:!o,onSelect:()=>{o&&(G(),uK(Zg(o.contentDir,wM(n),o.pathSeparator),`full`))},children:(0,Z.jsx)(s,{id:`oQA-cA`})}),(0,Z.jsx)(Da,{onSelect:()=>{G(),uK(wM(n),`relative`)},children:(0,Z.jsx)(s,{id:`s061i4`})})]})]}),(0,Z.jsx)(ro,{}),(0,Z.jsx)(qa,{checked:k,onCheckedChange:J,disabled:!j,"data-testid":`file-tree-menu-show-hidden-files`,children:(0,Z.jsx)(s,{id:`XcGbim`})}),(0,Z.jsx)(qa,{checked:A,onCheckedChange:te,disabled:!j,"data-testid":`file-tree-menu-show-all-files`,children:(0,Z.jsx)(s,{id:`i8dKs-`})}),Y||ie?(0,Z.jsx)(ro,{}):null,Y?(0,Z.jsxs)(Da,{onSelect:()=>{G(),_(n.path)},children:[(0,Z.jsx)(mu,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`OlAl5i`})]}):null,ie?(0,Z.jsxs)(Da,{onSelect:()=>{G(),v(n.path)},children:[(0,Z.jsx)(xl,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`qvWGzP`})]}):null,(0,Z.jsx)(ro,{}),(0,Z.jsxs)(Da,{disabled:a,onSelect:()=>{C.kind!==`asset`&&(G(),h(C))},children:[(0,Z.jsx)(Fe,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`euc6Ns`})]}),(0,Z.jsxs)(Da,{disabled:a,onSelect:()=>{U(),l.startRenaming(n.path)},children:[(0,Z.jsx)(se,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`2wxgft`})]}),(0,Z.jsxs)(Da,{"data-testid":`file-tree-menu-hide`,disabled:!E,onSelect:()=>{if(!u||!T)return;G();let e=qW(T),t=so(u.current()),n=Ja(t,e);if(n===t)return;u.patch(Za(n));let r=T.path.split(`/`).pop()||T.path;X.success(S({id:`4xtLTl`,values:{basename:r}}),{description:S({id:`nWv1ja`}),duration:5e3})},children:[(0,Z.jsx)(_t,{"aria-hidden":`true`}),O]}),(0,Z.jsxs)(Da,{variant:`destructive`,disabled:a,onSelect:()=>{G(),g(L)},children:[(0,Z.jsx)(K,{"aria-hidden":`true`}),z]})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(AK,{item:n,workspace:o,onClose:G}),!b&&(0,Z.jsx)(WG,{input:V,installStates:c.installStates,isElectronHost:c.isElectronHost,dispatch:c.dispatch}),(0,Z.jsxs)(Aa,{children:[(0,Z.jsxs)(co,{children:[(0,Z.jsx)(nt,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`oCZkaG`})]}),(0,Z.jsxs)(Ua,{children:[(0,Z.jsx)(Da,{disabled:!o,onSelect:()=>{o&&(G(),uK(Zg(o.contentDir,wM(n),o.pathSeparator),`full`))},children:(0,Z.jsx)(s,{id:`oQA-cA`})}),(0,Z.jsx)(Da,{onSelect:()=>{G(),uK(wM(n),`relative`)},children:(0,Z.jsx)(s,{id:`s061i4`})})]})]}),(0,Z.jsx)(ro,{}),b?null:(0,Z.jsxs)(Da,{disabled:a,onSelect:()=>{G(),h(C)},children:[(0,Z.jsx)(Fe,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`euc6Ns`})]}),(0,Z.jsxs)(Da,{disabled:a,onSelect:()=>{U(),l.startRenaming(n.path)},children:[(0,Z.jsx)(se,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`2wxgft`})]}),T?(0,Z.jsxs)(Da,{"data-testid":`file-tree-menu-hide`,disabled:!E,onSelect:()=>{if(!u)return;G();let e=qW(T),t=so(u.current()),n=Ja(t,e);if(n===t)return;u.patch(Za(n));let r=T.path.split(`/`).pop()||T.path;X.success(S({id:`OD0FCX`,values:{basename:r}}),{description:S({id:`nWv1ja`}),duration:5e3})},children:[(0,Z.jsx)(_t,{"aria-hidden":`true`}),O]}):null,(0,Z.jsxs)(Da,{variant:`destructive`,disabled:a,onSelect:()=>{G(),g(L)},children:[(0,Z.jsx)(K,{"aria-hidden":`true`}),z]})]})}),t[24]=S,t[25]=a,t[26]=E,t[27]=j,t[28]=G,t[29]=U,t[30]=z,t[31]=L,t[32]=P,t[33]=te,t[34]=J,t[35]=c,t[36]=V,t[37]=O,t[38]=b,t[39]=w,t[40]=n,t[41]=l,t[42]=u,t[43]=T,t[44]=v,t[45]=m,t[46]=g,t[47]=h,t[48]=_,t[49]=p,t[50]=A,t[51]=k,t[52]=ie,t[53]=Y,t[54]=C,t[55]=o,t[56]=ce):ce=t[56];let le;return t[57]!==ce||t[58]!==ae?(le=(0,Z.jsxs)(oo,{open:!0,modal:!1,onOpenChange:ae,children:[oe,ce]}),t[57]=ce,t[58]=ae,t[59]=le):le=t[59],le}async function zK(e,t,n,r){try{let i=await fetch(`/api/documents?showAll=true&dir=${encodeURIComponent(e)}&depth=1`,{signal:t,headers:FG});if(IG(i)){let e=await zG(i);return{kind:`entries`,entries:Bo(e.entries),truncated:e.truncated}}let a=await ve(i,n);if(!a.ok)return{kind:`http-error`,title:a.title};let o=jr.safeParse(a.body);return o.success?{kind:`entries`,entries:Bo(o.data.documents),truncated:o.data.truncated===!0}:{kind:`http-error`,title:r}}catch(e){return e instanceof LG?{kind:`http-error`,title:e.message}:{kind:`network-error`,cause:e}}}function BK(e){let t=(0,$.c)(356),{ref:n}=e,{_:r,i18n:a}=i(),{activeDocName:o,activeTarget:c,closeTabs:l,closeDocument:u,closeAndClearForRename:d,getPoolActiveDocName:f,poolHas:p,isNewTabActive:m,openTarget:h,prewarm:g,remapTabsForRename:_}=ht(),{notifySidebarFileSelected:v}=fA(),{resolvedTheme:y}=Pr(),{addPage:b,pageMeta:x}=is(),S;t[0]===x?S=t[1]:(S=function(e,t){return ds(e,t??x.get(e)?.size)??{kind:`doc`,target:e,docName:e}},t[0]=x,t[1]=S);let C=S,w;t[2]!==C||t[3]!==v||t[4]!==h?(w=function(e,t){h(C(e,t),{tabBehavior:`replace-active`}),Xo(Ho(e)),v()},t[2]=C,t[3]=v,t[4]=h,t[5]=w):w=t[5];let T=w,E;t[6]!==v||t[7]!==h?(E=function(e){let t=Wo(e);h({kind:`folder`,target:e,folderPath:e},{tabBehavior:`replace-active`}),Xo(t),v()},t[6]=v,t[7]=h,t[8]=E):E=t[8];let D=E,O;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(O=[],t[9]=O):O=t[9];let[k,j]=(0,Q.useState)(O),[M,N]=(0,Q.useState)(!0),[P,F]=(0,Q.useState)(null),[I,L]=(0,Q.useState)(!1),R=cm(),z=(0,Q.useRef)(null),[B,V]=(0,Q.useState)(null),[H,U]=(0,Q.useState)(null),[W,G]=(0,Q.useState)(null),[K,q]=(0,Q.useState)(null),{conflicts:J}=Fi(),[ee,te]=(0,Q.useState)(null),[ne,re]=(0,Q.useState)(null),[Y,ie]=(0,Q.useState)(!1),ae=(0,Q.useRef)(Y),se;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(se=new Set,t[10]=se):se=t[10];let ce=(0,Q.useRef)(se),le=(0,Q.useRef)(k),ue=(0,Q.useRef)(x),de;t[11]!==k||t[12]!==D||t[13]!==T||t[14]!==v||t[15]!==h?(de=function(e,t){let n=t===void 0?k:t,r=cG(e,n);if(r.kind===`none`){console.debug(`[FileTree] Dropped selection for unknown docName:`,mM(e));return}if(r.kind===`asset`){h({kind:`asset`,target:r.path,assetPath:r.path,mediaKind:r.mediaKind},{tabBehavior:`replace-active`}),Xo(r.hash),v();return}if(r.kind===`folder`){D(r.path);return}let i=n.find(e=>ps(e)&&e.docName===r.path);T(r.path,i?.size)},t[11]=k,t[12]=D,t[13]=T,t[14]=v,t[15]=h,t[16]=de):de=t[16];let fe=de,pe;t[17]!==v||t[18]!==h?(pe=function(e,t){h({kind:`asset`,target:e,assetPath:e,mediaKind:(t??le.current).find(t=>zo(t)&&t.path===e)?.mediaKind??null},{tabBehavior:`replace-active`}),Xo(Yo(e)),v()},t[17]=v,t[18]=h,t[19]=pe):pe=t[19];let me=pe,he=(0,Q.useRef)(o),ge;t[20]===k?ge=t[21]:(ge=new Set(k.filter(zo).map(pq)),t[20]=k,t[21]=ge);let _e=ge,ye=(0,Q.useRef)(_e),be;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(be=[],t[22]=be):be=t[22];let xe=(0,Q.useRef)(be),Se=(0,Q.useRef)(null),Ce=(0,Q.useRef)(fq),we=(0,Q.useRef)(null),Te=(0,Q.useRef)(null),Ee=(0,Q.useRef)(!1),De=(0,Q.useRef)(!1),Oe=(0,Q.useRef)(null),ke;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(ke={row:null,root:null},t[23]=ke):ke=t[23];let Ae=(0,Q.useRef)(ke),je=(0,Q.useRef)(dq),Me=(0,Q.useRef)(null),Ne;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=new Map,t[24]=Ne):Ne=t[24];let Pe=(0,Q.useRef)(Ne),Fe;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(Fe=new Set,t[25]=Fe):Fe=t[25];let Ie=(0,Q.useRef)(Fe),Le;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(Le=new Map,t[26]=Le):Le=t[26];let Re=(0,Q.useRef)(Le),ze=(0,Q.useRef)(0),Be;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(Be=new Set,t[27]=Be):Be=t[27];let Ve=(0,Q.useRef)(Be),He=(0,Q.useRef)(uq),Ue=(0,Q.useRef)(lq),We=(0,Q.useRef)(!1),Ge=(0,Q.useRef)(!0),Ke=(0,Q.useRef)(null),qe=(0,Q.useRef)(null),Je=(0,Q.useRef)(cq),Ye=(0,Q.useRef)(sq),Xe=(0,Q.useRef)(oq),Ze=(0,Q.useRef)(aq),Qe=(0,Q.useRef)(c),[$e,tt]=(0,Q.useState)(!1),nt;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(nt=function(){z.current!==null&&(clearTimeout(z.current),z.current=null)},t[28]=nt):nt=t[28];let rt=nt,it;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(it=function(){rt(),L(!1)},t[29]=it):it=t[29];let at=it,ot;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(ot=function(e){at(),F(e)},t[30]=ot):ot=t[30];let st=ot,ct;t[31]===r?ct=t[32]:(ct=function(){if(rt(),im()){F(null),L(!0),z.current=setTimeout(()=>{z.current=null,Ke.current?.()},wK);return}L(!1),F(r({id:`34qyH5`}))},t[31]=r,t[32]=ct);let lt=ct,ut=(0,Q.useRef)(!0),dt;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(dt=()=>{if(ut.current){ut.current=!1;return}Ke.current?.()},t[33]=dt):dt=t[33];let ft;t[34]===R?ft=t[35]:(ft=[R],t[34]=R,t[35]=ft),(0,Q.useEffect)(dt,ft);let pt,mt;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(pt=()=>rt,mt=[],t[36]=pt,t[37]=mt):(pt=t[36],mt=t[37]),(0,Q.useEffect)(pt,mt);let gt,_t;t[38]!==k.length||t[39]!==M?(gt=()=>{if(M||k.length===0)return;let e=qe.current?.querySelector(yF)?.shadowRoot;if(!e)return;let t=e,n=function(){Oe.current!==null&&clearTimeout(Oe.current),Oe.current=setTimeout(()=>{De.current=!1,Oe.current=null},0)},r=function(e){if(!(e instanceof DragEvent))return;let t=hq(e),n=t?.dataset.itemPath;if(!n)return;let r=pG(t.dataset.itemType===`folder`?pM(n):n,le.current,ue.current);r&&(Oe.current!==null&&(clearTimeout(Oe.current),Oe.current=null),De.current=!0,e.dataTransfer?.setData(VE,UE(r)))},i=function(e){if(!(e instanceof DragEvent)||!MM(e))return;let t=_q(e);if(!t){cK(Ae);return}e.preventDefault(),e.stopPropagation(),e.dataTransfer&&(e.dataTransfer.dropEffect=`copy`),lK(Ae,t)},a=function(e){if(!(e instanceof DragEvent)||!MM(e))return;let n=e.relatedTarget;n instanceof Node&&t.contains(n)||cK(Ae)},o=function(e){if(!(e instanceof DragEvent)||!MM(e))return;let t=_q(e),n=NM(e);if(!t||n.length===0){cK(Ae);return}e.preventDefault(),e.stopPropagation(),cK(Ae),je.current(n,t.parentDir,t.busyPath)};return e.addEventListener(`dragstart`,r,{capture:!0}),e.addEventListener(`dragover`,i,{capture:!0}),e.addEventListener(`dragleave`,a,{capture:!0}),e.addEventListener(`drop`,o,{capture:!0}),e.addEventListener(`dragend`,n,{capture:!0}),window.addEventListener(`drop`,n,!0),window.addEventListener(`dragend`,n,!0),()=>{e.removeEventListener(`dragstart`,r,{capture:!0}),e.removeEventListener(`dragover`,i,{capture:!0}),e.removeEventListener(`dragleave`,a,{capture:!0}),e.removeEventListener(`drop`,o,{capture:!0}),e.removeEventListener(`dragend`,n,{capture:!0}),window.removeEventListener(`drop`,n,!0),window.removeEventListener(`dragend`,n,!0),cK(Ae),Oe.current!==null&&(clearTimeout(Oe.current),Oe.current=null),De.current=!1}},_t=[k.length,M],t[38]=k.length,t[39]=M,t[40]=gt,t[41]=_t):(gt=t[40],_t=t[41]),(0,Q.useEffect)(gt,_t);let{selectedFilePath:vt,selectedFolderPath:yt,navigationPath:bt}=sG(c,m?null:o),xt=vt?cM(vt,k.find(e=>ps(e)&&e.docName===vt)?.docExt):yt?pM(yt):c?.kind===`asset`?c.assetPath:null,St=Y?null:xt,Ct=D_().states,{dispatch:Tt}=g_(),Et;t[42]!==Tt||t[43]!==Ct?(Et={installStates:Ct,isElectronHost:typeof window<`u`&&window.okDesktop!=null,dispatch:Tt},t[42]=Tt,t[43]=Ct,t[44]=Et):Et=t[44];let Dt=Et,{okignoreBinding:Ot,projectLocalBinding:kt,merged:At}=oe(),jt=At?.appearance?.sidebar?.showHiddenFiles??!1,Mt=At?.appearance?.sidebar?.showAllFiles??!0,Nt;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(Nt=()=>Me.current===null,t[45]=Nt):Nt=t[45];let Pt=Nt,Ft;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(Ft=[],t[46]=Ft):Ft=t[46];let It;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(It={set:`complete`,spriteSheet:yK,byFileExtension:{md:{name:mK,viewBox:hK},mdx:{name:mK,viewBox:hK}}},t[47]=It):It=t[47];let Lt;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(Lt={contextMenu:{enabled:!0,triggerMode:`both`,buttonVisibility:`when-needed`}},t[48]=Lt):Lt=t[48];let Rt;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(Rt={canDrag:Pt,canDrop:Pt,onDropComplete:e=>Ze.current(e),onDropError:iq},t[49]=Rt):Rt=t[49];let zt,Bt;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(zt={canRename:Pt,onRename:e=>Ye.current(e),onError:e=>Xe.current(e)},Bt=e=>Je.current(e),t[50]=zt,t[51]=Bt):(zt=t[50],Bt=t[51]);let Ht;t[52]===r?Ht=t[53]:(Ht={paths:Ft,initialExpansion:`closed`,fileTreeSearchMode:`hide-non-matches`,initialVisibleRowCount:18,stickyFolders:!0,...DW,icons:It,unsafeCSS:DK,composition:Lt,dragAndDrop:Rt,renaming:zt,onSelectionChange:Bt,renderRowDecoration:e=>{let{item:t}=e;if(t.kind===`file`){let e=le.current.find(e=>ps(e)&&cM(e.docName,e.docExt)===t.path);if(e?.isSymlink){let t=e.targetPath;return{icon:fK,title:r(t?{id:`JE21eh`,values:{targetPath:t}}:{id:`BQu9Pg`})}}return OK(t.path)?{icon:pK,title:r({id:`i9toLO`})}:null}let n=le.current.find(e=>Qo(e)&&pM(e.path)===pM(t.path));if(n?.isSymlink){let e=n.targetPath;return{icon:fK,title:r(e?{id:`JE21eh`,values:{targetPath:e}}:{id:`BQu9Pg`})}}return null}},t[52]=r,t[53]=Ht);let{model:Ut}=EW(Ht),Wt;t[54]===Ut?Wt=t[55]:(Wt=function(e){let t=Ut.getItem(e)??Ut.getItem(pM(e));return t?.isDirectory()?pM(fM(t.getPath())):e},t[54]=Ut,t[55]=Wt);let Gt=Wt,Kt,qt;t[56]===k?(Kt=t[57],qt=t[58]):(qt=hM(k),Kt=gM(qt),t[56]=k,t[57]=Kt,t[58]=qt);let Jt=Kt,Yt=(0,Q.useRef)(qt),Xt;t[59]===k?Xt=t[60]:(Xt=vM(k),t[59]=k,t[60]=Xt);let Zt=Xt,Qt=(0,Q.useRef)(Zt),$t=yt?yM(pM(yt)).slice(0,-1):yM(St??bt),en=$t.join(`\0`),tn;t[61]===Ut?tn=t[62]:(tn=()=>{let e=new Set;for(let t of Qt.current)SG(Ut.getItem(t))?.isExpanded()&&e.add(t);return e},t[61]=Ut,t[62]=tn);let nn=tn,rn;t[63]===nn?rn=t[64]:(rn=e=>{let t=new Set(vM(e??le.current)),n=nn();for(let e of xe.current)n.add(e);return[...n].filter(e=>t.has(e))},t[63]=nn,t[64]=rn);let an=rn,on;t[65]!==an||t[66]!==Ut?(on=e=>{let t=hM(e??le.current);Ut.resetPaths(t,{initialExpandedPaths:an(e)})},t[65]=an,t[66]=Ut,t[67]=on):on=t[67];let sn=on,cn;t[68]!==r||t[69]!==lt?(cn=async function(e){let t=ze.current,n=new AbortController;Re.current.set(e,n);let i=await zK(fM(e),n.signal,r({id:`8RtNI0`}),r({id:`HlmZBk`}));if(Re.current.get(e)===n&&Re.current.delete(e),n.signal.aborted||t!==ze.current)return;if(i.kind===`network-error`){lt(),console.warn(`[FileTree] lazy folder children fetch failed:`,e,i.cause);return}if(i.kind===`http-error`){console.warn(`[FileTree] lazy folder children http error:`,e,i.title),st(i.title);return}let a=We.current||Ge.current,o=Zo(i.entries,a);Ie.current.add(e),j(t=>VG(t,e,o,Pe.current)),F(null),at(),i.truncated&&V(i.entries.length)},t[68]=r,t[69]=lt,t[70]=cn):cn=t[70];let ln=cn,un;t[71]!==nn||t[72]!==ln?(un=()=>{let e=nn(),t=Ve.current;if(Ve.current=e,Ge.current)for(let n of e){if(t.has(n)||Ie.current.has(n)||Re.current.has(n))continue;let e=fM(n);le.current.find(t=>Qo(t)&&t.path===e)?.hasChildren!==!1&&ln(n)}},t[71]=nn,t[72]=ln,t[73]=un):un=t[73];let dn=un,fn;t[74]!==nn||t[75]!==ln?(fn=()=>{for(let e of nn())Ie.current.has(e)||Re.current.has(e)||ln(e)},t[74]=nn,t[75]=ln,t[76]=fn):fn=t[76];let pn=fn,mn;t[77]!==Ut||t[78]!==sn?(mn=(e,t,n,r)=>{let i=r===void 0?[]:r,a=0,o=null;for(let{fromDocName:r,toDocName:i}of n){let n=e.find(e=>ps(e)&&e.docName===r);if(n==null||Ut.getItem(i)==null)continue;let s=cM(i,t.find(e=>ps(e)&&e.docName===i)?.docExt??n.docExt);Ut.move(i,s),o=s,a+=1}for(let{toPath:e}of i){let t=nM(e);if(t===``)continue;let n=e.slice(0,-t.length);Ut.getItem(n)!=null&&(Ut.getItem(e)??Ut.move(n,e),o=e,a+=1)}a!==0&&(sn(t),o!=null&&Ut.focusPath(o))},t[77]=Ut,t[78]=sn,t[79]=mn):mn=t[79];let hn=mn,gn;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(gn=e=>{we.current=_M(e)},t[80]=gn):gn=t[80];let _n=gn,vn;t[81]===Symbol.for(`react.memo_cache_sentinel`)?(vn=e=>ye.current.has(e),t[81]=vn):vn=t[81];let yn=vn,bn;t[82]!==r||t[83]!==b||t[84]!==D||t[85]!==T||t[86]!==sn?(bn=async function(e){if(e.kind===`asset`||Me.current!==null)return;let t=()=>{U(null),Me.current=null};Me.current=e.path,U(e.path),F(null);try{let n=await ve(await fetch(`/api/duplicate-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e.kind,path:e.path})}),r({id:`dw_dUJ`}));if(!n.ok){X.error(n.title),sn(),t();return}let i=A(qn,n.body,`duplicate-path`,null);if(i===null){let e=r({id:`67f-3g`});X.error(e),F(e),cs([`files`,`backlinks`,`graph`]),sn(),t();return}for(let e of i.duplicatedDocNames)b(e);j(t=>{let n=UM(t,e,i);return sn(n),_n(n),n}),cs([`files`,`backlinks`,`graph`]),i.path!==e.path&&(i.kind===`folder`?D(i.path):T(i.path)),X.success(i.kind===`folder`?r({id:`iilQXA`}):r({id:`A6h5b-`}),{description:i.path}),t()}catch(e){let n=e,i=n instanceof Error?n.message:String(n);console.warn(`[FileTree] duplicate failed:`,n),X.error(r({id:`EBVbtP`}),{description:i}),sn(),t()}},t[82]=r,t[83]=b,t[84]=D,t[85]=T,t[86]=sn,t[87]=bn):bn=t[87];let xn=bn,Sn=(0,Q.useRef)(xn),Cn;t[88]===xn?Cn=t[89]:(Cn=()=>{Sn.current=xn},t[88]=xn,t[89]=Cn),(0,Q.useEffect)(Cn);let wn=function(e){let t=aK(e);if(!t||oK(t))return!1;let n=Ut.getFocusedPath()??Ut.getSelectedPaths()[0]??null;if(!n||n.endsWith(`/`)||yn(n))return!1;let r=oK(n);if(!r)return!1;let i=pM(t);if(!Qt.current.includes(i))return!1;let a=`${t}${r}`;return Yt.current.includes(a)?!1:(cr({sourcePath:n,destinationPath:a,isFolder:!1}),Ut.move(n,a),!0)},Tn;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(Tn=e=>{let t=e??Se.current;!t||Se.current!==t||(t.disposeCommitListener(),Se.current=null)},t[90]=Tn):Tn=t[90];let En=Tn,Dn;t[91]!==r||t[92]!==En||t[93]!==u||t[94]!==l||t[95]!==sn?(Dn=async function(e,t){let n=t===void 0?{}:t,i=n.updateUi??!0,a=n.restoreLocation??i;En(e),i&&U(e.renamePath);try{let t=await fetch(`/api/delete-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e.kind,path:e.createdPath})});if(!t.ok&&t.status!==404){let n=e.kind,a=e.createdPath,o=await ve(t,r({id:`EcM3k7`,values:{kind:n}}));if(o.ok)return;let s=o.title,c=r({id:`YPFBfr`,values:{detail:s,kind:n,createdPath:a}});i?X.error(c):console.warn(`[FileTree] cleanup pending create failed: ${c}`),i&&(U(null),sn());return}}catch(t){if(console.warn(`[FileTree] cleanup pending create failed:`,t),i){let t=e.kind,n=e.createdPath;X.error(r({id:`_TDESN`,values:{kind:t,createdPath:n}}))}i&&(U(null),sn());return}i&&(e.kind===`file`?u(e.createdPath):l([wt(e.createdPath)],{force:!0})),i&&j(t=>{let n=VM(t,e.kind===`file`?[e.createdPath]:[],e.kind===`folder`?e.createdPath:void 0);return _n(n),n}),cs([`files`,`backlinks`,`graph`]),a&&(window.location.hash=e.previousHash),i&&U(null)},t[91]=r,t[92]=En,t[93]=u,t[94]=l,t[95]=sn,t[96]=Dn):Dn=t[96];let On=Dn,kn,An;t[97]===Symbol.for(`react.memo_cache_sentinel`)?(kn=()=>()=>{let e=Se.current;e&&Ce.current(e,{restoreLocation:!1,updateUi:!1}).catch(rq)},An=[],t[97]=kn,t[98]=An):(kn=t[97],An=t[98]),(0,Q.useEffect)(kn,An);let jn;t[99]!==r||t[100]!==lt?(jn=()=>{let e=!0,t=null,n=PG(async function(){t?.abort();let n=new AbortController;t=n,ze.current+=1;for(let e of Re.current.values())e.abort();Re.current.clear(),Ie.current.clear();try{let t=Ge.current,i=await fetch(t?`/api/documents?showAll=true&dir=&depth=1`:`/api/documents`,{signal:n.signal,headers:t?FG:void 0});if(t&&IG(i)){let{entries:n,truncated:r}=await zG(i);if(!e)return;let a=We.current||t,o=Zo(Bo(n),a);j(e=>VG(e,``,o,Pe.current)),F(null),at(),V(r?n.length:null),Ue.current()}else{let n=await ve(i,r({id:`8RtNI0`}));if(!e)return;if(!n.ok)st(n.title),V(null);else{let e=jr.safeParse(n.body);if(!e.success)st(r({id:`HlmZBk`})),V(null);else{let n=We.current||t,r=Zo(Bo(e.data.documents),n);j(t?e=>VG(e,``,r,Pe.current):BG(r,le.current,Pe.current)),F(null),at(),V(t&&e.data.truncated===!0?e.data.documents.length:null),t&&Ue.current()}}}}catch(t){let r=t;if(n.signal.aborted)return;e&&(r instanceof LG?st(r.message):lt()),console.warn(`[FileTree] fetch failed:`,r)}e&&N(!1)},()=>t?.abort());Ke.current=()=>n.request(),n.request();let i=()=>{document.visibilityState===`visible`&&n.request()};window.addEventListener(`focus`,i),window.addEventListener(`visibilitychange`,i);let a=es(e=>{e.includes(`files`)&&n.request()});return()=>{e=!1,Ke.current=null,n.dispose();for(let e of Re.current.values())e.abort();Re.current.clear(),window.removeEventListener(`focus`,i),window.removeEventListener(`visibilitychange`,i),a()}},t[99]=r,t[100]=lt,t[101]=jn):jn=t[101];let Mn;t[102]===r?Mn=t[103]:(Mn=[r],t[102]=r,t[103]=Mn),(0,Q.useEffect)(jn,Mn);let Nn=(0,Q.useRef)(!0),Pn;t[104]===Symbol.for(`react.memo_cache_sentinel`)?(Pn=()=>{if(Nn.current){Nn.current=!1;return}Ke.current?.()},t[104]=Pn):Pn=t[104];let In;t[105]===jt?In=t[106]:(In=[jt],t[105]=jt,t[106]=In),(0,Q.useEffect)(Pn,In);let Rn=(0,Q.useRef)(!0),zn;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(zn=()=>{if(Rn.current){Rn.current=!1;return}Ke.current?.()},t[107]=zn):zn=t[107];let Bn;t[108]===Mt?Bn=t[109]:(Bn=[Mt],t[108]=Mt,t[109]=Bn),(0,Q.useEffect)(zn,Bn);let Vn,Hn;t[110]===Symbol.for(`react.memo_cache_sentinel`)?(Vn=()=>{let e=!0;return fetch(`/api/workspace`).then(async t=>{let n=await t.json();if(!e||!t.ok)return;let r=A(Ln,n,`workspace`,null);r&&re({contentDir:r.contentDir,pathSeparator:r.pathSeparator})}).catch(nq),()=>{e=!1}},Hn=[],t[110]=Vn,t[111]=Hn):(Vn=t[110],Hn=t[111]),(0,Q.useEffect)(Vn,Hn);let Un;t[112]!==an||t[113]!==Ut||t[114]!==Jt?(Un=()=>{if(we.current===Jt){we.current=null;return}Ut.resetPaths(Yt.current,{initialExpandedPaths:an()})},t[112]=an,t[113]=Ut,t[114]=Jt,t[115]=Un):Un=t[115];let Wn;t[116]!==Ut||t[117]!==Jt?(Wn=[Ut,Jt],t[116]=Ut,t[117]=Jt,t[118]=Wn):Wn=t[118],(0,Q.useEffect)(Un,Wn),wG(Ut,St,en,Ee,Jt);let Gn;t[119]===Symbol.for(`react.memo_cache_sentinel`)?(Gn=()=>{ie(!1)},t[119]=Gn):Gn=t[119];let Kn;t[120]===xt?Kn=t[121]:(Kn=[xt],t[120]=xt,t[121]=Kn),(0,Q.useEffect)(Gn,Kn);let Jn,Yn;t[122]===Y?(Jn=t[123],Yn=t[124]):(Jn=()=>{ae.current=Y;for(let e of ce.current)e()},Yn=[Y],t[122]=Y,t[123]=Jn,t[124]=Yn),(0,Q.useEffect)(Jn,Yn);let Xn;t[125]!==St||t[126]!==M||t[127]!==Ut?(Xn=()=>{M||!St||aG(Ut)},t[125]=St,t[126]=M,t[127]=Ut,t[128]=Xn):Xn=t[128];let Zn;t[129]!==en||t[130]!==St||t[131]!==M||t[132]!==Ut||t[133]!==Jt?(Zn=[St,en,Jt,M,Ut],t[129]=en,t[130]=St,t[131]=M,t[132]=Ut,t[133]=Jt,t[134]=Zn):Zn=t[134],(0,Q.useEffect)(Xn,Zn);let $n,er;t[135]===Ut?($n=t[136],er=t[137]):($n=()=>Ut.subscribe(()=>{if(!Ut.isSearchOpen())for(let e of xe.current){let t=SG(Ut.getItem(e));t&&!t.isExpanded()&&t.expand()}}),er=[Ut],t[135]=Ut,t[136]=$n,t[137]=er),(0,Q.useEffect)($n,er);let tr,rr;t[138]===Ut?(tr=t[139],rr=t[140]):(tr=()=>Ut.subscribe(()=>He.current()),rr=[Ut],t[138]=Ut,t[139]=tr,t[140]=rr),(0,Q.useEffect)(tr,rr);let ir,ar;t[141]===Ut?(ir=t[142],ar=t[143]):(ir=()=>Ut.onMutation(`remove`,e=>{let t=Se.current;!t||e.path!==t.renamePath||Ce.current(t)}),ar=[Ut],t[141]=Ut,t[142]=ir,t[143]=ar),(0,Q.useEffect)(ir,ar);let or;t[144]!==b||t[145]!==d||t[146]!==f||t[147]!==me||t[148]!==D||t[149]!==T||t[150]!==p||t[151]!==hn||t[152]!==_?(or=async(e,t,n,r,i)=>{let a=t===void 0?[]:t,o=n===void 0?[]:n,s=i===void 0?[]:i,c=r?.docName??he.current,l=new Map,u=new Map;for(let e of le.current){if(ps(e)){let t=o.find(t=>t.fromPath===cM(e.docName,e.docExt))?.toPath;t&&l.set(e.docName,t);continue}if(zo(e)){let t=o.find(t=>t.fromPath===e.path)?.toPath;t&&iM(t)&&u.set(e.path,lM(t))}}let m=c?l.get(c)??null:null,h=r?.folderPath??(Qe.current?.kind===`folder`?Qe.current.folderPath:null),g=h?et(h,a):null,v=r?.assetPath??(Qe.current?.kind===`asset`?Qe.current.assetPath:null),y=v?u.get(v)??null:null,x=m?null:y??WM(c,e),S=m??(v?y?null:o.find(e=>e.fromPath===v)?.toPath??et(v,a):null);Vt(e);let C=[...GM(e,f(),p),...l.keys()];await Promise.all(C.map(e=>d(e)));for(let t of e)b(t.toDocName);for(let e of u.values())b(e);_(e,a,o);let w=null;j(t=>{let n=BM(t,e,a,o,s);return w=n,hn(t,n,e,o),_n(n),n}),h&&g&&g!==h?D(g):x&&x!==c?(T(x),sK(x)):S&&(m||S!==v)&&me(S,w??le.current),cs([`files`,`backlinks`,`graph`])},t[144]=b,t[145]=d,t[146]=f,t[147]=me,t[148]=D,t[149]=T,t[150]=p,t[151]=hn,t[152]=_,t[153]=or):or=t[153];let sr=or;async function cr(e){let t=!e.isFolder&&yn(e.sourcePath),n=t?e.sourcePath:TM(e.sourcePath,e.isFolder);U(n),F(null);try{let i=aM(e.sourcePath,e.destinationPath,e.isFolder),a=!e.isFolder&&!t&&!iM(i.destinationPath),o=t||a?i.destinationPath:TM(i.destinationPath,e.isFolder),s=e.isFolder?{kind:`folder`,fromPath:fM(n),toPath:fM(o)}:t||a?{kind:`asset`,fromPath:n,toPath:o}:{kind:`file`,fromPath:lM(n),toPath:o},c={docName:he.current,folderPath:Qe.current?.kind===`folder`?Qe.current.folderPath:null,assetPath:Qe.current?.kind===`asset`?Qe.current.assetPath:null},l=await ve(await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(s)}),r({id:`gijbne`}));if(!l.ok){X.error(l.title),sn();let e=Se.current;e&&e.renamePath===n?await On(e):En(),U(null);return}let u=A(Qr,l.body,`rename-path`,{renamed:[],renamedAssets:[]});try{await sr(u.renamed,e.isFolder?[{fromPath:fM(n),toPath:fM(o)}]:[],u.renamedAssets,c,!e.isFolder&&!t&&!a?u.renamed.flatMap(e=>{let t=nM(o);return t?[{toDocName:e.toDocName,docExt:t}]:[]}):[])}catch(e){console.warn(`[FileTree] post-rename reconciliation failed`,{err:e,sourceTreePath:n,destinationTreePath:o,renamedCount:u.renamed.length,renamedAssetCount:u.renamedAssets.length}),X.error(r({id:`dDpCOp`}))}En(),U(null)}catch(e){console.warn(`[FileTree] rename failed:`,e);let t=r({id:`HIb0vl`});X.error(t),F(t),sn();let i=Se.current;i&&i.renamePath===n?await On(i):En(),U(null)}}let lr;t[154]!==r||t[155]!==sr||t[156]!==sn?(lr=async function(e){let t=e.draggedPaths.map(t=>{let n=OM(t,e.target);return t===n?null:{sourcePath:t,destinationTreePath:n}}).filter(tq);if(t.length!==0){U(t[0]?.sourcePath??null),F(null);try{let e=[],n=[],i=[],a={docName:he.current,folderPath:Qe.current?.kind===`folder`?Qe.current.folderPath:null,assetPath:Qe.current?.kind===`asset`?Qe.current.assetPath:null};for(let a of t){let t=a.sourcePath.endsWith(`/`),o=!t&&yn(a.sourcePath),s=t?{kind:`folder`,fromPath:fM(a.sourcePath),toPath:fM(a.destinationTreePath)}:o?{kind:`asset`,fromPath:a.sourcePath,toPath:a.destinationTreePath}:{kind:`file`,fromPath:lM(a.sourcePath),toPath:lM(a.destinationTreePath)},c=await ve(await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(s)}),r({id:`dOHMA0`}));if(!c.ok){X.error(c.title),sn(),U(null);return}let l=A(Qr,c.body,`rename-path:drop`,{renamed:[],renamedAssets:[]});e=e.concat(l.renamed),n=n.concat(l.renamedAssets),t&&i.push({fromPath:fM(a.sourcePath),toPath:fM(a.destinationTreePath)})}try{await sr(e,i,n,a)}catch(i){console.warn(`[FileTree] post-move reconciliation failed`,{err:i,operationCount:t.length,renamedCount:e.length,renamedAssetCount:n.length}),X.error(r({id:`8OxKZy`}))}U(null)}catch(e){console.warn(`[FileTree] move failed:`,e),X.error(r({id:`HIb0vl`})),sn(),U(null)}}},t[154]=r,t[155]=sr,t[156]=sn,t[157]=lr):lr=t[157];let ur=lr,dr;t[158]!==r||t[159]!==b||t[160]!==sn?(dr=async function(e,t,n){if(e.length===0||Me.current!==null)return;let i=()=>{Me.current=null,U(null)};Me.current=n,U(n),F(null);let a=[],o=0,s=0;for(let n of e){let e=new FormData;e.append(`file`,n),e.append(`parentDocName`,AM(t,n.name||`upload`));try{let i=await ve(await fetch(`/api/upload`,{method:`POST`,body:e}),r({id:`4Gz2wC`}));if(!i.ok){s+=1,X.error(i.title,{description:n.name});continue}let c=A(nr,i.body,`upload:drop`,null);if(c===null){s+=1,X.error(r({id:`4Gz2wC`}),{description:n.name});continue}let l=jM(t,c);if(c.deduped===!0){s+=1,X.error(r({id:`4sKwf6`}),{description:l});continue}o+=1;let u=PM(l,n);u&&a.push(u)}catch(e){let t=e;s+=1,console.warn(`[FileTree] external file upload failed:`,t),X.error(t instanceof TypeError?r({id:`HIb0vl`}):r({id:`4Gz2wC`}),{description:n.name})}}try{if(a.length>0){for(let e of a)ps(e)&&b(e.docName);j(e=>{let t=new Set(e.map(uM)),n=!1,r=[...e];for(let e of a){let i=uM(e);Pe.current.set(i,Date.now()),!t.has(i)&&(t.add(i),r.push(e),n=!0)}return n?(sn(r),_n(r),r):e})}o>0&&(cs([`files`,`backlinks`,`graph`]),Ke.current?.(),X.success(hs._({id:`v75Em9`,values:{uploadedCount:o}}),{description:t||r({id:`RSqaSd`})})),s>0&&F(o>0?hs._({id:`yH7T4q`,values:{failedCount:s}}):r({id:`4Gz2wC`})),i()}catch(e){let t=e,n=r({id:`VcqWBy`});console.warn(`[FileTree] upload post-upload reconciliation failed:`,t),X.error(n),F(n),i()}},t[158]=r,t[159]=b,t[160]=sn,t[161]=dr):dr=t[161];let fr=dr,pr;t[162]===Symbol.for(`react.memo_cache_sentinel`)?(pr=function(e){te({parentDir:e})},t[162]=pr):pr=t[162];let mr=pr,hr;t[163]!==r||t[164]!==b||t[165]!==On||t[166]!==En||t[167]!==Ut||t[168]!==D||t[169]!==T||t[170]!==sn||t[171]!==qt?(hr=async function(e,t,n){if(Me.current)return;let i=Se.current;i&&En(i);try{let i=EM(e,t,[...qt,...Qt.current]);U(i.renamePath),Me.current=i.renamePath;let a=window.location.hash,o;if(e===`file`){let e=DM(`file`,i.addPath),t={path:e};n?.template&&(t.template=n.template);let a=await ve(await fetch(`/api/create-page`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)}),r({id:`fJgQHX`}));if(!a.ok){X.error(a.title),U(null),Me.current=null;return}let s=lM(e),c=A(ei,a.body,`create-page`,{docName:s}).docName;o=c;let l={kind:`document`,docName:c,docExt:e.toLowerCase().endsWith(`.mdx`)?`.mdx`:`.md`,modified:new Date().toISOString(),size:0};b(c),j(e=>{if(e.some(e=>ps(e)&&e.docName===c))return e;let t=[...e,l];return _n(t),Pe.current.set(uM(l),Date.now()),t}),cs([`files`,`backlinks`,`graph`]),T(c)}else{let e=fM(i.addPath),t=await ve(await fetch(`/api/create-folder`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e})}),r({id:`K1ckLX`}));if(!t.ok){X.error(t.title),U(null),Me.current=null;return}o=A(Fn,t.body,`create-folder`,{path:e}).path;let n={kind:`folder`,path:o,modified:new Date().toISOString(),size:0};j(e=>{if(e.some(e=>Qo(e)&&e.path===o))return e;let t=[...e,n];return _n(t),Pe.current.set(uM(n),Date.now()),t}),cs([`files`]),D(o)}let s=!1,c=e=>{if(e.key!==`Enter`)return;let t=Se.current;!t||t.renamePath!==i.renamePath||queueMicrotask(()=>En(t))};document.addEventListener(`keydown`,c,!0),Se.current={kind:e,renamePath:i.renamePath,createdPath:o,previousHash:a,disposeCommitListener:()=>{s||(s=!0,document.removeEventListener(`keydown`,c,!0))}},U(null),Me.current=null,Ut.add(i.addPath),Ut.startRenaming(i.renamePath,{removeIfCanceled:!0})}catch(e){console.warn(`[FileTree] create placeholder failed:`,e),X.error(r({id:`S6l5dv`}));let t=Se.current;t?await On(t):En(),U(null),Me.current=null,sn()}},t[163]=r,t[164]=b,t[165]=On,t[166]=En,t[167]=Ut,t[168]=D,t[169]=T,t[170]=sn,t[171]=qt,t[172]=hr):hr=t[172];let gr=hr,_r;t[173]===Ut?_r=t[174]:(_r=function(e){let t=pM(e);(0,Q.startTransition)(()=>{for(let e of Qt.current)if(e===t||e.startsWith(t)){let t=SG(Ut.getItem(e));t&&t.expand()}})},t[173]=Ut,t[174]=_r);let vr=_r,yr;t[175]===Ut?yr=t[176]:(yr=function(e){let t=pM(e),n=new Set(xe.current);(0,Q.startTransition)(()=>{for(let e of[...Qt.current].reverse())if((e===t||e.startsWith(t))&&!n.has(e)){let t=SG(Ut.getItem(e));t&&t.collapse()}})},t[175]=Ut,t[176]=yr);let br=yr,xr;t[177]!==fe||t[178]!==$t||t[179]!==o||t[180]!==c||t[181]!==_e||t[182]!==H||t[183]!==On||t[184]!==dn||t[185]!==k||t[186]!==Zt||t[187]!==ur||t[188]!==cr||t[189]!==Gt||t[190]!==x||t[191]!==wn||t[192]!==pn||t[193]!==Mt||t[194]!==jt||t[195]!==qt||t[196]!==fr?(xr=()=>{le.current=k,ue.current=x,he.current=o,Qe.current=c,ye.current=_e,Me.current=H,We.current=jt,Ge.current=Mt,Yt.current=qt,Qt.current=Zt,xe.current=$t,He.current=dn,Ue.current=pn,Ce.current=On,je.current=(e,t,n)=>{fr(e,t,n)},Je.current=e=>{if(Ee.current||De.current||e.length!==1)return;let t=e[0];t&&(ie(!1),fe(Gt(t),k))},Xe.current=e=>{wn(e)||X.error(e)},Ye.current=cr,Ze.current=ur},t[177]=fe,t[178]=$t,t[179]=o,t[180]=c,t[181]=_e,t[182]=H,t[183]=On,t[184]=dn,t[185]=k,t[186]=Zt,t[187]=ur,t[188]=cr,t[189]=Gt,t[190]=x,t[191]=wn,t[192]=pn,t[193]=Mt,t[194]=jt,t[195]=qt,t[196]=fr,t[197]=xr):xr=t[197],(0,Q.useLayoutEffect)(xr);let Sr,Cr;t[198]===Ut?(Sr=t[199],Cr=t[200]):(Sr=()=>{let e=e=>{let t=(e.metaKey||e.ctrlKey)&&!e.altKey,n=e.key.toLowerCase(),r=t&&n===`a`,i=t&&!e.shiftKey&&n===`d`;if(!r&&!i||FK(e.target))return;let a=qe.current,o=e.target,s=document.activeElement,c=o instanceof Node&&a?.contains(o),l=s instanceof Node&&a?.contains(s);if(!c&&!l)return;if(i){let t=Ut.getFocusedPath()??Ut.getSelectedPaths()[0]??null;if(!t)return;let n=Ut.getItem(t)??Ut.getItem(pM(t)),r=n?.isDirectory()?pM(fM(n.getPath())):t;if(ye.current.has(r))return;Sn.current(jK(r,le.current)),e.preventDefault(),e.stopPropagation();return}let u=new Set([...Qt.current,...Yt.current]);Ee.current=!0;for(let e of u)e&&Ut.getItem(e)?.select();queueMicrotask(()=>{Ee.current=!1}),e.preventDefault(),e.stopPropagation()};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},Cr=[Ut],t[198]=Ut,t[199]=Sr,t[200]=Cr),(0,Q.useEffect)(Sr,Cr);let wr,Tr;t[201]!==k.length||t[202]!==M?(wr=()=>{if(M||k.length===0)return;let e=qe.current?.querySelector(yF)?.shadowRoot;if(!e)return;let t=eq,n=()=>{for(let n of e.querySelectorAll(`[data-item-path]`)){let e=n.dataset.itemPath;if(!e)continue;let r=t(e);n.title!==r&&(n.title=r)}let n=e.querySelector(`[data-type="context-menu-anchor"]`);if(n){let r=e.querySelector(`[data-item-context-hover="true"][data-item-path]`)?.dataset.itemPath,i=r?t(r):``;n.title!==i&&(n.title=i)}};n();let r=new MutationObserver(n);return r.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`data-item-path`,`data-item-context-hover`]}),()=>r.disconnect()},Tr=[M,k.length],t[201]=k.length,t[202]=M,t[203]=wr,t[204]=Tr):(wr=t[203],Tr=t[204]),(0,Q.useEffect)(wr,Tr);let Er,Dr;t[205]!==k.length||t[206]!==M?(Er=()=>{if(M||k.length===0)return;let e=qe.current?.querySelector(yF)?.shadowRoot;if(!e)return;let t=()=>IW(e);t();let n=new MutationObserver(t);return n.observe(e,{subtree:!0,childList:!0,characterData:!0,attributes:!0,attributeFilter:[`data-item-path`]}),()=>n.disconnect()},Dr=[M,k.length],t[205]=k.length,t[206]=M,t[207]=Er,t[208]=Dr):(Er=t[207],Dr=t[208]),(0,Q.useEffect)(Er,Dr);let Or,kr;t[209]!==k.length||t[210]!==M?(Or=()=>{if(M||k.length===0)return;let e=qe.current?.querySelector(yF)?.shadowRoot;if(!e)return;let t=()=>eG(e);t();let n=new MutationObserver(t);return n.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`data-item-path`]}),()=>n.disconnect()},kr=[M,k.length],t[209]=k.length,t[210]=M,t[211]=Or,t[212]=kr):(Or=t[211],kr=t[212]),(0,Q.useEffect)(Or,kr);let Ar;t[213]===Symbol.for(`react.memo_cache_sentinel`)?(Ar={folderCount:0,expandedCount:0},t[213]=Ar):Ar=t[213];let Nr=(0,Q.useRef)(Ar),Fr=(0,Q.useRef)(gr),Ir=(0,Q.useRef)(mr),Lr;t[214]===gr?Lr=t[215]:(Lr=()=>{Fr.current=gr,Ir.current=mr},t[214]=gr,t[215]=Lr),(0,Q.useEffect)(Lr);let Rr,zr;t[216]===Ut?(Rr=t[217],zr=t[218]):(Rr=()=>({startCreating(e,t){Fr.current(e,t)},startCreatingFromTemplate(e){Ir.current(e)},createFromTemplate(e,t){Fr.current(`file`,e,{template:t})},expandAll(){(0,Q.startTransition)(()=>{for(let e of Qt.current){let t=SG(Ut.getItem(e));t&&t.expand()}})},collapseAll(){let e=new Set(xe.current);(0,Q.startTransition)(()=>{for(let t of[...Qt.current].reverse()){if(e.has(t))continue;let n=SG(Ut.getItem(t));n&&n.collapse()}})},getFolderState(){let e=Qt.current,t=0;for(let n of e)SG(Ut.getItem(n))?.isExpanded()&&t++;let n=e.length,r=Nr.current;if(r.folderCount===n&&r.expandedCount===t)return r;let i={folderCount:n,expandedCount:t};return Nr.current=i,i},isCreationTargetCleared(){return ae.current},subscribe(e){ce.current.add(e);let t=Ut.subscribe(e);return()=>{ce.current.delete(e),t()}}}),zr=[Ut],t[216]=Ut,t[217]=Rr,t[218]=zr),(0,Q.useImperativeHandle)(n,Rr,zr);let Br;t[219]!==En||t[220]!==d||t[221]!==l||t[222]!==Ut?(Br=async function(e,t,n){let r=IK(e,le.current,Qt.current),i=Se.current;i&&e.some(e=>LK(e,i))&&(i.kind===`file`?r.docNames.add(i.createdPath):r.folderPaths.add(i.createdPath),En(i));let a=new Set([...r.docNames,...t]),o=new Set([...r.folderPaths,...n]),s=new Set([...r.assetPaths,...e.filter($K).map(QK)]);l([...[...a].map(ZK),...[...o].map(XK),...[...s].map(YK)],{force:!0}),await Promise.all([...a].map(e=>d(e)));for(let t of e){let e=t.kind===`folder`?pM(t.path):t.kind===`asset`?t.path:cM(t.path,t.docExt);Ut.getItem(e)&&Ut.remove(e,t.kind===`folder`?{recursive:!0}:void 0)}j(e=>{let t=VM(e,[...a],void 0,[...s]);for(let e of o)t=VM(t,[],e);return _n(t),t}),cs([`files`,`backlinks`,`graph`])},t[219]=En,t[220]=d,t[221]=l,t[222]=Ut,t[223]=Br):Br=t[223];let Vr=Br,Hr;t[224]!==r||t[225]!==Vr?(Hr=async function(e){let t=[],n=[],i=[];for(let a of e){let e=a.kind;U(a.path);let o=await ve(await fetch(`/api/delete-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e,path:a.path})}),r({id:`7JtSLi`}));if(!o.ok)return i.length>0&&await Vr(i,t,n),X.error(o.title),!1;let s=A(Qn,o.body,`delete-path`,{deletedDocNames:[]});t.push(...s.deletedDocNames),e===`folder`&&n.push(a.path),i.push(a)}return await Vr(i,t,n),!0},t[224]=r,t[225]=Vr,t[226]=Hr):Hr=t[226];let Ur=Hr,Wr;t[227]===Symbol.for(`react.memo_cache_sentinel`)?(Wr=async function(e,t,n){let r=[],i=[];for(let a of e){U(a.path);let e=KM(a,n),o=await t.shell.trashItem(e);o.ok?r.push(a):i.push({kind:a.kind,path:a.path,name:a.name,reason:hG(o.reason),detail:o.detail})}return{trashed:r,failed:i}},t[227]=Wr):Wr=t[227];let Gr=Wr,Kr;t[228]===r?Kr=t[229]:(Kr=async function(e){let t=[],n=[],i=[];for(let a of e){let e=a.kind;try{let o=await ve(await fetch(`/api/trash/cleanup`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e,path:a.path})}),r({id:`DVh_Tb`}));if(!o.ok){console.warn(`[FileTree] trash-cleanup failed`,{target:`${a.kind}:${a.path}`,reason:o.title}),i.push({target:a,reason:o.title});continue}let s=A(ni,o.body,`trash-cleanup`,{deletedDocNames:[]});t.push(...s.deletedDocNames),e===`folder`&&n.push(a.path)}catch(e){let t=e;console.warn(`[FileTree] trash-cleanup threw`,{target:`${a.kind}:${a.path}`,err:t}),i.push({target:a,reason:r({id:`r4R7AZ`})})}}if(i.length>0){let e=i.length;X.error(r({id:`IrB5AK`,values:{failedCount:e}}),{description:r({id:`vEJDlt`})})}return i.length===e.length&&e.length>0?null:{deletedDocNames:t,deletedFolderPaths:n}},t[228]=r,t[229]=Kr);let qr=Kr,Jr;t[230]!==r||t[231]!==J||t[232]!==Vr||t[233]!==Ur||t[234]!==qr||t[235]!==sn||t[236]!==ne?(Jr=async function(e){let t=e.map(e=>HM(e,le.current)),n=t[0];if(!n)return;let i=J.filter(e=>t.some(t=>{if(t.kind===`file`){let n=`${t.path}${t.docExt??`.md`}`;return e.file===n}return t.kind===`folder`?e.file.startsWith(`${t.path}/`):!1}));if(i.length>0){let e=i.slice(0,3).map(JK),t=i.length>e.length?`, +${i.length-e.length} more`:``;X.error(`Cannot delete files with unresolved conflicts`,{description:`Resolve the conflict on ${e.join(`, `)}${t} before deleting.`});return}U(n.path),G(null);let a=typeof window<`u`?window.okDesktop:void 0;try{if(a&&ne){let{trashed:e,failed:n}=await Gr(t,a,ne);if(e.length>0){let t=await qr(e);t?await Vr(e,t.deletedDocNames,t.deletedFolderPaths):await Vr(e,e.filter(qK).map(KK),e.filter(GK).map(WK))}n.length>0&&q({failed:n,originalTargets:[...t]}),U(null)}else{let e=await Ur(t);U(null),e||sn()}}catch(e){let t=e,n=t instanceof Error?t.message:String(t);console.warn(`[FileTree] delete failed:`,t),X.error(r({id:`0eHrMb`}),{description:n}),U(null),sn()}},t[230]=r,t[231]=J,t[232]=Vr,t[233]=Ur,t[234]=qr,t[235]=sn,t[236]=ne,t[237]=Jr):Jr=t[237];let Yr=Jr,Xr;t[238]!==r||t[239]!==Ur||t[240]!==sn||t[241]!==K?(Xr=async function(){if(!K)return;let e=new Set(K.failed.map(UK)),t=K.originalTargets.filter(t=>e.has(`${t.kind}:${t.path}`));if(q(null),t.length!==0){U(t[0]?.path??null);try{let e=await Ur(t);U(null),e||sn()}catch(e){let t=e,n=t instanceof Error?t.message:String(t);console.warn(`[FileTree] hard-delete fallback failed:`,t),X.error(r({id:`0eHrMb`}),{description:n}),U(null),sn()}}},t[238]=r,t[239]=Ur,t[240]=sn,t[241]=K,t[242]=Xr):Xr=t[242];let Zr=Xr,$r;t[243]!==Yr||t[244]!==K?($r=async function(){if(!K)return;let e=new Set(K.failed.map(HK)),t=K.originalTargets.filter(t=>e.has(`${t.kind}:${t.path}`));q(null),await Yr(t)},t[243]=Yr,t[244]=K,t[245]=$r):$r=t[245];let ti=$r,ri=(0,Q.useRef)(Yr),ii;t[246]===Yr?ii=t[247]:(ii=()=>{ri.current=Yr},t[246]=Yr,t[247]=ii),(0,Q.useEffect)(ii);let ai,oi;t[248]===Symbol.for(`react.memo_cache_sentinel`)?(ai=()=>kG(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=le.current.find(e=>ps(e)&&e.docName===t);ri.current([{kind:`file`,path:t,name:t.split(`/`).pop()??t,docExt:n?.docExt}]);return}if(e.kind===`folder`){ri.current([{kind:`folder`,path:e.folderPath,name:e.folderPath.split(`/`).pop()??e.folderPath}]);return}if(e.kind===`asset`){ri.current([{kind:`asset`,path:e.assetPath,name:e.assetPath.split(`/`).pop()??e.assetPath}]);return}console.warn(JSON.stringify({event:`file-tree-menu-action-delete-unsupported-kind`,kind:e.kind}))}),oi=[],t[248]=ai,t[249]=oi):(ai=t[248],oi=t[249]),(0,Q.useEffect)(ai,oi);let ci,ui;t[250]===Symbol.for(`react.memo_cache_sentinel`)?(ci=()=>NG(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=le.current.find(e=>ps(e)&&e.docName===t);Sn.current({kind:`file`,path:t,name:t.split(`/`).pop()??t,docExt:n?.docExt});return}if(e.kind===`folder`){Sn.current({kind:`folder`,path:e.folderPath,name:e.folderPath.split(`/`).pop()??e.folderPath});return}console.warn(JSON.stringify({event:`file-tree-menu-action-duplicate-unsupported-kind`,kind:e.kind}))}),ui=[],t[250]=ci,t[251]=ui):(ci=t[250],ui=t[251]),(0,Q.useEffect)(ci,ui);let di,fi;t[252]===Ut?(di=t[253],fi=t[254]):(di=()=>jG(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=cM(t,le.current.find(e=>ps(e)&&e.docName===t)?.docExt);Ut.startRenaming(n);return}if(e.kind===`folder`){Ut.startRenaming(e.folderPath);return}if(e.kind===`asset`){Ut.startRenaming(e.assetPath);return}console.warn(JSON.stringify({event:`file-tree-menu-action-rename-unsupported-kind`,kind:e.kind}))}),fi=[Ut],t[252]=Ut,t[253]=di,t[254]=fi),(0,Q.useEffect)(di,fi);let pi;t[255]===Symbol.for(`react.memo_cache_sentinel`)?(pi=function(){let e=Te.current;e&&rK(e),Te.current=null},t[255]=pi):pi=t[255];let mi=pi,hi;t[256]===g?hi=t[257]:(hi=function(e){let t=mq(e.nativeEvent);if(!t||t.endsWith(`/`)){mi();return}let n=lM(t),r=le.current.find(e=>uM(e)===t);if(r&&zo(r)){mi();return}if(r&&ps(r)&&Mr(r.size)){mi();return}Te.current!==n&&(mi(),Te.current=n,nK(n,e=>g(e)))},t[256]=g,t[257]=hi);let gi=hi,_i;t[258]!==fe||t[259]!==Ut||t[260]!==D?(_i=function(e){if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=hq(e.nativeEvent);if(!t){vq(e.nativeEvent)&&ie(!0);return}if(t.getAttribute(`aria-selected`)!==`true`)return;let n=t.dataset.itemPath;if(!n)return;let r=t.dataset.itemType===`folder`?pM(n):n;if(Ut.getSelectedPaths().length!==1)return;if(t.dataset.itemType===`folder`){let e=fM(r);if(window.location.hash===Wo(e))return;queueMicrotask(()=>D(e));return}let i=lM(r);window.location.hash!==Ho(i)&&queueMicrotask(()=>fe(r))},t[258]=fe,t[259]=Ut,t[260]=D,t[261]=_i):_i=t[261];let vi=_i,yi;t[262]===Symbol.for(`react.memo_cache_sentinel`)?(yi=function(e){MM(e.nativeEvent)&&(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=`copy`,tt(!0))},t[262]=yi):yi=t[262];let bi=yi,xi;t[263]===Symbol.for(`react.memo_cache_sentinel`)?(xi=function(e){let t=e.relatedTarget;t instanceof Node&&e.currentTarget.contains(t)||tt(!1)},t[263]=xi):xi=t[263];let Si=xi,Ci;t[264]===fr?Ci=t[265]:(Ci=function(e){if(!MM(e.nativeEvent))return;let t=NM(e.nativeEvent);t.length!==0&&(e.preventDefault(),e.stopPropagation(),tt(!1),fr(t,``,CK))},t[264]=fr,t[265]=Ci);let wi=Ci;if(M){let e;return t[266]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(bq,{}),t[266]=e):e=t[266],e}let Ti;t[267]!==r||t[268]!==I||t[269]!==R?(Ti=I?r(R?{id:`H-vDm3`}:{id:`09Tv5j`}):null,t[267]=r,t[268]=I,t[269]=R,t[270]=Ti):Ti=t[270];let Ei=Ti;if(k.length===0){if(Ei!==null){let e;return t[271]===Ei?e=t[272]:(e=(0,Z.jsx)(`div`,{className:`flex flex-1 items-center justify-center py-8`,children:(0,Z.jsx)(`span`,{role:`status`,className:`select-none text-sidebar-foreground/50 text-sm`,children:Ei})}),t[271]=Ei,t[272]=e),e}if(P){let e;return t[273]===P?e=t[274]:(e=(0,Z.jsx)(`div`,{className:`flex flex-1 items-center justify-center py-8`,children:(0,Z.jsx)(`span`,{role:`alert`,className:`select-none text-sidebar-foreground/50 text-sm`,children:P})}),t[273]=P,t[274]=e),e}let e;t[275]===r?e=t[276]:(e=r({id:`5ZB7XC`}),t[275]=r,t[276]=e);let n=$e&&`bg-primary/5 ring-2 ring-primary/70 ring-inset`,i;t[277]===n?i=t[278]:(i=si(`flex flex-1 flex-col items-center justify-center gap-3 rounded-md py-8`,n),t[277]=n,t[278]=i);let a;t[279]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(`span`,{className:`select-none text-sidebar-foreground/30 text-sm`,children:(0,Z.jsx)(s,{id:`xiv-dW`})}),t[279]=a):a=t[279];let o;t[280]===gr?o=t[281]:(o=()=>gr(`file`,``),t[280]=gr,t[281]=o);let c;t[282]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(s,{id:`6ibbCg`}),t[282]=c):c=t[282];let l;t[283]===o?l=t[284]:(l=(0,Z.jsx)(li,{variant:`link`,size:`sm`,className:`font-mono uppercase`,onClick:o,children:c}),t[283]=o,t[284]=l);let u;return t[285]!==wi||t[286]!==e||t[287]!==i||t[288]!==l?(u=(0,Z.jsxs)(`section`,{"aria-label":e,className:i,onDragOver:bi,onDragLeave:Si,onDrop:wi,children:[a,l]}),t[285]=wi,t[286]=e,t[287]=i,t[288]=l,t[289]=u):u=t[289],u}let Di=H!==null,Oi=W?.targets[0]??null,ki=null;if(B!==null){let e;if(t[290]!==a.locale||t[291]!==B){let n=new Intl.NumberFormat(a.locale).format(B);e=hs._({id:`mSpqzP`,values:{truncatedShownCount:B,formattedCount:n}}),t[290]=a.locale,t[291]=B,t[292]=e}else e=t[292];ki=e}let Ai;t[293]!==P||t[294]!==Ei||t[295]!==ki?(Ai=(P||Ei!==null||ki!==null)&&(0,Z.jsxs)(Z.Fragment,{children:[Ei===null?P&&(0,Z.jsx)(Sq,{kind:`error`,children:P}):(0,Z.jsx)(Sq,{kind:`reconnecting`,children:Ei}),ki!==null&&(0,Z.jsx)(Sq,{kind:`info`,children:ki})]}),t[293]=P,t[294]=Ei,t[295]=ki,t[296]=Ai):Ai=t[296];let ji;t[297]===y?ji=t[298]:(ji=jW(y),t[297]=y,t[298]=ji);let Mi=Y?``:void 0,Ni;t[299]===Mi?Ni=t[300]:(Ni={[EK]:Mi},t[299]=Mi,t[300]=Ni);let Pi;t[301]!==Di||t[302]!==_e||t[303]!==br||t[304]!==k||t[305]!==vr||t[306]!==Zt||t[307]!==xn||t[308]!==Dt||t[309]!==At||t[310]!==Ut||t[311]!==Ot||t[312]!==kt||t[313]!==gr||t[314]!==ne?(Pi=(e,t)=>(0,Z.jsx)(RK,{item:e,context:t,anyActionBusy:Di,workspace:ne,handoff:Dt,model:Ut,okignoreBinding:Ot,projectLocalBinding:kt,mergedConfig:At,onStartCreating:gr,onCreateFromTemplate:(e,t)=>gr(`file`,e,{template:t}),onDuplicate:xn,onDelete:e=>G({targets:e}),onExpandSubtree:vr,onCollapseSubtree:br,folderTreePaths:Zt,isAsset:_e.has(e.path),documents:k}),t[301]=Di,t[302]=_e,t[303]=br,t[304]=k,t[305]=vr,t[306]=Zt,t[307]=xn,t[308]=Dt,t[309]=At,t[310]=Ut,t[311]=Ot,t[312]=kt,t[313]=gr,t[314]=ne,t[315]=Pi):Pi=t[315];let Ii;t[316]!==vi||t[317]!==gi||t[318]!==Ut||t[319]!==Ai||t[320]!==ji||t[321]!==Ni||t[322]!==Pi?(Ii=(0,Z.jsx)(`div`,{ref:qe,className:`flex min-h-0 flex-1 flex-col`,children:(0,Z.jsx)(TW,{header:Ai,model:Ut,style:ji,...Ni,onClickCapture:vi,onMouseMove:gi,onMouseLeave:mi,renderContextMenu:Pi})}),t[316]=vi,t[317]=gi,t[318]=Ut,t[319]=Ai,t[320]=ji,t[321]=Ni,t[322]=Pi,t[323]=Ii):Ii=t[323];let Li=!!W,Ri;t[324]===H?Ri=t[325]:(Ri=e=>{!e&&!H&&G(null)},t[324]=H,t[325]=Ri);let zi;t[326]!==r||t[327]!==H||t[328]!==W||t[329]!==Yr||t[330]!==Oi?(zi=W&&Oi&&(0,Z.jsx)(za,{...(()=>{let e=dG(typeof window<`u`&&window.okDesktop!=null?`electron`:`web`,W.targets);if(e)return{customTitle:e.title,customDescription:``,customDetail:e.detail,customConfirmLabel:e.confirmLabel,customConfirmLabelBusy:e.confirmLabelBusy,children:e.listedTargets?(0,Z.jsx)(`ul`,{className:`flex flex-col gap-1 font-mono text-foreground text-xs`,children:e.listedTargets.map(VK)}):null};let t=W.targets.length,n=Oi.name;return{itemName:t===1?Oi.kind===`folder`?`${Oi.name}/`:Oi.kind===`file`?`${Oi.name}${Oi.docExt??`.md`}`:Oi.name:void 0,customTitle:t>1?r({id:`abiHje`}):void 0,customDescription:t>1?r({id:`WMIKXK`,values:{targetCount:t}}):Oi.kind===`folder`?r({id:`a5W0q0`,values:{folderName:n}}):void 0}})(),isSubmitting:H!==null,onDelete:()=>Yr(W.targets)}),t[326]=r,t[327]=H,t[328]=W,t[329]=Yr,t[330]=Oi,t[331]=zi):zi=t[331];let Bi;t[332]!==Li||t[333]!==Ri||t[334]!==zi?(Bi=(0,Z.jsx)(ko,{open:Li,onOpenChange:Ri,children:zi}),t[332]=Li,t[333]=Ri,t[334]=zi,t[335]=Bi):Bi=t[335];let Vi=!!K,Hi;t[336]===H?Hi=t[337]:(Hi=e=>{!e&&!H&&q(null)},t[336]=H,t[337]=Hi);let Ui;t[338]!==H||t[339]!==Zr||t[340]!==ti||t[341]!==K?(Ui=K&&(0,Z.jsx)(yG,{failedTargets:K.failed,isSubmitting:H!==null,onDeletePermanently:Zr,onRetry:ti,onCancel:()=>q(null)}),t[338]=H,t[339]=Zr,t[340]=ti,t[341]=K,t[342]=Ui):Ui=t[342];let Wi;t[343]!==Vi||t[344]!==Hi||t[345]!==Ui?(Wi=(0,Z.jsx)(ko,{open:Vi,onOpenChange:Hi,children:Ui}),t[343]=Vi,t[344]=Hi,t[345]=Ui,t[346]=Wi):Wi=t[346];let Gi=ee!==null,Ki;t[347]===Symbol.for(`react.memo_cache_sentinel`)?(Ki=e=>{e||te(null)},t[347]=Ki):Ki=t[347];let qi=ee?.parentDir??``,Ji;t[348]!==Gi||t[349]!==qi?(Ji=(0,Z.jsx)(zh,{open:Gi,onOpenChange:Ki,kind:`file`,initialDir:qi,defaultToTemplate:!0}),t[348]=Gi,t[349]=qi,t[350]=Ji):Ji=t[350];let Yi;return t[351]!==Ii||t[352]!==Bi||t[353]!==Wi||t[354]!==Ji?(Yi=(0,Z.jsxs)(Z.Fragment,{children:[Ii,Bi,Wi,Ji]}),t[351]=Ii,t[352]=Bi,t[353]=Wi,t[354]=Ji,t[355]=Yi):Yi=t[355],Yi}function VK(e){return(0,Z.jsx)(`li`,{"data-testid":`delete-target-row`,children:fG(e)},`${e.kind}:${e.path}`)}function HK(e){return`${e.kind}:${e.path}`}function UK(e){return`${e.kind}:${e.path}`}function WK(e){return e.path}function GK(e){return e.kind===`folder`}function KK(e){return e.path}function qK(e){return e.kind===`file`}function JK(e){return e.file}function YK(e){return Rt(e)}function XK(e){return wt(e)}function ZK(e){return Ue(e)}function QK(e){return e.path}function $K(e){return e.kind===`asset`}function eq(e){return e.endsWith(`/`)?e.slice(0,-1):e}function tq(e){return!!e}function nq(e){console.warn(`[FileTree] /api/workspace fetch failed:`,e)}function rq(e){console.warn(`[FileTree] unmount cleanup failed:`,e)}function iq(e){X.error(e)}function aq(){}function oq(e){return X.error(e)}function sq(){}function cq(){}function lq(){}function uq(){}function dq(){}async function fq(){}function pq(e){return uM(e)}function mq(e){return hq(e)?.dataset.itemPath??null}function hq(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.dataset.itemPath)return t;return null}function gq(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.matches(`[data-file-tree-virtualized-root]`))return t;return null}function _q(e){let t=hq(e);if(t){let e=t.dataset.itemPath;if(!e)return null;let n=t.dataset.itemType===`folder`,r=kM(e,n);return{parentDir:r,row:t,root:null,busyPath:n?pM(r):e}}return vq(e)?{parentDir:``,row:null,root:gq(e),busyPath:CK}:null}function vq(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.matches(`[data-file-tree-virtualized-scroll]`))return!0;return!1}var yq=[`w-3/4`,`w-2/3`,`w-4/5`,`w-1/2`,`w-3/5`,`w-2/3`];function bq(){let e=(0,$.c)(5),{_:t}=i(),n;e[0]===t?n=e[1]:(n=t({id:`5Tk8Fb`}),e[0]=t,e[1]=n);let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=yq.map(xq),e[2]=r):r=e[2];let a;return e[3]===n?a=e[4]:(a=(0,Z.jsx)(`div`,{className:`flex flex-1 flex-col gap-1 px-2 py-2`,role:`status`,"aria-busy":`true`,"aria-label":n,children:r}),e[3]=n,e[4]=a),a}function xq(e,t){return(0,Z.jsxs)(`div`,{className:`flex h-6 items-center gap-2`,children:[(0,Z.jsx)(Oi,{className:`h-3 w-3 shrink-0 rounded-sm`}),(0,Z.jsx)(Oi,{className:`h-3 ${e}`})]},t)}function Sq(e){let t=(0,$.c)(14),{kind:n,children:r}=e,i=n===`error`?Ro:n===`reconnecting`?Ka:jo,a=n===`error`?`alert`:`status`,o=n===`error`?`text-destructive`:`text-muted-foreground`,s;t[0]===o?s=t[1]:(s=si(`mx-2 mb-1 flex items-start gap-1.5 rounded-md bg-muted/50 px-2 py-1.5 text-xs leading-snug`,o),t[0]=o,t[1]=s);let c=n===`reconnecting`&&`animate-spin motion-reduce:animate-none`,l;t[2]===c?l=t[3]:(l=si(`mt-0.5 size-3.5 shrink-0`,c),t[2]=c,t[3]=l);let u;t[4]!==i||t[5]!==l?(u=(0,Z.jsx)(i,{"aria-hidden":`true`,className:l}),t[4]=i,t[5]=l,t[6]=u):u=t[6];let d;t[7]===r?d=t[8]:(d=(0,Z.jsx)(`span`,{className:`min-w-0`,children:r}),t[7]=r,t[8]=d);let f;return t[9]!==a||t[10]!==s||t[11]!==u||t[12]!==d?(f=(0,Z.jsxs)(`span`,{role:a,className:s,children:[u,d]}),t[9]=a,t[10]=s,t[11]=u,t[12]=d,t[13]=f):f=t[13],f}function Cq(e){return e?hs._({id:`wTcjov`}):null}function wq(e){let t=(0,$.c)(23),{_:n}=i(),r=pg(),a=Wx();if(r)return null;let{input:o,installStates:c,dispatch:l}=e,u=o===null,d,f,p,m,h,g;if(t[0]!==n||t[1]!==l||t[2]!==o||t[3]!==u||t[4]!==c||t[5]!==a){g=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Cq(u),r;t[12]===c?r=t[13]:(r=e=>c[e.id]?.installed===!0,t[12]=c,t[13]=r);let i=gg.filter(r),_=i.length>0,v=a!==null;if(!_&&!v){g=null;break bb0}f=tN,t[14]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsxs)(iN,{children:[(0,Z.jsx)(bi,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`O7_W_a`})]}),t[14]=h):h=t[14],d=aN,p=_?(0,Z.jsxs)(eN,{"aria-label":n({id:`BBqGS9`}),children:[(0,Z.jsx)(sN,{children:(0,Z.jsx)(s,{id:`BBqGS9`})}),i.map(t=>{let r=!u,{displayName:i}=t,a=n(e?{id:`1ZpfyB`,values:{displayName:i,hint:e}}:{id:`WqLq6M`,values:{displayName:i}});return(0,Z.jsxs)(rN,{disabled:!r,onSelect:()=>{o&&l(t.id,o)},"data-testid":`empty-space-open-in-${t.id}`,"aria-label":a,children:[(0,Z.jsx)(Vx,{id:t.id,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:t.displayName}),e?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t.id)})]}):null,m=v?(0,Z.jsxs)(Z.Fragment,{children:[_?(0,Z.jsx)(cN,{}):null,(0,Z.jsxs)(eN,{"aria-label":n({id:`ALhMYW`}),children:[(0,Z.jsx)(sN,{children:(0,Z.jsx)(s,{id:`ALhMYW`})}),(0,Z.jsxs)(rN,{onSelect:()=>{o!==null&&a.launchInTerminal(o)},disabled:u,"data-testid":`empty-space-open-in-terminal`,"aria-label":n(e?{id:`LtVw4J`,values:{hint:e}}:{id:`AcK_r0`}),children:[(0,Z.jsx)(ru,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`fcgvCA`})}),e?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]})]})]}):null}t[0]=n,t[1]=l,t[2]=o,t[3]=u,t[4]=c,t[5]=a,t[6]=d,t[7]=f,t[8]=p,t[9]=m,t[10]=h,t[11]=g}else d=t[6],f=t[7],p=t[8],m=t[9],h=t[10],g=t[11];if(g!==Symbol.for(`react.early_return_sentinel`))return g;let _;t[15]!==d||t[16]!==p||t[17]!==m?(_=(0,Z.jsxs)(d,{children:[p,m]}),t[15]=d,t[16]=p,t[17]=m,t[18]=_):_=t[18];let v;return t[19]!==f||t[20]!==h||t[21]!==_?(v=(0,Z.jsxs)(f,{children:[h,_]}),t[19]=f,t[20]=h,t[21]=_,t[22]=v):v=t[22],v}var Tq=(e,t,n)=>yu(e,t,n,`ProjectSwitcher`);function Eq(e){let t=(0,$.c)(96),{bridge:n}=e,{_:r}=i(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=[],t[0]=a):a=t[0];let[o,c]=(0,Q.useState)(a),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(``),[p,m]=(0,Q.useState)(!1),h=MA(),g=typeof window<`u`&&window.okDesktop!=null,_=(0,Q.useRef)(!1),v;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(v=e=>{u(e),e||f(``)},t[1]=v):v=t[1];let y=v,b;t[2]!==r||t[3]!==n.project||t[4]!==l?(b=()=>{if(!l)return;let e=!1;return Tq(async()=>{let t=await n.project.listRecent();e||c(t)},r({id:`fYKgzG`})),()=>{e=!0}},t[2]=r,t[3]=n.project,t[4]=l,t[5]=b):b=t[5];let x;t[6]!==r||t[7]!==n||t[8]!==l?(x=[l,n,r],t[6]=r,t[7]=n,t[8]=l,t[9]=x):x=t[9],(0,Q.useEffect)(b,x);let S;t[10]!==r||t[11]!==n.project?(S=e=>{u(!1),Tq(()=>n.project.open({path:e,target:`new-window`,entryPoint:`recents`}),r({id:`SUOoXn`}))},t[10]=r,t[11]=n.project,t[12]=S):S=t[12];let C=S,w;t[13]!==r||t[14]!==n.dialog||t[15]!==n.project?(w=()=>{u(!1),Tq(async()=>{let e=await n.dialog.openFolder();e&&await n.project.open({path:e,target:`new-window`,entryPoint:`pick-existing`})},r({id:`gmJ0An`}))},t[13]=r,t[14]=n.dialog,t[15]=n.project,t[16]=w):w=t[16];let E=w,D;t[17]!==r||t[18]!==n.navigator?(D=()=>{u(!1),Tq(()=>n.navigator.open(),r({id:`jol95m`}))},t[17]=r,t[18]=n.navigator,t[19]=D):D=t[19];let O=D,k;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(k=()=>{u(!1),m(!0)},t[20]=k):k=t[20];let A=k,j=n.config.projectPath,M,N,P,F,I,L,z,B,H,U,W;if(t[21]!==r||t[22]!==h||t[23]!==n.config.projectName||t[24]!==n.config.projectPath||t[25]!==j||t[26]!==l||t[27]!==C||t[28]!==o||t[29]!==d){let e;t[41]===j?e=t[42]:(e=e=>e.path!==j,t[41]=j,t[42]=e);let i=o.filter(e),a=d.trim().toLowerCase(),c=a?i.filter(e=>e.name.toLowerCase().includes(a)||e.path.toLowerCase().includes(a)):i;N=oo,z=l,B=y,H=!1;let u=h!==null&&`h-auto py-1.5`,p;t[43]===u?p=t[44]:(p=si(`justify-between text-sidebar-foreground/70 hover:text-sidebar-foreground! data-open:hover:text-sidebar-foreground!`,u),t[43]=u,t[44]=p);let m;t[45]===r?m=t[46]:(m=r({id:`zZ_I5K`}),t[45]=r,t[46]=m);let v;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(v=g?()=>{_.current=!0}:void 0,t[47]=v):v=t[47];let b;t[48]===l?b=t[49]:(b=g?()=>{if(_.current){_.current=!1;return}y(!l)}:void 0,t[48]=l,t[49]=b);let x;t[50]===n.config.projectName?x=t[51]:(x=(0,Z.jsx)(`span`,{className:`truncate`,children:n.config.projectName}),t[50]=n.config.projectName,t[51]=x);let S;t[52]===h?S=t[53]:(S=h===null?null:(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1 text-xs text-sidebar-foreground/50 group-hover/menu-button:text-sidebar-foreground`,"data-testid":`project-switcher-branch`,children:[(0,Z.jsx)(ke,{"aria-hidden":`true`,className:`size-3! shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:h})]}),t[52]=h,t[53]=S);let w;t[54]!==x||t[55]!==S?(w=(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[x,S]}),t[54]=x,t[55]=S,t[56]=w):w=t[56];let E;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Z.jsx)(cl,{"aria-hidden":`true`,className:`opacity-60`}),t[57]=E):E=t[57],t[58]!==n.config.projectPath||t[59]!==p||t[60]!==m||t[61]!==b||t[62]!==w?(U=(0,Z.jsx)(ja,{asChild:!0,children:(0,Z.jsxs)(EA,{className:p,"data-testid":`project-switcher-trigger`,"aria-label":m,title:n.config.projectPath,onPointerDown:v,onClick:b,children:[w,E]})}),t[58]=n.config.projectPath,t[59]=p,t[60]=m,t[61]=b,t[62]=w,t[63]=U):U=t[63],M=to,W=`start`,P=`top`,F=`min-w-[260px]`,I=`project-switcher-menu`,L=i.length===0?(0,Z.jsx)(Xa,{className:`font-normal text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`HNnVG1`})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(KC,{className:`mb-1 h-8 border-0 shadow-none has-[[data-slot=input-group-control]:focus-visible]:ring-0`,children:[(0,Z.jsx)(ZC,{"aria-label":r({id:`H8Ng4Z`}),placeholder:r({id:`8S1E33`}),value:d,onChange:e=>f(e.target.value),onKeyDown:Dq,"data-testid":`project-switcher-search`}),(0,Z.jsx)(JC,{children:(0,Z.jsx)(T,{"aria-hidden":`true`})})]}),(0,Z.jsx)(ro,{}),c.length===0?(0,Z.jsx)(Xa,{className:`font-normal text-muted-foreground text-xs`,role:`status`,"aria-live":`polite`,children:(0,Z.jsx)(s,{id:`pEQFsW`})}):(0,Z.jsx)(`div`,{className:`max-h-64 overflow-x-hidden overflow-y-auto overscroll-contain subtle-scrollbar scroll-fade-mask`,children:c.slice(0,10).map(e=>(0,Z.jsxs)(Da,{disabled:e.missing,onSelect:()=>C(e.path),className:`flex w-full min-w-0 flex-col items-start gap-0.5`,"data-testid":`project-switcher-recent-${e.path}`,children:[(0,Z.jsx)(`span`,{className:`w-full truncate font-medium text-sm`,title:e.name,children:e.name}),(0,Z.jsxs)(`span`,{className:`w-full truncate text-muted-foreground text-xs`,title:e.path,children:[e.path,e.missing?r({id:`2Znqb1`}):``]})]},e.path))})]}),t[21]=r,t[22]=h,t[23]=n.config.projectName,t[24]=n.config.projectPath,t[25]=j,t[26]=l,t[27]=C,t[28]=o,t[29]=d,t[30]=M,t[31]=N,t[32]=P,t[33]=F,t[34]=I,t[35]=L,t[36]=z,t[37]=B,t[38]=H,t[39]=U,t[40]=W}else M=t[30],N=t[31],P=t[32],F=t[33],I=t[34],L=t[35],z=t[36],B=t[37],H=t[38],U=t[39],W=t[40];let G;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,Z.jsx)(ro,{}),t[64]=G):G=t[64];let K,q;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Z.jsx)(ie,{"aria-hidden":`true`,className:`text-muted-foreground`}),q=(0,Z.jsx)(s,{id:`PVUn_c`}),t[65]=K,t[66]=q):(K=t[65],q=t[66]);let J;t[67]===E?J=t[68]:(J=(0,Z.jsxs)(Da,{onSelect:E,"data-testid":`project-switcher-open-folder`,children:[K,q]}),t[67]=E,t[68]=J);let ee,te;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Z.jsx)(R,{"aria-hidden":`true`,className:`text-muted-foreground`}),te=(0,Z.jsx)(s,{id:`xaDWAI`}),t[69]=ee,t[70]=te):(ee=t[69],te=t[70]);let ne;t[71]===O?ne=t[72]:(ne=(0,Z.jsxs)(Da,{onSelect:O,"data-testid":`project-switcher-switch-project`,children:[ee,te]}),t[71]=O,t[72]=ne);let re;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Z.jsxs)(Da,{onSelect:A,"data-testid":`project-switcher-new-project`,children:[(0,Z.jsx)(V,{"aria-hidden":`true`,className:`text-muted-foreground`}),(0,Z.jsx)(s,{id:`gKi-a_`})]}),t[73]=re):re=t[73];let Y;t[74]!==M||t[75]!==P||t[76]!==F||t[77]!==I||t[78]!==L||t[79]!==J||t[80]!==ne||t[81]!==W?(Y=(0,Z.jsxs)(M,{align:W,side:P,className:F,"data-testid":I,children:[L,G,J,ne,re]}),t[74]=M,t[75]=P,t[76]=F,t[77]=I,t[78]=L,t[79]=J,t[80]=ne,t[81]=W,t[82]=Y):Y=t[82];let ae;t[83]!==N||t[84]!==z||t[85]!==B||t[86]!==H||t[87]!==U||t[88]!==Y?(ae=(0,Z.jsxs)(N,{open:z,onOpenChange:B,modal:H,children:[U,Y]}),t[83]=N,t[84]=z,t[85]=B,t[86]=H,t[87]=U,t[88]=Y,t[89]=ae):ae=t[89];let oe;t[90]!==n||t[91]!==p?(oe=(0,Z.jsx)(hf,{open:p,onOpenChange:m,bridge:n}),t[90]=n,t[91]=p,t[92]=oe):oe=t[92];let se;return t[93]!==ae||t[94]!==oe?(se=(0,Z.jsxs)(Z.Fragment,{children:[ae,oe]}),t[93]=ae,t[94]=oe,t[95]=se):se=t[95],se}function Dq(e){return e.stopPropagation()}function Oq(e,t){let n=e instanceof Error?e:Error(String(e));console.warn(JSON.stringify({event:`jsx-render-failure`,component:`sidebarSearchPill`,rawComponentName:`sidebarSearchPill`,error:String(n),stack:t.componentStack})),In(`sidebarSearchPill`)}function kq(e){let t=(0,$.c)(8),{onClick:n,className:r}=e,i;t[0]===r?i=t[1]:(i=si(`rounded-lg h-9 w-full justify-start gap-2 px-3 font-normal text-muted-foreground`,r),t[0]=r,t[1]=i);let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(T,{"aria-hidden":`true`}),t[2]=a):a=t[2];let o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(`span`,{className:`flex-1 text-left text-sm`,children:(0,Z.jsx)(s,{id:`A1taO8`})}),t[3]=o):o=t[3];let c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(Yt,{className:`text-foreground/70`,children:tc(`command-palette`)}),t[4]=c):c=t[4];let l;return t[5]!==n||t[6]!==i?(l=(0,Z.jsxs)(li,{variant:`outline`,onClick:n,"data-telemetry-event":`ok.sidebar.search_pill.click`,className:i,children:[a,o,c]}),t[5]=n,t[6]=i,t[7]=l):l=t[7],l}function Aq(e){let t=(0,$.c)(37),{notice:n,onDismiss:r}=e,{_:a}=i(),o=n.variant===`error`?`border-destructive/60 bg-sidebar-accent/30 text-muted-foreground`:n.variant===`success`?`border-emerald-500/40 bg-emerald-500/10 text-emerald-600 dark:text-emerald-400`:`border-sidebar-border bg-sidebar-accent/30 text-muted-foreground`,s;t[0]!==a||t[1]!==n.dismissible||t[2]!==r?(s=n.dismissible===!1?null:(0,Z.jsx)(li,{variant:`ghost`,size:`icon`,className:`size-5 shrink-0 text-muted-foreground hover:text-sidebar-foreground`,"aria-label":a({id:`GUYwCr`}),onClick:r,children:(0,Z.jsx)(gs,{"aria-hidden":`true`,className:`size-3`})}),t[0]=a,t[1]=n.dismissible,t[2]=r,t[3]=s):s=t[3];let c=s,l=`shrink-0 text-xs font-medium underline underline-offset-2 ${n.variant===`success`?`decoration-emerald-500/40`:`decoration-muted-foreground/40`} hover:text-sidebar-foreground hover:decoration-sidebar-foreground`;if(n.secondaryAction){let e=`update-notice-${n.id}`,r=`flex flex-col gap-2 rounded-md border px-2 py-2 text-xs ${o}`,i;t[4]===n.body?i=t[5]:(i=(0,Z.jsx)(`span`,{className:`flex-1 leading-snug`,children:n.body}),t[4]=n.body,t[5]=i);let a;t[6]!==c||t[7]!==i?(a=(0,Z.jsxs)(`div`,{className:`flex items-start gap-2`,children:[i,c]}),t[6]=c,t[7]=i,t[8]=a):a=t[8];let s;t[9]!==l||t[10]!==n.action?(s=n.action?(0,Z.jsx)(`button`,{type:`button`,className:l,onClick:()=>{n.action?.onClick()},children:n.action.label}):null,t[9]=l,t[10]=n.action,t[11]=s):s=t[11];let u;t[12]===n.secondaryAction?u=t[13]:(u=()=>{n.secondaryAction?.onClick()},t[12]=n.secondaryAction,t[13]=u);let d;t[14]!==l||t[15]!==n.secondaryAction.label||t[16]!==u?(d=(0,Z.jsx)(`button`,{type:`button`,className:l,onClick:u,children:n.secondaryAction.label}),t[14]=l,t[15]=n.secondaryAction.label,t[16]=u,t[17]=d):d=t[17];let f;t[18]!==s||t[19]!==d?(f=(0,Z.jsxs)(`div`,{className:`flex gap-3 pl-1`,children:[s,d]}),t[18]=s,t[19]=d,t[20]=f):f=t[20];let p;return t[21]!==e||t[22]!==r||t[23]!==a||t[24]!==f?(p=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":e,className:r,children:[a,f]}),t[21]=e,t[22]=r,t[23]=a,t[24]=f,t[25]=p):p=t[25],p}let u=`update-notice-${n.id}`,d=`flex items-center gap-2 rounded-md border px-2 py-1.5 text-xs ${o}`,f;t[26]===n.body?f=t[27]:(f=(0,Z.jsx)(`span`,{className:`flex-1 leading-snug`,children:n.body}),t[26]=n.body,t[27]=f);let p;t[28]!==l||t[29]!==n.action?(p=n.action?(0,Z.jsx)(`button`,{type:`button`,className:l,onClick:()=>{n.action?.onClick()},children:n.action.label}):null,t[28]=l,t[29]=n.action,t[30]=p):p=t[30];let m;return t[31]!==c||t[32]!==u||t[33]!==d||t[34]!==f||t[35]!==p?(m=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":u,className:d,children:[f,p,c]}),t[31]=c,t[32]=u,t[33]=d,t[34]=f,t[35]=p,t[36]=m):m=t[36],m}function jq(e){if(e.length===0)return null;let t=e[0];if(!t)return null;for(let n=1;n<e.length;n++){let r=e[n];r&&r.priority<t.priority&&(t=r)}return t}function Mq(){let e=(0,$.c)(7),t=(0,Q.useSyncExternalStore)(Hm,Vm,Vm),n;e[0]===t?n=e[1]:(n=jq(t),e[0]=t,e[1]=n);let r=n;if(!r)return null;let i;e[2]===r?i=e[3]:(i=()=>{r.onDismiss?.(),Bm(r.id)},e[2]=r,e[3]=i);let a;return e[4]!==r||e[5]!==i?(a=(0,Z.jsx)(`div`,{"data-testid":`update-notices-list`,children:(0,Z.jsx)(Aq,{notice:r,onDismiss:i})}),e[4]=r,e[5]=i,e[6]=a):a=e[6],a}function Nq(e,t,n){return e?.kind===`doc`&&t||e?.kind===`folder-index`&&t?Zg(n.contentDir,Qg(t),n.pathSeparator):e?.kind===`folder`?Zg(n.contentDir,e.folderPath,n.pathSeparator):e?.kind===`asset`?Zg(n.contentDir,e.assetPath,n.pathSeparator):n.contentDir}function Pq(e,t){return(e?.kind===`doc`||e?.kind===`folder-index`)&&t?Qg(t):e?.kind===`folder`?e.folderPath:e?.kind===`asset`?e.assetPath:``}function Fq(e,t,n){return e===null?e_({workspace:n}):e.kind===`folder`?n?r_({folderRelativePath:e.folderPath,workspace:n}):null:e.kind===`doc`||e.kind===`folder-index`?$g({docName:t,workspace:n}):null}var Iq={folderCount:0,expandedCount:0},Lq=`button, [role="button"], [role="menuitem"], input, textarea, select, a[href]`;function Rq(e){return typeof Element>`u`||!(e instanceof Element)?!1:e.closest(Lq)!==null}function zq(e){let t=(0,$.c)(2),{onOpenSearch:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(Gt,{name:`file-sidebar`,children:(0,Z.jsx)(Vq,{onOpenSearch:n})}),t[0]=n,t[1]=r),r}var Bq=e=>{let t=(0,$.c)(15),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({icon:n,label:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=(0,Z.jsx)(n,{"aria-hidden":`true`}),t[4]=n,t[5]=a);let o;t[6]!==r||t[7]!==i||t[8]!==a?(o=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(li,{variant:`ghost`,size:`icon-sm`,"aria-label":r,...i,children:a})}),t[6]=r,t[7]=i,t[8]=a,t[9]=o):o=t[9];let s;t[10]===r?s=t[11]:(s=(0,Z.jsx)(Ns,{children:r}),t[10]=r,t[11]=s);let c;return t[12]!==o||t[13]!==s?(c=(0,Z.jsxs)(Is,{children:[o,s]}),t[12]=o,t[13]=s,t[14]=c):c=t[14],c};function Vq(e){let t=(0,$.c)(189),{onOpenSearch:n}=e,{_:r}=i(),[a,o]=(0,Q.useState)(null),{activeDocName:c,activeTarget:l}=ht(),u;t[0]!==c||t[1]!==l?(u=l?.kind===`folder`||l?.kind===`folder-index`?l.folderPath:ms(c),t[0]=c,t[1]=l,t[2]=u):u=t[2];let d=u,[f,p]=(0,Q.useState)(!1),m=f?``:d,h=typeof window<`u`&&window.okDesktop!=null,{state:g,toggleSidebar:_}=fA(),v=pg(),y=g===`expanded`,b=h&&g===`collapsed`,[x,S]=(0,Q.useState)(Iq),C,w;t[3]===a?(C=t[4],w=t[5]):(C=()=>{if(a===null)return;let e=()=>{S(a.getFolderState()),p(a.isCreationTargetCleared())};return e(),a.subscribe(e)},w=[a],t[3]=a,t[4]=C,t[5]=w),(0,Q.useEffect)(C,w);let T,E;t[6]===a?(T=t[7],E=t[8]):(T=()=>{if(a!==null)return NS(e=>{let t=e.initialDir??``;if(e.template){a.createFromTemplate(e.template.folder,e.template.name);return}a.startCreating(`file`,t)})},E=[a],t[6]=a,t[7]=T,t[8]=E),(0,Q.useEffect)(T,E);let D=x.folderCount>0,O=D&&x.expandedCount===x.folderCount,k=x.expandedCount===0,A=Ha(``),j=Ha(m===``?null:m),M=m===``?A:j,N=A.state.status===`ready`?(A.state.data.folder.templates_available?.length??0)>0:!0,P=M.state.status===`ready`?(M.state.data.folder.templates_available?.length??0)>0:!0,F=typeof window<`u`?window.okDesktop:void 0,I=ka(),L=D_().states,{dispatch:R}=g_(),z;t[9]===I?z=t[10]:(z=e_({workspace:I}),t[9]=I,t[10]=z);let B=z,{projectLocalBinding:V,merged:H}=oe(),U=H?.appearance?.sidebar?.showHiddenFiles??!1,W=H?.appearance?.sidebar?.showAllFiles??!0,G=D&&!O,K=D&&!k,q=G||K,J=Uq,ee;t[11]!==a||t[12]!==I?(ee=()=>{I&&a?.startCreating(`file`,``)},t[11]=a,t[12]=I,t[13]=ee):ee=t[13];let te=ee,ne;t[14]!==a||t[15]!==I?(ne=e=>{I&&a?.createFromTemplate(``,e)},t[14]=a,t[15]=I,t[16]=ne):ne=t[16];let re=ne,Y;t[17]!==a||t[18]!==I?(Y=()=>{I&&a?.startCreating(`folder`,``)},t[17]=a,t[18]=I,t[19]=Y):Y=t[19];let ae=Y,se;t[20]===I?se=t[21]:(se=()=>{!I||!F||F.shell.showItemInFolder(I.contentDir)},t[20]=I,t[21]=se);let ce=se,ue;t[22]!==r||t[23]!==I?(ue=async()=>{if(I)try{await navigator.clipboard.writeText(I.contentDir),X.success(r({id:`6_ZOw4`}),{description:I.contentDir})}catch(e){console.warn(`[FileSidebar] clipboard write failed:`,e),X.error(r({id:`vfRlCI`}))}},t[22]=r,t[23]=I,t[24]=ue):ue=t[24];let de=ue,fe;t[25]!==r||t[26]!==V?(fe=e=>{if(V===null)return;let t=V.patch({appearance:{sidebar:{showHiddenFiles:e}}});t.ok||(console.warn(`[FileSidebar] showHiddenFiles toggle rejected:`,Vr(t.error)),X.error(r({id:`P47EWZ`}),{description:Vr(t.error)}))},t[25]=r,t[26]=V,t[27]=fe):fe=t[27];let pe=fe,me;t[28]!==r||t[29]!==V?(me=e=>{if(V===null)return;let t=V.patch({appearance:{sidebar:{showAllFiles:e}}});t.ok||(console.warn(`[FileSidebar] showAllFiles toggle rejected:`,Vr(t.error)),X.error(r({id:`P47EWZ`}),{description:Vr(t.error)}))},t[28]=r,t[29]=V,t[30]=me):me=t[30];let he=me,ge;t[31]===a?ge=t[32]:(ge=()=>{a?.expandAll()},t[31]=a,t[32]=ge);let _e=ge,ve;t[33]===a?ve=t[34]:(ve=()=>{a?.collapseAll()},t[33]=a,t[34]=ve);let ye=ve,be,xe;t[35]!==W||t[36]!==K||t[37]!==G||t[38]!==U||t[39]!==g?(be=()=>{F&&F.editor.notifyViewMenuStateChanged({showHiddenFiles:U,showAllFiles:W,canExpandAll:G,canCollapseAll:K,sidebarVisible:g===`expanded`})},xe=[F,U,W,G,K,g],t[35]=W,t[36]=K,t[37]=G,t[38]=U,t[39]=g,t[40]=be,t[41]=xe):(be=t[40],xe=t[41]),(0,Q.useEffect)(be,xe);let Se,Ce;t[42]!==r||t[43]!==c||t[44]!==l||t[45]!==R||t[46]!==L||t[47]!==m||t[48]!==V||t[49]!==W||t[50]!==U||t[51]!==_||t[52]!==a||t[53]!==I?(Se=()=>{if(F)return F.onMenuAction(e=>{switch(e){case`new-doc`:if(!I||!a)return;a.startCreating(`file`,m);return;case`new-folder`:if(!I||!a)return;a.startCreating(`folder`,m);return;case`new-from-template`:if(!I||!a)return;a.startCreatingFromTemplate(m);return;case`rename`:if(!l)return;AG(l);return;case`duplicate`:if(!l)return;MG(l);return;case`move-to-trash`:if(!l)return;OG(l);return;case`reveal-in-finder`:{if(!F||!I)return;let e=Nq(l,c,I);F.shell.showItemInFolder(e);return}case`send-to-ai`:{let e=gg.filter(e=>L[e.id]?.installed===!0);if(e.length===0){X.error(r({id:`LKOLNn`}));return}let t=Fq(l,c,I);if(!t)return;let[n]=e;if(!n)return;R(n.id,t);return}case`copy-full-path`:{if(!I)return;let e=Nq(l,c,I);navigator.clipboard.writeText(e).then(()=>X.success(r({id:`6_ZOw4`}),{description:e})).catch(e=>{console.warn(`[FileSidebar] clipboard write failed:`,e),X.error(r({id:`vfRlCI`}))});return}case`copy-relative-path`:{let e=Pq(l,c);if(e===``){X.error(r({id:`74eHt-`}));return}navigator.clipboard.writeText(e).then(()=>X.success(r({id:`haHgQj`}),{description:e})).catch(e=>{console.warn(`[FileSidebar] clipboard write failed:`,e),X.error(r({id:`5QGTaA`}))});return}case`toggle-show-hidden-files`:{if(V===null)return;let e=V.patch({appearance:{sidebar:{showHiddenFiles:!U}}});e.ok||(console.warn(`[FileSidebar] toggle-show-hidden-files rejected:`,Vr(e.error)),X.error(r({id:`P47EWZ`}),{description:Vr(e.error)}));return}case`toggle-show-all-files`:{if(V===null)return;let e=V.patch({appearance:{sidebar:{showAllFiles:!W}}});e.ok||(console.warn(`[FileSidebar] toggle-show-all-files rejected:`,Vr(e.error)),X.error(r({id:`P47EWZ`}),{description:Vr(e.error)}));return}case`expand-all-tree`:a?.expandAll();return;case`collapse-all-tree`:a?.collapseAll();return;case`toggle-sidebar`:_();return;case`delete`:case`toggle-source`:case`save-version`:case`version-history`:case`focus-search`:case`focus-command-palette`:case`close-active-tab-or-window`:case`toggle-doc-panel`:return}})},Ce=[F,a,I,l,c,m,V,U,W,L,R,_,r],t[42]=r,t[43]=c,t[44]=l,t[45]=R,t[46]=L,t[47]=m,t[48]=V,t[49]=W,t[50]=U,t[51]=_,t[52]=a,t[53]=I,t[54]=Se,t[55]=Ce):(Se=t[54],Ce=t[55]),(0,Q.useEffect)(Se,Ce);let we=h&&y&&`motion-safe:delay-100`,Te=b&&`opacity-0`,Ee;t[56]!==we||t[57]!==Te?(Ee=si(`flex-row h-12 items-center py-0 px-3`,`justify-between`,h&&`overflow-x-clip`,h&&`motion-safe:transition-opacity motion-safe:duration-100 motion-safe:ease-out`,we,Te,h&&`[-webkit-app-region:drag]`),t[56]=we,t[57]=Te,t[58]=Ee):Ee=t[58];let De;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(De=h?(0,Z.jsx)(`div`,{"aria-hidden":`true`,"data-testid":`sidebar-traffic-light-reserve`,className:`w-[var(--ok-titlebar-reserve-left,0px)] shrink-0 self-stretch`}):null,t[59]=De):De=t[59];let Oe;t[60]===y?Oe=t[61]:(Oe=y&&!h?(0,Z.jsx)(`span`,{className:`shrink-0 font-mono text-sm uppercase tracking-wider text-sidebar-foreground/50`,children:(0,Z.jsx)(s,{id:`sER-bs`})}):null,t[60]=y,t[61]=Oe);let ke;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(ke=si(`flex items-center gap-1`,h&&`[&>*]:[-webkit-app-region:no-drag]`),t[62]=ke):ke=t[62];let Ae;t[63]!==r||t[64]!==O||t[65]!==D||t[66]!==k||t[67]!==a?(Ae=D?(0,Z.jsxs)(oo,{children:[(0,Z.jsx)(ja,{asChild:!0,children:(0,Z.jsx)(Bq,{icon:Ml,label:r({id:`Rq1vFD`})})}),(0,Z.jsxs)(to,{align:`end`,children:[O?null:(0,Z.jsxs)(Da,{onSelect:()=>a?.expandAll(),children:[(0,Z.jsx)(mu,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`OlAl5i`})]}),k?null:(0,Z.jsxs)(Da,{onSelect:()=>a?.collapseAll(),children:[(0,Z.jsx)(xl,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`qvWGzP`})]})]})]}):null,t[63]=r,t[64]=O,t[65]=D,t[66]=k,t[67]=a,t[68]=Ae):Ae=t[68];let je;t[69]===r?je=t[70]:(je=r({id:`HdkSiO`}),t[69]=r,t[70]=je);let Me;t[71]!==m||t[72]!==a?(Me=()=>a?.startCreating(`file`,m),t[71]=m,t[72]=a,t[73]=Me):Me=t[73];let Ne;t[74]!==je||t[75]!==Me?(Ne=(0,Z.jsx)(Bq,{icon:nu,label:je,onClick:Me}),t[74]=je,t[75]=Me,t[76]=Ne):Ne=t[76];let Pe;t[77]!==r||t[78]!==P||t[79]!==m||t[80]!==a?(Pe=P?(0,Z.jsxs)(oo,{children:[(0,Z.jsx)(ja,{asChild:!0,children:(0,Z.jsx)(Bq,{icon:La,label:r({id:`Uuj_R4`})})}),(0,Z.jsx)(to,{align:`end`,children:(0,Z.jsx)(xG,{parentDir:m,onSelectTemplate:e=>a?.createFromTemplate(m,e),ItemComponent:Da})})]}):null,t[77]=r,t[78]=P,t[79]=m,t[80]=a,t[81]=Pe):Pe=t[81];let Fe;t[82]===r?Fe=t[83]:(Fe=r({id:`96G6Re`}),t[82]=r,t[83]=Fe);let Ie;t[84]!==m||t[85]!==a?(Ie=()=>a?.startCreating(`folder`,m),t[84]=m,t[85]=a,t[86]=Ie):Ie=t[86];let Le;t[87]!==Fe||t[88]!==Ie?(Le=(0,Z.jsx)(Bq,{icon:Cl,label:Fe,onClick:Ie}),t[87]=Fe,t[88]=Ie,t[89]=Le):Le=t[89];let Re;t[90]!==Ae||t[91]!==Ne||t[92]!==Pe||t[93]!==Le?(Re=(0,Z.jsxs)(`div`,{"data-testid":`sidebar-toolbar`,className:ke,children:[Ae,Ne,Pe,Le]}),t[90]=Ae,t[91]=Ne,t[92]=Pe,t[93]=Le,t[94]=Re):Re=t[94];let ze;t[95]!==Ee||t[96]!==Oe||t[97]!==Re?(ze=(0,Z.jsxs)(bA,{"data-electron-drag":h?``:void 0,className:Ee,children:[De,Oe,Re]}),t[95]=Ee,t[96]=Oe,t[97]=Re,t[98]=ze):ze=t[98];let Be=h&&y&&`motion-safe:delay-100`,Ve=b&&`opacity-0`,He;t[99]!==Be||t[100]!==Ve?(He=si(`px-2 pb-2`,h&&`[-webkit-app-region:no-drag]`,h&&`motion-safe:transition-opacity motion-safe:duration-100 motion-safe:ease-out`,Be,Ve),t[99]=Be,t[100]=Ve,t[101]=He):He=t[101];let Ue;t[102]===g?Ue=t[103]:(Ue=[g],t[102]=g,t[103]=Ue);let We;t[104]===n?We=t[105]:(We=(0,Z.jsx)(kq,{onClick:n}),t[104]=n,t[105]=We);let Ge;t[106]!==Ue||t[107]!==We?(Ge=(0,Z.jsx)(le,{fallbackRender:Hq,onError:Oq,resetKeys:Ue,children:We}),t[106]=Ue,t[107]=We,t[108]=Ge):Ge=t[108];let Ke;t[109]!==He||t[110]!==Ge?(Ke=(0,Z.jsx)(`div`,{className:He,children:Ge}),t[109]=He,t[110]=Ge,t[111]=Ke):Ke=t[111];let qe;t[112]===Symbol.for(`react.memo_cache_sentinel`)?(qe=(0,Z.jsxs)(SA,{children:[(0,Z.jsx)(iP,{}),(0,Z.jsx)(BK,{ref:o})]}),t[112]=qe):qe=t[112];let Je;t[113]===Symbol.for(`react.memo_cache_sentinel`)?(Je=(0,Z.jsxs)(xA,{className:`px-0`,children:[(0,Z.jsx)(Mq,{}),typeof window<`u`&&window.okDesktop?(0,Z.jsx)(CA,{children:(0,Z.jsx)(wA,{children:(0,Z.jsx)(Eq,{bridge:window.okDesktop})})}):null]}),t[113]=Je):Je=t[113];let Ye=!(v&&g===`collapsed`),Xe;t[114]===Ye?Xe=t[115]:(Xe=(0,Z.jsx)(vA,{enableToggle:!1,enableDrag:Ye}),t[114]=Ye,t[115]=Xe);let Ze;t[116]!==ze||t[117]!==Ke||t[118]!==Xe?(Ze=(0,Z.jsx)($M,{asChild:!0,children:(0,Z.jsxs)(`div`,{className:`contents`,onContextMenu:J,children:[ze,Ke,qe,Je,Xe]})}),t[116]=ze,t[117]=Ke,t[118]=Xe,t[119]=Ze):Ze=t[119];let Qe=!I,$e,et;t[120]===Symbol.for(`react.memo_cache_sentinel`)?($e=(0,Z.jsx)(nu,{"aria-hidden":`true`}),et=(0,Z.jsx)(s,{id:`HdkSiO`}),t[120]=$e,t[121]=et):($e=t[120],et=t[121]);let tt;t[122]!==te||t[123]!==Qe?(tt=(0,Z.jsxs)(rN,{disabled:Qe,onSelect:te,"data-testid":`empty-space-menu-new-file`,children:[$e,et]}),t[122]=te,t[123]=Qe,t[124]=tt):tt=t[124];let rt;t[125]!==re||t[126]!==N||t[127]!==I?(rt=N?(0,Z.jsxs)(tN,{children:[(0,Z.jsxs)(iN,{disabled:!I,"data-testid":`empty-space-menu-new-from-template`,children:[(0,Z.jsx)(La,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`Uuj_R4`})]}),(0,Z.jsx)(aN,{children:(0,Z.jsx)(xG,{parentDir:``,onSelectTemplate:re,ItemComponent:rN})})]}):null,t[125]=re,t[126]=N,t[127]=I,t[128]=rt):rt=t[128];let it=!I,at,ot;t[129]===Symbol.for(`react.memo_cache_sentinel`)?(at=(0,Z.jsx)(Cl,{"aria-hidden":`true`}),ot=(0,Z.jsx)(s,{id:`96G6Re`}),t[129]=at,t[130]=ot):(at=t[129],ot=t[130]);let st;t[131]!==ae||t[132]!==it?(st=(0,Z.jsxs)(rN,{disabled:it,onSelect:ae,"data-testid":`empty-space-menu-new-folder`,children:[at,ot]}),t[131]=ae,t[132]=it,t[133]=st):st=t[133];let ct;t[134]===Symbol.for(`react.memo_cache_sentinel`)?(ct=(0,Z.jsx)(cN,{}),t[134]=ct):ct=t[134];let lt;t[135]!==r||t[136]!==ce||t[137]!==I?(lt=F?(0,Z.jsxs)(rN,{disabled:!I,onSelect:ce,"data-testid":`empty-space-menu-reveal-in-finder`,"aria-label":r(I?{id:`LtSYdi`}:{id:`o2yoFu`}),children:[(0,Z.jsx)(ie,{"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`LtSYdi`})}),I?null:(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`wTcjov`})})]}):null,t[135]=r,t[136]=ce,t[137]=I,t[138]=lt):lt=t[138];let ut;t[139]!==R||t[140]!==B||t[141]!==L?(ut=(0,Z.jsx)(wq,{input:B,installStates:L,dispatch:R}),t[139]=R,t[140]=B,t[141]=L,t[142]=ut):ut=t[142];let dt=!I,ft;t[143]!==r||t[144]!==I?(ft=r(I?{id:`Up2_7p`}:{id:`U8CD-l`}),t[143]=r,t[144]=I,t[145]=ft):ft=t[145];let pt;t[146]===Symbol.for(`react.memo_cache_sentinel`)?(pt=(0,Z.jsx)(nt,{"aria-hidden":`true`}),t[146]=pt):pt=t[146];let mt;t[147]===Symbol.for(`react.memo_cache_sentinel`)?(mt=(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`Up2_7p`})}),t[147]=mt):mt=t[147];let gt;t[148]===I?gt=t[149]:(gt=I?null:(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`wTcjov`})}),t[148]=I,t[149]=gt);let _t;t[150]!==de||t[151]!==dt||t[152]!==ft||t[153]!==gt?(_t=(0,Z.jsxs)(rN,{disabled:dt,onSelect:de,"data-testid":`empty-space-menu-copy-full-path`,"aria-label":ft,children:[pt,mt,gt]}),t[150]=de,t[151]=dt,t[152]=ft,t[153]=gt,t[154]=_t):_t=t[154];let vt;t[155]===Symbol.for(`react.memo_cache_sentinel`)?(vt=(0,Z.jsx)(cN,{}),t[155]=vt):vt=t[155];let yt=V===null,bt;t[156]===Symbol.for(`react.memo_cache_sentinel`)?(bt=(0,Z.jsx)(s,{id:`XcGbim`}),t[156]=bt):bt=t[156];let xt;t[157]!==pe||t[158]!==U||t[159]!==yt?(xt=(0,Z.jsx)(oN,{checked:U,onCheckedChange:pe,disabled:yt,"data-testid":`empty-space-menu-show-hidden-files`,children:bt}),t[157]=pe,t[158]=U,t[159]=yt,t[160]=xt):xt=t[160];let St=V===null,Ct;t[161]===Symbol.for(`react.memo_cache_sentinel`)?(Ct=(0,Z.jsx)(s,{id:`i8dKs-`}),t[161]=Ct):Ct=t[161];let wt;t[162]!==he||t[163]!==W||t[164]!==St?(wt=(0,Z.jsx)(oN,{checked:W,onCheckedChange:he,disabled:St,"data-testid":`empty-space-menu-show-all-files`,children:Ct}),t[162]=he,t[163]=W,t[164]=St,t[165]=wt):wt=t[165];let Tt;t[166]===q?Tt=t[167]:(Tt=q?(0,Z.jsx)(cN,{}):null,t[166]=q,t[167]=Tt);let Et;t[168]!==_e||t[169]!==G?(Et=G?(0,Z.jsxs)(rN,{onSelect:_e,"data-testid":`empty-space-menu-expand-all`,children:[(0,Z.jsx)(mu,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`OlAl5i`})]}):null,t[168]=_e,t[169]=G,t[170]=Et):Et=t[170];let Dt;t[171]!==ye||t[172]!==K?(Dt=K?(0,Z.jsxs)(rN,{onSelect:ye,"data-testid":`empty-space-menu-collapse-all`,children:[(0,Z.jsx)(xl,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`qvWGzP`})]}):null,t[171]=ye,t[172]=K,t[173]=Dt):Dt=t[173];let Ot;t[174]!==tt||t[175]!==rt||t[176]!==st||t[177]!==lt||t[178]!==ut||t[179]!==_t||t[180]!==xt||t[181]!==wt||t[182]!==Tt||t[183]!==Et||t[184]!==Dt?(Ot=(0,Z.jsxs)(nN,{children:[tt,rt,st,ct,lt,ut,_t,vt,xt,wt,Tt,Et,Dt]}),t[174]=tt,t[175]=rt,t[176]=st,t[177]=lt,t[178]=ut,t[179]=_t,t[180]=xt,t[181]=wt,t[182]=Tt,t[183]=Et,t[184]=Dt,t[185]=Ot):Ot=t[185];let kt;return t[186]!==Ze||t[187]!==Ot?(kt=(0,Z.jsx)(gA,{variant:`inset`,children:(0,Z.jsxs)(QM,{children:[Ze,Ot]})}),t[186]=Ze,t[187]=Ot,t[188]=kt):kt=t[188],kt}function Hq(){return null}function Uq(e){Rq(e.target)&&(e.preventDefault(),e.stopPropagation())}function Wq(e){let t=e.shareTargetExists,n=e.dirtyConflicts.conflicts,r=e.dirtyConflicts.files;return t&&!n?{kind:`A`,openCurrentEnabled:!0,switchEnabled:!0,conflictingFiles:r}:!t&&!n?{kind:`B`,openCurrentEnabled:!1,switchEnabled:!0,conflictingFiles:r}:t&&n?{kind:`C`,openCurrentEnabled:!0,switchEnabled:!1,conflictingFiles:r}:{kind:`D`,openCurrentEnabled:!1,switchEnabled:!1,conflictingFiles:r}}function Gq(e){return e.detached?e.currentHeadSha:e.currentBranch??`HEAD`}function Kq(e){if(e.ok)return{action:`await-cc1`};switch(e.reason){case`dirty-conflict`:return{action:`rerender-conflict`,files:e.files??[]};case`branch-not-found`:return{action:`dismiss-with-toast`,reason:`branch-not-found`};case`fetch-failed`:case`checkout-failed`:return{action:`stay-with-toast`,reason:e.reason};case`branch-in-other-worktree`:{let t=e.otherWorktreePath;return t===void 0||t.length===0?{action:`stay-with-toast`,reason:`checkout-failed`}:{action:`pivot-to-other-worktree`,otherWorktreePath:t}}default:{let t=e.reason;throw Error(`Unhandled CheckoutFailureReason: ${String(t)}`)}}}var qq={phase:`loading`};function Jq(e,t){return e.phase===`loading`?t===null?{phase:`error`}:{phase:`ready`,info:t}:e}function Yq(e,t){return e.phase===`ready`?{phase:`switching`,info:e.info,pendingDoc:t}:e}function Xq(e,t){if(e.phase!==`switching`)return{state:e};if(t===null)return{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:`proxy-null`}};let n=Kq(t);return n.action===`await-cc1`?{state:{phase:`awaiting-cc1-recycle`,pendingDoc:e.pendingDoc}}:n.action===`rerender-conflict`?{state:{phase:`ready`,info:{...e.info,dirtyConflicts:{conflicts:!0,files:n.files.slice()}}}}:n.action===`pivot-to-other-worktree`?{state:{phase:`branch-in-other-worktree`,info:e.info,otherWorktreePath:n.otherWorktreePath,pendingDoc:e.pendingDoc}}:n.action===`dismiss-with-toast`?{state:{phase:`dismissed`,reason:n.reason},sideEffect:{kind:`toast`,reason:n.reason}}:{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:n.reason}}}function Zq(e){return e!==null&&e.kind===`project-branch-switch`}function Qq(e){let t=(0,$.c)(146),{bridge:n,store:r}=e,a=r===void 0?zf:r,{_:o}=i(),c=(0,Q.useSyncExternalStore)(a.subscribe,a.getSnapshot,iJ),[l,u]=(0,Q.useState)(qq),d=(0,Q.useRef)(!1),f=(0,Q.useRef)(!1),m;t[0]===c?m=t[1]:(m=Zq(c)?c:null,t[0]=c,t[1]=m);let g=m,_;t[2]!==o||t[3]!==g?.share.target.kind?(_=g?.share.target.kind===`folder`?o({id:`ugoTXs`}):o({id:`XH30C4`}),t[2]=o,t[3]=g?.share.target.kind,t[4]=_):_=t[4];let v=_,y;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(y=()=>{u(qq),d.current=!1,f.current=!1},t[5]=y):y=t[5];let b;t[6]===c?b=t[7]:(b=[c],t[6]=c,t[7]=b),(0,Q.useEffect)(y,b);let x;t[8]!==g||t[9]!==n?(x=()=>{g&&(d.current||(d.current=!0,n.project.fetchBranchInfo({projectPath:g.projectPath,branch:g.share.branch,kind:g.share.target.kind,path:p(g.share.target)}).then(e=>{u(t=>Jq(t,e))}).catch(e=>{console.warn(`[receive] branch-info-fetch-failed`,e instanceof Error?e.message:e),u(rJ)})))},t[8]=g,t[9]=n,t[10]=x):x=t[10];let S;t[11]===g?S=t[12]:(S=[g],t[11]=g,t[12]=S),(0,Q.useEffect)(x,S);let C;t[13]!==o||t[14]!==g||t[15]!==l.phase||t[16]!==n||t[17]!==a||t[18]!==v?(C=()=>{if(l.phase!==`awaiting-cc1-recycle`||!g)return;let e=g.share.branch;if(!e){a.dismiss();return}if(f.current)return;f.current=!0;let t=!1;return n.project.awaitBranchSwitched({projectPath:g.projectPath,branch:e,timeoutMs:3e4}).then(r=>{if(!t){if(r.ok){console.log(wu({branch_dialog_action:`branch-switch-complete`,branch:e})),n.project.open({path:g.projectPath,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:g.share.target.kind,path:p(g.share.target)},pendingBranch:e}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=switch`,e instanceof Error?e.message:e),X.error(o({id:`gQV-9w`,values:{targetNoun:v}}))}),a.dismiss();return}console.log(wu({branch_dialog_action:`branch-switch-timeout`,branch:e})),X.error(o({id:`LBwUR6`,values:{targetNoun:v}})),a.dismiss()}}).catch(e=>{t||(console.warn(`[receive] awaitBranchSwitched rejected`,e instanceof Error?e.message:e),X.error(o({id:`Jw6EC4`,values:{targetNoun:v}})),a.dismiss())}),()=>{t=!0}},t[13]=o,t[14]=g,t[15]=l.phase,t[16]=n,t[17]=a,t[18]=v,t[19]=C):C=t[19];let w;if(t[20]!==g||t[21]!==l.phase?(w=[l.phase,g],t[20]=g,t[21]=l.phase,t[22]=w):w=t[22],(0,Q.useEffect)(C,w),!g)return null;let{share:T,projectPath:E,currentBranch:D}=g,O=T.branch,k;t[23]!==o||t[24]!==l.info||t[25]!==l.phase||t[26]!==n.project||t[27]!==E||t[28]!==T.target||t[29]!==O||t[30]!==a?(k=function(){l.phase===`ready`&&Wq(l.info).switchEnabled&&(console.log(wu({branch_dialog_action:`switch`,branch_action:`switch`,branch:O})),u(e=>Yq(e,p(T.target))),n.project.runCheckout({projectPath:E,branch:O}).then(e=>{let t=null,n=!1;u(r=>{let{state:i,sideEffect:a}=Xq(r,e);return a&&(t=a.reason,n=i.phase===`dismissed`),i}),t===`branch-not-found`?X.error(o({id:`NJyQi_`,values:{shareBranch:O}})):t===`fetch-failed`?X.error(o({id:`bWLmRK`})):(t===`checkout-failed`||t===`proxy-null`)&&X.error(o({id:`c863eW`,values:{shareBranch:O}})),n&&a.dismiss()}).catch(e=>{console.warn(`[receive] runCheckout rejected branch_action=switch`,e instanceof Error?e.message:e),u(nJ),X.error(o({id:`c863eW`,values:{shareBranch:O}}))}))},t[23]=o,t[24]=l.info,t[25]=l.phase,t[26]=n.project,t[27]=E,t[28]=T.target,t[29]=O,t[30]=a,t[31]=k):k=t[31];let A=k,j;t[32]!==o||t[33]!==n.project||t[34]!==E||t[35]!==T.target||t[36]!==O||t[37]!==a||t[38]!==v?(j=function(){console.log(wu({branch_dialog_action:`open-current`,branch:O})),n.project.open({path:E,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:T.target.kind,path:p(T.target)}}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=open-current`,e instanceof Error?e.message:e),X.error(o({id:`b5aNbi`,values:{targetNoun:v}}))}),a.dismiss()},t[32]=o,t[33]=n.project,t[34]=E,t[35]=T.target,t[36]=O,t[37]=a,t[38]=v,t[39]=j):j=t[39];let M=j,N;t[40]!==o||t[41]!==l.otherWorktreePath||t[42]!==l.phase||t[43]!==n.project||t[44]!==T.target||t[45]!==O||t[46]!==a?(N=function(){if(l.phase!==`branch-in-other-worktree`)return;let e=l.otherWorktreePath;console.log(wu({branch_dialog_action:`pivot-to-other-worktree`,branch:O})),n.project.open({path:e,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:T.target.kind,path:p(T.target)},pendingBranch:O}).catch(t=>{console.warn(`[receive] pivot-open-failed branch_action=pivot-to-other-worktree`,t instanceof Error?t.message:t),X.error(o({id:`LdABLa`,values:{target:e}}))}),a.dismiss()},t[40]=o,t[41]=l.otherWorktreePath,t[42]=l.phase,t[43]=n.project,t[44]=T.target,t[45]=O,t[46]=a,t[47]=N):N=t[47];let P=N,F;t[48]===a?F=t[49]:(F=function(){console.log(wu({branch_dialog_action:`cancel`})),a.dismiss()},t[48]=a,t[49]=F);let I=F,L,R,z,B,V,H,U,W,G,K,q,J,ee,te,ne,re,Y;if(t[50]!==o||t[51]!==l.info||t[52]!==l.otherWorktreePath||t[53]!==l.phase||t[54]!==I||t[55]!==D||t[56]!==T.branch||t[57]!==T.owner||t[58]!==T.repo||t[59]!==T.target||t[60]!==O||t[61]!==v){Y=l.phase===`ready`||l.phase===`switching`?Wq(l.info):null;let e;t[79]!==l.info||t[80]!==l.phase||t[81]!==D?(e=l.phase===`ready`||l.phase===`switching`?Gq(l.info):D??`HEAD`,t[79]=l.info,t[80]=l.phase,t[81]=D,t[82]=e):e=t[82];let n=e;H=l.phase===`switching`||l.phase===`awaiting-cc1-recycle`;let r;t[83]===o?r=t[84]:(r=o({id:`OuY8t9`}),t[83]=o,t[84]=r),B=r;let i;t[85]!==o||t[86]!==O?(i=o({id:`_BthEY`,values:{shareBranch:O}}),t[85]=o,t[86]=O,t[87]=i):i=t[87],V=i;let a=l.phase===`loading`,c=l.phase===`error`;z=ko,ne=!0,t[88]===I?re=t[89]:(re=e=>{e||I()},t[88]=I,t[89]=re),R=To,K=`sm:max-w-xl`,q=`share-branch-switch-dialog`,J=tJ,ee=eJ;let u;t[90]===v?u=t[91]:(u=(0,Z.jsx)(wo,{children:(0,Z.jsx)(s,{id:`RY6Bq1`,values:{targetNoun:v}})}),t[90]=v,t[91]=u);let d=T.owner,f=T.repo,m;t[92]===T.target?m=t[93]:(m=p(T.target),t[92]=T.target,t[93]=m);let g;t[94]!==T.owner||t[95]!==T.repo||t[96]!==m?(g=(0,Z.jsx)(Co,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`f8jU-L`,values:{0:d,1:f,2:m}})}),t[94]=T.owner,t[95]=T.repo,t[96]=m,t[97]=g):g=t[97],t[98]!==u||t[99]!==g?(te=(0,Z.jsxs)(Oo,{children:[u,g]}),t[98]=u,t[99]=g,t[100]=te):te=t[100],L=Eo;let _=T.owner,y=T.repo,b;t[101]===T.target?b=t[102]:(b=p(T.target),t[101]=T.target,t[102]=b),t[103]!==T.branch||t[104]!==T.owner||t[105]!==T.repo||t[106]!==T.target.kind||t[107]!==b?(U=(0,Z.jsx)(`div`,{className:`mb-4`,children:(0,Z.jsx)(jf,{owner:_,repo:y,path:b,kind:T.target.kind,branch:T.branch,testId:`share-branch-switch-metadata`,branchTestId:`share-branch-switch-metadata-branch`})}),t[103]=T.branch,t[104]=T.owner,t[105]=T.repo,t[106]=T.target.kind,t[107]=b,t[108]=U):U=t[108],W=l.phase===`branch-in-other-worktree`?(0,Z.jsxs)(`div`,{className:`text-sm text-muted-foreground`,"data-testid":`share-branch-switch-in-other-worktree`,children:[(0,Z.jsx)(`p`,{className:`leading-6`,children:(0,Z.jsx)(s,{id:`yjExfe`,values:{shareBranch:O},components:{0:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),(0,Z.jsx)(`p`,{className:`mt-2 break-all rounded bg-muted px-2 py-1 font-mono text-xs text-foreground/80`,"data-testid":`share-branch-switch-in-other-worktree-path`,children:l.otherWorktreePath})]}):a?(0,Z.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-loading`,role:`status`,"aria-live":`polite`,children:[(0,Z.jsx)(h,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`jerqF0`})]}):c?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`w4hMYl`})}):Y?.kind===`D`?(0,Z.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,Z.jsx)(s,{id:`XnoA1k`,values:{targetNoun:v,shareBranch:O},components:{0:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):Y?.kind===`B`?(0,Z.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,Z.jsx)(s,{id:`sZ2IOu`,values:{targetNoun:v,shareBranch:O,currentLabel:n},components:{0:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,Z.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,Z.jsx)(s,{id:`_902BE`,values:{targetNoun:v,shareBranch:O,currentLabel:n},components:{0:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),G=Y&&!Y.switchEnabled&&Y.conflictingFiles.length>0?(0,Z.jsxs)(`div`,{className:`mt-3 rounded-md border border-border bg-muted/30 p-3 text-1sm`,"data-testid":`share-branch-switch-conflict`,children:[(0,Z.jsx)(`p`,{className:`font-medium text-foreground/90`,children:(0,Z.jsx)(s,{id:`n2lRue`})}),(0,Z.jsx)(`ul`,{id:`share-receive-branch-conflict-files`,className:`mt-1 list-disc space-y-0.5 pl-5 text-muted-foreground`,children:Y.conflictingFiles.map($q)})]}):null,t[50]=o,t[51]=l.info,t[52]=l.otherWorktreePath,t[53]=l.phase,t[54]=I,t[55]=D,t[56]=T.branch,t[57]=T.owner,t[58]=T.repo,t[59]=T.target,t[60]=O,t[61]=v,t[62]=L,t[63]=R,t[64]=z,t[65]=B,t[66]=V,t[67]=H,t[68]=U,t[69]=W,t[70]=G,t[71]=K,t[72]=q,t[73]=J,t[74]=ee,t[75]=te,t[76]=ne,t[77]=re,t[78]=Y}else L=t[62],R=t[63],z=t[64],B=t[65],V=t[66],H=t[67],U=t[68],W=t[69],G=t[70],K=t[71],q=t[72],J=t[73],ee=t[74],te=t[75],ne=t[76],re=t[77],Y=t[78];let ie;t[109]===H?ie=t[110]:(ie=H?(0,Z.jsxs)(`p`,{className:`mt-3 flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-switching`,role:`status`,"aria-live":`polite`,children:[(0,Z.jsx)(h,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`CU3AiE`})]}):null,t[109]=H,t[110]=ie);let ae;t[111]!==L||t[112]!==U||t[113]!==W||t[114]!==G||t[115]!==ie?(ae=(0,Z.jsxs)(L,{children:[U,W,G,ie]}),t[111]=L,t[112]=U,t[113]=W,t[114]=G,t[115]=ie,t[116]=ae):ae=t[116];let oe;t[117]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,Z.jsx)(s,{id:`dEgA5A`}),t[117]=oe):oe=t[117];let se;t[118]===I?se=t[119]:(se=(0,Z.jsx)(li,{variant:`ghost`,className:`font-mono uppercase`,onClick:I,"data-testid":`share-branch-switch-cancel`,children:oe}),t[118]=I,t[119]=se);let ce;t[120]!==l.phase||t[121]!==M||t[122]!==P||t[123]!==A||t[124]!==B||t[125]!==V||t[126]!==H||t[127]!==Y?(ce=l.phase===`branch-in-other-worktree`?(0,Z.jsx)(li,{onClick:P,"data-testid":`share-branch-switch-in-other-worktree-pivot`,children:(0,Z.jsx)(s,{id:`hyCxJY`})}):(0,Z.jsxs)(`div`,{className:`flex flex-col-reverse gap-2 sm:flex-row sm:gap-2`,children:[Y?.openCurrentEnabled?(0,Z.jsxs)(li,{variant:`outline`,className:`font-mono uppercase`,onClick:M,disabled:H,"data-testid":`share-branch-switch-open-current`,children:[(0,Z.jsx)(Il,{className:`size-3.5`,"aria-hidden":!0}),B]}):null,(0,Z.jsx)(li,{onClick:A,disabled:!Y?.switchEnabled||H,"aria-disabled":!Y?.switchEnabled||H,"aria-describedby":Y&&!Y.switchEnabled&&Y.conflictingFiles.length>0?`share-receive-branch-conflict-files`:void 0,"data-testid":`share-branch-switch-switch`,children:H?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(h,{className:`size-3.5 animate-spin`,"aria-hidden":`true`}),V]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ke,{className:`size-3.5`,"aria-hidden":!0}),V]})})]}),t[120]=l.phase,t[121]=M,t[122]=P,t[123]=A,t[124]=B,t[125]=V,t[126]=H,t[127]=Y,t[128]=ce):ce=t[128];let le;t[129]!==se||t[130]!==ce?(le=(0,Z.jsxs)(Do,{className:`sm:justify-between`,children:[se,ce]}),t[129]=se,t[130]=ce,t[131]=le):le=t[131];let ue;t[132]!==R||t[133]!==K||t[134]!==q||t[135]!==J||t[136]!==ee||t[137]!==te||t[138]!==ae||t[139]!==le?(ue=(0,Z.jsxs)(R,{className:K,"data-testid":q,onInteractOutside:J,onPointerDownOutside:ee,children:[te,ae,le]}),t[132]=R,t[133]=K,t[134]=q,t[135]=J,t[136]=ee,t[137]=te,t[138]=ae,t[139]=le,t[140]=ue):ue=t[140];let de;return t[141]!==z||t[142]!==ne||t[143]!==re||t[144]!==ue?(de=(0,Z.jsx)(z,{open:ne,onOpenChange:re,children:ue}),t[141]=z,t[142]=ne,t[143]=re,t[144]=ue,t[145]=de):de=t[145],de}function $q(e){return(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{className:`text-foreground/80`,children:e})},e)}function eJ(e){e.preventDefault()}function tJ(e){e.preventDefault()}function nJ(e){return Xq(e,null).state}function rJ(e){return Jq(e,null)}function iJ(){return null}function aJ(){let e=(0,$.c)(17),t=wn(),{collabUrl:n,setSystemProvider:r,updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c}=ht(),l;e[0]!==o||e[1]!==s||e[2]!==a||e[3]!==c||e[4]!==i?(l={updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c},e[0]=o,e[1]=s,e[2]=a,e[3]=c,e[4]=i,e[5]=l):l=e[5];let u=(0,Q.useRef)(l),d;e[6]!==o||e[7]!==s||e[8]!==a||e[9]!==c||e[10]!==i?(d=()=>{u.current={updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c}},e[6]=o,e[7]=s,e[8]=a,e[9]=c,e[10]=i,e[11]=d):d=e[11],(0,Q.useEffect)(d);let f,p;return e[12]!==n||e[13]!==t||e[14]!==r?(f=()=>{if(n===null)return;let e=new Pe,i=new dt({url:n,name:Wr,document:e,onStateless:e=>{let{payload:t}=e;H(t,{onServerInfo:e=>{u.current.updateServerInstanceId(e.serverInstanceId),e.currentBranch!==void 0&&u.current.observeBranch(e.currentBranch)},onBranchSwitched:e=>{u.current.onBranchSwitched(e.branch)},onDiskAck:e=>{u.current.observeDiskAck(e.docName,e.sv)},onDerivedView:dJ,onConfigValidationRejected:uJ,onConfigIgnoreNestedError:lJ,onUnknown:cJ})},onClose:sJ,onDisconnect:oJ}),a=es(e=>{(e.includes(`files`)||e.includes(`backlinks`))&&(t.invalidateQueries({queryKey:[`backlinks`]}),t.invalidateQueries({queryKey:[`forward-links`]})),(e.includes(`files`)||e.includes(`graph`))&&(t.invalidateQueries({queryKey:[`orphans`]}),t.invalidateQueries({queryKey:[`hubs`]}))}),o=Zt(()=>{u.current.refreshServerInfo()});i.on(`synced`,()=>{cs([`files`,`backlinks`,`graph`]),o()});let s=new Set,c=()=>{if(i.awareness)for(let[e,t]of i.awareness.getStates().entries())s.has(e)||t.user?.type===`agent`&&(s.add(e),console.warn(`[agent-presence] observed stale AwarenessUser.type === 'agent' from clientID ${e} — probably a stale bundled client`))};return i.awareness?.on(`change`,c),r(i),()=>{a(),i.awareness?.off(`change`,c),r(null),i.destroy(),e.destroy()}},p=[t,n,r],e[12]=n,e[13]=t,e[14]=r,e[15]=f,e[16]=p):(f=e[15],p=e[16]),(0,Q.useEffect)(f,p),null}function oJ(){console.warn(`[CC1] __system__ disconnected - derived views may be stale`)}function sJ(e){let{event:t}=e;console.warn(`[CC1] __system__ connection closed:`,t.code,t.reason)}function cJ(e){console.warn(`[CC1] Unparseable stateless payload, skipping:`,e.slice(0,100))}function lJ(e){eo(e)}function uJ(e){io(e)}function dJ(e){cs([e.ch])}var fJ=`#install-claude-desktop`;function pJ(e){return e===`#settings`||e===fJ}function mJ(e,t,n){return[e,t,n].map(e=>[...e].sort().join(`\0`)).join(``)}function hJ(){let e=(0,$.c)(23),{clearTarget:t,syncOpenTabsWithKnownTargets:n,tabSessionLoaded:r}=ht(),{openTargetTransition:i}=Ot(),{assetPaths:a,folderPaths:o,loading:s,pageMeta:c,pages:l,pagesBySlug:u,pagesByBasename:d}=is(),f=(0,Q.useRef)(null),p;e[0]!==a||e[1]!==o||e[2]!==l?(p=mJ(l,o,a),e[0]=a,e[1]=o,e[2]=l,e[3]=p):p=e[3];let m=p,h,g;e[4]!==a||e[5]!==o||e[6]!==s||e[7]!==l||e[8]!==n||e[9]!==r||e[10]!==m?(h=()=>{s||!r||f.current===m||(f.current=m,n({pages:l,folderPaths:o,assetPaths:a}))},g=[a,o,s,l,n,r,m],e[4]=a,e[5]=o,e[6]=s,e[7]=l,e[8]=n,e[9]=r,e[10]=m,e[11]=h,e[12]=g):(h=e[11],g=e[12]),(0,Q.useEffect)(h,g);let _,v;return e[13]!==t||e[14]!==o||e[15]!==s||e[16]!==i||e[17]!==c||e[18]!==l||e[19]!==d||e[20]!==u?(_=()=>{e();function e(){if(pJ(window.location.hash))return;let e=Lo(window.location.hash);if(e){let t=rr(e.split(`.`).pop()??``);ue(`ok/nav/hash-change`,{docName:null,kind:`asset`}),i({kind:`asset`,target:e,assetPath:e,mediaKind:t});return}if(Go(window.location.hash)){ue(`ok/nav/hash-change`,{docName:null,kind:`folder`}),i({kind:`folder`,target:``,folderPath:``});return}let n=as(window.location.hash);if(!n){ue(`ok/nav/hash-change`,{docName:null,kind:`clear`}),t();return}if(s){ue(`ok/nav/hash-change`,{docName:n,kind:`deferred-loading`});return}let r=ns(n,{pages:l,folderPaths:o,pagesBySlug:u,pagesByBasename:d});if(r.kind===`missing`&&/\/+$/.test(n.trim())){ue(`ok/nav/hash-change`,{docName:n,kind:`deferred-missing-folder`});return}let a=ss(us(r),c);ue(`ok/nav/hash-change`,{docName:n,kind:a.kind}),i(a)}return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},v=[t,o,s,i,c,l,u,d],e[13]=t,e[14]=o,e[15]=s,e[16]=i,e[17]=c,e[18]=l,e[19]=d,e[20]=u,e[21]=_,e[22]=v):(_=e[21],v=e[22]),(0,Q.useEffect)(_,v),null}function gJ(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0],(0,Q.useEffect)(_J,t),null}function _J(){let e=bJ;if(!e(window.location.hash))return;let t=new AbortController;return ce(t.signal).then(n=>{if(t.signal.aborted||n.status!==`ok`)return;let r=n.config.paneTarget;r?.startsWith(`#/`)&&e(window.location.hash)&&(window.location.hash=r,fetch(`/api/config`,{method:`DELETE`}).catch(yJ))}).catch(vJ),()=>t.abort()}function vJ(){}function yJ(){}function bJ(e){return!pJ(e)&&!Lo(e)&&!as(e)&&(e===``||e===`#`||e===`#/`)}function xJ(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0],(0,Q.useEffect)(SJ,t),null}function SJ(){let e=function(e){let t=e.target;Cg({target:t,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,key:e.key})&&(e.preventDefault(),window.location.hash!==`#settings`&&(window.location.hash=Sg))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)}function CJ(){let e=(0,$.c)(4),{activeTarget:t}=ht(),n=typeof window<`u`?window.okDesktop??null:null,r=t?.kind===`doc`||t?.kind===`folder`||t?.kind===`asset`?t.kind:null,i=t?.kind===`doc`?t.docName:t?.kind===`folder`?t.folderPath:t?.kind===`asset`?t.assetPath:null,a,o;return e[0]!==i||e[1]!==r?(a=()=>{if(n){if(r===null){n.editor.notifyActiveTargetChanged({kind:null});return}i!==null&&n.editor.notifyActiveTargetChanged({kind:r,identifier:i})}},o=[n,r,i],e[0]=i,e[1]=r,e[2]=a,e[3]=o):(a=e[2],o=e[3]),(0,Q.useEffect)(a,o),null}function wJ(){let e=(0,$.c)(8),{activeDocName:t,activeTarget:n}=ht(),[r,i]=(0,Q.useState)(!1),a;e[0]!==t||e[1]!==n?(a=n?.kind===`folder`?n.folderPath:ms(t),e[0]=t,e[1]=n,e[2]=a):a=e[2];let o=a,s,c;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{let e=function(e){let t=e.target;Lh({target:t,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,key:e.key})&&(e.preventDefault(),i(!0))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},c=[],e[3]=s,e[4]=c):(s=e[3],c=e[4]),(0,Q.useEffect)(s,c);let l;return e[5]!==r||e[6]!==o?(l=(0,Z.jsx)(zh,{open:r,onOpenChange:i,kind:`file`,initialDir:o}),e[5]=r,e[6]=o,e[7]=l):l=e[7],l}function TJ(e){let t=(0,$.c)(3),{children:n}=e,{collabUrl:r}=ht(),i;return t[0]!==n||t[1]!==r?(i=(0,Z.jsx)(B,{collabUrl:r,children:n}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i}function EJ(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(Gt,{name:`app`,children:(0,Z.jsx)(Nt,{children:(0,Z.jsx)(TJ,{children:(0,Z.jsx)(vg,{children:(0,Z.jsx)(DJ,{})})})})}),e[0]=t):t=e[0],t}function DJ(){let e=(0,$.c)(25),t=typeof window<`u`?window.okDesktop??null:null,n=typeof window<`u`&&window.okDesktop!=null,[r,i]=(0,Q.useState)(!1),a=xg(),o;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=t?{launchInTerminal:OJ}:null,e[0]=o):o=e[0];let s=o,c;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(K_,{}),e[1]=c):c=e[1];let l,u,d,f,p;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(aJ,{}),u=(0,Z.jsx)(hJ,{}),d=(0,Z.jsx)(gJ,{}),f=(0,Z.jsx)(CJ,{}),p=(0,Z.jsx)(wJ,{}),e[2]=l,e[3]=u,e[4]=d,e[5]=f,e[6]=p):(l=e[2],u=e[3],d=e[4],f=e[5],p=e[6]);let m;e[7]===a?m=e[8]:(m=!a&&(0,Z.jsx)(xJ,{}),e[7]=a,e[8]=m);let h,g,_,v;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(_=!1,v=t?(0,Z.jsx)(q_,{bridge:t}):null,h=(0,Z.jsx)(Df,{}),g=t?(0,Z.jsx)(Qq,{bridge:t}):null,e[9]=h,e[10]=g,e[11]=_,e[12]=v):(h=e[9],g=e[10],_=e[11],v=e[12]);let y;e[13]===r?y=e[14]:(y=(0,Z.jsx)(R_,{bridge:t,open:r,onOpenChange:i}),e[13]=r,e[14]=y);let b;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(b=n&&(0,Z.jsx)(`div`,{"aria-hidden":`true`,"data-testid":`editor-window-chrome-drag-strip`,"data-electron-drag":``,className:`pointer-events-none fixed inset-x-0 top-0 z-50 h-2 [-webkit-app-region:drag]`}),e[15]=b):b=e[15];let x;e[16]===a?x=e[17]:(x=!a&&(0,Z.jsx)(zq,{onOpenSearch:()=>i(!0)}),e[16]=a,e[17]=x);let S;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(yA,{className:`overflow-hidden h-[calc(100vh-var(--layout-inset-offset))]`,children:(0,Z.jsx)(eP,{onOpenSearch:()=>i(!0)})}),e[18]=S):S=e[18];let C;e[19]===x?C=e[20]:(C=(0,Z.jsx)(Ux,{value:s,children:(0,Z.jsxs)(pA,{className:`h-screen overflow-hidden`,children:[x,S]})}),e[19]=x,e[20]=C);let w;return e[21]!==y||e[22]!==C||e[23]!==m?(w=(0,Z.jsxs)(Z.Fragment,{children:[c,(0,Z.jsxs)(ls,{children:[l,u,d,f,p,m,_,v,h,g,y,b,C]})]}),e[21]=y,e[22]=C,e[23]=m,e[24]=w):w=e[24],w}function OJ(e){QN(d_(e))}Rc(),sp({apiOrigin:typeof window<`u`?window.okDesktop?.config.apiOrigin:void 0}),bp(),Kp()&&Qp(),Um(),sm(),typeof window<`u`&&Sp({bridge:window.okDesktop}),typeof window<`u`&&Np({bridge:window.okDesktop}),typeof window<`u`&&$s({bridge:window.okDesktop}),typeof window<`u`&&Js({bridge:window.okDesktop}),typeof window<`u`&&Tp({bridge:window.okDesktop}),typeof window<`u`&&Bf({bridge:window.okDesktop}),dm();var kJ=new qc({defaultOptions:{queries:{retry:1,staleTime:1e4}}}),AJ=document.getElementById(`root`);if(!AJ)throw Error(`Root element not found`);var jJ=typeof window<`u`&&window.okDesktop?.config.mode===`navigator`;(0,il.createRoot)(AJ).render((0,Z.jsx)(Q.StrictMode,{children:(0,Z.jsx)(a,{i18n:hs,children:(0,Z.jsx)(gn,{client:kJ,children:(0,Z.jsxs)(yr,{attribute:`class`,defaultTheme:`system`,enableSystem:!0,disableTransitionOnChange:!0,storageKey:`ok-theme-v1`,children:[(0,Z.jsx)(Fs,{children:jJ&&window.okDesktop?(0,Z.jsx)(ep,{bridge:window.okDesktop}):(0,Z.jsx)(EJ,{})}),(0,Z.jsx)(ap,{richColors:!0,closeButton:!0})]})})})}));
|
|
2002
|
+
`}\n${OW}\n${kW}`;function DK(e){let t=e.split(`/`).pop()?.replace(/\.md$/i,``).toLowerCase();return!!t&&uK.has(t)}function OK(e){return e===`darwin`?hs._({id:`LtSYdi`}):e===`win32`?hs._({id:`qi1F96`}):hs._({id:`e1Rn_k`})}function kK(e){let t=(0,$.c)(18),{item:n,workspace:r,onClose:a}=e,{_:o}=i(),s=typeof window<`u`?window.okDesktop:void 0;if(!s)return null;let c=s.platform,l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=OK(c),t[0]=l):l=t[0];let u=l,d,f;t[1]!==o||t[2]!==r?(d=r?null:o({id:`wTcjov`}),f=o(c===`darwin`?d?{id:`FvpFSZ`,values:{hint:d}}:{id:`LtSYdi`}:c===`win32`?d?{id:`o4dcAf`,values:{hint:d}}:{id:`qi1F96`}:d?{id:`zUhPuR`,values:{hint:d}}:{id:`e1Rn_k`}),t[1]=o,t[2]=r,t[3]=d,t[4]=f):(d=t[3],f=t[4]);let p=f,m=!r,h;t[5]!==n||t[6]!==a||t[7]!==r?(h=()=>{if(!r)return;a();let e=Zg(r.contentDir,CM(n),r.pathSeparator);s.shell.showItemInFolder(e)},t[5]=n,t[6]=a,t[7]=r,t[8]=h):h=t[8];let g,_;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(ie,{"aria-hidden":`true`}),_=(0,Z.jsx)(`span`,{className:`flex-1`,children:u}),t[9]=g,t[10]=_):(g=t[9],_=t[10]);let v;t[11]===d?v=t[12]:(v=d?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:d}):null,t[11]=d,t[12]=v);let y;return t[13]!==p||t[14]!==m||t[15]!==h||t[16]!==v?(y=(0,Z.jsxs)(Da,{disabled:m,onSelect:h,"aria-label":p,children:[g,_,v]}),t[13]=p,t[14]=m,t[15]=h,t[16]=v,t[17]=y):y=t[17],y}function AK(e,t){return SM({kind:e.endsWith(`/`)?`directory`:`file`,name:e,path:e},t)}function jK(e,t){return e!==t&&e.startsWith(t)}function MK(e,t){let n=[...new Set(e)],r=n.filter(e=>e.endsWith(`/`));return n.filter(e=>!r.some(t=>jK(e,t))).map(e=>AK(e,t))}function NK(e,t){return e===t||e.startsWith(`${t}/`)}function PK(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName;return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`||e.isContentEditable||e.closest(`[contenteditable="true"]`)!==null}function FK(e,t,n){let r=new Set,i=new Set,a=new Set;for(let o of e){if(o.kind===`file`){r.add(o.path);continue}if(o.kind===`asset`){a.add(o.path);continue}i.add(o.path);for(let e of t)ps(e)&&e.docName.startsWith(`${o.path}/`)?r.add(e.docName):zo(e)&&e.path.startsWith(`${o.path}/`)&&a.add(e.path);for(let e of n){let t=dM(e);NK(t,o.path)&&i.add(t)}}return{docNames:r,folderPaths:i,assetPaths:a}}function IK(e,t){return e.kind===`file`?t.kind===`file`&&e.path===t.createdPath:e.kind===`asset`?!1:NK(t.createdPath,e.path)}function LK(e){let t=(0,$.c)(60),{item:n,context:r,anyActionBusy:a,workspace:o,handoff:c,model:l,okignoreBinding:u,projectLocalBinding:d,mergedConfig:f,onStartCreating:p,onCreateFromTemplate:m,onDuplicate:h,onDelete:g,onExpandSubtree:_,onCollapseSubtree:v,folderTreePaths:y,isAsset:b,documents:x}=e,{_:S}=i(),C=SM(n,x),w=n.kind===`directory`,T=C.kind===`asset`?null:C,E=T!==null&&u!==null,D;t[0]!==S||t[1]!==w?(D=S(w?{id:`5D3Ior`}:{id:`dbhUX1`}),t[0]=S,t[1]=w,t[2]=D):D=t[2];let O=D,k=f?.appearance?.sidebar?.showHiddenFiles??!1,A=f?.appearance?.sidebar?.showAllFiles??!0,j=d!==null,M;t[3]!==w||t[4]!==n.path?(M=w?dM(n.path):null,t[3]=w,t[4]=n.path,t[5]=M):M=t[5];let N=Ha(M),P=N.state.status===`ready`?(N.state.data.folder.templates_available?.length??0)>0:!0,F=l.getSelectedPaths(),I=F.includes(C.treePath)?MK(F,x):[],L=I.length>1?I:[C],R=L.length,z=hs._({id:`djjdjr`,values:{deleteCount:R}}),B;t[6]!==b||t[7]!==w||t[8]!==n||t[9]!==o?(B=b?null:w?r_({folderRelativePath:CM(n),workspace:o}):$g({docName:cM(n.path),workspace:o}),t[6]=b,t[7]=w,t[8]=n,t[9]=o,t[10]=B):B=t[10];let V=B,H;t[11]===r?H=t[12]:(H=()=>r.close({restoreFocus:!1}),t[11]=r,t[12]=H);let U=H,W;t[13]===r?W=t[14]:(W=()=>r.close(),t[13]=r,t[14]=W);let G=W,q;t[15]!==S||t[16]!==d?(q=e=>{if(d===null)return;let t=d.patch({appearance:{sidebar:{showHiddenFiles:e}}});t.ok||(console.warn(`[FileTree] showHiddenFiles toggle rejected:`,Vr(t.error)),X.error(S({id:`P47EWZ`}),{description:Vr(t.error)}))},t[15]=S,t[16]=d,t[17]=q):q=t[17];let J=q,ee;t[18]!==S||t[19]!==d?(ee=e=>{if(d===null)return;let t=d.patch({appearance:{sidebar:{showAllFiles:e}}});t.ok||(console.warn(`[FileTree] showAllFiles toggle rejected:`,Vr(t.error)),X.error(S({id:`P47EWZ`}),{description:Vr(t.error)}))},t[18]=S,t[19]=d,t[20]=ee):ee=t[20];let te=ee,ne=0,re=0;if(w){let e=fM(n.path);for(let t of y)(t===e||t.startsWith(e))&&(ne++,xG(l.getItem(t))?.isExpanded()&&re++)}let Y=w&&re<ne,ie=w&&re>0,ae;t[21]===G?ae=t[22]:(ae=e=>{e||G()},t[21]=G,t[22]=ae);let oe;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,Z.jsx)(ja,{asChild:!0,children:(0,Z.jsx)(`span`,{"aria-hidden":`true`,"data-file-tree-context-menu-root":`true`,className:`block size-px`})}),t[23]=oe):oe=t[23];let ce;t[24]!==S||t[25]!==a||t[26]!==E||t[27]!==j||t[28]!==G||t[29]!==U||t[30]!==z||t[31]!==L||t[32]!==P||t[33]!==te||t[34]!==J||t[35]!==c||t[36]!==V||t[37]!==O||t[38]!==b||t[39]!==w||t[40]!==n||t[41]!==l||t[42]!==u||t[43]!==T||t[44]!==v||t[45]!==m||t[46]!==g||t[47]!==h||t[48]!==_||t[49]!==p||t[50]!==A||t[51]!==k||t[52]!==ie||t[53]!==Y||t[54]!==C||t[55]!==o?(ce=(0,Z.jsx)(to,{sideOffset:0,align:`start`,"data-file-tree-context-menu-root":`true`,className:`min-w-52`,children:w?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Da,{disabled:a,onSelect:()=>{U(),p(`file`,dM(n.path))},children:[(0,Z.jsx)(nu,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`HdkSiO`})]}),P?(0,Z.jsxs)(Aa,{children:[(0,Z.jsxs)(co,{disabled:a,children:[(0,Z.jsx)(La,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`Uuj_R4`})]}),(0,Z.jsx)(Ua,{children:(0,Z.jsx)(bG,{parentDir:dM(n.path),onSelectTemplate:e=>{U(),m(dM(n.path),e)},ItemComponent:Da})})]}):null,(0,Z.jsxs)(Da,{disabled:a,onSelect:()=>{U(),p(`folder`,dM(n.path))},children:[(0,Z.jsx)(Cl,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`96G6Re`})]}),(0,Z.jsx)(ro,{}),(0,Z.jsx)(kK,{item:n,workspace:o,onClose:G}),(0,Z.jsx)(UG,{input:V,installStates:c.installStates,isElectronHost:c.isElectronHost,dispatch:c.dispatch}),(0,Z.jsxs)(Aa,{children:[(0,Z.jsxs)(co,{children:[(0,Z.jsx)(nt,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`oCZkaG`})]}),(0,Z.jsxs)(Ua,{children:[(0,Z.jsx)(Da,{disabled:!o,onSelect:()=>{o&&(G(),lK(Zg(o.contentDir,CM(n),o.pathSeparator),`full`))},children:(0,Z.jsx)(s,{id:`oQA-cA`})}),(0,Z.jsx)(Da,{onSelect:()=>{G(),lK(CM(n),`relative`)},children:(0,Z.jsx)(s,{id:`s061i4`})})]})]}),(0,Z.jsx)(ro,{}),(0,Z.jsx)(qa,{checked:k,onCheckedChange:J,disabled:!j,"data-testid":`file-tree-menu-show-hidden-files`,children:(0,Z.jsx)(s,{id:`XcGbim`})}),(0,Z.jsx)(qa,{checked:A,onCheckedChange:te,disabled:!j,"data-testid":`file-tree-menu-show-all-files`,children:(0,Z.jsx)(s,{id:`i8dKs-`})}),Y||ie?(0,Z.jsx)(ro,{}):null,Y?(0,Z.jsxs)(Da,{onSelect:()=>{G(),_(n.path)},children:[(0,Z.jsx)(mu,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`OlAl5i`})]}):null,ie?(0,Z.jsxs)(Da,{onSelect:()=>{G(),v(n.path)},children:[(0,Z.jsx)(xl,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`qvWGzP`})]}):null,(0,Z.jsx)(ro,{}),(0,Z.jsxs)(Da,{disabled:a,onSelect:()=>{C.kind!==`asset`&&(G(),h(C))},children:[(0,Z.jsx)(Fe,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`euc6Ns`})]}),(0,Z.jsxs)(Da,{disabled:a,onSelect:()=>{U(),l.startRenaming(n.path)},children:[(0,Z.jsx)(se,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`2wxgft`})]}),(0,Z.jsxs)(Da,{"data-testid":`file-tree-menu-hide`,disabled:!E,onSelect:()=>{if(!u||!T)return;G();let e=KW(T),t=so(u.current()),n=Ja(t,e);if(n===t)return;u.patch(Za(n));let r=T.path.split(`/`).pop()||T.path;X.success(S({id:`4xtLTl`,values:{basename:r}}),{description:S({id:`nWv1ja`}),duration:5e3})},children:[(0,Z.jsx)(_t,{"aria-hidden":`true`}),O]}),(0,Z.jsxs)(Da,{variant:`destructive`,disabled:a,onSelect:()=>{G(),g(L)},children:[(0,Z.jsx)(K,{"aria-hidden":`true`}),z]})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(kK,{item:n,workspace:o,onClose:G}),!b&&(0,Z.jsx)(UG,{input:V,installStates:c.installStates,isElectronHost:c.isElectronHost,dispatch:c.dispatch}),(0,Z.jsxs)(Aa,{children:[(0,Z.jsxs)(co,{children:[(0,Z.jsx)(nt,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`oCZkaG`})]}),(0,Z.jsxs)(Ua,{children:[(0,Z.jsx)(Da,{disabled:!o,onSelect:()=>{o&&(G(),lK(Zg(o.contentDir,CM(n),o.pathSeparator),`full`))},children:(0,Z.jsx)(s,{id:`oQA-cA`})}),(0,Z.jsx)(Da,{onSelect:()=>{G(),lK(CM(n),`relative`)},children:(0,Z.jsx)(s,{id:`s061i4`})})]})]}),(0,Z.jsx)(ro,{}),b?null:(0,Z.jsxs)(Da,{disabled:a,onSelect:()=>{G(),h(C)},children:[(0,Z.jsx)(Fe,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`euc6Ns`})]}),(0,Z.jsxs)(Da,{disabled:a,onSelect:()=>{U(),l.startRenaming(n.path)},children:[(0,Z.jsx)(se,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`2wxgft`})]}),T?(0,Z.jsxs)(Da,{"data-testid":`file-tree-menu-hide`,disabled:!E,onSelect:()=>{if(!u)return;G();let e=KW(T),t=so(u.current()),n=Ja(t,e);if(n===t)return;u.patch(Za(n));let r=T.path.split(`/`).pop()||T.path;X.success(S({id:`OD0FCX`,values:{basename:r}}),{description:S({id:`nWv1ja`}),duration:5e3})},children:[(0,Z.jsx)(_t,{"aria-hidden":`true`}),O]}):null,(0,Z.jsxs)(Da,{variant:`destructive`,disabled:a,onSelect:()=>{G(),g(L)},children:[(0,Z.jsx)(K,{"aria-hidden":`true`}),z]})]})}),t[24]=S,t[25]=a,t[26]=E,t[27]=j,t[28]=G,t[29]=U,t[30]=z,t[31]=L,t[32]=P,t[33]=te,t[34]=J,t[35]=c,t[36]=V,t[37]=O,t[38]=b,t[39]=w,t[40]=n,t[41]=l,t[42]=u,t[43]=T,t[44]=v,t[45]=m,t[46]=g,t[47]=h,t[48]=_,t[49]=p,t[50]=A,t[51]=k,t[52]=ie,t[53]=Y,t[54]=C,t[55]=o,t[56]=ce):ce=t[56];let le;return t[57]!==ce||t[58]!==ae?(le=(0,Z.jsxs)(oo,{open:!0,modal:!1,onOpenChange:ae,children:[oe,ce]}),t[57]=ce,t[58]=ae,t[59]=le):le=t[59],le}async function RK(e,t,n,r){try{let i=await fetch(`/api/documents?showAll=true&dir=${encodeURIComponent(e)}&depth=1`,{signal:t,headers:PG});if(FG(i)){let e=await RG(i);return{kind:`entries`,entries:Bo(e.entries),truncated:e.truncated}}let a=await ve(i,n);if(!a.ok)return{kind:`http-error`,title:a.title};let o=jr.safeParse(a.body);return o.success?{kind:`entries`,entries:Bo(o.data.documents),truncated:o.data.truncated===!0}:{kind:`http-error`,title:r}}catch(e){return e instanceof IG?{kind:`http-error`,title:e.message}:{kind:`network-error`,cause:e}}}function zK(e){let t=(0,$.c)(356),{ref:n}=e,{_:r,i18n:a}=i(),{activeDocName:o,activeTarget:c,closeTabs:l,closeDocument:u,closeAndClearForRename:d,getPoolActiveDocName:f,poolHas:p,isNewTabActive:m,openTarget:h,prewarm:g,remapTabsForRename:_}=ht(),{notifySidebarFileSelected:v}=fA(),{resolvedTheme:y}=Pr(),{addPage:b,pageMeta:x}=is(),S;t[0]===x?S=t[1]:(S=function(e,t){return ds(e,t??x.get(e)?.size)??{kind:`doc`,target:e,docName:e}},t[0]=x,t[1]=S);let C=S,w;t[2]!==C||t[3]!==v||t[4]!==h?(w=function(e,t){h(C(e,t),{tabBehavior:`replace-active`}),Xo(Ho(e)),v()},t[2]=C,t[3]=v,t[4]=h,t[5]=w):w=t[5];let T=w,E;t[6]!==v||t[7]!==h?(E=function(e){let t=Wo(e);h({kind:`folder`,target:e,folderPath:e},{tabBehavior:`replace-active`}),Xo(t),v()},t[6]=v,t[7]=h,t[8]=E):E=t[8];let D=E,O;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(O=[],t[9]=O):O=t[9];let[k,j]=(0,Q.useState)(O),[M,N]=(0,Q.useState)(!0),[P,F]=(0,Q.useState)(null),[I,L]=(0,Q.useState)(!1),R=cm(),z=(0,Q.useRef)(null),[B,V]=(0,Q.useState)(null),[H,U]=(0,Q.useState)(null),[W,G]=(0,Q.useState)(null),[K,q]=(0,Q.useState)(null),{conflicts:J}=Fi(),[ee,te]=(0,Q.useState)(null),[ne,re]=(0,Q.useState)(null),[Y,ie]=(0,Q.useState)(!1),ae=(0,Q.useRef)(Y),se;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(se=new Set,t[10]=se):se=t[10];let ce=(0,Q.useRef)(se),le=(0,Q.useRef)(k),ue=(0,Q.useRef)(x),de;t[11]!==k||t[12]!==D||t[13]!==T||t[14]!==v||t[15]!==h?(de=function(e,t){let n=t===void 0?k:t,r=sG(e,n);if(r.kind===`none`){console.debug(`[FileTree] Dropped selection for unknown docName:`,pM(e));return}if(r.kind===`asset`){h({kind:`asset`,target:r.path,assetPath:r.path,mediaKind:r.mediaKind},{tabBehavior:`replace-active`}),Xo(r.hash),v();return}if(r.kind===`folder`){D(r.path);return}let i=n.find(e=>ps(e)&&e.docName===r.path);T(r.path,i?.size)},t[11]=k,t[12]=D,t[13]=T,t[14]=v,t[15]=h,t[16]=de):de=t[16];let fe=de,pe;t[17]!==v||t[18]!==h?(pe=function(e,t){h({kind:`asset`,target:e,assetPath:e,mediaKind:(t??le.current).find(t=>zo(t)&&t.path===e)?.mediaKind??null},{tabBehavior:`replace-active`}),Xo(Yo(e)),v()},t[17]=v,t[18]=h,t[19]=pe):pe=t[19];let me=pe,he=(0,Q.useRef)(o),ge;t[20]===k?ge=t[21]:(ge=new Set(k.filter(zo).map(fq)),t[20]=k,t[21]=ge);let _e=ge,ye=(0,Q.useRef)(_e),be;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(be=[],t[22]=be):be=t[22];let xe=(0,Q.useRef)(be),Se=(0,Q.useRef)(null),Ce=(0,Q.useRef)(dq),we=(0,Q.useRef)(null),Te=(0,Q.useRef)(null),Ee=(0,Q.useRef)(!1),De=(0,Q.useRef)(!1),Oe=(0,Q.useRef)(null),ke;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(ke={row:null,root:null},t[23]=ke):ke=t[23];let Ae=(0,Q.useRef)(ke),je=(0,Q.useRef)(uq),Me=(0,Q.useRef)(null),Ne;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=new Map,t[24]=Ne):Ne=t[24];let Pe=(0,Q.useRef)(Ne),Fe;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(Fe=new Set,t[25]=Fe):Fe=t[25];let Ie=(0,Q.useRef)(Fe),Le;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(Le=new Map,t[26]=Le):Le=t[26];let Re=(0,Q.useRef)(Le),ze=(0,Q.useRef)(0),Be;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(Be=new Set,t[27]=Be):Be=t[27];let Ve=(0,Q.useRef)(Be),He=(0,Q.useRef)(lq),Ue=(0,Q.useRef)(cq),We=(0,Q.useRef)(!1),Ge=(0,Q.useRef)(!0),Ke=(0,Q.useRef)(null),qe=(0,Q.useRef)(null),Je=(0,Q.useRef)(sq),Ye=(0,Q.useRef)(oq),Xe=(0,Q.useRef)(aq),Ze=(0,Q.useRef)(iq),Qe=(0,Q.useRef)(c),[$e,tt]=(0,Q.useState)(!1),nt;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(nt=function(){z.current!==null&&(clearTimeout(z.current),z.current=null)},t[28]=nt):nt=t[28];let rt=nt,it;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(it=function(){rt(),L(!1)},t[29]=it):it=t[29];let at=it,ot;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(ot=function(e){at(),F(e)},t[30]=ot):ot=t[30];let st=ot,ct;t[31]===r?ct=t[32]:(ct=function(){if(rt(),im()){F(null),L(!0),z.current=setTimeout(()=>{z.current=null,Ke.current?.()},CK);return}L(!1),F(r({id:`34qyH5`}))},t[31]=r,t[32]=ct);let lt=ct,ut=(0,Q.useRef)(!0),dt;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(dt=()=>{if(ut.current){ut.current=!1;return}Ke.current?.()},t[33]=dt):dt=t[33];let ft;t[34]===R?ft=t[35]:(ft=[R],t[34]=R,t[35]=ft),(0,Q.useEffect)(dt,ft);let pt,mt;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(pt=()=>rt,mt=[],t[36]=pt,t[37]=mt):(pt=t[36],mt=t[37]),(0,Q.useEffect)(pt,mt);let gt,_t;t[38]!==k.length||t[39]!==M?(gt=()=>{if(M||k.length===0)return;let e=qe.current?.querySelector(vF)?.shadowRoot;if(!e)return;let t=e,n=function(){Oe.current!==null&&clearTimeout(Oe.current),Oe.current=setTimeout(()=>{De.current=!1,Oe.current=null},0)},r=function(e){if(!(e instanceof DragEvent))return;let t=mq(e),n=t?.dataset.itemPath;if(!n)return;let r=fG(t.dataset.itemType===`folder`?fM(n):n,le.current,ue.current);r&&(Oe.current!==null&&(clearTimeout(Oe.current),Oe.current=null),De.current=!0,e.dataTransfer?.setData(VE,UE(r)))},i=function(e){if(!(e instanceof DragEvent)||!jM(e))return;let t=gq(e);if(!t){sK(Ae);return}e.preventDefault(),e.stopPropagation(),e.dataTransfer&&(e.dataTransfer.dropEffect=`copy`),cK(Ae,t)},a=function(e){if(!(e instanceof DragEvent)||!jM(e))return;let n=e.relatedTarget;n instanceof Node&&t.contains(n)||sK(Ae)},o=function(e){if(!(e instanceof DragEvent)||!jM(e))return;let t=gq(e),n=MM(e);if(!t||n.length===0){sK(Ae);return}e.preventDefault(),e.stopPropagation(),sK(Ae),je.current(n,t.parentDir,t.busyPath)};return e.addEventListener(`dragstart`,r,{capture:!0}),e.addEventListener(`dragover`,i,{capture:!0}),e.addEventListener(`dragleave`,a,{capture:!0}),e.addEventListener(`drop`,o,{capture:!0}),e.addEventListener(`dragend`,n,{capture:!0}),window.addEventListener(`drop`,n,!0),window.addEventListener(`dragend`,n,!0),()=>{e.removeEventListener(`dragstart`,r,{capture:!0}),e.removeEventListener(`dragover`,i,{capture:!0}),e.removeEventListener(`dragleave`,a,{capture:!0}),e.removeEventListener(`drop`,o,{capture:!0}),e.removeEventListener(`dragend`,n,{capture:!0}),window.removeEventListener(`drop`,n,!0),window.removeEventListener(`dragend`,n,!0),sK(Ae),Oe.current!==null&&(clearTimeout(Oe.current),Oe.current=null),De.current=!1}},_t=[k.length,M],t[38]=k.length,t[39]=M,t[40]=gt,t[41]=_t):(gt=t[40],_t=t[41]),(0,Q.useEffect)(gt,_t);let{selectedFilePath:vt,selectedFolderPath:yt,navigationPath:bt}=oG(c,m?null:o),xt=vt?sM(vt,k.find(e=>ps(e)&&e.docName===vt)?.docExt):yt?fM(yt):c?.kind===`asset`?c.assetPath:null,St=Y?null:xt,Ct=D_().states,{dispatch:Tt}=g_(),Et;t[42]!==Tt||t[43]!==Ct?(Et={installStates:Ct,isElectronHost:typeof window<`u`&&window.okDesktop!=null,dispatch:Tt},t[42]=Tt,t[43]=Ct,t[44]=Et):Et=t[44];let Dt=Et,{okignoreBinding:Ot,projectLocalBinding:kt,merged:At}=oe(),jt=At?.appearance?.sidebar?.showHiddenFiles??!1,Mt=At?.appearance?.sidebar?.showAllFiles??!0,Nt;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(Nt=()=>Me.current===null,t[45]=Nt):Nt=t[45];let Pt=Nt,Ft;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(Ft=[],t[46]=Ft):Ft=t[46];let It;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(It={set:`complete`,spriteSheet:vK,byFileExtension:{md:{name:pK,viewBox:mK},mdx:{name:pK,viewBox:mK}}},t[47]=It):It=t[47];let Lt;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(Lt={contextMenu:{enabled:!0,triggerMode:`both`,buttonVisibility:`when-needed`}},t[48]=Lt):Lt=t[48];let Rt;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(Rt={canDrag:Pt,canDrop:Pt,onDropComplete:e=>Ze.current(e),onDropError:rq},t[49]=Rt):Rt=t[49];let zt,Bt;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(zt={canRename:Pt,onRename:e=>Ye.current(e),onError:e=>Xe.current(e)},Bt=e=>Je.current(e),t[50]=zt,t[51]=Bt):(zt=t[50],Bt=t[51]);let Ht;t[52]===r?Ht=t[53]:(Ht={paths:Ft,initialExpansion:`closed`,fileTreeSearchMode:`hide-non-matches`,initialVisibleRowCount:18,stickyFolders:!0,...EW,icons:It,unsafeCSS:EK,composition:Lt,dragAndDrop:Rt,renaming:zt,onSelectionChange:Bt,renderRowDecoration:e=>{let{item:t}=e;if(t.kind===`file`){let e=le.current.find(e=>ps(e)&&sM(e.docName,e.docExt)===t.path);if(e?.isSymlink){let t=e.targetPath;return{icon:dK,title:r(t?{id:`JE21eh`,values:{targetPath:t}}:{id:`BQu9Pg`})}}return DK(t.path)?{icon:fK,title:r({id:`i9toLO`})}:null}let n=le.current.find(e=>Qo(e)&&fM(e.path)===fM(t.path));if(n?.isSymlink){let e=n.targetPath;return{icon:dK,title:r(e?{id:`JE21eh`,values:{targetPath:e}}:{id:`BQu9Pg`})}}return null}},t[52]=r,t[53]=Ht);let{model:Ut}=TW(Ht),Wt;t[54]===Ut?Wt=t[55]:(Wt=function(e){let t=Ut.getItem(e)??Ut.getItem(fM(e));return t?.isDirectory()?fM(dM(t.getPath())):e},t[54]=Ut,t[55]=Wt);let Gt=Wt,Kt,qt;t[56]===k?(Kt=t[57],qt=t[58]):(qt=mM(k),Kt=hM(qt),t[56]=k,t[57]=Kt,t[58]=qt);let Jt=Kt,Yt=(0,Q.useRef)(qt),Xt;t[59]===k?Xt=t[60]:(Xt=_M(k),t[59]=k,t[60]=Xt);let Zt=Xt,Qt=(0,Q.useRef)(Zt),$t=yt?vM(fM(yt)).slice(0,-1):vM(St??bt),en=$t.join(`\0`),tn;t[61]===Ut?tn=t[62]:(tn=()=>{let e=new Set;for(let t of Qt.current)xG(Ut.getItem(t))?.isExpanded()&&e.add(t);return e},t[61]=Ut,t[62]=tn);let nn=tn,rn;t[63]===nn?rn=t[64]:(rn=e=>{let t=new Set(_M(e??le.current)),n=nn();for(let e of xe.current)n.add(e);return[...n].filter(e=>t.has(e))},t[63]=nn,t[64]=rn);let an=rn,on;t[65]!==an||t[66]!==Ut?(on=e=>{let t=mM(e??le.current);Ut.resetPaths(t,{initialExpandedPaths:an(e)})},t[65]=an,t[66]=Ut,t[67]=on):on=t[67];let sn=on,cn;t[68]!==r||t[69]!==lt?(cn=async function(e){let t=ze.current,n=new AbortController;Re.current.set(e,n);let i=await RK(dM(e),n.signal,r({id:`8RtNI0`}),r({id:`HlmZBk`}));if(Re.current.get(e)===n&&Re.current.delete(e),n.signal.aborted||t!==ze.current)return;if(i.kind===`network-error`){lt(),console.warn(`[FileTree] lazy folder children fetch failed:`,e,i.cause);return}if(i.kind===`http-error`){console.warn(`[FileTree] lazy folder children http error:`,e,i.title),st(i.title);return}let a=We.current||Ge.current,o=Zo(i.entries,a);Ie.current.add(e),j(t=>BG(t,e,o,Pe.current)),F(null),at(),i.truncated&&V(i.entries.length)},t[68]=r,t[69]=lt,t[70]=cn):cn=t[70];let ln=cn,un;t[71]!==nn||t[72]!==ln?(un=()=>{let e=nn(),t=Ve.current;if(Ve.current=e,Ge.current)for(let n of e){if(t.has(n)||Ie.current.has(n)||Re.current.has(n))continue;let e=dM(n);le.current.find(t=>Qo(t)&&t.path===e)?.hasChildren!==!1&&ln(n)}},t[71]=nn,t[72]=ln,t[73]=un):un=t[73];let dn=un,fn;t[74]!==nn||t[75]!==ln?(fn=()=>{for(let e of nn())Ie.current.has(e)||Re.current.has(e)||ln(e)},t[74]=nn,t[75]=ln,t[76]=fn):fn=t[76];let pn=fn,mn;t[77]!==Ut||t[78]!==sn?(mn=(e,t,n,r)=>{let i=r===void 0?[]:r,a=0,o=null;for(let{fromDocName:r,toDocName:i}of n){let n=e.find(e=>ps(e)&&e.docName===r);if(n==null||Ut.getItem(i)==null)continue;let s=sM(i,t.find(e=>ps(e)&&e.docName===i)?.docExt??n.docExt);Ut.move(i,s),o=s,a+=1}for(let{toPath:e}of i){let t=tM(e);if(t===``)continue;let n=e.slice(0,-t.length);Ut.getItem(n)!=null&&(Ut.getItem(e)??Ut.move(n,e),o=e,a+=1)}a!==0&&(sn(t),o!=null&&Ut.focusPath(o))},t[77]=Ut,t[78]=sn,t[79]=mn):mn=t[79];let hn=mn,gn;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(gn=e=>{we.current=gM(e)},t[80]=gn):gn=t[80];let _n=gn,vn;t[81]===Symbol.for(`react.memo_cache_sentinel`)?(vn=e=>ye.current.has(e),t[81]=vn):vn=t[81];let yn=vn,bn;t[82]!==r||t[83]!==b||t[84]!==D||t[85]!==T||t[86]!==sn?(bn=async function(e){if(e.kind===`asset`||Me.current!==null)return;let t=()=>{U(null),Me.current=null};Me.current=e.path,U(e.path),F(null);try{let n=await ve(await fetch(`/api/duplicate-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e.kind,path:e.path})}),r({id:`dw_dUJ`}));if(!n.ok){X.error(n.title),sn(),t();return}let i=A(qn,n.body,`duplicate-path`,null);if(i===null){let e=r({id:`67f-3g`});X.error(e),F(e),cs([`files`,`backlinks`,`graph`]),sn(),t();return}for(let e of i.duplicatedDocNames)b(e);j(t=>{let n=HM(t,e,i);return sn(n),_n(n),n}),cs([`files`,`backlinks`,`graph`]),i.path!==e.path&&(i.kind===`folder`?D(i.path):T(i.path)),X.success(i.kind===`folder`?r({id:`iilQXA`}):r({id:`A6h5b-`}),{description:i.path}),t()}catch(e){let n=e,i=n instanceof Error?n.message:String(n);console.warn(`[FileTree] duplicate failed:`,n),X.error(r({id:`EBVbtP`}),{description:i}),sn(),t()}},t[82]=r,t[83]=b,t[84]=D,t[85]=T,t[86]=sn,t[87]=bn):bn=t[87];let xn=bn,Sn=(0,Q.useRef)(xn),Cn;t[88]===xn?Cn=t[89]:(Cn=()=>{Sn.current=xn},t[88]=xn,t[89]=Cn),(0,Q.useEffect)(Cn);let wn=function(e){let t=iK(e);if(!t||aK(t))return!1;let n=Ut.getFocusedPath()??Ut.getSelectedPaths()[0]??null;if(!n||n.endsWith(`/`)||yn(n))return!1;let r=aK(n);if(!r)return!1;let i=fM(t);if(!Qt.current.includes(i))return!1;let a=`${t}${r}`;return Yt.current.includes(a)?!1:(cr({sourcePath:n,destinationPath:a,isFolder:!1}),Ut.move(n,a),!0)},Tn;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(Tn=e=>{let t=e??Se.current;!t||Se.current!==t||(t.disposeCommitListener(),Se.current=null)},t[90]=Tn):Tn=t[90];let En=Tn,Dn;t[91]!==r||t[92]!==En||t[93]!==u||t[94]!==l||t[95]!==sn?(Dn=async function(e,t){let n=t===void 0?{}:t,i=n.updateUi??!0,a=n.restoreLocation??i;En(e),i&&U(e.renamePath);try{let t=await fetch(`/api/delete-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e.kind,path:e.createdPath})});if(!t.ok&&t.status!==404){let n=e.kind,a=e.createdPath,o=await ve(t,r({id:`EcM3k7`,values:{kind:n}}));if(o.ok)return;let s=o.title,c=r({id:`YPFBfr`,values:{detail:s,kind:n,createdPath:a}});i?X.error(c):console.warn(`[FileTree] cleanup pending create failed: ${c}`),i&&(U(null),sn());return}}catch(t){if(console.warn(`[FileTree] cleanup pending create failed:`,t),i){let t=e.kind,n=e.createdPath;X.error(r({id:`_TDESN`,values:{kind:t,createdPath:n}}))}i&&(U(null),sn());return}i&&(e.kind===`file`?u(e.createdPath):l([wt(e.createdPath)],{force:!0})),i&&j(t=>{let n=BM(t,e.kind===`file`?[e.createdPath]:[],e.kind===`folder`?e.createdPath:void 0);return _n(n),n}),cs([`files`,`backlinks`,`graph`]),a&&(window.location.hash=e.previousHash),i&&U(null)},t[91]=r,t[92]=En,t[93]=u,t[94]=l,t[95]=sn,t[96]=Dn):Dn=t[96];let On=Dn,kn,An;t[97]===Symbol.for(`react.memo_cache_sentinel`)?(kn=()=>()=>{let e=Se.current;e&&Ce.current(e,{restoreLocation:!1,updateUi:!1}).catch(nq)},An=[],t[97]=kn,t[98]=An):(kn=t[97],An=t[98]),(0,Q.useEffect)(kn,An);let jn;t[99]!==r||t[100]!==lt?(jn=()=>{let e=!0,t=null,n=NG(async function(){t?.abort();let n=new AbortController;t=n,ze.current+=1;for(let e of Re.current.values())e.abort();Re.current.clear(),Ie.current.clear();try{let t=Ge.current,i=await fetch(t?`/api/documents?showAll=true&dir=&depth=1`:`/api/documents`,{signal:n.signal,headers:t?PG:void 0});if(t&&FG(i)){let{entries:n,truncated:r}=await RG(i);if(!e)return;let a=We.current||t,o=Zo(Bo(n),a);j(e=>BG(e,``,o,Pe.current)),F(null),at(),V(r?n.length:null),Ue.current()}else{let n=await ve(i,r({id:`8RtNI0`}));if(!e)return;if(!n.ok)st(n.title),V(null);else{let e=jr.safeParse(n.body);if(!e.success)st(r({id:`HlmZBk`})),V(null);else{let n=We.current||t,r=Zo(Bo(e.data.documents),n);j(t?e=>BG(e,``,r,Pe.current):zG(r,le.current,Pe.current)),F(null),at(),V(t&&e.data.truncated===!0?e.data.documents.length:null),t&&Ue.current()}}}}catch(t){let r=t;if(n.signal.aborted)return;e&&(r instanceof IG?st(r.message):lt()),console.warn(`[FileTree] fetch failed:`,r)}e&&N(!1)},()=>t?.abort());Ke.current=()=>n.request(),n.request();let i=()=>{document.visibilityState===`visible`&&n.request()};window.addEventListener(`focus`,i),window.addEventListener(`visibilitychange`,i);let a=es(e=>{e.includes(`files`)&&n.request()});return()=>{e=!1,Ke.current=null,n.dispose();for(let e of Re.current.values())e.abort();Re.current.clear(),window.removeEventListener(`focus`,i),window.removeEventListener(`visibilitychange`,i),a()}},t[99]=r,t[100]=lt,t[101]=jn):jn=t[101];let Mn;t[102]===r?Mn=t[103]:(Mn=[r],t[102]=r,t[103]=Mn),(0,Q.useEffect)(jn,Mn);let Nn=(0,Q.useRef)(!0),Pn;t[104]===Symbol.for(`react.memo_cache_sentinel`)?(Pn=()=>{if(Nn.current){Nn.current=!1;return}Ke.current?.()},t[104]=Pn):Pn=t[104];let In;t[105]===jt?In=t[106]:(In=[jt],t[105]=jt,t[106]=In),(0,Q.useEffect)(Pn,In);let Rn=(0,Q.useRef)(!0),zn;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(zn=()=>{if(Rn.current){Rn.current=!1;return}Ke.current?.()},t[107]=zn):zn=t[107];let Bn;t[108]===Mt?Bn=t[109]:(Bn=[Mt],t[108]=Mt,t[109]=Bn),(0,Q.useEffect)(zn,Bn);let Vn,Hn;t[110]===Symbol.for(`react.memo_cache_sentinel`)?(Vn=()=>{let e=!0;return fetch(`/api/workspace`).then(async t=>{let n=await t.json();if(!e||!t.ok)return;let r=A(Ln,n,`workspace`,null);r&&re({contentDir:r.contentDir,pathSeparator:r.pathSeparator})}).catch(tq),()=>{e=!1}},Hn=[],t[110]=Vn,t[111]=Hn):(Vn=t[110],Hn=t[111]),(0,Q.useEffect)(Vn,Hn);let Un;t[112]!==an||t[113]!==Ut||t[114]!==Jt?(Un=()=>{if(we.current===Jt){we.current=null;return}Ut.resetPaths(Yt.current,{initialExpandedPaths:an()})},t[112]=an,t[113]=Ut,t[114]=Jt,t[115]=Un):Un=t[115];let Wn;t[116]!==Ut||t[117]!==Jt?(Wn=[Ut,Jt],t[116]=Ut,t[117]=Jt,t[118]=Wn):Wn=t[118],(0,Q.useEffect)(Un,Wn),CG(Ut,St,en,Ee,Jt);let Gn;t[119]===Symbol.for(`react.memo_cache_sentinel`)?(Gn=()=>{ie(!1)},t[119]=Gn):Gn=t[119];let Kn;t[120]===xt?Kn=t[121]:(Kn=[xt],t[120]=xt,t[121]=Kn),(0,Q.useEffect)(Gn,Kn);let Jn,Yn;t[122]===Y?(Jn=t[123],Yn=t[124]):(Jn=()=>{ae.current=Y;for(let e of ce.current)e()},Yn=[Y],t[122]=Y,t[123]=Jn,t[124]=Yn),(0,Q.useEffect)(Jn,Yn);let Xn;t[125]!==St||t[126]!==M||t[127]!==Ut?(Xn=()=>{M||!St||iG(Ut)},t[125]=St,t[126]=M,t[127]=Ut,t[128]=Xn):Xn=t[128];let Zn;t[129]!==en||t[130]!==St||t[131]!==M||t[132]!==Ut||t[133]!==Jt?(Zn=[St,en,Jt,M,Ut],t[129]=en,t[130]=St,t[131]=M,t[132]=Ut,t[133]=Jt,t[134]=Zn):Zn=t[134],(0,Q.useEffect)(Xn,Zn);let $n,er;t[135]===Ut?($n=t[136],er=t[137]):($n=()=>Ut.subscribe(()=>{if(!Ut.isSearchOpen())for(let e of xe.current){let t=xG(Ut.getItem(e));t&&!t.isExpanded()&&t.expand()}}),er=[Ut],t[135]=Ut,t[136]=$n,t[137]=er),(0,Q.useEffect)($n,er);let tr,rr;t[138]===Ut?(tr=t[139],rr=t[140]):(tr=()=>Ut.subscribe(()=>He.current()),rr=[Ut],t[138]=Ut,t[139]=tr,t[140]=rr),(0,Q.useEffect)(tr,rr);let ir,ar;t[141]===Ut?(ir=t[142],ar=t[143]):(ir=()=>Ut.onMutation(`remove`,e=>{let t=Se.current;!t||e.path!==t.renamePath||Ce.current(t)}),ar=[Ut],t[141]=Ut,t[142]=ir,t[143]=ar),(0,Q.useEffect)(ir,ar);let or;t[144]!==b||t[145]!==d||t[146]!==f||t[147]!==me||t[148]!==D||t[149]!==T||t[150]!==p||t[151]!==hn||t[152]!==_?(or=async(e,t,n,r,i)=>{let a=t===void 0?[]:t,o=n===void 0?[]:n,s=i===void 0?[]:i,c=r?.docName??he.current,l=new Map,u=new Map;for(let e of le.current){if(ps(e)){let t=o.find(t=>t.fromPath===sM(e.docName,e.docExt))?.toPath;t&&l.set(e.docName,t);continue}if(zo(e)){let t=o.find(t=>t.fromPath===e.path)?.toPath;t&&rM(t)&&u.set(e.path,cM(t))}}let m=c?l.get(c)??null:null,h=r?.folderPath??(Qe.current?.kind===`folder`?Qe.current.folderPath:null),g=h?et(h,a):null,v=r?.assetPath??(Qe.current?.kind===`asset`?Qe.current.assetPath:null),y=v?u.get(v)??null:null,x=m?null:y??UM(c,e),S=m??(v?y?null:o.find(e=>e.fromPath===v)?.toPath??et(v,a):null);Vt(e);let C=[...WM(e,f(),p),...l.keys()];await Promise.all(C.map(e=>d(e)));for(let t of e)b(t.toDocName);for(let e of u.values())b(e);_(e,a,o);let w=null;j(t=>{let n=zM(t,e,a,o,s);return w=n,hn(t,n,e,o),_n(n),n}),h&&g&&g!==h?D(g):x&&x!==c?(T(x),oK(x)):S&&(m||S!==v)&&me(S,w??le.current),cs([`files`,`backlinks`,`graph`])},t[144]=b,t[145]=d,t[146]=f,t[147]=me,t[148]=D,t[149]=T,t[150]=p,t[151]=hn,t[152]=_,t[153]=or):or=t[153];let sr=or;async function cr(e){let t=!e.isFolder&&yn(e.sourcePath),n=t?e.sourcePath:wM(e.sourcePath,e.isFolder);U(n),F(null);try{let i=iM(e.sourcePath,e.destinationPath,e.isFolder),a=!e.isFolder&&!t&&!rM(i.destinationPath),o=t||a?i.destinationPath:wM(i.destinationPath,e.isFolder),s=e.isFolder?{kind:`folder`,fromPath:dM(n),toPath:dM(o)}:t||a?{kind:`asset`,fromPath:n,toPath:o}:{kind:`file`,fromPath:cM(n),toPath:o},c={docName:he.current,folderPath:Qe.current?.kind===`folder`?Qe.current.folderPath:null,assetPath:Qe.current?.kind===`asset`?Qe.current.assetPath:null},l=await ve(await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(s)}),r({id:`gijbne`}));if(!l.ok){X.error(l.title),sn();let e=Se.current;e&&e.renamePath===n?await On(e):En(),U(null);return}let u=A(Qr,l.body,`rename-path`,{renamed:[],renamedAssets:[]});try{await sr(u.renamed,e.isFolder?[{fromPath:dM(n),toPath:dM(o)}]:[],u.renamedAssets,c,!e.isFolder&&!t&&!a?u.renamed.flatMap(e=>{let t=tM(o);return t?[{toDocName:e.toDocName,docExt:t}]:[]}):[])}catch(e){console.warn(`[FileTree] post-rename reconciliation failed`,{err:e,sourceTreePath:n,destinationTreePath:o,renamedCount:u.renamed.length,renamedAssetCount:u.renamedAssets.length}),X.error(r({id:`dDpCOp`}))}En(),U(null)}catch(e){console.warn(`[FileTree] rename failed:`,e);let t=r({id:`HIb0vl`});X.error(t),F(t),sn();let i=Se.current;i&&i.renamePath===n?await On(i):En(),U(null)}}let lr;t[154]!==r||t[155]!==sr||t[156]!==sn?(lr=async function(e){let t=e.draggedPaths.map(t=>{let n=DM(t,e.target);return t===n?null:{sourcePath:t,destinationTreePath:n}}).filter(eq);if(t.length!==0){U(t[0]?.sourcePath??null),F(null);try{let e=[],n=[],i=[],a={docName:he.current,folderPath:Qe.current?.kind===`folder`?Qe.current.folderPath:null,assetPath:Qe.current?.kind===`asset`?Qe.current.assetPath:null};for(let a of t){let t=a.sourcePath.endsWith(`/`),o=!t&&yn(a.sourcePath),s=t?{kind:`folder`,fromPath:dM(a.sourcePath),toPath:dM(a.destinationTreePath)}:o?{kind:`asset`,fromPath:a.sourcePath,toPath:a.destinationTreePath}:{kind:`file`,fromPath:cM(a.sourcePath),toPath:cM(a.destinationTreePath)},c=await ve(await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(s)}),r({id:`dOHMA0`}));if(!c.ok){X.error(c.title),sn(),U(null);return}let l=A(Qr,c.body,`rename-path:drop`,{renamed:[],renamedAssets:[]});e=e.concat(l.renamed),n=n.concat(l.renamedAssets),t&&i.push({fromPath:dM(a.sourcePath),toPath:dM(a.destinationTreePath)})}try{await sr(e,i,n,a)}catch(i){console.warn(`[FileTree] post-move reconciliation failed`,{err:i,operationCount:t.length,renamedCount:e.length,renamedAssetCount:n.length}),X.error(r({id:`8OxKZy`}))}U(null)}catch(e){console.warn(`[FileTree] move failed:`,e),X.error(r({id:`HIb0vl`})),sn(),U(null)}}},t[154]=r,t[155]=sr,t[156]=sn,t[157]=lr):lr=t[157];let ur=lr,dr;t[158]!==r||t[159]!==b||t[160]!==sn?(dr=async function(e,t,n){if(e.length===0||Me.current!==null)return;let i=()=>{Me.current=null,U(null)};Me.current=n,U(n),F(null);let a=[],o=0,s=0;for(let n of e){let e=new FormData;e.append(`file`,n),e.append(`parentDocName`,kM(t,n.name||`upload`));try{let i=await ve(await fetch(`/api/upload`,{method:`POST`,body:e}),r({id:`4Gz2wC`}));if(!i.ok){s+=1,X.error(i.title,{description:n.name});continue}let c=A(nr,i.body,`upload:drop`,null);if(c===null){s+=1,X.error(r({id:`4Gz2wC`}),{description:n.name});continue}let l=AM(t,c);if(c.deduped===!0){s+=1,X.error(r({id:`4sKwf6`}),{description:l});continue}o+=1;let u=NM(l,n);u&&a.push(u)}catch(e){let t=e;s+=1,console.warn(`[FileTree] external file upload failed:`,t),X.error(t instanceof TypeError?r({id:`HIb0vl`}):r({id:`4Gz2wC`}),{description:n.name})}}try{if(a.length>0){for(let e of a)ps(e)&&b(e.docName);j(e=>{let t=new Set(e.map(lM)),n=!1,r=[...e];for(let e of a){let i=lM(e);Pe.current.set(i,Date.now()),!t.has(i)&&(t.add(i),r.push(e),n=!0)}return n?(sn(r),_n(r),r):e})}o>0&&(cs([`files`,`backlinks`,`graph`]),Ke.current?.(),X.success(hs._({id:`v75Em9`,values:{uploadedCount:o}}),{description:t||r({id:`RSqaSd`})})),s>0&&F(o>0?hs._({id:`yH7T4q`,values:{failedCount:s}}):r({id:`4Gz2wC`})),i()}catch(e){let t=e,n=r({id:`VcqWBy`});console.warn(`[FileTree] upload post-upload reconciliation failed:`,t),X.error(n),F(n),i()}},t[158]=r,t[159]=b,t[160]=sn,t[161]=dr):dr=t[161];let fr=dr,pr;t[162]===Symbol.for(`react.memo_cache_sentinel`)?(pr=function(e){te({parentDir:e})},t[162]=pr):pr=t[162];let mr=pr,hr;t[163]!==r||t[164]!==b||t[165]!==On||t[166]!==En||t[167]!==Ut||t[168]!==D||t[169]!==T||t[170]!==sn||t[171]!==qt?(hr=async function(e,t,n){if(Me.current)return;let i=Se.current;i&&En(i);try{let i=TM(e,t,[...qt,...Qt.current]);U(i.renamePath),Me.current=i.renamePath;let a=window.location.hash,o;if(e===`file`){let e=EM(`file`,i.addPath),t={path:e};n?.template&&(t.template=n.template);let a=await ve(await fetch(`/api/create-page`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)}),r({id:`fJgQHX`}));if(!a.ok){X.error(a.title),U(null),Me.current=null;return}let s=cM(e),c=A(ei,a.body,`create-page`,{docName:s}).docName;o=c;let l={kind:`document`,docName:c,docExt:e.toLowerCase().endsWith(`.mdx`)?`.mdx`:`.md`,modified:new Date().toISOString(),size:0};b(c),j(e=>{if(e.some(e=>ps(e)&&e.docName===c))return e;let t=[...e,l];return _n(t),Pe.current.set(lM(l),Date.now()),t}),cs([`files`,`backlinks`,`graph`]),T(c)}else{let e=dM(i.addPath),t=await ve(await fetch(`/api/create-folder`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e})}),r({id:`K1ckLX`}));if(!t.ok){X.error(t.title),U(null),Me.current=null;return}o=A(Fn,t.body,`create-folder`,{path:e}).path;let n={kind:`folder`,path:o,modified:new Date().toISOString(),size:0};j(e=>{if(e.some(e=>Qo(e)&&e.path===o))return e;let t=[...e,n];return _n(t),Pe.current.set(lM(n),Date.now()),t}),cs([`files`]),D(o)}let s=!1,c=e=>{if(e.key!==`Enter`)return;let t=Se.current;!t||t.renamePath!==i.renamePath||queueMicrotask(()=>En(t))};document.addEventListener(`keydown`,c,!0),Se.current={kind:e,renamePath:i.renamePath,createdPath:o,previousHash:a,disposeCommitListener:()=>{s||(s=!0,document.removeEventListener(`keydown`,c,!0))}},U(null),Me.current=null,Ut.add(i.addPath),Ut.startRenaming(i.renamePath,{removeIfCanceled:!0})}catch(e){console.warn(`[FileTree] create placeholder failed:`,e),X.error(r({id:`S6l5dv`}));let t=Se.current;t?await On(t):En(),U(null),Me.current=null,sn()}},t[163]=r,t[164]=b,t[165]=On,t[166]=En,t[167]=Ut,t[168]=D,t[169]=T,t[170]=sn,t[171]=qt,t[172]=hr):hr=t[172];let gr=hr,_r;t[173]===Ut?_r=t[174]:(_r=function(e){let t=fM(e);(0,Q.startTransition)(()=>{for(let e of Qt.current)if(e===t||e.startsWith(t)){let t=xG(Ut.getItem(e));t&&t.expand()}})},t[173]=Ut,t[174]=_r);let vr=_r,yr;t[175]===Ut?yr=t[176]:(yr=function(e){let t=fM(e),n=new Set(xe.current);(0,Q.startTransition)(()=>{for(let e of[...Qt.current].reverse())if((e===t||e.startsWith(t))&&!n.has(e)){let t=xG(Ut.getItem(e));t&&t.collapse()}})},t[175]=Ut,t[176]=yr);let br=yr,xr;t[177]!==fe||t[178]!==$t||t[179]!==o||t[180]!==c||t[181]!==_e||t[182]!==H||t[183]!==On||t[184]!==dn||t[185]!==k||t[186]!==Zt||t[187]!==ur||t[188]!==cr||t[189]!==Gt||t[190]!==x||t[191]!==wn||t[192]!==pn||t[193]!==Mt||t[194]!==jt||t[195]!==qt||t[196]!==fr?(xr=()=>{le.current=k,ue.current=x,he.current=o,Qe.current=c,ye.current=_e,Me.current=H,We.current=jt,Ge.current=Mt,Yt.current=qt,Qt.current=Zt,xe.current=$t,He.current=dn,Ue.current=pn,Ce.current=On,je.current=(e,t,n)=>{fr(e,t,n)},Je.current=e=>{if(Ee.current||De.current||e.length!==1)return;let t=e[0];t&&(ie(!1),fe(Gt(t),k))},Xe.current=e=>{wn(e)||X.error(e)},Ye.current=cr,Ze.current=ur},t[177]=fe,t[178]=$t,t[179]=o,t[180]=c,t[181]=_e,t[182]=H,t[183]=On,t[184]=dn,t[185]=k,t[186]=Zt,t[187]=ur,t[188]=cr,t[189]=Gt,t[190]=x,t[191]=wn,t[192]=pn,t[193]=Mt,t[194]=jt,t[195]=qt,t[196]=fr,t[197]=xr):xr=t[197],(0,Q.useLayoutEffect)(xr);let Sr,Cr;t[198]===Ut?(Sr=t[199],Cr=t[200]):(Sr=()=>{let e=e=>{let t=(e.metaKey||e.ctrlKey)&&!e.altKey,n=e.key.toLowerCase(),r=t&&n===`a`,i=t&&!e.shiftKey&&n===`d`;if(!r&&!i||PK(e.target))return;let a=qe.current,o=e.target,s=document.activeElement,c=o instanceof Node&&a?.contains(o),l=s instanceof Node&&a?.contains(s);if(!c&&!l)return;if(i){let t=Ut.getFocusedPath()??Ut.getSelectedPaths()[0]??null;if(!t)return;let n=Ut.getItem(t)??Ut.getItem(fM(t)),r=n?.isDirectory()?fM(dM(n.getPath())):t;if(ye.current.has(r))return;Sn.current(AK(r,le.current)),e.preventDefault(),e.stopPropagation();return}let u=new Set([...Qt.current,...Yt.current]);Ee.current=!0;for(let e of u)e&&Ut.getItem(e)?.select();queueMicrotask(()=>{Ee.current=!1}),e.preventDefault(),e.stopPropagation()};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},Cr=[Ut],t[198]=Ut,t[199]=Sr,t[200]=Cr),(0,Q.useEffect)(Sr,Cr);let wr,Tr;t[201]!==k.length||t[202]!==M?(wr=()=>{if(M||k.length===0)return;let e=qe.current?.querySelector(vF)?.shadowRoot;if(!e)return;let t=$K,n=()=>{for(let n of e.querySelectorAll(`[data-item-path]`)){let e=n.dataset.itemPath;if(!e)continue;let r=t(e);n.title!==r&&(n.title=r)}let n=e.querySelector(`[data-type="context-menu-anchor"]`);if(n){let r=e.querySelector(`[data-item-context-hover="true"][data-item-path]`)?.dataset.itemPath,i=r?t(r):``;n.title!==i&&(n.title=i)}};n();let r=new MutationObserver(n);return r.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`data-item-path`,`data-item-context-hover`]}),()=>r.disconnect()},Tr=[M,k.length],t[201]=k.length,t[202]=M,t[203]=wr,t[204]=Tr):(wr=t[203],Tr=t[204]),(0,Q.useEffect)(wr,Tr);let Er,Dr;t[205]!==k.length||t[206]!==M?(Er=()=>{if(M||k.length===0)return;let e=qe.current?.querySelector(vF)?.shadowRoot;if(!e)return;let t=()=>FW(e);t();let n=new MutationObserver(t);return n.observe(e,{subtree:!0,childList:!0,characterData:!0,attributes:!0,attributeFilter:[`data-item-path`]}),()=>n.disconnect()},Dr=[M,k.length],t[205]=k.length,t[206]=M,t[207]=Er,t[208]=Dr):(Er=t[207],Dr=t[208]),(0,Q.useEffect)(Er,Dr);let Or,kr;t[209]!==k.length||t[210]!==M?(Or=()=>{if(M||k.length===0)return;let e=qe.current?.querySelector(vF)?.shadowRoot;if(!e)return;let t=()=>$W(e);t();let n=new MutationObserver(t);return n.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`data-item-path`]}),()=>n.disconnect()},kr=[M,k.length],t[209]=k.length,t[210]=M,t[211]=Or,t[212]=kr):(Or=t[211],kr=t[212]),(0,Q.useEffect)(Or,kr);let Ar;t[213]===Symbol.for(`react.memo_cache_sentinel`)?(Ar={folderCount:0,expandedCount:0},t[213]=Ar):Ar=t[213];let Nr=(0,Q.useRef)(Ar),Fr=(0,Q.useRef)(gr),Ir=(0,Q.useRef)(mr),Lr;t[214]===gr?Lr=t[215]:(Lr=()=>{Fr.current=gr,Ir.current=mr},t[214]=gr,t[215]=Lr),(0,Q.useEffect)(Lr);let Rr,zr;t[216]===Ut?(Rr=t[217],zr=t[218]):(Rr=()=>({startCreating(e,t){Fr.current(e,t)},startCreatingFromTemplate(e){Ir.current(e)},createFromTemplate(e,t){Fr.current(`file`,e,{template:t})},expandAll(){(0,Q.startTransition)(()=>{for(let e of Qt.current){let t=xG(Ut.getItem(e));t&&t.expand()}})},collapseAll(){let e=new Set(xe.current);(0,Q.startTransition)(()=>{for(let t of[...Qt.current].reverse()){if(e.has(t))continue;let n=xG(Ut.getItem(t));n&&n.collapse()}})},getFolderState(){let e=Qt.current,t=0;for(let n of e)xG(Ut.getItem(n))?.isExpanded()&&t++;let n=e.length,r=Nr.current;if(r.folderCount===n&&r.expandedCount===t)return r;let i={folderCount:n,expandedCount:t};return Nr.current=i,i},isCreationTargetCleared(){return ae.current},subscribe(e){ce.current.add(e);let t=Ut.subscribe(e);return()=>{ce.current.delete(e),t()}}}),zr=[Ut],t[216]=Ut,t[217]=Rr,t[218]=zr),(0,Q.useImperativeHandle)(n,Rr,zr);let Br;t[219]!==En||t[220]!==d||t[221]!==l||t[222]!==Ut?(Br=async function(e,t,n){let r=FK(e,le.current,Qt.current),i=Se.current;i&&e.some(e=>IK(e,i))&&(i.kind===`file`?r.docNames.add(i.createdPath):r.folderPaths.add(i.createdPath),En(i));let a=new Set([...r.docNames,...t]),o=new Set([...r.folderPaths,...n]),s=new Set([...r.assetPaths,...e.filter(QK).map(ZK)]);l([...[...a].map(XK),...[...o].map(YK),...[...s].map(JK)],{force:!0}),await Promise.all([...a].map(e=>d(e)));for(let t of e){let e=t.kind===`folder`?fM(t.path):t.kind===`asset`?t.path:sM(t.path,t.docExt);Ut.getItem(e)&&Ut.remove(e,t.kind===`folder`?{recursive:!0}:void 0)}j(e=>{let t=BM(e,[...a],void 0,[...s]);for(let e of o)t=BM(t,[],e);return _n(t),t}),cs([`files`,`backlinks`,`graph`])},t[219]=En,t[220]=d,t[221]=l,t[222]=Ut,t[223]=Br):Br=t[223];let Vr=Br,Hr;t[224]!==r||t[225]!==Vr?(Hr=async function(e){let t=[],n=[],i=[];for(let a of e){let e=a.kind;U(a.path);let o=await ve(await fetch(`/api/delete-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e,path:a.path})}),r({id:`7JtSLi`}));if(!o.ok)return i.length>0&&await Vr(i,t,n),X.error(o.title),!1;let s=A(Qn,o.body,`delete-path`,{deletedDocNames:[]});t.push(...s.deletedDocNames),e===`folder`&&n.push(a.path),i.push(a)}return await Vr(i,t,n),!0},t[224]=r,t[225]=Vr,t[226]=Hr):Hr=t[226];let Ur=Hr,Wr;t[227]===Symbol.for(`react.memo_cache_sentinel`)?(Wr=async function(e,t,n){let r=[],i=[];for(let a of e){U(a.path);let e=GM(a,n),o=await t.shell.trashItem(e);o.ok?r.push(a):i.push({kind:a.kind,path:a.path,name:a.name,reason:mG(o.reason),detail:o.detail})}return{trashed:r,failed:i}},t[227]=Wr):Wr=t[227];let Gr=Wr,Kr;t[228]===r?Kr=t[229]:(Kr=async function(e){let t=[],n=[],i=[];for(let a of e){let e=a.kind;try{let o=await ve(await fetch(`/api/trash/cleanup`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e,path:a.path})}),r({id:`DVh_Tb`}));if(!o.ok){console.warn(`[FileTree] trash-cleanup failed`,{target:`${a.kind}:${a.path}`,reason:o.title}),i.push({target:a,reason:o.title});continue}let s=A(ni,o.body,`trash-cleanup`,{deletedDocNames:[]});t.push(...s.deletedDocNames),e===`folder`&&n.push(a.path)}catch(e){let t=e;console.warn(`[FileTree] trash-cleanup threw`,{target:`${a.kind}:${a.path}`,err:t}),i.push({target:a,reason:r({id:`r4R7AZ`})})}}if(i.length>0){let e=i.length;X.error(r({id:`IrB5AK`,values:{failedCount:e}}),{description:r({id:`vEJDlt`})})}return i.length===e.length&&e.length>0?null:{deletedDocNames:t,deletedFolderPaths:n}},t[228]=r,t[229]=Kr);let qr=Kr,Jr;t[230]!==r||t[231]!==J||t[232]!==Vr||t[233]!==Ur||t[234]!==qr||t[235]!==sn||t[236]!==ne?(Jr=async function(e){let t=e.map(e=>VM(e,le.current)),n=t[0];if(!n)return;let i=J.filter(e=>t.some(t=>{if(t.kind===`file`){let n=`${t.path}${t.docExt??`.md`}`;return e.file===n}return t.kind===`folder`?e.file.startsWith(`${t.path}/`):!1}));if(i.length>0){let e=i.slice(0,3).map(qK),t=i.length>e.length?`, +${i.length-e.length} more`:``;X.error(`Cannot delete files with unresolved conflicts`,{description:`Resolve the conflict on ${e.join(`, `)}${t} before deleting.`});return}U(n.path),G(null);let a=typeof window<`u`?window.okDesktop:void 0;try{if(a&&ne){let{trashed:e,failed:n}=await Gr(t,a,ne);if(e.length>0){let t=await qr(e);t?await Vr(e,t.deletedDocNames,t.deletedFolderPaths):await Vr(e,e.filter(KK).map(GK),e.filter(WK).map(UK))}n.length>0&&q({failed:n,originalTargets:[...t]}),U(null)}else{let e=await Ur(t);U(null),e||sn()}}catch(e){let t=e,n=t instanceof Error?t.message:String(t);console.warn(`[FileTree] delete failed:`,t),X.error(r({id:`0eHrMb`}),{description:n}),U(null),sn()}},t[230]=r,t[231]=J,t[232]=Vr,t[233]=Ur,t[234]=qr,t[235]=sn,t[236]=ne,t[237]=Jr):Jr=t[237];let Yr=Jr,Xr;t[238]!==r||t[239]!==Ur||t[240]!==sn||t[241]!==K?(Xr=async function(){if(!K)return;let e=new Set(K.failed.map(HK)),t=K.originalTargets.filter(t=>e.has(`${t.kind}:${t.path}`));if(q(null),t.length!==0){U(t[0]?.path??null);try{let e=await Ur(t);U(null),e||sn()}catch(e){let t=e,n=t instanceof Error?t.message:String(t);console.warn(`[FileTree] hard-delete fallback failed:`,t),X.error(r({id:`0eHrMb`}),{description:n}),U(null),sn()}}},t[238]=r,t[239]=Ur,t[240]=sn,t[241]=K,t[242]=Xr):Xr=t[242];let Zr=Xr,$r;t[243]!==Yr||t[244]!==K?($r=async function(){if(!K)return;let e=new Set(K.failed.map(VK)),t=K.originalTargets.filter(t=>e.has(`${t.kind}:${t.path}`));q(null),await Yr(t)},t[243]=Yr,t[244]=K,t[245]=$r):$r=t[245];let ti=$r,ri=(0,Q.useRef)(Yr),ii;t[246]===Yr?ii=t[247]:(ii=()=>{ri.current=Yr},t[246]=Yr,t[247]=ii),(0,Q.useEffect)(ii);let ai,oi;t[248]===Symbol.for(`react.memo_cache_sentinel`)?(ai=()=>OG(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=le.current.find(e=>ps(e)&&e.docName===t);ri.current([{kind:`file`,path:t,name:t.split(`/`).pop()??t,docExt:n?.docExt}]);return}if(e.kind===`folder`){ri.current([{kind:`folder`,path:e.folderPath,name:e.folderPath.split(`/`).pop()??e.folderPath}]);return}if(e.kind===`asset`){ri.current([{kind:`asset`,path:e.assetPath,name:e.assetPath.split(`/`).pop()??e.assetPath}]);return}console.warn(JSON.stringify({event:`file-tree-menu-action-delete-unsupported-kind`,kind:e.kind}))}),oi=[],t[248]=ai,t[249]=oi):(ai=t[248],oi=t[249]),(0,Q.useEffect)(ai,oi);let ci,ui;t[250]===Symbol.for(`react.memo_cache_sentinel`)?(ci=()=>MG(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=le.current.find(e=>ps(e)&&e.docName===t);Sn.current({kind:`file`,path:t,name:t.split(`/`).pop()??t,docExt:n?.docExt});return}if(e.kind===`folder`){Sn.current({kind:`folder`,path:e.folderPath,name:e.folderPath.split(`/`).pop()??e.folderPath});return}console.warn(JSON.stringify({event:`file-tree-menu-action-duplicate-unsupported-kind`,kind:e.kind}))}),ui=[],t[250]=ci,t[251]=ui):(ci=t[250],ui=t[251]),(0,Q.useEffect)(ci,ui);let di,fi;t[252]===Ut?(di=t[253],fi=t[254]):(di=()=>AG(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=sM(t,le.current.find(e=>ps(e)&&e.docName===t)?.docExt);Ut.startRenaming(n);return}if(e.kind===`folder`){Ut.startRenaming(e.folderPath);return}if(e.kind===`asset`){Ut.startRenaming(e.assetPath);return}console.warn(JSON.stringify({event:`file-tree-menu-action-rename-unsupported-kind`,kind:e.kind}))}),fi=[Ut],t[252]=Ut,t[253]=di,t[254]=fi),(0,Q.useEffect)(di,fi);let pi;t[255]===Symbol.for(`react.memo_cache_sentinel`)?(pi=function(){let e=Te.current;e&&nK(e),Te.current=null},t[255]=pi):pi=t[255];let mi=pi,hi;t[256]===g?hi=t[257]:(hi=function(e){let t=pq(e.nativeEvent);if(!t||t.endsWith(`/`)){mi();return}let n=cM(t),r=le.current.find(e=>lM(e)===t);if(r&&zo(r)){mi();return}if(r&&ps(r)&&Mr(r.size)){mi();return}Te.current!==n&&(mi(),Te.current=n,tK(n,e=>g(e)))},t[256]=g,t[257]=hi);let gi=hi,_i;t[258]!==fe||t[259]!==Ut||t[260]!==D?(_i=function(e){if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=mq(e.nativeEvent);if(!t){_q(e.nativeEvent)&&ie(!0);return}if(t.getAttribute(`aria-selected`)!==`true`)return;let n=t.dataset.itemPath;if(!n)return;let r=t.dataset.itemType===`folder`?fM(n):n;if(Ut.getSelectedPaths().length!==1)return;if(t.dataset.itemType===`folder`){let e=dM(r);if(window.location.hash===Wo(e))return;queueMicrotask(()=>D(e));return}let i=cM(r);window.location.hash!==Ho(i)&&queueMicrotask(()=>fe(r))},t[258]=fe,t[259]=Ut,t[260]=D,t[261]=_i):_i=t[261];let vi=_i,yi;t[262]===Symbol.for(`react.memo_cache_sentinel`)?(yi=function(e){jM(e.nativeEvent)&&(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=`copy`,tt(!0))},t[262]=yi):yi=t[262];let bi=yi,xi;t[263]===Symbol.for(`react.memo_cache_sentinel`)?(xi=function(e){let t=e.relatedTarget;t instanceof Node&&e.currentTarget.contains(t)||tt(!1)},t[263]=xi):xi=t[263];let Si=xi,Ci;t[264]===fr?Ci=t[265]:(Ci=function(e){if(!jM(e.nativeEvent))return;let t=MM(e.nativeEvent);t.length!==0&&(e.preventDefault(),e.stopPropagation(),tt(!1),fr(t,``,SK))},t[264]=fr,t[265]=Ci);let wi=Ci;if(M){let e;return t[266]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(yq,{}),t[266]=e):e=t[266],e}let Ti;t[267]!==r||t[268]!==I||t[269]!==R?(Ti=I?r(R?{id:`H-vDm3`}:{id:`09Tv5j`}):null,t[267]=r,t[268]=I,t[269]=R,t[270]=Ti):Ti=t[270];let Ei=Ti;if(k.length===0){if(Ei!==null){let e;return t[271]===Ei?e=t[272]:(e=(0,Z.jsx)(`div`,{className:`flex flex-1 items-center justify-center py-8`,children:(0,Z.jsx)(`span`,{role:`status`,className:`select-none text-sidebar-foreground/50 text-sm`,children:Ei})}),t[271]=Ei,t[272]=e),e}if(P){let e;return t[273]===P?e=t[274]:(e=(0,Z.jsx)(`div`,{className:`flex flex-1 items-center justify-center py-8`,children:(0,Z.jsx)(`span`,{role:`alert`,className:`select-none text-sidebar-foreground/50 text-sm`,children:P})}),t[273]=P,t[274]=e),e}let e;t[275]===r?e=t[276]:(e=r({id:`5ZB7XC`}),t[275]=r,t[276]=e);let n=$e&&`bg-primary/5 ring-2 ring-primary/70 ring-inset`,i;t[277]===n?i=t[278]:(i=si(`flex flex-1 flex-col items-center justify-center gap-3 rounded-md py-8`,n),t[277]=n,t[278]=i);let a;t[279]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(`span`,{className:`select-none text-sidebar-foreground/30 text-sm`,children:(0,Z.jsx)(s,{id:`xiv-dW`})}),t[279]=a):a=t[279];let o;t[280]===gr?o=t[281]:(o=()=>gr(`file`,``),t[280]=gr,t[281]=o);let c;t[282]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(s,{id:`6ibbCg`}),t[282]=c):c=t[282];let l;t[283]===o?l=t[284]:(l=(0,Z.jsx)(li,{variant:`link`,size:`sm`,className:`font-mono uppercase`,onClick:o,children:c}),t[283]=o,t[284]=l);let u;return t[285]!==wi||t[286]!==e||t[287]!==i||t[288]!==l?(u=(0,Z.jsxs)(`section`,{"aria-label":e,className:i,onDragOver:bi,onDragLeave:Si,onDrop:wi,children:[a,l]}),t[285]=wi,t[286]=e,t[287]=i,t[288]=l,t[289]=u):u=t[289],u}let Di=H!==null,Oi=W?.targets[0]??null,ki=null;if(B!==null){let e;if(t[290]!==a.locale||t[291]!==B){let n=new Intl.NumberFormat(a.locale).format(B);e=hs._({id:`mSpqzP`,values:{truncatedShownCount:B,formattedCount:n}}),t[290]=a.locale,t[291]=B,t[292]=e}else e=t[292];ki=e}let Ai;t[293]!==P||t[294]!==Ei||t[295]!==ki?(Ai=(P||Ei!==null||ki!==null)&&(0,Z.jsxs)(Z.Fragment,{children:[Ei===null?P&&(0,Z.jsx)(xq,{kind:`error`,children:P}):(0,Z.jsx)(xq,{kind:`reconnecting`,children:Ei}),ki!==null&&(0,Z.jsx)(xq,{kind:`info`,children:ki})]}),t[293]=P,t[294]=Ei,t[295]=ki,t[296]=Ai):Ai=t[296];let ji;t[297]===y?ji=t[298]:(ji=AW(y),t[297]=y,t[298]=ji);let Mi=Y?``:void 0,Ni;t[299]===Mi?Ni=t[300]:(Ni={[TK]:Mi},t[299]=Mi,t[300]=Ni);let Pi;t[301]!==Di||t[302]!==_e||t[303]!==br||t[304]!==k||t[305]!==vr||t[306]!==Zt||t[307]!==xn||t[308]!==Dt||t[309]!==At||t[310]!==Ut||t[311]!==Ot||t[312]!==kt||t[313]!==gr||t[314]!==ne?(Pi=(e,t)=>(0,Z.jsx)(LK,{item:e,context:t,anyActionBusy:Di,workspace:ne,handoff:Dt,model:Ut,okignoreBinding:Ot,projectLocalBinding:kt,mergedConfig:At,onStartCreating:gr,onCreateFromTemplate:(e,t)=>gr(`file`,e,{template:t}),onDuplicate:xn,onDelete:e=>G({targets:e}),onExpandSubtree:vr,onCollapseSubtree:br,folderTreePaths:Zt,isAsset:_e.has(e.path),documents:k}),t[301]=Di,t[302]=_e,t[303]=br,t[304]=k,t[305]=vr,t[306]=Zt,t[307]=xn,t[308]=Dt,t[309]=At,t[310]=Ut,t[311]=Ot,t[312]=kt,t[313]=gr,t[314]=ne,t[315]=Pi):Pi=t[315];let Ii;t[316]!==vi||t[317]!==gi||t[318]!==Ut||t[319]!==Ai||t[320]!==ji||t[321]!==Ni||t[322]!==Pi?(Ii=(0,Z.jsx)(`div`,{ref:qe,className:`flex min-h-0 flex-1 flex-col`,children:(0,Z.jsx)(wW,{header:Ai,model:Ut,style:ji,...Ni,onClickCapture:vi,onMouseMove:gi,onMouseLeave:mi,renderContextMenu:Pi})}),t[316]=vi,t[317]=gi,t[318]=Ut,t[319]=Ai,t[320]=ji,t[321]=Ni,t[322]=Pi,t[323]=Ii):Ii=t[323];let Li=!!W,Ri;t[324]===H?Ri=t[325]:(Ri=e=>{!e&&!H&&G(null)},t[324]=H,t[325]=Ri);let zi;t[326]!==r||t[327]!==H||t[328]!==W||t[329]!==Yr||t[330]!==Oi?(zi=W&&Oi&&(0,Z.jsx)(za,{...(()=>{let e=uG(typeof window<`u`&&window.okDesktop!=null?`electron`:`web`,W.targets);if(e)return{customTitle:e.title,customDescription:``,customDetail:e.detail,customConfirmLabel:e.confirmLabel,customConfirmLabelBusy:e.confirmLabelBusy,children:e.listedTargets?(0,Z.jsx)(`ul`,{className:`flex flex-col gap-1 font-mono text-foreground text-xs`,children:e.listedTargets.map(BK)}):null};let t=W.targets.length,n=Oi.name;return{itemName:t===1?Oi.kind===`folder`?`${Oi.name}/`:Oi.kind===`file`?`${Oi.name}${Oi.docExt??`.md`}`:Oi.name:void 0,customTitle:t>1?r({id:`abiHje`}):void 0,customDescription:t>1?r({id:`WMIKXK`,values:{targetCount:t}}):Oi.kind===`folder`?r({id:`a5W0q0`,values:{folderName:n}}):void 0}})(),isSubmitting:H!==null,onDelete:()=>Yr(W.targets)}),t[326]=r,t[327]=H,t[328]=W,t[329]=Yr,t[330]=Oi,t[331]=zi):zi=t[331];let Bi;t[332]!==Li||t[333]!==Ri||t[334]!==zi?(Bi=(0,Z.jsx)(ko,{open:Li,onOpenChange:Ri,children:zi}),t[332]=Li,t[333]=Ri,t[334]=zi,t[335]=Bi):Bi=t[335];let Vi=!!K,Hi;t[336]===H?Hi=t[337]:(Hi=e=>{!e&&!H&&q(null)},t[336]=H,t[337]=Hi);let Ui;t[338]!==H||t[339]!==Zr||t[340]!==ti||t[341]!==K?(Ui=K&&(0,Z.jsx)(vG,{failedTargets:K.failed,isSubmitting:H!==null,onDeletePermanently:Zr,onRetry:ti,onCancel:()=>q(null)}),t[338]=H,t[339]=Zr,t[340]=ti,t[341]=K,t[342]=Ui):Ui=t[342];let Wi;t[343]!==Vi||t[344]!==Hi||t[345]!==Ui?(Wi=(0,Z.jsx)(ko,{open:Vi,onOpenChange:Hi,children:Ui}),t[343]=Vi,t[344]=Hi,t[345]=Ui,t[346]=Wi):Wi=t[346];let Gi=ee!==null,Ki;t[347]===Symbol.for(`react.memo_cache_sentinel`)?(Ki=e=>{e||te(null)},t[347]=Ki):Ki=t[347];let qi=ee?.parentDir??``,Ji;t[348]!==Gi||t[349]!==qi?(Ji=(0,Z.jsx)(zh,{open:Gi,onOpenChange:Ki,kind:`file`,initialDir:qi,defaultToTemplate:!0}),t[348]=Gi,t[349]=qi,t[350]=Ji):Ji=t[350];let Yi;return t[351]!==Ii||t[352]!==Bi||t[353]!==Wi||t[354]!==Ji?(Yi=(0,Z.jsxs)(Z.Fragment,{children:[Ii,Bi,Wi,Ji]}),t[351]=Ii,t[352]=Bi,t[353]=Wi,t[354]=Ji,t[355]=Yi):Yi=t[355],Yi}function BK(e){return(0,Z.jsx)(`li`,{"data-testid":`delete-target-row`,children:dG(e)},`${e.kind}:${e.path}`)}function VK(e){return`${e.kind}:${e.path}`}function HK(e){return`${e.kind}:${e.path}`}function UK(e){return e.path}function WK(e){return e.kind===`folder`}function GK(e){return e.path}function KK(e){return e.kind===`file`}function qK(e){return e.file}function JK(e){return Rt(e)}function YK(e){return wt(e)}function XK(e){return Ue(e)}function ZK(e){return e.path}function QK(e){return e.kind===`asset`}function $K(e){return e.endsWith(`/`)?e.slice(0,-1):e}function eq(e){return!!e}function tq(e){console.warn(`[FileTree] /api/workspace fetch failed:`,e)}function nq(e){console.warn(`[FileTree] unmount cleanup failed:`,e)}function rq(e){X.error(e)}function iq(){}function aq(e){return X.error(e)}function oq(){}function sq(){}function cq(){}function lq(){}function uq(){}async function dq(){}function fq(e){return lM(e)}function pq(e){return mq(e)?.dataset.itemPath??null}function mq(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.dataset.itemPath)return t;return null}function hq(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.matches(`[data-file-tree-virtualized-root]`))return t;return null}function gq(e){let t=mq(e);if(t){let e=t.dataset.itemPath;if(!e)return null;let n=t.dataset.itemType===`folder`,r=OM(e,n);return{parentDir:r,row:t,root:null,busyPath:n?fM(r):e}}return _q(e)?{parentDir:``,row:null,root:hq(e),busyPath:SK}:null}function _q(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.matches(`[data-file-tree-virtualized-scroll]`))return!0;return!1}var vq=[`w-3/4`,`w-2/3`,`w-4/5`,`w-1/2`,`w-3/5`,`w-2/3`];function yq(){let e=(0,$.c)(5),{_:t}=i(),n;e[0]===t?n=e[1]:(n=t({id:`5Tk8Fb`}),e[0]=t,e[1]=n);let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=vq.map(bq),e[2]=r):r=e[2];let a;return e[3]===n?a=e[4]:(a=(0,Z.jsx)(`div`,{className:`flex flex-1 flex-col gap-1 px-2 py-2`,role:`status`,"aria-busy":`true`,"aria-label":n,children:r}),e[3]=n,e[4]=a),a}function bq(e,t){return(0,Z.jsxs)(`div`,{className:`flex h-6 items-center gap-2`,children:[(0,Z.jsx)(Oi,{className:`h-3 w-3 shrink-0 rounded-sm`}),(0,Z.jsx)(Oi,{className:`h-3 ${e}`})]},t)}function xq(e){let t=(0,$.c)(14),{kind:n,children:r}=e,i=n===`error`?Ro:n===`reconnecting`?Ka:jo,a=n===`error`?`alert`:`status`,o=n===`error`?`text-destructive`:`text-muted-foreground`,s;t[0]===o?s=t[1]:(s=si(`mx-2 mb-1 flex items-start gap-1.5 rounded-md bg-muted/50 px-2 py-1.5 text-xs leading-snug`,o),t[0]=o,t[1]=s);let c=n===`reconnecting`&&`animate-spin motion-reduce:animate-none`,l;t[2]===c?l=t[3]:(l=si(`mt-0.5 size-3.5 shrink-0`,c),t[2]=c,t[3]=l);let u;t[4]!==i||t[5]!==l?(u=(0,Z.jsx)(i,{"aria-hidden":`true`,className:l}),t[4]=i,t[5]=l,t[6]=u):u=t[6];let d;t[7]===r?d=t[8]:(d=(0,Z.jsx)(`span`,{className:`min-w-0`,children:r}),t[7]=r,t[8]=d);let f;return t[9]!==a||t[10]!==s||t[11]!==u||t[12]!==d?(f=(0,Z.jsxs)(`span`,{role:a,className:s,children:[u,d]}),t[9]=a,t[10]=s,t[11]=u,t[12]=d,t[13]=f):f=t[13],f}function Sq(e){return e?hs._({id:`wTcjov`}):null}function Cq(e){let t=(0,$.c)(23),{_:n}=i(),r=pg(),a=Wx();if(r)return null;let{input:o,installStates:c,dispatch:l}=e,u=o===null,d,f,p,m,h,g;if(t[0]!==n||t[1]!==l||t[2]!==o||t[3]!==u||t[4]!==c||t[5]!==a){g=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Sq(u),r;t[12]===c?r=t[13]:(r=e=>c[e.id]?.installed===!0,t[12]=c,t[13]=r);let i=gg.filter(r),_=i.length>0,v=a!==null;if(!_&&!v){g=null;break bb0}f=eN,t[14]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsxs)(rN,{children:[(0,Z.jsx)(bi,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`O7_W_a`})]}),t[14]=h):h=t[14],d=iN,p=_?(0,Z.jsxs)($M,{"aria-label":n({id:`BBqGS9`}),children:[(0,Z.jsx)(oN,{children:(0,Z.jsx)(s,{id:`BBqGS9`})}),i.map(t=>{let r=!u,{displayName:i}=t,a=n(e?{id:`1ZpfyB`,values:{displayName:i,hint:e}}:{id:`WqLq6M`,values:{displayName:i}});return(0,Z.jsxs)(nN,{disabled:!r,onSelect:()=>{o&&l(t.id,o)},"data-testid":`empty-space-open-in-${t.id}`,"aria-label":a,children:[(0,Z.jsx)(Vx,{id:t.id,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:t.displayName}),e?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t.id)})]}):null,m=v?(0,Z.jsxs)(Z.Fragment,{children:[_?(0,Z.jsx)(sN,{}):null,(0,Z.jsxs)($M,{"aria-label":n({id:`ALhMYW`}),children:[(0,Z.jsx)(oN,{children:(0,Z.jsx)(s,{id:`ALhMYW`})}),(0,Z.jsxs)(nN,{onSelect:()=>{o!==null&&a.launchInTerminal(o)},disabled:u,"data-testid":`empty-space-open-in-terminal`,"aria-label":n(e?{id:`LtVw4J`,values:{hint:e}}:{id:`AcK_r0`}),children:[(0,Z.jsx)(ru,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`fcgvCA`})}),e?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]})]})]}):null}t[0]=n,t[1]=l,t[2]=o,t[3]=u,t[4]=c,t[5]=a,t[6]=d,t[7]=f,t[8]=p,t[9]=m,t[10]=h,t[11]=g}else d=t[6],f=t[7],p=t[8],m=t[9],h=t[10],g=t[11];if(g!==Symbol.for(`react.early_return_sentinel`))return g;let _;t[15]!==d||t[16]!==p||t[17]!==m?(_=(0,Z.jsxs)(d,{children:[p,m]}),t[15]=d,t[16]=p,t[17]=m,t[18]=_):_=t[18];let v;return t[19]!==f||t[20]!==h||t[21]!==_?(v=(0,Z.jsxs)(f,{children:[h,_]}),t[19]=f,t[20]=h,t[21]=_,t[22]=v):v=t[22],v}var wq=(e,t,n)=>yu(e,t,n,`ProjectSwitcher`);function Tq(e){let t=(0,$.c)(96),{bridge:n}=e,{_:r}=i(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=[],t[0]=a):a=t[0];let[o,c]=(0,Q.useState)(a),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(``),[p,m]=(0,Q.useState)(!1),h=MA(),g=typeof window<`u`&&window.okDesktop!=null,_=(0,Q.useRef)(!1),v;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(v=e=>{u(e),e||f(``)},t[1]=v):v=t[1];let y=v,b;t[2]!==r||t[3]!==n.project||t[4]!==l?(b=()=>{if(!l)return;let e=!1;return wq(async()=>{let t=await n.project.listRecent();e||c(t)},r({id:`fYKgzG`})),()=>{e=!0}},t[2]=r,t[3]=n.project,t[4]=l,t[5]=b):b=t[5];let x;t[6]!==r||t[7]!==n||t[8]!==l?(x=[l,n,r],t[6]=r,t[7]=n,t[8]=l,t[9]=x):x=t[9],(0,Q.useEffect)(b,x);let S;t[10]!==r||t[11]!==n.project?(S=e=>{u(!1),wq(()=>n.project.open({path:e,target:`new-window`,entryPoint:`recents`}),r({id:`SUOoXn`}))},t[10]=r,t[11]=n.project,t[12]=S):S=t[12];let C=S,w;t[13]!==r||t[14]!==n.dialog||t[15]!==n.project?(w=()=>{u(!1),wq(async()=>{let e=await n.dialog.openFolder();e&&await n.project.open({path:e,target:`new-window`,entryPoint:`pick-existing`})},r({id:`gmJ0An`}))},t[13]=r,t[14]=n.dialog,t[15]=n.project,t[16]=w):w=t[16];let E=w,D;t[17]!==r||t[18]!==n.navigator?(D=()=>{u(!1),wq(()=>n.navigator.open(),r({id:`jol95m`}))},t[17]=r,t[18]=n.navigator,t[19]=D):D=t[19];let O=D,k;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(k=()=>{u(!1),m(!0)},t[20]=k):k=t[20];let A=k,j=n.config.projectPath,M,N,P,F,I,L,z,B,H,U,W;if(t[21]!==r||t[22]!==h||t[23]!==n.config.projectName||t[24]!==n.config.projectPath||t[25]!==j||t[26]!==l||t[27]!==C||t[28]!==o||t[29]!==d){let e;t[41]===j?e=t[42]:(e=e=>e.path!==j,t[41]=j,t[42]=e);let i=o.filter(e),a=d.trim().toLowerCase(),c=a?i.filter(e=>e.name.toLowerCase().includes(a)||e.path.toLowerCase().includes(a)):i;N=oo,z=l,B=y,H=!1;let u=h!==null&&`h-auto py-1.5`,p;t[43]===u?p=t[44]:(p=si(`justify-between text-sidebar-foreground/70 hover:text-sidebar-foreground! data-open:hover:text-sidebar-foreground!`,u),t[43]=u,t[44]=p);let m;t[45]===r?m=t[46]:(m=r({id:`zZ_I5K`}),t[45]=r,t[46]=m);let v;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(v=g?()=>{_.current=!0}:void 0,t[47]=v):v=t[47];let b;t[48]===l?b=t[49]:(b=g?()=>{if(_.current){_.current=!1;return}y(!l)}:void 0,t[48]=l,t[49]=b);let x;t[50]===n.config.projectName?x=t[51]:(x=(0,Z.jsx)(`span`,{className:`truncate`,children:n.config.projectName}),t[50]=n.config.projectName,t[51]=x);let S;t[52]===h?S=t[53]:(S=h===null?null:(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1 text-xs text-sidebar-foreground/50 group-hover/menu-button:text-sidebar-foreground`,"data-testid":`project-switcher-branch`,children:[(0,Z.jsx)(ke,{"aria-hidden":`true`,className:`size-3! shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:h})]}),t[52]=h,t[53]=S);let w;t[54]!==x||t[55]!==S?(w=(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[x,S]}),t[54]=x,t[55]=S,t[56]=w):w=t[56];let E;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Z.jsx)(cl,{"aria-hidden":`true`,className:`opacity-60`}),t[57]=E):E=t[57],t[58]!==n.config.projectPath||t[59]!==p||t[60]!==m||t[61]!==b||t[62]!==w?(U=(0,Z.jsx)(ja,{asChild:!0,children:(0,Z.jsxs)(EA,{className:p,"data-testid":`project-switcher-trigger`,"aria-label":m,title:n.config.projectPath,onPointerDown:v,onClick:b,children:[w,E]})}),t[58]=n.config.projectPath,t[59]=p,t[60]=m,t[61]=b,t[62]=w,t[63]=U):U=t[63],M=to,W=`start`,P=`top`,F=`min-w-[260px]`,I=`project-switcher-menu`,L=i.length===0?(0,Z.jsx)(Xa,{className:`font-normal text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`HNnVG1`})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(KC,{className:`mb-1 h-8 border-0 shadow-none has-[[data-slot=input-group-control]:focus-visible]:ring-0`,children:[(0,Z.jsx)(ZC,{"aria-label":r({id:`H8Ng4Z`}),placeholder:r({id:`8S1E33`}),value:d,onChange:e=>f(e.target.value),onKeyDown:Eq,"data-testid":`project-switcher-search`}),(0,Z.jsx)(JC,{children:(0,Z.jsx)(T,{"aria-hidden":`true`})})]}),(0,Z.jsx)(ro,{}),c.length===0?(0,Z.jsx)(Xa,{className:`font-normal text-muted-foreground text-xs`,role:`status`,"aria-live":`polite`,children:(0,Z.jsx)(s,{id:`pEQFsW`})}):(0,Z.jsx)(`div`,{className:`max-h-64 overflow-x-hidden overflow-y-auto overscroll-contain subtle-scrollbar scroll-fade-mask`,children:c.slice(0,10).map(e=>(0,Z.jsxs)(Da,{disabled:e.missing,onSelect:()=>C(e.path),className:`flex w-full min-w-0 flex-col items-start gap-0.5`,"data-testid":`project-switcher-recent-${e.path}`,children:[(0,Z.jsx)(`span`,{className:`w-full truncate font-medium text-sm`,title:e.name,children:e.name}),(0,Z.jsxs)(`span`,{className:`w-full truncate text-muted-foreground text-xs`,title:e.path,children:[e.path,e.missing?r({id:`2Znqb1`}):``]})]},e.path))})]}),t[21]=r,t[22]=h,t[23]=n.config.projectName,t[24]=n.config.projectPath,t[25]=j,t[26]=l,t[27]=C,t[28]=o,t[29]=d,t[30]=M,t[31]=N,t[32]=P,t[33]=F,t[34]=I,t[35]=L,t[36]=z,t[37]=B,t[38]=H,t[39]=U,t[40]=W}else M=t[30],N=t[31],P=t[32],F=t[33],I=t[34],L=t[35],z=t[36],B=t[37],H=t[38],U=t[39],W=t[40];let G;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,Z.jsx)(ro,{}),t[64]=G):G=t[64];let K,q;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Z.jsx)(ie,{"aria-hidden":`true`,className:`text-muted-foreground`}),q=(0,Z.jsx)(s,{id:`PVUn_c`}),t[65]=K,t[66]=q):(K=t[65],q=t[66]);let J;t[67]===E?J=t[68]:(J=(0,Z.jsxs)(Da,{onSelect:E,"data-testid":`project-switcher-open-folder`,children:[K,q]}),t[67]=E,t[68]=J);let ee,te;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Z.jsx)(R,{"aria-hidden":`true`,className:`text-muted-foreground`}),te=(0,Z.jsx)(s,{id:`xaDWAI`}),t[69]=ee,t[70]=te):(ee=t[69],te=t[70]);let ne;t[71]===O?ne=t[72]:(ne=(0,Z.jsxs)(Da,{onSelect:O,"data-testid":`project-switcher-switch-project`,children:[ee,te]}),t[71]=O,t[72]=ne);let re;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Z.jsxs)(Da,{onSelect:A,"data-testid":`project-switcher-new-project`,children:[(0,Z.jsx)(V,{"aria-hidden":`true`,className:`text-muted-foreground`}),(0,Z.jsx)(s,{id:`gKi-a_`})]}),t[73]=re):re=t[73];let Y;t[74]!==M||t[75]!==P||t[76]!==F||t[77]!==I||t[78]!==L||t[79]!==J||t[80]!==ne||t[81]!==W?(Y=(0,Z.jsxs)(M,{align:W,side:P,className:F,"data-testid":I,children:[L,G,J,ne,re]}),t[74]=M,t[75]=P,t[76]=F,t[77]=I,t[78]=L,t[79]=J,t[80]=ne,t[81]=W,t[82]=Y):Y=t[82];let ae;t[83]!==N||t[84]!==z||t[85]!==B||t[86]!==H||t[87]!==U||t[88]!==Y?(ae=(0,Z.jsxs)(N,{open:z,onOpenChange:B,modal:H,children:[U,Y]}),t[83]=N,t[84]=z,t[85]=B,t[86]=H,t[87]=U,t[88]=Y,t[89]=ae):ae=t[89];let oe;t[90]!==n||t[91]!==p?(oe=(0,Z.jsx)(hf,{open:p,onOpenChange:m,bridge:n}),t[90]=n,t[91]=p,t[92]=oe):oe=t[92];let se;return t[93]!==ae||t[94]!==oe?(se=(0,Z.jsxs)(Z.Fragment,{children:[ae,oe]}),t[93]=ae,t[94]=oe,t[95]=se):se=t[95],se}function Eq(e){return e.stopPropagation()}function Dq(e,t){let n=e instanceof Error?e:Error(String(e));console.warn(JSON.stringify({event:`jsx-render-failure`,component:`sidebarSearchPill`,rawComponentName:`sidebarSearchPill`,error:String(n),stack:t.componentStack})),In(`sidebarSearchPill`)}function Oq(e){let t=(0,$.c)(8),{onClick:n,className:r}=e,i;t[0]===r?i=t[1]:(i=si(`rounded-lg h-9 w-full justify-start gap-2 px-3 font-normal text-muted-foreground`,r),t[0]=r,t[1]=i);let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(T,{"aria-hidden":`true`}),t[2]=a):a=t[2];let o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(`span`,{className:`flex-1 text-left text-sm`,children:(0,Z.jsx)(s,{id:`A1taO8`})}),t[3]=o):o=t[3];let c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(Yt,{className:`text-foreground/70`,children:tc(`command-palette`)}),t[4]=c):c=t[4];let l;return t[5]!==n||t[6]!==i?(l=(0,Z.jsxs)(li,{variant:`outline`,onClick:n,"data-telemetry-event":`ok.sidebar.search_pill.click`,className:i,children:[a,o,c]}),t[5]=n,t[6]=i,t[7]=l):l=t[7],l}function kq(e){let t=(0,$.c)(37),{notice:n,onDismiss:r}=e,{_:a}=i(),o=n.variant===`error`?`border-destructive/60 bg-sidebar-accent/30 text-muted-foreground`:n.variant===`success`?`border-emerald-500/40 bg-emerald-500/10 text-emerald-600 dark:text-emerald-400`:`border-sidebar-border bg-sidebar-accent/30 text-muted-foreground`,s;t[0]!==a||t[1]!==n.dismissible||t[2]!==r?(s=n.dismissible===!1?null:(0,Z.jsx)(li,{variant:`ghost`,size:`icon`,className:`size-5 shrink-0 text-muted-foreground hover:text-sidebar-foreground`,"aria-label":a({id:`GUYwCr`}),onClick:r,children:(0,Z.jsx)(gs,{"aria-hidden":`true`,className:`size-3`})}),t[0]=a,t[1]=n.dismissible,t[2]=r,t[3]=s):s=t[3];let c=s,l=`shrink-0 text-xs font-medium underline underline-offset-2 ${n.variant===`success`?`decoration-emerald-500/40`:`decoration-muted-foreground/40`} hover:text-sidebar-foreground hover:decoration-sidebar-foreground`;if(n.secondaryAction){let e=`update-notice-${n.id}`,r=`flex flex-col gap-2 rounded-md border px-2 py-2 text-xs ${o}`,i;t[4]===n.body?i=t[5]:(i=(0,Z.jsx)(`span`,{className:`flex-1 leading-snug`,children:n.body}),t[4]=n.body,t[5]=i);let a;t[6]!==c||t[7]!==i?(a=(0,Z.jsxs)(`div`,{className:`flex items-start gap-2`,children:[i,c]}),t[6]=c,t[7]=i,t[8]=a):a=t[8];let s;t[9]!==l||t[10]!==n.action?(s=n.action?(0,Z.jsx)(`button`,{type:`button`,className:l,onClick:()=>{n.action?.onClick()},children:n.action.label}):null,t[9]=l,t[10]=n.action,t[11]=s):s=t[11];let u;t[12]===n.secondaryAction?u=t[13]:(u=()=>{n.secondaryAction?.onClick()},t[12]=n.secondaryAction,t[13]=u);let d;t[14]!==l||t[15]!==n.secondaryAction.label||t[16]!==u?(d=(0,Z.jsx)(`button`,{type:`button`,className:l,onClick:u,children:n.secondaryAction.label}),t[14]=l,t[15]=n.secondaryAction.label,t[16]=u,t[17]=d):d=t[17];let f;t[18]!==s||t[19]!==d?(f=(0,Z.jsxs)(`div`,{className:`flex gap-3 pl-1`,children:[s,d]}),t[18]=s,t[19]=d,t[20]=f):f=t[20];let p;return t[21]!==e||t[22]!==r||t[23]!==a||t[24]!==f?(p=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":e,className:r,children:[a,f]}),t[21]=e,t[22]=r,t[23]=a,t[24]=f,t[25]=p):p=t[25],p}let u=`update-notice-${n.id}`,d=`flex items-center gap-2 rounded-md border px-2 py-1.5 text-xs ${o}`,f;t[26]===n.body?f=t[27]:(f=(0,Z.jsx)(`span`,{className:`flex-1 leading-snug`,children:n.body}),t[26]=n.body,t[27]=f);let p;t[28]!==l||t[29]!==n.action?(p=n.action?(0,Z.jsx)(`button`,{type:`button`,className:l,onClick:()=>{n.action?.onClick()},children:n.action.label}):null,t[28]=l,t[29]=n.action,t[30]=p):p=t[30];let m;return t[31]!==c||t[32]!==u||t[33]!==d||t[34]!==f||t[35]!==p?(m=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":u,className:d,children:[f,p,c]}),t[31]=c,t[32]=u,t[33]=d,t[34]=f,t[35]=p,t[36]=m):m=t[36],m}function Aq(e){if(e.length===0)return null;let t=e[0];if(!t)return null;for(let n=1;n<e.length;n++){let r=e[n];r&&r.priority<t.priority&&(t=r)}return t}function jq(){let e=(0,$.c)(7),t=(0,Q.useSyncExternalStore)(Hm,Vm,Vm),n;e[0]===t?n=e[1]:(n=Aq(t),e[0]=t,e[1]=n);let r=n;if(!r)return null;let i;e[2]===r?i=e[3]:(i=()=>{r.onDismiss?.(),Bm(r.id)},e[2]=r,e[3]=i);let a;return e[4]!==r||e[5]!==i?(a=(0,Z.jsx)(`div`,{"data-testid":`update-notices-list`,children:(0,Z.jsx)(kq,{notice:r,onDismiss:i})}),e[4]=r,e[5]=i,e[6]=a):a=e[6],a}function Mq(e,t,n){return e?.kind===`doc`&&t||e?.kind===`folder-index`&&t?Zg(n.contentDir,Qg(t),n.pathSeparator):e?.kind===`folder`?Zg(n.contentDir,e.folderPath,n.pathSeparator):e?.kind===`asset`?Zg(n.contentDir,e.assetPath,n.pathSeparator):n.contentDir}function Nq(e,t){return(e?.kind===`doc`||e?.kind===`folder-index`)&&t?Qg(t):e?.kind===`folder`?e.folderPath:e?.kind===`asset`?e.assetPath:``}function Pq(e,t,n){return e===null?e_({workspace:n}):e.kind===`folder`?n?r_({folderRelativePath:e.folderPath,workspace:n}):null:e.kind===`doc`||e.kind===`folder-index`?$g({docName:t,workspace:n}):null}var Fq={folderCount:0,expandedCount:0},Iq=`button, [role="button"], [role="menuitem"], input, textarea, select, a[href]`;function Lq(e){return typeof Element>`u`||!(e instanceof Element)?!1:e.closest(Iq)!==null}function Rq(e){let t=(0,$.c)(2),{onOpenSearch:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(Gt,{name:`file-sidebar`,children:(0,Z.jsx)(Bq,{onOpenSearch:n})}),t[0]=n,t[1]=r),r}var zq=e=>{let t=(0,$.c)(15),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({icon:n,label:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=(0,Z.jsx)(n,{"aria-hidden":`true`}),t[4]=n,t[5]=a);let o;t[6]!==r||t[7]!==i||t[8]!==a?(o=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(li,{variant:`ghost`,size:`icon-sm`,"aria-label":r,...i,children:a})}),t[6]=r,t[7]=i,t[8]=a,t[9]=o):o=t[9];let s;t[10]===r?s=t[11]:(s=(0,Z.jsx)(Ns,{children:r}),t[10]=r,t[11]=s);let c;return t[12]!==o||t[13]!==s?(c=(0,Z.jsxs)(Is,{children:[o,s]}),t[12]=o,t[13]=s,t[14]=c):c=t[14],c};function Bq(e){let t=(0,$.c)(189),{onOpenSearch:n}=e,{_:r}=i(),[a,o]=(0,Q.useState)(null),{activeDocName:c,activeTarget:l}=ht(),u;t[0]!==c||t[1]!==l?(u=l?.kind===`folder`||l?.kind===`folder-index`?l.folderPath:ms(c),t[0]=c,t[1]=l,t[2]=u):u=t[2];let d=u,[f,p]=(0,Q.useState)(!1),m=f?``:d,h=typeof window<`u`&&window.okDesktop!=null,{state:g,toggleSidebar:_}=fA(),v=pg(),y=g===`expanded`,b=h&&g===`collapsed`,[x,S]=(0,Q.useState)(Fq),C,w;t[3]===a?(C=t[4],w=t[5]):(C=()=>{if(a===null)return;let e=()=>{S(a.getFolderState()),p(a.isCreationTargetCleared())};return e(),a.subscribe(e)},w=[a],t[3]=a,t[4]=C,t[5]=w),(0,Q.useEffect)(C,w);let T,E;t[6]===a?(T=t[7],E=t[8]):(T=()=>{if(a!==null)return NS(e=>{let t=e.initialDir??``;if(e.template){a.createFromTemplate(e.template.folder,e.template.name);return}a.startCreating(`file`,t)})},E=[a],t[6]=a,t[7]=T,t[8]=E),(0,Q.useEffect)(T,E);let D=x.folderCount>0,O=D&&x.expandedCount===x.folderCount,k=x.expandedCount===0,A=Ha(``),j=Ha(m===``?null:m),M=m===``?A:j,N=A.state.status===`ready`?(A.state.data.folder.templates_available?.length??0)>0:!0,P=M.state.status===`ready`?(M.state.data.folder.templates_available?.length??0)>0:!0,F=typeof window<`u`?window.okDesktop:void 0,I=ka(),L=D_().states,{dispatch:R}=g_(),z;t[9]===I?z=t[10]:(z=e_({workspace:I}),t[9]=I,t[10]=z);let B=z,{projectLocalBinding:V,merged:H}=oe(),U=H?.appearance?.sidebar?.showHiddenFiles??!1,W=H?.appearance?.sidebar?.showAllFiles??!0,G=D&&!O,K=D&&!k,q=G||K,J=Hq,ee;t[11]!==a||t[12]!==I?(ee=()=>{I&&a?.startCreating(`file`,``)},t[11]=a,t[12]=I,t[13]=ee):ee=t[13];let te=ee,ne;t[14]!==a||t[15]!==I?(ne=e=>{I&&a?.createFromTemplate(``,e)},t[14]=a,t[15]=I,t[16]=ne):ne=t[16];let re=ne,Y;t[17]!==a||t[18]!==I?(Y=()=>{I&&a?.startCreating(`folder`,``)},t[17]=a,t[18]=I,t[19]=Y):Y=t[19];let ae=Y,se;t[20]===I?se=t[21]:(se=()=>{!I||!F||F.shell.showItemInFolder(I.contentDir)},t[20]=I,t[21]=se);let ce=se,ue;t[22]!==r||t[23]!==I?(ue=async()=>{if(I)try{await navigator.clipboard.writeText(I.contentDir),X.success(r({id:`6_ZOw4`}),{description:I.contentDir})}catch(e){console.warn(`[FileSidebar] clipboard write failed:`,e),X.error(r({id:`vfRlCI`}))}},t[22]=r,t[23]=I,t[24]=ue):ue=t[24];let de=ue,fe;t[25]!==r||t[26]!==V?(fe=e=>{if(V===null)return;let t=V.patch({appearance:{sidebar:{showHiddenFiles:e}}});t.ok||(console.warn(`[FileSidebar] showHiddenFiles toggle rejected:`,Vr(t.error)),X.error(r({id:`P47EWZ`}),{description:Vr(t.error)}))},t[25]=r,t[26]=V,t[27]=fe):fe=t[27];let pe=fe,me;t[28]!==r||t[29]!==V?(me=e=>{if(V===null)return;let t=V.patch({appearance:{sidebar:{showAllFiles:e}}});t.ok||(console.warn(`[FileSidebar] showAllFiles toggle rejected:`,Vr(t.error)),X.error(r({id:`P47EWZ`}),{description:Vr(t.error)}))},t[28]=r,t[29]=V,t[30]=me):me=t[30];let he=me,ge;t[31]===a?ge=t[32]:(ge=()=>{a?.expandAll()},t[31]=a,t[32]=ge);let _e=ge,ve;t[33]===a?ve=t[34]:(ve=()=>{a?.collapseAll()},t[33]=a,t[34]=ve);let ye=ve,be,xe;t[35]!==W||t[36]!==K||t[37]!==G||t[38]!==U||t[39]!==g?(be=()=>{F&&F.editor.notifyViewMenuStateChanged({showHiddenFiles:U,showAllFiles:W,canExpandAll:G,canCollapseAll:K,sidebarVisible:g===`expanded`})},xe=[F,U,W,G,K,g],t[35]=W,t[36]=K,t[37]=G,t[38]=U,t[39]=g,t[40]=be,t[41]=xe):(be=t[40],xe=t[41]),(0,Q.useEffect)(be,xe);let Se,Ce;t[42]!==r||t[43]!==c||t[44]!==l||t[45]!==R||t[46]!==L||t[47]!==m||t[48]!==V||t[49]!==W||t[50]!==U||t[51]!==_||t[52]!==a||t[53]!==I?(Se=()=>{if(F)return F.onMenuAction(e=>{switch(e){case`new-doc`:if(!I||!a)return;a.startCreating(`file`,m);return;case`new-folder`:if(!I||!a)return;a.startCreating(`folder`,m);return;case`new-from-template`:if(!I||!a)return;a.startCreatingFromTemplate(m);return;case`rename`:if(!l)return;kG(l);return;case`duplicate`:if(!l)return;jG(l);return;case`move-to-trash`:if(!l)return;DG(l);return;case`reveal-in-finder`:{if(!F||!I)return;let e=Mq(l,c,I);F.shell.showItemInFolder(e);return}case`send-to-ai`:{let e=gg.filter(e=>L[e.id]?.installed===!0);if(e.length===0){X.error(r({id:`LKOLNn`}));return}let t=Pq(l,c,I);if(!t)return;let[n]=e;if(!n)return;R(n.id,t);return}case`copy-full-path`:{if(!I)return;let e=Mq(l,c,I);navigator.clipboard.writeText(e).then(()=>X.success(r({id:`6_ZOw4`}),{description:e})).catch(e=>{console.warn(`[FileSidebar] clipboard write failed:`,e),X.error(r({id:`vfRlCI`}))});return}case`copy-relative-path`:{let e=Nq(l,c);if(e===``){X.error(r({id:`74eHt-`}));return}navigator.clipboard.writeText(e).then(()=>X.success(r({id:`haHgQj`}),{description:e})).catch(e=>{console.warn(`[FileSidebar] clipboard write failed:`,e),X.error(r({id:`5QGTaA`}))});return}case`toggle-show-hidden-files`:{if(V===null)return;let e=V.patch({appearance:{sidebar:{showHiddenFiles:!U}}});e.ok||(console.warn(`[FileSidebar] toggle-show-hidden-files rejected:`,Vr(e.error)),X.error(r({id:`P47EWZ`}),{description:Vr(e.error)}));return}case`toggle-show-all-files`:{if(V===null)return;let e=V.patch({appearance:{sidebar:{showAllFiles:!W}}});e.ok||(console.warn(`[FileSidebar] toggle-show-all-files rejected:`,Vr(e.error)),X.error(r({id:`P47EWZ`}),{description:Vr(e.error)}));return}case`expand-all-tree`:a?.expandAll();return;case`collapse-all-tree`:a?.collapseAll();return;case`toggle-sidebar`:_();return;case`delete`:case`toggle-source`:case`save-version`:case`version-history`:case`focus-search`:case`focus-command-palette`:case`close-active-tab-or-window`:case`toggle-doc-panel`:return}})},Ce=[F,a,I,l,c,m,V,U,W,L,R,_,r],t[42]=r,t[43]=c,t[44]=l,t[45]=R,t[46]=L,t[47]=m,t[48]=V,t[49]=W,t[50]=U,t[51]=_,t[52]=a,t[53]=I,t[54]=Se,t[55]=Ce):(Se=t[54],Ce=t[55]),(0,Q.useEffect)(Se,Ce);let we=h&&y&&`motion-safe:delay-100`,Te=b&&`opacity-0`,Ee;t[56]!==we||t[57]!==Te?(Ee=si(`flex-row h-12 items-center py-0 px-3`,`justify-between`,h&&`overflow-x-clip`,h&&`motion-safe:transition-opacity motion-safe:duration-100 motion-safe:ease-out`,we,Te,h&&`[-webkit-app-region:drag]`),t[56]=we,t[57]=Te,t[58]=Ee):Ee=t[58];let De;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(De=h?(0,Z.jsx)(`div`,{"aria-hidden":`true`,"data-testid":`sidebar-traffic-light-reserve`,className:`w-[var(--ok-titlebar-reserve-left,0px)] shrink-0 self-stretch`}):null,t[59]=De):De=t[59];let Oe;t[60]===y?Oe=t[61]:(Oe=y&&!h?(0,Z.jsx)(`span`,{className:`shrink-0 font-mono text-sm uppercase tracking-wider text-sidebar-foreground/50`,children:(0,Z.jsx)(s,{id:`sER-bs`})}):null,t[60]=y,t[61]=Oe);let ke;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(ke=si(`flex items-center gap-1`,h&&`[&>*]:[-webkit-app-region:no-drag]`),t[62]=ke):ke=t[62];let Ae;t[63]!==r||t[64]!==O||t[65]!==D||t[66]!==k||t[67]!==a?(Ae=D?(0,Z.jsxs)(oo,{children:[(0,Z.jsx)(ja,{asChild:!0,children:(0,Z.jsx)(zq,{icon:Ml,label:r({id:`Rq1vFD`})})}),(0,Z.jsxs)(to,{align:`end`,children:[O?null:(0,Z.jsxs)(Da,{onSelect:()=>a?.expandAll(),children:[(0,Z.jsx)(mu,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`OlAl5i`})]}),k?null:(0,Z.jsxs)(Da,{onSelect:()=>a?.collapseAll(),children:[(0,Z.jsx)(xl,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`qvWGzP`})]})]})]}):null,t[63]=r,t[64]=O,t[65]=D,t[66]=k,t[67]=a,t[68]=Ae):Ae=t[68];let je;t[69]===r?je=t[70]:(je=r({id:`HdkSiO`}),t[69]=r,t[70]=je);let Me;t[71]!==m||t[72]!==a?(Me=()=>a?.startCreating(`file`,m),t[71]=m,t[72]=a,t[73]=Me):Me=t[73];let Ne;t[74]!==je||t[75]!==Me?(Ne=(0,Z.jsx)(zq,{icon:nu,label:je,onClick:Me}),t[74]=je,t[75]=Me,t[76]=Ne):Ne=t[76];let Pe;t[77]!==r||t[78]!==P||t[79]!==m||t[80]!==a?(Pe=P?(0,Z.jsxs)(oo,{children:[(0,Z.jsx)(ja,{asChild:!0,children:(0,Z.jsx)(zq,{icon:La,label:r({id:`Uuj_R4`})})}),(0,Z.jsx)(to,{align:`end`,children:(0,Z.jsx)(bG,{parentDir:m,onSelectTemplate:e=>a?.createFromTemplate(m,e),ItemComponent:Da})})]}):null,t[77]=r,t[78]=P,t[79]=m,t[80]=a,t[81]=Pe):Pe=t[81];let Fe;t[82]===r?Fe=t[83]:(Fe=r({id:`96G6Re`}),t[82]=r,t[83]=Fe);let Ie;t[84]!==m||t[85]!==a?(Ie=()=>a?.startCreating(`folder`,m),t[84]=m,t[85]=a,t[86]=Ie):Ie=t[86];let Le;t[87]!==Fe||t[88]!==Ie?(Le=(0,Z.jsx)(zq,{icon:Cl,label:Fe,onClick:Ie}),t[87]=Fe,t[88]=Ie,t[89]=Le):Le=t[89];let Re;t[90]!==Ae||t[91]!==Ne||t[92]!==Pe||t[93]!==Le?(Re=(0,Z.jsxs)(`div`,{"data-testid":`sidebar-toolbar`,className:ke,children:[Ae,Ne,Pe,Le]}),t[90]=Ae,t[91]=Ne,t[92]=Pe,t[93]=Le,t[94]=Re):Re=t[94];let ze;t[95]!==Ee||t[96]!==Oe||t[97]!==Re?(ze=(0,Z.jsxs)(bA,{"data-electron-drag":h?``:void 0,className:Ee,children:[De,Oe,Re]}),t[95]=Ee,t[96]=Oe,t[97]=Re,t[98]=ze):ze=t[98];let Be=h&&y&&`motion-safe:delay-100`,Ve=b&&`opacity-0`,He;t[99]!==Be||t[100]!==Ve?(He=si(`px-2 pb-2`,h&&`[-webkit-app-region:no-drag]`,h&&`motion-safe:transition-opacity motion-safe:duration-100 motion-safe:ease-out`,Be,Ve),t[99]=Be,t[100]=Ve,t[101]=He):He=t[101];let Ue;t[102]===g?Ue=t[103]:(Ue=[g],t[102]=g,t[103]=Ue);let We;t[104]===n?We=t[105]:(We=(0,Z.jsx)(Oq,{onClick:n}),t[104]=n,t[105]=We);let Ge;t[106]!==Ue||t[107]!==We?(Ge=(0,Z.jsx)(le,{fallbackRender:Vq,onError:Dq,resetKeys:Ue,children:We}),t[106]=Ue,t[107]=We,t[108]=Ge):Ge=t[108];let Ke;t[109]!==He||t[110]!==Ge?(Ke=(0,Z.jsx)(`div`,{className:He,children:Ge}),t[109]=He,t[110]=Ge,t[111]=Ke):Ke=t[111];let qe;t[112]===Symbol.for(`react.memo_cache_sentinel`)?(qe=(0,Z.jsxs)(SA,{children:[(0,Z.jsx)(rP,{}),(0,Z.jsx)(zK,{ref:o})]}),t[112]=qe):qe=t[112];let Je;t[113]===Symbol.for(`react.memo_cache_sentinel`)?(Je=(0,Z.jsxs)(xA,{className:`px-0`,children:[(0,Z.jsx)(jq,{}),typeof window<`u`&&window.okDesktop?(0,Z.jsx)(CA,{children:(0,Z.jsx)(wA,{children:(0,Z.jsx)(Tq,{bridge:window.okDesktop})})}):null]}),t[113]=Je):Je=t[113];let Ye=!(v&&g===`collapsed`),Xe;t[114]===Ye?Xe=t[115]:(Xe=(0,Z.jsx)(vA,{enableToggle:!1,enableDrag:Ye}),t[114]=Ye,t[115]=Xe);let Ze;t[116]!==ze||t[117]!==Ke||t[118]!==Xe?(Ze=(0,Z.jsx)(QM,{asChild:!0,children:(0,Z.jsxs)(`div`,{className:`contents`,onContextMenu:J,children:[ze,Ke,qe,Je,Xe]})}),t[116]=ze,t[117]=Ke,t[118]=Xe,t[119]=Ze):Ze=t[119];let Qe=!I,$e,et;t[120]===Symbol.for(`react.memo_cache_sentinel`)?($e=(0,Z.jsx)(nu,{"aria-hidden":`true`}),et=(0,Z.jsx)(s,{id:`HdkSiO`}),t[120]=$e,t[121]=et):($e=t[120],et=t[121]);let tt;t[122]!==te||t[123]!==Qe?(tt=(0,Z.jsxs)(nN,{disabled:Qe,onSelect:te,"data-testid":`empty-space-menu-new-file`,children:[$e,et]}),t[122]=te,t[123]=Qe,t[124]=tt):tt=t[124];let rt;t[125]!==re||t[126]!==N||t[127]!==I?(rt=N?(0,Z.jsxs)(eN,{children:[(0,Z.jsxs)(rN,{disabled:!I,"data-testid":`empty-space-menu-new-from-template`,children:[(0,Z.jsx)(La,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`Uuj_R4`})]}),(0,Z.jsx)(iN,{children:(0,Z.jsx)(bG,{parentDir:``,onSelectTemplate:re,ItemComponent:nN})})]}):null,t[125]=re,t[126]=N,t[127]=I,t[128]=rt):rt=t[128];let it=!I,at,ot;t[129]===Symbol.for(`react.memo_cache_sentinel`)?(at=(0,Z.jsx)(Cl,{"aria-hidden":`true`}),ot=(0,Z.jsx)(s,{id:`96G6Re`}),t[129]=at,t[130]=ot):(at=t[129],ot=t[130]);let st;t[131]!==ae||t[132]!==it?(st=(0,Z.jsxs)(nN,{disabled:it,onSelect:ae,"data-testid":`empty-space-menu-new-folder`,children:[at,ot]}),t[131]=ae,t[132]=it,t[133]=st):st=t[133];let ct;t[134]===Symbol.for(`react.memo_cache_sentinel`)?(ct=(0,Z.jsx)(sN,{}),t[134]=ct):ct=t[134];let lt;t[135]!==r||t[136]!==ce||t[137]!==I?(lt=F?(0,Z.jsxs)(nN,{disabled:!I,onSelect:ce,"data-testid":`empty-space-menu-reveal-in-finder`,"aria-label":r(I?{id:`LtSYdi`}:{id:`o2yoFu`}),children:[(0,Z.jsx)(ie,{"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`LtSYdi`})}),I?null:(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`wTcjov`})})]}):null,t[135]=r,t[136]=ce,t[137]=I,t[138]=lt):lt=t[138];let ut;t[139]!==R||t[140]!==B||t[141]!==L?(ut=(0,Z.jsx)(Cq,{input:B,installStates:L,dispatch:R}),t[139]=R,t[140]=B,t[141]=L,t[142]=ut):ut=t[142];let dt=!I,ft;t[143]!==r||t[144]!==I?(ft=r(I?{id:`Up2_7p`}:{id:`U8CD-l`}),t[143]=r,t[144]=I,t[145]=ft):ft=t[145];let pt;t[146]===Symbol.for(`react.memo_cache_sentinel`)?(pt=(0,Z.jsx)(nt,{"aria-hidden":`true`}),t[146]=pt):pt=t[146];let mt;t[147]===Symbol.for(`react.memo_cache_sentinel`)?(mt=(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`Up2_7p`})}),t[147]=mt):mt=t[147];let gt;t[148]===I?gt=t[149]:(gt=I?null:(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`wTcjov`})}),t[148]=I,t[149]=gt);let _t;t[150]!==de||t[151]!==dt||t[152]!==ft||t[153]!==gt?(_t=(0,Z.jsxs)(nN,{disabled:dt,onSelect:de,"data-testid":`empty-space-menu-copy-full-path`,"aria-label":ft,children:[pt,mt,gt]}),t[150]=de,t[151]=dt,t[152]=ft,t[153]=gt,t[154]=_t):_t=t[154];let vt;t[155]===Symbol.for(`react.memo_cache_sentinel`)?(vt=(0,Z.jsx)(sN,{}),t[155]=vt):vt=t[155];let yt=V===null,bt;t[156]===Symbol.for(`react.memo_cache_sentinel`)?(bt=(0,Z.jsx)(s,{id:`XcGbim`}),t[156]=bt):bt=t[156];let xt;t[157]!==pe||t[158]!==U||t[159]!==yt?(xt=(0,Z.jsx)(aN,{checked:U,onCheckedChange:pe,disabled:yt,"data-testid":`empty-space-menu-show-hidden-files`,children:bt}),t[157]=pe,t[158]=U,t[159]=yt,t[160]=xt):xt=t[160];let St=V===null,Ct;t[161]===Symbol.for(`react.memo_cache_sentinel`)?(Ct=(0,Z.jsx)(s,{id:`i8dKs-`}),t[161]=Ct):Ct=t[161];let wt;t[162]!==he||t[163]!==W||t[164]!==St?(wt=(0,Z.jsx)(aN,{checked:W,onCheckedChange:he,disabled:St,"data-testid":`empty-space-menu-show-all-files`,children:Ct}),t[162]=he,t[163]=W,t[164]=St,t[165]=wt):wt=t[165];let Tt;t[166]===q?Tt=t[167]:(Tt=q?(0,Z.jsx)(sN,{}):null,t[166]=q,t[167]=Tt);let Et;t[168]!==_e||t[169]!==G?(Et=G?(0,Z.jsxs)(nN,{onSelect:_e,"data-testid":`empty-space-menu-expand-all`,children:[(0,Z.jsx)(mu,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`OlAl5i`})]}):null,t[168]=_e,t[169]=G,t[170]=Et):Et=t[170];let Dt;t[171]!==ye||t[172]!==K?(Dt=K?(0,Z.jsxs)(nN,{onSelect:ye,"data-testid":`empty-space-menu-collapse-all`,children:[(0,Z.jsx)(xl,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`qvWGzP`})]}):null,t[171]=ye,t[172]=K,t[173]=Dt):Dt=t[173];let Ot;t[174]!==tt||t[175]!==rt||t[176]!==st||t[177]!==lt||t[178]!==ut||t[179]!==_t||t[180]!==xt||t[181]!==wt||t[182]!==Tt||t[183]!==Et||t[184]!==Dt?(Ot=(0,Z.jsxs)(tN,{children:[tt,rt,st,ct,lt,ut,_t,vt,xt,wt,Tt,Et,Dt]}),t[174]=tt,t[175]=rt,t[176]=st,t[177]=lt,t[178]=ut,t[179]=_t,t[180]=xt,t[181]=wt,t[182]=Tt,t[183]=Et,t[184]=Dt,t[185]=Ot):Ot=t[185];let kt;return t[186]!==Ze||t[187]!==Ot?(kt=(0,Z.jsx)(gA,{variant:`inset`,children:(0,Z.jsxs)(ZM,{children:[Ze,Ot]})}),t[186]=Ze,t[187]=Ot,t[188]=kt):kt=t[188],kt}function Vq(){return null}function Hq(e){Lq(e.target)&&(e.preventDefault(),e.stopPropagation())}function Uq(e){let t=e.shareTargetExists,n=e.dirtyConflicts.conflicts,r=e.dirtyConflicts.files;return t&&!n?{kind:`A`,openCurrentEnabled:!0,switchEnabled:!0,conflictingFiles:r}:!t&&!n?{kind:`B`,openCurrentEnabled:!1,switchEnabled:!0,conflictingFiles:r}:t&&n?{kind:`C`,openCurrentEnabled:!0,switchEnabled:!1,conflictingFiles:r}:{kind:`D`,openCurrentEnabled:!1,switchEnabled:!1,conflictingFiles:r}}function Wq(e){return e.detached?e.currentHeadSha:e.currentBranch??`HEAD`}function Gq(e){if(e.ok)return{action:`await-cc1`};switch(e.reason){case`dirty-conflict`:return{action:`rerender-conflict`,files:e.files??[]};case`branch-not-found`:return{action:`dismiss-with-toast`,reason:`branch-not-found`};case`fetch-failed`:case`checkout-failed`:return{action:`stay-with-toast`,reason:e.reason};case`branch-in-other-worktree`:{let t=e.otherWorktreePath;return t===void 0||t.length===0?{action:`stay-with-toast`,reason:`checkout-failed`}:{action:`pivot-to-other-worktree`,otherWorktreePath:t}}default:{let t=e.reason;throw Error(`Unhandled CheckoutFailureReason: ${String(t)}`)}}}var Kq={phase:`loading`};function qq(e,t){return e.phase===`loading`?t===null?{phase:`error`}:{phase:`ready`,info:t}:e}function Jq(e,t){return e.phase===`ready`?{phase:`switching`,info:e.info,pendingDoc:t}:e}function Yq(e,t){if(e.phase!==`switching`)return{state:e};if(t===null)return{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:`proxy-null`}};let n=Gq(t);return n.action===`await-cc1`?{state:{phase:`awaiting-cc1-recycle`,pendingDoc:e.pendingDoc}}:n.action===`rerender-conflict`?{state:{phase:`ready`,info:{...e.info,dirtyConflicts:{conflicts:!0,files:n.files.slice()}}}}:n.action===`pivot-to-other-worktree`?{state:{phase:`branch-in-other-worktree`,info:e.info,otherWorktreePath:n.otherWorktreePath,pendingDoc:e.pendingDoc}}:n.action===`dismiss-with-toast`?{state:{phase:`dismissed`,reason:n.reason},sideEffect:{kind:`toast`,reason:n.reason}}:{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:n.reason}}}function Xq(e){return e!==null&&e.kind===`project-branch-switch`}function Zq(e){let t=(0,$.c)(146),{bridge:n,store:r}=e,a=r===void 0?zf:r,{_:o}=i(),c=(0,Q.useSyncExternalStore)(a.subscribe,a.getSnapshot,rJ),[l,u]=(0,Q.useState)(Kq),d=(0,Q.useRef)(!1),f=(0,Q.useRef)(!1),m;t[0]===c?m=t[1]:(m=Xq(c)?c:null,t[0]=c,t[1]=m);let g=m,_;t[2]!==o||t[3]!==g?.share.target.kind?(_=g?.share.target.kind===`folder`?o({id:`ugoTXs`}):o({id:`XH30C4`}),t[2]=o,t[3]=g?.share.target.kind,t[4]=_):_=t[4];let v=_,y;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(y=()=>{u(Kq),d.current=!1,f.current=!1},t[5]=y):y=t[5];let b;t[6]===c?b=t[7]:(b=[c],t[6]=c,t[7]=b),(0,Q.useEffect)(y,b);let x;t[8]!==g||t[9]!==n?(x=()=>{g&&(d.current||(d.current=!0,n.project.fetchBranchInfo({projectPath:g.projectPath,branch:g.share.branch,kind:g.share.target.kind,path:p(g.share.target)}).then(e=>{u(t=>qq(t,e))}).catch(e=>{console.warn(`[receive] branch-info-fetch-failed`,e instanceof Error?e.message:e),u(nJ)})))},t[8]=g,t[9]=n,t[10]=x):x=t[10];let S;t[11]===g?S=t[12]:(S=[g],t[11]=g,t[12]=S),(0,Q.useEffect)(x,S);let C;t[13]!==o||t[14]!==g||t[15]!==l.phase||t[16]!==n||t[17]!==a||t[18]!==v?(C=()=>{if(l.phase!==`awaiting-cc1-recycle`||!g)return;let e=g.share.branch;if(!e){a.dismiss();return}if(f.current)return;f.current=!0;let t=!1;return n.project.awaitBranchSwitched({projectPath:g.projectPath,branch:e,timeoutMs:3e4}).then(r=>{if(!t){if(r.ok){console.log(wu({branch_dialog_action:`branch-switch-complete`,branch:e})),n.project.open({path:g.projectPath,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:g.share.target.kind,path:p(g.share.target)},pendingBranch:e}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=switch`,e instanceof Error?e.message:e),X.error(o({id:`gQV-9w`,values:{targetNoun:v}}))}),a.dismiss();return}console.log(wu({branch_dialog_action:`branch-switch-timeout`,branch:e})),X.error(o({id:`LBwUR6`,values:{targetNoun:v}})),a.dismiss()}}).catch(e=>{t||(console.warn(`[receive] awaitBranchSwitched rejected`,e instanceof Error?e.message:e),X.error(o({id:`Jw6EC4`,values:{targetNoun:v}})),a.dismiss())}),()=>{t=!0}},t[13]=o,t[14]=g,t[15]=l.phase,t[16]=n,t[17]=a,t[18]=v,t[19]=C):C=t[19];let w;if(t[20]!==g||t[21]!==l.phase?(w=[l.phase,g],t[20]=g,t[21]=l.phase,t[22]=w):w=t[22],(0,Q.useEffect)(C,w),!g)return null;let{share:T,projectPath:E,currentBranch:D}=g,O=T.branch,k;t[23]!==o||t[24]!==l.info||t[25]!==l.phase||t[26]!==n.project||t[27]!==E||t[28]!==T.target||t[29]!==O||t[30]!==a?(k=function(){l.phase===`ready`&&Uq(l.info).switchEnabled&&(console.log(wu({branch_dialog_action:`switch`,branch_action:`switch`,branch:O})),u(e=>Jq(e,p(T.target))),n.project.runCheckout({projectPath:E,branch:O}).then(e=>{let t=null,n=!1;u(r=>{let{state:i,sideEffect:a}=Yq(r,e);return a&&(t=a.reason,n=i.phase===`dismissed`),i}),t===`branch-not-found`?X.error(o({id:`NJyQi_`,values:{shareBranch:O}})):t===`fetch-failed`?X.error(o({id:`bWLmRK`})):(t===`checkout-failed`||t===`proxy-null`)&&X.error(o({id:`c863eW`,values:{shareBranch:O}})),n&&a.dismiss()}).catch(e=>{console.warn(`[receive] runCheckout rejected branch_action=switch`,e instanceof Error?e.message:e),u(tJ),X.error(o({id:`c863eW`,values:{shareBranch:O}}))}))},t[23]=o,t[24]=l.info,t[25]=l.phase,t[26]=n.project,t[27]=E,t[28]=T.target,t[29]=O,t[30]=a,t[31]=k):k=t[31];let A=k,j;t[32]!==o||t[33]!==n.project||t[34]!==E||t[35]!==T.target||t[36]!==O||t[37]!==a||t[38]!==v?(j=function(){console.log(wu({branch_dialog_action:`open-current`,branch:O})),n.project.open({path:E,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:T.target.kind,path:p(T.target)}}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=open-current`,e instanceof Error?e.message:e),X.error(o({id:`b5aNbi`,values:{targetNoun:v}}))}),a.dismiss()},t[32]=o,t[33]=n.project,t[34]=E,t[35]=T.target,t[36]=O,t[37]=a,t[38]=v,t[39]=j):j=t[39];let M=j,N;t[40]!==o||t[41]!==l.otherWorktreePath||t[42]!==l.phase||t[43]!==n.project||t[44]!==T.target||t[45]!==O||t[46]!==a?(N=function(){if(l.phase!==`branch-in-other-worktree`)return;let e=l.otherWorktreePath;console.log(wu({branch_dialog_action:`pivot-to-other-worktree`,branch:O})),n.project.open({path:e,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:T.target.kind,path:p(T.target)},pendingBranch:O}).catch(t=>{console.warn(`[receive] pivot-open-failed branch_action=pivot-to-other-worktree`,t instanceof Error?t.message:t),X.error(o({id:`LdABLa`,values:{target:e}}))}),a.dismiss()},t[40]=o,t[41]=l.otherWorktreePath,t[42]=l.phase,t[43]=n.project,t[44]=T.target,t[45]=O,t[46]=a,t[47]=N):N=t[47];let P=N,F;t[48]===a?F=t[49]:(F=function(){console.log(wu({branch_dialog_action:`cancel`})),a.dismiss()},t[48]=a,t[49]=F);let I=F,L,R,z,B,V,H,U,W,G,K,q,J,ee,te,ne,re,Y;if(t[50]!==o||t[51]!==l.info||t[52]!==l.otherWorktreePath||t[53]!==l.phase||t[54]!==I||t[55]!==D||t[56]!==T.branch||t[57]!==T.owner||t[58]!==T.repo||t[59]!==T.target||t[60]!==O||t[61]!==v){Y=l.phase===`ready`||l.phase===`switching`?Uq(l.info):null;let e;t[79]!==l.info||t[80]!==l.phase||t[81]!==D?(e=l.phase===`ready`||l.phase===`switching`?Wq(l.info):D??`HEAD`,t[79]=l.info,t[80]=l.phase,t[81]=D,t[82]=e):e=t[82];let n=e;H=l.phase===`switching`||l.phase===`awaiting-cc1-recycle`;let r;t[83]===o?r=t[84]:(r=o({id:`OuY8t9`}),t[83]=o,t[84]=r),B=r;let i;t[85]!==o||t[86]!==O?(i=o({id:`_BthEY`,values:{shareBranch:O}}),t[85]=o,t[86]=O,t[87]=i):i=t[87],V=i;let a=l.phase===`loading`,c=l.phase===`error`;z=ko,ne=!0,t[88]===I?re=t[89]:(re=e=>{e||I()},t[88]=I,t[89]=re),R=To,K=`sm:max-w-xl`,q=`share-branch-switch-dialog`,J=eJ,ee=$q;let u;t[90]===v?u=t[91]:(u=(0,Z.jsx)(wo,{children:(0,Z.jsx)(s,{id:`RY6Bq1`,values:{targetNoun:v}})}),t[90]=v,t[91]=u);let d=T.owner,f=T.repo,m;t[92]===T.target?m=t[93]:(m=p(T.target),t[92]=T.target,t[93]=m);let g;t[94]!==T.owner||t[95]!==T.repo||t[96]!==m?(g=(0,Z.jsx)(Co,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`f8jU-L`,values:{0:d,1:f,2:m}})}),t[94]=T.owner,t[95]=T.repo,t[96]=m,t[97]=g):g=t[97],t[98]!==u||t[99]!==g?(te=(0,Z.jsxs)(Oo,{children:[u,g]}),t[98]=u,t[99]=g,t[100]=te):te=t[100],L=Eo;let _=T.owner,y=T.repo,b;t[101]===T.target?b=t[102]:(b=p(T.target),t[101]=T.target,t[102]=b),t[103]!==T.branch||t[104]!==T.owner||t[105]!==T.repo||t[106]!==T.target.kind||t[107]!==b?(U=(0,Z.jsx)(`div`,{className:`mb-4`,children:(0,Z.jsx)(jf,{owner:_,repo:y,path:b,kind:T.target.kind,branch:T.branch,testId:`share-branch-switch-metadata`,branchTestId:`share-branch-switch-metadata-branch`})}),t[103]=T.branch,t[104]=T.owner,t[105]=T.repo,t[106]=T.target.kind,t[107]=b,t[108]=U):U=t[108],W=l.phase===`branch-in-other-worktree`?(0,Z.jsxs)(`div`,{className:`text-sm text-muted-foreground`,"data-testid":`share-branch-switch-in-other-worktree`,children:[(0,Z.jsx)(`p`,{className:`leading-6`,children:(0,Z.jsx)(s,{id:`yjExfe`,values:{shareBranch:O},components:{0:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),(0,Z.jsx)(`p`,{className:`mt-2 break-all rounded bg-muted px-2 py-1 font-mono text-xs text-foreground/80`,"data-testid":`share-branch-switch-in-other-worktree-path`,children:l.otherWorktreePath})]}):a?(0,Z.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-loading`,role:`status`,"aria-live":`polite`,children:[(0,Z.jsx)(h,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`jerqF0`})]}):c?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`w4hMYl`})}):Y?.kind===`D`?(0,Z.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,Z.jsx)(s,{id:`XnoA1k`,values:{targetNoun:v,shareBranch:O},components:{0:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):Y?.kind===`B`?(0,Z.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,Z.jsx)(s,{id:`sZ2IOu`,values:{targetNoun:v,shareBranch:O,currentLabel:n},components:{0:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,Z.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,Z.jsx)(s,{id:`_902BE`,values:{targetNoun:v,shareBranch:O,currentLabel:n},components:{0:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),G=Y&&!Y.switchEnabled&&Y.conflictingFiles.length>0?(0,Z.jsxs)(`div`,{className:`mt-3 rounded-md border border-border bg-muted/30 p-3 text-1sm`,"data-testid":`share-branch-switch-conflict`,children:[(0,Z.jsx)(`p`,{className:`font-medium text-foreground/90`,children:(0,Z.jsx)(s,{id:`n2lRue`})}),(0,Z.jsx)(`ul`,{id:`share-receive-branch-conflict-files`,className:`mt-1 list-disc space-y-0.5 pl-5 text-muted-foreground`,children:Y.conflictingFiles.map(Qq)})]}):null,t[50]=o,t[51]=l.info,t[52]=l.otherWorktreePath,t[53]=l.phase,t[54]=I,t[55]=D,t[56]=T.branch,t[57]=T.owner,t[58]=T.repo,t[59]=T.target,t[60]=O,t[61]=v,t[62]=L,t[63]=R,t[64]=z,t[65]=B,t[66]=V,t[67]=H,t[68]=U,t[69]=W,t[70]=G,t[71]=K,t[72]=q,t[73]=J,t[74]=ee,t[75]=te,t[76]=ne,t[77]=re,t[78]=Y}else L=t[62],R=t[63],z=t[64],B=t[65],V=t[66],H=t[67],U=t[68],W=t[69],G=t[70],K=t[71],q=t[72],J=t[73],ee=t[74],te=t[75],ne=t[76],re=t[77],Y=t[78];let ie;t[109]===H?ie=t[110]:(ie=H?(0,Z.jsxs)(`p`,{className:`mt-3 flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-switching`,role:`status`,"aria-live":`polite`,children:[(0,Z.jsx)(h,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`CU3AiE`})]}):null,t[109]=H,t[110]=ie);let ae;t[111]!==L||t[112]!==U||t[113]!==W||t[114]!==G||t[115]!==ie?(ae=(0,Z.jsxs)(L,{children:[U,W,G,ie]}),t[111]=L,t[112]=U,t[113]=W,t[114]=G,t[115]=ie,t[116]=ae):ae=t[116];let oe;t[117]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,Z.jsx)(s,{id:`dEgA5A`}),t[117]=oe):oe=t[117];let se;t[118]===I?se=t[119]:(se=(0,Z.jsx)(li,{variant:`ghost`,className:`font-mono uppercase`,onClick:I,"data-testid":`share-branch-switch-cancel`,children:oe}),t[118]=I,t[119]=se);let ce;t[120]!==l.phase||t[121]!==M||t[122]!==P||t[123]!==A||t[124]!==B||t[125]!==V||t[126]!==H||t[127]!==Y?(ce=l.phase===`branch-in-other-worktree`?(0,Z.jsx)(li,{onClick:P,"data-testid":`share-branch-switch-in-other-worktree-pivot`,children:(0,Z.jsx)(s,{id:`hyCxJY`})}):(0,Z.jsxs)(`div`,{className:`flex flex-col-reverse gap-2 sm:flex-row sm:gap-2`,children:[Y?.openCurrentEnabled?(0,Z.jsxs)(li,{variant:`outline`,className:`font-mono uppercase`,onClick:M,disabled:H,"data-testid":`share-branch-switch-open-current`,children:[(0,Z.jsx)(Il,{className:`size-3.5`,"aria-hidden":!0}),B]}):null,(0,Z.jsx)(li,{onClick:A,disabled:!Y?.switchEnabled||H,"aria-disabled":!Y?.switchEnabled||H,"aria-describedby":Y&&!Y.switchEnabled&&Y.conflictingFiles.length>0?`share-receive-branch-conflict-files`:void 0,"data-testid":`share-branch-switch-switch`,children:H?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(h,{className:`size-3.5 animate-spin`,"aria-hidden":`true`}),V]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ke,{className:`size-3.5`,"aria-hidden":!0}),V]})})]}),t[120]=l.phase,t[121]=M,t[122]=P,t[123]=A,t[124]=B,t[125]=V,t[126]=H,t[127]=Y,t[128]=ce):ce=t[128];let le;t[129]!==se||t[130]!==ce?(le=(0,Z.jsxs)(Do,{className:`sm:justify-between`,children:[se,ce]}),t[129]=se,t[130]=ce,t[131]=le):le=t[131];let ue;t[132]!==R||t[133]!==K||t[134]!==q||t[135]!==J||t[136]!==ee||t[137]!==te||t[138]!==ae||t[139]!==le?(ue=(0,Z.jsxs)(R,{className:K,"data-testid":q,onInteractOutside:J,onPointerDownOutside:ee,children:[te,ae,le]}),t[132]=R,t[133]=K,t[134]=q,t[135]=J,t[136]=ee,t[137]=te,t[138]=ae,t[139]=le,t[140]=ue):ue=t[140];let de;return t[141]!==z||t[142]!==ne||t[143]!==re||t[144]!==ue?(de=(0,Z.jsx)(z,{open:ne,onOpenChange:re,children:ue}),t[141]=z,t[142]=ne,t[143]=re,t[144]=ue,t[145]=de):de=t[145],de}function Qq(e){return(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{className:`text-foreground/80`,children:e})},e)}function $q(e){e.preventDefault()}function eJ(e){e.preventDefault()}function tJ(e){return Yq(e,null).state}function nJ(e){return qq(e,null)}function rJ(){return null}function iJ(){let e=(0,$.c)(17),t=wn(),{collabUrl:n,setSystemProvider:r,updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c}=ht(),l;e[0]!==o||e[1]!==s||e[2]!==a||e[3]!==c||e[4]!==i?(l={updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c},e[0]=o,e[1]=s,e[2]=a,e[3]=c,e[4]=i,e[5]=l):l=e[5];let u=(0,Q.useRef)(l),d;e[6]!==o||e[7]!==s||e[8]!==a||e[9]!==c||e[10]!==i?(d=()=>{u.current={updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c}},e[6]=o,e[7]=s,e[8]=a,e[9]=c,e[10]=i,e[11]=d):d=e[11],(0,Q.useEffect)(d);let f,p;return e[12]!==n||e[13]!==t||e[14]!==r?(f=()=>{if(n===null)return;let e=new Pe,i=new dt({url:n,name:Wr,document:e,onStateless:e=>{let{payload:t}=e;H(t,{onServerInfo:e=>{u.current.updateServerInstanceId(e.serverInstanceId),e.currentBranch!==void 0&&u.current.observeBranch(e.currentBranch)},onBranchSwitched:e=>{u.current.onBranchSwitched(e.branch)},onDiskAck:e=>{u.current.observeDiskAck(e.docName,e.sv)},onDerivedView:uJ,onConfigValidationRejected:lJ,onConfigIgnoreNestedError:cJ,onUnknown:sJ})},onClose:oJ,onDisconnect:aJ}),a=es(e=>{(e.includes(`files`)||e.includes(`backlinks`))&&(t.invalidateQueries({queryKey:[`backlinks`]}),t.invalidateQueries({queryKey:[`forward-links`]})),(e.includes(`files`)||e.includes(`graph`))&&(t.invalidateQueries({queryKey:[`orphans`]}),t.invalidateQueries({queryKey:[`hubs`]}))}),o=Zt(()=>{u.current.refreshServerInfo()});i.on(`synced`,()=>{cs([`files`,`backlinks`,`graph`]),o()});let s=new Set,c=()=>{if(i.awareness)for(let[e,t]of i.awareness.getStates().entries())s.has(e)||t.user?.type===`agent`&&(s.add(e),console.warn(`[agent-presence] observed stale AwarenessUser.type === 'agent' from clientID ${e} — probably a stale bundled client`))};return i.awareness?.on(`change`,c),r(i),()=>{a(),i.awareness?.off(`change`,c),r(null),i.destroy(),e.destroy()}},p=[t,n,r],e[12]=n,e[13]=t,e[14]=r,e[15]=f,e[16]=p):(f=e[15],p=e[16]),(0,Q.useEffect)(f,p),null}function aJ(){console.warn(`[CC1] __system__ disconnected - derived views may be stale`)}function oJ(e){let{event:t}=e;console.warn(`[CC1] __system__ connection closed:`,t.code,t.reason)}function sJ(e){console.warn(`[CC1] Unparseable stateless payload, skipping:`,e.slice(0,100))}function cJ(e){eo(e)}function lJ(e){io(e)}function uJ(e){cs([e.ch])}var dJ=`#install-claude-desktop`;function fJ(e){return e===`#settings`||e===dJ}function pJ(e,t,n){return[e,t,n].map(e=>[...e].sort().join(`\0`)).join(``)}function mJ(){let e=(0,$.c)(23),{clearTarget:t,syncOpenTabsWithKnownTargets:n,tabSessionLoaded:r}=ht(),{openTargetTransition:i}=Ot(),{assetPaths:a,folderPaths:o,loading:s,pageMeta:c,pages:l,pagesBySlug:u,pagesByBasename:d}=is(),f=(0,Q.useRef)(null),p;e[0]!==a||e[1]!==o||e[2]!==l?(p=pJ(l,o,a),e[0]=a,e[1]=o,e[2]=l,e[3]=p):p=e[3];let m=p,h,g;e[4]!==a||e[5]!==o||e[6]!==s||e[7]!==l||e[8]!==n||e[9]!==r||e[10]!==m?(h=()=>{s||!r||f.current===m||(f.current=m,n({pages:l,folderPaths:o,assetPaths:a}))},g=[a,o,s,l,n,r,m],e[4]=a,e[5]=o,e[6]=s,e[7]=l,e[8]=n,e[9]=r,e[10]=m,e[11]=h,e[12]=g):(h=e[11],g=e[12]),(0,Q.useEffect)(h,g);let _,v;return e[13]!==t||e[14]!==o||e[15]!==s||e[16]!==i||e[17]!==c||e[18]!==l||e[19]!==d||e[20]!==u?(_=()=>{e();function e(){if(fJ(window.location.hash))return;let e=Lo(window.location.hash);if(e){let t=rr(e.split(`.`).pop()??``);ue(`ok/nav/hash-change`,{docName:null,kind:`asset`}),i({kind:`asset`,target:e,assetPath:e,mediaKind:t});return}if(Go(window.location.hash)){ue(`ok/nav/hash-change`,{docName:null,kind:`folder`}),i({kind:`folder`,target:``,folderPath:``});return}let n=as(window.location.hash);if(!n){ue(`ok/nav/hash-change`,{docName:null,kind:`clear`}),t();return}if(s){ue(`ok/nav/hash-change`,{docName:n,kind:`deferred-loading`});return}let r=ns(n,{pages:l,folderPaths:o,pagesBySlug:u,pagesByBasename:d});if(r.kind===`missing`&&/\/+$/.test(n.trim())){ue(`ok/nav/hash-change`,{docName:n,kind:`deferred-missing-folder`});return}let a=ss(us(r),c);ue(`ok/nav/hash-change`,{docName:n,kind:a.kind}),i(a)}return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},v=[t,o,s,i,c,l,u,d],e[13]=t,e[14]=o,e[15]=s,e[16]=i,e[17]=c,e[18]=l,e[19]=d,e[20]=u,e[21]=_,e[22]=v):(_=e[21],v=e[22]),(0,Q.useEffect)(_,v),null}function hJ(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0],(0,Q.useEffect)(gJ,t),null}function gJ(){let e=yJ;if(!e(window.location.hash))return;let t=new AbortController;return ce(t.signal).then(n=>{if(t.signal.aborted||n.status!==`ok`)return;let r=n.config.paneTarget;r?.startsWith(`#/`)&&e(window.location.hash)&&(window.location.hash=r,fetch(`/api/config`,{method:`DELETE`}).catch(vJ))}).catch(_J),()=>t.abort()}function _J(){}function vJ(){}function yJ(e){return!fJ(e)&&!Lo(e)&&!as(e)&&(e===``||e===`#`||e===`#/`)}function bJ(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0],(0,Q.useEffect)(xJ,t),null}function xJ(){let e=function(e){let t=e.target;Cg({target:t,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,key:e.key})&&(e.preventDefault(),window.location.hash!==`#settings`&&(window.location.hash=Sg))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)}function SJ(){let e=(0,$.c)(4),{activeTarget:t}=ht(),n=typeof window<`u`?window.okDesktop??null:null,r=t?.kind===`doc`||t?.kind===`folder`||t?.kind===`asset`?t.kind:null,i=t?.kind===`doc`?t.docName:t?.kind===`folder`?t.folderPath:t?.kind===`asset`?t.assetPath:null,a,o;return e[0]!==i||e[1]!==r?(a=()=>{if(n){if(r===null){n.editor.notifyActiveTargetChanged({kind:null});return}i!==null&&n.editor.notifyActiveTargetChanged({kind:r,identifier:i})}},o=[n,r,i],e[0]=i,e[1]=r,e[2]=a,e[3]=o):(a=e[2],o=e[3]),(0,Q.useEffect)(a,o),null}function CJ(){let e=(0,$.c)(8),{activeDocName:t,activeTarget:n}=ht(),[r,i]=(0,Q.useState)(!1),a;e[0]!==t||e[1]!==n?(a=n?.kind===`folder`?n.folderPath:ms(t),e[0]=t,e[1]=n,e[2]=a):a=e[2];let o=a,s,c;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{let e=function(e){let t=e.target;Lh({target:t,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,key:e.key})&&(e.preventDefault(),i(!0))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},c=[],e[3]=s,e[4]=c):(s=e[3],c=e[4]),(0,Q.useEffect)(s,c);let l;return e[5]!==r||e[6]!==o?(l=(0,Z.jsx)(zh,{open:r,onOpenChange:i,kind:`file`,initialDir:o}),e[5]=r,e[6]=o,e[7]=l):l=e[7],l}function wJ(e){let t=(0,$.c)(3),{children:n}=e,{collabUrl:r}=ht(),i;return t[0]!==n||t[1]!==r?(i=(0,Z.jsx)(B,{collabUrl:r,children:n}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i}function TJ(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(Gt,{name:`app`,children:(0,Z.jsx)(Nt,{children:(0,Z.jsx)(wJ,{children:(0,Z.jsx)(vg,{children:(0,Z.jsx)(EJ,{})})})})}),e[0]=t):t=e[0],t}function EJ(){let e=(0,$.c)(25),t=typeof window<`u`?window.okDesktop??null:null,n=typeof window<`u`&&window.okDesktop!=null,[r,i]=(0,Q.useState)(!1),a=xg(),o;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=t?{launchInTerminal:DJ}:null,e[0]=o):o=e[0];let s=o,c;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(K_,{}),e[1]=c):c=e[1];let l,u,d,f,p;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(iJ,{}),u=(0,Z.jsx)(mJ,{}),d=(0,Z.jsx)(hJ,{}),f=(0,Z.jsx)(SJ,{}),p=(0,Z.jsx)(CJ,{}),e[2]=l,e[3]=u,e[4]=d,e[5]=f,e[6]=p):(l=e[2],u=e[3],d=e[4],f=e[5],p=e[6]);let m;e[7]===a?m=e[8]:(m=!a&&(0,Z.jsx)(bJ,{}),e[7]=a,e[8]=m);let h,g,_,v;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(_=!1,v=t?(0,Z.jsx)(q_,{bridge:t}):null,h=(0,Z.jsx)(Df,{}),g=t?(0,Z.jsx)(Zq,{bridge:t}):null,e[9]=h,e[10]=g,e[11]=_,e[12]=v):(h=e[9],g=e[10],_=e[11],v=e[12]);let y;e[13]===r?y=e[14]:(y=(0,Z.jsx)(R_,{bridge:t,open:r,onOpenChange:i}),e[13]=r,e[14]=y);let b;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(b=n&&(0,Z.jsx)(`div`,{"aria-hidden":`true`,"data-testid":`editor-window-chrome-drag-strip`,"data-electron-drag":``,className:`pointer-events-none fixed inset-x-0 top-0 z-50 h-2 [-webkit-app-region:drag]`}),e[15]=b):b=e[15];let x;e[16]===a?x=e[17]:(x=!a&&(0,Z.jsx)(Rq,{onOpenSearch:()=>i(!0)}),e[16]=a,e[17]=x);let S;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(yA,{className:`overflow-hidden h-[calc(100vh-var(--layout-inset-offset))]`,children:(0,Z.jsx)($N,{onOpenSearch:()=>i(!0)})}),e[18]=S):S=e[18];let C;e[19]===x?C=e[20]:(C=(0,Z.jsx)(Ux,{value:s,children:(0,Z.jsxs)(pA,{className:`h-screen overflow-hidden`,children:[x,S]})}),e[19]=x,e[20]=C);let w;return e[21]!==y||e[22]!==C||e[23]!==m?(w=(0,Z.jsxs)(Z.Fragment,{children:[c,(0,Z.jsxs)(ls,{children:[l,u,d,f,p,m,_,v,h,g,y,b,C]})]}),e[21]=y,e[22]=C,e[23]=m,e[24]=w):w=e[24],w}function DJ(e){ZN(d_(e))}Rc(),sp({apiOrigin:typeof window<`u`?window.okDesktop?.config.apiOrigin:void 0}),bp(),Kp()&&Qp(),Um(),sm(),typeof window<`u`&&Sp({bridge:window.okDesktop}),typeof window<`u`&&Np({bridge:window.okDesktop}),typeof window<`u`&&$s({bridge:window.okDesktop}),typeof window<`u`&&Js({bridge:window.okDesktop}),typeof window<`u`&&Tp({bridge:window.okDesktop}),typeof window<`u`&&Bf({bridge:window.okDesktop}),dm();var OJ=new qc({defaultOptions:{queries:{retry:1,staleTime:1e4}}}),kJ=document.getElementById(`root`);if(!kJ)throw Error(`Root element not found`);var AJ=typeof window<`u`&&window.okDesktop?.config.mode===`navigator`;(0,il.createRoot)(kJ).render((0,Z.jsx)(Q.StrictMode,{children:(0,Z.jsx)(a,{i18n:hs,children:(0,Z.jsx)(gn,{client:OJ,children:(0,Z.jsxs)(yr,{attribute:`class`,defaultTheme:`system`,enableSystem:!0,disableTransitionOnChange:!0,storageKey:`ok-theme-v1`,children:[(0,Z.jsx)(Fs,{children:AJ&&window.okDesktop?(0,Z.jsx)(ep,{bridge:window.okDesktop}):(0,Z.jsx)(TJ,{})}),(0,Z.jsx)(ap,{richColors:!0,closeButton:!0})]})})})}));
|