@inkeep/open-knowledge 0.38.0-beta.4 → 0.38.0-beta.5

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 (34) hide show
  1. package/dist/{acp-harness-probe-HXih6ZdV.mjs → acp-harness-probe-BNlbeFpR.mjs} +2 -2
  2. package/dist/assets/skills/discovery/SKILL.md +1 -1
  3. package/dist/assets/skills/project/SKILL.md +1 -1
  4. package/dist/cli.mjs +6 -6
  5. package/dist/constants-t3FhJ5kj.mjs +2 -0
  6. package/dist/index.mjs +1 -1
  7. package/dist/init-BRJ-t8Lu.mjs +1 -0
  8. package/dist/{init-e_IGVKiY.mjs → init-CloPMHMk.mjs} +3 -3
  9. package/dist/{launch-json-removal-D9iLWqvN.mjs → launch-json-removal-BdwZNPxR.mjs} +2 -2
  10. package/dist/loader-0o0M5iTR.mjs +1 -0
  11. package/dist/{loader-B9kWbDug.mjs → loader-L0RG68Di.mjs} +2 -2
  12. package/dist/preview-CPKzfpkN.mjs +1 -0
  13. package/dist/{preview-BS1icqKH.mjs → preview-mobXnBPo.mjs} +2 -2
  14. package/dist/public/assets/{AgentDiffPane-CiFNU0h-.js → AgentDiffPane-QEI9IvTx.js} +1 -1
  15. package/dist/public/assets/{ManagedArtifactProperties-CzFEbg0T.js → ManagedArtifactProperties-DroX_qbT.js} +1 -1
  16. package/dist/public/assets/PropertyPanel-CjAWmcMG.js +2 -0
  17. package/dist/public/assets/{TimelineDiffPane-Zfm2PLUq.js → TimelineDiffPane-BEQVtkis.js} +1 -1
  18. package/dist/public/assets/index-Cj5Hm4v5.css +1 -0
  19. package/dist/public/assets/{index-DZjGzqUr.js → index-IkUUpMh3.js} +90 -90
  20. package/dist/public/assets/{use-timeline-entry-diff-DbRWhy_0.js → use-timeline-entry-diff-B9JmhzBH.js} +1 -1
  21. package/dist/public/index.html +3 -3
  22. package/dist/{repair-launch-json-BfRG-Gd2.mjs → repair-launch-json-BpJsHMl7.mjs} +2 -2
  23. package/dist/{repair-mcp-configs-D2VQZ6vd.mjs → repair-mcp-configs-DIouVxbz.mjs} +2 -2
  24. package/dist/{src-Cx3T59sz.mjs → src-BjPwa-U8.mjs} +2 -2
  25. package/dist/start-DEFBseHT.mjs +1 -0
  26. package/dist/{start-DelzatCP.mjs → start-DGgc0XwY.mjs} +2 -2
  27. package/package.json +4 -4
  28. package/dist/constants-DwK-tP-f.mjs +0 -2
  29. package/dist/init-B2VDisuq.mjs +0 -1
  30. package/dist/loader-CYLxd0QN.mjs +0 -1
  31. package/dist/preview-BxVh4XVd.mjs +0 -1
  32. package/dist/public/assets/PropertyPanel-BwnXcEQL.js +0 -2
  33. package/dist/public/assets/index-NzW9g3x_.css +0 -1
  34. package/dist/start-D1wBWbC-.mjs +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./telemetry-impl-DEJSJ5rS.js","./chunk-DseTPa7n.js","./preload-helper-2ej06EnG.js","./trace-api-CXljsYUC.js","./propagation-api-yIIm019t.js","./ReportBugDialogBody-hPmCfQyc.js","./dist-Vm1kQiqo.js","./lib-9ZUh4rh4.js","./markdownit-BEubyjFu.js","./w3c-keyname-Daddi42S.js","./dist-DBENJeML.js","./jsx-runtime-DyiINK0N.js","./react-JNybMug3.js","./checkbox-Cn88M3G6.js","./dist-93kZXTH1.js","./floating-ui.dom-DhDEJ-Ns.js","./dist-Bv-DNDka.js","./createLucideIcon-BUb14crZ.js","./bundle-mjs-Dy8bHgkj.js","./react-dom-Db7zF7dM.js","./dist-xZVtOT7r.js","./check-D3jznJmG.js","./compiler-runtime-dQcBxOhn.js","./dialog-BLaUGJCd.js","./es2015-D5U2f808.js","./button-DHE6Sx02.js","./x-6ATUQvcC.js","./CopyButton-D0gTyMvW.js","./tooltip-BCGL5jDF.js","./copy-Dwat-rG5.js","./loader-circle-K7Xwpjny.js","./triangle-alert-DpxK7pzx.js","./badge-BDZGi1Ks.js","./input-CsXmpyZP.js","./textarea-DwJR-19i.js","./external-link-BtglP1zb.js","./clipboard-adapter-BGIXxhKQ.js","./GraphPanel-BjCltqW1.js","./dist-BD3698ve.js","./toggle-group-CxrQL99E.js","./dist-B4uQVk5s.js","./dist-BJxDYUHt.js","./useQuery-NsPxD6kI.js","./min-C03Z0UNc.js","./src-DlwJ21NB.js","./colors-N4wXgevD.js","./ordinal-DC5m951M.js","./init-BZfMkAqI.js","./isObject-ClHKc-zZ.js","./now-LAZzaJBH.js","./arrow-up-right-BKliW282.js","./prop-types-B0l6ZN6O.js","./navigation-targets-4J3F85tT.js","./doc-hash-B8kD24Kw.js","./documents-events-DQ6Iario.js","./documents-fetch-CyAk_i-3.js","./parse-api-error-DucXvNZh.js","./startup-marks-CytO17UM.js","./dist-COAuqNbv.js","./target-navigation-intent-95GTKrco.js","./panel-DLUMbyPl.js","./ActivityModeContent-BQeZuILy.js","./CodeMirrorPropInput-BDpilu8K.js","./dist-635PXtcP.js","./dist-5kUc8Rop.js","./dist-n-Hi6NdA.js","./dist-C5oOOujV.js","./dist-uVOKoIoH.js","./dist-DUnAX2Ky.js","./dist-CcNiwixP.js","./dist-DrdxKM3X.js","./dist-BgCLeN3Q.js","./stex-Hrt2qQag.js","./config-provider-CD9uoQQz.js","./client-version-nevRUfmx.js","./use-apply-config-color-theme-DBdIMwiU.js","./config-context-C5AosGyi.js","./folder-open-C-WgQ0Xp.js","./trash-2-DpF__0y9.js","./DocumentContext-C4eewS75.js","./collapsible-BIzY37go.js","./terminal-input-events-DxwonmvH.js","./git-branch-DFJ3yJt8.js","./chevron-down-0vl-mPeL.js","./chevron-right-zaL9JagC.js","./workspace-paths-B_ozK4P-.js","./eye-CmnH89UE.js","./info-DV3bzhzI.js","./paperclip-DF10JkTg.js","./sliders-horizontal-C9Uy29A1.js","./dist-DwCd6eR-.js","./file-tree-rename-validation-DMHa94fr.js","./use-collab-url-CwAStsIj.js","./DocumentContext-B0sQn39F.css","./timeline-diff-store-dt1fl2gd.js","./agent-diff-store-D6N0WX_4.js","./cursor-AolWKuZw.js","./copilot-Be7YOjJF.js","./use-activity-panel-BsQxJQD5.js","./agent-presence-DdJtLtJ1.js","./lru-string-cache-D19dwCKJ.js","./dist-C5VV4AJh.js","./dist-BlUN9R-p.js","./SettingsDialogBody-0nrbk-EZ.js","./sortable.esm-DcjmFgta.js","./dropdown-menu-CcKe8PiU.js","./dist-Cx2QCt5k.js","./label-bn6BDr7p.js","./radio-group-DW_ypmKx.js","./auth-state-cache-BUoG-O4E.js","./EnableSyncConfirmDialog-CLtmD52b.js","./skill-actions-s_ATobEI.js","./RegisteredAgentIcon--E1135hW.js","./refresh-cw-DSH9Of_0.js","./agent-visibility-Z2AQQ5Ce.js","./keyboard-shortcuts-DZ9kTSZ4.js","./skills-api-CYoD9FQt.js","./use-workspace-DyAcZSjY.js","./download-wdc_OGNY.js","./open-managed-artifact-tab-ze9HkqWn.js","./skeleton-CA6hvjst.js","./lint-config-client-Bg-6mquJ.js","./index.esm-DRU91WyY.js","./form-J8CRFj8p.js","./use-terminal-enabled-jZPkRHXb.js","./terminal-telemetry-DxZXlrf4.js","./ManagedArtifactProperties-CzFEbg0T.js","./PropertyPanel-BwnXcEQL.js","./format-Dn5VT_ew.js","./selection-context-DIZSdbRw.js","./MermaidDocEditor-BgRVEFx4.js","./dist-BigQ5-K5.js","./src-7sFVeKSR.js","./SourceEditor-DYIbaxIY.js","./typing-burst-detector-CmSynwPq.js","./wrench-BDWKT3wQ.js","./SkillEditorActions-BEtnBlep.js","./TimelineDiffPane-Zfm2PLUq.js","./use-timeline-entry-diff-DbRWhy_0.js","./libesm-BUX1Jc4h.js","./panel-right-open-CBweAP43.js","./AgentDiffPane-CiFNU0h-.js","./FeedbackForm-DH4DaXLD.js","./zod-CCGVCn6n.js","./AppMenubar-DqlpmcU7.js","./AgentThreadClientBinder-poPjsQXP.js","./thread-client-DH1Xs0By.js","./TerminalSessionsHost-BjojawIi.js","./terminal-launch-events-D0NkBM4g.js","./McpConsentDialogBody-B0VkhB1e.js","./mcp-consent-store-rBVJ88Wy.js","./ShareBranchSwitchDialog-GXTPAgND.js","./miss-dialog-store-81J1GwFD.js","./share-metadata-rows-Do2le589.js","./desktop-bridge-types-Ij8BA7el.js","./receive-store-jfaprLyZ.js","./worktree-store-1tC864Do.js","./ShareReceiveMissDialog-CHR2clGS.js","./pending-receive-nav-store-Dqowl8LB.js","./ConsentDialogBody-D9xWEY09.js","./project-paths-DcJ4HDNl.js","./ShareReceiveDialog-IVAS4xf8.js","./TerminalWindowApp-jhlpCVAO.js","./use-live-xterm-theme-oqXGh0AM.js","./use-installed-clis-DmVWBoog.js","./telemetry-startup-Bvr_iW-w.js"])))=>i.map(i=>d[i]);
2
- import{i as e,t}from"./chunk-DseTPa7n.js";import{t as n}from"./preload-helper-2ej06EnG.js";import{t as r}from"./jsx-runtime-DyiINK0N.js";import{$ as i,$t as a,A as o,At as s,B as c,Bt as l,Ct as u,D as d,Dt as f,Et as p,F as m,Ft as h,G as g,Gt as _,H as v,Ht as y,I as b,It as x,J as S,Jt as C,K as w,Kt as T,L as E,Lt as D,Mt as O,N as k,Nt as A,O as j,Ot as M,P as N,Pt as P,Q as F,R as I,Rt as L,St as R,Tt as z,U as B,Ut as V,V as H,Vt as U,W,Wt as ee,X as G,Xt as K,Y as te,Yt as ne,Z as re,Zt as ie,_t as ae,a as oe,an as se,at as ce,bn as le,bt as ue,c as de,cn as fe,ct as pe,d as q,dn as me,en as he,et as ge,f as _e,fn as ve,ft as ye,g as be,gn as xe,gt as Se,h as Ce,ht as we,i as Te,in as Ee,it as De,j as Oe,jt as ke,k as Ae,kt as je,l as Me,ln as Ne,lt as Pe,m as Fe,mn as Ie,mt as Le,n as Re,nn as ze,nt as Be,o as Ve,on as He,ot as Ue,p as We,pn as Ge,pt as Ke,q as qe,qt as Je,r as Ye,rn as Xe,rt as Ze,s as Qe,sn as $e,st as et,t as tt,tn as nt,tt as rt,u as it,un as at,v as ot,vn as st,vt as ct,wt as lt,xn as ut,xt as dt,y as ft,yn as pt,yt as mt,z as ht,zt as gt}from"./DocumentContext-C4eewS75.js";import{t as _t}from"./react-JNybMug3.js";import{n as J,r as vt,t as yt}from"./dist-DBENJeML.js";import{_ as bt,a as xt,c as St,d as Ct,f as wt,g as Tt,h as Et,i as Dt,l as Ot,m as kt,n as At,o as jt,p as Mt,r as Nt,s as Pt,t as Ft,u as It,v as Lt,y as Rt}from"./useQuery-NsPxD6kI.js";import{n as zt,t as Bt}from"./dist-COAuqNbv.js";import{t as Vt}from"./react-dom-Db7zF7dM.js";import{t as Ht}from"./compiler-runtime-dQcBxOhn.js";import{a as Ut,c as Wt,i as Gt,l as Kt,o as qt,r as Jt,s as Yt,t as Xt,u as Zt}from"./terminal-input-events-DxwonmvH.js";import{n as Qt,s as $t,t as en}from"./createLucideIcon-BUb14crZ.js";import{n as tn,r as nn,t as Y}from"./button-DHE6Sx02.js";import{c as rn,d as an,o as on,r as sn,u as cn}from"./dist-Bv-DNDka.js";import{i as ln,n as un,r as dn,t as fn}from"./tooltip-BCGL5jDF.js";import{n as pn,r as mn,t as hn}from"./collapsible-BIzY37go.js";import{a as gn,c as _n,i as vn,n as yn,o as bn,s as xn,t as Sn}from"./dialog-BLaUGJCd.js";import{$ as Cn,B as wn,C as Tn,D as En,F as Dn,I as On,K as kn,L as An,O as jn,Q as Mn,T as Nn,X as Pn,Y as Fn,_ as In,_t as Ln,at as Rn,b as zn,ct as Bn,et as Vn,f as Hn,gt as Un,ht as Wn,l as Gn,m as Kn,mt as qn,ot as Jn,q as Yn,rt as Xn,st as Zn,u as Qn,vt as $n,w as er,yt as tr}from"./CodeMirrorPropInput-BDpilu8K.js";import{t as nr}from"./checkbox-Cn88M3G6.js";import{a as rr,d as ir,i as ar,l as or,n as sr,o as cr,r as lr,s as ur,t as dr,u as fr}from"./floating-ui.dom-DhDEJ-Ns.js";import{_ as pr,a as mr,c as hr,d as gr,f as _r,g as vr,h as yr,i as br,l as xr,m as Sr,n as Cr,o as wr,p as Tr,r as Er,s as Dr,t as Or,u as kr}from"./dist-Cx2QCt5k.js";import{a as Ar,d as jr,f as Mr,i as Nr,m as Pr,n as Fr,o as Ir,p as Lr,r as Rr,s as zr,t as Br,u as Vr}from"./dropdown-menu-CcKe8PiU.js";import{t as Hr}from"./label-bn6BDr7p.js";import{n as Ur,t as Wr}from"./radio-group-DW_ypmKx.js";import{$ as Gr,B as Kr,C as qr,D as Jr,E as Yr,F as Xr,G as Zr,H as Qr,I as $r,K as ei,L as ti,M as ni,N as ri,O as ii,P as ai,Q as oi,R as si,T as ci,U as li,V as ui,W as di,X as fi,Y as pi,Z as mi,_ as hi,a as gi,c as _i,et as vi,k as yi,l as bi,m as xi,n as Si,nt as Ci,q as wi,r as Ti,rt as Ei,t as Di,tt as Oi,u as ki,v as Ai,z as ji}from"./auth-state-cache-BUoG-O4E.js";import{n as Mi,r as Ni,t as Pi}from"./toggle-group-CxrQL99E.js";import{C as Fi,D as Ii,E as Li,O as Ri,T as zi,_ as Bi,a as Vi,b as Hi,c as Ui,f as Wi,g as Gi,h as Ki,n as qi,o as Ji,r as Yi,s as Xi,t as Zi,u as Qi,v as $i,y as ea}from"./agent-visibility-Z2AQQ5Ce.js";import{a as ta,i as na,n as ra,r as ia}from"./terminal-telemetry-DxZXlrf4.js";import{A as aa,Ai as oa,An as sa,B as ca,Bi as la,Br as ua,Dn as da,Dt as fa,En as pa,Er as ma,Fa as ha,Fi as ga,Gi as _a,Gn as va,Gr as ya,Gt as ba,Hi as xa,Ht as Sa,I as Ca,Ii as wa,In as Ta,Ki as Ea,Lt as Da,Mr as Oa,N as ka,Na as Aa,Ni as ja,O as Ma,On as Na,Ot as Pa,P as Fa,Pi as Ia,Pr as La,Rn as Ra,Rr as za,Rt as Ba,Sa as Va,Sn as Ha,St as Ua,T as Wa,Ta as Ga,Tn as Ka,Un as qa,Ur as Ja,V as Ya,Vi as Xa,Vn as Za,Vt as Qa,Wi as $a,Wr as eo,Xr as to,Yi as no,Yr as ro,Yt as io,Zr as ao,_n as oo,ai as so,ar as co,br as lo,c as uo,ci as fo,dn as po,ei as mo,fr as ho,g as go,gt as _o,hi as vo,hr as yo,ii as bo,j as xo,jn as So,ki as Co,li as wo,lr as To,mi as Eo,n as Do,nr as Oo,nt as ko,oi as Ao,pr as jo,qn as Mo,qr as No,r as Po,rt as Fo,si as Io,sr as Lo,st as Ro,t as zo,un as Bo,va as Vo,vi as Ho,vn as Uo,w as Wo,wa as Go,x as Ko,zi as qo,zn as Jo,zr as Yo}from"./dist-Vm1kQiqo.js";import{t as Xo}from"./git-branch-DFJ3yJt8.js";import{a as Zo,c as Qo,i as $o,n as es,o as ts,r as ns,s as rs,t as is}from"./pending-receive-nav-store-Dqowl8LB.js";import{a as as,c as os,l as ss,o as cs,s as ls}from"./EnableSyncConfirmDialog-CLtmD52b.js";import{t as us}from"./arrow-up-right-BKliW282.js";import{r as ds,t as fs}from"./RegisteredAgentIcon--E1135hW.js";import{a as ps,c as ms,d as hs,f as gs,i as _s,l as vs,m as ys,n as bs,o as xs,p as Ss,r as Cs,s as ws,t as Ts,u as Es}from"./PropertyPanel-BwnXcEQL.js";import{t as Ds}from"./check-D3jznJmG.js";import{t as Os}from"./chevron-left-fiDaD9J4.js";import{t as ks}from"./chevron-down-0vl-mPeL.js";import{t as As}from"./chevron-right-zaL9JagC.js";import{t as js}from"./CopyButton-D0gTyMvW.js";import{a as Ms,i as Ns,n as Ps,o as Fs,s as Is}from"./prop-types-B0l6ZN6O.js";import{S as Ls,_ as Rs,a as zs,b as Bs,c as Vs,d as Hs,f as Us,g as Ws,i as Gs,l as Ks,m as qs,n as Js,o as Ys,p as Xs,r as Zs,s as Qs,u as $s,v as ec,x as tc,y as nc}from"./skill-actions-s_ATobEI.js";import{a as rc,d as ic,i as ac,l as oc,n as sc,o as cc,r as lc,s as uc,t as dc,u as fc}from"./workspace-paths-B_ozK4P-.js";import{t as pc}from"./copy-Dwat-rG5.js";import{t as mc}from"./download-wdc_OGNY.js";import{t as hc}from"./eye-CmnH89UE.js";import{t as gc}from"./folder-open-C-WgQ0Xp.js";import{i as _c,o as vc,t as yc}from"./open-managed-artifact-tab-ze9HkqWn.js";import{A as bc,C as xc,D as Sc,E as Cc,M as wc,N as Tc,T as Ec,_ as Dc,a as Oc,c as kc,d as Ac,f as jc,g as Mc,h as Nc,i as Pc,j as Fc,k as Ic,l as Lc,m as Rc,n as zc,o as Bc,p as Vc,r as Hc,s as Uc,t as Wc,u as Gc,v as Kc,w as qc,x as Jc,y as Yc}from"./terminal-launch-events-D0NkBM4g.js";import{t as Xc}from"./info-DV3bzhzI.js";import{t as Zc}from"./loader-circle-K7Xwpjny.js";import{t as Qc}from"./miss-dialog-store-81J1GwFD.js";import{n as $c,t as el}from"./panel-right-open-CBweAP43.js";import{t as tl}from"./refresh-cw-DSH9Of_0.js";import{t as nl}from"./sliders-horizontal-C9Uy29A1.js";import{a as rl,n as il,o as al}from"./follow-file-Db721Zx6.js";import{t as ol}from"./trash-2-DpF__0y9.js";import{t as sl}from"./triangle-alert-DpxK7pzx.js";import{i as cl,n as ll,r as ul,t as dl}from"./timeline-diff-store-dt1fl2gd.js";import{t as fl}from"./x-6ATUQvcC.js";import{n as X,t as pl}from"./dist-DwCd6eR-.js";import{a as ml,i as hl,n as gl,r as _l}from"./project-paths-DcJ4HDNl.js";import{t as vl}from"./input-CsXmpyZP.js";import{t as yl}from"./dist-BD3698ve.js";import{c as bl,i as xl,l as Sl,o as Cl}from"./keyboard-shortcuts-DZ9kTSZ4.js";import{t as wl}from"./parse-api-error-DucXvNZh.js";import{n as Tl,r as El,t as Dl}from"./file-tree-rename-validation-DMHa94fr.js";import{C as Ol,S as kl,_ as Al,a as jl,b as Ml,g as Nl,h as Pl,i as Fl,m as Il,n as Ll,o as Rl,r as zl,s as Bl,v as Vl,x as Hl,y as Ul}from"./navigation-targets-4J3F85tT.js";import{a as Wl,c as Gl,n as Kl,o as ql,r as Jl,s as Yl}from"./documents-events-DQ6Iario.js";import{t as Xl}from"./documents-fetch-CyAk_i-3.js";import{a as Zl,i as Ql,o as $l}from"./startup-marks-CytO17UM.js";import{a as eu,c as tu,d as nu,f as ru,i as iu,l as au,n as ou,o as su,r as cu,s as lu,t as uu,u as du}from"./doc-hash-B8kD24Kw.js";import{t as fu}from"./badge-BDZGi1Ks.js";import{c as pu,i as mu,n as hu,t as gu}from"./config-provider-CD9uoQQz.js";import{i as _u,r as vu,t as yu}from"./use-collab-url-CwAStsIj.js";import{n as bu}from"./client-version-nevRUfmx.js";import{$ as xu,Et as Su,Ft as Cu,I as wu,It as Tu,J as Eu,Lt as Du,Mt as Ou,Nt as ku,Ot as Au,Q as ju,X as Mu,Z as Nu,jt as Pu,k as Fu,kt as Iu,ot as Lu,w as Ru,wt as zu,xt as Bu}from"./dist-5kUc8Rop.js";import{n as Vu}from"./dist-DrdxKM3X.js";import{n as Hu}from"./config-context-C5AosGyi.js";import{n as Uu,t as Wu}from"./external-link-BtglP1zb.js";import{n as Gu,r as Ku,t as qu}from"./worktree-store-1tC864Do.js";import{t as Ju}from"./use-workspace-DyAcZSjY.js";import{c as Yu,i as Xu,n as Zu,r as Qu,s as $u,t as ed}from"./selection-context-DIZSdbRw.js";import{a as td,c as nd,d as rd,f as id,h as ad,i as od,l as sd,m as cd,n as ld,o as ud,s as dd,t as fd,u as pd}from"./typing-burst-detector-CmSynwPq.js";import{t as md}from"./use-installed-clis-DmVWBoog.js";import{a as hd,i as gd,n as _d,o as vd,r as yd,s as bd,t as xd}from"./panel-DLUMbyPl.js";import{t as Sd}from"./target-navigation-intent-95GTKrco.js";import{t as Cd}from"./skeleton-CA6hvjst.js";import{a as wd,n as Td,o as Ed,s as Dd}from"./lint-config-client-Bg-6mquJ.js";import{a as Od,o as kd,t as Ad}from"./agent-diff-store-D6N0WX_4.js";import{t as jd}from"./dist-BigQ5-K5.js";import{n as Md}from"./clipboard-adapter-BGIXxhKQ.js";import{a as Nd,f as Pd,i as Fd,l as Id,n as Ld,p as Rd,r as zd,s as Bd,t as Vd,u as Hd}from"./sortable.esm-DcjmFgta.js";import{i as Ud,o as Wd,r as Gd,u as Kd}from"./skills-api-CYoD9FQt.js";import{C as qd,D as Jd,E as Yd,O as Xd,S as Zd,T as Qd,_ as $d,a as ef,b as tf,c as nf,d as rf,f as af,g as of,h as sf,i as cf,k as lf,l as uf,m as df,n as ff,o as pf,p as mf,r as hf,s as gf,t as _f,u as vf,v as yf,w as bf,x as xf,y as Sf}from"./file-tree-adapter-eftmn56d.js";import{t as Cf}from"./use-live-xterm-theme-oqXGh0AM.js";import{n as wf,r as Tf}from"./agent-presence-DdJtLtJ1.js";import{o as Ef,t as Df}from"./index.esm-DRU91WyY.js";import{t as Of}from"./zod-CCGVCn6n.js";import{n as kf,t as Af}from"./mcp-consent-store-rBVJ88Wy.js";import{a as jf,t as Mf}from"./receive-store-jfaprLyZ.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 Nf(){({BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_APP_VERSION:`0.37.3`})?.VITE_OTEL_ENABLED===`true`&&n(()=>import(`./telemetry-impl-DEJSJ5rS.js`).then(e=>e.install()),__vite__mapDeps([0,1,2,3,4]),import.meta.url)}var Pf=class extends xt{#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||Ff(),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=jt({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),St.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Ff(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var If=class extends Rt{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 Pf({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=Lf(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=Lf(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=Lf(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=Lf(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){St.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=>wt(t,e))}findAll(e={}){return this.getAll().filter(t=>wt(e,t))}notify(e){St.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return St.batch(()=>Promise.all(e.map(e=>e.continue().catch(kt))))}};function Lf(e){return e.options.scope?.id}var Rf=class extends Rt{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??Ct(r,t),a=this.get(i);return a||(a=new Dt({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(){St.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=>Mt(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Mt(e,t)):t}notify(e){St.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){St.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){St.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},zf=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Rf,this.#t=e.mutationCache||new If,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=Lt.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Pt.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(Tt(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=Ot(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return St.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;St.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return St.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=St.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(kt).catch(kt)}invalidateQueries(e,t={}){return St.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=St.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(kt)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(kt)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(Tt(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(kt).catch(kt)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(kt).catch(kt)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return Pt.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(It(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{Et(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(It(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{Et(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||=Ct(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===bt&&(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()}},Bf=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}}}})),Vf=t(((e,t)=>{t.exports=Bf()})),Hf=t((e=>{var t=Vf(),n=_t(),r=Vt();function i(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 a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(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 s(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 c(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 l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function d(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=d(e),t!==null)return t;e=e.sibling}return null}var f=Object.assign,p=Symbol.for(`react.element`),m=Symbol.for(`react.transitional.element`),h=Symbol.for(`react.portal`),g=Symbol.for(`react.fragment`),_=Symbol.for(`react.strict_mode`),v=Symbol.for(`react.profiler`),y=Symbol.for(`react.consumer`),b=Symbol.for(`react.context`),x=Symbol.for(`react.forward_ref`),S=Symbol.for(`react.suspense`),C=Symbol.for(`react.suspense_list`),w=Symbol.for(`react.memo`),T=Symbol.for(`react.lazy`),E=Symbol.for(`react.activity`),D=Symbol.for(`react.memo_cache_sentinel`),O=Symbol.iterator;function k(e){return typeof e!=`object`||!e?null:(e=O&&e[O]||e[`@@iterator`],typeof e==`function`?e:null)}var A=Symbol.for(`react.client.reference`);function j(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===A?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case g:return`Fragment`;case v:return`Profiler`;case _:return`StrictMode`;case S:return`Suspense`;case C:return`SuspenseList`;case E:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case h:return`Portal`;case b:return e.displayName||`Context`;case y:return(e._context.displayName||`Context`)+`.Consumer`;case x:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case w:return t=e.displayName||null,t===null?j(e.type)||`Memo`:t;case T:t=e._payload,e=e._init;try{return j(e(t))}catch{}}return null}var M=Array.isArray,N=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,P=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F={pending:!1,data:null,method:null,action:null},I=[],L=-1;function R(e){return{current:e}}function z(e){0>L||(e.current=I[L],I[L]=null,L--)}function B(e,t){L++,I[L]=e.current,e.current=t}var V=R(null),H=R(null),U=R(null),W=R(null);function ee(e,t){switch(B(U,t),B(H,e),B(V,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}}z(V),B(V,e)}function G(){z(V),z(H),z(U)}function K(e){e.memoizedState!==null&&B(W,e);var t=V.current,n=Wd(t,e.type);t!==n&&(B(H,e),B(V,n))}function te(e){H.current===e&&(z(V),z(H)),W.current===e&&(z(W),Qf._currentValue=F)}var ne,re;function ie(e){if(ne===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ne=t&&t[1]||``,re=-1<e.stack.indexOf(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./telemetry-impl-DEJSJ5rS.js","./chunk-DseTPa7n.js","./preload-helper-2ej06EnG.js","./trace-api-CXljsYUC.js","./propagation-api-yIIm019t.js","./ReportBugDialogBody-hPmCfQyc.js","./dist-Vm1kQiqo.js","./lib-9ZUh4rh4.js","./markdownit-BEubyjFu.js","./w3c-keyname-Daddi42S.js","./dist-DBENJeML.js","./jsx-runtime-DyiINK0N.js","./react-JNybMug3.js","./checkbox-Cn88M3G6.js","./dist-93kZXTH1.js","./floating-ui.dom-DhDEJ-Ns.js","./dist-Bv-DNDka.js","./createLucideIcon-BUb14crZ.js","./bundle-mjs-Dy8bHgkj.js","./react-dom-Db7zF7dM.js","./dist-xZVtOT7r.js","./check-D3jznJmG.js","./compiler-runtime-dQcBxOhn.js","./dialog-BLaUGJCd.js","./es2015-D5U2f808.js","./button-DHE6Sx02.js","./x-6ATUQvcC.js","./CopyButton-D0gTyMvW.js","./tooltip-BCGL5jDF.js","./copy-Dwat-rG5.js","./loader-circle-K7Xwpjny.js","./triangle-alert-DpxK7pzx.js","./badge-BDZGi1Ks.js","./input-CsXmpyZP.js","./textarea-DwJR-19i.js","./external-link-BtglP1zb.js","./clipboard-adapter-BGIXxhKQ.js","./GraphPanel-BjCltqW1.js","./dist-BD3698ve.js","./toggle-group-CxrQL99E.js","./dist-B4uQVk5s.js","./dist-BJxDYUHt.js","./useQuery-NsPxD6kI.js","./min-C03Z0UNc.js","./src-DlwJ21NB.js","./colors-N4wXgevD.js","./ordinal-DC5m951M.js","./init-BZfMkAqI.js","./isObject-ClHKc-zZ.js","./now-LAZzaJBH.js","./arrow-up-right-BKliW282.js","./prop-types-B0l6ZN6O.js","./navigation-targets-4J3F85tT.js","./doc-hash-B8kD24Kw.js","./documents-events-DQ6Iario.js","./documents-fetch-CyAk_i-3.js","./parse-api-error-DucXvNZh.js","./startup-marks-CytO17UM.js","./dist-COAuqNbv.js","./target-navigation-intent-95GTKrco.js","./panel-DLUMbyPl.js","./ActivityModeContent-BQeZuILy.js","./CodeMirrorPropInput-BDpilu8K.js","./dist-635PXtcP.js","./dist-5kUc8Rop.js","./dist-n-Hi6NdA.js","./dist-C5oOOujV.js","./dist-uVOKoIoH.js","./dist-DUnAX2Ky.js","./dist-CcNiwixP.js","./dist-DrdxKM3X.js","./dist-BgCLeN3Q.js","./stex-Hrt2qQag.js","./config-provider-CD9uoQQz.js","./client-version-nevRUfmx.js","./use-apply-config-color-theme-DBdIMwiU.js","./config-context-C5AosGyi.js","./folder-open-C-WgQ0Xp.js","./trash-2-DpF__0y9.js","./DocumentContext-C4eewS75.js","./collapsible-BIzY37go.js","./terminal-input-events-DxwonmvH.js","./git-branch-DFJ3yJt8.js","./chevron-down-0vl-mPeL.js","./chevron-right-zaL9JagC.js","./workspace-paths-B_ozK4P-.js","./eye-CmnH89UE.js","./info-DV3bzhzI.js","./paperclip-DF10JkTg.js","./sliders-horizontal-C9Uy29A1.js","./dist-DwCd6eR-.js","./file-tree-rename-validation-DMHa94fr.js","./use-collab-url-CwAStsIj.js","./DocumentContext-B0sQn39F.css","./timeline-diff-store-dt1fl2gd.js","./agent-diff-store-D6N0WX_4.js","./cursor-AolWKuZw.js","./copilot-Be7YOjJF.js","./use-activity-panel-BsQxJQD5.js","./agent-presence-DdJtLtJ1.js","./lru-string-cache-D19dwCKJ.js","./dist-C5VV4AJh.js","./dist-BlUN9R-p.js","./SettingsDialogBody-0nrbk-EZ.js","./sortable.esm-DcjmFgta.js","./dropdown-menu-CcKe8PiU.js","./dist-Cx2QCt5k.js","./label-bn6BDr7p.js","./radio-group-DW_ypmKx.js","./auth-state-cache-BUoG-O4E.js","./EnableSyncConfirmDialog-CLtmD52b.js","./skill-actions-s_ATobEI.js","./RegisteredAgentIcon--E1135hW.js","./refresh-cw-DSH9Of_0.js","./agent-visibility-Z2AQQ5Ce.js","./keyboard-shortcuts-DZ9kTSZ4.js","./skills-api-CYoD9FQt.js","./use-workspace-DyAcZSjY.js","./download-wdc_OGNY.js","./open-managed-artifact-tab-ze9HkqWn.js","./skeleton-CA6hvjst.js","./lint-config-client-Bg-6mquJ.js","./index.esm-DRU91WyY.js","./form-J8CRFj8p.js","./use-terminal-enabled-jZPkRHXb.js","./terminal-telemetry-DxZXlrf4.js","./ManagedArtifactProperties-DroX_qbT.js","./PropertyPanel-CjAWmcMG.js","./format-Dn5VT_ew.js","./selection-context-DIZSdbRw.js","./MermaidDocEditor-BgRVEFx4.js","./dist-BigQ5-K5.js","./src-7sFVeKSR.js","./SourceEditor-DYIbaxIY.js","./typing-burst-detector-CmSynwPq.js","./wrench-BDWKT3wQ.js","./SkillEditorActions-BEtnBlep.js","./TimelineDiffPane-BEQVtkis.js","./use-timeline-entry-diff-B9JmhzBH.js","./libesm-BUX1Jc4h.js","./panel-right-open-CBweAP43.js","./AgentDiffPane-QEI9IvTx.js","./FeedbackForm-DH4DaXLD.js","./zod-CCGVCn6n.js","./AppMenubar-DqlpmcU7.js","./AgentThreadClientBinder-poPjsQXP.js","./thread-client-DH1Xs0By.js","./TerminalSessionsHost-BjojawIi.js","./terminal-launch-events-D0NkBM4g.js","./McpConsentDialogBody-B0VkhB1e.js","./mcp-consent-store-rBVJ88Wy.js","./ShareBranchSwitchDialog-GXTPAgND.js","./miss-dialog-store-81J1GwFD.js","./share-metadata-rows-Do2le589.js","./desktop-bridge-types-Ij8BA7el.js","./receive-store-jfaprLyZ.js","./worktree-store-1tC864Do.js","./ShareReceiveMissDialog-CHR2clGS.js","./pending-receive-nav-store-Dqowl8LB.js","./ConsentDialogBody-D9xWEY09.js","./project-paths-DcJ4HDNl.js","./ShareReceiveDialog-IVAS4xf8.js","./TerminalWindowApp-jhlpCVAO.js","./use-live-xterm-theme-oqXGh0AM.js","./use-installed-clis-DmVWBoog.js","./telemetry-startup-Bvr_iW-w.js"])))=>i.map(i=>d[i]);
2
+ import{i as e,t}from"./chunk-DseTPa7n.js";import{t as n}from"./preload-helper-2ej06EnG.js";import{t as r}from"./jsx-runtime-DyiINK0N.js";import{$ as i,$t as a,A as o,At as s,B as c,Bt as l,Ct as u,D as d,Dt as f,Et as p,F as m,Ft as h,G as g,Gt as _,H as v,Ht as y,I as b,It as x,J as S,Jt as C,K as w,Kt as T,L as E,Lt as D,Mt as O,N as k,Nt as A,O as j,Ot as M,P as N,Pt as P,Q as F,R as I,Rt as L,St as R,Tt as z,U as B,Ut as V,V as H,Vt as U,W,Wt as ee,X as G,Xt as K,Y as te,Yt as ne,Z as re,Zt as ie,_t as ae,a as oe,an as se,at as ce,bn as le,bt as ue,c as de,cn as fe,ct as pe,d as q,dn as me,en as he,et as ge,f as _e,fn as ve,ft as ye,g as be,gn as xe,gt as Se,h as Ce,ht as we,i as Te,in as Ee,it as De,j as Oe,jt as ke,k as Ae,kt as je,l as Me,ln as Ne,lt as Pe,m as Fe,mn as Ie,mt as Le,n as Re,nn as ze,nt as Be,o as Ve,on as He,ot as Ue,p as We,pn as Ge,pt as Ke,q as qe,qt as Je,r as Ye,rn as Xe,rt as Ze,s as Qe,sn as $e,st as et,t as tt,tn as nt,tt as rt,u as it,un as at,v as ot,vn as st,vt as ct,wt as lt,xn as ut,xt as dt,y as ft,yn as pt,yt as mt,z as ht,zt as gt}from"./DocumentContext-C4eewS75.js";import{t as _t}from"./react-JNybMug3.js";import{n as J,r as vt,t as yt}from"./dist-DBENJeML.js";import{_ as bt,a as xt,c as St,d as Ct,f as wt,g as Tt,h as Et,i as Dt,l as Ot,m as kt,n as At,o as jt,p as Mt,r as Nt,s as Pt,t as Ft,u as It,v as Lt,y as Rt}from"./useQuery-NsPxD6kI.js";import{n as zt,t as Bt}from"./dist-COAuqNbv.js";import{t as Vt}from"./react-dom-Db7zF7dM.js";import{t as Ht}from"./compiler-runtime-dQcBxOhn.js";import{a as Ut,c as Wt,i as Gt,l as Kt,o as qt,r as Jt,s as Yt,t as Xt,u as Zt}from"./terminal-input-events-DxwonmvH.js";import{n as Qt,s as $t,t as en}from"./createLucideIcon-BUb14crZ.js";import{n as tn,r as nn,t as Y}from"./button-DHE6Sx02.js";import{c as rn,d as an,o as on,r as sn,u as cn}from"./dist-Bv-DNDka.js";import{i as ln,n as un,r as dn,t as fn}from"./tooltip-BCGL5jDF.js";import{n as pn,r as mn,t as hn}from"./collapsible-BIzY37go.js";import{a as gn,c as _n,i as vn,n as yn,o as bn,s as xn,t as Sn}from"./dialog-BLaUGJCd.js";import{$ as Cn,B as wn,C as Tn,D as En,F as Dn,I as On,K as kn,L as An,O as jn,Q as Mn,T as Nn,X as Pn,Y as Fn,_ as In,_t as Ln,at as Rn,b as zn,ct as Bn,et as Vn,f as Hn,gt as Un,ht as Wn,l as Gn,m as Kn,mt as qn,ot as Jn,q as Yn,rt as Xn,st as Zn,u as Qn,vt as $n,w as er,yt as tr}from"./CodeMirrorPropInput-BDpilu8K.js";import{t as nr}from"./checkbox-Cn88M3G6.js";import{a as rr,d as ir,i as ar,l as or,n as sr,o as cr,r as lr,s as ur,t as dr,u as fr}from"./floating-ui.dom-DhDEJ-Ns.js";import{_ as pr,a as mr,c as hr,d as gr,f as _r,g as vr,h as yr,i as br,l as xr,m as Sr,n as Cr,o as wr,p as Tr,r as Er,s as Dr,t as Or,u as kr}from"./dist-Cx2QCt5k.js";import{a as Ar,d as jr,f as Mr,i as Nr,m as Pr,n as Fr,o as Ir,p as Lr,r as Rr,s as zr,t as Br,u as Vr}from"./dropdown-menu-CcKe8PiU.js";import{t as Hr}from"./label-bn6BDr7p.js";import{n as Ur,t as Wr}from"./radio-group-DW_ypmKx.js";import{$ as Gr,B as Kr,C as qr,D as Jr,E as Yr,F as Xr,G as Zr,H as Qr,I as $r,K as ei,L as ti,M as ni,N as ri,O as ii,P as ai,Q as oi,R as si,T as ci,U as li,V as ui,W as di,X as fi,Y as pi,Z as mi,_ as hi,a as gi,c as _i,et as vi,k as yi,l as bi,m as xi,n as Si,nt as Ci,q as wi,r as Ti,rt as Ei,t as Di,tt as Oi,u as ki,v as Ai,z as ji}from"./auth-state-cache-BUoG-O4E.js";import{n as Mi,r as Ni,t as Pi}from"./toggle-group-CxrQL99E.js";import{C as Fi,D as Ii,E as Li,O as Ri,T as zi,_ as Bi,a as Vi,b as Hi,c as Ui,f as Wi,g as Gi,h as Ki,n as qi,o as Ji,r as Yi,s as Xi,t as Zi,u as Qi,v as $i,y as ea}from"./agent-visibility-Z2AQQ5Ce.js";import{a as ta,i as na,n as ra,r as ia}from"./terminal-telemetry-DxZXlrf4.js";import{A as aa,Ai as oa,An as sa,B as ca,Bi as la,Br as ua,Dn as da,Dt as fa,En as pa,Er as ma,Fa as ha,Fi as ga,Gi as _a,Gn as va,Gr as ya,Gt as ba,Hi as xa,Ht as Sa,I as Ca,Ii as wa,In as Ta,Ki as Ea,Lt as Da,Mr as Oa,N as ka,Na as Aa,Ni as ja,O as Ma,On as Na,Ot as Pa,P as Fa,Pi as Ia,Pr as La,Rn as Ra,Rr as za,Rt as Ba,Sa as Va,Sn as Ha,St as Ua,T as Wa,Ta as Ga,Tn as Ka,Un as qa,Ur as Ja,V as Ya,Vi as Xa,Vn as Za,Vt as Qa,Wi as $a,Wr as eo,Xr as to,Yi as no,Yr as ro,Yt as io,Zr as ao,_n as oo,ai as so,ar as co,br as lo,c as uo,ci as fo,dn as po,ei as mo,fr as ho,g as go,gt as _o,hi as vo,hr as yo,ii as bo,j as xo,jn as So,ki as Co,li as wo,lr as To,mi as Eo,n as Do,nr as Oo,nt as ko,oi as Ao,pr as jo,qn as Mo,qr as No,r as Po,rt as Fo,si as Io,sr as Lo,st as Ro,t as zo,un as Bo,va as Vo,vi as Ho,vn as Uo,w as Wo,wa as Go,x as Ko,zi as qo,zn as Jo,zr as Yo}from"./dist-Vm1kQiqo.js";import{t as Xo}from"./git-branch-DFJ3yJt8.js";import{a as Zo,c as Qo,i as $o,n as es,o as ts,r as ns,s as rs,t as is}from"./pending-receive-nav-store-Dqowl8LB.js";import{a as as,c as os,l as ss,o as cs,s as ls}from"./EnableSyncConfirmDialog-CLtmD52b.js";import{t as us}from"./arrow-up-right-BKliW282.js";import{r as ds,t as fs}from"./RegisteredAgentIcon--E1135hW.js";import{a as ps,c as ms,d as hs,f as gs,i as _s,l as vs,m as ys,n as bs,o as xs,p as Ss,r as Cs,s as ws,t as Ts,u as Es}from"./PropertyPanel-CjAWmcMG.js";import{t as Ds}from"./check-D3jznJmG.js";import{t as Os}from"./chevron-left-fiDaD9J4.js";import{t as ks}from"./chevron-down-0vl-mPeL.js";import{t as As}from"./chevron-right-zaL9JagC.js";import{t as js}from"./CopyButton-D0gTyMvW.js";import{a as Ms,i as Ns,n as Ps,o as Fs,s as Is}from"./prop-types-B0l6ZN6O.js";import{S as Ls,_ as Rs,a as zs,b as Bs,c as Vs,d as Hs,f as Us,g as Ws,i as Gs,l as Ks,m as qs,n as Js,o as Ys,p as Xs,r as Zs,s as Qs,u as $s,v as ec,x as tc,y as nc}from"./skill-actions-s_ATobEI.js";import{a as rc,d as ic,i as ac,l as oc,n as sc,o as cc,r as lc,s as uc,t as dc,u as fc}from"./workspace-paths-B_ozK4P-.js";import{t as pc}from"./copy-Dwat-rG5.js";import{t as mc}from"./download-wdc_OGNY.js";import{t as hc}from"./eye-CmnH89UE.js";import{t as gc}from"./folder-open-C-WgQ0Xp.js";import{i as _c,o as vc,t as yc}from"./open-managed-artifact-tab-ze9HkqWn.js";import{A as bc,C as xc,D as Sc,E as Cc,M as wc,N as Tc,T as Ec,_ as Dc,a as Oc,c as kc,d as Ac,f as jc,g as Mc,h as Nc,i as Pc,j as Fc,k as Ic,l as Lc,m as Rc,n as zc,o as Bc,p as Vc,r as Hc,s as Uc,t as Wc,u as Gc,v as Kc,w as qc,x as Jc,y as Yc}from"./terminal-launch-events-D0NkBM4g.js";import{t as Xc}from"./info-DV3bzhzI.js";import{t as Zc}from"./loader-circle-K7Xwpjny.js";import{t as Qc}from"./miss-dialog-store-81J1GwFD.js";import{n as $c,t as el}from"./panel-right-open-CBweAP43.js";import{t as tl}from"./refresh-cw-DSH9Of_0.js";import{t as nl}from"./sliders-horizontal-C9Uy29A1.js";import{a as rl,n as il,o as al}from"./follow-file-Db721Zx6.js";import{t as ol}from"./trash-2-DpF__0y9.js";import{t as sl}from"./triangle-alert-DpxK7pzx.js";import{i as cl,n as ll,r as ul,t as dl}from"./timeline-diff-store-dt1fl2gd.js";import{t as fl}from"./x-6ATUQvcC.js";import{n as X,t as pl}from"./dist-DwCd6eR-.js";import{a as ml,i as hl,n as gl,r as _l}from"./project-paths-DcJ4HDNl.js";import{t as vl}from"./input-CsXmpyZP.js";import{t as yl}from"./dist-BD3698ve.js";import{c as bl,i as xl,l as Sl,o as Cl}from"./keyboard-shortcuts-DZ9kTSZ4.js";import{t as wl}from"./parse-api-error-DucXvNZh.js";import{n as Tl,r as El,t as Dl}from"./file-tree-rename-validation-DMHa94fr.js";import{C as Ol,S as kl,_ as Al,a as jl,b as Ml,g as Nl,h as Pl,i as Fl,m as Il,n as Ll,o as Rl,r as zl,s as Bl,v as Vl,x as Hl,y as Ul}from"./navigation-targets-4J3F85tT.js";import{a as Wl,c as Gl,n as Kl,o as ql,r as Jl,s as Yl}from"./documents-events-DQ6Iario.js";import{t as Xl}from"./documents-fetch-CyAk_i-3.js";import{a as Zl,i as Ql,o as $l}from"./startup-marks-CytO17UM.js";import{a as eu,c as tu,d as nu,f as ru,i as iu,l as au,n as ou,o as su,r as cu,s as lu,t as uu,u as du}from"./doc-hash-B8kD24Kw.js";import{t as fu}from"./badge-BDZGi1Ks.js";import{c as pu,i as mu,n as hu,t as gu}from"./config-provider-CD9uoQQz.js";import{i as _u,r as vu,t as yu}from"./use-collab-url-CwAStsIj.js";import{n as bu}from"./client-version-nevRUfmx.js";import{$ as xu,Et as Su,Ft as Cu,I as wu,It as Tu,J as Eu,Lt as Du,Mt as Ou,Nt as ku,Ot as Au,Q as ju,X as Mu,Z as Nu,jt as Pu,k as Fu,kt as Iu,ot as Lu,w as Ru,wt as zu,xt as Bu}from"./dist-5kUc8Rop.js";import{n as Vu}from"./dist-DrdxKM3X.js";import{n as Hu}from"./config-context-C5AosGyi.js";import{n as Uu,t as Wu}from"./external-link-BtglP1zb.js";import{n as Gu,r as Ku,t as qu}from"./worktree-store-1tC864Do.js";import{t as Ju}from"./use-workspace-DyAcZSjY.js";import{c as Yu,i as Xu,n as Zu,r as Qu,s as $u,t as ed}from"./selection-context-DIZSdbRw.js";import{a as td,c as nd,d as rd,f as id,h as ad,i as od,l as sd,m as cd,n as ld,o as ud,s as dd,t as fd,u as pd}from"./typing-burst-detector-CmSynwPq.js";import{t as md}from"./use-installed-clis-DmVWBoog.js";import{a as hd,i as gd,n as _d,o as vd,r as yd,s as bd,t as xd}from"./panel-DLUMbyPl.js";import{t as Sd}from"./target-navigation-intent-95GTKrco.js";import{t as Cd}from"./skeleton-CA6hvjst.js";import{a as wd,n as Td,o as Ed,s as Dd}from"./lint-config-client-Bg-6mquJ.js";import{a as Od,o as kd,t as Ad}from"./agent-diff-store-D6N0WX_4.js";import{t as jd}from"./dist-BigQ5-K5.js";import{n as Md}from"./clipboard-adapter-BGIXxhKQ.js";import{a as Nd,f as Pd,i as Fd,l as Id,n as Ld,p as Rd,r as zd,s as Bd,t as Vd,u as Hd}from"./sortable.esm-DcjmFgta.js";import{i as Ud,o as Wd,r as Gd,u as Kd}from"./skills-api-CYoD9FQt.js";import{C as qd,D as Jd,E as Yd,O as Xd,S as Zd,T as Qd,_ as $d,a as ef,b as tf,c as nf,d as rf,f as af,g as of,h as sf,i as cf,k as lf,l as uf,m as df,n as ff,o as pf,p as mf,r as hf,s as gf,t as _f,u as vf,v as yf,w as bf,x as xf,y as Sf}from"./file-tree-adapter-eftmn56d.js";import{t as Cf}from"./use-live-xterm-theme-oqXGh0AM.js";import{n as wf,r as Tf}from"./agent-presence-DdJtLtJ1.js";import{o as Ef,t as Df}from"./index.esm-DRU91WyY.js";import{t as Of}from"./zod-CCGVCn6n.js";import{n as kf,t as Af}from"./mcp-consent-store-rBVJ88Wy.js";import{a as jf,t as Mf}from"./receive-store-jfaprLyZ.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 Nf(){({BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_APP_VERSION:`0.37.3`})?.VITE_OTEL_ENABLED===`true`&&n(()=>import(`./telemetry-impl-DEJSJ5rS.js`).then(e=>e.install()),__vite__mapDeps([0,1,2,3,4]),import.meta.url)}var Pf=class extends xt{#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||Ff(),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=jt({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),St.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Ff(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var If=class extends Rt{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 Pf({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=Lf(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=Lf(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=Lf(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=Lf(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){St.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=>wt(t,e))}findAll(e={}){return this.getAll().filter(t=>wt(e,t))}notify(e){St.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return St.batch(()=>Promise.all(e.map(e=>e.continue().catch(kt))))}};function Lf(e){return e.options.scope?.id}var Rf=class extends Rt{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??Ct(r,t),a=this.get(i);return a||(a=new Dt({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(){St.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=>Mt(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Mt(e,t)):t}notify(e){St.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){St.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){St.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},zf=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Rf,this.#t=e.mutationCache||new If,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=Lt.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Pt.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(Tt(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=Ot(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return St.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;St.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return St.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=St.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(kt).catch(kt)}invalidateQueries(e,t={}){return St.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=St.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(kt)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(kt)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(Tt(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(kt).catch(kt)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(kt).catch(kt)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return Pt.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(It(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{Et(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(It(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{Et(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||=Ct(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===bt&&(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()}},Bf=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}}}})),Vf=t(((e,t)=>{t.exports=Bf()})),Hf=t((e=>{var t=Vf(),n=_t(),r=Vt();function i(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 a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(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 s(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 c(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 l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function d(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=d(e),t!==null)return t;e=e.sibling}return null}var f=Object.assign,p=Symbol.for(`react.element`),m=Symbol.for(`react.transitional.element`),h=Symbol.for(`react.portal`),g=Symbol.for(`react.fragment`),_=Symbol.for(`react.strict_mode`),v=Symbol.for(`react.profiler`),y=Symbol.for(`react.consumer`),b=Symbol.for(`react.context`),x=Symbol.for(`react.forward_ref`),S=Symbol.for(`react.suspense`),C=Symbol.for(`react.suspense_list`),w=Symbol.for(`react.memo`),T=Symbol.for(`react.lazy`),E=Symbol.for(`react.activity`),D=Symbol.for(`react.memo_cache_sentinel`),O=Symbol.iterator;function k(e){return typeof e!=`object`||!e?null:(e=O&&e[O]||e[`@@iterator`],typeof e==`function`?e:null)}var A=Symbol.for(`react.client.reference`);function j(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===A?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case g:return`Fragment`;case v:return`Profiler`;case _:return`StrictMode`;case S:return`Suspense`;case C:return`SuspenseList`;case E:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case h:return`Portal`;case b:return e.displayName||`Context`;case y:return(e._context.displayName||`Context`)+`.Consumer`;case x:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case w:return t=e.displayName||null,t===null?j(e.type)||`Memo`:t;case T:t=e._payload,e=e._init;try{return j(e(t))}catch{}}return null}var M=Array.isArray,N=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,P=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F={pending:!1,data:null,method:null,action:null},I=[],L=-1;function R(e){return{current:e}}function z(e){0>L||(e.current=I[L],I[L]=null,L--)}function B(e,t){L++,I[L]=e.current,e.current=t}var V=R(null),H=R(null),U=R(null),W=R(null);function ee(e,t){switch(B(U,t),B(H,e),B(V,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}}z(V),B(V,e)}function G(){z(V),z(H),z(U)}function K(e){e.memoizedState!==null&&B(W,e);var t=V.current,n=Wd(t,e.type);t!==n&&(B(H,e),B(V,n))}function te(e){H.current===e&&(z(V),z(H)),W.current===e&&(z(W),Qf._currentValue=F)}var ne,re;function ie(e){if(ne===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ne=t&&t[1]||``,re=-1<e.stack.indexOf(`
3
3
  at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
4
4
  `+ne+e+re}var ae=!1;function oe(e,t){if(!e||ae)return``;ae=!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(`
@@ -11,14 +11,14 @@ Error generating stack: `+e.message+`
11
11
  `),r=0;for(let e=0;e<t.line&&e<n.length;e+=1)r+=n[e].length+1;let i=n[Math.min(t.line,n.length-1)]?.length??0;return r+Math.min(Math.max(t.character,0),i)}function Xy(e){return e.flatMap(e=>e.fixes??[])}function Zy(e,t){if(t.length===0)return!1;let n=e.document.getText(`source`),r=n.toString(),i=t.map(e=>({from:Yy(r,e.range.start),to:Yy(r,e.range.end),insert:e.newText})).sort((e,t)=>t.to-e.to||t.from-e.from||e.insert.localeCompare(t.insert));return e.document.transact(()=>{let e=1/0,t;for(let r of i){let i=t!==void 0&&r.from===t.from&&r.to===t.to&&r.insert===t.insert;t=r,!(i||r.to>e)&&(r.to>r.from&&n.delete(r.from,r.to-r.from),r.insert.length>0&&n.insert(r.from,r.insert),e=r.from)}},Jy),typeof window<`u`&&window.dispatchEvent(new CustomEvent(qy)),!0}var Qy=300;function $y(e,t){let n=(0,$.c)(7),r;n[0]===t?r=n[1]:(r=t?.enabled?JSON.stringify(t):null,n[0]=t,n[1]=r);let i=r,a;n[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=[],n[2]=a):a=n[2];let[o,s]=(0,Q.useState)(a),c,l;return n[3]!==i||n[4]!==e?(c=()=>{if(!e||i===null){s(eb);return}let t=JSON.parse(i),n=e.document.getText(`source`),r=null,a=!1,o=e.configuration.name,c=()=>void lo(n.toString(),t,o).then(e=>{a||s(e)}).catch(e=>{a||console.warn(`[lint] lintDocument failed`,e)}),l=()=>{r&&clearTimeout(r),r=setTimeout(c,Qy)};return c(),n.observe(l),()=>{a=!0,r&&clearTimeout(r),n.unobserve(l)}},l=[e,i],n[3]=i,n[4]=e,n[5]=c,n[6]=l):(c=n[5],l=n[6]),(0,Q.useEffect)(c,l),o}function eb(e){return e.length===0?e:[]}var tb=[{id:`outline`,icon:uh},{id:`links`,icon:He},{id:`graph`,icon:mh},{id:`timeline`,icon:zm},{id:`problems`,icon:sl}];function nb(e){return e===`outline`?yl._({id:`dD7NPy`}):e===`links`?yl._({id:`Rj01Fz`}):e===`graph`?yl._({id:`x2fr_j`}):e===`problems`?yl._({id:`OXdGnd`}):yl._({id:`cklVjM`})}function rb(){return n(()=>import(`./GraphPanel-BjCltqW1.js`),__vite__mapDeps([37,1,6,2,3,7,8,9,38,10,11,12,17,18,39,16,19,40,41,25,22,28,14,15,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,31,58,59,60,35]),import.meta.url)}var ib=(0,Q.lazy)(async()=>({default:(await rb()).GraphPanel})),ab=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-BQeZuILy.js`),__vite__mapDeps([61,1,62,2,63,64,9,65,66,67,68,69,70,71,72,15,6,3,7,8,73,58,12,22,11,74,75,76,38,10,17,18,25,77,78,31,19,52,53,35,55,79,14,16,4,80,40,23,24,26,81,28,20,82,21,83,84,27,29,51,54,56,57,85,86,87,30,88,89,90,91,32,33,92,93,94,95,96,97,98,99,100]),import.meta.url)).ActivityModeContent}));function ob(e){let t=(0,$.c)(32),{docName:n,isSourceMode:r,activeTab:i,onActiveTabChange:a,mode:o}=e,{_:s}=vt(),{activeProvider:c,activeDocName:l}=Re(),{data:u}=Ed(n),d=l===n?c:null,f=$y(d,u?.effective??null),p;t[0]===d?p=t[1]:(p=e=>{d!==null&&e.fixes&&e.fixes.length>0&&Zy(d,e.fixes)},t[0]=d,t[1]=p);let m=p,h;t[2]!==f||t[3]!==d?(h=()=>{d!==null&&Zy(d,Xy(f))},t[2]=f,t[3]=d,t[4]=h):h=t[4];let g=h,_=Vs(),v;t[5]!==n||t[6]!==d?(v=e=>{if(d===null)return;let t=d.document.getText(`source`).toString().split(`
12
12
  `)[e.range.start.line];Xt(py(n,e,t))},t[5]=n,t[6]=d,t[7]=v):v=t[7];let y=v,b=iv(),x,S,C;if(t[8]!==s||t[9]!==i||t[10]!==f||t[11]!==o||t[12]!==a||t[13]!==b){let e=b?tb.filter(sb):tb;x=e.some(e=>e.id===i)?i:`outline`,S=o===`doc`&&e.length>1,C=S?(0,Z.jsx)(`div`,{className:`flex flex-row items-center justify-center gap-3 p-2`,children:(0,Z.jsx)(Pi,{type:`single`,variant:`outline`,value:x,onValueChange:e=>{e&&a(e)},"aria-label":s({id:`SrOuyg`}),children:e.map(e=>{let{id:t,icon:n}=e,r=nb(t),i=t===`problems`&&f.length>0;return(0,Z.jsxs)(fn,{children:[(0,Z.jsx)(Mi,{value:t,role:`tab`,id:`tab-${t}`,"aria-controls":`panel-${t}`,"aria-label":i?s({id:`2m_bmh`,values:{0:f.length,label:r}}):r,asChild:!0,children:(0,Z.jsxs)(ln,{className:`relative`,children:[(0,Z.jsx)(n,{}),i&&(0,Z.jsx)(fu,{variant:`destructive`,"aria-hidden":`true`,className:`absolute -right-1.5 -top-1.5 h-4 min-w-4 rounded-full px-1 text-[10px] leading-none`,children:f.length>99?`99+`:f.length})]})}),(0,Z.jsx)(un,{side:`bottom`,children:r})]},t)})})}):null,t[8]=s,t[9]=i,t[10]=f,t[11]=o,t[12]=a,t[13]=b,t[14]=x,t[15]=S,t[16]=C}else x=t[14],S=t[15],C=t[16];let w;t[17]!==f||t[18]!==n||t[19]!==x||t[20]!==y||t[21]!==m||t[22]!==g||t[23]!==r||t[24]!==d||t[25]!==o||t[26]!==S||t[27]!==_?(w=o===`doc`?(0,Z.jsxs)(`div`,{...S?{role:`tabpanel`,id:`panel-${x}`,"aria-labelledby":`tab-${x}`}:{},className:`min-h-0 flex-1`,children:[x===`outline`&&(0,Z.jsx)(rd,{docName:n,isSourceMode:r}),x===`links`&&(0,Z.jsx)(Ey,{docName:n}),x===`graph`&&(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`-lCAuQ`})}),children:(0,Z.jsx)(ib,{activeDocName:n})}),x===`timeline`&&(0,Z.jsx)(Wy,{docName:n}),x===`problems`&&(0,Z.jsx)(sd,{docName:n,diagnostics:f,onFix:d===null?void 0:m,onFixAll:d===null?void 0:g,onAskAi:d!==null&&_!==null?y:void 0})]}):(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(`div`,{role:`status`,"aria-busy":`true`,className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`ONPvOb`})}),children:(0,Z.jsx)(ab,{})})}),t[17]=f,t[18]=n,t[19]=x,t[20]=y,t[21]=m,t[22]=g,t[23]=r,t[24]=d,t[25]=o,t[26]=S,t[27]=_,t[28]=w):w=t[28];let T;return t[29]!==C||t[30]!==w?(T=(0,Z.jsxs)(Z.Fragment,{children:[C,w]}),t[29]=C,t[30]=w,t[31]=T):T=t[31],T}function sb(e){return e.id===`outline`||e.id===`problems`}function cb(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function lb(e,t){let n=getComputedStyle(e.ownerDocument.documentElement);return t*parseFloat(n.fontSize)}function ub(e){return e/100*window.innerHeight}function db(e){return e/100*window.innerWidth}function fb(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 pb({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=fb(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=lb(t,i);break;case`em`:r=cb(t,i);break;case`vh`:r=ub(i);break;case`vw`:r=db(i);break}return r}function mb(e){return parseFloat(e.toFixed(3))}function hb({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 gb(e){let{panels:t}=e,n=hb({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=mb(pb({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=mb(pb({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=mb(pb({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=mb(pb({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 _b(e,t=`Assertion error`){if(!e)throw Error(t)}function vb(e,t){return Array.from(t).sort(e===`horizontal`?yb:bb)}function yb(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function bb(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function xb(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function Sb(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 Cb({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}=Sb(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return _b(i,`No rect found`),i}var wb;function Tb(){return wb===void 0&&(wb=typeof matchMedia==`function`?!!matchMedia(`(pointer:coarse)`).matches:!1),wb}function Eb(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=vb(n,Array.from(t.children).filter(xb).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,Cb({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=Tb()?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:hb({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 Db=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)}}},Ob={cursorFlags:0,state:`inactive`},kb=new Db;function Ab(){return Ob}function jb(e){return kb.addListener(`change`,e)}function Mb(e){let t=Ob,n={...Ob};n.cursorFlags=e,Ob=n,kb.emit(`change`,{prev:t,next:n})}function Nb(e){let t=Ob;Ob=e,kb.emit(`change`,{prev:t,next:e})}var Pb=e=>e,Fb=()=>{},Ib=1,Lb=2,Rb=4,zb=8,Bb=3,Vb=12,Hb;function Ub(){return Hb===void 0&&(Hb=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(Hb=!0)),Hb}function Wb({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&&Ub()){let t=(e&Ib)!==0,n=(e&Lb)!==0,r=(e&Rb)!==0,i=(e&zb)!==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 Ub()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var Gb=new WeakMap;function Kb(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=Gb.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&(Object.isExtensible(e.adoptedStyleSheets)?e.adoptedStyleSheets.push(n):e.adoptedStyleSheets=[...e.adoptedStyleSheets,n]));let r=Ab();switch(r.state){case`active`:case`hover`:{let e=Wb({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}Gb.set(e,{prevStyle:t,styleSheet:n})}var qb=new Map,Jb=new Db;function Yb(e){qb=new Map(qb),qb.delete(e)}function Xb(e,t){for(let[t]of qb)if(t.id===e)return t}function Zb(e,t){for(let[t,n]of qb)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function Qb(){return qb}function $b(e,t){return Jb.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function ex(e,t,n){let r=qb.get(e);qb=new Map(qb),qb.set(e,t),Jb.emit(`groupChange`,{group:e,isUserInteraction:n?.isUserInteraction===!0,prev:r,next:t})}function tx(e){let t=Ab(),n=!1;switch(t.state){case`active`:Nb({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&(Kb(e),n=!0,t.hitRegions.forEach(e=>{let t=Zb(e.group.id,!0);ex(e.group,t,{isUserInteraction:!0})}))}return n}function nx(e){e.defaultPrevented||tx(e.currentTarget)}function rx(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=Sb(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 ix(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function ax(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:dx(e),b:dx(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();_b(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:ux(lx(n.a)),b:ux(lx(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 ox=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function sx(e){let t=getComputedStyle(fx(e)??e).display;return t===`flex`||t===`inline-flex`}function cx(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||sx(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`||ox.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function lx(e){let t=e.length;for(;t--;){let n=e[t];if(_b(n,`Missing node`),cx(n))return n}return null}function ux(e){return e&&Number(getComputedStyle(e).zIndex)||0}function dx(e){let t=[];for(;e;)t.push(e),e=fx(e);return t}function fx(e){let{parentNode:t}=e;return ix(t)?t.host:t}function px(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 mx({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!xb(n)||n.contains(e)||e.contains(n))return!0;if(ax(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(px(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function hx(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=Eb(r),a=rx(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&mx({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function gx(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 _x(e,t,n=0){return Math.abs(mb(e)-mb(t))<=n}function vx(e,t){return _x(e,t)?0:e>t?1:-1}function yx({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(vx(r,c)<0)if(a){let e=(i+c)/2;r=vx(r,e)<0?i:c}else r=c;return r=Math.min(s,r),r=mb(r),r}function bx({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(_x(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;_b(u!=null,`Invalid first pivot index`),_b(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];_b(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(_b(n!=null,`Previous layout not found for panel index ${t}`),_x(n,i)){let t=o-n;vx(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];_b(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(_b(n!=null,`Previous layout not found for panel index ${t}`),_x(n,o)){let t=n-i;vx(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];_b(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&vx(i,c)<0)if(e>0){let t=c-o,n=t/2;vx(i+e,c)<0&&(e=vx(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;vx(i-e,c)<0&&(e=vx(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];_b(e!=null,`Previous layout not found for panel index ${r}`);let a=yx({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];_b(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=yx({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!_x(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(gx(c,l))return i;{let t=e<0?d:u,r=s[t];_b(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=yx({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!_x(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];_b(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=yx({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(_x(i,s)||(t-=s-i,l[r]=s),_x(t,0))break;e>0?r--:r++}}}if(!_x(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 xx(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||vx(e[n],t[n])!==0)return!1;return!0}function Sx({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(!_x(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];_b(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];_b(i!=null,`No layout data found for index ${e}`);let o=r[e];_b(o!=null,`No layout data found for index ${e}`);let s=yx({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!_x(a,0))for(let e=0;e<t.length;e++){let n=r[e];_b(n!=null,`No layout data found for index ${e}`);let i=n+a,o=yx({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,_x(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function Cx({groupId:e,panelId:t}){let n=()=>{let t=Qb();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=({nextSize:e,panels:n,prevLayout:r,derivedPanelConstraints:i})=>{let o=a(),s=n.findIndex(e=>e.id===t),c=s===0,l=s===n.length-1;if(l&&e<o&&(c||n.slice(0,s).every((e,t)=>{let n=i[t];return n?.collapsible&&_x(n.collapsedSize,r[n.panelId])}))){let e=n.slice(0,s).reduce((e,t)=>e+r[t.id],0);return{...r,[t]:mb(100-e)}}return bx({delta:l?o-e:e-o,initialLayout:r,panelConstraints:i,pivotIndices:l?[s-1,s]:[s,s+1],prevLayout:r,trigger:`imperative-api`})},s=e=>{if(e===a())return;let{defaultLayoutDeferred:t,derivedPanelConstraints:r,group:i,groupSize:s,layout:c,separatorToPanels:l}=n(),u=Sx({layout:o({nextSize:e,panels:i.panels,prevLayout:c,derivedPanelConstraints:r}),panelConstraints:r});xx(c,u)||ex(i,{defaultLayoutDeferred:t,derivedPanelConstraints:r,groupSize:s,layout:u,separatorToPanels:l})};return{collapse:()=>{let{collapsible:e,collapsedSize:t}=r(),{mutableValues:n}=i(),o=a();e&&o!==t&&(n.expandToSize=o,s(t))},expand:()=>{let{collapsible:e,collapsedSize:t,minSize:n}=r(),{mutableValues:o}=i(),c=a();if(e&&c===t){let e=o.expandToSize??n;e===0&&(e=1),s(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&&_x(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=hb({group:t});s(mb(pb({groupSize:a,panelElement:r,styleProp:e})/a*100))}}}function wx(e){e.defaultPrevented||hx(e,Qb()).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=Cx({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function Tx(e){let t=Qb();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 Ex({groupId:e}){let t=()=>{let t=Qb();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=Sx({layout:e,panelConstraints:r});return n?o:(xx(o,c)||ex(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function Dx(e,t){let n=Tx(e),r=Zb(n.id,!0),i=n.separators.find(t=>t.element===e);_b(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);_b(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=Ex({groupId:n.id}).getLayout(),c=Sx({layout:bx({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});xx(s,c)||ex(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels},{isUserInteraction:!0})}function Ox(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=Tx(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&Dx(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&Dx(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&Dx(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&Dx(t,-5);break;case`End`:e.preventDefault(),Dx(t,100);break;case`Enter`:{e.preventDefault();let n=Tx(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=Zb(n.id,!0),o=n.separators.find(e=>e.element===t);_b(o,`Matching separator not found`);let s=a.get(o);_b(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(_b(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];Dx(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=Tx(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);_b(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(),Dx(t,-100);break}}function kx(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=Qb(),n=hx(e,t),r=new Map,i=!1;n.forEach(e=>{e.separator&&(i||(i=!0,e.separator.element.focus({focusVisible:!1,preventScroll:!0})));let n=t.get(e.group);n&&r.set(e.group,n.layout)}),Nb({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}function Ax({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=bx({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(xx(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?Ib:Lb;break;case`vertical`:s|=d<0?Rb:zb;break}}else ex(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&Bb:c|=s&Bb,t.movementY===0?c|=o&Vb:c|=s&Vb,Mb(c),Kb(e)}function jx(e){let t=Qb(),n=Ab();switch(n.state){case`active`:Ax({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function Mx(e){if(e.defaultPrevented)return;let t=Ab(),n=Qb();switch(t.state){case`active`:if(e.buttons===0){Nb({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{let t=Zb(e.group.id,!0);ex(e.group,t,{isUserInteraction:!0})});return}for(let n of t.hitRegions)if(n.separator){let{element:t}=n.separator;t.hasPointerCapture?.(e.pointerId)||t.setPointerCapture?.(e.pointerId)}Ax({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=hx(e,n);r.length===0?t.state!==`inactive`&&Nb({cursorFlags:0,state:`inactive`}):Nb({cursorFlags:0,hitRegions:r,state:`hover`}),Kb(e.currentTarget);break}}}function Nx(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(Ab().state){case`hover`:Nb({cursorFlags:0,state:`inactive`})}}function Px(e){e.defaultPrevented||e.pointerType===`mouse`&&e.button>0||tx(e.currentTarget)&&e.preventDefault()}function Fx(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=mb(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=mb((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function Ix(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=hb({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:mb(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function Lx(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 Rx({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=mb(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]=mb((r[e]??0)/a*l);else{let e=mb(l/c.length);for(let t of c)u[t]=e}return u}function zx(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 Bx=new Map;function Vx(e){let t=!0;_b(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=hb({group:e});if(t===0)return;let n=Zb(e.id);if(!n)return;let r=gb(e),i=n.defaultLayoutDeferred?Fx(r):n.layout,a=Sx({layout:Rx({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&xx(n.layout,a)&&Lx(n.derivedPanelConstraints,r)&&n.groupSize===t)return;ex(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else Ix(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{_b(!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=hb({group:e}),s=gb(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(zx(e.panels,l)||(l=void 0));let u=Sx({layout:e.mutableState.layouts[c]??l??Fx(s),panelConstraints:s}),d=e.element.ownerDocument;Bx.set(d,(Bx.get(d)??0)+1);let f=new Map;return Eb(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),ex(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{_b(!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`,Ox)}),Bx.get(d)===1&&(d.addEventListener(`contextmenu`,nx,!0),d.addEventListener(`dblclick`,wx,!0),d.addEventListener(`pointerdown`,kx,!0),d.addEventListener(`pointerleave`,jx),d.addEventListener(`pointermove`,Mx),d.addEventListener(`pointerout`,Nx),d.addEventListener(`pointerup`,Px,!0)),function(){t=!1,Bx.set(d,Math.max(0,(Bx.get(d)??0)-1)),Yb(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,Ox)}),Bx.get(d)||(d.removeEventListener(`contextmenu`,nx,!0),d.removeEventListener(`dblclick`,wx,!0),d.removeEventListener(`pointerdown`,kx,!0),d.removeEventListener(`pointerleave`,jx),d.removeEventListener(`pointermove`,Mx),d.removeEventListener(`pointerout`,Nx),d.removeEventListener(`pointerup`,Px,!0)),a.disconnect()}}function Hx(){let[e,t]=(0,Q.useState)({});return[e,(0,Q.useCallback)(()=>t({}),[])]}function Ux(e){let t=(0,Q.useId)();return`${e??t}`}var Wx=typeof window<`u`?Q.useLayoutEffect:Q.useEffect;function Gx(e){let t=(0,Q.useRef)(e);return Wx(()=>{t.current=e},[e]),(0,Q.useCallback)((...e)=>t.current?.(...e),[t])}function Kx(...e){return Gx(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t;break}})})}function qx(e){let t=(0,Q.useRef)({...e});return Wx(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var Jx=(0,Q.createContext)(null);function Yx(e,t){let n=(0,Q.useRef)({getLayout:()=>({}),setLayout:Pb});(0,Q.useImperativeHandle)(t,()=>n.current,[]),Wx(()=>{Object.assign(n.current,Ex({groupId:e}))})}function Xx({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,Q.useRef)({onLayoutChange:{},onLayoutChanged:{}}),h=Gx(e=>{xx(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=Gx((e,t)=>{xx(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e,{isUserInteraction:t}))}),_=Ux(s),v=(0,Q.useRef)(null),[y,b]=Hx(),x=(0,Q.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),S=Kx(v,a);Yx(_,o);let C=Gx((e,t)=>{let r=Ab(),i=Xb(e),a=Zb(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=qx({defaultLayout:n,disableCursor:r}),T=(0,Q.useMemo)(()=>({get disableCursor(){return!!w.disableCursor},getPanelStyles:C,id:_,orientation:u,registerPanel:e=>{let t=x.current;return t.panels=vb(u,[...t.panels,e]),b(),()=>{t.panels=t.panels.filter(t=>t!==e),b()}},registerSeparator:e=>{let t=x.current;return t.separators=vb(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=Xb(_),i=Zb(_);r&&i&&ex(r,{...i,derivedPanelConstraints:gb(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,Q.useRef)(null);return Wx(()=>{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=Vx(r),{defaultLayoutDeferred:o,derivedPanelConstraints:s,layout:c}=Zb(r.id,!0);!o&&s.length>0&&(h(c),g(c,!1));let l=$b(_,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=_x(t.collapsedSize,i[t.panelId]),a=_x(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=Ab().state!==`active`;h(i),o&&g(i,e.isUserInteraction)});return()=>{E.current=null,a(),l()}},[i,_,g,h,u,y,w]),(0,Q.useEffect)(()=>{let e=E.current;e&&(e.mutableState.defaultLayout=n,e.mutableState.disableCursor=!!r)}),(0,Z.jsx)(Jx.Provider,{value:T,children:(0,Z.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})})}Xx.displayName=`Group`;function Zx(){return(0,Q.useRef)(null)}function Qx(){let e=(0,Q.useContext)(Jx);return _b(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function $x(e,t){let{id:n}=Qx(),r=(0,Q.useRef)({collapse:Fb,expand:Fb,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:Fb});(0,Q.useImperativeHandle)(t,()=>r.current,[]),Wx(()=>{Object.assign(r.current,Cx({groupId:n,panelId:e}))})}function eS({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=Ux(c),_=qx({disabled:a}),v=(0,Q.useRef)(null),y=Kx(v,o),{getPanelStyles:b,id:x,orientation:S,registerPanel:C,updatePanelProps:w}=Qx(),T=d!==null,E=Gx((e,t,n)=>{d?.(e,c,n)});Wx(()=>{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,Q.useEffect)(()=>{w(g,{disabled:a})},[a,g,w]),$x(g,f);let D=()=>{let e=b(x,g);if(e)return JSON.stringify(e)},O=(0,Q.useSyncExternalStore)(e=>$b(x,e),D,D),k;return k=O?JSON.parse(O):i===void 0?{flexGrow:1}:{flexGrow:void 0,flexShrink:void 0,flexBasis:i},(0,Z.jsx)(`div`,{...m,"data-disabled":a||void 0,"data-panel":!0,"data-testid":g,id:g,ref:y,style:{...tS,display:`flex`,flexBasis:0,flexShrink:1,overflow:`visible`,...k},children:(0,Z.jsx)(`div`,{className:t,style:{maxHeight:`100%`,maxWidth:`100%`,flexGrow:1,overflow:`auto`,...p,touchAction:S===`horizontal`?`pan-y`:`pan-x`},children:e})})}eS.displayName=`Panel`;var tS={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function nS(){return(0,Q.useRef)(null)}function rS({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=Sx({layout:bx({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=Sx({layout:bx({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function iS({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...s}){let c=Ux(a),l=qx({disabled:n,disableDoubleClick:r}),[u,d]=(0,Q.useState)({}),[f,p]=(0,Q.useState)(`inactive`),[m,h]=(0,Q.useState)(!1),g=(0,Q.useRef)(null),_=Kx(g,i),{disableCursor:v,id:y,orientation:b,registerSeparator:x,updateSeparatorProps:S}=Qx(),C=b===`horizontal`?`vertical`:`horizontal`;Wx(()=>{let e=g.current;if(e!==null){let t={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:e,id:c},n=x(t),r=jb(e=>{p(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=$b(y,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(rS({layout:r,panelConstraints:n,panelId:e.id,panelIndex:t}))}});return()=>{r(),i(),n()}}},[y,c,x,l]),(0,Q.useEffect)(()=>{S(c,{disabled:n,disableDoubleClick:r})},[n,r,c,S]);let w;n&&!v&&(w=`not-allowed`);let T;if(n)T=`disabled`;else switch(f){case`active`:T=`active`;break;default:T=m?`focus`:f}return(0,Z.jsx)(`div`,{...s,"aria-controls":u.valueControls,"aria-disabled":n||void 0,"aria-orientation":C,"aria-valuemax":u.valueMax,"aria-valuemin":u.valueMin,"aria-valuenow":u.valueNow,children:e,className:t,"data-separator":T,"data-testid":c,id:c,onBlur:()=>h(!1),onFocus:()=>h(!0),ref:_,role:`separator`,style:{flexBasis:`auto`,cursor:w,...o,flexGrow:0,flexShrink:0,touchAction:`none`},tabIndex:n?void 0:0})}iS.displayName=`Separator`;var aS=new Map;function oS(e){let t=aS.get(e);if(t)return t;let n=sS(e);return aS.set(e,n),n}async function sS(e){switch(e){case`bash`:case`shell`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-5kUc8Rop.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([64,1,9]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{shell:e}=await import(`./shell-B3Wf6FeS.js`);return{shell:e}},[],import.meta.url)).shell);case`c`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-5kUc8Rop.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([64,1,9]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{c:e}=await import(`./clike-mYAQK8rB.js`);return{c:e}},[],import.meta.url)).c);case`cpp`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-5kUc8Rop.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([64,1,9]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{cpp:e}=await import(`./clike-mYAQK8rB.js`);return{cpp:e}},[],import.meta.url)).cpp);case`csharp`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-5kUc8Rop.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([64,1,9]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{csharp:e}=await import(`./clike-mYAQK8rB.js`);return{csharp:e}},[],import.meta.url)).csharp);case`css`:case`less`:case`scss`:return(await n(async()=>{let{css:e}=await import(`./dist-635PXtcP.js`).then(e=>e.r);return{css:e}},__vite__mapDeps([63,1,64,9,65]),import.meta.url)).css().language;case`diff`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-5kUc8Rop.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([64,1,9]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{diff:e}=await import(`./diff-CQoFqEJ8.js`);return{diff:e}},[],import.meta.url)).diff);case`go`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-5kUc8Rop.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([64,1,9]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{go:e}=await import(`./go-DksFOnIG.js`);return{go:e}},[],import.meta.url)).go);case`ini`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-5kUc8Rop.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([64,1,9]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{properties:e}=await import(`./properties-CJAqwakm.js`);return{properties:e}},[],import.meta.url)).properties);case`java`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-5kUc8Rop.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([64,1,9]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{java:e}=await import(`./clike-mYAQK8rB.js`);return{java:e}},[],import.meta.url)).java);case`javascript`:return(await n(async()=>{let{javascript:e}=await import(`./dist-uVOKoIoH.js`).then(e=>e.t);return{javascript:e}},__vite__mapDeps([67,1,68,64,9,65]),import.meta.url)).javascript().language;case`json`:return(await n(async()=>{let{json:e}=await import(`./dist-CcNiwixP.js`).then(e=>e.t);return{json:e}},__vite__mapDeps([69,1,64,9,65]),import.meta.url)).json().language;case`kotlin`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-5kUc8Rop.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([64,1,9]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{kotlin:e}=await import(`./clike-mYAQK8rB.js`);return{kotlin:e}},[],import.meta.url)).kotlin);case`lua`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-5kUc8Rop.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([64,1,9]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{lua:e}=await import(`./lua-DtKxmweM.js`);return{lua:e}},[],import.meta.url)).lua);case`markdown`:return(await n(async()=>{let{markdown:e}=await import(`./dist-DrdxKM3X.js`).then(e=>e.t);return{markdown:e}},__vite__mapDeps([70,1,68,64,9,66,63,65,67]),import.meta.url)).markdown().language;case`objectivec`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-5kUc8Rop.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([64,1,9]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{objectiveC:e}=await import(`./clike-mYAQK8rB.js`);return{objectiveC:e}},[],import.meta.url)).objectiveC);case`perl`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-5kUc8Rop.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([64,1,9]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{perl:e}=await import(`./perl-BXzCUtdd.js`);return{perl:e}},[],import.meta.url)).perl);case`python`:return(await n(async()=>{let{python:e}=await import(`./dist-C5VV4AJh.js`);return{python:e}},__vite__mapDeps([101,68,64,1,9,65]),import.meta.url)).python().language;case`r`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-5kUc8Rop.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([64,1,9]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{r:e}=await import(`./r-Brb1bnAX.js`);return{r:e}},[],import.meta.url)).r);case`ruby`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-5kUc8Rop.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([64,1,9]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{ruby:e}=await import(`./ruby-CWNYdZZ6.js`);return{ruby:e}},[],import.meta.url)).ruby);case`rust`:return(await n(async()=>{let{rust:e}=await import(`./dist-BlUN9R-p.js`);return{rust:e}},__vite__mapDeps([102,64,1,9,65]),import.meta.url)).rust().language;case`sql`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-5kUc8Rop.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([64,1,9]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{standardSQL:e}=await import(`./sql-BRvyk2_W.js`);return{standardSQL:e}},[],import.meta.url)).standardSQL);case`swift`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-5kUc8Rop.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([64,1,9]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{swift:e}=await import(`./swift-DT2ta4LM.js`);return{swift:e}},[],import.meta.url)).swift);case`typescript`:return(await n(async()=>{let{javascript:e}=await import(`./dist-uVOKoIoH.js`).then(e=>e.t);return{javascript:e}},__vite__mapDeps([67,1,68,64,9,65]),import.meta.url)).javascript({typescript:!0,jsx:!0}).language;case`xml`:return(await n(async()=>{let{html:e}=await import(`./dist-C5oOOujV.js`).then(e=>e.t);return{html:e}},__vite__mapDeps([66,1,63,64,9,65,67,68]),import.meta.url)).html().language;case`yaml`:return(await n(async()=>{let{yaml:e}=await import(`./dist-BgCLeN3Q.js`).then(e=>e.t);return{yaml:e}},__vite__mapDeps([71,1,64,9,65]),import.meta.url)).yaml().language;default:return null}}async function cS(e,t){if(e===`canvas`)return(await n(async()=>{let{json:e}=await import(`./dist-CcNiwixP.js`).then(e=>e.t);return{json:e}},__vite__mapDeps([69,1,64,9,65]),import.meta.url)).json().language;if(t){let e=await oS(t);if(e)return e}return e===`toml`?(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-5kUc8Rop.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([64,1,9]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{toml:e}=await import(`./toml-C1FnyICQ.js`);return{toml:e}},[],import.meta.url)).toml):null}function lS(e){let t=(0,$.c)(10),{_:n}=vt(),r;t[0]===n?r=t[1]:(r=e=>n(e===413?{id:`C_WGy8`}:e===415?{id:`VM7H66`}:e===404?{id:`s0IDhW`}:e===400?{id:`N1mdmS`}:typeof e==`number`?{id:`96w9hU`,values:{status:e}}:{id:`ig5vUe`}),t[0]=n,t[1]=r);let i=r,{src:a,loadText:o}=e,s=(0,Q.useRef)(o),c=(0,Q.useRef)(i),l;t[2]!==o||t[3]!==i?(l=()=>{s.current=o,c.current=i},t[2]=o,t[3]=i,t[4]=l):l=t[4],(0,Q.useEffect)(l);let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u={status:`loading`},t[5]=u):u=t[5];let[d,f]=(0,Q.useState)(u),p,m;return t[6]!==n||t[7]!==a?(p=()=>{let e=!1,t=new AbortController;f({status:`loading`});let r=s.current;return r?(r(t.signal).then(t=>{if(!e){if(t.ok){f({status:`loaded`,content:t.text});return}f({status:`error`,message:t.message??c.current(t.status)})}}).catch(t=>{e||t instanceof Error&&t.name===`AbortError`||f({status:`error`,message:n({id:`ig5vUe`})})}),()=>{e=!0,t.abort()}):(fetch(a??``,{credentials:`same-origin`,signal:t.signal}).then(async e=>{if(!e.ok)throw Error(c.current(e.status));return e.text()}).then(t=>{e||f({status:`loaded`,content:t})}).catch(t=>{e||t instanceof Error&&t.name===`AbortError`||f({status:`error`,message:t instanceof Error?t.message:n({id:`ig5vUe`})})}),()=>{e=!0,t.abort()})},m=[a,n],t[6]=n,t[7]=a,t[8]=p,t[9]=m):(p=t[8],m=t[9]),(0,Q.useEffect)(p,m),d}function uS(e){let t=(0,$.c)(10),{fileName:n,dataAttr:r,extraAttrs:i}=e,a=`${r}-state`,o;t[0]!==r||t[1]!==a?(o={[r]:``,[a]:`loading`},t[0]=r,t[1]=a,t[2]=o):o=t[2];let s;t[3]===n?s=t[4]:(s=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`Md709y`,values:{fileName:n}})}),t[3]=n,t[4]=s);let c;return t[5]!==i||t[6]!==n||t[7]!==o||t[8]!==s?(c=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col items-center justify-center bg-background text-muted-foreground text-sm`,"aria-label":n,...o,...i,children:s}),t[5]=i,t[6]=n,t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function dS(e){let t=(0,$.c)(16),{fileName:n,dataAttr:r,extraAttrs:i,message:a,openHref:o}=e,s=`${r}-state`,c;t[0]!==r||t[1]!==s?(c={[r]:``,[s]:`error`},t[0]=r,t[1]=s,t[2]=c):c=t[2];let l;t[3]===n?l=t[4]:(l=(0,Z.jsx)(`div`,{className:`font-medium text-sm`,children:(0,Z.jsx)(J,{id:`qdBUHP`,values:{fileName:n}})}),t[3]=n,t[4]=l);let u;t[5]===a?u=t[6]:(u=(0,Z.jsx)(`div`,{className:`text-muted-foreground text-xs`,children:a}),t[5]=a,t[6]=u);let d;t[7]===o?d=t[8]:(d=o?(0,Z.jsx)(`a`,{href:o,className:`mt-2 rounded-md border px-3 py-1.5 text-sm hover:bg-accent hover:text-accent-foreground`,children:(0,Z.jsx)(J,{id:`9npOH9`})}):null,t[7]=o,t[8]=d);let f;return t[9]!==i||t[10]!==n||t[11]!==c||t[12]!==l||t[13]!==u||t[14]!==d?(f=(0,Z.jsxs)(`main`,{className:`flex h-full min-h-0 flex-col items-center justify-center gap-2 bg-background p-4 text-center`,"aria-label":n,...c,...i,children:[l,u,d]}),t[9]=i,t[10]=n,t[11]=c,t[12]=l,t[13]=u,t[14]=d,t[15]=f):f=t[15],f}var fS=Nn({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),pS=er({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}});function mS(e){let t=(0,$.c)(23),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({fileName:r,extension:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=(0,Q.useRef)(null),o=(0,Q.useRef)(null),{resolvedTheme:s}=zt(),c=lS(i),l=c.status===`loaded`?c.content:null,u,d;t[4]!==n||t[5]!==l||t[6]!==s?(u=()=>{if(!a.current||l===null)return;let e=n.toLowerCase(),t=Vo(e),r=s===`dark`?fS:pS,i=!1,c=null;return cS(e,t).then(e=>{if(i||!a.current)return;let t=[jd,...e?[e]:[],Mu.editable.of(!0),Au.readOnly.of(!0),Mu.lineWrapping,r];c=new Mu({state:Au.create({doc:l,extensions:t}),parent:a.current}),o.current=c}),()=>{i=!0,c?.destroy(),o.current=null}},d=[l,n,s],t[4]=n,t[5]=l,t[6]=s,t[7]=u,t[8]=d):(u=t[7],d=t[8]),(0,Q.useEffect)(u,d);let f;t[9]===n?f=t[10]:(f={"data-text-viewer-extension":n},t[9]=n,t[10]=f);let p=f;if(c.status===`loading`){let e;return t[11]!==p||t[12]!==r?(e=(0,Z.jsx)(uS,{fileName:r,dataAttr:`data-text-viewer`,extraAttrs:p}),t[11]=p,t[12]=r,t[13]=e):e=t[13],e}if(c.status===`error`){let e;return t[14]!==p||t[15]!==c.message||t[16]!==r||t[17]!==i.src?(e=(0,Z.jsx)(dS,{fileName:r,dataAttr:`data-text-viewer`,extraAttrs:p,message:c.message,openHref:i.src}),t[14]=p,t[15]=c.message,t[16]=r,t[17]=i.src,t[18]=e):e=t[18],e}let m;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(`div`,{ref:a,className:`min-h-0 flex-1 overflow-auto`}),t[19]=m):m=t[19];let h;return t[20]!==n||t[21]!==r?(h=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":r,"data-text-viewer":``,"data-text-viewer-state":`loaded`,"data-text-viewer-extension":n,children:m}),t[20]=n,t[21]=r,t[22]=h):h=t[22],h}function hS(e){let t=(0,$.c)(50),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({fileName:r,extension:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let{_:a}=vt(),[o,s]=(0,Q.useState)(`diagram`),c=lS(i),l;t[4]===n?l=t[5]:(l={"data-mermaid-file-viewer-extension":n},t[4]=n,t[5]=l);let u=l;if(c.status===`loading`){let e;return t[6]!==u||t[7]!==r?(e=(0,Z.jsx)(uS,{fileName:r,dataAttr:`data-mermaid-file-viewer`,extraAttrs:u}),t[6]=u,t[7]=r,t[8]=e):e=t[8],e}if(c.status===`error`){let e;return t[9]!==u||t[10]!==c.message||t[11]!==r||t[12]!==i.src?(e=(0,Z.jsx)(dS,{fileName:r,dataAttr:`data-mermaid-file-viewer`,extraAttrs:u,message:c.message,openHref:i.src}),t[9]=u,t[10]=c.message,t[11]=r,t[12]=i.src,t[13]=e):e=t[13],e}let d=c.content,f;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(f=e=>{e&&s(e)},t[14]=f):f=t[14];let p;t[15]===a?p=t[16]:(p=a({id:`72xhRD`}),t[15]=a,t[16]=p);let m;t[17]===a?m=t[18]:(m=a({id:`DEWDbv`}),t[17]=a,t[18]=m);let h;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(ln,{children:(0,Z.jsx)(ie,{className:`size-4`})}),t[19]=h):h=t[19];let g;t[20]===m?g=t[21]:(g=(0,Z.jsx)(Mi,{value:`diagram`,"aria-label":m,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,asChild:!0,children:h}),t[20]=m,t[21]=g);let _;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(un,{side:`bottom`,children:(0,Z.jsx)(J,{id:`i-ShMB`})}),t[22]=_):_=t[22];let v;t[23]===g?v=t[24]:(v=(0,Z.jsxs)(fn,{children:[g,_]}),t[23]=g,t[24]=v);let y;t[25]===a?y=t[26]:(y=a({id:`Y6SK9K`}),t[25]=a,t[26]=y);let b;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(ln,{children:(0,Z.jsx)(xe,{className:`size-4`})}),t[27]=b):b=t[27];let x;t[28]===y?x=t[29]:(x=(0,Z.jsx)(Mi,{value:`source`,"aria-label":y,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,asChild:!0,children:b}),t[28]=y,t[29]=x);let S;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(un,{side:`bottom`,children:(0,Z.jsx)(J,{id:`wdxz7K`})}),t[30]=S):S=t[30];let C;t[31]===x?C=t[32]:(C=(0,Z.jsxs)(fn,{children:[x,S]}),t[31]=x,t[32]=C);let w;t[33]!==o||t[34]!==C||t[35]!==p||t[36]!==v?(w=(0,Z.jsx)(`div`,{className:`flex shrink-0 items-center justify-center border-b bg-background py-2`,children:(0,Z.jsxs)(Pi,{type:`single`,value:o,onValueChange:f,"aria-label":p,variant:`segmented`,size:`sm`,spacing:1,className:`shrink-0 bg-muted p-0.5 data-[size=sm]:rounded-[10px]`,children:[v,C]})}),t[33]=o,t[34]=C,t[35]=p,t[36]=v,t[37]=w):w=t[37];let T;t[38]!==n||t[39]!==r||t[40]!==o||t[41]!==i||t[42]!==d?(T=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:o===`diagram`?(0,Z.jsx)(`div`,{className:`flex h-full min-h-0 flex-col p-3 [&_.mermaid-error-source]:hidden`,children:(0,Z.jsx)(An,{chart:d,className:`min-h-0 flex-1`})}):(0,Z.jsx)(mS,{...i,fileName:r,extension:n})}),t[38]=n,t[39]=r,t[40]=o,t[41]=i,t[42]=d,t[43]=T):T=t[43];let E;return t[44]!==u||t[45]!==r||t[46]!==o||t[47]!==w||t[48]!==T?(E=(0,Z.jsxs)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":r,"data-mermaid-file-viewer":``,"data-mermaid-file-viewer-state":`loaded`,"data-mermaid-file-viewer-mode":o,...u,children:[w,T]}),t[44]=u,t[45]=r,t[46]=o,t[47]=w,t[48]=T,t[49]=E):E=t[49],E}function gS(e){let t=(0,$.c)(29),{entry:n,className:r}=e,{_:i}=vt(),{projectLocalBinding:a,merged:o}=Hu(),s=o?.appearance?.sidebar,c=s?.showHiddenFiles??!1,l=s?.showOnlyMarkdownFiles??!1,u;t[0]!==n||t[1]!==c||t[2]!==l?(u=Il(n,{showHiddenFiles:c,showOnlyMarkdownFiles:l}),t[0]=n,t[1]=c,t[2]=l,t[3]=u):u=t[3];let d=u;if(!d.hiddenFiles&&!d.onlyMarkdownFiles)return null;let f;t[4]!==i||t[5]!==a?(f=e=>{if(a===null)return;let t=a.patch({appearance:{sidebar:e}});t.ok||(console.warn(`[NotInSidebarIndicator] sidebar visibility flip rejected:`,Va(t.error)),X.error(i({id:`P47EWZ`}),{description:Va(t.error)}))},t[4]=i,t[5]=a,t[6]=f):f=t[6];let p=f,m;t[7]===r?m=t[8]:(m=$t(`flex items-center gap-1.5 text-muted-foreground/70 text-xs`,r),t[7]=r,t[8]=m);let h;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(Ie,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),t[9]=h):h=t[9];let g;t[10]===i?g=t[11]:(g=i({id:`j9tqwO`}),t[10]=i,t[11]=g);let _;t[12]===g?_=t[13]:(_=(0,Z.jsx)(`span`,{className:`whitespace-nowrap`,children:g}),t[12]=g,t[13]=_);let v;t[14]!==i||t[15]!==d.hiddenFiles||t[16]!==p||t[17]!==a?(v=d.hiddenFiles?(0,Z.jsx)(Y,{variant:`outline`,size:`sm`,className:`h-5 rounded-sm px-1.5 font-normal text-2xs text-muted-foreground hover:text-foreground`,disabled:a===null,onClick:()=>p({showHiddenFiles:!0}),"aria-label":i({id:`XcGbim`}),title:i({id:`XcGbim`}),"data-testid":`not-in-sidebar-flip-hidden-files`,children:i({id:`6KCH4m`})}):null,t[14]=i,t[15]=d.hiddenFiles,t[16]=p,t[17]=a,t[18]=v):v=t[18];let y;t[19]!==i||t[20]!==d.onlyMarkdownFiles||t[21]!==p||t[22]!==a?(y=d.onlyMarkdownFiles?(0,Z.jsx)(Y,{variant:`outline`,size:`sm`,className:`h-5 rounded-sm px-1.5 font-normal text-2xs text-muted-foreground hover:text-foreground`,disabled:a===null,onClick:()=>p({showOnlyMarkdownFiles:!1}),"aria-label":i({id:`10g8I_`}),title:i({id:`10g8I_`}),"data-testid":`not-in-sidebar-flip-only-markdown`,children:i({id:`5-o4kO`})}):null,t[19]=i,t[20]=d.onlyMarkdownFiles,t[21]=p,t[22]=a,t[23]=y):y=t[23];let b;return t[24]!==y||t[25]!==m||t[26]!==_||t[27]!==v?(b=(0,Z.jsxs)(`div`,{"data-testid":`not-in-sidebar-indicator`,className:m,children:[h,_,v,y]}),t[24]=y,t[25]=m,t[26]=_,t[27]=v,t[28]=b):b=t[28],b}function _S(e){return ao(`/api/asset?path=${encodeURIComponent(e)}`)}function vS(e){return`/api/asset-text?path=${encodeURIComponent(e)}`}function yS(e){let t=(0,$.c)(8),{assetPath:n,mediaKind:r}=e,i;t[0]===n?i=t[1]:(i=(0,Z.jsx)(gS,{entry:{kind:`asset`,path:n},className:`shrink-0 border-b bg-background px-3 py-1.5`}),t[0]=n,t[1]=i);let a;t[2]!==n||t[3]!==r?(a=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(bS,{assetPath:n,mediaKind:r})}),t[2]=n,t[3]=r,t[4]=a):a=t[4];let o;return t[5]!==i||t[6]!==a?(o=(0,Z.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[i,a]}),t[5]=i,t[6]=a,t[7]=o):o=t[7],o}function bS(e){let t=(0,$.c)(33),{assetPath:n,mediaKind:r}=e,[i,a]=(0,Q.useState)(!1),o;t[0]===n?o=t[1]:(o=_S(n),t[0]=n,t[1]=o);let s=o,c;t[2]===n?c=t[3]:(c=n.split(`/`).pop()??n,t[2]=n,t[3]=c);let l=c,u,d,f,p;if(t[4]!==n||t[5]!==l||t[6]!==i||t[7]!==r||t[8]!==s){p=Symbol.for(`react.early_return_sentinel`);bb0:{if(f=l.includes(`.`)?l.split(`.`).pop()??``:``,d=f.length>0?f.toUpperCase():`FILE`,u=i?`text`:r,u===`pdf`){let e;t[13]!==l||t[14]!==s?(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,Z.jsx)(v,{src:s,title:l,fillContainer:!0})}),t[13]=l,t[14]=s,t[15]=e):e=t[15];let n;t[16]!==l||t[17]!==e?(n=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":l,children:e}),t[16]=l,t[17]=e,t[18]=n):n=t[18],p=n;break bb0}if(u===`text`){let e;t[19]===n?e=t[20]:(e=vS(n),t[19]=n,t[20]=e),p=(0,Z.jsx)(mS,{src:e,fileName:l,extension:f.toLowerCase()},n);break bb0}if(u===`mermaid`){let e;t[21]===n?e=t[22]:(e=vS(n),t[21]=n,t[22]=e),p=(0,Z.jsx)(hS,{src:e,fileName:l,extension:f.toLowerCase()},n);break bb0}}t[4]=n,t[5]=l,t[6]=i,t[7]=r,t[8]=s,t[9]=u,t[10]=d,t[11]=f,t[12]=p}else u=t[9],d=t[10],f=t[11],p=t[12];if(p!==Symbol.for(`react.early_return_sentinel`))return p;let m;t[23]!==n||t[24]!==u||t[25]!==d||t[26]!==l||t[27]!==f||t[28]!==s?(m=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-auto p-4`,children:u===`image`?(0,Z.jsx)(B,{src:s,alt:l,draggable:!1,slotClassName:`flex h-full w-full items-center justify-center`,className:`max-h-full max-w-full`}):u===`video`?(0,Z.jsx)(`video`,{src:s,controls:!0,className:`max-h-full max-w-full`}):u===`audio`?(0,Z.jsx)(`audio`,{src:s,controls:!0,className:`w-full max-w-md`}):(0,Z.jsxs)(`div`,{className:`flex max-w-sm flex-col items-center gap-8 text-center`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[(0,Z.jsx)(`div`,{className:`flex items-center justify-center tracking-wide text-muted-foreground/80 text-2xs font-mono`,children:d}),(0,Z.jsx)(`div`,{className:`max-w-full text-balance break-words tracking-tight font-light text-2xl`,children:l})]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:[(0,Z.jsx)(Y,{variant:`default`,size:`sm`,onClick:()=>a(!0),"data-testid":`asset-preview-open-as-text`,className:`font-mono uppercase`,children:(0,Z.jsx)(J,{id:`qFWMl-`})}),(0,Z.jsx)(Y,{variant:`outline`,size:`sm`,className:`font-mono uppercase`,onClick:()=>{zn({url:s,projectRelPath:n,ext:f.toLowerCase(),title:l,forceOsDelegation:!1})},children:(0,Z.jsx)(J,{id:`9npOH9`})})]})]})}),t[23]=n,t[24]=u,t[25]=d,t[26]=l,t[27]=f,t[28]=s,t[29]=m):m=t[29];let h;return t[30]!==l||t[31]!==m?(h=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":l,children:m}),t[30]=l,t[31]=m,t[32]=h):h=t[32],h}function xS(){let e=(0,$.c)(5),{_:t}=vt(),n;e[0]===t?n=e[1]:(n=t({id:`3VsNTI`}),e[0]=t,e[1]=n);let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[(0,Z.jsx)(Cd,{className:`h-9 w-2/5 mt-6 mb-5`}),(0,Z.jsx)(Cd,{className:`h-4 w-full`}),(0,Z.jsx)(Cd,{className:`h-4 w-3/4`})]}),e[2]=r):r=e[2];let i;return e[3]===n?i=e[4]:(i=(0,Z.jsx)(`div`,{className:`tiptap-editor pt-10`,role:`status`,"aria-busy":`true`,"aria-label":n,children:r}),e[3]=n,e[4]=i),i}function SS(e){let{_:t}=vt();return e===`existing-repo`?[{id:`draft-spec`,icon:Km,label:t({id:`LdKIHS`}),prompt:t({id:`N_7kkF`})},{id:`organize-specs`,icon:uh,label:t({id:`cuA8QW`}),prompt:t({id:`mPy9lS`})},{id:`document-architecture`,icon:mh,label:t({id:`6eniID`}),prompt:t({id:`uDlyqd`})}]:[{id:`competitor-research`,icon:Ih,label:t({id:`GUqTzn`}),prompt:t({id:`KOZud0`})},{id:`eng-specs`,icon:Km,label:t({id:`Qvls7J`}),prompt:t({id:`6qMe0o`})},{id:`bird-wiki`,icon:Mm,label:t({id:`FqTpiN`}),prompt:t({id:`jtg_8-`})}]}function CS(e){let t=(0,$.c)(13),{scenario:n,className:r}=e,{_:i}=vt(),a=SS(n),[o,s]=(0,Q.useState)(null),c=(0,Q.useRef)(void 0),l,u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>()=>clearTimeout(c.current),u=[],t[0]=l,t[1]=u):(l=t[0],u=t[1]),(0,Q.useEffect)(l,u);let d,f;if(t[2]!==i||t[3]!==r||t[4]!==o||t[5]!==a){let e=function(e,t){Md(t).then(()=>{s(e),clearTimeout(c.current),c.current=setTimeout(()=>s(null),1600)}).catch(wS)};t[8]===r?d=t[9]:(d=$t(`w-full divide-y divide-border/60 overflow-hidden rounded-2xl border border-border/60 bg-card`,r),t[8]=r,t[9]=d),f=a.map(t=>{let n=t.icon,r=o===t.id;return(0,Z.jsxs)(`li`,{className:`group flex items-start gap-3 p-3.5`,"data-testid":`copy-prompt-${t.id}`,children:[(0,Z.jsx)(n,{className:`mt-0.5 size-4 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`text-sm font-medium leading-tight text-foreground`,children:t.label}),(0,Z.jsx)(`span`,{className:`truncate text-1sm leading-relaxed text-muted-foreground`,children:t.prompt})]}),(0,Z.jsxs)(Y,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>e(t.id,t.prompt),"aria-label":i(r?{id:`6V3Ea3`}:{id:`RG4XHV`,values:{0:t.label}}),className:$t(`shrink-0 gap-1.5 transition-opacity focus-visible:opacity-100 uppercase font-mono`,r?`opacity-100`:`opacity-0 group-hover:opacity-100`),"data-testid":`copy-prompt-button-${t.id}`,children:[r?(0,Z.jsx)(Ds,{className:`size-3.5`,"aria-hidden":`true`}):(0,Z.jsx)(pc,{className:`size-3.5`,"aria-hidden":`true`}),i(r?{id:`6V3Ea3`}:{id:`he3ygx`})]})]},t.id)}),t[2]=i,t[3]=r,t[4]=o,t[5]=a,t[6]=d,t[7]=f}else d=t[6],f=t[7];let p;return t[10]!==d||t[11]!==f?(p=(0,Z.jsx)(`ul`,{className:d,children:f}),t[10]=d,t[11]=f,t[12]=p):p=t[12],p}function wS(){}var TS=`ok-ask-ai-draft-v2`,ES={doc:null,dismissed:!1};function DS(){if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}var OS=null,kS=new Set;function AS(e){if(e===null)return!0;let t=e.content;return!Array.isArray(t)||t.length===0?!0:t.every(e=>{let t=e.content;return!Array.isArray(t)||t.length===0})}function jS(){let e=DS();if(!e)return ES;try{let t=e.getItem(TS);if(!t)return ES;let n=JSON.parse(t);return typeof n!=`object`||!n||Array.isArray(n)?ES:{doc:n,dismissed:!1}}catch(e){return console.warn(`failed to parse stored draft — clearing`,e),ES}}function MS(){return OS===null&&(OS=jS()),OS}function NS(e){let t=DS();if(t)try{e&&!AS(e)?t.setItem(TS,JSON.stringify(e)):t.removeItem(TS)}catch{}}function PS(){for(let e of kS)e()}function FS(){return MS()}function IS(e){let t=e&&!AS(e)?e:null;OS={...MS(),doc:t},NS(t),PS()}function LS(){IS(null)}var RS=nn(`group/button-group flex w-fit items-stretch *:focus-visible:relative *:focus-visible:z-10 has-[>[data-slot=button-group]]:gap-2 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-lg [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1`,{variants:{orientation:{horizontal:`[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-r-lg!`,vertical:`flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-b-lg!`}},defaultVariants:{orientation:`horizontal`}});function zS(e){let t=(0,$.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,orientation:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]!==n||t[5]!==r?(a=$t(RS({orientation:r}),n),t[4]=n,t[5]=r,t[6]=a):a=t[6];let o;return t[7]!==r||t[8]!==i||t[9]!==a?(o=(0,Z.jsx)(`div`,{role:`group`,"data-slot":`button-group`,"data-orientation":r,className:a,...i}),t[7]=r,t[8]=i,t[9]=a,t[10]=o):o=t[10],o}var BS=so;function VS(e){let t=Hn(e).kind;return t===`folder`||t===`asset`?t:`page`}function HS(e){let t=(0,$.c)(14),{items:n,query:r,selectedIndex:i,onSelect:a,loading:o,error:s,hasMore:c}=e,l=o===void 0?!1:o,u=s===void 0?!1:s,d=c===void 0?!1:c,{_:f}=vt(),p=(0,Q.useId)(),m=(0,Q.useRef)(null),h,g;t[0]===i?(h=t[1],g=t[2]):(h=()=>{(m.current?.querySelectorAll(`[role="option"]`))?.item(i)?.scrollIntoView({block:`nearest`})},g=[i],t[0]=i,t[1]=h,t[2]=g),(0,Q.useEffect)(h,g);let _=i>=0&&i<n.length?n[i]:null,v;return t[3]!==f||t[4]!==u||t[5]!==d||t[6]!==n||t[7]!==p||t[8]!==l||t[9]!==a||t[10]!==r||t[11]!==i||t[12]!==_?(v=(0,Z.jsx)(`div`,{ref:m,className:`w-80 max-w-[min(28rem,90vw)] overflow-hidden rounded-lg border bg-popover p-1 text-popover-foreground shadow-md`,children:l?(0,Z.jsx)(`p`,{className:`px-2 py-1.5 text-sm text-muted-foreground`,"aria-live":`polite`,children:f({id:`3m2GBo`})}):u?(0,Z.jsx)(`p`,{className:`px-2 py-1.5 text-sm text-muted-foreground`,"aria-live":`assertive`,children:f({id:`weP6me`})}):n.length===0?(0,Z.jsx)(`p`,{className:`px-2 py-1.5 text-sm text-muted-foreground`,"aria-live":`polite`,children:r.trim()===``?f({id:`0E9DR6`}):f({id:`yQyglE`})}):(0,Z.jsxs)(`div`,{role:`listbox`,id:p,"aria-label":f({id:`05n5wS`}),tabIndex:-1,className:`max-h-64 overflow-y-auto subtle-scrollbar`,children:[(0,Z.jsx)(`span`,{className:`sr-only`,"aria-live":`polite`,"aria-atomic":`true`,children:_?_.title:``}),n.map((e,t)=>{let n=t===i,r=VS(e.path),o=r===`folder`,s=o?`${e.path}/`:e.path;return(0,Z.jsxs)(`button`,{id:`${p}-option-${t}`,type:`button`,role:`option`,"aria-selected":n,"data-active":n,"data-mention-kind":r,"data-testid":`composer-mention-option-${e.docName}`,className:`flex w-full items-start gap-2 rounded-md px-2 py-1.5 text-left ${n?`bg-accent text-accent-foreground`:``}`,onMouseDown:t=>{t.preventDefault(),a(e)},children:[(0,Z.jsx)(ee,{path:e.path,className:`mt-0.5 size-4 shrink-0 text-muted-foreground`}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,Z.jsxs)(`span`,{className:`flex items-baseline gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`truncate text-sm font-medium`,children:e.title}),o?(0,Z.jsx)(`span`,{className:`shrink-0 text-[10px] font-medium uppercase tracking-wide text-muted-foreground`,children:f({id:`kNqMMd`})}):null]}),(0,Z.jsx)(`span`,{className:`line-clamp-2 break-all text-xs text-muted-foreground`,children:s})]})]},e.docName)}),d?(0,Z.jsx)(`div`,{className:`px-2 py-1 text-xs text-muted-foreground`,"aria-hidden":!0,children:f({id:`F1T9y_`})}):null]})}),t[3]=f,t[4]=u,t[5]=d,t[6]=n,t[7]=p,t[8]=l,t[9]=a,t[10]=r,t[11]=i,t[12]=_,t[13]=v):v=t[13],v}var US=8,WS=new Ea(`composerMentionSuggestion`);function GS(e){return e.kind===`asset`?e.docName.replace(/^\//,``):e.kind===`folder`?e.docName:dc(e.docName)}var KS=Ho.create({name:`doc`,topNode:!0,content:`paragraph+`}),qS=Ho.create({name:`paragraph`,group:`block`,content:`inline*`,parseHTML(){return[{tag:`p`}]},renderHTML(){return[`p`,0]}}),JS=Ho.create({name:`text`,group:`inline`}),YS=Ho.create({name:`hardBreak`,group:`inline`,inline:!0,selectable:!1,parseHTML(){return[{tag:`br`}]},renderHTML(){return[`br`]},addKeyboardShortcuts(){return{"Shift-Enter":()=>this.editor.commands.insertContent({type:`hardBreak`})}}}),XS=vo.create({name:`composerHistory`,addProseMirrorPlugins(){return[Ao(),qo({"Mod-z":fo,"Mod-y":Io,"Shift-Mod-z":Io})]}}),ZS=Ho.create({name:`composerMention`,group:`inline`,inline:!0,atom:!0,selectable:!0,addAttributes(){return{path:{default:``},label:{default:``}}},parseHTML(){return[{tag:`span[data-composer-mention]`}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.label||e.attrs.path);return[`span`,ga(t,{"data-composer-mention":String(e.attrs.path??``),class:`composer-mention-chip`}),`@${n}`]},renderText({node:e}){return`@${e.attrs.path}`},addNodeView(){return({node:e,editor:t,getPos:n})=>{let r=String(e.attrs.path??``),i=String(e.attrs.label||e.attrs.path),a=document.createElement(`span`);a.className=`composer-mention-chip group/mention`,a.setAttribute(`data-composer-mention`,r),a.title=i;let o=document.createElement(`button`);o.type=`button`,o.className=`composer-mention-icon`,o.setAttribute(`aria-label`,yl._({id:`Xzy0s0`,values:{fullLabel:i}}));let s=document.createElement(`span`);s.className=`composer-mention-glyph composer-mention-glyph-icon`,s.setAttribute(`aria-hidden`,`true`),s.innerHTML=Je(r),o.appendChild(s);let c=document.createElement(`span`);c.className=`composer-mention-glyph composer-mention-glyph-x`,c.setAttribute(`aria-hidden`,`true`),c.innerHTML=C(fl),o.appendChild(c),o.addEventListener(`mousedown`,e=>e.preventDefault()),o.addEventListener(`click`,r=>{r.preventDefault();let i=typeof n==`function`?n():null;i!=null&&t.chain().focus().deleteRange({from:i,to:i+e.nodeSize}).run()}),a.appendChild(o);let l=document.createElement(`span`);return l.className=`composer-mention-label`,l.textContent=i,a.appendChild(l),{dom:a}}},addProseMirrorPlugins(){return[eC(this.editor)]}});function QS(e){return[KS,qS,JS,YS,XS,ZS,...e?.placeholder?[BS.configure({placeholder:e.placeholder})]:[]]}function $S(e=Gn){let t=[],n=!1,r=null,i=!1;return{snapshot(){return{loaded:n,error:i}},async getItems(a){if(!n){r||=e();try{t=await r,n=!0,i=!1}catch(e){console.error(`[composer-mention] failed to fetch pages`,e),t=[],i=!0}finally{r=null}}return Qn(t,a).map(e=>({docName:e.docName,title:e.title,path:GS(e)})).filter(e=>e.path!==``)},reset(){t=[],n=!1,r=null,i=!1}}}function eC(e){let t=$S();return Cn({editor:e,pluginKey:WS,char:`@`,items:({query:e})=>t.getItems(e),command:({editor:e,range:t,props:n})=>{try{e.chain().focus().deleteRange(t).insertContent([{type:`composerMention`,attrs:{path:n.path,label:n.title}},{type:`text`,text:` `}]).run()}catch(e){console.error(`[composer-mention] insert failed`,{item:n,range:t},e)}},render:()=>{let e=null,n=null,r=0,i={popup:null,stopAutoUpdate:null},a=null,o=null,s=e=>{n?.command(e)},c=e=>{let n=e.items??[],{loaded:i,error:a}=t.snapshot();return{items:n,query:e.query??``,selectedIndex:r,onSelect:s,loading:!i&&!a,error:a,hasMore:n.length>=US}},l=()=>{!e||!n||e.updateProps(c(n))};return{onBeforeStart(t){n=t,r=0;let s=Fn(()=>n,`composer-mention`);i.popup=s.popup,a=s.doPosition,o=s.reveal,e=new Rn(HS,{props:c(t),editor:t.editor}),s.popup.appendChild(e.element),i.stopAutoUpdate=s.startAutoUpdate()},onStart(e){n=e,r=0,l(),o?.()},onUpdate(e){n=e,r=Math.min(r,Math.max(0,e.items.length-1)),l(),a?.()},onKeyDown({event:e}){if(!n)return!1;let t=n.items;if(e.key===`ArrowDown`)return t.length===0?!1:(r=(r+1)%t.length,l(),!0);if(e.key===`ArrowUp`)return t.length===0?!1:(r=(r-1+t.length)%t.length,l(),!0);if(e.key===`Enter`||e.key===`Tab`){let e=t[r];return e?(n.command(e),!0):!1}return!1},onExit(){Pn(i),a=null,o=null,e?.destroy(),e=null,n=null,r=0,t.reset()}}}})}function tC(e){let t=[],n=new Set,r=[];return e.state.doc.forEach(e=>{let i=``;e.forEach(e=>{if(e.type.name===`composerMention`){let r=String(e.attrs.path??``);r!==``&&(i+=`@${r}`,n.has(r)||(n.add(r),t.push(r)))}else e.isText?i+=e.text??``:e.type.name===`hardBreak`&&(i+=`
13
13
  `)}),r.push(i)}),{instruction:r.join(`
14
- `).trim(),mentions:t}}function nC(e){let{instruction:t,mentions:n}=tC(e);return t===``&&n.length===0}function rC(e){let t=e?.content;return!Array.isArray(t)||t.length===0?!1:t.some(e=>Array.isArray(e.content)&&e.content.length>0)}function iC(e){let t=(0,$.c)(29),{ref:n,ariaLabel:r,onEmptyChange:i,onContentChange:a,onMentionsChange:o,onSubmit:s,className:c,placeholder:l,initialDoc:u}=e,d=(0,Q.useRef)(i),f=(0,Q.useRef)(a),p=(0,Q.useRef)(o),m=(0,Q.useRef)(s),h;t[0]!==a||t[1]!==i||t[2]!==o||t[3]!==s?(h=()=>{d.current=i,f.current=a,p.current=o,m.current=s},t[0]=a,t[1]=i,t[2]=o,t[3]=s,t[4]=h):h=t[4],(0,Q.useEffect)(h);let g;t[5]===l?g=t[6]:(g=QS({placeholder:l}),t[5]=l,t[6]=g);let _=u??void 0,v;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(v=$t(`composer-prosemirror py-1 outline-none`),t[7]=v):v=t[7];let y;t[8]===r?y=t[9]:(y={role:`textbox`,"aria-label":r,"aria-multiline":`true`,class:v},t[8]=r,t[9]=y);let b;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(b=(e,t)=>t.key===`Escape`?WS.getState(e.state)?.active?!1:(e.dom.blur(),!0):t.key===`Enter`&&!t.shiftKey&&!t.isComposing&&!e.composing?WS.getState(e.state)?.active?!1:(m.current(),!0):!1,t[10]=b):b=t[10];let x;t[11]===y?x=t[12]:(x={attributes:y,handleKeyDown:b},t[11]=y,t[12]=x);let S;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(S=e=>{let{editor:t}=e;d.current(nC(t)),f.current?.(t.getJSON()),p.current?.(tC(t).mentions)},t[13]=S):S=t[13];let C;t[14]!==g||t[15]!==_||t[16]!==x?(C={extensions:g,content:_,immediatelyRender:!0,editorProps:x,onUpdate:S},t[14]=g,t[15]=_,t[16]=x,t[17]=C):C=t[17];let w=Zn(C),T;t[18]!==w||t[19]!==u?(T=()=>{w&&(nC(w)&&rC(u)&&(console.warn(`composer draft was incompatible with the current schema — clearing it`),LS()),d.current(nC(w)),p.current?.(tC(w).mentions))},t[18]=w,t[19]=u,t[20]=T):T=t[20];let E;t[21]===w?E=t[22]:(E=[w],t[21]=w,t[22]=E),(0,Q.useEffect)(T,E);let D,O;t[23]===w?(D=t[24],O=t[25]):(D=()=>({focus:()=>w?.commands.focus(),blur:()=>w?.commands.blur(),clear:()=>w?.commands.clearContent(!0),setText:e=>{w&&(w.commands.setContent(e),f.current?.(w.getJSON()),p.current?.(tC(w).mentions))},getContent:()=>w?tC(w):{instruction:``,mentions:[]}}),O=[w],t[23]=w,t[24]=D,t[25]=O),(0,Q.useImperativeHandle)(n,D,O);let k;return t[26]!==c||t[27]!==w?(k=(0,Z.jsx)(Vn,{editor:w,className:c}),t[26]=c,t[27]=w,t[28]=k):k=t[28],k}function aC(e,t,n){return e.trim().length>0||t.length>0||n}new Set(Ki.map(e=>e.id));function oC(e,t){Cc(e,t)}function sC(e){let t=(0,$.c)(2),{agentName:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(J,{id:`5PrrYw`,values:{agentName:n}}),t[0]=n,t[1]=r),r}function cC(e){let t=(0,$.c)(29),{scenario:n,className:r}=e,{_:i}=vt(),{states:a,refresh:o}=Ks(),s=Wi(),{dispatch:c}=Bs(),l=Ju(),u=Vs(),[d,f]=(0,Q.useState)(uC),p=Ii(),m=Ri(),h;t[0]===s?h=t[1]:(h=e=>qi(s,e.source,e.id,!0,e.supported),t[0]=s,t[1]=h);let g=m.filter(h),_=Fi(g,p),v;t[2]===u?.installedClis?v=t[3]:(v=u?.installedClis??{},t[2]=u?.installedClis,t[3]=v);let y=Yc({sticky:d,effectiveThreadAgent:_,enabledClis:u===null?[]:Kc(s,u.installedClis),enabledDesktopTargets:Dc(s),installedClis:v,terminalAvailable:u!==null,threadsAvailable:!0,desktopSelectable:!0}),b=y.kind===`thread`,x=y.kind===`cli`?y.cli:null,S=y.kind===`desktop`?y.target:null,C=x!==null,w=(0,Q.useRef)(null),[T]=(0,Q.useState)(lC),[E,D]=(0,Q.useState)(!0),[O,k]=(0,Q.useState)(!1),A;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(e){D(e),e||k(!1)},t[4]=A):A=t[4];let j=A,M=SS(n),N;t[5]===s?N=t[6]:(N=e=>Zi(s,e.id),t[5]=s,t[6]=N);let P=Ki.filter(N),F=Ki.every(e=>a[e.id]?.installed!=null),I=u!==null&&Kc(s,u.installedClis).length>0,L=F&&P.length===0&&g.length===0&&!I,R;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(R=function(e){f(e),Cc(e),oC(e)},t[7]=R):R=t[7];let z=R,B;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(B=function(e){f(Sc(e)),Cc(Sc(e))},t[8]=B):B=t[8];let V=B,H;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(H=function(e){zi(e),f(xc),Cc(xc)},t[9]=H):H=t[9];let U=H,W=function(){let{instruction:e,mentions:t}=w.current?.getContent()??{instruction:``,mentions:[]};if(!aC(e,t,!1)){k(!0);return}let r=Hs({workspace:l,description:e,scenario:n,mentions:t});r!==null&&(nc(r,_===null?void 0:{agent:{source:_.source,id:_.id}}),w.current?.clear(),LS())},ee=function(){if(u===null||x===null)return;let{instruction:e,mentions:t}=w.current?.getContent()??{instruction:``,mentions:[]};if(!aC(e,t,!1)){k(!0);return}let r=Hs({workspace:l,description:e,scenario:n,mentions:t});r!==null&&(u.launchInTerminal(r,x),w.current?.clear(),LS())},G=function(e){let{instruction:t,mentions:r}=w.current?.getContent()??{instruction:``,mentions:[]};if(!aC(t,r,!1)){k(!0);return}if(oC(e),a[e]?.installed!==!0){let t=Ki.find(t=>t.id===e);t&&ec(t);return}let i=Hs({workspace:l,description:t,scenario:n,mentions:r});i!==null&&(c(e,i),w.current?.clear(),LS())},K=function(){b?W():C?ee():S!==null&&G(S)},te=function(e){w.current?.setText(e),w.current?.focus()};if(L){let e;t[10]===r?e=t[11]:(e=$t(`flex w-full flex-wrap items-center justify-between gap-3 rounded-2xl border border-border/60 bg-card px-4 py-3`,r),t[10]=r,t[11]=e);let n;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(oc,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`}),t[12]=n):n=t[12];let i;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[n,(0,Z.jsx)(`span`,{className:`text-1sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`XT-L4j`})})]}),t[13]=i):i=t[13];let a;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsxs)(Y,{type:`button`,variant:`outline`,size:`sm`,onClick:ea,className:`gap-1.5`,"data-testid":`create-configure-agents`,children:[(0,Z.jsx)(nl,{"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(J,{id:`jRAGrQ`})]}),t[14]=a):a=t[14];let o;return t[15]===e?o=t[16]:(o=(0,Z.jsxs)(`div`,{className:e,"data-testid":`create-no-agents`,children:[i,a]}),t[15]=e,t[16]=o),o}let ne=u?Kc(s,u.installedClis):[],re=P.length>0,ie=ne.length>0,ae=g.length>0,oe=y.kind!==`none`,se;t[17]===r?se=t[18]:(se=$t(`flex w-full flex-col gap-3`,r),t[17]=r,t[18]=se);let ce;t[19]===i?ce=t[20]:(ce=i({id:`7hctf2`}),t[19]=i,t[20]=ce);let le;t[21]===i?le=t[22]:(le=i({id:`0jD-Gn`}),t[21]=i,t[22]=le);let ue;t[23]!==E||t[24]!==O?(ue=O&&E?(0,Z.jsx)(`p`,{role:`alert`,className:`text-1sm text-destructive`,"data-testid":`create-input-required`,children:(0,Z.jsx)(J,{id:`1FLarN`})}):(0,Z.jsx)(`span`,{}),t[23]=E,t[24]=O,t[25]=ue):ue=t[25];let de=oe?(0,Z.jsxs)(zS,{children:[(0,Z.jsx)(Y,{type:`button`,onClick:()=>b?W():C?ee():S===null?void 0:G(S),variant:`outline`,className:`gap-1.5`,"data-testid":`create-with-agent`,children:b&&_!==null?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(fs,{agentId:_.id,iconUrl:_.iconUrl,className:`size-3.5`}),(0,Z.jsx)(sC,{agentName:_.name})]}):C&&x!==null?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ji,{id:Vi(x),"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(J,{id:`4rjwLG`,values:{0:Da[x].displayName}})]}):S===null?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ji,{id:S,"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(J,{id:`9dw5bW`,values:{0:Rs(S)}})]})}),(0,Z.jsxs)(Br,{onOpenChange:e=>{e&&o()},children:[(0,Z.jsx)(Pr,{asChild:!0,children:(0,Z.jsx)(Y,{type:`button`,"aria-label":i({id:`nskygk`}),size:`icon`,variant:`outline`,"data-testid":`create-with-agent-menu`,children:(0,Z.jsx)(ks,{"aria-hidden":`true`,className:`size-3.5`})})}),(0,Z.jsxs)(Rr,{align:`end`,className:`max-h-80 min-w-[200px]`,children:[ae?(0,Z.jsxs)(Nr,{"aria-label":i({id:`vPKX2i`}),children:[(0,Z.jsxs)(Ir,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(J,{id:`RXEbZy`}),(0,Z.jsx)(Xi,{})]}),g.map(e=>(0,Z.jsxs)(Ar,{onSelect:()=>U(e),"data-testid":`create-agent-option-thread-${e.source}:${e.id}`,children:[(0,Z.jsx)(fs,{agentId:e.id,iconUrl:e.iconUrl,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1 truncate`,children:e.name}),b&&_!==null&&_.source===e.source&&_.id===e.id?(0,Z.jsx)(Ds,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},`${e.source}:${e.id}`))]}):null,ae&&(ie||re)?(0,Z.jsx)(Vr,{}):null,ie?(0,Z.jsxs)(Nr,{"aria-label":i({id:`ALhMYW`}),children:[(0,Z.jsx)(Ir,{children:(0,Z.jsx)(J,{id:`ALhMYW`})}),ne.map(e=>{let{displayName:t}=Da[e];return(0,Z.jsxs)(Ar,{onSelect:()=>V(e),"data-testid":`create-with-cli-${e}`,"aria-label":i({id:`QYfQdv`,values:{displayName:t}}),children:[(0,Z.jsx)(Ji,{id:Vi(e),"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:t}),x===e?(0,Z.jsx)(Ds,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e)})]}):null,re?(0,Z.jsxs)(Z.Fragment,{children:[ie?(0,Z.jsx)(Vr,{}):null,(0,Z.jsxs)(Nr,{"aria-label":i({id:`BBqGS9`}),children:[(0,Z.jsx)(Ir,{children:(0,Z.jsx)(J,{id:`BBqGS9`})}),P.map(e=>(0,Z.jsxs)(Ar,{onSelect:()=>z(e.id),"data-testid":`create-agent-option-${e.id}`,children:[(0,Z.jsx)(Ji,{id:e.id,"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:e.displayName}),!C&&e.id===S?(0,Z.jsx)(Ds,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.id))]})]}):null,(0,Z.jsx)(Vr,{}),(0,Z.jsxs)(Ar,{onSelect:ea,"data-testid":`create-agent-option-settings`,children:[(0,Z.jsx)(nl,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(J,{id:`jRAGrQ`})})]})]})]})]}):(0,Z.jsx)(Y,{type:`button`,variant:`outline`,disabled:!0,className:`gap-1.5`,"data-testid":`create-with-agent`,children:(0,Z.jsx)(J,{id:`hYgDIe`})}),fe;return t[26]!==ue||t[27]!==de?(fe=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 px-3 pb-3`,children:[ue,de]}),t[26]=ue,t[27]=de,t[28]=fe):fe=t[28],(0,Z.jsxs)(`div`,{className:se,children:[(0,Z.jsxs)(`div`,{onMouseDown:e=>rl(e,w),className:`flex w-full cursor-text flex-col rounded-2xl border border-border/60 bg-card shadow-sm transition-colors focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50`,children:[(0,Z.jsx)(iC,{ref:w,ariaLabel:ce,placeholder:le,onEmptyChange:j,onContentChange:IS,onSubmit:K,initialDoc:T,className:`max-h-96 overflow-y-auto px-4 py-3 text-sm leading-relaxed subtle-scrollbar [&_.ProseMirror]:min-h-16`}),fe]}),n!==`existing-repo`&&M.length>0?(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-1sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`I5685_`})}),M.map(e=>{let t=e.icon;return(0,Z.jsxs)(Y,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>te(e.prompt),className:`gap-1.5 rounded-md font-normal text-muted-foreground hover:text-foreground`,"data-testid":`create-suggestion-${e.id}`,children:[(0,Z.jsx)(t,{className:`size-3.5`,"aria-hidden":`true`}),e.label]},e.id)})]}):null]})}function lC(){return FS().doc??void 0}function uC(){return qc()}function dC(e){let t=(0,$.c)(12),{title:n,subtitle:r,celebrateSignal:i}=e,a;t[0]===i?a=t[1]:(a=(0,Z.jsx)(mp,{size:64,celebrateSignal:i}),t[0]=i,t[1]=a);let o;t[2]===n?o=t[3]:(o=(0,Z.jsx)(`h2`,{className:`text-2xl font-light tracking-tighter text-balance`,children:n}),t[2]=n,t[3]=o);let s;t[4]===r?s=t[5]:(s=r?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r}):null,t[4]=r,t[5]=s);let c;t[6]!==o||t[7]!==s?(c=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8];let l;return t[9]!==a||t[10]!==c?(l=(0,Z.jsxs)(`div`,{className:`flex flex-col items-start gap-3 @md/emptystate:flex-row @md/emptystate:items-center @md/emptystate:gap-4`,children:[a,c]}),t[9]=a,t[10]=c,t[11]=l):l=t[11],l}function fC({isOnboarding:e,isEmbedded:t}){return e?{title:{id:`6h4zVU`},subtitle:t?{id:`vGeNNQ`}:{id:`qpQwGC`}}:{title:{id:`FOGD7m`},subtitle:t?{id:`3DTatP`}:{id:`MqQoV-`}}}var pC=`open-knowledge:create-top-level-file`;function mC(e={}){window.dispatchEvent(new CustomEvent(pC,{detail:e}))}function hC(e){let t=t=>{let n=t.detail;e(n??{})};return window.addEventListener(pC,t),()=>window.removeEventListener(pC,t)}function gC(e){let t=(0,$.c)(28),{celebrateSignal:n,onAddStarterPack:r}=e,{_:i}=vt(),a=lc(),{title:o,subtitle:s}=fC({isOnboarding:!1,isEmbedded:a}),c=oi(),l;t[0]!==c.data||t[1]!==c.status?(l=c.status===`ready`?c.data:[],t[0]=c.data,t[1]=c.status,t[2]=l):l=t[2];let u=l,d=c.status===`loading`||c.status===`idle`,f=c.status===`error`,p=dC,m=i(o),h=i(s),g;t[3]!==p||t[4]!==n||t[5]!==m||t[6]!==h?(g=(0,Z.jsx)(p,{title:m,subtitle:h,celebrateSignal:n}),t[3]=p,t[4]=n,t[5]=m,t[6]=h,t[7]=g):g=t[7];let _;t[8]===a?_=t[9]:(_=a?(0,Z.jsx)(CS,{scenario:`existing-repo`}):(0,Z.jsx)(cC,{scenario:`existing-repo`}),t[8]=a,t[9]=_);let v;t[10]!==u||t[11]!==f||t[12]!==d?(v=d||f||u.length>0?(0,Z.jsx)(yC,{templates:u,loading:d,error:f,onSelect:vC}):null,t[10]=u,t[11]=f,t[12]=d,t[13]=v):v=t[13];let y,b;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(Kt,{"aria-hidden":`true`,className:`size-3`}),b=(0,Z.jsx)(J,{id:`IajAbS`}),t[14]=y,t[15]=b):(y=t[14],b=t[15]);let x;t[16]===r?x=t[17]:(x=(0,Z.jsxs)(Y,{onClick:r,variant:`link-muted`,size:`xs`,className:`font-mono text-xs uppercase tracking-wider`,children:[y,b]}),t[16]=r,t[17]=x);let S;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(Y,{variant:`link-muted`,className:`justify-end`,size:`sm`,onClick:_C,children:(0,Z.jsx)(J,{id:`L4Cdd9`,components:{0:(0,Z.jsx)(Ln,{"aria-hidden":`true`,className:`size-3`})}})}),t[18]=S):S=t[18];let C;t[19]===x?C=t[20]:(C=(0,Z.jsxs)(`div`,{className:`-mt-6 flex w-full items-center justify-between gap-4`,children:[x,S]}),t[19]=x,t[20]=C);let w;t[21]!==C||t[22]!==v?(w=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-8`,children:[v,C]}),t[21]=C,t[22]=v,t[23]=w):w=t[23];let T;return t[24]!==w||t[25]!==g||t[26]!==_?(T=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-8 py-12 max-w-5xl my-auto`,children:[g,_,w]}),t[24]=w,t[25]=g,t[26]=_,t[27]=T):T=t[27],T}function _C(){return mC({initialDir:``})}function vC(e,t){return mC({template:{folder:e,name:t}})}function yC(e){let t=(0,$.c)(25),{templates:n,loading:r,error:i,onSelect:a}=e,{_:o}=vt(),s;t[0]===o?s=t[1]:(s=o({id:`_8quCH`}),t[0]=o,t[1]=s);let c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`_8quCH`})}),t[2]=c):c=t[2];let l;t[3]!==o||t[4]!==i||t[5]!==r||t[6]!==n?(l=r||i?null:(0,Z.jsx)(fu,{className:`text-2xs`,variant:`gray`,"aria-label":o({id:`X7u0xR`,values:{0:n.length}}),children:n.length}),t[3]=o,t[4]=i,t[5]=r,t[6]=n,t[7]=l):l=t[7];let u;t[8]===l?u=t[9]:(u=(0,Z.jsxs)(`header`,{className:`flex items-center gap-2 font-mono text-2xs uppercase tracking-wider text-muted-foreground`,children:[c,l]}),t[8]=l,t[9]=u);let d;t[10]===o?d=t[11]:(d=o({id:`irFGwu`}),t[10]=o,t[11]=d);let f;t[12]!==i||t[13]!==r||t[14]!==a||t[15]!==n?(f=r?(0,Z.jsx)(`p`,{className:`p-4 text-1sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`Hl89Qd`})}):i?(0,Z.jsx)(`p`,{role:`alert`,className:`p-4 text-1sm text-destructive`,children:(0,Z.jsx)(J,{id:`54Y6Fg`})}):n.map(e=>(0,Z.jsx)(bC,{template:e,targetLabel:e.source_folder===``?`/`:`${e.source_folder}/`,onClick:()=>a(e.source_folder,e.name)},`${e.source_folder}/${e.name}`)),t[12]=i,t[13]=r,t[14]=a,t[15]=n,t[16]=f):f=t[16];let p;t[17]!==r||t[18]!==d||t[19]!==f?(p=(0,Z.jsx)(`div`,{className:`w-full overflow-hidden rounded-xl border border-border/60 bg-card`,children:(0,Z.jsx)(`section`,{"aria-busy":r,"aria-label":d,tabIndex:0,className:`subtle-scrollbar scroll-fade-mask flex max-h-[260px] w-full flex-col overflow-y-auto overscroll-contain focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50`,children:f})}),t[17]=r,t[18]=d,t[19]=f,t[20]=p):p=t[20];let m;return t[21]!==s||t[22]!==u||t[23]!==p?(m=(0,Z.jsxs)(`section`,{"aria-label":s,className:`flex w-full flex-col gap-3`,children:[u,p]}),t[21]=s,t[22]=u,t[23]=p,t[24]=m):m=t[24],m}function bC(e){let t=(0,$.c)(24),{template:n,targetLabel:r,onClick:i}=e,{_:a}=vt(),o;t[0]!==n.name||t[1]!==n.title?(o=n.title?.trim()||n.name,t[0]=n.name,t[1]=n.title,t[2]=o):o=t[2];let s=o,c=`${n.name}.md`,l=n.source_folder===``,u;t[3]!==a||t[4]!==s||t[5]!==c||t[6]!==l||t[7]!==r?(u=a(l?{id:`89TtiD`,values:{displayTitle:s,fileName:c}}:{id:`0_J12R`,values:{displayTitle:s,fileName:c,targetLabel:r}}),t[3]=a,t[4]=s,t[5]=c,t[6]=l,t[7]=r,t[8]=u):u=t[8];let d=u,f;t[9]===s?f=t[10]:(f=(0,Z.jsx)(`span`,{className:`truncate text-sm font-medium leading-tight text-foreground/80`,children:s}),t[9]=s,t[10]=f);let p;t[11]===c?p=t[12]:(p=(0,Z.jsx)(`span`,{className:`truncate font-mono text-1sm font-normal text-muted-foreground`,children:c}),t[11]=c,t[12]=p);let m;t[13]!==f||t[14]!==p?(m=(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-2`,children:[f,p]}),t[13]=f,t[14]=p,t[15]=m):m=t[15];let h=`shrink-0 font-mono text-1sm ${l?`text-muted-foreground/70`:`text-muted-foreground`}`,g;t[16]!==h||t[17]!==r?(g=(0,Z.jsx)(`span`,{className:h,children:r}),t[16]=h,t[17]=r,t[18]=g):g=t[18];let _;return t[19]!==d||t[20]!==i||t[21]!==m||t[22]!==g?(_=(0,Z.jsxs)(Y,{type:`button`,variant:`ghost`,onClick:i,"aria-label":d,className:`group flex h-auto w-full items-center justify-between gap-4 rounded-none p-4 text-left transition-colors hover:bg-muted/50 focus-visible:bg-muted/50`,children:[m,g]}),t[19]=d,t[20]=i,t[21]=m,t[22]=g,t[23]=_):_=t[23],_}function xC(e){let t=(0,$.c)(25),{terminalDock:n}=e,r=n===void 0?null:n,[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(void 0),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(0),f=(0,Q.useRef)(!1),p=(0,Q.useRef)(void 0),m,h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>{let e=!1,t=async function(){try{let{ok:t,body:n}=await Xl();if(e)return;let r=t?xo.safeParse(n):null;r?.success?(l(wC(r.data.documents)),f.current=!0):f.current||=(l(1),!0)}catch{!e&&!f.current&&(l(1),f.current=!0)}};t();let n=ql(e=>{e.includes(`files`)&&t()});return()=>{e=!0,n(),clearTimeout(p.current)}},h=[],t[0]=m,t[1]=h):(m=t[0],h=t[1]),(0,Q.useEffect)(m,h);let g;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(g=function(){clearTimeout(p.current),p.current=setTimeout(()=>d(CC),500),Xl().then(e=>{let{ok:t,body:n}=e;if(!t)return;let r=xo.safeParse(n);r.success&&l(wC(r.data.documents))}).catch(SC)},t[2]=g):g=t[2];let _=g,v=c!==null,y=c===0,b;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(b=function(e){a(e),e||s(void 0)},t[3]=b):b=t[3];let x=b;if(r!==null){let e=r===`bottom`?`justify-end`:`justify-center`,n;t[4]===e?n=t[5]:(n=$t(`@container/emptystate flex min-h-0 flex-1 flex-col items-center pb-8 pt-10`,e),t[4]=e,t[5]=n);let i;t[6]!==u||t[7]!==y||t[8]!==v?(i=v?(0,Z.jsx)(TC,{isOnboarding:y,celebrateSignal:u}):null,t[6]=u,t[7]=y,t[8]=v,t[9]=i):i=t[9];let a;t[10]===i?a=t[11]:(a=(0,Z.jsx)(`div`,{className:`flex w-full flex-col items-center px-4 @md/emptystate:px-10 @2xl/emptystate:px-16`,children:i}),t[10]=i,t[11]=a);let o;return t[12]!==n||t[13]!==a?(o=(0,Z.jsx)(`div`,{className:n,children:a}),t[12]=n,t[13]=a,t[14]=o):o=t[14],o}let S;t[15]!==u||t[16]!==y||t[17]!==v?(S=v?y?(0,Z.jsx)(EC,{celebrateSignal:u,onPackSelect:e=>{s(e),a(!0)}}):(0,Z.jsx)(gC,{celebrateSignal:u,onAddStarterPack:()=>{a(!0)}}):null,t[15]=u,t[16]=y,t[17]=v,t[18]=S):S=t[18];let C;t[19]!==o||t[20]!==i?(C=(0,Z.jsx)(U_,{open:i,onOpenChange:x,onSeedApplied:_,initialPackId:o}),t[19]=o,t[20]=i,t[21]=C):C=t[21];let w;return t[22]!==S||t[23]!==C?(w=(0,Z.jsx)(`div`,{className:`@container/emptystate flex min-h-0 flex-1 flex-col items-center overflow-y-auto subtle-scrollbar`,children:(0,Z.jsxs)(`div`,{className:`flex w-full flex-1 flex-col items-center px-4 @md/emptystate:px-10 @2xl/emptystate:px-16`,children:[S,C]})}),t[22]=S,t[23]=C,t[24]=w):w=t[24],w}function SC(){}function CC(e){return e+1}function wC(e){return Al(e).filter(e=>e.kind===`document`||e.kind===`folder`).length}function TC(e){let t=(0,$.c)(15),{isOnboarding:n,celebrateSignal:r}=e,{_:i}=vt(),a=lc(),o,s,c,l;if(t[0]!==i||t[1]!==a||t[2]!==n){let{title:e,subtitle:r}=fC({isOnboarding:n,isEmbedded:a});l=`w-full max-w-5xl`,o=dC,s=i(e),c=i(r),t[0]=i,t[1]=a,t[2]=n,t[3]=o,t[4]=s,t[5]=c,t[6]=l}else o=t[3],s=t[4],c=t[5],l=t[6];let u;t[7]!==o||t[8]!==r||t[9]!==s||t[10]!==c?(u=(0,Z.jsx)(o,{title:s,subtitle:c,celebrateSignal:r}),t[7]=o,t[8]=r,t[9]=s,t[10]=c,t[11]=u):u=t[11];let d;return t[12]!==l||t[13]!==u?(d=(0,Z.jsx)(`div`,{className:l,children:u}),t[12]=l,t[13]=u,t[14]=d):d=t[14],d}function EC(e){let t=(0,$.c)(29),{celebrateSignal:n,onPackSelect:r}=e,{_:i}=vt(),a=lc(),o,s,c,l;if(t[0]!==i||t[1]!==a){let{title:e,subtitle:n}=fC({isOnboarding:!0,isEmbedded:a});l=`flex w-full flex-col gap-10 py-12 max-w-5xl my-auto`,o=dC,s=i(e),c=i(n),t[0]=i,t[1]=a,t[2]=o,t[3]=s,t[4]=c,t[5]=l}else o=t[2],s=t[3],c=t[4],l=t[5];let u;t[6]!==o||t[7]!==n||t[8]!==s||t[9]!==c?(u=(0,Z.jsx)(o,{title:s,subtitle:c,celebrateSignal:n}),t[6]=o,t[7]=n,t[8]=s,t[9]=c,t[10]=u):u=t[10];let d;t[11]===a?d=t[12]:(d=a?(0,Z.jsx)(CS,{scenario:`new-project`}):(0,Z.jsx)(cC,{scenario:`new-project`}),t[11]=a,t[12]=d);let f;t[13]!==i||t[14]!==a?(f=i(a?{id:`GubkSu`}:{id:`xeXS4P`}),t[13]=i,t[14]=a,t[15]=f):f=t[15];let p;t[16]===f?p=t[17]:(p=(0,Z.jsx)(OC,{label:f}),t[16]=f,t[17]=p);let m;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(m=[`okf`,`entity-vault`],t[18]=m):m=t[18];let h;t[19]===r?h=t[20]:(h=(0,Z.jsx)(L_,{onPackSelect:r,onCreateBlankFile:DC,collapsedPackIds:m}),t[19]=r,t[20]=h);let g;t[21]!==p||t[22]!==h?(g=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-3`,children:[p,h]}),t[21]=p,t[22]=h,t[23]=g):g=t[23];let _;return t[24]!==g||t[25]!==l||t[26]!==u||t[27]!==d?(_=(0,Z.jsxs)(`div`,{className:l,children:[u,d,g]}),t[24]=g,t[25]=l,t[26]=u,t[27]=d,t[28]=_):_=t[28],_}function DC(){return mC()}function OC(e){let t=(0,$.c)(13),{label:n}=e,{_:r}=vt(),i;t[0]===n?i=t[1]:(i=(0,Z.jsx)(`span`,{className:`font-mono text-2xs uppercase tracking-wider text-muted-foreground whitespace-nowrap`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=r({id:`jAMpHn`}),t[2]=r,t[3]=a);let o;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(Xc,{className:`size-3.5`,"aria-hidden":!0}),t[4]=o):o=t[4];let s;t[5]===a?s=t[6]:(s=(0,Z.jsx)(ln,{className:`text-muted-foreground transition-colors hover:text-foreground`,"aria-label":a,"data-testid":`starter-pack-info`,children:o}),t[5]=a,t[6]=s);let c;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(un,{className:`max-w-xs`,children:(0,Z.jsx)(`p`,{className:`leading-relaxed wrap-break-word`,children:(0,Z.jsx)(J,{id:`k4CuuV`})})}),t[7]=c):c=t[7];let l;t[8]===s?l=t[9]:(l=(0,Z.jsxs)(fn,{children:[s,c]}),t[8]=s,t[9]=l);let u;return t[10]!==i||t[11]!==l?(u=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[i,l]}),t[10]=i,t[11]=l,t[12]=u):u=t[12],u}function kC(e){return e===``?`.ok/frontmatter.yml`:`${e}/.ok/frontmatter.yml`}function AC(e){let t=(0,$.c)(70),{folderPath:n,state:r,onChange:i}=e,{_:a}=vt(),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(null);if(r.status===`idle`||r.status===`loading`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card p-4 space-y-3`,children:[(0,Z.jsx)(MC,{}),(0,Z.jsx)(Cd,{className:`h-7 w-full`}),(0,Z.jsx)(Cd,{className:`h-7 w-full`}),(0,Z.jsx)(Cd,{className:`h-7 w-full`})]}),t[0]=e):e=t[0],e}if(r.status===`error`){let{message:e}=r,n;return t[1]===e?n=t[2]:(n=(0,Z.jsx)(`section`,{className:`rounded-lg border border-destructive/30 bg-destructive/5 p-4 text-sm text-destructive`,role:`alert`,children:(0,Z.jsx)(J,{id:`lzmtKp`,values:{message:e}})}),t[1]=e,t[2]=n),n}let f;t[3]===r.data.frontmatterLocal?f=t[4]:(f=r.data.frontmatterLocal??{},t[3]=r.data.frontmatterLocal,t[4]=f);let p=f,m;t[5]===r.data.folder.path?m=t[6]:(m=kC(r.data.folder.path),t[5]=r.data.folder.path,t[6]=m);let h=m,g;t[7]===p?g=t[8]:(g=Object.keys(p),t[7]=p,t[8]=g);let _=g,v;t[9]!==a||t[10]!==n||t[11]!==i?(v=async function(e,t){let r=await vc(n,{[e]:t});if(!r.ok){let{error:e}=r;X.error(a({id:`xXo8FT`,values:{error:e}}));return}i()},t[9]=a,t[10]=n,t[11]=i,t[12]=v):v=t[12];let y=v,b;t[13]!==a||t[14]!==n||t[15]!==i?(b=async function(e){let t=await vc(n,{[e]:null});if(!t.ok){let{error:e}=t;X.error(a({id:`ZU8VV_`,values:{error:e}}));return}i()},t[13]=a,t[14]=n,t[15]=i,t[16]=b):b=t[16];let x=b,S;t[17]!==y||t[18]!==p?(S=function(e,t){let n=p[e];y(e,gs(n,t))},t[17]=y,t[18]=p,t[19]=S):S=t[19];let C=S,w;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(w=function(){l({name:``,type:`text`,value:``,error:null}),s(!1)},t[20]=w):w=t[20];let T=w,E;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(E=function(e){l(t=>{if(!t)return t;let n=e===`date`?new Date().toISOString().slice(0,10):Es[e];return{...t,type:e,value:n,error:null}})},t[21]=E):E=t[21];let D=E,O;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(O=function(e){l(t=>t&&{...t,value:e})},t[22]=O):O=t[22];let k=O,A;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(e){l(t=>t&&{...t,name:e,error:null})},t[23]=A):A=t[23];let j=A,M;t[24]!==a||t[25]!==c||t[26]!==n||t[27]!==i||t[28]!==p?(M=async function(e){if(!c)return;let t=e??c.value,r=c.name.trim();if(!r){l({...c,value:t,error:a({id:`8_brI5`})});return}if(To(t)){l({...c,value:t,error:a({id:`hXUWyd`})});return}if(Object.hasOwn(p,r)){l({...c,value:t,error:a({id:`CTJLpz`,values:{trimmed:r}})});return}let o=await vc(n,{[r]:t});if(!o.ok){l({...c,value:t,error:o.error});return}l(null),i()},t[24]=a,t[25]=c,t[26]=n,t[27]=i,t[28]=p,t[29]=M):M=t[29];let N=M,P;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(P=function(e){d({key:e,draft:e,error:null})},t[30]=P):P=t[30];let F=P,I;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(I=function(e){d(t=>t&&{...t,draft:e,error:null})},t[31]=I):I=t[31];let L=I,R;t[32]!==a||t[33]!==n||t[34]!==i||t[35]!==p||t[36]!==u?(R=async function(){if(!u)return;let e=u.draft.trim();if(!e){d({...u,error:a({id:`8_brI5`})});return}if(e===u.key){d(null);return}if(Object.hasOwn(p,e)){d({...u,error:a({id:`CTJLpz`,values:{trimmed:e}})});return}let t=p[u.key],r=await vc(n,{[u.key]:null,[e]:t});if(!r.ok){d({...u,error:r.error});return}d(null),i()},t[32]=a,t[33]=n,t[34]=i,t[35]=p,t[36]=u,t[37]=R):R=t[37];let z=R,B;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(B=function(){d(null)},t[38]=B):B=t[38];let V=B,H=!o,U;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(U=e=>s(!e),t[39]=U):U=t[39];let W=`size-3 transition-transform ${o?``:`rotate-90`}`,ee;t[40]===W?ee=t[41]:(ee=(0,Z.jsx)(As,{className:W,"aria-hidden":!0}),t[40]=W,t[41]=ee);let G;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`vQIVHc`})}),t[42]=G):G=t[42];let K;t[43]===ee?K=t[44]:(K=(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:[ee,G]}),t[43]=ee,t[44]=K);let te;t[45]===h?te=t[46]:(te=(0,Z.jsx)(`code`,{className:`text-xs text-muted-foreground font-mono cursor-text select-text`,onClick:jC,children:h}),t[45]=h,t[46]=te);let ne;t[47]!==K||t[48]!==te?(ne=(0,Z.jsxs)(mn,{className:`flex w-full cursor-pointer items-center justify-between gap-2 px-3 py-2.5 data-[state=open]:border-b border-border`,children:[K,te]}),t[47]=K,t[48]=te,t[49]=ne):ne=t[49];let re;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Z.jsx)(`p`,{className:`px-1 pb-2 text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`hSBIG-`})}),t[50]=re):re=t[50];let ie;t[51]!==c||t[52]!==y||t[53]!==z||t[54]!==_||t[55]!==p||t[56]!==x||t[57]!==u||t[58]!==C?(ie=_.length===0&&!c?(0,Z.jsx)(`p`,{className:`px-1 py-1 text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`4c_a6S`})}):_.map(e=>{let t=p[e];return(0,Z.jsx)(ws,{keyName:e,value:t,declared:ys(t,co(t)),rename:{state:u?.key===e?u:null,onBegin:()=>F(e),onChangeDraft:L,onCommit:z,onCancel:V},badge:null,onCommit:t=>void y(e,t),onChangeType:t=>C(e,t),onRemove:()=>void x(e)},e)}),t[51]=c,t[52]=y,t[53]=z,t[54]=_,t[55]=p,t[56]=x,t[57]=u,t[58]=C,t[59]=ie):ie=t[59];let ae;t[60]!==c||t[61]!==N?(ae=c?(0,Z.jsx)(xs,{draft:c,onChangeName:j,onChangeType:D,onChangeValue:k,onCommit:e=>void N(e),onCancel:()=>l(null)}):(0,Z.jsx)(`div`,{className:`mt-1 flex flex-wrap items-center gap-1`,children:(0,Z.jsxs)(Y,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`add-property-trigger`,onClick:()=>T(),className:`flex items-center gap-1.5 rounded px-2 py-1 font-medium text-sm hover:bg-muted/50 hover:text-foreground`,children:[(0,Z.jsx)(Kt,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`G8t9NN`})})]})}),t[60]=c,t[61]=N,t[62]=ae):ae=t[62];let oe;t[63]!==ie||t[64]!==ae?(oe=(0,Z.jsx)(pn,{children:(0,Z.jsxs)(`div`,{className:`px-2 py-2`,children:[re,ie,ae]})}),t[63]=ie,t[64]=ae,t[65]=oe):oe=t[65];let se;return t[66]!==H||t[67]!==ne||t[68]!==oe?(se=(0,Z.jsx)(`section`,{className:`rounded-lg border bg-card`,children:(0,Z.jsxs)(hn,{open:H,onOpenChange:U,children:[ne,oe]})}),t[66]=H,t[67]=ne,t[68]=oe,t[69]=se):se=t[69],se}function jC(e){return e.stopPropagation()}function MC(){let e=(0,$.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(Qm,{className:`size-4 text-muted-foreground`,"aria-hidden":!0}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[t,(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(J,{id:`vQIVHc`})})]}),e[1]=n):n=e[1],n}function NC(e){let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);return t<60?yl._({id:`xOTzt5`}):t<3600?yl._({id:`zbymaY`,values:{0:Math.floor(t/60)}}):t<86400?yl._({id:`optX0N`,values:{0:Math.floor(t/3600)}}):t<86400*7?yl._({id:`l1l8sj`,values:{0:Math.floor(t/86400)}}):new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function PC(e){return(e.split(`/`).pop()??e).replace(/\.md$/,``)}function FC(e){let t=e.message,n=t.indexOf(`: `),r=n===-1?t:t.slice(0,n),i=n===-1?``:t.slice(n+2);switch(r){case`template-create`:return{Icon:Oi,label:yl._({id:`QR5SP1`}),detail:PC(i)};case`template-edit`:return{Icon:fc,label:yl._({id:`-LHLx7`}),detail:PC(i)};case`template-delete`:return{Icon:ol,label:yl._({id:`_gkGSK`}),detail:PC(i)};case`template-rename`:case`template-move`:{let[e,t]=i.split(` -> `);return{Icon:Am,label:yl._({id:`KPW5WC`}),detail:`${PC(e??``)} → ${PC(t??i)}`}}case`folder-frontmatter-edit`:return{Icon:Qm,label:yl._({id:`_tekeB`}),detail:``};case`folder-frontmatter-delete`:return{Icon:Qm,label:yl._({id:`ZWxfrc`}),detail:``};case`folder-create`:return{Icon:Qm,label:yl._({id:`ZQLDTl`}),detail:``};default:return{Icon:Tc,label:r.replace(/-/g,` `),detail:PC(i)}}}function IC(e){return e.contributors.length>0?e.contributors[0].name:e.author===`openknowledge-service`||e.author===`server`?yl._({id:`B2DrPb`}):e.author||yl._({id:`Ef7StM`})}function LC(e){let t=(0,$.c)(15),{folderPath:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=[],t[0]=r):r=t[0];let[i,a]=(0,Q.useState)(r),[o,s]=(0,Q.useState)(!0),[c,l]=(0,Q.useState)(!1),u,d;if(t[1]===n?(u=t[2],d=t[3]):(u=()=>{let e=!1,t=async function(){try{let t=await fetch(`/api/history?folder=${encodeURIComponent(n)}&limit=50`);if(e)return;if(!t.ok){l(!0),s(!1);return}let r=await t.json();if(e)return;a(r.entries??[]),l(!1),s(!1)}catch(t){e||(console.warn(`[FolderTimelineCard] failed to load folder timeline:`,t),l(!0),s(!1))}};s(!0),t();let r=Gl(t);return()=>{e=!0,r()}},d=[n],t[1]=n,t[2]=u,t[3]=d),(0,Q.useEffect)(u,d),c||!o&&i.length===0)return null;let f;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(J,{id:`XJOV1Y`})}),t[4]=f):f=t[4];let p;t[5]===i.length?p=t[6]:(p=i.length>0?(0,Z.jsx)(fu,{className:`text-xs`,variant:`secondary`,children:i.length}):null,t[5]=i.length,t[6]=p);let m;t[7]===p?m=t[8]:(m=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border px-3 py-1`,children:[f,p]}),t[7]=p,t[8]=m);let h;t[9]!==i||t[10]!==o?(h=(0,Z.jsx)(`div`,{className:`px-3 py-2.5`,children:o?(0,Z.jsxs)(`div`,{className:`space-y-2`,role:`status`,"aria-busy":`true`,children:[(0,Z.jsx)(Cd,{className:`h-8 w-full`}),(0,Z.jsx)(Cd,{className:`h-8 w-full`})]}):(0,Z.jsx)(`ul`,{className:`space-y-1`,children:i.map(RC)})}),t[9]=i,t[10]=o,t[11]=h):h=t[11];let g;return t[12]!==m||t[13]!==h?(g=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card`,"data-testid":`folder-timeline-card`,children:[m,h]}),t[12]=m,t[13]=h,t[14]=g):g=t[14],g}function RC(e){let{Icon:t,label:n,detail:r}=FC(e);return(0,Z.jsxs)(`li`,{className:`flex items-center gap-2.5 rounded-md px-2 py-1.5 text-sm`,children:[(0,Z.jsx)(t,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":!0}),(0,Z.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[(0,Z.jsx)(`span`,{className:`text-foreground`,children:n}),r?(0,Z.jsx)(`code`,{className:`ml-1.5 font-mono text-xs text-muted-foreground`,children:r}):null]}),(0,Z.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1 text-xs text-muted-foreground`,children:[(0,Z.jsx)(Wh,{className:`size-3`,"aria-hidden":!0}),IC(e)]}),(0,Z.jsx)(`time`,{className:`shrink-0 text-xs text-muted-foreground/80`,dateTime:e.timestamp,title:new Date(e.timestamp).toLocaleString(),children:NC(e.timestamp)})]},e.sha)}function zC(e){let t=e.split(`/`).pop();return t?`${e}/${t}`:null}function BC(e,t){let n=t.get(`${e}/index`);if(n)return n;let r=zC(e);if(r){let e=t.get(r);if(e)return e}return e.split(`/`).pop()??e}function VC(e,t,n){let r=n.get(e);return r&&r!==e?r:t}function HC(e,t){let n=e===``?``:`${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:BC(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:VC(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:BC(e,t.pageTitles),children:a}}function UC(e){let t=(0,$.c)(41),{folderPath:n,state:r,onChange:i,folderConfigHandle:a}=e,[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(!1);if(r.status===`idle`||r.status===`loading`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card px-3 py-2.5 space-y-3`,children:[(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(J,{id:`-QCLWk`})})}),(0,Z.jsx)(Cd,{className:`h-12 w-full`}),(0,Z.jsx)(Cd,{className:`h-12 w-full`})]}),t[0]=e):e=t[0],e}if(r.status===`error`){let{message:e}=r,n;return t[1]===e?n=t[2]:(n=(0,Z.jsx)(`section`,{className:`rounded-lg border border-destructive/30 bg-destructive/5 p-4 text-sm text-destructive`,role:`alert`,children:(0,Z.jsx)(J,{id:`iDZtvM`,values:{message:e}})}),t[1]=e,t[2]=n),n}let f;t[3]===r.data.folder.templates_available?f=t[4]:(f=r.data.folder.templates_available??[],t[3]=r.data.folder.templates_available,t[4]=f);let p=f,m;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(J,{id:`-QCLWk`})}),t[5]=m):m=t[5];let h;t[6]===p.length?h=t[7]:(h=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[m,(0,Z.jsx)(fu,{className:`text-xs`,variant:`secondary`,children:p.length})]}),t[6]=p.length,t[7]=h);let g;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsxs)(Y,{variant:`ghost`,className:`font-mono uppercase`,size:`sm`,onClick:()=>d(!0),children:[(0,Z.jsx)(Kt,{className:`size-3.5`,"aria-hidden":!0}),(0,Z.jsx)(J,{id:`G1Gw0v`})]}),t[8]=g):g=t[8];let _;t[9]===h?_=t[10]:(_=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-border px-3 py-1`,children:[h,g]}),t[9]=h,t[10]=_);let v;t[11]===p?v=t[12]:(v=(0,Z.jsx)(`div`,{className:`px-3 py-2.5`,children:p.length===0?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`MZSBsh`})}):(0,Z.jsx)(`ul`,{className:`space-y-1`,children:p.map(e=>(0,Z.jsx)($r,{template:e,onCreate:()=>l(e.name),onEdit:()=>yc(et(e.source_folder,e.name)),onDelete:()=>s(e),badge:e.scope===`inherited`?(0,Z.jsx)(ms,{source:e.source_folder,target:`templates/${e.name}.md`}):void 0},e.path))})}),t[11]=p,t[12]=v);let y;t[13]!==_||t[14]!==v?(y=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card`,children:[_,v]}),t[13]=_,t[14]=v,t[15]=y):y=t[15];let b;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(b=e=>{e||s(null)},t[16]=b):b=t[16];let x;t[17]!==o||t[18]!==i?(x=(0,Z.jsx)(ti,{template:o,onOpenChange:b,onDeleted:i}),t[17]=o,t[18]=i,t[19]=x):x=t[19];let S;t[20]===p?S=t[21]:(S=new Set(p.map(WC)),t[20]=p,t[21]=S);let C;t[22]!==n||t[23]!==i?(C=e=>{i(),yc(et(n,e))},t[22]=n,t[23]=i,t[24]=C):C=t[24];let w;t[25]!==n||t[26]!==u||t[27]!==S||t[28]!==C?(w=(0,Z.jsx)(si,{folderPath:n,existingNames:S,open:u,onOpenChange:d,onCreated:C}),t[25]=n,t[26]=u,t[27]=S,t[28]=C,t[29]=w):w=t[29];let T=c!==null,E;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(E=e=>{e||l(null)},t[30]=E):E=t[30];let D=c??void 0,O;t[31]!==a||t[32]!==n||t[33]!==T||t[34]!==D?(O=(0,Z.jsx)(h_,{open:T,onOpenChange:E,kind:`file`,initialDir:n,initialTemplate:D,folderConfig:a}),t[31]=a,t[32]=n,t[33]=T,t[34]=D,t[35]=O):O=t[35];let k;return t[36]!==w||t[37]!==O||t[38]!==y||t[39]!==x?(k=(0,Z.jsxs)(Z.Fragment,{children:[y,x,w,O]}),t[36]=w,t[37]=O,t[38]=y,t[39]=x,t[40]=k):k=t[40],k}function WC(e){return e.name}function GC(e){let t=(0,$.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=$t(`relative w-full overflow-x-auto subtle-scrollbar`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=$t(`w-full caption-bottom text-sm`,n),t[6]=n,t[7]=o);let s;t[8]!==i||t[9]!==o?(s=(0,Z.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,Z.jsx)(`div`,{"data-slot":`table-container`,className:a,children:s}),t[11]=a,t[12]=s,t[13]=c):c=t[13],c}function KC(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=$t(`[&_tr]:border-b`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`thead`,{"data-slot":`table-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function qC(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=$t(`[&_tr:last-child]:border-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`tbody`,{"data-slot":`table-body`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function JC(e){let t=(0,$.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=$t(`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,Z.jsx)(`tr`,{"data-slot":`table-row`,className:o,...r}),t[7]=r,t[8]=o,t[9]=s):s=t[9],s}function YC(e){let t=(0,$.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=$t(`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,Z.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 XC(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=$t(`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,Z.jsx)(`td`,{"data-slot":`table-cell`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function ZC(e){if(!e)return`—`;let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/6e4);if(r<1)return yl._({id:`xOTzt5`});if(r<60)return yl._({id:`NRSLBe`,values:{diffMin:r}});let i=Math.floor(r/60);if(i<24)return yl._({id:`hDKtoF`,values:{diffHrs:i}});let a=Math.floor(i/24);return a<30?yl._({id:`QDZbvN`,values:{diffDays:a}}):t.toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`numeric`})}function QC(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 $C(e){let t=(0,$.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,Z.jsx)(Un,{className:`ml-1 size-3`}):(0,Z.jsx)(tr,{className:`ml-1 size-3`}):(0,Z.jsx)(jm,{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,Z.jsxs)(Y,{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 ew(e){let t=(0,$.c)(96),{folderPath:n}=e,{_:r}=vt(),{folderPaths:i,loading:a,pages:o,pageTitles:s,pageMeta:c}=Ns(),l=Gr(n),{state:u,refresh:d}=l,[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(`name`),[g,_]=(0,Q.useState)(`asc`);if(a){let e;t[0]===r?e=t[1]:(e=r({id:`X9VpsP`}),t[0]=r,t[1]=e);let n;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(Cd,{className:`size-5 rounded`}),(0,Z.jsx)(Cd,{className:`h-7 w-48`})]}),(0,Z.jsx)(Cd,{className:`h-9 w-20 rounded-md`})]}),t[2]=n):n=t[2];let i;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(Cd,{className:`h-4 w-16`}),t[3]=i):i=t[3];let a;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsxs)(`div`,{className:`mx-auto flex w-full max-w-4xl flex-col gap-6 px-6 py-8`,children:[n,(0,Z.jsxs)(`div`,{className:`rounded-lg border`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-4 border-b px-4 py-3`,children:[i,(0,Z.jsx)(`div`,{className:`ml-auto`,children:(0,Z.jsx)(Cd,{className:`h-4 w-20`})})]}),[`a`,`b`,`c`,`d`].map(rw)]})]}),t[4]=a):a=t[4];let o;return t[5]===e?o=t[6]:(o=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-start overflow-y-auto subtle-scrollbar`,role:`status`,"aria-busy":`true`,"aria-label":e,children:a}),t[5]=e,t[6]=o),o}let v,y,b,x,S,C,w,T,E,D,O;if(t[7]!==r||t[8]!==u||t[9]!==l||t[10]!==n||t[11]!==i||t[12]!==c||t[13]!==s||t[14]!==o||t[15]!==d||t[16]!==g||t[17]!==m){let e=HC(n,{pages:o,pageTitles:s,pageMeta:c,folderPaths:i}),a=QC(e.children,m,g),f=e.title||(n===``?r({id:`3aeN7X`}):e.title),k;t[29]===m?k=t[30]:(k=function(e){e===m?_(nw):(h(e),_(`asc`))},t[29]=m,t[30]=k);let A=k;O=`flex min-h-0 flex-1 items-start overflow-y-auto subtle-scrollbar`,C=`mx-auto flex w-full max-w-4xl flex-col gap-6 px-6 py-8`;let j;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Z.jsx)(gc,{className:`size-5 text-muted-foreground`}),t[31]=j):j=t[31];let M=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[j,(0,Z.jsx)(`h1`,{className:`text-2xl font-light tracking-tight`,children:f})]}),N;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsxs)(Y,{onClick:()=>p(!0),children:[(0,Z.jsx)(Kt,{className:`size-4`}),(0,Z.jsx)(J,{id:`isRobC`})]}),t[32]=N):N=t[32],t[33]===M?w=t[34]:(w=(0,Z.jsx)(`div`,{className:`flex flex-col gap-6`,children:(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[M,N]})}),t[33]=M,t[34]=w),t[35]!==u||t[36]!==n||t[37]!==d?(T=(0,Z.jsx)(AC,{folderPath:n,state:u,onChange:d}),t[35]=u,t[36]=n,t[37]=d,t[38]=T):T=t[38],t[39]!==u||t[40]!==l||t[41]!==n||t[42]!==d?(E=(0,Z.jsx)(UC,{folderPath:n,state:u,onChange:d,folderConfigHandle:l}),t[39]=u,t[40]=l,t[41]=n,t[42]=d,t[43]=E):E=t[43],t[44]===n?D=t[45]:(D=(0,Z.jsx)(LC,{folderPath:n}),t[44]=n,t[45]=D),S=`rounded-lg border`,y=GC;let P=m===`name`?g===`asc`?`ascending`:`descending`:`none`,F;t[46]===r?F=t[47]:(F=r({id:`6YtxFj`}),t[46]=r,t[47]=F);let I;t[48]!==A||t[49]!==g||t[50]!==m||t[51]!==F?(I=(0,Z.jsx)($C,{label:F,sortKey:`name`,activeKey:m,activeDir:g,onSort:A}),t[48]=A,t[49]=g,t[50]=m,t[51]=F,t[52]=I):I=t[52];let L;t[53]!==P||t[54]!==I?(L=(0,Z.jsx)(YC,{"aria-sort":P,children:I}),t[53]=P,t[54]=I,t[55]=L):L=t[55];let R=m===`modified`?g===`asc`?`ascending`:`descending`:`none`,z;t[56]===r?z=t[57]:(z=r({id:`tgWuMB`}),t[56]=r,t[57]=z);let B;t[58]!==A||t[59]!==g||t[60]!==m||t[61]!==z?(B=(0,Z.jsx)($C,{label:z,sortKey:`modified`,activeKey:m,activeDir:g,onSort:A}),t[58]=A,t[59]=g,t[60]=m,t[61]=z,t[62]=B):B=t[62];let V;t[63]!==R||t[64]!==B?(V=(0,Z.jsx)(YC,{className:`w-32`,"aria-sort":R,children:B}),t[63]=R,t[64]=B,t[65]=V):V=t[65],t[66]!==L||t[67]!==V?(x=(0,Z.jsx)(KC,{children:(0,Z.jsxs)(JC,{children:[L,V]})}),t[66]=L,t[67]=V,t[68]=x):x=t[68],v=qC,b=a.length?a.map(tw):(0,Z.jsx)(JC,{children:(0,Z.jsx)(XC,{colSpan:2,className:`h-24 text-center text-muted-foreground`,children:(0,Z.jsx)(J,{id:`Pkw7J9`})})}),t[7]=r,t[8]=u,t[9]=l,t[10]=n,t[11]=i,t[12]=c,t[13]=s,t[14]=o,t[15]=d,t[16]=g,t[17]=m,t[18]=v,t[19]=y,t[20]=b,t[21]=x,t[22]=S,t[23]=C,t[24]=w,t[25]=T,t[26]=E,t[27]=D,t[28]=O}else v=t[18],y=t[19],b=t[20],x=t[21],S=t[22],C=t[23],w=t[24],T=t[25],E=t[26],D=t[27],O=t[28];let k;t[69]!==v||t[70]!==b?(k=(0,Z.jsx)(v,{children:b}),t[69]=v,t[70]=b,t[71]=k):k=t[71];let A;t[72]!==y||t[73]!==k||t[74]!==x?(A=(0,Z.jsxs)(y,{children:[x,k]}),t[72]=y,t[73]=k,t[74]=x,t[75]=A):A=t[75];let j;t[76]!==A||t[77]!==S?(j=(0,Z.jsx)(`div`,{className:S,children:A}),t[76]=A,t[77]=S,t[78]=j):j=t[78];let M;t[79]!==j||t[80]!==C||t[81]!==w||t[82]!==T||t[83]!==E||t[84]!==D?(M=(0,Z.jsxs)(`div`,{className:C,children:[w,T,E,D,j]}),t[79]=j,t[80]=C,t[81]=w,t[82]=T,t[83]=E,t[84]=D,t[85]=M):M=t[85];let N;t[86]!==M||t[87]!==O?(N=(0,Z.jsx)(`div`,{className:O,children:M}),t[86]=M,t[87]=O,t[88]=N):N=t[88];let P;t[89]!==f||t[90]!==l||t[91]!==n?(P=(0,Z.jsx)(h_,{open:f,onOpenChange:p,kind:`file`,initialDir:n,folderConfig:l,suggestedName:`index`}),t[89]=f,t[90]=l,t[91]=n,t[92]=P):P=t[92];let F;return t[93]!==N||t[94]!==P?(F=(0,Z.jsxs)(Z.Fragment,{children:[N,P]}),t[93]=N,t[94]=P,t[95]=F):F=t[95],F}function tw(e){return(0,Z.jsxs)(JC,{children:[(0,Z.jsx)(XC,{children:(0,Z.jsxs)(`a`,{href:lu(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,Z.jsx)(eh,{className:`size-4 shrink-0 text-muted-foreground`}):(0,Z.jsx)(Ge,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.title})]})}),(0,Z.jsx)(XC,{className:`text-muted-foreground`,children:e.kind===`file`?ZC(e.modified):`—`})]},e.path)}function nw(e){return e===`asc`?`desc`:`asc`}function rw(e){return(0,Z.jsxs)(`div`,{className:`flex items-center gap-3 border-b px-4 py-3 last:border-b-0`,children:[(0,Z.jsx)(Cd,{className:`size-4 rounded`}),(0,Z.jsx)(Cd,{className:`h-4 w-40`}),(0,Z.jsx)(`div`,{className:`ml-auto`,children:(0,Z.jsx)(Cd,{className:`h-4 w-16`})})]},e)}function iw(e){let t=(0,$.c)(24),{docName:n,size:r,limit:i,backNav:a}=e,o=a!==void 0,s=(0,Q.useRef)(null),c=(0,Q.useRef)(null),l,u;t[0]===o?(l=t[1],u=t[2]):(l=()=>{o?s.current?.focus():c.current?.focus()},u=[o],t[0]=o,t[1]=l,t[2]=u),(0,Q.useEffect)(l,u);let d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(`div`,{className:`flex size-16 items-center justify-center rounded-full border bg-muted/40 text-muted-foreground`,children:(0,Z.jsx)(Jm,{className:`size-9`,"aria-hidden":`true`})}),t[3]=d):d=t[3];let f=o?void 0:-1,p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(J,{id:`P3hnm0`}),t[4]=p):p=t[4];let m;t[5]===f?m=t[6]:(m=(0,Z.jsx)(`h2`,{ref:c,id:`large-file-title`,tabIndex:f,className:`text-2xl font-light text-balance outline-none`,children:p}),t[5]=f,t[6]=m);let h;t[7]===r?h=t[8]:(h=Ra(r),t[7]=r,t[8]=h);let g;t[9]===i?g=t[10]:(g=Ra(i),t[9]=i,t[10]=g);let _;t[11]!==n||t[12]!==h||t[13]!==g?(_=(0,Z.jsx)(`p`,{className:`max-w-md text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`GJH-AT`,values:{0:h,1:g,docName:n}})}),t[11]=n,t[12]=h,t[13]=g,t[14]=_):_=t[14];let v;t[15]!==m||t[16]!==_?(v=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[m,_]}),t[15]=m,t[16]=_,t[17]=v):v=t[17];let y;t[18]!==a||t[19]!==o?(y=o?(0,Z.jsxs)(Y,{ref:s,variant:`default`,onClick:()=>a.onNavigateBack(a.previousDocName),children:[(0,Z.jsx)($n,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`CKyk7Q`})]}):null,t[18]=a,t[19]=o,t[20]=y):y=t[20];let b;return t[21]!==v||t[22]!==y?(b=(0,Z.jsxs)(`div`,{role:`status`,"aria-labelledby":`large-file-title`,"data-slot":`large-file-editor-state`,className:`flex h-full flex-col items-center justify-center gap-8 p-8 text-center`,children:[d,v,y]}),t[21]=v,t[22]=y,t[23]=b):b=t[23],b}var aw={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`},ow=e=>{let t=(0,$.c)(15),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({color:a,size:o,strokeWidth:s,absoluteStrokeWidth:n,className:c,children:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=a===void 0?`currentColor`:a,u=o===void 0?24:o,d=s===void 0?2:s,f=c===void 0?``:c,p=n?Number(d)*24/Number(u):d,m;return t[8]!==r||t[9]!==f||t[10]!==l||t[11]!==i||t[12]!==u||t[13]!==p?(m=(0,Z.jsx)(`svg`,{"aria-hidden":`true`,...aw,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},sw=e=>{let t=(0,$.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`Markdown`}),r=(0,Z.jsx)(`path`,{d:`M232,48H24A16,16,0,0,0,8,64V192a16,16,0,0,0,16,16H232a16,16,0,0,0,16-16V64A16,16,0,0,0,232,48Zm0,144H24V64H232V192ZM128,104v48a8,8,0,0,1-16,0V123.31L93.66,141.66a8,8,0,0,1-11.32,0L64,123.31V152a8,8,0,0,1-16,0V104a8,8,0,0,1,13.66-5.66L88,124.69l26.34-26.35A8,8,0,0,1,128,104Zm77.66,18.34a8,8,0,0,1,0,11.32l-24,24a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L168,132.69V104a8,8,0,0,1,16,0v28.69l10.34-10.35A8,8,0,0,1,205.66,122.34Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,Z.jsxs)(ow,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i},cw=e=>{let t=(0,$.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`Textbox`}),r=(0,Z.jsx)(`path`,{d:`M112,40a8,8,0,0,0-8,8V64H24A16,16,0,0,0,8,80v96a16,16,0,0,0,16,16h80v16a8,8,0,0,0,16,0V48A8,8,0,0,0,112,40ZM24,176V80h80v96ZM248,80v96a16,16,0,0,1-16,16H144a8,8,0,0,1,0-16h88V80H144a8,8,0,0,1,0-16h88A16,16,0,0,1,248,80ZM88,112a8,8,0,0,1-8,8H72v24a8,8,0,0,1-16,0V120H48a8,8,0,0,1,0-16H80A8,8,0,0,1,88,112Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,Z.jsxs)(ow,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i};function lw(e){let t=(0,$.c)(48),{isSourceMode:n,onModeChange:r,sourceDisabled:i,wysiwygDisabled:a,wysiwygLabel:o,sourceLabel:s,wysiwygDisabledReason:c}=e,l=i===void 0?!1:i,u=a===void 0?!1:a,{_:d}=vt(),f;t[0]!==d||t[1]!==o?(f=o??d({id:`ur2XSb`}),t[0]=d,t[1]=o,t[2]=f):f=t[2];let p=f,m;t[3]!==d||t[4]!==s?(m=s??d({id:`xbdtfY`}),t[3]=d,t[4]=s,t[5]=m):m=t[5];let h=m,g=(0,Q.useId)(),_=u&&c?c:null,v=n?`source`:`wysiwyg`,y;t[6]===r?y=t[7]:(y=e=>{e&&r(e)},t[6]=r,t[7]=y);let b;t[8]===d?b=t[9]:(b=d({id:`n7aopT`}),t[8]=d,t[9]=b);let x=_?g:void 0,S;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(cw,{className:`size-4`}),t[10]=S):S=t[10];let C;t[11]!==x||t[12]!==u||t[13]!==p?(C=(0,Z.jsx)(Mi,{value:`wysiwyg`,"aria-label":p,"aria-describedby":x,disabled:u,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,children:S}),t[11]=x,t[12]=u,t[13]=p,t[14]=C):C=t[14];let w;t[15]!==_||t[16]!==g?(w=_?(0,Z.jsx)(`span`,{id:g,className:`sr-only`,children:_}):null,t[15]=_,t[16]=g,t[17]=w):w=t[17];let T;t[18]!==C||t[19]!==w?(T=(0,Z.jsx)(ln,{asChild:!0,children:(0,Z.jsxs)(`div`,{children:[C,w]})}),t[18]=C,t[19]=w,t[20]=T):T=t[20];let E;t[21]!==u||t[22]!==c||t[23]!==o?(E=u&&c?c:o||(0,Z.jsx)(J,{id:`Mb_20S`}),t[21]=u,t[22]=c,t[23]=o,t[24]=E):E=t[24];let D;t[25]===E?D=t[26]:(D=(0,Z.jsx)(un,{side:`bottom`,children:E}),t[25]=E,t[26]=D);let O;t[27]!==T||t[28]!==D?(O=(0,Z.jsxs)(fn,{children:[T,D]}),t[27]=T,t[28]=D,t[29]=O):O=t[29];let k;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Z.jsx)(sw,{className:`size-4`}),t[30]=k):k=t[30];let A;t[31]!==l||t[32]!==h?(A=(0,Z.jsx)(ln,{asChild:!0,children:(0,Z.jsx)(`div`,{children:(0,Z.jsx)(Mi,{value:`source`,"aria-label":h,disabled:l,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,children:k})})}),t[31]=l,t[32]=h,t[33]=A):A=t[33];let j;t[34]!==l||t[35]!==s?(j=l?(0,Z.jsx)(J,{id:`G-JBA1`}):s||(0,Z.jsx)(J,{id:`u6Hp4N`}),t[34]=l,t[35]=s,t[36]=j):j=t[36];let M;t[37]===j?M=t[38]:(M=(0,Z.jsx)(un,{side:`bottom`,children:j}),t[37]=j,t[38]=M);let N;t[39]!==A||t[40]!==M?(N=(0,Z.jsxs)(fn,{children:[A,M]}),t[39]=A,t[40]=M,t[41]=N):N=t[41];let P;return t[42]!==O||t[43]!==N||t[44]!==v||t[45]!==y||t[46]!==b?(P=(0,Z.jsxs)(Pi,{type:`single`,value:v,onValueChange:y,"aria-label":b,variant:`segmented`,size:`sm`,spacing:1,className:`shrink-0 bg-muted p-0.5 data-[size=sm]:rounded-[10px]`,children:[O,N]}),t[42]=O,t[43]=N,t[44]=v,t[45]=y,t[46]=b,t[47]=P):P=t[47],P}var uw=`ok-lint-config-view-mode-v1`,dw=[`source`,`rules`],fw=`source`;function pw(e){return dw.includes(e)}function mw(e=localStorage){try{let t=e.getItem(uw);if(t===null)return fw;if(pw(t))return t;console.warn(`[lint-config-view-mode] invalid persisted value, falling back to default`,{raw:t})}catch{}return fw}function hw(e,t=localStorage){try{return t.setItem(uw,e),!0}catch(e){return console.warn(`[lint-config-view-mode] persist failed`,e),!1}}function gw(){let e=(0,$.c)(3),[t,n]=(0,Q.useState)(mw),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=function(e){n(e),hw(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}function _w(e){return`/api/asset-text?path=${encodeURIComponent(e)}`}function vw(e){let t=(0,$.c)(30),{assetPath:n}=e,{_:r}=vt(),[i,a]=gw(),{data:o}=Dd(),s=(o?.configFile??null)===n,c=!s||i===`source`,l;t[0]===n?l=t[1]:(l=n.split(`/`).pop()??n,t[0]=n,t[1]=l);let u=l,d;t[2]===u?d=t[3]:(d=u.includes(`.`)?(u.split(`.`).pop()??``).toLowerCase():``,t[2]=u,t[3]=d);let f=d,p;t[4]===n?p=t[5]:(p=(0,Z.jsx)(gS,{entry:{kind:`asset`,path:n},className:`shrink-0 border-b bg-background px-3 py-1.5`}),t[4]=n,t[5]=p);let m;t[6]===a?m=t[7]:(m=e=>a(e===`source`?`source`:`rules`),t[6]=a,t[7]=m);let h=!s,g;t[8]===r?g=t[9]:(g=r({id:`4EZrJN`}),t[8]=r,t[9]=g);let _;t[10]===r?_=t[11]:(_=r({id:`wdxz7K`}),t[10]=r,t[11]=_);let v;t[12]===r?v=t[13]:(v=r({id:`EeUucb`}),t[12]=r,t[13]=v);let y;t[14]!==c||t[15]!==m||t[16]!==h||t[17]!==g||t[18]!==_||t[19]!==v?(y=(0,Z.jsx)(`div`,{className:`flex shrink-0 items-center justify-center border-b bg-background py-2`,children:(0,Z.jsx)(lw,{isSourceMode:c,onModeChange:m,wysiwygDisabled:h,wysiwygLabel:g,sourceLabel:_,wysiwygDisabledReason:v})}),t[14]=c,t[15]=m,t[16]=h,t[17]=g,t[18]=_,t[19]=v,t[20]=y):y=t[20];let b;t[21]!==n||t[22]!==f||t[23]!==u||t[24]!==c?(b=c?(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,Z.jsx)(mS,{src:_w(n),fileName:u,extension:f},n)}):(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-4 sm:px-6`,children:(0,Z.jsx)(`div`,{className:`mx-auto w-full max-w-3xl`,children:(0,Z.jsx)(Xr,{hideConfigSourceNote:!0})})}),t[21]=n,t[22]=f,t[23]=u,t[24]=c,t[25]=b):b=t[25];let x;return t[26]!==b||t[27]!==p||t[28]!==y?(x=(0,Z.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-background`,"data-lint-config-editor":``,children:[p,y,b]}),t[26]=b,t[27]=p,t[28]=y,t[29]=x):x=t[29],x}function yw(e){let t=(0,$.c)(8),{docName:n}=e,[r,i]=(0,Q.useState)(bw),a,o;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>mt(e=>{i(t=>{if(t.has(e))return t;let n=new Set(t);return n.add(e),n})}),o=[],t[0]=a,t[1]=o):(a=t[0],o=t[1]),(0,Q.useEffect)(a,o),!r.has(n))return null;let s;t[2]===n?s=t[3]:(s=function(){Se(n)?.abort(),i(e=>{if(!e.has(n))return e;let t=new Set(e);return t.delete(n),t})},t[2]=n,t[3]=s);let c=s,l;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`A67Uwj`})}),t[4]=l):l=t[4];let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(J,{id:`dEgA5A`}),t[5]=u):u=t[5];let d;return t[6]===c?d=t[7]:(d=(0,Z.jsxs)(`div`,{className:`absolute inset-x-0 bottom-8 z-20 flex justify-center text-xs text-muted-foreground`,children:[l,(0,Z.jsx)(Y,{variant:`link`,size:`sm`,className:`h-auto px-2 py-0 text-xs`,onClick:c,children:u})]}),t[6]=c,t[7]=d),d}function bw(){return new Set}function xw(e){let t=(0,$.c)(20),{nav:n}=e,{state:r,refetch:i}=Zo(n),a=(0,Q.useRef)(null),o=n.branch,s,c;t[0]===r.phase?(s=t[1],c=t[2]):(s=()=>{r.phase===`resolved`&&a.current?.querySelector(`button`)?.focus()},c=[r.phase],t[0]=r.phase,t[1]=s,t[2]=c),(0,Q.useEffect)(s,c);let l;t[3]===n.path?l=t[4]:(l=function(){window.location.hash=tu($o(n.path))},t[3]=n.path,t[4]=l);let u=l,d;t[5]!==o||t[6]!==n.kind?(d=function(e){es.arm({kind:n.kind,path:e,branch:o}),window.location.hash=n.kind===`folder`?tu(e):lu(e)},t[5]=o,t[6]=n.kind,t[7]=d):d=t[7];let f=d,p=r.phase===`pending`?`polite`:void 0,m=r.phase===`resolved`?r.resolution.verdict:void 0,h=r.phase===`pending`?`flex h-full flex-col items-center justify-center gap-3 p-8 text-center text-sm text-muted-foreground`:`flex h-full flex-col items-center justify-center gap-6 p-8 text-center`,g;t[8]!==u||t[9]!==n||t[10]!==f||t[11]!==i||t[12]!==r?(g=(0,Z.jsx)(ns,{nav:n,state:r,onBrowseFolder:u,onOpenRenamed:f,onEnableAutoSync:u,onSyncCompleted:i}),t[8]=u,t[9]=n,t[10]=f,t[11]=i,t[12]=r,t[13]=g):g=t[13];let _;return t[14]!==r.phase||t[15]!==p||t[16]!==m||t[17]!==h||t[18]!==g?(_=(0,Z.jsx)(`div`,{ref:a,role:`status`,"aria-live":p,"data-testid":`share-receive-miss-panel`,"data-phase":r.phase,"data-verdict":m,className:h,children:g}),t[14]=r.phase,t[15]=p,t[16]=m,t[17]=h,t[18]=g,t[19]=_):_=t[19],_}var Sw=e(Vt(),1);function Cw(e){let t=(0,$.c)(9),{text:n}=e,r;t[0]===n?r=t[1]:(r=ua(n),t[0]=n,t[1]=r);let{map:i}=r,a,o;if(t[2]!==i||t[3]!==n){o=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Yo(n),r=e.length>0?e:Object.keys(i);if(r.length===0){o=null;break bb0}let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(J,{id:`l_UFPv`}),t[6]=s):s=t[6];let c;t[7]===i?c=t[8]:(c=(e,t)=>{let n=i[e];return n===void 0?null:(0,Z.jsx)(ww,{keyName:e,value:n},`${e}-${t}`)},t[7]=i,t[8]=c),a=(0,Z.jsx)(Cs,{title:s,testId:`readonly-property-panel`,className:`pt-4 pb-4`,children:r.map(c)})}t[2]=i,t[3]=n,t[4]=a,t[5]=o}else a=t[4],o=t[5];return o===Symbol.for(`react.early_return_sentinel`)?a:o}function ww(e){let t=(0,$.c)(12),{keyName:n,value:r}=e,i=hs[co(r)],a;t[0]===i?a=t[1]:(a=(0,Z.jsx)(`span`,{"aria-hidden":!0,className:`flex size-7 shrink-0 items-center justify-center rounded text-muted-foreground`,children:(0,Z.jsx)(i,{className:`size-3.5`})}),t[0]=i,t[1]=a);let o;t[2]===n?o=t[3]:(o=(0,Z.jsx)(`span`,{className:`flex h-7 w-32 shrink-0 items-center truncate px-2 text-sm text-muted-foreground`,children:n}),t[2]=n,t[3]=o);let s;t[4]!==n||t[5]!==r?(s=(0,Z.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,Z.jsx)(Tw,{keyName:n,value:r})}),t[4]=n,t[5]=r,t[6]=s):s=t[6];let c;return t[7]!==n||t[8]!==a||t[9]!==o||t[10]!==s?(c=(0,Z.jsxs)(`div`,{className:`group flex items-start gap-1 py-0.5`,"data-testid":`readonly-property-row`,"data-key":n,children:[a,o,s]}),t[7]=n,t[8]=a,t[9]=o,t[10]=s,t[11]=c):c=t[11],c}function Tw(e){let t=(0,$.c)(8),{keyName:n,value:r}=e;if(Ss(r)){let e;return t[0]!==n||t[1]!==r?(e=(0,Z.jsx)(vs,{keyName:n,value:r}),t[0]=n,t[1]=r,t[2]=e):e=t[2],e}let i;t[3]===r?i=t[4]:(i=Array.isArray(r)?r.filter(Ew).join(`, `):String(r),t[3]=r,t[4]=i);let a=i,o;return t[5]!==a||t[6]!==n?(o=(0,Z.jsx)(`div`,{className:`flex min-h-7 items-center px-2 py-1 text-sm break-words`,"data-testid":`readonly-property-value`,"data-key":n,children:a}),t[5]=a,t[6]=n,t[7]=o):o=t[7],o}function Ew(e){return typeof e==`string`}function Dw(e){let t=(0,$.c)(29),{fileName:n,text:r}=e,i,a,o,s;if(t[0]!==r){let e=ro(r).body;s=Zn,i=We,a=!1,o=On().parseWithFallback(e),t[0]=r,t[1]=i,t[2]=a,t[3]=o,t[4]=s}else i=t[1],a=t[2],o=t[3],s=t[4];let c;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(c={attributes:{class:`pt-4 pb-4`}},t[5]=c):c=t[5];let l;t[6]!==i||t[7]!==a||t[8]!==o?(l={extensions:i,editable:a,content:o,editorProps:c},t[6]=i,t[7]=a,t[8]=o,t[9]=l):l=t[9];let u;t[10]===r?u=t[11]:(u=[r],t[10]=r,t[11]=u);let d=s(l,u),[f]=(0,Q.useState)(Ow),p=(0,Q.useRef)(null),m,h;t[12]===f?(m=t[13],h=t[14]):(m=()=>{let e=p.current;if(e)return e.appendChild(f),()=>{f.parentNode===e&&e.removeChild(f)}},h=[f],t[12]=f,t[13]=m,t[14]=h),(0,Q.useLayoutEffect)(m,h);let g;t[15]===r?g=t[16]:(g=(0,Z.jsx)(Cw,{text:r}),t[15]=r,t[16]=g);let _;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(`div`,{className:`tiptap-editor`,children:(0,Z.jsx)(`div`,{ref:p,style:{display:`contents`}})}),t[17]=_):_=t[17];let v;t[18]===g?v=t[19]:(v=(0,Z.jsxs)(`div`,{className:`editor-doc-scroll min-h-0 flex-1 overflow-auto`,children:[g,_]}),t[18]=g,t[19]=v);let y;t[20]===d?y=t[21]:(y=(0,Z.jsx)(Vn,{editor:d,className:`tiptap-editor-portal-content h-full`}),t[20]=d,t[21]=y);let b;t[22]!==f||t[23]!==y?(b=(0,Sw.createPortal)(y,f),t[22]=f,t[23]=y,t[24]=b):b=t[24];let x;return t[25]!==n||t[26]!==v||t[27]!==b?(x=(0,Z.jsxs)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":n,"data-skill-markdown-viewer":``,"data-skill-markdown-viewer-state":`loaded`,children:[v,b]}),t[25]=n,t[26]=v,t[27]=b,t[28]=x):x=t[28],x}function Ow(){let e=document.createElement(`div`);return e.style.display=`contents`,e}var kw=`data-skill-markdown`;function Aw(e){let t=(0,$.c)(12),{scope:n,name:r,path:i,fileName:a}=e,o;t[0]!==r||t[1]!==i||t[2]!==n?(o={loadText:e=>Wd({scope:n,name:r,path:i},e)},t[0]=r,t[1]=i,t[2]=n,t[3]=o):o=t[3];let s=lS(o);if(s.status===`loading`){let e;return t[4]===a?e=t[5]:(e=(0,Z.jsx)(uS,{fileName:a,dataAttr:kw}),t[4]=a,t[5]=e),e}if(s.status===`error`){let e;return t[6]!==s.message||t[7]!==a?(e=(0,Z.jsx)(dS,{fileName:a,dataAttr:kw,message:s.message}),t[6]=s.message,t[7]=a,t[8]=e):e=t[8],e}let c;return t[9]!==s.content||t[10]!==a?(c=(0,Z.jsx)(Dw,{fileName:a,text:s.content}),t[9]=s.content,t[10]=a,t[11]=c):c=t[11],c}var jw=new Set([`md`,`mdx`]);function Mw(e){let t=(0,$.c)(19),{scope:n,name:r,path:i}=e,a;t[0]===i?a=t[1]:(a=i.split(`/`).pop()??i,t[0]=i,t[1]=a);let o=a,s=o.lastIndexOf(`.`),c,l;if(t[2]!==s||t[3]!==o?(c=s>=0?o.slice(s+1).toLowerCase():``,l=jw.has(c),t[2]=s,t[3]=o,t[4]=c,t[5]=l):(c=t[4],l=t[5]),l){let e;return t[6]!==o||t[7]!==r||t[8]!==i||t[9]!==n?(e=(0,Z.jsx)(Aw,{scope:n,name:r,path:i,fileName:o}),t[6]=o,t[7]=r,t[8]=i,t[9]=n,t[10]=e):e=t[10],e}let u;t[11]!==r||t[12]!==i||t[13]!==n?(u=e=>Wd({scope:n,name:r,path:i},e),t[11]=r,t[12]=i,t[13]=n,t[14]=u):u=t[14];let d;return t[15]!==c||t[16]!==o||t[17]!==u?(d=(0,Z.jsx)(mS,{fileName:o,extension:c,loadText:u}),t[15]=c,t[16]=o,t[17]=u,t[18]=d):d=t[18],d}function Nw(e){let t=null,n=()=>(t===null&&(t=e(),t.catch(()=>{})),t),r=(0,Q.lazy)(n);return r.preload=n,r}var Pw=Nw(()=>n(()=>import(`./SettingsDialogBody-0nrbk-EZ.js`).then(e=>({default:e.SettingsDialogBody})),__vite__mapDeps([103,1,104,19,12,6,2,3,7,8,9,73,58,22,11,74,75,76,10,79,62,63,64,65,66,67,68,69,70,71,72,15,38,17,18,25,77,78,31,52,53,35,55,14,16,4,80,40,23,24,26,81,28,20,82,21,83,84,27,29,51,54,56,57,85,86,87,30,88,89,90,91,32,33,92,93,13,105,106,41,107,108,109,110,50,111,112,96,113,114,97,115,36,116,117,118,119,120,34,121,39,42,122,123,124,125]),import.meta.url));function Fw(e){let t=(0,$.c)(9),{error:n}=e,{_:r}=vt(),i;t[0]!==r||t[1]!==n?(i=n instanceof Error&&/dynamically imported module|Failed to fetch/i.test(n.message)?r({id:`Y8ViJx`}):r({id:`3h5zMp`}),t[0]=r,t[1]=n,t[2]=i):i=t[2];let a=i,o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(`h3`,{id:`settings-body-error-title`,className:`font-heading text-base leading-none font-medium`,children:(0,Z.jsx)(J,{id:`hwFOFD`})}),t[3]=o):o=t[3];let s;t[4]===a?s=t[5]:(s=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[o,(0,Z.jsx)(`p`,{className:`max-w-xs text-sm text-muted-foreground`,children:a})]}),t[4]=a,t[5]=s);let c;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(Y,{variant:`default`,onClick:Iw,children:(0,Z.jsx)(J,{id:`HpK_8d`})}),t[6]=c):c=t[6];let l;return t[7]===s?l=t[8]:(l=(0,Z.jsxs)(`div`,{role:`alert`,"aria-labelledby":`settings-body-error-title`,"data-slot":`settings-body-error-boundary`,className:`flex h-full flex-col items-center justify-center gap-5 p-8 text-center`,children:[s,c]}),t[7]=s,t[8]=l),l}function Iw(){return window.location.reload()}function Lw(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(Zt,{fallbackRender:zw,onError:Rw,children:n}),t[0]=n,t[1]=r),r}function Rw(e,t){console.error(`[SettingsDialogErrorBoundary] rendered fallback for Settings body`,e,t.componentStack)}function zw(e){return(0,Z.jsx)(Fw,{...e})}function Bw(e=typeof window>`u`?void 0:window.location){return e?.protocol===`file:`}function Vw(e){let{groups:t,translate:n}=e,r=[],i=new Set;for(let e of t)if(e.enabled)for(let t of e.items)i.add(t.id),r.push({id:`section:${t.id}`,kind:`section`,sectionId:t.id,label:t.label,keywords:[e.label]});for(let e of ni)if(i.has(e.sectionId))for(let t of e.fields){let i=t.path.join(`.`);r.push({id:`field:${e.sectionId}:${i}`,kind:`field`,sectionId:e.sectionId,label:n(t.label),keywords:t.description?[n(t.description)]:[],targetField:i})}if(i.has(`plugin:markdownlint`))for(let e of ko)r.push({id:`rule:${e.id}`,kind:`rule`,sectionId:`plugin:markdownlint`,label:e.name,keywords:[e.id,e.alias,...e.aliases],ruleId:e.id});return r}function Hw(e){return`https://github.com/inkeep/open-knowledge/releases/tag/v${encodeURIComponent(e)}`}function Uw(e){let t=(0,$.c)(43),{open:n,initialSection:r,onOpenChange:i}=e,a=r===void 0?null:r,{_:o}=vt(),{collabUrl:s}=Re(),{userBinding:c,userSynced:l,okignoreBinding:u,okignoreSynced:d,projectConfig:f,merged:p}=Hu(),{desktopPresent:m}=ai(),[h,g]=(0,Q.useState)(a??`preferences`),[_,v]=(0,Q.useState)(``),[y,b]=(0,Q.useState)(null),[x,S]=(0,Q.useState)(null),C=(0,Q.useRef)(0),w=(0,Q.useRef)(null),T,E;t[0]!==a||t[1]!==n?(T=()=>{n&&(g(a??`preferences`),v(``))},E=[n,a],t[0]=a,t[1]=n,t[2]=T,t[3]=E):(T=t[2],E=t[3]),(0,Q.useEffect)(T,E);let D,O;t[4]===y?(D=t[5],O=t[6]):(D=()=>{if(!y)return;let e=w.current;if(!e)return;let t=null,n=null,r=null,i=null,a=()=>{let r=e.querySelector(`[data-field="${y.path}"]`);return r?(r.scrollIntoView({block:`center`}),r.classList.add(`animate-settings-nav-flash`),t=r,n=setTimeout(()=>r.classList.remove(`animate-settings-nav-flash`),750),!0):!1};return a()||(i=new MutationObserver(()=>{a()&&i?.disconnect()}),i.observe(e,{childList:!0,subtree:!0}),r=setTimeout(()=>i?.disconnect(),4e3)),()=>{i?.disconnect(),n&&clearTimeout(n),r&&clearTimeout(r),t?.classList.remove(`animate-settings-nav-flash`)}},O=[y],t[4]=y,t[5]=D,t[6]=O),(0,Q.useEffect)(D,O);let k=s!==null,A=typeof window<`u`&&window.okDesktop!=null,j=A&&window.okDesktop?.config.ptyAvailable===!0,M,N;if(t[7]!==o||t[8]!==m||t[9]!==k||t[10]!==p?.appearance?.colorThemeEnabled||t[11]!==f?.contentRules){let e;t[14]===f?.contentRules?e=t[15]:(e=e=>f?.contentRules?.[e.id]?.enabled===!0,t[14]=f?.contentRules,t[15]=e);let n=ri.filter(e).map(Ww),r=p?.appearance?.colorThemeEnabled!==!1,i=Bw();M=[{id:`user`,label:o({id:`7PzzBU`}),enabled:!0,items:[{id:`preferences`,label:o({id:`Q6hhn8`})},{id:`configure-agents`,label:o({id:`jRAGrQ`})},{id:`hotkeys`,label:o({id:`4KmEoC`})},{id:`account`,label:o({id:`AeXO77`})},{id:`user-plugins-manage`,label:o({id:`ohUJJM`})},...A?[{id:`ai-tools`,label:o({id:`_5qBNl`})}]:[]]},{id:`project`,label:o({id:`ZWyHmq`}),enabled:k,items:[{id:`sync`,label:o({id:`Nu4DdT`})},{id:`search`,label:o({id:`A1taO8`})},{id:`plugins-manage`,label:o({id:`ohUJJM`})},...i?[]:[{id:`link-previews`,label:o({id:`gh27t1`})}],...j?[{id:`terminal`,label:o({id:`ALhMYW`})}]:[],...A?[{id:`project-ai-tools`,label:o({id:`crqzW5`})}]:[],{id:`project-templates`,label:o({id:`iTylMl`})},{id:`skills`,label:o({id:`PCSkw2`})},{id:`okignore`,label:o({id:`3zyg_A`})},{id:`sharing`,label:o({id:`cs4mps`})}]},{id:`plugins`,label:o({id:`ohUJJM`}),enabled:!0,items:[...k?n:[],...r?[{id:`plugin:theme`,label:o({id:`fJ3EbT`})}]:[]]},{id:`integrations`,label:o({id:`nbfdhU`}),enabled:!0,items:[]}],N=Vw({groups:M,translate:o}),t[7]=o,t[8]=m,t[9]=k,t[10]=p?.appearance?.colorThemeEnabled,t[11]=f?.contentRules,t[12]=M,t[13]=N}else M=t[12],N=t[13];let P=N,F;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(F=function(e){C.current+=1;let t=C.current;g(e.sectionId),e.kind===`field`&&e.targetField?b({path:e.targetField}):e.kind===`rule`&&e.ruleId&&S({query:e.ruleId,nonce:t}),v(``)},t[16]=F):F=t[16];let I=F,L;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(_n,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`Tz0i8g`})}),t[17]=L):L=t[17];let R;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Z.jsx)(gn,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`RDrXh4`})}),t[18]=R):R=t[18];let z;t[19]!==h||t[20]!==M||t[21]!==P||t[22]!==_?(z=(0,Z.jsx)(Gw,{groups:M,activeId:h,onSelect:g,entries:P,searchQuery:_,onSearchChange:v,onNavigate:I}),t[19]=h,t[20]=M,t[21]=P,t[22]=_,t[23]=z):z=t[23];let B;t[24]===o?B=t[25]:(B=o({id:`OXb_Df`}),t[24]=o,t[25]=B);let V;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Z.jsx)($w,{}),t[26]=V):V=t[26];let H=l?c:null,U;t[27]!==h||t[28]!==u||t[29]!==d||t[30]!==x||t[31]!==H?(U=(0,Z.jsx)(Lw,{children:(0,Z.jsx)(Q.Suspense,{fallback:V,children:(0,Z.jsx)(Pw,{activeId:h,userBinding:H,okignoreBinding:u,okignoreSynced:d,markdownlintRuleQuery:x})})}),t[27]=h,t[28]=u,t[29]=d,t[30]=x,t[31]=H,t[32]=U):U=t[32];let W;t[33]!==B||t[34]!==U?(W=(0,Z.jsx)(`section`,{ref:w,"aria-label":B,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain subtle-scrollbar p-6`,tabIndex:0,children:U}),t[33]=B,t[34]=U,t[35]=W):W=t[35];let ee;t[36]!==z||t[37]!==W?(ee=(0,Z.jsxs)(vn,{className:`flex h-[700px] max-h-[calc(100dvh-4rem)] w-[900px] max-w-[calc(100%-2rem)] flex-col gap-0 overflow-hidden p-0 sm:grid sm:grid-cols-[220px_1fr] sm:max-w-[min(900px,calc(100%-2rem))]`,"data-testid":`settings-dialog`,children:[L,R,z,W]}),t[36]=z,t[37]=W,t[38]=ee):ee=t[38];let G;return t[39]!==i||t[40]!==n||t[41]!==ee?(G=(0,Z.jsx)(Sn,{open:n,onOpenChange:i,children:ee}),t[39]=i,t[40]=n,t[41]=ee,t[42]=G):G=t[42],G}function Ww(e){return{id:`plugin:${e.id}`,label:e.label}}function Gw(e){let t=(0,$.c)(46),{groups:n,activeId:r,onSelect:i,entries:a,searchQuery:o,onSearchChange:s,onNavigate:c}=e,{_:l}=vt(),u,d,f,p,m,g,_,v,y,b;if(t[0]!==l||t[1]!==a||t[2]!==c||t[3]!==s||t[4]!==o){d=o.trim();let e=d===``?[]:a.filter(e=>Zg(e.label,d,e.keywords)),n=e.filter(Jw),r=e.filter(qw),i=e.filter(Kw);t[15]===l?y=t[16]:(y=l({id:`y1t8bQ`}),t[15]=l,t[16]=y),b=`flex shrink-0 gap-x-3 overflow-x-auto overscroll-contain subtle-scrollbar scroll-fade-mask-x-max-sm border-b bg-muted/30 px-3 py-2 max-sm:pt-10 sm:h-full sm:min-h-0 sm:flex-col sm:gap-0 sm:overflow-x-visible sm:border-r sm:border-b-0 sm:py-4`,u=h,f=!1,p=`h-auto w-full shrink-0 bg-transparent sm:mb-3 [&_[data-slot=command-input-wrapper]]:h-9 [&_[data-slot=command-input-wrapper]]:rounded-lg [&_[data-slot=command-input-wrapper]]:border [&_[data-slot=command-input-wrapper]]:border-input`,m=`settings-search`;let x;t[17]===l?x=t[18]:(x=l({id:`1DahsC`}),t[17]=l,t[18]=x),t[19]!==s||t[20]!==o||t[21]!==x?(g=(0,Z.jsx)(gt,{value:o,onValueChange:s,placeholder:x,className:`py-0`,"data-testid":`settings-search-input`}),t[19]=s,t[20]=o,t[21]=x,t[22]=g):g=t[22];let S=d===``?null:(0,Z.jsx)(J,{id:`TQJCR6`,values:{0:e.length}});t[23]===S?_=t[24]:(_=(0,Z.jsx)(`span`,{"aria-live":`polite`,className:`sr-only`,"data-testid":`settings-search-result-count`,children:S}),t[23]=S,t[24]=_),v=d===``?null:(0,Z.jsxs)(U,{"data-testid":`settings-search-results`,className:`mt-1.5`,children:[(0,Z.jsx)(D,{"data-testid":`settings-search-empty`,children:(0,Z.jsx)(J,{id:`ljFWEt`})}),n.length>0?(0,Z.jsx)(L,{heading:l({id:`R4OWFD`}),children:n.map(e=>(0,Z.jsx)(Yw,{entry:e,query:d,onNavigate:c},e.id))}):null,r.length>0?(0,Z.jsx)(L,{heading:l({id:`Tz0i8g`}),children:r.map(e=>(0,Z.jsx)(Yw,{entry:e,query:d,onNavigate:c},e.id))}):null,i.length>0?(0,Z.jsx)(L,{heading:l({id:`v2a04T`}),children:i.map(e=>(0,Z.jsx)(Yw,{entry:e,query:d,onNavigate:c},e.id))}):null]}),t[0]=l,t[1]=a,t[2]=c,t[3]=s,t[4]=o,t[5]=u,t[6]=d,t[7]=f,t[8]=p,t[9]=m,t[10]=g,t[11]=_,t[12]=v,t[13]=y,t[14]=b}else u=t[5],d=t[6],f=t[7],p=t[8],m=t[9],g=t[10],_=t[11],v=t[12],y=t[13],b=t[14];let x;t[25]!==u||t[26]!==f||t[27]!==p||t[28]!==m||t[29]!==g||t[30]!==_||t[31]!==v?(x=(0,Z.jsxs)(u,{shouldFilter:f,className:p,"data-testid":m,children:[g,_,v]}),t[25]=u,t[26]=f,t[27]=p,t[28]=m,t[29]=g,t[30]=_,t[31]=v,t[32]=x):x=t[32];let S;t[33]!==r||t[34]!==n||t[35]!==i||t[36]!==d?(S=d===``?n.map(e=>(0,Z.jsx)(Qw,{group:e,activeId:r,onSelect:i},e.id)):null,t[33]=r,t[34]=n,t[35]=i,t[36]=d,t[37]=S):S=t[37];let C;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(Zw,{}),t[38]=C):C=t[38];let w;t[39]===S?w=t[40]:(w=(0,Z.jsxs)(`div`,{className:`contents subtle-scrollbar sm:flex sm:min-h-0 sm:flex-1 sm:flex-col sm:overflow-y-auto sm:overscroll-contain`,children:[S,C]}),t[39]=S,t[40]=w);let T;return t[41]!==w||t[42]!==y||t[43]!==b||t[44]!==x?(T=(0,Z.jsxs)(`nav`,{"aria-label":y,className:b,children:[x,w]}),t[41]=w,t[42]=y,t[43]=b,t[44]=x,t[45]=T):T=t[45],T}function Kw(e){return e.kind===`rule`}function qw(e){return e.kind===`field`}function Jw(e){return e.kind===`section`}function Yw(e){let t=(0,$.c)(13),{entry:n,query:r,onNavigate:i}=e,a=n.id,o;t[0]!==n||t[1]!==i?(o=()=>i(n),t[0]=n,t[1]=i,t[2]=o):o=t[2];let s=`settings-search-result-${n.id}`,c;t[3]!==n.label||t[4]!==r?(c=Jg(n.label,r).map(Xw),t[3]=n.label,t[4]=r,t[5]=c):c=t[5];let u;t[6]===c?u=t[7]:(u=(0,Z.jsx)(`span`,{className:`truncate`,children:c}),t[6]=c,t[7]=u);let d;return t[8]!==n.id||t[9]!==o||t[10]!==s||t[11]!==u?(d=(0,Z.jsx)(l,{value:a,onSelect:o,"data-testid":s,children:u}),t[8]=n.id,t[9]=o,t[10]=s,t[11]=u,t[12]=d):d=t[12],d}function Xw(e){return e.match?(0,Z.jsx)(`span`,{className:`font-semibold text-foreground`,children:e.text},e.start):(0,Z.jsx)(`span`,{children:e.text},e.start)}function Zw(){let e=(0,$.c)(4),t=typeof window<`u`?window.okDesktop??null:null,n=t?.appVersion;if(!t||!n)return null;let r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=Hw(n),e[0]=r):r=e[0];let i=r,a;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsxs)(`p`,{className:`whitespace-nowrap font-mono text-xs text-muted-foreground/70`,"data-testid":`settings-sidebar-version`,children:[`v`,n]}),e[1]=a):a=e[1];let o;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>{t.shell.openExternal(i)},e[2]=o):o=e[2];let s;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsxs)(`div`,{className:`ml-auto shrink-0 px-2 sm:ml-0 sm:mt-auto sm:pt-3`,children:[a,(0,Z.jsxs)(`button`,{type:`button`,onClick:o,"data-testid":`settings-sidebar-release-notes`,className:$t(`mt-0.5 inline-flex items-center gap-1 whitespace-nowrap rounded text-xs text-muted-foreground transition-colors hover:text-foreground`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`),children:[(0,Z.jsx)(J,{id:`_PACVa`}),(0,Z.jsx)(us,{className:`size-3`,"aria-hidden":`true`})]})]}),e[3]=s):s=e[3],s}function Qw(e){let t=(0,$.c)(28),{group:n,activeId:r,onSelect:i}=e;if(n.items.length===0)return null;let a=`settings-group-${n.id}`,o=`${a}-caption`,s=n.enabled?void 0:o,c=n.enabled?`text-muted-foreground/80`:`text-muted-foreground/50`,l;t[0]===c?l=t[1]:(l=$t(`shrink-0 whitespace-nowrap px-2 text-xs font-semibold uppercase tracking-wide font-mono sm:mb-1`,c),t[0]=c,t[1]=l);let u;t[2]!==n.label||t[3]!==a||t[4]!==s||t[5]!==l?(u=(0,Z.jsx)(`h3`,{id:a,"aria-describedby":s,className:l,children:n.label}),t[2]=n.label,t[3]=a,t[4]=s,t[5]=l,t[6]=u):u=t[6];let d;t[7]!==o||t[8]!==n.enabled?(d=n.enabled?null:(0,Z.jsx)(`p`,{id:o,className:`px-2 text-xs italic text-muted-foreground/60 sm:mb-1`,children:(0,Z.jsx)(J,{id:`JWsZlx`})}),t[7]=o,t[8]=n.enabled,t[9]=d):d=t[9];let f;if(t[10]!==r||t[11]!==o||t[12]!==n.enabled||t[13]!==n.items||t[14]!==i){let e;t[16]!==r||t[17]!==o||t[18]!==n.enabled||t[19]!==i?(e=e=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`button`,{type:`button`,"aria-current":r===e.id?`page`:void 0,"aria-disabled":n.enabled?void 0:!0,"aria-describedby":n.enabled?void 0:o,tabIndex:n.enabled?0:-1,disabled:!n.enabled,onClick:()=>n.enabled&&i(e.id),"data-testid":`settings-sidebar-item-${e.id}`,className:$t(`w-auto whitespace-nowrap rounded px-2 py-1.5 text-left text-sm transition-colors sm:w-full`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,`disabled:cursor-not-allowed disabled:opacity-50`,r===e.id&&n.enabled?`bg-accent text-accent-foreground`:`hover:bg-accent/50`),children:e.label})},e.id),t[16]=r,t[17]=o,t[18]=n.enabled,t[19]=i,t[20]=e):e=t[20],f=n.items.map(e),t[10]=r,t[11]=o,t[12]=n.enabled,t[13]=n.items,t[14]=i,t[15]=f}else f=t[15];let p;t[21]!==a||t[22]!==f?(p=(0,Z.jsx)(`ul`,{"aria-labelledby":a,className:`flex gap-1 sm:block sm:space-y-0.5`,children:f}),t[21]=a,t[22]=f,t[23]=p):p=t[23];let m;return t[24]!==u||t[25]!==d||t[26]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 sm:mb-4 sm:block`,children:[u,d,p]}),t[24]=u,t[25]=d,t[26]=p,t[27]=m):m=t[27],m}function $w(){let e=(0,$.c)(4),t,n,r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`GsBUCk`})}),n=(0,Z.jsx)(Cd,{className:`h-5 w-32`}),r=(0,Z.jsx)(Cd,{className:`h-4 w-64`}),e[0]=t,e[1]=n,e[2]=r):(t=e[0],n=e[1],r=e[2]);let i;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"aria-busy":`true`,className:`space-y-3`,"data-testid":`settings-content-skeleton`,children:[t,n,r,(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(Cd,{className:`h-9 w-full`}),(0,Z.jsx)(Cd,{className:`h-9 w-full`})]})]}),e[3]=i):i=e[3],i}function eT(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=$t(`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,Z.jsx)(Xx,{"data-slot":`resizable-panel-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function tT(e){let t=(0,$.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,Z.jsx)(eS,{"data-slot":`resizable-panel`,...n}),t[2]=n,t[3]=r),r}function nT(e){let t=(0,$.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=$t(`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,Z.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,Z.jsx)(iS,{"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}function rT(e){let t=(0,$.c)(119),{findInputRef:n,query:r,replacement:i,replaceOpen:a,caseSensitive:o,wholeWord:s,current:c,total:l,onQueryChange:u,onReplacementChange:d,onReplaceOpenChange:f,onCaseSensitiveChange:p,onWholeWordChange:m,onNext:h,onPrevious:g,onReplaceCurrent:_,onReplaceAll:v,onClose:y}=e,{_:b}=vt(),x=r.length>0,S=l>0,C;t[0]!==b||t[1]!==c||t[2]!==S||t[3]!==x||t[4]!==l?(C=x?S?`${c} / ${l}`:b({id:`Ev2r9A`}):``,t[0]=b,t[1]=c,t[2]=S,t[3]=x,t[4]=l,t[5]=C):C=t[5];let w=C,T;t[6]!==y||t[7]!==h||t[8]!==g?(T=function(e){e.key===`Enter`?(e.preventDefault(),e.shiftKey?g():h()):e.key===`Escape`&&(e.preventDefault(),y())},t[6]=y,t[7]=h,t[8]=g,t[9]=T):T=t[9];let E=T,D;t[10]!==y||t[11]!==_?(D=function(e){e.key===`Enter`?(e.preventDefault(),_()):e.key===`Escape`&&(e.preventDefault(),y())},t[10]=y,t[11]=_,t[12]=D):D=t[12];let O=D,k;t[13]===b?k=t[14]:(k=b({id:`MVxpbf`}),t[13]=b,t[14]=k);let A;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(`label`,{className:`sr-only`,htmlFor:`ok-find-input`,children:(0,Z.jsx)(J,{id:`KujtjC`})}),t[15]=A):A=t[15];let j;t[16]===u?j=t[17]:(j=e=>u(e.target.value),t[16]=u,t[17]=j);let M;t[18]===b?M=t[19]:(M=b({id:`KujtjC`}),t[18]=b,t[19]=M);let N;t[20]!==n||t[21]!==E||t[22]!==r||t[23]!==j||t[24]!==M?(N=(0,Z.jsx)(Nc,{ref:n,id:`ok-find-input`,value:r,onChange:j,onKeyDown:E,placeholder:M,autoComplete:`off`,spellCheck:!1,className:`h-7 px-2 text-sm`}),t[20]=n,t[21]=E,t[22]=r,t[23]=j,t[24]=M,t[25]=N):N=t[25];let P;t[26]===b?P=t[27]:(P=b({id:`-8PP0T`}),t[26]=b,t[27]=P);let F;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(Im,{"aria-hidden":`true`}),t[28]=F):F=t[28];let I;t[29]!==o||t[30]!==p||t[31]!==P?(I=(0,Z.jsx)(ln,{asChild:!0,children:(0,Z.jsx)(Ni,{type:`button`,variant:`segmented`,size:`sm`,"aria-label":P,pressed:o,onPressedChange:p,className:`size-6 min-w-6 px-0`,children:F})}),t[29]=o,t[30]=p,t[31]=P,t[32]=I):I=t[32];let L;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(un,{side:`bottom`,children:(0,Z.jsx)(J,{id:`-8PP0T`})}),t[33]=L):L=t[33];let R;t[34]===I?R=t[35]:(R=(0,Z.jsxs)(fn,{children:[I,L]}),t[34]=I,t[35]=R);let z;t[36]===b?z=t[37]:(z=b({id:`_7UQ7y`}),t[36]=b,t[37]=z);let B;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsx)(Gh,{"aria-hidden":`true`}),t[38]=B):B=t[38];let V;t[39]!==m||t[40]!==z||t[41]!==s?(V=(0,Z.jsx)(ln,{asChild:!0,children:(0,Z.jsx)(Ni,{type:`button`,variant:`segmented`,size:`sm`,"aria-label":z,pressed:s,onPressedChange:m,className:`size-6 min-w-6 px-0`,children:B})}),t[39]=m,t[40]=z,t[41]=s,t[42]=V):V=t[42];let H;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Z.jsx)(un,{side:`bottom`,children:(0,Z.jsx)(J,{id:`_7UQ7y`})}),t[43]=H):H=t[43];let U;t[44]===V?U=t[45]:(U=(0,Z.jsxs)(fn,{children:[V,H]}),t[44]=V,t[45]=U);let W;t[46]!==R||t[47]!==U?(W=(0,Z.jsxs)(Rc,{align:`inline-end`,className:`gap-0.5`,children:[R,U]}),t[46]=R,t[47]=U,t[48]=W):W=t[48];let ee;t[49]!==W||t[50]!==N?(ee=(0,Z.jsxs)(Vc,{className:`h-7 w-56 rounded-[min(var(--radius-md),12px)]`,children:[N,W]}),t[49]=W,t[50]=N,t[51]=ee):ee=t[51];let G;t[52]===w?G=t[53]:(G=(0,Z.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`min-w-14 px-1 text-right text-muted-foreground text-xs tabular-nums shrink-0`,children:w}),t[52]=w,t[53]=G);let K;t[54]===b?K=t[55]:(K=b({id:`oqB2ez`}),t[54]=b,t[55]=K);let te=!S,ne;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Z.jsx)(pt,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[56]=ne):ne=t[56];let re;t[57]!==g||t[58]!==K||t[59]!==te?(re=(0,Z.jsx)(ln,{asChild:!0,children:(0,Z.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":K,disabled:te,onClick:g,children:ne})}),t[57]=g,t[58]=K,t[59]=te,t[60]=re):re=t[60];let ie;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,Z.jsx)(un,{side:`bottom`,children:(0,Z.jsx)(J,{id:`oqB2ez`})}),t[61]=ie):ie=t[61];let ae;t[62]===re?ae=t[63]:(ae=(0,Z.jsxs)(fn,{children:[re,ie]}),t[62]=re,t[63]=ae);let oe;t[64]===b?oe=t[65]:(oe=b({id:`SiUUCS`}),t[64]=b,t[65]=oe);let se=!S,ce;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(ce=(0,Z.jsx)(ks,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[66]=ce):ce=t[66];let le;t[67]!==h||t[68]!==oe||t[69]!==se?(le=(0,Z.jsx)(ln,{asChild:!0,children:(0,Z.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":oe,disabled:se,onClick:h,children:ce})}),t[67]=h,t[68]=oe,t[69]=se,t[70]=le):le=t[70];let ue;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(ue=(0,Z.jsx)(un,{side:`bottom`,children:(0,Z.jsx)(J,{id:`SiUUCS`})}),t[71]=ue):ue=t[71];let de;t[72]===le?de=t[73]:(de=(0,Z.jsxs)(fn,{children:[le,ue]}),t[72]=le,t[73]=de);let fe=a?`secondary`:`ghost`,pe;t[74]!==b||t[75]!==a?(pe=b(a?{id:`UkQGhd`}:{id:`1RluQD`}),t[74]=b,t[75]=a,t[76]=pe):pe=t[76];let q=a?`ok-replace-input`:void 0,me;t[77]!==f||t[78]!==a?(me=()=>f(!a),t[77]=f,t[78]=a,t[79]=me):me=t[79];let he;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(he=(0,Z.jsx)(wh,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[80]=he):he=t[80];let ge;t[81]!==a||t[82]!==fe||t[83]!==pe||t[84]!==q||t[85]!==me?(ge=(0,Z.jsx)(ln,{asChild:!0,children:(0,Z.jsx)(Y,{type:`button`,variant:fe,size:`icon-sm`,"aria-label":pe,"aria-expanded":a,"aria-controls":q,onClick:me,children:he})}),t[81]=a,t[82]=fe,t[83]=pe,t[84]=q,t[85]=me,t[86]=ge):ge=t[86];let _e;t[87]===a?_e=t[88]:(_e=(0,Z.jsx)(un,{side:`bottom`,children:a?(0,Z.jsx)(J,{id:`UkQGhd`}):(0,Z.jsx)(J,{id:`1RluQD`})}),t[87]=a,t[88]=_e);let ve;t[89]!==ge||t[90]!==_e?(ve=(0,Z.jsxs)(fn,{children:[ge,_e]}),t[89]=ge,t[90]=_e,t[91]=ve):ve=t[91];let ye;t[92]!==b||t[93]!==O||t[94]!==S||t[95]!==v||t[96]!==_||t[97]!==d||t[98]!==a||t[99]!==i?(ye=a?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`label`,{className:`sr-only`,htmlFor:`ok-replace-input`,children:(0,Z.jsx)(J,{id:`fqSfXY`})}),(0,Z.jsx)(vl,{id:`ok-replace-input`,value:i,onChange:e=>d(e.target.value),onKeyDown:O,placeholder:b({id:`fqSfXY`}),autoComplete:`off`,spellCheck:!1,className:`h-7 w-48 rounded-[min(var(--radius-md),12px)] px-2 text-sm shadow-none focus-visible:ring-2`}),(0,Z.jsxs)(fn,{children:[(0,Z.jsx)(ln,{asChild:!0,children:(0,Z.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":b({id:`bS_boY`}),disabled:!S,onClick:_,children:(0,Z.jsx)(wh,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(un,{side:`bottom`,children:(0,Z.jsx)(J,{id:`bS_boY`})})]}),(0,Z.jsxs)(fn,{children:[(0,Z.jsx)(ln,{asChild:!0,children:(0,Z.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":b({id:`dr1vFs`}),disabled:!S,onClick:v,children:(0,Z.jsx)(Ch,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(un,{side:`bottom`,children:(0,Z.jsx)(J,{id:`dr1vFs`})})]})]}):null,t[92]=b,t[93]=O,t[94]=S,t[95]=v,t[96]=_,t[97]=d,t[98]=a,t[99]=i,t[100]=ye):ye=t[100];let be;t[101]===b?be=t[102]:(be=b({id:`wJo9oS`}),t[101]=b,t[102]=be);let xe;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(xe=(0,Z.jsx)(fl,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[103]=xe):xe=t[103];let Se;t[104]!==y||t[105]!==be?(Se=(0,Z.jsx)(ln,{asChild:!0,children:(0,Z.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":be,onClick:y,children:xe})}),t[104]=y,t[105]=be,t[106]=Se):Se=t[106];let Ce;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=(0,Z.jsx)(un,{side:`bottom`,children:(0,Z.jsx)(J,{id:`yz7wBu`})}),t[107]=Ce):Ce=t[107];let we;t[108]===Se?we=t[109]:(we=(0,Z.jsxs)(fn,{children:[Se,Ce]}),t[108]=Se,t[109]=we);let Te;return t[110]!==ee||t[111]!==G||t[112]!==ae||t[113]!==de||t[114]!==k||t[115]!==ve||t[116]!==ye||t[117]!==we?(Te=(0,Z.jsxs)(`search`,{"data-testid":`find-replace-bar`,"aria-label":k,className:`pointer-events-auto flex max-w-[min(calc(100vw-1rem),720px)] touch-manipulation items-center gap-1 rounded-[calc(var(--radius)+2px)] border border-input bg-popover/95 p-1 text-popover-foreground shadow-md shadow-black/10 backdrop-blur`,children:[A,ee,G,ae,de,ve,ye,we]}),t[110]=ee,t[111]=G,t[112]=ae,t[113]=de,t[114]=k,t[115]=ve,t[116]=ye,t[117]=we,t[118]=Te):Te=t[118],Te}var iT={current:0,total:0},aT=120,oT=100;function sT(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=()=>e?f(e):null,t[0]=e,t[1]=n),(0,Q.useSyncExternalStore)(je,n,cT)}function cT(){return null}function lT(e){if(!e||e.isDestroyed)return null;let{from:t,to:n,empty:r}=e.state.selection;if(r)return null;let i=e.state.doc.textBetween(t,n,`
14
+ `).trim(),mentions:t}}function nC(e){let{instruction:t,mentions:n}=tC(e);return t===``&&n.length===0}function rC(e){let t=e?.content;return!Array.isArray(t)||t.length===0?!1:t.some(e=>Array.isArray(e.content)&&e.content.length>0)}function iC(e){let t=(0,$.c)(29),{ref:n,ariaLabel:r,onEmptyChange:i,onContentChange:a,onMentionsChange:o,onSubmit:s,className:c,placeholder:l,initialDoc:u}=e,d=(0,Q.useRef)(i),f=(0,Q.useRef)(a),p=(0,Q.useRef)(o),m=(0,Q.useRef)(s),h;t[0]!==a||t[1]!==i||t[2]!==o||t[3]!==s?(h=()=>{d.current=i,f.current=a,p.current=o,m.current=s},t[0]=a,t[1]=i,t[2]=o,t[3]=s,t[4]=h):h=t[4],(0,Q.useEffect)(h);let g;t[5]===l?g=t[6]:(g=QS({placeholder:l}),t[5]=l,t[6]=g);let _=u??void 0,v;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(v=$t(`composer-prosemirror py-1 outline-none`),t[7]=v):v=t[7];let y;t[8]===r?y=t[9]:(y={role:`textbox`,"aria-label":r,"aria-multiline":`true`,class:v},t[8]=r,t[9]=y);let b;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(b=(e,t)=>t.key===`Escape`?WS.getState(e.state)?.active?!1:(e.dom.blur(),!0):t.key===`Enter`&&!t.shiftKey&&!t.isComposing&&!e.composing?WS.getState(e.state)?.active?!1:(m.current(),!0):!1,t[10]=b):b=t[10];let x;t[11]===y?x=t[12]:(x={attributes:y,handleKeyDown:b},t[11]=y,t[12]=x);let S;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(S=e=>{let{editor:t}=e;d.current(nC(t)),f.current?.(t.getJSON()),p.current?.(tC(t).mentions)},t[13]=S):S=t[13];let C;t[14]!==g||t[15]!==_||t[16]!==x?(C={extensions:g,content:_,immediatelyRender:!0,editorProps:x,onUpdate:S},t[14]=g,t[15]=_,t[16]=x,t[17]=C):C=t[17];let w=Zn(C),T;t[18]!==w||t[19]!==u?(T=()=>{w&&(nC(w)&&rC(u)&&(console.warn(`composer draft was incompatible with the current schema — clearing it`),LS()),d.current(nC(w)),p.current?.(tC(w).mentions))},t[18]=w,t[19]=u,t[20]=T):T=t[20];let E;t[21]===w?E=t[22]:(E=[w],t[21]=w,t[22]=E),(0,Q.useEffect)(T,E);let D,O;t[23]===w?(D=t[24],O=t[25]):(D=()=>({focus:()=>w?.commands.focus(),blur:()=>w?.commands.blur(),clear:()=>w?.commands.clearContent(!0),setText:e=>{w&&(w.commands.setContent(e),f.current?.(w.getJSON()),p.current?.(tC(w).mentions))},getContent:()=>w?tC(w):{instruction:``,mentions:[]}}),O=[w],t[23]=w,t[24]=D,t[25]=O),(0,Q.useImperativeHandle)(n,D,O);let k;return t[26]!==c||t[27]!==w?(k=(0,Z.jsx)(Vn,{editor:w,className:c}),t[26]=c,t[27]=w,t[28]=k):k=t[28],k}function aC(e,t,n){return e.trim().length>0||t.length>0||n}new Set(Ki.map(e=>e.id));function oC(e,t){Cc(e,t)}function sC(e){let t=(0,$.c)(2),{agentName:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(J,{id:`5PrrYw`,values:{agentName:n}}),t[0]=n,t[1]=r),r}function cC(e){let t=(0,$.c)(29),{scenario:n,className:r}=e,{_:i}=vt(),{states:a,refresh:o}=Ks(),s=Wi(),{dispatch:c}=Bs(),l=Ju(),u=Vs(),[d,f]=(0,Q.useState)(uC),p=Ii(),m=Ri(),h;t[0]===s?h=t[1]:(h=e=>qi(s,e.source,e.id,!0,e.supported),t[0]=s,t[1]=h);let g=m.filter(h),_=Fi(g,p),v;t[2]===u?.installedClis?v=t[3]:(v=u?.installedClis??{},t[2]=u?.installedClis,t[3]=v);let y=Yc({sticky:d,effectiveThreadAgent:_,enabledClis:u===null?[]:Kc(s,u.installedClis),enabledDesktopTargets:Dc(s),installedClis:v,terminalAvailable:u!==null,threadsAvailable:!0,desktopSelectable:!0}),b=y.kind===`thread`,x=y.kind===`cli`?y.cli:null,S=y.kind===`desktop`?y.target:null,C=x!==null,w=(0,Q.useRef)(null),[T]=(0,Q.useState)(lC),[E,D]=(0,Q.useState)(!0),[O,k]=(0,Q.useState)(!1),A;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(e){D(e),e||k(!1)},t[4]=A):A=t[4];let j=A,M=SS(n),N;t[5]===s?N=t[6]:(N=e=>Zi(s,e.id),t[5]=s,t[6]=N);let P=Ki.filter(N),F=Ki.every(e=>a[e.id]?.installed!=null),I=u!==null&&Kc(s,u.installedClis).length>0,L=F&&P.length===0&&g.length===0&&!I,R;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(R=function(e){f(e),Cc(e),oC(e)},t[7]=R):R=t[7];let z=R,B;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(B=function(e){f(Sc(e)),Cc(Sc(e))},t[8]=B):B=t[8];let V=B,H;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(H=function(e){zi(e),f(xc),Cc(xc)},t[9]=H):H=t[9];let U=H,W=function(){let{instruction:e,mentions:t}=w.current?.getContent()??{instruction:``,mentions:[]};if(!aC(e,t,!1)){k(!0);return}let r=Hs({workspace:l,description:e,scenario:n,mentions:t});r!==null&&(nc(r,_===null?void 0:{agent:{source:_.source,id:_.id}}),w.current?.clear(),LS())},ee=function(){if(u===null||x===null)return;let{instruction:e,mentions:t}=w.current?.getContent()??{instruction:``,mentions:[]};if(!aC(e,t,!1)){k(!0);return}let r=Hs({workspace:l,description:e,scenario:n,mentions:t});r!==null&&(u.launchInTerminal(r,x),w.current?.clear(),LS())},G=function(e){let{instruction:t,mentions:r}=w.current?.getContent()??{instruction:``,mentions:[]};if(!aC(t,r,!1)){k(!0);return}if(oC(e),a[e]?.installed!==!0){let t=Ki.find(t=>t.id===e);t&&ec(t);return}let i=Hs({workspace:l,description:t,scenario:n,mentions:r});i!==null&&(c(e,i),w.current?.clear(),LS())},K=function(){b?W():C?ee():S!==null&&G(S)},te=function(e){w.current?.setText(e),w.current?.focus()};if(L){let e;t[10]===r?e=t[11]:(e=$t(`flex w-full flex-wrap items-center justify-between gap-3 rounded-2xl border border-border/60 bg-card px-4 py-3`,r),t[10]=r,t[11]=e);let n;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(oc,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`}),t[12]=n):n=t[12];let i;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[n,(0,Z.jsx)(`span`,{className:`text-1sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`XT-L4j`})})]}),t[13]=i):i=t[13];let a;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsxs)(Y,{type:`button`,variant:`outline`,size:`sm`,onClick:ea,className:`gap-1.5`,"data-testid":`create-configure-agents`,children:[(0,Z.jsx)(nl,{"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(J,{id:`jRAGrQ`})]}),t[14]=a):a=t[14];let o;return t[15]===e?o=t[16]:(o=(0,Z.jsxs)(`div`,{className:e,"data-testid":`create-no-agents`,children:[i,a]}),t[15]=e,t[16]=o),o}let ne=u?Kc(s,u.installedClis):[],re=P.length>0,ie=ne.length>0,ae=g.length>0,oe=y.kind!==`none`,se;t[17]===r?se=t[18]:(se=$t(`flex w-full flex-col gap-3`,r),t[17]=r,t[18]=se);let ce;t[19]===i?ce=t[20]:(ce=i({id:`7hctf2`}),t[19]=i,t[20]=ce);let le;t[21]===i?le=t[22]:(le=i({id:`0jD-Gn`}),t[21]=i,t[22]=le);let ue;t[23]!==E||t[24]!==O?(ue=O&&E?(0,Z.jsx)(`p`,{role:`alert`,className:`text-1sm text-destructive`,"data-testid":`create-input-required`,children:(0,Z.jsx)(J,{id:`1FLarN`})}):(0,Z.jsx)(`span`,{}),t[23]=E,t[24]=O,t[25]=ue):ue=t[25];let de=oe?(0,Z.jsxs)(zS,{children:[(0,Z.jsx)(Y,{type:`button`,onClick:()=>b?W():C?ee():S===null?void 0:G(S),variant:`outline`,className:`gap-1.5`,"data-testid":`create-with-agent`,children:b&&_!==null?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(fs,{agentId:_.id,iconUrl:_.iconUrl,className:`size-3.5`}),(0,Z.jsx)(sC,{agentName:_.name})]}):C&&x!==null?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ji,{id:Vi(x),"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(J,{id:`4rjwLG`,values:{0:Da[x].displayName}})]}):S===null?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ji,{id:S,"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(J,{id:`9dw5bW`,values:{0:Rs(S)}})]})}),(0,Z.jsxs)(Br,{onOpenChange:e=>{e&&o()},children:[(0,Z.jsx)(Pr,{asChild:!0,children:(0,Z.jsx)(Y,{type:`button`,"aria-label":i({id:`nskygk`}),size:`icon`,variant:`outline`,"data-testid":`create-with-agent-menu`,children:(0,Z.jsx)(ks,{"aria-hidden":`true`,className:`size-3.5`})})}),(0,Z.jsxs)(Rr,{align:`end`,className:`max-h-80 min-w-[200px]`,children:[ae?(0,Z.jsxs)(Nr,{"aria-label":i({id:`vPKX2i`}),children:[(0,Z.jsxs)(Ir,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(J,{id:`RXEbZy`}),(0,Z.jsx)(Xi,{})]}),g.map(e=>(0,Z.jsxs)(Ar,{onSelect:()=>U(e),"data-testid":`create-agent-option-thread-${e.source}:${e.id}`,children:[(0,Z.jsx)(fs,{agentId:e.id,iconUrl:e.iconUrl,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1 truncate`,children:e.name}),b&&_!==null&&_.source===e.source&&_.id===e.id?(0,Z.jsx)(Ds,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},`${e.source}:${e.id}`))]}):null,ae&&(ie||re)?(0,Z.jsx)(Vr,{}):null,ie?(0,Z.jsxs)(Nr,{"aria-label":i({id:`ALhMYW`}),children:[(0,Z.jsx)(Ir,{children:(0,Z.jsx)(J,{id:`ALhMYW`})}),ne.map(e=>{let{displayName:t}=Da[e];return(0,Z.jsxs)(Ar,{onSelect:()=>V(e),"data-testid":`create-with-cli-${e}`,"aria-label":i({id:`QYfQdv`,values:{displayName:t}}),children:[(0,Z.jsx)(Ji,{id:Vi(e),"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:t}),x===e?(0,Z.jsx)(Ds,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e)})]}):null,re?(0,Z.jsxs)(Z.Fragment,{children:[ie?(0,Z.jsx)(Vr,{}):null,(0,Z.jsxs)(Nr,{"aria-label":i({id:`BBqGS9`}),children:[(0,Z.jsx)(Ir,{children:(0,Z.jsx)(J,{id:`BBqGS9`})}),P.map(e=>(0,Z.jsxs)(Ar,{onSelect:()=>z(e.id),"data-testid":`create-agent-option-${e.id}`,children:[(0,Z.jsx)(Ji,{id:e.id,"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:e.displayName}),!C&&e.id===S?(0,Z.jsx)(Ds,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.id))]})]}):null,(0,Z.jsx)(Vr,{}),(0,Z.jsxs)(Ar,{onSelect:ea,"data-testid":`create-agent-option-settings`,children:[(0,Z.jsx)(nl,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(J,{id:`jRAGrQ`})})]})]})]})]}):(0,Z.jsx)(Y,{type:`button`,variant:`outline`,disabled:!0,className:`gap-1.5`,"data-testid":`create-with-agent`,children:(0,Z.jsx)(J,{id:`hYgDIe`})}),fe;return t[26]!==ue||t[27]!==de?(fe=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 px-3 pb-3`,children:[ue,de]}),t[26]=ue,t[27]=de,t[28]=fe):fe=t[28],(0,Z.jsxs)(`div`,{className:se,children:[(0,Z.jsxs)(`div`,{onMouseDown:e=>rl(e,w),className:`flex w-full cursor-text flex-col rounded-2xl border border-border/60 bg-card shadow-sm transition-colors focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50`,children:[(0,Z.jsx)(iC,{ref:w,ariaLabel:ce,placeholder:le,onEmptyChange:j,onContentChange:IS,onSubmit:K,initialDoc:T,className:`max-h-96 overflow-y-auto px-4 py-3 text-sm leading-relaxed subtle-scrollbar [&_.ProseMirror]:min-h-16`}),fe]}),n!==`existing-repo`&&M.length>0?(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-1sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`I5685_`})}),M.map(e=>{let t=e.icon;return(0,Z.jsxs)(Y,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>te(e.prompt),className:`gap-1.5 rounded-md font-normal text-muted-foreground hover:text-foreground`,"data-testid":`create-suggestion-${e.id}`,children:[(0,Z.jsx)(t,{className:`size-3.5`,"aria-hidden":`true`}),e.label]},e.id)})]}):null]})}function lC(){return FS().doc??void 0}function uC(){return qc()}function dC(e){let t=(0,$.c)(12),{title:n,subtitle:r,celebrateSignal:i}=e,a;t[0]===i?a=t[1]:(a=(0,Z.jsx)(mp,{size:64,celebrateSignal:i}),t[0]=i,t[1]=a);let o;t[2]===n?o=t[3]:(o=(0,Z.jsx)(`h2`,{className:`text-2xl font-light tracking-tighter text-balance`,children:n}),t[2]=n,t[3]=o);let s;t[4]===r?s=t[5]:(s=r?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r}):null,t[4]=r,t[5]=s);let c;t[6]!==o||t[7]!==s?(c=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8];let l;return t[9]!==a||t[10]!==c?(l=(0,Z.jsxs)(`div`,{className:`flex flex-col items-start gap-3 @md/emptystate:flex-row @md/emptystate:items-center @md/emptystate:gap-4`,children:[a,c]}),t[9]=a,t[10]=c,t[11]=l):l=t[11],l}function fC({isOnboarding:e,isEmbedded:t}){return e?{title:{id:`6h4zVU`},subtitle:t?{id:`vGeNNQ`}:{id:`qpQwGC`}}:{title:{id:`FOGD7m`},subtitle:t?{id:`3DTatP`}:{id:`MqQoV-`}}}var pC=`open-knowledge:create-top-level-file`;function mC(e={}){window.dispatchEvent(new CustomEvent(pC,{detail:e}))}function hC(e){let t=t=>{let n=t.detail;e(n??{})};return window.addEventListener(pC,t),()=>window.removeEventListener(pC,t)}function gC(e){let t=(0,$.c)(28),{celebrateSignal:n,onAddStarterPack:r}=e,{_:i}=vt(),a=lc(),{title:o,subtitle:s}=fC({isOnboarding:!1,isEmbedded:a}),c=oi(),l;t[0]!==c.data||t[1]!==c.status?(l=c.status===`ready`?c.data:[],t[0]=c.data,t[1]=c.status,t[2]=l):l=t[2];let u=l,d=c.status===`loading`||c.status===`idle`,f=c.status===`error`,p=dC,m=i(o),h=i(s),g;t[3]!==p||t[4]!==n||t[5]!==m||t[6]!==h?(g=(0,Z.jsx)(p,{title:m,subtitle:h,celebrateSignal:n}),t[3]=p,t[4]=n,t[5]=m,t[6]=h,t[7]=g):g=t[7];let _;t[8]===a?_=t[9]:(_=a?(0,Z.jsx)(CS,{scenario:`existing-repo`}):(0,Z.jsx)(cC,{scenario:`existing-repo`}),t[8]=a,t[9]=_);let v;t[10]!==u||t[11]!==f||t[12]!==d?(v=d||f||u.length>0?(0,Z.jsx)(yC,{templates:u,loading:d,error:f,onSelect:vC}):null,t[10]=u,t[11]=f,t[12]=d,t[13]=v):v=t[13];let y,b;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(Kt,{"aria-hidden":`true`,className:`size-3`}),b=(0,Z.jsx)(J,{id:`IajAbS`}),t[14]=y,t[15]=b):(y=t[14],b=t[15]);let x;t[16]===r?x=t[17]:(x=(0,Z.jsxs)(Y,{onClick:r,variant:`link-muted`,size:`xs`,className:`font-mono text-xs uppercase tracking-wider`,children:[y,b]}),t[16]=r,t[17]=x);let S;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(Y,{variant:`link-muted`,className:`justify-end`,size:`sm`,onClick:_C,children:(0,Z.jsx)(J,{id:`L4Cdd9`,components:{0:(0,Z.jsx)(Ln,{"aria-hidden":`true`,className:`size-3`})}})}),t[18]=S):S=t[18];let C;t[19]===x?C=t[20]:(C=(0,Z.jsxs)(`div`,{className:`-mt-6 flex w-full items-center justify-between gap-4`,children:[x,S]}),t[19]=x,t[20]=C);let w;t[21]!==C||t[22]!==v?(w=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-8`,children:[v,C]}),t[21]=C,t[22]=v,t[23]=w):w=t[23];let T;return t[24]!==w||t[25]!==g||t[26]!==_?(T=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-8 py-12 max-w-5xl my-auto`,children:[g,_,w]}),t[24]=w,t[25]=g,t[26]=_,t[27]=T):T=t[27],T}function _C(){return mC({initialDir:``})}function vC(e,t){return mC({template:{folder:e,name:t}})}function yC(e){let t=(0,$.c)(25),{templates:n,loading:r,error:i,onSelect:a}=e,{_:o}=vt(),s;t[0]===o?s=t[1]:(s=o({id:`_8quCH`}),t[0]=o,t[1]=s);let c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`_8quCH`})}),t[2]=c):c=t[2];let l;t[3]!==o||t[4]!==i||t[5]!==r||t[6]!==n?(l=r||i?null:(0,Z.jsx)(fu,{className:`text-2xs`,variant:`gray`,"aria-label":o({id:`X7u0xR`,values:{0:n.length}}),children:n.length}),t[3]=o,t[4]=i,t[5]=r,t[6]=n,t[7]=l):l=t[7];let u;t[8]===l?u=t[9]:(u=(0,Z.jsxs)(`header`,{className:`flex items-center gap-2 font-mono text-2xs uppercase tracking-wider text-muted-foreground`,children:[c,l]}),t[8]=l,t[9]=u);let d;t[10]===o?d=t[11]:(d=o({id:`irFGwu`}),t[10]=o,t[11]=d);let f;t[12]!==i||t[13]!==r||t[14]!==a||t[15]!==n?(f=r?(0,Z.jsx)(`p`,{className:`p-4 text-1sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`Hl89Qd`})}):i?(0,Z.jsx)(`p`,{role:`alert`,className:`p-4 text-1sm text-destructive`,children:(0,Z.jsx)(J,{id:`54Y6Fg`})}):n.map(e=>(0,Z.jsx)(bC,{template:e,targetLabel:e.source_folder===``?`/`:`${e.source_folder}/`,onClick:()=>a(e.source_folder,e.name)},`${e.source_folder}/${e.name}`)),t[12]=i,t[13]=r,t[14]=a,t[15]=n,t[16]=f):f=t[16];let p;t[17]!==r||t[18]!==d||t[19]!==f?(p=(0,Z.jsx)(`div`,{className:`w-full overflow-hidden rounded-xl border border-border/60 bg-card`,children:(0,Z.jsx)(`section`,{"aria-busy":r,"aria-label":d,tabIndex:0,className:`subtle-scrollbar scroll-fade-mask flex max-h-[260px] w-full flex-col overflow-y-auto overscroll-contain focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50`,children:f})}),t[17]=r,t[18]=d,t[19]=f,t[20]=p):p=t[20];let m;return t[21]!==s||t[22]!==u||t[23]!==p?(m=(0,Z.jsxs)(`section`,{"aria-label":s,className:`flex w-full flex-col gap-3`,children:[u,p]}),t[21]=s,t[22]=u,t[23]=p,t[24]=m):m=t[24],m}function bC(e){let t=(0,$.c)(24),{template:n,targetLabel:r,onClick:i}=e,{_:a}=vt(),o;t[0]!==n.name||t[1]!==n.title?(o=n.title?.trim()||n.name,t[0]=n.name,t[1]=n.title,t[2]=o):o=t[2];let s=o,c=`${n.name}.md`,l=n.source_folder===``,u;t[3]!==a||t[4]!==s||t[5]!==c||t[6]!==l||t[7]!==r?(u=a(l?{id:`89TtiD`,values:{displayTitle:s,fileName:c}}:{id:`0_J12R`,values:{displayTitle:s,fileName:c,targetLabel:r}}),t[3]=a,t[4]=s,t[5]=c,t[6]=l,t[7]=r,t[8]=u):u=t[8];let d=u,f;t[9]===s?f=t[10]:(f=(0,Z.jsx)(`span`,{className:`truncate text-sm font-medium leading-tight text-foreground/80`,children:s}),t[9]=s,t[10]=f);let p;t[11]===c?p=t[12]:(p=(0,Z.jsx)(`span`,{className:`truncate font-mono text-1sm font-normal text-muted-foreground`,children:c}),t[11]=c,t[12]=p);let m;t[13]!==f||t[14]!==p?(m=(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-2`,children:[f,p]}),t[13]=f,t[14]=p,t[15]=m):m=t[15];let h=`shrink-0 font-mono text-1sm ${l?`text-muted-foreground/70`:`text-muted-foreground`}`,g;t[16]!==h||t[17]!==r?(g=(0,Z.jsx)(`span`,{className:h,children:r}),t[16]=h,t[17]=r,t[18]=g):g=t[18];let _;return t[19]!==d||t[20]!==i||t[21]!==m||t[22]!==g?(_=(0,Z.jsxs)(Y,{type:`button`,variant:`ghost`,onClick:i,"aria-label":d,className:`group flex h-auto w-full items-center justify-between gap-4 rounded-none p-4 text-left transition-colors hover:bg-muted/50 focus-visible:bg-muted/50`,children:[m,g]}),t[19]=d,t[20]=i,t[21]=m,t[22]=g,t[23]=_):_=t[23],_}function xC(e){let t=(0,$.c)(25),{terminalDock:n}=e,r=n===void 0?null:n,[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(void 0),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(0),f=(0,Q.useRef)(!1),p=(0,Q.useRef)(void 0),m,h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>{let e=!1,t=async function(){try{let{ok:t,body:n}=await Xl();if(e)return;let r=t?xo.safeParse(n):null;r?.success?(l(wC(r.data.documents)),f.current=!0):f.current||=(l(1),!0)}catch{!e&&!f.current&&(l(1),f.current=!0)}};t();let n=ql(e=>{e.includes(`files`)&&t()});return()=>{e=!0,n(),clearTimeout(p.current)}},h=[],t[0]=m,t[1]=h):(m=t[0],h=t[1]),(0,Q.useEffect)(m,h);let g;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(g=function(){clearTimeout(p.current),p.current=setTimeout(()=>d(CC),500),Xl().then(e=>{let{ok:t,body:n}=e;if(!t)return;let r=xo.safeParse(n);r.success&&l(wC(r.data.documents))}).catch(SC)},t[2]=g):g=t[2];let _=g,v=c!==null,y=c===0,b;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(b=function(e){a(e),e||s(void 0)},t[3]=b):b=t[3];let x=b;if(r!==null){let e=r===`bottom`?`justify-end`:`justify-center`,n;t[4]===e?n=t[5]:(n=$t(`@container/emptystate flex min-h-0 flex-1 flex-col items-center pb-8 pt-10`,e),t[4]=e,t[5]=n);let i;t[6]!==u||t[7]!==y||t[8]!==v?(i=v?(0,Z.jsx)(TC,{isOnboarding:y,celebrateSignal:u}):null,t[6]=u,t[7]=y,t[8]=v,t[9]=i):i=t[9];let a;t[10]===i?a=t[11]:(a=(0,Z.jsx)(`div`,{className:`flex w-full flex-col items-center px-4 @md/emptystate:px-10 @2xl/emptystate:px-16`,children:i}),t[10]=i,t[11]=a);let o;return t[12]!==n||t[13]!==a?(o=(0,Z.jsx)(`div`,{className:n,children:a}),t[12]=n,t[13]=a,t[14]=o):o=t[14],o}let S;t[15]!==u||t[16]!==y||t[17]!==v?(S=v?y?(0,Z.jsx)(EC,{celebrateSignal:u,onPackSelect:e=>{s(e),a(!0)}}):(0,Z.jsx)(gC,{celebrateSignal:u,onAddStarterPack:()=>{a(!0)}}):null,t[15]=u,t[16]=y,t[17]=v,t[18]=S):S=t[18];let C;t[19]!==o||t[20]!==i?(C=(0,Z.jsx)(U_,{open:i,onOpenChange:x,onSeedApplied:_,initialPackId:o}),t[19]=o,t[20]=i,t[21]=C):C=t[21];let w;return t[22]!==S||t[23]!==C?(w=(0,Z.jsx)(`div`,{className:`@container/emptystate flex min-h-0 flex-1 flex-col items-center overflow-y-auto subtle-scrollbar`,children:(0,Z.jsxs)(`div`,{className:`flex w-full flex-1 flex-col items-center px-4 @md/emptystate:px-10 @2xl/emptystate:px-16`,children:[S,C]})}),t[22]=S,t[23]=C,t[24]=w):w=t[24],w}function SC(){}function CC(e){return e+1}function wC(e){return Al(e).filter(e=>e.kind===`document`||e.kind===`folder`).length}function TC(e){let t=(0,$.c)(15),{isOnboarding:n,celebrateSignal:r}=e,{_:i}=vt(),a=lc(),o,s,c,l;if(t[0]!==i||t[1]!==a||t[2]!==n){let{title:e,subtitle:r}=fC({isOnboarding:n,isEmbedded:a});l=`w-full max-w-5xl`,o=dC,s=i(e),c=i(r),t[0]=i,t[1]=a,t[2]=n,t[3]=o,t[4]=s,t[5]=c,t[6]=l}else o=t[3],s=t[4],c=t[5],l=t[6];let u;t[7]!==o||t[8]!==r||t[9]!==s||t[10]!==c?(u=(0,Z.jsx)(o,{title:s,subtitle:c,celebrateSignal:r}),t[7]=o,t[8]=r,t[9]=s,t[10]=c,t[11]=u):u=t[11];let d;return t[12]!==l||t[13]!==u?(d=(0,Z.jsx)(`div`,{className:l,children:u}),t[12]=l,t[13]=u,t[14]=d):d=t[14],d}function EC(e){let t=(0,$.c)(29),{celebrateSignal:n,onPackSelect:r}=e,{_:i}=vt(),a=lc(),o,s,c,l;if(t[0]!==i||t[1]!==a){let{title:e,subtitle:n}=fC({isOnboarding:!0,isEmbedded:a});l=`flex w-full flex-col gap-10 py-12 max-w-5xl my-auto`,o=dC,s=i(e),c=i(n),t[0]=i,t[1]=a,t[2]=o,t[3]=s,t[4]=c,t[5]=l}else o=t[2],s=t[3],c=t[4],l=t[5];let u;t[6]!==o||t[7]!==n||t[8]!==s||t[9]!==c?(u=(0,Z.jsx)(o,{title:s,subtitle:c,celebrateSignal:n}),t[6]=o,t[7]=n,t[8]=s,t[9]=c,t[10]=u):u=t[10];let d;t[11]===a?d=t[12]:(d=a?(0,Z.jsx)(CS,{scenario:`new-project`}):(0,Z.jsx)(cC,{scenario:`new-project`}),t[11]=a,t[12]=d);let f;t[13]!==i||t[14]!==a?(f=i(a?{id:`GubkSu`}:{id:`xeXS4P`}),t[13]=i,t[14]=a,t[15]=f):f=t[15];let p;t[16]===f?p=t[17]:(p=(0,Z.jsx)(OC,{label:f}),t[16]=f,t[17]=p);let m;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(m=[`okf`,`entity-vault`],t[18]=m):m=t[18];let h;t[19]===r?h=t[20]:(h=(0,Z.jsx)(L_,{onPackSelect:r,onCreateBlankFile:DC,collapsedPackIds:m}),t[19]=r,t[20]=h);let g;t[21]!==p||t[22]!==h?(g=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-3`,children:[p,h]}),t[21]=p,t[22]=h,t[23]=g):g=t[23];let _;return t[24]!==g||t[25]!==l||t[26]!==u||t[27]!==d?(_=(0,Z.jsxs)(`div`,{className:l,children:[u,d,g]}),t[24]=g,t[25]=l,t[26]=u,t[27]=d,t[28]=_):_=t[28],_}function DC(){return mC()}function OC(e){let t=(0,$.c)(13),{label:n}=e,{_:r}=vt(),i;t[0]===n?i=t[1]:(i=(0,Z.jsx)(`span`,{className:`font-mono text-2xs uppercase tracking-wider text-muted-foreground whitespace-nowrap`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=r({id:`jAMpHn`}),t[2]=r,t[3]=a);let o;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(Xc,{className:`size-3.5`,"aria-hidden":!0}),t[4]=o):o=t[4];let s;t[5]===a?s=t[6]:(s=(0,Z.jsx)(ln,{className:`text-muted-foreground transition-colors hover:text-foreground`,"aria-label":a,"data-testid":`starter-pack-info`,children:o}),t[5]=a,t[6]=s);let c;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(un,{className:`max-w-xs`,children:(0,Z.jsx)(`p`,{className:`leading-relaxed wrap-break-word`,children:(0,Z.jsx)(J,{id:`k4CuuV`})})}),t[7]=c):c=t[7];let l;t[8]===s?l=t[9]:(l=(0,Z.jsxs)(fn,{children:[s,c]}),t[8]=s,t[9]=l);let u;return t[10]!==i||t[11]!==l?(u=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[i,l]}),t[10]=i,t[11]=l,t[12]=u):u=t[12],u}function kC(e){return e===``?`.ok/frontmatter.yml`:`${e}/.ok/frontmatter.yml`}function AC(e){let t=(0,$.c)(70),{folderPath:n,state:r,onChange:i}=e,{_:a}=vt(),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(null);if(r.status===`idle`||r.status===`loading`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card p-4 space-y-3`,children:[(0,Z.jsx)(MC,{}),(0,Z.jsx)(Cd,{className:`h-7 w-full`}),(0,Z.jsx)(Cd,{className:`h-7 w-full`}),(0,Z.jsx)(Cd,{className:`h-7 w-full`})]}),t[0]=e):e=t[0],e}if(r.status===`error`){let{message:e}=r,n;return t[1]===e?n=t[2]:(n=(0,Z.jsx)(`section`,{className:`rounded-lg border border-destructive/30 bg-destructive/5 p-4 text-sm text-destructive`,role:`alert`,children:(0,Z.jsx)(J,{id:`lzmtKp`,values:{message:e}})}),t[1]=e,t[2]=n),n}let f;t[3]===r.data.frontmatterLocal?f=t[4]:(f=r.data.frontmatterLocal??{},t[3]=r.data.frontmatterLocal,t[4]=f);let p=f,m;t[5]===r.data.folder.path?m=t[6]:(m=kC(r.data.folder.path),t[5]=r.data.folder.path,t[6]=m);let h=m,g;t[7]===p?g=t[8]:(g=Object.keys(p),t[7]=p,t[8]=g);let _=g,v;t[9]!==a||t[10]!==n||t[11]!==i?(v=async function(e,t){let r=await vc(n,{[e]:t});if(!r.ok){let{error:e}=r;X.error(a({id:`xXo8FT`,values:{error:e}}));return}i()},t[9]=a,t[10]=n,t[11]=i,t[12]=v):v=t[12];let y=v,b;t[13]!==a||t[14]!==n||t[15]!==i?(b=async function(e){let t=await vc(n,{[e]:null});if(!t.ok){let{error:e}=t;X.error(a({id:`ZU8VV_`,values:{error:e}}));return}i()},t[13]=a,t[14]=n,t[15]=i,t[16]=b):b=t[16];let x=b,S;t[17]!==y||t[18]!==p?(S=function(e,t){let n=p[e];y(e,gs(n,t))},t[17]=y,t[18]=p,t[19]=S):S=t[19];let C=S,w;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(w=function(){l({name:``,type:`text`,value:``,error:null}),s(!1)},t[20]=w):w=t[20];let T=w,E;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(E=function(e){l(t=>{if(!t)return t;let n=e===`date`?new Date().toISOString().slice(0,10):Es[e];return{...t,type:e,value:n,error:null}})},t[21]=E):E=t[21];let D=E,O;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(O=function(e){l(t=>t&&{...t,value:e})},t[22]=O):O=t[22];let k=O,A;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(e){l(t=>t&&{...t,name:e,error:null})},t[23]=A):A=t[23];let j=A,M;t[24]!==a||t[25]!==c||t[26]!==n||t[27]!==i||t[28]!==p?(M=async function(e){if(!c)return;let t=e??c.value,r=c.name.trim();if(!r){l({...c,value:t,error:a({id:`8_brI5`})});return}if(To(t)){l({...c,value:t,error:a({id:`hXUWyd`})});return}if(Object.hasOwn(p,r)){l({...c,value:t,error:a({id:`CTJLpz`,values:{trimmed:r}})});return}let o=await vc(n,{[r]:t});if(!o.ok){l({...c,value:t,error:o.error});return}l(null),i()},t[24]=a,t[25]=c,t[26]=n,t[27]=i,t[28]=p,t[29]=M):M=t[29];let N=M,P;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(P=function(e){d({key:e,draft:e,error:null})},t[30]=P):P=t[30];let F=P,I;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(I=function(e){d(t=>t&&{...t,draft:e,error:null})},t[31]=I):I=t[31];let L=I,R;t[32]!==a||t[33]!==n||t[34]!==i||t[35]!==p||t[36]!==u?(R=async function(){if(!u)return;let e=u.draft.trim();if(!e){d({...u,error:a({id:`8_brI5`})});return}if(e===u.key){d(null);return}if(Object.hasOwn(p,e)){d({...u,error:a({id:`CTJLpz`,values:{trimmed:e}})});return}let t=p[u.key],r=await vc(n,{[u.key]:null,[e]:t});if(!r.ok){d({...u,error:r.error});return}d(null),i()},t[32]=a,t[33]=n,t[34]=i,t[35]=p,t[36]=u,t[37]=R):R=t[37];let z=R,B;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(B=function(){d(null)},t[38]=B):B=t[38];let V=B,H=!o,U;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(U=e=>s(!e),t[39]=U):U=t[39];let W=`size-3 transition-transform ${o?``:`rotate-90`}`,ee;t[40]===W?ee=t[41]:(ee=(0,Z.jsx)(As,{className:W,"aria-hidden":!0}),t[40]=W,t[41]=ee);let G;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`vQIVHc`})}),t[42]=G):G=t[42];let K;t[43]===ee?K=t[44]:(K=(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:[ee,G]}),t[43]=ee,t[44]=K);let te;t[45]===h?te=t[46]:(te=(0,Z.jsx)(`code`,{className:`text-xs text-muted-foreground font-mono cursor-text select-text`,onClick:jC,children:h}),t[45]=h,t[46]=te);let ne;t[47]!==K||t[48]!==te?(ne=(0,Z.jsxs)(mn,{className:`flex w-full cursor-pointer items-center justify-between gap-2 px-3 py-2.5 data-[state=open]:border-b border-border`,children:[K,te]}),t[47]=K,t[48]=te,t[49]=ne):ne=t[49];let re;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Z.jsx)(`p`,{className:`px-1 pb-2 text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`hSBIG-`})}),t[50]=re):re=t[50];let ie;t[51]!==c||t[52]!==y||t[53]!==z||t[54]!==_||t[55]!==p||t[56]!==x||t[57]!==u||t[58]!==C?(ie=_.length===0&&!c?(0,Z.jsx)(`p`,{className:`px-1 py-1 text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`4c_a6S`})}):_.map(e=>{let t=p[e];return(0,Z.jsx)(ws,{keyName:e,value:t,declared:ys(t,co(t)),rename:{state:u?.key===e?u:null,onBegin:()=>F(e),onChangeDraft:L,onCommit:z,onCancel:V},badge:null,onCommit:t=>void y(e,t),onChangeType:t=>C(e,t),onRemove:()=>void x(e)},e)}),t[51]=c,t[52]=y,t[53]=z,t[54]=_,t[55]=p,t[56]=x,t[57]=u,t[58]=C,t[59]=ie):ie=t[59];let ae;t[60]!==c||t[61]!==N?(ae=c?(0,Z.jsx)(xs,{draft:c,onChangeName:j,onChangeType:D,onChangeValue:k,onCommit:e=>void N(e),onCancel:()=>l(null)}):(0,Z.jsx)(`div`,{className:`mt-1 flex flex-wrap items-center gap-1`,children:(0,Z.jsxs)(Y,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`add-property-trigger`,onClick:()=>T(),className:`flex items-center gap-1.5 rounded px-2 py-1 font-medium text-sm hover:bg-muted/50 hover:text-foreground`,children:[(0,Z.jsx)(Kt,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`G8t9NN`})})]})}),t[60]=c,t[61]=N,t[62]=ae):ae=t[62];let oe;t[63]!==ie||t[64]!==ae?(oe=(0,Z.jsx)(pn,{children:(0,Z.jsxs)(`div`,{className:`px-2 py-2`,children:[re,ie,ae]})}),t[63]=ie,t[64]=ae,t[65]=oe):oe=t[65];let se;return t[66]!==H||t[67]!==ne||t[68]!==oe?(se=(0,Z.jsx)(`section`,{className:`rounded-lg border bg-card`,children:(0,Z.jsxs)(hn,{open:H,onOpenChange:U,children:[ne,oe]})}),t[66]=H,t[67]=ne,t[68]=oe,t[69]=se):se=t[69],se}function jC(e){return e.stopPropagation()}function MC(){let e=(0,$.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(Qm,{className:`size-4 text-muted-foreground`,"aria-hidden":!0}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[t,(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(J,{id:`vQIVHc`})})]}),e[1]=n):n=e[1],n}function NC(e){let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);return t<60?yl._({id:`xOTzt5`}):t<3600?yl._({id:`zbymaY`,values:{0:Math.floor(t/60)}}):t<86400?yl._({id:`optX0N`,values:{0:Math.floor(t/3600)}}):t<86400*7?yl._({id:`l1l8sj`,values:{0:Math.floor(t/86400)}}):new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function PC(e){return(e.split(`/`).pop()??e).replace(/\.md$/,``)}function FC(e){let t=e.message,n=t.indexOf(`: `),r=n===-1?t:t.slice(0,n),i=n===-1?``:t.slice(n+2);switch(r){case`template-create`:return{Icon:Oi,label:yl._({id:`QR5SP1`}),detail:PC(i)};case`template-edit`:return{Icon:fc,label:yl._({id:`-LHLx7`}),detail:PC(i)};case`template-delete`:return{Icon:ol,label:yl._({id:`_gkGSK`}),detail:PC(i)};case`template-rename`:case`template-move`:{let[e,t]=i.split(` -> `);return{Icon:Am,label:yl._({id:`KPW5WC`}),detail:`${PC(e??``)} → ${PC(t??i)}`}}case`folder-frontmatter-edit`:return{Icon:Qm,label:yl._({id:`_tekeB`}),detail:``};case`folder-frontmatter-delete`:return{Icon:Qm,label:yl._({id:`ZWxfrc`}),detail:``};case`folder-create`:return{Icon:Qm,label:yl._({id:`ZQLDTl`}),detail:``};default:return{Icon:Tc,label:r.replace(/-/g,` `),detail:PC(i)}}}function IC(e){return e.contributors.length>0?e.contributors[0].name:e.author===`openknowledge-service`||e.author===`server`?yl._({id:`B2DrPb`}):e.author||yl._({id:`Ef7StM`})}function LC(e){let t=(0,$.c)(15),{folderPath:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=[],t[0]=r):r=t[0];let[i,a]=(0,Q.useState)(r),[o,s]=(0,Q.useState)(!0),[c,l]=(0,Q.useState)(!1),u,d;if(t[1]===n?(u=t[2],d=t[3]):(u=()=>{let e=!1,t=async function(){try{let t=await fetch(`/api/history?folder=${encodeURIComponent(n)}&limit=50`);if(e)return;if(!t.ok){l(!0),s(!1);return}let r=await t.json();if(e)return;a(r.entries??[]),l(!1),s(!1)}catch(t){e||(console.warn(`[FolderTimelineCard] failed to load folder timeline:`,t),l(!0),s(!1))}};s(!0),t();let r=Gl(t);return()=>{e=!0,r()}},d=[n],t[1]=n,t[2]=u,t[3]=d),(0,Q.useEffect)(u,d),c||!o&&i.length===0)return null;let f;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(J,{id:`XJOV1Y`})}),t[4]=f):f=t[4];let p;t[5]===i.length?p=t[6]:(p=i.length>0?(0,Z.jsx)(fu,{className:`text-xs`,variant:`secondary`,children:i.length}):null,t[5]=i.length,t[6]=p);let m;t[7]===p?m=t[8]:(m=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border px-3 py-1`,children:[f,p]}),t[7]=p,t[8]=m);let h;t[9]!==i||t[10]!==o?(h=(0,Z.jsx)(`div`,{className:`px-3 py-2.5`,children:o?(0,Z.jsxs)(`div`,{className:`space-y-2`,role:`status`,"aria-busy":`true`,children:[(0,Z.jsx)(Cd,{className:`h-8 w-full`}),(0,Z.jsx)(Cd,{className:`h-8 w-full`})]}):(0,Z.jsx)(`ul`,{className:`space-y-1`,children:i.map(RC)})}),t[9]=i,t[10]=o,t[11]=h):h=t[11];let g;return t[12]!==m||t[13]!==h?(g=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card`,"data-testid":`folder-timeline-card`,children:[m,h]}),t[12]=m,t[13]=h,t[14]=g):g=t[14],g}function RC(e){let{Icon:t,label:n,detail:r}=FC(e);return(0,Z.jsxs)(`li`,{className:`flex items-center gap-2.5 rounded-md px-2 py-1.5 text-sm`,children:[(0,Z.jsx)(t,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":!0}),(0,Z.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[(0,Z.jsx)(`span`,{className:`text-foreground`,children:n}),r?(0,Z.jsx)(`code`,{className:`ml-1.5 font-mono text-xs text-muted-foreground`,children:r}):null]}),(0,Z.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1 text-xs text-muted-foreground`,children:[(0,Z.jsx)(Wh,{className:`size-3`,"aria-hidden":!0}),IC(e)]}),(0,Z.jsx)(`time`,{className:`shrink-0 text-xs text-muted-foreground/80`,dateTime:e.timestamp,title:new Date(e.timestamp).toLocaleString(),children:NC(e.timestamp)})]},e.sha)}function zC(e){let t=e.split(`/`).pop();return t?`${e}/${t}`:null}function BC(e,t){let n=t.get(`${e}/index`);if(n)return n;let r=zC(e);if(r){let e=t.get(r);if(e)return e}return e.split(`/`).pop()??e}function VC(e,t,n){let r=n.get(e);return r&&r!==e?r:t}function HC(e,t){let n=e===``?``:`${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:BC(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:VC(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:BC(e,t.pageTitles),children:a}}function UC(e){let t=(0,$.c)(41),{folderPath:n,state:r,onChange:i,folderConfigHandle:a}=e,[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(!1);if(r.status===`idle`||r.status===`loading`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card px-3 py-2.5 space-y-3`,children:[(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(J,{id:`-QCLWk`})})}),(0,Z.jsx)(Cd,{className:`h-12 w-full`}),(0,Z.jsx)(Cd,{className:`h-12 w-full`})]}),t[0]=e):e=t[0],e}if(r.status===`error`){let{message:e}=r,n;return t[1]===e?n=t[2]:(n=(0,Z.jsx)(`section`,{className:`rounded-lg border border-destructive/30 bg-destructive/5 p-4 text-sm text-destructive`,role:`alert`,children:(0,Z.jsx)(J,{id:`iDZtvM`,values:{message:e}})}),t[1]=e,t[2]=n),n}let f;t[3]===r.data.folder.templates_available?f=t[4]:(f=r.data.folder.templates_available??[],t[3]=r.data.folder.templates_available,t[4]=f);let p=f,m;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(J,{id:`-QCLWk`})}),t[5]=m):m=t[5];let h;t[6]===p.length?h=t[7]:(h=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[m,(0,Z.jsx)(fu,{className:`text-xs`,variant:`secondary`,children:p.length})]}),t[6]=p.length,t[7]=h);let g;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsxs)(Y,{variant:`ghost`,className:`font-mono uppercase`,size:`sm`,onClick:()=>d(!0),children:[(0,Z.jsx)(Kt,{className:`size-3.5`,"aria-hidden":!0}),(0,Z.jsx)(J,{id:`G1Gw0v`})]}),t[8]=g):g=t[8];let _;t[9]===h?_=t[10]:(_=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-border px-3 py-1`,children:[h,g]}),t[9]=h,t[10]=_);let v;t[11]===p?v=t[12]:(v=(0,Z.jsx)(`div`,{className:`px-3 py-2.5`,children:p.length===0?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`MZSBsh`})}):(0,Z.jsx)(`ul`,{className:`space-y-1`,children:p.map(e=>(0,Z.jsx)($r,{template:e,onCreate:()=>l(e.name),onEdit:()=>yc(et(e.source_folder,e.name)),onDelete:()=>s(e),badge:e.scope===`inherited`?(0,Z.jsx)(ms,{source:e.source_folder,target:`templates/${e.name}.md`}):void 0},e.path))})}),t[11]=p,t[12]=v);let y;t[13]!==_||t[14]!==v?(y=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card`,children:[_,v]}),t[13]=_,t[14]=v,t[15]=y):y=t[15];let b;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(b=e=>{e||s(null)},t[16]=b):b=t[16];let x;t[17]!==o||t[18]!==i?(x=(0,Z.jsx)(ti,{template:o,onOpenChange:b,onDeleted:i}),t[17]=o,t[18]=i,t[19]=x):x=t[19];let S;t[20]===p?S=t[21]:(S=new Set(p.map(WC)),t[20]=p,t[21]=S);let C;t[22]!==n||t[23]!==i?(C=e=>{i(),yc(et(n,e))},t[22]=n,t[23]=i,t[24]=C):C=t[24];let w;t[25]!==n||t[26]!==u||t[27]!==S||t[28]!==C?(w=(0,Z.jsx)(si,{folderPath:n,existingNames:S,open:u,onOpenChange:d,onCreated:C}),t[25]=n,t[26]=u,t[27]=S,t[28]=C,t[29]=w):w=t[29];let T=c!==null,E;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(E=e=>{e||l(null)},t[30]=E):E=t[30];let D=c??void 0,O;t[31]!==a||t[32]!==n||t[33]!==T||t[34]!==D?(O=(0,Z.jsx)(h_,{open:T,onOpenChange:E,kind:`file`,initialDir:n,initialTemplate:D,folderConfig:a}),t[31]=a,t[32]=n,t[33]=T,t[34]=D,t[35]=O):O=t[35];let k;return t[36]!==w||t[37]!==O||t[38]!==y||t[39]!==x?(k=(0,Z.jsxs)(Z.Fragment,{children:[y,x,w,O]}),t[36]=w,t[37]=O,t[38]=y,t[39]=x,t[40]=k):k=t[40],k}function WC(e){return e.name}function GC(e){let t=(0,$.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=$t(`relative w-full overflow-x-auto subtle-scrollbar`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=$t(`w-full caption-bottom text-sm`,n),t[6]=n,t[7]=o);let s;t[8]!==i||t[9]!==o?(s=(0,Z.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,Z.jsx)(`div`,{"data-slot":`table-container`,className:a,children:s}),t[11]=a,t[12]=s,t[13]=c):c=t[13],c}function KC(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=$t(`[&_tr]:border-b`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`thead`,{"data-slot":`table-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function qC(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=$t(`[&_tr:last-child]:border-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`tbody`,{"data-slot":`table-body`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function JC(e){let t=(0,$.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=$t(`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,Z.jsx)(`tr`,{"data-slot":`table-row`,className:o,...r}),t[7]=r,t[8]=o,t[9]=s):s=t[9],s}function YC(e){let t=(0,$.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=$t(`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,Z.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 XC(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=$t(`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,Z.jsx)(`td`,{"data-slot":`table-cell`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function ZC(e){if(!e)return`—`;let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/6e4);if(r<1)return yl._({id:`xOTzt5`});if(r<60)return yl._({id:`NRSLBe`,values:{diffMin:r}});let i=Math.floor(r/60);if(i<24)return yl._({id:`hDKtoF`,values:{diffHrs:i}});let a=Math.floor(i/24);return a<30?yl._({id:`QDZbvN`,values:{diffDays:a}}):t.toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`numeric`})}function QC(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 $C(e){let t=(0,$.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,Z.jsx)(Un,{className:`ml-1 size-3`}):(0,Z.jsx)(tr,{className:`ml-1 size-3`}):(0,Z.jsx)(jm,{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,Z.jsxs)(Y,{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 ew(e){let t=(0,$.c)(96),{folderPath:n}=e,{_:r}=vt(),{folderPaths:i,loading:a,pages:o,pageTitles:s,pageMeta:c}=Ns(),l=Gr(n),{state:u,refresh:d}=l,[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(`name`),[g,_]=(0,Q.useState)(`asc`);if(a){let e;t[0]===r?e=t[1]:(e=r({id:`X9VpsP`}),t[0]=r,t[1]=e);let n;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(Cd,{className:`size-5 rounded`}),(0,Z.jsx)(Cd,{className:`h-7 w-48`})]}),(0,Z.jsx)(Cd,{className:`h-9 w-20 rounded-md`})]}),t[2]=n):n=t[2];let i;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(Cd,{className:`h-4 w-16`}),t[3]=i):i=t[3];let a;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsxs)(`div`,{className:`mx-auto flex w-full max-w-4xl flex-col gap-6 px-6 py-8`,children:[n,(0,Z.jsxs)(`div`,{className:`rounded-lg border`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-4 border-b px-4 py-3`,children:[i,(0,Z.jsx)(`div`,{className:`ml-auto`,children:(0,Z.jsx)(Cd,{className:`h-4 w-20`})})]}),[`a`,`b`,`c`,`d`].map(rw)]})]}),t[4]=a):a=t[4];let o;return t[5]===e?o=t[6]:(o=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-start overflow-y-auto subtle-scrollbar`,role:`status`,"aria-busy":`true`,"aria-label":e,children:a}),t[5]=e,t[6]=o),o}let v,y,b,x,S,C,w,T,E,D,O;if(t[7]!==r||t[8]!==u||t[9]!==l||t[10]!==n||t[11]!==i||t[12]!==c||t[13]!==s||t[14]!==o||t[15]!==d||t[16]!==g||t[17]!==m){let e=HC(n,{pages:o,pageTitles:s,pageMeta:c,folderPaths:i}),a=QC(e.children,m,g),f=e.title||(n===``?r({id:`3aeN7X`}):e.title),k;t[29]===m?k=t[30]:(k=function(e){e===m?_(nw):(h(e),_(`asc`))},t[29]=m,t[30]=k);let A=k;O=`flex min-h-0 flex-1 items-start overflow-y-auto subtle-scrollbar`,C=`mx-auto flex w-full max-w-4xl flex-col gap-6 px-6 py-8`;let j;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Z.jsx)(gc,{className:`size-5 text-muted-foreground`}),t[31]=j):j=t[31];let M=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[j,(0,Z.jsx)(`h1`,{className:`text-2xl font-light tracking-tight`,children:f})]}),N;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsxs)(Y,{onClick:()=>p(!0),children:[(0,Z.jsx)(Kt,{className:`size-4`}),(0,Z.jsx)(J,{id:`isRobC`})]}),t[32]=N):N=t[32],t[33]===M?w=t[34]:(w=(0,Z.jsx)(`div`,{className:`flex flex-col gap-6`,children:(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[M,N]})}),t[33]=M,t[34]=w),t[35]!==u||t[36]!==n||t[37]!==d?(T=(0,Z.jsx)(AC,{folderPath:n,state:u,onChange:d}),t[35]=u,t[36]=n,t[37]=d,t[38]=T):T=t[38],t[39]!==u||t[40]!==l||t[41]!==n||t[42]!==d?(E=(0,Z.jsx)(UC,{folderPath:n,state:u,onChange:d,folderConfigHandle:l}),t[39]=u,t[40]=l,t[41]=n,t[42]=d,t[43]=E):E=t[43],t[44]===n?D=t[45]:(D=(0,Z.jsx)(LC,{folderPath:n}),t[44]=n,t[45]=D),S=`rounded-lg border`,y=GC;let P=m===`name`?g===`asc`?`ascending`:`descending`:`none`,F;t[46]===r?F=t[47]:(F=r({id:`6YtxFj`}),t[46]=r,t[47]=F);let I;t[48]!==A||t[49]!==g||t[50]!==m||t[51]!==F?(I=(0,Z.jsx)($C,{label:F,sortKey:`name`,activeKey:m,activeDir:g,onSort:A}),t[48]=A,t[49]=g,t[50]=m,t[51]=F,t[52]=I):I=t[52];let L;t[53]!==P||t[54]!==I?(L=(0,Z.jsx)(YC,{"aria-sort":P,children:I}),t[53]=P,t[54]=I,t[55]=L):L=t[55];let R=m===`modified`?g===`asc`?`ascending`:`descending`:`none`,z;t[56]===r?z=t[57]:(z=r({id:`tgWuMB`}),t[56]=r,t[57]=z);let B;t[58]!==A||t[59]!==g||t[60]!==m||t[61]!==z?(B=(0,Z.jsx)($C,{label:z,sortKey:`modified`,activeKey:m,activeDir:g,onSort:A}),t[58]=A,t[59]=g,t[60]=m,t[61]=z,t[62]=B):B=t[62];let V;t[63]!==R||t[64]!==B?(V=(0,Z.jsx)(YC,{className:`w-32`,"aria-sort":R,children:B}),t[63]=R,t[64]=B,t[65]=V):V=t[65],t[66]!==L||t[67]!==V?(x=(0,Z.jsx)(KC,{children:(0,Z.jsxs)(JC,{children:[L,V]})}),t[66]=L,t[67]=V,t[68]=x):x=t[68],v=qC,b=a.length?a.map(tw):(0,Z.jsx)(JC,{children:(0,Z.jsx)(XC,{colSpan:2,className:`h-24 text-center text-muted-foreground`,children:(0,Z.jsx)(J,{id:`Pkw7J9`})})}),t[7]=r,t[8]=u,t[9]=l,t[10]=n,t[11]=i,t[12]=c,t[13]=s,t[14]=o,t[15]=d,t[16]=g,t[17]=m,t[18]=v,t[19]=y,t[20]=b,t[21]=x,t[22]=S,t[23]=C,t[24]=w,t[25]=T,t[26]=E,t[27]=D,t[28]=O}else v=t[18],y=t[19],b=t[20],x=t[21],S=t[22],C=t[23],w=t[24],T=t[25],E=t[26],D=t[27],O=t[28];let k;t[69]!==v||t[70]!==b?(k=(0,Z.jsx)(v,{children:b}),t[69]=v,t[70]=b,t[71]=k):k=t[71];let A;t[72]!==y||t[73]!==k||t[74]!==x?(A=(0,Z.jsxs)(y,{children:[x,k]}),t[72]=y,t[73]=k,t[74]=x,t[75]=A):A=t[75];let j;t[76]!==A||t[77]!==S?(j=(0,Z.jsx)(`div`,{className:S,children:A}),t[76]=A,t[77]=S,t[78]=j):j=t[78];let M;t[79]!==j||t[80]!==C||t[81]!==w||t[82]!==T||t[83]!==E||t[84]!==D?(M=(0,Z.jsxs)(`div`,{className:C,children:[w,T,E,D,j]}),t[79]=j,t[80]=C,t[81]=w,t[82]=T,t[83]=E,t[84]=D,t[85]=M):M=t[85];let N;t[86]!==M||t[87]!==O?(N=(0,Z.jsx)(`div`,{className:O,children:M}),t[86]=M,t[87]=O,t[88]=N):N=t[88];let P;t[89]!==f||t[90]!==l||t[91]!==n?(P=(0,Z.jsx)(h_,{open:f,onOpenChange:p,kind:`file`,initialDir:n,folderConfig:l,suggestedName:`index`}),t[89]=f,t[90]=l,t[91]=n,t[92]=P):P=t[92];let F;return t[93]!==N||t[94]!==P?(F=(0,Z.jsxs)(Z.Fragment,{children:[N,P]}),t[93]=N,t[94]=P,t[95]=F):F=t[95],F}function tw(e){return(0,Z.jsxs)(JC,{children:[(0,Z.jsx)(XC,{children:(0,Z.jsxs)(`a`,{href:lu(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,Z.jsx)(eh,{className:`size-4 shrink-0 text-muted-foreground`}):(0,Z.jsx)(Ge,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.title})]})}),(0,Z.jsx)(XC,{className:`text-muted-foreground`,children:e.kind===`file`?ZC(e.modified):`—`})]},e.path)}function nw(e){return e===`asc`?`desc`:`asc`}function rw(e){return(0,Z.jsxs)(`div`,{className:`flex items-center gap-3 border-b px-4 py-3 last:border-b-0`,children:[(0,Z.jsx)(Cd,{className:`size-4 rounded`}),(0,Z.jsx)(Cd,{className:`h-4 w-40`}),(0,Z.jsx)(`div`,{className:`ml-auto`,children:(0,Z.jsx)(Cd,{className:`h-4 w-16`})})]},e)}function iw(e){let t=(0,$.c)(24),{docName:n,size:r,limit:i,backNav:a}=e,o=a!==void 0,s=(0,Q.useRef)(null),c=(0,Q.useRef)(null),l,u;t[0]===o?(l=t[1],u=t[2]):(l=()=>{o?s.current?.focus():c.current?.focus()},u=[o],t[0]=o,t[1]=l,t[2]=u),(0,Q.useEffect)(l,u);let d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(`div`,{className:`flex size-16 items-center justify-center rounded-full border bg-muted/40 text-muted-foreground`,children:(0,Z.jsx)(Jm,{className:`size-9`,"aria-hidden":`true`})}),t[3]=d):d=t[3];let f=o?void 0:-1,p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(J,{id:`P3hnm0`}),t[4]=p):p=t[4];let m;t[5]===f?m=t[6]:(m=(0,Z.jsx)(`h2`,{ref:c,id:`large-file-title`,tabIndex:f,className:`text-2xl font-light text-balance outline-none`,children:p}),t[5]=f,t[6]=m);let h;t[7]===r?h=t[8]:(h=Ra(r),t[7]=r,t[8]=h);let g;t[9]===i?g=t[10]:(g=Ra(i),t[9]=i,t[10]=g);let _;t[11]!==n||t[12]!==h||t[13]!==g?(_=(0,Z.jsx)(`p`,{className:`max-w-md text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`GJH-AT`,values:{0:h,1:g,docName:n}})}),t[11]=n,t[12]=h,t[13]=g,t[14]=_):_=t[14];let v;t[15]!==m||t[16]!==_?(v=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[m,_]}),t[15]=m,t[16]=_,t[17]=v):v=t[17];let y;t[18]!==a||t[19]!==o?(y=o?(0,Z.jsxs)(Y,{ref:s,variant:`default`,onClick:()=>a.onNavigateBack(a.previousDocName),children:[(0,Z.jsx)($n,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`CKyk7Q`})]}):null,t[18]=a,t[19]=o,t[20]=y):y=t[20];let b;return t[21]!==v||t[22]!==y?(b=(0,Z.jsxs)(`div`,{role:`status`,"aria-labelledby":`large-file-title`,"data-slot":`large-file-editor-state`,className:`flex h-full flex-col items-center justify-center gap-8 p-8 text-center`,children:[d,v,y]}),t[21]=v,t[22]=y,t[23]=b):b=t[23],b}var aw={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`},ow=e=>{let t=(0,$.c)(15),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({color:a,size:o,strokeWidth:s,absoluteStrokeWidth:n,className:c,children:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=a===void 0?`currentColor`:a,u=o===void 0?24:o,d=s===void 0?2:s,f=c===void 0?``:c,p=n?Number(d)*24/Number(u):d,m;return t[8]!==r||t[9]!==f||t[10]!==l||t[11]!==i||t[12]!==u||t[13]!==p?(m=(0,Z.jsx)(`svg`,{"aria-hidden":`true`,...aw,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},sw=e=>{let t=(0,$.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`Markdown`}),r=(0,Z.jsx)(`path`,{d:`M232,48H24A16,16,0,0,0,8,64V192a16,16,0,0,0,16,16H232a16,16,0,0,0,16-16V64A16,16,0,0,0,232,48Zm0,144H24V64H232V192ZM128,104v48a8,8,0,0,1-16,0V123.31L93.66,141.66a8,8,0,0,1-11.32,0L64,123.31V152a8,8,0,0,1-16,0V104a8,8,0,0,1,13.66-5.66L88,124.69l26.34-26.35A8,8,0,0,1,128,104Zm77.66,18.34a8,8,0,0,1,0,11.32l-24,24a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L168,132.69V104a8,8,0,0,1,16,0v28.69l10.34-10.35A8,8,0,0,1,205.66,122.34Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,Z.jsxs)(ow,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i},cw=e=>{let t=(0,$.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`Textbox`}),r=(0,Z.jsx)(`path`,{d:`M112,40a8,8,0,0,0-8,8V64H24A16,16,0,0,0,8,80v96a16,16,0,0,0,16,16h80v16a8,8,0,0,0,16,0V48A8,8,0,0,0,112,40ZM24,176V80h80v96ZM248,80v96a16,16,0,0,1-16,16H144a8,8,0,0,1,0-16h88V80H144a8,8,0,0,1,0-16h88A16,16,0,0,1,248,80ZM88,112a8,8,0,0,1-8,8H72v24a8,8,0,0,1-16,0V120H48a8,8,0,0,1,0-16H80A8,8,0,0,1,88,112Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,Z.jsxs)(ow,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i};function lw(e){let t=(0,$.c)(48),{isSourceMode:n,onModeChange:r,sourceDisabled:i,wysiwygDisabled:a,wysiwygLabel:o,sourceLabel:s,wysiwygDisabledReason:c}=e,l=i===void 0?!1:i,u=a===void 0?!1:a,{_:d}=vt(),f;t[0]!==d||t[1]!==o?(f=o??d({id:`ur2XSb`}),t[0]=d,t[1]=o,t[2]=f):f=t[2];let p=f,m;t[3]!==d||t[4]!==s?(m=s??d({id:`xbdtfY`}),t[3]=d,t[4]=s,t[5]=m):m=t[5];let h=m,g=(0,Q.useId)(),_=u&&c?c:null,v=n?`source`:`wysiwyg`,y;t[6]===r?y=t[7]:(y=e=>{e&&r(e)},t[6]=r,t[7]=y);let b;t[8]===d?b=t[9]:(b=d({id:`n7aopT`}),t[8]=d,t[9]=b);let x=_?g:void 0,S;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(cw,{className:`size-4`}),t[10]=S):S=t[10];let C;t[11]!==x||t[12]!==u||t[13]!==p?(C=(0,Z.jsx)(Mi,{value:`wysiwyg`,"aria-label":p,"aria-describedby":x,disabled:u,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,children:S}),t[11]=x,t[12]=u,t[13]=p,t[14]=C):C=t[14];let w;t[15]!==_||t[16]!==g?(w=_?(0,Z.jsx)(`span`,{id:g,className:`sr-only`,children:_}):null,t[15]=_,t[16]=g,t[17]=w):w=t[17];let T;t[18]!==C||t[19]!==w?(T=(0,Z.jsx)(ln,{asChild:!0,children:(0,Z.jsxs)(`div`,{children:[C,w]})}),t[18]=C,t[19]=w,t[20]=T):T=t[20];let E;t[21]!==u||t[22]!==c||t[23]!==o?(E=u&&c?c:o||(0,Z.jsx)(J,{id:`Mb_20S`}),t[21]=u,t[22]=c,t[23]=o,t[24]=E):E=t[24];let D;t[25]===E?D=t[26]:(D=(0,Z.jsx)(un,{side:`bottom`,children:E}),t[25]=E,t[26]=D);let O;t[27]!==T||t[28]!==D?(O=(0,Z.jsxs)(fn,{children:[T,D]}),t[27]=T,t[28]=D,t[29]=O):O=t[29];let k;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Z.jsx)(sw,{className:`size-4`}),t[30]=k):k=t[30];let A;t[31]!==l||t[32]!==h?(A=(0,Z.jsx)(ln,{asChild:!0,children:(0,Z.jsx)(`div`,{children:(0,Z.jsx)(Mi,{value:`source`,"aria-label":h,disabled:l,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,children:k})})}),t[31]=l,t[32]=h,t[33]=A):A=t[33];let j;t[34]!==l||t[35]!==s?(j=l?(0,Z.jsx)(J,{id:`G-JBA1`}):s||(0,Z.jsx)(J,{id:`u6Hp4N`}),t[34]=l,t[35]=s,t[36]=j):j=t[36];let M;t[37]===j?M=t[38]:(M=(0,Z.jsx)(un,{side:`bottom`,children:j}),t[37]=j,t[38]=M);let N;t[39]!==A||t[40]!==M?(N=(0,Z.jsxs)(fn,{children:[A,M]}),t[39]=A,t[40]=M,t[41]=N):N=t[41];let P;return t[42]!==O||t[43]!==N||t[44]!==v||t[45]!==y||t[46]!==b?(P=(0,Z.jsxs)(Pi,{type:`single`,value:v,onValueChange:y,"aria-label":b,variant:`segmented`,size:`sm`,spacing:1,className:`shrink-0 bg-muted p-0.5 data-[size=sm]:rounded-[10px]`,children:[O,N]}),t[42]=O,t[43]=N,t[44]=v,t[45]=y,t[46]=b,t[47]=P):P=t[47],P}var uw=`ok-lint-config-view-mode-v1`,dw=[`source`,`rules`],fw=`source`;function pw(e){return dw.includes(e)}function mw(e=localStorage){try{let t=e.getItem(uw);if(t===null)return fw;if(pw(t))return t;console.warn(`[lint-config-view-mode] invalid persisted value, falling back to default`,{raw:t})}catch{}return fw}function hw(e,t=localStorage){try{return t.setItem(uw,e),!0}catch(e){return console.warn(`[lint-config-view-mode] persist failed`,e),!1}}function gw(){let e=(0,$.c)(3),[t,n]=(0,Q.useState)(mw),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=function(e){n(e),hw(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}function _w(e){return`/api/asset-text?path=${encodeURIComponent(e)}`}function vw(e){let t=(0,$.c)(30),{assetPath:n}=e,{_:r}=vt(),[i,a]=gw(),{data:o}=Dd(),s=(o?.configFile??null)===n,c=!s||i===`source`,l;t[0]===n?l=t[1]:(l=n.split(`/`).pop()??n,t[0]=n,t[1]=l);let u=l,d;t[2]===u?d=t[3]:(d=u.includes(`.`)?(u.split(`.`).pop()??``).toLowerCase():``,t[2]=u,t[3]=d);let f=d,p;t[4]===n?p=t[5]:(p=(0,Z.jsx)(gS,{entry:{kind:`asset`,path:n},className:`shrink-0 border-b bg-background px-3 py-1.5`}),t[4]=n,t[5]=p);let m;t[6]===a?m=t[7]:(m=e=>a(e===`source`?`source`:`rules`),t[6]=a,t[7]=m);let h=!s,g;t[8]===r?g=t[9]:(g=r({id:`4EZrJN`}),t[8]=r,t[9]=g);let _;t[10]===r?_=t[11]:(_=r({id:`wdxz7K`}),t[10]=r,t[11]=_);let v;t[12]===r?v=t[13]:(v=r({id:`EeUucb`}),t[12]=r,t[13]=v);let y;t[14]!==c||t[15]!==m||t[16]!==h||t[17]!==g||t[18]!==_||t[19]!==v?(y=(0,Z.jsx)(`div`,{className:`flex shrink-0 items-center justify-center border-b bg-background py-2`,children:(0,Z.jsx)(lw,{isSourceMode:c,onModeChange:m,wysiwygDisabled:h,wysiwygLabel:g,sourceLabel:_,wysiwygDisabledReason:v})}),t[14]=c,t[15]=m,t[16]=h,t[17]=g,t[18]=_,t[19]=v,t[20]=y):y=t[20];let b;t[21]!==n||t[22]!==f||t[23]!==u||t[24]!==c?(b=c?(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,Z.jsx)(mS,{src:_w(n),fileName:u,extension:f},n)}):(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-4 sm:px-6`,children:(0,Z.jsx)(`div`,{className:`mx-auto w-full max-w-3xl`,children:(0,Z.jsx)(Xr,{hideConfigSourceNote:!0})})}),t[21]=n,t[22]=f,t[23]=u,t[24]=c,t[25]=b):b=t[25];let x;return t[26]!==b||t[27]!==p||t[28]!==y?(x=(0,Z.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-background`,"data-lint-config-editor":``,children:[p,y,b]}),t[26]=b,t[27]=p,t[28]=y,t[29]=x):x=t[29],x}function yw(e){let t=(0,$.c)(8),{docName:n}=e,[r,i]=(0,Q.useState)(bw),a,o;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>mt(e=>{i(t=>{if(t.has(e))return t;let n=new Set(t);return n.add(e),n})}),o=[],t[0]=a,t[1]=o):(a=t[0],o=t[1]),(0,Q.useEffect)(a,o),!r.has(n))return null;let s;t[2]===n?s=t[3]:(s=function(){Se(n)?.abort(),i(e=>{if(!e.has(n))return e;let t=new Set(e);return t.delete(n),t})},t[2]=n,t[3]=s);let c=s,l;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`A67Uwj`})}),t[4]=l):l=t[4];let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(J,{id:`dEgA5A`}),t[5]=u):u=t[5];let d;return t[6]===c?d=t[7]:(d=(0,Z.jsxs)(`div`,{className:`absolute inset-x-0 bottom-8 z-20 flex justify-center text-xs text-muted-foreground`,children:[l,(0,Z.jsx)(Y,{variant:`link`,size:`sm`,className:`h-auto px-2 py-0 text-xs`,onClick:c,children:u})]}),t[6]=c,t[7]=d),d}function bw(){return new Set}function xw(e){let t=(0,$.c)(20),{nav:n}=e,{state:r,refetch:i}=Zo(n),a=(0,Q.useRef)(null),o=n.branch,s,c;t[0]===r.phase?(s=t[1],c=t[2]):(s=()=>{r.phase===`resolved`&&a.current?.querySelector(`button`)?.focus()},c=[r.phase],t[0]=r.phase,t[1]=s,t[2]=c),(0,Q.useEffect)(s,c);let l;t[3]===n.path?l=t[4]:(l=function(){window.location.hash=tu($o(n.path))},t[3]=n.path,t[4]=l);let u=l,d;t[5]!==o||t[6]!==n.kind?(d=function(e){es.arm({kind:n.kind,path:e,branch:o}),window.location.hash=n.kind===`folder`?tu(e):lu(e)},t[5]=o,t[6]=n.kind,t[7]=d):d=t[7];let f=d,p=r.phase===`pending`?`polite`:void 0,m=r.phase===`resolved`?r.resolution.verdict:void 0,h=r.phase===`pending`?`flex h-full flex-col items-center justify-center gap-3 p-8 text-center text-sm text-muted-foreground`:`flex h-full flex-col items-center justify-center gap-6 p-8 text-center`,g;t[8]!==u||t[9]!==n||t[10]!==f||t[11]!==i||t[12]!==r?(g=(0,Z.jsx)(ns,{nav:n,state:r,onBrowseFolder:u,onOpenRenamed:f,onEnableAutoSync:u,onSyncCompleted:i}),t[8]=u,t[9]=n,t[10]=f,t[11]=i,t[12]=r,t[13]=g):g=t[13];let _;return t[14]!==r.phase||t[15]!==p||t[16]!==m||t[17]!==h||t[18]!==g?(_=(0,Z.jsx)(`div`,{ref:a,role:`status`,"aria-live":p,"data-testid":`share-receive-miss-panel`,"data-phase":r.phase,"data-verdict":m,className:h,children:g}),t[14]=r.phase,t[15]=p,t[16]=m,t[17]=h,t[18]=g,t[19]=_):_=t[19],_}var Sw=e(Vt(),1);function Cw(e){let t=(0,$.c)(9),{text:n}=e,r;t[0]===n?r=t[1]:(r=ua(n),t[0]=n,t[1]=r);let{map:i}=r,a,o;if(t[2]!==i||t[3]!==n){o=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Yo(n),r=e.length>0?e:Object.keys(i);if(r.length===0){o=null;break bb0}let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(J,{id:`l_UFPv`}),t[6]=s):s=t[6];let c;t[7]===i?c=t[8]:(c=(e,t)=>{let n=i[e];return n===void 0?null:(0,Z.jsx)(ww,{keyName:e,value:n},`${e}-${t}`)},t[7]=i,t[8]=c),a=(0,Z.jsx)(Cs,{title:s,count:r.length,testId:`readonly-property-panel`,className:`pt-4`,children:r.map(c)})}t[2]=i,t[3]=n,t[4]=a,t[5]=o}else a=t[4],o=t[5];return o===Symbol.for(`react.early_return_sentinel`)?a:o}function ww(e){let t=(0,$.c)(12),{keyName:n,value:r}=e,i=hs[co(r)],a;t[0]===i?a=t[1]:(a=(0,Z.jsx)(`span`,{"aria-hidden":!0,className:`flex size-7 shrink-0 items-center justify-center rounded text-muted-foreground`,children:(0,Z.jsx)(i,{className:`size-3.5`})}),t[0]=i,t[1]=a);let o;t[2]===n?o=t[3]:(o=(0,Z.jsx)(`span`,{className:`flex h-7 w-32 shrink-0 items-center truncate px-2 text-sm text-muted-foreground`,children:n}),t[2]=n,t[3]=o);let s;t[4]!==n||t[5]!==r?(s=(0,Z.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,Z.jsx)(Tw,{keyName:n,value:r})}),t[4]=n,t[5]=r,t[6]=s):s=t[6];let c;return t[7]!==n||t[8]!==a||t[9]!==o||t[10]!==s?(c=(0,Z.jsxs)(`div`,{className:`group flex items-start gap-1 py-0.5`,"data-testid":`readonly-property-row`,"data-key":n,children:[a,o,s]}),t[7]=n,t[8]=a,t[9]=o,t[10]=s,t[11]=c):c=t[11],c}function Tw(e){let t=(0,$.c)(8),{keyName:n,value:r}=e;if(Ss(r)){let e;return t[0]!==n||t[1]!==r?(e=(0,Z.jsx)(vs,{keyName:n,value:r}),t[0]=n,t[1]=r,t[2]=e):e=t[2],e}let i;t[3]===r?i=t[4]:(i=Array.isArray(r)?r.filter(Ew).join(`, `):String(r),t[3]=r,t[4]=i);let a=i,o;return t[5]!==a||t[6]!==n?(o=(0,Z.jsx)(`div`,{className:`flex min-h-7 items-center px-2 py-1 text-sm break-words`,"data-testid":`readonly-property-value`,"data-key":n,children:a}),t[5]=a,t[6]=n,t[7]=o):o=t[7],o}function Ew(e){return typeof e==`string`}function Dw(e){let t=(0,$.c)(29),{fileName:n,text:r}=e,i,a,o,s;if(t[0]!==r){let e=ro(r).body;s=Zn,i=We,a=!1,o=On().parseWithFallback(e),t[0]=r,t[1]=i,t[2]=a,t[3]=o,t[4]=s}else i=t[1],a=t[2],o=t[3],s=t[4];let c;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(c={attributes:{class:`pt-4`}},t[5]=c):c=t[5];let l;t[6]!==i||t[7]!==a||t[8]!==o?(l={extensions:i,editable:a,content:o,editorProps:c},t[6]=i,t[7]=a,t[8]=o,t[9]=l):l=t[9];let u;t[10]===r?u=t[11]:(u=[r],t[10]=r,t[11]=u);let d=s(l,u),[f]=(0,Q.useState)(Ow),p=(0,Q.useRef)(null),m,h;t[12]===f?(m=t[13],h=t[14]):(m=()=>{let e=p.current;if(e)return e.appendChild(f),()=>{f.parentNode===e&&e.removeChild(f)}},h=[f],t[12]=f,t[13]=m,t[14]=h),(0,Q.useLayoutEffect)(m,h);let g;t[15]===r?g=t[16]:(g=(0,Z.jsx)(Cw,{text:r}),t[15]=r,t[16]=g);let _;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(`div`,{className:`tiptap-editor`,children:(0,Z.jsx)(`div`,{ref:p,style:{display:`contents`}})}),t[17]=_):_=t[17];let v;t[18]===g?v=t[19]:(v=(0,Z.jsxs)(`div`,{className:`editor-doc-scroll min-h-0 flex-1 overflow-auto`,children:[g,_]}),t[18]=g,t[19]=v);let y;t[20]===d?y=t[21]:(y=(0,Z.jsx)(Vn,{editor:d,className:`tiptap-editor-portal-content h-full`}),t[20]=d,t[21]=y);let b;t[22]!==f||t[23]!==y?(b=(0,Sw.createPortal)(y,f),t[22]=f,t[23]=y,t[24]=b):b=t[24];let x;return t[25]!==n||t[26]!==v||t[27]!==b?(x=(0,Z.jsxs)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":n,"data-skill-markdown-viewer":``,"data-skill-markdown-viewer-state":`loaded`,children:[v,b]}),t[25]=n,t[26]=v,t[27]=b,t[28]=x):x=t[28],x}function Ow(){let e=document.createElement(`div`);return e.style.display=`contents`,e}var kw=`data-skill-markdown`;function Aw(e){let t=(0,$.c)(12),{scope:n,name:r,path:i,fileName:a}=e,o;t[0]!==r||t[1]!==i||t[2]!==n?(o={loadText:e=>Wd({scope:n,name:r,path:i},e)},t[0]=r,t[1]=i,t[2]=n,t[3]=o):o=t[3];let s=lS(o);if(s.status===`loading`){let e;return t[4]===a?e=t[5]:(e=(0,Z.jsx)(uS,{fileName:a,dataAttr:kw}),t[4]=a,t[5]=e),e}if(s.status===`error`){let e;return t[6]!==s.message||t[7]!==a?(e=(0,Z.jsx)(dS,{fileName:a,dataAttr:kw,message:s.message}),t[6]=s.message,t[7]=a,t[8]=e):e=t[8],e}let c;return t[9]!==s.content||t[10]!==a?(c=(0,Z.jsx)(Dw,{fileName:a,text:s.content}),t[9]=s.content,t[10]=a,t[11]=c):c=t[11],c}var jw=new Set([`md`,`mdx`]);function Mw(e){let t=(0,$.c)(19),{scope:n,name:r,path:i}=e,a;t[0]===i?a=t[1]:(a=i.split(`/`).pop()??i,t[0]=i,t[1]=a);let o=a,s=o.lastIndexOf(`.`),c,l;if(t[2]!==s||t[3]!==o?(c=s>=0?o.slice(s+1).toLowerCase():``,l=jw.has(c),t[2]=s,t[3]=o,t[4]=c,t[5]=l):(c=t[4],l=t[5]),l){let e;return t[6]!==o||t[7]!==r||t[8]!==i||t[9]!==n?(e=(0,Z.jsx)(Aw,{scope:n,name:r,path:i,fileName:o}),t[6]=o,t[7]=r,t[8]=i,t[9]=n,t[10]=e):e=t[10],e}let u;t[11]!==r||t[12]!==i||t[13]!==n?(u=e=>Wd({scope:n,name:r,path:i},e),t[11]=r,t[12]=i,t[13]=n,t[14]=u):u=t[14];let d;return t[15]!==c||t[16]!==o||t[17]!==u?(d=(0,Z.jsx)(mS,{fileName:o,extension:c,loadText:u}),t[15]=c,t[16]=o,t[17]=u,t[18]=d):d=t[18],d}function Nw(e){let t=null,n=()=>(t===null&&(t=e(),t.catch(()=>{})),t),r=(0,Q.lazy)(n);return r.preload=n,r}var Pw=Nw(()=>n(()=>import(`./SettingsDialogBody-0nrbk-EZ.js`).then(e=>({default:e.SettingsDialogBody})),__vite__mapDeps([103,1,104,19,12,6,2,3,7,8,9,73,58,22,11,74,75,76,10,79,62,63,64,65,66,67,68,69,70,71,72,15,38,17,18,25,77,78,31,52,53,35,55,14,16,4,80,40,23,24,26,81,28,20,82,21,83,84,27,29,51,54,56,57,85,86,87,30,88,89,90,91,32,33,92,93,13,105,106,41,107,108,109,110,50,111,112,96,113,114,97,115,36,116,117,118,119,120,34,121,39,42,122,123,124,125]),import.meta.url));function Fw(e){let t=(0,$.c)(9),{error:n}=e,{_:r}=vt(),i;t[0]!==r||t[1]!==n?(i=n instanceof Error&&/dynamically imported module|Failed to fetch/i.test(n.message)?r({id:`Y8ViJx`}):r({id:`3h5zMp`}),t[0]=r,t[1]=n,t[2]=i):i=t[2];let a=i,o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(`h3`,{id:`settings-body-error-title`,className:`font-heading text-base leading-none font-medium`,children:(0,Z.jsx)(J,{id:`hwFOFD`})}),t[3]=o):o=t[3];let s;t[4]===a?s=t[5]:(s=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[o,(0,Z.jsx)(`p`,{className:`max-w-xs text-sm text-muted-foreground`,children:a})]}),t[4]=a,t[5]=s);let c;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(Y,{variant:`default`,onClick:Iw,children:(0,Z.jsx)(J,{id:`HpK_8d`})}),t[6]=c):c=t[6];let l;return t[7]===s?l=t[8]:(l=(0,Z.jsxs)(`div`,{role:`alert`,"aria-labelledby":`settings-body-error-title`,"data-slot":`settings-body-error-boundary`,className:`flex h-full flex-col items-center justify-center gap-5 p-8 text-center`,children:[s,c]}),t[7]=s,t[8]=l),l}function Iw(){return window.location.reload()}function Lw(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(Zt,{fallbackRender:zw,onError:Rw,children:n}),t[0]=n,t[1]=r),r}function Rw(e,t){console.error(`[SettingsDialogErrorBoundary] rendered fallback for Settings body`,e,t.componentStack)}function zw(e){return(0,Z.jsx)(Fw,{...e})}function Bw(e=typeof window>`u`?void 0:window.location){return e?.protocol===`file:`}function Vw(e){let{groups:t,translate:n}=e,r=[],i=new Set;for(let e of t)if(e.enabled)for(let t of e.items)i.add(t.id),r.push({id:`section:${t.id}`,kind:`section`,sectionId:t.id,label:t.label,keywords:[e.label]});for(let e of ni)if(i.has(e.sectionId))for(let t of e.fields){let i=t.path.join(`.`);r.push({id:`field:${e.sectionId}:${i}`,kind:`field`,sectionId:e.sectionId,label:n(t.label),keywords:t.description?[n(t.description)]:[],targetField:i})}if(i.has(`plugin:markdownlint`))for(let e of ko)r.push({id:`rule:${e.id}`,kind:`rule`,sectionId:`plugin:markdownlint`,label:e.name,keywords:[e.id,e.alias,...e.aliases],ruleId:e.id});return r}function Hw(e){return`https://github.com/inkeep/open-knowledge/releases/tag/v${encodeURIComponent(e)}`}function Uw(e){let t=(0,$.c)(43),{open:n,initialSection:r,onOpenChange:i}=e,a=r===void 0?null:r,{_:o}=vt(),{collabUrl:s}=Re(),{userBinding:c,userSynced:l,okignoreBinding:u,okignoreSynced:d,projectConfig:f,merged:p}=Hu(),{desktopPresent:m}=ai(),[h,g]=(0,Q.useState)(a??`preferences`),[_,v]=(0,Q.useState)(``),[y,b]=(0,Q.useState)(null),[x,S]=(0,Q.useState)(null),C=(0,Q.useRef)(0),w=(0,Q.useRef)(null),T,E;t[0]!==a||t[1]!==n?(T=()=>{n&&(g(a??`preferences`),v(``))},E=[n,a],t[0]=a,t[1]=n,t[2]=T,t[3]=E):(T=t[2],E=t[3]),(0,Q.useEffect)(T,E);let D,O;t[4]===y?(D=t[5],O=t[6]):(D=()=>{if(!y)return;let e=w.current;if(!e)return;let t=null,n=null,r=null,i=null,a=()=>{let r=e.querySelector(`[data-field="${y.path}"]`);return r?(r.scrollIntoView({block:`center`}),r.classList.add(`animate-settings-nav-flash`),t=r,n=setTimeout(()=>r.classList.remove(`animate-settings-nav-flash`),750),!0):!1};return a()||(i=new MutationObserver(()=>{a()&&i?.disconnect()}),i.observe(e,{childList:!0,subtree:!0}),r=setTimeout(()=>i?.disconnect(),4e3)),()=>{i?.disconnect(),n&&clearTimeout(n),r&&clearTimeout(r),t?.classList.remove(`animate-settings-nav-flash`)}},O=[y],t[4]=y,t[5]=D,t[6]=O),(0,Q.useEffect)(D,O);let k=s!==null,A=typeof window<`u`&&window.okDesktop!=null,j=A&&window.okDesktop?.config.ptyAvailable===!0,M,N;if(t[7]!==o||t[8]!==m||t[9]!==k||t[10]!==p?.appearance?.colorThemeEnabled||t[11]!==f?.contentRules){let e;t[14]===f?.contentRules?e=t[15]:(e=e=>f?.contentRules?.[e.id]?.enabled===!0,t[14]=f?.contentRules,t[15]=e);let n=ri.filter(e).map(Ww),r=p?.appearance?.colorThemeEnabled!==!1,i=Bw();M=[{id:`user`,label:o({id:`7PzzBU`}),enabled:!0,items:[{id:`preferences`,label:o({id:`Q6hhn8`})},{id:`configure-agents`,label:o({id:`jRAGrQ`})},{id:`hotkeys`,label:o({id:`4KmEoC`})},{id:`account`,label:o({id:`AeXO77`})},{id:`user-plugins-manage`,label:o({id:`ohUJJM`})},...A?[{id:`ai-tools`,label:o({id:`_5qBNl`})}]:[]]},{id:`project`,label:o({id:`ZWyHmq`}),enabled:k,items:[{id:`sync`,label:o({id:`Nu4DdT`})},{id:`search`,label:o({id:`A1taO8`})},{id:`plugins-manage`,label:o({id:`ohUJJM`})},...i?[]:[{id:`link-previews`,label:o({id:`gh27t1`})}],...j?[{id:`terminal`,label:o({id:`ALhMYW`})}]:[],...A?[{id:`project-ai-tools`,label:o({id:`crqzW5`})}]:[],{id:`project-templates`,label:o({id:`iTylMl`})},{id:`skills`,label:o({id:`PCSkw2`})},{id:`okignore`,label:o({id:`3zyg_A`})},{id:`sharing`,label:o({id:`cs4mps`})}]},{id:`plugins`,label:o({id:`ohUJJM`}),enabled:!0,items:[...k?n:[],...r?[{id:`plugin:theme`,label:o({id:`fJ3EbT`})}]:[]]},{id:`integrations`,label:o({id:`nbfdhU`}),enabled:!0,items:[]}],N=Vw({groups:M,translate:o}),t[7]=o,t[8]=m,t[9]=k,t[10]=p?.appearance?.colorThemeEnabled,t[11]=f?.contentRules,t[12]=M,t[13]=N}else M=t[12],N=t[13];let P=N,F;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(F=function(e){C.current+=1;let t=C.current;g(e.sectionId),e.kind===`field`&&e.targetField?b({path:e.targetField}):e.kind===`rule`&&e.ruleId&&S({query:e.ruleId,nonce:t}),v(``)},t[16]=F):F=t[16];let I=F,L;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(_n,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`Tz0i8g`})}),t[17]=L):L=t[17];let R;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Z.jsx)(gn,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`RDrXh4`})}),t[18]=R):R=t[18];let z;t[19]!==h||t[20]!==M||t[21]!==P||t[22]!==_?(z=(0,Z.jsx)(Gw,{groups:M,activeId:h,onSelect:g,entries:P,searchQuery:_,onSearchChange:v,onNavigate:I}),t[19]=h,t[20]=M,t[21]=P,t[22]=_,t[23]=z):z=t[23];let B;t[24]===o?B=t[25]:(B=o({id:`OXb_Df`}),t[24]=o,t[25]=B);let V;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Z.jsx)($w,{}),t[26]=V):V=t[26];let H=l?c:null,U;t[27]!==h||t[28]!==u||t[29]!==d||t[30]!==x||t[31]!==H?(U=(0,Z.jsx)(Lw,{children:(0,Z.jsx)(Q.Suspense,{fallback:V,children:(0,Z.jsx)(Pw,{activeId:h,userBinding:H,okignoreBinding:u,okignoreSynced:d,markdownlintRuleQuery:x})})}),t[27]=h,t[28]=u,t[29]=d,t[30]=x,t[31]=H,t[32]=U):U=t[32];let W;t[33]!==B||t[34]!==U?(W=(0,Z.jsx)(`section`,{ref:w,"aria-label":B,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain subtle-scrollbar p-6`,tabIndex:0,children:U}),t[33]=B,t[34]=U,t[35]=W):W=t[35];let ee;t[36]!==z||t[37]!==W?(ee=(0,Z.jsxs)(vn,{className:`flex h-[700px] max-h-[calc(100dvh-4rem)] w-[900px] max-w-[calc(100%-2rem)] flex-col gap-0 overflow-hidden p-0 sm:grid sm:grid-cols-[220px_1fr] sm:max-w-[min(900px,calc(100%-2rem))]`,"data-testid":`settings-dialog`,children:[L,R,z,W]}),t[36]=z,t[37]=W,t[38]=ee):ee=t[38];let G;return t[39]!==i||t[40]!==n||t[41]!==ee?(G=(0,Z.jsx)(Sn,{open:n,onOpenChange:i,children:ee}),t[39]=i,t[40]=n,t[41]=ee,t[42]=G):G=t[42],G}function Ww(e){return{id:`plugin:${e.id}`,label:e.label}}function Gw(e){let t=(0,$.c)(46),{groups:n,activeId:r,onSelect:i,entries:a,searchQuery:o,onSearchChange:s,onNavigate:c}=e,{_:l}=vt(),u,d,f,p,m,g,_,v,y,b;if(t[0]!==l||t[1]!==a||t[2]!==c||t[3]!==s||t[4]!==o){d=o.trim();let e=d===``?[]:a.filter(e=>Zg(e.label,d,e.keywords)),n=e.filter(Jw),r=e.filter(qw),i=e.filter(Kw);t[15]===l?y=t[16]:(y=l({id:`y1t8bQ`}),t[15]=l,t[16]=y),b=`flex shrink-0 gap-x-3 overflow-x-auto overscroll-contain subtle-scrollbar scroll-fade-mask-x-max-sm border-b bg-muted/30 px-3 py-2 max-sm:pt-10 sm:h-full sm:min-h-0 sm:flex-col sm:gap-0 sm:overflow-x-visible sm:border-r sm:border-b-0 sm:py-4`,u=h,f=!1,p=`h-auto w-full shrink-0 bg-transparent sm:mb-3 [&_[data-slot=command-input-wrapper]]:h-9 [&_[data-slot=command-input-wrapper]]:rounded-lg [&_[data-slot=command-input-wrapper]]:border [&_[data-slot=command-input-wrapper]]:border-input`,m=`settings-search`;let x;t[17]===l?x=t[18]:(x=l({id:`1DahsC`}),t[17]=l,t[18]=x),t[19]!==s||t[20]!==o||t[21]!==x?(g=(0,Z.jsx)(gt,{value:o,onValueChange:s,placeholder:x,className:`py-0`,"data-testid":`settings-search-input`}),t[19]=s,t[20]=o,t[21]=x,t[22]=g):g=t[22];let S=d===``?null:(0,Z.jsx)(J,{id:`TQJCR6`,values:{0:e.length}});t[23]===S?_=t[24]:(_=(0,Z.jsx)(`span`,{"aria-live":`polite`,className:`sr-only`,"data-testid":`settings-search-result-count`,children:S}),t[23]=S,t[24]=_),v=d===``?null:(0,Z.jsxs)(U,{"data-testid":`settings-search-results`,className:`mt-1.5`,children:[(0,Z.jsx)(D,{"data-testid":`settings-search-empty`,children:(0,Z.jsx)(J,{id:`ljFWEt`})}),n.length>0?(0,Z.jsx)(L,{heading:l({id:`R4OWFD`}),children:n.map(e=>(0,Z.jsx)(Yw,{entry:e,query:d,onNavigate:c},e.id))}):null,r.length>0?(0,Z.jsx)(L,{heading:l({id:`Tz0i8g`}),children:r.map(e=>(0,Z.jsx)(Yw,{entry:e,query:d,onNavigate:c},e.id))}):null,i.length>0?(0,Z.jsx)(L,{heading:l({id:`v2a04T`}),children:i.map(e=>(0,Z.jsx)(Yw,{entry:e,query:d,onNavigate:c},e.id))}):null]}),t[0]=l,t[1]=a,t[2]=c,t[3]=s,t[4]=o,t[5]=u,t[6]=d,t[7]=f,t[8]=p,t[9]=m,t[10]=g,t[11]=_,t[12]=v,t[13]=y,t[14]=b}else u=t[5],d=t[6],f=t[7],p=t[8],m=t[9],g=t[10],_=t[11],v=t[12],y=t[13],b=t[14];let x;t[25]!==u||t[26]!==f||t[27]!==p||t[28]!==m||t[29]!==g||t[30]!==_||t[31]!==v?(x=(0,Z.jsxs)(u,{shouldFilter:f,className:p,"data-testid":m,children:[g,_,v]}),t[25]=u,t[26]=f,t[27]=p,t[28]=m,t[29]=g,t[30]=_,t[31]=v,t[32]=x):x=t[32];let S;t[33]!==r||t[34]!==n||t[35]!==i||t[36]!==d?(S=d===``?n.map(e=>(0,Z.jsx)(Qw,{group:e,activeId:r,onSelect:i},e.id)):null,t[33]=r,t[34]=n,t[35]=i,t[36]=d,t[37]=S):S=t[37];let C;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(Zw,{}),t[38]=C):C=t[38];let w;t[39]===S?w=t[40]:(w=(0,Z.jsxs)(`div`,{className:`contents subtle-scrollbar sm:flex sm:min-h-0 sm:flex-1 sm:flex-col sm:overflow-y-auto sm:overscroll-contain`,children:[S,C]}),t[39]=S,t[40]=w);let T;return t[41]!==w||t[42]!==y||t[43]!==b||t[44]!==x?(T=(0,Z.jsxs)(`nav`,{"aria-label":y,className:b,children:[x,w]}),t[41]=w,t[42]=y,t[43]=b,t[44]=x,t[45]=T):T=t[45],T}function Kw(e){return e.kind===`rule`}function qw(e){return e.kind===`field`}function Jw(e){return e.kind===`section`}function Yw(e){let t=(0,$.c)(13),{entry:n,query:r,onNavigate:i}=e,a=n.id,o;t[0]!==n||t[1]!==i?(o=()=>i(n),t[0]=n,t[1]=i,t[2]=o):o=t[2];let s=`settings-search-result-${n.id}`,c;t[3]!==n.label||t[4]!==r?(c=Jg(n.label,r).map(Xw),t[3]=n.label,t[4]=r,t[5]=c):c=t[5];let u;t[6]===c?u=t[7]:(u=(0,Z.jsx)(`span`,{className:`truncate`,children:c}),t[6]=c,t[7]=u);let d;return t[8]!==n.id||t[9]!==o||t[10]!==s||t[11]!==u?(d=(0,Z.jsx)(l,{value:a,onSelect:o,"data-testid":s,children:u}),t[8]=n.id,t[9]=o,t[10]=s,t[11]=u,t[12]=d):d=t[12],d}function Xw(e){return e.match?(0,Z.jsx)(`span`,{className:`font-semibold text-foreground`,children:e.text},e.start):(0,Z.jsx)(`span`,{children:e.text},e.start)}function Zw(){let e=(0,$.c)(4),t=typeof window<`u`?window.okDesktop??null:null,n=t?.appVersion;if(!t||!n)return null;let r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=Hw(n),e[0]=r):r=e[0];let i=r,a;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsxs)(`p`,{className:`whitespace-nowrap font-mono text-xs text-muted-foreground/70`,"data-testid":`settings-sidebar-version`,children:[`v`,n]}),e[1]=a):a=e[1];let o;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>{t.shell.openExternal(i)},e[2]=o):o=e[2];let s;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsxs)(`div`,{className:`ml-auto shrink-0 px-2 sm:ml-0 sm:mt-auto sm:pt-3`,children:[a,(0,Z.jsxs)(`button`,{type:`button`,onClick:o,"data-testid":`settings-sidebar-release-notes`,className:$t(`mt-0.5 inline-flex items-center gap-1 whitespace-nowrap rounded text-xs text-muted-foreground transition-colors hover:text-foreground`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`),children:[(0,Z.jsx)(J,{id:`_PACVa`}),(0,Z.jsx)(us,{className:`size-3`,"aria-hidden":`true`})]})]}),e[3]=s):s=e[3],s}function Qw(e){let t=(0,$.c)(28),{group:n,activeId:r,onSelect:i}=e;if(n.items.length===0)return null;let a=`settings-group-${n.id}`,o=`${a}-caption`,s=n.enabled?void 0:o,c=n.enabled?`text-muted-foreground/80`:`text-muted-foreground/50`,l;t[0]===c?l=t[1]:(l=$t(`shrink-0 whitespace-nowrap px-2 text-xs font-semibold uppercase tracking-wide font-mono sm:mb-1`,c),t[0]=c,t[1]=l);let u;t[2]!==n.label||t[3]!==a||t[4]!==s||t[5]!==l?(u=(0,Z.jsx)(`h3`,{id:a,"aria-describedby":s,className:l,children:n.label}),t[2]=n.label,t[3]=a,t[4]=s,t[5]=l,t[6]=u):u=t[6];let d;t[7]!==o||t[8]!==n.enabled?(d=n.enabled?null:(0,Z.jsx)(`p`,{id:o,className:`px-2 text-xs italic text-muted-foreground/60 sm:mb-1`,children:(0,Z.jsx)(J,{id:`JWsZlx`})}),t[7]=o,t[8]=n.enabled,t[9]=d):d=t[9];let f;if(t[10]!==r||t[11]!==o||t[12]!==n.enabled||t[13]!==n.items||t[14]!==i){let e;t[16]!==r||t[17]!==o||t[18]!==n.enabled||t[19]!==i?(e=e=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`button`,{type:`button`,"aria-current":r===e.id?`page`:void 0,"aria-disabled":n.enabled?void 0:!0,"aria-describedby":n.enabled?void 0:o,tabIndex:n.enabled?0:-1,disabled:!n.enabled,onClick:()=>n.enabled&&i(e.id),"data-testid":`settings-sidebar-item-${e.id}`,className:$t(`w-auto whitespace-nowrap rounded px-2 py-1.5 text-left text-sm transition-colors sm:w-full`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,`disabled:cursor-not-allowed disabled:opacity-50`,r===e.id&&n.enabled?`bg-accent text-accent-foreground`:`hover:bg-accent/50`),children:e.label})},e.id),t[16]=r,t[17]=o,t[18]=n.enabled,t[19]=i,t[20]=e):e=t[20],f=n.items.map(e),t[10]=r,t[11]=o,t[12]=n.enabled,t[13]=n.items,t[14]=i,t[15]=f}else f=t[15];let p;t[21]!==a||t[22]!==f?(p=(0,Z.jsx)(`ul`,{"aria-labelledby":a,className:`flex gap-1 sm:block sm:space-y-0.5`,children:f}),t[21]=a,t[22]=f,t[23]=p):p=t[23];let m;return t[24]!==u||t[25]!==d||t[26]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 sm:mb-4 sm:block`,children:[u,d,p]}),t[24]=u,t[25]=d,t[26]=p,t[27]=m):m=t[27],m}function $w(){let e=(0,$.c)(4),t,n,r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`GsBUCk`})}),n=(0,Z.jsx)(Cd,{className:`h-5 w-32`}),r=(0,Z.jsx)(Cd,{className:`h-4 w-64`}),e[0]=t,e[1]=n,e[2]=r):(t=e[0],n=e[1],r=e[2]);let i;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"aria-busy":`true`,className:`space-y-3`,"data-testid":`settings-content-skeleton`,children:[t,n,r,(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(Cd,{className:`h-9 w-full`}),(0,Z.jsx)(Cd,{className:`h-9 w-full`})]})]}),e[3]=i):i=e[3],i}function eT(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=$t(`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,Z.jsx)(Xx,{"data-slot":`resizable-panel-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function tT(e){let t=(0,$.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,Z.jsx)(eS,{"data-slot":`resizable-panel`,...n}),t[2]=n,t[3]=r),r}function nT(e){let t=(0,$.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=$t(`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,Z.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,Z.jsx)(iS,{"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}function rT(e){let t=(0,$.c)(119),{findInputRef:n,query:r,replacement:i,replaceOpen:a,caseSensitive:o,wholeWord:s,current:c,total:l,onQueryChange:u,onReplacementChange:d,onReplaceOpenChange:f,onCaseSensitiveChange:p,onWholeWordChange:m,onNext:h,onPrevious:g,onReplaceCurrent:_,onReplaceAll:v,onClose:y}=e,{_:b}=vt(),x=r.length>0,S=l>0,C;t[0]!==b||t[1]!==c||t[2]!==S||t[3]!==x||t[4]!==l?(C=x?S?`${c} / ${l}`:b({id:`Ev2r9A`}):``,t[0]=b,t[1]=c,t[2]=S,t[3]=x,t[4]=l,t[5]=C):C=t[5];let w=C,T;t[6]!==y||t[7]!==h||t[8]!==g?(T=function(e){e.key===`Enter`?(e.preventDefault(),e.shiftKey?g():h()):e.key===`Escape`&&(e.preventDefault(),y())},t[6]=y,t[7]=h,t[8]=g,t[9]=T):T=t[9];let E=T,D;t[10]!==y||t[11]!==_?(D=function(e){e.key===`Enter`?(e.preventDefault(),_()):e.key===`Escape`&&(e.preventDefault(),y())},t[10]=y,t[11]=_,t[12]=D):D=t[12];let O=D,k;t[13]===b?k=t[14]:(k=b({id:`MVxpbf`}),t[13]=b,t[14]=k);let A;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(`label`,{className:`sr-only`,htmlFor:`ok-find-input`,children:(0,Z.jsx)(J,{id:`KujtjC`})}),t[15]=A):A=t[15];let j;t[16]===u?j=t[17]:(j=e=>u(e.target.value),t[16]=u,t[17]=j);let M;t[18]===b?M=t[19]:(M=b({id:`KujtjC`}),t[18]=b,t[19]=M);let N;t[20]!==n||t[21]!==E||t[22]!==r||t[23]!==j||t[24]!==M?(N=(0,Z.jsx)(Nc,{ref:n,id:`ok-find-input`,value:r,onChange:j,onKeyDown:E,placeholder:M,autoComplete:`off`,spellCheck:!1,className:`h-7 px-2 text-sm`}),t[20]=n,t[21]=E,t[22]=r,t[23]=j,t[24]=M,t[25]=N):N=t[25];let P;t[26]===b?P=t[27]:(P=b({id:`-8PP0T`}),t[26]=b,t[27]=P);let F;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(Im,{"aria-hidden":`true`}),t[28]=F):F=t[28];let I;t[29]!==o||t[30]!==p||t[31]!==P?(I=(0,Z.jsx)(ln,{asChild:!0,children:(0,Z.jsx)(Ni,{type:`button`,variant:`segmented`,size:`sm`,"aria-label":P,pressed:o,onPressedChange:p,className:`size-6 min-w-6 px-0`,children:F})}),t[29]=o,t[30]=p,t[31]=P,t[32]=I):I=t[32];let L;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(un,{side:`bottom`,children:(0,Z.jsx)(J,{id:`-8PP0T`})}),t[33]=L):L=t[33];let R;t[34]===I?R=t[35]:(R=(0,Z.jsxs)(fn,{children:[I,L]}),t[34]=I,t[35]=R);let z;t[36]===b?z=t[37]:(z=b({id:`_7UQ7y`}),t[36]=b,t[37]=z);let B;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsx)(Gh,{"aria-hidden":`true`}),t[38]=B):B=t[38];let V;t[39]!==m||t[40]!==z||t[41]!==s?(V=(0,Z.jsx)(ln,{asChild:!0,children:(0,Z.jsx)(Ni,{type:`button`,variant:`segmented`,size:`sm`,"aria-label":z,pressed:s,onPressedChange:m,className:`size-6 min-w-6 px-0`,children:B})}),t[39]=m,t[40]=z,t[41]=s,t[42]=V):V=t[42];let H;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Z.jsx)(un,{side:`bottom`,children:(0,Z.jsx)(J,{id:`_7UQ7y`})}),t[43]=H):H=t[43];let U;t[44]===V?U=t[45]:(U=(0,Z.jsxs)(fn,{children:[V,H]}),t[44]=V,t[45]=U);let W;t[46]!==R||t[47]!==U?(W=(0,Z.jsxs)(Rc,{align:`inline-end`,className:`gap-0.5`,children:[R,U]}),t[46]=R,t[47]=U,t[48]=W):W=t[48];let ee;t[49]!==W||t[50]!==N?(ee=(0,Z.jsxs)(Vc,{className:`h-7 w-56 rounded-[min(var(--radius-md),12px)]`,children:[N,W]}),t[49]=W,t[50]=N,t[51]=ee):ee=t[51];let G;t[52]===w?G=t[53]:(G=(0,Z.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`min-w-14 px-1 text-right text-muted-foreground text-xs tabular-nums shrink-0`,children:w}),t[52]=w,t[53]=G);let K;t[54]===b?K=t[55]:(K=b({id:`oqB2ez`}),t[54]=b,t[55]=K);let te=!S,ne;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Z.jsx)(pt,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[56]=ne):ne=t[56];let re;t[57]!==g||t[58]!==K||t[59]!==te?(re=(0,Z.jsx)(ln,{asChild:!0,children:(0,Z.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":K,disabled:te,onClick:g,children:ne})}),t[57]=g,t[58]=K,t[59]=te,t[60]=re):re=t[60];let ie;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,Z.jsx)(un,{side:`bottom`,children:(0,Z.jsx)(J,{id:`oqB2ez`})}),t[61]=ie):ie=t[61];let ae;t[62]===re?ae=t[63]:(ae=(0,Z.jsxs)(fn,{children:[re,ie]}),t[62]=re,t[63]=ae);let oe;t[64]===b?oe=t[65]:(oe=b({id:`SiUUCS`}),t[64]=b,t[65]=oe);let se=!S,ce;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(ce=(0,Z.jsx)(ks,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[66]=ce):ce=t[66];let le;t[67]!==h||t[68]!==oe||t[69]!==se?(le=(0,Z.jsx)(ln,{asChild:!0,children:(0,Z.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":oe,disabled:se,onClick:h,children:ce})}),t[67]=h,t[68]=oe,t[69]=se,t[70]=le):le=t[70];let ue;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(ue=(0,Z.jsx)(un,{side:`bottom`,children:(0,Z.jsx)(J,{id:`SiUUCS`})}),t[71]=ue):ue=t[71];let de;t[72]===le?de=t[73]:(de=(0,Z.jsxs)(fn,{children:[le,ue]}),t[72]=le,t[73]=de);let fe=a?`secondary`:`ghost`,pe;t[74]!==b||t[75]!==a?(pe=b(a?{id:`UkQGhd`}:{id:`1RluQD`}),t[74]=b,t[75]=a,t[76]=pe):pe=t[76];let q=a?`ok-replace-input`:void 0,me;t[77]!==f||t[78]!==a?(me=()=>f(!a),t[77]=f,t[78]=a,t[79]=me):me=t[79];let he;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(he=(0,Z.jsx)(wh,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[80]=he):he=t[80];let ge;t[81]!==a||t[82]!==fe||t[83]!==pe||t[84]!==q||t[85]!==me?(ge=(0,Z.jsx)(ln,{asChild:!0,children:(0,Z.jsx)(Y,{type:`button`,variant:fe,size:`icon-sm`,"aria-label":pe,"aria-expanded":a,"aria-controls":q,onClick:me,children:he})}),t[81]=a,t[82]=fe,t[83]=pe,t[84]=q,t[85]=me,t[86]=ge):ge=t[86];let _e;t[87]===a?_e=t[88]:(_e=(0,Z.jsx)(un,{side:`bottom`,children:a?(0,Z.jsx)(J,{id:`UkQGhd`}):(0,Z.jsx)(J,{id:`1RluQD`})}),t[87]=a,t[88]=_e);let ve;t[89]!==ge||t[90]!==_e?(ve=(0,Z.jsxs)(fn,{children:[ge,_e]}),t[89]=ge,t[90]=_e,t[91]=ve):ve=t[91];let ye;t[92]!==b||t[93]!==O||t[94]!==S||t[95]!==v||t[96]!==_||t[97]!==d||t[98]!==a||t[99]!==i?(ye=a?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`label`,{className:`sr-only`,htmlFor:`ok-replace-input`,children:(0,Z.jsx)(J,{id:`fqSfXY`})}),(0,Z.jsx)(vl,{id:`ok-replace-input`,value:i,onChange:e=>d(e.target.value),onKeyDown:O,placeholder:b({id:`fqSfXY`}),autoComplete:`off`,spellCheck:!1,className:`h-7 w-48 rounded-[min(var(--radius-md),12px)] px-2 text-sm shadow-none focus-visible:ring-2`}),(0,Z.jsxs)(fn,{children:[(0,Z.jsx)(ln,{asChild:!0,children:(0,Z.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":b({id:`bS_boY`}),disabled:!S,onClick:_,children:(0,Z.jsx)(wh,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(un,{side:`bottom`,children:(0,Z.jsx)(J,{id:`bS_boY`})})]}),(0,Z.jsxs)(fn,{children:[(0,Z.jsx)(ln,{asChild:!0,children:(0,Z.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":b({id:`dr1vFs`}),disabled:!S,onClick:v,children:(0,Z.jsx)(Ch,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(un,{side:`bottom`,children:(0,Z.jsx)(J,{id:`dr1vFs`})})]})]}):null,t[92]=b,t[93]=O,t[94]=S,t[95]=v,t[96]=_,t[97]=d,t[98]=a,t[99]=i,t[100]=ye):ye=t[100];let be;t[101]===b?be=t[102]:(be=b({id:`wJo9oS`}),t[101]=b,t[102]=be);let xe;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(xe=(0,Z.jsx)(fl,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[103]=xe):xe=t[103];let Se;t[104]!==y||t[105]!==be?(Se=(0,Z.jsx)(ln,{asChild:!0,children:(0,Z.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":be,onClick:y,children:xe})}),t[104]=y,t[105]=be,t[106]=Se):Se=t[106];let Ce;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=(0,Z.jsx)(un,{side:`bottom`,children:(0,Z.jsx)(J,{id:`yz7wBu`})}),t[107]=Ce):Ce=t[107];let we;t[108]===Se?we=t[109]:(we=(0,Z.jsxs)(fn,{children:[Se,Ce]}),t[108]=Se,t[109]=we);let Te;return t[110]!==ee||t[111]!==G||t[112]!==ae||t[113]!==de||t[114]!==k||t[115]!==ve||t[116]!==ye||t[117]!==we?(Te=(0,Z.jsxs)(`search`,{"data-testid":`find-replace-bar`,"aria-label":k,className:`pointer-events-auto flex max-w-[min(calc(100vw-1rem),720px)] touch-manipulation items-center gap-1 rounded-[calc(var(--radius)+2px)] border border-input bg-popover/95 p-1 text-popover-foreground shadow-md shadow-black/10 backdrop-blur`,children:[A,ee,G,ae,de,ve,ye,we]}),t[110]=ee,t[111]=G,t[112]=ae,t[113]=de,t[114]=k,t[115]=ve,t[116]=ye,t[117]=we,t[118]=Te):Te=t[118],Te}var iT={current:0,total:0},aT=120,oT=100;function sT(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=()=>e?f(e):null,t[0]=e,t[1]=n),(0,Q.useSyncExternalStore)(je,n,cT)}function cT(){return null}function lT(e){if(!e||e.isDestroyed)return null;let{from:t,to:n,empty:r}=e.state.selection;if(r)return null;let i=e.state.doc.textBetween(t,n,`
15
15
  `,`
16
16
  `).trim();return i.length===0||i.length>aT||i.includes(`
17
17
  `)?null:i}function uT(e){let t=G(e.state);return{current:t.matches.length===0?0:t.activeIndex+1,total:t.matches.length}}function dT(e,t){return e.current===t.current&&e.total===t.total}function fT(e,t,n){e&&!e.isDestroyed&&(e.commands.clearFindMatches(),e.commands.focus()),t(e=>({...e,open:!1,activeIndex:0})),n(iT)}function pT(e){!e||e.isDestroyed||typeof window>`u`||window.requestAnimationFrame(()=>{if(e.isDestroyed)return;let t=En(e);if(!t)return;let n=t.dom.querySelector(`.ok-find-match-active`);n instanceof HTMLElement&&n.scrollIntoView({block:`center`,inline:`nearest`,behavior:`auto`})})}function mT(e){let t=(0,$.c)(81),{activeDocName:n,isSourceMode:r}=e,i=sT(n),a=(0,Q.useRef)(null),o=(0,Q.useRef)(null),s=(0,Q.useRef)(n),c=(0,Q.useRef)(0),l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l={open:!1,replaceOpen:!1,query:``,replacement:``,caseSensitive:!1,wholeWord:!1,activeIndex:0},t[0]=l):l=t[0];let[u,d]=(0,Q.useState)(l),[f,p]=(0,Q.useState)(iT),m,h;t[1]===n?(m=t[2],h=t[3]):(m=()=>{s.current!==n&&(s.current=n,d(gT))},h=[n],t[1]=n,t[2]=m,t[3]=h),(0,Q.useEffect)(m,h);let g,_;t[4]===u.activeIndex?(g=t[5],_=t[6]):(g=()=>{c.current=u.activeIndex},_=[u.activeIndex],t[4]=u.activeIndex,t[5]=g,t[6]=_),(0,Q.useEffect)(g,_);let v,y;t[7]===i?(v=t[8],y=t[9]):(v=()=>{let e=o.current;e&&e!==i&&!e.isDestroyed&&e.commands.clearFindMatches(),o.current=i},y=[i],t[7]=i,t[8]=v,t[9]=y),(0,Q.useEffect)(v,y);let b,x;t[10]===u.open?(b=t[11],x=t[12]):(b=()=>{if(!u.open||!a.current)return;let e=requestAnimationFrame(()=>{a.current?.focus(),a.current?.select()});return()=>cancelAnimationFrame(e)},x=[u.open],t[10]=u.open,t[11]=b,t[12]=x),(0,Q.useEffect)(b,x);let S,C;t[13]!==u.open||t[14]!==r?(S=()=>{!u.open||!r||d(hT)},C=[u.open,r],t[13]=u.open,t[14]=r,t[15]=S,t[16]=C):(S=t[15],C=t[16]),(0,Q.useEffect)(S,C);let w,T;t[17]!==i||t[18]!==u.caseSensitive||t[19]!==u.open||t[20]!==u.query||t[21]!==u.wholeWord||t[22]!==r?(w=()=>{if(!i||i.isDestroyed){p(iT);return}if(!u.open||r){i.commands.clearFindMatches(),p(iT);return}let e=window.setTimeout(()=>{if(i.isDestroyed)return;i.commands.setFindQuery(u.query,{options:{caseSensitive:u.caseSensitive,wholeWord:u.wholeWord},activeIndex:c.current});let e=uT(i);p(t=>dT(t,e)?t:e)},oT);return()=>window.clearTimeout(e)},T=[i,u.open,u.query,u.caseSensitive,u.wholeWord,r],t[17]=i,t[18]=u.caseSensitive,t[19]=u.open,t[20]=u.query,t[21]=u.wholeWord,t[22]=r,t[23]=w,t[24]=T):(w=t[23],T=t[24]),(0,Q.useEffect)(w,T);let E,D;t[25]!==i||t[26]!==u.open||t[27]!==r?(E=()=>{if(!i||i.isDestroyed||!u.open||r)return;let e=()=>{let e=G(i.state),t=uT(i);p(e=>dT(e,t)?e:t),d(t=>t.activeIndex===e.activeIndex?t:{...t,activeIndex:e.activeIndex})};return i.on(`transaction`,e),()=>{i.off(`transaction`,e)}},D=[i,u.open,r],t[25]=i,t[26]=u.open,t[27]=r,t[28]=E,t[29]=D):(E=t[28],D=t[29]),(0,Q.useEffect)(E,D);let O,k;t[30]!==n||t[31]!==i||t[32]!==u.open||t[33]!==r?(O=()=>{let e=function(e){let t=lT(i);d(n=>({...n,open:!0,replaceOpen:e,query:t??n.query,activeIndex:0}))},t=function(t){if(!(!n||r||t.defaultPrevented)){if(Sl(t,`find`)){t.preventDefault(),u.open?fT(i,d,p):e(!1);return}if(Sl(t,`replace`)){t.preventDefault(),e(!0);return}if(u.open){let e=Sl(t,`find-next`),n=Sl(t,`find-previous`);if(e||n){t.preventDefault(),(n?i?.commands.selectPreviousFindMatch():i?.commands.selectNextFindMatch())&&pT(i);return}}t.key===`Escape`&&u.open&&(t.preventDefault(),fT(i,d,p))}};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},k=[n,i,u.open,r],t[30]=n,t[31]=i,t[32]=u.open,t[33]=r,t[34]=O,t[35]=k):(O=t[34],k=t[35]),(0,Q.useEffect)(O,k);let A;t[36]!==i||t[37]!==u.caseSensitive||t[38]!==u.query||t[39]!==u.wholeWord?(A=function(){return!i||i.isDestroyed?!1:(i.commands.setFindQuery(u.query,{options:{caseSensitive:u.caseSensitive,wholeWord:u.wholeWord},activeIndex:c.current}),!0)},t[36]=i,t[37]=u.caseSensitive,t[38]=u.query,t[39]=u.wholeWord,t[40]=A):A=t[40];let j=A,M;t[41]===i?M=t[42]:(M=function(){if(!i||i.isDestroyed)return;let e=G(i.state),t=uT(i);p(e=>dT(e,t)?e:t),d(t=>t.activeIndex===e.activeIndex?t:{...t,activeIndex:e.activeIndex})},t[41]=i,t[42]=M);let N=M,P;t[43]===i?P=t[44]:(P=function(){fT(i,d,p)},t[43]=i,t[44]=P);let F=P,I;t[45]!==j||t[46]!==i||t[47]!==N?(I=function(){!i||i.isDestroyed||(j(),i.commands.selectNextFindMatch()&&pT(i),N())},t[45]=j,t[46]=i,t[47]=N,t[48]=I):I=t[48];let L=I,R;t[49]!==j||t[50]!==i||t[51]!==N?(R=function(){!i||i.isDestroyed||(j(),i.commands.selectPreviousFindMatch()&&pT(i),N())},t[49]=j,t[50]=i,t[51]=N,t[52]=R):R=t[52];let z=R,B;t[53]!==j||t[54]!==i||t[55]!==u.replacement||t[56]!==N?(B=function(){!i||i.isDestroyed||(j(),i.commands.replaceCurrentFindMatch(u.replacement)&&pT(i),N())},t[53]=j,t[54]=i,t[55]=u.replacement,t[56]=N,t[57]=B):B=t[57];let V=B,H;t[58]!==j||t[59]!==i||t[60]!==u.replacement||t[61]!==N?(H=function(){!i||i.isDestroyed||(j(),i.commands.replaceAllFindMatches(u.replacement)&&pT(i),N())},t[58]=j,t[59]=i,t[60]=u.replacement,t[61]=N,t[62]=H):H=t[62];let U=H;if(!u.open||!n||r)return null;let W,ee,K,te,ne;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(W=e=>d(t=>({...t,query:e,activeIndex:0})),ee=e=>d(t=>({...t,replacement:e})),K=e=>d(t=>({...t,replaceOpen:e})),te=e=>d(t=>({...t,caseSensitive:e})),ne=e=>d(t=>({...t,wholeWord:e})),t[63]=W,t[64]=ee,t[65]=K,t[66]=te,t[67]=ne):(W=t[63],ee=t[64],K=t[65],te=t[66],ne=t[67]);let re;return t[68]!==F||t[69]!==u.caseSensitive||t[70]!==u.query||t[71]!==u.replaceOpen||t[72]!==u.replacement||t[73]!==u.wholeWord||t[74]!==f.current||t[75]!==f.total||t[76]!==U||t[77]!==V||t[78]!==L||t[79]!==z?(re=(0,Z.jsx)(`div`,{className:`editor-content-aligned pointer-events-none absolute inset-x-0 top-2 z-30 px-2`,children:(0,Z.jsx)(`div`,{className:`flex justify-end`,children:(0,Z.jsx)(rT,{findInputRef:a,query:u.query,replacement:u.replacement,replaceOpen:u.replaceOpen,caseSensitive:u.caseSensitive,wholeWord:u.wholeWord,current:f.current,total:f.total,onQueryChange:W,onReplacementChange:ee,onReplaceOpenChange:K,onCaseSensitiveChange:te,onWholeWordChange:ne,onNext:L,onPrevious:z,onReplaceCurrent:V,onReplaceAll:U,onClose:F})})}),t[68]=F,t[69]=u.caseSensitive,t[70]=u.query,t[71]=u.replaceOpen,t[72]=u.replacement,t[73]=u.wholeWord,t[74]=f.current,t[75]=f.total,t[76]=U,t[77]=V,t[78]=L,t[79]=z,t[80]=re):re=t[80],re}function hT(e){return{...e,open:!1,activeIndex:0}}function gT(e){return{...e,activeIndex:0}}var _T=300;function vT(e,t){let n=(0,$.c)(4),[r,i]=(0,Q.useState)(ud),a,o;return n[0]!==t||n[1]!==e?(a=()=>{if(!e||!t){i(ud);return}let n=e.document.getText(`source`),r=!1,a=null,o=function(){r||i(dd(n.toString()))};o();let s=function(){a&&clearTimeout(a),a=setTimeout(o,_T)};return n.observe(s),()=>{r=!0,n.unobserve(s),a&&clearTimeout(a)}},o=[e,t],n[0]=t,n[1]=e,n[2]=a,n[3]=o):(a=n[2],o=n[3]),(0,Q.useEffect)(a,o),r}function yT(e){return e&&e.document.getMap(`lifecycle`).get(`status`)===`conflict`?`conflict`:null}function bT(e){let t=(0,$.c)(8),{poolEntries:n}=Re(),r;t[0]!==e||t[1]!==n?(r=e?n.find(t=>t.docName===e)??null:null,t[0]=e,t[1]=n,t[2]=r):r=t[2];let i=r?.provider??null,a;t[3]===i?a=t[4]:(a=()=>yT(i),t[3]=i,t[4]=a);let[o,s]=(0,Q.useState)(a),c,l;return t[5]===i?(c=t[6],l=t[7]):(c=()=>{if(!i){s(null);return}let e=i.document.getMap(`lifecycle`);s(yT(i));let t=()=>s(yT(i));return e.observe(t),()=>{e.unobserve(t)}},l=[i],t[5]=i,t[6]=c,t[7]=l),(0,Q.useEffect)(c,l),o}function xT(e,t){let n=(0,$.c)(3),r;return n[0]!==e||n[1]!==t?(r=()=>fd(e,t),n[0]=e,n[1]=t,n[2]=r):r=n[2],(0,Q.useSyncExternalStore)(td,r)}var ST=`ok-doc-panel-width-v1`;function CT(e){return Number.isFinite(e)?e<300?300:e>600?600:Math.round(e):320}function wT(e){try{let t=(e??localStorage).getItem(ST);if(t==null)return 320;let n=Number.parseInt(t,10);return Number.isFinite(n)?CT(n):320}catch{return 320}}function TT(e,t){try{(t??localStorage).setItem(ST,String(CT(e)))}catch{}}function ET(){try{return typeof localStorage>`u`?320:wT()}catch{return 320}}var DT=1024,OT=1280,kT={left:DT,right:OT};function AT(e,t,n){return e==null?t>=kT[n]?`above`:`below`:`embedded`}function jT(e){return e===`above`?`open`:`collapsed`}var MT=`ok-sidebar-pins-v2`;function NT(e){return e===`open`||e===`collapsed`}function PT(e){return e===`above`||e===`below`||e===`embedded`}function FT(e){if(typeof e!=`object`||!e)return!1;let t=e;for(let e of Object.keys(t))if(!PT(e)||!NT(t[e]))return!1;return!0}function IT(e){let t=JSON.parse(e);if(typeof t!=`object`||!t)return{};let n=t,r={};return FT(n.left)&&(r.left=n.left),FT(n.right)&&(r.right=n.right),r}function LT(e){try{let t=(e??localStorage).getItem(MT);return t==null?{}:IT(t)}catch{return{}}}function RT(e,t){try{t.setItem(MT,JSON.stringify(e))}catch{}}function zT(e,t,n){return n[e]?.[t]??jT(t)}function BT(e,t,n,r){let i=r??localStorage,a=LT(i);return a[e]={...a[e],[t]:n},RT(a,i),a}var VT=`ok-terminal-width-v1`;function HT(e){return Number.isFinite(e)?e<320?320:Math.round(e):480}function UT(e){try{let t=(e??localStorage).getItem(VT);if(t==null)return 480;let n=Number.parseInt(t,10);return Number.isFinite(n)?HT(n):480}catch{return 480}}function WT(e,t){try{(t??localStorage).setItem(VT,String(HT(e)))}catch{}}function GT(){try{return typeof localStorage>`u`?480:UT()}catch{return 480}}function KT(e){let t=(0,$.c)(3),[n,r]=(0,Q.useState)(`connecting`),i,a;return t[0]===e?(i=t[1],a=t[2]):(i=()=>{if(!e){r(`connecting`);return}let t=e.configuration.websocketProvider.status;e.isSynced?r(`synced`):r(t===`connected`?`connected`:t===`disconnected`?`disconnected`:`connecting`);let n=e=>{let{status:t}=e;r(t===`connected`?qT:t===`disconnected`?`disconnected`:`connecting`)},i=e=>{let{state:t}=e;r(t?`synced`:`connected`)},a=()=>r(`disconnected`);return e.on(`status`,n),e.on(`synced`,i),e.on(`disconnect`,a),()=>{e.off(`status`,n),e.off(`synced`,i),e.off(`disconnect`,a)}},a=[e],t[0]=e,t[1]=i,t[2]=a),(0,Q.useEffect)(i,a),n}function qT(e){return e===`synced`?`synced`:`connected`}function JT(e){let t=e.lastIndexOf(`/`);return t>=0?e.slice(t+1):e}function YT(e){let t=(0,$.c)(21),{path:n,onRemove:r}=e,{_:i}=vt(),a,o;t[0]!==i||t[1]!==n?(a=JT(n),o=i({id:`hnq8fP`,values:{label:a}}),t[0]=i,t[1]=n,t[2]=a,t[3]=o):(a=t[2],o=t[3]);let s=o,c=`composer-context-chip-file-${n}`,l;t[4]===r?l=t[5]:(l=e=>{(e.key===`Backspace`||e.key===`Delete`)&&(e.preventDefault(),r())},t[4]=r,t[5]=l);let u;t[6]===n?u=t[7]:(u=(0,Z.jsx)(`span`,{className:`absolute top-1/2 left-1/2 inline-flex size-3 -translate-x-1/2 -translate-y-1/2 opacity-100 transition-opacity duration-150 ease-out group-hover/chip:opacity-0 group-focus-within/chip:opacity-0 motion-reduce:transition-none`,children:(0,Z.jsx)(ee,{path:n,className:`size-3`,showExtensionBadge:!1})}),t[6]=n,t[7]=u);let d;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(fl,{className:`absolute top-1/2 left-1/2 size-3 -translate-x-1/2 -translate-y-1/2 opacity-0 transition-opacity duration-150 ease-out group-hover/chip:opacity-100 group-focus-within/chip:opacity-100 motion-reduce:transition-none`,"aria-hidden":!0}),t[8]=d):d=t[8];let f;t[9]!==r||t[10]!==s||t[11]!==l||t[12]!==u?(f=(0,Z.jsxs)(Y,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":s,onClick:r,onKeyDown:l,className:`group/remove relative size-3.5 shrink-0 rounded-sm text-muted-foreground/80 hover:text-foreground`,children:[u,d]}),t[9]=r,t[10]=s,t[11]=l,t[12]=u,t[13]=f):f=t[13];let p;t[14]===a?p=t[15]:(p=(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:a}),t[14]=a,t[15]=p);let m;return t[16]!==n||t[17]!==c||t[18]!==f||t[19]!==p?(m=(0,Z.jsxs)(`span`,{"data-testid":c,title:n,className:`group/chip inline-flex max-w-[14rem] items-center gap-1 rounded-md border bg-muted/40 py-0.5 pr-1.5 pl-1 text-muted-foreground text-xs`,children:[f,p]}),t[16]=n,t[17]=c,t[18]=f,t[19]=p,t[20]=m):m=t[20],m}function XT(e){let t=(0,$.c)(11),{files:n,onRemoveFile:r,className:i,children:a}=e;if(n.length===0&&a==null)return null;let o;t[0]===i?o=t[1]:(o=$t(`flex flex-wrap items-center gap-1`,i),t[0]=i,t[1]=o);let s;if(t[2]!==n||t[3]!==r){let e;t[5]===r?e=t[6]:(e=e=>(0,Z.jsx)(YT,{path:e,onRemove:()=>r(e)},e),t[5]=r,t[6]=e),s=n.map(e),t[2]=n,t[3]=r,t[4]=s}else s=t[4];let c;return t[7]!==a||t[8]!==o||t[9]!==s?(c=(0,Z.jsxs)(`div`,{className:o,"data-testid":`composer-context-chips`,children:[s,a]}),t[7]=a,t[8]=o,t[9]=s,t[10]=c):c=t[10],c}function ZT(e){let t=(0,$.c)(52),{primary:n,onPrimary:r,primaryDisabled:i,installedTargets:a,selectedTargetId:o,onSelectTarget:s,threadAgents:c,onOpenSettings:l,terminal:u,terminals:d,menuEmptyState:f,onMenuOpenChange:p,menuAlign:m,triggerAriaLabel:h,testIds:g}=e,_=i===void 0?!1:i,v=m===void 0?`end`:m,{_:y}=vt(),b=a.length>0,x=d&&d.length>0?d:null,S=x!=null||u!=null,C=b||S,w=c!==void 0&&c.length>0,T;t[0]===g?T=t[1]:(T=e=>typeof g.terminal==`function`?g.terminal(e):g.terminal,t[0]=g,t[1]=T);let E=T,D;t[2]!==r||t[3]!==n||t[4]!==_||t[5]!==g.primary?(D=(0,Z.jsx)(Y,{type:`button`,variant:`outline`,className:`gap-1.5`,disabled:_,onClick:r,"data-testid":g.primary,children:n}),t[2]=r,t[3]=n,t[4]=_,t[5]=g.primary,t[6]=D):D=t[6];let O;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Z.jsx)(ks,{"aria-hidden":`true`,className:`size-3.5 text-muted-foreground`}),t[7]=O):O=t[7];let k;t[8]!==g.trigger||t[9]!==h?(k=(0,Z.jsx)(Pr,{asChild:!0,children:(0,Z.jsx)(Y,{type:`button`,variant:`outline`,size:`icon`,"aria-label":h,"data-testid":g.trigger,children:O})}),t[8]=g.trigger,t[9]=h,t[10]=k):k=t[10];let A;t[11]!==y||t[12]!==C||t[13]!==w||t[14]!==g||t[15]!==c?(A=w?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Nr,{"aria-label":y({id:`vPKX2i`}),children:[(0,Z.jsxs)(Ir,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(J,{id:`RXEbZy`}),(0,Z.jsx)(Xi,{})]}),c?.map(e=>(0,Z.jsxs)(Ar,{onSelect:e.onSelect,"data-testid":g.threadAgent?.(e.key),children:[(0,Z.jsx)(fs,{agentId:e.id,iconUrl:e.iconUrl,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1 truncate`,children:e.name}),e.selected?(0,Z.jsx)(Ds,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.key))]}),C?(0,Z.jsx)(Vr,{}):null]}):null,t[11]=y,t[12]=C,t[13]=w,t[14]=g,t[15]=c,t[16]=A):A=t[16];let j;t[17]!==y||t[18]!==x||t[19]!==C||t[20]!==a||t[21]!==s||t[22]!==o||t[23]!==b||t[24]!==S||t[25]!==u||t[26]!==E||t[27]!==g?(j=C?(0,Z.jsxs)(Z.Fragment,{children:[S?(0,Z.jsxs)(Nr,{"aria-label":y({id:`ALhMYW`}),children:[(0,Z.jsx)(Ir,{children:(0,Z.jsx)(J,{id:`ALhMYW`})}),x?x.map(e=>(0,Z.jsxs)(Ar,{onSelect:e.onSelect,"data-testid":E(e.cli),"aria-label":e.ariaLabel,children:[(0,Z.jsx)(Ji,{id:Vi(e.cli),className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:e.label}),e.selected?(0,Z.jsx)(Ds,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.cli)):u?(0,Z.jsxs)(Ar,{onSelect:u.onSelect,"data-testid":E(`claude`),"aria-label":y({id:`AcK_r0`}),children:[(0,Z.jsx)(Ji,{id:Vi(`claude`),className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(J,{id:`fcgvCA`})}),u.selected?(0,Z.jsx)(Ds,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]}):null]}):null,b?(0,Z.jsxs)(Z.Fragment,{children:[S?(0,Z.jsx)(Vr,{}):null,(0,Z.jsxs)(Nr,{"aria-label":y({id:`BBqGS9`}),children:[(0,Z.jsx)(Ir,{children:(0,Z.jsx)(J,{id:`BBqGS9`})}),a.map(e=>(0,Z.jsxs)(Ar,{onSelect:()=>s(e),"data-testid":g.option(e.id),children:[(0,Z.jsx)(Ji,{id:e.id,"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:e.displayName}),o===e.id?(0,Z.jsx)(Ds,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.id))]})]}):null]}):null,t[17]=y,t[18]=x,t[19]=C,t[20]=a,t[21]=s,t[22]=o,t[23]=b,t[24]=S,t[25]=u,t[26]=E,t[27]=g,t[28]=j):j=t[28];let M=!w&&!C?f:null,N;t[29]!==C||t[30]!==w?(N=w||C?(0,Z.jsx)(Vr,{}):null,t[29]=C,t[30]=w,t[31]=N):N=t[31];let P;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(nl,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}),t[32]=P):P=t[32];let F;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(J,{id:`jRAGrQ`})}),t[33]=F):F=t[33];let I;t[34]!==l||t[35]!==g.settings?(I=(0,Z.jsxs)(Ar,{onSelect:l,"data-testid":g.settings,children:[P,F]}),t[34]=l,t[35]=g.settings,t[36]=I):I=t[36];let L;t[37]!==v||t[38]!==N||t[39]!==I||t[40]!==A||t[41]!==j||t[42]!==M||t[43]!==g.menu?(L=(0,Z.jsxs)(Rr,{align:v,className:`max-h-80 min-w-[200px]`,"data-testid":g.menu,children:[A,j,M,N,I]}),t[37]=v,t[38]=N,t[39]=I,t[40]=A,t[41]=j,t[42]=M,t[43]=g.menu,t[44]=L):L=t[44];let R;t[45]!==p||t[46]!==L||t[47]!==k?(R=(0,Z.jsxs)(Br,{modal:!1,onOpenChange:p,children:[k,L]}),t[45]=p,t[46]=L,t[47]=k,t[48]=R):R=t[48];let z;return t[49]!==R||t[50]!==D?(z=(0,Z.jsxs)(zS,{children:[D,R]}),t[49]=R,t[50]=D,t[51]=z):z=t[51],z}var QT=`ok-onboarding-card-v1`,$T={initialized:!1,steps:{file:!1,askedAi:!1},fileBaseline:0,dismissed:!1,completed:!1};function eE(e){return e===!0}function tE(e){if(typeof e!=`object`||!e)return $T;let t=e,n=typeof t.steps==`object`&&t.steps!==null?t.steps:{};return{initialized:eE(t.initialized),steps:{file:eE(n.file),askedAi:eE(n.askedAi)},fileBaseline:typeof t.fileBaseline==`number`&&Number.isFinite(t.fileBaseline)&&t.fileBaseline>=0?t.fileBaseline:0,dismissed:eE(t.dismissed),completed:eE(t.completed)}}function nE(e){try{let t=(e??localStorage).getItem(QT);return t==null?$T:tE(JSON.parse(t))}catch(e){return console.warn(`[onboarding-card-store] readPersistedState failed (corrupt/privacy/SSR)`,e),$T}}function rE(e,t){try{(t??localStorage).setItem(QT,JSON.stringify(e))}catch(e){console.warn(`[onboarding-card-store] writePersistedState failed (quota/privacy/SSR)`,e)}}function iE(e){let t=nE(e),n=new Set,r=!1;function i(){for(let e of n)e()}function a(n){t=n,rE(t,e),i()}return{getSnapshot(){return t},subscribe(e){return n.add(e),()=>{n.delete(e)}},activate(e=0){t.initialized||a({...t,initialized:!0,fileBaseline:e})},markStepComplete(e){t.steps[e]||a({...t,steps:{...t.steps,[e]:!0}})},dismiss(){t.dismissed||a({...t,dismissed:!0})},markCompleted(){t.completed||a({...t,completed:!0})},install(){r||(r=!0,t=nE(e),i())}}}var aE=iE();function oE(e){let t=e===void 0?aE:e;return(0,Q.useSyncExternalStore)(t.subscribe,t.getSnapshot,t.getSnapshot)}function sE(){aE.install()}function cE(e){return Al(e).filter(e=>e.kind===`document`||e.kind===`folder`).length}async function lE(){let e=await fetch(`/api/documents`);if(!e.ok)throw Error(`documents request failed: ${e.status}`);let t=await e.json(),n=xo.safeParse(t);if(!n.success)throw Error(`documents response did not match schema`,{cause:n.error});return cE(n.data.documents)}async function uE(e=aE){let t=e.getSnapshot();if(!(t.steps.file||!t.initialized))try{await lE()>t.fileBaseline&&e.markStepComplete(`file`)}catch(e){console.warn(`[onboarding-signals] file-step count read failed; leaving step incomplete`,e)}}function dE(e=aE){e.getSnapshot().initialized&&e.markStepComplete(`askedAi`)}var fE=5200,pE=500,mE=/\.(md|mdx)$/i;function hE(e,t){return mE.test(e)?e:t?`${e}${t}`:dc(e)}function gE(e){return mE.test(e)?e.replace(mE,``):null}function _E(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName.toUpperCase();return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`}function vE(){let e=(0,$.c)(2),[t,n]=(0,Q.useState)(yE),r,i;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=window.matchMedia(`(prefers-reduced-motion: reduce)`);n(e.matches);let t=e=>n(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,Q.useEffect)(r,i),t}function yE(){return typeof window<`u`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function bE(e,t){let n=(0,$.c)(9),[r,i]=(0,Q.useState)(0),[a,o]=(0,Q.useState)(!0),s,c;if(n[0]!==t||n[1]!==a?(s=()=>{if(!t)return;if(a){let e=setTimeout(()=>o(!1),fE);return()=>clearTimeout(e)}let e=setTimeout(()=>{i(xE),o(!0)},pE);return()=>clearTimeout(e)},c=[a,t],n[0]=t,n[1]=a,n[2]=s,n[3]=c):(s=n[2],c=n[3]),(0,Q.useEffect)(s,c),!t){let t=e[0]??``,r;return n[4]===t?r=n[5]:(r={text:t,visible:!0},n[4]=t,n[5]=r),r}let l=e[e.length>0?r%e.length:0]??``,u;return n[6]!==l||n[7]!==a?(u={text:l,visible:a},n[6]=l,n[7]=a,n[8]=u):u=n[8],u}function xE(e){return e+1}function SE(e){let t=(0,$.c)(2),{agentName:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(J,{id:`5PrrYw`,values:{agentName:n}}),t[0]=n,t[1]=r),r}function CE(e){let t=(0,$.c)(104),{docName:n,surface:r,folderPath:i,dismissed:a,onDismiss:o,onReopen:s}=e,l=a===void 0?!1:a,{_:u}=vt(),d=i!==void 0,p=d?null:n??null,m=r??`wysiwyg`,h=vE(),g=Ju(),{pageMeta:_}=Ns(),{states:v}=Ks(),y=Wi(),{dispatch:b}=Bs(),x=Vs(),[S]=(0,Q.useState)(FE),[C,w]=(0,Q.useState)(null),[T,E]=(0,Q.useState)(!0),[D,O]=(0,Q.useState)(!1),k=(0,Q.useRef)(null),A=(0,Q.useRef)(null),[j]=(0,Q.useState)(PE),M,N;t[0]!==l||t[1]!==n||t[2]!==d||t[3]!==r?(M=()=>{if(d||n==null)return;let e=document.documentElement,t=ME,i=()=>{r===`wysiwyg`&&requestAnimationFrame(()=>{let e=f(n),t=A.current;if(!(!e||e.isDestroyed||!t))try{let n=e.view,r=n.coordsAtPos(e.state.selection.head).bottom-(t.getBoundingClientRect().top-28);if(r<=0)return;let i=n.dom.closest(`.editor-doc-scroll`);i instanceof HTMLElement&&(i.scrollTop+=r)}catch{}})},a=A.current;if(l||!a){t(),e.style.removeProperty(`--ask-composer-height`);return}let o=()=>{t(),e.style.setProperty(`--ask-composer-height`,`${a.offsetHeight+56}px`)};o(),i();let s=new ResizeObserver(o);return s.observe(a),()=>{s.disconnect(),t(),e.style.removeProperty(`--ask-composer-height`)}},N=[l,r,n,d],t[0]=l,t[1]=n,t[2]=d,t[3]=r,t[4]=M,t[5]=N):(M=t[4],N=t[5]),(0,Q.useEffect)(M,N);let P=(0,Q.useRef)(l),F=(0,Q.useRef)(s),I;t[6]!==l||t[7]!==s?(I=()=>{P.current=l,F.current=s},t[6]=l,t[7]=s,t[8]=I):I=t[8],(0,Q.useEffect)(I);let L,R;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(L=()=>c(()=>{P.current?F.current?.():k.current?.focus()}),R=[],t[9]=L,t[10]=R):(L=t[9],R=t[10]),(0,Q.useEffect)(L,R);let z;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(z=[],t[11]=z):z=t[11],(0,Q.useEffect)(AE,z);let B=(0,Q.useRef)(l),V,H;t[12]===l?(V=t[13],H=t[14]):(V=()=>{let e=B.current;B.current=l,e&&!l&&k.current?.focus()},H=[l],t[12]=l,t[13]=V,t[14]=H),(0,Q.useEffect)(V,H);let U;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(U=[],t[15]=U):U=t[15];let[W,ee]=(0,Q.useState)(U),[G,K]=(0,Q.useState)(kE),te;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(te=[],t[16]=te):te=t[16];let[ne,re]=(0,Q.useState)(te),ie;t[17]!==n||t[18]!==d||t[19]!==_?(ie=d||n==null?``:hE(n,_.get(n)?.docExt),t[17]=n,t[18]=d,t[19]=_,t[20]=ie):ie=t[20];let ae=ie,oe,se;t[21]!==ae||t[22]!==G||t[23]!==d||t[24]!==T?(oe=()=>{d||T||ee(e=>{if(G.has(ae))return e;let t=gE(ae),n=t===null?e:e.filter(e=>e===ae||gE(e)!==t);return n.includes(ae)?n.length===e.length?e:n:[...n,ae]})},se=[d,T,ae,G],t[21]=ae,t[22]=G,t[23]=d,t[24]=T,t[25]=oe,t[26]=se):(oe=t[25],se=t[26]),(0,Q.useEffect)(oe,se);let ce=d?i&&!G.has(i)&&!ne.includes(i)?[i]:[]:W.filter(e=>!G.has(e)&&!ne.includes(e)),le=bs(p,m),ue=bs(p,`frontmatter`),[de,fe]=(0,Q.useState)(null),[pe,q]=(0,Q.useState)(!1),me,he;t[27]===le?(me=t[28],he=t[29]):(me=()=>{le&&fe(le)},he=[le],t[27]=le,t[28]=me,t[29]=he),(0,Q.useEffect)(me,he);let ge,_e;t[30]===ue?(ge=t[31],_e=t[32]):(ge=()=>{ue&&fe(ue)},_e=[ue],t[30]=ue,t[31]=ge,t[32]=_e),(0,Q.useEffect)(ge,_e);let ve=Ii(),ye=Ri(),be;t[33]===y?be=t[34]:(be=e=>qi(y,e.source,e.id,!0,e.supported),t[33]=y,t[34]=be);let xe=ye.filter(be),Se=Fi(xe,ve),Ce;t[35]===x?.installedClis?Ce=t[36]:(Ce=x?.installedClis??{},t[35]=x?.installedClis,t[36]=Ce);let we=Yc({sticky:C??S,effectiveThreadAgent:Se,enabledClis:x===null?[]:Kc(y,x.installedClis),enabledDesktopTargets:Dc(y),installedClis:Ce,terminalAvailable:x!==null,threadsAvailable:!0,desktopSelectable:!0}),Te=we.kind===`thread`,Ee=we.kind===`cli`?we.cli:null,De=Ee!==null,Oe=we.kind===`desktop`?Ki.find(e=>e.id===we.target)??null:null,ke=!D&&(!T||de!==null)&&(De||Oe!==null||Te),Ae;t[37]===y?Ae=t[38]:(Ae=Ki.filter(e=>Zi(y,e.id)),t[37]=y,t[38]=Ae);let je=Ae,Me;t[39]===v?Me=t[40]:(Me=Ki.some(e=>v[e.id]?.installed==null),t[39]=v,t[40]=Me);let Ne=Me,Pe=x===null?void 0:Kc(y,x.installedClis).map(e=>{let{displayName:t}=Da[e];return{cli:e,label:t,ariaLabel:u({id:`QYfQdv`,values:{displayName:t}}),selected:Ee===e,onSelect:()=>Ue(e)}}),Fe;t[41]===u?Fe=t[42]:(Fe=u({id:`KYSocE`}),t[41]=u,t[42]=Fe);let Ie;t[43]===u?Ie=t[44]:(Ie=u({id:`7Ongq0`}),t[43]=u,t[44]=Ie);let Le;t[45]===u?Le=t[46]:(Le=u({id:`HPTPGr`}),t[45]=u,t[46]=Le);let Re;t[47]===u?Re=t[48]:(Re=u({id:`qiRoLb`}),t[47]=u,t[48]=Re);let ze;t[49]!==Fe||t[50]!==Ie||t[51]!==Le||t[52]!==Re?(ze=[Fe,Ie,Le,Re],t[49]=Fe,t[50]=Ie,t[51]=Le,t[52]=Re,t[53]=ze):ze=t[53];let Be=bE(ze,!h&&T&&!l),Ve;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(Ve=e=>{w(e.id),Cc(e.id)},t[54]=Ve):Ve=t[54];let He=Ve,Ue=e=>{let t=Sc(e);w(t),Cc(t)},We;if(t[55]===Symbol.for(`react.memo_cache_sentinel`)){let e=()=>{w(xc),Cc(xc)};We=t=>{zi(t),e()},t[55]=We}else We=t[55];let Ge=We,Ke=()=>{k.current?.clear(),fe(null),q(!1),ee([]),K(new Set),LS()},qe=e=>{if(e===null){X.error(u({id:`y8B54M`}));return}if(Te){nc(e,Se===null?void 0:{agent:{source:Se.source,id:Se.id}}),dE(),Ke();return}if(Ee!==null&&x!==null){try{x.launchInTerminal(e,Ee)}catch{X.error(u({id:`jBVUXo`}));return}dE(),Ke();return}if(Oe!==null){if(v[Oe.id]?.installed!==!0){ec(Oe),X.info(u({id:`L1BQTH`,values:{0:Oe.displayName}})),Ke();return}O(!0),b(Oe.id,e).then(OE).finally(()=>{O(!1),Ke()})}},Je=()=>{let{instruction:e,mentions:t}=k.current?.getContent()??{instruction:``,mentions:[]};if(d)return $s({docName:null,folderRelativePath:i,workspace:g,instruction:e,mentions:[...new Set([...ce,...t])].filter(e=>e!==i)});let r=de?Yu(de):void 0,a=de?.docName??null,o=de?a:ce.includes(ae)?n??null:null,s=o===null?null:hE(o,_.get(o)?.docExt),c=[...new Set([...ce,...t])].filter(e=>e!==s);return $s({docName:o,...s===null?{}:{docRelativePath:s},workspace:g,instruction:e,mentions:c,selection:r})},Ye=()=>{ke&&qe(Je())};if(l)return null;let Xe=``,Ze=``;if(de){let e;t[56]!==_||t[57]!==de?(e=Xu(de,hE(de.docName,_.get(de.docName)?.docExt).split(`/`).pop()??``),t[56]=_,t[57]=de,t[58]=e):e=t[58],Xe=e;let n;t[59]===de.markdown?n=t[60]:(n=Zu(de.markdown),t[59]=de.markdown,t[60]=n),Ze=n}let Qe;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(Qe=e=>rl(e,k),t[61]=Qe):Qe=t[61];let $e;t[62]!==u||t[63]!==d||t[64]!==o?($e=d?null:(0,Z.jsx)(Y,{type:`button`,variant:`outline`,"aria-label":u({id:`EWX92Z`}),onClick:()=>o?.(),"data-testid":`ask-ai-collapse`,className:`-top-2.5 -translate-x-1/2 absolute left-1/2 z-10 h-5 w-10 rounded-md p-0 text-muted-foreground opacity-0 shadow-sm transition-opacity hover:text-foreground focus-visible:opacity-100 group-focus-within:opacity-100 group-hover:opacity-100`,children:(0,Z.jsx)(ks,{className:`size-3.5`,"aria-hidden":!0})}),t[62]=u,t[63]=d,t[64]=o,t[65]=$e):$e=t[65];let et;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(et=e=>K(t=>{let n=new Set(t);return n.add(e),n}),t[66]=et):et=t[66];let tt;t[67]!==u||t[68]!==Xe||t[69]!==Ze||t[70]!==de||t[71]!==pe?(tt=de?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`span`,{"data-testid":`composer-selection-pill`,title:Xe,className:`group/chip inline-flex max-w-[16rem] items-center gap-1 rounded-md border bg-muted/40 py-0.5 pr-1.5 pl-1 text-muted-foreground text-xs`,children:[(0,Z.jsxs)(Y,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":u({id:`irrm_E`}),onClick:()=>{fe(null),q(!1)},className:`group/remove relative size-3.5 shrink-0 rounded-sm text-muted-foreground/80 hover:text-foreground`,children:[(0,Z.jsx)(Bh,{className:`absolute top-1/2 left-1/2 size-3 -translate-x-1/2 -translate-y-1/2 opacity-100 transition-opacity duration-150 ease-out group-hover/chip:opacity-0 group-focus-within/chip:opacity-0 motion-reduce:transition-none`,"aria-hidden":!0}),(0,Z.jsx)(fl,{className:`absolute top-1/2 left-1/2 size-3 -translate-x-1/2 -translate-y-1/2 opacity-0 transition-opacity duration-150 ease-out group-hover/chip:opacity-100 group-focus-within/chip:opacity-100 motion-reduce:transition-none`,"aria-hidden":!0})]}),(0,Z.jsx)(Y,{type:`button`,variant:`ghost`,"aria-expanded":pe,"aria-label":u(pe?{id:`UaDyeb`}:{id:`eTL5y9`}),onClick:()=>q(DE),"data-testid":`composer-selection-peek`,className:`h-auto min-h-0 min-w-0 shrink justify-start px-0 py-0 text-left font-normal text-muted-foreground text-xs hover:bg-transparent hover:text-foreground`,children:(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:Xe})})]}),pe&&Ze!==``?(0,Z.jsx)(`p`,{className:`max-h-24 w-full basis-full overflow-y-auto whitespace-pre-wrap text-2xs text-muted-foreground/80 subtle-scrollbar`,"data-testid":`composer-selection-preview`,children:Ze}):null]}):null,t[67]=u,t[68]=Xe,t[69]=Ze,t[70]=de,t[71]=pe,t[72]=tt):tt=t[72];let nt;t[73]===u?nt=t[74]:(nt=u({id:`xWEvuo`}),t[73]=u,t[74]=nt);let rt;t[75]!==T||t[76]!==h||t[77]!==Be?(rt=T?(0,Z.jsx)(`div`,{"aria-hidden":!0,className:$t(`pointer-events-none absolute inset-0 truncate px-0 py-1 text-base text-muted-foreground/60 md:text-sm`,!h&&`transition-opacity duration-500 ease-in-out`,Be.visible?`opacity-100`:`opacity-0`),children:Be.text}):null,t[75]=T,t[76]=h,t[77]=Be,t[78]=rt):rt=t[78];let it=ZT,at=Te?(0,Z.jsx)(fs,{agentId:Se?.id??``,iconUrl:Se?.iconUrl,className:`size-4`}):Ee===null?Oe?(0,Z.jsx)(Ji,{id:Oe.id,className:`size-4`,"aria-hidden":!0}):null:(0,Z.jsx)(Ji,{id:Vi(Ee),className:`size-4`,"aria-hidden":!0}),ot=Te?Se===null?(0,Z.jsx)(J,{id:`G7bn_N`}):(0,Z.jsx)(SE,{agentName:Se.name}):Ee===null?Oe?(0,Z.jsx)(J,{id:`nUNZL4`,values:{0:Oe.displayName}}):(0,Z.jsx)(J,{id:`F-vBv0`}):(0,Z.jsx)(J,{id:`ti6aF_`,values:{0:Da[Ee].displayName}}),st;t[79]===ot?st=t[80]:(st=(0,Z.jsx)(`span`,{children:ot}),t[79]=ot,t[80]=st);let ct;t[81]===D?ct=t[82]:(ct=D?(0,Z.jsx)(Zc,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):null,t[81]=D,t[82]=ct);let lt;t[83]!==at||t[84]!==st||t[85]!==ct?(lt=(0,Z.jsxs)(Z.Fragment,{children:[at,st,ct]}),t[83]=at,t[84]=st,t[85]=ct,t[86]=lt):lt=t[86];let ut=!ke,dt=De?null:Oe?.id??null,ft=xe.map(e=>({key:`${e.source}:${e.id}`,id:e.id,name:e.name,...e.iconUrl===void 0?{}:{iconUrl:e.iconUrl},selected:Te&&Se!==null&&Se.source===e.source&&Se.id===e.id,onSelect:()=>Ge(e)})),pt;t[87]===Ne?pt=t[88]:(pt=(0,Z.jsx)(`p`,{className:`px-2 py-1.5 text-sm text-muted-foreground`,"aria-live":`polite`,children:Ne?(0,Z.jsx)(J,{id:`CPmYSG`}):(0,Z.jsx)(J,{id:`t9Qn8y`})}),t[87]=Ne,t[88]=pt);let mt;t[89]===u?mt=t[90]:(mt=u({id:`nskygk`}),t[89]=u,t[90]=mt);let ht;t[91]===Symbol.for(`react.memo_cache_sentinel`)?(ht={primary:`ask-ai-send`,trigger:`ask-ai-agent-trigger`,menu:`ask-ai-agent-menu`,option:EE,threadAgent:TE,settings:`ask-ai-agent-option-settings`,terminal:wE},t[91]=ht):ht=t[91];let gt;t[92]!==it||t[93]!==Pe||t[94]!==je||t[95]!==He||t[96]!==Ye||t[97]!==lt||t[98]!==ut||t[99]!==dt||t[100]!==ft||t[101]!==pt||t[102]!==mt?(gt=(0,Z.jsx)(it,{primary:lt,onPrimary:Ye,primaryDisabled:ut,installedTargets:je,selectedTargetId:dt,onSelectTarget:He,threadAgents:ft,onOpenSettings:ea,terminals:Pe,menuEmptyState:pt,triggerAriaLabel:mt,testIds:ht}),t[92]=it,t[93]=Pe,t[94]=je,t[95]=He,t[96]=Ye,t[97]=lt,t[98]=ut,t[99]=dt,t[100]=ft,t[101]=pt,t[102]=mt,t[103]=gt):gt=t[103];let _t=(0,Z.jsxs)(`div`,{ref:A,onMouseDown:Qe,className:`pointer-events-auto group relative flex cursor-text flex-col gap-1.5 rounded-2xl border border-border/60 bg-card px-3 py-2 shadow-sm transition-colors focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50`,children:[$e,(0,Z.jsx)(XT,{files:ce,onRemoveFile:et,children:tt}),(0,Z.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,Z.jsxs)(`div`,{className:`relative flex-1`,children:[(0,Z.jsx)(iC,{ref:k,ariaLabel:nt,onEmptyChange:E,onContentChange:IS,onMentionsChange:re,onSubmit:Ye,initialDoc:j,className:`max-h-[200px] overflow-y-auto text-base md:text-sm`}),rt]}),gt]})]});return d?(0,Z.jsx)(`div`,{className:`shrink-0 pt-2 pb-3`,"data-testid":`bottom-composer`,children:(0,Z.jsx)(`div`,{className:`mx-auto w-full max-w-4xl px-6`,children:_t})}):(0,Z.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-[var(--conflict-footer-height,0px)] z-20 editor-content-aligned bg-gradient-to-t from-background from-65% via-background to-transparent pt-10 pb-2`,"data-testid":`bottom-composer`,children:_t})}function wE(e){return e===`claude`?`ask-ai-agent-option-terminal`:`ask-ai-agent-option-terminal-${e}`}function TE(e){return`ask-ai-agent-option-thread-${e}`}function EE(e){return`ask-ai-agent-option-${e}`}function DE(e){return!e}function OE(e){e.ok&&dE()}function kE(){return new Set}function AE(){let e=jE;return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})}function jE(e){Sl(e,`open-ask-ai`)&&(_E(e.target)||(e.preventDefault(),ht()))}function ME(){let e=[...document.querySelectorAll(`.editor-doc-scroll`)].filter(NE);if(e.length===0)return;let t=!1,n=()=>{t=!0};window.addEventListener(`wheel`,n,{passive:!0}),window.addEventListener(`touchstart`,n,{passive:!0});let r=performance.now(),i=()=>{if(t||performance.now()-r>=300){window.removeEventListener(`wheel`,n),window.removeEventListener(`touchstart`,n);return}for(let t of e)t.scrollTop=t.scrollHeight-t.clientHeight;requestAnimationFrame(i)};requestAnimationFrame(i)}function NE(e){let t=e.scrollHeight-e.clientHeight;return t>0&&e.scrollTop>=t-40}function PE(){return FS().doc??void 0}function FE(){return qc()}function IE(e){return!e.terminalVisible&&!e.isEmbedded&&e.activeDocName!==null}function LE(e){return!e.terminalVisible&&!e.isEmbedded}function RE(e,t={}){let n=H(e.componentName);return n.name===`*`?t.unregisteredSuffix?`${e.componentName} (unregistered)`:e.componentName:n.displayName??n.name}var zE=200,BE=`Outside any block`;function VE(e){let t=(0,$.c)(5),{editor:n}=e,r=ft(n),i=(0,Q.useRef)(null),a=(0,Q.useRef)(null),o=(0,Q.useRef)(!1),s,c;t[0]!==r||t[1]!==n?(s=()=>{if(a.current!==null&&(window.clearTimeout(a.current),a.current=null),!n||!i.current)return;let e=r!==null&&r.ancestorChain.length>0,t;return t=e?HE(n,r):o.current?BE:``,a.current=window.setTimeout(()=>{i.current&&(i.current.textContent=``,i.current.textContent=t),o.current=e,a.current=null},zE),()=>{a.current!==null&&(window.clearTimeout(a.current),a.current=null)}},c=[n,r],t[0]=r,t[1]=n,t[2]=s,t[3]=c):(s=t[2],c=t[3]),(0,Q.useEffect)(s,c);let l;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(`div`,{ref:i,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`sr-only`}),t[4]=l):l=t[4],l}function HE(e,t){if(!t||t.ancestorChain.length===0)return``;let n=t.ancestorChain,r=n[n.length-1],i=RE(r,{unregisteredSuffix:!0});if(n.length===1)return`Selected: ${i}`;let a=n[n.length-2],o=RE(a);try{let t=e.state.doc.resolve(r.pos),n=t.index(t.depth),a=t.parent.childCount;return`Selected: ${i}, ${n+1} of ${a} in ${o}`}catch{return`Selected: ${i} in ${o}`}}var UE=!1;function WE(e,t,n,r){let i=e[t];if(typeof i!=`function`){console.warn(`[cold-mount-instrumentation] target missing method "${t}"`);return}e[t]=function(...e){let t=performance.now(),a,o=!1;try{return a=i.apply(this,e),o=!0,a}finally{let e=performance.now()-t,i;if(o&&r)try{i=r(this,a,t,e)}catch(e){i={"instrumentation-error":e instanceof Error?e.message:String(e)}}try{Zl(n,{durationMs:Math.round(e*1e3)/1e3,threw:!o,...i},{startTime:t,duration:e})}catch{}}}}function GE(e){return e?.doc?typeof e.doc.nodeSize==`number`?e.doc.nodeSize:e.doc.content&&typeof e.doc.content.size==`number`?e.doc.content.size:null:null}var KE=0,qE=0,JE=0,YE=0,XE=null,ZE=[`linkResolutionDecoration$`],QE=new WeakSet,$E=new WeakSet;function eD(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase()}function tD(){return!1}function nD(){return!tD()}function rD(e,t){if(nD())return t;let n=`ok/cold/nodeview-factory-${eD(e)}`;return function(...r){let i=performance.now();try{return t(...r)}finally{let t=performance.now()-i;Zl(n,{nodeType:e,durationMs:Math.round(t*1e3)/1e3},{startTime:i,duration:t})}}}function iD(e){if(nD())return;let t=e.state.plugins;for(let e of t){if($E.has(e))continue;let t=e.spec?.key?.key;if(!t||!ZE.some(e=>t.startsWith(e)))continue;let n=e.props,r=n.decorations;if(typeof r!=`function`){$E.add(e);continue}let i=`ok/cold/decoration-${eD(t.replace(/\$\d*$/,``))}`;n.decorations=function(...e){let n=performance.now();try{return r.apply(this,e)}finally{let e=performance.now()-n;Zl(i,{pluginKey:t,durationMs:Math.round(e*1e3)/1e3},{startTime:n,duration:e})}},$E.add(e)}}function aD(e){if(nD())return;let t=e._props?.nodeViews;if(!(!t||typeof t!=`object`))for(let[e,n]of Object.entries(t)){if(typeof n!=`function`||n.__okWrapped===!0)continue;let r=rD(e,n);r.__okWrapped=!0,t[e]=r}}function oD(e){return nD()?e:e.map(e=>{let t=e.name??`unknown`,n=eD(t);return e.extend({onBeforeCreate(){let e=performance.now();try{this.parent?.()}finally{let r=performance.now()-e;Zl(`ok/cold/ext-${n}-on-before-create`,{ext:t,hook:`onBeforeCreate`,durationMs:Math.round(r*1e3)/1e3},{startTime:e,duration:r})}},onCreate(){let e=performance.now();try{this.parent?.()}finally{let r=performance.now()-e;Zl(`ok/cold/ext-${n}-on-create`,{ext:t,hook:`onCreate`,durationMs:Math.round(r*1e3)/1e3},{startTime:e,duration:r})}},onUpdate(){let e=performance.now();try{this.parent?.()}finally{let r=performance.now()-e;Zl(`ok/cold/ext-${n}-on-update`,{ext:t,hook:`onUpdate`,durationMs:Math.round(r*1e3)/1e3},{startTime:e,duration:r})}},onDestroy(){let e=performance.now();try{this.parent?.()}finally{let r=performance.now()-e;Zl(`ok/cold/ext-${n}-on-destroy`,{ext:t,hook:`onDestroy`,durationMs:Math.round(r*1e3)/1e3},{startTime:e,duration:r})}}})})}function sD(){if(!UE){UE=!0,WE(Eo.prototype,`mount`,`ok/cold/editor-mount`,(e,t,n,r)=>{let i=e;return nD()||(XE=performance.now()),{elementDefault:i.options?.element?.nodeName??null,docSize:GE(i.editorState),durationMs:r}}),WE(Eo.prototype,`createView`,`ok/cold/editor-create-view`,e=>{let t=e;return!nD()&&!QE.has(e)&&t.view&&(iD(t.view),aD(t.view),QE.add(e)),{docSize:GE(t.editorState)}}),WE(Eo.prototype,`createNodeViews`,`ok/cold/create-node-views`,(e,t,n,r)=>{YE+=1;let i=e;return!nD()&&i.view&&aD(i.view),{docSize:GE(i.view),seq:YE,durationMs:r}}),WE(xa.prototype,`updateState`,`ok/cold/pm-update-state`,(e,t,n,r)=>(qE+=1,{seq:qE,docSize:GE(e.state),durationMs:r})),WE(xa.prototype,`setProps`,`ok/cold/pm-set-props`,(e,t,n,r)=>(JE+=1,{seq:JE,docSize:GE(e.state),durationMs:r})),WE(u.prototype,`_forceRerender`,`ok/cold/force-rerender`,(e,t,n,r)=>{KE+=1;let i=e,a=(()=>{try{return i.type?.toArray?i.type.toArray().length:null}catch{return null}})();return{seq:KE,topLevelYElements:a,durationMs:r}}),WE(Xn.prototype,`init`,`ok/cold/ec-init`,e=>({editorPresent:!!e.props?.editor}));try{typeof PerformanceObserver<`u`&&new PerformanceObserver(e=>{for(let t of e.getEntries()){let e=t.name;if((e===`first-paint`||e===`first-contentful-paint`)&&(Zl(e===`first-paint`?`ok/cold/paint-fp`:`ok/cold/paint-fcp`,{entryType:t.entryType,startTime:Math.round(t.startTime*1e3)/1e3},{startTime:t.startTime,duration:0}),!nD()&&e===`first-paint`&&XE!==null)){let e=XE,n=Math.max(0,t.startTime-e);Zl(`ok/cold/append-to-paint`,{paintEntryType:t.entryType,durationMs:Math.round(n*1e3)/1e3,paintAt:Math.round(t.startTime*1e3)/1e3},{startTime:e,duration:n}),XE=null}}}).observe({type:`paint`,buffered:!0})}catch{}globalThis.__okColdMountInstrumented=!0}}function cD(){let[e]=(0,Q.useState)(qa);return e}function lD({principal:e,identity:t}){return e&&e.source===`git-config`?{type:`human`,name:Jo(e.display_name),color:po(e.id,Ya),coeditor:t.coeditor,tabId:t.tabId,principalId:e.id}:e&&e.source===`synthesized`?{type:`human`,name:t.name,color:po(e.id,Ya),coeditor:t.coeditor,tabId:t.tabId}:{type:`human`,name:t.name,color:t.color,coeditor:t.coeditor,tabId:t.tabId}}function uD(e,t){return e>t}function dD(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.isChangeOrigin===!0?!0:`snapshot`in t&&`prevSnapshot`in t&&t.snapshot===null&&t.prevSnapshot===null}var fD=3,pD=6e4;function mD(e,t){let n=0;for(let r of e)t-r<pD&&(n+=1);return n<fD}var hD=new Map;function gD(e,t){for(let n of e.changed.keys()){let e=n;for(;e!=null;){if(e===t)return!0;let n=e._item;e=n==null?null:n.parent}}return!1}function _D(e){let t=p.getState(e);return t?.snapshot!=null||t?.prevSnapshot!=null}function vD(e){let{fragment:t,docName:n,onWedged:r}=e,i=0,a=0,o=!1,s=!1,c=!1,l=null,u=new WeakSet,d=e=>{let t=p.getState(e)?.binding;if(!t)return;if(typeof t._prosemirrorChanged!=`function`){Zl.count(`ok/editor/binding-guard-disarmed`,{docName:n,reason:`no-prosemirror-changed`}),console.warn(`[binding-staleness-guard] ySync binding on "${n}" exposes no _prosemirrorChanged — write-back gate disarmed (vendored y-tiptap contract change?)`);return}if(u.has(t))return;u.add(t);let r=t._prosemirrorChanged.bind(t);t._prosemirrorChanged=e=>{uD(i,a)||r(e)}},f=()=>{if(c=!1,!s||o||!uD(i,a)||l!==null&&_D(l.state))return;o=!0;let e=Date.now();for(let[t,n]of hD)n.every(t=>e-t>=pD)&&hD.delete(t);let t=(hD.get(n)??[]).filter(t=>e-t<pD);if(!mD(t,e)){hD.set(n,t),Zl.count(`ok/editor/binding-wedge-rate-capped`,{docName:n}),console.warn(`[binding-staleness-guard] wedge on "${n}" rate-capped (externalSeq=${i}, appliedSeq=${a}) — publication gate stays closed, no further recycle`);return}t.push(e),hD.set(n,t),console.warn(`[binding-staleness-guard] wedged binding on "${n}" — Y→PM apply missing (externalSeq=${i}, appliedSeq=${a})`);try{r({externalSeq:i,appliedSeq:a})}catch(e){o=!1,Zl.count(`ok/editor/binding-wedge-recovery-error`,{docName:n}),console.error(`[binding-staleness-guard] wedge recovery threw for "${n}":`,e)}},m=e=>{e.origin!==p&&gD(e,t)&&(i+=1,c||(c=!0,queueMicrotask(f)))};return new _a({state:{init:()=>null,apply:e=>(dD(e.getMeta(p))&&(a=i,o&&Zl.count(`ok/editor/binding-wedge-recovered`,{docName:n}),o=!1),null)},filterTransaction:(e,t)=>!uD(i,a)||_D(t)?!0:e.getMeta(p)!==void 0,view:e=>{let r=t.doc;return r==null?(Zl.count(`ok/editor/binding-guard-disarmed`,{docName:n,reason:`no-ydoc`}),console.error(`[binding-staleness-guard] fragment has no Y.Doc for "${n}" — staleness guard disarmed`),{}):(s=!0,l=e,d(e.state),r.off(`beforeObserverCalls`,m),r.on(`beforeObserverCalls`,m),{destroy:()=>{s=!1,l=null,r.off(`beforeObserverCalls`,m)}})}})}function yD(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 bD=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&&Ia(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(rr(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(fr(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(or(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(dr(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(ir(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(sr(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(cr(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(ur(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=wa(this.view,e.from,e.to),r={getBoundingClientRect:()=>n,getClientRects:()=>[n]};if(e instanceof $a){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 wo){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():yD(o.getBoundingClientRect(),s.getBoundingClientRect());r={getBoundingClientRect:()=>c,getClientRects:()=>[c]}}return r}updatePosition(){if(!this.isVisible)return;let e=this.virtualElement;e&&ar(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()}},xD=e=>new _a({key:typeof e.pluginKey==`string`?new Ea(e.pluginKey):e.pluginKey,view:t=>new bD({view:t,...e})});vo.create({name:`bubbleMenu`,addOptions(){return{element:null,pluginKey:`bubbleMenu`,updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[xD({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 SD=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 Co(e,{textSerializers:oa(this.editor.schema)})}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(rr(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(fr(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(or(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(dr(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(ir(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(sr(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(cr(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(ur(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=wa(this.view,e.from,e.to);ar({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()}},CD=e=>new _a({key:typeof e.pluginKey==`string`?new Ea(e.pluginKey):e.pluginKey,view:t=>new SD({view:t,...e})});vo.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?[CD({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 wD(e,t){return e??new Ea(t)}var TD=typeof window<`u`?Q.useLayoutEffect:Q.useEffect,ED=new Set([`left`,`opacity`,`position`,`top`,`visibility`,`width`]),DD=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(`.`)),OD=new Set([`children`,`className`,`style`]),kD=new Set([`tabIndex`]),AD=new Set([`accessKey`,`autoCapitalize`,`contentEditable`,`contextMenu`,`dir`,`draggable`,`enterKeyHint`,`hidden`,`id`,`lang`,`nonce`,`role`,`slot`,`spellCheck`,`tabIndex`,`title`,`translate`]),jD={Blur:`focusout`,DoubleClick:`dblclick`,Focus:`focusin`,MouseEnter:`mouseenter`,MouseLeave:`mouseleave`};function MD(e,t){return/^on[A-Z]/.test(e)&&typeof t==`function`}function ND(e){return e.startsWith(`aria-`)||e.startsWith(`data-`),e}function PD(e){return e.startsWith(`aria-`)||e.startsWith(`data-`)||AD.has(e)}function FD(e){return e.startsWith(`--`)?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function ID(e){let t=e.endsWith(`Capture`),n=(t?e.slice(0,-7):e).slice(2);return{eventName:jD[n]??n.toLowerCase(),options:t?{capture:!0}:void 0}}function LD(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 RD(e){return kD.has(e)}function zD(e,t,n){if(t===`tabIndex`){e.tabIndex=Number(n);return}e[t]=n}function BD(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 VD(e,t){return typeof t!=`number`||t===0||e.startsWith(`--`)||DD.has(e)?String(t):`${t}px`}function HD(e,t){ED.has(t)||e.style.removeProperty(FD(t))}function UD(e,t,n){ED.has(t)||e.style.setProperty(FD(t),VD(t,n))}function WD(e,t,n){new Set([...Object.keys(t),...Object.keys(n)]).forEach(r=>{if(OD.has(r)||!PD(r)||MD(r,t[r])||MD(r,n[r]))return;let i=t[r],a=n[r];if(i===a)return;let o=ND(r);if(a==null||a===!1){RD(r)&&BD(e,r),e.removeAttribute(o);return}if(a===!0){RD(r)&&zD(e,r,!0),e.setAttribute(o,``);return}if(RD(r)){zD(e,r,a);return}e.setAttribute(o,String(a))})}function GD(e,t,n){if(t!==n){if(n){e.className=n;return}e.removeAttribute(`class`)}}function KD(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){HD(e,t);return}UD(e,t,a)}})}function qD(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(!MD(t,n))return;let{eventName:i,options:a}=ID(t),o=t=>{n(LD(e,t))};e.addEventListener(i,o,a),r.push({eventName:i,listener:o,options:a})}),r}function JD(e,t){let n=(0,Q.useRef)({}),r=(0,Q.useRef)([]);TD(()=>{let i=n.current;return GD(e,i.className,t.className),KD(e,i.style,t.style),WD(e,i,t),r.current=qD(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 YD=Q.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:r,appendTo:i,shouldShow:a=null,getReferencedVirtualElement:o,options:s,children:c,...l},u)=>{let d=(0,Q.useRef)(document.createElement(`div`)),f=(0,Q.useRef)(wD(e,`bubbleMenu`)).current;JD(d.current,l),typeof u==`function`?u(d.current):u&&(u.current=d.current);let{editor:p}=Jn(),m=t||p,h={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:f,shouldShow:a,getReferencedVirtualElement:o,options:s},g=(0,Q.useRef)(h);g.current=h;let[_,v]=(0,Q.useState)(!1),y=(0,Q.useRef)(!0);return(0,Q.useEffect)(()=>{if(m?.isDestroyed)return;if(!m){console.warn(`BubbleMenu component is not rendered inside of an editor component or does not have editor prop.`);return}let e=d.current;e.style.visibility=`hidden`,e.style.position=`absolute`;let t=xD({...g.current,editor:m,element:e});m.registerPlugin(t);let n=g.current.pluginKey;return y.current=!0,v(!0),()=>{v(!1),m.unregisterPlugin(n),window.requestAnimationFrame(()=>{e.parentNode&&e.parentNode.removeChild(e)})}},[m]),(0,Q.useEffect)(()=>{if(!(!_||!m||m.isDestroyed)){if(y.current){y.current=!1;return}m.view.dispatch(m.state.tr.setMeta(f,{type:`updateOptions`,options:g.current}))}},[_,m,n,r,a,s,i,o,f]),(0,Sw.createPortal)(c,d.current)});Q.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:r,appendTo:i,shouldShow:a=null,options:o,children:s,...c},l)=>{let u=(0,Q.useRef)(document.createElement(`div`)),d=(0,Q.useRef)(wD(e,`floatingMenu`)).current;JD(u.current,c),typeof l==`function`?l(u.current):l&&(l.current=u.current);let{editor:f}=Jn(),p=t||f,m={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:d,shouldShow:a,options:o},h=(0,Q.useRef)(m);h.current=m;let[g,_]=(0,Q.useState)(!1),v=(0,Q.useRef)(!0);return(0,Q.useEffect)(()=>{if(p?.isDestroyed)return;if(!p){console.warn(`FloatingMenu component is not rendered inside of an editor component or does not have editor prop.`);return}let e=u.current;e.style.visibility=`hidden`,e.style.position=`absolute`;let t=CD({...h.current,editor:p,element:e});p.registerPlugin(t);let n=h.current.pluginKey;return v.current=!0,_(!0),()=>{_(!1),p.unregisterPlugin(n),window.requestAnimationFrame(()=>{e.parentNode&&e.parentNode.removeChild(e)})}},[p]),(0,Q.useEffect)(()=>{if(!(!g||!p||p.isDestroyed)){if(v.current){v.current=!1;return}p.view.dispatch(p.state.tr.setMeta(d,{type:`updateOptions`,options:h.current}))}},[g,p,n,r,a,o,i,d]),(0,Sw.createPortal)(s,u.current)});var XD=[{name:`paragraph`,label:`Text`,icon:yh,isActive:e=>e.isActive(`paragraph`)&&!e.isActive(`list`),command:e=>e.chain().focus().setParagraph().run()},{name:`heading1`,label:`Heading 1`,icon:me,isActive:e=>e.isActive(`heading`,{level:1}),command:e=>e.chain().focus().toggleHeading({level:1}).run()},{name:`heading2`,label:`Heading 2`,icon:at,isActive:e=>e.isActive(`heading`,{level:2}),command:e=>e.chain().focus().toggleHeading({level:2}).run()},{name:`heading3`,label:`Heading 3`,icon:Ne,isActive:e=>e.isActive(`heading`,{level:3}),command:e=>e.chain().focus().toggleHeading({level:3}).run()},{name:`bulletList`,label:`Bullet List`,icon:Xe,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:se,isActive:e=>e.isActive(`list`,{ordered:!0}),command:e=>e.chain().focus().toggleOrderedList().run()},{name:`taskList`,label:`Task List`,icon:Ee,isActive:e=>e.isActive(`listItem`,{checked:!0})||e.isActive(`listItem`,{checked:!1}),command:e=>e.chain().focus().toggleTaskList().run()},{name:`blockquote`,label:`Quote`,icon:nt,isActive:e=>e.isActive(`blockquote`),command:e=>e.chain().focus().toggleBlockquote().run()},{name:`codeBlock`,label:`Code Block`,icon:Ah,isActive:e=>e.isActive(`codeBlock`),command:e=>e.chain().focus().toggleCodeBlock({language:`js`}).run()}];function ZD(e){let t=(0,$.c)(18),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:QD},t[0]=n,t[1]=r);let{current:i,activeStates:a}=Bn(r),o=i.icon,s;t[2]===o?s=t[3]:(s=(0,Z.jsx)(o,{className:`size-3.5`}),t[2]=o,t[3]=s);let c;t[4]===i.label?c=t[5]:(c=(0,Z.jsx)(`span`,{children:i.label}),t[4]=i.label,t[5]=c);let l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(ks,{className:`size-3 opacity-50`}),t[6]=l):l=t[6];let u;t[7]!==s||t[8]!==c?(u=(0,Z.jsx)(Pr,{asChild:!0,children:(0,Z.jsxs)(Y,{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=XD.map(e=>{let t=e.icon,r=a[e.name];return(0,Z.jsxs)(Ar,{className:r?`bg-accent text-accent-foreground`:``,onSelect:()=>{e.command(n)},children:[(0,Z.jsx)(t,{className:`size-4`}),(0,Z.jsx)(`span`,{children:e.label})]},e.name)}),t[10]=a,t[11]=n,t[12]=d):d=t[12];let f;t[13]===d?f=t[14]:(f=(0,Z.jsx)(Rr,{align:`start`,sideOffset:8,className:`w-44 max-h-(--radix-dropdown-menu-content-available-height) overflow-y-auto subtle-scrollbar`,children:d}),t[13]=d,t[14]=f);let p;return t[15]!==u||t[16]!==f?(p=(0,Z.jsxs)(Br,{children:[u,f]}),t[15]=u,t[16]=f,t[17]=p):p=t[17],p}function QD(e){let t=Object.fromEntries(XD.map(t=>[t.name,t.isActive(e.editor)]));return{current:XD.find(e=>t[e.name])??XD[0],activeStates:t}}var $D=`0 2px 4px rgba(0, 0, 0, 0.08)`,eO=150,tO=globalThis.ScrollTimeline;function nO(e,t,n,r,i){let a=r-i;if(a<=0)return null;let o=e+n-(t+56);return{startOffset:o,endOffset:o+a,maxShift:a}}var rO=new WeakMap;function iO(e){let t=rO.get(e);if(t){for(let e of t.animations)e.cancel();rO.delete(e)}}function aO(e){for(let t of Array.from(e.cells))iO(t)}var oO=e=>e.cellIndex===0?`3`:`2`;function sO(e,t){return cO(e,t,e=>({transform:`translateY(${e}px)`}))}function cO(e,t,n){if(!(t>0))return[{offset:0,...n(0)},{offset:1,...n(0)}];let r=t=>Math.max(0,Math.min(t-e.startOffset,e.maxShift));return Array.from(new Set([0,e.startOffset/t,e.endOffset/t,1].map(e=>Math.max(0,Math.min(e,1))))).sort((e,t)=>e-t).map(e=>({offset:e,...n(r(e*t))}))}function lO(e,t,n,r){if(!(t>0))return[{...n,offset:0},{...n,offset:1}];let i=e.startOffset/t;if(i<=0)return[{...r,offset:0},{...r,offset:1}];if(i>=1)return[{...n,offset:0},{...n,offset:1}];let a=Math.min(i+1/t,1);return[{...n,offset:0},{...n,offset:i},{...r,offset:a},{...r,offset:1}]}function uO(e,t,n){return lO(e,t,{zIndex:`auto`,boxShadow:`none`},{zIndex:n,boxShadow:$D})}function dO(e,t){return lO(e,t,{opacity:`0`},{opacity:`1`})}function fO(e,t,n,r){let i=oO(e),a=`sd|${n.startOffset}|${n.maxShift}|${r}|${i}`,o=rO.get(e);if(o?.key===a)return;if(o)for(let e of o.animations)e.cancel();let s={timeline:t,fill:`both`,easing:`linear`},c=e.animate(sO(n,r),s),l=e.animate(uO(n,r,i),s),u=e.animate(dO(n,r),{...s,pseudoElement:`::before`});rO.set(e,{key:a,animations:[c,l,u]})}function pO(e,t){let n=oO(e),r=`in|${t}|${n}`,i=rO.get(e);if(i?.key===r)return;if(i)for(let e of i.animations)e.cancel();let a=e.animate([{transform:`translateY(${t}px)`,zIndex:n,boxShadow:$D}],{duration:0,fill:`forwards`}),o=e.animate([{opacity:`1`}],{duration:0,fill:`forwards`,pseudoElement:`::before`});rO.set(e,{key:r,animations:[a,o]})}function mO(e,t,n,r){let i=e.getBoundingClientRect().top,a=e.scrollTop,o=e.scrollHeight-e.clientHeight,s=t.querySelectorAll(`.tableWrapper`);for(let e of s){r?.(e);let t=e.querySelector(`table`);if(!t)continue;let s=t.querySelector(`tbody`)?.rows[0];if(!s||!Array.from(s.cells).some(e=>e.tagName===`TH`))continue;let c=t.getBoundingClientRect(),l=s.getBoundingClientRect(),u=nO(a,i,c.top,c.height,l.height);if(!u){aO(s);continue}if(n){if(o<=0){aO(s);continue}for(let e of Array.from(s.cells))fO(e,n,u,o);continue}let d=Math.max(0,Math.min(a-u.startOffset,u.maxShift));if(d<=0||c.bottom<=i+56){aO(s);continue}for(let e of Array.from(s.cells))pO(e,d)}}var hO=vo.create({name:`frozenTableHeaders`,addProseMirrorPlugins(){return[new _a({key:new Ea(`frozenTableHeaders`),view(e){let t=null,n=null,r=null,i=null,a=null,o=!1,s=new Set,c=()=>{o||!t||mO(t,e.dom,n,u)},l=()=>{r??=requestAnimationFrame(()=>{r=null,c()})};function u(e){s.has(e)||(s.add(e),e.addEventListener(`contentvisibilityautostatechange`,l))}let d=()=>{if(n){i??l(),i!=null&&clearTimeout(i),i=setTimeout(()=>{i=null,c()},eO);return}l()};return requestAnimationFrame(()=>{if(!o){if(t=e.dom.closest(`[data-testid="editor-scroll-container"]`),t&&tO)try{n=new tO({source:t,axis:`block`})}catch{n=null}t?.addEventListener(`scroll`,d,{passive:!0}),t&&typeof ResizeObserver<`u`&&(a=new ResizeObserver(l),a.observe(t),a.observe(e.dom)),c()}}),{update(e,t){t.doc.eq(e.state.doc)||c()},destroy(){o=!0,t?.removeEventListener(`scroll`,d),a?.disconnect(),r!=null&&cancelAnimationFrame(r),i!=null&&clearTimeout(i);for(let e of s)e.removeEventListener(`contentvisibilityautostatechange`,l);s.clear();for(let t of e.dom.querySelectorAll(`.tableWrapper > table > tbody > tr:first-child`))aO(t)}}}})]}});function gO(e){return()=>{let t=null;try{t=e.view.dom.closest(`.editor-doc-scroll`)}catch{}let n={top:56,bottom:_O(`--ask-composer-height`)+_O(`--conflict-footer-height`)};return t?{boundary:t,padding:n}:{padding:n}}}function _O(e){let t=Number.parseFloat(document.documentElement.style.getPropertyValue(e));return Number.isFinite(t)?t:0}function vO(e){let t=e.state.selection.node;if(!t||t.type.name!==`jsxComponent`)return null;let n=t.attrs.componentName;if(n!==`File`&&n!==`WikiEmbedFile`)return null;let r=(t.attrs.props??{}).src;return typeof r!=`string`||r.length===0?null:r}function yO(e){let t=e.state.selection.node;if(!t)return``;let n=t.attrs.props??{},r=typeof n.alias==`string`?n.alias:``;if(r.length>0)return r;let i=typeof n.name==`string`?n.name:``;return i.length>0?i:W(typeof n.src==`string`?n.src:``)}function bO(e,t){let n=document.createElement(`a`);n.href=e,n.download=t,n.rel=`noopener noreferrer`,n.style.display=`none`,document.body.appendChild(n),n.click(),n.remove()}function xO(e){let t=(0,$.c)(13),{editor:n}=e,{_:r}=vt(),i;if(t[0]===n?i=t[1]:(i={editor:n,selector:SO},t[0]=n,t[1]=i),Bn(i)===null)return null;let a;t[2]===r?a=t[3]:(a=r({id:`WcWS__`}),t[2]=r,t[3]=a);let o;t[4]===n?o=t[5]:(o=e=>{e.preventDefault();let t=vO(n);t&&bO(t,yO(n))},t[4]=n,t[5]=o);let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(mc,{className:`size-3.5`}),t[6]=s):s=t[6];let c;t[7]!==a||t[8]!==o?(c=(0,Z.jsx)(ln,{asChild:!0,children:(0,Z.jsx)(Y,{variant:`ghost`,size:`icon-xs`,"aria-label":a,className:`text-accent-foreground`,onMouseDown:o,children:s})}),t[7]=a,t[8]=o,t[9]=c):c=t[9];let l;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(un,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(J,{id:`WcWS__`})}),t[10]=l):l=t[10];let u;return t[11]===c?u=t[12]:(u=(0,Z.jsx)(`div`,{className:`flex items-center gap-0.5`,children:(0,Z.jsxs)(fn,{children:[c,l]})}),t[11]=c,t[12]=u),u}function SO(e){return vO(e.editor)}function CO(e){return vO(e)!==null}var wO=`img, .ok-embed, .ok-video`,TO=220,EO=`cubic-bezier(0.23, 1, 0.32, 1)`,DO=`ok-image-align-flip`,OO=.5;function kO(){return typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function AO(){return typeof requestAnimationFrame==`function`}function jO(e){return e?e.querySelector(wO):null}function MO(e,t){if(kO()||!AO()){t();return}let n=jO(e);if(!n){t();return}let r=n.getBoundingClientRect().left;t(),requestAnimationFrame(()=>{let t=jO(e);if(!t)return;for(let e of t.getAnimations())e.id===DO&&e.cancel();let n=r-t.getBoundingClientRect().left;if(Math.abs(n)<OO)return;let i=t.animate([{transform:`translateX(${n}px)`},{transform:`translateX(0)`}],{duration:TO,easing:EO,fill:`none`});i.id=DO})}var NO=[{value:`left`,label:`Align left`,icon:zh},{value:`center`,label:`Align center`,icon:Lh},{value:`right`,label:`Align right`,icon:Rh}];function PO(e){let t=e.state.selection.node;if(!t||t.type.name!==`jsxComponent`)return null;let n=t.attrs.componentName;if(!ot.has(String(n)))return null;let r=(t.attrs.props??{}).align;return r===`left`||r===`right`||r===`center`?r:`center`}function FO(e){let t=(0,$.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:IO},t[0]=n,t[1]=r);let i=Bn(r);if(i===null)return null;let a;t[2]!==i||t[3]!==n?(a=NO.map(e=>{let{value:t,label:r,icon:a}=e,o=i===t;return(0,Z.jsxs)(fn,{children:[(0,Z.jsx)(ln,{asChild:!0,children:(0,Z.jsx)(Y,{variant:`ghost`,size:`icon-xs`,"aria-label":r,"aria-pressed":o,className:o?`bg-accent text-primary`:`text-accent-foreground`,onMouseDown:e=>{e.preventDefault();let r=n.state.selection,i=r.node;if(!i||i.type.name!==`jsxComponent`)return;let a=String(i.attrs.componentName??``);if(!ot.has(a)||i.attrs.kind!==`element`)return;let o=a===`CommonMarkImage`,s=r.from,c={...i.attrs.props??{},align:t},l=o?{...i.attrs,componentName:`img`,props:c,sourceDirty:!0}:{...i.attrs,props:c,sourceDirty:!0},u=n.state.tr.setNodeMarkup(s,null,l);u.setSelection($a.create(u.doc,s)),MO(n.view.nodeDOM(s),()=>{n.view.dispatch(u)})},children:(0,Z.jsx)(a,{className:`size-3.5`})})}),(0,Z.jsx)(un,{side:`bottom`,sideOffset:8,children:r})]},t)}),t[2]=i,t[3]=n,t[4]=a):a=t[4];let o;return t[5]===a?o=t[6]:(o=(0,Z.jsx)(`div`,{className:`flex items-center gap-0.5`,children:a}),t[5]=a,t[6]=o),o}function IO(e){return PO(e.editor)}function LO(e){return PO(e)!==null}function RO({editor:e}){if(G(e.state).query||e.isActive(`codeBlock`))return!1;if(LO(e)||CO(e))return!0;if(e.state.selection.empty)return!1;let{from:t,to:n}=e.state.selection;return!!e.state.doc.textBetween(t,n,` `).trim()}function zO(e){throw Error(`Unhandled AddLinkShortcutAction variant: ${JSON.stringify(e)}`)}function BO(e){let{selection:t}=e.state;if(t.empty){if(!e.isActive(`link`))return null;let n=qe(e.state,t.from,`link`);return n===null?null:{kind:`edit-link`,markId:n}}return!RO({editor:e})||LO(e)||CO(e)?null:{kind:`open-popover`}}function VO(e,t){return Uo({relativePath:dc(e),instruction:``,selectionMarkdown:t,target:`claude-code`})}function HO(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName.toUpperCase();return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`}function UO(e){let t=(0,$.c)(3),{editor:n,shortcutEnabled:r}=e,i=r===void 0?!1:r;if(lc())return null;let a;return t[0]!==n||t[1]!==i?(a=(0,Z.jsx)(WO,{editor:n,shortcutEnabled:i}),t[0]=n,t[1]=i,t[2]=a):a=t[2],a}function WO(e){let t=(0,$.c)(11),{editor:n,shortcutEnabled:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=ja(),t[0]=i):i=t[0];let a=i,s,c;t[1]===r?(s=t[2],c=t[3]):(s=()=>{if(!a)return;let e=e=>{r&&Sl(e,`edit-with-ai`)&&(HO(e.target)||(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),ht()))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},c=[r,a],t[1]=r,t[2]=s,t[3]=c),(0,Q.useEffect)(s,c);let l;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(mi,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),t[4]=l):l=t[4];let u;t[5]===n?u=t[6]:(u=()=>{let e=kn(n),t=o(n);requestAnimationFrame(()=>{if(e===null||t.trim()===``){ht();return}Xt(VO(e,t))})},t[5]=n,t[6]=u);let d,f;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(oc,{className:`size-3.5`,"aria-hidden":`true`}),f=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`xWEvuo`})}),t[7]=d,t[8]=f):(d=t[7],f=t[8]);let p;return t[9]===u?p=t[10]:(p=(0,Z.jsxs)(Z.Fragment,{children:[l,(0,Z.jsxs)(Y,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`edit-with-ai-bubble-button`,className:`gap-1 px-2 text-sm font-medium text-accent-foreground/80`,onClick:u,children:[d,f]})]}),t[9]=u,t[10]=p),p}function GO(e){let t=e.schema.nodes;return!!(t.footnoteReference&&t.footnoteDefinition)}function KO(e){let{from:t,to:n}=e.state.selection,r=!1;return e.state.doc.nodesBetween(t,n,e=>e.type.name===`footnoteReference`?(r=!0,!1):!0),r}function qO(e){let{$from:t,$to:n}=e.state.selection;return!t.sameParent(n)}function JO(e){let t=(0,$.c)(21),{editor:n}=e,{_:r}=vt(),i;t[0]===n?i=t[1]:(i={editor:n,selector:YO},t[0]=n,t[1]=i);let o=Bn(i),s;t[2]!==o||t[3]!==n?(s=()=>{if(o||!GO(n)||n.state.selection.empty||qO(n)||KO(n))return;let{from:e,to:t}=n.state.selection,r=n.state.doc.textBetween(e,t,` `);if(!r.trim())return;let i=ma(Bo(n.state.doc)),a=Ta(n.state.doc)+1-(t-e);n.chain().focus().deleteSelection().insertFootnoteReference(i).insertContentAt(a,{type:`footnoteDefinition`,attrs:{identifier:i,label:i},content:[{type:`paragraph`,content:[{type:`text`,text:r}]}]}).run()},t[2]=o,t[3]=n,t[4]=s):s=t[4];let c=s,l;t[5]===r?l=t[6]:(l=r({id:`sIGbBZ`}),t[5]=r,t[6]=l);let u;t[7]===c?u=t[8]:(u=e=>{e.preventDefault(),c()},t[7]=c,t[8]=u);let d;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(a,{className:`size-3.5`,"aria-hidden":`true`}),t[9]=d):d=t[9];let f;t[10]!==o||t[11]!==l||t[12]!==u?(f=(0,Z.jsx)(ln,{asChild:!0,children:(0,Z.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon-xs`,"data-testid":`footnote-bubble-button`,className:`text-accent-foreground/80`,"aria-label":l,onMouseDown:u,disabled:o,children:d})}),t[10]=o,t[11]=l,t[12]=u,t[13]=f):f=t[13];let p;t[14]===r?p=t[15]:(p=r({id:`sIGbBZ`}),t[14]=r,t[15]=p);let m;t[16]===p?m=t[17]:(m=(0,Z.jsx)(un,{side:`bottom`,sideOffset:8,children:p}),t[16]=p,t[17]=m);let h;return t[18]!==f||t[19]!==m?(h=(0,Z.jsxs)(fn,{children:[f,m]}),t[18]=f,t[19]=m,t[20]=h):h=t[20],h}function YO(e){let t=e.editor;return!!(!GO(t)||t.state.selection.empty||qO(t)||KO(t))}var XO=[{name:`bold`,icon:Pm,command:e=>e.chain().focus().toggleBold().run(),isActive:e=>e.isActive(`strong`),shortcutId:`format-bold`},{name:`italic`,icon:ah,command:e=>e.chain().focus().toggleItalic().run(),isActive:e=>e.isActive(`emphasis`),shortcutId:`format-italic`},{name:`underline`,icon:Hh,command:e=>e.chain().focus().toggleUnderline().run(),isActive:e=>e.isActive(`underline`),shortcutId:`format-underline`},{name:`strikethrough`,icon:Ph,command:e=>e.chain().focus().toggleStrike().run(),isActive:e=>e.isActive(`strike`),shortcutId:`format-strike`},{name:`code`,icon:xe,command:e=>e.chain().focus().toggleCode().run(),isActive:e=>e.isActive(`code`),shortcutId:`format-inline-code`},{name:`highlight`,icon:ih,command:e=>e.chain().focus().toggleHighlight().run(),isActive:e=>e.isActive(`highlight`),shortcutId:`format-highlight`}];function ZO(e){let t=(0,$.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:QO},t[0]=n,t[1]=r);let i=Bn(r),a;t[2]!==i||t[3]!==n?(a=XO.map(e=>{let t=e.icon,r=i[e.name];return(0,Z.jsxs)(fn,{children:[(0,Z.jsx)(ln,{asChild:!0,children:(0,Z.jsx)(Y,{variant:`ghost`,size:`icon-xs`,"aria-label":e.name,className:r?`bg-accent text-primary`:`text-accent-foreground`,onMouseDown:t=>{t.preventDefault(),e.command(n)},children:(0,Z.jsx)(t,{className:`size-3.5`})})}),(0,Z.jsxs)(un,{side:`bottom`,sideOffset:8,children:[(0,Z.jsx)(`span`,{className:`capitalize`,children:e.name}),(0,Z.jsx)(Oe,{"aria-label":Cl(e.shortcutId),children:xl(e.shortcutId)})]})]},e.name)}),t[2]=i,t[3]=n,t[4]=a):a=t[4];let o;return t[5]===a?o=t[6]:(o=(0,Z.jsx)(`div`,{className:`flex items-center gap-0.5`,children:a}),t[5]=a,t[6]=o),o}function QO(e){return Object.fromEntries(XO.map(t=>[t.name,t.isActive(e.editor)]))}var $O=`open-knowledge:open-link-edit-popover`;function ek(e=typeof window>`u`?new EventTarget:window){e.dispatchEvent(new CustomEvent($O))}function tk(e,t=typeof window>`u`?new EventTarget:window){let n=()=>e();return t.addEventListener($O,n),()=>t.removeEventListener($O,n)}function nk(e){return e.state.selection.empty&&e.isActive(`link`)?e.getAttributes(`link`).href??``:``}async function rk(e,t){let n;try{n=await navigator.clipboard.readText()}catch(e){e instanceof DOMException||console.warn(`[link-popover] clipboard pre-fill read failed unexpectedly`,e);return}let r=m(n);r!==null&&(t(e=>e===``?r:e),requestAnimationFrame(()=>{let t=e.current;t&&t.value===r&&t.select()}))}function ik(e,t,n,r){let i=nk(e);n(i),r(!0),i===``&&rk(t,n)}function ak(e){let t=(0,$.c)(72),{editor:n,shortcutEnabled:r}=e,i=r===void 0?!1:r,{_:a}=vt(),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(``),u=(0,Q.useRef)(null),{folderPaths:f,loading:p,pages:m}=Ns(),h;t[0]===n?h=t[1]:(h=n.state.selection.empty&&n.isActive(`link`),t[0]=n,t[1]=h);let _=h,v;t[2]===n?v=t[3]:(v=n.getAttributes(`link`).href??``,t[2]=n,t[3]=v);let y=v,b,x;t[4]!==n||t[5]!==i?(b=()=>tk(()=>{i&&ik(n,u,l,s)}),x=[i,n],t[4]=n,t[5]=i,t[6]=b,t[7]=x):(b=t[6],x=t[7]),(0,Q.useEffect)(b,x);let C,w;t[8]!==n||t[9]!==i?(C=()=>{let e=e=>{if(!i||!Sl(e,`add-link`)||!n.editorView?.hasFocus())return;let t=BO(n);if(t!==null)switch(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),t.kind){case`open-popover`:ek();return;case`edit-link`:{let{markId:e}=t;S(e),requestAnimationFrame(()=>{g(n).setActiveNode(e)});return}default:zO(t)}};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},w=[i,n],t[8]=n,t[9]=i,t[10]=C,t[11]=w):(C=t[10],w=t[11]),(0,Q.useEffect)(C,w);let T,E;t[12]===n?(T=t[13],E=t[14]):(T=()=>{let e=function(){n.state.selection.empty&&s(!1)};return n.on(`selectionUpdate`,e),()=>{n.off(`selectionUpdate`,e)}},E=[n],t[12]=n,t[13]=T,t[14]=E),(0,Q.useEffect)(T,E);let D,O;t[15]===o?(D=t[16],O=t[17]):(D=()=>{if(!o)return;let e=!1,t=0,n=r=>{if(e)return;let i=u.current;i&&(i.focus(),document.activeElement===i)||(r<60?t=requestAnimationFrame(()=>n(r+1)):console.warn(`[link-popover] URL input never became focusable`))};return t=requestAnimationFrame(()=>n(0)),()=>{e=!0,cancelAnimationFrame(t)}},O=[o],t[15]=o,t[16]=D,t[17]=O),(0,Q.useEffect)(D,O);let k;t[18]!==n||t[19]!==_||t[20]!==c?(k=function(){c.trim()?n.chain().focus().setLink({href:c.trim()}).run():_&&n.chain().focus().unsetLink().run(),s(!1)},t[18]=n,t[19]=_,t[20]=c,t[21]=k):k=t[21];let A=k,j;t[22]===n?j=t[23]:(j=function(){n.chain().focus().unsetLink().run(),s(!1)},t[22]=n,t[23]=j);let M=j,N;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(N=function(e){l(Kn(e.path,null))},t[24]=N):N=t[24];let P=N,F;t[25]!==A||t[26]!==n?(F=function(e){e.key===`Enter`&&(e.preventDefault(),A()),e.key===`Escape`&&(e.preventDefault(),s(!1),n.chain().focus().run())},t[25]=A,t[26]=n,t[27]=F):F=t[27];let I=F;if(o){let e;t[28]===a?e=t[29]:(e=a({id:`ZsGpr_`}),t[28]=a,t[29]=e);let n;t[30]===a?n=t[31]:(n=a({id:`roAe2K`}),t[30]=a,t[31]=n);let r;t[32]!==f||t[33]!==I||t[34]!==p||t[35]!==m||t[36]!==e||t[37]!==n||t[38]!==c?(r=(0,Z.jsx)(d,{ref:u,type:`text`,placeholder:e,value:c,pages:m,folderPaths:f,loading:p,onValueChange:l,onSuggestionSelect:P,onKeyDown:I,"aria-label":n,className:`h-5 w-44 rounded-none border-none bg-transparent px-0 py-0 text-sm placeholder:text-muted-foreground focus-visible:border-transparent focus-visible:ring-0 dark:bg-transparent`}),t[32]=f,t[33]=I,t[34]=p,t[35]=m,t[36]=e,t[37]=n,t[38]=c,t[39]=r):r=t[39];let i;t[40]===a?i=t[41]:(i=a({id:`tP5DDk`}),t[40]=a,t[41]=i);let o;t[42]===A?o=t[43]:(o=()=>{A()},t[42]=A,t[43]=o);let s;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(Hm,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[44]=s):s=t[44];let h;t[45]!==i||t[46]!==o?(h=(0,Z.jsx)(Y,{variant:`ghost`,size:`icon-xs`,"aria-label":i,onClick:o,children:s}),t[45]=i,t[46]=o,t[47]=h):h=t[47];let g;t[48]!==r||t[49]!==h?(g=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5 rounded-md border bg-background px-2 py-1 focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50`,children:[r,h]}),t[48]=r,t[49]=h,t[50]=g):g=t[50];let v;t[51]!==a||t[52]!==y||t[53]!==_||t[54]!==M?(v=_&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(fn,{children:[(0,Z.jsx)(ln,{asChild:!0,children:(0,Z.jsx)(Y,{variant:`ghost`,size:`icon-xs`,"aria-label":a({id:`2vIPtm`}),onMouseDown:e=>{e.preventDefault(),In(y)},children:(0,Z.jsx)(us,{className:`size-3.5`})})}),(0,Z.jsx)(un,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(J,{id:`2vIPtm`})})]}),(0,Z.jsxs)(fn,{children:[(0,Z.jsx)(ln,{asChild:!0,children:(0,Z.jsx)(Y,{variant:`ghost`,size:`icon-xs`,"aria-label":a({id:`484LKL`}),onMouseDown:e=>{e.preventDefault(),M()},children:(0,Z.jsx)(ol,{className:`size-3.5`})})}),(0,Z.jsx)(un,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(J,{id:`484LKL`})})]})]}),t[51]=a,t[52]=y,t[53]=_,t[54]=M,t[55]=v):v=t[55];let b;return t[56]!==g||t[57]!==v?(b=(0,Z.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[g,v]}),t[56]=g,t[57]=v,t[58]=b):b=t[58],b}let L;t[59]===a?L=t[60]:(L=a({id:`p0Iq25`}),t[59]=a,t[60]=L);let R=_?`bg-accent text-primary`:`text-accent-foreground`,z;t[61]===n?z=t[62]:(z=e=>{e.preventDefault(),ik(n,u,l,s)},t[61]=n,t[62]=z);let B;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsx)(sh,{className:`size-3.5`}),t[63]=B):B=t[63];let V;t[64]!==L||t[65]!==R||t[66]!==z?(V=(0,Z.jsx)(ln,{asChild:!0,children:(0,Z.jsx)(Y,{variant:`ghost`,size:`icon-xs`,"aria-label":L,className:R,onMouseDown:z,children:B})}),t[64]=L,t[65]=R,t[66]=z,t[67]=V):V=t[67];let H;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Z.jsx)(J,{id:`yzF66j`}),t[68]=H):H=t[68];let U;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsxs)(un,{side:`bottom`,sideOffset:8,children:[H,(0,Z.jsx)(Oe,{children:xl(`add-link`)})]}),t[69]=U):U=t[69];let W;return t[70]===V?W=t[71]:(W=(0,Z.jsxs)(fn,{children:[V,U]}),t[70]=V,t[71]=W),W}function ok(e){let t=(0,$.c)(30),{editor:n,shortcutEnabled:r}=e,i=r===void 0?!0:r,a=(0,Q.useRef)(null),[o,s]=(0,Q.useState)(0),c=(0,Q.useRef)(null),l;t[0]===n?l=t[1]:(l={editor:n,selector:dk},t[0]=n,t[1]=l);let u=Bn(l),d;t[2]===n?d=t[3]:(d={editor:n,selector:uk},t[2]=n,t[3]=d);let f=Bn(d),p;t[4]!==n.state||t[5]!==n.view?(p=()=>{try{let{from:e,to:t}=n.state.selection;return wa(n.view,e,t)}catch{return new DOMRect}},t[4]=n.state,t[5]=n.view,t[6]=p):p=t[6];let m;t[7]!==n.view.dom||t[8]!==p?(m={getBoundingClientRect:p,contextElement:n.view.dom},t[7]=n.view.dom,t[8]=p,t[9]=m):m=t[9];let h=m,g;t[10]===n?g=t[11]:(g=gO(n),t[10]=n,t[11]=g);let _=g,v;t[12]!==_||t[13]!==h?(v=()=>{let e=a.current;e&&(c.current?.(),c.current=lr(h,e,()=>{ar(h,e,{placement:`top`,strategy:`fixed`,middleware:[or(8),rr(_),fr({padding:8}),cr(_)]}).then(t=>{let{x:n,y:r,middlewareData:i}=t;e.isConnected&&(e.style.position=`fixed`,e.style.left=`${n}px`,e.style.top=`${r}px`,e.style.visibility=i.hide?.referenceHidden?`hidden`:`visible`)}).catch(lk)}))},t[12]=_,t[13]=h,t[14]=v):v=t[14];let y=v,b;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(b=()=>{c.current?.(),c.current=null,s(ck)},t[15]=b):b=t[15];let x=b,S;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(S={padding:8},t[16]=S):S=t[16];let C;t[17]!==_||t[18]!==y?(C={onShow:y,onHide:x,strategy:`fixed`,flip:_,shift:S,hide:_},t[17]=_,t[18]=y,t[19]=C):C=t[19];let w;t[20]!==n||t[21]!==f||t[22]!==u||t[23]!==i||t[24]!==o?(w=u?(0,Z.jsx)(FO,{editor:n},`${o}-img-align`):f?(0,Z.jsx)(xO,{editor:n},`${o}-file`):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ZD,{editor:n}),(0,Z.jsx)(mi,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(ZO,{editor:n},o),(0,Z.jsx)(mi,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(ak,{editor:n,shortcutEnabled:i},`${o}-link`),(0,Z.jsx)(JO,{editor:n},`${o}-footnote`),(0,Z.jsx)(UO,{editor:n,shortcutEnabled:i},`${o}-edit-ai`)]}),t[20]=n,t[21]=f,t[22]=u,t[23]=i,t[24]=o,t[25]=w):w=t[25];let T;return t[26]!==n||t[27]!==C||t[28]!==w?(T=(0,Z.jsx)(YD,{ref:a,editor:n,"data-testid":`bubble-menu-bar`,appendTo:sk,shouldShow:RO,updateDelay:250,options:C,className:`z-50 flex items-center gap-0.5 rounded-lg border bg-background p-1 shadow-md`,children:w}),t[26]=n,t[27]=C,t[28]=w,t[29]=T):T=t[29],T}function sk(){return document.body}function ck(e){return e+1}function lk(){}function uk(e){return CO(e.editor)}function dk(e){return LO(e.editor)}var fk=new Ea(`markdownLintDecorations`),pk=`ok-lint-block`,mk=`ok-lint-block-error`,hk=`ok-lint-block-atom`,gk=400;function _k(e,t){let{frontmatter:n,body:r}=ro(e),i=n===``?0:n.split(`
18
18
  `).length-1;return{spans:t.parseToMdast(r).children.map(e=>({start:(e.position?.start.line??1/0)+i,end:(e.position?.end.line??-1/0)+i})),fmLineCount:i}}function vk(e,t){let n=e.findIndex(e=>t>=e.start&&t<=e.end);if(n>=0)return n;let r=e.findIndex(e=>e.start>t);return r>=0?r:e.length>0?e.length-1:null}function yk(e,t,n){let r=new Map;if(t.length===0)return r;let{spans:i,fmLineCount:a}=_k(e,n);for(let e of t){let t=e.range.start.line+1;if(a>0&&t<=a)continue;let n=vk(i,t);if(n===null)continue;let o=r.get(n);o?o.push(e):r.set(n,[e])}return r}function bk(e){let t=e.childCount>0?e.child(e.childCount-1):null;return t!==null&&t.type.name===`paragraph`&&t.content.size===0?e.childCount-1:e.childCount}var xk=`data-ok-lint`,Sk=`data-ok-lint-fixable`;function Ck(e,t){let n=new Map;if(t.size===0)return{set:Xa.empty,fixesByOffset:n};let r=[],i=0;return e.forEach((e,a)=>{let o=t.get(i);if(i+=1,!o||o.length===0)return;let s=o.some(e=>e.severity===`error`),c=o.map(e=>`${e.source}/${e.code}: ${e.message}`).join(`
19
19
  `),l=[pk];e.textContent.length===0&&l.push(hk),s&&l.push(mk);let u={class:l.join(` `),[xk]:c},d=Xy(o);d.length>0&&(u[Sk]=`1`,n.set(a,d)),r.push(la.node(a,a+e.nodeSize,u))}),{set:Xa.create(e,r),fixesByOffset:n}}function wk(e,t){let n=document.createElement(`div`);n.className=`ok-lint-tooltip`,n.hidden=!0;let r=document.createElement(`div`);r.className=`ok-lint-tooltip-message`,n.appendChild(r);let i=document.createElement(`button`);i.type=`button`,i.className=$t(`ok-lint-tooltip-fix`,tn({variant:`default`,size:`xs`}),`mt-1 self-start`),i.hidden=!0,n.appendChild(i),n.style.position=`fixed`,n.style.top=`0`,n.style.left=`0`,document.body.appendChild(n);let a=null,o=!1,s=null,c=null,l=0,u=0,d={getBoundingClientRect:()=>({width:0,height:0,x:l,y:u,top:u,left:l,right:l,bottom:u})};function f(){s!==null&&(clearTimeout(s),s=null)}function p(){f(),a=null,n.hidden=!0,c?.(),c=null}function m(){o||(f(),s=setTimeout(p,140))}function h(){ar(d,n,{placement:`top-start`,middleware:[or(6),rr(),fr({padding:8})]}).then(({x:e,y:t})=>{n.isConnected&&(n.style.left=`${e}px`,n.style.top=`${t}px`)}).catch(e=>{n.isConnected&&console.warn(`[markdown-lint] tooltip computePosition failed`,e)})}function g(e){let s=e.getAttribute(xk);if(!s){m();return}f(),a=e,r.textContent=s;let l=t.applyFix?t.getFixes(e):[];l.length>0&&t.applyFix?(i.hidden=!1,i.textContent=yl._({id:`c4fVUV`}),i.onclick=()=>{t.applyFix?.(l),o=!1,p()}):(i.hidden=!0,i.onclick=null),n.hidden=!1,c?.(),c=lr(d,n,h)}function _(e){let t=e,n=e.target?.closest(`.${pk}`)??null;n?n===a?f():(l=t.clientX,u=t.clientY,g(n)):a&&m()}function v(e){let t=e.relatedTarget;if(t===n||t?.closest(`.ok-lint-tooltip`)){f();return}t?.closest(`.${pk}`)||m()}function y(){o=!0,f()}function b(e){o=!1;let t=e.relatedTarget;t!==a&&!t?.closest(`.${pk}`)&&m()}return n.addEventListener(`pointerenter`,y),n.addEventListener(`pointerleave`,b),e.dom.addEventListener(`pointerover`,_),e.dom.addEventListener(`pointerout`,v),{destroy(){f(),c?.(),e.dom.removeEventListener(`pointerover`,_),e.dom.removeEventListener(`pointerout`,v),n.remove()}}}var Tk=vo.create({name:`markdownLintDecorations`,addOptions(){return{docName:``,getSource:void 0,applyFix:void 0}},addProseMirrorPlugins(){let{docName:e,getSource:t,applyFix:n}=this.options,r=new Fo({extensions:ya});return[new _a({key:fk,state:{init:()=>Xa.empty,apply(e,t){return e.getMeta(fk)||t.map(e.mapping,e.doc)}},props:{decorations(e){return fk.getState(e)??null}},view(i){let a=null,o=null,s=!1,c=0,l=new Map;async function u(){if(s)return;let n=t?.()??null,r=a?.enabled?await d(a):{kind:`ok`,set:Xa.empty,fixesByOffset:new Map};if(s||r.kind===`stale`)return;if(r.kind===`mismatch`){c<2&&(c+=1,f());return}c=0,l=r.fixesByOffset;let o=r.set,u=fk.getState(i.state)??Xa.empty;if((o.find().length>0||u.find().length>0)&&i.dispatch(i.state.tr.setMeta(fk,o)),a?.enabled){let t=cd(e);t?.kind===`lint`&&g(t.detail)&&id(e)}n!==null&&!s&&t?.()!==n&&f()}async function d(n){let a=i.state.doc,o=t?.()??r.serialize(a.toJSON()),s=await lo(o,n,e);if(!i.state.doc.eq(a))return{kind:`stale`};let{spans:c}=_k(o,r);return c.length===bk(a)?{kind:`ok`,...Ck(a,yk(o,s,r))}:{kind:`mismatch`}}function f(){o&&clearTimeout(o),o=setTimeout(()=>{u().catch(e=>{console.warn(`[markdown-lint] decoration pass failed`,e)})},gk)}let p=0;async function m(){let t=++p,n=await Td(e);s||t!==p||(a=n,await u())}let h=()=>{m().catch(e=>{console.warn(`[markdown-lint] config load/lint pass failed`,e)})};function g(e){if(!i.dom.isConnected||i.dom.offsetParent===null)return!1;let{spans:n,fmLineCount:a}=_k(t?.()??r.serialize(i.state.doc.toJSON()),r);if(n.length!==bk(i.state.doc)||a>0&&e.line<=a)return!1;let o=vk(n,e.line);if(o===null)return!1;let s=-1;if(i.state.doc.forEach((e,t,n)=>{n===o&&(s=t)}),s<0)return!1;i.dispatch(i.state.tr.setSelection(no.near(i.state.doc.resolve(s+1)))),i.focus();let c=i.nodeDOM(s);return c instanceof HTMLElement&&c.scrollIntoView({behavior:`smooth`,block:`start`}),!0}function _(t){let n=t.detail;!n||s||g(n)&&id(e)}h();let v=wd(h),y=wk(i,{getFixes:e=>{if(e.getAttribute(Sk)!==`1`||l.size===0)return[];let t;try{t=i.posAtDOM(e,0)}catch(e){return console.warn(`[markdown-lint] posAtDOM failed on lint block; Fix button suppressed`,e),[]}let n=Math.min(Math.max(t,0),i.state.doc.content.size),r=i.state.doc.resolve(n),a=r.depth>=1?r.before(1):0;return l.get(a)??[]},applyFix:n});window.addEventListener(nd,_);let b=()=>{s||f()};return window.addEventListener(qy,b),{update(e,t){e.state.doc.eq(t.doc)||f()},destroy(){s=!0,o&&clearTimeout(o),v(),y.destroy(),window.removeEventListener(nd,_),window.removeEventListener(qy,b)}}}})]}}),Ek=1400,Dk=new Ea(`okAgentInsertFlash`);function Ok(e,t){let n=e.content.findDiffStart(t.content);if(n==null)return null;let r=e.content.findDiffEnd(t.content),i=t.content.size,a=Math.max(0,Math.min(n,i)),o=Math.max(a,Math.min(r?.b??i,i));return o<=a?null:{from:a,to:o}}var kk=6e3;function Ak(e,t,n){let r=e.childCount,i=Math.max(0,Math.min(t,r)),a=Math.max(i,Math.min(n,r));if(a<=i)return null;let o=0;for(let t=0;t<i;t++)o+=e.child(t).nodeSize;let s=o;for(let t=i;t<a;t++)o+=e.child(t).nodeSize;let c=o,l=e.content.size,u=Math.max(0,Math.min(s,l)),d=Math.max(u,Math.min(c,l));return d<=u?null:{from:u,to:d}}function jk(){return new _a({key:Dk,state:{init:()=>Xa.empty,apply(e,t){let n=t.map(e.mapping,e.doc),r=e.getMeta(Dk);if(r===void 0)return n;if(r.sweep===!0){let e=n.find().filter(e=>r.now-(e.spec.addedAt??0)>=Ek);e.length>0&&(n=n.remove(e))}if(r.add!==void 0&&r.add.to>r.add.from){let t={addedAt:r.now};n=n.add(e.doc,[la.inline(r.add.from,r.add.to,{class:`ok-agent-insert-flash`},t)])}return n}},props:{decorations(e){return Dk.getState(e)}}})}function Mk(e,t){return(n,r)=>{let i=r,a=Xd(i.dataTransfer);return a?(i.preventDefault(),t?.(a),!0):e(n,i)}}function Nk(e,t){let n=Jd(e);t(n.target,{tabBehavior:`append`}),nu(n.hash)}var Pk=5,Fk=1;function Ik(e){let t=(0,$.c)(14),{editor:n,axis:r,anchor:i,onClickGesture:a}=e,o=(0,Q.useRef)(null),s=(0,Q.useRef)(null),c=(0,Q.useRef)(a),l,u;t[0]===a?(l=t[1],u=t[2]):(l=()=>{c.current=a},u=[a],t[0]=a,t[1]=l,t[2]=u),(0,Q.useEffect)(l,u);let d,f;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>()=>{s.current?.abort(),s.current=null,o.current=null,document.body.style.cursor=``,document.body.style.userSelect=``},f=[],t[3]=d,t[4]=f):(d=t[3],f=t[4]),(0,Q.useEffect)(d,f);let[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(null),_;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(_=e=>!(e&&o.current!==null),t[5]=_):_=t[5];let v=_,y;t[6]!==i||t[7]!==r||t[8]!==n?(y=e=>{if(e.button!==0)return;s.current?.abort(),o.current={startX:e.clientX,startY:e.clientY,isDragging:!1,lastTarget:null};let t=new AbortController;s.current=t;let{signal:a}=t,l=e=>{let t=o.current;if(!t)return;if(!t.isDragging){let n=e.clientX-t.startX,r=e.clientY-t.startY;if(Math.hypot(n,r)<Pk)return;t.isDragging=!0,m(!0),document.body.style.cursor=`grabbing`,document.body.style.userSelect=`none`}let n=Lk(i,r,e.clientX,e.clientY);t.lastTarget=n,g(n)},u=()=>{t.abort(),s.current===t&&(s.current=null),document.body.style.cursor=``,document.body.style.userSelect=``;let e=o.current;o.current=null,m(!1),g(null),e&&(e.isDragging&&e.lastTarget?Vk(n,i,r,e.lastTarget.index):e.isDragging||c.current())};document.addEventListener(`pointermove`,l,{signal:a}),document.addEventListener(`pointerup`,u,{signal:a}),document.addEventListener(`pointercancel`,u,{signal:a})},t[6]=i,t[7]=r,t[8]=n,t[9]=y):y=t[9];let b=y,x;return t[10]!==h||t[11]!==p||t[12]!==b?(x={onPointerDown:b,shouldAllowOpen:v,isDragging:p,indicator:h},t[10]=h,t[11]=p,t[12]=b,t[13]=x):x=t[13],x}function Lk(e,t,n,r){let i=e.closest(`table`);if(!i)return null;let a=i.getBoundingClientRect();if(t===`row`){let e=Array.from(i.rows);if(e.length===0)return null;for(let t=0;t<e.length;t++){let n=e[t].getBoundingClientRect();if(r<n.top)return{index:Fk,rect:zk(a,Rk(e,0,n.top))};if(r<=n.bottom){let i=r>=n.top+n.height/2,o=i?t+1:t,s=Math.max(Fk,o);return{index:s,rect:zk(a,s===o?i?n.bottom:n.top:Rk(e,0,n.top))}}}let t=e[e.length-1].getBoundingClientRect();return{index:e.length,rect:zk(a,t.bottom)}}let o=i.rows[0];if(!o)return null;let s=Array.from(o.cells);if(s.length===0)return null;for(let e=0;e<s.length;e++){let t=s[e].getBoundingClientRect();if(n<t.left)return{index:0,rect:Bk(a,t.left)};if(n<=t.right){let r=n>=t.left+t.width/2,i=r?t.right:t.left;return{index:r?e+1:e,rect:Bk(a,i)}}}let c=s[s.length-1].getBoundingClientRect();return{index:s.length,rect:Bk(a,c.right)}}function Rk(e,t,n){let r=e[t];return r?r.getBoundingClientRect().bottom:n}function zk(e,t){return{left:e.left,top:t-1,width:e.width,height:2}}function Bk(e,t){return{left:t-1,top:e.top,width:2,height:e.height}}function Vk(e,t,n,r){let i=n===`row`?Hk(t):t.cellIndex;if(i<0||n===`row`&&(i<Fk||r<Fk)||r===i||r===i+1)return;let{state:a,view:o}=e,s=Uk(a.selection.$from);if(s<0){console.warn(`[table-drag-reorder] no table found at selection depth`);return}let c=a.doc.nodeAt(s);if(!c){console.warn(`[table-drag-reorder] nodeAt returned null at tablePos`,s);return}let l=a.tr;Kk(l,s,c,n===`row`?Wk(c,i,r):Gk(c,i,r)),o.dispatch(l)}function Hk(e){let t=e.parentElement,n=t?.closest(`table`);return n?Array.prototype.indexOf.call(n.rows,t):-1}function Uk(e){for(let t=e.depth;t>0;t--)if(e.node(t).type.spec.tableRole===`table`)return e.before(t);return-1}function Wk(e,t,n){let r=[];e.forEach(e=>{r.push(e)});let[i]=r.splice(t,1),a=n>t?n-1:n;return r.splice(a,0,i),e.type.create(e.attrs,r,e.marks)}function Gk(e,t,n){let r=n>t?n-1:n,i=[];return e.forEach(e=>{let n=[];e.forEach(e=>{n.push(e)});let[a]=n.splice(t,1);n.splice(r,0,a),i.push(e.type.create(e.attrs,n,e.marks))}),e.type.create(e.attrs,i,e.marks)}function Kk(e,t,n,r){e.replaceRangeWith(t,t+n.nodeSize,r)}function qk(e){return[...e?[{label:`Toggle header column`,icon:Bm,run:e=>e.chain().focus().toggleHeaderColumn().run()}]:[],{label:`Insert column left`,icon:$n,run:e=>e.chain().focus().addColumnBefore().run()},{label:`Insert column right`,icon:Ln,run:e=>e.chain().focus().addColumnAfter().run()},{label:`Delete column`,icon:ol,separatorBefore:!0,run:e=>e.chain().focus().deleteColumn().run()},{label:`Delete table`,icon:th,run:e=>e.chain().focus().deleteTable().run()}]}function Jk(e){return[...e?[{label:`Toggle header row`,icon:Fh,run:e=>e.chain().focus().toggleHeaderRow().run()}]:[],{label:`Insert row above`,icon:Un,run:e=>e.chain().focus().addRowBefore().run()},{label:`Insert row below`,icon:tr,run:e=>e.chain().focus().addRowAfter().run()},{label:`Delete row`,icon:ol,separatorBefore:!0,run:e=>e.chain().focus().deleteRow().run()},{label:`Delete table`,icon:th,run:e=>e.chain().focus().deleteTable().run()}]}function Yk(e){if(!e.isEditable||G(e.state).query)return null;let{state:t,view:n}=e,r=t.selection.$from,i=-1;for(let e=r.depth;e>0;e--){let t=r.node(e).type.spec.tableRole;if(t===`cell`||t===`header_cell`){i=r.before(e);break}}if(i<0)return null;let a=n.nodeDOM(i);if(!(a instanceof HTMLTableCellElement))return null;let o=a.closest(`table`),s=a.closest(`tr`),c=a.closest(`.ProseMirror`);if(!o||!s||!c)return null;let l=Array.prototype.indexOf.call(o.rows,s),u=a.cellIndex,d=o.rows[0]?.cells[u],f=o.rows[l]?.cells[0];return!d||!f?null:{columnAnchor:d,rowAnchor:f,isFirstColumn:u===0,isFirstRow:l===0}}function Xk(e){let t=(0,$.c)(37),{editor:n,anchor:r,axis:i,items:a}=e,o=(0,Q.useRef)(null),[s,c]=(0,Q.useState)(!1),l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>c(!0),t[0]=l):l=t[0];let u;t[1]!==r||t[2]!==i||t[3]!==n?(u={editor:n,axis:i,anchor:r,onClickGesture:l},t[1]=r,t[2]=i,t[3]=n,t[4]=u):u=t[4];let d=Ik(u),f,p;t[5]!==r||t[6]!==i?(f=()=>{let e=o.current;if(!e)return;let t=i===`column`?`top`:`left`,n=i===`column`?-14:-6;return lr(r,e,()=>{ar(r,e,{strategy:`absolute`,placement:t,middleware:[or(n)]}).then(t=>{let{x:n,y:r}=t;e.style.left=`${n}px`,e.style.top=`${r}px`,e.style.opacity=`1`}).catch(Zk)})},p=[r,i],t[5]=r,t[6]=i,t[7]=f,t[8]=p):(f=t[7],p=t[8]),(0,Q.useEffect)(f,p);let m=i===`column`?Wm:Ci,h;t[9]===d?h=t[10]:(h=e=>{d.shouldAllowOpen(e)&&c(e)},t[9]=d,t[10]=h);let g=i===`column`?`h-3 w-7 rounded-full p-0 text-gray-700 dark:text-muted-foreground bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 hover:text-foreground dark:hover:bg-gray-600 dark:hover:text-gray-100 relative cursor-grab before:absolute before:-inset-[6px] before:content-[""]`:`h-7 w-3 rounded-full p-0 text-gray-700 dark:text-muted-foreground bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 hover:text-foreground dark:hover:bg-gray-600 dark:hover:text-gray-100 relative cursor-grab before:absolute before:-inset-[6px] before:content-[""]`,_=i===`column`?`Column options`:`Row options`,v;t[11]===m?v=t[12]:(v=(0,Z.jsx)(m,{className:`size-3.5`,"aria-hidden":!0}),t[11]=m,t[12]=v);let y;t[13]!==d.onPointerDown||t[14]!==g||t[15]!==_||t[16]!==v?(y=(0,Z.jsx)(Pr,{asChild:!0,children:(0,Z.jsx)(Y,{variant:`secondary`,onPointerDown:d.onPointerDown,className:g,"aria-label":_,children:v})}),t[13]=d.onPointerDown,t[14]=g,t[15]=_,t[16]=v,t[17]=y):y=t[17];let b=i===`column`?`center`:`start`,x=i===`column`?`bottom`:`right`,S;if(t[18]!==n||t[19]!==a){let e;t[21]===n?e=t[22]:(e=e=>(0,Z.jsxs)(Q.Fragment,{children:[e.separatorBefore&&(0,Z.jsx)(Vr,{}),(0,Z.jsxs)(Ar,{onSelect:()=>e.run(n),children:[(0,Z.jsx)(e.icon,{"aria-hidden":!0}),e.label]})]},e.label),t[21]=n,t[22]=e),S=a.map(e),t[18]=n,t[19]=a,t[20]=S}else S=t[20];let C;t[23]!==b||t[24]!==x||t[25]!==S?(C=(0,Z.jsx)(Rr,{align:b,side:x,className:`w-auto min-w-44 whitespace-nowrap`,children:S}),t[23]=b,t[24]=x,t[25]=S,t[26]=C):C=t[26];let w;t[27]!==s||t[28]!==C||t[29]!==h||t[30]!==y?(w=(0,Z.jsx)(`div`,{ref:o,"data-testid":`table-cell-handle`,className:`absolute left-0 top-0 z-10 opacity-0`,children:(0,Z.jsxs)(Br,{open:s,onOpenChange:h,children:[y,C]})}),t[27]=s,t[28]=C,t[29]=h,t[30]=y,t[31]=w):w=t[31];let T;t[32]===d.indicator?T=t[33]:(T=d.indicator&&(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none fixed z-50 bg-primary`,style:{left:d.indicator.rect.left,top:d.indicator.rect.top,width:d.indicator.rect.width,height:d.indicator.rect.height}}),t[32]=d.indicator,t[33]=T);let E;return t[34]!==w||t[35]!==T?(E=(0,Z.jsxs)(Z.Fragment,{children:[w,T]}),t[34]=w,t[35]=T,t[36]=E):E=t[36],E}function Zk(){}function Qk(e){let t=(0,$.c)(18),{editor:n}=e,[r,i]=(0,Q.useState)(null),a,o;if(t[0]===n?(a=t[1],o=t[2]):(a=()=>{let e=()=>i(e=>{let t=Yk(n);return e&&t&&e.columnAnchor===t.columnAnchor&&e.rowAnchor===t.rowAnchor?e:t});return e(),n.on(`selectionUpdate`,e),n.on(`update`,e),()=>{n.off(`selectionUpdate`,e),n.off(`update`,e)}},o=[n],t[0]=n,t[1]=a,t[2]=o),(0,Q.useEffect)(a,o),!r)return null;let s=r.columnAnchor,c;t[3]===r.isFirstColumn?c=t[4]:(c=qk(r.isFirstColumn),t[3]=r.isFirstColumn,t[4]=c);let l;t[5]!==r.columnAnchor||t[6]!==n||t[7]!==c?(l=(0,Z.jsx)(Xk,{editor:n,anchor:s,axis:`column`,items:c}),t[5]=r.columnAnchor,t[6]=n,t[7]=c,t[8]=l):l=t[8];let u=r.rowAnchor,d;t[9]===r.isFirstRow?d=t[10]:(d=Jk(r.isFirstRow),t[9]=r.isFirstRow,t[10]=d);let f;t[11]!==r.rowAnchor||t[12]!==n||t[13]!==d?(f=(0,Z.jsx)(Xk,{editor:n,anchor:u,axis:`row`,items:d}),t[11]=r.rowAnchor,t[12]=n,t[13]=d,t[14]=f):f=t[14];let p;return t[15]!==l||t[16]!==f?(p=(0,Z.jsxs)(`div`,{className:`ok-table-cell-handle-layer`,children:[l,f]}),t[15]=l,t[16]=f,t[17]=p):p=t[17],p}function $k(e){let{fragment:t,docName:n}=e,r=!1,i=!1,a=!1,o=()=>{r=!0},s=e=>{console.warn(`[walk-currency] ${e} at view init — stale pre-warm cannot be invalidated: a remote edit that landed in the construct→mount gap will not render, and the first local transaction may silently erase it from the CRDT for every peer and disk (vendored y-tiptap contract change? re-verify y-tiptap.cjs:263-268)`)},c=()=>{i&&(i=!1,t.unobserveDeep(o))},l=e=>{let t=p.getState(e.state)?.binding;if(!t){Zl.count(`ok/editor/walk-currency-disarmed`,{docName:n,reason:`no-binding`}),s(`no ySync binding on "${n}"`);return}if(typeof t._forceRerender!=`function`){Zl.count(`ok/editor/walk-currency-disarmed`,{docName:n,reason:`no-force-rerender`}),s(`ySync binding on "${n}" exposes no _forceRerender`);return}Zl.count(`ok/editor/pattern-d-stale-prewarm`,{docName:n}),t._forceRerender()};return vo.create({name:`walkCurrency`,onBeforeCreate(){t.observeDeep(o),i=!0},onDestroy(){c()},addProseMirrorPlugins(){return[new _a({view:e=>(a||(a=!0,c(),r&&l(e)),{})})]}})}var eA=new WeakMap;function tA(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=da(e.color),n.textContent=e.name,t.append(n),t}var nA={state:`idle`,count:0,lastFiredAt:null,position:`append`,lastAgentId:null};function rA(e,t){let n=null;for(let[r,i]of e.entries()){let e=i;typeof e?.timestamp!=`number`||e.timestamp<=t||(n===null||e.timestamp>n.entry.timestamp)&&(n={key:`${r}:${e.timestamp}`,entry:e})}return n}var iA=100,aA=100,oA=3,sA=250;function cA(e){return`contentComponent`in e&&`isEditorContentInitialized`in e}function lA(e,t){let n=En(e);if(!n||t.contains(n.dom))return!1;if(!cA(e))return console.warn(`[TiptapEditor] TipTap EditorContent binding fields missing; detached editor repair skipped`),!1;let r=e;if(r.contentComponent==null)return!1;try{n.setProps({nodeViews:{}})}catch{}return r.contentComponent=null,r.isEditorContentInitialized=!1,!0}function uA(){let e=new Fo({extensions:ya});return{mdManager:e,text:I({mdManager:e}),html:E({mdManager:e}),paste:N({mdManager:e}),copy:b({mdManager:e}),drop:k({mdManager:e})}}function dA(e,t){return t?{collaboration:Ae.configure({document:e.document,ySyncOptions:{mapping:t}}),guard:[$k({fragment:e.document.getXmlFragment(`default`),docName:e.configuration.name??``})]}:{collaboration:Ae.configure({document:e.document}),guard:[]}}function fA(e){let{provider:t,placeholder:n,prebuiltMapping:r,onWedged:i}=e,{collaboration:a,guard:o}=dA(t,r);return[...We.map(e=>e.name===`link`||e.name===`wikiLink`||e.name===`jsxComponent`?e.configure({docName:t.configuration.name??``}):e),BS.configure({placeholder:n??`Type '/' for commands`,showOnlyCurrent:!0}),a,vo.create({name:`imageUploadDecoration`,addProseMirrorPlugins(){return[te]}}),vo.create({name:`collaborationCursor`,addProseMirrorPlugins(){let e=t.awareness;if(!e)throw Error(`[TiptapEditor] HocuspocusProvider has no awareness instance — cursor plugin cannot initialize`);return[z(e,{cursorBuilder:tA})]}}),vo.create({name:`bindingStalenessGuard`,addProseMirrorPlugins(){return[vD({fragment:t.document.getXmlFragment(`default`),docName:t.configuration.name??``,onWedged:i??(()=>{})})]}}),...o,hO,Tk.configure({docName:t.configuration.name??``,getSource:()=>t.document.getText(`source`).toString(),applyFix:e=>Zy(t,e)})]}function pA(e){let{provider:t,clipboard:n,ctorStart:r}=e;return{onBeforeCreate:({editor:e})=>{eA.set(e,r)},onCreate:({editor:e})=>{n.html.setView(e.view);let r=eA.get(e);if(eA.delete(e),r==null)return;let i=performance.now();Zl(`ok/editor/create-tiptap`,{docName:t.configuration.name??`unknown`,ytextLength:t.document.getText(`source`).length},{startTime:r,duration:Math.max(0,i-r)})},editorProps:{attributes:{class:`pt-4 pb-4 h-full`},clipboardTextParser:(e,t,r,i)=>{let a=n.mdManager.parse(e);return i.state.schema.nodeFromJSON(a).content},clipboardTextSerializer:(e,t)=>n.text(e,t),clipboardSerializer:n.html.serializer,handlePaste:(e,t)=>n.paste(e,t),handleDrop:Mk(n.drop,e.onSidebarDrop),handleDOMEvents:{copy:(e,t)=>n.copy(e,t,!1),cut:(e,t)=>n.copy(e,t,!0)}},extensions:oD(fA(e))}}function mA(e){let{provider:t,placeholder:n,clipboard:r,ctorStart:i,onWedged:a,onSidebarDrop:o}=e,s=t.document.getXmlFragment(`default`),c=new Map,l=pA({provider:t,placeholder:n,clipboard:r,ctorStart:i,prebuiltMapping:c,onWedged:a,onSidebarDrop:o}),u=l.onBeforeCreate;return{...l,onBeforeCreate:e=>{u?.(e);let{editor:t}=e,{doc:n,mapping:r}=lt(s,t.schema);r.forEach((e,t)=>{c.set(t,e)}),t.options.content=n.toJSON()},element:null}}var hA=e=>{let t=(0,$.c)(24),{provider:n,placeholder:r,isSourceMode:i,portalTarget:a}=e,o=(0,Q.useRef)(null),s=(0,Q.useRef)(nA),c=cD(),{principal:l,activeDocName:u,recycleDocument:d,openTarget:f}=Re(),p=n.configuration.name??``,[m]=(0,Q.useState)(uA),h;t[0]!==m||t[1]!==p||t[2]!==f||t[3]!==r||t[4]!==n||t[5]!==d?(h=()=>()=>({editor:new Eo(mA({provider:n,placeholder:r,clipboard:m,ctorStart:performance.now(),onWedged:e=>{let{externalSeq:t,appliedSeq:n}=e;Zl(`ok/editor/binding-wedge-recycle`,{docName:p,externalSeq:t,appliedSeq:n}),d(p)},onSidebarDrop:e=>{Nk(e,f)}})),ydoc:n.document,ytext:n.document.getText(`source`),provider:n}),t[0]=m,t[1]=p,t[2]=f,t[3]=r,t[4]=n,t[5]=d,t[6]=h):h=t[6];let[g]=(0,Q.useState)(h),_,v;if(t[7]!==g||t[8]!==p||t[9]!==n.document){let e={viewCount:0,bytes:n.document.getText(`source`).length},r=dt(p)??crypto.randomUUID();_=Q.use,v=ct({docName:p,mountId:r,construct:g,sizeStats:e}),t[7]=g,t[8]=p,t[9]=n.document,t[10]=_,t[11]=v}else _=t[10],v=t[11];let y=_(v),b=y.editor,x,S;t[12]===y?(x=t[13],S=t[14]):(x=()=>()=>{ye(y)},S=[y],t[12]=y,t[13]=x,t[14]=S),(0,Q.useEffect)(x,S);let C;return t[15]!==u||t[16]!==p||t[17]!==b||t[18]!==c||t[19]!==i||t[20]!==a||t[21]!==l||t[22]!==n?(C=(0,Z.jsx)(gA,{provider:n,isSourceMode:i,docName:p,activeDocName:u,identity:c,principal:l,editor:b,wrapperRef:o,flashStateRef:s,portalTarget:a}),t[15]=u,t[16]=p,t[17]=b,t[18]=c,t[19]=i,t[20]=a,t[21]=l,t[22]=n,t[23]=C):C=t[23],C},gA=e=>{let t=(0,$.c)(110),{provider:n,isSourceMode:r,docName:i,activeDocName:a,identity:o,principal:c,editor:l,wrapperRef:u,flashStateRef:d,portalTarget:f}=e,m=(0,Q.useRef)(null),[h,_]=(0,Q.useState)(0),v,y;t[0]===f?(v=t[1],y=t[2]):(v=()=>{let e=m.current;if(e)return e.appendChild(f),()=>{f.parentNode===e&&e.removeChild(f)}},y=[f],t[0]=f,t[1]=v,t[2]=y),(0,Q.useLayoutEffect)(v,y);let b,x;t[3]!==l||t[4]!==f?(b=()=>{lA(l,f)&&_(_A)},x=[l,f],t[3]=l,t[4]=f,t[5]=b,t[6]=x):(b=t[5],x=t[6]),(0,Q.useEffect)(b,x);let S;t[7]!==l||t[8]!==n.configuration.name?(S=()=>(Yn(l,n.configuration.name??null),()=>{Yn(l,null)}),t[7]=l,t[8]=n.configuration.name,t[9]=S):S=t[9];let C;t[10]!==l||t[11]!==n?(C=[l,n],t[10]=l,t[11]=n,t[12]=C):C=t[12],(0,Q.useEffect)(S,C);let T;t[13]!==l||t[14]!==n.configuration.name?(T=()=>{let e=n.configuration.name;if(e)return M(e,l),()=>s(e,l)},t[13]=l,t[14]=n.configuration.name,t[15]=T):T=t[15];let E;t[16]!==l||t[17]!==n?(E=[l,n],t[16]=l,t[17]=n,t[18]=E):E=t[18],(0,Q.useEffect)(T,E);let D;t[19]!==l||t[20]!==n.configuration.name?(D=()=>{let e=n.configuration.name;if(!e)return;let t=null,r=()=>{t=null,ld(e,`wysiwyg`,od(l)),Qu(e,`wysiwyg`,$u(l,e))},i=()=>{t&&clearTimeout(t),t=setTimeout(r,120)};return r(),l.on(`selectionUpdate`,i),l.on(`update`,i),()=>{t&&clearTimeout(t),l.off(`selectionUpdate`,i),l.off(`update`,i),ld(e,`wysiwyg`,null),Qu(e,`wysiwyg`,null)}},t[19]=l,t[20]=n.configuration.name,t[21]=D):D=t[21];let O;t[22]!==l||t[23]!==n?(O=[l,n],t[22]=l,t[23]=n,t[24]=O):O=t[24],(0,Q.useEffect)(D,O);let k;t[25]!==l||t[26]!==n.configuration.name?(k=()=>{},t[25]=l,t[26]=n.configuration.name,t[27]=k):k=t[27];let A;t[28]!==l||t[29]!==n?(A=[l,n],t[28]=l,t[29]=n,t[30]=A):A=t[30],(0,Q.useEffect)(k,A);let j,N;t[31]===l?(j=t[32],N=t[33]):(j=()=>{let e=vA,t=null,n=()=>{if(t||l.isDestroyed)return;let n=En(l);n&&(t=n.dom,t.addEventListener(`keydown`,e),t.addEventListener(`paste`,e),t.addEventListener(`drop`,e),t.addEventListener(`cut`,e))},r=()=>{t&&=(t.removeEventListener(`keydown`,e),t.removeEventListener(`paste`,e),t.removeEventListener(`drop`,e),t.removeEventListener(`cut`,e),null)};return En(l)?n():l.on(`create`,n),()=>{l.off(`create`,n),r()}},N=[l],t[31]=l,t[32]=j,t[33]=N),(0,Q.useEffect)(j,N);let P,F;t[34]!==i||t[35]!==l?(P=()=>{let e=!1,t=()=>{if(e||l.isDestroyed||!En(l))return;e=!0;let t=Ke(i)?.selection??null;if(t)try{let e=l.state.doc.content.size;if(t.type===`text`){let n=Math.max(0,Math.min(t.anchor,e)),r=Math.max(0,Math.min(t.head,e));l.commands.setTextSelection({from:n,to:r})}else{let n=Math.max(0,Math.min(t.from,e));l.commands.setNodeSelection(n)}}catch(e){let t=e,n=t instanceof Error?t.message:String(t);console.warn(JSON.stringify({event:`ok-editor-selection-restore-failed`,docName:i,message:n})),Zl(`ok/editor/selection-restore-failed`,{docName:i,message:n})}Pe(i)};if(En(l)){t();return}return l.on(`create`,t),()=>{l.off(`create`,t)}},F=[l,i],t[34]=i,t[35]=l,t[36]=P,t[37]=F):(P=t[36],F=t[37]),(0,Q.useEffect)(P,F);let I,L;t[38]!==d||t[39]!==n.document||t[40]!==u?(I=()=>{let e=n.document.getMap(`agent-flash`),t=Date.now(),r=0,i=null,a=null,o=null,s=()=>{let t=null;for(let[,n]of e.entries()){let e=n;e.timestamp&&(!t||e.timestamp>t.timestamp)&&(t={agentId:e.agentId??`unknown`,timestamp:e.timestamp,type:e.type??`insert`,description:e.description})}return t},c=e=>{d.current=e;let t=u.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??``))},l=()=>{let e=s(),t=e?.description?.toLowerCase().includes(`prepend`)?`prepend`:`append`,n={state:`editing`,count:(d.current?.count??0)+1,lastFiredAt:Date.now(),position:t,lastAgentId:e?.agentId??null};c(n),document.dispatchEvent(new CustomEvent(`agent-flash`,{detail:n})),a&&clearTimeout(a),o&&clearTimeout(o),a=window.setTimeout(()=>{let e={...n,state:`settled`};c(e),document.dispatchEvent(new CustomEvent(`agent-flash-end`,{detail:e})),o=window.setTimeout(()=>{c({...e,state:`idle`})},300)},Ca)};c(nA);let f=()=>{if(So(e),!va(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(),l()},e)}return}r=n,l()};e.observe(f);let p=()=>{document.visibilityState===`visible`?va(e,t)&&(t=Date.now(),r=Date.now(),l()):t=Date.now()};return document.addEventListener(`visibilitychange`,p),()=>{e.unobserve(f),document.removeEventListener(`visibilitychange`,p),i&&clearTimeout(i),a&&clearTimeout(a),o&&clearTimeout(o)}},L=[n.document,d,u],t[38]=d,t[39]=n.document,t[40]=u,t[41]=I,t[42]=L):(I=t[41],L=t[42]),(0,Q.useEffect)(I,L);let R=(0,Q.useRef)(null),z;t[43]!==a||t[44]!==i||t[45]!==l||t[46]!==n?(z=()=>{let e=jk(),t=n.document.getMap(`agent-flash`),r=null,o=!1;queueMicrotask(()=>{o||l.isDestroyed||l.registerPlugin(e)});let s=[],c=()=>l.editorView??null,u=(e,t,n)=>{if(e.dispatch(e.state.tr.setMeta(Dk,{add:{from:t,to:n},now:Date.now()})),r!==null&&clearTimeout(r),r=window.setTimeout(()=>{r=null;let e=c();e?.dispatch(e.state.tr.setMeta(Dk,{now:Date.now(),sweep:!0}))},Ek+50),!il()||document.visibilityState!==`visible`||e.hasFocus())return;let i=()=>{let e=c();if(!(e==null||e.hasFocus()||document.visibilityState!==`visible`))try{let r=e.state.doc.content.size,i=Math.max(0,Math.min(Math.floor((t+n)/2),r-1)),a=e.domAtPos(i),o=a.node,s=o.nodeType===Node.TEXT_NODE?o.parentElement:o.childNodes[a.offset]??o,c=s instanceof HTMLElement?s:s?.parentElement??null;if(c==null)return;let l=c.getBoundingClientRect();if(l.top>=0&&l.bottom<=window.innerHeight)return;c.scrollIntoView({block:`center`,behavior:`smooth`})}catch{}};requestAnimationFrame(i),s.push(window.setTimeout(i,250),window.setTimeout(i,550))},d=e=>{let{transaction:n}=e;if(!n.docChanged||n.getMeta(p)?.isChangeOrigin!==!0||!va(t,Date.now()-1400)||i!==a)return;let r=rA(t,Date.now()-Ek);if(r!==null&&r.key===R.current)return;let o=Ok(n.before,n.doc);if(o===null)return;let s=c();s!=null&&(r!==null&&(R.current=r.key),u(s,o.from,o.to))};l.on(`transaction`,d);let f=()=>{if(o||i!==a)return;let e=c();if(e==null)return;let n=rA(t,Date.now()-kk);if(n===null||n.key===R.current)return;let r=n.entry.changedBlocks;if(r===void 0)return;let s=Ak(e.state.doc,r.from,r.to);s!==null&&(R.current=n.key,u(e,s.from,s.to))},m=requestAnimationFrame(f),h=()=>{requestAnimationFrame(f)};return n.on(`synced`,h),()=>{o=!0,l.off(`transaction`,d),n.off(`synced`,h),cancelAnimationFrame(m),r!==null&&clearTimeout(r);for(let e of s)clearTimeout(e);l.unregisterPlugin(Dk)}},t[43]=a,t[44]=i,t[45]=l,t[46]=n,t[47]=z):z=t[47];let B;t[48]!==a||t[49]!==i||t[50]!==l||t[51]!==n.document||t[52]!==n.off||t[53]!==n.on?(B=[l,n.document,i,a,n.on,n.off],t[48]=a,t[49]=i,t[50]=l,t[51]=n.document,t[52]=n.off,t[53]=n.on,t[54]=B):B=t[54],(0,Q.useEffect)(z,B);let V,H;t[55]!==a||t[56]!==i||t[57]!==l||t[58]!==n?(V=()=>{let e=0,t,r=null,o=null,s=null,c=function(){if(e<iA){e+=1,t=window.setTimeout(p,aA);return}r=null,o=null,e=0},u=function(e){let t=En(l);if(!t)return null;let n=CSS.escape(e);return t.dom.querySelector(`#${n}`)??t.dom.querySelector(`[data-mirror-source-id="${n}"]`)},d=function(e){let t=u(e);return t?(t.scrollIntoView({behavior:`smooth`,block:`start`}),!0):!1},f=function(e,n){let r=oA,o=()=>{t=void 0,!(i!==a||window.location.hash!==n)&&(d(e),--r,r>0&&(t=window.setTimeout(o,sA)))};t=window.setTimeout(o,sA)};function p(){if(!r||i!==a)return;let t=r,n=o;if(!n){c();return}d(t)?(s=n,r=null,o=null,e=0,f(t,n)):c()}let m=function(){if(i!==a)return;let n=window.location.hash;if(!r&&s===n)return;let c=uu(n);if(!c){s=n;return}r=c,o=n,e=0,t!==void 0&&(clearTimeout(t),t=void 0),p()},h=function(){if(i===a){if(r){p();return}m()}};return m(),n.on(`synced`,h),l.on(`transaction`,h),window.addEventListener(`hashchange`,m),()=>{t!==void 0&&clearTimeout(t),n.off(`synced`,h),l.off(`transaction`,h),window.removeEventListener(`hashchange`,m)}},H=[n,l,i,a],t[55]=a,t[56]=i,t[57]=l,t[58]=n,t[59]=V,t[60]=H):(V=t[59],H=t[60]),(0,Q.useEffect)(V,H);let U,W;t[61]===l?(U=t[62],W=t[63]):(U=()=>{let e=function(e){let t=e.detail;if(!t||t.mode!==`wysiwyg`||l.isDestroyed)return;let n=En(l);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(pd,e),()=>window.removeEventListener(pd,e)},W=[l],t[61]=l,t[62]=U,t[63]=W),(0,Q.useEffect)(U,W);let ee;t[64]!==a||t[65]!==i||t[66]!==o||t[67]!==r||t[68]!==c||t[69]!==n.awareness?(ee=()=>{let e=n.awareness;if(e){if(i!==a){e.setLocalState(null);return}e.setLocalState({user:lD({principal:c,identity:o}),mode:r?`source`:`wysiwyg`})}},t[64]=a,t[65]=i,t[66]=o,t[67]=r,t[68]=c,t[69]=n.awareness,t[70]=ee):ee=t[70];let G;t[71]!==a||t[72]!==i||t[73]!==o||t[74]!==r||t[75]!==c||t[76]!==n?(G=[n,i,a,o,c,r],t[71]=a,t[72]=i,t[73]=o,t[74]=r,t[75]=c,t[76]=n,t[77]=G):G=t[77],(0,Q.useEffect)(ee,G);let K,te;t[78]!==l||t[79]!==r?(K=()=>(Mn(l,r),()=>{Mn(l,!1)}),te=[l,r],t[78]=l,t[79]=r,t[80]=K,t[81]=te):(K=t[80],te=t[81]),(0,Q.useEffect)(K,te);let ne;t[82]!==a||t[83]!==i||t[84]!==l||t[85]!==r?(ne=!r&&(0,Z.jsx)(ok,{editor:l,shortcutEnabled:i===a}),t[82]=a,t[83]=i,t[84]=l,t[85]=r,t[86]=ne):ne=t[86];let re;t[87]!==l||t[88]!==r?(re=!r&&(0,Z.jsx)(Qk,{editor:l}),t[87]=l,t[88]=r,t[89]=re):re=t[89];let ie;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,Z.jsx)(`div`,{ref:m,style:{display:`contents`}}),t[90]=ie):ie=t[90];let ae;t[91]!==l||t[92]!==h?(ae=(0,Z.jsx)(Vn,{editor:l,className:`tiptap-editor-portal-content h-full`},h),t[91]=l,t[92]=h,t[93]=ae):ae=t[93];let oe;t[94]!==f||t[95]!==ae?(oe=(0,Sw.createPortal)(ae,f),t[94]=f,t[95]=ae,t[96]=oe):oe=t[96];let se;t[97]===l?se=t[98]:(se=(0,Z.jsx)(VE,{editor:l}),t[97]=l,t[98]=se);let ce;t[99]===l?ce=t[100]:(ce=g(l),t[99]=l,t[100]=ce);let le;t[101]===ce.store?le=t[102]:(le=(0,Z.jsx)(w,{store:ce.store}),t[101]=ce.store,t[102]=le);let ue;return t[103]!==ne||t[104]!==re||t[105]!==oe||t[106]!==se||t[107]!==le||t[108]!==u?(ue=(0,Z.jsxs)(`div`,{ref:u,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:[ne,re,ie,oe,se,le]}),t[103]=ne,t[104]=re,t[105]=oe,t[106]=se,t[107]=le,t[108]=u,t[109]=ue):ue=t[109],ue};function _A(e){return e+1}function vA(){return jn()}var yA=null;function bA(e){let t=(0,$.c)(3),n=(0,Q.useRef)(null),r,i;return t[0]===e?(r=t[1],i=t[2]):(r=()=>{if(!e)return;let t=n.current;if(!t)return;let r={};yA=r;let i=document.documentElement,a=null,o=()=>{if(yA!==r)return;let e=`${t.offsetHeight}px`;e!==a&&(a=e,i.style.setProperty(`--conflict-footer-height`,e))};o();let s=new ResizeObserver(o);return s.observe(t),()=>{s.disconnect(),yA===r&&(yA=null,i.style.removeProperty(`--conflict-footer-height`))}},i=[e],t[0]=e,t[1]=r,t[2]=i),(0,Q.useEffect)(r,i),n}var xA=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 SA(e,t,n,r,i,a){if(e==r)return[];let o=MA(e,t,n,r,i,a),s=NA(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 xA(t,n,i,a)];if(c>l){let o=e.slice(t,n).indexOf(r.slice(i,a));if(o>-1)return[new xA(t,t+o,i,i),new xA(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 xA(t,t,i,i+o),new xA(n,n,i+o+c,a)]}if(c==1||l==1)return[new xA(t,n,i,a)];let u=FA(e,t,n,r,i,a);if(u){let[o,s,c]=u;return SA(e,t,o,r,i,s).concat(SA(e,o+c,n,r,s+c,a))}return EA(e,t,n,r,i,a)}var CA=1e9,wA=0,TA=!1;function EA(e,t,n,r,i,a){let o=n-t,s=a-i;if(CA<1e9&&Math.min(o,s)>CA*16||wA>0&&Date.now()>wA)return Math.min(o,s)>CA*64?[new xA(t,n,i,a)]:IA(e,t,n,r,i,a);let c=Math.ceil((o+s)/2);OA.reset(c),kA.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:kA,f=d?null:OA;for(let p=0;p<c;p++){if(p>CA||wA>0&&!(p&63)&&Date.now()>wA)return IA(e,t,n,r,i,a);let m=OA.advance(p,o,s,c,d,!1,l)||kA.advance(p,o,s,c,f,!0,u);if(m)return AA(e,t,n,t+m[0],r,i,a,i+m[1])}return[new xA(t,n,i,a)]}var DA=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}},OA=new DA,kA=new DA;function AA(e,t,n,r,i,a,o,s){let c=!1;return!ZA(e,r)&&++r==n&&(c=!0),!ZA(i,s)&&++s==o&&(c=!0),c?[new xA(t,n,a,o)]:SA(e,t,r,i,a,s).concat(SA(e,r,n,i,s,o))}function jA(e,t){let n=1,r=Math.min(e,t);for(;n<r;)n<<=1;return n}function MA(e,t,n,r,i,a){if(t==n||t==a||e.charCodeAt(t)!=r.charCodeAt(i))return 0;let o=jA(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-+!ZA(e,s);o>>=1}else if(i==n||l==a)return i-t;else s=i,c=l}}function NA(e,t,n,r,i,a){if(t==n||i==a||e.charCodeAt(n-1)!=r.charCodeAt(a-1))return 0;let o=jA(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-+!ZA(e,s);o>>=1}else if(a==t||l==i)return n-a;else s=a,c=l}}function PA(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;;){ZA(e,s)||s++;let u=s+o;if(ZA(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=MA(e,u,n,r,i+f+d.length,a),c=NA(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 FA(e,t,n,r,i,a){let o=n-t,s=a-i;if(o<s){let o=FA(r,i,a,e,t,n);return o&&[o[1],o[0],o[2]]}return o<4||s*2<o?null:PA(e,t,n,r,i,a,Math.floor(o/4),-1)}function IA(e,t,n,r,i,a){TA=!0;let o=n-t,s=a-i,c;if(o<s){let s=PA(r,i,a,e,t,n,Math.floor(o/6),50);c=s&&[s[1],s[0],s[2]]}else c=PA(e,t,n,r,i,a,Math.floor(s/6),50);if(!c)return[new xA(t,n,i,a)];let[l,u,d]=c;return SA(e,t,l,r,i,u).concat(SA(e,l+d,n,r,u+d,a))}function LA(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 xA(r.fromA,i.toA,r.fromB,i.toB),e.splice(n--,1))}}function RA(e,t,n){for(;;){LA(n,1);let r=!1;for(let i=0;i<n.length;i++){let a=n[i],o,s;(o=MA(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new xA(a.fromA+o,a.toA,a.fromB+o,a.toB)),(s=NA(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new xA(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 xA(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 xA(a.fromA+d,a.toA+d,a.fromB+d,a.toB+d),r=!0)}if(!r)break}return n}function zA(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=KA(t,a.fromA,l),f=GA(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 xA(d,d+o,a.fromB-p,a.toB-p),d=a.fromA,f=GA(t,a.toA,c-a.toA)):l>m&&t.slice(a.toA,f)==u.slice(h,h+m)&&(a=e[i]=new xA(f-o,f,a.fromB+m,a.toB+m),f=a.toA,d=KA(t,a.fromA,a.fromA-r)),p=a.fromA-d,m=f-a.toA}if(p||m)a=e[i]=new xA(a.fromA-p,a.toA+m,a.fromB-p,a.toB+m);else if(!o){let t=JA(n,a.fromB,a.toB),r,o=t<0?-1:qA(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=JA(t,a.fromA,a.toA),r,o=n<0?-1:qA(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 LA(e,3),e}var BA;try{BA=RegExp(`[\\p{Alphabetic}\\p{Number}]`,`u`)}catch{}function VA(e){return e>48&&e<58||e>64&&e<91||e>96&&e<123}function HA(e,t){if(t==e.length)return 0;let n=e.charCodeAt(t);return n<192?+!!VA(n):BA?!YA(n)||t==e.length-1?+!!BA.test(String.fromCharCode(n)):BA.test(e.slice(t,t+2))?2:0:0}function UA(e,t){if(!t)return 0;let n=e.charCodeAt(t-1);return n<192?+!!VA(n):BA?!XA(n)||t==1?+!!BA.test(String.fromCharCode(n)):BA.test(e.slice(t-2,t))?2:0:0}var WA=8;function GA(e,t,n){if(t==e.length||!UA(e,t))return t;for(let r=t,i=t+n,a=0;a<WA;a++){let t=HA(e,r);if(!t||r+t>i)return r;r+=t}return t}function KA(e,t,n){if(!t||!HA(e,t))return t;for(let r=t,i=t-n,a=0;a<WA;a++){let t=UA(e,r);if(!t||r-t<i)return r;r-=t}return t}function qA(e,t,n){for(;t!=n;t--)if(e.charCodeAt(t-1)==10)return t;return-1}function JA(e,t,n){for(;t!=n;t++)if(e.charCodeAt(t)==10)return t;return-1}var YA=e=>e>=55296&&e<=56319,XA=e=>e>=56320&&e<=57343;function ZA(e,t){return!t||t==e.length||!YA(e.charCodeAt(t-1))||!XA(e.charCodeAt(t))}function QA(e,t,n){let r=n?.override;return r?r(e,t):(CA=(n?.scanLimit??1e9)>>1,wA=n?.timeout?Date.now()+n.timeout:0,TA=!1,RA(e,t,SA(e,0,e.length,t,0,t.length)))}function $A(){return!TA}function ej(e,t,n){return zA(QA(e,t,n),e,t)}var tj=Iu.define({combine:e=>e[0]}),nj=Cu.define(),rj=Iu.define(),ij=Tu.define({create(e){return null},update(e,t){for(let n of t.effects)n.is(nj)&&(e=n.value);for(let n of t.state.facet(rj))e=n(e,t);return e}});function aj(e){let t=e.field(ij,!1);if(!t)return null;let n=e.facet(tj);return{chunks:t,side:n?n.side:null}}var oj=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 lj(ej(e.toString(),t.toString(),n),e,t,0,0,$A())}static updateA(e,t,n,r,i){return pj(fj(e,r,!0,n.length),e,t,n,i)}static updateB(e,t,n,r,i){return pj(fj(e,r,!1,t.length),e,t,n,i)}};function sj(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 cj(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 lj(e,t,n,r,i,a){let o=[];for(let s=0;s<e.length;s++){let c=e[s],[l,u]=sj(c.fromA+r,c.fromB+i,t,n),[d,f]=cj(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]=sj(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]=cj(a.toA+r,a.toB+i,t,n),s++}o.push(new oj(p,l,Math.max(l,d),u,Math.max(u,f),a))}return o}var uj=1e3;function dj(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 fj(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>uj&&([l,d]=dj(e,a-uj,n,!0)),o<t.length-uj&&([u,f]=dj(e,o+uj,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 pj(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=ej(n.sliceString(d,p),r.sliceString(f,m),i);for(let e of lj(h,n,r,d,f,$A()))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 mj={scanLimit:500},hj=ju.fromClass(class{constructor(e){({deco:this.deco,gutter:this.gutter}=Tj(e))}update(e){(e.docChanged||e.viewportChanged||_j(e.startState,e.state)||vj(e.startState,e.state))&&({deco:this.deco,gutter:this.gutter}=Tj(e.view))}},{decorations:e=>e.deco}),gj=Pu.low(Lu({class:`cm-changeGutter`,markers:e=>e.plugin(hj)?.gutter||Ou.empty}));function _j(e,t){return e.field(ij,!1)!=t.field(ij,!1)}function vj(e,t){return e.facet(tj)!=t.facet(tj)}var yj=Eu.line({class:`cm-changedLine`}),bj=Eu.mark({class:`cm-changedText`}),xj=Eu.mark({tagName:`ins`,class:`cm-insertedLine`}),Sj=Eu.mark({tagName:`del`,class:`cm-deletedLine`}),Cj=new class extends Nu{constructor(){super(...arguments),this.elementClass=`cm-changedLineGutter`}};function wj(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,yj),i.add(o,s,n?Sj:xj),a&&a.add(o,o,Cj);for(let l=t.iterRange(o,s-1),u=o;!l.next().done;){if(l.lineBreak){u++,i.add(u,u,yj),a&&a.add(u,u,Cj);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,bj),s<t)c++;else break}u=t}}}function Tj(e){let t=e.state.field(ij),{side:n,highlightChanges:r,markGutter:i,overrideChunk:a}=e.state.facet(tj),o=n==`a`,s=new ku,c=i?new ku: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))&&wj(n,e.state.doc,o,r,s,c)}return{deco:s.finish(),gutter:c&&c.finish()}}var Ej=class extends xu{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}},Dj=Cu.define({map:(e,t)=>e.map(t)}),Oj=Tu.define({create:()=>Eu.none,update:(e,t)=>{for(let e of t.effects)if(e.is(Dj))return e.value;return e.map(t.changes)},provide:e=>Mu.decorations.from(e)}),kj=.01;function Aj(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 jj(e,t,n){let r=new ku,i=new ku,a=e.state.field(Oj).iter(),o=t.state.field(Oj).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<-kj?(l-=n,r.add(s,s,Eu.widget({widget:new Ej(-n),block:!0,side:-1}))):n>kj&&(u+=n,i.add(c,c,Eu.widget({widget:new Ej(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<kj?r.add(e.state.doc.length,e.state.doc.length,Eu.widget({widget:new Ej(-p),block:!0,side:1})):p>kj&&i.add(t.state.doc.length,t.state.doc.length,Eu.widget({widget:new Ej(p),block:!0,side:1}));let m=r.finish(),h=i.finish();Aj(m,e.state.field(Oj))||e.dispatch({effects:Dj.of(m)}),Aj(h,t.state.field(Oj))||t.dispatch({effects:Dj.of(h)})}var Mj=Cu.define({map:(e,t)=>t.mapPos(e)}),Nj=class extends xu{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:Mj.of(n)});let{side:r,sibling:i}=e.state.facet(tj);i&&i().dispatch({effects:Mj.of(Pj(n,e.state.field(ij),r==`a`))})}),t}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return`collapsed-unchanged-code`}};function Pj(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 Fj=Tu.define({create(e){return Eu.none},update(e,t){e=e.map(t.changes);for(let n of t.effects)n.is(Mj)&&(e=e.update({filter:e=>e!=n.value}));if(e.size&&t.state.field(ij)!=t.startState.field(ij,!1)){let n=t.state.facet(tj).side==`a`,r=[];for(let i of t.state.field(ij))e.between(n?i.fromA:i.fromB,n?i.toA:i.toB,e=>{r.push(e)});r.length&&(e=e.update({filter:e=>r.indexOf(e)<0}))}return e},provide:e=>Mu.decorations.from(e)});function Ij({margin:e=3,minSize:t=4}){return Fj.init(n=>Lj(n,e,t))}function Lj(e,t,n){let r=new ku,i=e.facet(tj).side==`a`,a=e.field(ij),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,Eu.replace({widget:new Nj(d),block:!0})),!c)break;o=e.doc.lineAt(Math.min(e.doc.length,i?c.toA:c.toB)).number}return r.finish()}var Rj=Mu.styleModule.of(new Bu({".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`}})),zj=Mu.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`}}),Bj=new Su,Vj=new Su,Hj=class{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig||mj;let t=[Pu.low(hj),zj,Rj,Oj,Mu.updateListener.of(e=>{this.measuring<0&&(e.heightChanged||e.viewportChanged)&&!e.transactions.some(e=>e.effects.some(e=>e.is(Dj)))&&this.measure()})],n=[tj.of({side:`a`,sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&n.push(gj);let r=Au.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],Mu.editorAttributes.of({class:`cm-merge-a`}),Vj.of(n),t]}),i=[tj.of({side:`b`,sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&i.push(gj);let a=Au.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],Mu.editorAttributes.of({class:`cm-merge-b`}),Vj.of(i),t]});this.chunks=oj.build(r.doc,a.doc,this.diffConf);let o=[ij.init(()=>this.chunks),Bj.of(e.collapseUnchanged?Ij(e.collapseUnchanged):[])];r=r.update({effects:Cu.appendConfig.of(o)}).state,a=a.update({effects:Cu.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 Mu({state:r,parent:c,root:e.root,dispatchTransactions:e=>this.dispatch(e,this.a)}),this.b=new Mu({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),zu.empty(e[0].startState.doc.length));this.chunks=t==this.a?oj.updateA(this.chunks,n.newDoc,this.b.state.doc,r,this.diffConf):oj.updateB(this.chunks,this.a.state.doc,n.newDoc,r,this.diffConf),t.update([...e,n.state.update({effects:nj.of(this.chunks)})]);let i=t==this.a?this.b:this.a;i.update([i.state.update({effects:nj.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(tj),o=n?e.gutter!==!1:r.markGutter,s=t?e.highlightChanges!==!1:r.highlightChanges;i.push(Vj.reconfigure([tj.of({side:`a`,sibling:()=>this.b,highlightChanges:s,markGutter:o}),o?gj:[]])),a.push(Vj.reconfigure([tj.of({side:`b`,sibling:()=>this.a,highlightChanges:s,markGutter:o}),o?gj:[]]))}if(r){let t=Bj.reconfigure(e.collapseUnchanged?Ij(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(){jj(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=Uj(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=Uj(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 Uj(e){let t=e.nextSibling;return e.remove(),t}var Wj=new class extends Nu{constructor(){super(...arguments),this.elementClass=`cm-deletedLineGutter`}},Gj=Pu.low(Lu({class:`cm-changeGutter`,markers:e=>e.plugin(hj)?.gutter||Ou.empty,widgetMarker:(e,t)=>t instanceof Xj?Wj:null}));function Kj(e){let t=typeof e.original==`string`?Du.of(e.original.split(/\r?\n/)):e.original,n=e.diffConfig||mj;return[Pu.low(hj),tM,zj,Mu.editorAttributes.of({class:`cm-merge-b`}),rj.of((e,t)=>{let r=t.effects.find(e=>e.is(qj));return r&&(e=oj.updateA(e,r.value.doc,t.startState.doc,r.value.changes,n)),t.docChanged&&(e=oj.updateB(e,t.state.field(Jj),t.newDoc,t.changes,n)),e}),tj.of({highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1,syntaxHighlightDeletions:e.syntaxHighlightDeletions!==!1,syntaxHighlightDeletionsMaxLength:3e3,mergeControls:e.mergeControls??!0,overrideChunk:e.allowInlineDiffs?sM:void 0,side:`b`}),Jj.init(()=>t),e.gutter===!1?[]:Gj,e.collapseUnchanged?Ij(e.collapseUnchanged):[],ij.init(e=>oj.build(t,e.doc,n))]}var qj=Cu.define(),Jj=Tu.define({create:()=>Du.empty,update(e,t){for(let n of t.effects)n.is(qj)&&(e=n.value.doc);return e}}),Yj=new WeakMap,Xj=class extends xu{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 Zj(e,t,n){let r=Yj.get(t.changes);if(r)return r;let i=Eu.widget({block:!0,side:-1,widget:new Xj(r=>{let{highlightChanges:i,syntaxHighlightDeletions:a,syntaxHighlightDeletionsMaxLength:o,mergeControls:s}=e.facet(tj),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(),Qj(r,r.posAtDOM(c))},i=e=>{e.preventDefault(),$j(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(Jj).sliceString(t.fromA,t.endA),u=a&&e.facet(Fu),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)==`
20
20
  `){d.firstChild||d.appendChild(document.createElement(`br`)),d=h(),r++;continue}let e=t,a=n+(m?` cm-deletedText`:``),o=!1,s=l.indexOf(`
21
- `,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;wu(t,{style:t=>Ru(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 Yj.set(t.changes,i),i}function Qj(e,t){let{state:n}=e,r=t??n.selection.main.head,i=e.state.field(ij).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(Jj);i.fromB!=i.toB&&i.toA<=o.length&&(a+=e.state.lineBreak);let s=zu.of({from:i.fromA,to:Math.min(o.length,i.toA),insert:a},o.length);return e.dispatch({effects:qj.of({doc:s.apply(o),changes:s}),userEvent:`accept`}),!0}function $j(e,t){let{state:n}=e,r=t??n.selection.main.head,i=n.field(ij).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=n.field(Jj).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 eM(e){let t=new ku;for(let n of e.field(ij)){let r=e.facet(tj).overrideChunk&&rM(e,n);t.add(n.fromB,n.fromB,Zj(e,n,!!r))}return t.finish()}var tM=Tu.define({create:e=>eM(e),update(e,t){return t.state.field(ij,!1)==t.startState.field(ij,!1)?e:eM(t.state)},provide:e=>Mu.decorations.from(e)}),nM=new WeakMap;function rM(e,t){let n=nM.get(t);if(n!==void 0)return n;n=null;let r=e.field(Jj),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(Eu.widget({widget:new iM(t),side:-1}).range(s+n.fromB))}n.fromB<n.toB&&e.push(bj.range(s+n.fromB,s+n.toB))}i<t.endA-t.fromA-a*2&&(n=e)}return nM.set(t,n),n}var iM=class extends xu{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}},aM=new class extends Nu{constructor(){super(...arguments),this.elementClass=`cm-inlineChangedLineGutter`}},oM=Eu.line({class:`cm-inlineChangedLine`});function sM(e,t,n,r){let i=rM(e,t),a=0;if(!i)return!1;for(let o=e.doc.lineAt(t.fromB);;){for(r&&r.add(o.from,o.from,aM),n.add(o.from,o.from,oM);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 cM=Nn({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),lM=er({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),uM=Mu.theme({".cm-deletedChunk .cm-chunkButtons":{display:`flex`,gap:`0.25rem`},".cm-deletedChunk .cm-chunkButtons button[data-slot='button']":{margin:`0`,border:`1px solid transparent`,borderRadius:`min(var(--radius-md), 10px)`,color:`var(--primary-foreground)`},".cm-deletedChunk .cm-chunkButtons button[data-slot='button'][data-variant='destructive']":{color:`var(--destructive)`}});function dM({addControl:e,nextId:t,removeControl:n,root:r}){return(i,a)=>{let o=document.createElement(`span`);o.className=`inline-flex`;let s=t();return e({id:s,host:o,type:i,action:a}),queueMicrotask(()=>{r.contains(o)||n(s)}),o}}function fM(e){let t=(0,$.c)(33),{oldContent:n,newContent:r,layout:i,conflictMode:a,previewMode:o,oursOverride:s,onResolve:c,onAbort:l}=e,{_:u}=vt(),d=s??r,f=(0,Q.useRef)(null),p=(0,Q.useRef)(null),m=(0,Q.useRef)(0),{resolvedTheme:h}=zt(),g=(0,Q.useRef)(c),_=(0,Q.useRef)(l),[v,y]=(0,Q.useState)(null),b;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(b=[],t[0]=b):b=t[0];let[x,S]=(0,Q.useState)(b),C=bA(a===!0),w;t[1]!==l||t[2]!==c?(w=()=>{g.current=c,_.current=l},t[1]=l,t[2]=c,t[3]=w):w=t[3],(0,Q.useEffect)(w);let T,E;t[4]!==a||t[5]!==d||t[6]!==i||t[7]!==n||t[8]!==o||t[9]!==h?(T=()=>{let e=f.current;if(!e)return;S([]);let t=new Map,r=!1,s=e=>{r||!t.delete(e)||S(t=>t.filter(t=>t.id!==e))},c=new MutationObserver(()=>{for(let[n,r]of t)e.contains(r)||s(n)});c.observe(e,{childList:!0,subtree:!0});let l=h===`dark`?cM:lM,u=[Mu.editable.of(!1),Au.readOnly.of(!0)],g=[jd,Vu(),...u,l,Mu.lineWrapping];if(p.current&&=(p.current.destroy(),null),o)p.current=new Mu({doc:d,extensions:g,parent:e}),y(null);else if(a){let i=dM({addControl:e=>{r||(t.set(e.id,e.host),S(t=>[...t,e]))},nextId:()=>(m.current+=1,m.current),removeControl:s,root:e}),a=new Mu({doc:d,extensions:[jd,Vu(),Mu.editable.of(!1),l,uM,Mu.lineWrapping,Kj({original:n,highlightChanges:!0,gutter:!0,mergeControls:i,collapseUnchanged:{margin:3,minSize:4}}),Mu.updateListener.of(e=>{let t=aj(e.state);y(t?t.chunks.length:0)})],parent:e});p.current=a;let o=aj(a.state);y(o?o.chunks.length:0)}else i===`split`?p.current=new Hj({a:{doc:n,extensions:g},b:{doc:d,extensions:g},parent:e,highlightChanges:!0,gutter:!0,collapseUnchanged:{margin:3,minSize:4}}):p.current=new Mu({doc:d,extensions:[...g,Kj({original:n,highlightChanges:!0,gutter:!0,mergeControls:!1,collapseUnchanged:{margin:3,minSize:4}})],parent:e});return()=>{r=!0,c.disconnect(),p.current&&=(p.current.destroy(),null)}},E=[n,d,i,h,a,o],t[4]=a,t[5]=d,t[6]=i,t[7]=n,t[8]=o,t[9]=h,t[10]=T,t[11]=E):(T=t[10],E=t[11]),(0,Q.useEffect)(T,E);let D;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(D=function(){let e=p.current;!e||!(e instanceof Mu)||g.current?.(e.state.doc.toString())},t[12]=D):D=t[12];let O=D,k;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(k=function(){let e=p.current;!e||!(e instanceof Mu)||Dn(e)},t[13]=k):k=t[13];let A=k,j=v===0,M;t[14]!==u||t[15]!==v?(M=v===null?``:v===0?u({id:`lPzyrU`}):yl._({id:`8FqTCr`,values:{chunksRemaining:v}}),t[14]=u,t[15]=v,t[16]=M):M=t[16];let N=M,P;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(`div`,{ref:f,className:`diff-view min-h-0 flex-1 overflow-y-auto subtle-scrollbar`}),t[17]=P):P=t[17];let F;if(t[18]!==u||t[19]!==x){let e;t[21]===u?e=t[22]:(e=e=>(0,Sw.createPortal)((0,Z.jsx)(Y,{type:`button`,variant:e.type===`accept`?`default`:`destructive`,size:`xs`,onClick:t=>{e.action(t.nativeEvent)},children:e.type===`accept`?u({id:`g3UF2V`}):u({id:`1t_NnN`})}),e.host,e.id),t[21]=u,t[22]=e),F=x.map(e),t[18]=u,t[19]=x,t[20]=F}else F=t[20];let I;t[23]!==j||t[24]!==C||t[25]!==a||t[26]!==N||t[27]!==l||t[28]!==c?(I=a&&(0,Z.jsxs)(`div`,{ref:C,className:`flex items-center justify-between gap-2 px-3 py-2 border-t shrink-0`,children:[(0,Z.jsx)(`span`,{className:`text-xs ${j?`text-emerald-600 dark:text-emerald-400`:`text-muted-foreground`}`,children:N}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[l&&(0,Z.jsx)(Y,{className:`uppercase font-mono`,variant:`ghost`,size:`sm`,onClick:l,children:(0,Z.jsx)(J,{id:`XyOUTJ`})}),(0,Z.jsx)(Y,{className:`uppercase font-mono`,variant:`outline`,size:`sm`,onClick:A,children:`Undo`}),c&&(0,Z.jsx)(Y,{variant:`default`,size:`sm`,disabled:!j,onClick:O,children:(0,Z.jsx)(J,{id:`Lcehxn`})})]})]}),t[23]=j,t[24]=C,t[25]=a,t[26]=N,t[27]=l,t[28]=c,t[29]=I):I=t[29];let L;return t[30]!==I||t[31]!==F?(L=(0,Z.jsxs)(`div`,{className:`flex flex-col h-full`,children:[P,F,I]}),t[30]=I,t[31]=F,t[32]=L):L=t[32],L}async function pM(e,t,n){try{let r={file:e,strategy:t};n!==void 0&&(r.content=n);let i=await fetch(`/api/sync/resolve-conflict`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(r)});if(i.ok)return{ok:!0};let a;try{let e=await i.json();typeof e.detail==`string`?a=e.detail:typeof e.title==`string`&&(a=e.title)}catch{}return{ok:!1,detail:a}}catch(n){let r=n instanceof Error?n.message:String(n);return console.warn(JSON.stringify({event:`conflict-resolve-dispatch-failed`,file:e,strategy:t,detail:r})),{ok:!1,detail:r}}}async function mM(e,t){return pM(e,`content`,t)}async function hM(e){return pM(e,`mine`)}async function gM(e){return pM(e,`theirs`)}async function _M(e){return pM(e,`delete`)}async function vM(e){try{let t=await fetch(`/api/sync/conflict-content?file=${encodeURIComponent(e)}&source=ytext`);if(!t.ok){let n;try{let e=await t.json();typeof e.detail==`string`?n=e.detail:typeof e.title==`string`&&(n=e.title)}catch{}return console.warn(JSON.stringify({event:`conflict-content-fetch-failed`,file:e,status:t.status,detail:n})),null}let n=await t.json(),r=n.kind===`delete-modify`||n.kind===`modify-delete`||n.kind===`both-modified`?n.kind:`both-modified`;return n.kind!==r&&console.warn(JSON.stringify({event:`conflict-kind-missing-fallback`,file:e,receivedKind:n.kind??null})),{base:n.base??``,ours:n.ours??``,theirs:n.theirs??``,kind:r}}catch(t){return console.warn(JSON.stringify({event:`conflict-content-fetch-failed`,file:e,status:null,detail:t instanceof Error?t.message:String(t)})),null}}function yM(e){let t=(0,$.c)(86),{docName:n}=e,{_:r}=vt(),{conflicts:i,loading:a}=yi(),o;if(t[0]!==i||t[1]!==n){let e;t[3]===n?e=t[4]:(e=e=>eu(e.file)===n,t[3]=n,t[4]=e),o=i.find(e),t[0]=i,t[1]=n,t[2]=o}else o=t[2];let s=o,c=s?.file??`${n}.md`,[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(!1),h=bA(l?.kind===`delete-modify`||l?.kind===`modify-delete`),g,_;t[5]===n?(g=t[6],_=t[7]):(g=()=>(console.warn(JSON.stringify({event:`editor-area-swap-to-diffview`,"doc.name":n})),()=>{console.warn(JSON.stringify({event:`editor-area-swap-from-diffview`,"doc.name":n}))}),_=[n],t[5]=n,t[6]=g,t[7]=_),(0,Q.useEffect)(g,_);let v=a||s===void 0,y,b;t[8]!==v||t[9]!==c?(y=()=>{if(v)return;let e=!1;return u(null),f(!1),vM(c).then(t=>{e||(t===null?f(!0):u(t))}),()=>{e=!0}},b=[c,v],t[8]=v,t[9]=c,t[10]=y,t[11]=b):(y=t[10],b=t[11]),(0,Q.useEffect)(y,b);let x;t[12]!==r||t[13]!==c?(x=async function(e){let t=await mM(c,e);t.ok||X.error(r({id:`K-h9cT`,values:{filePath:c}}),{description:t.detail})},t[12]=r,t[13]=c,t[14]=x):x=t[14];let S=x,C;t[15]!==r||t[16]!==c?(C=async function(e){m(!0);let t=await e(c);t.ok||(m(!1),X.error(r({id:`jPUPvG`,values:{filePath:c}}),{description:t.detail}))},t[15]=r,t[16]=c,t[17]=C):C=t[17];let w=C;if(d){let e;return t[18]===c?e=t[19]:(e=(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`ajz9F8`,values:{filePath:c}})}),t[18]=c,t[19]=e),e}if(l===null){let e;return t[20]===c?e=t[21]:(e=(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`DF1MtZ`,values:{filePath:c}})}),t[20]=c,t[21]=e),e}if(l.kind===`delete-modify`){let e;t[22]===l.theirs?e=t[23]:(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(fM,{oldContent:``,newContent:l.theirs,layout:`unified`,previewMode:!0})}),t[22]=l.theirs,t[23]=e);let n;t[24]===c?n=t[25]:(n={filePath:c},t[24]=c,t[25]=n);let r;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(r={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[26]=r):r=t[26];let i;t[27]===n?i=t[28]:(i=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`V48OUT`,values:n,components:r})}),t[27]=n,t[28]=i);let a;t[29]===w?a=t[30]:(a=()=>void w(_M),t[29]=w,t[30]=a);let o;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(J,{id:`Vlc75q`}),t[31]=o):o=t[31];let s;t[32]!==p||t[33]!==a?(s=(0,Z.jsx)(Y,{type:`button`,variant:`destructive`,disabled:p,onClick:a,children:o}),t[32]=p,t[33]=a,t[34]=s):s=t[34];let u;t[35]===w?u=t[36]:(u=()=>void w(gM),t[35]=w,t[36]=u);let d;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(J,{id:`3mFsc3`}),t[37]=d):d=t[37];let f;t[38]!==p||t[39]!==u?(f=(0,Z.jsx)(Y,{type:`button`,variant:`default`,disabled:p,onClick:u,children:d}),t[38]=p,t[39]=u,t[40]=f):f=t[40];let m;t[41]!==s||t[42]!==f?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-3`,children:[s,f]}),t[41]=s,t[42]=f,t[43]=m):m=t[43];let g;t[44]!==h||t[45]!==i||t[46]!==m?(g=(0,Z.jsxs)(`div`,{ref:h,className:`flex flex-shrink-0 flex-wrap items-center justify-between gap-x-6 gap-y-3 border-t px-6 py-4`,children:[i,m]}),t[44]=h,t[45]=i,t[46]=m,t[47]=g):g=t[47];let _;return t[48]!==g||t[49]!==e?(_=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[e,g]}),t[48]=g,t[49]=e,t[50]=_):_=t[50],_}if(l.kind===`modify-delete`){let e;t[51]===l.ours?e=t[52]:(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(fM,{oldContent:``,newContent:l.ours,layout:`unified`,previewMode:!0})}),t[51]=l.ours,t[52]=e);let n;t[53]===c?n=t[54]:(n={filePath:c},t[53]=c,t[54]=n);let r;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(r={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[55]=r):r=t[55];let i;t[56]===n?i=t[57]:(i=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`EhDLBx`,values:n,components:r})}),t[56]=n,t[57]=i);let a;t[58]===w?a=t[59]:(a=()=>void w(hM),t[58]=w,t[59]=a);let o;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(J,{id:`0NA4b3`}),t[60]=o):o=t[60];let s;t[61]!==p||t[62]!==a?(s=(0,Z.jsx)(Y,{type:`button`,variant:`default`,disabled:p,onClick:a,children:o}),t[61]=p,t[62]=a,t[63]=s):s=t[63];let u;t[64]===w?u=t[65]:(u=()=>void w(_M),t[64]=w,t[65]=u);let d;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(J,{id:`qSxaOz`}),t[66]=d):d=t[66];let f;t[67]!==p||t[68]!==u?(f=(0,Z.jsx)(Y,{type:`button`,variant:`destructive`,disabled:p,onClick:u,children:d}),t[67]=p,t[68]=u,t[69]=f):f=t[69];let m;t[70]!==s||t[71]!==f?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-3`,children:[s,f]}),t[70]=s,t[71]=f,t[72]=m):m=t[72];let g;t[73]!==h||t[74]!==i||t[75]!==m?(g=(0,Z.jsxs)(`div`,{ref:h,className:`flex flex-shrink-0 flex-wrap items-center justify-between gap-x-6 gap-y-3 border-t px-6 py-4`,children:[i,m]}),t[73]=h,t[74]=i,t[75]=m,t[76]=g):g=t[76];let _;return t[77]!==g||t[78]!==e?(_=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[e,g]}),t[77]=g,t[78]=e,t[79]=_):_=t[79],_}let T;t[80]===S?T=t[81]:(T=e=>void S(e),t[80]=S,t[81]=T);let E;return t[82]!==l.ours||t[83]!==l.theirs||t[84]!==T?(E=(0,Z.jsx)(fM,{oldContent:l.theirs,newContent:l.ours,layout:`unified`,conflictMode:!0,onResolve:T}),t[82]=l.ours,t[83]=l.theirs,t[84]=T,t[85]=E):E=t[85],E}function bM(e){let t=(0,$.c)(2),{docName:n,provider:r,children:i}=e;(0,Q.use)(it(n,r));let a;return t[0]===i?a=t[1]:(a=(0,Z.jsx)(Z.Fragment,{children:i}),t[0]=i,t[1]=a),a}var xM=`__back-nav__`;function SM(e){return e instanceof de||e instanceof Ve||e instanceof oe||e instanceof Te||e instanceof Qe||e instanceof we?e.docName:null}function CM(e){return e instanceof de||e instanceof Ve}function wM(e){if(e instanceof de){let t=e.docName;return{title:yl._({id:`Jejur6`}),summary:yl._({id:`jSY41h`,values:{docName:t}})}}if(e instanceof Ve){let t=e.docName;return{title:yl._({id:`V7QxyT`}),summary:yl._({id:`xG4tb6`,values:{docName:t}})}}if(e instanceof oe){let t=e.docName;return{title:yl._({id:`1di5fu`}),summary:yl._({id:`PQCdtv`,values:{docName:t}})}}if(e instanceof Te){let t=e.docName;return{title:yl._({id:`wvbc1r`}),summary:yl._({id:`IX7-sq`,values:{docName:t}})}}if(e instanceof Qe)return{title:yl._({id:`Gfr4fu`}),summary:yl._({id:`UW2Fg3`})};if(e instanceof we){let t=e.docName;return{title:yl._({id:`vv7kpg`}),summary:yl._({id:`mdKFEy`,values:{docName:t}})}}let t=e instanceof Error&&e.message?e.message:yl._({id:`W5A0Ly`});return{title:yl._({id:`29VNqC`}),summary:t}}function TM(e){let t=(0,$.c)(37),{error:n,resetErrorBoundary:r,activeDocName:i,previousDocName:a,onNavigateBack:o}=e,s;t[0]===n?s=t[1]:(s=wM(n),t[0]=n,t[1]=s);let{title:c,summary:l}=s,u=!!a&&!!o,d=(0,Q.useRef)(null),[f,p]=(0,Q.useState)(!1),m=typeof window<`u`?window.okDesktop:void 0,h=m&&CM(n)?m:null,g,_;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>{d.current?.focus()},_=[],t[2]=g,t[3]=_):(g=t[2],_=t[3]),(0,Q.useEffect)(g,_);let v;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(mp,{size:80,variant:`sleeping`}),t[4]=v):v=t[4];let y;t[5]===c?y=t[6]:(y=(0,Z.jsx)(`h2`,{id:`document-error-title`,className:`text-2xl font-light tracking-tighter text-balance`,children:c}),t[5]=c,t[6]=y);let b;t[7]===l?b=t[8]:(b=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-muted-foreground`,children:l}),t[7]=l,t[8]=b);let x;t[9]!==y||t[10]!==b?(x=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[y,b]}),t[9]=y,t[10]=b,t[11]=x):x=t[11];let S;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(J,{id:`KDw4GX`}),t[12]=S):S=t[12];let C;t[13]===r?C=t[14]:(C=(0,Z.jsx)(Y,{ref:d,variant:`default`,onClick:r,children:S}),t[13]=r,t[14]=C);let w;t[15]===h?w=t[16]:(w=h?(0,Z.jsx)(Y,{variant:`secondary`,onClick:()=>{Ev(h).then(DM).catch(EM)},children:(0,Z.jsx)(J,{id:`uaUc6t`})}):null,t[15]=h,t[16]=w);let T;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(T=m?(0,Z.jsx)(Y,{variant:`ghost`,className:`font-mono uppercase`,onClick:()=>p(!0),children:(0,Z.jsx)(J,{id:`ii5mVn`})}):null,t[17]=T):T=t[17];let E;t[18]!==i||t[19]!==u||t[20]!==n||t[21]!==o||t[22]!==a||t[23]!==r?(E=u?(0,Z.jsx)(Y,{variant:`ghost`,className:`font-mono uppercase`,onClick:()=>{!a||!o||(Me(SM(n)??i),o(a),r(xM))},children:(0,Z.jsx)(J,{id:`CKyk7Q`})}):null,t[18]=i,t[19]=u,t[20]=n,t[21]=o,t[22]=a,t[23]=r,t[24]=E):E=t[24];let D;t[25]!==w||t[26]!==E||t[27]!==C?(D=(0,Z.jsxs)(`div`,{className:`mt-1 flex gap-2`,children:[C,w,T,E]}),t[25]=w,t[26]=E,t[27]=C,t[28]=D):D=t[28];let O;t[29]!==i||t[30]!==n||t[31]!==f?(O=m?(0,Z.jsx)(Cp,{open:f,onOpenChange:p,crashContext:{source:`document view`,docName:SM(n)??i,errorMessage:n instanceof Error&&n.message?n.message:String(n)}}):null,t[29]=i,t[30]=n,t[31]=f,t[32]=O):O=t[32];let k;return t[33]!==D||t[34]!==O||t[35]!==x?(k=(0,Z.jsxs)(`div`,{role:`alert`,"aria-labelledby":`document-error-title`,"data-slot":`document-error-boundary`,className:`flex h-full flex-col items-center justify-center gap-8 p-8 text-center`,children:[v,x,D,O]}),t[33]=D,t[34]=O,t[35]=x,t[36]=k):k=t[36],k}function EM(){}function DM(e){e.ok||X.error(e.message,{id:`server-restart-error`,duration:1/0})}function OM(e){let t=(0,$.c)(17),{activeDocName:n,previousDocName:r,onNavigateBack:i,onRecycle:a,children:o}=e,s;t[0]!==n||t[1]!==i||t[2]!==r?(s=e=>(0,Z.jsx)(TM,{...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]===xM){console.warn(`[DocumentErrorBoundary] back-nav reset (no recycle)`);return}a(n),console.warn(`[DocumentErrorBoundary] retry recycled ${n}`)}else console.warn(`[DocumentErrorBoundary] reset by key change (${e.prev?.[0]} → ${e.next?.[0]})`)},t[6]=n,t[7]=a,t[8]=l):l=t[8];let u;t[9]===n?u=t[10]:(u=e=>{console.error(`[DocumentErrorBoundary] rendered fallback for ${n}: ${wM(e).title}`,e)},t[9]=n,t[10]=u);let d;return t[11]!==o||t[12]!==s||t[13]!==c||t[14]!==l||t[15]!==u?(d=(0,Z.jsx)(Zt,{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 kM(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=ua(t);return{map:n,keys:Yo(t),parseError:r}}function AM(e){let t=(0,$.c)(21),{provider:n}=e,r;t[0]===n?r=t[1]:(r=()=>kM(n),t[0]=n,t[1]=r);let[i,a]=(0,Q.useState)(r),o,s;t[2]===n?(o=t[3],s=t[4]):(o=()=>{let e=io(n);a(e.current());let t=e.subscribe(e=>{a(e)});return()=>{t(),e.dispose()}},s=[n],t[2]=n,t[3]=o,t[4]=s),(0,Q.useEffect)(o,s);let c;t[5]===i.map.icon?c=t[6]:(c=Ce(i.map.icon),t[5]=i.map.icon,t[6]=c);let l=c,u;t[7]===i.map.cover?u=t[8]:(u=Fe(i.map.cover),t[7]=i.map.cover,t[8]=u);let d=u,f=d.kind===`url`||d.kind===`path`,p=l.kind!==`unsupported`;if(!f&&!p)return null;let m=f?`true`:`false`,h=p?`true`:`false`,g;t[9]!==d||t[10]!==f?(g=f?(0,Z.jsx)(jM,{cover:d}):null,t[9]=d,t[10]=f,t[11]=g):g=t[11];let _;t[12]!==f||t[13]!==p||t[14]!==l?(_=p?(0,Z.jsx)(MM,{icon:l,hasCover:f}):null,t[12]=f,t[13]=p,t[14]=l,t[15]=_):_=t[15];let v;return t[16]!==m||t[17]!==h||t[18]!==g||t[19]!==_?(v=(0,Z.jsxs)(`div`,{className:`page-header editor-content-aligned`,"data-has-cover":m,"data-has-icon":h,"aria-hidden":`true`,"data-testid":`page-header`,children:[g,_]}),t[16]=m,t[17]=h,t[18]=g,t[19]=_,t[20]=v):v=t[20],v}function jM(e){let t=(0,$.c)(2),{cover:n}=e,r;return t[0]===n.value?r=t[1]:(r=(0,Z.jsx)(`div`,{className:`page-header-cover`,"data-testid":`page-header-cover`,children:(0,Z.jsx)(`img`,{src:n.value,alt:``,draggable:!1,loading:`lazy`,referrerPolicy:`no-referrer`,className:`page-header-cover-img`})}),t[0]=n.value,t[1]=r),r}function MM(e){let t=(0,$.c)(9),{icon:n,hasCover:r}=e,i=r?`page-header-icon page-header-icon--with-cover`:`page-header-icon`;if(n.kind===`emoji`){let e;return t[0]!==n.value||t[1]!==i?(e=(0,Z.jsx)(`span`,{className:i,"data-testid":`page-header-icon`,"data-kind":`emoji`,children:n.value}),t[0]=n.value,t[1]=i,t[2]=e):e=t[2],e}let a;t[3]===n.value?a=t[4]:(a=(0,Z.jsx)(`img`,{src:n.value,alt:``,draggable:!1,referrerPolicy:`no-referrer`,className:`page-header-icon-img`}),t[3]=n.value,t[4]=a);let o;return t[5]!==n.kind||t[6]!==i||t[7]!==a?(o=(0,Z.jsx)(`span`,{className:i,"data-testid":`page-header-icon`,"data-kind":n.kind,children:a}),t[5]=n.kind,t[6]=i,t[7]=a,t[8]=o):o=t[8],o}var NM=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{ManagedArtifactProperties:e}=await import(`./ManagedArtifactProperties-CzFEbg0T.js`);return{ManagedArtifactProperties:e}},__vite__mapDeps([126,1,6,2,3,7,8,9,10,11,12,79,62,63,64,65,66,67,68,69,70,71,72,15,73,58,22,74,75,76,38,17,18,25,77,78,31,19,52,53,35,55,14,16,4,80,40,23,24,26,81,28,20,82,21,83,84,27,29,51,54,56,57,85,86,87,30,88,89,90,91,32,33,92,93,127,104,13,105,106,41,128,119,129,34,116]),import.meta.url)).ManagedArtifactProperties})),PM=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{MermaidDocEditor:e}=await import(`./MermaidDocEditor-BgRVEFx4.js`);return{MermaidDocEditor:e}},__vite__mapDeps([130,1,62,2,63,64,9,65,66,67,68,69,70,71,72,15,6,3,7,8,73,58,12,22,11,74,75,76,38,10,17,18,25,77,78,31,19,52,53,35,55,131,132]),import.meta.url)).MermaidDocEditor})),FM=$l(`LARGE_DOC_CHAR_THRESHOLD`,5e5);function IM(e){let t=e.threshold??FM;return e.ytextLength>t?{renderSource:e.isSourceMode||e.visitedSource,renderVisual:!e.isSourceMode||e.visitedVisual,isLarge:!0}:{renderSource:!0,renderVisual:!0,isLarge:!1}}function LM(e){return e.hasEmittedFirstToggle||!e.isLarge?!1:e.renderSource&&e.renderVisual}var RM=$l(`ACTIVITY_MOUNT_LIMIT`,3);function zM(){return n(()=>import(`./SourceEditor-DYIbaxIY.js`),__vite__mapDeps([133,1,62,2,63,64,9,65,66,67,68,69,70,71,72,15,6,3,7,8,73,58,12,22,11,74,75,76,38,10,17,18,25,77,78,31,19,52,53,35,55,131,79,14,16,4,80,40,23,24,26,81,28,20,82,21,83,84,27,29,51,54,56,57,85,86,87,30,88,89,90,91,32,33,92,93,132,134,39,41,42,113,135,60,120,121,129,115]),import.meta.url)}var BM=(0,Q.lazy)(async()=>({default:(await zM()).SourceEditor}));function VM(e,t,n){if(n<=0)return[];let r=e.filter(e=>!_e(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 HM(e,t){return t.kind===`idle`?null:t.kind===`failed`&&t.failedDocNames.includes(e)?{kind:`failed`,title:yl._({id:`MTs6g3`}),summary:t.reason===`clear-data-timeout`?yl._({id:`Sc1bKE`,values:{docName:e}}):yl._({id:`ovIGrT`,values:{docName:e}}),actionLabel:yl._({id:`HpK_8d`})}:t.kind===`recovering`&&t.docNames.includes(e)?{kind:`recovering`,title:yl._({id:`cF9DyA`}),summary:t.phase===`clearing-local-cache`?yl._({id:`bmC18N`,values:{docName:e}}):yl._({id:`pAgkuZ`,values:{docName:e}})}:null}function UM(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(Ql,{name:`activity-pool`,children:(0,Z.jsx)(WM,{...e})}),t[0]=e,t[1]=n),n}function WM(e){let t=(0,$.c)(15),{activeDocName:n,isSourceMode:r,editorPlaceholder:i,previousDocName:a,onNavigateBack:o,onRecycle:s}=e,{poolEntries:c,serverRestartRecovery:l}=Re(),{pages:u,loading:d}=Ns(),f=VM(c,n,RM),p=(0,Q.useRef)(``),m=f.map(GM).join(`,`),h=(0,Q.useRef)(c),g,_;t[0]===c?(g=t[1],_=t[2]):(g=()=>{h.current=c},_=[c],t[0]=c,t[1]=g,t[2]=_),(0,Q.useLayoutEffect)(g,_),(0,Q.useLayoutEffect)(()=>{if(p.current===m)return;let e=p.current?p.current.split(`,`):[],t=m?m.split(`,`):[],r=e.filter(e=>!t.includes(e)),i=t.filter(t=>!e.includes(t));for(let e of r)ue(e);for(let e of i){let t=h.current.find(t=>t.docName===e)?.poolEventId;R(e,t&&t.length>0?t:crypto.randomUUID())}Zl(`ok/activity/mount-list-change`,{active:n,mounted:t,evicted:r}),p.current=m,Le(t)},[m,n]);let v;t[3]!==n||t[4]!==i||t[5]!==r||t[6]!==d||t[7]!==o||t[8]!==s||t[9]!==u||t[10]!==a||t[11]!==l?(v=e=>(0,Z.jsx)(ZM,{entry:e,isActive:e.docName===n,isSourceMode:r,editorPlaceholder:i,isNewDoc:!d&&!u.has(e.docName)&&!ho(e.docName)&&!Go(e.docName),previousDocName:a,onNavigateBack:o,onRecycle:s,serverRestartRecovery:l},e.docName),t[3]=n,t[4]=i,t[5]=r,t[6]=d,t[7]=o,t[8]=s,t[9]=u,t[10]=a,t[11]=l,t[12]=v):v=t[12];let y=f.map(v),b;return t[13]===y?b=t[14]:(b=(0,Z.jsx)(Z.Fragment,{children:y}),t[13]=y,t[14]=b),b}function GM(e){return e.docName}function KM(e){let t=(0,$.c)(8),{isActive:n,initialScrollTop:r,children:i}=e,a=(0,Q.useRef)(null),o=(0,Q.useRef)(r??0),s,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{let e=a.current;if(!e)return;let t=()=>{e.scrollTop>0&&(o.current=e.scrollTop)};return e.addEventListener(`scroll`,t,{passive:!0}),()=>e.removeEventListener(`scroll`,t)},c=[],t[0]=s,t[1]=c):(s=t[0],c=t[1]),(0,Q.useEffect)(s,c);let l,u;t[2]===n?(l=t[3],u=t[4]):(l=()=>{if(!n)return;let e=a.current;if(!e)return;let t=o.current;if(t===0)return;let r=performance.now(),i=!1;e.scrollTop=t,e.scrollTop===t&&e.scrollHeight>t&&Zl(`ok/scroll-restore/phase1-success`,{target:t,elapsedMs:performance.now()-r});let s=!1,c=0,l=()=>{s||(s=!0,cancelAnimationFrame(c),clearTimeout(f),e.removeEventListener(`wheel`,u),e.removeEventListener(`touchstart`,u))},u=()=>l();e.addEventListener(`wheel`,u,{passive:!0}),e.addEventListener(`touchstart`,u,{passive:!0});let d=()=>{s||(e.scrollTop!==t&&e.scrollHeight>t&&(e.scrollTop=t,e.scrollTop===t&&!i&&(Zl(`ok/scroll-restore/phase2-success`,{target:t,elapsedMs:performance.now()-r}),i=!0)),c=requestAnimationFrame(d))};c=requestAnimationFrame(d);let f=setTimeout(()=>{s||(e.scrollTop!==t&&e.scrollHeight>t&&Zl(`ok/scroll-restore/abandoned`,{target:t,elapsedMs:performance.now()-r,scrollHeight:e.scrollHeight,finalScrollTop:e.scrollTop}),l())},2e3);return l},u=[n],t[2]=n,t[3]=l,t[4]=u),(0,Q.useLayoutEffect)(l,u);let d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(d={overflowAnchor:`auto`},t[5]=d):d=t[5];let f;return t[6]===i?f=t[7]:(f=(0,Z.jsx)(`div`,{ref:a,"data-testid":`editor-scroll-container`,className:`editor-doc-scroll subtle-scrollbar h-full overflow-y-auto pt-14 scroll-pt-14`,style:d,children:i}),t[6]=i,t[7]=f),f}function qM(e){let t=(0,$.c)(12),{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a}=e,o=r&&i,[s,c]=(0,Q.useState)(o),l,u;if(t[0]===o?(l=t[1],u=t[2]):(l=()=>{o&&c(!0)},u=[o],t[0]=o,t[1]=l,t[2]=u),(0,Q.useEffect)(l,u),!s&&!o)return null;let d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(xS,{}),t[3]=d):d=t[3];let f=n.docName,p;t[4]===n.provider.document?p=t[5]:(p=n.provider.document.getText(`source`),t[4]=n.provider.document,t[5]=p);let m;return t[6]!==a||t[7]!==n.docName||t[8]!==n.provider||t[9]!==o||t[10]!==p?(m=(0,Z.jsx)(Q.Suspense,{fallback:d,children:(0,Z.jsx)(BM,{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 JM(e){let t=(0,$.c)(18),{view:n}=e,r=n.kind===`failed`,i=r?`alert`:`status`,a=!r,o;t[0]===r?o=t[1]:(o=(0,Z.jsx)(`div`,{className:`flex size-12 items-center justify-center rounded-full border bg-muted text-muted-foreground`,children:r?(0,Z.jsx)(tl,{className:`size-5`,"aria-hidden":`true`}):(0,Z.jsx)(Zc,{className:`size-5 animate-spin`,"aria-hidden":`true`})}),t[0]=r,t[1]=o);let s;t[2]===n.title?s=t[3]:(s=(0,Z.jsx)(`h2`,{className:`text-lg font-medium`,children:n.title}),t[2]=n.title,t[3]=s);let c;t[4]===n.summary?c=t[5]:(c=(0,Z.jsx)(`p`,{className:`max-w-md text-sm text-muted-foreground`,children:n.summary}),t[4]=n.summary,t[5]=c);let l;t[6]!==s||t[7]!==c?(l=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;t[9]!==r||t[10]!==n.actionLabel?(u=r?(0,Z.jsxs)(Y,{type:`button`,onClick:YM,children:[(0,Z.jsx)(tl,{className:`size-4`,"aria-hidden":`true`}),n.actionLabel]}):null,t[9]=r,t[10]=n.actionLabel,t[11]=u):u=t[11];let d;return t[12]!==i||t[13]!==a||t[14]!==o||t[15]!==l||t[16]!==u?(d=(0,Z.jsxs)(`div`,{"data-slot":`server-restart-recovery`,role:i,"aria-busy":a,className:`flex h-full flex-col items-center justify-center gap-6 p-8 text-center`,children:[o,l,u]}),t[12]=i,t[13]=a,t[14]=o,t[15]=l,t[16]=u,t[17]=d):d=t[17],d}function YM(){return window.location.reload()}function XM(e){let t=(0,$.c)(2),{html:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(`div`,{className:`tiptap-editor h-full pointer-events-none`,"aria-hidden":`true`,children:(0,Z.jsx)(`div`,{className:`tiptap ProseMirror tiptap-editor-portal-content`,dangerouslySetInnerHTML:{__html:n}})}),t[0]=n,t[1]=r),r}function ZM(e){let t=(0,$.c)(56),{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a,isNewDoc:o,previousDocName:s,onNavigateBack:c,onRecycle:l,serverRestartRecovery:u}=e,d;t[0]!==n.docName||t[1]!==u?(d=HM(n.docName,u),t[0]=n.docName,t[1]=u,t[2]=d):d=t[2];let f=d,p=bT(n.docName)===`conflict`,m;t[3]===n.docName?m=t[4]:(m=Go(n.docName),t[3]=n.docName,t[4]=m);let h=m,g;t[5]===n.docName?g=t[6]:(g=()=>{let e=document.createElement(`div`);return e.setAttribute(`data-ok-editor-portal`,n.docName),e.style.display=`contents`,e},t[5]=n.docName,t[6]=g);let[_]=(0,Q.useState)(g),v=n.provider.document.getText(`source`).length,[y,b]=(0,Q.useState)(i),[x,S]=(0,Q.useState)(!i),C,w;t[7]!==i||t[8]!==y||t[9]!==x?(C=()=>{i&&!y?b(!0):!i&&!x&&S(!0)},w=[i,y,x],t[7]=i,t[8]=y,t[9]=x,t[10]=C,t[11]=w):(C=t[10],w=t[11]),(0,Q.useEffect)(C,w);let T=IM({ytextLength:v,isSourceMode:i,visitedSource:y,visitedVisual:x}),E=(0,Q.useRef)(``),D=`${T.isLarge}-${T.renderSource}-${T.renderVisual}`,O,k;t[12]!==n.docName||t[13]!==T.isLarge||t[14]!==T.renderSource||t[15]!==T.renderVisual||t[16]!==D||t[17]!==i||t[18]!==v?(O=()=>{E.current!==D&&(E.current=D,T.isLarge&&Zl(`ok/activity/defer-mount`,{docName:n.docName,ytextLength:v,isSourceMode:i,renderSource:T.renderSource,renderVisual:T.renderVisual}))},k=[D,T.isLarge,T.renderSource,T.renderVisual,n.docName,v,i],t[12]=n.docName,t[13]=T.isLarge,t[14]=T.renderSource,t[15]=T.renderVisual,t[16]=D,t[17]=i,t[18]=v,t[19]=O,t[20]=k):(O=t[19],k=t[20]),(0,Q.useEffect)(O,k);let A;t[21]===n.docName?A=t[22]:(A=()=>Ke(n.docName),t[21]=n.docName,t[22]=A);let[j]=(0,Q.useState)(A),M=j?.html??null,[N,P]=(0,Q.useState)(!1),F,I;t[23]!==n.docName||t[24]!==T.isLarge||t[25]!==T.renderSource||t[26]!==T.renderVisual||t[27]!==N||t[28]!==i||t[29]!==v?(I=()=>{LM({isLarge:T.isLarge,renderSource:T.renderSource,renderVisual:T.renderVisual,hasEmittedFirstToggle:N})&&(Zl(`ok/cold/first-toggle`,{docName:n.docName,mountId:dt(n.docName),ytextLength:v,modeEnteredFirst:i?`source`:`visual`}),P(!0))},F=[N,T.isLarge,T.renderSource,T.renderVisual,n.docName,v,i],t[23]=n.docName,t[24]=T.isLarge,t[25]=T.renderSource,t[26]=T.renderVisual,t[27]=N,t[28]=i,t[29]=v,t[30]=F,t[31]=I):(F=t[30],I=t[31]),(0,Q.useEffect)(I,F);let L=r?`visible`:`hidden`,R=`editor:${n.docName}`,z=j?.scrollTop,B;t[32]!==a||t[33]!==n||t[34]!==T.renderSource||t[35]!==T.renderVisual||t[36]!==r||t[37]!==p||t[38]!==h||t[39]!==o||t[40]!==i||t[41]!==c||t[42]!==l||t[43]!==_||t[44]!==s||t[45]!==f||t[46]!==M?(B=f?(0,Z.jsx)(JM,{view:f}):(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsx)(OM,{activeDocName:n.docName,previousDocName:s,onNavigateBack:c,onRecycle:l,children:(0,Z.jsx)(Q.Suspense,{fallback:M?(0,Z.jsx)(XM,{html:M}):(0,Z.jsx)(xS,{}),children:(0,Z.jsx)(bM,{docName:n.docName,provider:n.provider,children:p?(0,Z.jsx)(yM,{docName:n.docName,provider:n.provider}):h?(0,Z.jsx)(PM,{docName:n.docName,provider:n.provider,isSourceMode:i}):(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[!i&&(ho(n.docName)||ce(n.docName)?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(NM,{docName:n.docName,provider:n.provider})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(AM,{provider:n.provider}),(0,Z.jsx)(Ts,{provider:n.provider})]})),(0,Z.jsxs)(`div`,{className:`relative flex-1`,children:[T.renderSource?(0,Z.jsx)(`div`,{className:i?`h-full`:`ok-mode-hidden h-full`,children:(0,Z.jsx)(qM,{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a})}):null,T.renderVisual?(0,Z.jsx)(`div`,{className:i?`ok-mode-hidden h-full`:`h-full`,children:(0,Z.jsx)(hA,{provider:n.provider,placeholder:a,isSourceMode:i,portalTarget:_},`${n.docName}-${String(o)}-${n.poolEventId}`)}):null]})]})})})})}),t[32]=a,t[33]=n,t[34]=T.renderSource,t[35]=T.renderVisual,t[36]=r,t[37]=p,t[38]=h,t[39]=o,t[40]=i,t[41]=c,t[42]=l,t[43]=_,t[44]=s,t[45]=f,t[46]=M,t[47]=B):B=t[47];let V;t[48]!==r||t[49]!==z||t[50]!==B?(V=(0,Z.jsx)(KM,{isActive:r,initialScrollTop:z,children:B}),t[48]=r,t[49]=z,t[50]=B,t[51]=V):V=t[51];let H;return t[52]!==L||t[53]!==R||t[54]!==V?(H=(0,Z.jsx)(Q.Activity,{mode:L,name:R,children:V}),t[52]=L,t[53]=R,t[54]=V,t[55]=H):H=t[55],H}function QM(e){let t=e.endsWith(`rem`)?`rem`:`px`;return{value:Number.parseFloat(e),unit:t}}function $M(e){let{value:t,unit:n}=QM(e);return n===`rem`?t*16:t}function eN(e,t){return`${t===`rem`?e.toFixed(1):Math.round(e)}${t}`}var tN=3600*24*7;function nN(e){let t=(0,$.c)(28),{direction:n,currentWidth:r,onResize:i,onToggle:a,isCollapsed:o,minResizeWidth:s,maxResizeWidth:c,enableToggle:l,enableAutoCollapse:u,autoCollapseThreshold:d,expandThreshold:f,enableDrag:p,setIsDraggingRail:m,widthCookieName:h,widthCookieMaxAge:g,isNested:_}=e,v=n===void 0?`right`:n,y=o===void 0?!1:o,b=s===void 0?`14rem`:s,x=c===void 0?`24rem`:c,S=l===void 0?!0:l,C=u===void 0?!0:u,w=d===void 0?1.5:d,T=f===void 0?.2:f,E=p===void 0?!0:p,D=m===void 0?rN:m,O=g===void 0?tN:g,k=_===void 0?!1:_,A=(0,Q.useRef)(null),j=(0,Q.useRef)(0),M=(0,Q.useRef)(0),N=(0,Q.useRef)(!1),P=(0,Q.useRef)(!1),F=(0,Q.useRef)(null),I=(0,Q.useRef)(0),L=(0,Q.useRef)(!1),R=(0,Q.useRef)(0),z=(0,Q.useRef)(0),B=(0,Q.useRef)(null),V=(0,Q.useRef)(r),H=(0,Q.useRef)(y),U,W;t[0]===r?(U=t[1],W=t[2]):(U=()=>{V.current=r},W=[r],t[0]=r,t[1]=U,t[2]=W),(0,Q.useEffect)(U,W);let ee,G;t[3]===y?(ee=t[4],G=t[5]):(ee=()=>{H.current=y},G=[y],t[3]=y,t[4]=ee,t[5]=G),(0,Q.useEffect)(ee,G);let K=$M(b),te;t[6]===x?te=t[7]:(te=$M(x),t[6]=x,t[7]=te);let ne=te,re;t[8]!==E||t[9]!==k?(re=function(e){E&&(P.current=!0,j.current=H.current?0:$M(V.current),M.current=e.clientX,I.current=e.clientX,F.current=null,L.current=!1,R.current=0,z.current=0,B.current=k&&A.current?A.current.getBoundingClientRect():null,e.preventDefault())},t[8]=E,t[9]=k,t[10]=re):re=t[10];let ie=re,ae,oe;t[11]!==w||t[12]!==v||t[13]!==C||t[14]!==S||t[15]!==T||t[16]!==k||t[17]!==ne||t[18]!==K||t[19]!==i||t[20]!==a||t[21]!==D||t[22]!==O||t[23]!==h?(ae=()=>{let e=function(e){h&&(document.cookie=`${h}=${e}; path=/; max-age=${O}`)},t=function(e,t){return v===`left`?e<t:e>t},n=function(e,t,n,r){if(k&&r){let r=e.clientX-t;return v===`left`?n-r:n+r}return v===`left`?window.innerWidth-e.clientX:e.clientX},r=function(r){if(!P.current)return;let o=Math.abs(r.clientX-M.current);if(!N.current&&o>5&&(N.current=!0,D(!0)),N.current){let{unit:o}=QM(V.current),s=B.current;k&&A.current&&(s=A.current.getBoundingClientRect());let c=t(r.clientX,I.current)?`expand`:`collapse`;F.current!==c&&(F.current=c),z.current=Math.abs(r.clientX-I.current);let l=Date.now();if(L.current&&l-R.current>200&&(L.current=!1),!L.current){if(C&&a&&!H.current){let e=n(r,M.current,j.current,s),t=!1;if(w<=1)t=e<=K*w;else if(e<=K){let n=K*(w-1);t=K-e>=n}if(c===`collapse`&&t){a(),I.current=r.clientX,L.current=!0,R.current=l;return}}if(a&&H.current&&c===`expand`&&z.current>K*T){a();let t=n(r,M.current,j.current,s),c=Math.max(K,Math.min(ne,t)),u=eN(o===`rem`?c/16:c,o);i(u),e(u),I.current=r.clientX,L.current=!0,R.current=l;return}}if(H.current)return;let u=n(r,M.current,j.current,s),d=Math.max(K,Math.min(ne,u)),f=eN(o===`rem`?d/16:d,o);i(f),e(f)}},o=function(){P.current&&(!N.current&&a&&S&&a(),N.current=!1,P.current=!1,F.current=null,I.current=0,L.current=!1,R.current=0,z.current=0,B.current=null,D(!1))};return document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,o),()=>{document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,o)}},oe=[i,a,D,K,ne,k,C,w,T,S,h,O,v],t[11]=w,t[12]=v,t[13]=C,t[14]=S,t[15]=T,t[16]=k,t[17]=ne,t[18]=K,t[19]=i,t[20]=a,t[21]=D,t[22]=O,t[23]=h,t[24]=ae,t[25]=oe):(ae=t[24],oe=t[25]),(0,Q.useEffect)(ae,oe);let se;return t[26]===ie?se=t[27]:(se={dragRef:A,isDragging:N,handleMouseDown:ie},t[26]=ie,t[27]=se),se}function rN(){}var iN=3600*24*7,aN=`18rem`,oN=`3rem`,sN=`app-file-sidebar`,cN=`14.625rem`,lN=`32rem`,uN=`sidebar_width`,dN=/^\d+(?:\.\d+)?(?:rem|px)$/,fN=Q.createContext(null);function pN(e){if(typeof document>`u`)return e;let t=document.cookie.split(`; `).find(e=>e.startsWith(`${uN}=`))?.split(`=`)[1];if(!t)return e;let n;try{n=decodeURIComponent(t)}catch{return e}return dN.test(n)?n:e}function mN(){let e=Q.use(fN);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function hN(e){let t=(0,$.c)(58),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({open:i,onOpenChange:o,className:r,style:s,children:n,defaultWidth:c,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=c===void 0?aN:c,[u]=Q.useState(_N),d;t[8]===u?d=t[9]:(d=()=>AT(u,window.innerWidth,`left`),t[8]=u,t[9]=d);let[f,p]=Q.useState(d),m;t[10]===l?m=t[11]:(m=()=>pN(l),t[10]=l,t[11]=m);let[h,g]=Q.useState(m),[_,v]=Q.useState(!1),[y,b]=Q.useState(!1),x;t[12]===u?x=t[13]:(x=()=>{let e=LT();return zT(`left`,AT(u,window.innerWidth,`left`),e)===`open`},t[12]=u,t[13]=x);let[S,C]=Q.useState(x),w=i??S,T;t[14]!==w||t[15]!==f||t[16]!==o?(T=e=>{let t=typeof e==`function`?e(w):e;o?o(t):C(t),BT(`left`,f,t?`open`:`collapsed`)},t[14]=w,t[15]=f,t[16]=o,t[17]=T):T=t[17];let E=T,D;t[18]===E?D=t[19]:(D=function(){E(gN)},t[18]=E,t[19]=D);let O=D,k=Q.useRef(w),A;t[20]===w?A=t[21]:(A=()=>{k.current=w},t[20]=w,t[21]=A),Q.useLayoutEffect(A);let j;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(j=function(){window.innerWidth>=1024||k.current&&(window.matchMedia(`(prefers-reduced-motion: reduce)`).matches||b(!0))},t[22]=j):j=t[22];let M=j,N,P;t[23]===u?(N=t[24],P=t[25]):(P=()=>{let e=window.matchMedia(`(min-width: ${DT}px)`),t=()=>{let e=AT(u,window.innerWidth,`left`);p(e),C(zT(`left`,e,LT())===`open`)};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},N=[u],t[23]=u,t[24]=N,t[25]=P),Q.useEffect(P,N);let F,I;t[26]===w?(F=t[27],I=t[28]):(F=()=>{w||document.getElementById(sN)?.contains(document.activeElement)&&document.querySelector(`[data-sidebar="trigger"]`)?.focus()},I=[w],t[26]=w,t[27]=F,t[28]=I),Q.useLayoutEffect(F,I);let L,R;t[29]!==w||t[30]!==f||t[31]!==E?(L=()=>{if(f===`above`||!w)return;let e=e=>{e.key===`Escape`&&(document.querySelector(`[data-state="open"][role="dialog"], [data-state="open"][role="alertdialog"], [data-state="open"][role="menu"], [data-state="open"][role="listbox"], [data-radix-popper-content-wrapper] [data-state="open"]`)||E(!1))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},R=[f,w,E],t[29]=w,t[30]=f,t[31]=E,t[32]=L,t[33]=R):(L=t[32],R=t[33]),Q.useEffect(L,R);let z,B;t[34]===O?(z=t[35],B=t[36]):(z=()=>{if(typeof window<`u`&&window.okDesktop!=null)return;let e=e=>{Sl(e,`toggle-files-sidebar`)&&(e.preventDefault(),O())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},B=[O],t[34]=O,t[35]=z,t[36]=B),Q.useEffect(z,B);let V=w?`expanded`:`collapsed`,H;t[37]!==_||t[38]!==w||t[39]!==E||t[40]!==y||t[41]!==V||t[42]!==O||t[43]!==h?(H={state:V,open:w,setOpen:E,toggleSidebar:O,width:h,setWidth:g,isDraggingRail:_,setIsDraggingRail:v,showPushPulse:y,setShowPushPulse:b,notifySidebarFileSelected:M},t[37]=_,t[38]=w,t[39]=E,t[40]=y,t[41]=V,t[42]=O,t[43]=h,t[44]=H):H=t[44];let U;t[45]!==s||t[46]!==h?(U={"--sidebar-width":h,"--sidebar-width-icon":oN,...s},t[45]=s,t[46]=h,t[47]=U):U=t[47];let W=U,ee;t[48]===r?ee=t[49]:(ee=$t(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),t[48]=r,t[49]=ee);let G;t[50]!==n||t[51]!==a||t[52]!==W||t[53]!==ee?(G=(0,Z.jsx)(`div`,{"data-slot":`sidebar-wrapper`,style:W,className:ee,...a,children:n}),t[50]=n,t[51]=a,t[52]=W,t[53]=ee,t[54]=G):G=t[54];let K;return t[55]!==H||t[56]!==G?(K=(0,Z.jsx)(fN.Provider,{value:H,children:G}),t[55]=H,t[56]=G,t[57]=K):K=t[57],K}function gN(e){return!e}function _N(){return Na()}function vN(e){let t=(0,$.c)(39),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,{_:d}=vt(),{state:f,isDraggingRail:p}=mN();if(u===`none`){let e;t[7]===r?e=t[8]:(e=$t(`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,Z.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}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[14]===h?g=t[15]:(g=$t(`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,`group-data-[dragging=true]:duration-0! group-data-[dragging=true]_*:!duration-0`),t[14]=h,t[15]=g);let _;t[16]===g?_=t[17]:(_=(0,Z.jsx)(`div`,{"data-slot":`sidebar-gap`,className:g}),t[16]=g,t[17]=_);let v;t[18]===d?v=t[19]:(v=d({id:`07q4Qk`}),t[18]=d,t[19]=v);let y=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`,b;t[20]!==r||t[21]!==y?(b=$t(`fixed inset-y-0 z-10 flex h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear motion-reduce:transition-none motion-reduce:duration-0 data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]`,y,`group-data-[dragging=true]:duration-0! group-data-[dragging=true]_*:!duration-0`,r),t[20]=r,t[21]=y,t[22]=b):b=t[22];let x;t[23]===n?x=t[24]:(x=(0,Z.jsx)(`div`,{"data-sidebar":`sidebar`,"data-slot":`sidebar-inner`,className:`flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border`,children:n}),t[23]=n,t[24]=x);let S;t[25]!==i||t[26]!==c||t[27]!==b||t[28]!==x||t[29]!==v?(S=(0,Z.jsx)(`nav`,{id:sN,"aria-label":v,"data-slot":`sidebar-container`,"data-side":c,className:b,...i,children:x}),t[25]=i,t[26]=c,t[27]=b,t[28]=x,t[29]=v,t[30]=S):S=t[30];let C;return t[31]!==p||t[32]!==c||t[33]!==f||t[34]!==S||t[35]!==m||t[36]!==_||t[37]!==l?(C=(0,Z.jsxs)(`div`,{className:`group peer text-sidebar-foreground`,"data-state":f,"data-collapsible":m,"data-variant":l,"data-side":c,"data-slot":`sidebar`,"data-dragging":p,children:[_,S]}),t[31]=p,t[32]=c,t[33]=f,t[34]=S,t[35]=m,t[36]=_,t[37]=l,t[38]=C):C=t[38],C}function yN(e){let t=(0,$.c)(34),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{_:a}=vt(),{toggleSidebar:o,state:s}=mN(),c,l,u,d,f,p,m,h;if(t[4]!==a||t[5]!==s){let e=Cl(`toggle-files-sidebar`);c=Y,l=`trigger`,u=`sidebar-trigger`,d=`ghost`,f=`icon-sm`,p=s===`expanded`,m=sN,h=a(s===`expanded`?{id:`4PYsOz`,values:{sidebarShortcutLabel:e}}:{id:`jbSG8V`,values:{sidebarShortcutLabel:e}}),t[4]=a,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d,t[10]=f,t[11]=p,t[12]=m,t[13]=h}else c=t[6],l=t[7],u=t[8],d=t[9],f=t[10],p=t[11],m=t[12],h=t[13];let g;t[14]===n?g=t[15]:(g=$t(n),t[14]=n,t[15]=g);let _;t[16]!==r||t[17]!==o?(_=e=>{r?.(e),o()},t[16]=r,t[17]=o,t[18]=_):_=t[18];let v;t[19]===s?v=t[20]:(v=s===`expanded`?(0,Z.jsx)(ze,{}):(0,Z.jsx)(_h,{}),t[19]=s,t[20]=v);let y;return t[21]!==c||t[22]!==i||t[23]!==l||t[24]!==v||t[25]!==u||t[26]!==d||t[27]!==f||t[28]!==p||t[29]!==m||t[30]!==h||t[31]!==g||t[32]!==_?(y=(0,Z.jsx)(c,{"data-sidebar":l,"data-slot":u,variant:d,size:f,"aria-expanded":p,"aria-controls":m,"aria-label":h,className:g,onClick:_,...i,children:v}),t[21]=c,t[22]=i,t[23]=l,t[24]=v,t[25]=u,t[26]=d,t[27]=f,t[28]=p,t[29]=m,t[30]=h,t[31]=g,t[32]=_,t[33]=y):y=t[33],y}function bN(e){let t=(0,$.c)(32),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:n,enableDrag:a,enableToggle:o,onMouseDown:r,...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?!0:a,c=o===void 0?!0:o,{_:l}=vt(),{toggleSidebar:u,setWidth:d,state:f,width:p,setIsDraggingRail:m}=mN(),h=f===`collapsed`,g;t[6]!==s||t[7]!==c||t[8]!==m||t[9]!==d||t[10]!==h||t[11]!==u||t[12]!==p?(g={direction:`right`,enableDrag:s,enableToggle:c,onResize:d,onToggle:u,currentWidth:p,isCollapsed:h,minResizeWidth:cN,maxResizeWidth:lN,setIsDraggingRail:m,widthCookieName:uN,widthCookieMaxAge:iN},t[6]=s,t[7]=c,t[8]=m,t[9]=d,t[10]=h,t[11]=u,t[12]=p,t[13]=g):g=t[13];let{dragRef:_,handleMouseDown:v}=nN(g),y;t[14]!==l||t[15]!==f?(y=l(f===`expanded`?{id:`w3vFfL`}:{id:`e8zRrb`}),t[14]=l,t[15]=f,t[16]=y):y=t[16];let b;t[17]!==v||t[18]!==r?(b=e=>{r?.(e),e.defaultPrevented||v(e)},t[17]=v,t[18]=r,t[19]=b):b=t[19];let x;t[20]!==l||t[21]!==f?(x=l(f===`expanded`?{id:`w3vFfL`}:{id:`e8zRrb`}),t[20]=l,t[21]=f,t[22]=x):x=t[22];let S;t[23]===n?S=t[24]:(S=$t(`absolute inset-y-0 z-20 hidden w-4 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:start-1/2 after:w-[2px] hover:after:bg-sidebar-border sm:flex ltr:-translate-x-1/2 rtl:-translate-x-1/2`,`in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize`,`[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize`,`group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full hover:group-data-[collapsible=offcanvas]:bg-sidebar`,`[[data-side=left][data-collapsible=offcanvas]_&]:-right-2`,`[[data-side=right][data-collapsible=offcanvas]_&]:-left-2`,`md:group-data-[variant=inset]:after:inset-y-5`,n),t[23]=n,t[24]=S);let C;return t[25]!==_||t[26]!==i||t[27]!==y||t[28]!==b||t[29]!==x||t[30]!==S?(C=(0,Z.jsx)(`button`,{ref:_,"data-sidebar":`rail`,"data-slot":`sidebar-rail`,"aria-label":y,tabIndex:-1,onMouseDown:b,title:x,className:S,...i}),t[25]=_,t[26]=i,t[27]=y,t[28]=b,t[29]=x,t[30]=S,t[31]=C):C=t[31],C}function xN(e){let t=(0,$.c)(14),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,onAnimationEnd:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let{showPushPulse:a,setShowPushPulse:o}=mN(),s;t[4]!==r||t[5]!==o?(s=e=>{r?.(e),e.animationName===`sidebar-push-pulse`&&o(!1)},t[4]=r,t[5]=o,t[6]=s):s=t[6];let c=s,l=a?``:void 0,u;t[7]===n?u=t[8]:(u=$t(`relative flex w-full flex-1 flex-col bg-background peer-data-[variant=inset]:m-2 peer-data-[variant=inset]:ml-0 peer-data-[variant=inset]:rounded-xl peer-data-[variant=inset]:shadow-sm peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2`,n),t[7]=n,t[8]=u);let d;return t[9]!==c||t[10]!==i||t[11]!==l||t[12]!==u?(d=(0,Z.jsx)(`main`,{"data-slot":`sidebar-inset`,"data-push-pulse":l,onAnimationEnd:c,className:u,...i}),t[9]=c,t[10]=i,t[11]=l,t[12]=u,t[13]=d):d=t[13],d}function SN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=$t(`flex flex-col gap-2 p-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-header`,"data-sidebar":`header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function CN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=$t(`flex flex-col gap-2 p-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-footer`,"data-sidebar":`footer`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function wN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=$t(`no-scrollbar flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-content`,"data-sidebar":`content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function TN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=$t(`relative flex w-full min-w-0 flex-col p-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-group`,"data-sidebar":`group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function EN(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,asChild:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i!==void 0&&i?Qt:`div`,o;t[4]===n?o=t[5]:(o=$t(`flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 ring-sidebar-ring outline-hidden transition-[margin,opacity] duration-200 ease-linear group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0`,n),t[4]=n,t[5]=o);let s;return t[6]!==a||t[7]!==r||t[8]!==o?(s=(0,Z.jsx)(a,{"data-slot":`sidebar-group-label`,"data-sidebar":`group-label`,className:o,...r}),t[6]=a,t[7]=r,t[8]=o,t[9]=s):s=t[9],s}function DN(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,asChild:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i!==void 0&&i?Qt:`button`,o;t[4]===n?o=t[5]:(o=$t(`absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform group-data-[collapsible=icon]:hidden after:absolute after:-inset-2 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0`,n),t[4]=n,t[5]=o);let s;return t[6]!==a||t[7]!==r||t[8]!==o?(s=(0,Z.jsx)(a,{"data-slot":`sidebar-group-action`,"data-sidebar":`group-action`,className:o,...r}),t[6]=a,t[7]=r,t[8]=o,t[9]=s):s=t[9],s}function ON(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=$t(`w-full text-sm`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-group-content`,"data-sidebar":`group-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function kN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=$t(`flex w-full min-w-0 flex-col gap-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`ul`,{"data-slot":`sidebar-menu`,"data-sidebar":`menu`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function AN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=$t(`group/menu-item relative`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`li`,{"data-slot":`sidebar-menu-item`,"data-sidebar":`menu-item`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var jN=nn(`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 MN(e){let t=(0,$.c)(28),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({asChild:i,isActive:a,variant:o,size:s,tooltip:c,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=i===void 0?!1:i,u=a===void 0?!1:a,d=o===void 0?`default`:o,f=s===void 0?`default`:s,p=l?Qt:`button`,{state:m}=mN(),h;t[8]!==n||t[9]!==f||t[10]!==d?(h=$t(jN({variant:d,size:f}),n),t[8]=n,t[9]=f,t[10]=d,t[11]=h):h=t[11];let g;t[12]!==p||t[13]!==u||t[14]!==r||t[15]!==f||t[16]!==h?(g=(0,Z.jsx)(p,{"data-slot":`sidebar-menu-button`,"data-sidebar":`menu-button`,"data-size":f,"data-active":u,className:h,...r}),t[12]=p,t[13]=u,t[14]=r,t[15]=f,t[16]=h,t[17]=g):g=t[17];let _=g;if(!c)return _;if(typeof c==`string`){let e;t[18]===c?e=t[19]:(e={children:c},t[18]=c,t[19]=e),c=e}let v;t[20]===_?v=t[21]:(v=(0,Z.jsx)(ln,{asChild:!0,children:_}),t[20]=_,t[21]=v);let y=m!==`collapsed`,b;t[22]!==y||t[23]!==c?(b=(0,Z.jsx)(un,{side:`right`,align:`center`,hidden:y,...c}),t[22]=y,t[23]=c,t[24]=b):b=t[24];let x;return t[25]!==v||t[26]!==b?(x=(0,Z.jsxs)(fn,{children:[v,b]}),t[25]=v,t[26]=b,t[27]=x):x=t[27],x}function NN(e){let t=(0,$.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,asChild:i,showOnHover:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?!1:i,s=a===void 0?!1:a,c=o?Qt:`button`,l=s&&`group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 peer-data-active/menu-button:text-sidebar-accent-foreground aria-expanded:opacity-100 md:opacity-0`,u;t[5]!==n||t[6]!==l?(u=$t(`absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform group-data-[collapsible=icon]:hidden peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1 after:absolute after:-inset-2 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0`,l,n),t[5]=n,t[6]=l,t[7]=u):u=t[7];let d;return t[8]!==c||t[9]!==r||t[10]!==u?(d=(0,Z.jsx)(c,{"data-slot":`sidebar-menu-action`,"data-sidebar":`menu-action`,className:u,...r}),t[8]=c,t[9]=r,t[10]=u,t[11]=d):d=t[11],d}function PN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=$t(`mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5 group-data-[collapsible=icon]:hidden`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`ul`,{"data-slot":`sidebar-menu-sub`,"data-sidebar":`menu-sub`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function FN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=$t(`group/menu-sub-item relative`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`li`,{"data-slot":`sidebar-menu-sub-item`,"data-sidebar":`menu-sub-item`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function IN(e){let t=(0,$.c)(14),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({asChild:i,size:a,isActive:o,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=i===void 0?!1:i,c=a===void 0?`md`:a,l=o===void 0?!1:o,u=s?Qt:`a`,d;t[6]===n?d=t[7]:(d=$t(`flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground ring-sidebar-ring outline-hidden group-data-[collapsible=icon]:hidden 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-[size=md]:text-sm data-[size=sm]:text-xs data-active:bg-sidebar-accent data-active:text-sidebar-accent-foreground data-active:hover:bg-sidebar-accent [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground`,n),t[6]=n,t[7]=d);let f;return t[8]!==u||t[9]!==l||t[10]!==r||t[11]!==c||t[12]!==d?(f=(0,Z.jsx)(u,{"data-slot":`sidebar-menu-sub-button`,"data-sidebar":`menu-sub-button`,"data-size":c,"data-active":l,className:d,...r}),t[8]=u,t[9]=l,t[10]=r,t[11]=c,t[12]=d,t[13]=f):f=t[13],f}function LN(e){let t=null,n=!1,r=new Set;function i(e){if(e!==t){t=e;for(let e of r)e()}}e.subscribeToEvent(i);async function a(){if(!n){n=!0;try{i(await e.fetchBranch())}catch{}}}return{getSnapshot:()=>t,subscribe(e){return r.add(e),a(),()=>{r.delete(e)}}}}async function RN(){let e=await fetch(`/api/server-info`,{signal:AbortSignal.timeout(5e3)});if(!e.ok)return null;let t=await e.json(),n=Pa.safeParse(t);return n.success?n.data.currentBranch??null:null}var zN=typeof window>`u`?{getSnapshot:()=>null,subscribe:()=>()=>{}}:LN({fetchBranch:RN,subscribeToEvent:Wl}),BN=zN.subscribe,VN=zN.getSnapshot;function HN(){return(0,Q.useSyncExternalStore)(BN,VN,VN)}function UN(){let e=(0,$.c)(6),t=HN(),n=Ju(),{state:r}=mN(),i=typeof window<`u`?window.okDesktop:void 0;if(i&&r===`expanded`)return null;let a;e[0]===n?a=e[1]:(a=i?.config.projectName??(n&&ii(n.contentDir)||null),e[0]=n,e[1]=a);let o=a,s=i?.config.projectPath??n?.contentDir??null;if(o===null&&t===null)return null;let c;return e[2]!==t||e[3]!==o||e[4]!==s?(c={projectName:o,projectPath:s,branch:t},e[2]=t,e[3]=o,e[4]=s,e[5]=c):c=e[5],c}function WN(e){let t=(0,$.c)(30),{stats:n,selectionStats:r,showStats:i,composerBadge:a,reserveRightGutter:o}=e,s=i===void 0?!0:i,c=o===void 0?!1:o,{_:l}=vt(),u=UN();if(!s&&u===null&&a==null)return null;let d=r??n,f=r!=null,{words:p,chars:m,tokens:h}=d,g;t[0]!==l||t[1]!==f||t[2]!==s?(g=l(s?f?{id:`Bv5a9_`}:{id:`L1ZE3M`}:{id:`goO4Ll`}),t[0]=l,t[1]=f,t[2]=s,t[3]=g):g=t[3];let _=c&&`pr-12`,v;t[4]===_?v=t[5]:(v=$t(`relative flex h-6 shrink-0 items-center justify-between gap-3 bg-background px-3 text-2xs text-muted-foreground`,_),t[4]=_,t[5]=v);let y;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-full h-2 bg-linear-to-t from-background to-transparent`}),t[6]=y):y=t[6];let b;t[7]!==l||t[8]!==a?(b=a?(0,Z.jsxs)(Y,{type:`button`,variant:`outline`,onClick:a.onReopen,"data-testid":`ask-ai-reopen-badge`,className:`-translate-x-1/2 absolute bottom-0 left-1/2 z-10 h-auto gap-1 rounded-md rounded-b-none bg-card px-2.5 py-0.5 text-2xs font-normal text-muted-foreground shadow-sm hover:text-foreground active:not-aria-[haspopup]:translate-y-0`,children:[(0,Z.jsx)(oc,{className:`size-3`,"aria-hidden":!0}),l({id:`xWEvuo`}),(0,Z.jsx)(pt,{className:`size-3`,"aria-hidden":!0})]}):null,t[7]=l,t[8]=a,t[9]=b):b=t[9];let x;t[10]===u?x=t[11]:(x=u===null?null:(0,Z.jsx)(GN,{identity:u}),t[10]=u,t[11]=x);let S;t[12]===x?S=t[13]:(S=(0,Z.jsx)(`span`,{className:`flex min-w-0 items-center gap-3`,children:x}),t[12]=x,t[13]=S);let C;t[14]!==l||t[15]!==d.chars||t[16]!==d.tokens||t[17]!==d.words||t[18]!==m||t[19]!==f||t[20]!==s||t[21]!==h||t[22]!==p?(C=s?(0,Z.jsxs)(`span`,{className:`flex shrink-0 items-center gap-3`,children:[f?(0,Z.jsx)(`span`,{className:`font-medium text-foreground/70`,"data-testid":`editor-footer-selected-label`,children:l({id:`ylXj1N`})}):null,(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:d.words.toLocaleString()}),` `,(0,Z.jsx)(J,{id:`gljvbT`,values:{words:p}})]}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:d.chars.toLocaleString()}),` `,(0,Z.jsx)(J,{id:`d5rK4X`,values:{chars:m}})]}),(0,Z.jsxs)(`span`,{children:[d.tokens>0?`~`:``,(0,Z.jsx)(`span`,{className:`tabular-nums`,children:d.tokens.toLocaleString()}),` `,(0,Z.jsx)(J,{id:`uynXup`,values:{tokens:h}})]})]}):null,t[14]=l,t[15]=d.chars,t[16]=d.tokens,t[17]=d.words,t[18]=m,t[19]=f,t[20]=s,t[21]=h,t[22]=p,t[23]=C):C=t[23];let w;return t[24]!==C||t[25]!==g||t[26]!==v||t[27]!==b||t[28]!==S?(w=(0,Z.jsxs)(`section`,{"aria-label":g,className:v,children:[y,b,S,C]}),t[24]=C,t[25]=g,t[26]=v,t[27]=b,t[28]=S,t[29]=w):w=t[29],w}function GN(e){let t=(0,$.c)(8),{identity:n}=e,{projectName:r,projectPath:i,branch:a}=n,o;t[0]!==r||t[1]!==i?(o=r===null?null:i?(0,Z.jsxs)(fn,{children:[(0,Z.jsx)(ln,{asChild:!0,children:(0,Z.jsx)(`span`,{tabIndex:0,className:`truncate`,"data-testid":`editor-footer-project-name`,children:r})}),(0,Z.jsx)(un,{side:`top`,className:`max-w-xs break-all`,children:i})]}):(0,Z.jsx)(`span`,{className:`truncate`,"data-testid":`editor-footer-project-name`,children:r}),t[0]=r,t[1]=i,t[2]=o):o=t[2];let s;t[3]===a?s=t[4]:(s=a===null?null:(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,"data-testid":`editor-footer-branch`,children:[(0,Z.jsx)(Xo,{"aria-hidden":`true`,className:`size-3 shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:a})]}),t[3]=a,t[4]=s);let c;return t[5]!==o||t[6]!==s?(c=(0,Z.jsxs)(Z.Fragment,{children:[o,s]}),t[5]=o,t[6]=s,t[7]=c):c=t[7],c}function KN(e){let t=(0,$.c)(11),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let{_:i}=vt(),a;t[3]===i?a=t[4]:(a=i({id:`3__SjS`}),t[3]=i,t[4]=a);let o;t[5]===n?o=t[6]:(o=$t(n),t[5]=n,t[6]=o);let s;return t[7]!==r||t[8]!==a||t[9]!==o?(s=(0,Z.jsx)(`nav`,{"aria-label":a,"data-slot":`breadcrumb`,className:o,...r}),t[7]=r,t[8]=a,t[9]=o,t[10]=s):s=t[10],s}function qN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=$t(`flex flex-wrap items-center gap-1.5 text-sm wrap-break-word text-muted-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`ol`,{"data-slot":`breadcrumb-list`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function JN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=$t(`inline-flex items-center gap-1`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`li`,{"data-slot":`breadcrumb-item`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function YN(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({current:i,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0||i?`page`:void 0,o;t[4]===n?o=t[5]:(o=$t(`font-normal text-foreground`,n),t[4]=n,t[5]=o);let s;return t[6]!==r||t[7]!==a||t[8]!==o?(s=(0,Z.jsx)(`span`,{"data-slot":`breadcrumb-page`,"aria-current":a,className:o,...r}),t[6]=r,t[7]=a,t[8]=o,t[9]=s):s=t[9],s}function XN(e){let t=(0,$.c)(12),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({children:n,className:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=$t(`[&>svg]:size-3.5`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=n??(0,Z.jsx)(As,{}),t[6]=n,t[7]=o);let s;return t[8]!==i||t[9]!==a||t[10]!==o?(s=(0,Z.jsx)(`li`,{"data-slot":`breadcrumb-separator`,role:`presentation`,"aria-hidden":`true`,className:a,...i,children:o}),t[8]=i,t[9]=a,t[10]=o,t[11]=s):s=t[11],s}var ZN=1,QN=2,$N=4;function eP(e){let t=(0,$.c)(18),{docName:n,className:r}=e;if(!n)return null;let i,a,o,s,c,l;if(t[0]!==r||t[1]!==n){l=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Oa(n),u=e?e.kind===`template`?e.folder.split(`/`).filter(Boolean):[]:De(n,``).prefix.replace(/\/$/,``).split(`/`).filter(Boolean);if(u.length===0){l=null;break bb0}let d=(e,t)=>({kind:`segment`,value:e,key:u.slice(0,t+1).join(`/`)}),f=u.length>$N?[...u.slice(0,ZN).map((e,t)=>d(e,t)),{kind:`ellipsis`,hidden:u.slice(ZN,-QN)},...u.slice(-QN).map((e,t)=>d(e,u.length-QN+t))]:u.map((e,t)=>d(e,t));a=KN,t[8]===r?c=t[9]:(c=$t(`flex min-w-0 items-center`,r),t[8]=r,t[9]=c),i=qN,o=`min-w-0 flex-nowrap gap-1 overflow-hidden text-muted-foreground/70 text-xs`,s=f.map(tP)}t[0]=r,t[1]=n,t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l}else i=t[2],a=t[3],o=t[4],s=t[5],c=t[6],l=t[7];if(l!==Symbol.for(`react.early_return_sentinel`))return l;let u;t[10]!==i||t[11]!==o||t[12]!==s?(u=(0,Z.jsx)(i,{className:o,children:s}),t[10]=i,t[11]=o,t[12]=s,t[13]=u):u=t[13];let d;return t[14]!==a||t[15]!==c||t[16]!==u?(d=(0,Z.jsx)(a,{className:c,children:u}),t[14]=a,t[15]=c,t[16]=u,t[17]=d):d=t[17],d}function tP(e,t){let n=e.kind===`segment`?e.key:`ellipsis`;return(0,Z.jsxs)(Q.Fragment,{children:[t>0&&(0,Z.jsx)(XN,{className:`shrink-0 text-muted-foreground/70 [&>svg]:size-3`}),e.kind===`ellipsis`?(0,Z.jsxs)(JN,{className:`shrink-0`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,title:e.hidden.join(` / `),className:`flex size-4 items-center justify-center text-muted-foreground/70`,children:(0,Z.jsx)(Wm,{className:`size-3.5`})}),(0,Z.jsx)(`span`,{className:`sr-only`,children:e.hidden.join(` / `)})]}):(0,Z.jsx)(JN,{className:`min-w-0`,children:(0,Z.jsx)(YN,{current:!1,className:`min-w-0 truncate font-normal text-muted-foreground/70`,title:e.value,children:e.value})})]},n)}var nP=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{SkillEditorActions:e}=await import(`./SkillEditorActions-BEtnBlep.js`);return{SkillEditorActions:e}},__vite__mapDeps([136,1,6,2,3,7,8,9,10,11,12,17,18,105,16,19,106,14,15,40,24,41,21,84,22,25,83,111,38,23,26,107,112,96,85,29,77,30,113,89,78,90,114,58,97,32,115,33,76,54,56,36,116,117]),import.meta.url)).SkillEditorActions}));function rP(e){let t=(0,$.c)(85),{activeDocName:n,isSourceMode:r,sourceDisabled:i,onModeChange:a,showAddPropertyButton:o,onAddProperty:s,isPanelCollapsed:c,onTogglePanel:l,reserveRightGutter:u}=e,d=u===void 0?!1:u,{_:f}=vt(),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=xl(`toggle-document-panel`),t[0]=p):p=t[0];let m=p,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k;if(t[1]!==f||t[2]!==n||t[3]!==c||t[4]!==r||t[5]!==s||t[6]!==a||t[7]!==l||t[8]!==d||t[9]!==o||t[10]!==i){let e=Cl(`toggle-document-panel`),u;t[26]===n?u=t[27]:(u=n?Oa(n):null,t[26]=n,t[27]=u);let p=u,m;t[28]===n?m=t[29]:(m=n?ce(n):null,t[28]=n,t[29]=m);let A=m,j;t[30]!==p||t[31]!==A?(j=p?.kind===`skill`?{scope:p.scope,name:p.name}:A?{scope:`project`,name:A}:null,t[30]=p,t[31]=A,t[32]=j):j=t[32];let M=j;b=`editor-toolbar`,x=`pointer-events-none absolute inset-x-0 top-0 z-10`;let N;t[33]!==n||t[34]!==M?(N=M?null:(0,Z.jsx)(eP,{docName:n}),t[33]=n,t[34]=M,t[35]=N):N=t[35];let P;t[36]===n?P=t[37]:(P=n===null?null:(0,Z.jsx)(gS,{entry:{kind:`document`,docName:n},className:`shrink-0`}),t[36]=n,t[37]=P);let F;t[38]!==N||t[39]!==P?(F=(0,Z.jsxs)(`div`,{className:`pointer-events-auto flex min-w-0 items-center gap-2`,children:[N,P]}),t[38]=N,t[39]=P,t[40]=F):F=t[40];let I;t[41]!==r||t[42]!==a||t[43]!==i?(I=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex justify-center`,children:(0,Z.jsx)(lw,{isSourceMode:r,onModeChange:a,sourceDisabled:i})}),t[41]=r,t[42]=a,t[43]=i,t[44]=I):I=t[44],t[45]!==F||t[46]!==I?(S=(0,Z.jsx)(`div`,{className:`editor-content-aligned bg-background py-2`,children:(0,Z.jsxs)(`div`,{className:`grid grid-cols-3 items-center`,children:[F,I]})}),t[45]=F,t[46]=I,t[47]=S):S=t[47];let L=d&&`pr-9`;t[48]===L?_=t[49]:(_=$t(`pointer-events-auto absolute top-0 right-0 flex items-center justify-end gap-1 py-2 pr-2`,L),t[48]=L,t[49]=_),t[50]===M?v=t[51]:(v=M?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(nP,{scope:M.scope,name:M.name})}):null,t[50]=M,t[51]=v),t[52]!==f||t[53]!==s||t[54]!==o?(y=o&&(0,Z.jsxs)(fn,{children:[(0,Z.jsx)(Y,{variant:`ghost`,size:`icon`,"aria-label":f({id:`81H_23`}),onClick:s,"data-testid":`add-properties-button`,asChild:!0,children:(0,Z.jsx)(ln,{children:(0,Z.jsx)(lh,{})})}),(0,Z.jsx)(un,{side:`bottom`,children:(0,Z.jsx)(J,{id:`81H_23`})})]}),t[52]=f,t[53]=s,t[54]=o,t[55]=y):y=t[55],g=fn,h=Y,C=``,w=`ghost`,T=`icon`,E=l,D=!c,O=`doc-panel`,k=f(c?{id:`u7H-Wn`,values:{panelShortcutLabel:e}}:{id:`2hpdRq`,values:{panelShortcutLabel:e}}),t[1]=f,t[2]=n,t[3]=c,t[4]=r,t[5]=s,t[6]=a,t[7]=l,t[8]=d,t[9]=o,t[10]=i,t[11]=h,t[12]=g,t[13]=_,t[14]=v,t[15]=y,t[16]=b,t[17]=x,t[18]=S,t[19]=C,t[20]=w,t[21]=T,t[22]=E,t[23]=D,t[24]=O,t[25]=k}else h=t[11],g=t[12],_=t[13],v=t[14],y=t[15],b=t[16],x=t[17],S=t[18],C=t[19],w=t[20],T=t[21],E=t[22],D=t[23],O=t[24],k=t[25];let A;t[56]===c?A=t[57]:(A=(0,Z.jsx)(ln,{children:c?(0,Z.jsx)(el,{}):(0,Z.jsx)($c,{})}),t[56]=c,t[57]=A);let j;t[58]!==h||t[59]!==A||t[60]!==C||t[61]!==w||t[62]!==T||t[63]!==E||t[64]!==D||t[65]!==O||t[66]!==k?(j=(0,Z.jsx)(h,{"data-doc-panel-toggle":C,variant:w,size:T,onClick:E,"aria-expanded":D,"aria-controls":O,"aria-label":k,asChild:!0,children:A}),t[58]=h,t[59]=A,t[60]=C,t[61]=w,t[62]=T,t[63]=E,t[64]=D,t[65]=O,t[66]=k,t[67]=j):j=t[67];let M;t[68]===c?M=t[69]:(M=(0,Z.jsx)(un,{side:`bottom`,children:c?(0,Z.jsx)(J,{id:`KFdXwz`,values:{panelShortcut:m}}):(0,Z.jsx)(J,{id:`MsuXaI`,values:{panelShortcut:m}})}),t[68]=c,t[69]=M);let N;t[70]!==g||t[71]!==j||t[72]!==M?(N=(0,Z.jsxs)(g,{children:[j,M]}),t[70]=g,t[71]=j,t[72]=M,t[73]=N):N=t[73];let P;t[74]!==_||t[75]!==v||t[76]!==y||t[77]!==N?(P=(0,Z.jsxs)(`div`,{className:_,children:[v,y,N]}),t[74]=_,t[75]=v,t[76]=y,t[77]=N,t[78]=P):P=t[78];let F;t[79]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none h-2 bg-linear-to-b from-background to-transparent`}),t[79]=F):F=t[79];let I;return t[80]!==b||t[81]!==x||t[82]!==S||t[83]!==P?(I=(0,Z.jsxs)(`div`,{"data-testid":b,className:x,children:[S,P,F]}),t[80]=b,t[81]=x,t[82]=S,t[83]=P,t[84]=I):I=t[84],I}function iP(e){let{activeDocName:t,deferredActiveDocName:n,mountResolved:r,syncResolved:i}=e;return t===null||t===n?!1:!(r&&i)}function aP(e){let{currentLayout:t,containerPx:n,pinnedPx:r,residualId:i}=e;if(n<=0||!(i in t))return t;let a={...t},o=0;for(let[e,i]of Object.entries(r)){if(!(e in t))continue;let r=i/n*100;a[e]=r,o+=r}let s=0;for(let[e,n]of Object.entries(t))e===i||e in r||(s+=n);let c=100-o-s;return c<0?t:(a[i]=c,a)}var oP=`ok-terminal-height-v1`,sP=1/3,cP=.5;function lP(e){return Math.max(120,Math.round((Number.isFinite(e)?e:0)*cP))}function uP(e){let t=Number.isFinite(e)?e:0;return t<=0?240:Math.round(t*sP)}function dP(e,t){let n=lP(t);return Number.isFinite(e)?e<120?120:e>n?n:Math.round(e):Math.min(uP(t),n)}function fP(){return typeof window>`u`?0:window.innerHeight}function pP(e,t){try{let n=e??localStorage,r=t??fP(),i=n.getItem(oP);if(i==null)return dP(uP(r),r);let a=Number.parseInt(i,10);return dP(Number.isFinite(a)?a:uP(r),r)}catch{return 240}}function mP(e,t,n){try{let r=t??localStorage,i=n??fP();r.setItem(oP,String(dP(e,i)))}catch{}}function hP(){try{return typeof localStorage>`u`?240:pP()}catch{return 240}}function gP(e){let t=(0,$.c)(19),{dockPosition:n,onReveal:r,className:i}=e,{_:a}=vt(),o=n===`right`,s;t[0]===a?s=t[1]:(s=a({id:`vja0Dg`}),t[0]=a,t[1]=s);let c=s,l=o?`rounded-r-none border-r-0`:`rounded-b-none border-b-0`,u;t[2]!==i||t[3]!==l?(u=$t(`absolute z-20 shrink-0 bg-background text-muted-foreground shadow-sm hover:text-foreground`,l,i),t[2]=i,t[3]=l,t[4]=u):u=t[4];let d;t[5]===o?d=t[6]:(d=o?(0,Z.jsx)(Os,{"aria-hidden":`true`}):(0,Z.jsx)(pt,{"aria-hidden":`true`}),t[5]=o,t[6]=d);let f;t[7]!==n||t[8]!==c||t[9]!==r||t[10]!==u||t[11]!==d?(f=(0,Z.jsx)(ln,{asChild:!0,children:(0,Z.jsx)(Y,{type:`button`,variant:`outline`,size:`icon-sm`,"aria-label":c,"data-terminal-reveal":n,onClick:r,className:u,children:d})}),t[7]=n,t[8]=c,t[9]=r,t[10]=u,t[11]=d,t[12]=f):f=t[12];let p=o?`left`:`top`,m;t[13]!==c||t[14]!==p?(m=(0,Z.jsx)(un,{side:p,sideOffset:8,children:c}),t[13]=c,t[14]=p,t[15]=m):m=t[15];let h;return t[16]!==f||t[17]!==m?(h=(0,Z.jsxs)(fn,{children:[f,m]}),t[16]=f,t[17]=m,t[18]=h):h=t[18],h}var _P=`terminal-dock-panel`;function vP(e){let t=(0,$.c)(42),{children:n,visible:r,onVisibleChange:i,dockPosition:a,onBottomContainer:o,onEditorRegion:s,onReveal:c,showRevealTab:l}=e,u=a===void 0?`bottom`:a,d=l===void 0?!1:l,{resolvedTheme:f}=zt(),p=nS(),[m,h]=(0,Q.useState)(!r),g=Cf(f).background,_=r&&u===`bottom`,v=d&&u===`bottom`&&c!=null,[y]=(0,Q.useState)(yP),b=(0,Q.useRef)(y),[x,S]=(0,Q.useState)(!1),C=(0,Q.useRef)(!1),w=(0,Q.useRef)(null),T;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(T=function(e){w.current!=null&&clearTimeout(w.current),w.current=setTimeout(()=>{mP(e),w.current=null},100)},t[0]=T):T=t[0];let E=T,D=(0,Q.useRef)(null),O,k;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(O=()=>()=>{w.current!=null&&clearTimeout(w.current),D.current!=null&&(window.removeEventListener(`pointerup`,D.current),D.current=null)},k=[],t[1]=O,t[2]=k):(O=t[1],k=t[2]),(0,Q.useEffect)(O,k);let A,j;t[3]!==_||t[4]!==p?(A=()=>{let e=p.current;e!=null&&(_?e.resize(`${b.current}px`):e.collapse())},j=[_,p],t[3]=_,t[4]=p,t[5]=A,t[6]=j):(A=t[5],j=t[6]),(0,Q.useEffect)(A,j);let M=x||void 0,N;t[7]!==c||t[8]!==v?(N=v&&c?(0,Z.jsx)(gP,{dockPosition:`bottom`,onReveal:c,className:`right-3 bottom-0`}):null,t[7]=c,t[8]=v,t[9]=N):N=t[9];let P;t[10]!==n||t[11]!==s||t[12]!==N?(P=(0,Z.jsx)(tT,{minSize:`5%`,className:`flex min-h-0 flex-col`,children:(0,Z.jsxs)(`div`,{ref:s,tabIndex:-1,className:`relative flex h-full min-h-0 flex-col outline-none`,children:[n,N]})}),t[10]=n,t[11]=s,t[12]=N,t[13]=P):P=t[13];let F=!_,I;t[14]===_?I=t[15]:(I=()=>{if(!_)return;S(!0),C.current=!0;let e=()=>{S(!1),C.current=!1,window.removeEventListener(`pointerup`,e),D.current=null};D.current=e,window.addEventListener(`pointerup`,e)},t[14]=_,t[15]=I);let L;t[16]!==_||t[17]!==F||t[18]!==I?(L=(0,Z.jsx)(nT,{withHandle:_,disabled:F,onPointerDown:I}),t[16]=_,t[17]=F,t[18]=I,t[19]=L):L=t[19];let R;t[20]===g?R=t[21]:(R={backgroundColor:g},t[20]=g,t[21]=R);let z=_?`${y}px`:0,B;t[22]!==i||t[23]!==r?(B=e=>{let t=e.asPercentage===0;h(t),C.current&&(t&&r?i(!1):!t&&!r&&i(!0),e.inPixels>0&&(b.current=e.inPixels,E(e.inPixels)))},t[22]=i,t[23]=r,t[24]=B):B=t[24];let V=!x&&`transition-[flex-grow] duration-150 ease-out motion-reduce:transition-none motion-reduce:duration-0`,H;t[25]===V?H=t[26]:(H=$t(`flex flex-col`,V),t[25]=V,t[26]=H);let U;t[27]===o?U=t[28]:(U=(0,Z.jsx)(`div`,{ref:o,className:`flex min-h-0 flex-1 flex-col overflow-hidden`}),t[27]=o,t[28]=U);let W;t[29]!==m||t[30]!==p||t[31]!==R||t[32]!==z||t[33]!==B||t[34]!==H||t[35]!==U?(W=(0,Z.jsx)(tT,{id:_P,style:R,panelRef:p,defaultSize:z,minSize:`120px`,maxSize:`95%`,collapsible:!0,collapsedSize:0,onResize:B,inert:m,className:H,children:U}),t[29]=m,t[30]=p,t[31]=R,t[32]=z,t[33]=B,t[34]=H,t[35]=U,t[36]=W):W=t[36];let ee;return t[37]!==P||t[38]!==L||t[39]!==W||t[40]!==M?(ee=(0,Z.jsxs)(eT,{orientation:`vertical`,className:`min-h-0 flex-1`,"data-dragging":M,children:[P,L,W]}),t[37]=P,t[38]=L,t[39]=W,t[40]=M,t[41]=ee):ee=t[41],ee}function yP(){return hP()}var bP=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-BQeZuILy.js`),__vite__mapDeps([61,1,62,2,63,64,9,65,66,67,68,69,70,71,72,15,6,3,7,8,73,58,12,22,11,74,75,76,38,10,17,18,25,77,78,31,19,52,53,35,55,79,14,16,4,80,40,23,24,26,81,28,20,82,21,83,84,27,29,51,54,56,57,85,86,87,30,88,89,90,91,32,33,92,93,94,95,96,97,98,99,100]),import.meta.url)).ActivityModeContent})),xP=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./TimelineDiffPane-Zfm2PLUq.js`),__vite__mapDeps([137,1,2,138,62,63,64,9,65,66,67,68,69,70,71,72,15,6,3,7,8,73,58,12,22,11,74,75,76,38,10,17,18,25,77,78,31,19,52,53,35,55,79,14,16,4,80,40,23,24,26,81,28,20,82,21,83,84,27,29,51,54,56,57,85,86,87,30,88,89,90,91,32,33,92,93,139,39,41,140,94,100]),import.meta.url)).TimelineDiffPane})),SP=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./AgentDiffPane-CiFNU0h-.js`),__vite__mapDeps([141,1,2,138,62,63,64,9,65,66,67,68,69,70,71,72,15,6,3,7,8,73,58,12,22,11,74,75,76,38,10,17,18,25,77,78,31,19,52,53,35,55,79,14,16,4,80,40,23,24,26,81,28,20,82,21,83,84,27,29,51,54,56,57,85,86,87,30,88,89,90,91,32,33,92,93,139,39,41,140,95,96,97,100,98,99]),import.meta.url)).AgentDiffPane})),CP=`300px`,wP=`600px`,TP=new Set([`doc-panel`,`terminal-column`,`agent-panel`]);function EP(e){let t=(0,$.c)(5),n;t[0]===e?n=t[1]:(n=(0,Z.jsx)(OP,{...e}),t[0]=e,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(DP,{}),t[2]=r):r=t[2];let i;return t[3]===n?i=t[4]:(i=(0,Z.jsx)(Ql,{name:`editor-area`,children:(0,Z.jsxs)(_s,{children:[n,r]})}),t[3]=n,t[4]=i),i}function DP(){let e=(0,$.c)(6),t=Hi(),n;e[0]===t?n=e[1]:(n=e=>{e||t.close()},e[0]=t,e[1]=n);let r;return e[2]!==t.open||e[3]!==t.section||e[4]!==n?(r=(0,Z.jsx)(Uw,{open:t.open,initialSection:t.section,onOpenChange:n}),e[2]=t.open,e[3]=t.section,e[4]=n,e[5]=r):r=e[5],r}function OP(e){let t=(0,$.c)(282),{editorMode:n,onModeChange:r,activeTab:i,onActiveTabChange:a,terminalBridge:o,terminalVisible:s,onTerminalVisibleChange:c,terminalDock:l,terminalHasSessions:u,onTerminalPlacement:d,onRevealTerminal:f}=e,p=s===void 0?!1:s,m=l===void 0?`right`:l,h=u===void 0?!1:u,{_:g}=vt(),{resolvedTheme:_}=zt(),v=Cf(_).background,{activeDocName:y,activeProvider:b,activeTarget:x,recycleDocument:S,docPanelMode:C,docPanelAgentId:w,docPanelExpandSignal:T}=Re(),{openDocumentTransition:E}=Ye(),{requestAddProperty:D}=ps(),O=vT(b,y),k=xT(y,n===`source`?`source`:`wysiwyg`),A=KT(b),j=A===`connected`||A===`synced`,M=bT(y)===`conflict`,[N,P]=(0,Q.useState)(!1),F,I;t[0]!==b||t[1]!==N?(F=()=>{b!=null&&!N&&P(!0)},I=[b,N],t[0]=b,t[1]=N,t[2]=F,t[3]=I):(F=t[2],I=t[3]),(0,Q.useEffect)(F,I);let L=(0,Q.useDeferredValue)(y),R=x?.kind===`missing`,z=!!y&&x?.kind!==`folder`,B;t[4]!==g||t[5]!==R?(B=R?g({id:`K-a33w`}):void 0,t[4]=g,t[5]=R,t[6]=B):B=t[6];let V=B,H=ul(),U,W;t[7]!==y||t[8]!==H?(U=()=>{H&&H.docName!==y&&dl()},W=[y,H],t[7]=y,t[8]=H,t[9]=U,t[10]=W):(U=t[9],W=t[10]),(0,Q.useEffect)(U,W);let ee=Od(),G=ee?.docName??null,K=(0,Q.useRef)(null),te;t[11]!==y||t[12]!==G||t[13]!==E?(te=()=>{if(G==null){K.current=null;return}if(K.current=G,G!==y){let e=lu(G);window.location.hash===e?E(G):window.location.hash=e}},t[11]=y,t[12]=G,t[13]=E,t[14]=te):te=t[14];let ne;t[15]===G?ne=t[16]:(ne=[G],t[15]=G,t[16]=ne),(0,Q.useEffect)(te,ne);let re,ie;t[17]!==y||t[18]!==G?(re=()=>{if(G!=null){if(G===y){K.current=null;return}K.current!==G&&Ad()}},ie=[y,G],t[17]=y,t[18]=G,t[19]=re,t[20]=ie):(re=t[19],ie=t[20]),(0,Q.useEffect)(re,ie);let oe,se;t[21]!==w||t[22]!==C?(oe=()=>{C===`agent`&&w!==null||Ad()},se=[C,w],t[21]=w,t[22]=C,t[23]=oe,t[24]=se):(oe=t[23],se=t[24]),(0,Q.useEffect)(oe,se);let ce=(0,Q.useSyncExternalStore)(es.subscribe,es.getSnapshot,es.getSnapshot),le;t[25]!==x||t[26]!==ce?(le=is(x,ce),t[25]=x,t[26]=ce,t[27]=le):le=t[27];let ue=le,[de]=(0,Q.useState)(NP),fe=de!==null,pe;t[28]===de?pe=t[29]:(pe=()=>AT(de,window.innerWidth,`right`),t[28]=de,t[29]=pe);let[me,he]=(0,Q.useState)(pe),ge=(0,Q.useRef)(me),_e,ve;t[30]===me?(_e=t[31],ve=t[32]):(_e=()=>{ge.current=me},ve=[me],t[30]=me,t[31]=_e,t[32]=ve),(0,Q.useEffect)(_e,ve);let ye=nS(),be=nS(),xe;t[33]===me?xe=t[34]:(xe=()=>zT(`right`,me,LT())===`collapsed`,t[33]=me,t[34]=xe);let[Se]=(0,Q.useState)(xe),[Ce,we]=(0,Q.useState)(Se),Te=(0,Q.useRef)(Ce),[Ee,De]=(0,Q.useState)(null),[Oe,ke]=(0,Q.useState)(null),[Ae,je]=(0,Q.useState)(null),Me=o?.terminal!=null,Ne=m===`right`,Pe=Ne?`right`:`bottom`,Fe=Ne&&p,Ie=!p&&f!=null&&(Me||h),Le=Ie&&!Ne,ze=Ie&&Ne,Be=Ne&&p&&Ee!=null,Ve=Be?Ee:Oe,He=(Ne?Be:p)&&Ve!=null,Ue,We;t[35]!==Ve||t[36]!==d||t[37]!==Pe||t[38]!==Ae||t[39]!==He?(Ue=()=>{d?.({container:Ve,isShowing:He,dockPosition:Pe,editorRegion:Ae})},We=[d,Ve,He,Pe,Ae],t[35]=Ve,t[36]=d,t[37]=Pe,t[38]=Ae,t[39]=He,t[40]=Ue,t[41]=We):(Ue=t[40],We=t[41]),(0,Q.useEffect)(Ue,We);let Ge,Ke;t[42]===Ce?(Ge=t[43],Ke=t[44]):(Ge=()=>{Te.current=Ce},Ke=[Ce],t[42]=Ce,t[43]=Ge,t[44]=Ke),(0,Q.useEffect)(Ge,Ke);let[qe,Je]=(0,Q.useState)(!1),Xe=(0,Q.useRef)(!1),[Ze]=(0,Q.useState)(MP),Qe=(0,Q.useRef)(Ze),$e=(0,Q.useRef)(null),et;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(et=function(e){$e.current!=null&&clearTimeout($e.current),$e.current=setTimeout(()=>{TT(e),$e.current=null},100)},t[45]=et):et=t[45];let tt=et,[nt]=(0,Q.useState)(jP),rt=(0,Q.useRef)(nt),[it,at]=(0,Q.useState)(!1),ot=(0,Q.useRef)(!1),st=(0,Q.useRef)(null),ct;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(ct=function(e){st.current!=null&&clearTimeout(st.current),st.current=setTimeout(()=>{WT(e),st.current=null},100)},t[46]=ct):ct=t[46];let lt=ct,ut,dt;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(ut=()=>()=>{$e.current!=null&&clearTimeout($e.current),st.current!=null&&clearTimeout(st.current)},dt=[],t[47]=ut,t[48]=dt):(ut=t[47],dt=t[48]),(0,Q.useEffect)(ut,dt);let[ft,pt]=(0,Q.useState)(null),mt=(0,Q.useRef)(null),ht=Zx(),gt=(0,Q.useRef)(Fe),_t,yt;t[49]===Fe?(_t=t[50],yt=t[51]):(_t=()=>{gt.current=Fe},yt=[Fe],t[49]=Fe,t[50]=_t,t[51]=yt),(0,Q.useEffect)(_t,yt);let bt;t[52]!==ye||t[53]!==be?(bt=function(){for(let e of[ye,be]){let t=e.current?.getSize();if(t!=null&&t.asPercentage>1&&t.inPixels>0)return t.inPixels/t.asPercentage*100}let e=mt.current;return e!=null&&e.offsetWidth>0?e.offsetWidth:null},t[52]=ye,t[53]=be,t[54]=bt):bt=t[54];let xt=bt,St;t[55]!==ht||t[56]!==xt?(St=function(e){if(Xe.current||ot.current)return;let t=ht.current;if(t!=null)try{let n=xt();if(n==null)return;let r=t.getLayout(),i=Object.keys(r);if(i.length===0)return;let a=i.find(AP);if(a==null)return;let o={};if(`doc-panel`in r&&(o[`doc-panel`]=e?0:Qe.current),`terminal-column`in r&&(o[`terminal-column`]=rt.current),Object.keys(o).length===0)return;let s=aP({currentLayout:r,containerPx:n,pinnedPx:o,residualId:a});s!==r&&t.setLayout(s)}catch{}},t[55]=ht,t[56]=xt,t[57]=St):St=t[57];let Ct=St,wt=(0,Q.useRef)(Ct),Tt;t[58]===Ct?Tt=t[59]:(Tt=()=>{wt.current=Ct},t[58]=Ct,t[59]=Tt),(0,Q.useEffect)(Tt);let Et;t[60]!==Ct||t[61]!==ye?(Et=function(){gt.current?Ct(!1):ye.current?.expand()},t[60]=Ct,t[61]=ye,t[62]=Et):Et=t[62];let Dt=Et,Ot;t[63]!==Ct||t[64]!==Ce||t[65]!==ye?(Ot=function(){if(ye.current==null)return;let e=ge.current;Ce?(BT(`right`,e,`open`),gt.current?Ct(!1):ye.current?.expand()):(BT(`right`,e,`collapsed`),gt.current?Ct(!0):ye.current?.collapse())},t[63]=Ct,t[64]=Ce,t[65]=ye,t[66]=Ot):Ot=t[66];let kt=Ot,At,jt;t[67]!==Ct||t[68]!==de||t[69]!==ye?(At=()=>{let e=window.matchMedia(`(min-width: ${OT}px)`),t=()=>{let e=AT(de,window.innerWidth,`right`);he(e);let t=zT(`right`,e,LT())===`collapsed`;we(t),gt.current?Ct(t):t?ye.current?.collapse():ye.current?.expand()};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},jt=[de,ye,Ct],t[67]=Ct,t[68]=de,t[69]=ye,t[70]=At,t[71]=jt):(At=t[70],jt=t[71]),(0,Q.useEffect)(At,jt);let Mt,Nt;t[72]!==ft||t[73]!==fe?(Mt=()=>{if(ft==null||fe)return;let e=new ResizeObserver(()=>{wt.current(Te.current)});return e.observe(ft),()=>e.disconnect()},Nt=[ft,fe],t[72]=ft,t[73]=fe,t[74]=Mt,t[75]=Nt):(Mt=t[74],Nt=t[75]),(0,Q.useEffect)(Mt,Nt);let Pt,Ft;t[76]!==Dt||t[77]!==a?(Pt=()=>{let e=e=>{a(e),Dt()},t=ug();return t&&e(t),fg(t=>{ug(),e(t)})},Ft=[a,Dt],t[76]=Dt,t[77]=a,t[78]=Pt,t[79]=Ft):(Pt=t[78],Ft=t[79]),(0,Q.useEffect)(Pt,Ft);let It,Lt;t[80]!==T||t[81]!==Dt?(It=()=>{T!==0&&Dt()},Lt=[T,Dt],t[80]=T,t[81]=Dt,t[82]=It,t[83]=Lt):(It=t[82],Lt=t[83]),(0,Q.useEffect)(It,Lt);let Rt=(0,Q.useRef)(Fe),Bt,Vt;t[84]!==Ce||t[85]!==Fe?(Bt=()=>{if(Rt.current===Fe)return;Rt.current=Fe;let e=Ce;queueMicrotask(()=>{wt.current(e)})},Vt=[Fe,Ce],t[84]=Ce,t[85]=Fe,t[86]=Bt,t[87]=Vt):(Bt=t[86],Vt=t[87]),(0,Q.useLayoutEffect)(Bt,Vt);let Ht,Ut;t[88]===Ce?(Ht=t[89],Ut=t[90]):(Ht=()=>{if(!Ce||!document.getElementById(`doc-panel`)?.contains(document.activeElement))return;let e=document.querySelector(`[data-doc-panel-toggle]`);if(e){e.focus();return}document.querySelector(`[data-sidebar="trigger"]`)?.focus()},Ut=[Ce],t[88]=Ce,t[89]=Ht,t[90]=Ut),(0,Q.useLayoutEffect)(Ht,Ut);let Wt,Kt;t[91]===Ce?(Wt=t[92],Kt=t[93]):(Wt=()=>{Ic({docPanelVisible:!Ce}),window.okDesktop!=null&&window.okDesktop.editor.notifyViewMenuStateChanged({docPanelVisible:!Ce})},Kt=[Ce],t[91]=Ce,t[92]=Wt,t[93]=Kt),(0,Q.useEffect)(Wt,Kt);let qt,Jt;t[94]===kt?(qt=t[95],Jt=t[96]):(qt=()=>Gt(e=>{e===`toggle-doc-panel`&&kt()}),Jt=[kt],t[94]=kt,t[95]=qt,t[96]=Jt),(0,Q.useEffect)(qt,Jt);let Yt,Xt;t[97]===kt?(Yt=t[98],Xt=t[99]):(Yt=()=>{if(window.okDesktop!=null)return;let e=e=>{Sl(e,`toggle-document-panel`)&&(e.preventDefault(),kt())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},Xt=[kt],t[97]=kt,t[98]=Yt,t[99]=Xt),(0,Q.useEffect)(Yt,Xt);let Zt=(0,Q.useRef)(null),[Qt,en]=(0,Q.useState)(null),[tn,nn]=(0,Q.useState)(!1),Y=x?.kind===`large-file`?x.docName:y,rn,an;t[100]===Y?(rn=t[101],an=t[102]):(rn=()=>{if(Y&&Y!==Zt.current){let e=Zt.current;Zt.current=Y,en(e)}},an=[Y],t[100]=Y,t[101]=rn,t[102]=an),(0,Q.useEffect)(rn,an);let on;t[103]===E?on=t[104]:(on=function(e){let t=lu(e);window.location.hash===t?E(e):window.location.hash=t},t[103]=E,t[104]=on);let sn=on,cn,ln=null;if(x?.kind===`large-file`){let e;t[105]!==sn||t[106]!==Qt?(e=Qt?{previousDocName:Qt,onNavigateBack:sn}:void 0,t[105]=sn,t[106]=Qt,t[107]=e):e=t[107];let n;t[108]!==x.docName||t[109]!==x.limit||t[110]!==x.size||t[111]!==e?(n=(0,Z.jsx)(iw,{docName:x.docName,size:x.size,limit:x.limit,backNav:e}),t[108]=x.docName,t[109]=x.limit,t[110]=x.size,t[111]=e,t[112]=n):n=t[112],cn=n}else if(x?.kind===`folder`){let e;t[113]!==fe||t[114]!==p?(e=LE({terminalVisible:p,isEmbedded:fe}),t[113]=fe,t[114]=p,t[115]=e):e=t[115];let n=e,r;t[116]===x.folderPath?r=t[117]:(r=(0,Z.jsx)(ew,{folderPath:x.folderPath}),t[116]=x.folderPath,t[117]=r);let i;t[118]===n?i=t[119]:(i=n?(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-0 h-2 bg-linear-to-t from-background to-transparent`}):null,t[118]=n,t[119]=i);let a;t[120]!==r||t[121]!==i?(a=(0,Z.jsxs)(`div`,{className:`relative flex min-h-0 flex-1 flex-col`,children:[r,i]}),t[120]=r,t[121]=i,t[122]=a):a=t[122];let o;t[123]!==x.folderPath||t[124]!==n?(o=n?(0,Z.jsx)(CE,{folderPath:x.folderPath}):null,t[123]=x.folderPath,t[124]=n,t[125]=o):o=t[125];let s;if(t[126]!==a||t[127]!==o?(s=(0,Z.jsxs)(`div`,{className:`relative flex h-full min-h-0 flex-col`,children:[a,o]}),t[126]=a,t[127]=o,t[128]=s):s=t[128],cn=s,C===`agent`&&w!==null){let e;t[129]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(nT,{withHandle:!0}),t[129]=e):e=t[129];let n;t[130]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(Z.Fragment,{children:[e,(0,Z.jsx)(tT,{id:`agent-panel`,defaultSize:`25%`,minSize:`300px`,maxSize:`40%`,className:`flex flex-col bg-muted/20`,children:(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(`div`,{role:`status`,"aria-busy":`true`,className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`ONPvOb`})}),children:(0,Z.jsx)(bP,{showBackButton:!1})})})]}),t[130]=n):n=t[130],ln=n}}else if(x?.kind===`asset`&&jo(x.assetPath.split(`/`).pop()??x.assetPath)){let e;t[131]===x.assetPath?e=t[132]:(e=(0,Z.jsx)(vw,{assetPath:x.assetPath},x.assetPath),t[131]=x.assetPath,t[132]=e),cn=e}else if(x?.kind===`asset`){let e;t[133]!==x.assetPath||t[134]!==x.mediaKind?(e=(0,Z.jsx)(yS,{assetPath:x.assetPath,mediaKind:x.mediaKind},x.assetPath),t[133]=x.assetPath,t[134]=x.mediaKind,t[135]=e):e=t[135],cn=e}else if(x?.kind===`skill-file`){let e=`${x.scope}/${x.name}/${x.path}`,n;t[136]!==x.name||t[137]!==x.path||t[138]!==x.scope||t[139]!==e?(n=(0,Z.jsx)(Mw,{scope:x.scope,name:x.name,path:x.path},e),t[136]=x.name,t[137]=x.path,t[138]=x.scope,t[139]=e,t[140]=n):n=t[140],cn=n}else if(ue){let e;t[141]===ue?e=t[142]:(e=(0,Z.jsx)(xw,{nav:ue},ue.path),t[141]=ue,t[142]=e),cn=e}else if(!b||!y)if((typeof window<`u`?cu(window.location.hash):null)!==null)if(o!=null&&N){let e;t[143]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(xS,{}),t[143]=e):e=t[143],cn=e;let n;t[144]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(nT,{withHandle:!0,disabled:!0}),t[144]=n):n=t[144];let r=Se?0:`${Ze}px`,i;t[145]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`}),t[145]=i):i=t[145];let a;t[146]===r?a=t[147]:(a=(0,Z.jsxs)(Z.Fragment,{children:[n,(0,Z.jsx)(tT,{id:`doc-panel`,defaultSize:r,minSize:CP,maxSize:wP,collapsible:!0,collapsedSize:0,inert:!0,className:`flex flex-col bg-muted/20`,children:i})]}),t[146]=r,t[147]=a),ln=a}else{let e;return t[148]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(xS,{}),t[148]=e):e=t[148],e}else{let e=p?Pe:null,n;t[149]===e?n=t[150]:(n=(0,Z.jsx)(xC,{terminalDock:e}),t[149]=e,t[150]=n),cn=n}else{let e=n===`source`,o=!j,s=Ce,c;t[151]!==y||t[152]!==D?(c=function(){y&&D(y)},t[151]=y,t[152]=D,t[153]=c):c=t[153];let l=c,u;t[154]!==y||t[155]!==ee||t[156]!==G||t[157]!==fe||t[158]!==p||t[159]!==H?(u=IE({terminalVisible:p,isEmbedded:fe,activeDocName:y})&&!(H&&H.docName===y)&&!(ee&&G===y),t[154]=y,t[155]=ee,t[156]=G,t[157]=fe,t[158]=p,t[159]=H,t[160]=u):u=t[160];let d=u,f=L??y,m=Qt??void 0,h;t[161]!==V||t[162]!==e||t[163]!==sn||t[164]!==S||t[165]!==f||t[166]!==m?(h=(0,Z.jsx)(UM,{activeDocName:f,isSourceMode:e,editorPlaceholder:V,previousDocName:m,onNavigateBack:sn,onRecycle:S}),t[161]=V,t[162]=e,t[163]=sn,t[164]=S,t[165]=f,t[166]=m,t[167]=h):h=t[167];let g;t[168]!==y||t[169]!==e?(g=(0,Z.jsx)(mT,{activeDocName:y,isSourceMode:e}),t[168]=y,t[169]=e,t[170]=g):g=t[170];let _;t[171]!==y||t[172]!==L?(_=iP({activeDocName:y,deferredActiveDocName:L,mountResolved:y!==null&&ae(y),syncResolved:y!==null&&q(y)})?(0,Z.jsxs)(`div`,{className:`absolute inset-0 z-10 bg-background`,children:[(0,Z.jsx)(xS,{}),y===null?null:(0,Z.jsx)(yw,{docName:y})]}):null,t[171]=y,t[172]=L,t[173]=_):_=t[173];let v;t[174]!==y||t[175]!==Ce||t[176]!==H||t[177]!==kt?(v=H&&H.docName===y?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(xP,{view:H,isPanelCollapsed:Ce,onTogglePanel:kt})}):null,t[174]=y,t[175]=Ce,t[176]=H,t[177]=kt,t[178]=v):v=t[178];let b;t[179]!==y||t[180]!==ee||t[181]!==G||t[182]!==Ce||t[183]!==kt?(b=ee&&G===y?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(SP,{view:ee,isPanelCollapsed:Ce,onTogglePanel:kt})}):null,t[179]=y,t[180]=ee,t[181]=G,t[182]=Ce,t[183]=kt,t[184]=b):b=t[184];let x;t[185]!==h||t[186]!==g||t[187]!==_||t[188]!==v||t[189]!==b?(x=(0,Z.jsxs)(`div`,{className:`relative h-full`,children:[h,g,_,v,b]}),t[185]=h,t[186]=g,t[187]=_,t[188]=v,t[189]=b,t[190]=x):x=t[190];let w;t[191]!==y||t[192]!==M||t[193]!==s||t[194]!==e||t[195]!==r||t[196]!==l||t[197]!==ze||t[198]!==o||t[199]!==kt?(w=!M&&(0,Z.jsx)(rP,{activeDocName:y,isSourceMode:e,sourceDisabled:o,onModeChange:r,showAddPropertyButton:!e,onAddProperty:l,isPanelCollapsed:s,onTogglePanel:kt,reserveRightGutter:ze&&s}),t[191]=y,t[192]=M,t[193]=s,t[194]=e,t[195]=r,t[196]=l,t[197]=ze,t[198]=o,t[199]=kt,t[200]=w):w=t[200];let T;t[201]!==y||t[202]!==tn||t[203]!==e||t[204]!==d?(T=d?(0,Z.jsx)(CE,{docName:y,surface:e?`source`:`wysiwyg`,dismissed:tn,onDismiss:()=>nn(!0),onReopen:()=>nn(!1)}):null,t[201]=y,t[202]=tn,t[203]=e,t[204]=d,t[205]=T):T=t[205];let E;t[206]!==x||t[207]!==w||t[208]!==T?(E=(0,Z.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[x,w,T]}),t[206]=x,t[207]=w,t[208]=T,t[209]=E):E=t[209];let A;t[210]!==tn||t[211]!==d?(A=d&&tn?{onReopen:()=>nn(!1)}:null,t[210]=tn,t[211]=d,t[212]=A):A=t[212];let N;t[213]!==Le||t[214]!==k||t[215]!==z||t[216]!==O||t[217]!==A?(N=(0,Z.jsx)(WN,{stats:O,selectionStats:k,showStats:z,composerBadge:A,reserveRightGutter:Le}),t[213]=Le,t[214]=k,t[215]=z,t[216]=O,t[217]=A,t[218]=N):N=t[218];let P;t[219]!==E||t[220]!==N?(P=(0,Z.jsxs)(`div`,{className:`relative flex h-full flex-col`,children:[E,N]}),t[219]=E,t[220]=N,t[221]=P):P=t[221],cn=P;let F=Fe&&Ce,I=!Ce,R;t[222]===Symbol.for(`react.memo_cache_sentinel`)?(R=()=>{Je(!0),Xe.current=!0;let e=()=>{Je(!1),Xe.current=!1,window.removeEventListener(`pointerup`,e)};window.addEventListener(`pointerup`,e)},t[222]=R):R=t[222];let B;t[223]!==Ce||t[224]!==I?(B=(0,Z.jsx)(nT,{withHandle:I,disabled:Ce,onPointerDown:R}),t[223]=Ce,t[224]=I,t[225]=B):B=t[225];let U=Se?0:`${Ze}px`,W=F?`0px`:CP,K;t[226]===Symbol.for(`react.memo_cache_sentinel`)?(K=e=>{we(e.asPercentage===0),e.inPixels>0&&Xe.current&&(Qe.current=e.inPixels,tt(e.inPixels))},t[226]=K):K=t[226];let te=!qe&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,ne;t[227]===te?ne=t[228]:(ne=$t(`flex flex-col bg-muted/20`,te),t[227]=te,t[228]=ne);let re;t[229]!==y||t[230]!==i||t[231]!==C||t[232]!==e||t[233]!==a?(re=(0,Z.jsx)(ob,{docName:y,isSourceMode:e,activeTab:i,onActiveTabChange:a,mode:C}),t[229]=y,t[230]=i,t[231]=C,t[232]=e,t[233]=a,t[234]=re):re=t[234];let ie;t[235]!==F||t[236]!==Ce||t[237]!==ye||t[238]!==U||t[239]!==W||t[240]!==ne||t[241]!==re?(ie=(0,Z.jsx)(tT,{id:`doc-panel`,panelRef:ye,disabled:F,defaultSize:U,minSize:W,maxSize:wP,collapsible:!0,collapsedSize:0,onResize:K,inert:Ce,className:ne,children:re}),t[235]=F,t[236]=Ce,t[237]=ye,t[238]=U,t[239]=W,t[240]=ne,t[241]=re,t[242]=ie):ie=t[242];let oe;t[243]!==B||t[244]!==ie?(oe=(0,Z.jsxs)(Z.Fragment,{children:[B,ie]}),t[243]=B,t[244]=ie,t[245]=oe):oe=t[245],ln=oe}let un=c??kP,dn;t[246]!==Le||t[247]!==f||t[248]!==un||t[249]!==Pe||t[250]!==p||t[251]!==cn?(dn=(0,Z.jsx)(vP,{visible:p,onVisibleChange:un,dockPosition:Pe,onBottomContainer:ke,onEditorRegion:je,onReveal:f,showRevealTab:Le,children:cn}),t[246]=Le,t[247]=f,t[248]=un,t[249]=Pe,t[250]=p,t[251]=cn,t[252]=dn):dn=t[252];let fn=dn,pn;t[253]!==nt||t[254]!==it||t[255]!==c||t[256]!==be||t[257]!==Fe||t[258]!==v?(pn=Fe?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(nT,{withHandle:!0,onPointerDown:()=>{at(!0),ot.current=!0;let e=()=>{at(!1),ot.current=!1,window.removeEventListener(`pointerup`,e),be.current?.isCollapsed()&&c?.(!1)};window.addEventListener(`pointerup`,e)}}),(0,Z.jsx)(tT,{id:`terminal-column`,panelRef:be,style:{backgroundColor:v},defaultSize:`${nt}px`,minSize:`320px`,maxSize:`95%`,collapsible:!0,collapsedSize:0,onResize:e=>{e.inPixels>0&&ot.current&&(rt.current=e.inPixels,lt(e.inPixels))},className:$t(`flex flex-col`,!it&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`),children:(0,Z.jsx)(`div`,{ref:De,className:`flex min-h-0 flex-1 flex-col overflow-hidden`})})]}):null,t[253]=nt,t[254]=it,t[255]=c,t[256]=be,t[257]=Fe,t[258]=v,t[259]=pn):pn=t[259];let mn=pn,hn=ln!=null&&!Se||Fe,gn;t[260]===Symbol.for(`react.memo_cache_sentinel`)?(gn=e=>{pt(e),mt.current=e},t[260]=gn):gn=t[260];let _n=qe||it||void 0,vn=Fe?`5%`:`30%`,yn;t[261]===hn?yn=t[262]:(yn=hn?{}:{defaultSize:`100%`},t[261]=hn,t[262]=yn);let bn=!(qe||it)&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,xn;t[263]===bn?xn=t[264]:(xn=$t(bn),t[263]=bn,t[264]=xn);let Sn;t[265]!==fn||t[266]!==vn||t[267]!==yn||t[268]!==xn?(Sn=(0,Z.jsx)(tT,{minSize:vn,...yn,className:xn,children:fn}),t[265]=fn,t[266]=vn,t[267]=yn,t[268]=xn,t[269]=Sn):Sn=t[269];let Cn;t[270]!==ht||t[271]!==ln||t[272]!==_n||t[273]!==Sn||t[274]!==mn?(Cn=(0,Z.jsxs)(eT,{orientation:`horizontal`,groupRef:ht,"data-dragging":_n,children:[Sn,ln,mn]}),t[270]=ht,t[271]=ln,t[272]=_n,t[273]=Sn,t[274]=mn,t[275]=Cn):Cn=t[275];let wn;t[276]!==f||t[277]!==ze?(wn=ze?(0,Z.jsx)(gP,{dockPosition:`right`,onReveal:f,className:`top-2.5 right-0`}):null,t[276]=f,t[277]=ze,t[278]=wn):wn=t[278];let Tn;return t[279]!==Cn||t[280]!==wn?(Tn=(0,Z.jsxs)(`div`,{className:`relative flex min-h-0 flex-1`,ref:gn,children:[Cn,wn]}),t[279]=Cn,t[280]=wn,t[281]=Tn):Tn=t[281],Tn}function kP(){}function AP(e){return!TP.has(e)}function jP(){return GT()}function MP(){return ET()}function NP(){return Na()}function PP(){if(typeof window>`u`)return!1;let e=window.okDesktop;return e!=null&&e.menu!=null&&e.platform!==`darwin`}function FP(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r.kind!==i.kind)return!1;if(r.kind===`human`&&i.kind===`human`){if(r.clientId!==i.clientId||r.mode!==i.mode||r.tabCount!==i.tabCount)return!1;let e=r.user,t=i.user;if(e.name!==t.name||e.color!==t.color||e.icon!==t.icon)return!1}else if(r.kind===`agent`&&i.kind===`agent`){if(r.agentId!==i.agentId)return!1;let e=r.presence,t=i.presence;if(e.displayName!==t.displayName||e.icon!==t.icon||e.color!==t.color||e.currentDoc!==t.currentDoc||e.mode!==t.mode)return!1}}return!0}function IP(e){let t=new Map;for(let n of e){let e=n.user.principalId;if(typeof e==`string`&&e.length>0){let r=t.get(e);r?r.push(n):t.set(e,[n])}}let n=new Map;for(let[e,r]of t){let t=r.reduce((e,t)=>Math.min(e,t.clientId),1/0);n.set(e,{repClientId:t,count:r.length})}let r=[];for(let t of e){let e=t.user.principalId;if(typeof e==`string`&&e.length>0){let i=n.get(e);i&&i.repClientId===t.clientId&&r.push({...t,tabCount:i.count})}else r.push({...t,tabCount:1})}return r}var LP=1e3,RP=!1;function zP(e){return!!(e.localPrincipalId&&e.entryPrincipalId===e.localPrincipalId||!e.localPrincipalId&&e.entryClientId===e.localClientId)}function BP(e,t,n){let r=(0,$.c)(9),i;r[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={current:[],crossDoc:[]},r[0]=i):i=r[0];let[a,o]=(0,Q.useState)(i),s;r[1]!==n||r[2]!==e?.awareness||r[3]!==t?.awareness?(s=()=>{let r=e?.awareness,i=t?.awareness,a;i==null?a=void 0:wf(i)?a=i:(a=void 0,RP||(RP=!0,console.warn(`[agent-presence] __system__ provider awareness missing getStates() — presence bar will render without agent peers`)));let s=()=>{let e=(r?.getLocalState())?.user?.principalId??null,t=r?.clientID??null,i=[];if(r)for(let[n,a]of r.getStates().entries()){let r=a;if(!r.user||typeof r.user!=`object`)continue;let o=r.user;o.type===`human`&&(zP({entryPrincipalId:o.principalId,entryClientId:n,localPrincipalId:e,localClientId:t})||i.push({kind:`human`,clientId:n,user:o,mode:r.mode??`wysiwyg`,tabCount:1}))}let s=IP(i),{current:c,crossDoc:l}=a?Tf(a,n,Date.now()):{current:[],crossDoc:[]},u=VP,d=c.map(u),f=l.map(u),p=[...s,...d],m=f;o(e=>FP(e.current,p)&&FP(e.crossDoc,m)?e:{current:p,crossDoc:m})};s();let c=()=>s(),l=()=>s();r?.on(`change`,c),t?.awareness?.on(`change`,l);let u=setInterval(s,LP);return()=>{r?.off(`change`,c),t?.awareness?.off(`change`,l),clearInterval(u)}},r[1]=n,r[2]=e?.awareness,r[3]=t?.awareness,r[4]=s):s=r[4];let c;return r[5]!==n||r[6]!==e||r[7]!==t?(c=[e,t,n],r[5]=n,r[6]=e,r[7]=t,r[8]=c):c=r[8],(0,Q.useEffect)(s,c),a}function VP(e){let{agentId:t,entry:n}=e;return{kind:`agent`,agentId:t,presence:n}}var HP=!1,UP=new Set,WP=!1;function GP(){for(let e of UP)e()}function KP(e){HP!==e&&(HP=e,GP())}function qP(){return HP}function JP(e){return UP.add(e),()=>{UP.delete(e)}}function YP(e){let t=[e.onUpdateRelaunching(()=>KP(!0)),e.onUpdateRelaunchFailed(()=>KP(!1))];return()=>{for(let e of t)e()}}function XP(){if(WP||typeof window>`u`)return;let e=window.okDesktop;e&&(WP=!0,YP(e))}function ZP(){return(0,Q.useSyncExternalStore)(JP,qP,QP)}function QP(){return!1}var $P=`sync-status`;async function eF(e){try{let t=await Ev(e);t.ok||X.error(t.message,{id:$P,duration:1/0})}catch{}}function tF(e,t){let n=(0,$.c)(6),{_:r}=vt(),i=ZP(),a=(0,Q.useRef)(!1),o=(0,Q.useRef)(!1),s=(0,Q.useRef)(t),c,l;n[0]!==r||n[1]!==t||n[2]!==i||n[3]!==e?(c=()=>{if(s.current!==t&&(s.current=t,a.current=!1,o.current=!1),t)if(e===`synced`&&(a.current=!0),e===`disconnected`&&a.current){if(i){X.dismiss($P);return}o.current=!0;let e=window.okDesktop;X.warning(r({id:`HGNCsl`}),{id:$P,duration:1/0,...e?{action:{label:r({id:`uaUc6t`}),onClick:()=>{eF(e)}}}:{}})}else o.current&&e===`synced`&&(o.current=!1,X.success(r({id:`GhjUB_`}),{id:$P,duration:3e3}))},l=[e,t,r,i],n[0]=r,n[1]=t,n[2]=i,n[3]=e,n[4]=c,n[5]=l):(c=n[4],l=n[5]),(0,Q.useEffect)(c,l)}var nF=4,rF=3,iF={Bird:Mm,Cat:Lm,Dog:Um,Fish:Xm,Mouse:Sh,Rabbit:xh,Shrimp:Dh,Snail:Oh,Squirrel:jh,Turtle:Vh};Object.freeze(Object.keys(iF));function aF(e){if(typeof e.principalId==`string`&&e.principalId.length>0)return{kind:`initials`};let t=e.name.split(` `)[1];return t&&Object.hasOwn(iF,t)?{kind:`animal`,animal:t}:{kind:`initials`}}var oF={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`,bot:`Agent`};function sF(e){let t=(0,$.c)(28),{user:n,mode:r,tabCount:i}=e,{_:a}=vt(),o=aF(n),s=o.kind===`animal`?iF[o.animal]:void 0,c;t[0]===n.name?c=t[1]:(c=Ha(n.name),t[0]=n.name,t[1]=c);let l=c,u;t[2]===n.color?u=t[3]:(u=da(n.color),t[2]=n.color,t[3]=u);let d=u,f=n.name,p;t[4]!==a||t[5]!==i||t[6]!==f?(p=i>1?a({id:`qAhFeg`,values:{userName:f,tabCount:i}}):f,t[4]=a,t[5]=i,t[6]=f,t[7]=p):p=t[7];let m=p,h;t[8]!==a||t[9]!==i||t[10]!==f?(h=i>1?a({id:`BEkF-P`,values:{userName:f,tabCount:i}}):f,t[8]=a,t[9]=i,t[10]=f,t[11]=h):h=t[11];let g=h,_;t[12]===n.color?_=t[13]:(_={backgroundColor:n.color},t[12]=n.color,t[13]=_);let v;t[14]!==s||t[15]!==d||t[16]!==l?(v=s?(0,Z.jsx)(s,{size:18,color:d,strokeWidth:1.5}):(0,Z.jsx)(`span`,{className:`font-mono text-2xs font-semibold leading-none`,style:{color:d},children:l}),t[14]=s,t[15]=d,t[16]=l,t[17]=v):v=t[17];let y;t[18]!==g||t[19]!==r||t[20]!==_||t[21]!==v?(y=(0,Z.jsx)(ln,{asChild:!0,children:(0,Z.jsx)(`div`,{"data-presence-badge":`human`,"data-presence-mode":r,role:`img`,"aria-label":g,className:`inline-flex size-7 shrink-0 cursor-default items-center justify-center rounded-full ring-2 ring-background`,style:_,children:v})}),t[18]=g,t[19]=r,t[20]=_,t[21]=v,t[22]=y):y=t[22];let b;t[23]===m?b=t[24]:(b=(0,Z.jsx)(un,{children:m}),t[23]=m,t[24]=b);let x;return t[25]!==y||t[26]!==b?(x=(0,Z.jsxs)(fn,{children:[y,b]}),t[25]=y,t[26]=b,t[27]=x):x=t[27],x}function cF(e){let t=oF[e.icon];return e.displayName||t||yl._({id:`iEQQyu`})}function lF(e){let t=(0,$.c)(3),[n,r]=(0,Q.useState)(e===`writing`),i=(0,Q.useRef)(null),a,o;return t[0]===e?(a=t[1],o=t[2]):(a=()=>{if(e===`writing`){i.current!==null&&(clearTimeout(i.current),i.current=null),r(!0);return}return i.current!==null&&clearTimeout(i.current),i.current=setTimeout(()=>{i.current=null,r(!1)},600),()=>{i.current!==null&&(clearTimeout(i.current),i.current=null)}},o=[e],t[0]=e,t[1]=a,t[2]=o),(0,Q.useEffect)(a,o),n}function uF(e){let t=(0,$.c)(33),{participant:n,crossDoc:r,scoped:i,onClickAgent:a}=e,{_:o}=vt(),{activeDocName:s}=Re(),{presence:c,agentId:l}=n,u=cF(c),d=lF(c.mode),f=!r&&d,p=c.currentDoc&&!yo(c.currentDoc)?c.currentDoc:null,m=s!==null||p!==null,h=m?`cursor-pointer`:`cursor-default opacity-50`,g=i?`ring-primary ring-offset-2 ring-offset-background`:`ring-background`,_=f&&!i?`ring-primary/40 animate-pulse`:``,v;t[0]!==h||t[1]!==g||t[2]!==_?(v=[`inline-flex size-7 shrink-0 items-center justify-center rounded-full ring-2`,h,g,_].filter(Boolean),t[0]=h,t[1]=g,t[2]=_,t[3]=v):v=t[3];let y=v.join(` `),b=r?`true`:void 0,x=i?`true`:void 0,S=m?void 0:`true`,C;t[4]!==c.mode||t[5]!==b||t[6]!==x||t[7]!==S?(C={"data-presence-badge":`agent`,"data-presence-mode":c.mode,"data-presence-crossdoc":b,"data-presence-scoped":x,"data-presence-inert":S},t[4]=c.mode,t[5]=b,t[6]=x,t[7]=S,t[8]=C):C=t[8];let w=C,T=o(r&&p?{id:`b4AQFK`,values:{tooltipName:u,realCurrentDoc:p}}:{id:`RfHNf8`,values:{tooltipName:u}}),E;t[9]!==l||t[10]!==T||t[11]!==w||t[12]!==m||t[13]!==a||t[14]!==c.color||t[15]!==c.icon||t[16]!==p||t[17]!==y||t[18]!==u?(E=m?(0,Z.jsx)(`button`,{type:`button`,...w,"aria-label":T,className:y,style:{backgroundColor:c.color},onClick:()=>a(l,p),children:(0,Z.jsx)(kd,{icon:c.icon,width:16,height:16,className:`text-white`,"aria-hidden":!0})}):(0,Z.jsx)(`div`,{...w,role:`img`,"aria-label":u,className:y,style:{backgroundColor:c.color},children:(0,Z.jsx)(kd,{icon:c.icon,width:16,height:16,className:`text-white`,"aria-hidden":!0})}),t[9]=l,t[10]=T,t[11]=w,t[12]=m,t[13]=a,t[14]=c.color,t[15]=c.icon,t[16]=p,t[17]=y,t[18]=u,t[19]=E):E=t[19];let D=E,O;t[20]===D?O=t[21]:(O=(0,Z.jsx)(ln,{asChild:!0,children:D}),t[20]=D,t[21]=O);let k;t[22]===u?k=t[23]:(k=(0,Z.jsx)(`span`,{className:`font-medium`,children:u}),t[22]=u,t[23]=k);let A;t[24]!==r||t[25]!==p?(A=r&&p?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(J,{id:`Wh0im4`,values:{realCurrentDoc:p}})}):null,t[24]=r,t[25]=p,t[26]=A):A=t[26];let j;t[27]!==k||t[28]!==A?(j=(0,Z.jsxs)(un,{className:`flex flex-col gap-0.5`,children:[k,A]}),t[27]=k,t[28]=A,t[29]=j):j=t[29];let M;return t[30]!==O||t[31]!==j?(M=(0,Z.jsxs)(fn,{children:[O,j]}),t[30]=O,t[31]=j,t[32]=M):M=t[32],M}function dF(e){let t=(0,$.c)(21),{count:n,remainder:r,crossDoc:i,scopedAgentId:a,onClickAgent:o}=e,s;t[0]!==n||t[1]!==i?(s=i?yl._({id:`9euN0m`,values:{count:n}}):yl._({id:`uhJEA2`,values:{count:n}}),t[0]=n,t[1]=i,t[2]=s):s=t[2];let c=s,l=i?`true`:void 0,u;t[3]!==n||t[4]!==c||t[5]!==l?(u=(0,Z.jsx)(Wt,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`presence-overflow`,"data-presence-crossdoc":l,className:`inline-flex size-7 shrink-0 cursor-pointer items-center justify-center rounded-full bg-muted font-medium text-muted-foreground text-xs ring-2 ring-background hover:bg-muted/80`,"aria-label":c,children:[`+`,n]})}),t[3]=n,t[4]=c,t[5]=l,t[6]=u):u=t[6];let d;if(t[7]!==i||t[8]!==o||t[9]!==r||t[10]!==a){let e;t[12]!==i||t[13]!==o||t[14]!==a?(e=e=>e.kind===`human`?(0,Z.jsx)(sF,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(uF,{participant:e,crossDoc:i,scoped:a===e.agentId,onClickAgent:o},e.agentId),t[12]=i,t[13]=o,t[14]=a,t[15]=e):e=t[15],d=r.map(e),t[7]=i,t[8]=o,t[9]=r,t[10]=a,t[11]=d}else d=t[11];let f;t[16]===d?f=t[17]:(f=(0,Z.jsx)(Yt,{align:`end`,className:`w-auto max-w-xs p-2`,children:(0,Z.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:d})}),t[16]=d,t[17]=f);let p;return t[18]!==u||t[19]!==f?(p=(0,Z.jsxs)(Ut,{children:[u,f]}),t[18]=u,t[19]=f,t[20]=p):p=t[20],p}function fF(e,t,n,r){return e.kind===`human`?(0,Z.jsx)(sF,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(uF,{participant:e,crossDoc:n,scoped:r===e.agentId,onClickAgent:t},e.agentId)}function pF(){let e=(0,$.c)(20),{activeProvider:t,activeDocName:n,systemProvider:r,openActivityPanel:i,docPanelMode:a,docPanelAgentId:o}=Re(),{current:s,crossDoc:c}=BP(t,r,n);if(tF(KT(t),n),s.length===0&&c.length===0)return null;let l;if(e[0]!==c||e[1]!==s||e[2]!==o||e[3]!==a||e[4]!==i){let t=s.slice(0,nF),n;e[6]===s?n=e[7]:(n=s.slice(nF),e[6]=s,e[7]=n);let r=n,u=c.slice(0,rF),d;e[8]===c?d=e[9]:(d=c.slice(rF),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=>fF(e,p,!1,m),e[10]=p,e[11]=m,e[12]=h):h=e[12];let g=t.map(h),_;e[13]!==r||e[14]!==p||e[15]!==m?(_=r.length>0?(0,Z.jsx)(dF,{count:r.length,remainder:r,crossDoc:!1,scopedAgentId:m,onClickAgent:p}):null,e[13]=r,e[14]=p,e[15]=m,e[16]=_):_=e[16];let v;e[17]!==g||e[18]!==_?(v=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,"data-presence-section":`current`,children:[g,_]}),e[17]=g,e[18]=_,e[19]=v):v=e[19],l=(0,Z.jsxs)(`div`,{"data-slot":`presence-bar`,className:`flex items-center px-1 py-1.5`,children:[v,c.length>0?(0,Z.jsxs)(`div`,{className:`ml-1.5 flex items-center gap-1.5`,"data-presence-section":`crossdoc`,children:[u.map(e=>fF(e,p,!0,m)),f.length>0?(0,Z.jsx)(dF,{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}function mF(){let e=(0,$.c)(4),[t,n]=(0,Q.useState)(null),r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=window.okDesktop;if(!e)return;let t=!1;return e.state.query().then(e=>{t||n(e.channel)}).catch(hF),()=>{t=!0}},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,Q.useEffect)(r,i);let a;return e[2]===t?a=e[3]:(a={channel:t},e[2]=t,e[3]=a),a}function hF(e){console.warn(`[use-update-channel] bridge.state.query() failed`,e)}function gF(e){let t=(0,$.c)(6),{className:n}=e,{_:r}=vt(),{channel:i}=mF();if(i!==`beta`)return null;let a;t[0]===r?a=t[1]:(a=r({id:`9fhQRL`}),t[0]=r,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(J,{id:`cSCbv3`}),t[2]=o):o=t[2];let s;return t[3]!==n||t[4]!==a?(s=(0,Z.jsx)(fu,{variant:`secondary`,"aria-label":a,"data-testid":`beta-badge`,className:n,children:o}),t[3]=n,t[4]=a,t[5]=s):s=t[5],s}function _F(e,t){return t.trim()}function vF(e){return![``,`.`,`..`].includes(e)&&!e.includes(`/`)&&!e.includes(`\\`)&&!e.includes(`\0`)}function yF(e,t){let n=_F(e.kind,t),r=e.path.split(`/`);return r[r.length-1]=n,r.join(`/`)}function bF(e,t,n=[],r=[],i=[]){if(t.length===0&&n.length===0&&r.length===0&&i.length===0)return e;let a=new Map(t.map(e=>[e.fromDocName,e.toDocName])),o=new Map(i.map(e=>[e.toDocName,e.docExt])),s=new Map(r.map(e=>[e.fromPath,e.toPath]));return e.map(e=>{if(Ml(e)){let t=s.get(gf(e.docName,e.docExt));if(t){let n=kl(t);return{kind:`asset`,path:t,assetExt:n,mediaKind:Ga(n),size:e.size,modified:e.modified,referencedBy:[]}}let n=a.get(e.docName)??e.docName;return{...e,docName:n,docExt:o.get(n)??e.docExt}}if(Hl(e))return{...e,path:DF(e.path,n)};if(Ul(e)){let t=s.get(e.path);return t&&Tl(t)?{kind:`document`,docName:tf(t),docExt:Dl(t),size:e.size,modified:e.modified}:{...e,path:t??DF(e.path,n)}}return e})}function xF(e,t,n,r=[]){if(t.length===0&&!n&&r.length===0)return e;let i=new Set(t),a=new Set(r);return e.filter(e=>Ml(e)?!i.has(e.docName)&&!jF(e.docName,n):Hl(e)?!jF(e.path,n):Ul(e)?!a.has(e.path)&&!jF(e.path,n):!0)}function SF(e,t){if(e.kind!==`asset`||t.some(t=>Ul(t)&&t.path===e.path))return e;let n=yf(e.path,t);return n?{...e,path:n,name:n.split(`/`).pop()??n}:e}function CF(e,t,n,r=new Date().toISOString()){let i=!1,a=[...e],o=e=>{a.some(t=>OF(t,e))||(a.push(e),i=!0)};if(n.kind===`file`){let s=e.find(e=>Ml(e)&&e.docName===t.path);return o({kind:`document`,docName:n.path,docExt:s?.docExt??t.docExt,size:s?.size??0,modified:r}),i?a:e}let s=e.find(e=>Hl(e)&&e.path===t.path);o({kind:`folder`,path:n.path,size:s?.size??0,modified:r});let c=new Set(n.duplicatedDocNames);for(let i of e){if(Ml(i)){let e=AF(i.docName,t.path,n.path);e&&c.has(e)&&o({...i,docName:e,modified:r});continue}if(Hl(i)){let e=kF(i.path,t.path,n.path);e&&o({...i,path:e,modified:r})}}return i?a:e}function wF(e,t){return e?t.find(t=>t.fromDocName===e)?.toDocName??e:null}function TF(e,t,n){return e.flatMap(e=>t===e.toDocName||!n(e.toDocName)?[e.fromDocName]:[e.fromDocName,e.toDocName])}function EF(e,t){let n=e.kind===`file`?gf(e.path,e.docExt):e.path;return sc(t.contentDir,n,t.pathSeparator)}function DF(e,t){for(let{fromPath:n,toPath:r}of t){if(e===n)return r;if(e.startsWith(`${n}/`))return`${r}${e.slice(n.length)}`}return e}function OF(e,t){return Ml(e)&&Ml(t)?e.docName===t.docName:Hl(e)&&Hl(t)||Ul(e)&&Ul(t)?e.path===t.path:!1}function kF(e,t,n){return e===t?n:AF(e,t,n)}function AF(e,t,n){return e.startsWith(`${t}/`)?`${n}${e.slice(t.length)}`:null}function jF(e,t){return!!t&&(e===t||e.startsWith(`${t}/`))}function MF(e){let t=(0,$.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,Z.jsx)(cm,{"data-slot":`context-menu`,...n}),t[2]=n,t[3]=r),r}function NF(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=$t(`select-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(lm,{"data-slot":`context-menu-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function PF(e){let t=(0,$.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,Z.jsx)(fm,{"data-slot":`context-menu-group`,...n}),t[2]=n,t[3]=r),r}function FF(e){let t=(0,$.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,Z.jsx)(vm,{"data-slot":`context-menu-sub`,...n}),t[2]=n,t[3]=r),r}function IF(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=$t(`z-50 max-h-(--radix-context-menu-content-available-height) min-w-36 origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 motion-reduce:data-open:animate-none motion-reduce:data-closed:animate-none motion-reduce:duration-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(um,{children:(0,Z.jsx)(dm,{"data-slot":`context-menu-content`,className:i,...r})}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function LF(e){let t=(0,$.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,inset:r,variant:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?`default`:a,s;t[5]===n?s=t[6]:(s=$t(`group/context-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 focus:*:[svg]:text-accent-foreground data-[variant=destructive]:*:[svg]:text-destructive`,n),t[5]=n,t[6]=s);let c;return t[7]!==r||t[8]!==i||t[9]!==s||t[10]!==o?(c=(0,Z.jsx)(mm,{"data-slot":`context-menu-item`,"data-inset":r,"data-variant":o,className:s,...i}),t[7]=r,t[8]=i,t[9]=s,t[10]=o,t[11]=c):c=t[11],c}function RF(e){let t=(0,$.c)(13),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,inset:i,children:n,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;t[5]===r?o=t[6]:(o=$t(`flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,r),t[5]=r,t[6]=o);let s;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(As,{className:`ml-auto`}),t[7]=s):s=t[7];let c;return t[8]!==n||t[9]!==i||t[10]!==a||t[11]!==o?(c=(0,Z.jsxs)(ym,{"data-slot":`context-menu-sub-trigger`,"data-inset":i,className:o,...a,children:[n,s]}),t[8]=n,t[9]=i,t[10]=a,t[11]=o,t[12]=c):c=t[12],c}function zF(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=$t(`z-50 max-h-(--radix-context-menu-content-available-height) min-w-32 origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg border bg-popover p-1 text-popover-foreground shadow-lg data-[state=closed]:overflow-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 motion-reduce:data-open:animate-none motion-reduce:data-closed:animate-none motion-reduce:duration-0 subtle-scrollbar`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(bm,{"data-slot":`context-menu-sub-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function BF(e){let t=(0,$.c)(15),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:i,children:r,checked:n,inset:a,...o}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s;t[6]===i?s=t[7]:(s=$t(`relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,i),t[6]=i,t[7]=s);let c;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(`span`,{className:`pointer-events-none absolute right-2`,children:(0,Z.jsx)(gm,{children:(0,Z.jsx)(Ds,{})})}),t[8]=c):c=t[8];let l;return t[9]!==n||t[10]!==r||t[11]!==a||t[12]!==o||t[13]!==s?(l=(0,Z.jsxs)(hm,{"data-slot":`context-menu-checkbox-item`,"data-inset":a,className:s,checked:n,...o,children:[c,r]}),t[9]=n,t[10]=r,t[11]=a,t[12]=o,t[13]=s,t[14]=l):l=t[14],l}function VF(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,inset:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=$t(`px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7`,n),t[4]=n,t[5]=a);let o;return t[6]!==r||t[7]!==i||t[8]!==a?(o=(0,Z.jsx)(pm,{"data-slot":`context-menu-label`,"data-inset":r,className:a,...i}),t[6]=r,t[7]=i,t[8]=a,t[9]=o):o=t[9],o}function HF(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=$t(`-mx-1 my-1 h-px bg-border`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(_m,{"data-slot":`context-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var UF=[`.md`,`.mdx`],WF=`group relative -mb-px flex h-10 min-w-28 max-w-64 shrink-0 cursor-pointer items-center overflow-hidden border border-transparent font-medium transition-colors`,GF=`z-10 rounded-t-lg rounded-b-none border-border border-b-0 bg-background text-foreground`,KF=$t(GF,`bg-transparent hover:bg-muted focus-visible:bg-muted border-transparent hover:border-border focus-visible:border-border`),qF=`flex h-full min-w-0 flex-1 cursor-pointer items-center overflow-hidden px-3 text-left text-[13px]`;function JF(e){return e.replace(/[^A-Za-z0-9_-]/g,`-`)}function YF(e){let t=lu(e);window.location.hash!==t&&(window.location.hash=t)}function XF(e,t){let n=[t,...UF].filter((e,t,n)=>e&&n.indexOf(e)===t),r=e.toLowerCase(),i=n.find(t=>e.length>t.length&&r.endsWith(t.toLowerCase()));return i?e.slice(0,-i.length):e}function ZF(e){return e.metaKey||e.ctrlKey}var QF=1e3;function $F(e,t){return e<0||e>=t?null:e<8?String(e+1):e===t-1?`9`:null}function eI(e,t){return $F(e,t)}function tI(e,t){let n=$F(e,t);if(n)return[`Meta+${n}`,`Control+${n}`].join(` `)}function nI(e,t){if(!ZF(e)||e.altKey||e.shiftKey||!/^[1-9]$/.test(e.key))return null;let n=Number(e.key);if(n===9)return t>0?t-1:null;let r=n-1;return r<Math.min(8,t)?r:null}function rI(e){let t=(0,$.c)(3),{value:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=$t(Lc(!0),`font-mono tabular-nums hover:bg-transparent animate-in fade-in-0 zoom-in-95 duration-150 motion-reduce:animate-none motion-reduce:duration-0`),t[0]=r):r=t[0];let i=`⌘${n}`,a;return t[1]===i?a=t[2]:(a=(0,Z.jsx)(`span`,{"aria-hidden":`true`,"data-testid":`editor-tab-shortcut-hint`,className:r,children:(0,Z.jsx)(Oe,{className:`text-[10px]`,children:i})}),t[1]=i,t[2]=a),a}function iI(e){let t=(0,$.c)(37),n,r,i,a,o,s,c,l;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8]):({activateFromKeyboard:n,className:r,tabId:l,disabled:i,onKeyDown:a,ref:o,style:s,...c}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l);let u;t[9]!==i||t[10]!==l?(u={id:l,disabled:i},t[9]=i,t[10]=l,t[11]=u):u=t[11];let{attributes:d,listeners:f,rect:p,setNodeRef:m,transform:h,transition:g,isDragging:_}=Nd(u),v=p.current?.width,y;t[12]!==_||t[13]!==s||t[14]!==v||t[15]!==h||t[16]!==g?(y=kc({activeWidth:v,isDragging:_,outerStyle:s,transform:h,transition:g}),t[12]=_,t[13]=s,t[14]=v,t[15]=h,t[16]=g,t[17]=y):y=t[17];let b=y,x;t[18]!==o||t[19]!==m?(x=function(e){m(e),typeof o==`function`?o(e):o&&`current`in o&&(o.current=e)},t[18]=o,t[19]=m,t[20]=x):x=t[20];let S=x,C=f?.onKeyDown,w;t[21]!==n||t[22]!==_||t[23]!==a||t[24]!==C?(w=function(e){a?.(e);let t=Uc({event:e,hasKeyboardActivation:!!n,isDragging:_});if(t!==`ignore`){if(t===`activate-tab`&&n){e.preventDefault(),n();return}C?.(e)}},t[21]=n,t[22]=_,t[23]=a,t[24]=C,t[25]=w):w=t[25];let T=w,E;t[26]!==r||t[27]!==_?(E=Bc({className:r,isDragging:_}),t[26]=r,t[27]=_,t[28]=E):E=t[28];let D;return t[29]!==d||t[30]!==S||t[31]!==T||t[32]!==f||t[33]!==c||t[34]!==b||t[35]!==E?(D=(0,Z.jsx)(`div`,{ref:S,"data-editor-tab-sortable":``,className:E,style:b,...c,...d,...f,onKeyDown:T}),t[29]=d,t[30]=S,t[31]=T,t[32]=f,t[33]=c,t[34]=b,t[35]=E,t[36]=D):D=t[36],D}function aI(e){let t=(0,$.c)(52),{children:n,closeTab:r,closeTabs:a,canPin:o,disabled:s,openTabs:c,pinTab:l,pinnedTabIds:u,tabId:d,unpinTab:f}=e,p=o===void 0?!0:o;if(s!==void 0&&s)return n;let m;t[0]!==p||t[1]!==u||t[2]!==d?(m=p&&u.includes(d),t[0]=p,t[1]=u,t[2]=d,t[3]=m):m=t[3];let h=m,g;if(t[4]!==c||t[5]!==u||t[6]!==d){let e;t[8]===d?e=t[9]:(e=e=>e!==d,t[8]=d,t[9]=e),g=i(c.filter(e),u),t[4]=c,t[5]=u,t[6]=d,t[7]=g}else g=t[7];let _=g,v;t[10]!==c||t[11]!==u?(v=i(c,u),t[10]=c,t[11]=u,t[12]=v):v=t[12];let y=v,b;t[13]===n?b=t[14]:(b=(0,Z.jsx)(NF,{asChild:!0,children:n}),t[13]=n,t[14]=b);let x;t[15]!==r||t[16]!==d?(x=()=>r(d),t[15]=r,t[16]=d,t[17]=x):x=t[17];let S;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(J,{id:`yz7wBu`}),t[18]=S):S=t[18];let C;t[19]!==h||t[20]!==x?(C=(0,Z.jsx)(LF,{disabled:h,onSelect:x,children:S}),t[19]=h,t[20]=x,t[21]=C):C=t[21];let w=_.length===0,T;t[22]!==a||t[23]!==_?(T=()=>{a(_)},t[22]=a,t[23]=_,t[24]=T):T=t[24];let E;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Z.jsx)(J,{id:`omXJcU`}),t[25]=E):E=t[25];let D;t[26]!==w||t[27]!==T?(D=(0,Z.jsx)(LF,{disabled:w,onSelect:T,children:E}),t[26]=w,t[27]=T,t[28]=D):D=t[28];let O=y.length===0,k;t[29]!==y||t[30]!==a?(k=()=>{a(y)},t[29]=y,t[30]=a,t[31]=k):k=t[31];let A;t[32]===u.length?A=t[33]:(A=u.length?(0,Z.jsx)(J,{id:`U2Kx6T`}):(0,Z.jsx)(J,{id:`WyXG7w`}),t[32]=u.length,t[33]=A);let j;t[34]!==O||t[35]!==k||t[36]!==A?(j=(0,Z.jsx)(LF,{disabled:O,"data-testid":`editor-tab-context-close-all`,onSelect:k,children:A}),t[34]=O,t[35]=k,t[36]=A,t[37]=j):j=t[37];let M;t[38]!==p||t[39]!==h||t[40]!==l||t[41]!==d||t[42]!==f?(M=p&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(HF,{}),(0,Z.jsx)(LF,{"data-testid":`editor-tab-context-pin-toggle`,onSelect:()=>h?f(d):l(d),children:h?(0,Z.jsx)(J,{id:`SYfHmN`}):(0,Z.jsx)(J,{id:`3pU8e-`})})]}),t[38]=p,t[39]=h,t[40]=l,t[41]=d,t[42]=f,t[43]=M):M=t[43];let N;t[44]!==D||t[45]!==j||t[46]!==M||t[47]!==C?(N=(0,Z.jsxs)(IF,{className:`min-w-40`,children:[C,D,j,M]}),t[44]=D,t[45]=j,t[46]=M,t[47]=C,t[48]=N):N=t[48];let P;return t[49]!==N||t[50]!==b?(P=(0,Z.jsxs)(MF,{children:[b,N]}),t[49]=N,t[50]=b,t[51]=P):P=t[51],P}function oI(e){let t=(0,$.c)(28),{accessibleLabel:n,closeTab:r,forceCloseVisible:i,isActive:a,isPinned:o,shortcutHint:s,tabId:c,unpinTab:l}=e,u=i===void 0?!1:i,d=s===void 0?null:s,{_:f}=vt();if(d){let e;return t[0]===d?e=t[1]:(e=(0,Z.jsx)(rI,{value:d}),t[0]=d,t[1]=e),e}if(o){let e;t[2]!==f||t[3]!==n?(e=f({id:`t18QYR`,values:{accessibleLabel:n}}),t[2]=f,t[3]=n,t[4]=e):e=t[4];let r;t[5]!==c||t[6]!==l?(r=e=>{e.stopPropagation(),l(c)},t[5]=c,t[6]=l,t[7]=r):r=t[7];let i;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(bh,{"aria-hidden":`true`}),t[8]=i):i=t[8];let a;return t[9]!==e||t[10]!==r?(a=(0,Z.jsx)(Y,{variant:`ghost`,size:`icon-xs`,type:`button`,"aria-label":e,"data-testid":`editor-tab-unpin-button`,className:`mr-1.5 text-primary! hover:bg-primary/10!`,onClick:r,children:i}),t[9]=e,t[10]=r,t[11]=a):a=t[11],a}let p;t[12]!==f||t[13]!==n?(p=f({id:`JLzQi_`,values:{accessibleLabel:n}}),t[12]=f,t[13]=n,t[14]=p):p=t[14];let m=u||a,h;t[15]===m?h=t[16]:(h=Lc(m),t[15]=m,t[16]=h);let g;t[17]===a?g=t[18]:(g=Gc(a),t[17]=a,t[18]=g);let _;t[19]!==r||t[20]!==c?(_=e=>{e.stopPropagation(),r(c)},t[19]=r,t[20]=c,t[21]=_):_=t[21];let v;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(fl,{"aria-hidden":`true`}),t[22]=v):v=t[22];let y;return t[23]!==p||t[24]!==h||t[25]!==g||t[26]!==_?(y=(0,Z.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":p,"data-testid":`editor-tab-close-button`,className:h,tabIndex:g,onClick:_,children:v}),t[23]=p,t[24]=h,t[25]=g,t[26]=_,t[27]=y):y=t[27],y}function sI(e){let t=(0,$.c)(1),{hasConflict:n}=e;if(!n)return null;let r;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(sl,{"aria-hidden":`true`,"data-testid":`editor-tab-conflict-badge`,className:`mr-1 size-3.5 shrink-0 text-amber-500`}),t[0]=r):r=t[0],r}function cI(e){let t=(0,$.c)(27),{accessibleLabel:n,activateTab:r,baseName:i,docName:a,enterRenameMode:o,extension:s,hideDocExtension:c,tabId:l}=e,{_:u}=vt(),d=bT(a)===`conflict`,f;t[0]!==u||t[1]!==n||t[2]!==d?(f=d?u({id:`mVFyH-`,values:{accessibleLabel:n}}):n,t[0]=u,t[1]=n,t[2]=d,t[3]=f):f=t[3];let p=f,m;t[4]!==r||t[5]!==l?(m=()=>{r(l)},t[4]=r,t[5]=l,t[6]=m):m=t[6];let h;t[7]!==a||t[8]!==o||t[9]!==l?(h=e=>{e.preventDefault(),e.stopPropagation(),o(l,a)},t[7]=a,t[8]=o,t[9]=l,t[10]=h):h=t[10];let g;t[11]===d?g=t[12]:(g=(0,Z.jsx)(sI,{hasConflict:d}),t[11]=d,t[12]=g);let _;t[13]===i?_=t[14]:(_=(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:i}),t[13]=i,t[14]=_);let v;t[15]!==s||t[16]!==c?(v=!c&&(0,Z.jsx)(`span`,{className:`shrink-0`,children:s}),t[15]=s,t[16]=c,t[17]=v):v=t[17];let y;t[18]!==_||t[19]!==v?(y=(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center`,children:[_,v]}),t[18]=_,t[19]=v,t[20]=y):y=t[20];let b;return t[21]!==p||t[22]!==m||t[23]!==h||t[24]!==g||t[25]!==y?(b=(0,Z.jsxs)(`button`,{type:`button`,"aria-label":p,title:p,className:qF,onClick:m,onDoubleClick:h,tabIndex:-1,children:[g,y]}),t[21]=p,t[22]=m,t[23]=h,t[24]=g,t[25]=y,t[26]=b):b=t[26],b}function lI(){let e=(0,$.c)(94),{activeDocName:t,activeTabId:n,activeNewTabId:r,activeTarget:i,activateTab:a,activateNewTab:o,closeAndClearForRename:s,closeNewTab:c,closeTab:l,closeTabs:u,getPoolActiveDocName:d,poolHas:f,isNewTabActive:p,newTabIds:m,openNewTab:h,openTabs:g,pinTab:_,pinnedTabIds:v,reopenClosedTab:y,remapTabsForRename:b,reorderTabs:x,unpinTab:S,visibleTabIds:C}=Re(),{_:w}=vt(),{pageMeta:T}=Ns(),E=(0,Q.useRef)(null),[D,O]=(0,Q.useState)(null),[k,j]=(0,Q.useState)(null),[M,N]=(0,Q.useState)(``),[I,L]=(0,Q.useState)(null),[R,z]=(0,Q.useState)(!1),[B,V]=(0,Q.useState)(!1),H=(0,Q.useRef)(null),U=(0,Q.useRef)(!1),W=(0,Q.useRef)(!1),ee=(0,Q.useRef)(null),G=(0,Q.useRef)(t),K=(0,Q.useRef)(null),te=(0,Q.useRef)(!1),ne=(0,Q.useRef)(!1),re;e[0]!==n||e[1]!==t||e[2]!==i?(re=n??(i?Ze(i):t?F(t):null),e[0]=n,e[1]=t,e[2]=i,e[3]=re):re=e[3];let ie=re,ae;e[4]!==r||e[5]!==ie||e[6]!==p||e[7]!==m||e[8]!==g?(ae=p?`${r??`__new-tab__`}\u0000${g.join(`\0`)}\u0000${m.join(`\0`)}`:ie?`${ie}\u0000${g.join(`\0`)}`:``,e[4]=r,e[5]=ie,e[6]=p,e[7]=m,e[8]=g,e[9]=ae):ae=e[9];let oe=ae,se,ce;e[10]===t?(se=e[11],ce=e[12]):(se=()=>{G.current=t},ce=[t],e[10]=t,e[11]=se,e[12]=ce),(0,Q.useEffect)(se,ce);let le,ue;e[13]===Symbol.for(`react.memo_cache_sentinel`)?(le=()=>()=>{K.current!==null&&(window.clearTimeout(K.current),K.current=null)},ue=[],e[13]=le,e[14]=ue):(le=e[13],ue=e[14]),(0,Q.useEffect)(le,ue);let de,fe;e[15]===oe?(de=e[16],fe=e[17]):(de=()=>{oe&&(E.current?.querySelector(`[data-active-tab="true"]`))?.scrollIntoView({block:`nearest`,inline:`nearest`})},fe=[oe],e[15]=oe,e[16]=de,e[17]=fe),(0,Q.useEffect)(de,fe);let q,me;e[18]===k?(q=e[19],me=e[20]):(q=()=>{k&&(H.current?.focus(),H.current?.select())},me=[k],e[18]=k,e[19]=q,e[20]=me),(0,Q.useEffect)(q,me);let he,ge;e[21]!==g||e[22]!==k?(he=()=>{!k||g.includes(k.tabId)||(W.current=!0,ee.current=null,j(null),N(``),L(null),z(!1))},ge=[g,k],e[21]=g,e[22]=k,e[23]=he,e[24]=ge):(he=e[23],ge=e[24]),(0,Q.useEffect)(he,ge);let _e;e[25]===Symbol.for(`react.memo_cache_sentinel`)?(_e=function(e,t){let n=t.split(`/`);W.current=!1,ee.current=null,j({docName:t,tabId:e}),N(n[n.length-1]),L(null)},e[25]=_e):_e=e[25];let ve=_e,ye=function(){W.current=!0,ee.current=null,j(null),N(``),L(null),z(!1)},be=async function(){if(W.current){W.current=!1;return}if(U.current)return;let e=k?.docName;if(!e){ye();return}let t=_F(`file`,XF(M,T.get(e)?.docExt??`.md`)),n=e.split(`/`),r=n[n.length-1];if(t===r){ye();return}if(t===ee.current){H.current?.focus();return}if(!vF(t)){L(w({id:`P8yDjG`})),H.current?.focus();return}let i=yF({kind:`file`,path:e,name:r},t);U.current=!0,z(!0),L(null);try{let n=await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:`file`,fromPath:e,toPath:i})});if(W.current){z(!1),U.current=!1;return}let r=await A(n,`Server error (HTTP ${n.status})`);if(!r.ok){L(r.title),z(!1),U.current=!1,ee.current=t,H.current?.focus();return}let a=P(Ua,r.body,`rename-path:tab`,{renamed:[],renamedAssets:[]}).renamed,o=G.current,c=wF(o,a);pe(a);let l=!0;try{let e=TF(a,d(),f);await Promise.all(e.map(e=>s(e))),b(a),Kl([`files`,`backlinks`,`graph`])}catch(n){let r=n;l=!1,console.warn(`[EditorTabs] post-rename reconciliation failed`,{err:r,docName:e,newDocName:i,normalized:t}),X.error(w({id:`MUBR8r`}))}W.current=!0,j(null),N(``),L(null),z(!1),U.current=!1,ee.current=null,l&&c&&c!==o&&YF(c)}catch(n){console.warn(`[EditorTabs] rename failed`,{err:n,docName:e,newDocName:i,normalized:t}),L(w({id:`HIb0vl`})),z(!1),U.current=!1,ee.current=t,H.current?.focus()}},xe=typeof window<`u`&&window.okDesktop!=null,Se;e[26]===m?Se=e[27]:(Se=new Set(m),e[26]=m,e[27]=Se);let Ce=Se,we;e[28]===D?we=e[29]:(we=Oc(D),e[28]=D,e[29]=we);let Te;e[30]===we?Te=e[31]:(Te=[we],e[30]=we,e[31]=Te);let Ee=Te,Oe;e[32]!==c||e[33]!==u||e[34]!==Ce?(Oe=function(e){let t=[],n=[];for(let r of e)Ce.has(r)?n.push(r):t.push(r);t.length>0&&u(t);for(let e of n)c(e)},e[32]=c,e[33]=u,e[34]=Ce,e[35]=Oe):Oe=e[35];let ke=Oe,Ae,je;e[36]!==o||e[37]!==a||e[38]!==r||e[39]!==ie||e[40]!==p||e[41]!==m||e[42]!==h||e[43]!==y||e[44]!==C?(Ae=()=>{let e=new Set(m),t=function(){K.current!==null&&(window.clearTimeout(K.current),K.current=null)},n=function(e){te.current!==e&&(te.current=e)},i=function(e){ne.current!==e&&(ne.current=e,V(e))},s=function(){n(!0),!(ne.current||K.current!==null)&&(K.current=window.setTimeout(()=>{K.current=null,te.current&&i(!0)},QF))},c=function(){t(),n(!1),i(!1)},l=function(t){e.has(t)?o(t):a(t)},u=function(e){if(C.length===0)return;let t=p?r:ie,n=t?C.indexOf(t):-1;l(C[((n>=0?n:0)+e+C.length)%C.length])},d=function(e){if(ZF(e)&&s(),Sl(e,`tab-new`)){e.preventDefault(),h();return}if(Sl(e,`tab-reopen-closed`)){e.preventDefault(),y();return}if(Sl(e,`tab-next`)){e.preventDefault(),u(1);return}if(Sl(e,`tab-previous`)){e.preventDefault(),u(-1);return}let t=nI(e,C.length);t!==null&&(e.preventDefault(),l(C[t]))},f=function(e){!e.metaKey&&!e.ctrlKey&&c()};return window.addEventListener(`keydown`,d,{capture:!0}),window.addEventListener(`keyup`,f,{capture:!0}),window.addEventListener(`blur`,c),document.addEventListener(`visibilitychange`,c),()=>{window.removeEventListener(`keydown`,d,{capture:!0}),window.removeEventListener(`keyup`,f,{capture:!0}),window.removeEventListener(`blur`,c),document.removeEventListener(`visibilitychange`,c)}},je=[r,ie,o,a,p,m,h,y,C],e[36]=o,e[37]=a,e[38]=r,e[39]=ie,e[40]=p,e[41]=m,e[42]=h,e[43]=y,e[44]=C,e[45]=Ae,e[46]=je):(Ae=e[45],je=e[46]),(0,Q.useEffect)(Ae,je);let Me;e[47]===Symbol.for(`react.memo_cache_sentinel`)?(Me={activationConstraint:{distance:8}},e[47]=Me):Me=e[47];let Ne;e[48]===Symbol.for(`react.memo_cache_sentinel`)?(Ne={coordinateGetter:Fd,keyboardCodes:Pc},e[48]=Ne):Ne=e[48];let Pe=Rd(Pd(Hd,Me),Pd(Id,Ne)),Fe=B,Ie;e[49]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=function(){O(Ac(E.current,`[data-editor-tab-sortable]`))},e[49]=Ie):Ie=e[49];let Le=Ie,ze;e[50]===Symbol.for(`react.memo_cache_sentinel`)?(ze=function(){O(null)},e[50]=ze):ze=e[50];let Be=ze,Ve;e[51]!==Be||e[52]!==x||e[53]!==C?(Ve=function(e){Be();let t=String(e.active.id),n=e.over?String(e.over.id):null;if(!n||t===n)return;let r=C.indexOf(t),i=C.indexOf(n);r<0||i<0||r===i||x(Ld([...C],r,i),t)},e[51]=Be,e[52]=x,e[53]=C,e[54]=Ve):Ve=e[54];let He=Ve,Ue=xe?``:void 0,We;e[55]===Symbol.for(`react.memo_cache_sentinel`)?(We=$t(`pl-2 flex h-12 min-w-0 touch-manipulation flex-1 items-end overflow-x-auto overflow-y-hidden overscroll-x-contain scroll-fade-mask-x [scrollbar-width:none]`,xe&&`[-webkit-app-region:drag]`),e[55]=We):We=e[55];let Ge=Hc,Ke;e[56]===Symbol.for(`react.memo_cache_sentinel`)?(Ke=$t(`flex items-end gap-1`,xe&&`[-webkit-app-region:no-drag]`),e[56]=Ke):Ke=e[56];let qe=Bd,Je=jc,Ye;e[57]===Symbol.for(`react.memo_cache_sentinel`)?(Ye={container:typeof document<`u`?document.body:void 0},e[57]=Ye):Ye=e[57];let Xe=Vd,Qe;e[58]===C?Qe=e[59]:(Qe=[...C],e[58]=C,e[59]=Qe);let $e=zd,et=C.map((e,t)=>{let n=B?eI(t,C.length):null,i=tI(t,C.length);if(Ce.has(e)){let t=e===r;return(0,Z.jsx)(aI,{tabId:e,canPin:!1,openTabs:C,closeTab:c,closeTabs:ke,pinTab:_,pinnedTabIds:v,unpinTab:S,children:(0,Z.jsxs)(iI,{tabId:e,activateFromKeyboard:()=>o(e),"aria-current":t?`page`:void 0,"aria-keyshortcuts":i,"data-active-tab":t?`true`:void 0,className:$t(WF,t?GF:KF),onAuxClick:t=>{t.button===1&&(t.preventDefault(),c(e))},onClick:t=>{t.target===t.currentTarget&&o(e)},children:[(0,Z.jsx)(`button`,{type:`button`,"aria-label":w({id:`zLak8b`}),"data-testid":`editor-new-tab-placeholder-button`,className:qF,onClick:()=>o(e),tabIndex:-1,children:(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:(0,Z.jsx)(J,{id:`3YvS-c`})})}),n?(0,Z.jsx)(rI,{value:n}):(0,Z.jsx)(`button`,{type:`button`,"aria-label":w({id:`xCdTnb`}),"data-testid":`editor-new-tab-placeholder-close`,className:Lc(Fe||t),tabIndex:Gc(t),onClick:t=>{t.stopPropagation(),c(e)},children:(0,Z.jsx)(fl,{"aria-hidden":`true`,className:`size-3.5`})})]})},e)}let s=rt(e),u=e===ie,d=v.includes(e);if(s.kind===`folder`){let{baseName:t,label:r,prefix:o}=De(s.folderPath,`/`),c=`${o}${r}`;return(0,Z.jsx)(aI,{tabId:e,openTabs:C,closeTab:l,closeTabs:ke,pinTab:_,pinnedTabIds:v,unpinTab:S,children:(0,Z.jsxs)(iI,{tabId:e,activateFromKeyboard:()=>a(e),"aria-current":u?`page`:void 0,"aria-keyshortcuts":i,"data-active-tab":u?`true`:void 0,className:$t(WF,u?GF:KF),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!d&&l(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":c,title:c,className:qF,onClick:()=>{a(e)},tabIndex:-1,children:[o&&(0,Z.jsx)(`span`,{className:$t(`min-w-0 flex-1 truncate`,u&&`text-muted-foreground`),children:o}),(0,Z.jsxs)(`span`,{className:$t(`flex min-w-0 items-center`,o?`max-w-[70%] shrink-0`:`flex-1`),children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:t}),(0,Z.jsx)(`span`,{className:`shrink-0`,children:`/`})]})]}),(0,Z.jsx)(oI,{accessibleLabel:c,closeTab:l,forceCloseVisible:Fe,isActive:u,isPinned:d,shortcutHint:n,tabId:e,unpinTab:S})]})},e)}if(s.kind===`asset`||s.kind===`skill-file`){let{baseName:t,label:r,prefix:o}=De(s.kind===`asset`?s.assetPath:s.path,``),c=`${o}${r}`;return(0,Z.jsx)(aI,{tabId:e,openTabs:C,closeTab:l,closeTabs:ke,pinTab:_,pinnedTabIds:v,unpinTab:S,children:(0,Z.jsxs)(iI,{tabId:e,activateFromKeyboard:()=>a(e),"aria-current":u?`page`:void 0,"aria-keyshortcuts":i,"data-active-tab":u?`true`:void 0,className:$t(WF,u?GF:KF),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!d&&l(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":c,className:qF,onClick:()=>{a(e)},tabIndex:-1,children:[o?(0,Z.jsx)(`span`,{className:$t(`min-w-0 flex-1 truncate text-muted-foreground/60`,u&&`text-muted-foreground`),children:o}):null,(0,Z.jsx)(`span`,{className:$t(`min-w-0 truncate`,o?`max-w-[70%] shrink-0`:`flex-1`),children:t})]}),(0,Z.jsx)(oI,{accessibleLabel:c,closeTab:l,forceCloseVisible:Fe,isActive:u,isPinned:d,shortcutHint:n,tabId:e,unpinTab:S})]})},e)}let f=s.docName,p=T.get(f)?.docExt??`.md`,{baseName:m,extension:h,label:g,prefix:y}=De(f,p),b=`${y}${g}`,x=p===`.md`||p===`.mdx`,E=k?.tabId===e,D=`editor-tab-rename-error-${JF(f)}`;return(0,Z.jsx)(aI,{disabled:E,tabId:e,openTabs:C,closeTab:l,closeTabs:ke,pinTab:_,pinnedTabIds:v,unpinTab:S,children:(0,Z.jsx)(iI,{tabId:e,activateFromKeyboard:()=>a(e),disabled:E,"aria-current":u?`page`:void 0,"aria-keyshortcuts":i,"data-active-tab":u?`true`:void 0,className:$t(WF,u?GF:KF,E&&I&&`border-destructive`),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!d&&l(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:E?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Vc,{className:`h-full min-w-0 flex-1 rounded-none border-0 bg-transparent dark:bg-transparent`,children:[(0,Z.jsx)(Nc,{ref:H,value:M,disabled:R,"aria-label":w({id:`Dw1T_W`,values:{label:g}}),"data-testid":`editor-tab-rename-input`,"aria-invalid":I?!0:void 0,"aria-describedby":I?D:void 0,"aria-busy":R||void 0,title:I??f,className:`h-full min-w-0 px-2 py-0 font-medium text-foreground text-xs selection:bg-primary selection:text-primary-foreground`,onChange:e=>{N(XF(e.target.value,p)),L(null),ee.current=null},onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),be()):e.key===`Escape`&&(e.preventDefault(),ye())},onBlur:be}),(0,Z.jsx)(Rc,{align:`inline-end`,"aria-hidden":`true`,className:`pr-2 text-xs`,children:(0,Z.jsx)(Mc,{className:`text-muted-foreground/60 text-xs`,children:p})})]}),I?(0,Z.jsx)(`span`,{id:D,role:`alert`,className:`sr-only`,children:I}):null]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(cI,{accessibleLabel:b,activateTab:a,baseName:m,docName:f,enterRenameMode:ve,extension:h,hideDocExtension:x,tabId:e}),(0,Z.jsx)(oI,{accessibleLabel:b,closeTab:l,forceCloseVisible:Fe,isActive:u,isPinned:d,shortcutHint:n,tabId:e,unpinTab:S})]})})},e)}),tt;e[60]!==Xe||e[61]!==Qe||e[62]!==$e||e[63]!==et?(tt=(0,Z.jsx)(Xe,{items:Qe,strategy:$e,children:et}),e[60]=Xe,e[61]=Qe,e[62]=$e,e[63]=et,e[64]=tt):tt=e[64];let nt;e[65]!==qe||e[66]!==Be||e[67]!==He||e[68]!==Le||e[69]!==Pe||e[70]!==!1||e[71]!==Je||e[72]!==Ye||e[73]!==tt||e[74]!==Ee?(nt=(0,Z.jsx)(qe,{sensors:Pe,autoScroll:!1,collisionDetection:Je,modifiers:Ee,onDragStart:Le,onDragEnd:He,onDragCancel:Be,accessibility:Ye,children:tt}),e[65]=qe,e[66]=Be,e[67]=He,e[68]=Le,e[69]=Pe,e[70]=!1,e[71]=Je,e[72]=Ye,e[73]=tt,e[74]=Ee,e[75]=nt):nt=e[75];let it;e[76]===w?it=e[77]:(it=w({id:`3YvS-c`}),e[76]=w,e[77]=it);let at;e[78]===Symbol.for(`react.memo_cache_sentinel`)?(at=(0,Z.jsx)(Kt,{"aria-hidden":`true`}),e[78]=at):at=e[78];let ot;e[79]!==h||e[80]!==it?(ot=(0,Z.jsx)(ln,{asChild:!0,children:(0,Z.jsx)(Y,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":it,"data-testid":`editor-new-tab-button`,className:`first:mb-3 mb-1.5`,onClick:h,children:at})}),e[79]=h,e[80]=it,e[81]=ot):ot=e[81];let st;e[82]===Symbol.for(`react.memo_cache_sentinel`)?(st=(0,Z.jsx)(un,{children:(0,Z.jsx)(J,{id:`3YvS-c`})}),e[82]=st):st=e[82];let ct;e[83]===ot?ct=e[84]:(ct=(0,Z.jsxs)(fn,{children:[ot,st]}),e[83]=ot,e[84]=ct);let lt;e[85]!==Ke||e[86]!==nt||e[87]!==ct?(lt=(0,Z.jsxs)(`div`,{className:Ke,children:[nt,ct]}),e[85]=Ke,e[86]=nt,e[87]=ct,e[88]=lt):lt=e[88];let ut;return e[89]!==Ue||e[90]!==We||e[91]!==Ge||e[92]!==lt?(ut=(0,Z.jsx)(`div`,{ref:E,"data-electron-drag":Ue,className:We,onWheel:Ge,children:lt}),e[89]=Ue,e[90]=We,e[91]=Ge,e[92]=lt,e[93]=ut):ut=e[93],ut}var uI=`https://openknowledge.ai/api/subscribe`;async function dI(e,t){try{let n=await fetch(uI,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({email:e,source:t}),signal:AbortSignal.timeout(15e3)});return n.ok?{ok:!0}:n.status===400?{ok:!1,reason:`invalid`}:n.status===503?{ok:!1,reason:`unavailable`}:(console.warn(`[subscribe] action=submit result=http-error status=${n.status}`),{ok:!1,reason:`error`})}catch(e){return console.warn(`[subscribe] action=submit result=network-error message=${e instanceof Error?e.message:String(e)}`),{ok:!1,reason:`error`}}}function fI(e){let t=(0,$.c)(49),{source:n,title:r,description:i,onSuccess:a,onDismiss:o,autoFocus:s,compactSubmit:c,className:l}=e,{_:u}=vt(),[d,f]=(0,Q.useState)(!1),p=(0,Q.useRef)(null),m,h;t[0]===d?(m=t[1],h=t[2]):(m=()=>{d&&p.current?.focus()},h=[d],t[0]=d,t[1]=m,t[2]=h),(0,Q.useEffect)(m,h);let g,_;if(t[3]!==u){let e=ha({email:Aa({message:u({id:`Wq6Wcm`})})});_=Ef,g=Of(e),t[3]=u,t[4]=g,t[5]=_}else g=t[4],_=t[5];let v;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(v={email:``},t[6]=v):v=t[6];let y;t[7]===g?y=t[8]:(y={resolver:g,defaultValues:v},t[7]=g,t[8]=y);let b=_(y),{isSubmitting:x}=b.formState,S=b.formState.errors.email?.message??b.formState.errors.root?.message,C;t[9]!==u||t[10]!==b||t[11]!==a||t[12]!==n?(C=async function(e){b.clearErrors(`root`);let t=await dI(e.email,n);if(t.ok){f(!0),a?.();return}if(t.reason===`invalid`){b.setError(`email`,{message:u({id:`Wq6Wcm`})});return}if(t.reason===`unavailable`){b.setError(`root`,{message:u({id:`4mLBx9`})});return}b.setError(`root`,{message:u({id:`fWsBTs`})})},t[9]=u,t[10]=b,t[11]=a,t[12]=n,t[13]=C):C=t[13];let w=C,T;t[14]===l?T=t[15]:(T=$t(`flex flex-col gap-3`,l),t[14]=l,t[15]=T);let E=d?-1:void 0,D;t[16]!==d||t[17]!==r?(D=d?(0,Z.jsxs)(`span`,{className:`mb-1.5 inline-flex flex-row items-center gap-2`,children:[(0,Z.jsx)(Ds,{className:`size-4 text-primary`}),(0,Z.jsx)(J,{id:`PIMM5l`})]}):r??(0,Z.jsx)(J,{id:`GzPQ2f`}),t[16]=d,t[17]=r,t[18]=D):D=t[18];let O;t[19]!==D||t[20]!==E?(O=(0,Z.jsx)(`p`,{ref:p,tabIndex:E,className:`text-sm font-medium leading-tight text-foreground focus:outline-none`,children:D}),t[19]=D,t[20]=E,t[21]=O):O=t[21];let k;t[22]!==i||t[23]!==d?(k=d?(0,Z.jsx)(J,{id:`pBROkv`}):i??(0,Z.jsx)(J,{id:`WmPbvm`}),t[22]=i,t[23]=d,t[24]=k):k=t[24];let A;t[25]===k?A=t[26]:(A=(0,Z.jsx)(`p`,{className:`text-1sm text-muted-foreground`,role:`status`,children:k}),t[25]=k,t[26]=A);let j;t[27]!==O||t[28]!==A?(j=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[O,A]}),t[27]=O,t[28]=A,t[29]=j):j=t[29];let M;t[30]!==u||t[31]!==o?(M=o?(0,Z.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon`,onClick:o,"aria-label":u({id:`yz7wBu`}),className:`-mr-1.5 -mt-1 size-7 shrink-0 text-muted-foreground opacity-60`,children:(0,Z.jsx)(fl,{className:`size-4`})}):null,t[30]=u,t[31]=o,t[32]=M):M=t[32];let N;t[33]!==j||t[34]!==M?(N=(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[j,M]}),t[33]=j,t[34]=M,t[35]=N):N=t[35];let P;t[36]!==u||t[37]!==s||t[38]!==c||t[39]!==S||t[40]!==b||t[41]!==x||t[42]!==w||t[43]!==d?(P=d?null:(0,Z.jsxs)(`form`,{onSubmit:b.handleSubmit(w),className:`flex flex-col gap-2`,noValidate:!0,children:[(0,Z.jsx)(Df,{control:b.control,name:`email`,render:e=>{let{field:t,fieldState:n}=e;return(0,Z.jsxs)(Vc,{className:`h-10 rounded-xl`,children:[(0,Z.jsx)(Rc,{className:`pl-2.5`,children:(0,Z.jsx)(dh,{className:`size-4 text-muted-foreground opacity-60`})}),(0,Z.jsx)(Nc,{...t,id:t.name,type:`email`,inputMode:`email`,autoComplete:`email`,spellCheck:!1,autoFocus:s,placeholder:u({id:`2hYmUH`}),"aria-invalid":n.invalid,"aria-label":u({id:`ATGYL1`}),"data-testid":`subscribe-email`,className:`placeholder:text-muted-foreground/60`}),(0,Z.jsx)(Y,{type:`submit`,disabled:x,size:c?`icon`:`default`,className:$t(`mr-1 ml-auto text-1sm`,c&&`size-8 shrink-0 rounded-lg`),"data-testid":`subscribe-submit`,children:x?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Zc,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`lCC_D5`})})]}):c?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ln,{className:`size-4`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`EDl9kS`})})]}):(0,Z.jsx)(J,{id:`EDl9kS`})})]})}}),S?(0,Z.jsx)(`p`,{className:`text-sm text-destructive`,role:`alert`,children:S}):null]}),t[36]=u,t[37]=s,t[38]=c,t[39]=S,t[40]=b,t[41]=x,t[42]=w,t[43]=d,t[44]=P):P=t[44];let F;return t[45]!==N||t[46]!==P||t[47]!==T?(F=(0,Z.jsxs)(`div`,{className:T,children:[N,P]}),t[45]=N,t[46]=P,t[47]=T,t[48]=F):F=t[48],F}var pI=`https://github.com/inkeep/open-knowledge`,mI=`https://discord.gg/VRKk2EaGHN`,hI=`https://x.com/OpenKnowledge`,gI=`ok-subscribe-card-v1`,_I={subscribed:!1,dismissed:!1,shownVersions:[]};function vI(e,t){return!e.subscribed&&!e.dismissed&&e.shownVersions.length<3&&!e.shownVersions.includes(t)}function yI(e){return e===!0}function bI(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function xI(e){if(typeof e!=`object`||!e)return _I;let t=e;return{subscribed:yI(t.subscribed),dismissed:yI(t.dismissed),shownVersions:bI(t.shownVersions)}}function SI(e){try{let t=(e??localStorage).getItem(gI);return t==null?_I:xI(JSON.parse(t))}catch(e){return console.warn(`[subscribe-card-store] readPersistedState failed (corrupt/privacy/SSR)`,e),_I}}function CI(e,t){try{(t??localStorage).setItem(gI,JSON.stringify(e))}catch(e){console.warn(`[subscribe-card-store] writePersistedState failed (quota/privacy/SSR)`,e)}}function wI(e){let t=SI(e),n=new Set,r=!1;function i(){for(let e of n)e()}function a(n){t=n,CI(t,e),i()}return{getSnapshot(){return t},subscribe(e){return n.add(e),()=>{n.delete(e)}},markSubscribed(){t.subscribed||a({...t,subscribed:!0})},dismiss(){t.dismissed||a({...t,dismissed:!0})},recordShown(e){t.shownVersions.includes(e)||a({...t,shownVersions:[...t.shownVersions,e]})},install(){r||(r=!0,t=SI(e),i())}}}var TI=wI();function EI(){TI.install()}var DI=(0,Q.lazy)(()=>n(()=>import(`./FeedbackForm-DH4DaXLD.js`).then(e=>({default:e.FeedbackForm})),__vite__mapDeps([142,1,6,2,3,7,8,9,143,122,12,10,11,13,14,15,16,17,18,19,20,21,22,39,40,41,25,28,88,26,90,123,107,33,34,74]),import.meta.url)),OI=e=>{let t=(0,$.c)(10),{open:n,onOpenChange:r,source:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(xn,{children:(0,Z.jsx)(_n,{children:(0,Z.jsx)(J,{id:`SItQRc`})})}),t[0]=a):a=t[0];let o;t[1]===r?o=t[2]:(o=()=>r(!1),t[1]=r,t[2]=o);let s;t[3]!==i||t[4]!==o?(s=(0,Z.jsxs)(vn,{children:[a,(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(DI,{source:i,onSuccess:o})})]}),t[3]=i,t[4]=o,t[5]=s):s=t[5];let c;return t[6]!==r||t[7]!==n||t[8]!==s?(c=(0,Z.jsx)(Sn,{open:n,onOpenChange:r,children:s}),t[6]=r,t[7]=n,t[8]=s,t[9]=c):c=t[9],c};function kI(e){let t=(0,$.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`Discord`}),r=(0,Z.jsx)(`path`,{d:`M20.317 4.3698a19.7913 19.7913 0 00-4.8851-1.5152.0741.0741 0 00-.0785.0371c-.211.3753-.4447.8648-.6083 1.2495-1.8447-.2762-3.68-.2762-5.4868 0-.1636-.3933-.4058-.8742-.6177-1.2495a.077.077 0 00-.0785-.037 19.7363 19.7363 0 00-4.8852 1.515.0699.0699 0 00-.0321.0277C.5334 9.0458-.319 13.5799.0992 18.0578a.0824.0824 0 00.0312.0561c2.0528 1.5076 4.0413 2.4228 5.9929 3.0294a.0777.0777 0 00.0842-.0276c.4616-.6304.8731-1.2952 1.226-1.9942a.076.076 0 00-.0416-.1057c-.6528-.2476-1.2743-.5495-1.8722-.8923a.077.077 0 01-.0076-.1277c.1258-.0943.2517-.1923.3718-.2914a.0743.0743 0 01.0776-.0105c3.9278 1.7933 8.18 1.7933 12.0614 0a.0739.0739 0 01.0785.0095c.1202.099.246.1981.3728.2924a.077.077 0 01-.0066.1276 12.2986 12.2986 0 01-1.873.8914.0766.0766 0 00-.0407.1067c.3604.698.7719 1.3628 1.225 1.9932a.076.076 0 00.0842.0286c1.961-.6067 3.9495-1.5219 6.0023-3.0294a.077.077 0 00.0313-.0552c.5004-5.177-.8382-9.6739-3.5485-13.6604a.061.061 0 00-.0312-.0286zM8.02 15.3312c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9555-2.4189 2.157-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9555 2.4189-2.1569 2.4189zm7.9748 0c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9554-2.4189 2.1569-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9554 2.4189-2.1568 2.4189Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,Z.jsxs)(`svg`,{role:`img`,fill:`currentColor`,height:24,width:24,viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[n,r]}),t[2]=e,t[3]=i),i}function AI(e){let t=(0,$.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`X (Twitter)`}),r=(0,Z.jsx)(`path`,{d:`M18.901 1.153h3.68l-8.04 9.19L24 22.846h-7.406l-5.8-7.584-6.638 7.584H.474l8.6-9.83L0 1.154h7.594l5.243 6.932ZM17.61 20.644h2.039L6.486 3.24H4.298Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,Z.jsxs)(`svg`,{role:`img`,fill:`currentColor`,height:24,width:24,viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[n,r]}),t[2]=e,t[3]=i),i}var jI=[{key:`resources`,heading:{id:`s-MGs7`},links:[{label:{id:`TbjyhA`},href:`https://openknowledge.ai/docs`,icon:ut}]},{key:`community`,heading:{id:`chL5IG`},links:[{label:`Discord`,href:mI,icon:kI},{label:`X (Twitter)`,href:hI,icon:AI},{label:`GitHub`,href:pI,icon:pg}]}],MI=`${pI}/releases`,NI=`group 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`;function PI(e){if(e<1e3)return String(e);let t=e/1e3;return`${t>=10?Math.round(t):t.toFixed(1)}k`}var FI=e=>{let t=(0,$.c)(12),{count:n}=e,{_:r}=vt(),i,a,o,s;t[0]!==r||t[1]!==n?(i=PI(n),a=`img`,o=`ml-auto flex items-center gap-1 text-xs tabular-nums text-muted-foreground`,s=r({id:`SVLPt5`,values:{formatted:i}}),t[0]=r,t[1]=n,t[2]=i,t[3]=a,t[4]=o,t[5]=s):(i=t[2],a=t[3],o=t[4],s=t[5]);let c;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(Mh,{className:`size-3 fill-current`,"aria-hidden":`true`}),t[6]=c):c=t[6];let l;return t[7]!==i||t[8]!==a||t[9]!==o||t[10]!==s?(l=(0,Z.jsxs)(`span`,{role:a,className:o,"aria-label":s,children:[c,i]}),t[7]=i,t[8]=a,t[9]=o,t[10]=s,t[11]=l):l=t[11],l},II=e=>{let t=(0,$.c)(15),{link:n,trailing:r}=e,{_:i}=vt(),{label:a,href:o,icon:s}=n,c,l;t[0]===o?(c=t[1],l=t[2]):(c=e=>Wu(e,o),l=e=>Wu(e,o),t[0]=o,t[1]=c,t[2]=l);let u;t[3]===s?u=t[4]:(u=(0,Z.jsx)(s,{"aria-hidden":`true`,className:`size-4 shrink-0`}),t[3]=s,t[4]=u);let d;t[5]!==i||t[6]!==a?(d=typeof a==`string`?a:i(a),t[5]=i,t[6]=a,t[7]=d):d=t[7];let f;return t[8]!==o||t[9]!==c||t[10]!==l||t[11]!==u||t[12]!==d||t[13]!==r?(f=(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`a`,{href:o,target:`_blank`,rel:`noopener noreferrer`,onClick:c,onAuxClick:l,className:NI,children:[u,d,r]})}),t[8]=o,t[9]=c,t[10]=l,t[11]=u,t[12]=d,t[13]=r,t[14]=f):f=t[14],f},LI=e=>{let t=(0,$.c)(7),{icon:n,onSelect:r,children:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=$t(NI,`h-auto w-full justify-start font-normal`),t[0]=a):a=t[0];let o;t[1]===n?o=t[2]:(o=(0,Z.jsx)(n,{"aria-hidden":`true`,className:`size-4 shrink-0`}),t[1]=n,t[2]=o);let s;return t[3]!==i||t[4]!==r||t[5]!==o?(s=(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(Y,{variant:`ghost`,className:a,onClick:r,children:[o,i]})}),t[3]=i,t[4]=r,t[5]=o,t[6]=s):s=t[6],s},RI=e=>{let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(`p`,{className:`font-mono tracking-wide uppercase text-muted-foreground text-xs mb-1`,children:n}),t[0]=n,t[1]=r),r},zI=()=>{let e=(0,$.c)(36),{_:t}=vt(),[n,r]=(0,Q.useState)(!1),[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(null),f=typeof window<`u`&&window.okDesktop!=null,p,m;e[0]!==n||e[1]!==u?(p=()=>{if(!n||u!==null)return;let e=new AbortController;return Za({signal:e.signal}).then(e=>{e!==null&&d(e)}),()=>e.abort()},m=[n,u],e[0]=n,e[1]=u,e[2]=p,e[3]=m):(p=e[2],m=e[3]),(0,Q.useEffect)(p,m);let h;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(h=e=>{r(e),e||a(!1)},e[4]=h):h=e[4];let g;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(st,{className:`size-4`}),e[5]=g):g=e[5];let _;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(ln,{asChild:!0,children:(0,Z.jsx)(Wt,{asChild:!0,children:(0,Z.jsxs)(Y,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,children:[g,(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`s-MGs7`})})]})})}),e[6]=_):_=e[6];let v;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsxs)(fn,{children:[_,(0,Z.jsx)(un,{children:(0,Z.jsx)(J,{id:`s-MGs7`})})]}),e[7]=v):v=e[7];let y;e[8]!==t||e[9]!==u?(y=jI.map((e,n)=>(0,Z.jsxs)(`div`,{className:$t(n>0&&`mt-3`),children:[(0,Z.jsx)(RI,{children:t(e.heading)}),(0,Z.jsx)(`nav`,{"aria-label":t(e.heading),children:(0,Z.jsxs)(`ul`,{className:`space-y-0.5`,children:[e.links.map(e=>(0,Z.jsx)(II,{link:e,trailing:e.href===`https://github.com/inkeep/open-knowledge`&&u!==null?(0,Z.jsx)(FI,{count:u}):void 0},e.href)),e.key===`resources`&&(0,Z.jsxs)(Z.Fragment,{children:[f&&(0,Z.jsx)(LI,{icon:le,onSelect:()=>{r(!1),s(!0)},children:(0,Z.jsx)(J,{id:`cd5EXh`})}),(0,Z.jsx)(LI,{icon:ph,onSelect:()=>{r(!1),l(!0)},children:(0,Z.jsx)(J,{id:`1uyUjj`})})]})]})})]},e.key)),e[8]=t,e[9]=u,e[10]=y):y=e[10];let b;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(RI,{children:(0,Z.jsx)(J,{id:`arUUsK`})}),e[11]=b):b=e[11];let x;e[12]===t?x=e[13]:(x=t({id:`arUUsK`}),e[12]=t,e[13]=x);let S;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(II,{link:{label:{id:`3ePd3I`},href:MI,icon:fh}}),e[14]=S):S=e[14];let C;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(Wt,{asChild:!0,children:(0,Z.jsxs)(Y,{variant:`ghost`,className:$t(NI,`h-auto w-full justify-start font-normal`),children:[(0,Z.jsx)(dh,{"aria-hidden":`true`,className:`size-4 shrink-0`}),(0,Z.jsx)(J,{id:`EDl9kS`})]})}),e[15]=C):C=e[15];let w;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(Yt,{side:`left`,align:`center`,sideOffset:20,className:`w-80`,children:(0,Z.jsx)(fI,{source:`resources_menu`,autoFocus:!0,onDismiss:()=>a(!1),onSuccess:BI})}),e[16]=w):w=e[16];let T;e[17]===i?T=e[18]:(T=(0,Z.jsxs)(`ul`,{className:`space-y-0.5`,children:[S,(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(Ut,{open:i,onOpenChange:a,children:[C,w]})})]}),e[17]=i,e[18]=T);let E;e[19]!==T||e[20]!==x?(E=(0,Z.jsxs)(`div`,{className:`mt-3`,children:[b,(0,Z.jsx)(`nav`,{"aria-label":x,children:T})]}),e[19]=T,e[20]=x,e[21]=E):E=e[21];let D;e[22]!==E||e[23]!==y?(D=(0,Z.jsxs)(Yt,{align:`end`,className:`w-56 p-3`,children:[y,E]}),e[22]=E,e[23]=y,e[24]=D):D=e[24];let O;e[25]!==n||e[26]!==D?(O=(0,Z.jsxs)(Ut,{open:n,onOpenChange:h,children:[v,D]}),e[25]=n,e[26]=D,e[27]=O):O=e[27];let k;e[28]===o?k=e[29]:(k=f&&(0,Z.jsx)(Cp,{open:o,onOpenChange:s}),e[28]=o,e[29]=k);let A;e[30]===c?A=e[31]:(A=(0,Z.jsx)(OI,{open:c,onOpenChange:l}),e[30]=c,e[31]=A);let j;return e[32]!==O||e[33]!==k||e[34]!==A?(j=(0,Z.jsxs)(Z.Fragment,{children:[O,k,A]}),e[32]=O,e[33]=k,e[34]=A,e[35]=j):j=e[35],j};function BI(){return TI.markSubscribed()}function VI(e){let t=(0,$.c)(14),{className:n}=e,{_:r}=vt(),i=typeof window<`u`?window.okDesktop?.instanceLabel??null:null;if(!i)return null;let a;t[0]===r?a=t[1]:(a=r({id:`iRdfLr`,values:{label:i}}),t[0]=r,t[1]=a);let o,s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(Xo,{"aria-hidden":`true`}),s=(0,Z.jsx)(`span`,{className:`max-w-40 truncate`,children:i}),t[2]=o,t[3]=s):(o=t[2],s=t[3]);let c;t[4]!==n||t[5]!==a?(c=(0,Z.jsx)(ln,{asChild:!0,children:(0,Z.jsxs)(fu,{variant:`secondary`,"aria-label":a,"data-testid":`instance-badge`,className:n,children:[o,s]})}),t[4]=n,t[5]=a,t[6]=c):c=t[6];let l;t[7]===r?l=t[8]:(l=r({id:`c5PTFE`,values:{label:i}}),t[7]=r,t[8]=l);let u;t[9]===l?u=t[10]:(u=(0,Z.jsx)(un,{children:l}),t[9]=l,t[10]=u);let d;return t[11]!==c||t[12]!==u?(d=(0,Z.jsxs)(fn,{children:[c,u]}),t[11]=c,t[12]=u,t[13]=d):d=t[13],d}var HI=50,UI=()=>{let e=(0,$.c)(8),t=(0,Q.useRef)(null),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=()=>{t.current===null&&(t.current=setTimeout(()=>{t.current=null,Pw.preload()},HI))},e[0]=n):n=e[0];let r=n,i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{t.current!==null&&(clearTimeout(t.current),t.current=null)},e[1]=i):i=e[1];let a=i,o,s;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>()=>{t.current!==null&&clearTimeout(t.current)},s=[],e[2]=o,e[3]=s):(o=e[2],s=e[3]),(0,Q.useEffect)(o,s);let c,l;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>{a(),window.location.hash!==`#settings`&&(window.location.hash=Gi)},l=(0,Z.jsx)(Th,{className:`size-4`}),e[4]=c,e[5]=l):(c=e[4],l=e[5]);let u;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(ln,{asChild:!0,children:(0,Z.jsxs)(Y,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,"data-testid":`header-settings-button`,onMouseEnter:r,onMouseLeave:a,onFocus:r,onBlur:a,onClick:c,children:[l,(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`Tz0i8g`})})]})}),e[6]=u):u=e[6];let d;return e[7]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsxs)(fn,{children:[u,(0,Z.jsx)(un,{children:(0,Z.jsx)(J,{id:`Tz0i8g`})})]}),e[7]=d):d=e[7],d},WI=`https://openknowledge.ai/docs/features/share`;function GI(e){let t=(0,$.c)(50),{input:n,onClickWhenNoRemote:r}=e,{_:i}=vt(),{status:a}=ss(),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(null),u=(0,Q.useRef)(null),d;t[0]===c?.autoCopyFailed?d=t[1]:(d=()=>{!c?.autoCopyFailed||!u.current||(u.current.focus(),u.current.select())},t[0]=c?.autoCopyFailed,t[1]=d);let f;t[2]===c?f=t[3]:(f=[c],t[2]=c,t[3]=f),(0,Q.useEffect)(d,f);let p=a?.hasRemote===!0,m=n===null,h=rs(c?.freshness,a),g;t[4]!==i||t[5]!==o||t[6]!==p||t[7]!==n||t[8]!==r?(g=async function(){if(!o&&n!==null){s(!0),l(null);try{let e=await Jr({...n,hasRemote:p,onClickWhenNoRemote:r},{clipboardWrite:Md,toastSuccess:$I,toastError:QI,logEvent:ZI});e.kind===`copied`?l({url:e.shareUrl,autoCopyFailed:!1,freshness:e.freshness}):e.kind===`clipboard-failed`&&l({url:e.shareUrl,autoCopyFailed:!0,freshness:e.freshness})}catch{X.error(i({id:`u3YnKw`}))}s(!1)}},t[4]=i,t[5]=o,t[6]=p,t[7]=n,t[8]=r,t[9]=g):g=t[9];let _=g,v=c!==null,y;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(y=e=>{e||l(null)},t[10]=y):y=t[10];let b;t[11]!==i||t[12]!==n?.kind?(b=n?.kind===`folder`?i({id:`WR0y2O`}):i({id:`F4IYWe`}),t[11]=i,t[12]=n?.kind,t[13]=b):b=t[13];let x=o||m,S,C;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(Eh,{className:`size-3.5`,"aria-hidden":!0}),C=(0,Z.jsx)(J,{id:`Z8lGw6`}),t[14]=S,t[15]=C):(S=t[14],C=t[15]);let w;t[16]!==_||t[17]!==b||t[18]!==x?(w=(0,Z.jsx)(qt,{asChild:!0,children:(0,Z.jsxs)(Y,{variant:`ghost`,size:`sm`,"aria-label":b,onClick:_,disabled:x,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`share-button`,children:[S,C]})}),t[16]=_,t[17]=b,t[18]=x,t[19]=w):w=t[19];let T=h?`w-96`:`w-80`,E;t[20]===T?E=t[21]:(E=$t(`flex flex-col gap-2`,T),t[20]=T,t[21]=E);let D;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsx)(`p`,{className:`font-mono tracking-wide uppercase text-muted-foreground text-xs`,children:(0,Z.jsx)(J,{id:`Z8lGw6`})}),t[22]=D):D=t[22];let O;t[23]===c?.autoCopyFailed?O=t[24]:(O=c?.autoCopyFailed?(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(J,{id:`ndeI89`})}):null,t[23]=c?.autoCopyFailed,t[24]=O);let k=c?.url??``,A;t[25]===i?A=t[26]:(A=i({id:`5-FeN2`}),t[25]=i,t[26]=A);let j;t[27]!==k||t[28]!==A?(j=(0,Z.jsx)(vl,{ref:u,readOnly:!0,value:k,onFocus:XI,onClick:YI,onContextMenu:JI,className:`select-all bg-muted font-mono text-xs text-muted-foreground`,"data-testid":`share-button-url`,"aria-label":A}),t[27]=k,t[28]=A,t[29]=j):j=t[29];let M=c?.url??``,N=c?.autoCopyFailed===!1,P;t[30]!==M||t[31]!==N?(P=(0,Z.jsx)(`div`,{className:`absolute inset-y-0 right-1 flex items-center`,children:(0,Z.jsx)(`div`,{className:`rounded-md bg-background/50 backdrop-blur-sm`,children:(0,Z.jsx)(js,{copyContent:M,clipboardWrite:Md,initialCopied:N})})}),t[30]=M,t[31]=N,t[32]=P):P=t[32];let F;t[33]!==j||t[34]!==P?(F=(0,Z.jsxs)(`div`,{className:`relative`,children:[j,P]}),t[33]=j,t[34]=P,t[35]=F):F=t[35];let I=c?.freshness,L=n?.kind??`doc`,R;t[36]!==a||t[37]!==I||t[38]!==L?(R=(0,Z.jsx)(ts,{freshness:I,status:a,kind:L}),t[36]=a,t[37]=I,t[38]=L,t[39]=R):R=t[39];let z;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Z.jsxs)(`a`,{href:WI,target:`_blank`,rel:`noopener noreferrer`,onClick:qI,onAuxClick:KI,className:`mt-2 flex items-center gap-1.5 self-start text-xs text-muted-foreground transition-colors hover:text-primary`,children:[(0,Z.jsx)(st,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(J,{id:`aByJ8j`})]}),t[40]=z):z=t[40];let B;t[41]!==E||t[42]!==O||t[43]!==F||t[44]!==R?(B=(0,Z.jsxs)(Yt,{align:`end`,className:E,"data-testid":`share-button-popover`,children:[D,O,F,R,z]}),t[41]=E,t[42]=O,t[43]=F,t[44]=R,t[45]=B):B=t[45];let V;return t[46]!==w||t[47]!==B||t[48]!==v?(V=(0,Z.jsxs)(Ut,{open:v,onOpenChange:y,children:[w,B]}),t[46]=w,t[47]=B,t[48]=v,t[49]=V):V=t[49],V}function KI(e){return Wu(e,WI)}function qI(e){return Wu(e,WI)}function JI(e){return e.currentTarget.select()}function YI(e){return e.currentTarget.select()}function XI(e){return e.currentTarget.select()}function ZI(e){return console.log(e)}function QI(e){e!==`Link ready but could not copy to clipboard.`&&X.error(e)}function $I(e){return X.success(e)}var eL=(0,Q.lazy)(()=>n(()=>import(`./AppMenubar-DqlpmcU7.js`).then(e=>({default:e.AppMenubar})),__vite__mapDeps([144,1,10,11,12,16,17,18,19,40,106,14,15,24,41,21,84,22]),import.meta.url));function tL(e){let t=(0,$.c)(38),{onSignIn:n,onSetIdentity:r,onOpenSearch:i}=e,{_:a}=vt(),{activeDocName:o,activeTarget:s}=Re(),c=o?Oa(o):null,{state:l,isDraggingRail:u}=mN(),d=iv(),f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f=xl(`toggle-files-sidebar`),t[0]=f):f=t[0];let p=f,m=xl(`command-palette`),[h,g]=(0,Q.useState)(!1),_;bb0:{if(s?.kind===`folder`){let e;t[1]===s.folderPath?e=t[2]:(e=Yr(s.folderPath),t[1]=s.folderPath,t[2]=e),_=e;break bb0}if(o&&!c){let e;t[3]===o?e=t[4]:(e=ci(o),t[3]=o,t[4]=e),_=e;break bb0}if(!s&&!o){let e;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=Yr(``),t[5]=e):e=t[5],_=e;break bb0}_=null}let v=_,y=typeof window<`u`&&window.okDesktop!=null,b=l===`collapsed`,x=y?``:void 0,S=y&&b&&`pl-[var(--ok-titlebar-reserve-left,1rem)]`,C=y&&!u&&`motion-safe:transition-[padding] motion-safe:duration-200 motion-safe:ease-linear`,w;t[6]!==S||t[7]!==C?(w=$t(`flex h-12 shrink-0 items-center bg-muted/35 shadow-[inset_0_-1px_0_var(--border)]`,y&&`[-webkit-app-region:drag]`,S,C),t[6]=S,t[7]=C,t[8]=w):w=t[8];let T;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(T=PP()&&(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(eL,{})}),t[9]=T):T=t[9];let E=!d&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(fn,{children:[(0,Z.jsx)(ln,{asChild:!0,children:(0,Z.jsx)(yN,{className:$t(`-ml-1 shrink-0 text-muted-foreground`,y&&`[-webkit-app-region:no-drag]`)})}),(0,Z.jsx)(un,{children:l===`expanded`?(0,Z.jsx)(J,{id:`ZxXhLY`,values:{sidebarShortcut:p}}):(0,Z.jsx)(J,{id:`Zz25kq`,values:{sidebarShortcut:p}})})]}),b&&i&&(0,Z.jsxs)(fn,{children:[(0,Z.jsx)(ln,{asChild:!0,children:(0,Z.jsx)(Y,{variant:`ghost`,size:`icon-sm`,onClick:i,"aria-label":a({id:`IN4UX8`,values:{searchShortcut:m}}),"data-telemetry-event":`ok.editor_header.search.click`,className:$t(`shrink-0 text-muted-foreground`,y&&`[-webkit-app-region:no-drag]`),children:(0,Z.jsx)(he,{"aria-hidden":`true`})})}),(0,Z.jsx)(un,{children:(0,Z.jsx)(J,{id:`IN4UX8`,values:{searchShortcut:m}})})]}),(0,Z.jsx)(mi,{orientation:`vertical`,className:`mr-1 h-4 shrink-0 data-vertical:self-center`}),(0,Z.jsx)(lI,{})]}),D;t[10]!==T||t[11]!==E?(D=(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1 px-3`,children:[T,E]}),t[10]=T,t[11]=E,t[12]=D):D=t[12];let O;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(O=$t(`flex shrink-0 items-center justify-end gap-2 px-3`,y&&`[&>*]:[-webkit-app-region:no-drag]`,y&&`mr-[var(--ok-titlebar-reserve-right,0px)]`),t[13]=O):O=t[13];let k;t[14]!==h||t[15]!==g||t[16]!==v||t[17]!==d?(k=!d&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(GI,{input:v,onClickWhenNoRemote:()=>g(!0)}),(0,Z.jsx)(qr,{open:h,onOpenChange:g})]}),t[14]=h,t[15]=g,t[16]=v,t[17]=d,t[18]=k):k=t[18];let A;t[19]!==r||t[20]!==n?(A=(0,Z.jsx)(Ai,{onSignIn:n,onSetIdentity:r}),t[19]=r,t[20]=n,t[21]=A):A=t[21];let j,M,N,P;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Z.jsx)(pF,{}),M=(0,Z.jsx)(mi,{orientation:`vertical`,className:`h-4 shrink-0 data-vertical:self-center`}),N=(0,Z.jsx)(VI,{}),P=(0,Z.jsx)(gF,{}),t[22]=j,t[23]=M,t[24]=N,t[25]=P):(j=t[22],M=t[23],N=t[24],P=t[25]);let F;t[26]===d?F=t[27]:(F=!d&&(0,Z.jsx)(UI,{}),t[26]=d,t[27]=F);let I;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(zI,{}),t[28]=I):I=t[28];let L;t[29]!==k||t[30]!==A||t[31]!==F?(L=(0,Z.jsxs)(`div`,{className:O,children:[k,A,j,M,N,P,F,I]}),t[29]=k,t[30]=A,t[31]=F,t[32]=L):L=t[32];let R;return t[33]!==D||t[34]!==L||t[35]!==x||t[36]!==w?(R=(0,Z.jsxs)(`header`,{"data-electron-drag":x,className:w,children:[D,L]}),t[33]=D,t[34]=L,t[35]=x,t[36]=w,t[37]=R):R=t[37],R}var nL=(0,Q.lazy)(()=>n(()=>import(`./AgentThreadClientBinder-poPjsQXP.js`).then(e=>({default:e.AgentThreadClientBinder})),__vite__mapDeps([145,1,22,12,146,38,90,19,92,6,2,3,7,8,9]),import.meta.url)),rL=(0,Q.lazy)(()=>n(()=>import(`./TerminalSessionsHost-BjojawIi.js`).then(e=>({default:e.TerminalSessionsHost})),__vite__mapDeps([147,1,2,104,19,12,6,3,7,8,9,38,10,11,16,17,18,40,105,106,14,15,24,41,21,84,22,81,28,42,25,112,96,83,148,114,58,97,32,115,33,34,30,89,78,26,90,124,73,74,75,76,125,146]),import.meta.url));function iL(e){let t=(0,$.c)(96),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{onOpenSearch:r}=n,[i,a]=$v(),[o,s]=(0,Q.useState)(i),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(`auth`),[f,p]=(0,Q.useState)(tb[0].id),[m,h]=(0,Q.useState)(!1),g=typeof window<`u`?window.okDesktop??null:null,_=g!=null&&g.terminal!=null&&g.config.ptyAvailable===!0,[v,y]=(0,Q.useState)(!1),b=md(),[x,S]=(0,Q.useState)(!1),[C,w]=(0,Q.useState)(!1),T=(0,Q.useRef)(!1),[E,D]=(0,Q.useState)(null),[O,k]=(0,Q.useState)(null),A=(0,Q.useRef)(0),[j,M]=(0,Q.useState)(cy),N;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(N=function(e){M(e),sy(e),y(!0)},t[2]=N):N=t[2];let P=N,F;t[3]===j?F=t[4]:(F=function(){P(j===`right`?`bottom`:`right`)},t[3]=j,t[4]=F);let I=F,L;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(L={container:null,isShowing:!1,dockPosition:`bottom`,editorRegion:null},t[5]=L):L=t[5];let[R,z]=(0,Q.useState)(L),B=(0,Q.useRef)(0),V;t[6]===b?V=t[7]:(V=function(e,t){let n=e??ny(qc(),b);y(!0),B.current+=1,D({prompt:null,cli:n,nonce:B.current,stagePaste:t})},t[6]=b,t[7]=V);let H=V,U;t[8]!==x||t[9]!==H?(U=function(){y(!0),_&&!x&&!Jc()&&H()},t[8]=x,t[9]=H,t[10]=U):U=t[10];let W=U,ee=os(),{projectConfig:G,projectLocalConfig:K,projectLocalSynced:te,projectSynced:ne}=Hu(),{activeDocName:re}=Re(),ie=ee?.hasRemote,ae=ee?.pushPermission?.checkStatus,oe;t[11]!==m||t[12]!==G||t[13]!==K||t[14]!==te||t[15]!==ne||t[16]!==ie||t[17]!==ae?(oe=dy({autoSyncOnboardingDismissed:m,hasRemote:ie,projectLocalSynced:te,projectSynced:ne,projectLocalConfig:K,projectConfig:G,pushPermissionCheckStatus:ae}),t[11]=m,t[12]=G,t[13]=K,t[14]=te,t[15]=ne,t[16]=ie,t[17]=ae,t[18]=oe):oe=t[18];let se=oe,ce,le;t[19]===re?(ce=t[20],le=t[21]):(ce=()=>{let e=function(e){let t=e.detail;t&&re&&ad(re,{kind:`raw-mdx`,detail:t}),s(`source`)};return window.addEventListener(Gv,e),()=>window.removeEventListener(Gv,e)},le=[re],t[19]=re,t[20]=ce,t[21]=le),(0,Q.useEffect)(ce,le);let ue=(0,Q.useRef)(!1),de;t[22]!==re||t[23]!==o||t[24]!==H?(de=function(e){if(!_||re==null)return!1;let t=ed(re,o)?.markdown??``;if(t.trim()===``)return!1;let n=`${VO(re,t)}\n\n`;return!e&&ue.current?(y(!0),Xt(n)):H(void 0,n),!0},t[22]=re,t[23]=o,t[24]=H,t[25]=de):de=t[25];let fe=(0,Q.useEffectEvent)(de),pe;t[26]===H?pe=t[27]:(pe=()=>H(),t[26]=H,t[27]=pe);let q=(0,Q.useEffectEvent)(pe),me;t[28]===fe?me=t[29]:(me=()=>Gt(e=>{if(e===`toggle-terminal`){if(fe(!1))return;y(sL)}else e===`new-terminal`&&y(!0)}),t[28]=fe,t[29]=me);let he;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(he=[],t[30]=he):he=t[30],(0,Q.useEffect)(me,he);let ge;t[31]===fe?ge=t[32]:(ge=()=>{if(window.okDesktop!=null)return;let e=function(e){if(Sl(e,`toggle-terminal-panel`)){if(e.preventDefault(),fe(!1))return;y(oL)}};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},t[31]=fe,t[32]=ge);let _e;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(_e=[],t[33]=_e):_e=t[33],(0,Q.useEffect)(ge,_e);let ve;t[34]!==q||t[35]!==fe?(ve=()=>{if(!_)return;let e=function(e){Sl(e,`new-terminal-tab`)&&(e.preventDefault(),fe(!0)||q())};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},t[34]=q,t[35]=fe,t[36]=ve):ve=t[36];let ye;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(ye=[_],t[37]=ye):ye=t[37],(0,Q.useEffect)(ve,ye);let be,xe;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(be=()=>zc((e,t)=>{y(!0),B.current+=1,D({prompt:e,cli:t,nonce:B.current})}),xe=[],t[38]=be,t[39]=xe):(be=t[38],xe=t[39]),(0,Q.useEffect)(be,xe);let Se,Ce;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(Se=()=>tc(e=>{y(!0),A.current+=1,k({agentSource:e.agentSource,agentId:e.agentId,prompt:e.prompt,docName:e.docName,titleHint:e.titleHint,nonce:A.current})}),Ce=[],t[40]=Se,t[41]=Ce):(Se=t[40],Ce=t[41]),(0,Q.useEffect)(Se,Ce);let we,Te;t[42]===v?(we=t[43],Te=t[44]):(we=()=>{v||D(null)},Te=[v],t[42]=v,t[43]=we,t[44]=Te),(0,Q.useEffect)(we,Te);let Ee,De;t[45]!==C||t[46]!==v?(Ee=()=>{window.okDesktop!=null&&C&&(Ic({terminalVisible:v}),window.okDesktop.editor.notifyViewMenuStateChanged({terminalVisible:v}))},De=[v,C],t[45]=C,t[46]=v,t[47]=Ee,t[48]=De):(Ee=t[47],De=t[48]),(0,Q.useEffect)(Ee,De);let Oe,ke;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=()=>{let e=window.okDesktop;if(e==null)return;if(typeof e.terminal?.getDockState!=`function`){w(!0);return}let t=!1;return e.terminal.getDockState().then(e=>{t||!e.visible||(T.current=!0,y(!0))}).catch(aL).finally(()=>{t||w(!0)}),()=>{t=!0}},ke=[],t[49]=Oe,t[50]=ke):(Oe=t[49],ke=t[50]),(0,Q.useEffect)(Oe,ke);let Ae,je;t[51]===v?(Ae=t[52],je=t[53]):(Ae=()=>{if(window.okDesktop!=null){if(T.current){T.current=!1;return}v&&ra()}},je=[v],t[51]=v,t[52]=Ae,t[53]=je),(0,Q.useEffect)(Ae,je),ey(ee?.pausedReason),ty();let Me;t[54]===a?Me=t[55]:(Me=function(e){s(e),a(e)},t[54]=a,t[55]=Me);let Ne=Me,Pe;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(nL,{})}),t[56]=Pe):Pe=t[56];let Fe,Ie;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(Fe=()=>{d(`auth`),l(!0)},Ie=()=>{d(`identity`),l(!0)},t[57]=Fe,t[58]=Ie):(Fe=t[57],Ie=t[58]);let Le;t[59]===r?Le=t[60]:(Le=(0,Z.jsx)(tL,{onSignIn:Fe,onSetIdentity:Ie,onOpenSearch:r}),t[59]=r,t[60]=Le);let ze;t[61]!==f||t[62]!==o||t[63]!==Ne||t[64]!==x||t[65]!==W||t[66]!==j||t[67]!==v?(ze=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 overflow-hidden`,children:(0,Z.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:(0,Z.jsx)(EP,{editorMode:o,onModeChange:Ne,activeTab:f,onActiveTabChange:p,terminalBridge:_?g:null,terminalVisible:v,onTerminalVisibleChange:y,terminalDock:j,terminalHasSessions:x,onTerminalPlacement:z,onRevealTerminal:W})})}),t[61]=f,t[62]=o,t[63]=Ne,t[64]=x,t[65]=W,t[66]=j,t[67]=v,t[68]=ze):ze=t[68];let Be;t[69]===R.editorRegion?Be=t[70]:(Be=()=>R.editorRegion?.focus(),t[69]=R.editorRegion,t[70]=Be);let Ve;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(Ve=e=>{ue.current=e},t[71]=Ve):Ve=t[71];let He;t[72]!==b||t[73]!==Be||t[74]!==j||t[75]!==E||t[76]!==R.container||t[77]!==R.isShowing||t[78]!==v||t[79]!==O||t[80]!==I?(He=(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(rL,{bridge:_?g:null,visible:v,onVisibleChange:y,launch:E,threadLaunch:O,installedClis:b,container:R.container,isShowing:R.isShowing,onRequestEditorFocus:Be,dockPosition:j,onToggleDock:I,onHasSessionsChange:S,onActiveSessionCliChange:Ve})}),t[72]=b,t[73]=Be,t[74]=j,t[75]=E,t[76]=R.container,t[77]=R.isShowing,t[78]=v,t[79]=O,t[80]=I,t[81]=He):He=t[81];let Ue=u===`identity`,We;t[82]===Symbol.for(`react.memo_cache_sentinel`)?(We=()=>{l(!1)},t[82]=We):We=t[82];let Ge;t[83]!==c||t[84]!==Ue?(Ge=(0,Z.jsx)(ji,{open:c,onOpenChange:l,identityPrompt:Ue,onSuccess:We}),t[83]=c,t[84]=Ue,t[85]=Ge):Ge=t[85];let Ke;t[86]===Symbol.for(`react.memo_cache_sentinel`)?(Ke=()=>h(!0),t[86]=Ke):Ke=t[86];let qe;t[87]===se?qe=t[88]:(qe=(0,Z.jsx)(ly,{open:se,onResolved:Ke}),t[87]=se,t[88]=qe);let Je;t[89]===Symbol.for(`react.memo_cache_sentinel`)?(Je=(0,Z.jsx)(Hv,{}),t[89]=Je):Je=t[89];let Ye;return t[90]!==Le||t[91]!==ze||t[92]!==He||t[93]!==Ge||t[94]!==qe?(Ye=(0,Z.jsxs)(Z.Fragment,{children:[Pe,Le,ze,He,Ge,qe,Je]}),t[90]=Le,t[91]=ze,t[92]=He,t[93]=Ge,t[94]=qe,t[95]=Ye):Ye=t[95],Ye}function aL(e){console.error(`[terminal] dock-state restore failed; staying hidden:`,e)}function oL(e){return!e}function sL(e){return!e}function cL(e){let t=lu(eu(e));typeof window>`u`||window.location.hash!==t&&(window.location.hash=t)}function lL(){let e=(0,$.c)(11),{conflicts:t,loading:n,error:r}=yi();if(n)return null;if(r===`server`){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`section`,{"data-testid":`conflicts-section`,"aria-label":`Conflicted files`,className:`border-b border-amber-200/60 bg-amber-50/40 px-2 py-2 dark:border-amber-900/40 dark:bg-amber-950/20`,children:(0,Z.jsxs)(`p`,{"data-testid":`conflicts-section-error`,className:`px-2 py-1.5 text-[12px] text-amber-700 dark:text-amber-400`,children:[(0,Z.jsx)(sl,{"aria-hidden":`true`,className:`mr-1.5 inline size-3`}),`Couldn't load conflicts — reload to retry.`]})}),e[0]=t):t=e[0],t}if(t.length===0)return null;let i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 font-mono text-[11px] uppercase tracking-wider text-amber-700 dark:text-amber-400`,children:[(0,Z.jsx)(sl,{"aria-hidden":`true`,className:`size-3`}),`Conflicts`]}),e[1]=i):i=e[1];let a;e[2]===t.length?a=e[3]:(a=(0,Z.jsxs)(`header`,{className:`flex items-center justify-between px-2 pb-1.5`,children:[i,(0,Z.jsx)(`span`,{"data-testid":`conflicts-section-count`,className:`rounded-full bg-amber-500 px-1.5 py-0.5 font-mono text-[10px] font-medium leading-none text-white`,children:t.length})]}),e[2]=t.length,e[3]=a);let o;e[4]===t?o=e[5]:(o=t.map(uL),e[4]=t,e[5]=o);let s;e[6]===o?s=e[7]:(s=(0,Z.jsx)(`ul`,{className:`flex flex-col gap-px`,children:o}),e[6]=o,e[7]=s);let c;return e[8]!==a||e[9]!==s?(c=(0,Z.jsxs)(`section`,{"data-testid":`conflicts-section`,"aria-label":`Conflicted files`,className:`border-b border-amber-200/60 bg-amber-50/40 px-2 py-2 dark:border-amber-900/40 dark:bg-amber-950/20`,children:[a,s]}),e[8]=a,e[9]=s,e[10]=c):c=e[10],c}function uL(e){return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(Y,{variant:`ghost`,size:`sm`,"data-testid":`conflicts-section-row`,"data-file":e.file,title:e.file,className:`h-7 w-full justify-start gap-1.5 px-2 font-normal text-[13px] text-amber-800 hover:bg-amber-100/60 hover:text-amber-900 dark:text-amber-300 dark:hover:bg-amber-900/30 dark:hover:text-amber-200`,onClick:()=>cL(e.file),children:[(0,Z.jsx)(sl,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:e.file})]})},e.file)}var dL=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
21
+ `,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;wu(t,{style:t=>Ru(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 Yj.set(t.changes,i),i}function Qj(e,t){let{state:n}=e,r=t??n.selection.main.head,i=e.state.field(ij).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(Jj);i.fromB!=i.toB&&i.toA<=o.length&&(a+=e.state.lineBreak);let s=zu.of({from:i.fromA,to:Math.min(o.length,i.toA),insert:a},o.length);return e.dispatch({effects:qj.of({doc:s.apply(o),changes:s}),userEvent:`accept`}),!0}function $j(e,t){let{state:n}=e,r=t??n.selection.main.head,i=n.field(ij).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=n.field(Jj).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 eM(e){let t=new ku;for(let n of e.field(ij)){let r=e.facet(tj).overrideChunk&&rM(e,n);t.add(n.fromB,n.fromB,Zj(e,n,!!r))}return t.finish()}var tM=Tu.define({create:e=>eM(e),update(e,t){return t.state.field(ij,!1)==t.startState.field(ij,!1)?e:eM(t.state)},provide:e=>Mu.decorations.from(e)}),nM=new WeakMap;function rM(e,t){let n=nM.get(t);if(n!==void 0)return n;n=null;let r=e.field(Jj),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(Eu.widget({widget:new iM(t),side:-1}).range(s+n.fromB))}n.fromB<n.toB&&e.push(bj.range(s+n.fromB,s+n.toB))}i<t.endA-t.fromA-a*2&&(n=e)}return nM.set(t,n),n}var iM=class extends xu{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}},aM=new class extends Nu{constructor(){super(...arguments),this.elementClass=`cm-inlineChangedLineGutter`}},oM=Eu.line({class:`cm-inlineChangedLine`});function sM(e,t,n,r){let i=rM(e,t),a=0;if(!i)return!1;for(let o=e.doc.lineAt(t.fromB);;){for(r&&r.add(o.from,o.from,aM),n.add(o.from,o.from,oM);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 cM=Nn({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),lM=er({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),uM=Mu.theme({".cm-deletedChunk .cm-chunkButtons":{display:`flex`,gap:`0.25rem`},".cm-deletedChunk .cm-chunkButtons button[data-slot='button']":{margin:`0`,border:`1px solid transparent`,borderRadius:`min(var(--radius-md), 10px)`,color:`var(--primary-foreground)`},".cm-deletedChunk .cm-chunkButtons button[data-slot='button'][data-variant='destructive']":{color:`var(--destructive)`}});function dM({addControl:e,nextId:t,removeControl:n,root:r}){return(i,a)=>{let o=document.createElement(`span`);o.className=`inline-flex`;let s=t();return e({id:s,host:o,type:i,action:a}),queueMicrotask(()=>{r.contains(o)||n(s)}),o}}function fM(e){let t=(0,$.c)(33),{oldContent:n,newContent:r,layout:i,conflictMode:a,previewMode:o,oursOverride:s,onResolve:c,onAbort:l}=e,{_:u}=vt(),d=s??r,f=(0,Q.useRef)(null),p=(0,Q.useRef)(null),m=(0,Q.useRef)(0),{resolvedTheme:h}=zt(),g=(0,Q.useRef)(c),_=(0,Q.useRef)(l),[v,y]=(0,Q.useState)(null),b;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(b=[],t[0]=b):b=t[0];let[x,S]=(0,Q.useState)(b),C=bA(a===!0),w;t[1]!==l||t[2]!==c?(w=()=>{g.current=c,_.current=l},t[1]=l,t[2]=c,t[3]=w):w=t[3],(0,Q.useEffect)(w);let T,E;t[4]!==a||t[5]!==d||t[6]!==i||t[7]!==n||t[8]!==o||t[9]!==h?(T=()=>{let e=f.current;if(!e)return;S([]);let t=new Map,r=!1,s=e=>{r||!t.delete(e)||S(t=>t.filter(t=>t.id!==e))},c=new MutationObserver(()=>{for(let[n,r]of t)e.contains(r)||s(n)});c.observe(e,{childList:!0,subtree:!0});let l=h===`dark`?cM:lM,u=[Mu.editable.of(!1),Au.readOnly.of(!0)],g=[jd,Vu(),...u,l,Mu.lineWrapping];if(p.current&&=(p.current.destroy(),null),o)p.current=new Mu({doc:d,extensions:g,parent:e}),y(null);else if(a){let i=dM({addControl:e=>{r||(t.set(e.id,e.host),S(t=>[...t,e]))},nextId:()=>(m.current+=1,m.current),removeControl:s,root:e}),a=new Mu({doc:d,extensions:[jd,Vu(),Mu.editable.of(!1),l,uM,Mu.lineWrapping,Kj({original:n,highlightChanges:!0,gutter:!0,mergeControls:i,collapseUnchanged:{margin:3,minSize:4}}),Mu.updateListener.of(e=>{let t=aj(e.state);y(t?t.chunks.length:0)})],parent:e});p.current=a;let o=aj(a.state);y(o?o.chunks.length:0)}else i===`split`?p.current=new Hj({a:{doc:n,extensions:g},b:{doc:d,extensions:g},parent:e,highlightChanges:!0,gutter:!0,collapseUnchanged:{margin:3,minSize:4}}):p.current=new Mu({doc:d,extensions:[...g,Kj({original:n,highlightChanges:!0,gutter:!0,mergeControls:!1,collapseUnchanged:{margin:3,minSize:4}})],parent:e});return()=>{r=!0,c.disconnect(),p.current&&=(p.current.destroy(),null)}},E=[n,d,i,h,a,o],t[4]=a,t[5]=d,t[6]=i,t[7]=n,t[8]=o,t[9]=h,t[10]=T,t[11]=E):(T=t[10],E=t[11]),(0,Q.useEffect)(T,E);let D;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(D=function(){let e=p.current;!e||!(e instanceof Mu)||g.current?.(e.state.doc.toString())},t[12]=D):D=t[12];let O=D,k;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(k=function(){let e=p.current;!e||!(e instanceof Mu)||Dn(e)},t[13]=k):k=t[13];let A=k,j=v===0,M;t[14]!==u||t[15]!==v?(M=v===null?``:v===0?u({id:`lPzyrU`}):yl._({id:`8FqTCr`,values:{chunksRemaining:v}}),t[14]=u,t[15]=v,t[16]=M):M=t[16];let N=M,P;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(`div`,{ref:f,className:`diff-view min-h-0 flex-1 overflow-y-auto subtle-scrollbar`}),t[17]=P):P=t[17];let F;if(t[18]!==u||t[19]!==x){let e;t[21]===u?e=t[22]:(e=e=>(0,Sw.createPortal)((0,Z.jsx)(Y,{type:`button`,variant:e.type===`accept`?`default`:`destructive`,size:`xs`,onClick:t=>{e.action(t.nativeEvent)},children:e.type===`accept`?u({id:`g3UF2V`}):u({id:`1t_NnN`})}),e.host,e.id),t[21]=u,t[22]=e),F=x.map(e),t[18]=u,t[19]=x,t[20]=F}else F=t[20];let I;t[23]!==j||t[24]!==C||t[25]!==a||t[26]!==N||t[27]!==l||t[28]!==c?(I=a&&(0,Z.jsxs)(`div`,{ref:C,className:`flex items-center justify-between gap-2 px-3 py-2 border-t shrink-0`,children:[(0,Z.jsx)(`span`,{className:`text-xs ${j?`text-emerald-600 dark:text-emerald-400`:`text-muted-foreground`}`,children:N}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[l&&(0,Z.jsx)(Y,{className:`uppercase font-mono`,variant:`ghost`,size:`sm`,onClick:l,children:(0,Z.jsx)(J,{id:`XyOUTJ`})}),(0,Z.jsx)(Y,{className:`uppercase font-mono`,variant:`outline`,size:`sm`,onClick:A,children:`Undo`}),c&&(0,Z.jsx)(Y,{variant:`default`,size:`sm`,disabled:!j,onClick:O,children:(0,Z.jsx)(J,{id:`Lcehxn`})})]})]}),t[23]=j,t[24]=C,t[25]=a,t[26]=N,t[27]=l,t[28]=c,t[29]=I):I=t[29];let L;return t[30]!==I||t[31]!==F?(L=(0,Z.jsxs)(`div`,{className:`flex flex-col h-full`,children:[P,F,I]}),t[30]=I,t[31]=F,t[32]=L):L=t[32],L}async function pM(e,t,n){try{let r={file:e,strategy:t};n!==void 0&&(r.content=n);let i=await fetch(`/api/sync/resolve-conflict`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(r)});if(i.ok)return{ok:!0};let a;try{let e=await i.json();typeof e.detail==`string`?a=e.detail:typeof e.title==`string`&&(a=e.title)}catch{}return{ok:!1,detail:a}}catch(n){let r=n instanceof Error?n.message:String(n);return console.warn(JSON.stringify({event:`conflict-resolve-dispatch-failed`,file:e,strategy:t,detail:r})),{ok:!1,detail:r}}}async function mM(e,t){return pM(e,`content`,t)}async function hM(e){return pM(e,`mine`)}async function gM(e){return pM(e,`theirs`)}async function _M(e){return pM(e,`delete`)}async function vM(e){try{let t=await fetch(`/api/sync/conflict-content?file=${encodeURIComponent(e)}&source=ytext`);if(!t.ok){let n;try{let e=await t.json();typeof e.detail==`string`?n=e.detail:typeof e.title==`string`&&(n=e.title)}catch{}return console.warn(JSON.stringify({event:`conflict-content-fetch-failed`,file:e,status:t.status,detail:n})),null}let n=await t.json(),r=n.kind===`delete-modify`||n.kind===`modify-delete`||n.kind===`both-modified`?n.kind:`both-modified`;return n.kind!==r&&console.warn(JSON.stringify({event:`conflict-kind-missing-fallback`,file:e,receivedKind:n.kind??null})),{base:n.base??``,ours:n.ours??``,theirs:n.theirs??``,kind:r}}catch(t){return console.warn(JSON.stringify({event:`conflict-content-fetch-failed`,file:e,status:null,detail:t instanceof Error?t.message:String(t)})),null}}function yM(e){let t=(0,$.c)(86),{docName:n}=e,{_:r}=vt(),{conflicts:i,loading:a}=yi(),o;if(t[0]!==i||t[1]!==n){let e;t[3]===n?e=t[4]:(e=e=>eu(e.file)===n,t[3]=n,t[4]=e),o=i.find(e),t[0]=i,t[1]=n,t[2]=o}else o=t[2];let s=o,c=s?.file??`${n}.md`,[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(!1),h=bA(l?.kind===`delete-modify`||l?.kind===`modify-delete`),g,_;t[5]===n?(g=t[6],_=t[7]):(g=()=>(console.warn(JSON.stringify({event:`editor-area-swap-to-diffview`,"doc.name":n})),()=>{console.warn(JSON.stringify({event:`editor-area-swap-from-diffview`,"doc.name":n}))}),_=[n],t[5]=n,t[6]=g,t[7]=_),(0,Q.useEffect)(g,_);let v=a||s===void 0,y,b;t[8]!==v||t[9]!==c?(y=()=>{if(v)return;let e=!1;return u(null),f(!1),vM(c).then(t=>{e||(t===null?f(!0):u(t))}),()=>{e=!0}},b=[c,v],t[8]=v,t[9]=c,t[10]=y,t[11]=b):(y=t[10],b=t[11]),(0,Q.useEffect)(y,b);let x;t[12]!==r||t[13]!==c?(x=async function(e){let t=await mM(c,e);t.ok||X.error(r({id:`K-h9cT`,values:{filePath:c}}),{description:t.detail})},t[12]=r,t[13]=c,t[14]=x):x=t[14];let S=x,C;t[15]!==r||t[16]!==c?(C=async function(e){m(!0);let t=await e(c);t.ok||(m(!1),X.error(r({id:`jPUPvG`,values:{filePath:c}}),{description:t.detail}))},t[15]=r,t[16]=c,t[17]=C):C=t[17];let w=C;if(d){let e;return t[18]===c?e=t[19]:(e=(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`ajz9F8`,values:{filePath:c}})}),t[18]=c,t[19]=e),e}if(l===null){let e;return t[20]===c?e=t[21]:(e=(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`DF1MtZ`,values:{filePath:c}})}),t[20]=c,t[21]=e),e}if(l.kind===`delete-modify`){let e;t[22]===l.theirs?e=t[23]:(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(fM,{oldContent:``,newContent:l.theirs,layout:`unified`,previewMode:!0})}),t[22]=l.theirs,t[23]=e);let n;t[24]===c?n=t[25]:(n={filePath:c},t[24]=c,t[25]=n);let r;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(r={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[26]=r):r=t[26];let i;t[27]===n?i=t[28]:(i=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`V48OUT`,values:n,components:r})}),t[27]=n,t[28]=i);let a;t[29]===w?a=t[30]:(a=()=>void w(_M),t[29]=w,t[30]=a);let o;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(J,{id:`Vlc75q`}),t[31]=o):o=t[31];let s;t[32]!==p||t[33]!==a?(s=(0,Z.jsx)(Y,{type:`button`,variant:`destructive`,disabled:p,onClick:a,children:o}),t[32]=p,t[33]=a,t[34]=s):s=t[34];let u;t[35]===w?u=t[36]:(u=()=>void w(gM),t[35]=w,t[36]=u);let d;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(J,{id:`3mFsc3`}),t[37]=d):d=t[37];let f;t[38]!==p||t[39]!==u?(f=(0,Z.jsx)(Y,{type:`button`,variant:`default`,disabled:p,onClick:u,children:d}),t[38]=p,t[39]=u,t[40]=f):f=t[40];let m;t[41]!==s||t[42]!==f?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-3`,children:[s,f]}),t[41]=s,t[42]=f,t[43]=m):m=t[43];let g;t[44]!==h||t[45]!==i||t[46]!==m?(g=(0,Z.jsxs)(`div`,{ref:h,className:`flex flex-shrink-0 flex-wrap items-center justify-between gap-x-6 gap-y-3 border-t px-6 py-4`,children:[i,m]}),t[44]=h,t[45]=i,t[46]=m,t[47]=g):g=t[47];let _;return t[48]!==g||t[49]!==e?(_=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[e,g]}),t[48]=g,t[49]=e,t[50]=_):_=t[50],_}if(l.kind===`modify-delete`){let e;t[51]===l.ours?e=t[52]:(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(fM,{oldContent:``,newContent:l.ours,layout:`unified`,previewMode:!0})}),t[51]=l.ours,t[52]=e);let n;t[53]===c?n=t[54]:(n={filePath:c},t[53]=c,t[54]=n);let r;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(r={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[55]=r):r=t[55];let i;t[56]===n?i=t[57]:(i=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`EhDLBx`,values:n,components:r})}),t[56]=n,t[57]=i);let a;t[58]===w?a=t[59]:(a=()=>void w(hM),t[58]=w,t[59]=a);let o;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(J,{id:`0NA4b3`}),t[60]=o):o=t[60];let s;t[61]!==p||t[62]!==a?(s=(0,Z.jsx)(Y,{type:`button`,variant:`default`,disabled:p,onClick:a,children:o}),t[61]=p,t[62]=a,t[63]=s):s=t[63];let u;t[64]===w?u=t[65]:(u=()=>void w(_M),t[64]=w,t[65]=u);let d;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(J,{id:`qSxaOz`}),t[66]=d):d=t[66];let f;t[67]!==p||t[68]!==u?(f=(0,Z.jsx)(Y,{type:`button`,variant:`destructive`,disabled:p,onClick:u,children:d}),t[67]=p,t[68]=u,t[69]=f):f=t[69];let m;t[70]!==s||t[71]!==f?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-3`,children:[s,f]}),t[70]=s,t[71]=f,t[72]=m):m=t[72];let g;t[73]!==h||t[74]!==i||t[75]!==m?(g=(0,Z.jsxs)(`div`,{ref:h,className:`flex flex-shrink-0 flex-wrap items-center justify-between gap-x-6 gap-y-3 border-t px-6 py-4`,children:[i,m]}),t[73]=h,t[74]=i,t[75]=m,t[76]=g):g=t[76];let _;return t[77]!==g||t[78]!==e?(_=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[e,g]}),t[77]=g,t[78]=e,t[79]=_):_=t[79],_}let T;t[80]===S?T=t[81]:(T=e=>void S(e),t[80]=S,t[81]=T);let E;return t[82]!==l.ours||t[83]!==l.theirs||t[84]!==T?(E=(0,Z.jsx)(fM,{oldContent:l.theirs,newContent:l.ours,layout:`unified`,conflictMode:!0,onResolve:T}),t[82]=l.ours,t[83]=l.theirs,t[84]=T,t[85]=E):E=t[85],E}function bM(e){let t=(0,$.c)(2),{docName:n,provider:r,children:i}=e;(0,Q.use)(it(n,r));let a;return t[0]===i?a=t[1]:(a=(0,Z.jsx)(Z.Fragment,{children:i}),t[0]=i,t[1]=a),a}var xM=`__back-nav__`;function SM(e){return e instanceof de||e instanceof Ve||e instanceof oe||e instanceof Te||e instanceof Qe||e instanceof we?e.docName:null}function CM(e){return e instanceof de||e instanceof Ve}function wM(e){if(e instanceof de){let t=e.docName;return{title:yl._({id:`Jejur6`}),summary:yl._({id:`jSY41h`,values:{docName:t}})}}if(e instanceof Ve){let t=e.docName;return{title:yl._({id:`V7QxyT`}),summary:yl._({id:`xG4tb6`,values:{docName:t}})}}if(e instanceof oe){let t=e.docName;return{title:yl._({id:`1di5fu`}),summary:yl._({id:`PQCdtv`,values:{docName:t}})}}if(e instanceof Te){let t=e.docName;return{title:yl._({id:`wvbc1r`}),summary:yl._({id:`IX7-sq`,values:{docName:t}})}}if(e instanceof Qe)return{title:yl._({id:`Gfr4fu`}),summary:yl._({id:`UW2Fg3`})};if(e instanceof we){let t=e.docName;return{title:yl._({id:`vv7kpg`}),summary:yl._({id:`mdKFEy`,values:{docName:t}})}}let t=e instanceof Error&&e.message?e.message:yl._({id:`W5A0Ly`});return{title:yl._({id:`29VNqC`}),summary:t}}function TM(e){let t=(0,$.c)(37),{error:n,resetErrorBoundary:r,activeDocName:i,previousDocName:a,onNavigateBack:o}=e,s;t[0]===n?s=t[1]:(s=wM(n),t[0]=n,t[1]=s);let{title:c,summary:l}=s,u=!!a&&!!o,d=(0,Q.useRef)(null),[f,p]=(0,Q.useState)(!1),m=typeof window<`u`?window.okDesktop:void 0,h=m&&CM(n)?m:null,g,_;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>{d.current?.focus()},_=[],t[2]=g,t[3]=_):(g=t[2],_=t[3]),(0,Q.useEffect)(g,_);let v;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(mp,{size:80,variant:`sleeping`}),t[4]=v):v=t[4];let y;t[5]===c?y=t[6]:(y=(0,Z.jsx)(`h2`,{id:`document-error-title`,className:`text-2xl font-light tracking-tighter text-balance`,children:c}),t[5]=c,t[6]=y);let b;t[7]===l?b=t[8]:(b=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-muted-foreground`,children:l}),t[7]=l,t[8]=b);let x;t[9]!==y||t[10]!==b?(x=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[y,b]}),t[9]=y,t[10]=b,t[11]=x):x=t[11];let S;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(J,{id:`KDw4GX`}),t[12]=S):S=t[12];let C;t[13]===r?C=t[14]:(C=(0,Z.jsx)(Y,{ref:d,variant:`default`,onClick:r,children:S}),t[13]=r,t[14]=C);let w;t[15]===h?w=t[16]:(w=h?(0,Z.jsx)(Y,{variant:`secondary`,onClick:()=>{Ev(h).then(DM).catch(EM)},children:(0,Z.jsx)(J,{id:`uaUc6t`})}):null,t[15]=h,t[16]=w);let T;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(T=m?(0,Z.jsx)(Y,{variant:`ghost`,className:`font-mono uppercase`,onClick:()=>p(!0),children:(0,Z.jsx)(J,{id:`ii5mVn`})}):null,t[17]=T):T=t[17];let E;t[18]!==i||t[19]!==u||t[20]!==n||t[21]!==o||t[22]!==a||t[23]!==r?(E=u?(0,Z.jsx)(Y,{variant:`ghost`,className:`font-mono uppercase`,onClick:()=>{!a||!o||(Me(SM(n)??i),o(a),r(xM))},children:(0,Z.jsx)(J,{id:`CKyk7Q`})}):null,t[18]=i,t[19]=u,t[20]=n,t[21]=o,t[22]=a,t[23]=r,t[24]=E):E=t[24];let D;t[25]!==w||t[26]!==E||t[27]!==C?(D=(0,Z.jsxs)(`div`,{className:`mt-1 flex gap-2`,children:[C,w,T,E]}),t[25]=w,t[26]=E,t[27]=C,t[28]=D):D=t[28];let O;t[29]!==i||t[30]!==n||t[31]!==f?(O=m?(0,Z.jsx)(Cp,{open:f,onOpenChange:p,crashContext:{source:`document view`,docName:SM(n)??i,errorMessage:n instanceof Error&&n.message?n.message:String(n)}}):null,t[29]=i,t[30]=n,t[31]=f,t[32]=O):O=t[32];let k;return t[33]!==D||t[34]!==O||t[35]!==x?(k=(0,Z.jsxs)(`div`,{role:`alert`,"aria-labelledby":`document-error-title`,"data-slot":`document-error-boundary`,className:`flex h-full flex-col items-center justify-center gap-8 p-8 text-center`,children:[v,x,D,O]}),t[33]=D,t[34]=O,t[35]=x,t[36]=k):k=t[36],k}function EM(){}function DM(e){e.ok||X.error(e.message,{id:`server-restart-error`,duration:1/0})}function OM(e){let t=(0,$.c)(17),{activeDocName:n,previousDocName:r,onNavigateBack:i,onRecycle:a,children:o}=e,s;t[0]!==n||t[1]!==i||t[2]!==r?(s=e=>(0,Z.jsx)(TM,{...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]===xM){console.warn(`[DocumentErrorBoundary] back-nav reset (no recycle)`);return}a(n),console.warn(`[DocumentErrorBoundary] retry recycled ${n}`)}else console.warn(`[DocumentErrorBoundary] reset by key change (${e.prev?.[0]} → ${e.next?.[0]})`)},t[6]=n,t[7]=a,t[8]=l):l=t[8];let u;t[9]===n?u=t[10]:(u=e=>{console.error(`[DocumentErrorBoundary] rendered fallback for ${n}: ${wM(e).title}`,e)},t[9]=n,t[10]=u);let d;return t[11]!==o||t[12]!==s||t[13]!==c||t[14]!==l||t[15]!==u?(d=(0,Z.jsx)(Zt,{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 kM(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=ua(t);return{map:n,keys:Yo(t),parseError:r}}function AM(e){let t=(0,$.c)(21),{provider:n}=e,r;t[0]===n?r=t[1]:(r=()=>kM(n),t[0]=n,t[1]=r);let[i,a]=(0,Q.useState)(r),o,s;t[2]===n?(o=t[3],s=t[4]):(o=()=>{let e=io(n);a(e.current());let t=e.subscribe(e=>{a(e)});return()=>{t(),e.dispose()}},s=[n],t[2]=n,t[3]=o,t[4]=s),(0,Q.useEffect)(o,s);let c;t[5]===i.map.icon?c=t[6]:(c=Ce(i.map.icon),t[5]=i.map.icon,t[6]=c);let l=c,u;t[7]===i.map.cover?u=t[8]:(u=Fe(i.map.cover),t[7]=i.map.cover,t[8]=u);let d=u,f=d.kind===`url`||d.kind===`path`,p=l.kind!==`unsupported`;if(!f&&!p)return null;let m=f?`true`:`false`,h=p?`true`:`false`,g;t[9]!==d||t[10]!==f?(g=f?(0,Z.jsx)(jM,{cover:d}):null,t[9]=d,t[10]=f,t[11]=g):g=t[11];let _;t[12]!==f||t[13]!==p||t[14]!==l?(_=p?(0,Z.jsx)(MM,{icon:l,hasCover:f}):null,t[12]=f,t[13]=p,t[14]=l,t[15]=_):_=t[15];let v;return t[16]!==m||t[17]!==h||t[18]!==g||t[19]!==_?(v=(0,Z.jsxs)(`div`,{className:`page-header editor-content-aligned`,"data-has-cover":m,"data-has-icon":h,"aria-hidden":`true`,"data-testid":`page-header`,children:[g,_]}),t[16]=m,t[17]=h,t[18]=g,t[19]=_,t[20]=v):v=t[20],v}function jM(e){let t=(0,$.c)(2),{cover:n}=e,r;return t[0]===n.value?r=t[1]:(r=(0,Z.jsx)(`div`,{className:`page-header-cover`,"data-testid":`page-header-cover`,children:(0,Z.jsx)(`img`,{src:n.value,alt:``,draggable:!1,loading:`lazy`,referrerPolicy:`no-referrer`,className:`page-header-cover-img`})}),t[0]=n.value,t[1]=r),r}function MM(e){let t=(0,$.c)(9),{icon:n,hasCover:r}=e,i=r?`page-header-icon page-header-icon--with-cover`:`page-header-icon`;if(n.kind===`emoji`){let e;return t[0]!==n.value||t[1]!==i?(e=(0,Z.jsx)(`span`,{className:i,"data-testid":`page-header-icon`,"data-kind":`emoji`,children:n.value}),t[0]=n.value,t[1]=i,t[2]=e):e=t[2],e}let a;t[3]===n.value?a=t[4]:(a=(0,Z.jsx)(`img`,{src:n.value,alt:``,draggable:!1,referrerPolicy:`no-referrer`,className:`page-header-icon-img`}),t[3]=n.value,t[4]=a);let o;return t[5]!==n.kind||t[6]!==i||t[7]!==a?(o=(0,Z.jsx)(`span`,{className:i,"data-testid":`page-header-icon`,"data-kind":n.kind,children:a}),t[5]=n.kind,t[6]=i,t[7]=a,t[8]=o):o=t[8],o}var NM=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{ManagedArtifactProperties:e}=await import(`./ManagedArtifactProperties-DroX_qbT.js`);return{ManagedArtifactProperties:e}},__vite__mapDeps([126,1,6,2,3,7,8,9,10,11,12,79,62,63,64,65,66,67,68,69,70,71,72,15,73,58,22,74,75,76,38,17,18,25,77,78,31,19,52,53,35,55,14,16,4,80,40,23,24,26,81,28,20,82,21,83,84,27,29,51,54,56,57,85,86,87,30,88,89,90,91,32,33,92,93,127,104,13,105,106,41,128,119,129,34,116]),import.meta.url)).ManagedArtifactProperties})),PM=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{MermaidDocEditor:e}=await import(`./MermaidDocEditor-BgRVEFx4.js`);return{MermaidDocEditor:e}},__vite__mapDeps([130,1,62,2,63,64,9,65,66,67,68,69,70,71,72,15,6,3,7,8,73,58,12,22,11,74,75,76,38,10,17,18,25,77,78,31,19,52,53,35,55,131,132]),import.meta.url)).MermaidDocEditor})),FM=$l(`LARGE_DOC_CHAR_THRESHOLD`,5e5);function IM(e){let t=e.threshold??FM;return e.ytextLength>t?{renderSource:e.isSourceMode||e.visitedSource,renderVisual:!e.isSourceMode||e.visitedVisual,isLarge:!0}:{renderSource:!0,renderVisual:!0,isLarge:!1}}function LM(e){return e.hasEmittedFirstToggle||!e.isLarge?!1:e.renderSource&&e.renderVisual}var RM=$l(`ACTIVITY_MOUNT_LIMIT`,3);function zM(){return n(()=>import(`./SourceEditor-DYIbaxIY.js`),__vite__mapDeps([133,1,62,2,63,64,9,65,66,67,68,69,70,71,72,15,6,3,7,8,73,58,12,22,11,74,75,76,38,10,17,18,25,77,78,31,19,52,53,35,55,131,79,14,16,4,80,40,23,24,26,81,28,20,82,21,83,84,27,29,51,54,56,57,85,86,87,30,88,89,90,91,32,33,92,93,132,134,39,41,42,113,135,60,120,121,129,115]),import.meta.url)}var BM=(0,Q.lazy)(async()=>({default:(await zM()).SourceEditor}));function VM(e,t,n){if(n<=0)return[];let r=e.filter(e=>!_e(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 HM(e,t){return t.kind===`idle`?null:t.kind===`failed`&&t.failedDocNames.includes(e)?{kind:`failed`,title:yl._({id:`MTs6g3`}),summary:t.reason===`clear-data-timeout`?yl._({id:`Sc1bKE`,values:{docName:e}}):yl._({id:`ovIGrT`,values:{docName:e}}),actionLabel:yl._({id:`HpK_8d`})}:t.kind===`recovering`&&t.docNames.includes(e)?{kind:`recovering`,title:yl._({id:`cF9DyA`}),summary:t.phase===`clearing-local-cache`?yl._({id:`bmC18N`,values:{docName:e}}):yl._({id:`pAgkuZ`,values:{docName:e}})}:null}function UM(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(Ql,{name:`activity-pool`,children:(0,Z.jsx)(WM,{...e})}),t[0]=e,t[1]=n),n}function WM(e){let t=(0,$.c)(15),{activeDocName:n,isSourceMode:r,editorPlaceholder:i,previousDocName:a,onNavigateBack:o,onRecycle:s}=e,{poolEntries:c,serverRestartRecovery:l}=Re(),{pages:u,loading:d}=Ns(),f=VM(c,n,RM),p=(0,Q.useRef)(``),m=f.map(GM).join(`,`),h=(0,Q.useRef)(c),g,_;t[0]===c?(g=t[1],_=t[2]):(g=()=>{h.current=c},_=[c],t[0]=c,t[1]=g,t[2]=_),(0,Q.useLayoutEffect)(g,_),(0,Q.useLayoutEffect)(()=>{if(p.current===m)return;let e=p.current?p.current.split(`,`):[],t=m?m.split(`,`):[],r=e.filter(e=>!t.includes(e)),i=t.filter(t=>!e.includes(t));for(let e of r)ue(e);for(let e of i){let t=h.current.find(t=>t.docName===e)?.poolEventId;R(e,t&&t.length>0?t:crypto.randomUUID())}Zl(`ok/activity/mount-list-change`,{active:n,mounted:t,evicted:r}),p.current=m,Le(t)},[m,n]);let v;t[3]!==n||t[4]!==i||t[5]!==r||t[6]!==d||t[7]!==o||t[8]!==s||t[9]!==u||t[10]!==a||t[11]!==l?(v=e=>(0,Z.jsx)(tN,{entry:e,isActive:e.docName===n,isSourceMode:r,editorPlaceholder:i,isNewDoc:!d&&!u.has(e.docName)&&!ho(e.docName)&&!Go(e.docName),previousDocName:a,onNavigateBack:o,onRecycle:s,serverRestartRecovery:l},e.docName),t[3]=n,t[4]=i,t[5]=r,t[6]=d,t[7]=o,t[8]=s,t[9]=u,t[10]=a,t[11]=l,t[12]=v):v=t[12];let y=f.map(v),b;return t[13]===y?b=t[14]:(b=(0,Z.jsx)(Z.Fragment,{children:y}),t[13]=y,t[14]=b),b}function GM(e){return e.docName}function KM(e,t){if(!t)return null;let n=e.getBoundingClientRect().top;return t.getBoundingClientRect().top-n+e.scrollTop}var qM=256,JM=new Map;function YM(e,t){if(JM.delete(e),JM.set(e,t),JM.size>qM){let e=JM.keys().next().value;e!==void 0&&JM.delete(e)}}function XM(e){let t=(0,$.c)(15),{isActive:n,docName:r,initialScrollTop:i,bodyAnchorRef:a,children:o}=e,s=(0,Q.useRef)(null),c=(0,Q.useRef)(i??0),l=(0,Q.useRef)(null),u=(0,Q.useRef)(n),d=(0,Q.useRef)(!1),f,p;t[0]===n?(f=t[1],p=t[2]):(f=()=>{u.current=n},p=[n],t[0]=n,t[1]=f,t[2]=p),(0,Q.useEffect)(f,p);let m,h;t[3]!==a||t[4]!==r?(m=()=>{let e=s.current;if(!e)return;let t=()=>{if(!(!u.current||d.current)&&e.scrollTop>0){c.current=e.scrollTop;let t=KM(e,a?.current);l.current=t,t!==null&&YM(r,e.scrollTop-t)}};return e.addEventListener(`scroll`,t,{passive:!0}),()=>e.removeEventListener(`scroll`,t)},h=[a,r],t[3]=a,t[4]=r,t[5]=m,t[6]=h):(m=t[5],h=t[6]),(0,Q.useEffect)(m,h);let g,_;t[7]!==a||t[8]!==r||t[9]!==n?(g=()=>{if(!n)return;let e=s.current;if(!e)return;let t=c.current,i=JM.get(r),o=l.current===null?null:t-l.current,u=i??o;if(t===0&&u===null)return;let f=()=>{if(u===null)return t;let n=KM(e,a?.current);return n===null?t:n+u};d.current=!0;let p=performance.now(),m=!1,h=f();e.scrollTop=h,e.scrollTop===h&&e.scrollHeight>h&&Zl(`ok/scroll-restore/phase1-success`,{target:h,elapsedMs:performance.now()-p});let g=!1,_=0,v=()=>{g||(g=!0,d.current=!1,cancelAnimationFrame(_),clearTimeout(x),e.removeEventListener(`wheel`,y),e.removeEventListener(`touchstart`,y))},y=()=>v();e.addEventListener(`wheel`,y,{passive:!0}),e.addEventListener(`touchstart`,y,{passive:!0});let b=()=>{g||(h=f(),e.scrollTop!==h&&e.scrollHeight>h&&(e.scrollTop=h,e.scrollTop===h&&!m&&(Zl(`ok/scroll-restore/phase2-success`,{target:h,elapsedMs:performance.now()-p}),m=!0)),_=requestAnimationFrame(b))};_=requestAnimationFrame(b);let x=setTimeout(()=>{g||(e.scrollTop!==h&&e.scrollHeight>h&&Zl(`ok/scroll-restore/abandoned`,{target:h,elapsedMs:performance.now()-p,scrollHeight:e.scrollHeight,finalScrollTop:e.scrollTop}),v())},2e3);return v},_=[n,a,r],t[7]=a,t[8]=r,t[9]=n,t[10]=g,t[11]=_):(g=t[10],_=t[11]),(0,Q.useLayoutEffect)(g,_);let v;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(v={overflowAnchor:`auto`},t[12]=v):v=t[12];let y;return t[13]===o?y=t[14]:(y=(0,Z.jsx)(`div`,{ref:s,"data-testid":`editor-scroll-container`,className:`editor-doc-scroll subtle-scrollbar h-full overflow-y-auto pt-14 scroll-pt-14`,style:v,children:o}),t[13]=o,t[14]=y),y}function ZM(e){let t=(0,$.c)(12),{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a}=e,o=r&&i,[s,c]=(0,Q.useState)(o),l,u;if(t[0]===o?(l=t[1],u=t[2]):(l=()=>{o&&c(!0)},u=[o],t[0]=o,t[1]=l,t[2]=u),(0,Q.useEffect)(l,u),!s&&!o)return null;let d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(xS,{}),t[3]=d):d=t[3];let f=n.docName,p;t[4]===n.provider.document?p=t[5]:(p=n.provider.document.getText(`source`),t[4]=n.provider.document,t[5]=p);let m;return t[6]!==a||t[7]!==n.docName||t[8]!==n.provider||t[9]!==o||t[10]!==p?(m=(0,Z.jsx)(Q.Suspense,{fallback:d,children:(0,Z.jsx)(BM,{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 QM(e){let t=(0,$.c)(18),{view:n}=e,r=n.kind===`failed`,i=r?`alert`:`status`,a=!r,o;t[0]===r?o=t[1]:(o=(0,Z.jsx)(`div`,{className:`flex size-12 items-center justify-center rounded-full border bg-muted text-muted-foreground`,children:r?(0,Z.jsx)(tl,{className:`size-5`,"aria-hidden":`true`}):(0,Z.jsx)(Zc,{className:`size-5 animate-spin`,"aria-hidden":`true`})}),t[0]=r,t[1]=o);let s;t[2]===n.title?s=t[3]:(s=(0,Z.jsx)(`h2`,{className:`text-lg font-medium`,children:n.title}),t[2]=n.title,t[3]=s);let c;t[4]===n.summary?c=t[5]:(c=(0,Z.jsx)(`p`,{className:`max-w-md text-sm text-muted-foreground`,children:n.summary}),t[4]=n.summary,t[5]=c);let l;t[6]!==s||t[7]!==c?(l=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;t[9]!==r||t[10]!==n.actionLabel?(u=r?(0,Z.jsxs)(Y,{type:`button`,onClick:$M,children:[(0,Z.jsx)(tl,{className:`size-4`,"aria-hidden":`true`}),n.actionLabel]}):null,t[9]=r,t[10]=n.actionLabel,t[11]=u):u=t[11];let d;return t[12]!==i||t[13]!==a||t[14]!==o||t[15]!==l||t[16]!==u?(d=(0,Z.jsxs)(`div`,{"data-slot":`server-restart-recovery`,role:i,"aria-busy":a,className:`flex h-full flex-col items-center justify-center gap-6 p-8 text-center`,children:[o,l,u]}),t[12]=i,t[13]=a,t[14]=o,t[15]=l,t[16]=u,t[17]=d):d=t[17],d}function $M(){return window.location.reload()}function eN(e){let t=(0,$.c)(2),{html:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(`div`,{className:`tiptap-editor h-full pointer-events-none`,"aria-hidden":`true`,children:(0,Z.jsx)(`div`,{className:`tiptap ProseMirror tiptap-editor-portal-content`,dangerouslySetInnerHTML:{__html:n}})}),t[0]=n,t[1]=r),r}function tN(e){let t=(0,$.c)(57),{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a,isNewDoc:o,previousDocName:s,onNavigateBack:c,onRecycle:l,serverRestartRecovery:u}=e,d;t[0]!==n.docName||t[1]!==u?(d=HM(n.docName,u),t[0]=n.docName,t[1]=u,t[2]=d):d=t[2];let f=d,p=bT(n.docName)===`conflict`,m;t[3]===n.docName?m=t[4]:(m=Go(n.docName),t[3]=n.docName,t[4]=m);let h=m,g;t[5]===n.docName?g=t[6]:(g=()=>{let e=document.createElement(`div`);return e.setAttribute(`data-ok-editor-portal`,n.docName),e.style.display=`contents`,e},t[5]=n.docName,t[6]=g);let[_]=(0,Q.useState)(g),v=(0,Q.useRef)(null),y=n.provider.document.getText(`source`).length,[b,x]=(0,Q.useState)(i),[S,C]=(0,Q.useState)(!i),w,T;t[7]!==i||t[8]!==b||t[9]!==S?(w=()=>{i&&!b?x(!0):!i&&!S&&C(!0)},T=[i,b,S],t[7]=i,t[8]=b,t[9]=S,t[10]=w,t[11]=T):(w=t[10],T=t[11]),(0,Q.useEffect)(w,T);let E=IM({ytextLength:y,isSourceMode:i,visitedSource:b,visitedVisual:S}),D=(0,Q.useRef)(``),O=`${E.isLarge}-${E.renderSource}-${E.renderVisual}`,k,A;t[12]!==n.docName||t[13]!==E.isLarge||t[14]!==E.renderSource||t[15]!==E.renderVisual||t[16]!==O||t[17]!==i||t[18]!==y?(k=()=>{D.current!==O&&(D.current=O,E.isLarge&&Zl(`ok/activity/defer-mount`,{docName:n.docName,ytextLength:y,isSourceMode:i,renderSource:E.renderSource,renderVisual:E.renderVisual}))},A=[O,E.isLarge,E.renderSource,E.renderVisual,n.docName,y,i],t[12]=n.docName,t[13]=E.isLarge,t[14]=E.renderSource,t[15]=E.renderVisual,t[16]=O,t[17]=i,t[18]=y,t[19]=k,t[20]=A):(k=t[19],A=t[20]),(0,Q.useEffect)(k,A);let j;t[21]===n.docName?j=t[22]:(j=()=>Ke(n.docName),t[21]=n.docName,t[22]=j);let[M]=(0,Q.useState)(j),N=M?.html??null,[P,F]=(0,Q.useState)(!1),I,L;t[23]!==n.docName||t[24]!==E.isLarge||t[25]!==E.renderSource||t[26]!==E.renderVisual||t[27]!==P||t[28]!==i||t[29]!==y?(L=()=>{LM({isLarge:E.isLarge,renderSource:E.renderSource,renderVisual:E.renderVisual,hasEmittedFirstToggle:P})&&(Zl(`ok/cold/first-toggle`,{docName:n.docName,mountId:dt(n.docName),ytextLength:y,modeEnteredFirst:i?`source`:`visual`}),F(!0))},I=[P,E.isLarge,E.renderSource,E.renderVisual,n.docName,y,i],t[23]=n.docName,t[24]=E.isLarge,t[25]=E.renderSource,t[26]=E.renderVisual,t[27]=P,t[28]=i,t[29]=y,t[30]=I,t[31]=L):(I=t[30],L=t[31]),(0,Q.useEffect)(L,I);let R=r?`visible`:`hidden`,z=`editor:${n.docName}`,B=M?.scrollTop,V;t[32]!==a||t[33]!==n||t[34]!==E.renderSource||t[35]!==E.renderVisual||t[36]!==r||t[37]!==p||t[38]!==h||t[39]!==o||t[40]!==i||t[41]!==c||t[42]!==l||t[43]!==_||t[44]!==s||t[45]!==f||t[46]!==N?(V=f?(0,Z.jsx)(QM,{view:f}):(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsx)(OM,{activeDocName:n.docName,previousDocName:s,onNavigateBack:c,onRecycle:l,children:(0,Z.jsx)(Q.Suspense,{fallback:N?(0,Z.jsx)(eN,{html:N}):(0,Z.jsx)(xS,{}),children:(0,Z.jsx)(bM,{docName:n.docName,provider:n.provider,children:p?(0,Z.jsx)(yM,{docName:n.docName,provider:n.provider}):h?(0,Z.jsx)(PM,{docName:n.docName,provider:n.provider,isSourceMode:i}):(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[!i&&(ho(n.docName)||ce(n.docName)?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(NM,{docName:n.docName,provider:n.provider})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(AM,{provider:n.provider}),(0,Z.jsx)(Ts,{provider:n.provider})]})),(0,Z.jsx)(`div`,{ref:v,"aria-hidden":!0,className:`h-0`}),(0,Z.jsxs)(`div`,{className:`relative flex-1`,children:[E.renderSource?(0,Z.jsx)(`div`,{className:i?`h-full`:`ok-mode-hidden h-full`,children:(0,Z.jsx)(ZM,{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a})}):null,E.renderVisual?(0,Z.jsx)(`div`,{className:i?`ok-mode-hidden h-full`:`h-full`,children:(0,Z.jsx)(hA,{provider:n.provider,placeholder:a,isSourceMode:i,portalTarget:_},`${n.docName}-${String(o)}-${n.poolEventId}`)}):null]})]})})})})}),t[32]=a,t[33]=n,t[34]=E.renderSource,t[35]=E.renderVisual,t[36]=r,t[37]=p,t[38]=h,t[39]=o,t[40]=i,t[41]=c,t[42]=l,t[43]=_,t[44]=s,t[45]=f,t[46]=N,t[47]=V):V=t[47];let H;t[48]!==n.docName||t[49]!==r||t[50]!==B||t[51]!==V?(H=(0,Z.jsx)(XM,{isActive:r,docName:n.docName,initialScrollTop:B,bodyAnchorRef:v,children:V}),t[48]=n.docName,t[49]=r,t[50]=B,t[51]=V,t[52]=H):H=t[52];let U;return t[53]!==R||t[54]!==z||t[55]!==H?(U=(0,Z.jsx)(Q.Activity,{mode:R,name:z,children:H}),t[53]=R,t[54]=z,t[55]=H,t[56]=U):U=t[56],U}function nN(e){let t=e.endsWith(`rem`)?`rem`:`px`;return{value:Number.parseFloat(e),unit:t}}function rN(e){let{value:t,unit:n}=nN(e);return n===`rem`?t*16:t}function iN(e,t){return`${t===`rem`?e.toFixed(1):Math.round(e)}${t}`}var aN=3600*24*7;function oN(e){let t=(0,$.c)(28),{direction:n,currentWidth:r,onResize:i,onToggle:a,isCollapsed:o,minResizeWidth:s,maxResizeWidth:c,enableToggle:l,enableAutoCollapse:u,autoCollapseThreshold:d,expandThreshold:f,enableDrag:p,setIsDraggingRail:m,widthCookieName:h,widthCookieMaxAge:g,isNested:_}=e,v=n===void 0?`right`:n,y=o===void 0?!1:o,b=s===void 0?`14rem`:s,x=c===void 0?`24rem`:c,S=l===void 0?!0:l,C=u===void 0?!0:u,w=d===void 0?1.5:d,T=f===void 0?.2:f,E=p===void 0?!0:p,D=m===void 0?sN:m,O=g===void 0?aN:g,k=_===void 0?!1:_,A=(0,Q.useRef)(null),j=(0,Q.useRef)(0),M=(0,Q.useRef)(0),N=(0,Q.useRef)(!1),P=(0,Q.useRef)(!1),F=(0,Q.useRef)(null),I=(0,Q.useRef)(0),L=(0,Q.useRef)(!1),R=(0,Q.useRef)(0),z=(0,Q.useRef)(0),B=(0,Q.useRef)(null),V=(0,Q.useRef)(r),H=(0,Q.useRef)(y),U,W;t[0]===r?(U=t[1],W=t[2]):(U=()=>{V.current=r},W=[r],t[0]=r,t[1]=U,t[2]=W),(0,Q.useEffect)(U,W);let ee,G;t[3]===y?(ee=t[4],G=t[5]):(ee=()=>{H.current=y},G=[y],t[3]=y,t[4]=ee,t[5]=G),(0,Q.useEffect)(ee,G);let K=rN(b),te;t[6]===x?te=t[7]:(te=rN(x),t[6]=x,t[7]=te);let ne=te,re;t[8]!==E||t[9]!==k?(re=function(e){E&&(P.current=!0,j.current=H.current?0:rN(V.current),M.current=e.clientX,I.current=e.clientX,F.current=null,L.current=!1,R.current=0,z.current=0,B.current=k&&A.current?A.current.getBoundingClientRect():null,e.preventDefault())},t[8]=E,t[9]=k,t[10]=re):re=t[10];let ie=re,ae,oe;t[11]!==w||t[12]!==v||t[13]!==C||t[14]!==S||t[15]!==T||t[16]!==k||t[17]!==ne||t[18]!==K||t[19]!==i||t[20]!==a||t[21]!==D||t[22]!==O||t[23]!==h?(ae=()=>{let e=function(e){h&&(document.cookie=`${h}=${e}; path=/; max-age=${O}`)},t=function(e,t){return v===`left`?e<t:e>t},n=function(e,t,n,r){if(k&&r){let r=e.clientX-t;return v===`left`?n-r:n+r}return v===`left`?window.innerWidth-e.clientX:e.clientX},r=function(r){if(!P.current)return;let o=Math.abs(r.clientX-M.current);if(!N.current&&o>5&&(N.current=!0,D(!0)),N.current){let{unit:o}=nN(V.current),s=B.current;k&&A.current&&(s=A.current.getBoundingClientRect());let c=t(r.clientX,I.current)?`expand`:`collapse`;F.current!==c&&(F.current=c),z.current=Math.abs(r.clientX-I.current);let l=Date.now();if(L.current&&l-R.current>200&&(L.current=!1),!L.current){if(C&&a&&!H.current){let e=n(r,M.current,j.current,s),t=!1;if(w<=1)t=e<=K*w;else if(e<=K){let n=K*(w-1);t=K-e>=n}if(c===`collapse`&&t){a(),I.current=r.clientX,L.current=!0,R.current=l;return}}if(a&&H.current&&c===`expand`&&z.current>K*T){a();let t=n(r,M.current,j.current,s),c=Math.max(K,Math.min(ne,t)),u=iN(o===`rem`?c/16:c,o);i(u),e(u),I.current=r.clientX,L.current=!0,R.current=l;return}}if(H.current)return;let u=n(r,M.current,j.current,s),d=Math.max(K,Math.min(ne,u)),f=iN(o===`rem`?d/16:d,o);i(f),e(f)}},o=function(){P.current&&(!N.current&&a&&S&&a(),N.current=!1,P.current=!1,F.current=null,I.current=0,L.current=!1,R.current=0,z.current=0,B.current=null,D(!1))};return document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,o),()=>{document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,o)}},oe=[i,a,D,K,ne,k,C,w,T,S,h,O,v],t[11]=w,t[12]=v,t[13]=C,t[14]=S,t[15]=T,t[16]=k,t[17]=ne,t[18]=K,t[19]=i,t[20]=a,t[21]=D,t[22]=O,t[23]=h,t[24]=ae,t[25]=oe):(ae=t[24],oe=t[25]),(0,Q.useEffect)(ae,oe);let se;return t[26]===ie?se=t[27]:(se={dragRef:A,isDragging:N,handleMouseDown:ie},t[26]=ie,t[27]=se),se}function sN(){}var cN=3600*24*7,lN=`18rem`,uN=`3rem`,dN=`app-file-sidebar`,fN=`14.625rem`,pN=`32rem`,mN=`sidebar_width`,hN=/^\d+(?:\.\d+)?(?:rem|px)$/,gN=Q.createContext(null);function _N(e){if(typeof document>`u`)return e;let t=document.cookie.split(`; `).find(e=>e.startsWith(`${mN}=`))?.split(`=`)[1];if(!t)return e;let n;try{n=decodeURIComponent(t)}catch{return e}return hN.test(n)?n:e}function vN(){let e=Q.use(gN);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function yN(e){let t=(0,$.c)(58),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({open:i,onOpenChange:o,className:r,style:s,children:n,defaultWidth:c,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=c===void 0?lN:c,[u]=Q.useState(xN),d;t[8]===u?d=t[9]:(d=()=>AT(u,window.innerWidth,`left`),t[8]=u,t[9]=d);let[f,p]=Q.useState(d),m;t[10]===l?m=t[11]:(m=()=>_N(l),t[10]=l,t[11]=m);let[h,g]=Q.useState(m),[_,v]=Q.useState(!1),[y,b]=Q.useState(!1),x;t[12]===u?x=t[13]:(x=()=>{let e=LT();return zT(`left`,AT(u,window.innerWidth,`left`),e)===`open`},t[12]=u,t[13]=x);let[S,C]=Q.useState(x),w=i??S,T;t[14]!==w||t[15]!==f||t[16]!==o?(T=e=>{let t=typeof e==`function`?e(w):e;o?o(t):C(t),BT(`left`,f,t?`open`:`collapsed`)},t[14]=w,t[15]=f,t[16]=o,t[17]=T):T=t[17];let E=T,D;t[18]===E?D=t[19]:(D=function(){E(bN)},t[18]=E,t[19]=D);let O=D,k=Q.useRef(w),A;t[20]===w?A=t[21]:(A=()=>{k.current=w},t[20]=w,t[21]=A),Q.useLayoutEffect(A);let j;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(j=function(){window.innerWidth>=1024||k.current&&(window.matchMedia(`(prefers-reduced-motion: reduce)`).matches||b(!0))},t[22]=j):j=t[22];let M=j,N,P;t[23]===u?(N=t[24],P=t[25]):(P=()=>{let e=window.matchMedia(`(min-width: ${DT}px)`),t=()=>{let e=AT(u,window.innerWidth,`left`);p(e),C(zT(`left`,e,LT())===`open`)};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},N=[u],t[23]=u,t[24]=N,t[25]=P),Q.useEffect(P,N);let F,I;t[26]===w?(F=t[27],I=t[28]):(F=()=>{w||document.getElementById(dN)?.contains(document.activeElement)&&document.querySelector(`[data-sidebar="trigger"]`)?.focus()},I=[w],t[26]=w,t[27]=F,t[28]=I),Q.useLayoutEffect(F,I);let L,R;t[29]!==w||t[30]!==f||t[31]!==E?(L=()=>{if(f===`above`||!w)return;let e=e=>{e.key===`Escape`&&(document.querySelector(`[data-state="open"][role="dialog"], [data-state="open"][role="alertdialog"], [data-state="open"][role="menu"], [data-state="open"][role="listbox"], [data-radix-popper-content-wrapper] [data-state="open"]`)||E(!1))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},R=[f,w,E],t[29]=w,t[30]=f,t[31]=E,t[32]=L,t[33]=R):(L=t[32],R=t[33]),Q.useEffect(L,R);let z,B;t[34]===O?(z=t[35],B=t[36]):(z=()=>{if(typeof window<`u`&&window.okDesktop!=null)return;let e=e=>{Sl(e,`toggle-files-sidebar`)&&(e.preventDefault(),O())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},B=[O],t[34]=O,t[35]=z,t[36]=B),Q.useEffect(z,B);let V=w?`expanded`:`collapsed`,H;t[37]!==_||t[38]!==w||t[39]!==E||t[40]!==y||t[41]!==V||t[42]!==O||t[43]!==h?(H={state:V,open:w,setOpen:E,toggleSidebar:O,width:h,setWidth:g,isDraggingRail:_,setIsDraggingRail:v,showPushPulse:y,setShowPushPulse:b,notifySidebarFileSelected:M},t[37]=_,t[38]=w,t[39]=E,t[40]=y,t[41]=V,t[42]=O,t[43]=h,t[44]=H):H=t[44];let U;t[45]!==s||t[46]!==h?(U={"--sidebar-width":h,"--sidebar-width-icon":uN,...s},t[45]=s,t[46]=h,t[47]=U):U=t[47];let W=U,ee;t[48]===r?ee=t[49]:(ee=$t(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),t[48]=r,t[49]=ee);let G;t[50]!==n||t[51]!==a||t[52]!==W||t[53]!==ee?(G=(0,Z.jsx)(`div`,{"data-slot":`sidebar-wrapper`,style:W,className:ee,...a,children:n}),t[50]=n,t[51]=a,t[52]=W,t[53]=ee,t[54]=G):G=t[54];let K;return t[55]!==H||t[56]!==G?(K=(0,Z.jsx)(gN.Provider,{value:H,children:G}),t[55]=H,t[56]=G,t[57]=K):K=t[57],K}function bN(e){return!e}function xN(){return Na()}function SN(e){let t=(0,$.c)(39),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,{_:d}=vt(),{state:f,isDraggingRail:p}=vN();if(u===`none`){let e;t[7]===r?e=t[8]:(e=$t(`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,Z.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}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[14]===h?g=t[15]:(g=$t(`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,`group-data-[dragging=true]:duration-0! group-data-[dragging=true]_*:!duration-0`),t[14]=h,t[15]=g);let _;t[16]===g?_=t[17]:(_=(0,Z.jsx)(`div`,{"data-slot":`sidebar-gap`,className:g}),t[16]=g,t[17]=_);let v;t[18]===d?v=t[19]:(v=d({id:`07q4Qk`}),t[18]=d,t[19]=v);let y=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`,b;t[20]!==r||t[21]!==y?(b=$t(`fixed inset-y-0 z-10 flex h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear motion-reduce:transition-none motion-reduce:duration-0 data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]`,y,`group-data-[dragging=true]:duration-0! group-data-[dragging=true]_*:!duration-0`,r),t[20]=r,t[21]=y,t[22]=b):b=t[22];let x;t[23]===n?x=t[24]:(x=(0,Z.jsx)(`div`,{"data-sidebar":`sidebar`,"data-slot":`sidebar-inner`,className:`flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border`,children:n}),t[23]=n,t[24]=x);let S;t[25]!==i||t[26]!==c||t[27]!==b||t[28]!==x||t[29]!==v?(S=(0,Z.jsx)(`nav`,{id:dN,"aria-label":v,"data-slot":`sidebar-container`,"data-side":c,className:b,...i,children:x}),t[25]=i,t[26]=c,t[27]=b,t[28]=x,t[29]=v,t[30]=S):S=t[30];let C;return t[31]!==p||t[32]!==c||t[33]!==f||t[34]!==S||t[35]!==m||t[36]!==_||t[37]!==l?(C=(0,Z.jsxs)(`div`,{className:`group peer text-sidebar-foreground`,"data-state":f,"data-collapsible":m,"data-variant":l,"data-side":c,"data-slot":`sidebar`,"data-dragging":p,children:[_,S]}),t[31]=p,t[32]=c,t[33]=f,t[34]=S,t[35]=m,t[36]=_,t[37]=l,t[38]=C):C=t[38],C}function CN(e){let t=(0,$.c)(34),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{_:a}=vt(),{toggleSidebar:o,state:s}=vN(),c,l,u,d,f,p,m,h;if(t[4]!==a||t[5]!==s){let e=Cl(`toggle-files-sidebar`);c=Y,l=`trigger`,u=`sidebar-trigger`,d=`ghost`,f=`icon-sm`,p=s===`expanded`,m=dN,h=a(s===`expanded`?{id:`4PYsOz`,values:{sidebarShortcutLabel:e}}:{id:`jbSG8V`,values:{sidebarShortcutLabel:e}}),t[4]=a,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d,t[10]=f,t[11]=p,t[12]=m,t[13]=h}else c=t[6],l=t[7],u=t[8],d=t[9],f=t[10],p=t[11],m=t[12],h=t[13];let g;t[14]===n?g=t[15]:(g=$t(n),t[14]=n,t[15]=g);let _;t[16]!==r||t[17]!==o?(_=e=>{r?.(e),o()},t[16]=r,t[17]=o,t[18]=_):_=t[18];let v;t[19]===s?v=t[20]:(v=s===`expanded`?(0,Z.jsx)(ze,{}):(0,Z.jsx)(_h,{}),t[19]=s,t[20]=v);let y;return t[21]!==c||t[22]!==i||t[23]!==l||t[24]!==v||t[25]!==u||t[26]!==d||t[27]!==f||t[28]!==p||t[29]!==m||t[30]!==h||t[31]!==g||t[32]!==_?(y=(0,Z.jsx)(c,{"data-sidebar":l,"data-slot":u,variant:d,size:f,"aria-expanded":p,"aria-controls":m,"aria-label":h,className:g,onClick:_,...i,children:v}),t[21]=c,t[22]=i,t[23]=l,t[24]=v,t[25]=u,t[26]=d,t[27]=f,t[28]=p,t[29]=m,t[30]=h,t[31]=g,t[32]=_,t[33]=y):y=t[33],y}function wN(e){let t=(0,$.c)(32),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:n,enableDrag:a,enableToggle:o,onMouseDown:r,...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?!0:a,c=o===void 0?!0:o,{_:l}=vt(),{toggleSidebar:u,setWidth:d,state:f,width:p,setIsDraggingRail:m}=vN(),h=f===`collapsed`,g;t[6]!==s||t[7]!==c||t[8]!==m||t[9]!==d||t[10]!==h||t[11]!==u||t[12]!==p?(g={direction:`right`,enableDrag:s,enableToggle:c,onResize:d,onToggle:u,currentWidth:p,isCollapsed:h,minResizeWidth:fN,maxResizeWidth:pN,setIsDraggingRail:m,widthCookieName:mN,widthCookieMaxAge:cN},t[6]=s,t[7]=c,t[8]=m,t[9]=d,t[10]=h,t[11]=u,t[12]=p,t[13]=g):g=t[13];let{dragRef:_,handleMouseDown:v}=oN(g),y;t[14]!==l||t[15]!==f?(y=l(f===`expanded`?{id:`w3vFfL`}:{id:`e8zRrb`}),t[14]=l,t[15]=f,t[16]=y):y=t[16];let b;t[17]!==v||t[18]!==r?(b=e=>{r?.(e),e.defaultPrevented||v(e)},t[17]=v,t[18]=r,t[19]=b):b=t[19];let x;t[20]!==l||t[21]!==f?(x=l(f===`expanded`?{id:`w3vFfL`}:{id:`e8zRrb`}),t[20]=l,t[21]=f,t[22]=x):x=t[22];let S;t[23]===n?S=t[24]:(S=$t(`absolute inset-y-0 z-20 hidden w-4 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:start-1/2 after:w-[2px] hover:after:bg-sidebar-border sm:flex ltr:-translate-x-1/2 rtl:-translate-x-1/2`,`in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize`,`[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize`,`group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full hover:group-data-[collapsible=offcanvas]:bg-sidebar`,`[[data-side=left][data-collapsible=offcanvas]_&]:-right-2`,`[[data-side=right][data-collapsible=offcanvas]_&]:-left-2`,`md:group-data-[variant=inset]:after:inset-y-5`,n),t[23]=n,t[24]=S);let C;return t[25]!==_||t[26]!==i||t[27]!==y||t[28]!==b||t[29]!==x||t[30]!==S?(C=(0,Z.jsx)(`button`,{ref:_,"data-sidebar":`rail`,"data-slot":`sidebar-rail`,"aria-label":y,tabIndex:-1,onMouseDown:b,title:x,className:S,...i}),t[25]=_,t[26]=i,t[27]=y,t[28]=b,t[29]=x,t[30]=S,t[31]=C):C=t[31],C}function TN(e){let t=(0,$.c)(14),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,onAnimationEnd:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let{showPushPulse:a,setShowPushPulse:o}=vN(),s;t[4]!==r||t[5]!==o?(s=e=>{r?.(e),e.animationName===`sidebar-push-pulse`&&o(!1)},t[4]=r,t[5]=o,t[6]=s):s=t[6];let c=s,l=a?``:void 0,u;t[7]===n?u=t[8]:(u=$t(`relative flex w-full flex-1 flex-col bg-background peer-data-[variant=inset]:m-2 peer-data-[variant=inset]:ml-0 peer-data-[variant=inset]:rounded-xl peer-data-[variant=inset]:shadow-sm peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2`,n),t[7]=n,t[8]=u);let d;return t[9]!==c||t[10]!==i||t[11]!==l||t[12]!==u?(d=(0,Z.jsx)(`main`,{"data-slot":`sidebar-inset`,"data-push-pulse":l,onAnimationEnd:c,className:u,...i}),t[9]=c,t[10]=i,t[11]=l,t[12]=u,t[13]=d):d=t[13],d}function EN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=$t(`flex flex-col gap-2 p-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-header`,"data-sidebar":`header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function DN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=$t(`flex flex-col gap-2 p-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-footer`,"data-sidebar":`footer`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function ON(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=$t(`no-scrollbar flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-content`,"data-sidebar":`content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function kN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=$t(`relative flex w-full min-w-0 flex-col p-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-group`,"data-sidebar":`group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function AN(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,asChild:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i!==void 0&&i?Qt:`div`,o;t[4]===n?o=t[5]:(o=$t(`flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 ring-sidebar-ring outline-hidden transition-[margin,opacity] duration-200 ease-linear group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0`,n),t[4]=n,t[5]=o);let s;return t[6]!==a||t[7]!==r||t[8]!==o?(s=(0,Z.jsx)(a,{"data-slot":`sidebar-group-label`,"data-sidebar":`group-label`,className:o,...r}),t[6]=a,t[7]=r,t[8]=o,t[9]=s):s=t[9],s}function jN(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,asChild:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i!==void 0&&i?Qt:`button`,o;t[4]===n?o=t[5]:(o=$t(`absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform group-data-[collapsible=icon]:hidden after:absolute after:-inset-2 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0`,n),t[4]=n,t[5]=o);let s;return t[6]!==a||t[7]!==r||t[8]!==o?(s=(0,Z.jsx)(a,{"data-slot":`sidebar-group-action`,"data-sidebar":`group-action`,className:o,...r}),t[6]=a,t[7]=r,t[8]=o,t[9]=s):s=t[9],s}function MN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=$t(`w-full text-sm`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-group-content`,"data-sidebar":`group-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function NN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=$t(`flex w-full min-w-0 flex-col gap-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`ul`,{"data-slot":`sidebar-menu`,"data-sidebar":`menu`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function PN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=$t(`group/menu-item relative`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`li`,{"data-slot":`sidebar-menu-item`,"data-sidebar":`menu-item`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var FN=nn(`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 IN(e){let t=(0,$.c)(28),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({asChild:i,isActive:a,variant:o,size:s,tooltip:c,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=i===void 0?!1:i,u=a===void 0?!1:a,d=o===void 0?`default`:o,f=s===void 0?`default`:s,p=l?Qt:`button`,{state:m}=vN(),h;t[8]!==n||t[9]!==f||t[10]!==d?(h=$t(FN({variant:d,size:f}),n),t[8]=n,t[9]=f,t[10]=d,t[11]=h):h=t[11];let g;t[12]!==p||t[13]!==u||t[14]!==r||t[15]!==f||t[16]!==h?(g=(0,Z.jsx)(p,{"data-slot":`sidebar-menu-button`,"data-sidebar":`menu-button`,"data-size":f,"data-active":u,className:h,...r}),t[12]=p,t[13]=u,t[14]=r,t[15]=f,t[16]=h,t[17]=g):g=t[17];let _=g;if(!c)return _;if(typeof c==`string`){let e;t[18]===c?e=t[19]:(e={children:c},t[18]=c,t[19]=e),c=e}let v;t[20]===_?v=t[21]:(v=(0,Z.jsx)(ln,{asChild:!0,children:_}),t[20]=_,t[21]=v);let y=m!==`collapsed`,b;t[22]!==y||t[23]!==c?(b=(0,Z.jsx)(un,{side:`right`,align:`center`,hidden:y,...c}),t[22]=y,t[23]=c,t[24]=b):b=t[24];let x;return t[25]!==v||t[26]!==b?(x=(0,Z.jsxs)(fn,{children:[v,b]}),t[25]=v,t[26]=b,t[27]=x):x=t[27],x}function LN(e){let t=(0,$.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,asChild:i,showOnHover:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?!1:i,s=a===void 0?!1:a,c=o?Qt:`button`,l=s&&`group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 peer-data-active/menu-button:text-sidebar-accent-foreground aria-expanded:opacity-100 md:opacity-0`,u;t[5]!==n||t[6]!==l?(u=$t(`absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform group-data-[collapsible=icon]:hidden peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1 after:absolute after:-inset-2 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0`,l,n),t[5]=n,t[6]=l,t[7]=u):u=t[7];let d;return t[8]!==c||t[9]!==r||t[10]!==u?(d=(0,Z.jsx)(c,{"data-slot":`sidebar-menu-action`,"data-sidebar":`menu-action`,className:u,...r}),t[8]=c,t[9]=r,t[10]=u,t[11]=d):d=t[11],d}function RN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=$t(`mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5 group-data-[collapsible=icon]:hidden`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`ul`,{"data-slot":`sidebar-menu-sub`,"data-sidebar":`menu-sub`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function zN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=$t(`group/menu-sub-item relative`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`li`,{"data-slot":`sidebar-menu-sub-item`,"data-sidebar":`menu-sub-item`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function BN(e){let t=(0,$.c)(14),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({asChild:i,size:a,isActive:o,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=i===void 0?!1:i,c=a===void 0?`md`:a,l=o===void 0?!1:o,u=s?Qt:`a`,d;t[6]===n?d=t[7]:(d=$t(`flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground ring-sidebar-ring outline-hidden group-data-[collapsible=icon]:hidden 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-[size=md]:text-sm data-[size=sm]:text-xs data-active:bg-sidebar-accent data-active:text-sidebar-accent-foreground data-active:hover:bg-sidebar-accent [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground`,n),t[6]=n,t[7]=d);let f;return t[8]!==u||t[9]!==l||t[10]!==r||t[11]!==c||t[12]!==d?(f=(0,Z.jsx)(u,{"data-slot":`sidebar-menu-sub-button`,"data-sidebar":`menu-sub-button`,"data-size":c,"data-active":l,className:d,...r}),t[8]=u,t[9]=l,t[10]=r,t[11]=c,t[12]=d,t[13]=f):f=t[13],f}function VN(e){let t=null,n=!1,r=new Set;function i(e){if(e!==t){t=e;for(let e of r)e()}}e.subscribeToEvent(i);async function a(){if(!n){n=!0;try{i(await e.fetchBranch())}catch{}}}return{getSnapshot:()=>t,subscribe(e){return r.add(e),a(),()=>{r.delete(e)}}}}async function HN(){let e=await fetch(`/api/server-info`,{signal:AbortSignal.timeout(5e3)});if(!e.ok)return null;let t=await e.json(),n=Pa.safeParse(t);return n.success?n.data.currentBranch??null:null}var UN=typeof window>`u`?{getSnapshot:()=>null,subscribe:()=>()=>{}}:VN({fetchBranch:HN,subscribeToEvent:Wl}),WN=UN.subscribe,GN=UN.getSnapshot;function KN(){return(0,Q.useSyncExternalStore)(WN,GN,GN)}function qN(){let e=(0,$.c)(6),t=KN(),n=Ju(),{state:r}=vN(),i=typeof window<`u`?window.okDesktop:void 0;if(i&&r===`expanded`)return null;let a;e[0]===n?a=e[1]:(a=i?.config.projectName??(n&&ii(n.contentDir)||null),e[0]=n,e[1]=a);let o=a,s=i?.config.projectPath??n?.contentDir??null;if(o===null&&t===null)return null;let c;return e[2]!==t||e[3]!==o||e[4]!==s?(c={projectName:o,projectPath:s,branch:t},e[2]=t,e[3]=o,e[4]=s,e[5]=c):c=e[5],c}function JN(e){let t=(0,$.c)(30),{stats:n,selectionStats:r,showStats:i,composerBadge:a,reserveRightGutter:o}=e,s=i===void 0?!0:i,c=o===void 0?!1:o,{_:l}=vt(),u=qN();if(!s&&u===null&&a==null)return null;let d=r??n,f=r!=null,{words:p,chars:m,tokens:h}=d,g;t[0]!==l||t[1]!==f||t[2]!==s?(g=l(s?f?{id:`Bv5a9_`}:{id:`L1ZE3M`}:{id:`goO4Ll`}),t[0]=l,t[1]=f,t[2]=s,t[3]=g):g=t[3];let _=c&&`pr-12`,v;t[4]===_?v=t[5]:(v=$t(`relative flex h-6 shrink-0 items-center justify-between gap-3 bg-background px-3 text-2xs text-muted-foreground`,_),t[4]=_,t[5]=v);let y;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-full h-2 bg-linear-to-t from-background to-transparent`}),t[6]=y):y=t[6];let b;t[7]!==l||t[8]!==a?(b=a?(0,Z.jsxs)(Y,{type:`button`,variant:`outline`,onClick:a.onReopen,"data-testid":`ask-ai-reopen-badge`,className:`-translate-x-1/2 absolute bottom-0 left-1/2 z-10 h-auto gap-1 rounded-md rounded-b-none bg-card px-2.5 py-0.5 text-2xs font-normal text-muted-foreground shadow-sm hover:text-foreground active:not-aria-[haspopup]:translate-y-0`,children:[(0,Z.jsx)(oc,{className:`size-3`,"aria-hidden":!0}),l({id:`xWEvuo`}),(0,Z.jsx)(pt,{className:`size-3`,"aria-hidden":!0})]}):null,t[7]=l,t[8]=a,t[9]=b):b=t[9];let x;t[10]===u?x=t[11]:(x=u===null?null:(0,Z.jsx)(YN,{identity:u}),t[10]=u,t[11]=x);let S;t[12]===x?S=t[13]:(S=(0,Z.jsx)(`span`,{className:`flex min-w-0 items-center gap-3`,children:x}),t[12]=x,t[13]=S);let C;t[14]!==l||t[15]!==d.chars||t[16]!==d.tokens||t[17]!==d.words||t[18]!==m||t[19]!==f||t[20]!==s||t[21]!==h||t[22]!==p?(C=s?(0,Z.jsxs)(`span`,{className:`flex shrink-0 items-center gap-3`,children:[f?(0,Z.jsx)(`span`,{className:`font-medium text-foreground/70`,"data-testid":`editor-footer-selected-label`,children:l({id:`ylXj1N`})}):null,(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:d.words.toLocaleString()}),` `,(0,Z.jsx)(J,{id:`gljvbT`,values:{words:p}})]}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:d.chars.toLocaleString()}),` `,(0,Z.jsx)(J,{id:`d5rK4X`,values:{chars:m}})]}),(0,Z.jsxs)(`span`,{children:[d.tokens>0?`~`:``,(0,Z.jsx)(`span`,{className:`tabular-nums`,children:d.tokens.toLocaleString()}),` `,(0,Z.jsx)(J,{id:`uynXup`,values:{tokens:h}})]})]}):null,t[14]=l,t[15]=d.chars,t[16]=d.tokens,t[17]=d.words,t[18]=m,t[19]=f,t[20]=s,t[21]=h,t[22]=p,t[23]=C):C=t[23];let w;return t[24]!==C||t[25]!==g||t[26]!==v||t[27]!==b||t[28]!==S?(w=(0,Z.jsxs)(`section`,{"aria-label":g,className:v,children:[y,b,S,C]}),t[24]=C,t[25]=g,t[26]=v,t[27]=b,t[28]=S,t[29]=w):w=t[29],w}function YN(e){let t=(0,$.c)(8),{identity:n}=e,{projectName:r,projectPath:i,branch:a}=n,o;t[0]!==r||t[1]!==i?(o=r===null?null:i?(0,Z.jsxs)(fn,{children:[(0,Z.jsx)(ln,{asChild:!0,children:(0,Z.jsx)(`span`,{tabIndex:0,className:`truncate`,"data-testid":`editor-footer-project-name`,children:r})}),(0,Z.jsx)(un,{side:`top`,className:`max-w-xs break-all`,children:i})]}):(0,Z.jsx)(`span`,{className:`truncate`,"data-testid":`editor-footer-project-name`,children:r}),t[0]=r,t[1]=i,t[2]=o):o=t[2];let s;t[3]===a?s=t[4]:(s=a===null?null:(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,"data-testid":`editor-footer-branch`,children:[(0,Z.jsx)(Xo,{"aria-hidden":`true`,className:`size-3 shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:a})]}),t[3]=a,t[4]=s);let c;return t[5]!==o||t[6]!==s?(c=(0,Z.jsxs)(Z.Fragment,{children:[o,s]}),t[5]=o,t[6]=s,t[7]=c):c=t[7],c}function XN(e){let t=(0,$.c)(11),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let{_:i}=vt(),a;t[3]===i?a=t[4]:(a=i({id:`3__SjS`}),t[3]=i,t[4]=a);let o;t[5]===n?o=t[6]:(o=$t(n),t[5]=n,t[6]=o);let s;return t[7]!==r||t[8]!==a||t[9]!==o?(s=(0,Z.jsx)(`nav`,{"aria-label":a,"data-slot":`breadcrumb`,className:o,...r}),t[7]=r,t[8]=a,t[9]=o,t[10]=s):s=t[10],s}function ZN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=$t(`flex flex-wrap items-center gap-1.5 text-sm wrap-break-word text-muted-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`ol`,{"data-slot":`breadcrumb-list`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function QN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=$t(`inline-flex items-center gap-1`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`li`,{"data-slot":`breadcrumb-item`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function $N(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({current:i,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0||i?`page`:void 0,o;t[4]===n?o=t[5]:(o=$t(`font-normal text-foreground`,n),t[4]=n,t[5]=o);let s;return t[6]!==r||t[7]!==a||t[8]!==o?(s=(0,Z.jsx)(`span`,{"data-slot":`breadcrumb-page`,"aria-current":a,className:o,...r}),t[6]=r,t[7]=a,t[8]=o,t[9]=s):s=t[9],s}function eP(e){let t=(0,$.c)(12),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({children:n,className:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=$t(`[&>svg]:size-3.5`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=n??(0,Z.jsx)(As,{}),t[6]=n,t[7]=o);let s;return t[8]!==i||t[9]!==a||t[10]!==o?(s=(0,Z.jsx)(`li`,{"data-slot":`breadcrumb-separator`,role:`presentation`,"aria-hidden":`true`,className:a,...i,children:o}),t[8]=i,t[9]=a,t[10]=o,t[11]=s):s=t[11],s}var tP=1,nP=2,rP=4;function iP(e){let t=(0,$.c)(18),{docName:n,className:r}=e;if(!n)return null;let i,a,o,s,c,l;if(t[0]!==r||t[1]!==n){l=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Oa(n),u=e?e.kind===`template`?e.folder.split(`/`).filter(Boolean):[]:De(n,``).prefix.replace(/\/$/,``).split(`/`).filter(Boolean);if(u.length===0){l=null;break bb0}let d=(e,t)=>({kind:`segment`,value:e,key:u.slice(0,t+1).join(`/`)}),f=u.length>rP?[...u.slice(0,tP).map((e,t)=>d(e,t)),{kind:`ellipsis`,hidden:u.slice(tP,-nP)},...u.slice(-nP).map((e,t)=>d(e,u.length-nP+t))]:u.map((e,t)=>d(e,t));a=XN,t[8]===r?c=t[9]:(c=$t(`flex min-w-0 items-center`,r),t[8]=r,t[9]=c),i=ZN,o=`min-w-0 flex-nowrap gap-1 overflow-hidden text-muted-foreground/70 text-xs`,s=f.map(aP)}t[0]=r,t[1]=n,t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l}else i=t[2],a=t[3],o=t[4],s=t[5],c=t[6],l=t[7];if(l!==Symbol.for(`react.early_return_sentinel`))return l;let u;t[10]!==i||t[11]!==o||t[12]!==s?(u=(0,Z.jsx)(i,{className:o,children:s}),t[10]=i,t[11]=o,t[12]=s,t[13]=u):u=t[13];let d;return t[14]!==a||t[15]!==c||t[16]!==u?(d=(0,Z.jsx)(a,{className:c,children:u}),t[14]=a,t[15]=c,t[16]=u,t[17]=d):d=t[17],d}function aP(e,t){let n=e.kind===`segment`?e.key:`ellipsis`;return(0,Z.jsxs)(Q.Fragment,{children:[t>0&&(0,Z.jsx)(eP,{className:`shrink-0 text-muted-foreground/70 [&>svg]:size-3`}),e.kind===`ellipsis`?(0,Z.jsxs)(QN,{className:`shrink-0`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,title:e.hidden.join(` / `),className:`flex size-4 items-center justify-center text-muted-foreground/70`,children:(0,Z.jsx)(Wm,{className:`size-3.5`})}),(0,Z.jsx)(`span`,{className:`sr-only`,children:e.hidden.join(` / `)})]}):(0,Z.jsx)(QN,{className:`min-w-0`,children:(0,Z.jsx)($N,{current:!1,className:`min-w-0 truncate font-normal text-muted-foreground/70`,title:e.value,children:e.value})})]},n)}var oP=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{SkillEditorActions:e}=await import(`./SkillEditorActions-BEtnBlep.js`);return{SkillEditorActions:e}},__vite__mapDeps([136,1,6,2,3,7,8,9,10,11,12,17,18,105,16,19,106,14,15,40,24,41,21,84,22,25,83,111,38,23,26,107,112,96,85,29,77,30,113,89,78,90,114,58,97,32,115,33,76,54,56,36,116,117]),import.meta.url)).SkillEditorActions}));function sP(e){let t=(0,$.c)(85),{activeDocName:n,isSourceMode:r,sourceDisabled:i,onModeChange:a,showAddPropertyButton:o,onAddProperty:s,isPanelCollapsed:c,onTogglePanel:l,reserveRightGutter:u}=e,d=u===void 0?!1:u,{_:f}=vt(),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=xl(`toggle-document-panel`),t[0]=p):p=t[0];let m=p,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k;if(t[1]!==f||t[2]!==n||t[3]!==c||t[4]!==r||t[5]!==s||t[6]!==a||t[7]!==l||t[8]!==d||t[9]!==o||t[10]!==i){let e=Cl(`toggle-document-panel`),u;t[26]===n?u=t[27]:(u=n?Oa(n):null,t[26]=n,t[27]=u);let p=u,m;t[28]===n?m=t[29]:(m=n?ce(n):null,t[28]=n,t[29]=m);let A=m,j;t[30]!==p||t[31]!==A?(j=p?.kind===`skill`?{scope:p.scope,name:p.name}:A?{scope:`project`,name:A}:null,t[30]=p,t[31]=A,t[32]=j):j=t[32];let M=j;b=`editor-toolbar`,x=`pointer-events-none absolute inset-x-0 top-0 z-10`;let N;t[33]!==n||t[34]!==M?(N=M?null:(0,Z.jsx)(iP,{docName:n}),t[33]=n,t[34]=M,t[35]=N):N=t[35];let P;t[36]===n?P=t[37]:(P=n===null?null:(0,Z.jsx)(gS,{entry:{kind:`document`,docName:n},className:`shrink-0`}),t[36]=n,t[37]=P);let F;t[38]!==N||t[39]!==P?(F=(0,Z.jsxs)(`div`,{className:`pointer-events-auto flex min-w-0 items-center gap-2`,children:[N,P]}),t[38]=N,t[39]=P,t[40]=F):F=t[40];let I;t[41]!==r||t[42]!==a||t[43]!==i?(I=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex justify-center`,children:(0,Z.jsx)(lw,{isSourceMode:r,onModeChange:a,sourceDisabled:i})}),t[41]=r,t[42]=a,t[43]=i,t[44]=I):I=t[44],t[45]!==F||t[46]!==I?(S=(0,Z.jsx)(`div`,{className:`editor-content-aligned bg-background py-2`,children:(0,Z.jsxs)(`div`,{className:`grid grid-cols-3 items-center`,children:[F,I]})}),t[45]=F,t[46]=I,t[47]=S):S=t[47];let L=d&&`pr-9`;t[48]===L?_=t[49]:(_=$t(`pointer-events-auto absolute top-0 right-0 flex items-center justify-end gap-1 py-2 pr-2`,L),t[48]=L,t[49]=_),t[50]===M?v=t[51]:(v=M?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(oP,{scope:M.scope,name:M.name})}):null,t[50]=M,t[51]=v),t[52]!==f||t[53]!==s||t[54]!==o?(y=o&&(0,Z.jsxs)(fn,{children:[(0,Z.jsx)(Y,{variant:`ghost`,size:`icon`,"aria-label":f({id:`81H_23`}),onClick:s,"data-testid":`add-properties-button`,asChild:!0,children:(0,Z.jsx)(ln,{children:(0,Z.jsx)(lh,{})})}),(0,Z.jsx)(un,{side:`bottom`,children:(0,Z.jsx)(J,{id:`81H_23`})})]}),t[52]=f,t[53]=s,t[54]=o,t[55]=y):y=t[55],g=fn,h=Y,C=``,w=`ghost`,T=`icon`,E=l,D=!c,O=`doc-panel`,k=f(c?{id:`u7H-Wn`,values:{panelShortcutLabel:e}}:{id:`2hpdRq`,values:{panelShortcutLabel:e}}),t[1]=f,t[2]=n,t[3]=c,t[4]=r,t[5]=s,t[6]=a,t[7]=l,t[8]=d,t[9]=o,t[10]=i,t[11]=h,t[12]=g,t[13]=_,t[14]=v,t[15]=y,t[16]=b,t[17]=x,t[18]=S,t[19]=C,t[20]=w,t[21]=T,t[22]=E,t[23]=D,t[24]=O,t[25]=k}else h=t[11],g=t[12],_=t[13],v=t[14],y=t[15],b=t[16],x=t[17],S=t[18],C=t[19],w=t[20],T=t[21],E=t[22],D=t[23],O=t[24],k=t[25];let A;t[56]===c?A=t[57]:(A=(0,Z.jsx)(ln,{children:c?(0,Z.jsx)(el,{}):(0,Z.jsx)($c,{})}),t[56]=c,t[57]=A);let j;t[58]!==h||t[59]!==A||t[60]!==C||t[61]!==w||t[62]!==T||t[63]!==E||t[64]!==D||t[65]!==O||t[66]!==k?(j=(0,Z.jsx)(h,{"data-doc-panel-toggle":C,variant:w,size:T,onClick:E,"aria-expanded":D,"aria-controls":O,"aria-label":k,asChild:!0,children:A}),t[58]=h,t[59]=A,t[60]=C,t[61]=w,t[62]=T,t[63]=E,t[64]=D,t[65]=O,t[66]=k,t[67]=j):j=t[67];let M;t[68]===c?M=t[69]:(M=(0,Z.jsx)(un,{side:`bottom`,children:c?(0,Z.jsx)(J,{id:`KFdXwz`,values:{panelShortcut:m}}):(0,Z.jsx)(J,{id:`MsuXaI`,values:{panelShortcut:m}})}),t[68]=c,t[69]=M);let N;t[70]!==g||t[71]!==j||t[72]!==M?(N=(0,Z.jsxs)(g,{children:[j,M]}),t[70]=g,t[71]=j,t[72]=M,t[73]=N):N=t[73];let P;t[74]!==_||t[75]!==v||t[76]!==y||t[77]!==N?(P=(0,Z.jsxs)(`div`,{className:_,children:[v,y,N]}),t[74]=_,t[75]=v,t[76]=y,t[77]=N,t[78]=P):P=t[78];let F;t[79]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none h-2 bg-linear-to-b from-background to-transparent`}),t[79]=F):F=t[79];let I;return t[80]!==b||t[81]!==x||t[82]!==S||t[83]!==P?(I=(0,Z.jsxs)(`div`,{"data-testid":b,className:x,children:[S,P,F]}),t[80]=b,t[81]=x,t[82]=S,t[83]=P,t[84]=I):I=t[84],I}function cP(e){let{activeDocName:t,deferredActiveDocName:n,mountResolved:r,syncResolved:i}=e;return t===null||t===n?!1:!(r&&i)}function lP(e){let{currentLayout:t,containerPx:n,pinnedPx:r,residualId:i}=e;if(n<=0||!(i in t))return t;let a={...t},o=0;for(let[e,i]of Object.entries(r)){if(!(e in t))continue;let r=i/n*100;a[e]=r,o+=r}let s=0;for(let[e,n]of Object.entries(t))e===i||e in r||(s+=n);let c=100-o-s;return c<0?t:(a[i]=c,a)}var uP=`ok-terminal-height-v1`,dP=1/3,fP=.5;function pP(e){return Math.max(120,Math.round((Number.isFinite(e)?e:0)*fP))}function mP(e){let t=Number.isFinite(e)?e:0;return t<=0?240:Math.round(t*dP)}function hP(e,t){let n=pP(t);return Number.isFinite(e)?e<120?120:e>n?n:Math.round(e):Math.min(mP(t),n)}function gP(){return typeof window>`u`?0:window.innerHeight}function _P(e,t){try{let n=e??localStorage,r=t??gP(),i=n.getItem(uP);if(i==null)return hP(mP(r),r);let a=Number.parseInt(i,10);return hP(Number.isFinite(a)?a:mP(r),r)}catch{return 240}}function vP(e,t,n){try{let r=t??localStorage,i=n??gP();r.setItem(uP,String(hP(e,i)))}catch{}}function yP(){try{return typeof localStorage>`u`?240:_P()}catch{return 240}}function bP(e){let t=(0,$.c)(19),{dockPosition:n,onReveal:r,className:i}=e,{_:a}=vt(),o=n===`right`,s;t[0]===a?s=t[1]:(s=a({id:`vja0Dg`}),t[0]=a,t[1]=s);let c=s,l=o?`rounded-r-none border-r-0`:`rounded-b-none border-b-0`,u;t[2]!==i||t[3]!==l?(u=$t(`absolute z-20 shrink-0 bg-background text-muted-foreground shadow-sm hover:text-foreground`,l,i),t[2]=i,t[3]=l,t[4]=u):u=t[4];let d;t[5]===o?d=t[6]:(d=o?(0,Z.jsx)(Os,{"aria-hidden":`true`}):(0,Z.jsx)(pt,{"aria-hidden":`true`}),t[5]=o,t[6]=d);let f;t[7]!==n||t[8]!==c||t[9]!==r||t[10]!==u||t[11]!==d?(f=(0,Z.jsx)(ln,{asChild:!0,children:(0,Z.jsx)(Y,{type:`button`,variant:`outline`,size:`icon-sm`,"aria-label":c,"data-terminal-reveal":n,onClick:r,className:u,children:d})}),t[7]=n,t[8]=c,t[9]=r,t[10]=u,t[11]=d,t[12]=f):f=t[12];let p=o?`left`:`top`,m;t[13]!==c||t[14]!==p?(m=(0,Z.jsx)(un,{side:p,sideOffset:8,children:c}),t[13]=c,t[14]=p,t[15]=m):m=t[15];let h;return t[16]!==f||t[17]!==m?(h=(0,Z.jsxs)(fn,{children:[f,m]}),t[16]=f,t[17]=m,t[18]=h):h=t[18],h}var xP=`terminal-dock-panel`;function SP(e){let t=(0,$.c)(42),{children:n,visible:r,onVisibleChange:i,dockPosition:a,onBottomContainer:o,onEditorRegion:s,onReveal:c,showRevealTab:l}=e,u=a===void 0?`bottom`:a,d=l===void 0?!1:l,{resolvedTheme:f}=zt(),p=nS(),[m,h]=(0,Q.useState)(!r),g=Cf(f).background,_=r&&u===`bottom`,v=d&&u===`bottom`&&c!=null,[y]=(0,Q.useState)(CP),b=(0,Q.useRef)(y),[x,S]=(0,Q.useState)(!1),C=(0,Q.useRef)(!1),w=(0,Q.useRef)(null),T;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(T=function(e){w.current!=null&&clearTimeout(w.current),w.current=setTimeout(()=>{vP(e),w.current=null},100)},t[0]=T):T=t[0];let E=T,D=(0,Q.useRef)(null),O,k;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(O=()=>()=>{w.current!=null&&clearTimeout(w.current),D.current!=null&&(window.removeEventListener(`pointerup`,D.current),D.current=null)},k=[],t[1]=O,t[2]=k):(O=t[1],k=t[2]),(0,Q.useEffect)(O,k);let A,j;t[3]!==_||t[4]!==p?(A=()=>{let e=p.current;e!=null&&(_?e.resize(`${b.current}px`):e.collapse())},j=[_,p],t[3]=_,t[4]=p,t[5]=A,t[6]=j):(A=t[5],j=t[6]),(0,Q.useEffect)(A,j);let M=x||void 0,N;t[7]!==c||t[8]!==v?(N=v&&c?(0,Z.jsx)(bP,{dockPosition:`bottom`,onReveal:c,className:`right-3 bottom-0`}):null,t[7]=c,t[8]=v,t[9]=N):N=t[9];let P;t[10]!==n||t[11]!==s||t[12]!==N?(P=(0,Z.jsx)(tT,{minSize:`5%`,className:`flex min-h-0 flex-col`,children:(0,Z.jsxs)(`div`,{ref:s,tabIndex:-1,className:`relative flex h-full min-h-0 flex-col outline-none`,children:[n,N]})}),t[10]=n,t[11]=s,t[12]=N,t[13]=P):P=t[13];let F=!_,I;t[14]===_?I=t[15]:(I=()=>{if(!_)return;S(!0),C.current=!0;let e=()=>{S(!1),C.current=!1,window.removeEventListener(`pointerup`,e),D.current=null};D.current=e,window.addEventListener(`pointerup`,e)},t[14]=_,t[15]=I);let L;t[16]!==_||t[17]!==F||t[18]!==I?(L=(0,Z.jsx)(nT,{withHandle:_,disabled:F,onPointerDown:I}),t[16]=_,t[17]=F,t[18]=I,t[19]=L):L=t[19];let R;t[20]===g?R=t[21]:(R={backgroundColor:g},t[20]=g,t[21]=R);let z=_?`${y}px`:0,B;t[22]!==i||t[23]!==r?(B=e=>{let t=e.asPercentage===0;h(t),C.current&&(t&&r?i(!1):!t&&!r&&i(!0),e.inPixels>0&&(b.current=e.inPixels,E(e.inPixels)))},t[22]=i,t[23]=r,t[24]=B):B=t[24];let V=!x&&`transition-[flex-grow] duration-150 ease-out motion-reduce:transition-none motion-reduce:duration-0`,H;t[25]===V?H=t[26]:(H=$t(`flex flex-col`,V),t[25]=V,t[26]=H);let U;t[27]===o?U=t[28]:(U=(0,Z.jsx)(`div`,{ref:o,className:`flex min-h-0 flex-1 flex-col overflow-hidden`}),t[27]=o,t[28]=U);let W;t[29]!==m||t[30]!==p||t[31]!==R||t[32]!==z||t[33]!==B||t[34]!==H||t[35]!==U?(W=(0,Z.jsx)(tT,{id:xP,style:R,panelRef:p,defaultSize:z,minSize:`120px`,maxSize:`95%`,collapsible:!0,collapsedSize:0,onResize:B,inert:m,className:H,children:U}),t[29]=m,t[30]=p,t[31]=R,t[32]=z,t[33]=B,t[34]=H,t[35]=U,t[36]=W):W=t[36];let ee;return t[37]!==P||t[38]!==L||t[39]!==W||t[40]!==M?(ee=(0,Z.jsxs)(eT,{orientation:`vertical`,className:`min-h-0 flex-1`,"data-dragging":M,children:[P,L,W]}),t[37]=P,t[38]=L,t[39]=W,t[40]=M,t[41]=ee):ee=t[41],ee}function CP(){return yP()}var wP=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-BQeZuILy.js`),__vite__mapDeps([61,1,62,2,63,64,9,65,66,67,68,69,70,71,72,15,6,3,7,8,73,58,12,22,11,74,75,76,38,10,17,18,25,77,78,31,19,52,53,35,55,79,14,16,4,80,40,23,24,26,81,28,20,82,21,83,84,27,29,51,54,56,57,85,86,87,30,88,89,90,91,32,33,92,93,94,95,96,97,98,99,100]),import.meta.url)).ActivityModeContent})),TP=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./TimelineDiffPane-BEQVtkis.js`),__vite__mapDeps([137,1,2,138,62,63,64,9,65,66,67,68,69,70,71,72,15,6,3,7,8,73,58,12,22,11,74,75,76,38,10,17,18,25,77,78,31,19,52,53,35,55,79,14,16,4,80,40,23,24,26,81,28,20,82,21,83,84,27,29,51,54,56,57,85,86,87,30,88,89,90,91,32,33,92,93,139,39,41,140,94,100]),import.meta.url)).TimelineDiffPane})),EP=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./AgentDiffPane-QEI9IvTx.js`),__vite__mapDeps([141,1,2,138,62,63,64,9,65,66,67,68,69,70,71,72,15,6,3,7,8,73,58,12,22,11,74,75,76,38,10,17,18,25,77,78,31,19,52,53,35,55,79,14,16,4,80,40,23,24,26,81,28,20,82,21,83,84,27,29,51,54,56,57,85,86,87,30,88,89,90,91,32,33,92,93,139,39,41,140,95,96,97,100,98,99]),import.meta.url)).AgentDiffPane})),DP=`300px`,OP=`600px`,kP=new Set([`doc-panel`,`terminal-column`,`agent-panel`]);function AP(e){let t=(0,$.c)(5),n;t[0]===e?n=t[1]:(n=(0,Z.jsx)(MP,{...e}),t[0]=e,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(jP,{}),t[2]=r):r=t[2];let i;return t[3]===n?i=t[4]:(i=(0,Z.jsx)(Ql,{name:`editor-area`,children:(0,Z.jsxs)(_s,{children:[n,r]})}),t[3]=n,t[4]=i),i}function jP(){let e=(0,$.c)(6),t=Hi(),n;e[0]===t?n=e[1]:(n=e=>{e||t.close()},e[0]=t,e[1]=n);let r;return e[2]!==t.open||e[3]!==t.section||e[4]!==n?(r=(0,Z.jsx)(Uw,{open:t.open,initialSection:t.section,onOpenChange:n}),e[2]=t.open,e[3]=t.section,e[4]=n,e[5]=r):r=e[5],r}function MP(e){let t=(0,$.c)(282),{editorMode:n,onModeChange:r,activeTab:i,onActiveTabChange:a,terminalBridge:o,terminalVisible:s,onTerminalVisibleChange:c,terminalDock:l,terminalHasSessions:u,onTerminalPlacement:d,onRevealTerminal:f}=e,p=s===void 0?!1:s,m=l===void 0?`right`:l,h=u===void 0?!1:u,{_:g}=vt(),{resolvedTheme:_}=zt(),v=Cf(_).background,{activeDocName:y,activeProvider:b,activeTarget:x,recycleDocument:S,docPanelMode:C,docPanelAgentId:w,docPanelExpandSignal:T}=Re(),{openDocumentTransition:E}=Ye(),{requestAddProperty:D}=ps(),O=vT(b,y),k=xT(y,n===`source`?`source`:`wysiwyg`),A=KT(b),j=A===`connected`||A===`synced`,M=bT(y)===`conflict`,[N,P]=(0,Q.useState)(!1),F,I;t[0]!==b||t[1]!==N?(F=()=>{b!=null&&!N&&P(!0)},I=[b,N],t[0]=b,t[1]=N,t[2]=F,t[3]=I):(F=t[2],I=t[3]),(0,Q.useEffect)(F,I);let L=(0,Q.useDeferredValue)(y),R=x?.kind===`missing`,z=!!y&&x?.kind!==`folder`,B;t[4]!==g||t[5]!==R?(B=R?g({id:`K-a33w`}):void 0,t[4]=g,t[5]=R,t[6]=B):B=t[6];let V=B,H=ul(),U,W;t[7]!==y||t[8]!==H?(U=()=>{H&&H.docName!==y&&dl()},W=[y,H],t[7]=y,t[8]=H,t[9]=U,t[10]=W):(U=t[9],W=t[10]),(0,Q.useEffect)(U,W);let ee=Od(),G=ee?.docName??null,K=(0,Q.useRef)(null),te;t[11]!==y||t[12]!==G||t[13]!==E?(te=()=>{if(G==null){K.current=null;return}if(K.current=G,G!==y){let e=lu(G);window.location.hash===e?E(G):window.location.hash=e}},t[11]=y,t[12]=G,t[13]=E,t[14]=te):te=t[14];let ne;t[15]===G?ne=t[16]:(ne=[G],t[15]=G,t[16]=ne),(0,Q.useEffect)(te,ne);let re,ie;t[17]!==y||t[18]!==G?(re=()=>{if(G!=null){if(G===y){K.current=null;return}K.current!==G&&Ad()}},ie=[y,G],t[17]=y,t[18]=G,t[19]=re,t[20]=ie):(re=t[19],ie=t[20]),(0,Q.useEffect)(re,ie);let oe,se;t[21]!==w||t[22]!==C?(oe=()=>{C===`agent`&&w!==null||Ad()},se=[C,w],t[21]=w,t[22]=C,t[23]=oe,t[24]=se):(oe=t[23],se=t[24]),(0,Q.useEffect)(oe,se);let ce=(0,Q.useSyncExternalStore)(es.subscribe,es.getSnapshot,es.getSnapshot),le;t[25]!==x||t[26]!==ce?(le=is(x,ce),t[25]=x,t[26]=ce,t[27]=le):le=t[27];let ue=le,[de]=(0,Q.useState)(LP),fe=de!==null,pe;t[28]===de?pe=t[29]:(pe=()=>AT(de,window.innerWidth,`right`),t[28]=de,t[29]=pe);let[me,he]=(0,Q.useState)(pe),ge=(0,Q.useRef)(me),_e,ve;t[30]===me?(_e=t[31],ve=t[32]):(_e=()=>{ge.current=me},ve=[me],t[30]=me,t[31]=_e,t[32]=ve),(0,Q.useEffect)(_e,ve);let ye=nS(),be=nS(),xe;t[33]===me?xe=t[34]:(xe=()=>zT(`right`,me,LT())===`collapsed`,t[33]=me,t[34]=xe);let[Se]=(0,Q.useState)(xe),[Ce,we]=(0,Q.useState)(Se),Te=(0,Q.useRef)(Ce),[Ee,De]=(0,Q.useState)(null),[Oe,ke]=(0,Q.useState)(null),[Ae,je]=(0,Q.useState)(null),Me=o?.terminal!=null,Ne=m===`right`,Pe=Ne?`right`:`bottom`,Fe=Ne&&p,Ie=!p&&f!=null&&(Me||h),Le=Ie&&!Ne,ze=Ie&&Ne,Be=Ne&&p&&Ee!=null,Ve=Be?Ee:Oe,He=(Ne?Be:p)&&Ve!=null,Ue,We;t[35]!==Ve||t[36]!==d||t[37]!==Pe||t[38]!==Ae||t[39]!==He?(Ue=()=>{d?.({container:Ve,isShowing:He,dockPosition:Pe,editorRegion:Ae})},We=[d,Ve,He,Pe,Ae],t[35]=Ve,t[36]=d,t[37]=Pe,t[38]=Ae,t[39]=He,t[40]=Ue,t[41]=We):(Ue=t[40],We=t[41]),(0,Q.useEffect)(Ue,We);let Ge,Ke;t[42]===Ce?(Ge=t[43],Ke=t[44]):(Ge=()=>{Te.current=Ce},Ke=[Ce],t[42]=Ce,t[43]=Ge,t[44]=Ke),(0,Q.useEffect)(Ge,Ke);let[qe,Je]=(0,Q.useState)(!1),Xe=(0,Q.useRef)(!1),[Ze]=(0,Q.useState)(IP),Qe=(0,Q.useRef)(Ze),$e=(0,Q.useRef)(null),et;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(et=function(e){$e.current!=null&&clearTimeout($e.current),$e.current=setTimeout(()=>{TT(e),$e.current=null},100)},t[45]=et):et=t[45];let tt=et,[nt]=(0,Q.useState)(FP),rt=(0,Q.useRef)(nt),[it,at]=(0,Q.useState)(!1),ot=(0,Q.useRef)(!1),st=(0,Q.useRef)(null),ct;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(ct=function(e){st.current!=null&&clearTimeout(st.current),st.current=setTimeout(()=>{WT(e),st.current=null},100)},t[46]=ct):ct=t[46];let lt=ct,ut,dt;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(ut=()=>()=>{$e.current!=null&&clearTimeout($e.current),st.current!=null&&clearTimeout(st.current)},dt=[],t[47]=ut,t[48]=dt):(ut=t[47],dt=t[48]),(0,Q.useEffect)(ut,dt);let[ft,pt]=(0,Q.useState)(null),mt=(0,Q.useRef)(null),ht=Zx(),gt=(0,Q.useRef)(Fe),_t,yt;t[49]===Fe?(_t=t[50],yt=t[51]):(_t=()=>{gt.current=Fe},yt=[Fe],t[49]=Fe,t[50]=_t,t[51]=yt),(0,Q.useEffect)(_t,yt);let bt;t[52]!==ye||t[53]!==be?(bt=function(){for(let e of[ye,be]){let t=e.current?.getSize();if(t!=null&&t.asPercentage>1&&t.inPixels>0)return t.inPixels/t.asPercentage*100}let e=mt.current;return e!=null&&e.offsetWidth>0?e.offsetWidth:null},t[52]=ye,t[53]=be,t[54]=bt):bt=t[54];let xt=bt,St;t[55]!==ht||t[56]!==xt?(St=function(e){if(Xe.current||ot.current)return;let t=ht.current;if(t!=null)try{let n=xt();if(n==null)return;let r=t.getLayout(),i=Object.keys(r);if(i.length===0)return;let a=i.find(PP);if(a==null)return;let o={};if(`doc-panel`in r&&(o[`doc-panel`]=e?0:Qe.current),`terminal-column`in r&&(o[`terminal-column`]=rt.current),Object.keys(o).length===0)return;let s=lP({currentLayout:r,containerPx:n,pinnedPx:o,residualId:a});s!==r&&t.setLayout(s)}catch{}},t[55]=ht,t[56]=xt,t[57]=St):St=t[57];let Ct=St,wt=(0,Q.useRef)(Ct),Tt;t[58]===Ct?Tt=t[59]:(Tt=()=>{wt.current=Ct},t[58]=Ct,t[59]=Tt),(0,Q.useEffect)(Tt);let Et;t[60]!==Ct||t[61]!==ye?(Et=function(){gt.current?Ct(!1):ye.current?.expand()},t[60]=Ct,t[61]=ye,t[62]=Et):Et=t[62];let Dt=Et,Ot;t[63]!==Ct||t[64]!==Ce||t[65]!==ye?(Ot=function(){if(ye.current==null)return;let e=ge.current;Ce?(BT(`right`,e,`open`),gt.current?Ct(!1):ye.current?.expand()):(BT(`right`,e,`collapsed`),gt.current?Ct(!0):ye.current?.collapse())},t[63]=Ct,t[64]=Ce,t[65]=ye,t[66]=Ot):Ot=t[66];let kt=Ot,At,jt;t[67]!==Ct||t[68]!==de||t[69]!==ye?(At=()=>{let e=window.matchMedia(`(min-width: ${OT}px)`),t=()=>{let e=AT(de,window.innerWidth,`right`);he(e);let t=zT(`right`,e,LT())===`collapsed`;we(t),gt.current?Ct(t):t?ye.current?.collapse():ye.current?.expand()};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},jt=[de,ye,Ct],t[67]=Ct,t[68]=de,t[69]=ye,t[70]=At,t[71]=jt):(At=t[70],jt=t[71]),(0,Q.useEffect)(At,jt);let Mt,Nt;t[72]!==ft||t[73]!==fe?(Mt=()=>{if(ft==null||fe)return;let e=new ResizeObserver(()=>{wt.current(Te.current)});return e.observe(ft),()=>e.disconnect()},Nt=[ft,fe],t[72]=ft,t[73]=fe,t[74]=Mt,t[75]=Nt):(Mt=t[74],Nt=t[75]),(0,Q.useEffect)(Mt,Nt);let Pt,Ft;t[76]!==Dt||t[77]!==a?(Pt=()=>{let e=e=>{a(e),Dt()},t=ug();return t&&e(t),fg(t=>{ug(),e(t)})},Ft=[a,Dt],t[76]=Dt,t[77]=a,t[78]=Pt,t[79]=Ft):(Pt=t[78],Ft=t[79]),(0,Q.useEffect)(Pt,Ft);let It,Lt;t[80]!==T||t[81]!==Dt?(It=()=>{T!==0&&Dt()},Lt=[T,Dt],t[80]=T,t[81]=Dt,t[82]=It,t[83]=Lt):(It=t[82],Lt=t[83]),(0,Q.useEffect)(It,Lt);let Rt=(0,Q.useRef)(Fe),Bt,Vt;t[84]!==Ce||t[85]!==Fe?(Bt=()=>{if(Rt.current===Fe)return;Rt.current=Fe;let e=Ce;queueMicrotask(()=>{wt.current(e)})},Vt=[Fe,Ce],t[84]=Ce,t[85]=Fe,t[86]=Bt,t[87]=Vt):(Bt=t[86],Vt=t[87]),(0,Q.useLayoutEffect)(Bt,Vt);let Ht,Ut;t[88]===Ce?(Ht=t[89],Ut=t[90]):(Ht=()=>{if(!Ce||!document.getElementById(`doc-panel`)?.contains(document.activeElement))return;let e=document.querySelector(`[data-doc-panel-toggle]`);if(e){e.focus();return}document.querySelector(`[data-sidebar="trigger"]`)?.focus()},Ut=[Ce],t[88]=Ce,t[89]=Ht,t[90]=Ut),(0,Q.useLayoutEffect)(Ht,Ut);let Wt,Kt;t[91]===Ce?(Wt=t[92],Kt=t[93]):(Wt=()=>{Ic({docPanelVisible:!Ce}),window.okDesktop!=null&&window.okDesktop.editor.notifyViewMenuStateChanged({docPanelVisible:!Ce})},Kt=[Ce],t[91]=Ce,t[92]=Wt,t[93]=Kt),(0,Q.useEffect)(Wt,Kt);let qt,Jt;t[94]===kt?(qt=t[95],Jt=t[96]):(qt=()=>Gt(e=>{e===`toggle-doc-panel`&&kt()}),Jt=[kt],t[94]=kt,t[95]=qt,t[96]=Jt),(0,Q.useEffect)(qt,Jt);let Yt,Xt;t[97]===kt?(Yt=t[98],Xt=t[99]):(Yt=()=>{if(window.okDesktop!=null)return;let e=e=>{Sl(e,`toggle-document-panel`)&&(e.preventDefault(),kt())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},Xt=[kt],t[97]=kt,t[98]=Yt,t[99]=Xt),(0,Q.useEffect)(Yt,Xt);let Zt=(0,Q.useRef)(null),[Qt,en]=(0,Q.useState)(null),[tn,nn]=(0,Q.useState)(!1),Y=x?.kind===`large-file`?x.docName:y,rn,an;t[100]===Y?(rn=t[101],an=t[102]):(rn=()=>{if(Y&&Y!==Zt.current){let e=Zt.current;Zt.current=Y,en(e)}},an=[Y],t[100]=Y,t[101]=rn,t[102]=an),(0,Q.useEffect)(rn,an);let on;t[103]===E?on=t[104]:(on=function(e){let t=lu(e);window.location.hash===t?E(e):window.location.hash=t},t[103]=E,t[104]=on);let sn=on,cn,ln=null;if(x?.kind===`large-file`){let e;t[105]!==sn||t[106]!==Qt?(e=Qt?{previousDocName:Qt,onNavigateBack:sn}:void 0,t[105]=sn,t[106]=Qt,t[107]=e):e=t[107];let n;t[108]!==x.docName||t[109]!==x.limit||t[110]!==x.size||t[111]!==e?(n=(0,Z.jsx)(iw,{docName:x.docName,size:x.size,limit:x.limit,backNav:e}),t[108]=x.docName,t[109]=x.limit,t[110]=x.size,t[111]=e,t[112]=n):n=t[112],cn=n}else if(x?.kind===`folder`){let e;t[113]!==fe||t[114]!==p?(e=LE({terminalVisible:p,isEmbedded:fe}),t[113]=fe,t[114]=p,t[115]=e):e=t[115];let n=e,r;t[116]===x.folderPath?r=t[117]:(r=(0,Z.jsx)(ew,{folderPath:x.folderPath}),t[116]=x.folderPath,t[117]=r);let i;t[118]===n?i=t[119]:(i=n?(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-0 h-2 bg-linear-to-t from-background to-transparent`}):null,t[118]=n,t[119]=i);let a;t[120]!==r||t[121]!==i?(a=(0,Z.jsxs)(`div`,{className:`relative flex min-h-0 flex-1 flex-col`,children:[r,i]}),t[120]=r,t[121]=i,t[122]=a):a=t[122];let o;t[123]!==x.folderPath||t[124]!==n?(o=n?(0,Z.jsx)(CE,{folderPath:x.folderPath}):null,t[123]=x.folderPath,t[124]=n,t[125]=o):o=t[125];let s;if(t[126]!==a||t[127]!==o?(s=(0,Z.jsxs)(`div`,{className:`relative flex h-full min-h-0 flex-col`,children:[a,o]}),t[126]=a,t[127]=o,t[128]=s):s=t[128],cn=s,C===`agent`&&w!==null){let e;t[129]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(nT,{withHandle:!0}),t[129]=e):e=t[129];let n;t[130]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(Z.Fragment,{children:[e,(0,Z.jsx)(tT,{id:`agent-panel`,defaultSize:`25%`,minSize:`300px`,maxSize:`40%`,className:`flex flex-col bg-muted/20`,children:(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(`div`,{role:`status`,"aria-busy":`true`,className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`ONPvOb`})}),children:(0,Z.jsx)(wP,{showBackButton:!1})})})]}),t[130]=n):n=t[130],ln=n}}else if(x?.kind===`asset`&&jo(x.assetPath.split(`/`).pop()??x.assetPath)){let e;t[131]===x.assetPath?e=t[132]:(e=(0,Z.jsx)(vw,{assetPath:x.assetPath},x.assetPath),t[131]=x.assetPath,t[132]=e),cn=e}else if(x?.kind===`asset`){let e;t[133]!==x.assetPath||t[134]!==x.mediaKind?(e=(0,Z.jsx)(yS,{assetPath:x.assetPath,mediaKind:x.mediaKind},x.assetPath),t[133]=x.assetPath,t[134]=x.mediaKind,t[135]=e):e=t[135],cn=e}else if(x?.kind===`skill-file`){let e=`${x.scope}/${x.name}/${x.path}`,n;t[136]!==x.name||t[137]!==x.path||t[138]!==x.scope||t[139]!==e?(n=(0,Z.jsx)(Mw,{scope:x.scope,name:x.name,path:x.path},e),t[136]=x.name,t[137]=x.path,t[138]=x.scope,t[139]=e,t[140]=n):n=t[140],cn=n}else if(ue){let e;t[141]===ue?e=t[142]:(e=(0,Z.jsx)(xw,{nav:ue},ue.path),t[141]=ue,t[142]=e),cn=e}else if(!b||!y)if((typeof window<`u`?cu(window.location.hash):null)!==null)if(o!=null&&N){let e;t[143]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(xS,{}),t[143]=e):e=t[143],cn=e;let n;t[144]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(nT,{withHandle:!0,disabled:!0}),t[144]=n):n=t[144];let r=Se?0:`${Ze}px`,i;t[145]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`}),t[145]=i):i=t[145];let a;t[146]===r?a=t[147]:(a=(0,Z.jsxs)(Z.Fragment,{children:[n,(0,Z.jsx)(tT,{id:`doc-panel`,defaultSize:r,minSize:DP,maxSize:OP,collapsible:!0,collapsedSize:0,inert:!0,className:`flex flex-col bg-muted/20`,children:i})]}),t[146]=r,t[147]=a),ln=a}else{let e;return t[148]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(xS,{}),t[148]=e):e=t[148],e}else{let e=p?Pe:null,n;t[149]===e?n=t[150]:(n=(0,Z.jsx)(xC,{terminalDock:e}),t[149]=e,t[150]=n),cn=n}else{let e=n===`source`,o=!j,s=Ce,c;t[151]!==y||t[152]!==D?(c=function(){y&&D(y)},t[151]=y,t[152]=D,t[153]=c):c=t[153];let l=c,u;t[154]!==y||t[155]!==ee||t[156]!==G||t[157]!==fe||t[158]!==p||t[159]!==H?(u=IE({terminalVisible:p,isEmbedded:fe,activeDocName:y})&&!(H&&H.docName===y)&&!(ee&&G===y),t[154]=y,t[155]=ee,t[156]=G,t[157]=fe,t[158]=p,t[159]=H,t[160]=u):u=t[160];let d=u,f=L??y,m=Qt??void 0,h;t[161]!==V||t[162]!==e||t[163]!==sn||t[164]!==S||t[165]!==f||t[166]!==m?(h=(0,Z.jsx)(UM,{activeDocName:f,isSourceMode:e,editorPlaceholder:V,previousDocName:m,onNavigateBack:sn,onRecycle:S}),t[161]=V,t[162]=e,t[163]=sn,t[164]=S,t[165]=f,t[166]=m,t[167]=h):h=t[167];let g;t[168]!==y||t[169]!==e?(g=(0,Z.jsx)(mT,{activeDocName:y,isSourceMode:e}),t[168]=y,t[169]=e,t[170]=g):g=t[170];let _;t[171]!==y||t[172]!==L?(_=cP({activeDocName:y,deferredActiveDocName:L,mountResolved:y!==null&&ae(y),syncResolved:y!==null&&q(y)})?(0,Z.jsxs)(`div`,{className:`absolute inset-0 z-10 bg-background`,children:[(0,Z.jsx)(xS,{}),y===null?null:(0,Z.jsx)(yw,{docName:y})]}):null,t[171]=y,t[172]=L,t[173]=_):_=t[173];let v;t[174]!==y||t[175]!==Ce||t[176]!==H||t[177]!==kt?(v=H&&H.docName===y?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(TP,{view:H,isPanelCollapsed:Ce,onTogglePanel:kt})}):null,t[174]=y,t[175]=Ce,t[176]=H,t[177]=kt,t[178]=v):v=t[178];let b;t[179]!==y||t[180]!==ee||t[181]!==G||t[182]!==Ce||t[183]!==kt?(b=ee&&G===y?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(EP,{view:ee,isPanelCollapsed:Ce,onTogglePanel:kt})}):null,t[179]=y,t[180]=ee,t[181]=G,t[182]=Ce,t[183]=kt,t[184]=b):b=t[184];let x;t[185]!==h||t[186]!==g||t[187]!==_||t[188]!==v||t[189]!==b?(x=(0,Z.jsxs)(`div`,{className:`relative h-full`,children:[h,g,_,v,b]}),t[185]=h,t[186]=g,t[187]=_,t[188]=v,t[189]=b,t[190]=x):x=t[190];let w;t[191]!==y||t[192]!==M||t[193]!==s||t[194]!==e||t[195]!==r||t[196]!==l||t[197]!==ze||t[198]!==o||t[199]!==kt?(w=!M&&(0,Z.jsx)(sP,{activeDocName:y,isSourceMode:e,sourceDisabled:o,onModeChange:r,showAddPropertyButton:!e,onAddProperty:l,isPanelCollapsed:s,onTogglePanel:kt,reserveRightGutter:ze&&s}),t[191]=y,t[192]=M,t[193]=s,t[194]=e,t[195]=r,t[196]=l,t[197]=ze,t[198]=o,t[199]=kt,t[200]=w):w=t[200];let T;t[201]!==y||t[202]!==tn||t[203]!==e||t[204]!==d?(T=d?(0,Z.jsx)(CE,{docName:y,surface:e?`source`:`wysiwyg`,dismissed:tn,onDismiss:()=>nn(!0),onReopen:()=>nn(!1)}):null,t[201]=y,t[202]=tn,t[203]=e,t[204]=d,t[205]=T):T=t[205];let E;t[206]!==x||t[207]!==w||t[208]!==T?(E=(0,Z.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[x,w,T]}),t[206]=x,t[207]=w,t[208]=T,t[209]=E):E=t[209];let A;t[210]!==tn||t[211]!==d?(A=d&&tn?{onReopen:()=>nn(!1)}:null,t[210]=tn,t[211]=d,t[212]=A):A=t[212];let N;t[213]!==Le||t[214]!==k||t[215]!==z||t[216]!==O||t[217]!==A?(N=(0,Z.jsx)(JN,{stats:O,selectionStats:k,showStats:z,composerBadge:A,reserveRightGutter:Le}),t[213]=Le,t[214]=k,t[215]=z,t[216]=O,t[217]=A,t[218]=N):N=t[218];let P;t[219]!==E||t[220]!==N?(P=(0,Z.jsxs)(`div`,{className:`relative flex h-full flex-col`,children:[E,N]}),t[219]=E,t[220]=N,t[221]=P):P=t[221],cn=P;let F=Fe&&Ce,I=!Ce,R;t[222]===Symbol.for(`react.memo_cache_sentinel`)?(R=()=>{Je(!0),Xe.current=!0;let e=()=>{Je(!1),Xe.current=!1,window.removeEventListener(`pointerup`,e)};window.addEventListener(`pointerup`,e)},t[222]=R):R=t[222];let B;t[223]!==Ce||t[224]!==I?(B=(0,Z.jsx)(nT,{withHandle:I,disabled:Ce,onPointerDown:R}),t[223]=Ce,t[224]=I,t[225]=B):B=t[225];let U=Se?0:`${Ze}px`,W=F?`0px`:DP,K;t[226]===Symbol.for(`react.memo_cache_sentinel`)?(K=e=>{we(e.asPercentage===0),e.inPixels>0&&Xe.current&&(Qe.current=e.inPixels,tt(e.inPixels))},t[226]=K):K=t[226];let te=!qe&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,ne;t[227]===te?ne=t[228]:(ne=$t(`flex flex-col bg-muted/20`,te),t[227]=te,t[228]=ne);let re;t[229]!==y||t[230]!==i||t[231]!==C||t[232]!==e||t[233]!==a?(re=(0,Z.jsx)(ob,{docName:y,isSourceMode:e,activeTab:i,onActiveTabChange:a,mode:C}),t[229]=y,t[230]=i,t[231]=C,t[232]=e,t[233]=a,t[234]=re):re=t[234];let ie;t[235]!==F||t[236]!==Ce||t[237]!==ye||t[238]!==U||t[239]!==W||t[240]!==ne||t[241]!==re?(ie=(0,Z.jsx)(tT,{id:`doc-panel`,panelRef:ye,disabled:F,defaultSize:U,minSize:W,maxSize:OP,collapsible:!0,collapsedSize:0,onResize:K,inert:Ce,className:ne,children:re}),t[235]=F,t[236]=Ce,t[237]=ye,t[238]=U,t[239]=W,t[240]=ne,t[241]=re,t[242]=ie):ie=t[242];let oe;t[243]!==B||t[244]!==ie?(oe=(0,Z.jsxs)(Z.Fragment,{children:[B,ie]}),t[243]=B,t[244]=ie,t[245]=oe):oe=t[245],ln=oe}let un=c??NP,dn;t[246]!==Le||t[247]!==f||t[248]!==un||t[249]!==Pe||t[250]!==p||t[251]!==cn?(dn=(0,Z.jsx)(SP,{visible:p,onVisibleChange:un,dockPosition:Pe,onBottomContainer:ke,onEditorRegion:je,onReveal:f,showRevealTab:Le,children:cn}),t[246]=Le,t[247]=f,t[248]=un,t[249]=Pe,t[250]=p,t[251]=cn,t[252]=dn):dn=t[252];let fn=dn,pn;t[253]!==nt||t[254]!==it||t[255]!==c||t[256]!==be||t[257]!==Fe||t[258]!==v?(pn=Fe?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(nT,{withHandle:!0,onPointerDown:()=>{at(!0),ot.current=!0;let e=()=>{at(!1),ot.current=!1,window.removeEventListener(`pointerup`,e),be.current?.isCollapsed()&&c?.(!1)};window.addEventListener(`pointerup`,e)}}),(0,Z.jsx)(tT,{id:`terminal-column`,panelRef:be,style:{backgroundColor:v},defaultSize:`${nt}px`,minSize:`320px`,maxSize:`95%`,collapsible:!0,collapsedSize:0,onResize:e=>{e.inPixels>0&&ot.current&&(rt.current=e.inPixels,lt(e.inPixels))},className:$t(`flex flex-col`,!it&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`),children:(0,Z.jsx)(`div`,{ref:De,className:`flex min-h-0 flex-1 flex-col overflow-hidden`})})]}):null,t[253]=nt,t[254]=it,t[255]=c,t[256]=be,t[257]=Fe,t[258]=v,t[259]=pn):pn=t[259];let mn=pn,hn=ln!=null&&!Se||Fe,gn;t[260]===Symbol.for(`react.memo_cache_sentinel`)?(gn=e=>{pt(e),mt.current=e},t[260]=gn):gn=t[260];let _n=qe||it||void 0,vn=Fe?`5%`:`30%`,yn;t[261]===hn?yn=t[262]:(yn=hn?{}:{defaultSize:`100%`},t[261]=hn,t[262]=yn);let bn=!(qe||it)&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,xn;t[263]===bn?xn=t[264]:(xn=$t(bn),t[263]=bn,t[264]=xn);let Sn;t[265]!==fn||t[266]!==vn||t[267]!==yn||t[268]!==xn?(Sn=(0,Z.jsx)(tT,{minSize:vn,...yn,className:xn,children:fn}),t[265]=fn,t[266]=vn,t[267]=yn,t[268]=xn,t[269]=Sn):Sn=t[269];let Cn;t[270]!==ht||t[271]!==ln||t[272]!==_n||t[273]!==Sn||t[274]!==mn?(Cn=(0,Z.jsxs)(eT,{orientation:`horizontal`,groupRef:ht,"data-dragging":_n,children:[Sn,ln,mn]}),t[270]=ht,t[271]=ln,t[272]=_n,t[273]=Sn,t[274]=mn,t[275]=Cn):Cn=t[275];let wn;t[276]!==f||t[277]!==ze?(wn=ze?(0,Z.jsx)(bP,{dockPosition:`right`,onReveal:f,className:`top-2.5 right-0`}):null,t[276]=f,t[277]=ze,t[278]=wn):wn=t[278];let Tn;return t[279]!==Cn||t[280]!==wn?(Tn=(0,Z.jsxs)(`div`,{className:`relative flex min-h-0 flex-1`,ref:gn,children:[Cn,wn]}),t[279]=Cn,t[280]=wn,t[281]=Tn):Tn=t[281],Tn}function NP(){}function PP(e){return!kP.has(e)}function FP(){return GT()}function IP(){return ET()}function LP(){return Na()}function RP(){if(typeof window>`u`)return!1;let e=window.okDesktop;return e!=null&&e.menu!=null&&e.platform!==`darwin`}function zP(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r.kind!==i.kind)return!1;if(r.kind===`human`&&i.kind===`human`){if(r.clientId!==i.clientId||r.mode!==i.mode||r.tabCount!==i.tabCount)return!1;let e=r.user,t=i.user;if(e.name!==t.name||e.color!==t.color||e.icon!==t.icon)return!1}else if(r.kind===`agent`&&i.kind===`agent`){if(r.agentId!==i.agentId)return!1;let e=r.presence,t=i.presence;if(e.displayName!==t.displayName||e.icon!==t.icon||e.color!==t.color||e.currentDoc!==t.currentDoc||e.mode!==t.mode)return!1}}return!0}function BP(e){let t=new Map;for(let n of e){let e=n.user.principalId;if(typeof e==`string`&&e.length>0){let r=t.get(e);r?r.push(n):t.set(e,[n])}}let n=new Map;for(let[e,r]of t){let t=r.reduce((e,t)=>Math.min(e,t.clientId),1/0);n.set(e,{repClientId:t,count:r.length})}let r=[];for(let t of e){let e=t.user.principalId;if(typeof e==`string`&&e.length>0){let i=n.get(e);i&&i.repClientId===t.clientId&&r.push({...t,tabCount:i.count})}else r.push({...t,tabCount:1})}return r}var VP=1e3,HP=!1;function UP(e){return!!(e.localPrincipalId&&e.entryPrincipalId===e.localPrincipalId||!e.localPrincipalId&&e.entryClientId===e.localClientId)}function WP(e,t,n){let r=(0,$.c)(9),i;r[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={current:[],crossDoc:[]},r[0]=i):i=r[0];let[a,o]=(0,Q.useState)(i),s;r[1]!==n||r[2]!==e?.awareness||r[3]!==t?.awareness?(s=()=>{let r=e?.awareness,i=t?.awareness,a;i==null?a=void 0:wf(i)?a=i:(a=void 0,HP||(HP=!0,console.warn(`[agent-presence] __system__ provider awareness missing getStates() — presence bar will render without agent peers`)));let s=()=>{let e=(r?.getLocalState())?.user?.principalId??null,t=r?.clientID??null,i=[];if(r)for(let[n,a]of r.getStates().entries()){let r=a;if(!r.user||typeof r.user!=`object`)continue;let o=r.user;o.type===`human`&&(UP({entryPrincipalId:o.principalId,entryClientId:n,localPrincipalId:e,localClientId:t})||i.push({kind:`human`,clientId:n,user:o,mode:r.mode??`wysiwyg`,tabCount:1}))}let s=BP(i),{current:c,crossDoc:l}=a?Tf(a,n,Date.now()):{current:[],crossDoc:[]},u=GP,d=c.map(u),f=l.map(u),p=[...s,...d],m=f;o(e=>zP(e.current,p)&&zP(e.crossDoc,m)?e:{current:p,crossDoc:m})};s();let c=()=>s(),l=()=>s();r?.on(`change`,c),t?.awareness?.on(`change`,l);let u=setInterval(s,VP);return()=>{r?.off(`change`,c),t?.awareness?.off(`change`,l),clearInterval(u)}},r[1]=n,r[2]=e?.awareness,r[3]=t?.awareness,r[4]=s):s=r[4];let c;return r[5]!==n||r[6]!==e||r[7]!==t?(c=[e,t,n],r[5]=n,r[6]=e,r[7]=t,r[8]=c):c=r[8],(0,Q.useEffect)(s,c),a}function GP(e){let{agentId:t,entry:n}=e;return{kind:`agent`,agentId:t,presence:n}}var KP=!1,qP=new Set,JP=!1;function YP(){for(let e of qP)e()}function XP(e){KP!==e&&(KP=e,YP())}function ZP(){return KP}function QP(e){return qP.add(e),()=>{qP.delete(e)}}function $P(e){let t=[e.onUpdateRelaunching(()=>XP(!0)),e.onUpdateRelaunchFailed(()=>XP(!1))];return()=>{for(let e of t)e()}}function eF(){if(JP||typeof window>`u`)return;let e=window.okDesktop;e&&(JP=!0,$P(e))}function tF(){return(0,Q.useSyncExternalStore)(QP,ZP,nF)}function nF(){return!1}var rF=`sync-status`;async function iF(e){try{let t=await Ev(e);t.ok||X.error(t.message,{id:rF,duration:1/0})}catch{}}function aF(e,t){let n=(0,$.c)(6),{_:r}=vt(),i=tF(),a=(0,Q.useRef)(!1),o=(0,Q.useRef)(!1),s=(0,Q.useRef)(t),c,l;n[0]!==r||n[1]!==t||n[2]!==i||n[3]!==e?(c=()=>{if(s.current!==t&&(s.current=t,a.current=!1,o.current=!1),t)if(e===`synced`&&(a.current=!0),e===`disconnected`&&a.current){if(i){X.dismiss(rF);return}o.current=!0;let e=window.okDesktop;X.warning(r({id:`HGNCsl`}),{id:rF,duration:1/0,...e?{action:{label:r({id:`uaUc6t`}),onClick:()=>{iF(e)}}}:{}})}else o.current&&e===`synced`&&(o.current=!1,X.success(r({id:`GhjUB_`}),{id:rF,duration:3e3}))},l=[e,t,r,i],n[0]=r,n[1]=t,n[2]=i,n[3]=e,n[4]=c,n[5]=l):(c=n[4],l=n[5]),(0,Q.useEffect)(c,l)}var oF=4,sF=3,cF={Bird:Mm,Cat:Lm,Dog:Um,Fish:Xm,Mouse:Sh,Rabbit:xh,Shrimp:Dh,Snail:Oh,Squirrel:jh,Turtle:Vh};Object.freeze(Object.keys(cF));function lF(e){if(typeof e.principalId==`string`&&e.principalId.length>0)return{kind:`initials`};let t=e.name.split(` `)[1];return t&&Object.hasOwn(cF,t)?{kind:`animal`,animal:t}:{kind:`initials`}}var uF={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`,bot:`Agent`};function dF(e){let t=(0,$.c)(28),{user:n,mode:r,tabCount:i}=e,{_:a}=vt(),o=lF(n),s=o.kind===`animal`?cF[o.animal]:void 0,c;t[0]===n.name?c=t[1]:(c=Ha(n.name),t[0]=n.name,t[1]=c);let l=c,u;t[2]===n.color?u=t[3]:(u=da(n.color),t[2]=n.color,t[3]=u);let d=u,f=n.name,p;t[4]!==a||t[5]!==i||t[6]!==f?(p=i>1?a({id:`qAhFeg`,values:{userName:f,tabCount:i}}):f,t[4]=a,t[5]=i,t[6]=f,t[7]=p):p=t[7];let m=p,h;t[8]!==a||t[9]!==i||t[10]!==f?(h=i>1?a({id:`BEkF-P`,values:{userName:f,tabCount:i}}):f,t[8]=a,t[9]=i,t[10]=f,t[11]=h):h=t[11];let g=h,_;t[12]===n.color?_=t[13]:(_={backgroundColor:n.color},t[12]=n.color,t[13]=_);let v;t[14]!==s||t[15]!==d||t[16]!==l?(v=s?(0,Z.jsx)(s,{size:18,color:d,strokeWidth:1.5}):(0,Z.jsx)(`span`,{className:`font-mono text-2xs font-semibold leading-none`,style:{color:d},children:l}),t[14]=s,t[15]=d,t[16]=l,t[17]=v):v=t[17];let y;t[18]!==g||t[19]!==r||t[20]!==_||t[21]!==v?(y=(0,Z.jsx)(ln,{asChild:!0,children:(0,Z.jsx)(`div`,{"data-presence-badge":`human`,"data-presence-mode":r,role:`img`,"aria-label":g,className:`inline-flex size-7 shrink-0 cursor-default items-center justify-center rounded-full ring-2 ring-background`,style:_,children:v})}),t[18]=g,t[19]=r,t[20]=_,t[21]=v,t[22]=y):y=t[22];let b;t[23]===m?b=t[24]:(b=(0,Z.jsx)(un,{children:m}),t[23]=m,t[24]=b);let x;return t[25]!==y||t[26]!==b?(x=(0,Z.jsxs)(fn,{children:[y,b]}),t[25]=y,t[26]=b,t[27]=x):x=t[27],x}function fF(e){let t=uF[e.icon];return e.displayName||t||yl._({id:`iEQQyu`})}function pF(e){let t=(0,$.c)(3),[n,r]=(0,Q.useState)(e===`writing`),i=(0,Q.useRef)(null),a,o;return t[0]===e?(a=t[1],o=t[2]):(a=()=>{if(e===`writing`){i.current!==null&&(clearTimeout(i.current),i.current=null),r(!0);return}return i.current!==null&&clearTimeout(i.current),i.current=setTimeout(()=>{i.current=null,r(!1)},600),()=>{i.current!==null&&(clearTimeout(i.current),i.current=null)}},o=[e],t[0]=e,t[1]=a,t[2]=o),(0,Q.useEffect)(a,o),n}function mF(e){let t=(0,$.c)(33),{participant:n,crossDoc:r,scoped:i,onClickAgent:a}=e,{_:o}=vt(),{activeDocName:s}=Re(),{presence:c,agentId:l}=n,u=fF(c),d=pF(c.mode),f=!r&&d,p=c.currentDoc&&!yo(c.currentDoc)?c.currentDoc:null,m=s!==null||p!==null,h=m?`cursor-pointer`:`cursor-default opacity-50`,g=i?`ring-primary ring-offset-2 ring-offset-background`:`ring-background`,_=f&&!i?`ring-primary/40 animate-pulse`:``,v;t[0]!==h||t[1]!==g||t[2]!==_?(v=[`inline-flex size-7 shrink-0 items-center justify-center rounded-full ring-2`,h,g,_].filter(Boolean),t[0]=h,t[1]=g,t[2]=_,t[3]=v):v=t[3];let y=v.join(` `),b=r?`true`:void 0,x=i?`true`:void 0,S=m?void 0:`true`,C;t[4]!==c.mode||t[5]!==b||t[6]!==x||t[7]!==S?(C={"data-presence-badge":`agent`,"data-presence-mode":c.mode,"data-presence-crossdoc":b,"data-presence-scoped":x,"data-presence-inert":S},t[4]=c.mode,t[5]=b,t[6]=x,t[7]=S,t[8]=C):C=t[8];let w=C,T=o(r&&p?{id:`b4AQFK`,values:{tooltipName:u,realCurrentDoc:p}}:{id:`RfHNf8`,values:{tooltipName:u}}),E;t[9]!==l||t[10]!==T||t[11]!==w||t[12]!==m||t[13]!==a||t[14]!==c.color||t[15]!==c.icon||t[16]!==p||t[17]!==y||t[18]!==u?(E=m?(0,Z.jsx)(`button`,{type:`button`,...w,"aria-label":T,className:y,style:{backgroundColor:c.color},onClick:()=>a(l,p),children:(0,Z.jsx)(kd,{icon:c.icon,width:16,height:16,className:`text-white`,"aria-hidden":!0})}):(0,Z.jsx)(`div`,{...w,role:`img`,"aria-label":u,className:y,style:{backgroundColor:c.color},children:(0,Z.jsx)(kd,{icon:c.icon,width:16,height:16,className:`text-white`,"aria-hidden":!0})}),t[9]=l,t[10]=T,t[11]=w,t[12]=m,t[13]=a,t[14]=c.color,t[15]=c.icon,t[16]=p,t[17]=y,t[18]=u,t[19]=E):E=t[19];let D=E,O;t[20]===D?O=t[21]:(O=(0,Z.jsx)(ln,{asChild:!0,children:D}),t[20]=D,t[21]=O);let k;t[22]===u?k=t[23]:(k=(0,Z.jsx)(`span`,{className:`font-medium`,children:u}),t[22]=u,t[23]=k);let A;t[24]!==r||t[25]!==p?(A=r&&p?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(J,{id:`Wh0im4`,values:{realCurrentDoc:p}})}):null,t[24]=r,t[25]=p,t[26]=A):A=t[26];let j;t[27]!==k||t[28]!==A?(j=(0,Z.jsxs)(un,{className:`flex flex-col gap-0.5`,children:[k,A]}),t[27]=k,t[28]=A,t[29]=j):j=t[29];let M;return t[30]!==O||t[31]!==j?(M=(0,Z.jsxs)(fn,{children:[O,j]}),t[30]=O,t[31]=j,t[32]=M):M=t[32],M}function hF(e){let t=(0,$.c)(21),{count:n,remainder:r,crossDoc:i,scopedAgentId:a,onClickAgent:o}=e,s;t[0]!==n||t[1]!==i?(s=i?yl._({id:`9euN0m`,values:{count:n}}):yl._({id:`uhJEA2`,values:{count:n}}),t[0]=n,t[1]=i,t[2]=s):s=t[2];let c=s,l=i?`true`:void 0,u;t[3]!==n||t[4]!==c||t[5]!==l?(u=(0,Z.jsx)(Wt,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`presence-overflow`,"data-presence-crossdoc":l,className:`inline-flex size-7 shrink-0 cursor-pointer items-center justify-center rounded-full bg-muted font-medium text-muted-foreground text-xs ring-2 ring-background hover:bg-muted/80`,"aria-label":c,children:[`+`,n]})}),t[3]=n,t[4]=c,t[5]=l,t[6]=u):u=t[6];let d;if(t[7]!==i||t[8]!==o||t[9]!==r||t[10]!==a){let e;t[12]!==i||t[13]!==o||t[14]!==a?(e=e=>e.kind===`human`?(0,Z.jsx)(dF,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(mF,{participant:e,crossDoc:i,scoped:a===e.agentId,onClickAgent:o},e.agentId),t[12]=i,t[13]=o,t[14]=a,t[15]=e):e=t[15],d=r.map(e),t[7]=i,t[8]=o,t[9]=r,t[10]=a,t[11]=d}else d=t[11];let f;t[16]===d?f=t[17]:(f=(0,Z.jsx)(Yt,{align:`end`,className:`w-auto max-w-xs p-2`,children:(0,Z.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:d})}),t[16]=d,t[17]=f);let p;return t[18]!==u||t[19]!==f?(p=(0,Z.jsxs)(Ut,{children:[u,f]}),t[18]=u,t[19]=f,t[20]=p):p=t[20],p}function gF(e,t,n,r){return e.kind===`human`?(0,Z.jsx)(dF,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(mF,{participant:e,crossDoc:n,scoped:r===e.agentId,onClickAgent:t},e.agentId)}function _F(){let e=(0,$.c)(20),{activeProvider:t,activeDocName:n,systemProvider:r,openActivityPanel:i,docPanelMode:a,docPanelAgentId:o}=Re(),{current:s,crossDoc:c}=WP(t,r,n);if(aF(KT(t),n),s.length===0&&c.length===0)return null;let l;if(e[0]!==c||e[1]!==s||e[2]!==o||e[3]!==a||e[4]!==i){let t=s.slice(0,oF),n;e[6]===s?n=e[7]:(n=s.slice(oF),e[6]=s,e[7]=n);let r=n,u=c.slice(0,sF),d;e[8]===c?d=e[9]:(d=c.slice(sF),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=>gF(e,p,!1,m),e[10]=p,e[11]=m,e[12]=h):h=e[12];let g=t.map(h),_;e[13]!==r||e[14]!==p||e[15]!==m?(_=r.length>0?(0,Z.jsx)(hF,{count:r.length,remainder:r,crossDoc:!1,scopedAgentId:m,onClickAgent:p}):null,e[13]=r,e[14]=p,e[15]=m,e[16]=_):_=e[16];let v;e[17]!==g||e[18]!==_?(v=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,"data-presence-section":`current`,children:[g,_]}),e[17]=g,e[18]=_,e[19]=v):v=e[19],l=(0,Z.jsxs)(`div`,{"data-slot":`presence-bar`,className:`flex items-center px-1 py-1.5`,children:[v,c.length>0?(0,Z.jsxs)(`div`,{className:`ml-1.5 flex items-center gap-1.5`,"data-presence-section":`crossdoc`,children:[u.map(e=>gF(e,p,!0,m)),f.length>0?(0,Z.jsx)(hF,{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}function vF(){let e=(0,$.c)(4),[t,n]=(0,Q.useState)(null),r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=window.okDesktop;if(!e)return;let t=!1;return e.state.query().then(e=>{t||n(e.channel)}).catch(yF),()=>{t=!0}},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,Q.useEffect)(r,i);let a;return e[2]===t?a=e[3]:(a={channel:t},e[2]=t,e[3]=a),a}function yF(e){console.warn(`[use-update-channel] bridge.state.query() failed`,e)}function bF(e){let t=(0,$.c)(6),{className:n}=e,{_:r}=vt(),{channel:i}=vF();if(i!==`beta`)return null;let a;t[0]===r?a=t[1]:(a=r({id:`9fhQRL`}),t[0]=r,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(J,{id:`cSCbv3`}),t[2]=o):o=t[2];let s;return t[3]!==n||t[4]!==a?(s=(0,Z.jsx)(fu,{variant:`secondary`,"aria-label":a,"data-testid":`beta-badge`,className:n,children:o}),t[3]=n,t[4]=a,t[5]=s):s=t[5],s}function xF(e,t){return t.trim()}function SF(e){return![``,`.`,`..`].includes(e)&&!e.includes(`/`)&&!e.includes(`\\`)&&!e.includes(`\0`)}function CF(e,t){let n=xF(e.kind,t),r=e.path.split(`/`);return r[r.length-1]=n,r.join(`/`)}function wF(e,t,n=[],r=[],i=[]){if(t.length===0&&n.length===0&&r.length===0&&i.length===0)return e;let a=new Map(t.map(e=>[e.fromDocName,e.toDocName])),o=new Map(i.map(e=>[e.toDocName,e.docExt])),s=new Map(r.map(e=>[e.fromPath,e.toPath]));return e.map(e=>{if(Ml(e)){let t=s.get(gf(e.docName,e.docExt));if(t){let n=kl(t);return{kind:`asset`,path:t,assetExt:n,mediaKind:Ga(n),size:e.size,modified:e.modified,referencedBy:[]}}let n=a.get(e.docName)??e.docName;return{...e,docName:n,docExt:o.get(n)??e.docExt}}if(Hl(e))return{...e,path:jF(e.path,n)};if(Ul(e)){let t=s.get(e.path);return t&&Tl(t)?{kind:`document`,docName:tf(t),docExt:Dl(t),size:e.size,modified:e.modified}:{...e,path:t??jF(e.path,n)}}return e})}function TF(e,t,n,r=[]){if(t.length===0&&!n&&r.length===0)return e;let i=new Set(t),a=new Set(r);return e.filter(e=>Ml(e)?!i.has(e.docName)&&!FF(e.docName,n):Hl(e)?!FF(e.path,n):Ul(e)?!a.has(e.path)&&!FF(e.path,n):!0)}function EF(e,t){if(e.kind!==`asset`||t.some(t=>Ul(t)&&t.path===e.path))return e;let n=yf(e.path,t);return n?{...e,path:n,name:n.split(`/`).pop()??n}:e}function DF(e,t,n,r=new Date().toISOString()){let i=!1,a=[...e],o=e=>{a.some(t=>MF(t,e))||(a.push(e),i=!0)};if(n.kind===`file`){let s=e.find(e=>Ml(e)&&e.docName===t.path);return o({kind:`document`,docName:n.path,docExt:s?.docExt??t.docExt,size:s?.size??0,modified:r}),i?a:e}let s=e.find(e=>Hl(e)&&e.path===t.path);o({kind:`folder`,path:n.path,size:s?.size??0,modified:r});let c=new Set(n.duplicatedDocNames);for(let i of e){if(Ml(i)){let e=PF(i.docName,t.path,n.path);e&&c.has(e)&&o({...i,docName:e,modified:r});continue}if(Hl(i)){let e=NF(i.path,t.path,n.path);e&&o({...i,path:e,modified:r})}}return i?a:e}function OF(e,t){return e?t.find(t=>t.fromDocName===e)?.toDocName??e:null}function kF(e,t,n){return e.flatMap(e=>t===e.toDocName||!n(e.toDocName)?[e.fromDocName]:[e.fromDocName,e.toDocName])}function AF(e,t){let n=e.kind===`file`?gf(e.path,e.docExt):e.path;return sc(t.contentDir,n,t.pathSeparator)}function jF(e,t){for(let{fromPath:n,toPath:r}of t){if(e===n)return r;if(e.startsWith(`${n}/`))return`${r}${e.slice(n.length)}`}return e}function MF(e,t){return Ml(e)&&Ml(t)?e.docName===t.docName:Hl(e)&&Hl(t)||Ul(e)&&Ul(t)?e.path===t.path:!1}function NF(e,t,n){return e===t?n:PF(e,t,n)}function PF(e,t,n){return e.startsWith(`${t}/`)?`${n}${e.slice(t.length)}`:null}function FF(e,t){return!!t&&(e===t||e.startsWith(`${t}/`))}function IF(e){let t=(0,$.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,Z.jsx)(cm,{"data-slot":`context-menu`,...n}),t[2]=n,t[3]=r),r}function LF(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=$t(`select-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(lm,{"data-slot":`context-menu-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function RF(e){let t=(0,$.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,Z.jsx)(fm,{"data-slot":`context-menu-group`,...n}),t[2]=n,t[3]=r),r}function zF(e){let t=(0,$.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,Z.jsx)(vm,{"data-slot":`context-menu-sub`,...n}),t[2]=n,t[3]=r),r}function BF(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=$t(`z-50 max-h-(--radix-context-menu-content-available-height) min-w-36 origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 motion-reduce:data-open:animate-none motion-reduce:data-closed:animate-none motion-reduce:duration-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(um,{children:(0,Z.jsx)(dm,{"data-slot":`context-menu-content`,className:i,...r})}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function VF(e){let t=(0,$.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,inset:r,variant:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?`default`:a,s;t[5]===n?s=t[6]:(s=$t(`group/context-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 focus:*:[svg]:text-accent-foreground data-[variant=destructive]:*:[svg]:text-destructive`,n),t[5]=n,t[6]=s);let c;return t[7]!==r||t[8]!==i||t[9]!==s||t[10]!==o?(c=(0,Z.jsx)(mm,{"data-slot":`context-menu-item`,"data-inset":r,"data-variant":o,className:s,...i}),t[7]=r,t[8]=i,t[9]=s,t[10]=o,t[11]=c):c=t[11],c}function HF(e){let t=(0,$.c)(13),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,inset:i,children:n,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;t[5]===r?o=t[6]:(o=$t(`flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,r),t[5]=r,t[6]=o);let s;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(As,{className:`ml-auto`}),t[7]=s):s=t[7];let c;return t[8]!==n||t[9]!==i||t[10]!==a||t[11]!==o?(c=(0,Z.jsxs)(ym,{"data-slot":`context-menu-sub-trigger`,"data-inset":i,className:o,...a,children:[n,s]}),t[8]=n,t[9]=i,t[10]=a,t[11]=o,t[12]=c):c=t[12],c}function UF(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=$t(`z-50 max-h-(--radix-context-menu-content-available-height) min-w-32 origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg border bg-popover p-1 text-popover-foreground shadow-lg data-[state=closed]:overflow-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 motion-reduce:data-open:animate-none motion-reduce:data-closed:animate-none motion-reduce:duration-0 subtle-scrollbar`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(bm,{"data-slot":`context-menu-sub-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function WF(e){let t=(0,$.c)(15),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:i,children:r,checked:n,inset:a,...o}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s;t[6]===i?s=t[7]:(s=$t(`relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,i),t[6]=i,t[7]=s);let c;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(`span`,{className:`pointer-events-none absolute right-2`,children:(0,Z.jsx)(gm,{children:(0,Z.jsx)(Ds,{})})}),t[8]=c):c=t[8];let l;return t[9]!==n||t[10]!==r||t[11]!==a||t[12]!==o||t[13]!==s?(l=(0,Z.jsxs)(hm,{"data-slot":`context-menu-checkbox-item`,"data-inset":a,className:s,checked:n,...o,children:[c,r]}),t[9]=n,t[10]=r,t[11]=a,t[12]=o,t[13]=s,t[14]=l):l=t[14],l}function GF(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,inset:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=$t(`px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7`,n),t[4]=n,t[5]=a);let o;return t[6]!==r||t[7]!==i||t[8]!==a?(o=(0,Z.jsx)(pm,{"data-slot":`context-menu-label`,"data-inset":r,className:a,...i}),t[6]=r,t[7]=i,t[8]=a,t[9]=o):o=t[9],o}function KF(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=$t(`-mx-1 my-1 h-px bg-border`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(_m,{"data-slot":`context-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var qF=[`.md`,`.mdx`],JF=`group relative -mb-px flex h-10 min-w-28 max-w-64 shrink-0 cursor-pointer items-center overflow-hidden border border-transparent font-medium transition-colors`,YF=`z-10 rounded-t-lg rounded-b-none border-border border-b-0 bg-background text-foreground`,XF=$t(YF,`bg-transparent hover:bg-muted focus-visible:bg-muted border-transparent hover:border-border focus-visible:border-border`),ZF=`flex h-full min-w-0 flex-1 cursor-pointer items-center overflow-hidden px-3 text-left text-[13px]`;function QF(e){return e.replace(/[^A-Za-z0-9_-]/g,`-`)}function $F(e){let t=lu(e);window.location.hash!==t&&(window.location.hash=t)}function eI(e,t){let n=[t,...qF].filter((e,t,n)=>e&&n.indexOf(e)===t),r=e.toLowerCase(),i=n.find(t=>e.length>t.length&&r.endsWith(t.toLowerCase()));return i?e.slice(0,-i.length):e}function tI(e){return e.metaKey||e.ctrlKey}var nI=1e3;function rI(e,t){return e<0||e>=t?null:e<8?String(e+1):e===t-1?`9`:null}function iI(e,t){return rI(e,t)}function aI(e,t){let n=rI(e,t);if(n)return[`Meta+${n}`,`Control+${n}`].join(` `)}function oI(e,t){if(!tI(e)||e.altKey||e.shiftKey||!/^[1-9]$/.test(e.key))return null;let n=Number(e.key);if(n===9)return t>0?t-1:null;let r=n-1;return r<Math.min(8,t)?r:null}function sI(e){let t=(0,$.c)(3),{value:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=$t(Lc(!0),`font-mono tabular-nums hover:bg-transparent animate-in fade-in-0 zoom-in-95 duration-150 motion-reduce:animate-none motion-reduce:duration-0`),t[0]=r):r=t[0];let i=`⌘${n}`,a;return t[1]===i?a=t[2]:(a=(0,Z.jsx)(`span`,{"aria-hidden":`true`,"data-testid":`editor-tab-shortcut-hint`,className:r,children:(0,Z.jsx)(Oe,{className:`text-[10px]`,children:i})}),t[1]=i,t[2]=a),a}function cI(e){let t=(0,$.c)(37),n,r,i,a,o,s,c,l;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8]):({activateFromKeyboard:n,className:r,tabId:l,disabled:i,onKeyDown:a,ref:o,style:s,...c}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l);let u;t[9]!==i||t[10]!==l?(u={id:l,disabled:i},t[9]=i,t[10]=l,t[11]=u):u=t[11];let{attributes:d,listeners:f,rect:p,setNodeRef:m,transform:h,transition:g,isDragging:_}=Nd(u),v=p.current?.width,y;t[12]!==_||t[13]!==s||t[14]!==v||t[15]!==h||t[16]!==g?(y=kc({activeWidth:v,isDragging:_,outerStyle:s,transform:h,transition:g}),t[12]=_,t[13]=s,t[14]=v,t[15]=h,t[16]=g,t[17]=y):y=t[17];let b=y,x;t[18]!==o||t[19]!==m?(x=function(e){m(e),typeof o==`function`?o(e):o&&`current`in o&&(o.current=e)},t[18]=o,t[19]=m,t[20]=x):x=t[20];let S=x,C=f?.onKeyDown,w;t[21]!==n||t[22]!==_||t[23]!==a||t[24]!==C?(w=function(e){a?.(e);let t=Uc({event:e,hasKeyboardActivation:!!n,isDragging:_});if(t!==`ignore`){if(t===`activate-tab`&&n){e.preventDefault(),n();return}C?.(e)}},t[21]=n,t[22]=_,t[23]=a,t[24]=C,t[25]=w):w=t[25];let T=w,E;t[26]!==r||t[27]!==_?(E=Bc({className:r,isDragging:_}),t[26]=r,t[27]=_,t[28]=E):E=t[28];let D;return t[29]!==d||t[30]!==S||t[31]!==T||t[32]!==f||t[33]!==c||t[34]!==b||t[35]!==E?(D=(0,Z.jsx)(`div`,{ref:S,"data-editor-tab-sortable":``,className:E,style:b,...c,...d,...f,onKeyDown:T}),t[29]=d,t[30]=S,t[31]=T,t[32]=f,t[33]=c,t[34]=b,t[35]=E,t[36]=D):D=t[36],D}function lI(e){let t=(0,$.c)(52),{children:n,closeTab:r,closeTabs:a,canPin:o,disabled:s,openTabs:c,pinTab:l,pinnedTabIds:u,tabId:d,unpinTab:f}=e,p=o===void 0?!0:o;if(s!==void 0&&s)return n;let m;t[0]!==p||t[1]!==u||t[2]!==d?(m=p&&u.includes(d),t[0]=p,t[1]=u,t[2]=d,t[3]=m):m=t[3];let h=m,g;if(t[4]!==c||t[5]!==u||t[6]!==d){let e;t[8]===d?e=t[9]:(e=e=>e!==d,t[8]=d,t[9]=e),g=i(c.filter(e),u),t[4]=c,t[5]=u,t[6]=d,t[7]=g}else g=t[7];let _=g,v;t[10]!==c||t[11]!==u?(v=i(c,u),t[10]=c,t[11]=u,t[12]=v):v=t[12];let y=v,b;t[13]===n?b=t[14]:(b=(0,Z.jsx)(LF,{asChild:!0,children:n}),t[13]=n,t[14]=b);let x;t[15]!==r||t[16]!==d?(x=()=>r(d),t[15]=r,t[16]=d,t[17]=x):x=t[17];let S;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(J,{id:`yz7wBu`}),t[18]=S):S=t[18];let C;t[19]!==h||t[20]!==x?(C=(0,Z.jsx)(VF,{disabled:h,onSelect:x,children:S}),t[19]=h,t[20]=x,t[21]=C):C=t[21];let w=_.length===0,T;t[22]!==a||t[23]!==_?(T=()=>{a(_)},t[22]=a,t[23]=_,t[24]=T):T=t[24];let E;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Z.jsx)(J,{id:`omXJcU`}),t[25]=E):E=t[25];let D;t[26]!==w||t[27]!==T?(D=(0,Z.jsx)(VF,{disabled:w,onSelect:T,children:E}),t[26]=w,t[27]=T,t[28]=D):D=t[28];let O=y.length===0,k;t[29]!==y||t[30]!==a?(k=()=>{a(y)},t[29]=y,t[30]=a,t[31]=k):k=t[31];let A;t[32]===u.length?A=t[33]:(A=u.length?(0,Z.jsx)(J,{id:`U2Kx6T`}):(0,Z.jsx)(J,{id:`WyXG7w`}),t[32]=u.length,t[33]=A);let j;t[34]!==O||t[35]!==k||t[36]!==A?(j=(0,Z.jsx)(VF,{disabled:O,"data-testid":`editor-tab-context-close-all`,onSelect:k,children:A}),t[34]=O,t[35]=k,t[36]=A,t[37]=j):j=t[37];let M;t[38]!==p||t[39]!==h||t[40]!==l||t[41]!==d||t[42]!==f?(M=p&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(KF,{}),(0,Z.jsx)(VF,{"data-testid":`editor-tab-context-pin-toggle`,onSelect:()=>h?f(d):l(d),children:h?(0,Z.jsx)(J,{id:`SYfHmN`}):(0,Z.jsx)(J,{id:`3pU8e-`})})]}),t[38]=p,t[39]=h,t[40]=l,t[41]=d,t[42]=f,t[43]=M):M=t[43];let N;t[44]!==D||t[45]!==j||t[46]!==M||t[47]!==C?(N=(0,Z.jsxs)(BF,{className:`min-w-40`,children:[C,D,j,M]}),t[44]=D,t[45]=j,t[46]=M,t[47]=C,t[48]=N):N=t[48];let P;return t[49]!==N||t[50]!==b?(P=(0,Z.jsxs)(IF,{children:[b,N]}),t[49]=N,t[50]=b,t[51]=P):P=t[51],P}function uI(e){let t=(0,$.c)(28),{accessibleLabel:n,closeTab:r,forceCloseVisible:i,isActive:a,isPinned:o,shortcutHint:s,tabId:c,unpinTab:l}=e,u=i===void 0?!1:i,d=s===void 0?null:s,{_:f}=vt();if(d){let e;return t[0]===d?e=t[1]:(e=(0,Z.jsx)(sI,{value:d}),t[0]=d,t[1]=e),e}if(o){let e;t[2]!==f||t[3]!==n?(e=f({id:`t18QYR`,values:{accessibleLabel:n}}),t[2]=f,t[3]=n,t[4]=e):e=t[4];let r;t[5]!==c||t[6]!==l?(r=e=>{e.stopPropagation(),l(c)},t[5]=c,t[6]=l,t[7]=r):r=t[7];let i;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(bh,{"aria-hidden":`true`}),t[8]=i):i=t[8];let a;return t[9]!==e||t[10]!==r?(a=(0,Z.jsx)(Y,{variant:`ghost`,size:`icon-xs`,type:`button`,"aria-label":e,"data-testid":`editor-tab-unpin-button`,className:`mr-1.5 text-primary! hover:bg-primary/10!`,onClick:r,children:i}),t[9]=e,t[10]=r,t[11]=a):a=t[11],a}let p;t[12]!==f||t[13]!==n?(p=f({id:`JLzQi_`,values:{accessibleLabel:n}}),t[12]=f,t[13]=n,t[14]=p):p=t[14];let m=u||a,h;t[15]===m?h=t[16]:(h=Lc(m),t[15]=m,t[16]=h);let g;t[17]===a?g=t[18]:(g=Gc(a),t[17]=a,t[18]=g);let _;t[19]!==r||t[20]!==c?(_=e=>{e.stopPropagation(),r(c)},t[19]=r,t[20]=c,t[21]=_):_=t[21];let v;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(fl,{"aria-hidden":`true`}),t[22]=v):v=t[22];let y;return t[23]!==p||t[24]!==h||t[25]!==g||t[26]!==_?(y=(0,Z.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":p,"data-testid":`editor-tab-close-button`,className:h,tabIndex:g,onClick:_,children:v}),t[23]=p,t[24]=h,t[25]=g,t[26]=_,t[27]=y):y=t[27],y}function dI(e){let t=(0,$.c)(1),{hasConflict:n}=e;if(!n)return null;let r;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(sl,{"aria-hidden":`true`,"data-testid":`editor-tab-conflict-badge`,className:`mr-1 size-3.5 shrink-0 text-amber-500`}),t[0]=r):r=t[0],r}function fI(e){let t=(0,$.c)(27),{accessibleLabel:n,activateTab:r,baseName:i,docName:a,enterRenameMode:o,extension:s,hideDocExtension:c,tabId:l}=e,{_:u}=vt(),d=bT(a)===`conflict`,f;t[0]!==u||t[1]!==n||t[2]!==d?(f=d?u({id:`mVFyH-`,values:{accessibleLabel:n}}):n,t[0]=u,t[1]=n,t[2]=d,t[3]=f):f=t[3];let p=f,m;t[4]!==r||t[5]!==l?(m=()=>{r(l)},t[4]=r,t[5]=l,t[6]=m):m=t[6];let h;t[7]!==a||t[8]!==o||t[9]!==l?(h=e=>{e.preventDefault(),e.stopPropagation(),o(l,a)},t[7]=a,t[8]=o,t[9]=l,t[10]=h):h=t[10];let g;t[11]===d?g=t[12]:(g=(0,Z.jsx)(dI,{hasConflict:d}),t[11]=d,t[12]=g);let _;t[13]===i?_=t[14]:(_=(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:i}),t[13]=i,t[14]=_);let v;t[15]!==s||t[16]!==c?(v=!c&&(0,Z.jsx)(`span`,{className:`shrink-0`,children:s}),t[15]=s,t[16]=c,t[17]=v):v=t[17];let y;t[18]!==_||t[19]!==v?(y=(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center`,children:[_,v]}),t[18]=_,t[19]=v,t[20]=y):y=t[20];let b;return t[21]!==p||t[22]!==m||t[23]!==h||t[24]!==g||t[25]!==y?(b=(0,Z.jsxs)(`button`,{type:`button`,"aria-label":p,title:p,className:ZF,onClick:m,onDoubleClick:h,tabIndex:-1,children:[g,y]}),t[21]=p,t[22]=m,t[23]=h,t[24]=g,t[25]=y,t[26]=b):b=t[26],b}function pI(){let e=(0,$.c)(94),{activeDocName:t,activeTabId:n,activeNewTabId:r,activeTarget:i,activateTab:a,activateNewTab:o,closeAndClearForRename:s,closeNewTab:c,closeTab:l,closeTabs:u,getPoolActiveDocName:d,poolHas:f,isNewTabActive:p,newTabIds:m,openNewTab:h,openTabs:g,pinTab:_,pinnedTabIds:v,reopenClosedTab:y,remapTabsForRename:b,reorderTabs:x,unpinTab:S,visibleTabIds:C}=Re(),{_:w}=vt(),{pageMeta:T}=Ns(),E=(0,Q.useRef)(null),[D,O]=(0,Q.useState)(null),[k,j]=(0,Q.useState)(null),[M,N]=(0,Q.useState)(``),[I,L]=(0,Q.useState)(null),[R,z]=(0,Q.useState)(!1),[B,V]=(0,Q.useState)(!1),H=(0,Q.useRef)(null),U=(0,Q.useRef)(!1),W=(0,Q.useRef)(!1),ee=(0,Q.useRef)(null),G=(0,Q.useRef)(t),K=(0,Q.useRef)(null),te=(0,Q.useRef)(!1),ne=(0,Q.useRef)(!1),re;e[0]!==n||e[1]!==t||e[2]!==i?(re=n??(i?Ze(i):t?F(t):null),e[0]=n,e[1]=t,e[2]=i,e[3]=re):re=e[3];let ie=re,ae;e[4]!==r||e[5]!==ie||e[6]!==p||e[7]!==m||e[8]!==g?(ae=p?`${r??`__new-tab__`}\u0000${g.join(`\0`)}\u0000${m.join(`\0`)}`:ie?`${ie}\u0000${g.join(`\0`)}`:``,e[4]=r,e[5]=ie,e[6]=p,e[7]=m,e[8]=g,e[9]=ae):ae=e[9];let oe=ae,se,ce;e[10]===t?(se=e[11],ce=e[12]):(se=()=>{G.current=t},ce=[t],e[10]=t,e[11]=se,e[12]=ce),(0,Q.useEffect)(se,ce);let le,ue;e[13]===Symbol.for(`react.memo_cache_sentinel`)?(le=()=>()=>{K.current!==null&&(window.clearTimeout(K.current),K.current=null)},ue=[],e[13]=le,e[14]=ue):(le=e[13],ue=e[14]),(0,Q.useEffect)(le,ue);let de,fe;e[15]===oe?(de=e[16],fe=e[17]):(de=()=>{oe&&(E.current?.querySelector(`[data-active-tab="true"]`))?.scrollIntoView({block:`nearest`,inline:`nearest`})},fe=[oe],e[15]=oe,e[16]=de,e[17]=fe),(0,Q.useEffect)(de,fe);let q,me;e[18]===k?(q=e[19],me=e[20]):(q=()=>{k&&(H.current?.focus(),H.current?.select())},me=[k],e[18]=k,e[19]=q,e[20]=me),(0,Q.useEffect)(q,me);let he,ge;e[21]!==g||e[22]!==k?(he=()=>{!k||g.includes(k.tabId)||(W.current=!0,ee.current=null,j(null),N(``),L(null),z(!1))},ge=[g,k],e[21]=g,e[22]=k,e[23]=he,e[24]=ge):(he=e[23],ge=e[24]),(0,Q.useEffect)(he,ge);let _e;e[25]===Symbol.for(`react.memo_cache_sentinel`)?(_e=function(e,t){let n=t.split(`/`);W.current=!1,ee.current=null,j({docName:t,tabId:e}),N(n[n.length-1]),L(null)},e[25]=_e):_e=e[25];let ve=_e,ye=function(){W.current=!0,ee.current=null,j(null),N(``),L(null),z(!1)},be=async function(){if(W.current){W.current=!1;return}if(U.current)return;let e=k?.docName;if(!e){ye();return}let t=xF(`file`,eI(M,T.get(e)?.docExt??`.md`)),n=e.split(`/`),r=n[n.length-1];if(t===r){ye();return}if(t===ee.current){H.current?.focus();return}if(!SF(t)){L(w({id:`P8yDjG`})),H.current?.focus();return}let i=CF({kind:`file`,path:e,name:r},t);U.current=!0,z(!0),L(null);try{let n=await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:`file`,fromPath:e,toPath:i})});if(W.current){z(!1),U.current=!1;return}let r=await A(n,`Server error (HTTP ${n.status})`);if(!r.ok){L(r.title),z(!1),U.current=!1,ee.current=t,H.current?.focus();return}let a=P(Ua,r.body,`rename-path:tab`,{renamed:[],renamedAssets:[]}).renamed,o=G.current,c=OF(o,a);pe(a);let l=!0;try{let e=kF(a,d(),f);await Promise.all(e.map(e=>s(e))),b(a),Kl([`files`,`backlinks`,`graph`])}catch(n){let r=n;l=!1,console.warn(`[EditorTabs] post-rename reconciliation failed`,{err:r,docName:e,newDocName:i,normalized:t}),X.error(w({id:`MUBR8r`}))}W.current=!0,j(null),N(``),L(null),z(!1),U.current=!1,ee.current=null,l&&c&&c!==o&&$F(c)}catch(n){console.warn(`[EditorTabs] rename failed`,{err:n,docName:e,newDocName:i,normalized:t}),L(w({id:`HIb0vl`})),z(!1),U.current=!1,ee.current=t,H.current?.focus()}},xe=typeof window<`u`&&window.okDesktop!=null,Se;e[26]===m?Se=e[27]:(Se=new Set(m),e[26]=m,e[27]=Se);let Ce=Se,we;e[28]===D?we=e[29]:(we=Oc(D),e[28]=D,e[29]=we);let Te;e[30]===we?Te=e[31]:(Te=[we],e[30]=we,e[31]=Te);let Ee=Te,Oe;e[32]!==c||e[33]!==u||e[34]!==Ce?(Oe=function(e){let t=[],n=[];for(let r of e)Ce.has(r)?n.push(r):t.push(r);t.length>0&&u(t);for(let e of n)c(e)},e[32]=c,e[33]=u,e[34]=Ce,e[35]=Oe):Oe=e[35];let ke=Oe,Ae,je;e[36]!==o||e[37]!==a||e[38]!==r||e[39]!==ie||e[40]!==p||e[41]!==m||e[42]!==h||e[43]!==y||e[44]!==C?(Ae=()=>{let e=new Set(m),t=function(){K.current!==null&&(window.clearTimeout(K.current),K.current=null)},n=function(e){te.current!==e&&(te.current=e)},i=function(e){ne.current!==e&&(ne.current=e,V(e))},s=function(){n(!0),!(ne.current||K.current!==null)&&(K.current=window.setTimeout(()=>{K.current=null,te.current&&i(!0)},nI))},c=function(){t(),n(!1),i(!1)},l=function(t){e.has(t)?o(t):a(t)},u=function(e){if(C.length===0)return;let t=p?r:ie,n=t?C.indexOf(t):-1;l(C[((n>=0?n:0)+e+C.length)%C.length])},d=function(e){if(tI(e)&&s(),Sl(e,`tab-new`)){e.preventDefault(),h();return}if(Sl(e,`tab-reopen-closed`)){e.preventDefault(),y();return}if(Sl(e,`tab-next`)){e.preventDefault(),u(1);return}if(Sl(e,`tab-previous`)){e.preventDefault(),u(-1);return}let t=oI(e,C.length);t!==null&&(e.preventDefault(),l(C[t]))},f=function(e){!e.metaKey&&!e.ctrlKey&&c()};return window.addEventListener(`keydown`,d,{capture:!0}),window.addEventListener(`keyup`,f,{capture:!0}),window.addEventListener(`blur`,c),document.addEventListener(`visibilitychange`,c),()=>{window.removeEventListener(`keydown`,d,{capture:!0}),window.removeEventListener(`keyup`,f,{capture:!0}),window.removeEventListener(`blur`,c),document.removeEventListener(`visibilitychange`,c)}},je=[r,ie,o,a,p,m,h,y,C],e[36]=o,e[37]=a,e[38]=r,e[39]=ie,e[40]=p,e[41]=m,e[42]=h,e[43]=y,e[44]=C,e[45]=Ae,e[46]=je):(Ae=e[45],je=e[46]),(0,Q.useEffect)(Ae,je);let Me;e[47]===Symbol.for(`react.memo_cache_sentinel`)?(Me={activationConstraint:{distance:8}},e[47]=Me):Me=e[47];let Ne;e[48]===Symbol.for(`react.memo_cache_sentinel`)?(Ne={coordinateGetter:Fd,keyboardCodes:Pc},e[48]=Ne):Ne=e[48];let Pe=Rd(Pd(Hd,Me),Pd(Id,Ne)),Fe=B,Ie;e[49]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=function(){O(Ac(E.current,`[data-editor-tab-sortable]`))},e[49]=Ie):Ie=e[49];let Le=Ie,ze;e[50]===Symbol.for(`react.memo_cache_sentinel`)?(ze=function(){O(null)},e[50]=ze):ze=e[50];let Be=ze,Ve;e[51]!==Be||e[52]!==x||e[53]!==C?(Ve=function(e){Be();let t=String(e.active.id),n=e.over?String(e.over.id):null;if(!n||t===n)return;let r=C.indexOf(t),i=C.indexOf(n);r<0||i<0||r===i||x(Ld([...C],r,i),t)},e[51]=Be,e[52]=x,e[53]=C,e[54]=Ve):Ve=e[54];let He=Ve,Ue=xe?``:void 0,We;e[55]===Symbol.for(`react.memo_cache_sentinel`)?(We=$t(`pl-2 flex h-12 min-w-0 touch-manipulation flex-1 items-end overflow-x-auto overflow-y-hidden overscroll-x-contain scroll-fade-mask-x [scrollbar-width:none]`,xe&&`[-webkit-app-region:drag]`),e[55]=We):We=e[55];let Ge=Hc,Ke;e[56]===Symbol.for(`react.memo_cache_sentinel`)?(Ke=$t(`flex items-end gap-1`,xe&&`[-webkit-app-region:no-drag]`),e[56]=Ke):Ke=e[56];let qe=Bd,Je=jc,Ye;e[57]===Symbol.for(`react.memo_cache_sentinel`)?(Ye={container:typeof document<`u`?document.body:void 0},e[57]=Ye):Ye=e[57];let Xe=Vd,Qe;e[58]===C?Qe=e[59]:(Qe=[...C],e[58]=C,e[59]=Qe);let $e=zd,et=C.map((e,t)=>{let n=B?iI(t,C.length):null,i=aI(t,C.length);if(Ce.has(e)){let t=e===r;return(0,Z.jsx)(lI,{tabId:e,canPin:!1,openTabs:C,closeTab:c,closeTabs:ke,pinTab:_,pinnedTabIds:v,unpinTab:S,children:(0,Z.jsxs)(cI,{tabId:e,activateFromKeyboard:()=>o(e),"aria-current":t?`page`:void 0,"aria-keyshortcuts":i,"data-active-tab":t?`true`:void 0,className:$t(JF,t?YF:XF),onAuxClick:t=>{t.button===1&&(t.preventDefault(),c(e))},onClick:t=>{t.target===t.currentTarget&&o(e)},children:[(0,Z.jsx)(`button`,{type:`button`,"aria-label":w({id:`zLak8b`}),"data-testid":`editor-new-tab-placeholder-button`,className:ZF,onClick:()=>o(e),tabIndex:-1,children:(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:(0,Z.jsx)(J,{id:`3YvS-c`})})}),n?(0,Z.jsx)(sI,{value:n}):(0,Z.jsx)(`button`,{type:`button`,"aria-label":w({id:`xCdTnb`}),"data-testid":`editor-new-tab-placeholder-close`,className:Lc(Fe||t),tabIndex:Gc(t),onClick:t=>{t.stopPropagation(),c(e)},children:(0,Z.jsx)(fl,{"aria-hidden":`true`,className:`size-3.5`})})]})},e)}let s=rt(e),u=e===ie,d=v.includes(e);if(s.kind===`folder`){let{baseName:t,label:r,prefix:o}=De(s.folderPath,`/`),c=`${o}${r}`;return(0,Z.jsx)(lI,{tabId:e,openTabs:C,closeTab:l,closeTabs:ke,pinTab:_,pinnedTabIds:v,unpinTab:S,children:(0,Z.jsxs)(cI,{tabId:e,activateFromKeyboard:()=>a(e),"aria-current":u?`page`:void 0,"aria-keyshortcuts":i,"data-active-tab":u?`true`:void 0,className:$t(JF,u?YF:XF),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!d&&l(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":c,title:c,className:ZF,onClick:()=>{a(e)},tabIndex:-1,children:[o&&(0,Z.jsx)(`span`,{className:$t(`min-w-0 flex-1 truncate`,u&&`text-muted-foreground`),children:o}),(0,Z.jsxs)(`span`,{className:$t(`flex min-w-0 items-center`,o?`max-w-[70%] shrink-0`:`flex-1`),children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:t}),(0,Z.jsx)(`span`,{className:`shrink-0`,children:`/`})]})]}),(0,Z.jsx)(uI,{accessibleLabel:c,closeTab:l,forceCloseVisible:Fe,isActive:u,isPinned:d,shortcutHint:n,tabId:e,unpinTab:S})]})},e)}if(s.kind===`asset`||s.kind===`skill-file`){let{baseName:t,label:r,prefix:o}=De(s.kind===`asset`?s.assetPath:s.path,``),c=`${o}${r}`;return(0,Z.jsx)(lI,{tabId:e,openTabs:C,closeTab:l,closeTabs:ke,pinTab:_,pinnedTabIds:v,unpinTab:S,children:(0,Z.jsxs)(cI,{tabId:e,activateFromKeyboard:()=>a(e),"aria-current":u?`page`:void 0,"aria-keyshortcuts":i,"data-active-tab":u?`true`:void 0,className:$t(JF,u?YF:XF),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!d&&l(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":c,className:ZF,onClick:()=>{a(e)},tabIndex:-1,children:[o?(0,Z.jsx)(`span`,{className:$t(`min-w-0 flex-1 truncate text-muted-foreground/60`,u&&`text-muted-foreground`),children:o}):null,(0,Z.jsx)(`span`,{className:$t(`min-w-0 truncate`,o?`max-w-[70%] shrink-0`:`flex-1`),children:t})]}),(0,Z.jsx)(uI,{accessibleLabel:c,closeTab:l,forceCloseVisible:Fe,isActive:u,isPinned:d,shortcutHint:n,tabId:e,unpinTab:S})]})},e)}let f=s.docName,p=T.get(f)?.docExt??`.md`,{baseName:m,extension:h,label:g,prefix:y}=De(f,p),b=`${y}${g}`,x=p===`.md`||p===`.mdx`,E=k?.tabId===e,D=`editor-tab-rename-error-${QF(f)}`;return(0,Z.jsx)(lI,{disabled:E,tabId:e,openTabs:C,closeTab:l,closeTabs:ke,pinTab:_,pinnedTabIds:v,unpinTab:S,children:(0,Z.jsx)(cI,{tabId:e,activateFromKeyboard:()=>a(e),disabled:E,"aria-current":u?`page`:void 0,"aria-keyshortcuts":i,"data-active-tab":u?`true`:void 0,className:$t(JF,u?YF:XF,E&&I&&`border-destructive`),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!d&&l(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:E?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Vc,{className:`h-full min-w-0 flex-1 rounded-none border-0 bg-transparent dark:bg-transparent`,children:[(0,Z.jsx)(Nc,{ref:H,value:M,disabled:R,"aria-label":w({id:`Dw1T_W`,values:{label:g}}),"data-testid":`editor-tab-rename-input`,"aria-invalid":I?!0:void 0,"aria-describedby":I?D:void 0,"aria-busy":R||void 0,title:I??f,className:`h-full min-w-0 px-2 py-0 font-medium text-foreground text-xs selection:bg-primary selection:text-primary-foreground`,onChange:e=>{N(eI(e.target.value,p)),L(null),ee.current=null},onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),be()):e.key===`Escape`&&(e.preventDefault(),ye())},onBlur:be}),(0,Z.jsx)(Rc,{align:`inline-end`,"aria-hidden":`true`,className:`pr-2 text-xs`,children:(0,Z.jsx)(Mc,{className:`text-muted-foreground/60 text-xs`,children:p})})]}),I?(0,Z.jsx)(`span`,{id:D,role:`alert`,className:`sr-only`,children:I}):null]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(fI,{accessibleLabel:b,activateTab:a,baseName:m,docName:f,enterRenameMode:ve,extension:h,hideDocExtension:x,tabId:e}),(0,Z.jsx)(uI,{accessibleLabel:b,closeTab:l,forceCloseVisible:Fe,isActive:u,isPinned:d,shortcutHint:n,tabId:e,unpinTab:S})]})})},e)}),tt;e[60]!==Xe||e[61]!==Qe||e[62]!==$e||e[63]!==et?(tt=(0,Z.jsx)(Xe,{items:Qe,strategy:$e,children:et}),e[60]=Xe,e[61]=Qe,e[62]=$e,e[63]=et,e[64]=tt):tt=e[64];let nt;e[65]!==qe||e[66]!==Be||e[67]!==He||e[68]!==Le||e[69]!==Pe||e[70]!==!1||e[71]!==Je||e[72]!==Ye||e[73]!==tt||e[74]!==Ee?(nt=(0,Z.jsx)(qe,{sensors:Pe,autoScroll:!1,collisionDetection:Je,modifiers:Ee,onDragStart:Le,onDragEnd:He,onDragCancel:Be,accessibility:Ye,children:tt}),e[65]=qe,e[66]=Be,e[67]=He,e[68]=Le,e[69]=Pe,e[70]=!1,e[71]=Je,e[72]=Ye,e[73]=tt,e[74]=Ee,e[75]=nt):nt=e[75];let it;e[76]===w?it=e[77]:(it=w({id:`3YvS-c`}),e[76]=w,e[77]=it);let at;e[78]===Symbol.for(`react.memo_cache_sentinel`)?(at=(0,Z.jsx)(Kt,{"aria-hidden":`true`}),e[78]=at):at=e[78];let ot;e[79]!==h||e[80]!==it?(ot=(0,Z.jsx)(ln,{asChild:!0,children:(0,Z.jsx)(Y,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":it,"data-testid":`editor-new-tab-button`,className:`first:mb-3 mb-1.5`,onClick:h,children:at})}),e[79]=h,e[80]=it,e[81]=ot):ot=e[81];let st;e[82]===Symbol.for(`react.memo_cache_sentinel`)?(st=(0,Z.jsx)(un,{children:(0,Z.jsx)(J,{id:`3YvS-c`})}),e[82]=st):st=e[82];let ct;e[83]===ot?ct=e[84]:(ct=(0,Z.jsxs)(fn,{children:[ot,st]}),e[83]=ot,e[84]=ct);let lt;e[85]!==Ke||e[86]!==nt||e[87]!==ct?(lt=(0,Z.jsxs)(`div`,{className:Ke,children:[nt,ct]}),e[85]=Ke,e[86]=nt,e[87]=ct,e[88]=lt):lt=e[88];let ut;return e[89]!==Ue||e[90]!==We||e[91]!==Ge||e[92]!==lt?(ut=(0,Z.jsx)(`div`,{ref:E,"data-electron-drag":Ue,className:We,onWheel:Ge,children:lt}),e[89]=Ue,e[90]=We,e[91]=Ge,e[92]=lt,e[93]=ut):ut=e[93],ut}var mI=`https://openknowledge.ai/api/subscribe`;async function hI(e,t){try{let n=await fetch(mI,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({email:e,source:t}),signal:AbortSignal.timeout(15e3)});return n.ok?{ok:!0}:n.status===400?{ok:!1,reason:`invalid`}:n.status===503?{ok:!1,reason:`unavailable`}:(console.warn(`[subscribe] action=submit result=http-error status=${n.status}`),{ok:!1,reason:`error`})}catch(e){return console.warn(`[subscribe] action=submit result=network-error message=${e instanceof Error?e.message:String(e)}`),{ok:!1,reason:`error`}}}function gI(e){let t=(0,$.c)(49),{source:n,title:r,description:i,onSuccess:a,onDismiss:o,autoFocus:s,compactSubmit:c,className:l}=e,{_:u}=vt(),[d,f]=(0,Q.useState)(!1),p=(0,Q.useRef)(null),m,h;t[0]===d?(m=t[1],h=t[2]):(m=()=>{d&&p.current?.focus()},h=[d],t[0]=d,t[1]=m,t[2]=h),(0,Q.useEffect)(m,h);let g,_;if(t[3]!==u){let e=ha({email:Aa({message:u({id:`Wq6Wcm`})})});_=Ef,g=Of(e),t[3]=u,t[4]=g,t[5]=_}else g=t[4],_=t[5];let v;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(v={email:``},t[6]=v):v=t[6];let y;t[7]===g?y=t[8]:(y={resolver:g,defaultValues:v},t[7]=g,t[8]=y);let b=_(y),{isSubmitting:x}=b.formState,S=b.formState.errors.email?.message??b.formState.errors.root?.message,C;t[9]!==u||t[10]!==b||t[11]!==a||t[12]!==n?(C=async function(e){b.clearErrors(`root`);let t=await hI(e.email,n);if(t.ok){f(!0),a?.();return}if(t.reason===`invalid`){b.setError(`email`,{message:u({id:`Wq6Wcm`})});return}if(t.reason===`unavailable`){b.setError(`root`,{message:u({id:`4mLBx9`})});return}b.setError(`root`,{message:u({id:`fWsBTs`})})},t[9]=u,t[10]=b,t[11]=a,t[12]=n,t[13]=C):C=t[13];let w=C,T;t[14]===l?T=t[15]:(T=$t(`flex flex-col gap-3`,l),t[14]=l,t[15]=T);let E=d?-1:void 0,D;t[16]!==d||t[17]!==r?(D=d?(0,Z.jsxs)(`span`,{className:`mb-1.5 inline-flex flex-row items-center gap-2`,children:[(0,Z.jsx)(Ds,{className:`size-4 text-primary`}),(0,Z.jsx)(J,{id:`PIMM5l`})]}):r??(0,Z.jsx)(J,{id:`GzPQ2f`}),t[16]=d,t[17]=r,t[18]=D):D=t[18];let O;t[19]!==D||t[20]!==E?(O=(0,Z.jsx)(`p`,{ref:p,tabIndex:E,className:`text-sm font-medium leading-tight text-foreground focus:outline-none`,children:D}),t[19]=D,t[20]=E,t[21]=O):O=t[21];let k;t[22]!==i||t[23]!==d?(k=d?(0,Z.jsx)(J,{id:`pBROkv`}):i??(0,Z.jsx)(J,{id:`WmPbvm`}),t[22]=i,t[23]=d,t[24]=k):k=t[24];let A;t[25]===k?A=t[26]:(A=(0,Z.jsx)(`p`,{className:`text-1sm text-muted-foreground`,role:`status`,children:k}),t[25]=k,t[26]=A);let j;t[27]!==O||t[28]!==A?(j=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[O,A]}),t[27]=O,t[28]=A,t[29]=j):j=t[29];let M;t[30]!==u||t[31]!==o?(M=o?(0,Z.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon`,onClick:o,"aria-label":u({id:`yz7wBu`}),className:`-mr-1.5 -mt-1 size-7 shrink-0 text-muted-foreground opacity-60`,children:(0,Z.jsx)(fl,{className:`size-4`})}):null,t[30]=u,t[31]=o,t[32]=M):M=t[32];let N;t[33]!==j||t[34]!==M?(N=(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[j,M]}),t[33]=j,t[34]=M,t[35]=N):N=t[35];let P;t[36]!==u||t[37]!==s||t[38]!==c||t[39]!==S||t[40]!==b||t[41]!==x||t[42]!==w||t[43]!==d?(P=d?null:(0,Z.jsxs)(`form`,{onSubmit:b.handleSubmit(w),className:`flex flex-col gap-2`,noValidate:!0,children:[(0,Z.jsx)(Df,{control:b.control,name:`email`,render:e=>{let{field:t,fieldState:n}=e;return(0,Z.jsxs)(Vc,{className:`h-10 rounded-xl`,children:[(0,Z.jsx)(Rc,{className:`pl-2.5`,children:(0,Z.jsx)(dh,{className:`size-4 text-muted-foreground opacity-60`})}),(0,Z.jsx)(Nc,{...t,id:t.name,type:`email`,inputMode:`email`,autoComplete:`email`,spellCheck:!1,autoFocus:s,placeholder:u({id:`2hYmUH`}),"aria-invalid":n.invalid,"aria-label":u({id:`ATGYL1`}),"data-testid":`subscribe-email`,className:`placeholder:text-muted-foreground/60`}),(0,Z.jsx)(Y,{type:`submit`,disabled:x,size:c?`icon`:`default`,className:$t(`mr-1 ml-auto text-1sm`,c&&`size-8 shrink-0 rounded-lg`),"data-testid":`subscribe-submit`,children:x?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Zc,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`lCC_D5`})})]}):c?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ln,{className:`size-4`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`EDl9kS`})})]}):(0,Z.jsx)(J,{id:`EDl9kS`})})]})}}),S?(0,Z.jsx)(`p`,{className:`text-sm text-destructive`,role:`alert`,children:S}):null]}),t[36]=u,t[37]=s,t[38]=c,t[39]=S,t[40]=b,t[41]=x,t[42]=w,t[43]=d,t[44]=P):P=t[44];let F;return t[45]!==N||t[46]!==P||t[47]!==T?(F=(0,Z.jsxs)(`div`,{className:T,children:[N,P]}),t[45]=N,t[46]=P,t[47]=T,t[48]=F):F=t[48],F}var _I=`https://github.com/inkeep/open-knowledge`,vI=`https://discord.gg/VRKk2EaGHN`,yI=`https://x.com/OpenKnowledge`,bI=`ok-subscribe-card-v1`,xI={subscribed:!1,dismissed:!1,shownVersions:[]};function SI(e,t){return!e.subscribed&&!e.dismissed&&e.shownVersions.length<3&&!e.shownVersions.includes(t)}function CI(e){return e===!0}function wI(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function TI(e){if(typeof e!=`object`||!e)return xI;let t=e;return{subscribed:CI(t.subscribed),dismissed:CI(t.dismissed),shownVersions:wI(t.shownVersions)}}function EI(e){try{let t=(e??localStorage).getItem(bI);return t==null?xI:TI(JSON.parse(t))}catch(e){return console.warn(`[subscribe-card-store] readPersistedState failed (corrupt/privacy/SSR)`,e),xI}}function DI(e,t){try{(t??localStorage).setItem(bI,JSON.stringify(e))}catch(e){console.warn(`[subscribe-card-store] writePersistedState failed (quota/privacy/SSR)`,e)}}function OI(e){let t=EI(e),n=new Set,r=!1;function i(){for(let e of n)e()}function a(n){t=n,DI(t,e),i()}return{getSnapshot(){return t},subscribe(e){return n.add(e),()=>{n.delete(e)}},markSubscribed(){t.subscribed||a({...t,subscribed:!0})},dismiss(){t.dismissed||a({...t,dismissed:!0})},recordShown(e){t.shownVersions.includes(e)||a({...t,shownVersions:[...t.shownVersions,e]})},install(){r||(r=!0,t=EI(e),i())}}}var kI=OI();function AI(){kI.install()}var jI=(0,Q.lazy)(()=>n(()=>import(`./FeedbackForm-DH4DaXLD.js`).then(e=>({default:e.FeedbackForm})),__vite__mapDeps([142,1,6,2,3,7,8,9,143,122,12,10,11,13,14,15,16,17,18,19,20,21,22,39,40,41,25,28,88,26,90,123,107,33,34,74]),import.meta.url)),MI=e=>{let t=(0,$.c)(10),{open:n,onOpenChange:r,source:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(xn,{children:(0,Z.jsx)(_n,{children:(0,Z.jsx)(J,{id:`SItQRc`})})}),t[0]=a):a=t[0];let o;t[1]===r?o=t[2]:(o=()=>r(!1),t[1]=r,t[2]=o);let s;t[3]!==i||t[4]!==o?(s=(0,Z.jsxs)(vn,{children:[a,(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(jI,{source:i,onSuccess:o})})]}),t[3]=i,t[4]=o,t[5]=s):s=t[5];let c;return t[6]!==r||t[7]!==n||t[8]!==s?(c=(0,Z.jsx)(Sn,{open:n,onOpenChange:r,children:s}),t[6]=r,t[7]=n,t[8]=s,t[9]=c):c=t[9],c};function NI(e){let t=(0,$.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`Discord`}),r=(0,Z.jsx)(`path`,{d:`M20.317 4.3698a19.7913 19.7913 0 00-4.8851-1.5152.0741.0741 0 00-.0785.0371c-.211.3753-.4447.8648-.6083 1.2495-1.8447-.2762-3.68-.2762-5.4868 0-.1636-.3933-.4058-.8742-.6177-1.2495a.077.077 0 00-.0785-.037 19.7363 19.7363 0 00-4.8852 1.515.0699.0699 0 00-.0321.0277C.5334 9.0458-.319 13.5799.0992 18.0578a.0824.0824 0 00.0312.0561c2.0528 1.5076 4.0413 2.4228 5.9929 3.0294a.0777.0777 0 00.0842-.0276c.4616-.6304.8731-1.2952 1.226-1.9942a.076.076 0 00-.0416-.1057c-.6528-.2476-1.2743-.5495-1.8722-.8923a.077.077 0 01-.0076-.1277c.1258-.0943.2517-.1923.3718-.2914a.0743.0743 0 01.0776-.0105c3.9278 1.7933 8.18 1.7933 12.0614 0a.0739.0739 0 01.0785.0095c.1202.099.246.1981.3728.2924a.077.077 0 01-.0066.1276 12.2986 12.2986 0 01-1.873.8914.0766.0766 0 00-.0407.1067c.3604.698.7719 1.3628 1.225 1.9932a.076.076 0 00.0842.0286c1.961-.6067 3.9495-1.5219 6.0023-3.0294a.077.077 0 00.0313-.0552c.5004-5.177-.8382-9.6739-3.5485-13.6604a.061.061 0 00-.0312-.0286zM8.02 15.3312c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9555-2.4189 2.157-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9555 2.4189-2.1569 2.4189zm7.9748 0c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9554-2.4189 2.1569-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9554 2.4189-2.1568 2.4189Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,Z.jsxs)(`svg`,{role:`img`,fill:`currentColor`,height:24,width:24,viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[n,r]}),t[2]=e,t[3]=i),i}function PI(e){let t=(0,$.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`X (Twitter)`}),r=(0,Z.jsx)(`path`,{d:`M18.901 1.153h3.68l-8.04 9.19L24 22.846h-7.406l-5.8-7.584-6.638 7.584H.474l8.6-9.83L0 1.154h7.594l5.243 6.932ZM17.61 20.644h2.039L6.486 3.24H4.298Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,Z.jsxs)(`svg`,{role:`img`,fill:`currentColor`,height:24,width:24,viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[n,r]}),t[2]=e,t[3]=i),i}var FI=[{key:`resources`,heading:{id:`s-MGs7`},links:[{label:{id:`TbjyhA`},href:`https://openknowledge.ai/docs`,icon:ut}]},{key:`community`,heading:{id:`chL5IG`},links:[{label:`Discord`,href:vI,icon:NI},{label:`X (Twitter)`,href:yI,icon:PI},{label:`GitHub`,href:_I,icon:pg}]}],II=`${_I}/releases`,LI=`group 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`;function RI(e){if(e<1e3)return String(e);let t=e/1e3;return`${t>=10?Math.round(t):t.toFixed(1)}k`}var zI=e=>{let t=(0,$.c)(12),{count:n}=e,{_:r}=vt(),i,a,o,s;t[0]!==r||t[1]!==n?(i=RI(n),a=`img`,o=`ml-auto flex items-center gap-1 text-xs tabular-nums text-muted-foreground`,s=r({id:`SVLPt5`,values:{formatted:i}}),t[0]=r,t[1]=n,t[2]=i,t[3]=a,t[4]=o,t[5]=s):(i=t[2],a=t[3],o=t[4],s=t[5]);let c;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(Mh,{className:`size-3 fill-current`,"aria-hidden":`true`}),t[6]=c):c=t[6];let l;return t[7]!==i||t[8]!==a||t[9]!==o||t[10]!==s?(l=(0,Z.jsxs)(`span`,{role:a,className:o,"aria-label":s,children:[c,i]}),t[7]=i,t[8]=a,t[9]=o,t[10]=s,t[11]=l):l=t[11],l},BI=e=>{let t=(0,$.c)(15),{link:n,trailing:r}=e,{_:i}=vt(),{label:a,href:o,icon:s}=n,c,l;t[0]===o?(c=t[1],l=t[2]):(c=e=>Wu(e,o),l=e=>Wu(e,o),t[0]=o,t[1]=c,t[2]=l);let u;t[3]===s?u=t[4]:(u=(0,Z.jsx)(s,{"aria-hidden":`true`,className:`size-4 shrink-0`}),t[3]=s,t[4]=u);let d;t[5]!==i||t[6]!==a?(d=typeof a==`string`?a:i(a),t[5]=i,t[6]=a,t[7]=d):d=t[7];let f;return t[8]!==o||t[9]!==c||t[10]!==l||t[11]!==u||t[12]!==d||t[13]!==r?(f=(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`a`,{href:o,target:`_blank`,rel:`noopener noreferrer`,onClick:c,onAuxClick:l,className:LI,children:[u,d,r]})}),t[8]=o,t[9]=c,t[10]=l,t[11]=u,t[12]=d,t[13]=r,t[14]=f):f=t[14],f},VI=e=>{let t=(0,$.c)(7),{icon:n,onSelect:r,children:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=$t(LI,`h-auto w-full justify-start font-normal`),t[0]=a):a=t[0];let o;t[1]===n?o=t[2]:(o=(0,Z.jsx)(n,{"aria-hidden":`true`,className:`size-4 shrink-0`}),t[1]=n,t[2]=o);let s;return t[3]!==i||t[4]!==r||t[5]!==o?(s=(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(Y,{variant:`ghost`,className:a,onClick:r,children:[o,i]})}),t[3]=i,t[4]=r,t[5]=o,t[6]=s):s=t[6],s},HI=e=>{let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(`p`,{className:`font-mono tracking-wide uppercase text-muted-foreground text-xs mb-1`,children:n}),t[0]=n,t[1]=r),r},UI=()=>{let e=(0,$.c)(36),{_:t}=vt(),[n,r]=(0,Q.useState)(!1),[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(null),f=typeof window<`u`&&window.okDesktop!=null,p,m;e[0]!==n||e[1]!==u?(p=()=>{if(!n||u!==null)return;let e=new AbortController;return Za({signal:e.signal}).then(e=>{e!==null&&d(e)}),()=>e.abort()},m=[n,u],e[0]=n,e[1]=u,e[2]=p,e[3]=m):(p=e[2],m=e[3]),(0,Q.useEffect)(p,m);let h;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(h=e=>{r(e),e||a(!1)},e[4]=h):h=e[4];let g;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(st,{className:`size-4`}),e[5]=g):g=e[5];let _;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(ln,{asChild:!0,children:(0,Z.jsx)(Wt,{asChild:!0,children:(0,Z.jsxs)(Y,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,children:[g,(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`s-MGs7`})})]})})}),e[6]=_):_=e[6];let v;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsxs)(fn,{children:[_,(0,Z.jsx)(un,{children:(0,Z.jsx)(J,{id:`s-MGs7`})})]}),e[7]=v):v=e[7];let y;e[8]!==t||e[9]!==u?(y=FI.map((e,n)=>(0,Z.jsxs)(`div`,{className:$t(n>0&&`mt-3`),children:[(0,Z.jsx)(HI,{children:t(e.heading)}),(0,Z.jsx)(`nav`,{"aria-label":t(e.heading),children:(0,Z.jsxs)(`ul`,{className:`space-y-0.5`,children:[e.links.map(e=>(0,Z.jsx)(BI,{link:e,trailing:e.href===`https://github.com/inkeep/open-knowledge`&&u!==null?(0,Z.jsx)(zI,{count:u}):void 0},e.href)),e.key===`resources`&&(0,Z.jsxs)(Z.Fragment,{children:[f&&(0,Z.jsx)(VI,{icon:le,onSelect:()=>{r(!1),s(!0)},children:(0,Z.jsx)(J,{id:`cd5EXh`})}),(0,Z.jsx)(VI,{icon:ph,onSelect:()=>{r(!1),l(!0)},children:(0,Z.jsx)(J,{id:`1uyUjj`})})]})]})})]},e.key)),e[8]=t,e[9]=u,e[10]=y):y=e[10];let b;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(HI,{children:(0,Z.jsx)(J,{id:`arUUsK`})}),e[11]=b):b=e[11];let x;e[12]===t?x=e[13]:(x=t({id:`arUUsK`}),e[12]=t,e[13]=x);let S;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(BI,{link:{label:{id:`3ePd3I`},href:II,icon:fh}}),e[14]=S):S=e[14];let C;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(Wt,{asChild:!0,children:(0,Z.jsxs)(Y,{variant:`ghost`,className:$t(LI,`h-auto w-full justify-start font-normal`),children:[(0,Z.jsx)(dh,{"aria-hidden":`true`,className:`size-4 shrink-0`}),(0,Z.jsx)(J,{id:`EDl9kS`})]})}),e[15]=C):C=e[15];let w;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(Yt,{side:`left`,align:`center`,sideOffset:20,className:`w-80`,children:(0,Z.jsx)(gI,{source:`resources_menu`,autoFocus:!0,onDismiss:()=>a(!1),onSuccess:WI})}),e[16]=w):w=e[16];let T;e[17]===i?T=e[18]:(T=(0,Z.jsxs)(`ul`,{className:`space-y-0.5`,children:[S,(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(Ut,{open:i,onOpenChange:a,children:[C,w]})})]}),e[17]=i,e[18]=T);let E;e[19]!==T||e[20]!==x?(E=(0,Z.jsxs)(`div`,{className:`mt-3`,children:[b,(0,Z.jsx)(`nav`,{"aria-label":x,children:T})]}),e[19]=T,e[20]=x,e[21]=E):E=e[21];let D;e[22]!==E||e[23]!==y?(D=(0,Z.jsxs)(Yt,{align:`end`,className:`w-56 p-3`,children:[y,E]}),e[22]=E,e[23]=y,e[24]=D):D=e[24];let O;e[25]!==n||e[26]!==D?(O=(0,Z.jsxs)(Ut,{open:n,onOpenChange:h,children:[v,D]}),e[25]=n,e[26]=D,e[27]=O):O=e[27];let k;e[28]===o?k=e[29]:(k=f&&(0,Z.jsx)(Cp,{open:o,onOpenChange:s}),e[28]=o,e[29]=k);let A;e[30]===c?A=e[31]:(A=(0,Z.jsx)(MI,{open:c,onOpenChange:l}),e[30]=c,e[31]=A);let j;return e[32]!==O||e[33]!==k||e[34]!==A?(j=(0,Z.jsxs)(Z.Fragment,{children:[O,k,A]}),e[32]=O,e[33]=k,e[34]=A,e[35]=j):j=e[35],j};function WI(){return kI.markSubscribed()}function GI(e){let t=(0,$.c)(14),{className:n}=e,{_:r}=vt(),i=typeof window<`u`?window.okDesktop?.instanceLabel??null:null;if(!i)return null;let a;t[0]===r?a=t[1]:(a=r({id:`iRdfLr`,values:{label:i}}),t[0]=r,t[1]=a);let o,s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(Xo,{"aria-hidden":`true`}),s=(0,Z.jsx)(`span`,{className:`max-w-40 truncate`,children:i}),t[2]=o,t[3]=s):(o=t[2],s=t[3]);let c;t[4]!==n||t[5]!==a?(c=(0,Z.jsx)(ln,{asChild:!0,children:(0,Z.jsxs)(fu,{variant:`secondary`,"aria-label":a,"data-testid":`instance-badge`,className:n,children:[o,s]})}),t[4]=n,t[5]=a,t[6]=c):c=t[6];let l;t[7]===r?l=t[8]:(l=r({id:`c5PTFE`,values:{label:i}}),t[7]=r,t[8]=l);let u;t[9]===l?u=t[10]:(u=(0,Z.jsx)(un,{children:l}),t[9]=l,t[10]=u);let d;return t[11]!==c||t[12]!==u?(d=(0,Z.jsxs)(fn,{children:[c,u]}),t[11]=c,t[12]=u,t[13]=d):d=t[13],d}var KI=50,qI=()=>{let e=(0,$.c)(8),t=(0,Q.useRef)(null),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=()=>{t.current===null&&(t.current=setTimeout(()=>{t.current=null,Pw.preload()},KI))},e[0]=n):n=e[0];let r=n,i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{t.current!==null&&(clearTimeout(t.current),t.current=null)},e[1]=i):i=e[1];let a=i,o,s;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>()=>{t.current!==null&&clearTimeout(t.current)},s=[],e[2]=o,e[3]=s):(o=e[2],s=e[3]),(0,Q.useEffect)(o,s);let c,l;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>{a(),window.location.hash!==`#settings`&&(window.location.hash=Gi)},l=(0,Z.jsx)(Th,{className:`size-4`}),e[4]=c,e[5]=l):(c=e[4],l=e[5]);let u;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(ln,{asChild:!0,children:(0,Z.jsxs)(Y,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,"data-testid":`header-settings-button`,onMouseEnter:r,onMouseLeave:a,onFocus:r,onBlur:a,onClick:c,children:[l,(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`Tz0i8g`})})]})}),e[6]=u):u=e[6];let d;return e[7]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsxs)(fn,{children:[u,(0,Z.jsx)(un,{children:(0,Z.jsx)(J,{id:`Tz0i8g`})})]}),e[7]=d):d=e[7],d},JI=`https://openknowledge.ai/docs/features/share`;function YI(e){let t=(0,$.c)(50),{input:n,onClickWhenNoRemote:r}=e,{_:i}=vt(),{status:a}=ss(),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(null),u=(0,Q.useRef)(null),d;t[0]===c?.autoCopyFailed?d=t[1]:(d=()=>{!c?.autoCopyFailed||!u.current||(u.current.focus(),u.current.select())},t[0]=c?.autoCopyFailed,t[1]=d);let f;t[2]===c?f=t[3]:(f=[c],t[2]=c,t[3]=f),(0,Q.useEffect)(d,f);let p=a?.hasRemote===!0,m=n===null,h=rs(c?.freshness,a),g;t[4]!==i||t[5]!==o||t[6]!==p||t[7]!==n||t[8]!==r?(g=async function(){if(!o&&n!==null){s(!0),l(null);try{let e=await Jr({...n,hasRemote:p,onClickWhenNoRemote:r},{clipboardWrite:Md,toastSuccess:rL,toastError:nL,logEvent:tL});e.kind===`copied`?l({url:e.shareUrl,autoCopyFailed:!1,freshness:e.freshness}):e.kind===`clipboard-failed`&&l({url:e.shareUrl,autoCopyFailed:!0,freshness:e.freshness})}catch{X.error(i({id:`u3YnKw`}))}s(!1)}},t[4]=i,t[5]=o,t[6]=p,t[7]=n,t[8]=r,t[9]=g):g=t[9];let _=g,v=c!==null,y;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(y=e=>{e||l(null)},t[10]=y):y=t[10];let b;t[11]!==i||t[12]!==n?.kind?(b=n?.kind===`folder`?i({id:`WR0y2O`}):i({id:`F4IYWe`}),t[11]=i,t[12]=n?.kind,t[13]=b):b=t[13];let x=o||m,S,C;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(Eh,{className:`size-3.5`,"aria-hidden":!0}),C=(0,Z.jsx)(J,{id:`Z8lGw6`}),t[14]=S,t[15]=C):(S=t[14],C=t[15]);let w;t[16]!==_||t[17]!==b||t[18]!==x?(w=(0,Z.jsx)(qt,{asChild:!0,children:(0,Z.jsxs)(Y,{variant:`ghost`,size:`sm`,"aria-label":b,onClick:_,disabled:x,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`share-button`,children:[S,C]})}),t[16]=_,t[17]=b,t[18]=x,t[19]=w):w=t[19];let T=h?`w-96`:`w-80`,E;t[20]===T?E=t[21]:(E=$t(`flex flex-col gap-2`,T),t[20]=T,t[21]=E);let D;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsx)(`p`,{className:`font-mono tracking-wide uppercase text-muted-foreground text-xs`,children:(0,Z.jsx)(J,{id:`Z8lGw6`})}),t[22]=D):D=t[22];let O;t[23]===c?.autoCopyFailed?O=t[24]:(O=c?.autoCopyFailed?(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(J,{id:`ndeI89`})}):null,t[23]=c?.autoCopyFailed,t[24]=O);let k=c?.url??``,A;t[25]===i?A=t[26]:(A=i({id:`5-FeN2`}),t[25]=i,t[26]=A);let j;t[27]!==k||t[28]!==A?(j=(0,Z.jsx)(vl,{ref:u,readOnly:!0,value:k,onFocus:eL,onClick:$I,onContextMenu:QI,className:`select-all bg-muted font-mono text-xs text-muted-foreground`,"data-testid":`share-button-url`,"aria-label":A}),t[27]=k,t[28]=A,t[29]=j):j=t[29];let M=c?.url??``,N=c?.autoCopyFailed===!1,P;t[30]!==M||t[31]!==N?(P=(0,Z.jsx)(`div`,{className:`absolute inset-y-0 right-1 flex items-center`,children:(0,Z.jsx)(`div`,{className:`rounded-md bg-background/50 backdrop-blur-sm`,children:(0,Z.jsx)(js,{copyContent:M,clipboardWrite:Md,initialCopied:N})})}),t[30]=M,t[31]=N,t[32]=P):P=t[32];let F;t[33]!==j||t[34]!==P?(F=(0,Z.jsxs)(`div`,{className:`relative`,children:[j,P]}),t[33]=j,t[34]=P,t[35]=F):F=t[35];let I=c?.freshness,L=n?.kind??`doc`,R;t[36]!==a||t[37]!==I||t[38]!==L?(R=(0,Z.jsx)(ts,{freshness:I,status:a,kind:L}),t[36]=a,t[37]=I,t[38]=L,t[39]=R):R=t[39];let z;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Z.jsxs)(`a`,{href:JI,target:`_blank`,rel:`noopener noreferrer`,onClick:ZI,onAuxClick:XI,className:`mt-2 flex items-center gap-1.5 self-start text-xs text-muted-foreground transition-colors hover:text-primary`,children:[(0,Z.jsx)(st,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(J,{id:`aByJ8j`})]}),t[40]=z):z=t[40];let B;t[41]!==E||t[42]!==O||t[43]!==F||t[44]!==R?(B=(0,Z.jsxs)(Yt,{align:`end`,className:E,"data-testid":`share-button-popover`,children:[D,O,F,R,z]}),t[41]=E,t[42]=O,t[43]=F,t[44]=R,t[45]=B):B=t[45];let V;return t[46]!==w||t[47]!==B||t[48]!==v?(V=(0,Z.jsxs)(Ut,{open:v,onOpenChange:y,children:[w,B]}),t[46]=w,t[47]=B,t[48]=v,t[49]=V):V=t[49],V}function XI(e){return Wu(e,JI)}function ZI(e){return Wu(e,JI)}function QI(e){return e.currentTarget.select()}function $I(e){return e.currentTarget.select()}function eL(e){return e.currentTarget.select()}function tL(e){return console.log(e)}function nL(e){e!==`Link ready but could not copy to clipboard.`&&X.error(e)}function rL(e){return X.success(e)}var iL=(0,Q.lazy)(()=>n(()=>import(`./AppMenubar-DqlpmcU7.js`).then(e=>({default:e.AppMenubar})),__vite__mapDeps([144,1,10,11,12,16,17,18,19,40,106,14,15,24,41,21,84,22]),import.meta.url));function aL(e){let t=(0,$.c)(38),{onSignIn:n,onSetIdentity:r,onOpenSearch:i}=e,{_:a}=vt(),{activeDocName:o,activeTarget:s}=Re(),c=o?Oa(o):null,{state:l,isDraggingRail:u}=vN(),d=iv(),f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f=xl(`toggle-files-sidebar`),t[0]=f):f=t[0];let p=f,m=xl(`command-palette`),[h,g]=(0,Q.useState)(!1),_;bb0:{if(s?.kind===`folder`){let e;t[1]===s.folderPath?e=t[2]:(e=Yr(s.folderPath),t[1]=s.folderPath,t[2]=e),_=e;break bb0}if(o&&!c){let e;t[3]===o?e=t[4]:(e=ci(o),t[3]=o,t[4]=e),_=e;break bb0}if(!s&&!o){let e;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=Yr(``),t[5]=e):e=t[5],_=e;break bb0}_=null}let v=_,y=typeof window<`u`&&window.okDesktop!=null,b=l===`collapsed`,x=y?``:void 0,S=y&&b&&`pl-[var(--ok-titlebar-reserve-left,1rem)]`,C=y&&!u&&`motion-safe:transition-[padding] motion-safe:duration-200 motion-safe:ease-linear`,w;t[6]!==S||t[7]!==C?(w=$t(`flex h-12 shrink-0 items-center bg-muted/35 shadow-[inset_0_-1px_0_var(--border)]`,y&&`[-webkit-app-region:drag]`,S,C),t[6]=S,t[7]=C,t[8]=w):w=t[8];let T;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(T=RP()&&(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(iL,{})}),t[9]=T):T=t[9];let E=!d&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(fn,{children:[(0,Z.jsx)(ln,{asChild:!0,children:(0,Z.jsx)(CN,{className:$t(`-ml-1 shrink-0 text-muted-foreground`,y&&`[-webkit-app-region:no-drag]`)})}),(0,Z.jsx)(un,{children:l===`expanded`?(0,Z.jsx)(J,{id:`ZxXhLY`,values:{sidebarShortcut:p}}):(0,Z.jsx)(J,{id:`Zz25kq`,values:{sidebarShortcut:p}})})]}),b&&i&&(0,Z.jsxs)(fn,{children:[(0,Z.jsx)(ln,{asChild:!0,children:(0,Z.jsx)(Y,{variant:`ghost`,size:`icon-sm`,onClick:i,"aria-label":a({id:`IN4UX8`,values:{searchShortcut:m}}),"data-telemetry-event":`ok.editor_header.search.click`,className:$t(`shrink-0 text-muted-foreground`,y&&`[-webkit-app-region:no-drag]`),children:(0,Z.jsx)(he,{"aria-hidden":`true`})})}),(0,Z.jsx)(un,{children:(0,Z.jsx)(J,{id:`IN4UX8`,values:{searchShortcut:m}})})]}),(0,Z.jsx)(mi,{orientation:`vertical`,className:`mr-1 h-4 shrink-0 data-vertical:self-center`}),(0,Z.jsx)(pI,{})]}),D;t[10]!==T||t[11]!==E?(D=(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1 px-3`,children:[T,E]}),t[10]=T,t[11]=E,t[12]=D):D=t[12];let O;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(O=$t(`flex shrink-0 items-center justify-end gap-2 px-3`,y&&`[&>*]:[-webkit-app-region:no-drag]`,y&&`mr-[var(--ok-titlebar-reserve-right,0px)]`),t[13]=O):O=t[13];let k;t[14]!==h||t[15]!==g||t[16]!==v||t[17]!==d?(k=!d&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(YI,{input:v,onClickWhenNoRemote:()=>g(!0)}),(0,Z.jsx)(qr,{open:h,onOpenChange:g})]}),t[14]=h,t[15]=g,t[16]=v,t[17]=d,t[18]=k):k=t[18];let A;t[19]!==r||t[20]!==n?(A=(0,Z.jsx)(Ai,{onSignIn:n,onSetIdentity:r}),t[19]=r,t[20]=n,t[21]=A):A=t[21];let j,M,N,P;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Z.jsx)(_F,{}),M=(0,Z.jsx)(mi,{orientation:`vertical`,className:`h-4 shrink-0 data-vertical:self-center`}),N=(0,Z.jsx)(GI,{}),P=(0,Z.jsx)(bF,{}),t[22]=j,t[23]=M,t[24]=N,t[25]=P):(j=t[22],M=t[23],N=t[24],P=t[25]);let F;t[26]===d?F=t[27]:(F=!d&&(0,Z.jsx)(qI,{}),t[26]=d,t[27]=F);let I;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(UI,{}),t[28]=I):I=t[28];let L;t[29]!==k||t[30]!==A||t[31]!==F?(L=(0,Z.jsxs)(`div`,{className:O,children:[k,A,j,M,N,P,F,I]}),t[29]=k,t[30]=A,t[31]=F,t[32]=L):L=t[32];let R;return t[33]!==D||t[34]!==L||t[35]!==x||t[36]!==w?(R=(0,Z.jsxs)(`header`,{"data-electron-drag":x,className:w,children:[D,L]}),t[33]=D,t[34]=L,t[35]=x,t[36]=w,t[37]=R):R=t[37],R}var oL=(0,Q.lazy)(()=>n(()=>import(`./AgentThreadClientBinder-poPjsQXP.js`).then(e=>({default:e.AgentThreadClientBinder})),__vite__mapDeps([145,1,22,12,146,38,90,19,92,6,2,3,7,8,9]),import.meta.url)),sL=(0,Q.lazy)(()=>n(()=>import(`./TerminalSessionsHost-BjojawIi.js`).then(e=>({default:e.TerminalSessionsHost})),__vite__mapDeps([147,1,2,104,19,12,6,3,7,8,9,38,10,11,16,17,18,40,105,106,14,15,24,41,21,84,22,81,28,42,25,112,96,83,148,114,58,97,32,115,33,34,30,89,78,26,90,124,73,74,75,76,125,146]),import.meta.url));function cL(e){let t=(0,$.c)(96),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{onOpenSearch:r}=n,[i,a]=$v(),[o,s]=(0,Q.useState)(i),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(`auth`),[f,p]=(0,Q.useState)(tb[0].id),[m,h]=(0,Q.useState)(!1),g=typeof window<`u`?window.okDesktop??null:null,_=g!=null&&g.terminal!=null&&g.config.ptyAvailable===!0,[v,y]=(0,Q.useState)(!1),b=md(),[x,S]=(0,Q.useState)(!1),[C,w]=(0,Q.useState)(!1),T=(0,Q.useRef)(!1),[E,D]=(0,Q.useState)(null),[O,k]=(0,Q.useState)(null),A=(0,Q.useRef)(0),[j,M]=(0,Q.useState)(cy),N;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(N=function(e){M(e),sy(e),y(!0)},t[2]=N):N=t[2];let P=N,F;t[3]===j?F=t[4]:(F=function(){P(j===`right`?`bottom`:`right`)},t[3]=j,t[4]=F);let I=F,L;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(L={container:null,isShowing:!1,dockPosition:`bottom`,editorRegion:null},t[5]=L):L=t[5];let[R,z]=(0,Q.useState)(L),B=(0,Q.useRef)(0),V;t[6]===b?V=t[7]:(V=function(e,t){let n=e??ny(qc(),b);y(!0),B.current+=1,D({prompt:null,cli:n,nonce:B.current,stagePaste:t})},t[6]=b,t[7]=V);let H=V,U;t[8]!==x||t[9]!==H?(U=function(){y(!0),_&&!x&&!Jc()&&H()},t[8]=x,t[9]=H,t[10]=U):U=t[10];let W=U,ee=os(),{projectConfig:G,projectLocalConfig:K,projectLocalSynced:te,projectSynced:ne}=Hu(),{activeDocName:re}=Re(),ie=ee?.hasRemote,ae=ee?.pushPermission?.checkStatus,oe;t[11]!==m||t[12]!==G||t[13]!==K||t[14]!==te||t[15]!==ne||t[16]!==ie||t[17]!==ae?(oe=dy({autoSyncOnboardingDismissed:m,hasRemote:ie,projectLocalSynced:te,projectSynced:ne,projectLocalConfig:K,projectConfig:G,pushPermissionCheckStatus:ae}),t[11]=m,t[12]=G,t[13]=K,t[14]=te,t[15]=ne,t[16]=ie,t[17]=ae,t[18]=oe):oe=t[18];let se=oe,ce,le;t[19]===re?(ce=t[20],le=t[21]):(ce=()=>{let e=function(e){let t=e.detail;t&&re&&ad(re,{kind:`raw-mdx`,detail:t}),s(`source`)};return window.addEventListener(Gv,e),()=>window.removeEventListener(Gv,e)},le=[re],t[19]=re,t[20]=ce,t[21]=le),(0,Q.useEffect)(ce,le);let ue=(0,Q.useRef)(!1),de;t[22]!==re||t[23]!==o||t[24]!==H?(de=function(e){if(!_||re==null)return!1;let t=ed(re,o)?.markdown??``;if(t.trim()===``)return!1;let n=`${VO(re,t)}\n\n`;return!e&&ue.current?(y(!0),Xt(n)):H(void 0,n),!0},t[22]=re,t[23]=o,t[24]=H,t[25]=de):de=t[25];let fe=(0,Q.useEffectEvent)(de),pe;t[26]===H?pe=t[27]:(pe=()=>H(),t[26]=H,t[27]=pe);let q=(0,Q.useEffectEvent)(pe),me;t[28]===fe?me=t[29]:(me=()=>Gt(e=>{if(e===`toggle-terminal`){if(fe(!1))return;y(dL)}else e===`new-terminal`&&y(!0)}),t[28]=fe,t[29]=me);let he;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(he=[],t[30]=he):he=t[30],(0,Q.useEffect)(me,he);let ge;t[31]===fe?ge=t[32]:(ge=()=>{if(window.okDesktop!=null)return;let e=function(e){if(Sl(e,`toggle-terminal-panel`)){if(e.preventDefault(),fe(!1))return;y(uL)}};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},t[31]=fe,t[32]=ge);let _e;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(_e=[],t[33]=_e):_e=t[33],(0,Q.useEffect)(ge,_e);let ve;t[34]!==q||t[35]!==fe?(ve=()=>{if(!_)return;let e=function(e){Sl(e,`new-terminal-tab`)&&(e.preventDefault(),fe(!0)||q())};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},t[34]=q,t[35]=fe,t[36]=ve):ve=t[36];let ye;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(ye=[_],t[37]=ye):ye=t[37],(0,Q.useEffect)(ve,ye);let be,xe;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(be=()=>zc((e,t)=>{y(!0),B.current+=1,D({prompt:e,cli:t,nonce:B.current})}),xe=[],t[38]=be,t[39]=xe):(be=t[38],xe=t[39]),(0,Q.useEffect)(be,xe);let Se,Ce;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(Se=()=>tc(e=>{y(!0),A.current+=1,k({agentSource:e.agentSource,agentId:e.agentId,prompt:e.prompt,docName:e.docName,titleHint:e.titleHint,nonce:A.current})}),Ce=[],t[40]=Se,t[41]=Ce):(Se=t[40],Ce=t[41]),(0,Q.useEffect)(Se,Ce);let we,Te;t[42]===v?(we=t[43],Te=t[44]):(we=()=>{v||D(null)},Te=[v],t[42]=v,t[43]=we,t[44]=Te),(0,Q.useEffect)(we,Te);let Ee,De;t[45]!==C||t[46]!==v?(Ee=()=>{window.okDesktop!=null&&C&&(Ic({terminalVisible:v}),window.okDesktop.editor.notifyViewMenuStateChanged({terminalVisible:v}))},De=[v,C],t[45]=C,t[46]=v,t[47]=Ee,t[48]=De):(Ee=t[47],De=t[48]),(0,Q.useEffect)(Ee,De);let Oe,ke;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=()=>{let e=window.okDesktop;if(e==null)return;if(typeof e.terminal?.getDockState!=`function`){w(!0);return}let t=!1;return e.terminal.getDockState().then(e=>{t||!e.visible||(T.current=!0,y(!0))}).catch(lL).finally(()=>{t||w(!0)}),()=>{t=!0}},ke=[],t[49]=Oe,t[50]=ke):(Oe=t[49],ke=t[50]),(0,Q.useEffect)(Oe,ke);let Ae,je;t[51]===v?(Ae=t[52],je=t[53]):(Ae=()=>{if(window.okDesktop!=null){if(T.current){T.current=!1;return}v&&ra()}},je=[v],t[51]=v,t[52]=Ae,t[53]=je),(0,Q.useEffect)(Ae,je),ey(ee?.pausedReason),ty();let Me;t[54]===a?Me=t[55]:(Me=function(e){s(e),a(e)},t[54]=a,t[55]=Me);let Ne=Me,Pe;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(oL,{})}),t[56]=Pe):Pe=t[56];let Fe,Ie;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(Fe=()=>{d(`auth`),l(!0)},Ie=()=>{d(`identity`),l(!0)},t[57]=Fe,t[58]=Ie):(Fe=t[57],Ie=t[58]);let Le;t[59]===r?Le=t[60]:(Le=(0,Z.jsx)(aL,{onSignIn:Fe,onSetIdentity:Ie,onOpenSearch:r}),t[59]=r,t[60]=Le);let ze;t[61]!==f||t[62]!==o||t[63]!==Ne||t[64]!==x||t[65]!==W||t[66]!==j||t[67]!==v?(ze=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 overflow-hidden`,children:(0,Z.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:(0,Z.jsx)(AP,{editorMode:o,onModeChange:Ne,activeTab:f,onActiveTabChange:p,terminalBridge:_?g:null,terminalVisible:v,onTerminalVisibleChange:y,terminalDock:j,terminalHasSessions:x,onTerminalPlacement:z,onRevealTerminal:W})})}),t[61]=f,t[62]=o,t[63]=Ne,t[64]=x,t[65]=W,t[66]=j,t[67]=v,t[68]=ze):ze=t[68];let Be;t[69]===R.editorRegion?Be=t[70]:(Be=()=>R.editorRegion?.focus(),t[69]=R.editorRegion,t[70]=Be);let Ve;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(Ve=e=>{ue.current=e},t[71]=Ve):Ve=t[71];let He;t[72]!==b||t[73]!==Be||t[74]!==j||t[75]!==E||t[76]!==R.container||t[77]!==R.isShowing||t[78]!==v||t[79]!==O||t[80]!==I?(He=(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(sL,{bridge:_?g:null,visible:v,onVisibleChange:y,launch:E,threadLaunch:O,installedClis:b,container:R.container,isShowing:R.isShowing,onRequestEditorFocus:Be,dockPosition:j,onToggleDock:I,onHasSessionsChange:S,onActiveSessionCliChange:Ve})}),t[72]=b,t[73]=Be,t[74]=j,t[75]=E,t[76]=R.container,t[77]=R.isShowing,t[78]=v,t[79]=O,t[80]=I,t[81]=He):He=t[81];let Ue=u===`identity`,We;t[82]===Symbol.for(`react.memo_cache_sentinel`)?(We=()=>{l(!1)},t[82]=We):We=t[82];let Ge;t[83]!==c||t[84]!==Ue?(Ge=(0,Z.jsx)(ji,{open:c,onOpenChange:l,identityPrompt:Ue,onSuccess:We}),t[83]=c,t[84]=Ue,t[85]=Ge):Ge=t[85];let Ke;t[86]===Symbol.for(`react.memo_cache_sentinel`)?(Ke=()=>h(!0),t[86]=Ke):Ke=t[86];let qe;t[87]===se?qe=t[88]:(qe=(0,Z.jsx)(ly,{open:se,onResolved:Ke}),t[87]=se,t[88]=qe);let Je;t[89]===Symbol.for(`react.memo_cache_sentinel`)?(Je=(0,Z.jsx)(Hv,{}),t[89]=Je):Je=t[89];let Ye;return t[90]!==Le||t[91]!==ze||t[92]!==He||t[93]!==Ge||t[94]!==qe?(Ye=(0,Z.jsxs)(Z.Fragment,{children:[Pe,Le,ze,He,Ge,qe,Je]}),t[90]=Le,t[91]=ze,t[92]=He,t[93]=Ge,t[94]=qe,t[95]=Ye):Ye=t[95],Ye}function lL(e){console.error(`[terminal] dock-state restore failed; staying hidden:`,e)}function uL(e){return!e}function dL(e){return!e}function fL(e){let t=lu(eu(e));typeof window>`u`||window.location.hash!==t&&(window.location.hash=t)}function pL(){let e=(0,$.c)(11),{conflicts:t,loading:n,error:r}=yi();if(n)return null;if(r===`server`){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`section`,{"data-testid":`conflicts-section`,"aria-label":`Conflicted files`,className:`border-b border-amber-200/60 bg-amber-50/40 px-2 py-2 dark:border-amber-900/40 dark:bg-amber-950/20`,children:(0,Z.jsxs)(`p`,{"data-testid":`conflicts-section-error`,className:`px-2 py-1.5 text-[12px] text-amber-700 dark:text-amber-400`,children:[(0,Z.jsx)(sl,{"aria-hidden":`true`,className:`mr-1.5 inline size-3`}),`Couldn't load conflicts — reload to retry.`]})}),e[0]=t):t=e[0],t}if(t.length===0)return null;let i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 font-mono text-[11px] uppercase tracking-wider text-amber-700 dark:text-amber-400`,children:[(0,Z.jsx)(sl,{"aria-hidden":`true`,className:`size-3`}),`Conflicts`]}),e[1]=i):i=e[1];let a;e[2]===t.length?a=e[3]:(a=(0,Z.jsxs)(`header`,{className:`flex items-center justify-between px-2 pb-1.5`,children:[i,(0,Z.jsx)(`span`,{"data-testid":`conflicts-section-count`,className:`rounded-full bg-amber-500 px-1.5 py-0.5 font-mono text-[10px] font-medium leading-none text-white`,children:t.length})]}),e[2]=t.length,e[3]=a);let o;e[4]===t?o=e[5]:(o=t.map(mL),e[4]=t,e[5]=o);let s;e[6]===o?s=e[7]:(s=(0,Z.jsx)(`ul`,{className:`flex flex-col gap-px`,children:o}),e[6]=o,e[7]=s);let c;return e[8]!==a||e[9]!==s?(c=(0,Z.jsxs)(`section`,{"data-testid":`conflicts-section`,"aria-label":`Conflicted files`,className:`border-b border-amber-200/60 bg-amber-50/40 px-2 py-2 dark:border-amber-900/40 dark:bg-amber-950/20`,children:[a,s]}),e[8]=a,e[9]=s,e[10]=c):c=e[10],c}function mL(e){return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(Y,{variant:`ghost`,size:`sm`,"data-testid":`conflicts-section-row`,"data-file":e.file,title:e.file,className:`h-7 w-full justify-start gap-1.5 px-2 font-normal text-[13px] text-amber-800 hover:bg-amber-100/60 hover:text-amber-900 dark:text-amber-300 dark:hover:bg-amber-900/30 dark:hover:text-amber-200`,onClick:()=>fL(e.file),children:[(0,Z.jsx)(sl,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:e.file})]})},e.file)}var hL=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
22
22
  <symbol id="file-tree-icon-chevron" viewBox="0 0 16 16">
23
23
  <path d="M12.4697 5.46973C12.7626 5.17684 13.2374 5.17684 13.5303 5.46973C13.8232 5.76262 13.8232 6.23738 13.5303 6.53028L8.53028 11.5303C8.23738 11.8232 7.76262 11.8232 7.46973 11.5303L2.46973 6.53028C2.17684 6.23738 2.17684 5.76262 2.46973 5.46973C2.76262 5.17684 3.23738 5.17684 3.53028 5.46973L8 9.93946L12.4697 5.46973Z" fill="currentcolor"/>
24
24
  </symbol>
@@ -35,72 +35,72 @@ Error generating stack: `+e.message+`
35
35
  <symbol id="file-tree-icon-ellipsis" viewBox="0 0 16 16">
36
36
  <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" />
37
37
  </symbol>
38
- </svg>`,fL=`<symbol id="file-tree-builtin-astro" viewBox="0 0 16 16">
38
+ </svg>`,gL=`<symbol id="file-tree-builtin-astro" viewBox="0 0 16 16">
39
39
  <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"/>
40
40
  <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"/>
41
- </symbol>`,pL=`<symbol id="file-tree-builtin-babel" viewBox="0 0 16 16">
41
+ </symbol>`,_L=`<symbol id="file-tree-builtin-babel" viewBox="0 0 16 16">
42
42
  <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"/>
43
- </symbol>`,mL=`<symbol id="file-tree-builtin-bash" viewBox="0 0 16 16">
43
+ </symbol>`,vL=`<symbol id="file-tree-builtin-bash" viewBox="0 0 16 16">
44
44
  <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"/>
45
45
  <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"/>
46
- </symbol>`,hL=`<symbol id="file-tree-builtin-biome" viewBox="0 0 16 16">
46
+ </symbol>`,yL=`<symbol id="file-tree-builtin-biome" viewBox="0 0 16 16">
47
47
  <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"/>
48
- </symbol>`,gL=`<symbol id="file-tree-builtin-bootstrap" viewBox="0 0 16 16">
48
+ </symbol>`,bL=`<symbol id="file-tree-builtin-bootstrap" viewBox="0 0 16 16">
49
49
  <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"/>
50
50
  <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"/>
51
- </symbol>`,_L=`<symbol id="file-tree-builtin-browserslist" viewBox="0 0 16 16">
51
+ </symbol>`,xL=`<symbol id="file-tree-builtin-browserslist" viewBox="0 0 16 16">
52
52
  <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"/>
53
53
  <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"/>
54
54
  <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"/>
55
- </symbol>`,vL=`<symbol id="file-tree-builtin-bun" viewBox="0 0 16 16">
55
+ </symbol>`,SL=`<symbol id="file-tree-builtin-bun" viewBox="0 0 16 16">
56
56
  <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"/>
57
- </symbol>`,yL=`<symbol id="file-tree-builtin-c" viewBox="0 0 16 16">
57
+ </symbol>`,CL=`<symbol id="file-tree-builtin-c" viewBox="0 0 16 16">
58
58
  <path fill="currentColor" fill-rule="evenodd" d="M8 1q.084 0 .166.021.098.023.186.075c1.055.624 4.22 2.486 5.277 3.11.085.05.15.112.209.192h-.002l.028.037a.5.5 0 0 1 .103.21q.031.102.033.21v6.29a.71.71 0 0 1-.347.616l-5.307 3.144a.68.68 0 0 1-.693 0l-5.307-3.144A.72.72 0 0 1 2 11.145V4.832a.71.71 0 0 1 .346-.612l5.288-3.126A.7.7 0 0 1 7.992 1zm2.901 4.349a3.75 3.75 0 1 0 0 5.302l-1.06-1.06a2.25 2.25 0 1 1 0-3.182z" clip-rule="evenodd"/>
59
- </symbol>`,bL=`<symbol id="file-tree-builtin-claude" viewBox="0 0 16 16">
59
+ </symbol>`,wL=`<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>`,xL=`<symbol id="file-tree-builtin-cpp" viewBox="0 0 16 16">
61
+ </symbol>`,TL=`<symbol id="file-tree-builtin-cpp" viewBox="0 0 16 16">
62
62
  <path fill="currentColor" fill-rule="evenodd" d="M8 1q.084 0 .166.021.098.023.186.075c1.055.624 4.22 2.486 5.277 3.11.085.05.15.112.209.192h-.002l.028.037a.5.5 0 0 1 .103.21q.031.102.033.21v6.29a.71.71 0 0 1-.347.616l-5.307 3.144a.68.68 0 0 1-.693 0l-5.307-3.144A.72.72 0 0 1 2 11.145V4.832a.71.71 0 0 1 .346-.612l5.288-3.126A.7.7 0 0 1 7.992 1zm2.901 4.349a3.75 3.75 0 1 0 0 5.302l-1.06-1.06a2.25 2.25 0 1 1 0-3.182z" clip-rule="evenodd"/>
63
- </symbol>`,SL=`<symbol id="file-tree-builtin-css" viewBox="0 0 16 16">
63
+ </symbol>`,EL=`<symbol id="file-tree-builtin-css" viewBox="0 0 16 16">
64
64
  <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"/>
65
65
  <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"/>
66
- </symbol>`,CL=`<symbol id="file-tree-builtin-database" viewBox="0 0 16 16">
66
+ </symbol>`,DL=`<symbol id="file-tree-builtin-database" viewBox="0 0 16 16">
67
67
  <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"/>
68
68
  <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"/>
69
69
  <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"/>
70
- </symbol>`,wL=`<symbol id="file-tree-builtin-default" viewBox="0 0 16 16">
70
+ </symbol>`,OL=`<symbol id="file-tree-builtin-default" viewBox="0 0 16 16">
71
71
  <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"/>
72
72
  <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"/>
73
- </symbol>`,TL=`<symbol id="file-tree-builtin-docker" viewBox="0 0 16 16">
73
+ </symbol>`,kL=`<symbol id="file-tree-builtin-docker" viewBox="0 0 16 16">
74
74
  <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"/>
75
75
  <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"/>
76
- </symbol>`,EL=`<symbol id="file-tree-builtin-eslint" viewBox="0 0 16 16">
76
+ </symbol>`,AL=`<symbol id="file-tree-builtin-eslint" viewBox="0 0 16 16">
77
77
  <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"/>
78
78
  <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"/>
79
- </symbol>`,DL=`<symbol id="file-tree-builtin-font" viewBox="0 0 16 16">
79
+ </symbol>`,jL=`<symbol id="file-tree-builtin-font" viewBox="0 0 16 16">
80
80
  <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"/>
81
- </symbol>`,OL=`<symbol id="file-tree-builtin-git" viewBox="0 0 16 16">
81
+ </symbol>`,ML=`<symbol id="file-tree-builtin-git" viewBox="0 0 16 16">
82
82
  <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"/>
83
- </symbol>`,kL=`<symbol id="file-tree-builtin-go" viewBox="0 0 16 16">
83
+ </symbol>`,NL=`<symbol id="file-tree-builtin-go" viewBox="0 0 16 16">
84
84
  <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"/>
85
- </symbol>`,AL=`<symbol id="file-tree-builtin-graphql" viewBox="0 0 16 16">
85
+ </symbol>`,PL=`<symbol id="file-tree-builtin-graphql" viewBox="0 0 16 16">
86
86
  <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"/>
87
- </symbol>`,jL=`<symbol id="file-tree-builtin-html" viewBox="0 0 16 16">
87
+ </symbol>`,FL=`<symbol id="file-tree-builtin-html" viewBox="0 0 16 16">
88
88
  <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"/>
89
89
  <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"/>
90
- </symbol>`,ML=`<symbol id="file-tree-builtin-image" viewBox="0 0 16 16">
90
+ </symbol>`,IL=`<symbol id="file-tree-builtin-image" viewBox="0 0 16 16">
91
91
  <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"/>
92
92
  <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"/>
93
- </symbol>`,NL=`<symbol id="file-tree-builtin-javascript" viewBox="0 0 16 16">
93
+ </symbol>`,LL=`<symbol id="file-tree-builtin-javascript" viewBox="0 0 16 16">
94
94
  <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"/>
95
95
  <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"/>
96
- </symbol>`,PL=`<symbol id="file-tree-builtin-json" viewBox="0 0 16 16">
96
+ </symbol>`,RL=`<symbol id="file-tree-builtin-json" viewBox="0 0 16 16">
97
97
  <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"/>
98
- </symbol>`,FL=`<symbol id="file-tree-builtin-markdown" viewBox="0 0 16 16">
98
+ </symbol>`,zL=`<symbol id="file-tree-builtin-markdown" viewBox="0 0 16 16">
99
99
  <path fill="currentColor" d="M1 12V4h2l2 2.5L7 4h2v8H7V7.5l-2 2-2-2V12zm9-3 3 3.5L16 9h-2V4h-2v5z"/>
100
- </symbol>`,IL=`<symbol id="file-tree-builtin-mcp" viewBox="0 0 16 16">
100
+ </symbol>`,BL=`<symbol id="file-tree-builtin-mcp" viewBox="0 0 16 16">
101
101
  <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"/>
102
102
  <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"/>
103
- </symbol>`,LL=`<symbol id="file-tree-builtin-nextjs" viewBox="0 0 16 16">
103
+ </symbol>`,VL=`<symbol id="file-tree-builtin-nextjs" viewBox="0 0 16 16">
104
104
  <defs>
105
105
  <linearGradient id="a" x1="4.522" x2="14" y1="3.943" y2="16" gradientUnits="userSpaceOnUse">
106
106
  <stop stop-color="currentColor"/>
@@ -110,82 +110,82 @@ Error generating stack: `+e.message+`
110
110
  <path fill="currentColor" d="M3 2h1.522v9.09H3z"/>
111
111
  <path fill="url(#a)" d="M4.903 2 15 15.075q-.565.5-1.195.925L4.522 3.943z"/>
112
112
  <path fill="currentColor" d="M12.172 2h-1.508v9.094h1.508z"/>
113
- </symbol>`,RL=`<symbol id="file-tree-builtin-npm" viewBox="0 0 16 16">
113
+ </symbol>`,HL=`<symbol id="file-tree-builtin-npm" viewBox="0 0 16 16">
114
114
  <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"/>
115
115
  <path fill="currentColor" d="M10.5 13H13V3H3v10h5V5.5h2.5z"/>
116
- </symbol>`,zL=`<symbol id="file-tree-builtin-oxc" viewBox="0 0 16 16">
116
+ </symbol>`,UL=`<symbol id="file-tree-builtin-oxc" viewBox="0 0 16 16">
117
117
  <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"/>
118
- </symbol>`,BL=`<symbol id="file-tree-builtin-postcss" viewBox="0 0 16 16">
118
+ </symbol>`,WL=`<symbol id="file-tree-builtin-postcss" viewBox="0 0 16 16">
119
119
  <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"/>
120
- </symbol>`,VL=`<symbol id="file-tree-builtin-prettier" viewBox="0 0 16 16">
120
+ </symbol>`,GL=`<symbol id="file-tree-builtin-prettier" viewBox="0 0 16 16">
121
121
  <path fill="currentColor" d="M6 12v1H4.93v-1zm1-2v1H2v-1zm6-4v1h-3V6zm-1-4v1H9V2z"/>
122
122
  <path fill="currentColor" d="M11.5 10v1H8v-1zM5 6v1H2V6zm5-2v1H9V4z" opacity=".8"/>
123
123
  <path fill="currentColor" d="M6 14v1H2v-1zm-.5-6v1H2V8zM13 4v1h-3V4zM4.93 2v1H2V2z" opacity=".6"/>
124
124
  <path fill="currentColor" d="M4.93 12v1H2v-1zM13 8v1H9V8zM5.5 4v1H2V4zM9 2v1H4.93V2z" opacity=".4"/>
125
- </symbol>`,HL=`<symbol id="file-tree-builtin-python" viewBox="0 0 16 16">
125
+ </symbol>`,KL=`<symbol id="file-tree-builtin-python" viewBox="0 0 16 16">
126
126
  <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"/>
127
127
  <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"/>
128
- </symbol>`,UL=`<symbol id="file-tree-builtin-react" viewBox="0 0 16 16">
128
+ </symbol>`,qL=`<symbol id="file-tree-builtin-react" viewBox="0 0 16 16">
129
129
  <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"/>
130
130
  <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"/>
131
- </symbol>`,WL=`<symbol id="file-tree-builtin-ruby" viewBox="0 0 16 16">
131
+ </symbol>`,JL=`<symbol id="file-tree-builtin-ruby" viewBox="0 0 16 16">
132
132
  <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"/>
133
- </symbol>`,GL=`<symbol id="file-tree-builtin-rust" viewBox="0 0 16 16">
133
+ </symbol>`,YL=`<symbol id="file-tree-builtin-rust" viewBox="0 0 16 16">
134
134
  <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"/>
135
- </symbol>`,KL=`<symbol id="file-tree-builtin-sass" viewBox="0 0 16 16">
135
+ </symbol>`,XL=`<symbol id="file-tree-builtin-sass" viewBox="0 0 16 16">
136
136
  <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"/>
137
- </symbol>`,qL=`<symbol id="file-tree-builtin-stylelint" viewBox="0 0 16 16">
137
+ </symbol>`,ZL=`<symbol id="file-tree-builtin-stylelint" viewBox="0 0 16 16">
138
138
  <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"/>
139
139
  <path fill="currentColor" d="M6.5 2.5V4l-2 1.5v-4zm5 3L9.5 4V2.5l2-1zM9 4H7V2.5h2z"/>
140
- </symbol>`,JL=`<symbol id="file-tree-builtin-svelte" viewBox="0 0 16 16">
140
+ </symbol>`,QL=`<symbol id="file-tree-builtin-svelte" viewBox="0 0 16 16">
141
141
  <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"/>
142
- </symbol>`,YL=`<symbol id="file-tree-builtin-svg" viewBox="0 0 16 16">
142
+ </symbol>`,$L=`<symbol id="file-tree-builtin-svg" viewBox="0 0 16 16">
143
143
  <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"/>
144
144
  <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"/>
145
- </symbol>`,XL=`<symbol id="file-tree-builtin-svgo" viewBox="0 0 16 16">
145
+ </symbol>`,eR=`<symbol id="file-tree-builtin-svgo" viewBox="0 0 16 16">
146
146
  <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"/>
147
147
  <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"/>
148
- </symbol>`,ZL=`<symbol id="file-tree-builtin-swift" viewBox="0 0 16 16">
148
+ </symbol>`,tR=`<symbol id="file-tree-builtin-swift" viewBox="0 0 16 16">
149
149
  <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"/>
150
- </symbol>`,QL=`<symbol id="file-tree-builtin-table" viewBox="0 0 16 16">
150
+ </symbol>`,nR=`<symbol id="file-tree-builtin-table" viewBox="0 0 16 16">
151
151
  <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"/>
152
152
  <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"/>
153
- </symbol>`,$L=`<symbol id="file-tree-builtin-tailwind" viewBox="0 0 16 16">
153
+ </symbol>`,rR=`<symbol id="file-tree-builtin-tailwind" viewBox="0 0 16 16">
154
154
  <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"/>
155
- </symbol>`,eR=`<symbol id="file-tree-builtin-terraform" viewBox="0 0 16 16">
155
+ </symbol>`,iR=`<symbol id="file-tree-builtin-terraform" viewBox="0 0 16 16">
156
156
  <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"/>
157
- </symbol>`,tR=`<symbol id="file-tree-builtin-text" viewBox="0 0 16 16">
157
+ </symbol>`,aR=`<symbol id="file-tree-builtin-text" viewBox="0 0 16 16">
158
158
  <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"/>
159
159
  <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"/>
160
- </symbol>`,nR=`<symbol id="file-tree-builtin-typescript" viewBox="0 0 16 16">
160
+ </symbol>`,oR=`<symbol id="file-tree-builtin-typescript" viewBox="0 0 16 16">
161
161
  <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"/>
162
162
  <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"/>
163
- </symbol>`,rR=`<symbol id="file-tree-builtin-vite" viewBox="0 0 16 16">
163
+ </symbol>`,sR=`<symbol id="file-tree-builtin-vite" viewBox="0 0 16 16">
164
164
  <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"/>
165
- </symbol>`,iR=`<symbol id="file-tree-builtin-vscode" viewBox="0 0 16 16">
165
+ </symbol>`,cR=`<symbol id="file-tree-builtin-vscode" viewBox="0 0 16 16">
166
166
  <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"/>
167
167
  <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"/>
168
168
  <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"/>
169
- </symbol>`,aR=`<symbol id="file-tree-builtin-vue" viewBox="0 0 16 16">
169
+ </symbol>`,lR=`<symbol id="file-tree-builtin-vue" viewBox="0 0 16 16">
170
170
  <path fill="currentColor" d="M9.62 2.25 8 5.02 6.38 2.25H1l7 12 7-12z" opacity=".5"/>
171
171
  <path fill="currentColor" d="M9.54 2.25 8 4.95l-1.54-2.7H4l4 7 4-7z"/>
172
- </symbol>`,oR=`<symbol id="file-tree-builtin-wasm" viewBox="0 0 16 16">
172
+ </symbol>`,uR=`<symbol id="file-tree-builtin-wasm" viewBox="0 0 16 16">
173
173
  <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"/>
174
174
  <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"/>
175
175
  <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"/>
176
- </symbol>`,sR=`<symbol id="file-tree-builtin-webpack" viewBox="0 0 16 16">
176
+ </symbol>`,dR=`<symbol id="file-tree-builtin-webpack" viewBox="0 0 16 16">
177
177
  <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"/>
178
178
  <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"/>
179
- </symbol>`,cR=`<symbol id="file-tree-builtin-yml" viewBox="0 0 16 16">
179
+ </symbol>`,fR=`<symbol id="file-tree-builtin-yml" viewBox="0 0 16 16">
180
180
  <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"/>
181
- </symbol>`,lR=`<symbol id="file-tree-builtin-zig" viewBox="0 0 16 16">
181
+ </symbol>`,pR=`<symbol id="file-tree-builtin-zig" viewBox="0 0 16 16">
182
182
  <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"/>
183
183
  <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"/>
184
- </symbol>`,uR=[mL,yL,xL,SL,CL,wL,DL,OL,kL,jL,ML,NL,PL,FL,IL,HL,WL,GL,ZL,QL,tR,nR,`<symbol id="file-tree-builtin-zip" viewBox="0 0 16 16">
184
+ </symbol>`,mR=[vL,CL,TL,EL,DL,OL,jL,ML,NL,FL,IL,LL,RL,zL,BL,KL,JL,YL,tR,nR,aR,oR,`<symbol id="file-tree-builtin-zip" viewBox="0 0 16 16">
185
185
  <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"/>
186
186
  <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"/>
187
- </symbol>`],dR=[fL,pL,hL,gL,_L,vL,bL,TL,EL,AL,LL,RL,zL,BL,VL,UL,KL,qL,JL,YL,XL,$L,eR,rR,iR,aR,oR,sR,cR,lR];function fR(e,t){return t.length===0?e:e.replace(`</svg>`,`\n ${t.join(`
188
- `)}\n</svg>`)}var pR=fR(dL,uR),mR={minimal:dL,standard:pR,complete:fR(pR,dR)},hR={".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`},gR={"7z":`zip`,astro:`astro`,AUTHORS:`text`,avif:`image`,bash:`bash`,bmp:`image`,bz2:`zip`,c:`c`,cc:`cpp`,cfg:`text`,CHANGELOG:`text`,cjs:`javascript`,"code-workspace":`vscode`,conf:`text`,CONTRIBUTORS:`text`,cpp:`cpp`,csh:`bash`,css:`css`,csv:`table`,cts:`typescript`,cxx:`cpp`,db:`database`,editorconfig:`text`,env:`text`,"env.development":`text`,"env.local":`text`,"env.production":`text`,eot:`font`,erb:`ruby`,fish:`bash`,gemspec:`ruby`,gif:`image`,go:`go`,gql:`graphql`,graphql:`graphql`,gz:`zip`,h:`c`,hh:`cpp`,hpp:`cpp`,htm:`html`,html:`html`,hxx:`cpp`,icns:`image`,ico:`image`,ini:`text`,inl:`cpp`,jar:`zip`,jpeg:`image`,jpg:`image`,js:`javascript`,json:`json`,json5:`json`,jsonc:`json`,jsonl:`json`,jsx:`javascript`,ksh:`bash`,less:`css`,LICENSE:`text`,log:`text`,markdown:`markdown`,mcp:`mcp`,md:`markdown`,mdx:`markdown`,"mdx.tsx":`markdown`,mjs:`javascript`,mm:`cpp`,mts:`typescript`,ods:`table`,otf:`font`,png:`image`,postcss:`css`,py:`python`,pyi:`python`,pyw:`python`,pyx:`python`,rake:`ruby`,rar:`zip`,rb:`ruby`,rs:`rust`,rst:`text`,rtf:`text`,sass:`css`,scss:`css`,sh:`bash`,sql:`database`,sqlite:`database`,sqlite3:`database`,styl:`css`,svelte:`svelte`,svg:`svg`,swift:`swift`,tar:`zip`,tf:`terraform`,tfstate:`terraform`,tfvars:`terraform`,tgz:`zip`,tif:`image`,tiff:`image`,ts:`typescript`,tsv:`table`,tsx:`typescript`,ttf:`font`,txt:`text`,vue:`vue`,war:`zip`,wasm:`wasm`,wast:`wasm`,wat:`wasm`,webp:`image`,woff:`font`,woff2:`font`,xhtml:`html`,xls:`table`,xlsx:`table`,xz:`zip`,yaml:`yml`,yml:`yml`,zig:`zig`,zip:`zip`,zsh:`bash`},_R={jsx:`react`,sass:`sass`,scss:`sass`,tsx:`react`},vR=new Set([`bash`,`c`,`cpp`,`css`,`database`,`default`,`font`,`git`,`go`,`html`,`image`,`javascript`,`json`,`markdown`,`mcp`,`python`,`ruby`,`rust`,`swift`,`table`,`text`,`typescript`,`zip`]),yR=new Set([`complete`]);function bR(e){return mR[e===`none`?`minimal`:e]}function xR(e){return`file-tree-builtin-${e}`}function SR(e){return e!==`none`&&yR.has(e)}function CR(e,t,n){if(e===`minimal`||e===`none`)return;let r=e===`complete`,i=hR[t.toLowerCase()];if(i!=null&&(r||vR.has(i)))return i;for(let e of n){if(r){let t=_R[e];if(t!=null)return t}let t=gR[e];if(t!=null&&(r||vR.has(t)))return t}return`default`}var wR=`file-tree-container`,TR=`data-file-tree-style`,ER=`data-file-tree-unsafe-css`,DR=`data-file-tree-scrollbar-measure`,OR=`data-file-tree-scrollbar-gutter-measured`,kR=`--trees-scrollbar-gutter-measured`,AR=`header`,jR=`context-menu`,MR=`context-menu-trigger`;function NR(e){return e.spriteSheet!=null||e.remap!=null||e.byFileName!=null||e.byFileExtension!=null||e.byFileNameContains!=null}function PR(e){return e==null?{set:`complete`,colored:!0}:typeof e==`string`?{set:e,colored:!0}:{...e,set:e.set??(NR(e)?`none`:`complete`),colored:e.colored??!0}}var FR=e=>e.trim().toLowerCase(),IR=e=>e.split(`/`).at(-1)??e,LR=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 RR(e,t){return typeof e==`string`?{name:e,remappedFrom:t}:{...e,remappedFrom:t}}function zR(e){let t=PR(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(FR(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=IR(o),s=n.toLowerCase(),c=r.get(s);if(c!=null)return RR(c,e);for(let[t,n]of a)if(s.includes(t))return RR(n,e);let l=LR(n);for(let t of l){let n=i.get(t);if(n!=null)return RR(n,e)}let u=CR(t.set,n,l);if(u!=null&&t.set!==`none`)return{name:xR(u),remappedFrom:e,token:u}}let s=n?.[e];return s==null?{name:e}:RR(s,e)}}}var BR=/^#(?:[0-9a-f]{3}0|[0-9a-f]{6}00)$/i,VR=/^0(?:\.0+)?%?$/;function HR(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 UR(e){if(e==null)return!1;let t=e.trim().toLowerCase();if(t===`transparent`||BR.test(t))return!0;let n=HR(t);return n!=null&&VR.test(n)}function WR(e){return UR(e)?void 0:e}function GR(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=WR(t[`list.focusOutline`])??WR(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 KR=5,qR=1<<KR,JR=qR*4;function YR(){return{childIdByNameId:new Map,childIds:[],childPositionById:new Map,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function XR(){return{childIdByNameId:null,childIds:[],childPositionById:null,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function ZR(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 QR(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 $R(e,t){e.childPositionById!=null&&e.childPositionById.set(t,e.childIds.length),e.childIds.push(t)}function ez(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 tz(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,az(e,t)}function nz(e,t,n,r){if(e.totalChildSubtreeNodeCount+=n,e.totalChildVisibleSubtreeCount+=r,e.childVisibleChunkSums==null||r===0)return;let i=QR(e).get(t);if(i===void 0)return;let a=i>>KR;e.childVisibleChunkSums[a]+=r}function rz(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=oz(e,t,a,i);return{...r,childVisibleIndex:n-r.localVisibleIndex}}i-=o,a+=qR}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 iz(e,t,n){let r=0,i=t.childVisibleChunkSums,a=0;if(i!=null){let e=n>>KR;for(let t=0;t<e;t+=1)r+=i[t]??0;a=e<<KR}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 az(e,t){if(t.childIds.length<JR){t.childVisibleChunkSums=null;return}let n=Math.ceil(t.childIds.length/qR),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>>KR]+=a.visibleSubtreeCount)}t.childVisibleChunkSums=r}function oz(e,t,n,r){let i=Math.min(t.childIds.length,n+qR),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 sz=7,cz=3,lz=1<<cz,uz=4;function dz(e,t,n=0){return e<<uz|n<<cz|t}function fz(e){return e.depthAndFlags>>>uz}function pz(e){return(e.depthAndFlags&lz)>>cz}function mz(e){return(e.depthAndFlags&lz)!==0}function hz(e){return e.depthAndFlags&sz}function gz(e,t){return(hz(e)&t)!==0}function _z(e,t){e.depthAndFlags|=t}function vz(e,t){e.depthAndFlags=dz(t,hz(e),pz(e))}var yz=Symbol(`benchmarkInstrumentation`);function bz(e,t){return t==null||Object.defineProperty(e,yz,{configurable:!0,enumerable:!1,value:t,writable:!1}),e}function xz(e){return e==null?null:e[yz]??null}function Sz(e,t,n){return e==null?n():e.measurePhase(t,n)}function Cz(e,t,n){!Number.isFinite(n)||e==null||e.setCounter(t,n)}function wz(e){return e>=48&&e<=57}function Tz(e){let t=[],n=0,r=0;for(;r<e.length;){for(;r<e.length&&!wz(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&&wz(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 Ez(e){let t=e.toLowerCase();return{lowerValue:t,tokens:Tz(t)}}function Dz(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 Oz(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=Dz(e.tokens,t.tokens);return n===0?e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1:n}function kz(e,t,n){let r=Oz(n(e),n(t));return r===0?e===t?0:e<t?-1:1:r}function Az(e,t){return kz(e,t,Ez)}function jz(e,t){return t===e.segments.length-1?+!!e.isDirectory:1}function Mz(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=jz(e,r);return a===jz(t,r)?Az(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 Nz(e,t){return Mz(e,t)}function Pz(e,t,n){let r=e=>{let t=n.get(e);if(t!=null)return t;let r=Ez(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=jz(e,n);return o===jz(t,n)?kz(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 Fz(e,t){let n=e.sortKeyById[t];if(n!==void 0)return n;let r=e.valueById[t],i=Ez(r);return e.sortKeyById[t]=i,i}function Iz(e={}){return{flattenEmptyDirectories:e.flattenEmptyDirectories!==!1,sort:e.sort??`default`}}function Lz(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 Rz(e){let{hasTrailingSlash:t,segments:n}=Lz(e);return{basename:n[n.length-1]??``,isDirectory:t,path:e,segments:n}}function zz(e){if(e.length===0)return{requiresDirectory:!1,segments:[]};let{hasTrailingSlash:t,segments:n}=Lz(e);return{requiresDirectory:t,segments:n}}var Bz=``;function Vz(){let e=new Map;return e.set(Bz,0),{idByValue:e,valueById:[Bz],sortKeyById:[Ez(Bz)]}}function Hz(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 Uz(e,t){let n=e.valueById[t];if(n===void 0)throw Error(`Unknown segment ID: ${String(t)}`);return n}var Wz=Symbol(`pathStorePreparedInputKind`);function Gz(e,t){return e[Wz]=t,e}function Kz(e){return{basename:e.basename,depth:e.segments.length,isDirectory:e.isDirectory,path:e.path,segments:e.segments}}function qz(e,t,n){return n===`default`?Nz(e,t):n(Kz(e),Kz(t))}function Jz(){return{depthAndFlags:dz(0,3,1),nameId:0,parentId:0,subtreeNodeCount:1,visibleSubtreeCount:1}}function Yz(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 Xz(e){return e.isDirectory?e.segments.length:e.segments.length-1}function Zz(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 Qz(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function $z(e,t={}){return aB(e,t).map(e=>e.path)}function eB(e,t={}){let n=aB(e,t);return Gz({paths:n.map(e=>e.path),preparedPaths:n},`prepared`)}function tB(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 Gz({paths:e,presortedPaths:e,presortedPathsContainDirectories:n},`presorted`)}function nB(e){let t=e,n=t.preparedPaths;if(t[Wz]===`prepared`&&n!=null)return n;if(!Zz(n))throw Error(`preparedInput must come from PathStore.prepareInput()`);return n}function rB(e){let t=e;return t[Wz]===`presorted`&&t.presortedPaths!=null||Qz(t.presortedPaths)?t.presortedPaths:null}function iB(e){let t=e;return typeof t.presortedPathsContainDirectories==`boolean`?t.presortedPathsContainDirectories:null}function aB(e,t={}){let n=Iz(t),r=xz(t);Cz(r,`workload.inputFiles`,e.length);let i=Sz(r,`store.preparePathEntries.parse`,()=>e.map(e=>Rz(e)));return Sz(r,`store.preparePathEntries.sort`,()=>i.sort((e,t)=>qz(e,t,n.sort))),i}var oB=class{directories=new Map;directoryStack=[0];presortedDirectoryNodeIds=[];initialExpandedPathSet;createdDirectoriesAllExpanded=!1;createdDirectoryCount=0;lastPreparedPath=null;nodes=[Jz()];options;instrumentation;segmentSortKeyCache=new Map;segmentTable=Vz();hasDeferredDirectoryIndexes=!1;constructor(e={}){this.instrumentation=xz(e),this.options=Iz(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,YR())}appendPaths(e){return Sz(this.instrumentation,`store.builder.appendPaths.parse`,()=>this.appendPreparedPaths(e.map(e=>Rz(e))))}appendPreparedPaths(e,t=!0){return this.createdDirectoriesAllExpanded=!1,Sz(this.instrumentation,`store.builder.appendPreparedPaths`,()=>{for(let n of e)this.appendPreparedPath(n,t)}),this}appendPresortedPaths(e,t=null){return Sz(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:dz(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:dz(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:dz(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=Rz(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:dz(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:dz(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=Rz(t)),this.hasDeferredDirectoryIndexes=!0}finish(e={}){let t=e.skipSubtreeCountPass===!0;return this.hasDeferredDirectoryIndexes?(Sz(this.instrumentation,`store.builder.buildDirectoryIndexes`,()=>this.buildPresortedFinish(t)),this.hasDeferredDirectoryIndexes=!1):t||Sz(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`?Pz(this.lastPreparedPath,e,this.segmentSortKeyCache):qz(this.lastPreparedPath,e,this.options.sort))>0)throw Error(`Builder input must be sorted before appendPaths(): "${e.path}"`)}let n=this.lastPreparedPath,r=Xz(e),i=n==null?0:Xz(n),a=n==null?0:Yz(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=Hz(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:dz(fz(o)+1,0),nameId:r,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),a?.set(r,s),$R(i,s),s}createFileChildUnchecked(e,t){let n=Hz(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:dz(fz(i)+1,0),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),$R(r,a),a}getOrCreateDirectoryChild(e,t){let n=Hz(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&&!mz(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:dz(fz(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),$R(r,a),this.directories.set(a,YR()),a}createDirectoryChild(e,t){let n=Hz(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:dz(fz(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),$R(r,a),this.directories.set(a,YR()),a}promoteDirectoryToExplicit(e,t){let n=this.nodes[e];if(n===void 0)throw Error(`Unknown directory node ID: ${String(e)}`);if(!mz(n))throw Error(`Path is not a directory: "${t}"`);if(gz(n,1))throw Error(`Duplicate path: "${t}"`);_z(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,XR());let r=-1,i=null;for(let e=1;e<t.length;e++){let a=t[e];if(a==null)continue;if(mz(a)){let t=XR();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;mz(n)&&this.directories.set(t,YR());let r=this.directories.get(n.parentId);r!=null&&(r.childIdByNameId!=null&&r.childIdByNameId.set(n.nameId,t),$R(r,t))}}computeSubtreeCounts(e){let t=this.nodes[e];if(t===void 0)throw Error(`Unknown node ID: ${String(e)}`);if(!mz(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 tz(this.nodes,n),t.subtreeNodeCount=r,t.visibleSubtreeCount=r,r}};function sB(e,t=`closed`,n=null){let r=lB(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 cB(){return{affectedAncestorIds:new Set,affectedNodeIds:new Set,events:[]}}function lB(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 uB(e,t){return gz(t,2)||e.defaultExpansion===`open`?!0:e.defaultExpansion===`closed`?!1:fz(t)<=e.defaultExpansion}function dB(e,t,n=e.snapshot.nodes[t]){return n==null||!mz(n)?!1:e.directoriesOpenByDefault&&!e.hasCollapsedDirectoryOverrides?!0:e.collapsedDirectoryIds.has(t)?!1:e.expandedDirectoryIds.has(t)?!0:uB(e,n)}function fB(e,t,n,r=e.snapshot.nodes[t]){if(r==null||!mz(r))return;let i=uB(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 pB(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 mB(e,t){return e.directoryLoadInfoById.get(t)?.state??`loaded`}function hB(e,t){let n=pB(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 gB(e,t){let n=pB(e,t);n.activeAttemptId=null,n.errorMessage=null,n.state=`unloaded`}function _B(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 vB(e,t,n){return e.directoryLoadInfoById.get(t)?.activeAttemptId===n}function yB(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 bB(e,t){e.directoryLoadInfoById.delete(t)}function xB(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 SB(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`add`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function CB(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`remove`,path:e.path,projectionChanged:e.projectionChanged,recursive:e.recursive,visibleCountDelta:null}}function wB(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,from:e.from,operation:`move`,projectionChanged:e.projectionChanged,to:e.to,visibleCountDelta:null}}function TB(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`expand`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function EB(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`collapse`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function DB(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`mark-directory-unloaded`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function OB(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 kB(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 AB(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 jB(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 MB(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 NB(e,t,n){return{...n,visibleCountDelta:WB(e)-t}}function PB(e,t){let n=WB(e),r=cB();e.transactionStack.push(r);try{t()}catch(t){throw LB(e,r,!1),t}LB(e,r,!0,WB(e)-n)}function FB(e,t){let n=e.instrumentation;if(n==null){IB(e,t);return}Sz(n,`store.events.record`,()=>IB(e,t))}function IB(e,t){let n=e.transactionStack[e.transactionStack.length-1]??null;if(n==null){HB(e,t);return}n.events.push(t),VB(n,t)}function LB(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?BB(i,t):Sz(n,`store.events.batch.merge`,()=>BB(i,t));return}let a=RB(t,r),o=e.instrumentation;if(o==null){HB(e,a);return}Sz(o,`store.events.batch.commit`,()=>HB(e,a))}function RB(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 zB(e,t){for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n);for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n)}function BB(e,t){for(let n of t.events)e.events.push(n);zB(e,t)}function VB(e,t){for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n);for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n)}function HB(e,t){let n=e.instrumentation;if(n==null){UB(e,t);return}Sz(n,`store.events.emit`,()=>UB(e,t))}function UB(e,t){e.listeners.get(t.operation)?.forEach(e=>e(t)),e.listeners.get(`*`)?.forEach(e=>e(t))}function WB(e){return e.snapshot.nodes[e.snapshot.rootId]?.visibleSubtreeCount??0}function GB(e,t){if(e.snapshot.options.flattenEmptyDirectories!==!0)return null;let n=e.snapshot.nodes[t];if(n==null||!mz(n)||gz(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||!mz(a)?null:i}function KB(e,t){let n=t;for(;;){let t=GB(e,n);if(t==null)return n;n=t}}function qB(e,t){let n=[t],r=t;for(;;){let t=GB(e,r);if(t==null)return n;n.push(t),r=t}}function JB(e,t){let n=t==null?e.snapshot.rootId:iV(e,t);return n==null?[]:cV(e,n)}function YB(e,t){let n=Rz(t),r=n.isDirectory?n.segments:n.segments.slice(0,-1),i=CV(e,SV(e,r)),{createdNodeIds:a,directoryId:o}=lV(e,r),s=new Set(a),c=o;if(n.isDirectory){let n=sV(e,o);if(gz(n,1))throw Error(`Path already exists: "${t}"`);_z(n,1),e.pathCacheByNodeId.set(o,{path:t,version:e.pathCacheVersion}),s.add(o)}else c=dV(e,o,n.basename),s.add(c);tV(e,o);let l=CV(e,o);return SB({affectedAncestorIds:rV(e,c),affectedNodeIds:[...s],path:t,projectionChanged:wV(i,l)})}function XB(e,t,n){let r=iV(e,t);if(r==null)throw Error(`Path does not exist: "${t}"`);let i=sV(e,r);if(gz(i,2))throw Error(`The root node cannot be removed`);if(mz(i)&&oV(e,r).childIds.length>0&&n.recursive!==!0)throw Error(`Cannot remove a non-empty directory without recursive: "${t}"`);let a=i.parentId,o=CV(e,a),s=bV(e,r);mV(e,a,r,i.nameId),xV(e,a),tV(e,a);let c=CV(e,a);return CB({affectedAncestorIds:rV(e,a),affectedNodeIds:s,path:t,projectionChanged:wV(o,c),recursive:n.recursive===!0})}function ZB(e,t,n,r){let i=iV(e,t);if(i==null)throw Error(`Source path does not exist: "${t}"`);let a=sV(e,i);if(gz(a,2))throw Error(`The root node cannot be moved`);let o=r.collision??`error`,s=vV(e,i,n),c=CV(e,a.parentId),l=CV(e,s.parentId),u=Uz(e.snapshot.segmentTable,a.nameId),d=Hz(e.snapshot.segmentTable,s.basename);if(s.parentId===a.parentId&&u===s.basename)return null;if(mz(a)&&OV(e,i,s.parentId))throw Error(`Cannot move a directory into one of its descendants`);let f=ZR(e.snapshot.nodes,oV(e,s.parentId)).get(d),p=s.existingNodeId??f??null;if(p!=null&&p!==i&&yV(e,p,o,pz(a))===`skip`)return null;let m=a.parentId;mV(e,m,i,a.nameId),a.parentId=s.parentId,a.nameId=d,e.pathCacheByNodeId.delete(i),DV(e,i),pV(e,s.parentId,i),xV(e,m),e.pathCacheVersion++,tV(e,m),s.parentId!==m&&tV(e,s.parentId);let h=CV(e,m),g=CV(e,s.parentId);return wB({affectedAncestorIds:[...new Set([...rV(e,m),...rV(e,s.parentId)])],affectedNodeIds:[i],from:t,projectionChanged:TV([c,l],[h,g]),to:eV(e,i)})}function QB(e,t){let n=e.pathCacheByNodeId.get(t);return n!=null&&n.version===e.pathCacheVersion?n.path:null}function $B(e,t,n){return e.pathCacheByNodeId.set(t,{path:n,version:e.pathCacheVersion}),n}function eV(e,t){let n=sV(e,t),r=QB(e,t);if(r!=null)return r;if(gz(n,2))return $B(e,t,``);let i=eV(e,n.parentId),a=Uz(e.snapshot.segmentTable,n.nameId),o=i.length===0?a:`${i}${a}`;return $B(e,t,mz(n)?`${o}/`:o)}function tV(e,t){let n=e.instrumentation;if(n==null){AV(e,t);return}Sz(n,`store.recomputeCountsUpwardFrom`,()=>AV(e,t))}function nV(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||!mz(o)){kV(e,a,o,!0),n.pop();continue}let s=i.get(a);if(s==null||t[1]>=s.childIds.length){kV(e,a,o,!0),n.pop();continue}let c=s.childIds[t[1]++];n.push([c,0])}}function rV(e,t){let n=[],r=t;for(;r!=null;){let t=sV(e,r);if(n.push(r),r===e.snapshot.rootId)break;r=t.parentId}return n}function iV(e,t){if(t.length===0)return e.snapshot.rootId;let n=zz(t);return aV(e,n.segments,n.requiresDirectory)}function aV(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=oV(e,r),a=ZR(e.snapshot.nodes,i).get(t);if(a===void 0)return null;r=a}let i=sV(e,r);return n&&!mz(i)?null:r}function oV(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 sV(e,t){let n=e.snapshot.nodes[t];if(n===void 0||gz(n,4))throw Error(`Unknown node ID: ${String(t)}`);return n}function cV(e,t){let n=e.snapshot.nodes[t];if(n===void 0||gz(n,4))return[];if(!mz(n))return[eV(e,t)];if(oV(e,t).childIds.length===0)return gz(n,1)&&!gz(n,2)?[eV(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||gz(n,4)){i.pop();continue}if(!mz(n)){r.push(eV(e,t.nodeId)),i.pop();continue}let a=oV(e,t.nodeId);if(a.childIds.length===0){gz(n,1)&&!gz(n,2)&&r.push(eV(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 lV(e,t){let n=[],r=e.snapshot.rootId;for(let i of t){let t=Hz(e.snapshot.segmentTable,i),a=oV(e,r),o=ZR(e.snapshot.nodes,a).get(t);if(o!==void 0){if(!mz(sV(e,o)))throw Error(`Cannot create a directory that collides with an existing file: "${i}"`);r=o;continue}r=uV(e,r,t),n.push(r)}return{createdNodeIds:n,directoryId:r}}function uV(e,t,n){let r=sV(e,t),i=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:dz(fz(r)+1,0,1),nameId:n,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),e.snapshot.directories.set(i,YR()),pV(e,t,i),e.collapseNewDirectoriesByDefault&&(e.collapsedDirectoryIds.add(i),e.hasCollapsedDirectoryOverrides=!0),e.activeNodeCount++,i}function dV(e,t,n){let r=Hz(e.snapshot.segmentTable,n),i=oV(e,t);if(ZR(e.snapshot.nodes,i).has(r))throw Error(`Path already exists: "${MV(e,t,n)}"`);let a=sV(e,t),o=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:dz(fz(a)+1,0),nameId:r,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),pV(e,t,o),e.activeNodeCount++,o}function fV(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}hV(e,n,o)<0?i=a:r=a+1}return r}function pV(e,t,n){let r=oV(e,t),i=sV(e,n);ZR(e.snapshot.nodes,r).set(i.nameId,n),nz(r,n,i.subtreeNodeCount,i.visibleSubtreeCount);let a=fV(e,r,n);r.childIds.splice(a,0,n),ez(r,a),az(e.snapshot.nodes,r)}function mV(e,t,n,r){let i=oV(e,t),a=QR(i),o=a.get(n)??-1;ZR(e.snapshot.nodes,i).delete(r),a.delete(n);let s=e.snapshot.nodes[n];s!=null&&nz(i,n,-s.subtreeNodeCount,-s.visibleSubtreeCount),o>=0&&(i.childIds.splice(o,1),ez(i,o),az(e.snapshot.nodes,i))}function hV(e,t,n){let r=e.snapshot.options.sort;return r===`default`?gV(e,t,n):r(_V(e,t),_V(e,n))}function gV(e,t,n){let r=sV(e,t),i=sV(e,n),a=mz(r);if(a!==mz(i))return a?-1:1;let o=Oz(Fz(e.snapshot.segmentTable,r.nameId),Fz(e.snapshot.segmentTable,i.nameId));if(o!==0)return o;let s=Uz(e.snapshot.segmentTable,r.nameId),c=Uz(e.snapshot.segmentTable,i.nameId);return s===c?t<n?-1:1:s<c?-1:1}function _V(e,t){let n=sV(e,t),r=eV(e,t),i=mz(n),a=i?r.slice(0,-1):r;return{basename:Uz(e.snapshot.segmentTable,n.nameId),depth:fz(n),isDirectory:i,path:r,segments:a.length===0?[]:a.split(`/`)}}function vV(e,t,n){let r=sV(e,t),i=iV(e,n);if(i!=null){let t=sV(e,i);if(mz(t))return{basename:Uz(e.snapshot.segmentTable,r.nameId),existingNodeId:null,parentId:i};let a=zz(n).segments;return{basename:a[a.length-1]??``,existingNodeId:i,parentId:t.parentId}}let a=zz(n),o=a.segments[a.segments.length-1]??``,s=a.segments.slice(0,-1),c=s.length===0?e.snapshot.rootId:aV(e,s,!0);if(c==null)throw Error(`Destination parent does not exist: "${n}"`);return{basename:o,existingNodeId:null,parentId:c}}function yV(e,t,n,r){if(n===`skip`)return`skip`;if(n===`error`)throw Error(`Destination already exists: "${eV(e,t)}"`);let i=sV(e,t);if(pz(i)!==r)throw Error(`replace collision requires the same source and destination kinds`);if(mz(i)&&oV(e,t).childIds.length>0)throw Error(`replace collision does not support non-empty directories`);let a=i.parentId,o=i.nameId;return bV(e,t),mV(e,a,t,o),xV(e,a),tV(e,a),`handled`}function bV(e,t){let n=[],r=[{nodeId:t,visitedChildren:!1}];for(;r.length>0;){let t=r.pop();if(t==null)break;let i=sV(e,t.nodeId);if(t.visitedChildren||!mz(i)){mz(i)&&e.snapshot.directories.delete(t.nodeId),_z(i,4),e.pathCacheByNodeId.delete(t.nodeId),e.collapsedDirectoryIds.delete(t.nodeId)&&(e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0),e.expandedDirectoryIds.delete(t.nodeId),bB(e,t.nodeId),e.activeNodeCount--,n.push(t.nodeId);continue}r.push({nodeId:t.nodeId,visitedChildren:!0});let a=oV(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 xV(e,t){let n=t;for(;n!=null;){let t=sV(e,n);if(!mz(t)||gz(t,2)||oV(e,n).childIds.length>0)return;_z(t,1),n=t.parentId===n?null:t.parentId}}function SV(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=ZR(e.snapshot.nodes,oV(e,n)).get(t);if(i==null||!mz(sV(e,i)))break;n=i}return n}function CV(e,t){let n=EV(e,t);if(n==null)return null;let r=KB(e,n),i=sV(e,r),a=n===r?null:qB(e,n).map(t=>eV(e,t));return JSON.stringify({flattenedSegmentPaths:a,hasChildren:oV(e,r).childIds.length>0,path:eV(e,r),terminalKind:pz(i)})}function wV(e,t){return TV([e],[t])}function TV(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 EV(e,t){let n=t;for(;n!=null;){let t=sV(e,n);if(!mz(t)||gz(t,2))return null;if(!dB(e,n,t))return n;n=t.parentId}return null}function DV(e,t){let n=sV(e,t);if(vz(n,(t===e.snapshot.rootId?-1:fz(sV(e,n.parentId)))+1),!mz(n))return;let r=oV(e,t);for(let t of r.childIds)DV(e,t)}function OV(e,t,n){let r=n;for(;r!=null;){if(r===t)return!0;let n=sV(e,r);if(r===e.snapshot.rootId)return!1;r=n.parentId}return!1}function kV(e,t,n=sV(e,t),r=!1){let i=e.instrumentation;if(i==null){jV(e,t,n,r);return}Sz(i,`store.recomputeNodeCounts`,()=>jV(e,t,n,r))}function AV(e,t){let n=t;for(;n!=null;){let t=sV(e,n),r=t.subtreeNodeCount,i=t.visibleSubtreeCount;if(kV(e,n,t),n===e.snapshot.rootId)return;let a=t.subtreeNodeCount-r,o=t.visibleSubtreeCount-i,s=t.parentId;(a!==0||o!==0)&&nz(oV(e,s),n,a,o),n=s}}function jV(e,t,n,r){if(!mz(n)){n.subtreeNodeCount=1,n.visibleSubtreeCount=1;return}let i=oV(e,t);if(r){let t=e.instrumentation;t==null?tz(e.snapshot.nodes,i):Sz(t,`store.recomputeNodeCounts.rebuildChildAggregates`,()=>tz(e.snapshot.nodes,i))}let a=1+i.totalChildSubtreeNodeCount,o=i.totalChildVisibleSubtreeCount;if(n.subtreeNodeCount=a,gz(n,2)){n.visibleSubtreeCount=o;return}n.visibleSubtreeCount=GB(e,t)==null?dB(e,t,n)?1+o:1:o}function MV(e,t,n){let r=eV(e,t);return r.length===0?n:`${r}${n}`}function NV(e){return e!=null&&!gz(e,4)}function PV(e,t){let n=e.snapshot.nodes[t];return!NV(n)||!mz(n)||gz(n,2)?null:n}function FV(e){let t=0;for(let[n,r]of e.pathCacheByNodeId)r.version===e.pathCacheVersion&&NV(e.snapshot.nodes[n])&&(t+=1);return t}function IV(e){return Math.max(0,e.valueById.length-1)}function LV(e){return{activeNodeCount:e.activeNodeCount,cachedPathEntryCount:FV(e),loadInfoEntryCount:e.directoryLoadInfoById.size,segmentCount:IV(e.snapshot.segmentTable),totalNodeSlotCount:Math.max(0,e.snapshot.nodes.length-1)}}function RV(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 zV(e){let t=[],n=[];for(let n of e.collapsedDirectoryIds)PV(e,n)!=null&&t.push(eV(e,n));for(let t of e.expandedDirectoryIds)PV(e,t)!=null&&n.push(eV(e,t));return{collapsedPaths:t,expandedPaths:n}}function BV(e){let t=[];for(let[n,r]of e.directoryLoadInfoById)PV(e,n)==null||mB(e,n)===`loaded`||t.push({info:{activeAttemptId:null,errorMessage:r.errorMessage,nextAttemptId:r.nextAttemptId,state:r.state},path:eV(e,n)});return t}function VV(e,t){e.collapsedDirectoryIds.clear(),e.hasCollapsedDirectoryOverrides=!1,e.expandedDirectoryIds.clear();for(let n of t.expandedPaths){let t=iV(e,n);t!=null&&fB(e,t,!0,sV(e,t))}for(let n of t.collapsedPaths){let t=iV(e,n);t!=null&&fB(e,t,!1,sV(e,t))}}function HV(e,t){e.directoryLoadInfoById.clear();for(let n of t){let t=iV(e,n.path);t!=null&&PV(e,t)!=null&&e.directoryLoadInfoById.set(t,{activeAttemptId:null,errorMessage:n.info.errorMessage,nextAttemptId:n.info.nextAttemptId,state:n.info.state})}}function UV(e){e.pathCacheVersion+=1,e.pathCacheByNodeId.clear(),e.pathCacheByNodeId.set(e.snapshot.rootId,{path:``,version:e.pathCacheVersion})}function WV(e){let t=e.snapshot.segmentTable,n=Vz();for(let r of e.snapshot.nodes)if(NV(r)){if(gz(r,2)){r.nameId=0;continue}r.nameId=Hz(n,Uz(t,r.nameId))}e.snapshot.segmentTable=n}function GV(e){for(let[t,n]of e.snapshot.directories){let r=e.snapshot.nodes[t];if(!NV(r)||!mz(r)){e.snapshot.directories.delete(t);continue}let i=n.childIds.filter(n=>{let r=e.snapshot.nodes[n];return NV(r)&&r.parentId===t});n.childIds=i,n.childIdByNameId=new Map(i.map(t=>[sV(e,t).nameId,t])),n.childPositionById=new Map(i.map((e,t)=>[e,t])),tz(e.snapshot.nodes,n)}}function KV(e){let t=e.snapshot.nodes.length-1;for(;t>e.snapshot.rootId;){let n=e.snapshot.nodes[t];if(NV(n))break;--t}e.snapshot.nodes.length=t+1}function qV(e){let t=zV(e),n=BV(e);Sz(e.instrumentation,`store.cleanup.stable.clearPathCaches`,()=>UV(e)),Sz(e.instrumentation,`store.cleanup.stable.rebuildSegmentTable`,()=>WV(e)),Sz(e.instrumentation,`store.cleanup.stable.rebuildDirectoryIndexes`,()=>GV(e)),Sz(e.instrumentation,`store.cleanup.stable.trimTrailingRemovedNodeSlots`,()=>KV(e)),Sz(e.instrumentation,`store.cleanup.stable.restoreExpansionOverrides`,()=>VV(e,t)),Sz(e.instrumentation,`store.cleanup.stable.restoreDirectoryLoadInfos`,()=>HV(e,n)),Sz(e.instrumentation,`store.cleanup.stable.recomputeCounts`,()=>nV(e,e.snapshot.rootId))}function JV(e){let t=zV(e),n=BV(e),r=Sz(e.instrumentation,`store.cleanup.aggressive.listPaths`,()=>JB(e)),i=bz({...e.snapshot.options},e.instrumentation),a=Sz(e.instrumentation,`store.cleanup.aggressive.rebuildSnapshot`,()=>{let e=new oB(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,Sz(e.instrumentation,`store.cleanup.aggressive.restoreExpansionOverrides`,()=>VV(e,t)),Sz(e.instrumentation,`store.cleanup.aggressive.restoreDirectoryLoadInfos`,()=>HV(e,n)),Sz(e.instrumentation,`store.cleanup.aggressive.recomputeCounts`,()=>nV(e,e.snapshot.rootId))}function YV(e){for(let t of e.directoryLoadInfoById.values())if(t.state===`loading`&&t.activeAttemptId!=null)return!0;return!1}function XV(e,t){let n=LV(e);t===`stable`?Sz(e.instrumentation,`store.cleanup.stable`,()=>qV(e)):Sz(e.instrumentation,`store.cleanup.aggressive`,()=>JV(e));let r=LV(e);return RV(t,t===`stable`,n,r)}var ZV=64;function QV(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 $V(e){return sV(e,e.snapshot.rootId).visibleSubtreeCount}function eH(e,t,n,r){let i=sV(e,t.terminalNodeId),a=Math.max(1,i.visibleSubtreeCount);return Math.min(r-1,n+a-1)}function tH(e,t,n,r){return{ancestorPaths:r,index:t.index,posInSet:t.posInSet,row:bH(e,t.cursor),setSize:t.setSize,subtreeEndIndex:eH(e,t.cursor,t.index,n)}}function nH(e,t,n,r,i,a){let o=oV(e,t),{childIndex:s,childVisibleIndex:c,localVisibleIndex:l}=rz(e.snapshot.nodes,o,n),u=o.childIds[s];if(u==null)throw Error(`Visible index ${String(n)} is out of range`);return rH(e,u,l,r+c,i+1,s,o.childIds.length,a)}function rH(e,t,n,r,i,a,o,s){if(!mz(sV(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=mH(e,t,i);if(n===0)return{ancestors:s,cursor:c,index:r,posInSet:a,setSize:o};let l=sV(e,c.terminalNodeId);if(!mz(l)||!dB(e,c.terminalNodeId,l))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return nH(e,c.terminalNodeId,n-1,r+1,c.visibleDepth,[...s,{cursor:c,index:r,posInSet:a,setSize:o}])}function iH(e,t){let n=$V(e);if(t<0||t>=n)return null;let r=nH(e,e.snapshot.rootId,t,0,-1,[]),i=r.ancestors.map(t=>eV(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=tH(e,a,n,[...i]);t.push(r),i.push(r.row.path)}return a=t,a},index:r.index,posInSet:r.posInSet,row:bH(e,r.cursor),setSize:r.setSize,subtreeEndIndex:eH(e,r.cursor,r.index,n)}}function aH(e,t,n){let r=e.instrumentation,i=$V(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 yH(e,o+1);let t=[],n=dH(e,a);for(let r=a;r<=o&&n!=null;r++){let r=bH(e,n);t.push(r),n=gH(e,n)}return t}let s=[],c=0,l=0,u=Sz(r,`store.getVisibleSlice.selectFirstRow`,()=>dH(e,a));for(let t=a;t<=o&&u!=null;t++){let t=Sz(r,`store.getVisibleSlice.materializeRow`,()=>bH(e,u));s.push(t),t.isFlattened&&(c++,l+=t.flattenedSegments?.length??0),u=Sz(r,`store.getVisibleSlice.advanceCursor`,()=>gH(e,u))}return Cz(r,`workload.visibleRowsRead`,s.length),Cz(r,`workload.flattenedRowsRead`,c),Cz(r,`workload.flattenedSegmentsRead`,l),s}function oH(e,t=$V(e)){let n=e.instrumentation;return n==null?vH(e,t):Sz(n,`store.getVisibleTreeProjection`,()=>vH(e,t))}function sH(e){return _H(oH(e))}function cH(e,t){let n=iV(e,t);if(n==null||n===e.snapshot.rootId||mz(sV(e,n))&&KB(e,n)!==n)return null;let r=0,i=n,{nodes:a,rootId:o}=e.snapshot;for(;i!==o;){let t=sV(e,i).parentId,n=oV(e,t),s=QR(n).get(i);if(s==null)throw Error(`Child ${String(i)} was not found in its parent index`);if(r+=iz(a,n,s),t!==o){let n=sV(e,t),a=GB(e,t);if(!dB(e,t,n)&&a!==i)return null;KB(e,t)===t&&(r+=1)}i=t}return r}function lH(e,t){let n=iV(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=sV(e,n);if(!mz(r))throw Error(`Path is not a directory: "${t}"`);return dB(e,n,r)?null:(fB(e,n,!0,r),tV(e,n),TB({affectedAncestorIds:rV(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0}))}function uH(e,t){let n=iV(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=sV(e,n);if(!mz(r))throw Error(`Path is not a directory: "${t}"`);return dB(e,n,r)?(fB(e,n,!1,r),tV(e,n),EB({affectedAncestorIds:rV(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0})):null}function dH(e,t){return t<0||t>=$V(e)?null:fH(e,e.snapshot.rootId,t,-1)}function fH(e,t,n,r){let i=oV(e,t),a=e.instrumentation,{childIndex:o,localVisibleIndex:s}=a==null?rz(e.snapshot.nodes,i,n):Sz(a,`store.getVisibleSlice.selectChildIndex`,()=>rz(e.snapshot.nodes,i,n)),c=i.childIds[o];if(c!=null)return pH(e,c,s,r+1);throw Error(`Visible index ${String(n)} is out of range`)}function pH(e,t,n,r){if(!mz(sV(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=mH(e,t,r);if(n===0)return i;let a=sV(e,i.terminalNodeId);if(!mz(a)||!dB(e,i.terminalNodeId,a))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return fH(e,i.terminalNodeId,n-1,i.visibleDepth)}function mH(e,t,n){return mz(sV(e,t))?e.instrumentation==null?{headNodeId:t,terminalNodeId:KB(e,t),visibleDepth:n}:{headNodeId:t,terminalNodeId:Sz(e.instrumentation,`store.getVisibleSlice.flatten.resolveTerminalDirectory`,()=>KB(e,t)),visibleDepth:n}:{headNodeId:t,terminalNodeId:t,visibleDepth:n}}function hH(e,t){let n=sV(e,t);if(!mz(n))return!0;let r=n.parentId;return r===e.snapshot.rootId?!0:GB(e,r)!==t}function gH(e,t){let n=sV(e,t.terminalNodeId);if(mz(n)){let r=oV(e,t.terminalNodeId);if(dB(e,t.terminalNodeId,n)&&r.childIds.length>0){let n=r.childIds[0];return n==null?null:pH(e,n,0,t.visibleDepth+1)}}let r=t.terminalNodeId,i=t.visibleDepth;for(;;){let t=sV(e,r);if(r===e.snapshot.rootId)return null;let n=t.parentId,a=oV(e,n),o=QR(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 pH(e,s,0,i);hH(e,r)&&i--,r=n}}function _H(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 vH(e,t){let n=Array(t),r=new Int32Array(t),i=new Int32Array(t),a=new Int32Array(t),o=new Int32Array(ZV);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=QV(o,y);let x,S=_;if(mz(v))S=f?KB(e,_):_,x=S===_?`${b}${h[v.nameId]}/`:eV(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&&mz(C)&&dB(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 yH(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(!mz(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:eV(e,f)};continue}let h=l?KB(e,f):f,g={headNodeId:f,terminalNodeId:h,visibleDepth:m};n[r++]=bH(e,g);let _=i[h];_!=null&&mz(_)&&dB(e,h,_)&&s.push([a.get(h),0,m])}return r<t&&(n.length=r),n}function bH(e,t){let n=sV(e,t.terminalNodeId),r=mz(n)?xH(e,t):null,i=eV(e,t.terminalNodeId),a=Uz(e.snapshot.segmentTable,n.nameId),o=mz(n)&&oV(e,t.terminalNodeId).childIds.length>0,s=t.headNodeId!==t.terminalNodeId,c=e.instrumentation,l=s?c==null?qB(e,t.headNodeId).map(n=>{let r=sV(e,n);return{isTerminal:n===t.terminalNodeId,name:Uz(e.snapshot.segmentTable,r.nameId),nodeId:n,path:eV(e,n)}}):Sz(c,`store.getVisibleSlice.flatten.collectSegments`,()=>qB(e,t.headNodeId).map(n=>{let r=sV(e,n);return{isTerminal:n===t.terminalNodeId,name:Uz(e.snapshot.segmentTable,r.nameId),nodeId:n,path:eV(e,n)}})):void 0;return{depth:t.visibleDepth,flattenedSegments:l,hasChildren:o,id:t.terminalNodeId,isExpanded:mz(n)&&dB(e,t.terminalNodeId,n),isFlattened:s,isLoading:r===`loading`,kind:mz(n)?`directory`:`file`,loadState:r==null||r===`loaded`?void 0:r,name:a,path:i}}function xH(e,t){if(t.headNodeId===t.terminalNodeId)return mB(e,t.terminalNodeId);let n=qB(e,t.headNodeId),r=!1,i=!1;for(let t of n){let n=mB(e,t);if(n===`loading`)return`loading`;if(n===`error`){i=!0;continue}n===`unloaded`&&(r=!0)}return i?`error`:r?`unloaded`:`loaded`}function SH(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||!mz(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&&az(n,i),r.subtreeNodeCount=1+c;let u;if(o&&s===1){let e=n[a[0]];u=e!=null&&mz(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,az(n,l),c.subtreeNodeCount=1+d,c.visibleSubtreeCount=f}function CH(e){return e.initialExpansion===`open`&&(e.initialExpandedPaths==null||e.initialExpandedPaths.length===0)}var wH=class e{#e;constructor(e={}){let t=xz(e),n=Sz(t,`store.builder.create`,()=>new oB(e));if(e.preparedInput!=null){let t=rB(e.preparedInput);t==null?n.appendPreparedPaths(nB(e.preparedInput),!1):n.appendPresortedPaths(t,iB(e.preparedInput))}else{let r=e.paths??[];e.presorted===!0?n.appendPaths(r):n.appendPreparedPaths(Sz(t,`store.preparePathEntries`,()=>aB(r,e)))}let r=Sz(t,`store.builder.finish`,()=>n.finish({skipSubtreeCountPass:!0})),i=Sz(t,`store.state.detectAllDirectoriesExpanded`,()=>(e.initialExpansion??`closed`)===`closed`&&n.didMatchAllInitialExpandedPaths());this.#e=Sz(t,`store.state.create`,()=>sB(r,i?`open`:e.initialExpansion??`closed`,t)),i&&(this.#e.collapseNewDirectoriesByDefault=!0);let a=i?this.#e.snapshot.directories.size-1:Sz(t,`store.state.initializeExpandedPaths`,()=>this.initializeExpandedPaths(e.initialExpandedPaths));i||CH(e)||(e.initialExpansion??`closed`)===`closed`&&a===this.#e.snapshot.directories.size-1||(e.initialExpandedPaths?.length??0)>0&&Sz(t,`store.state.checkAllDirectoriesExpanded`,()=>this.hasAllDirectoriesExpanded())?Sz(t,`store.state.initializeOpenVisibleCounts`,()=>SH(this.#e)):Sz(t,`store.state.recomputeCounts`,()=>nV(this.#e,this.#e.snapshot.rootId))}static preparePaths(e,t={}){return $z(e,t)}static prepareInput(e,t={}){return eB(e,t)}static preparePresortedInput(e){return tB(e)}list(e){return Sz(this.#e.instrumentation,`store.list`,()=>JB(this.#e,e))}add(e){Sz(this.#e.instrumentation,`store.add`,()=>{let t=$V(this.#e);FB(this.#e,NB(this.#e,t,YB(this.#e,e)))})}remove(e,t={}){Sz(this.#e.instrumentation,`store.remove`,()=>{let n=$V(this.#e);FB(this.#e,NB(this.#e,n,XB(this.#e,e,t)))})}move(e,t,n={}){Sz(this.#e.instrumentation,`store.move`,()=>{let r=$V(this.#e),i=ZB(this.#e,e,t,n);i!=null&&FB(this.#e,NB(this.#e,r,i))})}batch(e){PB(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 Sz(this.#e.instrumentation,`store.getVisibleCount`,()=>$V(this.#e))}getVisibleSlice(e,t){return Sz(this.#e.instrumentation,`store.getVisibleSlice`,()=>aH(this.#e,e,t))}getVisibleRowContext(e){return Sz(this.#e.instrumentation,`store.getVisibleRowContext`,()=>iH(this.#e,e))}getVisibleTreeProjection(){return sH(this.#e)}getVisibleTreeProjectionData(e){return oH(this.#e,e)}getVisibleIndex(e){return Sz(this.#e.instrumentation,`store.getVisibleIndex`,()=>cH(this.#e,e))}getPathInfo(e){return Sz(this.#e.instrumentation,`store.getPathInfo`,()=>{let t=iV(this.#e,e);if(t==null)return null;let n=sV(this.#e,t);return{depth:fz(n),kind:mz(n)?`directory`:`file`,path:eV(this.#e,t)}})}isExpanded(e){return Sz(this.#e.instrumentation,`store.isExpanded`,()=>{let t=this.requireDirectoryNodeId(e),n=sV(this.#e,t);return dB(this.#e,t,n)})}expand(e){Sz(this.#e.instrumentation,`store.expand`,()=>{let t=$V(this.#e),n=lH(this.#e,e);n!=null&&FB(this.#e,NB(this.#e,t,n))})}collapse(e){Sz(this.#e.instrumentation,`store.collapse`,()=>{let t=$V(this.#e),n=uH(this.#e,e);n!=null&&FB(this.#e,NB(this.#e,t,n))})}on(e,t){return xB(this.#e,e,t)}getDirectoryLoadState(e){let t=this.requireDirectoryNodeId(e);return mB(this.#e,t)}markDirectoryUnloaded(e){Sz(this.#e.instrumentation,`store.markDirectoryUnloaded`,()=>{let t=this.requireDirectoryNodeId(e);if(oV(this.#e,t).childIds.length>0)throw Error(`Cannot mark a directory with known children as unloaded: "${e}"`);let n=$V(this.#e);gB(this.#e,t),FB(this.#e,NB(this.#e,n,DB({affectedAncestorIds:rV(this.#e,t),affectedNodeIds:[t],path:e,projectionChanged:this.isDirectoryProjectionVisible(t)})))})}beginChildLoad(e){return Sz(this.#e.instrumentation,`store.beginChildLoad`,()=>{let t=this.requireDirectoryNodeId(e),n=$V(this.#e),r=hB(this.#e,t);return FB(this.#e,NB(this.#e,n,OB({affectedAncestorIds:rV(this.#e,t),affectedNodeIds:[t],attemptId:r.attemptId,path:e,projectionChanged:this.isDirectoryProjectionVisible(t),reused:r.reused}))),r})}applyChildPatch(e,t){return Sz(this.#e.instrumentation,`store.applyChildPatch`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null||mB(this.#e,n)!==`loading`||!vB(this.#e,n,e.attemptId))return!1;let r=eV(this.#e,n);this.validateChildPatch(r,t);let i=$V(this.#e),a=[];for(let e of t.operations){TH(r,e);let t=$V(this.#e);switch(e.type){case`add`:a.push(NB(this.#e,t,YB(this.#e,e.path)));break;case`remove`:a.push(NB(this.#e,t,XB(this.#e,e.path,{recursive:e.recursive})));break;case`move`:{let n=ZB(this.#e,e.from,e.to,{collision:e.collision});n!=null&&a.push(NB(this.#e,t,n));break}}}let o=a.some(e=>e.projectionChanged)||this.isDirectoryProjectionVisible(n);return FB(this.#e,NB(this.#e,i,kB({affectedAncestorIds:rV(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,childEvents:a,path:eV(this.#e,n),projectionChanged:o}))),!0})}completeChildLoad(e){return Sz(this.#e.instrumentation,`store.completeChildLoad`,()=>{let t=this.resolveActiveDirectoryNodeId(e.nodeId);if(t==null)return!1;let n=$V(this.#e),r=_B(this.#e,t,e.attemptId);return FB(this.#e,NB(this.#e,n,AB({affectedAncestorIds:rV(this.#e,t),affectedNodeIds:[t],attemptId:e.attemptId,path:eV(this.#e,t),projectionChanged:this.isDirectoryProjectionVisible(t),stale:!r}))),r})}failChildLoad(e,t){return Sz(this.#e.instrumentation,`store.failChildLoad`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null)return!1;let r=$V(this.#e),i=yB(this.#e,n,e.attemptId,t);return FB(this.#e,NB(this.#e,r,jB({affectedAncestorIds:rV(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,errorMessage:t,path:eV(this.#e,n),projectionChanged:this.isDirectoryProjectionVisible(n),stale:!i}))),i})}cleanup(e={}){return Sz(this.#e.instrumentation,`store.cleanup`,()=>{if(this.#e.transactionStack.length>0)throw Error(`Cleanup cannot run during an open batch or transaction.`);if(YV(this.#e))throw Error(`Cleanup cannot run while directory loads are active.`);let t=$V(this.#e),n=XV(this.#e,e.mode??`stable`);return FB(this.#e,NB(this.#e,t,MB({...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=oV(this.#e,p).childIds,_=m===d?n[m]??0:0,v=_,y,b=l.get(a)??Ez(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=Oz(Fz(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(!mz(sV(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=sV(this.#e,n);dB(this.#e,n,i)||(fB(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=sV(this.#e,e);if(!dB(this.#e,e,t))return!1}return!0}requireDirectoryNodeId(e){let t=iV(this.#e,e);if(t==null)throw Error(`Path does not exist: "${e}"`);if(!mz(sV(this.#e,t)))throw Error(`Path is not a directory: "${e}"`);return t}resolveActiveDirectoryNodeId(e){try{if(!mz(sV(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=sV(this.#e,t).parentId;if(e!==this.#e.snapshot.rootId){let n=sV(this.#e,e),r=GB(this.#e,e);if(!dB(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 TH(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 EH={compact:{itemHeight:24,factor:.8},default:{itemHeight:30,factor:1},relaxed:{itemHeight:36,factor:1.2}};function DH(e,t){if(typeof e==`number`)return{itemHeight:t??EH.default.itemHeight,factor:e};let n=EH[e??`default`];return{itemHeight:t??n.itemHeight,factor:n.factor}}var OH=EH.default.itemHeight,kH=`@layer base, theme, unsafe;
187
+ </symbol>`],hR=[gL,_L,yL,bL,xL,SL,wL,kL,AL,PL,VL,HL,UL,WL,GL,qL,XL,ZL,QL,$L,eR,rR,iR,sR,cR,lR,uR,dR,fR,pR];function gR(e,t){return t.length===0?e:e.replace(`</svg>`,`\n ${t.join(`
188
+ `)}\n</svg>`)}var _R=gR(hL,mR),vR={minimal:hL,standard:_R,complete:gR(_R,hR)},yR={".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`},bR={"7z":`zip`,astro:`astro`,AUTHORS:`text`,avif:`image`,bash:`bash`,bmp:`image`,bz2:`zip`,c:`c`,cc:`cpp`,cfg:`text`,CHANGELOG:`text`,cjs:`javascript`,"code-workspace":`vscode`,conf:`text`,CONTRIBUTORS:`text`,cpp:`cpp`,csh:`bash`,css:`css`,csv:`table`,cts:`typescript`,cxx:`cpp`,db:`database`,editorconfig:`text`,env:`text`,"env.development":`text`,"env.local":`text`,"env.production":`text`,eot:`font`,erb:`ruby`,fish:`bash`,gemspec:`ruby`,gif:`image`,go:`go`,gql:`graphql`,graphql:`graphql`,gz:`zip`,h:`c`,hh:`cpp`,hpp:`cpp`,htm:`html`,html:`html`,hxx:`cpp`,icns:`image`,ico:`image`,ini:`text`,inl:`cpp`,jar:`zip`,jpeg:`image`,jpg:`image`,js:`javascript`,json:`json`,json5:`json`,jsonc:`json`,jsonl:`json`,jsx:`javascript`,ksh:`bash`,less:`css`,LICENSE:`text`,log:`text`,markdown:`markdown`,mcp:`mcp`,md:`markdown`,mdx:`markdown`,"mdx.tsx":`markdown`,mjs:`javascript`,mm:`cpp`,mts:`typescript`,ods:`table`,otf:`font`,png:`image`,postcss:`css`,py:`python`,pyi:`python`,pyw:`python`,pyx:`python`,rake:`ruby`,rar:`zip`,rb:`ruby`,rs:`rust`,rst:`text`,rtf:`text`,sass:`css`,scss:`css`,sh:`bash`,sql:`database`,sqlite:`database`,sqlite3:`database`,styl:`css`,svelte:`svelte`,svg:`svg`,swift:`swift`,tar:`zip`,tf:`terraform`,tfstate:`terraform`,tfvars:`terraform`,tgz:`zip`,tif:`image`,tiff:`image`,ts:`typescript`,tsv:`table`,tsx:`typescript`,ttf:`font`,txt:`text`,vue:`vue`,war:`zip`,wasm:`wasm`,wast:`wasm`,wat:`wasm`,webp:`image`,woff:`font`,woff2:`font`,xhtml:`html`,xls:`table`,xlsx:`table`,xz:`zip`,yaml:`yml`,yml:`yml`,zig:`zig`,zip:`zip`,zsh:`bash`},xR={jsx:`react`,sass:`sass`,scss:`sass`,tsx:`react`},SR=new Set([`bash`,`c`,`cpp`,`css`,`database`,`default`,`font`,`git`,`go`,`html`,`image`,`javascript`,`json`,`markdown`,`mcp`,`python`,`ruby`,`rust`,`swift`,`table`,`text`,`typescript`,`zip`]),CR=new Set([`complete`]);function wR(e){return vR[e===`none`?`minimal`:e]}function TR(e){return`file-tree-builtin-${e}`}function ER(e){return e!==`none`&&CR.has(e)}function DR(e,t,n){if(e===`minimal`||e===`none`)return;let r=e===`complete`,i=yR[t.toLowerCase()];if(i!=null&&(r||SR.has(i)))return i;for(let e of n){if(r){let t=xR[e];if(t!=null)return t}let t=bR[e];if(t!=null&&(r||SR.has(t)))return t}return`default`}var OR=`file-tree-container`,kR=`data-file-tree-style`,AR=`data-file-tree-unsafe-css`,jR=`data-file-tree-scrollbar-measure`,MR=`data-file-tree-scrollbar-gutter-measured`,NR=`--trees-scrollbar-gutter-measured`,PR=`header`,FR=`context-menu`,IR=`context-menu-trigger`;function LR(e){return e.spriteSheet!=null||e.remap!=null||e.byFileName!=null||e.byFileExtension!=null||e.byFileNameContains!=null}function RR(e){return e==null?{set:`complete`,colored:!0}:typeof e==`string`?{set:e,colored:!0}:{...e,set:e.set??(LR(e)?`none`:`complete`),colored:e.colored??!0}}var zR=e=>e.trim().toLowerCase(),BR=e=>e.split(`/`).at(-1)??e,VR=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 HR(e,t){return typeof e==`string`?{name:e,remappedFrom:t}:{...e,remappedFrom:t}}function UR(e){let t=RR(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(zR(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=BR(o),s=n.toLowerCase(),c=r.get(s);if(c!=null)return HR(c,e);for(let[t,n]of a)if(s.includes(t))return HR(n,e);let l=VR(n);for(let t of l){let n=i.get(t);if(n!=null)return HR(n,e)}let u=DR(t.set,n,l);if(u!=null&&t.set!==`none`)return{name:TR(u),remappedFrom:e,token:u}}let s=n?.[e];return s==null?{name:e}:HR(s,e)}}}var WR=/^#(?:[0-9a-f]{3}0|[0-9a-f]{6}00)$/i,GR=/^0(?:\.0+)?%?$/;function KR(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 qR(e){if(e==null)return!1;let t=e.trim().toLowerCase();if(t===`transparent`||WR.test(t))return!0;let n=KR(t);return n!=null&&GR.test(n)}function JR(e){return qR(e)?void 0:e}function YR(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=JR(t[`list.focusOutline`])??JR(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 XR=5,ZR=1<<XR,QR=ZR*4;function $R(){return{childIdByNameId:new Map,childIds:[],childPositionById:new Map,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function ez(){return{childIdByNameId:null,childIds:[],childPositionById:null,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function tz(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 nz(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 rz(e,t){e.childPositionById!=null&&e.childPositionById.set(t,e.childIds.length),e.childIds.push(t)}function iz(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 az(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,lz(e,t)}function oz(e,t,n,r){if(e.totalChildSubtreeNodeCount+=n,e.totalChildVisibleSubtreeCount+=r,e.childVisibleChunkSums==null||r===0)return;let i=nz(e).get(t);if(i===void 0)return;let a=i>>XR;e.childVisibleChunkSums[a]+=r}function sz(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=uz(e,t,a,i);return{...r,childVisibleIndex:n-r.localVisibleIndex}}i-=o,a+=ZR}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 cz(e,t,n){let r=0,i=t.childVisibleChunkSums,a=0;if(i!=null){let e=n>>XR;for(let t=0;t<e;t+=1)r+=i[t]??0;a=e<<XR}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 lz(e,t){if(t.childIds.length<QR){t.childVisibleChunkSums=null;return}let n=Math.ceil(t.childIds.length/ZR),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>>XR]+=a.visibleSubtreeCount)}t.childVisibleChunkSums=r}function uz(e,t,n,r){let i=Math.min(t.childIds.length,n+ZR),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 dz=7,fz=3,pz=1<<fz,mz=4;function hz(e,t,n=0){return e<<mz|n<<fz|t}function gz(e){return e.depthAndFlags>>>mz}function _z(e){return(e.depthAndFlags&pz)>>fz}function vz(e){return(e.depthAndFlags&pz)!==0}function yz(e){return e.depthAndFlags&dz}function bz(e,t){return(yz(e)&t)!==0}function xz(e,t){e.depthAndFlags|=t}function Sz(e,t){e.depthAndFlags=hz(t,yz(e),_z(e))}var Cz=Symbol(`benchmarkInstrumentation`);function wz(e,t){return t==null||Object.defineProperty(e,Cz,{configurable:!0,enumerable:!1,value:t,writable:!1}),e}function Tz(e){return e==null?null:e[Cz]??null}function Ez(e,t,n){return e==null?n():e.measurePhase(t,n)}function Dz(e,t,n){!Number.isFinite(n)||e==null||e.setCounter(t,n)}function Oz(e){return e>=48&&e<=57}function kz(e){let t=[],n=0,r=0;for(;r<e.length;){for(;r<e.length&&!Oz(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&&Oz(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 Az(e){let t=e.toLowerCase();return{lowerValue:t,tokens:kz(t)}}function jz(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 Mz(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=jz(e.tokens,t.tokens);return n===0?e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1:n}function Nz(e,t,n){let r=Mz(n(e),n(t));return r===0?e===t?0:e<t?-1:1:r}function Pz(e,t){return Nz(e,t,Az)}function Fz(e,t){return t===e.segments.length-1?+!!e.isDirectory:1}function Iz(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=Fz(e,r);return a===Fz(t,r)?Pz(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 Lz(e,t){return Iz(e,t)}function Rz(e,t,n){let r=e=>{let t=n.get(e);if(t!=null)return t;let r=Az(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=Fz(e,n);return o===Fz(t,n)?Nz(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 zz(e,t){let n=e.sortKeyById[t];if(n!==void 0)return n;let r=e.valueById[t],i=Az(r);return e.sortKeyById[t]=i,i}function Bz(e={}){return{flattenEmptyDirectories:e.flattenEmptyDirectories!==!1,sort:e.sort??`default`}}function Vz(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 Hz(e){let{hasTrailingSlash:t,segments:n}=Vz(e);return{basename:n[n.length-1]??``,isDirectory:t,path:e,segments:n}}function Uz(e){if(e.length===0)return{requiresDirectory:!1,segments:[]};let{hasTrailingSlash:t,segments:n}=Vz(e);return{requiresDirectory:t,segments:n}}var Wz=``;function Gz(){let e=new Map;return e.set(Wz,0),{idByValue:e,valueById:[Wz],sortKeyById:[Az(Wz)]}}function Kz(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 qz(e,t){let n=e.valueById[t];if(n===void 0)throw Error(`Unknown segment ID: ${String(t)}`);return n}var Jz=Symbol(`pathStorePreparedInputKind`);function Yz(e,t){return e[Jz]=t,e}function Xz(e){return{basename:e.basename,depth:e.segments.length,isDirectory:e.isDirectory,path:e.path,segments:e.segments}}function Zz(e,t,n){return n===`default`?Lz(e,t):n(Xz(e),Xz(t))}function Qz(){return{depthAndFlags:hz(0,3,1),nameId:0,parentId:0,subtreeNodeCount:1,visibleSubtreeCount:1}}function $z(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 eB(e){return e.isDirectory?e.segments.length:e.segments.length-1}function tB(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 nB(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function rB(e,t={}){return lB(e,t).map(e=>e.path)}function iB(e,t={}){let n=lB(e,t);return Yz({paths:n.map(e=>e.path),preparedPaths:n},`prepared`)}function aB(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 Yz({paths:e,presortedPaths:e,presortedPathsContainDirectories:n},`presorted`)}function oB(e){let t=e,n=t.preparedPaths;if(t[Jz]===`prepared`&&n!=null)return n;if(!tB(n))throw Error(`preparedInput must come from PathStore.prepareInput()`);return n}function sB(e){let t=e;return t[Jz]===`presorted`&&t.presortedPaths!=null||nB(t.presortedPaths)?t.presortedPaths:null}function cB(e){let t=e;return typeof t.presortedPathsContainDirectories==`boolean`?t.presortedPathsContainDirectories:null}function lB(e,t={}){let n=Bz(t),r=Tz(t);Dz(r,`workload.inputFiles`,e.length);let i=Ez(r,`store.preparePathEntries.parse`,()=>e.map(e=>Hz(e)));return Ez(r,`store.preparePathEntries.sort`,()=>i.sort((e,t)=>Zz(e,t,n.sort))),i}var uB=class{directories=new Map;directoryStack=[0];presortedDirectoryNodeIds=[];initialExpandedPathSet;createdDirectoriesAllExpanded=!1;createdDirectoryCount=0;lastPreparedPath=null;nodes=[Qz()];options;instrumentation;segmentSortKeyCache=new Map;segmentTable=Gz();hasDeferredDirectoryIndexes=!1;constructor(e={}){this.instrumentation=Tz(e),this.options=Bz(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,$R())}appendPaths(e){return Ez(this.instrumentation,`store.builder.appendPaths.parse`,()=>this.appendPreparedPaths(e.map(e=>Hz(e))))}appendPreparedPaths(e,t=!0){return this.createdDirectoriesAllExpanded=!1,Ez(this.instrumentation,`store.builder.appendPreparedPaths`,()=>{for(let n of e)this.appendPreparedPath(n,t)}),this}appendPresortedPaths(e,t=null){return Ez(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:hz(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:hz(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:hz(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=Hz(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:hz(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:hz(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=Hz(t)),this.hasDeferredDirectoryIndexes=!0}finish(e={}){let t=e.skipSubtreeCountPass===!0;return this.hasDeferredDirectoryIndexes?(Ez(this.instrumentation,`store.builder.buildDirectoryIndexes`,()=>this.buildPresortedFinish(t)),this.hasDeferredDirectoryIndexes=!1):t||Ez(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`?Rz(this.lastPreparedPath,e,this.segmentSortKeyCache):Zz(this.lastPreparedPath,e,this.options.sort))>0)throw Error(`Builder input must be sorted before appendPaths(): "${e.path}"`)}let n=this.lastPreparedPath,r=eB(e),i=n==null?0:eB(n),a=n==null?0:$z(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=Kz(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:hz(gz(o)+1,0),nameId:r,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),a?.set(r,s),rz(i,s),s}createFileChildUnchecked(e,t){let n=Kz(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:hz(gz(i)+1,0),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),rz(r,a),a}getOrCreateDirectoryChild(e,t){let n=Kz(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&&!vz(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:hz(gz(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),rz(r,a),this.directories.set(a,$R()),a}createDirectoryChild(e,t){let n=Kz(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:hz(gz(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),rz(r,a),this.directories.set(a,$R()),a}promoteDirectoryToExplicit(e,t){let n=this.nodes[e];if(n===void 0)throw Error(`Unknown directory node ID: ${String(e)}`);if(!vz(n))throw Error(`Path is not a directory: "${t}"`);if(bz(n,1))throw Error(`Duplicate path: "${t}"`);xz(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,ez());let r=-1,i=null;for(let e=1;e<t.length;e++){let a=t[e];if(a==null)continue;if(vz(a)){let t=ez();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;vz(n)&&this.directories.set(t,$R());let r=this.directories.get(n.parentId);r!=null&&(r.childIdByNameId!=null&&r.childIdByNameId.set(n.nameId,t),rz(r,t))}}computeSubtreeCounts(e){let t=this.nodes[e];if(t===void 0)throw Error(`Unknown node ID: ${String(e)}`);if(!vz(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 az(this.nodes,n),t.subtreeNodeCount=r,t.visibleSubtreeCount=r,r}};function dB(e,t=`closed`,n=null){let r=pB(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 fB(){return{affectedAncestorIds:new Set,affectedNodeIds:new Set,events:[]}}function pB(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 mB(e,t){return bz(t,2)||e.defaultExpansion===`open`?!0:e.defaultExpansion===`closed`?!1:gz(t)<=e.defaultExpansion}function hB(e,t,n=e.snapshot.nodes[t]){return n==null||!vz(n)?!1:e.directoriesOpenByDefault&&!e.hasCollapsedDirectoryOverrides?!0:e.collapsedDirectoryIds.has(t)?!1:e.expandedDirectoryIds.has(t)?!0:mB(e,n)}function gB(e,t,n,r=e.snapshot.nodes[t]){if(r==null||!vz(r))return;let i=mB(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 _B(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 vB(e,t){return e.directoryLoadInfoById.get(t)?.state??`loaded`}function yB(e,t){let n=_B(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 bB(e,t){let n=_B(e,t);n.activeAttemptId=null,n.errorMessage=null,n.state=`unloaded`}function xB(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 SB(e,t,n){return e.directoryLoadInfoById.get(t)?.activeAttemptId===n}function CB(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 wB(e,t){e.directoryLoadInfoById.delete(t)}function TB(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 EB(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`add`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function DB(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`remove`,path:e.path,projectionChanged:e.projectionChanged,recursive:e.recursive,visibleCountDelta:null}}function OB(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,from:e.from,operation:`move`,projectionChanged:e.projectionChanged,to:e.to,visibleCountDelta:null}}function kB(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`expand`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function AB(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`collapse`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function jB(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`mark-directory-unloaded`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function MB(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 NB(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 PB(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 FB(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 IB(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 LB(e,t,n){return{...n,visibleCountDelta:JB(e)-t}}function RB(e,t){let n=JB(e),r=fB();e.transactionStack.push(r);try{t()}catch(t){throw VB(e,r,!1),t}VB(e,r,!0,JB(e)-n)}function zB(e,t){let n=e.instrumentation;if(n==null){BB(e,t);return}Ez(n,`store.events.record`,()=>BB(e,t))}function BB(e,t){let n=e.transactionStack[e.transactionStack.length-1]??null;if(n==null){KB(e,t);return}n.events.push(t),GB(n,t)}function VB(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?WB(i,t):Ez(n,`store.events.batch.merge`,()=>WB(i,t));return}let a=HB(t,r),o=e.instrumentation;if(o==null){KB(e,a);return}Ez(o,`store.events.batch.commit`,()=>KB(e,a))}function HB(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 UB(e,t){for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n);for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n)}function WB(e,t){for(let n of t.events)e.events.push(n);UB(e,t)}function GB(e,t){for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n);for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n)}function KB(e,t){let n=e.instrumentation;if(n==null){qB(e,t);return}Ez(n,`store.events.emit`,()=>qB(e,t))}function qB(e,t){e.listeners.get(t.operation)?.forEach(e=>e(t)),e.listeners.get(`*`)?.forEach(e=>e(t))}function JB(e){return e.snapshot.nodes[e.snapshot.rootId]?.visibleSubtreeCount??0}function YB(e,t){if(e.snapshot.options.flattenEmptyDirectories!==!0)return null;let n=e.snapshot.nodes[t];if(n==null||!vz(n)||bz(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||!vz(a)?null:i}function XB(e,t){let n=t;for(;;){let t=YB(e,n);if(t==null)return n;n=t}}function ZB(e,t){let n=[t],r=t;for(;;){let t=YB(e,r);if(t==null)return n;n.push(t),r=t}}function QB(e,t){let n=t==null?e.snapshot.rootId:cV(e,t);return n==null?[]:fV(e,n)}function $B(e,t){let n=Hz(t),r=n.isDirectory?n.segments:n.segments.slice(0,-1),i=DV(e,EV(e,r)),{createdNodeIds:a,directoryId:o}=pV(e,r),s=new Set(a),c=o;if(n.isDirectory){let n=dV(e,o);if(bz(n,1))throw Error(`Path already exists: "${t}"`);xz(n,1),e.pathCacheByNodeId.set(o,{path:t,version:e.pathCacheVersion}),s.add(o)}else c=hV(e,o,n.basename),s.add(c);aV(e,o);let l=DV(e,o);return EB({affectedAncestorIds:sV(e,c),affectedNodeIds:[...s],path:t,projectionChanged:OV(i,l)})}function eV(e,t,n){let r=cV(e,t);if(r==null)throw Error(`Path does not exist: "${t}"`);let i=dV(e,r);if(bz(i,2))throw Error(`The root node cannot be removed`);if(vz(i)&&uV(e,r).childIds.length>0&&n.recursive!==!0)throw Error(`Cannot remove a non-empty directory without recursive: "${t}"`);let a=i.parentId,o=DV(e,a),s=wV(e,r);vV(e,a,r,i.nameId),TV(e,a),aV(e,a);let c=DV(e,a);return DB({affectedAncestorIds:sV(e,a),affectedNodeIds:s,path:t,projectionChanged:OV(o,c),recursive:n.recursive===!0})}function tV(e,t,n,r){let i=cV(e,t);if(i==null)throw Error(`Source path does not exist: "${t}"`);let a=dV(e,i);if(bz(a,2))throw Error(`The root node cannot be moved`);let o=r.collision??`error`,s=SV(e,i,n),c=DV(e,a.parentId),l=DV(e,s.parentId),u=qz(e.snapshot.segmentTable,a.nameId),d=Kz(e.snapshot.segmentTable,s.basename);if(s.parentId===a.parentId&&u===s.basename)return null;if(vz(a)&&MV(e,i,s.parentId))throw Error(`Cannot move a directory into one of its descendants`);let f=tz(e.snapshot.nodes,uV(e,s.parentId)).get(d),p=s.existingNodeId??f??null;if(p!=null&&p!==i&&CV(e,p,o,_z(a))===`skip`)return null;let m=a.parentId;vV(e,m,i,a.nameId),a.parentId=s.parentId,a.nameId=d,e.pathCacheByNodeId.delete(i),jV(e,i),_V(e,s.parentId,i),TV(e,m),e.pathCacheVersion++,aV(e,m),s.parentId!==m&&aV(e,s.parentId);let h=DV(e,m),g=DV(e,s.parentId);return OB({affectedAncestorIds:[...new Set([...sV(e,m),...sV(e,s.parentId)])],affectedNodeIds:[i],from:t,projectionChanged:kV([c,l],[h,g]),to:iV(e,i)})}function nV(e,t){let n=e.pathCacheByNodeId.get(t);return n!=null&&n.version===e.pathCacheVersion?n.path:null}function rV(e,t,n){return e.pathCacheByNodeId.set(t,{path:n,version:e.pathCacheVersion}),n}function iV(e,t){let n=dV(e,t),r=nV(e,t);if(r!=null)return r;if(bz(n,2))return rV(e,t,``);let i=iV(e,n.parentId),a=qz(e.snapshot.segmentTable,n.nameId),o=i.length===0?a:`${i}${a}`;return rV(e,t,vz(n)?`${o}/`:o)}function aV(e,t){let n=e.instrumentation;if(n==null){PV(e,t);return}Ez(n,`store.recomputeCountsUpwardFrom`,()=>PV(e,t))}function oV(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||!vz(o)){NV(e,a,o,!0),n.pop();continue}let s=i.get(a);if(s==null||t[1]>=s.childIds.length){NV(e,a,o,!0),n.pop();continue}let c=s.childIds[t[1]++];n.push([c,0])}}function sV(e,t){let n=[],r=t;for(;r!=null;){let t=dV(e,r);if(n.push(r),r===e.snapshot.rootId)break;r=t.parentId}return n}function cV(e,t){if(t.length===0)return e.snapshot.rootId;let n=Uz(t);return lV(e,n.segments,n.requiresDirectory)}function lV(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=uV(e,r),a=tz(e.snapshot.nodes,i).get(t);if(a===void 0)return null;r=a}let i=dV(e,r);return n&&!vz(i)?null:r}function uV(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 dV(e,t){let n=e.snapshot.nodes[t];if(n===void 0||bz(n,4))throw Error(`Unknown node ID: ${String(t)}`);return n}function fV(e,t){let n=e.snapshot.nodes[t];if(n===void 0||bz(n,4))return[];if(!vz(n))return[iV(e,t)];if(uV(e,t).childIds.length===0)return bz(n,1)&&!bz(n,2)?[iV(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||bz(n,4)){i.pop();continue}if(!vz(n)){r.push(iV(e,t.nodeId)),i.pop();continue}let a=uV(e,t.nodeId);if(a.childIds.length===0){bz(n,1)&&!bz(n,2)&&r.push(iV(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 pV(e,t){let n=[],r=e.snapshot.rootId;for(let i of t){let t=Kz(e.snapshot.segmentTable,i),a=uV(e,r),o=tz(e.snapshot.nodes,a).get(t);if(o!==void 0){if(!vz(dV(e,o)))throw Error(`Cannot create a directory that collides with an existing file: "${i}"`);r=o;continue}r=mV(e,r,t),n.push(r)}return{createdNodeIds:n,directoryId:r}}function mV(e,t,n){let r=dV(e,t),i=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:hz(gz(r)+1,0,1),nameId:n,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),e.snapshot.directories.set(i,$R()),_V(e,t,i),e.collapseNewDirectoriesByDefault&&(e.collapsedDirectoryIds.add(i),e.hasCollapsedDirectoryOverrides=!0),e.activeNodeCount++,i}function hV(e,t,n){let r=Kz(e.snapshot.segmentTable,n),i=uV(e,t);if(tz(e.snapshot.nodes,i).has(r))throw Error(`Path already exists: "${IV(e,t,n)}"`);let a=dV(e,t),o=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:hz(gz(a)+1,0),nameId:r,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),_V(e,t,o),e.activeNodeCount++,o}function gV(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}yV(e,n,o)<0?i=a:r=a+1}return r}function _V(e,t,n){let r=uV(e,t),i=dV(e,n);tz(e.snapshot.nodes,r).set(i.nameId,n),oz(r,n,i.subtreeNodeCount,i.visibleSubtreeCount);let a=gV(e,r,n);r.childIds.splice(a,0,n),iz(r,a),lz(e.snapshot.nodes,r)}function vV(e,t,n,r){let i=uV(e,t),a=nz(i),o=a.get(n)??-1;tz(e.snapshot.nodes,i).delete(r),a.delete(n);let s=e.snapshot.nodes[n];s!=null&&oz(i,n,-s.subtreeNodeCount,-s.visibleSubtreeCount),o>=0&&(i.childIds.splice(o,1),iz(i,o),lz(e.snapshot.nodes,i))}function yV(e,t,n){let r=e.snapshot.options.sort;return r===`default`?bV(e,t,n):r(xV(e,t),xV(e,n))}function bV(e,t,n){let r=dV(e,t),i=dV(e,n),a=vz(r);if(a!==vz(i))return a?-1:1;let o=Mz(zz(e.snapshot.segmentTable,r.nameId),zz(e.snapshot.segmentTable,i.nameId));if(o!==0)return o;let s=qz(e.snapshot.segmentTable,r.nameId),c=qz(e.snapshot.segmentTable,i.nameId);return s===c?t<n?-1:1:s<c?-1:1}function xV(e,t){let n=dV(e,t),r=iV(e,t),i=vz(n),a=i?r.slice(0,-1):r;return{basename:qz(e.snapshot.segmentTable,n.nameId),depth:gz(n),isDirectory:i,path:r,segments:a.length===0?[]:a.split(`/`)}}function SV(e,t,n){let r=dV(e,t),i=cV(e,n);if(i!=null){let t=dV(e,i);if(vz(t))return{basename:qz(e.snapshot.segmentTable,r.nameId),existingNodeId:null,parentId:i};let a=Uz(n).segments;return{basename:a[a.length-1]??``,existingNodeId:i,parentId:t.parentId}}let a=Uz(n),o=a.segments[a.segments.length-1]??``,s=a.segments.slice(0,-1),c=s.length===0?e.snapshot.rootId:lV(e,s,!0);if(c==null)throw Error(`Destination parent does not exist: "${n}"`);return{basename:o,existingNodeId:null,parentId:c}}function CV(e,t,n,r){if(n===`skip`)return`skip`;if(n===`error`)throw Error(`Destination already exists: "${iV(e,t)}"`);let i=dV(e,t);if(_z(i)!==r)throw Error(`replace collision requires the same source and destination kinds`);if(vz(i)&&uV(e,t).childIds.length>0)throw Error(`replace collision does not support non-empty directories`);let a=i.parentId,o=i.nameId;return wV(e,t),vV(e,a,t,o),TV(e,a),aV(e,a),`handled`}function wV(e,t){let n=[],r=[{nodeId:t,visitedChildren:!1}];for(;r.length>0;){let t=r.pop();if(t==null)break;let i=dV(e,t.nodeId);if(t.visitedChildren||!vz(i)){vz(i)&&e.snapshot.directories.delete(t.nodeId),xz(i,4),e.pathCacheByNodeId.delete(t.nodeId),e.collapsedDirectoryIds.delete(t.nodeId)&&(e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0),e.expandedDirectoryIds.delete(t.nodeId),wB(e,t.nodeId),e.activeNodeCount--,n.push(t.nodeId);continue}r.push({nodeId:t.nodeId,visitedChildren:!0});let a=uV(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 TV(e,t){let n=t;for(;n!=null;){let t=dV(e,n);if(!vz(t)||bz(t,2)||uV(e,n).childIds.length>0)return;xz(t,1),n=t.parentId===n?null:t.parentId}}function EV(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=tz(e.snapshot.nodes,uV(e,n)).get(t);if(i==null||!vz(dV(e,i)))break;n=i}return n}function DV(e,t){let n=AV(e,t);if(n==null)return null;let r=XB(e,n),i=dV(e,r),a=n===r?null:ZB(e,n).map(t=>iV(e,t));return JSON.stringify({flattenedSegmentPaths:a,hasChildren:uV(e,r).childIds.length>0,path:iV(e,r),terminalKind:_z(i)})}function OV(e,t){return kV([e],[t])}function kV(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 AV(e,t){let n=t;for(;n!=null;){let t=dV(e,n);if(!vz(t)||bz(t,2))return null;if(!hB(e,n,t))return n;n=t.parentId}return null}function jV(e,t){let n=dV(e,t);if(Sz(n,(t===e.snapshot.rootId?-1:gz(dV(e,n.parentId)))+1),!vz(n))return;let r=uV(e,t);for(let t of r.childIds)jV(e,t)}function MV(e,t,n){let r=n;for(;r!=null;){if(r===t)return!0;let n=dV(e,r);if(r===e.snapshot.rootId)return!1;r=n.parentId}return!1}function NV(e,t,n=dV(e,t),r=!1){let i=e.instrumentation;if(i==null){FV(e,t,n,r);return}Ez(i,`store.recomputeNodeCounts`,()=>FV(e,t,n,r))}function PV(e,t){let n=t;for(;n!=null;){let t=dV(e,n),r=t.subtreeNodeCount,i=t.visibleSubtreeCount;if(NV(e,n,t),n===e.snapshot.rootId)return;let a=t.subtreeNodeCount-r,o=t.visibleSubtreeCount-i,s=t.parentId;(a!==0||o!==0)&&oz(uV(e,s),n,a,o),n=s}}function FV(e,t,n,r){if(!vz(n)){n.subtreeNodeCount=1,n.visibleSubtreeCount=1;return}let i=uV(e,t);if(r){let t=e.instrumentation;t==null?az(e.snapshot.nodes,i):Ez(t,`store.recomputeNodeCounts.rebuildChildAggregates`,()=>az(e.snapshot.nodes,i))}let a=1+i.totalChildSubtreeNodeCount,o=i.totalChildVisibleSubtreeCount;if(n.subtreeNodeCount=a,bz(n,2)){n.visibleSubtreeCount=o;return}n.visibleSubtreeCount=YB(e,t)==null?hB(e,t,n)?1+o:1:o}function IV(e,t,n){let r=iV(e,t);return r.length===0?n:`${r}${n}`}function LV(e){return e!=null&&!bz(e,4)}function RV(e,t){let n=e.snapshot.nodes[t];return!LV(n)||!vz(n)||bz(n,2)?null:n}function zV(e){let t=0;for(let[n,r]of e.pathCacheByNodeId)r.version===e.pathCacheVersion&&LV(e.snapshot.nodes[n])&&(t+=1);return t}function BV(e){return Math.max(0,e.valueById.length-1)}function VV(e){return{activeNodeCount:e.activeNodeCount,cachedPathEntryCount:zV(e),loadInfoEntryCount:e.directoryLoadInfoById.size,segmentCount:BV(e.snapshot.segmentTable),totalNodeSlotCount:Math.max(0,e.snapshot.nodes.length-1)}}function HV(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 UV(e){let t=[],n=[];for(let n of e.collapsedDirectoryIds)RV(e,n)!=null&&t.push(iV(e,n));for(let t of e.expandedDirectoryIds)RV(e,t)!=null&&n.push(iV(e,t));return{collapsedPaths:t,expandedPaths:n}}function WV(e){let t=[];for(let[n,r]of e.directoryLoadInfoById)RV(e,n)==null||vB(e,n)===`loaded`||t.push({info:{activeAttemptId:null,errorMessage:r.errorMessage,nextAttemptId:r.nextAttemptId,state:r.state},path:iV(e,n)});return t}function GV(e,t){e.collapsedDirectoryIds.clear(),e.hasCollapsedDirectoryOverrides=!1,e.expandedDirectoryIds.clear();for(let n of t.expandedPaths){let t=cV(e,n);t!=null&&gB(e,t,!0,dV(e,t))}for(let n of t.collapsedPaths){let t=cV(e,n);t!=null&&gB(e,t,!1,dV(e,t))}}function KV(e,t){e.directoryLoadInfoById.clear();for(let n of t){let t=cV(e,n.path);t!=null&&RV(e,t)!=null&&e.directoryLoadInfoById.set(t,{activeAttemptId:null,errorMessage:n.info.errorMessage,nextAttemptId:n.info.nextAttemptId,state:n.info.state})}}function qV(e){e.pathCacheVersion+=1,e.pathCacheByNodeId.clear(),e.pathCacheByNodeId.set(e.snapshot.rootId,{path:``,version:e.pathCacheVersion})}function JV(e){let t=e.snapshot.segmentTable,n=Gz();for(let r of e.snapshot.nodes)if(LV(r)){if(bz(r,2)){r.nameId=0;continue}r.nameId=Kz(n,qz(t,r.nameId))}e.snapshot.segmentTable=n}function YV(e){for(let[t,n]of e.snapshot.directories){let r=e.snapshot.nodes[t];if(!LV(r)||!vz(r)){e.snapshot.directories.delete(t);continue}let i=n.childIds.filter(n=>{let r=e.snapshot.nodes[n];return LV(r)&&r.parentId===t});n.childIds=i,n.childIdByNameId=new Map(i.map(t=>[dV(e,t).nameId,t])),n.childPositionById=new Map(i.map((e,t)=>[e,t])),az(e.snapshot.nodes,n)}}function XV(e){let t=e.snapshot.nodes.length-1;for(;t>e.snapshot.rootId;){let n=e.snapshot.nodes[t];if(LV(n))break;--t}e.snapshot.nodes.length=t+1}function ZV(e){let t=UV(e),n=WV(e);Ez(e.instrumentation,`store.cleanup.stable.clearPathCaches`,()=>qV(e)),Ez(e.instrumentation,`store.cleanup.stable.rebuildSegmentTable`,()=>JV(e)),Ez(e.instrumentation,`store.cleanup.stable.rebuildDirectoryIndexes`,()=>YV(e)),Ez(e.instrumentation,`store.cleanup.stable.trimTrailingRemovedNodeSlots`,()=>XV(e)),Ez(e.instrumentation,`store.cleanup.stable.restoreExpansionOverrides`,()=>GV(e,t)),Ez(e.instrumentation,`store.cleanup.stable.restoreDirectoryLoadInfos`,()=>KV(e,n)),Ez(e.instrumentation,`store.cleanup.stable.recomputeCounts`,()=>oV(e,e.snapshot.rootId))}function QV(e){let t=UV(e),n=WV(e),r=Ez(e.instrumentation,`store.cleanup.aggressive.listPaths`,()=>QB(e)),i=wz({...e.snapshot.options},e.instrumentation),a=Ez(e.instrumentation,`store.cleanup.aggressive.rebuildSnapshot`,()=>{let e=new uB(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,Ez(e.instrumentation,`store.cleanup.aggressive.restoreExpansionOverrides`,()=>GV(e,t)),Ez(e.instrumentation,`store.cleanup.aggressive.restoreDirectoryLoadInfos`,()=>KV(e,n)),Ez(e.instrumentation,`store.cleanup.aggressive.recomputeCounts`,()=>oV(e,e.snapshot.rootId))}function $V(e){for(let t of e.directoryLoadInfoById.values())if(t.state===`loading`&&t.activeAttemptId!=null)return!0;return!1}function eH(e,t){let n=VV(e);t===`stable`?Ez(e.instrumentation,`store.cleanup.stable`,()=>ZV(e)):Ez(e.instrumentation,`store.cleanup.aggressive`,()=>QV(e));let r=VV(e);return HV(t,t===`stable`,n,r)}var tH=64;function nH(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 rH(e){return dV(e,e.snapshot.rootId).visibleSubtreeCount}function iH(e,t,n,r){let i=dV(e,t.terminalNodeId),a=Math.max(1,i.visibleSubtreeCount);return Math.min(r-1,n+a-1)}function aH(e,t,n,r){return{ancestorPaths:r,index:t.index,posInSet:t.posInSet,row:wH(e,t.cursor),setSize:t.setSize,subtreeEndIndex:iH(e,t.cursor,t.index,n)}}function oH(e,t,n,r,i,a){let o=uV(e,t),{childIndex:s,childVisibleIndex:c,localVisibleIndex:l}=sz(e.snapshot.nodes,o,n),u=o.childIds[s];if(u==null)throw Error(`Visible index ${String(n)} is out of range`);return sH(e,u,l,r+c,i+1,s,o.childIds.length,a)}function sH(e,t,n,r,i,a,o,s){if(!vz(dV(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=vH(e,t,i);if(n===0)return{ancestors:s,cursor:c,index:r,posInSet:a,setSize:o};let l=dV(e,c.terminalNodeId);if(!vz(l)||!hB(e,c.terminalNodeId,l))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return oH(e,c.terminalNodeId,n-1,r+1,c.visibleDepth,[...s,{cursor:c,index:r,posInSet:a,setSize:o}])}function cH(e,t){let n=rH(e);if(t<0||t>=n)return null;let r=oH(e,e.snapshot.rootId,t,0,-1,[]),i=r.ancestors.map(t=>iV(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=aH(e,a,n,[...i]);t.push(r),i.push(r.row.path)}return a=t,a},index:r.index,posInSet:r.posInSet,row:wH(e,r.cursor),setSize:r.setSize,subtreeEndIndex:iH(e,r.cursor,r.index,n)}}function lH(e,t,n){let r=e.instrumentation,i=rH(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 CH(e,o+1);let t=[],n=hH(e,a);for(let r=a;r<=o&&n!=null;r++){let r=wH(e,n);t.push(r),n=bH(e,n)}return t}let s=[],c=0,l=0,u=Ez(r,`store.getVisibleSlice.selectFirstRow`,()=>hH(e,a));for(let t=a;t<=o&&u!=null;t++){let t=Ez(r,`store.getVisibleSlice.materializeRow`,()=>wH(e,u));s.push(t),t.isFlattened&&(c++,l+=t.flattenedSegments?.length??0),u=Ez(r,`store.getVisibleSlice.advanceCursor`,()=>bH(e,u))}return Dz(r,`workload.visibleRowsRead`,s.length),Dz(r,`workload.flattenedRowsRead`,c),Dz(r,`workload.flattenedSegmentsRead`,l),s}function uH(e,t=rH(e)){let n=e.instrumentation;return n==null?SH(e,t):Ez(n,`store.getVisibleTreeProjection`,()=>SH(e,t))}function dH(e){return xH(uH(e))}function fH(e,t){let n=cV(e,t);if(n==null||n===e.snapshot.rootId||vz(dV(e,n))&&XB(e,n)!==n)return null;let r=0,i=n,{nodes:a,rootId:o}=e.snapshot;for(;i!==o;){let t=dV(e,i).parentId,n=uV(e,t),s=nz(n).get(i);if(s==null)throw Error(`Child ${String(i)} was not found in its parent index`);if(r+=cz(a,n,s),t!==o){let n=dV(e,t),a=YB(e,t);if(!hB(e,t,n)&&a!==i)return null;XB(e,t)===t&&(r+=1)}i=t}return r}function pH(e,t){let n=cV(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=dV(e,n);if(!vz(r))throw Error(`Path is not a directory: "${t}"`);return hB(e,n,r)?null:(gB(e,n,!0,r),aV(e,n),kB({affectedAncestorIds:sV(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0}))}function mH(e,t){let n=cV(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=dV(e,n);if(!vz(r))throw Error(`Path is not a directory: "${t}"`);return hB(e,n,r)?(gB(e,n,!1,r),aV(e,n),AB({affectedAncestorIds:sV(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0})):null}function hH(e,t){return t<0||t>=rH(e)?null:gH(e,e.snapshot.rootId,t,-1)}function gH(e,t,n,r){let i=uV(e,t),a=e.instrumentation,{childIndex:o,localVisibleIndex:s}=a==null?sz(e.snapshot.nodes,i,n):Ez(a,`store.getVisibleSlice.selectChildIndex`,()=>sz(e.snapshot.nodes,i,n)),c=i.childIds[o];if(c!=null)return _H(e,c,s,r+1);throw Error(`Visible index ${String(n)} is out of range`)}function _H(e,t,n,r){if(!vz(dV(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=vH(e,t,r);if(n===0)return i;let a=dV(e,i.terminalNodeId);if(!vz(a)||!hB(e,i.terminalNodeId,a))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return gH(e,i.terminalNodeId,n-1,i.visibleDepth)}function vH(e,t,n){return vz(dV(e,t))?e.instrumentation==null?{headNodeId:t,terminalNodeId:XB(e,t),visibleDepth:n}:{headNodeId:t,terminalNodeId:Ez(e.instrumentation,`store.getVisibleSlice.flatten.resolveTerminalDirectory`,()=>XB(e,t)),visibleDepth:n}:{headNodeId:t,terminalNodeId:t,visibleDepth:n}}function yH(e,t){let n=dV(e,t);if(!vz(n))return!0;let r=n.parentId;return r===e.snapshot.rootId?!0:YB(e,r)!==t}function bH(e,t){let n=dV(e,t.terminalNodeId);if(vz(n)){let r=uV(e,t.terminalNodeId);if(hB(e,t.terminalNodeId,n)&&r.childIds.length>0){let n=r.childIds[0];return n==null?null:_H(e,n,0,t.visibleDepth+1)}}let r=t.terminalNodeId,i=t.visibleDepth;for(;;){let t=dV(e,r);if(r===e.snapshot.rootId)return null;let n=t.parentId,a=uV(e,n),o=nz(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 _H(e,s,0,i);yH(e,r)&&i--,r=n}}function xH(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 SH(e,t){let n=Array(t),r=new Int32Array(t),i=new Int32Array(t),a=new Int32Array(t),o=new Int32Array(tH);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=nH(o,y);let x,S=_;if(vz(v))S=f?XB(e,_):_,x=S===_?`${b}${h[v.nameId]}/`:iV(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&&vz(C)&&hB(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 CH(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(!vz(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:iV(e,f)};continue}let h=l?XB(e,f):f,g={headNodeId:f,terminalNodeId:h,visibleDepth:m};n[r++]=wH(e,g);let _=i[h];_!=null&&vz(_)&&hB(e,h,_)&&s.push([a.get(h),0,m])}return r<t&&(n.length=r),n}function wH(e,t){let n=dV(e,t.terminalNodeId),r=vz(n)?TH(e,t):null,i=iV(e,t.terminalNodeId),a=qz(e.snapshot.segmentTable,n.nameId),o=vz(n)&&uV(e,t.terminalNodeId).childIds.length>0,s=t.headNodeId!==t.terminalNodeId,c=e.instrumentation,l=s?c==null?ZB(e,t.headNodeId).map(n=>{let r=dV(e,n);return{isTerminal:n===t.terminalNodeId,name:qz(e.snapshot.segmentTable,r.nameId),nodeId:n,path:iV(e,n)}}):Ez(c,`store.getVisibleSlice.flatten.collectSegments`,()=>ZB(e,t.headNodeId).map(n=>{let r=dV(e,n);return{isTerminal:n===t.terminalNodeId,name:qz(e.snapshot.segmentTable,r.nameId),nodeId:n,path:iV(e,n)}})):void 0;return{depth:t.visibleDepth,flattenedSegments:l,hasChildren:o,id:t.terminalNodeId,isExpanded:vz(n)&&hB(e,t.terminalNodeId,n),isFlattened:s,isLoading:r===`loading`,kind:vz(n)?`directory`:`file`,loadState:r==null||r===`loaded`?void 0:r,name:a,path:i}}function TH(e,t){if(t.headNodeId===t.terminalNodeId)return vB(e,t.terminalNodeId);let n=ZB(e,t.headNodeId),r=!1,i=!1;for(let t of n){let n=vB(e,t);if(n===`loading`)return`loading`;if(n===`error`){i=!0;continue}n===`unloaded`&&(r=!0)}return i?`error`:r?`unloaded`:`loaded`}function EH(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||!vz(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&&lz(n,i),r.subtreeNodeCount=1+c;let u;if(o&&s===1){let e=n[a[0]];u=e!=null&&vz(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,lz(n,l),c.subtreeNodeCount=1+d,c.visibleSubtreeCount=f}function DH(e){return e.initialExpansion===`open`&&(e.initialExpandedPaths==null||e.initialExpandedPaths.length===0)}var OH=class e{#e;constructor(e={}){let t=Tz(e),n=Ez(t,`store.builder.create`,()=>new uB(e));if(e.preparedInput!=null){let t=sB(e.preparedInput);t==null?n.appendPreparedPaths(oB(e.preparedInput),!1):n.appendPresortedPaths(t,cB(e.preparedInput))}else{let r=e.paths??[];e.presorted===!0?n.appendPaths(r):n.appendPreparedPaths(Ez(t,`store.preparePathEntries`,()=>lB(r,e)))}let r=Ez(t,`store.builder.finish`,()=>n.finish({skipSubtreeCountPass:!0})),i=Ez(t,`store.state.detectAllDirectoriesExpanded`,()=>(e.initialExpansion??`closed`)===`closed`&&n.didMatchAllInitialExpandedPaths());this.#e=Ez(t,`store.state.create`,()=>dB(r,i?`open`:e.initialExpansion??`closed`,t)),i&&(this.#e.collapseNewDirectoriesByDefault=!0);let a=i?this.#e.snapshot.directories.size-1:Ez(t,`store.state.initializeExpandedPaths`,()=>this.initializeExpandedPaths(e.initialExpandedPaths));i||DH(e)||(e.initialExpansion??`closed`)===`closed`&&a===this.#e.snapshot.directories.size-1||(e.initialExpandedPaths?.length??0)>0&&Ez(t,`store.state.checkAllDirectoriesExpanded`,()=>this.hasAllDirectoriesExpanded())?Ez(t,`store.state.initializeOpenVisibleCounts`,()=>EH(this.#e)):Ez(t,`store.state.recomputeCounts`,()=>oV(this.#e,this.#e.snapshot.rootId))}static preparePaths(e,t={}){return rB(e,t)}static prepareInput(e,t={}){return iB(e,t)}static preparePresortedInput(e){return aB(e)}list(e){return Ez(this.#e.instrumentation,`store.list`,()=>QB(this.#e,e))}add(e){Ez(this.#e.instrumentation,`store.add`,()=>{let t=rH(this.#e);zB(this.#e,LB(this.#e,t,$B(this.#e,e)))})}remove(e,t={}){Ez(this.#e.instrumentation,`store.remove`,()=>{let n=rH(this.#e);zB(this.#e,LB(this.#e,n,eV(this.#e,e,t)))})}move(e,t,n={}){Ez(this.#e.instrumentation,`store.move`,()=>{let r=rH(this.#e),i=tV(this.#e,e,t,n);i!=null&&zB(this.#e,LB(this.#e,r,i))})}batch(e){RB(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 Ez(this.#e.instrumentation,`store.getVisibleCount`,()=>rH(this.#e))}getVisibleSlice(e,t){return Ez(this.#e.instrumentation,`store.getVisibleSlice`,()=>lH(this.#e,e,t))}getVisibleRowContext(e){return Ez(this.#e.instrumentation,`store.getVisibleRowContext`,()=>cH(this.#e,e))}getVisibleTreeProjection(){return dH(this.#e)}getVisibleTreeProjectionData(e){return uH(this.#e,e)}getVisibleIndex(e){return Ez(this.#e.instrumentation,`store.getVisibleIndex`,()=>fH(this.#e,e))}getPathInfo(e){return Ez(this.#e.instrumentation,`store.getPathInfo`,()=>{let t=cV(this.#e,e);if(t==null)return null;let n=dV(this.#e,t);return{depth:gz(n),kind:vz(n)?`directory`:`file`,path:iV(this.#e,t)}})}isExpanded(e){return Ez(this.#e.instrumentation,`store.isExpanded`,()=>{let t=this.requireDirectoryNodeId(e),n=dV(this.#e,t);return hB(this.#e,t,n)})}expand(e){Ez(this.#e.instrumentation,`store.expand`,()=>{let t=rH(this.#e),n=pH(this.#e,e);n!=null&&zB(this.#e,LB(this.#e,t,n))})}collapse(e){Ez(this.#e.instrumentation,`store.collapse`,()=>{let t=rH(this.#e),n=mH(this.#e,e);n!=null&&zB(this.#e,LB(this.#e,t,n))})}on(e,t){return TB(this.#e,e,t)}getDirectoryLoadState(e){let t=this.requireDirectoryNodeId(e);return vB(this.#e,t)}markDirectoryUnloaded(e){Ez(this.#e.instrumentation,`store.markDirectoryUnloaded`,()=>{let t=this.requireDirectoryNodeId(e);if(uV(this.#e,t).childIds.length>0)throw Error(`Cannot mark a directory with known children as unloaded: "${e}"`);let n=rH(this.#e);bB(this.#e,t),zB(this.#e,LB(this.#e,n,jB({affectedAncestorIds:sV(this.#e,t),affectedNodeIds:[t],path:e,projectionChanged:this.isDirectoryProjectionVisible(t)})))})}beginChildLoad(e){return Ez(this.#e.instrumentation,`store.beginChildLoad`,()=>{let t=this.requireDirectoryNodeId(e),n=rH(this.#e),r=yB(this.#e,t);return zB(this.#e,LB(this.#e,n,MB({affectedAncestorIds:sV(this.#e,t),affectedNodeIds:[t],attemptId:r.attemptId,path:e,projectionChanged:this.isDirectoryProjectionVisible(t),reused:r.reused}))),r})}applyChildPatch(e,t){return Ez(this.#e.instrumentation,`store.applyChildPatch`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null||vB(this.#e,n)!==`loading`||!SB(this.#e,n,e.attemptId))return!1;let r=iV(this.#e,n);this.validateChildPatch(r,t);let i=rH(this.#e),a=[];for(let e of t.operations){kH(r,e);let t=rH(this.#e);switch(e.type){case`add`:a.push(LB(this.#e,t,$B(this.#e,e.path)));break;case`remove`:a.push(LB(this.#e,t,eV(this.#e,e.path,{recursive:e.recursive})));break;case`move`:{let n=tV(this.#e,e.from,e.to,{collision:e.collision});n!=null&&a.push(LB(this.#e,t,n));break}}}let o=a.some(e=>e.projectionChanged)||this.isDirectoryProjectionVisible(n);return zB(this.#e,LB(this.#e,i,NB({affectedAncestorIds:sV(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,childEvents:a,path:iV(this.#e,n),projectionChanged:o}))),!0})}completeChildLoad(e){return Ez(this.#e.instrumentation,`store.completeChildLoad`,()=>{let t=this.resolveActiveDirectoryNodeId(e.nodeId);if(t==null)return!1;let n=rH(this.#e),r=xB(this.#e,t,e.attemptId);return zB(this.#e,LB(this.#e,n,PB({affectedAncestorIds:sV(this.#e,t),affectedNodeIds:[t],attemptId:e.attemptId,path:iV(this.#e,t),projectionChanged:this.isDirectoryProjectionVisible(t),stale:!r}))),r})}failChildLoad(e,t){return Ez(this.#e.instrumentation,`store.failChildLoad`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null)return!1;let r=rH(this.#e),i=CB(this.#e,n,e.attemptId,t);return zB(this.#e,LB(this.#e,r,FB({affectedAncestorIds:sV(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,errorMessage:t,path:iV(this.#e,n),projectionChanged:this.isDirectoryProjectionVisible(n),stale:!i}))),i})}cleanup(e={}){return Ez(this.#e.instrumentation,`store.cleanup`,()=>{if(this.#e.transactionStack.length>0)throw Error(`Cleanup cannot run during an open batch or transaction.`);if($V(this.#e))throw Error(`Cleanup cannot run while directory loads are active.`);let t=rH(this.#e),n=eH(this.#e,e.mode??`stable`);return zB(this.#e,LB(this.#e,t,IB({...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=uV(this.#e,p).childIds,_=m===d?n[m]??0:0,v=_,y,b=l.get(a)??Az(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=Mz(zz(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(!vz(dV(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=dV(this.#e,n);hB(this.#e,n,i)||(gB(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=dV(this.#e,e);if(!hB(this.#e,e,t))return!1}return!0}requireDirectoryNodeId(e){let t=cV(this.#e,e);if(t==null)throw Error(`Path does not exist: "${e}"`);if(!vz(dV(this.#e,t)))throw Error(`Path is not a directory: "${e}"`);return t}resolveActiveDirectoryNodeId(e){try{if(!vz(dV(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=dV(this.#e,t).parentId;if(e!==this.#e.snapshot.rootId){let n=dV(this.#e,e),r=YB(this.#e,e);if(!hB(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 kH(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 AH={compact:{itemHeight:24,factor:.8},default:{itemHeight:30,factor:1},relaxed:{itemHeight:36,factor:1.2}};function jH(e,t){if(typeof e==`number`)return{itemHeight:t??AH.default.itemHeight,factor:e};let n=AH[e??`default`];return{itemHeight:t??n.itemHeight,factor:n.factor}}var MH=AH.default.itemHeight,NH=`@layer base, theme, unsafe;
189
189
 
190
190
  @layer base {
191
191
  :host {
@@ -1849,20 +1849,20 @@ Error generating stack: `+e.message+`
1849
1849
  }
1850
1850
  }
1851
1851
  }
1852
- `,AH=`@layer base, unsafe;`;function jH(e){return`${AH}
1852
+ `,PH=`@layer base, unsafe;`;function FH(e){return`${PH}
1853
1853
  @layer base {
1854
1854
  ${e}
1855
- }`}function MH(e){return`${AH}
1855
+ }`}function IH(e){return`${PH}
1856
1856
  @layer unsafe {
1857
1857
  ${e}
1858
- }`}var NH=new WeakMap;function PH(e){let t=NH.get(e);if(t!=null)return t;let n=document.createElement(`div`);n.setAttribute(DR,`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(),NH.set(e,i),i}function FH(e,t){if(!e.isConnected)return;let n=PH(t);if(n==null)return;let r=t.querySelector(`style[${OR}]`),i=r instanceof HTMLStyleElement?r:document.createElement(`style`);r instanceof HTMLStyleElement||(i.setAttribute(OR,``),t.appendChild(i)),i.textContent=`:host { ${kR}: ${n}px; }`}var IH;function LH(e){if(typeof CSSStyleSheet<`u`&&typeof CSSStyleSheet.prototype.replaceSync==`function`&&`adoptedStyleSheets`in e){IH??(IH=new CSSStyleSheet,IH.replaceSync(jH(kH)));let t=!1;try{e.adoptedStyleSheets=[IH],t=!0}catch{}if(t){e.querySelector(`style[${TR}]`)?.remove();return}}if(e.querySelector(`style[data-file-tree-style]`)==null){let t=document.createElement(`style`);t.setAttribute(TR,``),t.textContent=jH(kH),e.prepend(t)}}function RH(e,t){zH(e,t),LH(t),FH(e,t)}function zH(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`});RH(this,e)}}if(customElements.define(wR,e),typeof document<`u`)for(let e of Array.from(document.querySelectorAll(wR)))e instanceof HTMLElement&&RH(e,e.shadowRoot??e.attachShadow({mode:`open`}))}var BH=e=>e.startsWith(`f::`)?e.slice(3):e;function VH(e){let t=e.lastIndexOf(`/`);return t<0?{parentPath:``,baseName:e}:{parentPath:e.slice(0,t),baseName:e.slice(t+1)}}function HH(e,t){return e===``?t:`${e}/${t}`}function UH({files:e,path:t,isFolder:n,nextBasename:r}){let i=BH(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}=VH(i);if(a===s)return{nextFiles:e,sourcePath:i,destinationPath:i,isFolder:n};let c=HH(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 WH(e){return e.endsWith(`/`)}function GH(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 KH(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 qH(e,t){return t.includes(e)?KH(t):[e]}function JH(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 YH(e,t){return{draggedPaths:e,target:t}}function XH(e,t){if(t.kind!==`directory`||t.directoryPath==null)return!1;for(let n of e)if(WH(n)&&(t.directoryPath===n||t.directoryPath.startsWith(n)))return!0;return!1}function ZH(e,t){return t.kind===`root`||t.directoryPath==null?GH(e):t.directoryPath}function QH(e,t){let n=e.map(e=>{let n=ZH(e,t);return n===e?null:{from:e,to:n,type:`move`}}).filter(e=>e!=null);return n.length===0?null:{operations:n,result:{draggedPaths:e,operation:n.length===1?`move`:`batch`,target:t}}}function $H(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 eU(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(!$H(wH.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 tU(e){return e.operation===`add`||e.operation===`remove`||e.operation===`move`||e.operation===`batch`}function nU(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 rU(e,t){if(e===t)return!0;let n=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(n)}function iU(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 rU(e,t.path)?n?e:null:e;case`move`:return nU(e,t.from,t.to);case`batch`:{let r=e;for(let e of t.events)if(r=iU(r,e,n),r==null)return null;return r}}}function aU(e){return{canonicalChanged:e.canonicalChanged,projectionChanged:e.projectionChanged,visibleCountDelta:e.visibleCountDelta}}function oU(e){switch(e.operation){case`add`:return{...aU(e),operation:`add`,path:e.path};case`remove`:return{...aU(e),operation:`remove`,path:e.path,recursive:e.recursive};case`move`:return{...aU(e),from:e.from,operation:`move`,to:e.to}}}function sU(e){return{...aU(e),events:e.events.filter(e=>e.operation===`add`||e.operation===`remove`||e.operation===`move`).map(e=>oU(e)),operation:`batch`}}function cU(e){switch(e.operation){case`add`:case`remove`:case`move`:return oU(e);case`batch`:return sU(e);default:return null}}function lU(e,t){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}function uU(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 dU(e){return uU(e).at(-1)??null}function fU(e,t){return t==null?e:e.startsWith(t)?e.slice(t.length):e}function pU(e){return e.endsWith(`/`)}var mU=e=>e.toLowerCase();function hU(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`);return n<0?t:t.slice(n+1)}function gU(e){return e.endsWith(`/`)?e.slice(0,-1):e}function _U(e,t){return t&&!e.endsWith(`/`)?`${e}/`:e}var vU=e=>{let t=e.trim();return t.length===0?``:(t.includes(`\\`)?t.replaceAll(`\\`,`/`):t).toLowerCase()},yU=Symbol(`FILE_TREE_RENAME_VIEW`),bU=512,xU=512;function SU(e){return e===`top`||e===`center`?e:`nearest`}function CU(e,t,n){if(e===0)return-1;if(n!=null){let e=t(n);if(e!=null)return e;let r=uU(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 wU(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:CU(e.paths.length,r,t),getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex}}var TU=class{#e;#t=new Set;#n=new Map;#r=null;#i=null;#a=new Map;#o=new Map;#s=-1;#c=null;#l=!1;#u=e=>-1;#d=new Map;#f=null;#p=null;#m=null;#h=null;#g=null;#_;#v;#y;#b=[];#x=new Int32Array;#S=new Int32Array;#C=void 0;#w=!1;#T=null;#E=``;#D=!1;#O=new Set;#k=[];#A;#j=null;#M=null;#N=null;#P=null;#F=null;#I=null;#L=null;#R=0;#z=null;#B=new Set;#V=0;#H;#U=0;#W=!1;#G=0;#K;constructor(e){let{dragAndDrop:t,fileTreeSearchMode:n,initialSearchQuery:r,initialSelectedPaths:i,renaming:a,onSearchChange:o,paths:s,preparedInput:c,...l}=e,u=eU({paths:s,preparedInput:c},`constructor`,l.sort);this.#e=l,t!=null&&t!==!1&&(this.#r=t===!0?{}:t),this.#w=a!=null&&a!==!1,a!=null&&a!==!1&&a!==!0&&(this.#C=a.canRename,this.#v=a.onError,this.#_=a.onRename),this.#y=o,this.#A=n??`hide-non-matches`,this.#H=this.#le(u.paths,u.preparedInput);let d=i?.map(e=>this.#Ne(e)).filter(e=>e!=null)??[],f=d.at(-1)??null;d.length>0&&(this.#B=new Set(d),this.#z=f,this.#V=1),this.#je(f,!1),r!=null&&this.#Te(r,!1),this.#K=this.#Re()}destroy(){this.#K?.(),this.#K=null,this.#n.clear(),this.#t.clear(),this.#d.clear(),this.#i=null,this.#he()}focusFirstItem(){this.#be().length>0&&this.#Fe(0)}focusLastItem(){this.#G<=0||(this.#Ie(),this.#Fe(this.#G-1))}focusNextItem(){this.#Ae(1)}focusParentItem(){if(this.#c==null)return;let e=dU(this.#c);if(e==null)return;let t=this.#Z(e);t>=0&&this.#Fe(t)}focusPath(e){let t=this.#H.getPathInfo(e)?.path??null;if(t==null)return;this.#Ie();let n=this.#Z(t);n>=0&&this.#Fe(n)}scrollToPath(e,t){let n=this.#H.getPathInfo(e)?.path??null;if(n==null)return;this.#Ie();let r=this.#xe(n);r<0||this.#Me(r)!=null&&(t?.focus!==!1&&this.#Fe(r,!1),this.#L={id:this.#R+=1,offset:SU(t?.offset),visibleIndex:r},this.#De())}focusMountedPathFromInput(e){let t=this.#H.getPathInfo(e)?.path??null;if(t==null)return;let n=this.#Z(t);n>=0&&this.#Fe(n)}focusNearestPath(e){let t=this.resolveNearestVisiblePath(e);if(t==null)return null;let n=this.#Z(t);return n>=0?(this.#Fe(n),this.#be()[n]??t):null}focusPreviousItem(){this.#Ae(-1)}getFocusedIndex(){return this.#s}getFocusedItem(){return this.#c==null?null:this.#Q(this.#c)}getFocusedPath(){return this.#c}getScrollRequest(){return this.#L}clearScrollRequest(e){this.#L?.id===e&&(this.#L=null)}resolveNearestVisiblePath(e){let t=this.#be();if(this.#G===0)return null;if(e==null)return this.#c??t[0]??null;let n=this.#H.getPathInfo(e)?.path??e,r=this.#Z(n);return r>=0?t[r]??n:this.#X(n)??this.#c??t[0]??null}getSelectedPaths(){return[...this.#B]}getSelectionVersion(){return this.#V}getVisibleCount(){return this.#G}getVisibleRows(e,t){if(t<e||this.#G===0)return[];let n=Math.max(0,e),r=Math.min(this.#G-1,t);if(r<n)return[];let i=r-n+1;if(this.#F==null&&!this.#l&&r>=this.#b.length&&i<=xU){let e=[];for(let t=n;t<=r;t+=1){let n=this.#H.getVisibleRowContext(t);if(n==null)break;e.push(this.#ee(n))}return e}if(!this.#l&&r>=this.#b.length&&this.#Ie(),this.#F!=null){let e=Array.from({length:r-n+1},(e,t)=>this.#Se(n+t)),t=new Map,i=e[0]??-1,a=i;for(let n=1;n<=e.length;n+=1){let r=e[n];if(r!=null&&r===a+1){a=r;continue}if(i>=0&&this.#H.getVisibleSlice(i,a).forEach((e,n)=>{t.set(i+n,e)}),r==null){i=-1,a=-1;continue}i=r,a=r}return Array.from({length:r-n+1},(e,r)=>{let i=n+r,a=this.#Se(i),o=t.get(a),s=this.#b[a];if(o==null||s==null)throw Error(`Missing projection row for filtered visible index ${String(i)}`);return this.#$(o,i,a,{ancestorPaths:this.#re(a),path:s})})}return this.#H.getVisibleSlice(n,r).map((e,t)=>{let r=n+t,i=this.#b[r];if(i==null)throw Error(`Missing projection path for visible index ${String(r)}`);return this.#$(e,r,r,{ancestorPaths:this.#re(r),path:i})})}getStickyRowCandidates(e,t){if(this.#F!=null)return null;if(this.#G===0||e<=0||t<=0)return[];let n=[];for(let r=0;r<this.#G;r+=1){let i=e+r*t,a=Math.min(this.#G-1,Math.floor(i/t)),o=this.#te(a,r)??(a>0?this.#te(a-1,r):void 0);if(o==null)break;n.push({row:this.#ee(o),subtreeEndIndex:o.subtreeEndIndex})}return n}getItem(e){let t=this.#H.getPathInfo(e);return t==null?null:this.#Q(t.path,t)}resolveMountedDirectoryPathFromInput(e){let t=this.#H.getPathInfo(e);return t?.kind===`directory`?t.path:null}toggleMountedDirectoryFromInput(e){let t=this.resolveMountedDirectoryPathFromInput(e);t!=null&&this.#ze(t)}selectAllVisiblePaths(){this.#Ie();let e=[...this.#be()];this.#ae(e,this.#c??this.#z)}selectOnlyPath(e){let t=this.#Ne(e);t!=null&&this.#ae([t],t)}selectOnlyMountedPathFromInput(e){this.#ae([e],e)}selectPath(e){let t=this.#Ne(e);t==null||this.#B.has(t)||this.#ae([...this.#B,t])}deselectPath(e){let t=this.#Ne(e);t==null||!this.#B.has(t)||this.#ae([...this.#B].filter(e=>e!==t))}toggleFocusedSelection(){this.#c!=null&&this.togglePathSelectionFromInput(this.#c)}togglePathSelection(e){let t=this.#Ne(e);if(t!=null){if(this.#B.has(t)){this.deselectPath(t);return}this.selectPath(t)}}togglePathSelectionFromInput(e){let t=this.#Ne(e);if(t!=null){if(this.#B.has(t)){this.#ae([...this.#B].filter(e=>e!==t),t);return}this.#ae([...this.#B,t],t)}}selectPathRange(e,t){let n=this.#Ne(e);if(n==null)return;this.#Ie();let r=this.#z,i=r==null?-1:this.#Ce(r),a=this.#Ce(n);if(i===-1||a===-1){let e=t?[...this.#B,n]:[n];this.#ae(e,n);return}let[o,s]=i<=a?[i,a]:[a,i],c=this.#be().slice(o,s+1),l=t?[...this.#B,...c]:c;this.#ae(l,r)}extendSelectionFromFocused(e){if(this.#c==null)return;let t=this.#s;if(t===-1)return;let n=Math.min(this.#G-1,Math.max(0,t+e));if(n===t)return;!this.#l&&n>=this.#b.length&&this.#Ie();let r=this.#be(),i=r[t]??null,a=r[n]??null;if(i==null||a==null)return;let o=new Set(this.#B);o.has(i)&&o.has(a)?o.delete(i):o.add(a),this.#ae([...o],this.#z??i,!1),this.#Fe(n)}getDragAndDropConfig(){return this.#r}isDragAndDropEnabled(){return this.#r!=null}getDragSession(){return this.#i==null?null:{draggedPaths:[...this.#i.draggedPaths],primaryPath:this.#i.primaryPath,target:this.#i.target==null?null:{...this.#i.target}}}startDrag(e){if(this.#r==null)return!1;let t=this.#Ne(e);if(t==null||this.#M!=null&&this.#M.length>0)return!1;let n=this.getSelectedPaths(),r=qH(t,n);return this.#r.canDrag?.(r)===!1?!1:(n.includes(t)||this.#ae([t],t,!1),this.#Pe(t),this.#i={draggedPaths:r,primaryPath:t,target:null},this.#De(),!0)}setDragTarget(e){let t=this.#i;if(t==null)return;let n=e;if(n!=null){let e=YH(t.draggedPaths,n);(XH(t.draggedPaths,n)||this.#r?.canDrop?.(e)===!1)&&(n=null)}JH(t.target,n)||(this.#i={...t,target:n},this.#De())}cancelDrag(){this.#i!=null&&(this.#i=null,this.#De())}completeDrag(){let e=this.#i;if(e==null)return!1;this.#i=null;let t=e.target==null?null:{...e.target};if(t==null)return this.#De(),!1;let n=YH(e.draggedPaths,t);if(XH(e.draggedPaths,t)||this.#r?.canDrop?.(n)===!1)return this.#De(),!1;let r=QH(e.draggedPaths,t);if(r==null)return this.#De(),!1;try{if(r.operations.length===1){let e=r.operations[0];if(e==null||e.type!==`move`)throw Error(`Expected a single move operation for one-item drops`);this.#H.move(e.from,e.to,{collision:e.collision})}else this.#ce(r.operations),this.#H.batch(r.operations)}catch(e){return this.#De(),this.#r?.onDropError?.(e instanceof Error?e.message:String(e),n),!1}return this.#r?.onDropComplete?.(r.result),!0}subscribe(e){return this.#t.add(e),e(),()=>{this.#t.delete(e)}}add(e){this.#H.add(e)}remove(e,t={}){this.#H.remove(e,t)}move(e,t,n={}){this.#H.move(e,t,n)}batch(e){this.#H.batch(e)}onMutation(e,t){let n=e,r=t,i=this.#n.get(n);return i??(i=new Set,this.#n.set(n,i)),i.add(r),()=>{let e=this.#n.get(n);e?.delete(r),e?.size===0&&this.#n.delete(n)}}setSearch(e){this.#Te(e,!0)}openSearch(e=``){this.#Te(e,!0)}closeSearch(){this.#Te(null,!0)}isSearchOpen(){return this.#M!==null}getSearchValue(){return this.#M??``}getSearchMatchingPaths(){return this.#k}focusNextSearchMatch(){this.#we(1)}focusPreviousSearchMatch(){this.#we(-1)}startRenaming(e=this.#c??``,t={}){if(!this.#w)return!1;let n=this.#H.getPathInfo(e);if(n==null)return!1;let r=n.path,i=pU(r),a=gU(r);if(this.#C?.({isFolder:i,path:a})===!1)return!1;for(let e of uU(r))this.#H.isExpanded(e)||this.#H.expand(e);return this.#ae([r],r,!1),this.#M!=null&&(this.#Te(null,!1),this.#y?.(this.#M)),this.#Pe(r),this.#T=r,this.#E=hU(r),this.#D=t.removeIfCanceled??!1,this.#De(),!0}[yU](){return{cancel:()=>{this.#q()},commit:()=>{this.#J()},getPath:()=>this.#T,getValue:()=>this.#E,isActive:()=>this.#T!=null,setValue:e=>{this.#Y(e)}}}#q(){if(this.#T==null)return;let e=this.#T,t=this.#D;if(this.#T=null,this.#E=``,this.#D=!1,t){this.remove(e,pU(e)?{recursive:!0}:void 0);return}this.#Pe(e),this.#De()}#J(){let e=this.#T;if(e==null)return;if(this.#D&&this.#E.trim().length===0){this.#T=null,this.#E=``,this.#D=!1,this.remove(e,pU(e)?{recursive:!0}:void 0);return}let t=pU(e),n=UH({files:this.#H.list(),isFolder:t,nextBasename:this.#E,path:gU(e)});if(this.#T=null,this.#E=``,this.#D=!1,`error`in n){this.#Pe(e),this.#v?.(n.error),this.#De();return}if(n.sourcePath===n.destinationPath){this.#Pe(e),this.#De();return}this.#_?.({destinationPath:n.destinationPath,isFolder:n.isFolder,sourcePath:n.sourcePath}),this.move(_U(n.sourcePath,t),_U(n.destinationPath,t))}#Y(e){this.#T==null||this.#E===e||(this.#E=e,this.#De())}resetPaths(e,t={}){let n=this.#H.list().length,r=this.#G,i=eU({paths:e,preparedInput:t.preparedInput},`resetPaths`,this.#e.sort),a=this.#le(i.paths,i.preparedInput,t.initialExpandedPaths),o=this.#c,s=this.#T,c=this.getSelectedPaths(),l=this.#z;this.#K?.(),this.#H=a,this.#d.clear(),this.#he();let u=c.map(e=>a.getPathInfo(e)?.path??null).filter(e=>e!=null),d=!lU(this.#B,u);this.#B=new Set(u),d&&(this.#V+=1),this.#z=l==null?null:a.getPathInfo(l)?.path??null,this.#T=s==null?null:a.getPathInfo(s)?.path??null,this.#T??(this.#E=``,this.#D=!1),this.#je(o,o!=null||u.length>0||this.#z!=null),this.#K=this.#Re(),this.#De(),this.#Oe({canonicalChanged:!0,operation:`reset`,pathCountAfter:i.paths.length,pathCountBefore:n,projectionChanged:!0,usedPreparedInput:t.preparedInput!=null,visibleCountDelta:this.#G-r})}#X(e){this.#Ie();let t=dU(e),n=fU(e,t),r=null,i=null;for(let e of this.#be()){if(dU(e)!==t)continue;let a=fU(e,t);if(a<n){r=e;continue}if(a>n){i=e;break}}return r??i}#Z(e){let t=this.#Ce(e);if(t!==-1)return t;let n=uU(e);for(let e=n.length-1;e>=0;--e){let t=n[e];if(t==null)continue;let r=this.#Ce(t);if(r!==-1)return r}return this.#be().length>0?0:-1}#Q(e,t){let n=this.#d.get(e);if(n!=null)return n;let r=t??this.#H.getPathInfo(e);if(r==null)return null;let i=r.kind===`directory`?this.#oe(r.path):this.#se(r.path);return this.#d.set(r.path,i),i}#$(e,t,n,r){return{ancestorPaths:r.ancestorPaths,depth:e.depth,flattenedSegments:e.flattenedSegments?.map(e=>({isTerminal:e.isTerminal,name:e.name,path:e.path})),hasChildren:e.hasChildren,index:t,isExpanded:e.isExpanded,isFlattened:e.isFlattened,isFocused:r.path===this.#c,isSelected:this.#B.has(r.path),kind:e.kind,level:e.depth,name:e.name,path:r.path,posInSet:r.posInSet??this.#x[n]??0,setSize:r.setSize??this.#S[n]??0}}#ee(e){return this.#$(e.row,e.index,e.index,{ancestorPaths:e.ancestorPaths,path:e.row.path,posInSet:e.posInSet,setSize:e.setSize})}#te(e,t){let n=this.#H.getVisibleRowContext(e);return n==null?void 0:n.ancestorRows[t]??(t===n.ancestorRows.length&&n.row.kind===`directory`&&n.row.isExpanded?n:void 0)}#ne(e){let t=this.#a.get(e);if(t!=null)return t;let n=this.#u(e),r=n<0?[]:[...this.#ne(n),n];return this.#a.set(e,r),r}#re(e){let t=this.#o.get(e);if(t!=null)return t;let n=this.#ne(e).map(e=>this.#b[e]??``).filter(e=>e!==``);return this.#o.set(e,n),n}#ie(e){this.#H.collapse(e)}#ae(e,t=this.#z,n=!0){let r=[...new Set(e)],i=!lU(this.#B,r),a=this.#z!==t;!i&&!a||(this.#B=new Set(r),this.#z=t,i&&(this.#V+=1),n&&this.#De())}#oe(e){return{collapse:()=>{this.#ie(e)},deselect:()=>{this.deselectPath(e)},expand:()=>{this.#ke(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!0,isExpanded:()=>this.#H.isExpanded(e),isFocused:()=>this.#c===e,isSelected:()=>this.#B.has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)},toggle:()=>{this.#ze(e)}}}#se(e){return{deselect:()=>{this.deselectPath(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!1,isFocused:()=>this.#c===e,isSelected:()=>this.#B.has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)}}}#ce(e){let t=this.#H.list();this.#le(t).batch(e)}#le(e,t,n){return new wH({...this.#e,paths:e,preparedInput:t??void 0,...n===void 0?{}:{initialExpandedPaths:n}})}#ue(){return this.#h??=this.#H.list(),this.#h}#de(){if(this.#m!=null)return this.#m;let e=new Set;for(let t of this.#ue()){e.add(t);for(let n of uU(t))e.add(n)}return this.#m=[...e].sort(),this.#m}#fe(){return this.#g??=this.#ue().map(mU),this.#g}#pe(){return this.#f??=this.#de().filter(e=>e.endsWith(`/`)),this.#f}#me(){return this.#p??=this.#pe().map(mU),this.#p}#he(){this.#f=null,this.#p=null,this.#m=null,this.#h=null,this.#g=null}#ge(){return this.#pe().filter(e=>this.#H.isExpanded(e))}#_e(e){let t=new Set(this.#j??[]);if(e)for(let e of this.#B)for(let n of uU(e))t.add(n);this.#ve(t)}#ve(e){this.#W=!0;try{for(let t of this.#pe()){let n=e.has(t),r=this.#H.isExpanded(t);n&&!r?this.#H.expand(t):!n&&r&&this.#H.collapse(t)}}finally{this.#W=!1}}#ye(){if(this.#M==null||this.#M.length===0){this.#k=[],this.#F=null,this.#I=null,this.#P=null,this.#G=this.#U;return}let e=this.#b;if(this.#k=e.filter(e=>this.#O.has(e)),this.#A!==`hide-non-matches`||this.#O.size===0){this.#F=null,this.#I=null,this.#P=null,this.#G=this.#U;return}let t=[],n=[],r=new Map;for(let[i,a]of e.entries())this.#N?.has(a)===!0&&(r.set(a,n.length),t.push(i),n.push(a));this.#F=t,this.#I=n,this.#P=r,this.#G=n.length}#be(){return this.#I??this.#b}#xe(e){return this.#I==null?this.#H.getVisibleIndex(e)??-1:this.#P?.get(e)??-1}#Se(e){return this.#F?.[e]??e}#Ce(e){return this.#P?.get(e)??this.#H.getVisibleIndex(e)??-1}#we(e){let t=this.#k;if(t.length===0)return;let n=this.#c,r=n==null?-1:t.indexOf(n),i=t[r<0?e>0?0:t.length-1:Math.min(t.length-1,Math.max(0,r+e))];i!=null&&this.focusPath(i)}#Te(e,t){let n=e==null?null:vU(e),r=this.#M;if(r!==n){if(r==null&&n!=null&&(this.#j=this.#ge()),this.#M=n,n==null)this.#_e(!0),this.#j=null,this.#O.clear(),this.#N=null,this.#je(this.#c,!0);else if(n.length===0)this.#_e(!1),this.#O.clear(),this.#N=null,this.#je(this.#c,!0);else{let e=this.#Ee();this.#je(e,!0)}t&&(this.#y?.(this.#M),this.#De())}}#Ee(){if(this.#M==null||this.#M.length===0)return this.#O.clear(),this.#c;let e=this.#M,t=this.#ue(),n=this.#fe(),r=[],i=new Set,a=null;for(let o=0;o<t.length;o+=1){if(!n[o].includes(e))continue;let s=t[o];r.push(s),i.add(s),a??=s}let o=this.#pe(),s=this.#me();for(let t=0;t<o.length;t+=1){if(!s[t].includes(e))continue;let n=o[t];i.has(n)||(r.push(n),i.add(n),a??=n)}this.#O=i;let c=this.#A===`hide-non-matches`&&r.length>0?new Set:null;this.#N=c;let l=this.#A===`expand-matches`?new Set(this.#j??[]):new Set;for(let e of r){c?.add(e),e.endsWith(`/`)&&l.add(e);for(let t of uU(e))l.add(t),c?.add(t)}return this.#ve(l),a??this.#c}#De(){for(let e of this.#t)e()}#Oe(e){this.#n.get(e.operation)?.forEach(t=>{t(e)}),this.#n.get(`*`)?.forEach(t=>{t(e)})}#ke(e){for(let t of uU(e))this.#H.isExpanded(t)||this.#H.expand(t);this.#H.isExpanded(e)||this.#H.expand(e)}#Ae(e){let t=this.#G;if(t===0)return;let n=this.#s===-1?0:this.#s,r=Math.min(t-1,Math.max(0,n+e));(r!==n||this.#s===-1)&&(!this.#l&&this.#F==null&&r>=this.#b.length&&this.#Ie(),this.#Fe(r))}#je(e,t=!0){let n=this.#H.getVisibleCount();this.#U=n;let r=wU(this.#H.getVisibleTreeProjectionData(t?void 0:Math.min(n,bU)),e,t?e=>this.#H.getVisibleIndex(e):void 0);this.#a.clear(),this.#o.clear(),this.#l=r.paths.length>=n,this.#u=r.getParentIndex,this.#b=r.paths,this.#x=r.posInSetByIndex,this.#S=r.setSizeByIndex,this.#ye(),this.#s=e==null?this.#be().length>0?0:-1:this.#Z(e),this.#c=this.#s<0?null:this.#Me(this.#s)}#Me(e){return this.#be()[e]??(this.#F==null?this.#H.getVisibleRowContext(e)?.row.path??null:null)}#Ne(e){return this.#H.getPathInfo(e)?.path??null}#Pe(e){if(e==null)return;let t=this.#Z(e);t>=0&&this.#Fe(t,!1)}#Fe(e,t=!0){let n=this.#Me(e);n!=null&&(this.#s===e&&this.#c===n||(this.#s=e,this.#c=n,t&&this.#De()))}#Ie(){this.#l||this.#je(this.#c,!0)}#Le(e){let t=iU(this.#T,e);t==null&&this.#T!=null&&(this.#E=``),this.#T=t;let n=iU(this.#c,e,!0),r=[...this.#B].map(t=>iU(t,e)).filter(e=>e!=null).map(e=>this.#H.getPathInfo(e)?.path??null).filter(e=>e!=null),i=iU(this.#z,e),a=i==null?null:this.#H.getPathInfo(i)?.path??null,o=[...new Set(r)];return lU(this.#B,o)||(this.#B=new Set(o),this.#V+=1),this.#z=a,n}#Re(){return this.#H.on(`*`,e=>{if(this.#W)return;e.canonicalChanged&&(this.#d.clear(),this.#he()),this.#i!=null&&tU(e)&&(this.#i=null);let t=tU(e)?this.#Le(e):this.#c,n=this.#M!=null&&this.#M.length>0?this.#Ee():this.#M===``?this.#c:t,r=this.#M!=null||e.operation!==`expand`&&e.operation!==`collapse`;this.#je(n,r),this.#De();let i=cU(e);i!=null&&this.#Oe(i)})}#ze(e){if(this.#H.isExpanded(e)){this.#ie(e);return}this.#ke(e)}},EU=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 DU(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 OU(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 kU(e,t){return t?`${e}/`:e}function AU(e,t=null){let n=EU(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=DU(t.path);if(e==null)continue;let n=kU(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 OU(e.path))i.add(t)}return{directoriesWithChanges:i,ignoredDirectoryPaths:a,signature:n,statusByPath:r}}var jU,MU,NU,PU,FU,IU,LU,RU,zU,BU,VU={},HU=[],UU=Array.isArray,WU=HU.slice,GU=Object.assign;function KU(e){e&&e.parentNode&&e.remove()}function qU(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?WU.call(arguments,2):n),JU(e,o,r,i,null)}function JU(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??++MU,__i:-1,__u:0};return i==null&&jU.vnode!=null&&jU.vnode(a),a}function YU(e){return e.children}function XU(e,t){this.props=e,this.context=t,this.__g=0}function ZU(e,t){if(t==null)return e.__?ZU(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`?ZU(e):null}function QU(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 QU(e)}}function $U(e){(8&e.__g||!(e.__g|=8)||!NU.push(e)||FU++)&&PU==jU.debounceRendering||((PU=jU.debounceRendering)||queueMicrotask)(eW)}function eW(){for(var e,t,n,r,i,a,o,s,c=1;NU.length;)NU.length>c&&NU.sort(IU),e=NU.shift(),c=NU.length,8&e.__g&&(n=void 0,i=(r=(t=e).__v).__e,a=[],o=[],(s=t.__P)&&((n=GU({},r)).__v=r.__v+1,jU.vnode&&jU.vnode(n),cW(s,n,r,t.__n,s.namespaceURI,32&r.__u?[i]:null,a,i??ZU(r),!!(32&r.__u),o,s.ownerDocument),n.__v=r.__v,n.__.__k[n.__i]=n,uW(a,n,o),n.__e!=i&&QU(n)));FU=0}function tW(e,t,n,r,i,a,o,s,c,l,u,d){var f,p,m,h,g,_,v,y=r&&r.__k||HU,b=t.length;for(c=nW(n,t,y,c,b),f=0;f<b;f++)(m=n.__k[f])!=null&&(p=m.__i==-1?VU:y[m.__i]||VU,m.__i=f,_=cW(e,m,p,i,a,o,s,c,l,u,d),h=m.__e,m.ref&&p.ref!=m.ref&&(p.ref&&pW(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=rW(m,c,e,v):typeof m.type==`function`&&_!==void 0?c=_:h&&(c=h.nextSibling),m.__u&=-7);return n.__e=g,c}function nW(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?JU(null,o,null,null,null):UU(o)?JU(YU,{children:o},null,null,null):o.constructor==null&&o.__b>0?JU(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=iW(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=ZU(s)),mW(s,s));return r}function rW(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=rW(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=ZU(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function iW(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 aW(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n??``}function oW(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||aW(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||aW(e.style,t,n[t])}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(LU,`$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=RU,e.addEventListener(t,a?BU:zU,a)):e.removeEventListener(t,a?BU:zU,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 sW(e){return function(t){if(this.__l){var n=this.__l[t.type+e];if(t.u==null)t.u=RU++;else if(t.u<n.l)return;return n(jU.event?jU.event(t):t)}}}function cW(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=jU.__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 XU(v,x),f.constructor=M,f.render=hW),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=GU({},f.__s)),GU(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=jU.__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=GU({},r,f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),E=d,d!=null&&d.type===YU&&d.key==null&&(E=dW(d.props.children)),s=tW(e,UU(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--;)KU(a[j]);lW(t)}else t.__e=n.__e,t.__k=n.__k,e.then||lW(t);jU.__e(e,t,n)}else s=t.__e=fW(n.__e,t,n,r,i,a,o,c,l,u);return(d=jU.diffed)&&d(t),128&t.__u?void 0:s}function lW(e){e&&e.__c&&(e.__c.__g|=4),e&&e.__k&&e.__k.forEach(lW)}function uW(e,t,n){for(var r=0;r<n.length;r++)pW(n[r],n[++r],n[++r]);jU.__c&&jU.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){jU.__e(e,t.__v)}})}function dW(e){return typeof e!=`object`||!e||e.__b&&e.__b>0?e:UU(e)?e.map(dW):GU({},e)}function fW(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&&=(jU.__m&&jU.__m(t,a),!1),a=null}if(b==null)v===y||s&&e.data==y||(e.data=y);else{if(a&&=WU.call(e.childNodes),v=n.props||VU,!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;oW(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&&!_||oW(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=``),tW(b==`template`?e.content:e,UU(p)?p:[p],t,n,r,b==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&ZU(n,0),s,c,l),a!=null)for(u=a.length;u--;)KU(a[u]);s||(u=`value`,b==`progress`&&h==null?e.removeAttribute(`value`):h==null||h===e[u]&&(b!==`progress`||h)||oW(e,u,h,v[u],i),u=`checked`,g!=null&&g!=e[u]&&oW(e,u,g,v[u],i))}return e}function pW(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){jU.__e(e,n)}}function mW(e,t,n){var r,i;if(jU.unmount&&jU.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||pW(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){jU.__e(e,t)}r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&mW(r[i],t,n||typeof e.type!=`function`);n||KU(e.__e),e.__e&&e.__e.__l&&(e.__e.__l=null),e.__e=e.__c=e.__=null}function hW(e,t,n){return this.constructor(e,n)}function gW(e,t){var n,r,i,a;t==document&&(t=document.documentElement),jU.__&&jU.__(e,t),r=(n=!!(e&&32&e.__u))?null:t.__k,e=t.__k=qU(YU,null,[e]),i=[],a=[],cW(t,e,r||VU,VU,t.namespaceURI,r?null:t.firstChild?WU.call(t.childNodes):null,i,r?r.__e:t.firstChild,n,a,t.ownerDocument),uW(i,e,a)}function _W(e,t){e.__u|=32,gW(e,t)}jU={__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 FU=0,e}},MU=0,XU.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=GU({},this.state);typeof e==`function`&&(e=e(GU({},n),this.props)),e&&GU(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),$U(this))},XU.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),$U(this))},XU.prototype.render=YU,NU=[],FU=0,IU=function(e,t){return e.__v.__b-t.__v.__b},LU=/(PointerCapture)$|Capture$/i,RU=0,zU=sW(!1),BU=sW(!0);var vW=0;Array.isArray;function yW(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:--vW,__i:-1,__u:0,__source:i,__self:a};return jU.vnode&&jU.vnode(l),l}var bW=16,xW=16,SW={};function CW({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}=SW[e]??{width:bW,height:xW},f=r??l,p=i??u,m=a??d??`0 0 ${l} ${u}`;return yW(`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:yW(`use`,{href:c})})}var wW=e=>{if(e.length<2)return[e,``];let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]},TW=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)]},EW=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)]},DW=(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)]},OW=(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)]},kW=(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 AW({children:e,marker:t,variant:n=`default`}){"use no memo";return yW(`div`,{"aria-hidden":!0,"data-truncate-marker-cell":!0,children:yW(`div`,{"data-truncate-marker":!0,children:typeof t==`function`?t({children:e}):n===`fade`?yW(`span`,{"data-truncate-fade":!0}):t})})}function jW(e){"use no memo";let{mode:t,children:n}=e;return yW(`div`,{children:[yW(`div`,{"data-truncate-content":`visible`,children:t===`fruncate`?yW(`span`,{children:n}):n}),yW(`div`,{"data-truncate-content":`overflow`,"aria-hidden":!0,children:t===`fruncate`?yW(`span`,{children:n}):n})]})}function MW({children:e,mode:t=`truncate`,marker:n=`…`,variant:r=`default`,...i}){"use no memo";let a=yW(jW,{mode:t,children:e},`content`),o=yW(AW,{marker:n,mode:t,variant:r},`marker`),s=yW(`div`,{"data-truncate-fill":!0},`fill`);return yW(`div`,{"data-truncate-container":t,"data-truncate-variant":r,...i,children:yW(`div`,{"data-truncate-grid":!0,children:t===`truncate`?[a,o]:[o,a,s]})})}function NW({children:e,...t}){"use no memo";return yW(MW,{mode:`truncate`,...t,children:e})}function PW({children:e,...t}){"use no memo";return yW(MW,{mode:`fruncate`,...t,children:e})}function FW({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=yW(NW,{...s,children:t[0]}),l=yW(PW,{...s,children:t[1]})}else{if(typeof e!=`string`)return console.error(`MiddleTruncate: children must be a string`),null;if(e.length===0)return yW(`div`,{className:a,style:o});if(e.length<i)return yW(n===`end`?PW:NW,{...s,className:a,style:o,children:e});let t=null,u=null,d=null;if(typeof r==`string`)r===`center`?t=wW:r===`extension`?t=TW:r===`leaf-path`&&(t=EW);else if(typeof r==`number`)t=DW,u=r;else if(Array.isArray(r)){let[e,n]=r;d=n,e===`last`?t=OW:e===`first`&&(t=kW)}else typeof r==`function`&&(t=r);t??=wW;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=yW(NW,{...s,..._,children:f}),l=yW(PW,{...s,...v,children:p})}return yW(`div`,{"data-truncate-group-container":`middle`,className:a,style:o,children:[yW(`div`,{"data-truncate-segment-priority":n===`start`||n===`equal`?`1`:`2`,children:c}),yW(`div`,{"data-truncate-segment-priority":n===`end`||n===`equal`?`1`:`2`,children:l})]})}var IW={endIndex:-1,startIndex:-1};function LW(e,t,n){return Math.min(Math.max(e,t),n)}function RW(e,t){return e<0||t<e?IW:{endIndex:t,startIndex:e}}function zW(e){return e.startIndex<0||e.endIndex<e.startIndex}function BW(e,t){return zW(e)?0:(e.endIndex-e.startIndex+1)*t}function VW(e,t,n){if(t<=0)return-1;let r=t*n;return e<=0?0:e>=r?t:Math.floor(e/n)}function HW(e,t,n){return t<=0||e<=0?-1:e>=t*n?t-1:Math.ceil(e/n)-1}function UW(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 WW(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 GW(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 KW(e,t,n){if(e.length===0||t<=0)return[];let r=GW(e),i=UW(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=WW(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 qW(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=LW(t.scrollTop,0,o),c=t.stickyRows??KW(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=VW(s,n,t.itemHeight),m=VW(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?IW:RW(m,HW(u+d,n,t.itemHeight)),y=g+1,b=zW(v)?IW:RW(Math.max(y,v.startIndex-a),Math.min(n-1,v.endIndex+a)),x=BW(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:zW(b)?0:b.startIndex*t.itemHeight,startIndex:b.startIndex}}}var JW={added:`A`,deleted:`D`,ignored:null,modified:`M`,renamed:`R`,untracked:`U`},YW={added:`Git status: added`,deleted:`Git status: deleted`,ignored:`Git status: ignored`,modified:`Git status: modified`,renamed:`Git status: renamed`,untracked:`Git status: untracked`},XW=`Contains git status items`;function ZW(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 QW(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,offset:i,topInset:a=0,totalHeight:o,viewportHeight:s}=e;if(i===`nearest`)return ZW({currentScrollTop:t,focusedIndex:n,itemHeight:r,topInset:a,viewportHeight:s});if(n<0)return null;let c=Math.max(0,a),l=n*r,u=Math.max(0,s-c),d=i===`center`?c+Math.max(0,(u-r)/2):c,f=Math.max(0,o-s),p=Math.max(0,Math.min(l-d,f));return p===t?null:p}function $W(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,targetViewportOffset:i,totalHeight:a,viewportHeight:o}=e;if(n<0)return null;let s=Math.max(0,i),c=n*r,l=c+r,u=t+s,d=t+o;if(c>=u&&l<=d)return null;let f=Math.max(0,a-o),p=Math.max(0,Math.min(c-s,f));return p===t?null:p}function eG(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 tG(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 nG(e,t){if(e==null)return t;let n=e.getBoundingClientRect().height;return n>0?n:e.clientHeight>0?e.clientHeight:t}function rG(e,t){return e!=null&&e>0?e:t}function iG(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 aG(e,t,n,r,i=0){let a=ZW({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,topInset:i,viewportHeight:r});return a==null?!1:(e.scrollTop=a,!0)}function oG(e,t,n,r,i,a,o=0){let s=QW({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,offset:a,topInset:o,totalHeight:i,viewportHeight:r});return s==null?!1:(e.scrollTop=s,!0)}function sG(e,t,n,r,i,a){let o=$W({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,targetViewportOffset:a,totalHeight:i,viewportHeight:r});return o==null?!1:(e.scrollTop=o,!0)}function cG(e,t,n,r){return n.end<n.start?null:e<n.start?-t:e>n.end?r:null}function lG(e){let{renamingPath:t,previousRenamingPath:n,hasRenderedInput:r}=e;return t==null?`reset`:r?n===t?`ignore`:`focus-input`:`reveal-canonical`}function uG({ariaLabel:e,isFlattened:t=!1,ref:n,value:r,onBlur:i,onInput:a}){return yW(`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 dG(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 fG(e){let{event:t,mode:n,isSearchOpen:r,isDirectory:i}=e,a=t.ctrlKey||t.metaKey,o=t.shiftKey||a,s=t.shiftKey?{additive:a,kind:`range`}:a?{kind:`toggle`}:{kind:`single`};return{closeSearch:r,revealCanonical:n===`sticky`,selection:s,toggleDirectory:!o&&i}}var pG,mG,hG,gG,_G=Object.is,vG=0,yG=[],bG=jU,xG=bG.__b,SG=bG.__r,CG=bG.diffed,wG=bG.__c,TG=bG.unmount,EG=bG.__;function DG(e,t){bG.__h&&bG.__h(mG,e,vG||t),vG=0;var n=mG.__H||={__:[],__h:[]};return e>=n.__.length&&n.__.push({}),n.__[e]}function OG(e){return vG=1,kG(VG,e)}function kG(e,t,n){var r=DG(pG++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):VG(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);_G(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=mG,!mG.__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,_G(t,e.__[0])||(o=!0)}}),a&&a.call(this,e,t,n)||o};mG.__f=!0;var a=mG.shouldComponentUpdate,o=mG.componentWillUpdate;mG.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)},mG.shouldComponentUpdate=i}return r.__N||r.__}function AG(e,t){var n=DG(pG++,3);!bG.__s&&BG(n.__H,t)&&(n.__=e,n.u=t,mG.__H.__h.push(n))}function jG(e,t){var n=DG(pG++,4);!bG.__s&&BG(n.__H,t)&&(n.__=e,n.u=t,mG.__h.push(n))}function MG(e){return vG=5,NG(function(){return{current:e}},[])}function NG(e,t){var n=DG(pG++,7);return BG(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function PG(e,t){return vG=8,NG(function(){return e},t)}function FG(){for(var e;e=yG.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(RG),e.__H.__h.forEach(zG),e.__H.__h=[]}catch(t){e.__H.__h=[],bG.__e(t,e.__v)}}bG.__b=function(e){mG=null,xG&&xG(e)},bG.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),EG&&EG(e,t)},bG.__r=function(e){SG&&SG(e),pG=0;var t=(mG=e.__c).__H;t&&(hG===mG?(t.__h=[],mG.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(RG),t.__h.forEach(zG),t.__h=[],pG=0)),hG=mG},bG.diffed=function(e){CG&&CG(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(yG.push(t)!==1&&gG===bG.requestAnimationFrame||((gG=bG.requestAnimationFrame)||LG)(FG)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),hG=mG=null},bG.__c=function(e,t){t.some(function(e){try{e.__h.forEach(RG),e.__h=e.__h.filter(function(e){return!e.__||zG(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],bG.__e(n,e.__v)}}),wG&&wG(e,t)},bG.unmount=function(e){TG&&TG(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{RG(e)}catch(e){t=e}}),n.__H=void 0,t&&bG.__e(t,n.__v))};var IG=typeof requestAnimationFrame==`function`;function LG(e){var t,n=function(){clearTimeout(r),IG&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);IG&&(t=requestAnimationFrame(n))}function RG(e){var t=mG,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),mG=t}function zG(e){var t=mG;e.__c=e.__(),mG=t}function BG(e,t){return!e||e.length!==t.length||t.some(function(t,n){return!_G(t,e[n])})}function VG(e,t){return typeof t==`function`?t(e):t}function HG(e,t=null,n=null){"use no memo";let r=e.flattenedSegments;return r==null||r.length===0?t??e.name:yW(`span`,{"data-item-flattened-subitems":!0,children:r.map((e,i)=>{let a=i===r.length-1;return yW(YU,{children:[yW(`span`,{"data-item-flattened-subitem":e.path,"data-item-flattened-subitem-drag-target":n===e.path?`true`:void 0,children:a&&t!=null?t:yW(NW,{children:e.name})}),i<r.length-1?` / `:``]},e.path)})})}function UG(e){return e.isFlattened?e.flattenedSegments?.findLast(e=>e.isTerminal)?.path??e.path:e.path}function WG(e){let t=e.flattenedSegments;return t==null||t.length===0?e.name:t.map(e=>e.name).join(` / `)}function GG(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 KG({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=qW(c,{itemHeight:t,overscan:n,scrollTop:r,stickyRows:s==null?void 0:GG(s,r,t,o),totalRowCount:o,viewportHeight:a}),u=i&&r<=0&&o>0?e.getStickyRowCandidates(1,t):[],d=u!=null&&r<=0?GG(u,1,t,o):i&&r<=0&&c.length>0?KW(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 qG=400,JG=10,YG=40,XG=18;function ZG(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))?QG(e,t,n):a instanceof HTMLElement?a:null}function QG(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 $G(e){let t=e?.closest?.(`[data-type="item"]`);if(!(t instanceof HTMLElement))return e?.closest?.(`[data-file-tree-virtualized-scroll]`)instanceof HTMLElement?{directoryPath:null,flattenedSegmentPath:null,hoveredPath:null,kind:`root`}:null;let n=t.dataset.itemPath??null;if(n==null)return null;let r=e?.closest?.(`[data-item-flattened-subitem]`),i=r instanceof HTMLElement?r.getAttribute(`data-item-flattened-subitem`)??null:null;if(i!=null&&i.endsWith(`/`))return{directoryPath:i,flattenedSegmentPath:i,hoveredPath:n,kind:`directory`};if(t.dataset.itemType===`folder`)return{directoryPath:n,flattenedSegmentPath:null,hoveredPath:n,kind:`directory`};let a=t.dataset.itemParentPath??null;return a==null||a.length===0?{directoryPath:null,flattenedSegmentPath:null,hoveredPath:n,kind:`root`}:{directoryPath:a,flattenedSegmentPath:null,hoveredPath:n,kind:`directory`}}function eK(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 tK(){return navigator.vendor!==`Apple Computer, Inc.`}function nK(e,t){let n=e-t.top;if(n<YG)return-Math.ceil((YG-Math.max(0,n))/YG*XG);let r=t.bottom-e;return r<YG?Math.ceil((YG-Math.max(0,r))/YG*XG):0}function rK(e,t){if(e!=null){let t=JW[e];return t==null?null:{text:t,title:YW[e]}}return t?{icon:{name:`file-tree-icon-dot`,width:6,height:6},title:XW}:null}function iK(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 aK(e){return e!=null&&`toggle`in e}function oK(e){return e.code===`Space`||e.key===` `||e.key===`Spacebar`}function sK(e){return e.key.length===1&&/^[\p{L}\p{N}]$/u.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey}function cK(e){return e==null?``:`[data-item-section="spacing-item"][data-ancestor-path="${e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}"] { opacity: 1; }`}function lK(e){return e.shiftKey&&e.key===`F10`||e.key===`ContextMenu`}function uK(e,t){return t&&lK(e)||(e.ctrlKey||e.metaKey)&&oK(e)?!0:e.key===`ArrowDown`||e.key===`ArrowLeft`||e.key===`ArrowRight`||e.key===`ArrowUp`}var dK=new Set([`ArrowDown`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`]);function fK(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 pK(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 mK(e,t){return{bottom:t,height:0,left:e,right:e,top:t,width:0,x:e,y:t}}function hK(e,t){if(e==null)return t.offsetTop;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.top-r.top}function gK(e,t,n){if(n==null){e.delete(t);return}e.set(t,n)}function _K(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 vK(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 yK(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 bK(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=yK(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 xK(e,t){return{kind:e.kind,name:WG(e),path:t}}function SK(e){return e==null?void 0:`${e}__tree`}function CK(e,t,n){if(e!=null)return`${e}__focused-item-${encodeURIComponent(t)}${n?`__parked`:``}`}function wK(e){return e===`file-tree-icon-chevron`||e===`file-tree-icon-dot`||e===`file-tree-icon-file`||e===`file-tree-icon-lock`}function TK(e,t){if(e==null)return null;if(`text`in e)return yW(`span`,{title:e.title,children:e.text});let n=typeof e.icon==`string`?wK(e.icon)?t(e.icon):{name:e.icon}:wK(e.icon.name)?(()=>{let n=t(e.icon.name),{name:r,...i}=e.icon;return{...n,...i}})():e.icon;return yW(`span`,{title:e.title,children:yW(CW,{...n})})}function EK(e){e!=null&&eG(e.querySelector([`button:not([disabled])`,`[href]`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`, `))??e)}function DK(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=UG(e);return yW(YU,{children:[e.depth>0?yW(`div`,{"data-item-section":`spacing`,children:Array.from({length:e.depth}).map((t,n)=>yW(`div`,{"data-item-section":`spacing-item`,"data-ancestor-path":e.ancestorPaths[n]},n))}):null,yW(`div`,{"data-item-section":`icon`,children:e.kind===`directory`?yW(CW,{...t(`file-tree-icon-chevron`)}):yW(CW,{...t(`file-tree-icon-file`,u)})}),yW(`div`,{"data-item-section":`content`,children:e.isFlattened?HG(e,c,a):c??yW(FW,{minimumLength:5,split:`extension`,children:e.name})}),i?yW(`div`,{"data-item-section":`decoration`,children:r==null?null:TK(r,t)}):null,s?yW(`div`,{"data-item-section":`git`,children:TK(o,t)}):null,n?yW(`div`,{"data-item-section":`action`,children:l?yW(`span`,{"aria-hidden":`true`,"data-item-action-affordance":`decorative`,children:yW(CW,{...t(`file-tree-icon-ellipsis`)})}):null}):null]})}function OK(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=UG(t),{isParked:F=!1,mode:I=`flow`,style:L}=r,R=I===`sticky`,z=_?.get(P)??null??iK(t.ancestorPaths,v,y),B=t.kind===`directory`&&(b?.has(P)??!1),V=A(t,P),H=rK(z,B),U=S&&w,W=V!=null||x||U,ee=U&&T===`always`,G=a.getPath()===P,K=G?a.getValue():``,te=R||!G?null:yW(uG,{ref:D,ariaLabel:`Rename ${WG(t)}`,isFlattened:t.isFlattened,value:K,onBlur:()=>{a.commit()},onInput:e=>{a.setValue(e.currentTarget.value)}}),ne=DK(t,k,{actionLaneEnabled:U,customDecoration:V,decorationLaneEnabled:W,dragTargetFlattenedSegmentPath:l?.flattenedSegmentPath??null,gitDecoration:H,gitLaneActive:x,renameInput:te,showDecorativeActionAffordance:ee}),re={...dG({ariaLabel:WG(t),domId:t.isFocused?CK(h,P,F):void 0,extraStyle:L,features:{actionLaneEnabled:U,contextMenuButtonVisibility:U?T:null,contextMenuEnabled:S,contextMenuTriggerMode:S?C:null,gitLaneActive:x},isParked:F,itemHeight:g,mode:I,row:t,state:{containsGitChange:B,effectiveGitStatus:z,isContextHovered:s===P,isDragTarget:l?.kind===`directory`&&l.directoryPath===P,isDragging:c?.has(P)===!0,isFocusRinged:t.isFocused&&o===P},targetPath:P}),key:n,onContextMenu:S||u?e=>{if(d()){e.preventDefault();return}S&&(e.preventDefault(),E&&(i.focusMountedPathFromInput(P),j(t,P,{anchorRect:mK(e.clientX,e.clientY),source:`right-click`})))}:void 0,onFocus:R?void 0:()=>{i.focusMountedPathFromInput(P)},onKeyDown:R?void 0:N,ref:e=>{O(P,e)}};return!R&&G?yW(`div`,{...re,children:ne}):yW(`button`,{...re,type:`button`,draggable:u&&!F,onDragEnd:u&&!F?p:void 0,onDragStart:u&&!F?e=>{f(e,t,P)}:void 0,onMouseDown:e=>{if(R){e.preventDefault();return}i.isSearchOpen()&&e.preventDefault()},onTouchStart:u&&!F?e=>{m(e,t,P)}:void 0,onClick:e=>{M(e,t,P,I)},children:ne})}function kK(e,t,n){return t.end<t.start?[]:e.controller.getVisibleRows(t.start,t.end).filter(e=>!n.has(UG(e))).map((n,r)=>OK(e,n,t.start+r))}function AK({composition:e,controller:t,gitStatusByPath:n,ignoredGitDirectories:r,directoriesWithGitChanges:i,icons:a,instanceId:o,itemHeight:s=OH,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 _=MG(null),v=MG(null),y=MG(!1),b=MG(null),x=MG(null),S=MG(null),C=MG(null),w=MG(null),T=MG(new Map),E=MG(new Map),D=MG(()=>{}),O=MG(null),k=MG(0),A=MG(!1),j=MG(null);j.current!==t&&(A.current=!1,j.current=t);let M=MG(!1),N=MG(null),P=MG(null),F=MG(!1),I=MG(null),L=MG(null),R=MG(null),z=MG(null),B=MG(null),V=MG(null),H=MG(null),U=MG(null),W=MG(!1),ee=MG(null),G=MG(null),K=MG(null),te=MG(null),ne=NG(()=>new Map,[]),[,re]=OG(0),[ie,ae]=OG(null),[oe,se]=OG(null),[ce,le]=OG(null),[ue,de]=OG(null),[fe,pe]=OG(0),[q,me]=OG(null),he=MG(q);he.current=q;let ge=MG(null),_e=MG(null),ve=MG(null),ye=MG(null),be=MG(null),xe=MG(!1),Se=()=>{_e.current=null,ve.current=null,ye.current=null},Ce=(e,t)=>{_e.current=e,ve.current=null,ye.current=t==null?null:{path:e,scrollTop:t}},we=(e,t)=>{_e.current=null,ve.current={path:e,viewportOffset:t},ye.current=null},Te=MG(d===`retain`&&t.isSearchOpen()),[Ee,De]=OG(p);AG(()=>{p||De(!1)},[p]);let Oe=MG(!1),ke=PG(()=>{Oe.current=!0,De(e=>e&&!1)},[]),[Ae,je]=OG(()=>KG({controller:t,itemHeight:s,overscan:c,scrollTop:0,stickyFolders:h,viewportHeight:g})),[Me,Ne]=OG(!1);AG(()=>{Ne(!0)},[]);let Pe=e?.contextMenu?.enabled===!0||e?.contextMenu?.render!=null||e?.contextMenu?.onOpen!=null||e?.contextMenu?.onClose!=null,Fe=e?.contextMenu?.triggerMode??(Pe?`right-click`:`both`),Ie=Fe===`both`||Fe===`button`,Le=e?.contextMenu?.buttonVisibility??`when-needed`,Re=Fe===`both`||Fe===`right-click`;jG(()=>{let e=S.current;if(e==null)return;let t=e=>{if(!(e instanceof CustomEvent))return;let t=e.detail?.path??null;be.current=t,se(t),de(t==null?null:`pointer`)},n=e=>{e instanceof CustomEvent&&(xe.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 ze=PG((e,t)=>{gK(T.current,e,t)},[]),Be=PG((e,t)=>{gK(E.current,e,t)},[]),Ve=PG(e=>{x.current=e},[]),He=PG(e=>_K(e,E.current,T.current),[]),Ue=n!=null||r!=null||i!=null,{resolveIcon:We}=NG(()=>zR(a),[a]),Ge=t[yU](),Ke=Ge.getPath(),qe=Ke!=null,Je=t.isSearchOpen(),Ye=t.getSearchValue(),Xe=t.getFocusedPath(),Ze=t.getFocusedIndex(),Qe=t.getScrollRequest(),$e=t.isDragAndDropEnabled(),et=t.getDragSession(),tt=NG(()=>et==null?null:new Set(et.draggedPaths),[et]),nt=et?.target??null,rt=et?.primaryPath??null,it=SK(o),{overlayHeight:at,overlayRows:ot,snapshot:st,visibleRows:ct}=Ae,lt=st.physical.viewportHeight,ut=NG(()=>({end:st.window.endIndex,start:st.window.startIndex}),[st.window.endIndex,st.window.startIndex]),dt=ot,ft=st.sticky.rows,pt=st.physical.totalHeight,mt=st.sticky.height,ht=NG(()=>new Set(ft.map(e=>UG(e.row))),[ft]),gt=Ze>=0&&Ze>=ut.start&&Ze<=ut.end,_t=PG((e,t)=>u?.({item:xK(e,t),row:e})??null,[u]),J=PG(e=>eG(e==null?null:T.current.get(e)??null)?!0:eG(S.current),[]),vt=PG(e=>{J(t.focusNearestPath(e))},[t,J]),yt=MG(vt);yt.current=vt;let bt=MG(!0),xt=MG(()=>{}),St=PG((t=!0)=>{let n=he.current;n!=null&&(bt.current=bt.current&&t,me(null),e?.contextMenu?.onClose?.(),bt.current&&vt(n.path))},[e?.contextMenu,vt]);xt.current=St;let Ct=PG(e=>{let t=e==null?null:hK(S.current,e);le(e=>e===t?e:t)},[]),wt=PG((e,n,r)=>{let i=t.getItem(n);if(i==null)return;let a=He(n);if(a?.dataset.fileTreeStickyRow===`true`){let e=C.current;Ce(n,e?.scrollTop??null),M.current=!0,ae(e=>e===n?e:n)}i.focus(),Ct(a),bt.current=!0,me({anchorRect:r?.anchorRect??null,item:xK(e,n),path:n,source:r?.source??`keyboard`})},[t,He,Ct]),Tt=PG(e=>{if(l){if(t.isSearchOpen()){let e=C.current,t=nG(e,lt);I.current=Ze<0||e==null?null:Math.max(0,Math.min(Ze*s-e.scrollTop,Math.max(0,t-s))),F.current=!0}t.startRenaming(e)!==!1&&(de(`focus`),re(e=>e+1))}},[t,Ze,s,l,lt]),Et=PG((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=nG(i,lt),u=t.getVisibleCount()*s,d=r===`sticky-parents`?o.ancestorPaths.length*s:KG({controller:t,itemHeight:s,overscan:c,scrollTop:i.scrollTop,stickyFolders:h,viewportHeight:l}).snapshot.sticky.height;return M.current=!0,sG(i,a,s,l,u,d),D.current(),ge.current=n?e:null,!0},[t,s,c,lt,h]),Dt=()=>y.current===!0||te.current!=null||W.current===!0,Ot=e=>typeof window.requestAnimationFrame==`function`?window.requestAnimationFrame(()=>{e()}):window.setTimeout(e,16),kt=e=>{if(e!=null){if(typeof window.cancelAnimationFrame==`function`){window.cancelAnimationFrame(e);return}window.clearTimeout(e)}},At=()=>{z.current!=null&&(clearTimeout(z.current),z.current=null),R.current=null},jt=()=>{V.current?.remove(),V.current=null},Mt=()=>{kt(L.current),L.current=null,B.current=null},Nt=e=>{let t=S.current?.getRootNode();if(t instanceof ShadowRoot){t.append(e);return}document.body.append(e)},Pt=()=>{U.current?.(),U.current=null,te.current!=null&&(clearTimeout(te.current),te.current=null),W.current=!1,ee.current=null,K.current=null,G.current!=null&&(G.current.setAttribute(`draggable`,`true`),G.current.style.removeProperty(`touch-action`),G.current=null),jt(),At(),Mt(),H.current=null},Ft=(e,n)=>{let r=S.current?.getRootNode(),i=$G(ZG(r instanceof ShadowRoot?r:document,e,n));return t.setDragTarget(i),t.getDragSession()?.target??null},It=e=>{let n=t.getDragAndDropConfig()?.openOnDropDelay??800;if(e==null||e.kind!==`directory`||e.directoryPath==null||n<=0){At();return}let r=t.getItem(e.directoryPath),i=aK(r)?r:null;if(i==null||i.isExpanded()){At();return}let a=`${e.directoryPath}::${e.flattenedSegmentPath??``}`;R.current!==a&&(At(),R.current=a,z.current=setTimeout(()=>{let n=t.getDragSession()?.target;n?.kind!==`directory`||n.directoryPath!==e.directoryPath||n.flattenedSegmentPath!==e.flattenedSegmentPath||i.expand()},n))},Lt=()=>{L.current=null;let e=B.current,n=C.current;if(e==null||n==null||t.getDragSession()==null)return;let r=n.getBoundingClientRect(),i=nK(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()),It(Ft(e.clientX,e.clientY)),L.current=Ot(Lt)},Rt=(e,t)=>{B.current={clientX:e,clientY:t},L.current??=Ot(Lt)},zt=(e,n,r)=>{let i=e.currentTarget;if(i!=null){if(Pt(),jt(),At(),Mt(),t.startDrag(r)===!1){e.preventDefault();return}if(H.current=n,e.dataTransfer!=null&&(e.dataTransfer.effectAllowed=`move`,e.dataTransfer.dropEffect=`move`,e.dataTransfer.setData(`text/plain`,r),tK())){let t=eK(i),n=i.getBoundingClientRect();Object.assign(t.style,{height:`${n.height}px`,opacity:`0.85`,transform:`translate3d(-9999px, 0px, 0)`,width:`${n.width}px`}),Nt(t),V.current=t,e.dataTransfer.setDragImage(t,Math.max(0,e.clientX-n.left),Math.max(0,e.clientY-n.top))}}},Bt=()=>{jt(),At(),Mt(),H.current=null,t.cancelDrag()},Vt=(e,n,r)=>{if(te.current!=null||W.current)return;let i=e.touches[0],a=e.currentTarget;if(i==null||a==null)return;K.current={clientX:i.clientX,clientY:i.clientY},G.current=a,a.setAttribute(`draggable`,`false`);let o=(e={})=>{let t=e.restoreNativeDraggable??!W.current;te.current!=null&&(clearTimeout(te.current),te.current=null),document.removeEventListener(`touchmove`,s),document.removeEventListener(`touchend`,c),document.removeEventListener(`touchcancel`,c),U.current===o&&(U.current=null),t&&(a.setAttribute(`draggable`,`true`),G.current===a&&(G.current=null),K.current=null)},s=e=>{let t=e.touches[0],n=K.current;if(t==null||n==null)return;let r=t.clientX-n.clientX,i=t.clientY-n.clientY;r*r+i*i<=JG*JG||o()},c=()=>{o()};document.addEventListener(`touchmove`,s,{passive:!0}),document.addEventListener(`touchend`,c),document.addEventListener(`touchcancel`,c),U.current=o,te.current=setTimeout(()=>{if(o({restoreNativeDraggable:!1}),t.startDrag(r)===!1){a.setAttribute(`draggable`,`true`),G.current===a&&(G.current=null),K.current=null;return}W.current=!0,G.current=a,a.setAttribute(`draggable`,`false`),a.style.setProperty(`touch-action`,`none`),H.current=n;let e=a.getBoundingClientRect(),s=eK(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`}),Nt(s),V.current=s,ee.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=ee.current;n!=null&&V.current!=null&&(V.current.style.transform=`translate3d(${t.clientX-n.x}px, ${t.clientY-n.y}px, 0)`),It(Ft(t.clientX,t.clientY)),Rt(t.clientX,t.clientY)},l=e=>{let n=e.changedTouches[0];n!=null&&Ft(n.clientX,n.clientY),t.completeDrag(),Pt()},u=()=>{t.cancelDrag(),Pt()};U.current=()=>{document.removeEventListener(`touchmove`,c),document.removeEventListener(`touchend`,l),document.removeEventListener(`touchcancel`,u)},document.addEventListener(`touchmove`,c,{passive:!1}),document.addEventListener(`touchend`,l),document.addEventListener(`touchcancel`,u)},qG)},Ht=e=>{if(q!=null){if(e.key===`Escape`){St(),e.preventDefault(),e.stopPropagation();return}dK.has(e.key)&&(e.preventDefault(),e.stopPropagation());return}if(Ge.isActive()){if(e.key===`Escape`)Ge.cancel();else if(e.key===`Enter`)Ge.commit();else return;de(`focus`),re(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(l&&e.key===`F2`){Tt(Xe??void 0),e.preventDefault(),e.stopPropagation();return}if(Je){if(e.key===`Escape`)F.current=!1,I.current=null,t.closeSearch();else if(e.key===`Enter`){let e=t.getFocusedPath();e!=null&&t.selectOnlyPath(e);let n=C.current,r=nG(n,lt);I.current=Ze<0||n==null?null:Math.max(0,Math.min(Ze*s-n.scrollTop,Math.max(0,r-s))),F.current=!0,t.closeSearch()}else if(e.key===`ArrowDown`)t.focusNextSearchMatch();else if(e.key===`ArrowUp`)t.focusPreviousSearchMatch();else return;de(`focus`),re(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(f&&sK(e)){t.openSearch(e.key),re(e=>e+1),e.preventDefault(),e.stopPropagation();return}let n=Pe&&lK(e),r=uK(e,Pe),i=r&&S.current!=null?tG(S.current):null,a=r?new Set(vK(S.current)):new Set,o=i?.dataset.fileTreeStickyPath??null,c=i?.dataset.fileTreeStickyRow===`true`&&o!=null;if(c&&o!==Xe&&a.has(o)){let e=C.current;Ce(o,e?.scrollTop??null),t.focusPath(o)}let u=t.getFocusedPath(),d=t.getFocusedIndex(),p=t.getFocusedItem();if(p==null)return;let m=aK(p)?p:null,h=u!=null&&(ht.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=_K(u,E.current,T.current);e==null||n==null?y=!1:wt(e,u)}else if((e.ctrlKey||e.metaKey)&&oK(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;de(`focus`);let b=t.getFocusedPath(),x=b!=null&&(ht.has(b)||a.has(b)),w=g&&b!==u,D=n&&c&&o===u&&b===u;if((h||D)&&b!=null&&(w&&x||D))Ce(b,v?.scrollTop??null),M.current=!0,ae(e=>e===b?e:b);else{let t=e.key===`ArrowUp`&&h&&b!==u;b!=null&&(t||_&&b===u)?(we(b,bK(S.current,v,i,u,s,mt,lt)),M.current=!0,ae(e=>e===b?e:b)):Se()}re(e=>e+1),e.preventDefault(),e.stopPropagation()};jG(()=>{if(!(!f||!Je)){if(Te.current){Te.current=!1;return}eG(w.current)}},[Je,f]),jG(()=>{let e=x.current;switch(lG({hasRenderedInput:e!=null,previousRenamingPath:P.current,renamingPath:Ke})){case`reset`:P.current=null;return;case`reveal-canonical`:Ke!=null&&Et(Ke,{restoreTreeFocus:!1,targetOffset:`live-overlay`});return;case`ignore`:return;case`focus-input`:e!=null&&(ge.current=null,P.current=Ke,eG(e),e.select());return}},[ut.end,ut.start,Ke,Et,ht]),jG(()=>{let e=S.current;if(e==null)return;let t=null,n=()=>{t!=null&&(clearTimeout(t),t=null)},r=()=>{let t=tG(e)?.dataset.itemPath??null;ae(e=>e===t?e:t)},i=()=>{n(),M.current=!0,r()},a=i=>{let a=i.relatedTarget;if(a==null){n(),t=setTimeout(()=>{if(t=null,tG(e)!=null){r();return}M.current=!1,ae(null)},0);return}if(!(a instanceof Node)||!e.contains(a)){n(),M.current=!1,ae(null);return}let o=a instanceof HTMLElement?a.dataset.itemPath??null:null;ae(e=>e===o?e:o)};return e.addEventListener(`focusin`,i),e.addEventListener(`focusout`,a),()=>{n(),e.removeEventListener(`focusin`,i),e.removeEventListener(`focusout`,a)}},[]),jG(()=>{let e=S.current;e!=null&&(st.physical.scrollTop<=0?e.dataset.scrollAtTop=`true`:delete e.dataset.scrollAtTop)},[st.physical.scrollTop]),jG(()=>{let e=null,n=C.current,r=b.current,i=S.current;if(n==null)return;O.current=nG(n,g);let a=()=>{let e=t.getVisibleCount(),r=rG(O.current,g),i=Math.max(0,e*s-r);n.scrollTop>i&&(n.scrollTop=i),je(KG({controller:t,itemHeight:s,overscan:c,scrollTop:Math.min(n.scrollTop,i),stickyFolders:h,viewportHeight:r}))};if(!A.current){A.current=!0;let e=t.getFocusedIndex();if(e>=0){let r=rG(O.current,g),i=t.getVisibleRows(e,e)[0]??null;aG(n,e,s,r,h&&i!=null?Math.max(0,Math.min(i.ancestorPaths.length*s,Math.max(0,r-s))):0)}}D.current=a;let o=!1,l=t.subscribe(()=>{o?re(e=>e+1):o=!0,a()}),u=()=>{xe.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,pe(e=>e+1),e=null},50))},d=null,f=()=>{i!=null&&delete i.dataset.overlayReveal,d!=null&&(clearTimeout(d),d=null)},p=()=>{i==null||xe.current===!0||n.scrollTop>0||(i.dataset.overlayReveal=`true`,d!=null&&clearTimeout(d),d=setTimeout(()=>{f()},200))},m=()=>{if(a(),n.scrollTop>0&&f(),he.current!=null&&y.current&&xt.current(),xe.current===!0){y.current=!1;return}se(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:iG(e[0]))??nG(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]),jG(()=>{Pe||q==null||St(!1)},[St,Pe,q]);let Ut=NG(()=>q==null?null:`${q.path}::${q.source}`,[q]);jG(()=>{if(Ut==null){m?.clearSlotContent(jR);return}let t=he.current;if(t==null)return;let n=v.current??_.current;if(n==null)return;let r={anchorElement:n,anchorRect:t.anchorRect??pK(n.getBoundingClientRect()),close:e=>{xt.current(e?.restoreFocus??!0)},restoreFocus:()=>{bt.current&&yt.current(he.current?.path??null)}},i=e?.contextMenu?.render?.(t.item,r)??null;return m?.setSlotContent(jR,i),e?.contextMenu?.onOpen?.(t.item,r),EK(i),queueMicrotask(()=>{i==null||!i.isConnected||document.activeElement===i&&EK(i)}),()=>{m?.clearSlotContent(jR)}},[Ut,e?.contextMenu,m]),jG(()=>{q!=null&&t.getItem(q.path)==null&&St()},[St,q,t]),jG(()=>{if(q==null)return;let e=S.current?.getRootNode(),t=e instanceof ShadowRoot?e.host:S.current,n=e=>{let n=e.target;n instanceof Node&&(fK(e)||_.current?.contains(n)!==!0&&t?.contains(n)!==!0&&St())},r=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),St())};return document.addEventListener(`mousedown`,n,!0),document.addEventListener(`keydown`,r,!0),()=>{document.removeEventListener(`mousedown`,n,!0),document.removeEventListener(`keydown`,r,!0)}},[St,q]),jG(()=>{let e=C.current,n=S.current;if(e==null||n==null){N.current=Xe;return}let r=Xe==null?null:T.current.get(Xe)??null,i=tG(n),a=i?.dataset.itemPath??null,o=qe&&x.current===i,c=f&&w.current===i,l=F.current&&!Je,u=I.current??0,d=ge.current,p=_e.current,m=ve.current,g=ye.current,_=i!=null,v=M.current||_,y=N.current!==Xe,b=p!=null&&p===Xe&&Xe!=null,E=!1,O=!1;if(Qe!=null&&Qe.id!==k.current){k.current=Qe.id;let n=Qe.visibleIndex,r=t.getVisibleRows(n,n)[0]??null;if(r!=null){let t=h?Math.max(0,Math.min(r.ancestorPaths.length*s,Math.max(0,lt-s))):mt;E=!0,O=oG(e,n,s,lt,pt,Qe.offset,t)}t.clearScrollRequest(Qe.id)}let A=!E&&l&&sG(e,Ze,s,lt,pt,u),j=!E&&d!=null&&d===Xe&&sG(e,Ze,s,lt,pt,mt),P=!E&&m!=null&&m.path===Xe&&sG(e,Ze,s,lt,pt,m.viewportOffset),L=!E&&g!=null&&g.path===Xe&&e.scrollTop!==g.scrollTop;if(L&&(e.scrollTop=g.scrollTop),(L||O||j||P||A||v&&y&&d!==Xe&&!b&&aG(e,Ze,s,lt,mt))&&D.current(),E){N.current=Xe;return}if(!v){N.current=Xe;return}if(o){N.current=Xe;return}if(c&&!l){N.current=Xe;return}if(r==null){l&&Ze>=0&&(sG(e,Ze,s,lt,pt,u),D.current()),N.current=Xe;return}(y||l||d===Xe||p===Xe||m?.path===Xe||g?.path===Xe||a==null||a!==Xe)&&(eG(r),d===Xe&&(ge.current=null),p===Xe&&(_e.current=null),m?.path===Xe&&(ve.current=null),g?.path===Xe&&(ye.current=null),F.current=!1,I.current=null),N.current=Xe},[t,Ze,Xe,gt,s,qe,Je,ut,lt,f,Qe,h,mt,pt,ct]);let Wt=Ze>=0&&Ze>=st.visible.startIndex&&Ze<=st.visible.endIndex,Gt=Xe!=null&&dt.some(e=>UG(e.row)===Xe),Kt=Wt||Gt,qt=Ie&&M.current===!0&&Kt?Xe:null,Jt=ue===`pointer`?oe:null,Yt=q?.path??be.current??Jt??qt??oe,Xt=q?.source===`right-click`;jG(()=>{y.current&&q==null||Ct(He(Yt))},[q,He,ut,lt,fe,dt,Yt,Ct,ct]);let Zt=PG(e=>{if(y.current||fK(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&&de(e=>e===`pointer`?e:`pointer`),se(e=>e===i?e:i)},[]),Qt=PG(()=>{se(null)},[]);jG(()=>{if(!$e)return;let e=()=>{Pt(),t.cancelDrag()};return window.addEventListener(`dragend`,e),()=>{window.removeEventListener(`dragend`,e),Pt(),t.cancelDrag()}},[t,$e]);let $t=e=>{if(!$e||t.getDragSession()==null||W.current)return;let n=$G(e.target instanceof HTMLElement?e.target:null);t.setDragTarget(n),It(t.getDragSession()?.target??null),Rt(e.clientX,e.clientY),e.dataTransfer!=null&&(e.dataTransfer.dropEffect=`move`),e.preventDefault()},en=e=>{if(!$e||t.getDragSession()==null||W.current)return;let n=e.relatedTarget;n instanceof Node&&S.current?.contains(n)===!0||(At(),Mt(),t.setDragTarget(null))},tn=e=>{!$e||t.getDragSession()==null||W.current||(e.preventDefault(),Ft(e.clientX,e.clientY),t.completeDrag(),jt(),At(),Mt(),H.current=null)},nn=st.window.height,Y=st.window.offsetTop,rn=Math.min(0,lt-nn),an=Math.min(0,lt-nn-mt),on=ie===Xe||F.current,sn=Xe!=null&&on&&!gt&&Ze>=0?ct[Ze]??t.getVisibleRows(Ze,Ze)[0]??null:null,cn=sn==null?null:cG(Ze,s,ut,nn),ln=H.current,un=rt!=null&&ln!=null&&ln.path===rt&&ln.index>=ut.start&&ln.index<=ut.end,dn=rt!=null&&ln!=null&&ln.path===rt&&!un&&ln.path!==sn?.path?ln:null,fn=dn==null?null:cG(dn.index,s,ut,nn),pn=cK((Ze>=0?ct[Ze]??t.getVisibleRows(Ze,Ze)[0]??null:null)?.ancestorPaths.at(-1)??null),mn=Je&&Xe!=null?CK(o,Xe,!gt):void 0,hn=q?.path??(Je?Xe:ie),gn=q?.path??oe,_n=He(Yt),vn=Pe&&Ie&&!Xt&&!qe&&_n!=null&&ce!=null&&Yt!=null,yn=Pe&&(vn||q!=null),bn=q?.anchorRect,xn=bn==null&&_n!=null&&ce!=null&&(q!=null||vn)?ce:null,Sn=bn==null?xn==null?void 0:{top:`${xn}px`}:{left:`${bn.left}px`,position:`fixed`,right:`auto`,top:`${bn.top}px`},Cn=Xt?{opacity:`0`}:void 0,wn=PG((e,n,r,i)=>{let a=fG({event:{ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey},isDirectory:n.kind===`directory`,isSearchOpen:Je,mode:i}),o=a.toggleDirectory&&n.kind===`directory`,s=o?t.resolveMountedDirectoryPathFromInput(r):null;if(o&&s==null)return;let c=s??r;switch(a.selection.kind){case`range`:t.selectPathRange(c,a.selection.additive);break;case`toggle`:t.togglePathSelectionFromInput(c);break;case`single`:t.selectOnlyMountedPathFromInput(c);break}let l=e.currentTarget instanceof HTMLElement?e.currentTarget:null,u=n.index>=st.visible.startIndex&&n.index<=st.visible.endIndex,d=i===`flow`&&u&&l!=null&&l.dataset.itemParked!==`true`;t.focusMountedPathFromInput(c),d&&(M.current=!0,ae(e=>e===c?e:c),de(`focus`)),o&&t.toggleMountedDirectoryFromInput(c),a.closeSearch&&t.closeSearch(),a.revealCanonical&&Et(c,{targetOffset:`sticky-parents`})},[t,Je,st.visible.endIndex,st.visible.startIndex,Et]),Tn=()=>{if(y.current||!Ie||Yt==null||_n==null)return;let e=t.getItem(Yt);e!=null&&(Ct(_n),bt.current=!0,me({anchorRect:null,item:{kind:e.isDirectory()?`directory`:`file`,name:_n.getAttribute(`aria-label`)??Yt,path:e.getPath()},path:e.getPath(),source:`button`}))},En={contextHoverPath:gn,contextMenuButtonTriggerEnabled:Ie,contextMenuButtonVisibility:Le,contextMenuEnabled:Pe,contextMenuRightClickEnabled:Re,contextMenuTriggerMode:Fe,controller:t,directoriesWithGitChanges:i,dragAndDropEnabled:$e,draggedPathSet:tt,dragTarget:nt,gitLaneActive:Ue,gitStatusByPath:n,handleRowDragEnd:Bt,handleRowDragStart:zt,handleRowTouchStart:Vt,ignoredGitDirectories:r,ignoredInheritanceCache:ne,instanceId:o,itemHeight:s,onKeyDown:Ht,onRowClick:wn,openContextMenuForRow:wt,registerButton:ze,registerRenameInput:Ve,renameView:Ge,renderDecorationForRow:_t,resolveIcon:We,shouldSuppressContextMenu:Dt,visualFocusPath:hn},Dn={...En,registerButton:Be};return yW(`div`,{ref:S,id:it,"data-file-tree-context-menu-button-visibility":Pe&&Ie?Le:void 0,"data-file-tree-context-menu-trigger-mode":Pe?Fe:void 0,"data-file-tree-has-context-menu-action-lane":Pe&&Ie?`true`:void 0,"data-file-tree-has-git-lane":Ue?`true`:void 0,"data-file-tree-virtualized-root":`true`,"data-file-tree-root-drag-target":nt?.kind===`root`?`true`:void 0,onDragLeave:$e?en:void 0,onDragOver:$e?$t:void 0,onDrop:$e?tn:void 0,onKeyDown:Ht,onPointerLeave:Pe?Qt:void 0,onPointerOver:Pe?Zt:void 0,role:`tree`,tabIndex:-1,style:{outline:`none`,position:`relative`},children:[yW(`style`,{"data-file-tree-guide-style":`true`,dangerouslySetInnerHTML:{__html:pn}}),yW(`slot`,{name:AR,"data-type":`header-slot`}),f?yW(`div`,{"data-file-tree-search-container":!0,"data-open":Je?`true`:`false`,children:yW(`input`,{ref:w,"aria-activedescendant":mn,"aria-controls":it,placeholder:`Search…`,"data-file-tree-search-input":!0,"data-file-tree-search-input-fake-focus":Ee?`true`:void 0,value:Ye,onBlur:()=>{d===`retain`&&!Oe.current||t.closeSearch()},onFocus:ke,onPointerDown:ke,onInput:e=>{ke();let n=e.currentTarget;t.setSearch(n.value)}})}):null,yW(`div`,{ref:C,"data-file-tree-virtualized-scroll":`true`,children:[h&&Me&&dt.length>0?yW(`div`,{"aria-hidden":`true`,"data-file-tree-sticky-overlay":`true`,children:yW(`div`,{"data-file-tree-sticky-overlay-content":`true`,style:{height:`${at}px`},children:dt.map((e,t)=>OK(Dn,e.row,`sticky:${UG(e.row)}`,{mode:`sticky`,style:{left:`0`,position:`absolute`,right:`0`,top:`${e.top}px`,zIndex:`${dt.length-t}`}}))})}):null,yW(`div`,{ref:b,"data-file-tree-virtualized-list":`true`,style:{height:`${pt}px`},children:[yW(`div`,{"data-file-tree-virtualized-sticky-offset":`true`,"aria-hidden":`true`,style:{height:`${Y}px`}}),yW(`div`,{"data-file-tree-virtualized-sticky":`true`,style:{height:`${nn}px`,top:`${rn}px`,bottom:`${an}px`},children:[kK(En,ut,ht),sn!=null&&cn!=null?OK(En,sn,`parked:${sn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:rt===sn.path?`none`:void 0,position:`absolute`,right:`0`,top:`${cn}px`}}):null,dn!=null&&fn!=null?OK(En,dn,`parked-drag:${dn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:`none`,position:`absolute`,right:`0`,top:`${fn}px`}}):null]})]})]}),Pe?yW(`div`,{ref:_,"data-type":`context-menu-anchor`,"data-visible":yn?`true`:`false`,style:Sn,children:[yW(`button`,{ref:v,type:`button`,"data-type":MR,"aria-label":`Options`,"aria-haspopup":`menu`,"aria-expanded":q==null?`false`:`true`,"data-visible":vn?`true`:`false`,onMouseDown:e=>{e.preventDefault()},onClick:e=>{if(e.preventDefault(),e.stopPropagation(),q!=null){St();return}Tn()},tabIndex:-1,style:Cn,children:yW(CW,{...We(`file-tree-icon-ellipsis`)})}),q==null?null:yW(`slot`,{name:jR})]}):null,q==null?null:yW(`div`,{"data-type":`context-menu-wash`,"aria-hidden":`true`,onMouseDownCapture:e=>{e.preventDefault(),St()},onTouchStartCapture:e=>{e.preventDefault(),e.stopPropagation(),St()},onTouchMoveCapture:e=>{e.preventDefault(),e.stopPropagation()},onWheelCapture:e=>{e.preventDefault(),e.stopPropagation()}})]})}var jK={hydrateRoot:(e,t)=>{_W(qU(AK,t),e)},renderRoot:(e,t)=>{gW(qU(AK,t),e)},unmountRoot:e=>{gW(null,e)}};function MK(e,t){jK.renderRoot(e,t)}function NK(e,t){jK.hydrateRoot(e,t)}function PK(e){jK.unmountRoot(e)}var FK=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)}}},IK=`__c`,LK=`__k`,RK=`__d`,zK=`__s`,BK=/[\s\n\\/='"\0<>]/,VK=/^(xlink|xmlns|xml)([A-Z])/,HK=/^(?: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])/,UK=/^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/,WK=new Set([`draggable`,`spellcheck`]);function GK(e){e.__g===void 0?e[RK]=!0:e.__g|=8}function KK(e){e.__g===void 0?e[RK]=!1:e.__g&=-9}function qK(e){return e.__g===void 0?!0===e[RK]:!!(8&e.__g)}var JK=/["&<]/;function YK(e){if(e.length===0||!1===JK.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 XK={},ZK=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(`.`)),QK=/[A-Z]/g;function $K(e){var t=``;for(var n in e){var r=e[n];if(r!=null&&r!==``){var i=n[0]==`-`?n:XK[n]||(XK[n]=n.replace(QK,`-$&`).toLowerCase()),a=`;`;typeof r!=`number`||i.startsWith(`--`)||ZK.has(i)||(a=`px;`),t=t+i+`:`+r+a}}return t||void 0}function eq(){this.__d=!0}function tq(e,t){return{__v:e,context:t,props:e.props,setState:eq,forceUpdate:eq,__d:!0,__h:[]}}function nq(e,t,n){if(!e.s){if(n instanceof rq){if(!n.s)return void(n.o=nq.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(nq.bind(null,e,t),nq.bind(null,e,2));e.s=t,e.v=n;let r=e.o;r&&r(e)}}var rq=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{nq(r,1,a(this.v))}catch(e){nq(r,2,e)}return r}return this}return this.o=function(e){try{var i=e.v;1&e.s?nq(r,1,t?t(i):i):n?nq(r,1,n(i)):nq(r,2,i)}catch(e){nq(r,2,e)}},r},e}(),iq,aq,oq,sq,cq={},lq=Array.isArray,uq=Object.assign,dq=``,fq=`<!--$s-->`,pq=`<!--/$s-->`;function mq(e,t){var n,r=e.type,i=!0;return e[IK]?(i=!1,(n=e[IK]).state=n[zK]):n=new r(e.props,t),e[IK]=n,n.__v=e,n.props=e.props,n.context=t,GK(n),n.state??=cq,n[zK]??(n[zK]=n.state),r.getDerivedStateFromProps?n.state=uq({},n.state,r.getDerivedStateFromProps(n.props,n.state)):i&&n.componentWillMount?(n.componentWillMount(),n.state=n[zK]===n.state?n.state:n[zK]):!i&&n.componentWillUpdate&&n.componentWillUpdate(),oq&&oq(e),n.render(n.props,n.state,t)}function hq(e,t,n,r,i,a,o){if(e==null||!0===e||!1===e||e===dq)return dq;var s=typeof e;if(s!=`object`)return s==`function`?dq:s==`string`?YK(e):e+dq;if(lq(e)){var c,l=dq;i[LK]=e;for(var u=e.length,d=0;d<u;d++){var f=e[d];if(f!=null&&typeof f!=`boolean`){var p,m=hq(f,t,n,r,i,a,o);typeof m==`string`?l+=m:(c||=Array(u),l&&c.push(l),l=dq,lq(m)?(p=c).push.apply(p,m):c.push(m))}}return c?(l&&c.push(l),c):l}if(e.constructor!==void 0)return dq;e.__=i,iq&&iq(e);var h=e.type,g=e.props;if(typeof h==`function`){var _,v,y,b=t;if(h===YU){if(`tpl`in g){for(var x=dq,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&&!lq(C)?x+=C:x+=hq(C,t,n,r,e,a,o)}return x}if(`UNSTABLE_comment`in g)return`<!--`+YK(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=mq(e,b),y=e[IK];else{e[IK]=y=tq(e,b);for(var E=0;qK(y)&&E++<25;){KK(y),oq&&oq(e);try{v=h.call(y,g,b)}catch(t){throw a&&t&&typeof t.then==`function`&&(e._suspended=!0),t}}GK(y)}if(y.getChildContext!=null&&(t=uq({},t,y.getChildContext())),T&&jU.errorBoundaries&&(h.getDerivedStateFromError||y.componentDidCatch)){v=v!=null&&v.type===YU&&v.key==null&&v.props.tpl==null?v.props.children:v;try{return hq(v,t,n,r,e,a,!1)}catch(i){return h.getDerivedStateFromError&&(y[zK]=h.getDerivedStateFromError(i)),y.componentDidCatch&&y.componentDidCatch(i,cq),qK(y)?(v=mq(e,t),(y=e[IK]).getChildContext!=null&&(t=uq({},t,y.getChildContext())),hq(v=v!=null&&v.type===YU&&v.key==null&&v.props.tpl==null?v.props.children:v,t,n,r,e,a,o)):dq}finally{aq&&aq(e),sq&&sq(e)}}}v=v!=null&&v.type===YU&&v.key==null&&v.props.tpl==null?v.props.children:v;try{var D=hq(v,t,n,r,e,a,o);return aq&&aq(e),jU.unmount&&jU.unmount(e),e._suspended?typeof D==`string`?fq+D+pq:lq(D)?(D.unshift(fq),D.push(pq),D):D.then(function(e){return fq+e+pq}):D}catch(i){if(!a&&o&&o.onError){var O=function i(s){return o.onError(s,e,function(e,s){try{return hq(e,t,n,r,s,a,o)}catch(e){return i(e)}})}(i);if(O!==void 0)return O;var k=jU.__e;return k&&k(i,e),dq}if(!a||!i||typeof i.then!=`function`)throw i;return i.then(function i(){try{var s=hq(v,t,n,r,e,a,o);return e._suspended?fq+s+pq:s}catch(e){if(!e||typeof e.then!=`function`)throw e;return e.then(i)}})}}var A,j=`<`+h,M=dq;for(var N in g){var P=g[N];if(typeof(P=_q(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=$K(P));break;case`acceptCharset`:N=`accept-charset`;break;case`httpEquiv`:N=`http-equiv`;break;default:if(VK.test(N))N=N.replace(VK,`$1:$2`).toLowerCase();else{if(BK.test(N))continue;N[4]!==`-`&&!WK.has(N)||P==null?n?UK.test(N)&&(N=N===`panose1`?`panose-1`:N.replace(/([A-Z])/g,`-$1`).toLowerCase()):HK.test(N)&&(N=N.toLowerCase()):P+=dq}}P!=null&&!1!==P&&(j=!0===P||P===dq?j+` `+N:j+` `+N+`="`+(typeof P==`string`?YK(P):P+dq)+`"`)}}if(BK.test(h))throw Error(h+` is not a valid HTML tag name in `+j+`>`);if(M||(typeof A==`string`?M=YK(A):A!=null&&!1!==A&&!0!==A&&(M=hq(A,t,h===`svg`||h!==`foreignObject`&&n,r,e,a,o))),aq&&aq(e),sq&&sq(e),!M&&gq.has(h))return j+`/>`;var F=`</`+h+`>`,I=j+`>`;return lq(M)?[I].concat(M,[F]):typeof M==`string`?I+M+F:[I,M,F]}var gq=new Set([`area`,`base`,`br`,`col`,`command`,`embed`,`hr`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`]);function _q(e){return typeof e==`object`&&!!e&&typeof e.peek==`function`&&`value`in e}var vq=0;function yq(e){return e!=null&&e.length>0?e:(vq+=1,`pst_ft_${vq}`)}function bq({initialVisibleRowCount:e,itemHeight:t}){return e==null?420:Math.max(0,e)*(t??OH)}function xq(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 Sq(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 Cq(e){return Array.from(e.children).filter(e=>e instanceof SVGElement)}var wq=class{static LoadedCustomComponent=!0;#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=new FK;#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=yq(a),this.#p=AU(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=DH(n,c),this.#d={itemHeight:this.#u.itemHeight,overscan:d,stickyFolders:_,initialVisibleRowCount:y},this.#t=new TU({...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&&(PK(this.#b),delete this.#b.dataset.fileTreeVirtualizedWrapper,this.#b=void 0),this.#l.clearAll(),this.#l.setHost(null),this.#f!=null&&(delete this.#f.dataset.fileTreeVirtualized,this.#I(this.#f),this.#f=void 0)}cleanUp(){this.unmount(),this.#y?.(),this.#y=null,this.#t.destroy()}getFileTreeContainer(){return this.#f}getItem(e){return this.#t.getItem(e)}getFocusedItem(){return this.#t.getFocusedItem()}getFocusedPath(){return this.#t.getFocusedPath()}getSelectedPaths(){return this.#t.getSelectedPaths()}getComposition(){return this.#e}getItemHeight(){return this.#u.itemHeight}getDensityFactor(){return this.#u.factor}subscribe(e){let t=!1;return this.#t.subscribe(()=>{if(!t){t=!0;return}e()})}focusPath(e){this.#t.focusPath(e)}scrollToPath(e,t){this.#t.scrollToPath(e,t)}focusNearestPath(e){return this.#t.focusNearestPath(e)}add(e){this.#t.add(e)}batch(e){this.#t.batch(e)}move(e,t,n){this.#t.move(e,t,n)}onMutation(e,t){return this.#t.onMutation(e,t)}setSearch(e){this.#t.setSearch(e)}openSearch(e){this.#t.openSearch(e)}closeSearch(){this.#t.closeSearch()}isSearchOpen(){return this.#t.isSearchOpen()}getSearchValue(){return this.#t.getSearchValue()}getSearchMatchingPaths(){return this.#t.getSearchMatchingPaths()}focusNextSearchMatch(){this.#t.focusNextSearchMatch()}focusPreviousSearchMatch(){this.#t.focusPreviousSearchMatch()}startRenaming(e,t){return this.#t.startRenaming(e,t)}remove(e,t){this.#t.remove(e,t)}resetPaths(e,t){this.#t.resetPaths(e,t)}setComposition(e){this.#e=e;let t=this.#T();t!=null&&(this.#O(),MK(t.wrapper,this.#w()))}setGitStatus(e){this.#p=AU(e,this.#p);let t=this.#T();t!=null&&MK(t.wrapper,this.#w())}setIcons(e){this.#m=e;let t=this.#T();t!=null&&(this.#E(t.host,t.wrapper),MK(t.wrapper,this.#w()))}hydrate({fileTreeContainer:e}){let t=this.#P(e),n=this.#N(t);this.#O(),NK(n,this.#w())}render({containerWrapper:e,fileTreeContainer:t}){let n=this.#P(t??this.#f,e),r=this.#N(n);this.#O(),MK(r,this.#w())}#C(){return{initialViewportHeight:bq({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(AR,e());return}this.#l.setSlotHtml(AR,this.#e?.header?.html??null)}#k(e){let t=Cq(e).find(e=>Sq(e)),n=xq(bR(PR(this.#m).set));n!=null&&(t!=null&&t.outerHTML===n.outerHTML||(t==null?e.prepend(n):t.replaceWith(n)))}#A(e){let t=Cq(e),n=t.find(e=>Sq(e)),r=t.filter(e=>e!==n),i=PR(this.#m).spriteSheet?.trim()??``;if(i.length===0){for(let e of r)e.remove();return}let a=xq(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=PR(this.#m);t.colored&&SR(t.set)?e.dataset.fileTreeColoredIcons=`true`:delete e.dataset.fileTreeColoredIcons}#M(e){let t=e.querySelector(`style[${ER}]`);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(ER,``),this.#g.parentNode!==e&&e.appendChild(this.#g),this.#g.textContent=MH(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 RH(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)}},Tq=typeof window>`u`?Q.useEffect:Q.useLayoutEffect;function Eq(e,t,n){let r=e==null?null:(0,Z.jsx)(`div`,{slot:AR,children:e}),i=t!=null&&n!=null?(0,Z.jsx)(`div`,{slot:jR,children:t(n.item,n.context)}):null;return r==null&&i==null?null:(0,Z.jsxs)(Z.Fragment,{children:[r,i]})}function Dq(e,t){return typeof window>`u`&&t!=null?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`template`,{shadowrootmode:`open`,dangerouslySetInnerHTML:{__html:t.shadowHtml}}),e]}):(0,Z.jsx)(Z.Fragment,{children:e})}function Oq(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 kq(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 Aq({header:e,id:t,model:n,preloadedData:r,renderContextMenu:i,...a}){let[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(null),u=(0,Q.useRef)(n.getComposition()),d=(0,Q.useRef)(n);d.current!==n&&(d.current=n,u.current=n.getComposition());let f=i!=null,p=(0,Q.useCallback)(()=>{s(null)},[]),m=(0,Q.useCallback)((e,t)=>{s({context:t,item:e})},[]),h=u.current,g=(0,Q.useMemo)(()=>kq(h,e,f,p,m),[h,p,m,f,e]),_=(0,Q.useCallback)(e=>{l(e)},[]);(0,Q.useEffect)(()=>{f||s(null)},[f]),Tq(()=>{n.setComposition(g)},[g,n]),Tq(()=>{if(c!=null)return r!=null&&Oq(c)?n.hydrate({fileTreeContainer:c}):n.render({fileTreeContainer:c}),()=>{n.unmount(),n.setComposition(h)}},[h,c,n,r]);let v=Dq(Eq(e,i,o),r),y=t??r?.id,b={"--trees-item-height":`${String(n.getItemHeight())}px`,"--trees-density-override":n.getDensityFactor(),...a.style};return(0,Z.jsx)(wR,{...a,id:y,ref:_,style:b,suppressHydrationWarning:r!=null,children:v})}function jq(e){let[t]=(0,Q.useState)(()=>new wq(e)),n=(0,Q.useRef)({timeout:null,model:t});return(0,Q.useEffect)(()=>{let{current:e}=n;return e.timeout!=null&&(clearTimeout(e.timeout),e.timeout=null),()=>{e.timeout=setTimeout(()=>e.model.cleanUp(),1)}},[]),{model:t}}function Mq(){let e=(0,$.c)(16),{_:t}=vt(),{projectLocalBinding:n}=Hu(),r;e[0]!==t||e[1]!==n?(r=()=>{if(n===null)return;let e=n.patch({appearance:{sidebar:{showHiddenFiles:!1,showOnlyMarkdownFiles:!1,showOkFolders:!1}}});e.ok||(console.warn(`[FileTreeFilteredToZeroNotice] view-filter reset rejected:`,Va(e.error)),X.error(t({id:`P47EWZ`}),{description:Va(e.error)}))},e[0]=t,e[1]=n,e[2]=r):r=e[2];let i=r,a;e[3]===t?a=e[4]:(a=t({id:`WHPvOb`}),e[3]=t,e[4]=a);let o;e[5]===a?o=e[6]:(o=(0,Z.jsx)(`span`,{className:`select-none text-sidebar-foreground/30 text-sm`,children:a}),e[5]=a,e[6]=o);let s=n===null,c;e[7]===t?c=e[8]:(c=t({id:`jC8LSZ`}),e[7]=t,e[8]=c);let l;e[9]!==i||e[10]!==s||e[11]!==c?(l=(0,Z.jsx)(Y,{variant:`link`,size:`sm`,className:`font-mono uppercase`,disabled:s,onClick:i,"data-testid":`reset-view-filters`,children:c}),e[9]=i,e[10]=s,e[11]=c,e[12]=l):l=e[12];let u;return e[13]!==o||e[14]!==l?(u=(0,Z.jsxs)(`div`,{"data-testid":`file-tree-filtered-to-zero`,className:`flex flex-1 flex-col items-center justify-center gap-3 py-8`,children:[o,l]}),e[13]=o,e[14]=l,e[15]=u):u=e[15],u}var Nq={density:`compact`,itemHeight:26,flattenEmptyDirectories:!1},Pq={"--trees-level-gap-override":`4px`,"--trees-item-row-gap-override":`4px`,"--trees-icon-width-override":`14px`,"--trees-item-height":`${Nq.itemHeight}px`,"--trees-indent-guide-bg-override":`color-mix(in oklab, var(--trees-fg-muted) 30%, transparent)`},Fq=`
1858
+ }`}var LH=new WeakMap;function RH(e){let t=LH.get(e);if(t!=null)return t;let n=document.createElement(`div`);n.setAttribute(jR,`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(),LH.set(e,i),i}function zH(e,t){if(!e.isConnected)return;let n=RH(t);if(n==null)return;let r=t.querySelector(`style[${MR}]`),i=r instanceof HTMLStyleElement?r:document.createElement(`style`);r instanceof HTMLStyleElement||(i.setAttribute(MR,``),t.appendChild(i)),i.textContent=`:host { ${NR}: ${n}px; }`}var BH;function VH(e){if(typeof CSSStyleSheet<`u`&&typeof CSSStyleSheet.prototype.replaceSync==`function`&&`adoptedStyleSheets`in e){BH??(BH=new CSSStyleSheet,BH.replaceSync(FH(NH)));let t=!1;try{e.adoptedStyleSheets=[BH],t=!0}catch{}if(t){e.querySelector(`style[${kR}]`)?.remove();return}}if(e.querySelector(`style[data-file-tree-style]`)==null){let t=document.createElement(`style`);t.setAttribute(kR,``),t.textContent=FH(NH),e.prepend(t)}}function HH(e,t){UH(e,t),VH(t),zH(e,t)}function UH(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`});HH(this,e)}}if(customElements.define(OR,e),typeof document<`u`)for(let e of Array.from(document.querySelectorAll(OR)))e instanceof HTMLElement&&HH(e,e.shadowRoot??e.attachShadow({mode:`open`}))}var WH=e=>e.startsWith(`f::`)?e.slice(3):e;function GH(e){let t=e.lastIndexOf(`/`);return t<0?{parentPath:``,baseName:e}:{parentPath:e.slice(0,t),baseName:e.slice(t+1)}}function KH(e,t){return e===``?t:`${e}/${t}`}function qH({files:e,path:t,isFolder:n,nextBasename:r}){let i=WH(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}=GH(i);if(a===s)return{nextFiles:e,sourcePath:i,destinationPath:i,isFolder:n};let c=KH(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 JH(e){return e.endsWith(`/`)}function YH(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 XH(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 ZH(e,t){return t.includes(e)?XH(t):[e]}function QH(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 $H(e,t){return{draggedPaths:e,target:t}}function eU(e,t){if(t.kind!==`directory`||t.directoryPath==null)return!1;for(let n of e)if(JH(n)&&(t.directoryPath===n||t.directoryPath.startsWith(n)))return!0;return!1}function tU(e,t){return t.kind===`root`||t.directoryPath==null?YH(e):t.directoryPath}function nU(e,t){let n=e.map(e=>{let n=tU(e,t);return n===e?null:{from:e,to:n,type:`move`}}).filter(e=>e!=null);return n.length===0?null:{operations:n,result:{draggedPaths:e,operation:n.length===1?`move`:`batch`,target:t}}}function rU(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 iU(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(!rU(OH.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 aU(e){return e.operation===`add`||e.operation===`remove`||e.operation===`move`||e.operation===`batch`}function oU(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 sU(e,t){if(e===t)return!0;let n=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(n)}function cU(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 sU(e,t.path)?n?e:null:e;case`move`:return oU(e,t.from,t.to);case`batch`:{let r=e;for(let e of t.events)if(r=cU(r,e,n),r==null)return null;return r}}}function lU(e){return{canonicalChanged:e.canonicalChanged,projectionChanged:e.projectionChanged,visibleCountDelta:e.visibleCountDelta}}function uU(e){switch(e.operation){case`add`:return{...lU(e),operation:`add`,path:e.path};case`remove`:return{...lU(e),operation:`remove`,path:e.path,recursive:e.recursive};case`move`:return{...lU(e),from:e.from,operation:`move`,to:e.to}}}function dU(e){return{...lU(e),events:e.events.filter(e=>e.operation===`add`||e.operation===`remove`||e.operation===`move`).map(e=>uU(e)),operation:`batch`}}function fU(e){switch(e.operation){case`add`:case`remove`:case`move`:return uU(e);case`batch`:return dU(e);default:return null}}function pU(e,t){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}function mU(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 hU(e){return mU(e).at(-1)??null}function gU(e,t){return t==null?e:e.startsWith(t)?e.slice(t.length):e}function _U(e){return e.endsWith(`/`)}var vU=e=>e.toLowerCase();function yU(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`);return n<0?t:t.slice(n+1)}function bU(e){return e.endsWith(`/`)?e.slice(0,-1):e}function xU(e,t){return t&&!e.endsWith(`/`)?`${e}/`:e}var SU=e=>{let t=e.trim();return t.length===0?``:(t.includes(`\\`)?t.replaceAll(`\\`,`/`):t).toLowerCase()},CU=Symbol(`FILE_TREE_RENAME_VIEW`),wU=512,TU=512;function EU(e){return e===`top`||e===`center`?e:`nearest`}function DU(e,t,n){if(e===0)return-1;if(n!=null){let e=t(n);if(e!=null)return e;let r=mU(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 OU(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:DU(e.paths.length,r,t),getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex}}var kU=class{#e;#t=new Set;#n=new Map;#r=null;#i=null;#a=new Map;#o=new Map;#s=-1;#c=null;#l=!1;#u=e=>-1;#d=new Map;#f=null;#p=null;#m=null;#h=null;#g=null;#_;#v;#y;#b=[];#x=new Int32Array;#S=new Int32Array;#C=void 0;#w=!1;#T=null;#E=``;#D=!1;#O=new Set;#k=[];#A;#j=null;#M=null;#N=null;#P=null;#F=null;#I=null;#L=null;#R=0;#z=null;#B=new Set;#V=0;#H;#U=0;#W=!1;#G=0;#K;constructor(e){let{dragAndDrop:t,fileTreeSearchMode:n,initialSearchQuery:r,initialSelectedPaths:i,renaming:a,onSearchChange:o,paths:s,preparedInput:c,...l}=e,u=iU({paths:s,preparedInput:c},`constructor`,l.sort);this.#e=l,t!=null&&t!==!1&&(this.#r=t===!0?{}:t),this.#w=a!=null&&a!==!1,a!=null&&a!==!1&&a!==!0&&(this.#C=a.canRename,this.#v=a.onError,this.#_=a.onRename),this.#y=o,this.#A=n??`hide-non-matches`,this.#H=this.#le(u.paths,u.preparedInput);let d=i?.map(e=>this.#Ne(e)).filter(e=>e!=null)??[],f=d.at(-1)??null;d.length>0&&(this.#B=new Set(d),this.#z=f,this.#V=1),this.#je(f,!1),r!=null&&this.#Te(r,!1),this.#K=this.#Re()}destroy(){this.#K?.(),this.#K=null,this.#n.clear(),this.#t.clear(),this.#d.clear(),this.#i=null,this.#he()}focusFirstItem(){this.#be().length>0&&this.#Fe(0)}focusLastItem(){this.#G<=0||(this.#Ie(),this.#Fe(this.#G-1))}focusNextItem(){this.#Ae(1)}focusParentItem(){if(this.#c==null)return;let e=hU(this.#c);if(e==null)return;let t=this.#Z(e);t>=0&&this.#Fe(t)}focusPath(e){let t=this.#H.getPathInfo(e)?.path??null;if(t==null)return;this.#Ie();let n=this.#Z(t);n>=0&&this.#Fe(n)}scrollToPath(e,t){let n=this.#H.getPathInfo(e)?.path??null;if(n==null)return;this.#Ie();let r=this.#xe(n);r<0||this.#Me(r)!=null&&(t?.focus!==!1&&this.#Fe(r,!1),this.#L={id:this.#R+=1,offset:EU(t?.offset),visibleIndex:r},this.#De())}focusMountedPathFromInput(e){let t=this.#H.getPathInfo(e)?.path??null;if(t==null)return;let n=this.#Z(t);n>=0&&this.#Fe(n)}focusNearestPath(e){let t=this.resolveNearestVisiblePath(e);if(t==null)return null;let n=this.#Z(t);return n>=0?(this.#Fe(n),this.#be()[n]??t):null}focusPreviousItem(){this.#Ae(-1)}getFocusedIndex(){return this.#s}getFocusedItem(){return this.#c==null?null:this.#Q(this.#c)}getFocusedPath(){return this.#c}getScrollRequest(){return this.#L}clearScrollRequest(e){this.#L?.id===e&&(this.#L=null)}resolveNearestVisiblePath(e){let t=this.#be();if(this.#G===0)return null;if(e==null)return this.#c??t[0]??null;let n=this.#H.getPathInfo(e)?.path??e,r=this.#Z(n);return r>=0?t[r]??n:this.#X(n)??this.#c??t[0]??null}getSelectedPaths(){return[...this.#B]}getSelectionVersion(){return this.#V}getVisibleCount(){return this.#G}getVisibleRows(e,t){if(t<e||this.#G===0)return[];let n=Math.max(0,e),r=Math.min(this.#G-1,t);if(r<n)return[];let i=r-n+1;if(this.#F==null&&!this.#l&&r>=this.#b.length&&i<=TU){let e=[];for(let t=n;t<=r;t+=1){let n=this.#H.getVisibleRowContext(t);if(n==null)break;e.push(this.#ee(n))}return e}if(!this.#l&&r>=this.#b.length&&this.#Ie(),this.#F!=null){let e=Array.from({length:r-n+1},(e,t)=>this.#Se(n+t)),t=new Map,i=e[0]??-1,a=i;for(let n=1;n<=e.length;n+=1){let r=e[n];if(r!=null&&r===a+1){a=r;continue}if(i>=0&&this.#H.getVisibleSlice(i,a).forEach((e,n)=>{t.set(i+n,e)}),r==null){i=-1,a=-1;continue}i=r,a=r}return Array.from({length:r-n+1},(e,r)=>{let i=n+r,a=this.#Se(i),o=t.get(a),s=this.#b[a];if(o==null||s==null)throw Error(`Missing projection row for filtered visible index ${String(i)}`);return this.#$(o,i,a,{ancestorPaths:this.#re(a),path:s})})}return this.#H.getVisibleSlice(n,r).map((e,t)=>{let r=n+t,i=this.#b[r];if(i==null)throw Error(`Missing projection path for visible index ${String(r)}`);return this.#$(e,r,r,{ancestorPaths:this.#re(r),path:i})})}getStickyRowCandidates(e,t){if(this.#F!=null)return null;if(this.#G===0||e<=0||t<=0)return[];let n=[];for(let r=0;r<this.#G;r+=1){let i=e+r*t,a=Math.min(this.#G-1,Math.floor(i/t)),o=this.#te(a,r)??(a>0?this.#te(a-1,r):void 0);if(o==null)break;n.push({row:this.#ee(o),subtreeEndIndex:o.subtreeEndIndex})}return n}getItem(e){let t=this.#H.getPathInfo(e);return t==null?null:this.#Q(t.path,t)}resolveMountedDirectoryPathFromInput(e){let t=this.#H.getPathInfo(e);return t?.kind===`directory`?t.path:null}toggleMountedDirectoryFromInput(e){let t=this.resolveMountedDirectoryPathFromInput(e);t!=null&&this.#ze(t)}selectAllVisiblePaths(){this.#Ie();let e=[...this.#be()];this.#ae(e,this.#c??this.#z)}selectOnlyPath(e){let t=this.#Ne(e);t!=null&&this.#ae([t],t)}selectOnlyMountedPathFromInput(e){this.#ae([e],e)}selectPath(e){let t=this.#Ne(e);t==null||this.#B.has(t)||this.#ae([...this.#B,t])}deselectPath(e){let t=this.#Ne(e);t==null||!this.#B.has(t)||this.#ae([...this.#B].filter(e=>e!==t))}toggleFocusedSelection(){this.#c!=null&&this.togglePathSelectionFromInput(this.#c)}togglePathSelection(e){let t=this.#Ne(e);if(t!=null){if(this.#B.has(t)){this.deselectPath(t);return}this.selectPath(t)}}togglePathSelectionFromInput(e){let t=this.#Ne(e);if(t!=null){if(this.#B.has(t)){this.#ae([...this.#B].filter(e=>e!==t),t);return}this.#ae([...this.#B,t],t)}}selectPathRange(e,t){let n=this.#Ne(e);if(n==null)return;this.#Ie();let r=this.#z,i=r==null?-1:this.#Ce(r),a=this.#Ce(n);if(i===-1||a===-1){let e=t?[...this.#B,n]:[n];this.#ae(e,n);return}let[o,s]=i<=a?[i,a]:[a,i],c=this.#be().slice(o,s+1),l=t?[...this.#B,...c]:c;this.#ae(l,r)}extendSelectionFromFocused(e){if(this.#c==null)return;let t=this.#s;if(t===-1)return;let n=Math.min(this.#G-1,Math.max(0,t+e));if(n===t)return;!this.#l&&n>=this.#b.length&&this.#Ie();let r=this.#be(),i=r[t]??null,a=r[n]??null;if(i==null||a==null)return;let o=new Set(this.#B);o.has(i)&&o.has(a)?o.delete(i):o.add(a),this.#ae([...o],this.#z??i,!1),this.#Fe(n)}getDragAndDropConfig(){return this.#r}isDragAndDropEnabled(){return this.#r!=null}getDragSession(){return this.#i==null?null:{draggedPaths:[...this.#i.draggedPaths],primaryPath:this.#i.primaryPath,target:this.#i.target==null?null:{...this.#i.target}}}startDrag(e){if(this.#r==null)return!1;let t=this.#Ne(e);if(t==null||this.#M!=null&&this.#M.length>0)return!1;let n=this.getSelectedPaths(),r=ZH(t,n);return this.#r.canDrag?.(r)===!1?!1:(n.includes(t)||this.#ae([t],t,!1),this.#Pe(t),this.#i={draggedPaths:r,primaryPath:t,target:null},this.#De(),!0)}setDragTarget(e){let t=this.#i;if(t==null)return;let n=e;if(n!=null){let e=$H(t.draggedPaths,n);(eU(t.draggedPaths,n)||this.#r?.canDrop?.(e)===!1)&&(n=null)}QH(t.target,n)||(this.#i={...t,target:n},this.#De())}cancelDrag(){this.#i!=null&&(this.#i=null,this.#De())}completeDrag(){let e=this.#i;if(e==null)return!1;this.#i=null;let t=e.target==null?null:{...e.target};if(t==null)return this.#De(),!1;let n=$H(e.draggedPaths,t);if(eU(e.draggedPaths,t)||this.#r?.canDrop?.(n)===!1)return this.#De(),!1;let r=nU(e.draggedPaths,t);if(r==null)return this.#De(),!1;try{if(r.operations.length===1){let e=r.operations[0];if(e==null||e.type!==`move`)throw Error(`Expected a single move operation for one-item drops`);this.#H.move(e.from,e.to,{collision:e.collision})}else this.#ce(r.operations),this.#H.batch(r.operations)}catch(e){return this.#De(),this.#r?.onDropError?.(e instanceof Error?e.message:String(e),n),!1}return this.#r?.onDropComplete?.(r.result),!0}subscribe(e){return this.#t.add(e),e(),()=>{this.#t.delete(e)}}add(e){this.#H.add(e)}remove(e,t={}){this.#H.remove(e,t)}move(e,t,n={}){this.#H.move(e,t,n)}batch(e){this.#H.batch(e)}onMutation(e,t){let n=e,r=t,i=this.#n.get(n);return i??(i=new Set,this.#n.set(n,i)),i.add(r),()=>{let e=this.#n.get(n);e?.delete(r),e?.size===0&&this.#n.delete(n)}}setSearch(e){this.#Te(e,!0)}openSearch(e=``){this.#Te(e,!0)}closeSearch(){this.#Te(null,!0)}isSearchOpen(){return this.#M!==null}getSearchValue(){return this.#M??``}getSearchMatchingPaths(){return this.#k}focusNextSearchMatch(){this.#we(1)}focusPreviousSearchMatch(){this.#we(-1)}startRenaming(e=this.#c??``,t={}){if(!this.#w)return!1;let n=this.#H.getPathInfo(e);if(n==null)return!1;let r=n.path,i=_U(r),a=bU(r);if(this.#C?.({isFolder:i,path:a})===!1)return!1;for(let e of mU(r))this.#H.isExpanded(e)||this.#H.expand(e);return this.#ae([r],r,!1),this.#M!=null&&(this.#Te(null,!1),this.#y?.(this.#M)),this.#Pe(r),this.#T=r,this.#E=yU(r),this.#D=t.removeIfCanceled??!1,this.#De(),!0}[CU](){return{cancel:()=>{this.#q()},commit:()=>{this.#J()},getPath:()=>this.#T,getValue:()=>this.#E,isActive:()=>this.#T!=null,setValue:e=>{this.#Y(e)}}}#q(){if(this.#T==null)return;let e=this.#T,t=this.#D;if(this.#T=null,this.#E=``,this.#D=!1,t){this.remove(e,_U(e)?{recursive:!0}:void 0);return}this.#Pe(e),this.#De()}#J(){let e=this.#T;if(e==null)return;if(this.#D&&this.#E.trim().length===0){this.#T=null,this.#E=``,this.#D=!1,this.remove(e,_U(e)?{recursive:!0}:void 0);return}let t=_U(e),n=qH({files:this.#H.list(),isFolder:t,nextBasename:this.#E,path:bU(e)});if(this.#T=null,this.#E=``,this.#D=!1,`error`in n){this.#Pe(e),this.#v?.(n.error),this.#De();return}if(n.sourcePath===n.destinationPath){this.#Pe(e),this.#De();return}this.#_?.({destinationPath:n.destinationPath,isFolder:n.isFolder,sourcePath:n.sourcePath}),this.move(xU(n.sourcePath,t),xU(n.destinationPath,t))}#Y(e){this.#T==null||this.#E===e||(this.#E=e,this.#De())}resetPaths(e,t={}){let n=this.#H.list().length,r=this.#G,i=iU({paths:e,preparedInput:t.preparedInput},`resetPaths`,this.#e.sort),a=this.#le(i.paths,i.preparedInput,t.initialExpandedPaths),o=this.#c,s=this.#T,c=this.getSelectedPaths(),l=this.#z;this.#K?.(),this.#H=a,this.#d.clear(),this.#he();let u=c.map(e=>a.getPathInfo(e)?.path??null).filter(e=>e!=null),d=!pU(this.#B,u);this.#B=new Set(u),d&&(this.#V+=1),this.#z=l==null?null:a.getPathInfo(l)?.path??null,this.#T=s==null?null:a.getPathInfo(s)?.path??null,this.#T??(this.#E=``,this.#D=!1),this.#je(o,o!=null||u.length>0||this.#z!=null),this.#K=this.#Re(),this.#De(),this.#Oe({canonicalChanged:!0,operation:`reset`,pathCountAfter:i.paths.length,pathCountBefore:n,projectionChanged:!0,usedPreparedInput:t.preparedInput!=null,visibleCountDelta:this.#G-r})}#X(e){this.#Ie();let t=hU(e),n=gU(e,t),r=null,i=null;for(let e of this.#be()){if(hU(e)!==t)continue;let a=gU(e,t);if(a<n){r=e;continue}if(a>n){i=e;break}}return r??i}#Z(e){let t=this.#Ce(e);if(t!==-1)return t;let n=mU(e);for(let e=n.length-1;e>=0;--e){let t=n[e];if(t==null)continue;let r=this.#Ce(t);if(r!==-1)return r}return this.#be().length>0?0:-1}#Q(e,t){let n=this.#d.get(e);if(n!=null)return n;let r=t??this.#H.getPathInfo(e);if(r==null)return null;let i=r.kind===`directory`?this.#oe(r.path):this.#se(r.path);return this.#d.set(r.path,i),i}#$(e,t,n,r){return{ancestorPaths:r.ancestorPaths,depth:e.depth,flattenedSegments:e.flattenedSegments?.map(e=>({isTerminal:e.isTerminal,name:e.name,path:e.path})),hasChildren:e.hasChildren,index:t,isExpanded:e.isExpanded,isFlattened:e.isFlattened,isFocused:r.path===this.#c,isSelected:this.#B.has(r.path),kind:e.kind,level:e.depth,name:e.name,path:r.path,posInSet:r.posInSet??this.#x[n]??0,setSize:r.setSize??this.#S[n]??0}}#ee(e){return this.#$(e.row,e.index,e.index,{ancestorPaths:e.ancestorPaths,path:e.row.path,posInSet:e.posInSet,setSize:e.setSize})}#te(e,t){let n=this.#H.getVisibleRowContext(e);return n==null?void 0:n.ancestorRows[t]??(t===n.ancestorRows.length&&n.row.kind===`directory`&&n.row.isExpanded?n:void 0)}#ne(e){let t=this.#a.get(e);if(t!=null)return t;let n=this.#u(e),r=n<0?[]:[...this.#ne(n),n];return this.#a.set(e,r),r}#re(e){let t=this.#o.get(e);if(t!=null)return t;let n=this.#ne(e).map(e=>this.#b[e]??``).filter(e=>e!==``);return this.#o.set(e,n),n}#ie(e){this.#H.collapse(e)}#ae(e,t=this.#z,n=!0){let r=[...new Set(e)],i=!pU(this.#B,r),a=this.#z!==t;!i&&!a||(this.#B=new Set(r),this.#z=t,i&&(this.#V+=1),n&&this.#De())}#oe(e){return{collapse:()=>{this.#ie(e)},deselect:()=>{this.deselectPath(e)},expand:()=>{this.#ke(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!0,isExpanded:()=>this.#H.isExpanded(e),isFocused:()=>this.#c===e,isSelected:()=>this.#B.has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)},toggle:()=>{this.#ze(e)}}}#se(e){return{deselect:()=>{this.deselectPath(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!1,isFocused:()=>this.#c===e,isSelected:()=>this.#B.has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)}}}#ce(e){let t=this.#H.list();this.#le(t).batch(e)}#le(e,t,n){return new OH({...this.#e,paths:e,preparedInput:t??void 0,...n===void 0?{}:{initialExpandedPaths:n}})}#ue(){return this.#h??=this.#H.list(),this.#h}#de(){if(this.#m!=null)return this.#m;let e=new Set;for(let t of this.#ue()){e.add(t);for(let n of mU(t))e.add(n)}return this.#m=[...e].sort(),this.#m}#fe(){return this.#g??=this.#ue().map(vU),this.#g}#pe(){return this.#f??=this.#de().filter(e=>e.endsWith(`/`)),this.#f}#me(){return this.#p??=this.#pe().map(vU),this.#p}#he(){this.#f=null,this.#p=null,this.#m=null,this.#h=null,this.#g=null}#ge(){return this.#pe().filter(e=>this.#H.isExpanded(e))}#_e(e){let t=new Set(this.#j??[]);if(e)for(let e of this.#B)for(let n of mU(e))t.add(n);this.#ve(t)}#ve(e){this.#W=!0;try{for(let t of this.#pe()){let n=e.has(t),r=this.#H.isExpanded(t);n&&!r?this.#H.expand(t):!n&&r&&this.#H.collapse(t)}}finally{this.#W=!1}}#ye(){if(this.#M==null||this.#M.length===0){this.#k=[],this.#F=null,this.#I=null,this.#P=null,this.#G=this.#U;return}let e=this.#b;if(this.#k=e.filter(e=>this.#O.has(e)),this.#A!==`hide-non-matches`||this.#O.size===0){this.#F=null,this.#I=null,this.#P=null,this.#G=this.#U;return}let t=[],n=[],r=new Map;for(let[i,a]of e.entries())this.#N?.has(a)===!0&&(r.set(a,n.length),t.push(i),n.push(a));this.#F=t,this.#I=n,this.#P=r,this.#G=n.length}#be(){return this.#I??this.#b}#xe(e){return this.#I==null?this.#H.getVisibleIndex(e)??-1:this.#P?.get(e)??-1}#Se(e){return this.#F?.[e]??e}#Ce(e){return this.#P?.get(e)??this.#H.getVisibleIndex(e)??-1}#we(e){let t=this.#k;if(t.length===0)return;let n=this.#c,r=n==null?-1:t.indexOf(n),i=t[r<0?e>0?0:t.length-1:Math.min(t.length-1,Math.max(0,r+e))];i!=null&&this.focusPath(i)}#Te(e,t){let n=e==null?null:SU(e),r=this.#M;if(r!==n){if(r==null&&n!=null&&(this.#j=this.#ge()),this.#M=n,n==null)this.#_e(!0),this.#j=null,this.#O.clear(),this.#N=null,this.#je(this.#c,!0);else if(n.length===0)this.#_e(!1),this.#O.clear(),this.#N=null,this.#je(this.#c,!0);else{let e=this.#Ee();this.#je(e,!0)}t&&(this.#y?.(this.#M),this.#De())}}#Ee(){if(this.#M==null||this.#M.length===0)return this.#O.clear(),this.#c;let e=this.#M,t=this.#ue(),n=this.#fe(),r=[],i=new Set,a=null;for(let o=0;o<t.length;o+=1){if(!n[o].includes(e))continue;let s=t[o];r.push(s),i.add(s),a??=s}let o=this.#pe(),s=this.#me();for(let t=0;t<o.length;t+=1){if(!s[t].includes(e))continue;let n=o[t];i.has(n)||(r.push(n),i.add(n),a??=n)}this.#O=i;let c=this.#A===`hide-non-matches`&&r.length>0?new Set:null;this.#N=c;let l=this.#A===`expand-matches`?new Set(this.#j??[]):new Set;for(let e of r){c?.add(e),e.endsWith(`/`)&&l.add(e);for(let t of mU(e))l.add(t),c?.add(t)}return this.#ve(l),a??this.#c}#De(){for(let e of this.#t)e()}#Oe(e){this.#n.get(e.operation)?.forEach(t=>{t(e)}),this.#n.get(`*`)?.forEach(t=>{t(e)})}#ke(e){for(let t of mU(e))this.#H.isExpanded(t)||this.#H.expand(t);this.#H.isExpanded(e)||this.#H.expand(e)}#Ae(e){let t=this.#G;if(t===0)return;let n=this.#s===-1?0:this.#s,r=Math.min(t-1,Math.max(0,n+e));(r!==n||this.#s===-1)&&(!this.#l&&this.#F==null&&r>=this.#b.length&&this.#Ie(),this.#Fe(r))}#je(e,t=!0){let n=this.#H.getVisibleCount();this.#U=n;let r=OU(this.#H.getVisibleTreeProjectionData(t?void 0:Math.min(n,wU)),e,t?e=>this.#H.getVisibleIndex(e):void 0);this.#a.clear(),this.#o.clear(),this.#l=r.paths.length>=n,this.#u=r.getParentIndex,this.#b=r.paths,this.#x=r.posInSetByIndex,this.#S=r.setSizeByIndex,this.#ye(),this.#s=e==null?this.#be().length>0?0:-1:this.#Z(e),this.#c=this.#s<0?null:this.#Me(this.#s)}#Me(e){return this.#be()[e]??(this.#F==null?this.#H.getVisibleRowContext(e)?.row.path??null:null)}#Ne(e){return this.#H.getPathInfo(e)?.path??null}#Pe(e){if(e==null)return;let t=this.#Z(e);t>=0&&this.#Fe(t,!1)}#Fe(e,t=!0){let n=this.#Me(e);n!=null&&(this.#s===e&&this.#c===n||(this.#s=e,this.#c=n,t&&this.#De()))}#Ie(){this.#l||this.#je(this.#c,!0)}#Le(e){let t=cU(this.#T,e);t==null&&this.#T!=null&&(this.#E=``),this.#T=t;let n=cU(this.#c,e,!0),r=[...this.#B].map(t=>cU(t,e)).filter(e=>e!=null).map(e=>this.#H.getPathInfo(e)?.path??null).filter(e=>e!=null),i=cU(this.#z,e),a=i==null?null:this.#H.getPathInfo(i)?.path??null,o=[...new Set(r)];return pU(this.#B,o)||(this.#B=new Set(o),this.#V+=1),this.#z=a,n}#Re(){return this.#H.on(`*`,e=>{if(this.#W)return;e.canonicalChanged&&(this.#d.clear(),this.#he()),this.#i!=null&&aU(e)&&(this.#i=null);let t=aU(e)?this.#Le(e):this.#c,n=this.#M!=null&&this.#M.length>0?this.#Ee():this.#M===``?this.#c:t,r=this.#M!=null||e.operation!==`expand`&&e.operation!==`collapse`;this.#je(n,r),this.#De();let i=fU(e);i!=null&&this.#Oe(i)})}#ze(e){if(this.#H.isExpanded(e)){this.#ie(e);return}this.#ke(e)}},AU=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 jU(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 MU(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 NU(e,t){return t?`${e}/`:e}function PU(e,t=null){let n=AU(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=jU(t.path);if(e==null)continue;let n=NU(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 MU(e.path))i.add(t)}return{directoriesWithChanges:i,ignoredDirectoryPaths:a,signature:n,statusByPath:r}}var FU,IU,LU,RU,zU,BU,VU,HU,UU,WU,GU={},KU=[],qU=Array.isArray,JU=KU.slice,YU=Object.assign;function XU(e){e&&e.parentNode&&e.remove()}function ZU(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?JU.call(arguments,2):n),QU(e,o,r,i,null)}function QU(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??++IU,__i:-1,__u:0};return i==null&&FU.vnode!=null&&FU.vnode(a),a}function $U(e){return e.children}function eW(e,t){this.props=e,this.context=t,this.__g=0}function tW(e,t){if(t==null)return e.__?tW(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`?tW(e):null}function nW(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 nW(e)}}function rW(e){(8&e.__g||!(e.__g|=8)||!LU.push(e)||zU++)&&RU==FU.debounceRendering||((RU=FU.debounceRendering)||queueMicrotask)(iW)}function iW(){for(var e,t,n,r,i,a,o,s,c=1;LU.length;)LU.length>c&&LU.sort(BU),e=LU.shift(),c=LU.length,8&e.__g&&(n=void 0,i=(r=(t=e).__v).__e,a=[],o=[],(s=t.__P)&&((n=YU({},r)).__v=r.__v+1,FU.vnode&&FU.vnode(n),fW(s,n,r,t.__n,s.namespaceURI,32&r.__u?[i]:null,a,i??tW(r),!!(32&r.__u),o,s.ownerDocument),n.__v=r.__v,n.__.__k[n.__i]=n,mW(a,n,o),n.__e!=i&&nW(n)));zU=0}function aW(e,t,n,r,i,a,o,s,c,l,u,d){var f,p,m,h,g,_,v,y=r&&r.__k||KU,b=t.length;for(c=oW(n,t,y,c,b),f=0;f<b;f++)(m=n.__k[f])!=null&&(p=m.__i==-1?GU:y[m.__i]||GU,m.__i=f,_=fW(e,m,p,i,a,o,s,c,l,u,d),h=m.__e,m.ref&&p.ref!=m.ref&&(p.ref&&_W(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=sW(m,c,e,v):typeof m.type==`function`&&_!==void 0?c=_:h&&(c=h.nextSibling),m.__u&=-7);return n.__e=g,c}function oW(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?QU(null,o,null,null,null):qU(o)?QU($U,{children:o},null,null,null):o.constructor==null&&o.__b>0?QU(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=cW(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=tW(s)),vW(s,s));return r}function sW(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=sW(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=tW(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function cW(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 lW(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n??``}function uW(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||lW(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||lW(e.style,t,n[t])}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(VU,`$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=HU,e.addEventListener(t,a?WU:UU,a)):e.removeEventListener(t,a?WU:UU,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 dW(e){return function(t){if(this.__l){var n=this.__l[t.type+e];if(t.u==null)t.u=HU++;else if(t.u<n.l)return;return n(FU.event?FU.event(t):t)}}}function fW(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=FU.__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 eW(v,x),f.constructor=M,f.render=yW),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=YU({},f.__s)),YU(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=FU.__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=YU({},r,f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),E=d,d!=null&&d.type===$U&&d.key==null&&(E=hW(d.props.children)),s=aW(e,qU(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--;)XU(a[j]);pW(t)}else t.__e=n.__e,t.__k=n.__k,e.then||pW(t);FU.__e(e,t,n)}else s=t.__e=gW(n.__e,t,n,r,i,a,o,c,l,u);return(d=FU.diffed)&&d(t),128&t.__u?void 0:s}function pW(e){e&&e.__c&&(e.__c.__g|=4),e&&e.__k&&e.__k.forEach(pW)}function mW(e,t,n){for(var r=0;r<n.length;r++)_W(n[r],n[++r],n[++r]);FU.__c&&FU.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){FU.__e(e,t.__v)}})}function hW(e){return typeof e!=`object`||!e||e.__b&&e.__b>0?e:qU(e)?e.map(hW):YU({},e)}function gW(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&&=(FU.__m&&FU.__m(t,a),!1),a=null}if(b==null)v===y||s&&e.data==y||(e.data=y);else{if(a&&=JU.call(e.childNodes),v=n.props||GU,!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;uW(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&&!_||uW(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=``),aW(b==`template`?e.content:e,qU(p)?p:[p],t,n,r,b==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&tW(n,0),s,c,l),a!=null)for(u=a.length;u--;)XU(a[u]);s||(u=`value`,b==`progress`&&h==null?e.removeAttribute(`value`):h==null||h===e[u]&&(b!==`progress`||h)||uW(e,u,h,v[u],i),u=`checked`,g!=null&&g!=e[u]&&uW(e,u,g,v[u],i))}return e}function _W(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){FU.__e(e,n)}}function vW(e,t,n){var r,i;if(FU.unmount&&FU.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||_W(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){FU.__e(e,t)}r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&vW(r[i],t,n||typeof e.type!=`function`);n||XU(e.__e),e.__e&&e.__e.__l&&(e.__e.__l=null),e.__e=e.__c=e.__=null}function yW(e,t,n){return this.constructor(e,n)}function bW(e,t){var n,r,i,a;t==document&&(t=document.documentElement),FU.__&&FU.__(e,t),r=(n=!!(e&&32&e.__u))?null:t.__k,e=t.__k=ZU($U,null,[e]),i=[],a=[],fW(t,e,r||GU,GU,t.namespaceURI,r?null:t.firstChild?JU.call(t.childNodes):null,i,r?r.__e:t.firstChild,n,a,t.ownerDocument),mW(i,e,a)}function xW(e,t){e.__u|=32,bW(e,t)}FU={__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 zU=0,e}},IU=0,eW.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=YU({},this.state);typeof e==`function`&&(e=e(YU({},n),this.props)),e&&YU(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),rW(this))},eW.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),rW(this))},eW.prototype.render=$U,LU=[],zU=0,BU=function(e,t){return e.__v.__b-t.__v.__b},VU=/(PointerCapture)$|Capture$/i,HU=0,UU=dW(!1),WU=dW(!0);var SW=0;Array.isArray;function CW(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:--SW,__i:-1,__u:0,__source:i,__self:a};return FU.vnode&&FU.vnode(l),l}var wW=16,TW=16,EW={};function DW({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}=EW[e]??{width:wW,height:TW},f=r??l,p=i??u,m=a??d??`0 0 ${l} ${u}`;return CW(`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:CW(`use`,{href:c})})}var OW=e=>{if(e.length<2)return[e,``];let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]},kW=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)]},AW=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)]},jW=(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)]},MW=(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)]},NW=(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 PW({children:e,marker:t,variant:n=`default`}){"use no memo";return CW(`div`,{"aria-hidden":!0,"data-truncate-marker-cell":!0,children:CW(`div`,{"data-truncate-marker":!0,children:typeof t==`function`?t({children:e}):n===`fade`?CW(`span`,{"data-truncate-fade":!0}):t})})}function FW(e){"use no memo";let{mode:t,children:n}=e;return CW(`div`,{children:[CW(`div`,{"data-truncate-content":`visible`,children:t===`fruncate`?CW(`span`,{children:n}):n}),CW(`div`,{"data-truncate-content":`overflow`,"aria-hidden":!0,children:t===`fruncate`?CW(`span`,{children:n}):n})]})}function IW({children:e,mode:t=`truncate`,marker:n=`…`,variant:r=`default`,...i}){"use no memo";let a=CW(FW,{mode:t,children:e},`content`),o=CW(PW,{marker:n,mode:t,variant:r},`marker`),s=CW(`div`,{"data-truncate-fill":!0},`fill`);return CW(`div`,{"data-truncate-container":t,"data-truncate-variant":r,...i,children:CW(`div`,{"data-truncate-grid":!0,children:t===`truncate`?[a,o]:[o,a,s]})})}function LW({children:e,...t}){"use no memo";return CW(IW,{mode:`truncate`,...t,children:e})}function RW({children:e,...t}){"use no memo";return CW(IW,{mode:`fruncate`,...t,children:e})}function zW({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=CW(LW,{...s,children:t[0]}),l=CW(RW,{...s,children:t[1]})}else{if(typeof e!=`string`)return console.error(`MiddleTruncate: children must be a string`),null;if(e.length===0)return CW(`div`,{className:a,style:o});if(e.length<i)return CW(n===`end`?RW:LW,{...s,className:a,style:o,children:e});let t=null,u=null,d=null;if(typeof r==`string`)r===`center`?t=OW:r===`extension`?t=kW:r===`leaf-path`&&(t=AW);else if(typeof r==`number`)t=jW,u=r;else if(Array.isArray(r)){let[e,n]=r;d=n,e===`last`?t=MW:e===`first`&&(t=NW)}else typeof r==`function`&&(t=r);t??=OW;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=CW(LW,{...s,..._,children:f}),l=CW(RW,{...s,...v,children:p})}return CW(`div`,{"data-truncate-group-container":`middle`,className:a,style:o,children:[CW(`div`,{"data-truncate-segment-priority":n===`start`||n===`equal`?`1`:`2`,children:c}),CW(`div`,{"data-truncate-segment-priority":n===`end`||n===`equal`?`1`:`2`,children:l})]})}var BW={endIndex:-1,startIndex:-1};function VW(e,t,n){return Math.min(Math.max(e,t),n)}function HW(e,t){return e<0||t<e?BW:{endIndex:t,startIndex:e}}function UW(e){return e.startIndex<0||e.endIndex<e.startIndex}function WW(e,t){return UW(e)?0:(e.endIndex-e.startIndex+1)*t}function GW(e,t,n){if(t<=0)return-1;let r=t*n;return e<=0?0:e>=r?t:Math.floor(e/n)}function KW(e,t,n){return t<=0||e<=0?-1:e>=t*n?t-1:Math.ceil(e/n)-1}function qW(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 JW(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 YW(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 XW(e,t,n){if(e.length===0||t<=0)return[];let r=YW(e),i=qW(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=JW(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 ZW(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=VW(t.scrollTop,0,o),c=t.stickyRows??XW(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=GW(s,n,t.itemHeight),m=GW(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?BW:HW(m,KW(u+d,n,t.itemHeight)),y=g+1,b=UW(v)?BW:HW(Math.max(y,v.startIndex-a),Math.min(n-1,v.endIndex+a)),x=WW(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:UW(b)?0:b.startIndex*t.itemHeight,startIndex:b.startIndex}}}var QW={added:`A`,deleted:`D`,ignored:null,modified:`M`,renamed:`R`,untracked:`U`},$W={added:`Git status: added`,deleted:`Git status: deleted`,ignored:`Git status: ignored`,modified:`Git status: modified`,renamed:`Git status: renamed`,untracked:`Git status: untracked`},eG=`Contains git status items`;function tG(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 nG(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,offset:i,topInset:a=0,totalHeight:o,viewportHeight:s}=e;if(i===`nearest`)return tG({currentScrollTop:t,focusedIndex:n,itemHeight:r,topInset:a,viewportHeight:s});if(n<0)return null;let c=Math.max(0,a),l=n*r,u=Math.max(0,s-c),d=i===`center`?c+Math.max(0,(u-r)/2):c,f=Math.max(0,o-s),p=Math.max(0,Math.min(l-d,f));return p===t?null:p}function rG(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,targetViewportOffset:i,totalHeight:a,viewportHeight:o}=e;if(n<0)return null;let s=Math.max(0,i),c=n*r,l=c+r,u=t+s,d=t+o;if(c>=u&&l<=d)return null;let f=Math.max(0,a-o),p=Math.max(0,Math.min(c-s,f));return p===t?null:p}function iG(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 aG(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 oG(e,t){if(e==null)return t;let n=e.getBoundingClientRect().height;return n>0?n:e.clientHeight>0?e.clientHeight:t}function sG(e,t){return e!=null&&e>0?e:t}function cG(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 lG(e,t,n,r,i=0){let a=tG({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,topInset:i,viewportHeight:r});return a==null?!1:(e.scrollTop=a,!0)}function uG(e,t,n,r,i,a,o=0){let s=nG({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,offset:a,topInset:o,totalHeight:i,viewportHeight:r});return s==null?!1:(e.scrollTop=s,!0)}function dG(e,t,n,r,i,a){let o=rG({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,targetViewportOffset:a,totalHeight:i,viewportHeight:r});return o==null?!1:(e.scrollTop=o,!0)}function fG(e,t,n,r){return n.end<n.start?null:e<n.start?-t:e>n.end?r:null}function pG(e){let{renamingPath:t,previousRenamingPath:n,hasRenderedInput:r}=e;return t==null?`reset`:r?n===t?`ignore`:`focus-input`:`reveal-canonical`}function mG({ariaLabel:e,isFlattened:t=!1,ref:n,value:r,onBlur:i,onInput:a}){return CW(`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 hG(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 gG(e){let{event:t,mode:n,isSearchOpen:r,isDirectory:i}=e,a=t.ctrlKey||t.metaKey,o=t.shiftKey||a,s=t.shiftKey?{additive:a,kind:`range`}:a?{kind:`toggle`}:{kind:`single`};return{closeSearch:r,revealCanonical:n===`sticky`,selection:s,toggleDirectory:!o&&i}}var _G,vG,yG,bG,xG=Object.is,SG=0,CG=[],wG=FU,TG=wG.__b,EG=wG.__r,DG=wG.diffed,OG=wG.__c,kG=wG.unmount,AG=wG.__;function jG(e,t){wG.__h&&wG.__h(vG,e,SG||t),SG=0;var n=vG.__H||={__:[],__h:[]};return e>=n.__.length&&n.__.push({}),n.__[e]}function MG(e){return SG=1,NG(GG,e)}function NG(e,t,n){var r=jG(_G++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):GG(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);xG(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=vG,!vG.__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,xG(t,e.__[0])||(o=!0)}}),a&&a.call(this,e,t,n)||o};vG.__f=!0;var a=vG.shouldComponentUpdate,o=vG.componentWillUpdate;vG.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)},vG.shouldComponentUpdate=i}return r.__N||r.__}function PG(e,t){var n=jG(_G++,3);!wG.__s&&WG(n.__H,t)&&(n.__=e,n.u=t,vG.__H.__h.push(n))}function FG(e,t){var n=jG(_G++,4);!wG.__s&&WG(n.__H,t)&&(n.__=e,n.u=t,vG.__h.push(n))}function IG(e){return SG=5,LG(function(){return{current:e}},[])}function LG(e,t){var n=jG(_G++,7);return WG(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function RG(e,t){return SG=8,LG(function(){return e},t)}function zG(){for(var e;e=CG.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(HG),e.__H.__h.forEach(UG),e.__H.__h=[]}catch(t){e.__H.__h=[],wG.__e(t,e.__v)}}wG.__b=function(e){vG=null,TG&&TG(e)},wG.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),AG&&AG(e,t)},wG.__r=function(e){EG&&EG(e),_G=0;var t=(vG=e.__c).__H;t&&(yG===vG?(t.__h=[],vG.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(HG),t.__h.forEach(UG),t.__h=[],_G=0)),yG=vG},wG.diffed=function(e){DG&&DG(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(CG.push(t)!==1&&bG===wG.requestAnimationFrame||((bG=wG.requestAnimationFrame)||VG)(zG)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),yG=vG=null},wG.__c=function(e,t){t.some(function(e){try{e.__h.forEach(HG),e.__h=e.__h.filter(function(e){return!e.__||UG(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],wG.__e(n,e.__v)}}),OG&&OG(e,t)},wG.unmount=function(e){kG&&kG(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{HG(e)}catch(e){t=e}}),n.__H=void 0,t&&wG.__e(t,n.__v))};var BG=typeof requestAnimationFrame==`function`;function VG(e){var t,n=function(){clearTimeout(r),BG&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);BG&&(t=requestAnimationFrame(n))}function HG(e){var t=vG,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),vG=t}function UG(e){var t=vG;e.__c=e.__(),vG=t}function WG(e,t){return!e||e.length!==t.length||t.some(function(t,n){return!xG(t,e[n])})}function GG(e,t){return typeof t==`function`?t(e):t}function KG(e,t=null,n=null){"use no memo";let r=e.flattenedSegments;return r==null||r.length===0?t??e.name:CW(`span`,{"data-item-flattened-subitems":!0,children:r.map((e,i)=>{let a=i===r.length-1;return CW($U,{children:[CW(`span`,{"data-item-flattened-subitem":e.path,"data-item-flattened-subitem-drag-target":n===e.path?`true`:void 0,children:a&&t!=null?t:CW(LW,{children:e.name})}),i<r.length-1?` / `:``]},e.path)})})}function qG(e){return e.isFlattened?e.flattenedSegments?.findLast(e=>e.isTerminal)?.path??e.path:e.path}function JG(e){let t=e.flattenedSegments;return t==null||t.length===0?e.name:t.map(e=>e.name).join(` / `)}function YG(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 XG({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=ZW(c,{itemHeight:t,overscan:n,scrollTop:r,stickyRows:s==null?void 0:YG(s,r,t,o),totalRowCount:o,viewportHeight:a}),u=i&&r<=0&&o>0?e.getStickyRowCandidates(1,t):[],d=u!=null&&r<=0?YG(u,1,t,o):i&&r<=0&&c.length>0?XW(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 ZG=400,QG=10,$G=40,eK=18;function tK(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))?nK(e,t,n):a instanceof HTMLElement?a:null}function nK(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 rK(e){let t=e?.closest?.(`[data-type="item"]`);if(!(t instanceof HTMLElement))return e?.closest?.(`[data-file-tree-virtualized-scroll]`)instanceof HTMLElement?{directoryPath:null,flattenedSegmentPath:null,hoveredPath:null,kind:`root`}:null;let n=t.dataset.itemPath??null;if(n==null)return null;let r=e?.closest?.(`[data-item-flattened-subitem]`),i=r instanceof HTMLElement?r.getAttribute(`data-item-flattened-subitem`)??null:null;if(i!=null&&i.endsWith(`/`))return{directoryPath:i,flattenedSegmentPath:i,hoveredPath:n,kind:`directory`};if(t.dataset.itemType===`folder`)return{directoryPath:n,flattenedSegmentPath:null,hoveredPath:n,kind:`directory`};let a=t.dataset.itemParentPath??null;return a==null||a.length===0?{directoryPath:null,flattenedSegmentPath:null,hoveredPath:n,kind:`root`}:{directoryPath:a,flattenedSegmentPath:null,hoveredPath:n,kind:`directory`}}function iK(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 aK(){return navigator.vendor!==`Apple Computer, Inc.`}function oK(e,t){let n=e-t.top;if(n<$G)return-Math.ceil(($G-Math.max(0,n))/$G*eK);let r=t.bottom-e;return r<$G?Math.ceil(($G-Math.max(0,r))/$G*eK):0}function sK(e,t){if(e!=null){let t=QW[e];return t==null?null:{text:t,title:$W[e]}}return t?{icon:{name:`file-tree-icon-dot`,width:6,height:6},title:eG}:null}function cK(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 lK(e){return e!=null&&`toggle`in e}function uK(e){return e.code===`Space`||e.key===` `||e.key===`Spacebar`}function dK(e){return e.key.length===1&&/^[\p{L}\p{N}]$/u.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey}function fK(e){return e==null?``:`[data-item-section="spacing-item"][data-ancestor-path="${e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}"] { opacity: 1; }`}function pK(e){return e.shiftKey&&e.key===`F10`||e.key===`ContextMenu`}function mK(e,t){return t&&pK(e)||(e.ctrlKey||e.metaKey)&&uK(e)?!0:e.key===`ArrowDown`||e.key===`ArrowLeft`||e.key===`ArrowRight`||e.key===`ArrowUp`}var hK=new Set([`ArrowDown`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`]);function gK(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 _K(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 vK(e,t){return{bottom:t,height:0,left:e,right:e,top:t,width:0,x:e,y:t}}function yK(e,t){if(e==null)return t.offsetTop;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.top-r.top}function bK(e,t,n){if(n==null){e.delete(t);return}e.set(t,n)}function xK(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 SK(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 CK(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 wK(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=CK(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 TK(e,t){return{kind:e.kind,name:JG(e),path:t}}function EK(e){return e==null?void 0:`${e}__tree`}function DK(e,t,n){if(e!=null)return`${e}__focused-item-${encodeURIComponent(t)}${n?`__parked`:``}`}function OK(e){return e===`file-tree-icon-chevron`||e===`file-tree-icon-dot`||e===`file-tree-icon-file`||e===`file-tree-icon-lock`}function kK(e,t){if(e==null)return null;if(`text`in e)return CW(`span`,{title:e.title,children:e.text});let n=typeof e.icon==`string`?OK(e.icon)?t(e.icon):{name:e.icon}:OK(e.icon.name)?(()=>{let n=t(e.icon.name),{name:r,...i}=e.icon;return{...n,...i}})():e.icon;return CW(`span`,{title:e.title,children:CW(DW,{...n})})}function AK(e){e!=null&&iG(e.querySelector([`button:not([disabled])`,`[href]`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`, `))??e)}function jK(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=qG(e);return CW($U,{children:[e.depth>0?CW(`div`,{"data-item-section":`spacing`,children:Array.from({length:e.depth}).map((t,n)=>CW(`div`,{"data-item-section":`spacing-item`,"data-ancestor-path":e.ancestorPaths[n]},n))}):null,CW(`div`,{"data-item-section":`icon`,children:e.kind===`directory`?CW(DW,{...t(`file-tree-icon-chevron`)}):CW(DW,{...t(`file-tree-icon-file`,u)})}),CW(`div`,{"data-item-section":`content`,children:e.isFlattened?KG(e,c,a):c??CW(zW,{minimumLength:5,split:`extension`,children:e.name})}),i?CW(`div`,{"data-item-section":`decoration`,children:r==null?null:kK(r,t)}):null,s?CW(`div`,{"data-item-section":`git`,children:kK(o,t)}):null,n?CW(`div`,{"data-item-section":`action`,children:l?CW(`span`,{"aria-hidden":`true`,"data-item-action-affordance":`decorative`,children:CW(DW,{...t(`file-tree-icon-ellipsis`)})}):null}):null]})}function MK(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=qG(t),{isParked:F=!1,mode:I=`flow`,style:L}=r,R=I===`sticky`,z=_?.get(P)??null??cK(t.ancestorPaths,v,y),B=t.kind===`directory`&&(b?.has(P)??!1),V=A(t,P),H=sK(z,B),U=S&&w,W=V!=null||x||U,ee=U&&T===`always`,G=a.getPath()===P,K=G?a.getValue():``,te=R||!G?null:CW(mG,{ref:D,ariaLabel:`Rename ${JG(t)}`,isFlattened:t.isFlattened,value:K,onBlur:()=>{a.commit()},onInput:e=>{a.setValue(e.currentTarget.value)}}),ne=jK(t,k,{actionLaneEnabled:U,customDecoration:V,decorationLaneEnabled:W,dragTargetFlattenedSegmentPath:l?.flattenedSegmentPath??null,gitDecoration:H,gitLaneActive:x,renameInput:te,showDecorativeActionAffordance:ee}),re={...hG({ariaLabel:JG(t),domId:t.isFocused?DK(h,P,F):void 0,extraStyle:L,features:{actionLaneEnabled:U,contextMenuButtonVisibility:U?T:null,contextMenuEnabled:S,contextMenuTriggerMode:S?C:null,gitLaneActive:x},isParked:F,itemHeight:g,mode:I,row:t,state:{containsGitChange:B,effectiveGitStatus:z,isContextHovered:s===P,isDragTarget:l?.kind===`directory`&&l.directoryPath===P,isDragging:c?.has(P)===!0,isFocusRinged:t.isFocused&&o===P},targetPath:P}),key:n,onContextMenu:S||u?e=>{if(d()){e.preventDefault();return}S&&(e.preventDefault(),E&&(i.focusMountedPathFromInput(P),j(t,P,{anchorRect:vK(e.clientX,e.clientY),source:`right-click`})))}:void 0,onFocus:R?void 0:()=>{i.focusMountedPathFromInput(P)},onKeyDown:R?void 0:N,ref:e=>{O(P,e)}};return!R&&G?CW(`div`,{...re,children:ne}):CW(`button`,{...re,type:`button`,draggable:u&&!F,onDragEnd:u&&!F?p:void 0,onDragStart:u&&!F?e=>{f(e,t,P)}:void 0,onMouseDown:e=>{if(R){e.preventDefault();return}i.isSearchOpen()&&e.preventDefault()},onTouchStart:u&&!F?e=>{m(e,t,P)}:void 0,onClick:e=>{M(e,t,P,I)},children:ne})}function NK(e,t,n){return t.end<t.start?[]:e.controller.getVisibleRows(t.start,t.end).filter(e=>!n.has(qG(e))).map((n,r)=>MK(e,n,t.start+r))}function PK({composition:e,controller:t,gitStatusByPath:n,ignoredGitDirectories:r,directoriesWithGitChanges:i,icons:a,instanceId:o,itemHeight:s=MH,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 _=IG(null),v=IG(null),y=IG(!1),b=IG(null),x=IG(null),S=IG(null),C=IG(null),w=IG(null),T=IG(new Map),E=IG(new Map),D=IG(()=>{}),O=IG(null),k=IG(0),A=IG(!1),j=IG(null);j.current!==t&&(A.current=!1,j.current=t);let M=IG(!1),N=IG(null),P=IG(null),F=IG(!1),I=IG(null),L=IG(null),R=IG(null),z=IG(null),B=IG(null),V=IG(null),H=IG(null),U=IG(null),W=IG(!1),ee=IG(null),G=IG(null),K=IG(null),te=IG(null),ne=LG(()=>new Map,[]),[,re]=MG(0),[ie,ae]=MG(null),[oe,se]=MG(null),[ce,le]=MG(null),[ue,de]=MG(null),[fe,pe]=MG(0),[q,me]=MG(null),he=IG(q);he.current=q;let ge=IG(null),_e=IG(null),ve=IG(null),ye=IG(null),be=IG(null),xe=IG(!1),Se=()=>{_e.current=null,ve.current=null,ye.current=null},Ce=(e,t)=>{_e.current=e,ve.current=null,ye.current=t==null?null:{path:e,scrollTop:t}},we=(e,t)=>{_e.current=null,ve.current={path:e,viewportOffset:t},ye.current=null},Te=IG(d===`retain`&&t.isSearchOpen()),[Ee,De]=MG(p);PG(()=>{p||De(!1)},[p]);let Oe=IG(!1),ke=RG(()=>{Oe.current=!0,De(e=>e&&!1)},[]),[Ae,je]=MG(()=>XG({controller:t,itemHeight:s,overscan:c,scrollTop:0,stickyFolders:h,viewportHeight:g})),[Me,Ne]=MG(!1);PG(()=>{Ne(!0)},[]);let Pe=e?.contextMenu?.enabled===!0||e?.contextMenu?.render!=null||e?.contextMenu?.onOpen!=null||e?.contextMenu?.onClose!=null,Fe=e?.contextMenu?.triggerMode??(Pe?`right-click`:`both`),Ie=Fe===`both`||Fe===`button`,Le=e?.contextMenu?.buttonVisibility??`when-needed`,Re=Fe===`both`||Fe===`right-click`;FG(()=>{let e=S.current;if(e==null)return;let t=e=>{if(!(e instanceof CustomEvent))return;let t=e.detail?.path??null;be.current=t,se(t),de(t==null?null:`pointer`)},n=e=>{e instanceof CustomEvent&&(xe.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 ze=RG((e,t)=>{bK(T.current,e,t)},[]),Be=RG((e,t)=>{bK(E.current,e,t)},[]),Ve=RG(e=>{x.current=e},[]),He=RG(e=>xK(e,E.current,T.current),[]),Ue=n!=null||r!=null||i!=null,{resolveIcon:We}=LG(()=>UR(a),[a]),Ge=t[CU](),Ke=Ge.getPath(),qe=Ke!=null,Je=t.isSearchOpen(),Ye=t.getSearchValue(),Xe=t.getFocusedPath(),Ze=t.getFocusedIndex(),Qe=t.getScrollRequest(),$e=t.isDragAndDropEnabled(),et=t.getDragSession(),tt=LG(()=>et==null?null:new Set(et.draggedPaths),[et]),nt=et?.target??null,rt=et?.primaryPath??null,it=EK(o),{overlayHeight:at,overlayRows:ot,snapshot:st,visibleRows:ct}=Ae,lt=st.physical.viewportHeight,ut=LG(()=>({end:st.window.endIndex,start:st.window.startIndex}),[st.window.endIndex,st.window.startIndex]),dt=ot,ft=st.sticky.rows,pt=st.physical.totalHeight,mt=st.sticky.height,ht=LG(()=>new Set(ft.map(e=>qG(e.row))),[ft]),gt=Ze>=0&&Ze>=ut.start&&Ze<=ut.end,_t=RG((e,t)=>u?.({item:TK(e,t),row:e})??null,[u]),J=RG(e=>iG(e==null?null:T.current.get(e)??null)?!0:iG(S.current),[]),vt=RG(e=>{J(t.focusNearestPath(e))},[t,J]),yt=IG(vt);yt.current=vt;let bt=IG(!0),xt=IG(()=>{}),St=RG((t=!0)=>{let n=he.current;n!=null&&(bt.current=bt.current&&t,me(null),e?.contextMenu?.onClose?.(),bt.current&&vt(n.path))},[e?.contextMenu,vt]);xt.current=St;let Ct=RG(e=>{let t=e==null?null:yK(S.current,e);le(e=>e===t?e:t)},[]),wt=RG((e,n,r)=>{let i=t.getItem(n);if(i==null)return;let a=He(n);if(a?.dataset.fileTreeStickyRow===`true`){let e=C.current;Ce(n,e?.scrollTop??null),M.current=!0,ae(e=>e===n?e:n)}i.focus(),Ct(a),bt.current=!0,me({anchorRect:r?.anchorRect??null,item:TK(e,n),path:n,source:r?.source??`keyboard`})},[t,He,Ct]),Tt=RG(e=>{if(l){if(t.isSearchOpen()){let e=C.current,t=oG(e,lt);I.current=Ze<0||e==null?null:Math.max(0,Math.min(Ze*s-e.scrollTop,Math.max(0,t-s))),F.current=!0}t.startRenaming(e)!==!1&&(de(`focus`),re(e=>e+1))}},[t,Ze,s,l,lt]),Et=RG((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=oG(i,lt),u=t.getVisibleCount()*s,d=r===`sticky-parents`?o.ancestorPaths.length*s:XG({controller:t,itemHeight:s,overscan:c,scrollTop:i.scrollTop,stickyFolders:h,viewportHeight:l}).snapshot.sticky.height;return M.current=!0,dG(i,a,s,l,u,d),D.current(),ge.current=n?e:null,!0},[t,s,c,lt,h]),Dt=()=>y.current===!0||te.current!=null||W.current===!0,Ot=e=>typeof window.requestAnimationFrame==`function`?window.requestAnimationFrame(()=>{e()}):window.setTimeout(e,16),kt=e=>{if(e!=null){if(typeof window.cancelAnimationFrame==`function`){window.cancelAnimationFrame(e);return}window.clearTimeout(e)}},At=()=>{z.current!=null&&(clearTimeout(z.current),z.current=null),R.current=null},jt=()=>{V.current?.remove(),V.current=null},Mt=()=>{kt(L.current),L.current=null,B.current=null},Nt=e=>{let t=S.current?.getRootNode();if(t instanceof ShadowRoot){t.append(e);return}document.body.append(e)},Pt=()=>{U.current?.(),U.current=null,te.current!=null&&(clearTimeout(te.current),te.current=null),W.current=!1,ee.current=null,K.current=null,G.current!=null&&(G.current.setAttribute(`draggable`,`true`),G.current.style.removeProperty(`touch-action`),G.current=null),jt(),At(),Mt(),H.current=null},Ft=(e,n)=>{let r=S.current?.getRootNode(),i=rK(tK(r instanceof ShadowRoot?r:document,e,n));return t.setDragTarget(i),t.getDragSession()?.target??null},It=e=>{let n=t.getDragAndDropConfig()?.openOnDropDelay??800;if(e==null||e.kind!==`directory`||e.directoryPath==null||n<=0){At();return}let r=t.getItem(e.directoryPath),i=lK(r)?r:null;if(i==null||i.isExpanded()){At();return}let a=`${e.directoryPath}::${e.flattenedSegmentPath??``}`;R.current!==a&&(At(),R.current=a,z.current=setTimeout(()=>{let n=t.getDragSession()?.target;n?.kind!==`directory`||n.directoryPath!==e.directoryPath||n.flattenedSegmentPath!==e.flattenedSegmentPath||i.expand()},n))},Lt=()=>{L.current=null;let e=B.current,n=C.current;if(e==null||n==null||t.getDragSession()==null)return;let r=n.getBoundingClientRect(),i=oK(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()),It(Ft(e.clientX,e.clientY)),L.current=Ot(Lt)},Rt=(e,t)=>{B.current={clientX:e,clientY:t},L.current??=Ot(Lt)},zt=(e,n,r)=>{let i=e.currentTarget;if(i!=null){if(Pt(),jt(),At(),Mt(),t.startDrag(r)===!1){e.preventDefault();return}if(H.current=n,e.dataTransfer!=null&&(e.dataTransfer.effectAllowed=`move`,e.dataTransfer.dropEffect=`move`,e.dataTransfer.setData(`text/plain`,r),aK())){let t=iK(i),n=i.getBoundingClientRect();Object.assign(t.style,{height:`${n.height}px`,opacity:`0.85`,transform:`translate3d(-9999px, 0px, 0)`,width:`${n.width}px`}),Nt(t),V.current=t,e.dataTransfer.setDragImage(t,Math.max(0,e.clientX-n.left),Math.max(0,e.clientY-n.top))}}},Bt=()=>{jt(),At(),Mt(),H.current=null,t.cancelDrag()},Vt=(e,n,r)=>{if(te.current!=null||W.current)return;let i=e.touches[0],a=e.currentTarget;if(i==null||a==null)return;K.current={clientX:i.clientX,clientY:i.clientY},G.current=a,a.setAttribute(`draggable`,`false`);let o=(e={})=>{let t=e.restoreNativeDraggable??!W.current;te.current!=null&&(clearTimeout(te.current),te.current=null),document.removeEventListener(`touchmove`,s),document.removeEventListener(`touchend`,c),document.removeEventListener(`touchcancel`,c),U.current===o&&(U.current=null),t&&(a.setAttribute(`draggable`,`true`),G.current===a&&(G.current=null),K.current=null)},s=e=>{let t=e.touches[0],n=K.current;if(t==null||n==null)return;let r=t.clientX-n.clientX,i=t.clientY-n.clientY;r*r+i*i<=QG*QG||o()},c=()=>{o()};document.addEventListener(`touchmove`,s,{passive:!0}),document.addEventListener(`touchend`,c),document.addEventListener(`touchcancel`,c),U.current=o,te.current=setTimeout(()=>{if(o({restoreNativeDraggable:!1}),t.startDrag(r)===!1){a.setAttribute(`draggable`,`true`),G.current===a&&(G.current=null),K.current=null;return}W.current=!0,G.current=a,a.setAttribute(`draggable`,`false`),a.style.setProperty(`touch-action`,`none`),H.current=n;let e=a.getBoundingClientRect(),s=iK(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`}),Nt(s),V.current=s,ee.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=ee.current;n!=null&&V.current!=null&&(V.current.style.transform=`translate3d(${t.clientX-n.x}px, ${t.clientY-n.y}px, 0)`),It(Ft(t.clientX,t.clientY)),Rt(t.clientX,t.clientY)},l=e=>{let n=e.changedTouches[0];n!=null&&Ft(n.clientX,n.clientY),t.completeDrag(),Pt()},u=()=>{t.cancelDrag(),Pt()};U.current=()=>{document.removeEventListener(`touchmove`,c),document.removeEventListener(`touchend`,l),document.removeEventListener(`touchcancel`,u)},document.addEventListener(`touchmove`,c,{passive:!1}),document.addEventListener(`touchend`,l),document.addEventListener(`touchcancel`,u)},ZG)},Ht=e=>{if(q!=null){if(e.key===`Escape`){St(),e.preventDefault(),e.stopPropagation();return}hK.has(e.key)&&(e.preventDefault(),e.stopPropagation());return}if(Ge.isActive()){if(e.key===`Escape`)Ge.cancel();else if(e.key===`Enter`)Ge.commit();else return;de(`focus`),re(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(l&&e.key===`F2`){Tt(Xe??void 0),e.preventDefault(),e.stopPropagation();return}if(Je){if(e.key===`Escape`)F.current=!1,I.current=null,t.closeSearch();else if(e.key===`Enter`){let e=t.getFocusedPath();e!=null&&t.selectOnlyPath(e);let n=C.current,r=oG(n,lt);I.current=Ze<0||n==null?null:Math.max(0,Math.min(Ze*s-n.scrollTop,Math.max(0,r-s))),F.current=!0,t.closeSearch()}else if(e.key===`ArrowDown`)t.focusNextSearchMatch();else if(e.key===`ArrowUp`)t.focusPreviousSearchMatch();else return;de(`focus`),re(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(f&&dK(e)){t.openSearch(e.key),re(e=>e+1),e.preventDefault(),e.stopPropagation();return}let n=Pe&&pK(e),r=mK(e,Pe),i=r&&S.current!=null?aG(S.current):null,a=r?new Set(SK(S.current)):new Set,o=i?.dataset.fileTreeStickyPath??null,c=i?.dataset.fileTreeStickyRow===`true`&&o!=null;if(c&&o!==Xe&&a.has(o)){let e=C.current;Ce(o,e?.scrollTop??null),t.focusPath(o)}let u=t.getFocusedPath(),d=t.getFocusedIndex(),p=t.getFocusedItem();if(p==null)return;let m=lK(p)?p:null,h=u!=null&&(ht.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=xK(u,E.current,T.current);e==null||n==null?y=!1:wt(e,u)}else if((e.ctrlKey||e.metaKey)&&uK(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;de(`focus`);let b=t.getFocusedPath(),x=b!=null&&(ht.has(b)||a.has(b)),w=g&&b!==u,D=n&&c&&o===u&&b===u;if((h||D)&&b!=null&&(w&&x||D))Ce(b,v?.scrollTop??null),M.current=!0,ae(e=>e===b?e:b);else{let t=e.key===`ArrowUp`&&h&&b!==u;b!=null&&(t||_&&b===u)?(we(b,wK(S.current,v,i,u,s,mt,lt)),M.current=!0,ae(e=>e===b?e:b)):Se()}re(e=>e+1),e.preventDefault(),e.stopPropagation()};FG(()=>{if(!(!f||!Je)){if(Te.current){Te.current=!1;return}iG(w.current)}},[Je,f]),FG(()=>{let e=x.current;switch(pG({hasRenderedInput:e!=null,previousRenamingPath:P.current,renamingPath:Ke})){case`reset`:P.current=null;return;case`reveal-canonical`:Ke!=null&&Et(Ke,{restoreTreeFocus:!1,targetOffset:`live-overlay`});return;case`ignore`:return;case`focus-input`:e!=null&&(ge.current=null,P.current=Ke,iG(e),e.select());return}},[ut.end,ut.start,Ke,Et,ht]),FG(()=>{let e=S.current;if(e==null)return;let t=null,n=()=>{t!=null&&(clearTimeout(t),t=null)},r=()=>{let t=aG(e)?.dataset.itemPath??null;ae(e=>e===t?e:t)},i=()=>{n(),M.current=!0,r()},a=i=>{let a=i.relatedTarget;if(a==null){n(),t=setTimeout(()=>{if(t=null,aG(e)!=null){r();return}M.current=!1,ae(null)},0);return}if(!(a instanceof Node)||!e.contains(a)){n(),M.current=!1,ae(null);return}let o=a instanceof HTMLElement?a.dataset.itemPath??null:null;ae(e=>e===o?e:o)};return e.addEventListener(`focusin`,i),e.addEventListener(`focusout`,a),()=>{n(),e.removeEventListener(`focusin`,i),e.removeEventListener(`focusout`,a)}},[]),FG(()=>{let e=S.current;e!=null&&(st.physical.scrollTop<=0?e.dataset.scrollAtTop=`true`:delete e.dataset.scrollAtTop)},[st.physical.scrollTop]),FG(()=>{let e=null,n=C.current,r=b.current,i=S.current;if(n==null)return;O.current=oG(n,g);let a=()=>{let e=t.getVisibleCount(),r=sG(O.current,g),i=Math.max(0,e*s-r);n.scrollTop>i&&(n.scrollTop=i),je(XG({controller:t,itemHeight:s,overscan:c,scrollTop:Math.min(n.scrollTop,i),stickyFolders:h,viewportHeight:r}))};if(!A.current){A.current=!0;let e=t.getFocusedIndex();if(e>=0){let r=sG(O.current,g),i=t.getVisibleRows(e,e)[0]??null;lG(n,e,s,r,h&&i!=null?Math.max(0,Math.min(i.ancestorPaths.length*s,Math.max(0,r-s))):0)}}D.current=a;let o=!1,l=t.subscribe(()=>{o?re(e=>e+1):o=!0,a()}),u=()=>{xe.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,pe(e=>e+1),e=null},50))},d=null,f=()=>{i!=null&&delete i.dataset.overlayReveal,d!=null&&(clearTimeout(d),d=null)},p=()=>{i==null||xe.current===!0||n.scrollTop>0||(i.dataset.overlayReveal=`true`,d!=null&&clearTimeout(d),d=setTimeout(()=>{f()},200))},m=()=>{if(a(),n.scrollTop>0&&f(),he.current!=null&&y.current&&xt.current(),xe.current===!0){y.current=!1;return}se(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:cG(e[0]))??oG(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]),FG(()=>{Pe||q==null||St(!1)},[St,Pe,q]);let Ut=LG(()=>q==null?null:`${q.path}::${q.source}`,[q]);FG(()=>{if(Ut==null){m?.clearSlotContent(FR);return}let t=he.current;if(t==null)return;let n=v.current??_.current;if(n==null)return;let r={anchorElement:n,anchorRect:t.anchorRect??_K(n.getBoundingClientRect()),close:e=>{xt.current(e?.restoreFocus??!0)},restoreFocus:()=>{bt.current&&yt.current(he.current?.path??null)}},i=e?.contextMenu?.render?.(t.item,r)??null;return m?.setSlotContent(FR,i),e?.contextMenu?.onOpen?.(t.item,r),AK(i),queueMicrotask(()=>{i==null||!i.isConnected||document.activeElement===i&&AK(i)}),()=>{m?.clearSlotContent(FR)}},[Ut,e?.contextMenu,m]),FG(()=>{q!=null&&t.getItem(q.path)==null&&St()},[St,q,t]),FG(()=>{if(q==null)return;let e=S.current?.getRootNode(),t=e instanceof ShadowRoot?e.host:S.current,n=e=>{let n=e.target;n instanceof Node&&(gK(e)||_.current?.contains(n)!==!0&&t?.contains(n)!==!0&&St())},r=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),St())};return document.addEventListener(`mousedown`,n,!0),document.addEventListener(`keydown`,r,!0),()=>{document.removeEventListener(`mousedown`,n,!0),document.removeEventListener(`keydown`,r,!0)}},[St,q]),FG(()=>{let e=C.current,n=S.current;if(e==null||n==null){N.current=Xe;return}let r=Xe==null?null:T.current.get(Xe)??null,i=aG(n),a=i?.dataset.itemPath??null,o=qe&&x.current===i,c=f&&w.current===i,l=F.current&&!Je,u=I.current??0,d=ge.current,p=_e.current,m=ve.current,g=ye.current,_=i!=null,v=M.current||_,y=N.current!==Xe,b=p!=null&&p===Xe&&Xe!=null,E=!1,O=!1;if(Qe!=null&&Qe.id!==k.current){k.current=Qe.id;let n=Qe.visibleIndex,r=t.getVisibleRows(n,n)[0]??null;if(r!=null){let t=h?Math.max(0,Math.min(r.ancestorPaths.length*s,Math.max(0,lt-s))):mt;E=!0,O=uG(e,n,s,lt,pt,Qe.offset,t)}t.clearScrollRequest(Qe.id)}let A=!E&&l&&dG(e,Ze,s,lt,pt,u),j=!E&&d!=null&&d===Xe&&dG(e,Ze,s,lt,pt,mt),P=!E&&m!=null&&m.path===Xe&&dG(e,Ze,s,lt,pt,m.viewportOffset),L=!E&&g!=null&&g.path===Xe&&e.scrollTop!==g.scrollTop;if(L&&(e.scrollTop=g.scrollTop),(L||O||j||P||A||v&&y&&d!==Xe&&!b&&lG(e,Ze,s,lt,mt))&&D.current(),E){N.current=Xe;return}if(!v){N.current=Xe;return}if(o){N.current=Xe;return}if(c&&!l){N.current=Xe;return}if(r==null){l&&Ze>=0&&(dG(e,Ze,s,lt,pt,u),D.current()),N.current=Xe;return}(y||l||d===Xe||p===Xe||m?.path===Xe||g?.path===Xe||a==null||a!==Xe)&&(iG(r),d===Xe&&(ge.current=null),p===Xe&&(_e.current=null),m?.path===Xe&&(ve.current=null),g?.path===Xe&&(ye.current=null),F.current=!1,I.current=null),N.current=Xe},[t,Ze,Xe,gt,s,qe,Je,ut,lt,f,Qe,h,mt,pt,ct]);let Wt=Ze>=0&&Ze>=st.visible.startIndex&&Ze<=st.visible.endIndex,Gt=Xe!=null&&dt.some(e=>qG(e.row)===Xe),Kt=Wt||Gt,qt=Ie&&M.current===!0&&Kt?Xe:null,Jt=ue===`pointer`?oe:null,Yt=q?.path??be.current??Jt??qt??oe,Xt=q?.source===`right-click`;FG(()=>{y.current&&q==null||Ct(He(Yt))},[q,He,ut,lt,fe,dt,Yt,Ct,ct]);let Zt=RG(e=>{if(y.current||gK(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&&de(e=>e===`pointer`?e:`pointer`),se(e=>e===i?e:i)},[]),Qt=RG(()=>{se(null)},[]);FG(()=>{if(!$e)return;let e=()=>{Pt(),t.cancelDrag()};return window.addEventListener(`dragend`,e),()=>{window.removeEventListener(`dragend`,e),Pt(),t.cancelDrag()}},[t,$e]);let $t=e=>{if(!$e||t.getDragSession()==null||W.current)return;let n=rK(e.target instanceof HTMLElement?e.target:null);t.setDragTarget(n),It(t.getDragSession()?.target??null),Rt(e.clientX,e.clientY),e.dataTransfer!=null&&(e.dataTransfer.dropEffect=`move`),e.preventDefault()},en=e=>{if(!$e||t.getDragSession()==null||W.current)return;let n=e.relatedTarget;n instanceof Node&&S.current?.contains(n)===!0||(At(),Mt(),t.setDragTarget(null))},tn=e=>{!$e||t.getDragSession()==null||W.current||(e.preventDefault(),Ft(e.clientX,e.clientY),t.completeDrag(),jt(),At(),Mt(),H.current=null)},nn=st.window.height,Y=st.window.offsetTop,rn=Math.min(0,lt-nn),an=Math.min(0,lt-nn-mt),on=ie===Xe||F.current,sn=Xe!=null&&on&&!gt&&Ze>=0?ct[Ze]??t.getVisibleRows(Ze,Ze)[0]??null:null,cn=sn==null?null:fG(Ze,s,ut,nn),ln=H.current,un=rt!=null&&ln!=null&&ln.path===rt&&ln.index>=ut.start&&ln.index<=ut.end,dn=rt!=null&&ln!=null&&ln.path===rt&&!un&&ln.path!==sn?.path?ln:null,fn=dn==null?null:fG(dn.index,s,ut,nn),pn=fK((Ze>=0?ct[Ze]??t.getVisibleRows(Ze,Ze)[0]??null:null)?.ancestorPaths.at(-1)??null),mn=Je&&Xe!=null?DK(o,Xe,!gt):void 0,hn=q?.path??(Je?Xe:ie),gn=q?.path??oe,_n=He(Yt),vn=Pe&&Ie&&!Xt&&!qe&&_n!=null&&ce!=null&&Yt!=null,yn=Pe&&(vn||q!=null),bn=q?.anchorRect,xn=bn==null&&_n!=null&&ce!=null&&(q!=null||vn)?ce:null,Sn=bn==null?xn==null?void 0:{top:`${xn}px`}:{left:`${bn.left}px`,position:`fixed`,right:`auto`,top:`${bn.top}px`},Cn=Xt?{opacity:`0`}:void 0,wn=RG((e,n,r,i)=>{let a=gG({event:{ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey},isDirectory:n.kind===`directory`,isSearchOpen:Je,mode:i}),o=a.toggleDirectory&&n.kind===`directory`,s=o?t.resolveMountedDirectoryPathFromInput(r):null;if(o&&s==null)return;let c=s??r;switch(a.selection.kind){case`range`:t.selectPathRange(c,a.selection.additive);break;case`toggle`:t.togglePathSelectionFromInput(c);break;case`single`:t.selectOnlyMountedPathFromInput(c);break}let l=e.currentTarget instanceof HTMLElement?e.currentTarget:null,u=n.index>=st.visible.startIndex&&n.index<=st.visible.endIndex,d=i===`flow`&&u&&l!=null&&l.dataset.itemParked!==`true`;t.focusMountedPathFromInput(c),d&&(M.current=!0,ae(e=>e===c?e:c),de(`focus`)),o&&t.toggleMountedDirectoryFromInput(c),a.closeSearch&&t.closeSearch(),a.revealCanonical&&Et(c,{targetOffset:`sticky-parents`})},[t,Je,st.visible.endIndex,st.visible.startIndex,Et]),Tn=()=>{if(y.current||!Ie||Yt==null||_n==null)return;let e=t.getItem(Yt);e!=null&&(Ct(_n),bt.current=!0,me({anchorRect:null,item:{kind:e.isDirectory()?`directory`:`file`,name:_n.getAttribute(`aria-label`)??Yt,path:e.getPath()},path:e.getPath(),source:`button`}))},En={contextHoverPath:gn,contextMenuButtonTriggerEnabled:Ie,contextMenuButtonVisibility:Le,contextMenuEnabled:Pe,contextMenuRightClickEnabled:Re,contextMenuTriggerMode:Fe,controller:t,directoriesWithGitChanges:i,dragAndDropEnabled:$e,draggedPathSet:tt,dragTarget:nt,gitLaneActive:Ue,gitStatusByPath:n,handleRowDragEnd:Bt,handleRowDragStart:zt,handleRowTouchStart:Vt,ignoredGitDirectories:r,ignoredInheritanceCache:ne,instanceId:o,itemHeight:s,onKeyDown:Ht,onRowClick:wn,openContextMenuForRow:wt,registerButton:ze,registerRenameInput:Ve,renameView:Ge,renderDecorationForRow:_t,resolveIcon:We,shouldSuppressContextMenu:Dt,visualFocusPath:hn},Dn={...En,registerButton:Be};return CW(`div`,{ref:S,id:it,"data-file-tree-context-menu-button-visibility":Pe&&Ie?Le:void 0,"data-file-tree-context-menu-trigger-mode":Pe?Fe:void 0,"data-file-tree-has-context-menu-action-lane":Pe&&Ie?`true`:void 0,"data-file-tree-has-git-lane":Ue?`true`:void 0,"data-file-tree-virtualized-root":`true`,"data-file-tree-root-drag-target":nt?.kind===`root`?`true`:void 0,onDragLeave:$e?en:void 0,onDragOver:$e?$t:void 0,onDrop:$e?tn:void 0,onKeyDown:Ht,onPointerLeave:Pe?Qt:void 0,onPointerOver:Pe?Zt:void 0,role:`tree`,tabIndex:-1,style:{outline:`none`,position:`relative`},children:[CW(`style`,{"data-file-tree-guide-style":`true`,dangerouslySetInnerHTML:{__html:pn}}),CW(`slot`,{name:PR,"data-type":`header-slot`}),f?CW(`div`,{"data-file-tree-search-container":!0,"data-open":Je?`true`:`false`,children:CW(`input`,{ref:w,"aria-activedescendant":mn,"aria-controls":it,placeholder:`Search…`,"data-file-tree-search-input":!0,"data-file-tree-search-input-fake-focus":Ee?`true`:void 0,value:Ye,onBlur:()=>{d===`retain`&&!Oe.current||t.closeSearch()},onFocus:ke,onPointerDown:ke,onInput:e=>{ke();let n=e.currentTarget;t.setSearch(n.value)}})}):null,CW(`div`,{ref:C,"data-file-tree-virtualized-scroll":`true`,children:[h&&Me&&dt.length>0?CW(`div`,{"aria-hidden":`true`,"data-file-tree-sticky-overlay":`true`,children:CW(`div`,{"data-file-tree-sticky-overlay-content":`true`,style:{height:`${at}px`},children:dt.map((e,t)=>MK(Dn,e.row,`sticky:${qG(e.row)}`,{mode:`sticky`,style:{left:`0`,position:`absolute`,right:`0`,top:`${e.top}px`,zIndex:`${dt.length-t}`}}))})}):null,CW(`div`,{ref:b,"data-file-tree-virtualized-list":`true`,style:{height:`${pt}px`},children:[CW(`div`,{"data-file-tree-virtualized-sticky-offset":`true`,"aria-hidden":`true`,style:{height:`${Y}px`}}),CW(`div`,{"data-file-tree-virtualized-sticky":`true`,style:{height:`${nn}px`,top:`${rn}px`,bottom:`${an}px`},children:[NK(En,ut,ht),sn!=null&&cn!=null?MK(En,sn,`parked:${sn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:rt===sn.path?`none`:void 0,position:`absolute`,right:`0`,top:`${cn}px`}}):null,dn!=null&&fn!=null?MK(En,dn,`parked-drag:${dn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:`none`,position:`absolute`,right:`0`,top:`${fn}px`}}):null]})]})]}),Pe?CW(`div`,{ref:_,"data-type":`context-menu-anchor`,"data-visible":yn?`true`:`false`,style:Sn,children:[CW(`button`,{ref:v,type:`button`,"data-type":IR,"aria-label":`Options`,"aria-haspopup":`menu`,"aria-expanded":q==null?`false`:`true`,"data-visible":vn?`true`:`false`,onMouseDown:e=>{e.preventDefault()},onClick:e=>{if(e.preventDefault(),e.stopPropagation(),q!=null){St();return}Tn()},tabIndex:-1,style:Cn,children:CW(DW,{...We(`file-tree-icon-ellipsis`)})}),q==null?null:CW(`slot`,{name:FR})]}):null,q==null?null:CW(`div`,{"data-type":`context-menu-wash`,"aria-hidden":`true`,onMouseDownCapture:e=>{e.preventDefault(),St()},onTouchStartCapture:e=>{e.preventDefault(),e.stopPropagation(),St()},onTouchMoveCapture:e=>{e.preventDefault(),e.stopPropagation()},onWheelCapture:e=>{e.preventDefault(),e.stopPropagation()}})]})}var FK={hydrateRoot:(e,t)=>{xW(ZU(PK,t),e)},renderRoot:(e,t)=>{bW(ZU(PK,t),e)},unmountRoot:e=>{bW(null,e)}};function IK(e,t){FK.renderRoot(e,t)}function LK(e,t){FK.hydrateRoot(e,t)}function RK(e){FK.unmountRoot(e)}var zK=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)}}},BK=`__c`,VK=`__k`,HK=`__d`,UK=`__s`,WK=/[\s\n\\/='"\0<>]/,GK=/^(xlink|xmlns|xml)([A-Z])/,KK=/^(?: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])/,qK=/^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/,JK=new Set([`draggable`,`spellcheck`]);function YK(e){e.__g===void 0?e[HK]=!0:e.__g|=8}function XK(e){e.__g===void 0?e[HK]=!1:e.__g&=-9}function ZK(e){return e.__g===void 0?!0===e[HK]:!!(8&e.__g)}var QK=/["&<]/;function $K(e){if(e.length===0||!1===QK.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 eq={},tq=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(`.`)),nq=/[A-Z]/g;function rq(e){var t=``;for(var n in e){var r=e[n];if(r!=null&&r!==``){var i=n[0]==`-`?n:eq[n]||(eq[n]=n.replace(nq,`-$&`).toLowerCase()),a=`;`;typeof r!=`number`||i.startsWith(`--`)||tq.has(i)||(a=`px;`),t=t+i+`:`+r+a}}return t||void 0}function iq(){this.__d=!0}function aq(e,t){return{__v:e,context:t,props:e.props,setState:iq,forceUpdate:iq,__d:!0,__h:[]}}function oq(e,t,n){if(!e.s){if(n instanceof sq){if(!n.s)return void(n.o=oq.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(oq.bind(null,e,t),oq.bind(null,e,2));e.s=t,e.v=n;let r=e.o;r&&r(e)}}var sq=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{oq(r,1,a(this.v))}catch(e){oq(r,2,e)}return r}return this}return this.o=function(e){try{var i=e.v;1&e.s?oq(r,1,t?t(i):i):n?oq(r,1,n(i)):oq(r,2,i)}catch(e){oq(r,2,e)}},r},e}(),cq,lq,uq,dq,fq={},pq=Array.isArray,mq=Object.assign,hq=``,gq=`<!--$s-->`,_q=`<!--/$s-->`;function vq(e,t){var n,r=e.type,i=!0;return e[BK]?(i=!1,(n=e[BK]).state=n[UK]):n=new r(e.props,t),e[BK]=n,n.__v=e,n.props=e.props,n.context=t,YK(n),n.state??=fq,n[UK]??(n[UK]=n.state),r.getDerivedStateFromProps?n.state=mq({},n.state,r.getDerivedStateFromProps(n.props,n.state)):i&&n.componentWillMount?(n.componentWillMount(),n.state=n[UK]===n.state?n.state:n[UK]):!i&&n.componentWillUpdate&&n.componentWillUpdate(),uq&&uq(e),n.render(n.props,n.state,t)}function yq(e,t,n,r,i,a,o){if(e==null||!0===e||!1===e||e===hq)return hq;var s=typeof e;if(s!=`object`)return s==`function`?hq:s==`string`?$K(e):e+hq;if(pq(e)){var c,l=hq;i[VK]=e;for(var u=e.length,d=0;d<u;d++){var f=e[d];if(f!=null&&typeof f!=`boolean`){var p,m=yq(f,t,n,r,i,a,o);typeof m==`string`?l+=m:(c||=Array(u),l&&c.push(l),l=hq,pq(m)?(p=c).push.apply(p,m):c.push(m))}}return c?(l&&c.push(l),c):l}if(e.constructor!==void 0)return hq;e.__=i,cq&&cq(e);var h=e.type,g=e.props;if(typeof h==`function`){var _,v,y,b=t;if(h===$U){if(`tpl`in g){for(var x=hq,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&&!pq(C)?x+=C:x+=yq(C,t,n,r,e,a,o)}return x}if(`UNSTABLE_comment`in g)return`<!--`+$K(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=vq(e,b),y=e[BK];else{e[BK]=y=aq(e,b);for(var E=0;ZK(y)&&E++<25;){XK(y),uq&&uq(e);try{v=h.call(y,g,b)}catch(t){throw a&&t&&typeof t.then==`function`&&(e._suspended=!0),t}}YK(y)}if(y.getChildContext!=null&&(t=mq({},t,y.getChildContext())),T&&FU.errorBoundaries&&(h.getDerivedStateFromError||y.componentDidCatch)){v=v!=null&&v.type===$U&&v.key==null&&v.props.tpl==null?v.props.children:v;try{return yq(v,t,n,r,e,a,!1)}catch(i){return h.getDerivedStateFromError&&(y[UK]=h.getDerivedStateFromError(i)),y.componentDidCatch&&y.componentDidCatch(i,fq),ZK(y)?(v=vq(e,t),(y=e[BK]).getChildContext!=null&&(t=mq({},t,y.getChildContext())),yq(v=v!=null&&v.type===$U&&v.key==null&&v.props.tpl==null?v.props.children:v,t,n,r,e,a,o)):hq}finally{lq&&lq(e),dq&&dq(e)}}}v=v!=null&&v.type===$U&&v.key==null&&v.props.tpl==null?v.props.children:v;try{var D=yq(v,t,n,r,e,a,o);return lq&&lq(e),FU.unmount&&FU.unmount(e),e._suspended?typeof D==`string`?gq+D+_q:pq(D)?(D.unshift(gq),D.push(_q),D):D.then(function(e){return gq+e+_q}):D}catch(i){if(!a&&o&&o.onError){var O=function i(s){return o.onError(s,e,function(e,s){try{return yq(e,t,n,r,s,a,o)}catch(e){return i(e)}})}(i);if(O!==void 0)return O;var k=FU.__e;return k&&k(i,e),hq}if(!a||!i||typeof i.then!=`function`)throw i;return i.then(function i(){try{var s=yq(v,t,n,r,e,a,o);return e._suspended?gq+s+_q:s}catch(e){if(!e||typeof e.then!=`function`)throw e;return e.then(i)}})}}var A,j=`<`+h,M=hq;for(var N in g){var P=g[N];if(typeof(P=xq(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=rq(P));break;case`acceptCharset`:N=`accept-charset`;break;case`httpEquiv`:N=`http-equiv`;break;default:if(GK.test(N))N=N.replace(GK,`$1:$2`).toLowerCase();else{if(WK.test(N))continue;N[4]!==`-`&&!JK.has(N)||P==null?n?qK.test(N)&&(N=N===`panose1`?`panose-1`:N.replace(/([A-Z])/g,`-$1`).toLowerCase()):KK.test(N)&&(N=N.toLowerCase()):P+=hq}}P!=null&&!1!==P&&(j=!0===P||P===hq?j+` `+N:j+` `+N+`="`+(typeof P==`string`?$K(P):P+hq)+`"`)}}if(WK.test(h))throw Error(h+` is not a valid HTML tag name in `+j+`>`);if(M||(typeof A==`string`?M=$K(A):A!=null&&!1!==A&&!0!==A&&(M=yq(A,t,h===`svg`||h!==`foreignObject`&&n,r,e,a,o))),lq&&lq(e),dq&&dq(e),!M&&bq.has(h))return j+`/>`;var F=`</`+h+`>`,I=j+`>`;return pq(M)?[I].concat(M,[F]):typeof M==`string`?I+M+F:[I,M,F]}var bq=new Set([`area`,`base`,`br`,`col`,`command`,`embed`,`hr`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`]);function xq(e){return typeof e==`object`&&!!e&&typeof e.peek==`function`&&`value`in e}var Sq=0;function Cq(e){return e!=null&&e.length>0?e:(Sq+=1,`pst_ft_${Sq}`)}function wq({initialVisibleRowCount:e,itemHeight:t}){return e==null?420:Math.max(0,e)*(t??MH)}function Tq(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 Eq(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 Dq(e){return Array.from(e.children).filter(e=>e instanceof SVGElement)}var Oq=class{static LoadedCustomComponent=!0;#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=new zK;#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=Cq(a),this.#p=PU(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=jH(n,c),this.#d={itemHeight:this.#u.itemHeight,overscan:d,stickyFolders:_,initialVisibleRowCount:y},this.#t=new kU({...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&&(RK(this.#b),delete this.#b.dataset.fileTreeVirtualizedWrapper,this.#b=void 0),this.#l.clearAll(),this.#l.setHost(null),this.#f!=null&&(delete this.#f.dataset.fileTreeVirtualized,this.#I(this.#f),this.#f=void 0)}cleanUp(){this.unmount(),this.#y?.(),this.#y=null,this.#t.destroy()}getFileTreeContainer(){return this.#f}getItem(e){return this.#t.getItem(e)}getFocusedItem(){return this.#t.getFocusedItem()}getFocusedPath(){return this.#t.getFocusedPath()}getSelectedPaths(){return this.#t.getSelectedPaths()}getComposition(){return this.#e}getItemHeight(){return this.#u.itemHeight}getDensityFactor(){return this.#u.factor}subscribe(e){let t=!1;return this.#t.subscribe(()=>{if(!t){t=!0;return}e()})}focusPath(e){this.#t.focusPath(e)}scrollToPath(e,t){this.#t.scrollToPath(e,t)}focusNearestPath(e){return this.#t.focusNearestPath(e)}add(e){this.#t.add(e)}batch(e){this.#t.batch(e)}move(e,t,n){this.#t.move(e,t,n)}onMutation(e,t){return this.#t.onMutation(e,t)}setSearch(e){this.#t.setSearch(e)}openSearch(e){this.#t.openSearch(e)}closeSearch(){this.#t.closeSearch()}isSearchOpen(){return this.#t.isSearchOpen()}getSearchValue(){return this.#t.getSearchValue()}getSearchMatchingPaths(){return this.#t.getSearchMatchingPaths()}focusNextSearchMatch(){this.#t.focusNextSearchMatch()}focusPreviousSearchMatch(){this.#t.focusPreviousSearchMatch()}startRenaming(e,t){return this.#t.startRenaming(e,t)}remove(e,t){this.#t.remove(e,t)}resetPaths(e,t){this.#t.resetPaths(e,t)}setComposition(e){this.#e=e;let t=this.#T();t!=null&&(this.#O(),IK(t.wrapper,this.#w()))}setGitStatus(e){this.#p=PU(e,this.#p);let t=this.#T();t!=null&&IK(t.wrapper,this.#w())}setIcons(e){this.#m=e;let t=this.#T();t!=null&&(this.#E(t.host,t.wrapper),IK(t.wrapper,this.#w()))}hydrate({fileTreeContainer:e}){let t=this.#P(e),n=this.#N(t);this.#O(),LK(n,this.#w())}render({containerWrapper:e,fileTreeContainer:t}){let n=this.#P(t??this.#f,e),r=this.#N(n);this.#O(),IK(r,this.#w())}#C(){return{initialViewportHeight:wq({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(PR,e());return}this.#l.setSlotHtml(PR,this.#e?.header?.html??null)}#k(e){let t=Dq(e).find(e=>Eq(e)),n=Tq(wR(RR(this.#m).set));n!=null&&(t!=null&&t.outerHTML===n.outerHTML||(t==null?e.prepend(n):t.replaceWith(n)))}#A(e){let t=Dq(e),n=t.find(e=>Eq(e)),r=t.filter(e=>e!==n),i=RR(this.#m).spriteSheet?.trim()??``;if(i.length===0){for(let e of r)e.remove();return}let a=Tq(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=RR(this.#m);t.colored&&ER(t.set)?e.dataset.fileTreeColoredIcons=`true`:delete e.dataset.fileTreeColoredIcons}#M(e){let t=e.querySelector(`style[${AR}]`);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(AR,``),this.#g.parentNode!==e&&e.appendChild(this.#g),this.#g.textContent=IH(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 HH(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)}},kq=typeof window>`u`?Q.useEffect:Q.useLayoutEffect;function Aq(e,t,n){let r=e==null?null:(0,Z.jsx)(`div`,{slot:PR,children:e}),i=t!=null&&n!=null?(0,Z.jsx)(`div`,{slot:FR,children:t(n.item,n.context)}):null;return r==null&&i==null?null:(0,Z.jsxs)(Z.Fragment,{children:[r,i]})}function jq(e,t){return typeof window>`u`&&t!=null?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`template`,{shadowrootmode:`open`,dangerouslySetInnerHTML:{__html:t.shadowHtml}}),e]}):(0,Z.jsx)(Z.Fragment,{children:e})}function Mq(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 Nq(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 Pq({header:e,id:t,model:n,preloadedData:r,renderContextMenu:i,...a}){let[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(null),u=(0,Q.useRef)(n.getComposition()),d=(0,Q.useRef)(n);d.current!==n&&(d.current=n,u.current=n.getComposition());let f=i!=null,p=(0,Q.useCallback)(()=>{s(null)},[]),m=(0,Q.useCallback)((e,t)=>{s({context:t,item:e})},[]),h=u.current,g=(0,Q.useMemo)(()=>Nq(h,e,f,p,m),[h,p,m,f,e]),_=(0,Q.useCallback)(e=>{l(e)},[]);(0,Q.useEffect)(()=>{f||s(null)},[f]),kq(()=>{n.setComposition(g)},[g,n]),kq(()=>{if(c!=null)return r!=null&&Mq(c)?n.hydrate({fileTreeContainer:c}):n.render({fileTreeContainer:c}),()=>{n.unmount(),n.setComposition(h)}},[h,c,n,r]);let v=jq(Aq(e,i,o),r),y=t??r?.id,b={"--trees-item-height":`${String(n.getItemHeight())}px`,"--trees-density-override":n.getDensityFactor(),...a.style};return(0,Z.jsx)(OR,{...a,id:y,ref:_,style:b,suppressHydrationWarning:r!=null,children:v})}function Fq(e){let[t]=(0,Q.useState)(()=>new Oq(e)),n=(0,Q.useRef)({timeout:null,model:t});return(0,Q.useEffect)(()=>{let{current:e}=n;return e.timeout!=null&&(clearTimeout(e.timeout),e.timeout=null),()=>{e.timeout=setTimeout(()=>e.model.cleanUp(),1)}},[]),{model:t}}function Iq(){let e=(0,$.c)(16),{_:t}=vt(),{projectLocalBinding:n}=Hu(),r;e[0]!==t||e[1]!==n?(r=()=>{if(n===null)return;let e=n.patch({appearance:{sidebar:{showHiddenFiles:!1,showOnlyMarkdownFiles:!1,showOkFolders:!1}}});e.ok||(console.warn(`[FileTreeFilteredToZeroNotice] view-filter reset rejected:`,Va(e.error)),X.error(t({id:`P47EWZ`}),{description:Va(e.error)}))},e[0]=t,e[1]=n,e[2]=r):r=e[2];let i=r,a;e[3]===t?a=e[4]:(a=t({id:`WHPvOb`}),e[3]=t,e[4]=a);let o;e[5]===a?o=e[6]:(o=(0,Z.jsx)(`span`,{className:`select-none text-sidebar-foreground/30 text-sm`,children:a}),e[5]=a,e[6]=o);let s=n===null,c;e[7]===t?c=e[8]:(c=t({id:`jC8LSZ`}),e[7]=t,e[8]=c);let l;e[9]!==i||e[10]!==s||e[11]!==c?(l=(0,Z.jsx)(Y,{variant:`link`,size:`sm`,className:`font-mono uppercase`,disabled:s,onClick:i,"data-testid":`reset-view-filters`,children:c}),e[9]=i,e[10]=s,e[11]=c,e[12]=l):l=e[12];let u;return e[13]!==o||e[14]!==l?(u=(0,Z.jsxs)(`div`,{"data-testid":`file-tree-filtered-to-zero`,className:`flex flex-1 flex-col items-center justify-center gap-3 py-8`,children:[o,l]}),e[13]=o,e[14]=l,e[15]=u):u=e[15],u}var Lq={density:`compact`,itemHeight:26,flattenEmptyDirectories:!1},Rq={"--trees-level-gap-override":`4px`,"--trees-item-row-gap-override":`4px`,"--trees-icon-width-override":`14px`,"--trees-item-height":`${Lq.itemHeight}px`,"--trees-indent-guide-bg-override":`color-mix(in oklab, var(--trees-fg-muted) 30%, transparent)`},zq=`
1859
1859
  [data-item-section='spacing-item'] {
1860
1860
  opacity: 0.5;
1861
1861
  }
1862
1862
  :host(:hover) [data-item-section='spacing-item'] {
1863
1863
  opacity: 0.85;
1864
1864
  }
1865
- `,Iq=`
1865
+ `,Bq=`
1866
1866
  [data-file-tree-sticky-overlay-content='true'] {
1867
1867
  --trees-bg: color-mix(in oklab, var(--sidebar) 92%, var(--sidebar-foreground) 8%);
1868
1868
  box-shadow: 0 1px 0 0 var(--sidebar-border);
@@ -1876,17 +1876,17 @@ Error generating stack: `+e.message+`
1876
1876
  border-bottom: 1px solid CanvasText;
1877
1877
  }
1878
1878
  }
1879
- `;function Lq(e){return{...GR({type:e===`dark`?`dark`:`light`,colors:{"sideBar.background":`var(--sidebar)`,"sideBar.foreground":`var(--sidebar-foreground)`,"sideBar.border":`var(--sidebar-border)`,"list.activeSelectionBackground":`var(--sidebar-accent)`,"list.activeSelectionForeground":`var(--sidebar-accent-foreground)`,"list.hoverBackground":`var(--sidebar-hover)`,focusBorder:`var(--color-primary)`,"input.background":`var(--input)`,"input.border":`var(--border)`}}),"--trees-font-family-override":`var(--font-sans)`,"--trees-font-size-override":`0.875rem`,"--trees-item-padding-x-override":`0.5rem`,"--trees-padding-inline-override":`0.5rem`,"--trees-border-radius-override":`0.375rem`,"--trees-selected-fg":`var(--color-primary)`,"--truncate-marker-fade-in-duration":`0s`,"--trees-file-icon-color-markdown":`light-dark(var(--color-gray-400), var(--color-gray-500))`,"--trees-fg-muted":`light-dark(var(--color-gray-400), var(--color-gray-500))`,...Pq}}var Rq=`data-ok-ext-badge`,zq=`data-ok-ext-row`,Bq=`data-ok-fullname-row`,Vq=`
1879
+ `;function Vq(e){return{...YR({type:e===`dark`?`dark`:`light`,colors:{"sideBar.background":`var(--sidebar)`,"sideBar.foreground":`var(--sidebar-foreground)`,"sideBar.border":`var(--sidebar-border)`,"list.activeSelectionBackground":`var(--sidebar-accent)`,"list.activeSelectionForeground":`var(--sidebar-accent-foreground)`,"list.hoverBackground":`var(--sidebar-hover)`,focusBorder:`var(--color-primary)`,"input.background":`var(--input)`,"input.border":`var(--border)`}}),"--trees-font-family-override":`var(--font-sans)`,"--trees-font-size-override":`0.875rem`,"--trees-item-padding-x-override":`0.5rem`,"--trees-padding-inline-override":`0.5rem`,"--trees-border-radius-override":`0.375rem`,"--trees-selected-fg":`var(--color-primary)`,"--truncate-marker-fade-in-duration":`0s`,"--trees-file-icon-color-markdown":`light-dark(var(--color-gray-400), var(--color-gray-500))`,"--trees-fg-muted":`light-dark(var(--color-gray-400), var(--color-gray-500))`,...Rq}}var Hq=`data-ok-ext-badge`,Uq=`data-ok-ext-row`,Wq=`data-ok-fullname-row`,Gq=`
1880
1880
  [data-item-selected='true'] [data-icon-token='markdown'] {
1881
1881
  color: var(--trees-selected-fg);
1882
1882
  }
1883
- [data-type='item'][${zq}] [data-truncate-segment-priority]:last-child {
1883
+ [data-type='item'][${Uq}] [data-truncate-segment-priority]:last-child {
1884
1884
  display: none;
1885
1885
  }
1886
- [data-type='item'][${Bq}] [data-truncate-segment-priority]:last-child {
1886
+ [data-type='item'][${Wq}] [data-truncate-segment-priority]:last-child {
1887
1887
  display: none;
1888
1888
  }
1889
- [${Rq}] {
1889
+ [${Hq}] {
1890
1890
  display: inline-block;
1891
1891
  margin-left: 0.375rem;
1892
1892
  margin-right: 0.25rem;
@@ -1898,11 +1898,11 @@ Error generating stack: `+e.message+`
1898
1898
  pointer-events: none;
1899
1899
  user-select: none;
1900
1900
  }
1901
- `;function Hq(e){let t=e.querySelectorAll(`[data-type="item"][data-item-path]`);for(let e of t){let t=e.dataset.itemPath;if(!t){Wq(e);continue}if(t.endsWith(`/`)){Kq(e,t);continue}let n=Dl(t);if(!n){Wq(e);continue}let r=Gq(e);if(r){if(e.setAttribute(zq,``),e.removeAttribute(Bq),Xq(r),n.toLowerCase()===`.md`){Uq(e);continue}Zq(e,n.slice(1).toUpperCase())}}}function Uq(e){let t=e.querySelector(`[${Rq}]`);t&&t.remove()}function Wq(e){e.removeAttribute(zq),e.removeAttribute(Bq),Uq(e)}function Gq(e){let t=e.querySelector(`[data-truncate-group-container="middle"]`);if(!t)return null;let n=t.querySelectorAll(`[data-truncate-segment-priority]`);return n.length<2?null:n[0]??null}function Kq(e,t){e.removeAttribute(zq),Uq(e);let n=Gq(e),r=qq(t);if(!n||!r){e.removeAttribute(Bq);return}Yq(n,r),e.setAttribute(Bq,``)}function qq(e){let t=e.replace(/\/+$/,``),n=t.lastIndexOf(`/`);return n>=0?t.slice(n+1):t}function Jq(e,t){let n=e.querySelectorAll(`[data-truncate-content]`);for(let e of n){let n=e.firstChild;if(!n||n.nodeType!==Node.TEXT_NODE)continue;let r=n.textContent??``,i=t(r);i!==r&&(n.textContent=i)}}function Yq(e,t){Jq(e,()=>t)}function Xq(e){Jq(e,e=>e.replace(/\.+$/,``))}function Zq(e,t){let n=e.querySelector(`[${Rq}]`);if(!n){n=e.ownerDocument.createElement(`span`),n.setAttribute(Rq,``),n.setAttribute(`aria-hidden`,`true`);let t=e.querySelector(`[data-item-section="action"]`);t?t.before(n):e.appendChild(n)}n.textContent!==t&&(n.textContent=t)}var Qq=`ok-file-tree-link-decoration`,$q=`ok-file-tree-agent-decoration`,eJ=`ok-file-tree-markdown`,tJ=`<symbol id="${eJ}" viewBox="${T}" fill="currentColor"><path d="${_}"/></symbol>`;function nJ(e){return e.map(([e,{key:t,...n}])=>`<${e} ${Object.entries(n).map(([e,t])=>`${e}="${t}"`).join(` `)} />`).join(``)}function rJ(e,t){return`<symbol id="${e}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${nJ(t)}</symbol>`}var iJ=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
1902
- ${rJ(Qq,$e)}
1903
- ${rJ($q,ds)}
1904
- ${tJ}
1905
- </svg>`;function aJ(e){return e.replace(/\\/g,`\\\\`).replace(/\[/g,`\\[`).replace(/\]/g,`\\]`).replace(/\*/g,`\\*`)}function oJ(e){let t=aJ(e.path);return e.kind===`folder`?`/${t}/`:`/${t}${e.docExt??`.md`}`}var sJ=/\.(md|mdx)$/i;function cJ(e){let t=e.match(/^"(.+)" already exists\.$/);return t?t[1]:null}function lJ(e){let t=e.match(sJ);return t?t[0]:null}var uJ=new Set([`agents`,`agent`,`claude`,`skill`]);function dJ(e){let t=e.split(`/`).pop()?.replace(/\.md$/i,``).toLowerCase();return!!t&&uJ.has(t)}function fJ(e,t){return Zd({kind:e.endsWith(`/`)?`directory`:`file`,name:e,path:e},t)}function pJ(e){let t=e.match(/\.(md|mdx)$/i);if(!t)return null;let n=t[0].toLowerCase()===`.md`?`.mdx`:`.md`;return`${e.slice(0,-t[0].length)}${n}`}function mJ(e,t){let n=pJ(e);return n?t.includes(n):!1}function hJ(e,t){return e!==t&&e.startsWith(t)}function gJ(e,t){let n=[...new Set(e)].filter(e=>!Vl(e)),r=n.filter(e=>e.endsWith(`/`));return n.filter(e=>!r.some(t=>hJ(e,t))).map(e=>fJ(e,t))}function _J(e,t){let n=e.getItem(t)??e.getItem(mf(t));return n?.isDirectory()?mf(Sf(n.getPath())):t}function vJ(e){let t=e.getFocusedPath()??e.getSelectedPaths()[0]??null;return t?_J(e,t):null}function yJ(e,t,n){let r=vJ(e);return!r||n.has(r)||Vl(r)?null:fJ(r,t)}function bJ(e,t){let n=e.getSelectedPaths(),r=vJ(e);return gJ(n.length>0?n.map(t=>_J(e,t)):r?[r]:[],t)}function xJ(e,t){return e===t||e.startsWith(`${t}/`)}function SJ(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName;return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`||e.isContentEditable||e.closest(`[contenteditable="true"]`)!==null}function CJ(e,t,n){let r=new Set,i=new Set,a=new Set;for(let o of e){if(o.kind===`file`){r.add(o.path);continue}if(o.kind===`asset`){a.add(o.path);continue}i.add(o.path);for(let e of t)Ml(e)&&e.docName.startsWith(`${o.path}/`)?r.add(e.docName):Ul(e)&&e.path.startsWith(`${o.path}/`)&&a.add(e.path);for(let e of n){let t=Sf(e);xJ(t,o.path)&&i.add(t)}}return{docNames:r,folderPaths:i,assetPaths:a}}function wJ(e,t){return e.kind===`file`?t.kind===`file`&&e.path===t.createdPath:e.kind===`asset`?!1:xJ(t.createdPath,e.path)}function TJ(e){let t=new Map,n=new Map;for(let r of e)if(Ml(r)){let e=gf(r.docName,r.docExt);t.has(e)||t.set(e,r)}else if(Hl(r)){let e=mf(r.path);n.has(e)||n.set(e,r)}return{docsByTreePath:t,foldersByTreeDirectoryPath:n}}var EJ=`data-ok-renaming`,DJ=`data-ok-rename-selection-applied`,OJ=null,kJ=null,AJ=5e3,jJ=`
1901
+ `;function Kq(e){let t=e.querySelectorAll(`[data-type="item"][data-item-path]`);for(let e of t){let t=e.dataset.itemPath;if(!t){Jq(e);continue}if(t.endsWith(`/`)){Xq(e,t);continue}let n=Dl(t);if(!n){Jq(e);continue}let r=Yq(e);if(r){if(e.setAttribute(Uq,``),e.removeAttribute(Wq),eJ(r),n.toLowerCase()===`.md`){qq(e);continue}tJ(e,n.slice(1).toUpperCase())}}}function qq(e){let t=e.querySelector(`[${Hq}]`);t&&t.remove()}function Jq(e){e.removeAttribute(Uq),e.removeAttribute(Wq),qq(e)}function Yq(e){let t=e.querySelector(`[data-truncate-group-container="middle"]`);if(!t)return null;let n=t.querySelectorAll(`[data-truncate-segment-priority]`);return n.length<2?null:n[0]??null}function Xq(e,t){e.removeAttribute(Uq),qq(e);let n=Yq(e),r=Zq(t);if(!n||!r){e.removeAttribute(Wq);return}$q(n,r),e.setAttribute(Wq,``)}function Zq(e){let t=e.replace(/\/+$/,``),n=t.lastIndexOf(`/`);return n>=0?t.slice(n+1):t}function Qq(e,t){let n=e.querySelectorAll(`[data-truncate-content]`);for(let e of n){let n=e.firstChild;if(!n||n.nodeType!==Node.TEXT_NODE)continue;let r=n.textContent??``,i=t(r);i!==r&&(n.textContent=i)}}function $q(e,t){Qq(e,()=>t)}function eJ(e){Qq(e,e=>e.replace(/\.+$/,``))}function tJ(e,t){let n=e.querySelector(`[${Hq}]`);if(!n){n=e.ownerDocument.createElement(`span`),n.setAttribute(Hq,``),n.setAttribute(`aria-hidden`,`true`);let t=e.querySelector(`[data-item-section="action"]`);t?t.before(n):e.appendChild(n)}n.textContent!==t&&(n.textContent=t)}var nJ=`ok-file-tree-link-decoration`,rJ=`ok-file-tree-agent-decoration`,iJ=`ok-file-tree-markdown`,aJ=`<symbol id="${iJ}" viewBox="${T}" fill="currentColor"><path d="${_}"/></symbol>`;function oJ(e){return e.map(([e,{key:t,...n}])=>`<${e} ${Object.entries(n).map(([e,t])=>`${e}="${t}"`).join(` `)} />`).join(``)}function sJ(e,t){return`<symbol id="${e}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${oJ(t)}</symbol>`}var cJ=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
1902
+ ${sJ(nJ,$e)}
1903
+ ${sJ(rJ,ds)}
1904
+ ${aJ}
1905
+ </svg>`;function lJ(e){return e.replace(/\\/g,`\\\\`).replace(/\[/g,`\\[`).replace(/\]/g,`\\]`).replace(/\*/g,`\\*`)}function uJ(e){let t=lJ(e.path);return e.kind===`folder`?`/${t}/`:`/${t}${e.docExt??`.md`}`}var dJ=/\.(md|mdx)$/i;function fJ(e){let t=e.match(/^"(.+)" already exists\.$/);return t?t[1]:null}function pJ(e){let t=e.match(dJ);return t?t[0]:null}var mJ=new Set([`agents`,`agent`,`claude`,`skill`]);function hJ(e){let t=e.split(`/`).pop()?.replace(/\.md$/i,``).toLowerCase();return!!t&&mJ.has(t)}function gJ(e,t){return Zd({kind:e.endsWith(`/`)?`directory`:`file`,name:e,path:e},t)}function _J(e){let t=e.match(/\.(md|mdx)$/i);if(!t)return null;let n=t[0].toLowerCase()===`.md`?`.mdx`:`.md`;return`${e.slice(0,-t[0].length)}${n}`}function vJ(e,t){let n=_J(e);return n?t.includes(n):!1}function yJ(e,t){return e!==t&&e.startsWith(t)}function bJ(e,t){let n=[...new Set(e)].filter(e=>!Vl(e)),r=n.filter(e=>e.endsWith(`/`));return n.filter(e=>!r.some(t=>yJ(e,t))).map(e=>gJ(e,t))}function xJ(e,t){let n=e.getItem(t)??e.getItem(mf(t));return n?.isDirectory()?mf(Sf(n.getPath())):t}function SJ(e){let t=e.getFocusedPath()??e.getSelectedPaths()[0]??null;return t?xJ(e,t):null}function CJ(e,t,n){let r=SJ(e);return!r||n.has(r)||Vl(r)?null:gJ(r,t)}function wJ(e,t){let n=e.getSelectedPaths(),r=SJ(e);return bJ(n.length>0?n.map(t=>xJ(e,t)):r?[r]:[],t)}function TJ(e,t){return e===t||e.startsWith(`${t}/`)}function EJ(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName;return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`||e.isContentEditable||e.closest(`[contenteditable="true"]`)!==null}function DJ(e,t,n){let r=new Set,i=new Set,a=new Set;for(let o of e){if(o.kind===`file`){r.add(o.path);continue}if(o.kind===`asset`){a.add(o.path);continue}i.add(o.path);for(let e of t)Ml(e)&&e.docName.startsWith(`${o.path}/`)?r.add(e.docName):Ul(e)&&e.path.startsWith(`${o.path}/`)&&a.add(e.path);for(let e of n){let t=Sf(e);TJ(t,o.path)&&i.add(t)}}return{docNames:r,folderPaths:i,assetPaths:a}}function OJ(e,t){return e.kind===`file`?t.kind===`file`&&e.path===t.createdPath:e.kind===`asset`?!1:TJ(t.createdPath,e.path)}function kJ(e){let t=new Map,n=new Map;for(let r of e)if(Ml(r)){let e=gf(r.docName,r.docExt);t.has(e)||t.set(e,r)}else if(Hl(r)){let e=mf(r.path);n.has(e)||n.set(e,r)}return{docsByTreePath:t,foldersByTreeDirectoryPath:n}}var AJ=`data-ok-renaming`,jJ=`data-ok-rename-selection-applied`,MJ=null,NJ=null,PJ=5e3,FJ=`
1906
1906
  /* Pierre's icon decoration keys off the row's data-item-path. If the user
1907
1907
  deletes the extension before commit, Pierre can temporarily key the row
1908
1908
  by an extensionless path and swap [data-icon-token] from 'markdown' to
@@ -1913,16 +1913,16 @@ Error generating stack: `+e.message+`
1913
1913
  the row to an extensionless path, then clears it when the path next
1914
1914
  includes the saved extension (settle / cancel / row recycle to a settled
1915
1915
  file). */
1916
- [${EJ}='.md'] [data-item-section="icon"],
1917
- [${EJ}='.mdx'] [data-item-section="icon"] {
1916
+ [${AJ}='.md'] [data-item-section="icon"],
1917
+ [${AJ}='.mdx'] [data-item-section="icon"] {
1918
1918
  position: relative;
1919
1919
  }
1920
- [${EJ}='.md'] [data-item-section="icon"] [data-icon-token]:not([data-icon-token='markdown']),
1921
- [${EJ}='.mdx'] [data-item-section="icon"] [data-icon-token]:not([data-icon-token='markdown']) {
1920
+ [${AJ}='.md'] [data-item-section="icon"] [data-icon-token]:not([data-icon-token='markdown']),
1921
+ [${AJ}='.mdx'] [data-item-section="icon"] [data-icon-token]:not([data-icon-token='markdown']) {
1922
1922
  visibility: hidden;
1923
1923
  }
1924
- [${EJ}='.md'] [data-item-section="icon"]::before,
1925
- [${EJ}='.mdx'] [data-item-section="icon"]::before {
1924
+ [${AJ}='.md'] [data-item-section="icon"]::before,
1925
+ [${AJ}='.mdx'] [data-item-section="icon"]::before {
1926
1926
  content: '';
1927
1927
  display: block;
1928
1928
  position: absolute;
@@ -1934,10 +1934,10 @@ Error generating stack: `+e.message+`
1934
1934
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path d='M1 12V4h2l2 2.5L7 4h2v8H7V7.5l-2 2-2-2V12zm9-3 3 3.5L16 9h-2V4h-2v5z'/></svg>") center / contain no-repeat;
1935
1935
  pointer-events: none;
1936
1936
  }
1937
- `;function MJ(e){FJ(e);let t=e.querySelector(`[data-item-rename-input]`);if(!t)return;let n=t.closest(`[data-type="item"]`);if(!n)return;let r=n.dataset.itemPath??``;if(r.endsWith(`/`))return;let i=Dl(r);Tl(r)&&NJ(i),!t.hasAttribute(DJ)&&(IJ(t),t.setAttribute(DJ,``))}function NJ(e){OJ=e,kJ!==null&&clearTimeout(kJ),kJ=setTimeout(PJ,AJ)}function PJ(){OJ=null,kJ!==null&&(clearTimeout(kJ),kJ=null)}function FJ(e){let t=e.querySelectorAll(`[${EJ}]`);for(let e of t){if(e.querySelector(`[data-item-rename-input]`))continue;let t=e.getAttribute(EJ);if(!t){e.removeAttribute(EJ);continue}let n=e.dataset.itemPath??``;if(n.toLowerCase().endsWith(t.toLowerCase())){e.removeAttribute(EJ);continue}let r=Dl(n);r&&r.toLowerCase()!==t.toLowerCase()&&e.removeAttribute(EJ)}if(OJ===null)return;let n=e.querySelectorAll(`[data-type="item"][data-item-path]`),r=!1;for(let e of n){let t=e.dataset.itemPath??``;!t||t.endsWith(`/`)||Dl(t)||(r=!0,e.getAttribute(`data-item-selected`)===`true`&&e.getAttribute(`data-ok-renaming`)!==OJ&&e.setAttribute(EJ,OJ))}let i=!!e.querySelector(`[data-item-rename-input]`);!r&&!i&&PJ()}function IJ(e){let t=Dl(e.value),n=t?e.value.length-t.length:e.value.length;e.setSelectionRange(0,n)}function LJ(e,t){e.getFocusedPath()===t&&e.scrollToPath(t,{offset:`nearest`,focus:!1})}function RJ(e){return{selectedFilePath:e,selectedFolderPath:null,navigationPath:e}}function zJ(e,t,n={}){if(!e)return RJ(t);let r=Ll(e);if(t&&r!==t)return RJ(t);switch(e.kind){case`doc`:return RJ(t??e.docName);case`large-file`:return RJ(e.docName);case`folder`:case`folder-index`:return{selectedFilePath:null,selectedFolderPath:e.folderPath,navigationPath:e.folderPath};case`missing`:return t&&n.isKnownDocument?.(t)?RJ(t):{selectedFilePath:null,selectedFolderPath:null,navigationPath:null};case`asset`:case`skill-file`:return{selectedFilePath:null,selectedFolderPath:null,navigationPath:null}}}function BJ(e,t){if(!e)return{kind:`none`};let n=t.find(t=>rf(t)===e),r=bf(e),i=e.endsWith(`/`)?r:xf(e,t);return i===r?n&&Ul(n)?n.mediaKind===`mermaid`?{kind:`document`,path:n.path}:{kind:`asset`,path:n.path,hash:su(n.path),mediaKind:n.mediaKind}:n&&Ml(n)?{kind:`document`,path:n.docName}:e.endsWith(`/`)?t.some(e=>Hl(e)?e.path===r||e.path.startsWith(`${r}/`):(Ul(e)?e.path:e.docName).startsWith(`${r}/`))?{kind:`folder`,path:r}:{kind:`none`}:t.some(e=>Ml(e)&&e.docName===r)?{kind:`document`,path:r}:{kind:`none`}:{kind:`document`,path:i}}var VJ=`You can restore this file from the Trash.`;function HJ(e){let t=VJ,n=`Move to Trash`,r=`Moving`;if(e.length===0)return{title:`Are you sure you want to delete the selected items?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r};if(e.length===1){let i=e[0];return i?i.kind===`folder`?{title:`Are you sure you want to delete '${i.name}' and its contents?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r}:{title:`Are you sure you want to delete '${i.name}'?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r}:{title:`Are you sure you want to delete the selected item?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r}}let i=e.some(e=>e.kind===`folder`),a=e.some(e=>e.kind!==`folder`);return i&&a?{title:`Are you sure you want to delete the following ${e.length} files/directories and their contents?`,detail:t,listedTargets:e,confirmLabel:n,confirmLabelBusy:r}:i?{title:`Are you sure you want to delete the following ${e.length} directories and their contents?`,detail:t,listedTargets:e,confirmLabel:n,confirmLabelBusy:r}:{title:`Are you sure you want to delete the following ${e.length} files?`,detail:t,listedTargets:e,confirmLabel:n,confirmLabelBusy:r}}function UJ(e,t){return e===`web`?null:HJ(t)}function WJ(e){return e.kind===`folder`?`${e.name}/`:e.kind===`asset`?e.name:e.docExt?`${e.name}${e.docExt}`:e.name}function GJ(e,t,n){let r=BJ(e,t);if(r.kind===`none`)return null;if(r.kind===`asset`)return{v:1,kind:`asset`,assetPath:r.path,mediaKind:r.mediaKind};if(r.kind===`folder`)return{v:1,kind:`folder`,folderPath:r.path};let i=t.find(e=>Ml(e)&&e.docName===r.path);return{v:1,kind:`doc`,docName:r.path,size:i?.size??n?.get(r.path)?.size??null}}var KJ=[`not-found`,`permission-denied`,`system-error`,`path-escape`];function qJ(e){return typeof e==`string`&&KJ.includes(e)?e:`system-error`}function JJ(e){switch(e){case`not-found`:return yl._({id:`v41fCm`});case`permission-denied`:return yl._({id:`sJK6pq`});case`system-error`:return yl._({id:`Jqqevv`});case`path-escape`:return yl._({id:`WL6puM`})}}function YJ(e){let t=JJ(e.reason),n=e.detail;return n?yl._({id:`Z2M5XM`,values:{reason:t,osDetail:n}}):yl._({id:`dTaauv`,values:{reason:t}})}function XJ(e){return e.kind===`folder`?`${e.name}/`:e.name}function ZJ(e){let t=(0,$.c)(34),{failedTargets:n,isSubmitting:r,onDeletePermanently:i,onRetry:a,onCancel:o}=e,s=n.length>1,c=n[0],l=n.length,u;if(t[0]!==l||t[1]!==s||t[2]!==c){let e=c?XJ(c):``;u=s?yl._({id:`5qNxOe`,values:{count:l}}):c?`${yl._({id:`E_BHoD`,values:{targetName:e}})}\n${YJ(c)}`:yl._({id:`kolRU1`}),t[0]=l,t[1]=s,t[2]=c,t[3]=u}else u=t[3];let d=u,f;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(_n,{children:(0,Z.jsx)(J,{id:`aOp3hw`})}),t[4]=f):f=t[4];let p;t[5]===d?p=t[6]:(p=(0,Z.jsxs)(xn,{children:[f,(0,Z.jsx)(gn,{className:`whitespace-pre-wrap`,children:d})]}),t[5]=d,t[6]=p);let m;t[7]!==n||t[8]!==s?(m=s?(0,Z.jsx)(yn,{children:(0,Z.jsx)(`ul`,{className:`flex flex-col gap-2 text-xs`,children:n.map(QJ)})}):null,t[7]=n,t[8]=s,t[9]=m):m=t[9];let h;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(J,{id:`dEgA5A`}),t[10]=h):h=t[10];let g;t[11]!==r||t[12]!==o?(g=(0,Z.jsx)(Y,{variant:`outline`,className:`font-mono uppercase`,onClick:o,disabled:r,"data-testid":`trash-failure-modal-cancel`,children:h}),t[11]=r,t[12]=o,t[13]=g):g=t[13];let _;t[14]===r?_=t[15]:(_=r?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Zc,{className:`size-4 animate-spin`}),` `,(0,Z.jsx)(J,{id:`mf37rL`})]}):(0,Z.jsx)(J,{id:`6gRgw8`}),t[14]=r,t[15]=_);let v;t[16]!==r||t[17]!==a||t[18]!==_?(v=(0,Z.jsx)(Y,{variant:`outline`,className:`font-mono uppercase`,onClick:a,disabled:r,"data-testid":`trash-failure-modal-retry`,children:_}),t[16]=r,t[17]=a,t[18]=_,t[19]=v):v=t[19];let y;t[20]===r?y=t[21]:(y=r?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Zc,{className:`size-4 animate-spin`}),` `,(0,Z.jsx)(J,{id:`s3caR3`})]}):(0,Z.jsx)(J,{id:`UBv8UK`}),t[20]=r,t[21]=y);let b;t[22]!==r||t[23]!==i||t[24]!==y?(b=(0,Z.jsx)(Y,{variant:`destructive`,onClick:i,disabled:r,"data-testid":`trash-failure-modal-delete-permanently`,children:y}),t[22]=r,t[23]=i,t[24]=y,t[25]=b):b=t[25];let x;t[26]!==b||t[27]!==g||t[28]!==v?(x=(0,Z.jsxs)(bn,{children:[g,v,b]}),t[26]=b,t[27]=g,t[28]=v,t[29]=x):x=t[29];let S;return t[30]!==x||t[31]!==p||t[32]!==m?(S=(0,Z.jsxs)(vn,{className:`sm:max-w-md`,children:[p,m,x]}),t[30]=x,t[31]=p,t[32]=m,t[33]=S):S=t[33],S}function QJ(e){return(0,Z.jsxs)(`li`,{"data-testid":`trash-failure-modal-target`,children:[(0,Z.jsx)(`div`,{className:`font-mono text-foreground`,children:XJ(e)}),(0,Z.jsx)(`div`,{className:`text-muted-foreground`,children:YJ(e)})]},e.path)}function $J(e){let t=(0,$.c)(21),{parentDir:n,onSelectTemplate:r,ItemComponent:i}=e,{state:a}=Gr(n);if(a.status===`idle`||a.status===`loading`){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(J,{id:`Hl89Qd`}),t[0]=e):e=t[0];let n;return t[1]===i?n=t[2]:(n=(0,Z.jsx)(i,{disabled:!0,className:`text-muted-foreground`,children:e}),t[1]=i,t[2]=n),n}if(a.status===`error`){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(J,{id:`AQ-Lfg`}),t[3]=e):e=t[3];let n;return t[4]===i?n=t[5]:(n=(0,Z.jsx)(i,{disabled:!0,className:`text-muted-foreground`,children:e}),t[4]=i,t[5]=n),n}let o,s;if(t[6]!==i||t[7]!==r||t[8]!==a.data.folder.templates_available){s=Symbol.for(`react.early_return_sentinel`);bb0:{let e;t[11]===a.data.folder.templates_available?e=t[12]:(e=a.data.folder.templates_available??[],t[11]=a.data.folder.templates_available,t[12]=e);let n=c_(e);if(n.length===0){let e;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(J,{id:`iGCs04`}),t[13]=e):e=t[13];let n;t[14]===i?n=t[15]:(n=(0,Z.jsx)(i,{disabled:!0,className:`text-muted-foreground`,children:e}),t[14]=i,t[15]=n),s=n;break bb0}let c;t[16]!==i||t[17]!==r?(c=e=>(0,Z.jsx)(i,{onSelect:()=>r(e.name),children:e.title??e.name},`${e.scope}:${e.source_folder}:${e.name}`),t[16]=i,t[17]=r,t[18]=c):c=t[18],o=n.map(c)}t[6]=i,t[7]=r,t[8]=a.data.folder.templates_available,t[9]=o,t[10]=s}else o=t[9],s=t[10];if(s!==Symbol.for(`react.early_return_sentinel`))return s;let c;return t[19]===o?c=t[20]:(c=(0,Z.jsx)(Z.Fragment,{children:o}),t[19]=o,t[20]=c),c}function eY(e){return e?.isDirectory()?e:null}function tY(e,t){let n=t.getPath();for(let t of e.getSelectedPaths())t!==n&&e.getItem(t)?.deselect();t.isSelected()||t.select()}function nY(e){for(let t of e.getSelectedPaths())e.getItem(t)?.deselect()}function rY(e,t,n,r,i){let a=(0,$.c)(11),o;a[0]!==n||a[1]!==t||a[2]!==e||a[3]!==r?(o=()=>{let i=()=>{queueMicrotask(()=>{r.current=!1})};if(r.current=!0,!t){nY(e),i();return}let a=n?n.split(`\0`):[];for(let t of a){let n=eY(e.getItem(t));n&&!n.isExpanded()&&n.expand()}let o=e.getItem(t);if(!o){nY(e),i();return}if(e.getSelectedPaths().length>1&&o.isSelected()){o.focus(),i();return}tY(e,o),o.focus(),i()},a[0]=n,a[1]=t,a[2]=e,a[3]=r,a[4]=o):o=a[4];let s;a[5]!==n||a[6]!==t||a[7]!==e||a[8]!==r||a[9]!==i?(s=[n,t,e,r,i],a[5]=n,a[6]=t,a[7]=e,a[8]=r,a[9]=i,a[10]=s):s=a[10],(0,Q.useEffect)(o,s)}var iY=`open-knowledge:file-tree-menu-action-delete`,aY=`open-knowledge:file-tree-menu-action-rename`,oY=`open-knowledge:file-tree-menu-action-duplicate`;function sY(e){window.dispatchEvent(new CustomEvent(iY,{detail:{target:e}}))}function cY(e){let t=t=>{let n=t.detail;n?.target&&e(n.target)};return window.addEventListener(iY,t),()=>window.removeEventListener(iY,t)}function lY(e){window.dispatchEvent(new CustomEvent(aY,{detail:{target:e}}))}function uY(e){let t=t=>{let n=t.detail;n?.target&&e(n.target)};return window.addEventListener(aY,t),()=>window.removeEventListener(aY,t)}function dY(e){window.dispatchEvent(new CustomEvent(oY,{detail:{target:e}}))}function fY(e){let t=t=>{let n=t.detail;n?.target&&e(n.target)};return window.addEventListener(oY,t),()=>window.removeEventListener(oY,t)}var pY={Accept:`application/x-ndjson, application/json`};function mY(e){return!e.ok||!e.body?!1:(e.headers.get(`content-type`)??``).includes(`application/x-ndjson`)}var hY=class extends Error{};function gY(e){return typeof e==`object`&&!!e&&`type`in e}async function _Y(e,t={}){let n=e.body;if(!n)throw new hY(`Show All Files stream had no response body.`);let{onBatch:r}=t,i=n.getReader(),a=new TextDecoder,o=[],s=[],c=!1,l=``,u=e=>{let t=e.trim();if(t.length===0)return!1;let n;try{n=JSON.parse(t)}catch{return console.warn(`[show-all-stream] dropping unparseable NDJSON line:`,t.slice(0,200)),!1}if(gY(n)){if(n.type===`error`)throw new hY(typeof n.problem?.title==`string`?n.problem.title:`Show All Files stream failed.`);return c=n.truncated===!0,!0}let r=aa.safeParse(n);return r.success?(o.push(r.data),s.push(r.data)):console.warn(`[show-all-stream] dropping schema-divergent entry line:`,r.error.issues),!1},d=()=>{if(!r||s.length===0)return;let e=s;s=[],r(e)};try{let e=!1;for(;!e;){let t=await i.read();if(t.done)break;l+=a.decode(t.value,{stream:!0});let n=l.indexOf(`
1937
+ `;function IJ(e){zJ(e);let t=e.querySelector(`[data-item-rename-input]`);if(!t)return;let n=t.closest(`[data-type="item"]`);if(!n)return;let r=n.dataset.itemPath??``;if(r.endsWith(`/`))return;let i=Dl(r);Tl(r)&&LJ(i),!t.hasAttribute(jJ)&&(BJ(t),t.setAttribute(jJ,``))}function LJ(e){MJ=e,NJ!==null&&clearTimeout(NJ),NJ=setTimeout(RJ,PJ)}function RJ(){MJ=null,NJ!==null&&(clearTimeout(NJ),NJ=null)}function zJ(e){let t=e.querySelectorAll(`[${AJ}]`);for(let e of t){if(e.querySelector(`[data-item-rename-input]`))continue;let t=e.getAttribute(AJ);if(!t){e.removeAttribute(AJ);continue}let n=e.dataset.itemPath??``;if(n.toLowerCase().endsWith(t.toLowerCase())){e.removeAttribute(AJ);continue}let r=Dl(n);r&&r.toLowerCase()!==t.toLowerCase()&&e.removeAttribute(AJ)}if(MJ===null)return;let n=e.querySelectorAll(`[data-type="item"][data-item-path]`),r=!1;for(let e of n){let t=e.dataset.itemPath??``;!t||t.endsWith(`/`)||Dl(t)||(r=!0,e.getAttribute(`data-item-selected`)===`true`&&e.getAttribute(`data-ok-renaming`)!==MJ&&e.setAttribute(AJ,MJ))}let i=!!e.querySelector(`[data-item-rename-input]`);!r&&!i&&RJ()}function BJ(e){let t=Dl(e.value),n=t?e.value.length-t.length:e.value.length;e.setSelectionRange(0,n)}function VJ(e,t){e.getFocusedPath()===t&&e.scrollToPath(t,{offset:`nearest`,focus:!1})}function HJ(e){return{selectedFilePath:e,selectedFolderPath:null,navigationPath:e}}function UJ(e,t,n={}){if(!e)return HJ(t);let r=Ll(e);if(t&&r!==t)return HJ(t);switch(e.kind){case`doc`:return HJ(t??e.docName);case`large-file`:return HJ(e.docName);case`folder`:case`folder-index`:return{selectedFilePath:null,selectedFolderPath:e.folderPath,navigationPath:e.folderPath};case`missing`:return t&&n.isKnownDocument?.(t)?HJ(t):{selectedFilePath:null,selectedFolderPath:null,navigationPath:null};case`asset`:case`skill-file`:return{selectedFilePath:null,selectedFolderPath:null,navigationPath:null}}}function WJ(e,t){if(!e)return{kind:`none`};let n=t.find(t=>rf(t)===e),r=bf(e),i=e.endsWith(`/`)?r:xf(e,t);return i===r?n&&Ul(n)?n.mediaKind===`mermaid`?{kind:`document`,path:n.path}:{kind:`asset`,path:n.path,hash:su(n.path),mediaKind:n.mediaKind}:n&&Ml(n)?{kind:`document`,path:n.docName}:e.endsWith(`/`)?t.some(e=>Hl(e)?e.path===r||e.path.startsWith(`${r}/`):(Ul(e)?e.path:e.docName).startsWith(`${r}/`))?{kind:`folder`,path:r}:{kind:`none`}:t.some(e=>Ml(e)&&e.docName===r)?{kind:`document`,path:r}:{kind:`none`}:{kind:`document`,path:i}}var GJ=`You can restore this file from the Trash.`;function KJ(e){let t=GJ,n=`Move to Trash`,r=`Moving`;if(e.length===0)return{title:`Are you sure you want to delete the selected items?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r};if(e.length===1){let i=e[0];return i?i.kind===`folder`?{title:`Are you sure you want to delete '${i.name}' and its contents?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r}:{title:`Are you sure you want to delete '${i.name}'?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r}:{title:`Are you sure you want to delete the selected item?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r}}let i=e.some(e=>e.kind===`folder`),a=e.some(e=>e.kind!==`folder`);return i&&a?{title:`Are you sure you want to delete the following ${e.length} files/directories and their contents?`,detail:t,listedTargets:e,confirmLabel:n,confirmLabelBusy:r}:i?{title:`Are you sure you want to delete the following ${e.length} directories and their contents?`,detail:t,listedTargets:e,confirmLabel:n,confirmLabelBusy:r}:{title:`Are you sure you want to delete the following ${e.length} files?`,detail:t,listedTargets:e,confirmLabel:n,confirmLabelBusy:r}}function qJ(e,t){return e===`web`?null:KJ(t)}function JJ(e){return e.kind===`folder`?`${e.name}/`:e.kind===`asset`?e.name:e.docExt?`${e.name}${e.docExt}`:e.name}function YJ(e,t,n){let r=WJ(e,t);if(r.kind===`none`)return null;if(r.kind===`asset`)return{v:1,kind:`asset`,assetPath:r.path,mediaKind:r.mediaKind};if(r.kind===`folder`)return{v:1,kind:`folder`,folderPath:r.path};let i=t.find(e=>Ml(e)&&e.docName===r.path);return{v:1,kind:`doc`,docName:r.path,size:i?.size??n?.get(r.path)?.size??null}}var XJ=[`not-found`,`permission-denied`,`system-error`,`path-escape`];function ZJ(e){return typeof e==`string`&&XJ.includes(e)?e:`system-error`}function QJ(e){switch(e){case`not-found`:return yl._({id:`v41fCm`});case`permission-denied`:return yl._({id:`sJK6pq`});case`system-error`:return yl._({id:`Jqqevv`});case`path-escape`:return yl._({id:`WL6puM`})}}function $J(e){let t=QJ(e.reason),n=e.detail;return n?yl._({id:`Z2M5XM`,values:{reason:t,osDetail:n}}):yl._({id:`dTaauv`,values:{reason:t}})}function eY(e){return e.kind===`folder`?`${e.name}/`:e.name}function tY(e){let t=(0,$.c)(34),{failedTargets:n,isSubmitting:r,onDeletePermanently:i,onRetry:a,onCancel:o}=e,s=n.length>1,c=n[0],l=n.length,u;if(t[0]!==l||t[1]!==s||t[2]!==c){let e=c?eY(c):``;u=s?yl._({id:`5qNxOe`,values:{count:l}}):c?`${yl._({id:`E_BHoD`,values:{targetName:e}})}\n${$J(c)}`:yl._({id:`kolRU1`}),t[0]=l,t[1]=s,t[2]=c,t[3]=u}else u=t[3];let d=u,f;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(_n,{children:(0,Z.jsx)(J,{id:`aOp3hw`})}),t[4]=f):f=t[4];let p;t[5]===d?p=t[6]:(p=(0,Z.jsxs)(xn,{children:[f,(0,Z.jsx)(gn,{className:`whitespace-pre-wrap`,children:d})]}),t[5]=d,t[6]=p);let m;t[7]!==n||t[8]!==s?(m=s?(0,Z.jsx)(yn,{children:(0,Z.jsx)(`ul`,{className:`flex flex-col gap-2 text-xs`,children:n.map(nY)})}):null,t[7]=n,t[8]=s,t[9]=m):m=t[9];let h;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(J,{id:`dEgA5A`}),t[10]=h):h=t[10];let g;t[11]!==r||t[12]!==o?(g=(0,Z.jsx)(Y,{variant:`outline`,className:`font-mono uppercase`,onClick:o,disabled:r,"data-testid":`trash-failure-modal-cancel`,children:h}),t[11]=r,t[12]=o,t[13]=g):g=t[13];let _;t[14]===r?_=t[15]:(_=r?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Zc,{className:`size-4 animate-spin`}),` `,(0,Z.jsx)(J,{id:`mf37rL`})]}):(0,Z.jsx)(J,{id:`6gRgw8`}),t[14]=r,t[15]=_);let v;t[16]!==r||t[17]!==a||t[18]!==_?(v=(0,Z.jsx)(Y,{variant:`outline`,className:`font-mono uppercase`,onClick:a,disabled:r,"data-testid":`trash-failure-modal-retry`,children:_}),t[16]=r,t[17]=a,t[18]=_,t[19]=v):v=t[19];let y;t[20]===r?y=t[21]:(y=r?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Zc,{className:`size-4 animate-spin`}),` `,(0,Z.jsx)(J,{id:`s3caR3`})]}):(0,Z.jsx)(J,{id:`UBv8UK`}),t[20]=r,t[21]=y);let b;t[22]!==r||t[23]!==i||t[24]!==y?(b=(0,Z.jsx)(Y,{variant:`destructive`,onClick:i,disabled:r,"data-testid":`trash-failure-modal-delete-permanently`,children:y}),t[22]=r,t[23]=i,t[24]=y,t[25]=b):b=t[25];let x;t[26]!==b||t[27]!==g||t[28]!==v?(x=(0,Z.jsxs)(bn,{children:[g,v,b]}),t[26]=b,t[27]=g,t[28]=v,t[29]=x):x=t[29];let S;return t[30]!==x||t[31]!==p||t[32]!==m?(S=(0,Z.jsxs)(vn,{className:`sm:max-w-md`,children:[p,m,x]}),t[30]=x,t[31]=p,t[32]=m,t[33]=S):S=t[33],S}function nY(e){return(0,Z.jsxs)(`li`,{"data-testid":`trash-failure-modal-target`,children:[(0,Z.jsx)(`div`,{className:`font-mono text-foreground`,children:eY(e)}),(0,Z.jsx)(`div`,{className:`text-muted-foreground`,children:$J(e)})]},e.path)}function rY(e){let t=(0,$.c)(21),{parentDir:n,onSelectTemplate:r,ItemComponent:i}=e,{state:a}=Gr(n);if(a.status===`idle`||a.status===`loading`){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(J,{id:`Hl89Qd`}),t[0]=e):e=t[0];let n;return t[1]===i?n=t[2]:(n=(0,Z.jsx)(i,{disabled:!0,className:`text-muted-foreground`,children:e}),t[1]=i,t[2]=n),n}if(a.status===`error`){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(J,{id:`AQ-Lfg`}),t[3]=e):e=t[3];let n;return t[4]===i?n=t[5]:(n=(0,Z.jsx)(i,{disabled:!0,className:`text-muted-foreground`,children:e}),t[4]=i,t[5]=n),n}let o,s;if(t[6]!==i||t[7]!==r||t[8]!==a.data.folder.templates_available){s=Symbol.for(`react.early_return_sentinel`);bb0:{let e;t[11]===a.data.folder.templates_available?e=t[12]:(e=a.data.folder.templates_available??[],t[11]=a.data.folder.templates_available,t[12]=e);let n=c_(e);if(n.length===0){let e;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(J,{id:`iGCs04`}),t[13]=e):e=t[13];let n;t[14]===i?n=t[15]:(n=(0,Z.jsx)(i,{disabled:!0,className:`text-muted-foreground`,children:e}),t[14]=i,t[15]=n),s=n;break bb0}let c;t[16]!==i||t[17]!==r?(c=e=>(0,Z.jsx)(i,{onSelect:()=>r(e.name),children:e.title??e.name},`${e.scope}:${e.source_folder}:${e.name}`),t[16]=i,t[17]=r,t[18]=c):c=t[18],o=n.map(c)}t[6]=i,t[7]=r,t[8]=a.data.folder.templates_available,t[9]=o,t[10]=s}else o=t[9],s=t[10];if(s!==Symbol.for(`react.early_return_sentinel`))return s;let c;return t[19]===o?c=t[20]:(c=(0,Z.jsx)(Z.Fragment,{children:o}),t[19]=o,t[20]=c),c}function iY(e){return e?.isDirectory()?e:null}function aY(e,t){let n=t.getPath();for(let t of e.getSelectedPaths())t!==n&&e.getItem(t)?.deselect();t.isSelected()||t.select()}function oY(e){for(let t of e.getSelectedPaths())e.getItem(t)?.deselect()}function sY(e,t,n,r,i){let a=(0,$.c)(11),o;a[0]!==n||a[1]!==t||a[2]!==e||a[3]!==r?(o=()=>{let i=()=>{queueMicrotask(()=>{r.current=!1})};if(r.current=!0,!t){oY(e),i();return}let a=n?n.split(`\0`):[];for(let t of a){let n=iY(e.getItem(t));n&&!n.isExpanded()&&n.expand()}let o=e.getItem(t);if(!o){oY(e),i();return}if(e.getSelectedPaths().length>1&&o.isSelected()){o.focus(),i();return}aY(e,o),o.focus(),i()},a[0]=n,a[1]=t,a[2]=e,a[3]=r,a[4]=o):o=a[4];let s;a[5]!==n||a[6]!==t||a[7]!==e||a[8]!==r||a[9]!==i?(s=[n,t,e,r,i],a[5]=n,a[6]=t,a[7]=e,a[8]=r,a[9]=i,a[10]=s):s=a[10],(0,Q.useEffect)(o,s)}var cY=`open-knowledge:file-tree-menu-action-delete`,lY=`open-knowledge:file-tree-menu-action-rename`,uY=`open-knowledge:file-tree-menu-action-duplicate`;function dY(e){window.dispatchEvent(new CustomEvent(cY,{detail:{target:e}}))}function fY(e){let t=t=>{let n=t.detail;n?.target&&e(n.target)};return window.addEventListener(cY,t),()=>window.removeEventListener(cY,t)}function pY(e){window.dispatchEvent(new CustomEvent(lY,{detail:{target:e}}))}function mY(e){let t=t=>{let n=t.detail;n?.target&&e(n.target)};return window.addEventListener(lY,t),()=>window.removeEventListener(lY,t)}function hY(e){window.dispatchEvent(new CustomEvent(uY,{detail:{target:e}}))}function gY(e){let t=t=>{let n=t.detail;n?.target&&e(n.target)};return window.addEventListener(uY,t),()=>window.removeEventListener(uY,t)}var _Y={Accept:`application/x-ndjson, application/json`};function vY(e){return!e.ok||!e.body?!1:(e.headers.get(`content-type`)??``).includes(`application/x-ndjson`)}var yY=class extends Error{};function bY(e){return typeof e==`object`&&!!e&&`type`in e}async function xY(e,t={}){let n=e.body;if(!n)throw new yY(`Show All Files stream had no response body.`);let{onBatch:r}=t,i=n.getReader(),a=new TextDecoder,o=[],s=[],c=!1,l=``,u=e=>{let t=e.trim();if(t.length===0)return!1;let n;try{n=JSON.parse(t)}catch{return console.warn(`[show-all-stream] dropping unparseable NDJSON line:`,t.slice(0,200)),!1}if(bY(n)){if(n.type===`error`)throw new yY(typeof n.problem?.title==`string`?n.problem.title:`Show All Files stream failed.`);return c=n.truncated===!0,!0}let r=aa.safeParse(n);return r.success?(o.push(r.data),s.push(r.data)):console.warn(`[show-all-stream] dropping schema-divergent entry line:`,r.error.issues),!1},d=()=>{if(!r||s.length===0)return;let e=s;s=[],r(e)};try{let e=!1;for(;!e;){let t=await i.read();if(t.done)break;l+=a.decode(t.value,{stream:!0});let n=l.indexOf(`
1938
1938
  `);for(;n!==-1;){let t=u(l.slice(0,n));if(l=l.slice(n+1),t){e=!0;break}n=l.indexOf(`
1939
1939
  `)}d()}l+=a.decode(),l.includes(`
1940
- `)||u(l),d()}finally{i.releaseLock()}return{entries:o,truncated:c}}function vY(e,t,n,r=Date.now()){if(n.size===0)return[...e];let i=new Set(e.map(e=>rf(e))),a=[];for(let e of t){let t=rf(e);if(i.has(t)){n.delete(t);continue}let o=n.get(t);if(o!==void 0){if(r-o>5e3){n.delete(t);continue}a.push(e)}}return a.length===0?[...e]:[...e,...a]}function yY(e,t){if(t.length===0)return[...e];let n=new Set(e.map(e=>rf(e))),r=[...e];for(let e of t){let t=rf(e);n.has(t)||(n.add(t),r.push(e))}return r}function bY(e,t,n,r,i=Date.now()){if(t!==``&&!e.some(e=>rf(e)===t))return[...e];let a=[],o=[];for(let n of e)xY(t,rf(n))?a.push(n):o.push(n);let s=vY(n,a,r,i),c=new Set(s.map(e=>rf(e)).filter(e=>e.endsWith(`/`)));return[...o.filter(e=>{let n=rf(e);if(!n.startsWith(t))return!0;let r=n.slice(t.length),i=r.indexOf(`/`);return i===-1?!0:c.has(t+r.slice(0,i+1))}),...s]}function xY(e,t){if(!t.startsWith(e))return!1;let n=t.slice(e.length);if(n===``)return!1;let r=n.endsWith(`/`)?n.slice(0,-1):n;return r!==``&&!r.includes(`/`)}var SY=$l(`HOVER_INTENT_MS`,80),CY=3,wY=20,TY=new Map,EY=new Set,DY=[],OY=new Map;function kY(e){for(OY.delete(e),OY.set(e,!0);OY.size>wY;){let e=OY.keys().next().value;if(e===void 0)break;OY.delete(e)}}function AY(e){EY.delete(e),MY()}function jY(e,t){let n=Date.now();Zl(`ok/sidebar/prewarm-success`,{docName:e,t:n,poolEventId:t}),O(e,t,n)}function MY(){for(;EY.size<CY&&DY.length>0;){let e=DY.shift();if(!e)break;if(!OY.has(e.docName)){EY.add(e.docName),kY(e.docName);try{let t=e.prewarm(e.docName);t&&jY(e.docName,t)}catch(t){Zl(`ok/sidebar/prewarm-failed`,{docName:e.docName,message:t instanceof Error?t.message:String(t)})}finally{AY(e.docName)}}}}function NY(e,t){if(_e(e)||OY.has(e))return;let n=TY.get(e);n&&clearTimeout(n.timer);let r=setTimeout(()=>{if(TY.delete(e),EY.size>=CY){DY.push({docName:e,prewarm:t});return}kY(e),EY.add(e);try{let n=t(e);n&&jY(e,n)}catch(t){Zl(`ok/sidebar/prewarm-failed`,{docName:e,message:t instanceof Error?t.message:String(t)})}finally{AY(e)}},SY);TY.set(e,{timer:r,prewarm:t})}function PY(e){let t=TY.get(e);t&&(clearTimeout(t.timer),TY.delete(e))}function FY(e){window.requestAnimationFrame(()=>{let t=f(e);if(!(!t||t.isDestroyed))try{t.commands.focus()}catch{}})}function IY(e){let t=e.current;t.row?.removeAttribute(BY),t.root?.removeAttribute(VY),e.current={row:null,root:null}}function LY(e,t){let n=e.current;n.row===t.row&&n.root===t.root||(IY(e),t.row?.setAttribute(BY,`true`),t.root?.setAttribute(VY,`true`),e.current={row:t.row,root:t.root})}async function RY(e,t){try{await navigator.clipboard.writeText(e),X.success(t===`full`?yl._({id:`6_ZOw4`}):yl._({id:`haHgQj`}),{description:e})}catch(e){console.warn(`[FileTree] clipboard write failed:`,e),X.error(t===`full`?yl._({id:`vfRlCI`}):yl._({id:`5QGTaA`}))}}var zY=`
1940
+ `)||u(l),d()}finally{i.releaseLock()}return{entries:o,truncated:c}}function SY(e,t,n,r=Date.now()){if(n.size===0)return[...e];let i=new Set(e.map(e=>rf(e))),a=[];for(let e of t){let t=rf(e);if(i.has(t)){n.delete(t);continue}let o=n.get(t);if(o!==void 0){if(r-o>5e3){n.delete(t);continue}a.push(e)}}return a.length===0?[...e]:[...e,...a]}function CY(e,t){if(t.length===0)return[...e];let n=new Set(e.map(e=>rf(e))),r=[...e];for(let e of t){let t=rf(e);n.has(t)||(n.add(t),r.push(e))}return r}function wY(e,t,n,r,i=Date.now()){if(t!==``&&!e.some(e=>rf(e)===t))return[...e];let a=[],o=[];for(let n of e)TY(t,rf(n))?a.push(n):o.push(n);let s=SY(n,a,r,i),c=new Set(s.map(e=>rf(e)).filter(e=>e.endsWith(`/`)));return[...o.filter(e=>{let n=rf(e);if(!n.startsWith(t))return!0;let r=n.slice(t.length),i=r.indexOf(`/`);return i===-1?!0:c.has(t+r.slice(0,i+1))}),...s]}function TY(e,t){if(!t.startsWith(e))return!1;let n=t.slice(e.length);if(n===``)return!1;let r=n.endsWith(`/`)?n.slice(0,-1):n;return r!==``&&!r.includes(`/`)}var EY=$l(`HOVER_INTENT_MS`,80),DY=3,OY=20,kY=new Map,AY=new Set,jY=[],MY=new Map;function NY(e){for(MY.delete(e),MY.set(e,!0);MY.size>OY;){let e=MY.keys().next().value;if(e===void 0)break;MY.delete(e)}}function PY(e){AY.delete(e),IY()}function FY(e,t){let n=Date.now();Zl(`ok/sidebar/prewarm-success`,{docName:e,t:n,poolEventId:t}),O(e,t,n)}function IY(){for(;AY.size<DY&&jY.length>0;){let e=jY.shift();if(!e)break;if(!MY.has(e.docName)){AY.add(e.docName),NY(e.docName);try{let t=e.prewarm(e.docName);t&&FY(e.docName,t)}catch(t){Zl(`ok/sidebar/prewarm-failed`,{docName:e.docName,message:t instanceof Error?t.message:String(t)})}finally{PY(e.docName)}}}}function LY(e,t){if(_e(e)||MY.has(e))return;let n=kY.get(e);n&&clearTimeout(n.timer);let r=setTimeout(()=>{if(kY.delete(e),AY.size>=DY){jY.push({docName:e,prewarm:t});return}NY(e),AY.add(e);try{let n=t(e);n&&FY(e,n)}catch(t){Zl(`ok/sidebar/prewarm-failed`,{docName:e,message:t instanceof Error?t.message:String(t)})}finally{PY(e)}},EY);kY.set(e,{timer:r,prewarm:t})}function RY(e){let t=kY.get(e);t&&(clearTimeout(t.timer),kY.delete(e))}function zY(e){window.requestAnimationFrame(()=>{let t=f(e);if(!(!t||t.isDestroyed))try{t.commands.focus()}catch{}})}function BY(e){let t=e.current;t.row?.removeAttribute(WY),t.root?.removeAttribute(GY),e.current={row:null,root:null}}function VY(e,t){let n=e.current;n.row===t.row&&n.root===t.root||(BY(e),t.row?.setAttribute(WY,`true`),t.root?.setAttribute(GY,`true`),e.current={row:t.row,root:t.root})}async function HY(e,t){try{await navigator.clipboard.writeText(e),X.success(t===`full`?yl._({id:`6_ZOw4`}):yl._({id:`haHgQj`}),{description:e})}catch(e){console.warn(`[FileTree] clipboard write failed:`,e),X.error(t===`full`?yl._({id:`vfRlCI`}):yl._({id:`5QGTaA`}))}}var UY=`
1941
1941
  [data-file-tree-virtualized-root][data-file-tree-root-drag-target="true"] {
1942
1942
  position: relative;
1943
1943
  }
@@ -1960,15 +1960,15 @@ Error generating stack: `+e.message+`
1960
1960
  border: 2px solid Highlight;
1961
1961
  }
1962
1962
  }
1963
- `,BY=`data-ok-external-file-drop-target`,VY=`data-ok-external-file-drop-root-target`,HY=`__external-file-drop__`,UY=2e3,WY=`
1964
- [data-type="item"][${BY}="true"] {
1963
+ `,WY=`data-ok-external-file-drop-target`,GY=`data-ok-external-file-drop-root-target`,KY=`__external-file-drop__`,qY=2e3,JY=`
1964
+ [data-type="item"][${WY}="true"] {
1965
1965
  background: color-mix(in oklab, var(--color-primary) 10%, transparent);
1966
1966
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--color-primary) 72%, transparent);
1967
1967
  }
1968
- [data-file-tree-virtualized-root][${VY}="true"] {
1968
+ [data-file-tree-virtualized-root][${GY}="true"] {
1969
1969
  position: relative;
1970
1970
  }
1971
- [data-file-tree-virtualized-root][${VY}="true"]::after {
1971
+ [data-file-tree-virtualized-root][${GY}="true"]::after {
1972
1972
  content: "";
1973
1973
  position: absolute;
1974
1974
  inset: 0;
@@ -1979,17 +1979,17 @@ Error generating stack: `+e.message+`
1979
1979
  pointer-events: none;
1980
1980
  }
1981
1981
  @media (forced-colors: active) {
1982
- [data-type="item"][${BY}="true"] {
1982
+ [data-type="item"][${WY}="true"] {
1983
1983
  outline: 2px solid Highlight;
1984
1984
  outline-offset: -2px;
1985
1985
  }
1986
- [data-file-tree-virtualized-root][${VY}="true"]::after {
1986
+ [data-file-tree-virtualized-root][${GY}="true"]::after {
1987
1987
  border: 2px solid Highlight;
1988
1988
  }
1989
1989
  }
1990
- `,GY=`data-ok-creation-cleared`,KY=`${Vq}\n${jJ}\n${zY}\n${WY}\n${`
1991
- :host([${GY}]) [data-item-focused="true"] {
1990
+ `,YY=`data-ok-creation-cleared`,XY=`${Gq}\n${FJ}\n${UY}\n${JY}\n${`
1991
+ :host([${YY}]) [data-item-focused="true"] {
1992
1992
  --trees-focus-ring-color: transparent;
1993
1993
  }
1994
- `}\n${Fq}\n${Iq}`;function qY(e){return e===`darwin`?yl._({id:`LtSYdi`}):e===`win32`?yl._({id:`qi1F96`}):yl._({id:`e1Rn_k`})}function JY(e){let t=(0,$.c)(18),{item:n,workspace:r,onClose:i}=e,{_:a}=vt(),o=typeof window<`u`?window.okDesktop:void 0;if(!o)return null;let s=o.platform,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=qY(s),t[0]=c):c=t[0];let l=c,u,d;t[1]!==a||t[2]!==r?(u=r?null:a({id:`wTcjov`}),d=a(s===`darwin`?u?{id:`FvpFSZ`,values:{hint:u}}:{id:`LtSYdi`}:s===`win32`?u?{id:`o4dcAf`,values:{hint:u}}:{id:`qi1F96`}:u?{id:`zUhPuR`,values:{hint:u}}:{id:`e1Rn_k`}),t[1]=a,t[2]=r,t[3]=u,t[4]=d):(u=t[3],d=t[4]);let f=d,p=!r,m;t[5]!==n||t[6]!==i||t[7]!==r?(m=()=>{if(!r)return;i();let e=sc(r.contentDir,$d(n),r.pathSeparator);o.shell.showItemInFolder(e)},t[5]=n,t[6]=i,t[7]=r,t[8]=m):m=t[8];let h,g;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(gc,{"aria-hidden":`true`}),g=(0,Z.jsx)(`span`,{className:`flex-1`,children:l}),t[9]=h,t[10]=g):(h=t[9],g=t[10]);let _;t[11]===u?_=t[12]:(_=u?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:u}):null,t[11]=u,t[12]=_);let v;return t[13]!==f||t[14]!==p||t[15]!==m||t[16]!==_?(v=(0,Z.jsxs)(Ar,{disabled:p,onSelect:m,"aria-label":f,children:[h,g,_]}),t[13]=f,t[14]=p,t[15]=m,t[16]=_,t[17]=v):v=t[17],v}function YY(e){let t=(0,$.c)(69),{item:n,context:r,anyActionBusy:i,workspace:a,handoff:o,model:s,okignoreBinding:c,onStartCreating:l,onCreateFromTemplate:u,onDuplicate:d,onImportTemplate:f,onDelete:p,onExpandSubtree:m,onCollapseSubtree:h,folderTreePaths:g,isAsset:_,documents:v}=e,{_:y}=vt(),b=Zd(n,v),x=n.kind===`directory`,S;t[0]===n.path?S=t[1]:(S=Vl(n.path),t[0]=n.path,t[1]=S);let C=S,w=b.kind===`asset`?null:b,T=w!==null&&c!==null,E;t[2]!==y||t[3]!==x?(E=y(x?{id:`5D3Ior`}:{id:`dbhUX1`}),t[2]=y,t[3]=x,t[4]=E):E=t[4];let D=E,O;t[5]!==x||t[6]!==n.path?(O=x?Sf(n.path):null,t[5]=x,t[6]=n.path,t[7]=O):O=t[7];let k=Gr(O),A=k.state.status===`ready`?(k.state.data.folder.templates_available?.length??0)>0:!0,j=s.getSelectedPaths(),M=j.includes(b.treePath)?gJ(j,v):[],N=M.length>1?M:[b],P=N.length,F=yl._({id:`djjdjr`,values:{deleteCount:P}}),I;t[8]!==v||t[9]!==_||t[10]!==x||t[11]!==n||t[12]!==a?(I=_?null:x?Us({folderRelativePath:$d(n),workspace:a}):Xs({docName:xf(n.path,v),workspace:a}),t[8]=v,t[9]=_,t[10]=x,t[11]=n,t[12]=a,t[13]=I):I=t[13];let L=I,R;t[14]===r?R=t[15]:(R=()=>r.close({restoreFocus:!1}),t[14]=r,t[15]=R);let z=R,B;t[16]===r?B=t[17]:(B=()=>r.close(),t[16]=r,t[17]=B);let V=B,{status:H}=ss(),U=H?.hasRemote===!0,W;t[18]!==v||t[19]!==_||t[20]!==x||t[21]!==n.path||t[22]!==b?(W=_||b.kind===`asset`?null:x?Yr(Sf(n.path)):ci(xf(n.path,v)),t[18]=v,t[19]=_,t[20]=x,t[21]=n.path,t[22]=b,t[23]=W):W=t[23];let ee=W,G=U&&ee!==null,K;t[24]!==y||t[25]!==U||t[26]!==ee?(K=()=>{ee&&Jr({...ee,hasRemote:U,onClickWhenNoRemote:()=>{X.error(y({id:`WyQxwa`}))}},{clipboardWrite:Md,toastSuccess:QY,toastError:ZY,logEvent:XY})},t[24]=y,t[25]=U,t[26]=ee,t[27]=K):K=t[27];let te=K,ne;t[28]!==G||t[29]!==V||t[30]!==te?(ne=G?(0,Z.jsxs)(Ar,{"data-testid":`file-tree-menu-share`,onSelect:()=>{V(),te()},children:[(0,Z.jsx)(Eh,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`Z8lGw6`})]}):null,t[28]=G,t[29]=V,t[30]=te,t[31]=ne):ne=t[31];let re=ne,ie=0,ae=0;if(x){let e=mf(n.path);for(let t of g)(t===e||t.startsWith(e))&&(ie++,eY(s.getItem(t))?.isExpanded()&&ae++)}let oe=x&&ae<ie,se=x&&ae>0,ce;t[32]===V?ce=t[33]:(ce=e=>{e||V()},t[32]=V,t[33]=ce);let le;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,Z.jsx)(Pr,{asChild:!0,children:(0,Z.jsx)(`span`,{"aria-hidden":`true`,"data-file-tree-context-menu-root":`true`,className:`block size-px`})}),t[34]=le):le=t[34];let ue;t[35]!==y||t[36]!==i||t[37]!==T||t[38]!==V||t[39]!==z||t[40]!==F||t[41]!==N||t[42]!==A||t[43]!==o||t[44]!==L||t[45]!==D||t[46]!==_||t[47]!==x||t[48]!==C||t[49]!==n||t[50]!==s||t[51]!==c||t[52]!==w||t[53]!==h||t[54]!==u||t[55]!==p||t[56]!==d||t[57]!==m||t[58]!==f||t[59]!==l||t[60]!==re||t[61]!==se||t[62]!==oe||t[63]!==b||t[64]!==a?(ue=(0,Z.jsx)(Rr,{sideOffset:0,align:`start`,"data-file-tree-context-menu-root":`true`,className:`min-w-52`,children:x?(0,Z.jsxs)(Z.Fragment,{children:[C?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Ar,{disabled:i,onSelect:()=>{z(),l(`file`,Sf(n.path))},children:[(0,Z.jsx)(al,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`HdkSiO`})]}),A?(0,Z.jsxs)(jr,{children:[(0,Z.jsxs)(Lr,{disabled:i,children:[(0,Z.jsx)(Oi,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`Uuj_R4`})]}),(0,Z.jsx)(Mr,{children:(0,Z.jsx)($J,{parentDir:Sf(n.path),onSelectTemplate:e=>{z(),u(Sf(n.path),e)},ItemComponent:Ar})})]}):null,(0,Z.jsxs)(Ar,{disabled:i,onSelect:()=>{z(),l(`folder`,Sf(n.path))},children:[(0,Z.jsx)($m,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`96G6Re`})]}),(0,Z.jsx)(Vr,{})]}),(0,Z.jsx)(JY,{item:n,workspace:a,onClose:V}),(0,Z.jsx)(zs,{input:L,installStates:o.installStates,isElectronHost:o.isElectronHost,dispatch:o.dispatch,onBeforeLaunch:V}),re,(0,Z.jsxs)(jr,{children:[(0,Z.jsxs)(Lr,{children:[(0,Z.jsx)(pc,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`oCZkaG`})]}),(0,Z.jsxs)(Mr,{children:[(0,Z.jsx)(Ar,{disabled:!a,onSelect:()=>{a&&(V(),RY(sc(a.contentDir,$d(n),a.pathSeparator),`full`))},children:(0,Z.jsx)(J,{id:`oQA-cA`})}),(0,Z.jsx)(Ar,{onSelect:()=>{V(),RY($d(n),`relative`)},children:(0,Z.jsx)(J,{id:`s061i4`})})]})]}),oe||se?(0,Z.jsx)(Vr,{}):null,oe?(0,Z.jsxs)(Ar,{onSelect:()=>{V(),m(n.path)},children:[(0,Z.jsx)(Uh,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`OlAl5i`})]}):null,se?(0,Z.jsxs)(Ar,{onSelect:()=>{V(),h(n.path)},children:[(0,Z.jsx)(Zm,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`qvWGzP`})]}):null,C?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Vr,{}),(0,Z.jsxs)(Ar,{disabled:i,onSelect:()=>{b.kind!==`asset`&&(V(),d(b))},children:[(0,Z.jsx)(ic,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`euc6Ns`})]}),(0,Z.jsxs)(Ar,{disabled:i,onSelect:()=>{z(),s.startRenaming(n.path)},children:[(0,Z.jsx)(fc,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`2wxgft`})]}),(0,Z.jsxs)(Ar,{"data-testid":`file-tree-menu-hide`,disabled:!T,onSelect:()=>{if(!c||!w)return;V();let e=oJ(w),t=xi(c.current()),n=ki(t,e);if(n===t)return;c.patch(hi(n));let r=w.path.split(`/`).pop()||w.path;X.success(y({id:`4xtLTl`,values:{basename:r}}),{description:y({id:`nWv1ja`}),duration:5e3})},children:[(0,Z.jsx)(Ie,{"aria-hidden":`true`}),D]}),(0,Z.jsxs)(Ar,{variant:`destructive`,disabled:i,onSelect:()=>{V(),p(N)},children:[(0,Z.jsx)(ol,{"aria-hidden":`true`}),F]})]})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(JY,{item:n,workspace:a,onClose:V}),!_&&(0,Z.jsx)(zs,{input:L,installStates:o.installStates,isElectronHost:o.isElectronHost,dispatch:o.dispatch,onBeforeLaunch:V}),re,(0,Z.jsxs)(jr,{children:[(0,Z.jsxs)(Lr,{children:[(0,Z.jsx)(pc,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`oCZkaG`})]}),(0,Z.jsxs)(Mr,{children:[(0,Z.jsx)(Ar,{disabled:!a,onSelect:()=>{a&&(V(),RY(sc(a.contentDir,$d(n),a.pathSeparator),`full`))},children:(0,Z.jsx)(J,{id:`oQA-cA`})}),(0,Z.jsx)(Ar,{onSelect:()=>{V(),RY($d(n),`relative`)},children:(0,Z.jsx)(J,{id:`s061i4`})})]})]}),C?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Vr,{}),_?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(jr,{children:[(0,Z.jsxs)(Lr,{disabled:i,children:[(0,Z.jsx)(Ym,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`PYmp-0`})]}),(0,Z.jsxs)(Mr,{children:[(0,Z.jsx)(Ar,{disabled:i,onSelect:()=>{V(),f(b,!1)},children:(0,Z.jsx)(J,{id:`-FeyRg`})}),(0,Z.jsx)(Ar,{disabled:i,onSelect:()=>{V(),f(b,!0)},children:(0,Z.jsx)(J,{id:`dQHSCs`})})]})]}),(0,Z.jsxs)(Ar,{disabled:i,onSelect:()=>{V(),d(b)},children:[(0,Z.jsx)(ic,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`euc6Ns`})]})]}),(0,Z.jsxs)(Ar,{disabled:i,onSelect:()=>{z(),s.startRenaming(n.path)},children:[(0,Z.jsx)(fc,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`2wxgft`})]}),w?(0,Z.jsxs)(Ar,{"data-testid":`file-tree-menu-hide`,disabled:!T,onSelect:()=>{if(!c)return;V();let e=oJ(w),t=xi(c.current()),n=ki(t,e);if(n===t)return;c.patch(hi(n));let r=w.path.split(`/`).pop()||w.path;X.success(y({id:`OD0FCX`,values:{basename:r}}),{description:y({id:`nWv1ja`}),duration:5e3})},children:[(0,Z.jsx)(Ie,{"aria-hidden":`true`}),D]}):null,(0,Z.jsxs)(Ar,{variant:`destructive`,disabled:i,onSelect:()=>{V(),p(N)},children:[(0,Z.jsx)(ol,{"aria-hidden":`true`}),F]})]})]})}),t[35]=y,t[36]=i,t[37]=T,t[38]=V,t[39]=z,t[40]=F,t[41]=N,t[42]=A,t[43]=o,t[44]=L,t[45]=D,t[46]=_,t[47]=x,t[48]=C,t[49]=n,t[50]=s,t[51]=c,t[52]=w,t[53]=h,t[54]=u,t[55]=p,t[56]=d,t[57]=m,t[58]=f,t[59]=l,t[60]=re,t[61]=se,t[62]=oe,t[63]=b,t[64]=a,t[65]=ue):ue=t[65];let de;return t[66]!==ce||t[67]!==ue?(de=(0,Z.jsxs)(Br,{open:!0,modal:!1,onOpenChange:ce,children:[le,ue]}),t[66]=ce,t[67]=ue,t[68]=de):de=t[68],de}function XY(e){return console.log(e)}function ZY(e){return X.error(e)}function QY(e){return X.success(e)}function $Y(e,t){return`/api/documents?showAll=true${t?`&showOk=true`:``}&dir=${encodeURIComponent(e)}&depth=1`}async function eX(e,t,n,r,i){try{let a=await fetch($Y(e,t),{signal:n,headers:pY});if(mY(a)){let e=await _Y(a);return{kind:`entries`,entries:Ol(e.entries),truncated:e.truncated}}let o=await A(a,r);if(!o.ok)return{kind:`http-error`,title:o.title};let s=xo.safeParse(o.body);return s.success?{kind:`entries`,entries:Ol(s.data.documents),truncated:s.data.truncated===!0}:{kind:`http-error`,title:i}}catch(e){return e instanceof hY?{kind:`http-error`,title:e.message}:{kind:`network-error`,cause:e}}}function tX(e){let t=(0,$.c)(365),{ref:n,onContentHeightChange:r}=e,{_:i,i18n:a}=vt(),{activeDocName:o,activeTarget:s,closeTabs:c,closeDocument:l,closeAndClearForRename:u,getPoolActiveDocName:d,poolHas:f,isNewTabActive:p,openTarget:m,prewarm:h,remapTabsForRename:g}=Re(),{notifySidebarFileSelected:_}=mN(),{resolvedTheme:v}=zt(),{addPage:y,pageMeta:b,pages:x}=Ns(),S;t[0]===b?S=t[1]:(S=function(e,t){return Fl(e,t??b.get(e)?.size)??{kind:`doc`,target:e,docName:e}},t[0]=b,t[1]=S);let C=S,w;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(w=[],t[2]=w):w=t[2];let[E,D]=(0,Q.useState)(w),[O,k]=(0,Q.useState)(!0),[j,M]=(0,Q.useState)(null),[N,F]=(0,Q.useState)(!1),I=ZP(),L=(0,Q.useRef)(null),[R,z]=(0,Q.useState)(null),[B,V]=(0,Q.useState)(0),[H,U]=(0,Q.useState)(null),[W,ee]=(0,Q.useState)(null),[G,K]=(0,Q.useState)(null),[te,ne]=(0,Q.useState)(null),{conflicts:re}=yi(),[ie,ae]=(0,Q.useState)(null),[oe,se]=(0,Q.useState)(null),[ce,le]=(0,Q.useState)(!1),ue=(0,Q.useRef)(ce),de;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(de=new Set,t[3]=de):de=t[3];let fe=(0,Q.useRef)(de),q=(0,Q.useRef)(E),me=(0,Q.useRef)(b),he=(0,Q.useRef)(null),_e;t[4]!==y||t[5]!==C||t[6]!==_||t[7]!==m?(_e=function(e){if(e.kind===`doc`)e.registerPage&&y(e.docName),m(C(e.docName,e.size),{tabBehavior:`replace-active`}),nu(lu(e.docName));else if(e.kind===`folder`)m({kind:`folder`,target:e.folderPath,folderPath:e.folderPath},{tabBehavior:`replace-active`}),nu(tu(e.folderPath));else{let t=(e.entries??q.current).find(t=>Ul(t)&&t.path===e.assetPath);m({kind:`asset`,target:e.assetPath,assetPath:e.assetPath,mediaKind:t?.mediaKind??null},{tabBehavior:`replace-active`}),nu(su(e.assetPath))}_()},t[4]=y,t[5]=C,t[6]=_,t[7]=m,t[8]=_e):_e=t[8];let ve=_e,ye;t[9]!==E||t[10]!==ve||t[11]!==_||t[12]!==m||t[13]!==x?(ye=function(e,t){let n=t===void 0?E:t,r=BJ(e,n);if(r.kind===`none`){console.debug(`[FileTree] Dropped selection for unknown docName:`,bf(e));return}if(r.kind===`asset`){m({kind:`asset`,target:r.path,assetPath:r.path,mediaKind:r.mediaKind},{tabBehavior:`replace-active`}),nu(r.hash),_();return}if(r.kind===`folder`){ve({kind:`folder`,folderPath:r.path});return}let i=n.find(e=>Ml(e)&&e.docName===r.path),a=jl(r.path,{pages:x,docExt:i?.docExt});if(a?.kind===`asset`){m(a,{tabBehavior:`replace-active`}),nu(su(a.assetPath)),_();return}if(a?.kind===`doc`){ve({kind:`doc`,docName:a.docName});return}ve({kind:`doc`,docName:r.path,size:i?.size,registerPage:Tl(r.path)})},t[9]=E,t[10]=ve,t[11]=_,t[12]=m,t[13]=x,t[14]=ye):ye=t[14];let be=ye,xe=(0,Q.useRef)(o),Se;t[15]===E?Se=t[16]:(Se=new Set(E.filter(Ul).map(kX)),t[15]=E,t[16]=Se);let Ce=Se,we=(0,Q.useRef)(Ce),Te;t[17]===E?Te=t[18]:(Te=TJ(E),t[17]=E,t[18]=Te);let Ee=Te,De=(0,Q.useRef)(Ee),Oe;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=[],t[19]=Oe):Oe=t[19];let ke=(0,Q.useRef)(Oe),Ae=(0,Q.useRef)(null),je=(0,Q.useRef)(OX),Me=(0,Q.useRef)(null),Ne=(0,Q.useRef)(null),Pe=(0,Q.useRef)(!1),Fe=(0,Q.useRef)(!1),Ie=(0,Q.useRef)(null),Le;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(Le={row:null,root:null},t[20]=Le):Le=t[20];let ze=(0,Q.useRef)(Le),Ve=(0,Q.useRef)(DX),He=(0,Q.useRef)(null),Ue=(0,Q.useRef)(null),We;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(We=new Map,t[21]=We):We=t[21];let Ge=(0,Q.useRef)(We),Ke;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(Ke=new Set,t[22]=Ke):Ke=t[22];let qe=(0,Q.useRef)(Ke),Je;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(Je=new Map,t[23]=Je):Je=t[23];let Ye=(0,Q.useRef)(Je),Xe=(0,Q.useRef)(0),Ze;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(Ze=new Set,t[24]=Ze):Ze=t[24];let Qe=(0,Q.useRef)(Ze),$e=(0,Q.useRef)(EX),et=(0,Q.useRef)(TX),tt=(0,Q.useRef)(!1),nt=(0,Q.useRef)(!1),rt=(0,Q.useRef)(!1),it;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(it=()=>({showHiddenFiles:tt.current,showOnlyMarkdownFiles:nt.current,showOkFolders:rt.current}),t[25]=it):it=t[25];let at=it,ot=(0,Q.useRef)(null),st=(0,Q.useRef)(null),ct=(0,Q.useRef)(wX),lt=(0,Q.useRef)(CX),ut=(0,Q.useRef)(SX),dt=(0,Q.useRef)(xX),ft=(0,Q.useRef)(s),[pt,mt]=(0,Q.useState)(!1),ht;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(ht=function(){L.current!==null&&(clearTimeout(L.current),L.current=null)},t[26]=ht):ht=t[26];let gt=ht,_t;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(_t=function(){gt(),F(!1)},t[27]=_t):_t=t[27];let yt=_t,bt;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(bt=function(e){yt(),M(e)},t[28]=bt):bt=t[28];let xt=bt,St;t[29]===i?St=t[30]:(St=function(){if(gt(),qP()){M(null),F(!0),L.current=setTimeout(()=>{L.current=null,ot.current?.()},UY);return}F(!1),M(i({id:`34qyH5`}))},t[29]=i,t[30]=St);let Ct=St,wt=(0,Q.useRef)(!0),Tt;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(Tt=()=>{if(wt.current){wt.current=!1;return}ot.current?.()},t[31]=Tt):Tt=t[31];let Et;t[32]===I?Et=t[33]:(Et=[I],t[32]=I,t[33]=Et),(0,Q.useEffect)(Tt,Et);let Dt,Ot;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(Dt=()=>gt,Ot=[],t[34]=Dt,t[35]=Ot):(Dt=t[34],Ot=t[35]),(0,Q.useEffect)(Dt,Ot);let kt,At;t[36]!==E.length||t[37]!==O?(kt=()=>{if(O||E.length===0)return;let e=st.current?.querySelector(wR)?.shadowRoot;if(!e)return;let t=e,n=function(){Ie.current!==null&&clearTimeout(Ie.current),Ie.current=setTimeout(()=>{Fe.current=!1,Ie.current=null},0)},r=function(e){if(!(e instanceof DragEvent))return;let t=jX(e),n=t?.dataset.itemPath;if(!n)return;let r=GJ(t.dataset.itemType===`folder`?mf(n):n,q.current,me.current);r&&(Ie.current!==null&&(clearTimeout(Ie.current),Ie.current=null),Fe.current=!0,e.dataTransfer?.setData(Yd,lf(r)))},i=function(e){if(!(e instanceof DragEvent)||!df(e))return;let t=NX(e);if(!t){IY(ze);return}e.preventDefault(),e.stopPropagation(),e.dataTransfer&&(e.dataTransfer.dropEffect=`copy`),LY(ze,t)},a=function(e){if(!(e instanceof DragEvent)||!df(e))return;let n=e.relatedTarget;n instanceof Node&&t.contains(n)||IY(ze)},o=function(e){if(!(e instanceof DragEvent)||!df(e))return;let t=NX(e),n=af(e);if(!t||n.length===0){IY(ze);return}e.preventDefault(),e.stopPropagation(),IY(ze),Ve.current(n,t.parentDir,t.busyPath)};return e.addEventListener(`dragstart`,r,{capture:!0}),e.addEventListener(`dragover`,i,{capture:!0}),e.addEventListener(`dragleave`,a,{capture:!0}),e.addEventListener(`drop`,o,{capture:!0}),e.addEventListener(`dragend`,n,{capture:!0}),window.addEventListener(`drop`,n,!0),window.addEventListener(`dragend`,n,!0),()=>{e.removeEventListener(`dragstart`,r,{capture:!0}),e.removeEventListener(`dragover`,i,{capture:!0}),e.removeEventListener(`dragleave`,a,{capture:!0}),e.removeEventListener(`drop`,o,{capture:!0}),e.removeEventListener(`dragend`,n,{capture:!0}),window.removeEventListener(`drop`,n,!0),window.removeEventListener(`dragend`,n,!0),IY(ze),Ie.current!==null&&(clearTimeout(Ie.current),Ie.current=null),Fe.current=!1}},At=[E.length,O],t[36]=E.length,t[37]=O,t[38]=kt,t[39]=At):(kt=t[38],At=t[39]),(0,Q.useEffect)(kt,At);let{selectedFilePath:jt,selectedFolderPath:Mt,navigationPath:Nt}=zJ(s,p?null:o),Pt=jt?gf(jt,E.find(e=>Ml(e)&&e.docName===jt)?.docExt):Mt?mf(Mt):s?.kind===`asset`?s.assetPath:null,Ft=ce?null:Pt,It=Ks().states,{dispatch:Lt}=Bs(),Rt;t[40]!==Lt||t[41]!==It?(Rt={installStates:It,isElectronHost:typeof window<`u`&&window.okDesktop!=null,dispatch:Lt},t[40]=Lt,t[41]=It,t[42]=Rt):Rt=t[42];let Bt=Rt,{okignoreBinding:Vt,merged:Ht}=Hu(),Ut=Ht?.appearance?.sidebar?.showHiddenFiles??!1,Wt=Ht?.appearance?.sidebar?.showOnlyMarkdownFiles??!1,Gt=Ht?.appearance?.sidebar?.showOkFolders??!1,Kt;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(Kt=()=>He.current===null,t[43]=Kt):Kt=t[43];let qt=Kt,Jt;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(Jt=[],t[44]=Jt):Jt=t[44];let Yt;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(Yt={set:`complete`,spriteSheet:iJ,byFileExtension:{md:{name:eJ,viewBox:T},mdx:{name:eJ,viewBox:T}}},t[45]=Yt):Yt=t[45];let Xt;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(Xt={contextMenu:{enabled:!0,triggerMode:`both`,buttonVisibility:`when-needed`}},t[46]=Xt):Xt=t[46];let Zt;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(Zt={canDrag:qt,canDrop:qt,onDropComplete:e=>dt.current(e),onDropError:bX},t[47]=Zt):Zt=t[47];let Qt,en;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(Qt={canRename:qt,onRename:e=>lt.current(e),onError:e=>ut.current(e)},en=e=>ct.current(e),t[48]=Qt,t[49]=en):(Qt=t[48],en=t[49]);let tn;t[50]===i?tn=t[51]:(tn={paths:Jt,initialExpansion:`closed`,fileTreeSearchMode:`hide-non-matches`,initialVisibleRowCount:18,stickyFolders:!0,...Nq,icons:Yt,unsafeCSS:KY,composition:Xt,dragAndDrop:Zt,renaming:Qt,onSelectionChange:en,renderRowDecoration:e=>{let{item:t}=e;if(t.kind===`file`){let e=De.current.docsByTreePath.get(t.path);if(e?.isSymlink){let t=e.targetPath;return{icon:Qq,title:i(t?{id:`JE21eh`,values:{targetPath:t}}:{id:`BQu9Pg`})}}return dJ(t.path)?{icon:$q,title:i({id:`i9toLO`})}:null}let n=De.current.foldersByTreeDirectoryPath.get(mf(t.path));if(n?.isSymlink){let e=n.targetPath;return{icon:Qq,title:i(e?{id:`JE21eh`,values:{targetPath:e}}:{id:`BQu9Pg`})}}return null}},t[50]=i,t[51]=tn);let{model:nn}=jq(tn),rn;t[52]===nn?rn=t[53]:(rn=function(e){let t=nn.getItem(e)??nn.getItem(mf(e));return t?.isDirectory()?mf(Sf(t.getPath())):e},t[52]=nn,t[53]=rn);let an=rn,on,sn;t[54]===E?(on=t[55],sn=t[56]):(sn=nf(E),on=qd(sn),t[54]=E,t[55]=on,t[56]=sn);let cn=on,ln=(0,Q.useRef)(sn),un;t[57]!==E||t[58]!==Gt?(un=ff(E,{includeOkFolders:Gt}),t[57]=E,t[58]=Gt,t[59]=un):un=t[59];let dn=un,fn=(0,Q.useRef)(dn),pn=Mt?hf(mf(Mt)).slice(0,-1):hf(Ft??Nt),mn=pn.join(`\0`),hn;t[60]===nn?hn=t[61]:(hn=()=>{let e=new Set;for(let t of fn.current)eY(nn.getItem(t))?.isExpanded()&&e.add(t);return e},t[60]=nn,t[61]=hn);let gn=hn,_n;t[62]===gn?_n=t[63]:(_n=e=>{let t=new Set(ff(e??q.current,{includeOkFolders:rt.current})),n=gn();for(let e of ke.current)n.add(e);return[...n].filter(e=>t.has(e))},t[62]=gn,t[63]=_n);let vn=_n,yn;t[64]!==vn||t[65]!==nn?(yn=e=>{let t=nf(e??q.current);nn.resetPaths(t,{initialExpandedPaths:vn(e)})},t[64]=vn,t[65]=nn,t[66]=yn):yn=t[66];let bn=yn,xn;t[67]!==i||t[68]!==Ct?(xn=async function(e){let t=Xe.current,n=new AbortController;Ye.current.set(e,n);let r=await eX(Sf(e),rt.current,n.signal,i({id:`8RtNI0`}),i({id:`HlmZBk`}));if(Ye.current.get(e)===n&&Ye.current.delete(e),n.signal.aborted||t!==Xe.current)return;if(r.kind===`network-error`){Ct(),console.warn(`[FileTree] lazy folder children fetch failed:`,e,r.cause);return}if(r.kind===`http-error`){console.warn(`[FileTree] lazy folder children http error:`,e,r.title),xt(r.title);return}let a=Al(r.entries,at());qe.current.add(e),D(t=>bY(t,e,a,Ge.current)),M(null),yt(),r.truncated&&z(r.entries.length)},t[67]=i,t[68]=Ct,t[69]=xn):xn=t[69];let Cn=xn,wn;t[70]!==gn||t[71]!==Cn?(wn=()=>{let e=gn(),t=Qe.current;Qe.current=e;for(let n of e){if(t.has(n)||qe.current.has(n)||Ye.current.has(n))continue;let e=Sf(n);q.current.find(t=>Hl(t)&&t.path===e)?.hasChildren!==!1&&Cn(n)}},t[70]=gn,t[71]=Cn,t[72]=wn):wn=t[72];let Tn=wn,En;t[73]!==gn||t[74]!==Cn?(En=()=>{for(let e of gn())qe.current.has(e)||Ye.current.has(e)||Cn(e)},t[73]=gn,t[74]=Cn,t[75]=En):En=t[75];let Dn=En,On;t[76]!==nn||t[77]!==bn?(On=(e,t,n,r)=>{let i=r===void 0?[]:r,a=0,o=null;for(let{fromDocName:r,toDocName:i}of n){let n=e.find(e=>Ml(e)&&e.docName===r);if(n==null||nn.getItem(i)==null)continue;let s=gf(i,t.find(e=>Ml(e)&&e.docName===i)?.docExt??n.docExt);nn.move(i,s),o=s,a+=1}for(let{toPath:e}of i){let t=Dl(e);if(t===``)continue;let n=e.slice(0,-t.length);nn.getItem(n)!=null&&(nn.getItem(e)??nn.move(n,e),o=e,a+=1)}a!==0&&(bn(t),o!=null&&nn.focusPath(o))},t[76]=nn,t[77]=bn,t[78]=On):On=t[78];let kn=On,An;t[79]===Symbol.for(`react.memo_cache_sentinel`)?(An=e=>{Me.current=uf(e)},t[79]=An):An=t[79];let jn=An,Mn;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(Mn=e=>we.current.has(e),t[80]=Mn):Mn=t[80];let Nn=Mn,Pn;t[81]!==i||t[82]!==y||t[83]!==ve||t[84]!==bn?(Pn=async function(e){if(e.kind===`asset`||He.current!==null)return;let t=()=>{U(null),He.current=null};He.current=e.path,U(e.path),M(null);try{let n=await A(await fetch(`/api/duplicate-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e.kind,path:e.path})}),i({id:`dw_dUJ`}));if(!n.ok){X.error(n.title),bn(),t();return}let r=P(ka,n.body,`duplicate-path`,null);if(r===null){let e=i({id:`67f-3g`});X.error(e),M(e),Kl([`files`,`backlinks`,`graph`]),bn(),t();return}for(let e of r.duplicatedDocNames)y(e);D(t=>{let n=CF(t,e,r);return bn(n),jn(n),n}),Kl([`files`,`backlinks`,`graph`]),r.path!==e.path&&(r.kind===`folder`?ve({kind:`folder`,folderPath:r.path}):ve({kind:`doc`,docName:r.path})),X.success(r.kind===`folder`?i({id:`iilQXA`}):i({id:`A6h5b-`}),{description:r.path}),t()}catch(e){let n=e,r=n instanceof Error?n.message:String(n);console.warn(`[FileTree] duplicate failed:`,n),X.error(i({id:`EBVbtP`}),{description:r}),bn(),t()}},t[81]=i,t[82]=y,t[83]=ve,t[84]=bn,t[85]=Pn):Pn=t[85];let Fn=Pn,In=(0,Q.useRef)(Fn),Ln;t[86]===Fn?Ln=t[87]:(Ln=()=>{In.current=Fn},t[86]=Fn,t[87]=Ln),(0,Q.useEffect)(Ln);let Rn=async function(e,t){if(e.kind===`file`){if(t){K(e);return}await zn(e,!1)}};async function zn(e,t){if(He.current!==null)return;let n=()=>{U(null),He.current=null,K(null)};He.current=e.path,U(e.path),M(null);let r=e.path,a=r.lastIndexOf(`/`),o=a===-1?``:r.slice(0,a),s=await _c({sourcePath:e.path,targetFolder:o,deleteSource:t});if(!s.ok){X.error(i({id:`rDOuNw`}),{description:s.error}),n();return}t&&(await Yr([e],[e.path],[]),D(t=>{let n=t.filter(t=>!(Ml(t)&&t.docName===e.path));return bn(n),jn(n),n}),Kl([`files`,`backlinks`,`graph`])),X.success(i({id:`Ba4D2x`}),{description:s.path}),n()}let Bn=function(e){let t=cJ(e);if(!t||lJ(t))return!1;let n=nn.getFocusedPath()??nn.getSelectedPaths()[0]??null;if(!n||n.endsWith(`/`)||Nn(n))return!1;let r=lJ(n);if(!r)return!1;let i=mf(t);if(!fn.current.includes(i))return!1;let a=`${t}${r}`;return ln.current.includes(a)?!1:(vr({sourcePath:n,destinationPath:a,isFolder:!1}),nn.move(n,a),!0)},Vn;t[88]===Symbol.for(`react.memo_cache_sentinel`)?(Vn=e=>{let t=e??Ae.current;!t||Ae.current!==t||(t.disposeCommitListener(),Ae.current=null)},t[88]=Vn):Vn=t[88];let Hn=Vn,Un;t[89]!==i||t[90]!==Hn||t[91]!==l||t[92]!==c||t[93]!==bn?(Un=async function(e,t){let n=t===void 0?{}:t,r=n.updateUi??!0,a=n.restoreLocation??r;Hn(e),r&&U(e.renamePath);try{let t=await fetch(`/api/delete-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e.kind,path:e.createdPath})});if(!t.ok&&t.status!==404){let n=e.kind,a=e.createdPath,o=await A(t,i({id:`EcM3k7`,values:{kind:n}}));if(o.ok)return;let s=o.title,c=i({id:`YPFBfr`,values:{detail:s,kind:n,createdPath:a}});r?X.error(c):console.warn(`[FileTree] cleanup pending create failed: ${c}`),r&&(U(null),bn());return}}catch(t){if(console.warn(`[FileTree] cleanup pending create failed:`,t),r){let t=e.kind,n=e.createdPath;X.error(i({id:`_TDESN`,values:{kind:t,createdPath:n}}))}r&&(U(null),bn());return}r&&(e.kind===`file`?l(e.createdPath):c([ge(e.createdPath)],{force:!0})),r&&D(t=>{let n=xF(t,e.kind===`file`?[e.createdPath]:[],e.kind===`folder`?e.createdPath:void 0);return jn(n),n}),Kl([`files`,`backlinks`,`graph`]),a&&(window.location.hash=e.previousHash),r&&U(null)},t[89]=i,t[90]=Hn,t[91]=l,t[92]=c,t[93]=bn,t[94]=Un):Un=t[94];let Wn=Un,Gn,Kn;t[95]===Symbol.for(`react.memo_cache_sentinel`)?(Gn=()=>()=>{let e=Ae.current;e&&je.current(e,{restoreLocation:!1,updateUi:!1}).catch(yX)},Kn=[],t[95]=Gn,t[96]=Kn):(Gn=t[95],Kn=t[96]),(0,Q.useEffect)(Gn,Kn);let qn;t[97]!==i||t[98]!==Ct?(qn=()=>{let e=!0,t=null,n=Ms(async function(){t?.abort();let n=new AbortController;t=n,Xe.current+=1;for(let e of Ye.current.values())e.abort();Ye.current.clear(),qe.current.clear();try{let t=await fetch($Y(``,rt.current),{signal:n.signal,headers:pY});if(mY(t)){let r=at(),i=!1,{entries:a,truncated:o}=await _Y(t,{onBatch:t=>{if(!e||n.signal.aborted)return;let a=Al(Ol(t),r);a.length!==0&&(D(e=>yY(e,a)),i||(i=!0,M(null),yt(),k(!1)))}});if(!e)return;let s=Ol(a),c=Al(s,r);D(e=>bY(e,``,c,Ge.current)),M(null),yt(),z(o?a.length:null),V(s.length),et.current()}else{let n=await A(t,i({id:`8RtNI0`}));if(!e)return;if(!n.ok)xt(n.title),z(null);else{let e=xo.safeParse(n.body);if(!e.success)xt(i({id:`HlmZBk`})),z(null);else{let t=Ol(e.data.documents),n=Al(t,at());D(e=>bY(e,``,n,Ge.current)),M(null),yt(),z(e.data.truncated===!0?e.data.documents.length:null),V(t.length),et.current()}}}}catch(t){let r=t;if(n.signal.aborted)return;e&&(r instanceof hY?xt(r.message):Ct()),console.warn(`[FileTree] fetch failed:`,r)}e&&k(!1)},()=>t?.abort());ot.current=()=>n.request(),n.request();let r=()=>{document.visibilityState===`visible`&&n.request()};window.addEventListener(`focus`,r),window.addEventListener(`visibilitychange`,r);let a=ql(e=>{e.includes(`files`)&&n.request()});return()=>{e=!1,ot.current=null,n.dispose();for(let e of Ye.current.values())e.abort();Ye.current.clear(),window.removeEventListener(`focus`,r),window.removeEventListener(`visibilitychange`,r),a()}},t[97]=i,t[98]=Ct,t[99]=qn):qn=t[99];let Jn;t[100]===i?Jn=t[101]:(Jn=[i],t[100]=i,t[101]=Jn),(0,Q.useEffect)(qn,Jn);let Yn=(0,Q.useRef)(!0),Xn;t[102]===Symbol.for(`react.memo_cache_sentinel`)?(Xn=()=>{if(Yn.current){Yn.current=!1;return}ot.current?.()},t[102]=Xn):Xn=t[102];let Zn;t[103]!==Ut||t[104]!==Gt||t[105]!==Wt?(Zn=[Ut,Wt,Gt],t[103]=Ut,t[104]=Gt,t[105]=Wt,t[106]=Zn):Zn=t[106],(0,Q.useEffect)(Xn,Zn);let Qn,$n;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(Qn=()=>{let e=!0;return fetch(`/api/workspace`).then(async t=>{let n=await t.json();if(!e||!t.ok)return;let r=P(ba,n,`workspace`,null);r&&se({contentDir:r.contentDir,pathSeparator:r.pathSeparator})}).catch(vX),()=>{e=!1}},$n=[],t[107]=Qn,t[108]=$n):(Qn=t[107],$n=t[108]),(0,Q.useEffect)(Qn,$n);let er;t[109]!==vn||t[110]!==nn||t[111]!==cn?(er=()=>{if(Me.current===cn){Me.current=null;return}nn.resetPaths(ln.current,{initialExpandedPaths:vn()})},t[109]=vn,t[110]=nn,t[111]=cn,t[112]=er):er=t[112];let tr;t[113]!==nn||t[114]!==cn?(tr=[nn,cn],t[113]=nn,t[114]=cn,t[115]=tr):tr=t[115],(0,Q.useEffect)(er,tr),rY(nn,Ft,mn,Pe,cn);let nr,rr;t[116]!==nn||t[117]!==r?(nr=()=>{if(!r)return;let e=0,t=0,n=()=>st.current?.querySelector(`file-tree-container`)?.shadowRoot?.querySelector(`[data-file-tree-virtualized-list]`)??null,i=()=>{let e=n();if(!e)return;let t=Number.parseFloat(e.style.height);Number.isFinite(t)&&r(t)},a=()=>{cancelAnimationFrame(e),e=requestAnimationFrame(i)},o=new MutationObserver(i),s=()=>{let e=n();e?(o.observe(e,{attributes:!0,attributeFilter:[`style`]}),i()):t=requestAnimationFrame(s)};s();let c=nn.subscribe(a);return window.addEventListener(`resize`,a),()=>{cancelAnimationFrame(e),cancelAnimationFrame(t),o.disconnect(),c(),window.removeEventListener(`resize`,a)}},rr=[r,nn],t[116]=nn,t[117]=r,t[118]=nr,t[119]=rr):(nr=t[118],rr=t[119]),(0,Q.useEffect)(nr,rr);let ir;t[120]===Symbol.for(`react.memo_cache_sentinel`)?(ir=()=>{le(!1)},t[120]=ir):ir=t[120];let ar;t[121]===Pt?ar=t[122]:(ar=[Pt],t[121]=Pt,t[122]=ar),(0,Q.useEffect)(ir,ar);let or,sr;t[123]===ce?(or=t[124],sr=t[125]):(or=()=>{ue.current=ce;for(let e of fe.current)e()},sr=[ce],t[123]=ce,t[124]=or,t[125]=sr),(0,Q.useEffect)(or,sr);let cr;t[126]!==Ft||t[127]!==O||t[128]!==nn?(cr=()=>{O||!Ft||LJ(nn,Ft)},t[126]=Ft,t[127]=O,t[128]=nn,t[129]=cr):cr=t[129];let lr;t[130]!==mn||t[131]!==Ft||t[132]!==O||t[133]!==nn||t[134]!==cn?(lr=[Ft,mn,cn,O,nn],t[130]=mn,t[131]=Ft,t[132]=O,t[133]=nn,t[134]=cn,t[135]=lr):lr=t[135],(0,Q.useEffect)(cr,lr);let ur,dr;t[136]===nn?(ur=t[137],dr=t[138]):(ur=()=>nn.subscribe(()=>{if(!nn.isSearchOpen())for(let e of ke.current){let t=eY(nn.getItem(e));t&&!t.isExpanded()&&t.expand()}}),dr=[nn],t[136]=nn,t[137]=ur,t[138]=dr),(0,Q.useEffect)(ur,dr);let fr,pr;t[139]===nn?(fr=t[140],pr=t[141]):(fr=()=>nn.subscribe(()=>$e.current()),pr=[nn],t[139]=nn,t[140]=fr,t[141]=pr),(0,Q.useEffect)(fr,pr);let mr,hr;t[142]===nn?(mr=t[143],hr=t[144]):(mr=()=>nn.onMutation(`remove`,e=>{let t=Ae.current;!t||e.path!==t.renamePath||je.current(t)}),hr=[nn],t[142]=nn,t[143]=mr,t[144]=hr),(0,Q.useEffect)(mr,hr);let gr;t[145]!==y||t[146]!==u||t[147]!==d||t[148]!==ve||t[149]!==f||t[150]!==kn||t[151]!==g?(gr=async(e,t,n,r,i)=>{let a=t===void 0?[]:t,o=n===void 0?[]:n,s=i===void 0?[]:i,c=r?.docName??xe.current,l=new Map,p=new Map;for(let e of q.current){if(Ml(e)){let t=o.find(t=>t.fromPath===gf(e.docName,e.docExt))?.toPath;t&&l.set(e.docName,t);continue}if(Ul(e)){let t=o.find(t=>t.fromPath===e.path)?.toPath;t&&Tl(t)&&p.set(e.path,tf(t))}}let m=c?l.get(c)??null:null,h=r?.folderPath??(ft.current?.kind===`folder`?ft.current.folderPath:null),_=h?Be(h,a):null,v=r?.assetPath??(ft.current?.kind===`asset`?ft.current.assetPath:null),b=v?p.get(v)??null:null,x=m?null:b??wF(c,e),S=m??(v?b?null:o.find(e=>e.fromPath===v)?.toPath??Be(v,a):null);pe(e);let C=[...TF(e,d(),f),...l.keys()];await Promise.all(C.map(e=>u(e)));for(let t of e)y(t.toDocName);for(let e of p.values())y(e);g(e,a,o);let w=null;D(t=>{let n=bF(t,e,a,o,s);return w=n,kn(t,n,e,o),jn(n),n}),h&&_&&_!==h?ve({kind:`folder`,folderPath:_}):x&&x!==c?(ve({kind:`doc`,docName:x}),FY(x)):S&&(m||S!==v)&&ve({kind:`asset`,assetPath:S,entries:w??q.current}),Kl([`files`,`backlinks`,`graph`])},t[145]=y,t[146]=u,t[147]=d,t[148]=ve,t[149]=f,t[150]=kn,t[151]=g,t[152]=gr):gr=t[152];let _r=gr;async function vr(e){let t=!e.isFolder&&Nn(e.sourcePath),n=t?e.sourcePath:sf(e.sourcePath,e.isFolder);U(n),M(null);try{let r=El(e.sourcePath,e.destinationPath,e.isFolder),a=!e.isFolder&&!t&&!Tl(r.destinationPath),o=t||a?r.destinationPath:sf(r.destinationPath,e.isFolder),s=e.isFolder?{kind:`folder`,fromPath:Sf(n),toPath:Sf(o)}:t||a?{kind:`asset`,fromPath:n,toPath:o}:{kind:`file`,fromPath:xf(n,q.current),toPath:o},c={docName:xe.current,folderPath:ft.current?.kind===`folder`?ft.current.folderPath:null,assetPath:ft.current?.kind===`asset`?ft.current.assetPath:null},l=await A(await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(s)}),i({id:`gijbne`}));if(!l.ok){X.error(l.title),bn();let e=Ae.current;e&&e.renamePath===n?await Wn(e):Hn(),U(null);return}let u=P(Ua,l.body,`rename-path`,{renamed:[],renamedAssets:[]});try{await _r(u.renamed,e.isFolder?[{fromPath:Sf(n),toPath:Sf(o)}]:[],u.renamedAssets,c,!e.isFolder&&!t&&!a?u.renamed.flatMap(e=>{let t=Dl(o);return t?[{toDocName:e.toDocName,docExt:t}]:[]}):[])}catch(e){console.warn(`[FileTree] post-rename reconciliation failed`,{err:e,sourceTreePath:n,destinationTreePath:o,renamedCount:u.renamed.length,renamedAssetCount:u.renamedAssets.length}),X.error(i({id:`dDpCOp`}))}Hn(),U(null)}catch(e){console.warn(`[FileTree] rename failed:`,e);let t=i({id:`HIb0vl`});X.error(t),M(t),bn();let r=Ae.current;r&&r.renamePath===n?await Wn(r):Hn(),U(null)}}let yr;t[153]!==i||t[154]!==_r||t[155]!==bn?(yr=async function(e){let t=e.draggedPaths.map(t=>{let n=cf(t,e.target);return t===n?null:{sourcePath:t,destinationTreePath:n}}).filter(_X);if(t.length!==0){U(t[0]?.sourcePath??null),M(null);try{let e=[],n=[],r=[],a={docName:xe.current,folderPath:ft.current?.kind===`folder`?ft.current.folderPath:null,assetPath:ft.current?.kind===`asset`?ft.current.assetPath:null};for(let a of t){let t=a.sourcePath.endsWith(`/`),o=!t&&Nn(a.sourcePath),s=o?null:xf(a.sourcePath,q.current),c=t?{kind:`folder`,fromPath:Sf(a.sourcePath),toPath:Sf(a.destinationTreePath)}:o?{kind:`asset`,fromPath:a.sourcePath,toPath:a.destinationTreePath}:{kind:`file`,fromPath:s??tf(a.sourcePath),toPath:s&&Tl(s)?a.destinationTreePath:tf(a.destinationTreePath)},l=await A(await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(c)}),i({id:`dOHMA0`}));if(!l.ok){X.error(l.title),bn(),U(null);return}let u=P(Ua,l.body,`rename-path:drop`,{renamed:[],renamedAssets:[]});e=e.concat(u.renamed),n=n.concat(u.renamedAssets),t&&r.push({fromPath:Sf(a.sourcePath),toPath:Sf(a.destinationTreePath)})}try{await _r(e,r,n,a)}catch(r){console.warn(`[FileTree] post-move reconciliation failed`,{err:r,operationCount:t.length,renamedCount:e.length,renamedAssetCount:n.length}),X.error(i({id:`8OxKZy`}))}U(null)}catch(e){console.warn(`[FileTree] move failed:`,e),X.error(i({id:`HIb0vl`})),bn(),U(null)}}},t[153]=i,t[154]=_r,t[155]=bn,t[156]=yr):yr=t[156];let br=yr,xr;t[157]!==i||t[158]!==y||t[159]!==bn?(xr=async function(e,t,n){if(e.length===0||He.current!==null)return;let r=()=>{He.current=null,U(null)};He.current=n,U(n),M(null);let a=[],o=0,s=0;for(let n of e){let e=new FormData;e.append(`file`,n),_f(e,t,n.name||`upload`);try{let r=await A(await fetch(`/api/upload`,{method:`POST`,body:e}),i({id:`4Gz2wC`}));if(!r.ok){s+=1,X.error(r.title,{description:n.name});continue}let c=P(Sa,r.body,`upload:drop`,null);if(c===null){s+=1,X.error(i({id:`4Gz2wC`}),{description:n.name});continue}let l=Qd(t,c);if(c.deduped===!0){s+=1,X.error(i({id:`4sKwf6`}),{description:l});continue}o+=1;let u=vf(l,n);u&&a.push(u)}catch(e){let t=e;s+=1,console.warn(`[FileTree] external file upload failed:`,t),X.error(t instanceof TypeError?i({id:`HIb0vl`}):i({id:`4Gz2wC`}),{description:n.name})}}try{if(a.length>0){for(let e of a)Ml(e)&&y(e.docName);D(e=>{let t=new Set(e.map(rf)),n=!1,r=[...e];for(let e of a){let i=rf(e);Ge.current.set(i,Date.now()),!t.has(i)&&(t.add(i),r.push(e),n=!0)}return n?(bn(r),jn(r),r):e})}o>0&&(Kl([`files`,`backlinks`,`graph`]),ot.current?.(),X.success(yl._({id:`v75Em9`,values:{uploadedCount:o}}),{description:t||i({id:`RSqaSd`})})),s>0&&M(o>0?yl._({id:`yH7T4q`,values:{failedCount:s}}):i({id:`4Gz2wC`})),r()}catch(e){let t=e,n=i({id:`VcqWBy`});console.warn(`[FileTree] upload post-upload reconciliation failed:`,t),X.error(n),M(n),r()}},t[157]=i,t[158]=y,t[159]=bn,t[160]=xr):xr=t[160];let Sr=xr,Cr;t[161]===Symbol.for(`react.memo_cache_sentinel`)?(Cr=function(e){ae({parentDir:e})},t[161]=Cr):Cr=t[161];let wr=Cr,Tr;t[162]!==i||t[163]!==y||t[164]!==Wn||t[165]!==Hn||t[166]!==nn||t[167]!==ve||t[168]!==bn||t[169]!==sn?(Tr=async function(e,t,n){if(He.current)return;let r=Ae.current;r&&Hn(r);try{let r=pf(e,t,[...sn,...fn.current]);U(r.renamePath),He.current=r.renamePath;let a=window.location.hash,o;if(e===`file`){let e=ef(`file`,r.addPath),t={path:e};n?.template&&(t.template=n.template);let a=await A(await fetch(`/api/create-page`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)}),i({id:`fJgQHX`}));if(!a.ok){X.error(a.title),U(null),He.current=null;return}let s=tf(e),c=P(Wa,a.body,`create-page`,{docName:s}).docName;o=c;let l={kind:`document`,docName:c,docExt:e.toLowerCase().endsWith(`.mdx`)?`.mdx`:`.md`,modified:new Date().toISOString(),size:0};y(c),D(e=>{if(e.some(e=>Ml(e)&&e.docName===c))return e;let t=[...e,l];return jn(t),Ge.current.set(rf(l),Date.now()),t}),Kl([`files`,`backlinks`,`graph`]),ve({kind:`doc`,docName:c})}else{let e=Sf(r.addPath),t=await A(await fetch(`/api/create-folder`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e})}),i({id:`K1ckLX`}));if(!t.ok){X.error(t.title),U(null),He.current=null;return}o=P(Wo,t.body,`create-folder`,{path:e}).path;let n={kind:`folder`,path:o,modified:new Date().toISOString(),size:0};D(e=>{if(e.some(e=>Hl(e)&&e.path===o))return e;let t=[...e,n];return jn(t),Ge.current.set(rf(n),Date.now()),t}),Kl([`files`]),ve({kind:`folder`,folderPath:o})}let s=!1,c=e=>{if(e.key!==`Enter`)return;let t=Ae.current;!t||t.renamePath!==r.renamePath||queueMicrotask(()=>Hn(t))};document.addEventListener(`keydown`,c,!0),Ae.current={kind:e,renamePath:r.renamePath,createdPath:o,previousHash:a,disposeCommitListener:()=>{s||(s=!0,document.removeEventListener(`keydown`,c,!0))}},U(null),He.current=null,nn.add(r.addPath),nn.startRenaming(r.renamePath,{removeIfCanceled:!0})}catch(e){console.warn(`[FileTree] create placeholder failed:`,e),X.error(i({id:`S6l5dv`}));let t=Ae.current;t?await Wn(t):Hn(),U(null),He.current=null,bn()}},t[162]=i,t[163]=y,t[164]=Wn,t[165]=Hn,t[166]=nn,t[167]=ve,t[168]=bn,t[169]=sn,t[170]=Tr):Tr=t[170];let Er=Tr,Dr;t[171]===nn?Dr=t[172]:(Dr=function(e){let t=mf(e);(0,Q.startTransition)(()=>{for(let e of fn.current)if(e===t||e.startsWith(t)){let t=eY(nn.getItem(e));t&&t.expand()}})},t[171]=nn,t[172]=Dr);let Or=Dr,kr;t[173]===nn?kr=t[174]:(kr=function(e){let t=mf(e),n=new Set(ke.current);(0,Q.startTransition)(()=>{for(let e of[...fn.current].reverse())if((e===t||e.startsWith(t))&&!n.has(e)){let t=eY(nn.getItem(e));t&&t.collapse()}})},t[173]=nn,t[174]=kr);let Ar=kr,jr;t[175]===Symbol.for(`react.memo_cache_sentinel`)?(jr=function(){return((st.current?.querySelector(`file-tree-container`)?.shadowRoot)?.querySelector(`[aria-selected="true"][data-item-path]`))?.dataset.itemPath??null},t[175]=jr):jr=t[175];let Mr=jr,Nr;t[176]!==be||t[177]!==pn||t[178]!==o||t[179]!==s||t[180]!==Ce||t[181]!==H||t[182]!==Wn||t[183]!==Tn||t[184]!==E||t[185]!==dn||t[186]!==br||t[187]!==vr||t[188]!==an||t[189]!==b||t[190]!==Bn||t[191]!==Dn||t[192]!==Ee||t[193]!==Ut||t[194]!==Gt||t[195]!==Wt||t[196]!==sn||t[197]!==Sr?(Nr=()=>{q.current=E,De.current=Ee,me.current=b,xe.current=o,ft.current=s,we.current=Ce,He.current=H,tt.current=Ut,nt.current=Wt,rt.current=Gt,ln.current=sn,fn.current=dn,ke.current=pn,$e.current=Tn,et.current=Dn,je.current=Wn,Ve.current=(e,t,n)=>{Sr(e,t,n)},ct.current=e=>{if(Pe.current||Fe.current||e.length!==1)return;let t=e[0];if(t){le(!1);let e=an(t),n=he.current,r=n!==null&&tf(n)===tf(e),i=r?n:e;he.current=null,queueMicrotask(()=>{be(an((r?null:Mr())??i),q.current)})}},ut.current=e=>{Bn(e)||X.error(e)},lt.current=vr,dt.current=br},t[176]=be,t[177]=pn,t[178]=o,t[179]=s,t[180]=Ce,t[181]=H,t[182]=Wn,t[183]=Tn,t[184]=E,t[185]=dn,t[186]=br,t[187]=vr,t[188]=an,t[189]=b,t[190]=Bn,t[191]=Dn,t[192]=Ee,t[193]=Ut,t[194]=Gt,t[195]=Wt,t[196]=sn,t[197]=Sr,t[198]=Nr):Nr=t[198],(0,Q.useLayoutEffect)(Nr);let Pr,Fr;t[199]===nn?(Pr=t[200],Fr=t[201]):(Pr=()=>{let e=e=>{let t=(e.metaKey||e.ctrlKey)&&!e.altKey,n=e.key.toLowerCase(),r=t&&n===`a`,i=t&&!e.shiftKey&&n===`d`,a=t&&!e.shiftKey&&n===`c`,o=t&&!e.shiftKey&&n===`v`,s=!e.altKey&&!e.shiftKey&&(e.metaKey&&!e.ctrlKey&&n===`backspace`||!e.metaKey&&!e.ctrlKey&&n===`delete`);if(!r&&!i&&!a&&!o&&!s||SJ(e.target))return;let c=st.current,l=e.target,u=document.activeElement,d=l instanceof Node&&c?.contains(l),f=u instanceof Node&&c?.contains(u);if(!d&&!f)return;if(a){let t=yJ(nn,q.current,we.current);if(!t)return;Ue.current=t,e.preventDefault(),e.stopPropagation();return}if(o){let t=Ue.current;if(!t)return;In.current(t),e.preventDefault(),e.stopPropagation();return}if(i){let t=yJ(nn,q.current,we.current);if(!t)return;In.current(t),e.preventDefault(),e.stopPropagation();return}if(s){if(He.current!==null)return;let t=bJ(nn,q.current);if(t.length===0)return;ee({targets:t}),e.preventDefault(),e.stopPropagation();return}let p=new Set([...fn.current,...ln.current]);Pe.current=!0;for(let e of p)e&&nn.getItem(e)?.select();queueMicrotask(()=>{Pe.current=!1}),e.preventDefault(),e.stopPropagation()};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},Fr=[nn],t[199]=nn,t[200]=Pr,t[201]=Fr),(0,Q.useEffect)(Pr,Fr);let Ir,Lr;t[202]!==E.length||t[203]!==O?(Ir=()=>{if(O||E.length===0)return;let e=st.current?.querySelector(wR)?.shadowRoot;if(!e)return;let t=gX,n=()=>{for(let n of e.querySelectorAll(`[data-item-path]`)){let e=n.dataset.itemPath;if(!e)continue;let r=t(e);n.title!==r&&(n.title=r)}let n=e.querySelector(`[data-type="context-menu-anchor"]`);if(n){let r=e.querySelector(`[data-item-context-hover="true"][data-item-path]`)?.dataset.itemPath,i=r?t(r):``;n.title!==i&&(n.title=i)}};n();let r=new MutationObserver(n);return r.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`data-item-path`,`data-item-context-hover`]}),()=>r.disconnect()},Lr=[O,E.length],t[202]=E.length,t[203]=O,t[204]=Ir,t[205]=Lr):(Ir=t[204],Lr=t[205]),(0,Q.useEffect)(Ir,Lr);let Rr,zr;t[206]!==E.length||t[207]!==O?(Rr=()=>{if(O||E.length===0)return;let e=st.current?.querySelector(wR)?.shadowRoot;if(!e)return;let t=()=>Hq(e);t();let n=new MutationObserver(t);return n.observe(e,{subtree:!0,childList:!0,characterData:!0,attributes:!0,attributeFilter:[`data-item-path`]}),()=>n.disconnect()},zr=[O,E.length],t[206]=E.length,t[207]=O,t[208]=Rr,t[209]=zr):(Rr=t[208],zr=t[209]),(0,Q.useEffect)(Rr,zr);let Br,Vr;t[210]!==E.length||t[211]!==O?(Br=()=>{if(O||E.length===0)return;let e=st.current?.querySelector(wR)?.shadowRoot;if(!e)return;let t=()=>MJ(e);t();let n=new MutationObserver(t);return n.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`data-item-path`]}),()=>n.disconnect()},Vr=[O,E.length],t[210]=E.length,t[211]=O,t[212]=Br,t[213]=Vr):(Br=t[212],Vr=t[213]),(0,Q.useEffect)(Br,Vr);let Hr;t[214]===Symbol.for(`react.memo_cache_sentinel`)?(Hr={folderCount:0,expandedCount:0},t[214]=Hr):Hr=t[214];let Ur=(0,Q.useRef)(Hr),Wr=(0,Q.useRef)(Er),Gr=(0,Q.useRef)(wr),Kr;t[215]===Er?Kr=t[216]:(Kr=()=>{Wr.current=Er,Gr.current=wr},t[215]=Er,t[216]=Kr),(0,Q.useEffect)(Kr);let qr,Jr;t[217]===nn?(qr=t[218],Jr=t[219]):(qr=()=>({startCreating(e,t){Wr.current(e,t)},startCreatingFromTemplate(e){Gr.current(e)},createFromTemplate(e,t){Wr.current(`file`,e,{template:t})},expandAll(){(0,Q.startTransition)(()=>{for(let e of fn.current){let t=eY(nn.getItem(e));t&&t.expand()}})},collapseAll(){let e=new Set(ke.current);(0,Q.startTransition)(()=>{for(let t of[...fn.current].reverse()){if(e.has(t))continue;let n=eY(nn.getItem(t));n&&n.collapse()}})},getFolderState(){let e=fn.current,t=0;for(let n of e)eY(nn.getItem(n))?.isExpanded()&&t++;let n=e.length,r=Ur.current;if(r.folderCount===n&&r.expandedCount===t)return r;let i={folderCount:n,expandedCount:t};return Ur.current=i,i},isCreationTargetCleared(){return ue.current},clearCreationTarget(){le(!0)},subscribe(e){fe.current.add(e);let t=nn.subscribe(e);return()=>{fe.current.delete(e),t()}}}),Jr=[nn],t[217]=nn,t[218]=qr,t[219]=Jr),(0,Q.useImperativeHandle)(n,qr,Jr);async function Yr(e,t,n){let r=CJ(e,q.current,fn.current),i=Ae.current;i&&e.some(e=>wJ(e,i))&&(i.kind===`file`?r.docNames.add(i.createdPath):r.folderPaths.add(i.createdPath),Hn(i));let a=new Set([...r.docNames,...t]),o=new Set([...r.folderPaths,...n]),s=new Set([...r.assetPaths,...e.filter(hX).map(mX)]);c([...[...a].map(pX),...[...o].map(fX),...[...s].map(dX)],{force:!0}),await Promise.all([...a].map(e=>u(e)));for(let t of e){let e=t.kind===`folder`?mf(t.path):t.kind===`asset`?t.path:gf(t.path,t.docExt);nn.getItem(e)&&nn.remove(e,t.kind===`folder`?{recursive:!0}:void 0)}D(e=>{let t=xF(e,[...a],void 0,[...s]);for(let e of o)t=xF(t,[],e);return jn(t),t}),Kl([`files`,`backlinks`,`graph`])}let Xr;t[220]!==i||t[221]!==Yr?(Xr=async function(e){let t=[],n=[],r=[];for(let a of e){let e=a.kind;U(a.path);let o=await A(await fetch(`/api/delete-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e,path:a.path})}),i({id:`7JtSLi`}));if(!o.ok)return r.length>0&&await Yr(r,t,n),X.error(o.title),!1;let s=P(Ma,o.body,`delete-path`,{deletedDocNames:[]});t.push(...s.deletedDocNames),e===`folder`&&n.push(a.path),r.push(a)}return await Yr(r,t,n),!0},t[220]=i,t[221]=Yr,t[222]=Xr):Xr=t[222];let Zr=Xr,Qr;t[223]===Symbol.for(`react.memo_cache_sentinel`)?(Qr=async function(e,t,n){let r=[],i=[];for(let a of e){U(a.path);let e=EF(a,n),o=await t.shell.trashItem(e);o.ok?r.push(a):i.push({kind:a.kind,path:a.path,name:a.name,reason:qJ(o.reason),detail:o.detail})}return{trashed:r,failed:i}},t[223]=Qr):Qr=t[223];let $r=Qr,ei;t[224]===i?ei=t[225]:(ei=async function(e){let t=[],n=[],r=[];for(let a of e){let e=a.kind;try{let o=await A(await fetch(`/api/trash/cleanup`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e,path:a.path})}),i({id:`DVh_Tb`}));if(!o.ok){console.warn(`[FileTree] trash-cleanup failed`,{target:`${a.kind}:${a.path}`,reason:o.title}),r.push({target:a,reason:o.title});continue}let s=P(Qa,o.body,`trash-cleanup`,{deletedDocNames:[]});t.push(...s.deletedDocNames),e===`folder`&&n.push(a.path)}catch(e){let t=e;console.warn(`[FileTree] trash-cleanup threw`,{target:`${a.kind}:${a.path}`,err:t}),r.push({target:a,reason:i({id:`r4R7AZ`})})}}if(r.length>0){let e=r.length;X.error(i({id:`IrB5AK`,values:{failedCount:e}}),{description:i({id:`vEJDlt`})})}return r.length===e.length&&e.length>0?null:{deletedDocNames:t,deletedFolderPaths:n}},t[224]=i,t[225]=ei);let ti=ei,ni;t[226]!==i||t[227]!==re||t[228]!==Yr||t[229]!==Zr||t[230]!==ti||t[231]!==bn||t[232]!==oe?(ni=async function(e){let t=e.filter(uX).map(e=>SF(e,q.current)),n=t[0];if(!n)return;let r=re.filter(e=>t.some(t=>{if(t.kind===`file`){let n=`${t.path}${t.docExt??`.md`}`;return e.file===n}return t.kind===`folder`?e.file.startsWith(`${t.path}/`):!1}));if(r.length>0){let e=r.slice(0,3).map(lX),t=r.length>e.length?`, +${r.length-e.length} more`:``;X.error(`Cannot delete files with unresolved conflicts`,{description:`Resolve the conflict on ${e.join(`, `)}${t} before deleting.`});return}U(n.path),ee(null);let a=typeof window<`u`?window.okDesktop:void 0;try{if(a&&oe){let{trashed:e,failed:n}=await $r(t,a,oe);if(e.length>0){let t=await ti(e);t?await Yr(e,t.deletedDocNames,t.deletedFolderPaths):await Yr(e,e.filter(cX).map(sX),e.filter(oX).map(aX))}n.length>0&&ne({failed:n,originalTargets:[...t]}),U(null)}else{let e=await Zr(t);U(null),e||bn()}}catch(e){let t=e,n=t instanceof Error?t.message:String(t);console.warn(`[FileTree] delete failed:`,t),X.error(i({id:`0eHrMb`}),{description:n}),U(null),bn()}},t[226]=i,t[227]=re,t[228]=Yr,t[229]=Zr,t[230]=ti,t[231]=bn,t[232]=oe,t[233]=ni):ni=t[233];let ri=ni,ii;t[234]!==i||t[235]!==Zr||t[236]!==bn||t[237]!==te?(ii=async function(){if(!te)return;let e=new Set(te.failed.map(iX)),t=te.originalTargets.filter(t=>e.has(`${t.kind}:${t.path}`));if(ne(null),t.length!==0){U(t[0]?.path??null);try{let e=await Zr(t);U(null),e||bn()}catch(e){let t=e,n=t instanceof Error?t.message:String(t);console.warn(`[FileTree] hard-delete fallback failed:`,t),X.error(i({id:`0eHrMb`}),{description:n}),U(null),bn()}}},t[234]=i,t[235]=Zr,t[236]=bn,t[237]=te,t[238]=ii):ii=t[238];let ai=ii,oi;t[239]!==ri||t[240]!==te?(oi=async function(){if(!te)return;let e=new Set(te.failed.map(rX)),t=te.originalTargets.filter(t=>e.has(`${t.kind}:${t.path}`));ne(null),await ri(t)},t[239]=ri,t[240]=te,t[241]=oi):oi=t[241];let si=oi,ci=(0,Q.useRef)(ri),li;t[242]===ri?li=t[243]:(li=()=>{ci.current=ri},t[242]=ri,t[243]=li),(0,Q.useEffect)(li);let ui,di;t[244]===Symbol.for(`react.memo_cache_sentinel`)?(ui=()=>cY(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=q.current.find(e=>Ml(e)&&e.docName===t);ci.current([{kind:`file`,path:t,name:t.split(`/`).pop()??t,docExt:n?.docExt}]);return}if(e.kind===`folder`){ci.current([{kind:`folder`,path:e.folderPath,name:e.folderPath.split(`/`).pop()??e.folderPath}]);return}if(e.kind===`asset`){ci.current([{kind:`asset`,path:e.assetPath,name:e.assetPath.split(`/`).pop()??e.assetPath}]);return}console.warn(JSON.stringify({event:`file-tree-menu-action-delete-unsupported-kind`,kind:e.kind}))}),di=[],t[244]=ui,t[245]=di):(ui=t[244],di=t[245]),(0,Q.useEffect)(ui,di);let fi,pi;t[246]===Symbol.for(`react.memo_cache_sentinel`)?(fi=()=>fY(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=q.current.find(e=>Ml(e)&&e.docName===t);In.current({kind:`file`,path:t,name:t.split(`/`).pop()??t,docExt:n?.docExt});return}if(e.kind===`folder`){In.current({kind:`folder`,path:e.folderPath,name:e.folderPath.split(`/`).pop()??e.folderPath});return}console.warn(JSON.stringify({event:`file-tree-menu-action-duplicate-unsupported-kind`,kind:e.kind}))}),pi=[],t[246]=fi,t[247]=pi):(fi=t[246],pi=t[247]),(0,Q.useEffect)(fi,pi);let mi,hi;t[248]===nn?(mi=t[249],hi=t[250]):(mi=()=>uY(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=gf(t,q.current.find(e=>Ml(e)&&e.docName===t)?.docExt);nn.startRenaming(n);return}if(e.kind===`folder`){nn.startRenaming(e.folderPath);return}if(e.kind===`asset`){nn.startRenaming(e.assetPath);return}console.warn(JSON.stringify({event:`file-tree-menu-action-rename-unsupported-kind`,kind:e.kind}))}),hi=[nn],t[248]=nn,t[249]=mi,t[250]=hi),(0,Q.useEffect)(mi,hi);let gi;t[251]===Symbol.for(`react.memo_cache_sentinel`)?(gi=function(){let e=Ne.current;e&&PY(e),Ne.current=null},t[251]=gi):gi=t[251];let _i=gi,vi;t[252]===Symbol.for(`react.memo_cache_sentinel`)?(vi=function(e){let t=pJ(e);if(!t)return!1;let n=st.current?.querySelector(wR)?.shadowRoot;if(!n)return!1;for(let e of n.querySelectorAll(`[data-item-path]`))if(e.dataset.itemPath===t)return!0;return!1},t[252]=vi):vi=t[252];let bi=vi,xi;t[253]===h?xi=t[254]:(xi=function(e){let t=AX(e.nativeEvent);if(!t||t.endsWith(`/`)){_i();return}let n=q.current.find(e=>rf(e)===t);if(n&&Ul(n)){_i();return}let r=n&&Ml(n)?n.docName:xf(t,q.current);if(n&&Ml(n)&&Lo(n.size)){_i();return}Ne.current!==r&&(_i(),Ne.current=r,NY(r,e=>h(e)))},t[253]=h,t[254]=xi);let Si=xi,Ci;t[255]!==be||t[256]!==nn||t[257]!==ve?(Ci=function(e){if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=jX(e.nativeEvent);if(!t){PX(e.nativeEvent)&&le(!0);return}let n=t.getAttribute(`aria-selected`)===`true`,r=t.dataset.itemPath;if(!r)return;let i=t.dataset.itemType===`folder`?mf(r):r;if(t.dataset.itemType===`folder`){let t=Sf(i),r=eY(nn.getItem(i));if(!n){e.preventDefault(),e.stopPropagation(),r&&!r.isExpanded()&&r.expand(),queueMicrotask(()=>ve({kind:`folder`,folderPath:t}));return}if(nn.getSelectedPaths().length!==1||window.location.hash===tu(t))return;e.preventDefault(),e.stopPropagation(),r&&!r.isExpanded()&&r.expand(),queueMicrotask(()=>ve({kind:`folder`,folderPath:t}));return}if(!n){if(mJ(i,ln.current)||bi(i)){he.current=i,setTimeout(()=>ve({kind:`doc`,docName:i,registerPage:!0}),0);return}queueMicrotask(()=>be(i));return}let a=xf(i,q.current);nn.getSelectedPaths().length===1&&window.location.hash!==lu(a)&&queueMicrotask(()=>be(i))},t[255]=be,t[256]=nn,t[257]=ve,t[258]=Ci):Ci=t[258];let wi=Ci,Ti;t[259]===Symbol.for(`react.memo_cache_sentinel`)?(Ti=function(e){df(e.nativeEvent)&&(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=`copy`,mt(!0))},t[259]=Ti):Ti=t[259];let Ei=Ti,Di;t[260]===Symbol.for(`react.memo_cache_sentinel`)?(Di=function(e){let t=e.relatedTarget;t instanceof Node&&e.currentTarget.contains(t)||mt(!1)},t[260]=Di):Di=t[260];let Oi=Di,ki;t[261]===Sr?ki=t[262]:(ki=function(e){if(!df(e.nativeEvent))return;let t=af(e.nativeEvent);t.length!==0&&(e.preventDefault(),e.stopPropagation(),mt(!1),Sr(t,``,HY))},t[261]=Sr,t[262]=ki);let Ai=ki;if(O){let e;return t[263]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(IX,{}),t[263]=e):e=t[263],e}let ji;t[264]!==i||t[265]!==N||t[266]!==I?(ji=N?i(I?{id:`H-vDm3`}:{id:`09Tv5j`}):null,t[264]=i,t[265]=N,t[266]=I,t[267]=ji):ji=t[267];let Mi=ji;if(E.length===0){if(Mi!==null){let e;return t[268]===Mi?e=t[269]:(e=(0,Z.jsx)(`div`,{className:`flex flex-1 items-center justify-center py-8`,children:(0,Z.jsx)(`span`,{role:`status`,className:`select-none text-sidebar-foreground/50 text-sm`,children:Mi})}),t[268]=Mi,t[269]=e),e}if(j){let e;return t[270]===j?e=t[271]:(e=(0,Z.jsx)(`div`,{className:`flex flex-1 items-center justify-center py-8`,children:(0,Z.jsx)(`span`,{role:`alert`,className:`select-none text-sidebar-foreground/50 text-sm`,children:j})}),t[270]=j,t[271]=e),e}if(Pl({visibility:{showHiddenFiles:Ut,showOnlyMarkdownFiles:Wt},unfilteredRootEntryCount:B,knownPageCount:x.size})===`filtered-to-zero`){let e;return t[272]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Mq,{}),t[272]=e):e=t[272],e}let e;t[273]===i?e=t[274]:(e=i({id:`5ZB7XC`}),t[273]=i,t[274]=e);let n=pt&&`bg-primary/5 ring-2 ring-primary/70 ring-inset`,r;t[275]===n?r=t[276]:(r=$t(`flex flex-1 flex-col items-center justify-center gap-3 rounded-md py-8`,n),t[275]=n,t[276]=r);let a;t[277]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(`span`,{className:`select-none text-sidebar-foreground/30 text-sm`,children:(0,Z.jsx)(J,{id:`xiv-dW`})}),t[277]=a):a=t[277];let o;t[278]===Er?o=t[279]:(o=()=>Er(`file`,``),t[278]=Er,t[279]=o);let s;t[280]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(J,{id:`6ibbCg`}),t[280]=s):s=t[280];let c;t[281]===o?c=t[282]:(c=(0,Z.jsx)(Y,{variant:`link`,size:`sm`,className:`font-mono uppercase`,onClick:o,children:s}),t[281]=o,t[282]=c);let l;return t[283]!==Ai||t[284]!==e||t[285]!==r||t[286]!==c?(l=(0,Z.jsxs)(`section`,{"aria-label":e,className:r,onDragOver:Ei,onDragLeave:Oi,onDrop:Ai,children:[a,c]}),t[283]=Ai,t[284]=e,t[285]=r,t[286]=c,t[287]=l):l=t[287],l}let Ni=H!==null,Pi=W?.targets[0]??null,Fi=null;if(R!==null){let e;if(t[288]!==a.locale||t[289]!==R){let n=new Intl.NumberFormat(a.locale).format(R);e=yl._({id:`LuoJWu`,values:{truncatedShownCount:R,formattedCount:n}}),t[288]=a.locale,t[289]=R,t[290]=e}else e=t[290];Fi=e}let Ii;t[291]!==j||t[292]!==Mi||t[293]!==Fi?(Ii=(j||Mi!==null||Fi!==null)&&(0,Z.jsxs)(Z.Fragment,{children:[Mi===null?j&&(0,Z.jsx)(RX,{kind:`error`,children:j}):(0,Z.jsx)(RX,{kind:`reconnecting`,children:Mi}),Fi!==null&&(0,Z.jsx)(RX,{kind:`info`,children:Fi})]}),t[291]=j,t[292]=Mi,t[293]=Fi,t[294]=Ii):Ii=t[294];let Li;t[295]===v?Li=t[296]:(Li=Lq(v),t[295]=v,t[296]=Li);let Ri=ce?``:void 0,zi;t[297]===Ri?zi=t[298]:(zi={[GY]:Ri},t[297]=Ri,t[298]=zi);let Bi;t[299]!==Ni||t[300]!==Ce||t[301]!==Ar||t[302]!==E||t[303]!==Or||t[304]!==dn||t[305]!==Fn||t[306]!==Rn||t[307]!==Bt||t[308]!==nn||t[309]!==Vt||t[310]!==Er||t[311]!==oe?(Bi=(e,t)=>(0,Z.jsx)(YY,{item:e,context:t,anyActionBusy:Ni,workspace:oe,handoff:Bt,model:nn,okignoreBinding:Vt,onStartCreating:Er,onCreateFromTemplate:(e,t)=>Er(`file`,e,{template:t}),onDuplicate:Fn,onImportTemplate:Rn,onDelete:e=>ee({targets:e}),onExpandSubtree:Or,onCollapseSubtree:Ar,folderTreePaths:dn,isAsset:Ce.has(e.path),documents:E}),t[299]=Ni,t[300]=Ce,t[301]=Ar,t[302]=E,t[303]=Or,t[304]=dn,t[305]=Fn,t[306]=Rn,t[307]=Bt,t[308]=nn,t[309]=Vt,t[310]=Er,t[311]=oe,t[312]=Bi):Bi=t[312];let Vi;t[313]!==wi||t[314]!==Si||t[315]!==nn||t[316]!==Ii||t[317]!==Li||t[318]!==zi||t[319]!==Bi?(Vi=(0,Z.jsx)(`div`,{ref:st,className:`flex min-h-0 flex-1 flex-col`,children:(0,Z.jsx)(Aq,{header:Ii,model:nn,style:Li,...zi,onClickCapture:wi,onMouseMove:Si,onMouseLeave:_i,renderContextMenu:Bi})}),t[313]=wi,t[314]=Si,t[315]=nn,t[316]=Ii,t[317]=Li,t[318]=zi,t[319]=Bi,t[320]=Vi):Vi=t[320];let Hi=!!W,Ui;t[321]===H?Ui=t[322]:(Ui=e=>{!e&&!H&&ee(null)},t[321]=H,t[322]=Ui);let Wi;t[323]!==i||t[324]!==H||t[325]!==W||t[326]!==ri||t[327]!==Pi?(Wi=W&&Pi&&(0,Z.jsx)(Ys,{...(()=>{let e=UJ(typeof window<`u`&&window.okDesktop!=null?`electron`:`web`,W.targets);if(e)return{customTitle:e.title,customDescription:``,customDetail:e.detail,customConfirmLabel:e.confirmLabel,customConfirmLabelBusy:e.confirmLabelBusy,children:e.listedTargets?(0,Z.jsx)(`ul`,{className:`flex flex-col gap-1 font-mono text-foreground text-xs`,children:e.listedTargets.map(nX)}):null};let t=W.targets.length,n=Pi.name;return{itemName:t===1?Pi.kind===`folder`?`${Pi.name}/`:Pi.kind===`file`?`${Pi.name}${Pi.docExt??`.md`}`:Pi.name:void 0,customTitle:t>1?i({id:`abiHje`}):void 0,customDescription:t>1?i({id:`WMIKXK`,values:{targetCount:t}}):Pi.kind===`folder`?i({id:`a5W0q0`,values:{folderName:n}}):void 0}})(),isSubmitting:H!==null,onDelete:()=>ri(W.targets)}),t[323]=i,t[324]=H,t[325]=W,t[326]=ri,t[327]=Pi,t[328]=Wi):Wi=t[328];let Gi;t[329]!==Hi||t[330]!==Ui||t[331]!==Wi?(Gi=(0,Z.jsx)(Sn,{open:Hi,onOpenChange:Ui,children:Wi}),t[329]=Hi,t[330]=Ui,t[331]=Wi,t[332]=Gi):Gi=t[332];let Ki=!!G,qi;t[333]===H?qi=t[334]:(qi=e=>{!e&&!H&&K(null)},t[333]=H,t[334]=qi);let Ji;t[335]!==i||t[336]!==H||t[337]!==zn||t[338]!==G?(Ji=G&&(0,Z.jsx)(Ys,{itemName:G.name+(G.kind===`file`?G.docExt??`.md`:`.md`),customTitle:i({id:`hLod4_`}),customDescription:i({id:`RMQe3p`}),customConfirmLabel:i({id:`hvZwVx`}),customConfirmLabelBusy:i({id:`ul1Atu`}),isSubmitting:H!==null,onDelete:()=>zn(G,!0)}),t[335]=i,t[336]=H,t[337]=zn,t[338]=G,t[339]=Ji):Ji=t[339];let Yi;t[340]!==Ki||t[341]!==qi||t[342]!==Ji?(Yi=(0,Z.jsx)(Sn,{open:Ki,onOpenChange:qi,children:Ji}),t[340]=Ki,t[341]=qi,t[342]=Ji,t[343]=Yi):Yi=t[343];let Xi=!!te,Zi;t[344]===H?Zi=t[345]:(Zi=e=>{!e&&!H&&ne(null)},t[344]=H,t[345]=Zi);let Qi;t[346]!==H||t[347]!==ai||t[348]!==si||t[349]!==te?(Qi=te&&(0,Z.jsx)(ZJ,{failedTargets:te.failed,isSubmitting:H!==null,onDeletePermanently:ai,onRetry:si,onCancel:()=>ne(null)}),t[346]=H,t[347]=ai,t[348]=si,t[349]=te,t[350]=Qi):Qi=t[350];let $i;t[351]!==Xi||t[352]!==Zi||t[353]!==Qi?($i=(0,Z.jsx)(Sn,{open:Xi,onOpenChange:Zi,children:Qi}),t[351]=Xi,t[352]=Zi,t[353]=Qi,t[354]=$i):$i=t[354];let ea=ie!==null,ta;t[355]===Symbol.for(`react.memo_cache_sentinel`)?(ta=e=>{e||ae(null)},t[355]=ta):ta=t[355];let na=ie?.parentDir??``,ra;t[356]!==ea||t[357]!==na?(ra=(0,Z.jsx)(h_,{open:ea,onOpenChange:ta,kind:`file`,initialDir:na,defaultToTemplate:!0}),t[356]=ea,t[357]=na,t[358]=ra):ra=t[358];let ia;return t[359]!==Vi||t[360]!==Gi||t[361]!==Yi||t[362]!==$i||t[363]!==ra?(ia=(0,Z.jsxs)(Z.Fragment,{children:[Vi,Gi,Yi,$i,ra]}),t[359]=Vi,t[360]=Gi,t[361]=Yi,t[362]=$i,t[363]=ra,t[364]=ia):ia=t[364],ia}function nX(e){return(0,Z.jsx)(`li`,{"data-testid":`delete-target-row`,children:WJ(e)},`${e.kind}:${e.path}`)}function rX(e){return`${e.kind}:${e.path}`}function iX(e){return`${e.kind}:${e.path}`}function aX(e){return e.path}function oX(e){return e.kind===`folder`}function sX(e){return e.path}function cX(e){return e.kind===`file`}function lX(e){return e.file}function uX(e){return!Vl(e.path)}function dX(e){return re(e)}function fX(e){return ge(e)}function pX(e){return F(e)}function mX(e){return e.path}function hX(e){return e.kind===`asset`}function gX(e){return e.endsWith(`/`)?e.slice(0,-1):e}function _X(e){return!!e}function vX(e){console.warn(`[FileTree] /api/workspace fetch failed:`,e)}function yX(e){console.warn(`[FileTree] unmount cleanup failed:`,e)}function bX(e){X.error(e)}function xX(){}function SX(e){return X.error(e)}function CX(){}function wX(){}function TX(){}function EX(){}function DX(){}async function OX(){}function kX(e){return rf(e)}function AX(e){return jX(e)?.dataset.itemPath??null}function jX(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.dataset.itemPath)return t;return null}function MX(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.matches(`[data-file-tree-virtualized-root]`))return t;return null}function NX(e){let t=jX(e);if(t){let e=t.dataset.itemPath;if(!e)return null;let n=t.dataset.itemType===`folder`,r=of(e,n);return{parentDir:r,row:t,root:null,busyPath:n?mf(r):e}}return PX(e)?{parentDir:``,row:null,root:MX(e),busyPath:HY}:null}function PX(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.matches(`[data-file-tree-virtualized-scroll]`))return!0;return!1}var FX=[`w-3/4`,`w-2/3`,`w-4/5`,`w-1/2`,`w-3/5`,`w-2/3`];function IX(){let e=(0,$.c)(5),{_:t}=vt(),n;e[0]===t?n=e[1]:(n=t({id:`5Tk8Fb`}),e[0]=t,e[1]=n);let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=FX.map(LX),e[2]=r):r=e[2];let i;return e[3]===n?i=e[4]:(i=(0,Z.jsx)(`div`,{className:`flex flex-1 flex-col gap-1 px-2 py-2`,role:`status`,"aria-busy":`true`,"aria-label":n,children:r}),e[3]=n,e[4]=i),i}function LX(e,t){return(0,Z.jsxs)(`div`,{className:`flex h-6 items-center gap-2`,children:[(0,Z.jsx)(Cd,{className:`h-3 w-3 shrink-0 rounded-sm`}),(0,Z.jsx)(Cd,{className:`h-3 ${e}`})]},t)}function RX(e){let t=(0,$.c)(14),{kind:n,children:r}=e,i=n===`error`?sl:n===`reconnecting`?tl:Xc,a=n===`error`?`alert`:`status`,o=n===`error`?`text-destructive`:`text-muted-foreground`,s;t[0]===o?s=t[1]:(s=$t(`mx-2 mb-1 flex items-start gap-1.5 rounded-md bg-muted/50 px-2 py-1.5 text-xs leading-snug`,o),t[0]=o,t[1]=s);let c=n===`reconnecting`&&`animate-spin motion-reduce:animate-none`,l;t[2]===c?l=t[3]:(l=$t(`mt-0.5 size-3.5 shrink-0`,c),t[2]=c,t[3]=l);let u;t[4]!==i||t[5]!==l?(u=(0,Z.jsx)(i,{"aria-hidden":`true`,className:l}),t[4]=i,t[5]=l,t[6]=u):u=t[6];let d;t[7]===r?d=t[8]:(d=(0,Z.jsx)(`span`,{className:`min-w-0`,children:r}),t[7]=r,t[8]=d);let f;return t[9]!==a||t[10]!==s||t[11]!==u||t[12]!==d?(f=(0,Z.jsxs)(`span`,{role:a,className:s,children:[u,d]}),t[9]=a,t[10]=s,t[11]=u,t[12]=d,t[13]=f):f=t[13],f}function zX(e){return e?yl._({id:`wTcjov`}):null}function BX(e){let t=(0,$.c)(46),{_:n}=vt(),r=lc(),i=Vs(),a=Ri(),o=Wi();if(r)return null;let{input:s,installStates:c,dispatch:l}=e,u=s===null,d,f,p,m,h,g,_,v,y,b,x;if(t[0]!==n||t[1]!==l||t[2]!==s||t[3]!==u||t[4]!==c||t[5]!==o||t[6]!==a||t[7]!==i){let e=zX(u),r;t[19]===o?r=t[20]:(r=e=>Zi(o,e.id),t[19]=o,t[20]=r);let S=Ki.filter(r),C;t[21]===o?C=t[22]:(C=e=>qi(o,e.source,e.id,!0,e.supported),t[21]=o,t[22]=C);let w=a.filter(C),T=i?Ba.filter(e=>Yi(o,e,i.installedClis)):[];p=S.length>0,m=i!==null&&T.length>0,h=w.length>0,f=FF,t[23]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsxs)(RF,{children:[(0,Z.jsx)(oc,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`O7_W_a`})]}),t[23]=x):x=t[23],d=zF,g=`max-h-80`,_=h?(0,Z.jsxs)(PF,{"aria-label":n({id:`vPKX2i`}),children:[(0,Z.jsxs)(VF,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(J,{id:`RXEbZy`}),(0,Z.jsx)(Xi,{})]}),w.map(t=>{let r=t.name;return(0,Z.jsxs)(LF,{onSelect:()=>{s!==null&&nc(s,{agent:{source:t.source,id:t.id}})},disabled:u,"data-testid":`empty-space-open-in-thread-${t.id}`,"aria-label":e?n({id:`gtGQ9S`,values:{agentName:r,hint:e}}):void 0,children:[(0,Z.jsx)(fs,{agentId:t.id,iconUrl:t.iconUrl,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(J,{id:`5PrrYw`,values:{agentName:r}})}),e?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},`${t.source}:${t.id}`)})]}):null,t[24]!==p||t[25]!==m||t[26]!==h?(v=h&&(m||p)?(0,Z.jsx)(HF,{}):null,t[24]=p,t[25]=m,t[26]=h,t[27]=v):v=t[27],y=m?(0,Z.jsxs)(PF,{"aria-label":n({id:`ALhMYW`}),children:[(0,Z.jsx)(VF,{children:(0,Z.jsx)(J,{id:`ALhMYW`})}),T.map(t=>{let{displayName:r}=Da[t];return(0,Z.jsxs)(LF,{onSelect:()=>{s!==null&&i.launchInTerminal(s,t)},disabled:u,"data-testid":`empty-space-open-in-terminal-${t}`,"aria-label":n(e?{id:`AIn2Yv`,values:{displayName:r,hint:e}}:{id:`QYfQdv`,values:{displayName:r}}),children:[(0,Z.jsx)(Ji,{id:Vi(t),"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:r}),e?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t)})]}):null,b=p?(0,Z.jsxs)(Z.Fragment,{children:[m?(0,Z.jsx)(HF,{}):null,(0,Z.jsxs)(PF,{"aria-label":n({id:`BBqGS9`}),children:[(0,Z.jsx)(VF,{children:(0,Z.jsx)(J,{id:`BBqGS9`})}),S.map(t=>{let r=!u,{displayName:i}=t,a=n(e?{id:`1ZpfyB`,values:{displayName:i,hint:e}}:{id:`WqLq6M`,values:{displayName:i}});return(0,Z.jsxs)(LF,{disabled:!r,onSelect:()=>{if(s){if(c[t.id]?.installed!==!0){ec(t);return}l(t.id,s)}},"data-testid":`empty-space-open-in-${t.id}`,"aria-label":a,children:[(0,Z.jsx)(Ji,{id:t.id,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:t.displayName}),e?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t.id)})]})]}):null,t[0]=n,t[1]=l,t[2]=s,t[3]=u,t[4]=c,t[5]=o,t[6]=a,t[7]=i,t[8]=d,t[9]=f,t[10]=p,t[11]=m,t[12]=h,t[13]=g,t[14]=_,t[15]=v,t[16]=y,t[17]=b,t[18]=x}else d=t[8],f=t[9],p=t[10],m=t[11],h=t[12],g=t[13],_=t[14],v=t[15],y=t[16],b=t[17],x=t[18];let S;t[28]!==p||t[29]!==m||t[30]!==h?(S=h||m||p?(0,Z.jsx)(HF,{}):null,t[28]=p,t[29]=m,t[30]=h,t[31]=S):S=t[31];let C;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(nl,{"aria-hidden":`true`}),t[32]=C):C=t[32];let w;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsxs)(LF,{onSelect:ea,"data-testid":`empty-space-open-in-settings`,children:[C,(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(J,{id:`jRAGrQ`})})]}),t[33]=w):w=t[33];let T;t[34]!==d||t[35]!==g||t[36]!==_||t[37]!==v||t[38]!==y||t[39]!==b||t[40]!==S?(T=(0,Z.jsxs)(d,{className:g,children:[_,v,y,b,S,w]}),t[34]=d,t[35]=g,t[36]=_,t[37]=v,t[38]=y,t[39]=b,t[40]=S,t[41]=T):T=t[41];let E;return t[42]!==f||t[43]!==x||t[44]!==T?(E=(0,Z.jsxs)(f,{children:[x,T]}),t[42]=f,t[43]=x,t[44]=T,t[45]=E):E=t[45],E}async function VX(e){try{let t=await e.project.listRecent(),n=e.config.projectPath;if(t.some(e=>e.path!==n))return null;let r=await lE();return e.config.freshlyCreated?r:r===0?0:null}catch(e){return console.warn(`[onboarding-card-visible] fresh-project probe failed; suppressing card`,e),null}}function HX(e){let t=(0,$.c)(4),n=e===void 0?aE:e,{initialized:r,dismissed:i,completed:a}=(0,Q.useSyncExternalStore)(n.subscribe,n.getSnapshot,n.getSnapshot),o=i||a,s=!r&&!o,c,l;return t[0]!==s||t[1]!==n?(c=()=>{if(!s)return;let e=window.okDesktop;if(e==null)return;let t=!1;return VX(e).then(e=>{!t&&e!==null&&n.activate(e)}),()=>{t=!0}},l=[s,n],t[0]=s,t[1]=n,t[2]=c,t[3]=l):(c=t[2],l=t[3]),(0,Q.useEffect)(c,l),r&&!o}function UX(e){let t=(0,$.c)(3),n=e===void 0?aE:e,r,i;t[0]===n?(r=t[1],i=t[2]):(r=()=>{if(n.getSnapshot().steps.file)return;let e=ql(e=>{e.includes(`files`)&&uE(n)});return uE(n),e},i=[n],t[0]=n,t[1]=r,t[2]=i),(0,Q.useEffect)(r,i)}var WX=3,GX=5200,KX=1500,qX=220;function JX(e){let t=(0,$.c)(14),{complete:n,label:r,shortcutId:i}=e,a;t[0]===n?a=t[1]:(a=(0,Z.jsx)(nr,{checked:n,disabled:!0,"aria-hidden":!0,tabIndex:-1,className:`pointer-events-none opacity-100 disabled:opacity-100`}),t[0]=n,t[1]=a);let o=n?`flex-1 text-muted-foreground/60`:`flex-1`,s;t[2]===n?s=t[3]:(s=n?(0,Z.jsxs)(`span`,{className:`sr-only`,children:[(0,Z.jsx)(J,{id:`Qj4RL5`}),` `]}):null,t[2]=n,t[3]=s);let c;t[4]!==r||t[5]!==o||t[6]!==s?(c=(0,Z.jsxs)(`span`,{className:o,children:[s,r]}),t[4]=r,t[5]=o,t[6]=s,t[7]=c):c=t[7];let l;t[8]===i?l=t[9]:(l=i?(0,Z.jsx)(Oe,{children:xl(i)}):null,t[8]=i,t[9]=l);let u;return t[10]!==a||t[11]!==c||t[12]!==l?(u=(0,Z.jsxs)(`li`,{className:`flex items-center gap-2 py-0.5 text-sm`,children:[a,c,l]}),t[10]=a,t[11]=c,t[12]=l,t[13]=u):u=t[13],u}function YX(e){let t=(0,$.c)(24),{store:n,lingerMs:r}=e,i=n===void 0?aE:n,a=r===void 0?GX:r,{_:o}=vt(),{steps:s}=oE(i);UX(i);let[c,l]=(0,Q.useState)(0),[u,d]=(0,Q.useState)(!1),f=1+ +!!s.file+ +!!s.askedAi,p=f===WX,m,h;t[0]!==p||t[1]!==a?(m=()=>{if(!p)return;l(ZX);let e=setInterval(()=>l(XX),KX),t=setTimeout(()=>{clearInterval(e),d(!0)},a);return()=>{clearInterval(e),clearTimeout(t)}},h=[p,a],t[0]=p,t[1]=a,t[2]=m,t[3]=h):(m=t[2],h=t[3]),(0,Q.useEffect)(m,h);let g,_;t[4]!==u||t[5]!==i?(g=()=>{if(!u)return;let e=setTimeout(()=>i.markCompleted(),qX);return()=>clearTimeout(e)},_=[u,i],t[4]=u,t[5]=i,t[6]=g,t[7]=_):(g=t[6],_=t[7]),(0,Q.useEffect)(g,_);let v;t[8]!==o||t[9]!==p?(v=p?o({id:`7jIIFX`}):``,t[8]=o,t[9]=p,t[10]=v):v=t[10];let y;t[11]===v?y=t[12]:(y=(0,Z.jsx)(`div`,{className:`sr-only`,role:`status`,"aria-live":`polite`,children:v}),t[11]=v,t[12]=y);let b;t[13]!==p||t[14]!==c||t[15]!==f||t[16]!==u||t[17]!==s.askedAi||t[18]!==s.file||t[19]!==i?(b=p?(0,Z.jsxs)(`section`,{"aria-hidden":!0,className:$t(`mx-2 mb-1 flex items-center gap-3 rounded-lg border bg-card px-4 py-3 text-card-foreground`,`motion-reduce:animate-none motion-reduce:duration-0`,u?`animate-out fade-out-0 zoom-out-95 fill-mode-forwards duration-200`:`animate-in fade-in-0 zoom-in-95 duration-300`),children:[(0,Z.jsx)(mp,{size:36,celebrateSignal:c}),(0,Z.jsx)(`span`,{className:`font-medium text-sm`,children:(0,Z.jsx)(J,{id:`7jIIFX`})})]}):(0,Z.jsxs)(`section`,{"aria-labelledby":`onboarding-card-heading`,className:`mx-2 mb-1 rounded-lg border bg-card px-4 py-3 text-card-foreground`,children:[(0,Z.jsxs)(`header`,{className:`mb-3 flex items-center justify-between`,children:[(0,Z.jsx)(`h2`,{id:`onboarding-card-heading`,className:`font-medium text-sm`,children:(0,Z.jsx)(J,{id:`Y1QMlM`})}),(0,Z.jsx)(`span`,{className:`text-muted-foreground/60 text-xs tabular-nums`,children:`${f} / ${WX}`})]}),(0,Z.jsxs)(`ul`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(JX,{complete:!0,label:(0,Z.jsx)(J,{id:`4E9jPa`})}),(0,Z.jsx)(JX,{complete:s.file,label:(0,Z.jsx)(J,{id:`6ibbCg`}),shortcutId:`new-item`}),(0,Z.jsx)(JX,{complete:s.askedAi,label:(0,Z.jsx)(J,{id:`xWEvuo`}),shortcutId:`open-ask-ai`})]}),(0,Z.jsx)(`footer`,{className:`-mb-1 mt-2 flex justify-end`,children:(0,Z.jsx)(Y,{type:`button`,variant:`ghost`,size:`sm`,className:`h-auto px-2 py-1 text-muted-foreground text-xs`,onClick:()=>i.dismiss(),children:(0,Z.jsx)(J,{id:`1QfxQT`})})})]}),t[13]=p,t[14]=c,t[15]=f,t[16]=u,t[17]=s.askedAi,t[18]=s.file,t[19]=i,t[20]=b):b=t[20];let x;return t[21]!==y||t[22]!==b?(x=(0,Z.jsxs)(Z.Fragment,{children:[y,b]}),t[21]=y,t[22]=b,t[23]=x):x=t[23],x}function XX(e){return e+1}function ZX(e){return e+1}function QX(){let e=(0,$.c)(1);if(!HX())return null;let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(YX,{}),e[0]=t):t=e[0],t}function $X(e){return e===null?null:e.kind===`local`?e.name:e.ref}function eZ(e,t){if(e.length===0)return null;let n=`origin/${e}`;return t.includes(n)?n:t.find(t=>to(t)===e)??null}function tZ(e){switch(e){case`branch-exists`:return{id:`wzq9Rv`};case`already-checked-out`:return{id:`ljHjfg`};case`path-exists`:return{id:`mYzDD_`};case`invalid-branch`:return{id:`r-OJYm`};case`no-git`:return{id:`CFnavk`};case`helper-not-found`:return{id:`HqOPpj`};default:return{id:`-zA2E7`}}}function nZ(e){let t=(0,$.c)(71),{open:n,onOpenChange:r,bridge:i,currentBranch:a,branches:o,existingWorktreeBranches:s,remoteBranches:c,behindByBranch:l,initialBranchName:u}=e,d=o===void 0?[]:o,f=c===void 0?[]:c,p=u===void 0?``:u,{_:m}=vt(),h=(0,Q.useId)(),g=(0,Q.useId)(),_=(0,Q.useId)(),v=(0,Q.useId)(),y=(0,Q.useId)(),b=(0,Q.useId)(),[x,S]=(0,Q.useState)(``),C;t[0]===a?C=t[1]:(C=a===null?null:{kind:`local`,name:a},t[0]=a,t[1]=C);let[w,T]=(0,Q.useState)(C),[E,D]=(0,Q.useState)(!1),[O,k]=(0,Q.useState)(``),[A,j]=(0,Q.useState)(!1),[M,N]=(0,Q.useState)(null),P=(0,Q.useRef)(null),F=(0,Q.useRef)(null),I,L;t[2]!==a||t[3]!==p||t[4]!==n?(I=()=>{if(!n)return;S(p),T(a===null?null:{kind:`local`,name:a}),D(!1),k(``),j(!1),N(null);let e=requestAnimationFrame(()=>P.current?.focus());return()=>cancelAnimationFrame(e)},L=[n,a,p],t[2]=a,t[3]=p,t[4]=n,t[5]=I,t[6]=L):(I=t[5],L=t[6]),(0,Q.useEffect)(I,L);let R=x.trim(),z=!A&&R.length>0,B=R.length>0&&d.includes(R),V=B?null:eZ(R,f),H=V!==null,U=B||H,W=B&&(s?.has(R)??!1),ee=d.filter(e=>e.toLowerCase().startsWith(R.toLowerCase())),G=!A&&ee.length>0&&!U,K=(a!==null&&!d.includes(a)?[a,...d]:d).map(sZ),te=f.map(oZ),ne=$X(w),re=O.trim().toLowerCase(),ie=re===``?K:K.filter(e=>e.name.toLowerCase().includes(re)),ae=re===``?te:te.filter(e=>e.ref.toLowerCase().includes(re)),oe=re!==``&&ie.length===0&&ae.length===0,se=async function(e){if(e.preventDefault(),z){j(!0),N(null);try{let e=H?{branch:R,createBranch:!0,remoteRef:V}:B?{branch:R,createBranch:!1}:{branch:R,createBranch:!0,baseBranch:w?.kind===`local`?w.name:void 0,baseRef:w?.kind===`remote`?w.ref:void 0},t=await i.worktree.create(e);if(!t.ok){N(tZ(t.reason)),j(!1);return}Gu(),r(!1),await i.project.open({path:t.path,target:`new-window`,entryPoint:`worktree`})}catch(e){console.warn(`[NewWorktreeDialog] worktree create/open failed:`,e),X.error(m({id:`vAYoCZ`})),j(!1)}}},ce=Sn,le;t[7]!==A||t[8]!==r?(le=e=>{A||r(e)},t[7]=A,t[8]=r,t[9]=le):le=t[9];let ue=vn,de;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,Z.jsx)(_n,{children:(0,Z.jsx)(J,{id:`DXd9LM`})}),t[10]=de):de=t[10];let fe;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(fe=(0,Z.jsxs)(xn,{children:[de,(0,Z.jsx)(gn,{children:(0,Z.jsx)(J,{id:`NEzPEh`})})]}),t[11]=fe):fe=t[11];let pe=yn,q;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,Z.jsx)(J,{id:`ng2Ibo`}),t[12]=q):q=t[12];let me;t[13]===g?me=t[14]:(me=(0,Z.jsx)(Hr,{htmlFor:g,children:q}),t[13]=g,t[14]=me);let ge;t[15]===m?ge=t[16]:(ge=m({id:`IX_uXB`}),t[15]=m,t[16]=ge);let _e;t[17]===M?_e=t[18]:(_e=e=>{S(e.target.value),M!==null&&N(null)},t[17]=M,t[18]=_e);let ve=M!==null,ye=M===null?y:`${y} ${b}`,be;t[19]!==x||t[20]!==A||t[21]!==g||t[22]!==ge||t[23]!==_e||t[24]!==ve||t[25]!==ye?(be=(0,Z.jsx)(vl,{id:g,ref:P,value:x,placeholder:ge,onChange:_e,disabled:A,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-invalid":ve,"aria-describedby":ye,"data-testid":`new-worktree-branch`}),t[19]=x,t[20]=A,t[21]=g,t[22]=ge,t[23]=_e,t[24]=ve,t[25]=ye,t[26]=be):be=t[26];let xe=R.length>0?(0,Z.jsxs)(`p`,{id:y,className:`flex items-start gap-1.5 text-1sm text-muted-foreground`,"data-testid":W?`new-worktree-mode-existing-worktree`:H?`new-worktree-mode-remote-checkout`:B?`new-worktree-mode-checkout`:`new-worktree-mode-create`,children:[W?(0,Z.jsx)(gc,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-amber-600 dark:text-amber-400`}):H?(0,Z.jsx)(Ei,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-violet-600 dark:text-violet-400`}):B?(0,Z.jsx)(Ds,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-blue-600 dark:text-blue-400`}):(0,Z.jsx)(Kt,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-green-600 dark:text-green-400`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1`,children:W?(0,Z.jsx)(J,{id:`QAi7Q9`,values:{trimmed:R},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-words`})}}):H?(0,Z.jsx)(J,{id:`oAGN8p`,values:{remoteCheckoutRef:V,trimmed:R},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-words`}),1:(0,Z.jsx)(`code`,{className:`font-mono break-words`}),2:(0,Z.jsx)(`code`,{className:`font-mono`})}}):B?(0,Z.jsx)(J,{id:`b4VvP-`,values:{trimmed:R},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-words`}),1:(0,Z.jsx)(`code`,{className:`font-mono`})}}):ne===null?(0,Z.jsx)(J,{id:`t4sFKC`,values:{trimmed:R},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-words`}),1:(0,Z.jsx)(`code`,{className:`font-mono`})}}):(0,Z.jsx)(J,{id:`dGAdpH`,values:{trimmed:R,currentBaseLabel:ne},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-words`}),1:(0,Z.jsx)(`code`,{className:`font-mono break-words`}),2:(0,Z.jsx)(`code`,{className:`font-mono`})}})})]}):null,Se=G?(0,Z.jsx)(`div`,{className:`max-h-40 overflow-y-auto rounded-md border bg-popover p-1 shadow-xs`,"data-testid":`new-worktree-branch-list`,children:ee.map(e=>(0,Z.jsxs)(Y,{type:`button`,variant:`ghost`,size:`sm`,tabIndex:-1,onClick:()=>{S(e),M!==null&&N(null),P.current?.focus()},"data-testid":`new-worktree-branch-option-${e}`,className:`h-8 w-full justify-start gap-2 font-normal`,children:[(0,Z.jsx)(Xo,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left`,children:e})]},e))}):null,Ce=U?null:(0,Z.jsxs)(`div`,{className:`mt-1 flex flex-col gap-2`,children:[(0,Z.jsx)(Hr,{id:v,htmlFor:_,children:(0,Z.jsx)(J,{id:`ZWwYwM`})}),(0,Z.jsxs)(Ut,{open:E,onOpenChange:e=>{D(e),e||k(``)},children:[(0,Z.jsx)(Wt,{asChild:!0,children:(0,Z.jsxs)(Y,{id:_,type:`button`,variant:`outline`,role:`combobox`,"aria-expanded":E,"aria-haspopup":`listbox`,"aria-labelledby":`${v} ${_}`,"aria-label":m({id:`ZWwYwM`}),disabled:A,"data-testid":`new-worktree-base-trigger`,className:`w-full justify-between font-normal`,children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[w?.kind===`remote`?(0,Z.jsx)(Ei,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}):(0,Z.jsx)(Xo,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate text-left`,children:ne===null?(0,Z.jsx)(J,{id:`EbjWsS`}):ne})]}),(0,Z.jsx)(Rm,{"aria-hidden":`true`,className:`ml-2 size-4 shrink-0 opacity-50`})]})}),(0,Z.jsxs)(Yt,{align:`start`,className:`w-[var(--radix-popover-trigger-width)] p-1`,onWheel:aZ,onTouchMove:iZ,onOpenAutoFocus:e=>{e.preventDefault(),F.current?.focus()},children:[(0,Z.jsxs)(Vc,{className:`mb-1 h-8`,children:[(0,Z.jsx)(Nc,{ref:F,"aria-label":m({id:`fuJZKk`}),placeholder:m({id:`hQXiDc`}),value:O,onChange:e=>k(e.target.value),onKeyDown:rZ,"data-testid":`new-worktree-base-search`}),(0,Z.jsx)(Rc,{children:(0,Z.jsx)(he,{"aria-hidden":`true`})})]}),(0,Z.jsxs)(`div`,{role:`listbox`,"aria-label":m({id:`ZWwYwM`}),className:`max-h-56 overflow-y-auto`,"data-testid":`new-worktree-base-list`,children:[oe?(0,Z.jsx)(`p`,{className:`px-2 py-1.5 text-1sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`Sh3Qkg`})}):null,ie.map(e=>{let t=e.name,n=l?.get(t);return(0,Z.jsxs)(Y,{type:`button`,role:`option`,"aria-selected":w?.kind===`local`&&w.name===t,variant:`ghost`,size:`sm`,onClick:()=>{T(e),D(!1),k(``)},"data-testid":`new-worktree-base-option-${t}`,className:`h-8 w-full justify-start gap-2 font-normal`,children:[(0,Z.jsx)(Xo,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left`,children:t}),n!==void 0&&n>0?(0,Z.jsx)(`span`,{className:`shrink-0 text-xs text-amber-600 dark:text-amber-400`,"data-testid":`new-worktree-base-behind-${t}`,children:(0,Z.jsx)(J,{id:`6-wLTJ`,values:{behind:n}})}):null]},`local:${t}`)}),ae.map(e=>{let t=e.ref;return(0,Z.jsxs)(Y,{type:`button`,role:`option`,"aria-selected":w?.kind===`remote`&&w.ref===t,variant:`ghost`,size:`sm`,onClick:()=>{T(e),D(!1),k(``)},"data-testid":`new-worktree-base-option-${t}`,className:`h-8 w-full justify-start gap-2 font-normal`,children:[(0,Z.jsx)(Ei,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left`,children:t}),(0,Z.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:(0,Z.jsx)(J,{id:`dIYSqk`})})]},`remote:${t}`)})]})]})]})]}),we;t[27]!==m||t[28]!==M||t[29]!==b?(we=M===null?null:(0,Z.jsx)(`p`,{id:b,role:`alert`,className:`text-1sm text-destructive`,"data-testid":`new-worktree-error`,children:m(M)}),t[27]=m,t[28]=M,t[29]=b,t[30]=we):we=t[30];let Te;t[31]!==h||t[32]!==se||t[33]!==me||t[34]!==be||t[35]!==xe||t[36]!==Se||t[37]!==Ce||t[38]!==we?(Te=(0,Z.jsxs)(`form`,{id:h,onSubmit:se,className:`flex flex-col gap-2`,children:[me,be,xe,Se,Ce,we]}),t[31]=h,t[32]=se,t[33]=me,t[34]=be,t[35]=xe,t[36]=Se,t[37]=Ce,t[38]=we,t[39]=Te):Te=t[39];let Ee;t[40]!==pe||t[41]!==Te?(Ee=(0,Z.jsx)(pe,{children:Te}),t[40]=pe,t[41]=Te,t[42]=Ee):Ee=t[42];let De;t[43]===r?De=t[44]:(De=()=>r(!1),t[43]=r,t[44]=De);let Oe;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=(0,Z.jsx)(J,{id:`dEgA5A`}),t[45]=Oe):Oe=t[45];let ke;t[46]!==A||t[47]!==De?(ke=(0,Z.jsx)(Y,{type:`button`,variant:`outline`,onClick:De,disabled:A,"data-testid":`new-worktree-cancel`,children:Oe}),t[46]=A,t[47]=De,t[48]=ke):ke=t[48];let Ae=!z,je;t[49]!==A||t[50]!==W||t[51]!==B||t[52]!==H?(je=A?(0,Z.jsx)(J,{id:`b4itZn`}):W?(0,Z.jsx)(J,{id:`XV5sC0`}):H?(0,Z.jsx)(J,{id:`XAyxsa`}):B?(0,Z.jsx)(J,{id:`uGaIIS`}):(0,Z.jsx)(J,{id:`iO8V-7`}),t[49]=A,t[50]=W,t[51]=B,t[52]=H,t[53]=je):je=t[53];let Me;t[54]!==h||t[55]!==Ae||t[56]!==je?(Me=(0,Z.jsx)(Y,{type:`submit`,form:h,disabled:Ae,"data-testid":`new-worktree-create`,children:je}),t[54]=h,t[55]=Ae,t[56]=je,t[57]=Me):Me=t[57];let Ne;t[58]!==ke||t[59]!==Me?(Ne=(0,Z.jsxs)(bn,{children:[ke,Me]}),t[58]=ke,t[59]=Me,t[60]=Ne):Ne=t[60];let Pe;t[61]!==ue||t[62]!==fe||t[63]!==Ee||t[64]!==Ne?(Pe=(0,Z.jsxs)(ue,{className:`sm:max-w-md`,"data-testid":`new-worktree-dialog`,children:[fe,Ee,Ne]}),t[61]=ue,t[62]=fe,t[63]=Ee,t[64]=Ne,t[65]=Pe):Pe=t[65];let Fe;return t[66]!==ce||t[67]!==n||t[68]!==Pe||t[69]!==le?(Fe=(0,Z.jsx)(ce,{open:n,onOpenChange:le,children:Pe}),t[66]=ce,t[67]=n,t[68]=Pe,t[69]=le,t[70]=Fe):Fe=t[70],Fe}function rZ(e){return e.stopPropagation()}function iZ(e){e.stopPropagation()}function aZ(e){e.stopPropagation()}function oZ(e){return{kind:`remote`,ref:e}}function sZ(e){return{kind:`local`,name:e}}function cZ(e){let t=(0,$.c)(51),{bridge:n,recents:r,currentPath:i,query:a,worktreeModel:o,closeMenu:s,guardStaleSelect:c,flyoutPath:l,setFlyoutPath:u,openNewWorktreeWith:d}=e,{_:f}=vt(),p;t[0]!==f||t[1]!==n.project||t[2]!==s?(p=function(e,t){s(),n.project.open({path:e,target:`new-window`,entryPoint:t}).catch(e=>{console.warn(`[RecentProjectsMenu] project.open failed:`,e),X.error(f({id:`6HCOwA`}))})},t[0]=f,t[1]=n.project,t[2]=s,t[3]=p):p=t[3];let m=p,h;t[4]!==f||t[5]!==n.project||t[6]!==n.worktree?(h=async function(e){try{let t=await n.worktree.create({branch:e,createBranch:!1});if(!t.ok){X.error(f({id:`teD0H9`}));return}Gu(),await n.project.open({path:t.path,target:`new-window`,entryPoint:`worktree`})}catch(e){console.warn(`[RecentProjectsMenu] create/open branch failed:`,e),X.error(f({id:`LwMxXg`}))}},t[4]=f,t[5]=n.project,t[6]=n.worktree,t[7]=h):h=t[7];let g=h,_;t[8]!==s||t[9]!==i||t[10]!==m?(_=function(e){if(e.path===i){s();return}m(e.path,e.isLinkedWorktree?`worktree`:`recents`)},t[8]=s,t[9]=i,t[10]=m,t[11]=_):_=t[11];let v=_,y;t[12]!==s||t[13]!==g||t[14]!==i||t[15]!==m?(y=function(e){if(e.path!==null){if(e.path===i){s();return}m(e.path,e.isMain?`recents`:`worktree`);return}e.branch!==null&&(s(),g(e.branch))},t[12]=s,t[13]=g,t[14]=i,t[15]=m,t[16]=y):y=t[16];let b=y;if(a!==``){let e;t[17]!==s||t[18]!==g?(e=e=>{s(),g(e)},t[17]=s,t[18]=g,t[19]=e):e=t[19];let n;return t[20]!==i||t[21]!==c||t[22]!==v||t[23]!==a||t[24]!==r||t[25]!==e||t[26]!==o?(n=(0,Z.jsx)(pZ,{recents:r,currentPath:i,query:a,worktreeModel:o,onPickEntry:v,onPickBranch:e,guardStaleSelect:c}),t[20]=i,t[21]=c,t[22]=v,t[23]=a,t[24]=r,t[25]=e,t[26]=o,t[27]=n):n=t[27],n}let x;if(t[28]!==s||t[29]!==i||t[30]!==l||t[31]!==c||t[32]!==b||t[33]!==d||t[34]!==m||t[35]!==r||t[36]!==u||t[37]!==o){let e=cv(r),n;t[39]!==s||t[40]!==i||t[41]!==l||t[42]!==c||t[43]!==b||t[44]!==d||t[45]!==m||t[46]!==u||t[47]!==o?(n=e=>(0,Z.jsx)(lZ,{group:e,currentPath:i,worktreeModel:o,flyoutOpen:l===e.project.path,setFlyoutOpen:t=>u(n=>t?e.project.path:n===e.project.path?null:n),onPickProject:()=>{if(e.project.path===i){s();return}m(e.project.path,`recents`)},onPickFlyoutEntry:b,guardStaleSelect:c,openNewWorktreeWith:d},e.project.path),t[39]=s,t[40]=i,t[41]=l,t[42]=c,t[43]=b,t[44]=d,t[45]=m,t[46]=u,t[47]=o,t[48]=n):n=t[48],x=e.map(n),t[28]=s,t[29]=i,t[30]=l,t[31]=c,t[32]=b,t[33]=d,t[34]=m,t[35]=r,t[36]=u,t[37]=o,t[38]=x}else x=t[38];let S;return t[49]===x?S=t[50]:(S=(0,Z.jsx)(Z.Fragment,{children:x}),t[49]=x,t[50]=S),S}function lZ(e){let t=(0,$.c)(34),{group:n,currentPath:r,worktreeModel:i,flyoutOpen:a,setFlyoutOpen:o,onPickProject:s,onPickFlyoutEntry:c,guardStaleSelect:l,openNewWorktreeWith:u}=e,d=n.project.path===r,f,p;t[0]!==r||t[1]!==n||t[2]!==i?(f=av(n,i,r),p=f.filter(uZ),t[0]=r,t[1]=n,t[2]=i,t[3]=f,t[4]=p):(f=t[3],p=t[4]);let m=p.length;if(m===0){let e;t[5]!==l||t[6]!==s?(e=e=>{l(e)||s()},t[5]=l,t[6]=s,t[7]=e):e=t[7];let r=`project-switcher-recent-${n.project.path}`,i=d?`true`:void 0,a;t[8]!==n.project.name||t[9]!==n.project.path||t[10]!==d?(a=(0,Z.jsx)(gZ,{name:n.project.name,path:n.project.path,current:d}),t[8]=n.project.name,t[9]=n.project.path,t[10]=d,t[11]=a):a=t[11];let o;return t[12]!==e||t[13]!==r||t[14]!==i||t[15]!==a?(o=(0,Z.jsx)(Ar,{onSelect:e,className:`flex w-full min-w-0 flex-col items-start gap-0.5`,"data-testid":r,"data-current":i,children:a}),t[12]=e,t[13]=r,t[14]=i,t[15]=a,t[16]=o):o=t[16],o}let h;t[17]!==r||t[18]!==n.worktrees||t[19]!==d?(h=d||n.worktrees.some(e=>e.path===r),t[17]=r,t[18]=n.worktrees,t[19]=d,t[20]=h):h=t[20];let g=h,_;return t[21]!==g||t[22]!==r||t[23]!==f||t[24]!==a||t[25]!==n||t[26]!==l||t[27]!==c||t[28]!==s||t[29]!==u||t[30]!==m||t[31]!==o||t[32]!==i?(_=(0,Z.jsx)(dZ,{group:n,currentPath:r,containsCurrent:g,worktreeModel:i,flyoutEntries:f,openedWorktreeCount:m,flyoutOpen:a,setFlyoutOpen:o,onPickProject:s,onPickFlyoutEntry:c,guardStaleSelect:l,openNewWorktreeWith:u}),t[21]=g,t[22]=r,t[23]=f,t[24]=a,t[25]=n,t[26]=l,t[27]=c,t[28]=s,t[29]=u,t[30]=m,t[31]=o,t[32]=i,t[33]=_):_=t[33],_}function uZ(e){return e.opened&&!e.isMain}function dZ(e){let t=(0,$.c)(46),{group:n,currentPath:r,containsCurrent:i,worktreeModel:a,flyoutEntries:o,openedWorktreeCount:s,flyoutOpen:c,setFlyoutOpen:l,onPickProject:u,onPickFlyoutEntry:d,guardStaleSelect:f,openNewWorktreeWith:p}=e,{_:m}=vt(),h=n.project.path===r,g;t[0]!==f||t[1]!==u?(g=e=>{f(e)||u()},t[0]=f,t[1]=u,t[2]=g):g=t[2];let _=g,v,y;t[3]===_?(v=t[4],y=t[5]):(v=e=>{e.target.closest(`[data-project-open]`)!==null&&(e.preventDefault(),_(e.nativeEvent))},y=e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),_(e.nativeEvent))},t[3]=_,t[4]=v,t[5]=y);let b=`project-switcher-group-${n.project.path}`,x=c?`true`:void 0,S=i?`true`:void 0,C;t[6]===n.project.name?C=t[7]:(C=(0,Z.jsx)(`span`,{className:`truncate font-medium text-sm`,"data-project-open":``,title:n.project.name,children:n.project.name}),t[6]=n.project.name,t[7]=C);let w;t[8]===n.project.path?w=t[9]:(w=(0,Z.jsx)(`span`,{className:`truncate text-muted-foreground text-xs`,title:n.project.path,children:n.project.path}),t[8]=n.project.path,t[9]=w);let T;t[10]!==C||t[11]!==w?(T=(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[C,w]}),t[10]=C,t[11]=w,t[12]=T):T=t[12];let E;t[13]!==m||t[14]!==h?(E=h?(0,Z.jsx)(Ds,{"aria-label":m({id:`Hp1l6f`}),className:`mt-0.5 size-3.5 shrink-0 text-muted-foreground`}):null,t[13]=m,t[14]=h,t[15]=E):E=t[15];let D=`project-switcher-toggle-${n.project.path}`,O;t[16]===s?O=t[17]:(O=(0,Z.jsx)(`span`,{className:`tabular-nums`,children:s}),t[16]=s,t[17]=O);let k;t[18]===s?k=t[19]:(k=(0,Z.jsx)(J,{id:`AKxFtn`,values:{openedWorktreeCount:s}}),t[18]=s,t[19]=k);let A;t[20]!==D||t[21]!==O||t[22]!==k?(A=(0,Z.jsxs)(`span`,{className:`mt-0.5 shrink-0 text-muted-foreground text-xs`,"data-testid":D,children:[O,` `,k]}),t[20]=D,t[21]=O,t[22]=k,t[23]=A):A=t[23];let j;t[24]!==E||t[25]!==A||t[26]!==v||t[27]!==y||t[28]!==b||t[29]!==x||t[30]!==S||t[31]!==T?(j=(0,Z.jsxs)(Lr,{onClick:v,onKeyDown:y,className:`flex w-full min-w-0 items-start gap-2`,"data-testid":b,"data-flyout-open":x,"data-current":S,children:[T,E,A]}),t[24]=E,t[25]=A,t[26]=v,t[27]=y,t[28]=b,t[29]=x,t[30]=S,t[31]=T,t[32]=j):j=t[32];let M;t[33]!==o||t[34]!==c||t[35]!==n||t[36]!==f||t[37]!==d||t[38]!==p||t[39]!==a?(M=(0,Z.jsx)(fZ,{group:n,open:c,worktreeModel:a,entries:o,onPickFlyoutEntry:d,guardStaleSelect:f,openNewWorktreeWith:p}),t[33]=o,t[34]=c,t[35]=n,t[36]=f,t[37]=d,t[38]=p,t[39]=a,t[40]=M):M=t[40];let N;return t[41]!==c||t[42]!==l||t[43]!==j||t[44]!==M?(N=(0,Z.jsxs)(jr,{open:c,onOpenChange:l,children:[j,M]}),t[41]=c,t[42]=l,t[43]=j,t[44]=M,t[45]=N):N=t[45],N}function fZ(e){let t=(0,$.c)(15),{group:n,open:r,worktreeModel:i,entries:a,onPickFlyoutEntry:o,guardStaleSelect:s,openNewWorktreeWith:c}=e,{_:l}=vt(),[u,d]=(0,Q.useState)(``),f=(0,Q.useRef)(null),p=(0,Q.useRef)(null),m,h;t[0]===r?(m=t[1],h=t[2]):(m=()=>{r&&f.current?.focus({preventScroll:!0})},h=[r],t[0]=r,t[1]=m,t[2]=h),(0,Q.useEffect)(m,h);let g=function(){let e=p.current;return e===null?[]:[...e.querySelectorAll(`[role="menuitem"]`)]},_=function(e){g()[e]?.focus()},v=function(e,t){if(e.key===`ArrowDown`){e.preventDefault(),e.stopPropagation();let t=g(),n=t.indexOf(e.currentTarget);_(Math.min(n+1,t.length-1))}else if(e.key===`ArrowUp`){e.preventDefault(),e.stopPropagation();let t=g().indexOf(e.currentTarget);t<=0?f.current?.focus():_(t-1)}else e.key===`Enter`&&(e.preventDefault(),e.stopPropagation(),t())},y;if(t[3]!==a||t[4]!==u){let e=u.trim().toLowerCase();y=e===``?a:a.filter(t=>(t.branch??``).toLowerCase().includes(e)),t[3]=a,t[4]=u,t[5]=y}else y=t[5];let b=y,x=i!==null&&i.mainRoot===n.project.mainRoot,S=u.trim(),C=x&&S.length>0,w;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(Rc,{align:`inline-start`,children:(0,Z.jsx)(he,{"aria-hidden":`true`})}),t[6]=w):w=t[6];let T;t[7]===l?T=t[8]:(T=l({id:`bSD4im`}),t[7]=l,t[8]=T);let E;t[9]===l?E=t[10]:(E=l({id:`Skr_7L`}),t[9]=l,t[10]=E);let D;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(D=e=>d(e.target.value),t[11]=D):D=t[11];let O=b.length===0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ir,{className:`font-normal text-muted-foreground text-xs`,role:`status`,"aria-live":`polite`,children:l({id:`-uaQnI`})}),C?(0,Z.jsxs)(Ar,{onSelect:e=>{s(e)||c(S)},onKeyDown:e=>v(e,()=>c(S)),className:`flex items-center gap-2`,"data-testid":`project-switcher-flyout-create`,children:[(0,Z.jsx)(Kt,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm`,title:S,children:(0,Z.jsx)(J,{id:`gHSAWT`,values:{typedName:S},components:{0:(0,Z.jsx)(`span`,{className:`font-medium`}),1:(0,Z.jsx)(`span`,{className:`font-mono`})}})})]}):null]}):b.map(e=>{let t=e.path??`branch:${e.branch}`,n=e.branch??l({id:`D12vtS`});return(0,Z.jsxs)(Ar,{onSelect:t=>{s(t)||o(e)},onKeyDown:t=>v(t,()=>o(e)),className:`flex items-center gap-2`,"data-testid":`project-switcher-flyout-entry-${t}`,"data-current":e.isCurrent?`true`:void 0,children:[(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm`,title:n,children:n}),e.isMain?(0,Z.jsx)(`span`,{className:`shrink-0 text-muted-foreground text-xs`,children:l({id:`Bn9-El`})}):e.opened?null:(0,Z.jsx)(`span`,{className:`shrink-0 text-muted-foreground text-xs`,title:l({id:`Dvwa0U`}),children:l({id:`nfoduq`})}),e.isCurrent?(0,Z.jsx)(_Z,{}):null]},t)}),k;return t[12]!==p||t[13]!==O?(k=(0,Z.jsx)(`div`,{ref:p,className:`min-h-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-contain subtle-scrollbar`,children:O}),t[12]=p,t[13]=O,t[14]=k):k=t[14],(0,Z.jsx)(zr,{children:(0,Z.jsxs)(Mr,{avoidCollisions:!1,sideOffset:-8,className:`flex max-h-80 w-96 flex-col gap-1 overflow-hidden p-1`,"data-testid":`project-switcher-flyout-${n.project.path}`,children:[(0,Z.jsxs)(Vc,{className:`mb-1 h-8 shrink-0`,children:[w,(0,Z.jsx)(Nc,{ref:f,"aria-label":T,placeholder:E,value:u,onChange:D,onKeyDown:e=>{e.key===`ArrowDown`&&(e.preventDefault(),_(0)),e.stopPropagation()},"data-testid":`project-switcher-flyout-search-${n.project.path}`})]}),k]})})}function pZ(e){let t=(0,$.c)(41),{recents:n,currentPath:r,query:i,worktreeModel:a,onPickEntry:o,onPickBranch:s,guardStaleSelect:c}=e,{_:l}=vt(),u;t[0]===i?u=t[1]:(u=e=>e.toLowerCase().includes(i),t[0]=i,t[1]=u);let d=u,f,p,m,h;if(t[2]!==l||t[3]!==r||t[4]!==c||t[5]!==d||t[6]!==s||t[7]!==o||t[8]!==n||t[9]!==a){h=Symbol.for(`react.early_return_sentinel`);bb0:{let e;t[14]===d?e=t[15]:(e=e=>!e.isLinkedWorktree&&(d(e.name)||d(e.path)),t[14]=d,t[15]=e);let i=n.filter(e),u;t[16]===d?u=t[17]:(u=e=>e.isLinkedWorktree===!0&&(d(e.branch??``)||d(e.path)),t[16]=d,t[17]=u);let g=n.filter(u),_=new Set(g.map(mZ)),v;t[18]===a?.entries?v=t[19]:(v=a?.entries??[],t[18]=a?.entries,t[19]=v);let y=v.filter(e=>e.branch!==null&&d(e.branch)&&(e.worktreePath===null||!_.has(e.worktreePath))&&e.worktreePath!==r);if(i.length===0&&g.length===0&&y.length===0){let e;t[20]===l?e=t[21]:(e=l({id:`pEQFsW`}),t[20]=l,t[21]=e);let n;t[22]===e?n=t[23]:(n=(0,Z.jsx)(Ir,{className:`font-normal text-muted-foreground text-xs`,role:`status`,"aria-live":`polite`,children:e}),t[22]=e,t[23]=n),h=n;break bb0}let b;t[24]!==r||t[25]!==c||t[26]!==o?(b=e=>(0,Z.jsx)(Ar,{onSelect:t=>{c(t)||o(e)},className:`flex w-full min-w-0 flex-col items-start gap-0.5`,"data-testid":`project-switcher-recent-${e.path}`,children:(0,Z.jsx)(gZ,{name:e.name,path:e.path,current:e.path===r})},e.path),t[24]=r,t[25]=c,t[26]=o,t[27]=b):b=t[27],f=i.map(b);let x;t[28]!==r||t[29]!==c||t[30]!==o?(x=e=>(0,Z.jsxs)(Ar,{onSelect:t=>{c(t)||o(e)},className:`flex items-start gap-2`,"data-testid":`project-switcher-worktree-${e.path}`,"data-current":e.path===r?`true`:void 0,children:[(0,Z.jsx)(Xo,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0`}),(0,Z.jsx)(hZ,{branch:e.branch??e.name,project:e.mainRoot===void 0?null:sv(e.mainRoot)})]},e.path),t[28]=r,t[29]=c,t[30]=o,t[31]=x):x=t[31],p=g.map(x);let S;t[32]!==l||t[33]!==c||t[34]!==s||t[35]!==a?(S=e=>(0,Z.jsxs)(Ar,{onSelect:t=>{c(t)||e.branch!==null&&s(e.branch)},className:`flex items-start gap-2`,"data-testid":`project-switcher-branch-${e.branch}`,children:[(0,Z.jsx)(Xo,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 opacity-40`}),(0,Z.jsx)(hZ,{branch:e.branch??``,project:a===null?null:sv(a.mainRoot),hint:l({id:`nfoduq`})})]},`branch:${e.branch}`),t[32]=l,t[33]=c,t[34]=s,t[35]=a,t[36]=S):S=t[36],m=y.map(S)}t[2]=l,t[3]=r,t[4]=c,t[5]=d,t[6]=s,t[7]=o,t[8]=n,t[9]=a,t[10]=f,t[11]=p,t[12]=m,t[13]=h}else f=t[10],p=t[11],m=t[12],h=t[13];if(h!==Symbol.for(`react.early_return_sentinel`))return h;let g;return t[37]!==f||t[38]!==p||t[39]!==m?(g=(0,Z.jsxs)(Z.Fragment,{children:[f,p,m]}),t[37]=f,t[38]=p,t[39]=m,t[40]=g):g=t[40],g}function mZ(e){return e.path}function hZ(e){let t=(0,$.c)(12),{branch:n,project:r,hint:i}=e,a;t[0]===n?a=t[1]:(a=(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm`,children:n}),t[0]=n,t[1]=a);let o;t[2]===i?o=t[3]:(o=i===void 0?null:(0,Z.jsx)(`span`,{className:`shrink-0 text-muted-foreground text-xs`,children:i}),t[2]=i,t[3]=o);let s;t[4]!==a||t[5]!==o?(s=(0,Z.jsxs)(`span`,{className:`flex w-full min-w-0 items-center gap-1.5`,children:[a,o]}),t[4]=a,t[5]=o,t[6]=s):s=t[6];let c;t[7]===r?c=t[8]:(c=r===null?null:(0,Z.jsx)(`span`,{className:`truncate text-muted-foreground text-xs`,title:r,children:r}),t[7]=r,t[8]=c);let l;return t[9]!==s||t[10]!==c?(l=(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[s,c]}),t[9]=s,t[10]=c,t[11]=l):l=t[11],l}function gZ(e){let t=(0,$.c)(15),{name:n,path:r,current:i}=e,a=i&&`font-medium`,o;t[0]===a?o=t[1]:(o=$t(`flex w-full items-center gap-1.5`,a),t[0]=a,t[1]=o);let s;t[2]===n?s=t[3]:(s=(0,Z.jsx)(`span`,{className:`truncate font-medium text-sm`,title:n,children:n}),t[2]=n,t[3]=s);let c;t[4]===i?c=t[5]:(c=i?(0,Z.jsx)(Ds,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}):null,t[4]=i,t[5]=c);let l;t[6]!==o||t[7]!==s||t[8]!==c?(l=(0,Z.jsxs)(`span`,{className:o,children:[s,c]}),t[6]=o,t[7]=s,t[8]=c,t[9]=l):l=t[9];let u;t[10]===r?u=t[11]:(u=(0,Z.jsx)(`span`,{className:`w-full truncate text-muted-foreground text-xs`,title:r,children:r}),t[10]=r,t[11]=u);let d;return t[12]!==l||t[13]!==u?(d=(0,Z.jsxs)(`span`,{className:`flex w-full min-w-0 flex-col gap-0.5`,children:[l,u]}),t[12]=l,t[13]=u,t[14]=d):d=t[14],d}function _Z(){let e=(0,$.c)(4),{_:t}=vt(),n;e[0]===t?n=e[1]:(n=t({id:`Hp1l6f`}),e[0]=t,e[1]=n);let r;return e[2]===n?r=e[3]:(r=(0,Z.jsx)(Ds,{"aria-label":n,className:`size-3.5 shrink-0 text-muted-foreground`}),e[2]=n,e[3]=r),r}var vZ=(e,t,n)=>$_(e,t,n,`ProjectSwitcher`),yZ=350;function bZ(e){let t=(0,$.c)(117),{bridge:n}=e,{_:r}=vt(),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(``),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(``),[g,_]=(0,Q.useState)(null),v=HN(),y=X_(),b=typeof window<`u`&&window.okDesktop!=null,x=(0,Q.useRef)(!1),S=(0,Q.useRef)(!1),C=(0,Q.useRef)(null),w;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(w=e=>{e&&(S.current=!0,C.current!==null&&clearTimeout(C.current),C.current=setTimeout(()=>{S.current=!1},yZ)),s(e),e||(l(``),_(null))},t[0]=w):w=t[0];let T=w,E;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(E=e=>!b||!S.current?!1:(e.preventDefault(),!0),t[1]=E):E=t[1];let D=E,O;t[2]!==r||t[3]!==n.project||t[4]!==o?(O=()=>{if(!o)return;let e=!1;return vZ(async()=>{let t=await n.project.listRecent();e||a(t)},r({id:`fYKgzG`})),()=>{e=!0}},t[2]=r,t[3]=n.project,t[4]=o,t[5]=O):O=t[5];let k;t[6]!==r||t[7]!==n||t[8]!==o?(k=[o,n,r],t[6]=r,t[7]=n,t[8]=o,t[9]=k):k=t[9],(0,Q.useEffect)(O,k);let A,j;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(A=()=>Gt(e=>{e===`new-worktree`?(s(!1),_(null),h(``),p(!0)):e===`switch-worktree`&&s(!0)}),j=[],t[10]=A,t[11]=j):(A=t[10],j=t[11]),(0,Q.useEffect)(A,j);let M;t[12]!==r||t[13]!==n.dialog||t[14]!==n.project?(M=()=>{T(!1),vZ(async()=>{let e=await n.dialog.openFolder();e&&await n.project.open({path:e,target:`new-window`,entryPoint:`pick-existing`})},r({id:`gmJ0An`}))},t[12]=r,t[13]=n.dialog,t[14]=n.project,t[15]=M):M=t[15];let N=M,P;t[16]!==r||t[17]!==n.project?(P=()=>{T(!1),vZ(()=>n.project.openFile(),r({id:`8vCZcs`}))},t[16]=r,t[17]=n.project,t[18]=P):P=t[18];let F=P,I;t[19]!==r||t[20]!==n.navigator?(I=()=>{T(!1),vZ(()=>n.navigator.open(),r({id:`jol95m`}))},t[19]=r,t[20]=n.navigator,t[21]=I):I=t[21];let L=I,R;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(R=()=>{T(!1),d(!0)},t[22]=R):R=t[22];let z=R,B;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(B=e=>{T(!1),h(e),p(!0)},t[23]=B):B=t[23];let V=B,H=n.config.projectPath,U;t[24]===c?U=t[25]:(U=c.trim().toLowerCase(),t[24]=c,t[25]=U);let W=U,ee=W!==``,G;t[26]===i?G=t[27]:(G=i??[],t[26]=i,t[27]=G);let K=G,te;t[28]!==ee||t[29]!==K?(te=ee?K.filter(OZ):K,t[28]=ee,t[29]=K,t[30]=te):te=t[30];let ne=te,re=ee?null:y,ie=v!==null&&`h-auto py-1.5`,ae;t[31]===ie?ae=t[32]:(ae=$t(`justify-between text-sidebar-foreground/70 hover:text-sidebar-foreground! data-open:hover:text-sidebar-foreground!`,ie),t[31]=ie,t[32]=ae);let oe;t[33]===r?oe=t[34]:(oe=r({id:`zZ_I5K`}),t[33]=r,t[34]=oe);let se;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(se=b?()=>{x.current=!0}:void 0,t[35]=se):se=t[35];let ce;t[36]===o?ce=t[37]:(ce=b?()=>{if(x.current){x.current=!1;return}T(!o)}:void 0,t[36]=o,t[37]=ce);let le;t[38]===n.config.projectName?le=t[39]:(le=(0,Z.jsx)(`span`,{className:`truncate`,children:n.config.projectName}),t[38]=n.config.projectName,t[39]=le);let ue;t[40]===v?ue=t[41]:(ue=v===null?null:(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1 text-xs text-sidebar-foreground/50 group-hover/menu-button:text-sidebar-foreground`,"data-testid":`project-switcher-branch`,children:[(0,Z.jsx)(Xo,{"aria-hidden":`true`,className:`size-3! shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:v})]}),t[40]=v,t[41]=ue);let de;t[42]!==le||t[43]!==ue?(de=(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[le,ue]}),t[42]=le,t[43]=ue,t[44]=de):de=t[44];let pe;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(pe=(0,Z.jsx)(Rm,{"aria-hidden":`true`,className:`opacity-60`}),t[45]=pe):pe=t[45];let q;t[46]!==n.config.projectPath||t[47]!==ae||t[48]!==oe||t[49]!==ce||t[50]!==de?(q=(0,Z.jsx)(Pr,{asChild:!0,children:(0,Z.jsxs)(MN,{className:ae,"data-testid":`project-switcher-trigger`,"aria-label":oe,title:n.config.projectPath,onPointerDown:se,onClick:ce,children:[de,pe]})}),t[46]=n.config.projectPath,t[47]=ae,t[48]=oe,t[49]=ce,t[50]=de,t[51]=q):q=t[51];let me;t[52]!==r||t[53]!==n||t[54]!==H||t[55]!==g||t[56]!==ne||t[57]!==re||t[58]!==W||t[59]!==i||t[60]!==c?(me=i===null?null:i.length===0?(0,Z.jsx)(Ir,{className:`font-normal text-muted-foreground text-xs`,children:(0,Z.jsx)(J,{id:`MUrVEo`})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Vc,{className:`mb-1 h-8 border-0 shadow-none has-[[data-slot=input-group-control]:focus-visible]:ring-0`,children:[(0,Z.jsx)(Nc,{"aria-label":r({id:`blFttG`}),placeholder:r({id:`RVZJWQ`}),value:c,onChange:e=>{e.target.value!==``&&_(null),l(e.target.value)},onKeyDown:DZ,"data-testid":`project-switcher-search`}),(0,Z.jsx)(Rc,{children:(0,Z.jsx)(he,{"aria-hidden":`true`})})]}),(0,Z.jsx)(Vr,{}),(0,Z.jsx)(`div`,{className:`max-h-64 overflow-x-hidden overflow-y-auto overscroll-contain subtle-scrollbar scroll-fade-mask`,"data-testid":`project-switcher-scroll`,onScroll:()=>{g!==null&&_(null)},children:(0,Z.jsx)(cZ,{bridge:n,recents:ne,currentPath:H,query:W,worktreeModel:re,closeMenu:()=>T(!1),guardStaleSelect:D,flyoutPath:g,setFlyoutPath:_,openNewWorktreeWith:V})})]}),t[52]=r,t[53]=n,t[54]=H,t[55]=g,t[56]=ne,t[57]=re,t[58]=W,t[59]=i,t[60]=c,t[61]=me):me=t[61];let ge;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,Z.jsx)(Vr,{}),t[62]=ge):ge=t[62];let _e;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(_e=e=>{D(e)||z()},t[63]=_e):_e=t[63];let ve;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(ve=(0,Z.jsxs)(Ar,{onSelect:_e,"data-testid":`project-switcher-new-project`,children:[(0,Z.jsx)(Kt,{"aria-hidden":`true`,className:`text-muted-foreground`}),(0,Z.jsx)(J,{id:`gKi-a_`})]}),t[64]=ve):ve=t[64];let ye;t[65]===L?ye=t[66]:(ye=e=>{D(e)||L()},t[65]=L,t[66]=ye);let be,xe;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(be=(0,Z.jsx)(fe,{"aria-hidden":`true`,className:`text-muted-foreground`}),xe=(0,Z.jsx)(J,{id:`xaDWAI`}),t[67]=be,t[68]=xe):(be=t[67],xe=t[68]);let Se;t[69]===ye?Se=t[70]:(Se=(0,Z.jsxs)(Ar,{onSelect:ye,"data-testid":`project-switcher-switch-project`,children:[be,xe]}),t[69]=ye,t[70]=Se);let Ce;t[71]===N?Ce=t[72]:(Ce=e=>{D(e)||N()},t[71]=N,t[72]=Ce);let we,Te;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(we=(0,Z.jsx)(gc,{"aria-hidden":`true`,className:`text-muted-foreground`}),Te=(0,Z.jsx)(J,{id:`PVUn_c`}),t[73]=we,t[74]=Te):(we=t[73],Te=t[74]);let Ee;t[75]===Ce?Ee=t[76]:(Ee=(0,Z.jsxs)(Ar,{onSelect:Ce,"data-testid":`project-switcher-open-folder`,children:[we,Te]}),t[75]=Ce,t[76]=Ee);let De;t[77]===F?De=t[78]:(De=e=>{D(e)||F()},t[77]=F,t[78]=De);let Oe,ke;t[79]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=(0,Z.jsx)(qn,{"aria-hidden":`true`,className:`text-muted-foreground`}),ke=(0,Z.jsx)(J,{id:`9npOH9`}),t[79]=Oe,t[80]=ke):(Oe=t[79],ke=t[80]);let Ae;t[81]===De?Ae=t[82]:(Ae=(0,Z.jsxs)(Ar,{onSelect:De,"data-testid":`project-switcher-open-file`,children:[Oe,ke]}),t[81]=De,t[82]=Ae);let je;t[83]===v?je=t[84]:(je=v===null?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Vr,{}),(0,Z.jsxs)(Ar,{onSelect:e=>{D(e)||(T(!1),h(``),p(!0))},"data-testid":`project-switcher-new-worktree`,children:[(0,Z.jsx)(Xo,{"aria-hidden":`true`,className:`text-muted-foreground`}),(0,Z.jsx)(J,{id:`DXd9LM`})]})]}),t[83]=v,t[84]=je);let Me;t[85]!==me||t[86]!==Se||t[87]!==Ee||t[88]!==Ae||t[89]!==je?(Me=(0,Z.jsxs)(Rr,{align:`start`,side:`top`,className:`min-w-[260px]`,"data-testid":`project-switcher-menu`,children:[me,ge,ve,Se,Ee,Ae,je]}),t[85]=me,t[86]=Se,t[87]=Ee,t[88]=Ae,t[89]=je,t[90]=Me):Me=t[90];let Ne;t[91]!==o||t[92]!==q||t[93]!==Me?(Ne=(0,Z.jsxs)(Br,{open:o,onOpenChange:T,modal:!1,children:[q,Me]}),t[91]=o,t[92]=q,t[93]=Me,t[94]=Ne):Ne=t[94];let Pe;t[95]!==n||t[96]!==u?(Pe=(0,Z.jsx)($h,{open:u,onOpenChange:d,bridge:n}),t[95]=n,t[96]=u,t[97]=Pe):Pe=t[97];let Fe;t[98]===y?.entries?Fe=t[99]:(Fe=y?.entries.map(EZ).filter(TZ),t[98]=y?.entries,t[99]=Fe);let Ie;t[100]===y?.entries?Ie=t[101]:(Ie=new Set(y?.entries.filter(wZ).map(CZ)),t[100]=y?.entries,t[101]=Ie);let Le=y?.remoteBranches,Re;t[102]===y?.entries?Re=t[103]:(Re=new Map(y?.entries.filter(SZ).map(xZ)),t[102]=y?.entries,t[103]=Re);let ze;t[104]!==v||t[105]!==n||t[106]!==m||t[107]!==f||t[108]!==Fe||t[109]!==Ie||t[110]!==Le||t[111]!==Re?(ze=(0,Z.jsx)(nZ,{open:f,onOpenChange:p,bridge:n,currentBranch:v,initialBranchName:m,branches:Fe,existingWorktreeBranches:Ie,remoteBranches:Le,behindByBranch:Re}),t[104]=v,t[105]=n,t[106]=m,t[107]=f,t[108]=Fe,t[109]=Ie,t[110]=Le,t[111]=Re,t[112]=ze):ze=t[112];let Be;return t[113]!==Ne||t[114]!==Pe||t[115]!==ze?(Be=(0,Z.jsxs)(Z.Fragment,{children:[Ne,Pe,ze]}),t[113]=Ne,t[114]=Pe,t[115]=ze,t[116]=Be):Be=t[116],Be}function xZ(e){return[e.branch,e.behind]}function SZ(e){return e.branch!==null&&e.behind!==void 0}function CZ(e){return e.branch}function wZ(e){return e.branch!==null&&e.worktreePath!==null}function TZ(e){return e!==null}function EZ(e){return e.branch}function DZ(e){return e.stopPropagation()}function OZ(e){return!e.isLinkedWorktree}function kZ(e,t){let n=e instanceof Error?e:Error(String(e));console.warn(JSON.stringify({event:`jsx-render-failure`,component:`sidebarSearchPill`,rawComponentName:`sidebarSearchPill`,error:String(n),stack:t.componentStack})),Oo(`sidebarSearchPill`)}function AZ(e){let t=(0,$.c)(8),{onClick:n,className:r}=e,i;t[0]===r?i=t[1]:(i=$t(`rounded-lg h-9 w-full justify-start gap-2 px-3 font-normal text-muted-foreground`,r),t[0]=r,t[1]=i);let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(he,{"aria-hidden":`true`}),t[2]=a):a=t[2];let o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(`span`,{className:`flex-1 text-left text-sm`,children:(0,Z.jsx)(J,{id:`A1taO8`})}),t[3]=o):o=t[3];let s;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(Oe,{className:`text-foreground/70`,children:xl(`command-palette`)}),t[4]=s):s=t[4];let c;return t[5]!==n||t[6]!==i?(c=(0,Z.jsxs)(Y,{variant:`outline`,onClick:n,"data-telemetry-event":`ok.sidebar.search_pill.click`,className:i,children:[a,o,s]}),t[5]=n,t[6]=i,t[7]=c):c=t[7],c}function jZ(){let e=(0,$.c)(36),{_:t}=vt(),n=Gs(),{activeDocName:r}=Re(),[i,a]=(0,Q.useState)(!1),o=Zs(),s;e[0]!==n.data||e[1]!==n.status?(s=n.status===`ready`?n.data:[],e[0]=n.data,e[1]=n.status,e[2]=s):s=e[2];let c=s,l;e[3]===c?l=e[4]:(l=cc(c),e[3]=c,e[4]=l);let u=l,d=uc(),f;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(f={},e[5]=f):f=e[5];let[p,m]=(0,Q.useState)(f),h;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(EN,{asChild:!0,children:(0,Z.jsxs)(mn,{className:`flex w-full items-center gap-1.5`,children:[(0,Z.jsx)(rh,{className:`size-3.5 shrink-0`}),(0,Z.jsx)(J,{id:`PCSkw2`}),(0,Z.jsx)(As,{className:`size-3.5 shrink-0 text-muted-foreground transition-transform group-data-[state=open]/skills:rotate-90`})]})}),e[6]=h):h=e[6];let g;e[7]===t?g=e[8]:(g=t({id:`MdpSC1`}),e[7]=t,e[8]=g);let _,v;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(_=()=>a(!0),v=(0,Z.jsx)(Kt,{}),e[9]=_,e[10]=v):(_=e[9],v=e[10]);let y;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`MdpSC1`})}),e[11]=y):y=e[11];let b;e[12]===g?b=e[13]:(b=(0,Z.jsxs)(DN,{title:g,onClick:_,children:[v,y]}),e[12]=g,e[13]=b);let x;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(VZ,{}),e[14]=x):x=e[14];let S;e[15]===c?S=e[16]:(S=c.some(NZ),e[15]=c,e[16]=S);let C;e[17]===S?C=e[18]:(C=(0,Z.jsx)(zZ,{hasProjectSkills:S}),e[17]=S,e[18]=C);let w;e[19]!==o||e[20]!==r||e[21]!==u||e[22]!==p||e[23]!==d||e[24]!==c?(w=c.length===0?(0,Z.jsx)(`p`,{className:`px-2 py-1 text-xs text-muted-foreground`,children:(0,Z.jsx)(J,{id:`PdJZ5p`})}):ac.filter(e=>c.some(t=>t.scope===e)).map(e=>(0,Z.jsxs)(hn,{className:`group/scope`,open:c.some(t=>t.scope===e&&No(t.scope,t.name)===r)||(p[e]??!1),onOpenChange:t=>m(n=>({...n,[e]:t})),children:[(0,Z.jsxs)(mn,{className:`flex w-full items-center gap-1 px-2 pt-1 pb-0.5 text-[11px] text-muted-foreground/70 hover:text-muted-foreground`,children:[(0,Z.jsx)(As,{className:`size-3 shrink-0 transition-transform group-data-[state=open]/scope:rotate-90`}),(0,Z.jsx)(`span`,{className:`truncate`,children:d[e]})]}),(0,Z.jsx)(pn,{children:(0,Z.jsx)(kN,{className:`pl-2`,children:c.filter(t=>t.scope===e).map(e=>(0,Z.jsx)(PZ,{skill:e,activeDocName:r,actions:o,existingNames:u[e.scope]},`${e.scope}::${e.name}`))})})]},e)),e[19]=o,e[20]=r,e[21]=u,e[22]=p,e[23]=d,e[24]=c,e[25]=w):w=e[25];let T;e[26]!==C||e[27]!==w?(T=(0,Z.jsx)(pn,{children:(0,Z.jsxs)(ON,{children:[x,C,w]})}),e[26]=C,e[27]=w,e[28]=T):T=e[28];let E;e[29]===i?E=e[30]:(E=(0,Z.jsx)(bi,{defaultScope:`project`,open:i,onOpenChange:a,onCreated:MZ}),e[29]=i,e[30]=E);let D;return e[31]!==o.dialogs||e[32]!==T||e[33]!==E||e[34]!==b?(D=(0,Z.jsx)(hn,{className:`group/skills shrink-0`,children:(0,Z.jsxs)(TN,{className:`px-0`,children:[h,b,T,o.dialogs,E]})}),e[31]=o.dialogs,e[32]=T,e[33]=E,e[34]=b,e[35]=D):D=e[35],D}function MZ(e){let{scope:t,name:n}=e;return yc(No(t,n))}function NZ(e){return e.scope===`project`&&!e.managed}function PZ(e){let t=(0,$.c)(52),{skill:n,activeDocName:r,actions:i,existingNames:a}=e,{_:o}=vt(),[s,c]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)(!1),d;t[0]!==n.name||t[1]!==n.scope?(d=No(n.scope,n.name),t[0]=n.name,t[1]=n.scope,t[2]=d):d=t[2];let f=r===d,p,m,h;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=e=>{e.preventDefault(),u(!0)},m=(0,Z.jsx)(As,{className:`size-3 shrink-0 text-muted-foreground transition-transform group-data-[state=open]/skill:rotate-90`}),h=(0,Z.jsx)(rh,{className:`size-3 shrink-0 text-muted-foreground`}),t[3]=p,t[4]=m,t[5]=h):(p=t[3],m=t[4],h=t[5]);let g=n.name,_;t[6]===n.name?_=t[7]:(_=rc(n.name),t[6]=n.name,t[7]=_);let v;t[8]!==n.name||t[9]!==_?(v=(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:g,children:_}),t[8]=n.name,t[9]=_,t[10]=v):v=t[10];let y;t[11]!==o||t[12]!==n.bundledVersion||t[13]!==n.updateAvailable?(y=n.updateAvailable?(0,Z.jsx)(`span`,{title:o({id:`1YJ4Yg`,values:{0:n.bundledVersion?` (${n.bundledVersion})`:``}}),className:`flex items-center`,children:(0,Z.jsx)(tl,{className:`size-3 text-primary`,"aria-label":o({id:`CifUuG`})})}):null,t[11]=o,t[12]=n.bundledVersion,t[13]=n.updateAvailable,t[14]=y):y=t[14];let b;t[15]!==o||t[16]!==n.installed||t[17]!==n.managed?(b=n.managed?(0,Z.jsx)(`span`,{title:o({id:`U7HJ4y`}),className:`flex items-center`,children:(0,Z.jsx)(Ls,{className:`size-3 text-muted-foreground`,"aria-label":o({id:`U7HJ4y`})})}):(0,Z.jsx)(_i,{installed:n.installed,subtle:!0,className:`shrink-0`}),t[15]=o,t[16]=n.installed,t[17]=n.managed,t[18]=b):b=t[18];let x;t[19]!==y||t[20]!==b?(x=(0,Z.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1`,children:[y,b]}),t[19]=y,t[20]=b,t[21]=x):x=t[21];let S;t[22]!==f||t[23]!==x||t[24]!==v?(S=(0,Z.jsx)(mn,{asChild:!0,children:(0,Z.jsxs)(MN,{size:`sm`,isActive:f,className:`h-6 text-[11px]`,onContextMenu:p,children:[m,h,v,x]})}),t[22]=f,t[23]=x,t[24]=v,t[25]=S):S=t[25];let C;t[26]!==o||t[27]!==n.name?(C=o({id:`RlLl3G`,values:{0:n.name}}),t[26]=o,t[27]=n.name,t[28]=C):C=t[28];let w;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(Wm,{}),t[29]=w):w=t[29];let T;t[30]===C?T=t[31]:(T=(0,Z.jsx)(Pr,{asChild:!0,children:(0,Z.jsx)(NN,{showOnHover:!0,"aria-label":C,children:w})}),t[30]=C,t[31]=T);let E;t[32]!==i||t[33]!==a||t[34]!==n?(E=(0,Z.jsx)(Rr,{side:`right`,align:`start`,className:`min-w-52`,children:(0,Z.jsx)(Js,{skill:n,actions:i,existingNames:a})}),t[32]=i,t[33]=a,t[34]=n,t[35]=E):E=t[35];let D;t[36]!==l||t[37]!==T||t[38]!==E?(D=(0,Z.jsxs)(Br,{open:l,onOpenChange:u,children:[T,E]}),t[36]=l,t[37]=T,t[38]=E,t[39]=D):D=t[39];let O;t[40]!==s||t[41]!==n?(O=s?(0,Z.jsx)(LZ,{skill:n}):null,t[40]=s,t[41]=n,t[42]=O):O=t[42];let k;t[43]===O?k=t[44]:(k=(0,Z.jsx)(pn,{children:O}),t[43]=O,t[44]=k);let A;t[45]!==S||t[46]!==D||t[47]!==k?(A=(0,Z.jsxs)(AN,{children:[S,D,k]}),t[45]=S,t[46]=D,t[47]=k,t[48]=A):A=t[48];let j;return t[49]!==s||t[50]!==A?(j=(0,Z.jsx)(hn,{open:s,onOpenChange:c,className:`group/skill`,children:A}),t[49]=s,t[50]=A,t[51]=j):j=t[51],j}function FZ(e){let t=[];for(let n of e){let e=n.path.split(`/`),r=t;e.forEach((t,i)=>{let a=i===e.length-1,o=r.find(e=>e.name===t);o||(o=a?{name:t,path:n.path,text:n.text}:{name:t,path:e.slice(0,i+1).join(`/`),children:[]},r.push(o)),!a&&o.children&&(r=o.children)})}return IZ(t),t}function IZ(e){e.sort((e,t)=>{let n=+!e.children,r=+!t.children;return n===r?e.name.localeCompare(t.name):n-r});for(let t of e)t.children&&IZ(t.children)}function LZ(e){let t=(0,$.c)(36),{skill:n}=e,{_:r}=vt(),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(!1),{openTarget:c}=Re(),l;t[0]===c?l=t[1]:(l=function(e){c({kind:`doc`,target:e,docName:e},{tabBehavior:`append`}),nu(lu(e))},t[0]=c,t[1]=l);let u=l,d;t[2]!==c||t[3]!==n.name||t[4]!==n.scope?(d=function(e){c({kind:`skill-file`,target:`${n.scope}/${n.name}/${e}`,scope:n.scope,name:n.name,path:e},{tabBehavior:`replace-active`}),nu(au({scope:n.scope,name:n.name,path:e}))},t[2]=c,t[3]=n.name,t[4]=n.scope,t[5]=d):d=t[5];let f=d,p;t[6]!==u||t[7]!==f||t[8]!==n.managed||t[9]!==n.name||t[10]!==n.scope?(p=function(e){if(n.managed){f(e);return}let t=e.lastIndexOf(`.`),r=t>=0?e.slice(t+1).toLowerCase():``;if(n.scope===`project`&&(r===`md`||r===`mdx`)){u(Ue(n.name,e.replace(/\.mdx?$/i,``)));return}f(e)},t[6]=u,t[7]=f,t[8]=n.managed,t[9]=n.name,t[10]=n.scope,t[11]=p):p=t[11];let m=p,h,g;t[12]!==n.name||t[13]!==n.scope?(h=()=>{let e=!0,t=()=>{Gd(n.scope,n.name).then(t=>{e&&(t.ok?(a(t.files),s(!1)):(a([]),s(!0)))})};t();let r=Yl(t);return()=>{e=!1,r()}},g=[n.scope,n.name],t[12]=n.name,t[13]=n.scope,t[14]=h,t[15]=g):(h=t[14],g=t[15]),(0,Q.useEffect)(h,g);let _;if(t[16]!==r||t[17]!==i||t[18]!==o||t[19]!==m||t[20]!==u||t[21]!==f||t[22]!==n.managed||t[23]!==n.name||t[24]!==n.scope){let e=i?FZ(i):[],a;t[26]!==u||t[27]!==f||t[28]!==n.managed||t[29]!==n.name||t[30]!==n.scope?(a=()=>n.managed?f(`SKILL.md`):n.scope===`project`?u(za(n.name)):yc(No(n.scope,n.name)),t[26]=u,t[27]=f,t[28]=n.managed,t[29]=n.name,t[30]=n.scope,t[31]=a):a=t[31];let s,c;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(qn,{className:`size-3 shrink-0 text-muted-foreground`}),c=(0,Z.jsx)(`span`,{className:`truncate`,children:`SKILL.md`}),t[32]=s,t[33]=c):(s=t[32],c=t[33]);let l;t[34]===a?l=t[35]:(l=(0,Z.jsx)(FN,{children:(0,Z.jsxs)(IN,{size:`sm`,onClick:a,className:`text-[11px]`,children:[s,c]})}),t[34]=a,t[35]=l),_=(0,Z.jsxs)(PN,{className:`mr-0 pr-0`,children:[l,i===null?(0,Z.jsx)(FN,{children:(0,Z.jsx)(`span`,{className:`px-2 py-0.5 text-[11px] text-muted-foreground/70`,children:(0,Z.jsx)(J,{id:`yQE2r9`})})}):o?(0,Z.jsx)(FN,{children:(0,Z.jsx)(`span`,{className:`px-2 py-0.5 text-[11px] text-muted-foreground/70`,title:r({id:`3Ijjy1`}),children:(0,Z.jsx)(J,{id:`ZARuZJ`})})}):e.map(e=>(0,Z.jsx)(RZ,{node:e,depth:0,onOpenFile:m},e.path))]}),t[16]=r,t[17]=i,t[18]=o,t[19]=m,t[20]=u,t[21]=f,t[22]=n.managed,t[23]=n.name,t[24]=n.scope,t[25]=_}else _=t[25];return _}function RZ(e){let t=(0,$.c)(34),{node:n,depth:r,onOpenFile:i}=e,[a,o]=(0,Q.useState)(!1),s=`${r*.6}rem`,c;t[0]===s?c=t[1]:(c={paddingLeft:s},t[0]=s,t[1]=c);let l=c;if(n.children){let e;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(As,{className:`size-3 shrink-0 text-muted-foreground transition-transform group-data-[state=open]/dir:rotate-90`}),t[2]=e):e=t[2];let s;t[3]===n.name?s=t[4]:(s=(0,Z.jsxs)(`span`,{className:`truncate`,children:[n.name,`/`]}),t[3]=n.name,t[4]=s);let c;t[5]!==l||t[6]!==s?(c=(0,Z.jsx)(mn,{asChild:!0,children:(0,Z.jsxs)(IN,{size:`sm`,className:`text-[11px]`,style:l,children:[e,s]})}),t[5]=l,t[6]=s,t[7]=c):c=t[7];let u;if(t[8]!==r||t[9]!==n.children||t[10]!==i){let e;t[12]!==r||t[13]!==i?(e=e=>(0,Z.jsx)(RZ,{node:e,depth:r+1,onOpenFile:i},e.path),t[12]=r,t[13]=i,t[14]=e):e=t[14],u=n.children.map(e),t[8]=r,t[9]=n.children,t[10]=i,t[11]=u}else u=t[11];let d;t[15]===u?d=t[16]:(d=(0,Z.jsx)(pn,{children:u}),t[15]=u,t[16]=d);let f;t[17]!==c||t[18]!==d?(f=(0,Z.jsxs)(FN,{children:[c,d]}),t[17]=c,t[18]=d,t[19]=f):f=t[19];let p;return t[20]!==a||t[21]!==f?(p=(0,Z.jsx)(hn,{open:a,onOpenChange:o,className:`group/dir`,children:f}),t[20]=a,t[21]=f,t[22]=p):p=t[22],p}let u=`skill-file-${n.path}`,d;t[23]!==n.path||t[24]!==i?(d=()=>i(n.path),t[23]=n.path,t[24]=i,t[25]=d):d=t[25];let f;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(qm,{className:`size-3 shrink-0 text-muted-foreground`}),t[26]=f):f=t[26];let p;t[27]===n.name?p=t[28]:(p=(0,Z.jsx)(`span`,{className:`truncate`,children:n.name}),t[27]=n.name,t[28]=p);let m;return t[29]!==l||t[30]!==u||t[31]!==d||t[32]!==p?(m=(0,Z.jsx)(FN,{children:(0,Z.jsxs)(IN,{size:`sm`,className:`text-[11px]`,style:l,"data-testid":u,onClick:d,children:[f,p]})}),t[29]=l,t[30]=u,t[31]=d,t[32]=p,t[33]=m):m=t[33],m}function zZ(e){let t=(0,$.c)(12),{hasProjectSkills:n}=e,{_:r}=vt(),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(!1),c,l;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>{let e=window.okDesktop?.sharing;if(!e)return;let t=!1,n=()=>{e.status().then(e=>{t||a(e.mode===`local-only`&&!e.skillsShared)}).catch(BZ)};return n(),window.addEventListener(`focus`,n),()=>{t=!0,window.removeEventListener(`focus`,n)}},l=[],t[0]=c,t[1]=l):(c=t[0],l=t[1]),(0,Q.useEffect)(c,l),!n||i!==!0)return null;let u;t[2]!==r||t[3]!==o?(u=async()=>{let e=window.okDesktop?.sharing;if(!e||o)return;s(!0);let t=null,n=null;try{t=await e.setSkillsShared(!0)}catch(e){n=e}if(s(!1),n!==null){let e=n instanceof Error?n.message:``;X.error(e.startsWith(`ok:sharing:dispatch:`)?r({id:`qXN416`}):e||r({id:`K2v7QF`}));return}if(t!==null){if(t.kind===`applied`)X.success(r({id:`Q7cNKe`})),a(!1);else if(t.kind===`no-exclude`){let e=t.reason===`no-git`?r({id:`Xwump4`}):t.reason===`inaccessible`?r({id:`PlGC6r`}):r({id:`zcmYx4`});X.warning(r({id:`EARn6h`,values:{detail:e}}))}}},t[2]=r,t[3]=o,t[4]=u):u=t[4];let d=u,f;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(`p`,{className:`mb-2 text-amber-900 dark:text-amber-200`,children:(0,Z.jsx)(J,{id:`Bh9671`})}),t[5]=f):f=t[5];let p;t[6]===d?p=t[7]:(p=()=>void d(),t[6]=d,t[7]=p);let m;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(J,{id:`TUzThQ`}),t[8]=m):m=t[8];let h;return t[9]!==o||t[10]!==p?(h=(0,Z.jsxs)(`div`,{className:`mx-2 mb-1 rounded-md border border-amber-300 bg-amber-50 p-2 text-xs dark:border-amber-700 dark:bg-amber-950`,children:[f,(0,Z.jsx)(Y,{size:`sm`,className:`h-6 px-2 text-xs`,disabled:o,onClick:p,children:m})]}),t[9]=o,t[10]=p,t[11]=h):h=t[11],h}function BZ(e){console.warn(JSON.stringify({event:`skills-share-status-read-failed`,error:e instanceof Error?e.message:String(e)}))}function VZ(){let e=(0,$.c)(19),[t,n]=(0,Q.useState)(null),[r,i]=(0,Q.useState)(!1),a,o;if(e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>{let e=!1;return Ud().then(t=>{e||n(t)}),()=>{e=!0}},o=[],e[0]=a,e[1]=o):(a=e[0],o=e[1]),(0,Q.useEffect)(a,o),!t||t.managed!==null||t.importable===0)return null;let s;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=async e=>{if(i(!0),!await Kd(e)){i(!1);return}n({managed:e,importable:0})},e[2]=s):s=e[2];let c=s,l;e[3]===t.importable?l=e[4]:(l=(0,Z.jsx)(`p`,{className:`mb-2 text-muted-foreground`,children:(0,Z.jsx)(J,{id:`mu1O0q`,values:{0:t.importable}})}),e[3]=t.importable,e[4]=l);let u,d;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>c(!0),d=(0,Z.jsx)(J,{id:`l3s5ri`}),e[5]=u,e[6]=d):(u=e[5],d=e[6]);let f;e[7]===r?f=e[8]:(f=(0,Z.jsx)(Y,{size:`sm`,className:`h-6 px-2 text-xs`,disabled:r,onClick:u,children:d}),e[7]=r,e[8]=f);let p,m;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(p=()=>c(!1),m=(0,Z.jsx)(J,{id:`PBxg_E`}),e[9]=p,e[10]=m):(p=e[9],m=e[10]);let h;e[11]===r?h=e[12]:(h=(0,Z.jsx)(Y,{size:`sm`,variant:`ghost`,className:`h-6 px-2 text-xs`,disabled:r,onClick:p,children:m}),e[11]=r,e[12]=h);let g;e[13]!==f||e[14]!==h?(g=(0,Z.jsxs)(`div`,{className:`flex gap-1.5`,children:[f,h]}),e[13]=f,e[14]=h,e[15]=g):g=e[15];let _;return e[16]!==g||e[17]!==l?(_=(0,Z.jsxs)(`div`,{className:`mx-2 mb-1 rounded-md border border-border/60 bg-muted/40 p-2 text-xs`,children:[l,g]}),e[16]=g,e[17]=l,e[18]=_):_=e[18],_}var HZ=`Relaunch`,UZ=`Release notes`,WZ=`Updates paused`,GZ=`Download`,KZ=`Reset to defaults`,qZ=`Relaunching to install the update…`,JZ=`Relaunch failed — please restart manually`;function YZ(e){return`Update to ${e} didn't install.`}var XZ=`Retry`,ZZ=`Download manually`,QZ=`Recovery action failed — please try again`;function $Z(e,t){let n=t instanceof Error&&t.message?t.message:``;return n?`${e}: ${n}`:e}function eQ(e){return`Version ${e} ready to install`}function tQ(e){return`Updated to Version ${e}`}function nQ(e){return`Your settings and recent projects were saved by a newer build than this one (v${e}). Reset to defaults to continue.`}var rQ=0,iQ=0,aQ=1,oQ=2,sQ=3,cQ=6e4;function lQ(e,t,n=()=>{},r=cQ,i={isEligible:()=>!1,onShown:()=>{}}){let a=[],o=new Set,s=`update-downloaded`;return a.push(e.onUpdateDownloaded(({version:r})=>{let i=s,a=()=>{t({id:i,body:eQ(r),priority:oQ,action:{label:HZ,onClick:()=>{t({id:i,body:qZ,priority:oQ,dismissible:!1}),e.update.relaunchNow().then(()=>{n(i)},e=>{a(),t({id:`relaunch-error-${r}`,body:$Z(JZ,e),variant:`error`,priority:aQ})})}}})};a()})),a.push(e.onUpdateRelaunching(()=>{t({id:s,body:qZ,priority:oQ,dismissible:!1})})),a.push(e.onUpdateRelaunchFailed(({version:r,message:i,downloadUrl:a})=>{if(a){let i=`install-failed-${r}`,o=()=>{t({id:i,body:YZ(r),variant:`error`,priority:aQ,action:{label:XZ,onClick:()=>{e.update.relaunchNow().then(()=>{n(i)},e=>{console.warn(`[update-notice] install-failed retry rejected`,e),o()})}},secondaryAction:{label:ZZ,onClick:()=>{e.shell.openExternal(a)}}})};o();return}t({id:`relaunch-error-${r}`,body:i?`${JZ}: ${i}`:JZ,variant:`error`,priority:aQ})})),a.push(e.onWhatsNew(({version:a,releaseUrl:s})=>{if(i.isEligible(a)){i.onShown(a),t({id:`whats-new-combined-${a}`,body:tQ(a),variant:`success`,priority:sQ,combinedSubscribe:!0,whatsNew:{version:a,releaseUrl:s},action:{label:UZ,onClick:()=>{e.shell.openExternal(s)}}}),e.update.dismissWhatsNew(a);return}let c=`whats-new-${a}`;t({id:c,body:tQ(a),variant:`success`,priority:sQ,action:{label:UZ,onClick:()=>{e.shell.openExternal(s)}},onDismiss:()=>{e.update.dismissWhatsNew(a)}});let l=setTimeout(()=>{o.delete(l),n(c),e.update.dismissWhatsNew(a)},r);o.add(l)})),a.push(e.onWhatsNewDismissed(({version:e})=>{n(`whats-new-${e}`)})),a.push(e.onUpdateStuckHint(({downloadUrl:n})=>{t({id:`update-stuck-hint`,body:WZ,priority:iQ,action:{label:GZ,onClick:()=>{e.shell.openExternal(n)}}})})),()=>{for(let e of a)e();for(let e of o)clearTimeout(e);o.clear()}}function uQ(e,t,n,r=()=>{}){let i=`schema-incompatibility-${t.persistedSchemaVersion}`,a=`schema-incompatibility-error-${t.persistedSchemaVersion}`,o=e=>{r(i),n({id:a,body:$Z(QZ,e),variant:`error`,priority:rQ})};n({id:i,body:nQ(t.currentBuild),priority:rQ,action:{label:KZ,onClick:()=>{e.state.resetIncompatible().then(()=>{r(i)},o)}}})}var dQ=[],fQ=new Set,pQ=!1;function mQ(){for(let e of fQ)e()}function hQ(e){let t=dQ.findIndex(t=>t.id===e.id);if(t===-1)dQ=[...dQ,e];else{let n=dQ.slice();n[t]=e,dQ=n}mQ()}function gQ(e){let t=dQ.filter(t=>t.id!==e);t.length!==dQ.length&&(dQ=t,mQ())}function _Q(){return dQ}function vQ(e){return fQ.add(e),()=>{fQ.delete(e)}}function yQ(){if(pQ||typeof window>`u`)return;let e=window.okDesktop;e&&(pQ=!0,lQ(e,hQ,gQ,void 0,{isEligible:e=>vI(TI.getSnapshot(),e),onShown:e=>TI.recordShown(e)}),e.state.query().then(t=>{t.schemaIncompatibility&&uQ(e,t.schemaIncompatibility,hQ,gQ)},e=>{console.warn(`[update-notices-store] bridge.state.query() failed`,e)}))}var bQ=6e4,xQ=e=>{let t=(0,$.c)(11),{href:n,label:r,icon:i}=e,a,o;t[0]===n?(a=t[1],o=t[2]):(a=e=>Wu(e,n),o=e=>Wu(e,n),t[0]=n,t[1]=a,t[2]=o);let s;t[3]===i?s=t[4]:(s=(0,Z.jsx)(i,{"aria-hidden":`true`,className:`size-3.5`}),t[3]=i,t[4]=s);let c;return t[5]!==n||t[6]!==r||t[7]!==a||t[8]!==o||t[9]!==s?(c=(0,Z.jsx)(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,onClick:a,onAuxClick:o,"aria-label":r,className:`rounded-md p-1 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,children:s}),t[5]=n,t[6]=r,t[7]=a,t[8]=o,t[9]=s,t[10]=c):c=t[10],c};function SQ(e){let t=(0,$.c)(34),{version:n,onOpenReleaseNotes:r,onClose:i,store:a,autoDismissMs:o}=e,s=a===void 0?TI:a,c=o===void 0?bQ:o,{_:l}=vt(),[u,d]=(0,Q.useState)(!1),f,p;t[0]!==c||t[1]!==i||t[2]!==u?(f=()=>{if(!u)return;let e=setTimeout(i,c);return()=>clearTimeout(e)},p=[u,i,c],t[0]=c,t[1]=i,t[2]=u,t[3]=f,t[4]=p):(f=t[3],p=t[4]),(0,Q.useEffect)(f,p);let m;t[5]===l?m=t[6]:(m=l({id:`GzPQ2f`}),t[5]=l,t[6]=m);let h;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(J,{id:`yLEyuq`}),t[7]=h):h=t[7];let g;t[8]===s?g=t[9]:(g=()=>{s.markSubscribed(),d(!0)},t[8]=s,t[9]=g);let _;t[10]!==i||t[11]!==s?(_=()=>{s.dismiss(),i()},t[10]=i,t[11]=s,t[12]=_):_=t[12];let v;t[13]!==g||t[14]!==_?(v=(0,Z.jsx)(fI,{source:`post_update_card`,compactSubmit:!0,description:h,onSuccess:g,onDismiss:_}),t[13]=g,t[14]=_,t[15]=v):v=t[15];let y;t[16]!==l||t[17]!==u?(y=u?null:(0,Z.jsxs)(`nav`,{"aria-label":l({id:`dbapvC`}),className:`mt-3 flex items-center gap-1.5 text-muted-foreground text-xs`,children:[(0,Z.jsx)(`span`,{className:`mr-0.5`,children:(0,Z.jsx)(J,{id:`9sBe85`})}),(0,Z.jsx)(xQ,{href:hI,label:l({id:`I7Exsw`}),icon:AI}),(0,Z.jsx)(xQ,{href:pI,label:l({id:`zyKa-I`}),icon:pg}),(0,Z.jsx)(xQ,{href:mI,label:l({id:`36aWJD`}),icon:kI})]}),t[16]=l,t[17]=u,t[18]=y):y=t[18];let b;t[19]!==y||t[20]!==v?(b=(0,Z.jsxs)(`div`,{className:`px-3 py-2.5`,children:[v,y]}),t[19]=y,t[20]=v,t[21]=b):b=t[21];let x;t[22]===n?x=t[23]:(x=(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(J,{id:`hLy8b1`,values:{version:n}})}),t[22]=n,t[23]=x);let S;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(J,{id:`_PACVa`}),t[24]=S):S=t[24];let C;t[25]===r?C=t[26]:(C=(0,Z.jsx)(Y,{variant:`link`,size:`sm`,className:`h-auto p-0 text-muted-foreground text-xs hover:text-foreground`,onClick:r,children:S}),t[25]=r,t[26]=C);let w;t[27]!==x||t[28]!==C?(w=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between border-t bg-muted/30 px-3 py-2.5 space-x-2`,children:[x,C]}),t[27]=x,t[28]=C,t[29]=w):w=t[29];let T;return t[30]!==b||t[31]!==w||t[32]!==m?(T=(0,Z.jsxs)(`section`,{"aria-label":m,className:`mx-1 mb-1 overflow-hidden rounded-lg border bg-card text-card-foreground`,children:[b,w]}),t[30]=b,t[31]=w,t[32]=m,t[33]=T):T=t[33],T}function CQ(e){let t=(0,$.c)(37),{notice:n,onDismiss:r}=e,{_:i}=vt(),a=n.variant===`error`?`border-destructive/60 bg-sidebar-accent/30 text-muted-foreground`:n.variant===`success`?`border-emerald-500/40 bg-emerald-500/10 text-emerald-600 dark:text-emerald-400`:`border-sidebar-border bg-sidebar-accent/30 text-muted-foreground`,o;t[0]!==i||t[1]!==n.dismissible||t[2]!==r?(o=n.dismissible===!1?null:(0,Z.jsx)(Y,{variant:`ghost`,size:`icon`,className:`size-5 shrink-0 text-muted-foreground hover:text-sidebar-foreground`,"aria-label":i({id:`GUYwCr`}),onClick:r,children:(0,Z.jsx)(fl,{"aria-hidden":`true`,className:`size-3`})}),t[0]=i,t[1]=n.dismissible,t[2]=r,t[3]=o):o=t[3];let s=o,c=`shrink-0 text-xs font-medium underline underline-offset-2 ${n.variant===`success`?`decoration-emerald-500/40`:`decoration-muted-foreground/40`} hover:text-sidebar-foreground hover:decoration-sidebar-foreground`;if(n.secondaryAction){let e=`update-notice-${n.id}`,r=`flex flex-col gap-2 rounded-md border px-2 py-2 text-xs ${a}`,i;t[4]===n.body?i=t[5]:(i=(0,Z.jsx)(`span`,{className:`flex-1 leading-snug`,children:n.body}),t[4]=n.body,t[5]=i);let o;t[6]!==s||t[7]!==i?(o=(0,Z.jsxs)(`div`,{className:`flex items-start gap-2`,children:[i,s]}),t[6]=s,t[7]=i,t[8]=o):o=t[8];let l;t[9]!==c||t[10]!==n.action?(l=n.action?(0,Z.jsx)(`button`,{type:`button`,className:c,onClick:()=>{n.action?.onClick()},children:n.action.label}):null,t[9]=c,t[10]=n.action,t[11]=l):l=t[11];let u;t[12]===n.secondaryAction?u=t[13]:(u=()=>{n.secondaryAction?.onClick()},t[12]=n.secondaryAction,t[13]=u);let d;t[14]!==c||t[15]!==n.secondaryAction.label||t[16]!==u?(d=(0,Z.jsx)(`button`,{type:`button`,className:c,onClick:u,children:n.secondaryAction.label}),t[14]=c,t[15]=n.secondaryAction.label,t[16]=u,t[17]=d):d=t[17];let f;t[18]!==l||t[19]!==d?(f=(0,Z.jsxs)(`div`,{className:`flex gap-3 pl-1`,children:[l,d]}),t[18]=l,t[19]=d,t[20]=f):f=t[20];let p;return t[21]!==e||t[22]!==r||t[23]!==o||t[24]!==f?(p=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":e,className:r,children:[o,f]}),t[21]=e,t[22]=r,t[23]=o,t[24]=f,t[25]=p):p=t[25],p}let l=`update-notice-${n.id}`,u=`flex items-center gap-2 rounded-md border px-2 py-1.5 text-xs ${a}`,d;t[26]===n.body?d=t[27]:(d=(0,Z.jsx)(`span`,{className:`flex-1 leading-snug`,children:n.body}),t[26]=n.body,t[27]=d);let f;t[28]!==c||t[29]!==n.action?(f=n.action?(0,Z.jsx)(`button`,{type:`button`,className:c,onClick:()=>{n.action?.onClick()},children:n.action.label}):null,t[28]=c,t[29]=n.action,t[30]=f):f=t[30];let p;return t[31]!==s||t[32]!==l||t[33]!==u||t[34]!==d||t[35]!==f?(p=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":l,className:u,children:[d,f,s]}),t[31]=s,t[32]=l,t[33]=u,t[34]=d,t[35]=f,t[36]=p):p=t[36],p}function wQ(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 TQ(){let e=(0,$.c)(15),t=(0,Q.useSyncExternalStore)(vQ,_Q,_Q),n;e[0]===t?n=e[1]:(n=wQ(t),e[0]=t,e[1]=n);let r=n;if(!r)return null;if(r.combinedSubscribe&&r.whatsNew){let t;e[2]===r.action?t=e[3]:(t=()=>r.action?.onClick(),e[2]=r.action,e[3]=t);let n;e[4]===r.id?n=e[5]:(n=()=>gQ(r.id),e[4]=r.id,e[5]=n);let i;return e[6]!==r.whatsNew.version||e[7]!==t||e[8]!==n?(i=(0,Z.jsx)(`div`,{"data-testid":`update-notices-list`,children:(0,Z.jsx)(SQ,{version:r.whatsNew.version,onOpenReleaseNotes:t,onClose:n})}),e[6]=r.whatsNew.version,e[7]=t,e[8]=n,e[9]=i):i=e[9],i}let i;e[10]===r?i=e[11]:(i=()=>{r.onDismiss?.(),gQ(r.id)},e[10]=r,e[11]=i);let a;return e[12]!==r||e[13]!==i?(a=(0,Z.jsx)(`div`,{"data-testid":`update-notices-list`,children:(0,Z.jsx)(CQ,{notice:r,onDismiss:i})}),e[12]=r,e[13]=i,e[14]=a):a=e[14],a}function EQ(e,t){return e?.kind===`doc`||e?.kind===`folder-index`?sc(t.contentDir,dc(e.docName),t.pathSeparator):e?.kind===`folder`?sc(t.contentDir,e.folderPath,t.pathSeparator):e?.kind===`asset`?sc(t.contentDir,e.assetPath,t.pathSeparator):t.contentDir}function DQ(e){return e?.kind===`doc`||e?.kind===`folder-index`?dc(e.docName):e?.kind===`folder`?e.folderPath:e?.kind===`asset`?e.assetPath:``}function OQ(e,t){return e===null?qs({workspace:t}):e.kind===`folder`?t?Us({folderRelativePath:e.folderPath,workspace:t}):null:e.kind===`doc`||e.kind===`folder-index`?Xs({docName:e.docName,workspace:t}):null}var kQ={folderCount:0,expandedCount:0},AQ=`button, [role="button"], [role="menuitem"], input, textarea, select, a[href]`;function jQ(e){return typeof Element>`u`||!(e instanceof Element)?!1:e.closest(AQ)!==null}function MQ(e){let t=(0,$.c)(2),{onOpenSearch:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(Ql,{name:`file-sidebar`,children:(0,Z.jsx)(FQ,{onOpenSearch:n})}),t[0]=n,t[1]=r),r}var NQ=e=>{let t=(0,$.c)(15),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({icon:n,label:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=(0,Z.jsx)(n,{"aria-hidden":`true`}),t[4]=n,t[5]=a);let o;t[6]!==r||t[7]!==i||t[8]!==a?(o=(0,Z.jsx)(ln,{asChild:!0,children:(0,Z.jsx)(Y,{variant:`ghost`,size:`icon-sm`,"aria-label":r,...i,children:a})}),t[6]=r,t[7]=i,t[8]=a,t[9]=o):o=t[9];let s;t[10]===r?s=t[11]:(s=(0,Z.jsx)(un,{children:r}),t[10]=r,t[11]=s);let c;return t[12]!==o||t[13]!==s?(c=(0,Z.jsxs)(fn,{children:[o,s]}),t[12]=o,t[13]=s,t[14]=c):c=t[14],c},PQ=e=>{let t=(0,$.c)(15),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({icon:n,label:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=(0,Z.jsx)(n,{"aria-hidden":`true`}),t[4]=n,t[5]=a);let o;t[6]!==r||t[7]!==i||t[8]!==a?(o=(0,Z.jsx)(ln,{asChild:!0,children:(0,Z.jsx)(Pr,{asChild:!0,children:(0,Z.jsx)(Y,{variant:`ghost`,size:`icon-sm`,"aria-label":r,...i,children:a})})}),t[6]=r,t[7]=i,t[8]=a,t[9]=o):o=t[9];let s;t[10]===r?s=t[11]:(s=(0,Z.jsx)(un,{children:r}),t[10]=r,t[11]=s);let c;return t[12]!==o||t[13]!==s?(c=(0,Z.jsxs)(fn,{children:[o,s]}),t[12]=o,t[13]=s,t[14]=c):c=t[14],c};function FQ(e){let t=(0,$.c)(309),{onOpenSearch:n}=e,{_:r}=vt(),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(null),{activeDocName:c,activeTarget:l}=Re(),u;t[0]!==c||t[1]!==l?(u=l?.kind===`folder`||l?.kind===`folder-index`?l.folderPath:Nl(c),t[0]=c,t[1]=l,t[2]=u):u=t[2];let d=u,f;t[3]===d?f=t[4]:(f=Vl(d)?``:d,t[3]=d,t[4]=f);let p=f,[m,h]=(0,Q.useState)(!1),g=m?``:p,_=typeof window<`u`&&window.okDesktop!=null,{state:v,toggleSidebar:y}=mN(),b=lc(),x=v===`expanded`,S=_&&v===`collapsed`,[C,w]=(0,Q.useState)(kQ),T,E;t[5]===i?(T=t[6],E=t[7]):(T=()=>{if(i===null)return;let e=()=>{w(i.getFolderState()),h(i.isCreationTargetCleared())};return e(),i.subscribe(e)},E=[i],t[5]=i,t[6]=T,t[7]=E),(0,Q.useEffect)(T,E);let D,O;t[8]===i?(D=t[9],O=t[10]):(D=()=>{if(i!==null)return hC(e=>{let t=e.initialDir??``;if(e.template){i.createFromTemplate(e.template.folder,e.template.name);return}i.startCreating(`file`,t)})},O=[i],t[8]=i,t[9]=D,t[10]=O),(0,Q.useEffect)(D,O);let k=C.folderCount>0,A=k&&C.expandedCount===C.folderCount,j=C.expandedCount===0,M=Gr(``),N=Gr(g===``?null:g),P=g===``?M:N,F=M.state.status===`ready`?(M.state.data.folder.templates_available?.length??0)>0:!0,I=P.state.status===`ready`?(P.state.data.folder.templates_available?.length??0)>0:!0,L=typeof window<`u`?window.okDesktop:void 0,R=Ju(),{status:z}=ss(),B=z?.hasRemote===!0,V;t[11]!==r||t[12]!==R?.contentDir?(V=L?.config?.projectName||R?.contentDir.split(`/`).filter(Boolean).pop()||r({id:`sER-bs`}),t[11]=r,t[12]=R?.contentDir,t[13]=V):V=t[13];let H=V,U=Ks().states,{dispatch:W}=Bs(),ee;t[14]===R?ee=t[15]:(ee=qs({workspace:R}),t[14]=R,t[15]=ee);let G=ee,{projectLocalBinding:K,merged:te}=Hu(),ne=te?.appearance?.sidebar?.showHiddenFiles??!1,re=te?.appearance?.sidebar?.showOkFolders??!1,ie=te?.appearance?.sidebar?.showOnlyMarkdownFiles??!1,ae=te?.appearance?.sidebar?.showSkillsSection??!0,oe=k&&!A,se=k&&!j,ce=oe||se,le=(0,Q.useRef)(!1),ue;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(ue=e=>{le.current&&(le.current=!1,e.preventDefault())},t[16]=ue):ue=t[16];let de=ue,fe=BQ,pe;t[17]!==i||t[18]!==R?(pe=()=>{R&&(le.current=!0,i?.startCreating(`file`,``))},t[17]=i,t[18]=R,t[19]=pe):pe=t[19];let q=pe,me;t[20]!==i||t[21]!==R?(me=e=>{R&&(le.current=!0,i?.createFromTemplate(``,e))},t[20]=i,t[21]=R,t[22]=me):me=t[22];let he=me,ge;t[23]!==i||t[24]!==R?(ge=()=>{R&&(le.current=!0,i?.startCreating(`folder`,``))},t[23]=i,t[24]=R,t[25]=ge):ge=t[25];let _e=ge,ve;t[26]===R?ve=t[27]:(ve=()=>{!R||!L||L.shell.showItemInFolder(R.contentDir)},t[26]=R,t[27]=ve);let ye=ve,be;t[28]!==r||t[29]!==R?(be=async()=>{if(R)try{await navigator.clipboard.writeText(R.contentDir),X.success(r({id:`6_ZOw4`}),{description:R.contentDir})}catch(e){console.warn(`[FileSidebar] clipboard write failed:`,e),X.error(r({id:`vfRlCI`}))}},t[28]=r,t[29]=R,t[30]=be):be=t[30];let xe=be,Se;t[31]!==r||t[32]!==B?(Se=()=>{Jr({...Yr(``),hasRemote:B,onClickWhenNoRemote:()=>{X.error(r({id:`WyQxwa`}))}},{clipboardWrite:Md,toastSuccess:zQ,toastError:RQ,logEvent:LQ})},t[31]=r,t[32]=B,t[33]=Se):Se=t[33];let Ce=Se,we;t[34]!==r||t[35]!==K?(we=e=>{if(K===null)return;let t=K.patch({appearance:{sidebar:e}});t.ok||(console.warn(`[FileSidebar] sidebar visibility toggle rejected:`,Va(t.error)),X.error(r({id:`P47EWZ`}),{description:Va(t.error)}))},t[34]=r,t[35]=K,t[36]=we):we=t[36];let Te=we,Ee;t[37]===i?Ee=t[38]:(Ee=()=>{i?.expandAll()},t[37]=i,t[38]=Ee);let De=Ee,Oe;t[39]===i?Oe=t[40]:(Oe=()=>{i?.collapseAll()},t[39]=i,t[40]=Oe);let ke=Oe,Ae,je;t[41]!==se||t[42]!==oe||t[43]!==ne||t[44]!==re||t[45]!==ie||t[46]!==ae||t[47]!==v?(Ae=()=>{let e={showHiddenFiles:ne,showOkFolders:re,showOnlyMarkdownFiles:ie,showSkillsSection:ae,canExpandAll:oe,canCollapseAll:se,sidebarVisible:v===`expanded`};Ic(e),L&&L.editor.notifyViewMenuStateChanged(e)},je=[L,ne,re,ie,ae,oe,se,v],t[41]=se,t[42]=oe,t[43]=ne,t[44]=re,t[45]=ie,t[46]=ae,t[47]=v,t[48]=Ae,t[49]=je):(Ae=t[48],je=t[49]),(0,Q.useEffect)(Ae,je);let Me;t[50]!==r||t[51]!==l||t[52]!==W||t[53]!==U||t[54]!==g||t[55]!==Te||t[56]!==ne||t[57]!==re||t[58]!==ie||t[59]!==ae||t[60]!==y||t[61]!==i||t[62]!==R?(Me=()=>Gt(e=>{let t=l!==null&&Vl(DQ(l));switch(e){case`new-doc`:if(!R||!i)return;i.startCreating(`file`,g);return;case`new-folder`:if(!R||!i)return;i.startCreating(`folder`,g);return;case`new-from-template`:if(!R||!i)return;i.startCreatingFromTemplate(g);return;case`rename`:if(!l||t)return;lY(l);return;case`duplicate`:if(!l||t)return;dY(l);return;case`move-to-trash`:if(!l||t)return;sY(l);return;case`reveal-in-finder`:{if(!L||!R)return;let e=EQ(l,R);L.shell.showItemInFolder(e);return}case`send-to-ai`:{let e=Ki.filter(e=>U[e.id]?.installed===!0);if(e.length===0){X.error(r({id:`LKOLNn`}));return}let t=OQ(l,R);if(!t)return;let[n]=e;if(!n)return;W(n.id,t);return}case`copy-full-path`:{if(!R)return;let e=EQ(l,R);navigator.clipboard.writeText(e).then(()=>X.success(r({id:`6_ZOw4`}),{description:e})).catch(e=>{console.warn(`[FileSidebar] clipboard write failed:`,e),X.error(r({id:`vfRlCI`}))});return}case`copy-relative-path`:{let e=DQ(l);if(e===``){X.error(r({id:`74eHt-`}));return}navigator.clipboard.writeText(e).then(()=>X.success(r({id:`haHgQj`}),{description:e})).catch(e=>{console.warn(`[FileSidebar] clipboard write failed:`,e),X.error(r({id:`5QGTaA`}))});return}case`toggle-show-ok-folders`:Te({showOkFolders:!re});return;case`toggle-show-hidden-files`:Te({showHiddenFiles:!ne});return;case`toggle-show-only-markdown-files`:Te({showOnlyMarkdownFiles:!ie});return;case`toggle-show-skills-section`:Te({showSkillsSection:!ae});return;case`expand-all-tree`:i?.expandAll();return;case`collapse-all-tree`:i?.collapseAll();return;case`toggle-sidebar`:y();return;case`delete`:case`toggle-source`:case`save-version`:case`version-history`:case`focus-search`:case`focus-command-palette`:case`close-active-tab-or-window`:case`toggle-doc-panel`:return}}),t[50]=r,t[51]=l,t[52]=W,t[53]=U,t[54]=g,t[55]=Te,t[56]=ne,t[57]=re,t[58]=ie,t[59]=ae,t[60]=y,t[61]=i,t[62]=R,t[63]=Me):Me=t[63];let Ne;t[64]!==r||t[65]!==l||t[66]!==W||t[67]!==U||t[68]!==g||t[69]!==K||t[70]!==ne||t[71]!==re||t[72]!==ie||t[73]!==ae||t[74]!==y||t[75]!==i||t[76]!==R?(Ne=[L,i,R,l,g,K,ne,re,ie,ae,U,W,y,r],t[64]=r,t[65]=l,t[66]=W,t[67]=U,t[68]=g,t[69]=K,t[70]=ne,t[71]=re,t[72]=ie,t[73]=ae,t[74]=y,t[75]=i,t[76]=R,t[77]=Ne):Ne=t[77],(0,Q.useEffect)(Me,Ne);let Pe=_&&x&&`motion-safe:delay-100`,Fe=S&&`opacity-0`,Ie;t[78]!==Pe||t[79]!==Fe?(Ie=$t(`flex-row h-12 items-center py-0 px-3`,`justify-between`,_&&`overflow-x-clip`,_&&`motion-safe:transition-opacity motion-safe:duration-100 motion-safe:ease-out`,Pe,Fe,_&&`[-webkit-app-region:drag]`),t[78]=Pe,t[79]=Fe,t[80]=Ie):Ie=t[80];let Le;t[81]===Symbol.for(`react.memo_cache_sentinel`)?(Le=_?(0,Z.jsx)(`div`,{"aria-hidden":`true`,"data-testid":`sidebar-traffic-light-reserve`,className:`w-[var(--ok-titlebar-reserve-left,0px)] shrink-0 self-stretch`}):null,t[81]=Le):Le=t[81];let ze;t[82]===x?ze=t[83]:(ze=x&&!_?(0,Z.jsx)(`span`,{className:`shrink-0 font-mono text-sm uppercase tracking-wider text-sidebar-foreground/50`,children:(0,Z.jsx)(J,{id:`sER-bs`})}):null,t[82]=x,t[83]=ze);let Be;t[84]===Symbol.for(`react.memo_cache_sentinel`)?(Be=$t(`flex items-center gap-1`,_&&`[&>*]:[-webkit-app-region:no-drag]`),t[84]=Be):Be=t[84];let Ve;t[85]===r?Ve=t[86]:(Ve=r({id:`Rq1vFD`}),t[85]=r,t[86]=Ve);let He;t[87]===Ve?He=t[88]:(He=(0,Z.jsx)(PQ,{icon:ch,label:Ve}),t[87]=Ve,t[88]=He);let Ue;t[89]!==oe||t[90]!==i?(Ue=oe?(0,Z.jsxs)(Ar,{onSelect:()=>i?.expandAll(),children:[(0,Z.jsx)(Uh,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`OlAl5i`})]}):null,t[89]=oe,t[90]=i,t[91]=Ue):Ue=t[91];let We;t[92]!==se||t[93]!==i?(We=se?(0,Z.jsxs)(Ar,{onSelect:()=>i?.collapseAll(),children:[(0,Z.jsx)(Zm,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`qvWGzP`})]}):null,t[92]=se,t[93]=i,t[94]=We):We=t[94];let Ge;t[95]===ce?Ge=t[96]:(Ge=ce?(0,Z.jsx)(Vr,{}):null,t[95]=ce,t[96]=Ge);let Ke;t[97]===r?Ke=t[98]:(Ke=r({id:`8vETh9`}),t[97]=r,t[98]=Ke);let qe;t[99]===Symbol.for(`react.memo_cache_sentinel`)?(qe=(0,Z.jsx)(Ir,{children:(0,Z.jsx)(J,{id:`8vETh9`})}),t[99]=qe):qe=t[99];let Je;t[100]===Te?Je=t[101]:(Je=e=>Te({showHiddenFiles:e}),t[100]=Te,t[101]=Je);let Ye=K===null,Xe;t[102]===Symbol.for(`react.memo_cache_sentinel`)?(Xe=(0,Z.jsx)(J,{id:`6KCH4m`}),t[102]=Xe):Xe=t[102];let Ze;t[103]!==ne||t[104]!==Je||t[105]!==Ye?(Ze=(0,Z.jsx)(Fr,{checked:ne,onCheckedChange:Je,disabled:Ye,"data-testid":`tree-options-show-hidden-files`,children:Xe}),t[103]=ne,t[104]=Je,t[105]=Ye,t[106]=Ze):Ze=t[106];let Qe;t[107]===Te?Qe=t[108]:(Qe=e=>Te({showOkFolders:e}),t[107]=Te,t[108]=Qe);let $e=K===null,et;t[109]===Symbol.for(`react.memo_cache_sentinel`)?(et=(0,Z.jsx)(J,{id:`ELYtNJ`}),t[109]=et):et=t[109];let tt;t[110]!==re||t[111]!==Qe||t[112]!==$e?(tt=(0,Z.jsx)(Fr,{checked:re,onCheckedChange:Qe,disabled:$e,"data-testid":`tree-options-show-ok-folders`,children:et}),t[110]=re,t[111]=Qe,t[112]=$e,t[113]=tt):tt=t[113];let nt;t[114]===Te?nt=t[115]:(nt=e=>Te({showOnlyMarkdownFiles:e}),t[114]=Te,t[115]=nt);let rt=K===null,it;t[116]===Symbol.for(`react.memo_cache_sentinel`)?(it=(0,Z.jsx)(J,{id:`5-o4kO`}),t[116]=it):it=t[116];let at;t[117]!==ie||t[118]!==nt||t[119]!==rt?(at=(0,Z.jsx)(Fr,{checked:ie,onCheckedChange:nt,disabled:rt,"data-testid":`tree-options-show-only-markdown-files`,children:it}),t[117]=ie,t[118]=nt,t[119]=rt,t[120]=at):at=t[120];let ot;t[121]===Te?ot=t[122]:(ot=e=>Te({showSkillsSection:e}),t[121]=Te,t[122]=ot);let st=K===null,ct;t[123]===Symbol.for(`react.memo_cache_sentinel`)?(ct=(0,Z.jsx)(J,{id:`PCSkw2`}),t[123]=ct):ct=t[123];let lt;t[124]!==ae||t[125]!==ot||t[126]!==st?(lt=(0,Z.jsx)(Fr,{checked:ae,onCheckedChange:ot,disabled:st,"data-testid":`tree-options-show-skills`,children:ct}),t[124]=ae,t[125]=ot,t[126]=st,t[127]=lt):lt=t[127];let ut;t[128]!==Ke||t[129]!==Ze||t[130]!==tt||t[131]!==at||t[132]!==lt?(ut=(0,Z.jsxs)(Nr,{"aria-label":Ke,children:[qe,Ze,tt,at,lt]}),t[128]=Ke,t[129]=Ze,t[130]=tt,t[131]=at,t[132]=lt,t[133]=ut):ut=t[133];let dt;t[134]!==Ue||t[135]!==We||t[136]!==Ge||t[137]!==ut?(dt=(0,Z.jsxs)(Rr,{align:`end`,className:`min-w-52`,"data-testid":`tree-options-menu`,children:[Ue,We,Ge,ut]}),t[134]=Ue,t[135]=We,t[136]=Ge,t[137]=ut,t[138]=dt):dt=t[138];let ft;t[139]!==He||t[140]!==dt?(ft=(0,Z.jsxs)(Br,{children:[He,dt]}),t[139]=He,t[140]=dt,t[141]=ft):ft=t[141];let pt;t[142]===r?pt=t[143]:(pt=r({id:`HdkSiO`}),t[142]=r,t[143]=pt);let mt;t[144]!==g||t[145]!==i?(mt=()=>i?.startCreating(`file`,g),t[144]=g,t[145]=i,t[146]=mt):mt=t[146];let ht;t[147]!==pt||t[148]!==mt?(ht=(0,Z.jsx)(NQ,{icon:al,label:pt,onClick:mt}),t[147]=pt,t[148]=mt,t[149]=ht):ht=t[149];let gt;t[150]!==r||t[151]!==I||t[152]!==g||t[153]!==i?(gt=I?(0,Z.jsxs)(Br,{children:[(0,Z.jsx)(PQ,{icon:Oi,label:r({id:`Uuj_R4`})}),(0,Z.jsx)(Rr,{align:`end`,className:`min-w-52`,onCloseAutoFocus:de,children:(0,Z.jsx)($J,{parentDir:g,onSelectTemplate:e=>{le.current=!0,i?.createFromTemplate(g,e)},ItemComponent:Ar})})]}):null,t[150]=r,t[151]=I,t[152]=g,t[153]=i,t[154]=gt):gt=t[154];let _t;t[155]===r?_t=t[156]:(_t=r({id:`96G6Re`}),t[155]=r,t[156]=_t);let yt;t[157]!==g||t[158]!==i?(yt=()=>i?.startCreating(`folder`,g),t[157]=g,t[158]=i,t[159]=yt):yt=t[159];let bt;t[160]!==_t||t[161]!==yt?(bt=(0,Z.jsx)(NQ,{icon:$m,label:_t,onClick:yt}),t[160]=_t,t[161]=yt,t[162]=bt):bt=t[162];let xt;t[163]!==ft||t[164]!==ht||t[165]!==gt||t[166]!==bt?(xt=(0,Z.jsxs)(`div`,{"data-testid":`sidebar-toolbar`,className:Be,children:[ft,ht,gt,bt]}),t[163]=ft,t[164]=ht,t[165]=gt,t[166]=bt,t[167]=xt):xt=t[167];let St;t[168]!==Ie||t[169]!==ze||t[170]!==xt?(St=(0,Z.jsxs)(SN,{"data-electron-drag":_?``:void 0,className:Ie,children:[Le,ze,xt]}),t[168]=Ie,t[169]=ze,t[170]=xt,t[171]=St):St=t[171];let Ct=_&&x&&`motion-safe:delay-100`,wt=S&&`opacity-0`,Tt;t[172]!==Ct||t[173]!==wt?(Tt=$t(`px-2 pb-2`,_&&`[-webkit-app-region:no-drag]`,_&&`motion-safe:transition-opacity motion-safe:duration-100 motion-safe:ease-out`,Ct,wt),t[172]=Ct,t[173]=wt,t[174]=Tt):Tt=t[174];let Et;t[175]===v?Et=t[176]:(Et=[v],t[175]=v,t[176]=Et);let Dt;t[177]===n?Dt=t[178]:(Dt=(0,Z.jsx)(AZ,{onClick:n}),t[177]=n,t[178]=Dt);let Ot;t[179]!==Et||t[180]!==Dt?(Ot=(0,Z.jsx)(Zt,{fallbackRender:IQ,onError:kZ,resetKeys:Et,children:Dt}),t[179]=Et,t[180]=Dt,t[181]=Ot):Ot=t[181];let kt;t[182]!==Tt||t[183]!==Ot?(kt=(0,Z.jsx)(`div`,{className:Tt,children:Ot}),t[182]=Tt,t[183]=Ot,t[184]=kt):kt=t[184];let At;t[185]===Symbol.for(`react.memo_cache_sentinel`)?(At=(0,Z.jsx)(lL,{}),t[185]=At):At=t[185];let jt;t[186]===Symbol.for(`react.memo_cache_sentinel`)?(jt=(0,Z.jsx)(gc,{className:`size-3.5 shrink-0`}),t[186]=jt):jt=t[186];let Mt;t[187]===H?Mt=t[188]:(Mt=(0,Z.jsx)(`span`,{className:`truncate`,children:H}),t[187]=H,t[188]=Mt);let Nt;t[189]===Symbol.for(`react.memo_cache_sentinel`)?(Nt=(0,Z.jsx)(As,{className:`size-3.5 shrink-0 text-muted-foreground transition-transform group-data-[state=open]/files:rotate-90`}),t[189]=Nt):Nt=t[189];let Pt;t[190]===Mt?Pt=t[191]:(Pt=(0,Z.jsx)(EN,{asChild:!0,className:`shrink-0`,children:(0,Z.jsxs)(mn,{"data-sidebar-root-context":!0,className:`flex w-full items-center gap-1.5`,children:[jt,Mt,Nt]})}),t[190]=Mt,t[191]=Pt);let Ft=o==null?`50vh`:`${o}px`,It;t[192]===Ft?It=t[193]:(It={height:Ft},t[192]=Ft,t[193]=It);let Lt;t[194]===Symbol.for(`react.memo_cache_sentinel`)?(Lt=(0,Z.jsx)(tX,{ref:a,onContentHeightChange:s}),t[194]=Lt):Lt=t[194];let Rt;t[195]===It?Rt=t[196]:(Rt=(0,Z.jsx)(pn,{className:`flex max-h-[70vh] flex-col overflow-hidden`,style:It,children:Lt}),t[195]=It,t[196]=Rt);let zt;t[197]!==Pt||t[198]!==Rt?(zt=(0,Z.jsx)(hn,{defaultOpen:!0,className:`group/files flex shrink-0 flex-col`,children:(0,Z.jsxs)(TN,{className:`min-h-0 px-0`,children:[Pt,Rt]})}),t[197]=Pt,t[198]=Rt,t[199]=zt):zt=t[199];let Bt;t[200]===ae?Bt=t[201]:(Bt=ae?(0,Z.jsx)(jZ,{}):null,t[200]=ae,t[201]=Bt);let Vt;t[202]===i?Vt=t[203]:(Vt=(0,Z.jsx)(`div`,{"aria-hidden":!0,"data-sidebar-empty-deselect":!0,className:`min-h-8 flex-1 cursor-default`,onClick:()=>i?.clearCreationTarget()}),t[202]=i,t[203]=Vt);let Ht;t[204]!==zt||t[205]!==Bt||t[206]!==Vt?(Ht=(0,Z.jsxs)(wN,{children:[At,zt,Bt,Vt]}),t[204]=zt,t[205]=Bt,t[206]=Vt,t[207]=Ht):Ht=t[207];let Ut;t[208]===Symbol.for(`react.memo_cache_sentinel`)?(Ut=(0,Z.jsxs)(CN,{className:`px-0`,children:[(0,Z.jsx)(QX,{}),(0,Z.jsx)(TQ,{}),typeof window<`u`&&window.okDesktop?(0,Z.jsx)(kN,{children:(0,Z.jsx)(AN,{children:(0,Z.jsx)(bZ,{bridge:window.okDesktop})})}):null]}),t[208]=Ut):Ut=t[208];let Wt=!(b&&v===`collapsed`),Kt;t[209]===Wt?Kt=t[210]:(Kt=(0,Z.jsx)(bN,{enableToggle:!1,enableDrag:Wt}),t[209]=Wt,t[210]=Kt);let qt;t[211]!==St||t[212]!==kt||t[213]!==Ht||t[214]!==Kt?(qt=(0,Z.jsx)(NF,{asChild:!0,children:(0,Z.jsxs)(`div`,{className:`contents`,onContextMenu:fe,children:[St,kt,Ht,Ut,Kt]})}),t[211]=St,t[212]=kt,t[213]=Ht,t[214]=Kt,t[215]=qt):qt=t[215];let Jt=!R,Yt,Xt;t[216]===Symbol.for(`react.memo_cache_sentinel`)?(Yt=(0,Z.jsx)(al,{"aria-hidden":`true`}),Xt=(0,Z.jsx)(J,{id:`HdkSiO`}),t[216]=Yt,t[217]=Xt):(Yt=t[216],Xt=t[217]);let Qt;t[218]!==q||t[219]!==Jt?(Qt=(0,Z.jsxs)(LF,{disabled:Jt,onSelect:q,"data-testid":`empty-space-menu-new-file`,children:[Yt,Xt]}),t[218]=q,t[219]=Jt,t[220]=Qt):Qt=t[220];let en;t[221]!==he||t[222]!==F||t[223]!==R?(en=F?(0,Z.jsxs)(FF,{children:[(0,Z.jsxs)(RF,{disabled:!R,"data-testid":`empty-space-menu-new-from-template`,children:[(0,Z.jsx)(Oi,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`Uuj_R4`})]}),(0,Z.jsx)(zF,{children:(0,Z.jsx)($J,{parentDir:``,onSelectTemplate:he,ItemComponent:LF})})]}):null,t[221]=he,t[222]=F,t[223]=R,t[224]=en):en=t[224];let tn=!R,nn,Y;t[225]===Symbol.for(`react.memo_cache_sentinel`)?(nn=(0,Z.jsx)($m,{"aria-hidden":`true`}),Y=(0,Z.jsx)(J,{id:`96G6Re`}),t[225]=nn,t[226]=Y):(nn=t[225],Y=t[226]);let rn;t[227]!==_e||t[228]!==tn?(rn=(0,Z.jsxs)(LF,{disabled:tn,onSelect:_e,"data-testid":`empty-space-menu-new-folder`,children:[nn,Y]}),t[227]=_e,t[228]=tn,t[229]=rn):rn=t[229];let an;t[230]===Symbol.for(`react.memo_cache_sentinel`)?(an=(0,Z.jsx)(HF,{}),t[230]=an):an=t[230];let on;t[231]!==r||t[232]!==ye||t[233]!==R?(on=L?(0,Z.jsxs)(LF,{disabled:!R,onSelect:ye,"data-testid":`empty-space-menu-reveal-in-finder`,"aria-label":r(R?{id:`LtSYdi`}:{id:`o2yoFu`}),children:[(0,Z.jsx)(gc,{"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(J,{id:`LtSYdi`})}),R?null:(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(J,{id:`wTcjov`})})]}):null,t[231]=r,t[232]=ye,t[233]=R,t[234]=on):on=t[234];let sn;t[235]!==W||t[236]!==G||t[237]!==U?(sn=(0,Z.jsx)(BX,{input:G,installStates:U,dispatch:W}),t[235]=W,t[236]=G,t[237]=U,t[238]=sn):sn=t[238];let cn;t[239]!==Ce||t[240]!==B?(cn=B?(0,Z.jsxs)(LF,{onSelect:Ce,"data-testid":`empty-space-menu-share`,children:[(0,Z.jsx)(Eh,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`Z8lGw6`})]}):null,t[239]=Ce,t[240]=B,t[241]=cn):cn=t[241];let ln=!R,un;t[242]!==r||t[243]!==R?(un=r(R?{id:`Up2_7p`}:{id:`U8CD-l`}),t[242]=r,t[243]=R,t[244]=un):un=t[244];let dn;t[245]===Symbol.for(`react.memo_cache_sentinel`)?(dn=(0,Z.jsx)(pc,{"aria-hidden":`true`}),t[245]=dn):dn=t[245];let fn;t[246]===Symbol.for(`react.memo_cache_sentinel`)?(fn=(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(J,{id:`Up2_7p`})}),t[246]=fn):fn=t[246];let gn;t[247]===R?gn=t[248]:(gn=R?null:(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(J,{id:`wTcjov`})}),t[247]=R,t[248]=gn);let _n;t[249]!==xe||t[250]!==ln||t[251]!==un||t[252]!==gn?(_n=(0,Z.jsxs)(LF,{disabled:ln,onSelect:xe,"data-testid":`empty-space-menu-copy-full-path`,"aria-label":un,children:[dn,fn,gn]}),t[249]=xe,t[250]=ln,t[251]=un,t[252]=gn,t[253]=_n):_n=t[253];let vn;t[254]===Symbol.for(`react.memo_cache_sentinel`)?(vn=(0,Z.jsx)(HF,{}),t[254]=vn):vn=t[254];let yn;t[255]===Te?yn=t[256]:(yn=e=>Te({showHiddenFiles:e}),t[255]=Te,t[256]=yn);let bn=K===null,xn;t[257]===Symbol.for(`react.memo_cache_sentinel`)?(xn=(0,Z.jsx)(J,{id:`XcGbim`}),t[257]=xn):xn=t[257];let Sn;t[258]!==ne||t[259]!==yn||t[260]!==bn?(Sn=(0,Z.jsx)(BF,{checked:ne,onCheckedChange:yn,disabled:bn,"data-testid":`empty-space-menu-show-hidden-files`,children:xn}),t[258]=ne,t[259]=yn,t[260]=bn,t[261]=Sn):Sn=t[261];let Cn;t[262]===Te?Cn=t[263]:(Cn=e=>Te({showOkFolders:e}),t[262]=Te,t[263]=Cn);let wn=K===null,Tn;t[264]===Symbol.for(`react.memo_cache_sentinel`)?(Tn=(0,Z.jsx)(J,{id:`GHsJb8`}),t[264]=Tn):Tn=t[264];let En;t[265]!==re||t[266]!==Cn||t[267]!==wn?(En=(0,Z.jsx)(BF,{checked:re,onCheckedChange:Cn,disabled:wn,"data-testid":`empty-space-menu-show-ok-folders`,children:Tn}),t[265]=re,t[266]=Cn,t[267]=wn,t[268]=En):En=t[268];let Dn;t[269]===Te?Dn=t[270]:(Dn=e=>Te({showOnlyMarkdownFiles:e}),t[269]=Te,t[270]=Dn);let On=K===null,kn;t[271]===Symbol.for(`react.memo_cache_sentinel`)?(kn=(0,Z.jsx)(J,{id:`WkTLN7`}),t[271]=kn):kn=t[271];let An;t[272]!==ie||t[273]!==Dn||t[274]!==On?(An=(0,Z.jsx)(BF,{checked:ie,onCheckedChange:Dn,disabled:On,"data-testid":`empty-space-menu-show-only-markdown-files`,children:kn}),t[272]=ie,t[273]=Dn,t[274]=On,t[275]=An):An=t[275];let jn;t[276]===Te?jn=t[277]:(jn=e=>Te({showSkillsSection:e}),t[276]=Te,t[277]=jn);let Mn=K===null,Nn;t[278]===Symbol.for(`react.memo_cache_sentinel`)?(Nn=(0,Z.jsx)(J,{id:`NF_Wcg`}),t[278]=Nn):Nn=t[278];let Pn;t[279]!==ae||t[280]!==jn||t[281]!==Mn?(Pn=(0,Z.jsx)(BF,{checked:ae,onCheckedChange:jn,disabled:Mn,"data-testid":`empty-space-menu-show-skills-section`,children:Nn}),t[279]=ae,t[280]=jn,t[281]=Mn,t[282]=Pn):Pn=t[282];let Fn;t[283]===ce?Fn=t[284]:(Fn=ce?(0,Z.jsx)(HF,{}):null,t[283]=ce,t[284]=Fn);let In;t[285]!==De||t[286]!==oe?(In=oe?(0,Z.jsxs)(LF,{onSelect:De,"data-testid":`empty-space-menu-expand-all`,children:[(0,Z.jsx)(Uh,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`OlAl5i`})]}):null,t[285]=De,t[286]=oe,t[287]=In):In=t[287];let Ln;t[288]!==ke||t[289]!==se?(Ln=se?(0,Z.jsxs)(LF,{onSelect:ke,"data-testid":`empty-space-menu-collapse-all`,children:[(0,Z.jsx)(Zm,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`qvWGzP`})]}):null,t[288]=ke,t[289]=se,t[290]=Ln):Ln=t[290];let Rn;t[291]!==cn||t[292]!==_n||t[293]!==Sn||t[294]!==En||t[295]!==An||t[296]!==Pn||t[297]!==Fn||t[298]!==In||t[299]!==Ln||t[300]!==Qt||t[301]!==en||t[302]!==rn||t[303]!==on||t[304]!==sn?(Rn=(0,Z.jsxs)(IF,{className:`min-w-52`,onCloseAutoFocus:de,children:[Qt,en,rn,an,on,sn,cn,_n,vn,Sn,En,An,Pn,Fn,In,Ln]}),t[291]=cn,t[292]=_n,t[293]=Sn,t[294]=En,t[295]=An,t[296]=Pn,t[297]=Fn,t[298]=In,t[299]=Ln,t[300]=Qt,t[301]=en,t[302]=rn,t[303]=on,t[304]=sn,t[305]=Rn):Rn=t[305];let zn;return t[306]!==Rn||t[307]!==qt?(zn=(0,Z.jsx)(vN,{variant:`inset`,children:(0,Z.jsxs)(MF,{children:[qt,Rn]})}),t[306]=Rn,t[307]=qt,t[308]=zn):zn=t[308],zn}function IQ(){return null}function LQ(e){return console.log(e)}function RQ(e){return X.error(e)}function zQ(e){return X.success(e)}function BQ(e){e.target instanceof Element&&e.target.closest(`[data-sidebar-root-context]`)||jQ(e.target)&&(e.preventDefault(),e.stopPropagation())}var VQ=(0,Q.lazy)(()=>n(()=>import(`./McpConsentDialogBody-B0VkhB1e.js`),__vite__mapDeps([149,1,6,2,3,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,107,28,50,87,90,35,150]),import.meta.url));function HQ(){let e=(0,$.c)(1);if(!(0,Q.useSyncExternalStore)(kf.subscribe,WQ,UQ))return null;let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(VQ,{})}),e[0]=t):t=e[0],t}function UQ(){return!1}function WQ(){return kf.getSnapshot()!==null}function GQ(){let e=(0,$.c)(4),[t,n]=(0,Q.useState)(!1),r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>Gt(e=>{e===`report-bug`&&n(!0)}),i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,Q.useEffect)(r,i);let a;return e[2]===t?a=e[3]:(a=(0,Z.jsx)(Cp,{open:t,onOpenChange:n}),e[2]=t,e[3]=a),a}function KQ(){let e=(0,$.c)(17),t=Nt(),{collabUrl:n,setSystemProvider:r,updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c}=Re(),l;e[0]!==o||e[1]!==s||e[2]!==a||e[3]!==c||e[4]!==i?(l={updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c},e[0]=o,e[1]=s,e[2]=a,e[3]=c,e[4]=i,e[5]=l):l=e[5];let u=(0,Q.useRef)(l),d;e[6]!==o||e[7]!==s||e[8]!==a||e[9]!==c||e[10]!==i?(d=()=>{u.current={updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c}},e[6]=o,e[7]=s,e[8]=a,e[9]=c,e[10]=i,e[11]=d):d=e[11],(0,Q.useEffect)(d);let f,p;return e[12]!==n||e[13]!==t||e[14]!==r?(f=()=>{if(n===null)return;let e=new pu,i=new mu({url:n,name:fa,document:e,onStateless:e=>{let{payload:t}=e;vu(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:QQ,onConfigValidationRejected:ZQ,onConfigIgnoreNestedError:XQ,onUnknown:YQ})},onClose:JQ,onDisconnect:qQ}),a=ql(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=ke(()=>{u.current.refreshServerInfo()});i.on(`synced`,()=>{Kl([`files`,`backlinks`,`graph`]),o()});let s=new Set,c=()=>{if(i.awareness)for(let[e,t]of i.awareness.getStates().entries())s.has(e)||t.user?.type===`agent`&&(s.add(e),console.warn(`[agent-presence] observed stale AwarenessUser.type === 'agent' from clientID ${e} — probably a stale bundled client`))};return i.awareness?.on(`change`,c),r(i),()=>{a(),i.awareness?.off(`change`,c),r(null),i.destroy(),e.destroy()}},p=[t,n,r],e[12]=n,e[13]=t,e[14]=r,e[15]=f,e[16]=p):(f=e[15],p=e[16]),(0,Q.useEffect)(f,p),null}function qQ(){console.warn(`[CC1] __system__ disconnected - derived views may be stale`)}function JQ(e){let{event:t}=e;console.warn(`[CC1] __system__ connection closed:`,t.code,t.reason)}function YQ(e){console.warn(`[CC1] Unparseable stateless payload, skipping:`,e.slice(0,100))}function XQ(e){gi(e)}function ZQ(e){Ti(e)}function QQ(e){Kl([e.ch])}function $Q(e){let t=ce(e);if(t)return{scope:`project`,name:t};let n=Oa(e);return n?.kind===`skill`?{scope:n.scope,name:n.name}:null}function e$(e,t){let n=new Set(t.map(e=>`${e.scope}\u0000${e.name}`)),r=[];for(let t of e){let e=$Q(t);if(!e||n.has(`${e.scope}\u0000${e.name}`))continue;let i=e.scope===`project`?`global`:`project`;n.has(`${i}\u0000${e.name}`)?r.push({kind:`retarget`,fromDocName:t,toDocName:No(i,e.name)}):r.push({kind:`close`,docName:t})}return r}function t$(){let e=(0,$.c)(13),{openTabs:t,closeDocument:n}=Re(),r;e[0]===t?r=e[1]:(r=t.some(r$),e[0]=t,e[1]=r);let i=r,a;e[2]===i?a=e[3]:(a={enabled:i},e[2]=i,e[3]=a);let o=Gs(a),s=(0,Q.useRef)(null),c;e[4]!==n||e[5]!==t||e[6]!==o.data||e[7]!==o.status?(c=()=>{if(o.status!==`ready`)return;let e=o.data,r=`${t.join(``)}\u0002${e.map(n$).sort().join(``)}`;if(s.current===r)return;s.current=r;let i=e$(t,e);for(let e of i)e.kind===`retarget`?(yc(e.toDocName),n(e.fromDocName)):n(e.docName)},e[4]=n,e[5]=t,e[6]=o.data,e[7]=o.status,e[8]=c):c=e[8];let l;e[9]!==n||e[10]!==t||e[11]!==o?(l=[o,t,n],e[9]=n,e[10]=t,e[11]=o,e[12]=l):l=e[12],(0,Q.useEffect)(c,l)}function n$(e){return`${e.scope}\u0000${e.name}`}function r$(e){return $Q(e)!==null}var i$=1e3,a$=3e4;function o$(e){let t=e.scheduler??{setTimeout:(e,t)=>globalThis.setTimeout(e,t),clearTimeout:e=>globalThis.clearTimeout(e)},n=e.initialBackoffMs??i$,r=e.maxBackoffMs??a$,i=e.rng??Math.random,a=e.createWebSocket??(e=>new WebSocket(e)),o=e.logger??null,s=e.log,c=null,l=null,u=!1,d=n;function f(e,t,n){try{o?o[e](t,n):s?.(t)}catch{}}function p(){if(u)return;l!==null&&t.clearTimeout(l);let e=d;d=Math.min(d*2,r);let n=i(),a=Math.max(1,Math.floor(e*(1-n/2)));f(`debug`,`scheduling reconnect`,{backoffMs:a,ceilMs:e}),l=t.setTimeout(()=>{l=null,m().catch(e=>f(`warn`,`reconnect failed`,{error:String(e)}))},a)}async function m(){if(u)return;let t;try{t=await e.resolveWsUrl()}catch(e){f(`warn`,`resolveWsUrl threw`,{error:String(e)}),p();return}if(!t){p();return}let r=[];e.pid!==void 0&&r.push(`pid=${encodeURIComponent(String(e.pid))}`),e.connectionId&&r.push(`connectionId=${encodeURIComponent(e.connectionId)}`),e.connectionId&&e.displayName!==void 0&&e.clientName!==void 0&&e.colorSeed!==void 0&&(r.push(`displayName=${encodeURIComponent(e.displayName)}`),r.push(`clientName=${encodeURIComponent(e.clientName)}`),r.push(`colorSeed=${encodeURIComponent(e.colorSeed)}`));let i=r.length>0?`?${r.join(`&`)}`:``,o=`${t}/collab/keepalive${i}`;try{c=a(o)}catch(e){f(`warn`,`WebSocket constructor failed`,{url:o,error:String(e)}),c=null,p();return}c.addEventListener(`open`,()=>{f(`info`,`connected`,{url:t}),d=n}),c.addEventListener(`close`,()=>{u||(f(`info`,`disconnected`,{url:t}),c=null,p())}),c.addEventListener(`error`,()=>{f(`debug`,`websocket error observed`,{url:t,readyState:c?.readyState,reason:`error-event`})})}return queueMicrotask(()=>{m().catch(e=>f(`warn`,`initial connect failed`,{error:String(e)}))}),{close:()=>{if(!u&&(u=!0,l!==null&&(t.clearTimeout(l),l=null),c)){try{c.close()}catch{}c=null}},isConnected:()=>c!==null&&c.readyState===1}}function s$(e){if(e)return e.replace(/\/collab\/?$/,``)}function c$(){return yu(window)!==null}function l$(e,t){let n=(0,$.c)(5),r=(0,Q.useRef)(e),i=(0,Q.useRef)(t),a,o;n[0]===e?(a=n[1],o=n[2]):(a=()=>{r.current=e},o=[e],n[0]=e,n[1]=a,n[2]=o),(0,Q.useEffect)(a,o);let s,c;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{let e=i.current?.startKeepalive??o$;if((i.current?.isElectronHost??c$)())return;let t=e({resolveWsUrl:async()=>s$(r.current)});return()=>t.close()},c=[],n[3]=s,n[4]=c):(s=n[3],c=n[4]),(0,Q.useEffect)(s,c)}var u$=(0,Q.lazy)(()=>n(()=>import(`./ShareBranchSwitchDialog-GXTPAgND.js`).then(e=>({default:e.ShareBranchSwitchDialog})),__vite__mapDeps([151,1,10,11,12,23,16,17,18,19,24,25,22,26,82,30,152,90,153,154,155,6,2,3,7,8,9,156]),import.meta.url)),d$=(0,Q.lazy)(()=>n(()=>import(`./ShareReceiveMissDialog-CHR2clGS.js`).then(e=>({default:e.ShareReceiveMissDialog})),__vite__mapDeps([157,1,23,10,11,12,16,17,18,19,24,25,22,26,158,110,6,2,3,7,8,9,73,58,74,75,76,86,90,54,50,21,77,87,30,152,113,31,35,53]),import.meta.url)),f$=`#install-claude-desktop`,p$=/\.(md|mdx)$/i;function m$(e){return Bi(e)||e===f$}function h$(e,t){if(!p$.test(e))return null;for(let n of t){let t=rt(n);if(t.kind===`doc`&&t.docName===e)return{kind:`doc`,target:e,docName:e}}return null}function g$(e,t,n,r){return[e,t,n,r].map(e=>[...e].sort().join(`\0`)).join(``)}function _$(){let e=(0,$.c)(26),{clearTarget:t,openTabs:n,syncOpenTabsWithKnownTargets:r,tabSessionLoaded:i}=Re(),{openTargetTransition:a}=Ye();t$();let{assetPaths:o,filePaths:s,folderPaths:c,loading:l,pageMeta:u,pages:d,pagesBySlug:f,pagesByBasename:p}=Ns(),m=(0,Q.useRef)(null),h;e[0]!==o||e[1]!==s||e[2]!==c||e[3]!==d?(h=g$(d,c,o,s),e[0]=o,e[1]=s,e[2]=c,e[3]=d,e[4]=h):h=e[4];let g=h,_,v;e[5]!==o||e[6]!==s||e[7]!==c||e[8]!==l||e[9]!==d||e[10]!==r||e[11]!==i||e[12]!==g?(_=()=>{l||!i||m.current===g||(m.current=g,r({pages:d,folderPaths:c,assetPaths:o,filePaths:s}))},v=[o,s,c,l,d,r,i,g],e[5]=o,e[6]=s,e[7]=c,e[8]=l,e[9]=d,e[10]=r,e[11]=i,e[12]=g,e[13]=_,e[14]=v):(_=e[13],v=e[14]),(0,Q.useEffect)(_,v);let y,b;return e[15]!==t||e[16]!==c||e[17]!==l||e[18]!==n||e[19]!==a||e[20]!==u||e[21]!==d||e[22]!==p||e[23]!==f?(y=()=>{e();function e(){if(m$(window.location.hash))return;let e=ou(window.location.hash);if(e){let t=Ga(e.split(`.`).pop()??``);Zl(`ok/nav/hash-change`,{docName:null,kind:`asset`}),a({kind:`asset`,target:e,assetPath:e,mediaKind:t});return}let r=ru(window.location.hash);if(r){Zl(`ok/nav/hash-change`,{docName:null,kind:`skill-file`}),a({kind:`skill-file`,target:`${r.scope}/${r.name}/${r.path}`,scope:r.scope,name:r.name,path:r.path});return}if(du(window.location.hash)){Zl(`ok/nav/hash-change`,{docName:null,kind:`folder`}),a({kind:`folder`,target:``,folderPath:``});return}let i=cu(window.location.hash);if(!i){Zl(`ok/nav/hash-change`,{docName:null,kind:`clear`}),t();return}if(l){Zl(`ok/nav/hash-change`,{docName:i,kind:`deferred-loading`});return}let o=h$(i,n)??Rl(i,{pages:d,folderPaths:c,pagesBySlug:f,pagesByBasename:p});if(o.kind===`missing`&&/\/+$/.test(i.trim())){Zl(`ok/nav/hash-change`,{docName:i,kind:`deferred-missing-folder`});return}let s=Bl(zl(o),u);Zl(`ok/nav/hash-change`,{docName:i,kind:s.kind}),a(s)}return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},b=[t,c,l,a,n,u,d,f,p],e[15]=t,e[16]=c,e[17]=l,e[18]=n,e[19]=a,e[20]=u,e[21]=d,e[22]=p,e[23]=f,e[24]=y,e[25]=b):(y=e[24],b=e[25]),(0,Q.useEffect)(y,b),null}function v$(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0],(0,Q.useEffect)(y$,t),null}function y$(){let e=function(e){let t=e.target;$i({target:t,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,key:e.key})&&(e.preventDefault(),window.location.hash!==`#settings`&&(window.location.hash=Gi))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)}function b$(){let e=(0,$.c)(4),{activeTarget:t}=Re(),n=typeof window<`u`?window.okDesktop??null:null,r=t?.kind===`doc`||t?.kind===`folder`||t?.kind===`asset`?t.kind:null,i=t?.kind===`doc`?t.docName:t?.kind===`folder`?t.folderPath:t?.kind===`asset`?t.assetPath:null,a,o;return e[0]!==i||e[1]!==r?(a=()=>{if(n){if(r===null){n.editor.notifyActiveTargetChanged({kind:null});return}i!==null&&n.editor.notifyActiveTargetChanged({kind:r,identifier:i})}},o=[n,r,i],e[0]=i,e[1]=r,e[2]=a,e[3]=o):(a=e[2],o=e[3]),(0,Q.useEffect)(a,o),null}function x$(){let e=(0,$.c)(8),{activeDocName:t,activeTarget:n}=Re(),[r,i]=(0,Q.useState)(!1),a;e[0]!==t||e[1]!==n?(a=n?.kind===`folder`?n.folderPath:Nl(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;p_({target:t,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,key:e.key})&&(e.preventDefault(),i(!0))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},c=[],e[3]=s,e[4]=c):(s=e[3],c=e[4]),(0,Q.useEffect)(s,c);let l;return e[5]!==r||e[6]!==o?(l=(0,Z.jsx)(h_,{open:r,onOpenChange:i,kind:`file`,initialDir:o}),e[5]=r,e[6]=o,e[7]=l):l=e[7],l}function S$(e){let t=(0,$.c)(3),{children:n}=e,{collabUrl:r}=Re();l$(r);let i;return t[0]!==n||t[1]!==r?(i=(0,Z.jsx)(gu,{collabUrl:r,children:n}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i}function C$(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(Ql,{name:`app`,children:(0,Z.jsx)(tt,{children:(0,Z.jsx)(S$,{children:(0,Z.jsx)(tv,{children:(0,Z.jsx)(w$,{})})})})}),e[0]=t):t=e[0],t}function w$(){let e=(0,$.c)(30),t=typeof window<`u`?window.okDesktop??null:null,n=typeof window<`u`&&window.okDesktop!=null,[r,i]=(0,Q.useState)(!1),a=iv(),o=md(),s;e[0]===o?s=e[1]:(s=t&&t.config.ptyAvailable===!0?{launchInTerminal:T$,installedClis:o}:null,e[0]=o,e[1]=s);let c=s,l;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(jv,{}),e[2]=l):l=e[2];let u,d,f,p;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(KQ,{}),d=(0,Z.jsx)(_$,{}),f=(0,Z.jsx)(b$,{}),p=(0,Z.jsx)(x$,{}),e[3]=u,e[4]=d,e[5]=f,e[6]=p):(u=e[3],d=e[4],f=e[5],p=e[6]);let m;e[7]===a?m=e[8]:(m=!a&&(0,Z.jsx)(v$,{}),e[7]=a,e[8]=m);let h,g,_,v,y,b;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(v=!1,y=t?(0,Z.jsx)(Mv,{bridge:t}):null,b=t?(0,Z.jsx)(Bv,{}):null,h=t?(0,Z.jsx)(GQ,{}):null,g=(0,Z.jsx)(HQ,{}),_=t?(0,Z.jsxs)(Q.Suspense,{fallback:null,children:[(0,Z.jsx)(u$,{bridge:t}),(0,Z.jsx)(d$,{})]}):null,e[9]=h,e[10]=g,e[11]=_,e[12]=v,e[13]=y,e[14]=b):(h=e[9],g=e[10],_=e[11],v=e[12],y=e[13],b=e[14]);let x;e[15]===r?x=e[16]:(x=(0,Z.jsx)(bv,{bridge:t,open:r,onOpenChange:i}),e[15]=r,e[16]=x);let S;e[17]===Symbol.for(`react.memo_cache_sentinel`)?(S=n&&(0,Z.jsx)(`div`,{"aria-hidden":`true`,"data-testid":`editor-window-chrome-drag-strip`,"data-electron-drag":``,className:`pointer-events-none fixed inset-x-0 top-0 z-50 h-2 [-webkit-app-region:drag]`}),e[17]=S):S=e[17];let C;e[18]===a?C=e[19]:(C=!a&&(0,Z.jsx)(MQ,{onOpenSearch:()=>i(!0)}),e[18]=a,e[19]=C);let w;e[20]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(xN,{className:`overflow-hidden h-[calc(100vh-var(--layout-inset-offset))]`,children:(0,Z.jsx)(iL,{onOpenSearch:()=>i(!0)})}),e[20]=w):w=e[20];let T;e[21]===C?T=e[22]:(T=(0,Z.jsxs)(hN,{className:`h-screen overflow-hidden`,children:[C,w]}),e[21]=C,e[22]=T);let E;e[23]!==T||e[24]!==c?(E=(0,Z.jsx)(Qs,{value:c,children:T}),e[23]=T,e[24]=c,e[25]=E):E=e[25];let D;return e[26]!==x||e[27]!==E||e[28]!==m?(D=(0,Z.jsxs)(Z.Fragment,{children:[l,(0,Z.jsxs)(Ps,{children:[u,d,f,p,m,v,y,b,h,g,_,x,S,E]})]}),e[26]=x,e[27]=E,e[28]=m,e[29]=D):D=e[29],D}function T$(e,t){Wc(Ws(e,t),t)}function E$(e){let t=/\/([^/]+?)(?:\.git)?\/?$/.exec(e);return t?t[1]:`repo`}function D$(e){return{async getAuthStatus(t){return e.authQueryTransport.status(t?{host:t}:void 0)},async startSignIn(){return e.openSignIn()},async runClone({url:t,branch:n}){let r=await e.bridge.dialog.openFolder();if(!r)return{kind:`cancelled`};let i=E$(t),a=`${r.replace(/\/$/,``)}/${i}`,o=X.loading(yl._({id:`GXf9hG`,values:{repoName:i}}),{duration:1/0}),s=typeof n==`string`&&n.length>0?n:null;try{let n=e.cloneTransport.start({url:t,dir:a,branch:s});for await(let e of n.events){if(e.type===`progress`){let t=e.phase,n=Math.round(e.pct);X.loading(yl._({id:`GXf9hG`,values:{repoName:i}}),{id:o,description:yl._({id:`SCzAbA`,values:{phase:t,pct:n}}),duration:1/0});continue}if(e.type===`branch-fallback`){console.log(jf({branch_action:`fallback`,branch:e.branch})),X.info(yl._({id:`3JYy1p`,values:{0:e.branch}}),{duration:8e3});continue}if(e.type===`complete`)return X.success(yl._({id:`IRv9cH`,values:{repoName:i}}),{id:o,duration:4e3}),{kind:`ok`,dir:e.dir};if(e.type===`error`)return X.dismiss(o),{kind:`error`,detail:e.message}}return X.dismiss(o),{kind:`error`,detail:`Clone ended unexpectedly.`}}catch(e){console.warn(`[clone-controller] clone transport threw`,e);let t=e instanceof Error?e.message:`Unknown error`;return X.dismiss(o),{kind:`error`,detail:t}}}}}function O$(){return{start(e){return ui((t,n)=>{(async()=>{try{let r=await fetch(`/api/local-op/clone`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({url:e.url,dir:e.dir||void 0,branch:typeof e.branch==`string`&&e.branch.length>0?e.branch:void 0}),signal:n});if(!r.ok){let e=`Clone failed — check the URL and try again (${r.status})`;try{let t=await r.json(),n=_o.safeParse(t);n.success&&(e=`Clone failed: ${n.data.title}`)}catch{}t({type:`error`,message:e});return}if(!r.body){t({type:`error`,message:`Clone failed — empty response body`});return}let i=r.body.getReader(),a=new TextDecoder,o=``;for(;;){let{done:e,value:r}=await i.read();if(e)break;o+=a.decode(r,{stream:!0});let s=o.split(`
1995
- `);o=s.pop()??``;for(let e of s){if(!e.trim())continue;let n;try{n=JSON.parse(e)}catch{console.warn(`[clone-transport] Dropped unparseable NDJSON line:`,e.slice(0,100));continue}if(n&&typeof n==`object`&&n.type===`error`&&`problem`in n){let e=n.problem;t({type:`error`,message:e?.detail||e?.title||`Unknown error`});break}t(n)}if(n.aborted)break}n.aborted||t({type:`error`,message:`Clone stream ended unexpectedly — check if the clone completed`})}catch(e){if(e instanceof Error&&e.name===`AbortError`)return;t({type:`error`,message:`Clone failed — connection error`})}})()})}}}function k$(e){return{start(t){let n=typeof t.branch==`string`&&t.branch.length>0?t.branch:null;return e.localOp.clone.start({url:t.url,dir:t.dir,branch:n})}}}function A$(e){switch(e){case`receiving`:return{id:`qbfj1f`};case`resolving`:return{id:`adsMWO`};case`checking`:return{id:`1HBhDS`};case`init`:return{id:`LlHqdU`};case`done`:return{id:`bD8I7O`};default:return{id:`25Pw6a`}}}function j$(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 M$(e){let t=(0,$.c)(100),{open:n,onOpenChange:r,onSignIn:i,onCloneComplete:a,transport:o,authQueryTransport:s,pickParentFolder:c,initialUrl:l}=e,{_:u}=vt(),d;t[0]===o?d=t[1]:(d=o??O$(),t[0]=o,t[1]=d);let f=d,p;t[2]===s?p=t[3]:(p=s??Qr(),t[2]=s,t[3]=p);let m=p,h=c!==void 0,[g,_]=(0,Q.useState)(``),[v,y]=(0,Q.useState)(``),[b,x]=(0,Q.useState)(null),[S,C]=(0,Q.useState)(!1),w;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(w=Di(),t[4]=w):w=t[4];let[T,E]=(0,Q.useState)(w),[D,O]=(0,Q.useState)(!1),[k,A]=(0,Q.useState)(!1),[j,M]=(0,Q.useState)(-1),N=(0,Q.useRef)(null),P=(0,Q.useRef)(null),F=(0,Q.useRef)(null),I=(0,Q.useId)(),L;t[5]!==n||t[6]!==m?(L=()=>{if(!n)return;let e=!1;return m.status().then(t=>{Si(t.authenticated),e||E(t.authenticated)}).catch(()=>{e||E(!1)}),()=>{e=!0}},t[5]=n,t[6]=m,t[7]=L):L=t[7];let R;t[8]===n?R=t[9]:(R=[n],t[8]=n,t[9]=R),(0,Q.useEffect)(L,R);let z;t[10]!==T||t[11]!==n||t[12]!==m?(z=()=>{if(!T||!n)return;let e=!1;return C(!0),m.repos().then(t=>{e||(x(t.ok?t.repos:[]),C(!1))}).catch(()=>{e||(x([]),C(!1))}),()=>{e=!0}},t[10]=T,t[11]=n,t[12]=m,t[13]=z):z=t[13];let B;t[14]!==T||t[15]!==n?(B=[T,n],t[14]=T,t[15]=n,t[16]=B):B=t[16],(0,Q.useEffect)(z,B);let V,H;t[17]!==l||t[18]!==n||t[19]!==h?(V=()=>{if(!n||!l||(_(l),h))return;let e=j$(l);e&&y(`~/Documents/${e}`)},H=[n,l,h],t[17]=l,t[18]=n,t[19]=h,t[20]=V,t[21]=H):(V=t[20],H=t[21]),(0,Q.useEffect)(V,H);let U,W;t[22]!==j||t[23]!==I?(U=()=>{j<0||document.getElementById(`${I}-opt-${j}`)?.scrollIntoView({block:`nearest`})},W=[j,I],t[22]=j,t[23]=I,t[24]=U,t[25]=W):(U=t[24],W=t[25]),(0,Q.useEffect)(U,W);let ee;t[26]===h?ee=t[27]:(ee=function(e){if(_(e),A(!0),M(-1),h)return;let t=j$(e);t&&y(`~/Documents/${t}`)},t[26]=h,t[27]=ee);let G=ee,K;t[28]===h?K=t[29]:(K=function(e){if(_(e.clone_url),h)return;let t=e.full_name.split(`/`)[1];y(`~/Documents/${t}`)},t[28]=h,t[29]=K);let te=K,ne;t[30]!==u||t[31]!==v||t[32]!==a||t[33]!==r||t[34]!==c||t[35]!==f||t[36]!==g?(ne=async function(){let e=g.trim();if(!e){X.error(u({id:`FTUGgh`}));return}let t=v||``;if(c){O(!0);let n=await c();if(!n){O(!1);return}let r=j$(e);t=`${n.replace(/\/$/,``)}/${r}`}else O(!0);let n=X.loading(u({id:`2tgFCe`}),{duration:1/0});P.current=n;let i=f.start({url:e,dir:t});N.current=i.cancel;try{let e=i.events[Symbol.asyncIterator](),t=await e.next();for(;!t.done;){let i=t.value;if(i.type===`progress`){let e=u(A$(i.phase));X.loading(`${e} — ${i.pct}%`,{id:n})}else if(i.type===`complete`){X.success(u({id:`u_lS4C`}),{id:n}),r(!1),O(!1),N.current=null;let e=`port`in i?i.port:void 0;a?a({port:e,dir:i.dir}):e!==void 0&&(window.location.href=`http://localhost:${e}`);return}else if(i.type===`error`){let e=i.message;X.error(u({id:`eFJkVt`,values:{cloneError:e}}),{id:n}),O(!1),N.current=null;return}t=await e.next()}X.error(u({id:`Tz9pJB`}),{id:n}),O(!1),N.current=null}catch(e){console.error(`[CloneDialog] clone iteration failed:`,e),X.error(u({id:`K9J00P`}),{id:n}),O(!1),N.current=null}},t[30]=u,t[31]=v,t[32]=a,t[33]=r,t[34]=c,t[35]=f,t[36]=g,t[37]=ne):ne=t[37];let re=ne,ie;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(ie=function(){N.current?.(),N.current=null,O(!1),X.dismiss(P.current??void 0)},t[38]=ie):ie=t[38];let ae=ie,oe;t[39]!==D||t[40]!==r||t[41]!==h?(oe=function(e){D||(r(e),e||(_(``),h||y(``),A(!1),M(-1)))},t[39]=D,t[40]=r,t[41]=h,t[42]=oe):oe=t[42];let se=oe,ce;t[43]===te?ce=t[44]:(ce=function(e){te(e),A(!1),M(-1),F.current?.focus()},t[43]=te,t[44]=ce);let le=ce,ue=T===null||S&&b===null,de;if(t[45]!==b||t[46]!==g){let e=g.trim().toLowerCase(),n;t[48]===b?n=t[49]:(n=b??[],t[48]=b,t[49]=n),de=n.filter(t=>`${t.full_name} ${t.clone_url}`.toLowerCase().includes(e)),t[45]=b,t[46]=g,t[47]=de}else de=t[47];let fe=de,pe;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(pe=/:\/\/|^git@|\.git$/i,t[50]=pe):pe=t[50];let q;t[51]===g?q=t[52]:(q=pe.test(g.trim()),t[51]=g,t[52]=q);let me=q,he=T===!0&&b!==null&&fe.length===0&&!me,ge=k&&T!==!1&&!D&&(ue||fe.length>0||he),_e=fe.length,ve=`${I}-loading`,ye,be;t[53]===_e?(ye=t[54],be=t[55]):(ye=()=>{M(e=>e>=_e?_e-1:e)},be=[_e],t[53]=_e,t[54]=ye,t[55]=be),(0,Q.useEffect)(ye,be);let xe;t[56]!==j||t[57]!==D||t[58]!==ge||t[59]!==le||t[60]!==fe?(xe=function(e){if(!D)if(e.key===`ArrowDown`){if(e.preventDefault(),!ge){A(!0);return}M(e=>Math.min(e+1,fe.length-1))}else e.key===`ArrowUp`?(e.preventDefault(),M(R$)):e.key===`Enter`?ge&&j>=0&&j<fe.length&&(e.preventDefault(),le(fe[j])):e.key===`Escape`&&ge&&(e.preventDefault(),e.stopPropagation(),A(!1),M(-1))},t[56]=j,t[57]=D,t[58]=ge,t[59]=le,t[60]=fe,t[61]=xe):xe=t[61];let Se=xe,Ce;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=(0,Z.jsx)(xn,{children:(0,Z.jsx)(_n,{children:(0,Z.jsx)(J,{id:`VdXv4D`})})}),t[62]=Ce):Ce=t[62];let we;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(we=(0,Z.jsx)(`label`,{htmlFor:`clone-source`,className:`text-sm font-medium`,children:(0,Z.jsx)(J,{id:`IreQBq`})}),t[63]=we):we=t[63];let Te;t[64]!==u||t[65]!==j||t[66]!==D||t[67]!==Se||t[68]!==G||t[69]!==T||t[70]!==I||t[71]!==ve||t[72]!==i||t[73]!==ge||t[74]!==ue||t[75]!==b||t[76]!==le||t[77]!==fe||t[78]!==g?(Te=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[we,T===!1?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(vl,{id:`clone-source`,placeholder:u({id:`Xv_ijG`}),value:g,onChange:e=>G(e.target.value),disabled:D}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-1sm text-muted-foreground`,children:[(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`9oE4C3`})}),(0,Z.jsx)(Y,{variant:`link`,className:`h-auto p-0`,onClick:()=>i?.(),disabled:D,children:(0,Z.jsx)(J,{id:`3jod3l`})})]})]}):(0,Z.jsxs)(Ut,{open:ge,onOpenChange:A,children:[(0,Z.jsx)(qt,{asChild:!0,children:(0,Z.jsx)(vl,{id:`clone-source`,ref:F,role:`combobox`,"aria-expanded":ge,"aria-controls":ge?ue?ve:I:void 0,"aria-activedescendant":j>=0?`${I}-opt-${j}`:void 0,"aria-autocomplete":`list`,autoComplete:`off`,placeholder:u({id:`R0jJzV`}),value:g,onChange:e=>G(e.target.value),onFocus:()=>A(!0),onKeyDown:Se,disabled:D})}),(0,Z.jsx)(Yt,{align:`start`,sideOffset:4,className:`w-(--radix-popover-trigger-width) max-h-56 overflow-y-auto overscroll-y-contain subtle-scrollbar p-0`,onOpenAutoFocus:L$,onCloseAutoFocus:I$,onInteractOutside:e=>{F.current?.contains(e.target)&&e.preventDefault()},onWheel:F$,onTouchMove:P$,children:ue?(0,Z.jsxs)(`output`,{id:ve,className:`flex flex-col gap-1.5 px-3 py-2`,"aria-label":u({id:`8XQRON`}),children:[(0,Z.jsx)(Cd,{className:`h-4 w-2/3`}),(0,Z.jsx)(Cd,{className:`h-4 w-1/2`}),(0,Z.jsx)(Cd,{className:`h-4 w-3/4`}),(0,Z.jsx)(Cd,{className:`h-4 w-2/5`})]}):(0,Z.jsx)(`div`,{id:I,role:`listbox`,"aria-label":u({id:`KX1MZR`}),className:`py-1`,children:fe.length===0?(0,Z.jsx)(`div`,{role:`presentation`,className:`px-3 py-2 text-xs text-muted-foreground`,children:b&&b.length===0?(0,Z.jsx)(J,{id:`cOSAfL`}):(0,Z.jsx)(J,{id:`8eW0WQ`})}):fe.map((e,t)=>(0,Z.jsxs)(`div`,{id:`${I}-opt-${t}`,role:`option`,tabIndex:-1,"aria-selected":t===j,onMouseDown:N$,onMouseEnter:()=>M(t),onClick:()=>le(e),className:$t(`flex cursor-default items-center gap-2 px-3 py-1.5 text-sm`,t===j&&`bg-accent text-accent-foreground`),children:[e.private?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ls,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`n5n_vi`})})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Fs,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`NuH1jp`})})]}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.full_name})]},e.full_name))})})]})]}),t[64]=u,t[65]=j,t[66]=D,t[67]=Se,t[68]=G,t[69]=T,t[70]=I,t[71]=ve,t[72]=i,t[73]=ge,t[74]=ue,t[75]=b,t[76]=le,t[77]=fe,t[78]=g,t[79]=Te):Te=t[79];let Ee;t[80]!==D||t[81]!==v||t[82]!==h?(Ee=!h&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`label`,{htmlFor:`clone-path`,className:`text-sm font-medium`,children:(0,Z.jsx)(J,{id:`Gp_twO`})}),(0,Z.jsx)(vl,{id:`clone-path`,placeholder:`~/Documents/repo-name`,value:v,onChange:e=>y(e.target.value),disabled:D})]}),t[80]=D,t[81]=v,t[82]=h,t[83]=Ee):Ee=t[83];let De;t[84]!==Te||t[85]!==Ee?(De=(0,Z.jsx)(yn,{children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[Te,Ee]})}),t[84]=Te,t[85]=Ee,t[86]=De):De=t[86];let Oe;t[87]!==D||t[88]!==re||t[89]!==se||t[90]!==g||t[91]!==h?(Oe=(0,Z.jsx)(bn,{children:D?(0,Z.jsx)(Y,{variant:`outline`,className:`font-mono uppercase`,onClick:ae,children:(0,Z.jsx)(J,{id:`dEgA5A`})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Y,{variant:`outline`,className:`font-mono uppercase`,onClick:()=>se(!1),children:(0,Z.jsx)(J,{id:`dEgA5A`})}),(0,Z.jsx)(Y,{onClick:()=>void re(),disabled:!g.trim(),"aria-describedby":h?`clone-picker-hint`:void 0,children:(0,Z.jsx)(J,{id:`9UQ730`})}),h&&(0,Z.jsx)(`span`,{id:`clone-picker-hint`,className:`sr-only`,children:(0,Z.jsx)(J,{id:`EvPX7f`})})]})}),t[87]=D,t[88]=re,t[89]=se,t[90]=g,t[91]=h,t[92]=Oe):Oe=t[92];let ke;t[93]!==De||t[94]!==Oe?(ke=(0,Z.jsxs)(vn,{className:`sm:max-w-lg`,children:[Ce,De,Oe]}),t[93]=De,t[94]=Oe,t[95]=ke):ke=t[95];let Ae;return t[96]!==se||t[97]!==n||t[98]!==ke?(Ae=(0,Z.jsx)(Sn,{open:n,onOpenChange:se,children:ke}),t[96]=se,t[97]=n,t[98]=ke,t[99]=Ae):Ae=t[99],Ae}function N$(e){return e.preventDefault()}function P$(e){return e.stopPropagation()}function F$(e){return e.stopPropagation()}function I$(e){return e.preventDefault()}function L$(e){return e.preventDefault()}function R$(e){return Math.max(e-1,-1)}var z$=(0,Q.lazy)(()=>n(()=>import(`./ConsentDialogBody-D9xWEY09.js`),__vite__mapDeps([159,1,10,11,12,13,14,15,16,17,18,19,20,21,22,80,23,24,25,26,84,90,160,107,108,40,41,28,87,33,34]),import.meta.url));function B$(){let e=(0,$.c)(1);if(!(0,Q.useSyncExternalStore)(_l.subscribe,H$,V$))return null;let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(z$,{})}),e[0]=t):t=e[0],t}function V$(){return!1}function H$(){return _l.getSnapshot()!==null}function U$(e){let t=(0,$.c)(5),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`OpenKnowledge icon`}),t[0]=n):n=t[0];let r;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsxs)(`g`,{filter:`url(#filter0_d_ok)`,children:[(0,Z.jsx)(`path`,{d:`M66.8902 16.1017C58.2694 3.86669 46.1739 -0.690239 29.9182 2.17749C21.3995 3.67813 13.4602 9.555 8.67934 17.9009C3.93974 26.1701 2.98514 35.6533 6.05714 43.9166C9.31574 52.6868 16.7168 58.4752 24.2299 63.4231C25.7973 64.4562 26.1351 65.7172 26.3551 68.9896C26.5221 71.4625 26.799 75.6011 30.6842 77.7204C31.8176 78.3372 33.0648 78.6515 34.3946 78.6515C37.0796 78.6515 39.4033 77.3649 40.5189 76.7482C47.1049 73.1046 68.8878 59.7147 72.6453 40.4027C74.3444 31.6679 70.9797 21.9019 66.8922 16.1017H66.8902Z`,fill:`white`}),(0,Z.jsx)(`path`,{d:`M37.4214 71.154C28.7888 75.929 36.787 64.0397 27.7458 58.0843C21.6372 54.0616 14.788 49.0568 12.0499 41.6911C6.74463 27.4192 17.5438 10.8473 31.028 8.47262C45.1977 5.97613 54.6946 9.8947 61.6635 19.7844C65.2089 24.8167 67.6013 32.8365 66.3658 39.1828C63.6906 52.9341 49.073 64.7075 37.4214 71.154Z`,fill:`#69A3FF`}),(0,Z.jsx)(`path`,{d:`M52.7244 29.2638C53.4665 28.5217 54.6697 28.5217 55.4119 29.2638V29.2638C56.154 30.0059 56.154 31.2091 55.4119 31.9513L49.2589 38.1042L46.5715 35.4167L52.7244 29.2638Z`,fill:`#D5E5FF`}),(0,Z.jsx)(`path`,{d:`M55.4119 38.8821C56.154 39.6242 56.154 40.8274 55.4119 41.5696V41.5696C54.6698 42.3117 53.4665 42.3117 52.7244 41.5696L46.5715 35.4166L49.259 32.7292L55.4119 38.8821Z`,fill:`#D5E5FF`})]}),t[1]=r):r=t[1];let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(`defs`,{children:(0,Z.jsxs)(`filter`,{id:`filter0_d_ok`,x:`-9.53674e-07`,y:`-0.0799994`,width:`77.3817`,height:`85.8743`,filterUnits:`userSpaceOnUse`,colorInterpolationFilters:`sRGB`,children:[(0,Z.jsx)(`feFlood`,{floodOpacity:`0`,result:`BackgroundImageFix`}),(0,Z.jsx)(`feColorMatrix`,{in:`SourceAlpha`,type:`matrix`,values:`0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0`,result:`hardAlpha`}),(0,Z.jsx)(`feOffset`,{dy:`2.85714`}),(0,Z.jsx)(`feGaussianBlur`,{stdDeviation:`2.14286`}),(0,Z.jsx)(`feComposite`,{in2:`hardAlpha`,operator:`out`}),(0,Z.jsx)(`feColorMatrix`,{type:`matrix`,values:`0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 0`}),(0,Z.jsx)(`feBlend`,{mode:`normal`,in2:`BackgroundImageFix`,result:`effect1_dropShadow_ok`}),(0,Z.jsx)(`feBlend`,{mode:`normal`,in:`SourceGraphic`,in2:`effect1_dropShadow_ok`,result:`shape`})]})}),t[2]=i):i=t[2];let a;return t[3]===e?a=t[4]:(a=(0,Z.jsxs)(`svg`,{role:`img`,"aria-label":`OpenKnowledge icon`,fill:`none`,height:24,width:24,viewBox:`0 0 78 80`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[n,r,i]}),t[3]=e,t[4]=a),a}var W$=(0,Q.lazy)(()=>n(()=>import(`./ShareReceiveDialog-IVAS4xf8.js`).then(e=>({default:e.ShareReceiveDialog})),__vite__mapDeps([161,1,6,2,3,7,8,9,10,11,12,23,16,17,18,19,24,25,22,26,30,90,153,154,155]),import.meta.url)),G$=(0,Q.lazy)(()=>n(()=>import(`./AppMenubar-DqlpmcU7.js`).then(e=>({default:e.AppMenubar})),__vite__mapDeps([144,1,10,11,12,16,17,18,19,40,106,14,15,24,41,21,84,22]),import.meta.url)),K$=(e,t,n)=>Q_(e,t,n,`NavigatorApp`);function q$(e,t){return e.filter(e=>e.path!==t)}function J$(e){let t=(0,$.c)(112),{bridge:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=[],t[0]=r):r=t[0];let[i,a]=(0,Q.useState)(r),o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=new Map,t[1]=o):o=t[1];let[s,c]=(0,Q.useState)(o),[l,u]=(0,Q.useState)(!0),[d,f]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(null),[_,v]=(0,Q.useState)(!1),[y,b]=(0,Q.useState)(!1),[x,S]=(0,Q.useState)(!1),[C,w]=(0,Q.useState)(void 0),[T,E]=(0,Q.useState)(void 0),[D,O]=(0,Q.useState)(!1),[k,A]=(0,Q.useState)(!1),[j,M]=(0,Q.useState)(null),N=typeof window<`u`&&window.okDesktop!=null,[P,F]=(0,Q.useState)(`auth`),{theme:I}=zt(),{_:L}=vt();hu(n,I??`system`);let R;t[2]!==L||t[3]!==n.project?(R=()=>{let e=!1;return n.project.listRecent().then(async t=>{if(e)return;a(t);let r=t.filter(Y$),i=await Promise.all(r.map(async e=>{try{let{currentBranch:t}=await n.project.readHeadBranch(e.path);return[e.path,t]}catch{return[e.path,null]}}));e||c(e=>{let t=new Map(e);for(let[e,n]of i)t.set(e,n);return t})}).catch(t=>{console.error(`[NavigatorApp] listRecent failed:`,t),e||(m(t instanceof Error?t.message:L({id:`fYKgzG`})),f(!0))}).finally(()=>{e||u(!1)}),()=>{e=!0}},t[2]=L,t[3]=n.project,t[4]=R):R=t[4];let z;t[5]!==L||t[6]!==n?(z=[n,L],t[5]=L,t[6]=n,t[7]=z):z=t[7],(0,Q.useEffect)(R,z);let B,V;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(B=()=>Gt(e=>{e===`new-project`&&b(!0),e===`report-bug`&&S(!0),e===`close-active-tab-or-window`&&window.close()}),V=[],t[8]=B,t[9]=V):(B=t[8],V=t[9]),(0,Q.useEffect)(B,V);let H;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(H=(e,t)=>K$(e,t,m),t[10]=H):H=t[10];let U=H,W;t[11]!==L||t[12]!==n?(W=(e,t,r)=>U(()=>(g(r),$$(n,e,t).finally(()=>g(null))),L({id:`SUOoXn`})),t[11]=L,t[12]=n,t[13]=W):W=t[13];let ee=W,G;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(G=()=>v(!0),t[14]=G):G=t[14];let K=G,te;t[15]!==L||t[16]!==n?(te=()=>U(async()=>{let e=await n.dialog.openFolder();e&&(g(e1(e)),await $$(n,e,`pick-existing`).finally(()=>g(null)))},L({id:`gmJ0An`})),t[15]=L,t[16]=n,t[17]=te):te=t[17];let ne=te,re;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(re=()=>b(!0),t[18]=re):re=t[18];let ie=re,ae;t[19]!==L||t[20]!==n.project?(ae=()=>U(()=>n.project.openFile(),L({id:`8vCZcs`})),t[19]=L,t[20]=n.project,t[21]=ae):ae=t[21];let oe=ae,se;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(se=(e,t)=>{w(e),E(t),b(!0)},t[22]=se):se=t[22];let ce=se,le;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(le=e=>{b(e),e||(w(void 0),E(void 0))},t[23]=le):le=t[23];let ue=le,de;t[24]===ee?de=t[25]:(de=e=>ee(e,`recents`,e1(e)),t[24]=ee,t[25]=de);let fe=de,pe;t[26]!==L||t[27]!==n.project?(pe=e=>U(async()=>{await n.project.removeRecent(e),a(t=>q$(t,e)),c(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},L({id:`viwC-K`})),t[26]=L,t[27]=n.project,t[28]=pe):pe=t[28];let q=pe,me;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,Z.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 top-0 z-10 h-9 ${N?`[-webkit-app-region:drag]`:``}`,"data-electron-drag":N?``:void 0,"data-testid":`nav-chrome-row`,children:PP()&&(0,Z.jsx)(`div`,{className:`pointer-events-auto flex h-full items-center px-2`,children:(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(G$,{})})})}),t[29]=me):me=t[29];let he;t[30]!==L||t[31]!==h?(he=h===null?null:(0,Z.jsxs)(`div`,{className:`absolute inset-0 z-20 flex flex-col items-center justify-center gap-3 bg-primary-foreground/85 dark:bg-background/85 backdrop-blur-sm`,"data-testid":`nav-opening-overlay`,role:`status`,"aria-live":`polite`,children:[(0,Z.jsx)(Zc,{className:`size-6 animate-spin text-muted-foreground`}),(0,Z.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:L({id:`s0_GnA`,values:{openingLabel:h}})})]}),t[30]=L,t[31]=h,t[32]=he):he=t[32];let ge;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,Z.jsx)(U$,{className:`size-12 shrink-0`}),t[33]=ge):ge=t[33];let _e;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(_e=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`h1`,{className:`font-medium text-xl tracking-tight`,children:`OpenKnowledge`}),(0,Z.jsx)(gF,{})]}),t[34]=_e):_e=t[34];let ve;t[35]===n.appVersion?ve=t[36]:(ve=(0,Z.jsxs)(`header`,{className:`shrink-0 flex-wrap flex items-center gap-2.5`,children:[ge,(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[_e,(0,Z.jsxs)(`p`,{className:`text-muted-foreground text-xs font-mono`,children:[`v`,n.appVersion]})]})]}),t[35]=n.appVersion,t[36]=ve);let ye;t[37]!==L||t[38]!==l||t[39]!==oe||t[40]!==ne||t[41]!==i||t[42]!==d?(ye=l?null:!d&&i.length===0?(0,Z.jsx)(Z$,{onPackSelect:ce,onOpenFolder:ne,onOpenFile:oe,onClone:K,onCreate:ie}):(0,Z.jsxs)(`section`,{className:`grid shrink-0 sm:grid-cols-2 gap-3`,children:[(0,Z.jsx)(X$,{title:L({id:`wbv9xO`}),description:L({id:`0uTHCg`}),onClick:ie,dataTestId:`nav-create-new`,Icon:Kt}),(0,Z.jsx)(X$,{title:L({id:`WPwDin`}),description:L({id:`tUvUfp`}),onClick:ne,dataTestId:`nav-open`,Icon:gc}),(0,Z.jsx)(X$,{title:L({id:`ka6Eke`}),description:L({id:`gOD68k`}),onClick:oe,dataTestId:`nav-open-file`,Icon:qn}),(0,Z.jsx)(X$,{title:L({id:`VdXv4D`}),description:L({id:`JOcPqH`}),onClick:K,dataTestId:`nav-clone`,Icon:pg})]}),t[37]=L,t[38]=l,t[39]=oe,t[40]=ne,t[41]=i,t[42]=d,t[43]=ye):ye=t[43];let be;t[44]===p?be=t[45]:(be=p===null?null:(0,Z.jsxs)(`div`,{className:`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,Z.jsx)(`span`,{className:`text-red-700 text-xs dark:text-red-300`,children:p}),(0,Z.jsx)(Y,{type:`button`,variant:`link`,size:`sm`,onClick:()=>m(null),className:`h-auto p-0 text-red-700 text-xs dark:text-red-300`,"data-testid":`nav-error-dismiss`,children:(0,Z.jsx)(J,{id:`1QfxQT`})})]}),t[44]=p,t[45]=be);let xe;t[46]!==l||t[47]!==fe||t[48]!==q||t[49]!==s||t[50]!==i?(xe=l?(0,Z.jsx)(`section`,{className:`flex shrink-0 flex-col items-center`,children:(0,Z.jsx)(Zc,{className:`size-4 animate-spin text-muted-foreground/60`})}):i.length>0?(0,Z.jsxs)(`section`,{className:`flex min-h-0 flex-col`,children:[(0,Z.jsx)(`h2`,{className:`mb-2 shrink-0 font-medium text-muted-foreground font-mono text-xs uppercase tracking-wide`,children:(0,Z.jsx)(J,{id:`CCTop_`})}),(0,Z.jsx)(`ul`,{className:`min-h-0 max-h-48 subtle-scrollbar scroll-fade-mask overflow-y-auto space-y-0.5 -mx-4`,"data-testid":`nav-recent-list`,children:i.map(e=>(0,Z.jsx)(Q$,{project:e,branch:s.get(e.path)??null,onOpen:()=>fe(e.path),onRemove:()=>q(e.path)},e.path))})]}):null,t[46]=l,t[47]=fe,t[48]=q,t[49]=s,t[50]=i,t[51]=xe):xe=t[51];let Se;t[52]!==ve||t[53]!==ye||t[54]!==be||t[55]!==xe?(Se=(0,Z.jsx)(`div`,{className:`mx-auto flex h-full w-full max-w-5xl flex-col overflow-hidden px-12 py-12`,children:(0,Z.jsxs)(`div`,{className:`my-auto flex min-h-0 flex-col space-y-10`,children:[ve,ye,be,xe]})}),t[52]=ve,t[53]=ye,t[54]=be,t[55]=xe,t[56]=Se):Se=t[56];let Ce,we;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=(0,Z.jsx)(HQ,{}),we=(0,Z.jsx)(B$,{}),t[57]=Ce,t[58]=we):(Ce=t[57],we=t[58]);let Te;t[59]!==n||t[60]!==y||t[61]!==C||t[62]!==T?(Te=(0,Z.jsx)($h,{open:y,onOpenChange:ue,bridge:n,initialPackId:C,packs:T}),t[59]=n,t[60]=y,t[61]=C,t[62]=T,t[63]=Te):Te=t[63];let Ee;t[64]===x?Ee=t[65]:(Ee=(0,Z.jsx)(Cp,{open:x,onOpenChange:S,systemWide:!0}),t[64]=x,t[65]=Ee);let De;t[66]===j?De=t[67]:(De=e=>{O(e),e||(A(!1),j&&(j(null),M(null)))},t[66]=j,t[67]=De);let Oe;t[68]===n?Oe=t[69]:(Oe=Kr(n),t[68]=n,t[69]=Oe);let ke;t[70]===n?ke=t[71]:(ke=li(n),t[70]=n,t[71]=ke);let Ae=P===`identity`,je;t[72]!==k||t[73]!==j?(je=e=>{O(!1),k&&(A(!1),v(!0)),j&&(j({authenticated:!0,host:`github.com`,login:e.login}),M(null))},t[72]=k,t[73]=j,t[74]=je):je=t[74];let Me;t[75]!==D||t[76]!==De||t[77]!==Oe||t[78]!==ke||t[79]!==Ae||t[80]!==je?(Me=(0,Z.jsx)(ji,{open:D,onOpenChange:De,transport:Oe,queryTransport:ke,identityPrompt:Ae,onSuccess:je}),t[75]=D,t[76]=De,t[77]=Oe,t[78]=ke,t[79]=Ae,t[80]=je,t[81]=Me):Me=t[81];let Ne;t[82]===n?Ne=t[83]:(Ne=k$(n),t[82]=n,t[83]=Ne);let Pe;t[84]===n?Pe=t[85]:(Pe=li(n),t[84]=n,t[85]=Pe);let Fe;t[86]===n.dialog?Fe=t[87]:(Fe=()=>n.dialog.openFolder(),t[86]=n.dialog,t[87]=Fe);let Ie;t[88]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=()=>{v(!1),F(`auth`),A(!0),O(!0)},t[88]=Ie):Ie=t[88];let Le;t[89]!==L||t[90]!==n?(Le=e=>{let{dir:t}=e;U(()=>(g(e1(t)),$$(n,t,`pick-existing`).finally(()=>g(null))),L({id:`iSnkwB`}))},t[89]=L,t[90]=n,t[91]=Le):Le=t[91];let Re;t[92]!==_||t[93]!==Ne||t[94]!==Pe||t[95]!==Fe||t[96]!==Le?(Re=(0,Z.jsx)(M$,{open:_,onOpenChange:v,transport:Ne,authQueryTransport:Pe,pickParentFolder:Fe,onSignIn:Ie,onCloneComplete:Le}),t[92]=_,t[93]=Ne,t[94]=Pe,t[95]=Fe,t[96]=Le,t[97]=Re):Re=t[97];let ze;if(t[98]!==n){let e;t[100]===Symbol.for(`react.memo_cache_sentinel`)?(e=()=>new Promise(e=>{M(()=>e),O(!0)}),t[100]=e):e=t[100],ze=D$({bridge:n,authQueryTransport:li(n),cloneTransport:k$(n),openSignIn:e}),t[98]=n,t[99]=ze}else ze=t[99];let Be;t[101]!==n||t[102]!==ze?(Be=(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(W$,{bridge:n,cloneController:ze})}),t[101]=n,t[102]=ze,t[103]=Be):Be=t[103];let Ve;return t[104]!==he||t[105]!==Se||t[106]!==Te||t[107]!==Ee||t[108]!==Me||t[109]!==Re||t[110]!==Be?(Ve=(0,Z.jsxs)(`div`,{className:`relative flex h-screen w-screen flex-col overflow-hidden bg-primary-foreground dark:bg-background text-foreground`,children:[me,he,Se,Ce,we,Te,Ee,Me,Re,Be]}),t[104]=he,t[105]=Se,t[106]=Te,t[107]=Ee,t[108]=Me,t[109]=Re,t[110]=Be,t[111]=Ve):Ve=t[111],Ve}function Y$(e){return!e.missing}function X$(e){let t=(0,$.c)(14),{title:n,description:r,onClick:i,dataTestId:a,Icon:o}=e,s;t[0]===o?s=t[1]:(s=o?(0,Z.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,Z.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,Z.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,Z.jsx)(`span`,{className:`line-clamp-2 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,Z.jsxs)(Y,{type:`button`,variant:`outline`,onClick:i,"data-testid":a,className:`h-auto flex-col items-start justify-start gap-1.5 whitespace-normal bg-card px-4 py-3.5 text-left`,children:[l,u]}),t[9]=a,t[10]=i,t[11]=l,t[12]=u,t[13]=d):d=t[13],d}function Z$(e){let t=(0,$.c)(36),{onPackSelect:n,onOpenFolder:r,onOpenFile:i,onClone:a,onCreate:o}=e,[s,c]=(0,Q.useState)(null),l,u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>{let e=!1;return(async()=>{try{let t=await P_().listPacks();if(e)return;t.ok?c(t.packs):(console.error(`[NavigatorApp] listPacks returned error:`,t),c([]))}catch(t){let n=t;if(e)return;console.error(`[NavigatorApp] listPacks failed:`,n),c([])}})(),()=>{e=!0}},u=[],t[0]=l,t[1]=u):(l=t[0],u=t[1]),(0,Q.useEffect)(l,u);let d;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(`h2`,{className:`text-xl font-light tracking-tighter text-balance`,children:(0,Z.jsx)(J,{id:`QnjpOq`})}),t[2]=d):d=t[2];let f;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-1`,children:[d,(0,Z.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:(0,Z.jsx)(J,{id:`gYuDfu`})})]}),t[3]=f):f=t[3];let p;t[4]!==n||t[5]!==s?(p=e=>n(e,s??[]),t[4]=n,t[5]=s,t[6]=p):p=t[6];let m;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(m=[`okf`,`entity-vault`],t[7]=m):m=t[7];let h;t[8]!==s||t[9]!==p?(h=(0,Z.jsx)(`div`,{className:`-m-1 min-h-0 flex-1 overflow-y-auto subtle-scrollbar p-1`,children:(0,Z.jsx)(L_,{packs:s,onPackSelect:p,collapsedPackIds:m})}),t[8]=s,t[9]=p,t[10]=h):h=t[10];let g;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(`span`,{className:`text-muted-foreground text-sm`,children:(0,Z.jsx)(J,{id:`S34Vju`})}),t[11]=g):g=t[11];let _,v;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(gc,{"aria-hidden":`true`,className:`size-3.5`}),_=(0,Z.jsx)(J,{id:`PVUn_c`}),t[12]=_,t[13]=v):(_=t[12],v=t[13]);let y;t[14]===r?y=t[15]:(y=(0,Z.jsxs)(Y,{type:`button`,variant:`link-muted`,size:`sm`,onClick:r,"data-testid":`nav-first-run-open`,children:[v,_]}),t[14]=r,t[15]=y);let b,x;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(qn,{"aria-hidden":`true`,className:`size-3.5`}),x=(0,Z.jsx)(J,{id:`9npOH9`}),t[16]=b,t[17]=x):(b=t[16],x=t[17]);let S;t[18]===i?S=t[19]:(S=(0,Z.jsxs)(Y,{type:`button`,variant:`link-muted`,size:`sm`,onClick:i,"data-testid":`nav-first-run-open-file`,children:[b,x]}),t[18]=i,t[19]=S);let C,w;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(pg,{"aria-hidden":`true`,className:`size-3.5`}),w=(0,Z.jsx)(J,{id:`VdXv4D`}),t[20]=C,t[21]=w):(C=t[20],w=t[21]);let T;t[22]===a?T=t[23]:(T=(0,Z.jsxs)(Y,{type:`button`,variant:`link-muted`,size:`sm`,onClick:a,"data-testid":`nav-first-run-clone`,children:[C,w]}),t[22]=a,t[23]=T);let E,D;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Z.jsx)(Kt,{"aria-hidden":`true`,className:`size-3.5`}),D=(0,Z.jsx)(J,{id:`ircigK`}),t[24]=E,t[25]=D):(E=t[24],D=t[25]);let O;t[26]===o?O=t[27]:(O=(0,Z.jsxs)(Y,{type:`button`,variant:`link-muted`,size:`sm`,onClick:o,"data-testid":`nav-first-run-blank`,children:[E,D]}),t[26]=o,t[27]=O);let k;t[28]!==y||t[29]!==S||t[30]!==T||t[31]!==O?(k=(0,Z.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-x-3 gap-y-1`,"data-testid":`nav-first-run-secondary`,children:[g,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-1 gap-y-1`,children:[y,S,T,O]})]}),t[28]=y,t[29]=S,t[30]=T,t[31]=O,t[32]=k):k=t[32];let A;return t[33]!==k||t[34]!==h?(A=(0,Z.jsxs)(`section`,{className:`flex min-h-0 shrink flex-col gap-6`,"data-testid":`nav-first-run`,children:[f,h,k]}),t[33]=k,t[34]=h,t[35]=A):A=t[35],A}function Q$(e){let t=(0,$.c)(44),{project:n,branch:r,onOpen:i,onRemove:a}=e,{_:o}=vt(),{name:s}=n,c=n.isLinkedWorktree===!0,l=c?n.branch??r:r,u=n.missing,d=n.missing&&`opacity-50`,f;t[0]===d?f=t[1]:(f=$t(`h-auto min-w-0 flex-1 justify-between gap-3 py-3.5 pl-4 pr-2 text-left hover:bg-transparent`,d),t[0]=d,t[1]=f);let p;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(eh,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-muted-foreground`}),t[2]=p):p=t[2];let m;t[3]===n.name?m=t[4]:(m=(0,Z.jsx)(`span`,{className:`truncate font-medium text-sm text-gray-700 dark:text-foreground`,children:n.name}),t[3]=n.name,t[4]=m);let h;t[5]===c?h=t[6]:(h=c?(0,Z.jsxs)(fu,{variant:`secondary`,className:`shrink-0 gap-1 rounded-full border-transparent bg-green-600/10 px-2 py-0 font-medium text-2xs text-green-800 dark:bg-green-400/10 dark:text-green-400`,children:[(0,Z.jsx)(Xo,{"aria-hidden":`true`,className:`size-2.5`}),(0,Z.jsx)(J,{id:`z-lawV`})]}):null,t[5]=c,t[6]=h);let g;t[7]!==m||t[8]!==h?(g=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[m,h]}),t[7]=m,t[8]=h,t[9]=g):g=t[9];let _=c?n.mainRoot??``:n.path,v;t[10]!==c||t[11]!==n.mainRoot||t[12]!==n.path?(v=c?(0,Z.jsx)(J,{id:`PRnH8G`,values:{0:sv(n.mainRoot??``)}}):n.path,t[10]=c,t[11]=n.mainRoot,t[12]=n.path,t[13]=v):v=t[13];let y;t[14]!==_||t[15]!==v?(y=(0,Z.jsx)(`span`,{className:`truncate w-full text-muted-foreground text-xs`,title:_,children:v}),t[14]=_,t[15]=v,t[16]=y):y=t[16];let b;t[17]!==y||t[18]!==g?(b=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[p,(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1 truncate`,children:[g,y]})]}),t[17]=y,t[18]=g,t[19]=b):b=t[19];let x;t[20]!==n.missing||t[21]!==n.path||t[22]!==l?(x=n.missing?(0,Z.jsx)(fu,{className:`text-2xs rounded-sm`,variant:`warning`,children:(0,Z.jsx)(J,{id:`VU3Nrn`})}):l==null?null:(0,Z.jsxs)(`span`,{className:`flex max-w-[40%] items-center gap-1 text-muted-foreground text-xs`,"data-testid":`nav-recent-branch-${n.path}`,children:[(0,Z.jsx)(Xo,{"aria-hidden":`true`,className:`size-3 shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate font-mono`,children:l})]}),t[20]=n.missing,t[21]=n.path,t[22]=l,t[23]=x):x=t[23];let S;t[24]!==i||t[25]!==n.missing||t[26]!==b||t[27]!==x||t[28]!==f?(S=(0,Z.jsxs)(Y,{type:`button`,variant:`ghost`,onClick:i,disabled:u,className:f,children:[b,x]}),t[24]=i,t[25]=n.missing,t[26]=b,t[27]=x,t[28]=f,t[29]=S):S=t[29];let C;t[30]!==o||t[31]!==s?(C=o({id:`hDoLrm`,values:{projectName:s}}),t[30]=o,t[31]=s,t[32]=C):C=t[32];let w;t[33]===o?w=t[34]:(w=o({id:`Es-eZU`}),t[33]=o,t[34]=w);let T=`nav-recent-remove-${n.path}`,E;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Z.jsx)(fl,{"aria-hidden":`true`}),t[35]=E):E=t[35];let D;t[36]!==a||t[37]!==C||t[38]!==w||t[39]!==T?(D=(0,Z.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon-sm`,onClick:a,"aria-label":C,title:w,className:`pointer-events-none mr-2 opacity-0 group-hover:pointer-events-auto group-hover:opacity-100 focus-visible:pointer-events-auto focus-visible:opacity-100`,"data-testid":T,children:E}),t[36]=a,t[37]=C,t[38]=w,t[39]=T,t[40]=D):D=t[40];let O;return t[41]!==S||t[42]!==D?(O=(0,Z.jsxs)(`li`,{className:`group flex items-center justify-between rounded-lg hover:bg-accent`,children:[S,D]}),t[41]=S,t[42]=D,t[43]=O):O=t[43],O}async function $$(e,t,n){await e.project.open({path:t,target:`new-window`,entryPoint:n})}function e1(e){let t=e.split(/[/\\]/).filter(Boolean);return t.length>0?t[t.length-1]??e:e}var t1=(0,Q.lazy)(()=>n(()=>import(`./TerminalWindowApp-jhlpCVAO.js`).then(e=>({default:e.TerminalWindowApp})),__vite__mapDeps([162,1,73,6,2,3,7,8,9,58,12,22,11,74,75,76,147,104,19,38,10,16,17,18,40,105,106,14,15,24,41,21,84,81,28,42,25,112,96,83,148,114,97,32,115,33,34,30,89,78,26,90,124,125,146,163,164]),import.meta.url));function n1(e){return e?.config.mode===`terminal`?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(t1,{bridge:e})}):e?.config.mode===`navigator`?(0,Z.jsx)(J$,{bridge:e}):(0,Z.jsx)(C$,{})}function r1(){let e=null,t=new Set,n=!1,r=null;function i(){for(let e of t)e()}function a(){e!==null&&(e=null,i())}return{install({bridge:t}){let o=t?.bugReport?.onCrashDetected;if(typeof o==`function`)return n?r??void 0:(n=!0,r=o(t=>{e=t,i()}),()=>{r?.(),r=null,n=!1,a()})},getSnapshot(){return e},subscribe(e){return t.add(e),()=>{t.delete(e)}},dismiss(){a()}}}var i1=r1();function a1(e){return i1.install(e)}function o1(e){let t=(0,$.c)(7),{bridge:n}=e,r=(0,Q.useSyncExternalStore)(i1.subscribe,i1.getSnapshot);if(r===null)return null;let i;t[0]!==n.bugReport||t[1]!==r?(i=e=>{e||(n.bugReport.crashAck({eventId:r.eventId}),i1.dismiss())},t[0]=n.bugReport,t[1]=r,t[2]=i):i=t[2];let a=n.config.mode===`navigator`,o;return t[3]!==r||t[4]!==i||t[5]!==a?(o=(0,Z.jsx)(Cp,{open:!0,onOpenChange:i,systemWide:a,crashInvite:r}),t[3]=r,t[4]=i,t[5]=a,t[6]=o):o=t[6],o}var s1=e=>{let t=(0,$.c)(8),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let{theme:r}=zt(),i=r===void 0?`system`:r,a,o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a={success:(0,Z.jsx)(Is,{className:`size-4`}),info:(0,Z.jsx)(Xc,{className:`size-4`}),warning:(0,Z.jsx)(sl,{className:`size-4`}),error:(0,Z.jsx)(hh,{className:`size-4`}),loading:(0,Z.jsx)(Zc,{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,Z.jsx)(pl,{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},c1=Symbol.for(`ok.client.fetchWrapper`);function l1(e={}){if(typeof window>`u`)return;let t=e.apiOrigin&&e.apiOrigin.length>0?e.apiOrigin:void 0;if(window.fetch[c1])return;let n=window.fetch.bind(window),r=bu(),i=((e,i)=>{let a=d1(e,t);if(!a.isApi)return n(e,i);if(e instanceof Request){let t=u1(e.headers,r);return n(new Request(a.url,e),{headers:t})}let o=u1(i?.headers,r);return n(a.url,{...i,headers:o})});i[c1]=!0,window.fetch=i}function u1(e,t){let n=new Headers(e);for(let[e,r]of Object.entries(t))n.set(e,r);return n}function d1(e,t){if(typeof e==`string`){if(e.startsWith(`/api/`))return{isApi:!0,url:t?t+e:e};let n=f1(e);return n&&p1(n,t)?{isApi:!0,url:e}:{isApi:!1,url:e}}let n=e instanceof URL?e:f1(e.url,window.location.origin);if(n&&p1(n,t)){let r=e instanceof URL?e.href:e.url;return t&&(n.origin===window.location.origin||n.protocol===`file:`)?{isApi:!0,url:t+n.pathname+n.search+n.hash}:{isApi:!0,url:r}}return{isApi:!1,url:e instanceof URL?e.href:e.url}}function f1(e,t){try{return new URL(e,t)}catch{return null}}function p1(e,t){if(!e.pathname.startsWith(`/api/`))return!1;if(e.origin===window.location.origin||e.protocol===`file:`)return!0;if(t){let n=f1(t);if(n&&e.origin===n.origin)return!0}return!1}var m1=Symbol.for(`ok.client.logForwarder`),h1=2e3,g1=[`log`,`info`,`warn`,`error`],_1={log:`info`,info:`info`,warn:`warn`,error:`error`};function v1(e){if(typeof e==`string`)return e;if(e instanceof Error)return`${e.name}: ${e.message}`;try{return JSON.stringify(e)??String(e)}catch{return String(e)}}function y1(e){let t=e.message.length+80;if(e.event&&(t+=e.event.length),e.fields)try{t+=JSON.stringify(e.fields).length}catch{}return t}function b1(e={}){let t=e.windowObj??(typeof window<`u`?window:void 0);if(!t||t.okDesktop)return;let n=t;if(n[m1])return;n[m1]=!0;let r=e.consoleObj??console,i=e.documentObj===void 0?typeof document<`u`?document:null:e.documentObj,a=e.flushIntervalMs??h1,o=e.fetchImpl??n.fetch.bind(n),s=e.now??Date.now,c=[],l=0,u=null,d=!1,f=0,p={log:r.log.bind(r),info:r.info.bind(r),warn:r.warn.bind(r),error:r.error.bind(r)};function m(){if(u!==null&&(clearTimeout(u),u=null),c.length===0)return;let e=c.splice(0,100);l=0;let t=f;d=!0;try{o(`/api/client-logs`,{method:`POST`,headers:{"content-type":`application/json`},keepalive:!0,body:JSON.stringify(t>0?{entries:e,droppedSinceLastFlush:t}:{entries:e})}).then(n=>{n.ok?f=Math.max(0,f-t):f+=e.length},()=>{f+=e.length})}catch{f+=e.length}finally{d=!1}}function h(e){if(c.push(e),l+=y1(e),c.length>100){let e=c.shift();e&&(l-=y1(e),f+=1)}if(c.length>=100||l>=32768){m();return}u===null&&(u=setTimeout(m,a))}function g(e,t){if(!d)try{let n=mo(t.map(v1).join(` `)),r=t[0],i=typeof r==`string`&&r.length<=32768?r:void 0,a=i?La(i):null,o=a?.fields;if(o)try{JSON.stringify(o).length>8192&&(o=void 0)}catch{o=void 0}h({level:e,message:n,ts:s(),...a?.event?{event:a.event}:{},...o?{fields:o}:{}})}catch{}}for(let e of g1)r[e]=(...t)=>{p[e](...t),g(_1[e],t)};let _=e=>{if(d)return;let t=e;g(`error`,[`uncaught error: ${t.message} (${t.filename}:${t.lineno}:${t.colno})`])},v=e=>{d||g(`error`,[`unhandledrejection: ${v1(e.reason)}`])},y=()=>m(),b=()=>{i&&i.visibilityState===`hidden`&&m()};n.addEventListener(`error`,_),n.addEventListener(`unhandledrejection`,v),n.addEventListener(`pagehide`,y),i&&i.addEventListener(`visibilitychange`,b);function x(){for(let e of g1)r[e]=p[e];n.removeEventListener(`error`,_),n.removeEventListener(`unhandledrejection`,v),n.removeEventListener(`pagehide`,y),i&&i.removeEventListener(`visibilitychange`,b),u!==null&&(clearTimeout(u),u=null),c.length=0,delete n[m1]}return{flushNow:m,uninstall:x}}function x1(e,t){return e.branch===void 0||e.branch===null||e.branch===``||t===``||e.multiCandidate!==!0?null:{message:`Opened on branch ${e.branch}`,description:t}}function S1(e){let t=e.bridge;if(!t)return;let n=e.setHash??(e=>{window.location.hash=e}),r=e.emitToast??((e,t)=>{X(e,t)});return t.onDeepLink(e=>{let i=e.kind??`doc`,a={kind:i,path:e.doc,branch:e.branch??null};if(e.targetMissing===!0){Qc.arm(a);return}es.arm(a),n(iu(i,e.doc,i===`doc`?e.branch:void 0));let o=x1(e,t.config.projectPath);o!==null&&r(o.message,{description:o.description,duration:3e3})})}var C1=4e3,w1=1440*60*1e3;function T1(e){let t=e.bridge;if(t&&t.onboarding)return t.onboarding.onToast(e=>{if(e.kind===`ancestor-promote`){X.success(`Opened existing OpenKnowledge project at ${e.ancestorPath}`,{duration:C1});return}if(e.kind===`startup-reclaim`){let t=[];if(e.mcp.status===`repaired`){let n=e.mcp.editors.map(e=>Fa[e]??e).join(`, `);t.push(`repaired ${n} MCP integration`)}else e.mcp.status===`failed`&&t.push(`MCP auto-repair failed`);e.path.status===`installed`&&t.push(e.path.summary),e.path.status===`failed`&&t.push(`PATH install failed: ${e.path.summary}`);let n=t.length>0?t.join(`; `):`OpenKnowledge integrations checked.`,r=e.mcp.status===`failed`||e.path.status===`failed`,i=e.path.status!==`none`;X[r?`error`:`success`](n,{duration:r||i?w1:C1,position:`bottom-left`});return}if(e.kind===`sharing-refused-tracked`){X.error(`Config sharing unchanged: ${e.tracked.length} OK file(s) tracked upstream — see message below.`,{duration:w1,description:e.remediation});return}if(e.kind===`sharing-no-git`){X.warning(`Local-only requested but no git repository was created. Switch later via Settings → Config sharing once the project is in a git repo.`,{duration:C1});return}let t=gl(e.gitRoot,e.pickedPath)??e.pickedPath;X.success(`Initialized OpenKnowledge at ${e.gitRoot} — opened parent of ${t} because it contains a .git folder`,{duration:C1})})}function E1(e){let t=(0,$.c)(18),{body:n,warning:r,restartLabel:i,cancelLabel:a,onRestart:o,onDismiss:s}=e,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(sl,{className:`mt-0.5 size-4 shrink-0 text-amber-500`}),t[0]=c):c=t[0];let l;t[1]===n?l=t[2]:(l=(0,Z.jsx)(`p`,{className:`font-medium text-sm`,children:n}),t[1]=n,t[2]=l);let u;t[3]===r?u=t[4]:(u=(0,Z.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:r}),t[3]=r,t[4]=u);let d;t[5]!==o||t[6]!==i?(d=(0,Z.jsx)(Y,{size:`sm`,onClick:o,children:i}),t[5]=o,t[6]=i,t[7]=d):d=t[7];let f;t[8]!==a||t[9]!==s?(f=(0,Z.jsx)(Y,{size:`sm`,variant:`ghost`,onClick:s,children:a}),t[8]=a,t[9]=s,t[10]=f):f=t[10];let p;t[11]!==d||t[12]!==f?(p=(0,Z.jsxs)(`div`,{className:`mt-1 flex flex-wrap gap-2`,children:[d,f]}),t[11]=d,t[12]=f,t[13]=p):p=t[13];let m;return t[14]!==l||t[15]!==u||t[16]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex w-full gap-3 rounded-lg border bg-popover p-4 text-popover-foreground shadow-lg`,children:[c,(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:[l,u,p]})]}),t[14]=l,t[15]=u,t[16]=p,t[17]=m):m=t[17],m}function D1(){return yl._({id:`f_PkYv`})}function O1(e){return e.serverRuntime===e.appRuntime?yl._({id:`FWQuPE`,values:{0:e.appRuntime}}):e.relation===`older`?yl._({id:`LhQlGR`,values:{0:e.serverRuntime,1:e.appRuntime}}):yl._({id:`yZmvQ4`,values:{0:e.serverRuntime,1:e.appRuntime}})}function k1(e){return yl._({id:`2YOwme`,values:{appRuntime:e}})}function A1(e){return e===`eperm`?yl._({id:`uQewpR`}):yl._({id:`PqYWiC`})}async function j1(e){let t=X.loading(yl._({id:`Kf7GG5`}),{duration:1/0}),n;try{n=await e.restartServer(e.config.projectPath)}catch{return}X.dismiss(t),n.ok===!1&&X.error(A1(n.reason),{duration:1/0})}function M1(e){let t=e.bridge;if(!t)return;let n=t.onServerVersionDrift(e=>{X.custom(n=>(0,Q.createElement)(E1,{body:O1(e),warning:D1(),restartLabel:yl._({id:`ppDgFi`}),cancelLabel:yl._({id:`PBxg_E`}),onRestart:()=>{X.dismiss(n),j1(t)},onDismiss:()=>X.dismiss(n)}),{duration:1/0})}),r=t.onServerRestarted(e=>{X.success(k1(e.appRuntime))});return()=>{n(),r()}}function N1(e){let{initialDoc:t}=e;if(!t)return;let n=e.getHash();n!==``&&n!==`#`&&n!==`#/`||e.setHash(lu(t))}function P1(){typeof window>`u`||!window.okDesktop||N1({initialDoc:window.okDesktop.config.initialDoc,getHash:()=>window.location.hash,setHash:e=>{window.location.hash=e}})}Nf(),n(()=>import(`./telemetry-startup-Bvr_iW-w.js`).then(e=>e.initStartupTrace()),__vite__mapDeps([165,0,1,2,3,4,57,22,12,11]),import.meta.url),l1({apiOrigin:typeof window<`u`?window.okDesktop?.config.apiOrigin:void 0}),b1(),tD()&&sD(),yQ(),sE(),EI(),XP(),typeof window<`u`&&S1({bridge:window.okDesktop}),typeof window<`u`&&M1({bridge:window.okDesktop}),typeof window<`u`&&Af({bridge:window.okDesktop}),typeof window<`u`&&hl({bridge:window.okDesktop}),typeof window<`u`&&T1({bridge:window.okDesktop}),typeof window<`u`&&Mf({bridge:window.okDesktop}),typeof window<`u`&&a1({bridge:window.okDesktop}),P1();var F1=new zf({defaultOptions:{queries:{retry:1,staleTime:1e4}}}),I1=document.getElementById(`root`);if(!I1)throw Error(`Root element not found`);var L1=typeof window>`u`?void 0:window.okDesktop;function R1(){return ta(),null}(0,Wf.createRoot)(I1).render((0,Z.jsx)(Q.StrictMode,{children:(0,Z.jsx)(yt,{i18n:yl,children:(0,Z.jsxs)(At,{client:F1,children:[(0,Z.jsx)(Em,{}),(0,Z.jsxs)(Bt,{attribute:`class`,defaultTheme:`system`,enableSystem:!0,disableTransitionOnChange:!0,storageKey:`ok-theme-v1`,children:[(0,Z.jsx)(R1,{}),(0,Z.jsxs)(dn,{children:[(0,Z.jsx)(Sm,{children:n1(L1)}),L1!==void 0&&(0,Z.jsx)(wm,{children:(0,Z.jsx)(o1,{bridge:L1})})]}),(0,Z.jsx)(s1,{richColors:!0,closeButton:!0})]})]})})}));
1994
+ `}\n${zq}\n${Bq}`;function ZY(e){return e===`darwin`?yl._({id:`LtSYdi`}):e===`win32`?yl._({id:`qi1F96`}):yl._({id:`e1Rn_k`})}function QY(e){let t=(0,$.c)(18),{item:n,workspace:r,onClose:i}=e,{_:a}=vt(),o=typeof window<`u`?window.okDesktop:void 0;if(!o)return null;let s=o.platform,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=ZY(s),t[0]=c):c=t[0];let l=c,u,d;t[1]!==a||t[2]!==r?(u=r?null:a({id:`wTcjov`}),d=a(s===`darwin`?u?{id:`FvpFSZ`,values:{hint:u}}:{id:`LtSYdi`}:s===`win32`?u?{id:`o4dcAf`,values:{hint:u}}:{id:`qi1F96`}:u?{id:`zUhPuR`,values:{hint:u}}:{id:`e1Rn_k`}),t[1]=a,t[2]=r,t[3]=u,t[4]=d):(u=t[3],d=t[4]);let f=d,p=!r,m;t[5]!==n||t[6]!==i||t[7]!==r?(m=()=>{if(!r)return;i();let e=sc(r.contentDir,$d(n),r.pathSeparator);o.shell.showItemInFolder(e)},t[5]=n,t[6]=i,t[7]=r,t[8]=m):m=t[8];let h,g;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(gc,{"aria-hidden":`true`}),g=(0,Z.jsx)(`span`,{className:`flex-1`,children:l}),t[9]=h,t[10]=g):(h=t[9],g=t[10]);let _;t[11]===u?_=t[12]:(_=u?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:u}):null,t[11]=u,t[12]=_);let v;return t[13]!==f||t[14]!==p||t[15]!==m||t[16]!==_?(v=(0,Z.jsxs)(Ar,{disabled:p,onSelect:m,"aria-label":f,children:[h,g,_]}),t[13]=f,t[14]=p,t[15]=m,t[16]=_,t[17]=v):v=t[17],v}function $Y(e){let t=(0,$.c)(69),{item:n,context:r,anyActionBusy:i,workspace:a,handoff:o,model:s,okignoreBinding:c,onStartCreating:l,onCreateFromTemplate:u,onDuplicate:d,onImportTemplate:f,onDelete:p,onExpandSubtree:m,onCollapseSubtree:h,folderTreePaths:g,isAsset:_,documents:v}=e,{_:y}=vt(),b=Zd(n,v),x=n.kind===`directory`,S;t[0]===n.path?S=t[1]:(S=Vl(n.path),t[0]=n.path,t[1]=S);let C=S,w=b.kind===`asset`?null:b,T=w!==null&&c!==null,E;t[2]!==y||t[3]!==x?(E=y(x?{id:`5D3Ior`}:{id:`dbhUX1`}),t[2]=y,t[3]=x,t[4]=E):E=t[4];let D=E,O;t[5]!==x||t[6]!==n.path?(O=x?Sf(n.path):null,t[5]=x,t[6]=n.path,t[7]=O):O=t[7];let k=Gr(O),A=k.state.status===`ready`?(k.state.data.folder.templates_available?.length??0)>0:!0,j=s.getSelectedPaths(),M=j.includes(b.treePath)?bJ(j,v):[],N=M.length>1?M:[b],P=N.length,F=yl._({id:`djjdjr`,values:{deleteCount:P}}),I;t[8]!==v||t[9]!==_||t[10]!==x||t[11]!==n||t[12]!==a?(I=_?null:x?Us({folderRelativePath:$d(n),workspace:a}):Xs({docName:xf(n.path,v),workspace:a}),t[8]=v,t[9]=_,t[10]=x,t[11]=n,t[12]=a,t[13]=I):I=t[13];let L=I,R;t[14]===r?R=t[15]:(R=()=>r.close({restoreFocus:!1}),t[14]=r,t[15]=R);let z=R,B;t[16]===r?B=t[17]:(B=()=>r.close(),t[16]=r,t[17]=B);let V=B,{status:H}=ss(),U=H?.hasRemote===!0,W;t[18]!==v||t[19]!==_||t[20]!==x||t[21]!==n.path||t[22]!==b?(W=_||b.kind===`asset`?null:x?Yr(Sf(n.path)):ci(xf(n.path,v)),t[18]=v,t[19]=_,t[20]=x,t[21]=n.path,t[22]=b,t[23]=W):W=t[23];let ee=W,G=U&&ee!==null,K;t[24]!==y||t[25]!==U||t[26]!==ee?(K=()=>{ee&&Jr({...ee,hasRemote:U,onClickWhenNoRemote:()=>{X.error(y({id:`WyQxwa`}))}},{clipboardWrite:Md,toastSuccess:nX,toastError:tX,logEvent:eX})},t[24]=y,t[25]=U,t[26]=ee,t[27]=K):K=t[27];let te=K,ne;t[28]!==G||t[29]!==V||t[30]!==te?(ne=G?(0,Z.jsxs)(Ar,{"data-testid":`file-tree-menu-share`,onSelect:()=>{V(),te()},children:[(0,Z.jsx)(Eh,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`Z8lGw6`})]}):null,t[28]=G,t[29]=V,t[30]=te,t[31]=ne):ne=t[31];let re=ne,ie=0,ae=0;if(x){let e=mf(n.path);for(let t of g)(t===e||t.startsWith(e))&&(ie++,iY(s.getItem(t))?.isExpanded()&&ae++)}let oe=x&&ae<ie,se=x&&ae>0,ce;t[32]===V?ce=t[33]:(ce=e=>{e||V()},t[32]=V,t[33]=ce);let le;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,Z.jsx)(Pr,{asChild:!0,children:(0,Z.jsx)(`span`,{"aria-hidden":`true`,"data-file-tree-context-menu-root":`true`,className:`block size-px`})}),t[34]=le):le=t[34];let ue;t[35]!==y||t[36]!==i||t[37]!==T||t[38]!==V||t[39]!==z||t[40]!==F||t[41]!==N||t[42]!==A||t[43]!==o||t[44]!==L||t[45]!==D||t[46]!==_||t[47]!==x||t[48]!==C||t[49]!==n||t[50]!==s||t[51]!==c||t[52]!==w||t[53]!==h||t[54]!==u||t[55]!==p||t[56]!==d||t[57]!==m||t[58]!==f||t[59]!==l||t[60]!==re||t[61]!==se||t[62]!==oe||t[63]!==b||t[64]!==a?(ue=(0,Z.jsx)(Rr,{sideOffset:0,align:`start`,"data-file-tree-context-menu-root":`true`,className:`min-w-52`,children:x?(0,Z.jsxs)(Z.Fragment,{children:[C?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Ar,{disabled:i,onSelect:()=>{z(),l(`file`,Sf(n.path))},children:[(0,Z.jsx)(al,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`HdkSiO`})]}),A?(0,Z.jsxs)(jr,{children:[(0,Z.jsxs)(Lr,{disabled:i,children:[(0,Z.jsx)(Oi,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`Uuj_R4`})]}),(0,Z.jsx)(Mr,{children:(0,Z.jsx)(rY,{parentDir:Sf(n.path),onSelectTemplate:e=>{z(),u(Sf(n.path),e)},ItemComponent:Ar})})]}):null,(0,Z.jsxs)(Ar,{disabled:i,onSelect:()=>{z(),l(`folder`,Sf(n.path))},children:[(0,Z.jsx)($m,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`96G6Re`})]}),(0,Z.jsx)(Vr,{})]}),(0,Z.jsx)(QY,{item:n,workspace:a,onClose:V}),(0,Z.jsx)(zs,{input:L,installStates:o.installStates,isElectronHost:o.isElectronHost,dispatch:o.dispatch,onBeforeLaunch:V}),re,(0,Z.jsxs)(jr,{children:[(0,Z.jsxs)(Lr,{children:[(0,Z.jsx)(pc,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`oCZkaG`})]}),(0,Z.jsxs)(Mr,{children:[(0,Z.jsx)(Ar,{disabled:!a,onSelect:()=>{a&&(V(),HY(sc(a.contentDir,$d(n),a.pathSeparator),`full`))},children:(0,Z.jsx)(J,{id:`oQA-cA`})}),(0,Z.jsx)(Ar,{onSelect:()=>{V(),HY($d(n),`relative`)},children:(0,Z.jsx)(J,{id:`s061i4`})})]})]}),oe||se?(0,Z.jsx)(Vr,{}):null,oe?(0,Z.jsxs)(Ar,{onSelect:()=>{V(),m(n.path)},children:[(0,Z.jsx)(Uh,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`OlAl5i`})]}):null,se?(0,Z.jsxs)(Ar,{onSelect:()=>{V(),h(n.path)},children:[(0,Z.jsx)(Zm,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`qvWGzP`})]}):null,C?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Vr,{}),(0,Z.jsxs)(Ar,{disabled:i,onSelect:()=>{b.kind!==`asset`&&(V(),d(b))},children:[(0,Z.jsx)(ic,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`euc6Ns`})]}),(0,Z.jsxs)(Ar,{disabled:i,onSelect:()=>{z(),s.startRenaming(n.path)},children:[(0,Z.jsx)(fc,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`2wxgft`})]}),(0,Z.jsxs)(Ar,{"data-testid":`file-tree-menu-hide`,disabled:!T,onSelect:()=>{if(!c||!w)return;V();let e=uJ(w),t=xi(c.current()),n=ki(t,e);if(n===t)return;c.patch(hi(n));let r=w.path.split(`/`).pop()||w.path;X.success(y({id:`4xtLTl`,values:{basename:r}}),{description:y({id:`nWv1ja`}),duration:5e3})},children:[(0,Z.jsx)(Ie,{"aria-hidden":`true`}),D]}),(0,Z.jsxs)(Ar,{variant:`destructive`,disabled:i,onSelect:()=>{V(),p(N)},children:[(0,Z.jsx)(ol,{"aria-hidden":`true`}),F]})]})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(QY,{item:n,workspace:a,onClose:V}),!_&&(0,Z.jsx)(zs,{input:L,installStates:o.installStates,isElectronHost:o.isElectronHost,dispatch:o.dispatch,onBeforeLaunch:V}),re,(0,Z.jsxs)(jr,{children:[(0,Z.jsxs)(Lr,{children:[(0,Z.jsx)(pc,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`oCZkaG`})]}),(0,Z.jsxs)(Mr,{children:[(0,Z.jsx)(Ar,{disabled:!a,onSelect:()=>{a&&(V(),HY(sc(a.contentDir,$d(n),a.pathSeparator),`full`))},children:(0,Z.jsx)(J,{id:`oQA-cA`})}),(0,Z.jsx)(Ar,{onSelect:()=>{V(),HY($d(n),`relative`)},children:(0,Z.jsx)(J,{id:`s061i4`})})]})]}),C?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Vr,{}),_?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(jr,{children:[(0,Z.jsxs)(Lr,{disabled:i,children:[(0,Z.jsx)(Ym,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`PYmp-0`})]}),(0,Z.jsxs)(Mr,{children:[(0,Z.jsx)(Ar,{disabled:i,onSelect:()=>{V(),f(b,!1)},children:(0,Z.jsx)(J,{id:`-FeyRg`})}),(0,Z.jsx)(Ar,{disabled:i,onSelect:()=>{V(),f(b,!0)},children:(0,Z.jsx)(J,{id:`dQHSCs`})})]})]}),(0,Z.jsxs)(Ar,{disabled:i,onSelect:()=>{V(),d(b)},children:[(0,Z.jsx)(ic,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`euc6Ns`})]})]}),(0,Z.jsxs)(Ar,{disabled:i,onSelect:()=>{z(),s.startRenaming(n.path)},children:[(0,Z.jsx)(fc,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`2wxgft`})]}),w?(0,Z.jsxs)(Ar,{"data-testid":`file-tree-menu-hide`,disabled:!T,onSelect:()=>{if(!c)return;V();let e=uJ(w),t=xi(c.current()),n=ki(t,e);if(n===t)return;c.patch(hi(n));let r=w.path.split(`/`).pop()||w.path;X.success(y({id:`OD0FCX`,values:{basename:r}}),{description:y({id:`nWv1ja`}),duration:5e3})},children:[(0,Z.jsx)(Ie,{"aria-hidden":`true`}),D]}):null,(0,Z.jsxs)(Ar,{variant:`destructive`,disabled:i,onSelect:()=>{V(),p(N)},children:[(0,Z.jsx)(ol,{"aria-hidden":`true`}),F]})]})]})}),t[35]=y,t[36]=i,t[37]=T,t[38]=V,t[39]=z,t[40]=F,t[41]=N,t[42]=A,t[43]=o,t[44]=L,t[45]=D,t[46]=_,t[47]=x,t[48]=C,t[49]=n,t[50]=s,t[51]=c,t[52]=w,t[53]=h,t[54]=u,t[55]=p,t[56]=d,t[57]=m,t[58]=f,t[59]=l,t[60]=re,t[61]=se,t[62]=oe,t[63]=b,t[64]=a,t[65]=ue):ue=t[65];let de;return t[66]!==ce||t[67]!==ue?(de=(0,Z.jsxs)(Br,{open:!0,modal:!1,onOpenChange:ce,children:[le,ue]}),t[66]=ce,t[67]=ue,t[68]=de):de=t[68],de}function eX(e){return console.log(e)}function tX(e){return X.error(e)}function nX(e){return X.success(e)}function rX(e,t){return`/api/documents?showAll=true${t?`&showOk=true`:``}&dir=${encodeURIComponent(e)}&depth=1`}async function iX(e,t,n,r,i){try{let a=await fetch(rX(e,t),{signal:n,headers:_Y});if(vY(a)){let e=await xY(a);return{kind:`entries`,entries:Ol(e.entries),truncated:e.truncated}}let o=await A(a,r);if(!o.ok)return{kind:`http-error`,title:o.title};let s=xo.safeParse(o.body);return s.success?{kind:`entries`,entries:Ol(s.data.documents),truncated:s.data.truncated===!0}:{kind:`http-error`,title:i}}catch(e){return e instanceof yY?{kind:`http-error`,title:e.message}:{kind:`network-error`,cause:e}}}function aX(e){let t=(0,$.c)(365),{ref:n,onContentHeightChange:r}=e,{_:i,i18n:a}=vt(),{activeDocName:o,activeTarget:s,closeTabs:c,closeDocument:l,closeAndClearForRename:u,getPoolActiveDocName:d,poolHas:f,isNewTabActive:p,openTarget:m,prewarm:h,remapTabsForRename:g}=Re(),{notifySidebarFileSelected:_}=vN(),{resolvedTheme:v}=zt(),{addPage:y,pageMeta:b,pages:x}=Ns(),S;t[0]===b?S=t[1]:(S=function(e,t){return Fl(e,t??b.get(e)?.size)??{kind:`doc`,target:e,docName:e}},t[0]=b,t[1]=S);let C=S,w;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(w=[],t[2]=w):w=t[2];let[E,D]=(0,Q.useState)(w),[O,k]=(0,Q.useState)(!0),[j,M]=(0,Q.useState)(null),[N,F]=(0,Q.useState)(!1),I=tF(),L=(0,Q.useRef)(null),[R,z]=(0,Q.useState)(null),[B,V]=(0,Q.useState)(0),[H,U]=(0,Q.useState)(null),[W,ee]=(0,Q.useState)(null),[G,K]=(0,Q.useState)(null),[te,ne]=(0,Q.useState)(null),{conflicts:re}=yi(),[ie,ae]=(0,Q.useState)(null),[oe,se]=(0,Q.useState)(null),[ce,le]=(0,Q.useState)(!1),ue=(0,Q.useRef)(ce),de;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(de=new Set,t[3]=de):de=t[3];let fe=(0,Q.useRef)(de),q=(0,Q.useRef)(E),me=(0,Q.useRef)(b),he=(0,Q.useRef)(null),_e;t[4]!==y||t[5]!==C||t[6]!==_||t[7]!==m?(_e=function(e){if(e.kind===`doc`)e.registerPage&&y(e.docName),m(C(e.docName,e.size),{tabBehavior:`replace-active`}),nu(lu(e.docName));else if(e.kind===`folder`)m({kind:`folder`,target:e.folderPath,folderPath:e.folderPath},{tabBehavior:`replace-active`}),nu(tu(e.folderPath));else{let t=(e.entries??q.current).find(t=>Ul(t)&&t.path===e.assetPath);m({kind:`asset`,target:e.assetPath,assetPath:e.assetPath,mediaKind:t?.mediaKind??null},{tabBehavior:`replace-active`}),nu(su(e.assetPath))}_()},t[4]=y,t[5]=C,t[6]=_,t[7]=m,t[8]=_e):_e=t[8];let ve=_e,ye;t[9]!==E||t[10]!==ve||t[11]!==_||t[12]!==m||t[13]!==x?(ye=function(e,t){let n=t===void 0?E:t,r=WJ(e,n);if(r.kind===`none`){console.debug(`[FileTree] Dropped selection for unknown docName:`,bf(e));return}if(r.kind===`asset`){m({kind:`asset`,target:r.path,assetPath:r.path,mediaKind:r.mediaKind},{tabBehavior:`replace-active`}),nu(r.hash),_();return}if(r.kind===`folder`){ve({kind:`folder`,folderPath:r.path});return}let i=n.find(e=>Ml(e)&&e.docName===r.path),a=jl(r.path,{pages:x,docExt:i?.docExt});if(a?.kind===`asset`){m(a,{tabBehavior:`replace-active`}),nu(su(a.assetPath)),_();return}if(a?.kind===`doc`){ve({kind:`doc`,docName:a.docName});return}ve({kind:`doc`,docName:r.path,size:i?.size,registerPage:Tl(r.path)})},t[9]=E,t[10]=ve,t[11]=_,t[12]=m,t[13]=x,t[14]=ye):ye=t[14];let be=ye,xe=(0,Q.useRef)(o),Se;t[15]===E?Se=t[16]:(Se=new Set(E.filter(Ul).map(NX)),t[15]=E,t[16]=Se);let Ce=Se,we=(0,Q.useRef)(Ce),Te;t[17]===E?Te=t[18]:(Te=kJ(E),t[17]=E,t[18]=Te);let Ee=Te,De=(0,Q.useRef)(Ee),Oe;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=[],t[19]=Oe):Oe=t[19];let ke=(0,Q.useRef)(Oe),Ae=(0,Q.useRef)(null),je=(0,Q.useRef)(MX),Me=(0,Q.useRef)(null),Ne=(0,Q.useRef)(null),Pe=(0,Q.useRef)(!1),Fe=(0,Q.useRef)(!1),Ie=(0,Q.useRef)(null),Le;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(Le={row:null,root:null},t[20]=Le):Le=t[20];let ze=(0,Q.useRef)(Le),Ve=(0,Q.useRef)(jX),He=(0,Q.useRef)(null),Ue=(0,Q.useRef)(null),We;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(We=new Map,t[21]=We):We=t[21];let Ge=(0,Q.useRef)(We),Ke;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(Ke=new Set,t[22]=Ke):Ke=t[22];let qe=(0,Q.useRef)(Ke),Je;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(Je=new Map,t[23]=Je):Je=t[23];let Ye=(0,Q.useRef)(Je),Xe=(0,Q.useRef)(0),Ze;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(Ze=new Set,t[24]=Ze):Ze=t[24];let Qe=(0,Q.useRef)(Ze),$e=(0,Q.useRef)(AX),et=(0,Q.useRef)(kX),tt=(0,Q.useRef)(!1),nt=(0,Q.useRef)(!1),rt=(0,Q.useRef)(!1),it;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(it=()=>({showHiddenFiles:tt.current,showOnlyMarkdownFiles:nt.current,showOkFolders:rt.current}),t[25]=it):it=t[25];let at=it,ot=(0,Q.useRef)(null),st=(0,Q.useRef)(null),ct=(0,Q.useRef)(OX),lt=(0,Q.useRef)(DX),ut=(0,Q.useRef)(EX),dt=(0,Q.useRef)(TX),ft=(0,Q.useRef)(s),[pt,mt]=(0,Q.useState)(!1),ht;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(ht=function(){L.current!==null&&(clearTimeout(L.current),L.current=null)},t[26]=ht):ht=t[26];let gt=ht,_t;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(_t=function(){gt(),F(!1)},t[27]=_t):_t=t[27];let yt=_t,bt;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(bt=function(e){yt(),M(e)},t[28]=bt):bt=t[28];let xt=bt,St;t[29]===i?St=t[30]:(St=function(){if(gt(),ZP()){M(null),F(!0),L.current=setTimeout(()=>{L.current=null,ot.current?.()},qY);return}F(!1),M(i({id:`34qyH5`}))},t[29]=i,t[30]=St);let Ct=St,wt=(0,Q.useRef)(!0),Tt;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(Tt=()=>{if(wt.current){wt.current=!1;return}ot.current?.()},t[31]=Tt):Tt=t[31];let Et;t[32]===I?Et=t[33]:(Et=[I],t[32]=I,t[33]=Et),(0,Q.useEffect)(Tt,Et);let Dt,Ot;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(Dt=()=>gt,Ot=[],t[34]=Dt,t[35]=Ot):(Dt=t[34],Ot=t[35]),(0,Q.useEffect)(Dt,Ot);let kt,At;t[36]!==E.length||t[37]!==O?(kt=()=>{if(O||E.length===0)return;let e=st.current?.querySelector(OR)?.shadowRoot;if(!e)return;let t=e,n=function(){Ie.current!==null&&clearTimeout(Ie.current),Ie.current=setTimeout(()=>{Fe.current=!1,Ie.current=null},0)},r=function(e){if(!(e instanceof DragEvent))return;let t=FX(e),n=t?.dataset.itemPath;if(!n)return;let r=YJ(t.dataset.itemType===`folder`?mf(n):n,q.current,me.current);r&&(Ie.current!==null&&(clearTimeout(Ie.current),Ie.current=null),Fe.current=!0,e.dataTransfer?.setData(Yd,lf(r)))},i=function(e){if(!(e instanceof DragEvent)||!df(e))return;let t=LX(e);if(!t){BY(ze);return}e.preventDefault(),e.stopPropagation(),e.dataTransfer&&(e.dataTransfer.dropEffect=`copy`),VY(ze,t)},a=function(e){if(!(e instanceof DragEvent)||!df(e))return;let n=e.relatedTarget;n instanceof Node&&t.contains(n)||BY(ze)},o=function(e){if(!(e instanceof DragEvent)||!df(e))return;let t=LX(e),n=af(e);if(!t||n.length===0){BY(ze);return}e.preventDefault(),e.stopPropagation(),BY(ze),Ve.current(n,t.parentDir,t.busyPath)};return e.addEventListener(`dragstart`,r,{capture:!0}),e.addEventListener(`dragover`,i,{capture:!0}),e.addEventListener(`dragleave`,a,{capture:!0}),e.addEventListener(`drop`,o,{capture:!0}),e.addEventListener(`dragend`,n,{capture:!0}),window.addEventListener(`drop`,n,!0),window.addEventListener(`dragend`,n,!0),()=>{e.removeEventListener(`dragstart`,r,{capture:!0}),e.removeEventListener(`dragover`,i,{capture:!0}),e.removeEventListener(`dragleave`,a,{capture:!0}),e.removeEventListener(`drop`,o,{capture:!0}),e.removeEventListener(`dragend`,n,{capture:!0}),window.removeEventListener(`drop`,n,!0),window.removeEventListener(`dragend`,n,!0),BY(ze),Ie.current!==null&&(clearTimeout(Ie.current),Ie.current=null),Fe.current=!1}},At=[E.length,O],t[36]=E.length,t[37]=O,t[38]=kt,t[39]=At):(kt=t[38],At=t[39]),(0,Q.useEffect)(kt,At);let{selectedFilePath:jt,selectedFolderPath:Mt,navigationPath:Nt}=UJ(s,p?null:o),Pt=jt?gf(jt,E.find(e=>Ml(e)&&e.docName===jt)?.docExt):Mt?mf(Mt):s?.kind===`asset`?s.assetPath:null,Ft=ce?null:Pt,It=Ks().states,{dispatch:Lt}=Bs(),Rt;t[40]!==Lt||t[41]!==It?(Rt={installStates:It,isElectronHost:typeof window<`u`&&window.okDesktop!=null,dispatch:Lt},t[40]=Lt,t[41]=It,t[42]=Rt):Rt=t[42];let Bt=Rt,{okignoreBinding:Vt,merged:Ht}=Hu(),Ut=Ht?.appearance?.sidebar?.showHiddenFiles??!1,Wt=Ht?.appearance?.sidebar?.showOnlyMarkdownFiles??!1,Gt=Ht?.appearance?.sidebar?.showOkFolders??!1,Kt;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(Kt=()=>He.current===null,t[43]=Kt):Kt=t[43];let qt=Kt,Jt;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(Jt=[],t[44]=Jt):Jt=t[44];let Yt;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(Yt={set:`complete`,spriteSheet:cJ,byFileExtension:{md:{name:iJ,viewBox:T},mdx:{name:iJ,viewBox:T}}},t[45]=Yt):Yt=t[45];let Xt;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(Xt={contextMenu:{enabled:!0,triggerMode:`both`,buttonVisibility:`when-needed`}},t[46]=Xt):Xt=t[46];let Zt;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(Zt={canDrag:qt,canDrop:qt,onDropComplete:e=>dt.current(e),onDropError:wX},t[47]=Zt):Zt=t[47];let Qt,en;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(Qt={canRename:qt,onRename:e=>lt.current(e),onError:e=>ut.current(e)},en=e=>ct.current(e),t[48]=Qt,t[49]=en):(Qt=t[48],en=t[49]);let tn;t[50]===i?tn=t[51]:(tn={paths:Jt,initialExpansion:`closed`,fileTreeSearchMode:`hide-non-matches`,initialVisibleRowCount:18,stickyFolders:!0,...Lq,icons:Yt,unsafeCSS:XY,composition:Xt,dragAndDrop:Zt,renaming:Qt,onSelectionChange:en,renderRowDecoration:e=>{let{item:t}=e;if(t.kind===`file`){let e=De.current.docsByTreePath.get(t.path);if(e?.isSymlink){let t=e.targetPath;return{icon:nJ,title:i(t?{id:`JE21eh`,values:{targetPath:t}}:{id:`BQu9Pg`})}}return hJ(t.path)?{icon:rJ,title:i({id:`i9toLO`})}:null}let n=De.current.foldersByTreeDirectoryPath.get(mf(t.path));if(n?.isSymlink){let e=n.targetPath;return{icon:nJ,title:i(e?{id:`JE21eh`,values:{targetPath:e}}:{id:`BQu9Pg`})}}return null}},t[50]=i,t[51]=tn);let{model:nn}=Fq(tn),rn;t[52]===nn?rn=t[53]:(rn=function(e){let t=nn.getItem(e)??nn.getItem(mf(e));return t?.isDirectory()?mf(Sf(t.getPath())):e},t[52]=nn,t[53]=rn);let an=rn,on,sn;t[54]===E?(on=t[55],sn=t[56]):(sn=nf(E),on=qd(sn),t[54]=E,t[55]=on,t[56]=sn);let cn=on,ln=(0,Q.useRef)(sn),un;t[57]!==E||t[58]!==Gt?(un=ff(E,{includeOkFolders:Gt}),t[57]=E,t[58]=Gt,t[59]=un):un=t[59];let dn=un,fn=(0,Q.useRef)(dn),pn=Mt?hf(mf(Mt)).slice(0,-1):hf(Ft??Nt),mn=pn.join(`\0`),hn;t[60]===nn?hn=t[61]:(hn=()=>{let e=new Set;for(let t of fn.current)iY(nn.getItem(t))?.isExpanded()&&e.add(t);return e},t[60]=nn,t[61]=hn);let gn=hn,_n;t[62]===gn?_n=t[63]:(_n=e=>{let t=new Set(ff(e??q.current,{includeOkFolders:rt.current})),n=gn();for(let e of ke.current)n.add(e);return[...n].filter(e=>t.has(e))},t[62]=gn,t[63]=_n);let vn=_n,yn;t[64]!==vn||t[65]!==nn?(yn=e=>{let t=nf(e??q.current);nn.resetPaths(t,{initialExpandedPaths:vn(e)})},t[64]=vn,t[65]=nn,t[66]=yn):yn=t[66];let bn=yn,xn;t[67]!==i||t[68]!==Ct?(xn=async function(e){let t=Xe.current,n=new AbortController;Ye.current.set(e,n);let r=await iX(Sf(e),rt.current,n.signal,i({id:`8RtNI0`}),i({id:`HlmZBk`}));if(Ye.current.get(e)===n&&Ye.current.delete(e),n.signal.aborted||t!==Xe.current)return;if(r.kind===`network-error`){Ct(),console.warn(`[FileTree] lazy folder children fetch failed:`,e,r.cause);return}if(r.kind===`http-error`){console.warn(`[FileTree] lazy folder children http error:`,e,r.title),xt(r.title);return}let a=Al(r.entries,at());qe.current.add(e),D(t=>wY(t,e,a,Ge.current)),M(null),yt(),r.truncated&&z(r.entries.length)},t[67]=i,t[68]=Ct,t[69]=xn):xn=t[69];let Cn=xn,wn;t[70]!==gn||t[71]!==Cn?(wn=()=>{let e=gn(),t=Qe.current;Qe.current=e;for(let n of e){if(t.has(n)||qe.current.has(n)||Ye.current.has(n))continue;let e=Sf(n);q.current.find(t=>Hl(t)&&t.path===e)?.hasChildren!==!1&&Cn(n)}},t[70]=gn,t[71]=Cn,t[72]=wn):wn=t[72];let Tn=wn,En;t[73]!==gn||t[74]!==Cn?(En=()=>{for(let e of gn())qe.current.has(e)||Ye.current.has(e)||Cn(e)},t[73]=gn,t[74]=Cn,t[75]=En):En=t[75];let Dn=En,On;t[76]!==nn||t[77]!==bn?(On=(e,t,n,r)=>{let i=r===void 0?[]:r,a=0,o=null;for(let{fromDocName:r,toDocName:i}of n){let n=e.find(e=>Ml(e)&&e.docName===r);if(n==null||nn.getItem(i)==null)continue;let s=gf(i,t.find(e=>Ml(e)&&e.docName===i)?.docExt??n.docExt);nn.move(i,s),o=s,a+=1}for(let{toPath:e}of i){let t=Dl(e);if(t===``)continue;let n=e.slice(0,-t.length);nn.getItem(n)!=null&&(nn.getItem(e)??nn.move(n,e),o=e,a+=1)}a!==0&&(bn(t),o!=null&&nn.focusPath(o))},t[76]=nn,t[77]=bn,t[78]=On):On=t[78];let kn=On,An;t[79]===Symbol.for(`react.memo_cache_sentinel`)?(An=e=>{Me.current=uf(e)},t[79]=An):An=t[79];let jn=An,Mn;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(Mn=e=>we.current.has(e),t[80]=Mn):Mn=t[80];let Nn=Mn,Pn;t[81]!==i||t[82]!==y||t[83]!==ve||t[84]!==bn?(Pn=async function(e){if(e.kind===`asset`||He.current!==null)return;let t=()=>{U(null),He.current=null};He.current=e.path,U(e.path),M(null);try{let n=await A(await fetch(`/api/duplicate-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e.kind,path:e.path})}),i({id:`dw_dUJ`}));if(!n.ok){X.error(n.title),bn(),t();return}let r=P(ka,n.body,`duplicate-path`,null);if(r===null){let e=i({id:`67f-3g`});X.error(e),M(e),Kl([`files`,`backlinks`,`graph`]),bn(),t();return}for(let e of r.duplicatedDocNames)y(e);D(t=>{let n=DF(t,e,r);return bn(n),jn(n),n}),Kl([`files`,`backlinks`,`graph`]),r.path!==e.path&&(r.kind===`folder`?ve({kind:`folder`,folderPath:r.path}):ve({kind:`doc`,docName:r.path})),X.success(r.kind===`folder`?i({id:`iilQXA`}):i({id:`A6h5b-`}),{description:r.path}),t()}catch(e){let n=e,r=n instanceof Error?n.message:String(n);console.warn(`[FileTree] duplicate failed:`,n),X.error(i({id:`EBVbtP`}),{description:r}),bn(),t()}},t[81]=i,t[82]=y,t[83]=ve,t[84]=bn,t[85]=Pn):Pn=t[85];let Fn=Pn,In=(0,Q.useRef)(Fn),Ln;t[86]===Fn?Ln=t[87]:(Ln=()=>{In.current=Fn},t[86]=Fn,t[87]=Ln),(0,Q.useEffect)(Ln);let Rn=async function(e,t){if(e.kind===`file`){if(t){K(e);return}await zn(e,!1)}};async function zn(e,t){if(He.current!==null)return;let n=()=>{U(null),He.current=null,K(null)};He.current=e.path,U(e.path),M(null);let r=e.path,a=r.lastIndexOf(`/`),o=a===-1?``:r.slice(0,a),s=await _c({sourcePath:e.path,targetFolder:o,deleteSource:t});if(!s.ok){X.error(i({id:`rDOuNw`}),{description:s.error}),n();return}t&&(await Yr([e],[e.path],[]),D(t=>{let n=t.filter(t=>!(Ml(t)&&t.docName===e.path));return bn(n),jn(n),n}),Kl([`files`,`backlinks`,`graph`])),X.success(i({id:`Ba4D2x`}),{description:s.path}),n()}let Bn=function(e){let t=fJ(e);if(!t||pJ(t))return!1;let n=nn.getFocusedPath()??nn.getSelectedPaths()[0]??null;if(!n||n.endsWith(`/`)||Nn(n))return!1;let r=pJ(n);if(!r)return!1;let i=mf(t);if(!fn.current.includes(i))return!1;let a=`${t}${r}`;return ln.current.includes(a)?!1:(vr({sourcePath:n,destinationPath:a,isFolder:!1}),nn.move(n,a),!0)},Vn;t[88]===Symbol.for(`react.memo_cache_sentinel`)?(Vn=e=>{let t=e??Ae.current;!t||Ae.current!==t||(t.disposeCommitListener(),Ae.current=null)},t[88]=Vn):Vn=t[88];let Hn=Vn,Un;t[89]!==i||t[90]!==Hn||t[91]!==l||t[92]!==c||t[93]!==bn?(Un=async function(e,t){let n=t===void 0?{}:t,r=n.updateUi??!0,a=n.restoreLocation??r;Hn(e),r&&U(e.renamePath);try{let t=await fetch(`/api/delete-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e.kind,path:e.createdPath})});if(!t.ok&&t.status!==404){let n=e.kind,a=e.createdPath,o=await A(t,i({id:`EcM3k7`,values:{kind:n}}));if(o.ok)return;let s=o.title,c=i({id:`YPFBfr`,values:{detail:s,kind:n,createdPath:a}});r?X.error(c):console.warn(`[FileTree] cleanup pending create failed: ${c}`),r&&(U(null),bn());return}}catch(t){if(console.warn(`[FileTree] cleanup pending create failed:`,t),r){let t=e.kind,n=e.createdPath;X.error(i({id:`_TDESN`,values:{kind:t,createdPath:n}}))}r&&(U(null),bn());return}r&&(e.kind===`file`?l(e.createdPath):c([ge(e.createdPath)],{force:!0})),r&&D(t=>{let n=TF(t,e.kind===`file`?[e.createdPath]:[],e.kind===`folder`?e.createdPath:void 0);return jn(n),n}),Kl([`files`,`backlinks`,`graph`]),a&&(window.location.hash=e.previousHash),r&&U(null)},t[89]=i,t[90]=Hn,t[91]=l,t[92]=c,t[93]=bn,t[94]=Un):Un=t[94];let Wn=Un,Gn,Kn;t[95]===Symbol.for(`react.memo_cache_sentinel`)?(Gn=()=>()=>{let e=Ae.current;e&&je.current(e,{restoreLocation:!1,updateUi:!1}).catch(CX)},Kn=[],t[95]=Gn,t[96]=Kn):(Gn=t[95],Kn=t[96]),(0,Q.useEffect)(Gn,Kn);let qn;t[97]!==i||t[98]!==Ct?(qn=()=>{let e=!0,t=null,n=Ms(async function(){t?.abort();let n=new AbortController;t=n,Xe.current+=1;for(let e of Ye.current.values())e.abort();Ye.current.clear(),qe.current.clear();try{let t=await fetch(rX(``,rt.current),{signal:n.signal,headers:_Y});if(vY(t)){let r=at(),i=!1,{entries:a,truncated:o}=await xY(t,{onBatch:t=>{if(!e||n.signal.aborted)return;let a=Al(Ol(t),r);a.length!==0&&(D(e=>CY(e,a)),i||(i=!0,M(null),yt(),k(!1)))}});if(!e)return;let s=Ol(a),c=Al(s,r);D(e=>wY(e,``,c,Ge.current)),M(null),yt(),z(o?a.length:null),V(s.length),et.current()}else{let n=await A(t,i({id:`8RtNI0`}));if(!e)return;if(!n.ok)xt(n.title),z(null);else{let e=xo.safeParse(n.body);if(!e.success)xt(i({id:`HlmZBk`})),z(null);else{let t=Ol(e.data.documents),n=Al(t,at());D(e=>wY(e,``,n,Ge.current)),M(null),yt(),z(e.data.truncated===!0?e.data.documents.length:null),V(t.length),et.current()}}}}catch(t){let r=t;if(n.signal.aborted)return;e&&(r instanceof yY?xt(r.message):Ct()),console.warn(`[FileTree] fetch failed:`,r)}e&&k(!1)},()=>t?.abort());ot.current=()=>n.request(),n.request();let r=()=>{document.visibilityState===`visible`&&n.request()};window.addEventListener(`focus`,r),window.addEventListener(`visibilitychange`,r);let a=ql(e=>{e.includes(`files`)&&n.request()});return()=>{e=!1,ot.current=null,n.dispose();for(let e of Ye.current.values())e.abort();Ye.current.clear(),window.removeEventListener(`focus`,r),window.removeEventListener(`visibilitychange`,r),a()}},t[97]=i,t[98]=Ct,t[99]=qn):qn=t[99];let Jn;t[100]===i?Jn=t[101]:(Jn=[i],t[100]=i,t[101]=Jn),(0,Q.useEffect)(qn,Jn);let Yn=(0,Q.useRef)(!0),Xn;t[102]===Symbol.for(`react.memo_cache_sentinel`)?(Xn=()=>{if(Yn.current){Yn.current=!1;return}ot.current?.()},t[102]=Xn):Xn=t[102];let Zn;t[103]!==Ut||t[104]!==Gt||t[105]!==Wt?(Zn=[Ut,Wt,Gt],t[103]=Ut,t[104]=Gt,t[105]=Wt,t[106]=Zn):Zn=t[106],(0,Q.useEffect)(Xn,Zn);let Qn,$n;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(Qn=()=>{let e=!0;return fetch(`/api/workspace`).then(async t=>{let n=await t.json();if(!e||!t.ok)return;let r=P(ba,n,`workspace`,null);r&&se({contentDir:r.contentDir,pathSeparator:r.pathSeparator})}).catch(SX),()=>{e=!1}},$n=[],t[107]=Qn,t[108]=$n):(Qn=t[107],$n=t[108]),(0,Q.useEffect)(Qn,$n);let er;t[109]!==vn||t[110]!==nn||t[111]!==cn?(er=()=>{if(Me.current===cn){Me.current=null;return}nn.resetPaths(ln.current,{initialExpandedPaths:vn()})},t[109]=vn,t[110]=nn,t[111]=cn,t[112]=er):er=t[112];let tr;t[113]!==nn||t[114]!==cn?(tr=[nn,cn],t[113]=nn,t[114]=cn,t[115]=tr):tr=t[115],(0,Q.useEffect)(er,tr),sY(nn,Ft,mn,Pe,cn);let nr,rr;t[116]!==nn||t[117]!==r?(nr=()=>{if(!r)return;let e=0,t=0,n=()=>st.current?.querySelector(`file-tree-container`)?.shadowRoot?.querySelector(`[data-file-tree-virtualized-list]`)??null,i=()=>{let e=n();if(!e)return;let t=Number.parseFloat(e.style.height);Number.isFinite(t)&&r(t)},a=()=>{cancelAnimationFrame(e),e=requestAnimationFrame(i)},o=new MutationObserver(i),s=()=>{let e=n();e?(o.observe(e,{attributes:!0,attributeFilter:[`style`]}),i()):t=requestAnimationFrame(s)};s();let c=nn.subscribe(a);return window.addEventListener(`resize`,a),()=>{cancelAnimationFrame(e),cancelAnimationFrame(t),o.disconnect(),c(),window.removeEventListener(`resize`,a)}},rr=[r,nn],t[116]=nn,t[117]=r,t[118]=nr,t[119]=rr):(nr=t[118],rr=t[119]),(0,Q.useEffect)(nr,rr);let ir;t[120]===Symbol.for(`react.memo_cache_sentinel`)?(ir=()=>{le(!1)},t[120]=ir):ir=t[120];let ar;t[121]===Pt?ar=t[122]:(ar=[Pt],t[121]=Pt,t[122]=ar),(0,Q.useEffect)(ir,ar);let or,sr;t[123]===ce?(or=t[124],sr=t[125]):(or=()=>{ue.current=ce;for(let e of fe.current)e()},sr=[ce],t[123]=ce,t[124]=or,t[125]=sr),(0,Q.useEffect)(or,sr);let cr;t[126]!==Ft||t[127]!==O||t[128]!==nn?(cr=()=>{O||!Ft||VJ(nn,Ft)},t[126]=Ft,t[127]=O,t[128]=nn,t[129]=cr):cr=t[129];let lr;t[130]!==mn||t[131]!==Ft||t[132]!==O||t[133]!==nn||t[134]!==cn?(lr=[Ft,mn,cn,O,nn],t[130]=mn,t[131]=Ft,t[132]=O,t[133]=nn,t[134]=cn,t[135]=lr):lr=t[135],(0,Q.useEffect)(cr,lr);let ur,dr;t[136]===nn?(ur=t[137],dr=t[138]):(ur=()=>nn.subscribe(()=>{if(!nn.isSearchOpen())for(let e of ke.current){let t=iY(nn.getItem(e));t&&!t.isExpanded()&&t.expand()}}),dr=[nn],t[136]=nn,t[137]=ur,t[138]=dr),(0,Q.useEffect)(ur,dr);let fr,pr;t[139]===nn?(fr=t[140],pr=t[141]):(fr=()=>nn.subscribe(()=>$e.current()),pr=[nn],t[139]=nn,t[140]=fr,t[141]=pr),(0,Q.useEffect)(fr,pr);let mr,hr;t[142]===nn?(mr=t[143],hr=t[144]):(mr=()=>nn.onMutation(`remove`,e=>{let t=Ae.current;!t||e.path!==t.renamePath||je.current(t)}),hr=[nn],t[142]=nn,t[143]=mr,t[144]=hr),(0,Q.useEffect)(mr,hr);let gr;t[145]!==y||t[146]!==u||t[147]!==d||t[148]!==ve||t[149]!==f||t[150]!==kn||t[151]!==g?(gr=async(e,t,n,r,i)=>{let a=t===void 0?[]:t,o=n===void 0?[]:n,s=i===void 0?[]:i,c=r?.docName??xe.current,l=new Map,p=new Map;for(let e of q.current){if(Ml(e)){let t=o.find(t=>t.fromPath===gf(e.docName,e.docExt))?.toPath;t&&l.set(e.docName,t);continue}if(Ul(e)){let t=o.find(t=>t.fromPath===e.path)?.toPath;t&&Tl(t)&&p.set(e.path,tf(t))}}let m=c?l.get(c)??null:null,h=r?.folderPath??(ft.current?.kind===`folder`?ft.current.folderPath:null),_=h?Be(h,a):null,v=r?.assetPath??(ft.current?.kind===`asset`?ft.current.assetPath:null),b=v?p.get(v)??null:null,x=m?null:b??OF(c,e),S=m??(v?b?null:o.find(e=>e.fromPath===v)?.toPath??Be(v,a):null);pe(e);let C=[...kF(e,d(),f),...l.keys()];await Promise.all(C.map(e=>u(e)));for(let t of e)y(t.toDocName);for(let e of p.values())y(e);g(e,a,o);let w=null;D(t=>{let n=wF(t,e,a,o,s);return w=n,kn(t,n,e,o),jn(n),n}),h&&_&&_!==h?ve({kind:`folder`,folderPath:_}):x&&x!==c?(ve({kind:`doc`,docName:x}),zY(x)):S&&(m||S!==v)&&ve({kind:`asset`,assetPath:S,entries:w??q.current}),Kl([`files`,`backlinks`,`graph`])},t[145]=y,t[146]=u,t[147]=d,t[148]=ve,t[149]=f,t[150]=kn,t[151]=g,t[152]=gr):gr=t[152];let _r=gr;async function vr(e){let t=!e.isFolder&&Nn(e.sourcePath),n=t?e.sourcePath:sf(e.sourcePath,e.isFolder);U(n),M(null);try{let r=El(e.sourcePath,e.destinationPath,e.isFolder),a=!e.isFolder&&!t&&!Tl(r.destinationPath),o=t||a?r.destinationPath:sf(r.destinationPath,e.isFolder),s=e.isFolder?{kind:`folder`,fromPath:Sf(n),toPath:Sf(o)}:t||a?{kind:`asset`,fromPath:n,toPath:o}:{kind:`file`,fromPath:xf(n,q.current),toPath:o},c={docName:xe.current,folderPath:ft.current?.kind===`folder`?ft.current.folderPath:null,assetPath:ft.current?.kind===`asset`?ft.current.assetPath:null},l=await A(await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(s)}),i({id:`gijbne`}));if(!l.ok){X.error(l.title),bn();let e=Ae.current;e&&e.renamePath===n?await Wn(e):Hn(),U(null);return}let u=P(Ua,l.body,`rename-path`,{renamed:[],renamedAssets:[]});try{await _r(u.renamed,e.isFolder?[{fromPath:Sf(n),toPath:Sf(o)}]:[],u.renamedAssets,c,!e.isFolder&&!t&&!a?u.renamed.flatMap(e=>{let t=Dl(o);return t?[{toDocName:e.toDocName,docExt:t}]:[]}):[])}catch(e){console.warn(`[FileTree] post-rename reconciliation failed`,{err:e,sourceTreePath:n,destinationTreePath:o,renamedCount:u.renamed.length,renamedAssetCount:u.renamedAssets.length}),X.error(i({id:`dDpCOp`}))}Hn(),U(null)}catch(e){console.warn(`[FileTree] rename failed:`,e);let t=i({id:`HIb0vl`});X.error(t),M(t),bn();let r=Ae.current;r&&r.renamePath===n?await Wn(r):Hn(),U(null)}}let yr;t[153]!==i||t[154]!==_r||t[155]!==bn?(yr=async function(e){let t=e.draggedPaths.map(t=>{let n=cf(t,e.target);return t===n?null:{sourcePath:t,destinationTreePath:n}}).filter(xX);if(t.length!==0){U(t[0]?.sourcePath??null),M(null);try{let e=[],n=[],r=[],a={docName:xe.current,folderPath:ft.current?.kind===`folder`?ft.current.folderPath:null,assetPath:ft.current?.kind===`asset`?ft.current.assetPath:null};for(let a of t){let t=a.sourcePath.endsWith(`/`),o=!t&&Nn(a.sourcePath),s=o?null:xf(a.sourcePath,q.current),c=t?{kind:`folder`,fromPath:Sf(a.sourcePath),toPath:Sf(a.destinationTreePath)}:o?{kind:`asset`,fromPath:a.sourcePath,toPath:a.destinationTreePath}:{kind:`file`,fromPath:s??tf(a.sourcePath),toPath:s&&Tl(s)?a.destinationTreePath:tf(a.destinationTreePath)},l=await A(await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(c)}),i({id:`dOHMA0`}));if(!l.ok){X.error(l.title),bn(),U(null);return}let u=P(Ua,l.body,`rename-path:drop`,{renamed:[],renamedAssets:[]});e=e.concat(u.renamed),n=n.concat(u.renamedAssets),t&&r.push({fromPath:Sf(a.sourcePath),toPath:Sf(a.destinationTreePath)})}try{await _r(e,r,n,a)}catch(r){console.warn(`[FileTree] post-move reconciliation failed`,{err:r,operationCount:t.length,renamedCount:e.length,renamedAssetCount:n.length}),X.error(i({id:`8OxKZy`}))}U(null)}catch(e){console.warn(`[FileTree] move failed:`,e),X.error(i({id:`HIb0vl`})),bn(),U(null)}}},t[153]=i,t[154]=_r,t[155]=bn,t[156]=yr):yr=t[156];let br=yr,xr;t[157]!==i||t[158]!==y||t[159]!==bn?(xr=async function(e,t,n){if(e.length===0||He.current!==null)return;let r=()=>{He.current=null,U(null)};He.current=n,U(n),M(null);let a=[],o=0,s=0;for(let n of e){let e=new FormData;e.append(`file`,n),_f(e,t,n.name||`upload`);try{let r=await A(await fetch(`/api/upload`,{method:`POST`,body:e}),i({id:`4Gz2wC`}));if(!r.ok){s+=1,X.error(r.title,{description:n.name});continue}let c=P(Sa,r.body,`upload:drop`,null);if(c===null){s+=1,X.error(i({id:`4Gz2wC`}),{description:n.name});continue}let l=Qd(t,c);if(c.deduped===!0){s+=1,X.error(i({id:`4sKwf6`}),{description:l});continue}o+=1;let u=vf(l,n);u&&a.push(u)}catch(e){let t=e;s+=1,console.warn(`[FileTree] external file upload failed:`,t),X.error(t instanceof TypeError?i({id:`HIb0vl`}):i({id:`4Gz2wC`}),{description:n.name})}}try{if(a.length>0){for(let e of a)Ml(e)&&y(e.docName);D(e=>{let t=new Set(e.map(rf)),n=!1,r=[...e];for(let e of a){let i=rf(e);Ge.current.set(i,Date.now()),!t.has(i)&&(t.add(i),r.push(e),n=!0)}return n?(bn(r),jn(r),r):e})}o>0&&(Kl([`files`,`backlinks`,`graph`]),ot.current?.(),X.success(yl._({id:`v75Em9`,values:{uploadedCount:o}}),{description:t||i({id:`RSqaSd`})})),s>0&&M(o>0?yl._({id:`yH7T4q`,values:{failedCount:s}}):i({id:`4Gz2wC`})),r()}catch(e){let t=e,n=i({id:`VcqWBy`});console.warn(`[FileTree] upload post-upload reconciliation failed:`,t),X.error(n),M(n),r()}},t[157]=i,t[158]=y,t[159]=bn,t[160]=xr):xr=t[160];let Sr=xr,Cr;t[161]===Symbol.for(`react.memo_cache_sentinel`)?(Cr=function(e){ae({parentDir:e})},t[161]=Cr):Cr=t[161];let wr=Cr,Tr;t[162]!==i||t[163]!==y||t[164]!==Wn||t[165]!==Hn||t[166]!==nn||t[167]!==ve||t[168]!==bn||t[169]!==sn?(Tr=async function(e,t,n){if(He.current)return;let r=Ae.current;r&&Hn(r);try{let r=pf(e,t,[...sn,...fn.current]);U(r.renamePath),He.current=r.renamePath;let a=window.location.hash,o;if(e===`file`){let e=ef(`file`,r.addPath),t={path:e};n?.template&&(t.template=n.template);let a=await A(await fetch(`/api/create-page`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)}),i({id:`fJgQHX`}));if(!a.ok){X.error(a.title),U(null),He.current=null;return}let s=tf(e),c=P(Wa,a.body,`create-page`,{docName:s}).docName;o=c;let l={kind:`document`,docName:c,docExt:e.toLowerCase().endsWith(`.mdx`)?`.mdx`:`.md`,modified:new Date().toISOString(),size:0};y(c),D(e=>{if(e.some(e=>Ml(e)&&e.docName===c))return e;let t=[...e,l];return jn(t),Ge.current.set(rf(l),Date.now()),t}),Kl([`files`,`backlinks`,`graph`]),ve({kind:`doc`,docName:c})}else{let e=Sf(r.addPath),t=await A(await fetch(`/api/create-folder`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e})}),i({id:`K1ckLX`}));if(!t.ok){X.error(t.title),U(null),He.current=null;return}o=P(Wo,t.body,`create-folder`,{path:e}).path;let n={kind:`folder`,path:o,modified:new Date().toISOString(),size:0};D(e=>{if(e.some(e=>Hl(e)&&e.path===o))return e;let t=[...e,n];return jn(t),Ge.current.set(rf(n),Date.now()),t}),Kl([`files`]),ve({kind:`folder`,folderPath:o})}let s=!1,c=e=>{if(e.key!==`Enter`)return;let t=Ae.current;!t||t.renamePath!==r.renamePath||queueMicrotask(()=>Hn(t))};document.addEventListener(`keydown`,c,!0),Ae.current={kind:e,renamePath:r.renamePath,createdPath:o,previousHash:a,disposeCommitListener:()=>{s||(s=!0,document.removeEventListener(`keydown`,c,!0))}},U(null),He.current=null,nn.add(r.addPath),nn.startRenaming(r.renamePath,{removeIfCanceled:!0})}catch(e){console.warn(`[FileTree] create placeholder failed:`,e),X.error(i({id:`S6l5dv`}));let t=Ae.current;t?await Wn(t):Hn(),U(null),He.current=null,bn()}},t[162]=i,t[163]=y,t[164]=Wn,t[165]=Hn,t[166]=nn,t[167]=ve,t[168]=bn,t[169]=sn,t[170]=Tr):Tr=t[170];let Er=Tr,Dr;t[171]===nn?Dr=t[172]:(Dr=function(e){let t=mf(e);(0,Q.startTransition)(()=>{for(let e of fn.current)if(e===t||e.startsWith(t)){let t=iY(nn.getItem(e));t&&t.expand()}})},t[171]=nn,t[172]=Dr);let Or=Dr,kr;t[173]===nn?kr=t[174]:(kr=function(e){let t=mf(e),n=new Set(ke.current);(0,Q.startTransition)(()=>{for(let e of[...fn.current].reverse())if((e===t||e.startsWith(t))&&!n.has(e)){let t=iY(nn.getItem(e));t&&t.collapse()}})},t[173]=nn,t[174]=kr);let Ar=kr,jr;t[175]===Symbol.for(`react.memo_cache_sentinel`)?(jr=function(){return((st.current?.querySelector(`file-tree-container`)?.shadowRoot)?.querySelector(`[aria-selected="true"][data-item-path]`))?.dataset.itemPath??null},t[175]=jr):jr=t[175];let Mr=jr,Nr;t[176]!==be||t[177]!==pn||t[178]!==o||t[179]!==s||t[180]!==Ce||t[181]!==H||t[182]!==Wn||t[183]!==Tn||t[184]!==E||t[185]!==dn||t[186]!==br||t[187]!==vr||t[188]!==an||t[189]!==b||t[190]!==Bn||t[191]!==Dn||t[192]!==Ee||t[193]!==Ut||t[194]!==Gt||t[195]!==Wt||t[196]!==sn||t[197]!==Sr?(Nr=()=>{q.current=E,De.current=Ee,me.current=b,xe.current=o,ft.current=s,we.current=Ce,He.current=H,tt.current=Ut,nt.current=Wt,rt.current=Gt,ln.current=sn,fn.current=dn,ke.current=pn,$e.current=Tn,et.current=Dn,je.current=Wn,Ve.current=(e,t,n)=>{Sr(e,t,n)},ct.current=e=>{if(Pe.current||Fe.current||e.length!==1)return;let t=e[0];if(t){le(!1);let e=an(t),n=he.current,r=n!==null&&tf(n)===tf(e),i=r?n:e;he.current=null,queueMicrotask(()=>{be(an((r?null:Mr())??i),q.current)})}},ut.current=e=>{Bn(e)||X.error(e)},lt.current=vr,dt.current=br},t[176]=be,t[177]=pn,t[178]=o,t[179]=s,t[180]=Ce,t[181]=H,t[182]=Wn,t[183]=Tn,t[184]=E,t[185]=dn,t[186]=br,t[187]=vr,t[188]=an,t[189]=b,t[190]=Bn,t[191]=Dn,t[192]=Ee,t[193]=Ut,t[194]=Gt,t[195]=Wt,t[196]=sn,t[197]=Sr,t[198]=Nr):Nr=t[198],(0,Q.useLayoutEffect)(Nr);let Pr,Fr;t[199]===nn?(Pr=t[200],Fr=t[201]):(Pr=()=>{let e=e=>{let t=(e.metaKey||e.ctrlKey)&&!e.altKey,n=e.key.toLowerCase(),r=t&&n===`a`,i=t&&!e.shiftKey&&n===`d`,a=t&&!e.shiftKey&&n===`c`,o=t&&!e.shiftKey&&n===`v`,s=!e.altKey&&!e.shiftKey&&(e.metaKey&&!e.ctrlKey&&n===`backspace`||!e.metaKey&&!e.ctrlKey&&n===`delete`);if(!r&&!i&&!a&&!o&&!s||EJ(e.target))return;let c=st.current,l=e.target,u=document.activeElement,d=l instanceof Node&&c?.contains(l),f=u instanceof Node&&c?.contains(u);if(!d&&!f)return;if(a){let t=CJ(nn,q.current,we.current);if(!t)return;Ue.current=t,e.preventDefault(),e.stopPropagation();return}if(o){let t=Ue.current;if(!t)return;In.current(t),e.preventDefault(),e.stopPropagation();return}if(i){let t=CJ(nn,q.current,we.current);if(!t)return;In.current(t),e.preventDefault(),e.stopPropagation();return}if(s){if(He.current!==null)return;let t=wJ(nn,q.current);if(t.length===0)return;ee({targets:t}),e.preventDefault(),e.stopPropagation();return}let p=new Set([...fn.current,...ln.current]);Pe.current=!0;for(let e of p)e&&nn.getItem(e)?.select();queueMicrotask(()=>{Pe.current=!1}),e.preventDefault(),e.stopPropagation()};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},Fr=[nn],t[199]=nn,t[200]=Pr,t[201]=Fr),(0,Q.useEffect)(Pr,Fr);let Ir,Lr;t[202]!==E.length||t[203]!==O?(Ir=()=>{if(O||E.length===0)return;let e=st.current?.querySelector(OR)?.shadowRoot;if(!e)return;let t=bX,n=()=>{for(let n of e.querySelectorAll(`[data-item-path]`)){let e=n.dataset.itemPath;if(!e)continue;let r=t(e);n.title!==r&&(n.title=r)}let n=e.querySelector(`[data-type="context-menu-anchor"]`);if(n){let r=e.querySelector(`[data-item-context-hover="true"][data-item-path]`)?.dataset.itemPath,i=r?t(r):``;n.title!==i&&(n.title=i)}};n();let r=new MutationObserver(n);return r.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`data-item-path`,`data-item-context-hover`]}),()=>r.disconnect()},Lr=[O,E.length],t[202]=E.length,t[203]=O,t[204]=Ir,t[205]=Lr):(Ir=t[204],Lr=t[205]),(0,Q.useEffect)(Ir,Lr);let Rr,zr;t[206]!==E.length||t[207]!==O?(Rr=()=>{if(O||E.length===0)return;let e=st.current?.querySelector(OR)?.shadowRoot;if(!e)return;let t=()=>Kq(e);t();let n=new MutationObserver(t);return n.observe(e,{subtree:!0,childList:!0,characterData:!0,attributes:!0,attributeFilter:[`data-item-path`]}),()=>n.disconnect()},zr=[O,E.length],t[206]=E.length,t[207]=O,t[208]=Rr,t[209]=zr):(Rr=t[208],zr=t[209]),(0,Q.useEffect)(Rr,zr);let Br,Vr;t[210]!==E.length||t[211]!==O?(Br=()=>{if(O||E.length===0)return;let e=st.current?.querySelector(OR)?.shadowRoot;if(!e)return;let t=()=>IJ(e);t();let n=new MutationObserver(t);return n.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`data-item-path`]}),()=>n.disconnect()},Vr=[O,E.length],t[210]=E.length,t[211]=O,t[212]=Br,t[213]=Vr):(Br=t[212],Vr=t[213]),(0,Q.useEffect)(Br,Vr);let Hr;t[214]===Symbol.for(`react.memo_cache_sentinel`)?(Hr={folderCount:0,expandedCount:0},t[214]=Hr):Hr=t[214];let Ur=(0,Q.useRef)(Hr),Wr=(0,Q.useRef)(Er),Gr=(0,Q.useRef)(wr),Kr;t[215]===Er?Kr=t[216]:(Kr=()=>{Wr.current=Er,Gr.current=wr},t[215]=Er,t[216]=Kr),(0,Q.useEffect)(Kr);let qr,Jr;t[217]===nn?(qr=t[218],Jr=t[219]):(qr=()=>({startCreating(e,t){Wr.current(e,t)},startCreatingFromTemplate(e){Gr.current(e)},createFromTemplate(e,t){Wr.current(`file`,e,{template:t})},expandAll(){(0,Q.startTransition)(()=>{for(let e of fn.current){let t=iY(nn.getItem(e));t&&t.expand()}})},collapseAll(){let e=new Set(ke.current);(0,Q.startTransition)(()=>{for(let t of[...fn.current].reverse()){if(e.has(t))continue;let n=iY(nn.getItem(t));n&&n.collapse()}})},getFolderState(){let e=fn.current,t=0;for(let n of e)iY(nn.getItem(n))?.isExpanded()&&t++;let n=e.length,r=Ur.current;if(r.folderCount===n&&r.expandedCount===t)return r;let i={folderCount:n,expandedCount:t};return Ur.current=i,i},isCreationTargetCleared(){return ue.current},clearCreationTarget(){le(!0)},subscribe(e){fe.current.add(e);let t=nn.subscribe(e);return()=>{fe.current.delete(e),t()}}}),Jr=[nn],t[217]=nn,t[218]=qr,t[219]=Jr),(0,Q.useImperativeHandle)(n,qr,Jr);async function Yr(e,t,n){let r=DJ(e,q.current,fn.current),i=Ae.current;i&&e.some(e=>OJ(e,i))&&(i.kind===`file`?r.docNames.add(i.createdPath):r.folderPaths.add(i.createdPath),Hn(i));let a=new Set([...r.docNames,...t]),o=new Set([...r.folderPaths,...n]),s=new Set([...r.assetPaths,...e.filter(yX).map(vX)]);c([...[...a].map(_X),...[...o].map(gX),...[...s].map(hX)],{force:!0}),await Promise.all([...a].map(e=>u(e)));for(let t of e){let e=t.kind===`folder`?mf(t.path):t.kind===`asset`?t.path:gf(t.path,t.docExt);nn.getItem(e)&&nn.remove(e,t.kind===`folder`?{recursive:!0}:void 0)}D(e=>{let t=TF(e,[...a],void 0,[...s]);for(let e of o)t=TF(t,[],e);return jn(t),t}),Kl([`files`,`backlinks`,`graph`])}let Xr;t[220]!==i||t[221]!==Yr?(Xr=async function(e){let t=[],n=[],r=[];for(let a of e){let e=a.kind;U(a.path);let o=await A(await fetch(`/api/delete-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e,path:a.path})}),i({id:`7JtSLi`}));if(!o.ok)return r.length>0&&await Yr(r,t,n),X.error(o.title),!1;let s=P(Ma,o.body,`delete-path`,{deletedDocNames:[]});t.push(...s.deletedDocNames),e===`folder`&&n.push(a.path),r.push(a)}return await Yr(r,t,n),!0},t[220]=i,t[221]=Yr,t[222]=Xr):Xr=t[222];let Zr=Xr,Qr;t[223]===Symbol.for(`react.memo_cache_sentinel`)?(Qr=async function(e,t,n){let r=[],i=[];for(let a of e){U(a.path);let e=AF(a,n),o=await t.shell.trashItem(e);o.ok?r.push(a):i.push({kind:a.kind,path:a.path,name:a.name,reason:ZJ(o.reason),detail:o.detail})}return{trashed:r,failed:i}},t[223]=Qr):Qr=t[223];let $r=Qr,ei;t[224]===i?ei=t[225]:(ei=async function(e){let t=[],n=[],r=[];for(let a of e){let e=a.kind;try{let o=await A(await fetch(`/api/trash/cleanup`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e,path:a.path})}),i({id:`DVh_Tb`}));if(!o.ok){console.warn(`[FileTree] trash-cleanup failed`,{target:`${a.kind}:${a.path}`,reason:o.title}),r.push({target:a,reason:o.title});continue}let s=P(Qa,o.body,`trash-cleanup`,{deletedDocNames:[]});t.push(...s.deletedDocNames),e===`folder`&&n.push(a.path)}catch(e){let t=e;console.warn(`[FileTree] trash-cleanup threw`,{target:`${a.kind}:${a.path}`,err:t}),r.push({target:a,reason:i({id:`r4R7AZ`})})}}if(r.length>0){let e=r.length;X.error(i({id:`IrB5AK`,values:{failedCount:e}}),{description:i({id:`vEJDlt`})})}return r.length===e.length&&e.length>0?null:{deletedDocNames:t,deletedFolderPaths:n}},t[224]=i,t[225]=ei);let ti=ei,ni;t[226]!==i||t[227]!==re||t[228]!==Yr||t[229]!==Zr||t[230]!==ti||t[231]!==bn||t[232]!==oe?(ni=async function(e){let t=e.filter(mX).map(e=>EF(e,q.current)),n=t[0];if(!n)return;let r=re.filter(e=>t.some(t=>{if(t.kind===`file`){let n=`${t.path}${t.docExt??`.md`}`;return e.file===n}return t.kind===`folder`?e.file.startsWith(`${t.path}/`):!1}));if(r.length>0){let e=r.slice(0,3).map(pX),t=r.length>e.length?`, +${r.length-e.length} more`:``;X.error(`Cannot delete files with unresolved conflicts`,{description:`Resolve the conflict on ${e.join(`, `)}${t} before deleting.`});return}U(n.path),ee(null);let a=typeof window<`u`?window.okDesktop:void 0;try{if(a&&oe){let{trashed:e,failed:n}=await $r(t,a,oe);if(e.length>0){let t=await ti(e);t?await Yr(e,t.deletedDocNames,t.deletedFolderPaths):await Yr(e,e.filter(fX).map(dX),e.filter(uX).map(lX))}n.length>0&&ne({failed:n,originalTargets:[...t]}),U(null)}else{let e=await Zr(t);U(null),e||bn()}}catch(e){let t=e,n=t instanceof Error?t.message:String(t);console.warn(`[FileTree] delete failed:`,t),X.error(i({id:`0eHrMb`}),{description:n}),U(null),bn()}},t[226]=i,t[227]=re,t[228]=Yr,t[229]=Zr,t[230]=ti,t[231]=bn,t[232]=oe,t[233]=ni):ni=t[233];let ri=ni,ii;t[234]!==i||t[235]!==Zr||t[236]!==bn||t[237]!==te?(ii=async function(){if(!te)return;let e=new Set(te.failed.map(cX)),t=te.originalTargets.filter(t=>e.has(`${t.kind}:${t.path}`));if(ne(null),t.length!==0){U(t[0]?.path??null);try{let e=await Zr(t);U(null),e||bn()}catch(e){let t=e,n=t instanceof Error?t.message:String(t);console.warn(`[FileTree] hard-delete fallback failed:`,t),X.error(i({id:`0eHrMb`}),{description:n}),U(null),bn()}}},t[234]=i,t[235]=Zr,t[236]=bn,t[237]=te,t[238]=ii):ii=t[238];let ai=ii,oi;t[239]!==ri||t[240]!==te?(oi=async function(){if(!te)return;let e=new Set(te.failed.map(sX)),t=te.originalTargets.filter(t=>e.has(`${t.kind}:${t.path}`));ne(null),await ri(t)},t[239]=ri,t[240]=te,t[241]=oi):oi=t[241];let si=oi,ci=(0,Q.useRef)(ri),li;t[242]===ri?li=t[243]:(li=()=>{ci.current=ri},t[242]=ri,t[243]=li),(0,Q.useEffect)(li);let ui,di;t[244]===Symbol.for(`react.memo_cache_sentinel`)?(ui=()=>fY(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=q.current.find(e=>Ml(e)&&e.docName===t);ci.current([{kind:`file`,path:t,name:t.split(`/`).pop()??t,docExt:n?.docExt}]);return}if(e.kind===`folder`){ci.current([{kind:`folder`,path:e.folderPath,name:e.folderPath.split(`/`).pop()??e.folderPath}]);return}if(e.kind===`asset`){ci.current([{kind:`asset`,path:e.assetPath,name:e.assetPath.split(`/`).pop()??e.assetPath}]);return}console.warn(JSON.stringify({event:`file-tree-menu-action-delete-unsupported-kind`,kind:e.kind}))}),di=[],t[244]=ui,t[245]=di):(ui=t[244],di=t[245]),(0,Q.useEffect)(ui,di);let fi,pi;t[246]===Symbol.for(`react.memo_cache_sentinel`)?(fi=()=>gY(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=q.current.find(e=>Ml(e)&&e.docName===t);In.current({kind:`file`,path:t,name:t.split(`/`).pop()??t,docExt:n?.docExt});return}if(e.kind===`folder`){In.current({kind:`folder`,path:e.folderPath,name:e.folderPath.split(`/`).pop()??e.folderPath});return}console.warn(JSON.stringify({event:`file-tree-menu-action-duplicate-unsupported-kind`,kind:e.kind}))}),pi=[],t[246]=fi,t[247]=pi):(fi=t[246],pi=t[247]),(0,Q.useEffect)(fi,pi);let mi,hi;t[248]===nn?(mi=t[249],hi=t[250]):(mi=()=>mY(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=gf(t,q.current.find(e=>Ml(e)&&e.docName===t)?.docExt);nn.startRenaming(n);return}if(e.kind===`folder`){nn.startRenaming(e.folderPath);return}if(e.kind===`asset`){nn.startRenaming(e.assetPath);return}console.warn(JSON.stringify({event:`file-tree-menu-action-rename-unsupported-kind`,kind:e.kind}))}),hi=[nn],t[248]=nn,t[249]=mi,t[250]=hi),(0,Q.useEffect)(mi,hi);let gi;t[251]===Symbol.for(`react.memo_cache_sentinel`)?(gi=function(){let e=Ne.current;e&&RY(e),Ne.current=null},t[251]=gi):gi=t[251];let _i=gi,vi;t[252]===Symbol.for(`react.memo_cache_sentinel`)?(vi=function(e){let t=_J(e);if(!t)return!1;let n=st.current?.querySelector(OR)?.shadowRoot;if(!n)return!1;for(let e of n.querySelectorAll(`[data-item-path]`))if(e.dataset.itemPath===t)return!0;return!1},t[252]=vi):vi=t[252];let bi=vi,xi;t[253]===h?xi=t[254]:(xi=function(e){let t=PX(e.nativeEvent);if(!t||t.endsWith(`/`)){_i();return}let n=q.current.find(e=>rf(e)===t);if(n&&Ul(n)){_i();return}let r=n&&Ml(n)?n.docName:xf(t,q.current);if(n&&Ml(n)&&Lo(n.size)){_i();return}Ne.current!==r&&(_i(),Ne.current=r,LY(r,e=>h(e)))},t[253]=h,t[254]=xi);let Si=xi,Ci;t[255]!==be||t[256]!==nn||t[257]!==ve?(Ci=function(e){if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=FX(e.nativeEvent);if(!t){RX(e.nativeEvent)&&le(!0);return}let n=t.getAttribute(`aria-selected`)===`true`,r=t.dataset.itemPath;if(!r)return;let i=t.dataset.itemType===`folder`?mf(r):r;if(t.dataset.itemType===`folder`){let t=Sf(i),r=iY(nn.getItem(i));if(!n){e.preventDefault(),e.stopPropagation(),r&&!r.isExpanded()&&r.expand(),queueMicrotask(()=>ve({kind:`folder`,folderPath:t}));return}if(nn.getSelectedPaths().length!==1||window.location.hash===tu(t))return;e.preventDefault(),e.stopPropagation(),r&&!r.isExpanded()&&r.expand(),queueMicrotask(()=>ve({kind:`folder`,folderPath:t}));return}if(!n){if(vJ(i,ln.current)||bi(i)){he.current=i,setTimeout(()=>ve({kind:`doc`,docName:i,registerPage:!0}),0);return}queueMicrotask(()=>be(i));return}let a=xf(i,q.current);nn.getSelectedPaths().length===1&&window.location.hash!==lu(a)&&queueMicrotask(()=>be(i))},t[255]=be,t[256]=nn,t[257]=ve,t[258]=Ci):Ci=t[258];let wi=Ci,Ti;t[259]===Symbol.for(`react.memo_cache_sentinel`)?(Ti=function(e){df(e.nativeEvent)&&(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=`copy`,mt(!0))},t[259]=Ti):Ti=t[259];let Ei=Ti,Di;t[260]===Symbol.for(`react.memo_cache_sentinel`)?(Di=function(e){let t=e.relatedTarget;t instanceof Node&&e.currentTarget.contains(t)||mt(!1)},t[260]=Di):Di=t[260];let Oi=Di,ki;t[261]===Sr?ki=t[262]:(ki=function(e){if(!df(e.nativeEvent))return;let t=af(e.nativeEvent);t.length!==0&&(e.preventDefault(),e.stopPropagation(),mt(!1),Sr(t,``,KY))},t[261]=Sr,t[262]=ki);let Ai=ki;if(O){let e;return t[263]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(BX,{}),t[263]=e):e=t[263],e}let ji;t[264]!==i||t[265]!==N||t[266]!==I?(ji=N?i(I?{id:`H-vDm3`}:{id:`09Tv5j`}):null,t[264]=i,t[265]=N,t[266]=I,t[267]=ji):ji=t[267];let Mi=ji;if(E.length===0){if(Mi!==null){let e;return t[268]===Mi?e=t[269]:(e=(0,Z.jsx)(`div`,{className:`flex flex-1 items-center justify-center py-8`,children:(0,Z.jsx)(`span`,{role:`status`,className:`select-none text-sidebar-foreground/50 text-sm`,children:Mi})}),t[268]=Mi,t[269]=e),e}if(j){let e;return t[270]===j?e=t[271]:(e=(0,Z.jsx)(`div`,{className:`flex flex-1 items-center justify-center py-8`,children:(0,Z.jsx)(`span`,{role:`alert`,className:`select-none text-sidebar-foreground/50 text-sm`,children:j})}),t[270]=j,t[271]=e),e}if(Pl({visibility:{showHiddenFiles:Ut,showOnlyMarkdownFiles:Wt},unfilteredRootEntryCount:B,knownPageCount:x.size})===`filtered-to-zero`){let e;return t[272]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Iq,{}),t[272]=e):e=t[272],e}let e;t[273]===i?e=t[274]:(e=i({id:`5ZB7XC`}),t[273]=i,t[274]=e);let n=pt&&`bg-primary/5 ring-2 ring-primary/70 ring-inset`,r;t[275]===n?r=t[276]:(r=$t(`flex flex-1 flex-col items-center justify-center gap-3 rounded-md py-8`,n),t[275]=n,t[276]=r);let a;t[277]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(`span`,{className:`select-none text-sidebar-foreground/30 text-sm`,children:(0,Z.jsx)(J,{id:`xiv-dW`})}),t[277]=a):a=t[277];let o;t[278]===Er?o=t[279]:(o=()=>Er(`file`,``),t[278]=Er,t[279]=o);let s;t[280]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(J,{id:`6ibbCg`}),t[280]=s):s=t[280];let c;t[281]===o?c=t[282]:(c=(0,Z.jsx)(Y,{variant:`link`,size:`sm`,className:`font-mono uppercase`,onClick:o,children:s}),t[281]=o,t[282]=c);let l;return t[283]!==Ai||t[284]!==e||t[285]!==r||t[286]!==c?(l=(0,Z.jsxs)(`section`,{"aria-label":e,className:r,onDragOver:Ei,onDragLeave:Oi,onDrop:Ai,children:[a,c]}),t[283]=Ai,t[284]=e,t[285]=r,t[286]=c,t[287]=l):l=t[287],l}let Ni=H!==null,Pi=W?.targets[0]??null,Fi=null;if(R!==null){let e;if(t[288]!==a.locale||t[289]!==R){let n=new Intl.NumberFormat(a.locale).format(R);e=yl._({id:`LuoJWu`,values:{truncatedShownCount:R,formattedCount:n}}),t[288]=a.locale,t[289]=R,t[290]=e}else e=t[290];Fi=e}let Ii;t[291]!==j||t[292]!==Mi||t[293]!==Fi?(Ii=(j||Mi!==null||Fi!==null)&&(0,Z.jsxs)(Z.Fragment,{children:[Mi===null?j&&(0,Z.jsx)(HX,{kind:`error`,children:j}):(0,Z.jsx)(HX,{kind:`reconnecting`,children:Mi}),Fi!==null&&(0,Z.jsx)(HX,{kind:`info`,children:Fi})]}),t[291]=j,t[292]=Mi,t[293]=Fi,t[294]=Ii):Ii=t[294];let Li;t[295]===v?Li=t[296]:(Li=Vq(v),t[295]=v,t[296]=Li);let Ri=ce?``:void 0,zi;t[297]===Ri?zi=t[298]:(zi={[YY]:Ri},t[297]=Ri,t[298]=zi);let Bi;t[299]!==Ni||t[300]!==Ce||t[301]!==Ar||t[302]!==E||t[303]!==Or||t[304]!==dn||t[305]!==Fn||t[306]!==Rn||t[307]!==Bt||t[308]!==nn||t[309]!==Vt||t[310]!==Er||t[311]!==oe?(Bi=(e,t)=>(0,Z.jsx)($Y,{item:e,context:t,anyActionBusy:Ni,workspace:oe,handoff:Bt,model:nn,okignoreBinding:Vt,onStartCreating:Er,onCreateFromTemplate:(e,t)=>Er(`file`,e,{template:t}),onDuplicate:Fn,onImportTemplate:Rn,onDelete:e=>ee({targets:e}),onExpandSubtree:Or,onCollapseSubtree:Ar,folderTreePaths:dn,isAsset:Ce.has(e.path),documents:E}),t[299]=Ni,t[300]=Ce,t[301]=Ar,t[302]=E,t[303]=Or,t[304]=dn,t[305]=Fn,t[306]=Rn,t[307]=Bt,t[308]=nn,t[309]=Vt,t[310]=Er,t[311]=oe,t[312]=Bi):Bi=t[312];let Vi;t[313]!==wi||t[314]!==Si||t[315]!==nn||t[316]!==Ii||t[317]!==Li||t[318]!==zi||t[319]!==Bi?(Vi=(0,Z.jsx)(`div`,{ref:st,className:`flex min-h-0 flex-1 flex-col`,children:(0,Z.jsx)(Pq,{header:Ii,model:nn,style:Li,...zi,onClickCapture:wi,onMouseMove:Si,onMouseLeave:_i,renderContextMenu:Bi})}),t[313]=wi,t[314]=Si,t[315]=nn,t[316]=Ii,t[317]=Li,t[318]=zi,t[319]=Bi,t[320]=Vi):Vi=t[320];let Hi=!!W,Ui;t[321]===H?Ui=t[322]:(Ui=e=>{!e&&!H&&ee(null)},t[321]=H,t[322]=Ui);let Wi;t[323]!==i||t[324]!==H||t[325]!==W||t[326]!==ri||t[327]!==Pi?(Wi=W&&Pi&&(0,Z.jsx)(Ys,{...(()=>{let e=qJ(typeof window<`u`&&window.okDesktop!=null?`electron`:`web`,W.targets);if(e)return{customTitle:e.title,customDescription:``,customDetail:e.detail,customConfirmLabel:e.confirmLabel,customConfirmLabelBusy:e.confirmLabelBusy,children:e.listedTargets?(0,Z.jsx)(`ul`,{className:`flex flex-col gap-1 font-mono text-foreground text-xs`,children:e.listedTargets.map(oX)}):null};let t=W.targets.length,n=Pi.name;return{itemName:t===1?Pi.kind===`folder`?`${Pi.name}/`:Pi.kind===`file`?`${Pi.name}${Pi.docExt??`.md`}`:Pi.name:void 0,customTitle:t>1?i({id:`abiHje`}):void 0,customDescription:t>1?i({id:`WMIKXK`,values:{targetCount:t}}):Pi.kind===`folder`?i({id:`a5W0q0`,values:{folderName:n}}):void 0}})(),isSubmitting:H!==null,onDelete:()=>ri(W.targets)}),t[323]=i,t[324]=H,t[325]=W,t[326]=ri,t[327]=Pi,t[328]=Wi):Wi=t[328];let Gi;t[329]!==Hi||t[330]!==Ui||t[331]!==Wi?(Gi=(0,Z.jsx)(Sn,{open:Hi,onOpenChange:Ui,children:Wi}),t[329]=Hi,t[330]=Ui,t[331]=Wi,t[332]=Gi):Gi=t[332];let Ki=!!G,qi;t[333]===H?qi=t[334]:(qi=e=>{!e&&!H&&K(null)},t[333]=H,t[334]=qi);let Ji;t[335]!==i||t[336]!==H||t[337]!==zn||t[338]!==G?(Ji=G&&(0,Z.jsx)(Ys,{itemName:G.name+(G.kind===`file`?G.docExt??`.md`:`.md`),customTitle:i({id:`hLod4_`}),customDescription:i({id:`RMQe3p`}),customConfirmLabel:i({id:`hvZwVx`}),customConfirmLabelBusy:i({id:`ul1Atu`}),isSubmitting:H!==null,onDelete:()=>zn(G,!0)}),t[335]=i,t[336]=H,t[337]=zn,t[338]=G,t[339]=Ji):Ji=t[339];let Yi;t[340]!==Ki||t[341]!==qi||t[342]!==Ji?(Yi=(0,Z.jsx)(Sn,{open:Ki,onOpenChange:qi,children:Ji}),t[340]=Ki,t[341]=qi,t[342]=Ji,t[343]=Yi):Yi=t[343];let Xi=!!te,Zi;t[344]===H?Zi=t[345]:(Zi=e=>{!e&&!H&&ne(null)},t[344]=H,t[345]=Zi);let Qi;t[346]!==H||t[347]!==ai||t[348]!==si||t[349]!==te?(Qi=te&&(0,Z.jsx)(tY,{failedTargets:te.failed,isSubmitting:H!==null,onDeletePermanently:ai,onRetry:si,onCancel:()=>ne(null)}),t[346]=H,t[347]=ai,t[348]=si,t[349]=te,t[350]=Qi):Qi=t[350];let $i;t[351]!==Xi||t[352]!==Zi||t[353]!==Qi?($i=(0,Z.jsx)(Sn,{open:Xi,onOpenChange:Zi,children:Qi}),t[351]=Xi,t[352]=Zi,t[353]=Qi,t[354]=$i):$i=t[354];let ea=ie!==null,ta;t[355]===Symbol.for(`react.memo_cache_sentinel`)?(ta=e=>{e||ae(null)},t[355]=ta):ta=t[355];let na=ie?.parentDir??``,ra;t[356]!==ea||t[357]!==na?(ra=(0,Z.jsx)(h_,{open:ea,onOpenChange:ta,kind:`file`,initialDir:na,defaultToTemplate:!0}),t[356]=ea,t[357]=na,t[358]=ra):ra=t[358];let ia;return t[359]!==Vi||t[360]!==Gi||t[361]!==Yi||t[362]!==$i||t[363]!==ra?(ia=(0,Z.jsxs)(Z.Fragment,{children:[Vi,Gi,Yi,$i,ra]}),t[359]=Vi,t[360]=Gi,t[361]=Yi,t[362]=$i,t[363]=ra,t[364]=ia):ia=t[364],ia}function oX(e){return(0,Z.jsx)(`li`,{"data-testid":`delete-target-row`,children:JJ(e)},`${e.kind}:${e.path}`)}function sX(e){return`${e.kind}:${e.path}`}function cX(e){return`${e.kind}:${e.path}`}function lX(e){return e.path}function uX(e){return e.kind===`folder`}function dX(e){return e.path}function fX(e){return e.kind===`file`}function pX(e){return e.file}function mX(e){return!Vl(e.path)}function hX(e){return re(e)}function gX(e){return ge(e)}function _X(e){return F(e)}function vX(e){return e.path}function yX(e){return e.kind===`asset`}function bX(e){return e.endsWith(`/`)?e.slice(0,-1):e}function xX(e){return!!e}function SX(e){console.warn(`[FileTree] /api/workspace fetch failed:`,e)}function CX(e){console.warn(`[FileTree] unmount cleanup failed:`,e)}function wX(e){X.error(e)}function TX(){}function EX(e){return X.error(e)}function DX(){}function OX(){}function kX(){}function AX(){}function jX(){}async function MX(){}function NX(e){return rf(e)}function PX(e){return FX(e)?.dataset.itemPath??null}function FX(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.dataset.itemPath)return t;return null}function IX(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.matches(`[data-file-tree-virtualized-root]`))return t;return null}function LX(e){let t=FX(e);if(t){let e=t.dataset.itemPath;if(!e)return null;let n=t.dataset.itemType===`folder`,r=of(e,n);return{parentDir:r,row:t,root:null,busyPath:n?mf(r):e}}return RX(e)?{parentDir:``,row:null,root:IX(e),busyPath:KY}:null}function RX(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.matches(`[data-file-tree-virtualized-scroll]`))return!0;return!1}var zX=[`w-3/4`,`w-2/3`,`w-4/5`,`w-1/2`,`w-3/5`,`w-2/3`];function BX(){let e=(0,$.c)(5),{_:t}=vt(),n;e[0]===t?n=e[1]:(n=t({id:`5Tk8Fb`}),e[0]=t,e[1]=n);let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=zX.map(VX),e[2]=r):r=e[2];let i;return e[3]===n?i=e[4]:(i=(0,Z.jsx)(`div`,{className:`flex flex-1 flex-col gap-1 px-2 py-2`,role:`status`,"aria-busy":`true`,"aria-label":n,children:r}),e[3]=n,e[4]=i),i}function VX(e,t){return(0,Z.jsxs)(`div`,{className:`flex h-6 items-center gap-2`,children:[(0,Z.jsx)(Cd,{className:`h-3 w-3 shrink-0 rounded-sm`}),(0,Z.jsx)(Cd,{className:`h-3 ${e}`})]},t)}function HX(e){let t=(0,$.c)(14),{kind:n,children:r}=e,i=n===`error`?sl:n===`reconnecting`?tl:Xc,a=n===`error`?`alert`:`status`,o=n===`error`?`text-destructive`:`text-muted-foreground`,s;t[0]===o?s=t[1]:(s=$t(`mx-2 mb-1 flex items-start gap-1.5 rounded-md bg-muted/50 px-2 py-1.5 text-xs leading-snug`,o),t[0]=o,t[1]=s);let c=n===`reconnecting`&&`animate-spin motion-reduce:animate-none`,l;t[2]===c?l=t[3]:(l=$t(`mt-0.5 size-3.5 shrink-0`,c),t[2]=c,t[3]=l);let u;t[4]!==i||t[5]!==l?(u=(0,Z.jsx)(i,{"aria-hidden":`true`,className:l}),t[4]=i,t[5]=l,t[6]=u):u=t[6];let d;t[7]===r?d=t[8]:(d=(0,Z.jsx)(`span`,{className:`min-w-0`,children:r}),t[7]=r,t[8]=d);let f;return t[9]!==a||t[10]!==s||t[11]!==u||t[12]!==d?(f=(0,Z.jsxs)(`span`,{role:a,className:s,children:[u,d]}),t[9]=a,t[10]=s,t[11]=u,t[12]=d,t[13]=f):f=t[13],f}function UX(e){return e?yl._({id:`wTcjov`}):null}function WX(e){let t=(0,$.c)(46),{_:n}=vt(),r=lc(),i=Vs(),a=Ri(),o=Wi();if(r)return null;let{input:s,installStates:c,dispatch:l}=e,u=s===null,d,f,p,m,h,g,_,v,y,b,x;if(t[0]!==n||t[1]!==l||t[2]!==s||t[3]!==u||t[4]!==c||t[5]!==o||t[6]!==a||t[7]!==i){let e=UX(u),r;t[19]===o?r=t[20]:(r=e=>Zi(o,e.id),t[19]=o,t[20]=r);let S=Ki.filter(r),C;t[21]===o?C=t[22]:(C=e=>qi(o,e.source,e.id,!0,e.supported),t[21]=o,t[22]=C);let w=a.filter(C),T=i?Ba.filter(e=>Yi(o,e,i.installedClis)):[];p=S.length>0,m=i!==null&&T.length>0,h=w.length>0,f=zF,t[23]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsxs)(HF,{children:[(0,Z.jsx)(oc,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`O7_W_a`})]}),t[23]=x):x=t[23],d=UF,g=`max-h-80`,_=h?(0,Z.jsxs)(RF,{"aria-label":n({id:`vPKX2i`}),children:[(0,Z.jsxs)(GF,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(J,{id:`RXEbZy`}),(0,Z.jsx)(Xi,{})]}),w.map(t=>{let r=t.name;return(0,Z.jsxs)(VF,{onSelect:()=>{s!==null&&nc(s,{agent:{source:t.source,id:t.id}})},disabled:u,"data-testid":`empty-space-open-in-thread-${t.id}`,"aria-label":e?n({id:`gtGQ9S`,values:{agentName:r,hint:e}}):void 0,children:[(0,Z.jsx)(fs,{agentId:t.id,iconUrl:t.iconUrl,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(J,{id:`5PrrYw`,values:{agentName:r}})}),e?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},`${t.source}:${t.id}`)})]}):null,t[24]!==p||t[25]!==m||t[26]!==h?(v=h&&(m||p)?(0,Z.jsx)(KF,{}):null,t[24]=p,t[25]=m,t[26]=h,t[27]=v):v=t[27],y=m?(0,Z.jsxs)(RF,{"aria-label":n({id:`ALhMYW`}),children:[(0,Z.jsx)(GF,{children:(0,Z.jsx)(J,{id:`ALhMYW`})}),T.map(t=>{let{displayName:r}=Da[t];return(0,Z.jsxs)(VF,{onSelect:()=>{s!==null&&i.launchInTerminal(s,t)},disabled:u,"data-testid":`empty-space-open-in-terminal-${t}`,"aria-label":n(e?{id:`AIn2Yv`,values:{displayName:r,hint:e}}:{id:`QYfQdv`,values:{displayName:r}}),children:[(0,Z.jsx)(Ji,{id:Vi(t),"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:r}),e?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t)})]}):null,b=p?(0,Z.jsxs)(Z.Fragment,{children:[m?(0,Z.jsx)(KF,{}):null,(0,Z.jsxs)(RF,{"aria-label":n({id:`BBqGS9`}),children:[(0,Z.jsx)(GF,{children:(0,Z.jsx)(J,{id:`BBqGS9`})}),S.map(t=>{let r=!u,{displayName:i}=t,a=n(e?{id:`1ZpfyB`,values:{displayName:i,hint:e}}:{id:`WqLq6M`,values:{displayName:i}});return(0,Z.jsxs)(VF,{disabled:!r,onSelect:()=>{if(s){if(c[t.id]?.installed!==!0){ec(t);return}l(t.id,s)}},"data-testid":`empty-space-open-in-${t.id}`,"aria-label":a,children:[(0,Z.jsx)(Ji,{id:t.id,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:t.displayName}),e?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t.id)})]})]}):null,t[0]=n,t[1]=l,t[2]=s,t[3]=u,t[4]=c,t[5]=o,t[6]=a,t[7]=i,t[8]=d,t[9]=f,t[10]=p,t[11]=m,t[12]=h,t[13]=g,t[14]=_,t[15]=v,t[16]=y,t[17]=b,t[18]=x}else d=t[8],f=t[9],p=t[10],m=t[11],h=t[12],g=t[13],_=t[14],v=t[15],y=t[16],b=t[17],x=t[18];let S;t[28]!==p||t[29]!==m||t[30]!==h?(S=h||m||p?(0,Z.jsx)(KF,{}):null,t[28]=p,t[29]=m,t[30]=h,t[31]=S):S=t[31];let C;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(nl,{"aria-hidden":`true`}),t[32]=C):C=t[32];let w;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsxs)(VF,{onSelect:ea,"data-testid":`empty-space-open-in-settings`,children:[C,(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(J,{id:`jRAGrQ`})})]}),t[33]=w):w=t[33];let T;t[34]!==d||t[35]!==g||t[36]!==_||t[37]!==v||t[38]!==y||t[39]!==b||t[40]!==S?(T=(0,Z.jsxs)(d,{className:g,children:[_,v,y,b,S,w]}),t[34]=d,t[35]=g,t[36]=_,t[37]=v,t[38]=y,t[39]=b,t[40]=S,t[41]=T):T=t[41];let E;return t[42]!==f||t[43]!==x||t[44]!==T?(E=(0,Z.jsxs)(f,{children:[x,T]}),t[42]=f,t[43]=x,t[44]=T,t[45]=E):E=t[45],E}async function GX(e){try{let t=await e.project.listRecent(),n=e.config.projectPath;if(t.some(e=>e.path!==n))return null;let r=await lE();return e.config.freshlyCreated?r:r===0?0:null}catch(e){return console.warn(`[onboarding-card-visible] fresh-project probe failed; suppressing card`,e),null}}function KX(e){let t=(0,$.c)(4),n=e===void 0?aE:e,{initialized:r,dismissed:i,completed:a}=(0,Q.useSyncExternalStore)(n.subscribe,n.getSnapshot,n.getSnapshot),o=i||a,s=!r&&!o,c,l;return t[0]!==s||t[1]!==n?(c=()=>{if(!s)return;let e=window.okDesktop;if(e==null)return;let t=!1;return GX(e).then(e=>{!t&&e!==null&&n.activate(e)}),()=>{t=!0}},l=[s,n],t[0]=s,t[1]=n,t[2]=c,t[3]=l):(c=t[2],l=t[3]),(0,Q.useEffect)(c,l),r&&!o}function qX(e){let t=(0,$.c)(3),n=e===void 0?aE:e,r,i;t[0]===n?(r=t[1],i=t[2]):(r=()=>{if(n.getSnapshot().steps.file)return;let e=ql(e=>{e.includes(`files`)&&uE(n)});return uE(n),e},i=[n],t[0]=n,t[1]=r,t[2]=i),(0,Q.useEffect)(r,i)}var JX=3,YX=5200,XX=1500,ZX=220;function QX(e){let t=(0,$.c)(14),{complete:n,label:r,shortcutId:i}=e,a;t[0]===n?a=t[1]:(a=(0,Z.jsx)(nr,{checked:n,disabled:!0,"aria-hidden":!0,tabIndex:-1,className:`pointer-events-none opacity-100 disabled:opacity-100`}),t[0]=n,t[1]=a);let o=n?`flex-1 text-muted-foreground/60`:`flex-1`,s;t[2]===n?s=t[3]:(s=n?(0,Z.jsxs)(`span`,{className:`sr-only`,children:[(0,Z.jsx)(J,{id:`Qj4RL5`}),` `]}):null,t[2]=n,t[3]=s);let c;t[4]!==r||t[5]!==o||t[6]!==s?(c=(0,Z.jsxs)(`span`,{className:o,children:[s,r]}),t[4]=r,t[5]=o,t[6]=s,t[7]=c):c=t[7];let l;t[8]===i?l=t[9]:(l=i?(0,Z.jsx)(Oe,{children:xl(i)}):null,t[8]=i,t[9]=l);let u;return t[10]!==a||t[11]!==c||t[12]!==l?(u=(0,Z.jsxs)(`li`,{className:`flex items-center gap-2 py-0.5 text-sm`,children:[a,c,l]}),t[10]=a,t[11]=c,t[12]=l,t[13]=u):u=t[13],u}function $X(e){let t=(0,$.c)(24),{store:n,lingerMs:r}=e,i=n===void 0?aE:n,a=r===void 0?YX:r,{_:o}=vt(),{steps:s}=oE(i);qX(i);let[c,l]=(0,Q.useState)(0),[u,d]=(0,Q.useState)(!1),f=1+ +!!s.file+ +!!s.askedAi,p=f===JX,m,h;t[0]!==p||t[1]!==a?(m=()=>{if(!p)return;l(tZ);let e=setInterval(()=>l(eZ),XX),t=setTimeout(()=>{clearInterval(e),d(!0)},a);return()=>{clearInterval(e),clearTimeout(t)}},h=[p,a],t[0]=p,t[1]=a,t[2]=m,t[3]=h):(m=t[2],h=t[3]),(0,Q.useEffect)(m,h);let g,_;t[4]!==u||t[5]!==i?(g=()=>{if(!u)return;let e=setTimeout(()=>i.markCompleted(),ZX);return()=>clearTimeout(e)},_=[u,i],t[4]=u,t[5]=i,t[6]=g,t[7]=_):(g=t[6],_=t[7]),(0,Q.useEffect)(g,_);let v;t[8]!==o||t[9]!==p?(v=p?o({id:`7jIIFX`}):``,t[8]=o,t[9]=p,t[10]=v):v=t[10];let y;t[11]===v?y=t[12]:(y=(0,Z.jsx)(`div`,{className:`sr-only`,role:`status`,"aria-live":`polite`,children:v}),t[11]=v,t[12]=y);let b;t[13]!==p||t[14]!==c||t[15]!==f||t[16]!==u||t[17]!==s.askedAi||t[18]!==s.file||t[19]!==i?(b=p?(0,Z.jsxs)(`section`,{"aria-hidden":!0,className:$t(`mx-2 mb-1 flex items-center gap-3 rounded-lg border bg-card px-4 py-3 text-card-foreground`,`motion-reduce:animate-none motion-reduce:duration-0`,u?`animate-out fade-out-0 zoom-out-95 fill-mode-forwards duration-200`:`animate-in fade-in-0 zoom-in-95 duration-300`),children:[(0,Z.jsx)(mp,{size:36,celebrateSignal:c}),(0,Z.jsx)(`span`,{className:`font-medium text-sm`,children:(0,Z.jsx)(J,{id:`7jIIFX`})})]}):(0,Z.jsxs)(`section`,{"aria-labelledby":`onboarding-card-heading`,className:`mx-2 mb-1 rounded-lg border bg-card px-4 py-3 text-card-foreground`,children:[(0,Z.jsxs)(`header`,{className:`mb-3 flex items-center justify-between`,children:[(0,Z.jsx)(`h2`,{id:`onboarding-card-heading`,className:`font-medium text-sm`,children:(0,Z.jsx)(J,{id:`Y1QMlM`})}),(0,Z.jsx)(`span`,{className:`text-muted-foreground/60 text-xs tabular-nums`,children:`${f} / ${JX}`})]}),(0,Z.jsxs)(`ul`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(QX,{complete:!0,label:(0,Z.jsx)(J,{id:`4E9jPa`})}),(0,Z.jsx)(QX,{complete:s.file,label:(0,Z.jsx)(J,{id:`6ibbCg`}),shortcutId:`new-item`}),(0,Z.jsx)(QX,{complete:s.askedAi,label:(0,Z.jsx)(J,{id:`xWEvuo`}),shortcutId:`open-ask-ai`})]}),(0,Z.jsx)(`footer`,{className:`-mb-1 mt-2 flex justify-end`,children:(0,Z.jsx)(Y,{type:`button`,variant:`ghost`,size:`sm`,className:`h-auto px-2 py-1 text-muted-foreground text-xs`,onClick:()=>i.dismiss(),children:(0,Z.jsx)(J,{id:`1QfxQT`})})})]}),t[13]=p,t[14]=c,t[15]=f,t[16]=u,t[17]=s.askedAi,t[18]=s.file,t[19]=i,t[20]=b):b=t[20];let x;return t[21]!==y||t[22]!==b?(x=(0,Z.jsxs)(Z.Fragment,{children:[y,b]}),t[21]=y,t[22]=b,t[23]=x):x=t[23],x}function eZ(e){return e+1}function tZ(e){return e+1}function nZ(){let e=(0,$.c)(1);if(!KX())return null;let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)($X,{}),e[0]=t):t=e[0],t}function rZ(e){return e===null?null:e.kind===`local`?e.name:e.ref}function iZ(e,t){if(e.length===0)return null;let n=`origin/${e}`;return t.includes(n)?n:t.find(t=>to(t)===e)??null}function aZ(e){switch(e){case`branch-exists`:return{id:`wzq9Rv`};case`already-checked-out`:return{id:`ljHjfg`};case`path-exists`:return{id:`mYzDD_`};case`invalid-branch`:return{id:`r-OJYm`};case`no-git`:return{id:`CFnavk`};case`helper-not-found`:return{id:`HqOPpj`};default:return{id:`-zA2E7`}}}function oZ(e){let t=(0,$.c)(71),{open:n,onOpenChange:r,bridge:i,currentBranch:a,branches:o,existingWorktreeBranches:s,remoteBranches:c,behindByBranch:l,initialBranchName:u}=e,d=o===void 0?[]:o,f=c===void 0?[]:c,p=u===void 0?``:u,{_:m}=vt(),h=(0,Q.useId)(),g=(0,Q.useId)(),_=(0,Q.useId)(),v=(0,Q.useId)(),y=(0,Q.useId)(),b=(0,Q.useId)(),[x,S]=(0,Q.useState)(``),C;t[0]===a?C=t[1]:(C=a===null?null:{kind:`local`,name:a},t[0]=a,t[1]=C);let[w,T]=(0,Q.useState)(C),[E,D]=(0,Q.useState)(!1),[O,k]=(0,Q.useState)(``),[A,j]=(0,Q.useState)(!1),[M,N]=(0,Q.useState)(null),P=(0,Q.useRef)(null),F=(0,Q.useRef)(null),I,L;t[2]!==a||t[3]!==p||t[4]!==n?(I=()=>{if(!n)return;S(p),T(a===null?null:{kind:`local`,name:a}),D(!1),k(``),j(!1),N(null);let e=requestAnimationFrame(()=>P.current?.focus());return()=>cancelAnimationFrame(e)},L=[n,a,p],t[2]=a,t[3]=p,t[4]=n,t[5]=I,t[6]=L):(I=t[5],L=t[6]),(0,Q.useEffect)(I,L);let R=x.trim(),z=!A&&R.length>0,B=R.length>0&&d.includes(R),V=B?null:iZ(R,f),H=V!==null,U=B||H,W=B&&(s?.has(R)??!1),ee=d.filter(e=>e.toLowerCase().startsWith(R.toLowerCase())),G=!A&&ee.length>0&&!U,K=(a!==null&&!d.includes(a)?[a,...d]:d).map(dZ),te=f.map(uZ),ne=rZ(w),re=O.trim().toLowerCase(),ie=re===``?K:K.filter(e=>e.name.toLowerCase().includes(re)),ae=re===``?te:te.filter(e=>e.ref.toLowerCase().includes(re)),oe=re!==``&&ie.length===0&&ae.length===0,se=async function(e){if(e.preventDefault(),z){j(!0),N(null);try{let e=H?{branch:R,createBranch:!0,remoteRef:V}:B?{branch:R,createBranch:!1}:{branch:R,createBranch:!0,baseBranch:w?.kind===`local`?w.name:void 0,baseRef:w?.kind===`remote`?w.ref:void 0},t=await i.worktree.create(e);if(!t.ok){N(aZ(t.reason)),j(!1);return}Gu(),r(!1),await i.project.open({path:t.path,target:`new-window`,entryPoint:`worktree`})}catch(e){console.warn(`[NewWorktreeDialog] worktree create/open failed:`,e),X.error(m({id:`vAYoCZ`})),j(!1)}}},ce=Sn,le;t[7]!==A||t[8]!==r?(le=e=>{A||r(e)},t[7]=A,t[8]=r,t[9]=le):le=t[9];let ue=vn,de;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,Z.jsx)(_n,{children:(0,Z.jsx)(J,{id:`DXd9LM`})}),t[10]=de):de=t[10];let fe;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(fe=(0,Z.jsxs)(xn,{children:[de,(0,Z.jsx)(gn,{children:(0,Z.jsx)(J,{id:`NEzPEh`})})]}),t[11]=fe):fe=t[11];let pe=yn,q;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,Z.jsx)(J,{id:`ng2Ibo`}),t[12]=q):q=t[12];let me;t[13]===g?me=t[14]:(me=(0,Z.jsx)(Hr,{htmlFor:g,children:q}),t[13]=g,t[14]=me);let ge;t[15]===m?ge=t[16]:(ge=m({id:`IX_uXB`}),t[15]=m,t[16]=ge);let _e;t[17]===M?_e=t[18]:(_e=e=>{S(e.target.value),M!==null&&N(null)},t[17]=M,t[18]=_e);let ve=M!==null,ye=M===null?y:`${y} ${b}`,be;t[19]!==x||t[20]!==A||t[21]!==g||t[22]!==ge||t[23]!==_e||t[24]!==ve||t[25]!==ye?(be=(0,Z.jsx)(vl,{id:g,ref:P,value:x,placeholder:ge,onChange:_e,disabled:A,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-invalid":ve,"aria-describedby":ye,"data-testid":`new-worktree-branch`}),t[19]=x,t[20]=A,t[21]=g,t[22]=ge,t[23]=_e,t[24]=ve,t[25]=ye,t[26]=be):be=t[26];let xe=R.length>0?(0,Z.jsxs)(`p`,{id:y,className:`flex items-start gap-1.5 text-1sm text-muted-foreground`,"data-testid":W?`new-worktree-mode-existing-worktree`:H?`new-worktree-mode-remote-checkout`:B?`new-worktree-mode-checkout`:`new-worktree-mode-create`,children:[W?(0,Z.jsx)(gc,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-amber-600 dark:text-amber-400`}):H?(0,Z.jsx)(Ei,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-violet-600 dark:text-violet-400`}):B?(0,Z.jsx)(Ds,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-blue-600 dark:text-blue-400`}):(0,Z.jsx)(Kt,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-green-600 dark:text-green-400`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1`,children:W?(0,Z.jsx)(J,{id:`QAi7Q9`,values:{trimmed:R},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-words`})}}):H?(0,Z.jsx)(J,{id:`oAGN8p`,values:{remoteCheckoutRef:V,trimmed:R},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-words`}),1:(0,Z.jsx)(`code`,{className:`font-mono break-words`}),2:(0,Z.jsx)(`code`,{className:`font-mono`})}}):B?(0,Z.jsx)(J,{id:`b4VvP-`,values:{trimmed:R},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-words`}),1:(0,Z.jsx)(`code`,{className:`font-mono`})}}):ne===null?(0,Z.jsx)(J,{id:`t4sFKC`,values:{trimmed:R},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-words`}),1:(0,Z.jsx)(`code`,{className:`font-mono`})}}):(0,Z.jsx)(J,{id:`dGAdpH`,values:{trimmed:R,currentBaseLabel:ne},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-words`}),1:(0,Z.jsx)(`code`,{className:`font-mono break-words`}),2:(0,Z.jsx)(`code`,{className:`font-mono`})}})})]}):null,Se=G?(0,Z.jsx)(`div`,{className:`max-h-40 overflow-y-auto rounded-md border bg-popover p-1 shadow-xs`,"data-testid":`new-worktree-branch-list`,children:ee.map(e=>(0,Z.jsxs)(Y,{type:`button`,variant:`ghost`,size:`sm`,tabIndex:-1,onClick:()=>{S(e),M!==null&&N(null),P.current?.focus()},"data-testid":`new-worktree-branch-option-${e}`,className:`h-8 w-full justify-start gap-2 font-normal`,children:[(0,Z.jsx)(Xo,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left`,children:e})]},e))}):null,Ce=U?null:(0,Z.jsxs)(`div`,{className:`mt-1 flex flex-col gap-2`,children:[(0,Z.jsx)(Hr,{id:v,htmlFor:_,children:(0,Z.jsx)(J,{id:`ZWwYwM`})}),(0,Z.jsxs)(Ut,{open:E,onOpenChange:e=>{D(e),e||k(``)},children:[(0,Z.jsx)(Wt,{asChild:!0,children:(0,Z.jsxs)(Y,{id:_,type:`button`,variant:`outline`,role:`combobox`,"aria-expanded":E,"aria-haspopup":`listbox`,"aria-labelledby":`${v} ${_}`,"aria-label":m({id:`ZWwYwM`}),disabled:A,"data-testid":`new-worktree-base-trigger`,className:`w-full justify-between font-normal`,children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[w?.kind===`remote`?(0,Z.jsx)(Ei,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}):(0,Z.jsx)(Xo,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate text-left`,children:ne===null?(0,Z.jsx)(J,{id:`EbjWsS`}):ne})]}),(0,Z.jsx)(Rm,{"aria-hidden":`true`,className:`ml-2 size-4 shrink-0 opacity-50`})]})}),(0,Z.jsxs)(Yt,{align:`start`,className:`w-[var(--radix-popover-trigger-width)] p-1`,onWheel:lZ,onTouchMove:cZ,onOpenAutoFocus:e=>{e.preventDefault(),F.current?.focus()},children:[(0,Z.jsxs)(Vc,{className:`mb-1 h-8`,children:[(0,Z.jsx)(Nc,{ref:F,"aria-label":m({id:`fuJZKk`}),placeholder:m({id:`hQXiDc`}),value:O,onChange:e=>k(e.target.value),onKeyDown:sZ,"data-testid":`new-worktree-base-search`}),(0,Z.jsx)(Rc,{children:(0,Z.jsx)(he,{"aria-hidden":`true`})})]}),(0,Z.jsxs)(`div`,{role:`listbox`,"aria-label":m({id:`ZWwYwM`}),className:`max-h-56 overflow-y-auto`,"data-testid":`new-worktree-base-list`,children:[oe?(0,Z.jsx)(`p`,{className:`px-2 py-1.5 text-1sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`Sh3Qkg`})}):null,ie.map(e=>{let t=e.name,n=l?.get(t);return(0,Z.jsxs)(Y,{type:`button`,role:`option`,"aria-selected":w?.kind===`local`&&w.name===t,variant:`ghost`,size:`sm`,onClick:()=>{T(e),D(!1),k(``)},"data-testid":`new-worktree-base-option-${t}`,className:`h-8 w-full justify-start gap-2 font-normal`,children:[(0,Z.jsx)(Xo,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left`,children:t}),n!==void 0&&n>0?(0,Z.jsx)(`span`,{className:`shrink-0 text-xs text-amber-600 dark:text-amber-400`,"data-testid":`new-worktree-base-behind-${t}`,children:(0,Z.jsx)(J,{id:`6-wLTJ`,values:{behind:n}})}):null]},`local:${t}`)}),ae.map(e=>{let t=e.ref;return(0,Z.jsxs)(Y,{type:`button`,role:`option`,"aria-selected":w?.kind===`remote`&&w.ref===t,variant:`ghost`,size:`sm`,onClick:()=>{T(e),D(!1),k(``)},"data-testid":`new-worktree-base-option-${t}`,className:`h-8 w-full justify-start gap-2 font-normal`,children:[(0,Z.jsx)(Ei,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left`,children:t}),(0,Z.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:(0,Z.jsx)(J,{id:`dIYSqk`})})]},`remote:${t}`)})]})]})]})]}),we;t[27]!==m||t[28]!==M||t[29]!==b?(we=M===null?null:(0,Z.jsx)(`p`,{id:b,role:`alert`,className:`text-1sm text-destructive`,"data-testid":`new-worktree-error`,children:m(M)}),t[27]=m,t[28]=M,t[29]=b,t[30]=we):we=t[30];let Te;t[31]!==h||t[32]!==se||t[33]!==me||t[34]!==be||t[35]!==xe||t[36]!==Se||t[37]!==Ce||t[38]!==we?(Te=(0,Z.jsxs)(`form`,{id:h,onSubmit:se,className:`flex flex-col gap-2`,children:[me,be,xe,Se,Ce,we]}),t[31]=h,t[32]=se,t[33]=me,t[34]=be,t[35]=xe,t[36]=Se,t[37]=Ce,t[38]=we,t[39]=Te):Te=t[39];let Ee;t[40]!==pe||t[41]!==Te?(Ee=(0,Z.jsx)(pe,{children:Te}),t[40]=pe,t[41]=Te,t[42]=Ee):Ee=t[42];let De;t[43]===r?De=t[44]:(De=()=>r(!1),t[43]=r,t[44]=De);let Oe;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=(0,Z.jsx)(J,{id:`dEgA5A`}),t[45]=Oe):Oe=t[45];let ke;t[46]!==A||t[47]!==De?(ke=(0,Z.jsx)(Y,{type:`button`,variant:`outline`,onClick:De,disabled:A,"data-testid":`new-worktree-cancel`,children:Oe}),t[46]=A,t[47]=De,t[48]=ke):ke=t[48];let Ae=!z,je;t[49]!==A||t[50]!==W||t[51]!==B||t[52]!==H?(je=A?(0,Z.jsx)(J,{id:`b4itZn`}):W?(0,Z.jsx)(J,{id:`XV5sC0`}):H?(0,Z.jsx)(J,{id:`XAyxsa`}):B?(0,Z.jsx)(J,{id:`uGaIIS`}):(0,Z.jsx)(J,{id:`iO8V-7`}),t[49]=A,t[50]=W,t[51]=B,t[52]=H,t[53]=je):je=t[53];let Me;t[54]!==h||t[55]!==Ae||t[56]!==je?(Me=(0,Z.jsx)(Y,{type:`submit`,form:h,disabled:Ae,"data-testid":`new-worktree-create`,children:je}),t[54]=h,t[55]=Ae,t[56]=je,t[57]=Me):Me=t[57];let Ne;t[58]!==ke||t[59]!==Me?(Ne=(0,Z.jsxs)(bn,{children:[ke,Me]}),t[58]=ke,t[59]=Me,t[60]=Ne):Ne=t[60];let Pe;t[61]!==ue||t[62]!==fe||t[63]!==Ee||t[64]!==Ne?(Pe=(0,Z.jsxs)(ue,{className:`sm:max-w-md`,"data-testid":`new-worktree-dialog`,children:[fe,Ee,Ne]}),t[61]=ue,t[62]=fe,t[63]=Ee,t[64]=Ne,t[65]=Pe):Pe=t[65];let Fe;return t[66]!==ce||t[67]!==n||t[68]!==Pe||t[69]!==le?(Fe=(0,Z.jsx)(ce,{open:n,onOpenChange:le,children:Pe}),t[66]=ce,t[67]=n,t[68]=Pe,t[69]=le,t[70]=Fe):Fe=t[70],Fe}function sZ(e){return e.stopPropagation()}function cZ(e){e.stopPropagation()}function lZ(e){e.stopPropagation()}function uZ(e){return{kind:`remote`,ref:e}}function dZ(e){return{kind:`local`,name:e}}function fZ(e){let t=(0,$.c)(51),{bridge:n,recents:r,currentPath:i,query:a,worktreeModel:o,closeMenu:s,guardStaleSelect:c,flyoutPath:l,setFlyoutPath:u,openNewWorktreeWith:d}=e,{_:f}=vt(),p;t[0]!==f||t[1]!==n.project||t[2]!==s?(p=function(e,t){s(),n.project.open({path:e,target:`new-window`,entryPoint:t}).catch(e=>{console.warn(`[RecentProjectsMenu] project.open failed:`,e),X.error(f({id:`6HCOwA`}))})},t[0]=f,t[1]=n.project,t[2]=s,t[3]=p):p=t[3];let m=p,h;t[4]!==f||t[5]!==n.project||t[6]!==n.worktree?(h=async function(e){try{let t=await n.worktree.create({branch:e,createBranch:!1});if(!t.ok){X.error(f({id:`teD0H9`}));return}Gu(),await n.project.open({path:t.path,target:`new-window`,entryPoint:`worktree`})}catch(e){console.warn(`[RecentProjectsMenu] create/open branch failed:`,e),X.error(f({id:`LwMxXg`}))}},t[4]=f,t[5]=n.project,t[6]=n.worktree,t[7]=h):h=t[7];let g=h,_;t[8]!==s||t[9]!==i||t[10]!==m?(_=function(e){if(e.path===i){s();return}m(e.path,e.isLinkedWorktree?`worktree`:`recents`)},t[8]=s,t[9]=i,t[10]=m,t[11]=_):_=t[11];let v=_,y;t[12]!==s||t[13]!==g||t[14]!==i||t[15]!==m?(y=function(e){if(e.path!==null){if(e.path===i){s();return}m(e.path,e.isMain?`recents`:`worktree`);return}e.branch!==null&&(s(),g(e.branch))},t[12]=s,t[13]=g,t[14]=i,t[15]=m,t[16]=y):y=t[16];let b=y;if(a!==``){let e;t[17]!==s||t[18]!==g?(e=e=>{s(),g(e)},t[17]=s,t[18]=g,t[19]=e):e=t[19];let n;return t[20]!==i||t[21]!==c||t[22]!==v||t[23]!==a||t[24]!==r||t[25]!==e||t[26]!==o?(n=(0,Z.jsx)(_Z,{recents:r,currentPath:i,query:a,worktreeModel:o,onPickEntry:v,onPickBranch:e,guardStaleSelect:c}),t[20]=i,t[21]=c,t[22]=v,t[23]=a,t[24]=r,t[25]=e,t[26]=o,t[27]=n):n=t[27],n}let x;if(t[28]!==s||t[29]!==i||t[30]!==l||t[31]!==c||t[32]!==b||t[33]!==d||t[34]!==m||t[35]!==r||t[36]!==u||t[37]!==o){let e=cv(r),n;t[39]!==s||t[40]!==i||t[41]!==l||t[42]!==c||t[43]!==b||t[44]!==d||t[45]!==m||t[46]!==u||t[47]!==o?(n=e=>(0,Z.jsx)(pZ,{group:e,currentPath:i,worktreeModel:o,flyoutOpen:l===e.project.path,setFlyoutOpen:t=>u(n=>t?e.project.path:n===e.project.path?null:n),onPickProject:()=>{if(e.project.path===i){s();return}m(e.project.path,`recents`)},onPickFlyoutEntry:b,guardStaleSelect:c,openNewWorktreeWith:d},e.project.path),t[39]=s,t[40]=i,t[41]=l,t[42]=c,t[43]=b,t[44]=d,t[45]=m,t[46]=u,t[47]=o,t[48]=n):n=t[48],x=e.map(n),t[28]=s,t[29]=i,t[30]=l,t[31]=c,t[32]=b,t[33]=d,t[34]=m,t[35]=r,t[36]=u,t[37]=o,t[38]=x}else x=t[38];let S;return t[49]===x?S=t[50]:(S=(0,Z.jsx)(Z.Fragment,{children:x}),t[49]=x,t[50]=S),S}function pZ(e){let t=(0,$.c)(34),{group:n,currentPath:r,worktreeModel:i,flyoutOpen:a,setFlyoutOpen:o,onPickProject:s,onPickFlyoutEntry:c,guardStaleSelect:l,openNewWorktreeWith:u}=e,d=n.project.path===r,f,p;t[0]!==r||t[1]!==n||t[2]!==i?(f=av(n,i,r),p=f.filter(mZ),t[0]=r,t[1]=n,t[2]=i,t[3]=f,t[4]=p):(f=t[3],p=t[4]);let m=p.length;if(m===0){let e;t[5]!==l||t[6]!==s?(e=e=>{l(e)||s()},t[5]=l,t[6]=s,t[7]=e):e=t[7];let r=`project-switcher-recent-${n.project.path}`,i=d?`true`:void 0,a;t[8]!==n.project.name||t[9]!==n.project.path||t[10]!==d?(a=(0,Z.jsx)(bZ,{name:n.project.name,path:n.project.path,current:d}),t[8]=n.project.name,t[9]=n.project.path,t[10]=d,t[11]=a):a=t[11];let o;return t[12]!==e||t[13]!==r||t[14]!==i||t[15]!==a?(o=(0,Z.jsx)(Ar,{onSelect:e,className:`flex w-full min-w-0 flex-col items-start gap-0.5`,"data-testid":r,"data-current":i,children:a}),t[12]=e,t[13]=r,t[14]=i,t[15]=a,t[16]=o):o=t[16],o}let h;t[17]!==r||t[18]!==n.worktrees||t[19]!==d?(h=d||n.worktrees.some(e=>e.path===r),t[17]=r,t[18]=n.worktrees,t[19]=d,t[20]=h):h=t[20];let g=h,_;return t[21]!==g||t[22]!==r||t[23]!==f||t[24]!==a||t[25]!==n||t[26]!==l||t[27]!==c||t[28]!==s||t[29]!==u||t[30]!==m||t[31]!==o||t[32]!==i?(_=(0,Z.jsx)(hZ,{group:n,currentPath:r,containsCurrent:g,worktreeModel:i,flyoutEntries:f,openedWorktreeCount:m,flyoutOpen:a,setFlyoutOpen:o,onPickProject:s,onPickFlyoutEntry:c,guardStaleSelect:l,openNewWorktreeWith:u}),t[21]=g,t[22]=r,t[23]=f,t[24]=a,t[25]=n,t[26]=l,t[27]=c,t[28]=s,t[29]=u,t[30]=m,t[31]=o,t[32]=i,t[33]=_):_=t[33],_}function mZ(e){return e.opened&&!e.isMain}function hZ(e){let t=(0,$.c)(46),{group:n,currentPath:r,containsCurrent:i,worktreeModel:a,flyoutEntries:o,openedWorktreeCount:s,flyoutOpen:c,setFlyoutOpen:l,onPickProject:u,onPickFlyoutEntry:d,guardStaleSelect:f,openNewWorktreeWith:p}=e,{_:m}=vt(),h=n.project.path===r,g;t[0]!==f||t[1]!==u?(g=e=>{f(e)||u()},t[0]=f,t[1]=u,t[2]=g):g=t[2];let _=g,v,y;t[3]===_?(v=t[4],y=t[5]):(v=e=>{e.target.closest(`[data-project-open]`)!==null&&(e.preventDefault(),_(e.nativeEvent))},y=e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),_(e.nativeEvent))},t[3]=_,t[4]=v,t[5]=y);let b=`project-switcher-group-${n.project.path}`,x=c?`true`:void 0,S=i?`true`:void 0,C;t[6]===n.project.name?C=t[7]:(C=(0,Z.jsx)(`span`,{className:`truncate font-medium text-sm`,"data-project-open":``,title:n.project.name,children:n.project.name}),t[6]=n.project.name,t[7]=C);let w;t[8]===n.project.path?w=t[9]:(w=(0,Z.jsx)(`span`,{className:`truncate text-muted-foreground text-xs`,title:n.project.path,children:n.project.path}),t[8]=n.project.path,t[9]=w);let T;t[10]!==C||t[11]!==w?(T=(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[C,w]}),t[10]=C,t[11]=w,t[12]=T):T=t[12];let E;t[13]!==m||t[14]!==h?(E=h?(0,Z.jsx)(Ds,{"aria-label":m({id:`Hp1l6f`}),className:`mt-0.5 size-3.5 shrink-0 text-muted-foreground`}):null,t[13]=m,t[14]=h,t[15]=E):E=t[15];let D=`project-switcher-toggle-${n.project.path}`,O;t[16]===s?O=t[17]:(O=(0,Z.jsx)(`span`,{className:`tabular-nums`,children:s}),t[16]=s,t[17]=O);let k;t[18]===s?k=t[19]:(k=(0,Z.jsx)(J,{id:`AKxFtn`,values:{openedWorktreeCount:s}}),t[18]=s,t[19]=k);let A;t[20]!==D||t[21]!==O||t[22]!==k?(A=(0,Z.jsxs)(`span`,{className:`mt-0.5 shrink-0 text-muted-foreground text-xs`,"data-testid":D,children:[O,` `,k]}),t[20]=D,t[21]=O,t[22]=k,t[23]=A):A=t[23];let j;t[24]!==E||t[25]!==A||t[26]!==v||t[27]!==y||t[28]!==b||t[29]!==x||t[30]!==S||t[31]!==T?(j=(0,Z.jsxs)(Lr,{onClick:v,onKeyDown:y,className:`flex w-full min-w-0 items-start gap-2`,"data-testid":b,"data-flyout-open":x,"data-current":S,children:[T,E,A]}),t[24]=E,t[25]=A,t[26]=v,t[27]=y,t[28]=b,t[29]=x,t[30]=S,t[31]=T,t[32]=j):j=t[32];let M;t[33]!==o||t[34]!==c||t[35]!==n||t[36]!==f||t[37]!==d||t[38]!==p||t[39]!==a?(M=(0,Z.jsx)(gZ,{group:n,open:c,worktreeModel:a,entries:o,onPickFlyoutEntry:d,guardStaleSelect:f,openNewWorktreeWith:p}),t[33]=o,t[34]=c,t[35]=n,t[36]=f,t[37]=d,t[38]=p,t[39]=a,t[40]=M):M=t[40];let N;return t[41]!==c||t[42]!==l||t[43]!==j||t[44]!==M?(N=(0,Z.jsxs)(jr,{open:c,onOpenChange:l,children:[j,M]}),t[41]=c,t[42]=l,t[43]=j,t[44]=M,t[45]=N):N=t[45],N}function gZ(e){let t=(0,$.c)(15),{group:n,open:r,worktreeModel:i,entries:a,onPickFlyoutEntry:o,guardStaleSelect:s,openNewWorktreeWith:c}=e,{_:l}=vt(),[u,d]=(0,Q.useState)(``),f=(0,Q.useRef)(null),p=(0,Q.useRef)(null),m,h;t[0]===r?(m=t[1],h=t[2]):(m=()=>{r&&f.current?.focus({preventScroll:!0})},h=[r],t[0]=r,t[1]=m,t[2]=h),(0,Q.useEffect)(m,h);let g=function(){let e=p.current;return e===null?[]:[...e.querySelectorAll(`[role="menuitem"]`)]},_=function(e){g()[e]?.focus()},v=function(e,t){if(e.key===`ArrowDown`){e.preventDefault(),e.stopPropagation();let t=g(),n=t.indexOf(e.currentTarget);_(Math.min(n+1,t.length-1))}else if(e.key===`ArrowUp`){e.preventDefault(),e.stopPropagation();let t=g().indexOf(e.currentTarget);t<=0?f.current?.focus():_(t-1)}else e.key===`Enter`&&(e.preventDefault(),e.stopPropagation(),t())},y;if(t[3]!==a||t[4]!==u){let e=u.trim().toLowerCase();y=e===``?a:a.filter(t=>(t.branch??``).toLowerCase().includes(e)),t[3]=a,t[4]=u,t[5]=y}else y=t[5];let b=y,x=i!==null&&i.mainRoot===n.project.mainRoot,S=u.trim(),C=x&&S.length>0,w;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(Rc,{align:`inline-start`,children:(0,Z.jsx)(he,{"aria-hidden":`true`})}),t[6]=w):w=t[6];let T;t[7]===l?T=t[8]:(T=l({id:`bSD4im`}),t[7]=l,t[8]=T);let E;t[9]===l?E=t[10]:(E=l({id:`Skr_7L`}),t[9]=l,t[10]=E);let D;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(D=e=>d(e.target.value),t[11]=D):D=t[11];let O=b.length===0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ir,{className:`font-normal text-muted-foreground text-xs`,role:`status`,"aria-live":`polite`,children:l({id:`-uaQnI`})}),C?(0,Z.jsxs)(Ar,{onSelect:e=>{s(e)||c(S)},onKeyDown:e=>v(e,()=>c(S)),className:`flex items-center gap-2`,"data-testid":`project-switcher-flyout-create`,children:[(0,Z.jsx)(Kt,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm`,title:S,children:(0,Z.jsx)(J,{id:`gHSAWT`,values:{typedName:S},components:{0:(0,Z.jsx)(`span`,{className:`font-medium`}),1:(0,Z.jsx)(`span`,{className:`font-mono`})}})})]}):null]}):b.map(e=>{let t=e.path??`branch:${e.branch}`,n=e.branch??l({id:`D12vtS`});return(0,Z.jsxs)(Ar,{onSelect:t=>{s(t)||o(e)},onKeyDown:t=>v(t,()=>o(e)),className:`flex items-center gap-2`,"data-testid":`project-switcher-flyout-entry-${t}`,"data-current":e.isCurrent?`true`:void 0,children:[(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm`,title:n,children:n}),e.isMain?(0,Z.jsx)(`span`,{className:`shrink-0 text-muted-foreground text-xs`,children:l({id:`Bn9-El`})}):e.opened?null:(0,Z.jsx)(`span`,{className:`shrink-0 text-muted-foreground text-xs`,title:l({id:`Dvwa0U`}),children:l({id:`nfoduq`})}),e.isCurrent?(0,Z.jsx)(xZ,{}):null]},t)}),k;return t[12]!==p||t[13]!==O?(k=(0,Z.jsx)(`div`,{ref:p,className:`min-h-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-contain subtle-scrollbar`,children:O}),t[12]=p,t[13]=O,t[14]=k):k=t[14],(0,Z.jsx)(zr,{children:(0,Z.jsxs)(Mr,{avoidCollisions:!1,sideOffset:-8,className:`flex max-h-80 w-96 flex-col gap-1 overflow-hidden p-1`,"data-testid":`project-switcher-flyout-${n.project.path}`,children:[(0,Z.jsxs)(Vc,{className:`mb-1 h-8 shrink-0`,children:[w,(0,Z.jsx)(Nc,{ref:f,"aria-label":T,placeholder:E,value:u,onChange:D,onKeyDown:e=>{e.key===`ArrowDown`&&(e.preventDefault(),_(0)),e.stopPropagation()},"data-testid":`project-switcher-flyout-search-${n.project.path}`})]}),k]})})}function _Z(e){let t=(0,$.c)(41),{recents:n,currentPath:r,query:i,worktreeModel:a,onPickEntry:o,onPickBranch:s,guardStaleSelect:c}=e,{_:l}=vt(),u;t[0]===i?u=t[1]:(u=e=>e.toLowerCase().includes(i),t[0]=i,t[1]=u);let d=u,f,p,m,h;if(t[2]!==l||t[3]!==r||t[4]!==c||t[5]!==d||t[6]!==s||t[7]!==o||t[8]!==n||t[9]!==a){h=Symbol.for(`react.early_return_sentinel`);bb0:{let e;t[14]===d?e=t[15]:(e=e=>!e.isLinkedWorktree&&(d(e.name)||d(e.path)),t[14]=d,t[15]=e);let i=n.filter(e),u;t[16]===d?u=t[17]:(u=e=>e.isLinkedWorktree===!0&&(d(e.branch??``)||d(e.path)),t[16]=d,t[17]=u);let g=n.filter(u),_=new Set(g.map(vZ)),v;t[18]===a?.entries?v=t[19]:(v=a?.entries??[],t[18]=a?.entries,t[19]=v);let y=v.filter(e=>e.branch!==null&&d(e.branch)&&(e.worktreePath===null||!_.has(e.worktreePath))&&e.worktreePath!==r);if(i.length===0&&g.length===0&&y.length===0){let e;t[20]===l?e=t[21]:(e=l({id:`pEQFsW`}),t[20]=l,t[21]=e);let n;t[22]===e?n=t[23]:(n=(0,Z.jsx)(Ir,{className:`font-normal text-muted-foreground text-xs`,role:`status`,"aria-live":`polite`,children:e}),t[22]=e,t[23]=n),h=n;break bb0}let b;t[24]!==r||t[25]!==c||t[26]!==o?(b=e=>(0,Z.jsx)(Ar,{onSelect:t=>{c(t)||o(e)},className:`flex w-full min-w-0 flex-col items-start gap-0.5`,"data-testid":`project-switcher-recent-${e.path}`,children:(0,Z.jsx)(bZ,{name:e.name,path:e.path,current:e.path===r})},e.path),t[24]=r,t[25]=c,t[26]=o,t[27]=b):b=t[27],f=i.map(b);let x;t[28]!==r||t[29]!==c||t[30]!==o?(x=e=>(0,Z.jsxs)(Ar,{onSelect:t=>{c(t)||o(e)},className:`flex items-start gap-2`,"data-testid":`project-switcher-worktree-${e.path}`,"data-current":e.path===r?`true`:void 0,children:[(0,Z.jsx)(Xo,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0`}),(0,Z.jsx)(yZ,{branch:e.branch??e.name,project:e.mainRoot===void 0?null:sv(e.mainRoot)})]},e.path),t[28]=r,t[29]=c,t[30]=o,t[31]=x):x=t[31],p=g.map(x);let S;t[32]!==l||t[33]!==c||t[34]!==s||t[35]!==a?(S=e=>(0,Z.jsxs)(Ar,{onSelect:t=>{c(t)||e.branch!==null&&s(e.branch)},className:`flex items-start gap-2`,"data-testid":`project-switcher-branch-${e.branch}`,children:[(0,Z.jsx)(Xo,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 opacity-40`}),(0,Z.jsx)(yZ,{branch:e.branch??``,project:a===null?null:sv(a.mainRoot),hint:l({id:`nfoduq`})})]},`branch:${e.branch}`),t[32]=l,t[33]=c,t[34]=s,t[35]=a,t[36]=S):S=t[36],m=y.map(S)}t[2]=l,t[3]=r,t[4]=c,t[5]=d,t[6]=s,t[7]=o,t[8]=n,t[9]=a,t[10]=f,t[11]=p,t[12]=m,t[13]=h}else f=t[10],p=t[11],m=t[12],h=t[13];if(h!==Symbol.for(`react.early_return_sentinel`))return h;let g;return t[37]!==f||t[38]!==p||t[39]!==m?(g=(0,Z.jsxs)(Z.Fragment,{children:[f,p,m]}),t[37]=f,t[38]=p,t[39]=m,t[40]=g):g=t[40],g}function vZ(e){return e.path}function yZ(e){let t=(0,$.c)(12),{branch:n,project:r,hint:i}=e,a;t[0]===n?a=t[1]:(a=(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm`,children:n}),t[0]=n,t[1]=a);let o;t[2]===i?o=t[3]:(o=i===void 0?null:(0,Z.jsx)(`span`,{className:`shrink-0 text-muted-foreground text-xs`,children:i}),t[2]=i,t[3]=o);let s;t[4]!==a||t[5]!==o?(s=(0,Z.jsxs)(`span`,{className:`flex w-full min-w-0 items-center gap-1.5`,children:[a,o]}),t[4]=a,t[5]=o,t[6]=s):s=t[6];let c;t[7]===r?c=t[8]:(c=r===null?null:(0,Z.jsx)(`span`,{className:`truncate text-muted-foreground text-xs`,title:r,children:r}),t[7]=r,t[8]=c);let l;return t[9]!==s||t[10]!==c?(l=(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[s,c]}),t[9]=s,t[10]=c,t[11]=l):l=t[11],l}function bZ(e){let t=(0,$.c)(15),{name:n,path:r,current:i}=e,a=i&&`font-medium`,o;t[0]===a?o=t[1]:(o=$t(`flex w-full items-center gap-1.5`,a),t[0]=a,t[1]=o);let s;t[2]===n?s=t[3]:(s=(0,Z.jsx)(`span`,{className:`truncate font-medium text-sm`,title:n,children:n}),t[2]=n,t[3]=s);let c;t[4]===i?c=t[5]:(c=i?(0,Z.jsx)(Ds,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}):null,t[4]=i,t[5]=c);let l;t[6]!==o||t[7]!==s||t[8]!==c?(l=(0,Z.jsxs)(`span`,{className:o,children:[s,c]}),t[6]=o,t[7]=s,t[8]=c,t[9]=l):l=t[9];let u;t[10]===r?u=t[11]:(u=(0,Z.jsx)(`span`,{className:`w-full truncate text-muted-foreground text-xs`,title:r,children:r}),t[10]=r,t[11]=u);let d;return t[12]!==l||t[13]!==u?(d=(0,Z.jsxs)(`span`,{className:`flex w-full min-w-0 flex-col gap-0.5`,children:[l,u]}),t[12]=l,t[13]=u,t[14]=d):d=t[14],d}function xZ(){let e=(0,$.c)(4),{_:t}=vt(),n;e[0]===t?n=e[1]:(n=t({id:`Hp1l6f`}),e[0]=t,e[1]=n);let r;return e[2]===n?r=e[3]:(r=(0,Z.jsx)(Ds,{"aria-label":n,className:`size-3.5 shrink-0 text-muted-foreground`}),e[2]=n,e[3]=r),r}var SZ=(e,t,n)=>$_(e,t,n,`ProjectSwitcher`),CZ=350;function wZ(e){let t=(0,$.c)(117),{bridge:n}=e,{_:r}=vt(),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(``),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(``),[g,_]=(0,Q.useState)(null),v=KN(),y=X_(),b=typeof window<`u`&&window.okDesktop!=null,x=(0,Q.useRef)(!1),S=(0,Q.useRef)(!1),C=(0,Q.useRef)(null),w;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(w=e=>{e&&(S.current=!0,C.current!==null&&clearTimeout(C.current),C.current=setTimeout(()=>{S.current=!1},CZ)),s(e),e||(l(``),_(null))},t[0]=w):w=t[0];let T=w,E;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(E=e=>!b||!S.current?!1:(e.preventDefault(),!0),t[1]=E):E=t[1];let D=E,O;t[2]!==r||t[3]!==n.project||t[4]!==o?(O=()=>{if(!o)return;let e=!1;return SZ(async()=>{let t=await n.project.listRecent();e||a(t)},r({id:`fYKgzG`})),()=>{e=!0}},t[2]=r,t[3]=n.project,t[4]=o,t[5]=O):O=t[5];let k;t[6]!==r||t[7]!==n||t[8]!==o?(k=[o,n,r],t[6]=r,t[7]=n,t[8]=o,t[9]=k):k=t[9],(0,Q.useEffect)(O,k);let A,j;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(A=()=>Gt(e=>{e===`new-worktree`?(s(!1),_(null),h(``),p(!0)):e===`switch-worktree`&&s(!0)}),j=[],t[10]=A,t[11]=j):(A=t[10],j=t[11]),(0,Q.useEffect)(A,j);let M;t[12]!==r||t[13]!==n.dialog||t[14]!==n.project?(M=()=>{T(!1),SZ(async()=>{let e=await n.dialog.openFolder();e&&await n.project.open({path:e,target:`new-window`,entryPoint:`pick-existing`})},r({id:`gmJ0An`}))},t[12]=r,t[13]=n.dialog,t[14]=n.project,t[15]=M):M=t[15];let N=M,P;t[16]!==r||t[17]!==n.project?(P=()=>{T(!1),SZ(()=>n.project.openFile(),r({id:`8vCZcs`}))},t[16]=r,t[17]=n.project,t[18]=P):P=t[18];let F=P,I;t[19]!==r||t[20]!==n.navigator?(I=()=>{T(!1),SZ(()=>n.navigator.open(),r({id:`jol95m`}))},t[19]=r,t[20]=n.navigator,t[21]=I):I=t[21];let L=I,R;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(R=()=>{T(!1),d(!0)},t[22]=R):R=t[22];let z=R,B;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(B=e=>{T(!1),h(e),p(!0)},t[23]=B):B=t[23];let V=B,H=n.config.projectPath,U;t[24]===c?U=t[25]:(U=c.trim().toLowerCase(),t[24]=c,t[25]=U);let W=U,ee=W!==``,G;t[26]===i?G=t[27]:(G=i??[],t[26]=i,t[27]=G);let K=G,te;t[28]!==ee||t[29]!==K?(te=ee?K.filter(MZ):K,t[28]=ee,t[29]=K,t[30]=te):te=t[30];let ne=te,re=ee?null:y,ie=v!==null&&`h-auto py-1.5`,ae;t[31]===ie?ae=t[32]:(ae=$t(`justify-between text-sidebar-foreground/70 hover:text-sidebar-foreground! data-open:hover:text-sidebar-foreground!`,ie),t[31]=ie,t[32]=ae);let oe;t[33]===r?oe=t[34]:(oe=r({id:`zZ_I5K`}),t[33]=r,t[34]=oe);let se;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(se=b?()=>{x.current=!0}:void 0,t[35]=se):se=t[35];let ce;t[36]===o?ce=t[37]:(ce=b?()=>{if(x.current){x.current=!1;return}T(!o)}:void 0,t[36]=o,t[37]=ce);let le;t[38]===n.config.projectName?le=t[39]:(le=(0,Z.jsx)(`span`,{className:`truncate`,children:n.config.projectName}),t[38]=n.config.projectName,t[39]=le);let ue;t[40]===v?ue=t[41]:(ue=v===null?null:(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1 text-xs text-sidebar-foreground/50 group-hover/menu-button:text-sidebar-foreground`,"data-testid":`project-switcher-branch`,children:[(0,Z.jsx)(Xo,{"aria-hidden":`true`,className:`size-3! shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:v})]}),t[40]=v,t[41]=ue);let de;t[42]!==le||t[43]!==ue?(de=(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[le,ue]}),t[42]=le,t[43]=ue,t[44]=de):de=t[44];let pe;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(pe=(0,Z.jsx)(Rm,{"aria-hidden":`true`,className:`opacity-60`}),t[45]=pe):pe=t[45];let q;t[46]!==n.config.projectPath||t[47]!==ae||t[48]!==oe||t[49]!==ce||t[50]!==de?(q=(0,Z.jsx)(Pr,{asChild:!0,children:(0,Z.jsxs)(IN,{className:ae,"data-testid":`project-switcher-trigger`,"aria-label":oe,title:n.config.projectPath,onPointerDown:se,onClick:ce,children:[de,pe]})}),t[46]=n.config.projectPath,t[47]=ae,t[48]=oe,t[49]=ce,t[50]=de,t[51]=q):q=t[51];let me;t[52]!==r||t[53]!==n||t[54]!==H||t[55]!==g||t[56]!==ne||t[57]!==re||t[58]!==W||t[59]!==i||t[60]!==c?(me=i===null?null:i.length===0?(0,Z.jsx)(Ir,{className:`font-normal text-muted-foreground text-xs`,children:(0,Z.jsx)(J,{id:`MUrVEo`})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Vc,{className:`mb-1 h-8 border-0 shadow-none has-[[data-slot=input-group-control]:focus-visible]:ring-0`,children:[(0,Z.jsx)(Nc,{"aria-label":r({id:`blFttG`}),placeholder:r({id:`RVZJWQ`}),value:c,onChange:e=>{e.target.value!==``&&_(null),l(e.target.value)},onKeyDown:jZ,"data-testid":`project-switcher-search`}),(0,Z.jsx)(Rc,{children:(0,Z.jsx)(he,{"aria-hidden":`true`})})]}),(0,Z.jsx)(Vr,{}),(0,Z.jsx)(`div`,{className:`max-h-64 overflow-x-hidden overflow-y-auto overscroll-contain subtle-scrollbar scroll-fade-mask`,"data-testid":`project-switcher-scroll`,onScroll:()=>{g!==null&&_(null)},children:(0,Z.jsx)(fZ,{bridge:n,recents:ne,currentPath:H,query:W,worktreeModel:re,closeMenu:()=>T(!1),guardStaleSelect:D,flyoutPath:g,setFlyoutPath:_,openNewWorktreeWith:V})})]}),t[52]=r,t[53]=n,t[54]=H,t[55]=g,t[56]=ne,t[57]=re,t[58]=W,t[59]=i,t[60]=c,t[61]=me):me=t[61];let ge;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,Z.jsx)(Vr,{}),t[62]=ge):ge=t[62];let _e;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(_e=e=>{D(e)||z()},t[63]=_e):_e=t[63];let ve;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(ve=(0,Z.jsxs)(Ar,{onSelect:_e,"data-testid":`project-switcher-new-project`,children:[(0,Z.jsx)(Kt,{"aria-hidden":`true`,className:`text-muted-foreground`}),(0,Z.jsx)(J,{id:`gKi-a_`})]}),t[64]=ve):ve=t[64];let ye;t[65]===L?ye=t[66]:(ye=e=>{D(e)||L()},t[65]=L,t[66]=ye);let be,xe;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(be=(0,Z.jsx)(fe,{"aria-hidden":`true`,className:`text-muted-foreground`}),xe=(0,Z.jsx)(J,{id:`xaDWAI`}),t[67]=be,t[68]=xe):(be=t[67],xe=t[68]);let Se;t[69]===ye?Se=t[70]:(Se=(0,Z.jsxs)(Ar,{onSelect:ye,"data-testid":`project-switcher-switch-project`,children:[be,xe]}),t[69]=ye,t[70]=Se);let Ce;t[71]===N?Ce=t[72]:(Ce=e=>{D(e)||N()},t[71]=N,t[72]=Ce);let we,Te;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(we=(0,Z.jsx)(gc,{"aria-hidden":`true`,className:`text-muted-foreground`}),Te=(0,Z.jsx)(J,{id:`PVUn_c`}),t[73]=we,t[74]=Te):(we=t[73],Te=t[74]);let Ee;t[75]===Ce?Ee=t[76]:(Ee=(0,Z.jsxs)(Ar,{onSelect:Ce,"data-testid":`project-switcher-open-folder`,children:[we,Te]}),t[75]=Ce,t[76]=Ee);let De;t[77]===F?De=t[78]:(De=e=>{D(e)||F()},t[77]=F,t[78]=De);let Oe,ke;t[79]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=(0,Z.jsx)(qn,{"aria-hidden":`true`,className:`text-muted-foreground`}),ke=(0,Z.jsx)(J,{id:`9npOH9`}),t[79]=Oe,t[80]=ke):(Oe=t[79],ke=t[80]);let Ae;t[81]===De?Ae=t[82]:(Ae=(0,Z.jsxs)(Ar,{onSelect:De,"data-testid":`project-switcher-open-file`,children:[Oe,ke]}),t[81]=De,t[82]=Ae);let je;t[83]===v?je=t[84]:(je=v===null?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Vr,{}),(0,Z.jsxs)(Ar,{onSelect:e=>{D(e)||(T(!1),h(``),p(!0))},"data-testid":`project-switcher-new-worktree`,children:[(0,Z.jsx)(Xo,{"aria-hidden":`true`,className:`text-muted-foreground`}),(0,Z.jsx)(J,{id:`DXd9LM`})]})]}),t[83]=v,t[84]=je);let Me;t[85]!==me||t[86]!==Se||t[87]!==Ee||t[88]!==Ae||t[89]!==je?(Me=(0,Z.jsxs)(Rr,{align:`start`,side:`top`,className:`min-w-[260px]`,"data-testid":`project-switcher-menu`,children:[me,ge,ve,Se,Ee,Ae,je]}),t[85]=me,t[86]=Se,t[87]=Ee,t[88]=Ae,t[89]=je,t[90]=Me):Me=t[90];let Ne;t[91]!==o||t[92]!==q||t[93]!==Me?(Ne=(0,Z.jsxs)(Br,{open:o,onOpenChange:T,modal:!1,children:[q,Me]}),t[91]=o,t[92]=q,t[93]=Me,t[94]=Ne):Ne=t[94];let Pe;t[95]!==n||t[96]!==u?(Pe=(0,Z.jsx)($h,{open:u,onOpenChange:d,bridge:n}),t[95]=n,t[96]=u,t[97]=Pe):Pe=t[97];let Fe;t[98]===y?.entries?Fe=t[99]:(Fe=y?.entries.map(AZ).filter(kZ),t[98]=y?.entries,t[99]=Fe);let Ie;t[100]===y?.entries?Ie=t[101]:(Ie=new Set(y?.entries.filter(OZ).map(DZ)),t[100]=y?.entries,t[101]=Ie);let Le=y?.remoteBranches,Re;t[102]===y?.entries?Re=t[103]:(Re=new Map(y?.entries.filter(EZ).map(TZ)),t[102]=y?.entries,t[103]=Re);let ze;t[104]!==v||t[105]!==n||t[106]!==m||t[107]!==f||t[108]!==Fe||t[109]!==Ie||t[110]!==Le||t[111]!==Re?(ze=(0,Z.jsx)(oZ,{open:f,onOpenChange:p,bridge:n,currentBranch:v,initialBranchName:m,branches:Fe,existingWorktreeBranches:Ie,remoteBranches:Le,behindByBranch:Re}),t[104]=v,t[105]=n,t[106]=m,t[107]=f,t[108]=Fe,t[109]=Ie,t[110]=Le,t[111]=Re,t[112]=ze):ze=t[112];let Be;return t[113]!==Ne||t[114]!==Pe||t[115]!==ze?(Be=(0,Z.jsxs)(Z.Fragment,{children:[Ne,Pe,ze]}),t[113]=Ne,t[114]=Pe,t[115]=ze,t[116]=Be):Be=t[116],Be}function TZ(e){return[e.branch,e.behind]}function EZ(e){return e.branch!==null&&e.behind!==void 0}function DZ(e){return e.branch}function OZ(e){return e.branch!==null&&e.worktreePath!==null}function kZ(e){return e!==null}function AZ(e){return e.branch}function jZ(e){return e.stopPropagation()}function MZ(e){return!e.isLinkedWorktree}function NZ(e,t){let n=e instanceof Error?e:Error(String(e));console.warn(JSON.stringify({event:`jsx-render-failure`,component:`sidebarSearchPill`,rawComponentName:`sidebarSearchPill`,error:String(n),stack:t.componentStack})),Oo(`sidebarSearchPill`)}function PZ(e){let t=(0,$.c)(8),{onClick:n,className:r}=e,i;t[0]===r?i=t[1]:(i=$t(`rounded-lg h-9 w-full justify-start gap-2 px-3 font-normal text-muted-foreground`,r),t[0]=r,t[1]=i);let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(he,{"aria-hidden":`true`}),t[2]=a):a=t[2];let o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(`span`,{className:`flex-1 text-left text-sm`,children:(0,Z.jsx)(J,{id:`A1taO8`})}),t[3]=o):o=t[3];let s;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(Oe,{className:`text-foreground/70`,children:xl(`command-palette`)}),t[4]=s):s=t[4];let c;return t[5]!==n||t[6]!==i?(c=(0,Z.jsxs)(Y,{variant:`outline`,onClick:n,"data-telemetry-event":`ok.sidebar.search_pill.click`,className:i,children:[a,o,s]}),t[5]=n,t[6]=i,t[7]=c):c=t[7],c}function FZ(){let e=(0,$.c)(36),{_:t}=vt(),n=Gs(),{activeDocName:r}=Re(),[i,a]=(0,Q.useState)(!1),o=Zs(),s;e[0]!==n.data||e[1]!==n.status?(s=n.status===`ready`?n.data:[],e[0]=n.data,e[1]=n.status,e[2]=s):s=e[2];let c=s,l;e[3]===c?l=e[4]:(l=cc(c),e[3]=c,e[4]=l);let u=l,d=uc(),f;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(f={},e[5]=f):f=e[5];let[p,m]=(0,Q.useState)(f),h;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(AN,{asChild:!0,children:(0,Z.jsxs)(mn,{className:`flex w-full items-center gap-1.5`,children:[(0,Z.jsx)(rh,{className:`size-3.5 shrink-0`}),(0,Z.jsx)(J,{id:`PCSkw2`}),(0,Z.jsx)(As,{className:`size-3.5 shrink-0 text-muted-foreground transition-transform group-data-[state=open]/skills:rotate-90`})]})}),e[6]=h):h=e[6];let g;e[7]===t?g=e[8]:(g=t({id:`MdpSC1`}),e[7]=t,e[8]=g);let _,v;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(_=()=>a(!0),v=(0,Z.jsx)(Kt,{}),e[9]=_,e[10]=v):(_=e[9],v=e[10]);let y;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`MdpSC1`})}),e[11]=y):y=e[11];let b;e[12]===g?b=e[13]:(b=(0,Z.jsxs)(jN,{title:g,onClick:_,children:[v,y]}),e[12]=g,e[13]=b);let x;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(GZ,{}),e[14]=x):x=e[14];let S;e[15]===c?S=e[16]:(S=c.some(LZ),e[15]=c,e[16]=S);let C;e[17]===S?C=e[18]:(C=(0,Z.jsx)(UZ,{hasProjectSkills:S}),e[17]=S,e[18]=C);let w;e[19]!==o||e[20]!==r||e[21]!==u||e[22]!==p||e[23]!==d||e[24]!==c?(w=c.length===0?(0,Z.jsx)(`p`,{className:`px-2 py-1 text-xs text-muted-foreground`,children:(0,Z.jsx)(J,{id:`PdJZ5p`})}):ac.filter(e=>c.some(t=>t.scope===e)).map(e=>(0,Z.jsxs)(hn,{className:`group/scope`,open:c.some(t=>t.scope===e&&No(t.scope,t.name)===r)||(p[e]??!1),onOpenChange:t=>m(n=>({...n,[e]:t})),children:[(0,Z.jsxs)(mn,{className:`flex w-full items-center gap-1 px-2 pt-1 pb-0.5 text-[11px] text-muted-foreground/70 hover:text-muted-foreground`,children:[(0,Z.jsx)(As,{className:`size-3 shrink-0 transition-transform group-data-[state=open]/scope:rotate-90`}),(0,Z.jsx)(`span`,{className:`truncate`,children:d[e]})]}),(0,Z.jsx)(pn,{children:(0,Z.jsx)(NN,{className:`pl-2`,children:c.filter(t=>t.scope===e).map(e=>(0,Z.jsx)(RZ,{skill:e,activeDocName:r,actions:o,existingNames:u[e.scope]},`${e.scope}::${e.name}`))})})]},e)),e[19]=o,e[20]=r,e[21]=u,e[22]=p,e[23]=d,e[24]=c,e[25]=w):w=e[25];let T;e[26]!==C||e[27]!==w?(T=(0,Z.jsx)(pn,{children:(0,Z.jsxs)(MN,{children:[x,C,w]})}),e[26]=C,e[27]=w,e[28]=T):T=e[28];let E;e[29]===i?E=e[30]:(E=(0,Z.jsx)(bi,{defaultScope:`project`,open:i,onOpenChange:a,onCreated:IZ}),e[29]=i,e[30]=E);let D;return e[31]!==o.dialogs||e[32]!==T||e[33]!==E||e[34]!==b?(D=(0,Z.jsx)(hn,{className:`group/skills shrink-0`,children:(0,Z.jsxs)(kN,{className:`px-0`,children:[h,b,T,o.dialogs,E]})}),e[31]=o.dialogs,e[32]=T,e[33]=E,e[34]=b,e[35]=D):D=e[35],D}function IZ(e){let{scope:t,name:n}=e;return yc(No(t,n))}function LZ(e){return e.scope===`project`&&!e.managed}function RZ(e){let t=(0,$.c)(52),{skill:n,activeDocName:r,actions:i,existingNames:a}=e,{_:o}=vt(),[s,c]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)(!1),d;t[0]!==n.name||t[1]!==n.scope?(d=No(n.scope,n.name),t[0]=n.name,t[1]=n.scope,t[2]=d):d=t[2];let f=r===d,p,m,h;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=e=>{e.preventDefault(),u(!0)},m=(0,Z.jsx)(As,{className:`size-3 shrink-0 text-muted-foreground transition-transform group-data-[state=open]/skill:rotate-90`}),h=(0,Z.jsx)(rh,{className:`size-3 shrink-0 text-muted-foreground`}),t[3]=p,t[4]=m,t[5]=h):(p=t[3],m=t[4],h=t[5]);let g=n.name,_;t[6]===n.name?_=t[7]:(_=rc(n.name),t[6]=n.name,t[7]=_);let v;t[8]!==n.name||t[9]!==_?(v=(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:g,children:_}),t[8]=n.name,t[9]=_,t[10]=v):v=t[10];let y;t[11]!==o||t[12]!==n.bundledVersion||t[13]!==n.updateAvailable?(y=n.updateAvailable?(0,Z.jsx)(`span`,{title:o({id:`1YJ4Yg`,values:{0:n.bundledVersion?` (${n.bundledVersion})`:``}}),className:`flex items-center`,children:(0,Z.jsx)(tl,{className:`size-3 text-primary`,"aria-label":o({id:`CifUuG`})})}):null,t[11]=o,t[12]=n.bundledVersion,t[13]=n.updateAvailable,t[14]=y):y=t[14];let b;t[15]!==o||t[16]!==n.installed||t[17]!==n.managed?(b=n.managed?(0,Z.jsx)(`span`,{title:o({id:`U7HJ4y`}),className:`flex items-center`,children:(0,Z.jsx)(Ls,{className:`size-3 text-muted-foreground`,"aria-label":o({id:`U7HJ4y`})})}):(0,Z.jsx)(_i,{installed:n.installed,subtle:!0,className:`shrink-0`}),t[15]=o,t[16]=n.installed,t[17]=n.managed,t[18]=b):b=t[18];let x;t[19]!==y||t[20]!==b?(x=(0,Z.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1`,children:[y,b]}),t[19]=y,t[20]=b,t[21]=x):x=t[21];let S;t[22]!==f||t[23]!==x||t[24]!==v?(S=(0,Z.jsx)(mn,{asChild:!0,children:(0,Z.jsxs)(IN,{size:`sm`,isActive:f,className:`h-6 text-[11px]`,onContextMenu:p,children:[m,h,v,x]})}),t[22]=f,t[23]=x,t[24]=v,t[25]=S):S=t[25];let C;t[26]!==o||t[27]!==n.name?(C=o({id:`RlLl3G`,values:{0:n.name}}),t[26]=o,t[27]=n.name,t[28]=C):C=t[28];let w;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(Wm,{}),t[29]=w):w=t[29];let T;t[30]===C?T=t[31]:(T=(0,Z.jsx)(Pr,{asChild:!0,children:(0,Z.jsx)(LN,{showOnHover:!0,"aria-label":C,children:w})}),t[30]=C,t[31]=T);let E;t[32]!==i||t[33]!==a||t[34]!==n?(E=(0,Z.jsx)(Rr,{side:`right`,align:`start`,className:`min-w-52`,children:(0,Z.jsx)(Js,{skill:n,actions:i,existingNames:a})}),t[32]=i,t[33]=a,t[34]=n,t[35]=E):E=t[35];let D;t[36]!==l||t[37]!==T||t[38]!==E?(D=(0,Z.jsxs)(Br,{open:l,onOpenChange:u,children:[T,E]}),t[36]=l,t[37]=T,t[38]=E,t[39]=D):D=t[39];let O;t[40]!==s||t[41]!==n?(O=s?(0,Z.jsx)(VZ,{skill:n}):null,t[40]=s,t[41]=n,t[42]=O):O=t[42];let k;t[43]===O?k=t[44]:(k=(0,Z.jsx)(pn,{children:O}),t[43]=O,t[44]=k);let A;t[45]!==S||t[46]!==D||t[47]!==k?(A=(0,Z.jsxs)(PN,{children:[S,D,k]}),t[45]=S,t[46]=D,t[47]=k,t[48]=A):A=t[48];let j;return t[49]!==s||t[50]!==A?(j=(0,Z.jsx)(hn,{open:s,onOpenChange:c,className:`group/skill`,children:A}),t[49]=s,t[50]=A,t[51]=j):j=t[51],j}function zZ(e){let t=[];for(let n of e){let e=n.path.split(`/`),r=t;e.forEach((t,i)=>{let a=i===e.length-1,o=r.find(e=>e.name===t);o||(o=a?{name:t,path:n.path,text:n.text}:{name:t,path:e.slice(0,i+1).join(`/`),children:[]},r.push(o)),!a&&o.children&&(r=o.children)})}return BZ(t),t}function BZ(e){e.sort((e,t)=>{let n=+!e.children,r=+!t.children;return n===r?e.name.localeCompare(t.name):n-r});for(let t of e)t.children&&BZ(t.children)}function VZ(e){let t=(0,$.c)(36),{skill:n}=e,{_:r}=vt(),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(!1),{openTarget:c}=Re(),l;t[0]===c?l=t[1]:(l=function(e){c({kind:`doc`,target:e,docName:e},{tabBehavior:`append`}),nu(lu(e))},t[0]=c,t[1]=l);let u=l,d;t[2]!==c||t[3]!==n.name||t[4]!==n.scope?(d=function(e){c({kind:`skill-file`,target:`${n.scope}/${n.name}/${e}`,scope:n.scope,name:n.name,path:e},{tabBehavior:`replace-active`}),nu(au({scope:n.scope,name:n.name,path:e}))},t[2]=c,t[3]=n.name,t[4]=n.scope,t[5]=d):d=t[5];let f=d,p;t[6]!==u||t[7]!==f||t[8]!==n.managed||t[9]!==n.name||t[10]!==n.scope?(p=function(e){if(n.managed){f(e);return}let t=e.lastIndexOf(`.`),r=t>=0?e.slice(t+1).toLowerCase():``;if(n.scope===`project`&&(r===`md`||r===`mdx`)){u(Ue(n.name,e.replace(/\.mdx?$/i,``)));return}f(e)},t[6]=u,t[7]=f,t[8]=n.managed,t[9]=n.name,t[10]=n.scope,t[11]=p):p=t[11];let m=p,h,g;t[12]!==n.name||t[13]!==n.scope?(h=()=>{let e=!0,t=()=>{Gd(n.scope,n.name).then(t=>{e&&(t.ok?(a(t.files),s(!1)):(a([]),s(!0)))})};t();let r=Yl(t);return()=>{e=!1,r()}},g=[n.scope,n.name],t[12]=n.name,t[13]=n.scope,t[14]=h,t[15]=g):(h=t[14],g=t[15]),(0,Q.useEffect)(h,g);let _;if(t[16]!==r||t[17]!==i||t[18]!==o||t[19]!==m||t[20]!==u||t[21]!==f||t[22]!==n.managed||t[23]!==n.name||t[24]!==n.scope){let e=i?zZ(i):[],a;t[26]!==u||t[27]!==f||t[28]!==n.managed||t[29]!==n.name||t[30]!==n.scope?(a=()=>n.managed?f(`SKILL.md`):n.scope===`project`?u(za(n.name)):yc(No(n.scope,n.name)),t[26]=u,t[27]=f,t[28]=n.managed,t[29]=n.name,t[30]=n.scope,t[31]=a):a=t[31];let s,c;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(qn,{className:`size-3 shrink-0 text-muted-foreground`}),c=(0,Z.jsx)(`span`,{className:`truncate`,children:`SKILL.md`}),t[32]=s,t[33]=c):(s=t[32],c=t[33]);let l;t[34]===a?l=t[35]:(l=(0,Z.jsx)(zN,{children:(0,Z.jsxs)(BN,{size:`sm`,onClick:a,className:`text-[11px]`,children:[s,c]})}),t[34]=a,t[35]=l),_=(0,Z.jsxs)(RN,{className:`mr-0 pr-0`,children:[l,i===null?(0,Z.jsx)(zN,{children:(0,Z.jsx)(`span`,{className:`px-2 py-0.5 text-[11px] text-muted-foreground/70`,children:(0,Z.jsx)(J,{id:`yQE2r9`})})}):o?(0,Z.jsx)(zN,{children:(0,Z.jsx)(`span`,{className:`px-2 py-0.5 text-[11px] text-muted-foreground/70`,title:r({id:`3Ijjy1`}),children:(0,Z.jsx)(J,{id:`ZARuZJ`})})}):e.map(e=>(0,Z.jsx)(HZ,{node:e,depth:0,onOpenFile:m},e.path))]}),t[16]=r,t[17]=i,t[18]=o,t[19]=m,t[20]=u,t[21]=f,t[22]=n.managed,t[23]=n.name,t[24]=n.scope,t[25]=_}else _=t[25];return _}function HZ(e){let t=(0,$.c)(34),{node:n,depth:r,onOpenFile:i}=e,[a,o]=(0,Q.useState)(!1),s=`${r*.6}rem`,c;t[0]===s?c=t[1]:(c={paddingLeft:s},t[0]=s,t[1]=c);let l=c;if(n.children){let e;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(As,{className:`size-3 shrink-0 text-muted-foreground transition-transform group-data-[state=open]/dir:rotate-90`}),t[2]=e):e=t[2];let s;t[3]===n.name?s=t[4]:(s=(0,Z.jsxs)(`span`,{className:`truncate`,children:[n.name,`/`]}),t[3]=n.name,t[4]=s);let c;t[5]!==l||t[6]!==s?(c=(0,Z.jsx)(mn,{asChild:!0,children:(0,Z.jsxs)(BN,{size:`sm`,className:`text-[11px]`,style:l,children:[e,s]})}),t[5]=l,t[6]=s,t[7]=c):c=t[7];let u;if(t[8]!==r||t[9]!==n.children||t[10]!==i){let e;t[12]!==r||t[13]!==i?(e=e=>(0,Z.jsx)(HZ,{node:e,depth:r+1,onOpenFile:i},e.path),t[12]=r,t[13]=i,t[14]=e):e=t[14],u=n.children.map(e),t[8]=r,t[9]=n.children,t[10]=i,t[11]=u}else u=t[11];let d;t[15]===u?d=t[16]:(d=(0,Z.jsx)(pn,{children:u}),t[15]=u,t[16]=d);let f;t[17]!==c||t[18]!==d?(f=(0,Z.jsxs)(zN,{children:[c,d]}),t[17]=c,t[18]=d,t[19]=f):f=t[19];let p;return t[20]!==a||t[21]!==f?(p=(0,Z.jsx)(hn,{open:a,onOpenChange:o,className:`group/dir`,children:f}),t[20]=a,t[21]=f,t[22]=p):p=t[22],p}let u=`skill-file-${n.path}`,d;t[23]!==n.path||t[24]!==i?(d=()=>i(n.path),t[23]=n.path,t[24]=i,t[25]=d):d=t[25];let f;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(qm,{className:`size-3 shrink-0 text-muted-foreground`}),t[26]=f):f=t[26];let p;t[27]===n.name?p=t[28]:(p=(0,Z.jsx)(`span`,{className:`truncate`,children:n.name}),t[27]=n.name,t[28]=p);let m;return t[29]!==l||t[30]!==u||t[31]!==d||t[32]!==p?(m=(0,Z.jsx)(zN,{children:(0,Z.jsxs)(BN,{size:`sm`,className:`text-[11px]`,style:l,"data-testid":u,onClick:d,children:[f,p]})}),t[29]=l,t[30]=u,t[31]=d,t[32]=p,t[33]=m):m=t[33],m}function UZ(e){let t=(0,$.c)(12),{hasProjectSkills:n}=e,{_:r}=vt(),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(!1),c,l;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>{let e=window.okDesktop?.sharing;if(!e)return;let t=!1,n=()=>{e.status().then(e=>{t||a(e.mode===`local-only`&&!e.skillsShared)}).catch(WZ)};return n(),window.addEventListener(`focus`,n),()=>{t=!0,window.removeEventListener(`focus`,n)}},l=[],t[0]=c,t[1]=l):(c=t[0],l=t[1]),(0,Q.useEffect)(c,l),!n||i!==!0)return null;let u;t[2]!==r||t[3]!==o?(u=async()=>{let e=window.okDesktop?.sharing;if(!e||o)return;s(!0);let t=null,n=null;try{t=await e.setSkillsShared(!0)}catch(e){n=e}if(s(!1),n!==null){let e=n instanceof Error?n.message:``;X.error(e.startsWith(`ok:sharing:dispatch:`)?r({id:`qXN416`}):e||r({id:`K2v7QF`}));return}if(t!==null){if(t.kind===`applied`)X.success(r({id:`Q7cNKe`})),a(!1);else if(t.kind===`no-exclude`){let e=t.reason===`no-git`?r({id:`Xwump4`}):t.reason===`inaccessible`?r({id:`PlGC6r`}):r({id:`zcmYx4`});X.warning(r({id:`EARn6h`,values:{detail:e}}))}}},t[2]=r,t[3]=o,t[4]=u):u=t[4];let d=u,f;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(`p`,{className:`mb-2 text-amber-900 dark:text-amber-200`,children:(0,Z.jsx)(J,{id:`Bh9671`})}),t[5]=f):f=t[5];let p;t[6]===d?p=t[7]:(p=()=>void d(),t[6]=d,t[7]=p);let m;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(J,{id:`TUzThQ`}),t[8]=m):m=t[8];let h;return t[9]!==o||t[10]!==p?(h=(0,Z.jsxs)(`div`,{className:`mx-2 mb-1 rounded-md border border-amber-300 bg-amber-50 p-2 text-xs dark:border-amber-700 dark:bg-amber-950`,children:[f,(0,Z.jsx)(Y,{size:`sm`,className:`h-6 px-2 text-xs`,disabled:o,onClick:p,children:m})]}),t[9]=o,t[10]=p,t[11]=h):h=t[11],h}function WZ(e){console.warn(JSON.stringify({event:`skills-share-status-read-failed`,error:e instanceof Error?e.message:String(e)}))}function GZ(){let e=(0,$.c)(19),[t,n]=(0,Q.useState)(null),[r,i]=(0,Q.useState)(!1),a,o;if(e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>{let e=!1;return Ud().then(t=>{e||n(t)}),()=>{e=!0}},o=[],e[0]=a,e[1]=o):(a=e[0],o=e[1]),(0,Q.useEffect)(a,o),!t||t.managed!==null||t.importable===0)return null;let s;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=async e=>{if(i(!0),!await Kd(e)){i(!1);return}n({managed:e,importable:0})},e[2]=s):s=e[2];let c=s,l;e[3]===t.importable?l=e[4]:(l=(0,Z.jsx)(`p`,{className:`mb-2 text-muted-foreground`,children:(0,Z.jsx)(J,{id:`mu1O0q`,values:{0:t.importable}})}),e[3]=t.importable,e[4]=l);let u,d;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>c(!0),d=(0,Z.jsx)(J,{id:`l3s5ri`}),e[5]=u,e[6]=d):(u=e[5],d=e[6]);let f;e[7]===r?f=e[8]:(f=(0,Z.jsx)(Y,{size:`sm`,className:`h-6 px-2 text-xs`,disabled:r,onClick:u,children:d}),e[7]=r,e[8]=f);let p,m;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(p=()=>c(!1),m=(0,Z.jsx)(J,{id:`PBxg_E`}),e[9]=p,e[10]=m):(p=e[9],m=e[10]);let h;e[11]===r?h=e[12]:(h=(0,Z.jsx)(Y,{size:`sm`,variant:`ghost`,className:`h-6 px-2 text-xs`,disabled:r,onClick:p,children:m}),e[11]=r,e[12]=h);let g;e[13]!==f||e[14]!==h?(g=(0,Z.jsxs)(`div`,{className:`flex gap-1.5`,children:[f,h]}),e[13]=f,e[14]=h,e[15]=g):g=e[15];let _;return e[16]!==g||e[17]!==l?(_=(0,Z.jsxs)(`div`,{className:`mx-2 mb-1 rounded-md border border-border/60 bg-muted/40 p-2 text-xs`,children:[l,g]}),e[16]=g,e[17]=l,e[18]=_):_=e[18],_}var KZ=`Relaunch`,qZ=`Release notes`,JZ=`Updates paused`,YZ=`Download`,XZ=`Reset to defaults`,ZZ=`Relaunching to install the update…`,QZ=`Relaunch failed — please restart manually`;function $Z(e){return`Update to ${e} didn't install.`}var eQ=`Retry`,tQ=`Download manually`,nQ=`Recovery action failed — please try again`;function rQ(e,t){let n=t instanceof Error&&t.message?t.message:``;return n?`${e}: ${n}`:e}function iQ(e){return`Version ${e} ready to install`}function aQ(e){return`Updated to Version ${e}`}function oQ(e){return`Your settings and recent projects were saved by a newer build than this one (v${e}). Reset to defaults to continue.`}var sQ=0,cQ=0,lQ=1,uQ=2,dQ=3,fQ=6e4;function pQ(e,t,n=()=>{},r=fQ,i={isEligible:()=>!1,onShown:()=>{}}){let a=[],o=new Set,s=`update-downloaded`;return a.push(e.onUpdateDownloaded(({version:r})=>{let i=s,a=()=>{t({id:i,body:iQ(r),priority:uQ,action:{label:KZ,onClick:()=>{t({id:i,body:ZZ,priority:uQ,dismissible:!1}),e.update.relaunchNow().then(()=>{n(i)},e=>{a(),t({id:`relaunch-error-${r}`,body:rQ(QZ,e),variant:`error`,priority:lQ})})}}})};a()})),a.push(e.onUpdateRelaunching(()=>{t({id:s,body:ZZ,priority:uQ,dismissible:!1})})),a.push(e.onUpdateRelaunchFailed(({version:r,message:i,downloadUrl:a})=>{if(a){let i=`install-failed-${r}`,o=()=>{t({id:i,body:$Z(r),variant:`error`,priority:lQ,action:{label:eQ,onClick:()=>{e.update.relaunchNow().then(()=>{n(i)},e=>{console.warn(`[update-notice] install-failed retry rejected`,e),o()})}},secondaryAction:{label:tQ,onClick:()=>{e.shell.openExternal(a)}}})};o();return}t({id:`relaunch-error-${r}`,body:i?`${QZ}: ${i}`:QZ,variant:`error`,priority:lQ})})),a.push(e.onWhatsNew(({version:a,releaseUrl:s})=>{if(i.isEligible(a)){i.onShown(a),t({id:`whats-new-combined-${a}`,body:aQ(a),variant:`success`,priority:dQ,combinedSubscribe:!0,whatsNew:{version:a,releaseUrl:s},action:{label:qZ,onClick:()=>{e.shell.openExternal(s)}}}),e.update.dismissWhatsNew(a);return}let c=`whats-new-${a}`;t({id:c,body:aQ(a),variant:`success`,priority:dQ,action:{label:qZ,onClick:()=>{e.shell.openExternal(s)}},onDismiss:()=>{e.update.dismissWhatsNew(a)}});let l=setTimeout(()=>{o.delete(l),n(c),e.update.dismissWhatsNew(a)},r);o.add(l)})),a.push(e.onWhatsNewDismissed(({version:e})=>{n(`whats-new-${e}`)})),a.push(e.onUpdateStuckHint(({downloadUrl:n})=>{t({id:`update-stuck-hint`,body:JZ,priority:cQ,action:{label:YZ,onClick:()=>{e.shell.openExternal(n)}}})})),()=>{for(let e of a)e();for(let e of o)clearTimeout(e);o.clear()}}function mQ(e,t,n,r=()=>{}){let i=`schema-incompatibility-${t.persistedSchemaVersion}`,a=`schema-incompatibility-error-${t.persistedSchemaVersion}`,o=e=>{r(i),n({id:a,body:rQ(nQ,e),variant:`error`,priority:sQ})};n({id:i,body:oQ(t.currentBuild),priority:sQ,action:{label:XZ,onClick:()=>{e.state.resetIncompatible().then(()=>{r(i)},o)}}})}var hQ=[],gQ=new Set,_Q=!1;function vQ(){for(let e of gQ)e()}function yQ(e){let t=hQ.findIndex(t=>t.id===e.id);if(t===-1)hQ=[...hQ,e];else{let n=hQ.slice();n[t]=e,hQ=n}vQ()}function bQ(e){let t=hQ.filter(t=>t.id!==e);t.length!==hQ.length&&(hQ=t,vQ())}function xQ(){return hQ}function SQ(e){return gQ.add(e),()=>{gQ.delete(e)}}function CQ(){if(_Q||typeof window>`u`)return;let e=window.okDesktop;e&&(_Q=!0,pQ(e,yQ,bQ,void 0,{isEligible:e=>SI(kI.getSnapshot(),e),onShown:e=>kI.recordShown(e)}),e.state.query().then(t=>{t.schemaIncompatibility&&mQ(e,t.schemaIncompatibility,yQ,bQ)},e=>{console.warn(`[update-notices-store] bridge.state.query() failed`,e)}))}var wQ=6e4,TQ=e=>{let t=(0,$.c)(11),{href:n,label:r,icon:i}=e,a,o;t[0]===n?(a=t[1],o=t[2]):(a=e=>Wu(e,n),o=e=>Wu(e,n),t[0]=n,t[1]=a,t[2]=o);let s;t[3]===i?s=t[4]:(s=(0,Z.jsx)(i,{"aria-hidden":`true`,className:`size-3.5`}),t[3]=i,t[4]=s);let c;return t[5]!==n||t[6]!==r||t[7]!==a||t[8]!==o||t[9]!==s?(c=(0,Z.jsx)(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,onClick:a,onAuxClick:o,"aria-label":r,className:`rounded-md p-1 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,children:s}),t[5]=n,t[6]=r,t[7]=a,t[8]=o,t[9]=s,t[10]=c):c=t[10],c};function EQ(e){let t=(0,$.c)(34),{version:n,onOpenReleaseNotes:r,onClose:i,store:a,autoDismissMs:o}=e,s=a===void 0?kI:a,c=o===void 0?wQ:o,{_:l}=vt(),[u,d]=(0,Q.useState)(!1),f,p;t[0]!==c||t[1]!==i||t[2]!==u?(f=()=>{if(!u)return;let e=setTimeout(i,c);return()=>clearTimeout(e)},p=[u,i,c],t[0]=c,t[1]=i,t[2]=u,t[3]=f,t[4]=p):(f=t[3],p=t[4]),(0,Q.useEffect)(f,p);let m;t[5]===l?m=t[6]:(m=l({id:`GzPQ2f`}),t[5]=l,t[6]=m);let h;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(J,{id:`yLEyuq`}),t[7]=h):h=t[7];let g;t[8]===s?g=t[9]:(g=()=>{s.markSubscribed(),d(!0)},t[8]=s,t[9]=g);let _;t[10]!==i||t[11]!==s?(_=()=>{s.dismiss(),i()},t[10]=i,t[11]=s,t[12]=_):_=t[12];let v;t[13]!==g||t[14]!==_?(v=(0,Z.jsx)(gI,{source:`post_update_card`,compactSubmit:!0,description:h,onSuccess:g,onDismiss:_}),t[13]=g,t[14]=_,t[15]=v):v=t[15];let y;t[16]!==l||t[17]!==u?(y=u?null:(0,Z.jsxs)(`nav`,{"aria-label":l({id:`dbapvC`}),className:`mt-3 flex items-center gap-1.5 text-muted-foreground text-xs`,children:[(0,Z.jsx)(`span`,{className:`mr-0.5`,children:(0,Z.jsx)(J,{id:`9sBe85`})}),(0,Z.jsx)(TQ,{href:yI,label:l({id:`I7Exsw`}),icon:PI}),(0,Z.jsx)(TQ,{href:_I,label:l({id:`zyKa-I`}),icon:pg}),(0,Z.jsx)(TQ,{href:vI,label:l({id:`36aWJD`}),icon:NI})]}),t[16]=l,t[17]=u,t[18]=y):y=t[18];let b;t[19]!==y||t[20]!==v?(b=(0,Z.jsxs)(`div`,{className:`px-3 py-2.5`,children:[v,y]}),t[19]=y,t[20]=v,t[21]=b):b=t[21];let x;t[22]===n?x=t[23]:(x=(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(J,{id:`hLy8b1`,values:{version:n}})}),t[22]=n,t[23]=x);let S;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(J,{id:`_PACVa`}),t[24]=S):S=t[24];let C;t[25]===r?C=t[26]:(C=(0,Z.jsx)(Y,{variant:`link`,size:`sm`,className:`h-auto p-0 text-muted-foreground text-xs hover:text-foreground`,onClick:r,children:S}),t[25]=r,t[26]=C);let w;t[27]!==x||t[28]!==C?(w=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between border-t bg-muted/30 px-3 py-2.5 space-x-2`,children:[x,C]}),t[27]=x,t[28]=C,t[29]=w):w=t[29];let T;return t[30]!==b||t[31]!==w||t[32]!==m?(T=(0,Z.jsxs)(`section`,{"aria-label":m,className:`mx-1 mb-1 overflow-hidden rounded-lg border bg-card text-card-foreground`,children:[b,w]}),t[30]=b,t[31]=w,t[32]=m,t[33]=T):T=t[33],T}function DQ(e){let t=(0,$.c)(37),{notice:n,onDismiss:r}=e,{_:i}=vt(),a=n.variant===`error`?`border-destructive/60 bg-sidebar-accent/30 text-muted-foreground`:n.variant===`success`?`border-emerald-500/40 bg-emerald-500/10 text-emerald-600 dark:text-emerald-400`:`border-sidebar-border bg-sidebar-accent/30 text-muted-foreground`,o;t[0]!==i||t[1]!==n.dismissible||t[2]!==r?(o=n.dismissible===!1?null:(0,Z.jsx)(Y,{variant:`ghost`,size:`icon`,className:`size-5 shrink-0 text-muted-foreground hover:text-sidebar-foreground`,"aria-label":i({id:`GUYwCr`}),onClick:r,children:(0,Z.jsx)(fl,{"aria-hidden":`true`,className:`size-3`})}),t[0]=i,t[1]=n.dismissible,t[2]=r,t[3]=o):o=t[3];let s=o,c=`shrink-0 text-xs font-medium underline underline-offset-2 ${n.variant===`success`?`decoration-emerald-500/40`:`decoration-muted-foreground/40`} hover:text-sidebar-foreground hover:decoration-sidebar-foreground`;if(n.secondaryAction){let e=`update-notice-${n.id}`,r=`flex flex-col gap-2 rounded-md border px-2 py-2 text-xs ${a}`,i;t[4]===n.body?i=t[5]:(i=(0,Z.jsx)(`span`,{className:`flex-1 leading-snug`,children:n.body}),t[4]=n.body,t[5]=i);let o;t[6]!==s||t[7]!==i?(o=(0,Z.jsxs)(`div`,{className:`flex items-start gap-2`,children:[i,s]}),t[6]=s,t[7]=i,t[8]=o):o=t[8];let l;t[9]!==c||t[10]!==n.action?(l=n.action?(0,Z.jsx)(`button`,{type:`button`,className:c,onClick:()=>{n.action?.onClick()},children:n.action.label}):null,t[9]=c,t[10]=n.action,t[11]=l):l=t[11];let u;t[12]===n.secondaryAction?u=t[13]:(u=()=>{n.secondaryAction?.onClick()},t[12]=n.secondaryAction,t[13]=u);let d;t[14]!==c||t[15]!==n.secondaryAction.label||t[16]!==u?(d=(0,Z.jsx)(`button`,{type:`button`,className:c,onClick:u,children:n.secondaryAction.label}),t[14]=c,t[15]=n.secondaryAction.label,t[16]=u,t[17]=d):d=t[17];let f;t[18]!==l||t[19]!==d?(f=(0,Z.jsxs)(`div`,{className:`flex gap-3 pl-1`,children:[l,d]}),t[18]=l,t[19]=d,t[20]=f):f=t[20];let p;return t[21]!==e||t[22]!==r||t[23]!==o||t[24]!==f?(p=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":e,className:r,children:[o,f]}),t[21]=e,t[22]=r,t[23]=o,t[24]=f,t[25]=p):p=t[25],p}let l=`update-notice-${n.id}`,u=`flex items-center gap-2 rounded-md border px-2 py-1.5 text-xs ${a}`,d;t[26]===n.body?d=t[27]:(d=(0,Z.jsx)(`span`,{className:`flex-1 leading-snug`,children:n.body}),t[26]=n.body,t[27]=d);let f;t[28]!==c||t[29]!==n.action?(f=n.action?(0,Z.jsx)(`button`,{type:`button`,className:c,onClick:()=>{n.action?.onClick()},children:n.action.label}):null,t[28]=c,t[29]=n.action,t[30]=f):f=t[30];let p;return t[31]!==s||t[32]!==l||t[33]!==u||t[34]!==d||t[35]!==f?(p=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":l,className:u,children:[d,f,s]}),t[31]=s,t[32]=l,t[33]=u,t[34]=d,t[35]=f,t[36]=p):p=t[36],p}function OQ(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 kQ(){let e=(0,$.c)(15),t=(0,Q.useSyncExternalStore)(SQ,xQ,xQ),n;e[0]===t?n=e[1]:(n=OQ(t),e[0]=t,e[1]=n);let r=n;if(!r)return null;if(r.combinedSubscribe&&r.whatsNew){let t;e[2]===r.action?t=e[3]:(t=()=>r.action?.onClick(),e[2]=r.action,e[3]=t);let n;e[4]===r.id?n=e[5]:(n=()=>bQ(r.id),e[4]=r.id,e[5]=n);let i;return e[6]!==r.whatsNew.version||e[7]!==t||e[8]!==n?(i=(0,Z.jsx)(`div`,{"data-testid":`update-notices-list`,children:(0,Z.jsx)(EQ,{version:r.whatsNew.version,onOpenReleaseNotes:t,onClose:n})}),e[6]=r.whatsNew.version,e[7]=t,e[8]=n,e[9]=i):i=e[9],i}let i;e[10]===r?i=e[11]:(i=()=>{r.onDismiss?.(),bQ(r.id)},e[10]=r,e[11]=i);let a;return e[12]!==r||e[13]!==i?(a=(0,Z.jsx)(`div`,{"data-testid":`update-notices-list`,children:(0,Z.jsx)(DQ,{notice:r,onDismiss:i})}),e[12]=r,e[13]=i,e[14]=a):a=e[14],a}function AQ(e,t){return e?.kind===`doc`||e?.kind===`folder-index`?sc(t.contentDir,dc(e.docName),t.pathSeparator):e?.kind===`folder`?sc(t.contentDir,e.folderPath,t.pathSeparator):e?.kind===`asset`?sc(t.contentDir,e.assetPath,t.pathSeparator):t.contentDir}function jQ(e){return e?.kind===`doc`||e?.kind===`folder-index`?dc(e.docName):e?.kind===`folder`?e.folderPath:e?.kind===`asset`?e.assetPath:``}function MQ(e,t){return e===null?qs({workspace:t}):e.kind===`folder`?t?Us({folderRelativePath:e.folderPath,workspace:t}):null:e.kind===`doc`||e.kind===`folder-index`?Xs({docName:e.docName,workspace:t}):null}var NQ={folderCount:0,expandedCount:0},PQ=`button, [role="button"], [role="menuitem"], input, textarea, select, a[href]`;function FQ(e){return typeof Element>`u`||!(e instanceof Element)?!1:e.closest(PQ)!==null}function IQ(e){let t=(0,$.c)(2),{onOpenSearch:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(Ql,{name:`file-sidebar`,children:(0,Z.jsx)(zQ,{onOpenSearch:n})}),t[0]=n,t[1]=r),r}var LQ=e=>{let t=(0,$.c)(15),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({icon:n,label:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=(0,Z.jsx)(n,{"aria-hidden":`true`}),t[4]=n,t[5]=a);let o;t[6]!==r||t[7]!==i||t[8]!==a?(o=(0,Z.jsx)(ln,{asChild:!0,children:(0,Z.jsx)(Y,{variant:`ghost`,size:`icon-sm`,"aria-label":r,...i,children:a})}),t[6]=r,t[7]=i,t[8]=a,t[9]=o):o=t[9];let s;t[10]===r?s=t[11]:(s=(0,Z.jsx)(un,{children:r}),t[10]=r,t[11]=s);let c;return t[12]!==o||t[13]!==s?(c=(0,Z.jsxs)(fn,{children:[o,s]}),t[12]=o,t[13]=s,t[14]=c):c=t[14],c},RQ=e=>{let t=(0,$.c)(15),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({icon:n,label:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=(0,Z.jsx)(n,{"aria-hidden":`true`}),t[4]=n,t[5]=a);let o;t[6]!==r||t[7]!==i||t[8]!==a?(o=(0,Z.jsx)(ln,{asChild:!0,children:(0,Z.jsx)(Pr,{asChild:!0,children:(0,Z.jsx)(Y,{variant:`ghost`,size:`icon-sm`,"aria-label":r,...i,children:a})})}),t[6]=r,t[7]=i,t[8]=a,t[9]=o):o=t[9];let s;t[10]===r?s=t[11]:(s=(0,Z.jsx)(un,{children:r}),t[10]=r,t[11]=s);let c;return t[12]!==o||t[13]!==s?(c=(0,Z.jsxs)(fn,{children:[o,s]}),t[12]=o,t[13]=s,t[14]=c):c=t[14],c};function zQ(e){let t=(0,$.c)(309),{onOpenSearch:n}=e,{_:r}=vt(),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(null),{activeDocName:c,activeTarget:l}=Re(),u;t[0]!==c||t[1]!==l?(u=l?.kind===`folder`||l?.kind===`folder-index`?l.folderPath:Nl(c),t[0]=c,t[1]=l,t[2]=u):u=t[2];let d=u,f;t[3]===d?f=t[4]:(f=Vl(d)?``:d,t[3]=d,t[4]=f);let p=f,[m,h]=(0,Q.useState)(!1),g=m?``:p,_=typeof window<`u`&&window.okDesktop!=null,{state:v,toggleSidebar:y}=vN(),b=lc(),x=v===`expanded`,S=_&&v===`collapsed`,[C,w]=(0,Q.useState)(NQ),T,E;t[5]===i?(T=t[6],E=t[7]):(T=()=>{if(i===null)return;let e=()=>{w(i.getFolderState()),h(i.isCreationTargetCleared())};return e(),i.subscribe(e)},E=[i],t[5]=i,t[6]=T,t[7]=E),(0,Q.useEffect)(T,E);let D,O;t[8]===i?(D=t[9],O=t[10]):(D=()=>{if(i!==null)return hC(e=>{let t=e.initialDir??``;if(e.template){i.createFromTemplate(e.template.folder,e.template.name);return}i.startCreating(`file`,t)})},O=[i],t[8]=i,t[9]=D,t[10]=O),(0,Q.useEffect)(D,O);let k=C.folderCount>0,A=k&&C.expandedCount===C.folderCount,j=C.expandedCount===0,M=Gr(``),N=Gr(g===``?null:g),P=g===``?M:N,F=M.state.status===`ready`?(M.state.data.folder.templates_available?.length??0)>0:!0,I=P.state.status===`ready`?(P.state.data.folder.templates_available?.length??0)>0:!0,L=typeof window<`u`?window.okDesktop:void 0,R=Ju(),{status:z}=ss(),B=z?.hasRemote===!0,V;t[11]!==r||t[12]!==R?.contentDir?(V=L?.config?.projectName||R?.contentDir.split(`/`).filter(Boolean).pop()||r({id:`sER-bs`}),t[11]=r,t[12]=R?.contentDir,t[13]=V):V=t[13];let H=V,U=Ks().states,{dispatch:W}=Bs(),ee;t[14]===R?ee=t[15]:(ee=qs({workspace:R}),t[14]=R,t[15]=ee);let G=ee,{projectLocalBinding:K,merged:te}=Hu(),ne=te?.appearance?.sidebar?.showHiddenFiles??!1,re=te?.appearance?.sidebar?.showOkFolders??!1,ie=te?.appearance?.sidebar?.showOnlyMarkdownFiles??!1,ae=te?.appearance?.sidebar?.showSkillsSection??!0,oe=k&&!A,se=k&&!j,ce=oe||se,le=(0,Q.useRef)(!1),ue;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(ue=e=>{le.current&&(le.current=!1,e.preventDefault())},t[16]=ue):ue=t[16];let de=ue,fe=WQ,pe;t[17]!==i||t[18]!==R?(pe=()=>{R&&(le.current=!0,i?.startCreating(`file`,``))},t[17]=i,t[18]=R,t[19]=pe):pe=t[19];let q=pe,me;t[20]!==i||t[21]!==R?(me=e=>{R&&(le.current=!0,i?.createFromTemplate(``,e))},t[20]=i,t[21]=R,t[22]=me):me=t[22];let he=me,ge;t[23]!==i||t[24]!==R?(ge=()=>{R&&(le.current=!0,i?.startCreating(`folder`,``))},t[23]=i,t[24]=R,t[25]=ge):ge=t[25];let _e=ge,ve;t[26]===R?ve=t[27]:(ve=()=>{!R||!L||L.shell.showItemInFolder(R.contentDir)},t[26]=R,t[27]=ve);let ye=ve,be;t[28]!==r||t[29]!==R?(be=async()=>{if(R)try{await navigator.clipboard.writeText(R.contentDir),X.success(r({id:`6_ZOw4`}),{description:R.contentDir})}catch(e){console.warn(`[FileSidebar] clipboard write failed:`,e),X.error(r({id:`vfRlCI`}))}},t[28]=r,t[29]=R,t[30]=be):be=t[30];let xe=be,Se;t[31]!==r||t[32]!==B?(Se=()=>{Jr({...Yr(``),hasRemote:B,onClickWhenNoRemote:()=>{X.error(r({id:`WyQxwa`}))}},{clipboardWrite:Md,toastSuccess:UQ,toastError:HQ,logEvent:VQ})},t[31]=r,t[32]=B,t[33]=Se):Se=t[33];let Ce=Se,we;t[34]!==r||t[35]!==K?(we=e=>{if(K===null)return;let t=K.patch({appearance:{sidebar:e}});t.ok||(console.warn(`[FileSidebar] sidebar visibility toggle rejected:`,Va(t.error)),X.error(r({id:`P47EWZ`}),{description:Va(t.error)}))},t[34]=r,t[35]=K,t[36]=we):we=t[36];let Te=we,Ee;t[37]===i?Ee=t[38]:(Ee=()=>{i?.expandAll()},t[37]=i,t[38]=Ee);let De=Ee,Oe;t[39]===i?Oe=t[40]:(Oe=()=>{i?.collapseAll()},t[39]=i,t[40]=Oe);let ke=Oe,Ae,je;t[41]!==se||t[42]!==oe||t[43]!==ne||t[44]!==re||t[45]!==ie||t[46]!==ae||t[47]!==v?(Ae=()=>{let e={showHiddenFiles:ne,showOkFolders:re,showOnlyMarkdownFiles:ie,showSkillsSection:ae,canExpandAll:oe,canCollapseAll:se,sidebarVisible:v===`expanded`};Ic(e),L&&L.editor.notifyViewMenuStateChanged(e)},je=[L,ne,re,ie,ae,oe,se,v],t[41]=se,t[42]=oe,t[43]=ne,t[44]=re,t[45]=ie,t[46]=ae,t[47]=v,t[48]=Ae,t[49]=je):(Ae=t[48],je=t[49]),(0,Q.useEffect)(Ae,je);let Me;t[50]!==r||t[51]!==l||t[52]!==W||t[53]!==U||t[54]!==g||t[55]!==Te||t[56]!==ne||t[57]!==re||t[58]!==ie||t[59]!==ae||t[60]!==y||t[61]!==i||t[62]!==R?(Me=()=>Gt(e=>{let t=l!==null&&Vl(jQ(l));switch(e){case`new-doc`:if(!R||!i)return;i.startCreating(`file`,g);return;case`new-folder`:if(!R||!i)return;i.startCreating(`folder`,g);return;case`new-from-template`:if(!R||!i)return;i.startCreatingFromTemplate(g);return;case`rename`:if(!l||t)return;pY(l);return;case`duplicate`:if(!l||t)return;hY(l);return;case`move-to-trash`:if(!l||t)return;dY(l);return;case`reveal-in-finder`:{if(!L||!R)return;let e=AQ(l,R);L.shell.showItemInFolder(e);return}case`send-to-ai`:{let e=Ki.filter(e=>U[e.id]?.installed===!0);if(e.length===0){X.error(r({id:`LKOLNn`}));return}let t=MQ(l,R);if(!t)return;let[n]=e;if(!n)return;W(n.id,t);return}case`copy-full-path`:{if(!R)return;let e=AQ(l,R);navigator.clipboard.writeText(e).then(()=>X.success(r({id:`6_ZOw4`}),{description:e})).catch(e=>{console.warn(`[FileSidebar] clipboard write failed:`,e),X.error(r({id:`vfRlCI`}))});return}case`copy-relative-path`:{let e=jQ(l);if(e===``){X.error(r({id:`74eHt-`}));return}navigator.clipboard.writeText(e).then(()=>X.success(r({id:`haHgQj`}),{description:e})).catch(e=>{console.warn(`[FileSidebar] clipboard write failed:`,e),X.error(r({id:`5QGTaA`}))});return}case`toggle-show-ok-folders`:Te({showOkFolders:!re});return;case`toggle-show-hidden-files`:Te({showHiddenFiles:!ne});return;case`toggle-show-only-markdown-files`:Te({showOnlyMarkdownFiles:!ie});return;case`toggle-show-skills-section`:Te({showSkillsSection:!ae});return;case`expand-all-tree`:i?.expandAll();return;case`collapse-all-tree`:i?.collapseAll();return;case`toggle-sidebar`:y();return;case`delete`:case`toggle-source`:case`save-version`:case`version-history`:case`focus-search`:case`focus-command-palette`:case`close-active-tab-or-window`:case`toggle-doc-panel`:return}}),t[50]=r,t[51]=l,t[52]=W,t[53]=U,t[54]=g,t[55]=Te,t[56]=ne,t[57]=re,t[58]=ie,t[59]=ae,t[60]=y,t[61]=i,t[62]=R,t[63]=Me):Me=t[63];let Ne;t[64]!==r||t[65]!==l||t[66]!==W||t[67]!==U||t[68]!==g||t[69]!==K||t[70]!==ne||t[71]!==re||t[72]!==ie||t[73]!==ae||t[74]!==y||t[75]!==i||t[76]!==R?(Ne=[L,i,R,l,g,K,ne,re,ie,ae,U,W,y,r],t[64]=r,t[65]=l,t[66]=W,t[67]=U,t[68]=g,t[69]=K,t[70]=ne,t[71]=re,t[72]=ie,t[73]=ae,t[74]=y,t[75]=i,t[76]=R,t[77]=Ne):Ne=t[77],(0,Q.useEffect)(Me,Ne);let Pe=_&&x&&`motion-safe:delay-100`,Fe=S&&`opacity-0`,Ie;t[78]!==Pe||t[79]!==Fe?(Ie=$t(`flex-row h-12 items-center py-0 px-3`,`justify-between`,_&&`overflow-x-clip`,_&&`motion-safe:transition-opacity motion-safe:duration-100 motion-safe:ease-out`,Pe,Fe,_&&`[-webkit-app-region:drag]`),t[78]=Pe,t[79]=Fe,t[80]=Ie):Ie=t[80];let Le;t[81]===Symbol.for(`react.memo_cache_sentinel`)?(Le=_?(0,Z.jsx)(`div`,{"aria-hidden":`true`,"data-testid":`sidebar-traffic-light-reserve`,className:`w-[var(--ok-titlebar-reserve-left,0px)] shrink-0 self-stretch`}):null,t[81]=Le):Le=t[81];let ze;t[82]===x?ze=t[83]:(ze=x&&!_?(0,Z.jsx)(`span`,{className:`shrink-0 font-mono text-sm uppercase tracking-wider text-sidebar-foreground/50`,children:(0,Z.jsx)(J,{id:`sER-bs`})}):null,t[82]=x,t[83]=ze);let Be;t[84]===Symbol.for(`react.memo_cache_sentinel`)?(Be=$t(`flex items-center gap-1`,_&&`[&>*]:[-webkit-app-region:no-drag]`),t[84]=Be):Be=t[84];let Ve;t[85]===r?Ve=t[86]:(Ve=r({id:`Rq1vFD`}),t[85]=r,t[86]=Ve);let He;t[87]===Ve?He=t[88]:(He=(0,Z.jsx)(RQ,{icon:ch,label:Ve}),t[87]=Ve,t[88]=He);let Ue;t[89]!==oe||t[90]!==i?(Ue=oe?(0,Z.jsxs)(Ar,{onSelect:()=>i?.expandAll(),children:[(0,Z.jsx)(Uh,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`OlAl5i`})]}):null,t[89]=oe,t[90]=i,t[91]=Ue):Ue=t[91];let We;t[92]!==se||t[93]!==i?(We=se?(0,Z.jsxs)(Ar,{onSelect:()=>i?.collapseAll(),children:[(0,Z.jsx)(Zm,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`qvWGzP`})]}):null,t[92]=se,t[93]=i,t[94]=We):We=t[94];let Ge;t[95]===ce?Ge=t[96]:(Ge=ce?(0,Z.jsx)(Vr,{}):null,t[95]=ce,t[96]=Ge);let Ke;t[97]===r?Ke=t[98]:(Ke=r({id:`8vETh9`}),t[97]=r,t[98]=Ke);let qe;t[99]===Symbol.for(`react.memo_cache_sentinel`)?(qe=(0,Z.jsx)(Ir,{children:(0,Z.jsx)(J,{id:`8vETh9`})}),t[99]=qe):qe=t[99];let Je;t[100]===Te?Je=t[101]:(Je=e=>Te({showHiddenFiles:e}),t[100]=Te,t[101]=Je);let Ye=K===null,Xe;t[102]===Symbol.for(`react.memo_cache_sentinel`)?(Xe=(0,Z.jsx)(J,{id:`6KCH4m`}),t[102]=Xe):Xe=t[102];let Ze;t[103]!==ne||t[104]!==Je||t[105]!==Ye?(Ze=(0,Z.jsx)(Fr,{checked:ne,onCheckedChange:Je,disabled:Ye,"data-testid":`tree-options-show-hidden-files`,children:Xe}),t[103]=ne,t[104]=Je,t[105]=Ye,t[106]=Ze):Ze=t[106];let Qe;t[107]===Te?Qe=t[108]:(Qe=e=>Te({showOkFolders:e}),t[107]=Te,t[108]=Qe);let $e=K===null,et;t[109]===Symbol.for(`react.memo_cache_sentinel`)?(et=(0,Z.jsx)(J,{id:`ELYtNJ`}),t[109]=et):et=t[109];let tt;t[110]!==re||t[111]!==Qe||t[112]!==$e?(tt=(0,Z.jsx)(Fr,{checked:re,onCheckedChange:Qe,disabled:$e,"data-testid":`tree-options-show-ok-folders`,children:et}),t[110]=re,t[111]=Qe,t[112]=$e,t[113]=tt):tt=t[113];let nt;t[114]===Te?nt=t[115]:(nt=e=>Te({showOnlyMarkdownFiles:e}),t[114]=Te,t[115]=nt);let rt=K===null,it;t[116]===Symbol.for(`react.memo_cache_sentinel`)?(it=(0,Z.jsx)(J,{id:`5-o4kO`}),t[116]=it):it=t[116];let at;t[117]!==ie||t[118]!==nt||t[119]!==rt?(at=(0,Z.jsx)(Fr,{checked:ie,onCheckedChange:nt,disabled:rt,"data-testid":`tree-options-show-only-markdown-files`,children:it}),t[117]=ie,t[118]=nt,t[119]=rt,t[120]=at):at=t[120];let ot;t[121]===Te?ot=t[122]:(ot=e=>Te({showSkillsSection:e}),t[121]=Te,t[122]=ot);let st=K===null,ct;t[123]===Symbol.for(`react.memo_cache_sentinel`)?(ct=(0,Z.jsx)(J,{id:`PCSkw2`}),t[123]=ct):ct=t[123];let lt;t[124]!==ae||t[125]!==ot||t[126]!==st?(lt=(0,Z.jsx)(Fr,{checked:ae,onCheckedChange:ot,disabled:st,"data-testid":`tree-options-show-skills`,children:ct}),t[124]=ae,t[125]=ot,t[126]=st,t[127]=lt):lt=t[127];let ut;t[128]!==Ke||t[129]!==Ze||t[130]!==tt||t[131]!==at||t[132]!==lt?(ut=(0,Z.jsxs)(Nr,{"aria-label":Ke,children:[qe,Ze,tt,at,lt]}),t[128]=Ke,t[129]=Ze,t[130]=tt,t[131]=at,t[132]=lt,t[133]=ut):ut=t[133];let dt;t[134]!==Ue||t[135]!==We||t[136]!==Ge||t[137]!==ut?(dt=(0,Z.jsxs)(Rr,{align:`end`,className:`min-w-52`,"data-testid":`tree-options-menu`,children:[Ue,We,Ge,ut]}),t[134]=Ue,t[135]=We,t[136]=Ge,t[137]=ut,t[138]=dt):dt=t[138];let ft;t[139]!==He||t[140]!==dt?(ft=(0,Z.jsxs)(Br,{children:[He,dt]}),t[139]=He,t[140]=dt,t[141]=ft):ft=t[141];let pt;t[142]===r?pt=t[143]:(pt=r({id:`HdkSiO`}),t[142]=r,t[143]=pt);let mt;t[144]!==g||t[145]!==i?(mt=()=>i?.startCreating(`file`,g),t[144]=g,t[145]=i,t[146]=mt):mt=t[146];let ht;t[147]!==pt||t[148]!==mt?(ht=(0,Z.jsx)(LQ,{icon:al,label:pt,onClick:mt}),t[147]=pt,t[148]=mt,t[149]=ht):ht=t[149];let gt;t[150]!==r||t[151]!==I||t[152]!==g||t[153]!==i?(gt=I?(0,Z.jsxs)(Br,{children:[(0,Z.jsx)(RQ,{icon:Oi,label:r({id:`Uuj_R4`})}),(0,Z.jsx)(Rr,{align:`end`,className:`min-w-52`,onCloseAutoFocus:de,children:(0,Z.jsx)(rY,{parentDir:g,onSelectTemplate:e=>{le.current=!0,i?.createFromTemplate(g,e)},ItemComponent:Ar})})]}):null,t[150]=r,t[151]=I,t[152]=g,t[153]=i,t[154]=gt):gt=t[154];let _t;t[155]===r?_t=t[156]:(_t=r({id:`96G6Re`}),t[155]=r,t[156]=_t);let yt;t[157]!==g||t[158]!==i?(yt=()=>i?.startCreating(`folder`,g),t[157]=g,t[158]=i,t[159]=yt):yt=t[159];let bt;t[160]!==_t||t[161]!==yt?(bt=(0,Z.jsx)(LQ,{icon:$m,label:_t,onClick:yt}),t[160]=_t,t[161]=yt,t[162]=bt):bt=t[162];let xt;t[163]!==ft||t[164]!==ht||t[165]!==gt||t[166]!==bt?(xt=(0,Z.jsxs)(`div`,{"data-testid":`sidebar-toolbar`,className:Be,children:[ft,ht,gt,bt]}),t[163]=ft,t[164]=ht,t[165]=gt,t[166]=bt,t[167]=xt):xt=t[167];let St;t[168]!==Ie||t[169]!==ze||t[170]!==xt?(St=(0,Z.jsxs)(EN,{"data-electron-drag":_?``:void 0,className:Ie,children:[Le,ze,xt]}),t[168]=Ie,t[169]=ze,t[170]=xt,t[171]=St):St=t[171];let Ct=_&&x&&`motion-safe:delay-100`,wt=S&&`opacity-0`,Tt;t[172]!==Ct||t[173]!==wt?(Tt=$t(`px-2 pb-2`,_&&`[-webkit-app-region:no-drag]`,_&&`motion-safe:transition-opacity motion-safe:duration-100 motion-safe:ease-out`,Ct,wt),t[172]=Ct,t[173]=wt,t[174]=Tt):Tt=t[174];let Et;t[175]===v?Et=t[176]:(Et=[v],t[175]=v,t[176]=Et);let Dt;t[177]===n?Dt=t[178]:(Dt=(0,Z.jsx)(PZ,{onClick:n}),t[177]=n,t[178]=Dt);let Ot;t[179]!==Et||t[180]!==Dt?(Ot=(0,Z.jsx)(Zt,{fallbackRender:BQ,onError:NZ,resetKeys:Et,children:Dt}),t[179]=Et,t[180]=Dt,t[181]=Ot):Ot=t[181];let kt;t[182]!==Tt||t[183]!==Ot?(kt=(0,Z.jsx)(`div`,{className:Tt,children:Ot}),t[182]=Tt,t[183]=Ot,t[184]=kt):kt=t[184];let At;t[185]===Symbol.for(`react.memo_cache_sentinel`)?(At=(0,Z.jsx)(pL,{}),t[185]=At):At=t[185];let jt;t[186]===Symbol.for(`react.memo_cache_sentinel`)?(jt=(0,Z.jsx)(gc,{className:`size-3.5 shrink-0`}),t[186]=jt):jt=t[186];let Mt;t[187]===H?Mt=t[188]:(Mt=(0,Z.jsx)(`span`,{className:`truncate`,children:H}),t[187]=H,t[188]=Mt);let Nt;t[189]===Symbol.for(`react.memo_cache_sentinel`)?(Nt=(0,Z.jsx)(As,{className:`size-3.5 shrink-0 text-muted-foreground transition-transform group-data-[state=open]/files:rotate-90`}),t[189]=Nt):Nt=t[189];let Pt;t[190]===Mt?Pt=t[191]:(Pt=(0,Z.jsx)(AN,{asChild:!0,className:`shrink-0`,children:(0,Z.jsxs)(mn,{"data-sidebar-root-context":!0,className:`flex w-full items-center gap-1.5`,children:[jt,Mt,Nt]})}),t[190]=Mt,t[191]=Pt);let Ft=o==null?`50vh`:`${o}px`,It;t[192]===Ft?It=t[193]:(It={height:Ft},t[192]=Ft,t[193]=It);let Lt;t[194]===Symbol.for(`react.memo_cache_sentinel`)?(Lt=(0,Z.jsx)(aX,{ref:a,onContentHeightChange:s}),t[194]=Lt):Lt=t[194];let Rt;t[195]===It?Rt=t[196]:(Rt=(0,Z.jsx)(pn,{className:`flex max-h-[70vh] flex-col overflow-hidden`,style:It,children:Lt}),t[195]=It,t[196]=Rt);let zt;t[197]!==Pt||t[198]!==Rt?(zt=(0,Z.jsx)(hn,{defaultOpen:!0,className:`group/files flex shrink-0 flex-col`,children:(0,Z.jsxs)(kN,{className:`min-h-0 px-0`,children:[Pt,Rt]})}),t[197]=Pt,t[198]=Rt,t[199]=zt):zt=t[199];let Bt;t[200]===ae?Bt=t[201]:(Bt=ae?(0,Z.jsx)(FZ,{}):null,t[200]=ae,t[201]=Bt);let Vt;t[202]===i?Vt=t[203]:(Vt=(0,Z.jsx)(`div`,{"aria-hidden":!0,"data-sidebar-empty-deselect":!0,className:`min-h-8 flex-1 cursor-default`,onClick:()=>i?.clearCreationTarget()}),t[202]=i,t[203]=Vt);let Ht;t[204]!==zt||t[205]!==Bt||t[206]!==Vt?(Ht=(0,Z.jsxs)(ON,{children:[At,zt,Bt,Vt]}),t[204]=zt,t[205]=Bt,t[206]=Vt,t[207]=Ht):Ht=t[207];let Ut;t[208]===Symbol.for(`react.memo_cache_sentinel`)?(Ut=(0,Z.jsxs)(DN,{className:`px-0`,children:[(0,Z.jsx)(nZ,{}),(0,Z.jsx)(kQ,{}),typeof window<`u`&&window.okDesktop?(0,Z.jsx)(NN,{children:(0,Z.jsx)(PN,{children:(0,Z.jsx)(wZ,{bridge:window.okDesktop})})}):null]}),t[208]=Ut):Ut=t[208];let Wt=!(b&&v===`collapsed`),Kt;t[209]===Wt?Kt=t[210]:(Kt=(0,Z.jsx)(wN,{enableToggle:!1,enableDrag:Wt}),t[209]=Wt,t[210]=Kt);let qt;t[211]!==St||t[212]!==kt||t[213]!==Ht||t[214]!==Kt?(qt=(0,Z.jsx)(LF,{asChild:!0,children:(0,Z.jsxs)(`div`,{className:`contents`,onContextMenu:fe,children:[St,kt,Ht,Ut,Kt]})}),t[211]=St,t[212]=kt,t[213]=Ht,t[214]=Kt,t[215]=qt):qt=t[215];let Jt=!R,Yt,Xt;t[216]===Symbol.for(`react.memo_cache_sentinel`)?(Yt=(0,Z.jsx)(al,{"aria-hidden":`true`}),Xt=(0,Z.jsx)(J,{id:`HdkSiO`}),t[216]=Yt,t[217]=Xt):(Yt=t[216],Xt=t[217]);let Qt;t[218]!==q||t[219]!==Jt?(Qt=(0,Z.jsxs)(VF,{disabled:Jt,onSelect:q,"data-testid":`empty-space-menu-new-file`,children:[Yt,Xt]}),t[218]=q,t[219]=Jt,t[220]=Qt):Qt=t[220];let en;t[221]!==he||t[222]!==F||t[223]!==R?(en=F?(0,Z.jsxs)(zF,{children:[(0,Z.jsxs)(HF,{disabled:!R,"data-testid":`empty-space-menu-new-from-template`,children:[(0,Z.jsx)(Oi,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`Uuj_R4`})]}),(0,Z.jsx)(UF,{children:(0,Z.jsx)(rY,{parentDir:``,onSelectTemplate:he,ItemComponent:VF})})]}):null,t[221]=he,t[222]=F,t[223]=R,t[224]=en):en=t[224];let tn=!R,nn,Y;t[225]===Symbol.for(`react.memo_cache_sentinel`)?(nn=(0,Z.jsx)($m,{"aria-hidden":`true`}),Y=(0,Z.jsx)(J,{id:`96G6Re`}),t[225]=nn,t[226]=Y):(nn=t[225],Y=t[226]);let rn;t[227]!==_e||t[228]!==tn?(rn=(0,Z.jsxs)(VF,{disabled:tn,onSelect:_e,"data-testid":`empty-space-menu-new-folder`,children:[nn,Y]}),t[227]=_e,t[228]=tn,t[229]=rn):rn=t[229];let an;t[230]===Symbol.for(`react.memo_cache_sentinel`)?(an=(0,Z.jsx)(KF,{}),t[230]=an):an=t[230];let on;t[231]!==r||t[232]!==ye||t[233]!==R?(on=L?(0,Z.jsxs)(VF,{disabled:!R,onSelect:ye,"data-testid":`empty-space-menu-reveal-in-finder`,"aria-label":r(R?{id:`LtSYdi`}:{id:`o2yoFu`}),children:[(0,Z.jsx)(gc,{"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(J,{id:`LtSYdi`})}),R?null:(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(J,{id:`wTcjov`})})]}):null,t[231]=r,t[232]=ye,t[233]=R,t[234]=on):on=t[234];let sn;t[235]!==W||t[236]!==G||t[237]!==U?(sn=(0,Z.jsx)(WX,{input:G,installStates:U,dispatch:W}),t[235]=W,t[236]=G,t[237]=U,t[238]=sn):sn=t[238];let cn;t[239]!==Ce||t[240]!==B?(cn=B?(0,Z.jsxs)(VF,{onSelect:Ce,"data-testid":`empty-space-menu-share`,children:[(0,Z.jsx)(Eh,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`Z8lGw6`})]}):null,t[239]=Ce,t[240]=B,t[241]=cn):cn=t[241];let ln=!R,un;t[242]!==r||t[243]!==R?(un=r(R?{id:`Up2_7p`}:{id:`U8CD-l`}),t[242]=r,t[243]=R,t[244]=un):un=t[244];let dn;t[245]===Symbol.for(`react.memo_cache_sentinel`)?(dn=(0,Z.jsx)(pc,{"aria-hidden":`true`}),t[245]=dn):dn=t[245];let fn;t[246]===Symbol.for(`react.memo_cache_sentinel`)?(fn=(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(J,{id:`Up2_7p`})}),t[246]=fn):fn=t[246];let gn;t[247]===R?gn=t[248]:(gn=R?null:(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(J,{id:`wTcjov`})}),t[247]=R,t[248]=gn);let _n;t[249]!==xe||t[250]!==ln||t[251]!==un||t[252]!==gn?(_n=(0,Z.jsxs)(VF,{disabled:ln,onSelect:xe,"data-testid":`empty-space-menu-copy-full-path`,"aria-label":un,children:[dn,fn,gn]}),t[249]=xe,t[250]=ln,t[251]=un,t[252]=gn,t[253]=_n):_n=t[253];let vn;t[254]===Symbol.for(`react.memo_cache_sentinel`)?(vn=(0,Z.jsx)(KF,{}),t[254]=vn):vn=t[254];let yn;t[255]===Te?yn=t[256]:(yn=e=>Te({showHiddenFiles:e}),t[255]=Te,t[256]=yn);let bn=K===null,xn;t[257]===Symbol.for(`react.memo_cache_sentinel`)?(xn=(0,Z.jsx)(J,{id:`XcGbim`}),t[257]=xn):xn=t[257];let Sn;t[258]!==ne||t[259]!==yn||t[260]!==bn?(Sn=(0,Z.jsx)(WF,{checked:ne,onCheckedChange:yn,disabled:bn,"data-testid":`empty-space-menu-show-hidden-files`,children:xn}),t[258]=ne,t[259]=yn,t[260]=bn,t[261]=Sn):Sn=t[261];let Cn;t[262]===Te?Cn=t[263]:(Cn=e=>Te({showOkFolders:e}),t[262]=Te,t[263]=Cn);let wn=K===null,Tn;t[264]===Symbol.for(`react.memo_cache_sentinel`)?(Tn=(0,Z.jsx)(J,{id:`GHsJb8`}),t[264]=Tn):Tn=t[264];let En;t[265]!==re||t[266]!==Cn||t[267]!==wn?(En=(0,Z.jsx)(WF,{checked:re,onCheckedChange:Cn,disabled:wn,"data-testid":`empty-space-menu-show-ok-folders`,children:Tn}),t[265]=re,t[266]=Cn,t[267]=wn,t[268]=En):En=t[268];let Dn;t[269]===Te?Dn=t[270]:(Dn=e=>Te({showOnlyMarkdownFiles:e}),t[269]=Te,t[270]=Dn);let On=K===null,kn;t[271]===Symbol.for(`react.memo_cache_sentinel`)?(kn=(0,Z.jsx)(J,{id:`WkTLN7`}),t[271]=kn):kn=t[271];let An;t[272]!==ie||t[273]!==Dn||t[274]!==On?(An=(0,Z.jsx)(WF,{checked:ie,onCheckedChange:Dn,disabled:On,"data-testid":`empty-space-menu-show-only-markdown-files`,children:kn}),t[272]=ie,t[273]=Dn,t[274]=On,t[275]=An):An=t[275];let jn;t[276]===Te?jn=t[277]:(jn=e=>Te({showSkillsSection:e}),t[276]=Te,t[277]=jn);let Mn=K===null,Nn;t[278]===Symbol.for(`react.memo_cache_sentinel`)?(Nn=(0,Z.jsx)(J,{id:`NF_Wcg`}),t[278]=Nn):Nn=t[278];let Pn;t[279]!==ae||t[280]!==jn||t[281]!==Mn?(Pn=(0,Z.jsx)(WF,{checked:ae,onCheckedChange:jn,disabled:Mn,"data-testid":`empty-space-menu-show-skills-section`,children:Nn}),t[279]=ae,t[280]=jn,t[281]=Mn,t[282]=Pn):Pn=t[282];let Fn;t[283]===ce?Fn=t[284]:(Fn=ce?(0,Z.jsx)(KF,{}):null,t[283]=ce,t[284]=Fn);let In;t[285]!==De||t[286]!==oe?(In=oe?(0,Z.jsxs)(VF,{onSelect:De,"data-testid":`empty-space-menu-expand-all`,children:[(0,Z.jsx)(Uh,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`OlAl5i`})]}):null,t[285]=De,t[286]=oe,t[287]=In):In=t[287];let Ln;t[288]!==ke||t[289]!==se?(Ln=se?(0,Z.jsxs)(VF,{onSelect:ke,"data-testid":`empty-space-menu-collapse-all`,children:[(0,Z.jsx)(Zm,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`qvWGzP`})]}):null,t[288]=ke,t[289]=se,t[290]=Ln):Ln=t[290];let Rn;t[291]!==cn||t[292]!==_n||t[293]!==Sn||t[294]!==En||t[295]!==An||t[296]!==Pn||t[297]!==Fn||t[298]!==In||t[299]!==Ln||t[300]!==Qt||t[301]!==en||t[302]!==rn||t[303]!==on||t[304]!==sn?(Rn=(0,Z.jsxs)(BF,{className:`min-w-52`,onCloseAutoFocus:de,children:[Qt,en,rn,an,on,sn,cn,_n,vn,Sn,En,An,Pn,Fn,In,Ln]}),t[291]=cn,t[292]=_n,t[293]=Sn,t[294]=En,t[295]=An,t[296]=Pn,t[297]=Fn,t[298]=In,t[299]=Ln,t[300]=Qt,t[301]=en,t[302]=rn,t[303]=on,t[304]=sn,t[305]=Rn):Rn=t[305];let zn;return t[306]!==Rn||t[307]!==qt?(zn=(0,Z.jsx)(SN,{variant:`inset`,children:(0,Z.jsxs)(IF,{children:[qt,Rn]})}),t[306]=Rn,t[307]=qt,t[308]=zn):zn=t[308],zn}function BQ(){return null}function VQ(e){return console.log(e)}function HQ(e){return X.error(e)}function UQ(e){return X.success(e)}function WQ(e){e.target instanceof Element&&e.target.closest(`[data-sidebar-root-context]`)||FQ(e.target)&&(e.preventDefault(),e.stopPropagation())}var GQ=(0,Q.lazy)(()=>n(()=>import(`./McpConsentDialogBody-B0VkhB1e.js`),__vite__mapDeps([149,1,6,2,3,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,107,28,50,87,90,35,150]),import.meta.url));function KQ(){let e=(0,$.c)(1);if(!(0,Q.useSyncExternalStore)(kf.subscribe,JQ,qQ))return null;let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(GQ,{})}),e[0]=t):t=e[0],t}function qQ(){return!1}function JQ(){return kf.getSnapshot()!==null}function YQ(){let e=(0,$.c)(4),[t,n]=(0,Q.useState)(!1),r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>Gt(e=>{e===`report-bug`&&n(!0)}),i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,Q.useEffect)(r,i);let a;return e[2]===t?a=e[3]:(a=(0,Z.jsx)(Cp,{open:t,onOpenChange:n}),e[2]=t,e[3]=a),a}function XQ(){let e=(0,$.c)(17),t=Nt(),{collabUrl:n,setSystemProvider:r,updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c}=Re(),l;e[0]!==o||e[1]!==s||e[2]!==a||e[3]!==c||e[4]!==i?(l={updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c},e[0]=o,e[1]=s,e[2]=a,e[3]=c,e[4]=i,e[5]=l):l=e[5];let u=(0,Q.useRef)(l),d;e[6]!==o||e[7]!==s||e[8]!==a||e[9]!==c||e[10]!==i?(d=()=>{u.current={updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c}},e[6]=o,e[7]=s,e[8]=a,e[9]=c,e[10]=i,e[11]=d):d=e[11],(0,Q.useEffect)(d);let f,p;return e[12]!==n||e[13]!==t||e[14]!==r?(f=()=>{if(n===null)return;let e=new pu,i=new mu({url:n,name:fa,document:e,onStateless:e=>{let{payload:t}=e;vu(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:n$,onConfigValidationRejected:t$,onConfigIgnoreNestedError:e$,onUnknown:$Q})},onClose:QQ,onDisconnect:ZQ}),a=ql(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=ke(()=>{u.current.refreshServerInfo()});i.on(`synced`,()=>{Kl([`files`,`backlinks`,`graph`]),o()});let s=new Set,c=()=>{if(i.awareness)for(let[e,t]of i.awareness.getStates().entries())s.has(e)||t.user?.type===`agent`&&(s.add(e),console.warn(`[agent-presence] observed stale AwarenessUser.type === 'agent' from clientID ${e} — probably a stale bundled client`))};return i.awareness?.on(`change`,c),r(i),()=>{a(),i.awareness?.off(`change`,c),r(null),i.destroy(),e.destroy()}},p=[t,n,r],e[12]=n,e[13]=t,e[14]=r,e[15]=f,e[16]=p):(f=e[15],p=e[16]),(0,Q.useEffect)(f,p),null}function ZQ(){console.warn(`[CC1] __system__ disconnected - derived views may be stale`)}function QQ(e){let{event:t}=e;console.warn(`[CC1] __system__ connection closed:`,t.code,t.reason)}function $Q(e){console.warn(`[CC1] Unparseable stateless payload, skipping:`,e.slice(0,100))}function e$(e){gi(e)}function t$(e){Ti(e)}function n$(e){Kl([e.ch])}function r$(e){let t=ce(e);if(t)return{scope:`project`,name:t};let n=Oa(e);return n?.kind===`skill`?{scope:n.scope,name:n.name}:null}function i$(e,t){let n=new Set(t.map(e=>`${e.scope}\u0000${e.name}`)),r=[];for(let t of e){let e=r$(t);if(!e||n.has(`${e.scope}\u0000${e.name}`))continue;let i=e.scope===`project`?`global`:`project`;n.has(`${i}\u0000${e.name}`)?r.push({kind:`retarget`,fromDocName:t,toDocName:No(i,e.name)}):r.push({kind:`close`,docName:t})}return r}function a$(){let e=(0,$.c)(13),{openTabs:t,closeDocument:n}=Re(),r;e[0]===t?r=e[1]:(r=t.some(s$),e[0]=t,e[1]=r);let i=r,a;e[2]===i?a=e[3]:(a={enabled:i},e[2]=i,e[3]=a);let o=Gs(a),s=(0,Q.useRef)(null),c;e[4]!==n||e[5]!==t||e[6]!==o.data||e[7]!==o.status?(c=()=>{if(o.status!==`ready`)return;let e=o.data,r=`${t.join(``)}\u0002${e.map(o$).sort().join(``)}`;if(s.current===r)return;s.current=r;let i=i$(t,e);for(let e of i)e.kind===`retarget`?(yc(e.toDocName),n(e.fromDocName)):n(e.docName)},e[4]=n,e[5]=t,e[6]=o.data,e[7]=o.status,e[8]=c):c=e[8];let l;e[9]!==n||e[10]!==t||e[11]!==o?(l=[o,t,n],e[9]=n,e[10]=t,e[11]=o,e[12]=l):l=e[12],(0,Q.useEffect)(c,l)}function o$(e){return`${e.scope}\u0000${e.name}`}function s$(e){return r$(e)!==null}var c$=1e3,l$=3e4;function u$(e){let t=e.scheduler??{setTimeout:(e,t)=>globalThis.setTimeout(e,t),clearTimeout:e=>globalThis.clearTimeout(e)},n=e.initialBackoffMs??c$,r=e.maxBackoffMs??l$,i=e.rng??Math.random,a=e.createWebSocket??(e=>new WebSocket(e)),o=e.logger??null,s=e.log,c=null,l=null,u=!1,d=n;function f(e,t,n){try{o?o[e](t,n):s?.(t)}catch{}}function p(){if(u)return;l!==null&&t.clearTimeout(l);let e=d;d=Math.min(d*2,r);let n=i(),a=Math.max(1,Math.floor(e*(1-n/2)));f(`debug`,`scheduling reconnect`,{backoffMs:a,ceilMs:e}),l=t.setTimeout(()=>{l=null,m().catch(e=>f(`warn`,`reconnect failed`,{error:String(e)}))},a)}async function m(){if(u)return;let t;try{t=await e.resolveWsUrl()}catch(e){f(`warn`,`resolveWsUrl threw`,{error:String(e)}),p();return}if(!t){p();return}let r=[];e.pid!==void 0&&r.push(`pid=${encodeURIComponent(String(e.pid))}`),e.connectionId&&r.push(`connectionId=${encodeURIComponent(e.connectionId)}`),e.connectionId&&e.displayName!==void 0&&e.clientName!==void 0&&e.colorSeed!==void 0&&(r.push(`displayName=${encodeURIComponent(e.displayName)}`),r.push(`clientName=${encodeURIComponent(e.clientName)}`),r.push(`colorSeed=${encodeURIComponent(e.colorSeed)}`));let i=r.length>0?`?${r.join(`&`)}`:``,o=`${t}/collab/keepalive${i}`;try{c=a(o)}catch(e){f(`warn`,`WebSocket constructor failed`,{url:o,error:String(e)}),c=null,p();return}c.addEventListener(`open`,()=>{f(`info`,`connected`,{url:t}),d=n}),c.addEventListener(`close`,()=>{u||(f(`info`,`disconnected`,{url:t}),c=null,p())}),c.addEventListener(`error`,()=>{f(`debug`,`websocket error observed`,{url:t,readyState:c?.readyState,reason:`error-event`})})}return queueMicrotask(()=>{m().catch(e=>f(`warn`,`initial connect failed`,{error:String(e)}))}),{close:()=>{if(!u&&(u=!0,l!==null&&(t.clearTimeout(l),l=null),c)){try{c.close()}catch{}c=null}},isConnected:()=>c!==null&&c.readyState===1}}function d$(e){if(e)return e.replace(/\/collab\/?$/,``)}function f$(){return yu(window)!==null}function p$(e,t){let n=(0,$.c)(5),r=(0,Q.useRef)(e),i=(0,Q.useRef)(t),a,o;n[0]===e?(a=n[1],o=n[2]):(a=()=>{r.current=e},o=[e],n[0]=e,n[1]=a,n[2]=o),(0,Q.useEffect)(a,o);let s,c;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{let e=i.current?.startKeepalive??u$;if((i.current?.isElectronHost??f$)())return;let t=e({resolveWsUrl:async()=>d$(r.current)});return()=>t.close()},c=[],n[3]=s,n[4]=c):(s=n[3],c=n[4]),(0,Q.useEffect)(s,c)}var m$=(0,Q.lazy)(()=>n(()=>import(`./ShareBranchSwitchDialog-GXTPAgND.js`).then(e=>({default:e.ShareBranchSwitchDialog})),__vite__mapDeps([151,1,10,11,12,23,16,17,18,19,24,25,22,26,82,30,152,90,153,154,155,6,2,3,7,8,9,156]),import.meta.url)),h$=(0,Q.lazy)(()=>n(()=>import(`./ShareReceiveMissDialog-CHR2clGS.js`).then(e=>({default:e.ShareReceiveMissDialog})),__vite__mapDeps([157,1,23,10,11,12,16,17,18,19,24,25,22,26,158,110,6,2,3,7,8,9,73,58,74,75,76,86,90,54,50,21,77,87,30,152,113,31,35,53]),import.meta.url)),g$=`#install-claude-desktop`,_$=/\.(md|mdx)$/i;function v$(e){return Bi(e)||e===g$}function y$(e,t){if(!_$.test(e))return null;for(let n of t){let t=rt(n);if(t.kind===`doc`&&t.docName===e)return{kind:`doc`,target:e,docName:e}}return null}function b$(e,t,n,r){return[e,t,n,r].map(e=>[...e].sort().join(`\0`)).join(``)}function x$(){let e=(0,$.c)(26),{clearTarget:t,openTabs:n,syncOpenTabsWithKnownTargets:r,tabSessionLoaded:i}=Re(),{openTargetTransition:a}=Ye();a$();let{assetPaths:o,filePaths:s,folderPaths:c,loading:l,pageMeta:u,pages:d,pagesBySlug:f,pagesByBasename:p}=Ns(),m=(0,Q.useRef)(null),h;e[0]!==o||e[1]!==s||e[2]!==c||e[3]!==d?(h=b$(d,c,o,s),e[0]=o,e[1]=s,e[2]=c,e[3]=d,e[4]=h):h=e[4];let g=h,_,v;e[5]!==o||e[6]!==s||e[7]!==c||e[8]!==l||e[9]!==d||e[10]!==r||e[11]!==i||e[12]!==g?(_=()=>{l||!i||m.current===g||(m.current=g,r({pages:d,folderPaths:c,assetPaths:o,filePaths:s}))},v=[o,s,c,l,d,r,i,g],e[5]=o,e[6]=s,e[7]=c,e[8]=l,e[9]=d,e[10]=r,e[11]=i,e[12]=g,e[13]=_,e[14]=v):(_=e[13],v=e[14]),(0,Q.useEffect)(_,v);let y,b;return e[15]!==t||e[16]!==c||e[17]!==l||e[18]!==n||e[19]!==a||e[20]!==u||e[21]!==d||e[22]!==p||e[23]!==f?(y=()=>{e();function e(){if(v$(window.location.hash))return;let e=ou(window.location.hash);if(e){let t=Ga(e.split(`.`).pop()??``);Zl(`ok/nav/hash-change`,{docName:null,kind:`asset`}),a({kind:`asset`,target:e,assetPath:e,mediaKind:t});return}let r=ru(window.location.hash);if(r){Zl(`ok/nav/hash-change`,{docName:null,kind:`skill-file`}),a({kind:`skill-file`,target:`${r.scope}/${r.name}/${r.path}`,scope:r.scope,name:r.name,path:r.path});return}if(du(window.location.hash)){Zl(`ok/nav/hash-change`,{docName:null,kind:`folder`}),a({kind:`folder`,target:``,folderPath:``});return}let i=cu(window.location.hash);if(!i){Zl(`ok/nav/hash-change`,{docName:null,kind:`clear`}),t();return}if(l){Zl(`ok/nav/hash-change`,{docName:i,kind:`deferred-loading`});return}let o=y$(i,n)??Rl(i,{pages:d,folderPaths:c,pagesBySlug:f,pagesByBasename:p});if(o.kind===`missing`&&/\/+$/.test(i.trim())){Zl(`ok/nav/hash-change`,{docName:i,kind:`deferred-missing-folder`});return}let s=Bl(zl(o),u);Zl(`ok/nav/hash-change`,{docName:i,kind:s.kind}),a(s)}return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},b=[t,c,l,a,n,u,d,f,p],e[15]=t,e[16]=c,e[17]=l,e[18]=n,e[19]=a,e[20]=u,e[21]=d,e[22]=p,e[23]=f,e[24]=y,e[25]=b):(y=e[24],b=e[25]),(0,Q.useEffect)(y,b),null}function S$(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0],(0,Q.useEffect)(C$,t),null}function C$(){let e=function(e){let t=e.target;$i({target:t,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,key:e.key})&&(e.preventDefault(),window.location.hash!==`#settings`&&(window.location.hash=Gi))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)}function w$(){let e=(0,$.c)(4),{activeTarget:t}=Re(),n=typeof window<`u`?window.okDesktop??null:null,r=t?.kind===`doc`||t?.kind===`folder`||t?.kind===`asset`?t.kind:null,i=t?.kind===`doc`?t.docName:t?.kind===`folder`?t.folderPath:t?.kind===`asset`?t.assetPath:null,a,o;return e[0]!==i||e[1]!==r?(a=()=>{if(n){if(r===null){n.editor.notifyActiveTargetChanged({kind:null});return}i!==null&&n.editor.notifyActiveTargetChanged({kind:r,identifier:i})}},o=[n,r,i],e[0]=i,e[1]=r,e[2]=a,e[3]=o):(a=e[2],o=e[3]),(0,Q.useEffect)(a,o),null}function T$(){let e=(0,$.c)(8),{activeDocName:t,activeTarget:n}=Re(),[r,i]=(0,Q.useState)(!1),a;e[0]!==t||e[1]!==n?(a=n?.kind===`folder`?n.folderPath:Nl(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;p_({target:t,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,key:e.key})&&(e.preventDefault(),i(!0))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},c=[],e[3]=s,e[4]=c):(s=e[3],c=e[4]),(0,Q.useEffect)(s,c);let l;return e[5]!==r||e[6]!==o?(l=(0,Z.jsx)(h_,{open:r,onOpenChange:i,kind:`file`,initialDir:o}),e[5]=r,e[6]=o,e[7]=l):l=e[7],l}function E$(e){let t=(0,$.c)(3),{children:n}=e,{collabUrl:r}=Re();p$(r);let i;return t[0]!==n||t[1]!==r?(i=(0,Z.jsx)(gu,{collabUrl:r,children:n}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i}function D$(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(Ql,{name:`app`,children:(0,Z.jsx)(tt,{children:(0,Z.jsx)(E$,{children:(0,Z.jsx)(tv,{children:(0,Z.jsx)(O$,{})})})})}),e[0]=t):t=e[0],t}function O$(){let e=(0,$.c)(30),t=typeof window<`u`?window.okDesktop??null:null,n=typeof window<`u`&&window.okDesktop!=null,[r,i]=(0,Q.useState)(!1),a=iv(),o=md(),s;e[0]===o?s=e[1]:(s=t&&t.config.ptyAvailable===!0?{launchInTerminal:k$,installedClis:o}:null,e[0]=o,e[1]=s);let c=s,l;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(jv,{}),e[2]=l):l=e[2];let u,d,f,p;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(XQ,{}),d=(0,Z.jsx)(x$,{}),f=(0,Z.jsx)(w$,{}),p=(0,Z.jsx)(T$,{}),e[3]=u,e[4]=d,e[5]=f,e[6]=p):(u=e[3],d=e[4],f=e[5],p=e[6]);let m;e[7]===a?m=e[8]:(m=!a&&(0,Z.jsx)(S$,{}),e[7]=a,e[8]=m);let h,g,_,v,y,b;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(v=!1,y=t?(0,Z.jsx)(Mv,{bridge:t}):null,b=t?(0,Z.jsx)(Bv,{}):null,h=t?(0,Z.jsx)(YQ,{}):null,g=(0,Z.jsx)(KQ,{}),_=t?(0,Z.jsxs)(Q.Suspense,{fallback:null,children:[(0,Z.jsx)(m$,{bridge:t}),(0,Z.jsx)(h$,{})]}):null,e[9]=h,e[10]=g,e[11]=_,e[12]=v,e[13]=y,e[14]=b):(h=e[9],g=e[10],_=e[11],v=e[12],y=e[13],b=e[14]);let x;e[15]===r?x=e[16]:(x=(0,Z.jsx)(bv,{bridge:t,open:r,onOpenChange:i}),e[15]=r,e[16]=x);let S;e[17]===Symbol.for(`react.memo_cache_sentinel`)?(S=n&&(0,Z.jsx)(`div`,{"aria-hidden":`true`,"data-testid":`editor-window-chrome-drag-strip`,"data-electron-drag":``,className:`pointer-events-none fixed inset-x-0 top-0 z-50 h-2 [-webkit-app-region:drag]`}),e[17]=S):S=e[17];let C;e[18]===a?C=e[19]:(C=!a&&(0,Z.jsx)(IQ,{onOpenSearch:()=>i(!0)}),e[18]=a,e[19]=C);let w;e[20]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(TN,{className:`overflow-hidden h-[calc(100vh-var(--layout-inset-offset))]`,children:(0,Z.jsx)(cL,{onOpenSearch:()=>i(!0)})}),e[20]=w):w=e[20];let T;e[21]===C?T=e[22]:(T=(0,Z.jsxs)(yN,{className:`h-screen overflow-hidden`,children:[C,w]}),e[21]=C,e[22]=T);let E;e[23]!==T||e[24]!==c?(E=(0,Z.jsx)(Qs,{value:c,children:T}),e[23]=T,e[24]=c,e[25]=E):E=e[25];let D;return e[26]!==x||e[27]!==E||e[28]!==m?(D=(0,Z.jsxs)(Z.Fragment,{children:[l,(0,Z.jsxs)(Ps,{children:[u,d,f,p,m,v,y,b,h,g,_,x,S,E]})]}),e[26]=x,e[27]=E,e[28]=m,e[29]=D):D=e[29],D}function k$(e,t){Wc(Ws(e,t),t)}function A$(e){let t=/\/([^/]+?)(?:\.git)?\/?$/.exec(e);return t?t[1]:`repo`}function j$(e){return{async getAuthStatus(t){return e.authQueryTransport.status(t?{host:t}:void 0)},async startSignIn(){return e.openSignIn()},async runClone({url:t,branch:n}){let r=await e.bridge.dialog.openFolder();if(!r)return{kind:`cancelled`};let i=A$(t),a=`${r.replace(/\/$/,``)}/${i}`,o=X.loading(yl._({id:`GXf9hG`,values:{repoName:i}}),{duration:1/0}),s=typeof n==`string`&&n.length>0?n:null;try{let n=e.cloneTransport.start({url:t,dir:a,branch:s});for await(let e of n.events){if(e.type===`progress`){let t=e.phase,n=Math.round(e.pct);X.loading(yl._({id:`GXf9hG`,values:{repoName:i}}),{id:o,description:yl._({id:`SCzAbA`,values:{phase:t,pct:n}}),duration:1/0});continue}if(e.type===`branch-fallback`){console.log(jf({branch_action:`fallback`,branch:e.branch})),X.info(yl._({id:`3JYy1p`,values:{0:e.branch}}),{duration:8e3});continue}if(e.type===`complete`)return X.success(yl._({id:`IRv9cH`,values:{repoName:i}}),{id:o,duration:4e3}),{kind:`ok`,dir:e.dir};if(e.type===`error`)return X.dismiss(o),{kind:`error`,detail:e.message}}return X.dismiss(o),{kind:`error`,detail:`Clone ended unexpectedly.`}}catch(e){console.warn(`[clone-controller] clone transport threw`,e);let t=e instanceof Error?e.message:`Unknown error`;return X.dismiss(o),{kind:`error`,detail:t}}}}}function M$(){return{start(e){return ui((t,n)=>{(async()=>{try{let r=await fetch(`/api/local-op/clone`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({url:e.url,dir:e.dir||void 0,branch:typeof e.branch==`string`&&e.branch.length>0?e.branch:void 0}),signal:n});if(!r.ok){let e=`Clone failed — check the URL and try again (${r.status})`;try{let t=await r.json(),n=_o.safeParse(t);n.success&&(e=`Clone failed: ${n.data.title}`)}catch{}t({type:`error`,message:e});return}if(!r.body){t({type:`error`,message:`Clone failed — empty response body`});return}let i=r.body.getReader(),a=new TextDecoder,o=``;for(;;){let{done:e,value:r}=await i.read();if(e)break;o+=a.decode(r,{stream:!0});let s=o.split(`
1995
+ `);o=s.pop()??``;for(let e of s){if(!e.trim())continue;let n;try{n=JSON.parse(e)}catch{console.warn(`[clone-transport] Dropped unparseable NDJSON line:`,e.slice(0,100));continue}if(n&&typeof n==`object`&&n.type===`error`&&`problem`in n){let e=n.problem;t({type:`error`,message:e?.detail||e?.title||`Unknown error`});break}t(n)}if(n.aborted)break}n.aborted||t({type:`error`,message:`Clone stream ended unexpectedly — check if the clone completed`})}catch(e){if(e instanceof Error&&e.name===`AbortError`)return;t({type:`error`,message:`Clone failed — connection error`})}})()})}}}function N$(e){return{start(t){let n=typeof t.branch==`string`&&t.branch.length>0?t.branch:null;return e.localOp.clone.start({url:t.url,dir:t.dir,branch:n})}}}function P$(e){switch(e){case`receiving`:return{id:`qbfj1f`};case`resolving`:return{id:`adsMWO`};case`checking`:return{id:`1HBhDS`};case`init`:return{id:`LlHqdU`};case`done`:return{id:`bD8I7O`};default:return{id:`25Pw6a`}}}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 I$(e){let t=(0,$.c)(100),{open:n,onOpenChange:r,onSignIn:i,onCloneComplete:a,transport:o,authQueryTransport:s,pickParentFolder:c,initialUrl:l}=e,{_:u}=vt(),d;t[0]===o?d=t[1]:(d=o??M$(),t[0]=o,t[1]=d);let f=d,p;t[2]===s?p=t[3]:(p=s??Qr(),t[2]=s,t[3]=p);let m=p,h=c!==void 0,[g,_]=(0,Q.useState)(``),[v,y]=(0,Q.useState)(``),[b,x]=(0,Q.useState)(null),[S,C]=(0,Q.useState)(!1),w;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(w=Di(),t[4]=w):w=t[4];let[T,E]=(0,Q.useState)(w),[D,O]=(0,Q.useState)(!1),[k,A]=(0,Q.useState)(!1),[j,M]=(0,Q.useState)(-1),N=(0,Q.useRef)(null),P=(0,Q.useRef)(null),F=(0,Q.useRef)(null),I=(0,Q.useId)(),L;t[5]!==n||t[6]!==m?(L=()=>{if(!n)return;let e=!1;return m.status().then(t=>{Si(t.authenticated),e||E(t.authenticated)}).catch(()=>{e||E(!1)}),()=>{e=!0}},t[5]=n,t[6]=m,t[7]=L):L=t[7];let R;t[8]===n?R=t[9]:(R=[n],t[8]=n,t[9]=R),(0,Q.useEffect)(L,R);let z;t[10]!==T||t[11]!==n||t[12]!==m?(z=()=>{if(!T||!n)return;let e=!1;return C(!0),m.repos().then(t=>{e||(x(t.ok?t.repos:[]),C(!1))}).catch(()=>{e||(x([]),C(!1))}),()=>{e=!0}},t[10]=T,t[11]=n,t[12]=m,t[13]=z):z=t[13];let B;t[14]!==T||t[15]!==n?(B=[T,n],t[14]=T,t[15]=n,t[16]=B):B=t[16],(0,Q.useEffect)(z,B);let V,H;t[17]!==l||t[18]!==n||t[19]!==h?(V=()=>{if(!n||!l||(_(l),h))return;let e=F$(l);e&&y(`~/Documents/${e}`)},H=[n,l,h],t[17]=l,t[18]=n,t[19]=h,t[20]=V,t[21]=H):(V=t[20],H=t[21]),(0,Q.useEffect)(V,H);let U,W;t[22]!==j||t[23]!==I?(U=()=>{j<0||document.getElementById(`${I}-opt-${j}`)?.scrollIntoView({block:`nearest`})},W=[j,I],t[22]=j,t[23]=I,t[24]=U,t[25]=W):(U=t[24],W=t[25]),(0,Q.useEffect)(U,W);let ee;t[26]===h?ee=t[27]:(ee=function(e){if(_(e),A(!0),M(-1),h)return;let t=F$(e);t&&y(`~/Documents/${t}`)},t[26]=h,t[27]=ee);let G=ee,K;t[28]===h?K=t[29]:(K=function(e){if(_(e.clone_url),h)return;let t=e.full_name.split(`/`)[1];y(`~/Documents/${t}`)},t[28]=h,t[29]=K);let te=K,ne;t[30]!==u||t[31]!==v||t[32]!==a||t[33]!==r||t[34]!==c||t[35]!==f||t[36]!==g?(ne=async function(){let e=g.trim();if(!e){X.error(u({id:`FTUGgh`}));return}let t=v||``;if(c){O(!0);let n=await c();if(!n){O(!1);return}let r=F$(e);t=`${n.replace(/\/$/,``)}/${r}`}else O(!0);let n=X.loading(u({id:`2tgFCe`}),{duration:1/0});P.current=n;let i=f.start({url:e,dir:t});N.current=i.cancel;try{let e=i.events[Symbol.asyncIterator](),t=await e.next();for(;!t.done;){let i=t.value;if(i.type===`progress`){let e=u(P$(i.phase));X.loading(`${e} — ${i.pct}%`,{id:n})}else if(i.type===`complete`){X.success(u({id:`u_lS4C`}),{id:n}),r(!1),O(!1),N.current=null;let e=`port`in i?i.port:void 0;a?a({port:e,dir:i.dir}):e!==void 0&&(window.location.href=`http://localhost:${e}`);return}else if(i.type===`error`){let e=i.message;X.error(u({id:`eFJkVt`,values:{cloneError:e}}),{id:n}),O(!1),N.current=null;return}t=await e.next()}X.error(u({id:`Tz9pJB`}),{id:n}),O(!1),N.current=null}catch(e){console.error(`[CloneDialog] clone iteration failed:`,e),X.error(u({id:`K9J00P`}),{id:n}),O(!1),N.current=null}},t[30]=u,t[31]=v,t[32]=a,t[33]=r,t[34]=c,t[35]=f,t[36]=g,t[37]=ne):ne=t[37];let re=ne,ie;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(ie=function(){N.current?.(),N.current=null,O(!1),X.dismiss(P.current??void 0)},t[38]=ie):ie=t[38];let ae=ie,oe;t[39]!==D||t[40]!==r||t[41]!==h?(oe=function(e){D||(r(e),e||(_(``),h||y(``),A(!1),M(-1)))},t[39]=D,t[40]=r,t[41]=h,t[42]=oe):oe=t[42];let se=oe,ce;t[43]===te?ce=t[44]:(ce=function(e){te(e),A(!1),M(-1),F.current?.focus()},t[43]=te,t[44]=ce);let le=ce,ue=T===null||S&&b===null,de;if(t[45]!==b||t[46]!==g){let e=g.trim().toLowerCase(),n;t[48]===b?n=t[49]:(n=b??[],t[48]=b,t[49]=n),de=n.filter(t=>`${t.full_name} ${t.clone_url}`.toLowerCase().includes(e)),t[45]=b,t[46]=g,t[47]=de}else de=t[47];let fe=de,pe;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(pe=/:\/\/|^git@|\.git$/i,t[50]=pe):pe=t[50];let q;t[51]===g?q=t[52]:(q=pe.test(g.trim()),t[51]=g,t[52]=q);let me=q,he=T===!0&&b!==null&&fe.length===0&&!me,ge=k&&T!==!1&&!D&&(ue||fe.length>0||he),_e=fe.length,ve=`${I}-loading`,ye,be;t[53]===_e?(ye=t[54],be=t[55]):(ye=()=>{M(e=>e>=_e?_e-1:e)},be=[_e],t[53]=_e,t[54]=ye,t[55]=be),(0,Q.useEffect)(ye,be);let xe;t[56]!==j||t[57]!==D||t[58]!==ge||t[59]!==le||t[60]!==fe?(xe=function(e){if(!D)if(e.key===`ArrowDown`){if(e.preventDefault(),!ge){A(!0);return}M(e=>Math.min(e+1,fe.length-1))}else e.key===`ArrowUp`?(e.preventDefault(),M(H$)):e.key===`Enter`?ge&&j>=0&&j<fe.length&&(e.preventDefault(),le(fe[j])):e.key===`Escape`&&ge&&(e.preventDefault(),e.stopPropagation(),A(!1),M(-1))},t[56]=j,t[57]=D,t[58]=ge,t[59]=le,t[60]=fe,t[61]=xe):xe=t[61];let Se=xe,Ce;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=(0,Z.jsx)(xn,{children:(0,Z.jsx)(_n,{children:(0,Z.jsx)(J,{id:`VdXv4D`})})}),t[62]=Ce):Ce=t[62];let we;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(we=(0,Z.jsx)(`label`,{htmlFor:`clone-source`,className:`text-sm font-medium`,children:(0,Z.jsx)(J,{id:`IreQBq`})}),t[63]=we):we=t[63];let Te;t[64]!==u||t[65]!==j||t[66]!==D||t[67]!==Se||t[68]!==G||t[69]!==T||t[70]!==I||t[71]!==ve||t[72]!==i||t[73]!==ge||t[74]!==ue||t[75]!==b||t[76]!==le||t[77]!==fe||t[78]!==g?(Te=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[we,T===!1?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(vl,{id:`clone-source`,placeholder:u({id:`Xv_ijG`}),value:g,onChange:e=>G(e.target.value),disabled:D}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-1sm text-muted-foreground`,children:[(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`9oE4C3`})}),(0,Z.jsx)(Y,{variant:`link`,className:`h-auto p-0`,onClick:()=>i?.(),disabled:D,children:(0,Z.jsx)(J,{id:`3jod3l`})})]})]}):(0,Z.jsxs)(Ut,{open:ge,onOpenChange:A,children:[(0,Z.jsx)(qt,{asChild:!0,children:(0,Z.jsx)(vl,{id:`clone-source`,ref:F,role:`combobox`,"aria-expanded":ge,"aria-controls":ge?ue?ve:I:void 0,"aria-activedescendant":j>=0?`${I}-opt-${j}`:void 0,"aria-autocomplete":`list`,autoComplete:`off`,placeholder:u({id:`R0jJzV`}),value:g,onChange:e=>G(e.target.value),onFocus:()=>A(!0),onKeyDown:Se,disabled:D})}),(0,Z.jsx)(Yt,{align:`start`,sideOffset:4,className:`w-(--radix-popover-trigger-width) max-h-56 overflow-y-auto overscroll-y-contain subtle-scrollbar p-0`,onOpenAutoFocus:V$,onCloseAutoFocus:B$,onInteractOutside:e=>{F.current?.contains(e.target)&&e.preventDefault()},onWheel:z$,onTouchMove:R$,children:ue?(0,Z.jsxs)(`output`,{id:ve,className:`flex flex-col gap-1.5 px-3 py-2`,"aria-label":u({id:`8XQRON`}),children:[(0,Z.jsx)(Cd,{className:`h-4 w-2/3`}),(0,Z.jsx)(Cd,{className:`h-4 w-1/2`}),(0,Z.jsx)(Cd,{className:`h-4 w-3/4`}),(0,Z.jsx)(Cd,{className:`h-4 w-2/5`})]}):(0,Z.jsx)(`div`,{id:I,role:`listbox`,"aria-label":u({id:`KX1MZR`}),className:`py-1`,children:fe.length===0?(0,Z.jsx)(`div`,{role:`presentation`,className:`px-3 py-2 text-xs text-muted-foreground`,children:b&&b.length===0?(0,Z.jsx)(J,{id:`cOSAfL`}):(0,Z.jsx)(J,{id:`8eW0WQ`})}):fe.map((e,t)=>(0,Z.jsxs)(`div`,{id:`${I}-opt-${t}`,role:`option`,tabIndex:-1,"aria-selected":t===j,onMouseDown:L$,onMouseEnter:()=>M(t),onClick:()=>le(e),className:$t(`flex cursor-default items-center gap-2 px-3 py-1.5 text-sm`,t===j&&`bg-accent text-accent-foreground`),children:[e.private?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ls,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`n5n_vi`})})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Fs,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`NuH1jp`})})]}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.full_name})]},e.full_name))})})]})]}),t[64]=u,t[65]=j,t[66]=D,t[67]=Se,t[68]=G,t[69]=T,t[70]=I,t[71]=ve,t[72]=i,t[73]=ge,t[74]=ue,t[75]=b,t[76]=le,t[77]=fe,t[78]=g,t[79]=Te):Te=t[79];let Ee;t[80]!==D||t[81]!==v||t[82]!==h?(Ee=!h&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`label`,{htmlFor:`clone-path`,className:`text-sm font-medium`,children:(0,Z.jsx)(J,{id:`Gp_twO`})}),(0,Z.jsx)(vl,{id:`clone-path`,placeholder:`~/Documents/repo-name`,value:v,onChange:e=>y(e.target.value),disabled:D})]}),t[80]=D,t[81]=v,t[82]=h,t[83]=Ee):Ee=t[83];let De;t[84]!==Te||t[85]!==Ee?(De=(0,Z.jsx)(yn,{children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[Te,Ee]})}),t[84]=Te,t[85]=Ee,t[86]=De):De=t[86];let Oe;t[87]!==D||t[88]!==re||t[89]!==se||t[90]!==g||t[91]!==h?(Oe=(0,Z.jsx)(bn,{children:D?(0,Z.jsx)(Y,{variant:`outline`,className:`font-mono uppercase`,onClick:ae,children:(0,Z.jsx)(J,{id:`dEgA5A`})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Y,{variant:`outline`,className:`font-mono uppercase`,onClick:()=>se(!1),children:(0,Z.jsx)(J,{id:`dEgA5A`})}),(0,Z.jsx)(Y,{onClick:()=>void re(),disabled:!g.trim(),"aria-describedby":h?`clone-picker-hint`:void 0,children:(0,Z.jsx)(J,{id:`9UQ730`})}),h&&(0,Z.jsx)(`span`,{id:`clone-picker-hint`,className:`sr-only`,children:(0,Z.jsx)(J,{id:`EvPX7f`})})]})}),t[87]=D,t[88]=re,t[89]=se,t[90]=g,t[91]=h,t[92]=Oe):Oe=t[92];let ke;t[93]!==De||t[94]!==Oe?(ke=(0,Z.jsxs)(vn,{className:`sm:max-w-lg`,children:[Ce,De,Oe]}),t[93]=De,t[94]=Oe,t[95]=ke):ke=t[95];let Ae;return t[96]!==se||t[97]!==n||t[98]!==ke?(Ae=(0,Z.jsx)(Sn,{open:n,onOpenChange:se,children:ke}),t[96]=se,t[97]=n,t[98]=ke,t[99]=Ae):Ae=t[99],Ae}function L$(e){return e.preventDefault()}function R$(e){return e.stopPropagation()}function z$(e){return e.stopPropagation()}function B$(e){return e.preventDefault()}function V$(e){return e.preventDefault()}function H$(e){return Math.max(e-1,-1)}var U$=(0,Q.lazy)(()=>n(()=>import(`./ConsentDialogBody-D9xWEY09.js`),__vite__mapDeps([159,1,10,11,12,13,14,15,16,17,18,19,20,21,22,80,23,24,25,26,84,90,160,107,108,40,41,28,87,33,34]),import.meta.url));function W$(){let e=(0,$.c)(1);if(!(0,Q.useSyncExternalStore)(_l.subscribe,K$,G$))return null;let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(U$,{})}),e[0]=t):t=e[0],t}function G$(){return!1}function K$(){return _l.getSnapshot()!==null}function q$(e){let t=(0,$.c)(5),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`OpenKnowledge icon`}),t[0]=n):n=t[0];let r;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsxs)(`g`,{filter:`url(#filter0_d_ok)`,children:[(0,Z.jsx)(`path`,{d:`M66.8902 16.1017C58.2694 3.86669 46.1739 -0.690239 29.9182 2.17749C21.3995 3.67813 13.4602 9.555 8.67934 17.9009C3.93974 26.1701 2.98514 35.6533 6.05714 43.9166C9.31574 52.6868 16.7168 58.4752 24.2299 63.4231C25.7973 64.4562 26.1351 65.7172 26.3551 68.9896C26.5221 71.4625 26.799 75.6011 30.6842 77.7204C31.8176 78.3372 33.0648 78.6515 34.3946 78.6515C37.0796 78.6515 39.4033 77.3649 40.5189 76.7482C47.1049 73.1046 68.8878 59.7147 72.6453 40.4027C74.3444 31.6679 70.9797 21.9019 66.8922 16.1017H66.8902Z`,fill:`white`}),(0,Z.jsx)(`path`,{d:`M37.4214 71.154C28.7888 75.929 36.787 64.0397 27.7458 58.0843C21.6372 54.0616 14.788 49.0568 12.0499 41.6911C6.74463 27.4192 17.5438 10.8473 31.028 8.47262C45.1977 5.97613 54.6946 9.8947 61.6635 19.7844C65.2089 24.8167 67.6013 32.8365 66.3658 39.1828C63.6906 52.9341 49.073 64.7075 37.4214 71.154Z`,fill:`#69A3FF`}),(0,Z.jsx)(`path`,{d:`M52.7244 29.2638C53.4665 28.5217 54.6697 28.5217 55.4119 29.2638V29.2638C56.154 30.0059 56.154 31.2091 55.4119 31.9513L49.2589 38.1042L46.5715 35.4167L52.7244 29.2638Z`,fill:`#D5E5FF`}),(0,Z.jsx)(`path`,{d:`M55.4119 38.8821C56.154 39.6242 56.154 40.8274 55.4119 41.5696V41.5696C54.6698 42.3117 53.4665 42.3117 52.7244 41.5696L46.5715 35.4166L49.259 32.7292L55.4119 38.8821Z`,fill:`#D5E5FF`})]}),t[1]=r):r=t[1];let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(`defs`,{children:(0,Z.jsxs)(`filter`,{id:`filter0_d_ok`,x:`-9.53674e-07`,y:`-0.0799994`,width:`77.3817`,height:`85.8743`,filterUnits:`userSpaceOnUse`,colorInterpolationFilters:`sRGB`,children:[(0,Z.jsx)(`feFlood`,{floodOpacity:`0`,result:`BackgroundImageFix`}),(0,Z.jsx)(`feColorMatrix`,{in:`SourceAlpha`,type:`matrix`,values:`0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0`,result:`hardAlpha`}),(0,Z.jsx)(`feOffset`,{dy:`2.85714`}),(0,Z.jsx)(`feGaussianBlur`,{stdDeviation:`2.14286`}),(0,Z.jsx)(`feComposite`,{in2:`hardAlpha`,operator:`out`}),(0,Z.jsx)(`feColorMatrix`,{type:`matrix`,values:`0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 0`}),(0,Z.jsx)(`feBlend`,{mode:`normal`,in2:`BackgroundImageFix`,result:`effect1_dropShadow_ok`}),(0,Z.jsx)(`feBlend`,{mode:`normal`,in:`SourceGraphic`,in2:`effect1_dropShadow_ok`,result:`shape`})]})}),t[2]=i):i=t[2];let a;return t[3]===e?a=t[4]:(a=(0,Z.jsxs)(`svg`,{role:`img`,"aria-label":`OpenKnowledge icon`,fill:`none`,height:24,width:24,viewBox:`0 0 78 80`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[n,r,i]}),t[3]=e,t[4]=a),a}var J$=(0,Q.lazy)(()=>n(()=>import(`./ShareReceiveDialog-IVAS4xf8.js`).then(e=>({default:e.ShareReceiveDialog})),__vite__mapDeps([161,1,6,2,3,7,8,9,10,11,12,23,16,17,18,19,24,25,22,26,30,90,153,154,155]),import.meta.url)),Y$=(0,Q.lazy)(()=>n(()=>import(`./AppMenubar-DqlpmcU7.js`).then(e=>({default:e.AppMenubar})),__vite__mapDeps([144,1,10,11,12,16,17,18,19,40,106,14,15,24,41,21,84,22]),import.meta.url)),X$=(e,t,n)=>Q_(e,t,n,`NavigatorApp`);function Z$(e,t){return e.filter(e=>e.path!==t)}function Q$(e){let t=(0,$.c)(112),{bridge:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=[],t[0]=r):r=t[0];let[i,a]=(0,Q.useState)(r),o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=new Map,t[1]=o):o=t[1];let[s,c]=(0,Q.useState)(o),[l,u]=(0,Q.useState)(!0),[d,f]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(null),[_,v]=(0,Q.useState)(!1),[y,b]=(0,Q.useState)(!1),[x,S]=(0,Q.useState)(!1),[C,w]=(0,Q.useState)(void 0),[T,E]=(0,Q.useState)(void 0),[D,O]=(0,Q.useState)(!1),[k,A]=(0,Q.useState)(!1),[j,M]=(0,Q.useState)(null),N=typeof window<`u`&&window.okDesktop!=null,[P,F]=(0,Q.useState)(`auth`),{theme:I}=zt(),{_:L}=vt();hu(n,I??`system`);let R;t[2]!==L||t[3]!==n.project?(R=()=>{let e=!1;return n.project.listRecent().then(async t=>{if(e)return;a(t);let r=t.filter($$),i=await Promise.all(r.map(async e=>{try{let{currentBranch:t}=await n.project.readHeadBranch(e.path);return[e.path,t]}catch{return[e.path,null]}}));e||c(e=>{let t=new Map(e);for(let[e,n]of i)t.set(e,n);return t})}).catch(t=>{console.error(`[NavigatorApp] listRecent failed:`,t),e||(m(t instanceof Error?t.message:L({id:`fYKgzG`})),f(!0))}).finally(()=>{e||u(!1)}),()=>{e=!0}},t[2]=L,t[3]=n.project,t[4]=R):R=t[4];let z;t[5]!==L||t[6]!==n?(z=[n,L],t[5]=L,t[6]=n,t[7]=z):z=t[7],(0,Q.useEffect)(R,z);let B,V;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(B=()=>Gt(e=>{e===`new-project`&&b(!0),e===`report-bug`&&S(!0),e===`close-active-tab-or-window`&&window.close()}),V=[],t[8]=B,t[9]=V):(B=t[8],V=t[9]),(0,Q.useEffect)(B,V);let H;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(H=(e,t)=>X$(e,t,m),t[10]=H):H=t[10];let U=H,W;t[11]!==L||t[12]!==n?(W=(e,t,r)=>U(()=>(g(r),r1(n,e,t).finally(()=>g(null))),L({id:`SUOoXn`})),t[11]=L,t[12]=n,t[13]=W):W=t[13];let ee=W,G;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(G=()=>v(!0),t[14]=G):G=t[14];let K=G,te;t[15]!==L||t[16]!==n?(te=()=>U(async()=>{let e=await n.dialog.openFolder();e&&(g(i1(e)),await r1(n,e,`pick-existing`).finally(()=>g(null)))},L({id:`gmJ0An`})),t[15]=L,t[16]=n,t[17]=te):te=t[17];let ne=te,re;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(re=()=>b(!0),t[18]=re):re=t[18];let ie=re,ae;t[19]!==L||t[20]!==n.project?(ae=()=>U(()=>n.project.openFile(),L({id:`8vCZcs`})),t[19]=L,t[20]=n.project,t[21]=ae):ae=t[21];let oe=ae,se;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(se=(e,t)=>{w(e),E(t),b(!0)},t[22]=se):se=t[22];let ce=se,le;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(le=e=>{b(e),e||(w(void 0),E(void 0))},t[23]=le):le=t[23];let ue=le,de;t[24]===ee?de=t[25]:(de=e=>ee(e,`recents`,i1(e)),t[24]=ee,t[25]=de);let fe=de,pe;t[26]!==L||t[27]!==n.project?(pe=e=>U(async()=>{await n.project.removeRecent(e),a(t=>Z$(t,e)),c(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},L({id:`viwC-K`})),t[26]=L,t[27]=n.project,t[28]=pe):pe=t[28];let q=pe,me;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,Z.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 top-0 z-10 h-9 ${N?`[-webkit-app-region:drag]`:``}`,"data-electron-drag":N?``:void 0,"data-testid":`nav-chrome-row`,children:RP()&&(0,Z.jsx)(`div`,{className:`pointer-events-auto flex h-full items-center px-2`,children:(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(Y$,{})})})}),t[29]=me):me=t[29];let he;t[30]!==L||t[31]!==h?(he=h===null?null:(0,Z.jsxs)(`div`,{className:`absolute inset-0 z-20 flex flex-col items-center justify-center gap-3 bg-primary-foreground/85 dark:bg-background/85 backdrop-blur-sm`,"data-testid":`nav-opening-overlay`,role:`status`,"aria-live":`polite`,children:[(0,Z.jsx)(Zc,{className:`size-6 animate-spin text-muted-foreground`}),(0,Z.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:L({id:`s0_GnA`,values:{openingLabel:h}})})]}),t[30]=L,t[31]=h,t[32]=he):he=t[32];let ge;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,Z.jsx)(q$,{className:`size-12 shrink-0`}),t[33]=ge):ge=t[33];let _e;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(_e=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`h1`,{className:`font-medium text-xl tracking-tight`,children:`OpenKnowledge`}),(0,Z.jsx)(bF,{})]}),t[34]=_e):_e=t[34];let ve;t[35]===n.appVersion?ve=t[36]:(ve=(0,Z.jsxs)(`header`,{className:`shrink-0 flex-wrap flex items-center gap-2.5`,children:[ge,(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[_e,(0,Z.jsxs)(`p`,{className:`text-muted-foreground text-xs font-mono`,children:[`v`,n.appVersion]})]})]}),t[35]=n.appVersion,t[36]=ve);let ye;t[37]!==L||t[38]!==l||t[39]!==oe||t[40]!==ne||t[41]!==i||t[42]!==d?(ye=l?null:!d&&i.length===0?(0,Z.jsx)(t1,{onPackSelect:ce,onOpenFolder:ne,onOpenFile:oe,onClone:K,onCreate:ie}):(0,Z.jsxs)(`section`,{className:`grid shrink-0 sm:grid-cols-2 gap-3`,children:[(0,Z.jsx)(e1,{title:L({id:`wbv9xO`}),description:L({id:`0uTHCg`}),onClick:ie,dataTestId:`nav-create-new`,Icon:Kt}),(0,Z.jsx)(e1,{title:L({id:`WPwDin`}),description:L({id:`tUvUfp`}),onClick:ne,dataTestId:`nav-open`,Icon:gc}),(0,Z.jsx)(e1,{title:L({id:`ka6Eke`}),description:L({id:`gOD68k`}),onClick:oe,dataTestId:`nav-open-file`,Icon:qn}),(0,Z.jsx)(e1,{title:L({id:`VdXv4D`}),description:L({id:`JOcPqH`}),onClick:K,dataTestId:`nav-clone`,Icon:pg})]}),t[37]=L,t[38]=l,t[39]=oe,t[40]=ne,t[41]=i,t[42]=d,t[43]=ye):ye=t[43];let be;t[44]===p?be=t[45]:(be=p===null?null:(0,Z.jsxs)(`div`,{className:`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,Z.jsx)(`span`,{className:`text-red-700 text-xs dark:text-red-300`,children:p}),(0,Z.jsx)(Y,{type:`button`,variant:`link`,size:`sm`,onClick:()=>m(null),className:`h-auto p-0 text-red-700 text-xs dark:text-red-300`,"data-testid":`nav-error-dismiss`,children:(0,Z.jsx)(J,{id:`1QfxQT`})})]}),t[44]=p,t[45]=be);let xe;t[46]!==l||t[47]!==fe||t[48]!==q||t[49]!==s||t[50]!==i?(xe=l?(0,Z.jsx)(`section`,{className:`flex shrink-0 flex-col items-center`,children:(0,Z.jsx)(Zc,{className:`size-4 animate-spin text-muted-foreground/60`})}):i.length>0?(0,Z.jsxs)(`section`,{className:`flex min-h-0 flex-col`,children:[(0,Z.jsx)(`h2`,{className:`mb-2 shrink-0 font-medium text-muted-foreground font-mono text-xs uppercase tracking-wide`,children:(0,Z.jsx)(J,{id:`CCTop_`})}),(0,Z.jsx)(`ul`,{className:`min-h-0 max-h-48 subtle-scrollbar scroll-fade-mask overflow-y-auto space-y-0.5 -mx-4`,"data-testid":`nav-recent-list`,children:i.map(e=>(0,Z.jsx)(n1,{project:e,branch:s.get(e.path)??null,onOpen:()=>fe(e.path),onRemove:()=>q(e.path)},e.path))})]}):null,t[46]=l,t[47]=fe,t[48]=q,t[49]=s,t[50]=i,t[51]=xe):xe=t[51];let Se;t[52]!==ve||t[53]!==ye||t[54]!==be||t[55]!==xe?(Se=(0,Z.jsx)(`div`,{className:`mx-auto flex h-full w-full max-w-5xl flex-col overflow-hidden px-12 py-12`,children:(0,Z.jsxs)(`div`,{className:`my-auto flex min-h-0 flex-col space-y-10`,children:[ve,ye,be,xe]})}),t[52]=ve,t[53]=ye,t[54]=be,t[55]=xe,t[56]=Se):Se=t[56];let Ce,we;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=(0,Z.jsx)(KQ,{}),we=(0,Z.jsx)(W$,{}),t[57]=Ce,t[58]=we):(Ce=t[57],we=t[58]);let Te;t[59]!==n||t[60]!==y||t[61]!==C||t[62]!==T?(Te=(0,Z.jsx)($h,{open:y,onOpenChange:ue,bridge:n,initialPackId:C,packs:T}),t[59]=n,t[60]=y,t[61]=C,t[62]=T,t[63]=Te):Te=t[63];let Ee;t[64]===x?Ee=t[65]:(Ee=(0,Z.jsx)(Cp,{open:x,onOpenChange:S,systemWide:!0}),t[64]=x,t[65]=Ee);let De;t[66]===j?De=t[67]:(De=e=>{O(e),e||(A(!1),j&&(j(null),M(null)))},t[66]=j,t[67]=De);let Oe;t[68]===n?Oe=t[69]:(Oe=Kr(n),t[68]=n,t[69]=Oe);let ke;t[70]===n?ke=t[71]:(ke=li(n),t[70]=n,t[71]=ke);let Ae=P===`identity`,je;t[72]!==k||t[73]!==j?(je=e=>{O(!1),k&&(A(!1),v(!0)),j&&(j({authenticated:!0,host:`github.com`,login:e.login}),M(null))},t[72]=k,t[73]=j,t[74]=je):je=t[74];let Me;t[75]!==D||t[76]!==De||t[77]!==Oe||t[78]!==ke||t[79]!==Ae||t[80]!==je?(Me=(0,Z.jsx)(ji,{open:D,onOpenChange:De,transport:Oe,queryTransport:ke,identityPrompt:Ae,onSuccess:je}),t[75]=D,t[76]=De,t[77]=Oe,t[78]=ke,t[79]=Ae,t[80]=je,t[81]=Me):Me=t[81];let Ne;t[82]===n?Ne=t[83]:(Ne=N$(n),t[82]=n,t[83]=Ne);let Pe;t[84]===n?Pe=t[85]:(Pe=li(n),t[84]=n,t[85]=Pe);let Fe;t[86]===n.dialog?Fe=t[87]:(Fe=()=>n.dialog.openFolder(),t[86]=n.dialog,t[87]=Fe);let Ie;t[88]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=()=>{v(!1),F(`auth`),A(!0),O(!0)},t[88]=Ie):Ie=t[88];let Le;t[89]!==L||t[90]!==n?(Le=e=>{let{dir:t}=e;U(()=>(g(i1(t)),r1(n,t,`pick-existing`).finally(()=>g(null))),L({id:`iSnkwB`}))},t[89]=L,t[90]=n,t[91]=Le):Le=t[91];let Re;t[92]!==_||t[93]!==Ne||t[94]!==Pe||t[95]!==Fe||t[96]!==Le?(Re=(0,Z.jsx)(I$,{open:_,onOpenChange:v,transport:Ne,authQueryTransport:Pe,pickParentFolder:Fe,onSignIn:Ie,onCloneComplete:Le}),t[92]=_,t[93]=Ne,t[94]=Pe,t[95]=Fe,t[96]=Le,t[97]=Re):Re=t[97];let ze;if(t[98]!==n){let e;t[100]===Symbol.for(`react.memo_cache_sentinel`)?(e=()=>new Promise(e=>{M(()=>e),O(!0)}),t[100]=e):e=t[100],ze=j$({bridge:n,authQueryTransport:li(n),cloneTransport:N$(n),openSignIn:e}),t[98]=n,t[99]=ze}else ze=t[99];let Be;t[101]!==n||t[102]!==ze?(Be=(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(J$,{bridge:n,cloneController:ze})}),t[101]=n,t[102]=ze,t[103]=Be):Be=t[103];let Ve;return t[104]!==he||t[105]!==Se||t[106]!==Te||t[107]!==Ee||t[108]!==Me||t[109]!==Re||t[110]!==Be?(Ve=(0,Z.jsxs)(`div`,{className:`relative flex h-screen w-screen flex-col overflow-hidden bg-primary-foreground dark:bg-background text-foreground`,children:[me,he,Se,Ce,we,Te,Ee,Me,Re,Be]}),t[104]=he,t[105]=Se,t[106]=Te,t[107]=Ee,t[108]=Me,t[109]=Re,t[110]=Be,t[111]=Ve):Ve=t[111],Ve}function $$(e){return!e.missing}function e1(e){let t=(0,$.c)(14),{title:n,description:r,onClick:i,dataTestId:a,Icon:o}=e,s;t[0]===o?s=t[1]:(s=o?(0,Z.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,Z.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,Z.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,Z.jsx)(`span`,{className:`line-clamp-2 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,Z.jsxs)(Y,{type:`button`,variant:`outline`,onClick:i,"data-testid":a,className:`h-auto flex-col items-start justify-start gap-1.5 whitespace-normal bg-card px-4 py-3.5 text-left`,children:[l,u]}),t[9]=a,t[10]=i,t[11]=l,t[12]=u,t[13]=d):d=t[13],d}function t1(e){let t=(0,$.c)(36),{onPackSelect:n,onOpenFolder:r,onOpenFile:i,onClone:a,onCreate:o}=e,[s,c]=(0,Q.useState)(null),l,u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>{let e=!1;return(async()=>{try{let t=await P_().listPacks();if(e)return;t.ok?c(t.packs):(console.error(`[NavigatorApp] listPacks returned error:`,t),c([]))}catch(t){let n=t;if(e)return;console.error(`[NavigatorApp] listPacks failed:`,n),c([])}})(),()=>{e=!0}},u=[],t[0]=l,t[1]=u):(l=t[0],u=t[1]),(0,Q.useEffect)(l,u);let d;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(`h2`,{className:`text-xl font-light tracking-tighter text-balance`,children:(0,Z.jsx)(J,{id:`QnjpOq`})}),t[2]=d):d=t[2];let f;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-1`,children:[d,(0,Z.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:(0,Z.jsx)(J,{id:`gYuDfu`})})]}),t[3]=f):f=t[3];let p;t[4]!==n||t[5]!==s?(p=e=>n(e,s??[]),t[4]=n,t[5]=s,t[6]=p):p=t[6];let m;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(m=[`okf`,`entity-vault`],t[7]=m):m=t[7];let h;t[8]!==s||t[9]!==p?(h=(0,Z.jsx)(`div`,{className:`-m-1 min-h-0 flex-1 overflow-y-auto subtle-scrollbar p-1`,children:(0,Z.jsx)(L_,{packs:s,onPackSelect:p,collapsedPackIds:m})}),t[8]=s,t[9]=p,t[10]=h):h=t[10];let g;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(`span`,{className:`text-muted-foreground text-sm`,children:(0,Z.jsx)(J,{id:`S34Vju`})}),t[11]=g):g=t[11];let _,v;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(gc,{"aria-hidden":`true`,className:`size-3.5`}),_=(0,Z.jsx)(J,{id:`PVUn_c`}),t[12]=_,t[13]=v):(_=t[12],v=t[13]);let y;t[14]===r?y=t[15]:(y=(0,Z.jsxs)(Y,{type:`button`,variant:`link-muted`,size:`sm`,onClick:r,"data-testid":`nav-first-run-open`,children:[v,_]}),t[14]=r,t[15]=y);let b,x;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(qn,{"aria-hidden":`true`,className:`size-3.5`}),x=(0,Z.jsx)(J,{id:`9npOH9`}),t[16]=b,t[17]=x):(b=t[16],x=t[17]);let S;t[18]===i?S=t[19]:(S=(0,Z.jsxs)(Y,{type:`button`,variant:`link-muted`,size:`sm`,onClick:i,"data-testid":`nav-first-run-open-file`,children:[b,x]}),t[18]=i,t[19]=S);let C,w;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(pg,{"aria-hidden":`true`,className:`size-3.5`}),w=(0,Z.jsx)(J,{id:`VdXv4D`}),t[20]=C,t[21]=w):(C=t[20],w=t[21]);let T;t[22]===a?T=t[23]:(T=(0,Z.jsxs)(Y,{type:`button`,variant:`link-muted`,size:`sm`,onClick:a,"data-testid":`nav-first-run-clone`,children:[C,w]}),t[22]=a,t[23]=T);let E,D;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Z.jsx)(Kt,{"aria-hidden":`true`,className:`size-3.5`}),D=(0,Z.jsx)(J,{id:`ircigK`}),t[24]=E,t[25]=D):(E=t[24],D=t[25]);let O;t[26]===o?O=t[27]:(O=(0,Z.jsxs)(Y,{type:`button`,variant:`link-muted`,size:`sm`,onClick:o,"data-testid":`nav-first-run-blank`,children:[E,D]}),t[26]=o,t[27]=O);let k;t[28]!==y||t[29]!==S||t[30]!==T||t[31]!==O?(k=(0,Z.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-x-3 gap-y-1`,"data-testid":`nav-first-run-secondary`,children:[g,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-1 gap-y-1`,children:[y,S,T,O]})]}),t[28]=y,t[29]=S,t[30]=T,t[31]=O,t[32]=k):k=t[32];let A;return t[33]!==k||t[34]!==h?(A=(0,Z.jsxs)(`section`,{className:`flex min-h-0 shrink flex-col gap-6`,"data-testid":`nav-first-run`,children:[f,h,k]}),t[33]=k,t[34]=h,t[35]=A):A=t[35],A}function n1(e){let t=(0,$.c)(44),{project:n,branch:r,onOpen:i,onRemove:a}=e,{_:o}=vt(),{name:s}=n,c=n.isLinkedWorktree===!0,l=c?n.branch??r:r,u=n.missing,d=n.missing&&`opacity-50`,f;t[0]===d?f=t[1]:(f=$t(`h-auto min-w-0 flex-1 justify-between gap-3 py-3.5 pl-4 pr-2 text-left hover:bg-transparent`,d),t[0]=d,t[1]=f);let p;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(eh,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-muted-foreground`}),t[2]=p):p=t[2];let m;t[3]===n.name?m=t[4]:(m=(0,Z.jsx)(`span`,{className:`truncate font-medium text-sm text-gray-700 dark:text-foreground`,children:n.name}),t[3]=n.name,t[4]=m);let h;t[5]===c?h=t[6]:(h=c?(0,Z.jsxs)(fu,{variant:`secondary`,className:`shrink-0 gap-1 rounded-full border-transparent bg-green-600/10 px-2 py-0 font-medium text-2xs text-green-800 dark:bg-green-400/10 dark:text-green-400`,children:[(0,Z.jsx)(Xo,{"aria-hidden":`true`,className:`size-2.5`}),(0,Z.jsx)(J,{id:`z-lawV`})]}):null,t[5]=c,t[6]=h);let g;t[7]!==m||t[8]!==h?(g=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[m,h]}),t[7]=m,t[8]=h,t[9]=g):g=t[9];let _=c?n.mainRoot??``:n.path,v;t[10]!==c||t[11]!==n.mainRoot||t[12]!==n.path?(v=c?(0,Z.jsx)(J,{id:`PRnH8G`,values:{0:sv(n.mainRoot??``)}}):n.path,t[10]=c,t[11]=n.mainRoot,t[12]=n.path,t[13]=v):v=t[13];let y;t[14]!==_||t[15]!==v?(y=(0,Z.jsx)(`span`,{className:`truncate w-full text-muted-foreground text-xs`,title:_,children:v}),t[14]=_,t[15]=v,t[16]=y):y=t[16];let b;t[17]!==y||t[18]!==g?(b=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[p,(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1 truncate`,children:[g,y]})]}),t[17]=y,t[18]=g,t[19]=b):b=t[19];let x;t[20]!==n.missing||t[21]!==n.path||t[22]!==l?(x=n.missing?(0,Z.jsx)(fu,{className:`text-2xs rounded-sm`,variant:`warning`,children:(0,Z.jsx)(J,{id:`VU3Nrn`})}):l==null?null:(0,Z.jsxs)(`span`,{className:`flex max-w-[40%] items-center gap-1 text-muted-foreground text-xs`,"data-testid":`nav-recent-branch-${n.path}`,children:[(0,Z.jsx)(Xo,{"aria-hidden":`true`,className:`size-3 shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate font-mono`,children:l})]}),t[20]=n.missing,t[21]=n.path,t[22]=l,t[23]=x):x=t[23];let S;t[24]!==i||t[25]!==n.missing||t[26]!==b||t[27]!==x||t[28]!==f?(S=(0,Z.jsxs)(Y,{type:`button`,variant:`ghost`,onClick:i,disabled:u,className:f,children:[b,x]}),t[24]=i,t[25]=n.missing,t[26]=b,t[27]=x,t[28]=f,t[29]=S):S=t[29];let C;t[30]!==o||t[31]!==s?(C=o({id:`hDoLrm`,values:{projectName:s}}),t[30]=o,t[31]=s,t[32]=C):C=t[32];let w;t[33]===o?w=t[34]:(w=o({id:`Es-eZU`}),t[33]=o,t[34]=w);let T=`nav-recent-remove-${n.path}`,E;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Z.jsx)(fl,{"aria-hidden":`true`}),t[35]=E):E=t[35];let D;t[36]!==a||t[37]!==C||t[38]!==w||t[39]!==T?(D=(0,Z.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon-sm`,onClick:a,"aria-label":C,title:w,className:`pointer-events-none mr-2 opacity-0 group-hover:pointer-events-auto group-hover:opacity-100 focus-visible:pointer-events-auto focus-visible:opacity-100`,"data-testid":T,children:E}),t[36]=a,t[37]=C,t[38]=w,t[39]=T,t[40]=D):D=t[40];let O;return t[41]!==S||t[42]!==D?(O=(0,Z.jsxs)(`li`,{className:`group flex items-center justify-between rounded-lg hover:bg-accent`,children:[S,D]}),t[41]=S,t[42]=D,t[43]=O):O=t[43],O}async function r1(e,t,n){await e.project.open({path:t,target:`new-window`,entryPoint:n})}function i1(e){let t=e.split(/[/\\]/).filter(Boolean);return t.length>0?t[t.length-1]??e:e}var a1=(0,Q.lazy)(()=>n(()=>import(`./TerminalWindowApp-jhlpCVAO.js`).then(e=>({default:e.TerminalWindowApp})),__vite__mapDeps([162,1,73,6,2,3,7,8,9,58,12,22,11,74,75,76,147,104,19,38,10,16,17,18,40,105,106,14,15,24,41,21,84,81,28,42,25,112,96,83,148,114,97,32,115,33,34,30,89,78,26,90,124,125,146,163,164]),import.meta.url));function o1(e){return e?.config.mode===`terminal`?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(a1,{bridge:e})}):e?.config.mode===`navigator`?(0,Z.jsx)(Q$,{bridge:e}):(0,Z.jsx)(D$,{})}function s1(){let e=null,t=new Set,n=!1,r=null;function i(){for(let e of t)e()}function a(){e!==null&&(e=null,i())}return{install({bridge:t}){let o=t?.bugReport?.onCrashDetected;if(typeof o==`function`)return n?r??void 0:(n=!0,r=o(t=>{e=t,i()}),()=>{r?.(),r=null,n=!1,a()})},getSnapshot(){return e},subscribe(e){return t.add(e),()=>{t.delete(e)}},dismiss(){a()}}}var c1=s1();function l1(e){return c1.install(e)}function u1(e){let t=(0,$.c)(7),{bridge:n}=e,r=(0,Q.useSyncExternalStore)(c1.subscribe,c1.getSnapshot);if(r===null)return null;let i;t[0]!==n.bugReport||t[1]!==r?(i=e=>{e||(n.bugReport.crashAck({eventId:r.eventId}),c1.dismiss())},t[0]=n.bugReport,t[1]=r,t[2]=i):i=t[2];let a=n.config.mode===`navigator`,o;return t[3]!==r||t[4]!==i||t[5]!==a?(o=(0,Z.jsx)(Cp,{open:!0,onOpenChange:i,systemWide:a,crashInvite:r}),t[3]=r,t[4]=i,t[5]=a,t[6]=o):o=t[6],o}var d1=e=>{let t=(0,$.c)(8),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let{theme:r}=zt(),i=r===void 0?`system`:r,a,o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a={success:(0,Z.jsx)(Is,{className:`size-4`}),info:(0,Z.jsx)(Xc,{className:`size-4`}),warning:(0,Z.jsx)(sl,{className:`size-4`}),error:(0,Z.jsx)(hh,{className:`size-4`}),loading:(0,Z.jsx)(Zc,{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,Z.jsx)(pl,{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},f1=Symbol.for(`ok.client.fetchWrapper`);function p1(e={}){if(typeof window>`u`)return;let t=e.apiOrigin&&e.apiOrigin.length>0?e.apiOrigin:void 0;if(window.fetch[f1])return;let n=window.fetch.bind(window),r=bu(),i=((e,i)=>{let a=h1(e,t);if(!a.isApi)return n(e,i);if(e instanceof Request){let t=m1(e.headers,r);return n(new Request(a.url,e),{headers:t})}let o=m1(i?.headers,r);return n(a.url,{...i,headers:o})});i[f1]=!0,window.fetch=i}function m1(e,t){let n=new Headers(e);for(let[e,r]of Object.entries(t))n.set(e,r);return n}function h1(e,t){if(typeof e==`string`){if(e.startsWith(`/api/`))return{isApi:!0,url:t?t+e:e};let n=g1(e);return n&&_1(n,t)?{isApi:!0,url:e}:{isApi:!1,url:e}}let n=e instanceof URL?e:g1(e.url,window.location.origin);if(n&&_1(n,t)){let r=e instanceof URL?e.href:e.url;return t&&(n.origin===window.location.origin||n.protocol===`file:`)?{isApi:!0,url:t+n.pathname+n.search+n.hash}:{isApi:!0,url:r}}return{isApi:!1,url:e instanceof URL?e.href:e.url}}function g1(e,t){try{return new URL(e,t)}catch{return null}}function _1(e,t){if(!e.pathname.startsWith(`/api/`))return!1;if(e.origin===window.location.origin||e.protocol===`file:`)return!0;if(t){let n=g1(t);if(n&&e.origin===n.origin)return!0}return!1}var v1=Symbol.for(`ok.client.logForwarder`),y1=2e3,b1=[`log`,`info`,`warn`,`error`],x1={log:`info`,info:`info`,warn:`warn`,error:`error`};function S1(e){if(typeof e==`string`)return e;if(e instanceof Error)return`${e.name}: ${e.message}`;try{return JSON.stringify(e)??String(e)}catch{return String(e)}}function C1(e){let t=e.message.length+80;if(e.event&&(t+=e.event.length),e.fields)try{t+=JSON.stringify(e.fields).length}catch{}return t}function w1(e={}){let t=e.windowObj??(typeof window<`u`?window:void 0);if(!t||t.okDesktop)return;let n=t;if(n[v1])return;n[v1]=!0;let r=e.consoleObj??console,i=e.documentObj===void 0?typeof document<`u`?document:null:e.documentObj,a=e.flushIntervalMs??y1,o=e.fetchImpl??n.fetch.bind(n),s=e.now??Date.now,c=[],l=0,u=null,d=!1,f=0,p={log:r.log.bind(r),info:r.info.bind(r),warn:r.warn.bind(r),error:r.error.bind(r)};function m(){if(u!==null&&(clearTimeout(u),u=null),c.length===0)return;let e=c.splice(0,100);l=0;let t=f;d=!0;try{o(`/api/client-logs`,{method:`POST`,headers:{"content-type":`application/json`},keepalive:!0,body:JSON.stringify(t>0?{entries:e,droppedSinceLastFlush:t}:{entries:e})}).then(n=>{n.ok?f=Math.max(0,f-t):f+=e.length},()=>{f+=e.length})}catch{f+=e.length}finally{d=!1}}function h(e){if(c.push(e),l+=C1(e),c.length>100){let e=c.shift();e&&(l-=C1(e),f+=1)}if(c.length>=100||l>=32768){m();return}u===null&&(u=setTimeout(m,a))}function g(e,t){if(!d)try{let n=mo(t.map(S1).join(` `)),r=t[0],i=typeof r==`string`&&r.length<=32768?r:void 0,a=i?La(i):null,o=a?.fields;if(o)try{JSON.stringify(o).length>8192&&(o=void 0)}catch{o=void 0}h({level:e,message:n,ts:s(),...a?.event?{event:a.event}:{},...o?{fields:o}:{}})}catch{}}for(let e of b1)r[e]=(...t)=>{p[e](...t),g(x1[e],t)};let _=e=>{if(d)return;let t=e;g(`error`,[`uncaught error: ${t.message} (${t.filename}:${t.lineno}:${t.colno})`])},v=e=>{d||g(`error`,[`unhandledrejection: ${S1(e.reason)}`])},y=()=>m(),b=()=>{i&&i.visibilityState===`hidden`&&m()};n.addEventListener(`error`,_),n.addEventListener(`unhandledrejection`,v),n.addEventListener(`pagehide`,y),i&&i.addEventListener(`visibilitychange`,b);function x(){for(let e of b1)r[e]=p[e];n.removeEventListener(`error`,_),n.removeEventListener(`unhandledrejection`,v),n.removeEventListener(`pagehide`,y),i&&i.removeEventListener(`visibilitychange`,b),u!==null&&(clearTimeout(u),u=null),c.length=0,delete n[v1]}return{flushNow:m,uninstall:x}}function T1(e,t){return e.branch===void 0||e.branch===null||e.branch===``||t===``||e.multiCandidate!==!0?null:{message:`Opened on branch ${e.branch}`,description:t}}function E1(e){let t=e.bridge;if(!t)return;let n=e.setHash??(e=>{window.location.hash=e}),r=e.emitToast??((e,t)=>{X(e,t)});return t.onDeepLink(e=>{let i=e.kind??`doc`,a={kind:i,path:e.doc,branch:e.branch??null};if(e.targetMissing===!0){Qc.arm(a);return}es.arm(a),n(iu(i,e.doc,i===`doc`?e.branch:void 0));let o=T1(e,t.config.projectPath);o!==null&&r(o.message,{description:o.description,duration:3e3})})}var D1=4e3,O1=1440*60*1e3;function k1(e){let t=e.bridge;if(t&&t.onboarding)return t.onboarding.onToast(e=>{if(e.kind===`ancestor-promote`){X.success(`Opened existing OpenKnowledge project at ${e.ancestorPath}`,{duration:D1});return}if(e.kind===`startup-reclaim`){let t=[];if(e.mcp.status===`repaired`){let n=e.mcp.editors.map(e=>Fa[e]??e).join(`, `);t.push(`repaired ${n} MCP integration`)}else e.mcp.status===`failed`&&t.push(`MCP auto-repair failed`);e.path.status===`installed`&&t.push(e.path.summary),e.path.status===`failed`&&t.push(`PATH install failed: ${e.path.summary}`);let n=t.length>0?t.join(`; `):`OpenKnowledge integrations checked.`,r=e.mcp.status===`failed`||e.path.status===`failed`,i=e.path.status!==`none`;X[r?`error`:`success`](n,{duration:r||i?O1:D1,position:`bottom-left`});return}if(e.kind===`sharing-refused-tracked`){X.error(`Config sharing unchanged: ${e.tracked.length} OK file(s) tracked upstream — see message below.`,{duration:O1,description:e.remediation});return}if(e.kind===`sharing-no-git`){X.warning(`Local-only requested but no git repository was created. Switch later via Settings → Config sharing once the project is in a git repo.`,{duration:D1});return}let t=gl(e.gitRoot,e.pickedPath)??e.pickedPath;X.success(`Initialized OpenKnowledge at ${e.gitRoot} — opened parent of ${t} because it contains a .git folder`,{duration:D1})})}function A1(e){let t=(0,$.c)(18),{body:n,warning:r,restartLabel:i,cancelLabel:a,onRestart:o,onDismiss:s}=e,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(sl,{className:`mt-0.5 size-4 shrink-0 text-amber-500`}),t[0]=c):c=t[0];let l;t[1]===n?l=t[2]:(l=(0,Z.jsx)(`p`,{className:`font-medium text-sm`,children:n}),t[1]=n,t[2]=l);let u;t[3]===r?u=t[4]:(u=(0,Z.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:r}),t[3]=r,t[4]=u);let d;t[5]!==o||t[6]!==i?(d=(0,Z.jsx)(Y,{size:`sm`,onClick:o,children:i}),t[5]=o,t[6]=i,t[7]=d):d=t[7];let f;t[8]!==a||t[9]!==s?(f=(0,Z.jsx)(Y,{size:`sm`,variant:`ghost`,onClick:s,children:a}),t[8]=a,t[9]=s,t[10]=f):f=t[10];let p;t[11]!==d||t[12]!==f?(p=(0,Z.jsxs)(`div`,{className:`mt-1 flex flex-wrap gap-2`,children:[d,f]}),t[11]=d,t[12]=f,t[13]=p):p=t[13];let m;return t[14]!==l||t[15]!==u||t[16]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex w-full gap-3 rounded-lg border bg-popover p-4 text-popover-foreground shadow-lg`,children:[c,(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:[l,u,p]})]}),t[14]=l,t[15]=u,t[16]=p,t[17]=m):m=t[17],m}function j1(){return yl._({id:`f_PkYv`})}function M1(e){return e.serverRuntime===e.appRuntime?yl._({id:`FWQuPE`,values:{0:e.appRuntime}}):e.relation===`older`?yl._({id:`LhQlGR`,values:{0:e.serverRuntime,1:e.appRuntime}}):yl._({id:`yZmvQ4`,values:{0:e.serverRuntime,1:e.appRuntime}})}function N1(e){return yl._({id:`2YOwme`,values:{appRuntime:e}})}function P1(e){return e===`eperm`?yl._({id:`uQewpR`}):yl._({id:`PqYWiC`})}async function F1(e){let t=X.loading(yl._({id:`Kf7GG5`}),{duration:1/0}),n;try{n=await e.restartServer(e.config.projectPath)}catch{return}X.dismiss(t),n.ok===!1&&X.error(P1(n.reason),{duration:1/0})}function I1(e){let t=e.bridge;if(!t)return;let n=t.onServerVersionDrift(e=>{X.custom(n=>(0,Q.createElement)(A1,{body:M1(e),warning:j1(),restartLabel:yl._({id:`ppDgFi`}),cancelLabel:yl._({id:`PBxg_E`}),onRestart:()=>{X.dismiss(n),F1(t)},onDismiss:()=>X.dismiss(n)}),{duration:1/0})}),r=t.onServerRestarted(e=>{X.success(N1(e.appRuntime))});return()=>{n(),r()}}function L1(e){let{initialDoc:t}=e;if(!t)return;let n=e.getHash();n!==``&&n!==`#`&&n!==`#/`||e.setHash(lu(t))}function R1(){typeof window>`u`||!window.okDesktop||L1({initialDoc:window.okDesktop.config.initialDoc,getHash:()=>window.location.hash,setHash:e=>{window.location.hash=e}})}Nf(),n(()=>import(`./telemetry-startup-Bvr_iW-w.js`).then(e=>e.initStartupTrace()),__vite__mapDeps([165,0,1,2,3,4,57,22,12,11]),import.meta.url),p1({apiOrigin:typeof window<`u`?window.okDesktop?.config.apiOrigin:void 0}),w1(),tD()&&sD(),CQ(),sE(),AI(),eF(),typeof window<`u`&&E1({bridge:window.okDesktop}),typeof window<`u`&&I1({bridge:window.okDesktop}),typeof window<`u`&&Af({bridge:window.okDesktop}),typeof window<`u`&&hl({bridge:window.okDesktop}),typeof window<`u`&&k1({bridge:window.okDesktop}),typeof window<`u`&&Mf({bridge:window.okDesktop}),typeof window<`u`&&l1({bridge:window.okDesktop}),R1();var z1=new zf({defaultOptions:{queries:{retry:1,staleTime:1e4}}}),B1=document.getElementById(`root`);if(!B1)throw Error(`Root element not found`);var V1=typeof window>`u`?void 0:window.okDesktop;function H1(){return ta(),null}(0,Wf.createRoot)(B1).render((0,Z.jsx)(Q.StrictMode,{children:(0,Z.jsx)(yt,{i18n:yl,children:(0,Z.jsxs)(At,{client:z1,children:[(0,Z.jsx)(Em,{}),(0,Z.jsxs)(Bt,{attribute:`class`,defaultTheme:`system`,enableSystem:!0,disableTransitionOnChange:!0,storageKey:`ok-theme-v1`,children:[(0,Z.jsx)(H1,{}),(0,Z.jsxs)(dn,{children:[(0,Z.jsx)(Sm,{children:o1(V1)}),V1!==void 0&&(0,Z.jsx)(wm,{children:(0,Z.jsx)(u1,{bridge:V1})})]}),(0,Z.jsx)(d1,{richColors:!0,closeButton:!0})]})]})})}));