@inkeep/open-knowledge 0.24.0-beta.7 → 0.24.0-beta.8

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 (31) hide show
  1. package/dist/assets/skills/discovery/SKILL.md +1 -1
  2. package/dist/assets/skills/project/SKILL.md +1 -1
  3. package/dist/cli.mjs +6 -6
  4. package/dist/constants-DYwiVBpF.mjs +2 -0
  5. package/dist/{dist-CP_B5QnK.mjs → dist-DcBjg7v1.mjs} +1 -1
  6. package/dist/{dist-9ODGY1sr.mjs → dist-DntDG79T.mjs} +4 -4
  7. package/dist/index.mjs +1 -1
  8. package/dist/{init-B6djgC_T.mjs → init-D3lDaCdS.mjs} +4 -4
  9. package/dist/init-NTxFesmd.mjs +1 -0
  10. package/dist/loader-4FZg108x.mjs +1 -0
  11. package/dist/{loader-C9WOVMzr.mjs → loader-Li7cUieM.mjs} +2 -2
  12. package/dist/{preview-DIZpvl3x.mjs → preview-DHXIkTl1.mjs} +2 -2
  13. package/dist/preview-OhPowgjY.mjs +1 -0
  14. package/dist/public/assets/{TerminalPanel-bFmiuK8M.js → TerminalPanel-C7GMKqtO.js} +4 -4
  15. package/dist/public/assets/{index-BWeiEFt2.js → index-BUc1PHZE.js} +2 -2
  16. package/dist/public/index.html +1 -1
  17. package/dist/{repair-launch-json-BtaA-DD2.mjs → repair-launch-json-B3T8K42c.mjs} +2 -2
  18. package/dist/{repair-mcp-configs-Dbwzmujk.mjs → repair-mcp-configs-LJD1vSll.mjs} +2 -2
  19. package/dist/{repair-skills-XRt-TSi_.mjs → repair-skills-BKmGWSNm.mjs} +2 -2
  20. package/dist/repair-skills-C_iNRKzb.mjs +1 -0
  21. package/dist/{src-B6UP4nPX.mjs → src-B-XsMCw3.mjs} +2 -2
  22. package/dist/{start-tfH94om9.mjs → start-CaGVtS1q.mjs} +2 -2
  23. package/dist/start-DJ6iUe0O.mjs +1 -0
  24. package/dist/{write-project-skill-B72gtwrZ.mjs → write-project-skill-9bkdbAY0.mjs} +2 -2
  25. package/package.json +1 -1
  26. package/dist/constants-HKiSpW-s.mjs +0 -2
  27. package/dist/init-BlcimW-B.mjs +0 -1
  28. package/dist/loader-D0nhnzVn.mjs +0 -1
  29. package/dist/preview-DKHez_w3.mjs +0 -1
  30. package/dist/repair-skills-CkAZUSQR.mjs +0 -1
  31. package/dist/start-lnUM3lAJ.mjs +0 -1
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./telemetry-impl-BxLbJWUi.js","./chunk-CFjPhJqf.js","./preload-helper-2ej06EnG.js","./trace-api-D2bW5RZv.js","./propagation-api-Dhdns5D6.js","./ConsentDialogBody-DOBtAIqx.js","./dist-CQw2y-s3.js","./compiler-runtime-CVnuRdak.js","./checkbox-DBdFRrZg.js","./dist-CPXhSDT0.js","./button-DGf25ccp.js","./react-dom-C-oc-P2K.js","./dialog-Bt8vN5IM.js","./dist-BLu8fLv5.js","./dist-KER3mSN7.js","./collapsible-B9pRLq8V.js","./chevron-right-jyIhGBkw.js","./project-paths-CK_36JyE.js","./label-Bg6tgeFh.js","./radio-group-_aqBV1Ev.js","./dist-DEyMVsLW.js","./dist-Dpgw_p7D.js","./tooltip-D-omjYEX.js","./input-CFm7DcvJ.js","./textarea-BVfCks43.js","./McpConsentDialogBody-BmNZ4WyJ.js","./mcp-consent-store-DZJQdxaS.js","./ActivityPanelDiffView-BO8reo7p.js","./ActivityPanelDiffView-legcy4jI.css","./GraphPanel-BOzNAXNR.js","./dist-Bjtzzcz_.js","./w3c-keyname-CO1Sq6Ug.js","./documents-events-B7iSYQul.js","./toggle-group-Bwdb9pNj.js","./panel-BbrtnF__.js","./min-DX8PS56Y.js","./src-D_6tSLtQ.js","./colors-C23yJeS9.js","./ordinal-BRkB4leE.js","./init-CLIhTc-7.js","./isObjectLike-B6rhnmNR.js","./now-jv_Sei15.js","./isSymbol-C5HN6O5S.js","./prop-types-DXyNHDSH.js","./navigation-targets-BBvp-Gxt.js","./startup-marks-DX3HfdcU.js","./target-navigation-intent-nE1R65kM.js","./external-link-CJXR-UFu.js","./ActivityModeContent-B64TMVp3.js","./DocumentContext-BlziVobJ.js","./dist-Det3ErjQ.js","./dist-CjXkcarO.js","./dist-m9JR0snv.js","./dist-HZjJQtoL2.js","./dist-pXD8nsnR.js","./dist-CikH4tpl.js","./dist-CEE3i3A0.js","./dist-7FuH8GMo.js","./dist-BPuPEdb6.js","./stex-C5SatQxm.js","./chevron-down-BaPMAfbX.js","./config-context-DhhN0rlf.js","./file-tree-rename-validation-B9K2lxjE.js","./DocumentContext-B0sQn39F.css","./agent-presence-CPRnxEOl.js","./cursor-CpjEfgnv.js","./dist-Bz14RHFY.js","./dist-BC_IrM4F.js","./SettingsDialogBody-CehseGeW.js","./open-managed-artifact-tab-BbQDONrv.js","./skills-api-C8yxC-Y8.js","./config-validation-events-VKG3DgLl.js","./skill-actions-8oZwtKvr.js","./keyboard-shortcuts-BanMswAs.js","./ManagedArtifactProperties-CYtk8Bqt.js","./PropertyPanel-DUcQoy8A.js","./format-C-cvY9tz.js","./selection-context-3bzSsUeV.js","./SourceEditor-Cd7sWXXb.js","./typing-burst-detector-CiXPtnXN.js","./SkillEditorActions-SkSo8rGK.js","./TerminalPanel-bFmiuK8M.js","./file-tree-adapter-CxLAzSjb.js","./TerminalPanel-BrP-ENHg.css","./telemetry-startup-mmkCxwyh.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./telemetry-impl-BxLbJWUi.js","./chunk-CFjPhJqf.js","./preload-helper-2ej06EnG.js","./trace-api-D2bW5RZv.js","./propagation-api-Dhdns5D6.js","./ConsentDialogBody-DOBtAIqx.js","./dist-CQw2y-s3.js","./compiler-runtime-CVnuRdak.js","./checkbox-DBdFRrZg.js","./dist-CPXhSDT0.js","./button-DGf25ccp.js","./react-dom-C-oc-P2K.js","./dialog-Bt8vN5IM.js","./dist-BLu8fLv5.js","./dist-KER3mSN7.js","./collapsible-B9pRLq8V.js","./chevron-right-jyIhGBkw.js","./project-paths-CK_36JyE.js","./label-Bg6tgeFh.js","./radio-group-_aqBV1Ev.js","./dist-DEyMVsLW.js","./dist-Dpgw_p7D.js","./tooltip-D-omjYEX.js","./input-CFm7DcvJ.js","./textarea-BVfCks43.js","./McpConsentDialogBody-BmNZ4WyJ.js","./mcp-consent-store-DZJQdxaS.js","./ActivityPanelDiffView-BO8reo7p.js","./ActivityPanelDiffView-legcy4jI.css","./GraphPanel-BOzNAXNR.js","./dist-Bjtzzcz_.js","./w3c-keyname-CO1Sq6Ug.js","./documents-events-B7iSYQul.js","./toggle-group-Bwdb9pNj.js","./panel-BbrtnF__.js","./min-DX8PS56Y.js","./src-D_6tSLtQ.js","./colors-C23yJeS9.js","./ordinal-BRkB4leE.js","./init-CLIhTc-7.js","./isObjectLike-B6rhnmNR.js","./now-jv_Sei15.js","./isSymbol-C5HN6O5S.js","./prop-types-DXyNHDSH.js","./navigation-targets-BBvp-Gxt.js","./startup-marks-DX3HfdcU.js","./target-navigation-intent-nE1R65kM.js","./external-link-CJXR-UFu.js","./ActivityModeContent-B64TMVp3.js","./DocumentContext-BlziVobJ.js","./dist-Det3ErjQ.js","./dist-CjXkcarO.js","./dist-m9JR0snv.js","./dist-HZjJQtoL2.js","./dist-pXD8nsnR.js","./dist-CikH4tpl.js","./dist-CEE3i3A0.js","./dist-7FuH8GMo.js","./dist-BPuPEdb6.js","./stex-C5SatQxm.js","./chevron-down-BaPMAfbX.js","./config-context-DhhN0rlf.js","./file-tree-rename-validation-B9K2lxjE.js","./DocumentContext-B0sQn39F.css","./agent-presence-CPRnxEOl.js","./cursor-CpjEfgnv.js","./dist-Bz14RHFY.js","./dist-BC_IrM4F.js","./SettingsDialogBody-CehseGeW.js","./open-managed-artifact-tab-BbQDONrv.js","./skills-api-C8yxC-Y8.js","./config-validation-events-VKG3DgLl.js","./skill-actions-8oZwtKvr.js","./keyboard-shortcuts-BanMswAs.js","./ManagedArtifactProperties-CYtk8Bqt.js","./PropertyPanel-DUcQoy8A.js","./format-C-cvY9tz.js","./selection-context-3bzSsUeV.js","./SourceEditor-Cd7sWXXb.js","./typing-burst-detector-CiXPtnXN.js","./SkillEditorActions-SkSo8rGK.js","./TerminalPanel-C7GMKqtO.js","./file-tree-adapter-CxLAzSjb.js","./TerminalPanel-BrP-ENHg.css","./telemetry-startup-mmkCxwyh.js"])))=>i.map(i=>d[i]);
2
2
  import{o as e,t}from"./chunk-CFjPhJqf.js";import{t as n}from"./preload-helper-2ej06EnG.js";import{n as r,r as i,t as a}from"./compiler-runtime-CVnuRdak.js";import{$n as o,$t as s,A as c,At as l,B as u,Bn as d,Bt as f,Cn as p,Ct as m,D as h,Dr as g,Dt as _,En as v,Er as y,Et as b,F as x,Ft as S,G as C,Gn as w,Gt as T,H as E,Hn as D,Ht as O,I as k,It as A,Jn as j,Jt as M,K as N,Kn as P,Kt as F,L as I,Lt as L,Nt as R,O as z,Or as B,Ot as V,Pt as H,Q as U,Qn as W,Qt as G,R as K,Rn as ee,Rt as te,Sn as q,Sr as J,St as ne,Tr as re,Tt as ie,U as ae,Un as oe,Ut as se,V as ce,Vn as le,Vt as ue,W as de,Wn as fe,Wt as pe,Xn as me,Xt as he,Yn as ge,Yt as _e,Zt as ve,_n as ye,_t as be,a as xe,an as Se,ar as Ce,at as we,bn as Te,br as Ee,bt as De,c as Oe,cn as ke,cr as Ae,ct as je,d as Me,dn as Ne,dr as Pe,dt as Fe,en as Ie,er as Le,et as Re,f as ze,fn as Be,fr as Ve,ft as He,g as Ue,gn as We,gr as Ge,gt as Ke,h as qe,hn as Je,hr as Ye,ht as Xe,i as Ze,in as Qe,ir as $e,it as et,j as tt,k as nt,kt as rt,l as it,ln as at,lr as ot,lt as st,m as ct,mn as lt,mr as ut,mt as dt,n as ft,nn as pt,nr as mt,o as ht,on as gt,or as _t,ot as vt,p as yt,pn as bt,pr as xt,pt as St,q as Ct,qn as wt,qt as Tt,r as Et,rn as Dt,rr as Ot,rt as kt,s as At,sn as jt,sr as Mt,st as Nt,t as Pt,tn as Ft,tr as It,tt as Lt,u as Rt,un as zt,ur as Bt,ut as Vt,v as Ht,vn as Ut,vr as Wt,vt as Gt,wn as Kt,wr as qt,wt as Jt,xn as Yt,xt as Xt,y as Zt,yn as Qt,yt as $t,z as en,zn as tn,zt as nn}from"./DocumentContext-BlziVobJ.js";import{n as Y,r as rn,t as an}from"./dist-CQw2y-s3.js";import{A as on,C as sn,D as cn,E as ln,O as un,S as dn,T as fn,_ as pn,a as mn,b as hn,c as gn,d as _n,f as vn,g as yn,h as bn,i as xn,k as Sn,l as Cn,m as wn,n as Tn,o as En,p as Dn,r as On,s as kn,t as An,u as jn,v as Mn,w as Nn,x as Pn,y as Fn}from"./panel-BbrtnF__.js";import{$r as In,A as Ln,Ai as Rn,Ar as zn,Br as Bn,Ct as Vn,D as Hn,Dt as Un,E as Wn,En as Gn,F as Kn,Fn as qn,Ft as Jn,Gi as Yn,Hi as Xn,Hr as Zn,Ht as Qn,K as $n,Li as er,Mi as tr,Mr as nr,Nr as rr,O as ir,Or as ar,Ot as or,P as sr,Pi as cr,Pr as lr,Rn as ur,S as dr,Sn as fr,Sr as pr,Ui as mr,Vi as hr,Vn as gr,Wi as _r,Wn as vr,Wt as yr,Xr as br,Xt as xr,Yr as Sr,Yt as Cr,_n as wr,_r as Tr,ai as Er,an as Dr,bn as Or,br as kr,ci as Ar,cn as jr,cr as Mr,ct as Nr,di as Pr,dn as Fr,dr as Ir,ei as Lr,fi as Rr,fn as zr,fr as Br,gn as Vr,gr as Hr,jr as Ur,jt as Wr,k as Gr,ln as Kr,mt as qr,n as Jr,ni as Yr,nn as Xr,o as Zr,or as Qr,pr as $r,pt as ei,r as ti,rt as ni,t as ri,ti as ii,tr as ai,ui as oi,un as si,v as ci,vn as li,vr as ui,w as di,wn as fi,wr as pi,wt as mi,x as hi,xr as gi,zi as _i,zn as vi,zr as yi}from"./dist-Bjtzzcz_.js";import{t as bi}from"./react-dom-C-oc-P2K.js";import{c as xi,l as X,r as Si,t as Ci,u as wi}from"./button-DGf25ccp.js";import{a as Ti,c as Ei,i as Di,l as Oi,n as ki,o as Ai,r as ji,s as Mi,t as Ni}from"./agent-presence-CPRnxEOl.js";import{$ as Pi,B as Fi,C as Ii,D as Li,E as Ri,F as zi,G as Bi,I as Vi,J as Hi,K as Ui,L as Wi,N as Gi,O as Ki,P as qi,Q as Ji,R as Yi,V as Xi,W as Zi,X as Qi,Y as $i,Z as ea,_ as ta,_t as na,at as ra,c as ia,ct as aa,dt as oa,et as sa,f as ca,ft as la,g as ua,gt as da,h as fa,ht as pa,it as ma,k as ha,lt as ga,mt as _a,nt as va,o as ya,ot as ba,pt as xa,q as Sa,r as Ca,rt as wa,s as Ta,st as Ea,t as Da,tt as Oa,ut as ka,v as Aa,vt as ja,w as Ma,yt as Na,z as Pa}from"./config-validation-events-VKG3DgLl.js";import{i as Fa,n as Ia,r as La,t as Ra}from"./toggle-group-Bwdb9pNj.js";import{a as za,c as Ba,d as Va,i as Ha,l as Ua,o as Wa,r as Ga,s as Ka,t as qa,u as Ja}from"./PropertyPanel-DUcQoy8A.js";import{_ as Ya,a as Xa,c as Za,i as Qa,n as $a,o as eo,s as to,t as no}from"./dialog-Bt8vN5IM.js";import{t as ro}from"./chevron-down-BaPMAfbX.js";import{t as io}from"./chevron-right-jyIhGBkw.js";import{a as ao,c as oo,i as so,l as co,n as lo,u as uo}from"./prop-types-DXyNHDSH.js";import{A as fo,C as po,D as mo,E as ho,O as go,S as _o,T as vo,_ as yo,a as bo,c as xo,d as So,g as Co,h as wo,i as To,k as Eo,l as Do,m as Oo,n as ko,o as Ao,p as jo,r as Mo,s as No,u as Po,v as Fo,w as Io,x as Lo,y as Ro}from"./skill-actions-8oZwtKvr.js";import{a as zo,c as Bo,d as Vo,f as Ho,i as Uo,l as Wo,m as Go,n as Ko,o as qo,p as Jo,r as Yo,u as Xo}from"./config-context-DhhN0rlf.js";import{_ as Zo,c as Qo,f as $o,g as es,h as ts,i as ns,l as rs,m as is,o as as,p as os,s as ss,t as cs,u as ls,v as us,y as ds}from"./open-managed-artifact-tab-BbQDONrv.js";import{i as fs,n as ps,r as ms,t as hs}from"./collapsible-B9pRLq8V.js";import{a as gs,i as _s,r as vs,t as ys}from"./cursor-CpjEfgnv.js";import{n as bs,r as xs,t as Ss}from"./dist-BLu8fLv5.js";import{a as Cs,c as ws,l as Ts,n as Es,o as Ds,r as Os,s as ks,u as As}from"./documents-events-B7iSYQul.js";import{t as js}from"./external-link-CJXR-UFu.js";import{a as Ms,d as Ns,f as Ps,i as Fs,l as Is,o as Ls,s as Rs}from"./dist-CPXhSDT0.js";import{i as zs,n as Bs,r as Vs,t as Hs}from"./tooltip-D-omjYEX.js";import{c as Us,d as Ws,f as Gs,g as Ks,h as qs,l as Js,m as Ys,o as Xs,p as Zs,s as Qs,u as $s}from"./dist-DEyMVsLW.js";import{t as ec}from"./checkbox-DBdFRrZg.js";import{n as tc,r as nc,t as rc}from"./dist-Dpgw_p7D.js";import{A as ic,B as ac,C as oc,D as sc,E as cc,F as lc,H as uc,I as dc,L as fc,M as pc,N as mc,O as hc,P as gc,R as _c,S as vc,T as yc,V as bc,_ as xc,g as Sc,h as Cc,i as wc,j as Tc,k as Ec,m as Dc,o as Oc,p as kc,r as Ac,u as jc,v as Mc,w as Nc,x as Pc,z as Fc}from"./skills-api-C8yxC-Y8.js";import{t as Ic}from"./label-Bg6tgeFh.js";import{n as Lc,t as Rc}from"./radio-group-_aqBV1Ev.js";import{t as zc}from"./input-CFm7DcvJ.js";import{a as Bc,i as Vc,n as Hc,r as Uc}from"./project-paths-CK_36JyE.js";import{n as Wc,t as Gc}from"./mcp-consent-store-DZJQdxaS.js";import{C as Kc,D as qc,E as Jc,O as Yc,S as Xc,T as Zc,_ as Qc,a as $c,b as el,d as tl,f as nl,g as rl,h as il,i as al,m as ol,n as sl,o as cl,p as ll,r as ul,u as dl,v as fl,w as pl,x as ml,y as hl}from"./navigation-targets-BBvp-Gxt.js";import{a as gl,i as _l,o as vl}from"./startup-marks-DX3HfdcU.js";import{n as yl,r as bl,t as xl}from"./file-tree-rename-validation-B9K2lxjE.js";import{c as Sl,i as Cl,l as wl,o as Tl}from"./keyboard-shortcuts-BanMswAs.js";import{$ as El,At as Dl,Ct as Ol,Dt as kl,Ft as Al,I as jl,It as Ml,J as Nl,Mt as Pl,Ot as Fl,Pt as Il,Q as Ll,Tt as Rl,X as zl,Z as Bl,at as Vl,bt as Hl,jt as Ul,k as Wl,w as Gl}from"./dist-CjXkcarO.js";import{n as Kl}from"./dist-7FuH8GMo.js";import{c as ql,f as Jl,g as Yl,i as Xl,l as Zl,n as Ql,o as $l,p as eu,r as tu,s as nu,t as ru,u as iu}from"./typing-burst-detector-CiXPtnXN.js";import{t as au}from"./target-navigation-intent-nE1R65kM.js";import"./textarea-BVfCks43.js";import{c as ou,i as su,n as cu,r as lu,s as uu,u as du}from"./selection-context-3bzSsUeV.js";import{C as fu,D as pu,E as mu,O as hu,S as gu,T as _u,_ as vu,a as yu,b as bu,c as xu,d as Su,f as Cu,g as wu,h as Tu,i as Eu,k as Du,l as Ou,m as ku,n as Au,o as ju,p as Mu,r as Nu,s as Pu,t as Fu,u as Iu,v as Lu,w as Ru,x as zu,y as Bu}from"./file-tree-adapter-CxLAzSjb.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 Vu(){({BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_APP_VERSION:`0.23.0`})?.VITE_OTEL_ENABLED===`true`&&n(()=>import(`./telemetry-impl-BxLbJWUi.js`).then(e=>e.install()),__vite__mapDeps([0,1,2,3,4]),import.meta.url)}function Hu(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{yn(e,()=>t.signal,()=>n=!0)},u=Fn(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject();if(r==null&&e.pages.length)return Promise.resolve(e);let a=await u((()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})()),{maxPages:o}=t.options,s=i?Mn:pn;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?Wu:Uu,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:Uu(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function Uu(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Wu(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var Gu=class extends vn{#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||Ku(),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=Dn({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),bn.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Ku(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var qu=class extends on{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 Gu({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=Ju(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=Ju(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=Ju(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=Ju(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){bn.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=>sn(t,e))}findAll(e={}){return this.getAll().filter(t=>sn(e,t))}notify(e){bn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return bn.batch(()=>Promise.all(e.map(e=>e.continue().catch(fn))))}};function Ju(e){return e.options.scope?.id}var Yu=class extends on{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??dn(r,t),a=this.get(i);return a||(a=new _n({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(){bn.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=>Nn(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Nn(e,t)):t}notify(e){bn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){bn.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){bn.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Xu=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Yu,this.#t=e.mutationCache||new qu,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=Sn.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=wn.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(cn(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=hn(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return bn.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;bn.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return bn.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=bn.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(fn).catch(fn)}invalidateQueries(e,t={}){return bn.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=bn.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(fn)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(fn)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(cn(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(fn).catch(fn)}fetchInfiniteQuery(e){return e.behavior=Hu(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(fn).catch(fn)}ensureInfiniteQueryData(e){return e.behavior=Hu(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return wn.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(Pn(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{ln(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(Pn(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{ln(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||=dn(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===un&&(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()}},Zu=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}}}})),Qu=t(((e,t)=>{t.exports=Zu()})),$u=t((e=>{var t=Qu(),n=r(),i=bi();function a(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function o(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function s(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function c(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function u(e){if(s(e)!==e)throw Error(a(188))}function d(e){var t=e.alternate;if(!t){if(t=s(e),t===null)throw Error(a(188));return t===e?e:null}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var o=i.alternate;if(o===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===o.child){for(o=i.child;o;){if(o===n)return u(i),e;if(o===r)return u(i),t;o=o.sibling}throw Error(a(188))}if(n.return!==r.return)n=i,r=o;else{for(var c=!1,l=i.child;l;){if(l===n){c=!0,n=i,r=o;break}if(l===r){c=!0,r=i,n=o;break}l=l.sibling}if(!c){for(l=o.child;l;){if(l===n){c=!0,n=o,r=i;break}if(l===r){c=!0,r=o,n=i;break}l=l.sibling}if(!c)throw Error(a(189))}}if(n.alternate!==r)throw Error(a(190))}if(n.tag!==3)throw Error(a(188));return n.stateNode.current===n?e:t}function f(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=f(e),t!==null)return t;e=e.sibling}return null}var p=Object.assign,m=Symbol.for(`react.element`),h=Symbol.for(`react.transitional.element`),g=Symbol.for(`react.portal`),_=Symbol.for(`react.fragment`),v=Symbol.for(`react.strict_mode`),y=Symbol.for(`react.profiler`),b=Symbol.for(`react.consumer`),x=Symbol.for(`react.context`),S=Symbol.for(`react.forward_ref`),C=Symbol.for(`react.suspense`),w=Symbol.for(`react.suspense_list`),T=Symbol.for(`react.memo`),E=Symbol.for(`react.lazy`),D=Symbol.for(`react.activity`),O=Symbol.for(`react.memo_cache_sentinel`),k=Symbol.iterator;function A(e){return typeof e!=`object`||!e?null:(e=k&&e[k]||e[`@@iterator`],typeof e==`function`?e:null)}var j=Symbol.for(`react.client.reference`);function M(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===j?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case _:return`Fragment`;case y:return`Profiler`;case v:return`StrictMode`;case C:return`Suspense`;case w:return`SuspenseList`;case D:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case g:return`Portal`;case x:return e.displayName||`Context`;case b:return(e._context.displayName||`Context`)+`.Consumer`;case S:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case T:return t=e.displayName||null,t===null?M(e.type)||`Memo`:t;case E:t=e._payload,e=e._init;try{return M(e(t))}catch{}}return null}var N=Array.isArray,P=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,I={pending:!1,data:null,method:null,action:null},L=[],R=-1;function z(e){return{current:e}}function B(e){0>R||(e.current=L[R],L[R]=null,R--)}function V(e,t){R++,L[R]=e.current,e.current=t}var H=z(null),U=z(null),W=z(null),G=z(null);function K(e,t){switch(V(W,t),V(U,e),V(H,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}B(H),V(H,e)}function ee(){B(H),B(U),B(W)}function te(e){e.memoizedState!==null&&V(G,e);var t=H.current,n=Hd(t,e.type);t!==n&&(V(U,e),V(H,n))}function q(e){U.current===e&&(B(H),B(U)),G.current===e&&(B(G),Qf._currentValue=I)}var J,ne;function re(e){if(J===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);J=t&&t[1]||``,ne=-1<e.stack.indexOf(`
3
3
  at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
4
4
  `+J+e+ne}var ie=!1;function ae(e,t){if(!e||ie)return``;ie=!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(`
@@ -28,7 +28,7 @@ Error generating stack: `+e.message+`
28
28
  `).trim();return i.length===0||i.length>EE||i.includes(`
29
29
  `)?null:i}function jE(e){let t=Ke(e.state);return{current:t.matches.length===0?0:t.activeIndex+1,total:t.matches.length}}function ME(e,t){return e.current===t.current&&e.total===t.total}function NE(e,t,n){e&&!e.isDestroyed&&(e.commands.clearFindMatches(),e.commands.focus()),t(e=>({...e,open:!1,activeIndex:0})),n(TE)}function PE(e){!e||e.isDestroyed||typeof window>`u`||window.requestAnimationFrame(()=>{if(e.isDestroyed)return;let t=de(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 FE(e){let t=(0,$.c)(81),{activeDocName:n,isSourceMode:r}=e,i=OE(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)(TE),m,h;t[1]===n?(m=t[2],h=t[3]):(m=()=>{s.current!==n&&(s.current=n,d(LE))},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(IE)},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(TE);return}if(!u.open||r){i.commands.clearFindMatches(),p(TE);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=jE(i);p(t=>ME(t,e)?t:e)},DE);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=Ke(i.state),t=jE(i);p(e=>ME(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=AE(i);d(n=>({...n,open:!0,replaceOpen:e,query:t??n.query,activeIndex:0}))},t=function(t){if(!(!n||r||t.defaultPrevented)){if(wl(t,`find`)){t.preventDefault(),u.open?NE(i,d,p):e(!1);return}if(wl(t,`replace`)){t.preventDefault(),e(!0);return}if(u.open){let e=wl(t,`find-next`),n=wl(t,`find-previous`);if(e||n){t.preventDefault(),(n?i?.commands.selectPreviousFindMatch():i?.commands.selectNextFindMatch())&&PE(i);return}}t.key===`Escape`&&u.open&&(t.preventDefault(),NE(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=Ke(i.state),t=jE(i);p(e=>ME(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(){NE(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()&&PE(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()&&PE(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)&&PE(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)&&PE(i),N())},t[58]=j,t[59]=i,t[60]=u.replacement,t[61]=N,t[62]=H):H=t[62];let U=H;if(!u.open||!n||r)return null;let W,G,K,ee,te;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(W=e=>d(t=>({...t,query:e,activeIndex:0})),G=e=>d(t=>({...t,replacement:e})),K=e=>d(t=>({...t,replaceOpen:e})),ee=e=>d(t=>({...t,caseSensitive:e})),te=e=>d(t=>({...t,wholeWord:e})),t[63]=W,t[64]=G,t[65]=K,t[66]=ee,t[67]=te):(W=t[63],G=t[64],K=t[65],ee=t[66],te=t[67]);let q;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?(q=(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)(wE,{findInputRef:a,query:u.query,replacement:u.replacement,replaceOpen:u.replaceOpen,caseSensitive:u.caseSensitive,wholeWord:u.wholeWord,current:f.current,total:f.total,onQueryChange:W,onReplacementChange:G,onReplaceOpenChange:K,onCaseSensitiveChange:ee,onWholeWordChange:te,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]=q):q=t[80],q}function IE(e){return{...e,open:!1,activeIndex:0}}function LE(e){return{...e,activeIndex:0}}var RE=300;function zE(e,t){let n=(0,$.c)(4),[r,i]=(0,Q.useState)(ql),a,o;return n[0]!==t||n[1]!==e?(a=()=>{if(!e||!t){i(ql);return}let n=e.document.getText(`source`),r=!1,a=null,o=function(){r||i(Zl(n.toString()))};o();let s=function(){a&&clearTimeout(a),a=setTimeout(o,RE)};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 BE(e){return e&&e.document.getMap(`lifecycle`).get(`status`)===`conflict`?`conflict`:null}function VE(e){let t=(0,$.c)(8),{poolEntries:n}=ft(),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=()=>BE(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(BE(i));let t=()=>s(BE(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 HE(e,t){let n=(0,$.c)(3),r;return n[0]!==e||n[1]!==t?(r=()=>tu(e,t),n[0]=e,n[1]=t,n[2]=r):r=n[2],(0,Q.useSyncExternalStore)(nu,r)}var UE=`ok-doc-panel-width-v1`;function WE(e){return Number.isFinite(e)?e<300?300:e>600?600:Math.round(e):320}function GE(e){try{let t=(e??localStorage).getItem(UE);if(t==null)return 320;let n=Number.parseInt(t,10);return Number.isFinite(n)?WE(n):320}catch{return 320}}function KE(e,t){try{(t??localStorage).setItem(UE,String(WE(e)))}catch{}}function qE(){try{return typeof localStorage>`u`?320:GE()}catch{return 320}}var JE=1024,YE=1280,XE={left:JE,right:YE};function ZE(e,t,n){return e==null?t>=XE[n]?`above`:`below`:`embedded`}function QE(e){return e===`above`?`open`:`collapsed`}var $E=`ok-sidebar-pins-v2`;function eD(e){return e===`open`||e===`collapsed`}function tD(e){return e===`above`||e===`below`||e===`embedded`}function nD(e){if(typeof e!=`object`||!e)return!1;let t=e;for(let e of Object.keys(t))if(!tD(e)||!eD(t[e]))return!1;return!0}function rD(e){let t=JSON.parse(e);if(typeof t!=`object`||!t)return{};let n=t,r={};return nD(n.left)&&(r.left=n.left),nD(n.right)&&(r.right=n.right),r}function iD(e){try{let t=(e??localStorage).getItem($E);return t==null?{}:rD(t)}catch{return{}}}function aD(e,t){try{t.setItem($E,JSON.stringify(e))}catch{}}function oD(e,t,n){return n[e]?.[t]??QE(t)}function sD(e,t,n,r){let i=r??localStorage,a=iD(i);return a[e]={...a[e],[t]:n},aD(a,i),a}var cD=`ok-terminal-width-v1`;function lD(e){return Number.isFinite(e)?e<320?320:e>900?900:Math.round(e):480}function uD(e){try{let t=(e??localStorage).getItem(cD);if(t==null)return 480;let n=Number.parseInt(t,10);return Number.isFinite(n)?lD(n):480}catch{return 480}}function dD(e,t){try{(t??localStorage).setItem(cD,String(lD(e)))}catch{}}function fD(){try{return typeof localStorage>`u`?480:uD()}catch{return 480}}function pD(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`?mD: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 mD(e){return e===`synced`?`synced`:`connected`}function hD(e){let t=e.lastIndexOf(`/`);return t>=0?e.slice(t+1):e}function gD(e){let t=(0,$.c)(21),{path:n,onRemove:r}=e,{_:i}=rn(),a,o;t[0]!==i||t[1]!==n?(a=hD(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)(zt,{path:n,className:`size-3`})}),t[6]=n,t[7]=u);let d;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(xs,{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)(Ci,{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 _D(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=X(`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)(gD,{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 vD(e){let t=(0,$.c)(35),{primary:n,onPrimary:r,primaryDisabled:i,installedTargets:a,selectedTargetId:o,onSelectTarget:s,terminal:c,terminals:l,menuEmptyState:u,onMenuOpenChange:d,menuAlign:f,triggerAriaLabel:p,testIds:m}=e,h=i===void 0?!1:i,g=f===void 0?`end`:f,{_}=rn(),v=a.length>0,y=l&&l.length>0?l:null,b=y!=null||c!=null,x=v||b,S;t[0]===m?S=t[1]:(S=e=>typeof m.terminal==`function`?m.terminal(e):m.terminal,t[0]=m,t[1]=S);let C=S,w;t[2]!==r||t[3]!==n||t[4]!==h||t[5]!==m.primary?(w=(0,Z.jsx)(Ci,{type:`button`,variant:`outline`,className:`gap-1.5`,disabled:h,onClick:r,"data-testid":m.primary,children:n}),t[2]=r,t[3]=n,t[4]=h,t[5]=m.primary,t[6]=w):w=t[6];let T;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(ro,{"aria-hidden":`true`,className:`size-3.5 text-muted-foreground`}),t[7]=T):T=t[7];let E;t[8]!==m.trigger||t[9]!==p?(E=(0,Z.jsx)(yc,{asChild:!0,children:(0,Z.jsx)(Ci,{type:`button`,variant:`outline`,size:`icon`,"aria-label":p,"data-testid":m.trigger,children:T})}),t[8]=m.trigger,t[9]=p,t[10]=E):E=t[10];let D;t[11]!==_||t[12]!==y||t[13]!==x||t[14]!==a||t[15]!==u||t[16]!==s||t[17]!==o||t[18]!==v||t[19]!==b||t[20]!==c||t[21]!==C||t[22]!==m?(D=x?(0,Z.jsxs)(Z.Fragment,{children:[b?(0,Z.jsxs)(Sc,{"aria-label":_({id:`ALhMYW`}),children:[(0,Z.jsx)(Mc,{children:(0,Z.jsx)(Y,{id:`ALhMYW`})}),y?y.map(e=>(0,Z.jsxs)(xc,{onSelect:e.onSelect,"data-testid":C(e.cli),"aria-label":e.ariaLabel,children:[(0,Z.jsx)(So,{id:xo(e.cli),className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:e.label}),e.selected?(0,Z.jsx)(Ya,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.cli)):c?(0,Z.jsxs)(xc,{onSelect:c.onSelect,"data-testid":C(`claude`),"aria-label":_({id:`AcK_r0`}),children:[(0,Z.jsx)(So,{id:xo(`claude`),className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(Y,{id:`fcgvCA`})}),c.selected?(0,Z.jsx)(Ya,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]}):null]}):null,v?(0,Z.jsxs)(Z.Fragment,{children:[b?(0,Z.jsx)(Pc,{}):null,(0,Z.jsxs)(Sc,{"aria-label":_({id:`BBqGS9`}),children:[(0,Z.jsx)(Mc,{children:(0,Z.jsx)(Y,{id:`BBqGS9`})}),a.map(e=>(0,Z.jsxs)(xc,{onSelect:()=>s(e),"data-testid":m.option(e.id),children:[(0,Z.jsx)(So,{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)(Ya,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.id))]})]}):null]}):u,t[11]=_,t[12]=y,t[13]=x,t[14]=a,t[15]=u,t[16]=s,t[17]=o,t[18]=v,t[19]=b,t[20]=c,t[21]=C,t[22]=m,t[23]=D):D=t[23];let O;t[24]!==g||t[25]!==D||t[26]!==m.menu?(O=(0,Z.jsx)(Cc,{align:g,className:`min-w-[200px]`,"data-testid":m.menu,children:D}),t[24]=g,t[25]=D,t[26]=m.menu,t[27]=O):O=t[27];let k;t[28]!==d||t[29]!==E||t[30]!==O?(k=(0,Z.jsxs)(kc,{onOpenChange:d,children:[E,O]}),t[28]=d,t[29]=E,t[30]=O,t[31]=k):k=t[31];let A;return t[32]!==w||t[33]!==k?(A=(0,Z.jsxs)(XC,{children:[w,k]}),t[32]=w,t[33]=k,t[34]=A):A=t[34],A}function yD(e){return tl(e).filter(e=>e.kind===`document`||e.kind===`folder`).length}async function bD(){let e=await fetch(`/api/documents`);if(!e.ok)throw Error(`documents request failed: ${e.status}`);let t=await e.json(),n=Hn.safeParse(t);if(!n.success)throw Error(`documents response did not match schema`,{cause:n.error});return yD(n.data.documents)}async function xD(e=eg){let t=e.getSnapshot();if(!(t.steps.file||!t.initialized))try{await bD()>=1&&e.markStepComplete(`file`)}catch(e){console.warn(`[onboarding-signals] file-step count read failed; leaving step incomplete`,e)}}function SD(e=eg){e.getSnapshot().initialized&&e.markStepComplete(`askedAi`)}var CD=5200,wD=500;function TD(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName.toUpperCase();return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`}function ED(){let e=(0,$.c)(2),[t,n]=(0,Q.useState)(DD),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 DD(){return typeof window<`u`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function OD(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),CD);return()=>clearTimeout(e)}let e=setTimeout(()=>{i(kD),o(!0)},wD);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 kD(e){return e+1}function AD(e){let t=(0,$.c)(153),{docName:n,surface:r,folderPath:i,dismissed:a,onDismiss:o,onReopen:s}=e,c=a===void 0?!1:a,{_:l}=rn(),u=i!==void 0,d=u?null:n??null,f=r??`wysiwyg`,p=ED(),m=mo(),{states:h}=Oo(),{dispatch:g}=Io(),_=Po(),[v]=(0,Q.useState)(VD),[y,b]=(0,Q.useState)(null),x=Iy(),[S,C]=(0,Q.useState)(!0),[w,T]=(0,Q.useState)(!1),E=(0,Q.useRef)(null),D=(0,Q.useRef)(null),[O]=(0,Q.useState)(BD),k,A;t[0]!==c||t[1]!==n||t[2]!==u||t[3]!==r?(k=()=>{if(u||n==null)return;let e=document.documentElement,t=RD,i=()=>{r===`wysiwyg`&&requestAnimationFrame(()=>{let e=pe(n),t=D.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=D.current;if(c||!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`)}},A=[c,r,n,u],t[0]=c,t[1]=n,t[2]=u,t[3]=r,t[4]=k,t[5]=A):(k=t[4],A=t[5]),(0,Q.useEffect)(k,A);let j=(0,Q.useRef)(c),M=(0,Q.useRef)(s),N;t[6]!==c||t[7]!==s?(N=()=>{j.current=c,M.current=s},t[6]=c,t[7]=s,t[8]=N):N=t[8],(0,Q.useEffect)(N);let P,F;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(P=()=>Ql(()=>{j.current?M.current?.():E.current?.focus()}),F=[],t[9]=P,t[10]=F):(P=t[9],F=t[10]),(0,Q.useEffect)(P,F);let I;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(I=[],t[11]=I):I=t[11],(0,Q.useEffect)(ID,I);let L=(0,Q.useRef)(!1),R,z;t[12]===c?(R=t[13],z=t[14]):(R=()=>{if(!L.current){L.current=!0;return}c||E.current?.focus()},z=[c],t[12]=c,t[13]=R,t[14]=z),(0,Q.useEffect)(R,z);let B;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(B=[],t[15]=B):B=t[15];let[V,H]=(0,Q.useState)(B),[U,W]=(0,Q.useState)(FD),G;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(G=[],t[16]=G):G=t[16];let[K,ee]=(0,Q.useState)(G),te;t[17]!==n||t[18]!==u?(te=u||n==null?``:vo(n),t[17]=n,t[18]=u,t[19]=te):te=t[19];let q=te,J,ne;t[20]!==q||t[21]!==U||t[22]!==u||t[23]!==S?(J=()=>{u||S||H(e=>e.includes(q)||U.has(q)?e:[...e,q])},ne=[u,S,q,U],t[20]=q,t[21]=U,t[22]=u,t[23]=S,t[24]=J,t[25]=ne):(J=t[24],ne=t[25]),(0,Q.useEffect)(J,ne);let re;t[26]!==U||t[27]!==u||t[28]!==i||t[29]!==K||t[30]!==V?(re=u?i&&!U.has(i)&&!K.includes(i)?[i]:[]:V.filter(e=>!U.has(e)&&!K.includes(e)),t[26]=U,t[27]=u,t[28]=i,t[29]=K,t[30]=V,t[31]=re):re=t[31];let ie=re,ae=Ga(d,f),oe=Ga(d,`frontmatter`),[se,ce]=(0,Q.useState)(null),[le,ue]=(0,Q.useState)(!1),de,fe;t[32]===ae?(de=t[33],fe=t[34]):(de=()=>{ae&&ce(ae)},fe=[ae],t[32]=ae,t[33]=de,t[34]=fe),(0,Q.useEffect)(de,fe);let me,he;t[35]===oe?(me=t[36],he=t[37]):(me=()=>{oe&&ce(oe)},he=[oe],t[35]=oe,t[36]=me,t[37]=he),(0,Q.useEffect)(me,he);let ge=y??v,_e;t[38]!==ge||t[39]!==_?(_e=_===null?null:Wy(ge),t[38]=ge,t[39]=_,t[40]=_e):_e=t[40];let ve=_e,ye;t[41]!==ge||t[42]!==x||t[43]!==_?(ye=_!==null&&ge===null?Yy(null,x):null,t[41]=ge,t[42]=x,t[43]=_,t[44]=ye):ye=t[44];let be=ve??ye,xe=be!==null,Se;t[45]!==ge||t[46]!==xe||t[47]!==h?(Se=xe?null:Jy(h,ge),t[45]=ge,t[46]=xe,t[47]=h,t[48]=Se):Se=t[48];let Ce=Se,we=!w&&(!S||se!==null)&&(xe||Ce!==null),Te;t[49]===h?Te=t[50]:(Te=go.filter(e=>h[e.id]?.installed===!0),t[49]=h,t[50]=Te);let Ee=Te,De;t[51]===h?De=t[52]:(De=go.some(e=>h[e.id]?.installed==null),t[51]=h,t[52]=De);let Oe=De,ke=_===null?void 0:mi.map(e=>{let{displayName:t}=Vn[e];return{cli:e,label:t,ariaLabel:l({id:`QYfQdv`,values:{displayName:t}}),selected:be===e,onSelect:()=>Re(e)}}),Ae;t[53]===l?Ae=t[54]:(Ae=l({id:`KYSocE`}),t[53]=l,t[54]=Ae);let je;t[55]===l?je=t[56]:(je=l({id:`7Ongq0`}),t[55]=l,t[56]=je);let Me;t[57]===l?Me=t[58]:(Me=l({id:`HPTPGr`}),t[57]=l,t[58]=Me);let Ne;t[59]===l?Ne=t[60]:(Ne=l({id:`qiRoLb`}),t[59]=l,t[60]=Ne);let Pe;t[61]!==Ae||t[62]!==je||t[63]!==Me||t[64]!==Ne?(Pe=[Ae,je,Me,Ne],t[61]=Ae,t[62]=je,t[63]=Me,t[64]=Ne,t[65]=Pe):Pe=t[65];let Fe=OD(Pe,!p&&S&&!c),Ie;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=e=>{b(e.id),qy(e.id)},t[66]=Ie):Ie=t[66];let Le=Ie,Re=e=>{let t=Uy(e);b(t),qy(t)},ze;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(ze=()=>{E.current?.clear(),ce(null),ue(!1),H([]),W(new Set),JC()},t[67]=ze):ze=t[67];let Be=ze,Ve;t[68]!==l||t[69]!==g||t[70]!==Ce||t[71]!==be||t[72]!==_?(Ve=e=>{if(e===null){bs.error(l({id:`y8B54M`}));return}if(be!==null&&_!==null){try{_.launchInTerminal(e,be)}catch{bs.error(l({id:`jBVUXo`}));return}SD(),Be();return}Ce!==null&&(T(!0),g(Ce.id,e).then(PD).finally(()=>{T(!1),Be()}))},t[68]=l,t[69]=g,t[70]=Ce,t[71]=be,t[72]=_,t[73]=Ve):Ve=t[73];let He=Ve,Ue;t[74]!==q||t[75]!==we||t[76]!==He||t[77]!==n||t[78]!==ie||t[79]!==u||t[80]!==i||t[81]!==se||t[82]!==m?(Ue=()=>{if(!we)return;let{instruction:e,mentions:t}=E.current?.getContent()??{instruction:``,mentions:[]};if(u){He(wo({docName:null,folderRelativePath:i,workspace:m,instruction:e,mentions:[...new Set([...ie,...t])].filter(e=>e!==i)}));return}let r=se?ou(se):void 0,a=se?.docName??null,o=se?a:ie.includes(q)?n??null:null,s=o===null?null:vo(o);He(wo({docName:o,workspace:m,instruction:e,mentions:[...new Set([...ie,...t])].filter(e=>e!==s),selection:r}))},t[74]=q,t[75]=we,t[76]=He,t[77]=n,t[78]=ie,t[79]=u,t[80]=i,t[81]=se,t[82]=m,t[83]=Ue):Ue=t[83];let We=Ue;if(c)return null;let Ge=``,Ke=``;if(se){let e;t[84]===se?e=t[85]:(e=su(se,vo(se.docName).split(`/`).pop()??``),t[84]=se,t[85]=e),Ge=e;let n;t[86]===se.markdown?n=t[87]:(n=cu(se.markdown),t[86]=se.markdown,t[87]=n),Ke=n}let qe;t[88]!==l||t[89]!==u||t[90]!==o?(qe=u?null:(0,Z.jsx)(Ci,{type:`button`,variant:`outline`,"aria-label":l({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)(ro,{className:`size-3.5`,"aria-hidden":!0})}),t[88]=l,t[89]=u,t[90]=o,t[91]=qe):qe=t[91];let Je;t[92]===Symbol.for(`react.memo_cache_sentinel`)?(Je=e=>W(t=>{let n=new Set(t);return n.add(e),n}),t[92]=Je):Je=t[92];let Ye;t[93]!==l||t[94]!==Ge||t[95]!==Ke||t[96]!==se||t[97]!==le?(Ye=se?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`span`,{"data-testid":`composer-selection-pill`,title:Ge,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)(Ci,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":l({id:`irrm_E`}),onClick:()=>{ce(null),ue(!1)},className:`group/remove relative size-3.5 shrink-0 rounded-sm text-muted-foreground/80 hover:text-foreground`,children:[(0,Z.jsx)(Tf,{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)(xs,{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)(Ci,{type:`button`,variant:`ghost`,"aria-expanded":le,"aria-label":l(le?{id:`UaDyeb`}:{id:`eTL5y9`}),onClick:()=>ue(ND),"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:Ge})})]}),le&&Ke!==``?(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:Ke}):null]}):null,t[93]=l,t[94]=Ge,t[95]=Ke,t[96]=se,t[97]=le,t[98]=Ye):Ye=t[98];let Xe;t[99]!==ie||t[100]!==Ye?(Xe=(0,Z.jsx)(_D,{files:ie,onRemoveFile:Je,children:Ye}),t[99]=ie,t[100]=Ye,t[101]=Xe):Xe=t[101];let Ze;t[102]===l?Ze=t[103]:(Ze=l({id:`xWEvuo`}),t[102]=l,t[103]=Ze);let Qe;t[104]!==O||t[105]!==We||t[106]!==Ze?(Qe=(0,Z.jsx)(hw,{ref:E,ariaLabel:Ze,onEmptyChange:C,onContentChange:qC,onMentionsChange:ee,onSubmit:We,initialDoc:O,className:`max-h-[200px] overflow-y-auto text-base md:text-sm`}),t[104]=O,t[105]=We,t[106]=Ze,t[107]=Qe):Qe=t[107];let $e;t[108]!==S||t[109]!==p||t[110]!==Fe?($e=S?(0,Z.jsx)(`div`,{"aria-hidden":!0,className:X(`pointer-events-none absolute inset-0 truncate px-0 py-1 text-base text-muted-foreground/60 md:text-sm`,!p&&`transition-opacity duration-500 ease-in-out`,Fe.visible?`opacity-100`:`opacity-0`),children:Fe.text}):null,t[108]=S,t[109]=p,t[110]=Fe,t[111]=$e):$e=t[111];let et;t[112]!==Qe||t[113]!==$e?(et=(0,Z.jsxs)(`div`,{className:`relative flex-1`,children:[Qe,$e]}),t[112]=Qe,t[113]=$e,t[114]=et):et=t[114];let tt;t[115]!==Ce||t[116]!==be?(tt=be===null?Ce?(0,Z.jsx)(So,{id:Ce.id,className:`size-4`,"aria-hidden":!0}):null:(0,Z.jsx)(So,{id:xo(be),className:`size-4`,"aria-hidden":!0}),t[115]=Ce,t[116]=be,t[117]=tt):tt=t[117];let nt;t[118]!==Ce||t[119]!==be?(nt=(0,Z.jsx)(`span`,{children:be===null?Ce?(0,Z.jsx)(Y,{id:`nUNZL4`,values:{0:Ce.displayName}}):(0,Z.jsx)(Y,{id:`F-vBv0`}):(0,Z.jsx)(Y,{id:`ti6aF_`,values:{0:Vn[be].displayName}})}),t[118]=Ce,t[119]=be,t[120]=nt):nt=t[120];let rt;t[121]===w?rt=t[122]:(rt=w?(0,Z.jsx)(Vo,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):null,t[121]=w,t[122]=rt);let it;t[123]!==tt||t[124]!==nt||t[125]!==rt?(it=(0,Z.jsxs)(Z.Fragment,{children:[tt,nt,rt]}),t[123]=tt,t[124]=nt,t[125]=rt,t[126]=it):it=t[126];let at=!we,ot=xe?null:Ce?.id??null,st;t[127]===Oe?st=t[128]:(st=(0,Z.jsx)(`p`,{className:`px-2 py-1.5 text-sm text-muted-foreground`,"aria-live":`polite`,children:Oe?(0,Z.jsx)(Y,{id:`EcR0fl`}):(0,Z.jsx)(Y,{id:`l6OXqI`})}),t[127]=Oe,t[128]=st);let ct;t[129]===l?ct=t[130]:(ct=l({id:`nskygk`}),t[129]=l,t[130]=ct);let lt;t[131]===Symbol.for(`react.memo_cache_sentinel`)?(lt={primary:`ask-ai-send`,trigger:`ask-ai-agent-trigger`,menu:`ask-ai-agent-menu`,option:MD,terminal:jD},t[131]=lt):lt=t[131];let ut;t[132]!==ke||t[133]!==Le||t[134]!==Ee||t[135]!==We||t[136]!==it||t[137]!==at||t[138]!==ot||t[139]!==st||t[140]!==ct?(ut=(0,Z.jsx)(vD,{primary:it,onPrimary:We,primaryDisabled:at,installedTargets:Ee,selectedTargetId:ot,onSelectTarget:Le,terminals:ke,menuEmptyState:st,triggerAriaLabel:ct,testIds:lt}),t[132]=ke,t[133]=Le,t[134]=Ee,t[135]=We,t[136]=it,t[137]=at,t[138]=ot,t[139]=st,t[140]=ct,t[141]=ut):ut=t[141];let dt;t[142]!==et||t[143]!==ut?(dt=(0,Z.jsxs)(`div`,{className:`flex items-end gap-2`,children:[et,ut]}),t[142]=et,t[143]=ut,t[144]=dt):dt=t[144];let ft;t[145]!==qe||t[146]!==Xe||t[147]!==dt?(ft=(0,Z.jsxs)(`div`,{ref:D,className:`pointer-events-auto group relative flex 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:[qe,Xe,dt]}),t[145]=qe,t[146]=Xe,t[147]=dt,t[148]=ft):ft=t[148];let pt=ft;if(u){let e;return t[149]===pt?e=t[150]:(e=(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:pt})}),t[149]=pt,t[150]=e),e}let mt;return t[151]===pt?mt=t[152]:(mt=(0,Z.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-0 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:pt}),t[151]=pt,t[152]=mt),mt}function jD(e){return e===`claude`?`ask-ai-agent-option-terminal`:`ask-ai-agent-option-terminal-${e}`}function MD(e){return`ask-ai-agent-option-${e}`}function ND(e){return!e}function PD(e){e.ok&&SD()}function FD(){return new Set}function ID(){let e=LD;return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})}function LD(e){wl(e,`open-ask-ai`)&&(TD(e.target)||(e.preventDefault(),ru()))}function RD(){let e=[...document.querySelectorAll(`.editor-doc-scroll`)].filter(zD);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 zD(e){let t=e.scrollHeight-e.clientHeight;return t>0&&e.scrollTop>=t-40}function BD(){return KC().doc??void 0}function VD(){return Ky()}function HD(e){return!e.terminalVisible&&!e.isEmbedded&&e.isDesktop&&e.activeDocName!==null}function UD(e){return!e.terminalVisible&&!e.isEmbedded&&e.isDesktop}function WD(e,t={}){let n=we(e.componentName);return n.name===`*`?t.unregisteredSuffix?`${e.componentName} (unregistered)`:e.componentName:n.displayName??n.name}var GD=200,KD=`Outside any block`;function qD(e){let t=(0,$.c)(5),{editor:n}=e,r=Zt(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?JD(n,r):o.current?KD:``,a.current=window.setTimeout(()=>{i.current&&(i.current.textContent=``,i.current.textContent=t),o.current=e,a.current=null},GD),()=>{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 JD(e,t){if(!t||t.ancestorChain.length===0)return``;let n=t.ancestorChain,r=n[n.length-1],i=WD(r,{unregisteredSuffix:!0});if(n.length===1)return`Selected: ${i}`;let a=n[n.length-2],o=WD(a);try{let t=e.state.doc.resolve(r.pos),n=t.index(t.depth),a=t.parent.childCount;return`Selected: ${i}, ${n+1} of ${a} in ${o}`}catch{return`Selected: ${i} in ${o}`}}function YD(){let[e]=(0,Q.useState)(fr);return e}function XD({principal:e,identity:t}){return e&&e.source===`git-config`?{type:`human`,name:li(e.display_name),color:xr(e.id,Kn),coeditor:t.coeditor,tabId:t.tabId,principalId:e.id}:e&&e.source===`synthesized`?{type:`human`,name:t.name,color:xr(e.id,Kn),coeditor:t.coeditor,tabId:t.tabId}:{type:`human`,name:t.name,color:t.color,coeditor:t.coeditor,tabId:t.tabId}}function ZD(e,t){return e>t}function QD(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 $D=3,eO=6e4;function tO(e,t){let n=0;for(let r of e)t-r<eO&&(n+=1);return n<$D}var nO=new Map;function rO(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 iO(e){let t=Kt.getState(e);return t?.snapshot!=null||t?.prevSnapshot!=null}function aO(e){let{fragment:t,docName:n,onWedged:r}=e,i=0,a=0,o=!1,s=!1,c=!1,l=null,u=new WeakSet,d=e=>{let t=Kt.getState(e)?.binding;if(!t)return;if(typeof t._prosemirrorChanged!=`function`){gl.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=>{ZD(i,a)||r(e)}},f=()=>{if(c=!1,!s||o||!ZD(i,a)||l!==null&&iO(l.state))return;o=!0;let e=Date.now();for(let[t,n]of nO)n.every(t=>e-t>=eO)&&nO.delete(t);let t=(nO.get(n)??[]).filter(t=>e-t<eO);if(!tO(t,e)){nO.set(n,t),gl.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),nO.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,gl.count(`ok/editor/binding-wedge-recovery-error`,{docName:n}),console.error(`[binding-staleness-guard] wedge recovery threw for "${n}":`,e)}},p=e=>{e.origin!==Kt&&rO(e,t)&&(i+=1,c||(c=!0,queueMicrotask(f)))};return new Pr({state:{init:()=>null,apply:e=>(QD(e.getMeta(Kt))&&(a=i,o&&gl.count(`ok/editor/binding-wedge-recovered`,{docName:n}),o=!1),null)},filterTransaction:(e,t)=>!ZD(i,a)||iO(t)?!0:e.getMeta(Kt)!==void 0,view:e=>{let r=t.doc;return r==null?(gl.count(`ok/editor/binding-guard-disarmed`,{docName:n,reason:`no-ydoc`}),console.error(`[binding-staleness-guard] fragment has no Y.Doc for "${n}" — staleness guard disarmed`),{}):(s=!0,l=e,d(e.state),r.off(`beforeObserverCalls`,p),r.on(`beforeObserverCalls`,p),{destroy:()=>{s=!1,l=null,r.off(`beforeObserverCalls`,p)}})}})}function oO(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 sO=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&&Lr(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($s(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(Ys(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(Zs(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(Xs(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(qs(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(Qs(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(Ws(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(Gs(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=Yr(this.view,e.from,e.to),r={getBoundingClientRect:()=>n,getClientRects:()=>[n]};if(e instanceof oi){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 lr){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():oO(o.getBoundingClientRect(),s.getBoundingClientRect());r={getBoundingClientRect:()=>c,getClientRects:()=>[c]}}return r}updatePosition(){if(!this.isVisible)return;let e=this.virtualElement;e&&Js(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()}},cO=e=>new Pr({key:typeof e.pluginKey==`string`?new Rr(e.pluginKey):e.pluginKey,view:t=>new sO({view:t,...e})});Bn.create({name:`bubbleMenu`,addOptions(){return{element:null,pluginKey:`bubbleMenu`,updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[cO({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 lO=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 Sr(e,{textSerializers:br(this.editor.schema)})}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push($s(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(Ys(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(Zs(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(Xs(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(qs(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(Qs(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(Ws(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(Gs(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=Yr(this.view,e.from,e.to);Js({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()}},uO=e=>new Pr({key:typeof e.pluginKey==`string`?new Rr(e.pluginKey):e.pluginKey,view:t=>new lO({view:t,...e})});Bn.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?[uO({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 dO(e,t){return e??new Rr(t)}var fO=typeof window<`u`?Q.useLayoutEffect:Q.useEffect,pO=new Set([`left`,`opacity`,`position`,`top`,`visibility`,`width`]),mO=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(`.`)),hO=new Set([`children`,`className`,`style`]),gO=new Set([`tabIndex`]),_O=new Set([`accessKey`,`autoCapitalize`,`contentEditable`,`contextMenu`,`dir`,`draggable`,`enterKeyHint`,`hidden`,`id`,`lang`,`nonce`,`role`,`slot`,`spellCheck`,`tabIndex`,`title`,`translate`]),vO={Blur:`focusout`,DoubleClick:`dblclick`,Focus:`focusin`,MouseEnter:`mouseenter`,MouseLeave:`mouseleave`};function yO(e,t){return/^on[A-Z]/.test(e)&&typeof t==`function`}function bO(e){return e.startsWith(`aria-`)||e.startsWith(`data-`),e}function xO(e){return e.startsWith(`aria-`)||e.startsWith(`data-`)||_O.has(e)}function SO(e){return e.startsWith(`--`)?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function CO(e){let t=e.endsWith(`Capture`),n=(t?e.slice(0,-7):e).slice(2);return{eventName:vO[n]??n.toLowerCase(),options:t?{capture:!0}:void 0}}function wO(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 TO(e){return gO.has(e)}function EO(e,t,n){if(t===`tabIndex`){e.tabIndex=Number(n);return}e[t]=n}function DO(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 OO(e,t){return typeof t!=`number`||t===0||e.startsWith(`--`)||mO.has(e)?String(t):`${t}px`}function kO(e,t){pO.has(t)||e.style.removeProperty(SO(t))}function AO(e,t,n){pO.has(t)||e.style.setProperty(SO(t),OO(t,n))}function jO(e,t,n){new Set([...Object.keys(t),...Object.keys(n)]).forEach(r=>{if(hO.has(r)||!xO(r)||yO(r,t[r])||yO(r,n[r]))return;let i=t[r],a=n[r];if(i===a)return;let o=bO(r);if(a==null||a===!1){TO(r)&&DO(e,r),e.removeAttribute(o);return}if(a===!0){TO(r)&&EO(e,r,!0),e.setAttribute(o,``);return}if(TO(r)){EO(e,r,a);return}e.setAttribute(o,String(a))})}function MO(e,t,n){if(t!==n){if(n){e.className=n;return}e.removeAttribute(`class`)}}function NO(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){kO(e,t);return}AO(e,t,a)}})}function PO(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(!yO(t,n))return;let{eventName:i,options:a}=CO(t),o=t=>{n(wO(e,t))};e.addEventListener(i,o,a),r.push({eventName:i,listener:o,options:a})}),r}function FO(e,t){let n=(0,Q.useRef)({}),r=(0,Q.useRef)([]);fO(()=>{let i=n.current;return MO(e,i.className,t.className),NO(e,i.style,t.style),jO(e,i,t),r.current=PO(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 IO=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)(dO(e,`bubbleMenu`)).current;FO(d.current,l),typeof u==`function`?u(d.current):u&&(u.current=d.current);let{editor:p}=le(),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=cO({...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,sd.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)(dO(e,`floatingMenu`)).current;FO(u.current,c),typeof l==`function`?l(u.current):l&&(l.current=u.current);let{editor:f}=le(),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=uO({...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,sd.createPortal)(s,u.current)});var LO=[{name:`paragraph`,label:`Text`,icon:tf,isActive:e=>e.isActive(`paragraph`)&&!e.isActive(`list`),command:e=>e.chain().focus().setParagraph().run()},{name:`heading1`,label:`Heading 1`,icon:Pe,isActive:e=>e.isActive(`heading`,{level:1}),command:e=>e.chain().focus().toggleHeading({level:1}).run()},{name:`heading2`,label:`Heading 2`,icon:Bt,isActive:e=>e.isActive(`heading`,{level:2}),command:e=>e.chain().focus().toggleHeading({level:2}).run()},{name:`heading3`,label:`Heading 3`,icon:ot,isActive:e=>e.isActive(`heading`,{level:3}),command:e=>e.chain().focus().toggleHeading({level:3}).run()},{name:`bulletList`,label:`Bullet List`,icon:Ot,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:Ce,isActive:e=>e.isActive(`list`,{ordered:!0}),command:e=>e.chain().focus().toggleOrderedList().run()},{name:`taskList`,label:`Task List`,icon:$e,isActive:e=>e.isActive(`listItem`,{checked:!0})||e.isActive(`listItem`,{checked:!1}),command:e=>e.chain().focus().toggleTaskList().run()},{name:`blockquote`,label:`Quote`,icon:Le,isActive:e=>e.isActive(`blockquote`),command:e=>e.chain().focus().toggleBlockquote().run()},{name:`codeBlock`,label:`Code Block`,icon:pf,isActive:e=>e.isActive(`codeBlock`),command:e=>e.chain().focus().toggleCodeBlock({language:`js`}).run()}];function RO(e){let t=(0,$.c)(18),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:zO},t[0]=n,t[1]=r);let{current:i,activeStates:a}=oe(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)(ro,{className:`size-3 opacity-50`}),t[6]=l):l=t[6];let u;t[7]!==s||t[8]!==c?(u=(0,Z.jsx)(yc,{asChild:!0,children:(0,Z.jsxs)(Ci,{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=LO.map(e=>{let t=e.icon,r=a[e.name];return(0,Z.jsxs)(xc,{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)(Cc,{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)(kc,{children:[u,f]}),t[15]=u,t[16]=f,t[17]=p):p=t[17],p}function zO(e){let t=Object.fromEntries(LO.map(t=>[t.name,t.isActive(e.editor)]));return{current:LO.find(e=>t[e.name])??LO[0],activeStates:t}}var BO=`open-knowledge:active-terminal-input`;function VO(e,t=typeof window>`u`?new EventTarget:window){t.dispatchEvent(new CustomEvent(BO,{detail:e}))}function HO(e,t=typeof window>`u`?new EventTarget:window){let n=t=>{let n=t instanceof CustomEvent?t.detail:void 0;typeof n==`string`&&e(n)};return t.addEventListener(BO,n),()=>t.removeEventListener(BO,n)}function UO(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName.toUpperCase();return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`}function WO(e){let t=(0,$.c)(3),{editor:n,shortcutEnabled:r}=e,i=r===void 0?!1:r,a=In(),o=Eo();if(!a||o)return null;let s;return t[0]!==n||t[1]!==i?(s=(0,Z.jsx)(GO,{editor:n,shortcutEnabled:i}),t[0]=n,t[1]=i,t[2]=s):s=t[2],s}function GO(e){let t=(0,$.c)(10),{editor:n,shortcutEnabled:r}=e,i,a;t[0]===r?(i=t[1],a=t[2]):(i=()=>{let e=e=>{r&&wl(e,`edit-with-ai`)&&(UO(e.target)||(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),ru()))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},a=[r],t[0]=r,t[1]=i,t[2]=a),(0,Q.useEffect)(i,a);let o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(ra,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),t[3]=o):o=t[3];let s;t[4]===n?s=t[5]:(s=()=>{let e=dt(n),t=du(n);requestAnimationFrame(()=>{if(e===null||t.trim()===``){ru();return}VO(Xr({relativePath:vo(e),instruction:``,selectionMarkdown:t,target:`claude-code`}))})},t[4]=n,t[5]=s);let c,l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(gs,{className:`size-3.5`,"aria-hidden":`true`}),l=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(Y,{id:`xWEvuo`})}),t[6]=c,t[7]=l):(c=t[6],l=t[7]);let u;return t[8]===s?u=t[9]:(u=(0,Z.jsxs)(Z.Fragment,{children:[o,(0,Z.jsxs)(Ci,{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:s,children:[c,l]})]}),t[8]=s,t[9]=u),u}function KO(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 qO(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:st(typeof n.src==`string`?n.src:``)}function JO(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 YO(e){let t=(0,$.c)(13),{editor:n}=e,{_:r}=rn(),i;if(t[0]===n?i=t[1]:(i={editor:n,selector:XO},t[0]=n,t[1]=i),oe(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=KO(n);t&&JO(t,qO(n))},t[4]=n,t[5]=o);let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(ja,{className:`size-3.5`}),t[6]=s):s=t[6];let c;t[7]!==a||t[8]!==o?(c=(0,Z.jsx)(zs,{asChild:!0,children:(0,Z.jsx)(Ci,{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)(Bs,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(Y,{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)(Hs,{children:[c,l]})}),t[11]=c,t[12]=u),u}function XO(e){return KO(e.editor)}function ZO(e){return KO(e)!==null}function QO(e){let t=e.schema.nodes;return!!(t.footnoteReference&&t.footnoteDefinition)}function $O(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 ek(e){let{$from:t,$to:n}=e.state.selection;return!t.sameParent(n)}function tk(e){let t=(0,$.c)(21),{editor:n}=e,{_:r}=rn(),i;t[0]===n?i=t[1]:(i={editor:n,selector:nk},t[0]=n,t[1]=i);let a=oe(i),o;t[2]!==a||t[3]!==n?(o=()=>{if(a||!QO(n)||n.state.selection.empty||ek(n)||$O(n))return;let{from:e,to:t}=n.state.selection,r=n.state.doc.textBetween(e,t,` `);if(!r.trim())return;let i=ai(Cr(n.state.doc)),o=Vr(n.state.doc)+1-(t-e);n.chain().focus().deleteSelection().insertFootnoteReference(i).insertContentAt(o,{type:`footnoteDefinition`,attrs:{identifier:i,label:i},content:[{type:`paragraph`,content:[{type:`text`,text:r}]}]}).run()},t[2]=a,t[3]=n,t[4]=o):o=t[4];let s=o,c;t[5]===r?c=t[6]:(c=r({id:`sIGbBZ`}),t[5]=r,t[6]=c);let l;t[7]===s?l=t[8]:(l=e=>{e.preventDefault(),s()},t[7]=s,t[8]=l);let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(W,{className:`size-3.5`,"aria-hidden":`true`}),t[9]=u):u=t[9];let d;t[10]!==a||t[11]!==c||t[12]!==l?(d=(0,Z.jsx)(zs,{asChild:!0,children:(0,Z.jsx)(Ci,{type:`button`,variant:`ghost`,size:`icon-xs`,"data-testid":`footnote-bubble-button`,className:`text-accent-foreground/80`,"aria-label":c,onMouseDown:l,disabled:a,children:u})}),t[10]=a,t[11]=c,t[12]=l,t[13]=d):d=t[13];let f;t[14]===r?f=t[15]:(f=r({id:`sIGbBZ`}),t[14]=r,t[15]=f);let p;t[16]===f?p=t[17]:(p=(0,Z.jsx)(Bs,{side:`bottom`,sideOffset:8,children:f}),t[16]=f,t[17]=p);let m;return t[18]!==d||t[19]!==p?(m=(0,Z.jsxs)(Hs,{children:[d,p]}),t[18]=d,t[19]=p,t[20]=m):m=t[20],m}function nk(e){let t=e.editor;return!!(!QO(t)||t.state.selection.empty||ek(t)||$O(t))}var rk=`img, .ok-embed, .ok-video`,ik=220,ak=`cubic-bezier(0.23, 1, 0.32, 1)`,ok=`ok-image-align-flip`,sk=.5;function ck(){return typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function lk(){return typeof requestAnimationFrame==`function`}function uk(e){return e?e.querySelector(rk):null}function dk(e,t){if(ck()||!lk()){t();return}let n=uk(e);if(!n){t();return}let r=n.getBoundingClientRect().left;t(),requestAnimationFrame(()=>{let t=uk(e);if(!t)return;for(let e of t.getAnimations())e.id===ok&&e.cancel();let n=r-t.getBoundingClientRect().left;if(Math.abs(n)<sk)return;let i=t.animate([{transform:`translateX(${n}px)`},{transform:`translateX(0)`}],{duration:ik,easing:ak,fill:`none`});i.id=ok})}var fk=[{value:`left`,label:`Align left`,icon:wf},{value:`center`,label:`Align center`,icon:Sf},{value:`right`,label:`Align right`,icon:Cf}];function pk(e){let t=e.state.selection.node;if(!t||t.type.name!==`jsxComponent`)return null;let n=t.attrs.componentName;if(!Ht.has(String(n)))return null;let r=(t.attrs.props??{}).align;return r===`left`||r===`right`||r===`center`?r:`center`}function mk(e){let t=(0,$.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:hk},t[0]=n,t[1]=r);let i=oe(r);if(i===null)return null;let a;t[2]!==i||t[3]!==n?(a=fk.map(e=>{let{value:t,label:r,icon:a}=e,o=i===t;return(0,Z.jsxs)(Hs,{children:[(0,Z.jsx)(zs,{asChild:!0,children:(0,Z.jsx)(Ci,{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(!Ht.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(oi.create(u.doc,s)),dk(n.view.nodeDOM(s),()=>{n.view.dispatch(u)})},children:(0,Z.jsx)(a,{className:`size-3.5`})})}),(0,Z.jsx)(Bs,{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 hk(e){return pk(e.editor)}function gk(e){return pk(e)!==null}var _k=[{name:`bold`,icon:ad,command:e=>e.chain().focus().toggleBold().run(),isActive:e=>e.isActive(`strong`),shortcutId:`format-bold`},{name:`italic`,icon:Fd,command:e=>e.chain().focus().toggleItalic().run(),isActive:e=>e.isActive(`emphasis`),shortcutId:`format-italic`},{name:`underline`,icon:Df,command:e=>e.chain().focus().toggleUnderline().run(),isActive:e=>e.isActive(`underline`),shortcutId:`format-underline`},{name:`strikethrough`,icon:yf,command:e=>e.chain().focus().toggleStrike().run(),isActive:e=>e.isActive(`strike`),shortcutId:`format-strike`},{name:`code`,icon:Ee,command:e=>e.chain().focus().toggleCode().run(),isActive:e=>e.isActive(`code`),shortcutId:`format-inline-code`},{name:`highlight`,icon:Nd,command:e=>e.chain().focus().toggleHighlight().run(),isActive:e=>e.isActive(`highlight`),shortcutId:`format-highlight`}];function vk(e){let t=(0,$.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:yk},t[0]=n,t[1]=r);let i=oe(r),a;t[2]!==i||t[3]!==n?(a=_k.map(e=>{let t=e.icon,r=i[e.name];return(0,Z.jsxs)(Hs,{children:[(0,Z.jsx)(zs,{asChild:!0,children:(0,Z.jsx)(Ci,{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)(Bs,{side:`bottom`,sideOffset:8,children:[(0,Z.jsx)(`span`,{className:`capitalize`,children:e.name}),(0,Z.jsx)(Ct,{"aria-label":Tl(e.shortcutId),children:Cl(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 yk(e){return Object.fromEntries(_k.map(t=>[t.name,t.isActive(e.editor)]))}function bk(e){let t=(0,$.c)(66),{editor:n}=e,{_:r}=rn(),[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(``),c=(0,Q.useRef)(null),{folderPaths:l,loading:u,pages:d}=so(),f;t[0]===n?f=t[1]:(f=n.state.selection.empty&&n.isActive(`link`),t[0]=n,t[1]=f);let p=f,m;t[2]===n?m=t[3]:(m=n.getAttributes(`link`).href??``,t[2]=n,t[3]=m);let h=m,g;t[4]===n?g=t[5]:(g=function(){return n.state.selection.empty&&n.isActive(`link`)?n.getAttributes(`link`).href??``:``},t[4]=n,t[5]=g);let _=g,v,y;t[6]===n?(v=t[7],y=t[8]):(v=()=>{let e=function(){n.state.selection.empty&&a(!1)};return n.on(`selectionUpdate`,e),()=>{n.off(`selectionUpdate`,e)}},y=[n],t[6]=n,t[7]=v,t[8]=y),(0,Q.useEffect)(v,y);let b,x;t[9]===i?(b=t[10],x=t[11]):(b=()=>{i&&requestAnimationFrame(()=>c.current?.focus())},x=[i],t[9]=i,t[10]=b,t[11]=x),(0,Q.useEffect)(b,x);let S;t[12]!==n||t[13]!==p||t[14]!==o?(S=function(){o.trim()?n.chain().focus().setLink({href:o.trim()}).run():p&&n.chain().focus().unsetLink().run(),a(!1)},t[12]=n,t[13]=p,t[14]=o,t[15]=S):S=t[15];let C=S,w;t[16]===n?w=t[17]:(w=function(){n.chain().focus().unsetLink().run(),a(!1)},t[16]=n,t[17]=w);let T=w,E;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(E=function(e){s(K(e.path,null))},t[18]=E):E=t[18];let D=E,O;t[19]!==C||t[20]!==n?(O=function(e){e.key===`Enter`&&(e.preventDefault(),C()),e.key===`Escape`&&(e.preventDefault(),a(!1),n.chain().focus().run())},t[19]=C,t[20]=n,t[21]=O):O=t[21];let k=O;if(i){let e;t[22]===r?e=t[23]:(e=r({id:`ZsGpr_`}),t[22]=r,t[23]=e);let n;t[24]===r?n=t[25]:(n=r({id:`roAe2K`}),t[24]=r,t[25]=n);let i;t[26]!==l||t[27]!==k||t[28]!==u||t[29]!==d||t[30]!==e||t[31]!==n||t[32]!==o?(i=(0,Z.jsx)(nt,{ref:c,type:`text`,placeholder:e,value:o,pages:d,folderPaths:l,loading:u,onValueChange:s,onSuggestionSelect:D,onKeyDown:k,"aria-label":n,className:`h-5 w-44 rounded-none border-none bg-transparent px-0 py-0 text-sm placeholder:text-muted-foreground focus-visible:border-transparent focus-visible:ring-0 dark:bg-transparent`}),t[26]=l,t[27]=k,t[28]=u,t[29]=d,t[30]=e,t[31]=n,t[32]=o,t[33]=i):i=t[33];let a;t[34]===r?a=t[35]:(a=r({id:`tP5DDk`}),t[34]=r,t[35]=a);let f;t[36]===C?f=t[37]:(f=()=>{C()},t[36]=C,t[37]=f);let m;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(vd,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[38]=m):m=t[38];let g;t[39]!==a||t[40]!==f?(g=(0,Z.jsx)(Ci,{variant:`ghost`,size:`icon-xs`,"aria-label":a,onClick:f,children:m}),t[39]=a,t[40]=f,t[41]=g):g=t[41];let _;t[42]!==i||t[43]!==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:[i,g]}),t[42]=i,t[43]=g,t[44]=_):_=t[44];let v;t[45]!==r||t[46]!==h||t[47]!==p||t[48]!==T?(v=p&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Hs,{children:[(0,Z.jsx)(zs,{asChild:!0,children:(0,Z.jsx)(Ci,{variant:`ghost`,size:`icon-xs`,"aria-label":r({id:`2vIPtm`}),onMouseDown:e=>{e.preventDefault(),en(h)},children:(0,Z.jsx)(Fa,{className:`size-3.5`})})}),(0,Z.jsx)(Bs,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(Y,{id:`2vIPtm`})})]}),(0,Z.jsxs)(Hs,{children:[(0,Z.jsx)(zs,{asChild:!0,children:(0,Z.jsx)(Ci,{variant:`ghost`,size:`icon-xs`,"aria-label":r({id:`484LKL`}),onMouseDown:e=>{e.preventDefault(),T()},children:(0,Z.jsx)(Wo,{className:`size-3.5`})})}),(0,Z.jsx)(Bs,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(Y,{id:`484LKL`})})]})]}),t[45]=r,t[46]=h,t[47]=p,t[48]=T,t[49]=v):v=t[49];let y;return t[50]!==_||t[51]!==v?(y=(0,Z.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[_,v]}),t[50]=_,t[51]=v,t[52]=y):y=t[52],y}let A;t[53]===r?A=t[54]:(A=r({id:`p0Iq25`}),t[53]=r,t[54]=A);let j=p?`bg-accent text-primary`:`text-accent-foreground`,M;t[55]===_?M=t[56]:(M=e=>{e.preventDefault(),s(_()),a(!0)},t[55]=_,t[56]=M);let N;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsx)(Ld,{className:`size-3.5`}),t[57]=N):N=t[57];let P;t[58]!==A||t[59]!==j||t[60]!==M?(P=(0,Z.jsx)(zs,{asChild:!0,children:(0,Z.jsx)(Ci,{variant:`ghost`,size:`icon-xs`,"aria-label":A,className:j,onMouseDown:M,children:N})}),t[58]=A,t[59]=j,t[60]=M,t[61]=P):P=t[61];let F;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(Y,{id:`yzF66j`}),t[62]=F):F=t[62];let I;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsxs)(Bs,{side:`bottom`,sideOffset:8,children:[F,(0,Z.jsx)(Ct,{children:Cl(`command-palette`)})]}),t[63]=I):I=t[63];let L;return t[64]===P?L=t[65]:(L=(0,Z.jsxs)(Hs,{children:[P,I]}),t[64]=P,t[65]=L),L}function xk({editor:e}){if(Ke(e.state).query||e.isActive(`codeBlock`))return!1;if(gk(e)||ZO(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 Sk(e){let t=(0,$.c)(23),{editor:n,shortcutEnabled:r}=e,i=r===void 0?!0:r,a=(0,Q.useRef)(null),[o,s]=(0,Q.useState)(0),c=(0,Q.useRef)(null),l;t[0]===n?l=t[1]:(l={editor:n,selector:Dk},t[0]=n,t[1]=l);let u=oe(l),d;t[2]===n?d=t[3]:(d={editor:n,selector:Ek},t[2]=n,t[3]=d);let f=oe(d),p;t[4]!==n.state||t[5]!==n.view?(p=()=>{try{let{from:e,to:t}=n.state.selection;return Yr(n.view,e,t)}catch{return new DOMRect}},t[4]=n.state,t[5]=n.view,t[6]=p):p=t[6];let m;if(t[7]!==n.view.dom||t[8]!==p){let e={getBoundingClientRect:p,contextElement:n.view.dom};m=()=>{let t=a.current;t&&(c.current?.(),c.current=Us(e,t,()=>{Js(e,t,{placement:`top`,strategy:`fixed`,middleware:[Zs(8),$s(),Ys({padding:8})]}).then(e=>{let{x:n,y:r}=e;t.isConnected&&(t.style.position=`fixed`,t.style.left=`${n}px`,t.style.top=`${r}px`)}).catch(Tk)}))},t[7]=n.view.dom,t[8]=p,t[9]=m}else m=t[9];let h=m,g;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>{c.current?.(),c.current=null,s(wk)},t[10]=g):g=t[10];let _=g,v;t[11]===h?v=t[12]:(v={onShow:h,onHide:_,strategy:`fixed`},t[11]=h,t[12]=v);let y;t[13]!==n||t[14]!==f||t[15]!==u||t[16]!==i||t[17]!==o?(y=u?(0,Z.jsx)(mk,{editor:n},`${o}-img-align`):f?(0,Z.jsx)(YO,{editor:n},`${o}-file`):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(RO,{editor:n}),(0,Z.jsx)(ra,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(vk,{editor:n},o),(0,Z.jsx)(ra,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(bk,{editor:n},`${o}-link`),(0,Z.jsx)(tk,{editor:n},`${o}-footnote`),(0,Z.jsx)(WO,{editor:n,shortcutEnabled:i},`${o}-edit-ai`)]}),t[13]=n,t[14]=f,t[15]=u,t[16]=i,t[17]=o,t[18]=y):y=t[18];let b;return t[19]!==n||t[20]!==v||t[21]!==y?(b=(0,Z.jsx)(IO,{ref:a,editor:n,"data-testid":`bubble-menu-bar`,appendTo:Ck,shouldShow:xk,updateDelay:250,options:v,className:`z-50 flex items-center gap-0.5 rounded-lg border bg-background p-1 shadow-md`,children:y}),t[19]=n,t[20]=v,t[21]=y,t[22]=b):b=t[22],b}function Ck(){return document.body}function wk(e){return e+1}function Tk(){}function Ek(e){return ZO(e.editor)}function Dk(e){return gk(e.editor)}var Ok=56,kk=`0 2px 4px rgba(0, 0, 0, 0.08)`,Ak=150,jk=globalThis.ScrollTimeline;function Mk(e,t,n,r,i){let a=r-i;if(a<=0)return null;let o=e+n-(t+Ok);return{startOffset:o,endOffset:o+a,maxShift:a}}var Nk=new WeakMap;function Pk(e){let t=Nk.get(e);if(t){for(let e of t.animations)e.cancel();Nk.delete(e)}}function Fk(e){for(let t of Array.from(e.cells))Pk(t)}var Ik=e=>e.cellIndex===0?`3`:`2`;function Lk(e,t){return Rk(e,t,e=>({transform:`translateY(${e}px)`}))}function Rk(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 zk(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 Bk(e,t,n){return zk(e,t,{zIndex:`auto`,boxShadow:`none`},{zIndex:n,boxShadow:kk})}function Vk(e,t){return zk(e,t,{opacity:`0`},{opacity:`1`})}function Hk(e,t,n,r){let i=Ik(e),a=`sd|${n.startOffset}|${n.maxShift}|${r}|${i}`,o=Nk.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(Lk(n,r),s),l=e.animate(Bk(n,r,i),s),u=e.animate(Vk(n,r),{...s,pseudoElement:`::before`});Nk.set(e,{key:a,animations:[c,l,u]})}function Uk(e,t){let n=Ik(e),r=`in|${t}|${n}`,i=Nk.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:kk}],{duration:0,fill:`forwards`}),o=e.animate([{opacity:`1`}],{duration:0,fill:`forwards`,pseudoElement:`::before`});Nk.set(e,{key:r,animations:[a,o]})}function Wk(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=Mk(a,i,c.top,c.height,l.height);if(!u){Fk(s);continue}if(n){if(o<=0){Fk(s);continue}for(let e of Array.from(s.cells))Hk(e,n,u,o);continue}let d=Math.max(0,Math.min(a-u.startOffset,u.maxShift));if(d<=0||c.bottom<=i+Ok){Fk(s);continue}for(let e of Array.from(s.cells))Uk(e,d)}}var Gk=Bn.create({name:`frozenTableHeaders`,addProseMirrorPlugins(){return[new Pr({key:new Rr(`frozenTableHeaders`),view(e){let t=null,n=null,r=null,i=null,a=null,o=!1,s=new Set,c=()=>{o||!t||Wk(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()},Ak);return}l()};return requestAnimationFrame(()=>{if(!o){if(t=e.dom.closest(`[data-testid="editor-scroll-container"]`),t&&jk)try{n=new jk({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`))Fk(t)}}}})]}});function Kk(e,t){return(n,r)=>{let i=r,a=hu(i.dataTransfer);return a?(i.preventDefault(),t?.(a),!0):e(n,i)}}function qk(e,t){let n=pu(e);t(n.target,{tabBehavior:`append`}),qc(n.hash)}function Jk(e){return[...e?[{label:`Toggle header column`,icon:gd,run:e=>e.chain().focus().toggleHeaderColumn().run()}]:[],{label:`Insert column left`,icon:Oi,run:e=>e.chain().focus().addColumnBefore().run()},{label:`Insert column right`,icon:Na,run:e=>e.chain().focus().addColumnAfter().run()},{label:`Delete column`,icon:Wo,separatorBefore:!0,run:e=>e.chain().focus().deleteColumn().run()},{label:`Delete table`,icon:Ad,run:e=>e.chain().focus().deleteTable().run()}]}function Yk(e){return[...e?[{label:`Toggle header row`,icon:bf,run:e=>e.chain().focus().toggleHeaderRow().run()}]:[],{label:`Insert row above`,icon:g,run:e=>e.chain().focus().addRowBefore().run()},{label:`Insert row below`,icon:B,run:e=>e.chain().focus().addRowAfter().run()},{label:`Delete row`,icon:Wo,separatorBefore:!0,run:e=>e.chain().focus().deleteRow().run()},{label:`Delete table`,icon:Ad,run:e=>e.chain().focus().deleteTable().run()}]}function Xk(e){if(!e.isEditable||Ke(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 Zk(e){let t=(0,$.c)(22),{editor:n,anchor:r,axis:i,items:a}=e,o=(0,Q.useRef)(null),s,c;t[0]!==r||t[1]!==i?(s=()=>{let e=o.current;if(!e)return;let t=i===`column`?`top`:`left`,n=i===`column`?-14:-6;return Us(r,e,()=>{Js(r,e,{strategy:`absolute`,placement:t,middleware:[Zs(n)]}).then(t=>{let{x:n,y:r}=t;e.style.left=`${n}px`,e.style.top=`${r}px`,e.style.opacity=`1`}).catch(Qk)})},c=[r,i],t[0]=r,t[1]=i,t[2]=s,t[3]=c):(s=t[2],c=t[3]),(0,Q.useEffect)(s,c);let l=i===`column`?bd:na,u=i===`column`?`h-3 w-7 rounded-full p-0 text-gray-700 dark:text-muted-foreground bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 hover:text-foreground dark:hover:bg-gray-600 dark:hover:text-gray-100 relative before:absolute before:-inset-[6px] before:content-[""]`:`h-7 w-3 rounded-full p-0 text-gray-700 dark:text-muted-foreground bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 hover:text-foreground dark:hover:bg-gray-600 dark:hover:text-gray-100 relative before:absolute before:-inset-[6px] before:content-[""]`,d=i===`column`?`Column options`:`Row options`,f;t[4]===l?f=t[5]:(f=(0,Z.jsx)(l,{className:`size-3.5`,"aria-hidden":!0}),t[4]=l,t[5]=f);let p;t[6]!==u||t[7]!==d||t[8]!==f?(p=(0,Z.jsx)(yc,{asChild:!0,children:(0,Z.jsx)(Ci,{variant:`secondary`,className:u,"aria-label":d,children:f})}),t[6]=u,t[7]=d,t[8]=f,t[9]=p):p=t[9];let m=i===`column`?`center`:`start`,h=i===`column`?`bottom`:`right`,g;if(t[10]!==n||t[11]!==a){let e;t[13]===n?e=t[14]:(e=e=>(0,Z.jsxs)(Q.Fragment,{children:[e.separatorBefore&&(0,Z.jsx)(Pc,{}),(0,Z.jsxs)(xc,{onSelect:()=>e.run(n),children:[(0,Z.jsx)(e.icon,{"aria-hidden":!0}),e.label]})]},e.label),t[13]=n,t[14]=e),g=a.map(e),t[10]=n,t[11]=a,t[12]=g}else g=t[12];let _;t[15]!==m||t[16]!==h||t[17]!==g?(_=(0,Z.jsx)(Cc,{align:m,side:h,className:`w-auto min-w-44 whitespace-nowrap`,children:g}),t[15]=m,t[16]=h,t[17]=g,t[18]=_):_=t[18];let v;return t[19]!==_||t[20]!==p?(v=(0,Z.jsx)(`div`,{ref:o,"data-testid":`table-cell-handle`,className:`absolute left-0 top-0 z-10 opacity-0`,children:(0,Z.jsxs)(kc,{children:[p,_]})}),t[19]=_,t[20]=p,t[21]=v):v=t[21],v}function Qk(){}function $k(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=Xk(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=Jk(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)(Zk,{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=Yk(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)(Zk,{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 eA(e){let{fragment:t,docName:n}=e,r=!1,i=!1,a=!1,o=()=>{r=!0},s=e=>{console.warn(`[walk-currency] ${e} at view init — stale pre-warm cannot be invalidated: a remote edit that landed in the construct→mount gap will not render, and the first local transaction may silently erase it from the CRDT for every peer and disk (vendored y-tiptap contract change? re-verify y-tiptap.cjs:263-268)`)},c=()=>{i&&(i=!1,t.unobserveDeep(o))},l=e=>{let t=Kt.getState(e.state)?.binding;if(!t){gl.count(`ok/editor/walk-currency-disarmed`,{docName:n,reason:`no-binding`}),s(`no ySync binding on "${n}"`);return}if(typeof t._forceRerender!=`function`){gl.count(`ok/editor/walk-currency-disarmed`,{docName:n,reason:`no-force-rerender`}),s(`ySync binding on "${n}" exposes no _forceRerender`);return}gl.count(`ok/editor/pattern-d-stale-prewarm`,{docName:n}),t._forceRerender()};return Bn.create({name:`walkCurrency`,onBeforeCreate(){t.observeDeep(o),i=!0},onDestroy(){c()},addProseMirrorPlugins(){return[new Pr({view:e=>(a||(a=!0,c(),r&&l(e)),{})})]}})}var tA=new WeakMap;function nA(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=si(e.color),n.textContent=e.name,t.append(n),t}var rA={state:`idle`,count:0,lastFiredAt:null,position:`append`,lastAgentId:null},iA=100,aA=100,oA=3,sA=250;function cA(e){return`contentComponent`in e&&`isEditorContentInitialized`in e}function lA(e,t){let n=de(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 $n({extensions:ui});return{mdManager:e,text:Lt({mdManager:e}),html:Re({mdManager:e}),paste:et({mdManager:e}),drop:kt({mdManager:e})}}function dA(e,t){return t?{collaboration:tt.configure({document:e.document,ySyncOptions:{mapping:t}}),guard:[eA({fragment:e.document.getXmlFragment(`default`),docName:e.configuration.name??``})]}:{collaboration:tt.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[...yt.map(e=>e.name===`link`||e.name===`wikiLink`||e.name===`jsxComponent`?e.configure({docName:t.configuration.name??``}):e),ZC.configure({placeholder:n??`Type '/' for commands`,showOnlyCurrent:!0}),a,Bn.create({name:`imageUploadDecoration`,addProseMirrorPlugins(){return[He]}}),Bn.create({name:`collaborationCursor`,addProseMirrorPlugins(){let e=t.awareness;if(!e)throw Error(`[TiptapEditor] HocuspocusProvider has no awareness instance — cursor plugin cannot initialize`);return[p(e,{cursorBuilder:nA})]}}),Bn.create({name:`bindingStalenessGuard`,addProseMirrorPlugins(){return[aO({fragment:t.document.getXmlFragment(`default`),docName:t.configuration.name??``,onWedged:i??(()=>{})})]}}),...o,Gk]}function pA(e){let{provider:t,clipboard:n,ctorStart:r}=e;return{onBeforeCreate:({editor:e})=>{tA.set(e,r)},onCreate:({editor:e})=>{n.html.setView(e.view);let r=tA.get(e);if(tA.delete(e),r==null)return;let i=performance.now();gl(`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:Kk(n.drop,e.onSidebarDrop)},extensions:bg(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}=q(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)(rA),c=YD(),{principal:l,activeDocName:u,recycleDocument:d,openTarget:f}=ft(),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 yi(mA({provider:n,placeholder:r,clipboard:m,ctorStart:performance.now(),onWedged:e=>{let{externalSeq:t,appliedSeq:n}=e;gl(`ok/editor/binding-wedge-recycle`,{docName:p,externalSeq:t,appliedSeq:n}),d(p)},onSidebarDrop:e=>{qk(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=O(p)??crypto.randomUUID();_=Q.use,v=nn({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=()=>()=>{R(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)(98),{provider:n,isSourceMode:r,docName:i,activeDocName:a,identity:o,principal:s,editor:c,wrapperRef:u,flashStateRef:d,portalTarget:f}=e,p=(0,Q.useRef)(null),[m,h]=(0,Q.useState)(0),g,_;t[0]===f?(g=t[1],_=t[2]):(g=()=>{let e=p.current;if(e)return e.appendChild(f),()=>{f.parentNode===e&&e.removeChild(f)}},_=[f],t[0]=f,t[1]=g,t[2]=_),(0,Q.useLayoutEffect)(g,_);let v,y;t[3]!==c||t[4]!==f?(v=()=>{lA(c,f)&&h(_A)},y=[c,f],t[3]=c,t[4]=f,t[5]=v,t[6]=y):(v=t[5],y=t[6]),(0,Q.useEffect)(v,y);let b;t[7]!==c||t[8]!==n.configuration.name?(b=()=>(Xe(c,n.configuration.name??null),()=>{Xe(c,null)}),t[7]=c,t[8]=n.configuration.name,t[9]=b):b=t[9];let x;t[10]!==c||t[11]!==n?(x=[c,n],t[10]=c,t[11]=n,t[12]=x):x=t[12],(0,Q.useEffect)(b,x);let S;t[13]!==c||t[14]!==n.configuration.name?(S=()=>{let e=n.configuration.name;if(e)return T(e,c),()=>Tt(e,c)},t[13]=c,t[14]=n.configuration.name,t[15]=S):S=t[15];let C;t[16]!==c||t[17]!==n?(C=[c,n],t[16]=c,t[17]=n,t[18]=C):C=t[18],(0,Q.useEffect)(S,C);let w;t[19]!==c||t[20]!==n.configuration.name?(w=()=>{let e=n.configuration.name;if(!e)return;let t=null,r=()=>{t=null,Xl(e,`wysiwyg`,$l(c)),lu(e,`wysiwyg`,uu(c,e))},i=()=>{t&&clearTimeout(t),t=setTimeout(r,120)};return r(),c.on(`selectionUpdate`,i),c.on(`update`,i),()=>{t&&clearTimeout(t),c.off(`selectionUpdate`,i),c.off(`update`,i),Xl(e,`wysiwyg`,null),lu(e,`wysiwyg`,null)}},t[19]=c,t[20]=n.configuration.name,t[21]=w):w=t[21];let E;t[22]!==c||t[23]!==n?(E=[c,n],t[22]=c,t[23]=n,t[24]=E):E=t[24],(0,Q.useEffect)(w,E);let D;t[25]!==c||t[26]!==n.configuration.name?(D=()=>{},t[25]=c,t[26]=n.configuration.name,t[27]=D):D=t[27];let O;t[28]!==c||t[29]!==n?(O=[c,n],t[28]=c,t[29]=n,t[30]=O):O=t[30],(0,Q.useEffect)(D,O);let k,A;t[31]===c?(k=t[32],A=t[33]):(k=()=>{let e=vA,t=null,n=()=>{if(t||c.isDestroyed)return;let n=de(c);n&&(t=n.dom,t.addEventListener(`keydown`,e),t.addEventListener(`paste`,e),t.addEventListener(`drop`,e),t.addEventListener(`cut`,e))},r=()=>{t&&=(t.removeEventListener(`keydown`,e),t.removeEventListener(`paste`,e),t.removeEventListener(`drop`,e),t.removeEventListener(`cut`,e),null)};return de(c)?n():c.on(`create`,n),()=>{c.off(`create`,n),r()}},A=[c],t[31]=c,t[32]=k,t[33]=A),(0,Q.useEffect)(k,A);let j,M;t[34]!==i||t[35]!==c?(j=()=>{let e=!1,t=()=>{if(e||c.isDestroyed||!de(c))return;e=!0;let t=H(i)?.selection??null;if(t)try{let e=c.state.doc.content.size;if(t.type===`text`){let n=Math.max(0,Math.min(t.anchor,e)),r=Math.max(0,Math.min(t.head,e));c.commands.setTextSelection({from:n,to:r})}else{let n=Math.max(0,Math.min(t.from,e));c.commands.setNodeSelection(n)}}catch(e){let t=e,n=t instanceof Error?t.message:String(t);console.warn(JSON.stringify({event:`ok-editor-selection-restore-failed`,docName:i,message:n})),gl(`ok/editor/selection-restore-failed`,{docName:i,message:n})}l(i)};if(de(c)){t();return}return c.on(`create`,t),()=>{c.off(`create`,t)}},M=[c,i],t[34]=i,t[35]=c,t[36]=j,t[37]=M):(j=t[36],M=t[37]),(0,Q.useEffect)(j,M);let N,P;t[38]!==d||t[39]!==n.document||t[40]!==u?(N=()=>{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)},Ln)};c(rA);let f=()=>{if(zr(e),!fi(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`?fi(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)}},P=[n.document,d,u],t[38]=d,t[39]=n.document,t[40]=u,t[41]=N,t[42]=P):(N=t[41],P=t[42]),(0,Q.useEffect)(N,P);let F,I;t[43]!==a||t[44]!==i||t[45]!==c||t[46]!==n?(F=()=>{let e=0,t,r=null,o=null,s=null,l=function(){if(e<iA){e+=1,t=window.setTimeout(p,aA);return}r=null,o=null,e=0},u=function(e){let t=de(c);if(!t)return null;let n=CSS.escape(e);return t.dom.querySelector(`#${n}`)??t.dom.querySelector(`[data-mirror-source-id="${n}"]`)},d=function(e){let t=u(e);return t?(t.scrollIntoView({behavior:`smooth`,block:`start`}),!0):!1},f=function(e,n){let r=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){l();return}d(t)?(s=n,r=null,o=null,e=0,f(t,n)):l()}let m=function(){if(i!==a)return;let n=window.location.hash;if(!r&&s===n)return;let c=Qc(n);if(!c){s=n;return}r=c,o=n,e=0,t!==void 0&&(clearTimeout(t),t=void 0),p()},h=function(){if(i===a){if(r){p();return}m()}};return m(),n.on(`synced`,h),c.on(`transaction`,h),window.addEventListener(`hashchange`,m),()=>{t!==void 0&&clearTimeout(t),n.off(`synced`,h),c.off(`transaction`,h),window.removeEventListener(`hashchange`,m)}},I=[n,c,i,a],t[43]=a,t[44]=i,t[45]=c,t[46]=n,t[47]=F,t[48]=I):(F=t[47],I=t[48]),(0,Q.useEffect)(F,I);let L,R;t[49]===c?(L=t[50],R=t[51]):(L=()=>{let e=function(e){let t=e.detail;if(!t||t.mode!==`wysiwyg`||c.isDestroyed)return;let n=de(c);if(!n)return;let r=n.dom.querySelectorAll(`h1, h2, h3, h4, h5, h6`)[t.index];r&&r.scrollIntoView({behavior:`smooth`,block:`start`})};return window.addEventListener(Jl,e),()=>window.removeEventListener(Jl,e)},R=[c],t[49]=c,t[50]=L,t[51]=R),(0,Q.useEffect)(L,R);let z;t[52]!==a||t[53]!==i||t[54]!==o||t[55]!==r||t[56]!==s||t[57]!==n.awareness?(z=()=>{let e=n.awareness;if(e){if(i!==a){e.setLocalState(null);return}e.setLocalState({user:XD({principal:s,identity:o}),mode:r?`source`:`wysiwyg`})}},t[52]=a,t[53]=i,t[54]=o,t[55]=r,t[56]=s,t[57]=n.awareness,t[58]=z):z=t[58];let B;t[59]!==a||t[60]!==i||t[61]!==o||t[62]!==r||t[63]!==s||t[64]!==n?(B=[n,i,a,o,s,r],t[59]=a,t[60]=i,t[61]=o,t[62]=r,t[63]=s,t[64]=n,t[65]=B):B=t[65],(0,Q.useEffect)(z,B);let V,U;t[66]!==c||t[67]!==r?(V=()=>(Qt(c,r),()=>{Qt(c,!1)}),U=[c,r],t[66]=c,t[67]=r,t[68]=V,t[69]=U):(V=t[68],U=t[69]),(0,Q.useEffect)(V,U);let W;t[70]!==a||t[71]!==i||t[72]!==c||t[73]!==r?(W=!r&&(0,Z.jsx)(Sk,{editor:c,shortcutEnabled:i===a}),t[70]=a,t[71]=i,t[72]=c,t[73]=r,t[74]=W):W=t[74];let G;t[75]!==c||t[76]!==r?(G=!r&&(0,Z.jsx)($k,{editor:c}),t[75]=c,t[76]=r,t[77]=G):G=t[77];let K;t[78]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Z.jsx)(`div`,{ref:p,style:{display:`contents`}}),t[78]=K):K=t[78];let te;t[79]!==c||t[80]!==m?(te=(0,Z.jsx)(ee,{editor:c,className:`tiptap-editor-portal-content h-full`},m),t[79]=c,t[80]=m,t[81]=te):te=t[81];let q;t[82]!==f||t[83]!==te?(q=(0,sd.createPortal)(te,f),t[82]=f,t[83]=te,t[84]=q):q=t[84];let J;t[85]===c?J=t[86]:(J=(0,Z.jsx)(qD,{editor:c}),t[85]=c,t[86]=J);let ne;t[87]===c?ne=t[88]:(ne=Vt(c),t[87]=c,t[88]=ne);let re;t[89]===ne.store?re=t[90]:(re=(0,Z.jsx)(Fe,{store:ne.store}),t[89]=ne.store,t[90]=re);let ie;return t[91]!==W||t[92]!==G||t[93]!==q||t[94]!==J||t[95]!==re||t[96]!==u?(ie=(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:[W,G,K,q,J,re]}),t[91]=W,t[92]=G,t[93]=q,t[94]=J,t[95]=re,t[96]=u,t[97]=ie):ie=t[97],ie};function _A(e){return e+1}function vA(){return C()}var yA=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 bA(e,t,n,r,i,a){if(e==r)return[];let o=AA(e,t,n,r,i,a),s=jA(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 yA(t,n,i,a)];if(c>l){let o=e.slice(t,n).indexOf(r.slice(i,a));if(o>-1)return[new yA(t,t+o,i,i),new yA(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 yA(t,t,i,i+o),new yA(n,n,i+o+c,a)]}if(c==1||l==1)return[new yA(t,n,i,a)];let u=NA(e,t,n,r,i,a);if(u){let[o,s,c]=u;return bA(e,t,o,r,i,s).concat(bA(e,o+c,n,r,s+c,a))}return wA(e,t,n,r,i,a)}var xA=1e9,SA=0,CA=!1;function wA(e,t,n,r,i,a){let o=n-t,s=a-i;if(xA<1e9&&Math.min(o,s)>xA*16||SA>0&&Date.now()>SA)return Math.min(o,s)>xA*64?[new yA(t,n,i,a)]:PA(e,t,n,r,i,a);let c=Math.ceil((o+s)/2);EA.reset(c),DA.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:DA,f=d?null:EA;for(let p=0;p<c;p++){if(p>xA||SA>0&&!(p&63)&&Date.now()>SA)return PA(e,t,n,r,i,a);let m=EA.advance(p,o,s,c,d,!1,l)||DA.advance(p,o,s,c,f,!0,u);if(m)return OA(e,t,n,t+m[0],r,i,a,i+m[1])}return[new yA(t,n,i,a)]}var TA=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}},EA=new TA,DA=new TA;function OA(e,t,n,r,i,a,o,s){let c=!1;return!YA(e,r)&&++r==n&&(c=!0),!YA(i,s)&&++s==o&&(c=!0),c?[new yA(t,n,a,o)]:bA(e,t,r,i,a,s).concat(bA(e,r,n,i,s,o))}function kA(e,t){let n=1,r=Math.min(e,t);for(;n<r;)n<<=1;return n}function AA(e,t,n,r,i,a){if(t==n||t==a||e.charCodeAt(t)!=r.charCodeAt(i))return 0;let o=kA(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-+!YA(e,s);o>>=1}else if(i==n||l==a)return i-t;else s=i,c=l}}function jA(e,t,n,r,i,a){if(t==n||i==a||e.charCodeAt(n-1)!=r.charCodeAt(a-1))return 0;let o=kA(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-+!YA(e,s);o>>=1}else if(a==t||l==i)return n-a;else s=a,c=l}}function MA(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;;){YA(e,s)||s++;let u=s+o;if(YA(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=AA(e,u,n,r,i+f+d.length,a),c=jA(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 NA(e,t,n,r,i,a){let o=n-t,s=a-i;if(o<s){let o=NA(r,i,a,e,t,n);return o&&[o[1],o[0],o[2]]}return o<4||s*2<o?null:MA(e,t,n,r,i,a,Math.floor(o/4),-1)}function PA(e,t,n,r,i,a){CA=!0;let o=n-t,s=a-i,c;if(o<s){let s=MA(r,i,a,e,t,n,Math.floor(o/6),50);c=s&&[s[1],s[0],s[2]]}else c=MA(e,t,n,r,i,a,Math.floor(s/6),50);if(!c)return[new yA(t,n,i,a)];let[l,u,d]=c;return bA(e,t,l,r,i,u).concat(bA(e,l+d,n,r,u+d,a))}function FA(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 yA(r.fromA,i.toA,r.fromB,i.toB),e.splice(n--,1))}}function IA(e,t,n){for(;;){FA(n,1);let r=!1;for(let i=0;i<n.length;i++){let a=n[i],o,s;(o=AA(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new yA(a.fromA+o,a.toA,a.fromB+o,a.toB)),(s=jA(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new yA(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 yA(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 yA(a.fromA+d,a.toA+d,a.fromB+d,a.toB+d),r=!0)}if(!r)break}return n}function LA(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=WA(t,a.fromA,l),f=UA(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 yA(d,d+o,a.fromB-p,a.toB-p),d=a.fromA,f=UA(t,a.toA,c-a.toA)):l>m&&t.slice(a.toA,f)==u.slice(h,h+m)&&(a=e[i]=new yA(f-o,f,a.fromB+m,a.toB+m),f=a.toA,d=WA(t,a.fromA,a.fromA-r)),p=a.fromA-d,m=f-a.toA}if(p||m)a=e[i]=new yA(a.fromA-p,a.toA+m,a.fromB-p,a.toB+m);else if(!o){let t=KA(n,a.fromB,a.toB),r,o=t<0?-1:GA(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=KA(t,a.fromA,a.toA),r,o=n<0?-1:GA(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 FA(e,3),e}var RA;try{RA=RegExp(`[\\p{Alphabetic}\\p{Number}]`,`u`)}catch{}function zA(e){return e>48&&e<58||e>64&&e<91||e>96&&e<123}function BA(e,t){if(t==e.length)return 0;let n=e.charCodeAt(t);return n<192?+!!zA(n):RA?!qA(n)||t==e.length-1?+!!RA.test(String.fromCharCode(n)):RA.test(e.slice(t,t+2))?2:0:0}function VA(e,t){if(!t)return 0;let n=e.charCodeAt(t-1);return n<192?+!!zA(n):RA?!JA(n)||t==1?+!!RA.test(String.fromCharCode(n)):RA.test(e.slice(t-2,t))?2:0:0}var HA=8;function UA(e,t,n){if(t==e.length||!VA(e,t))return t;for(let r=t,i=t+n,a=0;a<HA;a++){let t=BA(e,r);if(!t||r+t>i)return r;r+=t}return t}function WA(e,t,n){if(!t||!BA(e,t))return t;for(let r=t,i=t-n,a=0;a<HA;a++){let t=VA(e,r);if(!t||r-t<i)return r;r-=t}return t}function GA(e,t,n){for(;t!=n;t--)if(e.charCodeAt(t-1)==10)return t;return-1}function KA(e,t,n){for(;t!=n;t++)if(e.charCodeAt(t)==10)return t;return-1}var qA=e=>e>=55296&&e<=56319,JA=e=>e>=56320&&e<=57343;function YA(e,t){return!t||t==e.length||!qA(e.charCodeAt(t-1))||!JA(e.charCodeAt(t))}function XA(e,t,n){let r=n?.override;return r?r(e,t):(xA=(n?.scanLimit??1e9)>>1,SA=n?.timeout?Date.now()+n.timeout:0,CA=!1,IA(e,t,bA(e,0,e.length,t,0,t.length)))}function ZA(){return!CA}function QA(e,t,n){return LA(XA(e,t,n),e,t)}var $A=Fl.define({combine:e=>e[0]}),ej=Il.define(),tj=Fl.define(),nj=Al.define({create(e){return null},update(e,t){for(let n of t.effects)n.is(ej)&&(e=n.value);for(let n of t.state.facet(tj))e=n(e,t);return e}});function rj(e){let t=e.field(nj,!1);if(!t)return null;let n=e.facet($A);return{chunks:t,side:n?n.side:null}}var ij=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 sj(QA(e.toString(),t.toString(),n),e,t,0,0,ZA())}static updateA(e,t,n,r,i){return dj(uj(e,r,!0,n.length),e,t,n,i)}static updateB(e,t,n,r,i){return dj(uj(e,r,!1,t.length),e,t,n,i)}};function aj(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 oj(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 sj(e,t,n,r,i,a){let o=[];for(let s=0;s<e.length;s++){let c=e[s],[l,u]=aj(c.fromA+r,c.fromB+i,t,n),[d,f]=oj(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]=aj(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]=oj(a.toA+r,a.toB+i,t,n),s++}o.push(new ij(p,l,Math.max(l,d),u,Math.max(u,f),a))}return o}var cj=1e3;function lj(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 uj(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>cj&&([l,d]=lj(e,a-cj,n,!0)),o<t.length-cj&&([u,f]=lj(e,o+cj,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 dj(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=QA(n.sliceString(d,p),r.sliceString(f,m),i);for(let e of sj(h,n,r,d,f,ZA()))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 fj={scanLimit:500},pj=Ll.fromClass(class{constructor(e){({deco:this.deco,gutter:this.gutter}=Cj(e))}update(e){(e.docChanged||e.viewportChanged||hj(e.startState,e.state)||gj(e.startState,e.state))&&({deco:this.deco,gutter:this.gutter}=Cj(e.view))}},{decorations:e=>e.deco}),mj=Dl.low(Vl({class:`cm-changeGutter`,markers:e=>e.plugin(pj)?.gutter||Ul.empty}));function hj(e,t){return e.field(nj,!1)!=t.field(nj,!1)}function gj(e,t){return e.facet($A)!=t.facet($A)}var _j=Nl.line({class:`cm-changedLine`}),vj=Nl.mark({class:`cm-changedText`}),yj=Nl.mark({tagName:`ins`,class:`cm-insertedLine`}),bj=Nl.mark({tagName:`del`,class:`cm-deletedLine`}),xj=new class extends Bl{constructor(){super(...arguments),this.elementClass=`cm-changedLineGutter`}};function Sj(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,_j),i.add(o,s,n?bj:yj),a&&a.add(o,o,xj);for(let l=t.iterRange(o,s-1),u=o;!l.next().done;){if(l.lineBreak){u++,i.add(u,u,_j),a&&a.add(u,u,xj);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,vj),s<t)c++;else break}u=t}}}function Cj(e){let t=e.state.field(nj),{side:n,highlightChanges:r,markGutter:i,overrideChunk:a}=e.state.facet($A),o=n==`a`,s=new Pl,c=i?new Pl: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))&&Sj(n,e.state.doc,o,r,s,c)}return{deco:s.finish(),gutter:c&&c.finish()}}var wj=class extends El{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}},Tj=Il.define({map:(e,t)=>e.map(t)}),Ej=Al.define({create:()=>Nl.none,update:(e,t)=>{for(let e of t.effects)if(e.is(Tj))return e.value;return e.map(t.changes)},provide:e=>zl.decorations.from(e)}),Dj=.01;function Oj(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 kj(e,t,n){let r=new Pl,i=new Pl,a=e.state.field(Ej).iter(),o=t.state.field(Ej).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<-Dj?(l-=n,r.add(s,s,Nl.widget({widget:new wj(-n),block:!0,side:-1}))):n>Dj&&(u+=n,i.add(c,c,Nl.widget({widget:new wj(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<Dj?r.add(e.state.doc.length,e.state.doc.length,Nl.widget({widget:new wj(-p),block:!0,side:1})):p>Dj&&i.add(t.state.doc.length,t.state.doc.length,Nl.widget({widget:new wj(p),block:!0,side:1}));let m=r.finish(),h=i.finish();Oj(m,e.state.field(Ej))||e.dispatch({effects:Tj.of(m)}),Oj(h,t.state.field(Ej))||t.dispatch({effects:Tj.of(h)})}var Aj=Il.define({map:(e,t)=>t.mapPos(e)}),jj=class extends El{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:Aj.of(n)});let{side:r,sibling:i}=e.state.facet($A);i&&i().dispatch({effects:Aj.of(Mj(n,e.state.field(nj),r==`a`))})}),t}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return`collapsed-unchanged-code`}};function Mj(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 Nj=Al.define({create(e){return Nl.none},update(e,t){e=e.map(t.changes);for(let n of t.effects)n.is(Aj)&&(e=e.update({filter:e=>e!=n.value}));return e},provide:e=>zl.decorations.from(e)});function Pj({margin:e=3,minSize:t=4}){return Nj.init(n=>Fj(n,e,t))}function Fj(e,t,n){let r=new Pl,i=e.facet($A).side==`a`,a=e.field(nj),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,Nl.replace({widget:new jj(d),block:!0})),!c)break;o=e.doc.lineAt(Math.min(e.doc.length,i?c.toA:c.toB)).number}return r.finish()}var Ij=zl.styleModule.of(new Hl({".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`}})),Lj=zl.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`}}),Rj=new Rl,zj=new Rl,Bj=class{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig||fj;let t=[Dl.low(pj),Lj,Ij,Ej,zl.updateListener.of(e=>{this.measuring<0&&(e.heightChanged||e.viewportChanged)&&!e.transactions.some(e=>e.effects.some(e=>e.is(Tj)))&&this.measure()})],n=[$A.of({side:`a`,sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&n.push(mj);let r=kl.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],zl.editorAttributes.of({class:`cm-merge-a`}),zj.of(n),t]}),i=[$A.of({side:`b`,sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&i.push(mj);let a=kl.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],zl.editorAttributes.of({class:`cm-merge-b`}),zj.of(i),t]});this.chunks=ij.build(r.doc,a.doc,this.diffConf);let o=[nj.init(()=>this.chunks),Rj.of(e.collapseUnchanged?Pj(e.collapseUnchanged):[])];r=r.update({effects:Il.appendConfig.of(o)}).state,a=a.update({effects:Il.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 zl({state:r,parent:c,root:e.root,dispatchTransactions:e=>this.dispatch(e,this.a)}),this.b=new zl({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),Ol.empty(e[0].startState.doc.length));this.chunks=t==this.a?ij.updateA(this.chunks,n.newDoc,this.b.state.doc,r,this.diffConf):ij.updateB(this.chunks,this.a.state.doc,n.newDoc,r,this.diffConf),t.update([...e,n.state.update({effects:ej.of(this.chunks)})]);let i=t==this.a?this.b:this.a;i.update([i.state.update({effects:ej.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($A),o=n?e.gutter!==!1:r.markGutter,s=t?e.highlightChanges!==!1:r.highlightChanges;i.push(zj.reconfigure([$A.of({side:`a`,sibling:()=>this.b,highlightChanges:s,markGutter:o}),o?mj:[]])),a.push(zj.reconfigure([$A.of({side:`b`,sibling:()=>this.a,highlightChanges:s,markGutter:o}),o?mj:[]]))}if(r){let t=Rj.reconfigure(e.collapseUnchanged?Pj(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(){kj(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=Vj(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=Vj(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 Vj(e){let t=e.nextSibling;return e.remove(),t}var Hj=new class extends Bl{constructor(){super(...arguments),this.elementClass=`cm-deletedLineGutter`}},Uj=Dl.low(Vl({class:`cm-changeGutter`,markers:e=>e.plugin(pj)?.gutter||Ul.empty,widgetMarker:(e,t)=>t instanceof Jj?Hj:null}));function Wj(e){let t=typeof e.original==`string`?Ml.of(e.original.split(/\r?\n/)):e.original,n=e.diffConfig||fj;return[Dl.low(pj),$j,Lj,zl.editorAttributes.of({class:`cm-merge-b`}),tj.of((e,t)=>{let r=t.effects.find(e=>e.is(Gj));return r&&(e=ij.updateA(e,r.value.doc,t.startState.doc,r.value.changes,n)),t.docChanged&&(e=ij.updateB(e,t.state.field(Kj),t.newDoc,t.changes,n)),e}),$A.of({highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1,syntaxHighlightDeletions:e.syntaxHighlightDeletions!==!1,syntaxHighlightDeletionsMaxLength:3e3,mergeControls:e.mergeControls??!0,overrideChunk:e.allowInlineDiffs?aM:void 0,side:`b`}),Kj.init(()=>t),e.gutter===!1?[]:Uj,e.collapseUnchanged?Pj(e.collapseUnchanged):[],nj.init(e=>ij.build(t,e.doc,n))]}var Gj=Il.define(),Kj=Al.define({create:()=>Ml.empty,update(e,t){for(let n of t.effects)n.is(Gj)&&(e=n.value.doc);return e}}),qj=new WeakMap,Jj=class extends El{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 Yj(e,t,n){let r=qj.get(t.changes);if(r)return r;let i=Nl.widget({block:!0,side:-1,widget:new Jj(r=>{let{highlightChanges:i,syntaxHighlightDeletions:a,syntaxHighlightDeletionsMaxLength:o,mergeControls:s}=e.facet($A),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(),Xj(r,r.posAtDOM(c))},i=e=>{e.preventDefault(),Zj(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(Kj).sliceString(t.fromA,t.endA),u=a&&e.facet(Wl),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)==`
30
30
  `){d.firstChild||d.appendChild(document.createElement(`br`)),d=h(),r++;continue}let e=t,a=n+(m?` cm-deletedText`:``),o=!1,s=l.indexOf(`
31
- `,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;jl(t,{style:t=>Gl(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 qj.set(t.changes,i),i}function Xj(e,t){let{state:n}=e,r=t??n.selection.main.head,i=e.state.field(nj).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(Kj);i.fromB!=i.toB&&i.toA<=o.length&&(a+=e.state.lineBreak);let s=Ol.of({from:i.fromA,to:Math.min(o.length,i.toA),insert:a},o.length);return e.dispatch({effects:Gj.of({doc:s.apply(o),changes:s}),userEvent:`accept`}),!0}function Zj(e,t){let{state:n}=e,r=t??n.selection.main.head,i=n.field(nj).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=n.field(Kj).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 Qj(e){let t=new Pl;for(let n of e.field(nj)){let r=e.facet($A).overrideChunk&&tM(e,n);t.add(n.fromB,n.fromB,Yj(e,n,!!r))}return t.finish()}var $j=Al.define({create:e=>Qj(e),update(e,t){return t.state.field(nj,!1)==t.startState.field(nj,!1)?e:Qj(t.state)},provide:e=>zl.decorations.from(e)}),eM=new WeakMap;function tM(e,t){let n=eM.get(t);if(n!==void 0)return n;n=null;let r=e.field(Kj),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(Nl.widget({widget:new nM(t),side:-1}).range(s+n.fromB))}n.fromB<n.toB&&e.push(vj.range(s+n.fromB,s+n.toB))}i<t.endA-t.fromA-a*2&&(n=e)}return eM.set(t,n),n}var nM=class extends El{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}},rM=new class extends Bl{constructor(){super(...arguments),this.elementClass=`cm-inlineChangedLineGutter`}},iM=Nl.line({class:`cm-inlineChangedLine`});function aM(e,t,n,r){let i=tM(e,t),a=0;if(!i)return!1;for(let o=e.doc.lineAt(t.fromB);;){for(r&&r.add(o.from,o.from,rM),n.add(o.from,o.from,iM);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 oM=ae({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),sM=E({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),cM=zl.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 lM({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 uM(e){let t=(0,$.c)(32),{oldContent:n,newContent:r,layout:i,conflictMode:a,previewMode:o,oursOverride:s,onResolve:c,onAbort:l}=e,{_:u}=rn(),d=s??r,f=(0,Q.useRef)(null),p=(0,Q.useRef)(null),m=(0,Q.useRef)(0),{resolvedTheme:h}=Yn(),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;t[1]!==l||t[2]!==c?(C=()=>{g.current=c,_.current=l},t[1]=l,t[2]=c,t[3]=C):C=t[3],(0,Q.useEffect)(C);let w,T;t[4]!==a||t[5]!==d||t[6]!==i||t[7]!==n||t[8]!==o||t[9]!==h?(w=()=>{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`?oM:sM,u=[zl.editable.of(!1),kl.readOnly.of(!0)],g=[iu,Kl(),...u,l,zl.lineWrapping];if(p.current&&=(p.current.destroy(),null),o)p.current=new zl({doc:d,extensions:g,parent:e}),y(null);else if(a){let i=lM({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 zl({doc:d,extensions:[iu,Kl(),zl.editable.of(!1),l,cM,zl.lineWrapping,Wj({original:n,highlightChanges:!0,gutter:!0,mergeControls:i,collapseUnchanged:{margin:3,minSize:4}}),zl.updateListener.of(e=>{let t=rj(e.state);y(t?t.chunks.length:0)})],parent:e});p.current=a;let o=rj(a.state);y(o?o.chunks.length:0)}else i===`split`?p.current=new Bj({a:{doc:n,extensions:g},b:{doc:d,extensions:g},parent:e,highlightChanges:!0,gutter:!0,collapseUnchanged:{margin:3,minSize:4}}):p.current=new zl({doc:d,extensions:[...g,Wj({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)}},T=[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]=w,t[11]=T):(w=t[10],T=t[11]),(0,Q.useEffect)(w,T);let E;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(E=function(){let e=p.current;!e||!(e instanceof zl)||g.current?.(e.state.doc.toString())},t[12]=E):E=t[12];let D=E,O;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(O=function(){let e=p.current;!e||!(e instanceof zl)||U(e)},t[13]=O):O=t[13];let k=O,A=v===0,j;t[14]!==u||t[15]!==v?(j=v===null?``:v===0?u({id:`lPzyrU`}):As._({id:`8FqTCr`,values:{chunksRemaining:v}}),t[14]=u,t[15]=v,t[16]=j):j=t[16];let M=j,N;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsx)(`div`,{ref:f,className:`diff-view min-h-0 flex-1 overflow-y-auto subtle-scrollbar`}),t[17]=N):N=t[17];let P;if(t[18]!==u||t[19]!==x){let e;t[21]===u?e=t[22]:(e=e=>(0,sd.createPortal)((0,Z.jsx)(Ci,{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),P=x.map(e),t[18]=u,t[19]=x,t[20]=P}else P=t[20];let F;t[23]!==A||t[24]!==a||t[25]!==M||t[26]!==l||t[27]!==c?(F=a&&(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-3 py-2 border-t shrink-0`,children:[(0,Z.jsx)(`span`,{className:`text-xs ${A?`text-emerald-600 dark:text-emerald-400`:`text-muted-foreground`}`,children:M}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[l&&(0,Z.jsx)(Ci,{className:`uppercase font-mono`,variant:`ghost`,size:`sm`,onClick:l,children:(0,Z.jsx)(Y,{id:`XyOUTJ`})}),(0,Z.jsx)(Ci,{className:`uppercase font-mono`,variant:`outline`,size:`sm`,onClick:k,children:`Undo`}),c&&(0,Z.jsx)(Ci,{variant:`default`,size:`sm`,disabled:!A,onClick:D,children:(0,Z.jsx)(Y,{id:`Lcehxn`})})]})]}),t[23]=A,t[24]=a,t[25]=M,t[26]=l,t[27]=c,t[28]=F):F=t[28];let I;return t[29]!==F||t[30]!==P?(I=(0,Z.jsxs)(`div`,{className:`flex flex-col h-full`,children:[N,P,F]}),t[29]=F,t[30]=P,t[31]=I):I=t[31],I}async function dM(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 fM(e,t){return dM(e,`content`,t)}async function pM(e){return dM(e,`mine`)}async function mM(e){return dM(e,`theirs`)}async function hM(e){return dM(e,`delete`)}async function gM(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 _M(e){let t=(0,$.c)(84),{docName:n}=e,{_:r}=rn(),{conflicts:i,loading:a}=Wi(),o;if(t[0]!==i||t[1]!==n){let e;t[3]===n?e=t[4]:(e=e=>ml(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,g;t[5]===n?(h=t[6],g=t[7]):(h=()=>(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}))}),g=[n],t[5]=n,t[6]=h,t[7]=g),(0,Q.useEffect)(h,g);let _=a||s===void 0,v,y;t[8]!==_||t[9]!==c?(v=()=>{if(_)return;let e=!1;return u(null),f(!1),gM(c).then(t=>{e||(t===null?f(!0):u(t))}),()=>{e=!0}},y=[c,_],t[8]=_,t[9]=c,t[10]=v,t[11]=y):(v=t[10],y=t[11]),(0,Q.useEffect)(v,y);let b;t[12]!==r||t[13]!==c?(b=async function(e){let t=await fM(c,e);t.ok||bs.error(r({id:`K-h9cT`,values:{filePath:c}}),{description:t.detail})},t[12]=r,t[13]=c,t[14]=b):b=t[14];let x=b,S;t[15]!==r||t[16]!==c?(S=async function(e){m(!0);let t=await e(c);t.ok||(m(!1),bs.error(r({id:`jPUPvG`,values:{filePath:c}}),{description:t.detail}))},t[15]=r,t[16]=c,t[17]=S):S=t[17];let C=S;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)(Y,{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)(Y,{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)(uM,{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)(Y,{id:`V48OUT`,values:n,components:r})}),t[27]=n,t[28]=i);let a;t[29]===C?a=t[30]:(a=()=>void C(hM),t[29]=C,t[30]=a);let o;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(Y,{id:`Vlc75q`}),t[31]=o):o=t[31];let s;t[32]!==p||t[33]!==a?(s=(0,Z.jsx)(Ci,{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]===C?u=t[36]:(u=()=>void C(mM),t[35]=C,t[36]=u);let d;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Y,{id:`3mFsc3`}),t[37]=d):d=t[37];let f;t[38]!==p||t[39]!==u?(f=(0,Z.jsx)(Ci,{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 h;t[44]!==i||t[45]!==m?(h=(0,Z.jsxs)(`div`,{className:`flex flex-shrink-0 flex-wrap items-center justify-between gap-x-6 gap-y-3 border-t px-6 py-4`,children:[i,m]}),t[44]=i,t[45]=m,t[46]=h):h=t[46];let g;return t[47]!==h||t[48]!==e?(g=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[e,h]}),t[47]=h,t[48]=e,t[49]=g):g=t[49],g}if(l.kind===`modify-delete`){let e;t[50]===l.ours?e=t[51]:(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(uM,{oldContent:``,newContent:l.ours,layout:`unified`,previewMode:!0})}),t[50]=l.ours,t[51]=e);let n;t[52]===c?n=t[53]:(n={filePath:c},t[52]=c,t[53]=n);let r;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(r={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[54]=r):r=t[54];let i;t[55]===n?i=t[56]:(i=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`EhDLBx`,values:n,components:r})}),t[55]=n,t[56]=i);let a;t[57]===C?a=t[58]:(a=()=>void C(pM),t[57]=C,t[58]=a);let o;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(Y,{id:`0NA4b3`}),t[59]=o):o=t[59];let s;t[60]!==p||t[61]!==a?(s=(0,Z.jsx)(Ci,{type:`button`,variant:`default`,disabled:p,onClick:a,children:o}),t[60]=p,t[61]=a,t[62]=s):s=t[62];let u;t[63]===C?u=t[64]:(u=()=>void C(hM),t[63]=C,t[64]=u);let d;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Y,{id:`qSxaOz`}),t[65]=d):d=t[65];let f;t[66]!==p||t[67]!==u?(f=(0,Z.jsx)(Ci,{type:`button`,variant:`destructive`,disabled:p,onClick:u,children:d}),t[66]=p,t[67]=u,t[68]=f):f=t[68];let m;t[69]!==s||t[70]!==f?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-3`,children:[s,f]}),t[69]=s,t[70]=f,t[71]=m):m=t[71];let h;t[72]!==i||t[73]!==m?(h=(0,Z.jsxs)(`div`,{className:`flex flex-shrink-0 flex-wrap items-center justify-between gap-x-6 gap-y-3 border-t px-6 py-4`,children:[i,m]}),t[72]=i,t[73]=m,t[74]=h):h=t[74];let g;return t[75]!==h||t[76]!==e?(g=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[e,h]}),t[75]=h,t[76]=e,t[77]=g):g=t[77],g}let w;t[78]===x?w=t[79]:(w=e=>void x(e),t[78]=x,t[79]=w);let T;return t[80]!==l.ours||t[81]!==l.theirs||t[82]!==w?(T=(0,Z.jsx)(uM,{oldContent:l.theirs,newContent:l.ours,layout:`unified`,conflictMode:!0,onResolve:w}),t[80]=l.ours,t[81]=l.theirs,t[82]=w,t[83]=T):T=t[83],T}function vM(e){let t=(0,$.c)(2),{docName:n,provider:r,children:i}=e;(0,Q.use)(Rt(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 yM=`__back-nav__`;function bM(e){return e instanceof Oe||e instanceof ht||e instanceof xe||e instanceof Ze||e instanceof At||e instanceof A?e.docName:null}function xM(e){if(e instanceof Oe){let t=e.docName;return{title:As._({id:`Jejur6`}),summary:As._({id:`jSY41h`,values:{docName:t}})}}if(e instanceof ht){let t=e.docName;return{title:As._({id:`V7QxyT`}),summary:As._({id:`xG4tb6`,values:{docName:t}})}}if(e instanceof xe){let t=e.docName;return{title:As._({id:`1di5fu`}),summary:As._({id:`PQCdtv`,values:{docName:t}})}}if(e instanceof Ze){let t=e.docName;return{title:As._({id:`wvbc1r`}),summary:As._({id:`IX7-sq`,values:{docName:t}})}}if(e instanceof At)return{title:As._({id:`Gfr4fu`}),summary:As._({id:`UW2Fg3`})};if(e instanceof A){let t=e.docName;return{title:As._({id:`vv7kpg`}),summary:As._({id:`mdKFEy`,values:{docName:t}})}}let t=e instanceof Error&&e.message?e.message:As._({id:`W5A0Ly`});return{title:As._({id:`29VNqC`}),summary:t}}function SM(e){let t=(0,$.c)(28),{error:n,resetErrorBoundary:r,activeDocName:i,previousDocName:a,onNavigateBack:o}=e,s;t[0]===n?s=t[1]:(s=xM(n),t[0]=n,t[1]=s);let{title:c,summary:l}=s,u=!!a&&!!o,d=(0,Q.useRef)(null),f,p;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=()=>{d.current?.focus()},p=[],t[2]=f,t[3]=p):(f=t[2],p=t[3]),(0,Q.useEffect)(f,p);let m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(Yw,{size:80,variant:`sleeping`}),t[4]=m):m=t[4];let h;t[5]===c?h=t[6]:(h=(0,Z.jsx)(`h2`,{id:`document-error-title`,className:`text-2xl font-light tracking-tighter text-balance`,children:c}),t[5]=c,t[6]=h);let g;t[7]===l?g=t[8]:(g=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-muted-foreground`,children:l}),t[7]=l,t[8]=g);let _;t[9]!==h||t[10]!==g?(_=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[h,g]}),t[9]=h,t[10]=g,t[11]=_):_=t[11];let v;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(Y,{id:`KDw4GX`}),t[12]=v):v=t[12];let y;t[13]===r?y=t[14]:(y=(0,Z.jsx)(Ci,{ref:d,variant:`default`,onClick:r,children:v}),t[13]=r,t[14]=y);let b;t[15]!==i||t[16]!==u||t[17]!==n||t[18]!==o||t[19]!==a||t[20]!==r?(b=u?(0,Z.jsx)(Ci,{variant:`ghost`,className:`font-mono uppercase`,onClick:()=>{!a||!o||(it(bM(n)??i),o(a),r(yM))},children:(0,Z.jsx)(Y,{id:`CKyk7Q`})}):null,t[15]=i,t[16]=u,t[17]=n,t[18]=o,t[19]=a,t[20]=r,t[21]=b):b=t[21];let x;t[22]!==b||t[23]!==y?(x=(0,Z.jsxs)(`div`,{className:`mt-1 flex gap-2`,children:[y,b]}),t[22]=b,t[23]=y,t[24]=x):x=t[24];let S;return t[25]!==x||t[26]!==_?(S=(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:[m,_,x]}),t[25]=x,t[26]=_,t[27]=S):S=t[27],S}function CM(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)(SM,{...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]===yM){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}: ${xM(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)(h,{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 wM(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=$r(t);return{map:n,keys:Br(t),parseError:r}}function TM(e){let t=(0,$.c)(21),{provider:n}=e,r;t[0]===n?r=t[1]:(r=()=>wM(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=Jn(n);a(e.current());let t=e.subscribe(e=>{a(e)});return()=>{t(),e.dispose()}},s=[n],t[2]=n,t[3]=o,t[4]=s),(0,Q.useEffect)(o,s);let c;t[5]===i.map.icon?c=t[6]:(c=qe(i.map.icon),t[5]=i.map.icon,t[6]=c);let l=c,u;t[7]===i.map.cover?u=t[8]:(u=ct(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)(EM,{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)(DM,{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 EM(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 DM(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 OM=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{ManagedArtifactProperties:e}=await import(`./ManagedArtifactProperties-CYtk8Bqt.js`);return{ManagedArtifactProperties:e}},__vite__mapDeps([74,1,49,2,50,51,31,52,53,54,55,56,57,58,59,20,9,10,7,11,30,3,32,6,4,15,12,13,22,14,60,16,43,44,45,61,62,23,63,69,70,21,75,8,76,77,47,24]),import.meta.url)).ManagedArtifactProperties})),kM=vl(`LARGE_DOC_CHAR_THRESHOLD`,5e5);function AM(e){let t=e.threshold??kM;return e.ytextLength>t?{renderSource:e.isSourceMode||e.visitedSource,renderVisual:!e.isSourceMode||e.visitedVisual,isLarge:!0}:{renderSource:!0,renderVisual:!0,isLarge:!1}}function jM(e){return e.hasEmittedFirstToggle||!e.isLarge?!1:e.renderSource&&e.renderVisual}var MM=vl(`ACTIVITY_MOUNT_LIMIT`,3);function NM(){return n(()=>import(`./SourceEditor-Cd7sWXXb.js`),__vite__mapDeps([78,1,49,2,50,51,31,52,53,54,55,56,57,58,59,20,9,10,7,11,30,3,32,6,4,15,12,13,22,14,60,16,43,44,45,61,62,23,63,79,34,77,73]),import.meta.url)}var PM=(0,Q.lazy)(async()=>({default:(await NM()).SourceEditor}));function FM(e,t,n){if(n<=0)return[];let r=e.filter(e=>!ze(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 IM(e,t){return t.kind===`idle`?null:t.kind===`failed`&&t.failedDocNames.includes(e)?{kind:`failed`,title:As._({id:`MTs6g3`}),summary:t.reason===`clear-data-timeout`?As._({id:`Sc1bKE`,values:{docName:e}}):As._({id:`ovIGrT`,values:{docName:e}}),actionLabel:As._({id:`HpK_8d`})}:t.kind===`recovering`&&t.docNames.includes(e)?{kind:`recovering`,title:As._({id:`cF9DyA`}),summary:t.phase===`clearing-local-cache`?As._({id:`bmC18N`,values:{docName:e}}):As._({id:`pAgkuZ`,values:{docName:e}})}:null}function LM(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(_l,{name:`activity-pool`,children:(0,Z.jsx)(RM,{...e})}),t[0]=e,t[1]=n),n}function RM(e){let t=(0,$.c)(15),{activeDocName:n,isSourceMode:r,editorPlaceholder:i,previousDocName:a,onNavigateBack:o,onRecycle:s}=e,{poolEntries:c,serverRestartRecovery:l}=ft(),{pages:u,loading:d}=so(),f=FM(c,n,MM),p=(0,Q.useRef)(``),m=f.map(zM).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;se(e,t&&t.length>0?t:crypto.randomUUID())}gl(`ok/activity/mount-list-change`,{active:n,mounted:t,evicted:r}),p.current=m,S(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)(GM,{entry:e,isActive:e.docName===n,isSourceMode:r,editorPlaceholder:i,isNewDoc:!d&&!u.has(e.docName)&&!vr(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 zM(e){return e.docName}function BM(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&&gl(`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&&(gl(`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&&gl(`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 VM(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)(MC,{}),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)(PM,{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 HM(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)(fo,{className:`size-5`,"aria-hidden":`true`}):(0,Z.jsx)(Vo,{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)(Ci,{type:`button`,onClick:UM,children:[(0,Z.jsx)(fo,{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 UM(){return window.location.reload()}function WM(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 GM(e){let t=(0,$.c)(53),{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a,isNewDoc:o,previousDocName:s,onNavigateBack:c,onRecycle:l,serverRestartRecovery:u}=e,d;t[0]!==n.docName||t[1]!==u?(d=IM(n.docName,u),t[0]=n.docName,t[1]=u,t[2]=d):d=t[2];let f=d,p=VE(n.docName)===`conflict`,m;t[3]===n.docName?m=t[4]:(m=()=>{let e=document.createElement(`div`);return e.setAttribute(`data-ok-editor-portal`,n.docName),e.style.display=`contents`,e},t[3]=n.docName,t[4]=m);let[h]=(0,Q.useState)(m),g=n.provider.document.getText(`source`).length,[_,v]=(0,Q.useState)(i),[y,x]=(0,Q.useState)(!i),S,C;t[5]!==i||t[6]!==_||t[7]!==y?(S=()=>{i&&!_?v(!0):!i&&!y&&x(!0)},C=[i,_,y],t[5]=i,t[6]=_,t[7]=y,t[8]=S,t[9]=C):(S=t[8],C=t[9]),(0,Q.useEffect)(S,C);let w=AM({ytextLength:g,isSourceMode:i,visitedSource:_,visitedVisual:y}),T=(0,Q.useRef)(``),E=`${w.isLarge}-${w.renderSource}-${w.renderVisual}`,D,k;t[10]!==n.docName||t[11]!==w.isLarge||t[12]!==w.renderSource||t[13]!==w.renderVisual||t[14]!==E||t[15]!==i||t[16]!==g?(D=()=>{T.current!==E&&(T.current=E,w.isLarge&&gl(`ok/activity/defer-mount`,{docName:n.docName,ytextLength:g,isSourceMode:i,renderSource:w.renderSource,renderVisual:w.renderVisual}))},k=[E,w.isLarge,w.renderSource,w.renderVisual,n.docName,g,i],t[10]=n.docName,t[11]=w.isLarge,t[12]=w.renderSource,t[13]=w.renderVisual,t[14]=E,t[15]=i,t[16]=g,t[17]=D,t[18]=k):(D=t[17],k=t[18]),(0,Q.useEffect)(D,k);let A;t[19]===n.docName?A=t[20]:(A=()=>H(n.docName),t[19]=n.docName,t[20]=A);let[j]=(0,Q.useState)(A),M=j?.html??null,[N,P]=(0,Q.useState)(!1),F,I;t[21]!==n.docName||t[22]!==w.isLarge||t[23]!==w.renderSource||t[24]!==w.renderVisual||t[25]!==N||t[26]!==i||t[27]!==g?(F=()=>{jM({isLarge:w.isLarge,renderSource:w.renderSource,renderVisual:w.renderVisual,hasEmittedFirstToggle:N})&&(gl(`ok/cold/first-toggle`,{docName:n.docName,mountId:O(n.docName),ytextLength:g,modeEnteredFirst:i?`source`:`visual`}),P(!0))},I=[N,w.isLarge,w.renderSource,w.renderVisual,n.docName,g,i],t[21]=n.docName,t[22]=w.isLarge,t[23]=w.renderSource,t[24]=w.renderVisual,t[25]=N,t[26]=i,t[27]=g,t[28]=F,t[29]=I):(F=t[28],I=t[29]),(0,Q.useEffect)(F,I);let L=r?`visible`:`hidden`,R=`editor:${n.docName}`,z=j?.scrollTop,B;t[30]!==a||t[31]!==n||t[32]!==w.renderSource||t[33]!==w.renderVisual||t[34]!==r||t[35]!==p||t[36]!==o||t[37]!==i||t[38]!==c||t[39]!==l||t[40]!==h||t[41]!==s||t[42]!==f||t[43]!==M?(B=f?(0,Z.jsx)(HM,{view:f}):(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsx)(CM,{activeDocName:n.docName,previousDocName:s,onNavigateBack:c,onRecycle:l,children:(0,Z.jsx)(Q.Suspense,{fallback:M?(0,Z.jsx)(WM,{html:M}):(0,Z.jsx)(MC,{}),children:(0,Z.jsx)(vM,{docName:n.docName,provider:n.provider,children:p?(0,Z.jsx)(_M,{docName:n.docName,provider:n.provider}):(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[!i&&(vr(n.docName)||b(n.docName)?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(OM,{docName:n.docName,provider:n.provider})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(TM,{provider:n.provider}),(0,Z.jsx)(qa,{provider:n.provider})]})),(0,Z.jsxs)(`div`,{className:`relative flex-1`,children:[w.renderSource?(0,Z.jsx)(`div`,{className:i?`h-full`:`ok-mode-hidden h-full`,children:(0,Z.jsx)(VM,{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a})}):null,w.renderVisual?(0,Z.jsx)(`div`,{className:i?`ok-mode-hidden h-full`:`h-full`,children:(0,Z.jsx)(hA,{provider:n.provider,placeholder:a,isSourceMode:i,portalTarget:h},`${n.docName}-${String(o)}-${n.poolEventId}`)}):null]})]})})})})}),t[30]=a,t[31]=n,t[32]=w.renderSource,t[33]=w.renderVisual,t[34]=r,t[35]=p,t[36]=o,t[37]=i,t[38]=c,t[39]=l,t[40]=h,t[41]=s,t[42]=f,t[43]=M,t[44]=B):B=t[44];let V;t[45]!==r||t[46]!==z||t[47]!==B?(V=(0,Z.jsx)(BM,{isActive:r,initialScrollTop:z,children:B}),t[45]=r,t[46]=z,t[47]=B,t[48]=V):V=t[48];let U;return t[49]!==L||t[50]!==R||t[51]!==V?(U=(0,Z.jsx)(Q.Activity,{mode:L,name:R,children:V}),t[49]=L,t[50]=R,t[51]=V,t[52]=U):U=t[52],U}function KM(e){let t=e.endsWith(`rem`)?`rem`:`px`;return{value:Number.parseFloat(e),unit:t}}function qM(e){let{value:t,unit:n}=KM(e);return n===`rem`?t*16:t}function JM(e,t){return`${t===`rem`?e.toFixed(1):Math.round(e)}${t}`}var YM=3600*24*7;function XM(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?ZM:m,O=g===void 0?YM:g,k=_===void 0?!1:_,A=(0,Q.useRef)(null),j=(0,Q.useRef)(0),M=(0,Q.useRef)(0),N=(0,Q.useRef)(!1),P=(0,Q.useRef)(!1),F=(0,Q.useRef)(null),I=(0,Q.useRef)(0),L=(0,Q.useRef)(!1),R=(0,Q.useRef)(0),z=(0,Q.useRef)(0),B=(0,Q.useRef)(null),V=(0,Q.useRef)(r),H=(0,Q.useRef)(y),U,W;t[0]===r?(U=t[1],W=t[2]):(U=()=>{V.current=r},W=[r],t[0]=r,t[1]=U,t[2]=W),(0,Q.useEffect)(U,W);let G,K;t[3]===y?(G=t[4],K=t[5]):(G=()=>{H.current=y},K=[y],t[3]=y,t[4]=G,t[5]=K),(0,Q.useEffect)(G,K);let ee=qM(b),te;t[6]===x?te=t[7]:(te=qM(x),t[6]=x,t[7]=te);let q=te,J;t[8]!==E||t[9]!==k?(J=function(e){E&&(P.current=!0,j.current=H.current?0:qM(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]=J):J=t[10];let ne=J,re,ie;t[11]!==w||t[12]!==v||t[13]!==C||t[14]!==S||t[15]!==T||t[16]!==k||t[17]!==q||t[18]!==ee||t[19]!==i||t[20]!==a||t[21]!==D||t[22]!==O||t[23]!==h?(re=()=>{let e=function(e){h&&(document.cookie=`${h}=${e}; path=/; max-age=${O}`)},t=function(e,t){return v===`left`?e<t:e>t},n=function(e,t,n,r){if(k&&r){let r=e.clientX-t;return v===`left`?n-r:n+r}return v===`left`?window.innerWidth-e.clientX:e.clientX},r=function(r){if(!P.current)return;let o=Math.abs(r.clientX-M.current);if(!N.current&&o>5&&(N.current=!0,D(!0)),N.current){let{unit:o}=KM(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<=ee*w;else if(e<=ee){let n=ee*(w-1);t=ee-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>ee*T){a();let t=n(r,M.current,j.current,s),c=Math.max(ee,Math.min(q,t)),u=JM(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(ee,Math.min(q,u)),f=JM(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)}},ie=[i,a,D,ee,q,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]=q,t[18]=ee,t[19]=i,t[20]=a,t[21]=D,t[22]=O,t[23]=h,t[24]=re,t[25]=ie):(re=t[24],ie=t[25]),(0,Q.useEffect)(re,ie);let ae;return t[26]===ne?ae=t[27]:(ae={dragRef:A,isDragging:N,handleMouseDown:ne},t[26]=ne,t[27]=ae),ae}function ZM(){}var QM=3600*24*7,$M=`18rem`,eN=`3rem`,tN=`app-file-sidebar`,nN=`14.625rem`,rN=`32rem`,iN=`sidebar_width`,aN=/^\d+(?:\.\d+)?(?:rem|px)$/,oN=Q.createContext(null);function sN(e){if(typeof document>`u`)return e;let t=document.cookie.split(`; `).find(e=>e.startsWith(`${iN}=`))?.split(`=`)[1];if(!t)return e;let n;try{n=decodeURIComponent(t)}catch{return e}return aN.test(n)?n:e}function cN(){let e=Q.use(oN);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function lN(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?$M:c,[u]=Q.useState(dN),d;t[8]===u?d=t[9]:(d=()=>ZE(u,window.innerWidth,`left`),t[8]=u,t[9]=d);let[f,p]=Q.useState(d),m;t[10]===l?m=t[11]:(m=()=>sN(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=iD();return oD(`left`,ZE(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),sD(`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(uN)},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: ${JE}px)`),t=()=>{let e=ZE(u,window.innerWidth,`left`);p(e),C(oD(`left`,e,iD())===`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(tN)?.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=>{wl(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":eN,...s},t[45]=s,t[46]=h,t[47]=U):U=t[47];let W=U,G;t[48]===r?G=t[49]:(G=X(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),t[48]=r,t[49]=G);let K;t[50]!==n||t[51]!==a||t[52]!==W||t[53]!==G?(K=(0,Z.jsx)(`div`,{"data-slot":`sidebar-wrapper`,style:W,className:G,...a,children:n}),t[50]=n,t[51]=a,t[52]=W,t[53]=G,t[54]=K):K=t[54];let ee;return t[55]!==H||t[56]!==K?(ee=(0,Z.jsx)(oN.Provider,{value:H,children:K}),t[55]=H,t[56]=K,t[57]=ee):ee=t[57],ee}function uN(e){return!e}function dN(){return Fr()}function fN(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}=rn(),{state:f,isDraggingRail:p}=cN();if(u===`none`){let e;t[7]===r?e=t[8]:(e=X(`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=X(`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=X(`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:tN,"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 pN(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}=rn(),{toggleSidebar:o,state:s}=cN(),c,l,u,d,f,p,m,h;if(t[4]!==a||t[5]!==s){let e=Tl(`toggle-files-sidebar`);c=Ci,l=`trigger`,u=`sidebar-trigger`,d=`ghost`,f=`icon-sm`,p=s===`expanded`,m=tN,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=X(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)(mt,{}):(0,Z.jsx)(Xd,{}),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 mN(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}=rn(),{toggleSidebar:u,setWidth:d,state:f,width:p,setIsDraggingRail:m}=cN(),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:nN,maxResizeWidth:rN,setIsDraggingRail:m,widthCookieName:iN,widthCookieMaxAge:QM},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}=XM(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=X(`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 hN(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}=cN(),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=X(`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 gN(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=X(`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 _N(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=X(`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 vN(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=X(`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 yN(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=X(`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 bN(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?Si:`div`,o;t[4]===n?o=t[5]:(o=X(`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 xN(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?Si:`button`,o;t[4]===n?o=t[5]:(o=X(`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 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=X(`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 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=X(`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 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=X(`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 TN=xi(`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 EN(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?Si:`button`,{state:m}=cN(),h;t[8]!==n||t[9]!==f||t[10]!==d?(h=X(TN({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)(zs,{asChild:!0,children:_}),t[20]=_,t[21]=v);let y=m!==`collapsed`,b;t[22]!==y||t[23]!==c?(b=(0,Z.jsx)(Bs,{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)(Hs,{children:[v,b]}),t[25]=v,t[26]=b,t[27]=x):x=t[27],x}function DN(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?Si:`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=X(`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 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=X(`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 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=X(`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 AN(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?Si:`a`,d;t[6]===n?d=t[7]:(d=X(`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 jN(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 MN(){let e=await fetch(`/api/server-info`,{signal:AbortSignal.timeout(5e3)});if(!e.ok)return null;let t=await e.json(),n=qr.safeParse(t);return n.success?n.data.currentBranch??null:null}var NN=typeof window>`u`?{getSnapshot:()=>null,subscribe:()=>()=>{}}:jN({fetchBranch:MN,subscribeToEvent:Cs}),PN=NN.subscribe,FN=NN.getSnapshot;function IN(){return(0,Q.useSyncExternalStore)(PN,FN,FN)}function LN(){let e=(0,$.c)(6),t=IN(),n=mo(),{state:r}=cN(),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&&Vi(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 RN(e){let t=(0,$.c)(27),{stats:n,selectionStats:r,showStats:i,composerBadge:a}=e,o=i===void 0?!0:i,{_:s}=rn(),c=LN();if(!o&&c===null&&a==null)return null;let l=r??n,u=r!=null,{words:d,chars:f,tokens:p}=l,m;t[0]!==s||t[1]!==u||t[2]!==o?(m=s(o?u?{id:`Bv5a9_`}:{id:`L1ZE3M`}:{id:`goO4Ll`}),t[0]=s,t[1]=u,t[2]=o,t[3]=m):m=t[3];let h;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-full h-2 bg-linear-to-t from-background to-transparent`}),t[4]=h):h=t[4];let g;t[5]!==s||t[6]!==a?(g=a?(0,Z.jsxs)(Ci,{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)(gs,{className:`size-3`,"aria-hidden":!0}),s({id:`xWEvuo`}),(0,Z.jsx)(qt,{className:`size-3`,"aria-hidden":!0})]}):null,t[5]=s,t[6]=a,t[7]=g):g=t[7];let _;t[8]===c?_=t[9]:(_=c===null?null:(0,Z.jsx)(zN,{identity:c}),t[8]=c,t[9]=_);let v;t[10]===_?v=t[11]:(v=(0,Z.jsx)(`span`,{className:`flex min-w-0 items-center gap-3`,children:_}),t[10]=_,t[11]=v);let y;t[12]!==s||t[13]!==l.chars||t[14]!==l.tokens||t[15]!==l.words||t[16]!==f||t[17]!==u||t[18]!==o||t[19]!==p||t[20]!==d?(y=o?(0,Z.jsxs)(`span`,{className:`flex shrink-0 items-center gap-3`,children:[u?(0,Z.jsx)(`span`,{className:`font-medium text-foreground/70`,"data-testid":`editor-footer-selected-label`,children:s({id:`ylXj1N`})}):null,(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:l.words.toLocaleString()}),` `,(0,Z.jsx)(Y,{id:`gljvbT`,values:{words:d}})]}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:l.chars.toLocaleString()}),` `,(0,Z.jsx)(Y,{id:`d5rK4X`,values:{chars:f}})]}),(0,Z.jsxs)(`span`,{children:[l.tokens>0?`~`:``,(0,Z.jsx)(`span`,{className:`tabular-nums`,children:l.tokens.toLocaleString()}),` `,(0,Z.jsx)(Y,{id:`uynXup`,values:{tokens:p}})]})]}):null,t[12]=s,t[13]=l.chars,t[14]=l.tokens,t[15]=l.words,t[16]=f,t[17]=u,t[18]=o,t[19]=p,t[20]=d,t[21]=y):y=t[21];let b;return t[22]!==m||t[23]!==g||t[24]!==v||t[25]!==y?(b=(0,Z.jsxs)(`section`,{"aria-label":m,className:`relative flex h-6 shrink-0 items-center justify-between gap-3 bg-background px-3 text-2xs text-muted-foreground`,children:[h,g,v,y]}),t[22]=m,t[23]=g,t[24]=v,t[25]=y,t[26]=b):b=t[26],b}function zN(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)(Hs,{children:[(0,Z.jsx)(zs,{asChild:!0,children:(0,Z.jsx)(`span`,{tabIndex:0,className:`truncate`,"data-testid":`editor-footer-project-name`,children:r})}),(0,Z.jsx)(Bs,{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)(xt,{"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 BN(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}=rn(),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=X(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 VN(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=X(`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 HN(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=X(`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 UN(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=X(`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 WN(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=X(`[&>svg]:size-3.5`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=n??(0,Z.jsx)(io,{}),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 GN=1,KN=2,qN=4;function JN(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=Qr(n),u=e?e.kind===`template`?e.folder.split(`/`).filter(Boolean):[]:ie(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>qN?[...u.slice(0,GN).map((e,t)=>d(e,t)),{kind:`ellipsis`,hidden:u.slice(GN,-KN)},...u.slice(-KN).map((e,t)=>d(e,u.length-KN+t))]:u.map((e,t)=>d(e,t));a=BN,t[8]===r?c=t[9]:(c=X(`flex min-w-0 items-center`,r),t[8]=r,t[9]=c),i=VN,o=`min-w-0 flex-nowrap gap-1 overflow-hidden text-muted-foreground/70 text-xs`,s=f.map(YN)}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 YN(e,t){let n=e.kind===`segment`?e.key:`ellipsis`;return(0,Z.jsxs)(Q.Fragment,{children:[t>0&&(0,Z.jsx)(WN,{className:`shrink-0 text-muted-foreground/70 [&>svg]:size-3`}),e.kind===`ellipsis`?(0,Z.jsxs)(HN,{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)(bd,{className:`size-3.5`})}),(0,Z.jsx)(`span`,{className:`sr-only`,children:e.hidden.join(` / `)})]}):(0,Z.jsx)(HN,{className:`min-w-0`,children:(0,Z.jsx)(UN,{current:!1,className:`min-w-0 truncate font-normal text-muted-foreground/70`,title:e.value,children:e.value})})]},n)}var XN={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`},ZN=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`,...XN,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},QN=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)(ZN,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i},$N=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)(ZN,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i};function eP(e){let t=(0,$.c)(29),{isSourceMode:n,onModeChange:r,sourceDisabled:i}=e,a=i===void 0?!1:i,{_:o}=rn(),s=n?`source`:`wysiwyg`,c;t[0]===r?c=t[1]:(c=e=>{e&&r(e)},t[0]=r,t[1]=c);let l;t[2]===o?l=t[3]:(l=o({id:`n7aopT`}),t[2]=o,t[3]=l);let u;t[4]===o?u=t[5]:(u=o({id:`ur2XSb`}),t[4]=o,t[5]=u);let d;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(zs,{children:(0,Z.jsx)($N,{className:`size-4`})}),t[6]=d):d=t[6];let f;t[7]===u?f=t[8]:(f=(0,Z.jsx)(Ia,{value:`wysiwyg`,"aria-label":u,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,asChild:!0,children:d}),t[7]=u,t[8]=f);let p;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(Bs,{side:`bottom`,children:(0,Z.jsx)(Y,{id:`Mb_20S`})}),t[9]=p):p=t[9];let m;t[10]===f?m=t[11]:(m=(0,Z.jsxs)(Hs,{children:[f,p]}),t[10]=f,t[11]=m);let h;t[12]===o?h=t[13]:(h=o({id:`xbdtfY`}),t[12]=o,t[13]=h);let g;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(QN,{className:`size-4`}),t[14]=g):g=t[14];let _;t[15]!==a||t[16]!==h?(_=(0,Z.jsx)(zs,{asChild:!0,children:(0,Z.jsx)(`div`,{children:(0,Z.jsx)(Ia,{value:`source`,"aria-label":h,disabled:a,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,children:g})})}),t[15]=a,t[16]=h,t[17]=_):_=t[17];let v;t[18]===a?v=t[19]:(v=(0,Z.jsx)(Bs,{side:`bottom`,children:a?(0,Z.jsx)(Y,{id:`G-JBA1`}):(0,Z.jsx)(Y,{id:`u6Hp4N`})}),t[18]=a,t[19]=v);let y;t[20]!==_||t[21]!==v?(y=(0,Z.jsxs)(Hs,{children:[_,v]}),t[20]=_,t[21]=v,t[22]=y):y=t[22];let b;return t[23]!==y||t[24]!==s||t[25]!==c||t[26]!==l||t[27]!==m?(b=(0,Z.jsxs)(Ra,{type:`single`,value:s,onValueChange:c,"aria-label":l,variant:`segmented`,size:`sm`,spacing:1,className:`shrink-0 bg-muted p-0.5 data-[size=sm]:rounded-[10px]`,children:[m,y]}),t[23]=y,t[24]=s,t[25]=c,t[26]=l,t[27]=m,t[28]=b):b=t[28],b}var tP=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{SkillEditorActions:e}=await import(`./SkillEditorActions-SkSo8rGK.js`);return{SkillEditorActions:e}},__vite__mapDeps([80,1,30,3,7,31,6,10,70,20,9,11,32,12,13,21,16,60,72,18,61,65,23]),import.meta.url)).SkillEditorActions}));function nP(e){let t=(0,$.c)(79),{activeDocName:n,isSourceMode:r,sourceDisabled:i,onModeChange:a,showAddPropertyButton:o,onAddProperty:s,isPanelCollapsed:c,onTogglePanel:l}=e,{_:u}=rn(),d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=Cl(`toggle-document-panel`),t[0]=d):d=t[0];let f=d,p,m,h,g,_,v,y,x,S,C,w,T,E,D,O;if(t[1]!==u||t[2]!==n||t[3]!==c||t[4]!==r||t[5]!==s||t[6]!==a||t[7]!==l||t[8]!==o||t[9]!==i){let e=Tl(`toggle-document-panel`),d;t[25]===n?d=t[26]:(d=n?Qr(n):null,t[25]=n,t[26]=d);let f=d,k;t[27]===n?k=t[28]:(k=n?b(n):null,t[27]=n,t[28]=k);let A=k,j;t[29]!==f||t[30]!==A?(j=f?.kind===`skill`?{scope:f.scope,name:f.name}:A?{scope:`project`,name:A}:null,t[29]=f,t[30]=A,t[31]=j):j=t[31];let M=j;_=`editor-toolbar`,v=`pointer-events-none absolute inset-x-0 top-0 z-10`;let N;t[32]!==n||t[33]!==M?(N=M?null:(0,Z.jsx)(JN,{docName:n}),t[32]=n,t[33]=M,t[34]=N):N=t[34];let P;t[35]===N?P=t[36]:(P=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex min-w-0 items-center`,children:N}),t[35]=N,t[36]=P);let F;t[37]!==r||t[38]!==a||t[39]!==i?(F=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex justify-center`,children:(0,Z.jsx)(eP,{isSourceMode:r,onModeChange:a,sourceDisabled:i})}),t[37]=r,t[38]=a,t[39]=i,t[40]=F):F=t[40],t[41]!==P||t[42]!==F?(y=(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:[P,F]})}),t[41]=P,t[42]=F,t[43]=y):y=t[43],O=`pointer-events-auto absolute top-0 right-0 flex items-center justify-end gap-1 py-2 pr-2`,t[44]===M?h=t[45]:(h=M?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(tP,{scope:M.scope,name:M.name})}):null,t[44]=M,t[45]=h),t[46]!==u||t[47]!==s||t[48]!==o?(g=o&&(0,Z.jsxs)(Hs,{children:[(0,Z.jsx)(Ci,{variant:`ghost`,size:`icon`,"aria-label":u({id:`81H_23`}),onClick:s,"data-testid":`add-properties-button`,asChild:!0,children:(0,Z.jsx)(zs,{children:(0,Z.jsx)(zd,{})})}),(0,Z.jsx)(Bs,{side:`bottom`,children:(0,Z.jsx)(Y,{id:`81H_23`})})]}),t[46]=u,t[47]=s,t[48]=o,t[49]=g):g=t[49],m=Hs,p=Ci,x=``,S=`ghost`,C=`icon`,w=l,T=!c,E=`doc-panel`,D=u(c?{id:`u7H-Wn`,values:{panelShortcutLabel:e}}:{id:`2hpdRq`,values:{panelShortcutLabel:e}}),t[1]=u,t[2]=n,t[3]=c,t[4]=r,t[5]=s,t[6]=a,t[7]=l,t[8]=o,t[9]=i,t[10]=p,t[11]=m,t[12]=h,t[13]=g,t[14]=_,t[15]=v,t[16]=y,t[17]=x,t[18]=S,t[19]=C,t[20]=w,t[21]=T,t[22]=E,t[23]=D,t[24]=O}else p=t[10],m=t[11],h=t[12],g=t[13],_=t[14],v=t[15],y=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];let k;t[50]===c?k=t[51]:(k=(0,Z.jsx)(zs,{children:c?(0,Z.jsx)(Qd,{}):(0,Z.jsx)(Zd,{})}),t[50]=c,t[51]=k);let A;t[52]!==p||t[53]!==k||t[54]!==x||t[55]!==S||t[56]!==C||t[57]!==w||t[58]!==T||t[59]!==E||t[60]!==D?(A=(0,Z.jsx)(p,{"data-doc-panel-toggle":x,variant:S,size:C,onClick:w,"aria-expanded":T,"aria-controls":E,"aria-label":D,asChild:!0,children:k}),t[52]=p,t[53]=k,t[54]=x,t[55]=S,t[56]=C,t[57]=w,t[58]=T,t[59]=E,t[60]=D,t[61]=A):A=t[61];let j;t[62]===c?j=t[63]:(j=(0,Z.jsx)(Bs,{side:`bottom`,children:c?(0,Z.jsx)(Y,{id:`KFdXwz`,values:{panelShortcut:f}}):(0,Z.jsx)(Y,{id:`MsuXaI`,values:{panelShortcut:f}})}),t[62]=c,t[63]=j);let M;t[64]!==m||t[65]!==A||t[66]!==j?(M=(0,Z.jsxs)(m,{children:[A,j]}),t[64]=m,t[65]=A,t[66]=j,t[67]=M):M=t[67];let N;t[68]!==h||t[69]!==g||t[70]!==M||t[71]!==O?(N=(0,Z.jsxs)(`div`,{className:O,children:[h,g,M]}),t[68]=h,t[69]=g,t[70]=M,t[71]=O,t[72]=N):N=t[72];let P;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none h-2 bg-linear-to-b from-background to-transparent`}),t[73]=P):P=t[73];let F;return t[74]!==_||t[75]!==v||t[76]!==y||t[77]!==N?(F=(0,Z.jsxs)(`div`,{"data-testid":_,className:v,children:[y,N,P]}),t[74]=_,t[75]=v,t[76]=y,t[77]=N,t[78]=F):F=t[78],F}function rP(e){let{activeDocName:t,deferredActiveDocName:n,mountResolved:r,syncResolved:i}=e;return t===null||t===n?!1:!(r&&i)}var iP=`ok-terminal-height-v1`,aP=1/3,oP=.5;function sP(e){return Math.max(120,Math.round((Number.isFinite(e)?e:0)*oP))}function cP(e){let t=Number.isFinite(e)?e:0;return t<=0?240:Math.round(t*aP)}function lP(e,t){let n=sP(t);return Number.isFinite(e)?e<120?120:e>n?n:Math.round(e):Math.min(cP(t),n)}function uP(){return typeof window>`u`?0:window.innerHeight}function dP(e,t){try{let n=e??localStorage,r=t??uP(),i=n.getItem(iP);if(i==null)return lP(cP(r),r);let a=Number.parseInt(i,10);return lP(Number.isFinite(a)?a:cP(r),r)}catch{return 240}}function fP(e,t,n){try{let r=t??localStorage,i=n??uP();r.setItem(iP,String(lP(e,i)))}catch{}}function pP(){try{return typeof localStorage>`u`?240:dP()}catch{return 240}}var mP=`terminal-dock-panel`;function hP(e){let t=(0,$.c)(35),{children:n,visible:r,onVisibleChange:i,dockPosition:a,onBottomContainer:o,onEditorRegion:s}=e,c=a===void 0?`bottom`:a,{resolvedTheme:l}=Yn(),u=gC(),[d,f]=(0,Q.useState)(!r),p;t[0]===l?p=t[1]:(p=_u(l),t[0]=l,t[1]=p);let m=p.background,[h]=(0,Q.useState)(gP),g=(0,Q.useRef)(h),[_,v]=(0,Q.useState)(!1),y=(0,Q.useRef)(!1),b=(0,Q.useRef)(null),x;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(x=function(e){b.current!=null&&clearTimeout(b.current),b.current=setTimeout(()=>{fP(e),b.current=null},100)},t[2]=x):x=t[2];let S=x,C=(0,Q.useRef)(null),w,T;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(w=()=>()=>{b.current!=null&&clearTimeout(b.current),C.current!=null&&(window.removeEventListener(`pointerup`,C.current),C.current=null)},T=[],t[3]=w,t[4]=T):(w=t[3],T=t[4]),(0,Q.useEffect)(w,T);let E,D;t[5]!==c||t[6]!==u||t[7]!==r?(E=()=>{let e=u.current;e!=null&&(r&&c===`bottom`?e.resize(`${g.current}px`):e.collapse())},D=[r,u,c],t[5]=c,t[6]=u,t[7]=r,t[8]=E,t[9]=D):(E=t[8],D=t[9]),(0,Q.useEffect)(E,D);let O=_||void 0,k;t[10]!==n||t[11]!==s?(k=(0,Z.jsx)(gE,{minSize:`5%`,className:`flex min-h-0 flex-col`,children:(0,Z.jsx)(`div`,{ref:s,tabIndex:-1,className:`flex h-full min-h-0 flex-col outline-none`,children:n})}),t[10]=n,t[11]=s,t[12]=k):k=t[12];let A;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(_E,{withHandle:!0,onPointerDown:()=>{v(!0),y.current=!0;let e=()=>{v(!1),y.current=!1,window.removeEventListener(`pointerup`,e),C.current=null};C.current=e,window.addEventListener(`pointerup`,e)}}),t[13]=A):A=t[13];let j;t[14]===m?j=t[15]:(j={backgroundColor:m},t[14]=m,t[15]=j);let M=r&&c===`bottom`?`${h}px`:0,N;t[16]!==i||t[17]!==r?(N=e=>{let t=e.asPercentage===0;f(t),y.current&&(t&&r?i(!1):!t&&!r&&i(!0),e.inPixels>0&&(g.current=e.inPixels,S(e.inPixels)))},t[16]=i,t[17]=r,t[18]=N):N=t[18];let P=!_&&`transition-[flex-grow] duration-150 ease-out motion-reduce:transition-none motion-reduce:duration-0`,F;t[19]===P?F=t[20]:(F=X(`flex flex-col`,P),t[19]=P,t[20]=F);let I;t[21]===o?I=t[22]:(I=(0,Z.jsx)(`div`,{ref:o,className:`flex min-h-0 flex-1 flex-col overflow-hidden`}),t[21]=o,t[22]=I);let L;t[23]!==d||t[24]!==u||t[25]!==j||t[26]!==M||t[27]!==N||t[28]!==F||t[29]!==I?(L=(0,Z.jsx)(gE,{id:mP,style:j,panelRef:u,defaultSize:M,minSize:`120px`,maxSize:`95%`,collapsible:!0,collapsedSize:0,onResize:N,inert:d,className:F,children:I}),t[23]=d,t[24]=u,t[25]=j,t[26]=M,t[27]=N,t[28]=F,t[29]=I,t[30]=L):L=t[30];let R;return t[31]!==L||t[32]!==O||t[33]!==k?(R=(0,Z.jsxs)(hE,{orientation:`vertical`,className:`min-h-0 flex-1`,"data-dragging":O,children:[k,A,L]}),t[31]=L,t[32]=O,t[33]=k,t[34]=R):R=t[34],R}function gP(){return pP()}var _P=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-B64TMVp3.js`),__vite__mapDeps([48,1,2,49,50,51,31,52,53,54,55,56,57,58,59,20,9,10,7,11,30,3,32,6,4,15,12,13,22,14,60,16,43,44,45,61,62,23,63,64,65]),import.meta.url)).ActivityModeContent})),vP=`300px`,yP=`600px`;function bP(e){let t=(0,$.c)(5),n;t[0]===e?n=t[1]:(n=(0,Z.jsx)(SP,{...e}),t[0]=e,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(xP,{}),t[2]=r):r=t[2];let i;return t[3]===n?i=t[4]:(i=(0,Z.jsx)(_l,{name:`editor-area`,children:(0,Z.jsxs)(Ha,{children:[n,r]})}),t[3]=n,t[4]=i),i}function xP(){let e=(0,$.c)(5),t=Ji(),n;e[0]===t?n=e[1]:(n=e=>{e||t.close()},e[0]=t,e[1]=n);let r;return e[2]!==t.open||e[3]!==n?(r=(0,Z.jsx)(uE,{open:t.open,onOpenChange:n}),e[2]=t.open,e[3]=n,e[4]=r):r=e[4],r}function SP(e){let t=(0,$.c)(210),{editorMode:n,onModeChange:r,activeTab:i,onActiveTabChange:a,terminalBridge:o,terminalVisible:s,onTerminalVisibleChange:c,terminalDock:l,onTerminalPlacement:u}=e,d=s===void 0?!1:s,f=l===void 0?`right`:l,{_:p}=rn(),{resolvedTheme:m}=Yn(),h;t[0]===m?h=t[1]:(h=_u(m),t[0]=m,t[1]=h);let g=h.background,{activeDocName:_,activeProvider:v,activeTarget:y,recycleDocument:b,docPanelMode:x,docPanelAgentId:S,docPanelExpandSignal:C}=ft(),{openDocumentTransition:w}=Et(),{requestAddProperty:T}=za(),E=zE(v,_),D=HE(_,n===`source`?`source`:`wysiwyg`),O=pD(v),k=O===`connected`||O===`synced`,A=VE(_)===`conflict`,[j,M]=(0,Q.useState)(!1),N,P;t[2]!==v||t[3]!==j?(N=()=>{v!=null&&!j&&M(!0)},P=[v,j],t[2]=v,t[3]=j,t[4]=N,t[5]=P):(N=t[4],P=t[5]),(0,Q.useEffect)(N,P);let F=(0,Q.useDeferredValue)(_),I=y?.kind===`missing`,L=!!_&&y?.kind!==`folder`,R;t[6]!==p||t[7]!==I?(R=I?p({id:`K-a33w`}):void 0,t[6]=p,t[7]=I,t[8]=R):R=t[8];let z=R,[B]=(0,Q.useState)(DP),V=B!==null,[H]=(0,Q.useState)(EP),U;t[9]===B?U=t[10]:(U=()=>ZE(B,window.innerWidth,`right`),t[9]=B,t[10]=U);let[W,G]=(0,Q.useState)(U),K=(0,Q.useRef)(W),ee,q;t[11]===W?(ee=t[12],q=t[13]):(ee=()=>{K.current=W},q=[W],t[11]=W,t[12]=ee,t[13]=q),(0,Q.useEffect)(ee,q);let J=gC(),ne=gC(),re;t[14]===W?re=t[15]:(re=()=>oD(`right`,W,iD())===`collapsed`,t[14]=W,t[15]=re);let[ie]=(0,Q.useState)(re),[ae,oe]=(0,Q.useState)(ie),se=(0,Q.useRef)(ae),[ce,le]=(0,Q.useState)(null),[ue,de]=(0,Q.useState)(null),[fe,pe]=(0,Q.useState)(null),me=f===`right`,he=me?`right`:`bottom`,ge=me&&d&&ce!=null,_e=ge?ce:ue,ve=(me?ge:d)&&_e!=null,ye,be;t[16]!==_e||t[17]!==u||t[18]!==he||t[19]!==fe||t[20]!==ve?(ye=()=>{u?.({container:_e,isShowing:ve,dockPosition:he,editorRegion:fe})},be=[u,_e,ve,he,fe],t[16]=_e,t[17]=u,t[18]=he,t[19]=fe,t[20]=ve,t[21]=ye,t[22]=be):(ye=t[21],be=t[22]),(0,Q.useEffect)(ye,be);let xe,Se;t[23]===ae?(xe=t[24],Se=t[25]):(xe=()=>{se.current=ae},Se=[ae],t[23]=ae,t[24]=xe,t[25]=Se),(0,Q.useEffect)(xe,Se);let[Ce,we]=(0,Q.useState)(!1),Te=(0,Q.useRef)(!1),[Ee]=(0,Q.useState)(TP),De=(0,Q.useRef)(Ee),Oe=(0,Q.useRef)(null),ke;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(ke=function(e){Oe.current!=null&&clearTimeout(Oe.current),Oe.current=setTimeout(()=>{KE(e),Oe.current=null},100)},t[26]=ke):ke=t[26];let Ae=ke,[je]=(0,Q.useState)(wP),Ne=(0,Q.useRef)(je),[Pe,Fe]=(0,Q.useState)(!1),Ie=(0,Q.useRef)(!1),Le=(0,Q.useRef)(null),Re;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(Re=function(e){Le.current!=null&&clearTimeout(Le.current),Le.current=setTimeout(()=>{dD(e),Le.current=null},100)},t[27]=Re):Re=t[27];let ze=Re,Be,Ve;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(Be=()=>()=>{Oe.current!=null&&clearTimeout(Oe.current),Le.current!=null&&clearTimeout(Le.current)},Ve=[],t[28]=Be,t[29]=Ve):(Be=t[28],Ve=t[29]),(0,Q.useEffect)(Be,Ve);let[He,Ue]=(0,Q.useState)(null),We;t[30]!==ae||t[31]!==J?(We=function(){if(J.current==null)return;let e=K.current;ae?(sD(`right`,e,`open`),J.current?.expand()):(sD(`right`,e,`collapsed`),J.current?.collapse())},t[30]=ae,t[31]=J,t[32]=We):We=t[32];let Ge=We,Ke,qe;t[33]!==B||t[34]!==J?(Ke=()=>{let e=window.matchMedia(`(min-width: ${YE}px)`),t=()=>{let e=ZE(B,window.innerWidth,`right`);G(e);let t=oD(`right`,e,iD())===`collapsed`;oe(t),t?J.current?.collapse():J.current?.expand()};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},qe=[B,J],t[33]=B,t[34]=J,t[35]=Ke,t[36]=qe):(Ke=t[35],qe=t[36]),(0,Q.useEffect)(Ke,qe);let Je,Ye;t[37]!==He||t[38]!==V||t[39]!==J||t[40]!==ne?(Je=()=>{if(He==null||V)return;let e=new ResizeObserver(()=>{!Te.current&&!se.current&&J.current?.resize(`${De.current}px`),Ie.current||ne.current?.resize(`${Ne.current}px`)});return e.observe(He),()=>e.disconnect()},Ye=[He,V,J,ne],t[37]=He,t[38]=V,t[39]=J,t[40]=ne,t[41]=Je,t[42]=Ye):(Je=t[41],Ye=t[42]),(0,Q.useEffect)(Je,Ye);let Xe,Ze;t[43]!==a||t[44]!==J?(Xe=()=>{let e=e=>{a(e),J.current?.expand()},t=ov();return t&&e(t),cv(t=>{ov(),e(t)})},Ze=[a,J],t[43]=a,t[44]=J,t[45]=Xe,t[46]=Ze):(Xe=t[45],Ze=t[46]),(0,Q.useEffect)(Xe,Ze);let Qe,$e;t[47]!==C||t[48]!==J?(Qe=()=>{C!==0&&J.current?.expand()},$e=[C,J],t[47]=C,t[48]=J,t[49]=Qe,t[50]=$e):(Qe=t[49],$e=t[50]),(0,Q.useEffect)(Qe,$e);let et,tt;t[51]!==J||t[52]!==f?(et=()=>{let e=0,t=dv(()=>{f===`right`&&(cancelAnimationFrame(e),e=requestAnimationFrame(()=>{J.current?.collapse()}))});return()=>{cancelAnimationFrame(e),t()}},tt=[J,f],t[51]=J,t[52]=f,t[53]=et,t[54]=tt):(et=t[53],tt=t[54]),(0,Q.useEffect)(et,tt);let nt,rt;t[55]===ae?(nt=t[56],rt=t[57]):(nt=()=>{if(!ae||!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()},rt=[ae],t[55]=ae,t[56]=nt,t[57]=rt),(0,Q.useLayoutEffect)(nt,rt);let it,at;t[58]===ae?(it=t[59],at=t[60]):(it=()=>{window.okDesktop!=null&&window.okDesktop.editor.notifyViewMenuStateChanged({docPanelVisible:!ae})},at=[ae],t[58]=ae,t[59]=it,t[60]=at),(0,Q.useEffect)(it,at);let ot,st;t[61]===Ge?(ot=t[62],st=t[63]):(ot=()=>{if(window.okDesktop!=null)return window.okDesktop.onMenuAction(e=>{e===`toggle-doc-panel`&&Ge()})},st=[Ge],t[61]=Ge,t[62]=ot,t[63]=st),(0,Q.useEffect)(ot,st);let ct,lt;t[64]===Ge?(ct=t[65],lt=t[66]):(ct=()=>{if(window.okDesktop!=null)return;let e=e=>{wl(e,`toggle-document-panel`)&&(e.preventDefault(),Ge())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},lt=[Ge],t[64]=Ge,t[65]=ct,t[66]=lt),(0,Q.useEffect)(ct,lt);let ut=(0,Q.useRef)(null),[dt,pt]=(0,Q.useState)(null),[mt,ht]=(0,Q.useState)(!1),gt=y?.kind===`large-file`?y.docName:_,_t,vt;t[67]===gt?(_t=t[68],vt=t[69]):(_t=()=>{if(gt&&gt!==ut.current){let e=ut.current;ut.current=gt,pt(e)}},vt=[gt],t[67]=gt,t[68]=_t,t[69]=vt),(0,Q.useEffect)(_t,vt);let yt;t[70]===w?yt=t[71]:(yt=function(e){let t=Kc(e);window.location.hash===t?w(e):window.location.hash=t},t[70]=w,t[71]=yt);let bt=yt,xt,St=null;if(y?.kind===`large-file`){let e;t[72]!==bt||t[73]!==dt?(e=dt?{previousDocName:dt,onNavigateBack:bt}:void 0,t[72]=bt,t[73]=dt,t[74]=e):e=t[74];let n;t[75]!==y.docName||t[76]!==y.limit||t[77]!==y.size||t[78]!==e?(n=(0,Z.jsx)(qT,{docName:y.docName,size:y.size,limit:y.limit,backNav:e}),t[75]=y.docName,t[76]=y.limit,t[77]=y.size,t[78]=e,t[79]=n):n=t[79],xt=n}else if(y?.kind===`folder`){let e;t[80]!==H||t[81]!==V||t[82]!==d?(e=UD({terminalVisible:d,isEmbedded:V,isDesktop:H}),t[80]=H,t[81]=V,t[82]=d,t[83]=e):e=t[83];let n=e,r;t[84]===y.folderPath?r=t[85]:(r=(0,Z.jsx)(UT,{folderPath:y.folderPath}),t[84]=y.folderPath,t[85]=r);let i;t[86]!==y.folderPath||t[87]!==n?(i=n?(0,Z.jsx)(AD,{folderPath:y.folderPath}):null,t[86]=y.folderPath,t[87]=n,t[88]=i):i=t[88];let a;if(t[89]!==r||t[90]!==i?(a=(0,Z.jsxs)(`div`,{className:`relative flex h-full min-h-0 flex-col`,children:[r,i]}),t[89]=r,t[90]=i,t[91]=a):a=t[91],xt=a,x===`agent`&&S!==null){let e;t[92]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(_E,{withHandle:!0}),t[92]=e):e=t[92];let n;t[93]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(Z.Fragment,{children:[e,(0,Z.jsx)(gE,{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)(Y,{id:`ONPvOb`})}),children:(0,Z.jsx)(_P,{showBackButton:!1})})})]}),t[93]=n):n=t[93],St=n}}else if(y?.kind===`asset`){let e;t[94]!==y.assetPath||t[95]!==y.mediaKind?(e=(0,Z.jsx)(jC,{assetPath:y.assetPath,mediaKind:y.mediaKind},y.assetPath),t[94]=y.assetPath,t[95]=y.mediaKind,t[96]=e):e=t[96],xt=e}else if(y?.kind===`skill-file`){let e=`${y.scope}/${y.name}/${y.path}`,n;t[97]!==y.name||t[98]!==y.path||t[99]!==y.scope||t[100]!==e?(n=(0,Z.jsx)(tE,{scope:y.scope,name:y.name,path:y.path},e),t[97]=y.name,t[98]=y.path,t[99]=y.scope,t[100]=e,t[101]=n):n=t[101],xt=n}else if(!v||!_)if((typeof window<`u`?hl(window.location.hash):null)!==null)if(o!=null&&j){let e;t[102]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(MC,{}),t[102]=e):e=t[102],xt=e;let n;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(_E,{withHandle:!0,disabled:!0}),t[103]=n):n=t[103];let r=ie?0:`${Ee}px`,i;t[104]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`}),t[104]=i):i=t[104];let a;t[105]===r?a=t[106]:(a=(0,Z.jsxs)(Z.Fragment,{children:[n,(0,Z.jsx)(gE,{id:`doc-panel`,defaultSize:r,minSize:vP,maxSize:yP,collapsible:!0,collapsedSize:0,inert:!0,className:`flex flex-col bg-muted/20`,children:i})]}),t[105]=r,t[106]=a),St=a}else{let e;return t[107]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(MC,{}),t[107]=e):e=t[107],e}else{let e=d&&he===`bottom`,n;t[108]===e?n=t[109]:(n=(0,Z.jsx)(uT,{terminalVisible:e}),t[108]=e,t[109]=n),xt=n}else{let e=n===`source`,o=!k,s=ae,c;t[110]!==_||t[111]!==T?(c=function(){_&&T(_)},t[110]=_,t[111]=T,t[112]=c):c=t[112];let l=c,u;t[113]!==_||t[114]!==H||t[115]!==V||t[116]!==d?(u=HD({terminalVisible:d,isEmbedded:V,isDesktop:H,activeDocName:_}),t[113]=_,t[114]=H,t[115]=V,t[116]=d,t[117]=u):u=t[117];let f=u,p=F??_,m=dt??void 0,h;t[118]!==z||t[119]!==e||t[120]!==bt||t[121]!==b||t[122]!==p||t[123]!==m?(h=(0,Z.jsx)(LM,{activeDocName:p,isSourceMode:e,editorPlaceholder:z,previousDocName:m,onNavigateBack:bt,onRecycle:b}),t[118]=z,t[119]=e,t[120]=bt,t[121]=b,t[122]=p,t[123]=m,t[124]=h):h=t[124];let g;t[125]!==_||t[126]!==e?(g=(0,Z.jsx)(FE,{activeDocName:_,isSourceMode:e}),t[125]=_,t[126]=e,t[127]=g):g=t[127];let v;t[128]!==_||t[129]!==F?(v=rP({activeDocName:_,deferredActiveDocName:F,mountResolved:_!==null&&te(_),syncResolved:_!==null&&Me(_)})?(0,Z.jsxs)(`div`,{className:`absolute inset-0 z-10 bg-background`,children:[(0,Z.jsx)(MC,{}),_===null?null:(0,Z.jsx)(JT,{docName:_})]}):null,t[128]=_,t[129]=F,t[130]=v):v=t[130];let y;t[131]!==h||t[132]!==g||t[133]!==v?(y=(0,Z.jsxs)(`div`,{className:`relative h-full`,children:[h,g,v]}),t[131]=h,t[132]=g,t[133]=v,t[134]=y):y=t[134];let S;t[135]!==_||t[136]!==A||t[137]!==s||t[138]!==e||t[139]!==r||t[140]!==l||t[141]!==o||t[142]!==Ge?(S=!A&&(0,Z.jsx)(nP,{activeDocName:_,isSourceMode:e,sourceDisabled:o,onModeChange:r,showAddPropertyButton:!e,onAddProperty:l,isPanelCollapsed:s,onTogglePanel:Ge}),t[135]=_,t[136]=A,t[137]=s,t[138]=e,t[139]=r,t[140]=l,t[141]=o,t[142]=Ge,t[143]=S):S=t[143];let C;t[144]!==_||t[145]!==mt||t[146]!==e||t[147]!==f?(C=f?(0,Z.jsx)(AD,{docName:_,surface:e?`source`:`wysiwyg`,dismissed:mt,onDismiss:()=>ht(!0),onReopen:()=>ht(!1)}):null,t[144]=_,t[145]=mt,t[146]=e,t[147]=f,t[148]=C):C=t[148];let w;t[149]!==y||t[150]!==S||t[151]!==C?(w=(0,Z.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[y,S,C]}),t[149]=y,t[150]=S,t[151]=C,t[152]=w):w=t[152];let O;t[153]!==mt||t[154]!==f?(O=f&&mt?{onReopen:()=>ht(!1)}:null,t[153]=mt,t[154]=f,t[155]=O):O=t[155];let j;t[156]!==D||t[157]!==L||t[158]!==E||t[159]!==O?(j=(0,Z.jsx)(RN,{stats:E,selectionStats:D,showStats:L,composerBadge:O}),t[156]=D,t[157]=L,t[158]=E,t[159]=O,t[160]=j):j=t[160];let M;t[161]!==w||t[162]!==j?(M=(0,Z.jsxs)(`div`,{className:`relative flex h-full flex-col`,children:[w,j]}),t[161]=w,t[162]=j,t[163]=M):M=t[163],xt=M;let N=V&&ae,P;t[164]===Symbol.for(`react.memo_cache_sentinel`)?(P=()=>{we(!0),Te.current=!0;let e=()=>{we(!1),Te.current=!1,window.removeEventListener(`pointerup`,e)};window.addEventListener(`pointerup`,e)},t[164]=P):P=t[164];let I;t[165]===N?I=t[166]:(I=(0,Z.jsx)(_E,{withHandle:!0,disabled:N,onPointerDown:P}),t[165]=N,t[166]=I);let R=ie?0:`${Ee}px`,B;t[167]===Symbol.for(`react.memo_cache_sentinel`)?(B=e=>{oe(e.asPercentage===0),e.inPixels>0&&Te.current&&(De.current=e.inPixels,Ae(e.inPixels))},t[167]=B):B=t[167];let U=!Ce&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,W;t[168]===U?W=t[169]:(W=X(`flex flex-col bg-muted/20`,U),t[168]=U,t[169]=W);let G;t[170]!==_||t[171]!==i||t[172]!==x||t[173]!==e||t[174]!==a?(G=(0,Z.jsx)(Sx,{docName:_,isSourceMode:e,activeTab:i,onActiveTabChange:a,mode:x}),t[170]=_,t[171]=i,t[172]=x,t[173]=e,t[174]=a,t[175]=G):G=t[175];let K;t[176]!==ae||t[177]!==J||t[178]!==R||t[179]!==W||t[180]!==G?(K=(0,Z.jsx)(gE,{id:`doc-panel`,panelRef:J,defaultSize:R,minSize:vP,maxSize:yP,collapsible:!0,collapsedSize:0,onResize:B,inert:ae,className:W,children:G}),t[176]=ae,t[177]=J,t[178]=R,t[179]=W,t[180]=G,t[181]=K):K=t[181];let ee;t[182]!==I||t[183]!==K?(ee=(0,Z.jsxs)(Z.Fragment,{children:[I,K]}),t[182]=I,t[183]=K,t[184]=ee):ee=t[184],St=ee}let Ct;t[185]!==c||t[186]!==o||t[187]!==he||t[188]!==d||t[189]!==xt?(Ct=o==null?xt:(0,Z.jsx)(hP,{visible:d,onVisibleChange:c??CP,dockPosition:he,onBottomContainer:de,onEditorRegion:pe,children:xt}),t[185]=c,t[186]=o,t[187]=he,t[188]=d,t[189]=xt,t[190]=Ct):Ct=t[190];let wt=Ct,Tt=o!=null&&me&&d,Dt;t[191]!==je||t[192]!==Pe||t[193]!==ne||t[194]!==Tt||t[195]!==g?(Dt=Tt?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(_E,{withHandle:!0,onPointerDown:()=>{Fe(!0),Ie.current=!0;let e=()=>{Fe(!1),Ie.current=!1,window.removeEventListener(`pointerup`,e)};window.addEventListener(`pointerup`,e)}}),(0,Z.jsx)(gE,{id:`terminal-column`,panelRef:ne,style:{backgroundColor:g},defaultSize:`${je}px`,minSize:`320px`,maxSize:`900px`,onResize:e=>{e.inPixels>0&&Ie.current&&(Ne.current=e.inPixels,ze(e.inPixels))},className:X(`flex flex-col`,!Pe&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`),children:(0,Z.jsx)(`div`,{ref:le,className:`flex min-h-0 flex-1 flex-col overflow-hidden`})})]}):null,t[191]=je,t[192]=Pe,t[193]=ne,t[194]=Tt,t[195]=g,t[196]=Dt):Dt=t[196];let Ot=Dt,kt=St!=null&&!ie||Tt,At=Ce||Pe||void 0,jt;t[197]===kt?jt=t[198]:(jt=kt?{}:{defaultSize:`100%`},t[197]=kt,t[198]=jt);let Mt=!(Ce||Pe)&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,Nt;t[199]===Mt?Nt=t[200]:(Nt=X(Mt),t[199]=Mt,t[200]=Nt);let Pt;t[201]!==wt||t[202]!==jt||t[203]!==Nt?(Pt=(0,Z.jsx)(gE,{minSize:`30%`,...jt,className:Nt,children:wt}),t[201]=wt,t[202]=jt,t[203]=Nt,t[204]=Pt):Pt=t[204];let Ft;return t[205]!==St||t[206]!==At||t[207]!==Pt||t[208]!==Ot?(Ft=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1`,ref:Ue,children:(0,Z.jsxs)(hE,{orientation:`horizontal`,"data-dragging":At,children:[Pt,St,Ot]})}),t[205]=St,t[206]=At,t[207]=Pt,t[208]=Ot,t[209]=Ft):Ft=t[209],Ft}function CP(){}function wP(){return fD()}function TP(){return qE()}function EP(){return typeof window<`u`&&window.okDesktop!=null}function DP(){return Fr()}function OP(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 kP(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 AP=1e3,jP=!1;function MP(e){return!!(e.localPrincipalId&&e.entryPrincipalId===e.localPrincipalId||!e.localPrincipalId&&e.entryClientId===e.localClientId)}function NP(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:Ni(i)?a=i:(a=void 0,jP||(jP=!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`&&(MP({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=kP(i),{current:c,crossDoc:l}=a?ki(a,n,Date.now()):{current:[],crossDoc:[]},u=PP,d=c.map(u),f=l.map(u),p=[...s,...d],m=f;o(e=>OP(e.current,p)&&OP(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,AP);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 PP(e){let{agentId:t,entry:n}=e;return{kind:`agent`,agentId:t,presence:n}}var FP=`sync-status`;function IP(e,t){let n=(0,$.c)(6),{_:r}=rn(),i=jg(),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){bs.dismiss(FP);return}o.current=!0,bs.warning(r({id:`HGNCsl`}),{id:FP,duration:1/0})}else o.current&&e===`synced`&&(o.current=!1,bs.success(r({id:`GhjUB_`}),{id:FP,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 LP=4,RP=3,zP={Bird:id,Cat:dd,Dog:yd,Fish:Td,Mouse:af,Rabbit:rf,Shrimp:df,Snail:ff,Squirrel:gf,Turtle:Ef};Object.freeze(Object.keys(zP));function BP(e){if(typeof e.principalId==`string`&&e.principalId.length>0)return{kind:`initials`};let t=e.name.split(` `)[1];return t&&Object.hasOwn(zP,t)?{kind:`animal`,animal:t}:{kind:`initials`}}var VP={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`,bot:`Agent`};function HP(e){let t=(0,$.c)(28),{user:n,mode:r,tabCount:i}=e,{_:a}=rn(),o=BP(n),s=o.kind===`animal`?zP[o.animal]:void 0,c;t[0]===n.name?c=t[1]:(c=Dr(n.name),t[0]=n.name,t[1]=c);let l=c,u;t[2]===n.color?u=t[3]:(u=si(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)(zs,{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)(Bs,{children:m}),t[23]=m,t[24]=b);let x;return t[25]!==y||t[26]!==b?(x=(0,Z.jsxs)(Hs,{children:[y,b]}),t[25]=y,t[26]=b,t[27]=x):x=t[27],x}function UP(e){let t=VP[e.icon];return e.displayName||t||As._({id:`iEQQyu`})}function WP(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 GP(e){let t=(0,$.c)(33),{participant:n,crossDoc:r,scoped:i,onClickAgent:a}=e,{_:o}=rn(),{activeDocName:s}=ft(),{presence:c,agentId:l}=n,u=UP(c),d=WP(c.mode),f=!r&&d,p=c.currentDoc&&c.currentDoc!==`(connected)`?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)(ji,{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)(ji,{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)(zs,{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)(Y,{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)(Bs,{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)(Hs,{children:[O,j]}),t[30]=O,t[31]=j,t[32]=M):M=t[32],M}function KP(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?As._({id:`9euN0m`,values:{count:n}}):As._({id:`uhJEA2`,values:{count:n}}),t[0]=n,t[1]=i,t[2]=s):s=t[2];let c=s,l=i?`true`:void 0,u;t[3]!==n||t[4]!==c||t[5]!==l?(u=(0,Z.jsx)(j,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`presence-overflow`,"data-presence-crossdoc":l,className:`inline-flex size-7 shrink-0 cursor-pointer items-center justify-center rounded-full bg-muted font-medium text-muted-foreground text-xs ring-2 ring-background hover:bg-muted/80`,"aria-label":c,children:[`+`,n]})}),t[3]=n,t[4]=c,t[5]=l,t[6]=u):u=t[6];let d;if(t[7]!==i||t[8]!==o||t[9]!==r||t[10]!==a){let e;t[12]!==i||t[13]!==o||t[14]!==a?(e=e=>e.kind===`human`?(0,Z.jsx)(HP,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(GP,{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)(wt,{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)(w,{children:[u,f]}),t[18]=u,t[19]=f,t[20]=p):p=t[20],p}function qP(e,t,n,r){return e.kind===`human`?(0,Z.jsx)(HP,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(GP,{participant:e,crossDoc:n,scoped:r===e.agentId,onClickAgent:t},e.agentId)}function JP(){let e=(0,$.c)(20),{activeProvider:t,activeDocName:n,systemProvider:r,openActivityPanel:i,docPanelMode:a,docPanelAgentId:o}=ft(),{current:s,crossDoc:c}=NP(t,r,n);if(IP(pD(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,LP),n;e[6]===s?n=e[7]:(n=s.slice(LP),e[6]=s,e[7]=n);let r=n,u=c.slice(0,RP),d;e[8]===c?d=e[9]:(d=c.slice(RP),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=>qP(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)(KP,{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=>qP(e,p,!0,m)),f.length>0?(0,Z.jsx)(KP,{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 YP(e,t){return t.trim()}function XP(e){return![``,`.`,`..`].includes(e)&&!e.includes(`/`)&&!e.includes(`\\`)&&!e.includes(`\0`)}function ZP(e,t){let n=YP(e.kind,t),r=e.path.split(`/`);return r[r.length-1]=n,r.join(`/`)}function QP(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(ll(e)){let t=s.get(Pu(e.docName,e.docExt));if(t){let n=il(t);return{kind:`asset`,path:t,assetExt:n,mediaKind:cr(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(ol(e))return{...e,path:aF(e.path,n)};if(nl(e)){let t=s.get(e.path);return t&&yl(t)?{kind:`document`,docName:bu(t),docExt:xl(t),size:e.size,modified:e.modified}:{...e,path:t??aF(e.path,n)}}return e})}function $P(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=>ll(e)?!i.has(e.docName)&&!lF(e.docName,n):ol(e)?!lF(e.path,n):nl(e)?!a.has(e.path)&&!lF(e.path,n):!0)}function eF(e,t){if(e.kind!==`asset`||t.some(t=>nl(t)&&t.path===e.path))return e;let n=Lu(e.path,t);return n?{...e,path:n,name:n.split(`/`).pop()??n}:e}function tF(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=>ll(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=>ol(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(ll(i)){let e=cF(i.docName,t.path,n.path);e&&c.has(e)&&o({...i,docName:e,modified:r});continue}if(ol(i)){let e=sF(i.path,t.path,n.path);e&&o({...i,path:e,modified:r})}}return i?a:e}function nF(e,t){return e?t.find(t=>t.fromDocName===e)?.toDocName??e:null}function rF(e,t,n){return e.flatMap(e=>t===e.toDocName||!n(e.toDocName)?[e.fromDocName]:[e.fromDocName,e.toDocName])}function iF(e,t){let n=e.kind===`file`?Pu(e.path,e.docExt):e.path;return ho(t.contentDir,n,t.pathSeparator)}function aF(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 ll(e)&&ll(t)?e.docName===t.docName:ol(e)&&ol(t)||nl(e)&&nl(t)?e.path===t.path:!1}function sF(e,t,n){return e===t?n:cF(e,t,n)}function cF(e,t,n){return e.startsWith(`${t}/`)?`${n}${e.slice(t.length)}`:null}function lF(e,t){return!!t&&(e===t||e.startsWith(`${t}/`))}function uF(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)(Dp,{"data-slot":`context-menu`,...n}),t[2]=n,t[3]=r),r}function dF(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=X(`select-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Op,{"data-slot":`context-menu-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}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)(jp,{"data-slot":`context-menu-group`,...n}),t[2]=n,t[3]=r),r}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)(Lp,{"data-slot":`context-menu-sub`,...n}),t[2]=n,t[3]=r),r}function mF(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=X(`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)(kp,{children:(0,Z.jsx)(Ap,{"data-slot":`context-menu-content`,className:i,...r})}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function hF(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=X(`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)(Np,{"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 gF(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=X(`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)(io,{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)(Rp,{"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 _F(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=X(`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)(zp,{"data-slot":`context-menu-sub-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function vF(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=X(`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)(Fp,{children:(0,Z.jsx)(Ya,{})})}),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)(Pp,{"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 yF(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=X(`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)(Mp,{"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 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=X(`-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)(Ip,{"data-slot":`context-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var xF=`mr-1.5 flex size-5 shrink-0 cursor-pointer items-center justify-center rounded-sm text-muted-foreground outline-none transition hover:bg-foreground/10 hover:text-foreground hover:opacity-100 focus-visible:ring-2 focus-visible:ring-ring/50`,SF=`border-border bg-background text-foreground hover:bg-background focus-visible:bg-background`,CF={start:[os.Space],cancel:[os.Esc],end:[os.Space,os.Enter]};function wF(e){return X(xF,e?`opacity-100`:`pointer-events-none opacity-0 group-hover:pointer-events-auto group-hover:opacity-100`)}function TF(e){return e?void 0:-1}function EF({className:e,isDragging:t}){return X(e,t&&SF)}function DF(e){return e.code===os.Enter&&e.target===e.currentTarget}function OF({event:e,hasKeyboardActivation:t,isDragging:n}){return e.defaultPrevented?`ignore`:!n&&t&&DF(e)?`activate-tab`:`delegate-sortable`}function kF({activeWidth:e,isDragging:t,outerStyle:n,transform:r,transition:i}){let a=t&&e?e:void 0;return{...n,transform:ds.Transform.toString(r?{...r,scaleX:1,scaleY:1}:null),transition:i,flexBasis:a??n?.flexBasis,maxWidth:a??n?.maxWidth,minWidth:a??n?.minWidth,opacity:n?.opacity,width:a??n?.width,zIndex:t?20:n?.zIndex}}function AF(e){let t=e?.querySelectorAll(`[data-editor-tab-sortable]`)??[],n=1/0,r=-1/0;for(let e of t){let t=e.getBoundingClientRect();n=Math.min(n,t.left),r=Math.max(r,t.right)}return Number.isFinite(n)&&Number.isFinite(r)?{left:n,right:r}:null}function jF(e){return({activeNodeRect:t,transform:n})=>{let r={...n,y:0};if(!e||!t)return r;let i=e.left-t.left,a=e.right-t.right;return r.x=Math.min(Math.max(r.x,i),a),r}}var MF=e=>{let{droppableContainers:t,droppableRects:n,pointerCoordinates:r}=e;if(r){let e=1/0,i=-1/0,a=null,o=null;for(let r of t){let t=n.get(r.id);t&&(t.left<e&&(e=t.left,a=r),t.right>i&&(i=t.right,o=r))}if(!Number.isFinite(e)||!Number.isFinite(i))return[];let s=r.x<e?a:r.x>i?o:null;if(s)return[{id:s.id,data:{droppableContainer:s,value:0}}]}return es(e)},NF=[`.md`,`.mdx`],PF=`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`,FF=`z-10 rounded-t-lg rounded-b-none border-border border-b-0 bg-background text-foreground`,IF=X(FF,`bg-transparent hover:bg-muted focus-visible:bg-muted border-transparent hover:border-border focus-visible:border-border`),LF=`flex h-full min-w-0 flex-1 cursor-pointer items-center overflow-hidden px-3 text-left text-[13px]`;function RF(e){return e.replace(/[^A-Za-z0-9_-]/g,`-`)}function zF(e){let t=Kc(e);window.location.hash!==t&&(window.location.hash=t)}function BF(e){Math.abs(e.deltaX)>=Math.abs(e.deltaY)||e.currentTarget.scrollWidth<=e.currentTarget.clientWidth||(e.preventDefault(),e.currentTarget.scrollLeft+=e.deltaY)}function VF(e,t){let n=[t,...NF].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 HF(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:_}=ls(u),v=p.current?.width,y;t[12]!==_||t[13]!==s||t[14]!==v||t[15]!==h||t[16]!==g?(y=kF({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=OF({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=EF({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 UF(e){let t=(0,$.c)(52),{children:n,closeTab:r,closeTabs:i,canPin:a,disabled:o,openTabs:s,pinTab:c,pinnedTabIds:l,tabId:u,unpinTab:d}=e,f=a===void 0?!0:a;if(o!==void 0&&o)return n;let p;t[0]!==f||t[1]!==l||t[2]!==u?(p=f&&l.includes(u),t[0]=f,t[1]=l,t[2]=u,t[3]=p):p=t[3];let m=p,h;if(t[4]!==s||t[5]!==l||t[6]!==u){let e;t[8]===u?e=t[9]:(e=e=>e!==u,t[8]=u,t[9]=e),h=De(s.filter(e),l),t[4]=s,t[5]=l,t[6]=u,t[7]=h}else h=t[7];let g=h,_;t[10]!==s||t[11]!==l?(_=De(s,l),t[10]=s,t[11]=l,t[12]=_):_=t[12];let v=_,y;t[13]===n?y=t[14]:(y=(0,Z.jsx)(dF,{asChild:!0,children:n}),t[13]=n,t[14]=y);let b;t[15]!==r||t[16]!==u?(b=()=>r(u),t[15]=r,t[16]=u,t[17]=b):b=t[17];let x;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(Y,{id:`yz7wBu`}),t[18]=x):x=t[18];let S;t[19]!==m||t[20]!==b?(S=(0,Z.jsx)(hF,{disabled:m,onSelect:b,children:x}),t[19]=m,t[20]=b,t[21]=S):S=t[21];let C=g.length===0,w;t[22]!==i||t[23]!==g?(w=()=>{i(g)},t[22]=i,t[23]=g,t[24]=w):w=t[24];let T;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(Y,{id:`omXJcU`}),t[25]=T):T=t[25];let E;t[26]!==C||t[27]!==w?(E=(0,Z.jsx)(hF,{disabled:C,onSelect:w,children:T}),t[26]=C,t[27]=w,t[28]=E):E=t[28];let D=v.length===0,O;t[29]!==v||t[30]!==i?(O=()=>{i(v)},t[29]=v,t[30]=i,t[31]=O):O=t[31];let k;t[32]===l.length?k=t[33]:(k=l.length?(0,Z.jsx)(Y,{id:`U2Kx6T`}):(0,Z.jsx)(Y,{id:`WyXG7w`}),t[32]=l.length,t[33]=k);let A;t[34]!==D||t[35]!==O||t[36]!==k?(A=(0,Z.jsx)(hF,{disabled:D,"data-testid":`editor-tab-context-close-all`,onSelect:O,children:k}),t[34]=D,t[35]=O,t[36]=k,t[37]=A):A=t[37];let j;t[38]!==f||t[39]!==m||t[40]!==c||t[41]!==u||t[42]!==d?(j=f&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(bF,{}),(0,Z.jsx)(hF,{"data-testid":`editor-tab-context-pin-toggle`,onSelect:()=>m?d(u):c(u),children:m?(0,Z.jsx)(Y,{id:`SYfHmN`}):(0,Z.jsx)(Y,{id:`3pU8e-`})})]}),t[38]=f,t[39]=m,t[40]=c,t[41]=u,t[42]=d,t[43]=j):j=t[43];let M;t[44]!==E||t[45]!==A||t[46]!==j||t[47]!==S?(M=(0,Z.jsxs)(mF,{className:`min-w-40`,children:[S,E,A,j]}),t[44]=E,t[45]=A,t[46]=j,t[47]=S,t[48]=M):M=t[48];let N;return t[49]!==M||t[50]!==y?(N=(0,Z.jsxs)(uF,{children:[y,M]}),t[49]=M,t[50]=y,t[51]=N):N=t[51],N}function WF(e){let t=(0,$.c)(26),{accessibleLabel:n,closeTab:r,isActive:i,isPinned:a,tabId:o,unpinTab:s}=e,{_:c}=rn();if(a){let e;t[0]!==c||t[1]!==n?(e=c({id:`t18QYR`,values:{accessibleLabel:n}}),t[0]=c,t[1]=n,t[2]=e):e=t[2];let r;t[3]!==o||t[4]!==s?(r=e=>{e.stopPropagation(),s(o)},t[3]=o,t[4]=s,t[5]=r):r=t[5];let i;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(nf,{"aria-hidden":`true`}),t[6]=i):i=t[6];let a;return t[7]!==e||t[8]!==r?(a=(0,Z.jsx)(Ci,{variant:`ghost`,size:`icon-xs`,type:`button`,"aria-label":e,"data-testid":`editor-tab-unpin-button`,className:`mr-1.5 text-primary! hover:bg-primary/10!`,onClick:r,children:i}),t[7]=e,t[8]=r,t[9]=a):a=t[9],a}let l;t[10]!==c||t[11]!==n?(l=c({id:`JLzQi_`,values:{accessibleLabel:n}}),t[10]=c,t[11]=n,t[12]=l):l=t[12];let u;t[13]===i?u=t[14]:(u=wF(i),t[13]=i,t[14]=u);let d;t[15]===i?d=t[16]:(d=TF(i),t[15]=i,t[16]=d);let f;t[17]!==r||t[18]!==o?(f=e=>{e.stopPropagation(),r(o)},t[17]=r,t[18]=o,t[19]=f):f=t[19];let p;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(xs,{"aria-hidden":`true`}),t[20]=p):p=t[20];let m;return t[21]!==l||t[22]!==u||t[23]!==d||t[24]!==f?(m=(0,Z.jsx)(Ci,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":l,"data-testid":`editor-tab-close-button`,className:u,tabIndex:d,onClick:f,children:p}),t[21]=l,t[22]=u,t[23]=d,t[24]=f,t[25]=m):m=t[25],m}function GF(e){let t=(0,$.c)(1),{docName:n}=e;if(VE(n)!==`conflict`)return null;let r;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(oo,{"aria-label":`Conflict`,"data-testid":`editor-tab-conflict-badge`,className:`mr-1 size-3.5 shrink-0 text-amber-500`}),t[0]=r):r=t[0],r}function KF(){let e=(0,$.c)(80),{activeDocName:t,activeTabId:n,activeNewTabId:r,activeTarget:i,activateTab:a,activateNewTab:o,closeAndClearForRename:c,closeNewTab:l,closeTab:u,closeTabs:d,getPoolActiveDocName:f,poolHas:p,isNewTabActive:m,newTabIds:h,openNewTab:g,openTabs:_,pinTab:v,pinnedTabIds:y,remapTabsForRename:b,reorderTabs:x,unpinTab:S,visibleTabIds:C}=ft(),{_:w}=rn(),{pageMeta:T}=so(),E=(0,Q.useRef)(null),[D,O]=(0,Q.useState)(null),[k,A]=(0,Q.useState)(null),[j,M]=(0,Q.useState)(``),[N,P]=(0,Q.useState)(null),[F,I]=(0,Q.useState)(!1),L=(0,Q.useRef)(null),R=(0,Q.useRef)(!1),z=(0,Q.useRef)(!1),B=(0,Q.useRef)(null),V=(0,Q.useRef)(t),H;e[0]!==n||e[1]!==t||e[2]!==i?(H=n??(i?Jt(i):t?$t(t):null),e[0]=n,e[1]=t,e[2]=i,e[3]=H):H=e[3];let U=H,W;e[4]!==r||e[5]!==U||e[6]!==m||e[7]!==h||e[8]!==_?(W=m?`${r??`__new-tab__`}\u0000${_.join(`\0`)}\u0000${h.join(`\0`)}`:U?`${U}\u0000${_.join(`\0`)}`:``,e[4]=r,e[5]=U,e[6]=m,e[7]=h,e[8]=_,e[9]=W):W=e[9];let G=W,K,ee;e[10]===t?(K=e[11],ee=e[12]):(K=()=>{V.current=t},ee=[t],e[10]=t,e[11]=K,e[12]=ee),(0,Q.useEffect)(K,ee);let te,q;e[13]===G?(te=e[14],q=e[15]):(te=()=>{G&&(E.current?.querySelector(`[data-active-tab="true"]`))?.scrollIntoView({block:`nearest`,inline:`nearest`})},q=[G],e[13]=G,e[14]=te,e[15]=q),(0,Q.useEffect)(te,q);let J,re;e[16]===k?(J=e[17],re=e[18]):(J=()=>{k&&(L.current?.focus(),L.current?.select())},re=[k],e[16]=k,e[17]=J,e[18]=re),(0,Q.useEffect)(J,re);let ae,oe;e[19]!==_||e[20]!==k?(ae=()=>{!k||_.includes(k.tabId)||(z.current=!0,B.current=null,A(null),M(``),P(null),I(!1))},oe=[_,k],e[19]=_,e[20]=k,e[21]=ae,e[22]=oe):(ae=e[21],oe=e[22]),(0,Q.useEffect)(ae,oe);let se=function(e,t){let n=t.split(`/`);z.current=!1,B.current=null,A({docName:t,tabId:e}),M(n[n.length-1]),P(null)},ce=function(){z.current=!0,B.current=null,A(null),M(``),P(null),I(!1)},le=async function(){if(z.current){z.current=!1;return}if(R.current)return;let e=k?.docName;if(!e){ce();return}let t=YP(`file`,VF(j,T.get(e)?.docExt??`.md`)),n=e.split(`/`),r=n[n.length-1];if(t===r){ce();return}if(t===B.current){L.current?.focus();return}if(!XP(t)){P(w({id:`P8yDjG`})),L.current?.focus();return}let i=ZP({kind:`file`,path:e,name:r},t);R.current=!0,I(!0),P(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(z.current){I(!1),R.current=!1;return}let r=await s(n,`Server error (HTTP ${n.status})`);if(!r.ok){P(r.title),I(!1),R.current=!1,B.current=t,L.current?.focus();return}let a=Ie(Nr,r.body,`rename-path:tab`,{renamed:[],renamedAssets:[]}).renamed,o=V.current,l=nF(o,a);rt(a);let u=!0;try{let e=rF(a,f(),p);await Promise.all(e.map(e=>c(e))),b(a),Es([`files`,`backlinks`,`graph`])}catch(n){let r=n;u=!1,console.warn(`[EditorTabs] post-rename reconciliation failed`,{err:r,docName:e,newDocName:i,normalized:t}),bs.error(w({id:`MUBR8r`}))}z.current=!0,A(null),M(``),P(null),I(!1),R.current=!1,B.current=null,u&&l&&l!==o&&zF(l)}catch(n){console.warn(`[EditorTabs] rename failed`,{err:n,docName:e,newDocName:i,normalized:t}),P(w({id:`HIb0vl`})),I(!1),R.current=!1,B.current=t,L.current?.focus()}},ue=typeof window<`u`&&window.okDesktop!=null,de;e[23]===h?de=e[24]:(de=new Set(h),e[23]=h,e[24]=de);let fe=de,pe;e[25]===D?pe=e[26]:(pe=jF(D),e[25]=D,e[26]=pe);let me;e[27]===pe?me=e[28]:(me=[pe],e[27]=pe,e[28]=me);let he=me,ge;e[29]!==l||e[30]!==d||e[31]!==fe?(ge=function(e){let t=[],n=[];for(let r of e)fe.has(r)?n.push(r):t.push(r);t.length>0&&d(t);for(let e of n)l(e)},e[29]=l,e[30]=d,e[31]=fe,e[32]=ge):ge=e[32];let _e=ge,ve;e[33]===Symbol.for(`react.memo_cache_sentinel`)?(ve={activationConstraint:{distance:8}},e[33]=ve):ve=e[33];let ye;e[34]===Symbol.for(`react.memo_cache_sentinel`)?(ye={coordinateGetter:rs,keyboardCodes:CF},e[34]=ye):ye=e[34];let be=us(Zo(ts,ve),Zo(is,ye)),xe;e[35]===Symbol.for(`react.memo_cache_sentinel`)?(xe=function(){O(AF(E.current))},e[35]=xe):xe=e[35];let Se=xe,Ce;e[36]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=function(){O(null)},e[36]=Ce):Ce=e[36];let we=Ce,Te;e[37]!==we||e[38]!==x||e[39]!==C?(Te=function(e){we();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(ss([...C],r,i),t)},e[37]=we,e[38]=x,e[39]=C,e[40]=Te):Te=e[40];let Ee=Te,De=ue?``:void 0,Oe;e[41]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=X(`pl-2 flex h-12 min-w-0 touch-manipulation flex-1 items-end overflow-x-auto overflow-y-hidden overscroll-x-contain scroll-fade-mask-x [scrollbar-width:none]`,ue&&`[-webkit-app-region:drag]`),e[41]=Oe):Oe=e[41];let ke=BF,Ae;e[42]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=X(`flex items-end gap-1`,ue&&`[-webkit-app-region:no-drag]`),e[42]=Ae):Ae=e[42];let je=$o,Me=MF,Ne;e[43]===Symbol.for(`react.memo_cache_sentinel`)?(Ne={container:typeof document<`u`?document.body:void 0},e[43]=Ne):Ne=e[43];let Pe=as,Fe;e[44]===C?Fe=e[45]:(Fe=[...C],e[44]=C,e[45]=Fe);let Le=Qo,Re=C.map(e=>{if(fe.has(e)){let t=e===r;return(0,Z.jsx)(UF,{tabId:e,canPin:!1,openTabs:C,closeTab:l,closeTabs:_e,pinTab:v,pinnedTabIds:y,unpinTab:S,children:(0,Z.jsxs)(HF,{tabId:e,activateFromKeyboard:()=>o(e),"aria-current":t?`page`:void 0,"data-active-tab":t?`true`:void 0,className:X(PF,t?FF:IF),onAuxClick:t=>{t.button===1&&(t.preventDefault(),l(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:LF,onClick:()=>o(e),tabIndex:-1,children:(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:(0,Z.jsx)(Y,{id:`3YvS-c`})})}),(0,Z.jsx)(`button`,{type:`button`,"aria-label":w({id:`xCdTnb`}),"data-testid":`editor-new-tab-placeholder-close`,className:wF(t),tabIndex:TF(t),onClick:t=>{t.stopPropagation(),l(e)},children:(0,Z.jsx)(xs,{"aria-hidden":`true`,className:`size-3.5`})})]})},e)}let t=ne(e),n=e===U,i=y.includes(e);if(t.kind===`folder`){let{baseName:r,label:o,prefix:s}=ie(t.folderPath,`/`),c=`${s}${o}`;return(0,Z.jsx)(UF,{tabId:e,openTabs:C,closeTab:u,closeTabs:_e,pinTab:v,pinnedTabIds:y,unpinTab:S,children:(0,Z.jsxs)(HF,{tabId:e,activateFromKeyboard:()=>a(e),"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:X(PF,n?FF:IF),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&u(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":c,title:c,className:LF,onClick:()=>{a(e)},tabIndex:-1,children:[s&&(0,Z.jsx)(`span`,{className:X(`min-w-0 flex-1 truncate`,n&&`text-muted-foreground`),children:s}),(0,Z.jsxs)(`span`,{className:X(`flex min-w-0 items-center`,s?`max-w-[70%] shrink-0`:`flex-1`),children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:r}),(0,Z.jsx)(`span`,{className:`shrink-0`,children:`/`})]})]}),(0,Z.jsx)(WF,{accessibleLabel:c,closeTab:u,isActive:n,isPinned:i,tabId:e,unpinTab:S})]})},e)}if(t.kind===`asset`||t.kind===`skill-file`){let{baseName:r,label:o,prefix:s}=ie(t.kind===`asset`?t.assetPath:t.path,``),c=`${s}${o}`;return(0,Z.jsx)(UF,{tabId:e,openTabs:C,closeTab:u,closeTabs:_e,pinTab:v,pinnedTabIds:y,unpinTab:S,children:(0,Z.jsxs)(HF,{tabId:e,activateFromKeyboard:()=>a(e),"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:X(PF,n?FF:IF),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&u(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":c,className:LF,onClick:()=>{a(e)},tabIndex:-1,children:[s?(0,Z.jsx)(`span`,{className:X(`min-w-0 flex-1 truncate text-muted-foreground/60`,n&&`text-muted-foreground`),children:s}):null,(0,Z.jsx)(`span`,{className:X(`min-w-0 truncate`,s?`max-w-[70%] shrink-0`:`flex-1`),children:r})]}),(0,Z.jsx)(WF,{accessibleLabel:c,closeTab:u,isActive:n,isPinned:i,tabId:e,unpinTab:S})]})},e)}let s=t.docName,c=T.get(s)?.docExt??`.md`,{baseName:d,extension:f,label:p,prefix:m}=ie(s,c),h=`${m}${p}`,g=c===`.md`||c===`.mdx`,_=k?.tabId===e,b=`editor-tab-rename-error-${RF(s)}`;return(0,Z.jsx)(UF,{disabled:_,tabId:e,openTabs:C,closeTab:u,closeTabs:_e,pinTab:v,pinnedTabIds:y,unpinTab:S,children:(0,Z.jsx)(HF,{tabId:e,activateFromKeyboard:()=>a(e),disabled:_,"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:X(PF,n?FF:IF,_&&N&&`border-destructive`),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&u(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:_?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(vE,{className:`h-full min-w-0 flex-1 rounded-none border-0 bg-transparent dark:bg-transparent`,children:[(0,Z.jsx)(CE,{ref:L,value:j,disabled:F,"aria-label":w({id:`Dw1T_W`,values:{label:p}}),"data-testid":`editor-tab-rename-input`,"aria-invalid":N?!0:void 0,"aria-describedby":N?b:void 0,"aria-busy":F||void 0,title:N??s,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=>{M(VF(e.target.value,c)),P(null),B.current=null},onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),le()):e.key===`Escape`&&(e.preventDefault(),ce())},onBlur:le}),(0,Z.jsx)(bE,{align:`inline-end`,"aria-hidden":`true`,className:`pr-2 text-xs`,children:(0,Z.jsx)(SE,{className:`text-muted-foreground/60 text-xs`,children:c})})]}),N?(0,Z.jsx)(`span`,{id:b,role:`alert`,className:`sr-only`,children:N}):null]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":h,title:h,className:LF,onClick:()=>{a(e)},onDoubleClick:t=>{t.preventDefault(),t.stopPropagation(),se(e,s)},tabIndex:-1,children:[(0,Z.jsx)(GF,{docName:s}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:d}),!g&&(0,Z.jsx)(`span`,{className:`shrink-0`,children:f})]})]}),(0,Z.jsx)(WF,{accessibleLabel:h,closeTab:u,isActive:n,isPinned:i,tabId:e,unpinTab:S})]})})},e)}),ze;e[46]!==Pe||e[47]!==Fe||e[48]!==Le||e[49]!==Re?(ze=(0,Z.jsx)(Pe,{items:Fe,strategy:Le,children:Re}),e[46]=Pe,e[47]=Fe,e[48]=Le,e[49]=Re,e[50]=ze):ze=e[50];let Be;e[51]!==je||e[52]!==we||e[53]!==Ee||e[54]!==Se||e[55]!==be||e[56]!==!1||e[57]!==Me||e[58]!==Ne||e[59]!==ze||e[60]!==he?(Be=(0,Z.jsx)(je,{sensors:be,autoScroll:!1,collisionDetection:Me,modifiers:he,onDragStart:Se,onDragEnd:Ee,onDragCancel:we,accessibility:Ne,children:ze}),e[51]=je,e[52]=we,e[53]=Ee,e[54]=Se,e[55]=be,e[56]=!1,e[57]=Me,e[58]=Ne,e[59]=ze,e[60]=he,e[61]=Be):Be=e[61];let Ve;e[62]===w?Ve=e[63]:(Ve=w({id:`3YvS-c`}),e[62]=w,e[63]=Ve);let He;e[64]===Symbol.for(`react.memo_cache_sentinel`)?(He=(0,Z.jsx)(It,{"aria-hidden":`true`}),e[64]=He):He=e[64];let Ue;e[65]!==g||e[66]!==Ve?(Ue=(0,Z.jsx)(zs,{asChild:!0,children:(0,Z.jsx)(Ci,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":Ve,"data-testid":`editor-new-tab-button`,className:`first:mb-3 mb-1.5`,onClick:g,children:He})}),e[65]=g,e[66]=Ve,e[67]=Ue):Ue=e[67];let We;e[68]===Symbol.for(`react.memo_cache_sentinel`)?(We=(0,Z.jsx)(Bs,{children:(0,Z.jsx)(Y,{id:`3YvS-c`})}),e[68]=We):We=e[68];let Ge;e[69]===Ue?Ge=e[70]:(Ge=(0,Z.jsxs)(Hs,{children:[Ue,We]}),e[69]=Ue,e[70]=Ge);let Ke;e[71]!==Ae||e[72]!==Be||e[73]!==Ge?(Ke=(0,Z.jsxs)(`div`,{className:Ae,children:[Be,Ge]}),e[71]=Ae,e[72]=Be,e[73]=Ge,e[74]=Ke):Ke=e[74];let qe;return e[75]!==De||e[76]!==Oe||e[77]!==ke||e[78]!==Ke?(qe=(0,Z.jsx)(`div`,{ref:E,"data-electron-drag":De,className:Oe,onWheel:ke,children:Ke}),e[75]=De,e[76]=Oe,e[77]=ke,e[78]=Ke,e[79]=qe):qe=e[79],qe}var qF=(e,t,n)=>{if(e&&`reportValidity`in e){let r=Li(n,t);e.setCustomValidity(r&&r.message||``),e.reportValidity()}},JF=(e,t)=>{for(let n in t.fields){let r=t.fields[n];r&&r.ref&&`reportValidity`in r.ref?qF(r.ref,n,e):r&&r.refs&&r.refs.forEach(t=>qF(t,n,e))}},YF=(e,t)=>{t.shouldUseNativeValidation&&JF(e,t);let n={};for(let r in e){let i=Li(t.fields,r),a=Object.assign(e[r]||{},{ref:i&&i.ref});if(XF(t.names||Object.keys(e),r)){let e=Object.assign({},Li(n,r));Ki(e,`root`,a),Ki(n,r,e)}else Ki(n,r,a)}return n},XF=(e,t)=>{let n=ZF(t).replace(/[.*+?^${}()|\\]/g,`\\$&`);return e.some(e=>ZF(e).match(`^${n}\\.\\d+`))};function ZF(e){return e.replace(/[\[\]]/g,``)}function QF(){return QF=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},QF.apply(null,arguments)}function $F(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}function eI(e,t){for(var n={};e.length;){var r=e[0],i=r.code,a=r.message,o=r.path.join(`.`);if(!n[o])if(`unionErrors`in r){var s=r.unionErrors[0].errors[0];n[o]={message:s.message,type:s.code}}else n[o]={message:a,type:i};if(`unionErrors`in r&&r.unionErrors.forEach(function(t){return t.errors.forEach(function(t){return e.push(t)})}),t){var c=n[o].types,l=c&&c[r.code];n[o]=Ri(o,t,n,i,l?[].concat(l,r.message):r.message)}e.shift()}return n}function tI(e,t){for(var n={},r=function(){var r=e[0],i=r.code,a=r.message,o=r.path.join(`.`);if(!n[o])if(r.code===`invalid_union`&&r.errors.length>0){var s=r.errors[0][0];n[o]={message:s.message,type:s.code}}else n[o]={message:a,type:i};if(r.code===`invalid_union`&&r.errors.forEach(function(t){return t.forEach(function(t){return e.push(QF({},t,{path:[].concat(r.path,t.path)}))})}),t){var c=n[o].types,l=c&&c[r.code];n[o]=Ri(o,t,n,i,l?[].concat(l,r.message):r.message)}e.shift()};e.length;)r();return n}function nI(e,t,n){if(n===void 0&&(n={}),function(e){return`_def`in e&&typeof e._def==`object`&&`typeName`in e._def}(e))return function(r,i,a){try{return Promise.resolve($F(function(){return Promise.resolve(e[n.mode===`sync`?`parse`:`parseAsync`](r,t)).then(function(e){return a.shouldUseNativeValidation&&JF({},a),{errors:{},values:n.raw?Object.assign({},r):e}})},function(e){if(function(e){return Array.isArray(e?.issues)}(e))return{values:{},errors:YF(eI(e.errors,!a.shouldUseNativeValidation&&a.criteriaMode===`all`),a)};throw e}))}catch(e){return Promise.reject(e)}};if(function(e){return`_zod`in e&&typeof e._zod==`object`}(e))return function(r,i,a){try{return Promise.resolve($F(function(){return Promise.resolve((n.mode===`sync`?hr:Xn)(e,r,t)).then(function(e){return a.shouldUseNativeValidation&&JF({},a),{errors:{},values:n.raw?Object.assign({},r):e}})},function(e){if(function(e){return e instanceof mr}(e))return{values:{},errors:YF(tI(e.issues,!a.shouldUseNativeValidation&&a.criteriaMode===`all`),a)};throw e}))}catch(e){return Promise.reject(e)}};throw Error(`Invalid input: not a Zod schema`)}var rI=`https://openknowledge.ai/api/subscribe`;async function iI(e){try{let t=await fetch(rI,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({email:e}),signal:AbortSignal.timeout(15e3)});return t.ok?{ok:!0}:t.status===400?{ok:!1,reason:`invalid`}:t.status===503?{ok:!1,reason:`unavailable`}:(console.warn(`[subscribe] action=submit result=http-error status=${t.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 aI(e){let t=(0,$.c)(48),{title:n,description:r,onSuccess:i,onDismiss:a,autoFocus:o,compactSubmit:s,className:c}=e,{_:l}=rn(),[u,d]=(0,Q.useState)(!1),f=(0,Q.useRef)(null),p,m;t[0]===u?(p=t[1],m=t[2]):(p=()=>{u&&f.current?.focus()},m=[u],t[0]=u,t[1]=p,t[2]=m),(0,Q.useEffect)(p,m);let h,g;if(t[3]!==l){let e=_i({email:er({message:l({id:`Wq6Wcm`})})});g=ha,h=nI(e),t[3]=l,t[4]=h,t[5]=g}else h=t[4],g=t[5];let _;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(_={email:``},t[6]=_):_=t[6];let v;t[7]===h?v=t[8]:(v={resolver:h,defaultValues:_},t[7]=h,t[8]=v);let y=g(v),{isSubmitting:b}=y.formState,x=y.formState.errors.email?.message??y.formState.errors.root?.message,S;t[9]!==l||t[10]!==y||t[11]!==i?(S=async function(e){y.clearErrors(`root`);let t=await iI(e.email);if(t.ok){d(!0),i?.();return}if(t.reason===`invalid`){y.setError(`email`,{message:l({id:`Wq6Wcm`})});return}if(t.reason===`unavailable`){y.setError(`root`,{message:l({id:`4mLBx9`})});return}y.setError(`root`,{message:l({id:`fWsBTs`})})},t[9]=l,t[10]=y,t[11]=i,t[12]=S):S=t[12];let C=S,w;t[13]===c?w=t[14]:(w=X(`flex flex-col gap-3`,c),t[13]=c,t[14]=w);let T=u?-1:void 0,E;t[15]!==u||t[16]!==n?(E=u?(0,Z.jsxs)(`span`,{className:`mb-1.5 inline-flex flex-row items-center gap-2`,children:[(0,Z.jsx)(Ya,{className:`size-4 text-primary`}),(0,Z.jsx)(Y,{id:`PIMM5l`})]}):n??(0,Z.jsx)(Y,{id:`GzPQ2f`}),t[15]=u,t[16]=n,t[17]=E):E=t[17];let D;t[18]!==E||t[19]!==T?(D=(0,Z.jsx)(`p`,{ref:f,tabIndex:T,className:`text-sm font-medium leading-tight text-foreground focus:outline-none`,children:E}),t[18]=E,t[19]=T,t[20]=D):D=t[20];let O;t[21]!==r||t[22]!==u?(O=u?(0,Z.jsx)(Y,{id:`pBROkv`}):r??(0,Z.jsx)(Y,{id:`WmPbvm`}),t[21]=r,t[22]=u,t[23]=O):O=t[23];let k;t[24]===O?k=t[25]:(k=(0,Z.jsx)(`p`,{className:`text-1sm text-muted-foreground`,role:`status`,children:O}),t[24]=O,t[25]=k);let A;t[26]!==D||t[27]!==k?(A=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[D,k]}),t[26]=D,t[27]=k,t[28]=A):A=t[28];let j;t[29]!==l||t[30]!==a?(j=a?(0,Z.jsx)(Ci,{type:`button`,variant:`ghost`,size:`icon`,onClick:a,"aria-label":l({id:`yz7wBu`}),className:`-mr-1.5 -mt-1 size-7 shrink-0 text-muted-foreground opacity-60`,children:(0,Z.jsx)(xs,{className:`size-4`})}):null,t[29]=l,t[30]=a,t[31]=j):j=t[31];let M;t[32]!==A||t[33]!==j?(M=(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[A,j]}),t[32]=A,t[33]=j,t[34]=M):M=t[34];let N;t[35]!==l||t[36]!==o||t[37]!==s||t[38]!==x||t[39]!==y||t[40]!==b||t[41]!==C||t[42]!==u?(N=u?null:(0,Z.jsxs)(`form`,{onSubmit:y.handleSubmit(C),className:`flex flex-col gap-2`,noValidate:!0,children:[(0,Z.jsx)(Ma,{control:y.control,name:`email`,render:e=>{let{field:t,fieldState:n}=e;return(0,Z.jsxs)(vE,{className:`h-10 rounded-xl`,children:[(0,Z.jsx)(bE,{className:`pl-2.5`,children:(0,Z.jsx)(Hd,{className:`size-4 text-muted-foreground opacity-60`})}),(0,Z.jsx)(CE,{...t,id:t.name,type:`email`,inputMode:`email`,autoComplete:`email`,spellCheck:!1,autoFocus:o,placeholder:l({id:`2hYmUH`}),"aria-invalid":n.invalid,"aria-label":l({id:`ATGYL1`}),"data-testid":`subscribe-email`,className:`placeholder:text-muted-foreground/60`}),(0,Z.jsx)(Ci,{type:`submit`,disabled:b,size:s?`icon`:`default`,className:X(`mr-1 ml-auto text-1sm`,s&&`size-8 shrink-0 rounded-lg`),"data-testid":`subscribe-submit`,children:b?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Vo,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(Y,{id:`lCC_D5`})})]}):s?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Na,{className:`size-4`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(Y,{id:`EDl9kS`})})]}):(0,Z.jsx)(Y,{id:`EDl9kS`})})]})}}),x?(0,Z.jsx)(`p`,{className:`text-sm text-destructive`,role:`alert`,children:x}):null]}),t[35]=l,t[36]=o,t[37]=s,t[38]=x,t[39]=y,t[40]=b,t[41]=C,t[42]=u,t[43]=N):N=t[43];let P;return t[44]!==M||t[45]!==N||t[46]!==w?(P=(0,Z.jsxs)(`div`,{className:w,children:[M,N]}),t[44]=M,t[45]=N,t[46]=w,t[47]=P):P=t[47],P}var oI=`https://github.com/inkeep/open-knowledge`,sI=`https://discord.com/invite/YujKpFN49`,cI=`https://x.com/OpenKnowledgeAI`;function lI(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 uI(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 dI=[{key:`resources`,heading:{id:`s-MGs7`},links:[{label:{id:`TbjyhA`},href:`https://openknowledge.ai/docs`,icon:y},{label:{id:`PCNIuJ`},href:`${oI}/issues/new`,icon:pd},{label:{id:`On0aF2`},href:`https://openknowledge.ai/`,icon:co}]},{key:`community`,heading:{id:`chL5IG`},links:[{label:`Discord`,href:sI,icon:lI},{label:`X (Twitter)`,href:cI,icon:uI},{label:`GitHub`,href:oI,icon:Lm}]}],fI=`${oI}/releases`,pI=`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 mI(e){if(e<1e3)return String(e);let t=e/1e3;return`${t>=10?Math.round(t):t.toFixed(1)}k`}var hI=e=>{let t=(0,$.c)(12),{count:n}=e,{_:r}=rn(),i,a,o,s;t[0]!==r||t[1]!==n?(i=mI(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)(_f,{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},gI=e=>{let t=(0,$.c)(15),{link:n,trailing:r}=e,{_:i}=rn(),{label:a,href:o,icon:s}=n,c,l;t[0]===o?(c=t[1],l=t[2]):(c=e=>js(e,o),l=e=>js(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:pI,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},_I=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},vI=()=>{let e=(0,$.c)(28),{_:t}=rn(),[n,r]=(0,Q.useState)(!1),[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(null),c,l;e[0]!==n||e[1]!==o?(c=()=>{if(!n||o!==null)return;let e=new AbortController;return Or({signal:e.signal}).then(e=>{e!==null&&s(e)}),()=>e.abort()},l=[n,o],e[0]=n,e[1]=o,e[2]=c,e[3]=l):(c=e[2],l=e[3]),(0,Q.useEffect)(c,l);let u;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(u=e=>{r(e),e||a(!1)},e[4]=u):u=e[4];let d;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(J,{className:`size-4`}),e[5]=d):d=e[5];let f;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(zs,{asChild:!0,children:(0,Z.jsx)(j,{asChild:!0,children:(0,Z.jsxs)(Ci,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,children:[d,(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(Y,{id:`s-MGs7`})})]})})}),e[6]=f):f=e[6];let p;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsxs)(Hs,{children:[f,(0,Z.jsx)(Bs,{children:(0,Z.jsx)(Y,{id:`s-MGs7`})})]}),e[7]=p):p=e[7];let m;e[8]!==t||e[9]!==o?(m=dI.map((e,n)=>(0,Z.jsxs)(`div`,{className:X(n>0&&`mt-3`),children:[(0,Z.jsx)(_I,{children:t(e.heading)}),(0,Z.jsx)(`nav`,{"aria-label":t(e.heading),children:(0,Z.jsx)(`ul`,{className:`space-y-0.5`,children:e.links.map(e=>(0,Z.jsx)(gI,{link:e,trailing:e.href===`https://github.com/inkeep/open-knowledge`&&o!==null?(0,Z.jsx)(hI,{count:o}):void 0},e.href))})})]},e.key)),e[8]=t,e[9]=o,e[10]=m):m=e[10];let h;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(_I,{children:(0,Z.jsx)(Y,{id:`arUUsK`})}),e[11]=h):h=e[11];let g;e[12]===t?g=e[13]:(g=t({id:`arUUsK`}),e[12]=t,e[13]=g);let _;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(gI,{link:{label:{id:`3ePd3I`},href:fI,icon:Wd}}),e[14]=_):_=e[14];let v;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(j,{asChild:!0,children:(0,Z.jsxs)(Ci,{variant:`ghost`,className:X(pI,`h-auto w-full justify-start font-normal`),children:[(0,Z.jsx)(Hd,{"aria-hidden":`true`,className:`size-4 shrink-0`}),(0,Z.jsx)(Y,{id:`EDl9kS`})]})}),e[15]=v):v=e[15];let y;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(wt,{side:`left`,align:`center`,sideOffset:20,className:`w-80`,children:(0,Z.jsx)(aI,{autoFocus:!0,onDismiss:()=>a(!1),onSuccess:yI})}),e[16]=y):y=e[16];let b;e[17]===i?b=e[18]:(b=(0,Z.jsxs)(`ul`,{className:`space-y-0.5`,children:[_,(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(w,{open:i,onOpenChange:a,children:[v,y]})})]}),e[17]=i,e[18]=b);let x;e[19]!==b||e[20]!==g?(x=(0,Z.jsxs)(`div`,{className:`mt-3`,children:[h,(0,Z.jsx)(`nav`,{"aria-label":g,children:b})]}),e[19]=b,e[20]=g,e[21]=x):x=e[21];let S;e[22]!==x||e[23]!==m?(S=(0,Z.jsxs)(wt,{align:`end`,className:`w-56 p-3`,children:[m,x]}),e[22]=x,e[23]=m,e[24]=S):S=e[24];let C;return e[25]!==n||e[26]!==S?(C=(0,Z.jsxs)(w,{open:n,onOpenChange:u,children:[p,S]}),e[25]=n,e[26]=S,e[27]=C):C=e[27],C};function yI(){return Wg.markSubscribed()}var bI=50,xI=()=>{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,rE.preload()},bI))},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=Qi)},l=(0,Z.jsx)(lf,{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)(zs,{asChild:!0,children:(0,Z.jsxs)(Ci,{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)(Y,{id:`Tz0i8g`})})]})}),e[6]=u):u=e[6];let d;return e[7]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsxs)(Hs,{children:[u,(0,Z.jsx)(Bs,{children:(0,Z.jsx)(Y,{id:`Tz0i8g`})})]}),e[7]=d):d=e[7],d},SI=`https://openknowledge.ai/docs/features/share`;function CI(e){let t=(0,$.c)(42),{input:n,onClickWhenNoRemote:r}=e,{_:i}=rn(),{status:a}=$i(),[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;t[4]!==i||t[5]!==o||t[6]!==p||t[7]!==n||t[8]!==r?(h=async function(){if(!o&&n!==null){s(!0),l(null);try{let e=await zi({...n,hasRemote:p,onClickWhenNoRemote:r},{clipboardWrite:jo,toastSuccess:jI,toastError:AI,logEvent:kI});e.kind===`copied`?l({url:e.shareUrl,autoCopyFailed:!1}):e.kind===`clipboard-failed`&&l({url:e.shareUrl,autoCopyFailed:!0})}catch{bs.error(i({id:`u3YnKw`}))}s(!1)}},t[4]=i,t[5]=o,t[6]=p,t[7]=n,t[8]=r,t[9]=h):h=t[9];let g=h,_=c!==null,v;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(v=e=>{e||l(null)},t[10]=v):v=t[10];let y;t[11]!==i||t[12]!==n?.kind?(y=n?.kind===`folder`?i({id:`WR0y2O`}):i({id:`F4IYWe`}),t[11]=i,t[12]=n?.kind,t[13]=y):y=t[13];let b=o||m,x,S;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(uf,{className:`size-3.5`,"aria-hidden":!0}),S=(0,Z.jsx)(Y,{id:`Z8lGw6`}),t[14]=x,t[15]=S):(x=t[14],S=t[15]);let C;t[16]!==g||t[17]!==y||t[18]!==b?(C=(0,Z.jsx)(P,{asChild:!0,children:(0,Z.jsxs)(Ci,{variant:`ghost`,size:`sm`,"aria-label":y,onClick:g,disabled:b,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`share-button`,children:[x,S]})}),t[16]=g,t[17]=y,t[18]=b,t[19]=C):C=t[19];let T;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(`p`,{className:`font-mono tracking-wide uppercase text-muted-foreground text-xs`,children:(0,Z.jsx)(Y,{id:`Z8lGw6`})}),t[20]=T):T=t[20];let E;t[21]===c?.autoCopyFailed?E=t[22]:(E=c?.autoCopyFailed?(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`ndeI89`})}):null,t[21]=c?.autoCopyFailed,t[22]=E);let D=c?.url??``,O;t[23]===i?O=t[24]:(O=i({id:`5-FeN2`}),t[23]=i,t[24]=O);let k;t[25]!==D||t[26]!==O?(k=(0,Z.jsx)(zc,{ref:u,readOnly:!0,value:D,onFocus:OI,onClick:DI,onContextMenu:EI,className:`select-all bg-muted font-mono text-xs text-muted-foreground`,"data-testid":`share-button-url`,"aria-label":O}),t[25]=D,t[26]=O,t[27]=k):k=t[27];let A=c?.url??``,j=c?.autoCopyFailed===!1,M;t[28]!==A||t[29]!==j?(M=(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)(z,{copyContent:A,clipboardWrite:jo,initialCopied:j})})}),t[28]=A,t[29]=j,t[30]=M):M=t[30];let N;t[31]!==k||t[32]!==M?(N=(0,Z.jsxs)(`div`,{className:`relative`,children:[k,M]}),t[31]=k,t[32]=M,t[33]=N):N=t[33];let F;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsxs)(`a`,{href:SI,target:`_blank`,rel:`noopener noreferrer`,onClick:TI,onAuxClick:wI,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)(J,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(Y,{id:`aByJ8j`})]}),t[34]=F):F=t[34];let I;t[35]!==E||t[36]!==N?(I=(0,Z.jsxs)(wt,{align:`end`,className:`flex w-80 flex-col gap-2`,"data-testid":`share-button-popover`,children:[T,E,N,F]}),t[35]=E,t[36]=N,t[37]=I):I=t[37];let L;return t[38]!==C||t[39]!==I||t[40]!==_?(L=(0,Z.jsxs)(w,{open:_,onOpenChange:v,children:[C,I]}),t[38]=C,t[39]=I,t[40]=_,t[41]=L):L=t[41],L}function wI(e){return js(e,SI)}function TI(e){return js(e,SI)}function EI(e){return e.currentTarget.select()}function DI(e){return e.currentTarget.select()}function OI(e){return e.currentTarget.select()}function kI(e){return console.log(e)}function AI(e){e!==`Link ready but could not copy to clipboard.`&&bs.error(e)}function jI(e){return bs.success(e)}function MI(e){let t=(0,$.c)(43),{onSignIn:n,onSetIdentity:r,onOpenSearch:i,terminalAvailable:a,terminalVisible:s,onToggleChat:c}=e,{_:l}=rn(),u;t[0]!==l||t[1]!==s?(u=l(s?{id:`pqZJT2`}:{id:`6I7cJR`}),t[0]=l,t[1]=s,t[2]=u):u=t[2];let d=u,{activeDocName:f,activeTarget:p}=ft(),m=f?Qr(f):null,{state:h,isDraggingRail:g}=cN(),_=ty(),v;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(v=Cl(`toggle-files-sidebar`),t[3]=v):v=t[3];let y=v,b=Cl(`command-palette`),[x,S]=(0,Q.useState)(!1),C;bb0:{if(p?.kind===`folder`){let e;t[4]===p.folderPath?e=t[5]:(e=qi(p.folderPath),t[4]=p.folderPath,t[5]=e),C=e;break bb0}if(f&&!m){let e;t[6]===f?e=t[7]:(e=Gi(f),t[6]=f,t[7]=e),C=e;break bb0}if(!p&&!f){let e;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(e=qi(``),t[8]=e):e=t[8],C=e;break bb0}C=null}let w=C,T=typeof window<`u`&&window.okDesktop!=null,E=h===`collapsed`,D=T?``:void 0,O=T&&E&&`pl-[var(--ok-titlebar-reserve-left,1rem)]`,k=T&&!g&&`motion-safe:transition-[padding] motion-safe:duration-200 motion-safe:ease-linear`,A;t[9]!==O||t[10]!==k?(A=X(`flex h-12 shrink-0 items-center bg-muted/35 shadow-[inset_0_-1px_0_var(--border)]`,T&&`[-webkit-app-region:drag]`,O,k),t[9]=O,t[10]=k,t[11]=A):A=t[11];let j=!_&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Hs,{children:[(0,Z.jsx)(zs,{asChild:!0,children:(0,Z.jsx)(pN,{className:X(`-ml-1 shrink-0 text-muted-foreground`,T&&`[-webkit-app-region:no-drag]`)})}),(0,Z.jsx)(Bs,{children:h===`expanded`?(0,Z.jsx)(Y,{id:`ZxXhLY`,values:{sidebarShortcut:y}}):(0,Z.jsx)(Y,{id:`Zz25kq`,values:{sidebarShortcut:y}})})]}),E&&i&&(0,Z.jsxs)(Hs,{children:[(0,Z.jsx)(zs,{asChild:!0,children:(0,Z.jsx)(Ci,{variant:`ghost`,size:`icon-sm`,onClick:i,"aria-label":l({id:`IN4UX8`,values:{searchShortcut:b}}),"data-telemetry-event":`ok.editor_header.search.click`,className:X(`shrink-0 text-muted-foreground`,T&&`[-webkit-app-region:no-drag]`),children:(0,Z.jsx)(o,{"aria-hidden":`true`})})}),(0,Z.jsx)(Bs,{children:(0,Z.jsx)(Y,{id:`IN4UX8`,values:{searchShortcut:b}})})]}),(0,Z.jsx)(ra,{orientation:`vertical`,className:`mr-1 h-4 shrink-0 data-vertical:self-center`}),(0,Z.jsx)(KF,{})]}),M;t[12]===j?M=t[13]:(M=(0,Z.jsx)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1 px-3`,children:j}),t[12]=j,t[13]=M);let N;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(N=X(`flex shrink-0 items-center justify-end gap-2 px-3`,T&&`[&>*]:[-webkit-app-region:no-drag]`),t[14]=N):N=t[14];let P;t[15]!==x||t[16]!==S||t[17]!==w||t[18]!==_?(P=!_&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(CI,{input:w,onClickWhenNoRemote:()=>S(!0)}),(0,Z.jsx)(Ii,{open:x,onOpenChange:S})]}),t[15]=x,t[16]=S,t[17]=w,t[18]=_,t[19]=P):P=t[19];let F;t[20]!==r||t[21]!==n?(F=(0,Z.jsx)(Aa,{onSignIn:n,onSetIdentity:r}),t[20]=r,t[21]=n,t[22]=F):F=t[22];let I;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(JP,{}),t[23]=I):I=t[23];let L;t[24]!==d||t[25]!==c||t[26]!==a?(L=a&&(0,Z.jsxs)(Hs,{children:[(0,Z.jsx)(zs,{asChild:!0,children:(0,Z.jsx)(Ci,{variant:`ghost`,size:`icon-sm`,onClick:()=>c?.(),"aria-label":d,"data-telemetry-event":`ok.editor_header.toggle_chat.click`,className:X(`shrink-0 text-muted-foreground`,T&&`[-webkit-app-region:no-drag]`),children:(0,Z.jsx)(Gd,{"aria-hidden":`true`})})}),(0,Z.jsx)(Bs,{children:d})]}),t[24]=d,t[25]=c,t[26]=a,t[27]=L):L=t[27];let R,z;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Z.jsx)(ra,{orientation:`vertical`,className:`h-4 shrink-0 data-vertical:self-center`}),z=(0,Z.jsx)(sm,{}),t[28]=R,t[29]=z):(R=t[28],z=t[29]);let B;t[30]===_?B=t[31]:(B=!_&&(0,Z.jsx)(xI,{}),t[30]=_,t[31]=B);let V;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Z.jsx)(vI,{}),t[32]=V):V=t[32];let H;t[33]!==P||t[34]!==F||t[35]!==L||t[36]!==B?(H=(0,Z.jsxs)(`div`,{className:N,children:[P,F,I,L,R,z,B,V]}),t[33]=P,t[34]=F,t[35]=L,t[36]=B,t[37]=H):H=t[37];let U;return t[38]!==M||t[39]!==H||t[40]!==D||t[41]!==A?(U=(0,Z.jsxs)(`header`,{"data-electron-drag":D,className:A,children:[M,H]}),t[38]=M,t[39]=H,t[40]=D,t[41]=A,t[42]=U):U=t[42],U}var NI=`open-knowledge:terminal-launch`;function PI(e,t,n=typeof window>`u`?new EventTarget:window){n.dispatchEvent(new CustomEvent(NI,{detail:{prompt:e,cli:t}}))}function FI(e,t=typeof window>`u`?new EventTarget:window){let n=t=>{let n=t instanceof CustomEvent?t.detail:void 0;n&&typeof n.prompt==`string`&&e(n.prompt,n.cli)};return t.addEventListener(NI,n),()=>t.removeEventListener(NI,n)}function II(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,orientation:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`horizontal`:i,o;t[4]===n?o=t[5]:(o=X(`group/tabs flex gap-2 data-horizontal:flex-col`,n),t[4]=n,t[5]=o);let s;return t[6]!==a||t[7]!==r||t[8]!==o?(s=(0,Z.jsx)(tm,{"data-slot":`tabs`,"data-orientation":a,className:o,...r}),t[6]=a,t[7]=r,t[8]=o,t[9]=s):s=t[9],s}var LI=xi(`group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function RI(e){let t=(0,$.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,variant:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`default`:i,o;t[4]!==n||t[5]!==a?(o=X(LI({variant:a}),n),t[4]=n,t[5]=a,t[6]=o):o=t[6];let s;return t[7]!==r||t[8]!==o||t[9]!==a?(s=(0,Z.jsx)(nm,{"data-slot":`tabs-list`,"data-variant":a,className:o,...r}),t[7]=r,t[8]=o,t[9]=a,t[10]=s):s=t[10],s}function zI(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=X(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent`,`data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(rm,{"data-slot":`tabs-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function BI(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=X(`flex-1 text-sm outline-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(im,{"data-slot":`tabs-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var VI=(0,Q.lazy)(()=>n(()=>import(`./TerminalPanel-bFmiuK8M.js`).then(e=>({default:e.TerminalPanel})),__vite__mapDeps([81,1,30,3,7,31,6,10,13,11,82,62,44,83]),import.meta.url));function HI(e){let t=(0,$.c)(14),{bridge:n,onClose:r,onTitleChange:i,launch:a,adoptPtyId:o,onPtyId:s}=e,c=a===void 0?null:a,l=o===void 0?null:o,{enabled:u,synced:d}=ua(),f=ta(),{_:p}=rn(),m=d&&u===!1,g;t[0]!==p||t[1]!==f?(g=function(){if(f===null){bs.error(p({id:`V_6bJ4`}));return}let e=f(!0);e.ok||bs.error(p({id:`jKd3AP`,values:{0:e.error}}))},t[0]=p,t[1]=f,t[2]=g):g=t[2];let _=g;if(d&&!m){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(`div`,{className:`h-full w-full bg-background`,"aria-hidden":`true`}),t[3]=e):e=t[3];let a;return t[4]!==l||t[5]!==n||t[6]!==c||t[7]!==r||t[8]!==s||t[9]!==i?(a=(0,Z.jsx)(h,{fallbackRender:WI,onError:UI,children:(0,Z.jsx)(Q.Suspense,{fallback:e,children:(0,Z.jsx)(VI,{bridge:n,className:`h-full`,onClose:r,onTitleChange:i,launch:c,adoptPtyId:l,onPtyId:s})})}),t[4]=l,t[5]=n,t[6]=c,t[7]=r,t[8]=s,t[9]=i,t[10]=a):a=t[10],a}let v;return t[11]!==_||t[12]!==m?(v=m?(0,Z.jsx)(qI,{onEnable:_}):(0,Z.jsx)(`div`,{className:`h-full w-full bg-background`,"aria-hidden":`true`}),t[11]=_,t[12]=m,t[13]=v):v=t[13],v}function UI(e,t){console.error(`[TerminalGate] rendered fallback for the terminal panel`,e,t.componentStack)}function WI(e){return(0,Z.jsx)(GI,{...e})}function GI(e){let t=(0,$.c)(15),{error:n}=e,{_:r}=rn(),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:`fbsiBw`}),t[0]=r,t[1]=n,t[2]=i):i=t[2];let a=i,o;t[3]===r?o=t[4]:(o=r({id:`6MnZEC`}),t[3]=r,t[4]=o);let s;t[5]===a?s=t[6]:(s=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-foreground`,children:a}),t[5]=a,t[6]=s);let c;t[7]===r?c=t[8]:(c=r({id:`HpK_8d`}),t[7]=r,t[8]=c);let l;t[9]===c?l=t[10]:(l=(0,Z.jsx)(Ci,{onClick:KI,children:c}),t[9]=c,t[10]=l);let u;return t[11]!==o||t[12]!==s||t[13]!==l?(u=(0,Z.jsxs)(`section`,{"aria-label":o,className:`flex h-full w-full flex-col items-center justify-center gap-3 bg-background p-6 text-center`,role:`alert`,children:[s,l]}),t[11]=o,t[12]=s,t[13]=l,t[14]=u):u=t[14],u}function KI(){return window.location.reload()}function qI(e){let t=(0,$.c)(20),{onEnable:n}=e,{_:r}=rn(),i;t[0]===r?i=t[1]:(i=r({id:`_XWY2J`}),t[0]=r,t[1]=i);let a;t[2]===r?a=t[3]:(a=r({id:`oYepHb`}),t[2]=r,t[3]=a);let o;t[4]===a?o=t[5]:(o=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-foreground`,children:a}),t[4]=a,t[5]=o);let s;t[6]===r?s=t[7]:(s=r({id:`v2ZW0K`}),t[6]=r,t[7]=s);let c;t[8]!==n||t[9]!==s?(c=(0,Z.jsx)(Ci,{onClick:n,children:s}),t[8]=n,t[9]=s,t[10]=c):c=t[10];let l;t[11]===r?l=t[12]:(l=r({id:`ICoNYz`}),t[11]=r,t[12]=l);let u;t[13]===l?u=t[14]:(u=(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:l}),t[13]=l,t[14]=u);let d;return t[15]!==i||t[16]!==o||t[17]!==c||t[18]!==u?(d=(0,Z.jsxs)(`section`,{"aria-label":i,className:`flex h-full w-full flex-col items-center justify-center gap-3 bg-background p-6 text-center`,children:[o,c,u]}),t[15]=i,t[16]=o,t[17]=c,t[18]=u,t[19]=d):d=t[19],d}function JI(e){let t=(0,$.c)(74),{sessions:n,activeSessionId:r,onSelect:i,onTabActivate:a,onNewChat:o,onNewTerminalTab:s,onClose:c,dockPosition:l,onToggleDock:u,onCollapse:d,children:f,className:p}=e,{_:m}=rn(),h=l===`right`,g;t[0]===p?g=t[1]:(g=X(`flex min-h-0 min-w-0 flex-1 flex-col`,p),t[0]=p,t[1]=g);let _;t[2]===m?_=t[3]:(_=m({id:`1MGRQl`}),t[2]=m,t[3]=_);let v;if(t[4]!==m||t[5]!==r||t[6]!==c||t[7]!==a||t[8]!==n){let e;t[10]!==m||t[11]!==r||t[12]!==c||t[13]!==a?(e=e=>{let t=e.id===r;return(0,Z.jsxs)(`div`,{className:X(`group flex shrink-0 cursor-default items-center rounded-md pr-0.5 transition-colors`,t?`bg-muted`:`hover:bg-muted/50`),children:[(0,Z.jsx)(zI,{value:e.id,onClick:()=>a?.(e.id),className:`h-7 flex-none rounded-md px-2 text-xs`,children:(0,Z.jsx)(`span`,{className:`max-w-40 truncate`,children:e.label})}),(0,Z.jsx)(Ci,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":m({id:`nzHlj8`,values:{0:e.label}}),tabIndex:t?0:-1,className:X(`text-muted-foreground opacity-0 transition-opacity hover:text-foreground group-hover:opacity-100 group-focus-within:opacity-100`,t&&`opacity-100`),onClick:t=>{t.stopPropagation(),c(e.id)},children:(0,Z.jsx)(xs,{"aria-hidden":`true`})})]},e.id)},t[10]=m,t[11]=r,t[12]=c,t[13]=a,t[14]=e):e=t[14],v=n.map(e),t[4]=m,t[5]=r,t[6]=c,t[7]=a,t[8]=n,t[9]=v}else v=t[9];let y;t[15]!==_||t[16]!==v?(y=(0,Z.jsx)(RI,{variant:`line`,"aria-label":_,className:`flex h-auto min-w-0 items-center justify-start gap-0.5 overflow-x-auto bg-transparent p-0 [scrollbar-width:none] scroll-fade-mask-x`,children:v}),t[15]=_,t[16]=v,t[17]=y):y=t[17];let b;t[18]===m?b=t[19]:(b=m({id:`hIQkLb`}),t[18]=m,t[19]=b);let x;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(It,{"aria-hidden":`true`}),t[20]=x):x=t[20];let S;t[21]!==o||t[22]!==b?(S=(0,Z.jsx)(zs,{asChild:!0,children:(0,Z.jsx)(Ci,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":b,className:`shrink-0 cursor-pointer text-muted-foreground hover:text-foreground`,onClick:o,children:x})}),t[21]=o,t[22]=b,t[23]=S):S=t[23];let C;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(Bs,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(Y,{id:`hIQkLb`})}),t[24]=C):C=t[24];let w;t[25]===S?w=t[26]:(w=(0,Z.jsxs)(Hs,{children:[S,C]}),t[25]=S,t[26]=w);let T;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(`div`,{className:`flex-1`}),t[27]=T):T=t[27];let E;t[28]===m?E=t[29]:(E=m({id:`k0vc0N`}),t[28]=m,t[29]=E);let D;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsx)(hf,{"aria-hidden":`true`}),t[30]=D):D=t[30];let O;t[31]!==s||t[32]!==E?(O=(0,Z.jsx)(zs,{asChild:!0,children:(0,Z.jsx)(Ci,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":E,className:`shrink-0 cursor-pointer text-muted-foreground hover:text-foreground`,onClick:s,children:D})}),t[31]=s,t[32]=E,t[33]=O):O=t[33];let k;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Z.jsx)(Bs,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(Y,{id:`k0vc0N`})}),t[34]=k):k=t[34];let A;t[35]===O?A=t[36]:(A=(0,Z.jsxs)(Hs,{children:[O,k]}),t[35]=O,t[36]=A);let j;t[37]!==m||t[38]!==h?(j=m(h?{id:`rf6x3F`}:{id:`QNxpRm`}),t[37]=m,t[38]=h,t[39]=j):j=t[39];let M;t[40]===h?M=t[41]:(M=h?(0,Z.jsx)(Yd,{"aria-hidden":`true`}):(0,Z.jsx)($d,{"aria-hidden":`true`}),t[40]=h,t[41]=M);let N;t[42]!==u||t[43]!==j||t[44]!==M?(N=(0,Z.jsx)(zs,{asChild:!0,children:(0,Z.jsx)(Ci,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":j,className:`shrink-0 cursor-pointer text-muted-foreground hover:text-foreground`,onClick:u,children:M})}),t[42]=u,t[43]=j,t[44]=M,t[45]=N):N=t[45];let P;t[46]===h?P=t[47]:(P=(0,Z.jsx)(Bs,{side:`bottom`,sideOffset:8,children:h?(0,Z.jsx)(Y,{id:`rf6x3F`}):(0,Z.jsx)(Y,{id:`QNxpRm`})}),t[46]=h,t[47]=P);let F;t[48]!==N||t[49]!==P?(F=(0,Z.jsxs)(Hs,{children:[N,P]}),t[48]=N,t[49]=P,t[50]=F):F=t[50];let I;t[51]===m?I=t[52]:(I=m({id:`VZGGPK`}),t[51]=m,t[52]=I);let L;t[53]===h?L=t[54]:(L=h?(0,Z.jsx)(io,{"aria-hidden":`true`}):(0,Z.jsx)(ro,{"aria-hidden":`true`}),t[53]=h,t[54]=L);let R;t[55]!==d||t[56]!==I||t[57]!==L?(R=(0,Z.jsx)(zs,{asChild:!0,children:(0,Z.jsx)(Ci,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":I,className:`shrink-0 cursor-pointer text-muted-foreground hover:text-foreground`,onClick:d,children:L})}),t[55]=d,t[56]=I,t[57]=L,t[58]=R):R=t[58];let z;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Z.jsx)(Bs,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(Y,{id:`VZGGPK`})}),t[59]=z):z=t[59];let B;t[60]===R?B=t[61]:(B=(0,Z.jsxs)(Hs,{children:[R,z]}),t[60]=R,t[61]=B);let V;t[62]!==A||t[63]!==F||t[64]!==B||t[65]!==y||t[66]!==w?(V=(0,Z.jsxs)(`div`,{className:`flex shrink-0 flex-row items-center gap-1 px-1.5 py-1`,children:[y,w,T,A,F,B]}),t[62]=A,t[63]=F,t[64]=B,t[65]=y,t[66]=w,t[67]=V):V=t[67];let H;return t[68]!==r||t[69]!==f||t[70]!==i||t[71]!==g||t[72]!==V?(H=(0,Z.jsxs)(II,{value:r,onValueChange:i,className:g,children:[V,f]}),t[68]=r,t[69]=f,t[70]=i,t[71]=g,t[72]=V,t[73]=H):H=t[73],H}function YI(e){return`terminal-session-${e}`}function XI(e){e!==``&&document.querySelector(`[data-terminal-session="${e}"] .xterm-helper-textarea`)?.focus()}function ZI(e){let t=(0,$.c)(68),{bridge:n,visible:r,onVisibleChange:i,launch:a,installedClis:o,container:s,isShowing:c,onRequestEditorFocus:l,dockPosition:u,onToggleDock:d,onHasSessionsChange:f}=e,p=a===void 0?null:a,{_:m}=rn(),[h]=(0,Q.useState)(tL),g,_;t[0]!==s||t[1]!==h?(g=()=>{h==null||s==null||h.parentElement!==s&&s.appendChild(h)},_=[h,s],t[0]=s,t[1]=h,t[2]=g,t[3]=_):(g=t[2],_=t[3]),(0,Q.useLayoutEffect)(g,_);let v=typeof n.terminal?.list==`function`,y;t[4]!==v||t[5]!==p||t[6]!==r?(y=()=>!v&&r?[{id:YI(1),launch:p,title:null,adoptPtyId:null}]:[],t[4]=v,t[5]=p,t[6]=r,t[7]=y):y=t[7];let[b,x]=(0,Q.useState)(y),S;t[8]!==v||t[9]!==r?(S=()=>!v&&r?YI(1):``,t[8]=v,t[9]=r,t[10]=S):S=t[10];let[C,w]=(0,Q.useState)(S),[T,E]=(0,Q.useState)(!v),D=(0,Q.useRef)(!1),O=(0,Q.useRef)(C),k=(0,Q.useRef)(b),A=(0,Q.useRef)(!v&&r?1:0),j=(0,Q.useRef)(r&&p?p.nonce:null),M=(0,Q.useRef)(r),N=(0,Q.useRef)(new Map),P=function(e,t){t===null?N.current.delete(e):N.current.set(e,t)},F=(0,Q.useRef)(0),I;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(I=function(e){A.current+=1;let t=YI(A.current);x(n=>[...n,{id:t,launch:e,title:null,adoptPtyId:null}]),w(t)},t[11]=I):I=t[11];let L=I,R;t[12]===o?R=t[13]:(R=function(){F.current+=1,L({prompt:null,cli:Yy(Ky(),o??{}),nonce:F.current})},t[12]=o,t[13]=R);let z=R,B;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(B=function(e,t){let n=t.trim()===``?null:t.trim();x(t=>t.some(t=>t.id===e&&t.title!==n)?t.map(t=>t.id===e?{...t,title:n}:t):t)},t[14]=B):B=t[14];let V=B,H=(0,Q.useRef)(L),U;t[15]!==C||t[16]!==l||t[17]!==i?(U=function(e){let t=k.current,n=t.findIndex(t=>t.id===e);if(n===-1)return;let r=t.filter(t=>t.id!==e);if(e===C){let e=(t[n-1]??t[n+1])?.id??``;w(e),e!==``&&queueMicrotask(()=>XI(e))}x(r),r.length===0&&(i(!1),l())},t[15]=C,t[16]=l,t[17]=i,t[18]=U):U=t[18];let W=U,G=(0,Q.useRef)(eL),K;t[19]!==C||t[20]!==W||t[21]!==b?(K=()=>{H.current=L,O.current=C,k.current=b,G.current=()=>{C!==``&&W(C)}},t[19]=C,t[20]=W,t[21]=b,t[22]=K):K=t[22],(0,Q.useEffect)(K);let ee,te;t[23]!==p||t[24]!==T||t[25]!==b.length||t[26]!==r?(ee=()=>{if(!T)return;let e=M.current;if(M.current=r,p!=null&&p.nonce!==j.current){j.current=p.nonce,H.current(p);return}r&&!e&&b.length===0&&H.current(null)},te=[r,p,b.length,T],t[23]=p,t[24]=T,t[25]=b.length,t[26]=r,t[27]=ee,t[28]=te):(ee=t[27],te=t[28]),(0,Q.useEffect)(ee,te);let q;t[29]===n.terminal?q=t[30]:(q=()=>{if(typeof n.terminal?.list!=`function`||D.current)return;D.current=!0;let e=!1;return(async()=>{let t;try{t=await n.terminal.list()??[]}catch(e){console.error(`[terminal] reload session list() failed; cold-starting:`,e),t=[]}if(!e){if(t.length>0){let e=t.map($I);A.current=e.length,x(e),w(e[0]?.id??``)}E(!0)}})(),()=>{e=!0,D.current=!1}},t[29]=n.terminal,t[30]=q);let J;t[31]===n?J=t[32]:(J=[n],t[31]=n,t[32]=J),(0,Q.useEffect)(q,J);let ne;t[33]===n?ne=t[34]:(ne=[n],t[33]=n,t[34]=ne),(0,Q.useEffect)(()=>HO(e=>{let t=O.current,r=t===``?void 0:N.current.get(t);r==null?ru():(n.terminal.input(r,e),queueMicrotask(()=>XI(t)))}),ne);let re,ie;t[35]===n?(re=t[36],ie=t[37]):(re=()=>n.onMenuAction(e=>{e===`new-terminal`?H.current(null):e===`kill-terminal`&&G.current()}),ie=[n],t[35]=n,t[36]=re,t[37]=ie),(0,Q.useEffect)(re,ie);let ae,oe;t[38]===h?(ae=t[39],oe=t[40]):(ae=()=>{let e=function(e){if(!e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||!/^[1-9]$/.test(e.key)||h==null||!h.contains(document.activeElement))return;let t=k.current[Number(e.key)-1];t!=null&&(e.preventDefault(),e.stopPropagation(),w(t.id),queueMicrotask(()=>XI(t.id)))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},oe=[h],t[38]=h,t[39]=ae,t[40]=oe),(0,Q.useEffect)(ae,oe);let se;t[41]!==n.editor||t[42]!==b.length?(se=()=>{n.editor.notifyViewMenuStateChanged({terminalLive:b.length>0})},t[41]=n.editor,t[42]=b.length,t[43]=se):se=t[43];let ce;t[44]!==n||t[45]!==b.length?(ce=[n,b.length],t[44]=n,t[45]=b.length,t[46]=ce):ce=t[46],(0,Q.useEffect)(se,ce);let le,ue;t[47]!==f||t[48]!==b.length?(le=()=>{f?.(b.length>0)},ue=[f,b.length],t[47]=f,t[48]=b.length,t[49]=le,t[50]=ue):(le=t[49],ue=t[50]),(0,Q.useEffect)(le,ue);let de,fe;t[51]!==h||t[52]!==c||t[53]!==l||t[54]!==r?(de=()=>{c||r||h==null||!h.contains(document.activeElement)||l()},fe=[c,r,h,l],t[51]=h,t[52]=c,t[53]=l,t[54]=r,t[55]=de,t[56]=fe):(de=t[55],fe=t[56]),(0,Q.useLayoutEffect)(de,fe);let pe,me;t[57]===c?(pe=t[58],me=t[59]):(pe=()=>{c&&XI(O.current)},me=[c],t[57]=c,t[58]=pe,t[59]=me),(0,Q.useEffect)(pe,me);let he;if(t[60]!==m||t[61]!==b){let e;t[63]===m?e=t[64]:(e=(e,t)=>({id:e.id,label:e.title??m({id:`OVjNeX`,values:{0:t+1}})}),t[63]=m,t[64]=e),he=b.map(e),t[60]=m,t[61]=b,t[62]=he}else he=t[62];let ge=he,_e=b.length>0?(0,Z.jsx)(JI,{sessions:ge,activeSessionId:C,onSelect:w,onTabActivate:QI,onNewChat:z,onNewTerminalTab:()=>L(null),onClose:W,dockPosition:u,onToggleDock:d,onCollapse:()=>i(!1),className:`h-full`,children:b.map(e=>(0,Z.jsx)(BI,{value:e.id,forceMount:!0,"data-terminal-session":e.id,className:`m-0 flex min-h-0 flex-1 flex-col overflow-hidden data-[state=inactive]:hidden`,children:(0,Z.jsx)(HI,{bridge:n,launch:e.launch,adoptPtyId:e.adoptPtyId,onPtyId:t=>P(e.id,t),onTitleChange:t=>V(e.id,t),onClose:()=>W(e.id)})},e.id))}):null,ve;return t[65]!==h||t[66]!==_e?(ve=h==null?null:(0,sd.createPortal)(_e,h),t[65]=h,t[66]=_e,t[67]=ve):ve=t[67],ve}function QI(e){return queueMicrotask(()=>XI(e))}function $I(e,t){return{id:YI(t+1),launch:null,title:null,adoptPtyId:e.ptyId}}function eL(){}function tL(){if(typeof document>`u`)return null;let e=document.createElement(`div`);return e.className=`flex min-h-0 flex-1 flex-col overflow-hidden`,e}function nL(e){let t=(0,$.c)(76),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{onOpenSearch:r}=n,[i,a]=Fy(),[o,s]=(0,Q.useState)(i),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(`auth`),[f,p]=(0,Q.useState)(_x[0].id),[m,h]=(0,Q.useState)(!1),g=typeof window<`u`?window.okDesktop??null:null,_=g!=null&&g.terminal!=null,[v,y]=(0,Q.useState)(!1),b=Iy(),[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)(tb),A;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(e){k(e),eb(e),y(!0)},t[2]=A):A=t[2];let j=A,M;t[3]===O?M=t[4]:(M=function(){j(O===`right`?`bottom`:`right`)},t[3]=O,t[4]=M);let N=M,P;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(P={container:null,isShowing:!1,dockPosition:`bottom`,editorRegion:null},t[5]=P):P=t[5];let[F,I]=(0,Q.useState)(P),L=(0,Q.useRef)(0),R;t[6]===b?R=t[7]:(R=function(e){let t=e??Yy(Ky(),b);y(!0),L.current+=1,D({prompt:null,cli:t,nonce:L.current})},t[6]=b,t[7]=R);let z=R,B;t[8]!==x||t[9]!==z||t[10]!==v?(B=function(){if(v){y(!1);return}y(!0),uv(),x||z()},t[8]=x,t[9]=z,t[10]=v,t[11]=B):B=t[11];let V=B,H=Hi(),{projectConfig:U,projectLocalConfig:W,projectLocalSynced:G,projectSynced:K}=Ko(),{activeDocName:ee}=ft(),te=H?.hasRemote,q=H?.pushPermission?.checkStatus,J;t[12]!==m||t[13]!==U||t[14]!==W||t[15]!==G||t[16]!==K||t[17]!==te||t[18]!==q?(J=ib({autoSyncOnboardingDismissed:m,hasRemote:te,projectLocalSynced:G,projectSynced:K,projectLocalConfig:W,projectConfig:U,pushPermissionCheckStatus:q}),t[12]=m,t[13]=U,t[14]=W,t[15]=G,t[16]=K,t[17]=te,t[18]=q,t[19]=J):J=t[19];let ne=J,re,ie;t[20]===ee?(re=t[21],ie=t[22]):(re=()=>{let e=function(e){let t=e.detail;t&&ee&&Yl(ee,{kind:`raw-mdx`,detail:t}),s(`source`)};return window.addEventListener(Dy,e),()=>window.removeEventListener(Dy,e)},ie=[ee],t[20]=ee,t[21]=re,t[22]=ie),(0,Q.useEffect)(re,ie);let ae,oe;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(ae=()=>{let e=window.okDesktop;if(e!=null)return e.onMenuAction(e=>{e===`toggle-terminal`?y(aL):e===`new-terminal`&&y(!0)})},oe=[],t[23]=ae,t[24]=oe):(ae=t[23],oe=t[24]),(0,Q.useEffect)(ae,oe);let se,ce;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(se=()=>{if(window.okDesktop!=null)return;let e=function(e){wl(e,`toggle-terminal-panel`)&&(e.preventDefault(),y(iL))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},ce=[],t[25]=se,t[26]=ce):(se=t[25],ce=t[26]),(0,Q.useEffect)(se,ce);let le,ue;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(le=()=>FI((e,t)=>{y(!0),uv(),L.current+=1,D({prompt:e,cli:t,nonce:L.current})}),ue=[],t[27]=le,t[28]=ue):(le=t[27],ue=t[28]),(0,Q.useEffect)(le,ue);let de,fe;t[29]===v?(de=t[30],fe=t[31]):(de=()=>{v||D(null)},fe=[v],t[29]=v,t[30]=de,t[31]=fe),(0,Q.useEffect)(de,fe);let pe,me;t[32]!==C||t[33]!==v?(pe=()=>{window.okDesktop!=null&&C&&window.okDesktop.editor.notifyViewMenuStateChanged({terminalVisible:v})},me=[v,C],t[32]=C,t[33]=v,t[34]=pe,t[35]=me):(pe=t[34],me=t[35]),(0,Q.useEffect)(pe,me);let he,ge;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(he=()=>{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(rL).finally(()=>{t||w(!0)}),()=>{t=!0}},ge=[],t[36]=he,t[37]=ge):(he=t[36],ge=t[37]),(0,Q.useEffect)(he,ge);let _e,ve;t[38]===v?(_e=t[39],ve=t[40]):(_e=()=>{if(window.okDesktop!=null){if(T.current){T.current=!1;return}v&&Sa()}},ve=[v],t[38]=v,t[39]=_e,t[40]=ve),(0,Q.useEffect)(_e,ve),Ry(H?.pausedReason);let ye;t[41]===a?ye=t[42]:(ye=function(e){s(e),a(e)},t[41]=a,t[42]=ye);let be=ye,xe,Se;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(xe=()=>{d(`auth`),l(!0)},Se=()=>{d(`identity`),l(!0)},t[43]=xe,t[44]=Se):(xe=t[43],Se=t[44]);let Ce;t[45]!==V||t[46]!==r||t[47]!==v?(Ce=(0,Z.jsx)(MI,{onSignIn:xe,onSetIdentity:Se,onOpenSearch:r,terminalAvailable:_,terminalVisible:v,onToggleChat:V}),t[45]=V,t[46]=r,t[47]=v,t[48]=Ce):Ce=t[48];let we;t[49]!==f||t[50]!==o||t[51]!==be||t[52]!==O||t[53]!==v?(we=(0,Z.jsx)(bP,{editorMode:o,onModeChange:be,activeTab:f,onActiveTabChange:p,terminalBridge:g,terminalVisible:v,onTerminalVisibleChange:y,terminalDock:O,onTerminalPlacement:I}),t[49]=f,t[50]=o,t[51]=be,t[52]=O,t[53]=v,t[54]=we):we=t[54];let Te;t[55]!==b||t[56]!==O||t[57]!==E||t[58]!==F||t[59]!==v||t[60]!==N?(Te=_&&g!=null?(0,Z.jsx)(ZI,{bridge:g,visible:v,onVisibleChange:y,launch:E,installedClis:b,container:F.container,isShowing:F.isShowing,onRequestEditorFocus:()=>F.editorRegion?.focus(),dockPosition:O,onToggleDock:N,onHasSessionsChange:S}):null,t[55]=b,t[56]=O,t[57]=E,t[58]=F,t[59]=v,t[60]=N,t[61]=Te):Te=t[61];let Ee=u===`identity`,De;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(De=()=>{l(!1)},t[62]=De):De=t[62];let Oe;t[63]!==c||t[64]!==Ee?(Oe=(0,Z.jsx)(oa,{open:c,onOpenChange:l,identityPrompt:Ee,onSuccess:De}),t[63]=c,t[64]=Ee,t[65]=Oe):Oe=t[65];let ke;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(ke=()=>h(!0),t[66]=ke):ke=t[66];let Ae;t[67]===ne?Ae=t[68]:(Ae=(0,Z.jsx)(nb,{open:ne,onResolved:ke}),t[67]=ne,t[68]=Ae);let je;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(je=(0,Z.jsx)(wy,{}),t[69]=je):je=t[69];let Me;return t[70]!==Ce||t[71]!==we||t[72]!==Te||t[73]!==Oe||t[74]!==Ae?(Me=(0,Z.jsxs)(Z.Fragment,{children:[Ce,we,Te,Oe,Ae,je]}),t[70]=Ce,t[71]=we,t[72]=Te,t[73]=Oe,t[74]=Ae,t[75]=Me):Me=t[75],Me}function rL(e){console.error(`[terminal] dock-state restore failed; staying hidden:`,e)}function iL(e){return!e}function aL(e){return!e}function oL(e){let t=Kc(ml(e));typeof window>`u`||window.location.hash!==t&&(window.location.hash=t)}function sL(){let e=(0,$.c)(11),{conflicts:t,loading:n,error:r}=Wi();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)(oo,{"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)(oo,{"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(cL),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 cL(e){return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(Ci,{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:()=>oL(e.file),children:[(0,Z.jsx)(oo,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:e.file})]})},e.file)}var lL=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
31
+ `,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;jl(t,{style:t=>Gl(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 qj.set(t.changes,i),i}function Xj(e,t){let{state:n}=e,r=t??n.selection.main.head,i=e.state.field(nj).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(Kj);i.fromB!=i.toB&&i.toA<=o.length&&(a+=e.state.lineBreak);let s=Ol.of({from:i.fromA,to:Math.min(o.length,i.toA),insert:a},o.length);return e.dispatch({effects:Gj.of({doc:s.apply(o),changes:s}),userEvent:`accept`}),!0}function Zj(e,t){let{state:n}=e,r=t??n.selection.main.head,i=n.field(nj).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=n.field(Kj).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 Qj(e){let t=new Pl;for(let n of e.field(nj)){let r=e.facet($A).overrideChunk&&tM(e,n);t.add(n.fromB,n.fromB,Yj(e,n,!!r))}return t.finish()}var $j=Al.define({create:e=>Qj(e),update(e,t){return t.state.field(nj,!1)==t.startState.field(nj,!1)?e:Qj(t.state)},provide:e=>zl.decorations.from(e)}),eM=new WeakMap;function tM(e,t){let n=eM.get(t);if(n!==void 0)return n;n=null;let r=e.field(Kj),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(Nl.widget({widget:new nM(t),side:-1}).range(s+n.fromB))}n.fromB<n.toB&&e.push(vj.range(s+n.fromB,s+n.toB))}i<t.endA-t.fromA-a*2&&(n=e)}return eM.set(t,n),n}var nM=class extends El{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}},rM=new class extends Bl{constructor(){super(...arguments),this.elementClass=`cm-inlineChangedLineGutter`}},iM=Nl.line({class:`cm-inlineChangedLine`});function aM(e,t,n,r){let i=tM(e,t),a=0;if(!i)return!1;for(let o=e.doc.lineAt(t.fromB);;){for(r&&r.add(o.from,o.from,rM),n.add(o.from,o.from,iM);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 oM=ae({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),sM=E({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),cM=zl.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 lM({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 uM(e){let t=(0,$.c)(32),{oldContent:n,newContent:r,layout:i,conflictMode:a,previewMode:o,oursOverride:s,onResolve:c,onAbort:l}=e,{_:u}=rn(),d=s??r,f=(0,Q.useRef)(null),p=(0,Q.useRef)(null),m=(0,Q.useRef)(0),{resolvedTheme:h}=Yn(),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;t[1]!==l||t[2]!==c?(C=()=>{g.current=c,_.current=l},t[1]=l,t[2]=c,t[3]=C):C=t[3],(0,Q.useEffect)(C);let w,T;t[4]!==a||t[5]!==d||t[6]!==i||t[7]!==n||t[8]!==o||t[9]!==h?(w=()=>{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`?oM:sM,u=[zl.editable.of(!1),kl.readOnly.of(!0)],g=[iu,Kl(),...u,l,zl.lineWrapping];if(p.current&&=(p.current.destroy(),null),o)p.current=new zl({doc:d,extensions:g,parent:e}),y(null);else if(a){let i=lM({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 zl({doc:d,extensions:[iu,Kl(),zl.editable.of(!1),l,cM,zl.lineWrapping,Wj({original:n,highlightChanges:!0,gutter:!0,mergeControls:i,collapseUnchanged:{margin:3,minSize:4}}),zl.updateListener.of(e=>{let t=rj(e.state);y(t?t.chunks.length:0)})],parent:e});p.current=a;let o=rj(a.state);y(o?o.chunks.length:0)}else i===`split`?p.current=new Bj({a:{doc:n,extensions:g},b:{doc:d,extensions:g},parent:e,highlightChanges:!0,gutter:!0,collapseUnchanged:{margin:3,minSize:4}}):p.current=new zl({doc:d,extensions:[...g,Wj({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)}},T=[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]=w,t[11]=T):(w=t[10],T=t[11]),(0,Q.useEffect)(w,T);let E;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(E=function(){let e=p.current;!e||!(e instanceof zl)||g.current?.(e.state.doc.toString())},t[12]=E):E=t[12];let D=E,O;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(O=function(){let e=p.current;!e||!(e instanceof zl)||U(e)},t[13]=O):O=t[13];let k=O,A=v===0,j;t[14]!==u||t[15]!==v?(j=v===null?``:v===0?u({id:`lPzyrU`}):As._({id:`8FqTCr`,values:{chunksRemaining:v}}),t[14]=u,t[15]=v,t[16]=j):j=t[16];let M=j,N;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsx)(`div`,{ref:f,className:`diff-view min-h-0 flex-1 overflow-y-auto subtle-scrollbar`}),t[17]=N):N=t[17];let P;if(t[18]!==u||t[19]!==x){let e;t[21]===u?e=t[22]:(e=e=>(0,sd.createPortal)((0,Z.jsx)(Ci,{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),P=x.map(e),t[18]=u,t[19]=x,t[20]=P}else P=t[20];let F;t[23]!==A||t[24]!==a||t[25]!==M||t[26]!==l||t[27]!==c?(F=a&&(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-3 py-2 border-t shrink-0`,children:[(0,Z.jsx)(`span`,{className:`text-xs ${A?`text-emerald-600 dark:text-emerald-400`:`text-muted-foreground`}`,children:M}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[l&&(0,Z.jsx)(Ci,{className:`uppercase font-mono`,variant:`ghost`,size:`sm`,onClick:l,children:(0,Z.jsx)(Y,{id:`XyOUTJ`})}),(0,Z.jsx)(Ci,{className:`uppercase font-mono`,variant:`outline`,size:`sm`,onClick:k,children:`Undo`}),c&&(0,Z.jsx)(Ci,{variant:`default`,size:`sm`,disabled:!A,onClick:D,children:(0,Z.jsx)(Y,{id:`Lcehxn`})})]})]}),t[23]=A,t[24]=a,t[25]=M,t[26]=l,t[27]=c,t[28]=F):F=t[28];let I;return t[29]!==F||t[30]!==P?(I=(0,Z.jsxs)(`div`,{className:`flex flex-col h-full`,children:[N,P,F]}),t[29]=F,t[30]=P,t[31]=I):I=t[31],I}async function dM(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 fM(e,t){return dM(e,`content`,t)}async function pM(e){return dM(e,`mine`)}async function mM(e){return dM(e,`theirs`)}async function hM(e){return dM(e,`delete`)}async function gM(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 _M(e){let t=(0,$.c)(84),{docName:n}=e,{_:r}=rn(),{conflicts:i,loading:a}=Wi(),o;if(t[0]!==i||t[1]!==n){let e;t[3]===n?e=t[4]:(e=e=>ml(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,g;t[5]===n?(h=t[6],g=t[7]):(h=()=>(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}))}),g=[n],t[5]=n,t[6]=h,t[7]=g),(0,Q.useEffect)(h,g);let _=a||s===void 0,v,y;t[8]!==_||t[9]!==c?(v=()=>{if(_)return;let e=!1;return u(null),f(!1),gM(c).then(t=>{e||(t===null?f(!0):u(t))}),()=>{e=!0}},y=[c,_],t[8]=_,t[9]=c,t[10]=v,t[11]=y):(v=t[10],y=t[11]),(0,Q.useEffect)(v,y);let b;t[12]!==r||t[13]!==c?(b=async function(e){let t=await fM(c,e);t.ok||bs.error(r({id:`K-h9cT`,values:{filePath:c}}),{description:t.detail})},t[12]=r,t[13]=c,t[14]=b):b=t[14];let x=b,S;t[15]!==r||t[16]!==c?(S=async function(e){m(!0);let t=await e(c);t.ok||(m(!1),bs.error(r({id:`jPUPvG`,values:{filePath:c}}),{description:t.detail}))},t[15]=r,t[16]=c,t[17]=S):S=t[17];let C=S;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)(Y,{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)(Y,{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)(uM,{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)(Y,{id:`V48OUT`,values:n,components:r})}),t[27]=n,t[28]=i);let a;t[29]===C?a=t[30]:(a=()=>void C(hM),t[29]=C,t[30]=a);let o;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(Y,{id:`Vlc75q`}),t[31]=o):o=t[31];let s;t[32]!==p||t[33]!==a?(s=(0,Z.jsx)(Ci,{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]===C?u=t[36]:(u=()=>void C(mM),t[35]=C,t[36]=u);let d;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Y,{id:`3mFsc3`}),t[37]=d):d=t[37];let f;t[38]!==p||t[39]!==u?(f=(0,Z.jsx)(Ci,{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 h;t[44]!==i||t[45]!==m?(h=(0,Z.jsxs)(`div`,{className:`flex flex-shrink-0 flex-wrap items-center justify-between gap-x-6 gap-y-3 border-t px-6 py-4`,children:[i,m]}),t[44]=i,t[45]=m,t[46]=h):h=t[46];let g;return t[47]!==h||t[48]!==e?(g=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[e,h]}),t[47]=h,t[48]=e,t[49]=g):g=t[49],g}if(l.kind===`modify-delete`){let e;t[50]===l.ours?e=t[51]:(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(uM,{oldContent:``,newContent:l.ours,layout:`unified`,previewMode:!0})}),t[50]=l.ours,t[51]=e);let n;t[52]===c?n=t[53]:(n={filePath:c},t[52]=c,t[53]=n);let r;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(r={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[54]=r):r=t[54];let i;t[55]===n?i=t[56]:(i=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`EhDLBx`,values:n,components:r})}),t[55]=n,t[56]=i);let a;t[57]===C?a=t[58]:(a=()=>void C(pM),t[57]=C,t[58]=a);let o;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(Y,{id:`0NA4b3`}),t[59]=o):o=t[59];let s;t[60]!==p||t[61]!==a?(s=(0,Z.jsx)(Ci,{type:`button`,variant:`default`,disabled:p,onClick:a,children:o}),t[60]=p,t[61]=a,t[62]=s):s=t[62];let u;t[63]===C?u=t[64]:(u=()=>void C(hM),t[63]=C,t[64]=u);let d;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Y,{id:`qSxaOz`}),t[65]=d):d=t[65];let f;t[66]!==p||t[67]!==u?(f=(0,Z.jsx)(Ci,{type:`button`,variant:`destructive`,disabled:p,onClick:u,children:d}),t[66]=p,t[67]=u,t[68]=f):f=t[68];let m;t[69]!==s||t[70]!==f?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-3`,children:[s,f]}),t[69]=s,t[70]=f,t[71]=m):m=t[71];let h;t[72]!==i||t[73]!==m?(h=(0,Z.jsxs)(`div`,{className:`flex flex-shrink-0 flex-wrap items-center justify-between gap-x-6 gap-y-3 border-t px-6 py-4`,children:[i,m]}),t[72]=i,t[73]=m,t[74]=h):h=t[74];let g;return t[75]!==h||t[76]!==e?(g=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[e,h]}),t[75]=h,t[76]=e,t[77]=g):g=t[77],g}let w;t[78]===x?w=t[79]:(w=e=>void x(e),t[78]=x,t[79]=w);let T;return t[80]!==l.ours||t[81]!==l.theirs||t[82]!==w?(T=(0,Z.jsx)(uM,{oldContent:l.theirs,newContent:l.ours,layout:`unified`,conflictMode:!0,onResolve:w}),t[80]=l.ours,t[81]=l.theirs,t[82]=w,t[83]=T):T=t[83],T}function vM(e){let t=(0,$.c)(2),{docName:n,provider:r,children:i}=e;(0,Q.use)(Rt(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 yM=`__back-nav__`;function bM(e){return e instanceof Oe||e instanceof ht||e instanceof xe||e instanceof Ze||e instanceof At||e instanceof A?e.docName:null}function xM(e){if(e instanceof Oe){let t=e.docName;return{title:As._({id:`Jejur6`}),summary:As._({id:`jSY41h`,values:{docName:t}})}}if(e instanceof ht){let t=e.docName;return{title:As._({id:`V7QxyT`}),summary:As._({id:`xG4tb6`,values:{docName:t}})}}if(e instanceof xe){let t=e.docName;return{title:As._({id:`1di5fu`}),summary:As._({id:`PQCdtv`,values:{docName:t}})}}if(e instanceof Ze){let t=e.docName;return{title:As._({id:`wvbc1r`}),summary:As._({id:`IX7-sq`,values:{docName:t}})}}if(e instanceof At)return{title:As._({id:`Gfr4fu`}),summary:As._({id:`UW2Fg3`})};if(e instanceof A){let t=e.docName;return{title:As._({id:`vv7kpg`}),summary:As._({id:`mdKFEy`,values:{docName:t}})}}let t=e instanceof Error&&e.message?e.message:As._({id:`W5A0Ly`});return{title:As._({id:`29VNqC`}),summary:t}}function SM(e){let t=(0,$.c)(28),{error:n,resetErrorBoundary:r,activeDocName:i,previousDocName:a,onNavigateBack:o}=e,s;t[0]===n?s=t[1]:(s=xM(n),t[0]=n,t[1]=s);let{title:c,summary:l}=s,u=!!a&&!!o,d=(0,Q.useRef)(null),f,p;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=()=>{d.current?.focus()},p=[],t[2]=f,t[3]=p):(f=t[2],p=t[3]),(0,Q.useEffect)(f,p);let m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(Yw,{size:80,variant:`sleeping`}),t[4]=m):m=t[4];let h;t[5]===c?h=t[6]:(h=(0,Z.jsx)(`h2`,{id:`document-error-title`,className:`text-2xl font-light tracking-tighter text-balance`,children:c}),t[5]=c,t[6]=h);let g;t[7]===l?g=t[8]:(g=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-muted-foreground`,children:l}),t[7]=l,t[8]=g);let _;t[9]!==h||t[10]!==g?(_=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[h,g]}),t[9]=h,t[10]=g,t[11]=_):_=t[11];let v;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(Y,{id:`KDw4GX`}),t[12]=v):v=t[12];let y;t[13]===r?y=t[14]:(y=(0,Z.jsx)(Ci,{ref:d,variant:`default`,onClick:r,children:v}),t[13]=r,t[14]=y);let b;t[15]!==i||t[16]!==u||t[17]!==n||t[18]!==o||t[19]!==a||t[20]!==r?(b=u?(0,Z.jsx)(Ci,{variant:`ghost`,className:`font-mono uppercase`,onClick:()=>{!a||!o||(it(bM(n)??i),o(a),r(yM))},children:(0,Z.jsx)(Y,{id:`CKyk7Q`})}):null,t[15]=i,t[16]=u,t[17]=n,t[18]=o,t[19]=a,t[20]=r,t[21]=b):b=t[21];let x;t[22]!==b||t[23]!==y?(x=(0,Z.jsxs)(`div`,{className:`mt-1 flex gap-2`,children:[y,b]}),t[22]=b,t[23]=y,t[24]=x):x=t[24];let S;return t[25]!==x||t[26]!==_?(S=(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:[m,_,x]}),t[25]=x,t[26]=_,t[27]=S):S=t[27],S}function CM(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)(SM,{...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]===yM){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}: ${xM(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)(h,{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 wM(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=$r(t);return{map:n,keys:Br(t),parseError:r}}function TM(e){let t=(0,$.c)(21),{provider:n}=e,r;t[0]===n?r=t[1]:(r=()=>wM(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=Jn(n);a(e.current());let t=e.subscribe(e=>{a(e)});return()=>{t(),e.dispose()}},s=[n],t[2]=n,t[3]=o,t[4]=s),(0,Q.useEffect)(o,s);let c;t[5]===i.map.icon?c=t[6]:(c=qe(i.map.icon),t[5]=i.map.icon,t[6]=c);let l=c,u;t[7]===i.map.cover?u=t[8]:(u=ct(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)(EM,{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)(DM,{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 EM(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 DM(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 OM=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{ManagedArtifactProperties:e}=await import(`./ManagedArtifactProperties-CYtk8Bqt.js`);return{ManagedArtifactProperties:e}},__vite__mapDeps([74,1,49,2,50,51,31,52,53,54,55,56,57,58,59,20,9,10,7,11,30,3,32,6,4,15,12,13,22,14,60,16,43,44,45,61,62,23,63,69,70,21,75,8,76,77,47,24]),import.meta.url)).ManagedArtifactProperties})),kM=vl(`LARGE_DOC_CHAR_THRESHOLD`,5e5);function AM(e){let t=e.threshold??kM;return e.ytextLength>t?{renderSource:e.isSourceMode||e.visitedSource,renderVisual:!e.isSourceMode||e.visitedVisual,isLarge:!0}:{renderSource:!0,renderVisual:!0,isLarge:!1}}function jM(e){return e.hasEmittedFirstToggle||!e.isLarge?!1:e.renderSource&&e.renderVisual}var MM=vl(`ACTIVITY_MOUNT_LIMIT`,3);function NM(){return n(()=>import(`./SourceEditor-Cd7sWXXb.js`),__vite__mapDeps([78,1,49,2,50,51,31,52,53,54,55,56,57,58,59,20,9,10,7,11,30,3,32,6,4,15,12,13,22,14,60,16,43,44,45,61,62,23,63,79,34,77,73]),import.meta.url)}var PM=(0,Q.lazy)(async()=>({default:(await NM()).SourceEditor}));function FM(e,t,n){if(n<=0)return[];let r=e.filter(e=>!ze(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 IM(e,t){return t.kind===`idle`?null:t.kind===`failed`&&t.failedDocNames.includes(e)?{kind:`failed`,title:As._({id:`MTs6g3`}),summary:t.reason===`clear-data-timeout`?As._({id:`Sc1bKE`,values:{docName:e}}):As._({id:`ovIGrT`,values:{docName:e}}),actionLabel:As._({id:`HpK_8d`})}:t.kind===`recovering`&&t.docNames.includes(e)?{kind:`recovering`,title:As._({id:`cF9DyA`}),summary:t.phase===`clearing-local-cache`?As._({id:`bmC18N`,values:{docName:e}}):As._({id:`pAgkuZ`,values:{docName:e}})}:null}function LM(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(_l,{name:`activity-pool`,children:(0,Z.jsx)(RM,{...e})}),t[0]=e,t[1]=n),n}function RM(e){let t=(0,$.c)(15),{activeDocName:n,isSourceMode:r,editorPlaceholder:i,previousDocName:a,onNavigateBack:o,onRecycle:s}=e,{poolEntries:c,serverRestartRecovery:l}=ft(),{pages:u,loading:d}=so(),f=FM(c,n,MM),p=(0,Q.useRef)(``),m=f.map(zM).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;se(e,t&&t.length>0?t:crypto.randomUUID())}gl(`ok/activity/mount-list-change`,{active:n,mounted:t,evicted:r}),p.current=m,S(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)(GM,{entry:e,isActive:e.docName===n,isSourceMode:r,editorPlaceholder:i,isNewDoc:!d&&!u.has(e.docName)&&!vr(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 zM(e){return e.docName}function BM(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&&gl(`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&&(gl(`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&&gl(`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 VM(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)(MC,{}),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)(PM,{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 HM(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)(fo,{className:`size-5`,"aria-hidden":`true`}):(0,Z.jsx)(Vo,{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)(Ci,{type:`button`,onClick:UM,children:[(0,Z.jsx)(fo,{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 UM(){return window.location.reload()}function WM(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 GM(e){let t=(0,$.c)(53),{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a,isNewDoc:o,previousDocName:s,onNavigateBack:c,onRecycle:l,serverRestartRecovery:u}=e,d;t[0]!==n.docName||t[1]!==u?(d=IM(n.docName,u),t[0]=n.docName,t[1]=u,t[2]=d):d=t[2];let f=d,p=VE(n.docName)===`conflict`,m;t[3]===n.docName?m=t[4]:(m=()=>{let e=document.createElement(`div`);return e.setAttribute(`data-ok-editor-portal`,n.docName),e.style.display=`contents`,e},t[3]=n.docName,t[4]=m);let[h]=(0,Q.useState)(m),g=n.provider.document.getText(`source`).length,[_,v]=(0,Q.useState)(i),[y,x]=(0,Q.useState)(!i),S,C;t[5]!==i||t[6]!==_||t[7]!==y?(S=()=>{i&&!_?v(!0):!i&&!y&&x(!0)},C=[i,_,y],t[5]=i,t[6]=_,t[7]=y,t[8]=S,t[9]=C):(S=t[8],C=t[9]),(0,Q.useEffect)(S,C);let w=AM({ytextLength:g,isSourceMode:i,visitedSource:_,visitedVisual:y}),T=(0,Q.useRef)(``),E=`${w.isLarge}-${w.renderSource}-${w.renderVisual}`,D,k;t[10]!==n.docName||t[11]!==w.isLarge||t[12]!==w.renderSource||t[13]!==w.renderVisual||t[14]!==E||t[15]!==i||t[16]!==g?(D=()=>{T.current!==E&&(T.current=E,w.isLarge&&gl(`ok/activity/defer-mount`,{docName:n.docName,ytextLength:g,isSourceMode:i,renderSource:w.renderSource,renderVisual:w.renderVisual}))},k=[E,w.isLarge,w.renderSource,w.renderVisual,n.docName,g,i],t[10]=n.docName,t[11]=w.isLarge,t[12]=w.renderSource,t[13]=w.renderVisual,t[14]=E,t[15]=i,t[16]=g,t[17]=D,t[18]=k):(D=t[17],k=t[18]),(0,Q.useEffect)(D,k);let A;t[19]===n.docName?A=t[20]:(A=()=>H(n.docName),t[19]=n.docName,t[20]=A);let[j]=(0,Q.useState)(A),M=j?.html??null,[N,P]=(0,Q.useState)(!1),F,I;t[21]!==n.docName||t[22]!==w.isLarge||t[23]!==w.renderSource||t[24]!==w.renderVisual||t[25]!==N||t[26]!==i||t[27]!==g?(F=()=>{jM({isLarge:w.isLarge,renderSource:w.renderSource,renderVisual:w.renderVisual,hasEmittedFirstToggle:N})&&(gl(`ok/cold/first-toggle`,{docName:n.docName,mountId:O(n.docName),ytextLength:g,modeEnteredFirst:i?`source`:`visual`}),P(!0))},I=[N,w.isLarge,w.renderSource,w.renderVisual,n.docName,g,i],t[21]=n.docName,t[22]=w.isLarge,t[23]=w.renderSource,t[24]=w.renderVisual,t[25]=N,t[26]=i,t[27]=g,t[28]=F,t[29]=I):(F=t[28],I=t[29]),(0,Q.useEffect)(F,I);let L=r?`visible`:`hidden`,R=`editor:${n.docName}`,z=j?.scrollTop,B;t[30]!==a||t[31]!==n||t[32]!==w.renderSource||t[33]!==w.renderVisual||t[34]!==r||t[35]!==p||t[36]!==o||t[37]!==i||t[38]!==c||t[39]!==l||t[40]!==h||t[41]!==s||t[42]!==f||t[43]!==M?(B=f?(0,Z.jsx)(HM,{view:f}):(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsx)(CM,{activeDocName:n.docName,previousDocName:s,onNavigateBack:c,onRecycle:l,children:(0,Z.jsx)(Q.Suspense,{fallback:M?(0,Z.jsx)(WM,{html:M}):(0,Z.jsx)(MC,{}),children:(0,Z.jsx)(vM,{docName:n.docName,provider:n.provider,children:p?(0,Z.jsx)(_M,{docName:n.docName,provider:n.provider}):(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[!i&&(vr(n.docName)||b(n.docName)?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(OM,{docName:n.docName,provider:n.provider})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(TM,{provider:n.provider}),(0,Z.jsx)(qa,{provider:n.provider})]})),(0,Z.jsxs)(`div`,{className:`relative flex-1`,children:[w.renderSource?(0,Z.jsx)(`div`,{className:i?`h-full`:`ok-mode-hidden h-full`,children:(0,Z.jsx)(VM,{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a})}):null,w.renderVisual?(0,Z.jsx)(`div`,{className:i?`ok-mode-hidden h-full`:`h-full`,children:(0,Z.jsx)(hA,{provider:n.provider,placeholder:a,isSourceMode:i,portalTarget:h},`${n.docName}-${String(o)}-${n.poolEventId}`)}):null]})]})})})})}),t[30]=a,t[31]=n,t[32]=w.renderSource,t[33]=w.renderVisual,t[34]=r,t[35]=p,t[36]=o,t[37]=i,t[38]=c,t[39]=l,t[40]=h,t[41]=s,t[42]=f,t[43]=M,t[44]=B):B=t[44];let V;t[45]!==r||t[46]!==z||t[47]!==B?(V=(0,Z.jsx)(BM,{isActive:r,initialScrollTop:z,children:B}),t[45]=r,t[46]=z,t[47]=B,t[48]=V):V=t[48];let U;return t[49]!==L||t[50]!==R||t[51]!==V?(U=(0,Z.jsx)(Q.Activity,{mode:L,name:R,children:V}),t[49]=L,t[50]=R,t[51]=V,t[52]=U):U=t[52],U}function KM(e){let t=e.endsWith(`rem`)?`rem`:`px`;return{value:Number.parseFloat(e),unit:t}}function qM(e){let{value:t,unit:n}=KM(e);return n===`rem`?t*16:t}function JM(e,t){return`${t===`rem`?e.toFixed(1):Math.round(e)}${t}`}var YM=3600*24*7;function XM(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?ZM:m,O=g===void 0?YM:g,k=_===void 0?!1:_,A=(0,Q.useRef)(null),j=(0,Q.useRef)(0),M=(0,Q.useRef)(0),N=(0,Q.useRef)(!1),P=(0,Q.useRef)(!1),F=(0,Q.useRef)(null),I=(0,Q.useRef)(0),L=(0,Q.useRef)(!1),R=(0,Q.useRef)(0),z=(0,Q.useRef)(0),B=(0,Q.useRef)(null),V=(0,Q.useRef)(r),H=(0,Q.useRef)(y),U,W;t[0]===r?(U=t[1],W=t[2]):(U=()=>{V.current=r},W=[r],t[0]=r,t[1]=U,t[2]=W),(0,Q.useEffect)(U,W);let G,K;t[3]===y?(G=t[4],K=t[5]):(G=()=>{H.current=y},K=[y],t[3]=y,t[4]=G,t[5]=K),(0,Q.useEffect)(G,K);let ee=qM(b),te;t[6]===x?te=t[7]:(te=qM(x),t[6]=x,t[7]=te);let q=te,J;t[8]!==E||t[9]!==k?(J=function(e){E&&(P.current=!0,j.current=H.current?0:qM(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]=J):J=t[10];let ne=J,re,ie;t[11]!==w||t[12]!==v||t[13]!==C||t[14]!==S||t[15]!==T||t[16]!==k||t[17]!==q||t[18]!==ee||t[19]!==i||t[20]!==a||t[21]!==D||t[22]!==O||t[23]!==h?(re=()=>{let e=function(e){h&&(document.cookie=`${h}=${e}; path=/; max-age=${O}`)},t=function(e,t){return v===`left`?e<t:e>t},n=function(e,t,n,r){if(k&&r){let r=e.clientX-t;return v===`left`?n-r:n+r}return v===`left`?window.innerWidth-e.clientX:e.clientX},r=function(r){if(!P.current)return;let o=Math.abs(r.clientX-M.current);if(!N.current&&o>5&&(N.current=!0,D(!0)),N.current){let{unit:o}=KM(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<=ee*w;else if(e<=ee){let n=ee*(w-1);t=ee-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>ee*T){a();let t=n(r,M.current,j.current,s),c=Math.max(ee,Math.min(q,t)),u=JM(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(ee,Math.min(q,u)),f=JM(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)}},ie=[i,a,D,ee,q,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]=q,t[18]=ee,t[19]=i,t[20]=a,t[21]=D,t[22]=O,t[23]=h,t[24]=re,t[25]=ie):(re=t[24],ie=t[25]),(0,Q.useEffect)(re,ie);let ae;return t[26]===ne?ae=t[27]:(ae={dragRef:A,isDragging:N,handleMouseDown:ne},t[26]=ne,t[27]=ae),ae}function ZM(){}var QM=3600*24*7,$M=`18rem`,eN=`3rem`,tN=`app-file-sidebar`,nN=`14.625rem`,rN=`32rem`,iN=`sidebar_width`,aN=/^\d+(?:\.\d+)?(?:rem|px)$/,oN=Q.createContext(null);function sN(e){if(typeof document>`u`)return e;let t=document.cookie.split(`; `).find(e=>e.startsWith(`${iN}=`))?.split(`=`)[1];if(!t)return e;let n;try{n=decodeURIComponent(t)}catch{return e}return aN.test(n)?n:e}function cN(){let e=Q.use(oN);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function lN(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?$M:c,[u]=Q.useState(dN),d;t[8]===u?d=t[9]:(d=()=>ZE(u,window.innerWidth,`left`),t[8]=u,t[9]=d);let[f,p]=Q.useState(d),m;t[10]===l?m=t[11]:(m=()=>sN(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=iD();return oD(`left`,ZE(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),sD(`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(uN)},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: ${JE}px)`),t=()=>{let e=ZE(u,window.innerWidth,`left`);p(e),C(oD(`left`,e,iD())===`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(tN)?.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=>{wl(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":eN,...s},t[45]=s,t[46]=h,t[47]=U):U=t[47];let W=U,G;t[48]===r?G=t[49]:(G=X(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),t[48]=r,t[49]=G);let K;t[50]!==n||t[51]!==a||t[52]!==W||t[53]!==G?(K=(0,Z.jsx)(`div`,{"data-slot":`sidebar-wrapper`,style:W,className:G,...a,children:n}),t[50]=n,t[51]=a,t[52]=W,t[53]=G,t[54]=K):K=t[54];let ee;return t[55]!==H||t[56]!==K?(ee=(0,Z.jsx)(oN.Provider,{value:H,children:K}),t[55]=H,t[56]=K,t[57]=ee):ee=t[57],ee}function uN(e){return!e}function dN(){return Fr()}function fN(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}=rn(),{state:f,isDraggingRail:p}=cN();if(u===`none`){let e;t[7]===r?e=t[8]:(e=X(`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=X(`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=X(`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:tN,"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 pN(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}=rn(),{toggleSidebar:o,state:s}=cN(),c,l,u,d,f,p,m,h;if(t[4]!==a||t[5]!==s){let e=Tl(`toggle-files-sidebar`);c=Ci,l=`trigger`,u=`sidebar-trigger`,d=`ghost`,f=`icon-sm`,p=s===`expanded`,m=tN,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=X(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)(mt,{}):(0,Z.jsx)(Xd,{}),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 mN(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}=rn(),{toggleSidebar:u,setWidth:d,state:f,width:p,setIsDraggingRail:m}=cN(),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:nN,maxResizeWidth:rN,setIsDraggingRail:m,widthCookieName:iN,widthCookieMaxAge:QM},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}=XM(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=X(`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 hN(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}=cN(),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=X(`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 gN(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=X(`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 _N(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=X(`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 vN(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=X(`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 yN(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=X(`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 bN(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?Si:`div`,o;t[4]===n?o=t[5]:(o=X(`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 xN(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?Si:`button`,o;t[4]===n?o=t[5]:(o=X(`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 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=X(`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 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=X(`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 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=X(`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 TN=xi(`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 EN(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?Si:`button`,{state:m}=cN(),h;t[8]!==n||t[9]!==f||t[10]!==d?(h=X(TN({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)(zs,{asChild:!0,children:_}),t[20]=_,t[21]=v);let y=m!==`collapsed`,b;t[22]!==y||t[23]!==c?(b=(0,Z.jsx)(Bs,{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)(Hs,{children:[v,b]}),t[25]=v,t[26]=b,t[27]=x):x=t[27],x}function DN(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?Si:`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=X(`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 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=X(`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 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=X(`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 AN(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?Si:`a`,d;t[6]===n?d=t[7]:(d=X(`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 jN(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 MN(){let e=await fetch(`/api/server-info`,{signal:AbortSignal.timeout(5e3)});if(!e.ok)return null;let t=await e.json(),n=qr.safeParse(t);return n.success?n.data.currentBranch??null:null}var NN=typeof window>`u`?{getSnapshot:()=>null,subscribe:()=>()=>{}}:jN({fetchBranch:MN,subscribeToEvent:Cs}),PN=NN.subscribe,FN=NN.getSnapshot;function IN(){return(0,Q.useSyncExternalStore)(PN,FN,FN)}function LN(){let e=(0,$.c)(6),t=IN(),n=mo(),{state:r}=cN(),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&&Vi(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 RN(e){let t=(0,$.c)(27),{stats:n,selectionStats:r,showStats:i,composerBadge:a}=e,o=i===void 0?!0:i,{_:s}=rn(),c=LN();if(!o&&c===null&&a==null)return null;let l=r??n,u=r!=null,{words:d,chars:f,tokens:p}=l,m;t[0]!==s||t[1]!==u||t[2]!==o?(m=s(o?u?{id:`Bv5a9_`}:{id:`L1ZE3M`}:{id:`goO4Ll`}),t[0]=s,t[1]=u,t[2]=o,t[3]=m):m=t[3];let h;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-full h-2 bg-linear-to-t from-background to-transparent`}),t[4]=h):h=t[4];let g;t[5]!==s||t[6]!==a?(g=a?(0,Z.jsxs)(Ci,{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)(gs,{className:`size-3`,"aria-hidden":!0}),s({id:`xWEvuo`}),(0,Z.jsx)(qt,{className:`size-3`,"aria-hidden":!0})]}):null,t[5]=s,t[6]=a,t[7]=g):g=t[7];let _;t[8]===c?_=t[9]:(_=c===null?null:(0,Z.jsx)(zN,{identity:c}),t[8]=c,t[9]=_);let v;t[10]===_?v=t[11]:(v=(0,Z.jsx)(`span`,{className:`flex min-w-0 items-center gap-3`,children:_}),t[10]=_,t[11]=v);let y;t[12]!==s||t[13]!==l.chars||t[14]!==l.tokens||t[15]!==l.words||t[16]!==f||t[17]!==u||t[18]!==o||t[19]!==p||t[20]!==d?(y=o?(0,Z.jsxs)(`span`,{className:`flex shrink-0 items-center gap-3`,children:[u?(0,Z.jsx)(`span`,{className:`font-medium text-foreground/70`,"data-testid":`editor-footer-selected-label`,children:s({id:`ylXj1N`})}):null,(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:l.words.toLocaleString()}),` `,(0,Z.jsx)(Y,{id:`gljvbT`,values:{words:d}})]}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:l.chars.toLocaleString()}),` `,(0,Z.jsx)(Y,{id:`d5rK4X`,values:{chars:f}})]}),(0,Z.jsxs)(`span`,{children:[l.tokens>0?`~`:``,(0,Z.jsx)(`span`,{className:`tabular-nums`,children:l.tokens.toLocaleString()}),` `,(0,Z.jsx)(Y,{id:`uynXup`,values:{tokens:p}})]})]}):null,t[12]=s,t[13]=l.chars,t[14]=l.tokens,t[15]=l.words,t[16]=f,t[17]=u,t[18]=o,t[19]=p,t[20]=d,t[21]=y):y=t[21];let b;return t[22]!==m||t[23]!==g||t[24]!==v||t[25]!==y?(b=(0,Z.jsxs)(`section`,{"aria-label":m,className:`relative flex h-6 shrink-0 items-center justify-between gap-3 bg-background px-3 text-2xs text-muted-foreground`,children:[h,g,v,y]}),t[22]=m,t[23]=g,t[24]=v,t[25]=y,t[26]=b):b=t[26],b}function zN(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)(Hs,{children:[(0,Z.jsx)(zs,{asChild:!0,children:(0,Z.jsx)(`span`,{tabIndex:0,className:`truncate`,"data-testid":`editor-footer-project-name`,children:r})}),(0,Z.jsx)(Bs,{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)(xt,{"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 BN(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}=rn(),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=X(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 VN(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=X(`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 HN(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=X(`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 UN(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=X(`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 WN(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=X(`[&>svg]:size-3.5`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=n??(0,Z.jsx)(io,{}),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 GN=1,KN=2,qN=4;function JN(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=Qr(n),u=e?e.kind===`template`?e.folder.split(`/`).filter(Boolean):[]:ie(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>qN?[...u.slice(0,GN).map((e,t)=>d(e,t)),{kind:`ellipsis`,hidden:u.slice(GN,-KN)},...u.slice(-KN).map((e,t)=>d(e,u.length-KN+t))]:u.map((e,t)=>d(e,t));a=BN,t[8]===r?c=t[9]:(c=X(`flex min-w-0 items-center`,r),t[8]=r,t[9]=c),i=VN,o=`min-w-0 flex-nowrap gap-1 overflow-hidden text-muted-foreground/70 text-xs`,s=f.map(YN)}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 YN(e,t){let n=e.kind===`segment`?e.key:`ellipsis`;return(0,Z.jsxs)(Q.Fragment,{children:[t>0&&(0,Z.jsx)(WN,{className:`shrink-0 text-muted-foreground/70 [&>svg]:size-3`}),e.kind===`ellipsis`?(0,Z.jsxs)(HN,{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)(bd,{className:`size-3.5`})}),(0,Z.jsx)(`span`,{className:`sr-only`,children:e.hidden.join(` / `)})]}):(0,Z.jsx)(HN,{className:`min-w-0`,children:(0,Z.jsx)(UN,{current:!1,className:`min-w-0 truncate font-normal text-muted-foreground/70`,title:e.value,children:e.value})})]},n)}var XN={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`},ZN=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`,...XN,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},QN=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)(ZN,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i},$N=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)(ZN,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i};function eP(e){let t=(0,$.c)(29),{isSourceMode:n,onModeChange:r,sourceDisabled:i}=e,a=i===void 0?!1:i,{_:o}=rn(),s=n?`source`:`wysiwyg`,c;t[0]===r?c=t[1]:(c=e=>{e&&r(e)},t[0]=r,t[1]=c);let l;t[2]===o?l=t[3]:(l=o({id:`n7aopT`}),t[2]=o,t[3]=l);let u;t[4]===o?u=t[5]:(u=o({id:`ur2XSb`}),t[4]=o,t[5]=u);let d;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(zs,{children:(0,Z.jsx)($N,{className:`size-4`})}),t[6]=d):d=t[6];let f;t[7]===u?f=t[8]:(f=(0,Z.jsx)(Ia,{value:`wysiwyg`,"aria-label":u,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,asChild:!0,children:d}),t[7]=u,t[8]=f);let p;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(Bs,{side:`bottom`,children:(0,Z.jsx)(Y,{id:`Mb_20S`})}),t[9]=p):p=t[9];let m;t[10]===f?m=t[11]:(m=(0,Z.jsxs)(Hs,{children:[f,p]}),t[10]=f,t[11]=m);let h;t[12]===o?h=t[13]:(h=o({id:`xbdtfY`}),t[12]=o,t[13]=h);let g;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(QN,{className:`size-4`}),t[14]=g):g=t[14];let _;t[15]!==a||t[16]!==h?(_=(0,Z.jsx)(zs,{asChild:!0,children:(0,Z.jsx)(`div`,{children:(0,Z.jsx)(Ia,{value:`source`,"aria-label":h,disabled:a,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,children:g})})}),t[15]=a,t[16]=h,t[17]=_):_=t[17];let v;t[18]===a?v=t[19]:(v=(0,Z.jsx)(Bs,{side:`bottom`,children:a?(0,Z.jsx)(Y,{id:`G-JBA1`}):(0,Z.jsx)(Y,{id:`u6Hp4N`})}),t[18]=a,t[19]=v);let y;t[20]!==_||t[21]!==v?(y=(0,Z.jsxs)(Hs,{children:[_,v]}),t[20]=_,t[21]=v,t[22]=y):y=t[22];let b;return t[23]!==y||t[24]!==s||t[25]!==c||t[26]!==l||t[27]!==m?(b=(0,Z.jsxs)(Ra,{type:`single`,value:s,onValueChange:c,"aria-label":l,variant:`segmented`,size:`sm`,spacing:1,className:`shrink-0 bg-muted p-0.5 data-[size=sm]:rounded-[10px]`,children:[m,y]}),t[23]=y,t[24]=s,t[25]=c,t[26]=l,t[27]=m,t[28]=b):b=t[28],b}var tP=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{SkillEditorActions:e}=await import(`./SkillEditorActions-SkSo8rGK.js`);return{SkillEditorActions:e}},__vite__mapDeps([80,1,30,3,7,31,6,10,70,20,9,11,32,12,13,21,16,60,72,18,61,65,23]),import.meta.url)).SkillEditorActions}));function nP(e){let t=(0,$.c)(79),{activeDocName:n,isSourceMode:r,sourceDisabled:i,onModeChange:a,showAddPropertyButton:o,onAddProperty:s,isPanelCollapsed:c,onTogglePanel:l}=e,{_:u}=rn(),d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=Cl(`toggle-document-panel`),t[0]=d):d=t[0];let f=d,p,m,h,g,_,v,y,x,S,C,w,T,E,D,O;if(t[1]!==u||t[2]!==n||t[3]!==c||t[4]!==r||t[5]!==s||t[6]!==a||t[7]!==l||t[8]!==o||t[9]!==i){let e=Tl(`toggle-document-panel`),d;t[25]===n?d=t[26]:(d=n?Qr(n):null,t[25]=n,t[26]=d);let f=d,k;t[27]===n?k=t[28]:(k=n?b(n):null,t[27]=n,t[28]=k);let A=k,j;t[29]!==f||t[30]!==A?(j=f?.kind===`skill`?{scope:f.scope,name:f.name}:A?{scope:`project`,name:A}:null,t[29]=f,t[30]=A,t[31]=j):j=t[31];let M=j;_=`editor-toolbar`,v=`pointer-events-none absolute inset-x-0 top-0 z-10`;let N;t[32]!==n||t[33]!==M?(N=M?null:(0,Z.jsx)(JN,{docName:n}),t[32]=n,t[33]=M,t[34]=N):N=t[34];let P;t[35]===N?P=t[36]:(P=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex min-w-0 items-center`,children:N}),t[35]=N,t[36]=P);let F;t[37]!==r||t[38]!==a||t[39]!==i?(F=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex justify-center`,children:(0,Z.jsx)(eP,{isSourceMode:r,onModeChange:a,sourceDisabled:i})}),t[37]=r,t[38]=a,t[39]=i,t[40]=F):F=t[40],t[41]!==P||t[42]!==F?(y=(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:[P,F]})}),t[41]=P,t[42]=F,t[43]=y):y=t[43],O=`pointer-events-auto absolute top-0 right-0 flex items-center justify-end gap-1 py-2 pr-2`,t[44]===M?h=t[45]:(h=M?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(tP,{scope:M.scope,name:M.name})}):null,t[44]=M,t[45]=h),t[46]!==u||t[47]!==s||t[48]!==o?(g=o&&(0,Z.jsxs)(Hs,{children:[(0,Z.jsx)(Ci,{variant:`ghost`,size:`icon`,"aria-label":u({id:`81H_23`}),onClick:s,"data-testid":`add-properties-button`,asChild:!0,children:(0,Z.jsx)(zs,{children:(0,Z.jsx)(zd,{})})}),(0,Z.jsx)(Bs,{side:`bottom`,children:(0,Z.jsx)(Y,{id:`81H_23`})})]}),t[46]=u,t[47]=s,t[48]=o,t[49]=g):g=t[49],m=Hs,p=Ci,x=``,S=`ghost`,C=`icon`,w=l,T=!c,E=`doc-panel`,D=u(c?{id:`u7H-Wn`,values:{panelShortcutLabel:e}}:{id:`2hpdRq`,values:{panelShortcutLabel:e}}),t[1]=u,t[2]=n,t[3]=c,t[4]=r,t[5]=s,t[6]=a,t[7]=l,t[8]=o,t[9]=i,t[10]=p,t[11]=m,t[12]=h,t[13]=g,t[14]=_,t[15]=v,t[16]=y,t[17]=x,t[18]=S,t[19]=C,t[20]=w,t[21]=T,t[22]=E,t[23]=D,t[24]=O}else p=t[10],m=t[11],h=t[12],g=t[13],_=t[14],v=t[15],y=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];let k;t[50]===c?k=t[51]:(k=(0,Z.jsx)(zs,{children:c?(0,Z.jsx)(Qd,{}):(0,Z.jsx)(Zd,{})}),t[50]=c,t[51]=k);let A;t[52]!==p||t[53]!==k||t[54]!==x||t[55]!==S||t[56]!==C||t[57]!==w||t[58]!==T||t[59]!==E||t[60]!==D?(A=(0,Z.jsx)(p,{"data-doc-panel-toggle":x,variant:S,size:C,onClick:w,"aria-expanded":T,"aria-controls":E,"aria-label":D,asChild:!0,children:k}),t[52]=p,t[53]=k,t[54]=x,t[55]=S,t[56]=C,t[57]=w,t[58]=T,t[59]=E,t[60]=D,t[61]=A):A=t[61];let j;t[62]===c?j=t[63]:(j=(0,Z.jsx)(Bs,{side:`bottom`,children:c?(0,Z.jsx)(Y,{id:`KFdXwz`,values:{panelShortcut:f}}):(0,Z.jsx)(Y,{id:`MsuXaI`,values:{panelShortcut:f}})}),t[62]=c,t[63]=j);let M;t[64]!==m||t[65]!==A||t[66]!==j?(M=(0,Z.jsxs)(m,{children:[A,j]}),t[64]=m,t[65]=A,t[66]=j,t[67]=M):M=t[67];let N;t[68]!==h||t[69]!==g||t[70]!==M||t[71]!==O?(N=(0,Z.jsxs)(`div`,{className:O,children:[h,g,M]}),t[68]=h,t[69]=g,t[70]=M,t[71]=O,t[72]=N):N=t[72];let P;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none h-2 bg-linear-to-b from-background to-transparent`}),t[73]=P):P=t[73];let F;return t[74]!==_||t[75]!==v||t[76]!==y||t[77]!==N?(F=(0,Z.jsxs)(`div`,{"data-testid":_,className:v,children:[y,N,P]}),t[74]=_,t[75]=v,t[76]=y,t[77]=N,t[78]=F):F=t[78],F}function rP(e){let{activeDocName:t,deferredActiveDocName:n,mountResolved:r,syncResolved:i}=e;return t===null||t===n?!1:!(r&&i)}var iP=`ok-terminal-height-v1`,aP=1/3,oP=.5;function sP(e){return Math.max(120,Math.round((Number.isFinite(e)?e:0)*oP))}function cP(e){let t=Number.isFinite(e)?e:0;return t<=0?240:Math.round(t*aP)}function lP(e,t){let n=sP(t);return Number.isFinite(e)?e<120?120:e>n?n:Math.round(e):Math.min(cP(t),n)}function uP(){return typeof window>`u`?0:window.innerHeight}function dP(e,t){try{let n=e??localStorage,r=t??uP(),i=n.getItem(iP);if(i==null)return lP(cP(r),r);let a=Number.parseInt(i,10);return lP(Number.isFinite(a)?a:cP(r),r)}catch{return 240}}function fP(e,t,n){try{let r=t??localStorage,i=n??uP();r.setItem(iP,String(lP(e,i)))}catch{}}function pP(){try{return typeof localStorage>`u`?240:dP()}catch{return 240}}var mP=`terminal-dock-panel`;function hP(e){let t=(0,$.c)(35),{children:n,visible:r,onVisibleChange:i,dockPosition:a,onBottomContainer:o,onEditorRegion:s}=e,c=a===void 0?`bottom`:a,{resolvedTheme:l}=Yn(),u=gC(),[d,f]=(0,Q.useState)(!r),p;t[0]===l?p=t[1]:(p=_u(l),t[0]=l,t[1]=p);let m=p.background,[h]=(0,Q.useState)(gP),g=(0,Q.useRef)(h),[_,v]=(0,Q.useState)(!1),y=(0,Q.useRef)(!1),b=(0,Q.useRef)(null),x;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(x=function(e){b.current!=null&&clearTimeout(b.current),b.current=setTimeout(()=>{fP(e),b.current=null},100)},t[2]=x):x=t[2];let S=x,C=(0,Q.useRef)(null),w,T;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(w=()=>()=>{b.current!=null&&clearTimeout(b.current),C.current!=null&&(window.removeEventListener(`pointerup`,C.current),C.current=null)},T=[],t[3]=w,t[4]=T):(w=t[3],T=t[4]),(0,Q.useEffect)(w,T);let E,D;t[5]!==c||t[6]!==u||t[7]!==r?(E=()=>{let e=u.current;e!=null&&(r&&c===`bottom`?e.resize(`${g.current}px`):e.collapse())},D=[r,u,c],t[5]=c,t[6]=u,t[7]=r,t[8]=E,t[9]=D):(E=t[8],D=t[9]),(0,Q.useEffect)(E,D);let O=_||void 0,k;t[10]!==n||t[11]!==s?(k=(0,Z.jsx)(gE,{minSize:`5%`,className:`flex min-h-0 flex-col`,children:(0,Z.jsx)(`div`,{ref:s,tabIndex:-1,className:`flex h-full min-h-0 flex-col outline-none`,children:n})}),t[10]=n,t[11]=s,t[12]=k):k=t[12];let A;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(_E,{withHandle:!0,onPointerDown:()=>{v(!0),y.current=!0;let e=()=>{v(!1),y.current=!1,window.removeEventListener(`pointerup`,e),C.current=null};C.current=e,window.addEventListener(`pointerup`,e)}}),t[13]=A):A=t[13];let j;t[14]===m?j=t[15]:(j={backgroundColor:m},t[14]=m,t[15]=j);let M=r&&c===`bottom`?`${h}px`:0,N;t[16]!==i||t[17]!==r?(N=e=>{let t=e.asPercentage===0;f(t),y.current&&(t&&r?i(!1):!t&&!r&&i(!0),e.inPixels>0&&(g.current=e.inPixels,S(e.inPixels)))},t[16]=i,t[17]=r,t[18]=N):N=t[18];let P=!_&&`transition-[flex-grow] duration-150 ease-out motion-reduce:transition-none motion-reduce:duration-0`,F;t[19]===P?F=t[20]:(F=X(`flex flex-col`,P),t[19]=P,t[20]=F);let I;t[21]===o?I=t[22]:(I=(0,Z.jsx)(`div`,{ref:o,className:`flex min-h-0 flex-1 flex-col overflow-hidden`}),t[21]=o,t[22]=I);let L;t[23]!==d||t[24]!==u||t[25]!==j||t[26]!==M||t[27]!==N||t[28]!==F||t[29]!==I?(L=(0,Z.jsx)(gE,{id:mP,style:j,panelRef:u,defaultSize:M,minSize:`120px`,maxSize:`95%`,collapsible:!0,collapsedSize:0,onResize:N,inert:d,className:F,children:I}),t[23]=d,t[24]=u,t[25]=j,t[26]=M,t[27]=N,t[28]=F,t[29]=I,t[30]=L):L=t[30];let R;return t[31]!==L||t[32]!==O||t[33]!==k?(R=(0,Z.jsxs)(hE,{orientation:`vertical`,className:`min-h-0 flex-1`,"data-dragging":O,children:[k,A,L]}),t[31]=L,t[32]=O,t[33]=k,t[34]=R):R=t[34],R}function gP(){return pP()}var _P=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-B64TMVp3.js`),__vite__mapDeps([48,1,2,49,50,51,31,52,53,54,55,56,57,58,59,20,9,10,7,11,30,3,32,6,4,15,12,13,22,14,60,16,43,44,45,61,62,23,63,64,65]),import.meta.url)).ActivityModeContent})),vP=`300px`,yP=`600px`;function bP(e){let t=(0,$.c)(5),n;t[0]===e?n=t[1]:(n=(0,Z.jsx)(SP,{...e}),t[0]=e,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(xP,{}),t[2]=r):r=t[2];let i;return t[3]===n?i=t[4]:(i=(0,Z.jsx)(_l,{name:`editor-area`,children:(0,Z.jsxs)(Ha,{children:[n,r]})}),t[3]=n,t[4]=i),i}function xP(){let e=(0,$.c)(5),t=Ji(),n;e[0]===t?n=e[1]:(n=e=>{e||t.close()},e[0]=t,e[1]=n);let r;return e[2]!==t.open||e[3]!==n?(r=(0,Z.jsx)(uE,{open:t.open,onOpenChange:n}),e[2]=t.open,e[3]=n,e[4]=r):r=e[4],r}function SP(e){let t=(0,$.c)(210),{editorMode:n,onModeChange:r,activeTab:i,onActiveTabChange:a,terminalBridge:o,terminalVisible:s,onTerminalVisibleChange:c,terminalDock:l,onTerminalPlacement:u}=e,d=s===void 0?!1:s,f=l===void 0?`right`:l,{_:p}=rn(),{resolvedTheme:m}=Yn(),h;t[0]===m?h=t[1]:(h=_u(m),t[0]=m,t[1]=h);let g=h.background,{activeDocName:_,activeProvider:v,activeTarget:y,recycleDocument:b,docPanelMode:x,docPanelAgentId:S,docPanelExpandSignal:C}=ft(),{openDocumentTransition:w}=Et(),{requestAddProperty:T}=za(),E=zE(v,_),D=HE(_,n===`source`?`source`:`wysiwyg`),O=pD(v),k=O===`connected`||O===`synced`,A=VE(_)===`conflict`,[j,M]=(0,Q.useState)(!1),N,P;t[2]!==v||t[3]!==j?(N=()=>{v!=null&&!j&&M(!0)},P=[v,j],t[2]=v,t[3]=j,t[4]=N,t[5]=P):(N=t[4],P=t[5]),(0,Q.useEffect)(N,P);let F=(0,Q.useDeferredValue)(_),I=y?.kind===`missing`,L=!!_&&y?.kind!==`folder`,R;t[6]!==p||t[7]!==I?(R=I?p({id:`K-a33w`}):void 0,t[6]=p,t[7]=I,t[8]=R):R=t[8];let z=R,[B]=(0,Q.useState)(DP),V=B!==null,[H]=(0,Q.useState)(EP),U;t[9]===B?U=t[10]:(U=()=>ZE(B,window.innerWidth,`right`),t[9]=B,t[10]=U);let[W,G]=(0,Q.useState)(U),K=(0,Q.useRef)(W),ee,q;t[11]===W?(ee=t[12],q=t[13]):(ee=()=>{K.current=W},q=[W],t[11]=W,t[12]=ee,t[13]=q),(0,Q.useEffect)(ee,q);let J=gC(),ne=gC(),re;t[14]===W?re=t[15]:(re=()=>oD(`right`,W,iD())===`collapsed`,t[14]=W,t[15]=re);let[ie]=(0,Q.useState)(re),[ae,oe]=(0,Q.useState)(ie),se=(0,Q.useRef)(ae),[ce,le]=(0,Q.useState)(null),[ue,de]=(0,Q.useState)(null),[fe,pe]=(0,Q.useState)(null),me=f===`right`,he=me?`right`:`bottom`,ge=me&&d&&ce!=null,_e=ge?ce:ue,ve=(me?ge:d)&&_e!=null,ye,be;t[16]!==_e||t[17]!==u||t[18]!==he||t[19]!==fe||t[20]!==ve?(ye=()=>{u?.({container:_e,isShowing:ve,dockPosition:he,editorRegion:fe})},be=[u,_e,ve,he,fe],t[16]=_e,t[17]=u,t[18]=he,t[19]=fe,t[20]=ve,t[21]=ye,t[22]=be):(ye=t[21],be=t[22]),(0,Q.useEffect)(ye,be);let xe,Se;t[23]===ae?(xe=t[24],Se=t[25]):(xe=()=>{se.current=ae},Se=[ae],t[23]=ae,t[24]=xe,t[25]=Se),(0,Q.useEffect)(xe,Se);let[Ce,we]=(0,Q.useState)(!1),Te=(0,Q.useRef)(!1),[Ee]=(0,Q.useState)(TP),De=(0,Q.useRef)(Ee),Oe=(0,Q.useRef)(null),ke;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(ke=function(e){Oe.current!=null&&clearTimeout(Oe.current),Oe.current=setTimeout(()=>{KE(e),Oe.current=null},100)},t[26]=ke):ke=t[26];let Ae=ke,[je]=(0,Q.useState)(wP),Ne=(0,Q.useRef)(je),[Pe,Fe]=(0,Q.useState)(!1),Ie=(0,Q.useRef)(!1),Le=(0,Q.useRef)(null),Re;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(Re=function(e){Le.current!=null&&clearTimeout(Le.current),Le.current=setTimeout(()=>{dD(e),Le.current=null},100)},t[27]=Re):Re=t[27];let ze=Re,Be,Ve;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(Be=()=>()=>{Oe.current!=null&&clearTimeout(Oe.current),Le.current!=null&&clearTimeout(Le.current)},Ve=[],t[28]=Be,t[29]=Ve):(Be=t[28],Ve=t[29]),(0,Q.useEffect)(Be,Ve);let[He,Ue]=(0,Q.useState)(null),We;t[30]!==ae||t[31]!==J?(We=function(){if(J.current==null)return;let e=K.current;ae?(sD(`right`,e,`open`),J.current?.expand()):(sD(`right`,e,`collapsed`),J.current?.collapse())},t[30]=ae,t[31]=J,t[32]=We):We=t[32];let Ge=We,Ke,qe;t[33]!==B||t[34]!==J?(Ke=()=>{let e=window.matchMedia(`(min-width: ${YE}px)`),t=()=>{let e=ZE(B,window.innerWidth,`right`);G(e);let t=oD(`right`,e,iD())===`collapsed`;oe(t),t?J.current?.collapse():J.current?.expand()};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},qe=[B,J],t[33]=B,t[34]=J,t[35]=Ke,t[36]=qe):(Ke=t[35],qe=t[36]),(0,Q.useEffect)(Ke,qe);let Je,Ye;t[37]!==He||t[38]!==V||t[39]!==J||t[40]!==ne?(Je=()=>{if(He==null||V)return;let e=new ResizeObserver(()=>{!Te.current&&!se.current&&J.current?.resize(`${De.current}px`),Ie.current||ne.current?.resize(`${Ne.current}px`)});return e.observe(He),()=>e.disconnect()},Ye=[He,V,J,ne],t[37]=He,t[38]=V,t[39]=J,t[40]=ne,t[41]=Je,t[42]=Ye):(Je=t[41],Ye=t[42]),(0,Q.useEffect)(Je,Ye);let Xe,Ze;t[43]!==a||t[44]!==J?(Xe=()=>{let e=e=>{a(e),J.current?.expand()},t=ov();return t&&e(t),cv(t=>{ov(),e(t)})},Ze=[a,J],t[43]=a,t[44]=J,t[45]=Xe,t[46]=Ze):(Xe=t[45],Ze=t[46]),(0,Q.useEffect)(Xe,Ze);let Qe,$e;t[47]!==C||t[48]!==J?(Qe=()=>{C!==0&&J.current?.expand()},$e=[C,J],t[47]=C,t[48]=J,t[49]=Qe,t[50]=$e):(Qe=t[49],$e=t[50]),(0,Q.useEffect)(Qe,$e);let et,tt;t[51]!==J||t[52]!==f?(et=()=>{let e=0,t=dv(()=>{f===`right`&&(cancelAnimationFrame(e),e=requestAnimationFrame(()=>{J.current?.collapse()}))});return()=>{cancelAnimationFrame(e),t()}},tt=[J,f],t[51]=J,t[52]=f,t[53]=et,t[54]=tt):(et=t[53],tt=t[54]),(0,Q.useEffect)(et,tt);let nt,rt;t[55]===ae?(nt=t[56],rt=t[57]):(nt=()=>{if(!ae||!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()},rt=[ae],t[55]=ae,t[56]=nt,t[57]=rt),(0,Q.useLayoutEffect)(nt,rt);let it,at;t[58]===ae?(it=t[59],at=t[60]):(it=()=>{window.okDesktop!=null&&window.okDesktop.editor.notifyViewMenuStateChanged({docPanelVisible:!ae})},at=[ae],t[58]=ae,t[59]=it,t[60]=at),(0,Q.useEffect)(it,at);let ot,st;t[61]===Ge?(ot=t[62],st=t[63]):(ot=()=>{if(window.okDesktop!=null)return window.okDesktop.onMenuAction(e=>{e===`toggle-doc-panel`&&Ge()})},st=[Ge],t[61]=Ge,t[62]=ot,t[63]=st),(0,Q.useEffect)(ot,st);let ct,lt;t[64]===Ge?(ct=t[65],lt=t[66]):(ct=()=>{if(window.okDesktop!=null)return;let e=e=>{wl(e,`toggle-document-panel`)&&(e.preventDefault(),Ge())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},lt=[Ge],t[64]=Ge,t[65]=ct,t[66]=lt),(0,Q.useEffect)(ct,lt);let ut=(0,Q.useRef)(null),[dt,pt]=(0,Q.useState)(null),[mt,ht]=(0,Q.useState)(!1),gt=y?.kind===`large-file`?y.docName:_,_t,vt;t[67]===gt?(_t=t[68],vt=t[69]):(_t=()=>{if(gt&&gt!==ut.current){let e=ut.current;ut.current=gt,pt(e)}},vt=[gt],t[67]=gt,t[68]=_t,t[69]=vt),(0,Q.useEffect)(_t,vt);let yt;t[70]===w?yt=t[71]:(yt=function(e){let t=Kc(e);window.location.hash===t?w(e):window.location.hash=t},t[70]=w,t[71]=yt);let bt=yt,xt,St=null;if(y?.kind===`large-file`){let e;t[72]!==bt||t[73]!==dt?(e=dt?{previousDocName:dt,onNavigateBack:bt}:void 0,t[72]=bt,t[73]=dt,t[74]=e):e=t[74];let n;t[75]!==y.docName||t[76]!==y.limit||t[77]!==y.size||t[78]!==e?(n=(0,Z.jsx)(qT,{docName:y.docName,size:y.size,limit:y.limit,backNav:e}),t[75]=y.docName,t[76]=y.limit,t[77]=y.size,t[78]=e,t[79]=n):n=t[79],xt=n}else if(y?.kind===`folder`){let e;t[80]!==H||t[81]!==V||t[82]!==d?(e=UD({terminalVisible:d,isEmbedded:V,isDesktop:H}),t[80]=H,t[81]=V,t[82]=d,t[83]=e):e=t[83];let n=e,r;t[84]===y.folderPath?r=t[85]:(r=(0,Z.jsx)(UT,{folderPath:y.folderPath}),t[84]=y.folderPath,t[85]=r);let i;t[86]!==y.folderPath||t[87]!==n?(i=n?(0,Z.jsx)(AD,{folderPath:y.folderPath}):null,t[86]=y.folderPath,t[87]=n,t[88]=i):i=t[88];let a;if(t[89]!==r||t[90]!==i?(a=(0,Z.jsxs)(`div`,{className:`relative flex h-full min-h-0 flex-col`,children:[r,i]}),t[89]=r,t[90]=i,t[91]=a):a=t[91],xt=a,x===`agent`&&S!==null){let e;t[92]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(_E,{withHandle:!0}),t[92]=e):e=t[92];let n;t[93]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(Z.Fragment,{children:[e,(0,Z.jsx)(gE,{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)(Y,{id:`ONPvOb`})}),children:(0,Z.jsx)(_P,{showBackButton:!1})})})]}),t[93]=n):n=t[93],St=n}}else if(y?.kind===`asset`){let e;t[94]!==y.assetPath||t[95]!==y.mediaKind?(e=(0,Z.jsx)(jC,{assetPath:y.assetPath,mediaKind:y.mediaKind},y.assetPath),t[94]=y.assetPath,t[95]=y.mediaKind,t[96]=e):e=t[96],xt=e}else if(y?.kind===`skill-file`){let e=`${y.scope}/${y.name}/${y.path}`,n;t[97]!==y.name||t[98]!==y.path||t[99]!==y.scope||t[100]!==e?(n=(0,Z.jsx)(tE,{scope:y.scope,name:y.name,path:y.path},e),t[97]=y.name,t[98]=y.path,t[99]=y.scope,t[100]=e,t[101]=n):n=t[101],xt=n}else if(!v||!_)if((typeof window<`u`?hl(window.location.hash):null)!==null)if(o!=null&&j){let e;t[102]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(MC,{}),t[102]=e):e=t[102],xt=e;let n;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(_E,{withHandle:!0,disabled:!0}),t[103]=n):n=t[103];let r=ie?0:`${Ee}px`,i;t[104]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`}),t[104]=i):i=t[104];let a;t[105]===r?a=t[106]:(a=(0,Z.jsxs)(Z.Fragment,{children:[n,(0,Z.jsx)(gE,{id:`doc-panel`,defaultSize:r,minSize:vP,maxSize:yP,collapsible:!0,collapsedSize:0,inert:!0,className:`flex flex-col bg-muted/20`,children:i})]}),t[105]=r,t[106]=a),St=a}else{let e;return t[107]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(MC,{}),t[107]=e):e=t[107],e}else{let e=d&&he===`bottom`,n;t[108]===e?n=t[109]:(n=(0,Z.jsx)(uT,{terminalVisible:e}),t[108]=e,t[109]=n),xt=n}else{let e=n===`source`,o=!k,s=ae,c;t[110]!==_||t[111]!==T?(c=function(){_&&T(_)},t[110]=_,t[111]=T,t[112]=c):c=t[112];let l=c,u;t[113]!==_||t[114]!==H||t[115]!==V||t[116]!==d?(u=HD({terminalVisible:d,isEmbedded:V,isDesktop:H,activeDocName:_}),t[113]=_,t[114]=H,t[115]=V,t[116]=d,t[117]=u):u=t[117];let f=u,p=F??_,m=dt??void 0,h;t[118]!==z||t[119]!==e||t[120]!==bt||t[121]!==b||t[122]!==p||t[123]!==m?(h=(0,Z.jsx)(LM,{activeDocName:p,isSourceMode:e,editorPlaceholder:z,previousDocName:m,onNavigateBack:bt,onRecycle:b}),t[118]=z,t[119]=e,t[120]=bt,t[121]=b,t[122]=p,t[123]=m,t[124]=h):h=t[124];let g;t[125]!==_||t[126]!==e?(g=(0,Z.jsx)(FE,{activeDocName:_,isSourceMode:e}),t[125]=_,t[126]=e,t[127]=g):g=t[127];let v;t[128]!==_||t[129]!==F?(v=rP({activeDocName:_,deferredActiveDocName:F,mountResolved:_!==null&&te(_),syncResolved:_!==null&&Me(_)})?(0,Z.jsxs)(`div`,{className:`absolute inset-0 z-10 bg-background`,children:[(0,Z.jsx)(MC,{}),_===null?null:(0,Z.jsx)(JT,{docName:_})]}):null,t[128]=_,t[129]=F,t[130]=v):v=t[130];let y;t[131]!==h||t[132]!==g||t[133]!==v?(y=(0,Z.jsxs)(`div`,{className:`relative h-full`,children:[h,g,v]}),t[131]=h,t[132]=g,t[133]=v,t[134]=y):y=t[134];let S;t[135]!==_||t[136]!==A||t[137]!==s||t[138]!==e||t[139]!==r||t[140]!==l||t[141]!==o||t[142]!==Ge?(S=!A&&(0,Z.jsx)(nP,{activeDocName:_,isSourceMode:e,sourceDisabled:o,onModeChange:r,showAddPropertyButton:!e,onAddProperty:l,isPanelCollapsed:s,onTogglePanel:Ge}),t[135]=_,t[136]=A,t[137]=s,t[138]=e,t[139]=r,t[140]=l,t[141]=o,t[142]=Ge,t[143]=S):S=t[143];let C;t[144]!==_||t[145]!==mt||t[146]!==e||t[147]!==f?(C=f?(0,Z.jsx)(AD,{docName:_,surface:e?`source`:`wysiwyg`,dismissed:mt,onDismiss:()=>ht(!0),onReopen:()=>ht(!1)}):null,t[144]=_,t[145]=mt,t[146]=e,t[147]=f,t[148]=C):C=t[148];let w;t[149]!==y||t[150]!==S||t[151]!==C?(w=(0,Z.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[y,S,C]}),t[149]=y,t[150]=S,t[151]=C,t[152]=w):w=t[152];let O;t[153]!==mt||t[154]!==f?(O=f&&mt?{onReopen:()=>ht(!1)}:null,t[153]=mt,t[154]=f,t[155]=O):O=t[155];let j;t[156]!==D||t[157]!==L||t[158]!==E||t[159]!==O?(j=(0,Z.jsx)(RN,{stats:E,selectionStats:D,showStats:L,composerBadge:O}),t[156]=D,t[157]=L,t[158]=E,t[159]=O,t[160]=j):j=t[160];let M;t[161]!==w||t[162]!==j?(M=(0,Z.jsxs)(`div`,{className:`relative flex h-full flex-col`,children:[w,j]}),t[161]=w,t[162]=j,t[163]=M):M=t[163],xt=M;let N=V&&ae,P;t[164]===Symbol.for(`react.memo_cache_sentinel`)?(P=()=>{we(!0),Te.current=!0;let e=()=>{we(!1),Te.current=!1,window.removeEventListener(`pointerup`,e)};window.addEventListener(`pointerup`,e)},t[164]=P):P=t[164];let I;t[165]===N?I=t[166]:(I=(0,Z.jsx)(_E,{withHandle:!0,disabled:N,onPointerDown:P}),t[165]=N,t[166]=I);let R=ie?0:`${Ee}px`,B;t[167]===Symbol.for(`react.memo_cache_sentinel`)?(B=e=>{oe(e.asPercentage===0),e.inPixels>0&&Te.current&&(De.current=e.inPixels,Ae(e.inPixels))},t[167]=B):B=t[167];let U=!Ce&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,W;t[168]===U?W=t[169]:(W=X(`flex flex-col bg-muted/20`,U),t[168]=U,t[169]=W);let G;t[170]!==_||t[171]!==i||t[172]!==x||t[173]!==e||t[174]!==a?(G=(0,Z.jsx)(Sx,{docName:_,isSourceMode:e,activeTab:i,onActiveTabChange:a,mode:x}),t[170]=_,t[171]=i,t[172]=x,t[173]=e,t[174]=a,t[175]=G):G=t[175];let K;t[176]!==ae||t[177]!==J||t[178]!==R||t[179]!==W||t[180]!==G?(K=(0,Z.jsx)(gE,{id:`doc-panel`,panelRef:J,defaultSize:R,minSize:vP,maxSize:yP,collapsible:!0,collapsedSize:0,onResize:B,inert:ae,className:W,children:G}),t[176]=ae,t[177]=J,t[178]=R,t[179]=W,t[180]=G,t[181]=K):K=t[181];let ee;t[182]!==I||t[183]!==K?(ee=(0,Z.jsxs)(Z.Fragment,{children:[I,K]}),t[182]=I,t[183]=K,t[184]=ee):ee=t[184],St=ee}let Ct;t[185]!==c||t[186]!==o||t[187]!==he||t[188]!==d||t[189]!==xt?(Ct=o==null?xt:(0,Z.jsx)(hP,{visible:d,onVisibleChange:c??CP,dockPosition:he,onBottomContainer:de,onEditorRegion:pe,children:xt}),t[185]=c,t[186]=o,t[187]=he,t[188]=d,t[189]=xt,t[190]=Ct):Ct=t[190];let wt=Ct,Tt=o!=null&&me&&d,Dt;t[191]!==je||t[192]!==Pe||t[193]!==ne||t[194]!==Tt||t[195]!==g?(Dt=Tt?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(_E,{withHandle:!0,onPointerDown:()=>{Fe(!0),Ie.current=!0;let e=()=>{Fe(!1),Ie.current=!1,window.removeEventListener(`pointerup`,e)};window.addEventListener(`pointerup`,e)}}),(0,Z.jsx)(gE,{id:`terminal-column`,panelRef:ne,style:{backgroundColor:g},defaultSize:`${je}px`,minSize:`320px`,maxSize:`900px`,onResize:e=>{e.inPixels>0&&Ie.current&&(Ne.current=e.inPixels,ze(e.inPixels))},className:X(`flex flex-col`,!Pe&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`),children:(0,Z.jsx)(`div`,{ref:le,className:`flex min-h-0 flex-1 flex-col overflow-hidden`})})]}):null,t[191]=je,t[192]=Pe,t[193]=ne,t[194]=Tt,t[195]=g,t[196]=Dt):Dt=t[196];let Ot=Dt,kt=St!=null&&!ie||Tt,At=Ce||Pe||void 0,jt;t[197]===kt?jt=t[198]:(jt=kt?{}:{defaultSize:`100%`},t[197]=kt,t[198]=jt);let Mt=!(Ce||Pe)&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,Nt;t[199]===Mt?Nt=t[200]:(Nt=X(Mt),t[199]=Mt,t[200]=Nt);let Pt;t[201]!==wt||t[202]!==jt||t[203]!==Nt?(Pt=(0,Z.jsx)(gE,{minSize:`30%`,...jt,className:Nt,children:wt}),t[201]=wt,t[202]=jt,t[203]=Nt,t[204]=Pt):Pt=t[204];let Ft;return t[205]!==St||t[206]!==At||t[207]!==Pt||t[208]!==Ot?(Ft=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1`,ref:Ue,children:(0,Z.jsxs)(hE,{orientation:`horizontal`,"data-dragging":At,children:[Pt,St,Ot]})}),t[205]=St,t[206]=At,t[207]=Pt,t[208]=Ot,t[209]=Ft):Ft=t[209],Ft}function CP(){}function wP(){return fD()}function TP(){return qE()}function EP(){return typeof window<`u`&&window.okDesktop!=null}function DP(){return Fr()}function OP(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 kP(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 AP=1e3,jP=!1;function MP(e){return!!(e.localPrincipalId&&e.entryPrincipalId===e.localPrincipalId||!e.localPrincipalId&&e.entryClientId===e.localClientId)}function NP(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:Ni(i)?a=i:(a=void 0,jP||(jP=!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`&&(MP({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=kP(i),{current:c,crossDoc:l}=a?ki(a,n,Date.now()):{current:[],crossDoc:[]},u=PP,d=c.map(u),f=l.map(u),p=[...s,...d],m=f;o(e=>OP(e.current,p)&&OP(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,AP);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 PP(e){let{agentId:t,entry:n}=e;return{kind:`agent`,agentId:t,presence:n}}var FP=`sync-status`;function IP(e,t){let n=(0,$.c)(6),{_:r}=rn(),i=jg(),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){bs.dismiss(FP);return}o.current=!0,bs.warning(r({id:`HGNCsl`}),{id:FP,duration:1/0})}else o.current&&e===`synced`&&(o.current=!1,bs.success(r({id:`GhjUB_`}),{id:FP,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 LP=4,RP=3,zP={Bird:id,Cat:dd,Dog:yd,Fish:Td,Mouse:af,Rabbit:rf,Shrimp:df,Snail:ff,Squirrel:gf,Turtle:Ef};Object.freeze(Object.keys(zP));function BP(e){if(typeof e.principalId==`string`&&e.principalId.length>0)return{kind:`initials`};let t=e.name.split(` `)[1];return t&&Object.hasOwn(zP,t)?{kind:`animal`,animal:t}:{kind:`initials`}}var VP={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`,bot:`Agent`};function HP(e){let t=(0,$.c)(28),{user:n,mode:r,tabCount:i}=e,{_:a}=rn(),o=BP(n),s=o.kind===`animal`?zP[o.animal]:void 0,c;t[0]===n.name?c=t[1]:(c=Dr(n.name),t[0]=n.name,t[1]=c);let l=c,u;t[2]===n.color?u=t[3]:(u=si(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)(zs,{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)(Bs,{children:m}),t[23]=m,t[24]=b);let x;return t[25]!==y||t[26]!==b?(x=(0,Z.jsxs)(Hs,{children:[y,b]}),t[25]=y,t[26]=b,t[27]=x):x=t[27],x}function UP(e){let t=VP[e.icon];return e.displayName||t||As._({id:`iEQQyu`})}function WP(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 GP(e){let t=(0,$.c)(33),{participant:n,crossDoc:r,scoped:i,onClickAgent:a}=e,{_:o}=rn(),{activeDocName:s}=ft(),{presence:c,agentId:l}=n,u=UP(c),d=WP(c.mode),f=!r&&d,p=c.currentDoc&&c.currentDoc!==`(connected)`?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)(ji,{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)(ji,{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)(zs,{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)(Y,{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)(Bs,{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)(Hs,{children:[O,j]}),t[30]=O,t[31]=j,t[32]=M):M=t[32],M}function KP(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?As._({id:`9euN0m`,values:{count:n}}):As._({id:`uhJEA2`,values:{count:n}}),t[0]=n,t[1]=i,t[2]=s):s=t[2];let c=s,l=i?`true`:void 0,u;t[3]!==n||t[4]!==c||t[5]!==l?(u=(0,Z.jsx)(j,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`presence-overflow`,"data-presence-crossdoc":l,className:`inline-flex size-7 shrink-0 cursor-pointer items-center justify-center rounded-full bg-muted font-medium text-muted-foreground text-xs ring-2 ring-background hover:bg-muted/80`,"aria-label":c,children:[`+`,n]})}),t[3]=n,t[4]=c,t[5]=l,t[6]=u):u=t[6];let d;if(t[7]!==i||t[8]!==o||t[9]!==r||t[10]!==a){let e;t[12]!==i||t[13]!==o||t[14]!==a?(e=e=>e.kind===`human`?(0,Z.jsx)(HP,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(GP,{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)(wt,{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)(w,{children:[u,f]}),t[18]=u,t[19]=f,t[20]=p):p=t[20],p}function qP(e,t,n,r){return e.kind===`human`?(0,Z.jsx)(HP,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(GP,{participant:e,crossDoc:n,scoped:r===e.agentId,onClickAgent:t},e.agentId)}function JP(){let e=(0,$.c)(20),{activeProvider:t,activeDocName:n,systemProvider:r,openActivityPanel:i,docPanelMode:a,docPanelAgentId:o}=ft(),{current:s,crossDoc:c}=NP(t,r,n);if(IP(pD(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,LP),n;e[6]===s?n=e[7]:(n=s.slice(LP),e[6]=s,e[7]=n);let r=n,u=c.slice(0,RP),d;e[8]===c?d=e[9]:(d=c.slice(RP),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=>qP(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)(KP,{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=>qP(e,p,!0,m)),f.length>0?(0,Z.jsx)(KP,{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 YP(e,t){return t.trim()}function XP(e){return![``,`.`,`..`].includes(e)&&!e.includes(`/`)&&!e.includes(`\\`)&&!e.includes(`\0`)}function ZP(e,t){let n=YP(e.kind,t),r=e.path.split(`/`);return r[r.length-1]=n,r.join(`/`)}function QP(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(ll(e)){let t=s.get(Pu(e.docName,e.docExt));if(t){let n=il(t);return{kind:`asset`,path:t,assetExt:n,mediaKind:cr(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(ol(e))return{...e,path:aF(e.path,n)};if(nl(e)){let t=s.get(e.path);return t&&yl(t)?{kind:`document`,docName:bu(t),docExt:xl(t),size:e.size,modified:e.modified}:{...e,path:t??aF(e.path,n)}}return e})}function $P(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=>ll(e)?!i.has(e.docName)&&!lF(e.docName,n):ol(e)?!lF(e.path,n):nl(e)?!a.has(e.path)&&!lF(e.path,n):!0)}function eF(e,t){if(e.kind!==`asset`||t.some(t=>nl(t)&&t.path===e.path))return e;let n=Lu(e.path,t);return n?{...e,path:n,name:n.split(`/`).pop()??n}:e}function tF(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=>ll(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=>ol(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(ll(i)){let e=cF(i.docName,t.path,n.path);e&&c.has(e)&&o({...i,docName:e,modified:r});continue}if(ol(i)){let e=sF(i.path,t.path,n.path);e&&o({...i,path:e,modified:r})}}return i?a:e}function nF(e,t){return e?t.find(t=>t.fromDocName===e)?.toDocName??e:null}function rF(e,t,n){return e.flatMap(e=>t===e.toDocName||!n(e.toDocName)?[e.fromDocName]:[e.fromDocName,e.toDocName])}function iF(e,t){let n=e.kind===`file`?Pu(e.path,e.docExt):e.path;return ho(t.contentDir,n,t.pathSeparator)}function aF(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 ll(e)&&ll(t)?e.docName===t.docName:ol(e)&&ol(t)||nl(e)&&nl(t)?e.path===t.path:!1}function sF(e,t,n){return e===t?n:cF(e,t,n)}function cF(e,t,n){return e.startsWith(`${t}/`)?`${n}${e.slice(t.length)}`:null}function lF(e,t){return!!t&&(e===t||e.startsWith(`${t}/`))}function uF(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)(Dp,{"data-slot":`context-menu`,...n}),t[2]=n,t[3]=r),r}function dF(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=X(`select-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Op,{"data-slot":`context-menu-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}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)(jp,{"data-slot":`context-menu-group`,...n}),t[2]=n,t[3]=r),r}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)(Lp,{"data-slot":`context-menu-sub`,...n}),t[2]=n,t[3]=r),r}function mF(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=X(`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)(kp,{children:(0,Z.jsx)(Ap,{"data-slot":`context-menu-content`,className:i,...r})}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function hF(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=X(`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)(Np,{"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 gF(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=X(`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)(io,{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)(Rp,{"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 _F(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=X(`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)(zp,{"data-slot":`context-menu-sub-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function vF(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=X(`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)(Fp,{children:(0,Z.jsx)(Ya,{})})}),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)(Pp,{"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 yF(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=X(`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)(Mp,{"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 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=X(`-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)(Ip,{"data-slot":`context-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var xF=`mr-1.5 flex size-5 shrink-0 cursor-pointer items-center justify-center rounded-sm text-muted-foreground outline-none transition hover:bg-foreground/10 hover:text-foreground hover:opacity-100 focus-visible:ring-2 focus-visible:ring-ring/50`,SF=`border-border bg-background text-foreground hover:bg-background focus-visible:bg-background`,CF={start:[os.Space],cancel:[os.Esc],end:[os.Space,os.Enter]};function wF(e){return X(xF,e?`opacity-100`:`pointer-events-none opacity-0 group-hover:pointer-events-auto group-hover:opacity-100`)}function TF(e){return e?void 0:-1}function EF({className:e,isDragging:t}){return X(e,t&&SF)}function DF(e){return e.code===os.Enter&&e.target===e.currentTarget}function OF({event:e,hasKeyboardActivation:t,isDragging:n}){return e.defaultPrevented?`ignore`:!n&&t&&DF(e)?`activate-tab`:`delegate-sortable`}function kF({activeWidth:e,isDragging:t,outerStyle:n,transform:r,transition:i}){let a=t&&e?e:void 0;return{...n,transform:ds.Transform.toString(r?{...r,scaleX:1,scaleY:1}:null),transition:i,flexBasis:a??n?.flexBasis,maxWidth:a??n?.maxWidth,minWidth:a??n?.minWidth,opacity:n?.opacity,width:a??n?.width,zIndex:t?20:n?.zIndex}}function AF(e){let t=e?.querySelectorAll(`[data-editor-tab-sortable]`)??[],n=1/0,r=-1/0;for(let e of t){let t=e.getBoundingClientRect();n=Math.min(n,t.left),r=Math.max(r,t.right)}return Number.isFinite(n)&&Number.isFinite(r)?{left:n,right:r}:null}function jF(e){return({activeNodeRect:t,transform:n})=>{let r={...n,y:0};if(!e||!t)return r;let i=e.left-t.left,a=e.right-t.right;return r.x=Math.min(Math.max(r.x,i),a),r}}var MF=e=>{let{droppableContainers:t,droppableRects:n,pointerCoordinates:r}=e;if(r){let e=1/0,i=-1/0,a=null,o=null;for(let r of t){let t=n.get(r.id);t&&(t.left<e&&(e=t.left,a=r),t.right>i&&(i=t.right,o=r))}if(!Number.isFinite(e)||!Number.isFinite(i))return[];let s=r.x<e?a:r.x>i?o:null;if(s)return[{id:s.id,data:{droppableContainer:s,value:0}}]}return es(e)},NF=[`.md`,`.mdx`],PF=`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`,FF=`z-10 rounded-t-lg rounded-b-none border-border border-b-0 bg-background text-foreground`,IF=X(FF,`bg-transparent hover:bg-muted focus-visible:bg-muted border-transparent hover:border-border focus-visible:border-border`),LF=`flex h-full min-w-0 flex-1 cursor-pointer items-center overflow-hidden px-3 text-left text-[13px]`;function RF(e){return e.replace(/[^A-Za-z0-9_-]/g,`-`)}function zF(e){let t=Kc(e);window.location.hash!==t&&(window.location.hash=t)}function BF(e){Math.abs(e.deltaX)>=Math.abs(e.deltaY)||e.currentTarget.scrollWidth<=e.currentTarget.clientWidth||(e.preventDefault(),e.currentTarget.scrollLeft+=e.deltaY)}function VF(e,t){let n=[t,...NF].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 HF(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:_}=ls(u),v=p.current?.width,y;t[12]!==_||t[13]!==s||t[14]!==v||t[15]!==h||t[16]!==g?(y=kF({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=OF({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=EF({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 UF(e){let t=(0,$.c)(52),{children:n,closeTab:r,closeTabs:i,canPin:a,disabled:o,openTabs:s,pinTab:c,pinnedTabIds:l,tabId:u,unpinTab:d}=e,f=a===void 0?!0:a;if(o!==void 0&&o)return n;let p;t[0]!==f||t[1]!==l||t[2]!==u?(p=f&&l.includes(u),t[0]=f,t[1]=l,t[2]=u,t[3]=p):p=t[3];let m=p,h;if(t[4]!==s||t[5]!==l||t[6]!==u){let e;t[8]===u?e=t[9]:(e=e=>e!==u,t[8]=u,t[9]=e),h=De(s.filter(e),l),t[4]=s,t[5]=l,t[6]=u,t[7]=h}else h=t[7];let g=h,_;t[10]!==s||t[11]!==l?(_=De(s,l),t[10]=s,t[11]=l,t[12]=_):_=t[12];let v=_,y;t[13]===n?y=t[14]:(y=(0,Z.jsx)(dF,{asChild:!0,children:n}),t[13]=n,t[14]=y);let b;t[15]!==r||t[16]!==u?(b=()=>r(u),t[15]=r,t[16]=u,t[17]=b):b=t[17];let x;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(Y,{id:`yz7wBu`}),t[18]=x):x=t[18];let S;t[19]!==m||t[20]!==b?(S=(0,Z.jsx)(hF,{disabled:m,onSelect:b,children:x}),t[19]=m,t[20]=b,t[21]=S):S=t[21];let C=g.length===0,w;t[22]!==i||t[23]!==g?(w=()=>{i(g)},t[22]=i,t[23]=g,t[24]=w):w=t[24];let T;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(Y,{id:`omXJcU`}),t[25]=T):T=t[25];let E;t[26]!==C||t[27]!==w?(E=(0,Z.jsx)(hF,{disabled:C,onSelect:w,children:T}),t[26]=C,t[27]=w,t[28]=E):E=t[28];let D=v.length===0,O;t[29]!==v||t[30]!==i?(O=()=>{i(v)},t[29]=v,t[30]=i,t[31]=O):O=t[31];let k;t[32]===l.length?k=t[33]:(k=l.length?(0,Z.jsx)(Y,{id:`U2Kx6T`}):(0,Z.jsx)(Y,{id:`WyXG7w`}),t[32]=l.length,t[33]=k);let A;t[34]!==D||t[35]!==O||t[36]!==k?(A=(0,Z.jsx)(hF,{disabled:D,"data-testid":`editor-tab-context-close-all`,onSelect:O,children:k}),t[34]=D,t[35]=O,t[36]=k,t[37]=A):A=t[37];let j;t[38]!==f||t[39]!==m||t[40]!==c||t[41]!==u||t[42]!==d?(j=f&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(bF,{}),(0,Z.jsx)(hF,{"data-testid":`editor-tab-context-pin-toggle`,onSelect:()=>m?d(u):c(u),children:m?(0,Z.jsx)(Y,{id:`SYfHmN`}):(0,Z.jsx)(Y,{id:`3pU8e-`})})]}),t[38]=f,t[39]=m,t[40]=c,t[41]=u,t[42]=d,t[43]=j):j=t[43];let M;t[44]!==E||t[45]!==A||t[46]!==j||t[47]!==S?(M=(0,Z.jsxs)(mF,{className:`min-w-40`,children:[S,E,A,j]}),t[44]=E,t[45]=A,t[46]=j,t[47]=S,t[48]=M):M=t[48];let N;return t[49]!==M||t[50]!==y?(N=(0,Z.jsxs)(uF,{children:[y,M]}),t[49]=M,t[50]=y,t[51]=N):N=t[51],N}function WF(e){let t=(0,$.c)(26),{accessibleLabel:n,closeTab:r,isActive:i,isPinned:a,tabId:o,unpinTab:s}=e,{_:c}=rn();if(a){let e;t[0]!==c||t[1]!==n?(e=c({id:`t18QYR`,values:{accessibleLabel:n}}),t[0]=c,t[1]=n,t[2]=e):e=t[2];let r;t[3]!==o||t[4]!==s?(r=e=>{e.stopPropagation(),s(o)},t[3]=o,t[4]=s,t[5]=r):r=t[5];let i;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(nf,{"aria-hidden":`true`}),t[6]=i):i=t[6];let a;return t[7]!==e||t[8]!==r?(a=(0,Z.jsx)(Ci,{variant:`ghost`,size:`icon-xs`,type:`button`,"aria-label":e,"data-testid":`editor-tab-unpin-button`,className:`mr-1.5 text-primary! hover:bg-primary/10!`,onClick:r,children:i}),t[7]=e,t[8]=r,t[9]=a):a=t[9],a}let l;t[10]!==c||t[11]!==n?(l=c({id:`JLzQi_`,values:{accessibleLabel:n}}),t[10]=c,t[11]=n,t[12]=l):l=t[12];let u;t[13]===i?u=t[14]:(u=wF(i),t[13]=i,t[14]=u);let d;t[15]===i?d=t[16]:(d=TF(i),t[15]=i,t[16]=d);let f;t[17]!==r||t[18]!==o?(f=e=>{e.stopPropagation(),r(o)},t[17]=r,t[18]=o,t[19]=f):f=t[19];let p;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(xs,{"aria-hidden":`true`}),t[20]=p):p=t[20];let m;return t[21]!==l||t[22]!==u||t[23]!==d||t[24]!==f?(m=(0,Z.jsx)(Ci,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":l,"data-testid":`editor-tab-close-button`,className:u,tabIndex:d,onClick:f,children:p}),t[21]=l,t[22]=u,t[23]=d,t[24]=f,t[25]=m):m=t[25],m}function GF(e){let t=(0,$.c)(1),{docName:n}=e;if(VE(n)!==`conflict`)return null;let r;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(oo,{"aria-label":`Conflict`,"data-testid":`editor-tab-conflict-badge`,className:`mr-1 size-3.5 shrink-0 text-amber-500`}),t[0]=r):r=t[0],r}function KF(){let e=(0,$.c)(80),{activeDocName:t,activeTabId:n,activeNewTabId:r,activeTarget:i,activateTab:a,activateNewTab:o,closeAndClearForRename:c,closeNewTab:l,closeTab:u,closeTabs:d,getPoolActiveDocName:f,poolHas:p,isNewTabActive:m,newTabIds:h,openNewTab:g,openTabs:_,pinTab:v,pinnedTabIds:y,remapTabsForRename:b,reorderTabs:x,unpinTab:S,visibleTabIds:C}=ft(),{_:w}=rn(),{pageMeta:T}=so(),E=(0,Q.useRef)(null),[D,O]=(0,Q.useState)(null),[k,A]=(0,Q.useState)(null),[j,M]=(0,Q.useState)(``),[N,P]=(0,Q.useState)(null),[F,I]=(0,Q.useState)(!1),L=(0,Q.useRef)(null),R=(0,Q.useRef)(!1),z=(0,Q.useRef)(!1),B=(0,Q.useRef)(null),V=(0,Q.useRef)(t),H;e[0]!==n||e[1]!==t||e[2]!==i?(H=n??(i?Jt(i):t?$t(t):null),e[0]=n,e[1]=t,e[2]=i,e[3]=H):H=e[3];let U=H,W;e[4]!==r||e[5]!==U||e[6]!==m||e[7]!==h||e[8]!==_?(W=m?`${r??`__new-tab__`}\u0000${_.join(`\0`)}\u0000${h.join(`\0`)}`:U?`${U}\u0000${_.join(`\0`)}`:``,e[4]=r,e[5]=U,e[6]=m,e[7]=h,e[8]=_,e[9]=W):W=e[9];let G=W,K,ee;e[10]===t?(K=e[11],ee=e[12]):(K=()=>{V.current=t},ee=[t],e[10]=t,e[11]=K,e[12]=ee),(0,Q.useEffect)(K,ee);let te,q;e[13]===G?(te=e[14],q=e[15]):(te=()=>{G&&(E.current?.querySelector(`[data-active-tab="true"]`))?.scrollIntoView({block:`nearest`,inline:`nearest`})},q=[G],e[13]=G,e[14]=te,e[15]=q),(0,Q.useEffect)(te,q);let J,re;e[16]===k?(J=e[17],re=e[18]):(J=()=>{k&&(L.current?.focus(),L.current?.select())},re=[k],e[16]=k,e[17]=J,e[18]=re),(0,Q.useEffect)(J,re);let ae,oe;e[19]!==_||e[20]!==k?(ae=()=>{!k||_.includes(k.tabId)||(z.current=!0,B.current=null,A(null),M(``),P(null),I(!1))},oe=[_,k],e[19]=_,e[20]=k,e[21]=ae,e[22]=oe):(ae=e[21],oe=e[22]),(0,Q.useEffect)(ae,oe);let se=function(e,t){let n=t.split(`/`);z.current=!1,B.current=null,A({docName:t,tabId:e}),M(n[n.length-1]),P(null)},ce=function(){z.current=!0,B.current=null,A(null),M(``),P(null),I(!1)},le=async function(){if(z.current){z.current=!1;return}if(R.current)return;let e=k?.docName;if(!e){ce();return}let t=YP(`file`,VF(j,T.get(e)?.docExt??`.md`)),n=e.split(`/`),r=n[n.length-1];if(t===r){ce();return}if(t===B.current){L.current?.focus();return}if(!XP(t)){P(w({id:`P8yDjG`})),L.current?.focus();return}let i=ZP({kind:`file`,path:e,name:r},t);R.current=!0,I(!0),P(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(z.current){I(!1),R.current=!1;return}let r=await s(n,`Server error (HTTP ${n.status})`);if(!r.ok){P(r.title),I(!1),R.current=!1,B.current=t,L.current?.focus();return}let a=Ie(Nr,r.body,`rename-path:tab`,{renamed:[],renamedAssets:[]}).renamed,o=V.current,l=nF(o,a);rt(a);let u=!0;try{let e=rF(a,f(),p);await Promise.all(e.map(e=>c(e))),b(a),Es([`files`,`backlinks`,`graph`])}catch(n){let r=n;u=!1,console.warn(`[EditorTabs] post-rename reconciliation failed`,{err:r,docName:e,newDocName:i,normalized:t}),bs.error(w({id:`MUBR8r`}))}z.current=!0,A(null),M(``),P(null),I(!1),R.current=!1,B.current=null,u&&l&&l!==o&&zF(l)}catch(n){console.warn(`[EditorTabs] rename failed`,{err:n,docName:e,newDocName:i,normalized:t}),P(w({id:`HIb0vl`})),I(!1),R.current=!1,B.current=t,L.current?.focus()}},ue=typeof window<`u`&&window.okDesktop!=null,de;e[23]===h?de=e[24]:(de=new Set(h),e[23]=h,e[24]=de);let fe=de,pe;e[25]===D?pe=e[26]:(pe=jF(D),e[25]=D,e[26]=pe);let me;e[27]===pe?me=e[28]:(me=[pe],e[27]=pe,e[28]=me);let he=me,ge;e[29]!==l||e[30]!==d||e[31]!==fe?(ge=function(e){let t=[],n=[];for(let r of e)fe.has(r)?n.push(r):t.push(r);t.length>0&&d(t);for(let e of n)l(e)},e[29]=l,e[30]=d,e[31]=fe,e[32]=ge):ge=e[32];let _e=ge,ve;e[33]===Symbol.for(`react.memo_cache_sentinel`)?(ve={activationConstraint:{distance:8}},e[33]=ve):ve=e[33];let ye;e[34]===Symbol.for(`react.memo_cache_sentinel`)?(ye={coordinateGetter:rs,keyboardCodes:CF},e[34]=ye):ye=e[34];let be=us(Zo(ts,ve),Zo(is,ye)),xe;e[35]===Symbol.for(`react.memo_cache_sentinel`)?(xe=function(){O(AF(E.current))},e[35]=xe):xe=e[35];let Se=xe,Ce;e[36]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=function(){O(null)},e[36]=Ce):Ce=e[36];let we=Ce,Te;e[37]!==we||e[38]!==x||e[39]!==C?(Te=function(e){we();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(ss([...C],r,i),t)},e[37]=we,e[38]=x,e[39]=C,e[40]=Te):Te=e[40];let Ee=Te,De=ue?``:void 0,Oe;e[41]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=X(`pl-2 flex h-12 min-w-0 touch-manipulation flex-1 items-end overflow-x-auto overflow-y-hidden overscroll-x-contain scroll-fade-mask-x [scrollbar-width:none]`,ue&&`[-webkit-app-region:drag]`),e[41]=Oe):Oe=e[41];let ke=BF,Ae;e[42]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=X(`flex items-end gap-1`,ue&&`[-webkit-app-region:no-drag]`),e[42]=Ae):Ae=e[42];let je=$o,Me=MF,Ne;e[43]===Symbol.for(`react.memo_cache_sentinel`)?(Ne={container:typeof document<`u`?document.body:void 0},e[43]=Ne):Ne=e[43];let Pe=as,Fe;e[44]===C?Fe=e[45]:(Fe=[...C],e[44]=C,e[45]=Fe);let Le=Qo,Re=C.map(e=>{if(fe.has(e)){let t=e===r;return(0,Z.jsx)(UF,{tabId:e,canPin:!1,openTabs:C,closeTab:l,closeTabs:_e,pinTab:v,pinnedTabIds:y,unpinTab:S,children:(0,Z.jsxs)(HF,{tabId:e,activateFromKeyboard:()=>o(e),"aria-current":t?`page`:void 0,"data-active-tab":t?`true`:void 0,className:X(PF,t?FF:IF),onAuxClick:t=>{t.button===1&&(t.preventDefault(),l(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:LF,onClick:()=>o(e),tabIndex:-1,children:(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:(0,Z.jsx)(Y,{id:`3YvS-c`})})}),(0,Z.jsx)(`button`,{type:`button`,"aria-label":w({id:`xCdTnb`}),"data-testid":`editor-new-tab-placeholder-close`,className:wF(t),tabIndex:TF(t),onClick:t=>{t.stopPropagation(),l(e)},children:(0,Z.jsx)(xs,{"aria-hidden":`true`,className:`size-3.5`})})]})},e)}let t=ne(e),n=e===U,i=y.includes(e);if(t.kind===`folder`){let{baseName:r,label:o,prefix:s}=ie(t.folderPath,`/`),c=`${s}${o}`;return(0,Z.jsx)(UF,{tabId:e,openTabs:C,closeTab:u,closeTabs:_e,pinTab:v,pinnedTabIds:y,unpinTab:S,children:(0,Z.jsxs)(HF,{tabId:e,activateFromKeyboard:()=>a(e),"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:X(PF,n?FF:IF),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&u(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":c,title:c,className:LF,onClick:()=>{a(e)},tabIndex:-1,children:[s&&(0,Z.jsx)(`span`,{className:X(`min-w-0 flex-1 truncate`,n&&`text-muted-foreground`),children:s}),(0,Z.jsxs)(`span`,{className:X(`flex min-w-0 items-center`,s?`max-w-[70%] shrink-0`:`flex-1`),children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:r}),(0,Z.jsx)(`span`,{className:`shrink-0`,children:`/`})]})]}),(0,Z.jsx)(WF,{accessibleLabel:c,closeTab:u,isActive:n,isPinned:i,tabId:e,unpinTab:S})]})},e)}if(t.kind===`asset`||t.kind===`skill-file`){let{baseName:r,label:o,prefix:s}=ie(t.kind===`asset`?t.assetPath:t.path,``),c=`${s}${o}`;return(0,Z.jsx)(UF,{tabId:e,openTabs:C,closeTab:u,closeTabs:_e,pinTab:v,pinnedTabIds:y,unpinTab:S,children:(0,Z.jsxs)(HF,{tabId:e,activateFromKeyboard:()=>a(e),"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:X(PF,n?FF:IF),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&u(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":c,className:LF,onClick:()=>{a(e)},tabIndex:-1,children:[s?(0,Z.jsx)(`span`,{className:X(`min-w-0 flex-1 truncate text-muted-foreground/60`,n&&`text-muted-foreground`),children:s}):null,(0,Z.jsx)(`span`,{className:X(`min-w-0 truncate`,s?`max-w-[70%] shrink-0`:`flex-1`),children:r})]}),(0,Z.jsx)(WF,{accessibleLabel:c,closeTab:u,isActive:n,isPinned:i,tabId:e,unpinTab:S})]})},e)}let s=t.docName,c=T.get(s)?.docExt??`.md`,{baseName:d,extension:f,label:p,prefix:m}=ie(s,c),h=`${m}${p}`,g=c===`.md`||c===`.mdx`,_=k?.tabId===e,b=`editor-tab-rename-error-${RF(s)}`;return(0,Z.jsx)(UF,{disabled:_,tabId:e,openTabs:C,closeTab:u,closeTabs:_e,pinTab:v,pinnedTabIds:y,unpinTab:S,children:(0,Z.jsx)(HF,{tabId:e,activateFromKeyboard:()=>a(e),disabled:_,"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:X(PF,n?FF:IF,_&&N&&`border-destructive`),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&u(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:_?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(vE,{className:`h-full min-w-0 flex-1 rounded-none border-0 bg-transparent dark:bg-transparent`,children:[(0,Z.jsx)(CE,{ref:L,value:j,disabled:F,"aria-label":w({id:`Dw1T_W`,values:{label:p}}),"data-testid":`editor-tab-rename-input`,"aria-invalid":N?!0:void 0,"aria-describedby":N?b:void 0,"aria-busy":F||void 0,title:N??s,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=>{M(VF(e.target.value,c)),P(null),B.current=null},onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),le()):e.key===`Escape`&&(e.preventDefault(),ce())},onBlur:le}),(0,Z.jsx)(bE,{align:`inline-end`,"aria-hidden":`true`,className:`pr-2 text-xs`,children:(0,Z.jsx)(SE,{className:`text-muted-foreground/60 text-xs`,children:c})})]}),N?(0,Z.jsx)(`span`,{id:b,role:`alert`,className:`sr-only`,children:N}):null]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":h,title:h,className:LF,onClick:()=>{a(e)},onDoubleClick:t=>{t.preventDefault(),t.stopPropagation(),se(e,s)},tabIndex:-1,children:[(0,Z.jsx)(GF,{docName:s}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:d}),!g&&(0,Z.jsx)(`span`,{className:`shrink-0`,children:f})]})]}),(0,Z.jsx)(WF,{accessibleLabel:h,closeTab:u,isActive:n,isPinned:i,tabId:e,unpinTab:S})]})})},e)}),ze;e[46]!==Pe||e[47]!==Fe||e[48]!==Le||e[49]!==Re?(ze=(0,Z.jsx)(Pe,{items:Fe,strategy:Le,children:Re}),e[46]=Pe,e[47]=Fe,e[48]=Le,e[49]=Re,e[50]=ze):ze=e[50];let Be;e[51]!==je||e[52]!==we||e[53]!==Ee||e[54]!==Se||e[55]!==be||e[56]!==!1||e[57]!==Me||e[58]!==Ne||e[59]!==ze||e[60]!==he?(Be=(0,Z.jsx)(je,{sensors:be,autoScroll:!1,collisionDetection:Me,modifiers:he,onDragStart:Se,onDragEnd:Ee,onDragCancel:we,accessibility:Ne,children:ze}),e[51]=je,e[52]=we,e[53]=Ee,e[54]=Se,e[55]=be,e[56]=!1,e[57]=Me,e[58]=Ne,e[59]=ze,e[60]=he,e[61]=Be):Be=e[61];let Ve;e[62]===w?Ve=e[63]:(Ve=w({id:`3YvS-c`}),e[62]=w,e[63]=Ve);let He;e[64]===Symbol.for(`react.memo_cache_sentinel`)?(He=(0,Z.jsx)(It,{"aria-hidden":`true`}),e[64]=He):He=e[64];let Ue;e[65]!==g||e[66]!==Ve?(Ue=(0,Z.jsx)(zs,{asChild:!0,children:(0,Z.jsx)(Ci,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":Ve,"data-testid":`editor-new-tab-button`,className:`first:mb-3 mb-1.5`,onClick:g,children:He})}),e[65]=g,e[66]=Ve,e[67]=Ue):Ue=e[67];let We;e[68]===Symbol.for(`react.memo_cache_sentinel`)?(We=(0,Z.jsx)(Bs,{children:(0,Z.jsx)(Y,{id:`3YvS-c`})}),e[68]=We):We=e[68];let Ge;e[69]===Ue?Ge=e[70]:(Ge=(0,Z.jsxs)(Hs,{children:[Ue,We]}),e[69]=Ue,e[70]=Ge);let Ke;e[71]!==Ae||e[72]!==Be||e[73]!==Ge?(Ke=(0,Z.jsxs)(`div`,{className:Ae,children:[Be,Ge]}),e[71]=Ae,e[72]=Be,e[73]=Ge,e[74]=Ke):Ke=e[74];let qe;return e[75]!==De||e[76]!==Oe||e[77]!==ke||e[78]!==Ke?(qe=(0,Z.jsx)(`div`,{ref:E,"data-electron-drag":De,className:Oe,onWheel:ke,children:Ke}),e[75]=De,e[76]=Oe,e[77]=ke,e[78]=Ke,e[79]=qe):qe=e[79],qe}var qF=(e,t,n)=>{if(e&&`reportValidity`in e){let r=Li(n,t);e.setCustomValidity(r&&r.message||``),e.reportValidity()}},JF=(e,t)=>{for(let n in t.fields){let r=t.fields[n];r&&r.ref&&`reportValidity`in r.ref?qF(r.ref,n,e):r&&r.refs&&r.refs.forEach(t=>qF(t,n,e))}},YF=(e,t)=>{t.shouldUseNativeValidation&&JF(e,t);let n={};for(let r in e){let i=Li(t.fields,r),a=Object.assign(e[r]||{},{ref:i&&i.ref});if(XF(t.names||Object.keys(e),r)){let e=Object.assign({},Li(n,r));Ki(e,`root`,a),Ki(n,r,e)}else Ki(n,r,a)}return n},XF=(e,t)=>{let n=ZF(t).replace(/[.*+?^${}()|\\]/g,`\\$&`);return e.some(e=>ZF(e).match(`^${n}\\.\\d+`))};function ZF(e){return e.replace(/[\[\]]/g,``)}function QF(){return QF=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},QF.apply(null,arguments)}function $F(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}function eI(e,t){for(var n={};e.length;){var r=e[0],i=r.code,a=r.message,o=r.path.join(`.`);if(!n[o])if(`unionErrors`in r){var s=r.unionErrors[0].errors[0];n[o]={message:s.message,type:s.code}}else n[o]={message:a,type:i};if(`unionErrors`in r&&r.unionErrors.forEach(function(t){return t.errors.forEach(function(t){return e.push(t)})}),t){var c=n[o].types,l=c&&c[r.code];n[o]=Ri(o,t,n,i,l?[].concat(l,r.message):r.message)}e.shift()}return n}function tI(e,t){for(var n={},r=function(){var r=e[0],i=r.code,a=r.message,o=r.path.join(`.`);if(!n[o])if(r.code===`invalid_union`&&r.errors.length>0){var s=r.errors[0][0];n[o]={message:s.message,type:s.code}}else n[o]={message:a,type:i};if(r.code===`invalid_union`&&r.errors.forEach(function(t){return t.forEach(function(t){return e.push(QF({},t,{path:[].concat(r.path,t.path)}))})}),t){var c=n[o].types,l=c&&c[r.code];n[o]=Ri(o,t,n,i,l?[].concat(l,r.message):r.message)}e.shift()};e.length;)r();return n}function nI(e,t,n){if(n===void 0&&(n={}),function(e){return`_def`in e&&typeof e._def==`object`&&`typeName`in e._def}(e))return function(r,i,a){try{return Promise.resolve($F(function(){return Promise.resolve(e[n.mode===`sync`?`parse`:`parseAsync`](r,t)).then(function(e){return a.shouldUseNativeValidation&&JF({},a),{errors:{},values:n.raw?Object.assign({},r):e}})},function(e){if(function(e){return Array.isArray(e?.issues)}(e))return{values:{},errors:YF(eI(e.errors,!a.shouldUseNativeValidation&&a.criteriaMode===`all`),a)};throw e}))}catch(e){return Promise.reject(e)}};if(function(e){return`_zod`in e&&typeof e._zod==`object`}(e))return function(r,i,a){try{return Promise.resolve($F(function(){return Promise.resolve((n.mode===`sync`?hr:Xn)(e,r,t)).then(function(e){return a.shouldUseNativeValidation&&JF({},a),{errors:{},values:n.raw?Object.assign({},r):e}})},function(e){if(function(e){return e instanceof mr}(e))return{values:{},errors:YF(tI(e.issues,!a.shouldUseNativeValidation&&a.criteriaMode===`all`),a)};throw e}))}catch(e){return Promise.reject(e)}};throw Error(`Invalid input: not a Zod schema`)}var rI=`https://openknowledge.ai/api/subscribe`;async function iI(e){try{let t=await fetch(rI,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({email:e}),signal:AbortSignal.timeout(15e3)});return t.ok?{ok:!0}:t.status===400?{ok:!1,reason:`invalid`}:t.status===503?{ok:!1,reason:`unavailable`}:(console.warn(`[subscribe] action=submit result=http-error status=${t.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 aI(e){let t=(0,$.c)(48),{title:n,description:r,onSuccess:i,onDismiss:a,autoFocus:o,compactSubmit:s,className:c}=e,{_:l}=rn(),[u,d]=(0,Q.useState)(!1),f=(0,Q.useRef)(null),p,m;t[0]===u?(p=t[1],m=t[2]):(p=()=>{u&&f.current?.focus()},m=[u],t[0]=u,t[1]=p,t[2]=m),(0,Q.useEffect)(p,m);let h,g;if(t[3]!==l){let e=_i({email:er({message:l({id:`Wq6Wcm`})})});g=ha,h=nI(e),t[3]=l,t[4]=h,t[5]=g}else h=t[4],g=t[5];let _;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(_={email:``},t[6]=_):_=t[6];let v;t[7]===h?v=t[8]:(v={resolver:h,defaultValues:_},t[7]=h,t[8]=v);let y=g(v),{isSubmitting:b}=y.formState,x=y.formState.errors.email?.message??y.formState.errors.root?.message,S;t[9]!==l||t[10]!==y||t[11]!==i?(S=async function(e){y.clearErrors(`root`);let t=await iI(e.email);if(t.ok){d(!0),i?.();return}if(t.reason===`invalid`){y.setError(`email`,{message:l({id:`Wq6Wcm`})});return}if(t.reason===`unavailable`){y.setError(`root`,{message:l({id:`4mLBx9`})});return}y.setError(`root`,{message:l({id:`fWsBTs`})})},t[9]=l,t[10]=y,t[11]=i,t[12]=S):S=t[12];let C=S,w;t[13]===c?w=t[14]:(w=X(`flex flex-col gap-3`,c),t[13]=c,t[14]=w);let T=u?-1:void 0,E;t[15]!==u||t[16]!==n?(E=u?(0,Z.jsxs)(`span`,{className:`mb-1.5 inline-flex flex-row items-center gap-2`,children:[(0,Z.jsx)(Ya,{className:`size-4 text-primary`}),(0,Z.jsx)(Y,{id:`PIMM5l`})]}):n??(0,Z.jsx)(Y,{id:`GzPQ2f`}),t[15]=u,t[16]=n,t[17]=E):E=t[17];let D;t[18]!==E||t[19]!==T?(D=(0,Z.jsx)(`p`,{ref:f,tabIndex:T,className:`text-sm font-medium leading-tight text-foreground focus:outline-none`,children:E}),t[18]=E,t[19]=T,t[20]=D):D=t[20];let O;t[21]!==r||t[22]!==u?(O=u?(0,Z.jsx)(Y,{id:`pBROkv`}):r??(0,Z.jsx)(Y,{id:`WmPbvm`}),t[21]=r,t[22]=u,t[23]=O):O=t[23];let k;t[24]===O?k=t[25]:(k=(0,Z.jsx)(`p`,{className:`text-1sm text-muted-foreground`,role:`status`,children:O}),t[24]=O,t[25]=k);let A;t[26]!==D||t[27]!==k?(A=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[D,k]}),t[26]=D,t[27]=k,t[28]=A):A=t[28];let j;t[29]!==l||t[30]!==a?(j=a?(0,Z.jsx)(Ci,{type:`button`,variant:`ghost`,size:`icon`,onClick:a,"aria-label":l({id:`yz7wBu`}),className:`-mr-1.5 -mt-1 size-7 shrink-0 text-muted-foreground opacity-60`,children:(0,Z.jsx)(xs,{className:`size-4`})}):null,t[29]=l,t[30]=a,t[31]=j):j=t[31];let M;t[32]!==A||t[33]!==j?(M=(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[A,j]}),t[32]=A,t[33]=j,t[34]=M):M=t[34];let N;t[35]!==l||t[36]!==o||t[37]!==s||t[38]!==x||t[39]!==y||t[40]!==b||t[41]!==C||t[42]!==u?(N=u?null:(0,Z.jsxs)(`form`,{onSubmit:y.handleSubmit(C),className:`flex flex-col gap-2`,noValidate:!0,children:[(0,Z.jsx)(Ma,{control:y.control,name:`email`,render:e=>{let{field:t,fieldState:n}=e;return(0,Z.jsxs)(vE,{className:`h-10 rounded-xl`,children:[(0,Z.jsx)(bE,{className:`pl-2.5`,children:(0,Z.jsx)(Hd,{className:`size-4 text-muted-foreground opacity-60`})}),(0,Z.jsx)(CE,{...t,id:t.name,type:`email`,inputMode:`email`,autoComplete:`email`,spellCheck:!1,autoFocus:o,placeholder:l({id:`2hYmUH`}),"aria-invalid":n.invalid,"aria-label":l({id:`ATGYL1`}),"data-testid":`subscribe-email`,className:`placeholder:text-muted-foreground/60`}),(0,Z.jsx)(Ci,{type:`submit`,disabled:b,size:s?`icon`:`default`,className:X(`mr-1 ml-auto text-1sm`,s&&`size-8 shrink-0 rounded-lg`),"data-testid":`subscribe-submit`,children:b?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Vo,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(Y,{id:`lCC_D5`})})]}):s?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Na,{className:`size-4`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(Y,{id:`EDl9kS`})})]}):(0,Z.jsx)(Y,{id:`EDl9kS`})})]})}}),x?(0,Z.jsx)(`p`,{className:`text-sm text-destructive`,role:`alert`,children:x}):null]}),t[35]=l,t[36]=o,t[37]=s,t[38]=x,t[39]=y,t[40]=b,t[41]=C,t[42]=u,t[43]=N):N=t[43];let P;return t[44]!==M||t[45]!==N||t[46]!==w?(P=(0,Z.jsxs)(`div`,{className:w,children:[M,N]}),t[44]=M,t[45]=N,t[46]=w,t[47]=P):P=t[47],P}var oI=`https://github.com/inkeep/open-knowledge`,sI=`https://discord.com/invite/YujKpFN49`,cI=`https://x.com/OpenKnowledgeAI`;function lI(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 uI(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 dI=[{key:`resources`,heading:{id:`s-MGs7`},links:[{label:{id:`TbjyhA`},href:`https://openknowledge.ai/docs`,icon:y},{label:{id:`PCNIuJ`},href:`${oI}/issues/new`,icon:pd},{label:{id:`On0aF2`},href:`https://openknowledge.ai/`,icon:co}]},{key:`community`,heading:{id:`chL5IG`},links:[{label:`Discord`,href:sI,icon:lI},{label:`X (Twitter)`,href:cI,icon:uI},{label:`GitHub`,href:oI,icon:Lm}]}],fI=`${oI}/releases`,pI=`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 mI(e){if(e<1e3)return String(e);let t=e/1e3;return`${t>=10?Math.round(t):t.toFixed(1)}k`}var hI=e=>{let t=(0,$.c)(12),{count:n}=e,{_:r}=rn(),i,a,o,s;t[0]!==r||t[1]!==n?(i=mI(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)(_f,{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},gI=e=>{let t=(0,$.c)(15),{link:n,trailing:r}=e,{_:i}=rn(),{label:a,href:o,icon:s}=n,c,l;t[0]===o?(c=t[1],l=t[2]):(c=e=>js(e,o),l=e=>js(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:pI,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},_I=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},vI=()=>{let e=(0,$.c)(28),{_:t}=rn(),[n,r]=(0,Q.useState)(!1),[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(null),c,l;e[0]!==n||e[1]!==o?(c=()=>{if(!n||o!==null)return;let e=new AbortController;return Or({signal:e.signal}).then(e=>{e!==null&&s(e)}),()=>e.abort()},l=[n,o],e[0]=n,e[1]=o,e[2]=c,e[3]=l):(c=e[2],l=e[3]),(0,Q.useEffect)(c,l);let u;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(u=e=>{r(e),e||a(!1)},e[4]=u):u=e[4];let d;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(J,{className:`size-4`}),e[5]=d):d=e[5];let f;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(zs,{asChild:!0,children:(0,Z.jsx)(j,{asChild:!0,children:(0,Z.jsxs)(Ci,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,children:[d,(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(Y,{id:`s-MGs7`})})]})})}),e[6]=f):f=e[6];let p;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsxs)(Hs,{children:[f,(0,Z.jsx)(Bs,{children:(0,Z.jsx)(Y,{id:`s-MGs7`})})]}),e[7]=p):p=e[7];let m;e[8]!==t||e[9]!==o?(m=dI.map((e,n)=>(0,Z.jsxs)(`div`,{className:X(n>0&&`mt-3`),children:[(0,Z.jsx)(_I,{children:t(e.heading)}),(0,Z.jsx)(`nav`,{"aria-label":t(e.heading),children:(0,Z.jsx)(`ul`,{className:`space-y-0.5`,children:e.links.map(e=>(0,Z.jsx)(gI,{link:e,trailing:e.href===`https://github.com/inkeep/open-knowledge`&&o!==null?(0,Z.jsx)(hI,{count:o}):void 0},e.href))})})]},e.key)),e[8]=t,e[9]=o,e[10]=m):m=e[10];let h;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(_I,{children:(0,Z.jsx)(Y,{id:`arUUsK`})}),e[11]=h):h=e[11];let g;e[12]===t?g=e[13]:(g=t({id:`arUUsK`}),e[12]=t,e[13]=g);let _;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(gI,{link:{label:{id:`3ePd3I`},href:fI,icon:Wd}}),e[14]=_):_=e[14];let v;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(j,{asChild:!0,children:(0,Z.jsxs)(Ci,{variant:`ghost`,className:X(pI,`h-auto w-full justify-start font-normal`),children:[(0,Z.jsx)(Hd,{"aria-hidden":`true`,className:`size-4 shrink-0`}),(0,Z.jsx)(Y,{id:`EDl9kS`})]})}),e[15]=v):v=e[15];let y;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(wt,{side:`left`,align:`center`,sideOffset:20,className:`w-80`,children:(0,Z.jsx)(aI,{autoFocus:!0,onDismiss:()=>a(!1),onSuccess:yI})}),e[16]=y):y=e[16];let b;e[17]===i?b=e[18]:(b=(0,Z.jsxs)(`ul`,{className:`space-y-0.5`,children:[_,(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(w,{open:i,onOpenChange:a,children:[v,y]})})]}),e[17]=i,e[18]=b);let x;e[19]!==b||e[20]!==g?(x=(0,Z.jsxs)(`div`,{className:`mt-3`,children:[h,(0,Z.jsx)(`nav`,{"aria-label":g,children:b})]}),e[19]=b,e[20]=g,e[21]=x):x=e[21];let S;e[22]!==x||e[23]!==m?(S=(0,Z.jsxs)(wt,{align:`end`,className:`w-56 p-3`,children:[m,x]}),e[22]=x,e[23]=m,e[24]=S):S=e[24];let C;return e[25]!==n||e[26]!==S?(C=(0,Z.jsxs)(w,{open:n,onOpenChange:u,children:[p,S]}),e[25]=n,e[26]=S,e[27]=C):C=e[27],C};function yI(){return Wg.markSubscribed()}var bI=50,xI=()=>{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,rE.preload()},bI))},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=Qi)},l=(0,Z.jsx)(lf,{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)(zs,{asChild:!0,children:(0,Z.jsxs)(Ci,{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)(Y,{id:`Tz0i8g`})})]})}),e[6]=u):u=e[6];let d;return e[7]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsxs)(Hs,{children:[u,(0,Z.jsx)(Bs,{children:(0,Z.jsx)(Y,{id:`Tz0i8g`})})]}),e[7]=d):d=e[7],d},SI=`https://openknowledge.ai/docs/features/share`;function CI(e){let t=(0,$.c)(42),{input:n,onClickWhenNoRemote:r}=e,{_:i}=rn(),{status:a}=$i(),[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;t[4]!==i||t[5]!==o||t[6]!==p||t[7]!==n||t[8]!==r?(h=async function(){if(!o&&n!==null){s(!0),l(null);try{let e=await zi({...n,hasRemote:p,onClickWhenNoRemote:r},{clipboardWrite:jo,toastSuccess:jI,toastError:AI,logEvent:kI});e.kind===`copied`?l({url:e.shareUrl,autoCopyFailed:!1}):e.kind===`clipboard-failed`&&l({url:e.shareUrl,autoCopyFailed:!0})}catch{bs.error(i({id:`u3YnKw`}))}s(!1)}},t[4]=i,t[5]=o,t[6]=p,t[7]=n,t[8]=r,t[9]=h):h=t[9];let g=h,_=c!==null,v;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(v=e=>{e||l(null)},t[10]=v):v=t[10];let y;t[11]!==i||t[12]!==n?.kind?(y=n?.kind===`folder`?i({id:`WR0y2O`}):i({id:`F4IYWe`}),t[11]=i,t[12]=n?.kind,t[13]=y):y=t[13];let b=o||m,x,S;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(uf,{className:`size-3.5`,"aria-hidden":!0}),S=(0,Z.jsx)(Y,{id:`Z8lGw6`}),t[14]=x,t[15]=S):(x=t[14],S=t[15]);let C;t[16]!==g||t[17]!==y||t[18]!==b?(C=(0,Z.jsx)(P,{asChild:!0,children:(0,Z.jsxs)(Ci,{variant:`ghost`,size:`sm`,"aria-label":y,onClick:g,disabled:b,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`share-button`,children:[x,S]})}),t[16]=g,t[17]=y,t[18]=b,t[19]=C):C=t[19];let T;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(`p`,{className:`font-mono tracking-wide uppercase text-muted-foreground text-xs`,children:(0,Z.jsx)(Y,{id:`Z8lGw6`})}),t[20]=T):T=t[20];let E;t[21]===c?.autoCopyFailed?E=t[22]:(E=c?.autoCopyFailed?(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`ndeI89`})}):null,t[21]=c?.autoCopyFailed,t[22]=E);let D=c?.url??``,O;t[23]===i?O=t[24]:(O=i({id:`5-FeN2`}),t[23]=i,t[24]=O);let k;t[25]!==D||t[26]!==O?(k=(0,Z.jsx)(zc,{ref:u,readOnly:!0,value:D,onFocus:OI,onClick:DI,onContextMenu:EI,className:`select-all bg-muted font-mono text-xs text-muted-foreground`,"data-testid":`share-button-url`,"aria-label":O}),t[25]=D,t[26]=O,t[27]=k):k=t[27];let A=c?.url??``,j=c?.autoCopyFailed===!1,M;t[28]!==A||t[29]!==j?(M=(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)(z,{copyContent:A,clipboardWrite:jo,initialCopied:j})})}),t[28]=A,t[29]=j,t[30]=M):M=t[30];let N;t[31]!==k||t[32]!==M?(N=(0,Z.jsxs)(`div`,{className:`relative`,children:[k,M]}),t[31]=k,t[32]=M,t[33]=N):N=t[33];let F;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsxs)(`a`,{href:SI,target:`_blank`,rel:`noopener noreferrer`,onClick:TI,onAuxClick:wI,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)(J,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(Y,{id:`aByJ8j`})]}),t[34]=F):F=t[34];let I;t[35]!==E||t[36]!==N?(I=(0,Z.jsxs)(wt,{align:`end`,className:`flex w-80 flex-col gap-2`,"data-testid":`share-button-popover`,children:[T,E,N,F]}),t[35]=E,t[36]=N,t[37]=I):I=t[37];let L;return t[38]!==C||t[39]!==I||t[40]!==_?(L=(0,Z.jsxs)(w,{open:_,onOpenChange:v,children:[C,I]}),t[38]=C,t[39]=I,t[40]=_,t[41]=L):L=t[41],L}function wI(e){return js(e,SI)}function TI(e){return js(e,SI)}function EI(e){return e.currentTarget.select()}function DI(e){return e.currentTarget.select()}function OI(e){return e.currentTarget.select()}function kI(e){return console.log(e)}function AI(e){e!==`Link ready but could not copy to clipboard.`&&bs.error(e)}function jI(e){return bs.success(e)}function MI(e){let t=(0,$.c)(43),{onSignIn:n,onSetIdentity:r,onOpenSearch:i,terminalAvailable:a,terminalVisible:s,onToggleChat:c}=e,{_:l}=rn(),u;t[0]!==l||t[1]!==s?(u=l(s?{id:`pqZJT2`}:{id:`6I7cJR`}),t[0]=l,t[1]=s,t[2]=u):u=t[2];let d=u,{activeDocName:f,activeTarget:p}=ft(),m=f?Qr(f):null,{state:h,isDraggingRail:g}=cN(),_=ty(),v;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(v=Cl(`toggle-files-sidebar`),t[3]=v):v=t[3];let y=v,b=Cl(`command-palette`),[x,S]=(0,Q.useState)(!1),C;bb0:{if(p?.kind===`folder`){let e;t[4]===p.folderPath?e=t[5]:(e=qi(p.folderPath),t[4]=p.folderPath,t[5]=e),C=e;break bb0}if(f&&!m){let e;t[6]===f?e=t[7]:(e=Gi(f),t[6]=f,t[7]=e),C=e;break bb0}if(!p&&!f){let e;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(e=qi(``),t[8]=e):e=t[8],C=e;break bb0}C=null}let w=C,T=typeof window<`u`&&window.okDesktop!=null,E=h===`collapsed`,D=T?``:void 0,O=T&&E&&`pl-[var(--ok-titlebar-reserve-left,1rem)]`,k=T&&!g&&`motion-safe:transition-[padding] motion-safe:duration-200 motion-safe:ease-linear`,A;t[9]!==O||t[10]!==k?(A=X(`flex h-12 shrink-0 items-center bg-muted/35 shadow-[inset_0_-1px_0_var(--border)]`,T&&`[-webkit-app-region:drag]`,O,k),t[9]=O,t[10]=k,t[11]=A):A=t[11];let j=!_&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Hs,{children:[(0,Z.jsx)(zs,{asChild:!0,children:(0,Z.jsx)(pN,{className:X(`-ml-1 shrink-0 text-muted-foreground`,T&&`[-webkit-app-region:no-drag]`)})}),(0,Z.jsx)(Bs,{children:h===`expanded`?(0,Z.jsx)(Y,{id:`ZxXhLY`,values:{sidebarShortcut:y}}):(0,Z.jsx)(Y,{id:`Zz25kq`,values:{sidebarShortcut:y}})})]}),E&&i&&(0,Z.jsxs)(Hs,{children:[(0,Z.jsx)(zs,{asChild:!0,children:(0,Z.jsx)(Ci,{variant:`ghost`,size:`icon-sm`,onClick:i,"aria-label":l({id:`IN4UX8`,values:{searchShortcut:b}}),"data-telemetry-event":`ok.editor_header.search.click`,className:X(`shrink-0 text-muted-foreground`,T&&`[-webkit-app-region:no-drag]`),children:(0,Z.jsx)(o,{"aria-hidden":`true`})})}),(0,Z.jsx)(Bs,{children:(0,Z.jsx)(Y,{id:`IN4UX8`,values:{searchShortcut:b}})})]}),(0,Z.jsx)(ra,{orientation:`vertical`,className:`mr-1 h-4 shrink-0 data-vertical:self-center`}),(0,Z.jsx)(KF,{})]}),M;t[12]===j?M=t[13]:(M=(0,Z.jsx)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1 px-3`,children:j}),t[12]=j,t[13]=M);let N;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(N=X(`flex shrink-0 items-center justify-end gap-2 px-3`,T&&`[&>*]:[-webkit-app-region:no-drag]`),t[14]=N):N=t[14];let P;t[15]!==x||t[16]!==S||t[17]!==w||t[18]!==_?(P=!_&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(CI,{input:w,onClickWhenNoRemote:()=>S(!0)}),(0,Z.jsx)(Ii,{open:x,onOpenChange:S})]}),t[15]=x,t[16]=S,t[17]=w,t[18]=_,t[19]=P):P=t[19];let F;t[20]!==r||t[21]!==n?(F=(0,Z.jsx)(Aa,{onSignIn:n,onSetIdentity:r}),t[20]=r,t[21]=n,t[22]=F):F=t[22];let I;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(JP,{}),t[23]=I):I=t[23];let L;t[24]!==d||t[25]!==c||t[26]!==a?(L=a&&(0,Z.jsxs)(Hs,{children:[(0,Z.jsx)(zs,{asChild:!0,children:(0,Z.jsx)(Ci,{variant:`ghost`,size:`icon-sm`,onClick:()=>c?.(),"aria-label":d,"data-telemetry-event":`ok.editor_header.toggle_chat.click`,className:X(`shrink-0 text-muted-foreground`,T&&`[-webkit-app-region:no-drag]`),children:(0,Z.jsx)(Gd,{"aria-hidden":`true`})})}),(0,Z.jsx)(Bs,{children:d})]}),t[24]=d,t[25]=c,t[26]=a,t[27]=L):L=t[27];let R,z;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Z.jsx)(ra,{orientation:`vertical`,className:`h-4 shrink-0 data-vertical:self-center`}),z=(0,Z.jsx)(sm,{}),t[28]=R,t[29]=z):(R=t[28],z=t[29]);let B;t[30]===_?B=t[31]:(B=!_&&(0,Z.jsx)(xI,{}),t[30]=_,t[31]=B);let V;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Z.jsx)(vI,{}),t[32]=V):V=t[32];let H;t[33]!==P||t[34]!==F||t[35]!==L||t[36]!==B?(H=(0,Z.jsxs)(`div`,{className:N,children:[P,F,I,L,R,z,B,V]}),t[33]=P,t[34]=F,t[35]=L,t[36]=B,t[37]=H):H=t[37];let U;return t[38]!==M||t[39]!==H||t[40]!==D||t[41]!==A?(U=(0,Z.jsxs)(`header`,{"data-electron-drag":D,className:A,children:[M,H]}),t[38]=M,t[39]=H,t[40]=D,t[41]=A,t[42]=U):U=t[42],U}var NI=`open-knowledge:terminal-launch`;function PI(e,t,n=typeof window>`u`?new EventTarget:window){n.dispatchEvent(new CustomEvent(NI,{detail:{prompt:e,cli:t}}))}function FI(e,t=typeof window>`u`?new EventTarget:window){let n=t=>{let n=t instanceof CustomEvent?t.detail:void 0;n&&typeof n.prompt==`string`&&e(n.prompt,n.cli)};return t.addEventListener(NI,n),()=>t.removeEventListener(NI,n)}function II(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,orientation:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`horizontal`:i,o;t[4]===n?o=t[5]:(o=X(`group/tabs flex gap-2 data-horizontal:flex-col`,n),t[4]=n,t[5]=o);let s;return t[6]!==a||t[7]!==r||t[8]!==o?(s=(0,Z.jsx)(tm,{"data-slot":`tabs`,"data-orientation":a,className:o,...r}),t[6]=a,t[7]=r,t[8]=o,t[9]=s):s=t[9],s}var LI=xi(`group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function RI(e){let t=(0,$.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,variant:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`default`:i,o;t[4]!==n||t[5]!==a?(o=X(LI({variant:a}),n),t[4]=n,t[5]=a,t[6]=o):o=t[6];let s;return t[7]!==r||t[8]!==o||t[9]!==a?(s=(0,Z.jsx)(nm,{"data-slot":`tabs-list`,"data-variant":a,className:o,...r}),t[7]=r,t[8]=o,t[9]=a,t[10]=s):s=t[10],s}function zI(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=X(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent`,`data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(rm,{"data-slot":`tabs-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function BI(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=X(`flex-1 text-sm outline-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(im,{"data-slot":`tabs-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var VI=(0,Q.lazy)(()=>n(()=>import(`./TerminalPanel-C7GMKqtO.js`).then(e=>({default:e.TerminalPanel})),__vite__mapDeps([81,1,30,3,7,31,6,10,13,11,82,62,44,83]),import.meta.url));function HI(e){let t=(0,$.c)(14),{bridge:n,onClose:r,onTitleChange:i,launch:a,adoptPtyId:o,onPtyId:s}=e,c=a===void 0?null:a,l=o===void 0?null:o,{enabled:u,synced:d}=ua(),f=ta(),{_:p}=rn(),m=d&&u===!1,g;t[0]!==p||t[1]!==f?(g=function(){if(f===null){bs.error(p({id:`V_6bJ4`}));return}let e=f(!0);e.ok||bs.error(p({id:`jKd3AP`,values:{0:e.error}}))},t[0]=p,t[1]=f,t[2]=g):g=t[2];let _=g;if(d&&!m){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(`div`,{className:`h-full w-full bg-background`,"aria-hidden":`true`}),t[3]=e):e=t[3];let a;return t[4]!==l||t[5]!==n||t[6]!==c||t[7]!==r||t[8]!==s||t[9]!==i?(a=(0,Z.jsx)(h,{fallbackRender:WI,onError:UI,children:(0,Z.jsx)(Q.Suspense,{fallback:e,children:(0,Z.jsx)(VI,{bridge:n,className:`h-full`,onClose:r,onTitleChange:i,launch:c,adoptPtyId:l,onPtyId:s})})}),t[4]=l,t[5]=n,t[6]=c,t[7]=r,t[8]=s,t[9]=i,t[10]=a):a=t[10],a}let v;return t[11]!==_||t[12]!==m?(v=m?(0,Z.jsx)(qI,{onEnable:_}):(0,Z.jsx)(`div`,{className:`h-full w-full bg-background`,"aria-hidden":`true`}),t[11]=_,t[12]=m,t[13]=v):v=t[13],v}function UI(e,t){console.error(`[TerminalGate] rendered fallback for the terminal panel`,e,t.componentStack)}function WI(e){return(0,Z.jsx)(GI,{...e})}function GI(e){let t=(0,$.c)(15),{error:n}=e,{_:r}=rn(),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:`fbsiBw`}),t[0]=r,t[1]=n,t[2]=i):i=t[2];let a=i,o;t[3]===r?o=t[4]:(o=r({id:`6MnZEC`}),t[3]=r,t[4]=o);let s;t[5]===a?s=t[6]:(s=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-foreground`,children:a}),t[5]=a,t[6]=s);let c;t[7]===r?c=t[8]:(c=r({id:`HpK_8d`}),t[7]=r,t[8]=c);let l;t[9]===c?l=t[10]:(l=(0,Z.jsx)(Ci,{onClick:KI,children:c}),t[9]=c,t[10]=l);let u;return t[11]!==o||t[12]!==s||t[13]!==l?(u=(0,Z.jsxs)(`section`,{"aria-label":o,className:`flex h-full w-full flex-col items-center justify-center gap-3 bg-background p-6 text-center`,role:`alert`,children:[s,l]}),t[11]=o,t[12]=s,t[13]=l,t[14]=u):u=t[14],u}function KI(){return window.location.reload()}function qI(e){let t=(0,$.c)(20),{onEnable:n}=e,{_:r}=rn(),i;t[0]===r?i=t[1]:(i=r({id:`_XWY2J`}),t[0]=r,t[1]=i);let a;t[2]===r?a=t[3]:(a=r({id:`oYepHb`}),t[2]=r,t[3]=a);let o;t[4]===a?o=t[5]:(o=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-foreground`,children:a}),t[4]=a,t[5]=o);let s;t[6]===r?s=t[7]:(s=r({id:`v2ZW0K`}),t[6]=r,t[7]=s);let c;t[8]!==n||t[9]!==s?(c=(0,Z.jsx)(Ci,{onClick:n,children:s}),t[8]=n,t[9]=s,t[10]=c):c=t[10];let l;t[11]===r?l=t[12]:(l=r({id:`ICoNYz`}),t[11]=r,t[12]=l);let u;t[13]===l?u=t[14]:(u=(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:l}),t[13]=l,t[14]=u);let d;return t[15]!==i||t[16]!==o||t[17]!==c||t[18]!==u?(d=(0,Z.jsxs)(`section`,{"aria-label":i,className:`flex h-full w-full flex-col items-center justify-center gap-3 bg-background p-6 text-center`,children:[o,c,u]}),t[15]=i,t[16]=o,t[17]=c,t[18]=u,t[19]=d):d=t[19],d}function JI(e){let t=(0,$.c)(74),{sessions:n,activeSessionId:r,onSelect:i,onTabActivate:a,onNewChat:o,onNewTerminalTab:s,onClose:c,dockPosition:l,onToggleDock:u,onCollapse:d,children:f,className:p}=e,{_:m}=rn(),h=l===`right`,g;t[0]===p?g=t[1]:(g=X(`flex min-h-0 min-w-0 flex-1 flex-col`,p),t[0]=p,t[1]=g);let _;t[2]===m?_=t[3]:(_=m({id:`1MGRQl`}),t[2]=m,t[3]=_);let v;if(t[4]!==m||t[5]!==r||t[6]!==c||t[7]!==a||t[8]!==n){let e;t[10]!==m||t[11]!==r||t[12]!==c||t[13]!==a?(e=e=>{let t=e.id===r;return(0,Z.jsxs)(`div`,{className:X(`group flex shrink-0 cursor-default items-center rounded-md pr-0.5 transition-colors`,t?`bg-muted`:`hover:bg-muted/50`),children:[(0,Z.jsx)(zI,{value:e.id,onClick:()=>a?.(e.id),className:`h-7 flex-none rounded-md px-2 text-xs`,children:(0,Z.jsx)(`span`,{className:`max-w-40 truncate`,children:e.label})}),(0,Z.jsx)(Ci,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":m({id:`nzHlj8`,values:{0:e.label}}),tabIndex:t?0:-1,className:X(`text-muted-foreground opacity-0 transition-opacity hover:text-foreground group-hover:opacity-100 group-focus-within:opacity-100`,t&&`opacity-100`),onClick:t=>{t.stopPropagation(),c(e.id)},children:(0,Z.jsx)(xs,{"aria-hidden":`true`})})]},e.id)},t[10]=m,t[11]=r,t[12]=c,t[13]=a,t[14]=e):e=t[14],v=n.map(e),t[4]=m,t[5]=r,t[6]=c,t[7]=a,t[8]=n,t[9]=v}else v=t[9];let y;t[15]!==_||t[16]!==v?(y=(0,Z.jsx)(RI,{variant:`line`,"aria-label":_,className:`flex h-auto min-w-0 items-center justify-start gap-0.5 overflow-x-auto bg-transparent p-0 [scrollbar-width:none] scroll-fade-mask-x`,children:v}),t[15]=_,t[16]=v,t[17]=y):y=t[17];let b;t[18]===m?b=t[19]:(b=m({id:`hIQkLb`}),t[18]=m,t[19]=b);let x;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(It,{"aria-hidden":`true`}),t[20]=x):x=t[20];let S;t[21]!==o||t[22]!==b?(S=(0,Z.jsx)(zs,{asChild:!0,children:(0,Z.jsx)(Ci,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":b,className:`shrink-0 cursor-pointer text-muted-foreground hover:text-foreground`,onClick:o,children:x})}),t[21]=o,t[22]=b,t[23]=S):S=t[23];let C;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(Bs,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(Y,{id:`hIQkLb`})}),t[24]=C):C=t[24];let w;t[25]===S?w=t[26]:(w=(0,Z.jsxs)(Hs,{children:[S,C]}),t[25]=S,t[26]=w);let T;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(`div`,{className:`flex-1`}),t[27]=T):T=t[27];let E;t[28]===m?E=t[29]:(E=m({id:`k0vc0N`}),t[28]=m,t[29]=E);let D;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsx)(hf,{"aria-hidden":`true`}),t[30]=D):D=t[30];let O;t[31]!==s||t[32]!==E?(O=(0,Z.jsx)(zs,{asChild:!0,children:(0,Z.jsx)(Ci,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":E,className:`shrink-0 cursor-pointer text-muted-foreground hover:text-foreground`,onClick:s,children:D})}),t[31]=s,t[32]=E,t[33]=O):O=t[33];let k;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Z.jsx)(Bs,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(Y,{id:`k0vc0N`})}),t[34]=k):k=t[34];let A;t[35]===O?A=t[36]:(A=(0,Z.jsxs)(Hs,{children:[O,k]}),t[35]=O,t[36]=A);let j;t[37]!==m||t[38]!==h?(j=m(h?{id:`rf6x3F`}:{id:`QNxpRm`}),t[37]=m,t[38]=h,t[39]=j):j=t[39];let M;t[40]===h?M=t[41]:(M=h?(0,Z.jsx)(Yd,{"aria-hidden":`true`}):(0,Z.jsx)($d,{"aria-hidden":`true`}),t[40]=h,t[41]=M);let N;t[42]!==u||t[43]!==j||t[44]!==M?(N=(0,Z.jsx)(zs,{asChild:!0,children:(0,Z.jsx)(Ci,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":j,className:`shrink-0 cursor-pointer text-muted-foreground hover:text-foreground`,onClick:u,children:M})}),t[42]=u,t[43]=j,t[44]=M,t[45]=N):N=t[45];let P;t[46]===h?P=t[47]:(P=(0,Z.jsx)(Bs,{side:`bottom`,sideOffset:8,children:h?(0,Z.jsx)(Y,{id:`rf6x3F`}):(0,Z.jsx)(Y,{id:`QNxpRm`})}),t[46]=h,t[47]=P);let F;t[48]!==N||t[49]!==P?(F=(0,Z.jsxs)(Hs,{children:[N,P]}),t[48]=N,t[49]=P,t[50]=F):F=t[50];let I;t[51]===m?I=t[52]:(I=m({id:`VZGGPK`}),t[51]=m,t[52]=I);let L;t[53]===h?L=t[54]:(L=h?(0,Z.jsx)(io,{"aria-hidden":`true`}):(0,Z.jsx)(ro,{"aria-hidden":`true`}),t[53]=h,t[54]=L);let R;t[55]!==d||t[56]!==I||t[57]!==L?(R=(0,Z.jsx)(zs,{asChild:!0,children:(0,Z.jsx)(Ci,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":I,className:`shrink-0 cursor-pointer text-muted-foreground hover:text-foreground`,onClick:d,children:L})}),t[55]=d,t[56]=I,t[57]=L,t[58]=R):R=t[58];let z;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Z.jsx)(Bs,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(Y,{id:`VZGGPK`})}),t[59]=z):z=t[59];let B;t[60]===R?B=t[61]:(B=(0,Z.jsxs)(Hs,{children:[R,z]}),t[60]=R,t[61]=B);let V;t[62]!==A||t[63]!==F||t[64]!==B||t[65]!==y||t[66]!==w?(V=(0,Z.jsxs)(`div`,{className:`flex shrink-0 flex-row items-center gap-1 px-1.5 py-1`,children:[y,w,T,A,F,B]}),t[62]=A,t[63]=F,t[64]=B,t[65]=y,t[66]=w,t[67]=V):V=t[67];let H;return t[68]!==r||t[69]!==f||t[70]!==i||t[71]!==g||t[72]!==V?(H=(0,Z.jsxs)(II,{value:r,onValueChange:i,className:g,children:[V,f]}),t[68]=r,t[69]=f,t[70]=i,t[71]=g,t[72]=V,t[73]=H):H=t[73],H}function YI(e){return`terminal-session-${e}`}function XI(e){e!==``&&document.querySelector(`[data-terminal-session="${e}"] .xterm-helper-textarea`)?.focus()}function ZI(e){let t=(0,$.c)(68),{bridge:n,visible:r,onVisibleChange:i,launch:a,installedClis:o,container:s,isShowing:c,onRequestEditorFocus:l,dockPosition:u,onToggleDock:d,onHasSessionsChange:f}=e,p=a===void 0?null:a,{_:m}=rn(),[h]=(0,Q.useState)(tL),g,_;t[0]!==s||t[1]!==h?(g=()=>{h==null||s==null||h.parentElement!==s&&s.appendChild(h)},_=[h,s],t[0]=s,t[1]=h,t[2]=g,t[3]=_):(g=t[2],_=t[3]),(0,Q.useLayoutEffect)(g,_);let v=typeof n.terminal?.list==`function`,y;t[4]!==v||t[5]!==p||t[6]!==r?(y=()=>!v&&r?[{id:YI(1),launch:p,title:null,adoptPtyId:null}]:[],t[4]=v,t[5]=p,t[6]=r,t[7]=y):y=t[7];let[b,x]=(0,Q.useState)(y),S;t[8]!==v||t[9]!==r?(S=()=>!v&&r?YI(1):``,t[8]=v,t[9]=r,t[10]=S):S=t[10];let[C,w]=(0,Q.useState)(S),[T,E]=(0,Q.useState)(!v),D=(0,Q.useRef)(!1),O=(0,Q.useRef)(C),k=(0,Q.useRef)(b),A=(0,Q.useRef)(!v&&r?1:0),j=(0,Q.useRef)(r&&p?p.nonce:null),M=(0,Q.useRef)(r),N=(0,Q.useRef)(new Map),P=function(e,t){t===null?N.current.delete(e):N.current.set(e,t)},F=(0,Q.useRef)(0),I;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(I=function(e){A.current+=1;let t=YI(A.current);x(n=>[...n,{id:t,launch:e,title:null,adoptPtyId:null}]),w(t)},t[11]=I):I=t[11];let L=I,R;t[12]===o?R=t[13]:(R=function(){F.current+=1,L({prompt:null,cli:Yy(Ky(),o??{}),nonce:F.current})},t[12]=o,t[13]=R);let z=R,B;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(B=function(e,t){let n=t.trim()===``?null:t.trim();x(t=>t.some(t=>t.id===e&&t.title!==n)?t.map(t=>t.id===e?{...t,title:n}:t):t)},t[14]=B):B=t[14];let V=B,H=(0,Q.useRef)(L),U;t[15]!==C||t[16]!==l||t[17]!==i?(U=function(e){let t=k.current,n=t.findIndex(t=>t.id===e);if(n===-1)return;let r=t.filter(t=>t.id!==e);if(e===C){let e=(t[n-1]??t[n+1])?.id??``;w(e),e!==``&&queueMicrotask(()=>XI(e))}x(r),r.length===0&&(i(!1),l())},t[15]=C,t[16]=l,t[17]=i,t[18]=U):U=t[18];let W=U,G=(0,Q.useRef)(eL),K;t[19]!==C||t[20]!==W||t[21]!==b?(K=()=>{H.current=L,O.current=C,k.current=b,G.current=()=>{C!==``&&W(C)}},t[19]=C,t[20]=W,t[21]=b,t[22]=K):K=t[22],(0,Q.useEffect)(K);let ee,te;t[23]!==p||t[24]!==T||t[25]!==b.length||t[26]!==r?(ee=()=>{if(!T)return;let e=M.current;if(M.current=r,p!=null&&p.nonce!==j.current){j.current=p.nonce,H.current(p);return}r&&!e&&b.length===0&&H.current(null)},te=[r,p,b.length,T],t[23]=p,t[24]=T,t[25]=b.length,t[26]=r,t[27]=ee,t[28]=te):(ee=t[27],te=t[28]),(0,Q.useEffect)(ee,te);let q;t[29]===n.terminal?q=t[30]:(q=()=>{if(typeof n.terminal?.list!=`function`||D.current)return;D.current=!0;let e=!1;return(async()=>{let t;try{t=await n.terminal.list()??[]}catch(e){console.error(`[terminal] reload session list() failed; cold-starting:`,e),t=[]}if(!e){if(t.length>0){let e=t.map($I);A.current=e.length,x(e),w(e[0]?.id??``)}E(!0)}})(),()=>{e=!0,D.current=!1}},t[29]=n.terminal,t[30]=q);let J;t[31]===n?J=t[32]:(J=[n],t[31]=n,t[32]=J),(0,Q.useEffect)(q,J);let ne;t[33]===n?ne=t[34]:(ne=[n],t[33]=n,t[34]=ne),(0,Q.useEffect)(()=>HO(e=>{let t=O.current,r=t===``?void 0:N.current.get(t);r==null?ru():(n.terminal.input(r,e),queueMicrotask(()=>XI(t)))}),ne);let re,ie;t[35]===n?(re=t[36],ie=t[37]):(re=()=>n.onMenuAction(e=>{e===`new-terminal`?H.current(null):e===`kill-terminal`&&G.current()}),ie=[n],t[35]=n,t[36]=re,t[37]=ie),(0,Q.useEffect)(re,ie);let ae,oe;t[38]===h?(ae=t[39],oe=t[40]):(ae=()=>{let e=function(e){if(!e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||!/^[1-9]$/.test(e.key)||h==null||!h.contains(document.activeElement))return;let t=k.current[Number(e.key)-1];t!=null&&(e.preventDefault(),e.stopPropagation(),w(t.id),queueMicrotask(()=>XI(t.id)))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},oe=[h],t[38]=h,t[39]=ae,t[40]=oe),(0,Q.useEffect)(ae,oe);let se;t[41]!==n.editor||t[42]!==b.length?(se=()=>{n.editor.notifyViewMenuStateChanged({terminalLive:b.length>0})},t[41]=n.editor,t[42]=b.length,t[43]=se):se=t[43];let ce;t[44]!==n||t[45]!==b.length?(ce=[n,b.length],t[44]=n,t[45]=b.length,t[46]=ce):ce=t[46],(0,Q.useEffect)(se,ce);let le,ue;t[47]!==f||t[48]!==b.length?(le=()=>{f?.(b.length>0)},ue=[f,b.length],t[47]=f,t[48]=b.length,t[49]=le,t[50]=ue):(le=t[49],ue=t[50]),(0,Q.useEffect)(le,ue);let de,fe;t[51]!==h||t[52]!==c||t[53]!==l||t[54]!==r?(de=()=>{c||r||h==null||!h.contains(document.activeElement)||l()},fe=[c,r,h,l],t[51]=h,t[52]=c,t[53]=l,t[54]=r,t[55]=de,t[56]=fe):(de=t[55],fe=t[56]),(0,Q.useLayoutEffect)(de,fe);let pe,me;t[57]===c?(pe=t[58],me=t[59]):(pe=()=>{c&&XI(O.current)},me=[c],t[57]=c,t[58]=pe,t[59]=me),(0,Q.useEffect)(pe,me);let he;if(t[60]!==m||t[61]!==b){let e;t[63]===m?e=t[64]:(e=(e,t)=>({id:e.id,label:e.title??m({id:`OVjNeX`,values:{0:t+1}})}),t[63]=m,t[64]=e),he=b.map(e),t[60]=m,t[61]=b,t[62]=he}else he=t[62];let ge=he,_e=b.length>0?(0,Z.jsx)(JI,{sessions:ge,activeSessionId:C,onSelect:w,onTabActivate:QI,onNewChat:z,onNewTerminalTab:()=>L(null),onClose:W,dockPosition:u,onToggleDock:d,onCollapse:()=>i(!1),className:`h-full`,children:b.map(e=>(0,Z.jsx)(BI,{value:e.id,forceMount:!0,"data-terminal-session":e.id,className:`m-0 flex min-h-0 flex-1 flex-col overflow-hidden data-[state=inactive]:hidden`,children:(0,Z.jsx)(HI,{bridge:n,launch:e.launch,adoptPtyId:e.adoptPtyId,onPtyId:t=>P(e.id,t),onTitleChange:t=>V(e.id,t),onClose:()=>W(e.id)})},e.id))}):null,ve;return t[65]!==h||t[66]!==_e?(ve=h==null?null:(0,sd.createPortal)(_e,h),t[65]=h,t[66]=_e,t[67]=ve):ve=t[67],ve}function QI(e){return queueMicrotask(()=>XI(e))}function $I(e,t){return{id:YI(t+1),launch:null,title:null,adoptPtyId:e.ptyId}}function eL(){}function tL(){if(typeof document>`u`)return null;let e=document.createElement(`div`);return e.className=`flex min-h-0 flex-1 flex-col overflow-hidden`,e}function nL(e){let t=(0,$.c)(76),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{onOpenSearch:r}=n,[i,a]=Fy(),[o,s]=(0,Q.useState)(i),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(`auth`),[f,p]=(0,Q.useState)(_x[0].id),[m,h]=(0,Q.useState)(!1),g=typeof window<`u`?window.okDesktop??null:null,_=g!=null&&g.terminal!=null,[v,y]=(0,Q.useState)(!1),b=Iy(),[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)(tb),A;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(e){k(e),eb(e),y(!0)},t[2]=A):A=t[2];let j=A,M;t[3]===O?M=t[4]:(M=function(){j(O===`right`?`bottom`:`right`)},t[3]=O,t[4]=M);let N=M,P;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(P={container:null,isShowing:!1,dockPosition:`bottom`,editorRegion:null},t[5]=P):P=t[5];let[F,I]=(0,Q.useState)(P),L=(0,Q.useRef)(0),R;t[6]===b?R=t[7]:(R=function(e){let t=e??Yy(Ky(),b);y(!0),L.current+=1,D({prompt:null,cli:t,nonce:L.current})},t[6]=b,t[7]=R);let z=R,B;t[8]!==x||t[9]!==z||t[10]!==v?(B=function(){if(v){y(!1);return}y(!0),uv(),x||z()},t[8]=x,t[9]=z,t[10]=v,t[11]=B):B=t[11];let V=B,H=Hi(),{projectConfig:U,projectLocalConfig:W,projectLocalSynced:G,projectSynced:K}=Ko(),{activeDocName:ee}=ft(),te=H?.hasRemote,q=H?.pushPermission?.checkStatus,J;t[12]!==m||t[13]!==U||t[14]!==W||t[15]!==G||t[16]!==K||t[17]!==te||t[18]!==q?(J=ib({autoSyncOnboardingDismissed:m,hasRemote:te,projectLocalSynced:G,projectSynced:K,projectLocalConfig:W,projectConfig:U,pushPermissionCheckStatus:q}),t[12]=m,t[13]=U,t[14]=W,t[15]=G,t[16]=K,t[17]=te,t[18]=q,t[19]=J):J=t[19];let ne=J,re,ie;t[20]===ee?(re=t[21],ie=t[22]):(re=()=>{let e=function(e){let t=e.detail;t&&ee&&Yl(ee,{kind:`raw-mdx`,detail:t}),s(`source`)};return window.addEventListener(Dy,e),()=>window.removeEventListener(Dy,e)},ie=[ee],t[20]=ee,t[21]=re,t[22]=ie),(0,Q.useEffect)(re,ie);let ae,oe;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(ae=()=>{let e=window.okDesktop;if(e!=null)return e.onMenuAction(e=>{e===`toggle-terminal`?y(aL):e===`new-terminal`&&y(!0)})},oe=[],t[23]=ae,t[24]=oe):(ae=t[23],oe=t[24]),(0,Q.useEffect)(ae,oe);let se,ce;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(se=()=>{if(window.okDesktop!=null)return;let e=function(e){wl(e,`toggle-terminal-panel`)&&(e.preventDefault(),y(iL))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},ce=[],t[25]=se,t[26]=ce):(se=t[25],ce=t[26]),(0,Q.useEffect)(se,ce);let le,ue;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(le=()=>FI((e,t)=>{y(!0),uv(),L.current+=1,D({prompt:e,cli:t,nonce:L.current})}),ue=[],t[27]=le,t[28]=ue):(le=t[27],ue=t[28]),(0,Q.useEffect)(le,ue);let de,fe;t[29]===v?(de=t[30],fe=t[31]):(de=()=>{v||D(null)},fe=[v],t[29]=v,t[30]=de,t[31]=fe),(0,Q.useEffect)(de,fe);let pe,me;t[32]!==C||t[33]!==v?(pe=()=>{window.okDesktop!=null&&C&&window.okDesktop.editor.notifyViewMenuStateChanged({terminalVisible:v})},me=[v,C],t[32]=C,t[33]=v,t[34]=pe,t[35]=me):(pe=t[34],me=t[35]),(0,Q.useEffect)(pe,me);let he,ge;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(he=()=>{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(rL).finally(()=>{t||w(!0)}),()=>{t=!0}},ge=[],t[36]=he,t[37]=ge):(he=t[36],ge=t[37]),(0,Q.useEffect)(he,ge);let _e,ve;t[38]===v?(_e=t[39],ve=t[40]):(_e=()=>{if(window.okDesktop!=null){if(T.current){T.current=!1;return}v&&Sa()}},ve=[v],t[38]=v,t[39]=_e,t[40]=ve),(0,Q.useEffect)(_e,ve),Ry(H?.pausedReason);let ye;t[41]===a?ye=t[42]:(ye=function(e){s(e),a(e)},t[41]=a,t[42]=ye);let be=ye,xe,Se;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(xe=()=>{d(`auth`),l(!0)},Se=()=>{d(`identity`),l(!0)},t[43]=xe,t[44]=Se):(xe=t[43],Se=t[44]);let Ce;t[45]!==V||t[46]!==r||t[47]!==v?(Ce=(0,Z.jsx)(MI,{onSignIn:xe,onSetIdentity:Se,onOpenSearch:r,terminalAvailable:_,terminalVisible:v,onToggleChat:V}),t[45]=V,t[46]=r,t[47]=v,t[48]=Ce):Ce=t[48];let we;t[49]!==f||t[50]!==o||t[51]!==be||t[52]!==O||t[53]!==v?(we=(0,Z.jsx)(bP,{editorMode:o,onModeChange:be,activeTab:f,onActiveTabChange:p,terminalBridge:g,terminalVisible:v,onTerminalVisibleChange:y,terminalDock:O,onTerminalPlacement:I}),t[49]=f,t[50]=o,t[51]=be,t[52]=O,t[53]=v,t[54]=we):we=t[54];let Te;t[55]!==b||t[56]!==O||t[57]!==E||t[58]!==F||t[59]!==v||t[60]!==N?(Te=_&&g!=null?(0,Z.jsx)(ZI,{bridge:g,visible:v,onVisibleChange:y,launch:E,installedClis:b,container:F.container,isShowing:F.isShowing,onRequestEditorFocus:()=>F.editorRegion?.focus(),dockPosition:O,onToggleDock:N,onHasSessionsChange:S}):null,t[55]=b,t[56]=O,t[57]=E,t[58]=F,t[59]=v,t[60]=N,t[61]=Te):Te=t[61];let Ee=u===`identity`,De;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(De=()=>{l(!1)},t[62]=De):De=t[62];let Oe;t[63]!==c||t[64]!==Ee?(Oe=(0,Z.jsx)(oa,{open:c,onOpenChange:l,identityPrompt:Ee,onSuccess:De}),t[63]=c,t[64]=Ee,t[65]=Oe):Oe=t[65];let ke;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(ke=()=>h(!0),t[66]=ke):ke=t[66];let Ae;t[67]===ne?Ae=t[68]:(Ae=(0,Z.jsx)(nb,{open:ne,onResolved:ke}),t[67]=ne,t[68]=Ae);let je;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(je=(0,Z.jsx)(wy,{}),t[69]=je):je=t[69];let Me;return t[70]!==Ce||t[71]!==we||t[72]!==Te||t[73]!==Oe||t[74]!==Ae?(Me=(0,Z.jsxs)(Z.Fragment,{children:[Ce,we,Te,Oe,Ae,je]}),t[70]=Ce,t[71]=we,t[72]=Te,t[73]=Oe,t[74]=Ae,t[75]=Me):Me=t[75],Me}function rL(e){console.error(`[terminal] dock-state restore failed; staying hidden:`,e)}function iL(e){return!e}function aL(e){return!e}function oL(e){let t=Kc(ml(e));typeof window>`u`||window.location.hash!==t&&(window.location.hash=t)}function sL(){let e=(0,$.c)(11),{conflicts:t,loading:n,error:r}=Wi();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)(oo,{"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)(oo,{"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(cL),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 cL(e){return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(Ci,{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:()=>oL(e.file),children:[(0,Z.jsx)(oo,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:e.file})]})},e.file)}var lL=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
32
32
  <symbol id="file-tree-icon-chevron" viewBox="0 0 16 16">
33
33
  <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"/>
34
34
  </symbol>