@inkeep/open-knowledge 0.0.0-dev-20260427081104 → 0.0.0-dev-20260427172649

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.
Files changed (45) hide show
  1. package/dist/assets/skills/open-knowledge/SKILL.md +27 -15
  2. package/dist/cli.mjs +9 -9
  3. package/dist/constants-BTD7ZKSR.mjs +2 -0
  4. package/dist/dist-B8mg-f6q.mjs +1 -0
  5. package/dist/{dist-B_ROt9_c.mjs → dist-D4iyaPjq.mjs} +39 -39
  6. package/dist/{dist-D8JEQ6hO.mjs → dist-mmLEboji.mjs} +20 -8
  7. package/dist/index.mjs +1 -1
  8. package/dist/init--i3qKzKM.mjs +1 -0
  9. package/dist/{init-DvF3Dl7n.mjs → init-BvzZ82y2.mjs} +5 -5
  10. package/dist/init-CZ_E019R.mjs +1 -0
  11. package/dist/{init-DZDnMUjc.mjs → init-D8ujFTpS.mjs} +2 -2
  12. package/dist/loader-CPVGB7eo.mjs +1 -0
  13. package/dist/{loader-D3fsdR1w.mjs → loader-FD-NCStn.mjs} +2 -2
  14. package/dist/paths-DpAhhXfF.mjs +1 -0
  15. package/dist/paths-O_X0xRBt.mjs +2 -0
  16. package/dist/{preview-DyLhres3.mjs → preview-Dk-UNsFY.mjs} +2 -2
  17. package/dist/preview-JkR5aTPE.mjs +1 -0
  18. package/dist/public/assets/{ActivityModeContent-BdQtVWQT.js → ActivityModeContent-Bh4C07uL.js} +1 -1
  19. package/dist/public/assets/{DocumentContext-HT-mHcLO.js → DocumentContext-D125gYAt.js} +1 -1
  20. package/dist/public/assets/{GraphPanel-BJ9MldAi.js → GraphPanel-BkWSPzhS.js} +1 -1
  21. package/dist/public/assets/McpConsentDialogBody-QKrs5-z6.js +1 -0
  22. package/dist/public/assets/{PageListContext-1COIYjHT.js → PageListContext-BeAv6YTY.js} +7 -7
  23. package/dist/public/assets/{SourceEditor-C7wAoLYw.js → SourceEditor-M-p0lLYp.js} +1 -1
  24. package/dist/public/assets/{clipboard-D6iP9LKm.js → clipboard-BmiNdq3p.js} +1 -1
  25. package/dist/public/assets/{index-ChO0_t6R.js → index-DLXD_AE1.js} +64 -64
  26. package/dist/public/assets/index-DPJk5E6v.css +1 -0
  27. package/dist/public/assets/{toggle-group-AWjaf9XJ.js → toggle-group-C2g3gOrt.js} +1 -1
  28. package/dist/public/assets/{tooltip-0l1mzBHx.js → tooltip-D180uIJr.js} +1 -1
  29. package/dist/public/index.html +7 -7
  30. package/dist/src-BBeY6WLC.mjs +1 -0
  31. package/dist/start-Bds5ijsM.mjs +1 -0
  32. package/dist/{start-C2tHtLw6.mjs → start-CkSD8obv.mjs} +2 -2
  33. package/package.json +1 -1
  34. package/dist/constants-DY5Aq0Nx.mjs +0 -2
  35. package/dist/dist-DWb2jtNM.mjs +0 -1
  36. package/dist/init-CHB65M2f.mjs +0 -1
  37. package/dist/init-CXOhIFdP.mjs +0 -1
  38. package/dist/loader-ByLuMfzl.mjs +0 -1
  39. package/dist/paths-C6Cx7bux.mjs +0 -1
  40. package/dist/paths-CHt5HnJR.mjs +0 -2
  41. package/dist/preview-BE3bGa0b.mjs +0 -1
  42. package/dist/public/assets/McpConsentDialogBody-BY1JLPsB.js +0 -1
  43. package/dist/public/assets/index-UjCvBlfb.css +0 -1
  44. package/dist/src-BiR06L9a.mjs +0 -1
  45. package/dist/start-BF4fn4HY.mjs +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./telemetry-impl-D8K_lJGH.js","./chunk-DECur_0Z.js","./propagation-api-Bugyj7xy.js","./GraphPanel-BJ9MldAi.js","./PageListContext-1COIYjHT.js","./compiler-runtime-Y11fyRVL.js","./w3c-keyname-CSlwavrd.js","./tooltip-0l1mzBHx.js","./button-B1XQHQcX.js","./toggle-group-AWjaf9XJ.js","./panel-rtdrPcLu.js","./ActivityModeContent-BdQtVWQT.js","./DocumentContext-HT-mHcLO.js","./dialog-xzAlDsHy.js","./agent-presence-BQu9C0ej.js","./SourceEditor-C7wAoLYw.js","./clipboard-D6iP9LKm.js","./dist-D2wwoXzm.js","./dist-CgLbXgrr.js","./dist-GlH2KPqY.js"])))=>i.map(i=>d[i]);
2
- import{r as e,t}from"./chunk-DECur_0Z.js";import{d as n}from"./propagation-api-Bugyj7xy.js";import{n as r,r as i,t as a}from"./compiler-runtime-Y11fyRVL.js";import{A as o,C as s,D as c,E as l,M as u,O as d,S as f,T as p,_ as m,a as h,b as g,c as _,d as v,f as y,g as b,h as x,i as S,j as C,k as w,l as T,m as E,n as D,o as O,p as k,r as A,s as j,t as M,u as N,v as P,w as F,x as I,y as ee}from"./panel-rtdrPcLu.js";import{S as L,_ as R,a as z,b as B,c as V,f as H,g as te,h as ne,i as re,m as U,n as W,o as G,p as ie,r as ae,s as oe,t as K,u as q,v as se,x as J,y as ce}from"./button-B1XQHQcX.js";import{a as le,c as ue,d as de,f as fe,i as pe,l as me,n as he,o as ge,p as _e,r as ve,s as ye,t as be,u as xe}from"./agent-presence-BQu9C0ej.js";import{a as Se,c as Ce,d as we,f as Te,i as Ee,l as De,n as Oe,o as ke,r as Ae,s as je,t as Me,u as Ne}from"./toggle-group-AWjaf9XJ.js";import{A as Pe,B as Fe,C as Ie,H as Le,I as Re,L as ze,M as Be,P as Ve,R as He,S as Ue,_t as We,a as Ge,at as Ke,b as qe,c as Je,ct as Ye,d as Xe,dt as Ze,et as Qe,f as $e,ft as et,gt as tt,ht as nt,i as rt,it,j as at,k as ot,l as st,lt as ct,mt as lt,n as ut,nt as dt,o as ft,ot as pt,p as mt,pt as ht,r as gt,rt as _t,s as vt,st as yt,t as bt,tt as xt,u as St,ut as Ct,v as wt,vt as Tt,w as Et,x as Dt,y as Ot,z as kt}from"./DocumentContext-HT-mHcLO.js";import{C as At,S as jt,_ as Mt,a as Nt,b as Pt,c as Ft,d as It,f as Lt,g as Rt,h as zt,i as Bt,l as Vt,m as Ht,n as Ut,o as Wt,p as Gt,r as Kt,s as qt,t as Jt,u as Yt,v as Xt,w as Zt,x as Qt,y as $t}from"./dialog-xzAlDsHy.js";import{a as en,c as tn,i as nn,l as rn,n as an,o as on,r as sn,s as cn,t as ln,u as un}from"./tooltip-0l1mzBHx.js";import{A as dn,At as fn,Bt as pn,D as mn,F as hn,G as gn,Gt as _n,Ht as vn,I as yn,Jt as bn,O as xn,Q as Sn,R as Cn,St as wn,U as Tn,Ut as En,V as Dn,Vt as On,Wt as kn,Yt as An,Z as jn,_ as Mn,c as Nn,dt as Pn,i as Fn,it as In,jt as Ln,k as Rn,kt as zn,l as Bn,n as Vn,ot as Hn,qt as Un,r as Wn,rt as Gn,s as Kn,st as qn,t as Jn,u as Yn,ut as Xn,vt as Zn,w as Qn,wt as $n,x as er,yt as tr,z as nr,zt as rr}from"./PageListContext-1COIYjHT.js";import{a as ir,d as ar,i as or,l as sr,n as cr,o as lr,r as ur,s as dr,u as fr,y as pr}from"./clipboard-D6iP9LKm.js";import{At as mr,C as hr,Dt as gr,Et as _r,F as vr,Ft as yr,Nt as br,O as xr,Pt as Sr,Q as Cr,St as wr,X as Tr,Y as Er,Z as Dr,it as Or,jt as kr,kt as Ar,q as jr,wt as Mr,yt as Nr}from"./dist-CgLbXgrr.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 Pr(){({BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1})?.VITE_OTEL_ENABLED===`true`&&n(()=>import(`./telemetry-impl-D8K_lJGH.js`).then(e=>e.install()),__vite__mapDeps([0,1,2]),import.meta.url)}function Fr(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=>{P(e,()=>t.signal,()=>n=!0)},u=I(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?g:ee;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?Lr:Ir,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:Ir(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 Ir(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 Lr(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var Rr=class extends E{#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||zr(),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=x({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),m.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function zr(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Br=class extends u{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 Rr({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=Vr(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=Vr(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=Vr(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=Vr(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){m.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=>p(t,e))}findAll(e={}){return this.getAll().filter(t=>p(e,t))}notify(e){m.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return m.batch(()=>Promise.all(e.map(e=>e.continue().catch(c))))}};function Vr(e){return e.options.scope?.id}var Hr=class extends u{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??F(r,t),a=this.get(i);return a||(a=new k({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(){m.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=>l(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>l(e,t)):t}notify(e){m.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){m.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){m.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Ur=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Hr,this.#t=e.mutationCache||new Br,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=C.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=b.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(w(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=f(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return m.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;m.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return m.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=m.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(c).catch(c)}invalidateQueries(e,t={}){return m.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=m.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(c)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(c)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(w(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(c).catch(c)}fetchInfiniteQuery(e){return e.behavior=Fr(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(c).catch(c)}ensureInfiniteQueryData(e){return e.behavior=Fr(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return b.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(s(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{d(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(s(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{d(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||=F(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===o&&(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()}},Wr=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}}}})),Gr=t(((e,t)=>{t.exports=Wr()})),Kr=t((e=>{var t=Gr(),n=r(),i=L();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},ee=[],R=-1;function z(e){return{current:e}}function B(e){0>R||(e.current=ee[R],ee[R]=null,R--)}function V(e,t){R++,ee[R]=e.current,e.current=t}var H=z(null),te=z(null),ne=z(null),re=z(null);function U(e,t){switch(V(ne,t),V(te,e),V(H,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Ud(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Ud(t),e=Wd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}B(H),V(H,e)}function W(){B(H),B(te),B(ne)}function G(e){e.memoizedState!==null&&V(re,e);var t=H.current,n=Wd(t,e.type);t!==n&&(V(te,e),V(H,n))}function ie(e){te.current===e&&(B(H),B(te)),re.current===e&&(B(re),ep._currentValue=I)}var ae,oe;function K(e){if(ae===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ae=t&&t[1]||``,oe=-1<e.stack.indexOf(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./telemetry-impl-D8K_lJGH.js","./chunk-DECur_0Z.js","./propagation-api-Bugyj7xy.js","./GraphPanel-BkWSPzhS.js","./PageListContext-BeAv6YTY.js","./compiler-runtime-Y11fyRVL.js","./w3c-keyname-CSlwavrd.js","./tooltip-D180uIJr.js","./button-B1XQHQcX.js","./toggle-group-C2g3gOrt.js","./panel-rtdrPcLu.js","./ActivityModeContent-Bh4C07uL.js","./DocumentContext-D125gYAt.js","./dialog-xzAlDsHy.js","./agent-presence-BQu9C0ej.js","./SourceEditor-M-p0lLYp.js","./clipboard-BmiNdq3p.js","./dist-D2wwoXzm.js","./dist-CgLbXgrr.js","./dist-GlH2KPqY.js"])))=>i.map(i=>d[i]);
2
+ import{r as e,t}from"./chunk-DECur_0Z.js";import{d as n}from"./propagation-api-Bugyj7xy.js";import{n as r,r as i,t as a}from"./compiler-runtime-Y11fyRVL.js";import{A as o,C as s,D as c,E as l,M as u,O as d,S as f,T as p,_ as m,a as h,b as g,c as _,d as v,f as y,g as b,h as x,i as S,j as C,k as w,l as T,m as E,n as D,o as O,p as k,r as A,s as j,t as M,u as N,v as P,w as F,x as I,y as ee}from"./panel-rtdrPcLu.js";import{S as L,_ as R,a as z,b as B,c as V,f as H,g as te,h as ne,i as re,m as U,n as W,o as G,p as ie,r as ae,s as oe,t as K,u as q,v as se,x as J,y as ce}from"./button-B1XQHQcX.js";import{a as le,c as ue,d as de,f as fe,i as pe,l as me,n as he,o as ge,p as _e,r as ve,s as ye,t as be,u as xe}from"./agent-presence-BQu9C0ej.js";import{a as Se,c as Ce,d as we,f as Te,i as Ee,l as De,n as Oe,o as ke,r as Ae,s as je,t as Me,u as Ne}from"./toggle-group-C2g3gOrt.js";import{A as Pe,B as Fe,C as Ie,H as Le,I as Re,L as ze,M as Be,P as Ve,R as He,S as Ue,_t as We,a as Ge,at as Ke,b as qe,c as Je,ct as Ye,d as Xe,dt as Ze,et as Qe,f as $e,ft as et,gt as tt,ht as nt,i as rt,it,j as at,k as ot,l as st,lt as ct,mt as lt,n as ut,nt as dt,o as ft,ot as pt,p as mt,pt as ht,r as gt,rt as _t,s as vt,st as yt,t as bt,tt as xt,u as St,ut as Ct,v as wt,vt as Tt,w as Et,x as Dt,y as Ot,z as kt}from"./DocumentContext-D125gYAt.js";import{C as At,S as jt,_ as Mt,a as Nt,b as Pt,c as Ft,d as It,f as Lt,g as Rt,h as zt,i as Bt,l as Vt,m as Ht,n as Ut,o as Wt,p as Gt,r as Kt,s as qt,t as Jt,u as Yt,v as Xt,w as Zt,x as Qt,y as $t}from"./dialog-xzAlDsHy.js";import{a as en,c as tn,i as nn,l as rn,n as an,o as on,r as sn,s as cn,t as ln,u as un}from"./tooltip-D180uIJr.js";import{A as dn,At as fn,Bt as pn,D as mn,F as hn,G as gn,Gt as _n,Ht as vn,I as yn,Jt as bn,O as xn,Q as Sn,R as Cn,St as wn,U as Tn,Ut as En,V as Dn,Vt as On,Wt as kn,Yt as An,Z as jn,_ as Mn,c as Nn,dt as Pn,i as Fn,it as In,jt as Ln,k as Rn,kt as zn,l as Bn,n as Vn,ot as Hn,qt as Un,r as Wn,rt as Gn,s as Kn,st as qn,t as Jn,u as Yn,ut as Xn,vt as Zn,w as Qn,wt as $n,x as er,yt as tr,z as nr,zt as rr}from"./PageListContext-BeAv6YTY.js";import{a as ir,d as ar,i as or,l as sr,n as cr,o as lr,r as ur,s as dr,u as fr,y as pr}from"./clipboard-BmiNdq3p.js";import{At as mr,C as hr,Dt as gr,Et as _r,F as vr,Ft as yr,Nt as br,O as xr,Pt as Sr,Q as Cr,St as wr,X as Tr,Y as Er,Z as Dr,it as Or,jt as kr,kt as Ar,q as jr,wt as Mr,yt as Nr}from"./dist-CgLbXgrr.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 Pr(){({BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1})?.VITE_OTEL_ENABLED===`true`&&n(()=>import(`./telemetry-impl-D8K_lJGH.js`).then(e=>e.install()),__vite__mapDeps([0,1,2]),import.meta.url)}function Fr(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=>{P(e,()=>t.signal,()=>n=!0)},u=I(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?g:ee;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?Lr:Ir,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:Ir(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 Ir(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 Lr(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var Rr=class extends E{#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||zr(),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=x({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),m.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function zr(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Br=class extends u{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 Rr({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=Vr(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=Vr(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=Vr(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=Vr(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){m.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=>p(t,e))}findAll(e={}){return this.getAll().filter(t=>p(e,t))}notify(e){m.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return m.batch(()=>Promise.all(e.map(e=>e.continue().catch(c))))}};function Vr(e){return e.options.scope?.id}var Hr=class extends u{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??F(r,t),a=this.get(i);return a||(a=new k({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(){m.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=>l(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>l(e,t)):t}notify(e){m.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){m.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){m.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Ur=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Hr,this.#t=e.mutationCache||new Br,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=C.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=b.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(w(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=f(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return m.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;m.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return m.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=m.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(c).catch(c)}invalidateQueries(e,t={}){return m.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=m.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(c)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(c)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(w(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(c).catch(c)}fetchInfiniteQuery(e){return e.behavior=Fr(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(c).catch(c)}ensureInfiniteQueryData(e){return e.behavior=Fr(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return b.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(s(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{d(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(s(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{d(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||=F(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===o&&(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()}},Wr=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}}}})),Gr=t(((e,t)=>{t.exports=Wr()})),Kr=t((e=>{var t=Gr(),n=r(),i=L();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},ee=[],R=-1;function z(e){return{current:e}}function B(e){0>R||(e.current=ee[R],ee[R]=null,R--)}function V(e,t){R++,ee[R]=e.current,e.current=t}var H=z(null),te=z(null),ne=z(null),re=z(null);function U(e,t){switch(V(ne,t),V(te,e),V(H,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Ud(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Ud(t),e=Wd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}B(H),V(H,e)}function W(){B(H),B(te),B(ne)}function G(e){e.memoizedState!==null&&V(re,e);var t=H.current,n=Wd(t,e.type);t!==n&&(V(te,e),V(H,n))}function ie(e){te.current===e&&(B(H),B(te)),re.current===e&&(B(re),ep._currentValue=I)}var ae,oe;function K(e){if(ae===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ae=t&&t[1]||``,oe=-1<e.stack.indexOf(`
3
3
  at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
4
4
  `+ae+e+oe}var q=!1;function se(e,t){if(!e||q)return``;q=!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(`
5
5
  `),l=s.split(`
@@ -13,14 +13,14 @@ You can add a description to the \`${Ia}\` by passing a \`${Ua}\` component as a
13
13
 
14
14
  Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${Ia}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
15
15
 
16
- For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return X.useEffect(()=>{document.getElementById(e.current?.getAttribute(`aria-describedby`))||console.warn(t)},[t,e]),null},Xa=ka,Za=ja,Qa=Na,$a=Fa,eo=Ba,to=Ka,no=Ja,ro=Ha,io=Wa;function ao(e){let t=X.useRef({value:e,previous:e});return X.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var oo=[`Enter`,` `],so=[`ArrowDown`,`PageUp`,`Home`],co=[`ArrowUp`,`PageDown`,`End`],lo=[...so,...co],uo={ltr:[...oo,`ArrowRight`],rtl:[...oo,`ArrowLeft`]},fo={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},po=`Menu`,[mo,ho,go]=Ce(po),[_o,vo]=H(po,[go,rn,ke]),yo=rn(),bo=ke(),[xo,So]=_o(po),[Co,wo]=_o(po),To=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=yo(t),[c,l]=X.useState(null),u=X.useRef(!1),d=z(a),f=je(i);return X.useEffect(()=>{let e=()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>u.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),(0,Y.jsx)(tn,{...s,children:(0,Y.jsx)(xo,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,Y.jsx)(Co,{scope:t,onClose:X.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};To.displayName=po;var Eo=`MenuAnchor`,Do=X.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=yo(n);return(0,Y.jsx)(en,{...i,...r,ref:t})});Do.displayName=Eo;var Oo=`MenuPortal`,[ko,Ao]=_o(Oo,{forceMount:void 0}),jo=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=So(Oo,t);return(0,Y.jsx)(ko,{scope:t,forceMount:n,children:(0,Y.jsx)(oe,{present:n||a.open,children:(0,Y.jsx)(ae,{asChild:!0,container:i,children:r})})})};jo.displayName=Oo;var Mo=`MenuContent`,[No,Po]=_o(Mo),Fo=X.forwardRef((e,t)=>{let n=Ao(Mo,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=So(Mo,e.__scopeMenu),o=wo(Mo,e.__scopeMenu);return(0,Y.jsx)(mo.Provider,{scope:e.__scopeMenu,children:(0,Y.jsx)(oe,{present:r||a.open,children:(0,Y.jsx)(mo.Slot,{scope:e.__scopeMenu,children:o.modal?(0,Y.jsx)(Io,{...i,ref:t}):(0,Y.jsx)(Lo,{...i,ref:t})})})})}),Io=X.forwardRef((e,t)=>{let n=So(Mo,e.__scopeMenu),r=X.useRef(null),i=ce(t,r);return X.useEffect(()=>{let e=r.current;if(e)return Xt(e)},[]),(0,Y.jsx)(zo,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:q(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Lo=X.forwardRef((e,t)=>{let n=So(Mo,e.__scopeMenu);return(0,Y.jsx)(zo,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Ro=te(`MenuContent.ScrollLock`),zo=X.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...h}=e,g=So(Mo,n),_=wo(Mo,n),v=yo(n),y=bo(n),b=ho(n),[x,S]=X.useState(null),C=X.useRef(null),w=ce(t,C,g.onContentChange),T=X.useRef(0),E=X.useRef(``),D=X.useRef(0),O=X.useRef(null),k=X.useRef(`right`),A=X.useRef(0),j=m?$t:X.Fragment,M=m?{as:Ro,allowPinchZoom:!0}:void 0,N=e=>{let t=E.current+e,n=b().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=Cs(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){E.current=t,window.clearTimeout(T.current),t!==``&&(T.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};X.useEffect(()=>()=>window.clearTimeout(T.current),[]),Pt();let P=X.useCallback(e=>k.current===O.current?.side&&Ts(e,O.current?.area),[]);return(0,Y.jsx)(No,{scope:n,searchRef:E,onItemEnter:X.useCallback(e=>{P(e)&&e.preventDefault()},[P]),onItemLeave:X.useCallback(e=>{P(e)||(C.current?.focus(),S(null))},[P]),onTriggerLeave:X.useCallback(e=>{P(e)&&e.preventDefault()},[P]),pointerGraceTimerRef:D,onPointerGraceIntentChange:X.useCallback(e=>{O.current=e},[]),children:(0,Y.jsx)(j,{...M,children:(0,Y.jsx)(Qt,{asChild:!0,trapped:i,onMountAutoFocus:q(a,e=>{e.preventDefault(),C.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,Y.jsx)(re,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,Y.jsx)(Se,{asChild:!0,...y,dir:_.dir,orientation:`vertical`,loop:r,currentTabStopId:x,onCurrentTabStopIdChange:S,onEntryFocus:q(c,e=>{_.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,Y.jsx)(cn,{role:`menu`,"aria-orientation":`vertical`,"data-state":vs(g.open),"data-radix-menu-content":``,dir:_.dir,...v,...h,ref:w,style:{outline:`none`,...h.style},onKeyDown:q(h.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&N(e.key));let i=C.current;if(e.target!==i||!lo.includes(e.key))return;e.preventDefault();let a=b().filter(e=>!e.disabled).map(e=>e.ref.current);co.includes(e.key)&&a.reverse(),xs(a)}),onBlur:q(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(T.current),E.current=``)}),onPointerMove:q(e.onPointerMove,Es(e=>{let t=e.target,n=A.current!==e.clientX;e.currentTarget.contains(t)&&n&&(k.current=e.clientX>A.current?`right`:`left`,A.current=e.clientX)}))})})})})})})});Fo.displayName=Mo;var Bo=`MenuGroup`,Vo=X.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,Y.jsx)(ie.div,{role:`group`,...r,ref:t})});Vo.displayName=Bo;var Ho=`MenuLabel`,Uo=X.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,Y.jsx)(ie.div,{...r,ref:t})});Uo.displayName=Ho;var Wo=`MenuItem`,Go=`menu.itemSelect`,Ko=X.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=X.useRef(null),o=wo(Wo,e.__scopeMenu),s=Po(Wo,e.__scopeMenu),c=ce(t,a),l=X.useRef(!1),u=()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(Go,{bubbles:!0,cancelable:!0});e.addEventListener(Go,e=>r?.(e),{once:!0}),U(e,t),t.defaultPrevented?l.current=!1:o.onClose()}};return(0,Y.jsx)(qo,{...i,ref:c,disabled:n,onClick:q(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:q(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:q(e.onKeyDown,e=>{let t=s.searchRef.current!==``;n||t&&e.key===` `||oo.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});Ko.displayName=Wo;var qo=X.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=Po(Wo,n),s=bo(n),c=X.useRef(null),l=ce(t,c),[u,d]=X.useState(!1),[f,p]=X.useState(``);return X.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,Y.jsx)(mo.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,Y.jsx)(Ee,{asChild:!0,...s,focusable:!r,children:(0,Y.jsx)(ie.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:q(e.onPointerMove,Es(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:q(e.onPointerLeave,Es(e=>o.onItemLeave(e))),onFocus:q(e.onFocus,()=>d(!0)),onBlur:q(e.onBlur,()=>d(!1))})})})}),Jo=`MenuCheckboxItem`,Yo=X.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,Y.jsx)(rs,{scope:e.__scopeMenu,checked:n,children:(0,Y.jsx)(Ko,{role:`menuitemcheckbox`,"aria-checked":ys(n)?`mixed`:n,...i,ref:t,"data-state":bs(n),onSelect:q(i.onSelect,()=>r?.(ys(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Yo.displayName=Jo;var Xo=`MenuRadioGroup`,[Zo,Qo]=_o(Xo,{value:void 0,onValueChange:()=>{}}),$o=X.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=z(r);return(0,Y.jsx)(Zo,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,Y.jsx)(Vo,{...i,ref:t})})});$o.displayName=Xo;var es=`MenuRadioItem`,ts=X.forwardRef((e,t)=>{let{value:n,...r}=e,i=Qo(es,e.__scopeMenu),a=n===i.value;return(0,Y.jsx)(rs,{scope:e.__scopeMenu,checked:a,children:(0,Y.jsx)(Ko,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":bs(a),onSelect:q(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});ts.displayName=es;var ns=`MenuItemIndicator`,[rs,is]=_o(ns,{checked:!1}),as=X.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=is(ns,n);return(0,Y.jsx)(oe,{present:r||ys(a.checked)||a.checked===!0,children:(0,Y.jsx)(ie.span,{...i,ref:t,"data-state":bs(a.checked)})})});as.displayName=ns;var os=`MenuSeparator`,ss=X.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,Y.jsx)(ie.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});ss.displayName=os;var cs=`MenuArrow`,ls=X.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=yo(n);return(0,Y.jsx)(on,{...i,...r,ref:t})});ls.displayName=cs;var us=`MenuSub`,[ds,fs]=_o(us),ps=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=So(us,t),o=yo(t),[s,c]=X.useState(null),[l,u]=X.useState(null),d=z(i);return X.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,Y.jsx)(tn,{...o,children:(0,Y.jsx)(xo,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,Y.jsx)(ds,{scope:t,contentId:G(),triggerId:G(),trigger:s,onTriggerChange:c,children:n})})})};ps.displayName=us;var ms=`MenuSubTrigger`,hs=X.forwardRef((e,t)=>{let n=So(ms,e.__scopeMenu),r=wo(ms,e.__scopeMenu),i=fs(ms,e.__scopeMenu),a=Po(ms,e.__scopeMenu),o=X.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:c}=a,l={__scopeMenu:e.__scopeMenu},u=X.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return X.useEffect(()=>u,[u]),X.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),c(null)}},[s,c]),(0,Y.jsx)(Do,{asChild:!0,...l,children:(0,Y.jsx)(qo,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":i.contentId,"data-state":vs(n.open),...e,ref:se(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:q(e.onPointerMove,Es(t=>{a.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:q(e.onPointerLeave,Es(e=>{u();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,o=i?-5:5,c=t[i?`left`:`right`],l=t[i?`right`:`left`];a.onPointerGraceIntentChange({area:[{x:e.clientX+o,y:e.clientY},{x:c,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:c,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:q(e.onKeyDown,t=>{let i=a.searchRef.current!==``;e.disabled||i&&t.key===` `||uo[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});hs.displayName=ms;var gs=`MenuSubContent`,_s=X.forwardRef((e,t)=>{let n=Ao(Mo,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=So(Mo,e.__scopeMenu),o=wo(Mo,e.__scopeMenu),s=fs(gs,e.__scopeMenu),c=X.useRef(null),l=ce(t,c);return(0,Y.jsx)(mo.Provider,{scope:e.__scopeMenu,children:(0,Y.jsx)(oe,{present:r||a.open,children:(0,Y.jsx)(mo.Slot,{scope:e.__scopeMenu,children:(0,Y.jsx)(zo,{id:s.contentId,"aria-labelledby":s.triggerId,...i,ref:l,align:`start`,side:o.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{o.isUsingKeyboardRef.current&&c.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:q(e.onFocusOutside,e=>{e.target!==s.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:q(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:q(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=fo[o.dir].includes(e.key);t&&n&&(a.onOpenChange(!1),s.trigger?.focus(),e.preventDefault())})})})})})});_s.displayName=gs;function vs(e){return e?`open`:`closed`}function ys(e){return e===`indeterminate`}function bs(e){return ys(e)?`indeterminate`:e?`checked`:`unchecked`}function xs(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function Ss(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function Cs(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=Ss(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function ws(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function Ts(e,t){return t?ws({x:e.clientX,y:e.clientY},t):!1}function Es(e){return t=>t.pointerType===`mouse`?e(t):void 0}var Ds=To,Os=Do,ks=jo,As=Fo,js=Vo,Ms=Uo,Ns=Ko,Ps=Yo,Fs=$o,Is=ts,Ls=as,Rs=ss,zs=ls,Bs=ps,Vs=hs,Hs=_s,Us=`DropdownMenu`,[Ws,Gs]=H(Us,[vo]),Ks=vo(),[qs,Js]=Ws(Us),Ys=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=Ks(t),l=X.useRef(null),[u,d]=V({prop:i,defaultProp:a??!1,onChange:o,caller:Us});return(0,Y.jsx)(qs,{scope:t,triggerId:G(),triggerRef:l,contentId:G(),open:u,onOpenChange:d,onOpenToggle:X.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,Y.jsx)(Ds,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};Ys.displayName=Us;var Xs=`DropdownMenuTrigger`,Zs=X.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=Js(Xs,n),o=Ks(n);return(0,Y.jsx)(Os,{asChild:!0,...o,children:(0,Y.jsx)(ie.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:se(t,a.triggerRef),onPointerDown:q(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:q(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});Zs.displayName=Xs;var Qs=`DropdownMenuPortal`,$s=e=>{let{__scopeDropdownMenu:t,...n}=e,r=Ks(t);return(0,Y.jsx)(ks,{...r,...n})};$s.displayName=Qs;var ec=`DropdownMenuContent`,tc=X.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Js(ec,n),a=Ks(n),o=X.useRef(!1);return(0,Y.jsx)(As,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:q(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:q(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});tc.displayName=ec;var nc=`DropdownMenuGroup`,rc=X.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Ks(n);return(0,Y.jsx)(js,{...i,...r,ref:t})});rc.displayName=nc;var ic=`DropdownMenuLabel`,ac=X.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Ks(n);return(0,Y.jsx)(Ms,{...i,...r,ref:t})});ac.displayName=ic;var oc=`DropdownMenuItem`,sc=X.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Ks(n);return(0,Y.jsx)(Ns,{...i,...r,ref:t})});sc.displayName=oc;var cc=`DropdownMenuCheckboxItem`,lc=X.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Ks(n);return(0,Y.jsx)(Ps,{...i,...r,ref:t})});lc.displayName=cc;var uc=`DropdownMenuRadioGroup`,dc=X.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Ks(n);return(0,Y.jsx)(Fs,{...i,...r,ref:t})});dc.displayName=uc;var fc=`DropdownMenuRadioItem`,pc=X.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Ks(n);return(0,Y.jsx)(Is,{...i,...r,ref:t})});pc.displayName=fc;var mc=`DropdownMenuItemIndicator`,hc=X.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Ks(n);return(0,Y.jsx)(Ls,{...i,...r,ref:t})});hc.displayName=mc;var gc=`DropdownMenuSeparator`,_c=X.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Ks(n);return(0,Y.jsx)(Rs,{...i,...r,ref:t})});_c.displayName=gc;var vc=`DropdownMenuArrow`,yc=X.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Ks(n);return(0,Y.jsx)(zs,{...i,...r,ref:t})});yc.displayName=vc;var bc=e=>{let{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:i,defaultOpen:a}=e,o=Ks(t),[s,c]=V({prop:r,defaultProp:a??!1,onChange:i,caller:`DropdownMenuSub`});return(0,Y.jsx)(Bs,{...o,open:s,onOpenChange:c,children:n})},xc=`DropdownMenuSubTrigger`,Sc=X.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Ks(n);return(0,Y.jsx)(Vs,{...i,...r,ref:t})});Sc.displayName=xc;var Cc=`DropdownMenuSubContent`,wc=X.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Ks(n);return(0,Y.jsx)(Hs,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});wc.displayName=Cc;var Tc=Ys,Ec=Zs,Dc=$s,Oc=tc,kc=ac,Ac=sc,jc=dc,Mc=pc,Nc=hc,Pc=_c,Fc=bc,Ic=Sc,Lc=wc,Rc=`Popover`,[zc,Bc]=H(Rc,[rn]),Vc=rn(),[Hc,Uc]=zc(Rc),Wc=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=Vc(t),c=X.useRef(null),[l,u]=X.useState(!1),[d,f]=V({prop:r,defaultProp:i??!1,onChange:a,caller:Rc});return(0,Y.jsx)(tn,{...s,children:(0,Y.jsx)(Hc,{scope:t,contentId:G(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:X.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:X.useCallback(()=>u(!0),[]),onCustomAnchorRemove:X.useCallback(()=>u(!1),[]),modal:o,children:n})})};Wc.displayName=Rc;var Gc=`PopoverAnchor`,Kc=X.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Uc(Gc,n),a=Vc(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return X.useEffect(()=>(o(),()=>s()),[o,s]),(0,Y.jsx)(en,{...a,...r,ref:t})});Kc.displayName=Gc;var qc=`PopoverTrigger`,Jc=X.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Uc(qc,n),a=Vc(n),o=ce(t,i.triggerRef),s=(0,Y.jsx)(ie.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":ll(i.open),...r,ref:o,onClick:q(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,Y.jsx)(en,{asChild:!0,...a,children:s})});Jc.displayName=qc;var Yc=`PopoverPortal`,[Xc,Zc]=zc(Yc,{forceMount:void 0}),Qc=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=Uc(Yc,t);return(0,Y.jsx)(Xc,{scope:t,forceMount:n,children:(0,Y.jsx)(oe,{present:n||a.open,children:(0,Y.jsx)(ae,{asChild:!0,container:i,children:r})})})};Qc.displayName=Yc;var $c=`PopoverContent`,el=X.forwardRef((e,t)=>{let n=Zc($c,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=Uc($c,e.__scopePopover);return(0,Y.jsx)(oe,{present:r||a.open,children:a.modal?(0,Y.jsx)(nl,{...i,ref:t}):(0,Y.jsx)(rl,{...i,ref:t})})});el.displayName=$c;var tl=te(`PopoverContent.RemoveScroll`),nl=X.forwardRef((e,t)=>{let n=Uc($c,e.__scopePopover),r=X.useRef(null),i=ce(t,r),a=X.useRef(!1);return X.useEffect(()=>{let e=r.current;if(e)return Xt(e)},[]),(0,Y.jsx)($t,{as:tl,allowPinchZoom:!0,children:(0,Y.jsx)(il,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:q(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:q(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;a.current=t.button===2||n},{checkForDefaultPrevented:!1}),onFocusOutside:q(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),rl=X.forwardRef((e,t)=>{let n=Uc($c,e.__scopePopover),r=X.useRef(!1),i=X.useRef(!1);return(0,Y.jsx)(il,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),il=X.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=Uc($c,n),p=Vc(n);return Pt(),(0,Y.jsx)(Qt,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,Y.jsx)(re,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),children:(0,Y.jsx)(cn,{"data-state":ll(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})}),al=`PopoverClose`,ol=X.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Uc(al,n);return(0,Y.jsx)(ie.button,{type:`button`,...r,ref:t,onClick:q(e.onClick,()=>i.onOpenChange(!1))})});ol.displayName=al;var sl=`PopoverArrow`,cl=X.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Vc(n);return(0,Y.jsx)(on,{...i,...r,ref:t})});cl.displayName=sl;function ll(e){return e?`open`:`closed`}var ul=Wc,dl=Jc,fl=Qc,pl=el,ml=`Separator`,hl=`horizontal`,gl=[`horizontal`,`vertical`],_l=X.forwardRef((e,t)=>{let{decorative:n,orientation:r=hl,...i}=e,a=vl(r)?r:hl,o=n?{role:`none`}:{"aria-orientation":a===`vertical`?a:void 0,role:`separator`};return(0,Y.jsx)(ie.div,{"data-orientation":a,...o,...i,ref:t})});_l.displayName=ml;function vl(e){return gl.includes(e)}var yl=_l,bl=`Switch`,[xl,Sl]=H(bl),[Cl,wl]=xl(bl),Tl=X.forwardRef((e,t)=>{let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c=`on`,onCheckedChange:l,form:u,...d}=e,[f,p]=X.useState(null),m=ce(t,e=>p(e)),h=X.useRef(!1),g=f?u||!!f.closest(`form`):!0,[_,v]=V({prop:i,defaultProp:a??!1,onChange:l,caller:bl});return(0,Y.jsxs)(Cl,{scope:n,checked:_,disabled:s,children:[(0,Y.jsx)(ie.button,{type:`button`,role:`switch`,"aria-checked":_,"aria-required":o,"data-state":Al(_),"data-disabled":s?``:void 0,disabled:s,value:c,...d,ref:m,onClick:q(e.onClick,e=>{v(e=>!e),g&&(h.current=e.isPropagationStopped(),h.current||e.stopPropagation())})}),g&&(0,Y.jsx)(kl,{control:f,bubbles:!h.current,name:r,value:c,checked:_,required:o,disabled:s,form:u,style:{transform:`translateX(-100%)`}})]})});Tl.displayName=bl;var El=`SwitchThumb`,Dl=X.forwardRef((e,t)=>{let{__scopeSwitch:n,...r}=e,i=wl(El,n);return(0,Y.jsx)(ie.span,{"data-state":Al(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})});Dl.displayName=El;var Ol=`SwitchBubbleInput`,kl=X.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...i},a)=>{let o=X.useRef(null),s=ce(o,a),c=ao(n),l=un(t);return X.useEffect(()=>{let e=o.current;if(!e)return;let t=window.HTMLInputElement.prototype,i=Object.getOwnPropertyDescriptor(t,`checked`).set;if(c!==n&&i){let t=new Event(`click`,{bubbles:r});i.call(e,n),e.dispatchEvent(t)}},[c,n,r]),(0,Y.jsx)(`input`,{type:`checkbox`,"aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:s,style:{...i.style,...l,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0}})});kl.displayName=Ol;function Al(e){return e?`checked`:`unchecked`}var jl=Tl,Ml=Dl;function Nl(e){let t=new Set;for(let n of e)n.detected&&t.add(n.id);return t}function Pl(e,t){let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n}function Fl(e,t){let n=[];for(let r of t)e.has(r.id)&&n.push(r.id);return n}var Il={error:e=>At.error(e)};function Ll(e){let t=(0,Z.c)(9),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{store:r,toast:i,payload:a}=n,o=r===void 0?Ca:r,s=i===void 0?Il:i,c;t[2]!==a||t[3]!==o?(c=a??o.getSnapshot(),t[2]=a,t[3]=o,t[4]=c):c=t[4];let l=c;if(!l)return null;let u;return t[5]!==l||t[6]!==o||t[7]!==s?(u=(0,Y.jsx)(Rl,{payload:l,store:o,toast:s}),t[5]=l,t[6]=o,t[7]=s,t[8]=u):u=t[8],u}function Rl(e){let t=(0,Z.c)(44),{payload:n,store:r,toast:i}=e,a=n.detectedEditors,o;t[0]===a?o=t[1]:(o=()=>Nl(a),t[0]=a,t[1]=o);let[s,c]=(0,X.useState)(o),[l,u]=(0,X.useState)(!1),d;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=function(e){c(t=>Pl(t,e))},t[2]=d):d=t[2];let f=d,p;t[3]!==a||t[4]!==s||t[5]!==r||t[6]!==i?(p=async function(){u(!0);let e=await r.confirm(Fl(s,a));e.ok||(i.error(e.error),u(!1))},t[3]=a,t[4]=s,t[5]=r,t[6]=i,t[7]=p):p=t[7];let m=p,h;t[8]!==r||t[9]!==i?(h=async function(){u(!0);let e=await r.skip();e.ok||(i.error(e.error),u(!1))},t[8]=r,t[9]=i,t[10]=h):h=t[10];let g=h,_;t[11]!==l||t[12]!==g?(_=function(e){!e&&!l&&g()},t[11]=l,t[12]=g,t[13]=_):_=t[13];let v=_,y;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Y.jsxs)(Wt,{children:[(0,Y.jsx)(qt,{children:`Add Open Knowledge to your AI tools`}),(0,Y.jsx)(Bt,{children:`Connect Open Knowledge to your AI tools so they can read and write your notes. Once added, asking Claude to summarize or update a page works without copy-paste. Detected editors are preselected — you can toggle any row.`})]}),t[14]=y):y=t[14];let b;if(t[15]!==l||t[16]!==a||t[17]!==s){let e;t[19]!==l||t[20]!==s?(e=e=>{let t=s.has(e.id),n=e.willReplace?`Will replace existing Open Knowledge entry`:e.detected?`Detected on this machine`:`Not detected`,r=e.willReplace?`text-xs text-amber-600 dark:text-amber-400`:`text-xs text-muted-foreground`;return(0,Y.jsx)(`li`,{children:(0,Y.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2.5 px-3 py-2.5 text-sm hover:bg-accent`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:t,disabled:l,onChange:()=>f(e.id),className:`size-4 shrink-0 rounded accent-primary`,"data-testid":`mcp-consent-checkbox-${e.id}`}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-foreground`,children:e.label}),(0,Y.jsx)(`span`,{className:r,"data-testid":`mcp-consent-status-${e.id}`,children:n})]})]})},e.id)},t[19]=l,t[20]=s,t[21]=e):e=t[21],b=a.map(e),t[15]=l,t[16]=a,t[17]=s,t[18]=b}else b=t[18];let x;t[22]===b?x=t[23]:(x=(0,Y.jsx)(`ul`,{className:`max-h-72 overflow-y-auto rounded-md border border-border bg-card/50 divide-y divide-border`,children:b}),t[22]=b,t[23]=x);let S;t[24]===g?S=t[25]:(S=()=>void g(),t[24]=g,t[25]=S);let C;t[26]!==l||t[27]!==S?(C=(0,Y.jsx)(K,{variant:`outline`,className:`font-mono uppercase`,onClick:S,disabled:l,"data-testid":`mcp-consent-skip`,children:`Skip`}),t[26]=l,t[27]=S,t[28]=C):C=t[28];let w;t[29]===m?w=t[30]:(w=()=>void m(),t[29]=m,t[30]=w);let T=l||s.size===0,E=l?`Working...`:`Add`,D;t[31]!==w||t[32]!==T||t[33]!==E?(D=(0,Y.jsx)(K,{onClick:w,disabled:T,"data-testid":`mcp-consent-add`,children:E}),t[31]=w,t[32]=T,t[33]=E,t[34]=D):D=t[34];let O;t[35]!==C||t[36]!==D?(O=(0,Y.jsxs)(Nt,{children:[C,D]}),t[35]=C,t[36]=D,t[37]=O):O=t[37];let k;t[38]!==O||t[39]!==x?(k=(0,Y.jsxs)(Kt,{className:`sm:max-w-md`,children:[y,x,O]}),t[38]=O,t[39]=x,t[40]=k):k=t[40];let A;return t[41]!==v||t[42]!==k?(A=(0,Y.jsx)(Jt,{open:!0,onOpenChange:v,children:k}),t[41]=v,t[42]=k,t[43]=A):A=t[43],A}var zl=(0,X.lazy)(()=>n(()=>import(`./McpConsentDialogBody-BY1JLPsB.js`),[],import.meta.url));function Bl(){let e=(0,Z.c)(1);if(!(0,X.useSyncExternalStore)(Ca.subscribe,Hl,Vl))return null;let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Y.jsx)(X.Suspense,{fallback:null,children:(0,Y.jsx)(zl,{})}),e[0]=t):t=e[0],t}function Vl(){return!1}function Hl(){return Ca.getSnapshot()!==null}var Ul=B(`group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3! font-mono uppercase`,{variants:{variant:{default:`bg-primary text-primary-foreground [a]:hover:bg-primary/80`,secondary:`bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80`,warning:`bg-yellow-500/10 text-yellow-600 [a]:hover:bg-yellow-500/20`,destructive:`bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20`,outline:`border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground`,ghost:`hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50`,link:`text-primary underline-offset-4 hover:underline`,dashed:`border-dashed border-border text-muted-foreground rounded-sm`}},defaultVariants:{variant:`default`}});function Wl(e){let t=(0,Z.c)(13),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,variant:i,asChild:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?`default`:i,s=a!==void 0&&a?ne:`span`,c;t[5]!==n||t[6]!==o?(c=W(Ul({variant:o}),n),t[5]=n,t[6]=o,t[7]=c):c=t[7];let l;return t[8]!==s||t[9]!==r||t[10]!==c||t[11]!==o?(l=(0,Y.jsx)(s,{"data-slot":`badge`,"data-variant":o,className:c,...r}),t[8]=s,t[9]=r,t[10]=c,t[11]=o,t[12]=l):l=t[12],l}var Gl=(e,t,n)=>va(e,t,n,`NavigatorApp`);function Kl(e){let t=(0,Z.c)(41),{bridge:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=[],t[0]=r):r=t[0];let[i,a]=(0,X.useState)(r),[o,s]=(0,X.useState)(!0),[c,l]=(0,X.useState)(null),u;t[1]===n.project?u=t[2]:(u=()=>{let e=!1;return n.project.listRecent().then(t=>{e||a(t)}).catch(t=>{console.error(`[NavigatorApp] listRecent failed:`,t),e||l(t instanceof Error?t.message:`Failed to load recent projects.`)}).finally(()=>{e||s(!1)}),()=>{e=!0}},t[1]=n.project,t[2]=u);let d;t[3]===n?d=t[4]:(d=[n],t[3]=n,t[4]=d),(0,X.useEffect)(u,d);let f;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(f=(e,t)=>Gl(e,t,l),t[5]=f):f=t[5];let p=f,m;t[6]===n?m=t[7]:(m=()=>p(async()=>{let e=await n.dialog.openFolder();e&&await Yl(n,e)},`Failed to clone from GitHub.`),t[6]=n,t[7]=m);let h=m,g;t[8]===n?g=t[9]:(g=()=>p(async()=>{let e=await n.dialog.openFolder();e&&await Yl(n,e)},`Failed to open folder.`),t[8]=n,t[9]=g);let _=g,v;t[10]===n?v=t[11]:(v=()=>p(async()=>{let e=await n.dialog.createFolder();e&&await Yl(n,e)},`Failed to create project folder.`),t[10]=n,t[11]=v);let y=v,b;t[12]===n?b=t[13]:(b=e=>p(async()=>{await Yl(n,e)},`Failed to open project.`),t[12]=n,t[13]=b);let x=b,S=`flex h-screen w-screen flex-col overflow-hidden bg-primary-foreground dark:bg-background p-12 pb-2 text-foreground max-w-5xl space-y-10 mx-auto ${!o&&i.length===0?`justify-center`:``}`,C;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Y.jsx)(xa,{className:`size-12 shrink-0`}),t[14]=C):C=t[14];let w;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Y.jsx)(`h1`,{className:`font-medium text-xl tracking-tight`,children:`Open Knowledge`}),t[15]=w):w=t[15];let T;t[16]===n.appVersion?T=t[17]:(T=(0,Y.jsxs)(`header`,{className:`shrink-0 flex-wrap flex items-center gap-2.5`,children:[C,(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[w,(0,Y.jsxs)(`p`,{className:`text-muted-foreground text-xs font-mono`,children:[`v`,n.appVersion]})]})]}),t[16]=n.appVersion,t[17]=T);let E;t[18]===h?E=t[19]:(E=(0,Y.jsx)(ql,{title:`Clone from GitHub`,description:`Bring a remote repository onto this machine.`,onClick:h,dataTestId:`nav-clone`,Icon:ba}),t[18]=h,t[19]=E);let D;t[20]===_?D=t[21]:(D=(0,Y.jsx)(ql,{title:`Open folder on disk`,description:`Open an existing folder as a project.`,onClick:_,dataTestId:`nav-open`,Icon:nt}),t[20]=_,t[21]=D);let O;t[22]===y?O=t[23]:(O=(0,Y.jsx)(ql,{title:`Start fresh`,description:`Create a new folder for a brand-new project.`,onClick:y,dataTestId:`nav-fresh`,Icon:Zi}),t[22]=y,t[23]=O);let k;t[24]!==E||t[25]!==D||t[26]!==O?(k=(0,Y.jsxs)(`section`,{className:`grid shrink-0 sm:grid-cols-3 gap-3`,children:[E,D,O]}),t[24]=E,t[25]=D,t[26]=O,t[27]=k):k=t[27];let A;t[28]===c?A=t[29]:(A=c===null?null:(0,Y.jsxs)(`div`,{className:`mb-3 flex shrink-0 items-start justify-between gap-3 rounded-md border border-red-500/30 bg-red-500/10 px-3 py-2`,"data-testid":`nav-error-banner`,role:`alert`,children:[(0,Y.jsx)(`span`,{className:`text-red-700 text-xs dark:text-red-300`,children:c}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>l(null),className:`text-red-700 text-xs underline hover:no-underline dark:text-red-300`,"data-testid":`nav-error-dismiss`,children:`Dismiss`})]}),t[28]=c,t[29]=A);let j;t[30]!==o||t[31]!==x||t[32]!==i?(j=o?(0,Y.jsx)(`section`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,Y.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,Y.jsx)(Ye,{className:`size-4 animate-spin text-muted-foreground/60`})})}):i.length>0?(0,Y.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,Y.jsx)(`h2`,{className:`mb-2 shrink-0 font-medium text-muted-foreground font-mono text-xs uppercase tracking-wide`,children:`Recent`}),(0,Y.jsx)(`ul`,{className:`min-h-0 flex-1 subtle-scrollbar overflow-y-auto space-y-0.5 -mx-4`,"data-testid":`nav-recent-list`,children:i.map(e=>(0,Y.jsx)(Jl,{project:e,onOpen:()=>x(e.path)},e.path))})]}):null,t[30]=o,t[31]=x,t[32]=i,t[33]=j):j=t[33];let M;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Y.jsx)(Bl,{}),t[34]=M):M=t[34];let N;return t[35]!==T||t[36]!==k||t[37]!==A||t[38]!==j||t[39]!==S?(N=(0,Y.jsxs)(`div`,{className:S,children:[T,k,A,j,M]}),t[35]=T,t[36]=k,t[37]=A,t[38]=j,t[39]=S,t[40]=N):N=t[40],N}function ql(e){let t=(0,Z.c)(14),{title:n,description:r,onClick:i,dataTestId:a,Icon:o}=e,s;t[0]===o?s=t[1]:(s=o?(0,Y.jsx)(o,{className:`size-4 shrink-0 text-muted-foreground`}):null,t[0]=o,t[1]=s);let c;t[2]===n?c=t[3]:(c=(0,Y.jsx)(`span`,{className:`font-medium text-gray-700 dark:text-foreground text-sm`,children:n}),t[2]=n,t[3]=c);let l;t[4]!==s||t[5]!==c?(l=(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[s,c]}),t[4]=s,t[5]=c,t[6]=l):l=t[6];let u;t[7]===r?u=t[8]:(u=(0,Y.jsx)(`span`,{className:`text-muted-foreground text-xs leading-snug`,children:r}),t[7]=r,t[8]=u);let d;return t[9]!==a||t[10]!==i||t[11]!==l||t[12]!==u?(d=(0,Y.jsxs)(`button`,{type:`button`,onClick:i,"data-testid":a,className:`flex flex-col items-start gap-1.5 rounded-lg border border-border bg-card py-3.5 px-4 text-left transition-colors hover:bg-accent`,children:[l,u]}),t[9]=a,t[10]=i,t[11]=l,t[12]=u,t[13]=d):d=t[13],d}function Jl(e){let t=(0,Z.c)(17),{project:n,onOpen:r}=e,i=`flex items-center justify-between ${n.missing?`opacity-50`:``}`,a;t[0]===n.name?a=t[1]:(a=(0,Y.jsx)(`span`,{className:`font-medium text-sm text-gray-700 dark:text-foreground`,children:n.name}),t[0]=n.name,t[1]=a);let o;t[2]===n.path?o=t[3]:(o=(0,Y.jsx)(`span`,{className:`truncate w-full text-muted-foreground text-xs`,children:n.path}),t[2]=n.path,t[3]=o);let s;t[4]!==a||t[5]!==o?(s=(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1 truncate`,children:[a,o]}),t[4]=a,t[5]=o,t[6]=s):s=t[6];let c;t[7]===n.missing?c=t[8]:(c=n.missing?(0,Y.jsx)(Wl,{className:`text-2xs rounded-sm`,variant:`warning`,children:`Missing`}):null,t[7]=n.missing,t[8]=c);let l;t[9]!==r||t[10]!==n.missing||t[11]!==s||t[12]!==c?(l=(0,Y.jsxs)(`button`,{type:`button`,onClick:r,disabled:n.missing,className:`flex min-w-0 flex-1 items-center text-left disabled:cursor-not-allowed py-3.5 px-4 hover:bg-accent rounded-lg gap-2 justify-between`,children:[s,c]}),t[9]=r,t[10]=n.missing,t[11]=s,t[12]=c,t[13]=l):l=t[13];let u;return t[14]!==i||t[15]!==l?(u=(0,Y.jsx)(`li`,{className:i,children:l}),t[14]=i,t[15]=l,t[16]=u):u=t[16],u}async function Yl(e,t){await e.project.open({path:t,target:`new-window`})}var Xl=e=>{let t=(0,Z.c)(8),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let{theme:r}=T(),i=r===void 0?`system`:r,a,o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a={success:(0,Y.jsx)(we,{className:`size-4`}),info:(0,Y.jsx)(Pi,{className:`size-4`}),warning:(0,Y.jsx)(De,{className:`size-4`}),error:(0,Y.jsx)(Wi,{className:`size-4`}),loading:(0,Y.jsx)(Ye,{className:`size-4 animate-spin`})},o={"--normal-bg":`var(--popover)`,"--normal-text":`var(--popover-foreground)`,"--normal-border":`var(--border)`,"--border-radius":`var(--radius)`},t[2]=a,t[3]=o):(a=t[2],o=t[3]);let s;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(s={classNames:{toast:`cn-toast`}},t[4]=s):s=t[4];let c;return t[5]!==n||t[6]!==i?(c=(0,Y.jsx)(jt,{theme:i,className:`toaster group`,icons:a,style:o,toastOptions:s,...n}),t[5]=n,t[6]=i,t[7]=c):c=t[7],c};function Zl(e){let{apiOrigin:t}=e;if(!t)return;let n=Symbol.for(`ok.desktop.fetchRewrite`);if(window.fetch[n])return;let r=window.fetch.bind(window),i=((e,n)=>{if(typeof e==`string`)return r(Ql(e,t),n);if(e instanceof URL)return e.pathname.startsWith(`/api/`)&&(e.origin===window.location.origin||e.protocol===`file:`)?r(t+(e.pathname+e.search+e.hash),n):r(e,n);try{let i=new URL(e.url,window.location.origin);if(i.pathname.startsWith(`/api/`)){let a=i.pathname+i.search+i.hash;return r(new Request(t+a,e),n)}}catch{}return r(e,n)});i[n]=!0,window.fetch=i}function Ql(e,t){return e.startsWith(`/api/`)?t+e:e}function $l(e){return`#/${encodeURIComponent(e)}`}function eu(e){let t=e.bridge;if(!t)return;let n=e.setHash??(e=>{window.location.hash=e});return t.onDeepLink(e=>{n($l(e.doc))})}function tu(e){let t=e.bridge;if(!t)return;let n=e.toastImpl??(e=>At.info(e));return t.onGitInitNotice(e=>{n(`Initialized git repo at ${e.gitDir}`)})}var nu=`Update ready`,ru=`Relaunch`,iu=`Release notes`,au=`Updates paused`,ou=`Download`,su=`Relaunch failed — please restart manually`;function cu(e){return`Updated to v${e}`}var lu=0,uu=1,du=2,fu=3;function pu(e,t,n=()=>{}){let r=[];return r.push(e.onUpdateDownloaded(({version:r})=>{let i=`update-downloaded-${r}`;t({id:i,body:nu,priority:du,action:{label:ru,onClick:()=>{e.update.relaunchNow().then(()=>{n(i)},()=>{t({id:`relaunch-error-${r}`,body:su,variant:`error`,priority:uu})})}}})})),r.push(e.onWhatsNew(({version:n,releaseUrl:r})=>{t({id:`whats-new-${n}`,body:cu(n),priority:fu,action:{label:iu,onClick:()=>{e.shell.openExternal(r)}}})})),r.push(e.onUpdateStuckHint(({downloadUrl:n})=>{t({id:`update-stuck-hint`,body:au,priority:lu,action:{label:ou,onClick:()=>{e.shell.openExternal(n)}}})})),()=>{for(let e of r)e()}}var mu=[],hu=new Set,gu=!1;function _u(){for(let e of hu)e()}function vu(e){let t=mu.findIndex(t=>t.id===e.id);if(t===-1)mu=[...mu,e];else{let n=mu.slice();n[t]=e,mu=n}_u()}function yu(e){let t=mu.filter(t=>t.id!==e);t.length!==mu.length&&(mu=t,_u())}function bu(){return mu}function xu(e){return hu.add(e),()=>{hu.delete(e)}}function Su(){if(gu||typeof window>`u`)return;let e=window.okDesktop;e&&(gu=!0,pu(e,vu,yu))}var Cu=1,wu=.9,Tu=.8,Eu=.17,Du=.1,Ou=.999,ku=.9999,Au=.99,ju=/[\\\/_+.#"@\[\(\{&]/,Mu=/[\\\/_+.#"@\[\(\{&]/g,Nu=/[\s-]/,Pu=/[\s-]/g;function Fu(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?Cu:Au;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=Fu(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=Cu:ju.test(e.charAt(l-1))?(d*=Tu,p=e.slice(i,l-1).match(Mu),p&&i>0&&(d*=Ou**+p.length)):Nu.test(e.charAt(l-1))?(d*=wu,m=e.slice(i,l-1).match(Pu),m&&i>0&&(d*=Ou**+m.length)):(d*=Eu,i>0&&(d*=Ou**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=ku)),(d<Du&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=Fu(e,t,n,r,l+1,a+2,o),f*Du>d&&(d=f*Du)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function Iu(e){return e.toLowerCase().replace(Pu,` `)}function Lu(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,Fu(e,t,Iu(e),Iu(t),0,0,{})}var Ru=`[cmdk-group=""]`,zu=`[cmdk-group-items=""]`,Bu=`[cmdk-group-heading=""]`,Vu=`[cmdk-item=""]`,Hu=`${Vu}:not([aria-disabled="true"])`,Uu=`cmdk-item-select`,Wu=`data-value`,Gu=(e,t,n)=>Lu(e,t,n),Ku=X.createContext(void 0),qu=()=>X.useContext(Ku),Ju=X.createContext(void 0),Yu=()=>X.useContext(Ju),Xu=X.createContext(void 0),Zu=X.forwardRef((e,t)=>{let n=dd(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=dd(()=>new Set),i=dd(()=>new Map),a=dd(()=>new Map),o=dd(()=>new Set),s=ld(e),{label:c,children:l,value:u,onValueChange:d,filter:f,shouldFilter:p,loop:m,disablePointerSelection:h=!1,vimBindings:g=!0,..._}=e,v=G(),y=G(),b=G(),x=X.useRef(null),S=md();ud(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,C.emit()}},[u]),ud(()=>{S(6,k)},[]);let C=X.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)O(),E(),S(1,D);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(b);e?e.focus():(i=document.getElementById(v))==null||i.focus()}if(S(7,()=>{n.current.selectedItemId=A()?.id,C.emit()}),r||S(5,k),s.current?.value!==void 0){let e=t??``;(o=(a=s.current).onValueChange)==null||o.call(a,e);return}}C.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),w=X.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,T(t,r)),S(2,()=>{E(),C.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),S(3,()=>{O(),E(),n.current.value||D(),C.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=A();S(4,()=>{O(),t?.getAttribute(`id`)===e&&D(),C.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>s.current.shouldFilter,label:c||e[`aria-label`],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:v,inputId:b,labelId:y,listInnerRef:x}),[]);function T(e,t){let r=s.current?.filter??Gu;return e?r(e,n.current.search,t):0}function E(){if(!n.current.search||s.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=x.current;j().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(zu);t?t.appendChild(e.parentElement===t?e:e.closest(`${zu} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${zu} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=x.current?.querySelector(`${Ru}[${Wu}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function D(){let e=j().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(Wu);C.setState(`value`,e||void 0)}function O(){if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=T(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function k(){var e;let t=A();t&&(t.parentElement?.firstChild===t&&((e=t.closest(Ru)?.querySelector(Bu))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function A(){return x.current?.querySelector(`${Vu}[aria-selected="true"]`)}function j(){return Array.from(x.current?.querySelectorAll(Hu)||[])}function M(e){let t=j()[e];t&&C.setState(`value`,t.getAttribute(Wu))}function N(e){var t;let n=A(),r=j(),i=r.findIndex(e=>e===n),a=r[i+e];(t=s.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&C.setState(`value`,a.getAttribute(Wu))}function P(e){let t=A()?.closest(Ru),n;for(;t&&!n;)t=e>0?sd(t,Ru):cd(t,Ru),n=t?.querySelector(Hu);n?C.setState(`value`,n.getAttribute(Wu)):N(e)}let F=()=>M(j().length-1),I=e=>{e.preventDefault(),e.metaKey?F():e.altKey?P(1):N(1)},ee=e=>{e.preventDefault(),e.metaKey?M(0):e.altKey?P(-1):N(-1)};return X.createElement(ie.div,{ref:t,tabIndex:-1,..._,"cmdk-root":``,onKeyDown:e=>{var t;(t=_.onKeyDown)==null||t.call(_,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:g&&e.ctrlKey&&I(e);break;case`ArrowDown`:I(e);break;case`p`:case`k`:g&&e.ctrlKey&&ee(e);break;case`ArrowUp`:ee(e);break;case`Home`:e.preventDefault(),M(0);break;case`End`:e.preventDefault(),F();break;case`Enter`:{e.preventDefault();let t=A();if(t){let e=new Event(Uu);t.dispatchEvent(e)}}}}},X.createElement(`label`,{"cmdk-label":``,htmlFor:w.inputId,id:w.labelId,style:_d},c),gd(e,e=>X.createElement(Ju.Provider,{value:C},X.createElement(Ku.Provider,{value:w},e))))}),Qu=X.forwardRef((e,t)=>{let n=G(),r=X.useRef(null),i=X.useContext(Xu),a=qu(),o=ld(e),s=o.current?.forceMount??i?.forceMount;ud(()=>{if(!s)return a.item(n,i?.id)},[s]);let c=pd(n,r,[e.value,e.children,r],e.keywords),l=Yu(),u=fd(e=>e.value&&e.value===c.current),d=fd(e=>s||a.filter()===!1?!0:e.search?e.filtered.items.get(n)>0:!0);X.useEffect(()=>{let t=r.current;if(!(!t||e.disabled))return t.addEventListener(Uu,f),()=>t.removeEventListener(Uu,f)},[d,e.onSelect,e.disabled]);function f(){var e,t;p(),(t=(e=o.current).onSelect)==null||t.call(e,c.current)}function p(){l.setState(`value`,c.current,!0)}if(!d)return null;let{disabled:m,value:h,onSelect:g,forceMount:_,keywords:v,...y}=e;return X.createElement(ie.div,{ref:se(r,t),...y,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!m,"aria-selected":!!u,"data-disabled":!!m,"data-selected":!!u,onPointerMove:m||a.getDisablePointerSelection()?void 0:p,onClick:m?void 0:f},e.children)}),$u=X.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=G(),s=X.useRef(null),c=X.useRef(null),l=G(),u=qu(),d=fd(e=>i||u.filter()===!1?!0:e.search?e.filtered.groups.has(o):!0);ud(()=>u.group(o),[]),pd(o,s,[e.value,e.heading,c]);let f=X.useMemo(()=>({id:o,forceMount:i}),[i]);return X.createElement(ie.div,{ref:se(s,t),...a,"cmdk-group":``,role:`presentation`,hidden:d?void 0:!0},n&&X.createElement(`div`,{ref:c,"cmdk-group-heading":``,"aria-hidden":!0,id:l},n),gd(e,e=>X.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?l:void 0},X.createElement(Xu.Provider,{value:f},e))))}),ed=X.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=X.useRef(null),a=fd(e=>!e.search);return!n&&!a?null:X.createElement(ie.div,{ref:se(i,t),...r,"cmdk-separator":``,role:`separator`})}),td=X.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=Yu(),o=fd(e=>e.search),s=fd(e=>e.selectedItemId),c=qu();return X.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),X.createElement(ie.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),nd=X.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=X.useRef(null),o=X.useRef(null),s=fd(e=>e.selectedItemId),c=qu();return X.useEffect(()=>{if(o.current&&a.current){let e=o.current,t=a.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),X.createElement(ie.div,{ref:se(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},gd(e,e=>X.createElement(`div`,{ref:se(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),rd=X.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return X.createElement(Gt,{open:n,onOpenChange:r},X.createElement(Lt,{container:o},X.createElement(It,{"cmdk-overlay":``,className:i}),X.createElement(Vt,{"aria-label":e.label,"cmdk-dialog":``,className:a},X.createElement(Zu,{ref:t,...s}))))}),id=X.forwardRef((e,t)=>fd(e=>e.filtered.count===0)?X.createElement(ie.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),ad=X.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return X.createElement(ie.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},gd(e,e=>X.createElement(`div`,{"aria-hidden":!0},e)))}),od=Object.assign(Zu,{List:nd,Item:Qu,Input:td,Group:$u,Separator:ed,Dialog:rd,Empty:id,Loading:ad});function sd(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function cd(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function ld(e){let t=X.useRef(e);return ud(()=>{t.current=e}),t}var ud=typeof window>`u`?X.useEffect:X.useLayoutEffect;function dd(e){let t=X.useRef();return t.current===void 0&&(t.current=e()),t}function fd(e){let t=Yu(),n=()=>e(t.snapshot());return X.useSyncExternalStore(t.subscribe,n,n)}function pd(e,t,n,r=[]){let i=X.useRef(),a=qu();return ud(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(Wu,s),i.current=s}),i}var md=()=>{let[e,t]=X.useState(),n=dd(()=>new Map);return ud(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function hd(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function gd({asChild:e,children:t},n){return e&&X.isValidElement(t)?X.cloneElement(hd(t),{ref:t.ref},n(t.props.children)):n(t)}var _d={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`};function vd(e){let t=(0,Z.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=W(`flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Y.jsx)(od,{"data-slot":`command`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function yd(e){let t=(0,Z.c)(26),n,r,i,a,o,s;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6]):({title:a,description:o,children:n,className:r,showCloseButton:s,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s);let c=a===void 0?`Command Palette`:a,l=o===void 0?`Search for a command to run…`:o,u=s===void 0?!0:s,d;t[7]===c?d=t[8]:(d=(0,Y.jsx)(qt,{children:c}),t[7]=c,t[8]=d);let f;t[9]===l?f=t[10]:(f=(0,Y.jsx)(Bt,{children:l}),t[9]=l,t[10]=f);let p;t[11]!==d||t[12]!==f?(p=(0,Y.jsxs)(Wt,{className:`sr-only`,children:[d,f]}),t[11]=d,t[12]=f,t[13]=p):p=t[13];let m;t[14]===r?m=t[15]:(m=W(`overflow-hidden p-0`,r),t[14]=r,t[15]=m);let h;t[16]===n?h=t[17]:(h=(0,Y.jsx)(vd,{className:`[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5`,children:n}),t[16]=n,t[17]=h);let g;t[18]!==u||t[19]!==m||t[20]!==h?(g=(0,Y.jsx)(Kt,{className:m,showCloseButton:u,children:h}),t[18]=u,t[19]=m,t[20]=h,t[21]=g):g=t[21];let _;return t[22]!==i||t[23]!==p||t[24]!==g?(_=(0,Y.jsxs)(Jt,{...i,children:[p,g]}),t[22]=i,t[23]=p,t[24]=g,t[25]=_):_=t[25],_}function bd(e){let t=(0,Z.c)(9),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]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Y.jsx)(ra,{className:`size-4 shrink-0 opacity-50`}),t[3]=i):i=t[3];let a;t[4]===n?a=t[5]:(a=W(`flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50`,n),t[4]=n,t[5]=a);let o;return t[6]!==r||t[7]!==a?(o=(0,Y.jsxs)(`div`,{"data-slot":`command-input-wrapper`,className:`flex h-9 items-center gap-2 border-b px-3`,children:[i,(0,Y.jsx)(od.Input,{"data-slot":`command-input`,className:a,...r})]}),t[6]=r,t[7]=a,t[8]=o):o=t[8],o}function xd(e){let t=(0,Z.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=W(`max-h-[300px] scroll-py-1 overflow-y-auto overflow-x-hidden`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Y.jsx)(od.List,{"data-slot":`command-list`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Sd(e){let t=(0,Z.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Y.jsx)(od.Empty,{"data-slot":`command-empty`,className:`py-6 text-center text-sm`,...e}),t[0]=e,t[1]=n),n}function Cd(e){let t=(0,Z.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=W(`overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group-heading]]:text-xs`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Y.jsx)(od.Group,{"data-slot":`command-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function wd(e){let t=(0,Z.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=W(`-mx-1 h-px bg-border`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Y.jsx)(od.Separator,{"data-slot":`command-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Td(e){let t=(0,Z.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=W(`relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none data-disabled:pointer-events-none data-disabled:opacity-50 data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 [&_svg:not([class*='text-'])]:text-muted-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Y.jsx)(od.Item,{"data-slot":`command-item`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Ed(e){let t=(0,Z.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=W(`ml-auto text-muted-foreground text-xs tracking-widest`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Y.jsx)(`span`,{"data-slot":`command-shortcut`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var Dd=`Switch Project…`,Od=[{id:`claude-cowork`,displayName:`Claude Cowork`,appBrandName:`Claude Desktop`,schemes:[`claude:`],installUrl:`https://claude.com/download`,hasWebFallback:!0},{id:`claude-code`,displayName:`Claude Code`,appBrandName:`Claude Desktop`,schemes:[`claude:`],installUrl:`https://claude.com/download`,hasWebFallback:!0},{id:`codex`,displayName:`Codex`,appBrandName:`Codex Desktop`,schemes:[`codex:`],installUrl:`https://openai.com/codex`},{id:`cursor`,displayName:`Cursor`,schemes:[`cursor:`],installUrl:`https://cursor.com/`}];function kd(){let e=(0,Z.c)(3),[t,n]=(0,X.useState)(Md),r,i;return e[0]===t?(r=e[1],i=e[2]):(r=()=>{if(t!==null||typeof window>`u`||window.okDesktop)return;let e=!0;return fetch(`/api/workspace`).then(async t=>{let r=await t.json().catch(jd);e&&t.ok&&r?.ok&&typeof r.contentDir==`string`&&(r.pathSeparator===`/`||r.pathSeparator===`\\`)&&n({contentDir:r.contentDir,pathSeparator:r.pathSeparator})}).catch(Ad),()=>{e=!1}},i=[t],e[0]=t,e[1]=r,e[2]=i),(0,X.useEffect)(r,i),t}function Ad(e){console.warn(`[useWorkspace] /api/workspace fetch failed:`,e)}function jd(){return null}function Md(){return Nd()}function Nd(e=typeof window>`u`?void 0:window){if(!e)return null;let t=e.okDesktop;return t?{contentDir:t.config.projectPath,pathSeparator:t.platform===`win32`?`\\`:`/`}:null}async function Pd(e,t={}){let n=t.okDesktop??(typeof window<`u`?window.okDesktop:void 0);if(n?.shell?.openExternal)try{return await n.shell.openExternal(e),{ok:!0}}catch(e){return{ok:!1,reason:`dispatch-error`,detail:Fd(e)}}let r=t.doc??(typeof document<`u`?document:void 0);if(!r)return{ok:!1,reason:`dispatch-error`,detail:`no DOM available`};try{let t=r.createElement(`a`);return t.href=e,t.rel=`noopener noreferrer`,/^https?:/i.test(e)&&(t.target=`_blank`),r.body.appendChild(t),t.click(),t.remove(),{ok:!0}}catch(e){return{ok:!1,reason:`dispatch-error`,detail:Fd(e)}}}function Fd(e){if(e instanceof Error)return e.message;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}var Id=1e3,Ld=1500;function Rd(e){return new Promise(t=>setTimeout(t,e))}async function zd(e,t={}){let n=t.spawnCursor??(typeof window<`u`?window.okDesktop?.shell.spawnCursor:void 0);if(!n)return{ok:!1,reason:`web-host-cursor-unsupported`};let r=await n(e.projectDir);if(!r.ok)return Bd(r.reason);let i=t.isCursorRunning&&await t.isCursorRunning().catch(()=>!1)?Id:Ld;return await(t.sleep??Rd)(i),Pd(dn(e),t.openExternalDeps)}function Bd(e){switch(e){case`not-installed`:return{ok:!1,reason:`not-installed`,detail:`cursor binary not found`};case`invalid-path`:return{ok:!1,reason:`invalid-payload`,detail:`cursor spawn: invalid path`};case`timeout`:return{ok:!1,reason:`dispatch-error`,detail:`cursor spawn: timeout`};case`spawn-error`:return{ok:!1,reason:`dispatch-error`,detail:`cursor spawn: spawn-error`};default:return{ok:!1,reason:`dispatch-error`,detail:`cursor spawn: ${String(e)}`}}}async function Vd(e,t={}){switch(e.target){case`claude-cowork`:return Pd(xn({mode:`cowork`},e),t.openExternalDeps);case`claude-code`:return Pd(xn({mode:`code`},e),t.openExternalDeps);case`codex`:return Pd(Rn(e),t.openExternalDeps);case`cursor`:return zd(e,{...t.cursorDeps,openExternalDeps:t.cursorDeps?.openExternalDeps??t.openExternalDeps});default:{let t=e.target;return{ok:!1,reason:`invalid-payload`,detail:`unknown target: ${String(t)}`}}}}async function Hd(e,t={}){let n=t.okDesktop??(typeof window<`u`?window.okDesktop:void 0);if(n?.shell?.recordHandoff)try{await n.shell.recordHandoff(e)}catch(e){(t.warn??(e=>console.warn(e)))(`[handoff] recordHandoff IPC rejected (telemetry skipped): ${e instanceof Error?e.message:String(e)}`)}}function Ud(e,t,n){let r=n===`\\`?t.replaceAll(`/`,`\\`):t;return`${e.endsWith(n)?e.slice(0,-1):e}${n}${r}`}function Wd(e){return`${e}.md`}function Gd(e){if(!e.docName||!e.workspace)return null;let t=Wd(e.docName),{contentDir:n,pathSeparator:r}=e.workspace;return{docContext:{relativePath:t},projectDir:n,docPath:Ud(n,t,r)}}function Kd(e){return`Opened in ${e}.`}function qd(e,t=1){return t>=3?`Couldn't reach ${e} — please try again later.`:t===2?`Still couldn't reach ${e} — try one more time?`:`Couldn't reach ${e} — try again?`}function Jd(e){return e>=3?null:e===2?`Try one more time`:`Retry`}function Yd(e,t,n,r){return t.ok?{target:e,host:n,outcome:`ok`,ts:r}:{target:e,host:n,outcome:`error`,ts:r,reason:t.reason}}async function Xd(e,t,n,r=1){let i={target:e,projectDir:t.projectDir,docPath:t.docPath,prompt:yn(t.docContext)},a=await n.dispatchHandoff(i),o=Yd(e,a,n.isElectronHost()?`electron`:`web`,n.now().toISOString());await n.recordHandoff(o);let s=n.getDisplayName(e);if(a.ok)n.toast.success(Kd(s));else{let i=Jd(r),a=qd(s,r);i===null?n.toast.error(a):n.toast.error(a,{action:{label:i,onClick:()=>{Xd(e,t,n,r+1)}}})}return a}function Zd(e){return Od.find(t=>t.id===e)?.displayName??e}function Qd(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function $d(){return{dispatchHandoff:Vd,recordHandoff:Hd,toast:{success:e=>{At.success(e)},error:(e,t)=>{At.error(e,t?{action:t.action}:void 0)}},now:()=>new Date,isElectronHost:()=>Qd(),getDisplayName:Zd}}function ef(){return{dispatch:(e,t)=>Xd(e,t,$d())}}var tf=[...new Set(Od.flatMap(e=>e.schemes))];function nf(e,t){let n=t.now?.()??Date.now(),r={};for(let i of Od){if(!t.isElectronHost&&i.id===`cursor`){r[i.id]={installed:!1,lastChecked:n};continue}let a=i.schemes[0],o=a===void 0?void 0:e[a];if(!o){r[i.id]={installed:null};continue}r[i.id]={installed:o.installed,...o.displayName===void 0?{}:{displayName:o.displayName},lastChecked:n}}return r}function rf(e){return nf({},e)}async function af(e){let t=e.schemes??tf,n=await Promise.all(t.map(async t=>{let n=t.replace(/:$/,``);try{return[t,await e.detectProtocol(n)]}catch{return[t,{installed:!1}]}}));return Object.fromEntries(n)}var of=Object.fromEntries(tf.map(e=>[e,{installed:!1}]));async function sf(e){let t;try{t=await e.fetch(`/api/installed-agents`,{signal:e.signal,headers:{Accept:`application/json`}})}catch(e){if(e.name===`AbortError`)throw e;return of}if(!t.ok)return of;let n;try{n=await t.json()}catch{return of}if(typeof n!=`object`||!n||Array.isArray(n))return of;let r=n,i={};for(let e of tf)i[e]={installed:r[e.replace(/:$/,``)]===!0};return i}function cf(e,t){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n){let n=e[r],i=t[r];if(!n||!i||n.installed!==i.installed||n.displayName!==i.displayName)return!1}return!0}function lf(e){let t=e.throttleMs??1e4,n=!1,r=null,i=null,a={},o=rf({isElectronHost:e.isElectronHost(),now:e.now}),s=new Set,c=()=>{if(!n)for(let e of s)e(o)},l=()=>{o=nf(a,{isElectronHost:e.isElectronHost(),now:e.now})};return{probe:async()=>{if(n)return;if(i)return i;if(r!==null&&e.now()-r<t)return;let o=(async()=>{try{let t=await e.probe();if(n)return;let i=!cf(a,t);a=t,i&&(l(),c()),r=e.now()}catch{}finally{i=null}})();return i=o,o},getTargetStates:()=>o,subscribe:e=>(s.add(e),()=>{s.delete(e)}),cancel:()=>{n=!0,s.clear()}}}function uf(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function df(){let e=typeof window<`u`?window.okDesktop:void 0;if(e){let t=t=>e.shell.detectProtocol(t);return{probe:()=>af({detectProtocol:t}),isElectronHost:()=>!0,now:Date.now}}let t=globalThis.fetch.bind(globalThis);return{probe:()=>sf({fetch:t}),isElectronHost:()=>!1,now:Date.now}}function ff(){let e=(0,Z.c)(5),[t,n]=(0,X.useState)(pf),r=(0,X.useRef)(null),i,a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{let e=lf(df());r.current=e;let t=e.subscribe(n);return e.probe(),()=>{t(),e.cancel(),r.current=null}},a=[],e[0]=i,e[1]=a):(i=e[0],a=e[1]),(0,X.useEffect)(i,a);let o;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>r.current?.probe()??Promise.resolve(),e[2]=o):o=e[2];let s;return e[3]===t?s=e[4]:(s={states:t,refresh:o},e[3]=t,e[4]=s),s}function pf(){return rf({isElectronHost:uf(),now:Date.now})}var mf=(e,t,n)=>ya(e,t,n,`CommandPalette`);function hf(e){let t=(0,Z.c)(47),{bridge:n}=e,[r,i]=(0,X.useState)(!1),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=[],t[0]=a):a=t[0];let[o,s]=(0,X.useState)(a),{activeDocName:c}=ut(),l=kd(),{states:u,refresh:d}=ff(),{dispatch:f}=ef(),p=Gd({docName:c,workspace:l}),m;t[1]!==n.project||t[2]!==r||t[3]!==d?(m=()=>{if(!r)return;let e=!1;return mf(async()=>{let t=await n.project.listRecent();e||s(t)},`Failed to load recent projects.`),d(),()=>{e=!0}},t[1]=n.project,t[2]=r,t[3]=d,t[4]=m):m=t[4];let h;t[5]!==n||t[6]!==r||t[7]!==d?(h=[r,n,d],t[5]=n,t[6]=r,t[7]=d,t[8]=h):h=t[8],(0,X.useEffect)(m,h);let g,_;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&(e.key===`k`||e.key===`K`)&&(e.preventDefault(),i(gf))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},_=[],t[9]=g,t[10]=_):(g=t[9],_=t[10]),(0,X.useEffect)(g,_);let v;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(v=(e,t)=>{let n=t===void 0?`Command failed.`:t;i(!1),mf(async()=>{await e()},n)},t[11]=v):v=t[11];let y=v,b=n.config.projectPath,x;t[12]===b?x=t[13]:(x=e=>e.path!==b,t[12]=b,t[13]=x);let S=o.filter(x),C=yd,w;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Y.jsx)(bd,{placeholder:`Type a command or search recent projects…`}),t[14]=w):w=t[14];let T=xd,E;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Y.jsx)(Sd,{children:`No matching commands.`}),t[15]=E):E=t[15];let D;t[16]!==n.dialog||t[17]!==n.project?(D=()=>y(async()=>{let e=await n.dialog.openFolder();e&&await n.project.open({path:e,target:`new-window`})}),t[16]=n.dialog,t[17]=n.project,t[18]=D):D=t[18];let O,k,A;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Y.jsx)(nt,{}),k=(0,Y.jsx)(`span`,{children:`Open folder on disk…`}),A=(0,Y.jsx)(Ed,{children:`⌘O`}),t[19]=O,t[20]=k,t[21]=A):(O=t[19],k=t[20],A=t[21]);let j;t[22]===D?j=t[23]:(j=(0,Y.jsxs)(Td,{onSelect:D,"data-testid":`command-palette-open-folder`,children:[O,k,A]}),t[22]=D,t[23]=j);let M;t[24]===n.navigator?M=t[25]:(M=()=>y(()=>n.navigator.open(),`Failed to open Project Navigator.`),t[24]=n.navigator,t[25]=M);let N,P,F;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Y.jsx)(Ii,{}),P=(0,Y.jsx)(`span`,{children:Dd}),F=(0,Y.jsx)(Ed,{children:`⌘⇧N`}),t[26]=N,t[27]=P,t[28]=F):(N=t[26],P=t[27],F=t[28]);let I;t[29]===M?I=t[30]:(I=(0,Y.jsxs)(Td,{value:`switch-project navigator projects`,onSelect:M,"data-testid":`command-palette-switch-project`,children:[N,P,F]}),t[29]=M,t[30]=I);let ee;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(ee=()=>{i(!1),window.location.hash=`#install-claude-desktop`},t[31]=ee):ee=t[31];let L;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Y.jsxs)(Td,{onSelect:ee,"data-testid":`command-palette-install-claude-desktop`,children:[(0,Y.jsx)(Si,{}),(0,Y.jsx)(`span`,{children:`Install for Claude Chat & Cowork (Desktop App)…`})]}),t[32]=L):L=t[32];let R;t[33]!==j||t[34]!==I?(R=(0,Y.jsxs)(Cd,{heading:`Project`,children:[j,I,L]}),t[33]=j,t[34]=I,t[35]=R):R=t[35];let z=c?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(wd,{}),(0,Y.jsx)(Cd,{heading:`Open in agent`,children:Od.map(e=>{let t=u[e.id],n=t.installed===!0&&p!==null,r=t.installed===null?`Detecting…`:t.installed===!1?`Not installed`:p===null?`No active doc`:null,a=r?`Open in ${e.displayName}, ${r}`:`Open in ${e.displayName}`;return(0,Y.jsxs)(Td,{value:`open-in-agent ${e.id} ${e.displayName}`,disabled:!n,onSelect:()=>{!n||!p||(i(!1),f(e.id,p))},"data-testid":`command-palette-open-in-${e.id}`,"aria-label":a,children:[(0,Y.jsxs)(`span`,{className:`flex-1`,children:[`Open in `,e.displayName]}),r?(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`ml-auto text-muted-foreground text-xs`,children:r}):null]},e.id)})})]}):null,B=S.length>0?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(wd,{}),(0,Y.jsx)(Cd,{heading:`Recent projects`,children:S.slice(0,10).map(e=>(0,Y.jsxs)(Td,{value:`${e.name} ${e.path}`,disabled:e.missing,onSelect:()=>y(()=>n.project.open({path:e.path,target:`new-window`})),"data-testid":`command-palette-recent-${e.path}`,children:[(0,Y.jsx)(xe,{}),(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,Y.jsx)(`span`,{className:`truncate font-medium`,children:e.name}),(0,Y.jsxs)(`span`,{className:`truncate text-muted-foreground text-xs`,children:[e.path,e.missing?` (missing)`:``]})]})]},e.path))})]}):null,V;t[36]!==T||t[37]!==E||t[38]!==R||t[39]!==z||t[40]!==B?(V=(0,Y.jsxs)(T,{className:`subtle-scrollbar`,children:[E,R,z,B]}),t[36]=T,t[37]=E,t[38]=R,t[39]=z,t[40]=B,t[41]=V):V=t[41];let H;return t[42]!==C||t[43]!==r||t[44]!==w||t[45]!==V?(H=(0,Y.jsxs)(C,{open:r,onOpenChange:i,title:`Project Command Palette`,description:`Open a folder, switch to a recent project, or open the Project Navigator.`,children:[w,V]}),t[42]=C,t[43]=r,t[44]=w,t[45]=V,t[46]=H):H=t[46],H}function gf(e){return!e}var _f=500;function vf(e,t,n){return t?`terminal`:e===null&&n?`retrying`:`hidden`}function yf(e){return e===null?`no response`:e.kind===`null-collab`?`ok ui responded but server.lock has no port yet`:e.code===`network`?"network error (is `ok ui` running?)":e.code===`invalid-body`?`/api/config returned a malformed body`:`/api/config returned HTTP ${e.code}`}function bf(){let e=(0,Z.c)(16),{collabUrl:t,collabTerminal:n,collabLastError:r,retryCollab:i}=ut(),[a,o]=(0,X.useState)(!1),s,c;e[0]!==n||e[1]!==t?(s=()=>{if(t!==null||n){o(!1);return}let e=setTimeout(()=>o(!0),_f);return()=>clearTimeout(e)},c=[t,n],e[0]=n,e[1]=t,e[2]=s,e[3]=c):(s=e[2],c=e[3]),(0,X.useEffect)(s,c);let l=vf(t,n,a);if(l===`hidden`)return null;if(l===`terminal`){let t;e[4]===r?t=e[5]:(t=yf(r),e[4]=r,e[5]=t);let n;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Y.jsx)(`code`,{className:`bg-red-100/60 px-1 rounded`,children:`ok status`}),e[6]=n):n=e[6];let a;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Y.jsx)(`code`,{className:`bg-red-100/60 px-1 rounded`,children:`.open-knowledge/last-spawn-error.log`}),e[7]=a):a=e[7];let o;e[8]===t?o=e[9]:(o=(0,Y.jsxs)(`span`,{children:[`Couldn't reach collab server — `,t,`. Try`,` `,n,` or check`,` `,a,`.`]}),e[8]=t,e[9]=o);let s;e[10]===i?s=e[11]:(s=(0,Y.jsx)(`button`,{type:`button`,onClick:i,className:`bg-red-950 text-red-50 px-2 py-0.5 rounded text-xs font-medium hover:bg-red-900`,children:`Retry`}),e[10]=i,e[11]=s);let c;return e[12]!==o||e[13]!==s?(c=(0,Y.jsxs)(`div`,{role:`alert`,"aria-live":`assertive`,className:`fixed top-0 inset-x-0 z-50 bg-red-500/95 text-red-950 text-sm text-center py-2 px-4 shadow-md flex items-center justify-center gap-3 flex-wrap`,children:[o,s]}),e[12]=o,e[13]=s,e[14]=c):c=e[14],c}let u;return e[15]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Y.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:`fixed top-0 inset-x-0 z-50 bg-amber-500/95 text-amber-950 text-sm text-center py-2 px-4 shadow-md`,children:`Connecting — waiting for collab server…`}),e[15]=u):u=e[15],u}function xf(e){let t=(0,Z.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,Y.jsx)(Xa,{"data-slot":`alert-dialog`,...n}),t[2]=n,t[3]=r),r}function Sf(e){let t=(0,Z.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,Y.jsx)(Za,{"data-slot":`alert-dialog-trigger`,...n}),t[2]=n,t[3]=r),r}function Cf(e){let t=(0,Z.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,Y.jsx)(Qa,{"data-slot":`alert-dialog-portal`,...n}),t[2]=n,t[3]=r),r}function wf(e){let t=(0,Z.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=W(`fixed inset-0 z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Y.jsx)($a,{"data-slot":`alert-dialog-overlay`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Tf(e){let t=(0,Z.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,size: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]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Y.jsx)(wf,{}),t[4]=o):o=t[4];let s;t[5]===n?s=t[6]:(s=W(`group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm 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`,n),t[5]=n,t[6]=s);let c;return t[7]!==r||t[8]!==a||t[9]!==s?(c=(0,Y.jsxs)(Cf,{children:[o,(0,Y.jsx)(eo,{"data-slot":`alert-dialog-content`,"data-size":a,className:s,...r})]}),t[7]=r,t[8]=a,t[9]=s,t[10]=c):c=t[10],c}function Ef(e){let t=(0,Z.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=W(`grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Y.jsx)(`div`,{"data-slot":`alert-dialog-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Df(e){let t=(0,Z.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=W(`-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Y.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Of(e){let t=(0,Z.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=W(`font-heading text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Y.jsx)(ro,{"data-slot":`alert-dialog-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function kf(e){let t=(0,Z.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=W(`text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Y.jsx)(io,{"data-slot":`alert-dialog-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Af(e){let t=(0,Z.c)(14),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,variant:i,size:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?`default`:i,s=a===void 0?`default`:a,c;t[5]===n?c=t[6]:(c=W(n),t[5]=n,t[6]=c);let l;t[7]!==r||t[8]!==c?(l=(0,Y.jsx)(to,{"data-slot":`alert-dialog-action`,className:c,...r}),t[7]=r,t[8]=c,t[9]=l):l=t[9];let u;return t[10]!==s||t[11]!==l||t[12]!==o?(u=(0,Y.jsx)(K,{variant:o,size:s,asChild:!0,children:l}),t[10]=s,t[11]=l,t[12]=o,t[13]=u):u=t[13],u}function jf(e){let t=(0,Z.c)(14),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,variant:i,size:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?`outline`:i,s=a===void 0?`default`:a,c;t[5]===n?c=t[6]:(c=W(n),t[5]=n,t[6]=c);let l;t[7]!==r||t[8]!==c?(l=(0,Y.jsx)(no,{"data-slot":`alert-dialog-cancel`,className:c,...r}),t[7]=r,t[8]=c,t[9]=l):l=t[9];let u;return t[10]!==s||t[11]!==l||t[12]!==o?(u=(0,Y.jsx)(K,{variant:o,size:s,asChild:!0,children:l}),t[10]=s,t[11]=l,t[12]=o,t[13]=u):u=t[13],u}var Mf=`ok-editor-mode-v1`,Nf=[`wysiwyg`,`source`],Pf=`wysiwyg`;function Ff(e){return Nf.includes(e)}function If(e=localStorage){try{let t=e.getItem(Mf);if(t===null)return Pf;if(Ff(t))return t;console.warn(`[editor-mode] invalid persisted value, falling back to default`,{raw:t})}catch{}return Pf}function Lf(e=window,t=localStorage){let n=e.__OK_EDITOR_MODE__;return Ff(n)?n:If(t)}function Rf(e,t=localStorage){try{return t.setItem(Mf,e),!0}catch(e){return console.warn(`[editor-mode] persist failed`,e),!1}}function zf(){let e=(0,Z.c)(3),[t,n]=(0,X.useState)(Lf),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=function(e){n(e),Rf(e)},e[0]=r):r=e[0];let i=r,a;return e[1]===t?a=e[2]:(a=[t,i],e[1]=t,e[2]=a),a}async function Bf(){try{let e=await fetch(`/api/sync/status`);return e.ok?{status:await e.json()}:{status:null,error:`server`}}catch{return{status:null,error:`network`}}}function Vf(){return Hf().status}function Hf(){let e=(0,Z.c)(8),[t,n]=(0,X.useState)(null),[r,i]=(0,X.useState)(null),a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=function(){Bf().then(e=>{let{status:t,error:r}=e;i(r??null),t&&n(t)})},e[0]=a):a=e[0];let o=a,s,c;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{o()},c=[],e[1]=s,e[2]=c):(s=e[1],c=e[2]),(0,X.useEffect)(s,c);let l,u;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>Fn(e=>{e.includes(`sync-status`)&&o()}),u=[],e[3]=l,e[4]=u):(l=e[3],u=e[4]),(0,X.useEffect)(l,u);let d;return e[5]!==r||e[6]!==t?(d={status:t,fetchError:r},e[5]=r,e[6]=t,e[7]=d):d=e[7],d}async function Uf(e,t){let n=e.getReader(),r=new TextDecoder,i=``;for(;;){let{done:e,value:a}=await n.read();if(e)return i+=r.decode(),!!(i.trim()&&t(i)===`terminal`);i+=r.decode(a,{stream:!0});let o=i.split(`
16
+ For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return X.useEffect(()=>{document.getElementById(e.current?.getAttribute(`aria-describedby`))||console.warn(t)},[t,e]),null},Xa=ka,Za=ja,Qa=Na,$a=Fa,eo=Ba,to=Ka,no=Ja,ro=Ha,io=Wa;function ao(e){let t=X.useRef({value:e,previous:e});return X.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var oo=[`Enter`,` `],so=[`ArrowDown`,`PageUp`,`Home`],co=[`ArrowUp`,`PageDown`,`End`],lo=[...so,...co],uo={ltr:[...oo,`ArrowRight`],rtl:[...oo,`ArrowLeft`]},fo={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},po=`Menu`,[mo,ho,go]=Ce(po),[_o,vo]=H(po,[go,rn,ke]),yo=rn(),bo=ke(),[xo,So]=_o(po),[Co,wo]=_o(po),To=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=yo(t),[c,l]=X.useState(null),u=X.useRef(!1),d=z(a),f=je(i);return X.useEffect(()=>{let e=()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>u.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),(0,Y.jsx)(tn,{...s,children:(0,Y.jsx)(xo,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,Y.jsx)(Co,{scope:t,onClose:X.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};To.displayName=po;var Eo=`MenuAnchor`,Do=X.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=yo(n);return(0,Y.jsx)(en,{...i,...r,ref:t})});Do.displayName=Eo;var Oo=`MenuPortal`,[ko,Ao]=_o(Oo,{forceMount:void 0}),jo=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=So(Oo,t);return(0,Y.jsx)(ko,{scope:t,forceMount:n,children:(0,Y.jsx)(oe,{present:n||a.open,children:(0,Y.jsx)(ae,{asChild:!0,container:i,children:r})})})};jo.displayName=Oo;var Mo=`MenuContent`,[No,Po]=_o(Mo),Fo=X.forwardRef((e,t)=>{let n=Ao(Mo,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=So(Mo,e.__scopeMenu),o=wo(Mo,e.__scopeMenu);return(0,Y.jsx)(mo.Provider,{scope:e.__scopeMenu,children:(0,Y.jsx)(oe,{present:r||a.open,children:(0,Y.jsx)(mo.Slot,{scope:e.__scopeMenu,children:o.modal?(0,Y.jsx)(Io,{...i,ref:t}):(0,Y.jsx)(Lo,{...i,ref:t})})})})}),Io=X.forwardRef((e,t)=>{let n=So(Mo,e.__scopeMenu),r=X.useRef(null),i=ce(t,r);return X.useEffect(()=>{let e=r.current;if(e)return Xt(e)},[]),(0,Y.jsx)(zo,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:q(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Lo=X.forwardRef((e,t)=>{let n=So(Mo,e.__scopeMenu);return(0,Y.jsx)(zo,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Ro=te(`MenuContent.ScrollLock`),zo=X.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...h}=e,g=So(Mo,n),_=wo(Mo,n),v=yo(n),y=bo(n),b=ho(n),[x,S]=X.useState(null),C=X.useRef(null),w=ce(t,C,g.onContentChange),T=X.useRef(0),E=X.useRef(``),D=X.useRef(0),O=X.useRef(null),k=X.useRef(`right`),A=X.useRef(0),j=m?$t:X.Fragment,M=m?{as:Ro,allowPinchZoom:!0}:void 0,N=e=>{let t=E.current+e,n=b().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=Cs(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){E.current=t,window.clearTimeout(T.current),t!==``&&(T.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};X.useEffect(()=>()=>window.clearTimeout(T.current),[]),Pt();let P=X.useCallback(e=>k.current===O.current?.side&&Ts(e,O.current?.area),[]);return(0,Y.jsx)(No,{scope:n,searchRef:E,onItemEnter:X.useCallback(e=>{P(e)&&e.preventDefault()},[P]),onItemLeave:X.useCallback(e=>{P(e)||(C.current?.focus(),S(null))},[P]),onTriggerLeave:X.useCallback(e=>{P(e)&&e.preventDefault()},[P]),pointerGraceTimerRef:D,onPointerGraceIntentChange:X.useCallback(e=>{O.current=e},[]),children:(0,Y.jsx)(j,{...M,children:(0,Y.jsx)(Qt,{asChild:!0,trapped:i,onMountAutoFocus:q(a,e=>{e.preventDefault(),C.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,Y.jsx)(re,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,Y.jsx)(Se,{asChild:!0,...y,dir:_.dir,orientation:`vertical`,loop:r,currentTabStopId:x,onCurrentTabStopIdChange:S,onEntryFocus:q(c,e=>{_.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,Y.jsx)(cn,{role:`menu`,"aria-orientation":`vertical`,"data-state":vs(g.open),"data-radix-menu-content":``,dir:_.dir,...v,...h,ref:w,style:{outline:`none`,...h.style},onKeyDown:q(h.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&N(e.key));let i=C.current;if(e.target!==i||!lo.includes(e.key))return;e.preventDefault();let a=b().filter(e=>!e.disabled).map(e=>e.ref.current);co.includes(e.key)&&a.reverse(),xs(a)}),onBlur:q(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(T.current),E.current=``)}),onPointerMove:q(e.onPointerMove,Es(e=>{let t=e.target,n=A.current!==e.clientX;e.currentTarget.contains(t)&&n&&(k.current=e.clientX>A.current?`right`:`left`,A.current=e.clientX)}))})})})})})})});Fo.displayName=Mo;var Bo=`MenuGroup`,Vo=X.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,Y.jsx)(ie.div,{role:`group`,...r,ref:t})});Vo.displayName=Bo;var Ho=`MenuLabel`,Uo=X.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,Y.jsx)(ie.div,{...r,ref:t})});Uo.displayName=Ho;var Wo=`MenuItem`,Go=`menu.itemSelect`,Ko=X.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=X.useRef(null),o=wo(Wo,e.__scopeMenu),s=Po(Wo,e.__scopeMenu),c=ce(t,a),l=X.useRef(!1),u=()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(Go,{bubbles:!0,cancelable:!0});e.addEventListener(Go,e=>r?.(e),{once:!0}),U(e,t),t.defaultPrevented?l.current=!1:o.onClose()}};return(0,Y.jsx)(qo,{...i,ref:c,disabled:n,onClick:q(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:q(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:q(e.onKeyDown,e=>{let t=s.searchRef.current!==``;n||t&&e.key===` `||oo.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});Ko.displayName=Wo;var qo=X.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=Po(Wo,n),s=bo(n),c=X.useRef(null),l=ce(t,c),[u,d]=X.useState(!1),[f,p]=X.useState(``);return X.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,Y.jsx)(mo.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,Y.jsx)(Ee,{asChild:!0,...s,focusable:!r,children:(0,Y.jsx)(ie.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:q(e.onPointerMove,Es(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:q(e.onPointerLeave,Es(e=>o.onItemLeave(e))),onFocus:q(e.onFocus,()=>d(!0)),onBlur:q(e.onBlur,()=>d(!1))})})})}),Jo=`MenuCheckboxItem`,Yo=X.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,Y.jsx)(rs,{scope:e.__scopeMenu,checked:n,children:(0,Y.jsx)(Ko,{role:`menuitemcheckbox`,"aria-checked":ys(n)?`mixed`:n,...i,ref:t,"data-state":bs(n),onSelect:q(i.onSelect,()=>r?.(ys(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Yo.displayName=Jo;var Xo=`MenuRadioGroup`,[Zo,Qo]=_o(Xo,{value:void 0,onValueChange:()=>{}}),$o=X.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=z(r);return(0,Y.jsx)(Zo,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,Y.jsx)(Vo,{...i,ref:t})})});$o.displayName=Xo;var es=`MenuRadioItem`,ts=X.forwardRef((e,t)=>{let{value:n,...r}=e,i=Qo(es,e.__scopeMenu),a=n===i.value;return(0,Y.jsx)(rs,{scope:e.__scopeMenu,checked:a,children:(0,Y.jsx)(Ko,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":bs(a),onSelect:q(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});ts.displayName=es;var ns=`MenuItemIndicator`,[rs,is]=_o(ns,{checked:!1}),as=X.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=is(ns,n);return(0,Y.jsx)(oe,{present:r||ys(a.checked)||a.checked===!0,children:(0,Y.jsx)(ie.span,{...i,ref:t,"data-state":bs(a.checked)})})});as.displayName=ns;var os=`MenuSeparator`,ss=X.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,Y.jsx)(ie.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});ss.displayName=os;var cs=`MenuArrow`,ls=X.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=yo(n);return(0,Y.jsx)(on,{...i,...r,ref:t})});ls.displayName=cs;var us=`MenuSub`,[ds,fs]=_o(us),ps=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=So(us,t),o=yo(t),[s,c]=X.useState(null),[l,u]=X.useState(null),d=z(i);return X.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,Y.jsx)(tn,{...o,children:(0,Y.jsx)(xo,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,Y.jsx)(ds,{scope:t,contentId:G(),triggerId:G(),trigger:s,onTriggerChange:c,children:n})})})};ps.displayName=us;var ms=`MenuSubTrigger`,hs=X.forwardRef((e,t)=>{let n=So(ms,e.__scopeMenu),r=wo(ms,e.__scopeMenu),i=fs(ms,e.__scopeMenu),a=Po(ms,e.__scopeMenu),o=X.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:c}=a,l={__scopeMenu:e.__scopeMenu},u=X.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return X.useEffect(()=>u,[u]),X.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),c(null)}},[s,c]),(0,Y.jsx)(Do,{asChild:!0,...l,children:(0,Y.jsx)(qo,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":i.contentId,"data-state":vs(n.open),...e,ref:se(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:q(e.onPointerMove,Es(t=>{a.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:q(e.onPointerLeave,Es(e=>{u();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,o=i?-5:5,c=t[i?`left`:`right`],l=t[i?`right`:`left`];a.onPointerGraceIntentChange({area:[{x:e.clientX+o,y:e.clientY},{x:c,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:c,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:q(e.onKeyDown,t=>{let i=a.searchRef.current!==``;e.disabled||i&&t.key===` `||uo[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});hs.displayName=ms;var gs=`MenuSubContent`,_s=X.forwardRef((e,t)=>{let n=Ao(Mo,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=So(Mo,e.__scopeMenu),o=wo(Mo,e.__scopeMenu),s=fs(gs,e.__scopeMenu),c=X.useRef(null),l=ce(t,c);return(0,Y.jsx)(mo.Provider,{scope:e.__scopeMenu,children:(0,Y.jsx)(oe,{present:r||a.open,children:(0,Y.jsx)(mo.Slot,{scope:e.__scopeMenu,children:(0,Y.jsx)(zo,{id:s.contentId,"aria-labelledby":s.triggerId,...i,ref:l,align:`start`,side:o.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{o.isUsingKeyboardRef.current&&c.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:q(e.onFocusOutside,e=>{e.target!==s.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:q(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:q(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=fo[o.dir].includes(e.key);t&&n&&(a.onOpenChange(!1),s.trigger?.focus(),e.preventDefault())})})})})})});_s.displayName=gs;function vs(e){return e?`open`:`closed`}function ys(e){return e===`indeterminate`}function bs(e){return ys(e)?`indeterminate`:e?`checked`:`unchecked`}function xs(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function Ss(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function Cs(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=Ss(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function ws(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function Ts(e,t){return t?ws({x:e.clientX,y:e.clientY},t):!1}function Es(e){return t=>t.pointerType===`mouse`?e(t):void 0}var Ds=To,Os=Do,ks=jo,As=Fo,js=Vo,Ms=Uo,Ns=Ko,Ps=Yo,Fs=$o,Is=ts,Ls=as,Rs=ss,zs=ls,Bs=ps,Vs=hs,Hs=_s,Us=`DropdownMenu`,[Ws,Gs]=H(Us,[vo]),Ks=vo(),[qs,Js]=Ws(Us),Ys=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=Ks(t),l=X.useRef(null),[u,d]=V({prop:i,defaultProp:a??!1,onChange:o,caller:Us});return(0,Y.jsx)(qs,{scope:t,triggerId:G(),triggerRef:l,contentId:G(),open:u,onOpenChange:d,onOpenToggle:X.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,Y.jsx)(Ds,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};Ys.displayName=Us;var Xs=`DropdownMenuTrigger`,Zs=X.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=Js(Xs,n),o=Ks(n);return(0,Y.jsx)(Os,{asChild:!0,...o,children:(0,Y.jsx)(ie.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:se(t,a.triggerRef),onPointerDown:q(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:q(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});Zs.displayName=Xs;var Qs=`DropdownMenuPortal`,$s=e=>{let{__scopeDropdownMenu:t,...n}=e,r=Ks(t);return(0,Y.jsx)(ks,{...r,...n})};$s.displayName=Qs;var ec=`DropdownMenuContent`,tc=X.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Js(ec,n),a=Ks(n),o=X.useRef(!1);return(0,Y.jsx)(As,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:q(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:q(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});tc.displayName=ec;var nc=`DropdownMenuGroup`,rc=X.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Ks(n);return(0,Y.jsx)(js,{...i,...r,ref:t})});rc.displayName=nc;var ic=`DropdownMenuLabel`,ac=X.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Ks(n);return(0,Y.jsx)(Ms,{...i,...r,ref:t})});ac.displayName=ic;var oc=`DropdownMenuItem`,sc=X.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Ks(n);return(0,Y.jsx)(Ns,{...i,...r,ref:t})});sc.displayName=oc;var cc=`DropdownMenuCheckboxItem`,lc=X.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Ks(n);return(0,Y.jsx)(Ps,{...i,...r,ref:t})});lc.displayName=cc;var uc=`DropdownMenuRadioGroup`,dc=X.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Ks(n);return(0,Y.jsx)(Fs,{...i,...r,ref:t})});dc.displayName=uc;var fc=`DropdownMenuRadioItem`,pc=X.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Ks(n);return(0,Y.jsx)(Is,{...i,...r,ref:t})});pc.displayName=fc;var mc=`DropdownMenuItemIndicator`,hc=X.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Ks(n);return(0,Y.jsx)(Ls,{...i,...r,ref:t})});hc.displayName=mc;var gc=`DropdownMenuSeparator`,_c=X.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Ks(n);return(0,Y.jsx)(Rs,{...i,...r,ref:t})});_c.displayName=gc;var vc=`DropdownMenuArrow`,yc=X.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Ks(n);return(0,Y.jsx)(zs,{...i,...r,ref:t})});yc.displayName=vc;var bc=e=>{let{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:i,defaultOpen:a}=e,o=Ks(t),[s,c]=V({prop:r,defaultProp:a??!1,onChange:i,caller:`DropdownMenuSub`});return(0,Y.jsx)(Bs,{...o,open:s,onOpenChange:c,children:n})},xc=`DropdownMenuSubTrigger`,Sc=X.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Ks(n);return(0,Y.jsx)(Vs,{...i,...r,ref:t})});Sc.displayName=xc;var Cc=`DropdownMenuSubContent`,wc=X.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Ks(n);return(0,Y.jsx)(Hs,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});wc.displayName=Cc;var Tc=Ys,Ec=Zs,Dc=$s,Oc=tc,kc=ac,Ac=sc,jc=dc,Mc=pc,Nc=hc,Pc=_c,Fc=bc,Ic=Sc,Lc=wc,Rc=`Popover`,[zc,Bc]=H(Rc,[rn]),Vc=rn(),[Hc,Uc]=zc(Rc),Wc=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=Vc(t),c=X.useRef(null),[l,u]=X.useState(!1),[d,f]=V({prop:r,defaultProp:i??!1,onChange:a,caller:Rc});return(0,Y.jsx)(tn,{...s,children:(0,Y.jsx)(Hc,{scope:t,contentId:G(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:X.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:X.useCallback(()=>u(!0),[]),onCustomAnchorRemove:X.useCallback(()=>u(!1),[]),modal:o,children:n})})};Wc.displayName=Rc;var Gc=`PopoverAnchor`,Kc=X.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Uc(Gc,n),a=Vc(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return X.useEffect(()=>(o(),()=>s()),[o,s]),(0,Y.jsx)(en,{...a,...r,ref:t})});Kc.displayName=Gc;var qc=`PopoverTrigger`,Jc=X.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Uc(qc,n),a=Vc(n),o=ce(t,i.triggerRef),s=(0,Y.jsx)(ie.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":ll(i.open),...r,ref:o,onClick:q(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,Y.jsx)(en,{asChild:!0,...a,children:s})});Jc.displayName=qc;var Yc=`PopoverPortal`,[Xc,Zc]=zc(Yc,{forceMount:void 0}),Qc=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=Uc(Yc,t);return(0,Y.jsx)(Xc,{scope:t,forceMount:n,children:(0,Y.jsx)(oe,{present:n||a.open,children:(0,Y.jsx)(ae,{asChild:!0,container:i,children:r})})})};Qc.displayName=Yc;var $c=`PopoverContent`,el=X.forwardRef((e,t)=>{let n=Zc($c,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=Uc($c,e.__scopePopover);return(0,Y.jsx)(oe,{present:r||a.open,children:a.modal?(0,Y.jsx)(nl,{...i,ref:t}):(0,Y.jsx)(rl,{...i,ref:t})})});el.displayName=$c;var tl=te(`PopoverContent.RemoveScroll`),nl=X.forwardRef((e,t)=>{let n=Uc($c,e.__scopePopover),r=X.useRef(null),i=ce(t,r),a=X.useRef(!1);return X.useEffect(()=>{let e=r.current;if(e)return Xt(e)},[]),(0,Y.jsx)($t,{as:tl,allowPinchZoom:!0,children:(0,Y.jsx)(il,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:q(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:q(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;a.current=t.button===2||n},{checkForDefaultPrevented:!1}),onFocusOutside:q(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),rl=X.forwardRef((e,t)=>{let n=Uc($c,e.__scopePopover),r=X.useRef(!1),i=X.useRef(!1);return(0,Y.jsx)(il,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),il=X.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=Uc($c,n),p=Vc(n);return Pt(),(0,Y.jsx)(Qt,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,Y.jsx)(re,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),children:(0,Y.jsx)(cn,{"data-state":ll(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})}),al=`PopoverClose`,ol=X.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Uc(al,n);return(0,Y.jsx)(ie.button,{type:`button`,...r,ref:t,onClick:q(e.onClick,()=>i.onOpenChange(!1))})});ol.displayName=al;var sl=`PopoverArrow`,cl=X.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Vc(n);return(0,Y.jsx)(on,{...i,...r,ref:t})});cl.displayName=sl;function ll(e){return e?`open`:`closed`}var ul=Wc,dl=Jc,fl=Qc,pl=el,ml=`Separator`,hl=`horizontal`,gl=[`horizontal`,`vertical`],_l=X.forwardRef((e,t)=>{let{decorative:n,orientation:r=hl,...i}=e,a=vl(r)?r:hl,o=n?{role:`none`}:{"aria-orientation":a===`vertical`?a:void 0,role:`separator`};return(0,Y.jsx)(ie.div,{"data-orientation":a,...o,...i,ref:t})});_l.displayName=ml;function vl(e){return gl.includes(e)}var yl=_l,bl=`Switch`,[xl,Sl]=H(bl),[Cl,wl]=xl(bl),Tl=X.forwardRef((e,t)=>{let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c=`on`,onCheckedChange:l,form:u,...d}=e,[f,p]=X.useState(null),m=ce(t,e=>p(e)),h=X.useRef(!1),g=f?u||!!f.closest(`form`):!0,[_,v]=V({prop:i,defaultProp:a??!1,onChange:l,caller:bl});return(0,Y.jsxs)(Cl,{scope:n,checked:_,disabled:s,children:[(0,Y.jsx)(ie.button,{type:`button`,role:`switch`,"aria-checked":_,"aria-required":o,"data-state":Al(_),"data-disabled":s?``:void 0,disabled:s,value:c,...d,ref:m,onClick:q(e.onClick,e=>{v(e=>!e),g&&(h.current=e.isPropagationStopped(),h.current||e.stopPropagation())})}),g&&(0,Y.jsx)(kl,{control:f,bubbles:!h.current,name:r,value:c,checked:_,required:o,disabled:s,form:u,style:{transform:`translateX(-100%)`}})]})});Tl.displayName=bl;var El=`SwitchThumb`,Dl=X.forwardRef((e,t)=>{let{__scopeSwitch:n,...r}=e,i=wl(El,n);return(0,Y.jsx)(ie.span,{"data-state":Al(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})});Dl.displayName=El;var Ol=`SwitchBubbleInput`,kl=X.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...i},a)=>{let o=X.useRef(null),s=ce(o,a),c=ao(n),l=un(t);return X.useEffect(()=>{let e=o.current;if(!e)return;let t=window.HTMLInputElement.prototype,i=Object.getOwnPropertyDescriptor(t,`checked`).set;if(c!==n&&i){let t=new Event(`click`,{bubbles:r});i.call(e,n),e.dispatchEvent(t)}},[c,n,r]),(0,Y.jsx)(`input`,{type:`checkbox`,"aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:s,style:{...i.style,...l,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0}})});kl.displayName=Ol;function Al(e){return e?`checked`:`unchecked`}var jl=Tl,Ml=Dl;function Nl(e){let t=new Set;for(let n of e)n.detected&&t.add(n.id);return t}function Pl(e,t){let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n}function Fl(e,t){let n=[];for(let r of t)e.has(r.id)&&n.push(r.id);return n}var Il={error:e=>At.error(e)};function Ll(e){let t=(0,Z.c)(9),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{store:r,toast:i,payload:a}=n,o=r===void 0?Ca:r,s=i===void 0?Il:i,c;t[2]!==a||t[3]!==o?(c=a??o.getSnapshot(),t[2]=a,t[3]=o,t[4]=c):c=t[4];let l=c;if(!l)return null;let u;return t[5]!==l||t[6]!==o||t[7]!==s?(u=(0,Y.jsx)(Rl,{payload:l,store:o,toast:s}),t[5]=l,t[6]=o,t[7]=s,t[8]=u):u=t[8],u}function Rl(e){let t=(0,Z.c)(44),{payload:n,store:r,toast:i}=e,a=n.detectedEditors,o;t[0]===a?o=t[1]:(o=()=>Nl(a),t[0]=a,t[1]=o);let[s,c]=(0,X.useState)(o),[l,u]=(0,X.useState)(!1),d;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=function(e){c(t=>Pl(t,e))},t[2]=d):d=t[2];let f=d,p;t[3]!==a||t[4]!==s||t[5]!==r||t[6]!==i?(p=async function(){u(!0);let e=await r.confirm(Fl(s,a));e.ok||(i.error(e.error),u(!1))},t[3]=a,t[4]=s,t[5]=r,t[6]=i,t[7]=p):p=t[7];let m=p,h;t[8]!==r||t[9]!==i?(h=async function(){u(!0);let e=await r.skip();e.ok||(i.error(e.error),u(!1))},t[8]=r,t[9]=i,t[10]=h):h=t[10];let g=h,_;t[11]!==l||t[12]!==g?(_=function(e){!e&&!l&&g()},t[11]=l,t[12]=g,t[13]=_):_=t[13];let v=_,y;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Y.jsxs)(Wt,{children:[(0,Y.jsx)(qt,{children:`Add Open Knowledge to your AI tools`}),(0,Y.jsx)(Bt,{children:`Connect Open Knowledge to your AI tools so they can read and write your notes. Once added, asking Claude to summarize or update a page works without copy-paste. Detected editors are preselected — you can toggle any row.`})]}),t[14]=y):y=t[14];let b;if(t[15]!==l||t[16]!==a||t[17]!==s){let e;t[19]!==l||t[20]!==s?(e=e=>{let t=s.has(e.id),n=e.willReplace?`Will replace existing Open Knowledge entry`:e.detected?`Detected on this machine`:`Not detected`,r=e.willReplace?`text-xs text-amber-600 dark:text-amber-400`:`text-xs text-muted-foreground`;return(0,Y.jsx)(`li`,{children:(0,Y.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2.5 px-3 py-2.5 text-sm hover:bg-accent`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:t,disabled:l,onChange:()=>f(e.id),className:`size-4 shrink-0 rounded accent-primary`,"data-testid":`mcp-consent-checkbox-${e.id}`}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-foreground`,children:e.label}),(0,Y.jsx)(`span`,{className:r,"data-testid":`mcp-consent-status-${e.id}`,children:n})]})]})},e.id)},t[19]=l,t[20]=s,t[21]=e):e=t[21],b=a.map(e),t[15]=l,t[16]=a,t[17]=s,t[18]=b}else b=t[18];let x;t[22]===b?x=t[23]:(x=(0,Y.jsx)(`ul`,{className:`max-h-72 overflow-y-auto rounded-md border border-border bg-card/50 divide-y divide-border`,children:b}),t[22]=b,t[23]=x);let S;t[24]===g?S=t[25]:(S=()=>void g(),t[24]=g,t[25]=S);let C;t[26]!==l||t[27]!==S?(C=(0,Y.jsx)(K,{variant:`outline`,className:`font-mono uppercase`,onClick:S,disabled:l,"data-testid":`mcp-consent-skip`,children:`Skip`}),t[26]=l,t[27]=S,t[28]=C):C=t[28];let w;t[29]===m?w=t[30]:(w=()=>void m(),t[29]=m,t[30]=w);let T=l||s.size===0,E=l?`Working...`:`Add`,D;t[31]!==w||t[32]!==T||t[33]!==E?(D=(0,Y.jsx)(K,{onClick:w,disabled:T,"data-testid":`mcp-consent-add`,children:E}),t[31]=w,t[32]=T,t[33]=E,t[34]=D):D=t[34];let O;t[35]!==C||t[36]!==D?(O=(0,Y.jsxs)(Nt,{children:[C,D]}),t[35]=C,t[36]=D,t[37]=O):O=t[37];let k;t[38]!==O||t[39]!==x?(k=(0,Y.jsxs)(Kt,{className:`sm:max-w-md`,children:[y,x,O]}),t[38]=O,t[39]=x,t[40]=k):k=t[40];let A;return t[41]!==v||t[42]!==k?(A=(0,Y.jsx)(Jt,{open:!0,onOpenChange:v,children:k}),t[41]=v,t[42]=k,t[43]=A):A=t[43],A}var zl=(0,X.lazy)(()=>n(()=>import(`./McpConsentDialogBody-QKrs5-z6.js`),[],import.meta.url));function Bl(){let e=(0,Z.c)(1);if(!(0,X.useSyncExternalStore)(Ca.subscribe,Hl,Vl))return null;let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Y.jsx)(X.Suspense,{fallback:null,children:(0,Y.jsx)(zl,{})}),e[0]=t):t=e[0],t}function Vl(){return!1}function Hl(){return Ca.getSnapshot()!==null}var Ul=B(`group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3! font-mono uppercase`,{variants:{variant:{default:`bg-primary text-primary-foreground [a]:hover:bg-primary/80`,secondary:`bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80`,warning:`bg-yellow-500/10 text-yellow-600 [a]:hover:bg-yellow-500/20`,destructive:`bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20`,outline:`border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground`,ghost:`hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50`,link:`text-primary underline-offset-4 hover:underline`,dashed:`border-dashed border-border text-muted-foreground rounded-sm`}},defaultVariants:{variant:`default`}});function Wl(e){let t=(0,Z.c)(13),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,variant:i,asChild:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?`default`:i,s=a!==void 0&&a?ne:`span`,c;t[5]!==n||t[6]!==o?(c=W(Ul({variant:o}),n),t[5]=n,t[6]=o,t[7]=c):c=t[7];let l;return t[8]!==s||t[9]!==r||t[10]!==c||t[11]!==o?(l=(0,Y.jsx)(s,{"data-slot":`badge`,"data-variant":o,className:c,...r}),t[8]=s,t[9]=r,t[10]=c,t[11]=o,t[12]=l):l=t[12],l}var Gl=(e,t,n)=>va(e,t,n,`NavigatorApp`);function Kl(e){let t=(0,Z.c)(41),{bridge:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=[],t[0]=r):r=t[0];let[i,a]=(0,X.useState)(r),[o,s]=(0,X.useState)(!0),[c,l]=(0,X.useState)(null),u;t[1]===n.project?u=t[2]:(u=()=>{let e=!1;return n.project.listRecent().then(t=>{e||a(t)}).catch(t=>{console.error(`[NavigatorApp] listRecent failed:`,t),e||l(t instanceof Error?t.message:`Failed to load recent projects.`)}).finally(()=>{e||s(!1)}),()=>{e=!0}},t[1]=n.project,t[2]=u);let d;t[3]===n?d=t[4]:(d=[n],t[3]=n,t[4]=d),(0,X.useEffect)(u,d);let f;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(f=(e,t)=>Gl(e,t,l),t[5]=f):f=t[5];let p=f,m;t[6]===n?m=t[7]:(m=()=>p(async()=>{let e=await n.dialog.openFolder();e&&await Yl(n,e)},`Failed to clone from GitHub.`),t[6]=n,t[7]=m);let h=m,g;t[8]===n?g=t[9]:(g=()=>p(async()=>{let e=await n.dialog.openFolder();e&&await Yl(n,e)},`Failed to open folder.`),t[8]=n,t[9]=g);let _=g,v;t[10]===n?v=t[11]:(v=()=>p(async()=>{let e=await n.dialog.createFolder();e&&await Yl(n,e)},`Failed to create project folder.`),t[10]=n,t[11]=v);let y=v,b;t[12]===n?b=t[13]:(b=e=>p(async()=>{await Yl(n,e)},`Failed to open project.`),t[12]=n,t[13]=b);let x=b,S=`flex h-screen w-screen flex-col overflow-hidden bg-primary-foreground dark:bg-background p-12 pb-2 text-foreground max-w-5xl space-y-10 mx-auto ${!o&&i.length===0?`justify-center`:``}`,C;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Y.jsx)(xa,{className:`size-12 shrink-0`}),t[14]=C):C=t[14];let w;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Y.jsx)(`h1`,{className:`font-medium text-xl tracking-tight`,children:`Open Knowledge`}),t[15]=w):w=t[15];let T;t[16]===n.appVersion?T=t[17]:(T=(0,Y.jsxs)(`header`,{className:`shrink-0 flex-wrap flex items-center gap-2.5`,children:[C,(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[w,(0,Y.jsxs)(`p`,{className:`text-muted-foreground text-xs font-mono`,children:[`v`,n.appVersion]})]})]}),t[16]=n.appVersion,t[17]=T);let E;t[18]===h?E=t[19]:(E=(0,Y.jsx)(ql,{title:`Clone from GitHub`,description:`Bring a remote repository onto this machine.`,onClick:h,dataTestId:`nav-clone`,Icon:ba}),t[18]=h,t[19]=E);let D;t[20]===_?D=t[21]:(D=(0,Y.jsx)(ql,{title:`Open folder on disk`,description:`Open an existing folder as a project.`,onClick:_,dataTestId:`nav-open`,Icon:nt}),t[20]=_,t[21]=D);let O;t[22]===y?O=t[23]:(O=(0,Y.jsx)(ql,{title:`Start fresh`,description:`Create a new folder for a brand-new project.`,onClick:y,dataTestId:`nav-fresh`,Icon:Zi}),t[22]=y,t[23]=O);let k;t[24]!==E||t[25]!==D||t[26]!==O?(k=(0,Y.jsxs)(`section`,{className:`grid shrink-0 sm:grid-cols-3 gap-3`,children:[E,D,O]}),t[24]=E,t[25]=D,t[26]=O,t[27]=k):k=t[27];let A;t[28]===c?A=t[29]:(A=c===null?null:(0,Y.jsxs)(`div`,{className:`mb-3 flex shrink-0 items-start justify-between gap-3 rounded-md border border-red-500/30 bg-red-500/10 px-3 py-2`,"data-testid":`nav-error-banner`,role:`alert`,children:[(0,Y.jsx)(`span`,{className:`text-red-700 text-xs dark:text-red-300`,children:c}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>l(null),className:`text-red-700 text-xs underline hover:no-underline dark:text-red-300`,"data-testid":`nav-error-dismiss`,children:`Dismiss`})]}),t[28]=c,t[29]=A);let j;t[30]!==o||t[31]!==x||t[32]!==i?(j=o?(0,Y.jsx)(`section`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,Y.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,Y.jsx)(Ye,{className:`size-4 animate-spin text-muted-foreground/60`})})}):i.length>0?(0,Y.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,Y.jsx)(`h2`,{className:`mb-2 shrink-0 font-medium text-muted-foreground font-mono text-xs uppercase tracking-wide`,children:`Recent`}),(0,Y.jsx)(`ul`,{className:`min-h-0 flex-1 subtle-scrollbar overflow-y-auto space-y-0.5 -mx-4`,"data-testid":`nav-recent-list`,children:i.map(e=>(0,Y.jsx)(Jl,{project:e,onOpen:()=>x(e.path)},e.path))})]}):null,t[30]=o,t[31]=x,t[32]=i,t[33]=j):j=t[33];let M;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Y.jsx)(Bl,{}),t[34]=M):M=t[34];let N;return t[35]!==T||t[36]!==k||t[37]!==A||t[38]!==j||t[39]!==S?(N=(0,Y.jsxs)(`div`,{className:S,children:[T,k,A,j,M]}),t[35]=T,t[36]=k,t[37]=A,t[38]=j,t[39]=S,t[40]=N):N=t[40],N}function ql(e){let t=(0,Z.c)(14),{title:n,description:r,onClick:i,dataTestId:a,Icon:o}=e,s;t[0]===o?s=t[1]:(s=o?(0,Y.jsx)(o,{className:`size-4 shrink-0 text-muted-foreground`}):null,t[0]=o,t[1]=s);let c;t[2]===n?c=t[3]:(c=(0,Y.jsx)(`span`,{className:`font-medium text-gray-700 dark:text-foreground text-sm`,children:n}),t[2]=n,t[3]=c);let l;t[4]!==s||t[5]!==c?(l=(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[s,c]}),t[4]=s,t[5]=c,t[6]=l):l=t[6];let u;t[7]===r?u=t[8]:(u=(0,Y.jsx)(`span`,{className:`text-muted-foreground text-xs leading-snug`,children:r}),t[7]=r,t[8]=u);let d;return t[9]!==a||t[10]!==i||t[11]!==l||t[12]!==u?(d=(0,Y.jsxs)(`button`,{type:`button`,onClick:i,"data-testid":a,className:`flex flex-col items-start gap-1.5 rounded-lg border border-border bg-card py-3.5 px-4 text-left transition-colors hover:bg-accent`,children:[l,u]}),t[9]=a,t[10]=i,t[11]=l,t[12]=u,t[13]=d):d=t[13],d}function Jl(e){let t=(0,Z.c)(17),{project:n,onOpen:r}=e,i=`flex items-center justify-between ${n.missing?`opacity-50`:``}`,a;t[0]===n.name?a=t[1]:(a=(0,Y.jsx)(`span`,{className:`font-medium text-sm text-gray-700 dark:text-foreground`,children:n.name}),t[0]=n.name,t[1]=a);let o;t[2]===n.path?o=t[3]:(o=(0,Y.jsx)(`span`,{className:`truncate w-full text-muted-foreground text-xs`,children:n.path}),t[2]=n.path,t[3]=o);let s;t[4]!==a||t[5]!==o?(s=(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1 truncate`,children:[a,o]}),t[4]=a,t[5]=o,t[6]=s):s=t[6];let c;t[7]===n.missing?c=t[8]:(c=n.missing?(0,Y.jsx)(Wl,{className:`text-2xs rounded-sm`,variant:`warning`,children:`Missing`}):null,t[7]=n.missing,t[8]=c);let l;t[9]!==r||t[10]!==n.missing||t[11]!==s||t[12]!==c?(l=(0,Y.jsxs)(`button`,{type:`button`,onClick:r,disabled:n.missing,className:`flex min-w-0 flex-1 items-center text-left disabled:cursor-not-allowed py-3.5 px-4 hover:bg-accent rounded-lg gap-2 justify-between`,children:[s,c]}),t[9]=r,t[10]=n.missing,t[11]=s,t[12]=c,t[13]=l):l=t[13];let u;return t[14]!==i||t[15]!==l?(u=(0,Y.jsx)(`li`,{className:i,children:l}),t[14]=i,t[15]=l,t[16]=u):u=t[16],u}async function Yl(e,t){await e.project.open({path:t,target:`new-window`})}var Xl=e=>{let t=(0,Z.c)(8),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let{theme:r}=T(),i=r===void 0?`system`:r,a,o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a={success:(0,Y.jsx)(we,{className:`size-4`}),info:(0,Y.jsx)(Pi,{className:`size-4`}),warning:(0,Y.jsx)(De,{className:`size-4`}),error:(0,Y.jsx)(Wi,{className:`size-4`}),loading:(0,Y.jsx)(Ye,{className:`size-4 animate-spin`})},o={"--normal-bg":`var(--popover)`,"--normal-text":`var(--popover-foreground)`,"--normal-border":`var(--border)`,"--border-radius":`var(--radius)`},t[2]=a,t[3]=o):(a=t[2],o=t[3]);let s;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(s={classNames:{toast:`cn-toast`}},t[4]=s):s=t[4];let c;return t[5]!==n||t[6]!==i?(c=(0,Y.jsx)(jt,{theme:i,className:`toaster group`,icons:a,style:o,toastOptions:s,...n}),t[5]=n,t[6]=i,t[7]=c):c=t[7],c};function Zl(e){let{apiOrigin:t}=e;if(!t)return;let n=Symbol.for(`ok.desktop.fetchRewrite`);if(window.fetch[n])return;let r=window.fetch.bind(window),i=((e,n)=>{if(typeof e==`string`)return r(Ql(e,t),n);if(e instanceof URL)return e.pathname.startsWith(`/api/`)&&(e.origin===window.location.origin||e.protocol===`file:`)?r(t+(e.pathname+e.search+e.hash),n):r(e,n);try{let i=new URL(e.url,window.location.origin);if(i.pathname.startsWith(`/api/`)){let a=i.pathname+i.search+i.hash;return r(new Request(t+a,e),n)}}catch{}return r(e,n)});i[n]=!0,window.fetch=i}function Ql(e,t){return e.startsWith(`/api/`)?t+e:e}function $l(e){return`#/${encodeURIComponent(e)}`}function eu(e){let t=e.bridge;if(!t)return;let n=e.setHash??(e=>{window.location.hash=e});return t.onDeepLink(e=>{n($l(e.doc))})}function tu(e){let t=e.bridge;if(!t)return;let n=e.toastImpl??(e=>At.info(e));return t.onGitInitNotice(e=>{n(`Initialized git repo at ${e.gitDir}`)})}var nu=`Update ready`,ru=`Relaunch`,iu=`Release notes`,au=`Updates paused`,ou=`Download`,su=`Relaunch failed — please restart manually`;function cu(e){return`Updated to v${e}`}var lu=0,uu=1,du=2,fu=3;function pu(e,t,n=()=>{}){let r=[];return r.push(e.onUpdateDownloaded(({version:r})=>{let i=`update-downloaded-${r}`;t({id:i,body:nu,priority:du,action:{label:ru,onClick:()=>{e.update.relaunchNow().then(()=>{n(i)},()=>{t({id:`relaunch-error-${r}`,body:su,variant:`error`,priority:uu})})}}})})),r.push(e.onWhatsNew(({version:n,releaseUrl:r})=>{t({id:`whats-new-${n}`,body:cu(n),priority:fu,action:{label:iu,onClick:()=>{e.shell.openExternal(r)}}})})),r.push(e.onUpdateStuckHint(({downloadUrl:n})=>{t({id:`update-stuck-hint`,body:au,priority:lu,action:{label:ou,onClick:()=>{e.shell.openExternal(n)}}})})),()=>{for(let e of r)e()}}var mu=[],hu=new Set,gu=!1;function _u(){for(let e of hu)e()}function vu(e){let t=mu.findIndex(t=>t.id===e.id);if(t===-1)mu=[...mu,e];else{let n=mu.slice();n[t]=e,mu=n}_u()}function yu(e){let t=mu.filter(t=>t.id!==e);t.length!==mu.length&&(mu=t,_u())}function bu(){return mu}function xu(e){return hu.add(e),()=>{hu.delete(e)}}function Su(){if(gu||typeof window>`u`)return;let e=window.okDesktop;e&&(gu=!0,pu(e,vu,yu))}var Cu=1,wu=.9,Tu=.8,Eu=.17,Du=.1,Ou=.999,ku=.9999,Au=.99,ju=/[\\\/_+.#"@\[\(\{&]/,Mu=/[\\\/_+.#"@\[\(\{&]/g,Nu=/[\s-]/,Pu=/[\s-]/g;function Fu(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?Cu:Au;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=Fu(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=Cu:ju.test(e.charAt(l-1))?(d*=Tu,p=e.slice(i,l-1).match(Mu),p&&i>0&&(d*=Ou**+p.length)):Nu.test(e.charAt(l-1))?(d*=wu,m=e.slice(i,l-1).match(Pu),m&&i>0&&(d*=Ou**+m.length)):(d*=Eu,i>0&&(d*=Ou**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=ku)),(d<Du&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=Fu(e,t,n,r,l+1,a+2,o),f*Du>d&&(d=f*Du)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function Iu(e){return e.toLowerCase().replace(Pu,` `)}function Lu(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,Fu(e,t,Iu(e),Iu(t),0,0,{})}var Ru=`[cmdk-group=""]`,zu=`[cmdk-group-items=""]`,Bu=`[cmdk-group-heading=""]`,Vu=`[cmdk-item=""]`,Hu=`${Vu}:not([aria-disabled="true"])`,Uu=`cmdk-item-select`,Wu=`data-value`,Gu=(e,t,n)=>Lu(e,t,n),Ku=X.createContext(void 0),qu=()=>X.useContext(Ku),Ju=X.createContext(void 0),Yu=()=>X.useContext(Ju),Xu=X.createContext(void 0),Zu=X.forwardRef((e,t)=>{let n=dd(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=dd(()=>new Set),i=dd(()=>new Map),a=dd(()=>new Map),o=dd(()=>new Set),s=ld(e),{label:c,children:l,value:u,onValueChange:d,filter:f,shouldFilter:p,loop:m,disablePointerSelection:h=!1,vimBindings:g=!0,..._}=e,v=G(),y=G(),b=G(),x=X.useRef(null),S=md();ud(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,C.emit()}},[u]),ud(()=>{S(6,k)},[]);let C=X.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)O(),E(),S(1,D);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(b);e?e.focus():(i=document.getElementById(v))==null||i.focus()}if(S(7,()=>{n.current.selectedItemId=A()?.id,C.emit()}),r||S(5,k),s.current?.value!==void 0){let e=t??``;(o=(a=s.current).onValueChange)==null||o.call(a,e);return}}C.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),w=X.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,T(t,r)),S(2,()=>{E(),C.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),S(3,()=>{O(),E(),n.current.value||D(),C.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=A();S(4,()=>{O(),t?.getAttribute(`id`)===e&&D(),C.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>s.current.shouldFilter,label:c||e[`aria-label`],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:v,inputId:b,labelId:y,listInnerRef:x}),[]);function T(e,t){let r=s.current?.filter??Gu;return e?r(e,n.current.search,t):0}function E(){if(!n.current.search||s.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=x.current;j().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(zu);t?t.appendChild(e.parentElement===t?e:e.closest(`${zu} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${zu} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=x.current?.querySelector(`${Ru}[${Wu}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function D(){let e=j().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(Wu);C.setState(`value`,e||void 0)}function O(){if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=T(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function k(){var e;let t=A();t&&(t.parentElement?.firstChild===t&&((e=t.closest(Ru)?.querySelector(Bu))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function A(){return x.current?.querySelector(`${Vu}[aria-selected="true"]`)}function j(){return Array.from(x.current?.querySelectorAll(Hu)||[])}function M(e){let t=j()[e];t&&C.setState(`value`,t.getAttribute(Wu))}function N(e){var t;let n=A(),r=j(),i=r.findIndex(e=>e===n),a=r[i+e];(t=s.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&C.setState(`value`,a.getAttribute(Wu))}function P(e){let t=A()?.closest(Ru),n;for(;t&&!n;)t=e>0?sd(t,Ru):cd(t,Ru),n=t?.querySelector(Hu);n?C.setState(`value`,n.getAttribute(Wu)):N(e)}let F=()=>M(j().length-1),I=e=>{e.preventDefault(),e.metaKey?F():e.altKey?P(1):N(1)},ee=e=>{e.preventDefault(),e.metaKey?M(0):e.altKey?P(-1):N(-1)};return X.createElement(ie.div,{ref:t,tabIndex:-1,..._,"cmdk-root":``,onKeyDown:e=>{var t;(t=_.onKeyDown)==null||t.call(_,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:g&&e.ctrlKey&&I(e);break;case`ArrowDown`:I(e);break;case`p`:case`k`:g&&e.ctrlKey&&ee(e);break;case`ArrowUp`:ee(e);break;case`Home`:e.preventDefault(),M(0);break;case`End`:e.preventDefault(),F();break;case`Enter`:{e.preventDefault();let t=A();if(t){let e=new Event(Uu);t.dispatchEvent(e)}}}}},X.createElement(`label`,{"cmdk-label":``,htmlFor:w.inputId,id:w.labelId,style:_d},c),gd(e,e=>X.createElement(Ju.Provider,{value:C},X.createElement(Ku.Provider,{value:w},e))))}),Qu=X.forwardRef((e,t)=>{let n=G(),r=X.useRef(null),i=X.useContext(Xu),a=qu(),o=ld(e),s=o.current?.forceMount??i?.forceMount;ud(()=>{if(!s)return a.item(n,i?.id)},[s]);let c=pd(n,r,[e.value,e.children,r],e.keywords),l=Yu(),u=fd(e=>e.value&&e.value===c.current),d=fd(e=>s||a.filter()===!1?!0:e.search?e.filtered.items.get(n)>0:!0);X.useEffect(()=>{let t=r.current;if(!(!t||e.disabled))return t.addEventListener(Uu,f),()=>t.removeEventListener(Uu,f)},[d,e.onSelect,e.disabled]);function f(){var e,t;p(),(t=(e=o.current).onSelect)==null||t.call(e,c.current)}function p(){l.setState(`value`,c.current,!0)}if(!d)return null;let{disabled:m,value:h,onSelect:g,forceMount:_,keywords:v,...y}=e;return X.createElement(ie.div,{ref:se(r,t),...y,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!m,"aria-selected":!!u,"data-disabled":!!m,"data-selected":!!u,onPointerMove:m||a.getDisablePointerSelection()?void 0:p,onClick:m?void 0:f},e.children)}),$u=X.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=G(),s=X.useRef(null),c=X.useRef(null),l=G(),u=qu(),d=fd(e=>i||u.filter()===!1?!0:e.search?e.filtered.groups.has(o):!0);ud(()=>u.group(o),[]),pd(o,s,[e.value,e.heading,c]);let f=X.useMemo(()=>({id:o,forceMount:i}),[i]);return X.createElement(ie.div,{ref:se(s,t),...a,"cmdk-group":``,role:`presentation`,hidden:d?void 0:!0},n&&X.createElement(`div`,{ref:c,"cmdk-group-heading":``,"aria-hidden":!0,id:l},n),gd(e,e=>X.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?l:void 0},X.createElement(Xu.Provider,{value:f},e))))}),ed=X.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=X.useRef(null),a=fd(e=>!e.search);return!n&&!a?null:X.createElement(ie.div,{ref:se(i,t),...r,"cmdk-separator":``,role:`separator`})}),td=X.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=Yu(),o=fd(e=>e.search),s=fd(e=>e.selectedItemId),c=qu();return X.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),X.createElement(ie.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),nd=X.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=X.useRef(null),o=X.useRef(null),s=fd(e=>e.selectedItemId),c=qu();return X.useEffect(()=>{if(o.current&&a.current){let e=o.current,t=a.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),X.createElement(ie.div,{ref:se(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},gd(e,e=>X.createElement(`div`,{ref:se(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),rd=X.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return X.createElement(Gt,{open:n,onOpenChange:r},X.createElement(Lt,{container:o},X.createElement(It,{"cmdk-overlay":``,className:i}),X.createElement(Vt,{"aria-label":e.label,"cmdk-dialog":``,className:a},X.createElement(Zu,{ref:t,...s}))))}),id=X.forwardRef((e,t)=>fd(e=>e.filtered.count===0)?X.createElement(ie.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),ad=X.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return X.createElement(ie.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},gd(e,e=>X.createElement(`div`,{"aria-hidden":!0},e)))}),od=Object.assign(Zu,{List:nd,Item:Qu,Input:td,Group:$u,Separator:ed,Dialog:rd,Empty:id,Loading:ad});function sd(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function cd(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function ld(e){let t=X.useRef(e);return ud(()=>{t.current=e}),t}var ud=typeof window>`u`?X.useEffect:X.useLayoutEffect;function dd(e){let t=X.useRef();return t.current===void 0&&(t.current=e()),t}function fd(e){let t=Yu(),n=()=>e(t.snapshot());return X.useSyncExternalStore(t.subscribe,n,n)}function pd(e,t,n,r=[]){let i=X.useRef(),a=qu();return ud(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(Wu,s),i.current=s}),i}var md=()=>{let[e,t]=X.useState(),n=dd(()=>new Map);return ud(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function hd(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function gd({asChild:e,children:t},n){return e&&X.isValidElement(t)?X.cloneElement(hd(t),{ref:t.ref},n(t.props.children)):n(t)}var _d={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`};function vd(e){let t=(0,Z.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=W(`flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Y.jsx)(od,{"data-slot":`command`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function yd(e){let t=(0,Z.c)(26),n,r,i,a,o,s;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6]):({title:a,description:o,children:n,className:r,showCloseButton:s,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s);let c=a===void 0?`Command Palette`:a,l=o===void 0?`Search for a command to run…`:o,u=s===void 0?!0:s,d;t[7]===c?d=t[8]:(d=(0,Y.jsx)(qt,{children:c}),t[7]=c,t[8]=d);let f;t[9]===l?f=t[10]:(f=(0,Y.jsx)(Bt,{children:l}),t[9]=l,t[10]=f);let p;t[11]!==d||t[12]!==f?(p=(0,Y.jsxs)(Wt,{className:`sr-only`,children:[d,f]}),t[11]=d,t[12]=f,t[13]=p):p=t[13];let m;t[14]===r?m=t[15]:(m=W(`overflow-hidden p-0`,r),t[14]=r,t[15]=m);let h;t[16]===n?h=t[17]:(h=(0,Y.jsx)(vd,{className:`[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5`,children:n}),t[16]=n,t[17]=h);let g;t[18]!==u||t[19]!==m||t[20]!==h?(g=(0,Y.jsx)(Kt,{className:m,showCloseButton:u,children:h}),t[18]=u,t[19]=m,t[20]=h,t[21]=g):g=t[21];let _;return t[22]!==i||t[23]!==p||t[24]!==g?(_=(0,Y.jsxs)(Jt,{...i,children:[p,g]}),t[22]=i,t[23]=p,t[24]=g,t[25]=_):_=t[25],_}function bd(e){let t=(0,Z.c)(9),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]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Y.jsx)(ra,{className:`size-4 shrink-0 opacity-50`}),t[3]=i):i=t[3];let a;t[4]===n?a=t[5]:(a=W(`flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50`,n),t[4]=n,t[5]=a);let o;return t[6]!==r||t[7]!==a?(o=(0,Y.jsxs)(`div`,{"data-slot":`command-input-wrapper`,className:`flex h-9 items-center gap-2 border-b px-3`,children:[i,(0,Y.jsx)(od.Input,{"data-slot":`command-input`,className:a,...r})]}),t[6]=r,t[7]=a,t[8]=o):o=t[8],o}function xd(e){let t=(0,Z.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=W(`max-h-[300px] scroll-py-1 overflow-y-auto overflow-x-hidden`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Y.jsx)(od.List,{"data-slot":`command-list`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Sd(e){let t=(0,Z.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Y.jsx)(od.Empty,{"data-slot":`command-empty`,className:`py-6 text-center text-sm`,...e}),t[0]=e,t[1]=n),n}function Cd(e){let t=(0,Z.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=W(`overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group-heading]]:text-xs`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Y.jsx)(od.Group,{"data-slot":`command-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function wd(e){let t=(0,Z.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=W(`-mx-1 h-px bg-border`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Y.jsx)(od.Separator,{"data-slot":`command-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Td(e){let t=(0,Z.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=W(`relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none data-disabled:pointer-events-none data-disabled:opacity-50 data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 [&_svg:not([class*='text-'])]:text-muted-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Y.jsx)(od.Item,{"data-slot":`command-item`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Ed(e){let t=(0,Z.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=W(`ml-auto text-muted-foreground text-xs tracking-widest`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Y.jsx)(`span`,{"data-slot":`command-shortcut`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var Dd=`Switch Project…`,Od=[{id:`claude-cowork`,displayName:`Claude Cowork`,appBrandName:`Claude Desktop`,schemes:[`claude:`],installUrl:`https://claude.com/download`,hasWebFallback:!0},{id:`claude-code`,displayName:`Claude Code`,appBrandName:`Claude Desktop`,schemes:[`claude:`],installUrl:`https://claude.com/download`,hasWebFallback:!0},{id:`codex`,displayName:`Codex`,appBrandName:`Codex Desktop`,schemes:[`codex:`],installUrl:`https://openai.com/codex`},{id:`cursor`,displayName:`Cursor`,schemes:[`cursor:`],installUrl:`https://cursor.com/`}];function kd(){let e=(0,Z.c)(3),[t,n]=(0,X.useState)(Md),r,i;return e[0]===t?(r=e[1],i=e[2]):(r=()=>{if(t!==null||typeof window>`u`||window.okDesktop)return;let e=!0;return fetch(`/api/workspace`).then(async t=>{let r=await t.json().catch(jd);e&&t.ok&&r?.ok&&typeof r.contentDir==`string`&&(r.pathSeparator===`/`||r.pathSeparator===`\\`)&&n({contentDir:r.contentDir,pathSeparator:r.pathSeparator})}).catch(Ad),()=>{e=!1}},i=[t],e[0]=t,e[1]=r,e[2]=i),(0,X.useEffect)(r,i),t}function Ad(e){console.warn(`[useWorkspace] /api/workspace fetch failed:`,e)}function jd(){return null}function Md(){return Nd()}function Nd(e=typeof window>`u`?void 0:window){if(!e)return null;let t=e.okDesktop;return t?{contentDir:t.config.projectPath,pathSeparator:t.platform===`win32`?`\\`:`/`}:null}async function Pd(e,t={}){let n=t.okDesktop??(typeof window<`u`?window.okDesktop:void 0);if(n?.shell?.openExternal)try{return await n.shell.openExternal(e),{ok:!0}}catch(e){return{ok:!1,reason:`dispatch-error`,detail:Fd(e)}}let r=t.doc??(typeof document<`u`?document:void 0);if(!r)return{ok:!1,reason:`dispatch-error`,detail:`no DOM available`};try{let t=r.createElement(`a`);return t.href=e,t.rel=`noopener noreferrer`,/^https?:/i.test(e)&&(t.target=`_blank`),r.body.appendChild(t),t.click(),t.remove(),{ok:!0}}catch(e){return{ok:!1,reason:`dispatch-error`,detail:Fd(e)}}}function Fd(e){if(e instanceof Error)return e.message;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}var Id=1e3,Ld=1500;function Rd(e){return new Promise(t=>setTimeout(t,e))}async function zd(e,t={}){let n=t.spawnCursor??(typeof window<`u`?window.okDesktop?.shell.spawnCursor:void 0);if(!n)return{ok:!1,reason:`web-host-cursor-unsupported`};let r=await n(e.projectDir);if(!r.ok)return Bd(r.reason);let i=t.isCursorRunning&&await t.isCursorRunning().catch(()=>!1)?Id:Ld;return await(t.sleep??Rd)(i),Pd(dn(e),t.openExternalDeps)}function Bd(e){switch(e){case`not-installed`:return{ok:!1,reason:`not-installed`,detail:`cursor binary not found`};case`invalid-path`:return{ok:!1,reason:`invalid-payload`,detail:`cursor spawn: invalid path`};case`timeout`:return{ok:!1,reason:`dispatch-error`,detail:`cursor spawn: timeout`};case`spawn-error`:return{ok:!1,reason:`dispatch-error`,detail:`cursor spawn: spawn-error`};default:return{ok:!1,reason:`dispatch-error`,detail:`cursor spawn: ${String(e)}`}}}async function Vd(e,t={}){switch(e.target){case`claude-cowork`:return Pd(xn({mode:`cowork`},e),t.openExternalDeps);case`claude-code`:return Pd(xn({mode:`code`},e),t.openExternalDeps);case`codex`:return Pd(Rn(e),t.openExternalDeps);case`cursor`:return zd(e,{...t.cursorDeps,openExternalDeps:t.cursorDeps?.openExternalDeps??t.openExternalDeps});default:{let t=e.target;return{ok:!1,reason:`invalid-payload`,detail:`unknown target: ${String(t)}`}}}}async function Hd(e,t={}){let n=t.okDesktop??(typeof window<`u`?window.okDesktop:void 0);if(n?.shell?.recordHandoff)try{await n.shell.recordHandoff(e)}catch(e){(t.warn??(e=>console.warn(e)))(`[handoff] recordHandoff IPC rejected (telemetry skipped): ${e instanceof Error?e.message:String(e)}`)}}function Ud(e,t,n){let r=n===`\\`?t.replaceAll(`/`,`\\`):t;return`${e.endsWith(n)?e.slice(0,-1):e}${n}${r}`}function Wd(e){return`${e}.md`}function Gd(e){if(!e.docName||!e.workspace)return null;let t=Wd(e.docName),{contentDir:n,pathSeparator:r}=e.workspace;return{docContext:{relativePath:t},projectDir:n,docPath:Ud(n,t,r)}}function Kd(e){return`Opened in ${e}.`}function qd(e,t=1){return t>=3?`Couldn't reach ${e} — please try again later.`:t===2?`Still couldn't reach ${e} — try one more time?`:`Couldn't reach ${e} — try again?`}function Jd(e){return e>=3?null:e===2?`Try one more time`:`Retry`}function Yd(e,t,n,r){return t.ok?{target:e,host:n,outcome:`ok`,ts:r}:{target:e,host:n,outcome:`error`,ts:r,reason:t.reason}}async function Xd(e,t,n,r=1){let i={target:e,projectDir:t.projectDir,docPath:t.docPath,prompt:yn(t.docContext)},a=await n.dispatchHandoff(i),o=Yd(e,a,n.isElectronHost()?`electron`:`web`,n.now().toISOString());await n.recordHandoff(o);let s=n.getDisplayName(e);if(a.ok)n.toast.success(Kd(s));else{let i=Jd(r),a=qd(s,r);i===null?n.toast.error(a):n.toast.error(a,{action:{label:i,onClick:()=>{Xd(e,t,n,r+1)}}})}return a}function Zd(e){return Od.find(t=>t.id===e)?.displayName??e}function Qd(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function $d(){return{dispatchHandoff:Vd,recordHandoff:Hd,toast:{success:e=>{At.success(e)},error:(e,t)=>{At.error(e,t?{action:t.action}:void 0)}},now:()=>new Date,isElectronHost:()=>Qd(),getDisplayName:Zd}}function ef(){return{dispatch:(e,t)=>Xd(e,t,$d())}}var tf=[...new Set(Od.flatMap(e=>e.schemes))];function nf(e,t){let n=t.now?.()??Date.now(),r={};for(let i of Od){if(!t.isElectronHost&&i.id===`cursor`){r[i.id]={installed:!1,lastChecked:n};continue}let a=i.schemes[0],o=a===void 0?void 0:e[a];if(!o){r[i.id]={installed:null};continue}r[i.id]={installed:o.installed,...o.displayName===void 0?{}:{displayName:o.displayName},lastChecked:n}}return r}function rf(e){return nf({},e)}async function af(e){let t=e.schemes??tf,n=await Promise.all(t.map(async t=>{let n=t.replace(/:$/,``);try{return[t,await e.detectProtocol(n)]}catch{return[t,{installed:!1}]}}));return Object.fromEntries(n)}var of=Object.fromEntries(tf.map(e=>[e,{installed:!1}]));async function sf(e){let t;try{t=await e.fetch(`/api/installed-agents`,{signal:e.signal,headers:{Accept:`application/json`}})}catch(e){if(e.name===`AbortError`)throw e;return of}if(!t.ok)return of;let n;try{n=await t.json()}catch{return of}if(typeof n!=`object`||!n||Array.isArray(n))return of;let r=n,i={};for(let e of tf)i[e]={installed:r[e.replace(/:$/,``)]===!0};return i}function cf(e,t){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n){let n=e[r],i=t[r];if(!n||!i||n.installed!==i.installed||n.displayName!==i.displayName)return!1}return!0}function lf(e){let t=e.throttleMs??1e4,n=!1,r=null,i=null,a={},o=rf({isElectronHost:e.isElectronHost(),now:e.now}),s=new Set,c=()=>{if(!n)for(let e of s)e(o)},l=()=>{o=nf(a,{isElectronHost:e.isElectronHost(),now:e.now})};return{probe:async()=>{if(n)return;if(i)return i;if(r!==null&&e.now()-r<t)return;let o=(async()=>{try{let t=await e.probe();if(n)return;let i=!cf(a,t);a=t,i&&(l(),c()),r=e.now()}catch{}finally{i=null}})();return i=o,o},getTargetStates:()=>o,subscribe:e=>(s.add(e),()=>{s.delete(e)}),cancel:()=>{n=!0,s.clear()}}}function uf(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function df(){let e=typeof window<`u`?window.okDesktop:void 0;if(e){let t=t=>e.shell.detectProtocol(t);return{probe:()=>af({detectProtocol:t}),isElectronHost:()=>!0,now:Date.now}}let t=globalThis.fetch.bind(globalThis);return{probe:()=>sf({fetch:t}),isElectronHost:()=>!1,now:Date.now}}function ff(){let e=(0,Z.c)(5),[t,n]=(0,X.useState)(pf),r=(0,X.useRef)(null),i,a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{let e=lf(df());r.current=e;let t=e.subscribe(n);return e.probe(),()=>{t(),e.cancel(),r.current=null}},a=[],e[0]=i,e[1]=a):(i=e[0],a=e[1]),(0,X.useEffect)(i,a);let o;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>r.current?.probe()??Promise.resolve(),e[2]=o):o=e[2];let s;return e[3]===t?s=e[4]:(s={states:t,refresh:o},e[3]=t,e[4]=s),s}function pf(){return rf({isElectronHost:uf(),now:Date.now})}var mf=(e,t,n)=>ya(e,t,n,`CommandPalette`);function hf(e){let t=(0,Z.c)(47),{bridge:n}=e,[r,i]=(0,X.useState)(!1),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=[],t[0]=a):a=t[0];let[o,s]=(0,X.useState)(a),{activeDocName:c}=ut(),l=kd(),{states:u,refresh:d}=ff(),{dispatch:f}=ef(),p=Gd({docName:c,workspace:l}),m;t[1]!==n.project||t[2]!==r||t[3]!==d?(m=()=>{if(!r)return;let e=!1;return mf(async()=>{let t=await n.project.listRecent();e||s(t)},`Failed to load recent projects.`),d(),()=>{e=!0}},t[1]=n.project,t[2]=r,t[3]=d,t[4]=m):m=t[4];let h;t[5]!==n||t[6]!==r||t[7]!==d?(h=[r,n,d],t[5]=n,t[6]=r,t[7]=d,t[8]=h):h=t[8],(0,X.useEffect)(m,h);let g,_;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&(e.key===`k`||e.key===`K`)&&(e.preventDefault(),i(gf))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},_=[],t[9]=g,t[10]=_):(g=t[9],_=t[10]),(0,X.useEffect)(g,_);let v;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(v=(e,t)=>{let n=t===void 0?`Command failed.`:t;i(!1),mf(async()=>{await e()},n)},t[11]=v):v=t[11];let y=v,b=n.config.projectPath,x;t[12]===b?x=t[13]:(x=e=>e.path!==b,t[12]=b,t[13]=x);let S=o.filter(x),C=yd,w;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Y.jsx)(bd,{placeholder:`Type a command or search recent projects…`}),t[14]=w):w=t[14];let T=xd,E;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Y.jsx)(Sd,{children:`No matching commands.`}),t[15]=E):E=t[15];let D;t[16]!==n.dialog||t[17]!==n.project?(D=()=>y(async()=>{let e=await n.dialog.openFolder();e&&await n.project.open({path:e,target:`new-window`})}),t[16]=n.dialog,t[17]=n.project,t[18]=D):D=t[18];let O,k,A;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Y.jsx)(nt,{}),k=(0,Y.jsx)(`span`,{children:`Open folder on disk…`}),A=(0,Y.jsx)(Ed,{children:`⌘O`}),t[19]=O,t[20]=k,t[21]=A):(O=t[19],k=t[20],A=t[21]);let j;t[22]===D?j=t[23]:(j=(0,Y.jsxs)(Td,{onSelect:D,"data-testid":`command-palette-open-folder`,children:[O,k,A]}),t[22]=D,t[23]=j);let M;t[24]===n.navigator?M=t[25]:(M=()=>y(()=>n.navigator.open(),`Failed to open Project Navigator.`),t[24]=n.navigator,t[25]=M);let N,P,F;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Y.jsx)(Ii,{}),P=(0,Y.jsx)(`span`,{children:Dd}),F=(0,Y.jsx)(Ed,{children:`⌘⇧N`}),t[26]=N,t[27]=P,t[28]=F):(N=t[26],P=t[27],F=t[28]);let I;t[29]===M?I=t[30]:(I=(0,Y.jsxs)(Td,{value:`switch-project navigator projects`,onSelect:M,"data-testid":`command-palette-switch-project`,children:[N,P,F]}),t[29]=M,t[30]=I);let ee;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(ee=()=>{i(!1),window.location.hash=`#install-claude-desktop`},t[31]=ee):ee=t[31];let L;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Y.jsxs)(Td,{onSelect:ee,"data-testid":`command-palette-install-claude-desktop`,children:[(0,Y.jsx)(Si,{}),(0,Y.jsx)(`span`,{children:`Install for Claude Chat & Cowork (Desktop App)…`})]}),t[32]=L):L=t[32];let R;t[33]!==j||t[34]!==I?(R=(0,Y.jsxs)(Cd,{heading:`Project`,children:[j,I,L]}),t[33]=j,t[34]=I,t[35]=R):R=t[35];let z=c?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(wd,{}),(0,Y.jsx)(Cd,{heading:`Open in agent`,children:Od.map(e=>{let t=u[e.id],n=t.installed===!0&&p!==null,r=t.installed===null?`Detecting…`:t.installed===!1?`Not installed`:p===null?`No active doc`:null,a=r?`Open in ${e.displayName}, ${r}`:`Open in ${e.displayName}`;return(0,Y.jsxs)(Td,{value:`open-in-agent ${e.id} ${e.displayName}`,disabled:!n,onSelect:()=>{!n||!p||(i(!1),f(e.id,p))},"data-testid":`command-palette-open-in-${e.id}`,"aria-label":a,children:[(0,Y.jsxs)(`span`,{className:`flex-1`,children:[`Open in `,e.displayName]}),r?(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`ml-auto text-muted-foreground text-xs`,children:r}):null]},e.id)})})]}):null,B=S.length>0?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(wd,{}),(0,Y.jsx)(Cd,{heading:`Recent projects`,children:S.slice(0,10).map(e=>(0,Y.jsxs)(Td,{value:`${e.name} ${e.path}`,disabled:e.missing,onSelect:()=>y(()=>n.project.open({path:e.path,target:`new-window`})),"data-testid":`command-palette-recent-${e.path}`,children:[(0,Y.jsx)(xe,{}),(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,Y.jsx)(`span`,{className:`truncate font-medium`,children:e.name}),(0,Y.jsxs)(`span`,{className:`truncate text-muted-foreground text-xs`,children:[e.path,e.missing?` (missing)`:``]})]})]},e.path))})]}):null,V;t[36]!==T||t[37]!==E||t[38]!==R||t[39]!==z||t[40]!==B?(V=(0,Y.jsxs)(T,{className:`subtle-scrollbar`,children:[E,R,z,B]}),t[36]=T,t[37]=E,t[38]=R,t[39]=z,t[40]=B,t[41]=V):V=t[41];let H;return t[42]!==C||t[43]!==r||t[44]!==w||t[45]!==V?(H=(0,Y.jsxs)(C,{open:r,onOpenChange:i,title:`Project Command Palette`,description:`Open a folder, switch to a recent project, or open the Project Navigator.`,children:[w,V]}),t[42]=C,t[43]=r,t[44]=w,t[45]=V,t[46]=H):H=t[46],H}function gf(e){return!e}var _f=500;function vf(e,t,n){return t?`terminal`:e===null&&n?`retrying`:`hidden`}function yf(e){return e===null?`no response`:e.kind===`null-collab`?`ok ui responded but server.lock has no port yet`:e.code===`network`?"network error (is `ok ui` running?)":e.code===`invalid-body`?`/api/config returned a malformed body`:`/api/config returned HTTP ${e.code}`}function bf(){let e=(0,Z.c)(16),{collabUrl:t,collabTerminal:n,collabLastError:r,retryCollab:i}=ut(),[a,o]=(0,X.useState)(!1),s,c;e[0]!==n||e[1]!==t?(s=()=>{if(t!==null||n){o(!1);return}let e=setTimeout(()=>o(!0),_f);return()=>clearTimeout(e)},c=[t,n],e[0]=n,e[1]=t,e[2]=s,e[3]=c):(s=e[2],c=e[3]),(0,X.useEffect)(s,c);let l=vf(t,n,a);if(l===`hidden`)return null;if(l===`terminal`){let t;e[4]===r?t=e[5]:(t=yf(r),e[4]=r,e[5]=t);let n;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Y.jsx)(`code`,{className:`bg-red-100/60 px-1 rounded`,children:`ok status`}),e[6]=n):n=e[6];let a;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Y.jsx)(`code`,{className:`bg-red-100/60 px-1 rounded`,children:`.open-knowledge/last-spawn-error.log`}),e[7]=a):a=e[7];let o;e[8]===t?o=e[9]:(o=(0,Y.jsxs)(`span`,{children:[`Couldn't reach collab server — `,t,`. Try`,` `,n,` or check`,` `,a,`.`]}),e[8]=t,e[9]=o);let s;e[10]===i?s=e[11]:(s=(0,Y.jsx)(`button`,{type:`button`,onClick:i,className:`bg-red-950 text-red-50 px-2 py-0.5 rounded text-xs font-medium hover:bg-red-900`,children:`Retry`}),e[10]=i,e[11]=s);let c;return e[12]!==o||e[13]!==s?(c=(0,Y.jsxs)(`div`,{role:`alert`,"aria-live":`assertive`,className:`fixed top-0 inset-x-0 z-50 bg-red-500/95 text-red-950 text-sm text-center py-2 px-4 shadow-md flex items-center justify-center gap-3 flex-wrap`,children:[o,s]}),e[12]=o,e[13]=s,e[14]=c):c=e[14],c}let u;return e[15]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Y.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:`fixed top-0 inset-x-0 z-50 bg-amber-500/95 text-amber-950 text-sm text-center py-2 px-4 shadow-md`,children:`Connecting — waiting for collab server…`}),e[15]=u):u=e[15],u}function xf(e){let t=(0,Z.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,Y.jsx)(Xa,{"data-slot":`alert-dialog`,...n}),t[2]=n,t[3]=r),r}function Sf(e){let t=(0,Z.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,Y.jsx)(Za,{"data-slot":`alert-dialog-trigger`,...n}),t[2]=n,t[3]=r),r}function Cf(e){let t=(0,Z.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,Y.jsx)(Qa,{"data-slot":`alert-dialog-portal`,...n}),t[2]=n,t[3]=r),r}function wf(e){let t=(0,Z.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=W(`fixed inset-0 z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Y.jsx)($a,{"data-slot":`alert-dialog-overlay`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Tf(e){let t=(0,Z.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,size: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]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Y.jsx)(wf,{}),t[4]=o):o=t[4];let s;t[5]===n?s=t[6]:(s=W(`group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm 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`,n),t[5]=n,t[6]=s);let c;return t[7]!==r||t[8]!==a||t[9]!==s?(c=(0,Y.jsxs)(Cf,{children:[o,(0,Y.jsx)(eo,{"data-slot":`alert-dialog-content`,"data-size":a,className:s,...r})]}),t[7]=r,t[8]=a,t[9]=s,t[10]=c):c=t[10],c}function Ef(e){let t=(0,Z.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=W(`grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Y.jsx)(`div`,{"data-slot":`alert-dialog-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Df(e){let t=(0,Z.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=W(`-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Y.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Of(e){let t=(0,Z.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=W(`font-heading text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Y.jsx)(ro,{"data-slot":`alert-dialog-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function kf(e){let t=(0,Z.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=W(`text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Y.jsx)(io,{"data-slot":`alert-dialog-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Af(e){let t=(0,Z.c)(14),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,variant:i,size:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?`default`:i,s=a===void 0?`default`:a,c;t[5]===n?c=t[6]:(c=W(n),t[5]=n,t[6]=c);let l;t[7]!==r||t[8]!==c?(l=(0,Y.jsx)(to,{"data-slot":`alert-dialog-action`,className:c,...r}),t[7]=r,t[8]=c,t[9]=l):l=t[9];let u;return t[10]!==s||t[11]!==l||t[12]!==o?(u=(0,Y.jsx)(K,{variant:o,size:s,asChild:!0,children:l}),t[10]=s,t[11]=l,t[12]=o,t[13]=u):u=t[13],u}function jf(e){let t=(0,Z.c)(14),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,variant:i,size:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?`outline`:i,s=a===void 0?`default`:a,c;t[5]===n?c=t[6]:(c=W(n),t[5]=n,t[6]=c);let l;t[7]!==r||t[8]!==c?(l=(0,Y.jsx)(no,{"data-slot":`alert-dialog-cancel`,className:c,...r}),t[7]=r,t[8]=c,t[9]=l):l=t[9];let u;return t[10]!==s||t[11]!==l||t[12]!==o?(u=(0,Y.jsx)(K,{variant:o,size:s,asChild:!0,children:l}),t[10]=s,t[11]=l,t[12]=o,t[13]=u):u=t[13],u}var Mf=`ok-editor-mode-v1`,Nf=[`wysiwyg`,`source`],Pf=`wysiwyg`;function Ff(e){return Nf.includes(e)}function If(e=localStorage){try{let t=e.getItem(Mf);if(t===null)return Pf;if(Ff(t))return t;console.warn(`[editor-mode] invalid persisted value, falling back to default`,{raw:t})}catch{}return Pf}function Lf(e=window,t=localStorage){let n=e.__OK_EDITOR_MODE__;return Ff(n)?n:If(t)}function Rf(e,t=localStorage){try{return t.setItem(Mf,e),!0}catch(e){return console.warn(`[editor-mode] persist failed`,e),!1}}function zf(){let e=(0,Z.c)(3),[t,n]=(0,X.useState)(Lf),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=function(e){n(e),Rf(e)},e[0]=r):r=e[0];let i=r,a;return e[1]===t?a=e[2]:(a=[t,i],e[1]=t,e[2]=a),a}async function Bf(){try{let e=await fetch(`/api/sync/status`);return e.ok?{status:await e.json()}:{status:null,error:`server`}}catch{return{status:null,error:`network`}}}function Vf(){return Hf().status}function Hf(){let e=(0,Z.c)(8),[t,n]=(0,X.useState)(null),[r,i]=(0,X.useState)(null),a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=function(){Bf().then(e=>{let{status:t,error:r}=e;i(r??null),t&&n(t)})},e[0]=a):a=e[0];let o=a,s,c;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{o()},c=[],e[1]=s,e[2]=c):(s=e[1],c=e[2]),(0,X.useEffect)(s,c);let l,u;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>Fn(e=>{e.includes(`sync-status`)&&o()}),u=[],e[3]=l,e[4]=u):(l=e[3],u=e[4]),(0,X.useEffect)(l,u);let d;return e[5]!==r||e[6]!==t?(d={status:t,fetchError:r},e[5]=r,e[6]=t,e[7]=d):d=e[7],d}async function Uf(e,t){let n=e.getReader(),r=new TextDecoder,i=``;for(;;){let{done:e,value:a}=await n.read();if(e)return i+=r.decode(),!!(i.trim()&&t(i)===`terminal`);i+=r.decode(a,{stream:!0});let o=i.split(`
17
17
  `);i=o.pop()??``;for(let e of o)if(e.trim()&&t(e)===`terminal`)return!0}}async function Wf(e){try{await navigator.clipboard.writeText(e)}catch{}}var Gf=120*1e3;function Kf(e){let t=(0,Z.c)(25),{onSuccess:n,onCancel:r}=e,[i,a]=(0,X.useState)(null),[o,s]=(0,X.useState)(`https://github.com/login/device`),[c,l]=(0,X.useState)(!1),[u,d]=(0,X.useState)(null),[f,p]=(0,X.useState)(!1),[m,h]=(0,X.useState)(Gf),g=(0,X.useRef)(null),_=(0,X.useRef)(null),v;t[0]===n?v=t[1]:(v=async function(e){d(null),p(!0);try{let t=await fetch(`/api/local-op/auth/login`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({json:!0}),signal:e.signal});if(!t.ok||!t.body){d(`Failed to start sign-in — try again`),p(!1);return}await Uf(t.body,e=>{try{let t=JSON.parse(e);if(t.type===`verification`)a(t.user_code),s(t.verification_uri),h(t.expires_in*1e3),Wf(t.user_code).then(()=>{l(!0),setTimeout(()=>l(!1),2e3)});else if(t.type===`complete`)return p(!1),n({login:t.login,name:t.name,email:t.email,avatarUrl:t.avatarUrl}),`terminal`;else if(t.type===`error`)return d(t.message),p(!1),`terminal`}catch{}return`continue`})||(d(`Sign-in stream ended without confirmation — please try again`),p(!1))}catch(e){let t=e;t instanceof Error&&t.name!==`AbortError`&&d(`Connection error — try again`),p(!1)}},t[0]=n,t[1]=v);let y=v,b;t[2]===y?b=t[3]:(b=()=>{let e=new AbortController;return g.current=e,y(e),()=>{e.abort(),_.current&&clearInterval(_.current)}},t[2]=y,t[3]=b);let x;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(x=[],t[4]=x):x=t[4],(0,X.useEffect)(b,x);let S,C;t[5]===i?(S=t[6],C=t[7]):(S=()=>{if(!i)return;let e=Date.now();return _.current=setInterval(()=>{let t=Gf-(Date.now()-e);t<=0?(h(0),_.current&&clearInterval(_.current),d(`Code expired — please try again`)):h(t)},1e3),()=>{_.current&&clearInterval(_.current)}},C=[i],t[5]=i,t[6]=S,t[7]=C),(0,X.useEffect)(S,C);let w=Math.floor(m/6e4),T=Math.floor(m%6e4/1e3),E;t[8]===T?E=t[9]:(E=T.toString().padStart(2,`0`),t[8]=T,t[9]=E);let D=`${w}:${E}`,O;t[10]!==c||t[11]!==u||t[12]!==D||t[13]!==i||t[14]!==o?(O=i?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Open`,` `,(0,Y.jsx)(`a`,{href:o,target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-2`,children:o}),` `,`and enter this code:`]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`code`,{className:`flex-1 text-center text-2xl font-mono font-bold tracking-widest border rounded-md py-3 bg-muted`,children:i}),(0,Y.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void Wf(i).then(()=>{l(!0),setTimeout(()=>l(!1),2e3)}),children:c?`Copied!`:`Copy`})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-muted-foreground`,children:[(0,Y.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,Y.jsx)(`span`,{className:`size-1.5 rounded-full bg-amber-500 animate-pulse`}),`Waiting for authorization…`]}),(0,Y.jsxs)(`span`,{children:[`Expires in `,D]})]})]}):(0,Y.jsx)(`div`,{className:`flex items-center justify-center py-6 text-sm text-muted-foreground`,children:u?null:`Starting sign-in flow…`}),t[10]=c,t[11]=u,t[12]=D,t[13]=i,t[14]=o,t[15]=O):O=t[15];let k;t[16]===u?k=t[17]:(k=u&&(0,Y.jsx)(`p`,{className:`text-sm text-destructive`,children:u}),t[16]=u,t[17]=k);let A;t[18]!==r||t[19]!==f?(A=f&&(0,Y.jsx)(K,{variant:`ghost`,size:`sm`,onClick:r,children:`Cancel`}),t[18]=r,t[19]=f,t[20]=A):A=t[20];let j;return t[21]!==O||t[22]!==k||t[23]!==A?(j=(0,Y.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[O,k,A]}),t[21]=O,t[22]=k,t[23]=A,t[24]=j):j=t[24],j}function qf(e){let t=(0,Z.c)(32),{onSuccess:n,onCancel:r}=e,[i,a]=(0,X.useState)(``),[o,s]=(0,X.useState)(!1),[c,l]=(0,X.useState)(null),u=(0,X.useRef)(null),d,f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>()=>{u.current?.abort()},f=[],t[0]=d,t[1]=f):(d=t[0],f=t[1]),(0,X.useEffect)(d,f);let p;t[2]!==n||t[3]!==i?(p=async function(){if(!i.trim()){l(`Paste a personal access token`);return}u.current?.abort();let e=new AbortController;u.current=e,s(!0),l(null);try{let t=await fetch(`/api/local-op/auth/pat`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({pat:i.trim()}),signal:e.signal});if(!t.ok||!t.body){l(`Invalid token — check that it has repo scope`),s(!1);return}await Uf(t.body,e=>{try{let t=JSON.parse(e);if(t.type===`complete`)return n({login:t.login,name:t.name,email:t.email}),s(!1),`terminal`;if(t.type===`error`)return l(t.message),s(!1),`terminal`}catch{}return`continue`})||l(`No response — try again`)}catch(e){let t=e;t instanceof Error&&t.name!==`AbortError`&&l(`Connection error — try again`)}s(!1)},t[2]=n,t[3]=i,t[4]=p):p=t[4];let m=p,h;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Y.jsx)(`a`,{href:`https://github.com/settings/tokens`,target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-2`,children:`github.com/settings/tokens`}),t[5]=h):h=t[5];let g;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Y.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Create a token at`,` `,h,` `,`with `,(0,Y.jsx)(`code`,{className:`text-xs bg-muted px-1 rounded`,children:`repo`}),` scope.`]}),t[6]=g):g=t[6];let _;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(_=e=>a(e.target.value),t[7]=_):_=t[7];let v;t[8]===m?v=t[9]:(v=e=>{e.key===`Enter`&&m()},t[8]=m,t[9]=v);let y;t[10]!==o||t[11]!==i||t[12]!==v?(y=(0,Y.jsx)(Ue,{type:`password`,"aria-label":`Personal access token`,placeholder:`ghp_…`,value:i,onChange:_,disabled:o,onKeyDown:v}),t[10]=o,t[11]=i,t[12]=v,t[13]=y):y=t[13];let b;t[14]===c?b=t[15]:(b=c&&(0,Y.jsx)(`p`,{className:`text-sm text-destructive`,children:c}),t[14]=c,t[15]=b);let x;t[16]===m?x=t[17]:(x=()=>void m(),t[16]=m,t[17]=x);let S=o?`Validating…`:`Add token`,C;t[18]!==o||t[19]!==x||t[20]!==S?(C=(0,Y.jsx)(K,{className:`flex-1`,onClick:x,disabled:o,children:S}),t[18]=o,t[19]=x,t[20]=S,t[21]=C):C=t[21];let w;t[22]!==o||t[23]!==r?(w=(0,Y.jsx)(K,{variant:`ghost`,onClick:r,disabled:o,children:`Cancel`}),t[22]=o,t[23]=r,t[24]=w):w=t[24];let T;t[25]!==C||t[26]!==w?(T=(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[C,w]}),t[25]=C,t[26]=w,t[27]=T):T=t[27];let E;return t[28]!==T||t[29]!==y||t[30]!==b?(E=(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[g,y,b,T]}),t[28]=T,t[29]=y,t[30]=b,t[31]=E):E=t[31],E}function Jf(e){let t=(0,Z.c)(27),{login:n,onSave:r,onSkip:i}=e,[a,o]=(0,X.useState)(``),[s,c]=(0,X.useState)(``),l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Before syncing, set your identity for git commits:`}),t[0]=l):l=t[0];let u=`Name (e.g. ${n})`,d;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(d=e=>o(e.target.value),t[1]=d):d=t[1];let f;t[2]!==a||t[3]!==u?(f=(0,Y.jsx)(Ue,{"aria-label":`Name`,placeholder:u,value:a,onChange:d}),t[2]=a,t[3]=u,t[4]=f):f=t[4];let p;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(p=e=>c(e.target.value),t[5]=p):p=t[5];let m;t[6]===s?m=t[7]:(m=(0,Y.jsx)(Ue,{type:`email`,"aria-label":`Email`,placeholder:`Email`,value:s,onChange:p}),t[6]=s,t[7]=m);let h;t[8]!==s||t[9]!==a||t[10]!==r?(h=()=>r(a.trim(),s.trim()),t[8]=s,t[9]=a,t[10]=r,t[11]=h):h=t[11];let g;t[12]!==s||t[13]!==a?(g=!a.trim()||!s.trim(),t[12]=s,t[13]=a,t[14]=g):g=t[14];let _;t[15]!==h||t[16]!==g?(_=(0,Y.jsx)(K,{className:`flex-1`,onClick:h,disabled:g,children:`Save`}),t[15]=h,t[16]=g,t[17]=_):_=t[17];let v;t[18]===i?v=t[19]:(v=(0,Y.jsx)(K,{variant:`ghost`,onClick:i,children:`Skip`}),t[18]=i,t[19]=v);let y;t[20]!==v||t[21]!==_?(y=(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[_,v]}),t[20]=v,t[21]=_,t[22]=y):y=t[22];let b;return t[23]!==y||t[24]!==f||t[25]!==m?(b=(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[l,f,m,y]}),t[23]=y,t[24]=f,t[25]=m,t[26]=b):b=t[26],b}function Yf(e){let t=(0,Z.c)(37),{open:n,onOpenChange:r,onSuccess:i,identityPrompt:a,reauth:o}=e,[s,c]=(0,X.useState)(`device`),[l,u]=(0,X.useState)(`auth`),[d,f]=(0,X.useState)(null),p,m;t[0]===n?(p=t[1],m=t[2]):(p=()=>{n&&(c(`device`),u(`auth`),f(null))},m=[n],t[0]=n,t[1]=p,t[2]=m),(0,X.useEffect)(p,m);let h;t[3]!==a||t[4]!==r||t[5]!==i?(h=function(e){f(e),a&&(!e.name||!e.email)?u(`identity`):(u(`done`),i?.(e),r(!1),At.success(`Signed in as @${e.login}`))},t[3]=a,t[4]=r,t[5]=i,t[6]=h):h=t[6];let g=h,_;t[7]!==d||t[8]!==r||t[9]!==i?(_=function(e,t){fetch(`/api/local-op/auth/status`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({setIdentity:{name:e,email:t}})}).catch(Xf);let n={...d??{login:``},name:e,email:t};u(`done`),i?.(n),r(!1),At.success(`Signed in as @${n.login}`)},t[7]=d,t[8]=r,t[9]=i,t[10]=_):_=t[10];let v=_,y;t[11]!==d||t[12]!==r||t[13]!==i?(y=function(){d&&(u(`done`),i?.(d),r(!1),At.success(`Signed in as @${d.login}`))},t[11]=d,t[12]=r,t[13]=i,t[14]=y):y=t[14];let b=y,x;t[15]===r?x=t[16]:(x=function(){r(!1)},t[15]=r,t[16]=x);let S=x,C=o?`Re-authenticate with GitHub`:`Sign in to GitHub`,w;t[17]===C?w=t[18]:(w=(0,Y.jsx)(Wt,{children:(0,Y.jsx)(qt,{children:C})}),t[17]=C,t[18]=w);let T;t[19]!==g||t[20]!==S||t[21]!==l||t[22]!==s?(T=l===`auth`&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`flex gap-1 border-b pb-2 mb-1`,children:[(0,Y.jsx)(K,{variant:s===`device`?`secondary`:`ghost`,size:`sm`,onClick:()=>c(`device`),children:`GitHub App`}),(0,Y.jsx)(K,{variant:s===`pat`?`secondary`:`ghost`,size:`sm`,onClick:()=>c(`pat`),children:`Token`})]}),s===`device`?(0,Y.jsx)(Kf,{onSuccess:g,onCancel:S}):(0,Y.jsx)(qf,{onSuccess:g,onCancel:S})]}),t[19]=g,t[20]=S,t[21]=l,t[22]=s,t[23]=T):T=t[23];let E;t[24]!==d||t[25]!==v||t[26]!==b||t[27]!==l?(E=l===`identity`&&d&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`text-sm font-medium`,children:[`Signed in as @`,d.login]}),(0,Y.jsx)(Jf,{login:d.login,onSave:v,onSkip:b})]}),t[24]=d,t[25]=v,t[26]=b,t[27]=l,t[28]=E):E=t[28];let D;t[29]!==w||t[30]!==T||t[31]!==E?(D=(0,Y.jsxs)(Kt,{className:`sm:max-w-md`,children:[w,T,E]}),t[29]=w,t[30]=T,t[31]=E,t[32]=D):D=t[32];let O;return t[33]!==r||t[34]!==n||t[35]!==D?(O=(0,Y.jsx)(Jt,{open:n,onOpenChange:r,children:D}),t[33]=r,t[34]=n,t[35]=D,t[36]=O):O=t[36],O}function Xf(){}function Zf(e){let t=(0,Z.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=W(`animate-pulse rounded-md bg-muted`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Y.jsx)(`div`,{"data-slot":`skeleton`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Qf(e){switch(e){case`receiving`:return`Receiving objects`;case`resolving`:return`Resolving deltas`;case`checking`:return`Checking out files`;case`init`:return`Initializing project`;case`done`:return`Complete`;default:return`Cloning`}}function $f(e){let t=e.trim();if(/^[\w.-]+\/[\w.-]+$/.test(t))return t.split(`/`)[1];try{return new URL(t.replace(/^git@([^:]+):/,`https://$1/`)).pathname.replace(/\.git$/,``).split(`/`).pop()??`repo`}catch{return t.split(`/`).pop()?.replace(/\.git$/,``)??`repo`}}function ep(e){let t=(0,Z.c)(74),{open:n,onOpenChange:r,onSignIn:i}=e,[a,o]=(0,X.useState)(``),[s,c]=(0,X.useState)(``),[l,u]=(0,X.useState)(null),[d,f]=(0,X.useState)(!1),[p,m]=(0,X.useState)(``),[h,g]=(0,X.useState)(!1),[_,v]=(0,X.useState)(!1),[y,b]=(0,X.useState)(null),x=(0,X.useRef)(null),S,C;t[0]===n?(S=t[1],C=t[2]):(S=()=>{n&&fetch(`/api/local-op/auth/status`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({})}).then(tp).then(e=>{g(!!e.authenticated)}).catch(()=>g(!1))},C=[n],t[0]=n,t[1]=S,t[2]=C),(0,X.useEffect)(S,C);let w;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(w=async function(e){f(!0);let t=[],n=!1;try{let n=await fetch(`/api/local-op/auth/repos`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({}),signal:e}),r=n.ok?n.body?.getReader():null;if(r){let e=new TextDecoder,n=``;for(;;){let{done:i,value:a}=await r.read();if(i)break;n+=e.decode(a,{stream:!0});for(let e of n.split(`
18
18
  `))if(e.trim())try{let n=JSON.parse(e);n.repos&&t.push(...n.repos)}catch{}n=n.slice(n.lastIndexOf(`
19
19
  `)+1)}}}catch(e){let r=e;r instanceof Error&&r.name===`AbortError`?n=!0:t=[]}n||e.aborted||(u(t),f(!1))},t[3]=w):w=t[3];let T=w,E,D;t[4]!==h||t[5]!==n?(E=()=>{if(!h||!n)return;let e=new AbortController;return T(e.signal),()=>e.abort()},D=[h,n],t[4]=h,t[5]=n,t[6]=E,t[7]=D):(E=t[6],D=t[7]),(0,X.useEffect)(E,D);let O;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(O=function(e){o(e);let t=$f(e);t&&c(`~/Documents/${t}`)},t[8]=O):O=t[8];let k=O,A;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(e){o(e.clone_url);let t=e.full_name.split(`/`)[1];c(`~/Documents/${t}`)},t[9]=A):A=t[9];let j=A,M;t[10]!==s||t[11]!==r||t[12]!==a?(M=async function(){if(!a.trim()){At.error(`Enter a repository URL or owner/repo`);return}let e=new AbortController;b(e),v(!0);let t=At.loading(`Starting clone…`,{duration:1/0});x.current=t;try{let n=await fetch(`/api/local-op/clone`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({url:a.trim(),dir:s||void 0}),signal:e.signal});if(!n.ok||!n.body){At.error(`Clone failed — check the URL and try again`,{id:t}),v(!1),b(null);return}let i=n.body.getReader(),o=new TextDecoder,c=``;for(;;){let{done:e,value:n}=await i.read();if(e)break;c+=o.decode(n,{stream:!0});let a=c.split(`
20
20
  `);c=a.pop()??``;for(let e of a)if(e.trim())try{let n=JSON.parse(e);if(n.type===`progress`)At.loading(`${Qf(n.phase)} — ${n.pct}%`,{id:t});else if(n.type===`complete`){At.success(`Clone complete — opening project`,{id:t}),r(!1),v(!1),b(null),window.location.href=`http://localhost:${n.port}`;return}else if(n.type===`error`){At.error(`Clone failed: ${n.message}`,{id:t}),v(!1),b(null);return}}catch{}}At.error(`Clone stream ended unexpectedly — check if the clone completed`,{id:t}),v(!1),b(null)}catch(e){let n=e;n instanceof Error&&n.name===`AbortError`?At.dismiss(x.current??void 0):At.error(`Clone failed — connection error`,{id:t}),v(!1),b(null)}},t[10]=s,t[11]=r,t[12]=a,t[13]=M):M=t[13];let N=M,P;t[14]===y?P=t[15]:(P=function(){y?.abort(),v(!1),b(null),At.dismiss(x.current??void 0)},t[14]=y,t[15]=P);let F=P,I;t[16]!==_||t[17]!==r?(I=function(e){_||(r(e),e||(o(``),c(``),m(``)))},t[16]=_,t[17]=r,t[18]=I):I=t[18];let ee=I,L,R,z,B,V,H,te,ne,re;if(t[19]!==_||t[20]!==ee||t[21]!==h||t[22]!==d||t[23]!==n||t[24]!==p||t[25]!==l||t[26]!==a){let e=l?.filter(e=>e.full_name.toLowerCase().includes(p.toLowerCase()));R=Jt,ne=n,re=ee,L=Kt,H=`sm:max-w-lg`,t[36]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,Y.jsx)(Wt,{children:(0,Y.jsx)(qt,{children:`Clone from GitHub`})}),t[36]=te):te=t[36],z=`flex flex-col gap-4`;let r;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Y.jsx)(`label`,{htmlFor:`clone-url`,className:`text-sm font-medium`,children:`Repository URL or owner/repo`}),t[37]=r):r=t[37];let i;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(i=e=>k(e.target.value),t[38]=i):i=t[38],t[39]!==_||t[40]!==a?(B=(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[r,(0,Y.jsx)(Ue,{id:`clone-url`,placeholder:`https://github.com/owner/repo or owner/repo`,value:a,onChange:i,disabled:_})]}),t[39]=_,t[40]=a,t[41]=B):B=t[41],V=h&&(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Y.jsx)(`label`,{htmlFor:`repo-filter`,className:`text-sm font-medium`,children:`Your repositories`}),(0,Y.jsx)(Ue,{id:`repo-filter`,"aria-label":`Filter repositories`,placeholder:`Filter repositories…`,value:p,onChange:e=>m(e.target.value),disabled:_||d&&l===null}),(0,Y.jsx)(`div`,{className:`border rounded-md max-h-40 overflow-y-auto subtle-scrollbar`,"aria-busy":d&&l===null,children:d&&l===null?(0,Y.jsxs)(`output`,{className:`flex flex-col gap-1.5 px-3 py-2`,"aria-label":`Loading repositories`,children:[(0,Y.jsx)(Zf,{className:`h-4 w-2/3`}),(0,Y.jsx)(Zf,{className:`h-4 w-1/2`}),(0,Y.jsx)(Zf,{className:`h-4 w-3/4`}),(0,Y.jsx)(Zf,{className:`h-4 w-2/5`}),(0,Y.jsx)(Zf,{className:`h-4 w-3/5`})]}):e?.length===0?(0,Y.jsx)(`p`,{className:`px-3 py-2 text-xs text-muted-foreground`,children:l?.length===0?`No repositories found.`:`No matches.`}):e?.map(e=>(0,Y.jsxs)(`button`,{type:`button`,className:`w-full text-left px-3 py-1.5 text-sm hover:bg-muted flex items-center gap-2 truncate disabled:opacity-50`,onClick:()=>j(e),disabled:_,children:[e.private&&(0,Y.jsx)(`span`,{className:`text-xs text-muted-foreground shrink-0`,children:`🔒`}),e.full_name]},e.full_name))})]}),t[19]=_,t[20]=ee,t[21]=h,t[22]=d,t[23]=n,t[24]=p,t[25]=l,t[26]=a,t[27]=L,t[28]=R,t[29]=z,t[30]=B,t[31]=V,t[32]=H,t[33]=te,t[34]=ne,t[35]=re}else L=t[27],R=t[28],z=t[29],B=t[30],V=t[31],H=t[32],te=t[33],ne=t[34],re=t[35];let U;t[42]!==_||t[43]!==h||t[44]!==i?(U=!h&&(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,Y.jsx)(`span`,{children:`Browse your repos:`}),(0,Y.jsx)(K,{variant:`link`,size:`sm`,className:`h-auto p-0`,onClick:()=>i?.(),disabled:_,children:`Sign in to GitHub`})]}),t[42]=_,t[43]=h,t[44]=i,t[45]=U):U=t[45];let W;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,Y.jsx)(`label`,{htmlFor:`clone-path`,className:`text-sm font-medium`,children:`Local path`}),t[46]=W):W=t[46];let G;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(G=e=>c(e.target.value),t[47]=G):G=t[47];let ie;t[48]!==_||t[49]!==s?(ie=(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[W,(0,Y.jsx)(Ue,{id:`clone-path`,placeholder:`~/Documents/repo-name`,value:s,onChange:G,disabled:_})]}),t[48]=_,t[49]=s,t[50]=ie):ie=t[50];let ae;t[51]!==z||t[52]!==B||t[53]!==V||t[54]!==U||t[55]!==ie?(ae=(0,Y.jsxs)(`div`,{className:z,children:[B,V,U,ie]}),t[51]=z,t[52]=B,t[53]=V,t[54]=U,t[55]=ie,t[56]=ae):ae=t[56];let oe;t[57]!==_||t[58]!==F||t[59]!==N||t[60]!==ee||t[61]!==a?(oe=(0,Y.jsx)(Nt,{children:_?(0,Y.jsx)(K,{variant:`outline`,className:`font-mono uppercase`,onClick:F,children:`Cancel`}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(K,{variant:`outline`,className:`font-mono uppercase`,onClick:()=>ee(!1),children:`Cancel`}),(0,Y.jsx)(K,{onClick:()=>void N(),disabled:!a.trim(),children:`Clone`})]})}),t[57]=_,t[58]=F,t[59]=N,t[60]=ee,t[61]=a,t[62]=oe):oe=t[62];let q;t[63]!==L||t[64]!==H||t[65]!==te||t[66]!==ae||t[67]!==oe?(q=(0,Y.jsxs)(L,{className:H,children:[te,ae,oe]}),t[63]=L,t[64]=H,t[65]=te,t[66]=ae,t[67]=oe,t[68]=q):q=t[68];let se;return t[69]!==R||t[70]!==ne||t[71]!==re||t[72]!==q?(se=(0,Y.jsx)(R,{open:ne,onOpenChange:re,children:q}),t[69]=R,t[70]=ne,t[71]=re,t[72]=q,t[73]=se):se=t[73],se}function tp(e){return e.json()}function np(e){let t=(0,Z.c)(9),{onOpenResolver:n}=e,r=Vf();if(!r||r.state!==`conflict`)return null;let i=r.conflictCount,a=i>0?`${i} page${i===1?``:`s`}`:`Some pages`,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Y.jsx)(De,{className:`size-4 shrink-0`}),t[0]=o):o=t[0];let s=i===1?`has`:`have`,c;t[1]!==a||t[2]!==s?(c=(0,Y.jsxs)(`span`,{className:`flex-1`,children:[a,` `,s,` conflicting changes.`]}),t[1]=a,t[2]=s,t[3]=c):c=t[3];let l;t[4]===n?l=t[5]:(l=(0,Y.jsx)(K,{variant:`outline`,size:`xs`,className:`shrink-0 border-amber-400 dark:border-amber-700 text-amber-800 dark:text-amber-300 hover:bg-amber-100 dark:hover:bg-amber-900/50`,onClick:n,children:`Review and resolve`}),t[4]=n,t[5]=l);let u;return t[6]!==c||t[7]!==l?(u=(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 text-sm border-b bg-amber-50 dark:bg-amber-950/30 text-amber-800 dark:text-amber-300 shrink-0`,children:[o,c,l]}),t[6]=c,t[7]=l,t[8]=u):u=t[8],u}var rp=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 ip(e,t,n,r,i,a){if(e==r)return[];let o=mp(e,t,n,r,i,a),s=hp(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 rp(t,n,i,a)];if(c>l){let o=e.slice(t,n).indexOf(r.slice(i,a));if(o>-1)return[new rp(t,t+o,i,i),new rp(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 rp(t,t,i,i+o),new rp(n,n,i+o+c,a)]}if(c==1||l==1)return[new rp(t,n,i,a)];let u=_p(e,t,n,r,i,a);if(u){let[o,s,c]=u;return ip(e,t,o,r,i,s).concat(ip(e,o+c,n,r,s+c,a))}return cp(e,t,n,r,i,a)}var ap=1e9,op=0,sp=!1;function cp(e,t,n,r,i,a){let o=n-t,s=a-i;if(ap<1e9&&Math.min(o,s)>ap*16||op>0&&Date.now()>op)return Math.min(o,s)>ap*64?[new rp(t,n,i,a)]:vp(e,t,n,r,i,a);let c=Math.ceil((o+s)/2);up.reset(c),dp.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:dp,f=d?null:up;for(let p=0;p<c;p++){if(p>ap||op>0&&!(p&63)&&Date.now()>op)return vp(e,t,n,r,i,a);let m=up.advance(p,o,s,c,d,!1,l)||dp.advance(p,o,s,c,f,!0,u);if(m)return fp(e,t,n,t+m[0],r,i,a,i+m[1])}return[new rp(t,n,i,a)]}var lp=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}},up=new lp,dp=new lp;function fp(e,t,n,r,i,a,o,s){let c=!1;return!Np(e,r)&&++r==n&&(c=!0),!Np(i,s)&&++s==o&&(c=!0),c?[new rp(t,n,a,o)]:ip(e,t,r,i,a,s).concat(ip(e,r,n,i,s,o))}function pp(e,t){let n=1,r=Math.min(e,t);for(;n<r;)n<<=1;return n}function mp(e,t,n,r,i,a){if(t==n||t==a||e.charCodeAt(t)!=r.charCodeAt(i))return 0;let o=pp(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-+!Np(e,s);o>>=1}else if(i==n||l==a)return i-t;else s=i,c=l}}function hp(e,t,n,r,i,a){if(t==n||i==a||e.charCodeAt(n-1)!=r.charCodeAt(a-1))return 0;let o=pp(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-+!Np(e,s);o>>=1}else if(a==t||l==i)return n-a;else s=a,c=l}}function gp(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;;){Np(e,s)||s++;let u=s+o;if(Np(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=mp(e,u,n,r,i+f+d.length,a),c=hp(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 _p(e,t,n,r,i,a){let o=n-t,s=a-i;if(o<s){let o=_p(r,i,a,e,t,n);return o&&[o[1],o[0],o[2]]}return o<4||s*2<o?null:gp(e,t,n,r,i,a,Math.floor(o/4),-1)}function vp(e,t,n,r,i,a){sp=!0;let o=n-t,s=a-i,c;if(o<s){let s=gp(r,i,a,e,t,n,Math.floor(o/6),50);c=s&&[s[1],s[0],s[2]]}else c=gp(e,t,n,r,i,a,Math.floor(s/6),50);if(!c)return[new rp(t,n,i,a)];let[l,u,d]=c;return ip(e,t,l,r,i,u).concat(ip(e,l+d,n,r,u+d,a))}function yp(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 rp(r.fromA,i.toA,r.fromB,i.toB),e.splice(n--,1))}}function bp(e,t,n){for(;;){yp(n,1);let r=!1;for(let i=0;i<n.length;i++){let a=n[i],o,s;(o=mp(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new rp(a.fromA+o,a.toA,a.fromB+o,a.toB)),(s=hp(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new rp(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 rp(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 rp(a.fromA+d,a.toA+d,a.fromB+d,a.toB+d),r=!0)}if(!r)break}return n}function xp(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=Op(t,a.fromA,l),f=Dp(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 rp(d,d+o,a.fromB-p,a.toB-p),d=a.fromA,f=Dp(t,a.toA,c-a.toA)):l>m&&t.slice(a.toA,f)==u.slice(h,h+m)&&(a=e[i]=new rp(f-o,f,a.fromB+m,a.toB+m),f=a.toA,d=Op(t,a.fromA,a.fromA-r)),p=a.fromA-d,m=f-a.toA}if(p||m)a=e[i]=new rp(a.fromA-p,a.toA+m,a.fromB-p,a.toB+m);else if(!o){let t=Ap(n,a.fromB,a.toB),r,o=t<0?-1:kp(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=Ap(t,a.fromA,a.toA),r,o=n<0?-1:kp(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 yp(e,3),e}var Sp;try{Sp=RegExp(`[\\p{Alphabetic}\\p{Number}]`,`u`)}catch{}function Cp(e){return e>48&&e<58||e>64&&e<91||e>96&&e<123}function wp(e,t){if(t==e.length)return 0;let n=e.charCodeAt(t);return n<192?+!!Cp(n):Sp?!jp(n)||t==e.length-1?+!!Sp.test(String.fromCharCode(n)):Sp.test(e.slice(t,t+2))?2:0:0}function Tp(e,t){if(!t)return 0;let n=e.charCodeAt(t-1);return n<192?+!!Cp(n):Sp?!Mp(n)||t==1?+!!Sp.test(String.fromCharCode(n)):Sp.test(e.slice(t-2,t))?2:0:0}var Ep=8;function Dp(e,t,n){if(t==e.length||!Tp(e,t))return t;for(let r=t,i=t+n,a=0;a<Ep;a++){let t=wp(e,r);if(!t||r+t>i)return r;r+=t}return t}function Op(e,t,n){if(!t||!wp(e,t))return t;for(let r=t,i=t-n,a=0;a<Ep;a++){let t=Tp(e,r);if(!t||r-t<i)return r;r-=t}return t}function kp(e,t,n){for(;t!=n;t--)if(e.charCodeAt(t-1)==10)return t;return-1}function Ap(e,t,n){for(;t!=n;t++)if(e.charCodeAt(t)==10)return t;return-1}var jp=e=>e>=55296&&e<=56319,Mp=e=>e>=56320&&e<=57343;function Np(e,t){return!t||t==e.length||!jp(e.charCodeAt(t-1))||!Mp(e.charCodeAt(t))}function Pp(e,t,n){let r=n?.override;return r?r(e,t):(ap=(n?.scanLimit??1e9)>>1,op=n?.timeout?Date.now()+n.timeout:0,sp=!1,bp(e,t,ip(e,0,e.length,t,0,t.length)))}function Fp(){return!sp}function Ip(e,t,n){return xp(Pp(e,t,n),e,t)}var Lp=gr.define({combine:e=>e[0]}),Rp=br.define(),zp=gr.define(),Bp=Sr.define({create(e){return null},update(e,t){for(let n of t.effects)n.is(Rp)&&(e=n.value);for(let n of t.state.facet(zp))e=n(e,t);return e}});function Vp(e){let t=e.field(Bp,!1);if(!t)return null;let n=e.facet(Lp);return{chunks:t,side:n?n.side:null}}var Hp=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 Gp(Ip(e.toString(),t.toString(),n),e,t,0,0,Fp())}static updateA(e,t,n,r,i){return Yp(Jp(e,r,!0,n.length),e,t,n,i)}static updateB(e,t,n,r,i){return Yp(Jp(e,r,!1,t.length),e,t,n,i)}};function Up(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 Wp(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 Gp(e,t,n,r,i,a){let o=[];for(let s=0;s<e.length;s++){let c=e[s],[l,u]=Up(c.fromA+r,c.fromB+i,t,n),[d,f]=Wp(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]=Up(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]=Wp(a.toA+r,a.toB+i,t,n),s++}o.push(new Hp(p,l,Math.max(l,d),u,Math.max(u,f),a))}return o}var Kp=1e3;function qp(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 Jp(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>Kp&&([l,d]=qp(e,a-Kp,n,!0)),o<t.length-Kp&&([u,f]=qp(e,o+Kp,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 Yp(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=Ip(n.sliceString(d,p),r.sliceString(f,m),i);for(let e of Gp(h,n,r,d,f,Fp()))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 Xp={scanLimit:500},Zp=Dr.fromClass(class{constructor(e){({deco:this.deco,gutter:this.gutter}=sm(e))}update(e){(e.docChanged||e.viewportChanged||$p(e.startState,e.state)||em(e.startState,e.state))&&({deco:this.deco,gutter:this.gutter}=sm(e.view))}},{decorations:e=>e.deco}),Qp=Ar.low(Or({class:`cm-changeGutter`,markers:e=>e.plugin(Zp)?.gutter||mr.empty}));function $p(e,t){return e.field(Bp,!1)!=t.field(Bp,!1)}function em(e,t){return e.facet(Lp)!=t.facet(Lp)}var tm=jr.line({class:`cm-changedLine`}),nm=jr.mark({class:`cm-changedText`}),rm=jr.mark({tagName:`ins`,class:`cm-insertedLine`}),im=jr.mark({tagName:`del`,class:`cm-deletedLine`}),am=new class extends Tr{constructor(){super(...arguments),this.elementClass=`cm-changedLineGutter`}};function om(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,tm),i.add(o,s,n?im:rm),a&&a.add(o,o,am);for(let l=t.iterRange(o,s-1),u=o;!l.next().done;){if(l.lineBreak){u++,i.add(u,u,tm),a&&a.add(u,u,am);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,nm),s<t)c++;else break}u=t}}}function sm(e){let t=e.state.field(Bp),{side:n,highlightChanges:r,markGutter:i,overrideChunk:a}=e.state.facet(Lp),o=n==`a`,s=new kr,c=i?new kr: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))&&om(n,e.state.doc,o,r,s,c)}return{deco:s.finish(),gutter:c&&c.finish()}}var cm=class extends Cr{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}},lm=br.define({map:(e,t)=>e.map(t)}),um=Sr.define({create:()=>jr.none,update:(e,t)=>{for(let e of t.effects)if(e.is(lm))return e.value;return e.map(t.changes)},provide:e=>Er.decorations.from(e)}),dm=.01;function fm(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 pm(e,t,n){let r=new kr,i=new kr,a=e.state.field(um).iter(),o=t.state.field(um).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<-dm?(l-=n,r.add(s,s,jr.widget({widget:new cm(-n),block:!0,side:-1}))):n>dm&&(u+=n,i.add(c,c,jr.widget({widget:new cm(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<dm?r.add(e.state.doc.length,e.state.doc.length,jr.widget({widget:new cm(-p),block:!0,side:1})):p>dm&&i.add(t.state.doc.length,t.state.doc.length,jr.widget({widget:new cm(p),block:!0,side:1}));let m=r.finish(),h=i.finish();fm(m,e.state.field(um))||e.dispatch({effects:lm.of(m)}),fm(h,t.state.field(um))||t.dispatch({effects:lm.of(h)})}var mm=br.define({map:(e,t)=>t.mapPos(e)}),hm=class extends Cr{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:mm.of(n)});let{side:r,sibling:i}=e.state.facet(Lp);i&&i().dispatch({effects:mm.of(gm(n,e.state.field(Bp),r==`a`))})}),t}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return`collapsed-unchanged-code`}};function gm(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 _m=Sr.define({create(e){return jr.none},update(e,t){e=e.map(t.changes);for(let n of t.effects)n.is(mm)&&(e=e.update({filter:e=>e!=n.value}));return e},provide:e=>Er.decorations.from(e)});function vm({margin:e=3,minSize:t=4}){return _m.init(n=>ym(n,e,t))}function ym(e,t,n){let r=new kr,i=e.facet(Lp).side==`a`,a=e.field(Bp),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,jr.replace({widget:new hm(d),block:!0})),!c)break;o=e.doc.lineAt(Math.min(e.doc.length,i?c.toA:c.toB)).number}return r.finish()}var bm=Er.styleModule.of(new Nr({".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`}})),xm=Er.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`}}),Sm=new Mr,Cm=new Mr,wm=class{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig||Xp;let t=[Ar.low(Zp),xm,bm,um,Er.updateListener.of(e=>{this.measuring<0&&(e.heightChanged||e.viewportChanged)&&!e.transactions.some(e=>e.effects.some(e=>e.is(lm)))&&this.measure()})],n=[Lp.of({side:`a`,sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&n.push(Qp);let r=_r.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],Er.editorAttributes.of({class:`cm-merge-a`}),Cm.of(n),t]}),i=[Lp.of({side:`b`,sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&i.push(Qp);let a=_r.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],Er.editorAttributes.of({class:`cm-merge-b`}),Cm.of(i),t]});this.chunks=Hp.build(r.doc,a.doc,this.diffConf);let o=[Bp.init(()=>this.chunks),Sm.of(e.collapseUnchanged?vm(e.collapseUnchanged):[])];r=r.update({effects:br.appendConfig.of(o)}).state,a=a.update({effects:br.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 Er({state:r,parent:c,root:e.root,dispatchTransactions:e=>this.dispatch(e,this.a)}),this.b=new Er({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),wr.empty(e[0].startState.doc.length));this.chunks=t==this.a?Hp.updateA(this.chunks,n.newDoc,this.b.state.doc,r,this.diffConf):Hp.updateB(this.chunks,this.a.state.doc,n.newDoc,r,this.diffConf),t.update([...e,n.state.update({effects:Rp.of(this.chunks)})]);let i=t==this.a?this.b:this.a;i.update([i.state.update({effects:Rp.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(Lp),o=n?e.gutter!==!1:r.markGutter,s=t?e.highlightChanges!==!1:r.highlightChanges;i.push(Cm.reconfigure([Lp.of({side:`a`,sibling:()=>this.b,highlightChanges:s,markGutter:o}),o?Qp:[]])),a.push(Cm.reconfigure([Lp.of({side:`b`,sibling:()=>this.a,highlightChanges:s,markGutter:o}),o?Qp:[]]))}if(r){let t=Sm.reconfigure(e.collapseUnchanged?vm(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(){pm(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=Tm(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=Tm(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 Tm(e){let t=e.nextSibling;return e.remove(),t}var Em=new class extends Tr{constructor(){super(...arguments),this.elementClass=`cm-deletedLineGutter`}},Dm=Ar.low(Or({class:`cm-changeGutter`,markers:e=>e.plugin(Zp)?.gutter||mr.empty,widgetMarker:(e,t)=>t instanceof Mm?Em:null}));function Om(e){let t=typeof e.original==`string`?yr.of(e.original.split(/\r?\n/)):e.original,n=e.diffConfig||Xp;return[Ar.low(Zp),Lm,xm,Er.editorAttributes.of({class:`cm-merge-b`}),zp.of((e,t)=>{let r=t.effects.find(e=>e.is(km));return r&&(e=Hp.updateA(e,r.value.doc,t.startState.doc,r.value.changes,n)),t.docChanged&&(e=Hp.updateB(e,t.state.field(Am),t.newDoc,t.changes,n)),e}),Lp.of({highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1,syntaxHighlightDeletions:e.syntaxHighlightDeletions!==!1,syntaxHighlightDeletionsMaxLength:3e3,mergeControls:e.mergeControls??!0,overrideChunk:e.allowInlineDiffs?Um:void 0,side:`b`}),Am.init(()=>t),e.gutter===!1?[]:Dm,e.collapseUnchanged?vm(e.collapseUnchanged):[],Bp.init(e=>Hp.build(t,e.doc,n))]}var km=br.define(),Am=Sr.define({create:()=>yr.empty,update(e,t){for(let n of t.effects)n.is(km)&&(e=n.value.doc);return e}}),jm=new WeakMap,Mm=class extends Cr{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 Nm(e,t,n){let r=jm.get(t.changes);if(r)return r;let i=jr.widget({block:!0,side:-1,widget:new Mm(r=>{let{highlightChanges:i,syntaxHighlightDeletions:a,syntaxHighlightDeletionsMaxLength:o,mergeControls:s}=e.facet(Lp),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(),Pm(r,r.posAtDOM(c))},i=e=>{e.preventDefault(),Fm(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(Am).sliceString(t.fromA,t.endA),u=a&&e.facet(xr),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)==`
21
21
  `){d.firstChild||d.appendChild(document.createElement(`br`)),d=h(),r++;continue}let e=t,a=n+(m?` cm-deletedText`:``),o=!1,s=l.indexOf(`
22
- `,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;vr(t,{style:t=>hr(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 jm.set(t.changes,i),i}function Pm(e,t){let{state:n}=e,r=t??n.selection.main.head,i=e.state.field(Bp).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(Am);i.fromB!=i.toB&&i.toA<=o.length&&(a+=e.state.lineBreak);let s=wr.of({from:i.fromA,to:Math.min(o.length,i.toA),insert:a},o.length);return e.dispatch({effects:km.of({doc:s.apply(o),changes:s}),userEvent:`accept`}),!0}function Fm(e,t){let{state:n}=e,r=t??n.selection.main.head,i=n.field(Bp).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=n.field(Am).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 Im(e){let t=new kr;for(let n of e.field(Bp)){let r=e.facet(Lp).overrideChunk&&zm(e,n);t.add(n.fromB,n.fromB,Nm(e,n,!!r))}return t.finish()}var Lm=Sr.define({create:e=>Im(e),update(e,t){return t.state.field(Bp,!1)==t.startState.field(Bp,!1)?e:Im(t.state)},provide:e=>Er.decorations.from(e)}),Rm=new WeakMap;function zm(e,t){let n=Rm.get(t);if(n!==void 0)return n;n=null;let r=e.field(Am),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(jr.widget({widget:new Bm(t),side:-1}).range(s+n.fromB))}n.fromB<n.toB&&e.push(nm.range(s+n.fromB,s+n.toB))}i<t.endA-t.fromA-a*2&&(n=e)}return Rm.set(t,n),n}var Bm=class extends Cr{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}},Vm=new class extends Tr{constructor(){super(...arguments),this.elementClass=`cm-inlineChangedLineGutter`}},Hm=jr.line({class:`cm-inlineChangedLine`});function Um(e,t,n,r){let i=zm(e,t),a=0;if(!i)return!1;for(let o=e.doc.lineAt(t.fromB);;){for(r&&r.add(o.from,o.from,Vm),n.add(o.from,o.from,Hm);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 Wm=fr({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),Gm=sr({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}});function Km(e){let t=(0,Z.c)(20),{oldContent:n,newContent:r,layout:i,conflictMode:a,onResolve:o,onAbort:s}=e,c=(0,X.useRef)(null),l=(0,X.useRef)(null),{resolvedTheme:u}=T(),d=(0,X.useRef)(o),f=(0,X.useRef)(s),[p,m]=(0,X.useState)(null),h;t[0]!==s||t[1]!==o?(h=()=>{d.current=o,f.current=s},t[0]=s,t[1]=o,t[2]=h):h=t[2],(0,X.useEffect)(h);let g,_;t[3]!==a||t[4]!==i||t[5]!==r||t[6]!==n||t[7]!==u?(g=()=>{if(!c.current)return;let e=u===`dark`?Wm:Gm,t=[Er.editable.of(!1),_r.readOnly.of(!0)],o=[dr,ar(),...t,e,Er.lineWrapping];if(l.current&&=(l.current.destroy(),null),a){let t=new Er({doc:r,extensions:[dr,ar(),Er.editable.of(!1),e,Er.lineWrapping,Om({original:n,highlightChanges:!0,gutter:!0,mergeControls:!0,collapseUnchanged:{margin:3,minSize:4}}),Er.updateListener.of(e=>{let t=Vp(e.state);m(t?t.chunks.length:0)})],parent:c.current});l.current=t;let i=Vp(t.state);m(i?i.chunks.length:0)}else i===`split`?l.current=new wm({a:{doc:n,extensions:o},b:{doc:r,extensions:o},parent:c.current,highlightChanges:!0,gutter:!0,collapseUnchanged:{margin:3,minSize:4}}):l.current=new Er({doc:r,extensions:[...o,Om({original:n,highlightChanges:!0,gutter:!0,mergeControls:!1,collapseUnchanged:{margin:3,minSize:4}})],parent:c.current});return()=>{l.current&&=(l.current.destroy(),null)}},_=[n,r,i,u,a],t[3]=a,t[4]=i,t[5]=r,t[6]=n,t[7]=u,t[8]=g,t[9]=_):(g=t[8],_=t[9]),(0,X.useEffect)(g,_);let v;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(v=function(){let e=l.current;!e||!(e instanceof Er)||d.current?.(e.state.doc.toString())},t[10]=v):v=t[10];let y=v,b=p===0,x=p===null?``:p===0?`All hunks resolved`:`${p} unresolved hunk${p===1?``:`s`}`,S;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Y.jsx)(`div`,{ref:c,className:`diff-view min-h-0 flex-1 overflow-y-auto subtle-scrollbar`}),t[11]=S):S=t[11];let C;t[12]!==b||t[13]!==a||t[14]!==x||t[15]!==s||t[16]!==o?(C=a&&(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-3 py-2 border-t shrink-0`,children:[(0,Y.jsx)(`span`,{className:`text-xs ${b?`text-emerald-600 dark:text-emerald-400`:`text-muted-foreground`}`,children:x}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[s&&(0,Y.jsx)(K,{variant:`ghost`,size:`sm`,onClick:s,children:`Exit merge`}),o&&(0,Y.jsx)(K,{variant:`default`,size:`sm`,disabled:!b,onClick:y,children:`Save resolution`})]})]}),t[12]=b,t[13]=a,t[14]=x,t[15]=s,t[16]=o,t[17]=C):C=t[17];let w;return t[18]===C?w=t[19]:(w=(0,Y.jsxs)(`div`,{className:`flex flex-col h-full`,children:[S,C]}),t[18]=C,t[19]=w),w}function qm(e){let t=(0,Z.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,Y.jsx)(Gt,{"data-slot":`sheet`,...n}),t[2]=n,t[3]=r),r}function Jm(e){let t=(0,Z.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,Y.jsx)(Lt,{"data-slot":`sheet-portal`,...n}),t[2]=n,t[3]=r),r}function Ym(e){let t=(0,Z.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=W(`fixed inset-0 z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Y.jsx)(It,{"data-slot":`sheet-overlay`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Xm(e){let t=(0,Z.c)(17),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:r,children:n,side:a,showCloseButton:o,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=a===void 0?`right`:a,c=o===void 0?!0:o,l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Y.jsx)(Ym,{}),t[6]=l):l=t[6];let u;t[7]===r?u=t[8]:(u=W(`fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-[side=bottom]:data-open:slide-in-from-bottom-10 data-[side=left]:data-open:slide-in-from-left-10 data-[side=right]:data-open:slide-in-from-right-10 data-[side=top]:data-open:slide-in-from-top-10 data-closed:animate-out data-closed:fade-out-0 data-[side=bottom]:data-closed:slide-out-to-bottom-10 data-[side=left]:data-closed:slide-out-to-left-10 data-[side=right]:data-closed:slide-out-to-right-10 data-[side=top]:data-closed:slide-out-to-top-10`,r),t[7]=r,t[8]=u);let d;t[9]===c?d=t[10]:(d=c&&(0,Y.jsx)(Ft,{"data-slot":`sheet-close`,asChild:!0,children:(0,Y.jsxs)(K,{variant:`ghost`,className:`absolute top-3 right-3`,size:`icon-sm`,children:[(0,Y.jsx)(Zt,{}),(0,Y.jsx)(`span`,{className:`sr-only`,children:`Close`})]})}),t[9]=c,t[10]=d);let f;return t[11]!==n||t[12]!==i||t[13]!==s||t[14]!==u||t[15]!==d?(f=(0,Y.jsxs)(Jm,{children:[l,(0,Y.jsxs)(Vt,{"data-slot":`sheet-content`,"data-side":s,className:u,...i,children:[n,d]})]}),t[11]=n,t[12]=i,t[13]=s,t[14]=u,t[15]=d,t[16]=f):f=t[16],f}function Zm(e){let t=(0,Z.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=W(`flex flex-col gap-0.5 p-4`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Y.jsx)(`div`,{"data-slot":`sheet-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Qm(e){let t=(0,Z.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=W(`font-heading text-base font-medium text-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Y.jsx)(Ht,{"data-slot":`sheet-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}async function $m(){try{let e=await fetch(`/api/sync/conflicts`);return e.ok?{conflicts:(await e.json()).conflicts??[]}:{conflicts:[],error:`server`}}catch{return{conflicts:[],error:`network`}}}async function eh(e){try{let t=await fetch(`/api/sync/conflict-content?file=${encodeURIComponent(e)}`);if(!t.ok)return{ours:``,theirs:``,base:``};let n=await t.json();return{ours:n.ours??``,theirs:n.theirs??``,base:n.base??``}}catch{return{ours:``,theirs:``,base:``}}}async function th(e,t,n){try{let r={file:e,strategy:t};return n!==void 0&&(r.content=n),(await fetch(`/api/sync/resolve-conflict`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(r)})).ok}catch{return!1}}var nh=`w-[98vw] !max-w-[98vw] h-[96vh] flex flex-col gap-0 sm:!max-w-[98vw]`;function rh(e){let t=(0,Z.c)(31),{file:n,onResolve:r,onAbort:i}=e,[a,o]=(0,X.useState)(null),s,c;if(t[0]===n?(s=t[1],c=t[2]):(s=()=>{let e=!1;return eh(n).then(t=>{e||o(t)}),()=>{e=!0}},c=[n],t[0]=n,t[1]=s,t[2]=c),(0,X.useEffect)(s,c),a===null){let e;t[3]===i?e=t[4]:(e=e=>!e&&i(),t[3]=i,t[4]=e);let r;t[5]===n?r=t[6]:(r=(0,Y.jsx)(Wt,{className:`shrink-0`,children:(0,Y.jsxs)(qt,{children:[`Resolving: `,n]})}),t[5]=n,t[6]=r);let a;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Y.jsx)(`div`,{className:`flex-1 flex items-center justify-center text-sm text-muted-foreground`,children:`Loading…`}),t[7]=a):a=t[7];let o;t[8]===r?o=t[9]:(o=(0,Y.jsxs)(Kt,{className:nh,children:[r,a]}),t[8]=r,t[9]=o);let s;return t[10]!==e||t[11]!==o?(s=(0,Y.jsx)(Jt,{open:!0,onOpenChange:e,children:o}),t[10]=e,t[11]=o,t[12]=s):s=t[12],s}let l;t[13]===i?l=t[14]:(l=e=>!e&&i(),t[13]=i,t[14]=l);let u;t[15]===n?u=t[16]:(u=(0,Y.jsxs)(qt,{className:`text-sm font-medium`,children:[`Resolving: `,n]}),t[15]=n,t[16]=u);let d;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Red = your version (ours). Green = team's version (theirs). Accept each hunk to take theirs, reject to keep yours, then save.`}),t[17]=d):d=t[17];let f;t[18]===u?f=t[19]:(f=(0,Y.jsxs)(Wt,{className:`px-4 pt-4 pb-2 shrink-0`,children:[u,d]}),t[18]=u,t[19]=f);let p;t[20]!==i||t[21]!==r||t[22]!==a.ours||t[23]!==a.theirs?(p=(0,Y.jsx)(`div`,{className:`flex-1 min-h-0 overflow-hidden`,children:(0,Y.jsx)(Km,{oldContent:a.ours,newContent:a.theirs,layout:`unified`,conflictMode:!0,onResolve:r,onAbort:i})}),t[20]=i,t[21]=r,t[22]=a.ours,t[23]=a.theirs,t[24]=p):p=t[24];let m;t[25]!==f||t[26]!==p?(m=(0,Y.jsxs)(Kt,{className:`${nh} p-0`,children:[f,p]}),t[25]=f,t[26]=p,t[27]=m):m=t[27];let h;return t[28]!==l||t[29]!==m?(h=(0,Y.jsx)(Jt,{open:!0,onOpenChange:l,children:m}),t[28]=l,t[29]=m,t[30]=h):h=t[30],h}function ih(e){let t=(0,Z.c)(50),{open:n,onOpenChange:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=[],t[0]=i):i=t[0];let[a,o]=(0,X.useState)(i),[s,c]=(0,X.useState)(null),l;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(l=new Set,t[1]=l):l=t[1];let[u,d]=(0,X.useState)(l),f;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=new Set,t[2]=f):f=t[2];let[p,m]=(0,X.useState)(f),[h,g]=(0,X.useState)(null),_;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(_=function(){$m().then(e=>{let{conflicts:t,error:n}=e;c(n??null),o(t),d(e=>{let n=new Set(t.map(ah));return new Set([...e].filter(e=>!n.has(e)))})})},t[3]=_):_=t[3];let v=_,y,b;t[4]===n?(y=t[5],b=t[6]):(y=()=>{n&&v()},b=[n],t[4]=n,t[5]=y,t[6]=b),(0,X.useEffect)(y,b);let x,S;t[7]===n?(x=t[8],S=t[9]):(x=()=>Fn(e=>{e.includes(`sync-status`)&&n&&v()}),S=[n],t[7]=n,t[8]=x,t[9]=S),(0,X.useEffect)(x,S);let C,w;t[10]!==a.length||t[11]!==r||t[12]!==n||t[13]!==u.size?(w=()=>{n&&a.length>0&&u.size>=a.length&&(At.success(`All conflicts resolved — sync resuming`),r(!1),d(new Set))},C=[n,a.length,u.size,r],t[10]=a.length,t[11]=r,t[12]=n,t[13]=u.size,t[14]=C,t[15]=w):(C=t[14],w=t[15]),(0,X.useEffect)(w,C);let T;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(T=async function(e,t,n){m(t=>new Set([...t,e]));let r=await th(e,t,n);m(t=>{let n=new Set(t);return n.delete(e),n}),r?d(t=>new Set([...t,e])):At.error(`Failed to resolve ${e}`)},t[16]=T):T=t[16];let E=T,D;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(D=function(e){g(e)},t[17]=D):D=t[17];let O=D,k;t[18]===h?k=t[19]:(k=async function(e){if(!h)return;let t=h;g(null),await E(t,`content`,e)},t[18]=h,t[19]=k);let A=k,j;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(j=function(){g(null)},t[20]=j):j=t[20];let M=j,N;t[21]===r?N=t[22]:(N=async function(){try{(await fetch(`/api/sync/abort-merge`,{method:`POST`})).ok?At.info(`Merge aborted — sync paused`):At.error(`Failed to abort merge`)}catch{At.error(`Failed to abort merge — connection error`)}r(!1),d(new Set)},t[21]=r,t[22]=N);let P=N,F=a.length,I=u.size,ee;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Y.jsx)(Qm,{className:`text-sm font-medium`,children:`Resolve conflicts`}),t[23]=ee):ee=t[23];let L;t[24]!==I||t[25]!==F?(L=F>0&&(0,Y.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[I,` of `,F,` resolved`]}),t[24]=I,t[25]=F,t[26]=L):L=t[26];let R;t[27]===L?R=t[28]:(R=(0,Y.jsxs)(Zm,{className:`px-4 py-3 border-b shrink-0`,children:[ee,L]}),t[27]=L,t[28]=R);let z;t[29]!==a||t[30]!==s||t[31]!==u||t[32]!==p?(z=(0,Y.jsx)(`div`,{className:`flex-1 overflow-y-auto`,children:s?(0,Y.jsxs)(`div`,{className:`px-4 py-6 text-sm text-center space-y-2`,children:[(0,Y.jsx)(`p`,{className:`text-destructive`,children:s===`network`?`Could not reach the sync server — check your connection.`:`Sync server error — try again in a moment.`}),(0,Y.jsx)(K,{variant:`outline`,size:`sm`,onClick:v,children:`Retry`})]}):a.length===0?(0,Y.jsx)(`p`,{className:`px-4 py-6 text-sm text-muted-foreground text-center`,children:`No conflicts found.`}):(0,Y.jsx)(`ul`,{className:`divide-y`,children:a.map(e=>{let t=u.has(e.file),n=p.has(e.file),r=e.file.split(`/`).pop()??e.file;return(0,Y.jsxs)(`li`,{className:`px-4 py-3 ${t?`opacity-50`:``}`,children:[(0,Y.jsxs)(`p`,{className:`text-sm font-medium truncate mb-2`,title:e.file,children:[t?`✓ `:``,r]}),!t&&(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[(0,Y.jsx)(K,{variant:`outline`,size:`xs`,disabled:n,onClick:()=>void E(e.file,`mine`),children:`Keep my version`}),(0,Y.jsx)(K,{variant:`outline`,size:`xs`,disabled:n,onClick:()=>void E(e.file,`theirs`),children:`Keep team's version`}),(0,Y.jsx)(K,{variant:`ghost`,size:`xs`,disabled:n,onClick:()=>O(e.file),children:`Resolve manually`})]})]},e.file)})})}),t[29]=a,t[30]=s,t[31]=u,t[32]=p,t[33]=z):z=t[33];let B;t[34]===P?B=t[35]:(B=(0,Y.jsx)(`div`,{className:`px-4 py-3 border-t shrink-0`,children:(0,Y.jsx)(K,{variant:`ghost`,size:`sm`,className:`w-full`,onClick:P,children:`Exit merge`})}),t[34]=P,t[35]=B);let V;t[36]!==R||t[37]!==z||t[38]!==B?(V=(0,Y.jsxs)(Xm,{side:`right`,className:`w-80 sm:w-96 flex flex-col gap-0 p-0`,children:[R,z,B]}),t[36]=R,t[37]=z,t[38]=B,t[39]=V):V=t[39];let H;t[40]!==r||t[41]!==n||t[42]!==V?(H=(0,Y.jsx)(qm,{open:n,onOpenChange:r,children:V}),t[40]=r,t[41]=n,t[42]=V,t[43]=H):H=t[43];let te;t[44]!==A||t[45]!==h?(te=h&&(0,Y.jsx)(rh,{file:h,onResolve:e=>void A(e),onAbort:M}),t[44]=A,t[45]=h,t[46]=te):te=t[46];let ne;return t[47]!==H||t[48]!==te?(ne=(0,Y.jsxs)(Y.Fragment,{children:[H,te]}),t[47]=H,t[48]=te,t[49]=ne):ne=t[49],ne}function ah(e){return e.file}function oh(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function sh(e,t){let n=getComputedStyle(e.ownerDocument.body);return t*parseFloat(n.fontSize)}function ch(e){return e/100*window.innerHeight}function lh(e){return e/100*window.innerWidth}function uh(e){switch(typeof e){case`number`:return[e,`px`];case`string`:{let t=parseFloat(e);return e.endsWith(`%`)?[t,`%`]:e.endsWith(`px`)?[t,`px`]:e.endsWith(`rem`)?[t,`rem`]:e.endsWith(`em`)?[t,`em`]:e.endsWith(`vh`)?[t,`vh`]:e.endsWith(`vw`)?[t,`vw`]:[t,`%`]}}}function dh({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=uh(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=sh(t,i);break;case`em`:r=oh(t,i);break;case`vh`:r=ch(i);break;case`vw`:r=lh(i);break}return r}function fh(e){return parseFloat(e.toFixed(3))}function ph({group:e}){let{orientation:t,panels:n}=e;return n.reduce((e,n)=>(e+=t===`horizontal`?n.element.offsetWidth:n.element.offsetHeight,e),0)}function mh(e){let{panels:t}=e,n=ph({group:e});return n===0?t.map(e=>({groupResizeBehavior:e.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:e.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:e.panelConstraints.disabled,minSize:0,maxSize:100,panelId:e.id})):t.map(e=>{let{element:t,panelConstraints:r}=e,i=0;r.collapsedSize!==void 0&&(i=fh(dh({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=fh(dh({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=fh(dh({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=fh(dh({groupSize:n,panelElement:t,styleProp:r.maxSize})/n*100)),{groupResizeBehavior:r.groupResizeBehavior,collapsedSize:i,collapsible:r.collapsible===!0,defaultSize:a,disabled:r.disabled,minSize:o,maxSize:s,panelId:e.id}})}function hh(e,t=`Assertion error`){if(!e)throw Error(t)}function gh(e,t){return Array.from(t).sort(e===`horizontal`?_h:vh)}function _h(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function vh(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function yh(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function bh(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function xh({orientation:e,rects:t,targetRect:n}){let r={x:n.x+n.width/2,y:n.y+n.height/2},i,a=Number.MAX_VALUE;for(let n of t){let{x:t,y:o}=bh(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return hh(i,`No rect found`),i}var Sh;function Ch(){return Sh===void 0&&(Sh=typeof matchMedia==`function`?!!matchMedia(`(pointer:coarse)`).matches:!1),Sh}function wh(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=gh(n,Array.from(t.children).filter(yh).map(e=>({element:e}))).map(({element:e})=>e),o=[],s=!1,c=!1,l=-1,u=-1,d=0,f,p=[];{let e=-1;for(let t of a)t.hasAttribute(`data-panel`)&&(e++,t.hasAttribute(`data-disabled`)||(d++,l===-1&&(l=e),u=e))}if(d>1){let t=-1;for(let d of a)if(d.hasAttribute(`data-panel`)){t++;let i=r.find(e=>e.element===d);if(i){if(f){let r=f.element.getBoundingClientRect(),a=d.getBoundingClientRect(),m;if(c){let e=n===`horizontal`?new DOMRect(r.right,r.top,0,r.height):new DOMRect(r.left,r.bottom,r.width,0),t=n===`horizontal`?new DOMRect(a.left,a.top,0,a.height):new DOMRect(a.left,a.top,a.width,0);switch(p.length){case 0:m=[e,t];break;case 1:{let i=p[0];m=[i,xh({orientation:n,rects:[r,a],targetRect:i.element.getBoundingClientRect()})===r?t:e];break}default:m=p;break}}else m=p.length?p:[n===`horizontal`?new DOMRect(r.right,a.top,a.left-r.right,a.height):new DOMRect(a.left,r.bottom,a.width,a.top-r.bottom)];for(let n of m){let r=`width`in n?n:n.element.getBoundingClientRect(),a=Ch()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(r.width<a){let e=a-r.width;r=new DOMRect(r.x-e/2,r.y,r.width+e,r.height)}if(r.height<a){let e=a-r.height;r=new DOMRect(r.x,r.y-e/2,r.width,r.height+e)}!s&&!(t<=l||t>u)&&o.push({group:e,groupSize:ph({group:e}),panels:[f,i],separator:`width`in n?void 0:n,rect:r}),s=!1}}c=!1,f=i,p=[]}}else if(d.hasAttribute(`data-separator`)){d.ariaDisabled!==null&&(s=!0);let e=i.find(e=>e.element===d);e?p.push(e):(f=void 0,p=[])}else c=!0}return o}var Th=class{#e={};addListener(e,t){let n=this.#e[e];return n===void 0?this.#e[e]=[t]:n.includes(t)||n.push(t),()=>{this.removeListener(e,t)}}emit(e,t){let n=this.#e[e];if(n!==void 0)if(n.length===1)n[0].call(null,t);else{let e=!1,r=null,i=Array.from(n);for(let n=0;n<i.length;n++){let a=i[n];try{a.call(null,t)}catch(t){r===null&&(e=!0,r=t)}}if(e)throw r}}removeAllListeners(){this.#e={}}removeListener(e,t){let n=this.#e[e];if(n!==void 0){let e=n.indexOf(t);e>=0&&n.splice(e,1)}}},Eh=new Map,Dh=new Th;function Oh(e){Eh=new Map(Eh),Eh.delete(e)}function kh(e,t){for(let[t]of Eh)if(t.id===e)return t}function Ah(e,t){for(let[t,n]of Eh)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function jh(){return Eh}function Mh(e,t){return Dh.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function Nh(e,t){let n=Eh.get(e);Eh=new Map(Eh),Eh.set(e,t),Dh.emit(`groupChange`,{group:e,prev:n,next:t})}function Ph(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=bh(n,a.rect);switch(e){case`horizontal`:t.x<=i.x&&(r=a,i=t);break;case`vertical`:t.y<=i.y&&(r=a,i=t);break}}return r?{distance:i,hitRegion:r}:void 0}function Fh(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function Ih(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:Hh(e),b:Hh(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();hh(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:Vh(Bh(n.a)),b:Vh(Bh(n.b))};if(i.a===i.b){let e=r.childNodes,t={a:n.a.at(-1),b:n.b.at(-1)},i=e.length;for(;i--;){let n=e[i];if(n===t.a)return 1;if(n===t.b)return-1}}return Math.sign(i.a-i.b)}var Lh=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Rh(e){let t=getComputedStyle(Uh(e)??e).display;return t===`flex`||t===`inline-flex`}function zh(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||Rh(e))||+t.opacity<1||`transform`in t&&t.transform!==`none`||`webkitTransform`in t&&t.webkitTransform!==`none`||`mixBlendMode`in t&&t.mixBlendMode!==`normal`||`filter`in t&&t.filter!==`none`||`webkitFilter`in t&&t.webkitFilter!==`none`||`isolation`in t&&t.isolation===`isolate`||Lh.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function Bh(e){let t=e.length;for(;t--;){let n=e[t];if(hh(n,`Missing node`),zh(n))return n}return null}function Vh(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Hh(e){let t=[];for(;e;)t.push(e),e=Uh(e);return t}function Uh(e){let{parentNode:t}=e;return Fh(t)?t.host:t}function Wh(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function Gh({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!yh(n)||n.contains(e)||e.contains(n))return!0;if(Ih(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(Wh(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function Kh(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=wh(r),a=Ph(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&Gh({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function qh(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function Jh(e,t,n=0){return Math.abs(fh(e)-fh(t))<=n}function Yh(e,t){return Jh(e,t)?0:e>t?1:-1}function Xh({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:r}){let{collapsedSize:i=0,collapsible:a,disabled:o,maxSize:s=100,minSize:c=0}=t;if(o&&!e)return n;if(Yh(r,c)<0)if(a){let e=(i+c)/2;r=Yh(r,e)<0?i:c}else r=c;return r=Math.min(s,r),r=fh(r),r}function Zh({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(Jh(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;hh(u!=null,`Invalid first pivot index`),hh(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];hh(r,`Panel constraints not found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=s[t];if(hh(n!=null,`Previous layout not found for panel index ${t}`),Jh(n,i)){let t=o-n;Yh(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];hh(r,`No panel constraints found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=s[t];if(hh(n!=null,`Previous layout not found for panel index ${t}`),Jh(n,o)){let t=n-i;Yh(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];hh(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&Yh(i,c)<0)if(e>0){let t=c-o,n=t/2;Yh(i+e,c)<0&&(e=Yh(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;Yh(i-e,c)<0&&(e=Yh(100+e,n)>0?0:-t)}break}}{let t=e<0?1:-1,r=e<0?d:u,i=0;for(;;){let e=s[r];hh(e!=null,`Previous layout not found for panel index ${r}`);let a=Xh({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:e,size:100})-e;if(i+=a,r+=t,r<0||r>=n.length)break}let a=Math.min(Math.abs(e),Math.abs(i));e=e<0?0-a:a}{let t=e<0?u:d;for(;t>=0&&t<n.length;){let r=Math.abs(e)-Math.abs(f),i=s[t];hh(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=Xh({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!Jh(i,c)&&(f+=i-c,l[t]=c,f.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?t--:t++}}if(qh(c,l))return i;{let t=e<0?d:u,r=s[t];hh(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=Xh({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!Jh(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];hh(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=Xh({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(Jh(i,s)||(t-=s-i,l[r]=s),Jh(t,0))break;e>0?r--:r++}}}if(!Jh(Object.values(l).reduce((e,t)=>t+e,0),100,.1))return i;let p=Object.keys(i);return l.reduce((e,t,n)=>(e[p[n]]=t,e),{})}function Qh(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||Yh(e[n],t[n])!==0)return!1;return!0}function $h({layout:e,panelConstraints:t}){let n=Object.values(e),r=[...n],i=r.reduce((e,t)=>e+t,0);if(r.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${r.map(e=>`${e}%`).join(`, `)}`);if(!Jh(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];hh(t!=null,`No layout data found for index ${e}`),r[e]=100/i*t}let a=0;for(let e=0;e<t.length;e++){let i=n[e];hh(i!=null,`No layout data found for index ${e}`);let o=r[e];hh(o!=null,`No layout data found for index ${e}`);let s=Xh({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!Jh(a,0))for(let e=0;e<t.length;e++){let n=r[e];hh(n!=null,`No layout data found for index ${e}`);let i=n+a,o=Xh({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,Jh(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function eg({groupId:e,panelId:t}){let n=()=>{let t=jh();for(let[n,{defaultLayoutDeferred:r,derivedPanelConstraints:i,layout:a,groupSize:o,separatorToPanels:s}]of t)if(n.id===e)return{defaultLayoutDeferred:r,derivedPanelConstraints:i,group:n,groupSize:o,layout:a,separatorToPanels:s};throw Error(`Group ${e} not found`)},r=()=>{let e=n().derivedPanelConstraints.find(e=>e.panelId===t);if(e!==void 0)return e;throw Error(`Panel constraints not found for Panel ${t}`)},i=()=>{let e=n().group.panels.find(e=>e.id===t);if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},a=()=>{let e=n().layout[t];if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},o=e=>{let r=a();if(e===r)return;let{defaultLayoutDeferred:i,derivedPanelConstraints:o,group:s,groupSize:c,layout:l,separatorToPanels:u}=n(),d=s.panels.findIndex(e=>e.id===t),f=d===s.panels.length-1,p=$h({layout:Zh({delta:f?r-e:e-r,initialLayout:l,panelConstraints:o,pivotIndices:f?[d-1,d]:[d,d+1],prevLayout:l,trigger:`imperative-api`}),panelConstraints:o});Qh(l,p)||Nh(s,{defaultLayoutDeferred:i,derivedPanelConstraints:o,groupSize:c,layout:p,separatorToPanels:u})};return{collapse:()=>{let{collapsible:e,collapsedSize:t}=r(),{mutableValues:n}=i(),s=a();e&&s!==t&&(n.expandToSize=s,o(t))},expand:()=>{let{collapsible:e,collapsedSize:t,minSize:n}=r(),{mutableValues:s}=i(),c=a();if(e&&c===t){let e=s.expandToSize??n;e===0&&(e=1),o(e)}},getSize:()=>{let{group:e}=n(),t=a(),{element:r}=i();return{asPercentage:t,inPixels:e.orientation===`horizontal`?r.offsetWidth:r.offsetHeight}},isCollapsed:()=>{let{collapsible:e,collapsedSize:t}=r(),n=a();return e&&Jh(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=ph({group:t});o(fh(dh({groupSize:a,panelElement:r,styleProp:e})/a*100))}}}function tg(e){e.defaultPrevented||Kh(e,jh()).forEach(t=>{if(t.separator&&!t.separator.disableDoubleClick){let n=t.panels.find(e=>e.panelConstraints.defaultSize!==void 0);if(n){let r=n.panelConstraints.defaultSize,i=eg({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function ng(e){let t=jh();for(let[n]of t)if(n.separators.some(t=>t.element===e))return n;throw Error(`Could not find parent Group for separator element`)}function rg({groupId:e}){let t=()=>{let t=jh();for(let[n,r]of t)if(n.id===e)return{group:n,...r};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){let{defaultLayoutDeferred:e,layout:n}=t();return e?{}:n},setLayout(e){let{defaultLayoutDeferred:n,derivedPanelConstraints:r,group:i,groupSize:a,layout:o,separatorToPanels:s}=t(),c=$h({layout:e,panelConstraints:r});return n?o:(Qh(o,c)||Nh(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function ig(e,t){let n=ng(e),r=Ah(n.id,!0),i=n.separators.find(t=>t.element===e);hh(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);hh(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=rg({groupId:n.id}).getLayout(),c=$h({layout:Zh({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});Qh(s,c)||Nh(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels})}function ag(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=ng(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&ig(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&ig(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&ig(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&ig(t,-5);break;case`End`:e.preventDefault(),ig(t,100);break;case`Enter`:{e.preventDefault();let n=ng(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=Ah(n.id,!0),o=n.separators.find(e=>e.element===t);hh(o,`Matching separator not found`);let s=a.get(o);hh(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(hh(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];ig(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=ng(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);hh(r!==null,`Index not found`),n[e.shiftKey?r>0?r-1:n.length-1:r+1<n.length?r+1:0].focus({preventScroll:!0});break}case`Home`:e.preventDefault(),ig(t,-100);break}}var og={cursorFlags:0,state:`inactive`},sg=new Th;function cg(){return og}function lg(e){return sg.addListener(`change`,e)}function ug(e){let t=og,n={...og};n.cursorFlags=e,og=n,sg.emit(`change`,{prev:t,next:n})}function dg(e){let t=og;og=e,sg.emit(`change`,{prev:t,next:e})}function fg(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=jh(),n=Kh(e,t),r=new Map,i=!1;n.forEach(e=>{e.separator&&(i||(i=!0,e.separator.element.focus({preventScroll:!0})));let n=t.get(e.group);n&&r.set(e.group,n.layout)}),dg({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}var pg=e=>e,mg=()=>{},hg=1,gg=2,_g=4,vg=8,yg=3,bg=12,xg;function Sg(){return xg===void 0&&(xg=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(xg=!0)),xg}function Cg({cursorFlags:e,groups:t,state:n}){let r=0,i=0;switch(n){case`active`:case`hover`:t.forEach(e=>{if(!e.mutableState.disableCursor)switch(e.orientation){case`horizontal`:r++;break;case`vertical`:i++;break}})}if(!(r===0&&i===0)){switch(n){case`active`:if(e&&Sg()){let t=(e&hg)!==0,n=(e&gg)!==0,r=(e&_g)!==0,i=(e&vg)!==0;if(t)return r?`se-resize`:i?`ne-resize`:`e-resize`;if(n)return r?`sw-resize`:i?`nw-resize`:`w-resize`;if(r)return`s-resize`;if(i)return`n-resize`}break}return Sg()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var wg=new WeakMap;function Tg(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=wg.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&e.adoptedStyleSheets.push(n));let r=cg();switch(r.state){case`active`:case`hover`:{let e=Cg({cursorFlags:r.cursorFlags,groups:r.hitRegions.map(e=>e.group),state:r.state}),i=`*, *:hover {cursor: ${e} !important; }`;if(t===i)return;t=i,e?n.cssRules.length===0?n.insertRule(i):n.replaceSync(i):n.cssRules.length===1&&n.deleteRule(0);break}case`inactive`:t=void 0,n.cssRules.length===1&&n.deleteRule(0);break}wg.set(e,{prevStyle:t,styleSheet:n})}function Eg({document:e,event:t,hitRegions:n,initialLayoutMap:r,mountedGroups:i,pointerDownAtPoint:a,prevCursorFlags:o}){let s=0;n.forEach(e=>{let{group:n,groupSize:o}=e,{orientation:c,panels:l}=n,{disableCursor:u}=n.mutableState,d=0;d=a?c===`horizontal`?(t.clientX-a.x)/o*100:(t.clientY-a.y)/o*100:c===`horizontal`?t.clientX<0?-100:100:t.clientY<0?-100:100;let f=r.get(n),p=i.get(n);if(!f||!p)return;let{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:_,separatorToPanels:v}=p;if(h&&_&&v){let t=Zh({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(Qh(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?hg:gg;break;case`vertical`:s|=d<0?_g:vg;break}}else Nh(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&yg:c|=s&yg,t.movementY===0?c|=o&bg:c|=s&bg,ug(c),Tg(e)}function Dg(e){let t=jh(),n=cg();switch(n.state){case`active`:Eg({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function Og(e){if(e.defaultPrevented)return;let t=cg(),n=jh();switch(t.state){case`active`:if(e.buttons===0){dg({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{let t=Ah(e.group.id,!0);Nh(e.group,t)});return}for(let n of t.hitRegions)if(n.separator){let{element:t}=n.separator;t.hasPointerCapture?.(e.pointerId)||t.setPointerCapture?.(e.pointerId)}Eg({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=Kh(e,n);r.length===0?t.state!==`inactive`&&dg({cursorFlags:0,state:`inactive`}):dg({cursorFlags:0,hitRegions:r,state:`hover`}),Tg(e.currentTarget);break}}}function kg(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(cg().state){case`hover`:dg({cursorFlags:0,state:`inactive`})}}function Ag(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=cg();switch(t.state){case`active`:dg({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&(Tg(e.currentTarget),t.hitRegions.forEach(e=>{let t=Ah(e.group.id,!0);Nh(e.group,t)}),e.preventDefault())}}function jg(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=fh(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=fh((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function Mg(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=ph({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:fh(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function Ng(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function Pg({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:r}){if(n<=0||t<=0||n===t)return r;let i=0,a=0,o=!1,s=new Map,c=[];for(let l of e.panels){let e=r[l.id]??0;switch(l.panelConstraints.groupResizeBehavior){case`preserve-pixel-size`:{o=!0;let r=fh(e/100*n/t*100);s.set(l.id,r),i+=r;break}default:c.push(l.id),a+=e;break}}if(!o||c.length===0)return r;let l=100-i,u={...r};if(s.forEach((e,t)=>{u[t]=e}),a>0)for(let e of c)u[e]=fh((r[e]??0)/a*l);else{let e=fh(l/c.length);for(let t of c)u[t]=e}return u}function Fg(e,t){let n=e.map(e=>e.id),r=Object.keys(t);if(n.length!==r.length)return!1;for(let e of n)if(!r.includes(e))return!1;return!0}var Ig=new Map;function Lg(e){let t=!0;hh(e.element.ownerDocument.defaultView,`Cannot register an unmounted Group`);let n=e.element.ownerDocument.defaultView.ResizeObserver,r=new Set,i=new Set,a=new n(n=>{for(let r of n){let{borderBoxSize:n,target:i}=r;if(i===e.element){if(t){let t=ph({group:e});if(t===0)return;let n=Ah(e.id);if(!n)return;let r=mh(e),i=n.defaultLayoutDeferred?jg(r):n.layout,a=$h({layout:Pg({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&Qh(n.layout,a)&&Ng(n.derivedPanelConstraints,r)&&n.groupSize===t)return;Nh(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else Mg(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{hh(!r.has(e.id),`Panel ids must be unique; id "${e.id}" was used more than once`),r.add(e.id),e.onResize&&a.observe(e.element)});let o=ph({group:e}),s=mh(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(Fg(e.panels,l)||(l=void 0));let u=$h({layout:e.mutableState.layouts[c]??l??jg(s),panelConstraints:s}),d=e.element.ownerDocument;Ig.set(d,(Ig.get(d)??0)+1);let f=new Map;return wh(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),Nh(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{hh(!i.has(e.id),`Separator ids must be unique; id "${e.id}" was used more than once`),i.add(e.id),e.element.addEventListener(`keydown`,ag)}),Ig.get(d)===1&&(d.addEventListener(`dblclick`,tg,!0),d.addEventListener(`pointerdown`,fg,!0),d.addEventListener(`pointerleave`,Dg),d.addEventListener(`pointermove`,Og),d.addEventListener(`pointerout`,kg),d.addEventListener(`pointerup`,Ag,!0)),function(){t=!1,Ig.set(d,Math.max(0,(Ig.get(d)??0)-1)),Oh(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,ag)}),Ig.get(d)||(d.removeEventListener(`dblclick`,tg,!0),d.removeEventListener(`pointerdown`,fg,!0),d.removeEventListener(`pointerleave`,Dg),d.removeEventListener(`pointermove`,Og),d.removeEventListener(`pointerout`,kg),d.removeEventListener(`pointerup`,Ag,!0)),a.disconnect()}}function Rg(){let[e,t]=(0,X.useState)({});return[e,(0,X.useCallback)(()=>t({}),[])]}function zg(e){let t=(0,X.useId)();return`${e??t}`}var Bg=typeof window<`u`?X.useLayoutEffect:X.useEffect;function Vg(e){let t=(0,X.useRef)(e);return Bg(()=>{t.current=e},[e]),(0,X.useCallback)((...e)=>t.current?.(...e),[t])}function Hg(...e){return Vg(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t;break}})})}function Ug(e){let t=(0,X.useRef)({...e});return Bg(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var Wg=(0,X.createContext)(null);function Gg(e,t){let n=(0,X.useRef)({getLayout:()=>({}),setLayout:pg});(0,X.useImperativeHandle)(t,()=>n.current,[]),Bg(()=>{Object.assign(n.current,rg({groupId:e}))})}function Kg({children:e,className:t,defaultLayout:n,disableCursor:r,disabled:i,elementRef:a,groupRef:o,id:s,onLayoutChange:c,onLayoutChanged:l,orientation:u=`horizontal`,resizeTargetMinimumSize:d={coarse:20,fine:10},style:f,...p}){let m=(0,X.useRef)({onLayoutChange:{},onLayoutChanged:{}}),h=Vg(e=>{Qh(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=Vg(e=>{Qh(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e))}),_=zg(s),v=(0,X.useRef)(null),[y,b]=Rg(),x=(0,X.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),S=Hg(v,a);Gg(_,o);let C=Vg((e,t)=>{let r=cg(),i=kh(e),a=Ah(e);if(a){let e=!1;switch(r.state){case`active`:e=r.hitRegions.some(e=>e.group===i);break}return{flexGrow:a.layout[t]??1,pointerEvents:e?`none`:void 0}}if(n?.[t])return{flexGrow:n?.[t]}}),w=Ug({defaultLayout:n,disableCursor:r}),T=(0,X.useMemo)(()=>({get disableCursor(){return!!w.disableCursor},getPanelStyles:C,id:_,orientation:u,registerPanel:e=>{let t=x.current;return t.panels=gh(u,[...t.panels,e]),b(),()=>{t.panels=t.panels.filter(t=>t!==e),b()}},registerSeparator:e=>{let t=x.current;return t.separators=gh(u,[...t.separators,e]),b(),()=>{t.separators=t.separators.filter(t=>t!==e),b()}},updatePanelProps:(e,{disabled:t})=>{let n=x.current.panels.find(t=>t.id===e);n&&(n.panelConstraints.disabled=t);let r=kh(_),i=Ah(_);r&&i&&Nh(r,{...i,derivedPanelConstraints:mh(r)})},updateSeparatorProps:(e,{disabled:t,disableDoubleClick:n})=>{let r=x.current.separators.find(t=>t.id===e);r&&(r.disabled=t,r.disableDoubleClick=n)}}),[C,_,b,u,w]),E=(0,X.useRef)(null);return Bg(()=>{let e=v.current;if(e===null)return;let t=x.current,n;if(w.defaultLayout!==void 0&&Object.keys(w.defaultLayout).length===t.panels.length){n={};for(let e of t.panels){let t=w.defaultLayout[e.id];t!==void 0&&(n[e.id]=t)}}let r={disabled:!!i,element:e,id:_,mutableState:{defaultLayout:n,disableCursor:!!w.disableCursor,expandedPanelSizes:x.current.lastExpandedPanelSizes,layouts:x.current.layouts},orientation:u,panels:t.panels,resizeTargetMinimumSize:t.resizeTargetMinimumSize,separators:t.separators};E.current=r;let a=Lg(r),{defaultLayoutDeferred:o,derivedPanelConstraints:s,layout:c}=Ah(r.id,!0);!o&&s.length>0&&(h(c),g(c));let l=Mh(_,e=>{let{defaultLayoutDeferred:t,derivedPanelConstraints:n,layout:i}=e.next;if(t||n.length===0)return;let a=r.panels.map(({id:e})=>e).join(`,`);r.mutableState.layouts[a]=i,n.forEach(t=>{if(t.collapsible){let{layout:n}=e.prev??{};if(n){let e=Jh(t.collapsedSize,i[t.panelId]),a=Jh(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=cg().state!==`active`;h(i),o&&g(i)});return()=>{E.current=null,a(),l()}},[i,_,g,h,u,y,w]),(0,X.useEffect)(()=>{let e=E.current;e&&(e.mutableState.defaultLayout=n,e.mutableState.disableCursor=!!r)}),(0,Y.jsx)(Wg.Provider,{value:T,children:(0,Y.jsx)(`div`,{...p,className:t,"data-group":!0,"data-testid":_,id:_,ref:S,style:{height:`100%`,width:`100%`,overflow:`hidden`,...f,display:`flex`,flexDirection:u===`horizontal`?`row`:`column`,flexWrap:`nowrap`,touchAction:u===`horizontal`?`pan-y`:`pan-x`},children:e})})}Kg.displayName=`Group`;function qg(){let e=(0,X.useContext)(Wg);return hh(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function Jg(e,t){let{id:n}=qg(),r=(0,X.useRef)({collapse:mg,expand:mg,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:mg});(0,X.useImperativeHandle)(t,()=>r.current,[]),Bg(()=>{Object.assign(r.current,eg({groupId:n,panelId:e}))})}function Yg({children:e,className:t,collapsedSize:n=`0%`,collapsible:r=!1,defaultSize:i,disabled:a,elementRef:o,groupResizeBehavior:s=`preserve-relative-size`,id:c,maxSize:l=`100%`,minSize:u=`0%`,onResize:d,panelRef:f,style:p,...m}){let h=!!c,g=zg(c),_=Ug({disabled:a}),v=(0,X.useRef)(null),y=Hg(v,o),{getPanelStyles:b,id:x,orientation:S,registerPanel:C,updatePanelProps:w}=qg(),T=d!==null,E=Vg((e,t,n)=>{d?.(e,c,n)});Bg(()=>{let e=v.current;if(e!==null)return C({element:e,id:g,idIsStable:h,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:T?E:void 0,panelConstraints:{groupResizeBehavior:s,collapsedSize:n,collapsible:r,defaultSize:i,disabled:_.disabled,maxSize:l,minSize:u}})},[s,n,r,i,T,g,h,l,u,E,C,_]),(0,X.useEffect)(()=>{w(g,{disabled:a})},[a,g,w]),Jg(g,f);let D=()=>{let e=b(x,g);if(e)return JSON.stringify(e)},O=(0,X.useSyncExternalStore)(e=>Mh(x,e),D,D),k;return k=O?JSON.parse(O):i?{flexGrow:void 0,flexShrink:void 0,flexBasis:i}:{flexGrow:1},(0,Y.jsx)(`div`,{...m,"data-disabled":a||void 0,"data-panel":!0,"data-testid":g,id:g,ref:y,style:{...Xg,display:`flex`,flexBasis:0,flexShrink:1,overflow:`visible`,...k},children:(0,Y.jsx)(`div`,{className:t,style:{maxHeight:`100%`,maxWidth:`100%`,flexGrow:1,overflow:`auto`,...p,touchAction:S===`horizontal`?`pan-y`:`pan-x`},children:e})})}Yg.displayName=`Panel`;var Xg={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function Zg(){return(0,X.useRef)(null)}function Qg({layout:e,panelConstraints:t,panelId:n,panelIndex:r}){let i,a,o=e[n],s=t.find(e=>e.panelId===n);if(s){let c=s.maxSize,l=s.collapsible?s.collapsedSize:s.minSize,u=[r,r+1];a=$h({layout:Zh({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=$h({layout:Zh({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function $g({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...s}){let c=zg(a),l=Ug({disabled:n,disableDoubleClick:r}),[u,d]=(0,X.useState)({}),[f,p]=(0,X.useState)(`inactive`),m=(0,X.useRef)(null),h=Hg(m,i),{disableCursor:g,id:_,orientation:v,registerSeparator:y,updateSeparatorProps:b}=qg(),x=v===`horizontal`?`vertical`:`horizontal`;Bg(()=>{let e=m.current;if(e!==null){let t={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:e,id:c},n=y(t),r=lg(e=>{p(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=Mh(_,e=>{let{derivedPanelConstraints:n,layout:r,separatorToPanels:i}=e.next,a=i.get(t);if(a){let e=a[0],t=a.indexOf(e);d(Qg({layout:r,panelConstraints:n,panelId:e.id,panelIndex:t}))}});return()=>{r(),i(),n()}}},[_,c,y,l]),(0,X.useEffect)(()=>{b(c,{disabled:n,disableDoubleClick:r})},[n,r,c,b]);let S;return n&&!g&&(S=`not-allowed`),(0,Y.jsx)(`div`,{...s,"aria-controls":u.valueControls,"aria-disabled":n||void 0,"aria-orientation":x,"aria-valuemax":u.valueMax,"aria-valuemin":u.valueMin,"aria-valuenow":u.valueNow,children:e,className:t,"data-separator":n?`disabled`:f,"data-testid":c,id:c,ref:h,role:`separator`,style:{flexBasis:`auto`,cursor:S,...o,flexGrow:0,flexShrink:0,touchAction:`none`},tabIndex:n?void 0:0})}$g.displayName=`Separator`;async function e_(e){let t=await fetch(`/api/backlinks?docName=${encodeURIComponent(e)}`);if(!t.ok)throw Error(`Server error: ${t.status} ${t.statusText}`);let n=await t.json();if(!n.ok)throw Error(n.error??`Failed to load backlinks`);return n.backlinks??[]}function t_(e){let t=(0,Z.c)(32),{docName:n,className:r}=e,i=r===void 0?``:r,{folderPaths:a,pages:o,loading:s}=Vn(),c,l;t[0]===n?(c=t[1],l=t[2]):(c=[`backlinks`,n],l=()=>e_(n),t[0]=n,t[1]=c,t[2]=l);let u;t[3]!==n||t[4]!==s||t[5]!==o?(u=!s&&o.has(n),t[3]=n,t[4]=s,t[5]=o,t[6]=u):u=t[6];let d;t[7]!==c||t[8]!==l||t[9]!==u?(d={queryKey:c,queryFn:l,enabled:u},t[7]=c,t[8]=l,t[9]=u,t[10]=d):d=t[10];let{data:f,isLoading:p,error:m}=N(d),g;t[11]===f?g=t[12]:(g=f===void 0?[]:f,t[11]=f,t[12]=g);let _=g,v;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Y.jsx)(j,{children:`Backlinks`}),t[13]=v):v=t[13];let y;t[14]!==_||t[15]!==p?(y=!p&&(0,Y.jsx)(A,{children:_.length}),t[14]=_,t[15]=p,t[16]=y):y=t[16];let b;t[17]===y?b=t[18]:(b=(0,Y.jsxs)(O,{children:[v,y]}),t[17]=y,t[18]=b);let x;t[19]!==_||t[20]!==m||t[21]!==a||t[22]!==p||t[23]!==o?(x=m?(0,Y.jsx)(h,{children:m instanceof Error?m.message:`Failed to load backlinks`}):_.length===0&&!p?(0,Y.jsx)(S,{children:`No pages link here yet.`}):(0,Y.jsx)(`div`,{className:`flex flex-col gap-2`,children:_.map((e,t)=>(0,Y.jsxs)(`button`,{type:`button`,className:`block w-full rounded-lg border border-border bg-background/80 px-3 py-2 text-left transition-colors hover:bg-accent hover:text-accent-foreground`,onClick:()=>{let t=Ae(e.source,{pages:o,folderPaths:a});window.location.assign(Nn(t.hashDocName,e.anchor))},children:[(0,Y.jsx)(`div`,{className:`truncate text-sm font-medium`,children:e.title}),(0,Y.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:e.source}),e.snippet?(0,Y.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:e.snippet}):null]},`${e.source}-${t}`))}),t[19]=_,t[20]=m,t[21]=a,t[22]=p,t[23]=o,t[24]=x):x=t[24];let C;t[25]!==p||t[26]!==x?(C=(0,Y.jsx)(D,{"aria-busy":p,children:x}),t[25]=p,t[26]=x,t[27]=C):C=t[27];let w;return t[28]!==i||t[29]!==b||t[30]!==C?(w=(0,Y.jsxs)(M,{className:i,children:[b,C]}),t[28]=i,t[29]=b,t[30]=C,t[31]=w):w=t[31],w}function n_(e){let t=e.split(`/`);return t.length<=2?e:`…/${t.slice(-2).join(`/`)}`}async function r_(e){let t=await fetch(`/api/forward-links?docName=${encodeURIComponent(e)}`);if(!t.ok)throw Error(`Server error: ${t.status} ${t.statusText}`);let n=await t.json();if(!n.ok)throw Error(n.error??`Failed to load outgoing links`);return n.forwardLinks??[]}function i_(e){let t=(0,Z.c)(50),{docName:n,className:r}=e,i=r===void 0?``:r,{folderPaths:a,pages:o,loading:s}=Vn(),c,l;t[0]===n?(c=t[1],l=t[2]):(c=[`forward-links`,n],l=()=>r_(n),t[0]=n,t[1]=c,t[2]=l);let u;t[3]!==n||t[4]!==o||t[5]!==s?(u=!s&&o.has(n),t[3]=n,t[4]=o,t[5]=s,t[6]=u):u=t[6];let d;t[7]!==c||t[8]!==l||t[9]!==u?(d={queryKey:c,queryFn:l,enabled:u},t[7]=c,t[8]=l,t[9]=u,t[10]=d):d=t[10];let{data:f,isLoading:p,error:m}=N(d),g;t[11]===f?g=t[12]:(g=f===void 0?[]:f,t[11]=f,t[12]=g);let _=g,[v,y]=(0,X.useState)(null),b;if(t[13]!==v||t[14]!==a||t[15]!==o){let e=v===null?null:Et(v.docName,{pages:o,folderPaths:a});b=e===null?null:e.kind===`create`?{initialDir:e.initialDir,suggestedName:e.suggestedName}:Ie(e),t[13]=v,t[14]=a,t[15]=o,t[16]=b}else b=t[16];let x=b,C;t[17]!==a||t[18]!==o||t[19]!==s?(C=function(e){if(e.kind===`external`){window.open(e.url,`_blank`,`noopener,noreferrer`);return}let t=Et(e.docName,{pages:o,folderPaths:a});if(!s&&t.kind===`create`){y(e);return}let n=t.kind===`navigate`?t.hashDocName:e.docName;window.location.assign(Nn(n,e.anchor))},t[17]=a,t[18]=o,t[19]=s,t[20]=C):C=t[20];let w=C,T;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Y.jsx)(j,{children:`Outgoing Links`}),t[21]=T):T=t[21];let E;t[22]!==p||t[23]!==_?(E=!p&&(0,Y.jsx)(A,{children:_.length}),t[22]=p,t[23]=_,t[24]=E):E=t[24];let k;t[25]===E?k=t[26]:(k=(0,Y.jsxs)(O,{children:[T,E]}),t[25]=E,t[26]=k);let P;t[27]!==m||t[28]!==a||t[29]!==w||t[30]!==p||t[31]!==_||t[32]!==o||t[33]!==s?(P=m?(0,Y.jsx)(h,{children:m instanceof Error?m.message:`Failed to load outgoing links`}):_.length===0&&!p?(0,Y.jsx)(S,{children:`This page doesn't link to anything yet.`}):(0,Y.jsx)(`div`,{className:`flex flex-col gap-2`,children:_.map(e=>{let t=e.kind===`doc`?Et(e.docName,{pages:o,folderPaths:a}):null,n=e.kind===`doc`&&!s&&t?.kind===`create`,r=e.kind===`doc`&&!s&&t?.kind===`navigate`&&t.displayState===`folder`,i=e.kind===`doc`?n_(e.docName):e.url,c=e.kind===`doc`&&e.title===e.docName?i:e.title,l=e.kind===`doc`?`doc:${e.docName}:${e.anchor??``}`:`ext:${e.url}`;return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(K,{variant:`outline`,className:W(`h-auto w-full items-start justify-start whitespace-normal px-3 py-2 text-left`,n&&`border-amber-300 bg-amber-50/70 text-amber-950 hover:bg-amber-100 dark:border-amber-900 dark:bg-amber-950/20 dark:text-amber-200 dark:hover:bg-amber-950/35`,r&&`border-sky-300 bg-sky-50/70 text-sky-950 hover:bg-sky-100 dark:border-sky-900 dark:bg-sky-950/20 dark:text-sky-100 dark:hover:bg-sky-950/35`),onClick:()=>w(e),children:(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`div`,{className:`truncate text-sm font-medium`,title:e.kind===`doc`&&e.title===e.docName?e.docName:e.kind===`external`?e.url:void 0,children:(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Y.jsx)(`span`,{children:c}),e.kind===`external`?(0,Y.jsx)(Te,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}):null]})}),e.kind===`doc`&&e.title!==e.docName?(0,Y.jsx)(`div`,{className:`truncate font-mono text-xs text-muted-foreground`,title:e.docName,children:i}):null,e.kind===`external`?(0,Y.jsx)(`div`,{className:`mt-0.5 truncate font-mono text-xs text-muted-foreground`,children:e.url}):null,n?(0,Y.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-1.5 text-xs text-amber-700 dark:text-amber-300`,children:[(0,Y.jsx)(We,{className:`size-3 shrink-0`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{children:`Missing page. Click to create.`})]}):null,r?(0,Y.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-1.5 text-xs text-sky-700 dark:text-sky-300`,children:[(0,Y.jsx)(nt,{className:`size-3 shrink-0`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{children:`Folder target. Click to open the overview.`})]}):null,e.snippet?(0,Y.jsx)(`p`,{className:`mt-1 break-words text-sm text-muted-foreground`,children:e.snippet}):null]})}),r?(0,Y.jsxs)(K,{variant:`outline`,size:`sm`,className:`self-start`,onClick:()=>y(e),children:[(0,Y.jsx)(We,{className:`size-3.5`}),`Create index note`]}):null]},l)})}),t[27]=m,t[28]=a,t[29]=w,t[30]=p,t[31]=_,t[32]=o,t[33]=s,t[34]=P):P=t[34];let F;t[35]!==p||t[36]!==P?(F=(0,Y.jsx)(D,{"aria-busy":p,children:P}),t[35]=p,t[36]=P,t[37]=F):F=t[37];let I;t[38]!==i||t[39]!==k||t[40]!==F?(I=(0,Y.jsxs)(M,{className:i,children:[k,F]}),t[38]=i,t[39]=k,t[40]=F,t[41]=I):I=t[41];let ee=v!==null,L=x?.initialDir??``,R=x?.suggestedName,z;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(z=e=>{e||y(null)},t[42]=z):z=t[42];let B;t[43]!==ee||t[44]!==L||t[45]!==R?(B=(0,Y.jsx)(qe,{open:ee,kind:`file`,initialDir:L,suggestedName:R,onOpenChange:z}),t[43]=ee,t[44]=L,t[45]=R,t[46]=B):B=t[46];let V;return t[47]!==I||t[48]!==B?(V=(0,Y.jsxs)(Y.Fragment,{children:[I,B]}),t[47]=I,t[48]=B,t[49]=V):V=t[49],V}function a_(e){let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/1e3);if(r<60)return`just now`;if(r<3600)return`${Math.floor(r/60)} min ago`;if(r<86400)return`${Math.floor(r/3600)}h ago`;if(r<86400*2)return`yesterday`;let i=Math.floor(r/86400);return i<7?`${i} days ago`:t.toLocaleDateString()}function o_(e){return e.type===`upstream`?`Upstream sync`:e.contributors.length===1?e.contributors[0].name:e.contributors.length>1?e.contributors.map(e=>e.name).join(`, `):e.author===`openknowledge-server`||e.author===`server`?`Auto-save`:e.author}function s_(e){let t=(0,Z.c)(17),n,r;if(t[0]===e?(n=t[1],r=t[2]):({icon:n,...r}=e,t[0]=e,t[1]=n,t[2]=r),n===`claude`){let e;return t[3]===r?e=t[4]:(e=(0,Y.jsx)(me,{...r}),t[3]=r,t[4]=e),e}if(n===`cursor`){let e;return t[5]===r?e=t[6]:(e=(0,Y.jsx)(le,{...r}),t[5]=r,t[6]=e),e}if(n===`windsurf`){let e;return t[7]===r?e=t[8]:(e=(0,Y.jsx)(pe,{...r}),t[7]=r,t[8]=e),e}if(n===`openai`){let e;return t[9]===r?e=t[10]:(e=(0,Y.jsx)(ye,{...r}),t[9]=r,t[10]=e),e}if(n===`cline`){let e;return t[11]===r?e=t[12]:(e=(0,Y.jsx)(ue,{...r}),t[11]=r,t[12]=e),e}if(n===`github`){let e;return t[13]===r?e=t[14]:(e=(0,Y.jsx)(ge,{...r}),t[13]=r,t[14]=e),e}let i=r,a;return t[15]===i?a=t[16]:(a=(0,Y.jsx)(xe,{strokeWidth:1.5,...i}),t[15]=i,t[16]=a),a}function c_(e){let t=(0,Z.c)(17),{entry:n,isDark:r}=e;if(n.type===`upstream`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(ki,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[0]=e):e=t[0],e}if(n.contributors.length>0){let e=n.contributors[0],i=e.colorSeed??e.name,a;t[1]===i?a=t[2]:(a=gn(i),t[1]=i,t[2]=a);let o=a,s=r?Yn[o]??Bn[o]:Bn[o],c;t[3]!==s||t[4]!==i?(c=s??hn(i),t[3]=s,t[4]=i,t[5]=c):c=t[5];let l=c;if(o!==`bot`){let e;t[6]===l?e=t[7]:(e={color:l},t[6]=l,t[7]=e);let n;return t[8]!==o||t[9]!==e?(n=(0,Y.jsx)(s_,{icon:o,width:14,height:14,className:`shrink-0`,style:e}),t[8]=o,t[9]=e,t[10]=n):n=t[10],n}if(e.name===`File System`){let e;return t[11]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(Mi,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[11]=e):e=t[11],e}if(e.name===`Open Knowledge (service)`||e.name===`Git (upstream)`){let e;return t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(Jr,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[12]=e):e=t[12],e}let u;return t[13]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Y.jsx)(ga,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[13]=u):u=t[13],u}if(n.authorEmail.includes(`agent`)||n.author.includes(`agent`)||n.authorEmail.includes(`cursor`)||n.authorEmail.includes(`claude`)){let e;return t[14]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(xe,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[14]=e):e=t[14],e}if(n.author===`openknowledge-server`||n.author===`server`){let e;return t[15]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(Jr,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[15]=e):e=t[15],e}let i;return t[16]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Y.jsx)(ga,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[16]=i):i=t[16],i}function l_(e){let t=(0,Z.c)(7),{selected:n,onSelect:r}=e,i=n?`bg-muted`:`hover:bg-muted/50`,a;t[0]===i?a=t[1]:(a=[`group flex w-full items-center gap-3 rounded-lg px-3 py-2.5 text-left transition-colors cursor-pointer outline-none focus-visible:ring-2 focus-visible:ring-ring`,i],t[0]=i,t[1]=a);let o=a.join(` `),s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Y.jsxs)(`div`,{className:`flex items-center justify-center w-3.5 h-3.5`,children:[` `,(0,Y.jsx)(`span`,{className:`inline-block size-2 rounded-full bg-emerald-500 shrink-0`})]}),t[2]=s):s=t[2];let c;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Y.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,Y.jsx)(`p`,{className:`text-xs font-medium text-foreground`,children:`Current version`})}),t[3]=c):c=t[3];let l;return t[4]!==r||t[5]!==o?(l=(0,Y.jsxs)(`button`,{type:`button`,className:o,onClick:r,children:[s,c]}),t[4]=r,t[5]=o,t[6]=l):l=t[6],l}var u_={sha:``,timestamp:``,author:``,authorEmail:``,type:`wip`,message:``,contributors:[],checkpoint:null};function d_(e){let t=(0,Z.c)(16),{entries:n,defaultExpanded:r,selectedSha:i,onSelect:a,isDark:o}=e,[s,c]=(0,X.useState)(r);if(n.length===0)return null;let l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>c(f_),t[0]=l):l=t[0];let u;t[1]===s?u=t[2]:(u=s?(0,Y.jsx)(fe,{className:`size-3`}):(0,Y.jsx)(de,{className:`size-3`}),t[1]=s,t[2]=u);let d=s?`Hide ${n.length} auto-save${n.length>1?`s`:``}`:`Show ${n.length} auto-save${n.length>1?`s`:``}`,f;t[3]!==s||t[4]!==u||t[5]!==d?(f=(0,Y.jsxs)(`button`,{type:`button`,"aria-expanded":s,className:`flex items-center gap-1.5 rounded-lg px-3 py-2 text-xs text-muted-foreground hover:text-foreground hover:bg-muted/50 transition-colors text-left`,onClick:l,children:[u,d]}),t[3]=s,t[4]=u,t[5]=d,t[6]=f):f=t[6];let p;t[7]!==n||t[8]!==s||t[9]!==o||t[10]!==a||t[11]!==i?(p=s&&n.map(e=>(0,Y.jsx)(b_,{entry:e,selected:e.sha===i,onSelect:a,isDark:o},e.sha)),t[7]=n,t[8]=s,t[9]=o,t[10]=a,t[11]=i,t[12]=p):p=t[12];let m;return t[13]!==f||t[14]!==p?(m=(0,Y.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[f,p]}),t[13]=f,t[14]=p,t[15]=m):m=t[15],m}function f_(e){return!e}function p_(e){return e.checkpoint?e.checkpoint.kind:`save`}function m_(e){let t=p_(e);if(t===`save`)return`Save Version`;let n=e.checkpoint?.size??null,r=n!=null&&n>0?` (${h_(n)})`:``;return t===`bridge-merge-loss`?`Auto-saved before a concurrent edit${r}`:`Recovered from an external change${r}`}function h_(e){return e<1024?`${e} B`:e<1024*1024?`${Math.round(e/102.4)/10} KB`:`${Math.round(e/104857.6)/10} MB`}function g_(e){let t=[];for(let n of e.contributors)if(n.summaries)for(let e of n.summaries)t.push(e);return t}function __(e){let t=(0,Z.c)(20),{summaries:n}=e,[r,i]=(0,X.useState)(!1),a=(0,X.useId)();if(n.length===0)return null;let o,s;t[0]===n?(o=t[1],s=t[2]):([o,...s]=n,t[0]=n,t[1]=o,t[2]=s);let c;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Y.jsx)(`span`,{"aria-hidden":`true`,children:`• `}),t[3]=c):c=t[3];let l;t[4]===o?l=t[5]:(l=(0,Y.jsxs)(`li`,{className:`text-xs text-foreground/90`,children:[c,o]}),t[4]=o,t[5]=l);let u;t[6]!==r||t[7]!==s?(u=r&&s.map(y_),t[6]=r,t[7]=s,t[8]=u):u=t[8];let d;t[9]!==a||t[10]!==l||t[11]!==u?(d=(0,Y.jsxs)(`ul`,{id:a,className:`list-none`,children:[l,u]}),t[9]=a,t[10]=l,t[11]=u,t[12]=d):d=t[12];let f;t[13]!==r||t[14]!==a||t[15]!==s.length?(f=s.length>0&&(0,Y.jsxs)(`button`,{type:`button`,"aria-expanded":r,"aria-controls":a,className:`inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors cursor-pointer`,onClick:e=>{e.stopPropagation(),i(v_)},children:[r?(0,Y.jsx)(fe,{className:`size-3`}):(0,Y.jsx)(de,{className:`size-3`}),r?`Hide ${s.length} more`:`Show ${s.length} more`]}),t[13]=r,t[14]=a,t[15]=s.length,t[16]=f):f=t[16];let p;return t[17]!==d||t[18]!==f?(p=(0,Y.jsxs)(`div`,{className:`mt-0.5`,children:[d,f]}),t[17]=d,t[18]=f,t[19]=p):p=t[19],p}function v_(e){return!e}function y_(e,t){return(0,Y.jsxs)(`li`,{className:`text-xs text-foreground/90`,children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,children:`• `}),e]},`${t}-${e}`)}function b_(e){let t=(0,Z.c)(61),{entry:n,selected:r,onSelect:i,prominent:a,isDark:o}=e,s=a===void 0?!1:a,c;t[0]===n.timestamp?c=t[1]:(c=a_(n.timestamp),t[0]=n.timestamp,t[1]=c);let l=c,u;t[2]===n?u=t[3]:(u=o_(n),t[2]=n,t[3]=u);let d=u,f,p,m,h,g,_,v,y,b,x;if(t[4]!==d||t[5]!==n||t[6]!==o||t[7]!==i||t[8]!==s||t[9]!==l||t[10]!==r){let e=n.contributors.flatMap(x_),a;t[21]===n?a=t[22]:(a=g_(n),t[21]=n,t[22]=a);let c=a,u;t[23]!==n||t[24]!==i?(u=()=>i?.(n),t[23]=n,t[24]=i,t[25]=u):u=t[25];let S=u,C;t[26]!==n||t[27]!==o||t[28]!==s?(C=s?(()=>{let e=p_(n);return e===`bridge-merge-loss`?(0,Y.jsx)(De,{className:`size-3.5 shrink-0 text-amber-600 dark:text-amber-400`,"aria-hidden":`true`}):e===`external-change-rescue`?(0,Y.jsx)(Ci,{className:`size-3.5 shrink-0 text-sky-600 dark:text-sky-400`,"aria-hidden":`true`}):(0,Y.jsx)(bi,{className:`size-3.5 shrink-0 text-muted-foreground`})})():(0,Y.jsx)(c_,{entry:n,isDark:o}),t[26]=n,t[27]=o,t[28]=s,t[29]=C):C=t[29];let w=C;b=`button`,x=0;let T=r?`bg-muted`:`hover:bg-muted/50`,E;t[30]===T?E=t[31]:(E=[`group flex w-full items-start gap-3 rounded-lg px-3 py-2.5 text-left transition-colors cursor-pointer outline-none focus-visible:ring-2 focus-visible:ring-ring`,T],t[30]=T,t[31]=E),f=E.join(` `),p=S,t[32]===S?m=t[33]:(m=e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),S())},t[32]=S,t[33]=m),t[34]===w?h=t[35]:(h=(0,Y.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:w}),t[34]=w,t[35]=h),g=`min-w-0 flex-1 space-y-0.5`;let D;t[36]!==d||t[37]!==n||t[38]!==s?(D=s?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{className:`text-xs text-foreground truncate`,children:m_(n)}),(0,Y.jsx)(`span`,{className:`text-xs text-muted-foreground/50`,children:`·`}),(0,Y.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:d})]}):(0,Y.jsx)(`span`,{className:`truncate text-xs text-foreground`,children:d}),t[36]=d,t[37]=n,t[38]=s,t[39]=D):D=t[39];let O;t[40]!==n.timestamp||t[41]!==l?(O=(0,Y.jsx)(`time`,{className:`ml-auto shrink-0 text-xs text-muted-foreground/80`,dateTime:n.timestamp,title:n.timestamp,children:l}),t[40]=n.timestamp,t[41]=l,t[42]=O):O=t[42],t[43]!==D||t[44]!==O?(_=(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[D,O]}),t[43]=D,t[44]=O,t[45]=_):_=t[45],t[46]===c?v=t[47]:(v=c.length>0&&(0,Y.jsx)(__,{summaries:c}),t[46]=c,t[47]=v),y=e.length>0?(0,Y.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,title:e.join(`, `),children:e.join(`, `)}):(0,Y.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,title:n.message,children:n.message}),t[4]=d,t[5]=n,t[6]=o,t[7]=i,t[8]=s,t[9]=l,t[10]=r,t[11]=f,t[12]=p,t[13]=m,t[14]=h,t[15]=g,t[16]=_,t[17]=v,t[18]=y,t[19]=b,t[20]=x}else f=t[11],p=t[12],m=t[13],h=t[14],g=t[15],_=t[16],v=t[17],y=t[18],b=t[19],x=t[20];let S;t[48]!==g||t[49]!==_||t[50]!==v||t[51]!==y?(S=(0,Y.jsxs)(`div`,{className:g,children:[_,v,y]}),t[48]=g,t[49]=_,t[50]=v,t[51]=y,t[52]=S):S=t[52];let C;return t[53]!==f||t[54]!==p||t[55]!==m||t[56]!==h||t[57]!==S||t[58]!==b||t[59]!==x?(C=(0,Y.jsxs)(`div`,{role:b,tabIndex:x,className:f,onClick:p,onKeyDown:m,children:[h,S]}),t[53]=f,t[54]=p,t[55]=m,t[56]=h,t[57]=S,t[58]=b,t[59]=x,t[60]=C):C=t[60],C}function x_(e){return e.docs}function S_(e){let t=(0,Z.c)(43),{docName:n,onEntrySelect:r,selectedSha:i}=e,{resolvedTheme:a}=T(),o=a===`dark`,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=[],t[0]=s):s=t[0];let[c,l]=(0,X.useState)(s),[u,d]=(0,X.useState)(!1),[f,p]=(0,X.useState)(null),m=(0,X.useRef)(null),h,g;t[1]===n?(h=t[2],g=t[3]):(h=()=>{if(!n){l([]);return}let e=!1,t=async function(){if(n)try{let t=await fetch(`/api/history?docName=${encodeURIComponent(n)}&limit=100`);if(e)return;if(!t.ok){p(`History unavailable`);return}let r=await t.json();if(e)return;l(r.entries??[]),p(null)}catch(t){let n=t;if(e)return;p(`History unavailable`),console.error(`[timeline]`,n)}};return d(!0),t().finally(()=>{e||d(!1)}),m.current=setInterval(t,1e4),()=>{e=!0,m.current&&clearInterval(m.current)}},g=[n],t[1]=n,t[2]=h,t[3]=g),(0,X.useEffect)(h,g);let _,v;if(t[4]!==c){_=[];let e=[],n=!1;for(let t of c)t.type===`checkpoint`?(e.length>0&&(_.push({kind:`wip-group`,entries:e,isPreCheckpoint:!n}),e=[]),_.push({kind:`checkpoint`,entry:t}),n=!0):e.push(t);if(e.length>0){let r=!n,i;t[7]!==e||t[8]!==r?(i={kind:`wip-group`,entries:e,isPreCheckpoint:r},t[7]=e,t[8]=r,t[9]=i):i=t[9],_.push(i)}v=c.some(w_),t[4]=c,t[5]=_,t[6]=v}else _=t[5],v=t[6];let y=!v,b=!i,x;t[10]===u?x=t[11]:(x=u&&(0,Y.jsx)(`div`,{className:`flex flex-col gap-1 p-2`,role:`status`,"aria-busy":`true`,"aria-label":`Loading timeline history`,children:[1,2,3].map(C_)}),t[10]=u,t[11]=x);let S;t[12]!==f||t[13]!==u?(S=!u&&f&&(0,Y.jsx)(`div`,{className:`px-4 py-3`,children:(0,Y.jsx)(`p`,{className:`text-xs text-destructive`,children:f})}),t[12]=f,t[13]=u,t[14]=S):S=t[14];let C;t[15]!==c.length||t[16]!==f||t[17]!==u?(C=!u&&!f&&c.length===0&&(0,Y.jsx)(`div`,{className:`px-4 py-8 text-center`,children:(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No history yet`})}),t[15]=c.length,t[16]=f,t[17]=u,t[18]=C):C=t[18];let w;t[19]!==c||t[20]!==f||t[21]!==y||t[22]!==o||t[23]!==b||t[24]!==u||t[25]!==r||t[26]!==i?(w=!u&&!f&&y&&c.length>0&&(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1 p-2`,children:[(0,Y.jsx)(l_,{selected:b,onSelect:()=>r?.(u_)}),c.map(e=>(0,Y.jsx)(b_,{entry:e,selected:e.sha===i,onSelect:r,isDark:o},e.sha))]}),t[19]=c,t[20]=f,t[21]=y,t[22]=o,t[23]=b,t[24]=u,t[25]=r,t[26]=i,t[27]=w):w=t[27];let E;t[28]!==f||t[29]!==_||t[30]!==y||t[31]!==o||t[32]!==b||t[33]!==u||t[34]!==r||t[35]!==i?(E=!u&&!f&&!y&&(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1 p-2`,children:[(0,Y.jsx)(l_,{selected:b,onSelect:()=>r?.(u_)}),_.map((e,t)=>e.kind===`checkpoint`?(0,Y.jsx)(b_,{entry:e.entry,selected:e.entry.sha===i,onSelect:r,prominent:!0,isDark:o},e.entry.sha):(0,Y.jsx)(d_,{entries:e.entries,defaultExpanded:e.isPreCheckpoint,selectedSha:i,onSelect:r,isDark:o},e.entries[0]?.sha??`wip-${t}`))]}),t[28]=f,t[29]=_,t[30]=y,t[31]=o,t[32]=b,t[33]=u,t[34]=r,t[35]=i,t[36]=E):E=t[36];let D;return t[37]!==x||t[38]!==S||t[39]!==C||t[40]!==w||t[41]!==E?(D=(0,Y.jsx)(`div`,{className:`flex h-full flex-col`,children:(0,Y.jsxs)(`div`,{className:`flex-1 overflow-y-auto subtle-scrollbar`,children:[x,S,C,w,E]})}),t[37]=x,t[38]=S,t[39]=C,t[40]=w,t[41]=E,t[42]=D):D=t[42],D}function C_(e){return(0,Y.jsxs)(`div`,{className:`flex items-start gap-3 rounded-lg px-3 py-2.5`,children:[(0,Y.jsx)(Zf,{className:`size-3.5 rounded mt-0.5 shrink-0`}),(0,Y.jsxs)(`div`,{className:`flex-1 space-y-1.5`,children:[(0,Y.jsx)(Zf,{className:`h-3 w-28`}),(0,Y.jsx)(Zf,{className:`h-3 w-40`})]})]},e)}function w_(e){return e.type===`checkpoint`}var T_=[{id:`outline`,label:`Outline`,icon:Bi},{id:`backlinks`,label:`Backlinks`,icon:vi},{id:`forward-links`,label:`Outgoing Links`,icon:yi},{id:`graph`,label:`Graph`,icon:Ui},{id:`timeline`,label:`Timeline`,icon:ui}];function E_(){return n(()=>import(`./GraphPanel-BJ9MldAi.js`),__vite__mapDeps([3,1,4,5,6,7,8,9,10]),import.meta.url)}var D_=(0,X.lazy)(async()=>({default:(await E_()).GraphPanel})),O_=(0,X.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-BdQtVWQT.js`),__vite__mapDeps([11,1,2,4,5,6,7,8,12,13,14]),import.meta.url)).ActivityModeContent}));function k_(e){let t=(0,Z.c)(14),{docName:n,isSourceMode:r,activeTab:i,onActiveTabChange:a,onEntrySelect:o,selectedSha:s,mode:c}=e,l;t[0]!==i||t[1]!==c||t[2]!==a?(l=c===`doc`?(0,Y.jsx)(`div`,{className:`flex flex-row items-center justify-center gap-3 border-b border-border/60 p-2`,children:(0,Y.jsx)(Me,{type:`single`,variant:`outline`,value:i,onValueChange:e=>{e&&a(e)},"aria-label":`Document panels`,children:T_.map(A_)})}):null,t[0]=i,t[1]=c,t[2]=a,t[3]=l):l=t[3];let u;t[4]!==i||t[5]!==n||t[6]!==r||t[7]!==c||t[8]!==o||t[9]!==s?(u=c===`doc`?(0,Y.jsxs)(`div`,{role:`tabpanel`,id:`panel-${i}`,"aria-labelledby":`tab-${i}`,className:`min-h-0 flex-1`,children:[i===`outline`&&(0,Y.jsx)(lr,{docName:n,isSourceMode:r}),i===`backlinks`&&(0,Y.jsx)(t_,{docName:n}),i===`forward-links`&&(0,Y.jsx)(i_,{docName:n}),i===`graph`&&(0,Y.jsx)(X.Suspense,{fallback:(0,Y.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:`Loading graph…`}),children:(0,Y.jsx)(D_,{activeDocName:n})}),i===`timeline`&&(0,Y.jsx)(S_,{docName:n,onEntrySelect:o,selectedSha:s})]}):(0,Y.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Y.jsx)(X.Suspense,{fallback:(0,Y.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:`Loading agent activity…`}),children:(0,Y.jsx)(O_,{})})}),t[4]=i,t[5]=n,t[6]=r,t[7]=c,t[8]=o,t[9]=s,t[10]=u):u=t[10];let d;return t[11]!==l||t[12]!==u?(d=(0,Y.jsxs)(Y.Fragment,{children:[l,u]}),t[11]=l,t[12]=u,t[13]=d):d=t[13],d}function A_(e){let{id:t,label:n,icon:r}=e;return(0,Y.jsxs)(ln,{children:[(0,Y.jsx)(Oe,{value:t,role:`tab`,id:`tab-${t}`,"aria-controls":`panel-${t}`,"aria-label":n,asChild:!0,children:(0,Y.jsx)(nn,{children:(0,Y.jsx)(r,{})})}),(0,Y.jsx)(an,{side:`bottom`,children:n})]},t)}function j_(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Y.jsx)(`div`,{className:`tiptap-editor pt-10`,role:`status`,"aria-busy":`true`,"aria-label":`Loading document`,children:(0,Y.jsxs)(`div`,{className:`space-y-3`,children:[(0,Y.jsx)(Zf,{className:`h-9 w-2/5 mt-6 mb-5`}),(0,Y.jsx)(Zf,{className:`h-4 w-full`}),(0,Y.jsx)(Zf,{className:`h-4 w-3/4`})]})}),e[0]=t):t=e[0],t}function M_(e){let t=e.split(`/`).pop();return t?`${e}/${t}`:null}function N_(e,t){let n=t.get(`${e}/index`);if(n)return n;let r=M_(e);if(r){let e=t.get(r);if(e)return e}return e.split(`/`).pop()??e}function P_(e,t,n){let r=n.get(e);return r&&r!==e?r:t}function F_(e,t){let n=`${e}/`,r=[...t.folderPaths].filter(e=>e.startsWith(n)).map(e=>({path:e,rel:e.slice(n.length)})).filter(e=>e.rel.length>0&&!e.rel.includes(`/`)).map(({path:e,rel:n})=>({kind:`folder`,path:e,name:n,title:N_(e,t.pageTitles)})),i=[...t.pages].filter(e=>e.startsWith(n)).map(e=>({docName:e,rel:e.slice(n.length)})).filter(e=>e.rel.length>0&&!e.rel.includes(`/`)).map(({docName:e,rel:n})=>{let r=t.pageMeta.get(e);return{kind:`file`,path:e,name:n,title:P_(e,n,t.pageTitles),size:r?.size??0,modified:r?.modified??``}}),a=[...r,...i].sort((e,t)=>e.kind===t.kind?e.title.localeCompare(t.title)||e.name.localeCompare(t.name):e.kind===`folder`?-1:1);return{title:N_(e,t.pageTitles),children:a}}function I_(e){let t=(0,Z.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,Y.jsx)(Tc,{"data-slot":`dropdown-menu`,...n}),t[2]=n,t[3]=r),r}function L_(e){let t=(0,Z.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,Y.jsx)(Ec,{"data-slot":`dropdown-menu-trigger`,...n}),t[2]=n,t[3]=r),r}function R_(e){let t=(0,Z.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,align:i,sideOffset:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?`start`:i,s=a===void 0?4:a,c;t[5]===n?c=t[6]:(c=W(`z-50 max-h-(--radix-dropdown-menu-content-available-height) w-(--radix-dropdown-menu-trigger-width) min-w-32 origin-(--radix-dropdown-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-[state=closed]:overflow-hidden 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`,n),t[5]=n,t[6]=c);let l;return t[7]!==o||t[8]!==r||t[9]!==s||t[10]!==c?(l=(0,Y.jsx)(Dc,{children:(0,Y.jsx)(Oc,{"data-slot":`dropdown-menu-content`,sideOffset:s,align:o,className:c,...r})}),t[7]=o,t[8]=r,t[9]=s,t[10]=c,t[11]=l):l=t[11],l}function z_(e){let t=(0,Z.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=W(`group/dropdown-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 not-data-[variant=destructive]: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 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,Y.jsx)(Ac,{"data-slot":`dropdown-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 B_(e){let t=(0,Z.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,Y.jsx)(jc,{"data-slot":`dropdown-menu-radio-group`,...n}),t[2]=n,t[3]=r),r}function V_(e){let t=(0,Z.c)(13),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,children:n,inset:i,...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=W(`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 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`,r),t[5]=r,t[6]=o);let s;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Y.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex items-center justify-center`,"data-slot":`dropdown-menu-radio-item-indicator`,children:(0,Y.jsx)(Nc,{children:(0,Y.jsx)(si,{})})}),t[7]=s):s=t[7];let c;return t[8]!==n||t[9]!==i||t[10]!==a||t[11]!==o?(c=(0,Y.jsxs)(Mc,{"data-slot":`dropdown-menu-radio-item`,"data-inset":i,className:o,...a,children:[s,n]}),t[8]=n,t[9]=i,t[10]=a,t[11]=o,t[12]=c):c=t[12],c}function H_(e){let t=(0,Z.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=W(`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,Y.jsx)(kc,{"data-slot":`dropdown-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 U_(e){let t=(0,Z.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=W(`-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,Y.jsx)(Pc,{"data-slot":`dropdown-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function W_(e){let t=(0,Z.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,Y.jsx)(Fc,{"data-slot":`dropdown-menu-sub`,...n}),t[2]=n,t[3]=r),r}function G_(e){let t=(0,Z.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=W(`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 not-data-[variant=destructive]: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,Y.jsx)(de,{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,Y.jsxs)(Ic,{"data-slot":`dropdown-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 K_(e){let t=(0,Z.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=W(`z-50 min-w-[96px] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-lg bg-popover p-1 text-popover-foreground shadow-lg 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`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Y.jsx)(Lc,{"data-slot":`dropdown-menu-sub-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function q_(e){let t=(0,Z.c)(14),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,containerClassName:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=W(`relative w-full overflow-x-auto subtle-scrollbar`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=W(`w-full caption-bottom text-sm`,n),t[6]=n,t[7]=o);let s;t[8]!==i||t[9]!==o?(s=(0,Y.jsx)(`table`,{"data-slot":`table`,className:o,...i}),t[8]=i,t[9]=o,t[10]=s):s=t[10];let c;return t[11]!==a||t[12]!==s?(c=(0,Y.jsx)(`div`,{"data-slot":`table-container`,className:a,children:s}),t[11]=a,t[12]=s,t[13]=c):c=t[13],c}function J_(e){let t=(0,Z.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=W(`[&_tr]:border-b`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Y.jsx)(`thead`,{"data-slot":`table-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Y_(e){let t=(0,Z.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=W(`[&_tr:last-child]:border-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Y.jsx)(`tbody`,{"data-slot":`table-body`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function X_(e){let t=(0,Z.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,noHover:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=(i===void 0?!1:i)&&`hover:bg-transparent`,o;t[4]!==n||t[5]!==a?(o=W(`hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors`,a,n),t[4]=n,t[5]=a,t[6]=o):o=t[6];let s;return t[7]!==r||t[8]!==o?(s=(0,Y.jsx)(`tr`,{"data-slot":`table-row`,className:o,...r}),t[7]=r,t[8]=o,t[9]=s):s=t[9],s}function Z_(e){let t=(0,Z.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,scope:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`col`:i,o;t[4]===n?o=t[5]:(o=W(`font-mono uppercase text-xs text-muted-foreground h-10 px-4 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]`,n),t[4]=n,t[5]=o);let s;return t[6]!==r||t[7]!==a||t[8]!==o?(s=(0,Y.jsx)(`th`,{"data-slot":`table-head`,scope:a,className:o,...r}),t[6]=r,t[7]=a,t[8]=o,t[9]=s):s=t[9],s}function Q_(e){let t=(0,Z.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=W(`py-3 px-4 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Y.jsx)(`td`,{"data-slot":`table-cell`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function $_(e){if(!e)return`—`;let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/6e4);if(r<1)return`just now`;if(r<60)return`${r}m ago`;let i=Math.floor(r/60);if(i<24)return`${i}h ago`;let a=Math.floor(i/24);return a<30?`${a}d ago`:t.toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`numeric`})}function ev(e,t,n){return[...e].sort((e,r)=>{if(e.kind!==r.kind)return e.kind===`folder`?-1:1;let i=0;switch(t){case`name`:i=e.title.localeCompare(r.title)||e.name.localeCompare(r.name);break;case`modified`:{let t=e.kind===`file`?e.modified:``,n=r.kind===`file`?r.modified:``;i=t.localeCompare(n);break}}return n===`asc`?i:-i})}function tv(e){let t=(0,Z.c)(10),{label:n,sortKey:r,activeKey:i,activeDir:a,onSort:o}=e,s=i===r,c;t[0]!==o||t[1]!==r?(c=()=>o(r),t[0]=o,t[1]=r,t[2]=c):c=t[2];let l;t[3]!==a||t[4]!==s?(l=s?a===`asc`?(0,Y.jsx)(Qr,{className:`ml-1 size-3`}):(0,Y.jsx)(Yr,{className:`ml-1 size-3`}):(0,Y.jsx)(Zr,{className:`ml-1 size-3 text-muted-foreground/50`}),t[3]=a,t[4]=s,t[5]=l):l=t[5];let u;return t[6]!==n||t[7]!==c||t[8]!==l?(u=(0,Y.jsxs)(K,{variant:`ghost`,size:`sm`,className:`-ml-3 h-8 uppercase font-mono`,onClick:c,children:[n,l]}),t[6]=n,t[7]=c,t[8]=l,t[9]=u):u=t[9],u}function nv(e){let t=(0,Z.c)(87),{folderPath:n}=e,{addPage:r,folderPaths:i,loading:a,pages:o,pageTitles:s,pageMeta:c}=Vn(),[l,u]=(0,X.useState)(!1),[d,f]=(0,X.useState)(!1),[p,m]=(0,X.useState)(null),[h,g]=(0,X.useState)(`name`),[_,v]=(0,X.useState)(`asc`);if(a){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(Zf,{className:`size-5 rounded`}),(0,Y.jsx)(Zf,{className:`h-7 w-48`})]}),(0,Y.jsx)(Zf,{className:`h-9 w-20 rounded-md`})]}),t[0]=e):e=t[0];let n;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Y.jsx)(Zf,{className:`h-4 w-16`}),t[1]=n):n=t[1];let r;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Y.jsx)(`div`,{className:`flex min-h-0 flex-1 items-start overflow-y-auto subtle-scrollbar`,role:`status`,"aria-busy":`true`,"aria-label":`Loading folder contents`,children:(0,Y.jsxs)(`div`,{className:`mx-auto flex w-full max-w-4xl flex-col gap-6 px-6 py-8`,children:[e,(0,Y.jsxs)(`div`,{className:`rounded-lg border`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-4 border-b px-4 py-3`,children:[n,(0,Y.jsx)(`div`,{className:`ml-auto`,children:(0,Y.jsx)(Zf,{className:`h-4 w-20`})})]}),[`a`,`b`,`c`,`d`].map(ov)]})]})}),t[2]=r):r=t[2],r}let y,b,x,S,C,w,T,E;if(t[3]!==r||t[4]!==p||t[5]!==d||t[6]!==n||t[7]!==i||t[8]!==c||t[9]!==s||t[10]!==o||t[11]!==_||t[12]!==h){let e=F_(n,{pages:o,pageTitles:s,pageMeta:c,folderPaths:i}),a=ev(e.children,h,_),l;t[21]===h?l=t[22]:(l=function(e){e===h?v(av):(g(e),v(`asc`))},t[21]=h,t[22]=l);let D=l,O;t[23]!==r||t[24]!==n?(O=async function(){f(!0),m(null);try{let e=`${n}/index.md`,t=await fetch(`/api/create-page`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e})}),i=await t.json().catch(iv);if(!t.ok||!i?.ok){m(i?.error??`Server error (HTTP ${t.status})`),f(!1);return}let a=i.docName??`${n}/index`;r(a),Wn([`files`,`backlinks`,`graph`]),window.location.hash=Nn(a)}catch(e){console.warn(`[FolderOverview] create index note failed:`,e),m(`Network error — please try again`)}f(!1)},t[23]=r,t[24]=n,t[25]=O):O=t[25];let k=O;E=`flex min-h-0 flex-1 items-start overflow-y-auto subtle-scrollbar`,w=`mx-auto flex w-full max-w-4xl flex-col gap-6 px-6 py-8`;let A;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Y.jsx)(nt,{className:`size-5 text-muted-foreground`}),t[26]=A):A=t[26];let j=(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[A,(0,Y.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:e.title})]}),M;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Y.jsx)(Zi,{className:`size-4`}),t[27]=M):M=t[27];let N;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Y.jsx)(L_,{asChild:!0,children:(0,Y.jsxs)(K,{children:[M,`New`,(0,Y.jsx)(fe,{className:`size-3`})]})}),t[28]=N):N=t[28];let P;t[29]===k?P=t[30]:(P=()=>void k(),t[29]=k,t[30]=P);let F;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`div`,{className:`font-medium`,children:`Index note`}),(0,Y.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Landing page for this folder`})]}),t[31]=F):F=t[31];let I;t[32]!==d||t[33]!==P?(I=(0,Y.jsx)(z_,{disabled:d,onSelect:P,children:F}),t[32]=d,t[33]=P,t[34]=I):I=t[34];let ee;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Y.jsx)(z_,{onSelect:()=>u(!0),children:(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`div`,{className:`font-medium`,children:`Note`}),(0,Y.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`New note inside this folder`})]})}),t[35]=ee):ee=t[35];let L;t[36]===I?L=t[37]:(L=(0,Y.jsxs)(I_,{children:[N,(0,Y.jsxs)(R_,{align:`end`,children:[I,ee]})]}),t[36]=I,t[37]=L);let R;t[38]!==j||t[39]!==L?(R=(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[j,L]}),t[38]=j,t[39]=L,t[40]=R):R=t[40];let z;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This folder has no landing note yet. Choose an explicit action to add one or open a note inside the folder.`}),t[41]=z):z=t[41];let B;t[42]===p?B=t[43]:(B=p?(0,Y.jsx)(`span`,{role:`alert`,className:`text-sm text-destructive`,children:p}):null,t[42]=p,t[43]=B),t[44]!==R||t[45]!==B?(T=(0,Y.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[R,z,B]}),t[44]=R,t[45]=B,t[46]=T):T=t[46],C=`rounded-lg border`,b=q_;let V=h===`name`?_===`asc`?`ascending`:`descending`:`none`,H;t[47]!==D||t[48]!==_||t[49]!==h?(H=(0,Y.jsx)(tv,{label:`Name`,sortKey:`name`,activeKey:h,activeDir:_,onSort:D}),t[47]=D,t[48]=_,t[49]=h,t[50]=H):H=t[50];let te;t[51]!==V||t[52]!==H?(te=(0,Y.jsx)(Z_,{"aria-sort":V,children:H}),t[51]=V,t[52]=H,t[53]=te):te=t[53];let ne=h===`modified`?_===`asc`?`ascending`:`descending`:`none`,re;t[54]!==D||t[55]!==_||t[56]!==h?(re=(0,Y.jsx)(tv,{label:`Modified`,sortKey:`modified`,activeKey:h,activeDir:_,onSort:D}),t[54]=D,t[55]=_,t[56]=h,t[57]=re):re=t[57];let U;t[58]!==ne||t[59]!==re?(U=(0,Y.jsx)(Z_,{className:`w-32`,"aria-sort":ne,children:re}),t[58]=ne,t[59]=re,t[60]=U):U=t[60],t[61]!==te||t[62]!==U?(S=(0,Y.jsx)(J_,{children:(0,Y.jsxs)(X_,{children:[te,U]})}),t[61]=te,t[62]=U,t[63]=S):S=t[63],y=Y_,x=a.length?a.map(rv):(0,Y.jsx)(X_,{children:(0,Y.jsx)(Q_,{colSpan:2,className:`h-24 text-center text-muted-foreground`,children:`This folder is empty.`})}),t[3]=r,t[4]=p,t[5]=d,t[6]=n,t[7]=i,t[8]=c,t[9]=s,t[10]=o,t[11]=_,t[12]=h,t[13]=y,t[14]=b,t[15]=x,t[16]=S,t[17]=C,t[18]=w,t[19]=T,t[20]=E}else y=t[13],b=t[14],x=t[15],S=t[16],C=t[17],w=t[18],T=t[19],E=t[20];let D;t[64]!==y||t[65]!==x?(D=(0,Y.jsx)(y,{children:x}),t[64]=y,t[65]=x,t[66]=D):D=t[66];let O;t[67]!==b||t[68]!==S||t[69]!==D?(O=(0,Y.jsxs)(b,{children:[S,D]}),t[67]=b,t[68]=S,t[69]=D,t[70]=O):O=t[70];let k;t[71]!==C||t[72]!==O?(k=(0,Y.jsx)(`div`,{className:C,children:O}),t[71]=C,t[72]=O,t[73]=k):k=t[73];let A;t[74]!==w||t[75]!==T||t[76]!==k?(A=(0,Y.jsxs)(`div`,{className:w,children:[T,k]}),t[74]=w,t[75]=T,t[76]=k,t[77]=A):A=t[77];let j;t[78]!==A||t[79]!==E?(j=(0,Y.jsx)(`div`,{className:E,children:A}),t[78]=A,t[79]=E,t[80]=j):j=t[80];let M;t[81]!==l||t[82]!==n?(M=(0,Y.jsx)(qe,{open:l,onOpenChange:u,kind:`file`,initialDir:n}),t[81]=l,t[82]=n,t[83]=M):M=t[83];let N;return t[84]!==j||t[85]!==M?(N=(0,Y.jsxs)(Y.Fragment,{children:[j,M]}),t[84]=j,t[85]=M,t[86]=N):N=t[86],N}function rv(e){return(0,Y.jsxs)(X_,{children:[(0,Y.jsx)(Q_,{children:(0,Y.jsxs)(`a`,{href:Nn(e.path),className:`flex items-center gap-2 rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:[e.kind===`folder`?(0,Y.jsx)(Oi,{className:`size-4 shrink-0 text-muted-foreground`}):(0,Y.jsx)(tt,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Y.jsx)(`span`,{className:`truncate`,children:e.title})]})}),(0,Y.jsx)(Q_,{className:`text-muted-foreground`,children:e.kind===`file`?$_(e.modified):`—`})]},e.path)}function iv(){return null}function av(e){return e===`asc`?`desc`:`asc`}function ov(e){return(0,Y.jsxs)(`div`,{className:`flex items-center gap-3 border-b px-4 py-3 last:border-b-0`,children:[(0,Y.jsx)(Zf,{className:`size-4 rounded`}),(0,Y.jsx)(Zf,{className:`h-4 w-40`}),(0,Y.jsx)(`div`,{className:`ml-auto`,children:(0,Y.jsx)(Zf,{className:`h-4 w-16`})})]},e)}var sv=1e3,cv=3;function lv(e,t,n){let r=n?.windowMs??600,i=n?.maxLevel??cv;if(e===0||t>=r)return 1;let a=e+1;return a>i?i:a}var uv={0:{count:0,startRadius:0,baseDistance:0,distanceVariance:0,sizeMin:0,sizeMax:0,maxDelay:0,durationMin:0,durationMax:0},1:{count:0,startRadius:0,baseDistance:0,distanceVariance:0,sizeMin:0,sizeMax:0,maxDelay:0,durationMin:0,durationMax:0},2:{count:0,startRadius:0,baseDistance:0,distanceVariance:0,sizeMin:0,sizeMax:0,maxDelay:0,durationMin:0,durationMax:0},3:{count:16,startRadius:11,baseDistance:7,distanceVariance:3,sizeMin:.45,sizeMax:1.2,maxDelay:130,durationMin:620,durationMax:920}},dv=[`var(--color-azure-blue)`,`var(--color-sky-blue)`,`var(--color-violet-300)`,`var(--color-orange-light)`,`var(--color-crystal-blue)`,`var(--color-white-cream)`];function fv(e,t={}){let n=t.rng??Math.random,r=t.colors??dv,i=uv[e];if(i.count===0||r.length===0)return[];let a=[],o=Math.PI*2/i.count;for(let e=0;e<i.count;e++){let t=e*o+(n()-.5)*o*.7,s=i.baseDistance+(n()-.5)*2*i.distanceVariance,c=i.sizeMin+n()*(i.sizeMax-i.sizeMin),l=n()*i.maxDelay,u=i.durationMin+n()*(i.durationMax-i.durationMin),d=Math.floor(n()*r.length),f=Math.cos(t),p=Math.sin(t);a.push({id:e,dx:f*s,dy:p*s,originDx:f*i.startRadius,originDy:p*i.startRadius,size:c,color:r[d]??`currentColor`,delay:l,duration:u})}return a}var pv=1.8,mv=90,hv=16,gv=380,_v=.025,vv=.1,yv=.18,bv=400,xv=9.2736,Sv=18.1799,Cv=14.5244,wv={1:{halfWidth:1.5,apexLift:2.2},2:{halfWidth:1.4,apexLift:2.6},3:{halfWidth:1.25,apexLift:3}};function Tv(e,t){let{halfWidth:n,apexLift:r}=wv[t];return`M${e-n} ${Cv+.3} Q${e} ${Cv-r}, ${e+n} ${Cv+.3}`}function Ev(e){let t=1.5,n=.3;return`M${e-t} ${Cv-n} Q${e} ${Cv+1.4}, ${e+t} ${Cv-n}`}var Dv=15,Ov=15;function kv(e){return{fill:e.color,"--fx-tx":`${e.dx}px`,"--fx-ty":`${e.dy}px`,"--fx-delay":`${e.delay}ms`,"--fx-duration":`${e.duration}ms`}}function Av(e){let t=(0,Z.c)(67),{size:n,className:r,trackMouse:i,variant:a}=e,o=n===void 0?48:n,s=i===void 0?!0:i,c=a===void 0?`default`:a,l=(0,X.useRef)(null),u=(0,X.useRef)(null),d=(0,X.useRef)(null),f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f={x:0,y:0},t[0]=f):f=t[0];let p=(0,X.useRef)(f),[m,h]=(0,X.useState)(0),[g,_]=(0,X.useState)(0),v;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(v=[],t[1]=v):v=t[1];let[y,b]=(0,X.useState)(v),x=(0,X.useRef)(0),S=(0,X.useRef)(void 0),C=c===`sleeping`,w;t[2]!==m||t[3]!==C?(w=function(){if(C)return;let e=typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now(),t=x.current===0?1/0:e-x.current;x.current=e;let n=lv(m,t);h(n),_(Nv),b(fv(n)),clearTimeout(S.current),S.current=setTimeout(()=>{h(0),b([])},sv)},t[2]=m,t[3]=C,t[4]=w):w=t[4];let T=w,E,D;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(E=()=>()=>clearTimeout(S.current),D=[],t[5]=E,t[6]=D):(E=t[5],D=t[6]),(0,X.useEffect)(E,D);let O,k;t[7]!==C||t[8]!==s?(k=()=>{if(!s||C||window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)return;let e=0,t=0,n=!1,r=0,i=0,a=0,o=0,c=0,f=function(r){e=r.clientX,t=r.clientY,n=!0};function m(){if(c=requestAnimationFrame(m),!n)return;let s=u.current,f=l.current;if(!s||!f)return;let h=s.getBoundingClientRect(),g=h.left+h.width/2,_=h.top+h.height*.48,v=e-g,y=t-_,b=Math.hypot(v,y),x=Math.max(-1,Math.min(1,v/gv)),S=Math.max(-1,Math.min(1,y/gv)),C=x*hv,w=-S*hv;r+=(w-r)*vv,i+=(C-i)*vv,f.style.transform=`perspective(${bv}px) rotateX(${r.toFixed(3)}deg) rotateY(${i.toFixed(3)}deg)`;let T=0,E=0;if(b>=1){let e=Math.min(b/mv,1)*pv;T=v/b*e,E=y/b*e}a+=(T-a)*yv,o+=(E-o)*yv;let D=i*_v,O=-r*_v,k=a+D,A=o+O;p.current.x=k,p.current.y=A,d.current?.setAttribute(`transform`,`translate(${k.toFixed(3)} ${A.toFixed(3)})`)}return document.addEventListener(`mousemove`,f,{passive:!0}),c=requestAnimationFrame(m),()=>{document.removeEventListener(`mousemove`,f),cancelAnimationFrame(c),l.current&&(l.current.style.transform=``),p.current={x:0,y:0},d.current?.removeAttribute(`transform`)}},O=[s,C],t[7]=C,t[8]=s,t[9]=O,t[10]=k):(O=t[9],k=t[10]),(0,X.useEffect)(k,O);let A;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(A=()=>{let e=d.current;if(!e)return;let{x:t,y:n}=p.current;e.setAttribute(`transform`,`translate(${t.toFixed(3)} ${n.toFixed(3)})`)},t[11]=A):A=t[11],(0,X.useLayoutEffect)(A);let j=m>0,M=j?m:1,N=j?`ok-blob-clicked-${m}`:null,P;t[12]===r?P=t[13]:(P=W(`ok-blob-3d-wrapper`,r),t[12]=r,t[13]=P);let F=C?`cursor-default`:`cursor-pointer`,I=`body-${g}`,ee=C&&`ok-blob-sleeping`,L;t[14]!==N||t[15]!==ee?(L=W(`ok-blob-group`,ee,N),t[14]=N,t[15]=ee,t[16]=L):L=t[16];let R;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Y.jsx)(`path`,{d:`M25.2339 6.78134C25.5199 7.35734 25.8179 8.47234 26.0179 9.07834C26.0189 9.08234 26.0209 9.08634 26.0219 9.09134C26.0229 9.09534 26.0249 9.10034 26.0259 9.10434C26.0539 9.19734 26.0949 9.29533 26.1519 9.41633C26.2919 9.71133 26.5269 10.1173 27.1299 11.1683C27.3259 11.4643 27.5209 11.7693 27.7119 12.0903C29.9739 15.1623 29.3259 20.1913 27.0469 22.9153C26.7779 23.2953 26.4869 23.6043 26.1889 23.8863C26.1519 23.9253 26.1129 23.9643 26.0729 24.0033C25.3159 24.7543 24.2949 25.4673 23.6129 25.8323C22.7469 26.2983 22.1349 26.5483 21.6299 26.7463C20.3649 27.3063 19.0609 27.7733 17.6569 28.0423C15.9649 28.3513 14.1939 28.4433 12.4569 28.1373C11.4779 27.9663 10.5119 27.6663 9.60891 27.2493C8.77491 26.8663 7.99192 26.3853 7.26992 25.8403C6.83592 25.5393 6.43893 25.2343 6.08093 24.9383C5.57893 24.5223 5.15993 24.1263 4.83493 23.7793C4.04993 22.9443 3.31593 21.8893 2.80893 21.0953C2.72593 20.9663 2.64792 20.8433 2.57592 20.7293C2.56192 20.7093 2.54793 20.6893 2.53393 20.6703C2.08593 20.0263 1.71892 19.3293 1.43792 18.5993C1.42892 18.5453 1.42093 18.4903 1.41293 18.4353C1.32093 17.7443 1.08292 16.9423 1.01092 15.6333C0.984921 15.0653 0.998928 14.4013 1.12393 13.6353C1.20693 13.1413 1.31993 12.9023 1.40893 12.7113C1.43593 12.6543 1.46193 12.6023 1.48593 12.5483C1.56793 12.3653 1.59392 12.1563 1.63592 11.9083C1.68992 11.5883 1.76992 11.1943 2.04592 10.7553C2.94392 9.37934 3.36792 8.81934 3.66592 8.33934C3.75592 8.20334 3.84292 8.08134 3.94192 7.96634C4.21592 7.64634 4.67693 7.29534 5.10293 7.05734C5.16693 7.02234 5.23093 6.98834 5.29193 6.95534C5.62993 6.77834 6.22592 6.30135 6.66992 5.92035C6.83692 5.77635 7.08193 5.60735 7.37393 5.40935C7.67393 5.20535 8.02593 4.96934 8.39193 4.70234C9.32093 4.02634 9.84091 3.69134 10.2599 3.42334C10.3799 3.34734 10.4919 3.27734 10.6049 3.20834C10.9609 2.98834 11.4149 2.73034 11.8869 2.48634C12.4519 2.19334 13.0469 1.92133 13.5089 1.72233C14.7399 1.30233 16.0539 1.01333 17.4169 1.00033C18.1169 0.991333 18.7939 1.16534 19.2389 1.43034C19.6869 1.69534 19.8689 2.00335 19.8039 2.23935C19.7379 2.47835 19.4399 2.63634 19.0109 2.74734C18.5789 2.85634 18.0469 2.92035 17.4889 2.96135C16.3639 3.04235 15.2399 3.36435 14.1499 3.80835C12.8199 4.35135 11.5379 5.07133 10.2719 5.84733C9.38691 6.39133 8.51192 6.97334 7.63592 7.56834C7.54492 7.63034 7.45492 7.69135 7.36492 7.75235C6.97392 8.06635 6.58293 8.38134 6.22293 8.66334C5.97893 8.85734 5.76793 9.04834 5.59393 9.21434C5.26893 9.52334 5.02393 9.74334 4.81893 9.93934C4.67793 10.0753 4.55793 10.2013 4.45593 10.3443C4.40093 10.4213 4.32992 10.5273 4.24792 10.6593C3.90492 11.1933 3.44493 12.1693 3.15393 13.1173C3.01893 13.5363 2.87991 14.0343 2.79391 14.5253C2.66591 15.2253 2.65594 15.9053 2.71994 16.2373C2.82794 16.8193 2.95593 17.4833 3.14093 18.0553C3.31293 18.6003 3.52991 19.0583 3.70791 19.2823C3.81591 19.4183 3.90394 19.5473 3.99594 19.6913C4.09394 19.8413 4.19191 20.0073 4.31091 20.2033C4.47891 20.4803 4.68592 20.8163 5.00192 21.2493C5.36492 21.7463 5.61793 22.1043 5.83493 22.4023C6.14493 22.8243 6.38591 23.1343 6.83691 23.5033C7.33891 23.9113 7.86593 24.3113 8.26693 24.6393C8.44893 24.7883 8.66993 24.9443 8.90493 25.0963C9.21593 25.2963 9.55192 25.4893 9.85592 25.6703C10.1059 25.8203 10.3059 25.9633 10.4869 26.0863C10.5429 26.1243 10.5979 26.1603 10.6519 26.1943C10.8699 26.2803 11.0929 26.3593 11.3159 26.4283C11.3539 26.4323 11.3949 26.4353 11.4369 26.4393C11.6509 26.4573 11.9089 26.4733 12.2209 26.5133C12.7169 26.5753 13.1399 26.6603 13.6019 26.7243C13.9589 26.7733 14.3409 26.8083 14.7729 26.7893C15.0729 26.7753 15.4069 26.7353 15.7389 26.6813C16.2349 26.6023 16.7179 26.4943 17.0569 26.4473C17.1499 26.4343 17.2359 26.4343 17.3209 26.4373C17.3489 26.4393 17.3799 26.4413 17.4109 26.4433C17.4119 26.4433 17.4119 26.4433 17.4129 26.4433C17.4199 26.4433 17.4279 26.4443 17.4349 26.4443C18.2329 26.2413 19.0259 25.9433 19.7959 25.5983C19.8609 25.5633 19.9259 25.5273 19.9899 25.4913C20.3059 25.3173 20.6049 25.1383 20.7869 24.9943C20.9829 24.8393 21.5189 24.5373 22.0579 24.1853C22.4109 23.9553 22.7649 23.7053 23.0369 23.4833C23.1949 23.3553 23.3689 23.2693 23.5479 23.1773C23.7129 23.0923 23.8809 23.0013 24.0349 22.8653C24.1109 22.7983 24.1869 22.7173 24.2639 22.6303C24.3309 22.5563 24.4039 22.4723 24.4759 22.3923C24.5459 22.3153 24.7199 22.1723 24.9139 21.9793C25.0079 21.8863 25.1059 21.7783 25.1909 21.6713C25.2199 21.6323 25.2489 21.5943 25.2769 21.5553C25.5919 21.0403 25.8779 20.5003 26.1019 19.9653C26.1299 19.8403 26.1379 19.7293 26.1279 19.6373C26.1199 19.5703 26.1029 19.5113 26.0839 19.4503C26.0599 19.3643 26.0329 19.2773 26.0239 19.1723C26.0169 19.0893 26.0309 19.0043 26.0629 18.9543C26.0779 18.9323 26.0969 18.9143 26.1129 18.8993C26.1329 18.8823 26.1499 18.8673 26.1569 18.8443C26.1609 18.8273 26.1579 18.8073 26.1529 18.7833C26.1459 18.7443 26.1369 18.6943 26.1539 18.6293C26.2189 18.3853 26.2869 18.1103 26.3319 17.8383C26.3829 17.5393 26.4049 17.2433 26.3949 17.0123C26.3849 16.7493 26.3909 16.3823 26.3469 16.0003C26.3179 15.7343 26.2659 15.4663 26.1979 15.2383C26.1319 15.0143 26.0219 14.7913 25.9039 14.5783C25.7629 14.3223 25.6119 14.0783 25.5169 13.8453C25.4969 13.7983 25.4999 13.7263 25.4999 13.6323C25.5009 13.5673 25.4999 13.4913 25.4919 13.4083C25.3239 13.1243 25.1459 12.8423 24.9589 12.5483C24.9479 12.5413 24.9369 12.5333 24.9249 12.5263C24.6689 12.3503 24.3139 12.1173 24.0769 11.5503C24.0179 11.4063 24.0069 11.2983 23.9969 11.1993C23.9859 11.1013 23.9799 11.0183 23.9289 10.9093C23.8709 10.7853 23.7759 10.6583 23.6709 10.4993C23.5849 10.3703 23.4899 10.2133 23.4199 10.0423C23.3819 9.95134 23.3509 9.85734 23.3329 9.75934C23.3299 9.74334 23.3269 9.72534 23.3229 9.70634C23.2899 9.52734 23.2439 9.26534 23.2409 8.98634C23.0209 8.24434 22.8339 7.48833 22.6519 6.77633C22.3429 5.57133 22.0519 4.54234 21.3329 3.95434C20.9839 3.65334 20.5689 3.35433 20.2459 3.05433C19.9259 2.75633 19.7449 2.47534 19.8019 2.23834C19.8639 2.00634 20.1589 1.82934 20.6659 1.80534C21.1699 1.78334 21.8699 1.93235 22.5209 2.39235C23.6159 3.14235 24.2029 4.38334 24.5599 5.35734C24.5829 5.40834 24.6049 5.46034 24.6259 5.51234C24.7849 5.89434 24.9529 6.22834 25.1199 6.55534C25.1579 6.63034 25.1969 6.70834 25.2339 6.78134Z`,className:`ok-blob-body`}),t[17]=R):R=t[17];let z=(j||C)&&`ok-blob-eye-hidden`,B;t[18]===z?B=t[19]:(B=W(`ok-blob-eye`,z),t[18]=z,t[19]=B);let V;t[20]===B?V=t[21]:(V=(0,Y.jsx)(`ellipse`,{cx:xv,cy:Cv,rx:1.2722,ry:1.9083,className:B}),t[20]=B,t[21]=V);let H=(j||C)&&`ok-blob-eye-hidden`,te;t[22]===H?te=t[23]:(te=W(`ok-blob-eye ok-blob-eye-right`,H),t[22]=H,t[23]=te);let ne;t[24]===te?ne=t[25]:(ne=(0,Y.jsx)(`ellipse`,{cx:Sv,cy:Cv,rx:1.2722,ry:1.9083,className:te}),t[24]=te,t[25]=ne);let re;t[26]===M?re=t[27]:(re=Tv(xv,M),t[26]=M,t[27]=re);let U=(!j||C)&&`ok-blob-eye-hidden`,G;t[28]===U?G=t[29]:(G=W(`ok-blob-happy-eye`,U),t[28]=U,t[29]=G);let ie;t[30]!==re||t[31]!==G?(ie=(0,Y.jsx)(`path`,{d:re,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:G}),t[30]=re,t[31]=G,t[32]=ie):ie=t[32];let ae;t[33]===M?ae=t[34]:(ae=Tv(Sv,M),t[33]=M,t[34]=ae);let oe=(!j||C)&&`ok-blob-eye-hidden`,K;t[35]===oe?K=t[36]:(K=W(`ok-blob-happy-eye`,oe),t[35]=oe,t[36]=K);let q;t[37]!==ae||t[38]!==K?(q=(0,Y.jsx)(`path`,{d:ae,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:K}),t[37]=ae,t[38]=K,t[39]=q):q=t[39];let se;t[40]===C?se=t[41]:(se=C?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`path`,{d:Ev(xv),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`}),(0,Y.jsx)(`path`,{d:Ev(Sv),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`})]}):null,t[40]=C,t[41]=se);let J;t[42]!==V||t[43]!==ne||t[44]!==ie||t[45]!==q||t[46]!==se?(J=(0,Y.jsxs)(`g`,{ref:d,children:[V,ne,ie,q,se]}),t[42]=V,t[43]=ne,t[44]=ie,t[45]=q,t[46]=se,t[47]=J):J=t[47];let ce;t[48]!==I||t[49]!==L||t[50]!==J?(ce=(0,Y.jsxs)(`g`,{className:L,children:[R,J]},I),t[48]=I,t[49]=L,t[50]=J,t[51]=ce):ce=t[51];let le;t[52]===C?le=t[53]:(le=C?(0,Y.jsxs)(`g`,{children:[(0,Y.jsx)(`text`,{x:21,y:7,className:`ok-blob-z ok-blob-z-1`,children:`z`}),(0,Y.jsx)(`text`,{x:26,y:2,className:`ok-blob-z ok-blob-z-2`,children:`z`})]}):null,t[52]=C,t[53]=le);let ue;t[54]!==g||t[55]!==y?(ue=y.length>0&&(0,Y.jsx)(`g`,{children:y.map(jv)},`firework-${g}`),t[54]=g,t[55]=y,t[56]=ue):ue=t[56];let de;t[57]!==T||t[58]!==o||t[59]!==F||t[60]!==ce||t[61]!==le||t[62]!==ue?(de=(0,Y.jsxs)(`svg`,{ref:u,width:o,height:o,viewBox:`0 0 30 30`,fill:`none`,overflow:`visible`,xmlns:`http://www.w3.org/2000/svg`,className:F,"aria-hidden":`true`,onClick:T,onMouseDown:Mv,children:[ce,le,ue]}),t[57]=T,t[58]=o,t[59]=F,t[60]=ce,t[61]=le,t[62]=ue,t[63]=de):de=t[63];let fe;return t[64]!==P||t[65]!==de?(fe=(0,Y.jsx)(`span`,{ref:l,className:P,children:de}),t[64]=P,t[65]=de,t[66]=fe):fe=t[66],fe}function jv(e){return(0,Y.jsx)(`circle`,{cx:Dv+e.originDx,cy:Ov+e.originDy,r:e.size,className:`ok-blob-firework`,style:kv(e)},e.id)}function Mv(e){return e.preventDefault()}function Nv(e){return e+1}function Pv(){let e=typeof window<`u`?window.okDesktop:void 0;return e?.seed?{plan:()=>e.seed.plan(),apply:t=>e.seed.apply(t)}:{plan:async()=>await(await fetch(`/api/seed/plan`)).json(),apply:async e=>await(await fetch(`/api/seed/apply`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({plan:e})})).json()}}function Fv(e){let t=(0,Z.c)(36),{open:n,onOpenChange:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={kind:`loading`},t[0]=i):i=t[0];let[a,o]=(0,X.useState)(i),s,c;t[1]===n?(s=t[2],c=t[3]):(s=()=>{if(!n)return;o({kind:`loading`});let e=!1;return Pv().plan().then(t=>{if(!e){if(!t.ok){o({kind:`error`,message:t.error.message});return}o(t.plan.created.length>0||t.plan.configEdits.length>0?{kind:`plan`,plan:t.plan}:{kind:`already-seeded`,plan:t.plan})}}).catch(t=>{e||o({kind:`error`,message:t instanceof Error?t.message:String(t)})}),()=>{e=!0}},c=[n],t[1]=n,t[2]=s,t[3]=c),(0,X.useEffect)(s,c);let l;t[4]!==r||t[5]!==a.kind||t[6]!==a.plan?(l=async function(){if(a.kind!==`plan`)return;o({kind:`applying`,plan:a.plan});let e=await Pv().apply(a.plan);e.ok?(At.success(`LLM brain initialized (${e.result.applied} ${e.result.applied===1?`entry`:`entries`})`),r(!1)):(At.error(`Initialize failed: ${e.error.message}`),o({kind:`error`,message:e.error.message}))},t[4]=r,t[5]=a.kind,t[6]=a.plan,t[7]=l):l=t[7];let u=l,d;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Y.jsxs)(qt,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(ai,{"aria-hidden":`true`,className:`h-4 w-4`}),`Initialize LLM brain`]}),t[8]=d):d=t[8];let f;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Y.jsx)(`code`,{children:`external-sources`}),t[9]=f):f=t[9];let p;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Y.jsx)(`code`,{children:`research`}),t[10]=p):p=t[10];let m;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Y.jsx)(`code`,{children:`articles`}),t[11]=m):m=t[11];let h;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Y.jsx)(`code`,{children:`log.md`}),t[12]=h):h=t[12];let g;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Y.jsx)(`code`,{children:`config.yml`}),t[13]=g):g=t[13];let _;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Y.jsx)(`code`,{children:`folders:`}),t[14]=_):_=t[14];let v;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Y.jsxs)(Wt,{children:[d,(0,Y.jsxs)(Bt,{children:[`Optional starter structure — creates the Karpathy three-layer folders (`,f,`, `,p,`, `,m,`), an append-only `,h,`, and matching `,g,` `,_,` entries so agents see layer descriptions at every `,(0,Y.jsx)(`code`,{children:`ls`}),`. You can skip this and keep any folder layout you already use.`]})]}),t[15]=v):v=t[15];let y;t[16]===a?y=t[17]:(y=(0,Y.jsx)(Iv,{phase:a}),t[16]=a,t[17]=y);let b;t[18]===r?b=t[19]:(b=()=>r(!1),t[18]=r,t[19]=b);let x=a.kind===`already-seeded`||a.kind===`error`?`Close`:`Cancel`,S;t[20]!==b||t[21]!==x?(S=(0,Y.jsx)(K,{variant:`ghost`,onClick:b,children:x}),t[20]=b,t[21]=x,t[22]=S):S=t[22];let C;t[23]!==u||t[24]!==a.kind?(C=a.kind===`plan`?(0,Y.jsx)(K,{onClick:u,children:`Initialize`}):a.kind===`applying`?(0,Y.jsxs)(K,{disabled:!0,children:[(0,Y.jsx)(Ye,{"aria-hidden":`true`,className:`h-4 w-4 animate-spin`}),`Initializing…`]}):null,t[23]=u,t[24]=a.kind,t[25]=C):C=t[25];let w;t[26]!==S||t[27]!==C?(w=(0,Y.jsxs)(Nt,{children:[S,C]}),t[26]=S,t[27]=C,t[28]=w):w=t[28];let T;t[29]!==y||t[30]!==w?(T=(0,Y.jsxs)(Kt,{className:`sm:max-w-lg`,"data-ok-layer-spawned":``,children:[v,y,w]}),t[29]=y,t[30]=w,t[31]=T):T=t[31];let E;return t[32]!==r||t[33]!==n||t[34]!==T?(E=(0,Y.jsx)(Jt,{open:n,onOpenChange:r,children:T}),t[32]=r,t[33]=n,t[34]=T,t[35]=E):E=t[35],E}function Iv(e){let t=(0,Z.c)(18),{phase:n}=e;if(n.kind===`loading`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 py-4 text-sm text-muted-foreground`,children:[(0,Y.jsx)(Ye,{"aria-hidden":`true`,className:`h-4 w-4 animate-spin`}),`Computing scaffold plan…`]}),t[0]=e):e=t[0],e}if(n.kind===`error`){let e;return t[1]===n.message?e=t[2]:(e=(0,Y.jsx)(`div`,{className:`rounded-md bg-destructive/10 p-3 text-sm text-destructive`,children:n.message}),t[1]=n.message,t[2]=e),e}if(n.kind===`already-seeded`){let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsxs)(`div`,{className:`py-2 text-sm`,children:[(0,Y.jsx)(`p`,{className:`font-medium`,children:`This knowledge base is already initialized.`}),(0,Y.jsx)(`p`,{className:`text-muted-foreground`,children:`Nothing to do — the scaffolder has already been applied. Re-running would produce zero changes.`})]}),t[3]=e):e=t[3],e}let r=n.plan,i,a,o;if(t[4]!==r.created){let e=r.created.filter(Hv),n=r.created.filter(Vv);i=`space-y-3 py-2 text-sm`,a=e.length>0?(0,Y.jsx)(Uv,{title:`Folders`,items:e.map(Bv)}):null,o=n.length>0?(0,Y.jsx)(Uv,{title:`Files`,items:n.map(zv)}):null,t[4]=r.created,t[5]=i,t[6]=a,t[7]=o}else i=t[5],a=t[6],o=t[7];let s;t[8]===r.configEdits?s=t[9]:(s=r.configEdits.length>0?(0,Y.jsx)(Uv,{title:`config.yml folders: entries`,items:r.configEdits.map(Rv)}):null,t[8]=r.configEdits,t[9]=s);let c;t[10]===r.warnings?c=t[11]:(c=r.warnings.length>0?(0,Y.jsx)(`div`,{className:`rounded-md bg-warning/10 p-3 text-sm text-warning-foreground`,children:r.warnings.map(Lv)}):null,t[10]=r.warnings,t[11]=c);let l;return t[12]!==i||t[13]!==a||t[14]!==o||t[15]!==s||t[16]!==c?(l=(0,Y.jsxs)(`div`,{className:i,children:[a,o,s,c]}),t[12]=i,t[13]=a,t[14]=o,t[15]=s,t[16]=c,t[17]=l):l=t[17],l}function Lv(e){return(0,Y.jsx)(`p`,{children:e},e)}function Rv(e){return{key:e.folderMatch,leading:(0,Y.jsx)(de,{"aria-hidden":`true`,className:`h-4 w-4 text-muted-foreground`}),label:e.folderMatch,detail:e.entry.frontmatter.description}}function zv(e){return{key:e.path,leading:(0,Y.jsx)(wi,{"aria-hidden":`true`,className:`h-4 w-4 text-muted-foreground`}),label:e.path}}function Bv(e){return{key:e.path,leading:(0,Y.jsx)(Oi,{"aria-hidden":`true`,className:`h-4 w-4 text-muted-foreground`}),label:`${e.path}/`}}function Vv(e){return e.kind===`file`}function Hv(e){return e.kind===`folder`}function Uv(e){let t=(0,Z.c)(9),{title:n,items:r}=e,i;t[0]===n?i=t[1]:(i=(0,Y.jsx)(`h3`,{className:`mb-1 text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=r.map(Wv),t[2]=r,t[3]=a);let o;t[4]===a?o=t[5]:(o=(0,Y.jsx)(`ul`,{className:`space-y-1`,children:a}),t[4]=a,t[5]=o);let s;return t[6]!==i||t[7]!==o?(s=(0,Y.jsxs)(`section`,{children:[i,o]}),t[6]=i,t[7]=o,t[8]=s):s=t[8],s}function Wv(e){return(0,Y.jsxs)(`li`,{className:`space-y-0.5`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.leading,(0,Y.jsx)(`code`,{className:`text-xs`,children:e.label})]}),e.detail?(0,Y.jsx)(`p`,{className:`pl-6 text-xs text-muted-foreground`,children:e.detail}):null]},e.key)}function Gv(e){let t=(0,Z.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=W(`flex h-full w-full aria-[orientation=vertical]:flex-col`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Y.jsx)(Kg,{"data-slot":`resizable-panel-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Kv(e){let t=(0,Z.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,Y.jsx)(Yg,{"data-slot":`resizable-panel`,...n}),t[2]=n,t[3]=r),r}function qv(e){let t=(0,Z.c)(12),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({withHandle:i,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=W(`relative flex w-px items-center justify-center bg-border ring-offset-background after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-ring focus-visible:outline-hidden aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:translate-x-0 aria-[orientation=horizontal]:after:-translate-y-1/2 [&[aria-orientation=horizontal]>div]:rotate-90`,n),t[4]=n,t[5]=a);let o;t[6]===i?o=t[7]:(o=i&&(0,Y.jsx)(`div`,{className:`z-10 flex h-6 w-1 shrink-0 rounded-lg bg-border`}),t[6]=i,t[7]=o);let s;return t[8]!==r||t[9]!==a||t[10]!==o?(s=(0,Y.jsx)($g,{"data-slot":`resizable-handle`,className:a,...r,children:o}),t[8]=r,t[9]=a,t[10]=o,t[11]=s):s=t[11],s}var Jv=960,Yv=1024;function Xv(){let e=(0,Z.c)(5),[t,n]=(0,X.useState)(Qv),[r,i]=(0,X.useState)(Zv),a,o;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>{let e=window.matchMedia(`(max-width: ${Jv-1}px)`),t=window.matchMedia(`(max-width: ${Yv-1}px)`),r=()=>{let r=e.matches;n(r?`sheet`:`panel`),i(!r&&t.matches)};return e.addEventListener(`change`,r),t.addEventListener(`change`,r),()=>{e.removeEventListener(`change`,r),t.removeEventListener(`change`,r)}},o=[],e[0]=a,e[1]=o):(a=e[0],o=e[1]),(0,X.useEffect)(a,o);let s;return e[2]!==r||e[3]!==t?(s={layout:t,autoCollapse:r},e[2]=r,e[3]=t,e[4]=s):s=e[4],s}function Zv(){return window.innerWidth>=Jv&&window.innerWidth<Yv}function Qv(){return window.innerWidth<Jv?`sheet`:`panel`}var $v={words:0,chars:0,tokens:0},ey=/[ -〿぀-ゟ゠-ヿ㐀-䶿一-鿿豈-﫿＀-￯฀-๿ក-៿]/,ty=/[\p{L}\p{N}]/u;function ny(e){if(!e)return 0;let t=0;for(let n of e.split(/\s+/))ty.test(n)&&t++;return t}function ry(e){let t=globalThis.Intl.Segmenter;if(!t)return ny(e);let n=new t(void 0,{granularity:`word`}),r=0;for(let t of n.segment(e))t.isWordLike&&r++;return r}function iy(e){let t=ey.test(e)?1.5:4;return Math.ceil(e.length/t)}function ay(e){if(!e)return{words:0,chars:0,tokens:0};let{body:t}=Sn(e),n=t.trim();return n?{words:ey.test(n)?ry(n):ny(n),chars:n.length,tokens:iy(n)}:{words:0,chars:0,tokens:0}}var oy=300;function sy(e,t){let n=(0,Z.c)(4),[r,i]=(0,X.useState)($v),a,o;return n[0]!==t||n[1]!==e?(a=()=>{if(!e||!t){i($v);return}let n=e.document.getText(`source`),r=!1,a=null,o=function(){r||i(ay(n.toString()))};o();let s=function(){a&&clearTimeout(a),a=setTimeout(o,oy)};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,X.useEffect)(a,o),r}var cy=Gn;function ly(){let[e]=(0,X.useState)(Dn);return e}function uy(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 dy=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&&wn(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(En(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(bn(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(Un(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(rr(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(An(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(pn(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(kn(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(_n(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=$n(this.view,e.from,e.to),r={getBoundingClientRect:()=>n,getClientRects:()=>[n]};if(e instanceof zn){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 In){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():uy(o.getBoundingClientRect(),s.getBoundingClientRect());r={getBoundingClientRect:()=>c,getClientRects:()=>[c]}}return r}updatePosition(){if(!this.isVisible)return;let e=this.virtualElement;e&&vn(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()}},fy=e=>new fn({key:typeof e.pluginKey==`string`?new Ln(e.pluginKey):e.pluginKey,view:t=>new dy({view:t,...e})});Pn.create({name:`bubbleMenu`,addOptions(){return{element:null,pluginKey:`bubbleMenu`,updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[fy({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 py=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 Zn(e,{textSerializers:tr(this.editor.schema)})}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(En(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(bn(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(Un(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(rr(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(An(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(pn(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(kn(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(_n(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=$n(this.view,e.from,e.to);vn({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()}},my=e=>new fn({key:typeof e.pluginKey==`string`?new Ln(e.pluginKey):e.pluginKey,view:t=>new py({view:t,...e})});Pn.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?[my({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 hy(e,t){return e??new Ln(t)}var gy=typeof window<`u`?X.useLayoutEffect:X.useEffect,_y=new Set([`left`,`opacity`,`position`,`top`,`visibility`,`width`]),vy=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(`.`)),yy=new Set([`children`,`className`,`style`]),by=new Set([`tabIndex`]),xy=new Set([`accessKey`,`autoCapitalize`,`contentEditable`,`contextMenu`,`dir`,`draggable`,`enterKeyHint`,`hidden`,`id`,`lang`,`nonce`,`role`,`slot`,`spellCheck`,`tabIndex`,`title`,`translate`]),Sy={Blur:`focusout`,DoubleClick:`dblclick`,Focus:`focusin`,MouseEnter:`mouseenter`,MouseLeave:`mouseleave`};function Cy(e,t){return/^on[A-Z]/.test(e)&&typeof t==`function`}function wy(e){return e.startsWith(`aria-`)||e.startsWith(`data-`),e}function Ty(e){return e.startsWith(`aria-`)||e.startsWith(`data-`)||xy.has(e)}function Ey(e){return e.startsWith(`--`)?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function Dy(e){let t=e.endsWith(`Capture`),n=(t?e.slice(0,-7):e).slice(2);return{eventName:Sy[n]??n.toLowerCase(),options:t?{capture:!0}:void 0}}function Oy(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 ky(e){return by.has(e)}function Ay(e,t,n){if(t===`tabIndex`){e.tabIndex=Number(n);return}e[t]=n}function jy(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 My(e,t){return typeof t!=`number`||t===0||e.startsWith(`--`)||vy.has(e)?String(t):`${t}px`}function Ny(e,t){_y.has(t)||e.style.removeProperty(Ey(t))}function Py(e,t,n){_y.has(t)||e.style.setProperty(Ey(t),My(t,n))}function Fy(e,t,n){new Set([...Object.keys(t),...Object.keys(n)]).forEach(r=>{if(yy.has(r)||!Ty(r)||Cy(r,t[r])||Cy(r,n[r]))return;let i=t[r],a=n[r];if(i===a)return;let o=wy(r);if(a==null||a===!1){ky(r)&&jy(e,r),e.removeAttribute(o);return}if(a===!0){ky(r)&&Ay(e,r,!0),e.setAttribute(o,``);return}if(ky(r)){Ay(e,r,a);return}e.setAttribute(o,String(a))})}function Iy(e,t,n){if(t!==n){if(n){e.className=n;return}e.removeAttribute(`class`)}}function Ly(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){Ny(e,t);return}Py(e,t,a)}})}function Ry(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(!Cy(t,n))return;let{eventName:i,options:a}=Dy(t),o=t=>{n(Oy(e,t))};e.addEventListener(i,o,a),r.push({eventName:i,listener:o,options:a})}),r}function zy(e,t){let n=(0,X.useRef)({}),r=(0,X.useRef)([]);gy(()=>{let i=n.current;return Iy(e,i.className,t.className),Ly(e,i.style,t.style),Fy(e,i,t),r.current=Ry(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 By=X.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,X.useRef)(document.createElement(`div`)),f=(0,X.useRef)(hy(e,`bubbleMenu`)).current;zy(d.current,l),typeof u==`function`?u(d.current):u&&(u.current=d.current);let{editor:p}=xt(),m=t||p,h={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:f,shouldShow:a,getReferencedVirtualElement:o,options:s},g=(0,X.useRef)(h);g.current=h;let[_,v]=(0,X.useState)(!1),y=(0,X.useRef)(!0);return(0,X.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=fy({...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,X.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,ni.createPortal)(c,d.current)});X.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:r,appendTo:i,shouldShow:a=null,options:o,children:s,...c},l)=>{let u=(0,X.useRef)(document.createElement(`div`)),d=(0,X.useRef)(hy(e,`floatingMenu`)).current;zy(u.current,c),typeof l==`function`?l(u.current):l&&(l.current=u.current);let{editor:f}=xt(),p=t||f,m={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:d,shouldShow:a,options:o},h=(0,X.useRef)(m);h.current=m;let[g,_]=(0,X.useState)(!1),v=(0,X.useRef)(!0);return(0,X.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=my({...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,X.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,ni.createPortal)(s,u.current)});function Vy(e){let t=(0,Z.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,orientation:i,decorative:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?`horizontal`:i,s=a===void 0?!0:a,c;t[5]===n?c=t[6]:(c=W(`shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch`,n),t[5]=n,t[6]=c);let l;return t[7]!==s||t[8]!==o||t[9]!==r||t[10]!==c?(l=(0,Y.jsx)(yl,{"data-slot":`separator`,decorative:s,orientation:o,className:c,...r}),t[7]=s,t[8]=o,t[9]=r,t[10]=c,t[11]=l):l=t[11],l}var Hy=[{name:`paragraph`,label:`Text`,icon:Ji,isActive:e=>e.isActive(`paragraph`)&&!e.isActive(`list`),command:e=>e.chain().focus().setParagraph().run()},{name:`heading1`,label:`Heading 1`,icon:lt,isActive:e=>e.isActive(`heading`,{level:1}),command:e=>e.chain().focus().toggleHeading({level:1}).run()},{name:`heading2`,label:`Heading 2`,icon:ht,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:ct,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:Ze,isActive:e=>e.isActive(`list`,{ordered:!0}),command:e=>e.chain().focus().toggleOrderedList().run()},{name:`taskList`,label:`Task List`,icon:Ct,isActive:e=>e.isActive(`listItem`,{checked:!0})||e.isActive(`listItem`,{checked:!1}),command:e=>e.chain().focus().toggleTaskList().run()},{name:`blockquote`,label:`Quote`,icon:pt,isActive:e=>e.isActive(`blockquote`),command:e=>e.chain().focus().toggleBlockquote().run()},{name:`codeBlock`,label:`Code Block`,icon:oa,isActive:e=>e.isActive(`codeBlock`),command:e=>e.chain().focus().toggleCodeBlock().run()}];function Uy(e){let t=(0,Z.c)(18),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:Wy},t[0]=n,t[1]=r);let{current:i,activeStates:a}=dt(r),o=i.icon,s;t[2]===o?s=t[3]:(s=(0,Y.jsx)(o,{className:`size-3.5`}),t[2]=o,t[3]=s);let c;t[4]===i.label?c=t[5]:(c=(0,Y.jsx)(`span`,{children:i.label}),t[4]=i.label,t[5]=c);let l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Y.jsx)(fe,{className:`size-3 opacity-50`}),t[6]=l):l=t[6];let u;t[7]!==s||t[8]!==c?(u=(0,Y.jsx)(L_,{asChild:!0,children:(0,Y.jsxs)(K,{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=Hy.map(e=>{let t=e.icon,r=a[e.name];return(0,Y.jsxs)(z_,{className:r?`bg-accent text-accent-foreground`:``,onSelect:()=>{e.command(n)},children:[(0,Y.jsx)(t,{className:`size-4`}),(0,Y.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,Y.jsx)(R_,{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,Y.jsxs)(I_,{children:[u,f]}),t[15]=u,t[16]=f,t[17]=p):p=t[17],p}function Wy(e){let t=Object.fromEntries(Hy.map(t=>[t.name,t.isActive(e.editor)]));return{current:Hy.find(e=>t[e.name])??Hy[0],activeStates:t}}var Gy=[{name:`bold`,icon:ei,command:e=>e.chain().focus().toggleBold().run(),isActive:e=>e.isActive(`strong`),shortcut:`⌘B`},{name:`italic`,icon:Fi,command:e=>e.chain().focus().toggleItalic().run(),isActive:e=>e.isActive(`emphasis`),shortcut:`⌘I`},{name:`underline`,icon:pa,command:e=>e.chain().focus().toggleUnderline().run(),isActive:e=>e.isActive(`underline`),shortcut:`⌘U`},{name:`strikethrough`,icon:la,command:e=>e.chain().focus().toggleStrike().run(),isActive:e=>e.isActive(`strike`),shortcut:`⌘⇧X`},{name:`code`,icon:pi,command:e=>e.chain().focus().toggleCode().run(),isActive:e=>e.isActive(`code`),shortcut:`⌘E`},{name:`highlight`,icon:Ni,command:e=>e.chain().focus().toggleHighlight().run(),isActive:e=>e.isActive(`highlight`),shortcut:`⌘⇧H`}];function Ky(e){let t=(0,Z.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:qy},t[0]=n,t[1]=r);let i=dt(r),a;t[2]!==i||t[3]!==n?(a=Gy.map(e=>{let t=e.icon,r=i[e.name];return(0,Y.jsxs)(ln,{children:[(0,Y.jsx)(nn,{asChild:!0,children:(0,Y.jsx)(K,{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,Y.jsx)(t,{className:`size-3.5`})})}),(0,Y.jsxs)(an,{side:`bottom`,sideOffset:8,children:[(0,Y.jsx)(`span`,{className:`capitalize`,children:e.name}),(0,Y.jsx)(`kbd`,{className:`ml-1.5 text-[10px] opacity-60`,children:e.shortcut})]})]},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,Y.jsx)(`div`,{className:`flex items-center gap-0.5`,children:a}),t[5]=a,t[6]=o),o}function qy(e){return Object.fromEntries(Gy.map(t=>[t.name,t.isActive(e.editor)]))}function Jy(e){let t=(0,Z.c)(46),{editor:n}=e,[r,i]=(0,X.useState)(!1),[a,o]=(0,X.useState)(``),s=(0,X.useRef)(null),c;t[0]===n?c=t[1]:(c=n.isActive(`link`),t[0]=n,t[1]=c);let l=c,u;t[2]===n?u=t[3]:(u=n.getAttributes(`link`).href??``,t[2]=n,t[3]=u);let d=u,f,p;t[4]===n?(f=t[5],p=t[6]):(f=()=>{let e=function(){n.state.selection.empty&&i(!1)};return n.on(`selectionUpdate`,e),()=>{n.off(`selectionUpdate`,e)}},p=[n],t[4]=n,t[5]=f,t[6]=p),(0,X.useEffect)(f,p);let m,h;t[7]!==d||t[8]!==r?(m=()=>{r&&(o(d),requestAnimationFrame(()=>s.current?.focus()))},h=[r,d],t[7]=d,t[8]=r,t[9]=m,t[10]=h):(m=t[9],h=t[10]),(0,X.useEffect)(m,h);let g;t[11]!==n||t[12]!==l||t[13]!==a?(g=function(){a.trim()?n.chain().focus().setLink({href:a.trim()}).run():l&&n.chain().focus().unsetLink().run(),i(!1)},t[11]=n,t[12]=l,t[13]=a,t[14]=g):g=t[14];let _=g,v;t[15]===n?v=t[16]:(v=function(){n.chain().focus().unsetLink().run(),i(!1)},t[15]=n,t[16]=v);let y=v,b;t[17]!==_||t[18]!==n?(b=function(e){e.key===`Enter`&&(e.preventDefault(),_()),e.key===`Escape`&&(e.preventDefault(),i(!1),n.chain().focus().run())},t[17]=_,t[18]=n,t[19]=b):b=t[19];let x=b;if(r){let e;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(e=e=>o(e.target.value),t[20]=e):e=t[20];let n;t[21]!==x||t[22]!==a?(n=(0,Y.jsx)(`input`,{ref:s,type:`url`,placeholder:`Paste link...`,value:a,onChange:e,onKeyDown:x,"aria-label":`Link URL`,className:`h-5 w-44 bg-transparent text-sm border-none outline-none placeholder:text-muted-foreground`}),t[21]=x,t[22]=a,t[23]=n):n=t[23];let r;t[24]===_?r=t[25]:(r=()=>{_()},t[24]=_,t[25]=r);let i;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Y.jsx)(vi,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[26]=i):i=t[26];let c;t[27]===r?c=t[28]:(c=(0,Y.jsx)(K,{variant:`ghost`,size:`icon-xs`,"aria-label":`Apply link`,onClick:r,children:i}),t[27]=r,t[28]=c);let u;t[29]!==n||t[30]!==c?(u=(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5 rounded-md border bg-background px-2 py-1`,children:[n,c]}),t[29]=n,t[30]=c,t[31]=u):u=t[31];let f;t[32]!==d||t[33]!==l||t[34]!==y?(f=l&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(ln,{children:[(0,Y.jsx)(nn,{asChild:!0,children:(0,Y.jsx)(K,{variant:`ghost`,size:`icon-xs`,"aria-label":`Open link in new tab`,onMouseDown:e=>{e.preventDefault(),window.open(d,`_blank`,`noopener,noreferrer`)},children:(0,Y.jsx)(Te,{className:`size-3.5`})})}),(0,Y.jsx)(an,{side:`bottom`,sideOffset:8,children:`Open link in new tab`})]}),(0,Y.jsxs)(ln,{children:[(0,Y.jsx)(nn,{asChild:!0,children:(0,Y.jsx)(K,{variant:`ghost`,size:`icon-xs`,"aria-label":`Remove link`,onMouseDown:e=>{e.preventDefault(),y()},children:(0,Y.jsx)(Ke,{className:`size-3.5`})})}),(0,Y.jsx)(an,{side:`bottom`,sideOffset:8,children:`Remove link`})]})]}),t[32]=d,t[33]=l,t[34]=y,t[35]=f):f=t[35];let p;return t[36]!==u||t[37]!==f?(p=(0,Y.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[u,f]}),t[36]=u,t[37]=f,t[38]=p):p=t[38],p}let S=l?`bg-accent text-primary`:`text-accent-foreground`,C,w;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(C=e=>{e.preventDefault(),i(!0)},w=(0,Y.jsx)(Ri,{className:`size-3.5`}),t[39]=C,t[40]=w):(C=t[39],w=t[40]);let T;t[41]===S?T=t[42]:(T=(0,Y.jsx)(nn,{asChild:!0,children:(0,Y.jsx)(K,{variant:`ghost`,size:`icon-xs`,"aria-label":`Insert link`,className:S,onMouseDown:C,children:w})}),t[41]=S,t[42]=T);let E;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Y.jsxs)(an,{side:`bottom`,sideOffset:8,children:[`Link`,(0,Y.jsx)(`kbd`,{className:`ml-1.5 text-[10px] opacity-60`,children:`⌘K`})]}),t[43]=E):E=t[43];let D;return t[44]===T?D=t[45]:(D=(0,Y.jsxs)(ln,{children:[T,E]}),t[44]=T,t[45]=D),D}function Yy({editor:e}){if(e.state.selection.empty||e.isActive(`codeBlock`))return!1;let{from:t,to:n}=e.state.selection;return!!e.state.doc.textBetween(t,n,` `).trim()}function Xy(e){let t=(0,Z.c)(25),{editor:n}=e,r=(0,X.useRef)(null),[i,a]=(0,X.useState)(0),o=(0,X.useRef)(null),s;t[0]!==n.state||t[1]!==n.view?(s=()=>{try{let{from:e,to:t}=n.state.selection;return $n(n.view,e,t)}catch{return new DOMRect}},t[0]=n.state,t[1]=n.view,t[2]=s):s=t[2];let c;if(t[3]!==n.view.dom||t[4]!==s){let e={getBoundingClientRect:s,contextElement:n.view.dom};c=()=>{let t=r.current;t&&(o.current?.(),o.current=On(e,t,()=>{vn(e,t,{placement:`top`,strategy:`fixed`,middleware:[Un(8),En(),bn({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($y)}))},t[3]=n.view.dom,t[4]=s,t[5]=c}else c=t[5];let l=c,u;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>{o.current?.(),o.current=null,a(Qy)},t[6]=u):u=t[6];let d=u,f;t[7]===l?f=t[8]:(f={onShow:l,onHide:d,strategy:`fixed`},t[7]=l,t[8]=f);let p;t[9]===n?p=t[10]:(p=(0,Y.jsx)(Uy,{editor:n}),t[9]=n,t[10]=p);let m;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Y.jsx)(Vy,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),t[11]=m):m=t[11];let h;t[12]!==n||t[13]!==i?(h=(0,Y.jsx)(Ky,{editor:n},i),t[12]=n,t[13]=i,t[14]=h):h=t[14];let g;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Y.jsx)(Vy,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),t[15]=g):g=t[15];let _=`${i}-link`,v;t[16]!==n||t[17]!==_?(v=(0,Y.jsx)(Jy,{editor:n},_),t[16]=n,t[17]=_,t[18]=v):v=t[18];let y;return t[19]!==n||t[20]!==v||t[21]!==f||t[22]!==p||t[23]!==h?(y=(0,Y.jsxs)(By,{ref:r,editor:n,appendTo:Zy,shouldShow:Yy,updateDelay:250,options:f,className:`z-50 flex items-center gap-0.5 rounded-lg border bg-background p-1 shadow-md`,children:[p,m,h,g,v]}),t[19]=n,t[20]=v,t[21]=f,t[22]=p,t[23]=h,t[24]=y):y=t[24],y}function Zy(){return document.body}function Qy(e){return e+1}function $y(){}var eb=[{name:`addRowBefore`,icon:Qr,label:`Add row above`,command:e=>e.chain().focus().addRowBefore().run()},{name:`addRowAfter`,icon:Yr,label:`Add row below`,command:e=>e.chain().focus().addRowAfter().run()},{name:`deleteRow`,icon:Ke,label:`Delete row`,command:e=>e.chain().focus().deleteRow().run()}],tb=[{name:`addColumnBefore`,icon:_e,label:`Add column left`,command:e=>e.chain().focus().addColumnBefore().run()},{name:`addColumnAfter`,icon:Xr,label:`Add column right`,command:e=>e.chain().focus().addColumnAfter().run()},{name:`deleteColumn`,icon:Ke,label:`Delete column`,command:e=>e.chain().focus().deleteColumn().run()}],nb=[{name:`toggleHeaderRow`,icon:da,label:`Toggle header row`,command:e=>e.chain().focus().toggleHeaderRow().run()},{name:`toggleHeaderColumn`,icon:hi,label:`Toggle header column`,command:e=>e.chain().focus().toggleHeaderColumn().run()},{name:`deleteTable`,icon:ji,label:`Delete table`,command:e=>e.chain().focus().deleteTable().run()}];function rb({editor:e}){return e.isActive(`table`)}function ib(e){let t=(0,Z.c)(14),{action:n,editor:r}=e,i=n.icon,a;t[0]!==n||t[1]!==r?(a=e=>{e.preventDefault(),n.command(r)},t[0]=n,t[1]=r,t[2]=a):a=t[2];let o;t[3]===i?o=t[4]:(o=(0,Y.jsx)(i,{className:`size-3.5`}),t[3]=i,t[4]=o);let s;t[5]!==n.label||t[6]!==a||t[7]!==o?(s=(0,Y.jsx)(nn,{asChild:!0,children:(0,Y.jsx)(K,{variant:`ghost`,size:`icon-xs`,"aria-label":n.label,className:`text-muted-foreground`,onMouseDown:a,children:o})}),t[5]=n.label,t[6]=a,t[7]=o,t[8]=s):s=t[8];let c;t[9]===n.label?c=t[10]:(c=(0,Y.jsx)(an,{side:`bottom`,sideOffset:8,children:n.label}),t[9]=n.label,t[10]=c);let l;return t[11]!==s||t[12]!==c?(l=(0,Y.jsxs)(ln,{children:[s,c]}),t[11]=s,t[12]=c,t[13]=l):l=t[13],l}function ab(e){let t=(0,Z.c)(13),{editor:n}=e,r;t[0]===n?r=t[1]:(r=eb.map(e=>(0,Y.jsx)(ib,{action:e,editor:n},e.name)),t[0]=n,t[1]=r);let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Y.jsx)(Vy,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),t[2]=i):i=t[2];let a;t[3]===n?a=t[4]:(a=tb.map(e=>(0,Y.jsx)(ib,{action:e,editor:n},e.name)),t[3]=n,t[4]=a);let o;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Y.jsx)(Vy,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),t[5]=o):o=t[5];let s;t[6]===n?s=t[7]:(s=nb.map(e=>(0,Y.jsx)(ib,{action:e,editor:n},e.name)),t[6]=n,t[7]=s);let c;return t[8]!==n||t[9]!==r||t[10]!==a||t[11]!==s?(c=(0,Y.jsxs)(By,{editor:n,shouldShow:rb,updateDelay:100,className:`flex items-center gap-0.5 rounded-lg border bg-background p-1 shadow-md`,children:[r,i,a,o,s]}),t[8]=n,t[9]=r,t[10]=a,t[11]=s,t[12]=c):c=t[12],c}var ob=new WeakMap;function sb(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=Cn(e.color),n.textContent=e.name,t.append(n),t}var cb={state:`idle`,count:0,lastFiredAt:null,position:`append`,lastAgentId:null},lb=e=>{let t=(0,Z.c)(53),{provider:n,placeholder:r}=e,i=(0,X.useRef)(``),a=(0,X.useRef)(null),o=(0,X.useRef)(cb),s=ly(),[c]=(0,X.useState)(ub),[l,u]=(0,X.useState)(null),[d,f]=(0,X.useState)(null);if(d)throw d;let p=(0,X.useRef)(null),m=n.configuration.name??``,h;t[0]!==c||t[1]!==m||t[2]!==r||t[3]!==n?(h=()=>{let e;try{let t={viewCount:0,bytes:n.document.getText(`source`).length};e=Ve({docName:m,container:document.createElement(`div`),sizeStats:t,factory:e=>{let t=performance.now();return{editor:new Xn({element:e,onBeforeCreate:e=>{let{editor:n}=e;ob.set(n,t)},onCreate:e=>{let{editor:t}=e,r=ob.get(t);if(ob.delete(t),r==null)return;let i=performance.now();it(`ok/editor/create-tiptap`,{docName:n.configuration.name??`unknown`,ytextLength:n.document.getText(`source`).length},{startTime:r,duration:Math.max(0,i-r)})},editorProps:{attributes:{class:`pt-10 pb-16 h-full`},clipboardTextParser:(e,t,n,r)=>{let i=c.mdManager.parse(e);return r.state.schema.nodeFromJSON(i).content},clipboardTextSerializer:(e,t)=>c.text(e,t),clipboardSerializer:c.html,handlePaste:(e,t)=>c.paste(e,t)},extensions:[...$e.map(e=>e.name===`link`?e.configure({docName:n.configuration.name??``}):e),cy.configure({placeholder:r??`Type '/' for commands`,showOnlyCurrent:!0}),ot.configure({document:n.document}),Pn.create({name:`imageUploadDecoration`,addProseMirrorPlugins(){return[at]}}),Pn.create({name:`collaborationCursor`,addProseMirrorPlugins(){let e=n.awareness;if(!e)throw Error(`[TiptapEditor] HocuspocusProvider has no awareness instance — cursor plugin cannot initialize`);return[Fe(e,{cursorBuilder:sb})]}})]}),ydoc:n.document,ytext:n.document.getText(`source`),provider:n}}}),p.current=e,u(e.editor)}catch(e){let t=e;console.error(`[TiptapEditor] mountTiptapEditor failed`,t),p.current=null,u(null),f(t instanceof Error?t:Error(String(t)))}return()=>{let e=p.current;e&&Re(e),p.current=null,u(null)}},t[0]=c,t[1]=m,t[2]=r,t[3]=n,t[4]=h):h=t[4];let g;t[5]!==c||t[6]!==m||t[7]!==n?(g=[m,n,c],t[5]=c,t[6]=m,t[7]=n,t[8]=g):g=t[8],(0,X.useEffect)(h,g);let _;t[9]===n.configuration.name?_=t[10]:(_=()=>{let e=n.configuration.name;return Pe(e??null),db},t[9]=n.configuration.name,t[10]=_);let v;t[11]===n?v=t[12]:(v=[n],t[11]=n,t[12]=v),(0,X.useEffect)(_,v);let y;t[13]!==l||t[14]!==n.configuration.name?(y=()=>{},t[13]=l,t[14]=n.configuration.name,t[15]=y):y=t[15];let b;t[16]!==l||t[17]!==n?(b=[l,n],t[16]=l,t[17]=n,t[18]=b):b=t[18],(0,X.useEffect)(y,b);let x,S;t[19]===l?(x=t[20],S=t[21]):(x=()=>{if(!l)return;let e=fb,t=null,n=()=>{t||!l||l.isDestroyed||(t=l.view.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 l.editorView?n():l.on(`create`,n),()=>{l.off(`create`,n),r()}},S=[l],t[19]=l,t[20]=x,t[21]=S),(0,X.useEffect)(x,S);let C,w;t[22]!==l||t[23]!==n.document?(w=()=>{if(!l)return;let e=n.document.getMap(`agent-flash`),t=Date.now(),r=0,i=null,s=null,c=null,u=()=>{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},d=e=>{o.current=e;let t=a.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??``))},f=()=>{let e=u(),t=e?.description?.toLowerCase().includes(`prepend`)?`prepend`:`append`,n={state:`editing`,count:(o.current?.count??0)+1,lastFiredAt:Date.now(),position:t,lastAgentId:e?.agentId??null};d(n),document.dispatchEvent(new CustomEvent(`agent-flash`,{detail:n})),s&&clearTimeout(s),c&&clearTimeout(c),s=window.setTimeout(()=>{let e={...n,state:`settled`};d(e),document.dispatchEvent(new CustomEvent(`agent-flash-end`,{detail:e})),c=window.setTimeout(()=>{d({...e,state:`idle`})},300)},Mn)};d(cb);let p=()=>{if(nr(e),!Tn(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(),f()},e)}return}r=n,f()};e.observe(p);let m=()=>{document.visibilityState===`visible`?Tn(e,t)&&(t=Date.now(),r=Date.now(),f()):t=Date.now()};return document.addEventListener(`visibilitychange`,m),()=>{e.unobserve(p),document.removeEventListener(`visibilitychange`,m),i&&clearTimeout(i),s&&clearTimeout(s),c&&clearTimeout(c)}},C=[l,n.document],t[22]=l,t[23]=n.document,t[24]=C,t[25]=w):(C=t[24],w=t[25]),(0,X.useEffect)(w,C);let T,E;t[26]===n?(T=t[27],E=t[28]):(T=()=>{let e=window.location.hash,t=e.indexOf(`?`),r=t>=0?new URLSearchParams(e.slice(t+1)).get(`anchor`):null;if(!r)return;let i=r,a=0,o,s=!1;function c(){if(s)return;let e=document.getElementById(i);e?(e.scrollIntoView({behavior:`smooth`,block:`start`}),s=!0,n.off(`synced`,c)):a<20&&(a+=1,o=window.setTimeout(c,100))}return c(),n.on(`synced`,c),()=>{o!==void 0&&clearTimeout(o),n.off(`synced`,c)}},E=[n],t[26]=n,t[27]=T,t[28]=E),(0,X.useEffect)(T,E);let D,O;t[29]===l?(D=t[30],O=t[31]):(D=()=>{if(!l)return;let e=function(e){let t=e.detail;if(!t||t.mode!==`wysiwyg`||!l||l.isDestroyed)return;let n=l.editorView;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(ir,e),()=>window.removeEventListener(ir,e)},O=[l],t[29]=l,t[30]=D,t[31]=O),(0,X.useEffect)(D,O);let k,A;t[32]===n.document?(k=t[33],A=t[34]):(k=()=>{let e=n.document.getMap(`metadata`),t=e.get(`frontmatter`);typeof t==`string`&&t&&(i.current=t);let r=()=>{let t=e.get(`frontmatter`);typeof t==`string`&&(i.current=t)};return e.observe(r),()=>e.unobserve(r)},A=[n.document],t[32]=n.document,t[33]=k,t[34]=A),(0,X.useEffect)(k,A);let j;t[35]!==s||t[36]!==n.awareness?(j=()=>{let e=n.awareness;e&&(e.setLocalStateField(`user`,{name:s.name,color:s.color,type:`human`,coeditor:s.coeditor,tabId:s.tabId}),e.setLocalStateField(`mode`,`wysiwyg`))},t[35]=s,t[36]=n.awareness,t[37]=j):j=t[37];let M;t[38]!==s||t[39]!==n?(M=[n,s],t[38]=s,t[39]=n,t[40]=M):M=t[40],(0,X.useEffect)(j,M);let N;t[41]===l?N=t[42]:(N=l&&(0,Y.jsx)(Xy,{editor:l}),t[41]=l,t[42]=N);let P;t[43]===l?P=t[44]:(P=l&&(0,Y.jsx)(ab,{editor:l}),t[43]=l,t[44]=P);let F,I;t[45]===l?(F=t[46],I=t[47]):(F=(0,Y.jsx)(Qe,{editor:l,className:`h-full`}),I=l&&(0,Y.jsx)(Ot,{store:wt(l).store}),t[45]=l,t[46]=F,t[47]=I);let ee;return t[48]!==N||t[49]!==P||t[50]!==F||t[51]!==I?(ee=(0,Y.jsxs)(`div`,{ref:a,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:[N,P,F,I]}),t[48]=N,t[49]=P,t[50]=F,t[51]=I,t[52]=ee):ee=t[52],ee};function ub(){let e=new er({extensions:jn});return{mdManager:e,text:ur({mdManager:e}),html:cr({mdManager:e}),paste:or({mdManager:e})}}function db(){return Pe(null)}function fb(){return St()}function pb(e){let t=(0,Z.c)(2),{docName:n,provider:r,children:i}=e;(0,X.use)(st(n,r));let a;return t[0]===i?a=t[1]:(a=(0,Y.jsx)(Y.Fragment,{children:i}),t[0]=i,t[1]=a),a}var mb=(0,X.createContext)(null),hb={didCatch:!1,error:null},gb=class extends X.Component{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=hb}static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(...e){let{error:t}=this.state;t!==null&&(this.props.onReset?.({args:e,reason:`imperative-api`}),this.setState(hb))}componentDidCatch(e,t){this.props.onError?.(e,t)}componentDidUpdate(e,t){let{didCatch:n}=this.state,{resetKeys:r}=this.props;n&&t.error!==null&&_b(e.resetKeys,r)&&(this.props.onReset?.({next:r,prev:e.resetKeys,reason:`keys`}),this.setState(hb))}render(){let{children:e,fallbackRender:t,FallbackComponent:n,fallback:r}=this.props,{didCatch:i,error:a}=this.state,o=e;if(i){let e={error:a,resetErrorBoundary:this.resetErrorBoundary};if(typeof t==`function`)o=t(e);else if(n)o=(0,X.createElement)(n,e);else if(r!==void 0)o=r;else throw a}return(0,X.createElement)(mb.Provider,{value:{didCatch:i,error:a,resetErrorBoundary:this.resetErrorBoundary}},o)}};function _b(e=[],t=[]){return e.length!==t.length||e.some((e,n)=>!Object.is(e,t[n]))}var vb=`__back-nav__`;function yb(e){return e instanceof vt||e instanceof ft||e instanceof Ge||e instanceof rt?e.docName:null}function bb(e){return e instanceof vt?{title:`Couldn't load document`,summary:`"${e.docName}" took too long. Check your connection.`}:e instanceof ft?{title:`Connection dropped`,summary:`Lost connection to "${e.docName}".`}:e instanceof Ge?{title:`Document not found`,summary:`"${e.docName}" doesn't exist.`}:e instanceof rt?{title:`Couldn't open document`,summary:`Something went wrong opening "${e.docName}".`}:{title:`Unknown error`,summary:e instanceof Error&&e.message?e.message:`An unexpected error occurred.`}}function xb(e){let t=(0,Z.c)(27),{error:n,resetErrorBoundary:r,activeDocName:i,previousDocName:a,onNavigateBack:o}=e,s;t[0]===n?s=t[1]:(s=bb(n),t[0]=n,t[1]=s);let{title:c,summary:l}=s,u=!!a&&!!o,d=(0,X.useRef)(null),f,p;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=()=>{d.current?.focus()},p=[],t[2]=f,t[3]=p):(f=t[2],p=t[3]),(0,X.useEffect)(f,p);let m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Y.jsx)(Av,{size:80,variant:`sleeping`}),t[4]=m):m=t[4];let h;t[5]===c?h=t[6]:(h=(0,Y.jsx)(`h2`,{id:`document-error-title`,className:`text-lg font-medium`,children:c}),t[5]=c,t[6]=h);let g;t[7]===l?g=t[8]:(g=(0,Y.jsx)(`p`,{className:`max-w-sm text-sm text-muted-foreground`,children:l}),t[7]=l,t[8]=g);let _;t[9]!==h||t[10]!==g?(_=(0,Y.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[h,g]}),t[9]=h,t[10]=g,t[11]=_):_=t[11];let v;t[12]===r?v=t[13]:(v=(0,Y.jsx)(K,{ref:d,variant:`default`,onClick:r,children:`Try again`}),t[12]=r,t[13]=v);let y;t[14]!==i||t[15]!==u||t[16]!==n||t[17]!==o||t[18]!==a||t[19]!==r?(y=u?(0,Y.jsx)(K,{variant:`ghost`,className:`font-mono uppercase`,onClick:()=>{!a||!o||(Je(yb(n)??i),o(a),r(vb))},children:`Go back`}):null,t[14]=i,t[15]=u,t[16]=n,t[17]=o,t[18]=a,t[19]=r,t[20]=y):y=t[20];let b;t[21]!==v||t[22]!==y?(b=(0,Y.jsxs)(`div`,{className:`mt-1 flex gap-2`,children:[v,y]}),t[21]=v,t[22]=y,t[23]=b):b=t[23];let x;return t[24]!==b||t[25]!==_?(x=(0,Y.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:[m,_,b]}),t[24]=b,t[25]=_,t[26]=x):x=t[26],x}function Sb(e){let t=(0,Z.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,Y.jsx)(xb,{...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]===vb){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.warn(`[DocumentErrorBoundary] rendered fallback for ${n}: ${bb(e).title}`)},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,Y.jsx)(gb,{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 Cb(e){let t=e.threshold??5e5;return e.ytextLength>t?{renderSource:e.isSourceMode||e.visitedSource,renderVisual:!e.isSourceMode||e.visitedVisual,isLarge:!0}:{renderSource:!0,renderVisual:!0,isLarge:!1}}function wb(){return n(()=>import(`./SourceEditor-C7wAoLYw.js`),__vite__mapDeps([15,1,2,16,17,18,6,4,5,12,8,13,19,10]),import.meta.url)}var Tb=(0,X.lazy)(async()=>({default:(await wb()).SourceEditor}));function Eb(e,t,n){if(n<=0)return[];let r=e.filter(e=>!Xe(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 Db(e){let t=(0,Z.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Y.jsx)(_t,{name:`activity-pool`,children:(0,Y.jsx)(Ob,{...e})}),t[0]=e,t[1]=n),n}function Ob(e){let t=(0,Z.c)(11),{activeDocName:n,isSourceMode:r,editorPlaceholder:i,previousDocName:a,onNavigateBack:o,onRecycle:s}=e,{poolEntries:c}=ut(),{pages:l,loading:u}=Vn(),d=Eb(c,n,3),f=(0,X.useRef)(``),p=d.map(kb).join(`,`);(0,X.useLayoutEffect)(()=>{if(f.current===p)return;let e=f.current?f.current.split(`,`):[],t=p?p.split(`,`):[];it(`ok/activity/mount-list-change`,{active:n,mounted:t,evicted:e.filter(e=>!t.includes(e))}),f.current=p,ze(t)},[p,n]);let m;t[0]!==n||t[1]!==i||t[2]!==r||t[3]!==u||t[4]!==o||t[5]!==s||t[6]!==l||t[7]!==a?(m=e=>(0,Y.jsx)(Mb,{entry:e,isActive:e.docName===n,isSourceMode:r,editorPlaceholder:i,isNewDoc:!u&&!l.has(e.docName),previousDocName:a,onNavigateBack:o,onRecycle:s},e.docName),t[0]=n,t[1]=i,t[2]=r,t[3]=u,t[4]=o,t[5]=s,t[6]=l,t[7]=a,t[8]=m):m=t[8];let h=d.map(m),g;return t[9]===h?g=t[10]:(g=(0,Y.jsx)(Y.Fragment,{children:h}),t[9]=h,t[10]=g),g}function kb(e){return e.docName}function Ab(e){let t=(0,Z.c)(8),{isActive:n,children:r}=e,i=(0,X.useRef)(null),a=(0,X.useRef)(0),o,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>{let e=i.current;if(!e)return;let t=()=>{e.scrollTop>0&&(a.current=e.scrollTop)};return e.addEventListener(`scroll`,t,{passive:!0}),()=>e.removeEventListener(`scroll`,t)},s=[],t[0]=o,t[1]=s):(o=t[0],s=t[1]),(0,X.useEffect)(o,s);let c,l;t[2]===n?(c=t[3],l=t[4]):(c=()=>{if(!n)return;let e=i.current;if(!e)return;let t=a.current;if(t===0||(e.scrollTop=t,e.scrollTop===t))return;let r=!1,o=()=>{r||(r=!0,s.disconnect(),clearTimeout(c))},s=new ResizeObserver(()=>{r||!e||e.scrollHeight>t&&(e.scrollTop=t,e.scrollTop===t&&o())});s.observe(e);let c=setTimeout(o,500);return o},l=[n],t[2]=n,t[3]=c,t[4]=l),(0,X.useLayoutEffect)(c,l);let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u={overflowAnchor:`auto`},t[5]=u):u=t[5];let d;return t[6]===r?d=t[7]:(d=(0,Y.jsx)(`div`,{ref:i,className:`subtle-scrollbar h-full overflow-y-auto`,style:u,children:r}),t[6]=r,t[7]=d),d}function jb(e){let t=(0,Z.c)(12),{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a}=e,o=r&&i,[s,c]=(0,X.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,X.useEffect)(l,u),!s&&!o)return null;let d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Y.jsx)(j_,{}),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,Y.jsx)(X.Suspense,{fallback:d,children:(0,Y.jsx)(Tb,{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 Mb(e){let t=(0,Z.c)(48),{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a,isNewDoc:o,previousDocName:s,onNavigateBack:c,onRecycle:l}=e,u=n.provider.document.getText(`source`).length,[d,f]=(0,X.useState)(i),[p,m]=(0,X.useState)(!i),h,g;t[0]!==i||t[1]!==d||t[2]!==p?(h=()=>{i&&!d?f(!0):!i&&!p&&m(!0)},g=[i,d,p],t[0]=i,t[1]=d,t[2]=p,t[3]=h,t[4]=g):(h=t[3],g=t[4]),(0,X.useEffect)(h,g);let _=Cb({ytextLength:u,isSourceMode:i,visitedSource:d,visitedVisual:p}),v=(0,X.useRef)(``),y=`${_.isLarge}-${_.renderSource}-${_.renderVisual}`,b,x;t[5]!==n.docName||t[6]!==_.isLarge||t[7]!==_.renderSource||t[8]!==_.renderVisual||t[9]!==y||t[10]!==i||t[11]!==u?(b=()=>{v.current!==y&&(v.current=y,_.isLarge&&it(`ok/activity/defer-mount`,{docName:n.docName,ytextLength:u,isSourceMode:i,renderSource:_.renderSource,renderVisual:_.renderVisual}))},x=[y,_.isLarge,_.renderSource,_.renderVisual,n.docName,u,i],t[5]=n.docName,t[6]=_.isLarge,t[7]=_.renderSource,t[8]=_.renderVisual,t[9]=y,t[10]=i,t[11]=u,t[12]=b,t[13]=x):(b=t[12],x=t[13]),(0,X.useEffect)(b,x);let S=r?`visible`:`hidden`,C=`editor:${n.docName}`,w;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Y.jsx)(j_,{}),t[14]=w):w=t[14];let T;t[15]!==a||t[16]!==n||t[17]!==_.renderSource||t[18]!==r||t[19]!==i?(T=_.renderSource?(0,Y.jsx)(`div`,{className:i?`h-full`:`ok-mode-hidden h-full`,children:(0,Y.jsx)(jb,{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a})}):null,t[15]=a,t[16]=n,t[17]=_.renderSource,t[18]=r,t[19]=i,t[20]=T):T=t[20];let E;t[21]!==a||t[22]!==n.docName||t[23]!==n.provider||t[24]!==_.renderVisual||t[25]!==o||t[26]!==i?(E=_.renderVisual?(0,Y.jsx)(`div`,{className:i?`ok-mode-hidden h-full`:`h-full`,children:(0,Y.jsx)(lb,{provider:n.provider,placeholder:a},`${n.docName}-${String(o)}`)}):null,t[21]=a,t[22]=n.docName,t[23]=n.provider,t[24]=_.renderVisual,t[25]=o,t[26]=i,t[27]=E):E=t[27];let D;t[28]!==T||t[29]!==E?(D=(0,Y.jsxs)(`div`,{className:`relative h-full`,children:[T,E]}),t[28]=T,t[29]=E,t[30]=D):D=t[30];let O;t[31]!==n.docName||t[32]!==n.provider||t[33]!==D?(O=(0,Y.jsx)(X.Suspense,{fallback:w,children:(0,Y.jsx)(pb,{docName:n.docName,provider:n.provider,children:D})}),t[31]=n.docName,t[32]=n.provider,t[33]=D,t[34]=O):O=t[34];let k;t[35]!==n.docName||t[36]!==c||t[37]!==l||t[38]!==s||t[39]!==O?(k=(0,Y.jsx)(Sb,{activeDocName:n.docName,previousDocName:s,onNavigateBack:c,onRecycle:l,children:O}),t[35]=n.docName,t[36]=c,t[37]=l,t[38]=s,t[39]=O,t[40]=k):k=t[40];let A;t[41]!==r||t[42]!==k?(A=(0,Y.jsx)(Ab,{isActive:r,children:k}),t[41]=r,t[42]=k,t[43]=A):A=t[43];let j;return t[44]!==A||t[45]!==S||t[46]!==C?(j=(0,Y.jsx)(X.Activity,{mode:S,name:C,children:A}),t[44]=A,t[45]=S,t[46]=C,t[47]=j):j=t[47],j}function Nb(e){let t=(0,Z.c)(26),{stats:n}=e,r;t[0]===n.words?r=t[1]:(r=n.words.toLocaleString(),t[0]=n.words,t[1]=r);let i;t[2]===r?i=t[3]:(i=(0,Y.jsx)(`span`,{className:`tabular-nums`,children:r}),t[2]=r,t[3]=i);let a=n.words===1?`word`:`words`,o;t[4]!==i||t[5]!==a?(o=(0,Y.jsxs)(`span`,{children:[i,` `,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6];let s;t[7]===n.chars?s=t[8]:(s=n.chars.toLocaleString(),t[7]=n.chars,t[8]=s);let c;t[9]===s?c=t[10]:(c=(0,Y.jsx)(`span`,{className:`tabular-nums`,children:s}),t[9]=s,t[10]=c);let l=n.chars===1?`char`:`chars`,u;t[11]!==c||t[12]!==l?(u=(0,Y.jsxs)(`span`,{children:[c,` `,l]}),t[11]=c,t[12]=l,t[13]=u):u=t[13];let d=n.tokens>0?`~`:``,f;t[14]===n.tokens?f=t[15]:(f=n.tokens.toLocaleString(),t[14]=n.tokens,t[15]=f);let p;t[16]===f?p=t[17]:(p=(0,Y.jsx)(`span`,{className:`tabular-nums`,children:f}),t[16]=f,t[17]=p);let m=n.tokens===1?`token`:`tokens`,h;t[18]!==p||t[19]!==m||t[20]!==d?(h=(0,Y.jsxs)(`span`,{children:[d,p,` `,m]}),t[18]=p,t[19]=m,t[20]=d,t[21]=h):h=t[21];let g;return t[22]!==h||t[23]!==o||t[24]!==u?(g=(0,Y.jsxs)(`section`,{"aria-label":`Document statistics`,className:`flex h-6 shrink-0 items-center justify-end gap-3 px-3 text-2xs text-muted-foreground`,children:[o,u,h]}),t[22]=h,t[23]=o,t[24]=u,t[25]=g):g=t[25],g}function Pb(e){let t=(0,Z.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Y.jsx)(_t,{name:`editor-area`,children:(0,Y.jsx)(Fb,{...e})}),t[0]=e,t[1]=n),n}function Fb(e){let t=(0,Z.c)(112),{editorMode:n,previewEntry:r,diffLayout:i,onNoDiff:a,onEntrySelect:o,selectedSha:s}=e,{activeDocName:c,activeProvider:l,activeTarget:u,recycleDocument:d,docPanelMode:f,docPanelExpandSignal:p}=ut(),{openDocumentTransition:m}=gt(),h=sy(l,c),g=(0,X.useDeferredValue)(c),_=u?.kind===`missing`,v=!!c&&u?.kind!==`folder`&&n!==`diff`,y=_?`Start writing to create this page…`:void 0,b=Zg(),[x,S]=(0,X.useState)(!1),{layout:C,autoCollapse:w}=Xv(),T=C===`sheet`,[E,D]=(0,X.useState)(!1),O=(0,X.useRef)(!1),[k,A]=(0,X.useState)(T_[0].id),j,M;t[0]!==w||t[1]!==C||t[2]!==b?(j=()=>{C===`panel`&&(w?(O.current=!1,b.current?.collapse()):O.current||b.current?.expand())},M=[w,C,b],t[0]=w,t[1]=C,t[2]=b,t[3]=j,t[4]=M):(j=t[3],M=t[4]),(0,X.useEffect)(j,M);let N,P;t[5]!==p||t[6]!==T||t[7]!==b?(N=()=>{p!==0&&(T?D(!0):(O.current=!1,b.current?.expand()))},P=[p,T,b],t[5]=p,t[6]=T,t[7]=b,t[8]=N,t[9]=P):(N=t[8],P=t[9]),(0,X.useEffect)(N,P);let F=(0,X.useRef)(null),[I,ee]=(0,X.useState)(null),L,R;t[10]===c?(L=t[11],R=t[12]):(L=()=>{if(c&&c!==F.current){let e=F.current;F.current=c,ee(e)}},R=[c],t[10]=c,t[11]=L,t[12]=R),(0,X.useEffect)(L,R);let[z,B]=(0,X.useState)(null),[V,H]=(0,X.useState)(!1),te;t[13]!==c||t[14]!==l||t[15]!==a||t[16]!==r?(te=()=>{if(!r?.sha||!c){B(null);return}let e=!1,t=r.sha,n=c;return H(!0),B(null),(async function(){try{let r=await fetch(`/api/history/${t}?docName=${encodeURIComponent(n)}`);if(e)return;if(!r.ok){B(null),H(!1);return}let i=await r.json();if(!e){let e=Sn(i.content??``).body,t=Sn(l?.document.getText(`source`).toString()??``).body,n=Lb;if(n(e)===n(t)){H(!1),a?.();return}B({old:e,new:t}),H(!1)}}catch{e||(B(null),H(!1))}})(),()=>{e=!0}},t[13]=c,t[14]=l,t[15]=a,t[16]=r,t[17]=te):te=t[17];let ne=r?.sha,re;if(t[18]!==c||t[19]!==l||t[20]!==a||t[21]!==ne?(re=[ne,c,l,a],t[18]=c,t[19]=l,t[20]=a,t[21]=ne,t[22]=re):re=t[22],(0,X.useEffect)(te,re),u?.kind===`folder`){let e;return t[23]===u.folderPath?e=t[24]:(e=(0,Y.jsx)(nv,{folderPath:u.folderPath}),t[23]=u.folderPath,t[24]=e),e}if(!l||!c){if((typeof window<`u`?Kn(window.location.hash):null)!==null){let e;return t[25]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(j_,{}),t[25]=e):e=t[25],e}let e;return t[26]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(Rb,{}),t[26]=e):e=t[26],e}let U=n===`diff`,W=n===`source`,G=T?!E:x,ie;t[27]!==x||t[28]!==T||t[29]!==b?(ie=()=>{T?D(Ib):x?(O.current=!1,b.current?.expand()):(O.current=!0,b.current?.collapse())},t[27]=x,t[28]=T,t[29]=b,t[30]=ie):ie=t[30];let ae=G?`Show document panel`:`Hide document panel`,oe;t[31]===G?oe=t[32]:(oe=G?(0,Y.jsx)(qi,{className:`size-4`}):(0,Y.jsx)(Ki,{className:`size-4`}),t[31]=G,t[32]=oe);let q;t[33]!==ie||t[34]!==ae||t[35]!==oe?(q=(0,Y.jsx)(nn,{asChild:!0,children:(0,Y.jsx)(K,{variant:`ghost`,size:`icon`,onClick:ie,"aria-label":ae,className:`text-muted-foreground`,children:oe})}),t[33]=ie,t[34]=ae,t[35]=oe,t[36]=q):q=t[36];let se=G?`Show panel`:`Hide panel`,J;t[37]===se?J=t[38]:(J=(0,Y.jsx)(an,{side:`left`,children:se}),t[37]=se,t[38]=J);let ce;t[39]!==q||t[40]!==J?(ce=(0,Y.jsx)(`div`,{className:`absolute top-2 right-2 z-10`,children:(0,Y.jsxs)(ln,{children:[q,J]})}),t[39]=q,t[40]=J,t[41]=ce):ce=t[41];let le=ce,ue;t[42]!==U||t[43]!==V?(ue=U&&V&&(0,Y.jsx)(`div`,{className:`flex items-center justify-center py-16`,role:`status`,"aria-label":`Loading version`,children:(0,Y.jsx)(`div`,{className:`size-5 animate-spin rounded-full border-2 border-muted border-t-foreground`})}),t[42]=U,t[43]=V,t[44]=ue):ue=t[44];let de;t[45]!==z||t[46]!==i||t[47]!==U||t[48]!==V?(de=U&&!V&&z!==null&&(0,Y.jsx)(Km,{oldContent:z.old,newContent:z.new,layout:i}),t[45]=z,t[46]=i,t[47]=U,t[48]=V,t[49]=de):de=t[49];let fe=U?`none`:void 0,pe;t[50]===fe?pe=t[51]:(pe={display:fe},t[50]=fe,t[51]=pe);let me=g??c,he=I??void 0,ge;t[52]===m?ge=t[53]:(ge=e=>{let t=Nn(e);window.location.hash===t?m(e):window.location.hash=t},t[52]=m,t[53]=ge);let _e;t[54]!==y||t[55]!==W||t[56]!==d||t[57]!==me||t[58]!==he||t[59]!==ge?(_e=(0,Y.jsx)(Db,{activeDocName:me,isSourceMode:W,editorPlaceholder:y,previousDocName:he,onNavigateBack:ge,onRecycle:d}),t[54]=y,t[55]=W,t[56]=d,t[57]=me,t[58]=he,t[59]=ge,t[60]=_e):_e=t[60];let ve;t[61]!==c||t[62]!==g?(ve=c&&c!==g?(0,Y.jsx)(`div`,{className:`absolute inset-0 z-10 bg-background`,children:(0,Y.jsx)(j_,{})}):null,t[61]=c,t[62]=g,t[63]=ve):ve=t[63];let ye;t[64]!==pe||t[65]!==_e||t[66]!==ve?(ye=(0,Y.jsxs)(`div`,{className:`relative h-full`,style:pe,children:[_e,ve]}),t[64]=pe,t[65]=_e,t[66]=ve,t[67]=ye):ye=t[67];let be;t[68]!==ue||t[69]!==de||t[70]!==ye||t[71]!==le?(be=(0,Y.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[ue,de,ye,le]}),t[68]=ue,t[69]=de,t[70]=ye,t[71]=le,t[72]=be):be=t[72];let xe;t[73]!==v||t[74]!==h?(xe=v&&(0,Y.jsx)(Nb,{stats:h}),t[73]=v,t[74]=h,t[75]=xe):xe=t[75];let Se;t[76]!==be||t[77]!==xe?(Se=(0,Y.jsxs)(`div`,{className:`relative flex h-full flex-col`,children:[be,xe]}),t[76]=be,t[77]=xe,t[78]=Se):Se=t[78];let Ce=Se;if(T){let e;t[79]===Ce?e=t[80]:(e=(0,Y.jsx)(`div`,{className:`min-w-0 flex-1`,children:Ce}),t[79]=Ce,t[80]=e);let n;t[81]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Y.jsx)(Zm,{className:`sr-only`,children:(0,Y.jsx)(Qm,{children:`Document panel`})}),t[81]=n):n=t[81];let r;t[82]!==c||t[83]!==k||t[84]!==f||t[85]!==W||t[86]!==o||t[87]!==s?(r=(0,Y.jsxs)(Xm,{side:`right`,className:`flex w-80 sm:w-96 flex-col gap-0 p-0`,children:[n,(0,Y.jsx)(k_,{docName:c,isSourceMode:W,activeTab:k,onActiveTabChange:A,onEntrySelect:o,selectedSha:s,mode:f})]}),t[82]=c,t[83]=k,t[84]=f,t[85]=W,t[86]=o,t[87]=s,t[88]=r):r=t[88];let i;t[89]!==E||t[90]!==r?(i=(0,Y.jsx)(qm,{open:E,onOpenChange:D,children:r}),t[89]=E,t[90]=r,t[91]=i):i=t[91];let a;return t[92]!==e||t[93]!==i?(a=(0,Y.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[e,i]}),t[92]=e,t[93]=i,t[94]=a):a=t[94],a}let we;t[95]===Ce?we=t[96]:(we=(0,Y.jsx)(Kv,{minSize:`30%`,defaultSize:`75%`,children:Ce}),t[95]=Ce,t[96]=we);let Te;t[97]===Symbol.for(`react.memo_cache_sentinel`)?(Te=(0,Y.jsx)(qv,{withHandle:!0}),t[97]=Te):Te=t[97];let Ee;t[98]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=e=>S(e.asPercentage===0),t[98]=Ee):Ee=t[98];let De;t[99]!==c||t[100]!==k||t[101]!==f||t[102]!==W||t[103]!==o||t[104]!==s?(De=(0,Y.jsx)(k_,{docName:c,isSourceMode:W,activeTab:k,onActiveTabChange:A,onEntrySelect:o,selectedSha:s,mode:f}),t[99]=c,t[100]=k,t[101]=f,t[102]=W,t[103]=o,t[104]=s,t[105]=De):De=t[105];let Oe;t[106]!==b||t[107]!==De?(Oe=(0,Y.jsx)(Kv,{panelRef:b,defaultSize:`25%`,minSize:`300px`,maxSize:`40%`,collapsible:!0,collapsedSize:0,onResize:Ee,className:`flex flex-col bg-muted/20`,children:De}),t[106]=b,t[107]=De,t[108]=Oe):Oe=t[108];let ke;return t[109]!==we||t[110]!==Oe?(ke=(0,Y.jsx)(`div`,{className:`flex min-h-0 flex-1`,children:(0,Y.jsxs)(Gv,{orientation:`horizontal`,children:[we,Te,Oe]})}),t[109]=we,t[110]=Oe,t[111]=ke):ke=t[111],ke}function Ib(e){return!e}function Lb(e){return e.replace(/\r\n/g,`
23
- `).replace(/[ \t]+$/gm,``).trimEnd()}function Rb(){let e=(0,Z.c)(5),[t,n]=(0,X.useState)(!1),r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Y.jsx)(Av,{size:80}),i=(0,Y.jsx)(`span`,{className:`select-none text-sm text-muted-foreground`,children:`Select a document to edit`}),e[0]=r,e[1]=i):(r=e[0],i=e[1]);let a;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Y.jsxs)(`div`,{className:`flex flex-col items-center gap-2`,children:[(0,Y.jsxs)(K,{variant:`outline`,onClick:()=>n(!0),children:[(0,Y.jsx)(ai,{"aria-hidden":`true`,className:`h-4 w-4`}),`Initialize LLM brain`]}),(0,Y.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Optional starter structure`})]}),e[2]=a):a=e[2];let o;return e[3]===t?o=e[4]:(o=(0,Y.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-6`,children:[r,i,a,(0,Y.jsx)(Fv,{open:t,onOpenChange:n})]}),e[3]=t,e[4]=o),o}function zb(e,t){let n=t.trim();return e===`file`?n.replace(/\.md$/i,``):n}function Bb(e){return![``,`.`,`..`].includes(e)&&!e.includes(`/`)&&!e.includes(`\\`)&&!e.includes(`\0`)}function Vb(e,t){let n=zb(e.kind,t),r=e.path.split(`/`);return r[r.length-1]=n,r.join(`/`)}function Hb(e,t){if(t.length===0)return e;let n=new Map(t.map(e=>[e.fromDocName,e.toDocName]));return e.map(e=>({...e,docName:n.get(e.docName)??e.docName}))}function Ub(e,t){if(t.length===0)return e;let n=new Set(t);return e.filter(e=>!n.has(e.docName))}function Wb(e,t){return e?t.find(t=>t.fromDocName===e)?.toDocName??e:null}var Gb=1280;function Kb(){let e=(0,Z.c)(2),[t,n]=(0,X.useState)(qb),r,i;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=window.matchMedia(`(max-width: ${Gb-1}px)`),t=()=>{n(window.innerWidth<Gb)};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,X.useEffect)(r,i),t}function qb(){return window.innerWidth<Gb}var Jb=`sidebar_state`,Yb=3600*24*7,Xb=`18rem`,Zb=`3rem`,Qb=`\\`,$b=`app-file-sidebar`,ex=X.createContext(null);function tx(){let e=X.use(ex);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function nx(e){let t=(0,Z.c)(49),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]):({defaultOpen:c,open:i,onOpenChange:o,className:r,style:s,children:n,...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?!0:c,u=Kb(),[d,f]=X.useState(!1),[p,m]=X.useState(!1),[h,g]=X.useState(l),_=i??h,v;t[8]!==_||t[9]!==o?(v=e=>{let t=typeof e==`function`?e(_):e;o?o(t):g(t),document.cookie=`${Jb}=${t}; path=/; max-age=${Yb}`},t[8]=_,t[9]=o,t[10]=v):v=t[10];let y=v,b;t[11]!==u||t[12]!==y?(b=function(){return u?f(ix):y(rx)},t[11]=u,t[12]=y,t[13]=b):b=t[13];let x=b,S;t[14]!==u||t[15]!==d?(S=function(){!u||!d||window.matchMedia(`(prefers-reduced-motion: reduce)`).matches||m(!0)},t[14]=u,t[15]=d,t[16]=S):S=t[16];let C=S,w,T;t[17]===x?(w=t[18],T=t[19]):(w=()=>{let e=e=>{e.key===Qb&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),x())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},T=[x],t[17]=x,t[18]=w,t[19]=T),X.useEffect(w,T);let E,D;t[20]!==u||t[21]!==d?(E=()=>{if(!u||!d)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"]`)||f(!1))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},D=[u,d],t[20]=u,t[21]=d,t[22]=E,t[23]=D):(E=t[22],D=t[23]),X.useEffect(E,D);let O=X.useRef(u),k,A;t[24]!==u||t[25]!==_?(A=()=>{!O.current&&u&&f(_),O.current=u},k=[u,_],t[24]=u,t[25]=_,t[26]=k,t[27]=A):(k=t[26],A=t[27]),X.useEffect(A,k);let j=u?d?`expanded`:`collapsed`:_?`expanded`:`collapsed`,M;t[28]!==u||t[29]!==C||t[30]!==_||t[31]!==d||t[32]!==y||t[33]!==p||t[34]!==j||t[35]!==x?(M={state:j,open:_,setOpen:y,isMobile:u,openMobile:d,setOpenMobile:f,toggleSidebar:x,showPushPulse:p,setShowPushPulse:m,notifySidebarFileSelected:C},t[28]=u,t[29]=C,t[30]=_,t[31]=d,t[32]=y,t[33]=p,t[34]=j,t[35]=x,t[36]=M):M=t[36];let N;t[37]===s?N=t[38]:(N={"--sidebar-width":Xb,"--sidebar-width-icon":Zb,...s},t[37]=s,t[38]=N);let P=N,F;t[39]===r?F=t[40]:(F=W(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),t[39]=r,t[40]=F);let I;t[41]!==n||t[42]!==a||t[43]!==P||t[44]!==F?(I=(0,Y.jsx)(`div`,{"data-slot":`sidebar-wrapper`,style:P,className:F,...a,children:n}),t[41]=n,t[42]=a,t[43]=P,t[44]=F,t[45]=I):I=t[45];let ee;return t[46]!==M||t[47]!==I?(ee=(0,Y.jsx)(ex.Provider,{value:M,children:I}),t[46]=M,t[47]=I,t[48]=ee):ee=t[48],ee}function rx(e){return!e}function ix(e){return!e}function ax(e){let t=(0,Z.c)(50),n,r,i,a,o,s;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6]):({side:a,variant:o,collapsible:s,className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s);let c=a===void 0?`left`:a,l=o===void 0?`sidebar`:o,u=s===void 0?`offcanvas`:s,{isMobile:d,state:f,openMobile:p}=tx();if(u===`none`){let e;t[7]===r?e=t[8]:(e=W(`flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground`,r),t[7]=r,t[8]=e);let a;return t[9]!==n||t[10]!==i||t[11]!==e||t[12]!==l?(a=(0,Y.jsx)(`div`,{"data-slot":`sidebar`,"data-variant":l,className:e,...i,children:n}),t[9]=n,t[10]=i,t[11]=e,t[12]=l,t[13]=a):a=t[13],a}if(d){let e=p?`expanded`:`collapsed`,a=l===`floating`||l===`inset`?`p-2`:``,o;t[14]!==r||t[15]!==a?(o=W(`fixed inset-y-0 z-30 flex h-svh w-(--sidebar-width)`,`transition-transform duration-200 ease-linear motion-reduce:transition-none`,`data-[side=left]:left-0 data-[side=right]:right-0`,`group-data-[state=collapsed]:data-[side=left]:-translate-x-full`,`group-data-[state=collapsed]:data-[side=right]:translate-x-full`,a,r),t[14]=r,t[15]=a,t[16]=o):o=t[16];let s;t[17]===n?s=t[18]:(s=(0,Y.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[17]=n,t[18]=s);let u;t[19]!==i||t[20]!==c||t[21]!==o||t[22]!==s?(u=(0,Y.jsx)(`nav`,{id:$b,"aria-label":`File sidebar`,"data-slot":`sidebar-container`,"data-side":c,className:o,...i,children:s}),t[19]=i,t[20]=c,t[21]=o,t[22]=s,t[23]=u):u=t[23];let d;return t[24]!==e||t[25]!==c||t[26]!==u||t[27]!==l?(d=(0,Y.jsx)(`div`,{className:`group peer text-sidebar-foreground`,"data-state":e,"data-variant":l,"data-side":c,"data-slot":`sidebar`,"data-mobile":`true`,children:u}),t[24]=e,t[25]=c,t[26]=u,t[27]=l,t[28]=d):d=t[28],d}let m=f===`collapsed`?u:``,h=l===`floating`||l===`inset`?`group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon)`,g;t[29]===h?g=t[30]:(g=W(`relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear`,`group-data-[collapsible=offcanvas]:w-0`,`group-data-[side=right]:rotate-180`,h),t[29]=h,t[30]=g);let _;t[31]===g?_=t[32]:(_=(0,Y.jsx)(`div`,{"data-slot":`sidebar-gap`,className:g}),t[31]=g,t[32]=_);let v=l===`floating`||l===`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`,y;t[33]!==r||t[34]!==v?(y=W(`fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear 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)] md:flex`,v,r),t[33]=r,t[34]=v,t[35]=y):y=t[35];let b;t[36]===n?b=t[37]:(b=(0,Y.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[36]=n,t[37]=b);let x;t[38]!==i||t[39]!==c||t[40]!==b||t[41]!==y?(x=(0,Y.jsx)(`div`,{"data-slot":`sidebar-container`,"data-side":c,className:y,...i,children:b}),t[38]=i,t[39]=c,t[40]=b,t[41]=y,t[42]=x):x=t[42];let S;return t[43]!==c||t[44]!==f||t[45]!==x||t[46]!==m||t[47]!==_||t[48]!==l?(S=(0,Y.jsxs)(`div`,{className:`group peer hidden text-sidebar-foreground md:block`,"data-state":f,"data-collapsible":m,"data-variant":l,"data-side":c,"data-slot":`sidebar`,children:[_,x]}),t[43]=c,t[44]=f,t[45]=x,t[46]=m,t[47]=_,t[48]=l,t[49]=S):S=t[49],S}function ox(e){let t=(0,Z.c)(16),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,onClick:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let{toggleSidebar:a,state:o}=tx(),s=o===`expanded`,c;t[4]===n?c=t[5]:(c=W(n),t[4]=n,t[5]=c);let l;t[6]!==r||t[7]!==a?(l=e=>{r?.(e),a()},t[6]=r,t[7]=a,t[8]=l):l=t[8];let u,d;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Y.jsx)(Gi,{}),d=(0,Y.jsx)(`span`,{className:`sr-only`,children:`Toggle Sidebar`}),t[9]=u,t[10]=d):(u=t[9],d=t[10]);let f;return t[11]!==i||t[12]!==s||t[13]!==c||t[14]!==l?(f=(0,Y.jsxs)(K,{"data-sidebar":`trigger`,"data-slot":`sidebar-trigger`,variant:`ghost`,size:`icon-sm`,"aria-expanded":s,"aria-controls":$b,className:c,onClick:l,...i,children:[u,d]}),t[11]=i,t[12]=s,t[13]=c,t[14]=l,t[15]=f):f=t[15],f}function sx(e){let t=(0,Z.c)(21),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,onClick:i,onAnimationEnd:r,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let{isMobile:o,openMobile:s,setOpenMobile:c,showPushPulse:l,setShowPushPulse:u}=tx(),d;t[5]!==o||t[6]!==i||t[7]!==s||t[8]!==c?(d=e=>{i?.(e),!e.defaultPrevented&&(!o||!s||e.target?.closest(`[data-sidebar="trigger"]`)||c(!1))},t[5]=o,t[6]=i,t[7]=s,t[8]=c,t[9]=d):d=t[9];let f=d,p;t[10]!==r||t[11]!==u?(p=e=>{r?.(e),e.animationName===`sidebar-push-pulse`&&u(!1)},t[10]=r,t[11]=u,t[12]=p):p=t[12];let m=p,h=l?``:void 0,g;t[13]===n?g=t[14]:(g=W(`relative flex w-full flex-1 flex-col bg-background md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2`,`transition-transform duration-200 ease-linear motion-reduce:transition-none`,`peer-data-[mobile=true]:peer-data-[state=expanded]:translate-x-(--sidebar-width)`,n),t[13]=n,t[14]=g);let _;return t[15]!==m||t[16]!==f||t[17]!==a||t[18]!==h||t[19]!==g?(_=(0,Y.jsx)(`main`,{"data-slot":`sidebar-inset`,"data-push-pulse":h,onClick:f,onAnimationEnd:m,className:g,...a}),t[15]=m,t[16]=f,t[17]=a,t[18]=h,t[19]=g,t[20]=_):_=t[20],_}function cx(e){let t=(0,Z.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=W(`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,Y.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 lx(e){let t=(0,Z.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=W(`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,Y.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 ux(e){let t=(0,Z.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=W(`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,Y.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 dx(e){let t=(0,Z.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=W(`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,Y.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 fx(e){let t=(0,Z.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=W(`group/menu-item relative`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Y.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 px=B(`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 mx(e){let t=(0,Z.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?ne:`button`,{isMobile:m,state:h}=tx(),g;t[8]!==n||t[9]!==f||t[10]!==d?(g=W(px({variant:d,size:f}),n),t[8]=n,t[9]=f,t[10]=d,t[11]=g):g=t[11];let _;t[12]!==p||t[13]!==u||t[14]!==r||t[15]!==f||t[16]!==g?(_=(0,Y.jsx)(p,{"data-slot":`sidebar-menu-button`,"data-sidebar":`menu-button`,"data-size":f,"data-active":u,className:g,...r}),t[12]=p,t[13]=u,t[14]=r,t[15]=f,t[16]=g,t[17]=_):_=t[17];let v=_;if(!c)return v;if(typeof c==`string`){let e;t[18]===c?e=t[19]:(e={children:c},t[18]=c,t[19]=e),c=e}let y;t[20]===v?y=t[21]:(y=(0,Y.jsx)(nn,{asChild:!0,children:v}),t[20]=v,t[21]=y);let b=h!==`collapsed`||m,x;t[22]!==b||t[23]!==c?(x=(0,Y.jsx)(an,{side:`right`,align:`center`,hidden:b,...c}),t[22]=b,t[23]=c,t[24]=x):x=t[24];let S;return t[25]!==y||t[26]!==x?(S=(0,Y.jsxs)(ln,{children:[y,x]}),t[25]=y,t[26]=x,t[27]=S):S=t[27],S}function hx(e){let t=(0,Z.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,Y.jsx)(ul,{"data-slot":`popover`,...n}),t[2]=n,t[3]=r),r}function gx(e){let t=(0,Z.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,Y.jsx)(dl,{"data-slot":`popover-trigger`,...n}),t[2]=n,t[3]=r),r}function _x(e){let t=(0,Z.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,align:i,sideOffset:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?`center`:i,s=a===void 0?4:a,c;t[5]===n?c=t[6]:(c=W(`z-50 w-72 rounded-lg border bg-popover p-4 text-popover-foreground shadow-md outline-hidden data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 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`,n),t[5]=n,t[6]=c);let l;return t[7]!==o||t[8]!==r||t[9]!==s||t[10]!==c?(l=(0,Y.jsx)(fl,{children:(0,Y.jsx)(pl,{"data-slot":`popover-content`,align:o,sideOffset:s,className:c,...r})}),t[7]=o,t[8]=r,t[9]=s,t[10]=c,t[11]=l):l=t[11],l}var vx=1e3,yx=!1;function bx(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)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 xx(e,t,n){let r=(0,Z.c)(9),i;r[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={current:[],crossDoc:[]},r[0]=i):i=r[0];let[a,o]=(0,X.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:be(i)?a=i:(a=void 0,yx||(yx=!0,console.warn(`[agent-presence] __system__ provider awareness missing getStates() — presence bar will render without agent peers`)));let s=()=>{let e=[];if(r)for(let[t,n]of r.getStates().entries()){let r=n;if(!r.user||typeof r.user!=`object`)continue;let i=r.user;i.type===`human`&&e.push({kind:`human`,clientId:t,user:i,mode:r.mode??`wysiwyg`})}let{current:t,crossDoc:i}=a?he(a,n,Date.now()):{current:[],crossDoc:[]},s=Sx,c=t.map(s),l=i.map(s),u=[...e,...c],d=l;o(e=>bx(e.current,u)&&bx(e.crossDoc,d)?e:{current:u,crossDoc:d})};s();let c=()=>s(),l=()=>s();r?.on(`change`,c),t?.awareness?.on(`change`,l);let u=setInterval(s,vx);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,X.useEffect)(s,c),a}function Sx(e){let{agentId:t,entry:n}=e;return{kind:`agent`,agentId:t,presence:n}}function Cx(e){let t=(0,Z.c)(3),[n,r]=(0,X.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`?wx: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,X.useEffect)(i,a),n}function wx(e){return e===`synced`?`synced`:`connected`}var Tx=`sync-status`;function Ex(e,t){let n=(0,Z.c)(4),r=(0,X.useRef)(!1),i=(0,X.useRef)(!1),a=(0,X.useRef)(t),o,s;n[0]!==t||n[1]!==e?(o=()=>{a.current!==t&&(a.current=t,r.current=!1,i.current=!1),t&&(e===`synced`&&(r.current=!0),e===`disconnected`&&r.current?(i.current=!0,At.warning(`Connection lost — keep this tab open, your edits will sync when reconnected`,{id:Tx,duration:1/0})):i.current&&e===`synced`&&(i.current=!1,At.success(`Reconnected`,{id:Tx,duration:3e3})))},s=[e,t],n[0]=t,n[1]=e,n[2]=o,n[3]=s):(o=n[2],s=n[3]),(0,X.useEffect)(o,s)}var Dx=4,Ox=3,kx={Bird:$r,Cat:oi,Dog:xi,Fish:Ti,Mouse:$i,Rabbit:Qi,Shrimp:ia,Snail:aa,Squirrel:ca,Turtle:fa},Ax={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`,bot:`Agent`};function jx(e){let t=(0,Z.c)(20),{user:n,mode:r}=e,i=n.name.split(` `)[1],a=i?kx[i]:void 0,o;t[0]===n.name?o=t[1]:(o=n.name.split(` `).map(Mx).join(``),t[0]=n.name,t[1]=o);let s=o,c;t[2]===n.color?c=t[3]:(c=Cn(n.color),t[2]=n.color,t[3]=c);let l=c,u;t[4]===n.color?u=t[5]:(u={backgroundColor:n.color},t[4]=n.color,t[5]=u);let d;t[6]!==a||t[7]!==l||t[8]!==s?(d=a?(0,Y.jsx)(a,{size:18,color:l,strokeWidth:1.5}):(0,Y.jsx)(`span`,{className:`font-mono text-2xs font-semibold leading-none`,style:{color:l},children:s}),t[6]=a,t[7]=l,t[8]=s,t[9]=d):d=t[9];let f;t[10]!==r||t[11]!==u||t[12]!==d||t[13]!==n.name?(f=(0,Y.jsx)(nn,{asChild:!0,children:(0,Y.jsx)(`div`,{"data-presence-badge":`human`,"data-presence-mode":r,role:`img`,"aria-label":n.name,className:`inline-flex size-7 shrink-0 cursor-default items-center justify-center rounded-full ring-2 ring-background`,style:u,children:d})}),t[10]=r,t[11]=u,t[12]=d,t[13]=n.name,t[14]=f):f=t[14];let p;t[15]===n.name?p=t[16]:(p=(0,Y.jsx)(an,{children:n.name}),t[15]=n.name,t[16]=p);let m;return t[17]!==f||t[18]!==p?(m=(0,Y.jsxs)(ln,{children:[f,p]}),t[17]=f,t[18]=p,t[19]=m):m=t[19],m}function Mx(e){return e[0]}function Nx(e){let t=Ax[e.icon];return e.displayName||t||`Agent`}function Px(e){let t=(0,Z.c)(3),[n,r]=(0,X.useState)(e===`writing`),i=(0,X.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,X.useEffect)(a,o),n}function Fx(e){let t=(0,Z.c)(36),{participant:n,crossDoc:r,scoped:i,onClickAgent:a}=e,{presence:o,agentId:s}=n,c;t[0]===o?c=t[1]:(c=Nx(o),t[0]=o,t[1]=c);let l=c,u=Px(o.mode),d=!r&&u,f=i?`ring-primary ring-offset-2 ring-offset-background`:`ring-background`,p=d&&!i?`ring-primary/40 animate-pulse`:``,m;t[2]!==f||t[3]!==p?(m=[`inline-flex size-7 shrink-0 items-center justify-center rounded-full ring-2 cursor-pointer`,f,p].filter(Boolean),t[2]=f,t[3]=p,t[4]=m):m=t[4];let h=m.join(` `),g=r?`true`:void 0,_=i?`true`:void 0,v;t[5]!==o.mode||t[6]!==g||t[7]!==_?(v={"data-presence-badge":`agent`,"data-presence-mode":o.mode,"data-presence-crossdoc":g,"data-presence-scoped":_},t[5]=o.mode,t[6]=g,t[7]=_,t[8]=v):v=t[8];let y=v,b=r&&o.currentDoc?`Open activity panel for ${l}, editing ${o.currentDoc}`:`Open activity panel for ${l}`,x;t[9]===o.color?x=t[10]:(x={backgroundColor:o.color},t[9]=o.color,t[10]=x);let S;t[11]!==s||t[12]!==a?(S=()=>a(s),t[11]=s,t[12]=a,t[13]=S):S=t[13];let C;t[14]===o.icon?C=t[15]:(C=(0,Y.jsx)(ve,{icon:o.icon,width:16,height:16,className:`text-white`}),t[14]=o.icon,t[15]=C);let w;t[16]!==b||t[17]!==y||t[18]!==h||t[19]!==C||t[20]!==x||t[21]!==S?(w=(0,Y.jsx)(`button`,{type:`button`,...y,"aria-label":b,className:h,style:x,onClick:S,children:C}),t[16]=b,t[17]=y,t[18]=h,t[19]=C,t[20]=x,t[21]=S,t[22]=w):w=t[22];let T=w,E;t[23]===T?E=t[24]:(E=(0,Y.jsx)(nn,{asChild:!0,children:T}),t[23]=T,t[24]=E);let D;t[25]===l?D=t[26]:(D=(0,Y.jsx)(`span`,{className:`font-medium`,children:l}),t[25]=l,t[26]=D);let O;t[27]!==r||t[28]!==o.currentDoc?(O=r&&o.currentDoc?(0,Y.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`editing [[`,o.currentDoc,`]]`]}):null,t[27]=r,t[28]=o.currentDoc,t[29]=O):O=t[29];let k;t[30]!==D||t[31]!==O?(k=(0,Y.jsxs)(an,{className:`flex flex-col gap-0.5`,children:[D,O]}),t[30]=D,t[31]=O,t[32]=k):k=t[32];let A;return t[33]!==E||t[34]!==k?(A=(0,Y.jsxs)(ln,{children:[E,k]}),t[33]=E,t[34]=k,t[35]=A):A=t[35],A}function Ix(e){let t=(0,Z.c)(18),{count:n,remainder:r,crossDoc:i,scopedAgentId:a,onClickAgent:o}=e,s=i?`true`:void 0,c=`${n} more ${i?`cross-doc `:``}${n===1?`participant`:`participants`}`,l;t[0]!==n||t[1]!==s||t[2]!==c?(l=(0,Y.jsx)(gx,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`presence-overflow`,"data-presence-crossdoc":s,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[0]=n,t[1]=s,t[2]=c,t[3]=l):l=t[3];let u;if(t[4]!==i||t[5]!==o||t[6]!==r||t[7]!==a){let e;t[9]!==i||t[10]!==o||t[11]!==a?(e=e=>e.kind===`human`?(0,Y.jsx)(jx,{user:e.user,mode:e.mode},e.clientId):(0,Y.jsx)(Fx,{participant:e,crossDoc:i,scoped:a===e.agentId,onClickAgent:o},e.agentId),t[9]=i,t[10]=o,t[11]=a,t[12]=e):e=t[12],u=r.map(e),t[4]=i,t[5]=o,t[6]=r,t[7]=a,t[8]=u}else u=t[8];let d;t[13]===u?d=t[14]:(d=(0,Y.jsx)(_x,{align:`end`,className:`w-auto max-w-xs p-2`,children:(0,Y.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:u})}),t[13]=u,t[14]=d);let f;return t[15]!==l||t[16]!==d?(f=(0,Y.jsxs)(hx,{children:[l,d]}),t[15]=l,t[16]=d,t[17]=f):f=t[17],f}function Lx(e,t,n,r){return e.kind===`human`?(0,Y.jsx)(jx,{user:e.user,mode:e.mode},e.clientId):(0,Y.jsx)(Fx,{participant:e,crossDoc:n,scoped:r===e.agentId,onClickAgent:t},e.agentId)}function Rx(){let e=(0,Z.c)(20),{activeProvider:t,activeDocName:n,systemProvider:r,openActivityPanel:i,docPanelMode:a,docPanelAgentId:o}=ut(),{current:s,crossDoc:c}=xx(t,r,n);Ex(Cx(t),n);let l;if(e[0]!==c||e[1]!==s||e[2]!==o||e[3]!==a||e[4]!==i){let t=s.slice(0,Dx),n;e[6]===s?n=e[7]:(n=s.slice(Dx),e[6]=s,e[7]=n);let r=n,u=c.slice(0,Ox),d;e[8]===c?d=e[9]:(d=c.slice(Ox),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=>Lx(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,Y.jsx)(Ix,{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,Y.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,Y.jsxs)(`div`,{"data-slot":`presence-bar`,className:`flex items-center px-1 py-1.5`,children:[v,c.length>0?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`div`,{className:`mx-2 h-4 w-px bg-border`,"aria-hidden":!0,"data-slot":`presence-divider`}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5 opacity-60 grayscale`,"data-presence-section":`crossdoc`,children:[u.map(e=>Lx(e,p,!0,m)),f.length>0?(0,Y.jsx)(Ix,{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 zx=`npx @inkeep/open-knowledge install-skill`,Bx=`https://inkeep.github.io/open-knowledge/guides/install-claude-cowork`;function Vx(){return typeof window<`u`&&typeof window.okDesktop?.skill==`object`}function Hx(){let e=(0,Z.c)(12),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Y.jsx)(`p`,{className:`mb-2 font-medium text-foreground`,children:`Then in the Claude Desktop App, upload the file:`}),e[0]=t):t=e[0];let n;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Y.jsx)(`strong`,{children:`Customize`}),e[1]=n):n=e[1];let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Y.jsxs)(`li`,{children:[`Open `,n,` (sidebar) → `,(0,Y.jsx)(`strong`,{children:`Skills`}),`.`]}),e[2]=r):r=e[2];let i;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Y.jsxs)(`li`,{children:[`Click the `,(0,Y.jsx)(`strong`,{children:`+`}),` button.`]}),e[3]=i):i=e[3];let a;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Y.jsxs)(`li`,{children:[`Click `,(0,Y.jsx)(`strong`,{children:`Create skill`}),`.`]}),e[4]=a):a=e[4];let o;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Y.jsxs)(`li`,{children:[`Click `,(0,Y.jsx)(`strong`,{children:`Upload skill`}),`.`]}),e[5]=o):o=e[5];let s;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Y.jsx)(`code`,{children:`openknowledge.skill`}),e[6]=s):s=e[6];let c;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Y.jsxs)(`ol`,{className:`ml-4 list-decimal space-y-1 text-foreground`,children:[r,i,a,o,(0,Y.jsxs)(`li`,{children:[`Pick `,s,` from your `,(0,Y.jsx)(`strong`,{children:`Downloads`}),` folder.`]})]}),e[7]=c):c=e[7];let l;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Y.jsx)(`strong`,{className:`text-foreground`,children:`Claude Chat`}),e[8]=l):l=e[8];let u;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Y.jsxs)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:[`The skill toggles on by default. Use it in any`,` `,l,` or`,` `,(0,Y.jsx)(`strong`,{className:`text-foreground`,children:`Claude Cowork`}),` session — ask Claude to "use the open-knowledge skill".`]}),e[9]=u):u=e[9];let d;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Y.jsx)(`strong`,{children:`Customize → Skills`}),e[10]=d):d=e[10];let f;return e[11]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Y.jsxs)(`div`,{className:`rounded-md border border-primary/30 bg-primary/5 px-3 py-2 text-sm`,children:[t,c,u,(0,Y.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[`If `,d,` isn't visible, enable`,` `,(0,Y.jsx)(`strong`,{className:`text-foreground`,children:`Settings → Capabilities → Code execution and file creation`}),` `,`first.`]})]}),e[11]=f):f=e[11],f}function Ux(e){let t=(0,Z.c)(61),{open:n,onOpenChange:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={kind:`idle`},t[0]=i):i=t[0];let[a,o]=(0,X.useState)(i),[s,c]=(0,X.useState)(!1),l,u;t[1]===n?(l=t[2],u=t[3]):(l=()=>{n||(o({kind:`idle`}),c(!1))},u=[n],t[1]=n,t[2]=l,t[3]=u),(0,X.useEffect)(l,u);let d;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(d=async function(){o({kind:`downloading`});let e=window.okDesktop?.skill;if(!e){o({kind:`error`,message:`Electron bridge unavailable. Refresh and try again.`});return}let t=await e.buildAndOpen();if(t.ok)o({kind:`handed-off`,path:t.path});else{let e=t.message??t.reason;At.error(`Install handoff failed: ${e}`),o({kind:`error`,message:t.reason===`open-failed`?`The Claude Desktop App didn't open the file. Is it installed? (${e})`:`${t.reason}: ${e}`})}},t[4]=d):d=t[4];let f=d,p;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(p=async function(){try{await navigator.clipboard.writeText(zx),c(!0),setTimeout(()=>c(!1),2e3)}catch(e){let t=e;At.error(`Couldn't copy: ${t instanceof Error?t.message:String(t)}`)}},t[5]=p):p=t[5];let m=p,h;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(h=Vx(),t[6]=h):h=t[6];let g=h,_;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Y.jsxs)(qt,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(Si,{"aria-hidden":`true`,className:`h-4 w-4`}),`Install for Claude Chat & Cowork`]}),t[7]=_):_=t[7];let v;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Y.jsx)(`strong`,{children:`Claude Desktop App`}),t[8]=v):v=t[8];let y;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Y.jsx)(`code`,{children:`ok init`}),t[9]=y):y=t[9];let b;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Y.jsx)(`code`,{children:`npx skills add`}),t[10]=b):b=t[10];let x;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Y.jsxs)(Wt,{children:[_,(0,Y.jsxs)(Bt,{children:[`Adds the Open Knowledge skill to the `,v,` so it's available in Claude Chat and Claude Cowork modes. (Claude Code users: no action needed —`,` `,y,` already installed it via `,b,`.)`,` `,(0,Y.jsxs)(`a`,{href:Bx,className:`underline`,target:`_blank`,rel:`noopener noreferrer`,children:[`Full guide `,(0,Y.jsx)(Tt,{"aria-hidden":`true`,className:`inline h-3 w-3`})]})]})]}),t[11]=x):x=t[11];let S;t[12]===a.kind?S=t[13]:(S=a.kind===`idle`&&g&&(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3 text-sm`,children:[(0,Y.jsx)(`p`,{className:`font-medium`,children:`Here's what will happen when you click Install:`}),(0,Y.jsxs)(`ol`,{className:`ml-4 list-decimal space-y-1.5`,children:[(0,Y.jsxs)(`li`,{children:[`We build `,(0,Y.jsx)(`code`,{children:`openknowledge.skill`}),` from the bundled skill content.`]}),(0,Y.jsxs)(`li`,{children:[`The file saves to `,(0,Y.jsx)(`code`,{children:`~/Downloads/openknowledge.skill`}),`.`]}),(0,Y.jsxs)(`li`,{children:[`We open the `,(0,Y.jsx)(`strong`,{children:`Claude Desktop App`}),` for you.`]})]}),(0,Y.jsx)(Hx,{})]}),t[12]=a.kind,t[13]=S);let C;t[14]!==s||t[15]!==a.kind?(C=a.kind===`idle`&&!g&&(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3 text-sm`,children:[(0,Y.jsx)(`p`,{className:`font-medium`,children:`Here's what to do:`}),(0,Y.jsxs)(`ol`,{className:`ml-4 list-decimal space-y-2`,children:[(0,Y.jsxs)(`li`,{children:[(0,Y.jsx)(`span`,{children:`Copy this command:`}),(0,Y.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 rounded-md border bg-muted/40 p-2`,children:[(0,Y.jsx)(`code`,{className:`flex-1 font-mono text-xs`,children:zx}),(0,Y.jsx)(K,{variant:`ghost`,size:`sm`,onClick:m,"aria-label":`Copy command`,className:`h-7 gap-1`,children:s?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(we,{"aria-hidden":`true`,className:`h-3 w-3`}),`Copied`]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(_i,{"aria-hidden":`true`,className:`h-3 w-3`}),`Copy`]})})]})]}),(0,Y.jsxs)(`li`,{children:[`Paste + run it in your terminal. You'll see`,` `,(0,Y.jsx)(`code`,{children:`Built ~/Downloads/openknowledge.skill`}),` — that means the file is ready. The `,(0,Y.jsx)(`strong`,{children:`Claude Desktop App`}),` opens automatically.`]})]}),(0,Y.jsx)(Hx,{}),(0,Y.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[(0,Y.jsx)(`strong`,{className:`text-foreground`,children:`Requires:`}),` Node.js or Bun on your PATH.`,` `,(0,Y.jsx)(`code`,{children:`npx`}),` fetches and runs the CLI — no separate install.`]})]}),t[14]=s,t[15]=a.kind,t[16]=C):C=t[16];let w;t[17]===a.kind?w=t[18]:(w=a.kind===`downloading`&&(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,Y.jsx)(Ye,{"aria-hidden":`true`,className:`h-4 w-4 animate-spin`}),`Building `,(0,Y.jsx)(`code`,{children:`openknowledge.skill`}),` and opening the Claude Desktop App…`]}),t[17]=a.kind,t[18]=w);let T;t[19]!==a.kind||t[20]!==a.path?(T=a.kind===`handed-off`&&g&&(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3 text-sm`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-primary/30 bg-primary/5 px-3 py-2`,children:[(0,Y.jsx)(we,{"aria-hidden":`true`,className:`mt-0.5 h-4 w-4 text-primary`}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-foreground`,children:`File saved & Claude Desktop App opened`}),a.path?(0,Y.jsx)(`code`,{className:`text-xs text-muted-foreground`,children:a.path}):(0,Y.jsx)(`code`,{className:`text-xs text-muted-foreground`,children:`~/Downloads/openknowledge.skill`})]})]}),(0,Y.jsx)(Hx,{})]}),t[19]=a.kind,t[20]=a.path,t[21]=T):T=t[21];let E;t[22]===a.kind?E=t[23]:(E=a.kind===`handed-off`&&!g&&(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3 text-sm`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-primary/30 bg-primary/5 px-3 py-2`,children:[(0,Y.jsx)(we,{"aria-hidden":`true`,className:`mt-0.5 h-4 w-4 text-primary`}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-foreground`,children:`Download started`}),(0,Y.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`File saves to `,(0,Y.jsx)(`code`,{children:`~/Downloads/openknowledge.skill`}),`.`]})]})]}),(0,Y.jsx)(Hx,{})]}),t[22]=a.kind,t[23]=E);let D;t[24]!==a.kind||t[25]!==a.message?(D=a.kind===`error`&&(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2 text-sm`,children:[(0,Y.jsx)(`span`,{className:`text-destructive`,children:a.message}),(0,Y.jsx)(`a`,{href:Bx,target:`_blank`,rel:`noopener noreferrer`,className:`text-xs underline`,children:`See the full install guide`})]}),t[24]=a.kind,t[25]=a.message,t[26]=D):D=t[26];let O;t[27]!==S||t[28]!==C||t[29]!==w||t[30]!==T||t[31]!==E||t[32]!==D?(O=(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3 py-2`,children:[S,C,w,T,E,D]}),t[27]=S,t[28]=C,t[29]=w,t[30]=T,t[31]=E,t[32]=D,t[33]=O):O=t[33];let k;t[34]!==r||t[35]!==a.kind?(k=a.kind===`idle`&&g&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(K,{variant:`ghost`,onClick:()=>r(!1),children:`Cancel`}),(0,Y.jsxs)(K,{onClick:f,children:[(0,Y.jsx)(Si,{"aria-hidden":`true`,className:`mr-2 h-4 w-4`}),`Install`]})]}),t[34]=r,t[35]=a.kind,t[36]=k):k=t[36];let A;t[37]!==r||t[38]!==a.kind?(A=a.kind===`idle`&&!g&&(0,Y.jsx)(K,{variant:`ghost`,onClick:()=>r(!1),children:`Close`}),t[37]=r,t[38]=a.kind,t[39]=A):A=t[39];let j;t[40]!==r||t[41]!==a.kind?(j=a.kind===`error`&&g&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(K,{variant:`ghost`,onClick:()=>r(!1),children:`Cancel`}),(0,Y.jsxs)(K,{onClick:f,children:[(0,Y.jsx)(Si,{"aria-hidden":`true`,className:`mr-2 h-4 w-4`}),`Try again`]})]}),t[40]=r,t[41]=a.kind,t[42]=j):j=t[42];let M;t[43]===a.kind?M=t[44]:(M=a.kind===`downloading`&&(0,Y.jsxs)(K,{disabled:!0,children:[(0,Y.jsx)(Ye,{"aria-hidden":`true`,className:`mr-2 h-4 w-4 animate-spin`}),`Installing…`]}),t[43]=a.kind,t[44]=M);let N;t[45]!==r||t[46]!==a.kind?(N=a.kind===`handed-off`&&(0,Y.jsx)(K,{onClick:()=>r(!1),children:`Done`}),t[45]=r,t[46]=a.kind,t[47]=N):N=t[47];let P;t[48]!==k||t[49]!==A||t[50]!==j||t[51]!==M||t[52]!==N?(P=(0,Y.jsxs)(Nt,{children:[k,A,j,M,N]}),t[48]=k,t[49]=A,t[50]=j,t[51]=M,t[52]=N,t[53]=P):P=t[53];let F;t[54]!==O||t[55]!==P?(F=(0,Y.jsxs)(Kt,{className:`sm:max-w-lg`,"data-ok-layer-spawned":``,children:[x,O,P]}),t[54]=O,t[55]=P,t[56]=F):F=t[56];let I;return t[57]!==r||t[58]!==n||t[59]!==F?(I=(0,Y.jsx)(Jt,{open:n,onOpenChange:r,children:F}),t[57]=r,t[58]=n,t[59]=F,t[60]=I):I=t[60],I}function Wx(e){let t=(0,Z.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Y.jsx)(`title`,{children:`LinkedIn`}),r=(0,Y.jsx)(`path`,{d:`M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,Y.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 Gx(e){let t=(0,Z.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Y.jsx)(`title`,{children:`X (Twitter)`}),r=(0,Y.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,Y.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 Kx=[{label:`Documentation`,href:`https://openknowledge.ai/docs`,icon:ti},{label:`Homepage`,href:`https://openknowledge.ai/`,icon:Ne},{label:`Twitter / X`,href:`https://x.com/inkeep`,icon:Gx},{label:`LinkedIn`,href:`https://www.linkedin.com/company/inkeep/`,icon:Wx}],qx=()=>{let e=(0,Z.c)(13),[t,n]=(0,X.useState)(!1),[r,i]=(0,X.useState)(!1),a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Y.jsxs)(ln,{children:[(0,Y.jsx)(nn,{asChild:!0,children:(0,Y.jsx)(gx,{asChild:!0,children:(0,Y.jsxs)(K,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,children:[(0,Y.jsx)(li,{className:`size-4`}),(0,Y.jsx)(`span`,{className:`sr-only`,children:`Help & resources`})]})})}),(0,Y.jsx)(an,{children:`Help & resources`})]}),e[0]=a):a=e[0];let o;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Y.jsx)(`p`,{className:`text-sm font-medium mb-2`,children:`Setup`}),e[1]=o):o=e[1];let s;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{i(!1),n(!0)},e[2]=s):s=e[2];let c,l;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Y.jsx)(`ul`,{className:`mb-3 space-y-0.5`,children:(0,Y.jsx)(`li`,{children:(0,Y.jsxs)(`button`,{type:`button`,onClick:s,className:`flex w-full items-center gap-2.5 rounded-md px-2 py-1.5 text-left text-sm text-muted-foreground transition-colors hover:bg-azure-900/5 dark:hover:bg-white/20 hover:text-primary`,children:[(0,Y.jsx)(Si,{"aria-hidden":`true`,className:`size-4 shrink-0`}),(0,Y.jsx)(`span`,{children:`Install for Claude Chat & Cowork…`})]})})}),l=(0,Y.jsx)(`p`,{className:`text-sm font-medium mb-2`,children:`Resources`}),e[3]=c,e[4]=l):(c=e[3],l=e[4]);let u;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Y.jsxs)(_x,{align:`end`,className:`w-64 p-3`,children:[o,c,l,(0,Y.jsx)(`nav`,{"aria-label":`Help and resources`,children:(0,Y.jsx)(`ul`,{className:`space-y-0.5`,children:Kx.map(Jx)})})]}),e[5]=u):u=e[5];let d;e[6]===r?d=e[7]:(d=(0,Y.jsxs)(hx,{open:r,onOpenChange:i,children:[a,u]}),e[6]=r,e[7]=d);let f;e[8]===t?f=e[9]:(f=(0,Y.jsx)(Ux,{open:t,onOpenChange:n}),e[8]=t,e[9]=f);let p;return e[10]!==d||e[11]!==f?(p=(0,Y.jsxs)(Y.Fragment,{children:[d,f]}),e[10]=d,e[11]=f,e[12]=p):p=e[12],p};function Jx(e){let{label:t,href:n,icon:r}=e;return(0,Y.jsx)(`li`,{children:(0,Y.jsxs)(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,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,Y.jsx)(r,{"aria-hidden":`true`,className:`size-4 shrink-0`}),t]})},n)}function Yx(e){let t=(0,Z.c)(9),n,r;if(t[0]===e?(n=t[1],r=t[2]):({id:n,...r}=e,t[0]=e,t[1]=n,t[2]=r),n===`claude-cowork`||n===`claude-code`){let e;return t[3]===r?e=t[4]:(e=(0,Y.jsx)(me,{...r}),t[3]=r,t[4]=e),e}if(n===`codex`){let e;return t[5]===r?e=t[6]:(e=(0,Y.jsx)(ye,{...r}),t[5]=r,t[6]=e),e}if(n===`cursor`){let e;return t[7]===r?e=t[8]:(e=(0,Y.jsx)(le,{...r}),t[7]=r,t[8]=e),e}return null}var Xx=`https://github.com/inkeep/open-knowledge/releases`;function Zx(e){let{target:t,installState:n,isElectronHost:r}=e;return t.id===`cursor`&&!r?`Desktop only`:n.installed===null?`Detecting…`:n.installed===!1?`Not installed`:null}function Qx(e){let{target:t,installState:n,isElectronHost:r}=e;if(t.id===`cursor`&&!r)return{enabled:!1,tooltip:{message:`Cursor handoff requires the desktop build.`,installAction:{label:`Install the Open Knowledge desktop app →`,url:Xx}}};if(n.installed===null)return{enabled:!1,tooltip:null};if(n.installed===!1){let e=t.appBrandName??t.displayName;return{enabled:!1,tooltip:{message:`Requires ${e}.`,installAction:{label:`Install ${e} →`,url:t.installUrl},...t.hasWebFallback?{webFallback:{label:`Open in claude.ai →`,url:``}}:{}}}}return{enabled:!0,tooltip:null}}function $x(e){return mn(e)}function eS(e){return`Opened ${e} in your browser.`}function tS(e){let t=(0,Z.c)(73),{target:n,installState:r,isElectronHost:i,prompt:a,onSelect:o}=e,s=e.openExternal??Pd,c=e.onWebFallbackSuccess??rS,l=e.onWebFallbackError??nS,u;t[0]!==r||t[1]!==i||t[2]!==n?(u=Qx({target:n,installState:r,isElectronHost:i}),t[0]=r,t[1]=i,t[2]=n,t[3]=u):u=t[3];let d=u,f;t[4]!==r||t[5]!==i||t[6]!==n?(f=Zx({target:n,installState:r,isElectronHost:i}),t[4]=r,t[5]=i,t[6]=n,t[7]=f):f=t[7];let p=f,m;t[8]!==s||t[9]!==d.tooltip?(m=()=>{d.tooltip&&s(d.tooltip.installAction.url)},t[8]=s,t[9]=d.tooltip,t[10]=m):m=t[10];let h=m,g;t[11]!==l||t[12]!==c||t[13]!==s||t[14]!==a||t[15]!==n?(g=()=>{(async()=>{let e=await s($x(a));e.ok?c(n):l(n,e.detail??e.reason)})()},t[11]=l,t[12]=c,t[13]=s,t[14]=a,t[15]=n,t[16]=g):g=t[16];let _=g;if(d.enabled){let e=`open-in-agent-item-${n.id}`,r=`Open in ${n.displayName}`,i;t[17]===n.id?i=t[18]:(i=(0,Y.jsx)(Yx,{id:n.id,"aria-hidden":`true`}),t[17]=n.id,t[18]=i);let a;t[19]===n.displayName?a=t[20]:(a=(0,Y.jsx)(`span`,{children:n.displayName}),t[19]=n.displayName,t[20]=a);let s;return t[21]!==o||t[22]!==e||t[23]!==r||t[24]!==i||t[25]!==a?(s=(0,Y.jsxs)(z_,{onSelect:o,"data-testid":e,"aria-label":r,children:[i,a]}),t[21]=o,t[22]=e,t[23]=r,t[24]=i,t[25]=a,t[26]=s):s=t[26],s}if(!d.tooltip){let e=p?`Open in ${n.displayName}, ${p}`:`Open in ${n.displayName}`,r=`open-in-agent-item-${n.id}`,i;t[27]===n.id?i=t[28]:(i=(0,Y.jsx)(Yx,{id:n.id,"aria-hidden":`true`}),t[27]=n.id,t[28]=i);let a;t[29]===n.displayName?a=t[30]:(a=(0,Y.jsx)(`span`,{className:`flex-1`,children:n.displayName}),t[29]=n.displayName,t[30]=a);let o;t[31]===p?o=t[32]:(o=p?(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:p}):null,t[31]=p,t[32]=o);let s;return t[33]!==e||t[34]!==r||t[35]!==i||t[36]!==a||t[37]!==o?(s=(0,Y.jsxs)(z_,{disabled:!0,"data-testid":r,"aria-label":e,children:[i,a,o]}),t[33]=e,t[34]=r,t[35]=i,t[36]=a,t[37]=o,t[38]=s):s=t[38],s}let v=p?`Open in ${n.displayName}, ${p}`:`Open in ${n.displayName}`,y=`open-in-agent-item-${n.id}`,b;t[39]===n.id?b=t[40]:(b=(0,Y.jsx)(Yx,{id:n.id,"aria-hidden":`true`,className:`mr-2`}),t[39]=n.id,t[40]=b);let x;t[41]===n.displayName?x=t[42]:(x=(0,Y.jsx)(`span`,{className:`flex-1`,children:n.displayName}),t[41]=n.displayName,t[42]=x);let S;t[43]===p?S=t[44]:(S=p?(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:p}):null,t[43]=p,t[44]=S);let C;t[45]!==v||t[46]!==y||t[47]!==b||t[48]!==x||t[49]!==S?(C=(0,Y.jsxs)(G_,{"data-testid":y,"data-row-disabled":``,"aria-label":v,children:[b,x,S]}),t[45]=v,t[46]=y,t[47]=b,t[48]=x,t[49]=S,t[50]=C):C=t[50];let w=`open-in-agent-submenu-${n.id}`,T=`open-in-agent-message-${n.id}`,E;t[51]!==d.tooltip.message||t[52]!==T?(E=(0,Y.jsx)(H_,{className:`font-normal text-muted-foreground text-xs`,"data-testid":T,children:d.tooltip.message}),t[51]=d.tooltip.message,t[52]=T,t[53]=E):E=t[53];let D;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Y.jsx)(U_,{}),t[54]=D):D=t[54];let O=`open-in-agent-install-${n.id}`,k;t[55]===d.tooltip.installAction.label?k=t[56]:(k=(0,Y.jsx)(`span`,{children:d.tooltip.installAction.label}),t[55]=d.tooltip.installAction.label,t[56]=k);let A;t[57]!==h||t[58]!==O||t[59]!==k?(A=(0,Y.jsx)(z_,{onSelect:h,"data-testid":O,children:k}),t[57]=h,t[58]=O,t[59]=k,t[60]=A):A=t[60];let j;t[61]!==_||t[62]!==d.tooltip.webFallback||t[63]!==n.id?(j=d.tooltip.webFallback?(0,Y.jsxs)(z_,{onSelect:_,"data-testid":`open-in-agent-web-fallback-${n.id}`,"aria-label":`${d.tooltip.webFallback.label}, opens in browser with prompt pre-filled`,children:[(0,Y.jsx)(`span`,{className:`flex-1`,children:d.tooltip.webFallback.label}),(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:`opens in browser with prompt pre-filled`})]}):null,t[61]=_,t[62]=d.tooltip.webFallback,t[63]=n.id,t[64]=j):j=t[64];let M;t[65]!==E||t[66]!==A||t[67]!==j||t[68]!==w?(M=(0,Y.jsxs)(K_,{className:`min-w-[260px]`,"data-testid":w,children:[E,D,A,j]}),t[65]=E,t[66]=A,t[67]=j,t[68]=w,t[69]=M):M=t[69];let N;return t[70]!==M||t[71]!==C?(N=(0,Y.jsxs)(W_,{children:[C,M]}),t[70]=M,t[71]=C,t[72]=N):N=t[72],N}function nS(){}function rS(){}function iS(e){let t=(0,Z.c)(25),{input:n}=e,{states:r,refresh:i}=ff(),{dispatch:a}=ef(),[o,s]=(0,X.useState)(!1),c=typeof window<`u`&&window.okDesktop!=null,l=oS,u=aS,d;t[0]===i?d=t[1]:(d=e=>{s(e),e&&i()},t[0]=i,t[1]=d);let f=d,p=n===null,m;t[2]===n?m=t[3]:(m=n===null?``:yn(n.docContext),t[2]=n,t[3]=m);let h=m,g;t[4]!==a||t[5]!==n?(g=e=>{n!==null&&a(e.id,n)},t[4]=a,t[5]=n,t[6]=g):g=t[6];let _=g,v;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Y.jsx)(xe,{className:`size-4`}),t[7]=v):v=t[7];let y;t[8]===p?y=t[9]:(y=(0,Y.jsx)(nn,{asChild:!0,children:(0,Y.jsx)(L_,{asChild:!0,children:(0,Y.jsx)(K,{variant:`ghost`,size:`icon-sm`,"aria-label":`Edit with AI`,disabled:p,className:`text-muted-foreground`,"data-testid":`open-in-agent-trigger`,children:v})})}),t[8]=p,t[9]=y);let b;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Y.jsx)(an,{children:`Edit with AI`}),t[10]=b):b=t[10];let x;t[11]===y?x=t[12]:(x=(0,Y.jsxs)(ln,{children:[y,b]}),t[11]=y,t[12]=x);let S;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Y.jsx)(H_,{className:`font-mono font-normal tracking-wide uppercase text-muted-foreground text-xs`,children:`Open in…`}),t[13]=S):S=t[13];let C;t[14]!==_||t[15]!==h||t[16]!==r?(C=Od.map(e=>{let t=r[e.id];return(0,Y.jsx)(tS,{target:e,installState:t,isElectronHost:c,prompt:h,onSelect:()=>_(e),onWebFallbackSuccess:l,onWebFallbackError:u},e.id)}),t[14]=_,t[15]=h,t[16]=r,t[17]=C):C=t[17];let w;t[18]===C?w=t[19]:(w=(0,Y.jsxs)(R_,{align:`end`,className:`min-w-[220px]`,"data-testid":`open-in-agent-menu`,children:[S,C]}),t[18]=C,t[19]=w);let T;return t[20]!==f||t[21]!==o||t[22]!==w||t[23]!==x?(T=(0,Y.jsxs)(I_,{open:o,onOpenChange:f,children:[x,w]}),t[20]=f,t[21]=o,t[22]=w,t[23]=x,t[24]=T):T=t[24],T}function aS(e){At.error(`Couldn't open ${e.displayName} in your browser.`)}function oS(e){At.success(eS(e.displayName))}var sS={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`},cS=e=>{let t=(0,Z.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,Y.jsx)(`svg`,{"aria-hidden":`true`,...sS,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},lS=e=>{let t=(0,Z.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Y.jsx)(`title`,{children:`Markdown`}),r=(0,Y.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,Y.jsxs)(cS,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i},uS=e=>{let t=(0,Z.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Y.jsx)(`title`,{children:`Textbox`}),r=(0,Y.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,Y.jsxs)(cS,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i};function dS(e){let t=(0,Z.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,size: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?o=t[5]:(o=W(`peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50`,n),t[4]=n,t[5]=o);let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Y.jsx)(Ml,{"data-slot":`switch-thumb`,className:`pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground`}),t[6]=s):s=t[6];let c;return t[7]!==r||t[8]!==a||t[9]!==o?(c=(0,Y.jsx)(jl,{"data-slot":`switch`,"data-size":a,className:o,...r,children:s}),t[7]=r,t[8]=a,t[9]=o,t[10]=c):c=t[10],c}function fS(e){if(!e)return`never`;let t=Date.now()-new Date(e).getTime();return t<6e4?`just now`:t<36e5?`${Math.floor(t/6e4)} min ago`:t<864e5?`${Math.floor(t/36e5)}h ago`:new Date(e).toLocaleDateString()}async function pS(e){await fetch(`/api/sync/trigger`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({op:e})})}async function mS(e){let t=await fetch(`/api/sync/set-enabled`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({enabled:e})});if(!t.ok)throw Error(`set-enabled failed: HTTP ${t.status}`)}function hS(e){let t=(0,Z.c)(9),{status:n}=e;switch(n.state){case`dormant`:{let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(fi,{className:`size-3.5 text-muted-foreground`}),t[0]=e):e=t[0],e}case`idle`:{if(n.ahead>0||n.behind>0){let e;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(ea,{className:`size-3.5 text-muted-foreground`}),t[1]=e):e=t[1],e}let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(fi,{className:`size-3.5 text-emerald-500`}),t[2]=e):e=t[2],e}case`fetching`:case`pulling`:case`pushing`:{let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(ea,{className:`size-3.5 text-muted-foreground animate-spin`}),t[3]=e):e=t[3],e}case`conflict`:{let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(De,{className:`size-3.5 text-amber-500`}),t[4]=e):e=t[4],e}case`offline`:{let e;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(di,{className:`size-3.5 text-muted-foreground`}),t[5]=e):e=t[5],e}case`auth-error`:{let e;return t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(Vi,{className:`size-3.5 text-destructive`}),t[6]=e):e=t[6],e}case`disabled`:{let e;return t[7]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(di,{className:`size-3.5 text-muted-foreground`}),t[7]=e):e=t[7],e}default:{let e;return t[8]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(fi,{className:`size-3.5 text-muted-foreground`}),t[8]=e):e=t[8],e}}}function gS(e){switch(e.state){case`idle`:return e.ahead>0?`↑${e.ahead}`:e.behind>0?`↓${e.behind}`:``;case`fetching`:case`pulling`:case`pushing`:return``;case`conflict`:return e.conflictCount>0?`${e.conflictCount}`:``;case`offline`:return``;case`auth-error`:return``;case`disabled`:return``;default:return``}}function _S(e){switch(e){case`dormant`:return`No git remote`;case`idle`:return`Synced`;case`fetching`:return`Fetching…`;case`pulling`:return`Pulling…`;case`pushing`:return`Pushing…`;case`conflict`:return`Conflict`;case`offline`:return`Offline`;case`auth-error`:return`Sign in required`;case`disabled`:return`Sync disabled`;default:return e}}function vS(e){switch(e){case`external-changes-pending`:return`External changes pending`;case`dirty-tree`:return`Working tree has uncommitted changes`;case`detached-head`:return`Detached HEAD — checkout a branch to resume`;case`auth-error`:return`Sign in required`;case`protected-branch`:return`Protected branch — cannot push`;default:return e}}function yS(e){return e.syncEnabled?e.state===`idle`?e.ahead>0&&e.behind>0?`${e.ahead} ahead, ${e.behind} behind`:e.ahead>0?`${e.ahead} ahead`:e.behind>0?`${e.behind} behind`:`Synced`:e.state===`conflict`&&e.conflictCount>0?`${e.conflictCount} conflict${e.conflictCount===1?``:`s`}`:_S(e.state):`Sync off`}function bS(e){let t=(0,Z.c)(72),{status:n,onSignIn:r,onOpenConflictResolver:i,onSetIdentity:a}=e,[o,s]=(0,X.useState)(!1),c=n.syncEnabled,l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=async function(e){s(!0);try{await mS(e)}catch(t){console.error(`[sync] toggle failed`,t),At.error(`Failed to ${e?`enable`:`disable`} sync — try again`)}s(!1)},t[0]=l):l=t[0];let u=l,d;t[1]===n?d=t[2]:(d=(0,Y.jsx)(hS,{status:n}),t[1]=n,t[2]=d);let f;t[3]===n.state?f=t[4]:(f=_S(n.state),t[3]=n.state,t[4]=f);let p;t[5]===f?p=t[6]:(p=(0,Y.jsx)(`span`,{className:`text-sm font-medium truncate`,children:f}),t[5]=f,t[6]=p);let m;t[7]!==d||t[8]!==p?(m=(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[d,p]}),t[7]=d,t[8]=p,t[9]=m):m=t[9];let h;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(h=e=>void u(e),t[10]=h):h=t[10];let g=c?`Disable sync`:`Enable sync`,_;t[11]!==c||t[12]!==g||t[13]!==o?(_=(0,Y.jsx)(dS,{checked:c,disabled:o,onCheckedChange:h,"aria-label":g}),t[11]=c,t[12]=g,t[13]=o,t[14]=_):_=t[14];let v;t[15]!==m||t[16]!==_?(v=(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[m,_]}),t[15]=m,t[16]=_,t[17]=v):v=t[17];let y;t[18]===n.error?y=t[19]:(y=n.error&&(0,Y.jsx)(`p`,{className:`text-xs text-destructive`,children:n.error}),t[18]=n.error,t[19]=y);let b;t[20]===n.pausedReason?b=t[21]:(b=n.pausedReason&&(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:vS(n.pausedReason)}),t[20]=n.pausedReason,t[21]=b);let x;t[22]===n.state?x=t[23]:(x=n.state===`conflict`&&(0,Y.jsx)(`p`,{className:`text-xs text-amber-700 dark:text-amber-400`,children:`Sync paused — resolve conflicts to resume.`}),t[22]=n.state,t[23]=x);let S;t[24]!==c||t[25]!==n.lastSyncUtc||t[26]!==n.state?(S=c&&n.state!==`dormant`&&(0,Y.jsxs)(`div`,{children:[`Last synced: `,fS(n.lastSyncUtc)]}),t[24]=c,t[25]=n.lastSyncUtc,t[26]=n.state,t[27]=S):S=t[27];let C;t[28]===n.ahead?C=t[29]:(C=n.ahead>0&&(0,Y.jsxs)(`div`,{children:[n.ahead,` commit`,n.ahead===1?``:`s`,` ahead`]}),t[28]=n.ahead,t[29]=C);let w;t[30]===n.behind?w=t[31]:(w=n.behind>0&&(0,Y.jsxs)(`div`,{children:[n.behind,` commit`,n.behind===1?``:`s`,` behind`]}),t[30]=n.behind,t[31]=w);let T;t[32]===n.conflictCount?T=t[33]:(T=n.conflictCount>0&&(0,Y.jsxs)(`div`,{children:[n.conflictCount,` file`,n.conflictCount===1?``:`s`,` conflicted`]}),t[32]=n.conflictCount,t[33]=T);let E;t[34]===c?E=t[35]:(E=!c&&(0,Y.jsx)(`div`,{children:`Sync is off — your edits will not sync to the remote repository.`}),t[34]=c,t[35]=E);let D;t[36]!==S||t[37]!==C||t[38]!==w||t[39]!==T||t[40]!==E?(D=(0,Y.jsxs)(`div`,{className:`text-xs text-muted-foreground space-y-0.5`,children:[S,C,w,T,E]}),t[36]=S,t[37]=C,t[38]=w,t[39]=T,t[40]=E,t[41]=D):D=t[41];let O;t[42]!==a||t[43]!==n.identityUnresolved?(O=n.identityUnresolved&&a&&(0,Y.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-dashed p-2`,children:[(0,Y.jsx)(ha,{className:`size-3.5 mt-0.5 text-muted-foreground shrink-0`}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1.5 min-w-0`,children:[(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground leading-snug`,children:`Git identity isn't set — commits use a default author. Set yours so teammates see your name.`}),(0,Y.jsx)(K,{variant:`outline`,size:`xs`,className:`self-start`,onClick:a,children:`Set identity`})]})]}),t[42]=a,t[43]=n.identityUnresolved,t[44]=O):O=t[44];let k;t[45]!==c||t[46]!==n.state?(k=c&&n.state!==`dormant`&&n.state!==`disabled`&&n.state!==`auth-error`&&n.state!==`conflict`&&(0,Y.jsx)(K,{variant:`outline`,size:`xs`,onClick:SS,children:`Sync now`}),t[45]=c,t[46]=n.state,t[47]=k):k=t[47];let A;t[48]!==c||t[49]!==r||t[50]!==n.state?(A=c&&n.state===`auth-error`&&(0,Y.jsx)(K,{variant:`outline`,size:`xs`,onClick:r,children:`Sign in`}),t[48]=c,t[49]=r,t[50]=n.state,t[51]=A):A=t[51];let j;t[52]!==c||t[53]!==n.state?(j=c&&n.state===`offline`&&(0,Y.jsx)(K,{variant:`outline`,size:`xs`,onClick:xS,children:`Retry`}),t[52]=c,t[53]=n.state,t[54]=j):j=t[54];let M;t[55]!==c||t[56]!==i||t[57]!==n.state?(M=c&&n.state===`conflict`&&i&&(0,Y.jsx)(K,{variant:`outline`,size:`xs`,onClick:i,children:`Review conflicts`}),t[55]=c,t[56]=i,t[57]=n.state,t[58]=M):M=t[58];let N;t[59]!==k||t[60]!==A||t[61]!==j||t[62]!==M?(N=(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-1 pt-1`,children:[k,A,j,M]}),t[59]=k,t[60]=A,t[61]=j,t[62]=M,t[63]=N):N=t[63];let P;return t[64]!==y||t[65]!==b||t[66]!==x||t[67]!==D||t[68]!==O||t[69]!==N||t[70]!==v?(P=(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[v,y,b,x,D,O,N]}),t[64]=y,t[65]=b,t[66]=x,t[67]=D,t[68]=O,t[69]=N,t[70]=v,t[71]=P):P=t[71],P}function xS(){pS(`sync`)}function SS(){pS(`sync`)}function CS(e){let t=(0,Z.c)(36),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{onSignIn:r,onOpenConflictResolver:i,onSetIdentity:a}=n,{status:o,fetchError:s}=Hf();if(!o){if(s){let e;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(nn,{asChild:!0,children:(0,Y.jsx)(K,{variant:`ghost`,size:`icon-sm`,className:`text-muted-foreground`,"aria-label":`Sync status unavailable`,disabled:!0,children:(0,Y.jsx)(di,{className:`size-3.5`})})}),t[2]=e):e=t[2];let n=s===`network`?`Sync status unavailable — server unreachable.`:`Sync status unavailable — server error.`,r;return t[3]===n?r=t[4]:(r=(0,Y.jsxs)(ln,{children:[e,(0,Y.jsx)(an,{children:n})]}),t[3]=n,t[4]=r),r}return null}if(o.state===`dormant`&&!o.hasRemote)return null;let c;t[5]===o?c=t[6]:(c=gS(o),t[5]=o,t[6]=c);let l=c,u=!!o.identityUnresolved,d;t[7]===o.state?d=t[8]:(d=_S(o.state),t[7]=o.state,t[8]=d);let f=`Sync status: ${d}${u?` — git identity unset`:``}`,p;t[9]===o?p=t[10]:(p=(0,Y.jsx)(hS,{status:o}),t[9]=o,t[10]=p);let m;t[11]===l?m=t[12]:(m=l&&(0,Y.jsx)(`span`,{className:`absolute -top-0.5 -right-0.5 text-[9px] leading-none font-medium bg-background border rounded-full px-0.5`,children:l}),t[11]=l,t[12]=m);let h;t[13]!==l||t[14]!==u?(h=!l&&u&&(0,Y.jsx)(`span`,{className:`absolute -top-0.5 -right-0.5 size-1.5 rounded-full bg-amber-500 ring-2 ring-background`,"aria-hidden":!0}),t[13]=l,t[14]=u,t[15]=h):h=t[15];let g;t[16]!==f||t[17]!==p||t[18]!==m||t[19]!==h?(g=(0,Y.jsx)(nn,{asChild:!0,children:(0,Y.jsx)(gx,{asChild:!0,children:(0,Y.jsxs)(K,{variant:`ghost`,size:`icon-sm`,className:`text-muted-foreground relative`,"aria-label":f,children:[p,m,h]})})}),t[16]=f,t[17]=p,t[18]=m,t[19]=h,t[20]=g):g=t[20];let _;t[21]===o?_=t[22]:(_=yS(o),t[21]=o,t[22]=_);let v;t[23]===_?v=t[24]:(v=(0,Y.jsx)(an,{children:_}),t[23]=_,t[24]=v);let y;t[25]!==v||t[26]!==g?(y=(0,Y.jsxs)(ln,{children:[g,v]}),t[25]=v,t[26]=g,t[27]=y):y=t[27];let b;t[28]!==i||t[29]!==a||t[30]!==r||t[31]!==o?(b=(0,Y.jsx)(_x,{align:`end`,className:`w-64 p-3`,children:(0,Y.jsx)(bS,{status:o,onSignIn:r,onOpenConflictResolver:i,onSetIdentity:a})}),t[28]=i,t[29]=a,t[30]=r,t[31]=o,t[32]=b):b=t[32];let x;return t[33]!==y||t[34]!==b?(x=(0,Y.jsxs)(hx,{children:[y,b]}),t[33]=y,t[34]=b,t[35]=x):x=t[35],x}var wS=[{value:`light`,label:`Light`,icon:ua},{value:`dark`,label:`Dark`,icon:Hi},{value:`system`,label:`System`,icon:gi}],TS=()=>{let e=(0,Z.c)(14),{theme:t,setTheme:n}=T(),r=t===`system`?gi:t===`dark`?Hi:ua,i;e[0]===r?i=e[1]:(i=(0,Y.jsx)(r,{}),e[0]=r,e[1]=i);let a=t??`system`,o;e[2]===a?o=e[3]:(o=(0,Y.jsxs)(`span`,{className:`sr-only`,children:[`Toggle theme (current: `,a,`)`]}),e[2]=a,e[3]=o);let s;e[4]!==i||e[5]!==o?(s=(0,Y.jsx)(L_,{asChild:!0,children:(0,Y.jsxs)(K,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,children:[i,o]})}),e[4]=i,e[5]=o,e[6]=s):s=e[6];let c;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=wS.map(ES),e[7]=c):c=e[7];let l;e[8]!==n||e[9]!==t?(l=(0,Y.jsx)(R_,{align:`end`,children:(0,Y.jsx)(B_,{value:t,onValueChange:n,children:c})}),e[8]=n,e[9]=t,e[10]=l):l=e[10];let u;return e[11]!==s||e[12]!==l?(u=(0,Y.jsxs)(I_,{children:[s,l]}),e[11]=s,e[12]=l,e[13]=u):u=e[13],u};function ES(e){let{value:t,label:n,icon:r}=e;return(0,Y.jsxs)(V_,{value:t,className:`capitalize`,children:[(0,Y.jsx)(r,{className:`text-muted-foreground`}),n]},t)}function DS(e){return typeof e==`object`&&!!e&&typeof e.fromDocName==`string`&&typeof e.toDocName==`string`}function OS(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.ok===!0?Array.isArray(t.renamed)&&t.renamed.every(DS)&&Array.isArray(t.rewrittenDocs):t.ok===!1?typeof t.error==`string`:!1}function kS(e){let t=(0,Z.c)(97),{editorMode:n,onModeChange:r,onSaveVersion:i,saving:a,previewEntry:o,diffLayout:s,onDiffLayoutChange:c,onSignIn:l,onSetIdentity:u,onOpenConflictResolver:d,onOpenClone:f}=e,{activeDocName:p,activeProvider:m,activeTarget:h,closeDocument:g,pinnedDoc:_,pin:v,unpin:y}=ut(),{state:b}=tx(),x=kd(),S=Cx(m),C;t[0]!==p||t[1]!==x?(C=Gd({docName:p,workspace:x}),t[0]=p,t[1]=x,t[2]=C):C=t[2];let w=C,T=!p||!(S===`connected`||S===`synced`),E=h?.kind===`folder`,D=h?.kind===`missing`,O=E?`${h.folderPath}/`:p?`${p}.md`:``,k;t[3]===p?k=t[4]:(k=p?.lastIndexOf(`/`)??-1,t[3]=p,t[4]=k);let A=k,j;t[5]!==p||t[6]!==A?(j=p&&A!==-1?`${p.substring(0,A+1)}`:``,t[5]=p,t[6]=A,t[7]=j):j=t[7];let M=j,N;t[8]!==p||t[9]!==A?(N=p?p.substring(A+1):``,t[8]=p,t[9]=A,t[10]=N):N=t[10];let P=N,F=_!==null,I;t[11]!==p||t[12]!==F||t[13]!==v||t[14]!==y?(I=function(){p&&(F?y():v(p))},t[11]=p,t[12]=F,t[13]=v,t[14]=y,t[15]=I):I=t[15];let ee=I,L=n===`diff`,[R,z]=(0,X.useState)(!1),[B,V]=(0,X.useState)(``),[H,te]=(0,X.useState)(null),[ne,re]=(0,X.useState)(!1),U=(0,X.useRef)(null),W=(0,X.useRef)(!1),G=(0,X.useRef)(!1),ie=(0,X.useRef)(null),ae=(0,X.useRef)(null),oe;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(oe=()=>{G.current=!0,ie.current=null,ae.current=null,z(!1),te(null)},t[16]=oe):oe=t[16];let q;t[17]===p?q=t[18]:(q=[p],t[17]=p,t[18]=q),(0,X.useEffect)(oe,q);let se,J;t[19]===R?(se=t[20],J=t[21]):(se=()=>{if(R){let e=setTimeout(()=>{let e=U.current;e&&(e.focus(),e.select())},0);return()=>clearTimeout(e)}},J=[R],t[19]=R,t[20]=se,t[21]=J),(0,X.useEffect)(se,J);let ce;t[22]!==p||t[23]!==E?(ce=function(){if(!p||E)return;let e=p.split(`/`);G.current=!1,ie.current=p,V(e[e.length-1]),te(null),ae.current=null,z(!0)},t[22]=p,t[23]=E,t[24]=ce):ce=t[24];let le=ce,ue;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(ue=function(){G.current=!0,ie.current=null,ae.current=null,z(!1),V(``),te(null)},t[25]=ue):ue=t[25];let de=ue,fe;t[26]!==g||t[27]!==B?(fe=async function(){if(G.current){G.current=!1;return}if(W.current)return;let e=ie.current;if(!e){de();return}let t=zb(`file`,B),n=e.split(`/`),r=n[n.length-1];if(t===r){de();return}if(t===ae.current)return;if(!Bb(t)){te(`Name can’t be empty, ".", "..", or contain / or \\`);return}let i=Vb({kind:`file`,path:e,name:r},t);W.current=!0,re(!0),te(null);try{let n=await fetch(`/api/rename`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({docName:e,newDocName:i})});if(G.current){re(!1),W.current=!1;return}let r;try{r=await n.json()}catch(r){console.warn(`[EditorHeader] rename response JSON parse failed`,{parseErr:r,status:n.status,docName:e,newDocName:i}),te(`Server error (HTTP ${n.status})`),re(!1),W.current=!1,ae.current=t;return}if(!n.ok||!OS(r)){let a=r;console.warn(`[EditorHeader] rename failed`,{status:n.status,docName:e,newDocName:i}),te(a?.error||`Server error (HTTP ${n.status})`),re(!1),W.current=!1,ae.current=t;return}if(!r.ok){te(r.error||`Failed to rename path`),re(!1),W.current=!1,ae.current=t;return}let a=r.renamed,o=Wb(e,a);for(let e of a)g(e.fromDocName);Wn([`files`,`backlinks`,`graph`]),z(!1),V(``),re(!1),W.current=!1,ae.current=null,ie.current=null,o&&o!==e&&(window.location.hash=Nn(o))}catch(n){console.warn(`[EditorHeader] rename failed`,{err:n,docName:e,newDocName:i,normalized:t}),te(`Network error — please try again`),re(!1),W.current=!1,ae.current=t}},t[26]=g,t[27]=B,t[28]=fe):fe=t[28];let pe=fe,me;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,Y.jsx)(nn,{asChild:!0,children:(0,Y.jsx)(ox,{className:`-ml-1 shrink-0 text-muted-foreground`})}),t[29]=me):me=t[29];let he=b===`expanded`?`Hide Files`:`Show Files`,ge;t[30]===he?ge=t[31]:(ge=(0,Y.jsxs)(ln,{children:[me,(0,Y.jsx)(an,{children:he})]}),t[30]=he,t[31]=ge);let _e;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(_e=(0,Y.jsx)(Vy,{orientation:`vertical`,className:`mr-1 h-4 shrink-0 data-vertical:self-center`}),t[32]=_e):_e=t[32];let ve;t[33]!==p||t[34]!==pe||t[35]!==O||t[36]!==le||t[37]!==P||t[38]!==E||t[39]!==ne||t[40]!==R||t[41]!==M||t[42]!==H||t[43]!==B?(ve=E?(0,Y.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-2 text-sm text-muted-foreground`,children:[(0,Y.jsx)(nt,{className:`size-4 shrink-0`}),(0,Y.jsx)(`span`,{className:`truncate`,children:O})]}):p?(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center overflow-hidden`,children:[M&&(0,Y.jsxs)(`span`,{className:`flex shrink items-center overflow-hidden text-sm text-muted-foreground/60 transition-[max-width,opacity] duration-200 ease-in-out`,style:R?{maxWidth:0,opacity:0}:{maxWidth:`20rem`,opacity:1},children:[(0,Y.jsx)(`span`,{className:`truncate`,children:M.slice(0,-1)}),(0,Y.jsx)(`span`,{className:`shrink-0 pl-2`,children:`/`})]}),R?(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(Ue,{ref:U,value:B,disabled:ne,"aria-label":`Rename ${p}`,"aria-invalid":H?!0:void 0,"aria-describedby":H?`editor-header-rename-error`:void 0,"aria-busy":ne||void 0,onChange:e=>{V(e.target.value),te(null),ae.current=null},onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),pe()):e.key===`Escape`&&(e.preventDefault(),de())},onBlur:()=>void pe(),className:`h-7 min-w-0 flex-1 border-none bg-background text-sm shadow-none focus-visible:ring-0`}),(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 text-xs text-muted-foreground/40`,children:`.md`})]}),H&&(0,Y.jsx)(`span`,{id:`editor-header-rename-error`,role:`alert`,className:`text-xs text-destructive mt-0.5`,children:H})]}):(0,Y.jsxs)(K,{variant:`ghost`,size:`sm`,onClick:le,className:`h-7 shrink-0 px-2 text-sm font-normal text-muted-foreground hover:text-foreground`,children:[P,`.md`]})]}):(0,Y.jsx)(`span`,{className:`text-sm text-muted-foreground truncate min-w-0`,children:O}),t[33]=p,t[34]=pe,t[35]=O,t[36]=le,t[37]=P,t[38]=E,t[39]=ne,t[40]=R,t[41]=M,t[42]=H,t[43]=B,t[44]=ve):ve=t[44];let ye;t[45]!==p||t[46]!==F||t[47]!==ee?(ye=p&&(0,Y.jsxs)(ln,{children:[(0,Y.jsx)(nn,{asChild:!0,children:(0,Y.jsx)(K,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0 shrink-0 text-muted-foreground`,onClick:ee,"aria-label":F?`Unpin — resume following agent`:`Pin this doc — stop following agent`,"aria-pressed":F,"data-pinned":F?`true`:`false`,children:F?(0,Y.jsx)(Xi,{className:`size-4 text-foreground`,fill:`currentColor`}):(0,Y.jsx)(Yi,{className:`size-4`})})}),(0,Y.jsx)(an,{children:F?`Pinned — click to resume following agent navigation`:`Pin to stay on this doc — browser won’t auto-navigate to the agent’s current focus`})]}),t[45]=p,t[46]=F,t[47]=ee,t[48]=ye):ye=t[48];let be;t[49]===D?be=t[50]:(be=D&&(0,Y.jsx)(Wl,{variant:`dashed`,children:`New file`}),t[49]=D,t[50]=be);let xe;t[51]!==ge||t[52]!==ve||t[53]!==ye||t[54]!==be?(xe=(0,Y.jsxs)(`div`,{className:`flex flex-1 items-center gap-1 px-3 min-w-0`,children:[ge,_e,ve,ye,be]}),t[51]=ge,t[52]=ve,t[53]=ye,t[54]=be,t[55]=xe):xe=t[55];let Se;t[56]!==p||t[57]!==n||t[58]!==L||t[59]!==r||t[60]!==T?(Se=!L&&p&&(0,Y.jsxs)(Me,{type:`single`,value:n===`source`?`source`:`visual`,onValueChange:e=>{e&&r(e===`source`?`source`:`wysiwyg`)},"aria-label":`Editor mode`,variant:`segmented`,size:`sm`,spacing:1,className:`bg-muted dark:bg-background p-0.5 rounded-lg shrink-0`,disabled:!p,children:[(0,Y.jsxs)(ln,{children:[(0,Y.jsx)(nn,{asChild:!0,children:(0,Y.jsx)(`span`,{children:(0,Y.jsxs)(Oe,{value:`visual`,"aria-label":`Visual editor`,className:`gap-1.5 text-xs`,children:[(0,Y.jsx)(uS,{className:`size-4 text-muted-foreground`}),(0,Y.jsx)(`span`,{className:`hidden md:inline`,children:`Visual`})]})})}),(0,Y.jsx)(an,{className:`md:hidden`,children:`Visual`})]}),(0,Y.jsxs)(ln,{children:[(0,Y.jsx)(nn,{asChild:!0,children:(0,Y.jsx)(`span`,{tabIndex:T?0:void 0,children:(0,Y.jsxs)(Oe,{value:`source`,"aria-label":`Markdown source`,className:`gap-1.5 text-xs`,disabled:T,children:[(0,Y.jsx)(lS,{className:`size-4 text-muted-foreground`}),(0,Y.jsx)(`span`,{className:`hidden md:inline`,children:`Markdown`})]})})}),T&&!p?null:T?(0,Y.jsx)(an,{children:`Source mode requires a live connection — your edits are saved and will appear when you reconnect.`}):(0,Y.jsx)(an,{className:`md:hidden`,children:`Markdown`})]})]}),t[56]=p,t[57]=n,t[58]=L,t[59]=r,t[60]=T,t[61]=Se):Se=t[61];let Ce;t[62]!==s||t[63]!==L||t[64]!==c||t[65]!==o?(Ce=L&&o&&(0,Y.jsx)(`div`,{className:`flex items-center gap-2 shrink-0`,children:(0,Y.jsxs)(Me,{type:`single`,value:s,onValueChange:e=>{e&&c(e)},"aria-label":`Diff layout`,variant:`segmented`,size:`sm`,spacing:1,className:`bg-muted dark:bg-background p-0.5 rounded-lg shrink-0`,children:[(0,Y.jsxs)(ln,{children:[(0,Y.jsx)(nn,{asChild:!0,children:(0,Y.jsx)(`span`,{children:(0,Y.jsxs)(Oe,{value:`unified`,"aria-label":`Unified diff`,className:`gap-1 text-xs px-2`,children:[(0,Y.jsx)(ta,{className:`size-3.5`}),(0,Y.jsx)(`span`,{className:`hidden md:inline`,children:`Unified`})]})})}),(0,Y.jsx)(an,{className:`md:hidden`,children:`Unified`})]}),(0,Y.jsxs)(ln,{children:[(0,Y.jsx)(nn,{asChild:!0,children:(0,Y.jsx)(`span`,{children:(0,Y.jsxs)(Oe,{value:`split`,"aria-label":`Split diff`,className:`gap-1 text-xs px-2`,children:[(0,Y.jsx)(mi,{className:`size-3.5`}),(0,Y.jsx)(`span`,{className:`hidden md:inline`,children:`Split`})]})})}),(0,Y.jsx)(an,{className:`md:hidden`,children:`Split`})]})]})}),t[62]=s,t[63]=L,t[64]=c,t[65]=o,t[66]=Ce):Ce=t[66];let we;t[67]!==L||t[68]!==f?(we=!L&&f&&(0,Y.jsxs)(ln,{children:[(0,Y.jsx)(nn,{asChild:!0,children:(0,Y.jsx)(K,{variant:`ghost`,size:`icon-sm`,"aria-label":`Clone from GitHub`,onClick:f,className:`text-muted-foreground`,children:(0,Y.jsx)(Ai,{className:`size-3.5`})})}),(0,Y.jsx)(an,{children:`Clone from GitHub…`})]}),t[67]=L,t[68]=f,t[69]=we):we=t[69];let Te;t[70]!==p||t[71]!==L||t[72]!==i||t[73]!==a?(Te=!L&&p&&(0,Y.jsxs)(ln,{children:[(0,Y.jsx)(nn,{asChild:!0,children:(0,Y.jsx)(K,{variant:`ghost`,size:`icon-sm`,"aria-label":`Checkpoint version`,onClick:i,disabled:a,className:`text-muted-foreground`,children:(0,Y.jsx)(na,{className:`size-3.5`})})}),(0,Y.jsx)(an,{children:a?`Saving…`:`Checkpoint version`})]}),t[70]=p,t[71]=L,t[72]=i,t[73]=a,t[74]=Te):Te=t[74];let Ee;t[75]!==p||t[76]!==w||t[77]!==L?(Ee=!L&&p&&(0,Y.jsx)(iS,{input:w}),t[75]=p,t[76]=w,t[77]=L,t[78]=Ee):Ee=t[78];let De;t[79]!==d||t[80]!==u||t[81]!==l?(De=(0,Y.jsx)(CS,{onSignIn:l,onSetIdentity:u,onOpenConflictResolver:d}),t[79]=d,t[80]=u,t[81]=l,t[82]=De):De=t[82];let ke,Ae,je,Ne;t[83]===Symbol.for(`react.memo_cache_sentinel`)?(ke=(0,Y.jsx)(Rx,{}),Ae=(0,Y.jsx)(Vy,{orientation:`vertical`,className:`h-4 shrink-0 data-vertical:self-center`}),je=(0,Y.jsx)(qx,{}),Ne=(0,Y.jsx)(TS,{}),t[83]=ke,t[84]=Ae,t[85]=je,t[86]=Ne):(ke=t[83],Ae=t[84],je=t[85],Ne=t[86]);let Pe;t[87]!==we||t[88]!==Te||t[89]!==Ee||t[90]!==De?(Pe=(0,Y.jsxs)(`div`,{className:`flex flex-1 items-center justify-end gap-2 px-3`,children:[we,Te,Ee,De,ke,Ae,je,Ne]}),t[87]=we,t[88]=Te,t[89]=Ee,t[90]=De,t[91]=Pe):Pe=t[91];let Fe;return t[92]!==xe||t[93]!==Se||t[94]!==Ce||t[95]!==Pe?(Fe=(0,Y.jsxs)(`header`,{className:`flex h-12 shrink-0 items-center border-b`,children:[xe,Se,Ce,Pe]}),t[92]=xe,t[93]=Se,t[94]=Ce,t[95]=Pe,t[96]=Fe):Fe=t[96],Fe}function AS(){let e=(0,Z.c)(66),[t,n]=zf(),[r,i]=(0,X.useState)(t),[a,o]=(0,X.useState)(!1),[s,c]=(0,X.useState)(!1),[l,u]=(0,X.useState)(`auth`),[d,f]=(0,X.useState)(!1),[p,m]=(0,X.useState)(!1),[h,g]=(0,X.useState)(null),[_,v]=(0,X.useState)(`unified`),[y,b]=(0,X.useState)(!1),[x,S]=(0,X.useState)(null),[C,w]=(0,X.useState)(!1),T=(0,X.useRef)(null),E=(0,X.useRef)(!1),D=(0,X.useRef)(`wysiwyg`),O=Vf(),k,A;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(k=()=>()=>{T.current&&clearTimeout(T.current)},A=[],e[0]=k,e[1]=A):(k=e[0],A=e[1]),(0,X.useEffect)(k,A);let{activeDocName:j}=ut(),M;e[2]===r?M=e[3]:(M=function(e){e.sha?(r!==`diff`&&(D.current=r),g(e),i(`diff`)):(g(null),i(D.current)),S(null)},e[2]=r,e[3]=M);let N=M,P;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(P=function(){g(null),i(D.current),S(null)},e[4]=P):P=e[4];let F=P,I;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(I=function(){F(),At.info(`No changes since this version`)},e[5]=I):I=e[5];let ee=I,L,R;e[6]===j?(L=e[7],R=e[8]):(L=()=>{let e=function(e){let t=e.detail;t&&j&&pr(j,{kind:`raw-mdx`,detail:t}),i(`source`)};return window.addEventListener(mt,e),()=>window.removeEventListener(mt,e)},R=[j],e[6]=j,e[7]=L,e[8]=R),(0,X.useEffect)(L,R);let z=(0,X.useRef)(j),B,V;e[9]!==j||e[10]!==r?(B=()=>{z.current!==j&&(z.current=j,g(null),r===`diff`&&i(D.current))},V=[j,r],e[9]=j,e[10]=r,e[11]=B,e[12]=V):(B=e[11],V=e[12]),(0,X.useEffect)(B,V);let H;e[13]===O?H=e[14]:(H=()=>{!E.current&&O?.state===`dormant`&&O.hasRemote&&(E.current=!0,At.info(`This project has a GitHub remote.`,{description:`Sign in to enable automatic sync with your team.`,duration:8e3,action:{label:`Sign in`,onClick:()=>c(!0)}}))},e[13]=O,e[14]=H);let te=O?.state,ne=O?.hasRemote,re;e[15]!==te||e[16]!==ne?(re=[te,ne],e[15]=te,e[16]=ne,e[17]=re):re=e[17],(0,X.useEffect)(H,re);let U;e[18]===n?U=e[19]:(U=function(e){i(e),n(e)},e[18]=n,e[19]=U);let W=U,G;e[20]===Symbol.for(`react.memo_cache_sentinel`)?(G=async function(){w(!0);try{let e=await fetch(`/api/save-version`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({})});e.ok?At.success(`Checkpoint saved`):(console.error(`[save-version] failed:`,await e.text()),At.error(`Checkpoint failed — try again`))}catch(e){console.error(`[save-version] failed:`,e),At.error(`Checkpoint failed — try again`)}w(!1)},e[20]=G):G=e[20];let ie=G,ae;e[21]!==j||e[22]!==h?(ae=async function(){if(!(!h?.sha||!j)){b(!0);try{(await fetch(`/api/rollback`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({docName:j,commitSha:h.sha})})).ok?(g(null),i(D.current),S(null)):(S(`Restore failed — document unchanged`),T.current&&clearTimeout(T.current),T.current=setTimeout(()=>S(null),4e3))}catch{S(`Restore failed — document unchanged`),T.current&&clearTimeout(T.current),T.current=setTimeout(()=>S(null),4e3)}b(!1)}},e[21]=j,e[22]=h,e[23]=ae):ae=e[23];let oe=ae,q;e[24]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,Y.jsx)(np,{onOpenResolver:()=>o(!0)}),e[24]=q):q=e[24];let se,J,ce,le;e[25]===Symbol.for(`react.memo_cache_sentinel`)?(se=()=>{u(`auth`),c(!0)},J=()=>{u(`identity`),c(!0)},ce=()=>o(!0),le=()=>f(!0),e[25]=se,e[26]=J,e[27]=ce,e[28]=le):(se=e[25],J=e[26],ce=e[27],le=e[28]);let ue;e[29]!==_||e[30]!==r||e[31]!==W||e[32]!==h||e[33]!==C?(ue=(0,Y.jsx)(kS,{editorMode:r,onModeChange:W,onSaveVersion:ie,saving:C,previewEntry:h,diffLayout:_,onDiffLayoutChange:v,onSignIn:se,onSetIdentity:J,onOpenConflictResolver:ce,onOpenClone:le}),e[29]=_,e[30]=r,e[31]=W,e[32]=h,e[33]=C,e[34]=ue):ue=e[34];let de;e[35]!==r||e[36]!==oe||e[37]!==h||e[38]!==x||e[39]!==y?(de=r===`diff`&&h&&(0,Y.jsxs)(`div`,{className:`flex h-8 shrink-0 items-center border-b bg-muted/30 px-3 gap-2`,children:[(0,Y.jsxs)(`span`,{className:`flex-1 truncate text-xs text-muted-foreground`,children:[`Viewing: `,a_(h.timestamp),` — `,o_(h)]}),x&&(0,Y.jsx)(`span`,{className:`text-xs text-destructive`,children:x}),(0,Y.jsx)(K,{variant:`ghost`,className:`font-mono uppercase`,size:`xs`,onClick:F,children:`Close`}),(0,Y.jsxs)(xf,{children:[(0,Y.jsx)(Sf,{asChild:!0,children:(0,Y.jsx)(K,{variant:`default`,size:`xs`,disabled:y,children:y?`Restoring…`:`Restore`})}),(0,Y.jsxs)(Tf,{children:[(0,Y.jsxs)(Ef,{children:[(0,Y.jsx)(Of,{children:`Restore this version?`}),(0,Y.jsxs)(kf,{children:[`This will replace the current document content with the version from`,` `,a_(h.timestamp),`. Your current content is already saved in the timeline — you can restore it anytime.`]})]}),(0,Y.jsxs)(Df,{children:[(0,Y.jsx)(jf,{className:`font-mono uppercase`,children:`Cancel`}),(0,Y.jsx)(Af,{onClick:oe,children:`Restore`})]})]})]})]}),e[35]=r,e[36]=oe,e[37]=h,e[38]=x,e[39]=y,e[40]=de):de=e[40];let fe=h?.sha,pe;e[41]!==_||e[42]!==r||e[43]!==N||e[44]!==h||e[45]!==fe?(pe=(0,Y.jsx)(Pb,{editorMode:r,previewEntry:h,diffLayout:_,onNoDiff:ee,onEntrySelect:N,selectedSha:fe}),e[41]=_,e[42]=r,e[43]=N,e[44]=h,e[45]=fe,e[46]=pe):pe=e[46];let me;e[47]===a?me=e[48]:(me=(0,Y.jsx)(ih,{open:a,onOpenChange:o}),e[47]=a,e[48]=me);let he;e[49]===Symbol.for(`react.memo_cache_sentinel`)?(he=e=>{c(e),e||m(!1)},e[49]=he):he=e[49];let ge=l===`identity`,_e;e[50]===p?_e=e[51]:(_e=()=>{c(!1),p&&(m(!1),f(!0))},e[50]=p,e[51]=_e);let ve;e[52]!==s||e[53]!==ge||e[54]!==_e?(ve=(0,Y.jsx)(Yf,{open:s,onOpenChange:he,identityPrompt:ge,onSuccess:_e}),e[52]=s,e[53]=ge,e[54]=_e,e[55]=ve):ve=e[55];let ye;e[56]===Symbol.for(`react.memo_cache_sentinel`)?(ye=()=>{f(!1),u(`auth`),m(!0),c(!0)},e[56]=ye):ye=e[56];let be;e[57]===d?be=e[58]:(be=(0,Y.jsx)(ep,{open:d,onOpenChange:f,onSignIn:ye}),e[57]=d,e[58]=be);let xe;return e[59]!==ue||e[60]!==de||e[61]!==pe||e[62]!==me||e[63]!==ve||e[64]!==be?(xe=(0,Y.jsxs)(Y.Fragment,{children:[q,ue,de,pe,me,ve,be]}),e[59]=ue,e[60]=de,e[61]=pe,e[62]=me,e[63]=ve,e[64]=be,e[65]=xe):xe=e[65],xe}var jS=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
22
+ `,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;vr(t,{style:t=>hr(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 jm.set(t.changes,i),i}function Pm(e,t){let{state:n}=e,r=t??n.selection.main.head,i=e.state.field(Bp).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(Am);i.fromB!=i.toB&&i.toA<=o.length&&(a+=e.state.lineBreak);let s=wr.of({from:i.fromA,to:Math.min(o.length,i.toA),insert:a},o.length);return e.dispatch({effects:km.of({doc:s.apply(o),changes:s}),userEvent:`accept`}),!0}function Fm(e,t){let{state:n}=e,r=t??n.selection.main.head,i=n.field(Bp).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=n.field(Am).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 Im(e){let t=new kr;for(let n of e.field(Bp)){let r=e.facet(Lp).overrideChunk&&zm(e,n);t.add(n.fromB,n.fromB,Nm(e,n,!!r))}return t.finish()}var Lm=Sr.define({create:e=>Im(e),update(e,t){return t.state.field(Bp,!1)==t.startState.field(Bp,!1)?e:Im(t.state)},provide:e=>Er.decorations.from(e)}),Rm=new WeakMap;function zm(e,t){let n=Rm.get(t);if(n!==void 0)return n;n=null;let r=e.field(Am),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(jr.widget({widget:new Bm(t),side:-1}).range(s+n.fromB))}n.fromB<n.toB&&e.push(nm.range(s+n.fromB,s+n.toB))}i<t.endA-t.fromA-a*2&&(n=e)}return Rm.set(t,n),n}var Bm=class extends Cr{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}},Vm=new class extends Tr{constructor(){super(...arguments),this.elementClass=`cm-inlineChangedLineGutter`}},Hm=jr.line({class:`cm-inlineChangedLine`});function Um(e,t,n,r){let i=zm(e,t),a=0;if(!i)return!1;for(let o=e.doc.lineAt(t.fromB);;){for(r&&r.add(o.from,o.from,Vm),n.add(o.from,o.from,Hm);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 Wm=fr({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),Gm=sr({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}});function Km(e){let t=(0,Z.c)(20),{oldContent:n,newContent:r,layout:i,conflictMode:a,onResolve:o,onAbort:s}=e,c=(0,X.useRef)(null),l=(0,X.useRef)(null),{resolvedTheme:u}=T(),d=(0,X.useRef)(o),f=(0,X.useRef)(s),[p,m]=(0,X.useState)(null),h;t[0]!==s||t[1]!==o?(h=()=>{d.current=o,f.current=s},t[0]=s,t[1]=o,t[2]=h):h=t[2],(0,X.useEffect)(h);let g,_;t[3]!==a||t[4]!==i||t[5]!==r||t[6]!==n||t[7]!==u?(g=()=>{if(!c.current)return;let e=u===`dark`?Wm:Gm,t=[Er.editable.of(!1),_r.readOnly.of(!0)],o=[dr,ar(),...t,e,Er.lineWrapping];if(l.current&&=(l.current.destroy(),null),a){let t=new Er({doc:r,extensions:[dr,ar(),Er.editable.of(!1),e,Er.lineWrapping,Om({original:n,highlightChanges:!0,gutter:!0,mergeControls:!0,collapseUnchanged:{margin:3,minSize:4}}),Er.updateListener.of(e=>{let t=Vp(e.state);m(t?t.chunks.length:0)})],parent:c.current});l.current=t;let i=Vp(t.state);m(i?i.chunks.length:0)}else i===`split`?l.current=new wm({a:{doc:n,extensions:o},b:{doc:r,extensions:o},parent:c.current,highlightChanges:!0,gutter:!0,collapseUnchanged:{margin:3,minSize:4}}):l.current=new Er({doc:r,extensions:[...o,Om({original:n,highlightChanges:!0,gutter:!0,mergeControls:!1,collapseUnchanged:{margin:3,minSize:4}})],parent:c.current});return()=>{l.current&&=(l.current.destroy(),null)}},_=[n,r,i,u,a],t[3]=a,t[4]=i,t[5]=r,t[6]=n,t[7]=u,t[8]=g,t[9]=_):(g=t[8],_=t[9]),(0,X.useEffect)(g,_);let v;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(v=function(){let e=l.current;!e||!(e instanceof Er)||d.current?.(e.state.doc.toString())},t[10]=v):v=t[10];let y=v,b=p===0,x=p===null?``:p===0?`All hunks resolved`:`${p} unresolved hunk${p===1?``:`s`}`,S;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Y.jsx)(`div`,{ref:c,className:`diff-view min-h-0 flex-1 overflow-y-auto subtle-scrollbar`}),t[11]=S):S=t[11];let C;t[12]!==b||t[13]!==a||t[14]!==x||t[15]!==s||t[16]!==o?(C=a&&(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-3 py-2 border-t shrink-0`,children:[(0,Y.jsx)(`span`,{className:`text-xs ${b?`text-emerald-600 dark:text-emerald-400`:`text-muted-foreground`}`,children:x}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[s&&(0,Y.jsx)(K,{variant:`ghost`,size:`sm`,onClick:s,children:`Exit merge`}),o&&(0,Y.jsx)(K,{variant:`default`,size:`sm`,disabled:!b,onClick:y,children:`Save resolution`})]})]}),t[12]=b,t[13]=a,t[14]=x,t[15]=s,t[16]=o,t[17]=C):C=t[17];let w;return t[18]===C?w=t[19]:(w=(0,Y.jsxs)(`div`,{className:`flex flex-col h-full`,children:[S,C]}),t[18]=C,t[19]=w),w}function qm(e){let t=(0,Z.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,Y.jsx)(Gt,{"data-slot":`sheet`,...n}),t[2]=n,t[3]=r),r}function Jm(e){let t=(0,Z.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,Y.jsx)(Lt,{"data-slot":`sheet-portal`,...n}),t[2]=n,t[3]=r),r}function Ym(e){let t=(0,Z.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=W(`fixed inset-0 z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Y.jsx)(It,{"data-slot":`sheet-overlay`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Xm(e){let t=(0,Z.c)(17),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:r,children:n,side:a,showCloseButton:o,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=a===void 0?`right`:a,c=o===void 0?!0:o,l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Y.jsx)(Ym,{}),t[6]=l):l=t[6];let u;t[7]===r?u=t[8]:(u=W(`fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-[side=bottom]:data-open:slide-in-from-bottom-10 data-[side=left]:data-open:slide-in-from-left-10 data-[side=right]:data-open:slide-in-from-right-10 data-[side=top]:data-open:slide-in-from-top-10 data-closed:animate-out data-closed:fade-out-0 data-[side=bottom]:data-closed:slide-out-to-bottom-10 data-[side=left]:data-closed:slide-out-to-left-10 data-[side=right]:data-closed:slide-out-to-right-10 data-[side=top]:data-closed:slide-out-to-top-10`,r),t[7]=r,t[8]=u);let d;t[9]===c?d=t[10]:(d=c&&(0,Y.jsx)(Ft,{"data-slot":`sheet-close`,asChild:!0,children:(0,Y.jsxs)(K,{variant:`ghost`,className:`absolute top-3 right-3`,size:`icon-sm`,children:[(0,Y.jsx)(Zt,{}),(0,Y.jsx)(`span`,{className:`sr-only`,children:`Close`})]})}),t[9]=c,t[10]=d);let f;return t[11]!==n||t[12]!==i||t[13]!==s||t[14]!==u||t[15]!==d?(f=(0,Y.jsxs)(Jm,{children:[l,(0,Y.jsxs)(Vt,{"data-slot":`sheet-content`,"data-side":s,className:u,...i,children:[n,d]})]}),t[11]=n,t[12]=i,t[13]=s,t[14]=u,t[15]=d,t[16]=f):f=t[16],f}function Zm(e){let t=(0,Z.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=W(`flex flex-col gap-0.5 p-4`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Y.jsx)(`div`,{"data-slot":`sheet-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Qm(e){let t=(0,Z.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=W(`font-heading text-base font-medium text-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Y.jsx)(Ht,{"data-slot":`sheet-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}async function $m(){try{let e=await fetch(`/api/sync/conflicts`);return e.ok?{conflicts:(await e.json()).conflicts??[]}:{conflicts:[],error:`server`}}catch{return{conflicts:[],error:`network`}}}async function eh(e){try{let t=await fetch(`/api/sync/conflict-content?file=${encodeURIComponent(e)}`);if(!t.ok)return{ours:``,theirs:``,base:``};let n=await t.json();return{ours:n.ours??``,theirs:n.theirs??``,base:n.base??``}}catch{return{ours:``,theirs:``,base:``}}}async function th(e,t,n){try{let r={file:e,strategy:t};return n!==void 0&&(r.content=n),(await fetch(`/api/sync/resolve-conflict`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(r)})).ok}catch{return!1}}var nh=`w-[98vw] !max-w-[98vw] h-[96vh] flex flex-col gap-0 sm:!max-w-[98vw]`;function rh(e){let t=(0,Z.c)(31),{file:n,onResolve:r,onAbort:i}=e,[a,o]=(0,X.useState)(null),s,c;if(t[0]===n?(s=t[1],c=t[2]):(s=()=>{let e=!1;return eh(n).then(t=>{e||o(t)}),()=>{e=!0}},c=[n],t[0]=n,t[1]=s,t[2]=c),(0,X.useEffect)(s,c),a===null){let e;t[3]===i?e=t[4]:(e=e=>!e&&i(),t[3]=i,t[4]=e);let r;t[5]===n?r=t[6]:(r=(0,Y.jsx)(Wt,{className:`shrink-0`,children:(0,Y.jsxs)(qt,{children:[`Resolving: `,n]})}),t[5]=n,t[6]=r);let a;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Y.jsx)(`div`,{className:`flex-1 flex items-center justify-center text-sm text-muted-foreground`,children:`Loading…`}),t[7]=a):a=t[7];let o;t[8]===r?o=t[9]:(o=(0,Y.jsxs)(Kt,{className:nh,children:[r,a]}),t[8]=r,t[9]=o);let s;return t[10]!==e||t[11]!==o?(s=(0,Y.jsx)(Jt,{open:!0,onOpenChange:e,children:o}),t[10]=e,t[11]=o,t[12]=s):s=t[12],s}let l;t[13]===i?l=t[14]:(l=e=>!e&&i(),t[13]=i,t[14]=l);let u;t[15]===n?u=t[16]:(u=(0,Y.jsxs)(qt,{className:`text-sm font-medium`,children:[`Resolving: `,n]}),t[15]=n,t[16]=u);let d;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Red = your version (ours). Green = team's version (theirs). Accept each hunk to take theirs, reject to keep yours, then save.`}),t[17]=d):d=t[17];let f;t[18]===u?f=t[19]:(f=(0,Y.jsxs)(Wt,{className:`px-4 pt-4 pb-2 shrink-0`,children:[u,d]}),t[18]=u,t[19]=f);let p;t[20]!==i||t[21]!==r||t[22]!==a.ours||t[23]!==a.theirs?(p=(0,Y.jsx)(`div`,{className:`flex-1 min-h-0 overflow-hidden`,children:(0,Y.jsx)(Km,{oldContent:a.ours,newContent:a.theirs,layout:`unified`,conflictMode:!0,onResolve:r,onAbort:i})}),t[20]=i,t[21]=r,t[22]=a.ours,t[23]=a.theirs,t[24]=p):p=t[24];let m;t[25]!==f||t[26]!==p?(m=(0,Y.jsxs)(Kt,{className:`${nh} p-0`,children:[f,p]}),t[25]=f,t[26]=p,t[27]=m):m=t[27];let h;return t[28]!==l||t[29]!==m?(h=(0,Y.jsx)(Jt,{open:!0,onOpenChange:l,children:m}),t[28]=l,t[29]=m,t[30]=h):h=t[30],h}function ih(e){let t=(0,Z.c)(50),{open:n,onOpenChange:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=[],t[0]=i):i=t[0];let[a,o]=(0,X.useState)(i),[s,c]=(0,X.useState)(null),l;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(l=new Set,t[1]=l):l=t[1];let[u,d]=(0,X.useState)(l),f;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=new Set,t[2]=f):f=t[2];let[p,m]=(0,X.useState)(f),[h,g]=(0,X.useState)(null),_;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(_=function(){$m().then(e=>{let{conflicts:t,error:n}=e;c(n??null),o(t),d(e=>{let n=new Set(t.map(ah));return new Set([...e].filter(e=>!n.has(e)))})})},t[3]=_):_=t[3];let v=_,y,b;t[4]===n?(y=t[5],b=t[6]):(y=()=>{n&&v()},b=[n],t[4]=n,t[5]=y,t[6]=b),(0,X.useEffect)(y,b);let x,S;t[7]===n?(x=t[8],S=t[9]):(x=()=>Fn(e=>{e.includes(`sync-status`)&&n&&v()}),S=[n],t[7]=n,t[8]=x,t[9]=S),(0,X.useEffect)(x,S);let C,w;t[10]!==a.length||t[11]!==r||t[12]!==n||t[13]!==u.size?(w=()=>{n&&a.length>0&&u.size>=a.length&&(At.success(`All conflicts resolved — sync resuming`),r(!1),d(new Set))},C=[n,a.length,u.size,r],t[10]=a.length,t[11]=r,t[12]=n,t[13]=u.size,t[14]=C,t[15]=w):(C=t[14],w=t[15]),(0,X.useEffect)(w,C);let T;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(T=async function(e,t,n){m(t=>new Set([...t,e]));let r=await th(e,t,n);m(t=>{let n=new Set(t);return n.delete(e),n}),r?d(t=>new Set([...t,e])):At.error(`Failed to resolve ${e}`)},t[16]=T):T=t[16];let E=T,D;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(D=function(e){g(e)},t[17]=D):D=t[17];let O=D,k;t[18]===h?k=t[19]:(k=async function(e){if(!h)return;let t=h;g(null),await E(t,`content`,e)},t[18]=h,t[19]=k);let A=k,j;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(j=function(){g(null)},t[20]=j):j=t[20];let M=j,N;t[21]===r?N=t[22]:(N=async function(){try{(await fetch(`/api/sync/abort-merge`,{method:`POST`})).ok?At.info(`Merge aborted — sync paused`):At.error(`Failed to abort merge`)}catch{At.error(`Failed to abort merge — connection error`)}r(!1),d(new Set)},t[21]=r,t[22]=N);let P=N,F=a.length,I=u.size,ee;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Y.jsx)(Qm,{className:`text-sm font-medium`,children:`Resolve conflicts`}),t[23]=ee):ee=t[23];let L;t[24]!==I||t[25]!==F?(L=F>0&&(0,Y.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[I,` of `,F,` resolved`]}),t[24]=I,t[25]=F,t[26]=L):L=t[26];let R;t[27]===L?R=t[28]:(R=(0,Y.jsxs)(Zm,{className:`px-4 py-3 border-b shrink-0`,children:[ee,L]}),t[27]=L,t[28]=R);let z;t[29]!==a||t[30]!==s||t[31]!==u||t[32]!==p?(z=(0,Y.jsx)(`div`,{className:`flex-1 overflow-y-auto`,children:s?(0,Y.jsxs)(`div`,{className:`px-4 py-6 text-sm text-center space-y-2`,children:[(0,Y.jsx)(`p`,{className:`text-destructive`,children:s===`network`?`Could not reach the sync server — check your connection.`:`Sync server error — try again in a moment.`}),(0,Y.jsx)(K,{variant:`outline`,size:`sm`,onClick:v,children:`Retry`})]}):a.length===0?(0,Y.jsx)(`p`,{className:`px-4 py-6 text-sm text-muted-foreground text-center`,children:`No conflicts found.`}):(0,Y.jsx)(`ul`,{className:`divide-y`,children:a.map(e=>{let t=u.has(e.file),n=p.has(e.file),r=e.file.split(`/`).pop()??e.file;return(0,Y.jsxs)(`li`,{className:`px-4 py-3 ${t?`opacity-50`:``}`,children:[(0,Y.jsxs)(`p`,{className:`text-sm font-medium truncate mb-2`,title:e.file,children:[t?`✓ `:``,r]}),!t&&(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[(0,Y.jsx)(K,{variant:`outline`,size:`xs`,disabled:n,onClick:()=>void E(e.file,`mine`),children:`Keep my version`}),(0,Y.jsx)(K,{variant:`outline`,size:`xs`,disabled:n,onClick:()=>void E(e.file,`theirs`),children:`Keep team's version`}),(0,Y.jsx)(K,{variant:`ghost`,size:`xs`,disabled:n,onClick:()=>O(e.file),children:`Resolve manually`})]})]},e.file)})})}),t[29]=a,t[30]=s,t[31]=u,t[32]=p,t[33]=z):z=t[33];let B;t[34]===P?B=t[35]:(B=(0,Y.jsx)(`div`,{className:`px-4 py-3 border-t shrink-0`,children:(0,Y.jsx)(K,{variant:`ghost`,size:`sm`,className:`w-full`,onClick:P,children:`Exit merge`})}),t[34]=P,t[35]=B);let V;t[36]!==R||t[37]!==z||t[38]!==B?(V=(0,Y.jsxs)(Xm,{side:`right`,className:`w-80 sm:w-96 flex flex-col gap-0 p-0`,children:[R,z,B]}),t[36]=R,t[37]=z,t[38]=B,t[39]=V):V=t[39];let H;t[40]!==r||t[41]!==n||t[42]!==V?(H=(0,Y.jsx)(qm,{open:n,onOpenChange:r,children:V}),t[40]=r,t[41]=n,t[42]=V,t[43]=H):H=t[43];let te;t[44]!==A||t[45]!==h?(te=h&&(0,Y.jsx)(rh,{file:h,onResolve:e=>void A(e),onAbort:M}),t[44]=A,t[45]=h,t[46]=te):te=t[46];let ne;return t[47]!==H||t[48]!==te?(ne=(0,Y.jsxs)(Y.Fragment,{children:[H,te]}),t[47]=H,t[48]=te,t[49]=ne):ne=t[49],ne}function ah(e){return e.file}function oh(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function sh(e,t){let n=getComputedStyle(e.ownerDocument.body);return t*parseFloat(n.fontSize)}function ch(e){return e/100*window.innerHeight}function lh(e){return e/100*window.innerWidth}function uh(e){switch(typeof e){case`number`:return[e,`px`];case`string`:{let t=parseFloat(e);return e.endsWith(`%`)?[t,`%`]:e.endsWith(`px`)?[t,`px`]:e.endsWith(`rem`)?[t,`rem`]:e.endsWith(`em`)?[t,`em`]:e.endsWith(`vh`)?[t,`vh`]:e.endsWith(`vw`)?[t,`vw`]:[t,`%`]}}}function dh({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=uh(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=sh(t,i);break;case`em`:r=oh(t,i);break;case`vh`:r=ch(i);break;case`vw`:r=lh(i);break}return r}function fh(e){return parseFloat(e.toFixed(3))}function ph({group:e}){let{orientation:t,panels:n}=e;return n.reduce((e,n)=>(e+=t===`horizontal`?n.element.offsetWidth:n.element.offsetHeight,e),0)}function mh(e){let{panels:t}=e,n=ph({group:e});return n===0?t.map(e=>({groupResizeBehavior:e.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:e.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:e.panelConstraints.disabled,minSize:0,maxSize:100,panelId:e.id})):t.map(e=>{let{element:t,panelConstraints:r}=e,i=0;r.collapsedSize!==void 0&&(i=fh(dh({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=fh(dh({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=fh(dh({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=fh(dh({groupSize:n,panelElement:t,styleProp:r.maxSize})/n*100)),{groupResizeBehavior:r.groupResizeBehavior,collapsedSize:i,collapsible:r.collapsible===!0,defaultSize:a,disabled:r.disabled,minSize:o,maxSize:s,panelId:e.id}})}function hh(e,t=`Assertion error`){if(!e)throw Error(t)}function gh(e,t){return Array.from(t).sort(e===`horizontal`?_h:vh)}function _h(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function vh(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function yh(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function bh(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function xh({orientation:e,rects:t,targetRect:n}){let r={x:n.x+n.width/2,y:n.y+n.height/2},i,a=Number.MAX_VALUE;for(let n of t){let{x:t,y:o}=bh(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return hh(i,`No rect found`),i}var Sh;function Ch(){return Sh===void 0&&(Sh=typeof matchMedia==`function`?!!matchMedia(`(pointer:coarse)`).matches:!1),Sh}function wh(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=gh(n,Array.from(t.children).filter(yh).map(e=>({element:e}))).map(({element:e})=>e),o=[],s=!1,c=!1,l=-1,u=-1,d=0,f,p=[];{let e=-1;for(let t of a)t.hasAttribute(`data-panel`)&&(e++,t.hasAttribute(`data-disabled`)||(d++,l===-1&&(l=e),u=e))}if(d>1){let t=-1;for(let d of a)if(d.hasAttribute(`data-panel`)){t++;let i=r.find(e=>e.element===d);if(i){if(f){let r=f.element.getBoundingClientRect(),a=d.getBoundingClientRect(),m;if(c){let e=n===`horizontal`?new DOMRect(r.right,r.top,0,r.height):new DOMRect(r.left,r.bottom,r.width,0),t=n===`horizontal`?new DOMRect(a.left,a.top,0,a.height):new DOMRect(a.left,a.top,a.width,0);switch(p.length){case 0:m=[e,t];break;case 1:{let i=p[0];m=[i,xh({orientation:n,rects:[r,a],targetRect:i.element.getBoundingClientRect()})===r?t:e];break}default:m=p;break}}else m=p.length?p:[n===`horizontal`?new DOMRect(r.right,a.top,a.left-r.right,a.height):new DOMRect(a.left,r.bottom,a.width,a.top-r.bottom)];for(let n of m){let r=`width`in n?n:n.element.getBoundingClientRect(),a=Ch()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(r.width<a){let e=a-r.width;r=new DOMRect(r.x-e/2,r.y,r.width+e,r.height)}if(r.height<a){let e=a-r.height;r=new DOMRect(r.x,r.y-e/2,r.width,r.height+e)}!s&&!(t<=l||t>u)&&o.push({group:e,groupSize:ph({group:e}),panels:[f,i],separator:`width`in n?void 0:n,rect:r}),s=!1}}c=!1,f=i,p=[]}}else if(d.hasAttribute(`data-separator`)){d.ariaDisabled!==null&&(s=!0);let e=i.find(e=>e.element===d);e?p.push(e):(f=void 0,p=[])}else c=!0}return o}var Th=class{#e={};addListener(e,t){let n=this.#e[e];return n===void 0?this.#e[e]=[t]:n.includes(t)||n.push(t),()=>{this.removeListener(e,t)}}emit(e,t){let n=this.#e[e];if(n!==void 0)if(n.length===1)n[0].call(null,t);else{let e=!1,r=null,i=Array.from(n);for(let n=0;n<i.length;n++){let a=i[n];try{a.call(null,t)}catch(t){r===null&&(e=!0,r=t)}}if(e)throw r}}removeAllListeners(){this.#e={}}removeListener(e,t){let n=this.#e[e];if(n!==void 0){let e=n.indexOf(t);e>=0&&n.splice(e,1)}}},Eh=new Map,Dh=new Th;function Oh(e){Eh=new Map(Eh),Eh.delete(e)}function kh(e,t){for(let[t]of Eh)if(t.id===e)return t}function Ah(e,t){for(let[t,n]of Eh)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function jh(){return Eh}function Mh(e,t){return Dh.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function Nh(e,t){let n=Eh.get(e);Eh=new Map(Eh),Eh.set(e,t),Dh.emit(`groupChange`,{group:e,prev:n,next:t})}function Ph(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=bh(n,a.rect);switch(e){case`horizontal`:t.x<=i.x&&(r=a,i=t);break;case`vertical`:t.y<=i.y&&(r=a,i=t);break}}return r?{distance:i,hitRegion:r}:void 0}function Fh(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function Ih(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:Hh(e),b:Hh(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();hh(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:Vh(Bh(n.a)),b:Vh(Bh(n.b))};if(i.a===i.b){let e=r.childNodes,t={a:n.a.at(-1),b:n.b.at(-1)},i=e.length;for(;i--;){let n=e[i];if(n===t.a)return 1;if(n===t.b)return-1}}return Math.sign(i.a-i.b)}var Lh=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Rh(e){let t=getComputedStyle(Uh(e)??e).display;return t===`flex`||t===`inline-flex`}function zh(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||Rh(e))||+t.opacity<1||`transform`in t&&t.transform!==`none`||`webkitTransform`in t&&t.webkitTransform!==`none`||`mixBlendMode`in t&&t.mixBlendMode!==`normal`||`filter`in t&&t.filter!==`none`||`webkitFilter`in t&&t.webkitFilter!==`none`||`isolation`in t&&t.isolation===`isolate`||Lh.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function Bh(e){let t=e.length;for(;t--;){let n=e[t];if(hh(n,`Missing node`),zh(n))return n}return null}function Vh(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Hh(e){let t=[];for(;e;)t.push(e),e=Uh(e);return t}function Uh(e){let{parentNode:t}=e;return Fh(t)?t.host:t}function Wh(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function Gh({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!yh(n)||n.contains(e)||e.contains(n))return!0;if(Ih(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(Wh(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function Kh(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=wh(r),a=Ph(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&Gh({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function qh(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function Jh(e,t,n=0){return Math.abs(fh(e)-fh(t))<=n}function Yh(e,t){return Jh(e,t)?0:e>t?1:-1}function Xh({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:r}){let{collapsedSize:i=0,collapsible:a,disabled:o,maxSize:s=100,minSize:c=0}=t;if(o&&!e)return n;if(Yh(r,c)<0)if(a){let e=(i+c)/2;r=Yh(r,e)<0?i:c}else r=c;return r=Math.min(s,r),r=fh(r),r}function Zh({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(Jh(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;hh(u!=null,`Invalid first pivot index`),hh(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];hh(r,`Panel constraints not found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=s[t];if(hh(n!=null,`Previous layout not found for panel index ${t}`),Jh(n,i)){let t=o-n;Yh(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];hh(r,`No panel constraints found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=s[t];if(hh(n!=null,`Previous layout not found for panel index ${t}`),Jh(n,o)){let t=n-i;Yh(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];hh(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&Yh(i,c)<0)if(e>0){let t=c-o,n=t/2;Yh(i+e,c)<0&&(e=Yh(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;Yh(i-e,c)<0&&(e=Yh(100+e,n)>0?0:-t)}break}}{let t=e<0?1:-1,r=e<0?d:u,i=0;for(;;){let e=s[r];hh(e!=null,`Previous layout not found for panel index ${r}`);let a=Xh({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:e,size:100})-e;if(i+=a,r+=t,r<0||r>=n.length)break}let a=Math.min(Math.abs(e),Math.abs(i));e=e<0?0-a:a}{let t=e<0?u:d;for(;t>=0&&t<n.length;){let r=Math.abs(e)-Math.abs(f),i=s[t];hh(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=Xh({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!Jh(i,c)&&(f+=i-c,l[t]=c,f.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?t--:t++}}if(qh(c,l))return i;{let t=e<0?d:u,r=s[t];hh(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=Xh({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!Jh(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];hh(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=Xh({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(Jh(i,s)||(t-=s-i,l[r]=s),Jh(t,0))break;e>0?r--:r++}}}if(!Jh(Object.values(l).reduce((e,t)=>t+e,0),100,.1))return i;let p=Object.keys(i);return l.reduce((e,t,n)=>(e[p[n]]=t,e),{})}function Qh(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||Yh(e[n],t[n])!==0)return!1;return!0}function $h({layout:e,panelConstraints:t}){let n=Object.values(e),r=[...n],i=r.reduce((e,t)=>e+t,0);if(r.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${r.map(e=>`${e}%`).join(`, `)}`);if(!Jh(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];hh(t!=null,`No layout data found for index ${e}`),r[e]=100/i*t}let a=0;for(let e=0;e<t.length;e++){let i=n[e];hh(i!=null,`No layout data found for index ${e}`);let o=r[e];hh(o!=null,`No layout data found for index ${e}`);let s=Xh({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!Jh(a,0))for(let e=0;e<t.length;e++){let n=r[e];hh(n!=null,`No layout data found for index ${e}`);let i=n+a,o=Xh({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,Jh(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function eg({groupId:e,panelId:t}){let n=()=>{let t=jh();for(let[n,{defaultLayoutDeferred:r,derivedPanelConstraints:i,layout:a,groupSize:o,separatorToPanels:s}]of t)if(n.id===e)return{defaultLayoutDeferred:r,derivedPanelConstraints:i,group:n,groupSize:o,layout:a,separatorToPanels:s};throw Error(`Group ${e} not found`)},r=()=>{let e=n().derivedPanelConstraints.find(e=>e.panelId===t);if(e!==void 0)return e;throw Error(`Panel constraints not found for Panel ${t}`)},i=()=>{let e=n().group.panels.find(e=>e.id===t);if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},a=()=>{let e=n().layout[t];if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},o=e=>{let r=a();if(e===r)return;let{defaultLayoutDeferred:i,derivedPanelConstraints:o,group:s,groupSize:c,layout:l,separatorToPanels:u}=n(),d=s.panels.findIndex(e=>e.id===t),f=d===s.panels.length-1,p=$h({layout:Zh({delta:f?r-e:e-r,initialLayout:l,panelConstraints:o,pivotIndices:f?[d-1,d]:[d,d+1],prevLayout:l,trigger:`imperative-api`}),panelConstraints:o});Qh(l,p)||Nh(s,{defaultLayoutDeferred:i,derivedPanelConstraints:o,groupSize:c,layout:p,separatorToPanels:u})};return{collapse:()=>{let{collapsible:e,collapsedSize:t}=r(),{mutableValues:n}=i(),s=a();e&&s!==t&&(n.expandToSize=s,o(t))},expand:()=>{let{collapsible:e,collapsedSize:t,minSize:n}=r(),{mutableValues:s}=i(),c=a();if(e&&c===t){let e=s.expandToSize??n;e===0&&(e=1),o(e)}},getSize:()=>{let{group:e}=n(),t=a(),{element:r}=i();return{asPercentage:t,inPixels:e.orientation===`horizontal`?r.offsetWidth:r.offsetHeight}},isCollapsed:()=>{let{collapsible:e,collapsedSize:t}=r(),n=a();return e&&Jh(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=ph({group:t});o(fh(dh({groupSize:a,panelElement:r,styleProp:e})/a*100))}}}function tg(e){e.defaultPrevented||Kh(e,jh()).forEach(t=>{if(t.separator&&!t.separator.disableDoubleClick){let n=t.panels.find(e=>e.panelConstraints.defaultSize!==void 0);if(n){let r=n.panelConstraints.defaultSize,i=eg({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function ng(e){let t=jh();for(let[n]of t)if(n.separators.some(t=>t.element===e))return n;throw Error(`Could not find parent Group for separator element`)}function rg({groupId:e}){let t=()=>{let t=jh();for(let[n,r]of t)if(n.id===e)return{group:n,...r};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){let{defaultLayoutDeferred:e,layout:n}=t();return e?{}:n},setLayout(e){let{defaultLayoutDeferred:n,derivedPanelConstraints:r,group:i,groupSize:a,layout:o,separatorToPanels:s}=t(),c=$h({layout:e,panelConstraints:r});return n?o:(Qh(o,c)||Nh(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function ig(e,t){let n=ng(e),r=Ah(n.id,!0),i=n.separators.find(t=>t.element===e);hh(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);hh(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=rg({groupId:n.id}).getLayout(),c=$h({layout:Zh({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});Qh(s,c)||Nh(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels})}function ag(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=ng(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&ig(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&ig(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&ig(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&ig(t,-5);break;case`End`:e.preventDefault(),ig(t,100);break;case`Enter`:{e.preventDefault();let n=ng(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=Ah(n.id,!0),o=n.separators.find(e=>e.element===t);hh(o,`Matching separator not found`);let s=a.get(o);hh(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(hh(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];ig(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=ng(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);hh(r!==null,`Index not found`),n[e.shiftKey?r>0?r-1:n.length-1:r+1<n.length?r+1:0].focus({preventScroll:!0});break}case`Home`:e.preventDefault(),ig(t,-100);break}}var og={cursorFlags:0,state:`inactive`},sg=new Th;function cg(){return og}function lg(e){return sg.addListener(`change`,e)}function ug(e){let t=og,n={...og};n.cursorFlags=e,og=n,sg.emit(`change`,{prev:t,next:n})}function dg(e){let t=og;og=e,sg.emit(`change`,{prev:t,next:e})}function fg(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=jh(),n=Kh(e,t),r=new Map,i=!1;n.forEach(e=>{e.separator&&(i||(i=!0,e.separator.element.focus({preventScroll:!0})));let n=t.get(e.group);n&&r.set(e.group,n.layout)}),dg({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}var pg=e=>e,mg=()=>{},hg=1,gg=2,_g=4,vg=8,yg=3,bg=12,xg;function Sg(){return xg===void 0&&(xg=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(xg=!0)),xg}function Cg({cursorFlags:e,groups:t,state:n}){let r=0,i=0;switch(n){case`active`:case`hover`:t.forEach(e=>{if(!e.mutableState.disableCursor)switch(e.orientation){case`horizontal`:r++;break;case`vertical`:i++;break}})}if(!(r===0&&i===0)){switch(n){case`active`:if(e&&Sg()){let t=(e&hg)!==0,n=(e&gg)!==0,r=(e&_g)!==0,i=(e&vg)!==0;if(t)return r?`se-resize`:i?`ne-resize`:`e-resize`;if(n)return r?`sw-resize`:i?`nw-resize`:`w-resize`;if(r)return`s-resize`;if(i)return`n-resize`}break}return Sg()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var wg=new WeakMap;function Tg(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=wg.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&e.adoptedStyleSheets.push(n));let r=cg();switch(r.state){case`active`:case`hover`:{let e=Cg({cursorFlags:r.cursorFlags,groups:r.hitRegions.map(e=>e.group),state:r.state}),i=`*, *:hover {cursor: ${e} !important; }`;if(t===i)return;t=i,e?n.cssRules.length===0?n.insertRule(i):n.replaceSync(i):n.cssRules.length===1&&n.deleteRule(0);break}case`inactive`:t=void 0,n.cssRules.length===1&&n.deleteRule(0);break}wg.set(e,{prevStyle:t,styleSheet:n})}function Eg({document:e,event:t,hitRegions:n,initialLayoutMap:r,mountedGroups:i,pointerDownAtPoint:a,prevCursorFlags:o}){let s=0;n.forEach(e=>{let{group:n,groupSize:o}=e,{orientation:c,panels:l}=n,{disableCursor:u}=n.mutableState,d=0;d=a?c===`horizontal`?(t.clientX-a.x)/o*100:(t.clientY-a.y)/o*100:c===`horizontal`?t.clientX<0?-100:100:t.clientY<0?-100:100;let f=r.get(n),p=i.get(n);if(!f||!p)return;let{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:_,separatorToPanels:v}=p;if(h&&_&&v){let t=Zh({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(Qh(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?hg:gg;break;case`vertical`:s|=d<0?_g:vg;break}}else Nh(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&yg:c|=s&yg,t.movementY===0?c|=o&bg:c|=s&bg,ug(c),Tg(e)}function Dg(e){let t=jh(),n=cg();switch(n.state){case`active`:Eg({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function Og(e){if(e.defaultPrevented)return;let t=cg(),n=jh();switch(t.state){case`active`:if(e.buttons===0){dg({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{let t=Ah(e.group.id,!0);Nh(e.group,t)});return}for(let n of t.hitRegions)if(n.separator){let{element:t}=n.separator;t.hasPointerCapture?.(e.pointerId)||t.setPointerCapture?.(e.pointerId)}Eg({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=Kh(e,n);r.length===0?t.state!==`inactive`&&dg({cursorFlags:0,state:`inactive`}):dg({cursorFlags:0,hitRegions:r,state:`hover`}),Tg(e.currentTarget);break}}}function kg(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(cg().state){case`hover`:dg({cursorFlags:0,state:`inactive`})}}function Ag(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=cg();switch(t.state){case`active`:dg({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&(Tg(e.currentTarget),t.hitRegions.forEach(e=>{let t=Ah(e.group.id,!0);Nh(e.group,t)}),e.preventDefault())}}function jg(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=fh(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=fh((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function Mg(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=ph({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:fh(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function Ng(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function Pg({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:r}){if(n<=0||t<=0||n===t)return r;let i=0,a=0,o=!1,s=new Map,c=[];for(let l of e.panels){let e=r[l.id]??0;switch(l.panelConstraints.groupResizeBehavior){case`preserve-pixel-size`:{o=!0;let r=fh(e/100*n/t*100);s.set(l.id,r),i+=r;break}default:c.push(l.id),a+=e;break}}if(!o||c.length===0)return r;let l=100-i,u={...r};if(s.forEach((e,t)=>{u[t]=e}),a>0)for(let e of c)u[e]=fh((r[e]??0)/a*l);else{let e=fh(l/c.length);for(let t of c)u[t]=e}return u}function Fg(e,t){let n=e.map(e=>e.id),r=Object.keys(t);if(n.length!==r.length)return!1;for(let e of n)if(!r.includes(e))return!1;return!0}var Ig=new Map;function Lg(e){let t=!0;hh(e.element.ownerDocument.defaultView,`Cannot register an unmounted Group`);let n=e.element.ownerDocument.defaultView.ResizeObserver,r=new Set,i=new Set,a=new n(n=>{for(let r of n){let{borderBoxSize:n,target:i}=r;if(i===e.element){if(t){let t=ph({group:e});if(t===0)return;let n=Ah(e.id);if(!n)return;let r=mh(e),i=n.defaultLayoutDeferred?jg(r):n.layout,a=$h({layout:Pg({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&Qh(n.layout,a)&&Ng(n.derivedPanelConstraints,r)&&n.groupSize===t)return;Nh(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else Mg(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{hh(!r.has(e.id),`Panel ids must be unique; id "${e.id}" was used more than once`),r.add(e.id),e.onResize&&a.observe(e.element)});let o=ph({group:e}),s=mh(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(Fg(e.panels,l)||(l=void 0));let u=$h({layout:e.mutableState.layouts[c]??l??jg(s),panelConstraints:s}),d=e.element.ownerDocument;Ig.set(d,(Ig.get(d)??0)+1);let f=new Map;return wh(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),Nh(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{hh(!i.has(e.id),`Separator ids must be unique; id "${e.id}" was used more than once`),i.add(e.id),e.element.addEventListener(`keydown`,ag)}),Ig.get(d)===1&&(d.addEventListener(`dblclick`,tg,!0),d.addEventListener(`pointerdown`,fg,!0),d.addEventListener(`pointerleave`,Dg),d.addEventListener(`pointermove`,Og),d.addEventListener(`pointerout`,kg),d.addEventListener(`pointerup`,Ag,!0)),function(){t=!1,Ig.set(d,Math.max(0,(Ig.get(d)??0)-1)),Oh(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,ag)}),Ig.get(d)||(d.removeEventListener(`dblclick`,tg,!0),d.removeEventListener(`pointerdown`,fg,!0),d.removeEventListener(`pointerleave`,Dg),d.removeEventListener(`pointermove`,Og),d.removeEventListener(`pointerout`,kg),d.removeEventListener(`pointerup`,Ag,!0)),a.disconnect()}}function Rg(){let[e,t]=(0,X.useState)({});return[e,(0,X.useCallback)(()=>t({}),[])]}function zg(e){let t=(0,X.useId)();return`${e??t}`}var Bg=typeof window<`u`?X.useLayoutEffect:X.useEffect;function Vg(e){let t=(0,X.useRef)(e);return Bg(()=>{t.current=e},[e]),(0,X.useCallback)((...e)=>t.current?.(...e),[t])}function Hg(...e){return Vg(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t;break}})})}function Ug(e){let t=(0,X.useRef)({...e});return Bg(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var Wg=(0,X.createContext)(null);function Gg(e,t){let n=(0,X.useRef)({getLayout:()=>({}),setLayout:pg});(0,X.useImperativeHandle)(t,()=>n.current,[]),Bg(()=>{Object.assign(n.current,rg({groupId:e}))})}function Kg({children:e,className:t,defaultLayout:n,disableCursor:r,disabled:i,elementRef:a,groupRef:o,id:s,onLayoutChange:c,onLayoutChanged:l,orientation:u=`horizontal`,resizeTargetMinimumSize:d={coarse:20,fine:10},style:f,...p}){let m=(0,X.useRef)({onLayoutChange:{},onLayoutChanged:{}}),h=Vg(e=>{Qh(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=Vg(e=>{Qh(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e))}),_=zg(s),v=(0,X.useRef)(null),[y,b]=Rg(),x=(0,X.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),S=Hg(v,a);Gg(_,o);let C=Vg((e,t)=>{let r=cg(),i=kh(e),a=Ah(e);if(a){let e=!1;switch(r.state){case`active`:e=r.hitRegions.some(e=>e.group===i);break}return{flexGrow:a.layout[t]??1,pointerEvents:e?`none`:void 0}}if(n?.[t])return{flexGrow:n?.[t]}}),w=Ug({defaultLayout:n,disableCursor:r}),T=(0,X.useMemo)(()=>({get disableCursor(){return!!w.disableCursor},getPanelStyles:C,id:_,orientation:u,registerPanel:e=>{let t=x.current;return t.panels=gh(u,[...t.panels,e]),b(),()=>{t.panels=t.panels.filter(t=>t!==e),b()}},registerSeparator:e=>{let t=x.current;return t.separators=gh(u,[...t.separators,e]),b(),()=>{t.separators=t.separators.filter(t=>t!==e),b()}},updatePanelProps:(e,{disabled:t})=>{let n=x.current.panels.find(t=>t.id===e);n&&(n.panelConstraints.disabled=t);let r=kh(_),i=Ah(_);r&&i&&Nh(r,{...i,derivedPanelConstraints:mh(r)})},updateSeparatorProps:(e,{disabled:t,disableDoubleClick:n})=>{let r=x.current.separators.find(t=>t.id===e);r&&(r.disabled=t,r.disableDoubleClick=n)}}),[C,_,b,u,w]),E=(0,X.useRef)(null);return Bg(()=>{let e=v.current;if(e===null)return;let t=x.current,n;if(w.defaultLayout!==void 0&&Object.keys(w.defaultLayout).length===t.panels.length){n={};for(let e of t.panels){let t=w.defaultLayout[e.id];t!==void 0&&(n[e.id]=t)}}let r={disabled:!!i,element:e,id:_,mutableState:{defaultLayout:n,disableCursor:!!w.disableCursor,expandedPanelSizes:x.current.lastExpandedPanelSizes,layouts:x.current.layouts},orientation:u,panels:t.panels,resizeTargetMinimumSize:t.resizeTargetMinimumSize,separators:t.separators};E.current=r;let a=Lg(r),{defaultLayoutDeferred:o,derivedPanelConstraints:s,layout:c}=Ah(r.id,!0);!o&&s.length>0&&(h(c),g(c));let l=Mh(_,e=>{let{defaultLayoutDeferred:t,derivedPanelConstraints:n,layout:i}=e.next;if(t||n.length===0)return;let a=r.panels.map(({id:e})=>e).join(`,`);r.mutableState.layouts[a]=i,n.forEach(t=>{if(t.collapsible){let{layout:n}=e.prev??{};if(n){let e=Jh(t.collapsedSize,i[t.panelId]),a=Jh(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=cg().state!==`active`;h(i),o&&g(i)});return()=>{E.current=null,a(),l()}},[i,_,g,h,u,y,w]),(0,X.useEffect)(()=>{let e=E.current;e&&(e.mutableState.defaultLayout=n,e.mutableState.disableCursor=!!r)}),(0,Y.jsx)(Wg.Provider,{value:T,children:(0,Y.jsx)(`div`,{...p,className:t,"data-group":!0,"data-testid":_,id:_,ref:S,style:{height:`100%`,width:`100%`,overflow:`hidden`,...f,display:`flex`,flexDirection:u===`horizontal`?`row`:`column`,flexWrap:`nowrap`,touchAction:u===`horizontal`?`pan-y`:`pan-x`},children:e})})}Kg.displayName=`Group`;function qg(){let e=(0,X.useContext)(Wg);return hh(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function Jg(e,t){let{id:n}=qg(),r=(0,X.useRef)({collapse:mg,expand:mg,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:mg});(0,X.useImperativeHandle)(t,()=>r.current,[]),Bg(()=>{Object.assign(r.current,eg({groupId:n,panelId:e}))})}function Yg({children:e,className:t,collapsedSize:n=`0%`,collapsible:r=!1,defaultSize:i,disabled:a,elementRef:o,groupResizeBehavior:s=`preserve-relative-size`,id:c,maxSize:l=`100%`,minSize:u=`0%`,onResize:d,panelRef:f,style:p,...m}){let h=!!c,g=zg(c),_=Ug({disabled:a}),v=(0,X.useRef)(null),y=Hg(v,o),{getPanelStyles:b,id:x,orientation:S,registerPanel:C,updatePanelProps:w}=qg(),T=d!==null,E=Vg((e,t,n)=>{d?.(e,c,n)});Bg(()=>{let e=v.current;if(e!==null)return C({element:e,id:g,idIsStable:h,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:T?E:void 0,panelConstraints:{groupResizeBehavior:s,collapsedSize:n,collapsible:r,defaultSize:i,disabled:_.disabled,maxSize:l,minSize:u}})},[s,n,r,i,T,g,h,l,u,E,C,_]),(0,X.useEffect)(()=>{w(g,{disabled:a})},[a,g,w]),Jg(g,f);let D=()=>{let e=b(x,g);if(e)return JSON.stringify(e)},O=(0,X.useSyncExternalStore)(e=>Mh(x,e),D,D),k;return k=O?JSON.parse(O):i?{flexGrow:void 0,flexShrink:void 0,flexBasis:i}:{flexGrow:1},(0,Y.jsx)(`div`,{...m,"data-disabled":a||void 0,"data-panel":!0,"data-testid":g,id:g,ref:y,style:{...Xg,display:`flex`,flexBasis:0,flexShrink:1,overflow:`visible`,...k},children:(0,Y.jsx)(`div`,{className:t,style:{maxHeight:`100%`,maxWidth:`100%`,flexGrow:1,overflow:`auto`,...p,touchAction:S===`horizontal`?`pan-y`:`pan-x`},children:e})})}Yg.displayName=`Panel`;var Xg={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function Zg(){return(0,X.useRef)(null)}function Qg({layout:e,panelConstraints:t,panelId:n,panelIndex:r}){let i,a,o=e[n],s=t.find(e=>e.panelId===n);if(s){let c=s.maxSize,l=s.collapsible?s.collapsedSize:s.minSize,u=[r,r+1];a=$h({layout:Zh({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=$h({layout:Zh({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function $g({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...s}){let c=zg(a),l=Ug({disabled:n,disableDoubleClick:r}),[u,d]=(0,X.useState)({}),[f,p]=(0,X.useState)(`inactive`),m=(0,X.useRef)(null),h=Hg(m,i),{disableCursor:g,id:_,orientation:v,registerSeparator:y,updateSeparatorProps:b}=qg(),x=v===`horizontal`?`vertical`:`horizontal`;Bg(()=>{let e=m.current;if(e!==null){let t={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:e,id:c},n=y(t),r=lg(e=>{p(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=Mh(_,e=>{let{derivedPanelConstraints:n,layout:r,separatorToPanels:i}=e.next,a=i.get(t);if(a){let e=a[0],t=a.indexOf(e);d(Qg({layout:r,panelConstraints:n,panelId:e.id,panelIndex:t}))}});return()=>{r(),i(),n()}}},[_,c,y,l]),(0,X.useEffect)(()=>{b(c,{disabled:n,disableDoubleClick:r})},[n,r,c,b]);let S;return n&&!g&&(S=`not-allowed`),(0,Y.jsx)(`div`,{...s,"aria-controls":u.valueControls,"aria-disabled":n||void 0,"aria-orientation":x,"aria-valuemax":u.valueMax,"aria-valuemin":u.valueMin,"aria-valuenow":u.valueNow,children:e,className:t,"data-separator":n?`disabled`:f,"data-testid":c,id:c,ref:h,role:`separator`,style:{flexBasis:`auto`,cursor:S,...o,flexGrow:0,flexShrink:0,touchAction:`none`},tabIndex:n?void 0:0})}$g.displayName=`Separator`;async function e_(e){let t=await fetch(`/api/backlinks?docName=${encodeURIComponent(e)}`);if(!t.ok)throw Error(`Server error: ${t.status} ${t.statusText}`);let n=await t.json();if(!n.ok)throw Error(n.error??`Failed to load backlinks`);return n.backlinks??[]}function t_(e){let t=(0,Z.c)(32),{docName:n,className:r}=e,i=r===void 0?``:r,{folderPaths:a,pages:o,loading:s}=Vn(),c,l;t[0]===n?(c=t[1],l=t[2]):(c=[`backlinks`,n],l=()=>e_(n),t[0]=n,t[1]=c,t[2]=l);let u;t[3]!==n||t[4]!==s||t[5]!==o?(u=!s&&o.has(n),t[3]=n,t[4]=s,t[5]=o,t[6]=u):u=t[6];let d;t[7]!==c||t[8]!==l||t[9]!==u?(d={queryKey:c,queryFn:l,enabled:u},t[7]=c,t[8]=l,t[9]=u,t[10]=d):d=t[10];let{data:f,isLoading:p,error:m}=N(d),g;t[11]===f?g=t[12]:(g=f===void 0?[]:f,t[11]=f,t[12]=g);let _=g,v;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Y.jsx)(j,{children:`Backlinks`}),t[13]=v):v=t[13];let y;t[14]!==_||t[15]!==p?(y=!p&&(0,Y.jsx)(A,{children:_.length}),t[14]=_,t[15]=p,t[16]=y):y=t[16];let b;t[17]===y?b=t[18]:(b=(0,Y.jsxs)(O,{children:[v,y]}),t[17]=y,t[18]=b);let x;t[19]!==_||t[20]!==m||t[21]!==a||t[22]!==p||t[23]!==o?(x=m?(0,Y.jsx)(h,{children:m instanceof Error?m.message:`Failed to load backlinks`}):_.length===0&&!p?(0,Y.jsx)(S,{children:`No pages link here yet.`}):(0,Y.jsx)(`div`,{className:`flex flex-col gap-2`,children:_.map((e,t)=>(0,Y.jsxs)(`button`,{type:`button`,className:`block w-full rounded-lg border border-border bg-background/80 px-3 py-2 text-left transition-colors hover:bg-accent hover:text-accent-foreground`,onClick:()=>{let t=Ae(e.source,{pages:o,folderPaths:a});window.location.assign(Nn(t.hashDocName,e.anchor))},children:[(0,Y.jsx)(`div`,{className:`truncate text-sm font-medium`,children:e.title}),(0,Y.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:e.source}),e.snippet?(0,Y.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:e.snippet}):null]},`${e.source}-${t}`))}),t[19]=_,t[20]=m,t[21]=a,t[22]=p,t[23]=o,t[24]=x):x=t[24];let C;t[25]!==p||t[26]!==x?(C=(0,Y.jsx)(D,{"aria-busy":p,children:x}),t[25]=p,t[26]=x,t[27]=C):C=t[27];let w;return t[28]!==i||t[29]!==b||t[30]!==C?(w=(0,Y.jsxs)(M,{className:i,children:[b,C]}),t[28]=i,t[29]=b,t[30]=C,t[31]=w):w=t[31],w}function n_(e){let t=e.split(`/`);return t.length<=2?e:`…/${t.slice(-2).join(`/`)}`}async function r_(e){let t=await fetch(`/api/forward-links?docName=${encodeURIComponent(e)}`);if(!t.ok)throw Error(`Server error: ${t.status} ${t.statusText}`);let n=await t.json();if(!n.ok)throw Error(n.error??`Failed to load outgoing links`);return n.forwardLinks??[]}function i_(e){let t=(0,Z.c)(50),{docName:n,className:r}=e,i=r===void 0?``:r,{folderPaths:a,pages:o,loading:s}=Vn(),c,l;t[0]===n?(c=t[1],l=t[2]):(c=[`forward-links`,n],l=()=>r_(n),t[0]=n,t[1]=c,t[2]=l);let u;t[3]!==n||t[4]!==o||t[5]!==s?(u=!s&&o.has(n),t[3]=n,t[4]=o,t[5]=s,t[6]=u):u=t[6];let d;t[7]!==c||t[8]!==l||t[9]!==u?(d={queryKey:c,queryFn:l,enabled:u},t[7]=c,t[8]=l,t[9]=u,t[10]=d):d=t[10];let{data:f,isLoading:p,error:m}=N(d),g;t[11]===f?g=t[12]:(g=f===void 0?[]:f,t[11]=f,t[12]=g);let _=g,[v,y]=(0,X.useState)(null),b;if(t[13]!==v||t[14]!==a||t[15]!==o){let e=v===null?null:Et(v.docName,{pages:o,folderPaths:a});b=e===null?null:e.kind===`create`?{initialDir:e.initialDir,suggestedName:e.suggestedName}:Ie(e),t[13]=v,t[14]=a,t[15]=o,t[16]=b}else b=t[16];let x=b,C;t[17]!==a||t[18]!==o||t[19]!==s?(C=function(e){if(e.kind===`external`){window.open(e.url,`_blank`,`noopener,noreferrer`);return}let t=Et(e.docName,{pages:o,folderPaths:a});if(!s&&t.kind===`create`){y(e);return}let n=t.kind===`navigate`?t.hashDocName:e.docName;window.location.assign(Nn(n,e.anchor))},t[17]=a,t[18]=o,t[19]=s,t[20]=C):C=t[20];let w=C,T;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Y.jsx)(j,{children:`Outgoing Links`}),t[21]=T):T=t[21];let E;t[22]!==p||t[23]!==_?(E=!p&&(0,Y.jsx)(A,{children:_.length}),t[22]=p,t[23]=_,t[24]=E):E=t[24];let k;t[25]===E?k=t[26]:(k=(0,Y.jsxs)(O,{children:[T,E]}),t[25]=E,t[26]=k);let P;t[27]!==m||t[28]!==a||t[29]!==w||t[30]!==p||t[31]!==_||t[32]!==o||t[33]!==s?(P=m?(0,Y.jsx)(h,{children:m instanceof Error?m.message:`Failed to load outgoing links`}):_.length===0&&!p?(0,Y.jsx)(S,{children:`This page doesn't link to anything yet.`}):(0,Y.jsx)(`div`,{className:`flex flex-col gap-2`,children:_.map(e=>{let t=e.kind===`doc`?Et(e.docName,{pages:o,folderPaths:a}):null,n=e.kind===`doc`&&!s&&t?.kind===`create`,r=e.kind===`doc`&&!s&&t?.kind===`navigate`&&t.displayState===`folder`,i=e.kind===`doc`?n_(e.docName):e.url,c=e.kind===`doc`&&e.title===e.docName?i:e.title,l=e.kind===`doc`?`doc:${e.docName}:${e.anchor??``}`:`ext:${e.url}`;return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(K,{variant:`outline`,className:W(`h-auto w-full items-start justify-start whitespace-normal px-3 py-2 text-left`,n&&`border-amber-300 bg-amber-50/70 text-amber-950 hover:bg-amber-100 dark:border-amber-900 dark:bg-amber-950/20 dark:text-amber-200 dark:hover:bg-amber-950/35`,r&&`border-sky-300 bg-sky-50/70 text-sky-950 hover:bg-sky-100 dark:border-sky-900 dark:bg-sky-950/20 dark:text-sky-100 dark:hover:bg-sky-950/35`),onClick:()=>w(e),children:(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`div`,{className:`truncate text-sm font-medium`,title:e.kind===`doc`&&e.title===e.docName?e.docName:e.kind===`external`?e.url:void 0,children:(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Y.jsx)(`span`,{children:c}),e.kind===`external`?(0,Y.jsx)(Te,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}):null]})}),e.kind===`doc`&&e.title!==e.docName?(0,Y.jsx)(`div`,{className:`truncate font-mono text-xs text-muted-foreground`,title:e.docName,children:i}):null,e.kind===`external`?(0,Y.jsx)(`div`,{className:`mt-0.5 truncate font-mono text-xs text-muted-foreground`,children:e.url}):null,n?(0,Y.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-1.5 text-xs text-amber-700 dark:text-amber-300`,children:[(0,Y.jsx)(We,{className:`size-3 shrink-0`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{children:`Missing page. Click to create.`})]}):null,r?(0,Y.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-1.5 text-xs text-sky-700 dark:text-sky-300`,children:[(0,Y.jsx)(nt,{className:`size-3 shrink-0`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{children:`Folder target. Click to open the overview.`})]}):null,e.snippet?(0,Y.jsx)(`p`,{className:`mt-1 break-words text-sm text-muted-foreground`,children:e.snippet}):null]})}),r?(0,Y.jsxs)(K,{variant:`outline`,size:`sm`,className:`self-start`,onClick:()=>y(e),children:[(0,Y.jsx)(We,{className:`size-3.5`}),`Create index note`]}):null]},l)})}),t[27]=m,t[28]=a,t[29]=w,t[30]=p,t[31]=_,t[32]=o,t[33]=s,t[34]=P):P=t[34];let F;t[35]!==p||t[36]!==P?(F=(0,Y.jsx)(D,{"aria-busy":p,children:P}),t[35]=p,t[36]=P,t[37]=F):F=t[37];let I;t[38]!==i||t[39]!==k||t[40]!==F?(I=(0,Y.jsxs)(M,{className:i,children:[k,F]}),t[38]=i,t[39]=k,t[40]=F,t[41]=I):I=t[41];let ee=v!==null,L=x?.initialDir??``,R=x?.suggestedName,z;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(z=e=>{e||y(null)},t[42]=z):z=t[42];let B;t[43]!==ee||t[44]!==L||t[45]!==R?(B=(0,Y.jsx)(qe,{open:ee,kind:`file`,initialDir:L,suggestedName:R,onOpenChange:z}),t[43]=ee,t[44]=L,t[45]=R,t[46]=B):B=t[46];let V;return t[47]!==I||t[48]!==B?(V=(0,Y.jsxs)(Y.Fragment,{children:[I,B]}),t[47]=I,t[48]=B,t[49]=V):V=t[49],V}function a_(e){let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/1e3);if(r<60)return`just now`;if(r<3600)return`${Math.floor(r/60)} min ago`;if(r<86400)return`${Math.floor(r/3600)}h ago`;if(r<86400*2)return`yesterday`;let i=Math.floor(r/86400);return i<7?`${i} days ago`:t.toLocaleDateString()}function o_(e){return e.type===`upstream`?`Upstream sync`:e.contributors.length===1?e.contributors[0].name:e.contributors.length>1?e.contributors.map(e=>e.name).join(`, `):e.author===`openknowledge-server`||e.author===`server`?`Auto-save`:e.author}function s_(e){let t=(0,Z.c)(17),n,r;if(t[0]===e?(n=t[1],r=t[2]):({icon:n,...r}=e,t[0]=e,t[1]=n,t[2]=r),n===`claude`){let e;return t[3]===r?e=t[4]:(e=(0,Y.jsx)(me,{...r}),t[3]=r,t[4]=e),e}if(n===`cursor`){let e;return t[5]===r?e=t[6]:(e=(0,Y.jsx)(le,{...r}),t[5]=r,t[6]=e),e}if(n===`windsurf`){let e;return t[7]===r?e=t[8]:(e=(0,Y.jsx)(pe,{...r}),t[7]=r,t[8]=e),e}if(n===`openai`){let e;return t[9]===r?e=t[10]:(e=(0,Y.jsx)(ye,{...r}),t[9]=r,t[10]=e),e}if(n===`cline`){let e;return t[11]===r?e=t[12]:(e=(0,Y.jsx)(ue,{...r}),t[11]=r,t[12]=e),e}if(n===`github`){let e;return t[13]===r?e=t[14]:(e=(0,Y.jsx)(ge,{...r}),t[13]=r,t[14]=e),e}let i=r,a;return t[15]===i?a=t[16]:(a=(0,Y.jsx)(xe,{strokeWidth:1.5,...i}),t[15]=i,t[16]=a),a}function c_(e){let t=(0,Z.c)(17),{entry:n,isDark:r}=e;if(n.type===`upstream`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(ki,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[0]=e):e=t[0],e}if(n.contributors.length>0){let e=n.contributors[0],i=e.colorSeed??e.name,a;t[1]===i?a=t[2]:(a=gn(i),t[1]=i,t[2]=a);let o=a,s=r?Yn[o]??Bn[o]:Bn[o],c;t[3]!==s||t[4]!==i?(c=s??hn(i),t[3]=s,t[4]=i,t[5]=c):c=t[5];let l=c;if(o!==`bot`){let e;t[6]===l?e=t[7]:(e={color:l},t[6]=l,t[7]=e);let n;return t[8]!==o||t[9]!==e?(n=(0,Y.jsx)(s_,{icon:o,width:14,height:14,className:`shrink-0`,style:e}),t[8]=o,t[9]=e,t[10]=n):n=t[10],n}if(e.name===`File System`){let e;return t[11]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(Mi,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[11]=e):e=t[11],e}if(e.name===`Open Knowledge (service)`||e.name===`Git (upstream)`){let e;return t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(Jr,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[12]=e):e=t[12],e}let u;return t[13]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Y.jsx)(ga,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[13]=u):u=t[13],u}if(n.authorEmail.includes(`agent`)||n.author.includes(`agent`)||n.authorEmail.includes(`cursor`)||n.authorEmail.includes(`claude`)){let e;return t[14]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(xe,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[14]=e):e=t[14],e}if(n.author===`openknowledge-server`||n.author===`server`){let e;return t[15]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(Jr,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[15]=e):e=t[15],e}let i;return t[16]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Y.jsx)(ga,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[16]=i):i=t[16],i}function l_(e){let t=(0,Z.c)(7),{selected:n,onSelect:r}=e,i=n?`bg-muted`:`hover:bg-muted/50`,a;t[0]===i?a=t[1]:(a=[`group flex w-full items-center gap-3 rounded-lg px-3 py-2.5 text-left transition-colors cursor-pointer outline-none focus-visible:ring-2 focus-visible:ring-ring`,i],t[0]=i,t[1]=a);let o=a.join(` `),s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Y.jsxs)(`div`,{className:`flex items-center justify-center w-3.5 h-3.5`,children:[` `,(0,Y.jsx)(`span`,{className:`inline-block size-2 rounded-full bg-emerald-500 shrink-0`})]}),t[2]=s):s=t[2];let c;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Y.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,Y.jsx)(`p`,{className:`text-xs font-medium text-foreground`,children:`Current version`})}),t[3]=c):c=t[3];let l;return t[4]!==r||t[5]!==o?(l=(0,Y.jsxs)(`button`,{type:`button`,className:o,onClick:r,children:[s,c]}),t[4]=r,t[5]=o,t[6]=l):l=t[6],l}var u_={sha:``,timestamp:``,author:``,authorEmail:``,type:`wip`,message:``,contributors:[],checkpoint:null};function d_(e){let t=(0,Z.c)(16),{entries:n,defaultExpanded:r,selectedSha:i,onSelect:a,isDark:o}=e,[s,c]=(0,X.useState)(r);if(n.length===0)return null;let l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>c(f_),t[0]=l):l=t[0];let u;t[1]===s?u=t[2]:(u=s?(0,Y.jsx)(fe,{className:`size-3`}):(0,Y.jsx)(de,{className:`size-3`}),t[1]=s,t[2]=u);let d=s?`Hide ${n.length} auto-save${n.length>1?`s`:``}`:`Show ${n.length} auto-save${n.length>1?`s`:``}`,f;t[3]!==s||t[4]!==u||t[5]!==d?(f=(0,Y.jsxs)(`button`,{type:`button`,"aria-expanded":s,className:`flex items-center gap-1.5 rounded-lg px-3 py-2 text-xs text-muted-foreground hover:text-foreground hover:bg-muted/50 transition-colors text-left`,onClick:l,children:[u,d]}),t[3]=s,t[4]=u,t[5]=d,t[6]=f):f=t[6];let p;t[7]!==n||t[8]!==s||t[9]!==o||t[10]!==a||t[11]!==i?(p=s&&n.map(e=>(0,Y.jsx)(b_,{entry:e,selected:e.sha===i,onSelect:a,isDark:o},e.sha)),t[7]=n,t[8]=s,t[9]=o,t[10]=a,t[11]=i,t[12]=p):p=t[12];let m;return t[13]!==f||t[14]!==p?(m=(0,Y.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[f,p]}),t[13]=f,t[14]=p,t[15]=m):m=t[15],m}function f_(e){return!e}function p_(e){return e.checkpoint?e.checkpoint.kind:`save`}function m_(e){let t=p_(e);if(t===`save`)return`Save Version`;let n=e.checkpoint?.size??null,r=n!=null&&n>0?` (${h_(n)})`:``;return t===`bridge-merge-loss`?`Auto-saved before a concurrent edit${r}`:`Recovered from an external change${r}`}function h_(e){return e<1024?`${e} B`:e<1024*1024?`${Math.round(e/102.4)/10} KB`:`${Math.round(e/104857.6)/10} MB`}function g_(e){let t=[];for(let n of e.contributors)if(n.summaries)for(let e of n.summaries)t.push(e);return t}function __(e){let t=(0,Z.c)(20),{summaries:n}=e,[r,i]=(0,X.useState)(!1),a=(0,X.useId)();if(n.length===0)return null;let o,s;t[0]===n?(o=t[1],s=t[2]):([o,...s]=n,t[0]=n,t[1]=o,t[2]=s);let c;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Y.jsx)(`span`,{"aria-hidden":`true`,children:`• `}),t[3]=c):c=t[3];let l;t[4]===o?l=t[5]:(l=(0,Y.jsxs)(`li`,{className:`text-xs text-foreground/90`,children:[c,o]}),t[4]=o,t[5]=l);let u;t[6]!==r||t[7]!==s?(u=r&&s.map(y_),t[6]=r,t[7]=s,t[8]=u):u=t[8];let d;t[9]!==a||t[10]!==l||t[11]!==u?(d=(0,Y.jsxs)(`ul`,{id:a,className:`list-none`,children:[l,u]}),t[9]=a,t[10]=l,t[11]=u,t[12]=d):d=t[12];let f;t[13]!==r||t[14]!==a||t[15]!==s.length?(f=s.length>0&&(0,Y.jsxs)(`button`,{type:`button`,"aria-expanded":r,"aria-controls":a,className:`inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors cursor-pointer`,onClick:e=>{e.stopPropagation(),i(v_)},children:[r?(0,Y.jsx)(fe,{className:`size-3`}):(0,Y.jsx)(de,{className:`size-3`}),r?`Hide ${s.length} more`:`Show ${s.length} more`]}),t[13]=r,t[14]=a,t[15]=s.length,t[16]=f):f=t[16];let p;return t[17]!==d||t[18]!==f?(p=(0,Y.jsxs)(`div`,{className:`mt-0.5`,children:[d,f]}),t[17]=d,t[18]=f,t[19]=p):p=t[19],p}function v_(e){return!e}function y_(e,t){return(0,Y.jsxs)(`li`,{className:`text-xs text-foreground/90`,children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,children:`• `}),e]},`${t}-${e}`)}function b_(e){let t=(0,Z.c)(61),{entry:n,selected:r,onSelect:i,prominent:a,isDark:o}=e,s=a===void 0?!1:a,c;t[0]===n.timestamp?c=t[1]:(c=a_(n.timestamp),t[0]=n.timestamp,t[1]=c);let l=c,u;t[2]===n?u=t[3]:(u=o_(n),t[2]=n,t[3]=u);let d=u,f,p,m,h,g,_,v,y,b,x;if(t[4]!==d||t[5]!==n||t[6]!==o||t[7]!==i||t[8]!==s||t[9]!==l||t[10]!==r){let e=n.contributors.flatMap(x_),a;t[21]===n?a=t[22]:(a=g_(n),t[21]=n,t[22]=a);let c=a,u;t[23]!==n||t[24]!==i?(u=()=>i?.(n),t[23]=n,t[24]=i,t[25]=u):u=t[25];let S=u,C;t[26]!==n||t[27]!==o||t[28]!==s?(C=s?(()=>{let e=p_(n);return e===`bridge-merge-loss`?(0,Y.jsx)(De,{className:`size-3.5 shrink-0 text-amber-600 dark:text-amber-400`,"aria-hidden":`true`}):e===`external-change-rescue`?(0,Y.jsx)(Ci,{className:`size-3.5 shrink-0 text-sky-600 dark:text-sky-400`,"aria-hidden":`true`}):(0,Y.jsx)(bi,{className:`size-3.5 shrink-0 text-muted-foreground`})})():(0,Y.jsx)(c_,{entry:n,isDark:o}),t[26]=n,t[27]=o,t[28]=s,t[29]=C):C=t[29];let w=C;b=`button`,x=0;let T=r?`bg-muted`:`hover:bg-muted/50`,E;t[30]===T?E=t[31]:(E=[`group flex w-full items-start gap-3 rounded-lg px-3 py-2.5 text-left transition-colors cursor-pointer outline-none focus-visible:ring-2 focus-visible:ring-ring`,T],t[30]=T,t[31]=E),f=E.join(` `),p=S,t[32]===S?m=t[33]:(m=e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),S())},t[32]=S,t[33]=m),t[34]===w?h=t[35]:(h=(0,Y.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:w}),t[34]=w,t[35]=h),g=`min-w-0 flex-1 space-y-0.5`;let D;t[36]!==d||t[37]!==n||t[38]!==s?(D=s?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{className:`text-xs text-foreground truncate`,children:m_(n)}),(0,Y.jsx)(`span`,{className:`text-xs text-muted-foreground/50`,children:`·`}),(0,Y.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:d})]}):(0,Y.jsx)(`span`,{className:`truncate text-xs text-foreground`,children:d}),t[36]=d,t[37]=n,t[38]=s,t[39]=D):D=t[39];let O;t[40]!==n.timestamp||t[41]!==l?(O=(0,Y.jsx)(`time`,{className:`ml-auto shrink-0 text-xs text-muted-foreground/80`,dateTime:n.timestamp,title:n.timestamp,children:l}),t[40]=n.timestamp,t[41]=l,t[42]=O):O=t[42],t[43]!==D||t[44]!==O?(_=(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[D,O]}),t[43]=D,t[44]=O,t[45]=_):_=t[45],t[46]===c?v=t[47]:(v=c.length>0&&(0,Y.jsx)(__,{summaries:c}),t[46]=c,t[47]=v),y=e.length>0?(0,Y.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,title:e.join(`, `),children:e.join(`, `)}):(0,Y.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,title:n.message,children:n.message}),t[4]=d,t[5]=n,t[6]=o,t[7]=i,t[8]=s,t[9]=l,t[10]=r,t[11]=f,t[12]=p,t[13]=m,t[14]=h,t[15]=g,t[16]=_,t[17]=v,t[18]=y,t[19]=b,t[20]=x}else f=t[11],p=t[12],m=t[13],h=t[14],g=t[15],_=t[16],v=t[17],y=t[18],b=t[19],x=t[20];let S;t[48]!==g||t[49]!==_||t[50]!==v||t[51]!==y?(S=(0,Y.jsxs)(`div`,{className:g,children:[_,v,y]}),t[48]=g,t[49]=_,t[50]=v,t[51]=y,t[52]=S):S=t[52];let C;return t[53]!==f||t[54]!==p||t[55]!==m||t[56]!==h||t[57]!==S||t[58]!==b||t[59]!==x?(C=(0,Y.jsxs)(`div`,{role:b,tabIndex:x,className:f,onClick:p,onKeyDown:m,children:[h,S]}),t[53]=f,t[54]=p,t[55]=m,t[56]=h,t[57]=S,t[58]=b,t[59]=x,t[60]=C):C=t[60],C}function x_(e){return e.docs}function S_(e){let t=(0,Z.c)(43),{docName:n,onEntrySelect:r,selectedSha:i}=e,{resolvedTheme:a}=T(),o=a===`dark`,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=[],t[0]=s):s=t[0];let[c,l]=(0,X.useState)(s),[u,d]=(0,X.useState)(!1),[f,p]=(0,X.useState)(null),m=(0,X.useRef)(null),h,g;t[1]===n?(h=t[2],g=t[3]):(h=()=>{if(!n){l([]);return}let e=!1,t=async function(){if(n)try{let t=await fetch(`/api/history?docName=${encodeURIComponent(n)}&limit=100`);if(e)return;if(!t.ok){p(`History unavailable`);return}let r=await t.json();if(e)return;l(r.entries??[]),p(null)}catch(t){let n=t;if(e)return;p(`History unavailable`),console.error(`[timeline]`,n)}};return d(!0),t().finally(()=>{e||d(!1)}),m.current=setInterval(t,1e4),()=>{e=!0,m.current&&clearInterval(m.current)}},g=[n],t[1]=n,t[2]=h,t[3]=g),(0,X.useEffect)(h,g);let _,v;if(t[4]!==c){_=[];let e=[],n=!1;for(let t of c)t.type===`checkpoint`?(e.length>0&&(_.push({kind:`wip-group`,entries:e,isPreCheckpoint:!n}),e=[]),_.push({kind:`checkpoint`,entry:t}),n=!0):e.push(t);if(e.length>0){let r=!n,i;t[7]!==e||t[8]!==r?(i={kind:`wip-group`,entries:e,isPreCheckpoint:r},t[7]=e,t[8]=r,t[9]=i):i=t[9],_.push(i)}v=c.some(w_),t[4]=c,t[5]=_,t[6]=v}else _=t[5],v=t[6];let y=!v,b=!i,x;t[10]===u?x=t[11]:(x=u&&(0,Y.jsx)(`div`,{className:`flex flex-col gap-1 p-2`,role:`status`,"aria-busy":`true`,"aria-label":`Loading timeline history`,children:[1,2,3].map(C_)}),t[10]=u,t[11]=x);let S;t[12]!==f||t[13]!==u?(S=!u&&f&&(0,Y.jsx)(`div`,{className:`px-4 py-3`,children:(0,Y.jsx)(`p`,{className:`text-xs text-destructive`,children:f})}),t[12]=f,t[13]=u,t[14]=S):S=t[14];let C;t[15]!==c.length||t[16]!==f||t[17]!==u?(C=!u&&!f&&c.length===0&&(0,Y.jsx)(`div`,{className:`px-4 py-8 text-center`,children:(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No history yet`})}),t[15]=c.length,t[16]=f,t[17]=u,t[18]=C):C=t[18];let w;t[19]!==c||t[20]!==f||t[21]!==y||t[22]!==o||t[23]!==b||t[24]!==u||t[25]!==r||t[26]!==i?(w=!u&&!f&&y&&c.length>0&&(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1 p-2`,children:[(0,Y.jsx)(l_,{selected:b,onSelect:()=>r?.(u_)}),c.map(e=>(0,Y.jsx)(b_,{entry:e,selected:e.sha===i,onSelect:r,isDark:o},e.sha))]}),t[19]=c,t[20]=f,t[21]=y,t[22]=o,t[23]=b,t[24]=u,t[25]=r,t[26]=i,t[27]=w):w=t[27];let E;t[28]!==f||t[29]!==_||t[30]!==y||t[31]!==o||t[32]!==b||t[33]!==u||t[34]!==r||t[35]!==i?(E=!u&&!f&&!y&&(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1 p-2`,children:[(0,Y.jsx)(l_,{selected:b,onSelect:()=>r?.(u_)}),_.map((e,t)=>e.kind===`checkpoint`?(0,Y.jsx)(b_,{entry:e.entry,selected:e.entry.sha===i,onSelect:r,prominent:!0,isDark:o},e.entry.sha):(0,Y.jsx)(d_,{entries:e.entries,defaultExpanded:e.isPreCheckpoint,selectedSha:i,onSelect:r,isDark:o},e.entries[0]?.sha??`wip-${t}`))]}),t[28]=f,t[29]=_,t[30]=y,t[31]=o,t[32]=b,t[33]=u,t[34]=r,t[35]=i,t[36]=E):E=t[36];let D;return t[37]!==x||t[38]!==S||t[39]!==C||t[40]!==w||t[41]!==E?(D=(0,Y.jsx)(`div`,{className:`flex h-full flex-col`,children:(0,Y.jsxs)(`div`,{className:`flex-1 overflow-y-auto subtle-scrollbar`,children:[x,S,C,w,E]})}),t[37]=x,t[38]=S,t[39]=C,t[40]=w,t[41]=E,t[42]=D):D=t[42],D}function C_(e){return(0,Y.jsxs)(`div`,{className:`flex items-start gap-3 rounded-lg px-3 py-2.5`,children:[(0,Y.jsx)(Zf,{className:`size-3.5 rounded mt-0.5 shrink-0`}),(0,Y.jsxs)(`div`,{className:`flex-1 space-y-1.5`,children:[(0,Y.jsx)(Zf,{className:`h-3 w-28`}),(0,Y.jsx)(Zf,{className:`h-3 w-40`})]})]},e)}function w_(e){return e.type===`checkpoint`}var T_=[{id:`outline`,label:`Outline`,icon:Bi},{id:`backlinks`,label:`Backlinks`,icon:vi},{id:`forward-links`,label:`Outgoing Links`,icon:yi},{id:`graph`,label:`Graph`,icon:Ui},{id:`timeline`,label:`Timeline`,icon:ui}];function E_(){return n(()=>import(`./GraphPanel-BkWSPzhS.js`),__vite__mapDeps([3,1,4,5,6,7,8,9,10]),import.meta.url)}var D_=(0,X.lazy)(async()=>({default:(await E_()).GraphPanel})),O_=(0,X.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-Bh4C07uL.js`),__vite__mapDeps([11,1,2,4,5,6,7,8,12,13,14]),import.meta.url)).ActivityModeContent}));function k_(e){let t=(0,Z.c)(14),{docName:n,isSourceMode:r,activeTab:i,onActiveTabChange:a,onEntrySelect:o,selectedSha:s,mode:c}=e,l;t[0]!==i||t[1]!==c||t[2]!==a?(l=c===`doc`?(0,Y.jsx)(`div`,{className:`flex flex-row items-center justify-center gap-3 border-b border-border/60 p-2`,children:(0,Y.jsx)(Me,{type:`single`,variant:`outline`,value:i,onValueChange:e=>{e&&a(e)},"aria-label":`Document panels`,children:T_.map(A_)})}):null,t[0]=i,t[1]=c,t[2]=a,t[3]=l):l=t[3];let u;t[4]!==i||t[5]!==n||t[6]!==r||t[7]!==c||t[8]!==o||t[9]!==s?(u=c===`doc`?(0,Y.jsxs)(`div`,{role:`tabpanel`,id:`panel-${i}`,"aria-labelledby":`tab-${i}`,className:`min-h-0 flex-1`,children:[i===`outline`&&(0,Y.jsx)(lr,{docName:n,isSourceMode:r}),i===`backlinks`&&(0,Y.jsx)(t_,{docName:n}),i===`forward-links`&&(0,Y.jsx)(i_,{docName:n}),i===`graph`&&(0,Y.jsx)(X.Suspense,{fallback:(0,Y.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:`Loading graph…`}),children:(0,Y.jsx)(D_,{activeDocName:n})}),i===`timeline`&&(0,Y.jsx)(S_,{docName:n,onEntrySelect:o,selectedSha:s})]}):(0,Y.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Y.jsx)(X.Suspense,{fallback:(0,Y.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:`Loading agent activity…`}),children:(0,Y.jsx)(O_,{})})}),t[4]=i,t[5]=n,t[6]=r,t[7]=c,t[8]=o,t[9]=s,t[10]=u):u=t[10];let d;return t[11]!==l||t[12]!==u?(d=(0,Y.jsxs)(Y.Fragment,{children:[l,u]}),t[11]=l,t[12]=u,t[13]=d):d=t[13],d}function A_(e){let{id:t,label:n,icon:r}=e;return(0,Y.jsxs)(ln,{children:[(0,Y.jsx)(Oe,{value:t,role:`tab`,id:`tab-${t}`,"aria-controls":`panel-${t}`,"aria-label":n,asChild:!0,children:(0,Y.jsx)(nn,{children:(0,Y.jsx)(r,{})})}),(0,Y.jsx)(an,{side:`bottom`,children:n})]},t)}function j_(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Y.jsx)(`div`,{className:`tiptap-editor pt-10`,role:`status`,"aria-busy":`true`,"aria-label":`Loading document`,children:(0,Y.jsxs)(`div`,{className:`space-y-3`,children:[(0,Y.jsx)(Zf,{className:`h-9 w-2/5 mt-6 mb-5`}),(0,Y.jsx)(Zf,{className:`h-4 w-full`}),(0,Y.jsx)(Zf,{className:`h-4 w-3/4`})]})}),e[0]=t):t=e[0],t}function M_(e){let t=e.split(`/`).pop();return t?`${e}/${t}`:null}function N_(e,t){let n=t.get(`${e}/index`);if(n)return n;let r=M_(e);if(r){let e=t.get(r);if(e)return e}return e.split(`/`).pop()??e}function P_(e,t,n){let r=n.get(e);return r&&r!==e?r:t}function F_(e,t){let n=`${e}/`,r=[...t.folderPaths].filter(e=>e.startsWith(n)).map(e=>({path:e,rel:e.slice(n.length)})).filter(e=>e.rel.length>0&&!e.rel.includes(`/`)).map(({path:e,rel:n})=>({kind:`folder`,path:e,name:n,title:N_(e,t.pageTitles)})),i=[...t.pages].filter(e=>e.startsWith(n)).map(e=>({docName:e,rel:e.slice(n.length)})).filter(e=>e.rel.length>0&&!e.rel.includes(`/`)).map(({docName:e,rel:n})=>{let r=t.pageMeta.get(e);return{kind:`file`,path:e,name:n,title:P_(e,n,t.pageTitles),size:r?.size??0,modified:r?.modified??``}}),a=[...r,...i].sort((e,t)=>e.kind===t.kind?e.title.localeCompare(t.title)||e.name.localeCompare(t.name):e.kind===`folder`?-1:1);return{title:N_(e,t.pageTitles),children:a}}function I_(e){let t=(0,Z.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,Y.jsx)(Tc,{"data-slot":`dropdown-menu`,...n}),t[2]=n,t[3]=r),r}function L_(e){let t=(0,Z.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,Y.jsx)(Ec,{"data-slot":`dropdown-menu-trigger`,...n}),t[2]=n,t[3]=r),r}function R_(e){let t=(0,Z.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,align:i,sideOffset:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?`start`:i,s=a===void 0?4:a,c;t[5]===n?c=t[6]:(c=W(`z-50 max-h-(--radix-dropdown-menu-content-available-height) w-(--radix-dropdown-menu-trigger-width) min-w-32 origin-(--radix-dropdown-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-[state=closed]:overflow-hidden 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`,n),t[5]=n,t[6]=c);let l;return t[7]!==o||t[8]!==r||t[9]!==s||t[10]!==c?(l=(0,Y.jsx)(Dc,{children:(0,Y.jsx)(Oc,{"data-slot":`dropdown-menu-content`,sideOffset:s,align:o,className:c,...r})}),t[7]=o,t[8]=r,t[9]=s,t[10]=c,t[11]=l):l=t[11],l}function z_(e){let t=(0,Z.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=W(`group/dropdown-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 not-data-[variant=destructive]: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 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,Y.jsx)(Ac,{"data-slot":`dropdown-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 B_(e){let t=(0,Z.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,Y.jsx)(jc,{"data-slot":`dropdown-menu-radio-group`,...n}),t[2]=n,t[3]=r),r}function V_(e){let t=(0,Z.c)(13),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,children:n,inset:i,...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=W(`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 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`,r),t[5]=r,t[6]=o);let s;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Y.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex items-center justify-center`,"data-slot":`dropdown-menu-radio-item-indicator`,children:(0,Y.jsx)(Nc,{children:(0,Y.jsx)(si,{})})}),t[7]=s):s=t[7];let c;return t[8]!==n||t[9]!==i||t[10]!==a||t[11]!==o?(c=(0,Y.jsxs)(Mc,{"data-slot":`dropdown-menu-radio-item`,"data-inset":i,className:o,...a,children:[s,n]}),t[8]=n,t[9]=i,t[10]=a,t[11]=o,t[12]=c):c=t[12],c}function H_(e){let t=(0,Z.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=W(`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,Y.jsx)(kc,{"data-slot":`dropdown-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 U_(e){let t=(0,Z.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=W(`-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,Y.jsx)(Pc,{"data-slot":`dropdown-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function W_(e){let t=(0,Z.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,Y.jsx)(Fc,{"data-slot":`dropdown-menu-sub`,...n}),t[2]=n,t[3]=r),r}function G_(e){let t=(0,Z.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=W(`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 not-data-[variant=destructive]: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,Y.jsx)(de,{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,Y.jsxs)(Ic,{"data-slot":`dropdown-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 K_(e){let t=(0,Z.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=W(`z-50 min-w-[96px] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-lg bg-popover p-1 text-popover-foreground shadow-lg 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`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Y.jsx)(Lc,{"data-slot":`dropdown-menu-sub-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function q_(e){let t=(0,Z.c)(14),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,containerClassName:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=W(`relative w-full overflow-x-auto subtle-scrollbar`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=W(`w-full caption-bottom text-sm`,n),t[6]=n,t[7]=o);let s;t[8]!==i||t[9]!==o?(s=(0,Y.jsx)(`table`,{"data-slot":`table`,className:o,...i}),t[8]=i,t[9]=o,t[10]=s):s=t[10];let c;return t[11]!==a||t[12]!==s?(c=(0,Y.jsx)(`div`,{"data-slot":`table-container`,className:a,children:s}),t[11]=a,t[12]=s,t[13]=c):c=t[13],c}function J_(e){let t=(0,Z.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=W(`[&_tr]:border-b`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Y.jsx)(`thead`,{"data-slot":`table-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Y_(e){let t=(0,Z.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=W(`[&_tr:last-child]:border-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Y.jsx)(`tbody`,{"data-slot":`table-body`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function X_(e){let t=(0,Z.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,noHover:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=(i===void 0?!1:i)&&`hover:bg-transparent`,o;t[4]!==n||t[5]!==a?(o=W(`hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors`,a,n),t[4]=n,t[5]=a,t[6]=o):o=t[6];let s;return t[7]!==r||t[8]!==o?(s=(0,Y.jsx)(`tr`,{"data-slot":`table-row`,className:o,...r}),t[7]=r,t[8]=o,t[9]=s):s=t[9],s}function Z_(e){let t=(0,Z.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,scope:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`col`:i,o;t[4]===n?o=t[5]:(o=W(`font-mono uppercase text-xs text-muted-foreground h-10 px-4 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]`,n),t[4]=n,t[5]=o);let s;return t[6]!==r||t[7]!==a||t[8]!==o?(s=(0,Y.jsx)(`th`,{"data-slot":`table-head`,scope:a,className:o,...r}),t[6]=r,t[7]=a,t[8]=o,t[9]=s):s=t[9],s}function Q_(e){let t=(0,Z.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=W(`py-3 px-4 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Y.jsx)(`td`,{"data-slot":`table-cell`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function $_(e){if(!e)return`—`;let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/6e4);if(r<1)return`just now`;if(r<60)return`${r}m ago`;let i=Math.floor(r/60);if(i<24)return`${i}h ago`;let a=Math.floor(i/24);return a<30?`${a}d ago`:t.toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`numeric`})}function ev(e,t,n){return[...e].sort((e,r)=>{if(e.kind!==r.kind)return e.kind===`folder`?-1:1;let i=0;switch(t){case`name`:i=e.title.localeCompare(r.title)||e.name.localeCompare(r.name);break;case`modified`:{let t=e.kind===`file`?e.modified:``,n=r.kind===`file`?r.modified:``;i=t.localeCompare(n);break}}return n===`asc`?i:-i})}function tv(e){let t=(0,Z.c)(10),{label:n,sortKey:r,activeKey:i,activeDir:a,onSort:o}=e,s=i===r,c;t[0]!==o||t[1]!==r?(c=()=>o(r),t[0]=o,t[1]=r,t[2]=c):c=t[2];let l;t[3]!==a||t[4]!==s?(l=s?a===`asc`?(0,Y.jsx)(Qr,{className:`ml-1 size-3`}):(0,Y.jsx)(Yr,{className:`ml-1 size-3`}):(0,Y.jsx)(Zr,{className:`ml-1 size-3 text-muted-foreground/50`}),t[3]=a,t[4]=s,t[5]=l):l=t[5];let u;return t[6]!==n||t[7]!==c||t[8]!==l?(u=(0,Y.jsxs)(K,{variant:`ghost`,size:`sm`,className:`-ml-3 h-8 uppercase font-mono`,onClick:c,children:[n,l]}),t[6]=n,t[7]=c,t[8]=l,t[9]=u):u=t[9],u}function nv(e){let t=(0,Z.c)(87),{folderPath:n}=e,{addPage:r,folderPaths:i,loading:a,pages:o,pageTitles:s,pageMeta:c}=Vn(),[l,u]=(0,X.useState)(!1),[d,f]=(0,X.useState)(!1),[p,m]=(0,X.useState)(null),[h,g]=(0,X.useState)(`name`),[_,v]=(0,X.useState)(`asc`);if(a){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(Zf,{className:`size-5 rounded`}),(0,Y.jsx)(Zf,{className:`h-7 w-48`})]}),(0,Y.jsx)(Zf,{className:`h-9 w-20 rounded-md`})]}),t[0]=e):e=t[0];let n;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Y.jsx)(Zf,{className:`h-4 w-16`}),t[1]=n):n=t[1];let r;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Y.jsx)(`div`,{className:`flex min-h-0 flex-1 items-start overflow-y-auto subtle-scrollbar`,role:`status`,"aria-busy":`true`,"aria-label":`Loading folder contents`,children:(0,Y.jsxs)(`div`,{className:`mx-auto flex w-full max-w-4xl flex-col gap-6 px-6 py-8`,children:[e,(0,Y.jsxs)(`div`,{className:`rounded-lg border`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-4 border-b px-4 py-3`,children:[n,(0,Y.jsx)(`div`,{className:`ml-auto`,children:(0,Y.jsx)(Zf,{className:`h-4 w-20`})})]}),[`a`,`b`,`c`,`d`].map(ov)]})]})}),t[2]=r):r=t[2],r}let y,b,x,S,C,w,T,E;if(t[3]!==r||t[4]!==p||t[5]!==d||t[6]!==n||t[7]!==i||t[8]!==c||t[9]!==s||t[10]!==o||t[11]!==_||t[12]!==h){let e=F_(n,{pages:o,pageTitles:s,pageMeta:c,folderPaths:i}),a=ev(e.children,h,_),l;t[21]===h?l=t[22]:(l=function(e){e===h?v(av):(g(e),v(`asc`))},t[21]=h,t[22]=l);let D=l,O;t[23]!==r||t[24]!==n?(O=async function(){f(!0),m(null);try{let e=`${n}/index.md`,t=await fetch(`/api/create-page`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e})}),i=await t.json().catch(iv);if(!t.ok||!i?.ok){m(i?.error??`Server error (HTTP ${t.status})`),f(!1);return}let a=i.docName??`${n}/index`;r(a),Wn([`files`,`backlinks`,`graph`]),window.location.hash=Nn(a)}catch(e){console.warn(`[FolderOverview] create index note failed:`,e),m(`Network error — please try again`)}f(!1)},t[23]=r,t[24]=n,t[25]=O):O=t[25];let k=O;E=`flex min-h-0 flex-1 items-start overflow-y-auto subtle-scrollbar`,w=`mx-auto flex w-full max-w-4xl flex-col gap-6 px-6 py-8`;let A;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Y.jsx)(nt,{className:`size-5 text-muted-foreground`}),t[26]=A):A=t[26];let j=(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[A,(0,Y.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:e.title})]}),M;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Y.jsx)(Zi,{className:`size-4`}),t[27]=M):M=t[27];let N;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Y.jsx)(L_,{asChild:!0,children:(0,Y.jsxs)(K,{children:[M,`New`,(0,Y.jsx)(fe,{className:`size-3`})]})}),t[28]=N):N=t[28];let P;t[29]===k?P=t[30]:(P=()=>void k(),t[29]=k,t[30]=P);let F;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`div`,{className:`font-medium`,children:`Index note`}),(0,Y.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Landing page for this folder`})]}),t[31]=F):F=t[31];let I;t[32]!==d||t[33]!==P?(I=(0,Y.jsx)(z_,{disabled:d,onSelect:P,children:F}),t[32]=d,t[33]=P,t[34]=I):I=t[34];let ee;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Y.jsx)(z_,{onSelect:()=>u(!0),children:(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`div`,{className:`font-medium`,children:`Note`}),(0,Y.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`New note inside this folder`})]})}),t[35]=ee):ee=t[35];let L;t[36]===I?L=t[37]:(L=(0,Y.jsxs)(I_,{children:[N,(0,Y.jsxs)(R_,{align:`end`,children:[I,ee]})]}),t[36]=I,t[37]=L);let R;t[38]!==j||t[39]!==L?(R=(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[j,L]}),t[38]=j,t[39]=L,t[40]=R):R=t[40];let z;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This folder has no landing note yet. Choose an explicit action to add one or open a note inside the folder.`}),t[41]=z):z=t[41];let B;t[42]===p?B=t[43]:(B=p?(0,Y.jsx)(`span`,{role:`alert`,className:`text-sm text-destructive`,children:p}):null,t[42]=p,t[43]=B),t[44]!==R||t[45]!==B?(T=(0,Y.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[R,z,B]}),t[44]=R,t[45]=B,t[46]=T):T=t[46],C=`rounded-lg border`,b=q_;let V=h===`name`?_===`asc`?`ascending`:`descending`:`none`,H;t[47]!==D||t[48]!==_||t[49]!==h?(H=(0,Y.jsx)(tv,{label:`Name`,sortKey:`name`,activeKey:h,activeDir:_,onSort:D}),t[47]=D,t[48]=_,t[49]=h,t[50]=H):H=t[50];let te;t[51]!==V||t[52]!==H?(te=(0,Y.jsx)(Z_,{"aria-sort":V,children:H}),t[51]=V,t[52]=H,t[53]=te):te=t[53];let ne=h===`modified`?_===`asc`?`ascending`:`descending`:`none`,re;t[54]!==D||t[55]!==_||t[56]!==h?(re=(0,Y.jsx)(tv,{label:`Modified`,sortKey:`modified`,activeKey:h,activeDir:_,onSort:D}),t[54]=D,t[55]=_,t[56]=h,t[57]=re):re=t[57];let U;t[58]!==ne||t[59]!==re?(U=(0,Y.jsx)(Z_,{className:`w-32`,"aria-sort":ne,children:re}),t[58]=ne,t[59]=re,t[60]=U):U=t[60],t[61]!==te||t[62]!==U?(S=(0,Y.jsx)(J_,{children:(0,Y.jsxs)(X_,{children:[te,U]})}),t[61]=te,t[62]=U,t[63]=S):S=t[63],y=Y_,x=a.length?a.map(rv):(0,Y.jsx)(X_,{children:(0,Y.jsx)(Q_,{colSpan:2,className:`h-24 text-center text-muted-foreground`,children:`This folder is empty.`})}),t[3]=r,t[4]=p,t[5]=d,t[6]=n,t[7]=i,t[8]=c,t[9]=s,t[10]=o,t[11]=_,t[12]=h,t[13]=y,t[14]=b,t[15]=x,t[16]=S,t[17]=C,t[18]=w,t[19]=T,t[20]=E}else y=t[13],b=t[14],x=t[15],S=t[16],C=t[17],w=t[18],T=t[19],E=t[20];let D;t[64]!==y||t[65]!==x?(D=(0,Y.jsx)(y,{children:x}),t[64]=y,t[65]=x,t[66]=D):D=t[66];let O;t[67]!==b||t[68]!==S||t[69]!==D?(O=(0,Y.jsxs)(b,{children:[S,D]}),t[67]=b,t[68]=S,t[69]=D,t[70]=O):O=t[70];let k;t[71]!==C||t[72]!==O?(k=(0,Y.jsx)(`div`,{className:C,children:O}),t[71]=C,t[72]=O,t[73]=k):k=t[73];let A;t[74]!==w||t[75]!==T||t[76]!==k?(A=(0,Y.jsxs)(`div`,{className:w,children:[T,k]}),t[74]=w,t[75]=T,t[76]=k,t[77]=A):A=t[77];let j;t[78]!==A||t[79]!==E?(j=(0,Y.jsx)(`div`,{className:E,children:A}),t[78]=A,t[79]=E,t[80]=j):j=t[80];let M;t[81]!==l||t[82]!==n?(M=(0,Y.jsx)(qe,{open:l,onOpenChange:u,kind:`file`,initialDir:n}),t[81]=l,t[82]=n,t[83]=M):M=t[83];let N;return t[84]!==j||t[85]!==M?(N=(0,Y.jsxs)(Y.Fragment,{children:[j,M]}),t[84]=j,t[85]=M,t[86]=N):N=t[86],N}function rv(e){return(0,Y.jsxs)(X_,{children:[(0,Y.jsx)(Q_,{children:(0,Y.jsxs)(`a`,{href:Nn(e.path),className:`flex items-center gap-2 rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:[e.kind===`folder`?(0,Y.jsx)(Oi,{className:`size-4 shrink-0 text-muted-foreground`}):(0,Y.jsx)(tt,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Y.jsx)(`span`,{className:`truncate`,children:e.title})]})}),(0,Y.jsx)(Q_,{className:`text-muted-foreground`,children:e.kind===`file`?$_(e.modified):`—`})]},e.path)}function iv(){return null}function av(e){return e===`asc`?`desc`:`asc`}function ov(e){return(0,Y.jsxs)(`div`,{className:`flex items-center gap-3 border-b px-4 py-3 last:border-b-0`,children:[(0,Y.jsx)(Zf,{className:`size-4 rounded`}),(0,Y.jsx)(Zf,{className:`h-4 w-40`}),(0,Y.jsx)(`div`,{className:`ml-auto`,children:(0,Y.jsx)(Zf,{className:`h-4 w-16`})})]},e)}var sv=1e3,cv=3;function lv(e,t,n){let r=n?.windowMs??600,i=n?.maxLevel??cv;if(e===0||t>=r)return 1;let a=e+1;return a>i?i:a}var uv={0:{count:0,startRadius:0,baseDistance:0,distanceVariance:0,sizeMin:0,sizeMax:0,maxDelay:0,durationMin:0,durationMax:0},1:{count:0,startRadius:0,baseDistance:0,distanceVariance:0,sizeMin:0,sizeMax:0,maxDelay:0,durationMin:0,durationMax:0},2:{count:0,startRadius:0,baseDistance:0,distanceVariance:0,sizeMin:0,sizeMax:0,maxDelay:0,durationMin:0,durationMax:0},3:{count:16,startRadius:11,baseDistance:7,distanceVariance:3,sizeMin:.45,sizeMax:1.2,maxDelay:130,durationMin:620,durationMax:920}},dv=[`var(--color-azure-blue)`,`var(--color-sky-blue)`,`var(--color-violet-300)`,`var(--color-orange-light)`,`var(--color-crystal-blue)`,`var(--color-white-cream)`];function fv(e,t={}){let n=t.rng??Math.random,r=t.colors??dv,i=uv[e];if(i.count===0||r.length===0)return[];let a=[],o=Math.PI*2/i.count;for(let e=0;e<i.count;e++){let t=e*o+(n()-.5)*o*.7,s=i.baseDistance+(n()-.5)*2*i.distanceVariance,c=i.sizeMin+n()*(i.sizeMax-i.sizeMin),l=n()*i.maxDelay,u=i.durationMin+n()*(i.durationMax-i.durationMin),d=Math.floor(n()*r.length),f=Math.cos(t),p=Math.sin(t);a.push({id:e,dx:f*s,dy:p*s,originDx:f*i.startRadius,originDy:p*i.startRadius,size:c,color:r[d]??`currentColor`,delay:l,duration:u})}return a}var pv=1.8,mv=90,hv=16,gv=380,_v=.025,vv=.1,yv=.18,bv=400,xv=9.2736,Sv=18.1799,Cv=14.5244,wv={1:{halfWidth:1.5,apexLift:2.2},2:{halfWidth:1.4,apexLift:2.6},3:{halfWidth:1.25,apexLift:3}};function Tv(e,t){let{halfWidth:n,apexLift:r}=wv[t];return`M${e-n} ${Cv+.3} Q${e} ${Cv-r}, ${e+n} ${Cv+.3}`}function Ev(e){let t=1.5,n=.3;return`M${e-t} ${Cv-n} Q${e} ${Cv+1.4}, ${e+t} ${Cv-n}`}var Dv=15,Ov=15;function kv(e){return{fill:e.color,"--fx-tx":`${e.dx}px`,"--fx-ty":`${e.dy}px`,"--fx-delay":`${e.delay}ms`,"--fx-duration":`${e.duration}ms`}}function Av(e){let t=(0,Z.c)(67),{size:n,className:r,trackMouse:i,variant:a}=e,o=n===void 0?48:n,s=i===void 0?!0:i,c=a===void 0?`default`:a,l=(0,X.useRef)(null),u=(0,X.useRef)(null),d=(0,X.useRef)(null),f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f={x:0,y:0},t[0]=f):f=t[0];let p=(0,X.useRef)(f),[m,h]=(0,X.useState)(0),[g,_]=(0,X.useState)(0),v;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(v=[],t[1]=v):v=t[1];let[y,b]=(0,X.useState)(v),x=(0,X.useRef)(0),S=(0,X.useRef)(void 0),C=c===`sleeping`,w;t[2]!==m||t[3]!==C?(w=function(){if(C)return;let e=typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now(),t=x.current===0?1/0:e-x.current;x.current=e;let n=lv(m,t);h(n),_(Nv),b(fv(n)),clearTimeout(S.current),S.current=setTimeout(()=>{h(0),b([])},sv)},t[2]=m,t[3]=C,t[4]=w):w=t[4];let T=w,E,D;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(E=()=>()=>clearTimeout(S.current),D=[],t[5]=E,t[6]=D):(E=t[5],D=t[6]),(0,X.useEffect)(E,D);let O,k;t[7]!==C||t[8]!==s?(k=()=>{if(!s||C||window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)return;let e=0,t=0,n=!1,r=0,i=0,a=0,o=0,c=0,f=function(r){e=r.clientX,t=r.clientY,n=!0};function m(){if(c=requestAnimationFrame(m),!n)return;let s=u.current,f=l.current;if(!s||!f)return;let h=s.getBoundingClientRect(),g=h.left+h.width/2,_=h.top+h.height*.48,v=e-g,y=t-_,b=Math.hypot(v,y),x=Math.max(-1,Math.min(1,v/gv)),S=Math.max(-1,Math.min(1,y/gv)),C=x*hv,w=-S*hv;r+=(w-r)*vv,i+=(C-i)*vv,f.style.transform=`perspective(${bv}px) rotateX(${r.toFixed(3)}deg) rotateY(${i.toFixed(3)}deg)`;let T=0,E=0;if(b>=1){let e=Math.min(b/mv,1)*pv;T=v/b*e,E=y/b*e}a+=(T-a)*yv,o+=(E-o)*yv;let D=i*_v,O=-r*_v,k=a+D,A=o+O;p.current.x=k,p.current.y=A,d.current?.setAttribute(`transform`,`translate(${k.toFixed(3)} ${A.toFixed(3)})`)}return document.addEventListener(`mousemove`,f,{passive:!0}),c=requestAnimationFrame(m),()=>{document.removeEventListener(`mousemove`,f),cancelAnimationFrame(c),l.current&&(l.current.style.transform=``),p.current={x:0,y:0},d.current?.removeAttribute(`transform`)}},O=[s,C],t[7]=C,t[8]=s,t[9]=O,t[10]=k):(O=t[9],k=t[10]),(0,X.useEffect)(k,O);let A;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(A=()=>{let e=d.current;if(!e)return;let{x:t,y:n}=p.current;e.setAttribute(`transform`,`translate(${t.toFixed(3)} ${n.toFixed(3)})`)},t[11]=A):A=t[11],(0,X.useLayoutEffect)(A);let j=m>0,M=j?m:1,N=j?`ok-blob-clicked-${m}`:null,P;t[12]===r?P=t[13]:(P=W(`ok-blob-3d-wrapper`,r),t[12]=r,t[13]=P);let F=C?`cursor-default`:`cursor-pointer`,I=`body-${g}`,ee=C&&`ok-blob-sleeping`,L;t[14]!==N||t[15]!==ee?(L=W(`ok-blob-group`,ee,N),t[14]=N,t[15]=ee,t[16]=L):L=t[16];let R;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Y.jsx)(`path`,{d:`M25.2339 6.78134C25.5199 7.35734 25.8179 8.47234 26.0179 9.07834C26.0189 9.08234 26.0209 9.08634 26.0219 9.09134C26.0229 9.09534 26.0249 9.10034 26.0259 9.10434C26.0539 9.19734 26.0949 9.29533 26.1519 9.41633C26.2919 9.71133 26.5269 10.1173 27.1299 11.1683C27.3259 11.4643 27.5209 11.7693 27.7119 12.0903C29.9739 15.1623 29.3259 20.1913 27.0469 22.9153C26.7779 23.2953 26.4869 23.6043 26.1889 23.8863C26.1519 23.9253 26.1129 23.9643 26.0729 24.0033C25.3159 24.7543 24.2949 25.4673 23.6129 25.8323C22.7469 26.2983 22.1349 26.5483 21.6299 26.7463C20.3649 27.3063 19.0609 27.7733 17.6569 28.0423C15.9649 28.3513 14.1939 28.4433 12.4569 28.1373C11.4779 27.9663 10.5119 27.6663 9.60891 27.2493C8.77491 26.8663 7.99192 26.3853 7.26992 25.8403C6.83592 25.5393 6.43893 25.2343 6.08093 24.9383C5.57893 24.5223 5.15993 24.1263 4.83493 23.7793C4.04993 22.9443 3.31593 21.8893 2.80893 21.0953C2.72593 20.9663 2.64792 20.8433 2.57592 20.7293C2.56192 20.7093 2.54793 20.6893 2.53393 20.6703C2.08593 20.0263 1.71892 19.3293 1.43792 18.5993C1.42892 18.5453 1.42093 18.4903 1.41293 18.4353C1.32093 17.7443 1.08292 16.9423 1.01092 15.6333C0.984921 15.0653 0.998928 14.4013 1.12393 13.6353C1.20693 13.1413 1.31993 12.9023 1.40893 12.7113C1.43593 12.6543 1.46193 12.6023 1.48593 12.5483C1.56793 12.3653 1.59392 12.1563 1.63592 11.9083C1.68992 11.5883 1.76992 11.1943 2.04592 10.7553C2.94392 9.37934 3.36792 8.81934 3.66592 8.33934C3.75592 8.20334 3.84292 8.08134 3.94192 7.96634C4.21592 7.64634 4.67693 7.29534 5.10293 7.05734C5.16693 7.02234 5.23093 6.98834 5.29193 6.95534C5.62993 6.77834 6.22592 6.30135 6.66992 5.92035C6.83692 5.77635 7.08193 5.60735 7.37393 5.40935C7.67393 5.20535 8.02593 4.96934 8.39193 4.70234C9.32093 4.02634 9.84091 3.69134 10.2599 3.42334C10.3799 3.34734 10.4919 3.27734 10.6049 3.20834C10.9609 2.98834 11.4149 2.73034 11.8869 2.48634C12.4519 2.19334 13.0469 1.92133 13.5089 1.72233C14.7399 1.30233 16.0539 1.01333 17.4169 1.00033C18.1169 0.991333 18.7939 1.16534 19.2389 1.43034C19.6869 1.69534 19.8689 2.00335 19.8039 2.23935C19.7379 2.47835 19.4399 2.63634 19.0109 2.74734C18.5789 2.85634 18.0469 2.92035 17.4889 2.96135C16.3639 3.04235 15.2399 3.36435 14.1499 3.80835C12.8199 4.35135 11.5379 5.07133 10.2719 5.84733C9.38691 6.39133 8.51192 6.97334 7.63592 7.56834C7.54492 7.63034 7.45492 7.69135 7.36492 7.75235C6.97392 8.06635 6.58293 8.38134 6.22293 8.66334C5.97893 8.85734 5.76793 9.04834 5.59393 9.21434C5.26893 9.52334 5.02393 9.74334 4.81893 9.93934C4.67793 10.0753 4.55793 10.2013 4.45593 10.3443C4.40093 10.4213 4.32992 10.5273 4.24792 10.6593C3.90492 11.1933 3.44493 12.1693 3.15393 13.1173C3.01893 13.5363 2.87991 14.0343 2.79391 14.5253C2.66591 15.2253 2.65594 15.9053 2.71994 16.2373C2.82794 16.8193 2.95593 17.4833 3.14093 18.0553C3.31293 18.6003 3.52991 19.0583 3.70791 19.2823C3.81591 19.4183 3.90394 19.5473 3.99594 19.6913C4.09394 19.8413 4.19191 20.0073 4.31091 20.2033C4.47891 20.4803 4.68592 20.8163 5.00192 21.2493C5.36492 21.7463 5.61793 22.1043 5.83493 22.4023C6.14493 22.8243 6.38591 23.1343 6.83691 23.5033C7.33891 23.9113 7.86593 24.3113 8.26693 24.6393C8.44893 24.7883 8.66993 24.9443 8.90493 25.0963C9.21593 25.2963 9.55192 25.4893 9.85592 25.6703C10.1059 25.8203 10.3059 25.9633 10.4869 26.0863C10.5429 26.1243 10.5979 26.1603 10.6519 26.1943C10.8699 26.2803 11.0929 26.3593 11.3159 26.4283C11.3539 26.4323 11.3949 26.4353 11.4369 26.4393C11.6509 26.4573 11.9089 26.4733 12.2209 26.5133C12.7169 26.5753 13.1399 26.6603 13.6019 26.7243C13.9589 26.7733 14.3409 26.8083 14.7729 26.7893C15.0729 26.7753 15.4069 26.7353 15.7389 26.6813C16.2349 26.6023 16.7179 26.4943 17.0569 26.4473C17.1499 26.4343 17.2359 26.4343 17.3209 26.4373C17.3489 26.4393 17.3799 26.4413 17.4109 26.4433C17.4119 26.4433 17.4119 26.4433 17.4129 26.4433C17.4199 26.4433 17.4279 26.4443 17.4349 26.4443C18.2329 26.2413 19.0259 25.9433 19.7959 25.5983C19.8609 25.5633 19.9259 25.5273 19.9899 25.4913C20.3059 25.3173 20.6049 25.1383 20.7869 24.9943C20.9829 24.8393 21.5189 24.5373 22.0579 24.1853C22.4109 23.9553 22.7649 23.7053 23.0369 23.4833C23.1949 23.3553 23.3689 23.2693 23.5479 23.1773C23.7129 23.0923 23.8809 23.0013 24.0349 22.8653C24.1109 22.7983 24.1869 22.7173 24.2639 22.6303C24.3309 22.5563 24.4039 22.4723 24.4759 22.3923C24.5459 22.3153 24.7199 22.1723 24.9139 21.9793C25.0079 21.8863 25.1059 21.7783 25.1909 21.6713C25.2199 21.6323 25.2489 21.5943 25.2769 21.5553C25.5919 21.0403 25.8779 20.5003 26.1019 19.9653C26.1299 19.8403 26.1379 19.7293 26.1279 19.6373C26.1199 19.5703 26.1029 19.5113 26.0839 19.4503C26.0599 19.3643 26.0329 19.2773 26.0239 19.1723C26.0169 19.0893 26.0309 19.0043 26.0629 18.9543C26.0779 18.9323 26.0969 18.9143 26.1129 18.8993C26.1329 18.8823 26.1499 18.8673 26.1569 18.8443C26.1609 18.8273 26.1579 18.8073 26.1529 18.7833C26.1459 18.7443 26.1369 18.6943 26.1539 18.6293C26.2189 18.3853 26.2869 18.1103 26.3319 17.8383C26.3829 17.5393 26.4049 17.2433 26.3949 17.0123C26.3849 16.7493 26.3909 16.3823 26.3469 16.0003C26.3179 15.7343 26.2659 15.4663 26.1979 15.2383C26.1319 15.0143 26.0219 14.7913 25.9039 14.5783C25.7629 14.3223 25.6119 14.0783 25.5169 13.8453C25.4969 13.7983 25.4999 13.7263 25.4999 13.6323C25.5009 13.5673 25.4999 13.4913 25.4919 13.4083C25.3239 13.1243 25.1459 12.8423 24.9589 12.5483C24.9479 12.5413 24.9369 12.5333 24.9249 12.5263C24.6689 12.3503 24.3139 12.1173 24.0769 11.5503C24.0179 11.4063 24.0069 11.2983 23.9969 11.1993C23.9859 11.1013 23.9799 11.0183 23.9289 10.9093C23.8709 10.7853 23.7759 10.6583 23.6709 10.4993C23.5849 10.3703 23.4899 10.2133 23.4199 10.0423C23.3819 9.95134 23.3509 9.85734 23.3329 9.75934C23.3299 9.74334 23.3269 9.72534 23.3229 9.70634C23.2899 9.52734 23.2439 9.26534 23.2409 8.98634C23.0209 8.24434 22.8339 7.48833 22.6519 6.77633C22.3429 5.57133 22.0519 4.54234 21.3329 3.95434C20.9839 3.65334 20.5689 3.35433 20.2459 3.05433C19.9259 2.75633 19.7449 2.47534 19.8019 2.23834C19.8639 2.00634 20.1589 1.82934 20.6659 1.80534C21.1699 1.78334 21.8699 1.93235 22.5209 2.39235C23.6159 3.14235 24.2029 4.38334 24.5599 5.35734C24.5829 5.40834 24.6049 5.46034 24.6259 5.51234C24.7849 5.89434 24.9529 6.22834 25.1199 6.55534C25.1579 6.63034 25.1969 6.70834 25.2339 6.78134Z`,className:`ok-blob-body`}),t[17]=R):R=t[17];let z=(j||C)&&`ok-blob-eye-hidden`,B;t[18]===z?B=t[19]:(B=W(`ok-blob-eye`,z),t[18]=z,t[19]=B);let V;t[20]===B?V=t[21]:(V=(0,Y.jsx)(`ellipse`,{cx:xv,cy:Cv,rx:1.2722,ry:1.9083,className:B}),t[20]=B,t[21]=V);let H=(j||C)&&`ok-blob-eye-hidden`,te;t[22]===H?te=t[23]:(te=W(`ok-blob-eye ok-blob-eye-right`,H),t[22]=H,t[23]=te);let ne;t[24]===te?ne=t[25]:(ne=(0,Y.jsx)(`ellipse`,{cx:Sv,cy:Cv,rx:1.2722,ry:1.9083,className:te}),t[24]=te,t[25]=ne);let re;t[26]===M?re=t[27]:(re=Tv(xv,M),t[26]=M,t[27]=re);let U=(!j||C)&&`ok-blob-eye-hidden`,G;t[28]===U?G=t[29]:(G=W(`ok-blob-happy-eye`,U),t[28]=U,t[29]=G);let ie;t[30]!==re||t[31]!==G?(ie=(0,Y.jsx)(`path`,{d:re,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:G}),t[30]=re,t[31]=G,t[32]=ie):ie=t[32];let ae;t[33]===M?ae=t[34]:(ae=Tv(Sv,M),t[33]=M,t[34]=ae);let oe=(!j||C)&&`ok-blob-eye-hidden`,K;t[35]===oe?K=t[36]:(K=W(`ok-blob-happy-eye`,oe),t[35]=oe,t[36]=K);let q;t[37]!==ae||t[38]!==K?(q=(0,Y.jsx)(`path`,{d:ae,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:K}),t[37]=ae,t[38]=K,t[39]=q):q=t[39];let se;t[40]===C?se=t[41]:(se=C?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`path`,{d:Ev(xv),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`}),(0,Y.jsx)(`path`,{d:Ev(Sv),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`})]}):null,t[40]=C,t[41]=se);let J;t[42]!==V||t[43]!==ne||t[44]!==ie||t[45]!==q||t[46]!==se?(J=(0,Y.jsxs)(`g`,{ref:d,children:[V,ne,ie,q,se]}),t[42]=V,t[43]=ne,t[44]=ie,t[45]=q,t[46]=se,t[47]=J):J=t[47];let ce;t[48]!==I||t[49]!==L||t[50]!==J?(ce=(0,Y.jsxs)(`g`,{className:L,children:[R,J]},I),t[48]=I,t[49]=L,t[50]=J,t[51]=ce):ce=t[51];let le;t[52]===C?le=t[53]:(le=C?(0,Y.jsxs)(`g`,{children:[(0,Y.jsx)(`text`,{x:21,y:7,className:`ok-blob-z ok-blob-z-1`,children:`z`}),(0,Y.jsx)(`text`,{x:26,y:2,className:`ok-blob-z ok-blob-z-2`,children:`z`})]}):null,t[52]=C,t[53]=le);let ue;t[54]!==g||t[55]!==y?(ue=y.length>0&&(0,Y.jsx)(`g`,{children:y.map(jv)},`firework-${g}`),t[54]=g,t[55]=y,t[56]=ue):ue=t[56];let de;t[57]!==T||t[58]!==o||t[59]!==F||t[60]!==ce||t[61]!==le||t[62]!==ue?(de=(0,Y.jsxs)(`svg`,{ref:u,width:o,height:o,viewBox:`0 0 30 30`,fill:`none`,overflow:`visible`,xmlns:`http://www.w3.org/2000/svg`,className:F,"aria-hidden":`true`,onClick:T,onMouseDown:Mv,children:[ce,le,ue]}),t[57]=T,t[58]=o,t[59]=F,t[60]=ce,t[61]=le,t[62]=ue,t[63]=de):de=t[63];let fe;return t[64]!==P||t[65]!==de?(fe=(0,Y.jsx)(`span`,{ref:l,className:P,children:de}),t[64]=P,t[65]=de,t[66]=fe):fe=t[66],fe}function jv(e){return(0,Y.jsx)(`circle`,{cx:Dv+e.originDx,cy:Ov+e.originDy,r:e.size,className:`ok-blob-firework`,style:kv(e)},e.id)}function Mv(e){return e.preventDefault()}function Nv(e){return e+1}function Pv(){let e=typeof window<`u`?window.okDesktop:void 0;return e?.seed?{plan:t=>e.seed.plan(t),apply:t=>e.seed.apply(t)}:{plan:async e=>{let t=e?`?rootDir=${encodeURIComponent(e)}`:``;return await(await fetch(`/api/seed/plan${t}`)).json()},apply:async e=>await(await fetch(`/api/seed/apply`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({plan:e})})).json()}}function Fv(e){let t=(0,Z.c)(50),{open:n,onOpenChange:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={kind:`loading`},t[0]=i):i=t[0];let[a,o]=(0,X.useState)(i),[s,c]=(0,X.useState)(`project-root`),[l,u]=(0,X.useState)(`brain`),d=(0,X.useRef)(!0),f,p;t[1]===n?(f=t[2],p=t[3]):(f=()=>{n&&(c(`project-root`),u(`brain`),d.current=!0)},p=[n],t[1]=n,t[2]=f,t[3]=p),(0,X.useEffect)(f,p);let m;t[4]===l?m=t[5]:(m=l.trim(),t[4]=l,t[5]=m);let h=m,g=s===`subfolder`&&h===``,_,v;t[6]!==n||t[7]!==s||t[8]!==g||t[9]!==h?(_=()=>{if(!n)return;if(g){o({kind:`error`,message:`Enter a folder name (e.g. brain).`});return}let e=s===`project-root`?void 0:h,t=d.current?0:200;d.current=!1;let r=!1,i=setTimeout(()=>{r||(o(Iv),Pv().plan(e).then(e=>{if(!r){if(!e.ok){o({kind:`error`,message:e.error.message});return}o(e.plan.created.length>0||e.plan.configEdits.length>0?{kind:`plan`,plan:e.plan}:{kind:`already-seeded`,plan:e.plan})}}).catch(e=>{r||o({kind:`error`,message:e instanceof Error?e.message:String(e)})}))},t);return()=>{r=!0,clearTimeout(i)}},v=[n,s,h,g],t[6]=n,t[7]=s,t[8]=g,t[9]=h,t[10]=_,t[11]=v):(_=t[10],v=t[11]),(0,X.useEffect)(_,v);let y;t[12]!==r||t[13]!==a.kind||t[14]!==a.plan||t[15]!==g?(y=async function(){if(a.kind!==`plan`||g)return;o({kind:`applying`,plan:a.plan});let e=await Pv().apply(a.plan);e.ok?(At.success(`LLM brain initialized (${e.result.applied} ${e.result.applied===1?`entry`:`entries`})`),r(!1)):(At.error(`Initialize failed: ${e.error.message}`),o({kind:`error`,message:e.error.message}))},t[12]=r,t[13]=a.kind,t[14]=a.plan,t[15]=g,t[16]=y):y=t[16];let b=y,x;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Y.jsxs)(qt,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(ai,{"aria-hidden":`true`,className:`h-4 w-4`}),`Initialize LLM brain`]}),t[17]=x):x=t[17];let S;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Y.jsx)(`code`,{children:`external-sources`}),t[18]=S):S=t[18];let C;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Y.jsx)(`code`,{children:`research`}),t[19]=C):C=t[19];let w;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Y.jsx)(`code`,{children:`articles`}),t[20]=w):w=t[20];let T;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Y.jsx)(`code`,{children:`log.md`}),t[21]=T):T=t[21];let E;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Y.jsx)(`code`,{children:`config.yml`}),t[22]=E):E=t[22];let D;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Y.jsx)(`code`,{children:`folders:`}),t[23]=D):D=t[23];let O;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Y.jsxs)(Wt,{children:[x,(0,Y.jsxs)(Bt,{children:[`Optional starter structure — creates the Karpathy three-layer folders (`,S,`, `,C,`, `,w,`), an append-only `,T,`, and matching `,E,` `,D,` entries so agents see layer descriptions at every `,(0,Y.jsx)(`code`,{children:`ls`}),`. You can skip this and keep any folder layout you already use.`]})]}),t[24]=O):O=t[24];let k;t[25]!==s||t[26]!==l?(k=(0,Y.jsx)(Lv,{choice:s,subfolder:l,onChoiceChange:c,onSubfolderChange:u}),t[25]=s,t[26]=l,t[27]=k):k=t[27];let A;t[28]===a?A=t[29]:(A=(0,Y.jsx)(Rv,{phase:a}),t[28]=a,t[29]=A);let j;t[30]===r?j=t[31]:(j=()=>r(!1),t[30]=r,t[31]=j);let M=a.kind===`already-seeded`||a.kind===`error`?`Close`:`Cancel`,N;t[32]!==j||t[33]!==M?(N=(0,Y.jsx)(K,{variant:`ghost`,onClick:j,children:M}),t[32]=j,t[33]=M,t[34]=N):N=t[34];let P;t[35]!==b||t[36]!==a.kind||t[37]!==g?(P=a.kind===`plan`?(0,Y.jsx)(K,{onClick:b,disabled:g,children:`Initialize`}):a.kind===`applying`?(0,Y.jsxs)(K,{disabled:!0,children:[(0,Y.jsx)(Ye,{"aria-hidden":`true`,className:`h-4 w-4 animate-spin`}),`Initializing…`]}):null,t[35]=b,t[36]=a.kind,t[37]=g,t[38]=P):P=t[38];let F;t[39]!==N||t[40]!==P?(F=(0,Y.jsxs)(Nt,{children:[N,P]}),t[39]=N,t[40]=P,t[41]=F):F=t[41];let I;t[42]!==k||t[43]!==A||t[44]!==F?(I=(0,Y.jsxs)(Kt,{className:`sm:max-w-lg`,"data-ok-layer-spawned":``,children:[O,k,A,F]}),t[42]=k,t[43]=A,t[44]=F,t[45]=I):I=t[45];let ee;return t[46]!==r||t[47]!==n||t[48]!==I?(ee=(0,Y.jsx)(Jt,{open:n,onOpenChange:r,children:I}),t[46]=r,t[47]=n,t[48]=I,t[49]=ee):ee=t[49],ee}function Iv(e){return e.kind===`plan`||e.kind===`already-seeded`?e:{kind:`loading`}}function Lv(e){let t=(0,Z.c)(30),{choice:n,subfolder:r,onChoiceChange:i,onSubfolderChange:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Y.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`Where should the brain live?`}),t[0]=o):o=t[0];let s=n===`project-root`,c;t[1]===i?c=t[2]:(c=()=>i(`project-root`),t[1]=i,t[2]=c);let l;t[3]!==s||t[4]!==c?(l=(0,Y.jsx)(`input`,{type:`radio`,name:`seed-root-choice`,checked:s,onChange:c,className:`mt-1`}),t[3]=s,t[4]=c,t[5]=l):l=t[5];let u;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(`span`,{className:`font-medium`,children:`Project root`}),(0,Y.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:`Scaffold the three folders directly under this project.`})]}),t[6]=u):u=t[6];let d;t[7]===l?d=t[8]:(d=(0,Y.jsxs)(`label`,{className:`flex items-start gap-2 text-sm`,children:[l,u]}),t[7]=l,t[8]=d);let f=n===`subfolder`,p;t[9]===i?p=t[10]:(p=()=>i(`subfolder`),t[9]=i,t[10]=p);let m;t[11]!==f||t[12]!==p?(m=(0,Y.jsx)(`input`,{type:`radio`,name:`seed-root-choice`,checked:f,onChange:p,className:`mt-1`}),t[11]=f,t[12]=p,t[13]=m):m=t[13];let h,g;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Y.jsx)(`span`,{className:`font-medium`,children:`In a subfolder`}),g=(0,Y.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:`Created if missing. Reuses the folder if it already exists.`}),t[14]=h,t[15]=g):(h=t[14],g=t[15]);let _;t[16]===a?_=t[17]:(_=e=>a(e.target.value),t[16]=a,t[17]=_);let v;t[18]===i?v=t[19]:(v=()=>i(`subfolder`),t[18]=i,t[19]=v);let y;t[20]!==r||t[21]!==_||t[22]!==v?(y=(0,Y.jsxs)(`span`,{className:`flex-1`,children:[h,g,(0,Y.jsx)(Ue,{value:r,onChange:_,onFocus:v,placeholder:`brain`,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,className:`mt-1.5 font-mono text-xs`})]}),t[20]=r,t[21]=_,t[22]=v,t[23]=y):y=t[23];let b;t[24]!==y||t[25]!==m?(b=(0,Y.jsxs)(`label`,{className:`flex items-start gap-2 text-sm`,children:[m,y]}),t[24]=y,t[25]=m,t[26]=b):b=t[26];let x;return t[27]!==b||t[28]!==d?(x=(0,Y.jsxs)(`div`,{className:`space-y-2 border-y py-3`,children:[o,d,b]}),t[27]=b,t[28]=d,t[29]=x):x=t[29],x}function Rv(e){let t=(0,Z.c)(18),{phase:n}=e;if(n.kind===`loading`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 py-4 text-sm text-muted-foreground`,children:[(0,Y.jsx)(Ye,{"aria-hidden":`true`,className:`h-4 w-4 animate-spin`}),`Computing scaffold plan…`]}),t[0]=e):e=t[0],e}if(n.kind===`error`){let e;return t[1]===n.message?e=t[2]:(e=(0,Y.jsx)(`div`,{className:`rounded-md bg-destructive/10 p-3 text-sm text-destructive`,children:n.message}),t[1]=n.message,t[2]=e),e}if(n.kind===`already-seeded`){let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsxs)(`div`,{className:`py-2 text-sm`,children:[(0,Y.jsx)(`p`,{className:`font-medium`,children:`This knowledge base is already initialized.`}),(0,Y.jsx)(`p`,{className:`text-muted-foreground`,children:`Nothing to do — the scaffolder has already been applied. Re-running would produce zero changes.`})]}),t[3]=e):e=t[3],e}let r=n.plan,i,a,o;if(t[4]!==r.created){let e=r.created.filter(Wv),n=r.created.filter(Uv);i=`space-y-3 py-2 text-sm`,a=e.length>0?(0,Y.jsx)(Gv,{title:`Folders`,items:e.map(Hv)}):null,o=n.length>0?(0,Y.jsx)(Gv,{title:`Files`,items:n.map(Vv)}):null,t[4]=r.created,t[5]=i,t[6]=a,t[7]=o}else i=t[5],a=t[6],o=t[7];let s;t[8]===r.configEdits?s=t[9]:(s=r.configEdits.length>0?(0,Y.jsx)(Gv,{title:`config.yml folders: entries`,items:r.configEdits.map(Bv)}):null,t[8]=r.configEdits,t[9]=s);let c;t[10]===r.warnings?c=t[11]:(c=r.warnings.length>0?(0,Y.jsx)(`div`,{className:`rounded-md bg-warning/10 p-3 text-sm text-warning-foreground`,children:r.warnings.map(zv)}):null,t[10]=r.warnings,t[11]=c);let l;return t[12]!==i||t[13]!==a||t[14]!==o||t[15]!==s||t[16]!==c?(l=(0,Y.jsxs)(`div`,{className:i,children:[a,o,s,c]}),t[12]=i,t[13]=a,t[14]=o,t[15]=s,t[16]=c,t[17]=l):l=t[17],l}function zv(e){return(0,Y.jsx)(`p`,{children:e},e)}function Bv(e){return{key:e.folderMatch,leading:(0,Y.jsx)(de,{"aria-hidden":`true`,className:`h-4 w-4 text-muted-foreground`}),label:e.folderMatch,detail:e.entry.frontmatter.description}}function Vv(e){return{key:e.path,leading:(0,Y.jsx)(wi,{"aria-hidden":`true`,className:`h-4 w-4 text-muted-foreground`}),label:e.path}}function Hv(e){return{key:e.path,leading:(0,Y.jsx)(Oi,{"aria-hidden":`true`,className:`h-4 w-4 text-muted-foreground`}),label:`${e.path}/`}}function Uv(e){return e.kind===`file`}function Wv(e){return e.kind===`folder`}function Gv(e){let t=(0,Z.c)(9),{title:n,items:r}=e,i;t[0]===n?i=t[1]:(i=(0,Y.jsx)(`h3`,{className:`mb-1 text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=r.map(Kv),t[2]=r,t[3]=a);let o;t[4]===a?o=t[5]:(o=(0,Y.jsx)(`ul`,{className:`space-y-1`,children:a}),t[4]=a,t[5]=o);let s;return t[6]!==i||t[7]!==o?(s=(0,Y.jsxs)(`section`,{children:[i,o]}),t[6]=i,t[7]=o,t[8]=s):s=t[8],s}function Kv(e){return(0,Y.jsxs)(`li`,{className:`space-y-0.5`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.leading,(0,Y.jsx)(`code`,{className:`text-xs`,children:e.label})]}),e.detail?(0,Y.jsx)(`p`,{className:`pl-6 text-xs text-muted-foreground`,children:e.detail}):null]},e.key)}function qv(e){let t=(0,Z.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=W(`flex h-full w-full aria-[orientation=vertical]:flex-col`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Y.jsx)(Kg,{"data-slot":`resizable-panel-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Jv(e){let t=(0,Z.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,Y.jsx)(Yg,{"data-slot":`resizable-panel`,...n}),t[2]=n,t[3]=r),r}function Yv(e){let t=(0,Z.c)(12),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({withHandle:i,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=W(`relative flex w-px items-center justify-center bg-border ring-offset-background after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-ring focus-visible:outline-hidden aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:translate-x-0 aria-[orientation=horizontal]:after:-translate-y-1/2 [&[aria-orientation=horizontal]>div]:rotate-90`,n),t[4]=n,t[5]=a);let o;t[6]===i?o=t[7]:(o=i&&(0,Y.jsx)(`div`,{className:`z-10 flex h-6 w-1 shrink-0 rounded-lg bg-border`}),t[6]=i,t[7]=o);let s;return t[8]!==r||t[9]!==a||t[10]!==o?(s=(0,Y.jsx)($g,{"data-slot":`resizable-handle`,className:a,...r,children:o}),t[8]=r,t[9]=a,t[10]=o,t[11]=s):s=t[11],s}var Xv=960,Zv=1024;function Qv(){let e=(0,Z.c)(5),[t,n]=(0,X.useState)(ey),[r,i]=(0,X.useState)($v),a,o;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>{let e=window.matchMedia(`(max-width: ${Xv-1}px)`),t=window.matchMedia(`(max-width: ${Zv-1}px)`),r=()=>{let r=e.matches;n(r?`sheet`:`panel`),i(!r&&t.matches)};return e.addEventListener(`change`,r),t.addEventListener(`change`,r),()=>{e.removeEventListener(`change`,r),t.removeEventListener(`change`,r)}},o=[],e[0]=a,e[1]=o):(a=e[0],o=e[1]),(0,X.useEffect)(a,o);let s;return e[2]!==r||e[3]!==t?(s={layout:t,autoCollapse:r},e[2]=r,e[3]=t,e[4]=s):s=e[4],s}function $v(){return window.innerWidth>=Xv&&window.innerWidth<Zv}function ey(){return window.innerWidth<Xv?`sheet`:`panel`}var ty={words:0,chars:0,tokens:0},ny=/[ -〿぀-ゟ゠-ヿ㐀-䶿一-鿿豈-﫿＀-￯฀-๿ក-៿]/,ry=/[\p{L}\p{N}]/u;function iy(e){if(!e)return 0;let t=0;for(let n of e.split(/\s+/))ry.test(n)&&t++;return t}function ay(e){let t=globalThis.Intl.Segmenter;if(!t)return iy(e);let n=new t(void 0,{granularity:`word`}),r=0;for(let t of n.segment(e))t.isWordLike&&r++;return r}function oy(e){let t=ny.test(e)?1.5:4;return Math.ceil(e.length/t)}function sy(e){if(!e)return{words:0,chars:0,tokens:0};let{body:t}=Sn(e),n=t.trim();return n?{words:ny.test(n)?ay(n):iy(n),chars:n.length,tokens:oy(n)}:{words:0,chars:0,tokens:0}}var cy=300;function ly(e,t){let n=(0,Z.c)(4),[r,i]=(0,X.useState)(ty),a,o;return n[0]!==t||n[1]!==e?(a=()=>{if(!e||!t){i(ty);return}let n=e.document.getText(`source`),r=!1,a=null,o=function(){r||i(sy(n.toString()))};o();let s=function(){a&&clearTimeout(a),a=setTimeout(o,cy)};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,X.useEffect)(a,o),r}var uy=Gn;function dy(){let[e]=(0,X.useState)(Dn);return e}function fy(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 py=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&&wn(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(En(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(bn(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(Un(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(rr(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(An(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(pn(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(kn(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(_n(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=$n(this.view,e.from,e.to),r={getBoundingClientRect:()=>n,getClientRects:()=>[n]};if(e instanceof zn){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 In){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():fy(o.getBoundingClientRect(),s.getBoundingClientRect());r={getBoundingClientRect:()=>c,getClientRects:()=>[c]}}return r}updatePosition(){if(!this.isVisible)return;let e=this.virtualElement;e&&vn(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()}},my=e=>new fn({key:typeof e.pluginKey==`string`?new Ln(e.pluginKey):e.pluginKey,view:t=>new py({view:t,...e})});Pn.create({name:`bubbleMenu`,addOptions(){return{element:null,pluginKey:`bubbleMenu`,updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[my({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 hy=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 Zn(e,{textSerializers:tr(this.editor.schema)})}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(En(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(bn(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(Un(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(rr(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(An(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(pn(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(kn(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(_n(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=$n(this.view,e.from,e.to);vn({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()}},gy=e=>new fn({key:typeof e.pluginKey==`string`?new Ln(e.pluginKey):e.pluginKey,view:t=>new hy({view:t,...e})});Pn.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?[gy({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 _y(e,t){return e??new Ln(t)}var vy=typeof window<`u`?X.useLayoutEffect:X.useEffect,yy=new Set([`left`,`opacity`,`position`,`top`,`visibility`,`width`]),by=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(`.`)),xy=new Set([`children`,`className`,`style`]),Sy=new Set([`tabIndex`]),Cy=new Set([`accessKey`,`autoCapitalize`,`contentEditable`,`contextMenu`,`dir`,`draggable`,`enterKeyHint`,`hidden`,`id`,`lang`,`nonce`,`role`,`slot`,`spellCheck`,`tabIndex`,`title`,`translate`]),wy={Blur:`focusout`,DoubleClick:`dblclick`,Focus:`focusin`,MouseEnter:`mouseenter`,MouseLeave:`mouseleave`};function Ty(e,t){return/^on[A-Z]/.test(e)&&typeof t==`function`}function Ey(e){return e.startsWith(`aria-`)||e.startsWith(`data-`),e}function Dy(e){return e.startsWith(`aria-`)||e.startsWith(`data-`)||Cy.has(e)}function Oy(e){return e.startsWith(`--`)?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function ky(e){let t=e.endsWith(`Capture`),n=(t?e.slice(0,-7):e).slice(2);return{eventName:wy[n]??n.toLowerCase(),options:t?{capture:!0}:void 0}}function Ay(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 jy(e){return Sy.has(e)}function My(e,t,n){if(t===`tabIndex`){e.tabIndex=Number(n);return}e[t]=n}function Ny(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 Py(e,t){return typeof t!=`number`||t===0||e.startsWith(`--`)||by.has(e)?String(t):`${t}px`}function Fy(e,t){yy.has(t)||e.style.removeProperty(Oy(t))}function Iy(e,t,n){yy.has(t)||e.style.setProperty(Oy(t),Py(t,n))}function Ly(e,t,n){new Set([...Object.keys(t),...Object.keys(n)]).forEach(r=>{if(xy.has(r)||!Dy(r)||Ty(r,t[r])||Ty(r,n[r]))return;let i=t[r],a=n[r];if(i===a)return;let o=Ey(r);if(a==null||a===!1){jy(r)&&Ny(e,r),e.removeAttribute(o);return}if(a===!0){jy(r)&&My(e,r,!0),e.setAttribute(o,``);return}if(jy(r)){My(e,r,a);return}e.setAttribute(o,String(a))})}function Ry(e,t,n){if(t!==n){if(n){e.className=n;return}e.removeAttribute(`class`)}}function zy(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){Fy(e,t);return}Iy(e,t,a)}})}function By(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(!Ty(t,n))return;let{eventName:i,options:a}=ky(t),o=t=>{n(Ay(e,t))};e.addEventListener(i,o,a),r.push({eventName:i,listener:o,options:a})}),r}function Vy(e,t){let n=(0,X.useRef)({}),r=(0,X.useRef)([]);vy(()=>{let i=n.current;return Ry(e,i.className,t.className),zy(e,i.style,t.style),Ly(e,i,t),r.current=By(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 Hy=X.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,X.useRef)(document.createElement(`div`)),f=(0,X.useRef)(_y(e,`bubbleMenu`)).current;Vy(d.current,l),typeof u==`function`?u(d.current):u&&(u.current=d.current);let{editor:p}=xt(),m=t||p,h={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:f,shouldShow:a,getReferencedVirtualElement:o,options:s},g=(0,X.useRef)(h);g.current=h;let[_,v]=(0,X.useState)(!1),y=(0,X.useRef)(!0);return(0,X.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=my({...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,X.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,ni.createPortal)(c,d.current)});X.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:r,appendTo:i,shouldShow:a=null,options:o,children:s,...c},l)=>{let u=(0,X.useRef)(document.createElement(`div`)),d=(0,X.useRef)(_y(e,`floatingMenu`)).current;Vy(u.current,c),typeof l==`function`?l(u.current):l&&(l.current=u.current);let{editor:f}=xt(),p=t||f,m={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:d,shouldShow:a,options:o},h=(0,X.useRef)(m);h.current=m;let[g,_]=(0,X.useState)(!1),v=(0,X.useRef)(!0);return(0,X.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=gy({...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,X.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,ni.createPortal)(s,u.current)});function Uy(e){let t=(0,Z.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,orientation:i,decorative:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?`horizontal`:i,s=a===void 0?!0:a,c;t[5]===n?c=t[6]:(c=W(`shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch`,n),t[5]=n,t[6]=c);let l;return t[7]!==s||t[8]!==o||t[9]!==r||t[10]!==c?(l=(0,Y.jsx)(yl,{"data-slot":`separator`,decorative:s,orientation:o,className:c,...r}),t[7]=s,t[8]=o,t[9]=r,t[10]=c,t[11]=l):l=t[11],l}var Wy=[{name:`paragraph`,label:`Text`,icon:Ji,isActive:e=>e.isActive(`paragraph`)&&!e.isActive(`list`),command:e=>e.chain().focus().setParagraph().run()},{name:`heading1`,label:`Heading 1`,icon:lt,isActive:e=>e.isActive(`heading`,{level:1}),command:e=>e.chain().focus().toggleHeading({level:1}).run()},{name:`heading2`,label:`Heading 2`,icon:ht,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:ct,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:Ze,isActive:e=>e.isActive(`list`,{ordered:!0}),command:e=>e.chain().focus().toggleOrderedList().run()},{name:`taskList`,label:`Task List`,icon:Ct,isActive:e=>e.isActive(`listItem`,{checked:!0})||e.isActive(`listItem`,{checked:!1}),command:e=>e.chain().focus().toggleTaskList().run()},{name:`blockquote`,label:`Quote`,icon:pt,isActive:e=>e.isActive(`blockquote`),command:e=>e.chain().focus().toggleBlockquote().run()},{name:`codeBlock`,label:`Code Block`,icon:oa,isActive:e=>e.isActive(`codeBlock`),command:e=>e.chain().focus().toggleCodeBlock().run()}];function Gy(e){let t=(0,Z.c)(18),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:Ky},t[0]=n,t[1]=r);let{current:i,activeStates:a}=dt(r),o=i.icon,s;t[2]===o?s=t[3]:(s=(0,Y.jsx)(o,{className:`size-3.5`}),t[2]=o,t[3]=s);let c;t[4]===i.label?c=t[5]:(c=(0,Y.jsx)(`span`,{children:i.label}),t[4]=i.label,t[5]=c);let l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Y.jsx)(fe,{className:`size-3 opacity-50`}),t[6]=l):l=t[6];let u;t[7]!==s||t[8]!==c?(u=(0,Y.jsx)(L_,{asChild:!0,children:(0,Y.jsxs)(K,{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=Wy.map(e=>{let t=e.icon,r=a[e.name];return(0,Y.jsxs)(z_,{className:r?`bg-accent text-accent-foreground`:``,onSelect:()=>{e.command(n)},children:[(0,Y.jsx)(t,{className:`size-4`}),(0,Y.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,Y.jsx)(R_,{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,Y.jsxs)(I_,{children:[u,f]}),t[15]=u,t[16]=f,t[17]=p):p=t[17],p}function Ky(e){let t=Object.fromEntries(Wy.map(t=>[t.name,t.isActive(e.editor)]));return{current:Wy.find(e=>t[e.name])??Wy[0],activeStates:t}}var qy=[{name:`bold`,icon:ei,command:e=>e.chain().focus().toggleBold().run(),isActive:e=>e.isActive(`strong`),shortcut:`⌘B`},{name:`italic`,icon:Fi,command:e=>e.chain().focus().toggleItalic().run(),isActive:e=>e.isActive(`emphasis`),shortcut:`⌘I`},{name:`underline`,icon:pa,command:e=>e.chain().focus().toggleUnderline().run(),isActive:e=>e.isActive(`underline`),shortcut:`⌘U`},{name:`strikethrough`,icon:la,command:e=>e.chain().focus().toggleStrike().run(),isActive:e=>e.isActive(`strike`),shortcut:`⌘⇧X`},{name:`code`,icon:pi,command:e=>e.chain().focus().toggleCode().run(),isActive:e=>e.isActive(`code`),shortcut:`⌘E`},{name:`highlight`,icon:Ni,command:e=>e.chain().focus().toggleHighlight().run(),isActive:e=>e.isActive(`highlight`),shortcut:`⌘⇧H`}];function Jy(e){let t=(0,Z.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:Yy},t[0]=n,t[1]=r);let i=dt(r),a;t[2]!==i||t[3]!==n?(a=qy.map(e=>{let t=e.icon,r=i[e.name];return(0,Y.jsxs)(ln,{children:[(0,Y.jsx)(nn,{asChild:!0,children:(0,Y.jsx)(K,{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,Y.jsx)(t,{className:`size-3.5`})})}),(0,Y.jsxs)(an,{side:`bottom`,sideOffset:8,children:[(0,Y.jsx)(`span`,{className:`capitalize`,children:e.name}),(0,Y.jsx)(`kbd`,{className:`ml-1.5 text-[10px] opacity-60`,children:e.shortcut})]})]},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,Y.jsx)(`div`,{className:`flex items-center gap-0.5`,children:a}),t[5]=a,t[6]=o),o}function Yy(e){return Object.fromEntries(qy.map(t=>[t.name,t.isActive(e.editor)]))}function Xy(e){let t=(0,Z.c)(46),{editor:n}=e,[r,i]=(0,X.useState)(!1),[a,o]=(0,X.useState)(``),s=(0,X.useRef)(null),c;t[0]===n?c=t[1]:(c=n.isActive(`link`),t[0]=n,t[1]=c);let l=c,u;t[2]===n?u=t[3]:(u=n.getAttributes(`link`).href??``,t[2]=n,t[3]=u);let d=u,f,p;t[4]===n?(f=t[5],p=t[6]):(f=()=>{let e=function(){n.state.selection.empty&&i(!1)};return n.on(`selectionUpdate`,e),()=>{n.off(`selectionUpdate`,e)}},p=[n],t[4]=n,t[5]=f,t[6]=p),(0,X.useEffect)(f,p);let m,h;t[7]!==d||t[8]!==r?(m=()=>{r&&(o(d),requestAnimationFrame(()=>s.current?.focus()))},h=[r,d],t[7]=d,t[8]=r,t[9]=m,t[10]=h):(m=t[9],h=t[10]),(0,X.useEffect)(m,h);let g;t[11]!==n||t[12]!==l||t[13]!==a?(g=function(){a.trim()?n.chain().focus().setLink({href:a.trim()}).run():l&&n.chain().focus().unsetLink().run(),i(!1)},t[11]=n,t[12]=l,t[13]=a,t[14]=g):g=t[14];let _=g,v;t[15]===n?v=t[16]:(v=function(){n.chain().focus().unsetLink().run(),i(!1)},t[15]=n,t[16]=v);let y=v,b;t[17]!==_||t[18]!==n?(b=function(e){e.key===`Enter`&&(e.preventDefault(),_()),e.key===`Escape`&&(e.preventDefault(),i(!1),n.chain().focus().run())},t[17]=_,t[18]=n,t[19]=b):b=t[19];let x=b;if(r){let e;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(e=e=>o(e.target.value),t[20]=e):e=t[20];let n;t[21]!==x||t[22]!==a?(n=(0,Y.jsx)(`input`,{ref:s,type:`url`,placeholder:`Paste link...`,value:a,onChange:e,onKeyDown:x,"aria-label":`Link URL`,className:`h-5 w-44 bg-transparent text-sm border-none outline-none placeholder:text-muted-foreground`}),t[21]=x,t[22]=a,t[23]=n):n=t[23];let r;t[24]===_?r=t[25]:(r=()=>{_()},t[24]=_,t[25]=r);let i;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Y.jsx)(vi,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[26]=i):i=t[26];let c;t[27]===r?c=t[28]:(c=(0,Y.jsx)(K,{variant:`ghost`,size:`icon-xs`,"aria-label":`Apply link`,onClick:r,children:i}),t[27]=r,t[28]=c);let u;t[29]!==n||t[30]!==c?(u=(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5 rounded-md border bg-background px-2 py-1`,children:[n,c]}),t[29]=n,t[30]=c,t[31]=u):u=t[31];let f;t[32]!==d||t[33]!==l||t[34]!==y?(f=l&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(ln,{children:[(0,Y.jsx)(nn,{asChild:!0,children:(0,Y.jsx)(K,{variant:`ghost`,size:`icon-xs`,"aria-label":`Open link in new tab`,onMouseDown:e=>{e.preventDefault(),window.open(d,`_blank`,`noopener,noreferrer`)},children:(0,Y.jsx)(Te,{className:`size-3.5`})})}),(0,Y.jsx)(an,{side:`bottom`,sideOffset:8,children:`Open link in new tab`})]}),(0,Y.jsxs)(ln,{children:[(0,Y.jsx)(nn,{asChild:!0,children:(0,Y.jsx)(K,{variant:`ghost`,size:`icon-xs`,"aria-label":`Remove link`,onMouseDown:e=>{e.preventDefault(),y()},children:(0,Y.jsx)(Ke,{className:`size-3.5`})})}),(0,Y.jsx)(an,{side:`bottom`,sideOffset:8,children:`Remove link`})]})]}),t[32]=d,t[33]=l,t[34]=y,t[35]=f):f=t[35];let p;return t[36]!==u||t[37]!==f?(p=(0,Y.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[u,f]}),t[36]=u,t[37]=f,t[38]=p):p=t[38],p}let S=l?`bg-accent text-primary`:`text-accent-foreground`,C,w;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(C=e=>{e.preventDefault(),i(!0)},w=(0,Y.jsx)(Ri,{className:`size-3.5`}),t[39]=C,t[40]=w):(C=t[39],w=t[40]);let T;t[41]===S?T=t[42]:(T=(0,Y.jsx)(nn,{asChild:!0,children:(0,Y.jsx)(K,{variant:`ghost`,size:`icon-xs`,"aria-label":`Insert link`,className:S,onMouseDown:C,children:w})}),t[41]=S,t[42]=T);let E;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Y.jsxs)(an,{side:`bottom`,sideOffset:8,children:[`Link`,(0,Y.jsx)(`kbd`,{className:`ml-1.5 text-[10px] opacity-60`,children:`⌘K`})]}),t[43]=E):E=t[43];let D;return t[44]===T?D=t[45]:(D=(0,Y.jsxs)(ln,{children:[T,E]}),t[44]=T,t[45]=D),D}function Zy({editor:e}){if(e.state.selection.empty||e.isActive(`codeBlock`))return!1;let{from:t,to:n}=e.state.selection;return!!e.state.doc.textBetween(t,n,` `).trim()}function Qy(e){let t=(0,Z.c)(25),{editor:n}=e,r=(0,X.useRef)(null),[i,a]=(0,X.useState)(0),o=(0,X.useRef)(null),s;t[0]!==n.state||t[1]!==n.view?(s=()=>{try{let{from:e,to:t}=n.state.selection;return $n(n.view,e,t)}catch{return new DOMRect}},t[0]=n.state,t[1]=n.view,t[2]=s):s=t[2];let c;if(t[3]!==n.view.dom||t[4]!==s){let e={getBoundingClientRect:s,contextElement:n.view.dom};c=()=>{let t=r.current;t&&(o.current?.(),o.current=On(e,t,()=>{vn(e,t,{placement:`top`,strategy:`fixed`,middleware:[Un(8),En(),bn({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(tb)}))},t[3]=n.view.dom,t[4]=s,t[5]=c}else c=t[5];let l=c,u;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>{o.current?.(),o.current=null,a(eb)},t[6]=u):u=t[6];let d=u,f;t[7]===l?f=t[8]:(f={onShow:l,onHide:d,strategy:`fixed`},t[7]=l,t[8]=f);let p;t[9]===n?p=t[10]:(p=(0,Y.jsx)(Gy,{editor:n}),t[9]=n,t[10]=p);let m;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Y.jsx)(Uy,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),t[11]=m):m=t[11];let h;t[12]!==n||t[13]!==i?(h=(0,Y.jsx)(Jy,{editor:n},i),t[12]=n,t[13]=i,t[14]=h):h=t[14];let g;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Y.jsx)(Uy,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),t[15]=g):g=t[15];let _=`${i}-link`,v;t[16]!==n||t[17]!==_?(v=(0,Y.jsx)(Xy,{editor:n},_),t[16]=n,t[17]=_,t[18]=v):v=t[18];let y;return t[19]!==n||t[20]!==v||t[21]!==f||t[22]!==p||t[23]!==h?(y=(0,Y.jsxs)(Hy,{ref:r,editor:n,appendTo:$y,shouldShow:Zy,updateDelay:250,options:f,className:`z-50 flex items-center gap-0.5 rounded-lg border bg-background p-1 shadow-md`,children:[p,m,h,g,v]}),t[19]=n,t[20]=v,t[21]=f,t[22]=p,t[23]=h,t[24]=y):y=t[24],y}function $y(){return document.body}function eb(e){return e+1}function tb(){}var nb=[{name:`addRowBefore`,icon:Qr,label:`Add row above`,command:e=>e.chain().focus().addRowBefore().run()},{name:`addRowAfter`,icon:Yr,label:`Add row below`,command:e=>e.chain().focus().addRowAfter().run()},{name:`deleteRow`,icon:Ke,label:`Delete row`,command:e=>e.chain().focus().deleteRow().run()}],rb=[{name:`addColumnBefore`,icon:_e,label:`Add column left`,command:e=>e.chain().focus().addColumnBefore().run()},{name:`addColumnAfter`,icon:Xr,label:`Add column right`,command:e=>e.chain().focus().addColumnAfter().run()},{name:`deleteColumn`,icon:Ke,label:`Delete column`,command:e=>e.chain().focus().deleteColumn().run()}],ib=[{name:`toggleHeaderRow`,icon:da,label:`Toggle header row`,command:e=>e.chain().focus().toggleHeaderRow().run()},{name:`toggleHeaderColumn`,icon:hi,label:`Toggle header column`,command:e=>e.chain().focus().toggleHeaderColumn().run()},{name:`deleteTable`,icon:ji,label:`Delete table`,command:e=>e.chain().focus().deleteTable().run()}];function ab({editor:e}){return e.isActive(`table`)}function ob(e){let t=(0,Z.c)(14),{action:n,editor:r}=e,i=n.icon,a;t[0]!==n||t[1]!==r?(a=e=>{e.preventDefault(),n.command(r)},t[0]=n,t[1]=r,t[2]=a):a=t[2];let o;t[3]===i?o=t[4]:(o=(0,Y.jsx)(i,{className:`size-3.5`}),t[3]=i,t[4]=o);let s;t[5]!==n.label||t[6]!==a||t[7]!==o?(s=(0,Y.jsx)(nn,{asChild:!0,children:(0,Y.jsx)(K,{variant:`ghost`,size:`icon-xs`,"aria-label":n.label,className:`text-muted-foreground`,onMouseDown:a,children:o})}),t[5]=n.label,t[6]=a,t[7]=o,t[8]=s):s=t[8];let c;t[9]===n.label?c=t[10]:(c=(0,Y.jsx)(an,{side:`bottom`,sideOffset:8,children:n.label}),t[9]=n.label,t[10]=c);let l;return t[11]!==s||t[12]!==c?(l=(0,Y.jsxs)(ln,{children:[s,c]}),t[11]=s,t[12]=c,t[13]=l):l=t[13],l}function sb(e){let t=(0,Z.c)(13),{editor:n}=e,r;t[0]===n?r=t[1]:(r=nb.map(e=>(0,Y.jsx)(ob,{action:e,editor:n},e.name)),t[0]=n,t[1]=r);let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Y.jsx)(Uy,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),t[2]=i):i=t[2];let a;t[3]===n?a=t[4]:(a=rb.map(e=>(0,Y.jsx)(ob,{action:e,editor:n},e.name)),t[3]=n,t[4]=a);let o;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Y.jsx)(Uy,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),t[5]=o):o=t[5];let s;t[6]===n?s=t[7]:(s=ib.map(e=>(0,Y.jsx)(ob,{action:e,editor:n},e.name)),t[6]=n,t[7]=s);let c;return t[8]!==n||t[9]!==r||t[10]!==a||t[11]!==s?(c=(0,Y.jsxs)(Hy,{editor:n,shouldShow:ab,updateDelay:100,className:`flex items-center gap-0.5 rounded-lg border bg-background p-1 shadow-md`,children:[r,i,a,o,s]}),t[8]=n,t[9]=r,t[10]=a,t[11]=s,t[12]=c):c=t[12],c}var cb=new WeakMap;function lb(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=Cn(e.color),n.textContent=e.name,t.append(n),t}var ub={state:`idle`,count:0,lastFiredAt:null,position:`append`,lastAgentId:null},db=e=>{let t=(0,Z.c)(53),{provider:n,placeholder:r}=e,i=(0,X.useRef)(``),a=(0,X.useRef)(null),o=(0,X.useRef)(ub),s=dy(),[c]=(0,X.useState)(fb),[l,u]=(0,X.useState)(null),[d,f]=(0,X.useState)(null);if(d)throw d;let p=(0,X.useRef)(null),m=n.configuration.name??``,h;t[0]!==c||t[1]!==m||t[2]!==r||t[3]!==n?(h=()=>{let e;try{let t={viewCount:0,bytes:n.document.getText(`source`).length};e=Ve({docName:m,container:document.createElement(`div`),sizeStats:t,factory:e=>{let t=performance.now();return{editor:new Xn({element:e,onBeforeCreate:e=>{let{editor:n}=e;cb.set(n,t)},onCreate:e=>{let{editor:t}=e,r=cb.get(t);if(cb.delete(t),r==null)return;let i=performance.now();it(`ok/editor/create-tiptap`,{docName:n.configuration.name??`unknown`,ytextLength:n.document.getText(`source`).length},{startTime:r,duration:Math.max(0,i-r)})},editorProps:{attributes:{class:`pt-10 pb-16 h-full`},clipboardTextParser:(e,t,n,r)=>{let i=c.mdManager.parse(e);return r.state.schema.nodeFromJSON(i).content},clipboardTextSerializer:(e,t)=>c.text(e,t),clipboardSerializer:c.html,handlePaste:(e,t)=>c.paste(e,t)},extensions:[...$e.map(e=>e.name===`link`?e.configure({docName:n.configuration.name??``}):e),uy.configure({placeholder:r??`Type '/' for commands`,showOnlyCurrent:!0}),ot.configure({document:n.document}),Pn.create({name:`imageUploadDecoration`,addProseMirrorPlugins(){return[at]}}),Pn.create({name:`collaborationCursor`,addProseMirrorPlugins(){let e=n.awareness;if(!e)throw Error(`[TiptapEditor] HocuspocusProvider has no awareness instance — cursor plugin cannot initialize`);return[Fe(e,{cursorBuilder:lb})]}})]}),ydoc:n.document,ytext:n.document.getText(`source`),provider:n}}}),p.current=e,u(e.editor)}catch(e){let t=e;console.error(`[TiptapEditor] mountTiptapEditor failed`,t),p.current=null,u(null),f(t instanceof Error?t:Error(String(t)))}return()=>{let e=p.current;e&&Re(e),p.current=null,u(null)}},t[0]=c,t[1]=m,t[2]=r,t[3]=n,t[4]=h):h=t[4];let g;t[5]!==c||t[6]!==m||t[7]!==n?(g=[m,n,c],t[5]=c,t[6]=m,t[7]=n,t[8]=g):g=t[8],(0,X.useEffect)(h,g);let _;t[9]===n.configuration.name?_=t[10]:(_=()=>{let e=n.configuration.name;return Pe(e??null),pb},t[9]=n.configuration.name,t[10]=_);let v;t[11]===n?v=t[12]:(v=[n],t[11]=n,t[12]=v),(0,X.useEffect)(_,v);let y;t[13]!==l||t[14]!==n.configuration.name?(y=()=>{},t[13]=l,t[14]=n.configuration.name,t[15]=y):y=t[15];let b;t[16]!==l||t[17]!==n?(b=[l,n],t[16]=l,t[17]=n,t[18]=b):b=t[18],(0,X.useEffect)(y,b);let x,S;t[19]===l?(x=t[20],S=t[21]):(x=()=>{if(!l)return;let e=mb,t=null,n=()=>{t||!l||l.isDestroyed||(t=l.view.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 l.editorView?n():l.on(`create`,n),()=>{l.off(`create`,n),r()}},S=[l],t[19]=l,t[20]=x,t[21]=S),(0,X.useEffect)(x,S);let C,w;t[22]!==l||t[23]!==n.document?(w=()=>{if(!l)return;let e=n.document.getMap(`agent-flash`),t=Date.now(),r=0,i=null,s=null,c=null,u=()=>{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},d=e=>{o.current=e;let t=a.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??``))},f=()=>{let e=u(),t=e?.description?.toLowerCase().includes(`prepend`)?`prepend`:`append`,n={state:`editing`,count:(o.current?.count??0)+1,lastFiredAt:Date.now(),position:t,lastAgentId:e?.agentId??null};d(n),document.dispatchEvent(new CustomEvent(`agent-flash`,{detail:n})),s&&clearTimeout(s),c&&clearTimeout(c),s=window.setTimeout(()=>{let e={...n,state:`settled`};d(e),document.dispatchEvent(new CustomEvent(`agent-flash-end`,{detail:e})),c=window.setTimeout(()=>{d({...e,state:`idle`})},300)},Mn)};d(ub);let p=()=>{if(nr(e),!Tn(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(),f()},e)}return}r=n,f()};e.observe(p);let m=()=>{document.visibilityState===`visible`?Tn(e,t)&&(t=Date.now(),r=Date.now(),f()):t=Date.now()};return document.addEventListener(`visibilitychange`,m),()=>{e.unobserve(p),document.removeEventListener(`visibilitychange`,m),i&&clearTimeout(i),s&&clearTimeout(s),c&&clearTimeout(c)}},C=[l,n.document],t[22]=l,t[23]=n.document,t[24]=C,t[25]=w):(C=t[24],w=t[25]),(0,X.useEffect)(w,C);let T,E;t[26]===n?(T=t[27],E=t[28]):(T=()=>{let e=window.location.hash,t=e.indexOf(`?`),r=t>=0?new URLSearchParams(e.slice(t+1)).get(`anchor`):null;if(!r)return;let i=r,a=0,o,s=!1;function c(){if(s)return;let e=document.getElementById(i);e?(e.scrollIntoView({behavior:`smooth`,block:`start`}),s=!0,n.off(`synced`,c)):a<20&&(a+=1,o=window.setTimeout(c,100))}return c(),n.on(`synced`,c),()=>{o!==void 0&&clearTimeout(o),n.off(`synced`,c)}},E=[n],t[26]=n,t[27]=T,t[28]=E),(0,X.useEffect)(T,E);let D,O;t[29]===l?(D=t[30],O=t[31]):(D=()=>{if(!l)return;let e=function(e){let t=e.detail;if(!t||t.mode!==`wysiwyg`||!l||l.isDestroyed)return;let n=l.editorView;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(ir,e),()=>window.removeEventListener(ir,e)},O=[l],t[29]=l,t[30]=D,t[31]=O),(0,X.useEffect)(D,O);let k,A;t[32]===n.document?(k=t[33],A=t[34]):(k=()=>{let e=n.document.getMap(`metadata`),t=e.get(`frontmatter`);typeof t==`string`&&t&&(i.current=t);let r=()=>{let t=e.get(`frontmatter`);typeof t==`string`&&(i.current=t)};return e.observe(r),()=>e.unobserve(r)},A=[n.document],t[32]=n.document,t[33]=k,t[34]=A),(0,X.useEffect)(k,A);let j;t[35]!==s||t[36]!==n.awareness?(j=()=>{let e=n.awareness;e&&(e.setLocalStateField(`user`,{name:s.name,color:s.color,type:`human`,coeditor:s.coeditor,tabId:s.tabId}),e.setLocalStateField(`mode`,`wysiwyg`))},t[35]=s,t[36]=n.awareness,t[37]=j):j=t[37];let M;t[38]!==s||t[39]!==n?(M=[n,s],t[38]=s,t[39]=n,t[40]=M):M=t[40],(0,X.useEffect)(j,M);let N;t[41]===l?N=t[42]:(N=l&&(0,Y.jsx)(Qy,{editor:l}),t[41]=l,t[42]=N);let P;t[43]===l?P=t[44]:(P=l&&(0,Y.jsx)(sb,{editor:l}),t[43]=l,t[44]=P);let F,I;t[45]===l?(F=t[46],I=t[47]):(F=(0,Y.jsx)(Qe,{editor:l,className:`h-full`}),I=l&&(0,Y.jsx)(Ot,{store:wt(l).store}),t[45]=l,t[46]=F,t[47]=I);let ee;return t[48]!==N||t[49]!==P||t[50]!==F||t[51]!==I?(ee=(0,Y.jsxs)(`div`,{ref:a,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:[N,P,F,I]}),t[48]=N,t[49]=P,t[50]=F,t[51]=I,t[52]=ee):ee=t[52],ee};function fb(){let e=new er({extensions:jn});return{mdManager:e,text:ur({mdManager:e}),html:cr({mdManager:e}),paste:or({mdManager:e})}}function pb(){return Pe(null)}function mb(){return St()}function hb(e){let t=(0,Z.c)(2),{docName:n,provider:r,children:i}=e;(0,X.use)(st(n,r));let a;return t[0]===i?a=t[1]:(a=(0,Y.jsx)(Y.Fragment,{children:i}),t[0]=i,t[1]=a),a}var gb=(0,X.createContext)(null),_b={didCatch:!1,error:null},vb=class extends X.Component{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=_b}static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(...e){let{error:t}=this.state;t!==null&&(this.props.onReset?.({args:e,reason:`imperative-api`}),this.setState(_b))}componentDidCatch(e,t){this.props.onError?.(e,t)}componentDidUpdate(e,t){let{didCatch:n}=this.state,{resetKeys:r}=this.props;n&&t.error!==null&&yb(e.resetKeys,r)&&(this.props.onReset?.({next:r,prev:e.resetKeys,reason:`keys`}),this.setState(_b))}render(){let{children:e,fallbackRender:t,FallbackComponent:n,fallback:r}=this.props,{didCatch:i,error:a}=this.state,o=e;if(i){let e={error:a,resetErrorBoundary:this.resetErrorBoundary};if(typeof t==`function`)o=t(e);else if(n)o=(0,X.createElement)(n,e);else if(r!==void 0)o=r;else throw a}return(0,X.createElement)(gb.Provider,{value:{didCatch:i,error:a,resetErrorBoundary:this.resetErrorBoundary}},o)}};function yb(e=[],t=[]){return e.length!==t.length||e.some((e,n)=>!Object.is(e,t[n]))}var bb=`__back-nav__`;function xb(e){return e instanceof vt||e instanceof ft||e instanceof Ge||e instanceof rt?e.docName:null}function Sb(e){return e instanceof vt?{title:`Couldn't load document`,summary:`"${e.docName}" took too long. Check your connection.`}:e instanceof ft?{title:`Connection dropped`,summary:`Lost connection to "${e.docName}".`}:e instanceof Ge?{title:`Document not found`,summary:`"${e.docName}" doesn't exist.`}:e instanceof rt?{title:`Couldn't open document`,summary:`Something went wrong opening "${e.docName}".`}:{title:`Unknown error`,summary:e instanceof Error&&e.message?e.message:`An unexpected error occurred.`}}function Cb(e){let t=(0,Z.c)(27),{error:n,resetErrorBoundary:r,activeDocName:i,previousDocName:a,onNavigateBack:o}=e,s;t[0]===n?s=t[1]:(s=Sb(n),t[0]=n,t[1]=s);let{title:c,summary:l}=s,u=!!a&&!!o,d=(0,X.useRef)(null),f,p;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=()=>{d.current?.focus()},p=[],t[2]=f,t[3]=p):(f=t[2],p=t[3]),(0,X.useEffect)(f,p);let m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Y.jsx)(Av,{size:80,variant:`sleeping`}),t[4]=m):m=t[4];let h;t[5]===c?h=t[6]:(h=(0,Y.jsx)(`h2`,{id:`document-error-title`,className:`text-lg font-medium`,children:c}),t[5]=c,t[6]=h);let g;t[7]===l?g=t[8]:(g=(0,Y.jsx)(`p`,{className:`max-w-sm text-sm text-muted-foreground`,children:l}),t[7]=l,t[8]=g);let _;t[9]!==h||t[10]!==g?(_=(0,Y.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[h,g]}),t[9]=h,t[10]=g,t[11]=_):_=t[11];let v;t[12]===r?v=t[13]:(v=(0,Y.jsx)(K,{ref:d,variant:`default`,onClick:r,children:`Try again`}),t[12]=r,t[13]=v);let y;t[14]!==i||t[15]!==u||t[16]!==n||t[17]!==o||t[18]!==a||t[19]!==r?(y=u?(0,Y.jsx)(K,{variant:`ghost`,className:`font-mono uppercase`,onClick:()=>{!a||!o||(Je(xb(n)??i),o(a),r(bb))},children:`Go back`}):null,t[14]=i,t[15]=u,t[16]=n,t[17]=o,t[18]=a,t[19]=r,t[20]=y):y=t[20];let b;t[21]!==v||t[22]!==y?(b=(0,Y.jsxs)(`div`,{className:`mt-1 flex gap-2`,children:[v,y]}),t[21]=v,t[22]=y,t[23]=b):b=t[23];let x;return t[24]!==b||t[25]!==_?(x=(0,Y.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:[m,_,b]}),t[24]=b,t[25]=_,t[26]=x):x=t[26],x}function wb(e){let t=(0,Z.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,Y.jsx)(Cb,{...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]===bb){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.warn(`[DocumentErrorBoundary] rendered fallback for ${n}: ${Sb(e).title}`)},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,Y.jsx)(vb,{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 Tb(e){let t=e.threshold??5e5;return e.ytextLength>t?{renderSource:e.isSourceMode||e.visitedSource,renderVisual:!e.isSourceMode||e.visitedVisual,isLarge:!0}:{renderSource:!0,renderVisual:!0,isLarge:!1}}function Eb(){return n(()=>import(`./SourceEditor-M-p0lLYp.js`),__vite__mapDeps([15,1,2,16,17,18,6,4,5,12,8,13,19,10]),import.meta.url)}var Db=(0,X.lazy)(async()=>({default:(await Eb()).SourceEditor}));function Ob(e,t,n){if(n<=0)return[];let r=e.filter(e=>!Xe(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 kb(e){let t=(0,Z.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Y.jsx)(_t,{name:`activity-pool`,children:(0,Y.jsx)(Ab,{...e})}),t[0]=e,t[1]=n),n}function Ab(e){let t=(0,Z.c)(11),{activeDocName:n,isSourceMode:r,editorPlaceholder:i,previousDocName:a,onNavigateBack:o,onRecycle:s}=e,{poolEntries:c}=ut(),{pages:l,loading:u}=Vn(),d=Ob(c,n,3),f=(0,X.useRef)(``),p=d.map(jb).join(`,`);(0,X.useLayoutEffect)(()=>{if(f.current===p)return;let e=f.current?f.current.split(`,`):[],t=p?p.split(`,`):[];it(`ok/activity/mount-list-change`,{active:n,mounted:t,evicted:e.filter(e=>!t.includes(e))}),f.current=p,ze(t)},[p,n]);let m;t[0]!==n||t[1]!==i||t[2]!==r||t[3]!==u||t[4]!==o||t[5]!==s||t[6]!==l||t[7]!==a?(m=e=>(0,Y.jsx)(Pb,{entry:e,isActive:e.docName===n,isSourceMode:r,editorPlaceholder:i,isNewDoc:!u&&!l.has(e.docName),previousDocName:a,onNavigateBack:o,onRecycle:s},e.docName),t[0]=n,t[1]=i,t[2]=r,t[3]=u,t[4]=o,t[5]=s,t[6]=l,t[7]=a,t[8]=m):m=t[8];let h=d.map(m),g;return t[9]===h?g=t[10]:(g=(0,Y.jsx)(Y.Fragment,{children:h}),t[9]=h,t[10]=g),g}function jb(e){return e.docName}function Mb(e){let t=(0,Z.c)(8),{isActive:n,children:r}=e,i=(0,X.useRef)(null),a=(0,X.useRef)(0),o,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>{let e=i.current;if(!e)return;let t=()=>{e.scrollTop>0&&(a.current=e.scrollTop)};return e.addEventListener(`scroll`,t,{passive:!0}),()=>e.removeEventListener(`scroll`,t)},s=[],t[0]=o,t[1]=s):(o=t[0],s=t[1]),(0,X.useEffect)(o,s);let c,l;t[2]===n?(c=t[3],l=t[4]):(c=()=>{if(!n)return;let e=i.current;if(!e)return;let t=a.current;if(t===0||(e.scrollTop=t,e.scrollTop===t))return;let r=!1,o=()=>{r||(r=!0,s.disconnect(),clearTimeout(c))},s=new ResizeObserver(()=>{r||!e||e.scrollHeight>t&&(e.scrollTop=t,e.scrollTop===t&&o())});s.observe(e);let c=setTimeout(o,500);return o},l=[n],t[2]=n,t[3]=c,t[4]=l),(0,X.useLayoutEffect)(c,l);let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u={overflowAnchor:`auto`},t[5]=u):u=t[5];let d;return t[6]===r?d=t[7]:(d=(0,Y.jsx)(`div`,{ref:i,className:`subtle-scrollbar h-full overflow-y-auto`,style:u,children:r}),t[6]=r,t[7]=d),d}function Nb(e){let t=(0,Z.c)(12),{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a}=e,o=r&&i,[s,c]=(0,X.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,X.useEffect)(l,u),!s&&!o)return null;let d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Y.jsx)(j_,{}),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,Y.jsx)(X.Suspense,{fallback:d,children:(0,Y.jsx)(Db,{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 Pb(e){let t=(0,Z.c)(48),{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a,isNewDoc:o,previousDocName:s,onNavigateBack:c,onRecycle:l}=e,u=n.provider.document.getText(`source`).length,[d,f]=(0,X.useState)(i),[p,m]=(0,X.useState)(!i),h,g;t[0]!==i||t[1]!==d||t[2]!==p?(h=()=>{i&&!d?f(!0):!i&&!p&&m(!0)},g=[i,d,p],t[0]=i,t[1]=d,t[2]=p,t[3]=h,t[4]=g):(h=t[3],g=t[4]),(0,X.useEffect)(h,g);let _=Tb({ytextLength:u,isSourceMode:i,visitedSource:d,visitedVisual:p}),v=(0,X.useRef)(``),y=`${_.isLarge}-${_.renderSource}-${_.renderVisual}`,b,x;t[5]!==n.docName||t[6]!==_.isLarge||t[7]!==_.renderSource||t[8]!==_.renderVisual||t[9]!==y||t[10]!==i||t[11]!==u?(b=()=>{v.current!==y&&(v.current=y,_.isLarge&&it(`ok/activity/defer-mount`,{docName:n.docName,ytextLength:u,isSourceMode:i,renderSource:_.renderSource,renderVisual:_.renderVisual}))},x=[y,_.isLarge,_.renderSource,_.renderVisual,n.docName,u,i],t[5]=n.docName,t[6]=_.isLarge,t[7]=_.renderSource,t[8]=_.renderVisual,t[9]=y,t[10]=i,t[11]=u,t[12]=b,t[13]=x):(b=t[12],x=t[13]),(0,X.useEffect)(b,x);let S=r?`visible`:`hidden`,C=`editor:${n.docName}`,w;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Y.jsx)(j_,{}),t[14]=w):w=t[14];let T;t[15]!==a||t[16]!==n||t[17]!==_.renderSource||t[18]!==r||t[19]!==i?(T=_.renderSource?(0,Y.jsx)(`div`,{className:i?`h-full`:`ok-mode-hidden h-full`,children:(0,Y.jsx)(Nb,{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a})}):null,t[15]=a,t[16]=n,t[17]=_.renderSource,t[18]=r,t[19]=i,t[20]=T):T=t[20];let E;t[21]!==a||t[22]!==n.docName||t[23]!==n.provider||t[24]!==_.renderVisual||t[25]!==o||t[26]!==i?(E=_.renderVisual?(0,Y.jsx)(`div`,{className:i?`ok-mode-hidden h-full`:`h-full`,children:(0,Y.jsx)(db,{provider:n.provider,placeholder:a},`${n.docName}-${String(o)}`)}):null,t[21]=a,t[22]=n.docName,t[23]=n.provider,t[24]=_.renderVisual,t[25]=o,t[26]=i,t[27]=E):E=t[27];let D;t[28]!==T||t[29]!==E?(D=(0,Y.jsxs)(`div`,{className:`relative h-full`,children:[T,E]}),t[28]=T,t[29]=E,t[30]=D):D=t[30];let O;t[31]!==n.docName||t[32]!==n.provider||t[33]!==D?(O=(0,Y.jsx)(X.Suspense,{fallback:w,children:(0,Y.jsx)(hb,{docName:n.docName,provider:n.provider,children:D})}),t[31]=n.docName,t[32]=n.provider,t[33]=D,t[34]=O):O=t[34];let k;t[35]!==n.docName||t[36]!==c||t[37]!==l||t[38]!==s||t[39]!==O?(k=(0,Y.jsx)(wb,{activeDocName:n.docName,previousDocName:s,onNavigateBack:c,onRecycle:l,children:O}),t[35]=n.docName,t[36]=c,t[37]=l,t[38]=s,t[39]=O,t[40]=k):k=t[40];let A;t[41]!==r||t[42]!==k?(A=(0,Y.jsx)(Mb,{isActive:r,children:k}),t[41]=r,t[42]=k,t[43]=A):A=t[43];let j;return t[44]!==A||t[45]!==S||t[46]!==C?(j=(0,Y.jsx)(X.Activity,{mode:S,name:C,children:A}),t[44]=A,t[45]=S,t[46]=C,t[47]=j):j=t[47],j}function Fb(e){let t=(0,Z.c)(26),{stats:n}=e,r;t[0]===n.words?r=t[1]:(r=n.words.toLocaleString(),t[0]=n.words,t[1]=r);let i;t[2]===r?i=t[3]:(i=(0,Y.jsx)(`span`,{className:`tabular-nums`,children:r}),t[2]=r,t[3]=i);let a=n.words===1?`word`:`words`,o;t[4]!==i||t[5]!==a?(o=(0,Y.jsxs)(`span`,{children:[i,` `,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6];let s;t[7]===n.chars?s=t[8]:(s=n.chars.toLocaleString(),t[7]=n.chars,t[8]=s);let c;t[9]===s?c=t[10]:(c=(0,Y.jsx)(`span`,{className:`tabular-nums`,children:s}),t[9]=s,t[10]=c);let l=n.chars===1?`char`:`chars`,u;t[11]!==c||t[12]!==l?(u=(0,Y.jsxs)(`span`,{children:[c,` `,l]}),t[11]=c,t[12]=l,t[13]=u):u=t[13];let d=n.tokens>0?`~`:``,f;t[14]===n.tokens?f=t[15]:(f=n.tokens.toLocaleString(),t[14]=n.tokens,t[15]=f);let p;t[16]===f?p=t[17]:(p=(0,Y.jsx)(`span`,{className:`tabular-nums`,children:f}),t[16]=f,t[17]=p);let m=n.tokens===1?`token`:`tokens`,h;t[18]!==p||t[19]!==m||t[20]!==d?(h=(0,Y.jsxs)(`span`,{children:[d,p,` `,m]}),t[18]=p,t[19]=m,t[20]=d,t[21]=h):h=t[21];let g;return t[22]!==h||t[23]!==o||t[24]!==u?(g=(0,Y.jsxs)(`section`,{"aria-label":`Document statistics`,className:`flex h-6 shrink-0 items-center justify-end gap-3 px-3 text-2xs text-muted-foreground`,children:[o,u,h]}),t[22]=h,t[23]=o,t[24]=u,t[25]=g):g=t[25],g}function Ib(e){let t=(0,Z.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Y.jsx)(_t,{name:`editor-area`,children:(0,Y.jsx)(Lb,{...e})}),t[0]=e,t[1]=n),n}function Lb(e){let t=(0,Z.c)(112),{editorMode:n,previewEntry:r,diffLayout:i,onNoDiff:a,onEntrySelect:o,selectedSha:s}=e,{activeDocName:c,activeProvider:l,activeTarget:u,recycleDocument:d,docPanelMode:f,docPanelExpandSignal:p}=ut(),{openDocumentTransition:m}=gt(),h=ly(l,c),g=(0,X.useDeferredValue)(c),_=u?.kind===`missing`,v=!!c&&u?.kind!==`folder`&&n!==`diff`,y=_?`Start writing to create this page…`:void 0,b=Zg(),[x,S]=(0,X.useState)(!1),{layout:C,autoCollapse:w}=Qv(),T=C===`sheet`,[E,D]=(0,X.useState)(!1),O=(0,X.useRef)(!1),[k,A]=(0,X.useState)(T_[0].id),j,M;t[0]!==w||t[1]!==C||t[2]!==b?(j=()=>{C===`panel`&&(w?(O.current=!1,b.current?.collapse()):O.current||b.current?.expand())},M=[w,C,b],t[0]=w,t[1]=C,t[2]=b,t[3]=j,t[4]=M):(j=t[3],M=t[4]),(0,X.useEffect)(j,M);let N,P;t[5]!==p||t[6]!==T||t[7]!==b?(N=()=>{p!==0&&(T?D(!0):(O.current=!1,b.current?.expand()))},P=[p,T,b],t[5]=p,t[6]=T,t[7]=b,t[8]=N,t[9]=P):(N=t[8],P=t[9]),(0,X.useEffect)(N,P);let F=(0,X.useRef)(null),[I,ee]=(0,X.useState)(null),L,R;t[10]===c?(L=t[11],R=t[12]):(L=()=>{if(c&&c!==F.current){let e=F.current;F.current=c,ee(e)}},R=[c],t[10]=c,t[11]=L,t[12]=R),(0,X.useEffect)(L,R);let[z,B]=(0,X.useState)(null),[V,H]=(0,X.useState)(!1),te;t[13]!==c||t[14]!==l||t[15]!==a||t[16]!==r?(te=()=>{if(!r?.sha||!c){B(null);return}let e=!1,t=r.sha,n=c;return H(!0),B(null),(async function(){try{let r=await fetch(`/api/history/${t}?docName=${encodeURIComponent(n)}`);if(e)return;if(!r.ok){B(null),H(!1);return}let i=await r.json();if(!e){let e=Sn(i.content??``).body,t=Sn(l?.document.getText(`source`).toString()??``).body,n=zb;if(n(e)===n(t)){H(!1),a?.();return}B({old:e,new:t}),H(!1)}}catch{e||(B(null),H(!1))}})(),()=>{e=!0}},t[13]=c,t[14]=l,t[15]=a,t[16]=r,t[17]=te):te=t[17];let ne=r?.sha,re;if(t[18]!==c||t[19]!==l||t[20]!==a||t[21]!==ne?(re=[ne,c,l,a],t[18]=c,t[19]=l,t[20]=a,t[21]=ne,t[22]=re):re=t[22],(0,X.useEffect)(te,re),u?.kind===`folder`){let e;return t[23]===u.folderPath?e=t[24]:(e=(0,Y.jsx)(nv,{folderPath:u.folderPath}),t[23]=u.folderPath,t[24]=e),e}if(!l||!c){if((typeof window<`u`?Kn(window.location.hash):null)!==null){let e;return t[25]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(j_,{}),t[25]=e):e=t[25],e}let e;return t[26]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(Bb,{}),t[26]=e):e=t[26],e}let U=n===`diff`,W=n===`source`,G=T?!E:x,ie;t[27]!==x||t[28]!==T||t[29]!==b?(ie=()=>{T?D(Rb):x?(O.current=!1,b.current?.expand()):(O.current=!0,b.current?.collapse())},t[27]=x,t[28]=T,t[29]=b,t[30]=ie):ie=t[30];let ae=G?`Show document panel`:`Hide document panel`,oe;t[31]===G?oe=t[32]:(oe=G?(0,Y.jsx)(qi,{className:`size-4`}):(0,Y.jsx)(Ki,{className:`size-4`}),t[31]=G,t[32]=oe);let q;t[33]!==ie||t[34]!==ae||t[35]!==oe?(q=(0,Y.jsx)(nn,{asChild:!0,children:(0,Y.jsx)(K,{variant:`ghost`,size:`icon`,onClick:ie,"aria-label":ae,className:`text-muted-foreground`,children:oe})}),t[33]=ie,t[34]=ae,t[35]=oe,t[36]=q):q=t[36];let se=G?`Show panel`:`Hide panel`,J;t[37]===se?J=t[38]:(J=(0,Y.jsx)(an,{side:`left`,children:se}),t[37]=se,t[38]=J);let ce;t[39]!==q||t[40]!==J?(ce=(0,Y.jsx)(`div`,{className:`absolute top-2 right-2 z-10`,children:(0,Y.jsxs)(ln,{children:[q,J]})}),t[39]=q,t[40]=J,t[41]=ce):ce=t[41];let le=ce,ue;t[42]!==U||t[43]!==V?(ue=U&&V&&(0,Y.jsx)(`div`,{className:`flex items-center justify-center py-16`,role:`status`,"aria-label":`Loading version`,children:(0,Y.jsx)(`div`,{className:`size-5 animate-spin rounded-full border-2 border-muted border-t-foreground`})}),t[42]=U,t[43]=V,t[44]=ue):ue=t[44];let de;t[45]!==z||t[46]!==i||t[47]!==U||t[48]!==V?(de=U&&!V&&z!==null&&(0,Y.jsx)(Km,{oldContent:z.old,newContent:z.new,layout:i}),t[45]=z,t[46]=i,t[47]=U,t[48]=V,t[49]=de):de=t[49];let fe=U?`none`:void 0,pe;t[50]===fe?pe=t[51]:(pe={display:fe},t[50]=fe,t[51]=pe);let me=g??c,he=I??void 0,ge;t[52]===m?ge=t[53]:(ge=e=>{let t=Nn(e);window.location.hash===t?m(e):window.location.hash=t},t[52]=m,t[53]=ge);let _e;t[54]!==y||t[55]!==W||t[56]!==d||t[57]!==me||t[58]!==he||t[59]!==ge?(_e=(0,Y.jsx)(kb,{activeDocName:me,isSourceMode:W,editorPlaceholder:y,previousDocName:he,onNavigateBack:ge,onRecycle:d}),t[54]=y,t[55]=W,t[56]=d,t[57]=me,t[58]=he,t[59]=ge,t[60]=_e):_e=t[60];let ve;t[61]!==c||t[62]!==g?(ve=c&&c!==g?(0,Y.jsx)(`div`,{className:`absolute inset-0 z-10 bg-background`,children:(0,Y.jsx)(j_,{})}):null,t[61]=c,t[62]=g,t[63]=ve):ve=t[63];let ye;t[64]!==pe||t[65]!==_e||t[66]!==ve?(ye=(0,Y.jsxs)(`div`,{className:`relative h-full`,style:pe,children:[_e,ve]}),t[64]=pe,t[65]=_e,t[66]=ve,t[67]=ye):ye=t[67];let be;t[68]!==ue||t[69]!==de||t[70]!==ye||t[71]!==le?(be=(0,Y.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[ue,de,ye,le]}),t[68]=ue,t[69]=de,t[70]=ye,t[71]=le,t[72]=be):be=t[72];let xe;t[73]!==v||t[74]!==h?(xe=v&&(0,Y.jsx)(Fb,{stats:h}),t[73]=v,t[74]=h,t[75]=xe):xe=t[75];let Se;t[76]!==be||t[77]!==xe?(Se=(0,Y.jsxs)(`div`,{className:`relative flex h-full flex-col`,children:[be,xe]}),t[76]=be,t[77]=xe,t[78]=Se):Se=t[78];let Ce=Se;if(T){let e;t[79]===Ce?e=t[80]:(e=(0,Y.jsx)(`div`,{className:`min-w-0 flex-1`,children:Ce}),t[79]=Ce,t[80]=e);let n;t[81]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Y.jsx)(Zm,{className:`sr-only`,children:(0,Y.jsx)(Qm,{children:`Document panel`})}),t[81]=n):n=t[81];let r;t[82]!==c||t[83]!==k||t[84]!==f||t[85]!==W||t[86]!==o||t[87]!==s?(r=(0,Y.jsxs)(Xm,{side:`right`,className:`flex w-80 sm:w-96 flex-col gap-0 p-0`,children:[n,(0,Y.jsx)(k_,{docName:c,isSourceMode:W,activeTab:k,onActiveTabChange:A,onEntrySelect:o,selectedSha:s,mode:f})]}),t[82]=c,t[83]=k,t[84]=f,t[85]=W,t[86]=o,t[87]=s,t[88]=r):r=t[88];let i;t[89]!==E||t[90]!==r?(i=(0,Y.jsx)(qm,{open:E,onOpenChange:D,children:r}),t[89]=E,t[90]=r,t[91]=i):i=t[91];let a;return t[92]!==e||t[93]!==i?(a=(0,Y.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[e,i]}),t[92]=e,t[93]=i,t[94]=a):a=t[94],a}let we;t[95]===Ce?we=t[96]:(we=(0,Y.jsx)(Jv,{minSize:`30%`,defaultSize:`75%`,children:Ce}),t[95]=Ce,t[96]=we);let Te;t[97]===Symbol.for(`react.memo_cache_sentinel`)?(Te=(0,Y.jsx)(Yv,{withHandle:!0}),t[97]=Te):Te=t[97];let Ee;t[98]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=e=>S(e.asPercentage===0),t[98]=Ee):Ee=t[98];let De;t[99]!==c||t[100]!==k||t[101]!==f||t[102]!==W||t[103]!==o||t[104]!==s?(De=(0,Y.jsx)(k_,{docName:c,isSourceMode:W,activeTab:k,onActiveTabChange:A,onEntrySelect:o,selectedSha:s,mode:f}),t[99]=c,t[100]=k,t[101]=f,t[102]=W,t[103]=o,t[104]=s,t[105]=De):De=t[105];let Oe;t[106]!==b||t[107]!==De?(Oe=(0,Y.jsx)(Jv,{panelRef:b,defaultSize:`25%`,minSize:`300px`,maxSize:`40%`,collapsible:!0,collapsedSize:0,onResize:Ee,className:`flex flex-col bg-muted/20`,children:De}),t[106]=b,t[107]=De,t[108]=Oe):Oe=t[108];let ke;return t[109]!==we||t[110]!==Oe?(ke=(0,Y.jsx)(`div`,{className:`flex min-h-0 flex-1`,children:(0,Y.jsxs)(qv,{orientation:`horizontal`,children:[we,Te,Oe]})}),t[109]=we,t[110]=Oe,t[111]=ke):ke=t[111],ke}function Rb(e){return!e}function zb(e){return e.replace(/\r\n/g,`
23
+ `).replace(/[ \t]+$/gm,``).trimEnd()}function Bb(){let e=(0,Z.c)(5),[t,n]=(0,X.useState)(!1),r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Y.jsx)(Av,{size:80}),i=(0,Y.jsx)(`span`,{className:`select-none text-sm text-muted-foreground`,children:`Select a document to edit`}),e[0]=r,e[1]=i):(r=e[0],i=e[1]);let a;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Y.jsxs)(`div`,{className:`flex flex-col items-center gap-2`,children:[(0,Y.jsxs)(K,{variant:`outline`,onClick:()=>n(!0),children:[(0,Y.jsx)(ai,{"aria-hidden":`true`,className:`h-4 w-4`}),`Initialize LLM brain`]}),(0,Y.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Optional starter structure`})]}),e[2]=a):a=e[2];let o;return e[3]===t?o=e[4]:(o=(0,Y.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-6`,children:[r,i,a,(0,Y.jsx)(Fv,{open:t,onOpenChange:n})]}),e[3]=t,e[4]=o),o}function Vb(e,t){let n=t.trim();return e===`file`?n.replace(/\.md$/i,``):n}function Hb(e){return![``,`.`,`..`].includes(e)&&!e.includes(`/`)&&!e.includes(`\\`)&&!e.includes(`\0`)}function Ub(e,t){let n=Vb(e.kind,t),r=e.path.split(`/`);return r[r.length-1]=n,r.join(`/`)}function Wb(e,t){if(t.length===0)return e;let n=new Map(t.map(e=>[e.fromDocName,e.toDocName]));return e.map(e=>({...e,docName:n.get(e.docName)??e.docName}))}function Gb(e,t){if(t.length===0)return e;let n=new Set(t);return e.filter(e=>!n.has(e.docName))}function Kb(e,t){return e?t.find(t=>t.fromDocName===e)?.toDocName??e:null}var qb=1280;function Jb(){let e=(0,Z.c)(2),[t,n]=(0,X.useState)(Yb),r,i;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=window.matchMedia(`(max-width: ${qb-1}px)`),t=()=>{n(window.innerWidth<qb)};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,X.useEffect)(r,i),t}function Yb(){return window.innerWidth<qb}var Xb=`sidebar_state`,Zb=3600*24*7,Qb=`18rem`,$b=`3rem`,ex=`\\`,tx=`app-file-sidebar`,nx=X.createContext(null);function rx(){let e=X.use(nx);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function ix(e){let t=(0,Z.c)(49),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]):({defaultOpen:c,open:i,onOpenChange:o,className:r,style:s,children:n,...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?!0:c,u=Jb(),[d,f]=X.useState(!1),[p,m]=X.useState(!1),[h,g]=X.useState(l),_=i??h,v;t[8]!==_||t[9]!==o?(v=e=>{let t=typeof e==`function`?e(_):e;o?o(t):g(t),document.cookie=`${Xb}=${t}; path=/; max-age=${Zb}`},t[8]=_,t[9]=o,t[10]=v):v=t[10];let y=v,b;t[11]!==u||t[12]!==y?(b=function(){return u?f(ox):y(ax)},t[11]=u,t[12]=y,t[13]=b):b=t[13];let x=b,S;t[14]!==u||t[15]!==d?(S=function(){!u||!d||window.matchMedia(`(prefers-reduced-motion: reduce)`).matches||m(!0)},t[14]=u,t[15]=d,t[16]=S):S=t[16];let C=S,w,T;t[17]===x?(w=t[18],T=t[19]):(w=()=>{let e=e=>{e.key===ex&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),x())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},T=[x],t[17]=x,t[18]=w,t[19]=T),X.useEffect(w,T);let E,D;t[20]!==u||t[21]!==d?(E=()=>{if(!u||!d)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"]`)||f(!1))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},D=[u,d],t[20]=u,t[21]=d,t[22]=E,t[23]=D):(E=t[22],D=t[23]),X.useEffect(E,D);let O=X.useRef(u),k,A;t[24]!==u||t[25]!==_?(A=()=>{!O.current&&u&&f(_),O.current=u},k=[u,_],t[24]=u,t[25]=_,t[26]=k,t[27]=A):(k=t[26],A=t[27]),X.useEffect(A,k);let j=u?d?`expanded`:`collapsed`:_?`expanded`:`collapsed`,M;t[28]!==u||t[29]!==C||t[30]!==_||t[31]!==d||t[32]!==y||t[33]!==p||t[34]!==j||t[35]!==x?(M={state:j,open:_,setOpen:y,isMobile:u,openMobile:d,setOpenMobile:f,toggleSidebar:x,showPushPulse:p,setShowPushPulse:m,notifySidebarFileSelected:C},t[28]=u,t[29]=C,t[30]=_,t[31]=d,t[32]=y,t[33]=p,t[34]=j,t[35]=x,t[36]=M):M=t[36];let N;t[37]===s?N=t[38]:(N={"--sidebar-width":Qb,"--sidebar-width-icon":$b,...s},t[37]=s,t[38]=N);let P=N,F;t[39]===r?F=t[40]:(F=W(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),t[39]=r,t[40]=F);let I;t[41]!==n||t[42]!==a||t[43]!==P||t[44]!==F?(I=(0,Y.jsx)(`div`,{"data-slot":`sidebar-wrapper`,style:P,className:F,...a,children:n}),t[41]=n,t[42]=a,t[43]=P,t[44]=F,t[45]=I):I=t[45];let ee;return t[46]!==M||t[47]!==I?(ee=(0,Y.jsx)(nx.Provider,{value:M,children:I}),t[46]=M,t[47]=I,t[48]=ee):ee=t[48],ee}function ax(e){return!e}function ox(e){return!e}function sx(e){let t=(0,Z.c)(50),n,r,i,a,o,s;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6]):({side:a,variant:o,collapsible:s,className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s);let c=a===void 0?`left`:a,l=o===void 0?`sidebar`:o,u=s===void 0?`offcanvas`:s,{isMobile:d,state:f,openMobile:p}=rx();if(u===`none`){let e;t[7]===r?e=t[8]:(e=W(`flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground`,r),t[7]=r,t[8]=e);let a;return t[9]!==n||t[10]!==i||t[11]!==e||t[12]!==l?(a=(0,Y.jsx)(`div`,{"data-slot":`sidebar`,"data-variant":l,className:e,...i,children:n}),t[9]=n,t[10]=i,t[11]=e,t[12]=l,t[13]=a):a=t[13],a}if(d){let e=p?`expanded`:`collapsed`,a=l===`floating`||l===`inset`?`p-2`:``,o;t[14]!==r||t[15]!==a?(o=W(`fixed inset-y-0 z-30 flex h-svh w-(--sidebar-width)`,`transition-transform duration-200 ease-linear motion-reduce:transition-none`,`data-[side=left]:left-0 data-[side=right]:right-0`,`group-data-[state=collapsed]:data-[side=left]:-translate-x-full`,`group-data-[state=collapsed]:data-[side=right]:translate-x-full`,a,r),t[14]=r,t[15]=a,t[16]=o):o=t[16];let s;t[17]===n?s=t[18]:(s=(0,Y.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[17]=n,t[18]=s);let u;t[19]!==i||t[20]!==c||t[21]!==o||t[22]!==s?(u=(0,Y.jsx)(`nav`,{id:tx,"aria-label":`File sidebar`,"data-slot":`sidebar-container`,"data-side":c,className:o,...i,children:s}),t[19]=i,t[20]=c,t[21]=o,t[22]=s,t[23]=u):u=t[23];let d;return t[24]!==e||t[25]!==c||t[26]!==u||t[27]!==l?(d=(0,Y.jsx)(`div`,{className:`group peer text-sidebar-foreground`,"data-state":e,"data-variant":l,"data-side":c,"data-slot":`sidebar`,"data-mobile":`true`,children:u}),t[24]=e,t[25]=c,t[26]=u,t[27]=l,t[28]=d):d=t[28],d}let m=f===`collapsed`?u:``,h=l===`floating`||l===`inset`?`group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon)`,g;t[29]===h?g=t[30]:(g=W(`relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear`,`group-data-[collapsible=offcanvas]:w-0`,`group-data-[side=right]:rotate-180`,h),t[29]=h,t[30]=g);let _;t[31]===g?_=t[32]:(_=(0,Y.jsx)(`div`,{"data-slot":`sidebar-gap`,className:g}),t[31]=g,t[32]=_);let v=l===`floating`||l===`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`,y;t[33]!==r||t[34]!==v?(y=W(`fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear 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)] md:flex`,v,r),t[33]=r,t[34]=v,t[35]=y):y=t[35];let b;t[36]===n?b=t[37]:(b=(0,Y.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[36]=n,t[37]=b);let x;t[38]!==i||t[39]!==c||t[40]!==b||t[41]!==y?(x=(0,Y.jsx)(`div`,{"data-slot":`sidebar-container`,"data-side":c,className:y,...i,children:b}),t[38]=i,t[39]=c,t[40]=b,t[41]=y,t[42]=x):x=t[42];let S;return t[43]!==c||t[44]!==f||t[45]!==x||t[46]!==m||t[47]!==_||t[48]!==l?(S=(0,Y.jsxs)(`div`,{className:`group peer hidden text-sidebar-foreground md:block`,"data-state":f,"data-collapsible":m,"data-variant":l,"data-side":c,"data-slot":`sidebar`,children:[_,x]}),t[43]=c,t[44]=f,t[45]=x,t[46]=m,t[47]=_,t[48]=l,t[49]=S):S=t[49],S}function cx(e){let t=(0,Z.c)(16),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,onClick:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let{toggleSidebar:a,state:o}=rx(),s=o===`expanded`,c;t[4]===n?c=t[5]:(c=W(n),t[4]=n,t[5]=c);let l;t[6]!==r||t[7]!==a?(l=e=>{r?.(e),a()},t[6]=r,t[7]=a,t[8]=l):l=t[8];let u,d;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Y.jsx)(Gi,{}),d=(0,Y.jsx)(`span`,{className:`sr-only`,children:`Toggle Sidebar`}),t[9]=u,t[10]=d):(u=t[9],d=t[10]);let f;return t[11]!==i||t[12]!==s||t[13]!==c||t[14]!==l?(f=(0,Y.jsxs)(K,{"data-sidebar":`trigger`,"data-slot":`sidebar-trigger`,variant:`ghost`,size:`icon-sm`,"aria-expanded":s,"aria-controls":tx,className:c,onClick:l,...i,children:[u,d]}),t[11]=i,t[12]=s,t[13]=c,t[14]=l,t[15]=f):f=t[15],f}function lx(e){let t=(0,Z.c)(21),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,onClick:i,onAnimationEnd:r,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let{isMobile:o,openMobile:s,setOpenMobile:c,showPushPulse:l,setShowPushPulse:u}=rx(),d;t[5]!==o||t[6]!==i||t[7]!==s||t[8]!==c?(d=e=>{i?.(e),!e.defaultPrevented&&(!o||!s||e.target?.closest(`[data-sidebar="trigger"]`)||c(!1))},t[5]=o,t[6]=i,t[7]=s,t[8]=c,t[9]=d):d=t[9];let f=d,p;t[10]!==r||t[11]!==u?(p=e=>{r?.(e),e.animationName===`sidebar-push-pulse`&&u(!1)},t[10]=r,t[11]=u,t[12]=p):p=t[12];let m=p,h=l?``:void 0,g;t[13]===n?g=t[14]:(g=W(`relative flex w-full flex-1 flex-col bg-background md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2`,`transition-transform duration-200 ease-linear motion-reduce:transition-none`,`peer-data-[mobile=true]:peer-data-[state=expanded]:translate-x-(--sidebar-width)`,n),t[13]=n,t[14]=g);let _;return t[15]!==m||t[16]!==f||t[17]!==a||t[18]!==h||t[19]!==g?(_=(0,Y.jsx)(`main`,{"data-slot":`sidebar-inset`,"data-push-pulse":h,onClick:f,onAnimationEnd:m,className:g,...a}),t[15]=m,t[16]=f,t[17]=a,t[18]=h,t[19]=g,t[20]=_):_=t[20],_}function ux(e){let t=(0,Z.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=W(`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,Y.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 dx(e){let t=(0,Z.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=W(`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,Y.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 fx(e){let t=(0,Z.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=W(`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,Y.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 px(e){let t=(0,Z.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=W(`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,Y.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 mx(e){let t=(0,Z.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=W(`group/menu-item relative`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Y.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 hx=B(`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 gx(e){let t=(0,Z.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?ne:`button`,{isMobile:m,state:h}=rx(),g;t[8]!==n||t[9]!==f||t[10]!==d?(g=W(hx({variant:d,size:f}),n),t[8]=n,t[9]=f,t[10]=d,t[11]=g):g=t[11];let _;t[12]!==p||t[13]!==u||t[14]!==r||t[15]!==f||t[16]!==g?(_=(0,Y.jsx)(p,{"data-slot":`sidebar-menu-button`,"data-sidebar":`menu-button`,"data-size":f,"data-active":u,className:g,...r}),t[12]=p,t[13]=u,t[14]=r,t[15]=f,t[16]=g,t[17]=_):_=t[17];let v=_;if(!c)return v;if(typeof c==`string`){let e;t[18]===c?e=t[19]:(e={children:c},t[18]=c,t[19]=e),c=e}let y;t[20]===v?y=t[21]:(y=(0,Y.jsx)(nn,{asChild:!0,children:v}),t[20]=v,t[21]=y);let b=h!==`collapsed`||m,x;t[22]!==b||t[23]!==c?(x=(0,Y.jsx)(an,{side:`right`,align:`center`,hidden:b,...c}),t[22]=b,t[23]=c,t[24]=x):x=t[24];let S;return t[25]!==y||t[26]!==x?(S=(0,Y.jsxs)(ln,{children:[y,x]}),t[25]=y,t[26]=x,t[27]=S):S=t[27],S}function _x(e){let t=(0,Z.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,Y.jsx)(ul,{"data-slot":`popover`,...n}),t[2]=n,t[3]=r),r}function vx(e){let t=(0,Z.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,Y.jsx)(dl,{"data-slot":`popover-trigger`,...n}),t[2]=n,t[3]=r),r}function yx(e){let t=(0,Z.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,align:i,sideOffset:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?`center`:i,s=a===void 0?4:a,c;t[5]===n?c=t[6]:(c=W(`z-50 w-72 rounded-lg border bg-popover p-4 text-popover-foreground shadow-md outline-hidden data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 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`,n),t[5]=n,t[6]=c);let l;return t[7]!==o||t[8]!==r||t[9]!==s||t[10]!==c?(l=(0,Y.jsx)(fl,{children:(0,Y.jsx)(pl,{"data-slot":`popover-content`,align:o,sideOffset:s,className:c,...r})}),t[7]=o,t[8]=r,t[9]=s,t[10]=c,t[11]=l):l=t[11],l}var bx=1e3,xx=!1;function Sx(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)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 Cx(e,t,n){let r=(0,Z.c)(9),i;r[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={current:[],crossDoc:[]},r[0]=i):i=r[0];let[a,o]=(0,X.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:be(i)?a=i:(a=void 0,xx||(xx=!0,console.warn(`[agent-presence] __system__ provider awareness missing getStates() — presence bar will render without agent peers`)));let s=()=>{let e=[];if(r)for(let[t,n]of r.getStates().entries()){let r=n;if(!r.user||typeof r.user!=`object`)continue;let i=r.user;i.type===`human`&&e.push({kind:`human`,clientId:t,user:i,mode:r.mode??`wysiwyg`})}let{current:t,crossDoc:i}=a?he(a,n,Date.now()):{current:[],crossDoc:[]},s=wx,c=t.map(s),l=i.map(s),u=[...e,...c],d=l;o(e=>Sx(e.current,u)&&Sx(e.crossDoc,d)?e:{current:u,crossDoc:d})};s();let c=()=>s(),l=()=>s();r?.on(`change`,c),t?.awareness?.on(`change`,l);let u=setInterval(s,bx);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,X.useEffect)(s,c),a}function wx(e){let{agentId:t,entry:n}=e;return{kind:`agent`,agentId:t,presence:n}}function Tx(e){let t=(0,Z.c)(3),[n,r]=(0,X.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`?Ex: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,X.useEffect)(i,a),n}function Ex(e){return e===`synced`?`synced`:`connected`}var Dx=`sync-status`;function Ox(e,t){let n=(0,Z.c)(4),r=(0,X.useRef)(!1),i=(0,X.useRef)(!1),a=(0,X.useRef)(t),o,s;n[0]!==t||n[1]!==e?(o=()=>{a.current!==t&&(a.current=t,r.current=!1,i.current=!1),t&&(e===`synced`&&(r.current=!0),e===`disconnected`&&r.current?(i.current=!0,At.warning(`Connection lost — keep this tab open, your edits will sync when reconnected`,{id:Dx,duration:1/0})):i.current&&e===`synced`&&(i.current=!1,At.success(`Reconnected`,{id:Dx,duration:3e3})))},s=[e,t],n[0]=t,n[1]=e,n[2]=o,n[3]=s):(o=n[2],s=n[3]),(0,X.useEffect)(o,s)}var kx=4,Ax=3,jx={Bird:$r,Cat:oi,Dog:xi,Fish:Ti,Mouse:$i,Rabbit:Qi,Shrimp:ia,Snail:aa,Squirrel:ca,Turtle:fa},Mx={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`,bot:`Agent`};function Nx(e){let t=(0,Z.c)(20),{user:n,mode:r}=e,i=n.name.split(` `)[1],a=i?jx[i]:void 0,o;t[0]===n.name?o=t[1]:(o=n.name.split(` `).map(Px).join(``),t[0]=n.name,t[1]=o);let s=o,c;t[2]===n.color?c=t[3]:(c=Cn(n.color),t[2]=n.color,t[3]=c);let l=c,u;t[4]===n.color?u=t[5]:(u={backgroundColor:n.color},t[4]=n.color,t[5]=u);let d;t[6]!==a||t[7]!==l||t[8]!==s?(d=a?(0,Y.jsx)(a,{size:18,color:l,strokeWidth:1.5}):(0,Y.jsx)(`span`,{className:`font-mono text-2xs font-semibold leading-none`,style:{color:l},children:s}),t[6]=a,t[7]=l,t[8]=s,t[9]=d):d=t[9];let f;t[10]!==r||t[11]!==u||t[12]!==d||t[13]!==n.name?(f=(0,Y.jsx)(nn,{asChild:!0,children:(0,Y.jsx)(`div`,{"data-presence-badge":`human`,"data-presence-mode":r,role:`img`,"aria-label":n.name,className:`inline-flex size-7 shrink-0 cursor-default items-center justify-center rounded-full ring-2 ring-background`,style:u,children:d})}),t[10]=r,t[11]=u,t[12]=d,t[13]=n.name,t[14]=f):f=t[14];let p;t[15]===n.name?p=t[16]:(p=(0,Y.jsx)(an,{children:n.name}),t[15]=n.name,t[16]=p);let m;return t[17]!==f||t[18]!==p?(m=(0,Y.jsxs)(ln,{children:[f,p]}),t[17]=f,t[18]=p,t[19]=m):m=t[19],m}function Px(e){return e[0]}function Fx(e){let t=Mx[e.icon];return e.displayName||t||`Agent`}function Ix(e){let t=(0,Z.c)(3),[n,r]=(0,X.useState)(e===`writing`),i=(0,X.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,X.useEffect)(a,o),n}function Lx(e){let t=(0,Z.c)(36),{participant:n,crossDoc:r,scoped:i,onClickAgent:a}=e,{presence:o,agentId:s}=n,c;t[0]===o?c=t[1]:(c=Fx(o),t[0]=o,t[1]=c);let l=c,u=Ix(o.mode),d=!r&&u,f=i?`ring-primary ring-offset-2 ring-offset-background`:`ring-background`,p=d&&!i?`ring-primary/40 animate-pulse`:``,m;t[2]!==f||t[3]!==p?(m=[`inline-flex size-7 shrink-0 items-center justify-center rounded-full ring-2 cursor-pointer`,f,p].filter(Boolean),t[2]=f,t[3]=p,t[4]=m):m=t[4];let h=m.join(` `),g=r?`true`:void 0,_=i?`true`:void 0,v;t[5]!==o.mode||t[6]!==g||t[7]!==_?(v={"data-presence-badge":`agent`,"data-presence-mode":o.mode,"data-presence-crossdoc":g,"data-presence-scoped":_},t[5]=o.mode,t[6]=g,t[7]=_,t[8]=v):v=t[8];let y=v,b=r&&o.currentDoc?`Open activity panel for ${l}, editing ${o.currentDoc}`:`Open activity panel for ${l}`,x;t[9]===o.color?x=t[10]:(x={backgroundColor:o.color},t[9]=o.color,t[10]=x);let S;t[11]!==s||t[12]!==a?(S=()=>a(s),t[11]=s,t[12]=a,t[13]=S):S=t[13];let C;t[14]===o.icon?C=t[15]:(C=(0,Y.jsx)(ve,{icon:o.icon,width:16,height:16,className:`text-white`}),t[14]=o.icon,t[15]=C);let w;t[16]!==b||t[17]!==y||t[18]!==h||t[19]!==C||t[20]!==x||t[21]!==S?(w=(0,Y.jsx)(`button`,{type:`button`,...y,"aria-label":b,className:h,style:x,onClick:S,children:C}),t[16]=b,t[17]=y,t[18]=h,t[19]=C,t[20]=x,t[21]=S,t[22]=w):w=t[22];let T=w,E;t[23]===T?E=t[24]:(E=(0,Y.jsx)(nn,{asChild:!0,children:T}),t[23]=T,t[24]=E);let D;t[25]===l?D=t[26]:(D=(0,Y.jsx)(`span`,{className:`font-medium`,children:l}),t[25]=l,t[26]=D);let O;t[27]!==r||t[28]!==o.currentDoc?(O=r&&o.currentDoc?(0,Y.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`editing [[`,o.currentDoc,`]]`]}):null,t[27]=r,t[28]=o.currentDoc,t[29]=O):O=t[29];let k;t[30]!==D||t[31]!==O?(k=(0,Y.jsxs)(an,{className:`flex flex-col gap-0.5`,children:[D,O]}),t[30]=D,t[31]=O,t[32]=k):k=t[32];let A;return t[33]!==E||t[34]!==k?(A=(0,Y.jsxs)(ln,{children:[E,k]}),t[33]=E,t[34]=k,t[35]=A):A=t[35],A}function Rx(e){let t=(0,Z.c)(18),{count:n,remainder:r,crossDoc:i,scopedAgentId:a,onClickAgent:o}=e,s=i?`true`:void 0,c=`${n} more ${i?`cross-doc `:``}${n===1?`participant`:`participants`}`,l;t[0]!==n||t[1]!==s||t[2]!==c?(l=(0,Y.jsx)(vx,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`presence-overflow`,"data-presence-crossdoc":s,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[0]=n,t[1]=s,t[2]=c,t[3]=l):l=t[3];let u;if(t[4]!==i||t[5]!==o||t[6]!==r||t[7]!==a){let e;t[9]!==i||t[10]!==o||t[11]!==a?(e=e=>e.kind===`human`?(0,Y.jsx)(Nx,{user:e.user,mode:e.mode},e.clientId):(0,Y.jsx)(Lx,{participant:e,crossDoc:i,scoped:a===e.agentId,onClickAgent:o},e.agentId),t[9]=i,t[10]=o,t[11]=a,t[12]=e):e=t[12],u=r.map(e),t[4]=i,t[5]=o,t[6]=r,t[7]=a,t[8]=u}else u=t[8];let d;t[13]===u?d=t[14]:(d=(0,Y.jsx)(yx,{align:`end`,className:`w-auto max-w-xs p-2`,children:(0,Y.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:u})}),t[13]=u,t[14]=d);let f;return t[15]!==l||t[16]!==d?(f=(0,Y.jsxs)(_x,{children:[l,d]}),t[15]=l,t[16]=d,t[17]=f):f=t[17],f}function zx(e,t,n,r){return e.kind===`human`?(0,Y.jsx)(Nx,{user:e.user,mode:e.mode},e.clientId):(0,Y.jsx)(Lx,{participant:e,crossDoc:n,scoped:r===e.agentId,onClickAgent:t},e.agentId)}function Bx(){let e=(0,Z.c)(20),{activeProvider:t,activeDocName:n,systemProvider:r,openActivityPanel:i,docPanelMode:a,docPanelAgentId:o}=ut(),{current:s,crossDoc:c}=Cx(t,r,n);Ox(Tx(t),n);let l;if(e[0]!==c||e[1]!==s||e[2]!==o||e[3]!==a||e[4]!==i){let t=s.slice(0,kx),n;e[6]===s?n=e[7]:(n=s.slice(kx),e[6]=s,e[7]=n);let r=n,u=c.slice(0,Ax),d;e[8]===c?d=e[9]:(d=c.slice(Ax),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=>zx(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,Y.jsx)(Rx,{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,Y.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,Y.jsxs)(`div`,{"data-slot":`presence-bar`,className:`flex items-center px-1 py-1.5`,children:[v,c.length>0?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`div`,{className:`mx-2 h-4 w-px bg-border`,"aria-hidden":!0,"data-slot":`presence-divider`}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5 opacity-60 grayscale`,"data-presence-section":`crossdoc`,children:[u.map(e=>zx(e,p,!0,m)),f.length>0?(0,Y.jsx)(Rx,{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 Vx=`npx @inkeep/open-knowledge install-skill`,Hx=`https://inkeep.github.io/open-knowledge/guides/install-claude-cowork`;function Ux(){return typeof window<`u`&&typeof window.okDesktop?.skill==`object`}function Wx(){let e=(0,Z.c)(12),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Y.jsx)(`p`,{className:`mb-2 font-medium text-foreground`,children:`Then in the Claude Desktop App, upload the file:`}),e[0]=t):t=e[0];let n;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Y.jsx)(`strong`,{children:`Customize`}),e[1]=n):n=e[1];let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Y.jsxs)(`li`,{children:[`Open `,n,` (sidebar) → `,(0,Y.jsx)(`strong`,{children:`Skills`}),`.`]}),e[2]=r):r=e[2];let i;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Y.jsxs)(`li`,{children:[`Click the `,(0,Y.jsx)(`strong`,{children:`+`}),` button.`]}),e[3]=i):i=e[3];let a;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Y.jsxs)(`li`,{children:[`Click `,(0,Y.jsx)(`strong`,{children:`Create skill`}),`.`]}),e[4]=a):a=e[4];let o;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Y.jsxs)(`li`,{children:[`Click `,(0,Y.jsx)(`strong`,{children:`Upload skill`}),`.`]}),e[5]=o):o=e[5];let s;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Y.jsx)(`code`,{children:`openknowledge.skill`}),e[6]=s):s=e[6];let c;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Y.jsxs)(`ol`,{className:`ml-4 list-decimal space-y-1 text-foreground`,children:[r,i,a,o,(0,Y.jsxs)(`li`,{children:[`Pick `,s,` from your `,(0,Y.jsx)(`strong`,{children:`Downloads`}),` folder.`]})]}),e[7]=c):c=e[7];let l;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Y.jsx)(`strong`,{className:`text-foreground`,children:`Claude Chat`}),e[8]=l):l=e[8];let u;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Y.jsxs)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:[`The skill toggles on by default. Use it in any`,` `,l,` or`,` `,(0,Y.jsx)(`strong`,{className:`text-foreground`,children:`Claude Cowork`}),` session — ask Claude to "use the open-knowledge skill".`]}),e[9]=u):u=e[9];let d;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Y.jsx)(`strong`,{children:`Customize → Skills`}),e[10]=d):d=e[10];let f;return e[11]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Y.jsxs)(`div`,{className:`rounded-md border border-primary/30 bg-primary/5 px-3 py-2 text-sm`,children:[t,c,u,(0,Y.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[`If `,d,` isn't visible, enable`,` `,(0,Y.jsx)(`strong`,{className:`text-foreground`,children:`Settings → Capabilities → Code execution and file creation`}),` `,`first.`]})]}),e[11]=f):f=e[11],f}function Gx(e){let t=(0,Z.c)(61),{open:n,onOpenChange:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={kind:`idle`},t[0]=i):i=t[0];let[a,o]=(0,X.useState)(i),[s,c]=(0,X.useState)(!1),l,u;t[1]===n?(l=t[2],u=t[3]):(l=()=>{n||(o({kind:`idle`}),c(!1))},u=[n],t[1]=n,t[2]=l,t[3]=u),(0,X.useEffect)(l,u);let d;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(d=async function(){o({kind:`downloading`});let e=window.okDesktop?.skill;if(!e){o({kind:`error`,message:`Electron bridge unavailable. Refresh and try again.`});return}let t=await e.buildAndOpen();if(t.ok)o({kind:`handed-off`,path:t.path});else{let e=t.message??t.reason;At.error(`Install handoff failed: ${e}`),o({kind:`error`,message:t.reason===`open-failed`?`The Claude Desktop App didn't open the file. Is it installed? (${e})`:`${t.reason}: ${e}`})}},t[4]=d):d=t[4];let f=d,p;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(p=async function(){try{await navigator.clipboard.writeText(Vx),c(!0),setTimeout(()=>c(!1),2e3)}catch(e){let t=e;At.error(`Couldn't copy: ${t instanceof Error?t.message:String(t)}`)}},t[5]=p):p=t[5];let m=p,h;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(h=Ux(),t[6]=h):h=t[6];let g=h,_;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Y.jsxs)(qt,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(Si,{"aria-hidden":`true`,className:`h-4 w-4`}),`Install for Claude Chat & Cowork`]}),t[7]=_):_=t[7];let v;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Y.jsx)(`strong`,{children:`Claude Desktop App`}),t[8]=v):v=t[8];let y;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Y.jsx)(`code`,{children:`ok init`}),t[9]=y):y=t[9];let b;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Y.jsx)(`code`,{children:`npx skills add`}),t[10]=b):b=t[10];let x;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Y.jsxs)(Wt,{children:[_,(0,Y.jsxs)(Bt,{children:[`Adds the Open Knowledge skill to the `,v,` so it's available in Claude Chat and Claude Cowork modes. (Claude Code users: no action needed —`,` `,y,` already installed it via `,b,`.)`,` `,(0,Y.jsxs)(`a`,{href:Hx,className:`underline`,target:`_blank`,rel:`noopener noreferrer`,children:[`Full guide `,(0,Y.jsx)(Tt,{"aria-hidden":`true`,className:`inline h-3 w-3`})]})]})]}),t[11]=x):x=t[11];let S;t[12]===a.kind?S=t[13]:(S=a.kind===`idle`&&g&&(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3 text-sm`,children:[(0,Y.jsx)(`p`,{className:`font-medium`,children:`Here's what will happen when you click Install:`}),(0,Y.jsxs)(`ol`,{className:`ml-4 list-decimal space-y-1.5`,children:[(0,Y.jsxs)(`li`,{children:[`We build `,(0,Y.jsx)(`code`,{children:`openknowledge.skill`}),` from the bundled skill content.`]}),(0,Y.jsxs)(`li`,{children:[`The file saves to `,(0,Y.jsx)(`code`,{children:`~/Downloads/openknowledge.skill`}),`.`]}),(0,Y.jsxs)(`li`,{children:[`We open the `,(0,Y.jsx)(`strong`,{children:`Claude Desktop App`}),` for you.`]})]}),(0,Y.jsx)(Wx,{})]}),t[12]=a.kind,t[13]=S);let C;t[14]!==s||t[15]!==a.kind?(C=a.kind===`idle`&&!g&&(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3 text-sm`,children:[(0,Y.jsx)(`p`,{className:`font-medium`,children:`Here's what to do:`}),(0,Y.jsxs)(`ol`,{className:`ml-4 list-decimal space-y-2`,children:[(0,Y.jsxs)(`li`,{children:[(0,Y.jsx)(`span`,{children:`Copy this command:`}),(0,Y.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 rounded-md border bg-muted/40 p-2`,children:[(0,Y.jsx)(`code`,{className:`flex-1 font-mono text-xs`,children:Vx}),(0,Y.jsx)(K,{variant:`ghost`,size:`sm`,onClick:m,"aria-label":`Copy command`,className:`h-7 gap-1`,children:s?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(we,{"aria-hidden":`true`,className:`h-3 w-3`}),`Copied`]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(_i,{"aria-hidden":`true`,className:`h-3 w-3`}),`Copy`]})})]})]}),(0,Y.jsxs)(`li`,{children:[`Paste + run it in your terminal. You'll see`,` `,(0,Y.jsx)(`code`,{children:`Built ~/Downloads/openknowledge.skill`}),` — that means the file is ready. The `,(0,Y.jsx)(`strong`,{children:`Claude Desktop App`}),` opens automatically.`]})]}),(0,Y.jsx)(Wx,{}),(0,Y.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[(0,Y.jsx)(`strong`,{className:`text-foreground`,children:`Requires:`}),` Node.js or Bun on your PATH.`,` `,(0,Y.jsx)(`code`,{children:`npx`}),` fetches and runs the CLI — no separate install.`]})]}),t[14]=s,t[15]=a.kind,t[16]=C):C=t[16];let w;t[17]===a.kind?w=t[18]:(w=a.kind===`downloading`&&(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,Y.jsx)(Ye,{"aria-hidden":`true`,className:`h-4 w-4 animate-spin`}),`Building `,(0,Y.jsx)(`code`,{children:`openknowledge.skill`}),` and opening the Claude Desktop App…`]}),t[17]=a.kind,t[18]=w);let T;t[19]!==a.kind||t[20]!==a.path?(T=a.kind===`handed-off`&&g&&(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3 text-sm`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-primary/30 bg-primary/5 px-3 py-2`,children:[(0,Y.jsx)(we,{"aria-hidden":`true`,className:`mt-0.5 h-4 w-4 text-primary`}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-foreground`,children:`File saved & Claude Desktop App opened`}),a.path?(0,Y.jsx)(`code`,{className:`text-xs text-muted-foreground`,children:a.path}):(0,Y.jsx)(`code`,{className:`text-xs text-muted-foreground`,children:`~/Downloads/openknowledge.skill`})]})]}),(0,Y.jsx)(Wx,{})]}),t[19]=a.kind,t[20]=a.path,t[21]=T):T=t[21];let E;t[22]===a.kind?E=t[23]:(E=a.kind===`handed-off`&&!g&&(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3 text-sm`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-primary/30 bg-primary/5 px-3 py-2`,children:[(0,Y.jsx)(we,{"aria-hidden":`true`,className:`mt-0.5 h-4 w-4 text-primary`}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-foreground`,children:`Download started`}),(0,Y.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`File saves to `,(0,Y.jsx)(`code`,{children:`~/Downloads/openknowledge.skill`}),`.`]})]})]}),(0,Y.jsx)(Wx,{})]}),t[22]=a.kind,t[23]=E);let D;t[24]!==a.kind||t[25]!==a.message?(D=a.kind===`error`&&(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2 text-sm`,children:[(0,Y.jsx)(`span`,{className:`text-destructive`,children:a.message}),(0,Y.jsx)(`a`,{href:Hx,target:`_blank`,rel:`noopener noreferrer`,className:`text-xs underline`,children:`See the full install guide`})]}),t[24]=a.kind,t[25]=a.message,t[26]=D):D=t[26];let O;t[27]!==S||t[28]!==C||t[29]!==w||t[30]!==T||t[31]!==E||t[32]!==D?(O=(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3 py-2`,children:[S,C,w,T,E,D]}),t[27]=S,t[28]=C,t[29]=w,t[30]=T,t[31]=E,t[32]=D,t[33]=O):O=t[33];let k;t[34]!==r||t[35]!==a.kind?(k=a.kind===`idle`&&g&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(K,{variant:`ghost`,onClick:()=>r(!1),children:`Cancel`}),(0,Y.jsxs)(K,{onClick:f,children:[(0,Y.jsx)(Si,{"aria-hidden":`true`,className:`mr-2 h-4 w-4`}),`Install`]})]}),t[34]=r,t[35]=a.kind,t[36]=k):k=t[36];let A;t[37]!==r||t[38]!==a.kind?(A=a.kind===`idle`&&!g&&(0,Y.jsx)(K,{variant:`ghost`,onClick:()=>r(!1),children:`Close`}),t[37]=r,t[38]=a.kind,t[39]=A):A=t[39];let j;t[40]!==r||t[41]!==a.kind?(j=a.kind===`error`&&g&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(K,{variant:`ghost`,onClick:()=>r(!1),children:`Cancel`}),(0,Y.jsxs)(K,{onClick:f,children:[(0,Y.jsx)(Si,{"aria-hidden":`true`,className:`mr-2 h-4 w-4`}),`Try again`]})]}),t[40]=r,t[41]=a.kind,t[42]=j):j=t[42];let M;t[43]===a.kind?M=t[44]:(M=a.kind===`downloading`&&(0,Y.jsxs)(K,{disabled:!0,children:[(0,Y.jsx)(Ye,{"aria-hidden":`true`,className:`mr-2 h-4 w-4 animate-spin`}),`Installing…`]}),t[43]=a.kind,t[44]=M);let N;t[45]!==r||t[46]!==a.kind?(N=a.kind===`handed-off`&&(0,Y.jsx)(K,{onClick:()=>r(!1),children:`Done`}),t[45]=r,t[46]=a.kind,t[47]=N):N=t[47];let P;t[48]!==k||t[49]!==A||t[50]!==j||t[51]!==M||t[52]!==N?(P=(0,Y.jsxs)(Nt,{children:[k,A,j,M,N]}),t[48]=k,t[49]=A,t[50]=j,t[51]=M,t[52]=N,t[53]=P):P=t[53];let F;t[54]!==O||t[55]!==P?(F=(0,Y.jsxs)(Kt,{className:`sm:max-w-lg`,"data-ok-layer-spawned":``,children:[x,O,P]}),t[54]=O,t[55]=P,t[56]=F):F=t[56];let I;return t[57]!==r||t[58]!==n||t[59]!==F?(I=(0,Y.jsx)(Jt,{open:n,onOpenChange:r,children:F}),t[57]=r,t[58]=n,t[59]=F,t[60]=I):I=t[60],I}function Kx(e){let t=(0,Z.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Y.jsx)(`title`,{children:`LinkedIn`}),r=(0,Y.jsx)(`path`,{d:`M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,Y.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 qx(e){let t=(0,Z.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Y.jsx)(`title`,{children:`X (Twitter)`}),r=(0,Y.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,Y.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 Jx=[{label:`Documentation`,href:`https://openknowledge.ai/docs`,icon:ti},{label:`Homepage`,href:`https://openknowledge.ai/`,icon:Ne},{label:`Twitter / X`,href:`https://x.com/inkeep`,icon:qx},{label:`LinkedIn`,href:`https://www.linkedin.com/company/inkeep/`,icon:Kx}],Yx=()=>{let e=(0,Z.c)(13),[t,n]=(0,X.useState)(!1),[r,i]=(0,X.useState)(!1),a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Y.jsxs)(ln,{children:[(0,Y.jsx)(nn,{asChild:!0,children:(0,Y.jsx)(vx,{asChild:!0,children:(0,Y.jsxs)(K,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,children:[(0,Y.jsx)(li,{className:`size-4`}),(0,Y.jsx)(`span`,{className:`sr-only`,children:`Help & resources`})]})})}),(0,Y.jsx)(an,{children:`Help & resources`})]}),e[0]=a):a=e[0];let o;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Y.jsx)(`p`,{className:`text-sm font-medium mb-2`,children:`Setup`}),e[1]=o):o=e[1];let s;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{i(!1),n(!0)},e[2]=s):s=e[2];let c,l;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Y.jsx)(`ul`,{className:`mb-3 space-y-0.5`,children:(0,Y.jsx)(`li`,{children:(0,Y.jsxs)(`button`,{type:`button`,onClick:s,className:`flex w-full items-center gap-2.5 rounded-md px-2 py-1.5 text-left text-sm text-muted-foreground transition-colors hover:bg-azure-900/5 dark:hover:bg-white/20 hover:text-primary`,children:[(0,Y.jsx)(Si,{"aria-hidden":`true`,className:`size-4 shrink-0`}),(0,Y.jsx)(`span`,{children:`Install for Claude Chat & Cowork…`})]})})}),l=(0,Y.jsx)(`p`,{className:`text-sm font-medium mb-2`,children:`Resources`}),e[3]=c,e[4]=l):(c=e[3],l=e[4]);let u;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Y.jsxs)(yx,{align:`end`,className:`w-64 p-3`,children:[o,c,l,(0,Y.jsx)(`nav`,{"aria-label":`Help and resources`,children:(0,Y.jsx)(`ul`,{className:`space-y-0.5`,children:Jx.map(Xx)})})]}),e[5]=u):u=e[5];let d;e[6]===r?d=e[7]:(d=(0,Y.jsxs)(_x,{open:r,onOpenChange:i,children:[a,u]}),e[6]=r,e[7]=d);let f;e[8]===t?f=e[9]:(f=(0,Y.jsx)(Gx,{open:t,onOpenChange:n}),e[8]=t,e[9]=f);let p;return e[10]!==d||e[11]!==f?(p=(0,Y.jsxs)(Y.Fragment,{children:[d,f]}),e[10]=d,e[11]=f,e[12]=p):p=e[12],p};function Xx(e){let{label:t,href:n,icon:r}=e;return(0,Y.jsx)(`li`,{children:(0,Y.jsxs)(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,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,Y.jsx)(r,{"aria-hidden":`true`,className:`size-4 shrink-0`}),t]})},n)}function Zx(e){let t=(0,Z.c)(9),n,r;if(t[0]===e?(n=t[1],r=t[2]):({id:n,...r}=e,t[0]=e,t[1]=n,t[2]=r),n===`claude-cowork`||n===`claude-code`){let e;return t[3]===r?e=t[4]:(e=(0,Y.jsx)(me,{...r}),t[3]=r,t[4]=e),e}if(n===`codex`){let e;return t[5]===r?e=t[6]:(e=(0,Y.jsx)(ye,{...r}),t[5]=r,t[6]=e),e}if(n===`cursor`){let e;return t[7]===r?e=t[8]:(e=(0,Y.jsx)(le,{...r}),t[7]=r,t[8]=e),e}return null}var Qx=`https://github.com/inkeep/open-knowledge/releases`;function $x(e){let{target:t,installState:n,isElectronHost:r}=e;return t.id===`cursor`&&!r?`Desktop only`:n.installed===null?`Detecting…`:n.installed===!1?`Not installed`:null}function eS(e){let{target:t,installState:n,isElectronHost:r}=e;if(t.id===`cursor`&&!r)return{enabled:!1,tooltip:{message:`Cursor handoff requires the desktop build.`,installAction:{label:`Install the Open Knowledge desktop app →`,url:Qx}}};if(n.installed===null)return{enabled:!1,tooltip:null};if(n.installed===!1){let e=t.appBrandName??t.displayName;return{enabled:!1,tooltip:{message:`Requires ${e}.`,installAction:{label:`Install ${e} →`,url:t.installUrl},...t.hasWebFallback?{webFallback:{label:`Open in claude.ai →`,url:``}}:{}}}}return{enabled:!0,tooltip:null}}function tS(e){return mn(e)}function nS(e){return`Opened ${e} in your browser.`}function rS(e){let t=(0,Z.c)(73),{target:n,installState:r,isElectronHost:i,prompt:a,onSelect:o}=e,s=e.openExternal??Pd,c=e.onWebFallbackSuccess??aS,l=e.onWebFallbackError??iS,u;t[0]!==r||t[1]!==i||t[2]!==n?(u=eS({target:n,installState:r,isElectronHost:i}),t[0]=r,t[1]=i,t[2]=n,t[3]=u):u=t[3];let d=u,f;t[4]!==r||t[5]!==i||t[6]!==n?(f=$x({target:n,installState:r,isElectronHost:i}),t[4]=r,t[5]=i,t[6]=n,t[7]=f):f=t[7];let p=f,m;t[8]!==s||t[9]!==d.tooltip?(m=()=>{d.tooltip&&s(d.tooltip.installAction.url)},t[8]=s,t[9]=d.tooltip,t[10]=m):m=t[10];let h=m,g;t[11]!==l||t[12]!==c||t[13]!==s||t[14]!==a||t[15]!==n?(g=()=>{(async()=>{let e=await s(tS(a));e.ok?c(n):l(n,e.detail??e.reason)})()},t[11]=l,t[12]=c,t[13]=s,t[14]=a,t[15]=n,t[16]=g):g=t[16];let _=g;if(d.enabled){let e=`open-in-agent-item-${n.id}`,r=`Open in ${n.displayName}`,i;t[17]===n.id?i=t[18]:(i=(0,Y.jsx)(Zx,{id:n.id,"aria-hidden":`true`}),t[17]=n.id,t[18]=i);let a;t[19]===n.displayName?a=t[20]:(a=(0,Y.jsx)(`span`,{children:n.displayName}),t[19]=n.displayName,t[20]=a);let s;return t[21]!==o||t[22]!==e||t[23]!==r||t[24]!==i||t[25]!==a?(s=(0,Y.jsxs)(z_,{onSelect:o,"data-testid":e,"aria-label":r,children:[i,a]}),t[21]=o,t[22]=e,t[23]=r,t[24]=i,t[25]=a,t[26]=s):s=t[26],s}if(!d.tooltip){let e=p?`Open in ${n.displayName}, ${p}`:`Open in ${n.displayName}`,r=`open-in-agent-item-${n.id}`,i;t[27]===n.id?i=t[28]:(i=(0,Y.jsx)(Zx,{id:n.id,"aria-hidden":`true`}),t[27]=n.id,t[28]=i);let a;t[29]===n.displayName?a=t[30]:(a=(0,Y.jsx)(`span`,{className:`flex-1`,children:n.displayName}),t[29]=n.displayName,t[30]=a);let o;t[31]===p?o=t[32]:(o=p?(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:p}):null,t[31]=p,t[32]=o);let s;return t[33]!==e||t[34]!==r||t[35]!==i||t[36]!==a||t[37]!==o?(s=(0,Y.jsxs)(z_,{disabled:!0,"data-testid":r,"aria-label":e,children:[i,a,o]}),t[33]=e,t[34]=r,t[35]=i,t[36]=a,t[37]=o,t[38]=s):s=t[38],s}let v=p?`Open in ${n.displayName}, ${p}`:`Open in ${n.displayName}`,y=`open-in-agent-item-${n.id}`,b;t[39]===n.id?b=t[40]:(b=(0,Y.jsx)(Zx,{id:n.id,"aria-hidden":`true`,className:`mr-2`}),t[39]=n.id,t[40]=b);let x;t[41]===n.displayName?x=t[42]:(x=(0,Y.jsx)(`span`,{className:`flex-1`,children:n.displayName}),t[41]=n.displayName,t[42]=x);let S;t[43]===p?S=t[44]:(S=p?(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:p}):null,t[43]=p,t[44]=S);let C;t[45]!==v||t[46]!==y||t[47]!==b||t[48]!==x||t[49]!==S?(C=(0,Y.jsxs)(G_,{"data-testid":y,"data-row-disabled":``,"aria-label":v,children:[b,x,S]}),t[45]=v,t[46]=y,t[47]=b,t[48]=x,t[49]=S,t[50]=C):C=t[50];let w=`open-in-agent-submenu-${n.id}`,T=`open-in-agent-message-${n.id}`,E;t[51]!==d.tooltip.message||t[52]!==T?(E=(0,Y.jsx)(H_,{className:`font-normal text-muted-foreground text-xs`,"data-testid":T,children:d.tooltip.message}),t[51]=d.tooltip.message,t[52]=T,t[53]=E):E=t[53];let D;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Y.jsx)(U_,{}),t[54]=D):D=t[54];let O=`open-in-agent-install-${n.id}`,k;t[55]===d.tooltip.installAction.label?k=t[56]:(k=(0,Y.jsx)(`span`,{children:d.tooltip.installAction.label}),t[55]=d.tooltip.installAction.label,t[56]=k);let A;t[57]!==h||t[58]!==O||t[59]!==k?(A=(0,Y.jsx)(z_,{onSelect:h,"data-testid":O,children:k}),t[57]=h,t[58]=O,t[59]=k,t[60]=A):A=t[60];let j;t[61]!==_||t[62]!==d.tooltip.webFallback||t[63]!==n.id?(j=d.tooltip.webFallback?(0,Y.jsxs)(z_,{onSelect:_,"data-testid":`open-in-agent-web-fallback-${n.id}`,"aria-label":`${d.tooltip.webFallback.label}, opens in browser with prompt pre-filled`,children:[(0,Y.jsx)(`span`,{className:`flex-1`,children:d.tooltip.webFallback.label}),(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:`opens in browser with prompt pre-filled`})]}):null,t[61]=_,t[62]=d.tooltip.webFallback,t[63]=n.id,t[64]=j):j=t[64];let M;t[65]!==E||t[66]!==A||t[67]!==j||t[68]!==w?(M=(0,Y.jsxs)(K_,{className:`min-w-[260px]`,"data-testid":w,children:[E,D,A,j]}),t[65]=E,t[66]=A,t[67]=j,t[68]=w,t[69]=M):M=t[69];let N;return t[70]!==M||t[71]!==C?(N=(0,Y.jsxs)(W_,{children:[C,M]}),t[70]=M,t[71]=C,t[72]=N):N=t[72],N}function iS(){}function aS(){}function oS(e){let t=(0,Z.c)(25),{input:n}=e,{states:r,refresh:i}=ff(),{dispatch:a}=ef(),[o,s]=(0,X.useState)(!1),c=typeof window<`u`&&window.okDesktop!=null,l=cS,u=sS,d;t[0]===i?d=t[1]:(d=e=>{s(e),e&&i()},t[0]=i,t[1]=d);let f=d,p=n===null,m;t[2]===n?m=t[3]:(m=n===null?``:yn(n.docContext),t[2]=n,t[3]=m);let h=m,g;t[4]!==a||t[5]!==n?(g=e=>{n!==null&&a(e.id,n)},t[4]=a,t[5]=n,t[6]=g):g=t[6];let _=g,v;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Y.jsx)(xe,{className:`size-4`}),t[7]=v):v=t[7];let y;t[8]===p?y=t[9]:(y=(0,Y.jsx)(nn,{asChild:!0,children:(0,Y.jsx)(L_,{asChild:!0,children:(0,Y.jsx)(K,{variant:`ghost`,size:`icon-sm`,"aria-label":`Edit with AI`,disabled:p,className:`text-muted-foreground`,"data-testid":`open-in-agent-trigger`,children:v})})}),t[8]=p,t[9]=y);let b;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Y.jsx)(an,{children:`Edit with AI`}),t[10]=b):b=t[10];let x;t[11]===y?x=t[12]:(x=(0,Y.jsxs)(ln,{children:[y,b]}),t[11]=y,t[12]=x);let S;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Y.jsx)(H_,{className:`font-mono font-normal tracking-wide uppercase text-muted-foreground text-xs`,children:`Open in…`}),t[13]=S):S=t[13];let C;t[14]!==_||t[15]!==h||t[16]!==r?(C=Od.map(e=>{let t=r[e.id];return(0,Y.jsx)(rS,{target:e,installState:t,isElectronHost:c,prompt:h,onSelect:()=>_(e),onWebFallbackSuccess:l,onWebFallbackError:u},e.id)}),t[14]=_,t[15]=h,t[16]=r,t[17]=C):C=t[17];let w;t[18]===C?w=t[19]:(w=(0,Y.jsxs)(R_,{align:`end`,className:`min-w-[220px]`,"data-testid":`open-in-agent-menu`,children:[S,C]}),t[18]=C,t[19]=w);let T;return t[20]!==f||t[21]!==o||t[22]!==w||t[23]!==x?(T=(0,Y.jsxs)(I_,{open:o,onOpenChange:f,children:[x,w]}),t[20]=f,t[21]=o,t[22]=w,t[23]=x,t[24]=T):T=t[24],T}function sS(e){At.error(`Couldn't open ${e.displayName} in your browser.`)}function cS(e){At.success(nS(e.displayName))}var lS={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`},uS=e=>{let t=(0,Z.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,Y.jsx)(`svg`,{"aria-hidden":`true`,...lS,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},dS=e=>{let t=(0,Z.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Y.jsx)(`title`,{children:`Markdown`}),r=(0,Y.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,Y.jsxs)(uS,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i},fS=e=>{let t=(0,Z.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Y.jsx)(`title`,{children:`Textbox`}),r=(0,Y.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,Y.jsxs)(uS,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i};function pS(e){let t=(0,Z.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,size: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?o=t[5]:(o=W(`peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50`,n),t[4]=n,t[5]=o);let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Y.jsx)(Ml,{"data-slot":`switch-thumb`,className:`pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground`}),t[6]=s):s=t[6];let c;return t[7]!==r||t[8]!==a||t[9]!==o?(c=(0,Y.jsx)(jl,{"data-slot":`switch`,"data-size":a,className:o,...r,children:s}),t[7]=r,t[8]=a,t[9]=o,t[10]=c):c=t[10],c}function mS(e){if(!e)return`never`;let t=Date.now()-new Date(e).getTime();return t<6e4?`just now`:t<36e5?`${Math.floor(t/6e4)} min ago`:t<864e5?`${Math.floor(t/36e5)}h ago`:new Date(e).toLocaleDateString()}async function hS(e){await fetch(`/api/sync/trigger`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({op:e})})}async function gS(e){let t=await fetch(`/api/sync/set-enabled`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({enabled:e})});if(!t.ok)throw Error(`set-enabled failed: HTTP ${t.status}`)}function _S(e){let t=(0,Z.c)(9),{status:n}=e;switch(n.state){case`dormant`:{let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(fi,{className:`size-3.5 text-muted-foreground`}),t[0]=e):e=t[0],e}case`idle`:{if(n.ahead>0||n.behind>0){let e;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(ea,{className:`size-3.5 text-muted-foreground`}),t[1]=e):e=t[1],e}let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(fi,{className:`size-3.5 text-emerald-500`}),t[2]=e):e=t[2],e}case`fetching`:case`pulling`:case`pushing`:{let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(ea,{className:`size-3.5 text-muted-foreground animate-spin`}),t[3]=e):e=t[3],e}case`conflict`:{let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(De,{className:`size-3.5 text-amber-500`}),t[4]=e):e=t[4],e}case`offline`:{let e;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(di,{className:`size-3.5 text-muted-foreground`}),t[5]=e):e=t[5],e}case`auth-error`:{let e;return t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(Vi,{className:`size-3.5 text-destructive`}),t[6]=e):e=t[6],e}case`disabled`:{let e;return t[7]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(di,{className:`size-3.5 text-muted-foreground`}),t[7]=e):e=t[7],e}default:{let e;return t[8]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(fi,{className:`size-3.5 text-muted-foreground`}),t[8]=e):e=t[8],e}}}function vS(e){switch(e.state){case`idle`:return e.ahead>0?`↑${e.ahead}`:e.behind>0?`↓${e.behind}`:``;case`fetching`:case`pulling`:case`pushing`:return``;case`conflict`:return e.conflictCount>0?`${e.conflictCount}`:``;case`offline`:return``;case`auth-error`:return``;case`disabled`:return``;default:return``}}function yS(e){switch(e){case`dormant`:return`No git remote`;case`idle`:return`Synced`;case`fetching`:return`Fetching…`;case`pulling`:return`Pulling…`;case`pushing`:return`Pushing…`;case`conflict`:return`Conflict`;case`offline`:return`Offline`;case`auth-error`:return`Sign in required`;case`disabled`:return`Sync disabled`;default:return e}}function bS(e){switch(e){case`external-changes-pending`:return`External changes pending`;case`dirty-tree`:return`Working tree has uncommitted changes`;case`detached-head`:return`Detached HEAD — checkout a branch to resume`;case`auth-error`:return`Sign in required`;case`protected-branch`:return`Protected branch — cannot push`;default:return e}}function xS(e){return e.syncEnabled?e.state===`idle`?e.ahead>0&&e.behind>0?`${e.ahead} ahead, ${e.behind} behind`:e.ahead>0?`${e.ahead} ahead`:e.behind>0?`${e.behind} behind`:`Synced`:e.state===`conflict`&&e.conflictCount>0?`${e.conflictCount} conflict${e.conflictCount===1?``:`s`}`:yS(e.state):`Sync off`}function SS(e){let t=(0,Z.c)(72),{status:n,onSignIn:r,onOpenConflictResolver:i,onSetIdentity:a}=e,[o,s]=(0,X.useState)(!1),c=n.syncEnabled,l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=async function(e){s(!0);try{await gS(e)}catch(t){console.error(`[sync] toggle failed`,t),At.error(`Failed to ${e?`enable`:`disable`} sync — try again`)}s(!1)},t[0]=l):l=t[0];let u=l,d;t[1]===n?d=t[2]:(d=(0,Y.jsx)(_S,{status:n}),t[1]=n,t[2]=d);let f;t[3]===n.state?f=t[4]:(f=yS(n.state),t[3]=n.state,t[4]=f);let p;t[5]===f?p=t[6]:(p=(0,Y.jsx)(`span`,{className:`text-sm font-medium truncate`,children:f}),t[5]=f,t[6]=p);let m;t[7]!==d||t[8]!==p?(m=(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[d,p]}),t[7]=d,t[8]=p,t[9]=m):m=t[9];let h;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(h=e=>void u(e),t[10]=h):h=t[10];let g=c?`Disable sync`:`Enable sync`,_;t[11]!==c||t[12]!==g||t[13]!==o?(_=(0,Y.jsx)(pS,{checked:c,disabled:o,onCheckedChange:h,"aria-label":g}),t[11]=c,t[12]=g,t[13]=o,t[14]=_):_=t[14];let v;t[15]!==m||t[16]!==_?(v=(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[m,_]}),t[15]=m,t[16]=_,t[17]=v):v=t[17];let y;t[18]===n.error?y=t[19]:(y=n.error&&(0,Y.jsx)(`p`,{className:`text-xs text-destructive`,children:n.error}),t[18]=n.error,t[19]=y);let b;t[20]===n.pausedReason?b=t[21]:(b=n.pausedReason&&(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:bS(n.pausedReason)}),t[20]=n.pausedReason,t[21]=b);let x;t[22]===n.state?x=t[23]:(x=n.state===`conflict`&&(0,Y.jsx)(`p`,{className:`text-xs text-amber-700 dark:text-amber-400`,children:`Sync paused — resolve conflicts to resume.`}),t[22]=n.state,t[23]=x);let S;t[24]!==c||t[25]!==n.lastSyncUtc||t[26]!==n.state?(S=c&&n.state!==`dormant`&&(0,Y.jsxs)(`div`,{children:[`Last synced: `,mS(n.lastSyncUtc)]}),t[24]=c,t[25]=n.lastSyncUtc,t[26]=n.state,t[27]=S):S=t[27];let C;t[28]===n.ahead?C=t[29]:(C=n.ahead>0&&(0,Y.jsxs)(`div`,{children:[n.ahead,` commit`,n.ahead===1?``:`s`,` ahead`]}),t[28]=n.ahead,t[29]=C);let w;t[30]===n.behind?w=t[31]:(w=n.behind>0&&(0,Y.jsxs)(`div`,{children:[n.behind,` commit`,n.behind===1?``:`s`,` behind`]}),t[30]=n.behind,t[31]=w);let T;t[32]===n.conflictCount?T=t[33]:(T=n.conflictCount>0&&(0,Y.jsxs)(`div`,{children:[n.conflictCount,` file`,n.conflictCount===1?``:`s`,` conflicted`]}),t[32]=n.conflictCount,t[33]=T);let E;t[34]===c?E=t[35]:(E=!c&&(0,Y.jsx)(`div`,{children:`Sync is off — your edits will not sync to the remote repository.`}),t[34]=c,t[35]=E);let D;t[36]!==S||t[37]!==C||t[38]!==w||t[39]!==T||t[40]!==E?(D=(0,Y.jsxs)(`div`,{className:`text-xs text-muted-foreground space-y-0.5`,children:[S,C,w,T,E]}),t[36]=S,t[37]=C,t[38]=w,t[39]=T,t[40]=E,t[41]=D):D=t[41];let O;t[42]!==a||t[43]!==n.identityUnresolved?(O=n.identityUnresolved&&a&&(0,Y.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-dashed p-2`,children:[(0,Y.jsx)(ha,{className:`size-3.5 mt-0.5 text-muted-foreground shrink-0`}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1.5 min-w-0`,children:[(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground leading-snug`,children:`Git identity isn't set — commits use a default author. Set yours so teammates see your name.`}),(0,Y.jsx)(K,{variant:`outline`,size:`xs`,className:`self-start`,onClick:a,children:`Set identity`})]})]}),t[42]=a,t[43]=n.identityUnresolved,t[44]=O):O=t[44];let k;t[45]!==c||t[46]!==n.state?(k=c&&n.state!==`dormant`&&n.state!==`disabled`&&n.state!==`auth-error`&&n.state!==`conflict`&&(0,Y.jsx)(K,{variant:`outline`,size:`xs`,onClick:wS,children:`Sync now`}),t[45]=c,t[46]=n.state,t[47]=k):k=t[47];let A;t[48]!==c||t[49]!==r||t[50]!==n.state?(A=c&&n.state===`auth-error`&&(0,Y.jsx)(K,{variant:`outline`,size:`xs`,onClick:r,children:`Sign in`}),t[48]=c,t[49]=r,t[50]=n.state,t[51]=A):A=t[51];let j;t[52]!==c||t[53]!==n.state?(j=c&&n.state===`offline`&&(0,Y.jsx)(K,{variant:`outline`,size:`xs`,onClick:CS,children:`Retry`}),t[52]=c,t[53]=n.state,t[54]=j):j=t[54];let M;t[55]!==c||t[56]!==i||t[57]!==n.state?(M=c&&n.state===`conflict`&&i&&(0,Y.jsx)(K,{variant:`outline`,size:`xs`,onClick:i,children:`Review conflicts`}),t[55]=c,t[56]=i,t[57]=n.state,t[58]=M):M=t[58];let N;t[59]!==k||t[60]!==A||t[61]!==j||t[62]!==M?(N=(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-1 pt-1`,children:[k,A,j,M]}),t[59]=k,t[60]=A,t[61]=j,t[62]=M,t[63]=N):N=t[63];let P;return t[64]!==y||t[65]!==b||t[66]!==x||t[67]!==D||t[68]!==O||t[69]!==N||t[70]!==v?(P=(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[v,y,b,x,D,O,N]}),t[64]=y,t[65]=b,t[66]=x,t[67]=D,t[68]=O,t[69]=N,t[70]=v,t[71]=P):P=t[71],P}function CS(){hS(`sync`)}function wS(){hS(`sync`)}function TS(e){let t=(0,Z.c)(36),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{onSignIn:r,onOpenConflictResolver:i,onSetIdentity:a}=n,{status:o,fetchError:s}=Hf();if(!o){if(s){let e;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(nn,{asChild:!0,children:(0,Y.jsx)(K,{variant:`ghost`,size:`icon-sm`,className:`text-muted-foreground`,"aria-label":`Sync status unavailable`,disabled:!0,children:(0,Y.jsx)(di,{className:`size-3.5`})})}),t[2]=e):e=t[2];let n=s===`network`?`Sync status unavailable — server unreachable.`:`Sync status unavailable — server error.`,r;return t[3]===n?r=t[4]:(r=(0,Y.jsxs)(ln,{children:[e,(0,Y.jsx)(an,{children:n})]}),t[3]=n,t[4]=r),r}return null}if(o.state===`dormant`&&!o.hasRemote)return null;let c;t[5]===o?c=t[6]:(c=vS(o),t[5]=o,t[6]=c);let l=c,u=!!o.identityUnresolved,d;t[7]===o.state?d=t[8]:(d=yS(o.state),t[7]=o.state,t[8]=d);let f=`Sync status: ${d}${u?` — git identity unset`:``}`,p;t[9]===o?p=t[10]:(p=(0,Y.jsx)(_S,{status:o}),t[9]=o,t[10]=p);let m;t[11]===l?m=t[12]:(m=l&&(0,Y.jsx)(`span`,{className:`absolute -top-0.5 -right-0.5 text-[9px] leading-none font-medium bg-background border rounded-full px-0.5`,children:l}),t[11]=l,t[12]=m);let h;t[13]!==l||t[14]!==u?(h=!l&&u&&(0,Y.jsx)(`span`,{className:`absolute -top-0.5 -right-0.5 size-1.5 rounded-full bg-amber-500 ring-2 ring-background`,"aria-hidden":!0}),t[13]=l,t[14]=u,t[15]=h):h=t[15];let g;t[16]!==f||t[17]!==p||t[18]!==m||t[19]!==h?(g=(0,Y.jsx)(nn,{asChild:!0,children:(0,Y.jsx)(vx,{asChild:!0,children:(0,Y.jsxs)(K,{variant:`ghost`,size:`icon-sm`,className:`text-muted-foreground relative`,"aria-label":f,children:[p,m,h]})})}),t[16]=f,t[17]=p,t[18]=m,t[19]=h,t[20]=g):g=t[20];let _;t[21]===o?_=t[22]:(_=xS(o),t[21]=o,t[22]=_);let v;t[23]===_?v=t[24]:(v=(0,Y.jsx)(an,{children:_}),t[23]=_,t[24]=v);let y;t[25]!==v||t[26]!==g?(y=(0,Y.jsxs)(ln,{children:[g,v]}),t[25]=v,t[26]=g,t[27]=y):y=t[27];let b;t[28]!==i||t[29]!==a||t[30]!==r||t[31]!==o?(b=(0,Y.jsx)(yx,{align:`end`,className:`w-64 p-3`,children:(0,Y.jsx)(SS,{status:o,onSignIn:r,onOpenConflictResolver:i,onSetIdentity:a})}),t[28]=i,t[29]=a,t[30]=r,t[31]=o,t[32]=b):b=t[32];let x;return t[33]!==y||t[34]!==b?(x=(0,Y.jsxs)(_x,{children:[y,b]}),t[33]=y,t[34]=b,t[35]=x):x=t[35],x}var ES=[{value:`light`,label:`Light`,icon:ua},{value:`dark`,label:`Dark`,icon:Hi},{value:`system`,label:`System`,icon:gi}],DS=()=>{let e=(0,Z.c)(14),{theme:t,setTheme:n}=T(),r=t===`system`?gi:t===`dark`?Hi:ua,i;e[0]===r?i=e[1]:(i=(0,Y.jsx)(r,{}),e[0]=r,e[1]=i);let a=t??`system`,o;e[2]===a?o=e[3]:(o=(0,Y.jsxs)(`span`,{className:`sr-only`,children:[`Toggle theme (current: `,a,`)`]}),e[2]=a,e[3]=o);let s;e[4]!==i||e[5]!==o?(s=(0,Y.jsx)(L_,{asChild:!0,children:(0,Y.jsxs)(K,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,children:[i,o]})}),e[4]=i,e[5]=o,e[6]=s):s=e[6];let c;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=ES.map(OS),e[7]=c):c=e[7];let l;e[8]!==n||e[9]!==t?(l=(0,Y.jsx)(R_,{align:`end`,children:(0,Y.jsx)(B_,{value:t,onValueChange:n,children:c})}),e[8]=n,e[9]=t,e[10]=l):l=e[10];let u;return e[11]!==s||e[12]!==l?(u=(0,Y.jsxs)(I_,{children:[s,l]}),e[11]=s,e[12]=l,e[13]=u):u=e[13],u};function OS(e){let{value:t,label:n,icon:r}=e;return(0,Y.jsxs)(V_,{value:t,className:`capitalize`,children:[(0,Y.jsx)(r,{className:`text-muted-foreground`}),n]},t)}function kS(e){return typeof e==`object`&&!!e&&typeof e.fromDocName==`string`&&typeof e.toDocName==`string`}function AS(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.ok===!0?Array.isArray(t.renamed)&&t.renamed.every(kS)&&Array.isArray(t.rewrittenDocs):t.ok===!1?typeof t.error==`string`:!1}function jS(e){let t=(0,Z.c)(97),{editorMode:n,onModeChange:r,onSaveVersion:i,saving:a,previewEntry:o,diffLayout:s,onDiffLayoutChange:c,onSignIn:l,onSetIdentity:u,onOpenConflictResolver:d,onOpenClone:f}=e,{activeDocName:p,activeProvider:m,activeTarget:h,closeDocument:g,pinnedDoc:_,pin:v,unpin:y}=ut(),{state:b}=rx(),x=kd(),S=Tx(m),C;t[0]!==p||t[1]!==x?(C=Gd({docName:p,workspace:x}),t[0]=p,t[1]=x,t[2]=C):C=t[2];let w=C,T=!p||!(S===`connected`||S===`synced`),E=h?.kind===`folder`,D=h?.kind===`missing`,O=E?`${h.folderPath}/`:p?`${p}.md`:``,k;t[3]===p?k=t[4]:(k=p?.lastIndexOf(`/`)??-1,t[3]=p,t[4]=k);let A=k,j;t[5]!==p||t[6]!==A?(j=p&&A!==-1?`${p.substring(0,A+1)}`:``,t[5]=p,t[6]=A,t[7]=j):j=t[7];let M=j,N;t[8]!==p||t[9]!==A?(N=p?p.substring(A+1):``,t[8]=p,t[9]=A,t[10]=N):N=t[10];let P=N,F=_!==null,I;t[11]!==p||t[12]!==F||t[13]!==v||t[14]!==y?(I=function(){p&&(F?y():v(p))},t[11]=p,t[12]=F,t[13]=v,t[14]=y,t[15]=I):I=t[15];let ee=I,L=n===`diff`,[R,z]=(0,X.useState)(!1),[B,V]=(0,X.useState)(``),[H,te]=(0,X.useState)(null),[ne,re]=(0,X.useState)(!1),U=(0,X.useRef)(null),W=(0,X.useRef)(!1),G=(0,X.useRef)(!1),ie=(0,X.useRef)(null),ae=(0,X.useRef)(null),oe;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(oe=()=>{G.current=!0,ie.current=null,ae.current=null,z(!1),te(null)},t[16]=oe):oe=t[16];let q;t[17]===p?q=t[18]:(q=[p],t[17]=p,t[18]=q),(0,X.useEffect)(oe,q);let se,J;t[19]===R?(se=t[20],J=t[21]):(se=()=>{if(R){let e=setTimeout(()=>{let e=U.current;e&&(e.focus(),e.select())},0);return()=>clearTimeout(e)}},J=[R],t[19]=R,t[20]=se,t[21]=J),(0,X.useEffect)(se,J);let ce;t[22]!==p||t[23]!==E?(ce=function(){if(!p||E)return;let e=p.split(`/`);G.current=!1,ie.current=p,V(e[e.length-1]),te(null),ae.current=null,z(!0)},t[22]=p,t[23]=E,t[24]=ce):ce=t[24];let le=ce,ue;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(ue=function(){G.current=!0,ie.current=null,ae.current=null,z(!1),V(``),te(null)},t[25]=ue):ue=t[25];let de=ue,fe;t[26]!==g||t[27]!==B?(fe=async function(){if(G.current){G.current=!1;return}if(W.current)return;let e=ie.current;if(!e){de();return}let t=Vb(`file`,B),n=e.split(`/`),r=n[n.length-1];if(t===r){de();return}if(t===ae.current)return;if(!Hb(t)){te(`Name can’t be empty, ".", "..", or contain / or \\`);return}let i=Ub({kind:`file`,path:e,name:r},t);W.current=!0,re(!0),te(null);try{let n=await fetch(`/api/rename`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({docName:e,newDocName:i})});if(G.current){re(!1),W.current=!1;return}let r;try{r=await n.json()}catch(r){console.warn(`[EditorHeader] rename response JSON parse failed`,{parseErr:r,status:n.status,docName:e,newDocName:i}),te(`Server error (HTTP ${n.status})`),re(!1),W.current=!1,ae.current=t;return}if(!n.ok||!AS(r)){let a=r;console.warn(`[EditorHeader] rename failed`,{status:n.status,docName:e,newDocName:i}),te(a?.error||`Server error (HTTP ${n.status})`),re(!1),W.current=!1,ae.current=t;return}if(!r.ok){te(r.error||`Failed to rename path`),re(!1),W.current=!1,ae.current=t;return}let a=r.renamed,o=Kb(e,a);for(let e of a)g(e.fromDocName);Wn([`files`,`backlinks`,`graph`]),z(!1),V(``),re(!1),W.current=!1,ae.current=null,ie.current=null,o&&o!==e&&(window.location.hash=Nn(o))}catch(n){console.warn(`[EditorHeader] rename failed`,{err:n,docName:e,newDocName:i,normalized:t}),te(`Network error — please try again`),re(!1),W.current=!1,ae.current=t}},t[26]=g,t[27]=B,t[28]=fe):fe=t[28];let pe=fe,me;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,Y.jsx)(nn,{asChild:!0,children:(0,Y.jsx)(cx,{className:`-ml-1 shrink-0 text-muted-foreground`})}),t[29]=me):me=t[29];let he=b===`expanded`?`Hide Files`:`Show Files`,ge;t[30]===he?ge=t[31]:(ge=(0,Y.jsxs)(ln,{children:[me,(0,Y.jsx)(an,{children:he})]}),t[30]=he,t[31]=ge);let _e;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(_e=(0,Y.jsx)(Uy,{orientation:`vertical`,className:`mr-1 h-4 shrink-0 data-vertical:self-center`}),t[32]=_e):_e=t[32];let ve;t[33]!==p||t[34]!==pe||t[35]!==O||t[36]!==le||t[37]!==P||t[38]!==E||t[39]!==ne||t[40]!==R||t[41]!==M||t[42]!==H||t[43]!==B?(ve=E?(0,Y.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-2 text-sm text-muted-foreground`,children:[(0,Y.jsx)(nt,{className:`size-4 shrink-0`}),(0,Y.jsx)(`span`,{className:`truncate`,children:O})]}):p?(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center overflow-hidden`,children:[M&&(0,Y.jsxs)(`span`,{className:`flex shrink items-center overflow-hidden text-sm text-muted-foreground/60 transition-[max-width,opacity] duration-200 ease-in-out`,style:R?{maxWidth:0,opacity:0}:{maxWidth:`20rem`,opacity:1},children:[(0,Y.jsx)(`span`,{className:`truncate`,children:M.slice(0,-1)}),(0,Y.jsx)(`span`,{className:`shrink-0 pl-2`,children:`/`})]}),R?(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(Ue,{ref:U,value:B,disabled:ne,"aria-label":`Rename ${p}`,"aria-invalid":H?!0:void 0,"aria-describedby":H?`editor-header-rename-error`:void 0,"aria-busy":ne||void 0,onChange:e=>{V(e.target.value),te(null),ae.current=null},onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),pe()):e.key===`Escape`&&(e.preventDefault(),de())},onBlur:()=>void pe(),className:`h-7 min-w-0 flex-1 border-none bg-background text-sm shadow-none focus-visible:ring-0`}),(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 text-xs text-muted-foreground/40`,children:`.md`})]}),H&&(0,Y.jsx)(`span`,{id:`editor-header-rename-error`,role:`alert`,className:`text-xs text-destructive mt-0.5`,children:H})]}):(0,Y.jsxs)(K,{variant:`ghost`,size:`sm`,onClick:le,className:`h-7 shrink-0 px-2 text-sm font-normal text-muted-foreground hover:text-foreground`,children:[P,`.md`]})]}):(0,Y.jsx)(`span`,{className:`text-sm text-muted-foreground truncate min-w-0`,children:O}),t[33]=p,t[34]=pe,t[35]=O,t[36]=le,t[37]=P,t[38]=E,t[39]=ne,t[40]=R,t[41]=M,t[42]=H,t[43]=B,t[44]=ve):ve=t[44];let ye;t[45]!==p||t[46]!==F||t[47]!==ee?(ye=p&&(0,Y.jsxs)(ln,{children:[(0,Y.jsx)(nn,{asChild:!0,children:(0,Y.jsx)(K,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0 shrink-0 text-muted-foreground`,onClick:ee,"aria-label":F?`Unpin — resume following agent`:`Pin this doc — stop following agent`,"aria-pressed":F,"data-pinned":F?`true`:`false`,children:F?(0,Y.jsx)(Xi,{className:`size-4 text-foreground`,fill:`currentColor`}):(0,Y.jsx)(Yi,{className:`size-4`})})}),(0,Y.jsx)(an,{children:F?`Pinned — click to resume following agent navigation`:`Pin to stay on this doc — browser won’t auto-navigate to the agent’s current focus`})]}),t[45]=p,t[46]=F,t[47]=ee,t[48]=ye):ye=t[48];let be;t[49]===D?be=t[50]:(be=D&&(0,Y.jsx)(Wl,{variant:`dashed`,children:`New file`}),t[49]=D,t[50]=be);let xe;t[51]!==ge||t[52]!==ve||t[53]!==ye||t[54]!==be?(xe=(0,Y.jsxs)(`div`,{className:`flex flex-1 items-center gap-1 px-3 min-w-0`,children:[ge,_e,ve,ye,be]}),t[51]=ge,t[52]=ve,t[53]=ye,t[54]=be,t[55]=xe):xe=t[55];let Se;t[56]!==p||t[57]!==n||t[58]!==L||t[59]!==r||t[60]!==T?(Se=!L&&p&&(0,Y.jsxs)(Me,{type:`single`,value:n===`source`?`source`:`visual`,onValueChange:e=>{e&&r(e===`source`?`source`:`wysiwyg`)},"aria-label":`Editor mode`,variant:`segmented`,size:`sm`,spacing:1,className:`bg-muted dark:bg-background p-0.5 rounded-lg shrink-0`,disabled:!p,children:[(0,Y.jsxs)(ln,{children:[(0,Y.jsx)(nn,{asChild:!0,children:(0,Y.jsx)(`span`,{children:(0,Y.jsxs)(Oe,{value:`visual`,"aria-label":`Visual editor`,className:`gap-1.5 text-xs`,children:[(0,Y.jsx)(fS,{className:`size-4 text-muted-foreground`}),(0,Y.jsx)(`span`,{className:`hidden md:inline`,children:`Visual`})]})})}),(0,Y.jsx)(an,{className:`md:hidden`,children:`Visual`})]}),(0,Y.jsxs)(ln,{children:[(0,Y.jsx)(nn,{asChild:!0,children:(0,Y.jsx)(`span`,{tabIndex:T?0:void 0,children:(0,Y.jsxs)(Oe,{value:`source`,"aria-label":`Markdown source`,className:`gap-1.5 text-xs`,disabled:T,children:[(0,Y.jsx)(dS,{className:`size-4 text-muted-foreground`}),(0,Y.jsx)(`span`,{className:`hidden md:inline`,children:`Markdown`})]})})}),T&&!p?null:T?(0,Y.jsx)(an,{children:`Source mode requires a live connection — your edits are saved and will appear when you reconnect.`}):(0,Y.jsx)(an,{className:`md:hidden`,children:`Markdown`})]})]}),t[56]=p,t[57]=n,t[58]=L,t[59]=r,t[60]=T,t[61]=Se):Se=t[61];let Ce;t[62]!==s||t[63]!==L||t[64]!==c||t[65]!==o?(Ce=L&&o&&(0,Y.jsx)(`div`,{className:`flex items-center gap-2 shrink-0`,children:(0,Y.jsxs)(Me,{type:`single`,value:s,onValueChange:e=>{e&&c(e)},"aria-label":`Diff layout`,variant:`segmented`,size:`sm`,spacing:1,className:`bg-muted dark:bg-background p-0.5 rounded-lg shrink-0`,children:[(0,Y.jsxs)(ln,{children:[(0,Y.jsx)(nn,{asChild:!0,children:(0,Y.jsx)(`span`,{children:(0,Y.jsxs)(Oe,{value:`unified`,"aria-label":`Unified diff`,className:`gap-1 text-xs px-2`,children:[(0,Y.jsx)(ta,{className:`size-3.5`}),(0,Y.jsx)(`span`,{className:`hidden md:inline`,children:`Unified`})]})})}),(0,Y.jsx)(an,{className:`md:hidden`,children:`Unified`})]}),(0,Y.jsxs)(ln,{children:[(0,Y.jsx)(nn,{asChild:!0,children:(0,Y.jsx)(`span`,{children:(0,Y.jsxs)(Oe,{value:`split`,"aria-label":`Split diff`,className:`gap-1 text-xs px-2`,children:[(0,Y.jsx)(mi,{className:`size-3.5`}),(0,Y.jsx)(`span`,{className:`hidden md:inline`,children:`Split`})]})})}),(0,Y.jsx)(an,{className:`md:hidden`,children:`Split`})]})]})}),t[62]=s,t[63]=L,t[64]=c,t[65]=o,t[66]=Ce):Ce=t[66];let we;t[67]!==L||t[68]!==f?(we=!L&&f&&(0,Y.jsxs)(ln,{children:[(0,Y.jsx)(nn,{asChild:!0,children:(0,Y.jsx)(K,{variant:`ghost`,size:`icon-sm`,"aria-label":`Clone from GitHub`,onClick:f,className:`text-muted-foreground`,children:(0,Y.jsx)(Ai,{className:`size-3.5`})})}),(0,Y.jsx)(an,{children:`Clone from GitHub…`})]}),t[67]=L,t[68]=f,t[69]=we):we=t[69];let Te;t[70]!==p||t[71]!==L||t[72]!==i||t[73]!==a?(Te=!L&&p&&(0,Y.jsxs)(ln,{children:[(0,Y.jsx)(nn,{asChild:!0,children:(0,Y.jsx)(K,{variant:`ghost`,size:`icon-sm`,"aria-label":`Checkpoint version`,onClick:i,disabled:a,className:`text-muted-foreground`,children:(0,Y.jsx)(na,{className:`size-3.5`})})}),(0,Y.jsx)(an,{children:a?`Saving…`:`Checkpoint version`})]}),t[70]=p,t[71]=L,t[72]=i,t[73]=a,t[74]=Te):Te=t[74];let Ee;t[75]!==p||t[76]!==w||t[77]!==L?(Ee=!L&&p&&(0,Y.jsx)(oS,{input:w}),t[75]=p,t[76]=w,t[77]=L,t[78]=Ee):Ee=t[78];let De;t[79]!==d||t[80]!==u||t[81]!==l?(De=(0,Y.jsx)(TS,{onSignIn:l,onSetIdentity:u,onOpenConflictResolver:d}),t[79]=d,t[80]=u,t[81]=l,t[82]=De):De=t[82];let ke,Ae,je,Ne;t[83]===Symbol.for(`react.memo_cache_sentinel`)?(ke=(0,Y.jsx)(Bx,{}),Ae=(0,Y.jsx)(Uy,{orientation:`vertical`,className:`h-4 shrink-0 data-vertical:self-center`}),je=(0,Y.jsx)(Yx,{}),Ne=(0,Y.jsx)(DS,{}),t[83]=ke,t[84]=Ae,t[85]=je,t[86]=Ne):(ke=t[83],Ae=t[84],je=t[85],Ne=t[86]);let Pe;t[87]!==we||t[88]!==Te||t[89]!==Ee||t[90]!==De?(Pe=(0,Y.jsxs)(`div`,{className:`flex flex-1 items-center justify-end gap-2 px-3`,children:[we,Te,Ee,De,ke,Ae,je,Ne]}),t[87]=we,t[88]=Te,t[89]=Ee,t[90]=De,t[91]=Pe):Pe=t[91];let Fe;return t[92]!==xe||t[93]!==Se||t[94]!==Ce||t[95]!==Pe?(Fe=(0,Y.jsxs)(`header`,{className:`flex h-12 shrink-0 items-center border-b`,children:[xe,Se,Ce,Pe]}),t[92]=xe,t[93]=Se,t[94]=Ce,t[95]=Pe,t[96]=Fe):Fe=t[96],Fe}function MS(){let e=(0,Z.c)(66),[t,n]=zf(),[r,i]=(0,X.useState)(t),[a,o]=(0,X.useState)(!1),[s,c]=(0,X.useState)(!1),[l,u]=(0,X.useState)(`auth`),[d,f]=(0,X.useState)(!1),[p,m]=(0,X.useState)(!1),[h,g]=(0,X.useState)(null),[_,v]=(0,X.useState)(`unified`),[y,b]=(0,X.useState)(!1),[x,S]=(0,X.useState)(null),[C,w]=(0,X.useState)(!1),T=(0,X.useRef)(null),E=(0,X.useRef)(!1),D=(0,X.useRef)(`wysiwyg`),O=Vf(),k,A;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(k=()=>()=>{T.current&&clearTimeout(T.current)},A=[],e[0]=k,e[1]=A):(k=e[0],A=e[1]),(0,X.useEffect)(k,A);let{activeDocName:j}=ut(),M;e[2]===r?M=e[3]:(M=function(e){e.sha?(r!==`diff`&&(D.current=r),g(e),i(`diff`)):(g(null),i(D.current)),S(null)},e[2]=r,e[3]=M);let N=M,P;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(P=function(){g(null),i(D.current),S(null)},e[4]=P):P=e[4];let F=P,I;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(I=function(){F(),At.info(`No changes since this version`)},e[5]=I):I=e[5];let ee=I,L,R;e[6]===j?(L=e[7],R=e[8]):(L=()=>{let e=function(e){let t=e.detail;t&&j&&pr(j,{kind:`raw-mdx`,detail:t}),i(`source`)};return window.addEventListener(mt,e),()=>window.removeEventListener(mt,e)},R=[j],e[6]=j,e[7]=L,e[8]=R),(0,X.useEffect)(L,R);let z=(0,X.useRef)(j),B,V;e[9]!==j||e[10]!==r?(B=()=>{z.current!==j&&(z.current=j,g(null),r===`diff`&&i(D.current))},V=[j,r],e[9]=j,e[10]=r,e[11]=B,e[12]=V):(B=e[11],V=e[12]),(0,X.useEffect)(B,V);let H;e[13]===O?H=e[14]:(H=()=>{!E.current&&O?.state===`dormant`&&O.hasRemote&&(E.current=!0,At.info(`This project has a GitHub remote.`,{description:`Sign in to enable automatic sync with your team.`,duration:8e3,action:{label:`Sign in`,onClick:()=>c(!0)}}))},e[13]=O,e[14]=H);let te=O?.state,ne=O?.hasRemote,re;e[15]!==te||e[16]!==ne?(re=[te,ne],e[15]=te,e[16]=ne,e[17]=re):re=e[17],(0,X.useEffect)(H,re);let U;e[18]===n?U=e[19]:(U=function(e){i(e),n(e)},e[18]=n,e[19]=U);let W=U,G;e[20]===Symbol.for(`react.memo_cache_sentinel`)?(G=async function(){w(!0);try{let e=await fetch(`/api/save-version`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({})});e.ok?At.success(`Checkpoint saved`):(console.error(`[save-version] failed:`,await e.text()),At.error(`Checkpoint failed — try again`))}catch(e){console.error(`[save-version] failed:`,e),At.error(`Checkpoint failed — try again`)}w(!1)},e[20]=G):G=e[20];let ie=G,ae;e[21]!==j||e[22]!==h?(ae=async function(){if(!(!h?.sha||!j)){b(!0);try{(await fetch(`/api/rollback`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({docName:j,commitSha:h.sha})})).ok?(g(null),i(D.current),S(null)):(S(`Restore failed — document unchanged`),T.current&&clearTimeout(T.current),T.current=setTimeout(()=>S(null),4e3))}catch{S(`Restore failed — document unchanged`),T.current&&clearTimeout(T.current),T.current=setTimeout(()=>S(null),4e3)}b(!1)}},e[21]=j,e[22]=h,e[23]=ae):ae=e[23];let oe=ae,q;e[24]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,Y.jsx)(np,{onOpenResolver:()=>o(!0)}),e[24]=q):q=e[24];let se,J,ce,le;e[25]===Symbol.for(`react.memo_cache_sentinel`)?(se=()=>{u(`auth`),c(!0)},J=()=>{u(`identity`),c(!0)},ce=()=>o(!0),le=()=>f(!0),e[25]=se,e[26]=J,e[27]=ce,e[28]=le):(se=e[25],J=e[26],ce=e[27],le=e[28]);let ue;e[29]!==_||e[30]!==r||e[31]!==W||e[32]!==h||e[33]!==C?(ue=(0,Y.jsx)(jS,{editorMode:r,onModeChange:W,onSaveVersion:ie,saving:C,previewEntry:h,diffLayout:_,onDiffLayoutChange:v,onSignIn:se,onSetIdentity:J,onOpenConflictResolver:ce,onOpenClone:le}),e[29]=_,e[30]=r,e[31]=W,e[32]=h,e[33]=C,e[34]=ue):ue=e[34];let de;e[35]!==r||e[36]!==oe||e[37]!==h||e[38]!==x||e[39]!==y?(de=r===`diff`&&h&&(0,Y.jsxs)(`div`,{className:`flex h-8 shrink-0 items-center border-b bg-muted/30 px-3 gap-2`,children:[(0,Y.jsxs)(`span`,{className:`flex-1 truncate text-xs text-muted-foreground`,children:[`Viewing: `,a_(h.timestamp),` — `,o_(h)]}),x&&(0,Y.jsx)(`span`,{className:`text-xs text-destructive`,children:x}),(0,Y.jsx)(K,{variant:`ghost`,className:`font-mono uppercase`,size:`xs`,onClick:F,children:`Close`}),(0,Y.jsxs)(xf,{children:[(0,Y.jsx)(Sf,{asChild:!0,children:(0,Y.jsx)(K,{variant:`default`,size:`xs`,disabled:y,children:y?`Restoring…`:`Restore`})}),(0,Y.jsxs)(Tf,{children:[(0,Y.jsxs)(Ef,{children:[(0,Y.jsx)(Of,{children:`Restore this version?`}),(0,Y.jsxs)(kf,{children:[`This will replace the current document content with the version from`,` `,a_(h.timestamp),`. Your current content is already saved in the timeline — you can restore it anytime.`]})]}),(0,Y.jsxs)(Df,{children:[(0,Y.jsx)(jf,{className:`font-mono uppercase`,children:`Cancel`}),(0,Y.jsx)(Af,{onClick:oe,children:`Restore`})]})]})]})]}),e[35]=r,e[36]=oe,e[37]=h,e[38]=x,e[39]=y,e[40]=de):de=e[40];let fe=h?.sha,pe;e[41]!==_||e[42]!==r||e[43]!==N||e[44]!==h||e[45]!==fe?(pe=(0,Y.jsx)(Ib,{editorMode:r,previewEntry:h,diffLayout:_,onNoDiff:ee,onEntrySelect:N,selectedSha:fe}),e[41]=_,e[42]=r,e[43]=N,e[44]=h,e[45]=fe,e[46]=pe):pe=e[46];let me;e[47]===a?me=e[48]:(me=(0,Y.jsx)(ih,{open:a,onOpenChange:o}),e[47]=a,e[48]=me);let he;e[49]===Symbol.for(`react.memo_cache_sentinel`)?(he=e=>{c(e),e||m(!1)},e[49]=he):he=e[49];let ge=l===`identity`,_e;e[50]===p?_e=e[51]:(_e=()=>{c(!1),p&&(m(!1),f(!0))},e[50]=p,e[51]=_e);let ve;e[52]!==s||e[53]!==ge||e[54]!==_e?(ve=(0,Y.jsx)(Yf,{open:s,onOpenChange:he,identityPrompt:ge,onSuccess:_e}),e[52]=s,e[53]=ge,e[54]=_e,e[55]=ve):ve=e[55];let ye;e[56]===Symbol.for(`react.memo_cache_sentinel`)?(ye=()=>{f(!1),u(`auth`),m(!0),c(!0)},e[56]=ye):ye=e[56];let be;e[57]===d?be=e[58]:(be=(0,Y.jsx)(ep,{open:d,onOpenChange:f,onSignIn:ye}),e[57]=d,e[58]=be);let xe;return e[59]!==ue||e[60]!==de||e[61]!==pe||e[62]!==me||e[63]!==ve||e[64]!==be?(xe=(0,Y.jsxs)(Y.Fragment,{children:[q,ue,de,pe,me,ve,be]}),e[59]=ue,e[60]=de,e[61]=pe,e[62]=me,e[63]=ve,e[64]=be,e[65]=xe):xe=e[65],xe}var NS=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
24
24
  <symbol id="file-tree-icon-chevron" viewBox="0 0 16 16">
25
25
  <path d="M3.47 5.47a.75.75 0 0 1 1.06 0L8 8.94l3.47-3.47a.75.75 0 1 1 1.06 1.06l-4 4a.75.75 0 0 1-1.06 0l-4-4a.75.75 0 0 1 0-1.06" fill="currentcolor"/>
26
26
  </symbol>
@@ -37,68 +37,68 @@ For more information, see https://radix-ui.com/primitives/docs/components/alert-
37
37
  <symbol id="file-tree-icon-ellipsis" viewBox="0 0 16 16">
38
38
  <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" />
39
39
  </symbol>
40
- </svg>`,MS=`<symbol id="file-tree-builtin-astro" viewBox="0 0 16 16">
40
+ </svg>`,PS=`<symbol id="file-tree-builtin-astro" viewBox="0 0 16 16">
41
41
  <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"/>
42
42
  <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"/>
43
- </symbol>`,NS=`<symbol id="file-tree-builtin-babel" viewBox="0 0 16 16">
43
+ </symbol>`,FS=`<symbol id="file-tree-builtin-babel" viewBox="0 0 16 16">
44
44
  <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"/>
45
- </symbol>`,PS=`<symbol id="file-tree-builtin-bash" viewBox="0 0 16 16">
45
+ </symbol>`,IS=`<symbol id="file-tree-builtin-bash" viewBox="0 0 16 16">
46
46
  <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"/>
47
47
  <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"/>
48
- </symbol>`,FS=`<symbol id="file-tree-builtin-biome" viewBox="0 0 16 16">
48
+ </symbol>`,LS=`<symbol id="file-tree-builtin-biome" viewBox="0 0 16 16">
49
49
  <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"/>
50
- </symbol>`,IS=`<symbol id="file-tree-builtin-bootstrap" viewBox="0 0 16 16">
50
+ </symbol>`,RS=`<symbol id="file-tree-builtin-bootstrap" viewBox="0 0 16 16">
51
51
  <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"/>
52
52
  <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"/>
53
- </symbol>`,LS=`<symbol id="file-tree-builtin-browserslist" viewBox="0 0 16 16">
53
+ </symbol>`,zS=`<symbol id="file-tree-builtin-browserslist" viewBox="0 0 16 16">
54
54
  <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"/>
55
55
  <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"/>
56
56
  <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"/>
57
- </symbol>`,RS=`<symbol id="file-tree-builtin-bun" viewBox="0 0 16 16">
57
+ </symbol>`,BS=`<symbol id="file-tree-builtin-bun" viewBox="0 0 16 16">
58
58
  <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"/>
59
- </symbol>`,zS=`<symbol id="file-tree-builtin-claude" viewBox="0 0 16 16">
59
+ </symbol>`,VS=`<symbol id="file-tree-builtin-claude" viewBox="0 0 16 16">
60
60
  <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"/>
61
- </symbol>`,BS=`<symbol id="file-tree-builtin-css" viewBox="0 0 16 16">
61
+ </symbol>`,HS=`<symbol id="file-tree-builtin-css" viewBox="0 0 16 16">
62
62
  <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"/>
63
63
  <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"/>
64
- </symbol>`,VS=`<symbol id="file-tree-builtin-database" viewBox="0 0 16 16">
64
+ </symbol>`,US=`<symbol id="file-tree-builtin-database" viewBox="0 0 16 16">
65
65
  <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"/>
66
66
  <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"/>
67
67
  <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"/>
68
- </symbol>`,HS=`<symbol id="file-tree-builtin-default" viewBox="0 0 16 16">
68
+ </symbol>`,WS=`<symbol id="file-tree-builtin-default" viewBox="0 0 16 16">
69
69
  <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"/>
70
70
  <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"/>
71
- </symbol>`,US=`<symbol id="file-tree-builtin-docker" viewBox="0 0 16 16">
71
+ </symbol>`,GS=`<symbol id="file-tree-builtin-docker" viewBox="0 0 16 16">
72
72
  <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"/>
73
73
  <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"/>
74
- </symbol>`,WS=`<symbol id="file-tree-builtin-eslint" viewBox="0 0 16 16">
74
+ </symbol>`,KS=`<symbol id="file-tree-builtin-eslint" viewBox="0 0 16 16">
75
75
  <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"/>
76
76
  <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"/>
77
- </symbol>`,GS=`<symbol id="file-tree-builtin-font" viewBox="0 0 16 16">
77
+ </symbol>`,qS=`<symbol id="file-tree-builtin-font" viewBox="0 0 16 16">
78
78
  <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"/>
79
- </symbol>`,KS=`<symbol id="file-tree-builtin-git" viewBox="0 0 16 16">
79
+ </symbol>`,JS=`<symbol id="file-tree-builtin-git" viewBox="0 0 16 16">
80
80
  <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"/>
81
- </symbol>`,qS=`<symbol id="file-tree-builtin-go" viewBox="0 0 16 16">
81
+ </symbol>`,YS=`<symbol id="file-tree-builtin-go" viewBox="0 0 16 16">
82
82
  <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"/>
83
- </symbol>`,JS=`<symbol id="file-tree-builtin-graphql" viewBox="0 0 16 16">
83
+ </symbol>`,XS=`<symbol id="file-tree-builtin-graphql" viewBox="0 0 16 16">
84
84
  <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"/>
85
- </symbol>`,YS=`<symbol id="file-tree-builtin-html" viewBox="0 0 16 16">
85
+ </symbol>`,ZS=`<symbol id="file-tree-builtin-html" viewBox="0 0 16 16">
86
86
  <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"/>
87
87
  <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"/>
88
- </symbol>`,XS=`<symbol id="file-tree-builtin-image" viewBox="0 0 16 16">
88
+ </symbol>`,QS=`<symbol id="file-tree-builtin-image" viewBox="0 0 16 16">
89
89
  <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"/>
90
90
  <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"/>
91
- </symbol>`,ZS=`<symbol id="file-tree-builtin-javascript" viewBox="0 0 16 16">
91
+ </symbol>`,$S=`<symbol id="file-tree-builtin-javascript" viewBox="0 0 16 16">
92
92
  <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"/>
93
93
  <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"/>
94
- </symbol>`,QS=`<symbol id="file-tree-builtin-json" viewBox="0 0 16 16">
94
+ </symbol>`,eC=`<symbol id="file-tree-builtin-json" viewBox="0 0 16 16">
95
95
  <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"/>
96
- </symbol>`,$S=`<symbol id="file-tree-builtin-markdown" viewBox="0 0 16 16">
96
+ </symbol>`,tC=`<symbol id="file-tree-builtin-markdown" viewBox="0 0 16 16">
97
97
  <path fill="currentColor" d="M1 12V4h2l2 2.5L7 4h2v8H7V7.5l-2 2-2-2V12zm9-3 3 3.5L16 9h-2V4h-2v5z"/>
98
- </symbol>`,eC=`<symbol id="file-tree-builtin-mcp" viewBox="0 0 16 16">
98
+ </symbol>`,nC=`<symbol id="file-tree-builtin-mcp" viewBox="0 0 16 16">
99
99
  <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"/>
100
100
  <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"/>
101
- </symbol>`,tC=`<symbol id="file-tree-builtin-nextjs" viewBox="0 0 16 16">
101
+ </symbol>`,rC=`<symbol id="file-tree-builtin-nextjs" viewBox="0 0 16 16">
102
102
  <defs>
103
103
  <linearGradient id="a" x1="4.522" x2="14" y1="3.943" y2="16" gradientUnits="userSpaceOnUse">
104
104
  <stop stop-color="currentColor"/>
@@ -108,82 +108,82 @@ For more information, see https://radix-ui.com/primitives/docs/components/alert-
108
108
  <path fill="currentColor" d="M3 2h1.522v9.09H3z"/>
109
109
  <path fill="url(#a)" d="M4.903 2 15 15.075q-.565.5-1.195.925L4.522 3.943z"/>
110
110
  <path fill="currentColor" d="M12.172 2h-1.508v9.094h1.508z"/>
111
- </symbol>`,nC=`<symbol id="file-tree-builtin-npm" viewBox="0 0 16 16">
111
+ </symbol>`,iC=`<symbol id="file-tree-builtin-npm" viewBox="0 0 16 16">
112
112
  <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"/>
113
113
  <path fill="currentColor" d="M10.5 13H13V3H3v10h5V5.5h2.5z"/>
114
- </symbol>`,rC=`<symbol id="file-tree-builtin-oxc" viewBox="0 0 16 16">
114
+ </symbol>`,aC=`<symbol id="file-tree-builtin-oxc" viewBox="0 0 16 16">
115
115
  <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"/>
116
- </symbol>`,iC=`<symbol id="file-tree-builtin-postcss" viewBox="0 0 16 16">
116
+ </symbol>`,oC=`<symbol id="file-tree-builtin-postcss" viewBox="0 0 16 16">
117
117
  <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"/>
118
- </symbol>`,aC=`<symbol id="file-tree-builtin-prettier" viewBox="0 0 16 16">
118
+ </symbol>`,sC=`<symbol id="file-tree-builtin-prettier" viewBox="0 0 16 16">
119
119
  <path fill="currentColor" d="M6 12v1H4.93v-1zm1-2v1H2v-1zm6-4v1h-3V6zm-1-4v1H9V2z"/>
120
120
  <path fill="currentColor" d="M11.5 10v1H8v-1zM5 6v1H2V6zm5-2v1H9V4z" opacity=".8"/>
121
121
  <path fill="currentColor" d="M6 14v1H2v-1zm-.5-6v1H2V8zM13 4v1h-3V4zM4.93 2v1H2V2z" opacity=".6"/>
122
122
  <path fill="currentColor" d="M4.93 12v1H2v-1zM13 8v1H9V8zM5.5 4v1H2V4zM9 2v1H4.93V2z" opacity=".4"/>
123
- </symbol>`,oC=`<symbol id="file-tree-builtin-python" viewBox="0 0 16 16">
123
+ </symbol>`,cC=`<symbol id="file-tree-builtin-python" viewBox="0 0 16 16">
124
124
  <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"/>
125
125
  <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"/>
126
- </symbol>`,sC=`<symbol id="file-tree-builtin-react" viewBox="0 0 16 16">
126
+ </symbol>`,lC=`<symbol id="file-tree-builtin-react" viewBox="0 0 16 16">
127
127
  <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"/>
128
128
  <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"/>
129
- </symbol>`,cC=`<symbol id="file-tree-builtin-ruby" viewBox="0 0 16 16">
129
+ </symbol>`,uC=`<symbol id="file-tree-builtin-ruby" viewBox="0 0 16 16">
130
130
  <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"/>
131
- </symbol>`,lC=`<symbol id="file-tree-builtin-rust" viewBox="0 0 16 16">
131
+ </symbol>`,dC=`<symbol id="file-tree-builtin-rust" viewBox="0 0 16 16">
132
132
  <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"/>
133
- </symbol>`,uC=`<symbol id="file-tree-builtin-sass" viewBox="0 0 16 16">
133
+ </symbol>`,fC=`<symbol id="file-tree-builtin-sass" viewBox="0 0 16 16">
134
134
  <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"/>
135
- </symbol>`,dC=`<symbol id="file-tree-builtin-stylelint" viewBox="0 0 16 16">
135
+ </symbol>`,pC=`<symbol id="file-tree-builtin-stylelint" viewBox="0 0 16 16">
136
136
  <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"/>
137
137
  <path fill="currentColor" d="M6.5 2.5V4l-2 1.5v-4zm5 3L9.5 4V2.5l2-1zM9 4H7V2.5h2z"/>
138
- </symbol>`,fC=`<symbol id="file-tree-builtin-svelte" viewBox="0 0 16 16">
138
+ </symbol>`,mC=`<symbol id="file-tree-builtin-svelte" viewBox="0 0 16 16">
139
139
  <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"/>
140
- </symbol>`,pC=`<symbol id="file-tree-builtin-svg" viewBox="0 0 16 16">
140
+ </symbol>`,hC=`<symbol id="file-tree-builtin-svg" viewBox="0 0 16 16">
141
141
  <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"/>
142
142
  <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"/>
143
- </symbol>`,mC=`<symbol id="file-tree-builtin-svgo" viewBox="0 0 16 16">
143
+ </symbol>`,gC=`<symbol id="file-tree-builtin-svgo" viewBox="0 0 16 16">
144
144
  <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"/>
145
145
  <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"/>
146
- </symbol>`,hC=`<symbol id="file-tree-builtin-swift" viewBox="0 0 16 16">
146
+ </symbol>`,_C=`<symbol id="file-tree-builtin-swift" viewBox="0 0 16 16">
147
147
  <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"/>
148
- </symbol>`,gC=`<symbol id="file-tree-builtin-table" viewBox="0 0 16 16">
148
+ </symbol>`,vC=`<symbol id="file-tree-builtin-table" viewBox="0 0 16 16">
149
149
  <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"/>
150
150
  <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"/>
151
- </symbol>`,_C=`<symbol id="file-tree-builtin-tailwind" viewBox="0 0 16 16">
151
+ </symbol>`,yC=`<symbol id="file-tree-builtin-tailwind" viewBox="0 0 16 16">
152
152
  <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"/>
153
- </symbol>`,vC=`<symbol id="file-tree-builtin-terraform" viewBox="0 0 16 16">
153
+ </symbol>`,bC=`<symbol id="file-tree-builtin-terraform" viewBox="0 0 16 16">
154
154
  <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"/>
155
- </symbol>`,yC=`<symbol id="file-tree-builtin-text" viewBox="0 0 16 16">
155
+ </symbol>`,xC=`<symbol id="file-tree-builtin-text" viewBox="0 0 16 16">
156
156
  <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"/>
157
157
  <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"/>
158
- </symbol>`,bC=`<symbol id="file-tree-builtin-typescript" viewBox="0 0 16 16">
158
+ </symbol>`,SC=`<symbol id="file-tree-builtin-typescript" viewBox="0 0 16 16">
159
159
  <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"/>
160
160
  <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"/>
161
- </symbol>`,xC=`<symbol id="file-tree-builtin-vite" viewBox="0 0 16 16">
161
+ </symbol>`,CC=`<symbol id="file-tree-builtin-vite" viewBox="0 0 16 16">
162
162
  <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"/>
163
- </symbol>`,SC=`<symbol id="file-tree-builtin-vscode" viewBox="0 0 16 16">
163
+ </symbol>`,wC=`<symbol id="file-tree-builtin-vscode" viewBox="0 0 16 16">
164
164
  <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"/>
165
165
  <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"/>
166
166
  <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"/>
167
- </symbol>`,CC=`<symbol id="file-tree-builtin-vue" viewBox="0 0 16 16">
167
+ </symbol>`,TC=`<symbol id="file-tree-builtin-vue" viewBox="0 0 16 16">
168
168
  <path fill="currentColor" d="M9.62 2.25 8 5.02 6.38 2.25H1l7 12 7-12z" opacity=".5"/>
169
169
  <path fill="currentColor" d="M9.54 2.25 8 4.95l-1.54-2.7H4l4 7 4-7z"/>
170
- </symbol>`,wC=`<symbol id="file-tree-builtin-wasm" viewBox="0 0 16 16">
170
+ </symbol>`,EC=`<symbol id="file-tree-builtin-wasm" viewBox="0 0 16 16">
171
171
  <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"/>
172
172
  <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"/>
173
173
  <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"/>
174
- </symbol>`,TC=`<symbol id="file-tree-builtin-webpack" viewBox="0 0 16 16">
174
+ </symbol>`,DC=`<symbol id="file-tree-builtin-webpack" viewBox="0 0 16 16">
175
175
  <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"/>
176
176
  <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"/>
177
- </symbol>`,EC=`<symbol id="file-tree-builtin-yml" viewBox="0 0 16 16">
177
+ </symbol>`,OC=`<symbol id="file-tree-builtin-yml" viewBox="0 0 16 16">
178
178
  <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"/>
179
- </symbol>`,DC=`<symbol id="file-tree-builtin-zig" viewBox="0 0 16 16">
179
+ </symbol>`,kC=`<symbol id="file-tree-builtin-zig" viewBox="0 0 16 16">
180
180
  <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"/>
181
181
  <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"/>
182
- </symbol>`,OC=[PS,BS,VS,HS,GS,KS,qS,YS,XS,ZS,QS,$S,eC,oC,cC,lC,hC,gC,yC,bC,`<symbol id="file-tree-builtin-zip" viewBox="0 0 16 16">
182
+ </symbol>`,AC=[IS,HS,US,WS,qS,JS,YS,ZS,QS,$S,eC,tC,nC,cC,uC,dC,_C,vC,xC,SC,`<symbol id="file-tree-builtin-zip" viewBox="0 0 16 16">
183
183
  <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"/>
184
184
  <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"/>
185
- </symbol>`],kC=[MS,NS,FS,IS,LS,RS,zS,US,WS,JS,tC,nC,rC,iC,aC,sC,uC,dC,fC,pC,mC,_C,vC,xC,SC,CC,wC,TC,EC,DC];function AC(e,t){return t.length===0?e:e.replace(`</svg>`,`\n ${t.join(`
186
- `)}\n</svg>`)}var jC=AC(jS,OC),MC={minimal:jS,standard:jC,complete:AC(jC,kC)},NC={".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`},PC={"7z":`zip`,astro:`astro`,AUTHORS:`text`,avif:`image`,bash:`bash`,bmp:`image`,bz2:`zip`,cfg:`text`,CHANGELOG:`text`,cjs:`javascript`,"code-workspace":`vscode`,conf:`text`,CONTRIBUTORS:`text`,csh:`bash`,css:`css`,csv:`table`,cts:`typescript`,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`,htm:`html`,html:`html`,icns:`image`,ico:`image`,ini:`text`,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`,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`},FC={jsx:`react`,sass:`sass`,scss:`sass`,tsx:`react`},IC=new Set([`bash`,`css`,`database`,`default`,`font`,`git`,`go`,`html`,`image`,`javascript`,`json`,`markdown`,`mcp`,`python`,`ruby`,`rust`,`swift`,`table`,`text`,`typescript`,`zip`]),LC=new Set([`complete`]);function RC(e){return MC[e===`none`?`minimal`:e]}function zC(e){return`file-tree-builtin-${e}`}function BC(e){return e!==`none`&&LC.has(e)}function VC(e,t,n){if(e===`minimal`||e===`none`)return;let r=e===`complete`,i=NC[t.toLowerCase()];if(i!=null&&(r||IC.has(i)))return i;for(let e of n){if(r){let t=FC[e];if(t!=null)return t}let t=PC[e];if(t!=null&&(r||IC.has(t)))return t}return`default`}var HC=`file-tree-container`,UC=`data-file-tree-style`,WC=`data-file-tree-unsafe-css`,GC=`data-file-tree-scrollbar-measure`,KC=`data-file-tree-scrollbar-gutter-measured`,qC=`--trees-scrollbar-gutter-measured`,JC=`header`,YC=`context-menu`,XC=`context-menu-trigger`;function ZC(e){return e.spriteSheet!=null||e.remap!=null||e.byFileName!=null||e.byFileExtension!=null||e.byFileNameContains!=null}function QC(e){return e==null?{set:`complete`,colored:!0}:typeof e==`string`?{set:e,colored:!0}:{...e,set:e.set??(ZC(e)?`none`:`complete`),colored:e.colored??!0}}var $C=e=>e.trim().toLowerCase(),ew=e=>e.split(`/`).at(-1)??e,tw=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 nw(e,t){return typeof e==`string`?{name:e,remappedFrom:t}:{...e,remappedFrom:t}}function rw(e){let t=QC(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($C(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=ew(o),s=n.toLowerCase(),c=r.get(s);if(c!=null)return nw(c,e);for(let[t,n]of a)if(s.includes(t))return nw(n,e);let l=tw(n);for(let t of l){let n=i.get(t);if(n!=null)return nw(n,e)}let u=VC(t.set,n,l);if(u!=null&&t.set!==`none`)return{name:zC(u),remappedFrom:e,token:u}}let s=n?.[e];return s==null?{name:e}:nw(s,e)}}}var iw=/^#(?:[0-9a-f]{3}0|[0-9a-f]{6}00)$/i,aw=/^0(?:\.0+)?%?$/;function ow(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 sw(e){if(e==null)return!1;let t=e.trim().toLowerCase();if(t===`transparent`||iw.test(t))return!0;let n=ow(t);return n!=null&&aw.test(n)}function cw(e){return sw(e)?void 0:e}function lw(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=cw(t[`list.focusOutline`])??cw(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 uw=5,dw=1<<uw,fw=dw*4;function pw(){return{childIdByNameId:new Map,childIds:[],childPositionById:new Map,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function mw(){return{childIdByNameId:null,childIds:[],childPositionById:null,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function hw(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 gw(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 _w(e,t){e.childPositionById!=null&&e.childPositionById.set(t,e.childIds.length),e.childIds.push(t)}function vw(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 yw(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,Cw(e,t)}function bw(e,t,n,r){if(e.totalChildSubtreeNodeCount+=n,e.totalChildVisibleSubtreeCount+=r,e.childVisibleChunkSums==null||r===0)return;let i=gw(e).get(t);if(i===void 0)return;let a=i>>uw;e.childVisibleChunkSums[a]+=r}function xw(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=ww(e,t,a,i);return{...r,childVisibleIndex:n-r.localVisibleIndex}}i-=o,a+=dw}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 Sw(e,t,n){let r=0,i=t.childVisibleChunkSums,a=0;if(i!=null){let e=n>>uw;for(let t=0;t<e;t+=1)r+=i[t]??0;a=e<<uw}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 Cw(e,t){if(t.childIds.length<fw){t.childVisibleChunkSums=null;return}let n=Math.ceil(t.childIds.length/dw),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>>uw]+=a.visibleSubtreeCount)}t.childVisibleChunkSums=r}function ww(e,t,n,r){let i=Math.min(t.childIds.length,n+dw),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 Tw=7,Ew=3,Dw=1<<Ew,Ow=4;function kw(e,t,n=0){return e<<Ow|n<<Ew|t}function Aw(e){return e.depthAndFlags>>>Ow}function jw(e){return(e.depthAndFlags&Dw)>>Ew}function Mw(e){return(e.depthAndFlags&Dw)!==0}function Nw(e){return e.depthAndFlags&Tw}function Pw(e,t){return(Nw(e)&t)!==0}function Fw(e,t){e.depthAndFlags|=t}function Iw(e,t){e.depthAndFlags=kw(t,Nw(e),jw(e))}var Lw=Symbol(`benchmarkInstrumentation`);function Rw(e,t){return t==null||Object.defineProperty(e,Lw,{configurable:!0,enumerable:!1,value:t,writable:!1}),e}function zw(e){return e==null?null:e[Lw]??null}function Q(e,t,n){return e==null?n():e.measurePhase(t,n)}function Bw(e,t,n){!Number.isFinite(n)||e==null||e.setCounter(t,n)}function Vw(e){return e>=48&&e<=57}function Hw(e){let t=[],n=0,r=0;for(;r<e.length;){for(;r<e.length&&!Vw(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&&Vw(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 Uw(e){let t=e.toLowerCase();return{lowerValue:t,tokens:Hw(t)}}function Ww(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 Gw(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=Ww(e.tokens,t.tokens);return n===0?e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1:n}function Kw(e,t,n){let r=Gw(n(e),n(t));return r===0?e===t?0:e<t?-1:1:r}function qw(e,t){return Kw(e,t,Uw)}function Jw(e,t){return t===e.segments.length-1?+!!e.isDirectory:1}function Yw(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=Jw(e,r);return a===Jw(t,r)?qw(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 Xw(e,t){return Yw(e,t)}function Zw(e,t,n){let r=e=>{let t=n.get(e);if(t!=null)return t;let r=Uw(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=Jw(e,n);return o===Jw(t,n)?Kw(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 Qw(e,t){let n=e.sortKeyById[t];if(n!==void 0)return n;let r=e.valueById[t],i=Uw(r);return e.sortKeyById[t]=i,i}function $w(e={}){return{flattenEmptyDirectories:e.flattenEmptyDirectories!==!1,sort:e.sort??`default`}}function eT(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 tT(e){let{hasTrailingSlash:t,segments:n}=eT(e);return{basename:n[n.length-1]??``,isDirectory:t,path:e,segments:n}}function nT(e){if(e.length===0)return{requiresDirectory:!1,segments:[]};let{hasTrailingSlash:t,segments:n}=eT(e);return{requiresDirectory:t,segments:n}}var rT=``;function iT(){let e=new Map;return e.set(rT,0),{idByValue:e,valueById:[rT],sortKeyById:[Uw(rT)]}}function aT(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 oT(e,t){let n=e.valueById[t];if(n===void 0)throw Error(`Unknown segment ID: ${String(t)}`);return n}var sT=Symbol(`pathStorePreparedInputKind`);function cT(e,t){return e[sT]=t,e}function lT(e){return{basename:e.basename,depth:e.segments.length,isDirectory:e.isDirectory,path:e.path,segments:e.segments}}function uT(e,t,n){return n===`default`?Xw(e,t):n(lT(e),lT(t))}function dT(){return{depthAndFlags:kw(0,3,1),nameId:0,parentId:0,subtreeNodeCount:1,visibleSubtreeCount:1}}function fT(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 pT(e){return e.isDirectory?e.segments.length:e.segments.length-1}function mT(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 hT(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function gT(e,t={}){return ST(e,t).map(e=>e.path)}function _T(e,t={}){let n=ST(e,t);return cT({paths:n.map(e=>e.path),preparedPaths:n},`prepared`)}function vT(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 cT({paths:e,presortedPaths:e,presortedPathsContainDirectories:n},`presorted`)}function yT(e){let t=e,n=t.preparedPaths;if(t[sT]===`prepared`&&n!=null)return n;if(!mT(n))throw Error(`preparedInput must come from PathStore.prepareInput()`);return n}function bT(e){let t=e;return t[sT]===`presorted`&&t.presortedPaths!=null||hT(t.presortedPaths)?t.presortedPaths:null}function xT(e){let t=e;return typeof t.presortedPathsContainDirectories==`boolean`?t.presortedPathsContainDirectories:null}function ST(e,t={}){let n=$w(t),r=zw(t);Bw(r,`workload.inputFiles`,e.length);let i=Q(r,`store.preparePathEntries.parse`,()=>e.map(e=>tT(e)));return Q(r,`store.preparePathEntries.sort`,()=>i.sort((e,t)=>uT(e,t,n.sort))),i}var CT=class{directories=new Map;directoryStack=[0];presortedDirectoryNodeIds=[];initialExpandedPathSet;createdDirectoriesAllExpanded=!1;createdDirectoryCount=0;lastPreparedPath=null;nodes=[dT()];options;instrumentation;segmentSortKeyCache=new Map;segmentTable=iT();hasDeferredDirectoryIndexes=!1;constructor(e={}){this.instrumentation=zw(e),this.options=$w(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,pw())}appendPaths(e){return Q(this.instrumentation,`store.builder.appendPaths.parse`,()=>this.appendPreparedPaths(e.map(e=>tT(e))))}appendPreparedPaths(e,t=!0){return this.createdDirectoriesAllExpanded=!1,Q(this.instrumentation,`store.builder.appendPreparedPaths`,()=>{for(let n of e)this.appendPreparedPath(n,t)}),this}appendPresortedPaths(e,t=null){return Q(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:kw(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:kw(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:kw(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=tT(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:kw(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:kw(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=tT(t)),this.hasDeferredDirectoryIndexes=!0}finish(e={}){let t=e.skipSubtreeCountPass===!0;return this.hasDeferredDirectoryIndexes?(Q(this.instrumentation,`store.builder.buildDirectoryIndexes`,()=>this.buildPresortedFinish(t)),this.hasDeferredDirectoryIndexes=!1):t||Q(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`?Zw(this.lastPreparedPath,e,this.segmentSortKeyCache):uT(this.lastPreparedPath,e,this.options.sort))>0)throw Error(`Builder input must be sorted before appendPaths(): "${e.path}"`)}let n=this.lastPreparedPath,r=pT(e),i=n==null?0:pT(n),a=n==null?0:fT(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=aT(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:kw(Aw(o)+1,0),nameId:r,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),a?.set(r,s),_w(i,s),s}createFileChildUnchecked(e,t){let n=aT(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:kw(Aw(i)+1,0),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),_w(r,a),a}getOrCreateDirectoryChild(e,t){let n=aT(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&&!Mw(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:kw(Aw(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),_w(r,a),this.directories.set(a,pw()),a}createDirectoryChild(e,t){let n=aT(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:kw(Aw(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),_w(r,a),this.directories.set(a,pw()),a}promoteDirectoryToExplicit(e,t){let n=this.nodes[e];if(n===void 0)throw Error(`Unknown directory node ID: ${String(e)}`);if(!Mw(n))throw Error(`Path is not a directory: "${t}"`);if(Pw(n,1))throw Error(`Duplicate path: "${t}"`);Fw(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,mw());let r=-1,i=null;for(let e=1;e<t.length;e++){let a=t[e];if(a==null)continue;if(Mw(a)){let t=mw();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;Mw(n)&&this.directories.set(t,pw());let r=this.directories.get(n.parentId);r!=null&&(r.childIdByNameId!=null&&r.childIdByNameId.set(n.nameId,t),_w(r,t))}}computeSubtreeCounts(e){let t=this.nodes[e];if(t===void 0)throw Error(`Unknown node ID: ${String(e)}`);if(!Mw(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 yw(this.nodes,n),t.subtreeNodeCount=r,t.visibleSubtreeCount=r,r}};function wT(e,t=`closed`,n=null){let r=ET(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 TT(){return{affectedAncestorIds:new Set,affectedNodeIds:new Set,events:[]}}function ET(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 DT(e,t){return Pw(t,2)||e.defaultExpansion===`open`?!0:e.defaultExpansion===`closed`?!1:Aw(t)<=e.defaultExpansion}function OT(e,t,n=e.snapshot.nodes[t]){return n==null||!Mw(n)?!1:e.directoriesOpenByDefault&&!e.hasCollapsedDirectoryOverrides?!0:e.collapsedDirectoryIds.has(t)?!1:e.expandedDirectoryIds.has(t)?!0:DT(e,n)}function kT(e,t,n,r=e.snapshot.nodes[t]){if(r==null||!Mw(r))return;let i=DT(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 AT(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 jT(e,t){return e.directoryLoadInfoById.get(t)?.state??`loaded`}function MT(e,t){let n=AT(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 NT(e,t){let n=AT(e,t);n.activeAttemptId=null,n.errorMessage=null,n.state=`unloaded`}function PT(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 FT(e,t,n){return e.directoryLoadInfoById.get(t)?.activeAttemptId===n}function IT(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 LT(e,t){e.directoryLoadInfoById.delete(t)}function RT(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 zT(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`add`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function BT(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`remove`,path:e.path,projectionChanged:e.projectionChanged,recursive:e.recursive,visibleCountDelta:null}}function VT(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,from:e.from,operation:`move`,projectionChanged:e.projectionChanged,to:e.to,visibleCountDelta:null}}function HT(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`expand`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function UT(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`collapse`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function WT(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`mark-directory-unloaded`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function GT(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 KT(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 qT(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 JT(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 YT(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 XT(e,t,n){return{...n,visibleCountDelta:sE(e)-t}}function ZT(e,t){let n=sE(e),r=TT();e.transactionStack.push(r);try{t()}catch(t){throw eE(e,r,!1),t}eE(e,r,!0,sE(e)-n)}function QT(e,t){let n=e.instrumentation;if(n==null){$T(e,t);return}Q(n,`store.events.record`,()=>$T(e,t))}function $T(e,t){let n=e.transactionStack[e.transactionStack.length-1]??null;if(n==null){aE(e,t);return}n.events.push(t),iE(n,t)}function eE(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?rE(i,t):Q(n,`store.events.batch.merge`,()=>rE(i,t));return}let a=tE(t,r),o=e.instrumentation;if(o==null){aE(e,a);return}Q(o,`store.events.batch.commit`,()=>aE(e,a))}function tE(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 nE(e,t){for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n);for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n)}function rE(e,t){for(let n of t.events)e.events.push(n);nE(e,t)}function iE(e,t){for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n);for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n)}function aE(e,t){let n=e.instrumentation;if(n==null){oE(e,t);return}Q(n,`store.events.emit`,()=>oE(e,t))}function oE(e,t){e.listeners.get(t.operation)?.forEach(e=>e(t)),e.listeners.get(`*`)?.forEach(e=>e(t))}function sE(e){return e.snapshot.nodes[e.snapshot.rootId]?.visibleSubtreeCount??0}function cE(e,t){if(e.snapshot.options.flattenEmptyDirectories!==!0)return null;let n=e.snapshot.nodes[t];if(n==null||!Mw(n)||Pw(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||!Mw(a)?null:i}function lE(e,t){let n=t;for(;;){let t=cE(e,n);if(t==null)return n;n=t}}function uE(e,t){let n=[t],r=t;for(;;){let t=cE(e,r);if(t==null)return n;n.push(t),r=t}}function dE(e,t){let n=t==null?e.snapshot.rootId:xE(e,t);return n==null?[]:TE(e,n)}function fE(e,t){let n=tT(t),r=n.isDirectory?n.segments:n.segments.slice(0,-1),i=BE(e,zE(e,r)),{createdNodeIds:a,directoryId:o}=EE(e,r),s=new Set(a),c=o;if(n.isDirectory){let n=wE(e,o);if(Pw(n,1))throw Error(`Path already exists: "${t}"`);Fw(n,1),e.pathCacheByNodeId.set(o,{path:t,version:e.pathCacheVersion}),s.add(o)}else c=OE(e,o,n.basename),s.add(c);vE(e,o);let l=BE(e,o);return zT({affectedAncestorIds:bE(e,c),affectedNodeIds:[...s],path:t,projectionChanged:VE(i,l)})}function pE(e,t,n){let r=xE(e,t);if(r==null)throw Error(`Path does not exist: "${t}"`);let i=wE(e,r);if(Pw(i,2))throw Error(`The root node cannot be removed`);if(Mw(i)&&CE(e,r).childIds.length>0&&n.recursive!==!0)throw Error(`Cannot remove a non-empty directory without recursive: "${t}"`);let a=i.parentId,o=BE(e,a),s=LE(e,r);jE(e,a,r,i.nameId),RE(e,a),vE(e,a);let c=BE(e,a);return BT({affectedAncestorIds:bE(e,a),affectedNodeIds:s,path:t,projectionChanged:VE(o,c),recursive:n.recursive===!0})}function mE(e,t,n,r){let i=xE(e,t);if(i==null)throw Error(`Source path does not exist: "${t}"`);let a=wE(e,i);if(Pw(a,2))throw Error(`The root node cannot be moved`);let o=r.collision??`error`,s=FE(e,i,n),c=BE(e,a.parentId),l=BE(e,s.parentId),u=oT(e.snapshot.segmentTable,a.nameId),d=aT(e.snapshot.segmentTable,s.basename);if(s.parentId===a.parentId&&u===s.basename)return null;if(Mw(a)&&GE(e,i,s.parentId))throw Error(`Cannot move a directory into one of its descendants`);let f=hw(e.snapshot.nodes,CE(e,s.parentId)).get(d),p=s.existingNodeId??f??null;if(p!=null&&p!==i&&IE(e,p,o,jw(a))===`skip`)return null;let m=a.parentId;jE(e,m,i,a.nameId),a.parentId=s.parentId,a.nameId=d,e.pathCacheByNodeId.delete(i),WE(e,i),AE(e,s.parentId,i),RE(e,m),e.pathCacheVersion++,vE(e,m),s.parentId!==m&&vE(e,s.parentId);let h=BE(e,m),g=BE(e,s.parentId);return VT({affectedAncestorIds:[...new Set([...bE(e,m),...bE(e,s.parentId)])],affectedNodeIds:[i],from:t,projectionChanged:HE([c,l],[h,g]),to:_E(e,i)})}function hE(e,t){let n=e.pathCacheByNodeId.get(t);return n!=null&&n.version===e.pathCacheVersion?n.path:null}function gE(e,t,n){return e.pathCacheByNodeId.set(t,{path:n,version:e.pathCacheVersion}),n}function _E(e,t){let n=wE(e,t),r=hE(e,t);if(r!=null)return r;if(Pw(n,2))return gE(e,t,``);let i=_E(e,n.parentId),a=oT(e.snapshot.segmentTable,n.nameId),o=i.length===0?a:`${i}${a}`;return gE(e,t,Mw(n)?`${o}/`:o)}function vE(e,t){let n=e.instrumentation;if(n==null){qE(e,t);return}Q(n,`store.recomputeCountsUpwardFrom`,()=>qE(e,t))}function yE(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||!Mw(o)){KE(e,a,o,!0),n.pop();continue}let s=i.get(a);if(s==null||t[1]>=s.childIds.length){KE(e,a,o,!0),n.pop();continue}let c=s.childIds[t[1]++];n.push([c,0])}}function bE(e,t){let n=[],r=t;for(;r!=null;){let t=wE(e,r);if(n.push(r),r===e.snapshot.rootId)break;r=t.parentId}return n}function xE(e,t){if(t.length===0)return e.snapshot.rootId;let n=nT(t);return SE(e,n.segments,n.requiresDirectory)}function SE(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=CE(e,r),a=hw(e.snapshot.nodes,i).get(t);if(a===void 0)return null;r=a}let i=wE(e,r);return n&&!Mw(i)?null:r}function CE(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 wE(e,t){let n=e.snapshot.nodes[t];if(n===void 0||Pw(n,4))throw Error(`Unknown node ID: ${String(t)}`);return n}function TE(e,t){let n=e.snapshot.nodes[t];if(n===void 0||Pw(n,4))return[];if(!Mw(n))return[_E(e,t)];if(CE(e,t).childIds.length===0)return Pw(n,1)&&!Pw(n,2)?[_E(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||Pw(n,4)){i.pop();continue}if(!Mw(n)){r.push(_E(e,t.nodeId)),i.pop();continue}let a=CE(e,t.nodeId);if(a.childIds.length===0){Pw(n,1)&&!Pw(n,2)&&r.push(_E(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 EE(e,t){let n=[],r=e.snapshot.rootId;for(let i of t){let t=aT(e.snapshot.segmentTable,i),a=CE(e,r),o=hw(e.snapshot.nodes,a).get(t);if(o!==void 0){if(!Mw(wE(e,o)))throw Error(`Cannot create a directory that collides with an existing file: "${i}"`);r=o;continue}r=DE(e,r,t),n.push(r)}return{createdNodeIds:n,directoryId:r}}function DE(e,t,n){let r=wE(e,t),i=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:kw(Aw(r)+1,0,1),nameId:n,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),e.snapshot.directories.set(i,pw()),AE(e,t,i),e.collapseNewDirectoriesByDefault&&(e.collapsedDirectoryIds.add(i),e.hasCollapsedDirectoryOverrides=!0),e.activeNodeCount++,i}function OE(e,t,n){let r=aT(e.snapshot.segmentTable,n),i=CE(e,t);if(hw(e.snapshot.nodes,i).has(r))throw Error(`Path already exists: "${YE(e,t,n)}"`);let a=wE(e,t),o=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:kw(Aw(a)+1,0),nameId:r,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),AE(e,t,o),e.activeNodeCount++,o}function kE(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}ME(e,n,o)<0?i=a:r=a+1}return r}function AE(e,t,n){let r=CE(e,t),i=wE(e,n);hw(e.snapshot.nodes,r).set(i.nameId,n),bw(r,n,i.subtreeNodeCount,i.visibleSubtreeCount);let a=kE(e,r,n);r.childIds.splice(a,0,n),vw(r,a),Cw(e.snapshot.nodes,r)}function jE(e,t,n,r){let i=CE(e,t),a=gw(i),o=a.get(n)??-1;hw(e.snapshot.nodes,i).delete(r),a.delete(n);let s=e.snapshot.nodes[n];s!=null&&bw(i,n,-s.subtreeNodeCount,-s.visibleSubtreeCount),o>=0&&(i.childIds.splice(o,1),vw(i,o),Cw(e.snapshot.nodes,i))}function ME(e,t,n){let r=e.snapshot.options.sort;return r===`default`?NE(e,t,n):r(PE(e,t),PE(e,n))}function NE(e,t,n){let r=wE(e,t),i=wE(e,n),a=Mw(r);if(a!==Mw(i))return a?-1:1;let o=Gw(Qw(e.snapshot.segmentTable,r.nameId),Qw(e.snapshot.segmentTable,i.nameId));if(o!==0)return o;let s=oT(e.snapshot.segmentTable,r.nameId),c=oT(e.snapshot.segmentTable,i.nameId);return s===c?t<n?-1:1:s<c?-1:1}function PE(e,t){let n=wE(e,t),r=_E(e,t),i=Mw(n),a=i?r.slice(0,-1):r;return{basename:oT(e.snapshot.segmentTable,n.nameId),depth:Aw(n),isDirectory:i,path:r,segments:a.length===0?[]:a.split(`/`)}}function FE(e,t,n){let r=wE(e,t),i=xE(e,n);if(i!=null){let t=wE(e,i);if(Mw(t))return{basename:oT(e.snapshot.segmentTable,r.nameId),existingNodeId:null,parentId:i};let a=nT(n).segments;return{basename:a[a.length-1]??``,existingNodeId:i,parentId:t.parentId}}let a=nT(n),o=a.segments[a.segments.length-1]??``,s=a.segments.slice(0,-1),c=s.length===0?e.snapshot.rootId:SE(e,s,!0);if(c==null)throw Error(`Destination parent does not exist: "${n}"`);return{basename:o,existingNodeId:null,parentId:c}}function IE(e,t,n,r){if(n===`skip`)return`skip`;if(n===`error`)throw Error(`Destination already exists: "${_E(e,t)}"`);let i=wE(e,t);if(jw(i)!==r)throw Error(`replace collision requires the same source and destination kinds`);if(Mw(i)&&CE(e,t).childIds.length>0)throw Error(`replace collision does not support non-empty directories`);let a=i.parentId,o=i.nameId;return LE(e,t),jE(e,a,t,o),RE(e,a),vE(e,a),`handled`}function LE(e,t){let n=[],r=[{nodeId:t,visitedChildren:!1}];for(;r.length>0;){let t=r.pop();if(t==null)break;let i=wE(e,t.nodeId);if(t.visitedChildren||!Mw(i)){Mw(i)&&e.snapshot.directories.delete(t.nodeId),Fw(i,4),e.pathCacheByNodeId.delete(t.nodeId),e.collapsedDirectoryIds.delete(t.nodeId)&&(e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0),e.expandedDirectoryIds.delete(t.nodeId),LT(e,t.nodeId),e.activeNodeCount--,n.push(t.nodeId);continue}r.push({nodeId:t.nodeId,visitedChildren:!0});let a=CE(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 RE(e,t){let n=t;for(;n!=null;){let t=wE(e,n);if(!Mw(t)||Pw(t,2)||CE(e,n).childIds.length>0)return;Fw(t,1),n=t.parentId===n?null:t.parentId}}function zE(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=hw(e.snapshot.nodes,CE(e,n)).get(t);if(i==null||!Mw(wE(e,i)))break;n=i}return n}function BE(e,t){let n=UE(e,t);if(n==null)return null;let r=lE(e,n),i=wE(e,r),a=n===r?null:uE(e,n).map(t=>_E(e,t));return JSON.stringify({flattenedSegmentPaths:a,hasChildren:CE(e,r).childIds.length>0,path:_E(e,r),terminalKind:jw(i)})}function VE(e,t){return HE([e],[t])}function HE(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 UE(e,t){let n=t;for(;n!=null;){let t=wE(e,n);if(!Mw(t)||Pw(t,2))return null;if(!OT(e,n,t))return n;n=t.parentId}return null}function WE(e,t){let n=wE(e,t);if(Iw(n,(t===e.snapshot.rootId?-1:Aw(wE(e,n.parentId)))+1),!Mw(n))return;let r=CE(e,t);for(let t of r.childIds)WE(e,t)}function GE(e,t,n){let r=n;for(;r!=null;){if(r===t)return!0;let n=wE(e,r);if(r===e.snapshot.rootId)return!1;r=n.parentId}return!1}function KE(e,t,n=wE(e,t),r=!1){let i=e.instrumentation;if(i==null){JE(e,t,n,r);return}Q(i,`store.recomputeNodeCounts`,()=>JE(e,t,n,r))}function qE(e,t){let n=t;for(;n!=null;){let t=wE(e,n),r=t.subtreeNodeCount,i=t.visibleSubtreeCount;if(KE(e,n,t),n===e.snapshot.rootId)return;let a=t.subtreeNodeCount-r,o=t.visibleSubtreeCount-i,s=t.parentId;(a!==0||o!==0)&&bw(CE(e,s),n,a,o),n=s}}function JE(e,t,n,r){if(!Mw(n)){n.subtreeNodeCount=1,n.visibleSubtreeCount=1;return}let i=CE(e,t);if(r){let t=e.instrumentation;t==null?yw(e.snapshot.nodes,i):Q(t,`store.recomputeNodeCounts.rebuildChildAggregates`,()=>yw(e.snapshot.nodes,i))}let a=1+i.totalChildSubtreeNodeCount,o=i.totalChildVisibleSubtreeCount;if(n.subtreeNodeCount=a,Pw(n,2)){n.visibleSubtreeCount=o;return}n.visibleSubtreeCount=cE(e,t)==null?OT(e,t,n)?1+o:1:o}function YE(e,t,n){let r=_E(e,t);return r.length===0?n:`${r}${n}`}function XE(e){return e!=null&&!Pw(e,4)}function ZE(e,t){let n=e.snapshot.nodes[t];return!XE(n)||!Mw(n)||Pw(n,2)?null:n}function QE(e){let t=0;for(let[n,r]of e.pathCacheByNodeId)r.version===e.pathCacheVersion&&XE(e.snapshot.nodes[n])&&(t+=1);return t}function $E(e){return Math.max(0,e.valueById.length-1)}function eD(e){return{activeNodeCount:e.activeNodeCount,cachedPathEntryCount:QE(e),loadInfoEntryCount:e.directoryLoadInfoById.size,segmentCount:$E(e.snapshot.segmentTable),totalNodeSlotCount:Math.max(0,e.snapshot.nodes.length-1)}}function tD(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 nD(e){let t=[],n=[];for(let n of e.collapsedDirectoryIds)ZE(e,n)!=null&&t.push(_E(e,n));for(let t of e.expandedDirectoryIds)ZE(e,t)!=null&&n.push(_E(e,t));return{collapsedPaths:t,expandedPaths:n}}function rD(e){let t=[];for(let[n,r]of e.directoryLoadInfoById)ZE(e,n)==null||jT(e,n)===`loaded`||t.push({info:{activeAttemptId:null,errorMessage:r.errorMessage,nextAttemptId:r.nextAttemptId,state:r.state},path:_E(e,n)});return t}function iD(e,t){e.collapsedDirectoryIds.clear(),e.hasCollapsedDirectoryOverrides=!1,e.expandedDirectoryIds.clear();for(let n of t.expandedPaths){let t=xE(e,n);t!=null&&kT(e,t,!0,wE(e,t))}for(let n of t.collapsedPaths){let t=xE(e,n);t!=null&&kT(e,t,!1,wE(e,t))}}function aD(e,t){e.directoryLoadInfoById.clear();for(let n of t){let t=xE(e,n.path);t!=null&&ZE(e,t)!=null&&e.directoryLoadInfoById.set(t,{activeAttemptId:null,errorMessage:n.info.errorMessage,nextAttemptId:n.info.nextAttemptId,state:n.info.state})}}function oD(e){e.pathCacheVersion+=1,e.pathCacheByNodeId.clear(),e.pathCacheByNodeId.set(e.snapshot.rootId,{path:``,version:e.pathCacheVersion})}function sD(e){let t=e.snapshot.segmentTable,n=iT();for(let r of e.snapshot.nodes)if(XE(r)){if(Pw(r,2)){r.nameId=0;continue}r.nameId=aT(n,oT(t,r.nameId))}e.snapshot.segmentTable=n}function cD(e){for(let[t,n]of e.snapshot.directories){let r=e.snapshot.nodes[t];if(!XE(r)||!Mw(r)){e.snapshot.directories.delete(t);continue}let i=n.childIds.filter(n=>{let r=e.snapshot.nodes[n];return XE(r)&&r.parentId===t});n.childIds=i,n.childIdByNameId=new Map(i.map(t=>[wE(e,t).nameId,t])),n.childPositionById=new Map(i.map((e,t)=>[e,t])),yw(e.snapshot.nodes,n)}}function lD(e){let t=e.snapshot.nodes.length-1;for(;t>e.snapshot.rootId;){let n=e.snapshot.nodes[t];if(XE(n))break;--t}e.snapshot.nodes.length=t+1}function uD(e){let t=nD(e),n=rD(e);Q(e.instrumentation,`store.cleanup.stable.clearPathCaches`,()=>oD(e)),Q(e.instrumentation,`store.cleanup.stable.rebuildSegmentTable`,()=>sD(e)),Q(e.instrumentation,`store.cleanup.stable.rebuildDirectoryIndexes`,()=>cD(e)),Q(e.instrumentation,`store.cleanup.stable.trimTrailingRemovedNodeSlots`,()=>lD(e)),Q(e.instrumentation,`store.cleanup.stable.restoreExpansionOverrides`,()=>iD(e,t)),Q(e.instrumentation,`store.cleanup.stable.restoreDirectoryLoadInfos`,()=>aD(e,n)),Q(e.instrumentation,`store.cleanup.stable.recomputeCounts`,()=>yE(e,e.snapshot.rootId))}function dD(e){let t=nD(e),n=rD(e),r=Q(e.instrumentation,`store.cleanup.aggressive.listPaths`,()=>dE(e)),i=Rw({...e.snapshot.options},e.instrumentation),a=Q(e.instrumentation,`store.cleanup.aggressive.rebuildSnapshot`,()=>{let e=new CT(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,Q(e.instrumentation,`store.cleanup.aggressive.restoreExpansionOverrides`,()=>iD(e,t)),Q(e.instrumentation,`store.cleanup.aggressive.restoreDirectoryLoadInfos`,()=>aD(e,n)),Q(e.instrumentation,`store.cleanup.aggressive.recomputeCounts`,()=>yE(e,e.snapshot.rootId))}function fD(e){for(let t of e.directoryLoadInfoById.values())if(t.state===`loading`&&t.activeAttemptId!=null)return!0;return!1}function pD(e,t){let n=eD(e);t===`stable`?Q(e.instrumentation,`store.cleanup.stable`,()=>uD(e)):Q(e.instrumentation,`store.cleanup.aggressive`,()=>dD(e));let r=eD(e);return tD(t,t===`stable`,n,r)}var mD=64;function hD(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 gD(e){return wE(e,e.snapshot.rootId).visibleSubtreeCount}function _D(e,t,n,r){let i=wE(e,t.terminalNodeId),a=Math.max(1,i.visibleSubtreeCount);return Math.min(r-1,n+a-1)}function vD(e,t,n,r){return{ancestorPaths:r,index:t.index,posInSet:t.posInSet,row:LD(e,t.cursor),setSize:t.setSize,subtreeEndIndex:_D(e,t.cursor,t.index,n)}}function yD(e,t,n,r,i,a){let o=CE(e,t),{childIndex:s,childVisibleIndex:c,localVisibleIndex:l}=xw(e.snapshot.nodes,o,n),u=o.childIds[s];if(u==null)throw Error(`Visible index ${String(n)} is out of range`);return bD(e,u,l,r+c,i+1,s,o.childIds.length,a)}function bD(e,t,n,r,i,a,o,s){if(!Mw(wE(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=jD(e,t,i);if(n===0)return{ancestors:s,cursor:c,index:r,posInSet:a,setSize:o};let l=wE(e,c.terminalNodeId);if(!Mw(l)||!OT(e,c.terminalNodeId,l))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return yD(e,c.terminalNodeId,n-1,r+1,c.visibleDepth,[...s,{cursor:c,index:r,posInSet:a,setSize:o}])}function xD(e,t){let n=gD(e);if(t<0||t>=n)return null;let r=yD(e,e.snapshot.rootId,t,0,-1,[]),i=r.ancestors.map(t=>_E(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=vD(e,a,n,[...i]);t.push(r),i.push(r.row.path)}return a=t,a},index:r.index,posInSet:r.posInSet,row:LD(e,r.cursor),setSize:r.setSize,subtreeEndIndex:_D(e,r.cursor,r.index,n)}}function SD(e,t,n){let r=e.instrumentation,i=gD(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 ID(e,o+1);let t=[],n=OD(e,a);for(let r=a;r<=o&&n!=null;r++){let r=LD(e,n);t.push(r),n=ND(e,n)}return t}let s=[],c=0,l=0,u=Q(r,`store.getVisibleSlice.selectFirstRow`,()=>OD(e,a));for(let t=a;t<=o&&u!=null;t++){let t=Q(r,`store.getVisibleSlice.materializeRow`,()=>LD(e,u));s.push(t),t.isFlattened&&(c++,l+=t.flattenedSegments?.length??0),u=Q(r,`store.getVisibleSlice.advanceCursor`,()=>ND(e,u))}return Bw(r,`workload.visibleRowsRead`,s.length),Bw(r,`workload.flattenedRowsRead`,c),Bw(r,`workload.flattenedSegmentsRead`,l),s}function CD(e,t=gD(e)){let n=e.instrumentation;return n==null?FD(e,t):Q(n,`store.getVisibleTreeProjection`,()=>FD(e,t))}function wD(e){return PD(CD(e))}function TD(e,t){let n=xE(e,t);if(n==null||n===e.snapshot.rootId||Mw(wE(e,n))&&lE(e,n)!==n)return null;let r=0,i=n,{nodes:a,rootId:o}=e.snapshot;for(;i!==o;){let t=wE(e,i).parentId,n=CE(e,t),s=gw(n).get(i);if(s==null)throw Error(`Child ${String(i)} was not found in its parent index`);if(r+=Sw(a,n,s),t!==o){let n=wE(e,t),a=cE(e,t);if(!OT(e,t,n)&&a!==i)return null;lE(e,t)===t&&(r+=1)}i=t}return r}function ED(e,t){let n=xE(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=wE(e,n);if(!Mw(r))throw Error(`Path is not a directory: "${t}"`);return OT(e,n,r)?null:(kT(e,n,!0,r),vE(e,n),HT({affectedAncestorIds:bE(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0}))}function DD(e,t){let n=xE(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=wE(e,n);if(!Mw(r))throw Error(`Path is not a directory: "${t}"`);return OT(e,n,r)?(kT(e,n,!1,r),vE(e,n),UT({affectedAncestorIds:bE(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0})):null}function OD(e,t){return t<0||t>=gD(e)?null:kD(e,e.snapshot.rootId,t,-1)}function kD(e,t,n,r){let i=CE(e,t),a=e.instrumentation,{childIndex:o,localVisibleIndex:s}=a==null?xw(e.snapshot.nodes,i,n):Q(a,`store.getVisibleSlice.selectChildIndex`,()=>xw(e.snapshot.nodes,i,n)),c=i.childIds[o];if(c!=null)return AD(e,c,s,r+1);throw Error(`Visible index ${String(n)} is out of range`)}function AD(e,t,n,r){if(!Mw(wE(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=jD(e,t,r);if(n===0)return i;let a=wE(e,i.terminalNodeId);if(!Mw(a)||!OT(e,i.terminalNodeId,a))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return kD(e,i.terminalNodeId,n-1,i.visibleDepth)}function jD(e,t,n){return Mw(wE(e,t))?e.instrumentation==null?{headNodeId:t,terminalNodeId:lE(e,t),visibleDepth:n}:{headNodeId:t,terminalNodeId:Q(e.instrumentation,`store.getVisibleSlice.flatten.resolveTerminalDirectory`,()=>lE(e,t)),visibleDepth:n}:{headNodeId:t,terminalNodeId:t,visibleDepth:n}}function MD(e,t){let n=wE(e,t);if(!Mw(n))return!0;let r=n.parentId;return r===e.snapshot.rootId?!0:cE(e,r)!==t}function ND(e,t){let n=wE(e,t.terminalNodeId);if(Mw(n)){let r=CE(e,t.terminalNodeId);if(OT(e,t.terminalNodeId,n)&&r.childIds.length>0){let n=r.childIds[0];return n==null?null:AD(e,n,0,t.visibleDepth+1)}}let r=t.terminalNodeId,i=t.visibleDepth;for(;;){let t=wE(e,r);if(r===e.snapshot.rootId)return null;let n=t.parentId,a=CE(e,n),o=gw(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 AD(e,s,0,i);MD(e,r)&&i--,r=n}}function PD(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 FD(e,t){let n=Array(t),r=new Int32Array(t),i=new Int32Array(t),a=new Int32Array(t),o=new Int32Array(mD);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=hD(o,y);let x,S=_;if(Mw(v))S=f?lE(e,_):_,x=S===_?`${b}${h[v.nameId]}/`:_E(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&&Mw(C)&&OT(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 ID(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(!Mw(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:_E(e,f)};continue}let h=l?lE(e,f):f,g={headNodeId:f,terminalNodeId:h,visibleDepth:m};n[r++]=LD(e,g);let _=i[h];_!=null&&Mw(_)&&OT(e,h,_)&&s.push([a.get(h),0,m])}return r<t&&(n.length=r),n}function LD(e,t){let n=wE(e,t.terminalNodeId),r=Mw(n)?RD(e,t):null,i=_E(e,t.terminalNodeId),a=oT(e.snapshot.segmentTable,n.nameId),o=Mw(n)&&CE(e,t.terminalNodeId).childIds.length>0,s=t.headNodeId!==t.terminalNodeId,c=e.instrumentation,l=s?c==null?uE(e,t.headNodeId).map(n=>{let r=wE(e,n);return{isTerminal:n===t.terminalNodeId,name:oT(e.snapshot.segmentTable,r.nameId),nodeId:n,path:_E(e,n)}}):Q(c,`store.getVisibleSlice.flatten.collectSegments`,()=>uE(e,t.headNodeId).map(n=>{let r=wE(e,n);return{isTerminal:n===t.terminalNodeId,name:oT(e.snapshot.segmentTable,r.nameId),nodeId:n,path:_E(e,n)}})):void 0;return{depth:t.visibleDepth,flattenedSegments:l,hasChildren:o,id:t.terminalNodeId,isExpanded:Mw(n)&&OT(e,t.terminalNodeId,n),isFlattened:s,isLoading:r===`loading`,kind:Mw(n)?`directory`:`file`,loadState:r==null||r===`loaded`?void 0:r,name:a,path:i}}function RD(e,t){if(t.headNodeId===t.terminalNodeId)return jT(e,t.terminalNodeId);let n=uE(e,t.headNodeId),r=!1,i=!1;for(let t of n){let n=jT(e,t);if(n===`loading`)return`loading`;if(n===`error`){i=!0;continue}n===`unloaded`&&(r=!0)}return i?`error`:r?`unloaded`:`loaded`}function zD(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||!Mw(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&&Cw(n,i),r.subtreeNodeCount=1+c;let u;if(o&&s===1){let e=n[a[0]];u=e!=null&&Mw(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,Cw(n,l),c.subtreeNodeCount=1+d,c.visibleSubtreeCount=f}function BD(e){return e.initialExpansion===`open`&&(e.initialExpandedPaths==null||e.initialExpandedPaths.length===0)}var VD=class e{#e;constructor(e={}){let t=zw(e),n=Q(t,`store.builder.create`,()=>new CT(e));if(e.preparedInput!=null){let t=bT(e.preparedInput);t==null?n.appendPreparedPaths(yT(e.preparedInput),!1):n.appendPresortedPaths(t,xT(e.preparedInput))}else{let r=e.paths??[];e.presorted===!0?n.appendPaths(r):n.appendPreparedPaths(Q(t,`store.preparePathEntries`,()=>ST(r,e)))}let r=Q(t,`store.builder.finish`,()=>n.finish({skipSubtreeCountPass:!0})),i=Q(t,`store.state.detectAllDirectoriesExpanded`,()=>(e.initialExpansion??`closed`)===`closed`&&n.didMatchAllInitialExpandedPaths());this.#e=Q(t,`store.state.create`,()=>wT(r,i?`open`:e.initialExpansion??`closed`,t)),i&&(this.#e.collapseNewDirectoriesByDefault=!0);let a=i?this.#e.snapshot.directories.size-1:Q(t,`store.state.initializeExpandedPaths`,()=>this.initializeExpandedPaths(e.initialExpandedPaths));i||BD(e)||(e.initialExpansion??`closed`)===`closed`&&a===this.#e.snapshot.directories.size-1||(e.initialExpandedPaths?.length??0)>0&&Q(t,`store.state.checkAllDirectoriesExpanded`,()=>this.hasAllDirectoriesExpanded())?Q(t,`store.state.initializeOpenVisibleCounts`,()=>zD(this.#e)):Q(t,`store.state.recomputeCounts`,()=>yE(this.#e,this.#e.snapshot.rootId))}static preparePaths(e,t={}){return gT(e,t)}static prepareInput(e,t={}){return _T(e,t)}static preparePresortedInput(e){return vT(e)}list(e){return Q(this.#e.instrumentation,`store.list`,()=>dE(this.#e,e))}add(e){Q(this.#e.instrumentation,`store.add`,()=>{let t=gD(this.#e);QT(this.#e,XT(this.#e,t,fE(this.#e,e)))})}remove(e,t={}){Q(this.#e.instrumentation,`store.remove`,()=>{let n=gD(this.#e);QT(this.#e,XT(this.#e,n,pE(this.#e,e,t)))})}move(e,t,n={}){Q(this.#e.instrumentation,`store.move`,()=>{let r=gD(this.#e),i=mE(this.#e,e,t,n);i!=null&&QT(this.#e,XT(this.#e,r,i))})}batch(e){ZT(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 Q(this.#e.instrumentation,`store.getVisibleCount`,()=>gD(this.#e))}getVisibleSlice(e,t){return Q(this.#e.instrumentation,`store.getVisibleSlice`,()=>SD(this.#e,e,t))}getVisibleRowContext(e){return Q(this.#e.instrumentation,`store.getVisibleRowContext`,()=>xD(this.#e,e))}getVisibleTreeProjection(){return wD(this.#e)}getVisibleTreeProjectionData(e){return CD(this.#e,e)}getVisibleIndex(e){return Q(this.#e.instrumentation,`store.getVisibleIndex`,()=>TD(this.#e,e))}getPathInfo(e){return Q(this.#e.instrumentation,`store.getPathInfo`,()=>{let t=xE(this.#e,e);if(t==null)return null;let n=wE(this.#e,t);return{depth:Aw(n),kind:Mw(n)?`directory`:`file`,path:_E(this.#e,t)}})}isExpanded(e){return Q(this.#e.instrumentation,`store.isExpanded`,()=>{let t=this.requireDirectoryNodeId(e),n=wE(this.#e,t);return OT(this.#e,t,n)})}expand(e){Q(this.#e.instrumentation,`store.expand`,()=>{let t=gD(this.#e),n=ED(this.#e,e);n!=null&&QT(this.#e,XT(this.#e,t,n))})}collapse(e){Q(this.#e.instrumentation,`store.collapse`,()=>{let t=gD(this.#e),n=DD(this.#e,e);n!=null&&QT(this.#e,XT(this.#e,t,n))})}on(e,t){return RT(this.#e,e,t)}getDirectoryLoadState(e){let t=this.requireDirectoryNodeId(e);return jT(this.#e,t)}markDirectoryUnloaded(e){Q(this.#e.instrumentation,`store.markDirectoryUnloaded`,()=>{let t=this.requireDirectoryNodeId(e);if(CE(this.#e,t).childIds.length>0)throw Error(`Cannot mark a directory with known children as unloaded: "${e}"`);let n=gD(this.#e);NT(this.#e,t),QT(this.#e,XT(this.#e,n,WT({affectedAncestorIds:bE(this.#e,t),affectedNodeIds:[t],path:e,projectionChanged:this.isDirectoryProjectionVisible(t)})))})}beginChildLoad(e){return Q(this.#e.instrumentation,`store.beginChildLoad`,()=>{let t=this.requireDirectoryNodeId(e),n=gD(this.#e),r=MT(this.#e,t);return QT(this.#e,XT(this.#e,n,GT({affectedAncestorIds:bE(this.#e,t),affectedNodeIds:[t],attemptId:r.attemptId,path:e,projectionChanged:this.isDirectoryProjectionVisible(t),reused:r.reused}))),r})}applyChildPatch(e,t){return Q(this.#e.instrumentation,`store.applyChildPatch`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null||jT(this.#e,n)!==`loading`||!FT(this.#e,n,e.attemptId))return!1;let r=_E(this.#e,n);this.validateChildPatch(r,t);let i=gD(this.#e),a=[];for(let e of t.operations){HD(r,e);let t=gD(this.#e);switch(e.type){case`add`:a.push(XT(this.#e,t,fE(this.#e,e.path)));break;case`remove`:a.push(XT(this.#e,t,pE(this.#e,e.path,{recursive:e.recursive})));break;case`move`:{let n=mE(this.#e,e.from,e.to,{collision:e.collision});n!=null&&a.push(XT(this.#e,t,n));break}}}let o=a.some(e=>e.projectionChanged)||this.isDirectoryProjectionVisible(n);return QT(this.#e,XT(this.#e,i,KT({affectedAncestorIds:bE(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,childEvents:a,path:_E(this.#e,n),projectionChanged:o}))),!0})}completeChildLoad(e){return Q(this.#e.instrumentation,`store.completeChildLoad`,()=>{let t=this.resolveActiveDirectoryNodeId(e.nodeId);if(t==null)return!1;let n=gD(this.#e),r=PT(this.#e,t,e.attemptId);return QT(this.#e,XT(this.#e,n,qT({affectedAncestorIds:bE(this.#e,t),affectedNodeIds:[t],attemptId:e.attemptId,path:_E(this.#e,t),projectionChanged:this.isDirectoryProjectionVisible(t),stale:!r}))),r})}failChildLoad(e,t){return Q(this.#e.instrumentation,`store.failChildLoad`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null)return!1;let r=gD(this.#e),i=IT(this.#e,n,e.attemptId,t);return QT(this.#e,XT(this.#e,r,JT({affectedAncestorIds:bE(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,errorMessage:t,path:_E(this.#e,n),projectionChanged:this.isDirectoryProjectionVisible(n),stale:!i}))),i})}cleanup(e={}){return Q(this.#e.instrumentation,`store.cleanup`,()=>{if(this.#e.transactionStack.length>0)throw Error(`Cleanup cannot run during an open batch or transaction.`);if(fD(this.#e))throw Error(`Cleanup cannot run while directory loads are active.`);let t=gD(this.#e),n=pD(this.#e,e.mode??`stable`);return QT(this.#e,XT(this.#e,t,YT({...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=CE(this.#e,p).childIds,_=m===d?n[m]??0:0,v=_,y,b=l.get(a)??Uw(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=Gw(Qw(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(!Mw(wE(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=wE(this.#e,n);OT(this.#e,n,i)||(kT(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=wE(this.#e,e);if(!OT(this.#e,e,t))return!1}return!0}requireDirectoryNodeId(e){let t=xE(this.#e,e);if(t==null)throw Error(`Path does not exist: "${e}"`);if(!Mw(wE(this.#e,t)))throw Error(`Path is not a directory: "${e}"`);return t}resolveActiveDirectoryNodeId(e){try{if(!Mw(wE(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=wE(this.#e,t).parentId;if(e!==this.#e.snapshot.rootId){let n=wE(this.#e,e),r=cE(this.#e,e);if(!OT(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 HD(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 UD={compact:{itemHeight:24,factor:.8},default:{itemHeight:30,factor:1},relaxed:{itemHeight:36,factor:1.2}};function WD(e,t){if(typeof e==`number`)return{itemHeight:t??UD.default.itemHeight,factor:e};let n=UD[e??`default`];return{itemHeight:t??n.itemHeight,factor:n.factor}}var GD=UD.default.itemHeight,KD=`@layer base, theme, unsafe;
185
+ </symbol>`],jC=[PS,FS,LS,RS,zS,BS,VS,GS,KS,XS,rC,iC,aC,oC,sC,lC,fC,pC,mC,hC,gC,yC,bC,CC,wC,TC,EC,DC,OC,kC];function MC(e,t){return t.length===0?e:e.replace(`</svg>`,`\n ${t.join(`
186
+ `)}\n</svg>`)}var NC=MC(NS,AC),PC={minimal:NS,standard:NC,complete:MC(NC,jC)},FC={".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`},IC={"7z":`zip`,astro:`astro`,AUTHORS:`text`,avif:`image`,bash:`bash`,bmp:`image`,bz2:`zip`,cfg:`text`,CHANGELOG:`text`,cjs:`javascript`,"code-workspace":`vscode`,conf:`text`,CONTRIBUTORS:`text`,csh:`bash`,css:`css`,csv:`table`,cts:`typescript`,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`,htm:`html`,html:`html`,icns:`image`,ico:`image`,ini:`text`,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`,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`},LC={jsx:`react`,sass:`sass`,scss:`sass`,tsx:`react`},RC=new Set([`bash`,`css`,`database`,`default`,`font`,`git`,`go`,`html`,`image`,`javascript`,`json`,`markdown`,`mcp`,`python`,`ruby`,`rust`,`swift`,`table`,`text`,`typescript`,`zip`]),zC=new Set([`complete`]);function BC(e){return PC[e===`none`?`minimal`:e]}function VC(e){return`file-tree-builtin-${e}`}function HC(e){return e!==`none`&&zC.has(e)}function UC(e,t,n){if(e===`minimal`||e===`none`)return;let r=e===`complete`,i=FC[t.toLowerCase()];if(i!=null&&(r||RC.has(i)))return i;for(let e of n){if(r){let t=LC[e];if(t!=null)return t}let t=IC[e];if(t!=null&&(r||RC.has(t)))return t}return`default`}var WC=`file-tree-container`,GC=`data-file-tree-style`,KC=`data-file-tree-unsafe-css`,qC=`data-file-tree-scrollbar-measure`,JC=`data-file-tree-scrollbar-gutter-measured`,YC=`--trees-scrollbar-gutter-measured`,XC=`header`,ZC=`context-menu`,QC=`context-menu-trigger`;function $C(e){return e.spriteSheet!=null||e.remap!=null||e.byFileName!=null||e.byFileExtension!=null||e.byFileNameContains!=null}function ew(e){return e==null?{set:`complete`,colored:!0}:typeof e==`string`?{set:e,colored:!0}:{...e,set:e.set??($C(e)?`none`:`complete`),colored:e.colored??!0}}var tw=e=>e.trim().toLowerCase(),nw=e=>e.split(`/`).at(-1)??e,rw=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 iw(e,t){return typeof e==`string`?{name:e,remappedFrom:t}:{...e,remappedFrom:t}}function aw(e){let t=ew(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(tw(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=nw(o),s=n.toLowerCase(),c=r.get(s);if(c!=null)return iw(c,e);for(let[t,n]of a)if(s.includes(t))return iw(n,e);let l=rw(n);for(let t of l){let n=i.get(t);if(n!=null)return iw(n,e)}let u=UC(t.set,n,l);if(u!=null&&t.set!==`none`)return{name:VC(u),remappedFrom:e,token:u}}let s=n?.[e];return s==null?{name:e}:iw(s,e)}}}var ow=/^#(?:[0-9a-f]{3}0|[0-9a-f]{6}00)$/i,sw=/^0(?:\.0+)?%?$/;function cw(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 lw(e){if(e==null)return!1;let t=e.trim().toLowerCase();if(t===`transparent`||ow.test(t))return!0;let n=cw(t);return n!=null&&sw.test(n)}function uw(e){return lw(e)?void 0:e}function dw(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=uw(t[`list.focusOutline`])??uw(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 fw=5,pw=1<<fw,mw=pw*4;function hw(){return{childIdByNameId:new Map,childIds:[],childPositionById:new Map,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function gw(){return{childIdByNameId:null,childIds:[],childPositionById:null,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function _w(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 vw(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 yw(e,t){e.childPositionById!=null&&e.childPositionById.set(t,e.childIds.length),e.childIds.push(t)}function bw(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 xw(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,Tw(e,t)}function Sw(e,t,n,r){if(e.totalChildSubtreeNodeCount+=n,e.totalChildVisibleSubtreeCount+=r,e.childVisibleChunkSums==null||r===0)return;let i=vw(e).get(t);if(i===void 0)return;let a=i>>fw;e.childVisibleChunkSums[a]+=r}function Cw(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=Ew(e,t,a,i);return{...r,childVisibleIndex:n-r.localVisibleIndex}}i-=o,a+=pw}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 ww(e,t,n){let r=0,i=t.childVisibleChunkSums,a=0;if(i!=null){let e=n>>fw;for(let t=0;t<e;t+=1)r+=i[t]??0;a=e<<fw}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 Tw(e,t){if(t.childIds.length<mw){t.childVisibleChunkSums=null;return}let n=Math.ceil(t.childIds.length/pw),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>>fw]+=a.visibleSubtreeCount)}t.childVisibleChunkSums=r}function Ew(e,t,n,r){let i=Math.min(t.childIds.length,n+pw),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 Dw=7,Ow=3,kw=1<<Ow,Aw=4;function jw(e,t,n=0){return e<<Aw|n<<Ow|t}function Mw(e){return e.depthAndFlags>>>Aw}function Nw(e){return(e.depthAndFlags&kw)>>Ow}function Pw(e){return(e.depthAndFlags&kw)!==0}function Fw(e){return e.depthAndFlags&Dw}function Iw(e,t){return(Fw(e)&t)!==0}function Lw(e,t){e.depthAndFlags|=t}function Rw(e,t){e.depthAndFlags=jw(t,Fw(e),Nw(e))}var zw=Symbol(`benchmarkInstrumentation`);function Bw(e,t){return t==null||Object.defineProperty(e,zw,{configurable:!0,enumerable:!1,value:t,writable:!1}),e}function Vw(e){return e==null?null:e[zw]??null}function Q(e,t,n){return e==null?n():e.measurePhase(t,n)}function Hw(e,t,n){!Number.isFinite(n)||e==null||e.setCounter(t,n)}function Uw(e){return e>=48&&e<=57}function Ww(e){let t=[],n=0,r=0;for(;r<e.length;){for(;r<e.length&&!Uw(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&&Uw(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 Gw(e){let t=e.toLowerCase();return{lowerValue:t,tokens:Ww(t)}}function Kw(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 qw(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=Kw(e.tokens,t.tokens);return n===0?e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1:n}function Jw(e,t,n){let r=qw(n(e),n(t));return r===0?e===t?0:e<t?-1:1:r}function Yw(e,t){return Jw(e,t,Gw)}function Xw(e,t){return t===e.segments.length-1?+!!e.isDirectory:1}function Zw(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=Xw(e,r);return a===Xw(t,r)?Yw(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 Qw(e,t){return Zw(e,t)}function $w(e,t,n){let r=e=>{let t=n.get(e);if(t!=null)return t;let r=Gw(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=Xw(e,n);return o===Xw(t,n)?Jw(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 eT(e,t){let n=e.sortKeyById[t];if(n!==void 0)return n;let r=e.valueById[t],i=Gw(r);return e.sortKeyById[t]=i,i}function tT(e={}){return{flattenEmptyDirectories:e.flattenEmptyDirectories!==!1,sort:e.sort??`default`}}function nT(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 rT(e){let{hasTrailingSlash:t,segments:n}=nT(e);return{basename:n[n.length-1]??``,isDirectory:t,path:e,segments:n}}function iT(e){if(e.length===0)return{requiresDirectory:!1,segments:[]};let{hasTrailingSlash:t,segments:n}=nT(e);return{requiresDirectory:t,segments:n}}var aT=``;function oT(){let e=new Map;return e.set(aT,0),{idByValue:e,valueById:[aT],sortKeyById:[Gw(aT)]}}function sT(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 cT(e,t){let n=e.valueById[t];if(n===void 0)throw Error(`Unknown segment ID: ${String(t)}`);return n}var lT=Symbol(`pathStorePreparedInputKind`);function uT(e,t){return e[lT]=t,e}function dT(e){return{basename:e.basename,depth:e.segments.length,isDirectory:e.isDirectory,path:e.path,segments:e.segments}}function fT(e,t,n){return n===`default`?Qw(e,t):n(dT(e),dT(t))}function pT(){return{depthAndFlags:jw(0,3,1),nameId:0,parentId:0,subtreeNodeCount:1,visibleSubtreeCount:1}}function mT(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 hT(e){return e.isDirectory?e.segments.length:e.segments.length-1}function gT(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 _T(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function vT(e,t={}){return wT(e,t).map(e=>e.path)}function yT(e,t={}){let n=wT(e,t);return uT({paths:n.map(e=>e.path),preparedPaths:n},`prepared`)}function bT(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 uT({paths:e,presortedPaths:e,presortedPathsContainDirectories:n},`presorted`)}function xT(e){let t=e,n=t.preparedPaths;if(t[lT]===`prepared`&&n!=null)return n;if(!gT(n))throw Error(`preparedInput must come from PathStore.prepareInput()`);return n}function ST(e){let t=e;return t[lT]===`presorted`&&t.presortedPaths!=null||_T(t.presortedPaths)?t.presortedPaths:null}function CT(e){let t=e;return typeof t.presortedPathsContainDirectories==`boolean`?t.presortedPathsContainDirectories:null}function wT(e,t={}){let n=tT(t),r=Vw(t);Hw(r,`workload.inputFiles`,e.length);let i=Q(r,`store.preparePathEntries.parse`,()=>e.map(e=>rT(e)));return Q(r,`store.preparePathEntries.sort`,()=>i.sort((e,t)=>fT(e,t,n.sort))),i}var TT=class{directories=new Map;directoryStack=[0];presortedDirectoryNodeIds=[];initialExpandedPathSet;createdDirectoriesAllExpanded=!1;createdDirectoryCount=0;lastPreparedPath=null;nodes=[pT()];options;instrumentation;segmentSortKeyCache=new Map;segmentTable=oT();hasDeferredDirectoryIndexes=!1;constructor(e={}){this.instrumentation=Vw(e),this.options=tT(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,hw())}appendPaths(e){return Q(this.instrumentation,`store.builder.appendPaths.parse`,()=>this.appendPreparedPaths(e.map(e=>rT(e))))}appendPreparedPaths(e,t=!0){return this.createdDirectoriesAllExpanded=!1,Q(this.instrumentation,`store.builder.appendPreparedPaths`,()=>{for(let n of e)this.appendPreparedPath(n,t)}),this}appendPresortedPaths(e,t=null){return Q(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:jw(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:jw(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:jw(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=rT(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:jw(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:jw(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=rT(t)),this.hasDeferredDirectoryIndexes=!0}finish(e={}){let t=e.skipSubtreeCountPass===!0;return this.hasDeferredDirectoryIndexes?(Q(this.instrumentation,`store.builder.buildDirectoryIndexes`,()=>this.buildPresortedFinish(t)),this.hasDeferredDirectoryIndexes=!1):t||Q(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`?$w(this.lastPreparedPath,e,this.segmentSortKeyCache):fT(this.lastPreparedPath,e,this.options.sort))>0)throw Error(`Builder input must be sorted before appendPaths(): "${e.path}"`)}let n=this.lastPreparedPath,r=hT(e),i=n==null?0:hT(n),a=n==null?0:mT(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=sT(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:jw(Mw(o)+1,0),nameId:r,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),a?.set(r,s),yw(i,s),s}createFileChildUnchecked(e,t){let n=sT(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:jw(Mw(i)+1,0),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),yw(r,a),a}getOrCreateDirectoryChild(e,t){let n=sT(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&&!Pw(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:jw(Mw(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),yw(r,a),this.directories.set(a,hw()),a}createDirectoryChild(e,t){let n=sT(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:jw(Mw(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),yw(r,a),this.directories.set(a,hw()),a}promoteDirectoryToExplicit(e,t){let n=this.nodes[e];if(n===void 0)throw Error(`Unknown directory node ID: ${String(e)}`);if(!Pw(n))throw Error(`Path is not a directory: "${t}"`);if(Iw(n,1))throw Error(`Duplicate path: "${t}"`);Lw(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,gw());let r=-1,i=null;for(let e=1;e<t.length;e++){let a=t[e];if(a==null)continue;if(Pw(a)){let t=gw();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;Pw(n)&&this.directories.set(t,hw());let r=this.directories.get(n.parentId);r!=null&&(r.childIdByNameId!=null&&r.childIdByNameId.set(n.nameId,t),yw(r,t))}}computeSubtreeCounts(e){let t=this.nodes[e];if(t===void 0)throw Error(`Unknown node ID: ${String(e)}`);if(!Pw(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 xw(this.nodes,n),t.subtreeNodeCount=r,t.visibleSubtreeCount=r,r}};function ET(e,t=`closed`,n=null){let r=OT(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 DT(){return{affectedAncestorIds:new Set,affectedNodeIds:new Set,events:[]}}function OT(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 kT(e,t){return Iw(t,2)||e.defaultExpansion===`open`?!0:e.defaultExpansion===`closed`?!1:Mw(t)<=e.defaultExpansion}function AT(e,t,n=e.snapshot.nodes[t]){return n==null||!Pw(n)?!1:e.directoriesOpenByDefault&&!e.hasCollapsedDirectoryOverrides?!0:e.collapsedDirectoryIds.has(t)?!1:e.expandedDirectoryIds.has(t)?!0:kT(e,n)}function jT(e,t,n,r=e.snapshot.nodes[t]){if(r==null||!Pw(r))return;let i=kT(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 MT(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 NT(e,t){return e.directoryLoadInfoById.get(t)?.state??`loaded`}function PT(e,t){let n=MT(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 FT(e,t){let n=MT(e,t);n.activeAttemptId=null,n.errorMessage=null,n.state=`unloaded`}function IT(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 LT(e,t,n){return e.directoryLoadInfoById.get(t)?.activeAttemptId===n}function RT(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 zT(e,t){e.directoryLoadInfoById.delete(t)}function BT(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 VT(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`add`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function HT(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`remove`,path:e.path,projectionChanged:e.projectionChanged,recursive:e.recursive,visibleCountDelta:null}}function UT(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,from:e.from,operation:`move`,projectionChanged:e.projectionChanged,to:e.to,visibleCountDelta:null}}function WT(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`expand`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function GT(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`collapse`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function KT(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`mark-directory-unloaded`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function qT(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 JT(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 YT(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 XT(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 ZT(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 QT(e,t,n){return{...n,visibleCountDelta:lE(e)-t}}function $T(e,t){let n=lE(e),r=DT();e.transactionStack.push(r);try{t()}catch(t){throw nE(e,r,!1),t}nE(e,r,!0,lE(e)-n)}function eE(e,t){let n=e.instrumentation;if(n==null){tE(e,t);return}Q(n,`store.events.record`,()=>tE(e,t))}function tE(e,t){let n=e.transactionStack[e.transactionStack.length-1]??null;if(n==null){sE(e,t);return}n.events.push(t),oE(n,t)}function nE(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?aE(i,t):Q(n,`store.events.batch.merge`,()=>aE(i,t));return}let a=rE(t,r),o=e.instrumentation;if(o==null){sE(e,a);return}Q(o,`store.events.batch.commit`,()=>sE(e,a))}function rE(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 iE(e,t){for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n);for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n)}function aE(e,t){for(let n of t.events)e.events.push(n);iE(e,t)}function oE(e,t){for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n);for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n)}function sE(e,t){let n=e.instrumentation;if(n==null){cE(e,t);return}Q(n,`store.events.emit`,()=>cE(e,t))}function cE(e,t){e.listeners.get(t.operation)?.forEach(e=>e(t)),e.listeners.get(`*`)?.forEach(e=>e(t))}function lE(e){return e.snapshot.nodes[e.snapshot.rootId]?.visibleSubtreeCount??0}function uE(e,t){if(e.snapshot.options.flattenEmptyDirectories!==!0)return null;let n=e.snapshot.nodes[t];if(n==null||!Pw(n)||Iw(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||!Pw(a)?null:i}function dE(e,t){let n=t;for(;;){let t=uE(e,n);if(t==null)return n;n=t}}function fE(e,t){let n=[t],r=t;for(;;){let t=uE(e,r);if(t==null)return n;n.push(t),r=t}}function pE(e,t){let n=t==null?e.snapshot.rootId:CE(e,t);return n==null?[]:DE(e,n)}function mE(e,t){let n=rT(t),r=n.isDirectory?n.segments:n.segments.slice(0,-1),i=HE(e,VE(e,r)),{createdNodeIds:a,directoryId:o}=OE(e,r),s=new Set(a),c=o;if(n.isDirectory){let n=EE(e,o);if(Iw(n,1))throw Error(`Path already exists: "${t}"`);Lw(n,1),e.pathCacheByNodeId.set(o,{path:t,version:e.pathCacheVersion}),s.add(o)}else c=AE(e,o,n.basename),s.add(c);bE(e,o);let l=HE(e,o);return VT({affectedAncestorIds:SE(e,c),affectedNodeIds:[...s],path:t,projectionChanged:UE(i,l)})}function hE(e,t,n){let r=CE(e,t);if(r==null)throw Error(`Path does not exist: "${t}"`);let i=EE(e,r);if(Iw(i,2))throw Error(`The root node cannot be removed`);if(Pw(i)&&TE(e,r).childIds.length>0&&n.recursive!==!0)throw Error(`Cannot remove a non-empty directory without recursive: "${t}"`);let a=i.parentId,o=HE(e,a),s=zE(e,r);NE(e,a,r,i.nameId),BE(e,a),bE(e,a);let c=HE(e,a);return HT({affectedAncestorIds:SE(e,a),affectedNodeIds:s,path:t,projectionChanged:UE(o,c),recursive:n.recursive===!0})}function gE(e,t,n,r){let i=CE(e,t);if(i==null)throw Error(`Source path does not exist: "${t}"`);let a=EE(e,i);if(Iw(a,2))throw Error(`The root node cannot be moved`);let o=r.collision??`error`,s=LE(e,i,n),c=HE(e,a.parentId),l=HE(e,s.parentId),u=cT(e.snapshot.segmentTable,a.nameId),d=sT(e.snapshot.segmentTable,s.basename);if(s.parentId===a.parentId&&u===s.basename)return null;if(Pw(a)&&qE(e,i,s.parentId))throw Error(`Cannot move a directory into one of its descendants`);let f=_w(e.snapshot.nodes,TE(e,s.parentId)).get(d),p=s.existingNodeId??f??null;if(p!=null&&p!==i&&RE(e,p,o,Nw(a))===`skip`)return null;let m=a.parentId;NE(e,m,i,a.nameId),a.parentId=s.parentId,a.nameId=d,e.pathCacheByNodeId.delete(i),KE(e,i),ME(e,s.parentId,i),BE(e,m),e.pathCacheVersion++,bE(e,m),s.parentId!==m&&bE(e,s.parentId);let h=HE(e,m),g=HE(e,s.parentId);return UT({affectedAncestorIds:[...new Set([...SE(e,m),...SE(e,s.parentId)])],affectedNodeIds:[i],from:t,projectionChanged:WE([c,l],[h,g]),to:yE(e,i)})}function _E(e,t){let n=e.pathCacheByNodeId.get(t);return n!=null&&n.version===e.pathCacheVersion?n.path:null}function vE(e,t,n){return e.pathCacheByNodeId.set(t,{path:n,version:e.pathCacheVersion}),n}function yE(e,t){let n=EE(e,t),r=_E(e,t);if(r!=null)return r;if(Iw(n,2))return vE(e,t,``);let i=yE(e,n.parentId),a=cT(e.snapshot.segmentTable,n.nameId),o=i.length===0?a:`${i}${a}`;return vE(e,t,Pw(n)?`${o}/`:o)}function bE(e,t){let n=e.instrumentation;if(n==null){YE(e,t);return}Q(n,`store.recomputeCountsUpwardFrom`,()=>YE(e,t))}function xE(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||!Pw(o)){JE(e,a,o,!0),n.pop();continue}let s=i.get(a);if(s==null||t[1]>=s.childIds.length){JE(e,a,o,!0),n.pop();continue}let c=s.childIds[t[1]++];n.push([c,0])}}function SE(e,t){let n=[],r=t;for(;r!=null;){let t=EE(e,r);if(n.push(r),r===e.snapshot.rootId)break;r=t.parentId}return n}function CE(e,t){if(t.length===0)return e.snapshot.rootId;let n=iT(t);return wE(e,n.segments,n.requiresDirectory)}function wE(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=TE(e,r),a=_w(e.snapshot.nodes,i).get(t);if(a===void 0)return null;r=a}let i=EE(e,r);return n&&!Pw(i)?null:r}function TE(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 EE(e,t){let n=e.snapshot.nodes[t];if(n===void 0||Iw(n,4))throw Error(`Unknown node ID: ${String(t)}`);return n}function DE(e,t){let n=e.snapshot.nodes[t];if(n===void 0||Iw(n,4))return[];if(!Pw(n))return[yE(e,t)];if(TE(e,t).childIds.length===0)return Iw(n,1)&&!Iw(n,2)?[yE(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||Iw(n,4)){i.pop();continue}if(!Pw(n)){r.push(yE(e,t.nodeId)),i.pop();continue}let a=TE(e,t.nodeId);if(a.childIds.length===0){Iw(n,1)&&!Iw(n,2)&&r.push(yE(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 OE(e,t){let n=[],r=e.snapshot.rootId;for(let i of t){let t=sT(e.snapshot.segmentTable,i),a=TE(e,r),o=_w(e.snapshot.nodes,a).get(t);if(o!==void 0){if(!Pw(EE(e,o)))throw Error(`Cannot create a directory that collides with an existing file: "${i}"`);r=o;continue}r=kE(e,r,t),n.push(r)}return{createdNodeIds:n,directoryId:r}}function kE(e,t,n){let r=EE(e,t),i=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:jw(Mw(r)+1,0,1),nameId:n,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),e.snapshot.directories.set(i,hw()),ME(e,t,i),e.collapseNewDirectoriesByDefault&&(e.collapsedDirectoryIds.add(i),e.hasCollapsedDirectoryOverrides=!0),e.activeNodeCount++,i}function AE(e,t,n){let r=sT(e.snapshot.segmentTable,n),i=TE(e,t);if(_w(e.snapshot.nodes,i).has(r))throw Error(`Path already exists: "${ZE(e,t,n)}"`);let a=EE(e,t),o=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:jw(Mw(a)+1,0),nameId:r,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),ME(e,t,o),e.activeNodeCount++,o}function jE(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}PE(e,n,o)<0?i=a:r=a+1}return r}function ME(e,t,n){let r=TE(e,t),i=EE(e,n);_w(e.snapshot.nodes,r).set(i.nameId,n),Sw(r,n,i.subtreeNodeCount,i.visibleSubtreeCount);let a=jE(e,r,n);r.childIds.splice(a,0,n),bw(r,a),Tw(e.snapshot.nodes,r)}function NE(e,t,n,r){let i=TE(e,t),a=vw(i),o=a.get(n)??-1;_w(e.snapshot.nodes,i).delete(r),a.delete(n);let s=e.snapshot.nodes[n];s!=null&&Sw(i,n,-s.subtreeNodeCount,-s.visibleSubtreeCount),o>=0&&(i.childIds.splice(o,1),bw(i,o),Tw(e.snapshot.nodes,i))}function PE(e,t,n){let r=e.snapshot.options.sort;return r===`default`?FE(e,t,n):r(IE(e,t),IE(e,n))}function FE(e,t,n){let r=EE(e,t),i=EE(e,n),a=Pw(r);if(a!==Pw(i))return a?-1:1;let o=qw(eT(e.snapshot.segmentTable,r.nameId),eT(e.snapshot.segmentTable,i.nameId));if(o!==0)return o;let s=cT(e.snapshot.segmentTable,r.nameId),c=cT(e.snapshot.segmentTable,i.nameId);return s===c?t<n?-1:1:s<c?-1:1}function IE(e,t){let n=EE(e,t),r=yE(e,t),i=Pw(n),a=i?r.slice(0,-1):r;return{basename:cT(e.snapshot.segmentTable,n.nameId),depth:Mw(n),isDirectory:i,path:r,segments:a.length===0?[]:a.split(`/`)}}function LE(e,t,n){let r=EE(e,t),i=CE(e,n);if(i!=null){let t=EE(e,i);if(Pw(t))return{basename:cT(e.snapshot.segmentTable,r.nameId),existingNodeId:null,parentId:i};let a=iT(n).segments;return{basename:a[a.length-1]??``,existingNodeId:i,parentId:t.parentId}}let a=iT(n),o=a.segments[a.segments.length-1]??``,s=a.segments.slice(0,-1),c=s.length===0?e.snapshot.rootId:wE(e,s,!0);if(c==null)throw Error(`Destination parent does not exist: "${n}"`);return{basename:o,existingNodeId:null,parentId:c}}function RE(e,t,n,r){if(n===`skip`)return`skip`;if(n===`error`)throw Error(`Destination already exists: "${yE(e,t)}"`);let i=EE(e,t);if(Nw(i)!==r)throw Error(`replace collision requires the same source and destination kinds`);if(Pw(i)&&TE(e,t).childIds.length>0)throw Error(`replace collision does not support non-empty directories`);let a=i.parentId,o=i.nameId;return zE(e,t),NE(e,a,t,o),BE(e,a),bE(e,a),`handled`}function zE(e,t){let n=[],r=[{nodeId:t,visitedChildren:!1}];for(;r.length>0;){let t=r.pop();if(t==null)break;let i=EE(e,t.nodeId);if(t.visitedChildren||!Pw(i)){Pw(i)&&e.snapshot.directories.delete(t.nodeId),Lw(i,4),e.pathCacheByNodeId.delete(t.nodeId),e.collapsedDirectoryIds.delete(t.nodeId)&&(e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0),e.expandedDirectoryIds.delete(t.nodeId),zT(e,t.nodeId),e.activeNodeCount--,n.push(t.nodeId);continue}r.push({nodeId:t.nodeId,visitedChildren:!0});let a=TE(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 BE(e,t){let n=t;for(;n!=null;){let t=EE(e,n);if(!Pw(t)||Iw(t,2)||TE(e,n).childIds.length>0)return;Lw(t,1),n=t.parentId===n?null:t.parentId}}function VE(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=_w(e.snapshot.nodes,TE(e,n)).get(t);if(i==null||!Pw(EE(e,i)))break;n=i}return n}function HE(e,t){let n=GE(e,t);if(n==null)return null;let r=dE(e,n),i=EE(e,r),a=n===r?null:fE(e,n).map(t=>yE(e,t));return JSON.stringify({flattenedSegmentPaths:a,hasChildren:TE(e,r).childIds.length>0,path:yE(e,r),terminalKind:Nw(i)})}function UE(e,t){return WE([e],[t])}function WE(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 GE(e,t){let n=t;for(;n!=null;){let t=EE(e,n);if(!Pw(t)||Iw(t,2))return null;if(!AT(e,n,t))return n;n=t.parentId}return null}function KE(e,t){let n=EE(e,t);if(Rw(n,(t===e.snapshot.rootId?-1:Mw(EE(e,n.parentId)))+1),!Pw(n))return;let r=TE(e,t);for(let t of r.childIds)KE(e,t)}function qE(e,t,n){let r=n;for(;r!=null;){if(r===t)return!0;let n=EE(e,r);if(r===e.snapshot.rootId)return!1;r=n.parentId}return!1}function JE(e,t,n=EE(e,t),r=!1){let i=e.instrumentation;if(i==null){XE(e,t,n,r);return}Q(i,`store.recomputeNodeCounts`,()=>XE(e,t,n,r))}function YE(e,t){let n=t;for(;n!=null;){let t=EE(e,n),r=t.subtreeNodeCount,i=t.visibleSubtreeCount;if(JE(e,n,t),n===e.snapshot.rootId)return;let a=t.subtreeNodeCount-r,o=t.visibleSubtreeCount-i,s=t.parentId;(a!==0||o!==0)&&Sw(TE(e,s),n,a,o),n=s}}function XE(e,t,n,r){if(!Pw(n)){n.subtreeNodeCount=1,n.visibleSubtreeCount=1;return}let i=TE(e,t);if(r){let t=e.instrumentation;t==null?xw(e.snapshot.nodes,i):Q(t,`store.recomputeNodeCounts.rebuildChildAggregates`,()=>xw(e.snapshot.nodes,i))}let a=1+i.totalChildSubtreeNodeCount,o=i.totalChildVisibleSubtreeCount;if(n.subtreeNodeCount=a,Iw(n,2)){n.visibleSubtreeCount=o;return}n.visibleSubtreeCount=uE(e,t)==null?AT(e,t,n)?1+o:1:o}function ZE(e,t,n){let r=yE(e,t);return r.length===0?n:`${r}${n}`}function QE(e){return e!=null&&!Iw(e,4)}function $E(e,t){let n=e.snapshot.nodes[t];return!QE(n)||!Pw(n)||Iw(n,2)?null:n}function eD(e){let t=0;for(let[n,r]of e.pathCacheByNodeId)r.version===e.pathCacheVersion&&QE(e.snapshot.nodes[n])&&(t+=1);return t}function tD(e){return Math.max(0,e.valueById.length-1)}function nD(e){return{activeNodeCount:e.activeNodeCount,cachedPathEntryCount:eD(e),loadInfoEntryCount:e.directoryLoadInfoById.size,segmentCount:tD(e.snapshot.segmentTable),totalNodeSlotCount:Math.max(0,e.snapshot.nodes.length-1)}}function rD(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 iD(e){let t=[],n=[];for(let n of e.collapsedDirectoryIds)$E(e,n)!=null&&t.push(yE(e,n));for(let t of e.expandedDirectoryIds)$E(e,t)!=null&&n.push(yE(e,t));return{collapsedPaths:t,expandedPaths:n}}function aD(e){let t=[];for(let[n,r]of e.directoryLoadInfoById)$E(e,n)==null||NT(e,n)===`loaded`||t.push({info:{activeAttemptId:null,errorMessage:r.errorMessage,nextAttemptId:r.nextAttemptId,state:r.state},path:yE(e,n)});return t}function oD(e,t){e.collapsedDirectoryIds.clear(),e.hasCollapsedDirectoryOverrides=!1,e.expandedDirectoryIds.clear();for(let n of t.expandedPaths){let t=CE(e,n);t!=null&&jT(e,t,!0,EE(e,t))}for(let n of t.collapsedPaths){let t=CE(e,n);t!=null&&jT(e,t,!1,EE(e,t))}}function sD(e,t){e.directoryLoadInfoById.clear();for(let n of t){let t=CE(e,n.path);t!=null&&$E(e,t)!=null&&e.directoryLoadInfoById.set(t,{activeAttemptId:null,errorMessage:n.info.errorMessage,nextAttemptId:n.info.nextAttemptId,state:n.info.state})}}function cD(e){e.pathCacheVersion+=1,e.pathCacheByNodeId.clear(),e.pathCacheByNodeId.set(e.snapshot.rootId,{path:``,version:e.pathCacheVersion})}function lD(e){let t=e.snapshot.segmentTable,n=oT();for(let r of e.snapshot.nodes)if(QE(r)){if(Iw(r,2)){r.nameId=0;continue}r.nameId=sT(n,cT(t,r.nameId))}e.snapshot.segmentTable=n}function uD(e){for(let[t,n]of e.snapshot.directories){let r=e.snapshot.nodes[t];if(!QE(r)||!Pw(r)){e.snapshot.directories.delete(t);continue}let i=n.childIds.filter(n=>{let r=e.snapshot.nodes[n];return QE(r)&&r.parentId===t});n.childIds=i,n.childIdByNameId=new Map(i.map(t=>[EE(e,t).nameId,t])),n.childPositionById=new Map(i.map((e,t)=>[e,t])),xw(e.snapshot.nodes,n)}}function dD(e){let t=e.snapshot.nodes.length-1;for(;t>e.snapshot.rootId;){let n=e.snapshot.nodes[t];if(QE(n))break;--t}e.snapshot.nodes.length=t+1}function fD(e){let t=iD(e),n=aD(e);Q(e.instrumentation,`store.cleanup.stable.clearPathCaches`,()=>cD(e)),Q(e.instrumentation,`store.cleanup.stable.rebuildSegmentTable`,()=>lD(e)),Q(e.instrumentation,`store.cleanup.stable.rebuildDirectoryIndexes`,()=>uD(e)),Q(e.instrumentation,`store.cleanup.stable.trimTrailingRemovedNodeSlots`,()=>dD(e)),Q(e.instrumentation,`store.cleanup.stable.restoreExpansionOverrides`,()=>oD(e,t)),Q(e.instrumentation,`store.cleanup.stable.restoreDirectoryLoadInfos`,()=>sD(e,n)),Q(e.instrumentation,`store.cleanup.stable.recomputeCounts`,()=>xE(e,e.snapshot.rootId))}function pD(e){let t=iD(e),n=aD(e),r=Q(e.instrumentation,`store.cleanup.aggressive.listPaths`,()=>pE(e)),i=Bw({...e.snapshot.options},e.instrumentation),a=Q(e.instrumentation,`store.cleanup.aggressive.rebuildSnapshot`,()=>{let e=new TT(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,Q(e.instrumentation,`store.cleanup.aggressive.restoreExpansionOverrides`,()=>oD(e,t)),Q(e.instrumentation,`store.cleanup.aggressive.restoreDirectoryLoadInfos`,()=>sD(e,n)),Q(e.instrumentation,`store.cleanup.aggressive.recomputeCounts`,()=>xE(e,e.snapshot.rootId))}function mD(e){for(let t of e.directoryLoadInfoById.values())if(t.state===`loading`&&t.activeAttemptId!=null)return!0;return!1}function hD(e,t){let n=nD(e);t===`stable`?Q(e.instrumentation,`store.cleanup.stable`,()=>fD(e)):Q(e.instrumentation,`store.cleanup.aggressive`,()=>pD(e));let r=nD(e);return rD(t,t===`stable`,n,r)}var gD=64;function _D(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 vD(e){return EE(e,e.snapshot.rootId).visibleSubtreeCount}function yD(e,t,n,r){let i=EE(e,t.terminalNodeId),a=Math.max(1,i.visibleSubtreeCount);return Math.min(r-1,n+a-1)}function bD(e,t,n,r){return{ancestorPaths:r,index:t.index,posInSet:t.posInSet,row:zD(e,t.cursor),setSize:t.setSize,subtreeEndIndex:yD(e,t.cursor,t.index,n)}}function xD(e,t,n,r,i,a){let o=TE(e,t),{childIndex:s,childVisibleIndex:c,localVisibleIndex:l}=Cw(e.snapshot.nodes,o,n),u=o.childIds[s];if(u==null)throw Error(`Visible index ${String(n)} is out of range`);return SD(e,u,l,r+c,i+1,s,o.childIds.length,a)}function SD(e,t,n,r,i,a,o,s){if(!Pw(EE(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=ND(e,t,i);if(n===0)return{ancestors:s,cursor:c,index:r,posInSet:a,setSize:o};let l=EE(e,c.terminalNodeId);if(!Pw(l)||!AT(e,c.terminalNodeId,l))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return xD(e,c.terminalNodeId,n-1,r+1,c.visibleDepth,[...s,{cursor:c,index:r,posInSet:a,setSize:o}])}function CD(e,t){let n=vD(e);if(t<0||t>=n)return null;let r=xD(e,e.snapshot.rootId,t,0,-1,[]),i=r.ancestors.map(t=>yE(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=bD(e,a,n,[...i]);t.push(r),i.push(r.row.path)}return a=t,a},index:r.index,posInSet:r.posInSet,row:zD(e,r.cursor),setSize:r.setSize,subtreeEndIndex:yD(e,r.cursor,r.index,n)}}function wD(e,t,n){let r=e.instrumentation,i=vD(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 RD(e,o+1);let t=[],n=AD(e,a);for(let r=a;r<=o&&n!=null;r++){let r=zD(e,n);t.push(r),n=FD(e,n)}return t}let s=[],c=0,l=0,u=Q(r,`store.getVisibleSlice.selectFirstRow`,()=>AD(e,a));for(let t=a;t<=o&&u!=null;t++){let t=Q(r,`store.getVisibleSlice.materializeRow`,()=>zD(e,u));s.push(t),t.isFlattened&&(c++,l+=t.flattenedSegments?.length??0),u=Q(r,`store.getVisibleSlice.advanceCursor`,()=>FD(e,u))}return Hw(r,`workload.visibleRowsRead`,s.length),Hw(r,`workload.flattenedRowsRead`,c),Hw(r,`workload.flattenedSegmentsRead`,l),s}function TD(e,t=vD(e)){let n=e.instrumentation;return n==null?LD(e,t):Q(n,`store.getVisibleTreeProjection`,()=>LD(e,t))}function ED(e){return ID(TD(e))}function DD(e,t){let n=CE(e,t);if(n==null||n===e.snapshot.rootId||Pw(EE(e,n))&&dE(e,n)!==n)return null;let r=0,i=n,{nodes:a,rootId:o}=e.snapshot;for(;i!==o;){let t=EE(e,i).parentId,n=TE(e,t),s=vw(n).get(i);if(s==null)throw Error(`Child ${String(i)} was not found in its parent index`);if(r+=ww(a,n,s),t!==o){let n=EE(e,t),a=uE(e,t);if(!AT(e,t,n)&&a!==i)return null;dE(e,t)===t&&(r+=1)}i=t}return r}function OD(e,t){let n=CE(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=EE(e,n);if(!Pw(r))throw Error(`Path is not a directory: "${t}"`);return AT(e,n,r)?null:(jT(e,n,!0,r),bE(e,n),WT({affectedAncestorIds:SE(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0}))}function kD(e,t){let n=CE(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=EE(e,n);if(!Pw(r))throw Error(`Path is not a directory: "${t}"`);return AT(e,n,r)?(jT(e,n,!1,r),bE(e,n),GT({affectedAncestorIds:SE(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0})):null}function AD(e,t){return t<0||t>=vD(e)?null:jD(e,e.snapshot.rootId,t,-1)}function jD(e,t,n,r){let i=TE(e,t),a=e.instrumentation,{childIndex:o,localVisibleIndex:s}=a==null?Cw(e.snapshot.nodes,i,n):Q(a,`store.getVisibleSlice.selectChildIndex`,()=>Cw(e.snapshot.nodes,i,n)),c=i.childIds[o];if(c!=null)return MD(e,c,s,r+1);throw Error(`Visible index ${String(n)} is out of range`)}function MD(e,t,n,r){if(!Pw(EE(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=ND(e,t,r);if(n===0)return i;let a=EE(e,i.terminalNodeId);if(!Pw(a)||!AT(e,i.terminalNodeId,a))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return jD(e,i.terminalNodeId,n-1,i.visibleDepth)}function ND(e,t,n){return Pw(EE(e,t))?e.instrumentation==null?{headNodeId:t,terminalNodeId:dE(e,t),visibleDepth:n}:{headNodeId:t,terminalNodeId:Q(e.instrumentation,`store.getVisibleSlice.flatten.resolveTerminalDirectory`,()=>dE(e,t)),visibleDepth:n}:{headNodeId:t,terminalNodeId:t,visibleDepth:n}}function PD(e,t){let n=EE(e,t);if(!Pw(n))return!0;let r=n.parentId;return r===e.snapshot.rootId?!0:uE(e,r)!==t}function FD(e,t){let n=EE(e,t.terminalNodeId);if(Pw(n)){let r=TE(e,t.terminalNodeId);if(AT(e,t.terminalNodeId,n)&&r.childIds.length>0){let n=r.childIds[0];return n==null?null:MD(e,n,0,t.visibleDepth+1)}}let r=t.terminalNodeId,i=t.visibleDepth;for(;;){let t=EE(e,r);if(r===e.snapshot.rootId)return null;let n=t.parentId,a=TE(e,n),o=vw(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 MD(e,s,0,i);PD(e,r)&&i--,r=n}}function ID(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 LD(e,t){let n=Array(t),r=new Int32Array(t),i=new Int32Array(t),a=new Int32Array(t),o=new Int32Array(gD);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=_D(o,y);let x,S=_;if(Pw(v))S=f?dE(e,_):_,x=S===_?`${b}${h[v.nameId]}/`:yE(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&&Pw(C)&&AT(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 RD(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(!Pw(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:yE(e,f)};continue}let h=l?dE(e,f):f,g={headNodeId:f,terminalNodeId:h,visibleDepth:m};n[r++]=zD(e,g);let _=i[h];_!=null&&Pw(_)&&AT(e,h,_)&&s.push([a.get(h),0,m])}return r<t&&(n.length=r),n}function zD(e,t){let n=EE(e,t.terminalNodeId),r=Pw(n)?BD(e,t):null,i=yE(e,t.terminalNodeId),a=cT(e.snapshot.segmentTable,n.nameId),o=Pw(n)&&TE(e,t.terminalNodeId).childIds.length>0,s=t.headNodeId!==t.terminalNodeId,c=e.instrumentation,l=s?c==null?fE(e,t.headNodeId).map(n=>{let r=EE(e,n);return{isTerminal:n===t.terminalNodeId,name:cT(e.snapshot.segmentTable,r.nameId),nodeId:n,path:yE(e,n)}}):Q(c,`store.getVisibleSlice.flatten.collectSegments`,()=>fE(e,t.headNodeId).map(n=>{let r=EE(e,n);return{isTerminal:n===t.terminalNodeId,name:cT(e.snapshot.segmentTable,r.nameId),nodeId:n,path:yE(e,n)}})):void 0;return{depth:t.visibleDepth,flattenedSegments:l,hasChildren:o,id:t.terminalNodeId,isExpanded:Pw(n)&&AT(e,t.terminalNodeId,n),isFlattened:s,isLoading:r===`loading`,kind:Pw(n)?`directory`:`file`,loadState:r==null||r===`loaded`?void 0:r,name:a,path:i}}function BD(e,t){if(t.headNodeId===t.terminalNodeId)return NT(e,t.terminalNodeId);let n=fE(e,t.headNodeId),r=!1,i=!1;for(let t of n){let n=NT(e,t);if(n===`loading`)return`loading`;if(n===`error`){i=!0;continue}n===`unloaded`&&(r=!0)}return i?`error`:r?`unloaded`:`loaded`}function VD(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||!Pw(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&&Tw(n,i),r.subtreeNodeCount=1+c;let u;if(o&&s===1){let e=n[a[0]];u=e!=null&&Pw(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,Tw(n,l),c.subtreeNodeCount=1+d,c.visibleSubtreeCount=f}function HD(e){return e.initialExpansion===`open`&&(e.initialExpandedPaths==null||e.initialExpandedPaths.length===0)}var UD=class e{#e;constructor(e={}){let t=Vw(e),n=Q(t,`store.builder.create`,()=>new TT(e));if(e.preparedInput!=null){let t=ST(e.preparedInput);t==null?n.appendPreparedPaths(xT(e.preparedInput),!1):n.appendPresortedPaths(t,CT(e.preparedInput))}else{let r=e.paths??[];e.presorted===!0?n.appendPaths(r):n.appendPreparedPaths(Q(t,`store.preparePathEntries`,()=>wT(r,e)))}let r=Q(t,`store.builder.finish`,()=>n.finish({skipSubtreeCountPass:!0})),i=Q(t,`store.state.detectAllDirectoriesExpanded`,()=>(e.initialExpansion??`closed`)===`closed`&&n.didMatchAllInitialExpandedPaths());this.#e=Q(t,`store.state.create`,()=>ET(r,i?`open`:e.initialExpansion??`closed`,t)),i&&(this.#e.collapseNewDirectoriesByDefault=!0);let a=i?this.#e.snapshot.directories.size-1:Q(t,`store.state.initializeExpandedPaths`,()=>this.initializeExpandedPaths(e.initialExpandedPaths));i||HD(e)||(e.initialExpansion??`closed`)===`closed`&&a===this.#e.snapshot.directories.size-1||(e.initialExpandedPaths?.length??0)>0&&Q(t,`store.state.checkAllDirectoriesExpanded`,()=>this.hasAllDirectoriesExpanded())?Q(t,`store.state.initializeOpenVisibleCounts`,()=>VD(this.#e)):Q(t,`store.state.recomputeCounts`,()=>xE(this.#e,this.#e.snapshot.rootId))}static preparePaths(e,t={}){return vT(e,t)}static prepareInput(e,t={}){return yT(e,t)}static preparePresortedInput(e){return bT(e)}list(e){return Q(this.#e.instrumentation,`store.list`,()=>pE(this.#e,e))}add(e){Q(this.#e.instrumentation,`store.add`,()=>{let t=vD(this.#e);eE(this.#e,QT(this.#e,t,mE(this.#e,e)))})}remove(e,t={}){Q(this.#e.instrumentation,`store.remove`,()=>{let n=vD(this.#e);eE(this.#e,QT(this.#e,n,hE(this.#e,e,t)))})}move(e,t,n={}){Q(this.#e.instrumentation,`store.move`,()=>{let r=vD(this.#e),i=gE(this.#e,e,t,n);i!=null&&eE(this.#e,QT(this.#e,r,i))})}batch(e){$T(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 Q(this.#e.instrumentation,`store.getVisibleCount`,()=>vD(this.#e))}getVisibleSlice(e,t){return Q(this.#e.instrumentation,`store.getVisibleSlice`,()=>wD(this.#e,e,t))}getVisibleRowContext(e){return Q(this.#e.instrumentation,`store.getVisibleRowContext`,()=>CD(this.#e,e))}getVisibleTreeProjection(){return ED(this.#e)}getVisibleTreeProjectionData(e){return TD(this.#e,e)}getVisibleIndex(e){return Q(this.#e.instrumentation,`store.getVisibleIndex`,()=>DD(this.#e,e))}getPathInfo(e){return Q(this.#e.instrumentation,`store.getPathInfo`,()=>{let t=CE(this.#e,e);if(t==null)return null;let n=EE(this.#e,t);return{depth:Mw(n),kind:Pw(n)?`directory`:`file`,path:yE(this.#e,t)}})}isExpanded(e){return Q(this.#e.instrumentation,`store.isExpanded`,()=>{let t=this.requireDirectoryNodeId(e),n=EE(this.#e,t);return AT(this.#e,t,n)})}expand(e){Q(this.#e.instrumentation,`store.expand`,()=>{let t=vD(this.#e),n=OD(this.#e,e);n!=null&&eE(this.#e,QT(this.#e,t,n))})}collapse(e){Q(this.#e.instrumentation,`store.collapse`,()=>{let t=vD(this.#e),n=kD(this.#e,e);n!=null&&eE(this.#e,QT(this.#e,t,n))})}on(e,t){return BT(this.#e,e,t)}getDirectoryLoadState(e){let t=this.requireDirectoryNodeId(e);return NT(this.#e,t)}markDirectoryUnloaded(e){Q(this.#e.instrumentation,`store.markDirectoryUnloaded`,()=>{let t=this.requireDirectoryNodeId(e);if(TE(this.#e,t).childIds.length>0)throw Error(`Cannot mark a directory with known children as unloaded: "${e}"`);let n=vD(this.#e);FT(this.#e,t),eE(this.#e,QT(this.#e,n,KT({affectedAncestorIds:SE(this.#e,t),affectedNodeIds:[t],path:e,projectionChanged:this.isDirectoryProjectionVisible(t)})))})}beginChildLoad(e){return Q(this.#e.instrumentation,`store.beginChildLoad`,()=>{let t=this.requireDirectoryNodeId(e),n=vD(this.#e),r=PT(this.#e,t);return eE(this.#e,QT(this.#e,n,qT({affectedAncestorIds:SE(this.#e,t),affectedNodeIds:[t],attemptId:r.attemptId,path:e,projectionChanged:this.isDirectoryProjectionVisible(t),reused:r.reused}))),r})}applyChildPatch(e,t){return Q(this.#e.instrumentation,`store.applyChildPatch`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null||NT(this.#e,n)!==`loading`||!LT(this.#e,n,e.attemptId))return!1;let r=yE(this.#e,n);this.validateChildPatch(r,t);let i=vD(this.#e),a=[];for(let e of t.operations){WD(r,e);let t=vD(this.#e);switch(e.type){case`add`:a.push(QT(this.#e,t,mE(this.#e,e.path)));break;case`remove`:a.push(QT(this.#e,t,hE(this.#e,e.path,{recursive:e.recursive})));break;case`move`:{let n=gE(this.#e,e.from,e.to,{collision:e.collision});n!=null&&a.push(QT(this.#e,t,n));break}}}let o=a.some(e=>e.projectionChanged)||this.isDirectoryProjectionVisible(n);return eE(this.#e,QT(this.#e,i,JT({affectedAncestorIds:SE(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,childEvents:a,path:yE(this.#e,n),projectionChanged:o}))),!0})}completeChildLoad(e){return Q(this.#e.instrumentation,`store.completeChildLoad`,()=>{let t=this.resolveActiveDirectoryNodeId(e.nodeId);if(t==null)return!1;let n=vD(this.#e),r=IT(this.#e,t,e.attemptId);return eE(this.#e,QT(this.#e,n,YT({affectedAncestorIds:SE(this.#e,t),affectedNodeIds:[t],attemptId:e.attemptId,path:yE(this.#e,t),projectionChanged:this.isDirectoryProjectionVisible(t),stale:!r}))),r})}failChildLoad(e,t){return Q(this.#e.instrumentation,`store.failChildLoad`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null)return!1;let r=vD(this.#e),i=RT(this.#e,n,e.attemptId,t);return eE(this.#e,QT(this.#e,r,XT({affectedAncestorIds:SE(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,errorMessage:t,path:yE(this.#e,n),projectionChanged:this.isDirectoryProjectionVisible(n),stale:!i}))),i})}cleanup(e={}){return Q(this.#e.instrumentation,`store.cleanup`,()=>{if(this.#e.transactionStack.length>0)throw Error(`Cleanup cannot run during an open batch or transaction.`);if(mD(this.#e))throw Error(`Cleanup cannot run while directory loads are active.`);let t=vD(this.#e),n=hD(this.#e,e.mode??`stable`);return eE(this.#e,QT(this.#e,t,ZT({...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=TE(this.#e,p).childIds,_=m===d?n[m]??0:0,v=_,y,b=l.get(a)??Gw(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=qw(eT(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(!Pw(EE(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=EE(this.#e,n);AT(this.#e,n,i)||(jT(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=EE(this.#e,e);if(!AT(this.#e,e,t))return!1}return!0}requireDirectoryNodeId(e){let t=CE(this.#e,e);if(t==null)throw Error(`Path does not exist: "${e}"`);if(!Pw(EE(this.#e,t)))throw Error(`Path is not a directory: "${e}"`);return t}resolveActiveDirectoryNodeId(e){try{if(!Pw(EE(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=EE(this.#e,t).parentId;if(e!==this.#e.snapshot.rootId){let n=EE(this.#e,e),r=uE(this.#e,e);if(!AT(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 WD(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 GD={compact:{itemHeight:24,factor:.8},default:{itemHeight:30,factor:1},relaxed:{itemHeight:36,factor:1.2}};function KD(e,t){if(typeof e==`number`)return{itemHeight:t??GD.default.itemHeight,factor:e};let n=GD[e??`default`];return{itemHeight:t??n.itemHeight,factor:n.factor}}var qD=GD.default.itemHeight,JD=`@layer base, theme, unsafe;
187
187
 
188
188
  @layer base {
189
189
  :host {
@@ -1826,13 +1826,13 @@ For more information, see https://radix-ui.com/primitives/docs/components/alert-
1826
1826
  }
1827
1827
  }
1828
1828
  }
1829
- `,qD=`@layer base, unsafe;`;function JD(e){return`${qD}
1829
+ `,YD=`@layer base, unsafe;`;function XD(e){return`${YD}
1830
1830
  @layer base {
1831
1831
  ${e}
1832
- }`}function YD(e){return`${qD}
1832
+ }`}function ZD(e){return`${YD}
1833
1833
  @layer unsafe {
1834
1834
  ${e}
1835
- }`}var XD=new WeakMap;function ZD(e){let t=XD.get(e);if(t!=null)return t;let n=document.createElement(`div`);n.setAttribute(GC,`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(),XD.set(e,i),i}function QD(e,t){if(!e.isConnected)return;let n=ZD(t);if(n==null)return;let r=t.querySelector(`style[${KC}]`),i=r instanceof HTMLStyleElement?r:document.createElement(`style`);r instanceof HTMLStyleElement||(i.setAttribute(KC,``),t.appendChild(i)),i.textContent=`:host { ${qC}: ${n}px; }`}var $D;function eO(e){if(typeof CSSStyleSheet<`u`&&typeof CSSStyleSheet.prototype.replaceSync==`function`&&`adoptedStyleSheets`in e){$D??($D=new CSSStyleSheet,$D.replaceSync(JD(KD)));let t=!1;try{e.adoptedStyleSheets=[$D],t=!0}catch{}if(t){e.querySelector(`style[${UC}]`)?.remove();return}}if(e.querySelector(`style[data-file-tree-style]`)==null){let t=document.createElement(`style`);t.setAttribute(UC,``),t.textContent=JD(KD),e.prepend(t)}}function tO(e,t){nO(e,t),eO(t),QD(e,t)}function nO(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`});tO(this,e)}}if(customElements.define(HC,e),typeof document<`u`)for(let e of Array.from(document.querySelectorAll(HC)))e instanceof HTMLElement&&tO(e,e.shadowRoot??e.attachShadow({mode:`open`}))}var rO=e=>e.startsWith(`f::`)?e.slice(3):e;function iO(e){let t=e.lastIndexOf(`/`);return t<0?{parentPath:``,baseName:e}:{parentPath:e.slice(0,t),baseName:e.slice(t+1)}}function aO(e,t){return e===``?t:`${e}/${t}`}function oO({files:e,path:t,isFolder:n,nextBasename:r}){let i=rO(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}=iO(i);if(a===s)return{nextFiles:e,sourcePath:i,destinationPath:i,isFolder:n};let c=aO(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 sO(e){return e.endsWith(`/`)}function cO(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 lO(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 uO(e,t){return t.includes(e)?lO(t):[e]}function dO(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 fO(e,t){return{draggedPaths:e,target:t}}function pO(e,t){if(t.kind!==`directory`||t.directoryPath==null)return!1;for(let n of e)if(sO(n)&&(t.directoryPath===n||t.directoryPath.startsWith(n)))return!0;return!1}function mO(e,t){return t.kind===`root`||t.directoryPath==null?cO(e):t.directoryPath}function hO(e,t){let n=e.map(e=>{let n=mO(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}}}var gO=Symbol(`FILE_TREE_RENAME_VIEW`);function _O(e){return e.operation===`add`||e.operation===`remove`||e.operation===`move`||e.operation===`batch`}var vO=512,yO=512;function bO(e,t){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}function xO(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 SO(e){return xO(e).at(-1)??null}function CO(e,t){return t==null?e:e.startsWith(t)?e.slice(t.length):e}var wO=e=>{let t=e.trim();return t.length===0?``:(t.includes(`\\`)?t.replaceAll(`\\`,`/`):t).toLowerCase()},TO=e=>e.toLowerCase();function EO(e){return e.endsWith(`/`)}function DO(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`);return n<0?t:t.slice(n+1)}function OO(e){return e.endsWith(`/`)?e.slice(0,-1):e}function kO(e,t){return t&&!e.endsWith(`/`)?`${e}/`:e}function AO(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 jO(e,t){if(e===t)return!0;let n=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(n)}function MO(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 jO(e,t.path)?n?e:null:e;case`move`:return AO(e,t.from,t.to);case`batch`:{let r=e;for(let e of t.events)if(r=MO(r,e,n),r==null)return null;return r}}}function NO(e){return{canonicalChanged:e.canonicalChanged,projectionChanged:e.projectionChanged,visibleCountDelta:e.visibleCountDelta}}function PO(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 FO(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(!PO(VD.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 IO(e){switch(e.operation){case`add`:return{...NO(e),operation:`add`,path:e.path};case`remove`:return{...NO(e),operation:`remove`,path:e.path,recursive:e.recursive};case`move`:return{...NO(e),from:e.from,operation:`move`,to:e.to}}}function LO(e){return{...NO(e),events:e.events.filter(e=>e.operation===`add`||e.operation===`remove`||e.operation===`move`).map(e=>IO(e)),operation:`batch`}}function RO(e){switch(e.operation){case`add`:case`remove`:case`move`:return IO(e);case`batch`:return LO(e);default:return null}}function zO(e,t,n){if(e===0)return-1;if(n!=null){let e=t(n);if(e!=null)return e;let r=xO(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 BO(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:zO(e.paths.length,r,t),getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex}}var VO=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=new Set;#z=0;#B;#V=0;#H=!1;#U=0;#W;constructor(e){let{dragAndDrop:t,fileTreeSearchMode:n,initialSearchQuery:r,initialSelectedPaths:i,renaming:a,onSearchChange:o,paths:s,preparedInput:c,...l}=e,u=FO({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.#B=this.#se(u.paths,u.preparedInput);let d=i?.map(e=>this.#Ae(e)).filter(e=>e!=null)??[],f=d.at(-1)??null;d.length>0&&(this.#R=new Set(d),this.#L=f,this.#z=1),this.#Oe(f,!1),r!=null&&this.#Se(r,!1),this.#W=this.#Fe()}destroy(){this.#W?.(),this.#W=null,this.#n.clear(),this.#t.clear(),this.#d.clear(),this.#i=null,this.#pe()}focusFirstItem(){this.#ve().length>0&&this.#Me(0)}focusLastItem(){this.#U<=0||(this.#Ne(),this.#Me(this.#U-1))}focusNextItem(){this.#De(1)}focusParentItem(){if(this.#c==null)return;let e=SO(this.#c);if(e==null)return;let t=this.#Y(e);t>=0&&this.#Me(t)}focusPath(e){let t=this.#B.getPathInfo(e)?.path??null;if(t==null)return;this.#Ne();let n=this.#Y(t);n>=0&&this.#Me(n)}focusNearestPath(e){let t=this.resolveNearestVisiblePath(e);if(t==null)return null;let n=this.#Y(t);return n>=0?(this.#Me(n),this.#ve()[n]??t):null}focusPreviousItem(){this.#De(-1)}getFocusedIndex(){return this.#s}getFocusedItem(){return this.#c==null?null:this.#X(this.#c)}getFocusedPath(){return this.#c}resolveNearestVisiblePath(e){let t=this.#ve();if(this.#U===0)return null;if(e==null)return this.#c??t[0]??null;let n=this.#B.getPathInfo(e)?.path??e,r=this.#Y(n);return r>=0?t[r]??n:this.#J(n)??this.#c??t[0]??null}getSelectedPaths(){return[...this.#R]}getSelectionVersion(){return this.#z}getVisibleCount(){return this.#U}getVisibleRows(e,t){if(t<e||this.#U===0)return[];let n=Math.max(0,e),r=Math.min(this.#U-1,t);if(r<n)return[];let i=r-n+1;if(this.#F==null&&!this.#l&&r>=this.#b.length&&i<=yO){let e=[];for(let t=n;t<=r;t+=1){let n=this.#B.getVisibleRowContext(t);if(n==null)break;e.push(this.#Q(n))}return e}if(!this.#l&&r>=this.#b.length&&this.#Ne(),this.#F!=null){let e=Array.from({length:r-n+1},(e,t)=>this.#ye(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.#B.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.#ye(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.#Z(o,i,a,{ancestorPaths:this.#te(a),path:s})})}return this.#B.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.#Z(e,r,r,{ancestorPaths:this.#te(r),path:i})})}getStickyRowCandidates(e,t){if(this.#F!=null)return null;if(this.#U===0||e<=0||t<=0)return[];let n=[];for(let r=0;r<this.#U;r+=1){let i=e+r*t,a=Math.min(this.#U-1,Math.floor(i/t)),o=this.#$(a,r)??(a>0?this.#$(a-1,r):void 0);if(o==null)break;n.push({row:this.#Q(o),subtreeEndIndex:o.subtreeEndIndex})}return n}getItem(e){let t=this.#B.getPathInfo(e);return t==null?null:this.#X(t.path,t)}selectAllVisiblePaths(){this.#Ne();let e=[...this.#ve()];this.#re(e,this.#c??this.#L)}selectOnlyPath(e){let t=this.#Ae(e);t!=null&&this.#re([t],t)}selectPath(e){let t=this.#Ae(e);t==null||this.#R.has(t)||this.#re([...this.#R,t])}deselectPath(e){let t=this.#Ae(e);t==null||!this.#R.has(t)||this.#re([...this.#R].filter(e=>e!==t))}toggleFocusedSelection(){this.#c!=null&&this.togglePathSelectionFromInput(this.#c)}togglePathSelection(e){let t=this.#Ae(e);if(t!=null){if(this.#R.has(t)){this.deselectPath(t);return}this.selectPath(t)}}togglePathSelectionFromInput(e){let t=this.#Ae(e);if(t!=null){if(this.#R.has(t)){this.#re([...this.#R].filter(e=>e!==t),t);return}this.#re([...this.#R,t],t)}}selectPathRange(e,t){let n=this.#Ae(e);if(n==null)return;this.#Ne();let r=this.#L,i=r==null?-1:this.#be(r),a=this.#be(n);if(i===-1||a===-1){let e=t?[...this.#R,n]:[n];this.#re(e,n);return}let[o,s]=i<=a?[i,a]:[a,i],c=this.#ve().slice(o,s+1),l=t?[...this.#R,...c]:c;this.#re(l,r)}extendSelectionFromFocused(e){if(this.#c==null)return;let t=this.#s;if(t===-1)return;let n=Math.min(this.#U-1,Math.max(0,t+e));if(n===t)return;!this.#l&&n>=this.#b.length&&this.#Ne();let r=this.#ve(),i=r[t]??null,a=r[n]??null;if(i==null||a==null)return;let o=new Set(this.#R);o.has(i)&&o.has(a)?o.delete(i):o.add(a),this.#re([...o],this.#L??i,!1),this.#Me(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.#Ae(e);if(t==null||this.#M!=null&&this.#M.length>0)return!1;let n=this.getSelectedPaths(),r=uO(t,n);return this.#r.canDrag?.(r)===!1?!1:(n.includes(t)||this.#re([t],t,!1),this.#je(t),this.#i={draggedPaths:r,primaryPath:t,target:null},this.#we(),!0)}setDragTarget(e){let t=this.#i;if(t==null)return;let n=e;if(n!=null){let e=fO(t.draggedPaths,n);(pO(t.draggedPaths,n)||this.#r?.canDrop?.(e)===!1)&&(n=null)}dO(t.target,n)||(this.#i={...t,target:n},this.#we())}cancelDrag(){this.#i!=null&&(this.#i=null,this.#we())}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.#we(),!1;let n=fO(e.draggedPaths,t);if(pO(e.draggedPaths,t)||this.#r?.canDrop?.(n)===!1)return this.#we(),!1;let r=hO(e.draggedPaths,t);if(r==null)return this.#we(),!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.#B.move(e.from,e.to,{collision:e.collision})}else this.#oe(r.operations),this.#B.batch(r.operations)}catch(e){return this.#we(),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.#B.add(e)}remove(e,t={}){this.#B.remove(e,t)}move(e,t,n={}){this.#B.move(e,t,n)}batch(e){this.#B.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.#Se(e,!0)}openSearch(e=``){this.#Se(e,!0)}closeSearch(){this.#Se(null,!0)}isSearchOpen(){return this.#M!==null}getSearchValue(){return this.#M??``}getSearchMatchingPaths(){return this.#k}focusNextSearchMatch(){this.#xe(1)}focusPreviousSearchMatch(){this.#xe(-1)}startRenaming(e=this.#c??``,t={}){if(!this.#w)return!1;let n=this.#B.getPathInfo(e);if(n==null)return!1;let r=n.path,i=EO(r),a=OO(r);if(this.#C?.({isFolder:i,path:a})===!1)return!1;for(let e of xO(r))this.#B.isExpanded(e)||this.#B.expand(e);return this.#re([r],r,!1),this.#M!=null&&(this.#Se(null,!1),this.#y?.(this.#M)),this.#je(r),this.#T=r,this.#E=DO(r),this.#D=t.removeIfCanceled??!1,this.#we(),!0}[gO](){return{cancel:()=>{this.#G()},commit:()=>{this.#K()},getPath:()=>this.#T,getValue:()=>this.#E,isActive:()=>this.#T!=null,setValue:e=>{this.#q(e)}}}#G(){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,EO(e)?{recursive:!0}:void 0);return}this.#je(e),this.#we()}#K(){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,EO(e)?{recursive:!0}:void 0);return}let t=EO(e),n=oO({files:this.#B.list(),isFolder:t,nextBasename:this.#E,path:OO(e)});if(this.#T=null,this.#E=``,this.#D=!1,`error`in n){this.#je(e),this.#v?.(n.error),this.#we();return}if(n.sourcePath===n.destinationPath){this.#je(e),this.#we();return}this.#_?.({destinationPath:n.destinationPath,isFolder:n.isFolder,sourcePath:n.sourcePath}),this.move(kO(n.sourcePath,t),kO(n.destinationPath,t))}#q(e){this.#T==null||this.#E===e||(this.#E=e,this.#we())}resetPaths(e,t={}){let n=this.#B.list().length,r=this.#U,i=FO({paths:e,preparedInput:t.preparedInput},`resetPaths`,this.#e.sort),a=this.#se(i.paths,i.preparedInput,t.initialExpandedPaths),o=this.#c,s=this.#T,c=this.getSelectedPaths(),l=this.#L;this.#W?.(),this.#B=a,this.#d.clear(),this.#pe();let u=c.map(e=>a.getPathInfo(e)?.path??null).filter(e=>e!=null),d=!bO(this.#R,u);this.#R=new Set(u),d&&(this.#z+=1),this.#L=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.#Oe(o,o!=null||u.length>0||this.#L!=null),this.#W=this.#Fe(),this.#we(),this.#Te({canonicalChanged:!0,operation:`reset`,pathCountAfter:i.paths.length,pathCountBefore:n,projectionChanged:!0,usedPreparedInput:t.preparedInput!=null,visibleCountDelta:this.#U-r})}#J(e){this.#Ne();let t=SO(e),n=CO(e,t),r=null,i=null;for(let e of this.#ve()){if(SO(e)!==t)continue;let a=CO(e,t);if(a<n){r=e;continue}if(a>n){i=e;break}}return r??i}#Y(e){let t=this.#be(e);if(t!==-1)return t;let n=xO(e);for(let e=n.length-1;e>=0;--e){let t=n[e];if(t==null)continue;let r=this.#be(t);if(r!==-1)return r}return this.#ve().length>0?0:-1}#X(e,t){let n=this.#d.get(e);if(n!=null)return n;let r=t??this.#B.getPathInfo(e);if(r==null)return null;let i=r.kind===`directory`?this.#ie(r.path):this.#ae(r.path);return this.#d.set(r.path,i),i}#Z(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.#R.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}}#Q(e){return this.#Z(e.row,e.index,e.index,{ancestorPaths:e.ancestorPaths,path:e.row.path,posInSet:e.posInSet,setSize:e.setSize})}#$(e,t){let n=this.#B.getVisibleRowContext(e);return n==null?void 0:n.ancestorRows[t]??(t===n.ancestorRows.length&&n.row.kind===`directory`&&n.row.isExpanded?n:void 0)}#ee(e){let t=this.#a.get(e);if(t!=null)return t;let n=this.#u(e),r=n<0?[]:[...this.#ee(n),n];return this.#a.set(e,r),r}#te(e){let t=this.#o.get(e);if(t!=null)return t;let n=this.#ee(e).map(e=>this.#b[e]??``).filter(e=>e!==``);return this.#o.set(e,n),n}#ne(e){this.#B.collapse(e)}#re(e,t=this.#L,n=!0){let r=[...new Set(e)],i=!bO(this.#R,r),a=this.#L!==t;!i&&!a||(this.#R=new Set(r),this.#L=t,i&&(this.#z+=1),n&&this.#we())}#ie(e){return{collapse:()=>{this.#ne(e)},deselect:()=>{this.deselectPath(e)},expand:()=>{this.#Ee(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!0,isExpanded:()=>this.#B.isExpanded(e),isFocused:()=>this.#c===e,isSelected:()=>this.#R.has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)},toggle:()=>{this.#Ie(e)}}}#ae(e){return{deselect:()=>{this.deselectPath(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!1,isFocused:()=>this.#c===e,isSelected:()=>this.#R.has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)}}}#oe(e){let t=this.#B.list();this.#se(t).batch(e)}#se(e,t,n){return new VD({...this.#e,paths:e,preparedInput:t??void 0,...n===void 0?{}:{initialExpandedPaths:n}})}#ce(){return this.#h??=this.#B.list(),this.#h}#le(){if(this.#m!=null)return this.#m;let e=new Set;for(let t of this.#ce()){e.add(t);for(let n of xO(t))e.add(n)}return this.#m=[...e].sort(),this.#m}#ue(){return this.#g??=this.#ce().map(TO),this.#g}#de(){return this.#f??=this.#le().filter(e=>e.endsWith(`/`)),this.#f}#fe(){return this.#p??=this.#de().map(TO),this.#p}#pe(){this.#f=null,this.#p=null,this.#m=null,this.#h=null,this.#g=null}#me(){return this.#de().filter(e=>this.#B.isExpanded(e))}#he(e){let t=new Set(this.#j??[]);if(e)for(let e of this.#R)for(let n of xO(e))t.add(n);this.#ge(t)}#ge(e){this.#H=!0;try{for(let t of this.#de()){let n=e.has(t),r=this.#B.isExpanded(t);n&&!r?this.#B.expand(t):!n&&r&&this.#B.collapse(t)}}finally{this.#H=!1}}#_e(){let e=this.#b;if(this.#k=e.filter(e=>this.#O.has(e)),this.#M==null||this.#M.length===0||this.#A!==`hide-non-matches`||this.#O.size===0){this.#F=null,this.#I=null,this.#P=null,this.#U=this.#V;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.#U=n.length}#ve(){return this.#I??this.#b}#ye(e){return this.#F?.[e]??e}#be(e){return this.#P?.get(e)??this.#B.getVisibleIndex(e)??-1}#xe(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)}#Se(e,t){let n=e==null?null:wO(e),r=this.#M;if(r!==n){if(r==null&&n!=null&&(this.#j=this.#me()),this.#M=n,n==null)this.#he(!0),this.#j=null,this.#O.clear(),this.#N=null,this.#Oe(this.#c,!0);else if(n.length===0)this.#he(!1),this.#O.clear(),this.#N=null,this.#Oe(this.#c,!0);else{let e=this.#Ce();this.#Oe(e,!0)}t&&(this.#y?.(this.#M),this.#we())}}#Ce(){if(this.#M==null||this.#M.length===0)return this.#O.clear(),this.#c;let e=this.#M,t=this.#ce(),n=this.#ue(),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.#de(),s=this.#fe();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 xO(e))l.add(t),c?.add(t)}return this.#ge(l),a??this.#c}#we(){for(let e of this.#t)e()}#Te(e){this.#n.get(e.operation)?.forEach(t=>{t(e)}),this.#n.get(`*`)?.forEach(t=>{t(e)})}#Ee(e){for(let t of xO(e))this.#B.isExpanded(t)||this.#B.expand(t);this.#B.isExpanded(e)||this.#B.expand(e)}#De(e){let t=this.#U;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.#Ne(),this.#Me(r))}#Oe(e,t=!0){let n=this.#B.getVisibleCount();this.#V=n;let r=BO(this.#B.getVisibleTreeProjectionData(t?void 0:Math.min(n,vO)),e,t?e=>this.#B.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.#_e(),this.#s=e==null?this.#ve().length>0?0:-1:this.#Y(e),this.#c=this.#s<0?null:this.#ke(this.#s)}#ke(e){return this.#ve()[e]??(this.#F==null?this.#B.getVisibleRowContext(e)?.row.path??null:null)}#Ae(e){return this.#B.getPathInfo(e)?.path??null}#je(e){if(e==null)return;let t=this.#Y(e);t>=0&&this.#Me(t,!1)}#Me(e,t=!0){let n=this.#ke(e);n!=null&&(this.#s===e&&this.#c===n||(this.#s=e,this.#c=n,t&&this.#we()))}#Ne(){this.#l||this.#Oe(this.#c,!0)}#Pe(e){let t=MO(this.#T,e);t==null&&this.#T!=null&&(this.#E=``),this.#T=t;let n=MO(this.#c,e,!0),r=[...this.#R].map(t=>MO(t,e)).filter(e=>e!=null).map(e=>this.#B.getPathInfo(e)?.path??null).filter(e=>e!=null),i=MO(this.#L,e),a=i==null?null:this.#B.getPathInfo(i)?.path??null,o=[...new Set(r)];return bO(this.#R,o)||(this.#R=new Set(o),this.#z+=1),this.#L=a,n}#Fe(){return this.#B.on(`*`,e=>{if(this.#H)return;e.canonicalChanged&&(this.#d.clear(),this.#pe()),this.#i!=null&&_O(e)&&(this.#i=null);let t=_O(e)?this.#Pe(e):this.#c,n=this.#M!=null&&this.#M.length>0?this.#Ce():this.#M===``?this.#c:t,r=this.#M!=null||e.operation!==`expand`&&e.operation!==`collapse`;this.#Oe(n,r),this.#we();let i=RO(e);i!=null&&this.#Te(i)})}#Ie(e){if(this.#B.isExpanded(e)){this.#ne(e);return}this.#Ee(e)}},HO=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 UO(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 WO(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 GO(e,t){return t?`${e}/`:e}function KO(e,t=null){let n=HO(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=UO(t.path);if(e==null)continue;let n=GO(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 WO(e.path))i.add(t)}return{directoriesWithChanges:i,ignoredDirectoryPaths:a,signature:n,statusByPath:r}}var qO,JO,YO,XO,ZO,QO,$O,ek,tk,nk,rk={},ik=[],ak=Array.isArray,ok=ik.slice,sk=Object.assign;function ck(e){e&&e.parentNode&&e.remove()}function lk(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?ok.call(arguments,2):n),uk(e,o,r,i,null)}function uk(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??++JO,__i:-1,__u:0};return i==null&&qO.vnode!=null&&qO.vnode(a),a}function dk(e){return e.children}function fk(e,t){this.props=e,this.context=t,this.__g=0}function pk(e,t){if(t==null)return e.__?pk(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`?pk(e):null}function mk(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 mk(e)}}function hk(e){(8&e.__g||!(e.__g|=8)||!YO.push(e)||ZO++)&&XO==qO.debounceRendering||((XO=qO.debounceRendering)||queueMicrotask)(gk)}function gk(){for(var e,t,n,r,i,a,o,s,c=1;YO.length;)YO.length>c&&YO.sort(QO),e=YO.shift(),c=YO.length,8&e.__g&&(n=void 0,i=(r=(t=e).__v).__e,a=[],o=[],(s=t.__P)&&((n=sk({},r)).__v=r.__v+1,qO.vnode&&qO.vnode(n),wk(s,n,r,t.__n,s.namespaceURI,32&r.__u?[i]:null,a,i??pk(r),!!(32&r.__u),o,s.ownerDocument),n.__v=r.__v,n.__.__k[n.__i]=n,Ek(a,n,o),n.__e!=i&&mk(n)));ZO=0}function _k(e,t,n,r,i,a,o,s,c,l,u,d){var f,p,m,h,g,_,v,y=r&&r.__k||ik,b=t.length;for(c=vk(n,t,y,c,b),f=0;f<b;f++)(m=n.__k[f])!=null&&(p=m.__i==-1?rk:y[m.__i]||rk,m.__i=f,_=wk(e,m,p,i,a,o,s,c,l,u,d),h=m.__e,m.ref&&p.ref!=m.ref&&(p.ref&&kk(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=yk(m,c,e,v):typeof m.type==`function`&&_!==void 0?c=_:h&&(c=h.nextSibling),m.__u&=-7);return n.__e=g,c}function vk(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?uk(null,o,null,null,null):ak(o)?uk(dk,{children:o},null,null,null):o.constructor==null&&o.__b>0?uk(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=bk(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=pk(s)),Ak(s,s));return r}function yk(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=yk(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=pk(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function bk(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 xk(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n??``}function Sk(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||xk(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||xk(e.style,t,n[t])}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace($O,`$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=ek,e.addEventListener(t,a?nk:tk,a)):e.removeEventListener(t,a?nk:tk,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 Ck(e){return function(t){if(this.__l){var n=this.__l[t.type+e];if(t.u==null)t.u=ek++;else if(t.u<n.l)return;return n(qO.event?qO.event(t):t)}}}function wk(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=qO.__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 fk(v,x),f.constructor=M,f.render=jk),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=sk({},f.__s)),sk(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=qO.__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=sk({},r,f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),E=d,d!=null&&d.type===dk&&d.key==null&&(E=Dk(d.props.children)),s=_k(e,ak(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--;)ck(a[j]);Tk(t)}else t.__e=n.__e,t.__k=n.__k,e.then||Tk(t);qO.__e(e,t,n)}else s=t.__e=Ok(n.__e,t,n,r,i,a,o,c,l,u);return(d=qO.diffed)&&d(t),128&t.__u?void 0:s}function Tk(e){e&&e.__c&&(e.__c.__g|=4),e&&e.__k&&e.__k.forEach(Tk)}function Ek(e,t,n){for(var r=0;r<n.length;r++)kk(n[r],n[++r],n[++r]);qO.__c&&qO.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){qO.__e(e,t.__v)}})}function Dk(e){return typeof e!=`object`||!e||e.__b&&e.__b>0?e:ak(e)?e.map(Dk):sk({},e)}function Ok(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&&=(qO.__m&&qO.__m(t,a),!1),a=null}if(b==null)v===y||s&&e.data==y||(e.data=y);else{if(a&&=ok.call(e.childNodes),v=n.props||rk,!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;Sk(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&&!_||Sk(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=``),_k(b==`template`?e.content:e,ak(p)?p:[p],t,n,r,b==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&pk(n,0),s,c,l),a!=null)for(u=a.length;u--;)ck(a[u]);s||(u=`value`,b==`progress`&&h==null?e.removeAttribute(`value`):h==null||h===e[u]&&(b!==`progress`||h)||Sk(e,u,h,v[u],i),u=`checked`,g!=null&&g!=e[u]&&Sk(e,u,g,v[u],i))}return e}function kk(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){qO.__e(e,n)}}function Ak(e,t,n){var r,i;if(qO.unmount&&qO.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||kk(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){qO.__e(e,t)}r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&Ak(r[i],t,n||typeof e.type!=`function`);n||ck(e.__e),e.__e&&e.__e.__l&&(e.__e.__l=null),e.__e=e.__c=e.__=null}function jk(e,t,n){return this.constructor(e,n)}function Mk(e,t){var n,r,i,a;t==document&&(t=document.documentElement),qO.__&&qO.__(e,t),r=(n=!!(e&&32&e.__u))?null:t.__k,e=t.__k=lk(dk,null,[e]),i=[],a=[],wk(t,e,r||rk,rk,t.namespaceURI,r?null:t.firstChild?ok.call(t.childNodes):null,i,r?r.__e:t.firstChild,n,a,t.ownerDocument),Ek(i,e,a)}function Nk(e,t){e.__u|=32,Mk(e,t)}qO={__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 ZO=0,e}},JO=0,fk.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=sk({},this.state);typeof e==`function`&&(e=e(sk({},n),this.props)),e&&sk(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),hk(this))},fk.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),hk(this))},fk.prototype.render=dk,YO=[],ZO=0,QO=function(e,t){return e.__v.__b-t.__v.__b},$O=/(PointerCapture)$|Capture$/i,ek=0,tk=Ck(!1),nk=Ck(!0);var Pk=0;Array.isArray;function $(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:--Pk,__i:-1,__u:0,__source:i,__self:a};return qO.vnode&&qO.vnode(l),l}var Fk=16,Ik=16,Lk={};function Rk({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}=Lk[e]??{width:Fk,height:Ik},f=r??l,p=i??u,m=a??d??`0 0 ${l} ${u}`;return $(`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:$(`use`,{href:c})})}var zk=e=>{if(e.length<2)return[e,``];let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]},Bk=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)]},Vk=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)]},Hk=(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)]},Uk=(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)]},Wk=(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 Gk({children:e,marker:t,variant:n=`default`}){"use no memo";return $(`div`,{"aria-hidden":!0,"data-truncate-marker-cell":!0,children:$(`div`,{"data-truncate-marker":!0,children:typeof t==`function`?t({children:e}):n===`fade`?$(`span`,{"data-truncate-fade":!0}):t})})}function Kk(e){"use no memo";let{mode:t,children:n}=e;return $(`div`,{children:[$(`div`,{"data-truncate-content":`visible`,children:t===`fruncate`?$(`span`,{children:n}):n}),$(`div`,{"data-truncate-content":`overflow`,"aria-hidden":!0,children:t===`fruncate`?$(`span`,{children:n}):n})]})}function qk({children:e,mode:t=`truncate`,marker:n=`…`,variant:r=`default`,...i}){"use no memo";let a=$(Kk,{mode:t,children:e},`content`),o=$(Gk,{marker:n,mode:t,variant:r},`marker`),s=$(`div`,{"data-truncate-fill":!0},`fill`);return $(`div`,{"data-truncate-container":t,"data-truncate-variant":r,...i,children:$(`div`,{"data-truncate-grid":!0,children:t===`truncate`?[a,o]:[o,a,s]})})}function Jk({children:e,...t}){"use no memo";return $(qk,{mode:`truncate`,...t,children:e})}function Yk({children:e,...t}){"use no memo";return $(qk,{mode:`fruncate`,...t,children:e})}function Xk({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=$(Jk,{...s,children:t[0]}),l=$(Yk,{...s,children:t[1]})}else{if(typeof e!=`string`)return console.error(`MiddleTruncate: children must be a string`),null;if(e.length===0)return $(`div`,{className:a,style:o});if(e.length<i)return $(n===`end`?Yk:Jk,{...s,className:a,style:o,children:e});let t=null,u=null,d=null;if(typeof r==`string`)r===`center`?t=zk:r===`extension`?t=Bk:r===`leaf-path`&&(t=Vk);else if(typeof r==`number`)t=Hk,u=r;else if(Array.isArray(r)){let[e,n]=r;d=n,e===`last`?t=Uk:e===`first`&&(t=Wk)}else typeof r==`function`&&(t=r);t??=zk;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=$(Jk,{...s,..._,children:f}),l=$(Yk,{...s,...v,children:p})}return $(`div`,{"data-truncate-group-container":`middle`,className:a,style:o,children:[$(`div`,{"data-truncate-segment-priority":n===`start`||n===`equal`?`1`:`2`,children:c}),$(`div`,{"data-truncate-segment-priority":n===`end`||n===`equal`?`1`:`2`,children:l})]})}var Zk={endIndex:-1,startIndex:-1};function Qk(e,t,n){return Math.min(Math.max(e,t),n)}function $k(e,t){return e<0||t<e?Zk:{endIndex:t,startIndex:e}}function eA(e){return e.startIndex<0||e.endIndex<e.startIndex}function tA(e,t){return eA(e)?0:(e.endIndex-e.startIndex+1)*t}function nA(e,t,n){if(t<=0)return-1;let r=t*n;return e<=0?0:e>=r?t:Math.floor(e/n)}function rA(e,t,n){return t<=0||e<=0?-1:e>=t*n?t-1:Math.ceil(e/n)-1}function iA(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 aA(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 oA(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 sA(e,t,n){if(e.length===0||t<=0)return[];let r=oA(e),i=iA(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=aA(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 cA(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=Qk(t.scrollTop,0,o),c=t.stickyRows??sA(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=nA(s,n,t.itemHeight),m=nA(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?Zk:$k(m,rA(u+d,n,t.itemHeight)),y=g+1,b=eA(v)?Zk:$k(Math.max(y,v.startIndex-a),Math.min(n-1,v.endIndex+a)),x=tA(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:eA(b)?0:b.startIndex*t.itemHeight,startIndex:b.startIndex}}}var lA={added:`A`,deleted:`D`,ignored:null,modified:`M`,renamed:`R`,untracked:`U`},uA={added:`Git status: added`,deleted:`Git status: deleted`,ignored:`Git status: ignored`,modified:`Git status: modified`,renamed:`Git status: renamed`,untracked:`Git status: untracked`},dA=`Contains git status items`;function fA(e){let{renamingPath:t,previousRenamingPath:n,hasRenderedInput:r}=e;return t==null?`reset`:r?n===t?`ignore`:`focus-input`:`reveal-canonical`}function pA(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 mA(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}}function hA(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 gA(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}var _A,vA,yA,bA,xA=Object.is,SA=0,CA=[],wA=qO,TA=wA.__b,EA=wA.__r,DA=wA.diffed,OA=wA.__c,kA=wA.unmount,AA=wA.__;function jA(e,t){wA.__h&&wA.__h(vA,e,SA||t),SA=0;var n=vA.__H||={__:[],__h:[]};return e>=n.__.length&&n.__.push({}),n.__[e]}function MA(e){return SA=1,NA(GA,e)}function NA(e,t,n){var r=jA(_A++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):GA(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);xA(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=vA,!vA.__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,xA(t,e.__[0])||(o=!0)}}),a&&a.call(this,e,t,n)||o};vA.__f=!0;var a=vA.shouldComponentUpdate,o=vA.componentWillUpdate;vA.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)},vA.shouldComponentUpdate=i}return r.__N||r.__}function PA(e,t){var n=jA(_A++,3);!wA.__s&&WA(n.__H,t)&&(n.__=e,n.u=t,vA.__H.__h.push(n))}function FA(e,t){var n=jA(_A++,4);!wA.__s&&WA(n.__H,t)&&(n.__=e,n.u=t,vA.__h.push(n))}function IA(e){return SA=5,LA(function(){return{current:e}},[])}function LA(e,t){var n=jA(_A++,7);return WA(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function RA(e,t){return SA=8,LA(function(){return e},t)}function zA(){for(var e;e=CA.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(HA),e.__H.__h.forEach(UA),e.__H.__h=[]}catch(t){e.__H.__h=[],wA.__e(t,e.__v)}}wA.__b=function(e){vA=null,TA&&TA(e)},wA.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),AA&&AA(e,t)},wA.__r=function(e){EA&&EA(e),_A=0;var t=(vA=e.__c).__H;t&&(yA===vA?(t.__h=[],vA.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(HA),t.__h.forEach(UA),t.__h=[],_A=0)),yA=vA},wA.diffed=function(e){DA&&DA(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(CA.push(t)!==1&&bA===wA.requestAnimationFrame||((bA=wA.requestAnimationFrame)||VA)(zA)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),yA=vA=null},wA.__c=function(e,t){t.some(function(e){try{e.__h.forEach(HA),e.__h=e.__h.filter(function(e){return!e.__||UA(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],wA.__e(n,e.__v)}}),OA&&OA(e,t)},wA.unmount=function(e){kA&&kA(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{HA(e)}catch(e){t=e}}),n.__H=void 0,t&&wA.__e(t,n.__v))};var BA=typeof requestAnimationFrame==`function`;function VA(e){var t,n=function(){clearTimeout(r),BA&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);BA&&(t=requestAnimationFrame(n))}function HA(e){var t=vA,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),vA=t}function UA(e){var t=vA;e.__c=e.__(),vA=t}function WA(e,t){return!e||e.length!==t.length||t.some(function(t,n){return!xA(t,e[n])})}function GA(e,t){return typeof t==`function`?t(e):t}function KA(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 qA(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 JA({ariaLabel:e,isFlattened:t=!1,ref:n,value:r,onBlur:i,onInput:a}){return $(`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 YA(e,t=null,n=null){"use no memo";let r=e.flattenedSegments;return r==null||r.length===0?t??e.name:$(`span`,{"data-item-flattened-subitems":!0,children:r.map((e,i)=>{let a=i===r.length-1;return $(dk,{children:[$(`span`,{"data-item-flattened-subitem":e.path,"data-item-flattened-subitem-drag-target":n===e.path?`true`:void 0,children:a&&t!=null?t:$(Jk,{children:e.name})}),i<r.length-1?` / `:``]},e.path)})})}function XA(e){return e.isFlattened?e.flattenedSegments?.findLast(e=>e.isTerminal)?.path??e.path:e.path}function ZA(e){let t=e.flattenedSegments;return t==null||t.length===0?e.name:t.map(e=>e.name).join(` / `)}function QA(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 $A({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=cA(c,{itemHeight:t,overscan:n,scrollTop:r,stickyRows:s==null?void 0:QA(s,r,t,o),totalRowCount:o,viewportHeight:a}),u=i&&r<=0&&o>0?e.getStickyRowCandidates(1,t):[],d=u!=null&&r<=0?QA(u,1,t,o):i&&r<=0&&c.length>0?sA(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 ej=400,tj=10,nj=40,rj=18;function ij(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))?aj(e,t,n):a instanceof HTMLElement?a:null}function aj(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 oj(e){let t=e?.closest?.(`[data-type="item"]`);if(!(t instanceof HTMLElement))return null;let n=t.dataset.itemPath??null;if(n==null)return null;let r=e?.closest?.(`[data-item-flattened-subitem]`),i=r instanceof HTMLElement?r.getAttribute(`data-item-flattened-subitem`)??null:null;if(i!=null&&i.endsWith(`/`))return{directoryPath:i,flattenedSegmentPath:i,hoveredPath:n,kind:`directory`};if(t.dataset.itemType===`folder`)return{directoryPath:n,flattenedSegmentPath:null,hoveredPath:n,kind:`directory`};let a=t.dataset.itemParentPath??null;return a==null||a.length===0?{directoryPath:null,flattenedSegmentPath:null,hoveredPath:n,kind:`root`}:{directoryPath:a,flattenedSegmentPath:null,hoveredPath:n,kind:`directory`}}function sj(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 cj(){return navigator.vendor!==`Apple Computer, Inc.`}function lj(e,t){let n=e-t.top;if(n<nj)return-Math.ceil((nj-Math.max(0,n))/nj*rj);let r=t.bottom-e;return r<nj?Math.ceil((nj-Math.max(0,r))/nj*rj):0}function uj(e,t){if(e!=null){let t=lA[e];return t==null?null:{text:t,title:uA[e]}}return t?{icon:{name:`file-tree-icon-dot`,width:6,height:6},title:dA}:null}function dj(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 fj(e){return e!=null&&`toggle`in e}function pj(e){return e.code===`Space`||e.key===` `||e.key===`Spacebar`}function mj(e){return e.key.length===1&&/^[\p{L}\p{N}]$/u.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey}function hj(e,t){if(e==null)return t;let n=e.getBoundingClientRect().height;return n>0?n:e.clientHeight>0?e.clientHeight:t}function gj(e,t){return e!=null&&e>0?e:t}function _j(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 vj(e,t,n,r,i=0){let a=hA({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,topInset:i,viewportHeight:r});return a==null?!1:(e.scrollTop=a,!0)}function yj(e,t,n,r,i,a){let o=gA({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,targetViewportOffset:a,totalHeight:i,viewportHeight:r});return o==null?!1:(e.scrollTop=o,!0)}function bj(e,t,n,r){return n.end<n.start?null:e<n.start?-t:e>n.end?r:null}function xj(e){return e==null?``:`[data-item-section="spacing-item"][data-ancestor-path="${e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}"] { opacity: 1; }`}function Sj(e){return e.shiftKey&&e.key===`F10`||e.key===`ContextMenu`}function Cj(e,t){return t&&Sj(e)||(e.ctrlKey||e.metaKey)&&pj(e)?!0:e.key===`ArrowDown`||e.key===`ArrowLeft`||e.key===`ArrowRight`||e.key===`ArrowUp`}var wj=new Set([`ArrowDown`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`]);function Tj(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 Ej(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 Dj(e,t){return{bottom:t,height:0,left:e,right:e,top:t,width:0,x:e,y:t}}function Oj(e,t){if(e==null)return t.offsetTop;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.top-r.top}function kj(e,t,n){if(n==null){e.delete(t);return}e.set(t,n)}function Aj(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 jj(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 Mj(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 Nj(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=Mj(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 Pj(e,t){return{kind:e.kind,name:ZA(e),path:t}}function Fj(e){return e==null?void 0:`${e}__tree`}function Ij(e,t,n){if(e!=null)return`${e}__focused-item-${encodeURIComponent(t)}${n?`__parked`:``}`}function Lj(e){return e===`file-tree-icon-chevron`||e===`file-tree-icon-dot`||e===`file-tree-icon-file`||e===`file-tree-icon-lock`}function Rj(e,t){if(e==null)return null;if(`text`in e)return $(`span`,{title:e.title,children:e.text});let n=typeof e.icon==`string`?Lj(e.icon)?t(e.icon):{name:e.icon}:Lj(e.icon.name)?(()=>{let n=t(e.icon.name),{name:r,...i}=e.icon;return{...n,...i}})():e.icon;return $(`span`,{title:e.title,children:$(Rk,{...n})})}function zj(e){e!=null&&KA(e.querySelector([`button:not([disabled])`,`[href]`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`, `))??e)}function Bj(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=XA(e);return $(dk,{children:[e.depth>0?$(`div`,{"data-item-section":`spacing`,children:Array.from({length:e.depth}).map((t,n)=>$(`div`,{"data-item-section":`spacing-item`,"data-ancestor-path":e.ancestorPaths[n]},n))}):null,$(`div`,{"data-item-section":`icon`,children:e.kind===`directory`?$(Rk,{...t(`file-tree-icon-chevron`)}):$(Rk,{...t(`file-tree-icon-file`,u)})}),$(`div`,{"data-item-section":`content`,children:e.isFlattened?YA(e,c,a):c??$(Xk,{minimumLength:5,split:`extension`,children:e.name})}),i?$(`div`,{"data-item-section":`decoration`,children:r==null?null:Rj(r,t)}):null,s?$(`div`,{"data-item-section":`git`,children:Rj(o,t)}):null,n?$(`div`,{"data-item-section":`action`,children:l?$(`span`,{"aria-hidden":`true`,"data-item-action-affordance":`decorative`,children:$(Rk,{...t(`file-tree-icon-ellipsis`)})}):null}):null]})}function Vj(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=XA(t),{isParked:F=!1,mode:I=`flow`,style:ee}=r,L=I===`sticky`,R=_?.get(P)??null??dj(t.ancestorPaths,v,y),z=t.kind===`directory`&&(b?.has(P)??!1),B=A(t,P),V=uj(R,z),H=S&&w,te=B!=null||x||H,ne=H&&T===`always`,re=a.getPath()===P,U=re?a.getValue():``,W=L||!re?null:$(JA,{ref:D,ariaLabel:`Rename ${ZA(t)}`,isFlattened:t.isFlattened,value:U,onBlur:()=>{a.commit()},onInput:e=>{a.setValue(e.currentTarget.value)}}),G=Bj(t,k,{actionLaneEnabled:H,customDecoration:B,decorationLaneEnabled:te,dragTargetFlattenedSegmentPath:l?.flattenedSegmentPath??null,gitDecoration:V,gitLaneActive:x,renameInput:W,showDecorativeActionAffordance:ne}),ie={...pA({ariaLabel:ZA(t),domId:t.isFocused?Ij(h,P,F):void 0,extraStyle:ee,features:{actionLaneEnabled:H,contextMenuButtonVisibility:H?T:null,contextMenuEnabled:S,contextMenuTriggerMode:S?C:null,gitLaneActive:x},isParked:F,itemHeight:g,mode:I,row:t,state:{containsGitChange:z,effectiveGitStatus:R,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.focusPath(P),j(t,P,{anchorRect:Dj(e.clientX,e.clientY),source:`right-click`})))}:void 0,onFocus:L?void 0:()=>{i.focusPath(P)},onKeyDown:L?void 0:N,ref:e=>{O(P,e)}};return!L&&re?$(`div`,{...ie,children:G}):$(`button`,{...ie,type:`button`,draggable:u&&!F,onDragEnd:u&&!F?p:void 0,onDragStart:u&&!F?e=>{f(e,t,P)}:void 0,onMouseDown:e=>{if(L){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:G})}function Hj(e,t,n){return t.end<t.start?[]:e.controller.getVisibleRows(t.start,t.end).filter(e=>!n.has(XA(e))).map((n,r)=>Vj(e,n,t.start+r))}function Uj({composition:e,controller:t,gitStatusByPath:n,ignoredGitDirectories:r,directoriesWithGitChanges:i,icons:a,instanceId:o,itemHeight:s=GD,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 _=IA(null),v=IA(null),y=IA(!1),b=IA(null),x=IA(null),S=IA(null),C=IA(null),w=IA(null),T=IA(new Map),E=IA(new Map),D=IA(()=>{}),O=IA(null),k=IA(!1),A=IA(null),j=IA(null),M=IA(!1),N=IA(null),P=IA(null),F=IA(null),I=IA(null),ee=IA(null),L=IA(null),R=IA(null),z=IA(null),B=IA(!1),V=IA(null),H=IA(null),te=IA(null),ne=IA(null),re=LA(()=>new Map,[]),[,U]=MA(0),[W,G]=MA(null),[ie,ae]=MA(null),[oe,K]=MA(null),[q,se]=MA(null),[J,ce]=MA(0),[le,ue]=MA(null),de=IA(le);de.current=le;let fe=IA(null),pe=IA(null),me=IA(null),he=IA(null),ge=IA(null),_e=IA(!1),ve=()=>{pe.current=null,me.current=null,he.current=null},ye=(e,t)=>{pe.current=e,me.current=null,he.current=t==null?null:{path:e,scrollTop:t}},be=(e,t)=>{pe.current=null,me.current={path:e,viewportOffset:t},he.current=null},xe=IA(d===`retain`&&t.isSearchOpen()),[Se,Ce]=MA(p);PA(()=>{p||Ce(!1)},[p]);let we=IA(!1),Te=RA(()=>{we.current=!0,Ce(e=>e&&!1)},[]),[Ee,De]=MA(()=>$A({controller:t,itemHeight:s,overscan:c,scrollTop:0,stickyFolders:h,viewportHeight:g})),[Oe,ke]=MA(!1);PA(()=>{ke(!0)},[]);let Ae=e?.contextMenu?.enabled===!0||e?.contextMenu?.render!=null||e?.contextMenu?.onOpen!=null||e?.contextMenu?.onClose!=null,je=e?.contextMenu?.triggerMode??(Ae?`right-click`:`both`),Me=je===`both`||je===`button`,Ne=e?.contextMenu?.buttonVisibility??`when-needed`,Pe=je===`both`||je===`right-click`;FA(()=>{let e=S.current;if(e==null)return;let t=e=>{if(!(e instanceof CustomEvent))return;let t=e.detail?.path??null;ge.current=t,ae(t),se(t==null?null:`pointer`)},n=e=>{e instanceof CustomEvent&&(_e.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 Fe=RA((e,t)=>{kj(T.current,e,t)},[]),Ie=RA((e,t)=>{kj(E.current,e,t)},[]),Le=RA(e=>{x.current=e},[]),Re=RA(e=>Aj(e,E.current,T.current),[]),ze=n!=null||r!=null||i!=null,{resolveIcon:Be}=LA(()=>rw(a),[a]),Ve=t[gO](),He=Ve.getPath(),Ue=He!=null,We=t.isSearchOpen(),Ge=t.getSearchValue(),Ke=t.getFocusedPath(),qe=t.getFocusedIndex(),Je=t.isDragAndDropEnabled(),Ye=t.getDragSession(),Xe=LA(()=>Ye==null?null:new Set(Ye.draggedPaths),[Ye]),Ze=Ye?.target??null,Qe=Ye?.primaryPath??null,$e=Fj(o),{overlayHeight:et,overlayRows:tt,snapshot:nt,visibleRows:rt}=Ee,it=nt.physical.viewportHeight,at=LA(()=>({end:nt.window.endIndex,start:nt.window.startIndex}),[nt.window.endIndex,nt.window.startIndex]),ot=tt,st=nt.sticky.rows,ct=nt.physical.totalHeight,lt=nt.sticky.height,ut=LA(()=>new Set(st.map(e=>XA(e.row))),[st]),dt=qe>=0&&qe>=at.start&&qe<=at.end,ft=RA((e,t)=>u?.({item:Pj(e,t),row:e})??null,[u]),pt=RA(e=>KA(e==null?null:T.current.get(e)??null)?!0:KA(S.current),[]),mt=RA(e=>{pt(t.focusNearestPath(e))},[t,pt]),ht=IA(mt);ht.current=mt;let gt=IA(!0),_t=IA(()=>{}),vt=RA((t=!0)=>{let n=de.current;n!=null&&(gt.current=gt.current&&t,ue(null),e?.contextMenu?.onClose?.(),gt.current&&mt(n.path))},[e?.contextMenu,mt]);_t.current=vt;let yt=RA(e=>{let t=e==null?null:Oj(S.current,e);K(e=>e===t?e:t)},[]),bt=RA((e,n,r)=>{let i=t.getItem(n);if(i==null)return;let a=Re(n);if(a?.dataset.fileTreeStickyRow===`true`){let e=C.current;ye(n,e?.scrollTop??null),k.current=!0,G(e=>e===n?e:n)}i.focus(),yt(a),gt.current=!0,ue({anchorRect:r?.anchorRect??null,item:Pj(e,n),path:n,source:r?.source??`keyboard`})},[t,Re,yt]),xt=RA(e=>{if(l){if(t.isSearchOpen()){let e=C.current,t=hj(e,it);N.current=qe<0||e==null?null:Math.max(0,Math.min(qe*s-e.scrollTop,Math.max(0,t-s))),M.current=!0}t.startRenaming(e)!==!1&&(se(`focus`),U(e=>e+1))}},[t,qe,s,l,it]),St=RA((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=hj(i,it),u=t.getVisibleCount()*s,d=r===`sticky-parents`?o.ancestorPaths.length*s:$A({controller:t,itemHeight:s,overscan:c,scrollTop:i.scrollTop,stickyFolders:h,viewportHeight:l}).snapshot.sticky.height;return k.current=!0,yj(i,a,s,l,u,d),D.current(),fe.current=n?e:null,!0},[t,s,c,it,h]),Ct=()=>y.current===!0||ne.current!=null||B.current===!0,wt=e=>typeof window.requestAnimationFrame==`function`?window.requestAnimationFrame(()=>{e()}):window.setTimeout(e,16),Tt=e=>{if(e!=null){if(typeof window.cancelAnimationFrame==`function`){window.cancelAnimationFrame(e);return}window.clearTimeout(e)}},Et=()=>{I.current!=null&&(clearTimeout(I.current),I.current=null),F.current=null},Dt=()=>{L.current?.remove(),L.current=null},Ot=()=>{Tt(P.current),P.current=null,ee.current=null},kt=e=>{let t=S.current?.getRootNode();if(t instanceof ShadowRoot){t.append(e);return}document.body.append(e)},At=()=>{z.current?.(),z.current=null,ne.current!=null&&(clearTimeout(ne.current),ne.current=null),B.current=!1,V.current=null,te.current=null,H.current!=null&&(H.current.setAttribute(`draggable`,`true`),H.current.style.removeProperty(`touch-action`),H.current=null),Dt(),Et(),Ot(),R.current=null},jt=(e,n)=>{let r=S.current?.getRootNode(),i=oj(ij(r instanceof ShadowRoot?r:document,e,n));return t.setDragTarget(i),t.getDragSession()?.target??null},Mt=e=>{let n=t.getDragAndDropConfig()?.openOnDropDelay??800;if(e==null||e.kind!==`directory`||e.directoryPath==null||n<=0){Et();return}let r=t.getItem(e.directoryPath),i=fj(r)?r:null;if(i==null||i.isExpanded()){Et();return}let a=`${e.directoryPath}::${e.flattenedSegmentPath??``}`;F.current!==a&&(Et(),F.current=a,I.current=setTimeout(()=>{let n=t.getDragSession()?.target;n?.kind!==`directory`||n.directoryPath!==e.directoryPath||n.flattenedSegmentPath!==e.flattenedSegmentPath||i.expand()},n))},Nt=()=>{P.current=null;let e=ee.current,n=C.current;if(e==null||n==null||t.getDragSession()==null)return;let r=n.getBoundingClientRect(),i=lj(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()),Mt(jt(e.clientX,e.clientY)),P.current=wt(Nt)},Pt=(e,t)=>{ee.current={clientX:e,clientY:t},P.current??=wt(Nt)},Ft=(e,n,r)=>{let i=e.currentTarget;if(i!=null){if(At(),Dt(),Et(),Ot(),t.startDrag(r)===!1){e.preventDefault();return}if(R.current=n,e.dataTransfer!=null&&(e.dataTransfer.effectAllowed=`move`,e.dataTransfer.dropEffect=`move`,e.dataTransfer.setData(`text/plain`,r),cj())){let t=sj(i),n=i.getBoundingClientRect();Object.assign(t.style,{height:`${n.height}px`,opacity:`0.85`,transform:`translate3d(-9999px, 0px, 0)`,width:`${n.width}px`}),kt(t),L.current=t,e.dataTransfer.setDragImage(t,Math.max(0,e.clientX-n.left),Math.max(0,e.clientY-n.top))}}},It=()=>{Dt(),Et(),Ot(),R.current=null,t.cancelDrag()},Lt=(e,n,r)=>{if(ne.current!=null||B.current)return;let i=e.touches[0],a=e.currentTarget;if(i==null||a==null)return;te.current={clientX:i.clientX,clientY:i.clientY},H.current=a,a.setAttribute(`draggable`,`false`);let o=(e={})=>{let t=e.restoreNativeDraggable??!B.current;ne.current!=null&&(clearTimeout(ne.current),ne.current=null),document.removeEventListener(`touchmove`,s),document.removeEventListener(`touchend`,c),document.removeEventListener(`touchcancel`,c),z.current===o&&(z.current=null),t&&(a.setAttribute(`draggable`,`true`),H.current===a&&(H.current=null),te.current=null)},s=e=>{let t=e.touches[0],n=te.current;if(t==null||n==null)return;let r=t.clientX-n.clientX,i=t.clientY-n.clientY;r*r+i*i<=tj*tj||o()},c=()=>{o()};document.addEventListener(`touchmove`,s,{passive:!0}),document.addEventListener(`touchend`,c),document.addEventListener(`touchcancel`,c),z.current=o,ne.current=setTimeout(()=>{if(o({restoreNativeDraggable:!1}),t.startDrag(r)===!1){a.setAttribute(`draggable`,`true`),H.current===a&&(H.current=null),te.current=null;return}B.current=!0,H.current=a,a.setAttribute(`draggable`,`false`),a.style.setProperty(`touch-action`,`none`),R.current=n;let e=a.getBoundingClientRect(),s=sj(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`}),kt(s),L.current=s,V.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=V.current;n!=null&&L.current!=null&&(L.current.style.transform=`translate3d(${t.clientX-n.x}px, ${t.clientY-n.y}px, 0)`),Mt(jt(t.clientX,t.clientY)),Pt(t.clientX,t.clientY)},l=e=>{let n=e.changedTouches[0];n!=null&&jt(n.clientX,n.clientY),t.completeDrag(),At()},u=()=>{t.cancelDrag(),At()};z.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)},ej)},Rt=e=>{if(le!=null){if(e.key===`Escape`){vt(),e.preventDefault(),e.stopPropagation();return}wj.has(e.key)&&(e.preventDefault(),e.stopPropagation());return}if(Ve.isActive()){if(e.key===`Escape`)Ve.cancel();else if(e.key===`Enter`)Ve.commit();else return;se(`focus`),U(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(l&&e.key===`F2`){xt(Ke??void 0),e.preventDefault(),e.stopPropagation();return}if(We){if(e.key===`Escape`)M.current=!1,N.current=null,t.closeSearch();else if(e.key===`Enter`){let e=t.getFocusedPath();e!=null&&t.selectOnlyPath(e);let n=C.current,r=hj(n,it);N.current=qe<0||n==null?null:Math.max(0,Math.min(qe*s-n.scrollTop,Math.max(0,r-s))),M.current=!0,t.closeSearch()}else if(e.key===`ArrowDown`)t.focusNextSearchMatch();else if(e.key===`ArrowUp`)t.focusPreviousSearchMatch();else return;se(`focus`),U(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(f&&mj(e)){t.openSearch(e.key),U(e=>e+1),e.preventDefault(),e.stopPropagation();return}let n=Ae&&Sj(e),r=Cj(e,Ae),i=r&&S.current!=null?qA(S.current):null,a=r?new Set(jj(S.current)):new Set,o=i?.dataset.fileTreeStickyPath??null,c=i?.dataset.fileTreeStickyRow===`true`&&o!=null;if(c&&o!==Ke&&a.has(o)){let e=C.current;ye(o,e?.scrollTop??null),t.focusPath(o)}let u=t.getFocusedPath(),d=t.getFocusedIndex(),p=t.getFocusedItem();if(p==null)return;let m=fj(p)?p:null,h=u!=null&&(ut.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=Aj(u,E.current,T.current);e==null||n==null?y=!1:bt(e,u)}else if((e.ctrlKey||e.metaKey)&&pj(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;se(`focus`);let b=t.getFocusedPath(),x=b!=null&&(ut.has(b)||a.has(b)),w=g&&b!==u,D=n&&c&&o===u&&b===u;if((h||D)&&b!=null&&(w&&x||D))ye(b,v?.scrollTop??null),k.current=!0,G(e=>e===b?e:b);else{let t=e.key===`ArrowUp`&&h&&b!==u;b!=null&&(t||_&&b===u)?(be(b,Nj(S.current,v,i,u,s,lt,it)),k.current=!0,G(e=>e===b?e:b)):ve()}U(e=>e+1),e.preventDefault(),e.stopPropagation()};FA(()=>{if(!(!f||!We)){if(xe.current){xe.current=!1;return}KA(w.current)}},[We,f]),FA(()=>{let e=x.current;switch(fA({hasRenderedInput:e!=null,previousRenamingPath:j.current,renamingPath:He})){case`reset`:j.current=null;return;case`reveal-canonical`:He!=null&&St(He,{restoreTreeFocus:!1,targetOffset:`live-overlay`});return;case`ignore`:return;case`focus-input`:e!=null&&(fe.current=null,j.current=He,KA(e),e.select());return}},[at.end,at.start,He,St,ut]),FA(()=>{let e=S.current;if(e==null)return;let t=null,n=()=>{t!=null&&(clearTimeout(t),t=null)},r=()=>{let t=qA(e)?.dataset.itemPath??null;G(e=>e===t?e:t)},i=()=>{n(),k.current=!0,r()},a=i=>{let a=i.relatedTarget;if(a==null){n(),t=setTimeout(()=>{if(t=null,qA(e)!=null){r();return}k.current=!1,G(null)},0);return}if(!(a instanceof Node)||!e.contains(a)){n(),k.current=!1,G(null);return}let o=a instanceof HTMLElement?a.dataset.itemPath??null:null;G(e=>e===o?e:o)};return e.addEventListener(`focusin`,i),e.addEventListener(`focusout`,a),()=>{n(),e.removeEventListener(`focusin`,i),e.removeEventListener(`focusout`,a)}},[]),FA(()=>{let e=S.current;e!=null&&(nt.physical.scrollTop<=0?e.dataset.scrollAtTop=`true`:delete e.dataset.scrollAtTop)},[nt.physical.scrollTop]),FA(()=>{let e=null,n=C.current,r=b.current,i=S.current;if(n==null)return;O.current=hj(n,g);let a=()=>{let e=t.getVisibleCount(),r=gj(O.current,g),i=Math.max(0,e*s-r);n.scrollTop>i&&(n.scrollTop=i),De($A({controller:t,itemHeight:s,overscan:c,scrollTop:Math.min(n.scrollTop,i),stickyFolders:h,viewportHeight:r}))};D.current=a;let o=!1,l=t.subscribe(()=>{o?U(e=>e+1):o=!0,a()}),u=()=>{_e.current!==!0&&(r!=null&&(r.dataset.isScrolling??=``),i!=null&&(i.dataset.isScrolling??=``),y.current=!0,e!=null&&clearTimeout(e),e=setTimeout(()=>{r!=null&&delete r.dataset.isScrolling,i!=null&&delete i.dataset.isScrolling,y.current=!1,ce(e=>e+1),e=null},50))},d=null,f=()=>{i!=null&&delete i.dataset.overlayReveal,d!=null&&(clearTimeout(d),d=null)},p=()=>{i==null||_e.current===!0||n.scrollTop>0||(i.dataset.overlayReveal=`true`,d!=null&&clearTimeout(d),d=setTimeout(()=>{f()},200))},m=()=>{if(a(),n.scrollTop>0&&f(),de.current!=null&&y.current&&_t.current(),_e.current===!0){y.current=!1;return}ae(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:_j(e[0]))??hj(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]),FA(()=>{Ae||le==null||vt(!1)},[vt,Ae,le]);let zt=LA(()=>le==null?null:`${le.path}::${le.source}`,[le]);FA(()=>{if(zt==null){m?.clearSlotContent(YC);return}let t=de.current;if(t==null)return;let n=v.current??_.current;if(n==null)return;let r={anchorElement:n,anchorRect:t.anchorRect??Ej(n.getBoundingClientRect()),close:e=>{_t.current(e?.restoreFocus??!0)},restoreFocus:()=>{gt.current&&ht.current(de.current?.path??null)}},i=e?.contextMenu?.render?.(t.item,r)??null;return m?.setSlotContent(YC,i),e?.contextMenu?.onOpen?.(t.item,r),zj(i),queueMicrotask(()=>{i==null||!i.isConnected||document.activeElement===i&&zj(i)}),()=>{m?.clearSlotContent(YC)}},[zt,e?.contextMenu,m]),FA(()=>{le!=null&&t.getItem(le.path)==null&&vt()},[vt,le,t]),FA(()=>{if(le==null)return;let e=S.current?.getRootNode(),t=e instanceof ShadowRoot?e.host:S.current,n=e=>{let n=e.target;n instanceof Node&&(Tj(e)||_.current?.contains(n)!==!0&&t?.contains(n)!==!0&&vt())},r=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),vt())};return document.addEventListener(`mousedown`,n,!0),document.addEventListener(`keydown`,r,!0),()=>{document.removeEventListener(`mousedown`,n,!0),document.removeEventListener(`keydown`,r,!0)}},[vt,le]),FA(()=>{let e=C.current,t=S.current;if(e==null||t==null){A.current=Ke;return}let n=Ke==null?null:T.current.get(Ke)??null,r=qA(t),i=r?.dataset.itemPath??null,a=Ue&&x.current===r,o=f&&w.current===r,c=M.current&&!We,l=N.current??0,u=fe.current,d=pe.current,p=me.current,m=he.current,h=r!=null,g=k.current||h,_=A.current!==Ke,v=d!=null&&d===Ke&&Ke!=null,y=c&&yj(e,qe,s,it,ct,l),b=u!=null&&u===Ke&&yj(e,qe,s,it,ct,lt),E=p!=null&&p.path===Ke&&yj(e,qe,s,it,ct,p.viewportOffset),O=m!=null&&m.path===Ke&&e.scrollTop!==m.scrollTop;if(O&&(e.scrollTop=m.scrollTop),(O||b||E||y||g&&_&&u!==Ke&&!v&&vj(e,qe,s,it,lt))&&D.current(),!g){A.current=Ke;return}if(a){A.current=Ke;return}if(o&&!c){A.current=Ke;return}if(n==null){c&&qe>=0&&(yj(e,qe,s,it,ct,l),D.current()),A.current=Ke;return}(_||c||u===Ke||d===Ke||p?.path===Ke||m?.path===Ke||i==null||i!==Ke)&&(KA(n),u===Ke&&(fe.current=null),d===Ke&&(pe.current=null),p?.path===Ke&&(me.current=null),m?.path===Ke&&(he.current=null),M.current=!1,N.current=null),A.current=Ke},[t,qe,Ke,dt,s,Ue,We,at,it,f,lt,ct,rt]);let Bt=qe>=0&&qe>=nt.visible.startIndex&&qe<=nt.visible.endIndex,Vt=Ke!=null&&ot.some(e=>XA(e.row)===Ke),Ht=Bt||Vt,Ut=Me&&k.current===!0&&Ht?Ke:null,Wt=q===`pointer`?ie:null,Gt=le?.path??ge.current??Wt??Ut??ie,Kt=le?.source===`right-click`;FA(()=>{y.current&&le==null||yt(Re(Gt))},[le,Re,at,it,J,ot,Gt,yt,rt]);let qt=RA(e=>{if(y.current||Tj(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&&se(e=>e===`pointer`?e:`pointer`),ae(e=>e===i?e:i)},[]),Jt=RA(()=>{ae(null)},[]);FA(()=>{if(!Je)return;let e=()=>{At(),t.cancelDrag()};return window.addEventListener(`dragend`,e),()=>{window.removeEventListener(`dragend`,e),At(),t.cancelDrag()}},[t,Je]);let Yt=e=>{if(!Je||t.getDragSession()==null||B.current)return;let n=oj(e.target instanceof HTMLElement?e.target:null);t.setDragTarget(n),Mt(t.getDragSession()?.target??null),Pt(e.clientX,e.clientY),e.dataTransfer!=null&&(e.dataTransfer.dropEffect=`move`),e.preventDefault()},Xt=e=>{if(!Je||t.getDragSession()==null||B.current)return;let n=e.relatedTarget;n instanceof Node&&S.current?.contains(n)===!0||(Et(),Ot(),t.setDragTarget(null))},Zt=e=>{!Je||t.getDragSession()==null||B.current||(e.preventDefault(),jt(e.clientX,e.clientY),t.completeDrag(),Dt(),Et(),Ot(),R.current=null)},Qt=nt.window.height,$t=nt.window.offsetTop,en=Math.min(0,it-Qt-lt),tn=W===Ke||M.current,nn=Ke!=null&&tn&&!dt&&qe>=0?rt[qe]??t.getVisibleRows(qe,qe)[0]??null:null,rn=nn==null?null:bj(qe,s,at,Qt),an=R.current,on=Qe!=null&&an!=null&&an.path===Qe&&an.index>=at.start&&an.index<=at.end,sn=Qe!=null&&an!=null&&an.path===Qe&&!on&&an.path!==nn?.path?an:null,cn=sn==null?null:bj(sn.index,s,at,Qt),ln=xj((qe>=0?rt[qe]??t.getVisibleRows(qe,qe)[0]??null:null)?.ancestorPaths.at(-1)??null),un=We&&Ke!=null?Ij(o,Ke,!dt):void 0,dn=le?.path??(We?Ke:W),fn=le?.path??ie,pn=Re(Gt),mn=Ae&&Me&&!Kt&&!Ue&&pn!=null&&oe!=null&&Gt!=null,hn=Ae&&(mn||le!=null),gn=le?.anchorRect,_n=gn==null&&pn!=null&&oe!=null&&(le!=null||mn)?oe:null,vn=gn==null?_n==null?void 0:{top:`${_n}px`}:{left:`${gn.left}px`,position:`fixed`,right:`auto`,top:`${gn.top}px`},yn=Kt?{opacity:`0`}:void 0,bn=RA((e,n,r,i)=>{let a=t.getItem(r),o=mA({event:{ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey},isDirectory:n.kind===`directory`,isSearchOpen:t.isSearchOpen(),mode:i});switch(o.selection.kind){case`range`:t.selectPathRange(r,o.selection.additive);break;case`toggle`:t.togglePathSelectionFromInput(r);break;case`single`:t.selectOnlyPath(r);break}let s=e.currentTarget instanceof HTMLElement?e.currentTarget:null,c=n.index>=nt.visible.startIndex&&n.index<=nt.visible.endIndex,l=i===`flow`&&c&&s!=null&&s.dataset.itemParked!==`true`;a?.focus(),l&&(k.current=!0,G(e=>e===r?e:r),se(`focus`)),o.toggleDirectory&&fj(a)&&a.toggle(),o.closeSearch&&t.closeSearch(),o.revealCanonical&&St(r,{targetOffset:`sticky-parents`})},[t,nt.visible.endIndex,nt.visible.startIndex,St]),xn=()=>{if(y.current||!Me||Gt==null||pn==null)return;let e=t.getItem(Gt);e!=null&&(yt(pn),gt.current=!0,ue({anchorRect:null,item:{kind:e.isDirectory()?`directory`:`file`,name:pn.getAttribute(`aria-label`)??Gt,path:e.getPath()},path:e.getPath(),source:`button`}))},Sn={contextHoverPath:fn,contextMenuButtonTriggerEnabled:Me,contextMenuButtonVisibility:Ne,contextMenuEnabled:Ae,contextMenuRightClickEnabled:Pe,contextMenuTriggerMode:je,controller:t,directoriesWithGitChanges:i,dragAndDropEnabled:Je,draggedPathSet:Xe,dragTarget:Ze,gitLaneActive:ze,gitStatusByPath:n,handleRowDragEnd:It,handleRowDragStart:Ft,handleRowTouchStart:Lt,ignoredGitDirectories:r,ignoredInheritanceCache:re,instanceId:o,itemHeight:s,onKeyDown:Rt,onRowClick:bn,openContextMenuForRow:bt,registerButton:Fe,registerRenameInput:Le,renameView:Ve,renderDecorationForRow:ft,resolveIcon:Be,shouldSuppressContextMenu:Ct,visualFocusPath:dn},Cn={...Sn,registerButton:Ie};return $(`div`,{ref:S,id:$e,"data-file-tree-context-menu-button-visibility":Ae&&Me?Ne:void 0,"data-file-tree-context-menu-trigger-mode":Ae?je:void 0,"data-file-tree-has-context-menu-action-lane":Ae&&Me?`true`:void 0,"data-file-tree-has-git-lane":ze?`true`:void 0,"data-file-tree-virtualized-root":`true`,onDragLeave:Je?Xt:void 0,onDragOver:Je?Yt:void 0,onDrop:Je?Zt:void 0,onKeyDown:Rt,onPointerLeave:Ae?Jt:void 0,onPointerOver:Ae?qt:void 0,role:`tree`,tabIndex:-1,style:{outline:`none`,position:`relative`},children:[$(`style`,{"data-file-tree-guide-style":`true`,dangerouslySetInnerHTML:{__html:ln}}),$(`slot`,{name:JC,"data-type":`header-slot`}),f?$(`div`,{"data-file-tree-search-container":!0,"data-open":We?`true`:`false`,children:$(`input`,{ref:w,"aria-activedescendant":un,"aria-controls":$e,placeholder:`Search…`,"data-file-tree-search-input":!0,"data-file-tree-search-input-fake-focus":Se?`true`:void 0,value:Ge,onBlur:()=>{d===`retain`&&!we.current||t.closeSearch()},onFocus:Te,onPointerDown:Te,onInput:e=>{Te();let n=e.currentTarget;t.setSearch(n.value)}})}):null,$(`div`,{ref:C,"data-file-tree-virtualized-scroll":`true`,children:[h&&Oe&&ot.length>0?$(`div`,{"aria-hidden":`true`,"data-file-tree-sticky-overlay":`true`,children:$(`div`,{"data-file-tree-sticky-overlay-content":`true`,style:{height:`${et}px`},children:ot.map((e,t)=>Vj(Cn,e.row,`sticky:${XA(e.row)}`,{mode:`sticky`,style:{left:`0`,position:`absolute`,right:`0`,top:`${e.top}px`,zIndex:`${ot.length-t}`}}))})}):null,$(`div`,{ref:b,"data-file-tree-virtualized-list":`true`,style:{height:`${ct}px`},children:[$(`div`,{"data-file-tree-virtualized-sticky-offset":`true`,"aria-hidden":`true`,style:{height:`${$t}px`}}),$(`div`,{"data-file-tree-virtualized-sticky":`true`,style:{height:`${Qt}px`,top:`${en}px`,bottom:`${en}px`},children:[Hj(Sn,at,ut),nn!=null&&rn!=null?Vj(Sn,nn,`parked:${nn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:Qe===nn.path?`none`:void 0,position:`absolute`,right:`0`,top:`${rn}px`}}):null,sn!=null&&cn!=null?Vj(Sn,sn,`parked-drag:${sn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:`none`,position:`absolute`,right:`0`,top:`${cn}px`}}):null]})]})]}),Ae?$(`div`,{ref:_,"data-type":`context-menu-anchor`,"data-visible":hn?`true`:`false`,style:vn,children:[$(`button`,{ref:v,type:`button`,"data-type":XC,"aria-label":`Options`,"aria-haspopup":`menu`,"aria-expanded":le==null?`false`:`true`,"data-visible":mn?`true`:`false`,onMouseDown:e=>{e.preventDefault()},onClick:e=>{if(e.preventDefault(),e.stopPropagation(),le!=null){vt();return}xn()},tabIndex:-1,style:yn,children:$(Rk,{...Be(`file-tree-icon-ellipsis`)})}),le==null?null:$(`slot`,{name:YC})]}):null,le==null?null:$(`div`,{"data-type":`context-menu-wash`,"aria-hidden":`true`,onMouseDownCapture:e=>{e.preventDefault(),vt()},onTouchStartCapture:e=>{e.preventDefault(),e.stopPropagation(),vt()},onTouchMoveCapture:e=>{e.preventDefault(),e.stopPropagation()},onWheelCapture:e=>{e.preventDefault(),e.stopPropagation()}})]})}var Wj={hydrateRoot:(e,t)=>{Nk(lk(Uj,t),e)},renderRoot:(e,t)=>{Mk(lk(Uj,t),e)},unmountRoot:e=>{Mk(null,e)}};function Gj(e,t){Wj.renderRoot(e,t)}function Kj(e,t){Wj.hydrateRoot(e,t)}function qj(e){Wj.unmountRoot(e)}var Jj=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)}}},Yj=`__c`,Xj=`__k`,Zj=`__d`,Qj=`__s`,$j=/[\s\n\\/='"\0<>]/,eM=/^(xlink|xmlns|xml)([A-Z])/,tM=/^(?: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])/,nM=/^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/,rM=new Set([`draggable`,`spellcheck`]);function iM(e){e.__g===void 0?e[Zj]=!0:e.__g|=8}function aM(e){e.__g===void 0?e[Zj]=!1:e.__g&=-9}function oM(e){return e.__g===void 0?!0===e[Zj]:!!(8&e.__g)}var sM=/["&<]/;function cM(e){if(e.length===0||!1===sM.test(e))return e;for(var t=0,n=0,r=``,i=``;n<e.length;n++){switch(e.charCodeAt(n)){case 34:i=`&quot;`;break;case 38:i=`&amp;`;break;case 60:i=`&lt;`;break;default:continue}n!==t&&(r+=e.slice(t,n)),r+=i,t=n+1}return n!==t&&(r+=e.slice(t,n)),r}var lM={},uM=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(`.`)),dM=/[A-Z]/g;function fM(e){var t=``;for(var n in e){var r=e[n];if(r!=null&&r!==``){var i=n[0]==`-`?n:lM[n]||(lM[n]=n.replace(dM,`-$&`).toLowerCase()),a=`;`;typeof r!=`number`||i.startsWith(`--`)||uM.has(i)||(a=`px;`),t=t+i+`:`+r+a}}return t||void 0}function pM(){this.__d=!0}function mM(e,t){return{__v:e,context:t,props:e.props,setState:pM,forceUpdate:pM,__d:!0,__h:[]}}function hM(e,t,n){if(!e.s){if(n instanceof gM){if(!n.s)return void(n.o=hM.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(hM.bind(null,e,t),hM.bind(null,e,2));e.s=t,e.v=n;let r=e.o;r&&r(e)}}var gM=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{hM(r,1,a(this.v))}catch(e){hM(r,2,e)}return r}return this}return this.o=function(e){try{var i=e.v;1&e.s?hM(r,1,t?t(i):i):n?hM(r,1,n(i)):hM(r,2,i)}catch(e){hM(r,2,e)}},r},e}(),_M,vM,yM,bM,xM={},SM=Array.isArray,CM=Object.assign,wM=``,TM=`<!--$s-->`,EM=`<!--/$s-->`;function DM(e,t){var n,r=e.type,i=!0;return e[Yj]?(i=!1,(n=e[Yj]).state=n[Qj]):n=new r(e.props,t),e[Yj]=n,n.__v=e,n.props=e.props,n.context=t,iM(n),n.state??=xM,n[Qj]??(n[Qj]=n.state),r.getDerivedStateFromProps?n.state=CM({},n.state,r.getDerivedStateFromProps(n.props,n.state)):i&&n.componentWillMount?(n.componentWillMount(),n.state=n[Qj]===n.state?n.state:n[Qj]):!i&&n.componentWillUpdate&&n.componentWillUpdate(),yM&&yM(e),n.render(n.props,n.state,t)}function OM(e,t,n,r,i,a,o){if(e==null||!0===e||!1===e||e===wM)return wM;var s=typeof e;if(s!=`object`)return s==`function`?wM:s==`string`?cM(e):e+wM;if(SM(e)){var c,l=wM;i[Xj]=e;for(var u=e.length,d=0;d<u;d++){var f=e[d];if(f!=null&&typeof f!=`boolean`){var p,m=OM(f,t,n,r,i,a,o);typeof m==`string`?l+=m:(c||=Array(u),l&&c.push(l),l=wM,SM(m)?(p=c).push.apply(p,m):c.push(m))}}return c?(l&&c.push(l),c):l}if(e.constructor!==void 0)return wM;e.__=i,_M&&_M(e);var h=e.type,g=e.props;if(typeof h==`function`){var _,v,y,b=t;if(h===dk){if(`tpl`in g){for(var x=wM,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&&!SM(C)?x+=C:x+=OM(C,t,n,r,e,a,o)}return x}if(`UNSTABLE_comment`in g)return`<!--`+cM(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=DM(e,b),y=e[Yj];else{e[Yj]=y=mM(e,b);for(var E=0;oM(y)&&E++<25;){aM(y),yM&&yM(e);try{v=h.call(y,g,b)}catch(t){throw a&&t&&typeof t.then==`function`&&(e._suspended=!0),t}}iM(y)}if(y.getChildContext!=null&&(t=CM({},t,y.getChildContext())),T&&qO.errorBoundaries&&(h.getDerivedStateFromError||y.componentDidCatch)){v=v!=null&&v.type===dk&&v.key==null&&v.props.tpl==null?v.props.children:v;try{return OM(v,t,n,r,e,a,!1)}catch(i){return h.getDerivedStateFromError&&(y[Qj]=h.getDerivedStateFromError(i)),y.componentDidCatch&&y.componentDidCatch(i,xM),oM(y)?(v=DM(e,t),(y=e[Yj]).getChildContext!=null&&(t=CM({},t,y.getChildContext())),OM(v=v!=null&&v.type===dk&&v.key==null&&v.props.tpl==null?v.props.children:v,t,n,r,e,a,o)):wM}finally{vM&&vM(e),bM&&bM(e)}}}v=v!=null&&v.type===dk&&v.key==null&&v.props.tpl==null?v.props.children:v;try{var D=OM(v,t,n,r,e,a,o);return vM&&vM(e),qO.unmount&&qO.unmount(e),e._suspended?typeof D==`string`?TM+D+EM:SM(D)?(D.unshift(TM),D.push(EM),D):D.then(function(e){return TM+e+EM}):D}catch(i){if(!a&&o&&o.onError){var O=function i(s){return o.onError(s,e,function(e,s){try{return OM(e,t,n,r,s,a,o)}catch(e){return i(e)}})}(i);if(O!==void 0)return O;var k=qO.__e;return k&&k(i,e),wM}if(!a||!i||typeof i.then!=`function`)throw i;return i.then(function i(){try{var s=OM(v,t,n,r,e,a,o);return e._suspended?TM+s+EM:s}catch(e){if(!e||typeof e.then!=`function`)throw e;return e.then(i)}})}}var A,j=`<`+h,M=wM;for(var N in g){var P=g[N];if(typeof(P=AM(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=fM(P));break;case`acceptCharset`:N=`accept-charset`;break;case`httpEquiv`:N=`http-equiv`;break;default:if(eM.test(N))N=N.replace(eM,`$1:$2`).toLowerCase();else{if($j.test(N))continue;N[4]!==`-`&&!rM.has(N)||P==null?n?nM.test(N)&&(N=N===`panose1`?`panose-1`:N.replace(/([A-Z])/g,`-$1`).toLowerCase()):tM.test(N)&&(N=N.toLowerCase()):P+=wM}}P!=null&&!1!==P&&(j=!0===P||P===wM?j+` `+N:j+` `+N+`="`+(typeof P==`string`?cM(P):P+wM)+`"`)}}if($j.test(h))throw Error(h+` is not a valid HTML tag name in `+j+`>`);if(M||(typeof A==`string`?M=cM(A):A!=null&&!1!==A&&!0!==A&&(M=OM(A,t,h===`svg`||h!==`foreignObject`&&n,r,e,a,o))),vM&&vM(e),bM&&bM(e),!M&&kM.has(h))return j+`/>`;var F=`</`+h+`>`,I=j+`>`;return SM(M)?[I].concat(M,[F]):typeof M==`string`?I+M+F:[I,M,F]}var kM=new Set([`area`,`base`,`br`,`col`,`command`,`embed`,`hr`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`]);function AM(e){return typeof e==`object`&&!!e&&typeof e.peek==`function`&&`value`in e}var jM=0;function MM(e){return e!=null&&e.length>0?e:(jM+=1,`pst_ft_${jM}`)}function NM({initialVisibleRowCount:e,itemHeight:t}){return e==null?420:Math.max(0,e)*(t??GD)}function PM(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 FM(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 IM(e){return Array.from(e.children).filter(e=>e instanceof SVGElement)}var LM=class{static LoadedCustomComponent=!0;#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=new Jj;#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=MM(a),this.#p=KO(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=WD(n,c),this.#d={itemHeight:this.#u.itemHeight,overscan:d,stickyFolders:_,initialVisibleRowCount:y},this.#t=new VO({...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&&(qj(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)}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(),Gj(t.wrapper,this.#w()))}setGitStatus(e){this.#p=KO(e,this.#p);let t=this.#T();t!=null&&Gj(t.wrapper,this.#w())}setIcons(e){this.#m=e;let t=this.#T();t!=null&&(this.#E(t.host,t.wrapper),Gj(t.wrapper,this.#w()))}hydrate({fileTreeContainer:e}){let t=this.#P(e),n=this.#N(t);this.#O(),Kj(n,this.#w())}render({containerWrapper:e,fileTreeContainer:t}){let n=this.#P(t??this.#f,e),r=this.#N(n);this.#O(),Gj(r,this.#w())}#C(){return{initialViewportHeight:NM({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(JC,e());return}this.#l.setSlotHtml(JC,this.#e?.header?.html??null)}#k(e){let t=IM(e).find(e=>FM(e)),n=PM(RC(QC(this.#m).set));n!=null&&(t!=null&&t.outerHTML===n.outerHTML||(t==null?e.prepend(n):t.replaceWith(n)))}#A(e){let t=IM(e),n=t.find(e=>FM(e)),r=t.filter(e=>e!==n),i=QC(this.#m).spriteSheet?.trim()??``;if(i.length===0){for(let e of r)e.remove();return}let a=PM(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=QC(this.#m);t.colored&&BC(t.set)?e.dataset.fileTreeColoredIcons=`true`:delete e.dataset.fileTreeColoredIcons}#M(e){let t=e.querySelector(`style[${WC}]`);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(WC,``),this.#g.parentNode!==e&&e.appendChild(this.#g),this.#g.textContent=YD(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 tO(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)}},RM=typeof window>`u`?X.useEffect:X.useLayoutEffect;function zM(e,t,n){let r=e==null?null:(0,Y.jsx)(`div`,{slot:JC,children:e}),i=t!=null&&n!=null?(0,Y.jsx)(`div`,{slot:YC,children:t(n.item,n.context)}):null;return r==null&&i==null?null:(0,Y.jsxs)(Y.Fragment,{children:[r,i]})}function BM(e,t){return typeof window>`u`&&t!=null?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`template`,{shadowrootmode:`open`,dangerouslySetInnerHTML:{__html:t.shadowHtml}}),e]}):(0,Y.jsx)(Y.Fragment,{children:e})}function VM(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 HM(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 UM({header:e,id:t,model:n,preloadedData:r,renderContextMenu:i,...a}){let[o,s]=(0,X.useState)(null),[c,l]=(0,X.useState)(null),u=(0,X.useRef)(n.getComposition()),d=(0,X.useRef)(n);d.current!==n&&(d.current=n,u.current=n.getComposition());let f=i!=null,p=(0,X.useCallback)(()=>{s(null)},[]),m=(0,X.useCallback)((e,t)=>{s({context:t,item:e})},[]),h=u.current,g=(0,X.useMemo)(()=>HM(h,e,f,p,m),[h,p,m,f,e]),_=(0,X.useCallback)(e=>{l(e)},[]);(0,X.useEffect)(()=>{f||s(null)},[f]),RM(()=>{n.setComposition(g)},[g,n]),RM(()=>{if(c!=null)return r!=null&&VM(c)?n.hydrate({fileTreeContainer:c}):n.render({fileTreeContainer:c}),()=>{n.unmount(),n.setComposition(h)}},[h,c,n,r]);let v=BM(zM(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,Y.jsx)(HC,{...a,id:y,ref:_,style:b,suppressHydrationWarning:r!=null,children:v})}function WM(e){let t=(0,X.useRef)(null);return t.current??=new LM(e),(0,X.useEffect)(()=>{let e=t.current;return()=>{e?.cleanUp(),t.current=null}},[]),{model:t.current}}function GM(e){let t=(0,Z.c)(20),{itemName:n,isSubmitting:r,onDelete:i,customTitle:a,customDescription:o,children:s}=e,c=n===void 0?`this item`:n,l=a??`Delete ${c}`,u;t[0]===l?u=t[1]:(u=(0,Y.jsx)(qt,{children:l}),t[0]=l,t[1]=u);let d=o??`Are you sure you want to delete ${c}? This action cannot be undone.`,f;t[2]===d?f=t[3]:(f=(0,Y.jsx)(Bt,{className:`whitespace-pre-wrap`,children:d}),t[2]=d,t[3]=f);let p;t[4]===r?p=t[5]:(p=(0,Y.jsx)(Ut,{asChild:!0,children:(0,Y.jsx)(K,{variant:`outline`,disabled:r,children:`Cancel`})}),t[4]=r,t[5]=p);let m;t[6]===r?m=t[7]:(m=r?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Ye,{className:`size-4 animate-spin`}),` Deleting...`]}):`Delete`,t[6]=r,t[7]=m);let h;t[8]!==r||t[9]!==i||t[10]!==m?(h=(0,Y.jsx)(K,{variant:`destructive`,onClick:i,disabled:r,children:m}),t[8]=r,t[9]=i,t[10]=m,t[11]=h):h=t[11];let g;t[12]!==p||t[13]!==h?(g=(0,Y.jsxs)(Nt,{children:[p,h]}),t[12]=p,t[13]=h,t[14]=g):g=t[14];let _;return t[15]!==s||t[16]!==u||t[17]!==f||t[18]!==g?(_=(0,Y.jsxs)(Kt,{children:[u,f,s,g]}),t[15]=s,t[16]=u,t[17]=f,t[18]=g,t[19]=_):_=t[19],_}var KM=`.md`;function qM(e){return`${e}${KM}`}function JM(e){return uN(e).replace(/\.md$/i,``)}function YM(e){return uN(e)}function XM(e){let t=uN(e.trim());return t?`${t}/`:``}function ZM(e){return e.endsWith(`/`)?YM(e):JM(e)}function QM(e){return e.map(e=>qM(e.docName))}function $M(e){return[...e].sort().join(`\0`)}function eN(e){return $M(QM(e))}function tN(e){let t=new Set;for(let n of e){let e=n.docName.split(`/`).filter(Boolean);for(let n=1;n<e.length;n++)t.add(`${e.slice(0,n).join(`/`)}/`)}return[...t].sort()}function nN(e){if(!e)return[];let t=uN(e.replace(/\.md$/i,``)).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 rN(e){let t=e.kind===`directory`,n=t?YM(e.path):JM(e.path);return{kind:t?`folder`:`file`,name:uN(lN(e.path)).replace(/\.md$/i,``),path:n,treePath:aN(e.path,t)}}function iN(e){return e.kind===`directory`?YM(e.path):e.path}function aN(e,t){return t?XM(e):e.endsWith(KM)?e:`${e}${KM}`}function oN(e,t,n){let r=XM(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}${KM}`;if(!i.has(e))return{addPath:e,renamePath:e};continue}let a=`${r}New Folder${n}/`,o=`${a}index${KM}`;if(!i.has(o)&&!i.has(a))return{addPath:o,renamePath:a}}throw Error(`Could not allocate a unique tree placeholder`)}function sN(e,t){return e===`file`?aN(t,!1):`${YM(t)}/index${KM}`}function cN(e,t){return t.kind===`root`||t.directoryPath==null?lN(e):`${t.directoryPath}${lN(e)}`}function lN(e){let t=uN(e),n=t.lastIndexOf(`/`),r=n===-1?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function uN(e){return e.endsWith(`/`)?e.slice(0,-1):e}function dN(e,t){if(!e)return{selectedFilePath:t,selectedFolderPath:null,navigationPath:t};switch(e.kind){case`doc`:return{selectedFilePath:e.docName,selectedFolderPath:null,navigationPath:e.docName};case`folder`:case`folder-index`:return{selectedFilePath:null,selectedFolderPath:e.folderPath,navigationPath:e.folderPath};case`missing`:return{selectedFilePath:null,selectedFolderPath:null,navigationPath:null}}}function fN(e,t,n,r){return e.id===`cursor`&&!n?`Desktop only`:t.installed===null?`Detecting…`:t.installed===!1?`Not installed`:r?`No workspace`:null}function pN(e){let t=(0,Z.c)(8),{input:n,installStates:r,isElectronHost:i,dispatch:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Y.jsxs)(G_,{children:[(0,Y.jsx)(xe,{"aria-hidden":`true`}),`Open in…`]}),t[0]=o):o=t[0];let s;t[1]!==a||t[2]!==n||t[3]!==r||t[4]!==i?(s=Od.map(e=>{let t=r[e.id],o=Qx({target:e,installState:t,isElectronHost:i}),s=n===null,c=o.enabled&&!s,l=fN(e,t,i,s),u=l?`Open in ${e.displayName}, ${l}`:`Open in ${e.displayName}`;return(0,Y.jsxs)(z_,{disabled:!c,onSelect:()=>{!c||!n||a(e.id,n)},"data-testid":`file-tree-open-in-${e.id}`,"aria-label":u,children:[(0,Y.jsx)(Yx,{id:e.id,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`flex-1`,children:e.displayName}),l?(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:l}):null]},e.id)}),t[1]=a,t[2]=n,t[3]=r,t[4]=i,t[5]=s):s=t[5];let c;return t[6]===s?c=t[7]:(c=(0,Y.jsxs)(W_,{children:[o,(0,Y.jsx)(K_,{children:s})]}),t[6]=s,t[7]=c),c}var mN=80,hN=3,gN=20,_N=new Map,vN=new Set,yN=[],bN=new Map;function xN(e){for(bN.delete(e),bN.set(e,!0);bN.size>gN;){let e=bN.keys().next().value;if(e===void 0)break;bN.delete(e)}}function SN(e){vN.delete(e),CN()}function CN(){for(;vN.size<hN&&yN.length>0;){let e=yN.shift();if(!e)break;if(!bN.has(e.docName)){vN.add(e.docName),xN(e.docName);try{e.prewarm(e.docName)}catch(t){it(`ok/sidebar/prewarm-failed`,{docName:e.docName,message:t instanceof Error?t.message:String(t)})}finally{SN(e.docName)}}}}function wN(e,t){if(Xe(e)||bN.has(e))return;let n=_N.get(e);n&&clearTimeout(n.timer);let r=setTimeout(()=>{if(_N.delete(e),vN.size>=hN){yN.push({docName:e,prewarm:t});return}xN(e),vN.add(e);try{t(e)}catch(t){it(`ok/sidebar/prewarm-failed`,{docName:e,message:t instanceof Error?t.message:String(t)})}finally{SN(e)}},mN);_N.set(e,{timer:r,prewarm:t})}function TN(e){let t=_N.get(e);t&&(clearTimeout(t.timer),_N.delete(e))}function EN(e){window.location.hash=Nn(e)}async function DN(e,t){try{await navigator.clipboard.writeText(e),At.success(`Copied ${t}`,{description:e})}catch(e){console.warn(`[FileTree] clipboard write failed:`,e),At.error(`Could not copy ${t}`)}}var ON=new Set([`agents`,`agent`,`claude`,`skill`]),kN=`ok-file-tree-link-decoration`,AN=`ok-file-tree-agent-decoration`;function jN(e){return e.map(([e,{key:t,...n}])=>`<${e} ${Object.entries(n).map(([e,t])=>`${e}="${t}"`).join(` `)} />`).join(``)}function MN(e,t){return`<symbol id="${e}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${jN(t)}</symbol>`}var NN=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
1836
- ${MN(kN,Li)}
1837
- ${MN(AN,ii)}
1838
- </svg>`;function PN(e){return{...lw({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)`}}function FN(e){let t=e.split(`/`).pop()?.replace(/\.md$/i,``).toLowerCase();return!!t&&ON.has(t)}function IN(e){return e?.isDirectory()?e:null}function LN(e){let t=(0,Z.c)(66),{item:n,context:r,anyActionBusy:i,workspace:a,handoff:o,model:s,onStartCreating:c,onDelete:l,onExpandSubtree:u,onCollapseSubtree:d}=e,f;t[0]===n?f=t[1]:(f=rN(n),t[0]=n,t[1]=f);let p=f,m=n.kind===`directory`,h;t[2]!==m||t[3]!==n.path||t[4]!==a?(h=m?null:Gd({docName:JM(n.path),workspace:a}),t[2]=m,t[3]=n.path,t[4]=a,t[5]=h):h=t[5];let g=h,_;t[6]===r?_=t[7]:(_=()=>r.close({restoreFocus:!1}),t[6]=r,t[7]=_);let v=_,y;t[8]===r?y=t[9]:(y=()=>r.close(),t[8]=r,t[9]=y);let b=y,x;t[10]===b?x=t[11]:(x=e=>{e||b()},t[10]=b,t[11]=x);let S;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Y.jsx)(L_,{asChild:!0,children:(0,Y.jsx)(`span`,{"aria-hidden":`true`,"data-file-tree-context-menu-root":`true`,className:`block size-px`})}),t[12]=S):S=t[12];let C;t[13]!==i||t[14]!==b||t[15]!==v||t[16]!==m||t[17]!==n.path||t[18]!==d||t[19]!==u||t[20]!==c?(C=m?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(z_,{disabled:i,onSelect:()=>{v(),c(`file`,YM(n.path))},children:[(0,Y.jsx)(sa,{"aria-hidden":`true`}),`New File`]}),(0,Y.jsxs)(z_,{disabled:i,onSelect:()=>{v(),c(`folder`,YM(n.path))},children:[(0,Y.jsx)(Di,{"aria-hidden":`true`}),`New Folder`]}),(0,Y.jsx)(U_,{}),(0,Y.jsxs)(z_,{onSelect:()=>{b(),u(n.path)},children:[(0,Y.jsx)(ma,{"aria-hidden":`true`}),`Expand All`]}),(0,Y.jsxs)(z_,{onSelect:()=>{b(),d(n.path)},children:[(0,Y.jsx)(Ei,{"aria-hidden":`true`}),`Collapse All`]}),(0,Y.jsx)(U_,{})]}):null,t[13]=i,t[14]=b,t[15]=v,t[16]=m,t[17]=n.path,t[18]=d,t[19]=u,t[20]=c,t[21]=C):C=t[21];let w;t[22]!==v||t[23]!==n.path||t[24]!==s?(w=()=>{v(),s.startRenaming(n.path)},t[22]=v,t[23]=n.path,t[24]=s,t[25]=w):w=t[25];let T;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Y.jsx)(yt,{"aria-hidden":`true`}),t[26]=T):T=t[26];let E;t[27]!==i||t[28]!==w?(E=(0,Y.jsxs)(z_,{disabled:i,onSelect:w,children:[T,`Rename`]}),t[27]=i,t[28]=w,t[29]=E):E=t[29];let D;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Y.jsxs)(G_,{children:[(0,Y.jsx)(_i,{"aria-hidden":`true`}),`Copy Path`]}),t[30]=D):D=t[30];let O=!a,k;t[31]!==b||t[32]!==n||t[33]!==a?(k=()=>{a&&(b(),DN(Ud(a.contentDir,iN(n),a.pathSeparator),`full path`))},t[31]=b,t[32]=n,t[33]=a,t[34]=k):k=t[34];let A;t[35]!==O||t[36]!==k?(A=(0,Y.jsx)(z_,{disabled:O,onSelect:k,children:`Full Path`}),t[35]=O,t[36]=k,t[37]=A):A=t[37];let j;t[38]!==b||t[39]!==n?(j=(0,Y.jsx)(z_,{onSelect:()=>{b(),DN(iN(n),`relative path`)},children:`Relative Path`}),t[38]=b,t[39]=n,t[40]=j):j=t[40];let M;t[41]!==A||t[42]!==j?(M=(0,Y.jsxs)(W_,{children:[D,(0,Y.jsxs)(K_,{children:[A,j]})]}),t[41]=A,t[42]=j,t[43]=M):M=t[43];let N;t[44]!==o||t[45]!==g||t[46]!==m?(N=!m&&(0,Y.jsx)(pN,{input:g,installStates:o.installStates,isElectronHost:o.isElectronHost,dispatch:o.dispatch}),t[44]=o,t[45]=g,t[46]=m,t[47]=N):N=t[47];let P;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Y.jsx)(U_,{}),t[48]=P):P=t[48];let F;t[49]!==b||t[50]!==l||t[51]!==p?(F=()=>{b(),l(p)},t[49]=b,t[50]=l,t[51]=p,t[52]=F):F=t[52];let I;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Y.jsx)(Ke,{"aria-hidden":`true`}),t[53]=I):I=t[53];let ee;t[54]!==i||t[55]!==F?(ee=(0,Y.jsxs)(z_,{variant:`destructive`,disabled:i,onSelect:F,children:[I,`Delete`]}),t[54]=i,t[55]=F,t[56]=ee):ee=t[56];let L;t[57]!==E||t[58]!==M||t[59]!==N||t[60]!==ee||t[61]!==C?(L=(0,Y.jsxs)(R_,{sideOffset:0,align:`start`,"data-file-tree-context-menu-root":`true`,className:`min-w-52`,children:[C,E,M,N,P,ee]}),t[57]=E,t[58]=M,t[59]=N,t[60]=ee,t[61]=C,t[62]=L):L=t[62];let R;return t[63]!==L||t[64]!==x?(R=(0,Y.jsxs)(I_,{open:!0,modal:!1,onOpenChange:x,children:[S,L]}),t[63]=L,t[64]=x,t[65]=R):R=t[65],R}function RN(e){let t=(0,Z.c)(105),{ref:n}=e,{activeDocName:r,activeTarget:i,closeDocument:a,prewarm:o}=ut(),{notifySidebarFileSelected:s}=tx(),{resolvedTheme:c}=T(),l;t[0]===s?l=t[1]:(l=function(e){EN(e),s()},t[0]=s,t[1]=l);let u=l,d;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=[],t[2]=d):d=t[2];let[f,p]=(0,X.useState)(d),[m,h]=(0,X.useState)(!0),[g,_]=(0,X.useState)(null),[v,y]=(0,X.useState)(null),[b,x]=(0,X.useState)(null),[S,C]=(0,X.useState)(null),w=(0,X.useRef)(f),E=(0,X.useRef)(r),D;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(D=[],t[3]=D):D=t[3];let O=(0,X.useRef)(D),k=(0,X.useRef)(null),A=(0,X.useRef)(null),j=(0,X.useRef)(null),M=(0,X.useRef)(!1),N=(0,X.useRef)(null),P=(0,X.useRef)(qN),F=(0,X.useRef)(KN),I=(0,X.useRef)(GN),{selectedFilePath:ee,selectedFolderPath:L,navigationPath:R}=dN(i,r),z=ee?qM(ee):L?XM(L):null,B=ff().states,{dispatch:V}=ef(),H;t[4]!==V||t[5]!==B?(H={installStates:B,isElectronHost:typeof window<`u`&&window.okDesktop!=null,dispatch:V},t[4]=V,t[5]=B,t[6]=H):H=t[6];let te=H,ne;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(ne=[],t[7]=ne):ne=t[7];let re;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(re={paths:ne,flattenEmptyDirectories:!1,initialExpansion:`closed`,search:!0,searchBlurBehavior:`retain`,fileTreeSearchMode:`hide-non-matches`,initialVisibleRowCount:18,stickyFolders:!0,icons:{set:`complete`,spriteSheet:NN},composition:{contextMenu:{enabled:!0,triggerMode:`both`,buttonVisibility:`when-needed`}},dragAndDrop:{canDrag:()=>N.current===null,canDrop:()=>N.current===null,onDropComplete:e=>I.current(e),onDropError:WN},renaming:{canRename:()=>N.current===null,onRename:e=>F.current(e),onError:At.error},onSelectionChange:e=>P.current(e),renderRowDecoration:e=>{let{item:t}=e;if(t.kind!==`file`)return null;let n=w.current.find(e=>qM(e.docName)===t.path);return n?.isSymlink?{icon:kN,title:n.targetPath?`Symlink to ${n.targetPath}`:`Symlink`}:FN(t.path)?{icon:AN,title:`Agent configuration file`}:null}},t[8]=re):re=t[8];let{model:U}=WM(re),W,G;t[9]===f?(W=t[10],G=t[11]):(G=QM(f),W=$M(G),t[9]=f,t[10]=W,t[11]=G);let ie=W,ae=(0,X.useRef)(G),oe;t[12]===f?oe=t[13]:(oe=tN(f),t[12]=f,t[13]=oe);let q=oe,se=(0,X.useRef)(q),J=L?nN(XM(L)).slice(0,-1):nN(z??R),ce=J.join(`\0`),le;t[14]===U?le=t[15]:(le=e=>{let t=QM(e??w.current);U.resetPaths(t,{initialExpandedPaths:O.current})},t[14]=U,t[15]=le);let ue=le,de;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(de=e=>{A.current=eN(e)},t[16]=de):de=t[16];let fe=de,pe,me;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(pe=()=>{let e=!0,t=async function(){try{let t=await fetch(`/api/documents`),n=await t.json().catch(UN);if(!e)return;t.ok&&n?.ok?(p(n.documents),_(null)):_(n?.error??`Server error (HTTP ${t.status})`)}catch(t){let n=t;e&&_(`Could not reach server`),console.warn(`[FileTree] fetch failed:`,n)}e&&h(!1)};t();let n=()=>{document.visibilityState===`visible`&&t()};window.addEventListener(`focus`,n),window.addEventListener(`visibilitychange`,n);let r=Fn(e=>{e.includes(`files`)&&t()});return()=>{e=!1,window.removeEventListener(`focus`,n),window.removeEventListener(`visibilitychange`,n),r()}},me=[],t[17]=pe,t[18]=me):(pe=t[17],me=t[18]),(0,X.useEffect)(pe,me);let he,ge;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(he=()=>{let e=!0;return fetch(`/api/workspace`).then(async t=>{let n=await t.json().catch(HN);e&&t.ok&&n?.ok&&typeof n.contentDir==`string`&&(n.pathSeparator===`/`||n.pathSeparator===`\\`)&&C({contentDir:n.contentDir,pathSeparator:n.pathSeparator})}).catch(VN),()=>{e=!1}},ge=[],t[19]=he,t[20]=ge):(he=t[19],ge=t[20]),(0,X.useEffect)(he,ge);let _e,ve;t[21]!==U||t[22]!==ie?(_e=()=>{if(A.current===ie){A.current=null;return}U.resetPaths(ae.current,{initialExpandedPaths:O.current})},ve=[U,ie],t[21]=U,t[22]=ie,t[23]=_e,t[24]=ve):(_e=t[23],ve=t[24]),(0,X.useEffect)(_e,ve);let ye,be;t[25]!==ce||t[26]!==z||t[27]!==U?(ye=()=>{if(!z)return;let e=ce?ce.split(`\0`):[];for(let t of e){let e=IN(U.getItem(t));e&&!e.isExpanded()&&e.expand()}let t=U.getItem(z);t&&(M.current=!0,t.select(),t.focus(),queueMicrotask(()=>{M.current=!1}))},be=[ce,z,U],t[25]=ce,t[26]=z,t[27]=U,t[28]=ye,t[29]=be):(ye=t[28],be=t[29]),(0,X.useEffect)(ye,be);let xe,Se;t[30]===U?(xe=t[31],Se=t[32]):(xe=()=>U.subscribe(()=>{if(!U.isSearchOpen())for(let e of O.current){let t=IN(U.getItem(e));t&&!t.isExpanded()&&t.expand()}}),Se=[U],t[30]=U,t[31]=xe,t[32]=Se),(0,X.useEffect)(xe,Se);let Ce;t[33]===a?Ce=t[34]:(Ce=e=>{let t=E.current,n=Wb(t,e);for(let t of e)a(t.fromDocName);p(t=>{let n=Hb(t,e);return fe(n),n}),Wn([`files`,`backlinks`,`graph`]),t&&n!==t&&(window.location.hash=`#/${n}`)},t[33]=a,t[34]=Ce);let we=Ce,Te;t[35]!==we||t[36]!==ue?(Te=async function(e){let t=e.isFolder?`folder`:`file`,n=aN(e.sourcePath,e.isFolder),r=aN(e.destinationPath,e.isFolder),i=k.current;y(n),_(null);try{if(i?.renamePath===n){let e=sN(t,r),n=await fetch(`/api/create-page`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e})}),i=await n.json().catch(BN);if(!n.ok||!i?.ok){let e=i?.error??`Failed to create ${t}`;At.error(e),_(e),ue(),k.current=null,y(null);return}let a=i.docName??e.replace(/\.md$/i,``);p(e=>{if(e.some(e=>e.docName===a))return e;let t=[...e,{docName:a,modified:new Date().toISOString(),size:0}];return fe(t),t}),EN(a),Wn([`files`,`backlinks`,`graph`]),k.current=null,y(null);return}let a=e.isFolder?`/api/rename-path`:`/api/rename`,o=e.isFolder?{kind:`folder`,fromPath:YM(n),toPath:YM(r)}:{docName:JM(n),newDocName:JM(r)},s=await fetch(a,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(o)}),c=await s.json();if(!s.ok||!c.ok){let e=c.error??`Failed to rename path`;At.error(e),_(e),ue(),k.current=null,y(null);return}we(Array.isArray(c.renamed)?c.renamed:[]),k.current=null,y(null)}catch(e){console.warn(`[FileTree] rename failed:`,e),At.error(`Network error — please try again`),_(`Network error — please try again`),ue(),k.current=null,y(null)}},t[35]=we,t[36]=ue,t[37]=Te):Te=t[37];let Ee=Te,De;t[38]!==we||t[39]!==ue?(De=async function(e){let t=e.draggedPaths.map(t=>{let n=cN(t,e.target);return t===n?null:{sourcePath:t,destinationTreePath:n}}).filter(zN);if(t.length!==0){y(t[0]?.sourcePath??null),_(null);try{let e=[];for(let n of t){let t=n.sourcePath.endsWith(`/`),r=t?`/api/rename-path`:`/api/rename`,i=t?{kind:`folder`,fromPath:YM(n.sourcePath),toPath:YM(n.destinationTreePath)}:{docName:JM(n.sourcePath),newDocName:JM(n.destinationTreePath)},a=await fetch(r,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(i)}),o=await a.json();if(!a.ok||!o.ok){let e=o.error??`Failed to move`;At.error(e),_(e),ue(),y(null);return}e=e.concat(Array.isArray(o.renamed)?o.renamed:[])}we(e),y(null)}catch(e){console.warn(`[FileTree] move failed:`,e),At.error(`Network error — please try again`),ue(),y(null)}}},t[38]=we,t[39]=ue,t[40]=De):De=t[40];let Oe=De,ke;t[41]!==U||t[42]!==G?(ke=function(e,t){try{let n=oN(e,t,[...G,...se.current]);k.current={kind:e,renamePath:n.renamePath},U.add(n.addPath),U.startRenaming(n.renamePath,{removeIfCanceled:!0})}catch(e){console.warn(`[FileTree] create placeholder failed:`,e),At.error(`Could not start creating a new item`)}},t[41]=U,t[42]=G,t[43]=ke):ke=t[43];let Ae=ke,je;t[44]===U?je=t[45]:(je=function(e){let t=XM(e);(0,X.startTransition)(()=>{for(let e of se.current)if(e===t||e.startsWith(t)){let t=IN(U.getItem(e));t&&t.expand()}})},t[44]=U,t[45]=je);let Me=je,Ne;t[46]===U?Ne=t[47]:(Ne=function(e){let t=XM(e),n=new Set(O.current);(0,X.startTransition)(()=>{for(let e of[...se.current].reverse())if((e===t||e.startsWith(t))&&!n.has(e)){let t=IN(U.getItem(e));t&&t.collapse()}})},t[46]=U,t[47]=Ne);let Pe=Ne,Fe;t[48]!==J||t[49]!==r||t[50]!==v||t[51]!==f||t[52]!==q||t[53]!==Oe||t[54]!==Ee||t[55]!==u||t[56]!==G?(Fe=()=>{w.current=f,E.current=r,N.current=v,ae.current=G,se.current=q,O.current=J,P.current=e=>{if(M.current)return;let t=e[0];t&&u(ZM(t))},F.current=Ee,I.current=Oe},t[48]=J,t[49]=r,t[50]=v,t[51]=f,t[52]=q,t[53]=Oe,t[54]=Ee,t[55]=u,t[56]=G,t[57]=Fe):Fe=t[57],(0,X.useLayoutEffect)(Fe);let Ie;t[58]!==U||t[59]!==Ae?(Ie=()=>({startCreating:Ae,expandAll(){(0,X.startTransition)(()=>{for(let e of se.current){let t=IN(U.getItem(e));t&&t.expand()}})},collapseAll(){let e=new Set(O.current);(0,X.startTransition)(()=>{for(let t of[...se.current].reverse()){if(e.has(t))continue;let n=IN(U.getItem(t));n&&n.collapse()}})}}),t[58]=U,t[59]=Ae,t[60]=Ie):Ie=t[60],(0,X.useImperativeHandle)(n,Ie);let Le;t[61]!==a||t[62]!==U||t[63]!==ue?(Le=async function(e){y(e.path),x(null);try{let t=e.kind===`folder`?XM(e.path):qM(e.path),n=await fetch(`/api/delete-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e.kind,path:e.path})}),r=await n.json();if(!n.ok||!r.ok){At.error(r.error??`Failed to delete path`),y(null);return}let i=Array.isArray(r.deletedDocNames)?r.deletedDocNames:[],o=new Set(i);for(let e of o)a(e);U.getItem(t)&&U.remove(t,e.kind===`folder`?{recursive:!0}:void 0),p(e=>{let t=Ub(e,i);return fe(t),t}),Wn([`files`,`backlinks`,`graph`]);let s=E.current;s&&o.has(s)&&(window.location.hash=``),y(null)}catch(e){console.warn(`[FileTree] delete failed:`,e),At.error(`Network error — please try again`),y(null),ue()}},t[61]=a,t[62]=U,t[63]=ue,t[64]=Le):Le=t[64];let Re=Le,ze;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(ze=function(){let e=j.current;e&&TN(e),j.current=null},t[65]=ze):ze=t[65];let Be=ze,Ve;t[66]===o?Ve=t[67]:(Ve=function(e){let t=JN(e.nativeEvent);if(!t||t.endsWith(`/`)){Be();return}let n=JM(t);j.current!==n&&(Be(),j.current=n,wN(n,e=>{o(e)}))},t[66]=o,t[67]=Ve);let He=Ve;if(m){let e;return t[68]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(`div`,{className:`flex flex-1 items-center justify-center py-8`,children:(0,Y.jsx)(`span`,{className:`select-none text-sidebar-foreground/30 text-sm`,children:`Loading...`})}),t[68]=e):e=t[68],e}if(f.length===0){if(g){let e;return t[69]===g?e=t[70]:(e=(0,Y.jsx)(`div`,{className:`flex flex-1 items-center justify-center py-8`,children:(0,Y.jsx)(`span`,{className:`select-none text-sidebar-foreground/50 text-sm`,children:g})}),t[69]=g,t[70]=e),e}let e;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(`span`,{className:`select-none text-sidebar-foreground/30 text-sm`,children:`No files yet.`}),t[71]=e):e=t[71];let n;return t[72]===Ae?n=t[73]:(n=(0,Y.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 py-8`,children:[e,(0,Y.jsx)(K,{variant:`link`,size:`sm`,className:`font-mono uppercase`,onClick:()=>Ae(`file`,``),children:`Create your first file`})]}),t[72]=Ae,t[73]=n),n}let Ue=v!==null,We;t[74]===g?We=t[75]:(We=g&&(0,Y.jsx)(`span`,{role:`alert`,className:`px-3 pb-1 text-destructive text-xs`,children:g}),t[74]=g,t[75]=We);let Ge;t[76]===c?Ge=t[77]:(Ge=PN(c),t[76]=c,t[77]=Ge);let Ke;t[78]!==Ue||t[79]!==Pe||t[80]!==Me||t[81]!==te||t[82]!==U||t[83]!==Ae||t[84]!==S?(Ke=(e,t)=>(0,Y.jsx)(LN,{item:e,context:t,anyActionBusy:Ue,workspace:S,handoff:te,model:U,onStartCreating:Ae,onDelete:x,onExpandSubtree:Me,onCollapseSubtree:Pe}),t[78]=Ue,t[79]=Pe,t[80]=Me,t[81]=te,t[82]=U,t[83]=Ae,t[84]=S,t[85]=Ke):Ke=t[85];let qe;t[86]!==He||t[87]!==U||t[88]!==We||t[89]!==Ge||t[90]!==Ke?(qe=(0,Y.jsx)(UM,{header:We,model:U,style:Ge,onMouseMove:He,onMouseLeave:Be,renderContextMenu:Ke}),t[86]=He,t[87]=U,t[88]=We,t[89]=Ge,t[90]=Ke,t[91]=qe):qe=t[91];let Je=!!b,Ye;t[92]===v?Ye=t[93]:(Ye=e=>{!e&&!v&&x(null)},t[92]=v,t[93]=Ye);let Xe;t[94]!==v||t[95]!==b||t[96]!==Re?(Xe=b&&(0,Y.jsx)(GM,{itemName:`${b.name}${b.kind===`file`?`.md`:`/`}`,isSubmitting:v===b.path,onDelete:()=>Re(b),customDescription:b.kind===`folder`?`Are you sure you want to delete ${b.name}/ and all files inside? This action cannot be undone.`:void 0}),t[94]=v,t[95]=b,t[96]=Re,t[97]=Xe):Xe=t[97];let Ze;t[98]!==Je||t[99]!==Ye||t[100]!==Xe?(Ze=(0,Y.jsx)(Jt,{open:Je,onOpenChange:Ye,children:Xe}),t[98]=Je,t[99]=Ye,t[100]=Xe,t[101]=Ze):Ze=t[101];let Qe;return t[102]!==qe||t[103]!==Ze?(Qe=(0,Y.jsxs)(Y.Fragment,{children:[qe,Ze]}),t[102]=qe,t[103]=Ze,t[104]=Qe):Qe=t[104],Qe}function zN(e){return!!e}function BN(){return null}function VN(e){console.warn(`[FileTree] /api/workspace fetch failed:`,e)}function HN(){return null}function UN(){return null}function WN(e){At.error(e)}function GN(){}function KN(){}function qN(){}function JN(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.dataset.itemPath)return t.dataset.itemPath;return null}var YN=(e,t,n)=>ya(e,t,n,`ProjectSwitcher`);function XN(e){let t=(0,Z.c)(59),{bridge:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=[],t[0]=r):r=t[0];let[i,a]=(0,X.useState)(r),[o,s]=(0,X.useState)(!1),c;t[1]!==n.project||t[2]!==o?(c=()=>{if(!o)return;let e=!1;return YN(async()=>{let t=await n.project.listRecent();e||a(t)},`Failed to load recent projects.`),()=>{e=!0}},t[1]=n.project,t[2]=o,t[3]=c):c=t[3];let l;t[4]!==n||t[5]!==o?(l=[o,n],t[4]=n,t[5]=o,t[6]=l):l=t[6],(0,X.useEffect)(c,l);let u;t[7]===n.project?u=t[8]:(u=e=>{s(!1),YN(()=>n.project.open({path:e,target:`new-window`}),`Failed to open project.`)},t[7]=n.project,t[8]=u);let d=u,f;t[9]!==n.dialog||t[10]!==n.project?(f=()=>{s(!1),YN(async()=>{let e=await n.dialog.openFolder();e&&await n.project.open({path:e,target:`new-window`})},`Failed to open folder.`)},t[9]=n.dialog,t[10]=n.project,t[11]=f):f=t[11];let p=f,m;t[12]===n.navigator?m=t[13]:(m=()=>{s(!1),YN(()=>n.navigator.open(),`Failed to open Project Navigator.`)},t[12]=n.navigator,t[13]=m);let h=m,g=n.config.projectPath,_,v,y,b,x,S,C,w,T,E,D;if(t[14]!==n.config.projectName||t[15]!==g||t[16]!==o||t[17]!==d||t[18]!==i){let e;t[30]===g?e=t[31]:(e=e=>e.path!==g,t[30]=g,t[31]=e);let r=i.filter(e);v=I_,S=o,C=s;let a;t[32]===n.config.projectName?a=t[33]:(a=(0,Y.jsx)(`span`,{className:`truncate`,children:n.config.projectName}),t[32]=n.config.projectName,t[33]=a);let c;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Y.jsx)(ci,{"aria-hidden":`true`,className:`opacity-60`}),t[34]=c):c=t[34],t[35]===a?w=t[36]:(w=(0,Y.jsx)(L_,{asChild:!0,children:(0,Y.jsxs)(mx,{className:`justify-between text-sidebar-foreground/70`,"data-testid":`project-switcher-trigger`,title:`Open project menu`,children:[a,c]})}),t[35]=a,t[36]=w),_=R_,T=`start`,E=`top`,D=`min-w-[260px]`,y=`project-switcher-menu`,t[37]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Y.jsx)(H_,{className:`font-mono font-normal tracking-wide uppercase text-muted-foreground text-xs`,children:`Recent projects`}),t[37]=b):b=t[37],x=r.length===0?(0,Y.jsx)(H_,{className:`font-normal text-muted-foreground text-xs`,children:`No other recent projects.`}):r.slice(0,10).map(e=>(0,Y.jsxs)(z_,{disabled:e.missing,onSelect:()=>d(e.path),className:`flex flex-col items-start gap-0.5`,"data-testid":`project-switcher-recent-${e.path}`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-sm`,children:e.name}),(0,Y.jsxs)(`span`,{className:`max-w-[240px] truncate text-muted-foreground text-xs`,children:[e.path,e.missing?` (missing)`:``]})]},e.path)),t[14]=n.config.projectName,t[15]=g,t[16]=o,t[17]=d,t[18]=i,t[19]=_,t[20]=v,t[21]=y,t[22]=b,t[23]=x,t[24]=S,t[25]=C,t[26]=w,t[27]=T,t[28]=E,t[29]=D}else _=t[19],v=t[20],y=t[21],b=t[22],x=t[23],S=t[24],C=t[25],w=t[26],T=t[27],E=t[28],D=t[29];let O;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Y.jsx)(U_,{}),t[38]=O):O=t[38];let k;t[39]===p?k=t[40]:(k=(0,Y.jsx)(z_,{onSelect:p,"data-testid":`project-switcher-open-folder`,children:`Open folder…`}),t[39]=p,t[40]=k);let A;t[41]===h?A=t[42]:(A=(0,Y.jsx)(z_,{onSelect:h,"data-testid":`project-switcher-switch-project`,children:Dd}),t[41]=h,t[42]=A);let j;t[43]!==_||t[44]!==y||t[45]!==b||t[46]!==x||t[47]!==k||t[48]!==A||t[49]!==T||t[50]!==E||t[51]!==D?(j=(0,Y.jsxs)(_,{align:T,side:E,className:D,"data-testid":y,children:[b,x,O,k,A]}),t[43]=_,t[44]=y,t[45]=b,t[46]=x,t[47]=k,t[48]=A,t[49]=T,t[50]=E,t[51]=D,t[52]=j):j=t[52];let M;return t[53]!==v||t[54]!==S||t[55]!==C||t[56]!==w||t[57]!==j?(M=(0,Y.jsxs)(v,{open:S,onOpenChange:C,children:[w,j]}),t[53]=v,t[54]=S,t[55]=C,t[56]=w,t[57]=j,t[58]=M):M=t[58],M}function ZN(e){let t=(0,Z.c)(13),{notice:n,onDismiss:r}=e,i=n.variant===`error`?`border-destructive/60`:`border-sidebar-border`,a=`update-notice-${n.id}`,o=`flex items-center gap-2 rounded-md border bg-sidebar-accent/30 px-2 py-1.5 text-xs text-muted-foreground ${i}`,s;t[0]===n.body?s=t[1]:(s=(0,Y.jsx)(`span`,{className:`flex-1 leading-snug`,children:n.body}),t[0]=n.body,t[1]=s);let c;t[2]===n.action?c=t[3]:(c=n.action?(0,Y.jsx)(`button`,{type:`button`,className:`shrink-0 text-xs font-medium underline underline-offset-2 decoration-muted-foreground/40 hover:text-sidebar-foreground hover:decoration-sidebar-foreground`,onClick:()=>{n.action?.onClick()},children:n.action.label}):null,t[2]=n.action,t[3]=c);let l;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Y.jsx)(Zt,{"aria-hidden":`true`,className:`size-3`}),t[4]=l):l=t[4];let u;t[5]===r?u=t[6]:(u=(0,Y.jsx)(K,{variant:`ghost`,size:`icon`,className:`size-5 shrink-0 text-muted-foreground hover:text-sidebar-foreground`,"aria-label":`Dismiss notice`,onClick:r,children:l}),t[5]=r,t[6]=u);let d;return t[7]!==a||t[8]!==o||t[9]!==s||t[10]!==c||t[11]!==u?(d=(0,Y.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":a,className:o,children:[s,c,u]}),t[7]=a,t[8]=o,t[9]=s,t[10]=c,t[11]=u,t[12]=d):d=t[12],d}function QN(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 $N(){let e=(0,Z.c)(7),t=(0,X.useSyncExternalStore)(xu,bu,bu),n;e[0]===t?n=e[1]:(n=QN(t),e[0]=t,e[1]=n);let r=n;if(!r)return null;let i;e[2]===r.id?i=e[3]:(i=()=>{yu(r.id)},e[2]=r.id,e[3]=i);let a;return e[4]!==r||e[5]!==i?(a=(0,Y.jsx)(`div`,{"data-testid":`update-notices-list`,children:(0,Y.jsx)(ZN,{notice:r,onDismiss:i})}),e[4]=r,e[5]=i,e[6]=a):a=e[6],a}function eP(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Y.jsx)(_t,{name:`file-sidebar`,children:(0,Y.jsx)(tP,{})}),e[0]=t):t=e[0],t}function tP(){let e=(0,Z.c)(8),t=(0,X.useRef)(null),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Y.jsx)(`span`,{className:`font-mono text-sm uppercase tracking-wider text-sidebar-foreground/50`,children:`Files`}),e[0]=n):n=e[0];let r;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Y.jsxs)(ln,{children:[(0,Y.jsx)(nn,{asChild:!0,children:(0,Y.jsx)(L_,{asChild:!0,children:(0,Y.jsx)(K,{variant:`ghost`,size:`icon`,"aria-label":`Tree view options`,children:(0,Y.jsx)(zi,{"aria-hidden":`true`})})})}),(0,Y.jsx)(an,{children:`Tree view options`})]}),e[1]=r):r=e[1];let i;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Y.jsxs)(z_,{onSelect:()=>t.current?.expandAll(),children:[(0,Y.jsx)(ma,{"aria-hidden":`true`}),`Expand All`]}),e[2]=i):i=e[2];let a;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Y.jsxs)(I_,{children:[r,(0,Y.jsxs)(R_,{align:`end`,children:[i,(0,Y.jsxs)(z_,{onSelect:()=>t.current?.collapseAll(),children:[(0,Y.jsx)(Ei,{"aria-hidden":`true`}),`Collapse All`]})]})]}),e[3]=a):a=e[3];let o;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Y.jsxs)(ln,{children:[(0,Y.jsx)(nn,{asChild:!0,children:(0,Y.jsx)(K,{variant:`ghost`,size:`icon`,"aria-label":`New file`,onClick:()=>t.current?.startCreating(`file`,``),children:(0,Y.jsx)(sa,{"aria-hidden":`true`})})}),(0,Y.jsx)(an,{children:`New File`})]}),e[4]=o):o=e[4];let s;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Y.jsx)(cx,{children:(0,Y.jsx)(dx,{children:(0,Y.jsx)(fx,{children:(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[n,(0,Y.jsxs)(`div`,{className:`flex items-center gap-1`,children:[a,o,(0,Y.jsxs)(ln,{children:[(0,Y.jsx)(nn,{asChild:!0,children:(0,Y.jsx)(K,{variant:`ghost`,size:`icon`,"aria-label":`New folder`,onClick:()=>t.current?.startCreating(`folder`,``),children:(0,Y.jsx)(Di,{"aria-hidden":`true`})})}),(0,Y.jsx)(an,{children:`New Folder`})]})]})]})})})}),e[5]=s):s=e[5];let c;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Y.jsx)(ux,{children:(0,Y.jsx)(RN,{ref:t})}),e[6]=c):c=e[6];let l;return e[7]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Y.jsxs)(ax,{variant:`inset`,children:[s,c,(0,Y.jsxs)(lx,{className:`px-0`,children:[typeof window<`u`&&window.okDesktop?(0,Y.jsx)(dx,{children:(0,Y.jsx)(fx,{children:(0,Y.jsx)(XN,{bridge:window.okDesktop})})}):null,(0,Y.jsx)($N,{})]})]}),e[7]=l):l=e[7],l}function nP(){let e=(0,Z.c)(17),t=y(),{collabUrl:n,setSystemProvider:r,updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c}=ut(),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,X.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,X.useEffect)(d);let f,p;return e[12]!==n||e[13]!==t||e[14]!==r?(f=()=>{if(n===null)return;let e=new Le,i=new Be({url:n,name:Qn,document:e,onStateless:e=>{let{payload:t}=e;He(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:oP,onUnknown:aP})},onClose:iP,onDisconnect:rP}),a=Fn(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=kt(()=>{u.current.refreshServerInfo()});i.on(`synced`,()=>{Wn([`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,X.useEffect)(f,p),null}function rP(){console.warn(`[CC1] __system__ disconnected - derived views may be stale`)}function iP(e){let{event:t}=e;console.warn(`[CC1] __system__ connection closed:`,t.code,t.reason)}function aP(e){console.warn(`[CC1] Unparseable stateless payload, skipping:`,e.slice(0,100))}function oP(e){Wn([e.ch])}function sP(){let e=(0,Z.c)(7),{clearTarget:t}=ut(),{openTargetTransition:n}=gt(),{folderPaths:r,loading:i,pages:a}=Vn(),o,s;return e[0]!==t||e[1]!==r||e[2]!==i||e[3]!==n||e[4]!==a?(o=()=>{e();function e(){let e=Kn(window.location.hash);if(!e){it(`ok/nav/hash-change`,{docName:null,kind:`clear`}),t();return}if(i){it(`ok/nav/hash-change`,{docName:e,kind:`deferred-loading`});return}let o=Hn(e,{pages:a,folderPaths:r});it(`ok/nav/hash-change`,{docName:e,kind:o.kind}),n(o)}return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},s=[t,r,i,n,a],e[0]=t,e[1]=r,e[2]=i,e[3]=n,e[4]=a,e[5]=o,e[6]=s):(o=e[5],s=e[6]),(0,X.useEffect)(o,s),null}var cP=`#install-claude-desktop`;function lP(){let e=(0,Z.c)(5),[t,n]=(0,X.useState)(typeof window<`u`&&window.location.hash===cP),r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=function(){window.location.hash===cP&&n(!0)};return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,X.useEffect)(r,i);let a;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=function(e){if(n(e),!e&&window.location.hash===cP){let{pathname:e,search:t}=window.location;window.history.replaceState(null,``,`${e}${t}`)}},e[2]=a):a=e[2];let o=a,s;return e[3]===t?s=e[4]:(s=(0,Y.jsx)(Ux,{open:t,onOpenChange:o}),e[3]=t,e[4]=s),s}function uP(){let e=(0,Z.c)(8),{activeDocName:t,activeTarget:n}=ut(),[r,i]=(0,X.useState)(!1),a;e[0]!==t||e[1]!==n?(a=n?.kind===`folder`?n.folderPath:qn(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;Dt({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,X.useEffect)(s,c);let l;return e[5]!==r||e[6]!==o?(l=(0,Y.jsx)(qe,{open:r,onOpenChange:i,kind:`file`,initialDir:o}),e[5]=r,e[6]=o,e[7]=l):l=e[7],l}function dP(){let e=(0,Z.c)(9),t=typeof window<`u`?window.okDesktop??null:null,n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Y.jsx)(bf,{}),e[0]=n):n=e[0];let r,i,a,o,s,c;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Y.jsx)(nP,{}),i=(0,Y.jsx)(sP,{}),a=(0,Y.jsx)(uP,{}),o=(0,Y.jsx)(lP,{}),s=(0,Y.jsx)(Bl,{}),c=t?(0,Y.jsx)(hf,{bridge:t}):null,e[1]=r,e[2]=i,e[3]=a,e[4]=o,e[5]=s,e[6]=c):(r=e[1],i=e[2],a=e[3],o=e[4],s=e[5],c=e[6]);let l;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Y.jsx)(eP,{}),e[7]=l):l=e[7];let u;return e[8]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Y.jsx)(_t,{name:`app`,children:(0,Y.jsxs)(bt,{children:[n,(0,Y.jsxs)(Jn,{children:[r,i,a,o,s,c,(0,Y.jsxs)(nx,{className:`h-screen overflow-hidden`,children:[l,(0,Y.jsx)(sx,{className:`overflow-hidden h-[calc(100vh-var(--layout-inset-offset))]`,children:(0,Y.jsx)(AS,{})})]})]})]})}),e[8]=u):u=e[8],u}Pr(),typeof window<`u`&&window.okDesktop?.config.apiOrigin&&Zl({apiOrigin:window.okDesktop.config.apiOrigin}),typeof window<`u`&&tu({bridge:window.okDesktop}),Su(),typeof window<`u`&&eu({bridge:window.okDesktop}),typeof window<`u`&&wa({bridge:window.okDesktop});var fP=new Ur({defaultOptions:{queries:{retry:1,staleTime:1e4}}}),pP=document.getElementById(`root`);if(!pP)throw Error(`Root element not found`);var mP=typeof window<`u`&&window.okDesktop?.config.mode===`navigator`;(0,ri.createRoot)(pP).render((0,Y.jsx)(X.StrictMode,{children:(0,Y.jsx)(v,{client:fP,children:(0,Y.jsxs)(_,{attribute:`class`,defaultTheme:`system`,enableSystem:!0,disableTransitionOnChange:!0,storageKey:`ok-theme-v1`,children:[(0,Y.jsx)(sn,{children:mP&&window.okDesktop?(0,Y.jsx)(Kl,{bridge:window.okDesktop}):(0,Y.jsx)(dP,{})}),(0,Y.jsx)(Xl,{richColors:!0})]})})}));export{Pl as i,Nl as n,Fl as r,Ll as t};
1835
+ }`}var QD=new WeakMap;function $D(e){let t=QD.get(e);if(t!=null)return t;let n=document.createElement(`div`);n.setAttribute(qC,`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(),QD.set(e,i),i}function eO(e,t){if(!e.isConnected)return;let n=$D(t);if(n==null)return;let r=t.querySelector(`style[${JC}]`),i=r instanceof HTMLStyleElement?r:document.createElement(`style`);r instanceof HTMLStyleElement||(i.setAttribute(JC,``),t.appendChild(i)),i.textContent=`:host { ${YC}: ${n}px; }`}var tO;function nO(e){if(typeof CSSStyleSheet<`u`&&typeof CSSStyleSheet.prototype.replaceSync==`function`&&`adoptedStyleSheets`in e){tO??(tO=new CSSStyleSheet,tO.replaceSync(XD(JD)));let t=!1;try{e.adoptedStyleSheets=[tO],t=!0}catch{}if(t){e.querySelector(`style[${GC}]`)?.remove();return}}if(e.querySelector(`style[data-file-tree-style]`)==null){let t=document.createElement(`style`);t.setAttribute(GC,``),t.textContent=XD(JD),e.prepend(t)}}function rO(e,t){iO(e,t),nO(t),eO(e,t)}function iO(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`});rO(this,e)}}if(customElements.define(WC,e),typeof document<`u`)for(let e of Array.from(document.querySelectorAll(WC)))e instanceof HTMLElement&&rO(e,e.shadowRoot??e.attachShadow({mode:`open`}))}var aO=e=>e.startsWith(`f::`)?e.slice(3):e;function oO(e){let t=e.lastIndexOf(`/`);return t<0?{parentPath:``,baseName:e}:{parentPath:e.slice(0,t),baseName:e.slice(t+1)}}function sO(e,t){return e===``?t:`${e}/${t}`}function cO({files:e,path:t,isFolder:n,nextBasename:r}){let i=aO(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}=oO(i);if(a===s)return{nextFiles:e,sourcePath:i,destinationPath:i,isFolder:n};let c=sO(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 lO(e){return e.endsWith(`/`)}function uO(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 dO(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 fO(e,t){return t.includes(e)?dO(t):[e]}function pO(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 mO(e,t){return{draggedPaths:e,target:t}}function hO(e,t){if(t.kind!==`directory`||t.directoryPath==null)return!1;for(let n of e)if(lO(n)&&(t.directoryPath===n||t.directoryPath.startsWith(n)))return!0;return!1}function gO(e,t){return t.kind===`root`||t.directoryPath==null?uO(e):t.directoryPath}function _O(e,t){let n=e.map(e=>{let n=gO(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}}}var vO=Symbol(`FILE_TREE_RENAME_VIEW`);function yO(e){return e.operation===`add`||e.operation===`remove`||e.operation===`move`||e.operation===`batch`}var bO=512,xO=512;function SO(e,t){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}function CO(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 wO(e){return CO(e).at(-1)??null}function TO(e,t){return t==null?e:e.startsWith(t)?e.slice(t.length):e}var EO=e=>{let t=e.trim();return t.length===0?``:(t.includes(`\\`)?t.replaceAll(`\\`,`/`):t).toLowerCase()},DO=e=>e.toLowerCase();function OO(e){return e.endsWith(`/`)}function kO(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`);return n<0?t:t.slice(n+1)}function AO(e){return e.endsWith(`/`)?e.slice(0,-1):e}function jO(e,t){return t&&!e.endsWith(`/`)?`${e}/`:e}function MO(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 NO(e,t){if(e===t)return!0;let n=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(n)}function PO(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 NO(e,t.path)?n?e:null:e;case`move`:return MO(e,t.from,t.to);case`batch`:{let r=e;for(let e of t.events)if(r=PO(r,e,n),r==null)return null;return r}}}function FO(e){return{canonicalChanged:e.canonicalChanged,projectionChanged:e.projectionChanged,visibleCountDelta:e.visibleCountDelta}}function IO(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 LO(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(!IO(UD.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 RO(e){switch(e.operation){case`add`:return{...FO(e),operation:`add`,path:e.path};case`remove`:return{...FO(e),operation:`remove`,path:e.path,recursive:e.recursive};case`move`:return{...FO(e),from:e.from,operation:`move`,to:e.to}}}function zO(e){return{...FO(e),events:e.events.filter(e=>e.operation===`add`||e.operation===`remove`||e.operation===`move`).map(e=>RO(e)),operation:`batch`}}function BO(e){switch(e.operation){case`add`:case`remove`:case`move`:return RO(e);case`batch`:return zO(e);default:return null}}function VO(e,t,n){if(e===0)return-1;if(n!=null){let e=t(n);if(e!=null)return e;let r=CO(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 HO(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:VO(e.paths.length,r,t),getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex}}var UO=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=new Set;#z=0;#B;#V=0;#H=!1;#U=0;#W;constructor(e){let{dragAndDrop:t,fileTreeSearchMode:n,initialSearchQuery:r,initialSelectedPaths:i,renaming:a,onSearchChange:o,paths:s,preparedInput:c,...l}=e,u=LO({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.#B=this.#se(u.paths,u.preparedInput);let d=i?.map(e=>this.#Ae(e)).filter(e=>e!=null)??[],f=d.at(-1)??null;d.length>0&&(this.#R=new Set(d),this.#L=f,this.#z=1),this.#Oe(f,!1),r!=null&&this.#Se(r,!1),this.#W=this.#Fe()}destroy(){this.#W?.(),this.#W=null,this.#n.clear(),this.#t.clear(),this.#d.clear(),this.#i=null,this.#pe()}focusFirstItem(){this.#ve().length>0&&this.#Me(0)}focusLastItem(){this.#U<=0||(this.#Ne(),this.#Me(this.#U-1))}focusNextItem(){this.#De(1)}focusParentItem(){if(this.#c==null)return;let e=wO(this.#c);if(e==null)return;let t=this.#Y(e);t>=0&&this.#Me(t)}focusPath(e){let t=this.#B.getPathInfo(e)?.path??null;if(t==null)return;this.#Ne();let n=this.#Y(t);n>=0&&this.#Me(n)}focusNearestPath(e){let t=this.resolveNearestVisiblePath(e);if(t==null)return null;let n=this.#Y(t);return n>=0?(this.#Me(n),this.#ve()[n]??t):null}focusPreviousItem(){this.#De(-1)}getFocusedIndex(){return this.#s}getFocusedItem(){return this.#c==null?null:this.#X(this.#c)}getFocusedPath(){return this.#c}resolveNearestVisiblePath(e){let t=this.#ve();if(this.#U===0)return null;if(e==null)return this.#c??t[0]??null;let n=this.#B.getPathInfo(e)?.path??e,r=this.#Y(n);return r>=0?t[r]??n:this.#J(n)??this.#c??t[0]??null}getSelectedPaths(){return[...this.#R]}getSelectionVersion(){return this.#z}getVisibleCount(){return this.#U}getVisibleRows(e,t){if(t<e||this.#U===0)return[];let n=Math.max(0,e),r=Math.min(this.#U-1,t);if(r<n)return[];let i=r-n+1;if(this.#F==null&&!this.#l&&r>=this.#b.length&&i<=xO){let e=[];for(let t=n;t<=r;t+=1){let n=this.#B.getVisibleRowContext(t);if(n==null)break;e.push(this.#Q(n))}return e}if(!this.#l&&r>=this.#b.length&&this.#Ne(),this.#F!=null){let e=Array.from({length:r-n+1},(e,t)=>this.#ye(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.#B.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.#ye(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.#Z(o,i,a,{ancestorPaths:this.#te(a),path:s})})}return this.#B.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.#Z(e,r,r,{ancestorPaths:this.#te(r),path:i})})}getStickyRowCandidates(e,t){if(this.#F!=null)return null;if(this.#U===0||e<=0||t<=0)return[];let n=[];for(let r=0;r<this.#U;r+=1){let i=e+r*t,a=Math.min(this.#U-1,Math.floor(i/t)),o=this.#$(a,r)??(a>0?this.#$(a-1,r):void 0);if(o==null)break;n.push({row:this.#Q(o),subtreeEndIndex:o.subtreeEndIndex})}return n}getItem(e){let t=this.#B.getPathInfo(e);return t==null?null:this.#X(t.path,t)}selectAllVisiblePaths(){this.#Ne();let e=[...this.#ve()];this.#re(e,this.#c??this.#L)}selectOnlyPath(e){let t=this.#Ae(e);t!=null&&this.#re([t],t)}selectPath(e){let t=this.#Ae(e);t==null||this.#R.has(t)||this.#re([...this.#R,t])}deselectPath(e){let t=this.#Ae(e);t==null||!this.#R.has(t)||this.#re([...this.#R].filter(e=>e!==t))}toggleFocusedSelection(){this.#c!=null&&this.togglePathSelectionFromInput(this.#c)}togglePathSelection(e){let t=this.#Ae(e);if(t!=null){if(this.#R.has(t)){this.deselectPath(t);return}this.selectPath(t)}}togglePathSelectionFromInput(e){let t=this.#Ae(e);if(t!=null){if(this.#R.has(t)){this.#re([...this.#R].filter(e=>e!==t),t);return}this.#re([...this.#R,t],t)}}selectPathRange(e,t){let n=this.#Ae(e);if(n==null)return;this.#Ne();let r=this.#L,i=r==null?-1:this.#be(r),a=this.#be(n);if(i===-1||a===-1){let e=t?[...this.#R,n]:[n];this.#re(e,n);return}let[o,s]=i<=a?[i,a]:[a,i],c=this.#ve().slice(o,s+1),l=t?[...this.#R,...c]:c;this.#re(l,r)}extendSelectionFromFocused(e){if(this.#c==null)return;let t=this.#s;if(t===-1)return;let n=Math.min(this.#U-1,Math.max(0,t+e));if(n===t)return;!this.#l&&n>=this.#b.length&&this.#Ne();let r=this.#ve(),i=r[t]??null,a=r[n]??null;if(i==null||a==null)return;let o=new Set(this.#R);o.has(i)&&o.has(a)?o.delete(i):o.add(a),this.#re([...o],this.#L??i,!1),this.#Me(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.#Ae(e);if(t==null||this.#M!=null&&this.#M.length>0)return!1;let n=this.getSelectedPaths(),r=fO(t,n);return this.#r.canDrag?.(r)===!1?!1:(n.includes(t)||this.#re([t],t,!1),this.#je(t),this.#i={draggedPaths:r,primaryPath:t,target:null},this.#we(),!0)}setDragTarget(e){let t=this.#i;if(t==null)return;let n=e;if(n!=null){let e=mO(t.draggedPaths,n);(hO(t.draggedPaths,n)||this.#r?.canDrop?.(e)===!1)&&(n=null)}pO(t.target,n)||(this.#i={...t,target:n},this.#we())}cancelDrag(){this.#i!=null&&(this.#i=null,this.#we())}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.#we(),!1;let n=mO(e.draggedPaths,t);if(hO(e.draggedPaths,t)||this.#r?.canDrop?.(n)===!1)return this.#we(),!1;let r=_O(e.draggedPaths,t);if(r==null)return this.#we(),!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.#B.move(e.from,e.to,{collision:e.collision})}else this.#oe(r.operations),this.#B.batch(r.operations)}catch(e){return this.#we(),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.#B.add(e)}remove(e,t={}){this.#B.remove(e,t)}move(e,t,n={}){this.#B.move(e,t,n)}batch(e){this.#B.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.#Se(e,!0)}openSearch(e=``){this.#Se(e,!0)}closeSearch(){this.#Se(null,!0)}isSearchOpen(){return this.#M!==null}getSearchValue(){return this.#M??``}getSearchMatchingPaths(){return this.#k}focusNextSearchMatch(){this.#xe(1)}focusPreviousSearchMatch(){this.#xe(-1)}startRenaming(e=this.#c??``,t={}){if(!this.#w)return!1;let n=this.#B.getPathInfo(e);if(n==null)return!1;let r=n.path,i=OO(r),a=AO(r);if(this.#C?.({isFolder:i,path:a})===!1)return!1;for(let e of CO(r))this.#B.isExpanded(e)||this.#B.expand(e);return this.#re([r],r,!1),this.#M!=null&&(this.#Se(null,!1),this.#y?.(this.#M)),this.#je(r),this.#T=r,this.#E=kO(r),this.#D=t.removeIfCanceled??!1,this.#we(),!0}[vO](){return{cancel:()=>{this.#G()},commit:()=>{this.#K()},getPath:()=>this.#T,getValue:()=>this.#E,isActive:()=>this.#T!=null,setValue:e=>{this.#q(e)}}}#G(){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,OO(e)?{recursive:!0}:void 0);return}this.#je(e),this.#we()}#K(){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,OO(e)?{recursive:!0}:void 0);return}let t=OO(e),n=cO({files:this.#B.list(),isFolder:t,nextBasename:this.#E,path:AO(e)});if(this.#T=null,this.#E=``,this.#D=!1,`error`in n){this.#je(e),this.#v?.(n.error),this.#we();return}if(n.sourcePath===n.destinationPath){this.#je(e),this.#we();return}this.#_?.({destinationPath:n.destinationPath,isFolder:n.isFolder,sourcePath:n.sourcePath}),this.move(jO(n.sourcePath,t),jO(n.destinationPath,t))}#q(e){this.#T==null||this.#E===e||(this.#E=e,this.#we())}resetPaths(e,t={}){let n=this.#B.list().length,r=this.#U,i=LO({paths:e,preparedInput:t.preparedInput},`resetPaths`,this.#e.sort),a=this.#se(i.paths,i.preparedInput,t.initialExpandedPaths),o=this.#c,s=this.#T,c=this.getSelectedPaths(),l=this.#L;this.#W?.(),this.#B=a,this.#d.clear(),this.#pe();let u=c.map(e=>a.getPathInfo(e)?.path??null).filter(e=>e!=null),d=!SO(this.#R,u);this.#R=new Set(u),d&&(this.#z+=1),this.#L=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.#Oe(o,o!=null||u.length>0||this.#L!=null),this.#W=this.#Fe(),this.#we(),this.#Te({canonicalChanged:!0,operation:`reset`,pathCountAfter:i.paths.length,pathCountBefore:n,projectionChanged:!0,usedPreparedInput:t.preparedInput!=null,visibleCountDelta:this.#U-r})}#J(e){this.#Ne();let t=wO(e),n=TO(e,t),r=null,i=null;for(let e of this.#ve()){if(wO(e)!==t)continue;let a=TO(e,t);if(a<n){r=e;continue}if(a>n){i=e;break}}return r??i}#Y(e){let t=this.#be(e);if(t!==-1)return t;let n=CO(e);for(let e=n.length-1;e>=0;--e){let t=n[e];if(t==null)continue;let r=this.#be(t);if(r!==-1)return r}return this.#ve().length>0?0:-1}#X(e,t){let n=this.#d.get(e);if(n!=null)return n;let r=t??this.#B.getPathInfo(e);if(r==null)return null;let i=r.kind===`directory`?this.#ie(r.path):this.#ae(r.path);return this.#d.set(r.path,i),i}#Z(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.#R.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}}#Q(e){return this.#Z(e.row,e.index,e.index,{ancestorPaths:e.ancestorPaths,path:e.row.path,posInSet:e.posInSet,setSize:e.setSize})}#$(e,t){let n=this.#B.getVisibleRowContext(e);return n==null?void 0:n.ancestorRows[t]??(t===n.ancestorRows.length&&n.row.kind===`directory`&&n.row.isExpanded?n:void 0)}#ee(e){let t=this.#a.get(e);if(t!=null)return t;let n=this.#u(e),r=n<0?[]:[...this.#ee(n),n];return this.#a.set(e,r),r}#te(e){let t=this.#o.get(e);if(t!=null)return t;let n=this.#ee(e).map(e=>this.#b[e]??``).filter(e=>e!==``);return this.#o.set(e,n),n}#ne(e){this.#B.collapse(e)}#re(e,t=this.#L,n=!0){let r=[...new Set(e)],i=!SO(this.#R,r),a=this.#L!==t;!i&&!a||(this.#R=new Set(r),this.#L=t,i&&(this.#z+=1),n&&this.#we())}#ie(e){return{collapse:()=>{this.#ne(e)},deselect:()=>{this.deselectPath(e)},expand:()=>{this.#Ee(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!0,isExpanded:()=>this.#B.isExpanded(e),isFocused:()=>this.#c===e,isSelected:()=>this.#R.has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)},toggle:()=>{this.#Ie(e)}}}#ae(e){return{deselect:()=>{this.deselectPath(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!1,isFocused:()=>this.#c===e,isSelected:()=>this.#R.has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)}}}#oe(e){let t=this.#B.list();this.#se(t).batch(e)}#se(e,t,n){return new UD({...this.#e,paths:e,preparedInput:t??void 0,...n===void 0?{}:{initialExpandedPaths:n}})}#ce(){return this.#h??=this.#B.list(),this.#h}#le(){if(this.#m!=null)return this.#m;let e=new Set;for(let t of this.#ce()){e.add(t);for(let n of CO(t))e.add(n)}return this.#m=[...e].sort(),this.#m}#ue(){return this.#g??=this.#ce().map(DO),this.#g}#de(){return this.#f??=this.#le().filter(e=>e.endsWith(`/`)),this.#f}#fe(){return this.#p??=this.#de().map(DO),this.#p}#pe(){this.#f=null,this.#p=null,this.#m=null,this.#h=null,this.#g=null}#me(){return this.#de().filter(e=>this.#B.isExpanded(e))}#he(e){let t=new Set(this.#j??[]);if(e)for(let e of this.#R)for(let n of CO(e))t.add(n);this.#ge(t)}#ge(e){this.#H=!0;try{for(let t of this.#de()){let n=e.has(t),r=this.#B.isExpanded(t);n&&!r?this.#B.expand(t):!n&&r&&this.#B.collapse(t)}}finally{this.#H=!1}}#_e(){let e=this.#b;if(this.#k=e.filter(e=>this.#O.has(e)),this.#M==null||this.#M.length===0||this.#A!==`hide-non-matches`||this.#O.size===0){this.#F=null,this.#I=null,this.#P=null,this.#U=this.#V;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.#U=n.length}#ve(){return this.#I??this.#b}#ye(e){return this.#F?.[e]??e}#be(e){return this.#P?.get(e)??this.#B.getVisibleIndex(e)??-1}#xe(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)}#Se(e,t){let n=e==null?null:EO(e),r=this.#M;if(r!==n){if(r==null&&n!=null&&(this.#j=this.#me()),this.#M=n,n==null)this.#he(!0),this.#j=null,this.#O.clear(),this.#N=null,this.#Oe(this.#c,!0);else if(n.length===0)this.#he(!1),this.#O.clear(),this.#N=null,this.#Oe(this.#c,!0);else{let e=this.#Ce();this.#Oe(e,!0)}t&&(this.#y?.(this.#M),this.#we())}}#Ce(){if(this.#M==null||this.#M.length===0)return this.#O.clear(),this.#c;let e=this.#M,t=this.#ce(),n=this.#ue(),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.#de(),s=this.#fe();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 CO(e))l.add(t),c?.add(t)}return this.#ge(l),a??this.#c}#we(){for(let e of this.#t)e()}#Te(e){this.#n.get(e.operation)?.forEach(t=>{t(e)}),this.#n.get(`*`)?.forEach(t=>{t(e)})}#Ee(e){for(let t of CO(e))this.#B.isExpanded(t)||this.#B.expand(t);this.#B.isExpanded(e)||this.#B.expand(e)}#De(e){let t=this.#U;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.#Ne(),this.#Me(r))}#Oe(e,t=!0){let n=this.#B.getVisibleCount();this.#V=n;let r=HO(this.#B.getVisibleTreeProjectionData(t?void 0:Math.min(n,bO)),e,t?e=>this.#B.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.#_e(),this.#s=e==null?this.#ve().length>0?0:-1:this.#Y(e),this.#c=this.#s<0?null:this.#ke(this.#s)}#ke(e){return this.#ve()[e]??(this.#F==null?this.#B.getVisibleRowContext(e)?.row.path??null:null)}#Ae(e){return this.#B.getPathInfo(e)?.path??null}#je(e){if(e==null)return;let t=this.#Y(e);t>=0&&this.#Me(t,!1)}#Me(e,t=!0){let n=this.#ke(e);n!=null&&(this.#s===e&&this.#c===n||(this.#s=e,this.#c=n,t&&this.#we()))}#Ne(){this.#l||this.#Oe(this.#c,!0)}#Pe(e){let t=PO(this.#T,e);t==null&&this.#T!=null&&(this.#E=``),this.#T=t;let n=PO(this.#c,e,!0),r=[...this.#R].map(t=>PO(t,e)).filter(e=>e!=null).map(e=>this.#B.getPathInfo(e)?.path??null).filter(e=>e!=null),i=PO(this.#L,e),a=i==null?null:this.#B.getPathInfo(i)?.path??null,o=[...new Set(r)];return SO(this.#R,o)||(this.#R=new Set(o),this.#z+=1),this.#L=a,n}#Fe(){return this.#B.on(`*`,e=>{if(this.#H)return;e.canonicalChanged&&(this.#d.clear(),this.#pe()),this.#i!=null&&yO(e)&&(this.#i=null);let t=yO(e)?this.#Pe(e):this.#c,n=this.#M!=null&&this.#M.length>0?this.#Ce():this.#M===``?this.#c:t,r=this.#M!=null||e.operation!==`expand`&&e.operation!==`collapse`;this.#Oe(n,r),this.#we();let i=BO(e);i!=null&&this.#Te(i)})}#Ie(e){if(this.#B.isExpanded(e)){this.#ne(e);return}this.#Ee(e)}},WO=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 GO(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 KO(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 qO(e,t){return t?`${e}/`:e}function JO(e,t=null){let n=WO(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=GO(t.path);if(e==null)continue;let n=qO(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 KO(e.path))i.add(t)}return{directoriesWithChanges:i,ignoredDirectoryPaths:a,signature:n,statusByPath:r}}var YO,XO,ZO,QO,$O,ek,tk,nk,rk,ik,ak={},ok=[],sk=Array.isArray,ck=ok.slice,lk=Object.assign;function uk(e){e&&e.parentNode&&e.remove()}function dk(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?ck.call(arguments,2):n),fk(e,o,r,i,null)}function fk(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??++XO,__i:-1,__u:0};return i==null&&YO.vnode!=null&&YO.vnode(a),a}function pk(e){return e.children}function mk(e,t){this.props=e,this.context=t,this.__g=0}function hk(e,t){if(t==null)return e.__?hk(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`?hk(e):null}function gk(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 gk(e)}}function _k(e){(8&e.__g||!(e.__g|=8)||!ZO.push(e)||$O++)&&QO==YO.debounceRendering||((QO=YO.debounceRendering)||queueMicrotask)(vk)}function vk(){for(var e,t,n,r,i,a,o,s,c=1;ZO.length;)ZO.length>c&&ZO.sort(ek),e=ZO.shift(),c=ZO.length,8&e.__g&&(n=void 0,i=(r=(t=e).__v).__e,a=[],o=[],(s=t.__P)&&((n=lk({},r)).__v=r.__v+1,YO.vnode&&YO.vnode(n),Ek(s,n,r,t.__n,s.namespaceURI,32&r.__u?[i]:null,a,i??hk(r),!!(32&r.__u),o,s.ownerDocument),n.__v=r.__v,n.__.__k[n.__i]=n,Ok(a,n,o),n.__e!=i&&gk(n)));$O=0}function yk(e,t,n,r,i,a,o,s,c,l,u,d){var f,p,m,h,g,_,v,y=r&&r.__k||ok,b=t.length;for(c=bk(n,t,y,c,b),f=0;f<b;f++)(m=n.__k[f])!=null&&(p=m.__i==-1?ak:y[m.__i]||ak,m.__i=f,_=Ek(e,m,p,i,a,o,s,c,l,u,d),h=m.__e,m.ref&&p.ref!=m.ref&&(p.ref&&jk(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=xk(m,c,e,v):typeof m.type==`function`&&_!==void 0?c=_:h&&(c=h.nextSibling),m.__u&=-7);return n.__e=g,c}function bk(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?fk(null,o,null,null,null):sk(o)?fk(pk,{children:o},null,null,null):o.constructor==null&&o.__b>0?fk(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=Sk(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=hk(s)),Mk(s,s));return r}function xk(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=xk(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=hk(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function Sk(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 Ck(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n??``}function wk(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||Ck(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||Ck(e.style,t,n[t])}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(tk,`$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=nk,e.addEventListener(t,a?ik:rk,a)):e.removeEventListener(t,a?ik:rk,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 Tk(e){return function(t){if(this.__l){var n=this.__l[t.type+e];if(t.u==null)t.u=nk++;else if(t.u<n.l)return;return n(YO.event?YO.event(t):t)}}}function Ek(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=YO.__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 mk(v,x),f.constructor=M,f.render=Nk),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=lk({},f.__s)),lk(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=YO.__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=lk({},r,f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),E=d,d!=null&&d.type===pk&&d.key==null&&(E=kk(d.props.children)),s=yk(e,sk(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--;)uk(a[j]);Dk(t)}else t.__e=n.__e,t.__k=n.__k,e.then||Dk(t);YO.__e(e,t,n)}else s=t.__e=Ak(n.__e,t,n,r,i,a,o,c,l,u);return(d=YO.diffed)&&d(t),128&t.__u?void 0:s}function Dk(e){e&&e.__c&&(e.__c.__g|=4),e&&e.__k&&e.__k.forEach(Dk)}function Ok(e,t,n){for(var r=0;r<n.length;r++)jk(n[r],n[++r],n[++r]);YO.__c&&YO.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){YO.__e(e,t.__v)}})}function kk(e){return typeof e!=`object`||!e||e.__b&&e.__b>0?e:sk(e)?e.map(kk):lk({},e)}function Ak(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&&=(YO.__m&&YO.__m(t,a),!1),a=null}if(b==null)v===y||s&&e.data==y||(e.data=y);else{if(a&&=ck.call(e.childNodes),v=n.props||ak,!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;wk(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&&!_||wk(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=``),yk(b==`template`?e.content:e,sk(p)?p:[p],t,n,r,b==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&hk(n,0),s,c,l),a!=null)for(u=a.length;u--;)uk(a[u]);s||(u=`value`,b==`progress`&&h==null?e.removeAttribute(`value`):h==null||h===e[u]&&(b!==`progress`||h)||wk(e,u,h,v[u],i),u=`checked`,g!=null&&g!=e[u]&&wk(e,u,g,v[u],i))}return e}function jk(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){YO.__e(e,n)}}function Mk(e,t,n){var r,i;if(YO.unmount&&YO.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||jk(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){YO.__e(e,t)}r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&Mk(r[i],t,n||typeof e.type!=`function`);n||uk(e.__e),e.__e&&e.__e.__l&&(e.__e.__l=null),e.__e=e.__c=e.__=null}function Nk(e,t,n){return this.constructor(e,n)}function Pk(e,t){var n,r,i,a;t==document&&(t=document.documentElement),YO.__&&YO.__(e,t),r=(n=!!(e&&32&e.__u))?null:t.__k,e=t.__k=dk(pk,null,[e]),i=[],a=[],Ek(t,e,r||ak,ak,t.namespaceURI,r?null:t.firstChild?ck.call(t.childNodes):null,i,r?r.__e:t.firstChild,n,a,t.ownerDocument),Ok(i,e,a)}function Fk(e,t){e.__u|=32,Pk(e,t)}YO={__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 $O=0,e}},XO=0,mk.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=lk({},this.state);typeof e==`function`&&(e=e(lk({},n),this.props)),e&&lk(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),_k(this))},mk.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),_k(this))},mk.prototype.render=pk,ZO=[],$O=0,ek=function(e,t){return e.__v.__b-t.__v.__b},tk=/(PointerCapture)$|Capture$/i,nk=0,rk=Tk(!1),ik=Tk(!0);var Ik=0;Array.isArray;function $(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:--Ik,__i:-1,__u:0,__source:i,__self:a};return YO.vnode&&YO.vnode(l),l}var Lk=16,Rk=16,zk={};function Bk({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}=zk[e]??{width:Lk,height:Rk},f=r??l,p=i??u,m=a??d??`0 0 ${l} ${u}`;return $(`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:$(`use`,{href:c})})}var Vk=e=>{if(e.length<2)return[e,``];let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]},Hk=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)]},Uk=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)]},Wk=(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)]},Gk=(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)]},Kk=(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 qk({children:e,marker:t,variant:n=`default`}){"use no memo";return $(`div`,{"aria-hidden":!0,"data-truncate-marker-cell":!0,children:$(`div`,{"data-truncate-marker":!0,children:typeof t==`function`?t({children:e}):n===`fade`?$(`span`,{"data-truncate-fade":!0}):t})})}function Jk(e){"use no memo";let{mode:t,children:n}=e;return $(`div`,{children:[$(`div`,{"data-truncate-content":`visible`,children:t===`fruncate`?$(`span`,{children:n}):n}),$(`div`,{"data-truncate-content":`overflow`,"aria-hidden":!0,children:t===`fruncate`?$(`span`,{children:n}):n})]})}function Yk({children:e,mode:t=`truncate`,marker:n=`…`,variant:r=`default`,...i}){"use no memo";let a=$(Jk,{mode:t,children:e},`content`),o=$(qk,{marker:n,mode:t,variant:r},`marker`),s=$(`div`,{"data-truncate-fill":!0},`fill`);return $(`div`,{"data-truncate-container":t,"data-truncate-variant":r,...i,children:$(`div`,{"data-truncate-grid":!0,children:t===`truncate`?[a,o]:[o,a,s]})})}function Xk({children:e,...t}){"use no memo";return $(Yk,{mode:`truncate`,...t,children:e})}function Zk({children:e,...t}){"use no memo";return $(Yk,{mode:`fruncate`,...t,children:e})}function Qk({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=$(Xk,{...s,children:t[0]}),l=$(Zk,{...s,children:t[1]})}else{if(typeof e!=`string`)return console.error(`MiddleTruncate: children must be a string`),null;if(e.length===0)return $(`div`,{className:a,style:o});if(e.length<i)return $(n===`end`?Zk:Xk,{...s,className:a,style:o,children:e});let t=null,u=null,d=null;if(typeof r==`string`)r===`center`?t=Vk:r===`extension`?t=Hk:r===`leaf-path`&&(t=Uk);else if(typeof r==`number`)t=Wk,u=r;else if(Array.isArray(r)){let[e,n]=r;d=n,e===`last`?t=Gk:e===`first`&&(t=Kk)}else typeof r==`function`&&(t=r);t??=Vk;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=$(Xk,{...s,..._,children:f}),l=$(Zk,{...s,...v,children:p})}return $(`div`,{"data-truncate-group-container":`middle`,className:a,style:o,children:[$(`div`,{"data-truncate-segment-priority":n===`start`||n===`equal`?`1`:`2`,children:c}),$(`div`,{"data-truncate-segment-priority":n===`end`||n===`equal`?`1`:`2`,children:l})]})}var $k={endIndex:-1,startIndex:-1};function eA(e,t,n){return Math.min(Math.max(e,t),n)}function tA(e,t){return e<0||t<e?$k:{endIndex:t,startIndex:e}}function nA(e){return e.startIndex<0||e.endIndex<e.startIndex}function rA(e,t){return nA(e)?0:(e.endIndex-e.startIndex+1)*t}function iA(e,t,n){if(t<=0)return-1;let r=t*n;return e<=0?0:e>=r?t:Math.floor(e/n)}function aA(e,t,n){return t<=0||e<=0?-1:e>=t*n?t-1:Math.ceil(e/n)-1}function oA(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 sA(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 cA(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 lA(e,t,n){if(e.length===0||t<=0)return[];let r=cA(e),i=oA(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=sA(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 uA(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=eA(t.scrollTop,0,o),c=t.stickyRows??lA(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=iA(s,n,t.itemHeight),m=iA(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?$k:tA(m,aA(u+d,n,t.itemHeight)),y=g+1,b=nA(v)?$k:tA(Math.max(y,v.startIndex-a),Math.min(n-1,v.endIndex+a)),x=rA(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:nA(b)?0:b.startIndex*t.itemHeight,startIndex:b.startIndex}}}var dA={added:`A`,deleted:`D`,ignored:null,modified:`M`,renamed:`R`,untracked:`U`},fA={added:`Git status: added`,deleted:`Git status: deleted`,ignored:`Git status: ignored`,modified:`Git status: modified`,renamed:`Git status: renamed`,untracked:`Git status: untracked`},pA=`Contains git status items`;function mA(e){let{renamingPath:t,previousRenamingPath:n,hasRenderedInput:r}=e;return t==null?`reset`:r?n===t?`ignore`:`focus-input`:`reveal-canonical`}function hA(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 gA(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}}function _A(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 vA(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}var yA,bA,xA,SA,CA=Object.is,wA=0,TA=[],EA=YO,DA=EA.__b,OA=EA.__r,kA=EA.diffed,AA=EA.__c,jA=EA.unmount,MA=EA.__;function NA(e,t){EA.__h&&EA.__h(bA,e,wA||t),wA=0;var n=bA.__H||={__:[],__h:[]};return e>=n.__.length&&n.__.push({}),n.__[e]}function PA(e){return wA=1,FA(qA,e)}function FA(e,t,n){var r=NA(yA++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):qA(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);CA(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=bA,!bA.__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,CA(t,e.__[0])||(o=!0)}}),a&&a.call(this,e,t,n)||o};bA.__f=!0;var a=bA.shouldComponentUpdate,o=bA.componentWillUpdate;bA.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)},bA.shouldComponentUpdate=i}return r.__N||r.__}function IA(e,t){var n=NA(yA++,3);!EA.__s&&KA(n.__H,t)&&(n.__=e,n.u=t,bA.__H.__h.push(n))}function LA(e,t){var n=NA(yA++,4);!EA.__s&&KA(n.__H,t)&&(n.__=e,n.u=t,bA.__h.push(n))}function RA(e){return wA=5,zA(function(){return{current:e}},[])}function zA(e,t){var n=NA(yA++,7);return KA(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function BA(e,t){return wA=8,zA(function(){return e},t)}function VA(){for(var e;e=TA.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(WA),e.__H.__h.forEach(GA),e.__H.__h=[]}catch(t){e.__H.__h=[],EA.__e(t,e.__v)}}EA.__b=function(e){bA=null,DA&&DA(e)},EA.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),MA&&MA(e,t)},EA.__r=function(e){OA&&OA(e),yA=0;var t=(bA=e.__c).__H;t&&(xA===bA?(t.__h=[],bA.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(WA),t.__h.forEach(GA),t.__h=[],yA=0)),xA=bA},EA.diffed=function(e){kA&&kA(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(TA.push(t)!==1&&SA===EA.requestAnimationFrame||((SA=EA.requestAnimationFrame)||UA)(VA)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),xA=bA=null},EA.__c=function(e,t){t.some(function(e){try{e.__h.forEach(WA),e.__h=e.__h.filter(function(e){return!e.__||GA(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],EA.__e(n,e.__v)}}),AA&&AA(e,t)},EA.unmount=function(e){jA&&jA(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{WA(e)}catch(e){t=e}}),n.__H=void 0,t&&EA.__e(t,n.__v))};var HA=typeof requestAnimationFrame==`function`;function UA(e){var t,n=function(){clearTimeout(r),HA&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);HA&&(t=requestAnimationFrame(n))}function WA(e){var t=bA,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),bA=t}function GA(e){var t=bA;e.__c=e.__(),bA=t}function KA(e,t){return!e||e.length!==t.length||t.some(function(t,n){return!CA(t,e[n])})}function qA(e,t){return typeof t==`function`?t(e):t}function JA(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 YA(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 XA({ariaLabel:e,isFlattened:t=!1,ref:n,value:r,onBlur:i,onInput:a}){return $(`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 ZA(e,t=null,n=null){"use no memo";let r=e.flattenedSegments;return r==null||r.length===0?t??e.name:$(`span`,{"data-item-flattened-subitems":!0,children:r.map((e,i)=>{let a=i===r.length-1;return $(pk,{children:[$(`span`,{"data-item-flattened-subitem":e.path,"data-item-flattened-subitem-drag-target":n===e.path?`true`:void 0,children:a&&t!=null?t:$(Xk,{children:e.name})}),i<r.length-1?` / `:``]},e.path)})})}function QA(e){return e.isFlattened?e.flattenedSegments?.findLast(e=>e.isTerminal)?.path??e.path:e.path}function $A(e){let t=e.flattenedSegments;return t==null||t.length===0?e.name:t.map(e=>e.name).join(` / `)}function ej(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 tj({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=uA(c,{itemHeight:t,overscan:n,scrollTop:r,stickyRows:s==null?void 0:ej(s,r,t,o),totalRowCount:o,viewportHeight:a}),u=i&&r<=0&&o>0?e.getStickyRowCandidates(1,t):[],d=u!=null&&r<=0?ej(u,1,t,o):i&&r<=0&&c.length>0?lA(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 nj=400,rj=10,ij=40,aj=18;function oj(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))?sj(e,t,n):a instanceof HTMLElement?a:null}function sj(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 cj(e){let t=e?.closest?.(`[data-type="item"]`);if(!(t instanceof HTMLElement))return null;let n=t.dataset.itemPath??null;if(n==null)return null;let r=e?.closest?.(`[data-item-flattened-subitem]`),i=r instanceof HTMLElement?r.getAttribute(`data-item-flattened-subitem`)??null:null;if(i!=null&&i.endsWith(`/`))return{directoryPath:i,flattenedSegmentPath:i,hoveredPath:n,kind:`directory`};if(t.dataset.itemType===`folder`)return{directoryPath:n,flattenedSegmentPath:null,hoveredPath:n,kind:`directory`};let a=t.dataset.itemParentPath??null;return a==null||a.length===0?{directoryPath:null,flattenedSegmentPath:null,hoveredPath:n,kind:`root`}:{directoryPath:a,flattenedSegmentPath:null,hoveredPath:n,kind:`directory`}}function lj(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 uj(){return navigator.vendor!==`Apple Computer, Inc.`}function dj(e,t){let n=e-t.top;if(n<ij)return-Math.ceil((ij-Math.max(0,n))/ij*aj);let r=t.bottom-e;return r<ij?Math.ceil((ij-Math.max(0,r))/ij*aj):0}function fj(e,t){if(e!=null){let t=dA[e];return t==null?null:{text:t,title:fA[e]}}return t?{icon:{name:`file-tree-icon-dot`,width:6,height:6},title:pA}:null}function pj(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 mj(e){return e!=null&&`toggle`in e}function hj(e){return e.code===`Space`||e.key===` `||e.key===`Spacebar`}function gj(e){return e.key.length===1&&/^[\p{L}\p{N}]$/u.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey}function _j(e,t){if(e==null)return t;let n=e.getBoundingClientRect().height;return n>0?n:e.clientHeight>0?e.clientHeight:t}function vj(e,t){return e!=null&&e>0?e:t}function yj(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 bj(e,t,n,r,i=0){let a=_A({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,topInset:i,viewportHeight:r});return a==null?!1:(e.scrollTop=a,!0)}function xj(e,t,n,r,i,a){let o=vA({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,targetViewportOffset:a,totalHeight:i,viewportHeight:r});return o==null?!1:(e.scrollTop=o,!0)}function Sj(e,t,n,r){return n.end<n.start?null:e<n.start?-t:e>n.end?r:null}function Cj(e){return e==null?``:`[data-item-section="spacing-item"][data-ancestor-path="${e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}"] { opacity: 1; }`}function wj(e){return e.shiftKey&&e.key===`F10`||e.key===`ContextMenu`}function Tj(e,t){return t&&wj(e)||(e.ctrlKey||e.metaKey)&&hj(e)?!0:e.key===`ArrowDown`||e.key===`ArrowLeft`||e.key===`ArrowRight`||e.key===`ArrowUp`}var Ej=new Set([`ArrowDown`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`]);function Dj(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 Oj(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 kj(e,t){return{bottom:t,height:0,left:e,right:e,top:t,width:0,x:e,y:t}}function Aj(e,t){if(e==null)return t.offsetTop;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.top-r.top}function jj(e,t,n){if(n==null){e.delete(t);return}e.set(t,n)}function Mj(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 Nj(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 Pj(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 Fj(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=Pj(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 Ij(e,t){return{kind:e.kind,name:$A(e),path:t}}function Lj(e){return e==null?void 0:`${e}__tree`}function Rj(e,t,n){if(e!=null)return`${e}__focused-item-${encodeURIComponent(t)}${n?`__parked`:``}`}function zj(e){return e===`file-tree-icon-chevron`||e===`file-tree-icon-dot`||e===`file-tree-icon-file`||e===`file-tree-icon-lock`}function Bj(e,t){if(e==null)return null;if(`text`in e)return $(`span`,{title:e.title,children:e.text});let n=typeof e.icon==`string`?zj(e.icon)?t(e.icon):{name:e.icon}:zj(e.icon.name)?(()=>{let n=t(e.icon.name),{name:r,...i}=e.icon;return{...n,...i}})():e.icon;return $(`span`,{title:e.title,children:$(Bk,{...n})})}function Vj(e){e!=null&&JA(e.querySelector([`button:not([disabled])`,`[href]`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`, `))??e)}function Hj(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=QA(e);return $(pk,{children:[e.depth>0?$(`div`,{"data-item-section":`spacing`,children:Array.from({length:e.depth}).map((t,n)=>$(`div`,{"data-item-section":`spacing-item`,"data-ancestor-path":e.ancestorPaths[n]},n))}):null,$(`div`,{"data-item-section":`icon`,children:e.kind===`directory`?$(Bk,{...t(`file-tree-icon-chevron`)}):$(Bk,{...t(`file-tree-icon-file`,u)})}),$(`div`,{"data-item-section":`content`,children:e.isFlattened?ZA(e,c,a):c??$(Qk,{minimumLength:5,split:`extension`,children:e.name})}),i?$(`div`,{"data-item-section":`decoration`,children:r==null?null:Bj(r,t)}):null,s?$(`div`,{"data-item-section":`git`,children:Bj(o,t)}):null,n?$(`div`,{"data-item-section":`action`,children:l?$(`span`,{"aria-hidden":`true`,"data-item-action-affordance":`decorative`,children:$(Bk,{...t(`file-tree-icon-ellipsis`)})}):null}):null]})}function Uj(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=QA(t),{isParked:F=!1,mode:I=`flow`,style:ee}=r,L=I===`sticky`,R=_?.get(P)??null??pj(t.ancestorPaths,v,y),z=t.kind===`directory`&&(b?.has(P)??!1),B=A(t,P),V=fj(R,z),H=S&&w,te=B!=null||x||H,ne=H&&T===`always`,re=a.getPath()===P,U=re?a.getValue():``,W=L||!re?null:$(XA,{ref:D,ariaLabel:`Rename ${$A(t)}`,isFlattened:t.isFlattened,value:U,onBlur:()=>{a.commit()},onInput:e=>{a.setValue(e.currentTarget.value)}}),G=Hj(t,k,{actionLaneEnabled:H,customDecoration:B,decorationLaneEnabled:te,dragTargetFlattenedSegmentPath:l?.flattenedSegmentPath??null,gitDecoration:V,gitLaneActive:x,renameInput:W,showDecorativeActionAffordance:ne}),ie={...hA({ariaLabel:$A(t),domId:t.isFocused?Rj(h,P,F):void 0,extraStyle:ee,features:{actionLaneEnabled:H,contextMenuButtonVisibility:H?T:null,contextMenuEnabled:S,contextMenuTriggerMode:S?C:null,gitLaneActive:x},isParked:F,itemHeight:g,mode:I,row:t,state:{containsGitChange:z,effectiveGitStatus:R,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.focusPath(P),j(t,P,{anchorRect:kj(e.clientX,e.clientY),source:`right-click`})))}:void 0,onFocus:L?void 0:()=>{i.focusPath(P)},onKeyDown:L?void 0:N,ref:e=>{O(P,e)}};return!L&&re?$(`div`,{...ie,children:G}):$(`button`,{...ie,type:`button`,draggable:u&&!F,onDragEnd:u&&!F?p:void 0,onDragStart:u&&!F?e=>{f(e,t,P)}:void 0,onMouseDown:e=>{if(L){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:G})}function Wj(e,t,n){return t.end<t.start?[]:e.controller.getVisibleRows(t.start,t.end).filter(e=>!n.has(QA(e))).map((n,r)=>Uj(e,n,t.start+r))}function Gj({composition:e,controller:t,gitStatusByPath:n,ignoredGitDirectories:r,directoriesWithGitChanges:i,icons:a,instanceId:o,itemHeight:s=qD,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 _=RA(null),v=RA(null),y=RA(!1),b=RA(null),x=RA(null),S=RA(null),C=RA(null),w=RA(null),T=RA(new Map),E=RA(new Map),D=RA(()=>{}),O=RA(null),k=RA(!1),A=RA(null),j=RA(null),M=RA(!1),N=RA(null),P=RA(null),F=RA(null),I=RA(null),ee=RA(null),L=RA(null),R=RA(null),z=RA(null),B=RA(!1),V=RA(null),H=RA(null),te=RA(null),ne=RA(null),re=zA(()=>new Map,[]),[,U]=PA(0),[W,G]=PA(null),[ie,ae]=PA(null),[oe,K]=PA(null),[q,se]=PA(null),[J,ce]=PA(0),[le,ue]=PA(null),de=RA(le);de.current=le;let fe=RA(null),pe=RA(null),me=RA(null),he=RA(null),ge=RA(null),_e=RA(!1),ve=()=>{pe.current=null,me.current=null,he.current=null},ye=(e,t)=>{pe.current=e,me.current=null,he.current=t==null?null:{path:e,scrollTop:t}},be=(e,t)=>{pe.current=null,me.current={path:e,viewportOffset:t},he.current=null},xe=RA(d===`retain`&&t.isSearchOpen()),[Se,Ce]=PA(p);IA(()=>{p||Ce(!1)},[p]);let we=RA(!1),Te=BA(()=>{we.current=!0,Ce(e=>e&&!1)},[]),[Ee,De]=PA(()=>tj({controller:t,itemHeight:s,overscan:c,scrollTop:0,stickyFolders:h,viewportHeight:g})),[Oe,ke]=PA(!1);IA(()=>{ke(!0)},[]);let Ae=e?.contextMenu?.enabled===!0||e?.contextMenu?.render!=null||e?.contextMenu?.onOpen!=null||e?.contextMenu?.onClose!=null,je=e?.contextMenu?.triggerMode??(Ae?`right-click`:`both`),Me=je===`both`||je===`button`,Ne=e?.contextMenu?.buttonVisibility??`when-needed`,Pe=je===`both`||je===`right-click`;LA(()=>{let e=S.current;if(e==null)return;let t=e=>{if(!(e instanceof CustomEvent))return;let t=e.detail?.path??null;ge.current=t,ae(t),se(t==null?null:`pointer`)},n=e=>{e instanceof CustomEvent&&(_e.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 Fe=BA((e,t)=>{jj(T.current,e,t)},[]),Ie=BA((e,t)=>{jj(E.current,e,t)},[]),Le=BA(e=>{x.current=e},[]),Re=BA(e=>Mj(e,E.current,T.current),[]),ze=n!=null||r!=null||i!=null,{resolveIcon:Be}=zA(()=>aw(a),[a]),Ve=t[vO](),He=Ve.getPath(),Ue=He!=null,We=t.isSearchOpen(),Ge=t.getSearchValue(),Ke=t.getFocusedPath(),qe=t.getFocusedIndex(),Je=t.isDragAndDropEnabled(),Ye=t.getDragSession(),Xe=zA(()=>Ye==null?null:new Set(Ye.draggedPaths),[Ye]),Ze=Ye?.target??null,Qe=Ye?.primaryPath??null,$e=Lj(o),{overlayHeight:et,overlayRows:tt,snapshot:nt,visibleRows:rt}=Ee,it=nt.physical.viewportHeight,at=zA(()=>({end:nt.window.endIndex,start:nt.window.startIndex}),[nt.window.endIndex,nt.window.startIndex]),ot=tt,st=nt.sticky.rows,ct=nt.physical.totalHeight,lt=nt.sticky.height,ut=zA(()=>new Set(st.map(e=>QA(e.row))),[st]),dt=qe>=0&&qe>=at.start&&qe<=at.end,ft=BA((e,t)=>u?.({item:Ij(e,t),row:e})??null,[u]),pt=BA(e=>JA(e==null?null:T.current.get(e)??null)?!0:JA(S.current),[]),mt=BA(e=>{pt(t.focusNearestPath(e))},[t,pt]),ht=RA(mt);ht.current=mt;let gt=RA(!0),_t=RA(()=>{}),vt=BA((t=!0)=>{let n=de.current;n!=null&&(gt.current=gt.current&&t,ue(null),e?.contextMenu?.onClose?.(),gt.current&&mt(n.path))},[e?.contextMenu,mt]);_t.current=vt;let yt=BA(e=>{let t=e==null?null:Aj(S.current,e);K(e=>e===t?e:t)},[]),bt=BA((e,n,r)=>{let i=t.getItem(n);if(i==null)return;let a=Re(n);if(a?.dataset.fileTreeStickyRow===`true`){let e=C.current;ye(n,e?.scrollTop??null),k.current=!0,G(e=>e===n?e:n)}i.focus(),yt(a),gt.current=!0,ue({anchorRect:r?.anchorRect??null,item:Ij(e,n),path:n,source:r?.source??`keyboard`})},[t,Re,yt]),xt=BA(e=>{if(l){if(t.isSearchOpen()){let e=C.current,t=_j(e,it);N.current=qe<0||e==null?null:Math.max(0,Math.min(qe*s-e.scrollTop,Math.max(0,t-s))),M.current=!0}t.startRenaming(e)!==!1&&(se(`focus`),U(e=>e+1))}},[t,qe,s,l,it]),St=BA((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=_j(i,it),u=t.getVisibleCount()*s,d=r===`sticky-parents`?o.ancestorPaths.length*s:tj({controller:t,itemHeight:s,overscan:c,scrollTop:i.scrollTop,stickyFolders:h,viewportHeight:l}).snapshot.sticky.height;return k.current=!0,xj(i,a,s,l,u,d),D.current(),fe.current=n?e:null,!0},[t,s,c,it,h]),Ct=()=>y.current===!0||ne.current!=null||B.current===!0,wt=e=>typeof window.requestAnimationFrame==`function`?window.requestAnimationFrame(()=>{e()}):window.setTimeout(e,16),Tt=e=>{if(e!=null){if(typeof window.cancelAnimationFrame==`function`){window.cancelAnimationFrame(e);return}window.clearTimeout(e)}},Et=()=>{I.current!=null&&(clearTimeout(I.current),I.current=null),F.current=null},Dt=()=>{L.current?.remove(),L.current=null},Ot=()=>{Tt(P.current),P.current=null,ee.current=null},kt=e=>{let t=S.current?.getRootNode();if(t instanceof ShadowRoot){t.append(e);return}document.body.append(e)},At=()=>{z.current?.(),z.current=null,ne.current!=null&&(clearTimeout(ne.current),ne.current=null),B.current=!1,V.current=null,te.current=null,H.current!=null&&(H.current.setAttribute(`draggable`,`true`),H.current.style.removeProperty(`touch-action`),H.current=null),Dt(),Et(),Ot(),R.current=null},jt=(e,n)=>{let r=S.current?.getRootNode(),i=cj(oj(r instanceof ShadowRoot?r:document,e,n));return t.setDragTarget(i),t.getDragSession()?.target??null},Mt=e=>{let n=t.getDragAndDropConfig()?.openOnDropDelay??800;if(e==null||e.kind!==`directory`||e.directoryPath==null||n<=0){Et();return}let r=t.getItem(e.directoryPath),i=mj(r)?r:null;if(i==null||i.isExpanded()){Et();return}let a=`${e.directoryPath}::${e.flattenedSegmentPath??``}`;F.current!==a&&(Et(),F.current=a,I.current=setTimeout(()=>{let n=t.getDragSession()?.target;n?.kind!==`directory`||n.directoryPath!==e.directoryPath||n.flattenedSegmentPath!==e.flattenedSegmentPath||i.expand()},n))},Nt=()=>{P.current=null;let e=ee.current,n=C.current;if(e==null||n==null||t.getDragSession()==null)return;let r=n.getBoundingClientRect(),i=dj(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()),Mt(jt(e.clientX,e.clientY)),P.current=wt(Nt)},Pt=(e,t)=>{ee.current={clientX:e,clientY:t},P.current??=wt(Nt)},Ft=(e,n,r)=>{let i=e.currentTarget;if(i!=null){if(At(),Dt(),Et(),Ot(),t.startDrag(r)===!1){e.preventDefault();return}if(R.current=n,e.dataTransfer!=null&&(e.dataTransfer.effectAllowed=`move`,e.dataTransfer.dropEffect=`move`,e.dataTransfer.setData(`text/plain`,r),uj())){let t=lj(i),n=i.getBoundingClientRect();Object.assign(t.style,{height:`${n.height}px`,opacity:`0.85`,transform:`translate3d(-9999px, 0px, 0)`,width:`${n.width}px`}),kt(t),L.current=t,e.dataTransfer.setDragImage(t,Math.max(0,e.clientX-n.left),Math.max(0,e.clientY-n.top))}}},It=()=>{Dt(),Et(),Ot(),R.current=null,t.cancelDrag()},Lt=(e,n,r)=>{if(ne.current!=null||B.current)return;let i=e.touches[0],a=e.currentTarget;if(i==null||a==null)return;te.current={clientX:i.clientX,clientY:i.clientY},H.current=a,a.setAttribute(`draggable`,`false`);let o=(e={})=>{let t=e.restoreNativeDraggable??!B.current;ne.current!=null&&(clearTimeout(ne.current),ne.current=null),document.removeEventListener(`touchmove`,s),document.removeEventListener(`touchend`,c),document.removeEventListener(`touchcancel`,c),z.current===o&&(z.current=null),t&&(a.setAttribute(`draggable`,`true`),H.current===a&&(H.current=null),te.current=null)},s=e=>{let t=e.touches[0],n=te.current;if(t==null||n==null)return;let r=t.clientX-n.clientX,i=t.clientY-n.clientY;r*r+i*i<=rj*rj||o()},c=()=>{o()};document.addEventListener(`touchmove`,s,{passive:!0}),document.addEventListener(`touchend`,c),document.addEventListener(`touchcancel`,c),z.current=o,ne.current=setTimeout(()=>{if(o({restoreNativeDraggable:!1}),t.startDrag(r)===!1){a.setAttribute(`draggable`,`true`),H.current===a&&(H.current=null),te.current=null;return}B.current=!0,H.current=a,a.setAttribute(`draggable`,`false`),a.style.setProperty(`touch-action`,`none`),R.current=n;let e=a.getBoundingClientRect(),s=lj(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`}),kt(s),L.current=s,V.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=V.current;n!=null&&L.current!=null&&(L.current.style.transform=`translate3d(${t.clientX-n.x}px, ${t.clientY-n.y}px, 0)`),Mt(jt(t.clientX,t.clientY)),Pt(t.clientX,t.clientY)},l=e=>{let n=e.changedTouches[0];n!=null&&jt(n.clientX,n.clientY),t.completeDrag(),At()},u=()=>{t.cancelDrag(),At()};z.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)},nj)},Rt=e=>{if(le!=null){if(e.key===`Escape`){vt(),e.preventDefault(),e.stopPropagation();return}Ej.has(e.key)&&(e.preventDefault(),e.stopPropagation());return}if(Ve.isActive()){if(e.key===`Escape`)Ve.cancel();else if(e.key===`Enter`)Ve.commit();else return;se(`focus`),U(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(l&&e.key===`F2`){xt(Ke??void 0),e.preventDefault(),e.stopPropagation();return}if(We){if(e.key===`Escape`)M.current=!1,N.current=null,t.closeSearch();else if(e.key===`Enter`){let e=t.getFocusedPath();e!=null&&t.selectOnlyPath(e);let n=C.current,r=_j(n,it);N.current=qe<0||n==null?null:Math.max(0,Math.min(qe*s-n.scrollTop,Math.max(0,r-s))),M.current=!0,t.closeSearch()}else if(e.key===`ArrowDown`)t.focusNextSearchMatch();else if(e.key===`ArrowUp`)t.focusPreviousSearchMatch();else return;se(`focus`),U(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(f&&gj(e)){t.openSearch(e.key),U(e=>e+1),e.preventDefault(),e.stopPropagation();return}let n=Ae&&wj(e),r=Tj(e,Ae),i=r&&S.current!=null?YA(S.current):null,a=r?new Set(Nj(S.current)):new Set,o=i?.dataset.fileTreeStickyPath??null,c=i?.dataset.fileTreeStickyRow===`true`&&o!=null;if(c&&o!==Ke&&a.has(o)){let e=C.current;ye(o,e?.scrollTop??null),t.focusPath(o)}let u=t.getFocusedPath(),d=t.getFocusedIndex(),p=t.getFocusedItem();if(p==null)return;let m=mj(p)?p:null,h=u!=null&&(ut.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=Mj(u,E.current,T.current);e==null||n==null?y=!1:bt(e,u)}else if((e.ctrlKey||e.metaKey)&&hj(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;se(`focus`);let b=t.getFocusedPath(),x=b!=null&&(ut.has(b)||a.has(b)),w=g&&b!==u,D=n&&c&&o===u&&b===u;if((h||D)&&b!=null&&(w&&x||D))ye(b,v?.scrollTop??null),k.current=!0,G(e=>e===b?e:b);else{let t=e.key===`ArrowUp`&&h&&b!==u;b!=null&&(t||_&&b===u)?(be(b,Fj(S.current,v,i,u,s,lt,it)),k.current=!0,G(e=>e===b?e:b)):ve()}U(e=>e+1),e.preventDefault(),e.stopPropagation()};LA(()=>{if(!(!f||!We)){if(xe.current){xe.current=!1;return}JA(w.current)}},[We,f]),LA(()=>{let e=x.current;switch(mA({hasRenderedInput:e!=null,previousRenamingPath:j.current,renamingPath:He})){case`reset`:j.current=null;return;case`reveal-canonical`:He!=null&&St(He,{restoreTreeFocus:!1,targetOffset:`live-overlay`});return;case`ignore`:return;case`focus-input`:e!=null&&(fe.current=null,j.current=He,JA(e),e.select());return}},[at.end,at.start,He,St,ut]),LA(()=>{let e=S.current;if(e==null)return;let t=null,n=()=>{t!=null&&(clearTimeout(t),t=null)},r=()=>{let t=YA(e)?.dataset.itemPath??null;G(e=>e===t?e:t)},i=()=>{n(),k.current=!0,r()},a=i=>{let a=i.relatedTarget;if(a==null){n(),t=setTimeout(()=>{if(t=null,YA(e)!=null){r();return}k.current=!1,G(null)},0);return}if(!(a instanceof Node)||!e.contains(a)){n(),k.current=!1,G(null);return}let o=a instanceof HTMLElement?a.dataset.itemPath??null:null;G(e=>e===o?e:o)};return e.addEventListener(`focusin`,i),e.addEventListener(`focusout`,a),()=>{n(),e.removeEventListener(`focusin`,i),e.removeEventListener(`focusout`,a)}},[]),LA(()=>{let e=S.current;e!=null&&(nt.physical.scrollTop<=0?e.dataset.scrollAtTop=`true`:delete e.dataset.scrollAtTop)},[nt.physical.scrollTop]),LA(()=>{let e=null,n=C.current,r=b.current,i=S.current;if(n==null)return;O.current=_j(n,g);let a=()=>{let e=t.getVisibleCount(),r=vj(O.current,g),i=Math.max(0,e*s-r);n.scrollTop>i&&(n.scrollTop=i),De(tj({controller:t,itemHeight:s,overscan:c,scrollTop:Math.min(n.scrollTop,i),stickyFolders:h,viewportHeight:r}))};D.current=a;let o=!1,l=t.subscribe(()=>{o?U(e=>e+1):o=!0,a()}),u=()=>{_e.current!==!0&&(r!=null&&(r.dataset.isScrolling??=``),i!=null&&(i.dataset.isScrolling??=``),y.current=!0,e!=null&&clearTimeout(e),e=setTimeout(()=>{r!=null&&delete r.dataset.isScrolling,i!=null&&delete i.dataset.isScrolling,y.current=!1,ce(e=>e+1),e=null},50))},d=null,f=()=>{i!=null&&delete i.dataset.overlayReveal,d!=null&&(clearTimeout(d),d=null)},p=()=>{i==null||_e.current===!0||n.scrollTop>0||(i.dataset.overlayReveal=`true`,d!=null&&clearTimeout(d),d=setTimeout(()=>{f()},200))},m=()=>{if(a(),n.scrollTop>0&&f(),de.current!=null&&y.current&&_t.current(),_e.current===!0){y.current=!1;return}ae(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:yj(e[0]))??_j(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]),LA(()=>{Ae||le==null||vt(!1)},[vt,Ae,le]);let zt=zA(()=>le==null?null:`${le.path}::${le.source}`,[le]);LA(()=>{if(zt==null){m?.clearSlotContent(ZC);return}let t=de.current;if(t==null)return;let n=v.current??_.current;if(n==null)return;let r={anchorElement:n,anchorRect:t.anchorRect??Oj(n.getBoundingClientRect()),close:e=>{_t.current(e?.restoreFocus??!0)},restoreFocus:()=>{gt.current&&ht.current(de.current?.path??null)}},i=e?.contextMenu?.render?.(t.item,r)??null;return m?.setSlotContent(ZC,i),e?.contextMenu?.onOpen?.(t.item,r),Vj(i),queueMicrotask(()=>{i==null||!i.isConnected||document.activeElement===i&&Vj(i)}),()=>{m?.clearSlotContent(ZC)}},[zt,e?.contextMenu,m]),LA(()=>{le!=null&&t.getItem(le.path)==null&&vt()},[vt,le,t]),LA(()=>{if(le==null)return;let e=S.current?.getRootNode(),t=e instanceof ShadowRoot?e.host:S.current,n=e=>{let n=e.target;n instanceof Node&&(Dj(e)||_.current?.contains(n)!==!0&&t?.contains(n)!==!0&&vt())},r=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),vt())};return document.addEventListener(`mousedown`,n,!0),document.addEventListener(`keydown`,r,!0),()=>{document.removeEventListener(`mousedown`,n,!0),document.removeEventListener(`keydown`,r,!0)}},[vt,le]),LA(()=>{let e=C.current,t=S.current;if(e==null||t==null){A.current=Ke;return}let n=Ke==null?null:T.current.get(Ke)??null,r=YA(t),i=r?.dataset.itemPath??null,a=Ue&&x.current===r,o=f&&w.current===r,c=M.current&&!We,l=N.current??0,u=fe.current,d=pe.current,p=me.current,m=he.current,h=r!=null,g=k.current||h,_=A.current!==Ke,v=d!=null&&d===Ke&&Ke!=null,y=c&&xj(e,qe,s,it,ct,l),b=u!=null&&u===Ke&&xj(e,qe,s,it,ct,lt),E=p!=null&&p.path===Ke&&xj(e,qe,s,it,ct,p.viewportOffset),O=m!=null&&m.path===Ke&&e.scrollTop!==m.scrollTop;if(O&&(e.scrollTop=m.scrollTop),(O||b||E||y||g&&_&&u!==Ke&&!v&&bj(e,qe,s,it,lt))&&D.current(),!g){A.current=Ke;return}if(a){A.current=Ke;return}if(o&&!c){A.current=Ke;return}if(n==null){c&&qe>=0&&(xj(e,qe,s,it,ct,l),D.current()),A.current=Ke;return}(_||c||u===Ke||d===Ke||p?.path===Ke||m?.path===Ke||i==null||i!==Ke)&&(JA(n),u===Ke&&(fe.current=null),d===Ke&&(pe.current=null),p?.path===Ke&&(me.current=null),m?.path===Ke&&(he.current=null),M.current=!1,N.current=null),A.current=Ke},[t,qe,Ke,dt,s,Ue,We,at,it,f,lt,ct,rt]);let Bt=qe>=0&&qe>=nt.visible.startIndex&&qe<=nt.visible.endIndex,Vt=Ke!=null&&ot.some(e=>QA(e.row)===Ke),Ht=Bt||Vt,Ut=Me&&k.current===!0&&Ht?Ke:null,Wt=q===`pointer`?ie:null,Gt=le?.path??ge.current??Wt??Ut??ie,Kt=le?.source===`right-click`;LA(()=>{y.current&&le==null||yt(Re(Gt))},[le,Re,at,it,J,ot,Gt,yt,rt]);let qt=BA(e=>{if(y.current||Dj(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&&se(e=>e===`pointer`?e:`pointer`),ae(e=>e===i?e:i)},[]),Jt=BA(()=>{ae(null)},[]);LA(()=>{if(!Je)return;let e=()=>{At(),t.cancelDrag()};return window.addEventListener(`dragend`,e),()=>{window.removeEventListener(`dragend`,e),At(),t.cancelDrag()}},[t,Je]);let Yt=e=>{if(!Je||t.getDragSession()==null||B.current)return;let n=cj(e.target instanceof HTMLElement?e.target:null);t.setDragTarget(n),Mt(t.getDragSession()?.target??null),Pt(e.clientX,e.clientY),e.dataTransfer!=null&&(e.dataTransfer.dropEffect=`move`),e.preventDefault()},Xt=e=>{if(!Je||t.getDragSession()==null||B.current)return;let n=e.relatedTarget;n instanceof Node&&S.current?.contains(n)===!0||(Et(),Ot(),t.setDragTarget(null))},Zt=e=>{!Je||t.getDragSession()==null||B.current||(e.preventDefault(),jt(e.clientX,e.clientY),t.completeDrag(),Dt(),Et(),Ot(),R.current=null)},Qt=nt.window.height,$t=nt.window.offsetTop,en=Math.min(0,it-Qt-lt),tn=W===Ke||M.current,nn=Ke!=null&&tn&&!dt&&qe>=0?rt[qe]??t.getVisibleRows(qe,qe)[0]??null:null,rn=nn==null?null:Sj(qe,s,at,Qt),an=R.current,on=Qe!=null&&an!=null&&an.path===Qe&&an.index>=at.start&&an.index<=at.end,sn=Qe!=null&&an!=null&&an.path===Qe&&!on&&an.path!==nn?.path?an:null,cn=sn==null?null:Sj(sn.index,s,at,Qt),ln=Cj((qe>=0?rt[qe]??t.getVisibleRows(qe,qe)[0]??null:null)?.ancestorPaths.at(-1)??null),un=We&&Ke!=null?Rj(o,Ke,!dt):void 0,dn=le?.path??(We?Ke:W),fn=le?.path??ie,pn=Re(Gt),mn=Ae&&Me&&!Kt&&!Ue&&pn!=null&&oe!=null&&Gt!=null,hn=Ae&&(mn||le!=null),gn=le?.anchorRect,_n=gn==null&&pn!=null&&oe!=null&&(le!=null||mn)?oe:null,vn=gn==null?_n==null?void 0:{top:`${_n}px`}:{left:`${gn.left}px`,position:`fixed`,right:`auto`,top:`${gn.top}px`},yn=Kt?{opacity:`0`}:void 0,bn=BA((e,n,r,i)=>{let a=t.getItem(r),o=gA({event:{ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey},isDirectory:n.kind===`directory`,isSearchOpen:t.isSearchOpen(),mode:i});switch(o.selection.kind){case`range`:t.selectPathRange(r,o.selection.additive);break;case`toggle`:t.togglePathSelectionFromInput(r);break;case`single`:t.selectOnlyPath(r);break}let s=e.currentTarget instanceof HTMLElement?e.currentTarget:null,c=n.index>=nt.visible.startIndex&&n.index<=nt.visible.endIndex,l=i===`flow`&&c&&s!=null&&s.dataset.itemParked!==`true`;a?.focus(),l&&(k.current=!0,G(e=>e===r?e:r),se(`focus`)),o.toggleDirectory&&mj(a)&&a.toggle(),o.closeSearch&&t.closeSearch(),o.revealCanonical&&St(r,{targetOffset:`sticky-parents`})},[t,nt.visible.endIndex,nt.visible.startIndex,St]),xn=()=>{if(y.current||!Me||Gt==null||pn==null)return;let e=t.getItem(Gt);e!=null&&(yt(pn),gt.current=!0,ue({anchorRect:null,item:{kind:e.isDirectory()?`directory`:`file`,name:pn.getAttribute(`aria-label`)??Gt,path:e.getPath()},path:e.getPath(),source:`button`}))},Sn={contextHoverPath:fn,contextMenuButtonTriggerEnabled:Me,contextMenuButtonVisibility:Ne,contextMenuEnabled:Ae,contextMenuRightClickEnabled:Pe,contextMenuTriggerMode:je,controller:t,directoriesWithGitChanges:i,dragAndDropEnabled:Je,draggedPathSet:Xe,dragTarget:Ze,gitLaneActive:ze,gitStatusByPath:n,handleRowDragEnd:It,handleRowDragStart:Ft,handleRowTouchStart:Lt,ignoredGitDirectories:r,ignoredInheritanceCache:re,instanceId:o,itemHeight:s,onKeyDown:Rt,onRowClick:bn,openContextMenuForRow:bt,registerButton:Fe,registerRenameInput:Le,renameView:Ve,renderDecorationForRow:ft,resolveIcon:Be,shouldSuppressContextMenu:Ct,visualFocusPath:dn},Cn={...Sn,registerButton:Ie};return $(`div`,{ref:S,id:$e,"data-file-tree-context-menu-button-visibility":Ae&&Me?Ne:void 0,"data-file-tree-context-menu-trigger-mode":Ae?je:void 0,"data-file-tree-has-context-menu-action-lane":Ae&&Me?`true`:void 0,"data-file-tree-has-git-lane":ze?`true`:void 0,"data-file-tree-virtualized-root":`true`,onDragLeave:Je?Xt:void 0,onDragOver:Je?Yt:void 0,onDrop:Je?Zt:void 0,onKeyDown:Rt,onPointerLeave:Ae?Jt:void 0,onPointerOver:Ae?qt:void 0,role:`tree`,tabIndex:-1,style:{outline:`none`,position:`relative`},children:[$(`style`,{"data-file-tree-guide-style":`true`,dangerouslySetInnerHTML:{__html:ln}}),$(`slot`,{name:XC,"data-type":`header-slot`}),f?$(`div`,{"data-file-tree-search-container":!0,"data-open":We?`true`:`false`,children:$(`input`,{ref:w,"aria-activedescendant":un,"aria-controls":$e,placeholder:`Search…`,"data-file-tree-search-input":!0,"data-file-tree-search-input-fake-focus":Se?`true`:void 0,value:Ge,onBlur:()=>{d===`retain`&&!we.current||t.closeSearch()},onFocus:Te,onPointerDown:Te,onInput:e=>{Te();let n=e.currentTarget;t.setSearch(n.value)}})}):null,$(`div`,{ref:C,"data-file-tree-virtualized-scroll":`true`,children:[h&&Oe&&ot.length>0?$(`div`,{"aria-hidden":`true`,"data-file-tree-sticky-overlay":`true`,children:$(`div`,{"data-file-tree-sticky-overlay-content":`true`,style:{height:`${et}px`},children:ot.map((e,t)=>Uj(Cn,e.row,`sticky:${QA(e.row)}`,{mode:`sticky`,style:{left:`0`,position:`absolute`,right:`0`,top:`${e.top}px`,zIndex:`${ot.length-t}`}}))})}):null,$(`div`,{ref:b,"data-file-tree-virtualized-list":`true`,style:{height:`${ct}px`},children:[$(`div`,{"data-file-tree-virtualized-sticky-offset":`true`,"aria-hidden":`true`,style:{height:`${$t}px`}}),$(`div`,{"data-file-tree-virtualized-sticky":`true`,style:{height:`${Qt}px`,top:`${en}px`,bottom:`${en}px`},children:[Wj(Sn,at,ut),nn!=null&&rn!=null?Uj(Sn,nn,`parked:${nn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:Qe===nn.path?`none`:void 0,position:`absolute`,right:`0`,top:`${rn}px`}}):null,sn!=null&&cn!=null?Uj(Sn,sn,`parked-drag:${sn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:`none`,position:`absolute`,right:`0`,top:`${cn}px`}}):null]})]})]}),Ae?$(`div`,{ref:_,"data-type":`context-menu-anchor`,"data-visible":hn?`true`:`false`,style:vn,children:[$(`button`,{ref:v,type:`button`,"data-type":QC,"aria-label":`Options`,"aria-haspopup":`menu`,"aria-expanded":le==null?`false`:`true`,"data-visible":mn?`true`:`false`,onMouseDown:e=>{e.preventDefault()},onClick:e=>{if(e.preventDefault(),e.stopPropagation(),le!=null){vt();return}xn()},tabIndex:-1,style:yn,children:$(Bk,{...Be(`file-tree-icon-ellipsis`)})}),le==null?null:$(`slot`,{name:ZC})]}):null,le==null?null:$(`div`,{"data-type":`context-menu-wash`,"aria-hidden":`true`,onMouseDownCapture:e=>{e.preventDefault(),vt()},onTouchStartCapture:e=>{e.preventDefault(),e.stopPropagation(),vt()},onTouchMoveCapture:e=>{e.preventDefault(),e.stopPropagation()},onWheelCapture:e=>{e.preventDefault(),e.stopPropagation()}})]})}var Kj={hydrateRoot:(e,t)=>{Fk(dk(Gj,t),e)},renderRoot:(e,t)=>{Pk(dk(Gj,t),e)},unmountRoot:e=>{Pk(null,e)}};function qj(e,t){Kj.renderRoot(e,t)}function Jj(e,t){Kj.hydrateRoot(e,t)}function Yj(e){Kj.unmountRoot(e)}var Xj=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)}}},Zj=`__c`,Qj=`__k`,$j=`__d`,eM=`__s`,tM=/[\s\n\\/='"\0<>]/,nM=/^(xlink|xmlns|xml)([A-Z])/,rM=/^(?: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])/,iM=/^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/,aM=new Set([`draggable`,`spellcheck`]);function oM(e){e.__g===void 0?e[$j]=!0:e.__g|=8}function sM(e){e.__g===void 0?e[$j]=!1:e.__g&=-9}function cM(e){return e.__g===void 0?!0===e[$j]:!!(8&e.__g)}var lM=/["&<]/;function uM(e){if(e.length===0||!1===lM.test(e))return e;for(var t=0,n=0,r=``,i=``;n<e.length;n++){switch(e.charCodeAt(n)){case 34:i=`&quot;`;break;case 38:i=`&amp;`;break;case 60:i=`&lt;`;break;default:continue}n!==t&&(r+=e.slice(t,n)),r+=i,t=n+1}return n!==t&&(r+=e.slice(t,n)),r}var dM={},fM=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(`.`)),pM=/[A-Z]/g;function mM(e){var t=``;for(var n in e){var r=e[n];if(r!=null&&r!==``){var i=n[0]==`-`?n:dM[n]||(dM[n]=n.replace(pM,`-$&`).toLowerCase()),a=`;`;typeof r!=`number`||i.startsWith(`--`)||fM.has(i)||(a=`px;`),t=t+i+`:`+r+a}}return t||void 0}function hM(){this.__d=!0}function gM(e,t){return{__v:e,context:t,props:e.props,setState:hM,forceUpdate:hM,__d:!0,__h:[]}}function _M(e,t,n){if(!e.s){if(n instanceof vM){if(!n.s)return void(n.o=_M.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(_M.bind(null,e,t),_M.bind(null,e,2));e.s=t,e.v=n;let r=e.o;r&&r(e)}}var vM=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{_M(r,1,a(this.v))}catch(e){_M(r,2,e)}return r}return this}return this.o=function(e){try{var i=e.v;1&e.s?_M(r,1,t?t(i):i):n?_M(r,1,n(i)):_M(r,2,i)}catch(e){_M(r,2,e)}},r},e}(),yM,bM,xM,SM,CM={},wM=Array.isArray,TM=Object.assign,EM=``,DM=`<!--$s-->`,OM=`<!--/$s-->`;function kM(e,t){var n,r=e.type,i=!0;return e[Zj]?(i=!1,(n=e[Zj]).state=n[eM]):n=new r(e.props,t),e[Zj]=n,n.__v=e,n.props=e.props,n.context=t,oM(n),n.state??=CM,n[eM]??(n[eM]=n.state),r.getDerivedStateFromProps?n.state=TM({},n.state,r.getDerivedStateFromProps(n.props,n.state)):i&&n.componentWillMount?(n.componentWillMount(),n.state=n[eM]===n.state?n.state:n[eM]):!i&&n.componentWillUpdate&&n.componentWillUpdate(),xM&&xM(e),n.render(n.props,n.state,t)}function AM(e,t,n,r,i,a,o){if(e==null||!0===e||!1===e||e===EM)return EM;var s=typeof e;if(s!=`object`)return s==`function`?EM:s==`string`?uM(e):e+EM;if(wM(e)){var c,l=EM;i[Qj]=e;for(var u=e.length,d=0;d<u;d++){var f=e[d];if(f!=null&&typeof f!=`boolean`){var p,m=AM(f,t,n,r,i,a,o);typeof m==`string`?l+=m:(c||=Array(u),l&&c.push(l),l=EM,wM(m)?(p=c).push.apply(p,m):c.push(m))}}return c?(l&&c.push(l),c):l}if(e.constructor!==void 0)return EM;e.__=i,yM&&yM(e);var h=e.type,g=e.props;if(typeof h==`function`){var _,v,y,b=t;if(h===pk){if(`tpl`in g){for(var x=EM,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&&!wM(C)?x+=C:x+=AM(C,t,n,r,e,a,o)}return x}if(`UNSTABLE_comment`in g)return`<!--`+uM(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=kM(e,b),y=e[Zj];else{e[Zj]=y=gM(e,b);for(var E=0;cM(y)&&E++<25;){sM(y),xM&&xM(e);try{v=h.call(y,g,b)}catch(t){throw a&&t&&typeof t.then==`function`&&(e._suspended=!0),t}}oM(y)}if(y.getChildContext!=null&&(t=TM({},t,y.getChildContext())),T&&YO.errorBoundaries&&(h.getDerivedStateFromError||y.componentDidCatch)){v=v!=null&&v.type===pk&&v.key==null&&v.props.tpl==null?v.props.children:v;try{return AM(v,t,n,r,e,a,!1)}catch(i){return h.getDerivedStateFromError&&(y[eM]=h.getDerivedStateFromError(i)),y.componentDidCatch&&y.componentDidCatch(i,CM),cM(y)?(v=kM(e,t),(y=e[Zj]).getChildContext!=null&&(t=TM({},t,y.getChildContext())),AM(v=v!=null&&v.type===pk&&v.key==null&&v.props.tpl==null?v.props.children:v,t,n,r,e,a,o)):EM}finally{bM&&bM(e),SM&&SM(e)}}}v=v!=null&&v.type===pk&&v.key==null&&v.props.tpl==null?v.props.children:v;try{var D=AM(v,t,n,r,e,a,o);return bM&&bM(e),YO.unmount&&YO.unmount(e),e._suspended?typeof D==`string`?DM+D+OM:wM(D)?(D.unshift(DM),D.push(OM),D):D.then(function(e){return DM+e+OM}):D}catch(i){if(!a&&o&&o.onError){var O=function i(s){return o.onError(s,e,function(e,s){try{return AM(e,t,n,r,s,a,o)}catch(e){return i(e)}})}(i);if(O!==void 0)return O;var k=YO.__e;return k&&k(i,e),EM}if(!a||!i||typeof i.then!=`function`)throw i;return i.then(function i(){try{var s=AM(v,t,n,r,e,a,o);return e._suspended?DM+s+OM:s}catch(e){if(!e||typeof e.then!=`function`)throw e;return e.then(i)}})}}var A,j=`<`+h,M=EM;for(var N in g){var P=g[N];if(typeof(P=MM(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=mM(P));break;case`acceptCharset`:N=`accept-charset`;break;case`httpEquiv`:N=`http-equiv`;break;default:if(nM.test(N))N=N.replace(nM,`$1:$2`).toLowerCase();else{if(tM.test(N))continue;N[4]!==`-`&&!aM.has(N)||P==null?n?iM.test(N)&&(N=N===`panose1`?`panose-1`:N.replace(/([A-Z])/g,`-$1`).toLowerCase()):rM.test(N)&&(N=N.toLowerCase()):P+=EM}}P!=null&&!1!==P&&(j=!0===P||P===EM?j+` `+N:j+` `+N+`="`+(typeof P==`string`?uM(P):P+EM)+`"`)}}if(tM.test(h))throw Error(h+` is not a valid HTML tag name in `+j+`>`);if(M||(typeof A==`string`?M=uM(A):A!=null&&!1!==A&&!0!==A&&(M=AM(A,t,h===`svg`||h!==`foreignObject`&&n,r,e,a,o))),bM&&bM(e),SM&&SM(e),!M&&jM.has(h))return j+`/>`;var F=`</`+h+`>`,I=j+`>`;return wM(M)?[I].concat(M,[F]):typeof M==`string`?I+M+F:[I,M,F]}var jM=new Set([`area`,`base`,`br`,`col`,`command`,`embed`,`hr`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`]);function MM(e){return typeof e==`object`&&!!e&&typeof e.peek==`function`&&`value`in e}var NM=0;function PM(e){return e!=null&&e.length>0?e:(NM+=1,`pst_ft_${NM}`)}function FM({initialVisibleRowCount:e,itemHeight:t}){return e==null?420:Math.max(0,e)*(t??qD)}function IM(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 LM(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 RM(e){return Array.from(e.children).filter(e=>e instanceof SVGElement)}var zM=class{static LoadedCustomComponent=!0;#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=new Xj;#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=PM(a),this.#p=JO(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=KD(n,c),this.#d={itemHeight:this.#u.itemHeight,overscan:d,stickyFolders:_,initialVisibleRowCount:y},this.#t=new UO({...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&&(Yj(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)}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(),qj(t.wrapper,this.#w()))}setGitStatus(e){this.#p=JO(e,this.#p);let t=this.#T();t!=null&&qj(t.wrapper,this.#w())}setIcons(e){this.#m=e;let t=this.#T();t!=null&&(this.#E(t.host,t.wrapper),qj(t.wrapper,this.#w()))}hydrate({fileTreeContainer:e}){let t=this.#P(e),n=this.#N(t);this.#O(),Jj(n,this.#w())}render({containerWrapper:e,fileTreeContainer:t}){let n=this.#P(t??this.#f,e),r=this.#N(n);this.#O(),qj(r,this.#w())}#C(){return{initialViewportHeight:FM({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(XC,e());return}this.#l.setSlotHtml(XC,this.#e?.header?.html??null)}#k(e){let t=RM(e).find(e=>LM(e)),n=IM(BC(ew(this.#m).set));n!=null&&(t!=null&&t.outerHTML===n.outerHTML||(t==null?e.prepend(n):t.replaceWith(n)))}#A(e){let t=RM(e),n=t.find(e=>LM(e)),r=t.filter(e=>e!==n),i=ew(this.#m).spriteSheet?.trim()??``;if(i.length===0){for(let e of r)e.remove();return}let a=IM(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=ew(this.#m);t.colored&&HC(t.set)?e.dataset.fileTreeColoredIcons=`true`:delete e.dataset.fileTreeColoredIcons}#M(e){let t=e.querySelector(`style[${KC}]`);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(KC,``),this.#g.parentNode!==e&&e.appendChild(this.#g),this.#g.textContent=ZD(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 rO(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)}},BM=typeof window>`u`?X.useEffect:X.useLayoutEffect;function VM(e,t,n){let r=e==null?null:(0,Y.jsx)(`div`,{slot:XC,children:e}),i=t!=null&&n!=null?(0,Y.jsx)(`div`,{slot:ZC,children:t(n.item,n.context)}):null;return r==null&&i==null?null:(0,Y.jsxs)(Y.Fragment,{children:[r,i]})}function HM(e,t){return typeof window>`u`&&t!=null?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`template`,{shadowrootmode:`open`,dangerouslySetInnerHTML:{__html:t.shadowHtml}}),e]}):(0,Y.jsx)(Y.Fragment,{children:e})}function UM(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 WM(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 GM({header:e,id:t,model:n,preloadedData:r,renderContextMenu:i,...a}){let[o,s]=(0,X.useState)(null),[c,l]=(0,X.useState)(null),u=(0,X.useRef)(n.getComposition()),d=(0,X.useRef)(n);d.current!==n&&(d.current=n,u.current=n.getComposition());let f=i!=null,p=(0,X.useCallback)(()=>{s(null)},[]),m=(0,X.useCallback)((e,t)=>{s({context:t,item:e})},[]),h=u.current,g=(0,X.useMemo)(()=>WM(h,e,f,p,m),[h,p,m,f,e]),_=(0,X.useCallback)(e=>{l(e)},[]);(0,X.useEffect)(()=>{f||s(null)},[f]),BM(()=>{n.setComposition(g)},[g,n]),BM(()=>{if(c!=null)return r!=null&&UM(c)?n.hydrate({fileTreeContainer:c}):n.render({fileTreeContainer:c}),()=>{n.unmount(),n.setComposition(h)}},[h,c,n,r]);let v=HM(VM(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,Y.jsx)(WC,{...a,id:y,ref:_,style:b,suppressHydrationWarning:r!=null,children:v})}function KM(e){let t=(0,X.useRef)(null);return t.current??=new zM(e),(0,X.useEffect)(()=>{let e=t.current;return()=>{e?.cleanUp(),t.current=null}},[]),{model:t.current}}function qM(e){let t=(0,Z.c)(20),{itemName:n,isSubmitting:r,onDelete:i,customTitle:a,customDescription:o,children:s}=e,c=n===void 0?`this item`:n,l=a??`Delete ${c}`,u;t[0]===l?u=t[1]:(u=(0,Y.jsx)(qt,{children:l}),t[0]=l,t[1]=u);let d=o??`Are you sure you want to delete ${c}? This action cannot be undone.`,f;t[2]===d?f=t[3]:(f=(0,Y.jsx)(Bt,{className:`whitespace-pre-wrap`,children:d}),t[2]=d,t[3]=f);let p;t[4]===r?p=t[5]:(p=(0,Y.jsx)(Ut,{asChild:!0,children:(0,Y.jsx)(K,{variant:`outline`,disabled:r,children:`Cancel`})}),t[4]=r,t[5]=p);let m;t[6]===r?m=t[7]:(m=r?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Ye,{className:`size-4 animate-spin`}),` Deleting...`]}):`Delete`,t[6]=r,t[7]=m);let h;t[8]!==r||t[9]!==i||t[10]!==m?(h=(0,Y.jsx)(K,{variant:`destructive`,onClick:i,disabled:r,children:m}),t[8]=r,t[9]=i,t[10]=m,t[11]=h):h=t[11];let g;t[12]!==p||t[13]!==h?(g=(0,Y.jsxs)(Nt,{children:[p,h]}),t[12]=p,t[13]=h,t[14]=g):g=t[14];let _;return t[15]!==s||t[16]!==u||t[17]!==f||t[18]!==g?(_=(0,Y.jsxs)(Kt,{children:[u,f,s,g]}),t[15]=s,t[16]=u,t[17]=f,t[18]=g,t[19]=_):_=t[19],_}var JM=`.md`;function YM(e){return`${e}${JM}`}function XM(e){return fN(e).replace(/\.md$/i,``)}function ZM(e){return fN(e)}function QM(e){let t=fN(e.trim());return t?`${t}/`:``}function $M(e){return e.endsWith(`/`)?ZM(e):XM(e)}function eN(e){return e.map(e=>YM(e.docName))}function tN(e){return[...e].sort().join(`\0`)}function nN(e){return tN(eN(e))}function rN(e){let t=new Set;for(let n of e){let e=n.docName.split(`/`).filter(Boolean);for(let n=1;n<e.length;n++)t.add(`${e.slice(0,n).join(`/`)}/`)}return[...t].sort()}function iN(e){if(!e)return[];let t=fN(e.replace(/\.md$/i,``)).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 aN(e){let t=e.kind===`directory`,n=t?ZM(e.path):XM(e.path);return{kind:t?`folder`:`file`,name:fN(dN(e.path)).replace(/\.md$/i,``),path:n,treePath:sN(e.path,t)}}function oN(e){return e.kind===`directory`?ZM(e.path):e.path}function sN(e,t){return t?QM(e):e.endsWith(JM)?e:`${e}${JM}`}function cN(e,t,n){let r=QM(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}${JM}`;if(!i.has(e))return{addPath:e,renamePath:e};continue}let a=`${r}New Folder${n}/`,o=`${a}index${JM}`;if(!i.has(o)&&!i.has(a))return{addPath:o,renamePath:a}}throw Error(`Could not allocate a unique tree placeholder`)}function lN(e,t){return e===`file`?sN(t,!1):`${ZM(t)}/index${JM}`}function uN(e,t){return t.kind===`root`||t.directoryPath==null?dN(e):`${t.directoryPath}${dN(e)}`}function dN(e){let t=fN(e),n=t.lastIndexOf(`/`),r=n===-1?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function fN(e){return e.endsWith(`/`)?e.slice(0,-1):e}function pN(e,t){if(!e)return{selectedFilePath:t,selectedFolderPath:null,navigationPath:t};switch(e.kind){case`doc`:return{selectedFilePath:e.docName,selectedFolderPath:null,navigationPath:e.docName};case`folder`:case`folder-index`:return{selectedFilePath:null,selectedFolderPath:e.folderPath,navigationPath:e.folderPath};case`missing`:return{selectedFilePath:null,selectedFolderPath:null,navigationPath:null}}}function mN(e,t,n,r){return e.id===`cursor`&&!n?`Desktop only`:t.installed===null?`Detecting…`:t.installed===!1?`Not installed`:r?`No workspace`:null}function hN(e){let t=(0,Z.c)(8),{input:n,installStates:r,isElectronHost:i,dispatch:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Y.jsxs)(G_,{children:[(0,Y.jsx)(xe,{"aria-hidden":`true`}),`Open in…`]}),t[0]=o):o=t[0];let s;t[1]!==a||t[2]!==n||t[3]!==r||t[4]!==i?(s=Od.map(e=>{let t=r[e.id],o=eS({target:e,installState:t,isElectronHost:i}),s=n===null,c=o.enabled&&!s,l=mN(e,t,i,s),u=l?`Open in ${e.displayName}, ${l}`:`Open in ${e.displayName}`;return(0,Y.jsxs)(z_,{disabled:!c,onSelect:()=>{!c||!n||a(e.id,n)},"data-testid":`file-tree-open-in-${e.id}`,"aria-label":u,children:[(0,Y.jsx)(Zx,{id:e.id,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`flex-1`,children:e.displayName}),l?(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:l}):null]},e.id)}),t[1]=a,t[2]=n,t[3]=r,t[4]=i,t[5]=s):s=t[5];let c;return t[6]===s?c=t[7]:(c=(0,Y.jsxs)(W_,{children:[o,(0,Y.jsx)(K_,{children:s})]}),t[6]=s,t[7]=c),c}var gN=80,_N=3,vN=20,yN=new Map,bN=new Set,xN=[],SN=new Map;function CN(e){for(SN.delete(e),SN.set(e,!0);SN.size>vN;){let e=SN.keys().next().value;if(e===void 0)break;SN.delete(e)}}function wN(e){bN.delete(e),TN()}function TN(){for(;bN.size<_N&&xN.length>0;){let e=xN.shift();if(!e)break;if(!SN.has(e.docName)){bN.add(e.docName),CN(e.docName);try{e.prewarm(e.docName)}catch(t){it(`ok/sidebar/prewarm-failed`,{docName:e.docName,message:t instanceof Error?t.message:String(t)})}finally{wN(e.docName)}}}}function EN(e,t){if(Xe(e)||SN.has(e))return;let n=yN.get(e);n&&clearTimeout(n.timer);let r=setTimeout(()=>{if(yN.delete(e),bN.size>=_N){xN.push({docName:e,prewarm:t});return}CN(e),bN.add(e);try{t(e)}catch(t){it(`ok/sidebar/prewarm-failed`,{docName:e,message:t instanceof Error?t.message:String(t)})}finally{wN(e)}},gN);yN.set(e,{timer:r,prewarm:t})}function DN(e){let t=yN.get(e);t&&(clearTimeout(t.timer),yN.delete(e))}function ON(e){window.location.hash=Nn(e)}async function kN(e,t){try{await navigator.clipboard.writeText(e),At.success(`Copied ${t}`,{description:e})}catch(e){console.warn(`[FileTree] clipboard write failed:`,e),At.error(`Could not copy ${t}`)}}var AN=new Set([`agents`,`agent`,`claude`,`skill`]),jN=`ok-file-tree-link-decoration`,MN=`ok-file-tree-agent-decoration`;function NN(e){return e.map(([e,{key:t,...n}])=>`<${e} ${Object.entries(n).map(([e,t])=>`${e}="${t}"`).join(` `)} />`).join(``)}function PN(e,t){return`<symbol id="${e}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${NN(t)}</symbol>`}var FN=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
1836
+ ${PN(jN,Li)}
1837
+ ${PN(MN,ii)}
1838
+ </svg>`;function IN(e){return{...dw({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)`}}function LN(e){let t=e.split(`/`).pop()?.replace(/\.md$/i,``).toLowerCase();return!!t&&AN.has(t)}function RN(e){return e?.isDirectory()?e:null}function zN(e){let t=(0,Z.c)(66),{item:n,context:r,anyActionBusy:i,workspace:a,handoff:o,model:s,onStartCreating:c,onDelete:l,onExpandSubtree:u,onCollapseSubtree:d}=e,f;t[0]===n?f=t[1]:(f=aN(n),t[0]=n,t[1]=f);let p=f,m=n.kind===`directory`,h;t[2]!==m||t[3]!==n.path||t[4]!==a?(h=m?null:Gd({docName:XM(n.path),workspace:a}),t[2]=m,t[3]=n.path,t[4]=a,t[5]=h):h=t[5];let g=h,_;t[6]===r?_=t[7]:(_=()=>r.close({restoreFocus:!1}),t[6]=r,t[7]=_);let v=_,y;t[8]===r?y=t[9]:(y=()=>r.close(),t[8]=r,t[9]=y);let b=y,x;t[10]===b?x=t[11]:(x=e=>{e||b()},t[10]=b,t[11]=x);let S;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Y.jsx)(L_,{asChild:!0,children:(0,Y.jsx)(`span`,{"aria-hidden":`true`,"data-file-tree-context-menu-root":`true`,className:`block size-px`})}),t[12]=S):S=t[12];let C;t[13]!==i||t[14]!==b||t[15]!==v||t[16]!==m||t[17]!==n.path||t[18]!==d||t[19]!==u||t[20]!==c?(C=m?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(z_,{disabled:i,onSelect:()=>{v(),c(`file`,ZM(n.path))},children:[(0,Y.jsx)(sa,{"aria-hidden":`true`}),`New File`]}),(0,Y.jsxs)(z_,{disabled:i,onSelect:()=>{v(),c(`folder`,ZM(n.path))},children:[(0,Y.jsx)(Di,{"aria-hidden":`true`}),`New Folder`]}),(0,Y.jsx)(U_,{}),(0,Y.jsxs)(z_,{onSelect:()=>{b(),u(n.path)},children:[(0,Y.jsx)(ma,{"aria-hidden":`true`}),`Expand All`]}),(0,Y.jsxs)(z_,{onSelect:()=>{b(),d(n.path)},children:[(0,Y.jsx)(Ei,{"aria-hidden":`true`}),`Collapse All`]}),(0,Y.jsx)(U_,{})]}):null,t[13]=i,t[14]=b,t[15]=v,t[16]=m,t[17]=n.path,t[18]=d,t[19]=u,t[20]=c,t[21]=C):C=t[21];let w;t[22]!==v||t[23]!==n.path||t[24]!==s?(w=()=>{v(),s.startRenaming(n.path)},t[22]=v,t[23]=n.path,t[24]=s,t[25]=w):w=t[25];let T;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Y.jsx)(yt,{"aria-hidden":`true`}),t[26]=T):T=t[26];let E;t[27]!==i||t[28]!==w?(E=(0,Y.jsxs)(z_,{disabled:i,onSelect:w,children:[T,`Rename`]}),t[27]=i,t[28]=w,t[29]=E):E=t[29];let D;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Y.jsxs)(G_,{children:[(0,Y.jsx)(_i,{"aria-hidden":`true`}),`Copy Path`]}),t[30]=D):D=t[30];let O=!a,k;t[31]!==b||t[32]!==n||t[33]!==a?(k=()=>{a&&(b(),kN(Ud(a.contentDir,oN(n),a.pathSeparator),`full path`))},t[31]=b,t[32]=n,t[33]=a,t[34]=k):k=t[34];let A;t[35]!==O||t[36]!==k?(A=(0,Y.jsx)(z_,{disabled:O,onSelect:k,children:`Full Path`}),t[35]=O,t[36]=k,t[37]=A):A=t[37];let j;t[38]!==b||t[39]!==n?(j=(0,Y.jsx)(z_,{onSelect:()=>{b(),kN(oN(n),`relative path`)},children:`Relative Path`}),t[38]=b,t[39]=n,t[40]=j):j=t[40];let M;t[41]!==A||t[42]!==j?(M=(0,Y.jsxs)(W_,{children:[D,(0,Y.jsxs)(K_,{children:[A,j]})]}),t[41]=A,t[42]=j,t[43]=M):M=t[43];let N;t[44]!==o||t[45]!==g||t[46]!==m?(N=!m&&(0,Y.jsx)(hN,{input:g,installStates:o.installStates,isElectronHost:o.isElectronHost,dispatch:o.dispatch}),t[44]=o,t[45]=g,t[46]=m,t[47]=N):N=t[47];let P;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Y.jsx)(U_,{}),t[48]=P):P=t[48];let F;t[49]!==b||t[50]!==l||t[51]!==p?(F=()=>{b(),l(p)},t[49]=b,t[50]=l,t[51]=p,t[52]=F):F=t[52];let I;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Y.jsx)(Ke,{"aria-hidden":`true`}),t[53]=I):I=t[53];let ee;t[54]!==i||t[55]!==F?(ee=(0,Y.jsxs)(z_,{variant:`destructive`,disabled:i,onSelect:F,children:[I,`Delete`]}),t[54]=i,t[55]=F,t[56]=ee):ee=t[56];let L;t[57]!==E||t[58]!==M||t[59]!==N||t[60]!==ee||t[61]!==C?(L=(0,Y.jsxs)(R_,{sideOffset:0,align:`start`,"data-file-tree-context-menu-root":`true`,className:`min-w-52`,children:[C,E,M,N,P,ee]}),t[57]=E,t[58]=M,t[59]=N,t[60]=ee,t[61]=C,t[62]=L):L=t[62];let R;return t[63]!==L||t[64]!==x?(R=(0,Y.jsxs)(I_,{open:!0,modal:!1,onOpenChange:x,children:[S,L]}),t[63]=L,t[64]=x,t[65]=R):R=t[65],R}function BN(e){let t=(0,Z.c)(105),{ref:n}=e,{activeDocName:r,activeTarget:i,closeDocument:a,prewarm:o}=ut(),{notifySidebarFileSelected:s}=rx(),{resolvedTheme:c}=T(),l;t[0]===s?l=t[1]:(l=function(e){ON(e),s()},t[0]=s,t[1]=l);let u=l,d;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=[],t[2]=d):d=t[2];let[f,p]=(0,X.useState)(d),[m,h]=(0,X.useState)(!0),[g,_]=(0,X.useState)(null),[v,y]=(0,X.useState)(null),[b,x]=(0,X.useState)(null),[S,C]=(0,X.useState)(null),w=(0,X.useRef)(f),E=(0,X.useRef)(r),D;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(D=[],t[3]=D):D=t[3];let O=(0,X.useRef)(D),k=(0,X.useRef)(null),A=(0,X.useRef)(null),j=(0,X.useRef)(null),M=(0,X.useRef)(!1),N=(0,X.useRef)(null),P=(0,X.useRef)(YN),F=(0,X.useRef)(JN),I=(0,X.useRef)(qN),{selectedFilePath:ee,selectedFolderPath:L,navigationPath:R}=pN(i,r),z=ee?YM(ee):L?QM(L):null,B=ff().states,{dispatch:V}=ef(),H;t[4]!==V||t[5]!==B?(H={installStates:B,isElectronHost:typeof window<`u`&&window.okDesktop!=null,dispatch:V},t[4]=V,t[5]=B,t[6]=H):H=t[6];let te=H,ne;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(ne=[],t[7]=ne):ne=t[7];let re;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(re={paths:ne,flattenEmptyDirectories:!1,initialExpansion:`closed`,search:!0,searchBlurBehavior:`retain`,fileTreeSearchMode:`hide-non-matches`,initialVisibleRowCount:18,stickyFolders:!0,icons:{set:`complete`,spriteSheet:FN},composition:{contextMenu:{enabled:!0,triggerMode:`both`,buttonVisibility:`when-needed`}},dragAndDrop:{canDrag:()=>N.current===null,canDrop:()=>N.current===null,onDropComplete:e=>I.current(e),onDropError:KN},renaming:{canRename:()=>N.current===null,onRename:e=>F.current(e),onError:At.error},onSelectionChange:e=>P.current(e),renderRowDecoration:e=>{let{item:t}=e;if(t.kind!==`file`)return null;let n=w.current.find(e=>YM(e.docName)===t.path);return n?.isSymlink?{icon:jN,title:n.targetPath?`Symlink to ${n.targetPath}`:`Symlink`}:LN(t.path)?{icon:MN,title:`Agent configuration file`}:null}},t[8]=re):re=t[8];let{model:U}=KM(re),W,G;t[9]===f?(W=t[10],G=t[11]):(G=eN(f),W=tN(G),t[9]=f,t[10]=W,t[11]=G);let ie=W,ae=(0,X.useRef)(G),oe;t[12]===f?oe=t[13]:(oe=rN(f),t[12]=f,t[13]=oe);let q=oe,se=(0,X.useRef)(q),J=L?iN(QM(L)).slice(0,-1):iN(z??R),ce=J.join(`\0`),le;t[14]===U?le=t[15]:(le=e=>{let t=eN(e??w.current);U.resetPaths(t,{initialExpandedPaths:O.current})},t[14]=U,t[15]=le);let ue=le,de;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(de=e=>{A.current=nN(e)},t[16]=de):de=t[16];let fe=de,pe,me;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(pe=()=>{let e=!0,t=async function(){try{let t=await fetch(`/api/documents`),n=await t.json().catch(GN);if(!e)return;t.ok&&n?.ok?(p(n.documents),_(null)):_(n?.error??`Server error (HTTP ${t.status})`)}catch(t){let n=t;e&&_(`Could not reach server`),console.warn(`[FileTree] fetch failed:`,n)}e&&h(!1)};t();let n=()=>{document.visibilityState===`visible`&&t()};window.addEventListener(`focus`,n),window.addEventListener(`visibilitychange`,n);let r=Fn(e=>{e.includes(`files`)&&t()});return()=>{e=!1,window.removeEventListener(`focus`,n),window.removeEventListener(`visibilitychange`,n),r()}},me=[],t[17]=pe,t[18]=me):(pe=t[17],me=t[18]),(0,X.useEffect)(pe,me);let he,ge;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(he=()=>{let e=!0;return fetch(`/api/workspace`).then(async t=>{let n=await t.json().catch(WN);e&&t.ok&&n?.ok&&typeof n.contentDir==`string`&&(n.pathSeparator===`/`||n.pathSeparator===`\\`)&&C({contentDir:n.contentDir,pathSeparator:n.pathSeparator})}).catch(UN),()=>{e=!1}},ge=[],t[19]=he,t[20]=ge):(he=t[19],ge=t[20]),(0,X.useEffect)(he,ge);let _e,ve;t[21]!==U||t[22]!==ie?(_e=()=>{if(A.current===ie){A.current=null;return}U.resetPaths(ae.current,{initialExpandedPaths:O.current})},ve=[U,ie],t[21]=U,t[22]=ie,t[23]=_e,t[24]=ve):(_e=t[23],ve=t[24]),(0,X.useEffect)(_e,ve);let ye,be;t[25]!==ce||t[26]!==z||t[27]!==U?(ye=()=>{if(!z)return;let e=ce?ce.split(`\0`):[];for(let t of e){let e=RN(U.getItem(t));e&&!e.isExpanded()&&e.expand()}let t=U.getItem(z);t&&(M.current=!0,t.select(),t.focus(),queueMicrotask(()=>{M.current=!1}))},be=[ce,z,U],t[25]=ce,t[26]=z,t[27]=U,t[28]=ye,t[29]=be):(ye=t[28],be=t[29]),(0,X.useEffect)(ye,be);let xe,Se;t[30]===U?(xe=t[31],Se=t[32]):(xe=()=>U.subscribe(()=>{if(!U.isSearchOpen())for(let e of O.current){let t=RN(U.getItem(e));t&&!t.isExpanded()&&t.expand()}}),Se=[U],t[30]=U,t[31]=xe,t[32]=Se),(0,X.useEffect)(xe,Se);let Ce;t[33]===a?Ce=t[34]:(Ce=e=>{let t=E.current,n=Kb(t,e);for(let t of e)a(t.fromDocName);p(t=>{let n=Wb(t,e);return fe(n),n}),Wn([`files`,`backlinks`,`graph`]),t&&n!==t&&(window.location.hash=`#/${n}`)},t[33]=a,t[34]=Ce);let we=Ce,Te;t[35]!==we||t[36]!==ue?(Te=async function(e){let t=e.isFolder?`folder`:`file`,n=sN(e.sourcePath,e.isFolder),r=sN(e.destinationPath,e.isFolder),i=k.current;y(n),_(null);try{if(i?.renamePath===n){let e=lN(t,r),n=await fetch(`/api/create-page`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e})}),i=await n.json().catch(HN);if(!n.ok||!i?.ok){let e=i?.error??`Failed to create ${t}`;At.error(e),_(e),ue(),k.current=null,y(null);return}let a=i.docName??e.replace(/\.md$/i,``);p(e=>{if(e.some(e=>e.docName===a))return e;let t=[...e,{docName:a,modified:new Date().toISOString(),size:0}];return fe(t),t}),ON(a),Wn([`files`,`backlinks`,`graph`]),k.current=null,y(null);return}let a=e.isFolder?`/api/rename-path`:`/api/rename`,o=e.isFolder?{kind:`folder`,fromPath:ZM(n),toPath:ZM(r)}:{docName:XM(n),newDocName:XM(r)},s=await fetch(a,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(o)}),c=await s.json();if(!s.ok||!c.ok){let e=c.error??`Failed to rename path`;At.error(e),_(e),ue(),k.current=null,y(null);return}we(Array.isArray(c.renamed)?c.renamed:[]),k.current=null,y(null)}catch(e){console.warn(`[FileTree] rename failed:`,e),At.error(`Network error — please try again`),_(`Network error — please try again`),ue(),k.current=null,y(null)}},t[35]=we,t[36]=ue,t[37]=Te):Te=t[37];let Ee=Te,De;t[38]!==we||t[39]!==ue?(De=async function(e){let t=e.draggedPaths.map(t=>{let n=uN(t,e.target);return t===n?null:{sourcePath:t,destinationTreePath:n}}).filter(VN);if(t.length!==0){y(t[0]?.sourcePath??null),_(null);try{let e=[];for(let n of t){let t=n.sourcePath.endsWith(`/`),r=t?`/api/rename-path`:`/api/rename`,i=t?{kind:`folder`,fromPath:ZM(n.sourcePath),toPath:ZM(n.destinationTreePath)}:{docName:XM(n.sourcePath),newDocName:XM(n.destinationTreePath)},a=await fetch(r,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(i)}),o=await a.json();if(!a.ok||!o.ok){let e=o.error??`Failed to move`;At.error(e),_(e),ue(),y(null);return}e=e.concat(Array.isArray(o.renamed)?o.renamed:[])}we(e),y(null)}catch(e){console.warn(`[FileTree] move failed:`,e),At.error(`Network error — please try again`),ue(),y(null)}}},t[38]=we,t[39]=ue,t[40]=De):De=t[40];let Oe=De,ke;t[41]!==U||t[42]!==G?(ke=function(e,t){try{let n=cN(e,t,[...G,...se.current]);k.current={kind:e,renamePath:n.renamePath},U.add(n.addPath),U.startRenaming(n.renamePath,{removeIfCanceled:!0})}catch(e){console.warn(`[FileTree] create placeholder failed:`,e),At.error(`Could not start creating a new item`)}},t[41]=U,t[42]=G,t[43]=ke):ke=t[43];let Ae=ke,je;t[44]===U?je=t[45]:(je=function(e){let t=QM(e);(0,X.startTransition)(()=>{for(let e of se.current)if(e===t||e.startsWith(t)){let t=RN(U.getItem(e));t&&t.expand()}})},t[44]=U,t[45]=je);let Me=je,Ne;t[46]===U?Ne=t[47]:(Ne=function(e){let t=QM(e),n=new Set(O.current);(0,X.startTransition)(()=>{for(let e of[...se.current].reverse())if((e===t||e.startsWith(t))&&!n.has(e)){let t=RN(U.getItem(e));t&&t.collapse()}})},t[46]=U,t[47]=Ne);let Pe=Ne,Fe;t[48]!==J||t[49]!==r||t[50]!==v||t[51]!==f||t[52]!==q||t[53]!==Oe||t[54]!==Ee||t[55]!==u||t[56]!==G?(Fe=()=>{w.current=f,E.current=r,N.current=v,ae.current=G,se.current=q,O.current=J,P.current=e=>{if(M.current)return;let t=e[0];t&&u($M(t))},F.current=Ee,I.current=Oe},t[48]=J,t[49]=r,t[50]=v,t[51]=f,t[52]=q,t[53]=Oe,t[54]=Ee,t[55]=u,t[56]=G,t[57]=Fe):Fe=t[57],(0,X.useLayoutEffect)(Fe);let Ie;t[58]!==U||t[59]!==Ae?(Ie=()=>({startCreating:Ae,expandAll(){(0,X.startTransition)(()=>{for(let e of se.current){let t=RN(U.getItem(e));t&&t.expand()}})},collapseAll(){let e=new Set(O.current);(0,X.startTransition)(()=>{for(let t of[...se.current].reverse()){if(e.has(t))continue;let n=RN(U.getItem(t));n&&n.collapse()}})}}),t[58]=U,t[59]=Ae,t[60]=Ie):Ie=t[60],(0,X.useImperativeHandle)(n,Ie);let Le;t[61]!==a||t[62]!==U||t[63]!==ue?(Le=async function(e){y(e.path),x(null);try{let t=e.kind===`folder`?QM(e.path):YM(e.path),n=await fetch(`/api/delete-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e.kind,path:e.path})}),r=await n.json();if(!n.ok||!r.ok){At.error(r.error??`Failed to delete path`),y(null);return}let i=Array.isArray(r.deletedDocNames)?r.deletedDocNames:[],o=new Set(i);for(let e of o)a(e);U.getItem(t)&&U.remove(t,e.kind===`folder`?{recursive:!0}:void 0),p(e=>{let t=Gb(e,i);return fe(t),t}),Wn([`files`,`backlinks`,`graph`]);let s=E.current;s&&o.has(s)&&(window.location.hash=``),y(null)}catch(e){console.warn(`[FileTree] delete failed:`,e),At.error(`Network error — please try again`),y(null),ue()}},t[61]=a,t[62]=U,t[63]=ue,t[64]=Le):Le=t[64];let Re=Le,ze;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(ze=function(){let e=j.current;e&&DN(e),j.current=null},t[65]=ze):ze=t[65];let Be=ze,Ve;t[66]===o?Ve=t[67]:(Ve=function(e){let t=XN(e.nativeEvent);if(!t||t.endsWith(`/`)){Be();return}let n=XM(t);j.current!==n&&(Be(),j.current=n,EN(n,e=>{o(e)}))},t[66]=o,t[67]=Ve);let He=Ve;if(m){let e;return t[68]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(`div`,{className:`flex flex-1 items-center justify-center py-8`,children:(0,Y.jsx)(`span`,{className:`select-none text-sidebar-foreground/30 text-sm`,children:`Loading...`})}),t[68]=e):e=t[68],e}if(f.length===0){if(g){let e;return t[69]===g?e=t[70]:(e=(0,Y.jsx)(`div`,{className:`flex flex-1 items-center justify-center py-8`,children:(0,Y.jsx)(`span`,{className:`select-none text-sidebar-foreground/50 text-sm`,children:g})}),t[69]=g,t[70]=e),e}let e;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(`span`,{className:`select-none text-sidebar-foreground/30 text-sm`,children:`No files yet.`}),t[71]=e):e=t[71];let n;return t[72]===Ae?n=t[73]:(n=(0,Y.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 py-8`,children:[e,(0,Y.jsx)(K,{variant:`link`,size:`sm`,className:`font-mono uppercase`,onClick:()=>Ae(`file`,``),children:`Create your first file`})]}),t[72]=Ae,t[73]=n),n}let Ue=v!==null,We;t[74]===g?We=t[75]:(We=g&&(0,Y.jsx)(`span`,{role:`alert`,className:`px-3 pb-1 text-destructive text-xs`,children:g}),t[74]=g,t[75]=We);let Ge;t[76]===c?Ge=t[77]:(Ge=IN(c),t[76]=c,t[77]=Ge);let Ke;t[78]!==Ue||t[79]!==Pe||t[80]!==Me||t[81]!==te||t[82]!==U||t[83]!==Ae||t[84]!==S?(Ke=(e,t)=>(0,Y.jsx)(zN,{item:e,context:t,anyActionBusy:Ue,workspace:S,handoff:te,model:U,onStartCreating:Ae,onDelete:x,onExpandSubtree:Me,onCollapseSubtree:Pe}),t[78]=Ue,t[79]=Pe,t[80]=Me,t[81]=te,t[82]=U,t[83]=Ae,t[84]=S,t[85]=Ke):Ke=t[85];let qe;t[86]!==He||t[87]!==U||t[88]!==We||t[89]!==Ge||t[90]!==Ke?(qe=(0,Y.jsx)(GM,{header:We,model:U,style:Ge,onMouseMove:He,onMouseLeave:Be,renderContextMenu:Ke}),t[86]=He,t[87]=U,t[88]=We,t[89]=Ge,t[90]=Ke,t[91]=qe):qe=t[91];let Je=!!b,Ye;t[92]===v?Ye=t[93]:(Ye=e=>{!e&&!v&&x(null)},t[92]=v,t[93]=Ye);let Xe;t[94]!==v||t[95]!==b||t[96]!==Re?(Xe=b&&(0,Y.jsx)(qM,{itemName:`${b.name}${b.kind===`file`?`.md`:`/`}`,isSubmitting:v===b.path,onDelete:()=>Re(b),customDescription:b.kind===`folder`?`Are you sure you want to delete ${b.name}/ and all files inside? This action cannot be undone.`:void 0}),t[94]=v,t[95]=b,t[96]=Re,t[97]=Xe):Xe=t[97];let Ze;t[98]!==Je||t[99]!==Ye||t[100]!==Xe?(Ze=(0,Y.jsx)(Jt,{open:Je,onOpenChange:Ye,children:Xe}),t[98]=Je,t[99]=Ye,t[100]=Xe,t[101]=Ze):Ze=t[101];let Qe;return t[102]!==qe||t[103]!==Ze?(Qe=(0,Y.jsxs)(Y.Fragment,{children:[qe,Ze]}),t[102]=qe,t[103]=Ze,t[104]=Qe):Qe=t[104],Qe}function VN(e){return!!e}function HN(){return null}function UN(e){console.warn(`[FileTree] /api/workspace fetch failed:`,e)}function WN(){return null}function GN(){return null}function KN(e){At.error(e)}function qN(){}function JN(){}function YN(){}function XN(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.dataset.itemPath)return t.dataset.itemPath;return null}var ZN=(e,t,n)=>ya(e,t,n,`ProjectSwitcher`);function QN(e){let t=(0,Z.c)(59),{bridge:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=[],t[0]=r):r=t[0];let[i,a]=(0,X.useState)(r),[o,s]=(0,X.useState)(!1),c;t[1]!==n.project||t[2]!==o?(c=()=>{if(!o)return;let e=!1;return ZN(async()=>{let t=await n.project.listRecent();e||a(t)},`Failed to load recent projects.`),()=>{e=!0}},t[1]=n.project,t[2]=o,t[3]=c):c=t[3];let l;t[4]!==n||t[5]!==o?(l=[o,n],t[4]=n,t[5]=o,t[6]=l):l=t[6],(0,X.useEffect)(c,l);let u;t[7]===n.project?u=t[8]:(u=e=>{s(!1),ZN(()=>n.project.open({path:e,target:`new-window`}),`Failed to open project.`)},t[7]=n.project,t[8]=u);let d=u,f;t[9]!==n.dialog||t[10]!==n.project?(f=()=>{s(!1),ZN(async()=>{let e=await n.dialog.openFolder();e&&await n.project.open({path:e,target:`new-window`})},`Failed to open folder.`)},t[9]=n.dialog,t[10]=n.project,t[11]=f):f=t[11];let p=f,m;t[12]===n.navigator?m=t[13]:(m=()=>{s(!1),ZN(()=>n.navigator.open(),`Failed to open Project Navigator.`)},t[12]=n.navigator,t[13]=m);let h=m,g=n.config.projectPath,_,v,y,b,x,S,C,w,T,E,D;if(t[14]!==n.config.projectName||t[15]!==g||t[16]!==o||t[17]!==d||t[18]!==i){let e;t[30]===g?e=t[31]:(e=e=>e.path!==g,t[30]=g,t[31]=e);let r=i.filter(e);v=I_,S=o,C=s;let a;t[32]===n.config.projectName?a=t[33]:(a=(0,Y.jsx)(`span`,{className:`truncate`,children:n.config.projectName}),t[32]=n.config.projectName,t[33]=a);let c;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Y.jsx)(ci,{"aria-hidden":`true`,className:`opacity-60`}),t[34]=c):c=t[34],t[35]===a?w=t[36]:(w=(0,Y.jsx)(L_,{asChild:!0,children:(0,Y.jsxs)(gx,{className:`justify-between text-sidebar-foreground/70`,"data-testid":`project-switcher-trigger`,title:`Open project menu`,children:[a,c]})}),t[35]=a,t[36]=w),_=R_,T=`start`,E=`top`,D=`min-w-[260px]`,y=`project-switcher-menu`,t[37]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Y.jsx)(H_,{className:`font-mono font-normal tracking-wide uppercase text-muted-foreground text-xs`,children:`Recent projects`}),t[37]=b):b=t[37],x=r.length===0?(0,Y.jsx)(H_,{className:`font-normal text-muted-foreground text-xs`,children:`No other recent projects.`}):r.slice(0,10).map(e=>(0,Y.jsxs)(z_,{disabled:e.missing,onSelect:()=>d(e.path),className:`flex flex-col items-start gap-0.5`,"data-testid":`project-switcher-recent-${e.path}`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-sm`,children:e.name}),(0,Y.jsxs)(`span`,{className:`max-w-[240px] truncate text-muted-foreground text-xs`,children:[e.path,e.missing?` (missing)`:``]})]},e.path)),t[14]=n.config.projectName,t[15]=g,t[16]=o,t[17]=d,t[18]=i,t[19]=_,t[20]=v,t[21]=y,t[22]=b,t[23]=x,t[24]=S,t[25]=C,t[26]=w,t[27]=T,t[28]=E,t[29]=D}else _=t[19],v=t[20],y=t[21],b=t[22],x=t[23],S=t[24],C=t[25],w=t[26],T=t[27],E=t[28],D=t[29];let O;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Y.jsx)(U_,{}),t[38]=O):O=t[38];let k;t[39]===p?k=t[40]:(k=(0,Y.jsx)(z_,{onSelect:p,"data-testid":`project-switcher-open-folder`,children:`Open folder…`}),t[39]=p,t[40]=k);let A;t[41]===h?A=t[42]:(A=(0,Y.jsx)(z_,{onSelect:h,"data-testid":`project-switcher-switch-project`,children:Dd}),t[41]=h,t[42]=A);let j;t[43]!==_||t[44]!==y||t[45]!==b||t[46]!==x||t[47]!==k||t[48]!==A||t[49]!==T||t[50]!==E||t[51]!==D?(j=(0,Y.jsxs)(_,{align:T,side:E,className:D,"data-testid":y,children:[b,x,O,k,A]}),t[43]=_,t[44]=y,t[45]=b,t[46]=x,t[47]=k,t[48]=A,t[49]=T,t[50]=E,t[51]=D,t[52]=j):j=t[52];let M;return t[53]!==v||t[54]!==S||t[55]!==C||t[56]!==w||t[57]!==j?(M=(0,Y.jsxs)(v,{open:S,onOpenChange:C,children:[w,j]}),t[53]=v,t[54]=S,t[55]=C,t[56]=w,t[57]=j,t[58]=M):M=t[58],M}function $N(e){let t=(0,Z.c)(13),{notice:n,onDismiss:r}=e,i=n.variant===`error`?`border-destructive/60`:`border-sidebar-border`,a=`update-notice-${n.id}`,o=`flex items-center gap-2 rounded-md border bg-sidebar-accent/30 px-2 py-1.5 text-xs text-muted-foreground ${i}`,s;t[0]===n.body?s=t[1]:(s=(0,Y.jsx)(`span`,{className:`flex-1 leading-snug`,children:n.body}),t[0]=n.body,t[1]=s);let c;t[2]===n.action?c=t[3]:(c=n.action?(0,Y.jsx)(`button`,{type:`button`,className:`shrink-0 text-xs font-medium underline underline-offset-2 decoration-muted-foreground/40 hover:text-sidebar-foreground hover:decoration-sidebar-foreground`,onClick:()=>{n.action?.onClick()},children:n.action.label}):null,t[2]=n.action,t[3]=c);let l;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Y.jsx)(Zt,{"aria-hidden":`true`,className:`size-3`}),t[4]=l):l=t[4];let u;t[5]===r?u=t[6]:(u=(0,Y.jsx)(K,{variant:`ghost`,size:`icon`,className:`size-5 shrink-0 text-muted-foreground hover:text-sidebar-foreground`,"aria-label":`Dismiss notice`,onClick:r,children:l}),t[5]=r,t[6]=u);let d;return t[7]!==a||t[8]!==o||t[9]!==s||t[10]!==c||t[11]!==u?(d=(0,Y.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":a,className:o,children:[s,c,u]}),t[7]=a,t[8]=o,t[9]=s,t[10]=c,t[11]=u,t[12]=d):d=t[12],d}function eP(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 tP(){let e=(0,Z.c)(7),t=(0,X.useSyncExternalStore)(xu,bu,bu),n;e[0]===t?n=e[1]:(n=eP(t),e[0]=t,e[1]=n);let r=n;if(!r)return null;let i;e[2]===r.id?i=e[3]:(i=()=>{yu(r.id)},e[2]=r.id,e[3]=i);let a;return e[4]!==r||e[5]!==i?(a=(0,Y.jsx)(`div`,{"data-testid":`update-notices-list`,children:(0,Y.jsx)($N,{notice:r,onDismiss:i})}),e[4]=r,e[5]=i,e[6]=a):a=e[6],a}function nP(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Y.jsx)(_t,{name:`file-sidebar`,children:(0,Y.jsx)(rP,{})}),e[0]=t):t=e[0],t}function rP(){let e=(0,Z.c)(8),t=(0,X.useRef)(null),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Y.jsx)(`span`,{className:`font-mono text-sm uppercase tracking-wider text-sidebar-foreground/50`,children:`Files`}),e[0]=n):n=e[0];let r;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Y.jsxs)(ln,{children:[(0,Y.jsx)(nn,{asChild:!0,children:(0,Y.jsx)(L_,{asChild:!0,children:(0,Y.jsx)(K,{variant:`ghost`,size:`icon`,"aria-label":`Tree view options`,children:(0,Y.jsx)(zi,{"aria-hidden":`true`})})})}),(0,Y.jsx)(an,{children:`Tree view options`})]}),e[1]=r):r=e[1];let i;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Y.jsxs)(z_,{onSelect:()=>t.current?.expandAll(),children:[(0,Y.jsx)(ma,{"aria-hidden":`true`}),`Expand All`]}),e[2]=i):i=e[2];let a;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Y.jsxs)(I_,{children:[r,(0,Y.jsxs)(R_,{align:`end`,children:[i,(0,Y.jsxs)(z_,{onSelect:()=>t.current?.collapseAll(),children:[(0,Y.jsx)(Ei,{"aria-hidden":`true`}),`Collapse All`]})]})]}),e[3]=a):a=e[3];let o;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Y.jsxs)(ln,{children:[(0,Y.jsx)(nn,{asChild:!0,children:(0,Y.jsx)(K,{variant:`ghost`,size:`icon`,"aria-label":`New file`,onClick:()=>t.current?.startCreating(`file`,``),children:(0,Y.jsx)(sa,{"aria-hidden":`true`})})}),(0,Y.jsx)(an,{children:`New File`})]}),e[4]=o):o=e[4];let s;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Y.jsx)(ux,{children:(0,Y.jsx)(px,{children:(0,Y.jsx)(mx,{children:(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[n,(0,Y.jsxs)(`div`,{className:`flex items-center gap-1`,children:[a,o,(0,Y.jsxs)(ln,{children:[(0,Y.jsx)(nn,{asChild:!0,children:(0,Y.jsx)(K,{variant:`ghost`,size:`icon`,"aria-label":`New folder`,onClick:()=>t.current?.startCreating(`folder`,``),children:(0,Y.jsx)(Di,{"aria-hidden":`true`})})}),(0,Y.jsx)(an,{children:`New Folder`})]})]})]})})})}),e[5]=s):s=e[5];let c;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Y.jsx)(fx,{children:(0,Y.jsx)(BN,{ref:t})}),e[6]=c):c=e[6];let l;return e[7]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Y.jsxs)(sx,{variant:`inset`,children:[s,c,(0,Y.jsxs)(dx,{className:`px-0`,children:[typeof window<`u`&&window.okDesktop?(0,Y.jsx)(px,{children:(0,Y.jsx)(mx,{children:(0,Y.jsx)(QN,{bridge:window.okDesktop})})}):null,(0,Y.jsx)(tP,{})]})]}),e[7]=l):l=e[7],l}function iP(){let e=(0,Z.c)(17),t=y(),{collabUrl:n,setSystemProvider:r,updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c}=ut(),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,X.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,X.useEffect)(d);let f,p;return e[12]!==n||e[13]!==t||e[14]!==r?(f=()=>{if(n===null)return;let e=new Le,i=new Be({url:n,name:Qn,document:e,onStateless:e=>{let{payload:t}=e;He(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:cP,onUnknown:sP})},onClose:oP,onDisconnect:aP}),a=Fn(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=kt(()=>{u.current.refreshServerInfo()});i.on(`synced`,()=>{Wn([`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,X.useEffect)(f,p),null}function aP(){console.warn(`[CC1] __system__ disconnected - derived views may be stale`)}function oP(e){let{event:t}=e;console.warn(`[CC1] __system__ connection closed:`,t.code,t.reason)}function sP(e){console.warn(`[CC1] Unparseable stateless payload, skipping:`,e.slice(0,100))}function cP(e){Wn([e.ch])}function lP(){let e=(0,Z.c)(7),{clearTarget:t}=ut(),{openTargetTransition:n}=gt(),{folderPaths:r,loading:i,pages:a}=Vn(),o,s;return e[0]!==t||e[1]!==r||e[2]!==i||e[3]!==n||e[4]!==a?(o=()=>{e();function e(){let e=Kn(window.location.hash);if(!e){it(`ok/nav/hash-change`,{docName:null,kind:`clear`}),t();return}if(i){it(`ok/nav/hash-change`,{docName:e,kind:`deferred-loading`});return}let o=Hn(e,{pages:a,folderPaths:r});it(`ok/nav/hash-change`,{docName:e,kind:o.kind}),n(o)}return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},s=[t,r,i,n,a],e[0]=t,e[1]=r,e[2]=i,e[3]=n,e[4]=a,e[5]=o,e[6]=s):(o=e[5],s=e[6]),(0,X.useEffect)(o,s),null}var uP=`#install-claude-desktop`;function dP(){let e=(0,Z.c)(5),[t,n]=(0,X.useState)(typeof window<`u`&&window.location.hash===uP),r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=function(){window.location.hash===uP&&n(!0)};return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,X.useEffect)(r,i);let a;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=function(e){if(n(e),!e&&window.location.hash===uP){let{pathname:e,search:t}=window.location;window.history.replaceState(null,``,`${e}${t}`)}},e[2]=a):a=e[2];let o=a,s;return e[3]===t?s=e[4]:(s=(0,Y.jsx)(Gx,{open:t,onOpenChange:o}),e[3]=t,e[4]=s),s}function fP(){let e=(0,Z.c)(8),{activeDocName:t,activeTarget:n}=ut(),[r,i]=(0,X.useState)(!1),a;e[0]!==t||e[1]!==n?(a=n?.kind===`folder`?n.folderPath:qn(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;Dt({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,X.useEffect)(s,c);let l;return e[5]!==r||e[6]!==o?(l=(0,Y.jsx)(qe,{open:r,onOpenChange:i,kind:`file`,initialDir:o}),e[5]=r,e[6]=o,e[7]=l):l=e[7],l}function pP(){let e=(0,Z.c)(9),t=typeof window<`u`?window.okDesktop??null:null,n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Y.jsx)(bf,{}),e[0]=n):n=e[0];let r,i,a,o,s,c;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Y.jsx)(iP,{}),i=(0,Y.jsx)(lP,{}),a=(0,Y.jsx)(fP,{}),o=(0,Y.jsx)(dP,{}),s=(0,Y.jsx)(Bl,{}),c=t?(0,Y.jsx)(hf,{bridge:t}):null,e[1]=r,e[2]=i,e[3]=a,e[4]=o,e[5]=s,e[6]=c):(r=e[1],i=e[2],a=e[3],o=e[4],s=e[5],c=e[6]);let l;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Y.jsx)(nP,{}),e[7]=l):l=e[7];let u;return e[8]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Y.jsx)(_t,{name:`app`,children:(0,Y.jsxs)(bt,{children:[n,(0,Y.jsxs)(Jn,{children:[r,i,a,o,s,c,(0,Y.jsxs)(ix,{className:`h-screen overflow-hidden`,children:[l,(0,Y.jsx)(lx,{className:`overflow-hidden h-[calc(100vh-var(--layout-inset-offset))]`,children:(0,Y.jsx)(MS,{})})]})]})]})}),e[8]=u):u=e[8],u}Pr(),typeof window<`u`&&window.okDesktop?.config.apiOrigin&&Zl({apiOrigin:window.okDesktop.config.apiOrigin}),typeof window<`u`&&tu({bridge:window.okDesktop}),Su(),typeof window<`u`&&eu({bridge:window.okDesktop}),typeof window<`u`&&wa({bridge:window.okDesktop});var mP=new Ur({defaultOptions:{queries:{retry:1,staleTime:1e4}}}),hP=document.getElementById(`root`);if(!hP)throw Error(`Root element not found`);var gP=typeof window<`u`&&window.okDesktop?.config.mode===`navigator`;(0,ri.createRoot)(hP).render((0,Y.jsx)(X.StrictMode,{children:(0,Y.jsx)(v,{client:mP,children:(0,Y.jsxs)(_,{attribute:`class`,defaultTheme:`system`,enableSystem:!0,disableTransitionOnChange:!0,storageKey:`ok-theme-v1`,children:[(0,Y.jsx)(sn,{children:gP&&window.okDesktop?(0,Y.jsx)(Kl,{bridge:window.okDesktop}):(0,Y.jsx)(pP,{})}),(0,Y.jsx)(Xl,{richColors:!0})]})})}));export{Pl as i,Nl as n,Fl as r,Ll as t};