@inkeep/open-knowledge 0.29.0-beta.0 → 0.29.0-beta.1

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 (73) 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-DzwzGnge.mjs +2 -0
  5. package/dist/{dist-YCnI0BBU.mjs → dist-D1WPeGDD.mjs} +1 -1
  6. package/dist/{dist-CzszUkVL.mjs → dist-enzS4QJb.mjs} +4 -4
  7. package/dist/{gh-detect-V88Du2MF.mjs → gh-detect-CkD5P0-7.mjs} +2 -2
  8. package/dist/index.mjs +1 -1
  9. package/dist/init-BwZjunnX.mjs +1 -0
  10. package/dist/{init-T4iNBuZr.mjs → init-CD7gPvxY.mjs} +4 -4
  11. package/dist/loader-B2tdFV2u.mjs +1 -0
  12. package/dist/{loader-DrYPDE4W.mjs → loader-BNccmd7o.mjs} +2 -2
  13. package/dist/{open-browser-ngpLclet.mjs → open-browser-DamMPOar.mjs} +2 -2
  14. package/dist/{preview-DCgISA37.mjs → preview-CJTJyhRe.mjs} +2 -2
  15. package/dist/preview-CloAm65l.mjs +1 -0
  16. package/dist/public/assets/{ActivityModeContent-9CRsXwpX.js → ActivityModeContent-CxxS8nFq.js} +1 -1
  17. package/dist/public/assets/{CodeMirrorPropInput-DTQhS7of.js → CodeMirrorPropInput-CI_BdrFO.js} +1 -1
  18. package/dist/public/assets/{DocumentContext-fCycsmXU.js → DocumentContext-H8ueoY2i.js} +1 -1
  19. package/dist/public/assets/{EnableSyncConfirmDialog-Di9PpxcJ.js → EnableSyncConfirmDialog-Bfx-F020.js} +1 -1
  20. package/dist/public/assets/{GraphPanel-RxqTHyYU.js → GraphPanel-Bq38mdVO.js} +1 -1
  21. package/dist/public/assets/{ManagedArtifactProperties-OmaGINfG.js → ManagedArtifactProperties-BSPBOnr-.js} +1 -1
  22. package/dist/public/assets/{McpConsentDialogBody-ikl9jWLz.js → McpConsentDialogBody-iiKQkaSO.js} +1 -1
  23. package/dist/public/assets/{MermaidDocEditor-DmgH_l9s.js → MermaidDocEditor-DeLvY3mL.js} +1 -1
  24. package/dist/public/assets/{PropertyPanel-DW-wXPL8.js → PropertyPanel-M1FqAxBu.js} +1 -1
  25. package/dist/public/assets/{SettingsDialogBody-DLKGYz4m.js → SettingsDialogBody-CI2EJgcM.js} +1 -1
  26. package/dist/public/assets/{ShareBranchSwitchDialog-BO-B5Z58.js → ShareBranchSwitchDialog-DCB8oBto.js} +1 -1
  27. package/dist/public/assets/{ShareReceiveDialog-C2putkgB.js → ShareReceiveDialog-Dd0J6bu0.js} +1 -1
  28. package/dist/public/assets/{ShareReceiveMissDialog-WUihVM0X.js → ShareReceiveMissDialog-CXxQa4KW.js} +1 -1
  29. package/dist/public/assets/{SkillEditorActions-DBG6FPch.js → SkillEditorActions-CYONKTh4.js} +1 -1
  30. package/dist/public/assets/{SourceEditor-Dli-GA4u.js → SourceEditor-9SpbjiWH.js} +1 -1
  31. package/dist/public/assets/{TerminalPanel-B5-ikSnl.js → TerminalPanel-Cc0voOqd.js} +1 -1
  32. package/dist/public/assets/{agent-presence-EPReOnD1.js → agent-presence-BH_OoZBC.js} +1 -1
  33. package/dist/public/assets/{auth-state-cache-CwFOes4V.js → auth-state-cache-Chy1TIhv.js} +1 -1
  34. package/dist/public/assets/{config-provider-idYtRijR.js → config-provider-C8aBdDar.js} +1 -1
  35. package/dist/public/assets/{dist-wGNuEzOi.js → dist-AuN-WRQ2.js} +1 -1
  36. package/dist/public/assets/{dist-vGnNU_kt.js → dist-D5fPTJjV.js} +2 -2
  37. package/dist/public/assets/{doc-hash-DZPPDZDP.js → doc-hash-I00EhzUZ.js} +1 -1
  38. package/dist/public/assets/{documents-events-C387FFj2.js → documents-events-BvkJvzEE.js} +1 -1
  39. package/dist/public/assets/{file-tree-adapter-DohgQL5I.js → file-tree-adapter-DvAE1kkw.js} +1 -1
  40. package/dist/public/assets/{index-BESZ1LvY.js → index-CWW9ADpk.js} +7 -7
  41. package/dist/public/assets/{keyboard-shortcuts-CKBtlgh1.js → keyboard-shortcuts-BuZN2bTe.js} +1 -1
  42. package/dist/public/assets/{navigation-targets-v47kYNlN.js → navigation-targets-u2AFSpqT.js} +1 -1
  43. package/dist/public/assets/{open-managed-artifact-tab-BylvD5LD.js → open-managed-artifact-tab-BX3OwOLJ.js} +1 -1
  44. package/dist/public/assets/{pending-receive-nav-store-NlnPJ3yz.js → pending-receive-nav-store-DD8Ei1lo.js} +1 -1
  45. package/dist/public/assets/{prop-types-DDCTJMGl.js → prop-types-B0pfL-iG.js} +1 -1
  46. package/dist/public/assets/{receive-store-S3luT2x-.js → receive-store-Dt6o4uQU.js} +1 -1
  47. package/dist/public/assets/{selection-context-BeAbIsTm.js → selection-context-BVfXsapt.js} +1 -1
  48. package/dist/public/assets/skill-actions-D6y739v8.js +1 -0
  49. package/dist/public/assets/{skills-api-CDt3rqi3.js → skills-api-C4PwgAoY.js} +1 -1
  50. package/dist/public/assets/{src-ePqEpSu0.js → src-ibmWGcks.js} +1 -1
  51. package/dist/public/assets/{target-navigation-intent-9hvgFXB8.js → target-navigation-intent-P7IapNEj.js} +1 -1
  52. package/dist/public/assets/{typing-burst-detector-CEJxVkAD.js → typing-burst-detector-DXjPfO7_.js} +1 -1
  53. package/dist/public/assets/{workspace-paths-Dhhbnhbw.js → workspace-paths-BTMolBhv.js} +1 -1
  54. package/dist/public/index.html +25 -25
  55. package/dist/{repair-launch-json-BQQaFuKa.mjs → repair-launch-json-B0B568xb.mjs} +2 -2
  56. package/dist/{repair-mcp-configs-COKWe8pq.mjs → repair-mcp-configs-Cz7vaVvt.mjs} +2 -2
  57. package/dist/repair-skills-DRT6PpNy.mjs +1 -0
  58. package/dist/{repair-skills-q1ij3mTL.mjs → repair-skills-DoroYY8I.mjs} +2 -2
  59. package/dist/server-lock-GuuouVft-C8t6Ffyt.mjs +1 -0
  60. package/dist/{server-lock-iLcBw_q0-CU5aT1xR.mjs → server-lock-iLcBw_q0-rwg8rOgA.mjs} +2 -2
  61. package/dist/{src-D0bM1z_b.mjs → src-BGLE9r6j.mjs} +2 -2
  62. package/dist/start-CSu4I80l.mjs +1 -0
  63. package/dist/{start-Sq4c1D8L.mjs → start-D8BbQM4c.mjs} +2 -2
  64. package/dist/{write-project-skill-IMZdJi1p.mjs → write-project-skill-8alJi7YJ.mjs} +3 -3
  65. package/package.json +1 -1
  66. package/dist/constants-Dddf4Zbt.mjs +0 -2
  67. package/dist/init-CGWSpnxf.mjs +0 -1
  68. package/dist/loader-u8jcWe4s.mjs +0 -1
  69. package/dist/preview-CzKjLznn.mjs +0 -1
  70. package/dist/public/assets/skill-actions-CCgKV1BP.js +0 -1
  71. package/dist/repair-skills-DAdqIWrM.mjs +0 -1
  72. package/dist/server-lock-GuuouVft-Bm1fDFIJ.mjs +0 -1
  73. package/dist/start-rgO6nXNS.mjs +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./telemetry-impl-DehWSZsy.js","./chunk-CFjPhJqf.js","./preload-helper-2ej06EnG.js","./trace-api-D6fqC5Nw.js","./propagation-api-BHhJitgG.js","./ActivityPanelDiffView-B6QdoucA.js","./dist-CQw2y-s3.js","./compiler-runtime-CVnuRdak.js","./ActivityPanelDiffView-legcy4jI.css","./GraphPanel-RxqTHyYU.js","./dist-vGnNU_kt.js","./w3c-keyname-CHcJEDvG.js","./dist-BvBijIC5.js","./button-cneJOVxD.js","./toggle-group-CXHn0FKi.js","./dist-BSkHa6UR.js","./react-dom-C-oc-P2K.js","./dist-Dkr4jGYv.js","./dist-CyYz03up.js","./tooltip-FFg0kVkD.js","./dist-fpPv-rVb.js","./floating-ui.dom-DVRWCLii.js","./panel-BH2RZRZQ.js","./min-CIIm51Yo.js","./src-COe6dO0Z.js","./colors-viOD3yoc.js","./ordinal-CCfGWVix.js","./init-AaQV2WsU.js","./isObjectLike-D3Jc2RN1.js","./now-By2-TWwE.js","./isSymbol-BhFc7brD.js","./arrow-up-right-Crm0Btez.js","./prop-types-DDCTJMGl.js","./navigation-targets-v47kYNlN.js","./doc-hash-DZPPDZDP.js","./documents-fetch-DqIXnUVU.js","./documents-events-C387FFj2.js","./parse-api-error-CqtA8BcL.js","./startup-marks-DDtA9pbt.js","./triangle-alert-c3yCucJv.js","./dist-BVOt51sU.js","./target-navigation-intent-9hvgFXB8.js","./external-link-27uXLNxg.js","./ActivityModeContent-9CRsXwpX.js","./CodeMirrorPropInput-DTQhS7of.js","./dist-sRKGD4vA.js","./dist-Dot7Y1W_.js","./dist-Csh9y0a0.js","./dist-ClYcK7Yq.js","./dist-DmkgvB1A.js","./dist-BzxczcQx.js","./dist-COmtpu4e.js","./dist-Gaq2suxg.js","./dist-DYyQPSDl.js","./stex-4t0JIuX_.js","./config-provider-idYtRijR.js","./config-context-CE3SCVYc.js","./folder-open-BF5DIykr.js","./trash-2-Dcpo0Di-.js","./DocumentContext-fCycsmXU.js","./collapsible-mJvufeMs.js","./dialog-DdHaoAGK.js","./dist-CoyydoqN.js","./dist-BzWUi0nJ.js","./check-DRRCCRSs.js","./chevron-down-BvNcCN1f.js","./chevron-right-DSNnH-Vb.js","./workspace-paths-Dhhbnhbw.js","./eye-WB1l5kVb.js","./git-branch-q0qWPEwd.js","./info-BlYnsVoP.js","./loader-circle-B7Gv_Djz.js","./file-tree-rename-validation-DeKIxKnc.js","./input-tW78aNaR.js","./DocumentContext-B0sQn39F.css","./agent-presence-EPReOnD1.js","./cursor-Diqcx2dn.js","./dist-BxbpSpXO.js","./dist-B_WDz9Fr.js","./SettingsDialogBody-DLKGYz4m.js","./open-managed-artifact-tab-BylvD5LD.js","./checkbox-DurEHAAx.js","./skills-api-CDt3rqi3.js","./label-DPn_C7ZD.js","./radio-group-CXUz67M8.js","./auth-state-cache-CwFOes4V.js","./EnableSyncConfirmDialog-Di9PpxcJ.js","./skill-actions-CCgKV1BP.js","./refresh-cw-CluaccKu.js","./textarea-CfltWSGa.js","./keyboard-shortcuts-CKBtlgh1.js","./ManagedArtifactProperties-OmaGINfG.js","./PropertyPanel-DW-wXPL8.js","./format-2O9Da5Lm.js","./selection-context-BeAbIsTm.js","./MermaidDocEditor-DmgH_l9s.js","./dist-wGNuEzOi.js","./src-ePqEpSu0.js","./SourceEditor-Dli-GA4u.js","./typing-burst-detector-CEJxVkAD.js","./SkillEditorActions-DBG6FPch.js","./TerminalPanel-B5-ikSnl.js","./file-tree-adapter-DohgQL5I.js","./TerminalPanel-BrP-ENHg.css","./McpConsentDialogBody-ikl9jWLz.js","./mcp-consent-store-BxRtlIhJ.js","./ShareBranchSwitchDialog-BO-B5Z58.js","./miss-dialog-store-PJQ_kr0I.js","./share-metadata-rows-BttnPmuW.js","./desktop-bridge-types-NXCK8Pd7.js","./receive-store-S3luT2x-.js","./ShareReceiveMissDialog-WUihVM0X.js","./pending-receive-nav-store-NlnPJ3yz.js","./ConsentDialogBody-CG9T8kVb.js","./project-paths-Cv9JzTbQ.js","./ShareReceiveDialog-C2putkgB.js","./telemetry-startup-SAmXunjr.js"])))=>i.map(i=>d[i]);
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{$ as o,$t as s,A as c,An as l,At as u,B as d,Bt as f,Cn as p,Ct as m,D as h,Dt as g,En as _,Et as v,F as y,Ft as b,G as x,Gt as S,H as C,Ht as w,It as T,J as E,Jt as D,K as O,Kt as k,L as A,Lt as j,M,Mn as N,Mt as P,Nn as F,Nt as I,O as L,On as R,Ot as z,P as B,Pt as V,Q as H,Qt as U,R as W,Rt as G,Sn as K,St as ee,Tn as te,Tt as ne,U as re,Ut as ie,V as q,Vt as ae,W as oe,Wt as se,X as ce,Xt as le,Y as ue,Yt as de,Z as fe,Zt as pe,_n as me,_t as he,a as ge,an as _e,at as ve,bn as ye,bt as be,c as xe,cn as Se,ct as Ce,d as we,dn as Te,dt as Ee,en as De,et as Oe,f as ke,fn as Ae,ft as je,g as Me,gn as Ne,gt as Pe,h as Fe,hn as Ie,ht as Le,i as Re,in as ze,it as Be,j as Ve,jt as He,k as Ue,kt as We,l as Ge,lt as Ke,m as qe,mn as Je,n as Ye,nn as Xe,nt as Ze,o as Qe,on as $e,ot as et,p as tt,pn as nt,q as rt,qt as it,r as at,rn as ot,rt as st,s as ct,sn as lt,st as ut,t as dt,tn as ft,tt as pt,u as mt,un as ht,ut as gt,v as _t,vn as vt,vt as yt,wn as bt,wt as xt,xn as St,xt as Ct,y as wt,yn as Tt,yt as Et,z as Dt,zt as Ot}from"./DocumentContext-fCycsmXU.js";import{n as J,r as kt,t as At}from"./dist-CQw2y-s3.js";import{A as jt,C as Mt,D as Nt,E as Pt,O as Ft,S as It,T as Lt,_ as Rt,a as zt,b as Bt,c as Vt,d as Ht,f as Ut,g as Wt,h as Y,i as Gt,k as Kt,l as qt,m as Jt,n as Yt,o as Xt,p as Zt,r as Qt,s as $t,t as en,u as tn,v as nn,w as rn,x as an,y as on}from"./panel-BH2RZRZQ.js";import{n as sn,t as cn}from"./dist-BVOt51sU.js";import{t as ln}from"./react-dom-C-oc-P2K.js";import{Bi as un,Cn as dn,Cr as fn,D as pn,Dn as mn,Dr as hn,E as gn,F as _n,Fr as vn,Hi as yn,Hr as bn,I as xn,In as Sn,Ir as Cn,It as wn,Ji as Tn,Ki as En,Kn as Dn,Kr as On,Lr as kn,Mt as An,Nr as jn,O as Mn,Ot as Nn,Pr as Pn,Qi as Fn,Ri as In,S as Ln,Sr as Rn,Tn as zn,Tr as Bn,Tt as Vn,Ui as Hn,Un,Ur as Wn,Vn as Gn,Xi as Kn,Xt as qn,Zi as Jn,Zt as Yn,_n as Xn,bi as Zn,br as Qn,ci as $n,cr as er,dn as tr,fn as nr,gi as rr,hr as ir,ht as ar,ii as or,it as sr,j as cr,jr as lr,k as ur,kt as dr,li as fr,ln as pr,lt as mr,mr as hr,mt as gr,n as _r,o as vr,on as yr,pi as br,pn as xr,pr as Sr,q as Cr,r as wr,ri as Tr,rn as Er,rr as Dr,si as Or,t as kr,ui as Ar,un as jr,ur as Mr,v as Nr,vi as Pr,vn as Fr,vr as Ir,w as Lr,wr as Rr,wt as zr,x as Br,xn as Vr,yi as Hr,yn as Ur,yr as Wr,zn as Gr}from"./dist-vGnNU_kt.js";import{a as Kr,i as X,r as qr,t as Jr,u as Yr}from"./button-cneJOVxD.js";import{a as Xr,c as Zr,i as Qr,n as $r,o as ei,r as ti,s as ni,t as ri}from"./pending-receive-nav-store-NlnPJ3yz.js";import{$ as ii,B as ai,D as oi,E as si,F as ci,I as li,K as ui,L as di,O as fi,Q as pi,T as mi,X as hi,Y as gi,_ as _i,_t as vi,at as yi,ct as bi,et as xi,f as Si,gt as Ci,ht as wi,l as Ti,m as Ei,mt as Di,ot as Oi,q as ki,rt as Ai,st as ji,u as Mi,vt as Ni,w as Pi,x as Fi,yt as Ii}from"./CodeMirrorPropInput-DTQhS7of.js";import{a as Li,c as Ri,l as zi,o as Bi,s as Vi}from"./EnableSyncConfirmDialog-Di9PpxcJ.js";import{t as Hi}from"./arrow-up-right-Crm0Btez.js";import{a as Ui,c as Wi,d as Gi,i as Ki,l as qi,o as Ji,r as Yi,s as Xi,t as Zi,u as Qi}from"./PropertyPanel-DW-wXPL8.js";import{t as $i}from"./check-DRRCCRSs.js";import{t as ea}from"./chevron-down-BvNcCN1f.js";import{t as ta}from"./chevron-left-BEP8MhU3.js";import{t as na}from"./chevron-right-DSNnH-Vb.js";import{a as ra,i as ia,n as aa,o as oa}from"./prop-types-DDCTJMGl.js";import{C as sa,E as ca,S as la,T as ua,_ as da,a as fa,c as pa,d as ma,g as ha,h as ga,i as _a,l as va,m as ya,n as ba,o as xa,p as Sa,r as Ca,s as wa,u as Ta,v as Ea,w as Da,x as Oa,y as ka}from"./skill-actions-CCgKV1BP.js";import{$ as Aa,A as ja,B as Ma,D as Na,F as Pa,G as Fa,H as Ia,I as La,J as Ra,K as za,L as Ba,O as Va,P as Ha,Q as Ua,R as Wa,T as Ga,U as Ka,V as qa,W as Ja,X as Ya,Y as Xa,Z as Za,_ as Qa,a as $a,at as eo,b as to,c as no,ct as ro,dt as io,et as ao,it as oo,k as so,l as co,lt as lo,m as uo,n as fo,nt as po,ot as mo,q as ho,r as go,rt as _o,st as vo,t as yo,tt as bo,u as xo,ut as So,v as Co,w as wo,y as To,z as Eo}from"./auth-state-cache-CwFOes4V.js";import{a as Do,d as Oo,f as ko,i as Ao,l as jo,n as Mo,o as No,r as Po,s as Fo,t as Io,u as Lo}from"./workspace-paths-Dhhbnhbw.js";import{t as Ro}from"./folder-open-BF5DIykr.js";import{t as zo}from"./git-branch-q0qWPEwd.js";import{_ as Bo,c as Vo,f as Ho,g as Uo,h as Wo,i as Go,l as Ko,m as qo,o as Jo,p as Yo,s as Xo,t as Zo,u as Qo,v as $o,y as es}from"./open-managed-artifact-tab-BylvD5LD.js";import{t as ts}from"./info-BlYnsVoP.js";import{t as ns}from"./loader-circle-B7Gv_Djz.js";import{t as rs}from"./miss-dialog-store-PJQ_kr0I.js";import{t as is}from"./refresh-cw-CluaccKu.js";import{t as as}from"./trash-2-Dcpo0Di-.js";import{t as os}from"./triangle-alert-c3yCucJv.js";import{a as ss,c as cs,i as ls,n as us,o as ds,r as fs,s as ps,t as ms}from"./agent-presence-EPReOnD1.js";import{n as hs,r as gs,t as _s}from"./dist-CoyydoqN.js";import{a as vs,c as ys,d as bs,i as xs,o as Ss,r as Cs,u as ws}from"./dist-BSkHa6UR.js";import{i as Ts,n as Es,r as Ds,t as Os}from"./tooltip-FFg0kVkD.js";import{t as ks}from"./dist-Dkr4jGYv.js";import{n as As,r as js,t as Ms}from"./collapsible-mJvufeMs.js";import{a as Ns,c as Ps,i as Fs,n as Is,o as Ls,s as Rs,t as zs}from"./dialog-DdHaoAGK.js";import{t as Bs}from"./checkbox-DurEHAAx.js";import{a as Vs,d as Hs,i as Us,l as Ws,n as Gs,o as Ks,r as qs,s as Js,t as Ys,u as Xs}from"./floating-ui.dom-DVRWCLii.js";import{n as Zs,r as Qs,t as $s}from"./dist-CyYz03up.js";import{A as ec,B as tc,C as nc,D as rc,E as ic,F as ac,H as oc,I as sc,L as cc,M as lc,N as uc,O as dc,P as fc,R as pc,S as mc,T as hc,U as gc,V as _c,_ as vc,g as yc,h as bc,i as xc,j as Sc,k as Cc,m as wc,o as Tc,p as Ec,r as Dc,u as Oc,v as kc,w as Ac,y as jc,z as Mc}from"./skills-api-CDt3rqi3.js";import{t as Nc}from"./label-DPn_C7ZD.js";import{n as Pc,t as Fc}from"./radio-group-CXUz67M8.js";import{n as Ic,r as Lc,t as Rc}from"./toggle-group-CXHn0FKi.js";import{a as zc,i as Bc,n as Vc,r as Hc}from"./project-paths-Cv9JzTbQ.js";import{t as Uc}from"./input-tW78aNaR.js";import{t as Wc}from"./parse-api-error-CqtA8BcL.js";import{t as Gc}from"./dist-BvBijIC5.js";import{n as Kc,r as qc,t as Jc}from"./file-tree-rename-validation-DeKIxKnc.js";import{a as Yc,c as Xc,d as Zc,f as Qc,i as $c,l as el,n as tl,o as nl,p as rl,r as il,s as al,u as ol}from"./navigation-targets-v47kYNlN.js";import{t as sl}from"./documents-fetch-DqIXnUVU.js";import{a as cl,c as ll,n as ul,o as dl,r as fl,s as pl}from"./documents-events-C387FFj2.js";import{a as ml,i as hl,o as gl}from"./startup-marks-DDtA9pbt.js";import{a as _l,c as vl,d as yl,f as bl,i as xl,l as Sl,n as Cl,o as wl,r as Tl,s as El,t as Dl,u as Ol}from"./doc-hash-DZPPDZDP.js";import{c as kl,i as Al,l as jl,o as Ml}from"./keyboard-shortcuts-CKBtlgh1.js";import{a as Nl,i as Pl,l as Fl,n as Il,t as Ll}from"./config-provider-idYtRijR.js";import{$ as Rl,At as zl,Ct as Bl,Dt as Vl,Ft as Hl,I as Ul,It as Wl,J as Gl,Mt as Kl,Ot as ql,Pt as Jl,Q as Yl,Tt as Xl,X as Zl,Z as Ql,at as $l,bt as eu,jt as tu,k as nu,w as ru}from"./dist-Dot7Y1W_.js";import{n as iu}from"./dist-Gaq2suxg.js";import{n as au}from"./config-context-CE3SCVYc.js";import{a as ou,c as su,f as cu,i as lu,l as uu,n as du,o as fu,s as pu,t as mu}from"./typing-burst-detector-CEJxVkAD.js";import{t as hu}from"./external-link-27uXLNxg.js";import{t as gu}from"./target-navigation-intent-9hvgFXB8.js";import{i as _u,r as vu,t as yu}from"./cursor-Diqcx2dn.js";import{t as bu}from"./dist-wGNuEzOi.js";import"./textarea-CfltWSGa.js";import{c as xu,i as Su,n as Cu,r as wu,s as Tu,u as Eu}from"./selection-context-BeAbIsTm.js";import{A as Du,C as Ou,D as ku,E as Au,O as ju,S as Mu,T as Nu,_ as Pu,a as Fu,b as Iu,c as Lu,d as Ru,f as zu,g as Bu,h as Vu,i as Hu,k as Uu,l as Wu,m as Gu,n as Ku,o as qu,p as Ju,r as Yu,s as Xu,t as Zu,u as Qu,v as $u,w as ed,x as td,y as nd}from"./file-tree-adapter-DohgQL5I.js";import{n as rd,t as id}from"./mcp-consent-store-BxRtlIhJ.js";import{a as ad,t as od}from"./receive-store-S3luT2x-.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 sd(){({BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_APP_VERSION:`0.28.2`})?.VITE_OTEL_ENABLED===`true`&&n(()=>import(`./telemetry-impl-DehWSZsy.js`).then(e=>e.install()),__vite__mapDeps([0,1,2,3,4]),import.meta.url)}function cd(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=>{Wt(e,()=>t.signal,()=>n=!0)},u=on(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject();if(r==null&&e.pages.length)return Promise.resolve(e);let a=await u((()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})()),{maxPages:o}=t.options,s=i?nn:Rt;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?ud:ld,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:ld(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 ld(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 ud(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var dd=class extends Ut{#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||fd(),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=Zt({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),Y.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function fd(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var pd=class extends jt{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 dd({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=md(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=md(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=md(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=md(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){Y.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=>Mt(t,e))}findAll(e={}){return this.getAll().filter(t=>Mt(e,t))}notify(e){Y.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return Y.batch(()=>Promise.all(e.map(e=>e.continue().catch(Lt))))}};function md(e){return e.options.scope?.id}var hd=class extends jt{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??It(r,t),a=this.get(i);return a||(a=new Ht({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(){Y.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=>rn(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>rn(e,t)):t}notify(e){Y.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Y.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Y.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},gd=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new hd,this.#t=e.mutationCache||new pd,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=Kt.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Jt.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(Nt(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=Bt(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return Y.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;Y.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return Y.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=Y.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(Lt).catch(Lt)}invalidateQueries(e,t={}){return Y.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=Y.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(Lt)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(Lt)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(Nt(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Lt).catch(Lt)}fetchInfiniteQuery(e){return e.behavior=cd(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Lt).catch(Lt)}ensureInfiniteQueryData(e){return e.behavior=cd(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Jt.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(an(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{Pt(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(an(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{Pt(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||=It(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===Ft&&(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()}},_d=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}}}})),vd=t(((e,t)=>{t.exports=_d()})),yd=t((e=>{var t=vd(),n=r(),i=ln();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 ne(e){U.current===e&&(B(H),B(U)),G.current===e&&(B(G),Qf._currentValue=I)}var re,ie;function q(e){if(re===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);re=t&&t[1]||``,ie=-1<e.stack.indexOf(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./telemetry-impl-DehWSZsy.js","./chunk-CFjPhJqf.js","./preload-helper-2ej06EnG.js","./trace-api-D6fqC5Nw.js","./propagation-api-BHhJitgG.js","./ActivityPanelDiffView-B6QdoucA.js","./dist-CQw2y-s3.js","./compiler-runtime-CVnuRdak.js","./ActivityPanelDiffView-legcy4jI.css","./GraphPanel-Bq38mdVO.js","./dist-D5fPTJjV.js","./w3c-keyname-CHcJEDvG.js","./dist-BvBijIC5.js","./button-cneJOVxD.js","./toggle-group-CXHn0FKi.js","./dist-BSkHa6UR.js","./react-dom-C-oc-P2K.js","./dist-Dkr4jGYv.js","./dist-CyYz03up.js","./tooltip-FFg0kVkD.js","./dist-fpPv-rVb.js","./floating-ui.dom-DVRWCLii.js","./panel-BH2RZRZQ.js","./min-CIIm51Yo.js","./src-COe6dO0Z.js","./colors-viOD3yoc.js","./ordinal-CCfGWVix.js","./init-AaQV2WsU.js","./isObjectLike-D3Jc2RN1.js","./now-By2-TWwE.js","./isSymbol-BhFc7brD.js","./arrow-up-right-Crm0Btez.js","./prop-types-B0pfL-iG.js","./navigation-targets-u2AFSpqT.js","./doc-hash-I00EhzUZ.js","./documents-fetch-DqIXnUVU.js","./documents-events-BvkJvzEE.js","./parse-api-error-CqtA8BcL.js","./startup-marks-DDtA9pbt.js","./triangle-alert-c3yCucJv.js","./dist-BVOt51sU.js","./target-navigation-intent-P7IapNEj.js","./external-link-27uXLNxg.js","./ActivityModeContent-CxxS8nFq.js","./CodeMirrorPropInput-CI_BdrFO.js","./dist-sRKGD4vA.js","./dist-Dot7Y1W_.js","./dist-Csh9y0a0.js","./dist-ClYcK7Yq.js","./dist-DmkgvB1A.js","./dist-BzxczcQx.js","./dist-COmtpu4e.js","./dist-Gaq2suxg.js","./dist-DYyQPSDl.js","./stex-4t0JIuX_.js","./config-provider-C8aBdDar.js","./config-context-CE3SCVYc.js","./folder-open-BF5DIykr.js","./trash-2-Dcpo0Di-.js","./DocumentContext-H8ueoY2i.js","./collapsible-mJvufeMs.js","./dialog-DdHaoAGK.js","./dist-CoyydoqN.js","./dist-BzWUi0nJ.js","./check-DRRCCRSs.js","./chevron-down-BvNcCN1f.js","./chevron-right-DSNnH-Vb.js","./workspace-paths-BTMolBhv.js","./eye-WB1l5kVb.js","./git-branch-q0qWPEwd.js","./info-BlYnsVoP.js","./loader-circle-B7Gv_Djz.js","./file-tree-rename-validation-DeKIxKnc.js","./input-tW78aNaR.js","./DocumentContext-B0sQn39F.css","./agent-presence-BH_OoZBC.js","./cursor-Diqcx2dn.js","./dist-BxbpSpXO.js","./dist-B_WDz9Fr.js","./SettingsDialogBody-CI2EJgcM.js","./open-managed-artifact-tab-BX3OwOLJ.js","./checkbox-DurEHAAx.js","./skills-api-C4PwgAoY.js","./label-DPn_C7ZD.js","./radio-group-CXUz67M8.js","./auth-state-cache-Chy1TIhv.js","./EnableSyncConfirmDialog-Bfx-F020.js","./skill-actions-D6y739v8.js","./refresh-cw-CluaccKu.js","./textarea-CfltWSGa.js","./keyboard-shortcuts-BuZN2bTe.js","./ManagedArtifactProperties-BSPBOnr-.js","./PropertyPanel-M1FqAxBu.js","./format-2O9Da5Lm.js","./selection-context-BVfXsapt.js","./MermaidDocEditor-DeLvY3mL.js","./dist-AuN-WRQ2.js","./src-ibmWGcks.js","./SourceEditor-9SpbjiWH.js","./typing-burst-detector-DXjPfO7_.js","./SkillEditorActions-CYONKTh4.js","./TerminalPanel-Cc0voOqd.js","./file-tree-adapter-DvAE1kkw.js","./TerminalPanel-BrP-ENHg.css","./McpConsentDialogBody-iiKQkaSO.js","./mcp-consent-store-BxRtlIhJ.js","./ShareBranchSwitchDialog-DCB8oBto.js","./miss-dialog-store-PJQ_kr0I.js","./share-metadata-rows-BttnPmuW.js","./desktop-bridge-types-NXCK8Pd7.js","./receive-store-Dt6o4uQU.js","./ShareReceiveMissDialog-CXxQa4KW.js","./pending-receive-nav-store-DD8Ei1lo.js","./ConsentDialogBody-CG9T8kVb.js","./project-paths-Cv9JzTbQ.js","./ShareReceiveDialog-Dd0J6bu0.js","./telemetry-startup-SAmXunjr.js"])))=>i.map(i=>d[i]);
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{$ as o,$t as s,A as c,An as l,At as u,B as d,Bt as f,Cn as p,Ct as m,D as h,Dt as g,En as _,Et as v,F as y,Ft as b,G as x,Gt as S,H as C,Ht as w,It as T,J as E,Jt as D,K as O,Kt as k,L as A,Lt as j,M,Mn as N,Mt as P,Nn as F,Nt as I,O as L,On as R,Ot as z,P as B,Pt as V,Q as H,Qt as U,R as W,Rt as G,Sn as K,St as ee,Tn as te,Tt as ne,U as re,Ut as ie,V as q,Vt as ae,W as oe,Wt as se,X as ce,Xt as le,Y as ue,Yt as de,Z as fe,Zt as pe,_n as me,_t as he,a as ge,an as _e,at as ve,bn as ye,bt as be,c as xe,cn as Se,ct as Ce,d as we,dn as Te,dt as Ee,en as De,et as Oe,f as ke,fn as Ae,ft as je,g as Me,gn as Ne,gt as Pe,h as Fe,hn as Ie,ht as Le,i as Re,in as ze,it as Be,j as Ve,jt as He,k as Ue,kt as We,l as Ge,lt as Ke,m as qe,mn as Je,n as Ye,nn as Xe,nt as Ze,o as Qe,on as $e,ot as et,p as tt,pn as nt,q as rt,qt as it,r as at,rn as ot,rt as st,s as ct,sn as lt,st as ut,t as dt,tn as ft,tt as pt,u as mt,un as ht,ut as gt,v as _t,vn as vt,vt as yt,wn as bt,wt as xt,xn as St,xt as Ct,y as wt,yn as Tt,yt as Et,z as Dt,zt as Ot}from"./DocumentContext-H8ueoY2i.js";import{n as J,r as kt,t as At}from"./dist-CQw2y-s3.js";import{A as jt,C as Mt,D as Nt,E as Pt,O as Ft,S as It,T as Lt,_ as Rt,a as zt,b as Bt,c as Vt,d as Ht,f as Ut,g as Wt,h as Y,i as Gt,k as Kt,l as qt,m as Jt,n as Yt,o as Xt,p as Zt,r as Qt,s as $t,t as en,u as tn,v as nn,w as rn,x as an,y as on}from"./panel-BH2RZRZQ.js";import{n as sn,t as cn}from"./dist-BVOt51sU.js";import{t as ln}from"./react-dom-C-oc-P2K.js";import{Bi as un,Cn as dn,Cr as fn,D as pn,Dn as mn,Dr as hn,E as gn,F as _n,Fr as vn,Hi as yn,Hr as bn,I as xn,In as Sn,Ir as Cn,It as wn,Ji as Tn,Ki as En,Kn as Dn,Kr as On,Lr as kn,Mt as An,Nr as jn,O as Mn,Ot as Nn,Pr as Pn,Qi as Fn,Ri as In,S as Ln,Sr as Rn,Tn as zn,Tr as Bn,Tt as Vn,Ui as Hn,Un,Ur as Wn,Vn as Gn,Xi as Kn,Xt as qn,Zi as Jn,Zt as Yn,_n as Xn,bi as Zn,br as Qn,ci as $n,cr as er,dn as tr,fn as nr,gi as rr,hr as ir,ht as ar,ii as or,it as sr,j as cr,jr as lr,k as ur,kt as dr,li as fr,ln as pr,lt as mr,mr as hr,mt as gr,n as _r,o as vr,on as yr,pi as br,pn as xr,pr as Sr,q as Cr,r as wr,ri as Tr,rn as Er,rr as Dr,si as Or,t as kr,ui as Ar,un as jr,ur as Mr,v as Nr,vi as Pr,vn as Fr,vr as Ir,w as Lr,wr as Rr,wt as zr,x as Br,xn as Vr,yi as Hr,yn as Ur,yr as Wr,zn as Gr}from"./dist-D5fPTJjV.js";import{a as Kr,i as X,r as qr,t as Jr,u as Yr}from"./button-cneJOVxD.js";import{a as Xr,c as Zr,i as Qr,n as $r,o as ei,r as ti,s as ni,t as ri}from"./pending-receive-nav-store-DD8Ei1lo.js";import{$ as ii,B as ai,D as oi,E as si,F as ci,I as li,K as ui,L as di,O as fi,Q as pi,T as mi,X as hi,Y as gi,_ as _i,_t as vi,at as yi,ct as bi,et as xi,f as Si,gt as Ci,ht as wi,l as Ti,m as Ei,mt as Di,ot as Oi,q as ki,rt as Ai,st as ji,u as Mi,vt as Ni,w as Pi,x as Fi,yt as Ii}from"./CodeMirrorPropInput-CI_BdrFO.js";import{a as Li,c as Ri,l as zi,o as Bi,s as Vi}from"./EnableSyncConfirmDialog-Bfx-F020.js";import{t as Hi}from"./arrow-up-right-Crm0Btez.js";import{a as Ui,c as Wi,d as Gi,i as Ki,l as qi,o as Ji,r as Yi,s as Xi,t as Zi,u as Qi}from"./PropertyPanel-M1FqAxBu.js";import{t as $i}from"./check-DRRCCRSs.js";import{t as ea}from"./chevron-down-BvNcCN1f.js";import{t as ta}from"./chevron-left-BEP8MhU3.js";import{t as na}from"./chevron-right-DSNnH-Vb.js";import{a as ra,i as ia,n as aa,o as oa}from"./prop-types-B0pfL-iG.js";import{C as sa,E as ca,S as la,T as ua,_ as da,a as fa,c as pa,d as ma,g as ha,h as ga,i as _a,l as va,m as ya,n as ba,o as xa,p as Sa,r as Ca,s as wa,u as Ta,v as Ea,w as Da,x as Oa,y as ka}from"./skill-actions-D6y739v8.js";import{$ as Aa,A as ja,B as Ma,D as Na,F as Pa,G as Fa,H as Ia,I as La,J as Ra,K as za,L as Ba,O as Va,P as Ha,Q as Ua,R as Wa,T as Ga,U as Ka,V as qa,W as Ja,X as Ya,Y as Xa,Z as Za,_ as Qa,a as $a,at as eo,b as to,c as no,ct as ro,dt as io,et as ao,it as oo,k as so,l as co,lt as lo,m as uo,n as fo,nt as po,ot as mo,q as ho,r as go,rt as _o,st as vo,t as yo,tt as bo,u as xo,ut as So,v as Co,w as wo,y as To,z as Eo}from"./auth-state-cache-Chy1TIhv.js";import{a as Do,d as Oo,f as ko,i as Ao,l as jo,n as Mo,o as No,r as Po,s as Fo,t as Io,u as Lo}from"./workspace-paths-BTMolBhv.js";import{t as Ro}from"./folder-open-BF5DIykr.js";import{t as zo}from"./git-branch-q0qWPEwd.js";import{_ as Bo,c as Vo,f as Ho,g as Uo,h as Wo,i as Go,l as Ko,m as qo,o as Jo,p as Yo,s as Xo,t as Zo,u as Qo,v as $o,y as es}from"./open-managed-artifact-tab-BX3OwOLJ.js";import{t as ts}from"./info-BlYnsVoP.js";import{t as ns}from"./loader-circle-B7Gv_Djz.js";import{t as rs}from"./miss-dialog-store-PJQ_kr0I.js";import{t as is}from"./refresh-cw-CluaccKu.js";import{t as as}from"./trash-2-Dcpo0Di-.js";import{t as os}from"./triangle-alert-c3yCucJv.js";import{a as ss,c as cs,i as ls,n as us,o as ds,r as fs,s as ps,t as ms}from"./agent-presence-BH_OoZBC.js";import{n as hs,r as gs,t as _s}from"./dist-CoyydoqN.js";import{a as vs,c as ys,d as bs,i as xs,o as Ss,r as Cs,u as ws}from"./dist-BSkHa6UR.js";import{i as Ts,n as Es,r as Ds,t as Os}from"./tooltip-FFg0kVkD.js";import{t as ks}from"./dist-Dkr4jGYv.js";import{n as As,r as js,t as Ms}from"./collapsible-mJvufeMs.js";import{a as Ns,c as Ps,i as Fs,n as Is,o as Ls,s as Rs,t as zs}from"./dialog-DdHaoAGK.js";import{t as Bs}from"./checkbox-DurEHAAx.js";import{a as Vs,d as Hs,i as Us,l as Ws,n as Gs,o as Ks,r as qs,s as Js,t as Ys,u as Xs}from"./floating-ui.dom-DVRWCLii.js";import{n as Zs,r as Qs,t as $s}from"./dist-CyYz03up.js";import{A as ec,B as tc,C as nc,D as rc,E as ic,F as ac,H as oc,I as sc,L as cc,M as lc,N as uc,O as dc,P as fc,R as pc,S as mc,T as hc,U as gc,V as _c,_ as vc,g as yc,h as bc,i as xc,j as Sc,k as Cc,m as wc,o as Tc,p as Ec,r as Dc,u as Oc,v as kc,w as Ac,y as jc,z as Mc}from"./skills-api-C4PwgAoY.js";import{t as Nc}from"./label-DPn_C7ZD.js";import{n as Pc,t as Fc}from"./radio-group-CXUz67M8.js";import{n as Ic,r as Lc,t as Rc}from"./toggle-group-CXHn0FKi.js";import{a as zc,i as Bc,n as Vc,r as Hc}from"./project-paths-Cv9JzTbQ.js";import{t as Uc}from"./input-tW78aNaR.js";import{t as Wc}from"./parse-api-error-CqtA8BcL.js";import{t as Gc}from"./dist-BvBijIC5.js";import{n as Kc,r as qc,t as Jc}from"./file-tree-rename-validation-DeKIxKnc.js";import{a as Yc,c as Xc,d as Zc,f as Qc,i as $c,l as el,n as tl,o as nl,p as rl,r as il,s as al,u as ol}from"./navigation-targets-u2AFSpqT.js";import{t as sl}from"./documents-fetch-DqIXnUVU.js";import{a as cl,c as ll,n as ul,o as dl,r as fl,s as pl}from"./documents-events-BvkJvzEE.js";import{a as ml,i as hl,o as gl}from"./startup-marks-DDtA9pbt.js";import{a as _l,c as vl,d as yl,f as bl,i as xl,l as Sl,n as Cl,o as wl,r as Tl,s as El,t as Dl,u as Ol}from"./doc-hash-I00EhzUZ.js";import{c as kl,i as Al,l as jl,o as Ml}from"./keyboard-shortcuts-BuZN2bTe.js";import{a as Nl,i as Pl,l as Fl,n as Il,t as Ll}from"./config-provider-C8aBdDar.js";import{$ as Rl,At as zl,Ct as Bl,Dt as Vl,Ft as Hl,I as Ul,It as Wl,J as Gl,Mt as Kl,Ot as ql,Pt as Jl,Q as Yl,Tt as Xl,X as Zl,Z as Ql,at as $l,bt as eu,jt as tu,k as nu,w as ru}from"./dist-Dot7Y1W_.js";import{n as iu}from"./dist-Gaq2suxg.js";import{n as au}from"./config-context-CE3SCVYc.js";import{a as ou,c as su,f as cu,i as lu,l as uu,n as du,o as fu,s as pu,t as mu}from"./typing-burst-detector-DXjPfO7_.js";import{t as hu}from"./external-link-27uXLNxg.js";import{t as gu}from"./target-navigation-intent-P7IapNEj.js";import{i as _u,r as vu,t as yu}from"./cursor-Diqcx2dn.js";import{t as bu}from"./dist-AuN-WRQ2.js";import"./textarea-CfltWSGa.js";import{c as xu,i as Su,n as Cu,r as wu,s as Tu,u as Eu}from"./selection-context-BVfXsapt.js";import{A as Du,C as Ou,D as ku,E as Au,O as ju,S as Mu,T as Nu,_ as Pu,a as Fu,b as Iu,c as Lu,d as Ru,f as zu,g as Bu,h as Vu,i as Hu,k as Uu,l as Wu,m as Gu,n as Ku,o as qu,p as Ju,r as Yu,s as Xu,t as Zu,u as Qu,v as $u,w as ed,x as td,y as nd}from"./file-tree-adapter-DvAE1kkw.js";import{n as rd,t as id}from"./mcp-consent-store-BxRtlIhJ.js";import{a as ad,t as od}from"./receive-store-Dt6o4uQU.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 sd(){({BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_APP_VERSION:`0.28.2`})?.VITE_OTEL_ENABLED===`true`&&n(()=>import(`./telemetry-impl-DehWSZsy.js`).then(e=>e.install()),__vite__mapDeps([0,1,2,3,4]),import.meta.url)}function cd(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=>{Wt(e,()=>t.signal,()=>n=!0)},u=on(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject();if(r==null&&e.pages.length)return Promise.resolve(e);let a=await u((()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})()),{maxPages:o}=t.options,s=i?nn:Rt;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?ud:ld,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:ld(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 ld(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 ud(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var dd=class extends Ut{#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||fd(),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=Zt({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),Y.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function fd(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var pd=class extends jt{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 dd({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=md(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=md(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=md(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=md(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){Y.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=>Mt(t,e))}findAll(e={}){return this.getAll().filter(t=>Mt(e,t))}notify(e){Y.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return Y.batch(()=>Promise.all(e.map(e=>e.continue().catch(Lt))))}};function md(e){return e.options.scope?.id}var hd=class extends jt{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??It(r,t),a=this.get(i);return a||(a=new Ht({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(){Y.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=>rn(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>rn(e,t)):t}notify(e){Y.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Y.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Y.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},gd=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new hd,this.#t=e.mutationCache||new pd,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=Kt.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Jt.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(Nt(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=Bt(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return Y.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;Y.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return Y.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=Y.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(Lt).catch(Lt)}invalidateQueries(e,t={}){return Y.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=Y.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(Lt)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(Lt)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(Nt(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Lt).catch(Lt)}fetchInfiniteQuery(e){return e.behavior=cd(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Lt).catch(Lt)}ensureInfiniteQueryData(e){return e.behavior=cd(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Jt.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(an(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{Pt(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(an(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{Pt(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||=It(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===Ft&&(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()}},_d=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}}}})),vd=t(((e,t)=>{t.exports=_d()})),yd=t((e=>{var t=vd(),n=r(),i=ln();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 ne(e){U.current===e&&(B(H),B(U)),G.current===e&&(B(G),Qf._currentValue=I)}var re,ie;function q(e){if(re===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);re=t&&t[1]||``,ie=-1<e.stack.indexOf(`
3
3
  at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
4
4
  `+re+e+ie}var ae=!1;function oe(e,t){if(!e||ae)return``;ae=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,`props`,{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,`name`,{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
5
5
  `),l=s.split(`
@@ -19,14 +19,14 @@ Error generating stack: `+e.message+`
19
19
  `}function _v(e,t,n,r,i,a,o){if(typeof o==`function`&&(o={callback:o}),o?.callback){let{callback:s}=o;hv(e,t,n,r,i,a,Object.assign(Object.assign({},o),{callback:e=>{s(e?gv(e,o.headerOptions):void 0)}}))}else{let s=hv(e,t,n,r,i,a,o);return s?gv(s,o?.headerOptions):void 0}}function vv(e,t,n,r,i,a){return _v(e,e,t,n,r,i,a)}function yv(e){let t=e.endsWith(`
20
20
  `),n=e.split(`
21
21
  `).map(e=>e+`
22
- `);return t?n.pop():n.push(n.pop().slice(0,-1)),n}function bv(e,t){return`${e}\u0000${t}`}function xv(e,t,n){let r=fn(e).body,i=fn(t).body;return r===i?``:vv(n,r,i,``,``,{context:3})}function Sv(e,t,n){let r=(0,$.c)(8),{activeProvider:i}=Ye(),a;r[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={status:`idle`,diff:null},r[0]=a):a=r[0];let[o,s]=(0,Q.useState)(a),c=(0,Q.useRef)(i),l;r[1]===i?l=r[2]:(l=()=>{c.current=i},r[1]=i,r[2]=l),(0,Q.useEffect)(l);let u,d;return r[3]!==n||r[4]!==t||r[5]!==e?(u=()=>{if(!e){s({status:`idle`,diff:null});return}let r=e,i=!1;return s({status:`loading`,diff:null}),(async function(){try{let e=bv(t,r),a=n.get(e);if(a===void 0){let o=await fetch(`/api/history/${r}?docName=${encodeURIComponent(t)}`);if(i)return;if(!o.ok){s({status:`error`,diff:null});return}let c=await o.json();if(i)return;a=c.content??``,n.set(e,a)}if(i)return;let o=c.current?.document.getText(`source`).toString()??``,l=xv(a,o,t);if(i)return;s({status:`ready`,diff:l})}catch(e){i||(console.error(`[timeline-diff] failed to load entry diff`,{sha:r,docName:t,err:e}),s({status:`error`,diff:null}))}})(),()=>{i=!0}},d=[e,t,n],r[3]=n,r[4]=t,r[5]=e,r[6]=u,r[7]=d):(u=r[6],d=r[7]),(0,Q.useEffect)(u,d),o}var Cv=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityPanelDiffView-B6QdoucA.js`),__vite__mapDeps([5,1,6,7,8]),import.meta.url)).ActivityPanelDiffView})),wv=1e4,Tv=6e4;async function Ev(e,t,n){try{let r=await fetch(`/api/history?docName=${encodeURIComponent(e)}&limit=100`,{signal:t});if(!r.ok)return n.setError(n.unavailableMessage),`error`;let i=await r.json();return n.setEntries((i.entries??[]).filter(e=>e.type!==`checkpoint`)),n.setError(null),`ok`}catch(e){if(e instanceof DOMException&&e.name===`AbortError`)throw e;return n.setError(n.unavailableMessage),console.error(`[timeline]`,e),`error`}finally{t.aborted||n.setLoading(!1)}}function Dv(e){let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/1e3);if(r<60)return Gc._({id:`xOTzt5`});if(r<3600){let e=Math.floor(r/60);return Gc._({id:`UyROxs`,values:{mins:e}})}if(r<86400){let e=Math.floor(r/3600);return Gc._({id:`wXO4Tg`,values:{hrs:e}})}if(r<86400*2)return Gc._({id:`rQRrkB`});let i=Math.floor(r/86400);return i<7?Gc._({id:`6u9LvN`,values:{days:i}}):t.toLocaleDateString()}function Ov(e){return new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function kv(e){return e.slice(0,7)}function Av(e){return e.type===`upstream`?Gc._({id:`K_vT1F`}):e.contributors.length===1?e.contributors[0].name:e.contributors.length>1?e.contributors.map(e=>e.name).join(`, `):e.author===`openknowledge-server`||e.author===`server`?Gc._({id:`B2DrPb`}):e.author}function jv(e){let t=(0,$.c)(17),n,r;if(t[0]===e?(n=t[1],r=t[2]):({icon:n,...r}=e,t[0]=e,t[1]=n,t[2]=r),n===`claude`){let e;return t[3]===r?e=t[4]:(e=(0,Z.jsx)(_u,{...r}),t[3]=r,t[4]=e),e}if(n===`cursor`){let e;return t[5]===r?e=t[6]:(e=(0,Z.jsx)(yu,{...r}),t[5]=r,t[6]=e),e}if(n===`windsurf`){let e;return t[7]===r?e=t[8]:(e=(0,Z.jsx)(ss,{...r}),t[7]=r,t[8]=e),e}if(n===`openai`){let e;return t[9]===r?e=t[10]:(e=(0,Z.jsx)(vu,{...r}),t[9]=r,t[10]=e),e}if(n===`cline`){let e;return t[11]===r?e=t[12]:(e=(0,Z.jsx)(ps,{...r}),t[11]=r,t[12]=e),e}if(n===`github`){let e;return t[13]===r?e=t[14]:(e=(0,Z.jsx)(ds,{...r}),t[13]=r,t[14]=e),e}let i=r,a;return t[15]===i?a=t[16]:(a=(0,Z.jsx)(jo,{strokeWidth:1.5,...i}),t[15]=i,t[16]=a),a}function Mv(e){let t=(0,$.c)(17),{entry:n,isDark:r}=e;if(n.type===`upstream`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(zo,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[0]=e):e=t[0],e}if(n.contributors.length>0){let e=n.contributors[0],i=e.colorSeed??e.name,a;t[1]===i?a=t[2]:(a=mn(i),t[1]=i,t[2]=a);let o=a,s=r?_r[o]??kr[o]:kr[o],c;t[3]!==s||t[4]!==i?(c=s??Yn(i),t[3]=s,t[4]=i,t[5]=c):c=t[5];let l=c;if(o!==`bot`){let e;t[6]===l?e=t[7]:(e={color:l},t[6]=l,t[7]=e);let n;return t[8]!==o||t[9]!==e?(n=(0,Z.jsx)(jv,{icon:o,width:14,height:14,className:`shrink-0`,style:e}),t[8]=o,t[9]=e,t[10]=n):n=t[10],n}if(e.name===`File System`){let e;return t[11]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Xd,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[11]=e):e=t[11],e}if(e.name===`OpenKnowledge (service)`||e.name===`Git (upstream)`){let e;return t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Zr,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[12]=e):e=t[12],e}let u;return t[13]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(Kf,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[13]=u):u=t[13],u}if(n.authorEmail.includes(`agent`)||n.author.includes(`agent`)||n.authorEmail.includes(`cursor`)||n.authorEmail.includes(`claude`)){let e;return t[14]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(jo,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[14]=e):e=t[14],e}if(n.author===`openknowledge-server`||n.author===`server`){let e;return t[15]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Zr,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[15]=e):e=t[15],e}let i;return t[16]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(Kf,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[16]=i):i=t[16],i}function Nv(e){let t=[];for(let n of e.contributors)if(n.summaries)for(let e of n.summaries)t.push(e);return t}function Pv(e){let t=(0,$.c)(21),{summaries:n}=e,[r,i]=(0,Q.useState)(!1),a=(0,Q.useId)();if(n.length===0)return null;let o,s;t[0]===n?(o=t[1],s=t[2]):([o,...s]=n,t[0]=n,t[1]=o,t[2]=s);let c=s.length,l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:`• `}),t[3]=l):l=t[3];let u;t[4]===o?u=t[5]:(u=(0,Z.jsxs)(`li`,{className:`text-xs text-foreground/90`,children:[l,o]}),t[4]=o,t[5]=u);let d;t[6]!==r||t[7]!==s?(d=r&&s.map(Iv),t[6]=r,t[7]=s,t[8]=d):d=t[8];let f;t[9]!==a||t[10]!==u||t[11]!==d?(f=(0,Z.jsxs)(`ul`,{id:a,className:`list-none`,children:[u,d]}),t[9]=a,t[10]=u,t[11]=d,t[12]=f):f=t[12];let p;t[13]!==r||t[14]!==c||t[15]!==a||t[16]!==s.length?(p=s.length>0&&(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":r,"aria-controls":a,className:`inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors cursor-pointer`,onClick:e=>{e.stopPropagation(),i(Fv)},children:[r?(0,Z.jsx)(ea,{className:`size-3`}):(0,Z.jsx)(na,{className:`size-3`}),r?(0,Z.jsx)(J,{id:`vLyv1R`}):(0,Z.jsx)(J,{id:`ZptNUh`,values:{hidden:c}})]}),t[13]=r,t[14]=c,t[15]=a,t[16]=s.length,t[17]=p):p=t[17];let m;return t[18]!==f||t[19]!==p?(m=(0,Z.jsxs)(`div`,{className:`mt-0.5`,children:[f,p]}),t[18]=f,t[19]=p,t[20]=m):m=t[20],m}function Fv(e){return!e}function Iv(e,t){return(0,Z.jsxs)(`li`,{className:`text-xs text-foreground/90`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:`• `}),e]},`${t}-${e}`)}function Lv(e){let t=(0,$.c)(13),{sha:n,docName:r,cache:i,diffLayout:a,panelId:o}=e,s=Sv(n,r,i),c;t[0]===s.status?c=t[1]:(c=s.status===`loading`&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 py-2 text-xs text-muted-foreground`,children:[(0,Z.jsx)(ns,{className:`size-3 animate-spin`}),(0,Z.jsx)(J,{id:`38foVZ`})]}),t[0]=s.status,t[1]=c);let l;t[2]===s.status?l=t[3]:(l=s.status===`error`&&(0,Z.jsx)(`p`,{className:`py-2 text-xs text-destructive`,children:(0,Z.jsx)(J,{id:`vvWZnu`})}),t[2]=s.status,t[3]=l);let u;t[4]!==a||t[5]!==s.diff||t[6]!==s.status?(u=s.status===`ready`&&(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 py-2 text-xs text-muted-foreground`,children:[(0,Z.jsx)(ns,{className:`size-3 animate-spin`}),(0,Z.jsx)(J,{id:`EDm3wJ`})]}),children:(0,Z.jsx)(Cv,{diff:s.diff,viewType:a})}),t[4]=a,t[5]=s.diff,t[6]=s.status,t[7]=u):u=t[7];let d;return t[8]!==o||t[9]!==c||t[10]!==l||t[11]!==u?(d=(0,Z.jsxs)(`div`,{id:o,className:`px-3 pb-2`,"data-testid":`timeline-entry-diff`,children:[c,l,u]}),t[8]=o,t[9]=c,t[10]=l,t[11]=u,t[12]=d):d=t[12],d}function Rv(e){let t=(0,$.c)(127),{entry:n,isDark:r,diffLayout:i,cache:a,docName:o,expanded:s,onToggleExpanded:c,onRestoreSuccess:l}=e,{_:u}=kt(),d;t[0]===n.timestamp?d=t[1]:(d=Dv(n.timestamp),t[0]=n.timestamp,t[1]=d);let f=d,p;t[2]===n?p=t[3]:(p=Av(n),t[2]=n,t[3]=p);let m=p,h;t[4]===n.timestamp?h=t[5]:(h=Ov(n.timestamp),t[4]=n.timestamp,t[5]=h);let g=h,_;t[6]===n.sha?_=t[7]:(_=kv(n.sha),t[6]=n.sha,t[7]=_);let v=_,y=n.contributors.flatMap(zv),b;t[8]===n?b=t[9]:(b=Nv(n),t[8]=n,t[9]=b);let x=b,[S,C]=(0,Q.useState)(!1),[w,T]=(0,Q.useState)(!1),E=(0,Q.useRef)(null),D=(0,Q.useId)(),O,k;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(O=()=>()=>E.current?.abort(),k=[],t[10]=O,t[11]=k):(O=t[10],k=t[11]),(0,Q.useEffect)(O,k);let A;t[12]!==n.sha||t[13]!==c?(A=()=>c(n.sha),t[12]=n.sha,t[13]=c,t[14]=A):A=t[14];let j=A,M;t[15]===C?M=t[16]:(M=function(){E.current?.abort(),E.current=null,T(!1),C(!1)},t[15]=C,t[16]=M);let N=M,P;t[17]!==u||t[18]!==o||t[19]!==n.sha||t[20]!==l||t[21]!==C?(P=async function(){T(!0);let e=new AbortController;E.current=e;let t=function(){e.signal.aborted||T(!1),E.current===e&&(E.current=null)},r;try{r=await fetch(`/api/rollback`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({docName:o,commitSha:n.sha}),signal:e.signal})}catch(r){let i=r;!e.signal.aborted&&!(i instanceof DOMException&&i.name===`AbortError`)&&(console.error(`[timeline] rollback fetch failed`,{docName:o,sha:n.sha,err:i}),hs.error(u({id:`NkXEFS`}),{duration:4e3})),t();return}if(e.signal.aborted){t();return}if(r.ok)C(!1),l();else{let e=`HTTP ${r.status}`;try{let t=sr.safeParse(await r.json());t.success&&(e=t.data.title)}catch{}console.error(`[timeline] rollback failed`,{docName:o,sha:n.sha,status:r.status,detail:e}),hs.error(u({id:`uM6jnS`}),{description:e,duration:6e3})}t()},t[17]=u,t[18]=o,t[19]=n.sha,t[20]=l,t[21]=C,t[22]=P):P=t[22];let F=P,I;t[23]!==n||t[24]!==r?(I=(0,Z.jsx)(Mv,{entry:n,isDark:r}),t[23]=n,t[24]=r,t[25]=I):I=t[25];let L=I,R=s?D:void 0,z=s?`bg-muted`:`hover:bg-muted/80`,B;t[26]===z?B=t[27]:(B=[`group flex w-full items-start gap-2.5 rounded-lg px-3 py-2.5 text-left transition-colors cursor-pointer outline-none focus-visible:ring-2 focus-visible:ring-ring`,z],t[26]=z,t[27]=B);let V=B.join(` `),H;t[28]===j?H=t[29]:(H=e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),j())},t[28]=j,t[29]=H);let U;t[30]===L?U=t[31]:(U=(0,Z.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:L}),t[30]=L,t[31]=U);let W;t[32]===m?W=t[33]:(W=(0,Z.jsx)(`span`,{className:`truncate text-xs text-foreground`,children:m}),t[32]=m,t[33]=W);let G;t[34]!==n.timestamp||t[35]!==f?(G=(0,Z.jsx)(`time`,{className:`ml-auto shrink-0 text-xs text-muted-foreground/80`,dateTime:n.timestamp,title:n.timestamp,children:f}),t[34]=n.timestamp,t[35]=f,t[36]=G):G=t[36];let K;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`h-3 w-px shrink-0 bg-border`}),t[37]=K):K=t[37];let ee;t[38]===u?ee=t[39]:(ee=u({id:`Yea-K5`}),t[38]=u,t[39]=ee);let te;t[40]===C?te=t[41]:(te=e=>{e.stopPropagation(),C(!0)},t[40]=C,t[41]=te);let ne;t[42]===w?ne=t[43]:(ne=w?(0,Z.jsx)(ns,{className:`size-3 animate-spin`}):(0,Z.jsx)(cs,{className:`size-3`}),t[42]=w,t[43]=ne);let re;t[44]!==w||t[45]!==ee||t[46]!==te||t[47]!==ne?(re=(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(Jr,{variant:`ghost`,size:`icon`,className:`size-5 shrink-0 text-muted-foreground hover:text-destructive`,"data-testid":`timeline-entry-restore`,"aria-label":ee,disabled:w,onClick:te,children:ne})}),t[44]=w,t[45]=ee,t[46]=te,t[47]=ne,t[48]=re):re=t[48];let ie;t[49]===u?ie=t[50]:(ie=u({id:`Yea-K5`}),t[49]=u,t[50]=ie);let q;t[51]===ie?q=t[52]:(q=(0,Z.jsx)(Es,{side:`top`,children:ie}),t[51]=ie,t[52]=q);let ae;t[53]!==re||t[54]!==q?(ae=(0,Z.jsxs)(Os,{children:[re,q]}),t[53]=re,t[54]=q,t[55]=ae):ae=t[55];let oe;t[56]!==W||t[57]!==G||t[58]!==ae?(oe=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[W,G,K,ae]}),t[56]=W,t[57]=G,t[58]=ae,t[59]=oe):oe=t[59];let se;t[60]===x?se=t[61]:(se=x.length>0&&(0,Z.jsx)(Pv,{summaries:x}),t[60]=x,t[61]=se);let ce=y.length>0?(0,Z.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,title:y.join(`, `),children:y.join(`, `)}):(0,Z.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,title:n.message,children:n.message}),le;t[62]!==oe||t[63]!==se||t[64]!==ce?(le=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[oe,se,ce]}),t[62]=oe,t[63]=se,t[64]=ce,t[65]=le):le=t[65];let ue;t[66]!==s||t[67]!==j||t[68]!==R||t[69]!==V||t[70]!==H||t[71]!==U||t[72]!==le?(ue=(0,Z.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-expanded":s,"aria-controls":R,"data-testid":`timeline-entry-expand`,className:V,onClick:j,onKeyDown:H,children:[U,le]}),t[66]=s,t[67]=j,t[68]=R,t[69]=V,t[70]=H,t[71]=U,t[72]=le,t[73]=ue):ue=t[73];let de;t[74]!==a||t[75]!==i||t[76]!==D||t[77]!==o||t[78]!==n.sha||t[79]!==s?(de=s&&(0,Z.jsx)(Lv,{sha:n.sha,docName:o,cache:a,diffLayout:i,panelId:D}),t[74]=a,t[75]=i,t[76]=D,t[77]=o,t[78]=n.sha,t[79]=s,t[80]=de):de=t[80];let fe;t[81]!==ue||t[82]!==de?(fe=(0,Z.jsxs)(`div`,{className:`flex flex-col rounded-lg`,children:[ue,de]}),t[81]=ue,t[82]=de,t[83]=fe):fe=t[83];let pe;t[84]!==N||t[85]!==C?(pe=e=>{e?C(!0):N()},t[84]=N,t[85]=C,t[86]=pe):pe=t[86];let me;t[87]===u?me=t[88]:(me=u({id:`Pyp1NA`}),t[87]=u,t[88]=me);let he;t[89]===me?he=t[90]:(he=(0,Z.jsx)(Ps,{children:me}),t[89]=me,t[90]=he);let ge;t[91]!==g||t[92]!==m||t[93]!==v||t[94]!==f?(ge={relative:f,absoluteTime:g,entrySha:v,authorName:m},t[91]=g,t[92]=m,t[93]=v,t[94]=f,t[95]=ge):ge=t[95];let _e;t[96]===Symbol.for(`react.memo_cache_sentinel`)?(_e={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`}),1:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[96]=_e):_e=t[96];let ve;t[97]===ge?ve=t[98]:(ve=(0,Z.jsx)(Ns,{children:(0,Z.jsx)(J,{id:`h6EvY-`,values:ge,components:_e})}),t[97]=ge,t[98]=ve);let ye;t[99]!==he||t[100]!==ve?(ye=(0,Z.jsxs)(Rs,{children:[he,ve]}),t[99]=he,t[100]=ve,t[101]=ye):ye=t[101];let be;t[102]===Symbol.for(`react.memo_cache_sentinel`)?(be=(0,Z.jsx)(J,{id:`dEgA5A`}),t[102]=be):be=t[102];let xe;t[103]===N?xe=t[104]:(xe=(0,Z.jsx)(Jr,{variant:`outline`,"data-testid":`timeline-entry-restore-cancel`,onClick:N,children:be}),t[103]=N,t[104]=xe);let Se;t[105]===F?Se=t[106]:(Se=()=>F(),t[105]=F,t[106]=Se);let Ce;t[107]===w?Ce=t[108]:(Ce=w?(0,Z.jsx)(ns,{className:`mr-2 size-4 animate-spin`}):null,t[107]=w,t[108]=Ce);let we;t[109]===Symbol.for(`react.memo_cache_sentinel`)?(we=(0,Z.jsx)(J,{id:`yKu_3Y`}),t[109]=we):we=t[109];let Te;t[110]!==w||t[111]!==Se||t[112]!==Ce?(Te=(0,Z.jsxs)(Jr,{variant:`destructive`,"data-testid":`timeline-entry-restore-confirm`,disabled:w,onClick:Se,children:[Ce,we]}),t[110]=w,t[111]=Se,t[112]=Ce,t[113]=Te):Te=t[113];let Ee;t[114]!==xe||t[115]!==Te?(Ee=(0,Z.jsxs)(Ls,{children:[xe,Te]}),t[114]=xe,t[115]=Te,t[116]=Ee):Ee=t[116];let De;t[117]!==ye||t[118]!==Ee?(De=(0,Z.jsxs)(Fs,{children:[ye,Ee]}),t[117]=ye,t[118]=Ee,t[119]=De):De=t[119];let Oe;t[120]!==S||t[121]!==pe||t[122]!==De?(Oe=(0,Z.jsx)(zs,{open:S,onOpenChange:pe,children:De}),t[120]=S,t[121]=pe,t[122]=De,t[123]=Oe):Oe=t[123];let ke;return t[124]!==fe||t[125]!==Oe?(ke=(0,Z.jsxs)(Z.Fragment,{children:[fe,Oe]}),t[124]=fe,t[125]=Oe,t[126]=ke):ke=t[126],ke}function zv(e){return e.docs}function Bv(e){let t=(0,$.c)(46),{docName:n,diffLayout:r,onDiffLayoutChange:i}=e,{_:a}=kt(),{resolvedTheme:o}=sn(),s=o===`dark`,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=[],t[0]=c):c=t[0];let[l,u]=(0,Q.useState)(c),[d,f]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(null),[h]=(0,Q.useState)(Wv),[g,_]=(0,Q.useState)(Uv),v;t[1]===h?v=t[2]:(v=()=>{_(new Set),h.clear()},t[1]=h,t[2]=v);let y;t[3]===n?y=t[4]:(y=[n],t[3]=n,t[4]=y),(0,Q.useEffect)(v,y);let b;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(b=function(e){_(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},t[5]=b):b=t[5];let x=b,S;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(S=function(){_(new Set)},t[6]=S):S=t[6];let C=S,w,T;t[7]!==a||t[8]!==n?(w=()=>{if(!n){u([]);return}f(!0);let e=K_({baseMs:wv,maxBackoffMs:Tv,isPaused:Hv,poll:e=>Ev(n,e,{setEntries:u,setError:m,setLoading:f,unavailableMessage:a({id:`brCtGB`})})});e.start();let t=()=>e.resume();return typeof document<`u`&&document.addEventListener(`visibilitychange`,t),()=>{e.stop(),typeof document<`u`&&document.removeEventListener(`visibilitychange`,t)}},T=[n,a],t[7]=a,t[8]=n,t[9]=w,t[10]=T):(w=t[9],T=t[10]),(0,Q.useEffect)(w,T);let E=!d&&!p&&l.length>0,D;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsx)($t,{children:(0,Z.jsx)(J,{id:`cklVjM`})}),t[11]=D):D=t[11];let O;t[12]!==a||t[13]!==r||t[14]!==E||t[15]!==i?(O=E&&(0,Z.jsxs)(Os,{children:[(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsxs)(Rc,{type:`single`,value:r,onValueChange:e=>{e&&i(e)},"aria-label":a({id:`XvPJaT`}),variant:`segmented`,size:`sm`,spacing:1,className:`bg-muted dark:bg-background p-0.5 rounded-md shrink-0`,children:[(0,Z.jsx)(Ic,{value:`unified`,"aria-label":a({id:`379t2h`}),className:`size-6 px-0`,children:(0,Z.jsx)(Tf,{className:`size-3.5`})}),(0,Z.jsx)(Ic,{value:`split`,"aria-label":a({id:`HXFyWD`}),className:`size-6 px-0`,children:(0,Z.jsx)(Pd,{className:`size-3.5`})})]})}),(0,Z.jsx)(Es,{children:r===`unified`?(0,Z.jsx)(J,{id:`379t2h`}):(0,Z.jsx)(J,{id:`HXFyWD`})})]}),t[12]=a,t[13]=r,t[14]=E,t[15]=i,t[16]=O):O=t[16];let k;t[17]===O?k=t[18]:(k=(0,Z.jsxs)(Xt,{children:[D,O]}),t[17]=O,t[18]=k);let A;t[19]!==a||t[20]!==d?(A=d&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-1 p-2`,role:`status`,"aria-busy":`true`,"aria-label":a({id:`o49mDZ`}),children:[1,2,3].map(Vv)}),t[19]=a,t[20]=d,t[21]=A):A=t[21];let j;t[22]!==p||t[23]!==d?(j=!d&&p&&(0,Z.jsx)(`div`,{className:`px-4 py-3`,children:(0,Z.jsx)(`p`,{className:`text-xs text-destructive`,children:p})}),t[22]=p,t[23]=d,t[24]=j):j=t[24];let M;t[25]!==l||t[26]!==p||t[27]!==d?(M=!d&&!p&&l.length===0&&(0,Z.jsx)(`div`,{className:`px-4 py-8 text-center`,children:(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(J,{id:`Ta25TG`})})}),t[25]=l,t[26]=p,t[27]=d,t[28]=M):M=t[28];let N;t[29]!==h||t[30]!==r||t[31]!==n||t[32]!==l||t[33]!==p||t[34]!==g||t[35]!==s||t[36]!==d?(N=!d&&!p&&l.length>0&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-1 p-2`,children:l.map(e=>(0,Z.jsx)(Rv,{entry:e,isDark:s,diffLayout:r,cache:h,docName:n,expanded:g.has(e.sha),onToggleExpanded:x,onRestoreSuccess:C},e.sha))}),t[29]=h,t[30]=r,t[31]=n,t[32]=l,t[33]=p,t[34]=g,t[35]=s,t[36]=d,t[37]=N):N=t[37];let P;t[38]!==A||t[39]!==j||t[40]!==M||t[41]!==N?(P=(0,Z.jsxs)(`div`,{className:`flex-1 overflow-y-auto subtle-scrollbar scroll-fade-mask`,children:[A,j,M,N]}),t[38]=A,t[39]=j,t[40]=M,t[41]=N,t[42]=P):P=t[42];let F;return t[43]!==k||t[44]!==P?(F=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[k,P]}),t[43]=k,t[44]=P,t[45]=F):F=t[45],F}function Vv(e){return(0,Z.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-lg px-3 py-2.5`,children:[(0,Z.jsx)(Ka,{className:`size-3.5 rounded mt-0.5 shrink-0`}),(0,Z.jsxs)(`div`,{className:`flex-1 space-y-1.5`,children:[(0,Z.jsx)(Ka,{className:`h-3 w-28`}),(0,Z.jsx)(Ka,{className:`h-3 w-40`})]})]},e)}function Hv(){return typeof document<`u`&&document.visibilityState===`hidden`}function Uv(){return new Set}function Wv(){return new ls(32)}var Gv=[{id:`outline`,icon:of},{id:`links`,icon:vt},{id:`graph`,icon:uf},{id:`timeline`,icon:Nd}];function Kv(e){return e===`outline`?Gc._({id:`dD7NPy`}):e===`links`?Gc._({id:`Rj01Fz`}):e===`graph`?Gc._({id:`x2fr_j`}):Gc._({id:`cklVjM`})}function qv(){return n(()=>import(`./GraphPanel-RxqTHyYU.js`),__vite__mapDeps([9,1,10,3,11,12,6,7,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42]),import.meta.url)}var Jv=(0,Q.lazy)(async()=>({default:(await qv()).GraphPanel})),Yv=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-9CRsXwpX.js`),__vite__mapDeps([43,1,2,44,45,46,11,47,48,49,50,51,52,53,54,21,10,3,55,40,7,56,12,6,13,57,58,39,16,33,34,35,59,20,15,4,60,17,61,62,19,63,64,65,66,32,36,37,38,67,68,69,70,71,72,73,74,75,76]),import.meta.url)).ActivityModeContent}));function Xv(e){let t=(0,$.c)(18),{docName:n,isSourceMode:r,activeTab:i,onActiveTabChange:a,mode:o}=e,{_:s}=kt(),[c,l]=(0,Q.useState)(`unified`),u=_g(),d,f,p;if(t[0]!==s||t[1]!==i||t[2]!==o||t[3]!==a||t[4]!==u){let e=u?Gv.filter(Qv):Gv;d=e.some(e=>e.id===i)?i:`outline`,f=o===`doc`&&e.length>1,p=f?(0,Z.jsx)(`div`,{className:`flex flex-row items-center justify-center gap-3 p-2`,children:(0,Z.jsx)(Rc,{type:`single`,variant:`outline`,value:d,onValueChange:e=>{e&&a(e)},"aria-label":s({id:`SrOuyg`}),children:e.map(Zv)})}):null,t[0]=s,t[1]=i,t[2]=o,t[3]=a,t[4]=u,t[5]=d,t[6]=f,t[7]=p}else d=t[5],f=t[6],p=t[7];let m;t[8]!==c||t[9]!==n||t[10]!==d||t[11]!==r||t[12]!==o||t[13]!==f?(m=o===`doc`?(0,Z.jsxs)(`div`,{...f?{role:`tabpanel`,id:`panel-${d}`,"aria-labelledby":`tab-${d}`}:{},className:`min-h-0 flex-1`,children:[d===`outline`&&(0,Z.jsx)(uu,{docName:n,isSourceMode:r}),d===`links`&&(0,Z.jsx)(G_,{docName:n}),d===`graph`&&(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`-lCAuQ`})}),children:(0,Z.jsx)(Jv,{activeDocName:n})}),d===`timeline`&&(0,Z.jsx)(Bv,{docName:n,diffLayout:c,onDiffLayoutChange:l})]}):(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(`div`,{role:`status`,"aria-busy":`true`,className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`ONPvOb`})}),children:(0,Z.jsx)(Yv,{})})}),t[8]=c,t[9]=n,t[10]=d,t[11]=r,t[12]=o,t[13]=f,t[14]=m):m=t[14];let h;return t[15]!==p||t[16]!==m?(h=(0,Z.jsxs)(Z.Fragment,{children:[p,m]}),t[15]=p,t[16]=m,t[17]=h):h=t[17],h}function Zv(e){let{id:t,icon:n}=e,r=Kv(t);return(0,Z.jsxs)(Os,{children:[(0,Z.jsx)(Ic,{value:t,role:`tab`,id:`tab-${t}`,"aria-controls":`panel-${t}`,"aria-label":r,asChild:!0,children:(0,Z.jsx)(Ts,{children:(0,Z.jsx)(n,{})})}),(0,Z.jsx)(Es,{side:`bottom`,children:r})]},t)}function Qv(e){return e.id===`outline`}function $v(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function ey(e,t){let n=getComputedStyle(e.ownerDocument.body);return t*parseFloat(n.fontSize)}function ty(e){return e/100*window.innerHeight}function ny(e){return e/100*window.innerWidth}function ry(e){switch(typeof e){case`number`:return[e,`px`];case`string`:{let t=parseFloat(e);return e.endsWith(`%`)?[t,`%`]:e.endsWith(`px`)?[t,`px`]:e.endsWith(`rem`)?[t,`rem`]:e.endsWith(`em`)?[t,`em`]:e.endsWith(`vh`)?[t,`vh`]:e.endsWith(`vw`)?[t,`vw`]:[t,`%`]}}}function iy({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=ry(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=ey(t,i);break;case`em`:r=$v(t,i);break;case`vh`:r=ty(i);break;case`vw`:r=ny(i);break}return r}function ay(e){return parseFloat(e.toFixed(3))}function oy({group:e}){let{orientation:t,panels:n}=e;return n.reduce((e,n)=>(e+=t===`horizontal`?n.element.offsetWidth:n.element.offsetHeight,e),0)}function sy(e){let{panels:t}=e,n=oy({group:e});return n===0?t.map(e=>({groupResizeBehavior:e.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:e.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:e.panelConstraints.disabled,minSize:0,maxSize:100,panelId:e.id})):t.map(e=>{let{element:t,panelConstraints:r}=e,i=0;r.collapsedSize!==void 0&&(i=ay(iy({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=ay(iy({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=ay(iy({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=ay(iy({groupSize:n,panelElement:t,styleProp:r.maxSize})/n*100)),{groupResizeBehavior:r.groupResizeBehavior,collapsedSize:i,collapsible:r.collapsible===!0,defaultSize:a,disabled:r.disabled,minSize:o,maxSize:s,panelId:e.id}})}function cy(e,t=`Assertion error`){if(!e)throw Error(t)}function ly(e,t){return Array.from(t).sort(e===`horizontal`?uy:dy)}function uy(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function dy(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function fy(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function py(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function my({orientation:e,rects:t,targetRect:n}){let r={x:n.x+n.width/2,y:n.y+n.height/2},i,a=Number.MAX_VALUE;for(let n of t){let{x:t,y:o}=py(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return cy(i,`No rect found`),i}var hy;function gy(){return hy===void 0&&(hy=typeof matchMedia==`function`?!!matchMedia(`(pointer:coarse)`).matches:!1),hy}function _y(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=ly(n,Array.from(t.children).filter(fy).map(e=>({element:e}))).map(({element:e})=>e),o=[],s=!1,c=!1,l=-1,u=-1,d=0,f,p=[];{let e=-1;for(let t of a)t.hasAttribute(`data-panel`)&&(e++,t.hasAttribute(`data-disabled`)||(d++,l===-1&&(l=e),u=e))}if(d>1){let t=-1;for(let d of a)if(d.hasAttribute(`data-panel`)){t++;let i=r.find(e=>e.element===d);if(i){if(f){let r=f.element.getBoundingClientRect(),a=d.getBoundingClientRect(),m;if(c){let e=n===`horizontal`?new DOMRect(r.right,r.top,0,r.height):new DOMRect(r.left,r.bottom,r.width,0),t=n===`horizontal`?new DOMRect(a.left,a.top,0,a.height):new DOMRect(a.left,a.top,a.width,0);switch(p.length){case 0:m=[e,t];break;case 1:{let i=p[0];m=[i,my({orientation:n,rects:[r,a],targetRect:i.element.getBoundingClientRect()})===r?t:e];break}default:m=p;break}}else m=p.length?p:[n===`horizontal`?new DOMRect(r.right,a.top,a.left-r.right,a.height):new DOMRect(a.left,r.bottom,a.width,a.top-r.bottom)];for(let n of m){let r=`width`in n?n:n.element.getBoundingClientRect(),a=gy()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(r.width<a){let e=a-r.width;r=new DOMRect(r.x-e/2,r.y,r.width+e,r.height)}if(r.height<a){let e=a-r.height;r=new DOMRect(r.x,r.y-e/2,r.width,r.height+e)}!s&&!(t<=l||t>u)&&o.push({group:e,groupSize:oy({group:e}),panels:[f,i],separator:`width`in n?void 0:n,rect:r}),s=!1}}c=!1,f=i,p=[]}}else if(d.hasAttribute(`data-separator`)){d.ariaDisabled!==null&&(s=!0);let e=i.find(e=>e.element===d);e?p.push(e):(f=void 0,p=[])}else c=!0}return o}var vy=class{#e={};addListener(e,t){let n=this.#e[e];return n===void 0?this.#e[e]=[t]:n.includes(t)||n.push(t),()=>{this.removeListener(e,t)}}emit(e,t){let n=this.#e[e];if(n!==void 0)if(n.length===1)n[0].call(null,t);else{let e=!1,r=null,i=Array.from(n);for(let n=0;n<i.length;n++){let a=i[n];try{a.call(null,t)}catch(t){r===null&&(e=!0,r=t)}}if(e)throw r}}removeAllListeners(){this.#e={}}removeListener(e,t){let n=this.#e[e];if(n!==void 0){let e=n.indexOf(t);e>=0&&n.splice(e,1)}}},yy=new Map,by=new vy;function xy(e){yy=new Map(yy),yy.delete(e)}function Sy(e,t){for(let[t]of yy)if(t.id===e)return t}function Cy(e,t){for(let[t,n]of yy)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function wy(){return yy}function Ty(e,t){return by.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function Ey(e,t){let n=yy.get(e);yy=new Map(yy),yy.set(e,t),by.emit(`groupChange`,{group:e,prev:n,next:t})}function Dy(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=py(n,a.rect);switch(e){case`horizontal`:t.x<=i.x&&(r=a,i=t);break;case`vertical`:t.y<=i.y&&(r=a,i=t);break}}return r?{distance:i,hitRegion:r}:void 0}function Oy(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function ky(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:Fy(e),b:Fy(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();cy(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:Py(Ny(n.a)),b:Py(Ny(n.b))};if(i.a===i.b){let e=r.childNodes,t={a:n.a.at(-1),b:n.b.at(-1)},i=e.length;for(;i--;){let n=e[i];if(n===t.a)return 1;if(n===t.b)return-1}}return Math.sign(i.a-i.b)}var Ay=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function jy(e){let t=getComputedStyle(Iy(e)??e).display;return t===`flex`||t===`inline-flex`}function My(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||jy(e))||+t.opacity<1||`transform`in t&&t.transform!==`none`||`webkitTransform`in t&&t.webkitTransform!==`none`||`mixBlendMode`in t&&t.mixBlendMode!==`normal`||`filter`in t&&t.filter!==`none`||`webkitFilter`in t&&t.webkitFilter!==`none`||`isolation`in t&&t.isolation===`isolate`||Ay.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function Ny(e){let t=e.length;for(;t--;){let n=e[t];if(cy(n,`Missing node`),My(n))return n}return null}function Py(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Fy(e){let t=[];for(;e;)t.push(e),e=Iy(e);return t}function Iy(e){let{parentNode:t}=e;return Oy(t)?t.host:t}function Ly(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function Ry({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!fy(n)||n.contains(e)||e.contains(n))return!0;if(ky(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(Ly(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function zy(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=_y(r),a=Dy(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&Ry({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function By(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function Vy(e,t,n=0){return Math.abs(ay(e)-ay(t))<=n}function Hy(e,t){return Vy(e,t)?0:e>t?1:-1}function Uy({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:r}){let{collapsedSize:i=0,collapsible:a,disabled:o,maxSize:s=100,minSize:c=0}=t;if(o&&!e)return n;if(Hy(r,c)<0)if(a){let e=(i+c)/2;r=Hy(r,e)<0?i:c}else r=c;return r=Math.min(s,r),r=ay(r),r}function Wy({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(Vy(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;cy(u!=null,`Invalid first pivot index`),cy(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];cy(r,`Panel constraints not found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=s[t];if(cy(n!=null,`Previous layout not found for panel index ${t}`),Vy(n,i)){let t=o-n;Hy(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];cy(r,`No panel constraints found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=s[t];if(cy(n!=null,`Previous layout not found for panel index ${t}`),Vy(n,o)){let t=n-i;Hy(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];cy(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&Hy(i,c)<0)if(e>0){let t=c-o,n=t/2;Hy(i+e,c)<0&&(e=Hy(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;Hy(i-e,c)<0&&(e=Hy(100+e,n)>0?0:-t)}break}}{let t=e<0?1:-1,r=e<0?d:u,i=0;for(;;){let e=s[r];cy(e!=null,`Previous layout not found for panel index ${r}`);let a=Uy({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:e,size:100})-e;if(i+=a,r+=t,r<0||r>=n.length)break}let a=Math.min(Math.abs(e),Math.abs(i));e=e<0?0-a:a}{let t=e<0?u:d;for(;t>=0&&t<n.length;){let r=Math.abs(e)-Math.abs(f),i=s[t];cy(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=Uy({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!Vy(i,c)&&(f+=i-c,l[t]=c,f.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?t--:t++}}if(By(c,l))return i;{let t=e<0?d:u,r=s[t];cy(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=Uy({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!Vy(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];cy(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=Uy({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(Vy(i,s)||(t-=s-i,l[r]=s),Vy(t,0))break;e>0?r--:r++}}}if(!Vy(Object.values(l).reduce((e,t)=>t+e,0),100,.1))return i;let p=Object.keys(i);return l.reduce((e,t,n)=>(e[p[n]]=t,e),{})}function Gy(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||Hy(e[n],t[n])!==0)return!1;return!0}function Ky({layout:e,panelConstraints:t}){let n=Object.values(e),r=[...n],i=r.reduce((e,t)=>e+t,0);if(r.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${r.map(e=>`${e}%`).join(`, `)}`);if(!Vy(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];cy(t!=null,`No layout data found for index ${e}`),r[e]=100/i*t}let a=0;for(let e=0;e<t.length;e++){let i=n[e];cy(i!=null,`No layout data found for index ${e}`);let o=r[e];cy(o!=null,`No layout data found for index ${e}`);let s=Uy({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!Vy(a,0))for(let e=0;e<t.length;e++){let n=r[e];cy(n!=null,`No layout data found for index ${e}`);let i=n+a,o=Uy({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,Vy(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function qy({groupId:e,panelId:t}){let n=()=>{let t=wy();for(let[n,{defaultLayoutDeferred:r,derivedPanelConstraints:i,layout:a,groupSize:o,separatorToPanels:s}]of t)if(n.id===e)return{defaultLayoutDeferred:r,derivedPanelConstraints:i,group:n,groupSize:o,layout:a,separatorToPanels:s};throw Error(`Group ${e} not found`)},r=()=>{let e=n().derivedPanelConstraints.find(e=>e.panelId===t);if(e!==void 0)return e;throw Error(`Panel constraints not found for Panel ${t}`)},i=()=>{let e=n().group.panels.find(e=>e.id===t);if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},a=()=>{let e=n().layout[t];if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},o=e=>{let r=a();if(e===r)return;let{defaultLayoutDeferred:i,derivedPanelConstraints:o,group:s,groupSize:c,layout:l,separatorToPanels:u}=n(),d=s.panels.findIndex(e=>e.id===t),f=d===s.panels.length-1,p=Ky({layout:Wy({delta:f?r-e:e-r,initialLayout:l,panelConstraints:o,pivotIndices:f?[d-1,d]:[d,d+1],prevLayout:l,trigger:`imperative-api`}),panelConstraints:o});Gy(l,p)||Ey(s,{defaultLayoutDeferred:i,derivedPanelConstraints:o,groupSize:c,layout:p,separatorToPanels:u})};return{collapse:()=>{let{collapsible:e,collapsedSize:t}=r(),{mutableValues:n}=i(),s=a();e&&s!==t&&(n.expandToSize=s,o(t))},expand:()=>{let{collapsible:e,collapsedSize:t,minSize:n}=r(),{mutableValues:s}=i(),c=a();if(e&&c===t){let e=s.expandToSize??n;e===0&&(e=1),o(e)}},getSize:()=>{let{group:e}=n(),t=a(),{element:r}=i();return{asPercentage:t,inPixels:e.orientation===`horizontal`?r.offsetWidth:r.offsetHeight}},isCollapsed:()=>{let{collapsible:e,collapsedSize:t}=r(),n=a();return e&&Vy(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=oy({group:t});o(ay(iy({groupSize:a,panelElement:r,styleProp:e})/a*100))}}}function Jy(e){e.defaultPrevented||zy(e,wy()).forEach(t=>{if(t.separator&&!t.separator.disableDoubleClick){let n=t.panels.find(e=>e.panelConstraints.defaultSize!==void 0);if(n){let r=n.panelConstraints.defaultSize,i=qy({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function Yy(e){let t=wy();for(let[n]of t)if(n.separators.some(t=>t.element===e))return n;throw Error(`Could not find parent Group for separator element`)}function Xy({groupId:e}){let t=()=>{let t=wy();for(let[n,r]of t)if(n.id===e)return{group:n,...r};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){let{defaultLayoutDeferred:e,layout:n}=t();return e?{}:n},setLayout(e){let{defaultLayoutDeferred:n,derivedPanelConstraints:r,group:i,groupSize:a,layout:o,separatorToPanels:s}=t(),c=Ky({layout:e,panelConstraints:r});return n?o:(Gy(o,c)||Ey(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function Zy(e,t){let n=Yy(e),r=Cy(n.id,!0),i=n.separators.find(t=>t.element===e);cy(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);cy(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=Xy({groupId:n.id}).getLayout(),c=Ky({layout:Wy({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});Gy(s,c)||Ey(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels})}function Qy(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=Yy(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&Zy(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&Zy(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&Zy(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&Zy(t,-5);break;case`End`:e.preventDefault(),Zy(t,100);break;case`Enter`:{e.preventDefault();let n=Yy(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=Cy(n.id,!0),o=n.separators.find(e=>e.element===t);cy(o,`Matching separator not found`);let s=a.get(o);cy(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(cy(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];Zy(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=Yy(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);cy(r!==null,`Index not found`),n[e.shiftKey?r>0?r-1:n.length-1:r+1<n.length?r+1:0].focus({preventScroll:!0});break}case`Home`:e.preventDefault(),Zy(t,-100);break}}var $y={cursorFlags:0,state:`inactive`},eb=new vy;function tb(){return $y}function nb(e){return eb.addListener(`change`,e)}function rb(e){let t=$y,n={...$y};n.cursorFlags=e,$y=n,eb.emit(`change`,{prev:t,next:n})}function ib(e){let t=$y;$y=e,eb.emit(`change`,{prev:t,next:e})}function ab(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=wy(),n=zy(e,t),r=new Map,i=!1;n.forEach(e=>{e.separator&&(i||(i=!0,e.separator.element.focus({preventScroll:!0})));let n=t.get(e.group);n&&r.set(e.group,n.layout)}),ib({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}var ob=e=>e,sb=()=>{},cb=1,lb=2,ub=4,db=8,fb=3,pb=12,mb;function hb(){return mb===void 0&&(mb=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(mb=!0)),mb}function gb({cursorFlags:e,groups:t,state:n}){let r=0,i=0;switch(n){case`active`:case`hover`:t.forEach(e=>{if(!e.mutableState.disableCursor)switch(e.orientation){case`horizontal`:r++;break;case`vertical`:i++;break}})}if(!(r===0&&i===0)){switch(n){case`active`:if(e&&hb()){let t=(e&cb)!==0,n=(e&lb)!==0,r=(e&ub)!==0,i=(e&db)!==0;if(t)return r?`se-resize`:i?`ne-resize`:`e-resize`;if(n)return r?`sw-resize`:i?`nw-resize`:`w-resize`;if(r)return`s-resize`;if(i)return`n-resize`}break}return hb()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var _b=new WeakMap;function vb(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=_b.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&e.adoptedStyleSheets.push(n));let r=tb();switch(r.state){case`active`:case`hover`:{let e=gb({cursorFlags:r.cursorFlags,groups:r.hitRegions.map(e=>e.group),state:r.state}),i=`*, *:hover {cursor: ${e} !important; }`;if(t===i)return;t=i,e?n.cssRules.length===0?n.insertRule(i):n.replaceSync(i):n.cssRules.length===1&&n.deleteRule(0);break}case`inactive`:t=void 0,n.cssRules.length===1&&n.deleteRule(0);break}_b.set(e,{prevStyle:t,styleSheet:n})}function yb({document:e,event:t,hitRegions:n,initialLayoutMap:r,mountedGroups:i,pointerDownAtPoint:a,prevCursorFlags:o}){let s=0;n.forEach(e=>{let{group:n,groupSize:o}=e,{orientation:c,panels:l}=n,{disableCursor:u}=n.mutableState,d=0;d=a?c===`horizontal`?(t.clientX-a.x)/o*100:(t.clientY-a.y)/o*100:c===`horizontal`?t.clientX<0?-100:100:t.clientY<0?-100:100;let f=r.get(n),p=i.get(n);if(!f||!p)return;let{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:_,separatorToPanels:v}=p;if(h&&_&&v){let t=Wy({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(Gy(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?cb:lb;break;case`vertical`:s|=d<0?ub:db;break}}else Ey(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&fb:c|=s&fb,t.movementY===0?c|=o&pb:c|=s&pb,rb(c),vb(e)}function bb(e){let t=wy(),n=tb();switch(n.state){case`active`:yb({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function xb(e){if(e.defaultPrevented)return;let t=tb(),n=wy();switch(t.state){case`active`:if(e.buttons===0){ib({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{let t=Cy(e.group.id,!0);Ey(e.group,t)});return}for(let n of t.hitRegions)if(n.separator){let{element:t}=n.separator;t.hasPointerCapture?.(e.pointerId)||t.setPointerCapture?.(e.pointerId)}yb({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=zy(e,n);r.length===0?t.state!==`inactive`&&ib({cursorFlags:0,state:`inactive`}):ib({cursorFlags:0,hitRegions:r,state:`hover`}),vb(e.currentTarget);break}}}function Sb(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(tb().state){case`hover`:ib({cursorFlags:0,state:`inactive`})}}function Cb(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=tb();switch(t.state){case`active`:ib({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&(vb(e.currentTarget),t.hitRegions.forEach(e=>{let t=Cy(e.group.id,!0);Ey(e.group,t)}),e.preventDefault())}}function wb(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=ay(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=ay((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function Tb(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=oy({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:ay(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function Eb(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function Db({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:r}){if(n<=0||t<=0||n===t)return r;let i=0,a=0,o=!1,s=new Map,c=[];for(let l of e.panels){let e=r[l.id]??0;switch(l.panelConstraints.groupResizeBehavior){case`preserve-pixel-size`:{o=!0;let r=ay(e/100*n/t*100);s.set(l.id,r),i+=r;break}default:c.push(l.id),a+=e;break}}if(!o||c.length===0)return r;let l=100-i,u={...r};if(s.forEach((e,t)=>{u[t]=e}),a>0)for(let e of c)u[e]=ay((r[e]??0)/a*l);else{let e=ay(l/c.length);for(let t of c)u[t]=e}return u}function Ob(e,t){let n=e.map(e=>e.id),r=Object.keys(t);if(n.length!==r.length)return!1;for(let e of n)if(!r.includes(e))return!1;return!0}var kb=new Map;function Ab(e){let t=!0;cy(e.element.ownerDocument.defaultView,`Cannot register an unmounted Group`);let n=e.element.ownerDocument.defaultView.ResizeObserver,r=new Set,i=new Set,a=new n(n=>{for(let r of n){let{borderBoxSize:n,target:i}=r;if(i===e.element){if(t){let t=oy({group:e});if(t===0)return;let n=Cy(e.id);if(!n)return;let r=sy(e),i=n.defaultLayoutDeferred?wb(r):n.layout,a=Ky({layout:Db({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&Gy(n.layout,a)&&Eb(n.derivedPanelConstraints,r)&&n.groupSize===t)return;Ey(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else Tb(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{cy(!r.has(e.id),`Panel ids must be unique; id "${e.id}" was used more than once`),r.add(e.id),e.onResize&&a.observe(e.element)});let o=oy({group:e}),s=sy(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(Ob(e.panels,l)||(l=void 0));let u=Ky({layout:e.mutableState.layouts[c]??l??wb(s),panelConstraints:s}),d=e.element.ownerDocument;kb.set(d,(kb.get(d)??0)+1);let f=new Map;return _y(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),Ey(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{cy(!i.has(e.id),`Separator ids must be unique; id "${e.id}" was used more than once`),i.add(e.id),e.element.addEventListener(`keydown`,Qy)}),kb.get(d)===1&&(d.addEventListener(`dblclick`,Jy,!0),d.addEventListener(`pointerdown`,ab,!0),d.addEventListener(`pointerleave`,bb),d.addEventListener(`pointermove`,xb),d.addEventListener(`pointerout`,Sb),d.addEventListener(`pointerup`,Cb,!0)),function(){t=!1,kb.set(d,Math.max(0,(kb.get(d)??0)-1)),xy(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,Qy)}),kb.get(d)||(d.removeEventListener(`dblclick`,Jy,!0),d.removeEventListener(`pointerdown`,ab,!0),d.removeEventListener(`pointerleave`,bb),d.removeEventListener(`pointermove`,xb),d.removeEventListener(`pointerout`,Sb),d.removeEventListener(`pointerup`,Cb,!0)),a.disconnect()}}function jb(){let[e,t]=(0,Q.useState)({});return[e,(0,Q.useCallback)(()=>t({}),[])]}function Mb(e){let t=(0,Q.useId)();return`${e??t}`}var Nb=typeof window<`u`?Q.useLayoutEffect:Q.useEffect;function Pb(e){let t=(0,Q.useRef)(e);return Nb(()=>{t.current=e},[e]),(0,Q.useCallback)((...e)=>t.current?.(...e),[t])}function Fb(...e){return Pb(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t;break}})})}function Ib(e){let t=(0,Q.useRef)({...e});return Nb(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var Lb=(0,Q.createContext)(null);function Rb(e,t){let n=(0,Q.useRef)({getLayout:()=>({}),setLayout:ob});(0,Q.useImperativeHandle)(t,()=>n.current,[]),Nb(()=>{Object.assign(n.current,Xy({groupId:e}))})}function zb({children:e,className:t,defaultLayout:n,disableCursor:r,disabled:i,elementRef:a,groupRef:o,id:s,onLayoutChange:c,onLayoutChanged:l,orientation:u=`horizontal`,resizeTargetMinimumSize:d={coarse:20,fine:10},style:f,...p}){let m=(0,Q.useRef)({onLayoutChange:{},onLayoutChanged:{}}),h=Pb(e=>{Gy(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=Pb(e=>{Gy(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e))}),_=Mb(s),v=(0,Q.useRef)(null),[y,b]=jb(),x=(0,Q.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),S=Fb(v,a);Rb(_,o);let C=Pb((e,t)=>{let r=tb(),i=Sy(e),a=Cy(e);if(a){let e=!1;switch(r.state){case`active`:e=r.hitRegions.some(e=>e.group===i);break}return{flexGrow:a.layout[t]??1,pointerEvents:e?`none`:void 0}}if(n?.[t])return{flexGrow:n?.[t]}}),w=Ib({defaultLayout:n,disableCursor:r}),T=(0,Q.useMemo)(()=>({get disableCursor(){return!!w.disableCursor},getPanelStyles:C,id:_,orientation:u,registerPanel:e=>{let t=x.current;return t.panels=ly(u,[...t.panels,e]),b(),()=>{t.panels=t.panels.filter(t=>t!==e),b()}},registerSeparator:e=>{let t=x.current;return t.separators=ly(u,[...t.separators,e]),b(),()=>{t.separators=t.separators.filter(t=>t!==e),b()}},updatePanelProps:(e,{disabled:t})=>{let n=x.current.panels.find(t=>t.id===e);n&&(n.panelConstraints.disabled=t);let r=Sy(_),i=Cy(_);r&&i&&Ey(r,{...i,derivedPanelConstraints:sy(r)})},updateSeparatorProps:(e,{disabled:t,disableDoubleClick:n})=>{let r=x.current.separators.find(t=>t.id===e);r&&(r.disabled=t,r.disableDoubleClick=n)}}),[C,_,b,u,w]),E=(0,Q.useRef)(null);return Nb(()=>{let e=v.current;if(e===null)return;let t=x.current,n;if(w.defaultLayout!==void 0&&Object.keys(w.defaultLayout).length===t.panels.length){n={};for(let e of t.panels){let t=w.defaultLayout[e.id];t!==void 0&&(n[e.id]=t)}}let r={disabled:!!i,element:e,id:_,mutableState:{defaultLayout:n,disableCursor:!!w.disableCursor,expandedPanelSizes:x.current.lastExpandedPanelSizes,layouts:x.current.layouts},orientation:u,panels:t.panels,resizeTargetMinimumSize:t.resizeTargetMinimumSize,separators:t.separators};E.current=r;let a=Ab(r),{defaultLayoutDeferred:o,derivedPanelConstraints:s,layout:c}=Cy(r.id,!0);!o&&s.length>0&&(h(c),g(c));let l=Ty(_,e=>{let{defaultLayoutDeferred:t,derivedPanelConstraints:n,layout:i}=e.next;if(t||n.length===0)return;let a=r.panels.map(({id:e})=>e).join(`,`);r.mutableState.layouts[a]=i,n.forEach(t=>{if(t.collapsible){let{layout:n}=e.prev??{};if(n){let e=Vy(t.collapsedSize,i[t.panelId]),a=Vy(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=tb().state!==`active`;h(i),o&&g(i)});return()=>{E.current=null,a(),l()}},[i,_,g,h,u,y,w]),(0,Q.useEffect)(()=>{let e=E.current;e&&(e.mutableState.defaultLayout=n,e.mutableState.disableCursor=!!r)}),(0,Z.jsx)(Lb.Provider,{value:T,children:(0,Z.jsx)(`div`,{...p,className:t,"data-group":!0,"data-testid":_,id:_,ref:S,style:{height:`100%`,width:`100%`,overflow:`hidden`,...f,display:`flex`,flexDirection:u===`horizontal`?`row`:`column`,flexWrap:`nowrap`,touchAction:u===`horizontal`?`pan-y`:`pan-x`},children:e})})}zb.displayName=`Group`;function Bb(){return(0,Q.useRef)(null)}function Vb(){let e=(0,Q.useContext)(Lb);return cy(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function Hb(e,t){let{id:n}=Vb(),r=(0,Q.useRef)({collapse:sb,expand:sb,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:sb});(0,Q.useImperativeHandle)(t,()=>r.current,[]),Nb(()=>{Object.assign(r.current,qy({groupId:n,panelId:e}))})}function Ub({children:e,className:t,collapsedSize:n=`0%`,collapsible:r=!1,defaultSize:i,disabled:a,elementRef:o,groupResizeBehavior:s=`preserve-relative-size`,id:c,maxSize:l=`100%`,minSize:u=`0%`,onResize:d,panelRef:f,style:p,...m}){let h=!!c,g=Mb(c),_=Ib({disabled:a}),v=(0,Q.useRef)(null),y=Fb(v,o),{getPanelStyles:b,id:x,orientation:S,registerPanel:C,updatePanelProps:w}=Vb(),T=d!==null,E=Pb((e,t,n)=>{d?.(e,c,n)});Nb(()=>{let e=v.current;if(e!==null)return C({element:e,id:g,idIsStable:h,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:T?E:void 0,panelConstraints:{groupResizeBehavior:s,collapsedSize:n,collapsible:r,defaultSize:i,disabled:_.disabled,maxSize:l,minSize:u}})},[s,n,r,i,T,g,h,l,u,E,C,_]),(0,Q.useEffect)(()=>{w(g,{disabled:a})},[a,g,w]),Hb(g,f);let D=()=>{let e=b(x,g);if(e)return JSON.stringify(e)},O=(0,Q.useSyncExternalStore)(e=>Ty(x,e),D,D),k;return k=O?JSON.parse(O):i?{flexGrow:void 0,flexShrink:void 0,flexBasis:i}:{flexGrow:1},(0,Z.jsx)(`div`,{...m,"data-disabled":a||void 0,"data-panel":!0,"data-testid":g,id:g,ref:y,style:{...Wb,display:`flex`,flexBasis:0,flexShrink:1,overflow:`visible`,...k},children:(0,Z.jsx)(`div`,{className:t,style:{maxHeight:`100%`,maxWidth:`100%`,flexGrow:1,overflow:`auto`,...p,touchAction:S===`horizontal`?`pan-y`:`pan-x`},children:e})})}Ub.displayName=`Panel`;var Wb={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function Gb(){return(0,Q.useRef)(null)}function Kb({layout:e,panelConstraints:t,panelId:n,panelIndex:r}){let i,a,o=e[n],s=t.find(e=>e.panelId===n);if(s){let c=s.maxSize,l=s.collapsible?s.collapsedSize:s.minSize,u=[r,r+1];a=Ky({layout:Wy({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=Ky({layout:Wy({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function qb({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...s}){let c=Mb(a),l=Ib({disabled:n,disableDoubleClick:r}),[u,d]=(0,Q.useState)({}),[f,p]=(0,Q.useState)(`inactive`),m=(0,Q.useRef)(null),h=Fb(m,i),{disableCursor:g,id:_,orientation:v,registerSeparator:y,updateSeparatorProps:b}=Vb(),x=v===`horizontal`?`vertical`:`horizontal`;Nb(()=>{let e=m.current;if(e!==null){let t={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:e,id:c},n=y(t),r=nb(e=>{p(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=Ty(_,e=>{let{derivedPanelConstraints:n,layout:r,separatorToPanels:i}=e.next,a=i.get(t);if(a){let e=a[0],t=a.indexOf(e);d(Kb({layout:r,panelConstraints:n,panelId:e.id,panelIndex:t}))}});return()=>{r(),i(),n()}}},[_,c,y,l]),(0,Q.useEffect)(()=>{b(c,{disabled:n,disableDoubleClick:r})},[n,r,c,b]);let S;return n&&!g&&(S=`not-allowed`),(0,Z.jsx)(`div`,{...s,"aria-controls":u.valueControls,"aria-disabled":n||void 0,"aria-orientation":x,"aria-valuemax":u.valueMax,"aria-valuemin":u.valueMin,"aria-valuenow":u.valueNow,children:e,className:t,"data-separator":n?`disabled`:f,"data-testid":c,id:c,ref:h,role:`separator`,style:{flexBasis:`auto`,cursor:S,...o,flexGrow:0,flexShrink:0,touchAction:`none`},tabIndex:n?void 0:0})}qb.displayName=`Separator`;var Jb=new Map;function Yb(e){let t=Jb.get(e);if(t)return t;let n=Xb(e);return Jb.set(e,n),n}async function Xb(e){switch(e){case`bash`:case`shell`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-Dot7Y1W_.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([46,1,11]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{shell:e}=await import(`./shell-BbGOQhIp.js`);return{shell:e}},[],import.meta.url)).shell);case`c`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-Dot7Y1W_.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([46,1,11]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{c:e}=await import(`./clike-BpCX2P2I.js`);return{c:e}},[],import.meta.url)).c);case`cpp`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-Dot7Y1W_.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([46,1,11]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{cpp:e}=await import(`./clike-BpCX2P2I.js`);return{cpp:e}},[],import.meta.url)).cpp);case`csharp`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-Dot7Y1W_.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([46,1,11]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{csharp:e}=await import(`./clike-BpCX2P2I.js`);return{csharp:e}},[],import.meta.url)).csharp);case`css`:case`less`:case`scss`:return(await n(async()=>{let{css:e}=await import(`./dist-sRKGD4vA.js`).then(e=>e.r);return{css:e}},__vite__mapDeps([45,1,46,11,47]),import.meta.url)).css().language;case`diff`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-Dot7Y1W_.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([46,1,11]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{diff:e}=await import(`./diff-B-RpHLEu.js`);return{diff:e}},[],import.meta.url)).diff);case`go`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-Dot7Y1W_.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([46,1,11]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{go:e}=await import(`./go-3CbI6agw.js`);return{go:e}},[],import.meta.url)).go);case`ini`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-Dot7Y1W_.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([46,1,11]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{properties:e}=await import(`./properties-BbTKbq9k.js`);return{properties:e}},[],import.meta.url)).properties);case`java`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-Dot7Y1W_.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([46,1,11]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{java:e}=await import(`./clike-BpCX2P2I.js`);return{java:e}},[],import.meta.url)).java);case`javascript`:return(await n(async()=>{let{javascript:e}=await import(`./dist-DmkgvB1A.js`).then(e=>e.t);return{javascript:e}},__vite__mapDeps([49,1,50,46,11,47]),import.meta.url)).javascript().language;case`json`:return(await n(async()=>{let{json:e}=await import(`./dist-COmtpu4e.js`).then(e=>e.t);return{json:e}},__vite__mapDeps([51,1,46,11,47]),import.meta.url)).json().language;case`kotlin`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-Dot7Y1W_.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([46,1,11]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{kotlin:e}=await import(`./clike-BpCX2P2I.js`);return{kotlin:e}},[],import.meta.url)).kotlin);case`lua`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-Dot7Y1W_.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([46,1,11]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{lua:e}=await import(`./lua-CImTx43q.js`);return{lua:e}},[],import.meta.url)).lua);case`markdown`:return(await n(async()=>{let{markdown:e}=await import(`./dist-Gaq2suxg.js`).then(e=>e.t);return{markdown:e}},__vite__mapDeps([52,1,50,46,11,48,45,47,49]),import.meta.url)).markdown().language;case`objectivec`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-Dot7Y1W_.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([46,1,11]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{objectiveC:e}=await import(`./clike-BpCX2P2I.js`);return{objectiveC:e}},[],import.meta.url)).objectiveC);case`perl`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-Dot7Y1W_.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([46,1,11]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{perl:e}=await import(`./perl-Blo9V_bV.js`);return{perl:e}},[],import.meta.url)).perl);case`python`:return(await n(async()=>{let{python:e}=await import(`./dist-BxbpSpXO.js`);return{python:e}},__vite__mapDeps([77,50,46,1,11,47]),import.meta.url)).python().language;case`r`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-Dot7Y1W_.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([46,1,11]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{r:e}=await import(`./r-BoaXxHWr.js`);return{r:e}},[],import.meta.url)).r);case`ruby`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-Dot7Y1W_.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([46,1,11]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{ruby:e}=await import(`./ruby-Dl-I4pxG.js`);return{ruby:e}},[],import.meta.url)).ruby);case`rust`:return(await n(async()=>{let{rust:e}=await import(`./dist-B_WDz9Fr.js`);return{rust:e}},__vite__mapDeps([78,46,1,11,47]),import.meta.url)).rust().language;case`sql`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-Dot7Y1W_.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([46,1,11]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{standardSQL:e}=await import(`./sql-Bwur_qe2.js`);return{standardSQL:e}},[],import.meta.url)).standardSQL);case`swift`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-Dot7Y1W_.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([46,1,11]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{swift:e}=await import(`./swift-T0hDoOb-.js`);return{swift:e}},[],import.meta.url)).swift);case`typescript`:return(await n(async()=>{let{javascript:e}=await import(`./dist-DmkgvB1A.js`).then(e=>e.t);return{javascript:e}},__vite__mapDeps([49,1,50,46,11,47]),import.meta.url)).javascript({typescript:!0,jsx:!0}).language;case`xml`:return(await n(async()=>{let{html:e}=await import(`./dist-ClYcK7Yq.js`).then(e=>e.t);return{html:e}},__vite__mapDeps([48,1,45,46,11,47,49,50]),import.meta.url)).html().language;case`yaml`:return(await n(async()=>{let{yaml:e}=await import(`./dist-DYyQPSDl.js`).then(e=>e.t);return{yaml:e}},__vite__mapDeps([53,1,46,11,47]),import.meta.url)).yaml().language;default:return null}}async function Zb(e,t){if(e===`canvas`)return(await n(async()=>{let{json:e}=await import(`./dist-COmtpu4e.js`).then(e=>e.t);return{json:e}},__vite__mapDeps([51,1,46,11,47]),import.meta.url)).json().language;if(t){let e=await Yb(t);if(e)return e}return e===`toml`?(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-Dot7Y1W_.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([46,1,11]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{toml:e}=await import(`./toml-DDz4twot.js`);return{toml:e}},[],import.meta.url)).toml):null}function Qb(e){let t=(0,$.c)(10),{_:n}=kt(),r;t[0]===n?r=t[1]:(r=e=>n(e===413?{id:`C_WGy8`}:e===415?{id:`VM7H66`}:e===404?{id:`s0IDhW`}:e===400?{id:`N1mdmS`}:typeof e==`number`?{id:`96w9hU`,values:{status:e}}:{id:`ig5vUe`}),t[0]=n,t[1]=r);let i=r,{src:a,loadText:o}=e,s=(0,Q.useRef)(o),c=(0,Q.useRef)(i),l;t[2]!==o||t[3]!==i?(l=()=>{s.current=o,c.current=i},t[2]=o,t[3]=i,t[4]=l):l=t[4],(0,Q.useEffect)(l);let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u={status:`loading`},t[5]=u):u=t[5];let[d,f]=(0,Q.useState)(u),p,m;return t[6]!==n||t[7]!==a?(p=()=>{let e=!1,t=new AbortController;f({status:`loading`});let r=s.current;return r?(r(t.signal).then(t=>{if(!e){if(t.ok){f({status:`loaded`,content:t.text});return}f({status:`error`,message:t.message??c.current(t.status)})}}).catch(t=>{e||t instanceof Error&&t.name===`AbortError`||f({status:`error`,message:n({id:`ig5vUe`})})}),()=>{e=!0,t.abort()}):(fetch(a??``,{credentials:`same-origin`,signal:t.signal}).then(async e=>{if(!e.ok)throw Error(c.current(e.status));return e.text()}).then(t=>{e||f({status:`loaded`,content:t})}).catch(t=>{e||t instanceof Error&&t.name===`AbortError`||f({status:`error`,message:t instanceof Error?t.message:n({id:`ig5vUe`})})}),()=>{e=!0,t.abort()})},m=[a,n],t[6]=n,t[7]=a,t[8]=p,t[9]=m):(p=t[8],m=t[9]),(0,Q.useEffect)(p,m),d}function $b(e){let t=(0,$.c)(10),{fileName:n,dataAttr:r,extraAttrs:i}=e,a=`${r}-state`,o;t[0]!==r||t[1]!==a?(o={[r]:``,[a]:`loading`},t[0]=r,t[1]=a,t[2]=o):o=t[2];let s;t[3]===n?s=t[4]:(s=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`Md709y`,values:{fileName:n}})}),t[3]=n,t[4]=s);let c;return t[5]!==i||t[6]!==n||t[7]!==o||t[8]!==s?(c=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col items-center justify-center bg-background text-muted-foreground text-sm`,"aria-label":n,...o,...i,children:s}),t[5]=i,t[6]=n,t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function ex(e){let t=(0,$.c)(16),{fileName:n,dataAttr:r,extraAttrs:i,message:a,openHref:o}=e,s=`${r}-state`,c;t[0]!==r||t[1]!==s?(c={[r]:``,[s]:`error`},t[0]=r,t[1]=s,t[2]=c):c=t[2];let l;t[3]===n?l=t[4]:(l=(0,Z.jsx)(`div`,{className:`font-medium text-sm`,children:(0,Z.jsx)(J,{id:`qdBUHP`,values:{fileName:n}})}),t[3]=n,t[4]=l);let u;t[5]===a?u=t[6]:(u=(0,Z.jsx)(`div`,{className:`text-muted-foreground text-xs`,children:a}),t[5]=a,t[6]=u);let d;t[7]===o?d=t[8]:(d=o?(0,Z.jsx)(`a`,{href:o,className:`mt-2 rounded-md border px-3 py-1.5 text-sm hover:bg-accent hover:text-accent-foreground`,children:(0,Z.jsx)(J,{id:`9npOH9`})}):null,t[7]=o,t[8]=d);let f;return t[9]!==i||t[10]!==n||t[11]!==c||t[12]!==l||t[13]!==u||t[14]!==d?(f=(0,Z.jsxs)(`main`,{className:`flex h-full min-h-0 flex-col items-center justify-center gap-2 bg-background p-4 text-center`,"aria-label":n,...c,...i,children:[l,u,d]}),t[9]=i,t[10]=n,t[11]=c,t[12]=l,t[13]=u,t[14]=d,t[15]=f):f=t[15],f}var tx=si({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),nx=mi({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}});function rx(e){let t=(0,$.c)(23),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({fileName:r,extension:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=(0,Q.useRef)(null),o=(0,Q.useRef)(null),{resolvedTheme:s}=sn(),c=Qb(i),l=c.status===`loaded`?c.content:null,u,d;t[4]!==n||t[5]!==l||t[6]!==s?(u=()=>{if(!a.current||l===null)return;let e=n.toLowerCase(),t=In(e),r=s===`dark`?tx:nx,i=!1,c=null;return Zb(e,t).then(e=>{if(i||!a.current)return;let t=[bu,...e?[e]:[],Zl.editable.of(!0),Vl.readOnly.of(!0),Zl.lineWrapping,r];c=new Zl({state:Vl.create({doc:l,extensions:t}),parent:a.current}),o.current=c}),()=>{i=!0,c?.destroy(),o.current=null}},d=[l,n,s],t[4]=n,t[5]=l,t[6]=s,t[7]=u,t[8]=d):(u=t[7],d=t[8]),(0,Q.useEffect)(u,d);let f;t[9]===n?f=t[10]:(f={"data-text-viewer-extension":n},t[9]=n,t[10]=f);let p=f;if(c.status===`loading`){let e;return t[11]!==p||t[12]!==r?(e=(0,Z.jsx)($b,{fileName:r,dataAttr:`data-text-viewer`,extraAttrs:p}),t[11]=p,t[12]=r,t[13]=e):e=t[13],e}if(c.status===`error`){let e;return t[14]!==p||t[15]!==c.message||t[16]!==r||t[17]!==i.src?(e=(0,Z.jsx)(ex,{fileName:r,dataAttr:`data-text-viewer`,extraAttrs:p,message:c.message,openHref:i.src}),t[14]=p,t[15]=c.message,t[16]=r,t[17]=i.src,t[18]=e):e=t[18],e}let m;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(`div`,{ref:a,className:`min-h-0 flex-1 overflow-auto`}),t[19]=m):m=t[19];let h;return t[20]!==n||t[21]!==r?(h=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":r,"data-text-viewer":``,"data-text-viewer-state":`loaded`,"data-text-viewer-extension":n,children:m}),t[20]=n,t[21]=r,t[22]=h):h=t[22],h}function ix(e){let t=(0,$.c)(50),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({fileName:r,extension:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let{_:a}=kt(),[o,s]=(0,Q.useState)(`diagram`),c=Qb(i),l;t[4]===n?l=t[5]:(l={"data-mermaid-file-viewer-extension":n},t[4]=n,t[5]=l);let u=l;if(c.status===`loading`){let e;return t[6]!==u||t[7]!==r?(e=(0,Z.jsx)($b,{fileName:r,dataAttr:`data-mermaid-file-viewer`,extraAttrs:u}),t[6]=u,t[7]=r,t[8]=e):e=t[8],e}if(c.status===`error`){let e;return t[9]!==u||t[10]!==c.message||t[11]!==r||t[12]!==i.src?(e=(0,Z.jsx)(ex,{fileName:r,dataAttr:`data-mermaid-file-viewer`,extraAttrs:u,message:c.message,openHref:i.src}),t[9]=u,t[10]=c.message,t[11]=r,t[12]=i.src,t[13]=e):e=t[13],e}let d=c.content,f;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(f=e=>{e&&s(e)},t[14]=f):f=t[14];let p;t[15]===a?p=t[16]:(p=a({id:`72xhRD`}),t[15]=a,t[16]=p);let m;t[17]===a?m=t[18]:(m=a({id:`DEWDbv`}),t[17]=a,t[18]=m);let h;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(Ts,{children:(0,Z.jsx)(Se,{className:`size-4`})}),t[19]=h):h=t[19];let g;t[20]===m?g=t[21]:(g=(0,Z.jsx)(Ic,{value:`diagram`,"aria-label":m,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,asChild:!0,children:h}),t[20]=m,t[21]=g);let _;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(Es,{side:`bottom`,children:(0,Z.jsx)(J,{id:`i-ShMB`})}),t[22]=_):_=t[22];let v;t[23]===g?v=t[24]:(v=(0,Z.jsxs)(Os,{children:[g,_]}),t[23]=g,t[24]=v);let y;t[25]===a?y=t[26]:(y=a({id:`Y6SK9K`}),t[25]=a,t[26]=y);let b;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(Ts,{children:(0,Z.jsx)(R,{className:`size-4`})}),t[27]=b):b=t[27];let x;t[28]===y?x=t[29]:(x=(0,Z.jsx)(Ic,{value:`source`,"aria-label":y,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,asChild:!0,children:b}),t[28]=y,t[29]=x);let S;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(Es,{side:`bottom`,children:(0,Z.jsx)(J,{id:`wdxz7K`})}),t[30]=S):S=t[30];let C;t[31]===x?C=t[32]:(C=(0,Z.jsxs)(Os,{children:[x,S]}),t[31]=x,t[32]=C);let w;t[33]!==o||t[34]!==C||t[35]!==p||t[36]!==v?(w=(0,Z.jsx)(`div`,{className:`flex shrink-0 items-center justify-center border-b bg-background py-2`,children:(0,Z.jsxs)(Rc,{type:`single`,value:o,onValueChange:f,"aria-label":p,variant:`segmented`,size:`sm`,spacing:1,className:`shrink-0 bg-muted p-0.5 data-[size=sm]:rounded-[10px]`,children:[v,C]})}),t[33]=o,t[34]=C,t[35]=p,t[36]=v,t[37]=w):w=t[37];let T;t[38]!==n||t[39]!==r||t[40]!==o||t[41]!==i||t[42]!==d?(T=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:o===`diagram`?(0,Z.jsx)(`div`,{className:`flex h-full min-h-0 flex-col p-3 [&_.mermaid-error-source]:hidden`,children:(0,Z.jsx)(di,{chart:d,className:`min-h-0 flex-1`})}):(0,Z.jsx)(rx,{...i,fileName:r,extension:n})}),t[38]=n,t[39]=r,t[40]=o,t[41]=i,t[42]=d,t[43]=T):T=t[43];let E;return t[44]!==u||t[45]!==r||t[46]!==o||t[47]!==w||t[48]!==T?(E=(0,Z.jsxs)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":r,"data-mermaid-file-viewer":``,"data-mermaid-file-viewer-state":`loaded`,"data-mermaid-file-viewer-mode":o,...u,children:[w,T]}),t[44]=u,t[45]=r,t[46]=o,t[47]=w,t[48]=T,t[49]=E):E=t[49],E}function ax(e){return Bn(`/api/asset?path=${encodeURIComponent(e)}`)}function ox(e){return`/api/asset-text?path=${encodeURIComponent(e)}`}function sx(e){let t=(0,$.c)(33),{assetPath:n,mediaKind:r}=e,[i,a]=(0,Q.useState)(!1),o;t[0]===n?o=t[1]:(o=ax(n),t[0]=n,t[1]=o);let s=o,c;t[2]===n?c=t[3]:(c=n.split(`/`).pop()??n,t[2]=n,t[3]=c);let l=c,u,d,f,p;if(t[4]!==n||t[5]!==l||t[6]!==i||t[7]!==r||t[8]!==s){p=Symbol.for(`react.early_return_sentinel`);bb0:{if(f=l.includes(`.`)?l.split(`.`).pop()??``:``,d=f.length>0?f.toUpperCase():`FILE`,u=i?`text`:r,u===`pdf`){let e;t[13]!==l||t[14]!==s?(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,Z.jsx)(x,{src:s,title:l,fillContainer:!0})}),t[13]=l,t[14]=s,t[15]=e):e=t[15];let n;t[16]!==l||t[17]!==e?(n=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":l,children:e}),t[16]=l,t[17]=e,t[18]=n):n=t[18],p=n;break bb0}if(u===`text`){let e;t[19]===n?e=t[20]:(e=ox(n),t[19]=n,t[20]=e),p=(0,Z.jsx)(rx,{src:e,fileName:l,extension:f.toLowerCase()},n);break bb0}if(u===`mermaid`){let e;t[21]===n?e=t[22]:(e=ox(n),t[21]=n,t[22]=e),p=(0,Z.jsx)(ix,{src:e,fileName:l,extension:f.toLowerCase()},n);break bb0}}t[4]=n,t[5]=l,t[6]=i,t[7]=r,t[8]=s,t[9]=u,t[10]=d,t[11]=f,t[12]=p}else u=t[9],d=t[10],f=t[11],p=t[12];if(p!==Symbol.for(`react.early_return_sentinel`))return p;let m;t[23]!==n||t[24]!==u||t[25]!==d||t[26]!==l||t[27]!==f||t[28]!==s?(m=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-auto p-4`,children:u===`image`?(0,Z.jsx)(O,{src:s,alt:l,draggable:!1,slotClassName:`flex h-full w-full items-center justify-center`,className:`max-h-full max-w-full`}):u===`video`?(0,Z.jsx)(`video`,{src:s,controls:!0,className:`max-h-full max-w-full`}):u===`audio`?(0,Z.jsx)(`audio`,{src:s,controls:!0,className:`w-full max-w-md`}):(0,Z.jsxs)(`div`,{className:`flex max-w-sm flex-col items-center gap-8 text-center`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[(0,Z.jsx)(`div`,{className:`flex items-center justify-center tracking-wide text-muted-foreground/80 text-2xs font-mono`,children:d}),(0,Z.jsx)(`div`,{className:`max-w-full text-balance break-words tracking-tight font-light text-2xl`,children:l})]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:[(0,Z.jsx)(Jr,{variant:`default`,size:`sm`,onClick:()=>a(!0),"data-testid":`asset-preview-open-as-text`,className:`font-mono uppercase`,children:(0,Z.jsx)(J,{id:`qFWMl-`})}),(0,Z.jsx)(Jr,{variant:`outline`,size:`sm`,className:`font-mono uppercase`,onClick:()=>{Fi({url:s,projectRelPath:n,ext:f.toLowerCase(),title:l,forceOsDelegation:!1})},children:(0,Z.jsx)(J,{id:`9npOH9`})})]})]})}),t[23]=n,t[24]=u,t[25]=d,t[26]=l,t[27]=f,t[28]=s,t[29]=m):m=t[29];let h;return t[30]!==l||t[31]!==m?(h=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":l,children:m}),t[30]=l,t[31]=m,t[32]=h):h=t[32],h}function cx(){let e=(0,$.c)(5),{_:t}=kt(),n;e[0]===t?n=e[1]:(n=t({id:`3VsNTI`}),e[0]=t,e[1]=n);let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[(0,Z.jsx)(Ka,{className:`h-9 w-2/5 mt-6 mb-5`}),(0,Z.jsx)(Ka,{className:`h-4 w-full`}),(0,Z.jsx)(Ka,{className:`h-4 w-3/4`})]}),e[2]=r):r=e[2];let i;return e[3]===n?i=e[4]:(i=(0,Z.jsx)(`div`,{className:`tiptap-editor pt-10`,role:`status`,"aria-busy":`true`,"aria-label":n,children:r}),e[3]=n,e[4]=i),i}function lx(e){let{_:t}=kt();return e===`existing-repo`?[{id:`draft-spec`,icon:Vd,label:t({id:`LdKIHS`}),prompt:t({id:`N_7kkF`})},{id:`organize-specs`,icon:of,label:t({id:`cuA8QW`}),prompt:t({id:`mPy9lS`})},{id:`document-architecture`,icon:uf,label:t({id:`6eniID`}),prompt:t({id:`uDlyqd`})}]:[{id:`competitor-research`,icon:Rf,label:t({id:`GUqTzn`}),prompt:t({id:`KOZud0`})},{id:`eng-specs`,icon:Vd,label:t({id:`Qvls7J`}),prompt:t({id:`6qMe0o`})},{id:`bird-wiki`,icon:Cd,label:t({id:`FqTpiN`}),prompt:t({id:`jtg_8-`})}]}function ux(e){let t=(0,$.c)(13),{scenario:n,className:r}=e,{_:i}=kt(),a=lx(n),[o,s]=(0,Q.useState)(null),c=(0,Q.useRef)(void 0),l,u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>()=>clearTimeout(c.current),u=[],t[0]=l,t[1]=u):(l=t[0],u=t[1]),(0,Q.useEffect)(l,u);let d,f;if(t[2]!==i||t[3]!==r||t[4]!==o||t[5]!==a){let e=function(e,t){Sa(t).then(()=>{s(e),clearTimeout(c.current),c.current=setTimeout(()=>s(null),1600)}).catch(dx)};t[8]===r?d=t[9]:(d=X(`w-full divide-y divide-border/60 overflow-hidden rounded-2xl border border-border/60 bg-card`,r),t[8]=r,t[9]=d),f=a.map(t=>{let n=t.icon,r=o===t.id;return(0,Z.jsxs)(`li`,{className:`group flex items-start gap-3 p-3.5`,"data-testid":`copy-prompt-${t.id}`,children:[(0,Z.jsx)(n,{className:`mt-0.5 size-4 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`text-sm font-medium leading-tight text-foreground`,children:t.label}),(0,Z.jsx)(`span`,{className:`truncate text-1sm leading-relaxed text-muted-foreground`,children:t.prompt})]}),(0,Z.jsxs)(Jr,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>e(t.id,t.prompt),"aria-label":i(r?{id:`6V3Ea3`}:{id:`RG4XHV`,values:{0:t.label}}),className:X(`shrink-0 gap-1.5 transition-opacity focus-visible:opacity-100 uppercase font-mono`,r?`opacity-100`:`opacity-0 group-hover:opacity-100`),"data-testid":`copy-prompt-button-${t.id}`,children:[r?(0,Z.jsx)($i,{className:`size-3.5`,"aria-hidden":`true`}):(0,Z.jsx)(Oo,{className:`size-3.5`,"aria-hidden":`true`}),i(r?{id:`6V3Ea3`}:{id:`he3ygx`})]})]},t.id)}),t[2]=i,t[3]=r,t[4]=o,t[5]=a,t[6]=d,t[7]=f}else d=t[6],f=t[7];let p;return t[10]!==d||t[11]!==f?(p=(0,Z.jsx)(`ul`,{className:d,children:f}),t[10]=d,t[11]=f,t[12]=p):p=t[12],p}function dx(){}var fx=`ok-ask-ai-draft-v2`,px={doc:null,dismissed:!1};function mx(){if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}var hx=null,gx=new Set;function _x(e){if(e===null)return!0;let t=e.content;return!Array.isArray(t)||t.length===0?!0:t.every(e=>{let t=e.content;return!Array.isArray(t)||t.length===0})}function vx(){let e=mx();if(!e)return px;try{let t=e.getItem(fx);if(!t)return px;let n=JSON.parse(t);return typeof n!=`object`||!n||Array.isArray(n)?px:{doc:n,dismissed:!1}}catch(e){return console.warn(`failed to parse stored draft — clearing`,e),px}}function yx(){return hx===null&&(hx=vx()),hx}function bx(e){let t=mx();if(t)try{e&&!_x(e)?t.setItem(fx,JSON.stringify(e)):t.removeItem(fx)}catch{}}function xx(){for(let e of gx)e()}function Sx(){return yx()}function Cx(e){let t=e&&!_x(e)?e:null;hx={...yx(),doc:t},bx(t),xx()}function wx(){Cx(null)}var Tx=`button, a[href], [role="menuitem"], [role="button"], input, textarea, select, [contenteditable="true"]`;function Ex(e,t){!(e.target instanceof HTMLElement)||e.target.closest(Tx)||(e.preventDefault(),t.current?.focus())}var Dx=qr(`group/button-group flex w-fit items-stretch *:focus-visible:relative *:focus-visible:z-10 has-[>[data-slot=button-group]]:gap-2 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-lg [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1`,{variants:{orientation:{horizontal:`[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-r-lg!`,vertical:`flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-b-lg!`}},defaultVariants:{orientation:`horizontal`}});function Ox(e){let t=(0,$.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,orientation:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]!==n||t[5]!==r?(a=X(Dx({orientation:r}),n),t[4]=n,t[5]=r,t[6]=a):a=t[6];let o;return t[7]!==r||t[8]!==i||t[9]!==a?(o=(0,Z.jsx)(`div`,{role:`group`,"data-slot":`button-group`,"data-orientation":r,className:a,...i}),t[7]=r,t[8]=i,t[9]=a,t[10]=o):o=t[10],o}var kx=jn;function Ax(e){let t=Si(e).kind;return t===`folder`||t===`asset`?t:`page`}function jx(e){let t=(0,$.c)(14),{items:n,query:r,selectedIndex:i,onSelect:a,loading:o,error:s,hasMore:c}=e,l=o===void 0?!1:o,u=s===void 0?!1:s,d=c===void 0?!1:c,{_:f}=kt(),p=(0,Q.useId)(),m=(0,Q.useRef)(null),h,g;t[0]===i?(h=t[1],g=t[2]):(h=()=>{(m.current?.querySelectorAll(`[role="option"]`))?.item(i)?.scrollIntoView({block:`nearest`})},g=[i],t[0]=i,t[1]=h,t[2]=g),(0,Q.useEffect)(h,g);let _=i>=0&&i<n.length?n[i]:null,v;return t[3]!==f||t[4]!==u||t[5]!==d||t[6]!==n||t[7]!==p||t[8]!==l||t[9]!==a||t[10]!==r||t[11]!==i||t[12]!==_?(v=(0,Z.jsx)(`div`,{ref:m,className:`w-80 max-w-[min(28rem,90vw)] overflow-hidden rounded-lg border bg-popover p-1 text-popover-foreground shadow-md`,children:l?(0,Z.jsx)(`p`,{className:`px-2 py-1.5 text-sm text-muted-foreground`,"aria-live":`polite`,children:f({id:`3m2GBo`})}):u?(0,Z.jsx)(`p`,{className:`px-2 py-1.5 text-sm text-muted-foreground`,"aria-live":`assertive`,children:f({id:`weP6me`})}):n.length===0?(0,Z.jsx)(`p`,{className:`px-2 py-1.5 text-sm text-muted-foreground`,"aria-live":`polite`,children:r.trim()===``?f({id:`0E9DR6`}):f({id:`yQyglE`})}):(0,Z.jsxs)(`div`,{role:`listbox`,id:p,"aria-label":f({id:`05n5wS`}),tabIndex:-1,className:`max-h-64 overflow-y-auto subtle-scrollbar`,children:[(0,Z.jsx)(`span`,{className:`sr-only`,"aria-live":`polite`,"aria-atomic":`true`,children:_?_.title:``}),n.map((e,t)=>{let n=t===i,r=Ax(e.path),o=r===`folder`,s=o?`${e.path}/`:e.path;return(0,Z.jsxs)(`button`,{id:`${p}-option-${t}`,type:`button`,role:`option`,"aria-selected":n,"data-active":n,"data-mention-kind":r,"data-testid":`composer-mention-option-${e.docName}`,className:`flex w-full items-start gap-2 rounded-md px-2 py-1.5 text-left ${n?`bg-accent text-accent-foreground`:``}`,onMouseDown:t=>{t.preventDefault(),a(e)},children:[(0,Z.jsx)(ft,{path:e.path,className:`mt-0.5 size-4 shrink-0 text-muted-foreground`}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,Z.jsxs)(`span`,{className:`flex items-baseline gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`truncate text-sm font-medium`,children:e.title}),o?(0,Z.jsx)(`span`,{className:`shrink-0 text-[10px] font-medium uppercase tracking-wide text-muted-foreground`,children:f({id:`kNqMMd`})}):null]}),(0,Z.jsx)(`span`,{className:`line-clamp-2 break-all text-xs text-muted-foreground`,children:s})]})]},e.docName)}),d?(0,Z.jsx)(`div`,{className:`px-2 py-1 text-xs text-muted-foreground`,"aria-hidden":!0,children:f({id:`F1T9y_`})}):null]})}),t[3]=f,t[4]=u,t[5]=d,t[6]=n,t[7]=p,t[8]=l,t[9]=a,t[10]=r,t[11]=i,t[12]=_,t[13]=v):v=t[13],v}var Mx=8,Nx=new Zn(`composerMentionSuggestion`);function Px(e){return e.kind===`asset`?e.docName.replace(/^\//,``):e.kind===`folder`?e.docName:Io(e.docName)}var Fx=On.create({name:`doc`,topNode:!0,content:`paragraph+`}),Ix=On.create({name:`paragraph`,group:`block`,content:`inline*`,parseHTML(){return[{tag:`p`}]},renderHTML(){return[`p`,0]}}),Lx=On.create({name:`text`,group:`inline`}),Rx=On.create({name:`hardBreak`,group:`inline`,inline:!0,selectable:!1,parseHTML(){return[{tag:`br`}]},renderHTML(){return[`br`]},addKeyboardShortcuts(){return{"Shift-Enter":()=>this.editor.commands.insertContent({type:`hardBreak`})}}}),zx=Wn.create({name:`composerHistory`,addProseMirrorPlugins(){return[Pn(),br({"Mod-z":Cn,"Mod-y":vn,"Shift-Mod-z":vn})]}}),Bx=On.create({name:`composerMention`,group:`inline`,inline:!0,atom:!0,selectable:!0,addAttributes(){return{path:{default:``},label:{default:``}}},parseHTML(){return[{tag:`span[data-composer-mention]`}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.label||e.attrs.path);return[`span`,fr(t,{"data-composer-mention":String(e.attrs.path??``),class:`composer-mention-chip`}),`@${n}`]},renderText({node:e}){return`@${e.attrs.path}`},addNodeView(){return({node:e,editor:t,getPos:n})=>{let r=String(e.attrs.path??``),i=String(e.attrs.label||e.attrs.path),a=document.createElement(`span`);a.className=`composer-mention-chip group/mention`,a.setAttribute(`data-composer-mention`,r),a.title=i;let o=document.createElement(`button`);o.type=`button`,o.className=`composer-mention-icon`,o.setAttribute(`aria-label`,Gc._({id:`Xzy0s0`,values:{fullLabel:i}}));let s=document.createElement(`span`);s.className=`composer-mention-glyph composer-mention-glyph-icon`,s.setAttribute(`aria-hidden`,`true`),s.innerHTML=ze(r),o.appendChild(s);let c=document.createElement(`span`);c.className=`composer-mention-glyph composer-mention-glyph-x`,c.setAttribute(`aria-hidden`,`true`),c.innerHTML=_e(gs),o.appendChild(c),o.addEventListener(`mousedown`,e=>e.preventDefault()),o.addEventListener(`click`,r=>{r.preventDefault();let i=typeof n==`function`?n():null;i!=null&&t.chain().focus().deleteRange({from:i,to:i+e.nodeSize}).run()}),a.appendChild(o);let l=document.createElement(`span`);return l.className=`composer-mention-label`,l.textContent=i,a.appendChild(l),{dom:a}}},addProseMirrorPlugins(){return[Ux(this.editor)]}});function Vx(e){return[Fx,Ix,Lx,Rx,zx,Bx,...e?.placeholder?[kx.configure({placeholder:e.placeholder})]:[]]}function Hx(e=Ti){let t=[],n=!1,r=null,i=!1;return{snapshot(){return{loaded:n,error:i}},async getItems(a){if(!n){r||=e();try{t=await r,n=!0,i=!1}catch(e){console.error(`[composer-mention] failed to fetch pages`,e),t=[],i=!0}finally{r=null}}return Mi(t,a).map(e=>({docName:e.docName,title:e.title,path:Px(e)})).filter(e=>e.path!==``)},reset(){t=[],n=!1,r=null,i=!1}}}function Ux(e){let t=Hx();return ii({editor:e,pluginKey:Nx,char:`@`,items:({query:e})=>t.getItems(e),command:({editor:e,range:t,props:n})=>{try{e.chain().focus().deleteRange(t).insertContent([{type:`composerMention`,attrs:{path:n.path,label:n.title}},{type:`text`,text:` `}]).run()}catch(e){console.error(`[composer-mention] insert failed`,{item:n,range:t},e)}},render:()=>{let e=null,n=null,r=0,i={popup:null,stopAutoUpdate:null},a=null,o=null,s=e=>{n?.command(e)},c=e=>{let n=e.items??[],{loaded:i,error:a}=t.snapshot();return{items:n,query:e.query??``,selectedIndex:r,onSelect:s,loading:!i&&!a,error:a,hasMore:n.length>=Mx}},l=()=>{!e||!n||e.updateProps(c(n))};return{onBeforeStart(t){n=t,r=0;let s=gi(()=>n,`composer-mention`);i.popup=s.popup,a=s.doPosition,o=s.reveal,e=new yi(jx,{props:c(t),editor:t.editor}),s.popup.appendChild(e.element),i.stopAutoUpdate=s.startAutoUpdate()},onStart(e){n=e,r=0,l(),o?.()},onUpdate(e){n=e,r=Math.min(r,Math.max(0,e.items.length-1)),l(),a?.()},onKeyDown({event:e}){if(!n)return!1;let t=n.items;if(e.key===`ArrowDown`)return t.length===0?!1:(r=(r+1)%t.length,l(),!0);if(e.key===`ArrowUp`)return t.length===0?!1:(r=(r-1+t.length)%t.length,l(),!0);if(e.key===`Enter`||e.key===`Tab`){let e=t[r];return e?(n.command(e),!0):!1}return!1},onExit(){hi(i),a=null,o=null,e?.destroy(),e=null,n=null,r=0,t.reset()}}}})}function Wx(e){let t=[],n=new Set,r=[];return e.state.doc.forEach(e=>{let i=``;e.forEach(e=>{if(e.type.name===`composerMention`){let r=String(e.attrs.path??``);r!==``&&(i+=`@${r}`,n.has(r)||(n.add(r),t.push(r)))}else e.isText?i+=e.text??``:e.type.name===`hardBreak`&&(i+=`
22
+ `);return t?n.pop():n.push(n.pop().slice(0,-1)),n}function bv(e,t){return`${e}\u0000${t}`}function xv(e,t,n){let r=fn(e).body,i=fn(t).body;return r===i?``:vv(n,r,i,``,``,{context:3})}function Sv(e,t,n){let r=(0,$.c)(8),{activeProvider:i}=Ye(),a;r[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={status:`idle`,diff:null},r[0]=a):a=r[0];let[o,s]=(0,Q.useState)(a),c=(0,Q.useRef)(i),l;r[1]===i?l=r[2]:(l=()=>{c.current=i},r[1]=i,r[2]=l),(0,Q.useEffect)(l);let u,d;return r[3]!==n||r[4]!==t||r[5]!==e?(u=()=>{if(!e){s({status:`idle`,diff:null});return}let r=e,i=!1;return s({status:`loading`,diff:null}),(async function(){try{let e=bv(t,r),a=n.get(e);if(a===void 0){let o=await fetch(`/api/history/${r}?docName=${encodeURIComponent(t)}`);if(i)return;if(!o.ok){s({status:`error`,diff:null});return}let c=await o.json();if(i)return;a=c.content??``,n.set(e,a)}if(i)return;let o=c.current?.document.getText(`source`).toString()??``,l=xv(a,o,t);if(i)return;s({status:`ready`,diff:l})}catch(e){i||(console.error(`[timeline-diff] failed to load entry diff`,{sha:r,docName:t,err:e}),s({status:`error`,diff:null}))}})(),()=>{i=!0}},d=[e,t,n],r[3]=n,r[4]=t,r[5]=e,r[6]=u,r[7]=d):(u=r[6],d=r[7]),(0,Q.useEffect)(u,d),o}var Cv=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityPanelDiffView-B6QdoucA.js`),__vite__mapDeps([5,1,6,7,8]),import.meta.url)).ActivityPanelDiffView})),wv=1e4,Tv=6e4;async function Ev(e,t,n){try{let r=await fetch(`/api/history?docName=${encodeURIComponent(e)}&limit=100`,{signal:t});if(!r.ok)return n.setError(n.unavailableMessage),`error`;let i=await r.json();return n.setEntries((i.entries??[]).filter(e=>e.type!==`checkpoint`)),n.setError(null),`ok`}catch(e){if(e instanceof DOMException&&e.name===`AbortError`)throw e;return n.setError(n.unavailableMessage),console.error(`[timeline]`,e),`error`}finally{t.aborted||n.setLoading(!1)}}function Dv(e){let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/1e3);if(r<60)return Gc._({id:`xOTzt5`});if(r<3600){let e=Math.floor(r/60);return Gc._({id:`UyROxs`,values:{mins:e}})}if(r<86400){let e=Math.floor(r/3600);return Gc._({id:`wXO4Tg`,values:{hrs:e}})}if(r<86400*2)return Gc._({id:`rQRrkB`});let i=Math.floor(r/86400);return i<7?Gc._({id:`6u9LvN`,values:{days:i}}):t.toLocaleDateString()}function Ov(e){return new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function kv(e){return e.slice(0,7)}function Av(e){return e.type===`upstream`?Gc._({id:`K_vT1F`}):e.contributors.length===1?e.contributors[0].name:e.contributors.length>1?e.contributors.map(e=>e.name).join(`, `):e.author===`openknowledge-server`||e.author===`server`?Gc._({id:`B2DrPb`}):e.author}function jv(e){let t=(0,$.c)(17),n,r;if(t[0]===e?(n=t[1],r=t[2]):({icon:n,...r}=e,t[0]=e,t[1]=n,t[2]=r),n===`claude`){let e;return t[3]===r?e=t[4]:(e=(0,Z.jsx)(_u,{...r}),t[3]=r,t[4]=e),e}if(n===`cursor`){let e;return t[5]===r?e=t[6]:(e=(0,Z.jsx)(yu,{...r}),t[5]=r,t[6]=e),e}if(n===`windsurf`){let e;return t[7]===r?e=t[8]:(e=(0,Z.jsx)(ss,{...r}),t[7]=r,t[8]=e),e}if(n===`openai`){let e;return t[9]===r?e=t[10]:(e=(0,Z.jsx)(vu,{...r}),t[9]=r,t[10]=e),e}if(n===`cline`){let e;return t[11]===r?e=t[12]:(e=(0,Z.jsx)(ps,{...r}),t[11]=r,t[12]=e),e}if(n===`github`){let e;return t[13]===r?e=t[14]:(e=(0,Z.jsx)(ds,{...r}),t[13]=r,t[14]=e),e}let i=r,a;return t[15]===i?a=t[16]:(a=(0,Z.jsx)(jo,{strokeWidth:1.5,...i}),t[15]=i,t[16]=a),a}function Mv(e){let t=(0,$.c)(17),{entry:n,isDark:r}=e;if(n.type===`upstream`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(zo,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[0]=e):e=t[0],e}if(n.contributors.length>0){let e=n.contributors[0],i=e.colorSeed??e.name,a;t[1]===i?a=t[2]:(a=mn(i),t[1]=i,t[2]=a);let o=a,s=r?_r[o]??kr[o]:kr[o],c;t[3]!==s||t[4]!==i?(c=s??Yn(i),t[3]=s,t[4]=i,t[5]=c):c=t[5];let l=c;if(o!==`bot`){let e;t[6]===l?e=t[7]:(e={color:l},t[6]=l,t[7]=e);let n;return t[8]!==o||t[9]!==e?(n=(0,Z.jsx)(jv,{icon:o,width:14,height:14,className:`shrink-0`,style:e}),t[8]=o,t[9]=e,t[10]=n):n=t[10],n}if(e.name===`File System`){let e;return t[11]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Xd,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[11]=e):e=t[11],e}if(e.name===`OpenKnowledge (service)`||e.name===`Git (upstream)`){let e;return t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Zr,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[12]=e):e=t[12],e}let u;return t[13]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(Kf,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[13]=u):u=t[13],u}if(n.authorEmail.includes(`agent`)||n.author.includes(`agent`)||n.authorEmail.includes(`cursor`)||n.authorEmail.includes(`claude`)){let e;return t[14]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(jo,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[14]=e):e=t[14],e}if(n.author===`openknowledge-server`||n.author===`server`){let e;return t[15]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Zr,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[15]=e):e=t[15],e}let i;return t[16]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(Kf,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[16]=i):i=t[16],i}function Nv(e){let t=[];for(let n of e.contributors)if(n.summaries)for(let e of n.summaries)t.push(e);return t}function Pv(e){let t=(0,$.c)(21),{summaries:n}=e,[r,i]=(0,Q.useState)(!1),a=(0,Q.useId)();if(n.length===0)return null;let o,s;t[0]===n?(o=t[1],s=t[2]):([o,...s]=n,t[0]=n,t[1]=o,t[2]=s);let c=s.length,l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:`• `}),t[3]=l):l=t[3];let u;t[4]===o?u=t[5]:(u=(0,Z.jsxs)(`li`,{className:`text-xs text-foreground/90`,children:[l,o]}),t[4]=o,t[5]=u);let d;t[6]!==r||t[7]!==s?(d=r&&s.map(Iv),t[6]=r,t[7]=s,t[8]=d):d=t[8];let f;t[9]!==a||t[10]!==u||t[11]!==d?(f=(0,Z.jsxs)(`ul`,{id:a,className:`list-none`,children:[u,d]}),t[9]=a,t[10]=u,t[11]=d,t[12]=f):f=t[12];let p;t[13]!==r||t[14]!==c||t[15]!==a||t[16]!==s.length?(p=s.length>0&&(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":r,"aria-controls":a,className:`inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors cursor-pointer`,onClick:e=>{e.stopPropagation(),i(Fv)},children:[r?(0,Z.jsx)(ea,{className:`size-3`}):(0,Z.jsx)(na,{className:`size-3`}),r?(0,Z.jsx)(J,{id:`vLyv1R`}):(0,Z.jsx)(J,{id:`ZptNUh`,values:{hidden:c}})]}),t[13]=r,t[14]=c,t[15]=a,t[16]=s.length,t[17]=p):p=t[17];let m;return t[18]!==f||t[19]!==p?(m=(0,Z.jsxs)(`div`,{className:`mt-0.5`,children:[f,p]}),t[18]=f,t[19]=p,t[20]=m):m=t[20],m}function Fv(e){return!e}function Iv(e,t){return(0,Z.jsxs)(`li`,{className:`text-xs text-foreground/90`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:`• `}),e]},`${t}-${e}`)}function Lv(e){let t=(0,$.c)(13),{sha:n,docName:r,cache:i,diffLayout:a,panelId:o}=e,s=Sv(n,r,i),c;t[0]===s.status?c=t[1]:(c=s.status===`loading`&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 py-2 text-xs text-muted-foreground`,children:[(0,Z.jsx)(ns,{className:`size-3 animate-spin`}),(0,Z.jsx)(J,{id:`38foVZ`})]}),t[0]=s.status,t[1]=c);let l;t[2]===s.status?l=t[3]:(l=s.status===`error`&&(0,Z.jsx)(`p`,{className:`py-2 text-xs text-destructive`,children:(0,Z.jsx)(J,{id:`vvWZnu`})}),t[2]=s.status,t[3]=l);let u;t[4]!==a||t[5]!==s.diff||t[6]!==s.status?(u=s.status===`ready`&&(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 py-2 text-xs text-muted-foreground`,children:[(0,Z.jsx)(ns,{className:`size-3 animate-spin`}),(0,Z.jsx)(J,{id:`EDm3wJ`})]}),children:(0,Z.jsx)(Cv,{diff:s.diff,viewType:a})}),t[4]=a,t[5]=s.diff,t[6]=s.status,t[7]=u):u=t[7];let d;return t[8]!==o||t[9]!==c||t[10]!==l||t[11]!==u?(d=(0,Z.jsxs)(`div`,{id:o,className:`px-3 pb-2`,"data-testid":`timeline-entry-diff`,children:[c,l,u]}),t[8]=o,t[9]=c,t[10]=l,t[11]=u,t[12]=d):d=t[12],d}function Rv(e){let t=(0,$.c)(127),{entry:n,isDark:r,diffLayout:i,cache:a,docName:o,expanded:s,onToggleExpanded:c,onRestoreSuccess:l}=e,{_:u}=kt(),d;t[0]===n.timestamp?d=t[1]:(d=Dv(n.timestamp),t[0]=n.timestamp,t[1]=d);let f=d,p;t[2]===n?p=t[3]:(p=Av(n),t[2]=n,t[3]=p);let m=p,h;t[4]===n.timestamp?h=t[5]:(h=Ov(n.timestamp),t[4]=n.timestamp,t[5]=h);let g=h,_;t[6]===n.sha?_=t[7]:(_=kv(n.sha),t[6]=n.sha,t[7]=_);let v=_,y=n.contributors.flatMap(zv),b;t[8]===n?b=t[9]:(b=Nv(n),t[8]=n,t[9]=b);let x=b,[S,C]=(0,Q.useState)(!1),[w,T]=(0,Q.useState)(!1),E=(0,Q.useRef)(null),D=(0,Q.useId)(),O,k;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(O=()=>()=>E.current?.abort(),k=[],t[10]=O,t[11]=k):(O=t[10],k=t[11]),(0,Q.useEffect)(O,k);let A;t[12]!==n.sha||t[13]!==c?(A=()=>c(n.sha),t[12]=n.sha,t[13]=c,t[14]=A):A=t[14];let j=A,M;t[15]===C?M=t[16]:(M=function(){E.current?.abort(),E.current=null,T(!1),C(!1)},t[15]=C,t[16]=M);let N=M,P;t[17]!==u||t[18]!==o||t[19]!==n.sha||t[20]!==l||t[21]!==C?(P=async function(){T(!0);let e=new AbortController;E.current=e;let t=function(){e.signal.aborted||T(!1),E.current===e&&(E.current=null)},r;try{r=await fetch(`/api/rollback`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({docName:o,commitSha:n.sha}),signal:e.signal})}catch(r){let i=r;!e.signal.aborted&&!(i instanceof DOMException&&i.name===`AbortError`)&&(console.error(`[timeline] rollback fetch failed`,{docName:o,sha:n.sha,err:i}),hs.error(u({id:`NkXEFS`}),{duration:4e3})),t();return}if(e.signal.aborted){t();return}if(r.ok)C(!1),l();else{let e=`HTTP ${r.status}`;try{let t=sr.safeParse(await r.json());t.success&&(e=t.data.title)}catch{}console.error(`[timeline] rollback failed`,{docName:o,sha:n.sha,status:r.status,detail:e}),hs.error(u({id:`uM6jnS`}),{description:e,duration:6e3})}t()},t[17]=u,t[18]=o,t[19]=n.sha,t[20]=l,t[21]=C,t[22]=P):P=t[22];let F=P,I;t[23]!==n||t[24]!==r?(I=(0,Z.jsx)(Mv,{entry:n,isDark:r}),t[23]=n,t[24]=r,t[25]=I):I=t[25];let L=I,R=s?D:void 0,z=s?`bg-muted`:`hover:bg-muted/80`,B;t[26]===z?B=t[27]:(B=[`group flex w-full items-start gap-2.5 rounded-lg px-3 py-2.5 text-left transition-colors cursor-pointer outline-none focus-visible:ring-2 focus-visible:ring-ring`,z],t[26]=z,t[27]=B);let V=B.join(` `),H;t[28]===j?H=t[29]:(H=e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),j())},t[28]=j,t[29]=H);let U;t[30]===L?U=t[31]:(U=(0,Z.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:L}),t[30]=L,t[31]=U);let W;t[32]===m?W=t[33]:(W=(0,Z.jsx)(`span`,{className:`truncate text-xs text-foreground`,children:m}),t[32]=m,t[33]=W);let G;t[34]!==n.timestamp||t[35]!==f?(G=(0,Z.jsx)(`time`,{className:`ml-auto shrink-0 text-xs text-muted-foreground/80`,dateTime:n.timestamp,title:n.timestamp,children:f}),t[34]=n.timestamp,t[35]=f,t[36]=G):G=t[36];let K;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`h-3 w-px shrink-0 bg-border`}),t[37]=K):K=t[37];let ee;t[38]===u?ee=t[39]:(ee=u({id:`Yea-K5`}),t[38]=u,t[39]=ee);let te;t[40]===C?te=t[41]:(te=e=>{e.stopPropagation(),C(!0)},t[40]=C,t[41]=te);let ne;t[42]===w?ne=t[43]:(ne=w?(0,Z.jsx)(ns,{className:`size-3 animate-spin`}):(0,Z.jsx)(cs,{className:`size-3`}),t[42]=w,t[43]=ne);let re;t[44]!==w||t[45]!==ee||t[46]!==te||t[47]!==ne?(re=(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(Jr,{variant:`ghost`,size:`icon`,className:`size-5 shrink-0 text-muted-foreground hover:text-destructive`,"data-testid":`timeline-entry-restore`,"aria-label":ee,disabled:w,onClick:te,children:ne})}),t[44]=w,t[45]=ee,t[46]=te,t[47]=ne,t[48]=re):re=t[48];let ie;t[49]===u?ie=t[50]:(ie=u({id:`Yea-K5`}),t[49]=u,t[50]=ie);let q;t[51]===ie?q=t[52]:(q=(0,Z.jsx)(Es,{side:`top`,children:ie}),t[51]=ie,t[52]=q);let ae;t[53]!==re||t[54]!==q?(ae=(0,Z.jsxs)(Os,{children:[re,q]}),t[53]=re,t[54]=q,t[55]=ae):ae=t[55];let oe;t[56]!==W||t[57]!==G||t[58]!==ae?(oe=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[W,G,K,ae]}),t[56]=W,t[57]=G,t[58]=ae,t[59]=oe):oe=t[59];let se;t[60]===x?se=t[61]:(se=x.length>0&&(0,Z.jsx)(Pv,{summaries:x}),t[60]=x,t[61]=se);let ce=y.length>0?(0,Z.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,title:y.join(`, `),children:y.join(`, `)}):(0,Z.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,title:n.message,children:n.message}),le;t[62]!==oe||t[63]!==se||t[64]!==ce?(le=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[oe,se,ce]}),t[62]=oe,t[63]=se,t[64]=ce,t[65]=le):le=t[65];let ue;t[66]!==s||t[67]!==j||t[68]!==R||t[69]!==V||t[70]!==H||t[71]!==U||t[72]!==le?(ue=(0,Z.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-expanded":s,"aria-controls":R,"data-testid":`timeline-entry-expand`,className:V,onClick:j,onKeyDown:H,children:[U,le]}),t[66]=s,t[67]=j,t[68]=R,t[69]=V,t[70]=H,t[71]=U,t[72]=le,t[73]=ue):ue=t[73];let de;t[74]!==a||t[75]!==i||t[76]!==D||t[77]!==o||t[78]!==n.sha||t[79]!==s?(de=s&&(0,Z.jsx)(Lv,{sha:n.sha,docName:o,cache:a,diffLayout:i,panelId:D}),t[74]=a,t[75]=i,t[76]=D,t[77]=o,t[78]=n.sha,t[79]=s,t[80]=de):de=t[80];let fe;t[81]!==ue||t[82]!==de?(fe=(0,Z.jsxs)(`div`,{className:`flex flex-col rounded-lg`,children:[ue,de]}),t[81]=ue,t[82]=de,t[83]=fe):fe=t[83];let pe;t[84]!==N||t[85]!==C?(pe=e=>{e?C(!0):N()},t[84]=N,t[85]=C,t[86]=pe):pe=t[86];let me;t[87]===u?me=t[88]:(me=u({id:`Pyp1NA`}),t[87]=u,t[88]=me);let he;t[89]===me?he=t[90]:(he=(0,Z.jsx)(Ps,{children:me}),t[89]=me,t[90]=he);let ge;t[91]!==g||t[92]!==m||t[93]!==v||t[94]!==f?(ge={relative:f,absoluteTime:g,entrySha:v,authorName:m},t[91]=g,t[92]=m,t[93]=v,t[94]=f,t[95]=ge):ge=t[95];let _e;t[96]===Symbol.for(`react.memo_cache_sentinel`)?(_e={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`}),1:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[96]=_e):_e=t[96];let ve;t[97]===ge?ve=t[98]:(ve=(0,Z.jsx)(Ns,{children:(0,Z.jsx)(J,{id:`h6EvY-`,values:ge,components:_e})}),t[97]=ge,t[98]=ve);let ye;t[99]!==he||t[100]!==ve?(ye=(0,Z.jsxs)(Rs,{children:[he,ve]}),t[99]=he,t[100]=ve,t[101]=ye):ye=t[101];let be;t[102]===Symbol.for(`react.memo_cache_sentinel`)?(be=(0,Z.jsx)(J,{id:`dEgA5A`}),t[102]=be):be=t[102];let xe;t[103]===N?xe=t[104]:(xe=(0,Z.jsx)(Jr,{variant:`outline`,"data-testid":`timeline-entry-restore-cancel`,onClick:N,children:be}),t[103]=N,t[104]=xe);let Se;t[105]===F?Se=t[106]:(Se=()=>F(),t[105]=F,t[106]=Se);let Ce;t[107]===w?Ce=t[108]:(Ce=w?(0,Z.jsx)(ns,{className:`mr-2 size-4 animate-spin`}):null,t[107]=w,t[108]=Ce);let we;t[109]===Symbol.for(`react.memo_cache_sentinel`)?(we=(0,Z.jsx)(J,{id:`yKu_3Y`}),t[109]=we):we=t[109];let Te;t[110]!==w||t[111]!==Se||t[112]!==Ce?(Te=(0,Z.jsxs)(Jr,{variant:`destructive`,"data-testid":`timeline-entry-restore-confirm`,disabled:w,onClick:Se,children:[Ce,we]}),t[110]=w,t[111]=Se,t[112]=Ce,t[113]=Te):Te=t[113];let Ee;t[114]!==xe||t[115]!==Te?(Ee=(0,Z.jsxs)(Ls,{children:[xe,Te]}),t[114]=xe,t[115]=Te,t[116]=Ee):Ee=t[116];let De;t[117]!==ye||t[118]!==Ee?(De=(0,Z.jsxs)(Fs,{children:[ye,Ee]}),t[117]=ye,t[118]=Ee,t[119]=De):De=t[119];let Oe;t[120]!==S||t[121]!==pe||t[122]!==De?(Oe=(0,Z.jsx)(zs,{open:S,onOpenChange:pe,children:De}),t[120]=S,t[121]=pe,t[122]=De,t[123]=Oe):Oe=t[123];let ke;return t[124]!==fe||t[125]!==Oe?(ke=(0,Z.jsxs)(Z.Fragment,{children:[fe,Oe]}),t[124]=fe,t[125]=Oe,t[126]=ke):ke=t[126],ke}function zv(e){return e.docs}function Bv(e){let t=(0,$.c)(46),{docName:n,diffLayout:r,onDiffLayoutChange:i}=e,{_:a}=kt(),{resolvedTheme:o}=sn(),s=o===`dark`,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=[],t[0]=c):c=t[0];let[l,u]=(0,Q.useState)(c),[d,f]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(null),[h]=(0,Q.useState)(Wv),[g,_]=(0,Q.useState)(Uv),v;t[1]===h?v=t[2]:(v=()=>{_(new Set),h.clear()},t[1]=h,t[2]=v);let y;t[3]===n?y=t[4]:(y=[n],t[3]=n,t[4]=y),(0,Q.useEffect)(v,y);let b;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(b=function(e){_(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},t[5]=b):b=t[5];let x=b,S;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(S=function(){_(new Set)},t[6]=S):S=t[6];let C=S,w,T;t[7]!==a||t[8]!==n?(w=()=>{if(!n){u([]);return}f(!0);let e=K_({baseMs:wv,maxBackoffMs:Tv,isPaused:Hv,poll:e=>Ev(n,e,{setEntries:u,setError:m,setLoading:f,unavailableMessage:a({id:`brCtGB`})})});e.start();let t=()=>e.resume();return typeof document<`u`&&document.addEventListener(`visibilitychange`,t),()=>{e.stop(),typeof document<`u`&&document.removeEventListener(`visibilitychange`,t)}},T=[n,a],t[7]=a,t[8]=n,t[9]=w,t[10]=T):(w=t[9],T=t[10]),(0,Q.useEffect)(w,T);let E=!d&&!p&&l.length>0,D;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsx)($t,{children:(0,Z.jsx)(J,{id:`cklVjM`})}),t[11]=D):D=t[11];let O;t[12]!==a||t[13]!==r||t[14]!==E||t[15]!==i?(O=E&&(0,Z.jsxs)(Os,{children:[(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsxs)(Rc,{type:`single`,value:r,onValueChange:e=>{e&&i(e)},"aria-label":a({id:`XvPJaT`}),variant:`segmented`,size:`sm`,spacing:1,className:`bg-muted dark:bg-background p-0.5 rounded-md shrink-0`,children:[(0,Z.jsx)(Ic,{value:`unified`,"aria-label":a({id:`379t2h`}),className:`size-6 px-0`,children:(0,Z.jsx)(Tf,{className:`size-3.5`})}),(0,Z.jsx)(Ic,{value:`split`,"aria-label":a({id:`HXFyWD`}),className:`size-6 px-0`,children:(0,Z.jsx)(Pd,{className:`size-3.5`})})]})}),(0,Z.jsx)(Es,{children:r===`unified`?(0,Z.jsx)(J,{id:`379t2h`}):(0,Z.jsx)(J,{id:`HXFyWD`})})]}),t[12]=a,t[13]=r,t[14]=E,t[15]=i,t[16]=O):O=t[16];let k;t[17]===O?k=t[18]:(k=(0,Z.jsxs)(Xt,{children:[D,O]}),t[17]=O,t[18]=k);let A;t[19]!==a||t[20]!==d?(A=d&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-1 p-2`,role:`status`,"aria-busy":`true`,"aria-label":a({id:`o49mDZ`}),children:[1,2,3].map(Vv)}),t[19]=a,t[20]=d,t[21]=A):A=t[21];let j;t[22]!==p||t[23]!==d?(j=!d&&p&&(0,Z.jsx)(`div`,{className:`px-4 py-3`,children:(0,Z.jsx)(`p`,{className:`text-xs text-destructive`,children:p})}),t[22]=p,t[23]=d,t[24]=j):j=t[24];let M;t[25]!==l||t[26]!==p||t[27]!==d?(M=!d&&!p&&l.length===0&&(0,Z.jsx)(`div`,{className:`px-4 py-8 text-center`,children:(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(J,{id:`Ta25TG`})})}),t[25]=l,t[26]=p,t[27]=d,t[28]=M):M=t[28];let N;t[29]!==h||t[30]!==r||t[31]!==n||t[32]!==l||t[33]!==p||t[34]!==g||t[35]!==s||t[36]!==d?(N=!d&&!p&&l.length>0&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-1 p-2`,children:l.map(e=>(0,Z.jsx)(Rv,{entry:e,isDark:s,diffLayout:r,cache:h,docName:n,expanded:g.has(e.sha),onToggleExpanded:x,onRestoreSuccess:C},e.sha))}),t[29]=h,t[30]=r,t[31]=n,t[32]=l,t[33]=p,t[34]=g,t[35]=s,t[36]=d,t[37]=N):N=t[37];let P;t[38]!==A||t[39]!==j||t[40]!==M||t[41]!==N?(P=(0,Z.jsxs)(`div`,{className:`flex-1 overflow-y-auto subtle-scrollbar scroll-fade-mask`,children:[A,j,M,N]}),t[38]=A,t[39]=j,t[40]=M,t[41]=N,t[42]=P):P=t[42];let F;return t[43]!==k||t[44]!==P?(F=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[k,P]}),t[43]=k,t[44]=P,t[45]=F):F=t[45],F}function Vv(e){return(0,Z.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-lg px-3 py-2.5`,children:[(0,Z.jsx)(Ka,{className:`size-3.5 rounded mt-0.5 shrink-0`}),(0,Z.jsxs)(`div`,{className:`flex-1 space-y-1.5`,children:[(0,Z.jsx)(Ka,{className:`h-3 w-28`}),(0,Z.jsx)(Ka,{className:`h-3 w-40`})]})]},e)}function Hv(){return typeof document<`u`&&document.visibilityState===`hidden`}function Uv(){return new Set}function Wv(){return new ls(32)}var Gv=[{id:`outline`,icon:of},{id:`links`,icon:vt},{id:`graph`,icon:uf},{id:`timeline`,icon:Nd}];function Kv(e){return e===`outline`?Gc._({id:`dD7NPy`}):e===`links`?Gc._({id:`Rj01Fz`}):e===`graph`?Gc._({id:`x2fr_j`}):Gc._({id:`cklVjM`})}function qv(){return n(()=>import(`./GraphPanel-Bq38mdVO.js`),__vite__mapDeps([9,1,10,3,11,12,6,7,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42]),import.meta.url)}var Jv=(0,Q.lazy)(async()=>({default:(await qv()).GraphPanel})),Yv=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-CxxS8nFq.js`),__vite__mapDeps([43,1,2,44,45,46,11,47,48,49,50,51,52,53,54,21,10,3,55,40,7,56,12,6,13,57,58,39,16,33,34,35,59,20,15,4,60,17,61,62,19,63,64,65,66,32,36,37,38,67,68,69,70,71,72,73,74,75,76]),import.meta.url)).ActivityModeContent}));function Xv(e){let t=(0,$.c)(18),{docName:n,isSourceMode:r,activeTab:i,onActiveTabChange:a,mode:o}=e,{_:s}=kt(),[c,l]=(0,Q.useState)(`unified`),u=_g(),d,f,p;if(t[0]!==s||t[1]!==i||t[2]!==o||t[3]!==a||t[4]!==u){let e=u?Gv.filter(Qv):Gv;d=e.some(e=>e.id===i)?i:`outline`,f=o===`doc`&&e.length>1,p=f?(0,Z.jsx)(`div`,{className:`flex flex-row items-center justify-center gap-3 p-2`,children:(0,Z.jsx)(Rc,{type:`single`,variant:`outline`,value:d,onValueChange:e=>{e&&a(e)},"aria-label":s({id:`SrOuyg`}),children:e.map(Zv)})}):null,t[0]=s,t[1]=i,t[2]=o,t[3]=a,t[4]=u,t[5]=d,t[6]=f,t[7]=p}else d=t[5],f=t[6],p=t[7];let m;t[8]!==c||t[9]!==n||t[10]!==d||t[11]!==r||t[12]!==o||t[13]!==f?(m=o===`doc`?(0,Z.jsxs)(`div`,{...f?{role:`tabpanel`,id:`panel-${d}`,"aria-labelledby":`tab-${d}`}:{},className:`min-h-0 flex-1`,children:[d===`outline`&&(0,Z.jsx)(uu,{docName:n,isSourceMode:r}),d===`links`&&(0,Z.jsx)(G_,{docName:n}),d===`graph`&&(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`-lCAuQ`})}),children:(0,Z.jsx)(Jv,{activeDocName:n})}),d===`timeline`&&(0,Z.jsx)(Bv,{docName:n,diffLayout:c,onDiffLayoutChange:l})]}):(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(`div`,{role:`status`,"aria-busy":`true`,className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`ONPvOb`})}),children:(0,Z.jsx)(Yv,{})})}),t[8]=c,t[9]=n,t[10]=d,t[11]=r,t[12]=o,t[13]=f,t[14]=m):m=t[14];let h;return t[15]!==p||t[16]!==m?(h=(0,Z.jsxs)(Z.Fragment,{children:[p,m]}),t[15]=p,t[16]=m,t[17]=h):h=t[17],h}function Zv(e){let{id:t,icon:n}=e,r=Kv(t);return(0,Z.jsxs)(Os,{children:[(0,Z.jsx)(Ic,{value:t,role:`tab`,id:`tab-${t}`,"aria-controls":`panel-${t}`,"aria-label":r,asChild:!0,children:(0,Z.jsx)(Ts,{children:(0,Z.jsx)(n,{})})}),(0,Z.jsx)(Es,{side:`bottom`,children:r})]},t)}function Qv(e){return e.id===`outline`}function $v(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function ey(e,t){let n=getComputedStyle(e.ownerDocument.body);return t*parseFloat(n.fontSize)}function ty(e){return e/100*window.innerHeight}function ny(e){return e/100*window.innerWidth}function ry(e){switch(typeof e){case`number`:return[e,`px`];case`string`:{let t=parseFloat(e);return e.endsWith(`%`)?[t,`%`]:e.endsWith(`px`)?[t,`px`]:e.endsWith(`rem`)?[t,`rem`]:e.endsWith(`em`)?[t,`em`]:e.endsWith(`vh`)?[t,`vh`]:e.endsWith(`vw`)?[t,`vw`]:[t,`%`]}}}function iy({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=ry(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=ey(t,i);break;case`em`:r=$v(t,i);break;case`vh`:r=ty(i);break;case`vw`:r=ny(i);break}return r}function ay(e){return parseFloat(e.toFixed(3))}function oy({group:e}){let{orientation:t,panels:n}=e;return n.reduce((e,n)=>(e+=t===`horizontal`?n.element.offsetWidth:n.element.offsetHeight,e),0)}function sy(e){let{panels:t}=e,n=oy({group:e});return n===0?t.map(e=>({groupResizeBehavior:e.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:e.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:e.panelConstraints.disabled,minSize:0,maxSize:100,panelId:e.id})):t.map(e=>{let{element:t,panelConstraints:r}=e,i=0;r.collapsedSize!==void 0&&(i=ay(iy({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=ay(iy({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=ay(iy({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=ay(iy({groupSize:n,panelElement:t,styleProp:r.maxSize})/n*100)),{groupResizeBehavior:r.groupResizeBehavior,collapsedSize:i,collapsible:r.collapsible===!0,defaultSize:a,disabled:r.disabled,minSize:o,maxSize:s,panelId:e.id}})}function cy(e,t=`Assertion error`){if(!e)throw Error(t)}function ly(e,t){return Array.from(t).sort(e===`horizontal`?uy:dy)}function uy(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function dy(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function fy(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function py(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function my({orientation:e,rects:t,targetRect:n}){let r={x:n.x+n.width/2,y:n.y+n.height/2},i,a=Number.MAX_VALUE;for(let n of t){let{x:t,y:o}=py(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return cy(i,`No rect found`),i}var hy;function gy(){return hy===void 0&&(hy=typeof matchMedia==`function`?!!matchMedia(`(pointer:coarse)`).matches:!1),hy}function _y(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=ly(n,Array.from(t.children).filter(fy).map(e=>({element:e}))).map(({element:e})=>e),o=[],s=!1,c=!1,l=-1,u=-1,d=0,f,p=[];{let e=-1;for(let t of a)t.hasAttribute(`data-panel`)&&(e++,t.hasAttribute(`data-disabled`)||(d++,l===-1&&(l=e),u=e))}if(d>1){let t=-1;for(let d of a)if(d.hasAttribute(`data-panel`)){t++;let i=r.find(e=>e.element===d);if(i){if(f){let r=f.element.getBoundingClientRect(),a=d.getBoundingClientRect(),m;if(c){let e=n===`horizontal`?new DOMRect(r.right,r.top,0,r.height):new DOMRect(r.left,r.bottom,r.width,0),t=n===`horizontal`?new DOMRect(a.left,a.top,0,a.height):new DOMRect(a.left,a.top,a.width,0);switch(p.length){case 0:m=[e,t];break;case 1:{let i=p[0];m=[i,my({orientation:n,rects:[r,a],targetRect:i.element.getBoundingClientRect()})===r?t:e];break}default:m=p;break}}else m=p.length?p:[n===`horizontal`?new DOMRect(r.right,a.top,a.left-r.right,a.height):new DOMRect(a.left,r.bottom,a.width,a.top-r.bottom)];for(let n of m){let r=`width`in n?n:n.element.getBoundingClientRect(),a=gy()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(r.width<a){let e=a-r.width;r=new DOMRect(r.x-e/2,r.y,r.width+e,r.height)}if(r.height<a){let e=a-r.height;r=new DOMRect(r.x,r.y-e/2,r.width,r.height+e)}!s&&!(t<=l||t>u)&&o.push({group:e,groupSize:oy({group:e}),panels:[f,i],separator:`width`in n?void 0:n,rect:r}),s=!1}}c=!1,f=i,p=[]}}else if(d.hasAttribute(`data-separator`)){d.ariaDisabled!==null&&(s=!0);let e=i.find(e=>e.element===d);e?p.push(e):(f=void 0,p=[])}else c=!0}return o}var vy=class{#e={};addListener(e,t){let n=this.#e[e];return n===void 0?this.#e[e]=[t]:n.includes(t)||n.push(t),()=>{this.removeListener(e,t)}}emit(e,t){let n=this.#e[e];if(n!==void 0)if(n.length===1)n[0].call(null,t);else{let e=!1,r=null,i=Array.from(n);for(let n=0;n<i.length;n++){let a=i[n];try{a.call(null,t)}catch(t){r===null&&(e=!0,r=t)}}if(e)throw r}}removeAllListeners(){this.#e={}}removeListener(e,t){let n=this.#e[e];if(n!==void 0){let e=n.indexOf(t);e>=0&&n.splice(e,1)}}},yy=new Map,by=new vy;function xy(e){yy=new Map(yy),yy.delete(e)}function Sy(e,t){for(let[t]of yy)if(t.id===e)return t}function Cy(e,t){for(let[t,n]of yy)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function wy(){return yy}function Ty(e,t){return by.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function Ey(e,t){let n=yy.get(e);yy=new Map(yy),yy.set(e,t),by.emit(`groupChange`,{group:e,prev:n,next:t})}function Dy(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=py(n,a.rect);switch(e){case`horizontal`:t.x<=i.x&&(r=a,i=t);break;case`vertical`:t.y<=i.y&&(r=a,i=t);break}}return r?{distance:i,hitRegion:r}:void 0}function Oy(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function ky(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:Fy(e),b:Fy(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();cy(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:Py(Ny(n.a)),b:Py(Ny(n.b))};if(i.a===i.b){let e=r.childNodes,t={a:n.a.at(-1),b:n.b.at(-1)},i=e.length;for(;i--;){let n=e[i];if(n===t.a)return 1;if(n===t.b)return-1}}return Math.sign(i.a-i.b)}var Ay=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function jy(e){let t=getComputedStyle(Iy(e)??e).display;return t===`flex`||t===`inline-flex`}function My(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||jy(e))||+t.opacity<1||`transform`in t&&t.transform!==`none`||`webkitTransform`in t&&t.webkitTransform!==`none`||`mixBlendMode`in t&&t.mixBlendMode!==`normal`||`filter`in t&&t.filter!==`none`||`webkitFilter`in t&&t.webkitFilter!==`none`||`isolation`in t&&t.isolation===`isolate`||Ay.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function Ny(e){let t=e.length;for(;t--;){let n=e[t];if(cy(n,`Missing node`),My(n))return n}return null}function Py(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Fy(e){let t=[];for(;e;)t.push(e),e=Iy(e);return t}function Iy(e){let{parentNode:t}=e;return Oy(t)?t.host:t}function Ly(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function Ry({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!fy(n)||n.contains(e)||e.contains(n))return!0;if(ky(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(Ly(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function zy(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=_y(r),a=Dy(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&Ry({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function By(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function Vy(e,t,n=0){return Math.abs(ay(e)-ay(t))<=n}function Hy(e,t){return Vy(e,t)?0:e>t?1:-1}function Uy({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:r}){let{collapsedSize:i=0,collapsible:a,disabled:o,maxSize:s=100,minSize:c=0}=t;if(o&&!e)return n;if(Hy(r,c)<0)if(a){let e=(i+c)/2;r=Hy(r,e)<0?i:c}else r=c;return r=Math.min(s,r),r=ay(r),r}function Wy({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(Vy(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;cy(u!=null,`Invalid first pivot index`),cy(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];cy(r,`Panel constraints not found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=s[t];if(cy(n!=null,`Previous layout not found for panel index ${t}`),Vy(n,i)){let t=o-n;Hy(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];cy(r,`No panel constraints found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=s[t];if(cy(n!=null,`Previous layout not found for panel index ${t}`),Vy(n,o)){let t=n-i;Hy(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];cy(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&Hy(i,c)<0)if(e>0){let t=c-o,n=t/2;Hy(i+e,c)<0&&(e=Hy(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;Hy(i-e,c)<0&&(e=Hy(100+e,n)>0?0:-t)}break}}{let t=e<0?1:-1,r=e<0?d:u,i=0;for(;;){let e=s[r];cy(e!=null,`Previous layout not found for panel index ${r}`);let a=Uy({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:e,size:100})-e;if(i+=a,r+=t,r<0||r>=n.length)break}let a=Math.min(Math.abs(e),Math.abs(i));e=e<0?0-a:a}{let t=e<0?u:d;for(;t>=0&&t<n.length;){let r=Math.abs(e)-Math.abs(f),i=s[t];cy(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=Uy({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!Vy(i,c)&&(f+=i-c,l[t]=c,f.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?t--:t++}}if(By(c,l))return i;{let t=e<0?d:u,r=s[t];cy(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=Uy({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!Vy(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];cy(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=Uy({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(Vy(i,s)||(t-=s-i,l[r]=s),Vy(t,0))break;e>0?r--:r++}}}if(!Vy(Object.values(l).reduce((e,t)=>t+e,0),100,.1))return i;let p=Object.keys(i);return l.reduce((e,t,n)=>(e[p[n]]=t,e),{})}function Gy(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||Hy(e[n],t[n])!==0)return!1;return!0}function Ky({layout:e,panelConstraints:t}){let n=Object.values(e),r=[...n],i=r.reduce((e,t)=>e+t,0);if(r.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${r.map(e=>`${e}%`).join(`, `)}`);if(!Vy(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];cy(t!=null,`No layout data found for index ${e}`),r[e]=100/i*t}let a=0;for(let e=0;e<t.length;e++){let i=n[e];cy(i!=null,`No layout data found for index ${e}`);let o=r[e];cy(o!=null,`No layout data found for index ${e}`);let s=Uy({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!Vy(a,0))for(let e=0;e<t.length;e++){let n=r[e];cy(n!=null,`No layout data found for index ${e}`);let i=n+a,o=Uy({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,Vy(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function qy({groupId:e,panelId:t}){let n=()=>{let t=wy();for(let[n,{defaultLayoutDeferred:r,derivedPanelConstraints:i,layout:a,groupSize:o,separatorToPanels:s}]of t)if(n.id===e)return{defaultLayoutDeferred:r,derivedPanelConstraints:i,group:n,groupSize:o,layout:a,separatorToPanels:s};throw Error(`Group ${e} not found`)},r=()=>{let e=n().derivedPanelConstraints.find(e=>e.panelId===t);if(e!==void 0)return e;throw Error(`Panel constraints not found for Panel ${t}`)},i=()=>{let e=n().group.panels.find(e=>e.id===t);if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},a=()=>{let e=n().layout[t];if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},o=e=>{let r=a();if(e===r)return;let{defaultLayoutDeferred:i,derivedPanelConstraints:o,group:s,groupSize:c,layout:l,separatorToPanels:u}=n(),d=s.panels.findIndex(e=>e.id===t),f=d===s.panels.length-1,p=Ky({layout:Wy({delta:f?r-e:e-r,initialLayout:l,panelConstraints:o,pivotIndices:f?[d-1,d]:[d,d+1],prevLayout:l,trigger:`imperative-api`}),panelConstraints:o});Gy(l,p)||Ey(s,{defaultLayoutDeferred:i,derivedPanelConstraints:o,groupSize:c,layout:p,separatorToPanels:u})};return{collapse:()=>{let{collapsible:e,collapsedSize:t}=r(),{mutableValues:n}=i(),s=a();e&&s!==t&&(n.expandToSize=s,o(t))},expand:()=>{let{collapsible:e,collapsedSize:t,minSize:n}=r(),{mutableValues:s}=i(),c=a();if(e&&c===t){let e=s.expandToSize??n;e===0&&(e=1),o(e)}},getSize:()=>{let{group:e}=n(),t=a(),{element:r}=i();return{asPercentage:t,inPixels:e.orientation===`horizontal`?r.offsetWidth:r.offsetHeight}},isCollapsed:()=>{let{collapsible:e,collapsedSize:t}=r(),n=a();return e&&Vy(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=oy({group:t});o(ay(iy({groupSize:a,panelElement:r,styleProp:e})/a*100))}}}function Jy(e){e.defaultPrevented||zy(e,wy()).forEach(t=>{if(t.separator&&!t.separator.disableDoubleClick){let n=t.panels.find(e=>e.panelConstraints.defaultSize!==void 0);if(n){let r=n.panelConstraints.defaultSize,i=qy({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function Yy(e){let t=wy();for(let[n]of t)if(n.separators.some(t=>t.element===e))return n;throw Error(`Could not find parent Group for separator element`)}function Xy({groupId:e}){let t=()=>{let t=wy();for(let[n,r]of t)if(n.id===e)return{group:n,...r};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){let{defaultLayoutDeferred:e,layout:n}=t();return e?{}:n},setLayout(e){let{defaultLayoutDeferred:n,derivedPanelConstraints:r,group:i,groupSize:a,layout:o,separatorToPanels:s}=t(),c=Ky({layout:e,panelConstraints:r});return n?o:(Gy(o,c)||Ey(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function Zy(e,t){let n=Yy(e),r=Cy(n.id,!0),i=n.separators.find(t=>t.element===e);cy(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);cy(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=Xy({groupId:n.id}).getLayout(),c=Ky({layout:Wy({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});Gy(s,c)||Ey(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels})}function Qy(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=Yy(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&Zy(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&Zy(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&Zy(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&Zy(t,-5);break;case`End`:e.preventDefault(),Zy(t,100);break;case`Enter`:{e.preventDefault();let n=Yy(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=Cy(n.id,!0),o=n.separators.find(e=>e.element===t);cy(o,`Matching separator not found`);let s=a.get(o);cy(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(cy(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];Zy(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=Yy(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);cy(r!==null,`Index not found`),n[e.shiftKey?r>0?r-1:n.length-1:r+1<n.length?r+1:0].focus({preventScroll:!0});break}case`Home`:e.preventDefault(),Zy(t,-100);break}}var $y={cursorFlags:0,state:`inactive`},eb=new vy;function tb(){return $y}function nb(e){return eb.addListener(`change`,e)}function rb(e){let t=$y,n={...$y};n.cursorFlags=e,$y=n,eb.emit(`change`,{prev:t,next:n})}function ib(e){let t=$y;$y=e,eb.emit(`change`,{prev:t,next:e})}function ab(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=wy(),n=zy(e,t),r=new Map,i=!1;n.forEach(e=>{e.separator&&(i||(i=!0,e.separator.element.focus({preventScroll:!0})));let n=t.get(e.group);n&&r.set(e.group,n.layout)}),ib({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}var ob=e=>e,sb=()=>{},cb=1,lb=2,ub=4,db=8,fb=3,pb=12,mb;function hb(){return mb===void 0&&(mb=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(mb=!0)),mb}function gb({cursorFlags:e,groups:t,state:n}){let r=0,i=0;switch(n){case`active`:case`hover`:t.forEach(e=>{if(!e.mutableState.disableCursor)switch(e.orientation){case`horizontal`:r++;break;case`vertical`:i++;break}})}if(!(r===0&&i===0)){switch(n){case`active`:if(e&&hb()){let t=(e&cb)!==0,n=(e&lb)!==0,r=(e&ub)!==0,i=(e&db)!==0;if(t)return r?`se-resize`:i?`ne-resize`:`e-resize`;if(n)return r?`sw-resize`:i?`nw-resize`:`w-resize`;if(r)return`s-resize`;if(i)return`n-resize`}break}return hb()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var _b=new WeakMap;function vb(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=_b.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&e.adoptedStyleSheets.push(n));let r=tb();switch(r.state){case`active`:case`hover`:{let e=gb({cursorFlags:r.cursorFlags,groups:r.hitRegions.map(e=>e.group),state:r.state}),i=`*, *:hover {cursor: ${e} !important; }`;if(t===i)return;t=i,e?n.cssRules.length===0?n.insertRule(i):n.replaceSync(i):n.cssRules.length===1&&n.deleteRule(0);break}case`inactive`:t=void 0,n.cssRules.length===1&&n.deleteRule(0);break}_b.set(e,{prevStyle:t,styleSheet:n})}function yb({document:e,event:t,hitRegions:n,initialLayoutMap:r,mountedGroups:i,pointerDownAtPoint:a,prevCursorFlags:o}){let s=0;n.forEach(e=>{let{group:n,groupSize:o}=e,{orientation:c,panels:l}=n,{disableCursor:u}=n.mutableState,d=0;d=a?c===`horizontal`?(t.clientX-a.x)/o*100:(t.clientY-a.y)/o*100:c===`horizontal`?t.clientX<0?-100:100:t.clientY<0?-100:100;let f=r.get(n),p=i.get(n);if(!f||!p)return;let{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:_,separatorToPanels:v}=p;if(h&&_&&v){let t=Wy({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(Gy(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?cb:lb;break;case`vertical`:s|=d<0?ub:db;break}}else Ey(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&fb:c|=s&fb,t.movementY===0?c|=o&pb:c|=s&pb,rb(c),vb(e)}function bb(e){let t=wy(),n=tb();switch(n.state){case`active`:yb({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function xb(e){if(e.defaultPrevented)return;let t=tb(),n=wy();switch(t.state){case`active`:if(e.buttons===0){ib({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{let t=Cy(e.group.id,!0);Ey(e.group,t)});return}for(let n of t.hitRegions)if(n.separator){let{element:t}=n.separator;t.hasPointerCapture?.(e.pointerId)||t.setPointerCapture?.(e.pointerId)}yb({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=zy(e,n);r.length===0?t.state!==`inactive`&&ib({cursorFlags:0,state:`inactive`}):ib({cursorFlags:0,hitRegions:r,state:`hover`}),vb(e.currentTarget);break}}}function Sb(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(tb().state){case`hover`:ib({cursorFlags:0,state:`inactive`})}}function Cb(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=tb();switch(t.state){case`active`:ib({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&(vb(e.currentTarget),t.hitRegions.forEach(e=>{let t=Cy(e.group.id,!0);Ey(e.group,t)}),e.preventDefault())}}function wb(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=ay(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=ay((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function Tb(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=oy({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:ay(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function Eb(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function Db({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:r}){if(n<=0||t<=0||n===t)return r;let i=0,a=0,o=!1,s=new Map,c=[];for(let l of e.panels){let e=r[l.id]??0;switch(l.panelConstraints.groupResizeBehavior){case`preserve-pixel-size`:{o=!0;let r=ay(e/100*n/t*100);s.set(l.id,r),i+=r;break}default:c.push(l.id),a+=e;break}}if(!o||c.length===0)return r;let l=100-i,u={...r};if(s.forEach((e,t)=>{u[t]=e}),a>0)for(let e of c)u[e]=ay((r[e]??0)/a*l);else{let e=ay(l/c.length);for(let t of c)u[t]=e}return u}function Ob(e,t){let n=e.map(e=>e.id),r=Object.keys(t);if(n.length!==r.length)return!1;for(let e of n)if(!r.includes(e))return!1;return!0}var kb=new Map;function Ab(e){let t=!0;cy(e.element.ownerDocument.defaultView,`Cannot register an unmounted Group`);let n=e.element.ownerDocument.defaultView.ResizeObserver,r=new Set,i=new Set,a=new n(n=>{for(let r of n){let{borderBoxSize:n,target:i}=r;if(i===e.element){if(t){let t=oy({group:e});if(t===0)return;let n=Cy(e.id);if(!n)return;let r=sy(e),i=n.defaultLayoutDeferred?wb(r):n.layout,a=Ky({layout:Db({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&Gy(n.layout,a)&&Eb(n.derivedPanelConstraints,r)&&n.groupSize===t)return;Ey(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else Tb(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{cy(!r.has(e.id),`Panel ids must be unique; id "${e.id}" was used more than once`),r.add(e.id),e.onResize&&a.observe(e.element)});let o=oy({group:e}),s=sy(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(Ob(e.panels,l)||(l=void 0));let u=Ky({layout:e.mutableState.layouts[c]??l??wb(s),panelConstraints:s}),d=e.element.ownerDocument;kb.set(d,(kb.get(d)??0)+1);let f=new Map;return _y(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),Ey(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{cy(!i.has(e.id),`Separator ids must be unique; id "${e.id}" was used more than once`),i.add(e.id),e.element.addEventListener(`keydown`,Qy)}),kb.get(d)===1&&(d.addEventListener(`dblclick`,Jy,!0),d.addEventListener(`pointerdown`,ab,!0),d.addEventListener(`pointerleave`,bb),d.addEventListener(`pointermove`,xb),d.addEventListener(`pointerout`,Sb),d.addEventListener(`pointerup`,Cb,!0)),function(){t=!1,kb.set(d,Math.max(0,(kb.get(d)??0)-1)),xy(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,Qy)}),kb.get(d)||(d.removeEventListener(`dblclick`,Jy,!0),d.removeEventListener(`pointerdown`,ab,!0),d.removeEventListener(`pointerleave`,bb),d.removeEventListener(`pointermove`,xb),d.removeEventListener(`pointerout`,Sb),d.removeEventListener(`pointerup`,Cb,!0)),a.disconnect()}}function jb(){let[e,t]=(0,Q.useState)({});return[e,(0,Q.useCallback)(()=>t({}),[])]}function Mb(e){let t=(0,Q.useId)();return`${e??t}`}var Nb=typeof window<`u`?Q.useLayoutEffect:Q.useEffect;function Pb(e){let t=(0,Q.useRef)(e);return Nb(()=>{t.current=e},[e]),(0,Q.useCallback)((...e)=>t.current?.(...e),[t])}function Fb(...e){return Pb(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t;break}})})}function Ib(e){let t=(0,Q.useRef)({...e});return Nb(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var Lb=(0,Q.createContext)(null);function Rb(e,t){let n=(0,Q.useRef)({getLayout:()=>({}),setLayout:ob});(0,Q.useImperativeHandle)(t,()=>n.current,[]),Nb(()=>{Object.assign(n.current,Xy({groupId:e}))})}function zb({children:e,className:t,defaultLayout:n,disableCursor:r,disabled:i,elementRef:a,groupRef:o,id:s,onLayoutChange:c,onLayoutChanged:l,orientation:u=`horizontal`,resizeTargetMinimumSize:d={coarse:20,fine:10},style:f,...p}){let m=(0,Q.useRef)({onLayoutChange:{},onLayoutChanged:{}}),h=Pb(e=>{Gy(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=Pb(e=>{Gy(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e))}),_=Mb(s),v=(0,Q.useRef)(null),[y,b]=jb(),x=(0,Q.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),S=Fb(v,a);Rb(_,o);let C=Pb((e,t)=>{let r=tb(),i=Sy(e),a=Cy(e);if(a){let e=!1;switch(r.state){case`active`:e=r.hitRegions.some(e=>e.group===i);break}return{flexGrow:a.layout[t]??1,pointerEvents:e?`none`:void 0}}if(n?.[t])return{flexGrow:n?.[t]}}),w=Ib({defaultLayout:n,disableCursor:r}),T=(0,Q.useMemo)(()=>({get disableCursor(){return!!w.disableCursor},getPanelStyles:C,id:_,orientation:u,registerPanel:e=>{let t=x.current;return t.panels=ly(u,[...t.panels,e]),b(),()=>{t.panels=t.panels.filter(t=>t!==e),b()}},registerSeparator:e=>{let t=x.current;return t.separators=ly(u,[...t.separators,e]),b(),()=>{t.separators=t.separators.filter(t=>t!==e),b()}},updatePanelProps:(e,{disabled:t})=>{let n=x.current.panels.find(t=>t.id===e);n&&(n.panelConstraints.disabled=t);let r=Sy(_),i=Cy(_);r&&i&&Ey(r,{...i,derivedPanelConstraints:sy(r)})},updateSeparatorProps:(e,{disabled:t,disableDoubleClick:n})=>{let r=x.current.separators.find(t=>t.id===e);r&&(r.disabled=t,r.disableDoubleClick=n)}}),[C,_,b,u,w]),E=(0,Q.useRef)(null);return Nb(()=>{let e=v.current;if(e===null)return;let t=x.current,n;if(w.defaultLayout!==void 0&&Object.keys(w.defaultLayout).length===t.panels.length){n={};for(let e of t.panels){let t=w.defaultLayout[e.id];t!==void 0&&(n[e.id]=t)}}let r={disabled:!!i,element:e,id:_,mutableState:{defaultLayout:n,disableCursor:!!w.disableCursor,expandedPanelSizes:x.current.lastExpandedPanelSizes,layouts:x.current.layouts},orientation:u,panels:t.panels,resizeTargetMinimumSize:t.resizeTargetMinimumSize,separators:t.separators};E.current=r;let a=Ab(r),{defaultLayoutDeferred:o,derivedPanelConstraints:s,layout:c}=Cy(r.id,!0);!o&&s.length>0&&(h(c),g(c));let l=Ty(_,e=>{let{defaultLayoutDeferred:t,derivedPanelConstraints:n,layout:i}=e.next;if(t||n.length===0)return;let a=r.panels.map(({id:e})=>e).join(`,`);r.mutableState.layouts[a]=i,n.forEach(t=>{if(t.collapsible){let{layout:n}=e.prev??{};if(n){let e=Vy(t.collapsedSize,i[t.panelId]),a=Vy(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=tb().state!==`active`;h(i),o&&g(i)});return()=>{E.current=null,a(),l()}},[i,_,g,h,u,y,w]),(0,Q.useEffect)(()=>{let e=E.current;e&&(e.mutableState.defaultLayout=n,e.mutableState.disableCursor=!!r)}),(0,Z.jsx)(Lb.Provider,{value:T,children:(0,Z.jsx)(`div`,{...p,className:t,"data-group":!0,"data-testid":_,id:_,ref:S,style:{height:`100%`,width:`100%`,overflow:`hidden`,...f,display:`flex`,flexDirection:u===`horizontal`?`row`:`column`,flexWrap:`nowrap`,touchAction:u===`horizontal`?`pan-y`:`pan-x`},children:e})})}zb.displayName=`Group`;function Bb(){return(0,Q.useRef)(null)}function Vb(){let e=(0,Q.useContext)(Lb);return cy(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function Hb(e,t){let{id:n}=Vb(),r=(0,Q.useRef)({collapse:sb,expand:sb,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:sb});(0,Q.useImperativeHandle)(t,()=>r.current,[]),Nb(()=>{Object.assign(r.current,qy({groupId:n,panelId:e}))})}function Ub({children:e,className:t,collapsedSize:n=`0%`,collapsible:r=!1,defaultSize:i,disabled:a,elementRef:o,groupResizeBehavior:s=`preserve-relative-size`,id:c,maxSize:l=`100%`,minSize:u=`0%`,onResize:d,panelRef:f,style:p,...m}){let h=!!c,g=Mb(c),_=Ib({disabled:a}),v=(0,Q.useRef)(null),y=Fb(v,o),{getPanelStyles:b,id:x,orientation:S,registerPanel:C,updatePanelProps:w}=Vb(),T=d!==null,E=Pb((e,t,n)=>{d?.(e,c,n)});Nb(()=>{let e=v.current;if(e!==null)return C({element:e,id:g,idIsStable:h,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:T?E:void 0,panelConstraints:{groupResizeBehavior:s,collapsedSize:n,collapsible:r,defaultSize:i,disabled:_.disabled,maxSize:l,minSize:u}})},[s,n,r,i,T,g,h,l,u,E,C,_]),(0,Q.useEffect)(()=>{w(g,{disabled:a})},[a,g,w]),Hb(g,f);let D=()=>{let e=b(x,g);if(e)return JSON.stringify(e)},O=(0,Q.useSyncExternalStore)(e=>Ty(x,e),D,D),k;return k=O?JSON.parse(O):i?{flexGrow:void 0,flexShrink:void 0,flexBasis:i}:{flexGrow:1},(0,Z.jsx)(`div`,{...m,"data-disabled":a||void 0,"data-panel":!0,"data-testid":g,id:g,ref:y,style:{...Wb,display:`flex`,flexBasis:0,flexShrink:1,overflow:`visible`,...k},children:(0,Z.jsx)(`div`,{className:t,style:{maxHeight:`100%`,maxWidth:`100%`,flexGrow:1,overflow:`auto`,...p,touchAction:S===`horizontal`?`pan-y`:`pan-x`},children:e})})}Ub.displayName=`Panel`;var Wb={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function Gb(){return(0,Q.useRef)(null)}function Kb({layout:e,panelConstraints:t,panelId:n,panelIndex:r}){let i,a,o=e[n],s=t.find(e=>e.panelId===n);if(s){let c=s.maxSize,l=s.collapsible?s.collapsedSize:s.minSize,u=[r,r+1];a=Ky({layout:Wy({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=Ky({layout:Wy({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function qb({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...s}){let c=Mb(a),l=Ib({disabled:n,disableDoubleClick:r}),[u,d]=(0,Q.useState)({}),[f,p]=(0,Q.useState)(`inactive`),m=(0,Q.useRef)(null),h=Fb(m,i),{disableCursor:g,id:_,orientation:v,registerSeparator:y,updateSeparatorProps:b}=Vb(),x=v===`horizontal`?`vertical`:`horizontal`;Nb(()=>{let e=m.current;if(e!==null){let t={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:e,id:c},n=y(t),r=nb(e=>{p(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=Ty(_,e=>{let{derivedPanelConstraints:n,layout:r,separatorToPanels:i}=e.next,a=i.get(t);if(a){let e=a[0],t=a.indexOf(e);d(Kb({layout:r,panelConstraints:n,panelId:e.id,panelIndex:t}))}});return()=>{r(),i(),n()}}},[_,c,y,l]),(0,Q.useEffect)(()=>{b(c,{disabled:n,disableDoubleClick:r})},[n,r,c,b]);let S;return n&&!g&&(S=`not-allowed`),(0,Z.jsx)(`div`,{...s,"aria-controls":u.valueControls,"aria-disabled":n||void 0,"aria-orientation":x,"aria-valuemax":u.valueMax,"aria-valuemin":u.valueMin,"aria-valuenow":u.valueNow,children:e,className:t,"data-separator":n?`disabled`:f,"data-testid":c,id:c,ref:h,role:`separator`,style:{flexBasis:`auto`,cursor:S,...o,flexGrow:0,flexShrink:0,touchAction:`none`},tabIndex:n?void 0:0})}qb.displayName=`Separator`;var Jb=new Map;function Yb(e){let t=Jb.get(e);if(t)return t;let n=Xb(e);return Jb.set(e,n),n}async function Xb(e){switch(e){case`bash`:case`shell`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-Dot7Y1W_.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([46,1,11]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{shell:e}=await import(`./shell-BbGOQhIp.js`);return{shell:e}},[],import.meta.url)).shell);case`c`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-Dot7Y1W_.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([46,1,11]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{c:e}=await import(`./clike-BpCX2P2I.js`);return{c:e}},[],import.meta.url)).c);case`cpp`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-Dot7Y1W_.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([46,1,11]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{cpp:e}=await import(`./clike-BpCX2P2I.js`);return{cpp:e}},[],import.meta.url)).cpp);case`csharp`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-Dot7Y1W_.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([46,1,11]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{csharp:e}=await import(`./clike-BpCX2P2I.js`);return{csharp:e}},[],import.meta.url)).csharp);case`css`:case`less`:case`scss`:return(await n(async()=>{let{css:e}=await import(`./dist-sRKGD4vA.js`).then(e=>e.r);return{css:e}},__vite__mapDeps([45,1,46,11,47]),import.meta.url)).css().language;case`diff`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-Dot7Y1W_.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([46,1,11]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{diff:e}=await import(`./diff-B-RpHLEu.js`);return{diff:e}},[],import.meta.url)).diff);case`go`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-Dot7Y1W_.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([46,1,11]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{go:e}=await import(`./go-3CbI6agw.js`);return{go:e}},[],import.meta.url)).go);case`ini`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-Dot7Y1W_.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([46,1,11]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{properties:e}=await import(`./properties-BbTKbq9k.js`);return{properties:e}},[],import.meta.url)).properties);case`java`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-Dot7Y1W_.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([46,1,11]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{java:e}=await import(`./clike-BpCX2P2I.js`);return{java:e}},[],import.meta.url)).java);case`javascript`:return(await n(async()=>{let{javascript:e}=await import(`./dist-DmkgvB1A.js`).then(e=>e.t);return{javascript:e}},__vite__mapDeps([49,1,50,46,11,47]),import.meta.url)).javascript().language;case`json`:return(await n(async()=>{let{json:e}=await import(`./dist-COmtpu4e.js`).then(e=>e.t);return{json:e}},__vite__mapDeps([51,1,46,11,47]),import.meta.url)).json().language;case`kotlin`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-Dot7Y1W_.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([46,1,11]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{kotlin:e}=await import(`./clike-BpCX2P2I.js`);return{kotlin:e}},[],import.meta.url)).kotlin);case`lua`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-Dot7Y1W_.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([46,1,11]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{lua:e}=await import(`./lua-CImTx43q.js`);return{lua:e}},[],import.meta.url)).lua);case`markdown`:return(await n(async()=>{let{markdown:e}=await import(`./dist-Gaq2suxg.js`).then(e=>e.t);return{markdown:e}},__vite__mapDeps([52,1,50,46,11,48,45,47,49]),import.meta.url)).markdown().language;case`objectivec`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-Dot7Y1W_.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([46,1,11]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{objectiveC:e}=await import(`./clike-BpCX2P2I.js`);return{objectiveC:e}},[],import.meta.url)).objectiveC);case`perl`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-Dot7Y1W_.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([46,1,11]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{perl:e}=await import(`./perl-Blo9V_bV.js`);return{perl:e}},[],import.meta.url)).perl);case`python`:return(await n(async()=>{let{python:e}=await import(`./dist-BxbpSpXO.js`);return{python:e}},__vite__mapDeps([77,50,46,1,11,47]),import.meta.url)).python().language;case`r`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-Dot7Y1W_.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([46,1,11]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{r:e}=await import(`./r-BoaXxHWr.js`);return{r:e}},[],import.meta.url)).r);case`ruby`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-Dot7Y1W_.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([46,1,11]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{ruby:e}=await import(`./ruby-Dl-I4pxG.js`);return{ruby:e}},[],import.meta.url)).ruby);case`rust`:return(await n(async()=>{let{rust:e}=await import(`./dist-B_WDz9Fr.js`);return{rust:e}},__vite__mapDeps([78,46,1,11,47]),import.meta.url)).rust().language;case`sql`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-Dot7Y1W_.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([46,1,11]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{standardSQL:e}=await import(`./sql-Bwur_qe2.js`);return{standardSQL:e}},[],import.meta.url)).standardSQL);case`swift`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-Dot7Y1W_.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([46,1,11]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{swift:e}=await import(`./swift-T0hDoOb-.js`);return{swift:e}},[],import.meta.url)).swift);case`typescript`:return(await n(async()=>{let{javascript:e}=await import(`./dist-DmkgvB1A.js`).then(e=>e.t);return{javascript:e}},__vite__mapDeps([49,1,50,46,11,47]),import.meta.url)).javascript({typescript:!0,jsx:!0}).language;case`xml`:return(await n(async()=>{let{html:e}=await import(`./dist-ClYcK7Yq.js`).then(e=>e.t);return{html:e}},__vite__mapDeps([48,1,45,46,11,47,49,50]),import.meta.url)).html().language;case`yaml`:return(await n(async()=>{let{yaml:e}=await import(`./dist-DYyQPSDl.js`).then(e=>e.t);return{yaml:e}},__vite__mapDeps([53,1,46,11,47]),import.meta.url)).yaml().language;default:return null}}async function Zb(e,t){if(e===`canvas`)return(await n(async()=>{let{json:e}=await import(`./dist-COmtpu4e.js`).then(e=>e.t);return{json:e}},__vite__mapDeps([51,1,46,11,47]),import.meta.url)).json().language;if(t){let e=await Yb(t);if(e)return e}return e===`toml`?(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-Dot7Y1W_.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([46,1,11]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{toml:e}=await import(`./toml-DDz4twot.js`);return{toml:e}},[],import.meta.url)).toml):null}function Qb(e){let t=(0,$.c)(10),{_:n}=kt(),r;t[0]===n?r=t[1]:(r=e=>n(e===413?{id:`C_WGy8`}:e===415?{id:`VM7H66`}:e===404?{id:`s0IDhW`}:e===400?{id:`N1mdmS`}:typeof e==`number`?{id:`96w9hU`,values:{status:e}}:{id:`ig5vUe`}),t[0]=n,t[1]=r);let i=r,{src:a,loadText:o}=e,s=(0,Q.useRef)(o),c=(0,Q.useRef)(i),l;t[2]!==o||t[3]!==i?(l=()=>{s.current=o,c.current=i},t[2]=o,t[3]=i,t[4]=l):l=t[4],(0,Q.useEffect)(l);let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u={status:`loading`},t[5]=u):u=t[5];let[d,f]=(0,Q.useState)(u),p,m;return t[6]!==n||t[7]!==a?(p=()=>{let e=!1,t=new AbortController;f({status:`loading`});let r=s.current;return r?(r(t.signal).then(t=>{if(!e){if(t.ok){f({status:`loaded`,content:t.text});return}f({status:`error`,message:t.message??c.current(t.status)})}}).catch(t=>{e||t instanceof Error&&t.name===`AbortError`||f({status:`error`,message:n({id:`ig5vUe`})})}),()=>{e=!0,t.abort()}):(fetch(a??``,{credentials:`same-origin`,signal:t.signal}).then(async e=>{if(!e.ok)throw Error(c.current(e.status));return e.text()}).then(t=>{e||f({status:`loaded`,content:t})}).catch(t=>{e||t instanceof Error&&t.name===`AbortError`||f({status:`error`,message:t instanceof Error?t.message:n({id:`ig5vUe`})})}),()=>{e=!0,t.abort()})},m=[a,n],t[6]=n,t[7]=a,t[8]=p,t[9]=m):(p=t[8],m=t[9]),(0,Q.useEffect)(p,m),d}function $b(e){let t=(0,$.c)(10),{fileName:n,dataAttr:r,extraAttrs:i}=e,a=`${r}-state`,o;t[0]!==r||t[1]!==a?(o={[r]:``,[a]:`loading`},t[0]=r,t[1]=a,t[2]=o):o=t[2];let s;t[3]===n?s=t[4]:(s=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`Md709y`,values:{fileName:n}})}),t[3]=n,t[4]=s);let c;return t[5]!==i||t[6]!==n||t[7]!==o||t[8]!==s?(c=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col items-center justify-center bg-background text-muted-foreground text-sm`,"aria-label":n,...o,...i,children:s}),t[5]=i,t[6]=n,t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function ex(e){let t=(0,$.c)(16),{fileName:n,dataAttr:r,extraAttrs:i,message:a,openHref:o}=e,s=`${r}-state`,c;t[0]!==r||t[1]!==s?(c={[r]:``,[s]:`error`},t[0]=r,t[1]=s,t[2]=c):c=t[2];let l;t[3]===n?l=t[4]:(l=(0,Z.jsx)(`div`,{className:`font-medium text-sm`,children:(0,Z.jsx)(J,{id:`qdBUHP`,values:{fileName:n}})}),t[3]=n,t[4]=l);let u;t[5]===a?u=t[6]:(u=(0,Z.jsx)(`div`,{className:`text-muted-foreground text-xs`,children:a}),t[5]=a,t[6]=u);let d;t[7]===o?d=t[8]:(d=o?(0,Z.jsx)(`a`,{href:o,className:`mt-2 rounded-md border px-3 py-1.5 text-sm hover:bg-accent hover:text-accent-foreground`,children:(0,Z.jsx)(J,{id:`9npOH9`})}):null,t[7]=o,t[8]=d);let f;return t[9]!==i||t[10]!==n||t[11]!==c||t[12]!==l||t[13]!==u||t[14]!==d?(f=(0,Z.jsxs)(`main`,{className:`flex h-full min-h-0 flex-col items-center justify-center gap-2 bg-background p-4 text-center`,"aria-label":n,...c,...i,children:[l,u,d]}),t[9]=i,t[10]=n,t[11]=c,t[12]=l,t[13]=u,t[14]=d,t[15]=f):f=t[15],f}var tx=si({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),nx=mi({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}});function rx(e){let t=(0,$.c)(23),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({fileName:r,extension:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=(0,Q.useRef)(null),o=(0,Q.useRef)(null),{resolvedTheme:s}=sn(),c=Qb(i),l=c.status===`loaded`?c.content:null,u,d;t[4]!==n||t[5]!==l||t[6]!==s?(u=()=>{if(!a.current||l===null)return;let e=n.toLowerCase(),t=In(e),r=s===`dark`?tx:nx,i=!1,c=null;return Zb(e,t).then(e=>{if(i||!a.current)return;let t=[bu,...e?[e]:[],Zl.editable.of(!0),Vl.readOnly.of(!0),Zl.lineWrapping,r];c=new Zl({state:Vl.create({doc:l,extensions:t}),parent:a.current}),o.current=c}),()=>{i=!0,c?.destroy(),o.current=null}},d=[l,n,s],t[4]=n,t[5]=l,t[6]=s,t[7]=u,t[8]=d):(u=t[7],d=t[8]),(0,Q.useEffect)(u,d);let f;t[9]===n?f=t[10]:(f={"data-text-viewer-extension":n},t[9]=n,t[10]=f);let p=f;if(c.status===`loading`){let e;return t[11]!==p||t[12]!==r?(e=(0,Z.jsx)($b,{fileName:r,dataAttr:`data-text-viewer`,extraAttrs:p}),t[11]=p,t[12]=r,t[13]=e):e=t[13],e}if(c.status===`error`){let e;return t[14]!==p||t[15]!==c.message||t[16]!==r||t[17]!==i.src?(e=(0,Z.jsx)(ex,{fileName:r,dataAttr:`data-text-viewer`,extraAttrs:p,message:c.message,openHref:i.src}),t[14]=p,t[15]=c.message,t[16]=r,t[17]=i.src,t[18]=e):e=t[18],e}let m;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(`div`,{ref:a,className:`min-h-0 flex-1 overflow-auto`}),t[19]=m):m=t[19];let h;return t[20]!==n||t[21]!==r?(h=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":r,"data-text-viewer":``,"data-text-viewer-state":`loaded`,"data-text-viewer-extension":n,children:m}),t[20]=n,t[21]=r,t[22]=h):h=t[22],h}function ix(e){let t=(0,$.c)(50),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({fileName:r,extension:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let{_:a}=kt(),[o,s]=(0,Q.useState)(`diagram`),c=Qb(i),l;t[4]===n?l=t[5]:(l={"data-mermaid-file-viewer-extension":n},t[4]=n,t[5]=l);let u=l;if(c.status===`loading`){let e;return t[6]!==u||t[7]!==r?(e=(0,Z.jsx)($b,{fileName:r,dataAttr:`data-mermaid-file-viewer`,extraAttrs:u}),t[6]=u,t[7]=r,t[8]=e):e=t[8],e}if(c.status===`error`){let e;return t[9]!==u||t[10]!==c.message||t[11]!==r||t[12]!==i.src?(e=(0,Z.jsx)(ex,{fileName:r,dataAttr:`data-mermaid-file-viewer`,extraAttrs:u,message:c.message,openHref:i.src}),t[9]=u,t[10]=c.message,t[11]=r,t[12]=i.src,t[13]=e):e=t[13],e}let d=c.content,f;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(f=e=>{e&&s(e)},t[14]=f):f=t[14];let p;t[15]===a?p=t[16]:(p=a({id:`72xhRD`}),t[15]=a,t[16]=p);let m;t[17]===a?m=t[18]:(m=a({id:`DEWDbv`}),t[17]=a,t[18]=m);let h;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(Ts,{children:(0,Z.jsx)(Se,{className:`size-4`})}),t[19]=h):h=t[19];let g;t[20]===m?g=t[21]:(g=(0,Z.jsx)(Ic,{value:`diagram`,"aria-label":m,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,asChild:!0,children:h}),t[20]=m,t[21]=g);let _;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(Es,{side:`bottom`,children:(0,Z.jsx)(J,{id:`i-ShMB`})}),t[22]=_):_=t[22];let v;t[23]===g?v=t[24]:(v=(0,Z.jsxs)(Os,{children:[g,_]}),t[23]=g,t[24]=v);let y;t[25]===a?y=t[26]:(y=a({id:`Y6SK9K`}),t[25]=a,t[26]=y);let b;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(Ts,{children:(0,Z.jsx)(R,{className:`size-4`})}),t[27]=b):b=t[27];let x;t[28]===y?x=t[29]:(x=(0,Z.jsx)(Ic,{value:`source`,"aria-label":y,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,asChild:!0,children:b}),t[28]=y,t[29]=x);let S;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(Es,{side:`bottom`,children:(0,Z.jsx)(J,{id:`wdxz7K`})}),t[30]=S):S=t[30];let C;t[31]===x?C=t[32]:(C=(0,Z.jsxs)(Os,{children:[x,S]}),t[31]=x,t[32]=C);let w;t[33]!==o||t[34]!==C||t[35]!==p||t[36]!==v?(w=(0,Z.jsx)(`div`,{className:`flex shrink-0 items-center justify-center border-b bg-background py-2`,children:(0,Z.jsxs)(Rc,{type:`single`,value:o,onValueChange:f,"aria-label":p,variant:`segmented`,size:`sm`,spacing:1,className:`shrink-0 bg-muted p-0.5 data-[size=sm]:rounded-[10px]`,children:[v,C]})}),t[33]=o,t[34]=C,t[35]=p,t[36]=v,t[37]=w):w=t[37];let T;t[38]!==n||t[39]!==r||t[40]!==o||t[41]!==i||t[42]!==d?(T=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:o===`diagram`?(0,Z.jsx)(`div`,{className:`flex h-full min-h-0 flex-col p-3 [&_.mermaid-error-source]:hidden`,children:(0,Z.jsx)(di,{chart:d,className:`min-h-0 flex-1`})}):(0,Z.jsx)(rx,{...i,fileName:r,extension:n})}),t[38]=n,t[39]=r,t[40]=o,t[41]=i,t[42]=d,t[43]=T):T=t[43];let E;return t[44]!==u||t[45]!==r||t[46]!==o||t[47]!==w||t[48]!==T?(E=(0,Z.jsxs)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":r,"data-mermaid-file-viewer":``,"data-mermaid-file-viewer-state":`loaded`,"data-mermaid-file-viewer-mode":o,...u,children:[w,T]}),t[44]=u,t[45]=r,t[46]=o,t[47]=w,t[48]=T,t[49]=E):E=t[49],E}function ax(e){return Bn(`/api/asset?path=${encodeURIComponent(e)}`)}function ox(e){return`/api/asset-text?path=${encodeURIComponent(e)}`}function sx(e){let t=(0,$.c)(33),{assetPath:n,mediaKind:r}=e,[i,a]=(0,Q.useState)(!1),o;t[0]===n?o=t[1]:(o=ax(n),t[0]=n,t[1]=o);let s=o,c;t[2]===n?c=t[3]:(c=n.split(`/`).pop()??n,t[2]=n,t[3]=c);let l=c,u,d,f,p;if(t[4]!==n||t[5]!==l||t[6]!==i||t[7]!==r||t[8]!==s){p=Symbol.for(`react.early_return_sentinel`);bb0:{if(f=l.includes(`.`)?l.split(`.`).pop()??``:``,d=f.length>0?f.toUpperCase():`FILE`,u=i?`text`:r,u===`pdf`){let e;t[13]!==l||t[14]!==s?(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,Z.jsx)(x,{src:s,title:l,fillContainer:!0})}),t[13]=l,t[14]=s,t[15]=e):e=t[15];let n;t[16]!==l||t[17]!==e?(n=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":l,children:e}),t[16]=l,t[17]=e,t[18]=n):n=t[18],p=n;break bb0}if(u===`text`){let e;t[19]===n?e=t[20]:(e=ox(n),t[19]=n,t[20]=e),p=(0,Z.jsx)(rx,{src:e,fileName:l,extension:f.toLowerCase()},n);break bb0}if(u===`mermaid`){let e;t[21]===n?e=t[22]:(e=ox(n),t[21]=n,t[22]=e),p=(0,Z.jsx)(ix,{src:e,fileName:l,extension:f.toLowerCase()},n);break bb0}}t[4]=n,t[5]=l,t[6]=i,t[7]=r,t[8]=s,t[9]=u,t[10]=d,t[11]=f,t[12]=p}else u=t[9],d=t[10],f=t[11],p=t[12];if(p!==Symbol.for(`react.early_return_sentinel`))return p;let m;t[23]!==n||t[24]!==u||t[25]!==d||t[26]!==l||t[27]!==f||t[28]!==s?(m=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-auto p-4`,children:u===`image`?(0,Z.jsx)(O,{src:s,alt:l,draggable:!1,slotClassName:`flex h-full w-full items-center justify-center`,className:`max-h-full max-w-full`}):u===`video`?(0,Z.jsx)(`video`,{src:s,controls:!0,className:`max-h-full max-w-full`}):u===`audio`?(0,Z.jsx)(`audio`,{src:s,controls:!0,className:`w-full max-w-md`}):(0,Z.jsxs)(`div`,{className:`flex max-w-sm flex-col items-center gap-8 text-center`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[(0,Z.jsx)(`div`,{className:`flex items-center justify-center tracking-wide text-muted-foreground/80 text-2xs font-mono`,children:d}),(0,Z.jsx)(`div`,{className:`max-w-full text-balance break-words tracking-tight font-light text-2xl`,children:l})]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:[(0,Z.jsx)(Jr,{variant:`default`,size:`sm`,onClick:()=>a(!0),"data-testid":`asset-preview-open-as-text`,className:`font-mono uppercase`,children:(0,Z.jsx)(J,{id:`qFWMl-`})}),(0,Z.jsx)(Jr,{variant:`outline`,size:`sm`,className:`font-mono uppercase`,onClick:()=>{Fi({url:s,projectRelPath:n,ext:f.toLowerCase(),title:l,forceOsDelegation:!1})},children:(0,Z.jsx)(J,{id:`9npOH9`})})]})]})}),t[23]=n,t[24]=u,t[25]=d,t[26]=l,t[27]=f,t[28]=s,t[29]=m):m=t[29];let h;return t[30]!==l||t[31]!==m?(h=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":l,children:m}),t[30]=l,t[31]=m,t[32]=h):h=t[32],h}function cx(){let e=(0,$.c)(5),{_:t}=kt(),n;e[0]===t?n=e[1]:(n=t({id:`3VsNTI`}),e[0]=t,e[1]=n);let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[(0,Z.jsx)(Ka,{className:`h-9 w-2/5 mt-6 mb-5`}),(0,Z.jsx)(Ka,{className:`h-4 w-full`}),(0,Z.jsx)(Ka,{className:`h-4 w-3/4`})]}),e[2]=r):r=e[2];let i;return e[3]===n?i=e[4]:(i=(0,Z.jsx)(`div`,{className:`tiptap-editor pt-10`,role:`status`,"aria-busy":`true`,"aria-label":n,children:r}),e[3]=n,e[4]=i),i}function lx(e){let{_:t}=kt();return e===`existing-repo`?[{id:`draft-spec`,icon:Vd,label:t({id:`LdKIHS`}),prompt:t({id:`N_7kkF`})},{id:`organize-specs`,icon:of,label:t({id:`cuA8QW`}),prompt:t({id:`mPy9lS`})},{id:`document-architecture`,icon:uf,label:t({id:`6eniID`}),prompt:t({id:`uDlyqd`})}]:[{id:`competitor-research`,icon:Rf,label:t({id:`GUqTzn`}),prompt:t({id:`KOZud0`})},{id:`eng-specs`,icon:Vd,label:t({id:`Qvls7J`}),prompt:t({id:`6qMe0o`})},{id:`bird-wiki`,icon:Cd,label:t({id:`FqTpiN`}),prompt:t({id:`jtg_8-`})}]}function ux(e){let t=(0,$.c)(13),{scenario:n,className:r}=e,{_:i}=kt(),a=lx(n),[o,s]=(0,Q.useState)(null),c=(0,Q.useRef)(void 0),l,u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>()=>clearTimeout(c.current),u=[],t[0]=l,t[1]=u):(l=t[0],u=t[1]),(0,Q.useEffect)(l,u);let d,f;if(t[2]!==i||t[3]!==r||t[4]!==o||t[5]!==a){let e=function(e,t){Sa(t).then(()=>{s(e),clearTimeout(c.current),c.current=setTimeout(()=>s(null),1600)}).catch(dx)};t[8]===r?d=t[9]:(d=X(`w-full divide-y divide-border/60 overflow-hidden rounded-2xl border border-border/60 bg-card`,r),t[8]=r,t[9]=d),f=a.map(t=>{let n=t.icon,r=o===t.id;return(0,Z.jsxs)(`li`,{className:`group flex items-start gap-3 p-3.5`,"data-testid":`copy-prompt-${t.id}`,children:[(0,Z.jsx)(n,{className:`mt-0.5 size-4 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`text-sm font-medium leading-tight text-foreground`,children:t.label}),(0,Z.jsx)(`span`,{className:`truncate text-1sm leading-relaxed text-muted-foreground`,children:t.prompt})]}),(0,Z.jsxs)(Jr,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>e(t.id,t.prompt),"aria-label":i(r?{id:`6V3Ea3`}:{id:`RG4XHV`,values:{0:t.label}}),className:X(`shrink-0 gap-1.5 transition-opacity focus-visible:opacity-100 uppercase font-mono`,r?`opacity-100`:`opacity-0 group-hover:opacity-100`),"data-testid":`copy-prompt-button-${t.id}`,children:[r?(0,Z.jsx)($i,{className:`size-3.5`,"aria-hidden":`true`}):(0,Z.jsx)(Oo,{className:`size-3.5`,"aria-hidden":`true`}),i(r?{id:`6V3Ea3`}:{id:`he3ygx`})]})]},t.id)}),t[2]=i,t[3]=r,t[4]=o,t[5]=a,t[6]=d,t[7]=f}else d=t[6],f=t[7];let p;return t[10]!==d||t[11]!==f?(p=(0,Z.jsx)(`ul`,{className:d,children:f}),t[10]=d,t[11]=f,t[12]=p):p=t[12],p}function dx(){}var fx=`ok-ask-ai-draft-v2`,px={doc:null,dismissed:!1};function mx(){if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}var hx=null,gx=new Set;function _x(e){if(e===null)return!0;let t=e.content;return!Array.isArray(t)||t.length===0?!0:t.every(e=>{let t=e.content;return!Array.isArray(t)||t.length===0})}function vx(){let e=mx();if(!e)return px;try{let t=e.getItem(fx);if(!t)return px;let n=JSON.parse(t);return typeof n!=`object`||!n||Array.isArray(n)?px:{doc:n,dismissed:!1}}catch(e){return console.warn(`failed to parse stored draft — clearing`,e),px}}function yx(){return hx===null&&(hx=vx()),hx}function bx(e){let t=mx();if(t)try{e&&!_x(e)?t.setItem(fx,JSON.stringify(e)):t.removeItem(fx)}catch{}}function xx(){for(let e of gx)e()}function Sx(){return yx()}function Cx(e){let t=e&&!_x(e)?e:null;hx={...yx(),doc:t},bx(t),xx()}function wx(){Cx(null)}var Tx=`button, a[href], [role="menuitem"], [role="button"], input, textarea, select, [contenteditable="true"]`;function Ex(e,t){!(e.target instanceof HTMLElement)||e.target.closest(Tx)||(e.preventDefault(),t.current?.focus())}var Dx=qr(`group/button-group flex w-fit items-stretch *:focus-visible:relative *:focus-visible:z-10 has-[>[data-slot=button-group]]:gap-2 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-lg [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1`,{variants:{orientation:{horizontal:`[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-r-lg!`,vertical:`flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-b-lg!`}},defaultVariants:{orientation:`horizontal`}});function Ox(e){let t=(0,$.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,orientation:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]!==n||t[5]!==r?(a=X(Dx({orientation:r}),n),t[4]=n,t[5]=r,t[6]=a):a=t[6];let o;return t[7]!==r||t[8]!==i||t[9]!==a?(o=(0,Z.jsx)(`div`,{role:`group`,"data-slot":`button-group`,"data-orientation":r,className:a,...i}),t[7]=r,t[8]=i,t[9]=a,t[10]=o):o=t[10],o}var kx=jn;function Ax(e){let t=Si(e).kind;return t===`folder`||t===`asset`?t:`page`}function jx(e){let t=(0,$.c)(14),{items:n,query:r,selectedIndex:i,onSelect:a,loading:o,error:s,hasMore:c}=e,l=o===void 0?!1:o,u=s===void 0?!1:s,d=c===void 0?!1:c,{_:f}=kt(),p=(0,Q.useId)(),m=(0,Q.useRef)(null),h,g;t[0]===i?(h=t[1],g=t[2]):(h=()=>{(m.current?.querySelectorAll(`[role="option"]`))?.item(i)?.scrollIntoView({block:`nearest`})},g=[i],t[0]=i,t[1]=h,t[2]=g),(0,Q.useEffect)(h,g);let _=i>=0&&i<n.length?n[i]:null,v;return t[3]!==f||t[4]!==u||t[5]!==d||t[6]!==n||t[7]!==p||t[8]!==l||t[9]!==a||t[10]!==r||t[11]!==i||t[12]!==_?(v=(0,Z.jsx)(`div`,{ref:m,className:`w-80 max-w-[min(28rem,90vw)] overflow-hidden rounded-lg border bg-popover p-1 text-popover-foreground shadow-md`,children:l?(0,Z.jsx)(`p`,{className:`px-2 py-1.5 text-sm text-muted-foreground`,"aria-live":`polite`,children:f({id:`3m2GBo`})}):u?(0,Z.jsx)(`p`,{className:`px-2 py-1.5 text-sm text-muted-foreground`,"aria-live":`assertive`,children:f({id:`weP6me`})}):n.length===0?(0,Z.jsx)(`p`,{className:`px-2 py-1.5 text-sm text-muted-foreground`,"aria-live":`polite`,children:r.trim()===``?f({id:`0E9DR6`}):f({id:`yQyglE`})}):(0,Z.jsxs)(`div`,{role:`listbox`,id:p,"aria-label":f({id:`05n5wS`}),tabIndex:-1,className:`max-h-64 overflow-y-auto subtle-scrollbar`,children:[(0,Z.jsx)(`span`,{className:`sr-only`,"aria-live":`polite`,"aria-atomic":`true`,children:_?_.title:``}),n.map((e,t)=>{let n=t===i,r=Ax(e.path),o=r===`folder`,s=o?`${e.path}/`:e.path;return(0,Z.jsxs)(`button`,{id:`${p}-option-${t}`,type:`button`,role:`option`,"aria-selected":n,"data-active":n,"data-mention-kind":r,"data-testid":`composer-mention-option-${e.docName}`,className:`flex w-full items-start gap-2 rounded-md px-2 py-1.5 text-left ${n?`bg-accent text-accent-foreground`:``}`,onMouseDown:t=>{t.preventDefault(),a(e)},children:[(0,Z.jsx)(ft,{path:e.path,className:`mt-0.5 size-4 shrink-0 text-muted-foreground`}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,Z.jsxs)(`span`,{className:`flex items-baseline gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`truncate text-sm font-medium`,children:e.title}),o?(0,Z.jsx)(`span`,{className:`shrink-0 text-[10px] font-medium uppercase tracking-wide text-muted-foreground`,children:f({id:`kNqMMd`})}):null]}),(0,Z.jsx)(`span`,{className:`line-clamp-2 break-all text-xs text-muted-foreground`,children:s})]})]},e.docName)}),d?(0,Z.jsx)(`div`,{className:`px-2 py-1 text-xs text-muted-foreground`,"aria-hidden":!0,children:f({id:`F1T9y_`})}):null]})}),t[3]=f,t[4]=u,t[5]=d,t[6]=n,t[7]=p,t[8]=l,t[9]=a,t[10]=r,t[11]=i,t[12]=_,t[13]=v):v=t[13],v}var Mx=8,Nx=new Zn(`composerMentionSuggestion`);function Px(e){return e.kind===`asset`?e.docName.replace(/^\//,``):e.kind===`folder`?e.docName:Io(e.docName)}var Fx=On.create({name:`doc`,topNode:!0,content:`paragraph+`}),Ix=On.create({name:`paragraph`,group:`block`,content:`inline*`,parseHTML(){return[{tag:`p`}]},renderHTML(){return[`p`,0]}}),Lx=On.create({name:`text`,group:`inline`}),Rx=On.create({name:`hardBreak`,group:`inline`,inline:!0,selectable:!1,parseHTML(){return[{tag:`br`}]},renderHTML(){return[`br`]},addKeyboardShortcuts(){return{"Shift-Enter":()=>this.editor.commands.insertContent({type:`hardBreak`})}}}),zx=Wn.create({name:`composerHistory`,addProseMirrorPlugins(){return[Pn(),br({"Mod-z":Cn,"Mod-y":vn,"Shift-Mod-z":vn})]}}),Bx=On.create({name:`composerMention`,group:`inline`,inline:!0,atom:!0,selectable:!0,addAttributes(){return{path:{default:``},label:{default:``}}},parseHTML(){return[{tag:`span[data-composer-mention]`}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.label||e.attrs.path);return[`span`,fr(t,{"data-composer-mention":String(e.attrs.path??``),class:`composer-mention-chip`}),`@${n}`]},renderText({node:e}){return`@${e.attrs.path}`},addNodeView(){return({node:e,editor:t,getPos:n})=>{let r=String(e.attrs.path??``),i=String(e.attrs.label||e.attrs.path),a=document.createElement(`span`);a.className=`composer-mention-chip group/mention`,a.setAttribute(`data-composer-mention`,r),a.title=i;let o=document.createElement(`button`);o.type=`button`,o.className=`composer-mention-icon`,o.setAttribute(`aria-label`,Gc._({id:`Xzy0s0`,values:{fullLabel:i}}));let s=document.createElement(`span`);s.className=`composer-mention-glyph composer-mention-glyph-icon`,s.setAttribute(`aria-hidden`,`true`),s.innerHTML=ze(r),o.appendChild(s);let c=document.createElement(`span`);c.className=`composer-mention-glyph composer-mention-glyph-x`,c.setAttribute(`aria-hidden`,`true`),c.innerHTML=_e(gs),o.appendChild(c),o.addEventListener(`mousedown`,e=>e.preventDefault()),o.addEventListener(`click`,r=>{r.preventDefault();let i=typeof n==`function`?n():null;i!=null&&t.chain().focus().deleteRange({from:i,to:i+e.nodeSize}).run()}),a.appendChild(o);let l=document.createElement(`span`);return l.className=`composer-mention-label`,l.textContent=i,a.appendChild(l),{dom:a}}},addProseMirrorPlugins(){return[Ux(this.editor)]}});function Vx(e){return[Fx,Ix,Lx,Rx,zx,Bx,...e?.placeholder?[kx.configure({placeholder:e.placeholder})]:[]]}function Hx(e=Ti){let t=[],n=!1,r=null,i=!1;return{snapshot(){return{loaded:n,error:i}},async getItems(a){if(!n){r||=e();try{t=await r,n=!0,i=!1}catch(e){console.error(`[composer-mention] failed to fetch pages`,e),t=[],i=!0}finally{r=null}}return Mi(t,a).map(e=>({docName:e.docName,title:e.title,path:Px(e)})).filter(e=>e.path!==``)},reset(){t=[],n=!1,r=null,i=!1}}}function Ux(e){let t=Hx();return ii({editor:e,pluginKey:Nx,char:`@`,items:({query:e})=>t.getItems(e),command:({editor:e,range:t,props:n})=>{try{e.chain().focus().deleteRange(t).insertContent([{type:`composerMention`,attrs:{path:n.path,label:n.title}},{type:`text`,text:` `}]).run()}catch(e){console.error(`[composer-mention] insert failed`,{item:n,range:t},e)}},render:()=>{let e=null,n=null,r=0,i={popup:null,stopAutoUpdate:null},a=null,o=null,s=e=>{n?.command(e)},c=e=>{let n=e.items??[],{loaded:i,error:a}=t.snapshot();return{items:n,query:e.query??``,selectedIndex:r,onSelect:s,loading:!i&&!a,error:a,hasMore:n.length>=Mx}},l=()=>{!e||!n||e.updateProps(c(n))};return{onBeforeStart(t){n=t,r=0;let s=gi(()=>n,`composer-mention`);i.popup=s.popup,a=s.doPosition,o=s.reveal,e=new yi(jx,{props:c(t),editor:t.editor}),s.popup.appendChild(e.element),i.stopAutoUpdate=s.startAutoUpdate()},onStart(e){n=e,r=0,l(),o?.()},onUpdate(e){n=e,r=Math.min(r,Math.max(0,e.items.length-1)),l(),a?.()},onKeyDown({event:e}){if(!n)return!1;let t=n.items;if(e.key===`ArrowDown`)return t.length===0?!1:(r=(r+1)%t.length,l(),!0);if(e.key===`ArrowUp`)return t.length===0?!1:(r=(r-1+t.length)%t.length,l(),!0);if(e.key===`Enter`||e.key===`Tab`){let e=t[r];return e?(n.command(e),!0):!1}return!1},onExit(){hi(i),a=null,o=null,e?.destroy(),e=null,n=null,r=0,t.reset()}}}})}function Wx(e){let t=[],n=new Set,r=[];return e.state.doc.forEach(e=>{let i=``;e.forEach(e=>{if(e.type.name===`composerMention`){let r=String(e.attrs.path??``);r!==``&&(i+=`@${r}`,n.has(r)||(n.add(r),t.push(r)))}else e.isText?i+=e.text??``:e.type.name===`hardBreak`&&(i+=`
23
23
  `)}),r.push(i)}),{instruction:r.join(`
24
- `).trim(),mentions:t}}function Gx(e){let{instruction:t,mentions:n}=Wx(e);return t===``&&n.length===0}function Kx(e){let t=e?.content;return!Array.isArray(t)||t.length===0?!1:t.some(e=>Array.isArray(e.content)&&e.content.length>0)}function qx(e){let t=(0,$.c)(29),{ref:n,ariaLabel:r,onEmptyChange:i,onContentChange:a,onMentionsChange:o,onSubmit:s,className:c,placeholder:l,initialDoc:u}=e,d=(0,Q.useRef)(i),f=(0,Q.useRef)(a),p=(0,Q.useRef)(o),m=(0,Q.useRef)(s),h;t[0]!==a||t[1]!==i||t[2]!==o||t[3]!==s?(h=()=>{d.current=i,f.current=a,p.current=o,m.current=s},t[0]=a,t[1]=i,t[2]=o,t[3]=s,t[4]=h):h=t[4],(0,Q.useEffect)(h);let g;t[5]===l?g=t[6]:(g=Vx({placeholder:l}),t[5]=l,t[6]=g);let _=u??void 0,v;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(v=X(`composer-prosemirror py-1 outline-none`),t[7]=v):v=t[7];let y;t[8]===r?y=t[9]:(y={role:`textbox`,"aria-label":r,"aria-multiline":`true`,class:v},t[8]=r,t[9]=y);let b;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(b=(e,t)=>t.key===`Escape`?Nx.getState(e.state)?.active?!1:(e.dom.blur(),!0):t.key===`Enter`&&!t.shiftKey&&!t.isComposing&&!e.composing?Nx.getState(e.state)?.active?!1:(m.current(),!0):!1,t[10]=b):b=t[10];let x;t[11]===y?x=t[12]:(x={attributes:y,handleKeyDown:b},t[11]=y,t[12]=x);let S;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(S=e=>{let{editor:t}=e;d.current(Gx(t)),f.current?.(t.getJSON()),p.current?.(Wx(t).mentions)},t[13]=S):S=t[13];let C;t[14]!==g||t[15]!==_||t[16]!==x?(C={extensions:g,content:_,immediatelyRender:!0,editorProps:x,onUpdate:S},t[14]=g,t[15]=_,t[16]=x,t[17]=C):C=t[17];let w=ji(C),T;t[18]!==w||t[19]!==u?(T=()=>{w&&(Gx(w)&&Kx(u)&&(console.warn(`composer draft was incompatible with the current schema — clearing it`),wx()),d.current(Gx(w)),p.current?.(Wx(w).mentions))},t[18]=w,t[19]=u,t[20]=T):T=t[20];let E;t[21]===w?E=t[22]:(E=[w],t[21]=w,t[22]=E),(0,Q.useEffect)(T,E);let D,O;t[23]===w?(D=t[24],O=t[25]):(D=()=>({focus:()=>w?.commands.focus(),blur:()=>w?.commands.blur(),clear:()=>w?.commands.clearContent(!0),setText:e=>{w&&(w.commands.setContent(e),f.current?.(w.getJSON()),p.current?.(Wx(w).mentions))},getContent:()=>w?Wx(w):{instruction:``,mentions:[]}}),O=[w],t[23]=w,t[24]=D,t[25]=O),(0,Q.useImperativeHandle)(n,D,O);let k;return t[26]!==c||t[27]!==w?(k=(0,Z.jsx)(xi,{editor:w,className:c}),t[26]=c,t[27]=w,t[28]=k):k=t[28],k}function Jx(e,t,n){return e.trim().length>0||t.length>0||n}var Yx=new Set(ca.map(e=>e.id));function Xx(e){return typeof e==`string`&&Yx.has(e)}function Zx(e){try{let t=g_(e);return Xx(t)?t:null}catch{return null}}function Qx(e,t){__(e,t)}function $x(e){let{lastUsed:t,states:n}=e;return t&&n[t]?.installed===!0?t:ca.find(e=>n[e.id]?.installed===!0)?.id??null}function eS(e){let t=(0,$.c)(28),{scenario:n,className:r}=e,{_:i}=kt(),{states:a,refresh:o}=ya(),{dispatch:s}=Da(),c=ua(),l=Ta(),[u,d]=(0,Q.useState)(rS),f=(0,Q.useRef)(!1),[p,m]=(0,Q.useState)(null),h=p!==null&&l!==null,g=(0,Q.useRef)(null),[_]=(0,Q.useState)(nS),[v,y]=(0,Q.useState)(!0),[b,x]=(0,Q.useState)(!1),S;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(S=function(e){y(e),e||x(!1)},t[0]=S):S=t[0];let C=S,w=lx(n),T;t[1]===a?T=t[2]:(T=e=>a[e.id]?.installed===!0,t[1]=a,t[2]=T);let E=ca.filter(T),D;t[3]===a?D=t[4]:(D=ca.every(e=>a[e.id]?.installed!=null),t[3]=a,t[4]=D);let O=D,k=O&&E.length===0,A,j;t[5]!==O||t[6]!==a?(A=()=>{if(!O||f.current)return;let e=$x({lastUsed:Zx(),states:a});d(t=>e===t?t:e)},j=[O,a],t[5]=O,t[6]=a,t[7]=A,t[8]=j):(A=t[7],j=t[8]),(0,Q.useEffect)(A,j);let M=function(e){f.current=!0,m(null),d(e),Qx(e)},N=function(e){f.current=!0,m(e)},P=function(){if(l===null||p===null)return;let{instruction:e,mentions:t}=g.current?.getContent()??{instruction:``,mentions:[]};if(!Jx(e,t,!1)){x(!0);return}let r=ha({workspace:c,description:e,scenario:n,mentions:t});r!==null&&(l.launchInTerminal(r,p),g.current?.clear(),wx())},F=function(e){let{instruction:t,mentions:r}=g.current?.getContent()??{instruction:``,mentions:[]};if(!Jx(t,r,!1)){x(!0);return}Qx(e);let i=ha({workspace:c,description:t,scenario:n,mentions:r});i!==null&&(s(e,i),g.current?.clear(),wx())},I=function(){h?P():u!==null&&F(u)},L=function(e){g.current?.setText(e),g.current?.focus()};if(k){let e;t[9]===r?e=t[10]:(e=X(`flex w-full flex-wrap items-center justify-between gap-3 rounded-2xl border border-border/60 bg-card px-4 py-3`,r),t[9]=r,t[10]=e);let n;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(jo,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`}),t[11]=n):n=t[11];let i;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[n,(0,Z.jsx)(`span`,{className:`text-1sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`3IseAk`})})]}),t[12]=i):i=t[12];let a;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:ca.map(tS)}),t[13]=a):a=t[13];let o;return t[14]===e?o=t[15]:(o=(0,Z.jsxs)(`div`,{className:e,"data-testid":`create-no-agents`,children:[i,a]}),t[14]=e,t[15]=o),o}let R=E.length>0,z=l!==null,B;t[16]===r?B=t[17]:(B=X(`flex w-full flex-col gap-3`,r),t[16]=r,t[17]=B);let V;t[18]===i?V=t[19]:(V=i({id:`7hctf2`}),t[18]=i,t[19]=V);let H;t[20]===i?H=t[21]:(H=i({id:`0jD-Gn`}),t[20]=i,t[21]=H);let U;t[22]!==v||t[23]!==b?(U=b&&v?(0,Z.jsx)(`p`,{role:`alert`,className:`text-1sm text-destructive`,"data-testid":`create-input-required`,children:(0,Z.jsx)(J,{id:`1FLarN`})}):(0,Z.jsx)(`span`,{}),t[22]=v,t[23]=b,t[24]=U):U=t[24];let W=u===null?(0,Z.jsx)(Jr,{type:`button`,variant:`outline`,disabled:!0,className:`gap-1.5`,"data-testid":`create-with-agent`,children:(0,Z.jsx)(J,{id:`hYgDIe`})}):(0,Z.jsxs)(Ox,{children:[(0,Z.jsx)(Jr,{type:`button`,onClick:()=>h?P():F(u),variant:`outline`,className:`gap-1.5`,"data-testid":`create-with-agent`,children:h&&p!==null?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ma,{id:pa(p),"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(J,{id:`4rjwLG`,values:{0:zr[p].displayName}})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ma,{id:u,"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(J,{id:`9dw5bW`,values:{0:la(u)}})]})}),(0,Z.jsxs)(Ec,{onOpenChange:e=>{e&&o()},children:[(0,Z.jsx)(ic,{asChild:!0,children:(0,Z.jsx)(Jr,{type:`button`,"aria-label":i({id:`nskygk`}),size:`icon`,variant:`outline`,"data-testid":`create-with-agent-menu`,children:(0,Z.jsx)(ea,{"aria-hidden":`true`,className:`size-3.5`})})}),(0,Z.jsxs)(bc,{align:`end`,className:`min-w-[200px]`,children:[z?(0,Z.jsxs)(yc,{"aria-label":i({id:`ALhMYW`}),children:[(0,Z.jsx)(kc,{children:(0,Z.jsx)(J,{id:`ALhMYW`})}),wa.map(e=>{let{displayName:t}=zr[e];return(0,Z.jsxs)(vc,{onSelect:()=>N(e),"data-testid":`create-with-cli-${e}`,"aria-label":i({id:`QYfQdv`,values:{displayName:t}}),children:[(0,Z.jsx)(ma,{id:pa(e),"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:t}),p===e?(0,Z.jsx)($i,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e)})]}):null,R?(0,Z.jsxs)(Z.Fragment,{children:[z?(0,Z.jsx)(mc,{}):null,(0,Z.jsxs)(yc,{"aria-label":i({id:`BBqGS9`}),children:[(0,Z.jsx)(kc,{children:(0,Z.jsx)(J,{id:`BBqGS9`})}),E.map(e=>(0,Z.jsxs)(vc,{onSelect:()=>M(e.id),"data-testid":`create-agent-option-${e.id}`,children:[(0,Z.jsx)(ma,{id:e.id,"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:e.displayName}),!h&&e.id===u?(0,Z.jsx)($i,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.id))]})]}):null]})]})]}),G;return t[25]!==W||t[26]!==U?(G=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 px-3 pb-3`,children:[U,W]}),t[25]=W,t[26]=U,t[27]=G):G=t[27],(0,Z.jsxs)(`div`,{className:B,children:[(0,Z.jsxs)(`div`,{onMouseDown:e=>Ex(e,g),className:`flex w-full cursor-text flex-col rounded-2xl border border-border/60 bg-card shadow-sm transition-colors focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50`,children:[(0,Z.jsx)(qx,{ref:g,ariaLabel:V,placeholder:H,onEmptyChange:C,onContentChange:Cx,onSubmit:I,initialDoc:_,className:`max-h-96 overflow-y-auto px-4 py-3 text-sm leading-relaxed subtle-scrollbar [&_.ProseMirror]:min-h-16`}),G]}),n!==`existing-repo`&&w.length>0?(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-1sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`I5685_`})}),w.map(e=>{let t=e.icon;return(0,Z.jsxs)(Jr,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>L(e.prompt),className:`gap-1.5 rounded-md font-normal text-muted-foreground hover:text-foreground`,"data-testid":`create-suggestion-${e.id}`,children:[(0,Z.jsx)(t,{className:`size-3.5`,"aria-hidden":`true`}),e.label]},e.id)})]}):null]})}function tS(e){return(0,Z.jsxs)(Jr,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void sa(e),className:`gap-1.5`,"data-testid":`install-agent-${e.id}`,children:[(0,Z.jsx)(ma,{id:e.id,"aria-hidden":`true`,className:`size-3.5`}),e.displayName,(0,Z.jsx)(Hi,{"aria-hidden":`true`,className:`size-3`})]},e.id)}function nS(){return Sx().doc??void 0}function rS(){return Zx()}var iS=3100,aS=3;function oS(e,t,n){let r=n?.windowMs??600,i=n?.maxLevel??aS;if(e===0||t>=r)return 1;let a=e+1;return a>i?i:a}var sS={0:{count:0,startRadius:0,baseDistance:0,distanceVariance:0,sizeMin:0,sizeMax:0,maxDelay:0,durationMin:0,durationMax:0},1:{count:0,startRadius:0,baseDistance:0,distanceVariance:0,sizeMin:0,sizeMax:0,maxDelay:0,durationMin:0,durationMax:0},2:{count:0,startRadius:0,baseDistance:0,distanceVariance:0,sizeMin:0,sizeMax:0,maxDelay:0,durationMin:0,durationMax:0},3:{count:16,startRadius:11,baseDistance:7,distanceVariance:3,sizeMin:.45,sizeMax:1.2,maxDelay:500,durationMin:1100,durationMax:2400}},cS=[`var(--color-azure-blue)`,`var(--color-sky-blue)`,`var(--color-violet-300)`,`var(--color-orange-light)`,`var(--color-crystal-blue)`,`var(--color-white-cream)`];function lS(e,t={}){let n=t.rng??Math.random,r=t.colors??cS,i=sS[e];if(i.count===0||r.length===0)return[];let a=[],o=Math.PI*2/i.count;for(let e=0;e<i.count;e++){let t=e*o+(n()-.5)*o*.7,s=i.baseDistance+(n()-.5)*2*i.distanceVariance,c=i.sizeMin+n()*(i.sizeMax-i.sizeMin),l=n()*i.maxDelay,u=i.durationMin+n()*(i.durationMax-i.durationMin),d=Math.floor(n()*r.length),f=Math.cos(t),p=Math.sin(t);a.push({id:e,dx:f*s,dy:p*s,originDx:f*i.startRadius,originDy:p*i.startRadius,size:c,color:r[d]??`currentColor`,delay:l,duration:u})}return a}var uS=1.8,dS=90,fS=16,pS=380,mS=.025,hS=.1,gS=.18,_S=400,vS=9.2736,yS=18.1799,bS=14.5244,xS={1:{halfWidth:1.5,apexLift:2.2},2:{halfWidth:1.4,apexLift:2.6},3:{halfWidth:1.25,apexLift:3}};function SS(e,t){let{halfWidth:n,apexLift:r}=xS[t];return`M${e-n} ${bS+.3} Q${e} ${bS-r}, ${e+n} ${bS+.3}`}function CS(e){let t=1.5,n=.3;return`M${e-t} ${bS-n} Q${e} ${bS+1.4}, ${e+t} ${bS-n}`}var wS=15,TS=15;function ES(e){return{fill:e.color,"--fx-tx":`${e.dx}px`,"--fx-ty":`${e.dy}px`,"--fx-delay":`${e.delay}ms`,"--fx-duration":`${e.duration}ms`}}function DS(e){let t=(0,$.c)(71),{size:n,className:r,trackMouse:i,variant:a,celebrateSignal:o}=e,s=n===void 0?48:n,c=i===void 0?!0:i,l=a===void 0?`default`:a,u=o===void 0?0:o,d=(0,Q.useRef)(null),f=(0,Q.useRef)(null),p=(0,Q.useRef)(null),m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m={x:0,y:0},t[0]=m):m=t[0];let h=(0,Q.useRef)(m),[g,_]=(0,Q.useState)(0),[v,y]=(0,Q.useState)(0),b;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(b=[],t[1]=b):b=t[1];let[x,S]=(0,Q.useState)(b),C=(0,Q.useRef)(0),w=(0,Q.useRef)(void 0),T=l===`sleeping`,E;t[2]!==g||t[3]!==T?(E=function(){if(T)return;let e=typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now(),t=C.current===0?1/0:e-C.current;C.current=e;let n=oS(g,t);_(n),y(jS),S(lS(n)),clearTimeout(w.current),w.current=setTimeout(()=>{_(0),S([])},iS)},t[2]=g,t[3]=T,t[4]=E):E=t[4];let D=E,O,k;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(O=()=>()=>clearTimeout(w.current),k=[],t[5]=O,t[6]=k):(O=t[5],k=t[6]),(0,Q.useEffect)(O,k);let A,j;t[7]!==u||t[8]!==T?(A=()=>{u===0||T||(_(3),y(AS),S(lS(3)),clearTimeout(w.current),w.current=setTimeout(()=>{_(0),S([])},iS))},j=[u,T],t[7]=u,t[8]=T,t[9]=A,t[10]=j):(A=t[9],j=t[10]),(0,Q.useEffect)(A,j);let M,N;t[11]!==T||t[12]!==c?(M=()=>{if(!c||T||window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)return;let e=0,t=0,n=!1,r=0,i=0,a=0,o=0,s=0,l=function(){s===0&&(s=requestAnimationFrame(m))},u=function(r){e=r.clientX,t=r.clientY,n=!0,l()};function m(){s=0;let c=f.current,u=d.current;if(!c||!u){l();return}let m=n;n=!1;let g=c.getBoundingClientRect(),_=g.left+g.width/2,v=g.top+g.height*.48,y=e-_,b=t-v,x=Math.hypot(y,b),S=Math.max(-1,Math.min(1,y/pS)),C=-Math.max(-1,Math.min(1,b/pS))*fS,w=S*fS,T=0,E=0;if(x>=1){let e=Math.min(x/dS,1)*uS;T=y/x*e,E=b/x*e}let D=Math.abs(C-r)<.01&&Math.abs(w-i)<.01&&Math.abs(T-a)<.01&&Math.abs(E-o)<.01;if(!m&&D)return;l(),r+=(C-r)*hS,i+=(w-i)*hS,u.style.transform=`perspective(${_S}px) rotateX(${r.toFixed(3)}deg) rotateY(${i.toFixed(3)}deg)`,a+=(T-a)*gS,o+=(E-o)*gS;let O=i*mS,k=-r*mS,A=a+O,j=o+k;h.current.x=A,h.current.y=j,p.current?.setAttribute(`transform`,`translate(${A.toFixed(3)} ${j.toFixed(3)})`)}return document.addEventListener(`mousemove`,u,{passive:!0}),l(),()=>{document.removeEventListener(`mousemove`,u),s!==0&&cancelAnimationFrame(s),s=0,d.current&&(d.current.style.transform=``),h.current={x:0,y:0},p.current?.removeAttribute(`transform`)}},N=[c,T],t[11]=T,t[12]=c,t[13]=M,t[14]=N):(M=t[13],N=t[14]),(0,Q.useEffect)(M,N);let P;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(P=()=>{let e=p.current;if(!e)return;let{x:t,y:n}=h.current;e.setAttribute(`transform`,`translate(${t.toFixed(3)} ${n.toFixed(3)})`)},t[15]=P):P=t[15],(0,Q.useLayoutEffect)(P);let F=g>0,I=F?g:1,L=F?`ok-blob-clicked-${g}`:null,R;t[16]===r?R=t[17]:(R=X(`ok-blob-3d-wrapper`,r),t[16]=r,t[17]=R);let z=T?`cursor-default`:`cursor-pointer`,B=`body-${v}`,V=T&&`ok-blob-sleeping`,H;t[18]!==L||t[19]!==V?(H=X(`ok-blob-group`,V,L),t[18]=L,t[19]=V,t[20]=H):H=t[20];let U;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(`path`,{d:`M25.2339 6.78134C25.5199 7.35734 25.8179 8.47234 26.0179 9.07834C26.0189 9.08234 26.0209 9.08634 26.0219 9.09134C26.0229 9.09534 26.0249 9.10034 26.0259 9.10434C26.0539 9.19734 26.0949 9.29533 26.1519 9.41633C26.2919 9.71133 26.5269 10.1173 27.1299 11.1683C27.3259 11.4643 27.5209 11.7693 27.7119 12.0903C29.9739 15.1623 29.3259 20.1913 27.0469 22.9153C26.7779 23.2953 26.4869 23.6043 26.1889 23.8863C26.1519 23.9253 26.1129 23.9643 26.0729 24.0033C25.3159 24.7543 24.2949 25.4673 23.6129 25.8323C22.7469 26.2983 22.1349 26.5483 21.6299 26.7463C20.3649 27.3063 19.0609 27.7733 17.6569 28.0423C15.9649 28.3513 14.1939 28.4433 12.4569 28.1373C11.4779 27.9663 10.5119 27.6663 9.60891 27.2493C8.77491 26.8663 7.99192 26.3853 7.26992 25.8403C6.83592 25.5393 6.43893 25.2343 6.08093 24.9383C5.57893 24.5223 5.15993 24.1263 4.83493 23.7793C4.04993 22.9443 3.31593 21.8893 2.80893 21.0953C2.72593 20.9663 2.64792 20.8433 2.57592 20.7293C2.56192 20.7093 2.54793 20.6893 2.53393 20.6703C2.08593 20.0263 1.71892 19.3293 1.43792 18.5993C1.42892 18.5453 1.42093 18.4903 1.41293 18.4353C1.32093 17.7443 1.08292 16.9423 1.01092 15.6333C0.984921 15.0653 0.998928 14.4013 1.12393 13.6353C1.20693 13.1413 1.31993 12.9023 1.40893 12.7113C1.43593 12.6543 1.46193 12.6023 1.48593 12.5483C1.56793 12.3653 1.59392 12.1563 1.63592 11.9083C1.68992 11.5883 1.76992 11.1943 2.04592 10.7553C2.94392 9.37934 3.36792 8.81934 3.66592 8.33934C3.75592 8.20334 3.84292 8.08134 3.94192 7.96634C4.21592 7.64634 4.67693 7.29534 5.10293 7.05734C5.16693 7.02234 5.23093 6.98834 5.29193 6.95534C5.62993 6.77834 6.22592 6.30135 6.66992 5.92035C6.83692 5.77635 7.08193 5.60735 7.37393 5.40935C7.67393 5.20535 8.02593 4.96934 8.39193 4.70234C9.32093 4.02634 9.84091 3.69134 10.2599 3.42334C10.3799 3.34734 10.4919 3.27734 10.6049 3.20834C10.9609 2.98834 11.4149 2.73034 11.8869 2.48634C12.4519 2.19334 13.0469 1.92133 13.5089 1.72233C14.7399 1.30233 16.0539 1.01333 17.4169 1.00033C18.1169 0.991333 18.7939 1.16534 19.2389 1.43034C19.6869 1.69534 19.8689 2.00335 19.8039 2.23935C19.7379 2.47835 19.4399 2.63634 19.0109 2.74734C18.5789 2.85634 18.0469 2.92035 17.4889 2.96135C16.3639 3.04235 15.2399 3.36435 14.1499 3.80835C12.8199 4.35135 11.5379 5.07133 10.2719 5.84733C9.38691 6.39133 8.51192 6.97334 7.63592 7.56834C7.54492 7.63034 7.45492 7.69135 7.36492 7.75235C6.97392 8.06635 6.58293 8.38134 6.22293 8.66334C5.97893 8.85734 5.76793 9.04834 5.59393 9.21434C5.26893 9.52334 5.02393 9.74334 4.81893 9.93934C4.67793 10.0753 4.55793 10.2013 4.45593 10.3443C4.40093 10.4213 4.32992 10.5273 4.24792 10.6593C3.90492 11.1933 3.44493 12.1693 3.15393 13.1173C3.01893 13.5363 2.87991 14.0343 2.79391 14.5253C2.66591 15.2253 2.65594 15.9053 2.71994 16.2373C2.82794 16.8193 2.95593 17.4833 3.14093 18.0553C3.31293 18.6003 3.52991 19.0583 3.70791 19.2823C3.81591 19.4183 3.90394 19.5473 3.99594 19.6913C4.09394 19.8413 4.19191 20.0073 4.31091 20.2033C4.47891 20.4803 4.68592 20.8163 5.00192 21.2493C5.36492 21.7463 5.61793 22.1043 5.83493 22.4023C6.14493 22.8243 6.38591 23.1343 6.83691 23.5033C7.33891 23.9113 7.86593 24.3113 8.26693 24.6393C8.44893 24.7883 8.66993 24.9443 8.90493 25.0963C9.21593 25.2963 9.55192 25.4893 9.85592 25.6703C10.1059 25.8203 10.3059 25.9633 10.4869 26.0863C10.5429 26.1243 10.5979 26.1603 10.6519 26.1943C10.8699 26.2803 11.0929 26.3593 11.3159 26.4283C11.3539 26.4323 11.3949 26.4353 11.4369 26.4393C11.6509 26.4573 11.9089 26.4733 12.2209 26.5133C12.7169 26.5753 13.1399 26.6603 13.6019 26.7243C13.9589 26.7733 14.3409 26.8083 14.7729 26.7893C15.0729 26.7753 15.4069 26.7353 15.7389 26.6813C16.2349 26.6023 16.7179 26.4943 17.0569 26.4473C17.1499 26.4343 17.2359 26.4343 17.3209 26.4373C17.3489 26.4393 17.3799 26.4413 17.4109 26.4433C17.4119 26.4433 17.4119 26.4433 17.4129 26.4433C17.4199 26.4433 17.4279 26.4443 17.4349 26.4443C18.2329 26.2413 19.0259 25.9433 19.7959 25.5983C19.8609 25.5633 19.9259 25.5273 19.9899 25.4913C20.3059 25.3173 20.6049 25.1383 20.7869 24.9943C20.9829 24.8393 21.5189 24.5373 22.0579 24.1853C22.4109 23.9553 22.7649 23.7053 23.0369 23.4833C23.1949 23.3553 23.3689 23.2693 23.5479 23.1773C23.7129 23.0923 23.8809 23.0013 24.0349 22.8653C24.1109 22.7983 24.1869 22.7173 24.2639 22.6303C24.3309 22.5563 24.4039 22.4723 24.4759 22.3923C24.5459 22.3153 24.7199 22.1723 24.9139 21.9793C25.0079 21.8863 25.1059 21.7783 25.1909 21.6713C25.2199 21.6323 25.2489 21.5943 25.2769 21.5553C25.5919 21.0403 25.8779 20.5003 26.1019 19.9653C26.1299 19.8403 26.1379 19.7293 26.1279 19.6373C26.1199 19.5703 26.1029 19.5113 26.0839 19.4503C26.0599 19.3643 26.0329 19.2773 26.0239 19.1723C26.0169 19.0893 26.0309 19.0043 26.0629 18.9543C26.0779 18.9323 26.0969 18.9143 26.1129 18.8993C26.1329 18.8823 26.1499 18.8673 26.1569 18.8443C26.1609 18.8273 26.1579 18.8073 26.1529 18.7833C26.1459 18.7443 26.1369 18.6943 26.1539 18.6293C26.2189 18.3853 26.2869 18.1103 26.3319 17.8383C26.3829 17.5393 26.4049 17.2433 26.3949 17.0123C26.3849 16.7493 26.3909 16.3823 26.3469 16.0003C26.3179 15.7343 26.2659 15.4663 26.1979 15.2383C26.1319 15.0143 26.0219 14.7913 25.9039 14.5783C25.7629 14.3223 25.6119 14.0783 25.5169 13.8453C25.4969 13.7983 25.4999 13.7263 25.4999 13.6323C25.5009 13.5673 25.4999 13.4913 25.4919 13.4083C25.3239 13.1243 25.1459 12.8423 24.9589 12.5483C24.9479 12.5413 24.9369 12.5333 24.9249 12.5263C24.6689 12.3503 24.3139 12.1173 24.0769 11.5503C24.0179 11.4063 24.0069 11.2983 23.9969 11.1993C23.9859 11.1013 23.9799 11.0183 23.9289 10.9093C23.8709 10.7853 23.7759 10.6583 23.6709 10.4993C23.5849 10.3703 23.4899 10.2133 23.4199 10.0423C23.3819 9.95134 23.3509 9.85734 23.3329 9.75934C23.3299 9.74334 23.3269 9.72534 23.3229 9.70634C23.2899 9.52734 23.2439 9.26534 23.2409 8.98634C23.0209 8.24434 22.8339 7.48833 22.6519 6.77633C22.3429 5.57133 22.0519 4.54234 21.3329 3.95434C20.9839 3.65334 20.5689 3.35433 20.2459 3.05433C19.9259 2.75633 19.7449 2.47534 19.8019 2.23834C19.8639 2.00634 20.1589 1.82934 20.6659 1.80534C21.1699 1.78334 21.8699 1.93235 22.5209 2.39235C23.6159 3.14235 24.2029 4.38334 24.5599 5.35734C24.5829 5.40834 24.6049 5.46034 24.6259 5.51234C24.7849 5.89434 24.9529 6.22834 25.1199 6.55534C25.1579 6.63034 25.1969 6.70834 25.2339 6.78134Z`,className:`ok-blob-body`}),t[21]=U):U=t[21];let W=(F||T)&&`ok-blob-eye-hidden`,G;t[22]===W?G=t[23]:(G=X(`ok-blob-eye`,W),t[22]=W,t[23]=G);let K;t[24]===G?K=t[25]:(K=(0,Z.jsx)(`ellipse`,{cx:vS,cy:bS,rx:1.2722,ry:1.9083,className:G}),t[24]=G,t[25]=K);let ee=(F||T)&&`ok-blob-eye-hidden`,te;t[26]===ee?te=t[27]:(te=X(`ok-blob-eye ok-blob-eye-right`,ee),t[26]=ee,t[27]=te);let ne;t[28]===te?ne=t[29]:(ne=(0,Z.jsx)(`ellipse`,{cx:yS,cy:bS,rx:1.2722,ry:1.9083,className:te}),t[28]=te,t[29]=ne);let re;t[30]===I?re=t[31]:(re=SS(vS,I),t[30]=I,t[31]=re);let ie=(!F||T)&&`ok-blob-eye-hidden`,q;t[32]===ie?q=t[33]:(q=X(`ok-blob-happy-eye`,ie),t[32]=ie,t[33]=q);let ae;t[34]!==re||t[35]!==q?(ae=(0,Z.jsx)(`path`,{d:re,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:q}),t[34]=re,t[35]=q,t[36]=ae):ae=t[36];let oe;t[37]===I?oe=t[38]:(oe=SS(yS,I),t[37]=I,t[38]=oe);let se=(!F||T)&&`ok-blob-eye-hidden`,ce;t[39]===se?ce=t[40]:(ce=X(`ok-blob-happy-eye`,se),t[39]=se,t[40]=ce);let le;t[41]!==oe||t[42]!==ce?(le=(0,Z.jsx)(`path`,{d:oe,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:ce}),t[41]=oe,t[42]=ce,t[43]=le):le=t[43];let ue;t[44]===T?ue=t[45]:(ue=T?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`path`,{d:CS(vS),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`}),(0,Z.jsx)(`path`,{d:CS(yS),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`})]}):null,t[44]=T,t[45]=ue);let de;t[46]!==K||t[47]!==ne||t[48]!==ae||t[49]!==le||t[50]!==ue?(de=(0,Z.jsxs)(`g`,{ref:p,children:[K,ne,ae,le,ue]}),t[46]=K,t[47]=ne,t[48]=ae,t[49]=le,t[50]=ue,t[51]=de):de=t[51];let fe;t[52]!==B||t[53]!==H||t[54]!==de?(fe=(0,Z.jsxs)(`g`,{className:H,children:[U,de]},B),t[52]=B,t[53]=H,t[54]=de,t[55]=fe):fe=t[55];let pe;t[56]===T?pe=t[57]:(pe=T?(0,Z.jsxs)(`g`,{children:[(0,Z.jsx)(`text`,{x:21,y:7,className:`ok-blob-z ok-blob-z-1`,children:`z`}),(0,Z.jsx)(`text`,{x:26,y:2,className:`ok-blob-z ok-blob-z-2`,children:`z`})]}):null,t[56]=T,t[57]=pe);let me;t[58]!==v||t[59]!==x?(me=x.length>0&&(0,Z.jsx)(`g`,{children:x.map(OS)},`firework-${v}`),t[58]=v,t[59]=x,t[60]=me):me=t[60];let he;t[61]!==D||t[62]!==s||t[63]!==z||t[64]!==fe||t[65]!==pe||t[66]!==me?(he=(0,Z.jsxs)(`svg`,{ref:f,width:s,height:s,viewBox:`0 0 30 30`,fill:`none`,overflow:`visible`,xmlns:`http://www.w3.org/2000/svg`,className:z,"aria-hidden":`true`,onClick:D,onMouseDown:kS,children:[fe,pe,me]}),t[61]=D,t[62]=s,t[63]=z,t[64]=fe,t[65]=pe,t[66]=me,t[67]=he):he=t[67];let ge;return t[68]!==R||t[69]!==he?(ge=(0,Z.jsx)(`span`,{ref:d,className:R,children:he}),t[68]=R,t[69]=he,t[70]=ge):ge=t[70],ge}function OS(e){return(0,Z.jsx)(`circle`,{cx:wS+e.originDx,cy:TS+e.originDy,r:e.size,className:`ok-blob-firework`,style:ES(e)},e.id)}function kS(e){return e.preventDefault()}function AS(e){return e+1}function jS(e){return e+1}function MS(e){let t=(0,$.c)(12),{title:n,subtitle:r,celebrateSignal:i}=e,a;t[0]===i?a=t[1]:(a=(0,Z.jsx)(DS,{size:64,celebrateSignal:i}),t[0]=i,t[1]=a);let o;t[2]===n?o=t[3]:(o=(0,Z.jsx)(`h2`,{className:`text-2xl font-light tracking-tighter text-balance`,children:n}),t[2]=n,t[3]=o);let s;t[4]===r?s=t[5]:(s=r?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r}):null,t[4]=r,t[5]=s);let c;t[6]!==o||t[7]!==s?(c=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8];let l;return t[9]!==a||t[10]!==c?(l=(0,Z.jsxs)(`div`,{className:`flex flex-col items-start gap-3 @md/emptystate:flex-row @md/emptystate:items-center @md/emptystate:gap-4`,children:[a,c]}),t[9]=a,t[10]=c,t[11]=l):l=t[11],l}function NS({isOnboarding:e,isEmbedded:t}){return e?{title:{id:`6h4zVU`},subtitle:t?{id:`vGeNNQ`}:{id:`qpQwGC`}}:{title:{id:`FOGD7m`},subtitle:t?{id:`3DTatP`}:{id:`MqQoV-`}}}var PS=`open-knowledge:create-top-level-file`;function FS(e={}){window.dispatchEvent(new CustomEvent(PS,{detail:e}))}function IS(e){let t=t=>{let n=t.detail;e(n??{})};return window.addEventListener(PS,t),()=>window.removeEventListener(PS,t)}function LS(e){let t=(0,$.c)(28),{celebrateSignal:n,onAddStarterPack:r}=e,{_:i}=kt(),a=Po(),{title:o,subtitle:s}=NS({isOnboarding:!1,isEmbedded:a}),c=mo(),l;t[0]!==c.data||t[1]!==c.status?(l=c.status===`ready`?c.data:[],t[0]=c.data,t[1]=c.status,t[2]=l):l=t[2];let u=l,d=c.status===`loading`||c.status===`idle`,f=c.status===`error`,p=MS,m=i(o),h=i(s),g;t[3]!==p||t[4]!==n||t[5]!==m||t[6]!==h?(g=(0,Z.jsx)(p,{title:m,subtitle:h,celebrateSignal:n}),t[3]=p,t[4]=n,t[5]=m,t[6]=h,t[7]=g):g=t[7];let _;t[8]===a?_=t[9]:(_=a?(0,Z.jsx)(ux,{scenario:`existing-repo`}):(0,Z.jsx)(eS,{scenario:`existing-repo`}),t[8]=a,t[9]=_);let v;t[10]!==u||t[11]!==f||t[12]!==d?(v=d||f||u.length>0?(0,Z.jsx)(BS,{templates:u,loading:d,error:f,onSelect:zS}):null,t[10]=u,t[11]=f,t[12]=d,t[13]=v):v=t[13];let y,b;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(nt,{"aria-hidden":`true`,className:`size-3`}),b=(0,Z.jsx)(J,{id:`IajAbS`}),t[14]=y,t[15]=b):(y=t[14],b=t[15]);let x;t[16]===r?x=t[17]:(x=(0,Z.jsxs)(Jr,{onClick:r,variant:`link-muted`,size:`xs`,className:`font-mono text-xs uppercase tracking-wider`,children:[y,b]}),t[16]=r,t[17]=x);let S;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(Jr,{variant:`link-muted`,className:`justify-end`,size:`sm`,onClick:RS,children:(0,Z.jsx)(J,{id:`L4Cdd9`,components:{0:(0,Z.jsx)(vi,{"aria-hidden":`true`,className:`size-3`})}})}),t[18]=S):S=t[18];let C;t[19]===x?C=t[20]:(C=(0,Z.jsxs)(`div`,{className:`-mt-6 flex w-full items-center justify-between gap-4`,children:[x,S]}),t[19]=x,t[20]=C);let w;t[21]!==C||t[22]!==v?(w=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-8`,children:[v,C]}),t[21]=C,t[22]=v,t[23]=w):w=t[23];let T;return t[24]!==w||t[25]!==g||t[26]!==_?(T=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-8 py-12 max-w-5xl my-auto`,children:[g,_,w]}),t[24]=w,t[25]=g,t[26]=_,t[27]=T):T=t[27],T}function RS(){return FS({initialDir:``})}function zS(e,t){return FS({template:{folder:e,name:t}})}function BS(e){let t=(0,$.c)(25),{templates:n,loading:r,error:i,onSelect:a}=e,{_:o}=kt(),c;t[0]===o?c=t[1]:(c=o({id:`_8quCH`}),t[0]=o,t[1]=c);let l;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`_8quCH`})}),t[2]=l):l=t[2];let u;t[3]!==o||t[4]!==i||t[5]!==r||t[6]!==n?(u=r||i?null:(0,Z.jsx)(s,{className:`text-2xs`,variant:`gray`,"aria-label":o({id:`X7u0xR`,values:{0:n.length}}),children:n.length}),t[3]=o,t[4]=i,t[5]=r,t[6]=n,t[7]=u):u=t[7];let d;t[8]===u?d=t[9]:(d=(0,Z.jsxs)(`header`,{className:`flex items-center gap-2 font-mono text-2xs uppercase tracking-wider text-muted-foreground`,children:[l,u]}),t[8]=u,t[9]=d);let f;t[10]===o?f=t[11]:(f=o({id:`irFGwu`}),t[10]=o,t[11]=f);let p;t[12]!==i||t[13]!==r||t[14]!==a||t[15]!==n?(p=r?(0,Z.jsx)(`p`,{className:`p-4 text-1sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`Hl89Qd`})}):i?(0,Z.jsx)(`p`,{role:`alert`,className:`p-4 text-1sm text-destructive`,children:(0,Z.jsx)(J,{id:`54Y6Fg`})}):n.map(e=>(0,Z.jsx)(VS,{template:e,targetLabel:e.source_folder===``?`/`:`${e.source_folder}/`,onClick:()=>a(e.source_folder,e.name)},`${e.source_folder}/${e.name}`)),t[12]=i,t[13]=r,t[14]=a,t[15]=n,t[16]=p):p=t[16];let m;t[17]!==r||t[18]!==f||t[19]!==p?(m=(0,Z.jsx)(`div`,{className:`w-full overflow-hidden rounded-xl border border-border/60 bg-card`,children:(0,Z.jsx)(`section`,{"aria-busy":r,"aria-label":f,tabIndex:0,className:`subtle-scrollbar scroll-fade-mask flex max-h-[260px] w-full flex-col overflow-y-auto overscroll-contain focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50`,children:p})}),t[17]=r,t[18]=f,t[19]=p,t[20]=m):m=t[20];let h;return t[21]!==c||t[22]!==d||t[23]!==m?(h=(0,Z.jsxs)(`section`,{"aria-label":c,className:`flex w-full flex-col gap-3`,children:[d,m]}),t[21]=c,t[22]=d,t[23]=m,t[24]=h):h=t[24],h}function VS(e){let t=(0,$.c)(24),{template:n,targetLabel:r,onClick:i}=e,{_:a}=kt(),o;t[0]!==n.name||t[1]!==n.title?(o=n.title?.trim()||n.name,t[0]=n.name,t[1]=n.title,t[2]=o):o=t[2];let s=o,c=`${n.name}.md`,l=n.source_folder===``,u;t[3]!==a||t[4]!==s||t[5]!==c||t[6]!==l||t[7]!==r?(u=a(l?{id:`89TtiD`,values:{displayTitle:s,fileName:c}}:{id:`0_J12R`,values:{displayTitle:s,fileName:c,targetLabel:r}}),t[3]=a,t[4]=s,t[5]=c,t[6]=l,t[7]=r,t[8]=u):u=t[8];let d=u,f;t[9]===s?f=t[10]:(f=(0,Z.jsx)(`span`,{className:`truncate text-sm font-medium leading-tight text-foreground/80`,children:s}),t[9]=s,t[10]=f);let p;t[11]===c?p=t[12]:(p=(0,Z.jsx)(`span`,{className:`truncate font-mono text-1sm font-normal text-muted-foreground`,children:c}),t[11]=c,t[12]=p);let m;t[13]!==f||t[14]!==p?(m=(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-2`,children:[f,p]}),t[13]=f,t[14]=p,t[15]=m):m=t[15];let h=`shrink-0 font-mono text-1sm ${l?`text-muted-foreground/70`:`text-muted-foreground`}`,g;t[16]!==h||t[17]!==r?(g=(0,Z.jsx)(`span`,{className:h,children:r}),t[16]=h,t[17]=r,t[18]=g):g=t[18];let _;return t[19]!==d||t[20]!==i||t[21]!==m||t[22]!==g?(_=(0,Z.jsxs)(Jr,{type:`button`,variant:`ghost`,onClick:i,"aria-label":d,className:`group flex h-auto w-full items-center justify-between gap-4 rounded-none p-4 text-left transition-colors hover:bg-muted/50 focus-visible:bg-muted/50`,children:[m,g]}),t[19]=d,t[20]=i,t[21]=m,t[22]=g,t[23]=_):_=t[23],_}function HS(e){let t=(0,$.c)(25),{terminalDock:n}=e,r=n===void 0?null:n,[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(void 0),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(0),f=(0,Q.useRef)(!1),p=(0,Q.useRef)(void 0),m,h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>{let e=!1,t=async function(){try{let{ok:t,body:n}=await sl();if(e)return;let r=t?pn.safeParse(n):null;r?.success?(l(GS(r.data.documents)),f.current=!0):f.current||=(l(1),!0)}catch{!e&&!f.current&&(l(1),f.current=!0)}};t();let n=dl(e=>{e.includes(`files`)&&t()});return()=>{e=!0,n(),clearTimeout(p.current)}},h=[],t[0]=m,t[1]=h):(m=t[0],h=t[1]),(0,Q.useEffect)(m,h);let g;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(g=function(){clearTimeout(p.current),p.current=setTimeout(()=>d(WS),500),sl().then(e=>{let{ok:t,body:n}=e;if(!t)return;let r=pn.safeParse(n);r.success&&l(GS(r.data.documents))}).catch(US)},t[2]=g):g=t[2];let _=g,v=c!==null,y=c===0,b;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(b=function(e){a(e),e||s(void 0)},t[3]=b):b=t[3];let x=b;if(r!==null){let e=r===`bottom`?`justify-end`:`justify-center`,n;t[4]===e?n=t[5]:(n=X(`@container/emptystate flex min-h-0 flex-1 flex-col items-center pb-8 pt-10`,e),t[4]=e,t[5]=n);let i;t[6]!==u||t[7]!==y||t[8]!==v?(i=v?(0,Z.jsx)(KS,{isOnboarding:y,celebrateSignal:u}):null,t[6]=u,t[7]=y,t[8]=v,t[9]=i):i=t[9];let a;t[10]===i?a=t[11]:(a=(0,Z.jsx)(`div`,{className:`flex w-full flex-col items-center px-4 @md/emptystate:px-10 @2xl/emptystate:px-16`,children:i}),t[10]=i,t[11]=a);let o;return t[12]!==n||t[13]!==a?(o=(0,Z.jsx)(`div`,{className:n,children:a}),t[12]=n,t[13]=a,t[14]=o):o=t[14],o}let S;t[15]!==u||t[16]!==y||t[17]!==v?(S=v?y?(0,Z.jsx)(qS,{celebrateSignal:u,onPackSelect:e=>{s(e),a(!0)}}):(0,Z.jsx)(LS,{celebrateSignal:u,onAddStarterPack:()=>{a(!0)}}):null,t[15]=u,t[16]=y,t[17]=v,t[18]=S):S=t[18];let C;t[19]!==o||t[20]!==i?(C=(0,Z.jsx)(Yh,{open:i,onOpenChange:x,onSeedApplied:_,initialPackId:o}),t[19]=o,t[20]=i,t[21]=C):C=t[21];let w;return t[22]!==S||t[23]!==C?(w=(0,Z.jsx)(`div`,{className:`@container/emptystate flex min-h-0 flex-1 flex-col items-center overflow-y-auto subtle-scrollbar`,children:(0,Z.jsxs)(`div`,{className:`flex w-full flex-1 flex-col items-center px-4 @md/emptystate:px-10 @2xl/emptystate:px-16`,children:[S,C]})}),t[22]=S,t[23]=C,t[24]=w):w=t[24],w}function US(){}function WS(e){return e+1}function GS(e){return Xc(e).filter(e=>e.kind===`document`||e.kind===`folder`).length}function KS(e){let t=(0,$.c)(15),{isOnboarding:n,celebrateSignal:r}=e,{_:i}=kt(),a=Po(),o,s,c,l;if(t[0]!==i||t[1]!==a||t[2]!==n){let{title:e,subtitle:r}=NS({isOnboarding:n,isEmbedded:a});l=`w-full max-w-5xl`,o=MS,s=i(e),c=i(r),t[0]=i,t[1]=a,t[2]=n,t[3]=o,t[4]=s,t[5]=c,t[6]=l}else o=t[3],s=t[4],c=t[5],l=t[6];let u;t[7]!==o||t[8]!==r||t[9]!==s||t[10]!==c?(u=(0,Z.jsx)(o,{title:s,subtitle:c,celebrateSignal:r}),t[7]=o,t[8]=r,t[9]=s,t[10]=c,t[11]=u):u=t[11];let d;return t[12]!==l||t[13]!==u?(d=(0,Z.jsx)(`div`,{className:l,children:u}),t[12]=l,t[13]=u,t[14]=d):d=t[14],d}function qS(e){let t=(0,$.c)(29),{celebrateSignal:n,onPackSelect:r}=e,{_:i}=kt(),a=Po(),o,s,c,l;if(t[0]!==i||t[1]!==a){let{title:e,subtitle:n}=NS({isOnboarding:!0,isEmbedded:a});l=`flex w-full flex-col gap-10 py-12 max-w-5xl my-auto`,o=MS,s=i(e),c=i(n),t[0]=i,t[1]=a,t[2]=o,t[3]=s,t[4]=c,t[5]=l}else o=t[2],s=t[3],c=t[4],l=t[5];let u;t[6]!==o||t[7]!==n||t[8]!==s||t[9]!==c?(u=(0,Z.jsx)(o,{title:s,subtitle:c,celebrateSignal:n}),t[6]=o,t[7]=n,t[8]=s,t[9]=c,t[10]=u):u=t[10];let d;t[11]===a?d=t[12]:(d=a?(0,Z.jsx)(ux,{scenario:`new-project`}):(0,Z.jsx)(eS,{scenario:`new-project`}),t[11]=a,t[12]=d);let f;t[13]!==i||t[14]!==a?(f=i(a?{id:`GubkSu`}:{id:`xeXS4P`}),t[13]=i,t[14]=a,t[15]=f):f=t[15];let p;t[16]===f?p=t[17]:(p=(0,Z.jsx)(YS,{label:f}),t[16]=f,t[17]=p);let m;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(m=[`okf`,`entity-vault`],t[18]=m):m=t[18];let h;t[19]===r?h=t[20]:(h=(0,Z.jsx)(Uh,{onPackSelect:r,onCreateBlankFile:JS,collapsedPackIds:m}),t[19]=r,t[20]=h);let g;t[21]!==p||t[22]!==h?(g=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-3`,children:[p,h]}),t[21]=p,t[22]=h,t[23]=g):g=t[23];let _;return t[24]!==g||t[25]!==l||t[26]!==u||t[27]!==d?(_=(0,Z.jsxs)(`div`,{className:l,children:[u,d,g]}),t[24]=g,t[25]=l,t[26]=u,t[27]=d,t[28]=_):_=t[28],_}function JS(){return FS()}function YS(e){let t=(0,$.c)(13),{label:n}=e,{_:r}=kt(),i;t[0]===n?i=t[1]:(i=(0,Z.jsx)(`span`,{className:`font-mono text-2xs uppercase tracking-wider text-muted-foreground whitespace-nowrap`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=r({id:`jAMpHn`}),t[2]=r,t[3]=a);let o;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(ts,{className:`size-3.5`,"aria-hidden":!0}),t[4]=o):o=t[4];let s;t[5]===a?s=t[6]:(s=(0,Z.jsx)(Ts,{className:`text-muted-foreground transition-colors hover:text-foreground`,"aria-label":a,"data-testid":`starter-pack-info`,children:o}),t[5]=a,t[6]=s);let c;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(Es,{className:`max-w-xs`,children:(0,Z.jsx)(`p`,{className:`leading-relaxed wrap-break-word`,children:(0,Z.jsx)(J,{id:`k4CuuV`})})}),t[7]=c):c=t[7];let l;t[8]===s?l=t[9]:(l=(0,Z.jsxs)(Os,{children:[s,c]}),t[8]=s,t[9]=l);let u;return t[10]!==i||t[11]!==l?(u=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[i,l]}),t[10]=i,t[11]=l,t[12]=u):u=t[12],u}function XS(e){return e===``?`.ok/frontmatter.yml`:`${e}/.ok/frontmatter.yml`}function ZS(e){let t=(0,$.c)(70),{folderPath:n,state:r,onChange:i}=e,{_:a}=kt(),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(null);if(r.status===`idle`||r.status===`loading`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card p-4 space-y-3`,children:[(0,Z.jsx)($S,{}),(0,Z.jsx)(Ka,{className:`h-7 w-full`}),(0,Z.jsx)(Ka,{className:`h-7 w-full`}),(0,Z.jsx)(Ka,{className:`h-7 w-full`})]}),t[0]=e):e=t[0],e}if(r.status===`error`){let{message:e}=r,n;return t[1]===e?n=t[2]:(n=(0,Z.jsx)(`section`,{className:`rounded-lg border border-destructive/30 bg-destructive/5 p-4 text-sm text-destructive`,role:`alert`,children:(0,Z.jsx)(J,{id:`lzmtKp`,values:{message:e}})}),t[1]=e,t[2]=n),n}let f;t[3]===r.data.frontmatterLocal?f=t[4]:(f=r.data.frontmatterLocal??{},t[3]=r.data.frontmatterLocal,t[4]=f);let p=f,m;t[5]===r.data.folder.path?m=t[6]:(m=XS(r.data.folder.path),t[5]=r.data.folder.path,t[6]=m);let h=m,g;t[7]===p?g=t[8]:(g=Object.keys(p),t[7]=p,t[8]=g);let _=g,v;t[9]!==a||t[10]!==n||t[11]!==i?(v=async function(e,t){let r=await Go(n,{[e]:t});if(!r.ok){let{error:e}=r;hs.error(a({id:`xXo8FT`,values:{error:e}}));return}i()},t[9]=a,t[10]=n,t[11]=i,t[12]=v):v=t[12];let y=v,b;t[13]!==a||t[14]!==n||t[15]!==i?(b=async function(e){let t=await Go(n,{[e]:null});if(!t.ok){let{error:e}=t;hs.error(a({id:`ZU8VV_`,values:{error:e}}));return}i()},t[13]=a,t[14]=n,t[15]=i,t[16]=b):b=t[16];let x=b,S;t[17]!==y||t[18]!==p?(S=function(e,t){let n=p[e];y(e,Qi(n,t))},t[17]=y,t[18]=p,t[19]=S):S=t[19];let C=S,w;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(w=function(){l({name:``,type:`text`,value:``,error:null}),s(!1)},t[20]=w):w=t[20];let T=w,E;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(E=function(e){l(t=>{if(!t)return t;let n=e===`date`?new Date().toISOString().slice(0,10):qi[e];return{...t,type:e,value:n,error:null}})},t[21]=E):E=t[21];let D=E,O;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(O=function(e){l(t=>t&&{...t,value:e})},t[22]=O):O=t[22];let k=O,A;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(e){l(t=>t&&{...t,name:e,error:null})},t[23]=A):A=t[23];let j=A,M;t[24]!==a||t[25]!==c||t[26]!==n||t[27]!==i||t[28]!==p?(M=async function(e){if(!c)return;let t=e??c.value,r=c.name.trim();if(!r){l({...c,value:t,error:a({id:`8_brI5`})});return}if(Un(t)){l({...c,value:t,error:a({id:`hXUWyd`})});return}if(Object.hasOwn(p,r)){l({...c,value:t,error:a({id:`CTJLpz`,values:{trimmed:r}})});return}let o=await Go(n,{[r]:t});if(!o.ok){l({...c,value:t,error:o.error});return}l(null),i()},t[24]=a,t[25]=c,t[26]=n,t[27]=i,t[28]=p,t[29]=M):M=t[29];let N=M,P;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(P=function(e){d({key:e,draft:e,error:null})},t[30]=P):P=t[30];let F=P,I;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(I=function(e){d(t=>t&&{...t,draft:e,error:null})},t[31]=I):I=t[31];let L=I,R;t[32]!==a||t[33]!==n||t[34]!==i||t[35]!==p||t[36]!==u?(R=async function(){if(!u)return;let e=u.draft.trim();if(!e){d({...u,error:a({id:`8_brI5`})});return}if(e===u.key){d(null);return}if(Object.hasOwn(p,e)){d({...u,error:a({id:`CTJLpz`,values:{trimmed:e}})});return}let t=p[u.key],r=await Go(n,{[u.key]:null,[e]:t});if(!r.ok){d({...u,error:r.error});return}d(null),i()},t[32]=a,t[33]=n,t[34]=i,t[35]=p,t[36]=u,t[37]=R):R=t[37];let z=R,B;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(B=function(){d(null)},t[38]=B):B=t[38];let V=B,H=!o,U;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(U=e=>s(!e),t[39]=U):U=t[39];let W=`size-3 transition-transform ${o?``:`rotate-90`}`,G;t[40]===W?G=t[41]:(G=(0,Z.jsx)(na,{className:W,"aria-hidden":!0}),t[40]=W,t[41]=G);let K;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`vQIVHc`})}),t[42]=K):K=t[42];let ee;t[43]===G?ee=t[44]:(ee=(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:[G,K]}),t[43]=G,t[44]=ee);let te;t[45]===h?te=t[46]:(te=(0,Z.jsx)(`code`,{className:`text-xs text-muted-foreground font-mono cursor-text select-text`,onClick:QS,children:h}),t[45]=h,t[46]=te);let ne;t[47]!==ee||t[48]!==te?(ne=(0,Z.jsxs)(js,{className:`flex w-full cursor-pointer items-center justify-between gap-2 px-3 py-2.5 data-[state=open]:border-b border-border`,children:[ee,te]}),t[47]=ee,t[48]=te,t[49]=ne):ne=t[49];let re;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Z.jsx)(`p`,{className:`px-1 pb-2 text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`hSBIG-`})}),t[50]=re):re=t[50];let ie;t[51]!==c||t[52]!==y||t[53]!==z||t[54]!==_||t[55]!==p||t[56]!==x||t[57]!==u||t[58]!==C?(ie=_.length===0&&!c?(0,Z.jsx)(`p`,{className:`px-1 py-1 text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`4c_a6S`})}):_.map(e=>{let t=p[e];return(0,Z.jsx)(Xi,{keyName:e,value:t,declared:Gi(t,Gr(t)),rename:{state:u?.key===e?u:null,onBegin:()=>F(e),onChangeDraft:L,onCommit:z,onCancel:V},badge:null,onCommit:t=>void y(e,t),onChangeType:t=>C(e,t),onRemove:()=>void x(e)},e)}),t[51]=c,t[52]=y,t[53]=z,t[54]=_,t[55]=p,t[56]=x,t[57]=u,t[58]=C,t[59]=ie):ie=t[59];let q;t[60]!==c||t[61]!==N?(q=c?(0,Z.jsx)(Ji,{draft:c,onChangeName:j,onChangeType:D,onChangeValue:k,onCommit:e=>void N(e),onCancel:()=>l(null)}):(0,Z.jsx)(`div`,{className:`mt-1 flex flex-wrap items-center gap-1`,children:(0,Z.jsxs)(Jr,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`add-property-trigger`,onClick:()=>T(),className:`flex items-center gap-1.5 rounded px-2 py-1 font-medium text-sm hover:bg-muted/50 hover:text-foreground`,children:[(0,Z.jsx)(nt,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`G8t9NN`})})]})}),t[60]=c,t[61]=N,t[62]=q):q=t[62];let ae;t[63]!==ie||t[64]!==q?(ae=(0,Z.jsx)(As,{children:(0,Z.jsxs)(`div`,{className:`px-2 py-2`,children:[re,ie,q]})}),t[63]=ie,t[64]=q,t[65]=ae):ae=t[65];let oe;return t[66]!==H||t[67]!==ne||t[68]!==ae?(oe=(0,Z.jsx)(`section`,{className:`rounded-lg border bg-card`,children:(0,Z.jsxs)(Ms,{open:H,onOpenChange:U,children:[ne,ae]})}),t[66]=H,t[67]=ne,t[68]=ae,t[69]=oe):oe=t[69],oe}function QS(e){return e.stopPropagation()}function $S(){let e=(0,$.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(Kd,{className:`size-4 text-muted-foreground`,"aria-hidden":!0}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[t,(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(J,{id:`vQIVHc`})})]}),e[1]=n):n=e[1],n}function eC(e){let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);return t<60?Gc._({id:`xOTzt5`}):t<3600?Gc._({id:`zbymaY`,values:{0:Math.floor(t/60)}}):t<86400?Gc._({id:`optX0N`,values:{0:Math.floor(t/3600)}}):t<86400*7?Gc._({id:`l1l8sj`,values:{0:Math.floor(t/86400)}}):new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function tC(e){return(e.split(`/`).pop()??e).replace(/\.md$/,``)}function nC(e){let t=e.message,n=t.indexOf(`: `),r=n===-1?t:t.slice(0,n),i=n===-1?``:t.slice(n+2);switch(r){case`template-create`:return{Icon:ro,label:Gc._({id:`QR5SP1`}),detail:tC(i)};case`template-edit`:return{Icon:Lo,label:Gc._({id:`-LHLx7`}),detail:tC(i)};case`template-delete`:return{Icon:as,label:Gc._({id:`_gkGSK`}),detail:tC(i)};case`template-rename`:case`template-move`:{let[e,t]=i.split(` -> `);return{Icon:xd,label:Gc._({id:`KPW5WC`}),detail:`${tC(e??``)} → ${tC(t??i)}`}}case`folder-frontmatter-edit`:return{Icon:Kd,label:Gc._({id:`_tekeB`}),detail:``};case`folder-frontmatter-delete`:return{Icon:Kd,label:Gc._({id:`ZWxfrc`}),detail:``};case`folder-create`:return{Icon:Kd,label:Gc._({id:`ZQLDTl`}),detail:``};default:return{Icon:$d,label:r.replace(/-/g,` `),detail:tC(i)}}}function rC(e){return e.contributors.length>0?e.contributors[0].name:e.author===`openknowledge-service`||e.author===`server`?Gc._({id:`B2DrPb`}):e.author||Gc._({id:`Ef7StM`})}function iC(e){let t=(0,$.c)(15),{folderPath:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=[],t[0]=r):r=t[0];let[i,a]=(0,Q.useState)(r),[o,c]=(0,Q.useState)(!0),[l,u]=(0,Q.useState)(!1),d,f;if(t[1]===n?(d=t[2],f=t[3]):(d=()=>{let e=!1,t=async function(){try{let t=await fetch(`/api/history?folder=${encodeURIComponent(n)}&limit=50`);if(e)return;if(!t.ok){u(!0),c(!1);return}let r=await t.json();if(e)return;a(r.entries??[]),u(!1),c(!1)}catch(t){e||(console.warn(`[FolderTimelineCard] failed to load folder timeline:`,t),u(!0),c(!1))}};c(!0),t();let r=ll(t);return()=>{e=!0,r()}},f=[n],t[1]=n,t[2]=d,t[3]=f),(0,Q.useEffect)(d,f),l||!o&&i.length===0)return null;let p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(J,{id:`XJOV1Y`})}),t[4]=p):p=t[4];let m;t[5]===i.length?m=t[6]:(m=i.length>0?(0,Z.jsx)(s,{className:`text-xs`,variant:`secondary`,children:i.length}):null,t[5]=i.length,t[6]=m);let h;t[7]===m?h=t[8]:(h=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border px-3 py-1`,children:[p,m]}),t[7]=m,t[8]=h);let g;t[9]!==i||t[10]!==o?(g=(0,Z.jsx)(`div`,{className:`px-3 py-2.5`,children:o?(0,Z.jsxs)(`div`,{className:`space-y-2`,role:`status`,"aria-busy":`true`,children:[(0,Z.jsx)(Ka,{className:`h-8 w-full`}),(0,Z.jsx)(Ka,{className:`h-8 w-full`})]}):(0,Z.jsx)(`ul`,{className:`space-y-1`,children:i.map(aC)})}),t[9]=i,t[10]=o,t[11]=g):g=t[11];let _;return t[12]!==h||t[13]!==g?(_=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card`,"data-testid":`folder-timeline-card`,children:[h,g]}),t[12]=h,t[13]=g,t[14]=_):_=t[14],_}function aC(e){let{Icon:t,label:n,detail:r}=nC(e);return(0,Z.jsxs)(`li`,{className:`flex items-center gap-2.5 rounded-md px-2 py-1.5 text-sm`,children:[(0,Z.jsx)(t,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":!0}),(0,Z.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[(0,Z.jsx)(`span`,{className:`text-foreground`,children:n}),r?(0,Z.jsx)(`code`,{className:`ml-1.5 font-mono text-xs text-muted-foreground`,children:r}):null]}),(0,Z.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1 text-xs text-muted-foreground`,children:[(0,Z.jsx)(Kf,{className:`size-3`,"aria-hidden":!0}),rC(e)]}),(0,Z.jsx)(`time`,{className:`shrink-0 text-xs text-muted-foreground/80`,dateTime:e.timestamp,title:new Date(e.timestamp).toLocaleString(),children:eC(e.timestamp)})]},e.sha)}function oC(e){let t=e.split(`/`).pop();return t?`${e}/${t}`:null}function sC(e,t){let n=t.get(`${e}/index`);if(n)return n;let r=oC(e);if(r){let e=t.get(r);if(e)return e}return e.split(`/`).pop()??e}function cC(e,t,n){let r=n.get(e);return r&&r!==e?r:t}function lC(e,t){let n=e===``?``:`${e}/`,r=[...t.folderPaths].filter(e=>e.startsWith(n)).map(e=>({path:e,rel:e.slice(n.length)})).filter(e=>e.rel.length>0&&!e.rel.includes(`/`)).map(({path:e,rel:n})=>({kind:`folder`,path:e,name:n,title:sC(e,t.pageTitles)})),i=[...t.pages].filter(e=>e.startsWith(n)).map(e=>({docName:e,rel:e.slice(n.length)})).filter(e=>e.rel.length>0&&!e.rel.includes(`/`)).map(({docName:e,rel:n})=>{let r=t.pageMeta.get(e);return{kind:`file`,path:e,name:n,title:cC(e,n,t.pageTitles),size:r?.size??0,modified:r?.modified??``}}),a=[...r,...i].sort((e,t)=>e.kind===t.kind?e.title.localeCompare(t.title)||e.name.localeCompare(t.name):e.kind===`folder`?-1:1);return{title:sC(e,t.pageTitles),children:a}}function uC(e){let t=(0,$.c)(41),{folderPath:n,state:r,onChange:i,folderConfigHandle:a}=e,[o,c]=(0,Q.useState)(null),[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(!1);if(r.status===`idle`||r.status===`loading`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card px-3 py-2.5 space-y-3`,children:[(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(J,{id:`-QCLWk`})})}),(0,Z.jsx)(Ka,{className:`h-12 w-full`}),(0,Z.jsx)(Ka,{className:`h-12 w-full`})]}),t[0]=e):e=t[0],e}if(r.status===`error`){let{message:e}=r,n;return t[1]===e?n=t[2]:(n=(0,Z.jsx)(`section`,{className:`rounded-lg border border-destructive/30 bg-destructive/5 p-4 text-sm text-destructive`,role:`alert`,children:(0,Z.jsx)(J,{id:`iDZtvM`,values:{message:e}})}),t[1]=e,t[2]=n),n}let p;t[3]===r.data.folder.templates_available?p=t[4]:(p=r.data.folder.templates_available??[],t[3]=r.data.folder.templates_available,t[4]=p);let m=p,h;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(J,{id:`-QCLWk`})}),t[5]=h):h=t[5];let g;t[6]===m.length?g=t[7]:(g=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[h,(0,Z.jsx)(s,{className:`text-xs`,variant:`secondary`,children:m.length})]}),t[6]=m.length,t[7]=g);let _;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsxs)(Jr,{variant:`ghost`,className:`font-mono uppercase`,size:`sm`,onClick:()=>f(!0),children:[(0,Z.jsx)(nt,{className:`size-3.5`,"aria-hidden":!0}),(0,Z.jsx)(J,{id:`G1Gw0v`})]}),t[8]=_):_=t[8];let v;t[9]===g?v=t[10]:(v=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-border px-3 py-1`,children:[g,_]}),t[9]=g,t[10]=v);let y;t[11]===m?y=t[12]:(y=(0,Z.jsx)(`div`,{className:`px-3 py-2.5`,children:m.length===0?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`MZSBsh`})}):(0,Z.jsx)(`ul`,{className:`space-y-1`,children:m.map(e=>(0,Z.jsx)(Ma,{template:e,onCreate:()=>u(e.name),onEdit:()=>Zo(gt(e.source_folder,e.name)),onDelete:()=>c(e),badge:e.scope===`inherited`?(0,Z.jsx)(Wi,{source:e.source_folder,target:`templates/${e.name}.md`}):void 0},e.path))})}),t[11]=m,t[12]=y);let b;t[13]!==v||t[14]!==y?(b=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card`,children:[v,y]}),t[13]=v,t[14]=y,t[15]=b):b=t[15];let x;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(x=e=>{e||c(null)},t[16]=x):x=t[16];let S;t[17]!==o||t[18]!==i?(S=(0,Z.jsx)(qa,{template:o,onOpenChange:x,onDeleted:i}),t[17]=o,t[18]=i,t[19]=S):S=t[19];let C;t[20]===m?C=t[21]:(C=new Set(m.map(dC)),t[20]=m,t[21]=C);let w;t[22]!==n||t[23]!==i?(w=e=>{i(),Zo(gt(n,e))},t[22]=n,t[23]=i,t[24]=w):w=t[24];let T;t[25]!==n||t[26]!==d||t[27]!==C||t[28]!==w?(T=(0,Z.jsx)(Ia,{folderPath:n,existingNames:C,open:d,onOpenChange:f,onCreated:w}),t[25]=n,t[26]=d,t[27]=C,t[28]=w,t[29]=T):T=t[29];let E=l!==null,D;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(D=e=>{e||u(null)},t[30]=D):D=t[30];let O=l??void 0,k;t[31]!==a||t[32]!==n||t[33]!==E||t[34]!==O?(k=(0,Z.jsx)(xh,{open:E,onOpenChange:D,kind:`file`,initialDir:n,initialTemplate:O,folderConfig:a}),t[31]=a,t[32]=n,t[33]=E,t[34]=O,t[35]=k):k=t[35];let A;return t[36]!==T||t[37]!==k||t[38]!==b||t[39]!==S?(A=(0,Z.jsxs)(Z.Fragment,{children:[b,S,T,k]}),t[36]=T,t[37]=k,t[38]=b,t[39]=S,t[40]=A):A=t[40],A}function dC(e){return e.name}function fC(e){let t=(0,$.c)(14),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,containerClassName:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=X(`relative w-full overflow-x-auto subtle-scrollbar`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=X(`w-full caption-bottom text-sm`,n),t[6]=n,t[7]=o);let s;t[8]!==i||t[9]!==o?(s=(0,Z.jsx)(`table`,{"data-slot":`table`,className:o,...i}),t[8]=i,t[9]=o,t[10]=s):s=t[10];let c;return t[11]!==a||t[12]!==s?(c=(0,Z.jsx)(`div`,{"data-slot":`table-container`,className:a,children:s}),t[11]=a,t[12]=s,t[13]=c):c=t[13],c}function pC(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(`[&_tr]:border-b`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`thead`,{"data-slot":`table-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function mC(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(`[&_tr:last-child]:border-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`tbody`,{"data-slot":`table-body`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function hC(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,noHover:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=(i===void 0?!1:i)&&`hover:bg-transparent`,o;t[4]!==n||t[5]!==a?(o=X(`hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors`,a,n),t[4]=n,t[5]=a,t[6]=o):o=t[6];let s;return t[7]!==r||t[8]!==o?(s=(0,Z.jsx)(`tr`,{"data-slot":`table-row`,className:o,...r}),t[7]=r,t[8]=o,t[9]=s):s=t[9],s}function gC(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,scope:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`col`:i,o;t[4]===n?o=t[5]:(o=X(`font-mono uppercase text-xs text-muted-foreground h-10 px-4 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]`,n),t[4]=n,t[5]=o);let s;return t[6]!==r||t[7]!==a||t[8]!==o?(s=(0,Z.jsx)(`th`,{"data-slot":`table-head`,scope:a,className:o,...r}),t[6]=r,t[7]=a,t[8]=o,t[9]=s):s=t[9],s}function _C(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(`py-3 px-4 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`td`,{"data-slot":`table-cell`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function vC(e){if(!e)return`—`;let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/6e4);if(r<1)return Gc._({id:`xOTzt5`});if(r<60)return Gc._({id:`NRSLBe`,values:{diffMin:r}});let i=Math.floor(r/60);if(i<24)return Gc._({id:`hDKtoF`,values:{diffHrs:i}});let a=Math.floor(i/24);return a<30?Gc._({id:`QDZbvN`,values:{diffDays:a}}):t.toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`numeric`})}function yC(e,t,n){return[...e].sort((e,r)=>{if(e.kind!==r.kind)return e.kind===`folder`?-1:1;let i=0;switch(t){case`name`:i=e.title.localeCompare(r.title)||e.name.localeCompare(r.name);break;case`modified`:{let t=e.kind===`file`?e.modified:``,n=r.kind===`file`?r.modified:``;i=t.localeCompare(n);break}}return n===`asc`?i:-i})}function bC(e){let t=(0,$.c)(10),{label:n,sortKey:r,activeKey:i,activeDir:a,onSort:o}=e,s=i===r,c;t[0]!==o||t[1]!==r?(c=()=>o(r),t[0]=o,t[1]=r,t[2]=c):c=t[2];let l;t[3]!==a||t[4]!==s?(l=s?a===`asc`?(0,Z.jsx)(Ci,{className:`ml-1 size-3`}):(0,Z.jsx)(Ii,{className:`ml-1 size-3`}):(0,Z.jsx)(Sd,{className:`ml-1 size-3 text-muted-foreground/50`}),t[3]=a,t[4]=s,t[5]=l):l=t[5];let u;return t[6]!==n||t[7]!==c||t[8]!==l?(u=(0,Z.jsxs)(Jr,{variant:`ghost`,size:`sm`,className:`-ml-3 h-8 uppercase font-mono`,onClick:c,children:[n,l]}),t[6]=n,t[7]=c,t[8]=l,t[9]=u):u=t[9],u}function xC(e){let t=(0,$.c)(96),{folderPath:n}=e,{_:r}=kt(),{folderPaths:i,loading:a,pages:o,pageTitles:s,pageMeta:c}=ia(),l=vo(n),{state:u,refresh:d}=l,[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(`name`),[g,_]=(0,Q.useState)(`asc`);if(a){let e;t[0]===r?e=t[1]:(e=r({id:`X9VpsP`}),t[0]=r,t[1]=e);let n;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(Ka,{className:`size-5 rounded`}),(0,Z.jsx)(Ka,{className:`h-7 w-48`})]}),(0,Z.jsx)(Ka,{className:`h-9 w-20 rounded-md`})]}),t[2]=n):n=t[2];let i;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(Ka,{className:`h-4 w-16`}),t[3]=i):i=t[3];let a;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsxs)(`div`,{className:`mx-auto flex w-full max-w-4xl flex-col gap-6 px-6 py-8`,children:[n,(0,Z.jsxs)(`div`,{className:`rounded-lg border`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-4 border-b px-4 py-3`,children:[i,(0,Z.jsx)(`div`,{className:`ml-auto`,children:(0,Z.jsx)(Ka,{className:`h-4 w-20`})})]}),[`a`,`b`,`c`,`d`].map(wC)]})]}),t[4]=a):a=t[4];let o;return t[5]===e?o=t[6]:(o=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-start overflow-y-auto subtle-scrollbar`,role:`status`,"aria-busy":`true`,"aria-label":e,children:a}),t[5]=e,t[6]=o),o}let v,y,b,x,S,C,w,T,E,D,O;if(t[7]!==r||t[8]!==u||t[9]!==l||t[10]!==n||t[11]!==i||t[12]!==c||t[13]!==s||t[14]!==o||t[15]!==d||t[16]!==g||t[17]!==m){let e=lC(n,{pages:o,pageTitles:s,pageMeta:c,folderPaths:i}),a=yC(e.children,m,g),f=e.title||(n===``?r({id:`3aeN7X`}):e.title),k;t[29]===m?k=t[30]:(k=function(e){e===m?_(CC):(h(e),_(`asc`))},t[29]=m,t[30]=k);let A=k;O=`flex min-h-0 flex-1 items-start overflow-y-auto subtle-scrollbar`,C=`mx-auto flex w-full max-w-4xl flex-col gap-6 px-6 py-8`;let j;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Z.jsx)(Ro,{className:`size-5 text-muted-foreground`}),t[31]=j):j=t[31];let M=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[j,(0,Z.jsx)(`h1`,{className:`text-2xl font-light tracking-tight`,children:f})]}),N;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsxs)(Jr,{onClick:()=>p(!0),children:[(0,Z.jsx)(nt,{className:`size-4`}),(0,Z.jsx)(J,{id:`isRobC`})]}),t[32]=N):N=t[32],t[33]===M?w=t[34]:(w=(0,Z.jsx)(`div`,{className:`flex flex-col gap-6`,children:(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[M,N]})}),t[33]=M,t[34]=w),t[35]!==u||t[36]!==n||t[37]!==d?(T=(0,Z.jsx)(ZS,{folderPath:n,state:u,onChange:d}),t[35]=u,t[36]=n,t[37]=d,t[38]=T):T=t[38],t[39]!==u||t[40]!==l||t[41]!==n||t[42]!==d?(E=(0,Z.jsx)(uC,{folderPath:n,state:u,onChange:d,folderConfigHandle:l}),t[39]=u,t[40]=l,t[41]=n,t[42]=d,t[43]=E):E=t[43],t[44]===n?D=t[45]:(D=(0,Z.jsx)(iC,{folderPath:n}),t[44]=n,t[45]=D),S=`rounded-lg border`,y=fC;let P=m===`name`?g===`asc`?`ascending`:`descending`:`none`,F;t[46]===r?F=t[47]:(F=r({id:`6YtxFj`}),t[46]=r,t[47]=F);let I;t[48]!==A||t[49]!==g||t[50]!==m||t[51]!==F?(I=(0,Z.jsx)(bC,{label:F,sortKey:`name`,activeKey:m,activeDir:g,onSort:A}),t[48]=A,t[49]=g,t[50]=m,t[51]=F,t[52]=I):I=t[52];let L;t[53]!==P||t[54]!==I?(L=(0,Z.jsx)(gC,{"aria-sort":P,children:I}),t[53]=P,t[54]=I,t[55]=L):L=t[55];let R=m===`modified`?g===`asc`?`ascending`:`descending`:`none`,z;t[56]===r?z=t[57]:(z=r({id:`tgWuMB`}),t[56]=r,t[57]=z);let B;t[58]!==A||t[59]!==g||t[60]!==m||t[61]!==z?(B=(0,Z.jsx)(bC,{label:z,sortKey:`modified`,activeKey:m,activeDir:g,onSort:A}),t[58]=A,t[59]=g,t[60]=m,t[61]=z,t[62]=B):B=t[62];let V;t[63]!==R||t[64]!==B?(V=(0,Z.jsx)(gC,{className:`w-32`,"aria-sort":R,children:B}),t[63]=R,t[64]=B,t[65]=V):V=t[65],t[66]!==L||t[67]!==V?(x=(0,Z.jsx)(pC,{children:(0,Z.jsxs)(hC,{children:[L,V]})}),t[66]=L,t[67]=V,t[68]=x):x=t[68],v=mC,b=a.length?a.map(SC):(0,Z.jsx)(hC,{children:(0,Z.jsx)(_C,{colSpan:2,className:`h-24 text-center text-muted-foreground`,children:(0,Z.jsx)(J,{id:`Pkw7J9`})})}),t[7]=r,t[8]=u,t[9]=l,t[10]=n,t[11]=i,t[12]=c,t[13]=s,t[14]=o,t[15]=d,t[16]=g,t[17]=m,t[18]=v,t[19]=y,t[20]=b,t[21]=x,t[22]=S,t[23]=C,t[24]=w,t[25]=T,t[26]=E,t[27]=D,t[28]=O}else v=t[18],y=t[19],b=t[20],x=t[21],S=t[22],C=t[23],w=t[24],T=t[25],E=t[26],D=t[27],O=t[28];let k;t[69]!==v||t[70]!==b?(k=(0,Z.jsx)(v,{children:b}),t[69]=v,t[70]=b,t[71]=k):k=t[71];let A;t[72]!==y||t[73]!==k||t[74]!==x?(A=(0,Z.jsxs)(y,{children:[x,k]}),t[72]=y,t[73]=k,t[74]=x,t[75]=A):A=t[75];let j;t[76]!==A||t[77]!==S?(j=(0,Z.jsx)(`div`,{className:S,children:A}),t[76]=A,t[77]=S,t[78]=j):j=t[78];let M;t[79]!==j||t[80]!==C||t[81]!==w||t[82]!==T||t[83]!==E||t[84]!==D?(M=(0,Z.jsxs)(`div`,{className:C,children:[w,T,E,D,j]}),t[79]=j,t[80]=C,t[81]=w,t[82]=T,t[83]=E,t[84]=D,t[85]=M):M=t[85];let N;t[86]!==M||t[87]!==O?(N=(0,Z.jsx)(`div`,{className:O,children:M}),t[86]=M,t[87]=O,t[88]=N):N=t[88];let P;t[89]!==f||t[90]!==l||t[91]!==n?(P=(0,Z.jsx)(xh,{open:f,onOpenChange:p,kind:`file`,initialDir:n,folderConfig:l,suggestedName:`index`}),t[89]=f,t[90]=l,t[91]=n,t[92]=P):P=t[92];let F;return t[93]!==N||t[94]!==P?(F=(0,Z.jsxs)(Z.Fragment,{children:[N,P]}),t[93]=N,t[94]=P,t[95]=F):F=t[95],F}function SC(e){return(0,Z.jsxs)(hC,{children:[(0,Z.jsx)(_C,{children:(0,Z.jsxs)(`a`,{href:El(e.path),className:`flex items-center gap-2 rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:[e.kind===`folder`?(0,Z.jsx)(Jd,{className:`size-4 shrink-0 text-muted-foreground`}):(0,Z.jsx)(te,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.title})]})}),(0,Z.jsx)(_C,{className:`text-muted-foreground`,children:e.kind===`file`?vC(e.modified):`—`})]},e.path)}function CC(e){return e===`asc`?`desc`:`asc`}function wC(e){return(0,Z.jsxs)(`div`,{className:`flex items-center gap-3 border-b px-4 py-3 last:border-b-0`,children:[(0,Z.jsx)(Ka,{className:`size-4 rounded`}),(0,Z.jsx)(Ka,{className:`h-4 w-40`}),(0,Z.jsx)(`div`,{className:`ml-auto`,children:(0,Z.jsx)(Ka,{className:`h-4 w-16`})})]},e)}function TC(e){let t=(0,$.c)(24),{docName:n,size:r,limit:i,backNav:a}=e,o=a!==void 0,s=(0,Q.useRef)(null),c=(0,Q.useRef)(null),l,u;t[0]===o?(l=t[1],u=t[2]):(l=()=>{o?s.current?.focus():c.current?.focus()},u=[o],t[0]=o,t[1]=l,t[2]=u),(0,Q.useEffect)(l,u);let d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(`div`,{className:`flex size-16 items-center justify-center rounded-full border bg-muted/40 text-muted-foreground`,children:(0,Z.jsx)(Ud,{className:`size-9`,"aria-hidden":`true`})}),t[3]=d):d=t[3];let f=o?void 0:-1,p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(J,{id:`P3hnm0`}),t[4]=p):p=t[4];let m;t[5]===f?m=t[6]:(m=(0,Z.jsx)(`h2`,{ref:c,id:`large-file-title`,tabIndex:f,className:`text-2xl font-light text-balance outline-none`,children:p}),t[5]=f,t[6]=m);let h;t[7]===r?h=t[8]:(h=Fr(r),t[7]=r,t[8]=h);let g;t[9]===i?g=t[10]:(g=Fr(i),t[9]=i,t[10]=g);let _;t[11]!==n||t[12]!==h||t[13]!==g?(_=(0,Z.jsx)(`p`,{className:`max-w-md text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`GJH-AT`,values:{0:h,1:g,docName:n}})}),t[11]=n,t[12]=h,t[13]=g,t[14]=_):_=t[14];let v;t[15]!==m||t[16]!==_?(v=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[m,_]}),t[15]=m,t[16]=_,t[17]=v):v=t[17];let y;t[18]!==a||t[19]!==o?(y=o?(0,Z.jsxs)(Jr,{ref:s,variant:`default`,onClick:()=>a.onNavigateBack(a.previousDocName),children:[(0,Z.jsx)(Ni,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`CKyk7Q`})]}):null,t[18]=a,t[19]=o,t[20]=y):y=t[20];let b;return t[21]!==v||t[22]!==y?(b=(0,Z.jsxs)(`div`,{role:`status`,"aria-labelledby":`large-file-title`,"data-slot":`large-file-editor-state`,className:`flex h-full flex-col items-center justify-center gap-8 p-8 text-center`,children:[d,v,y]}),t[21]=v,t[22]=y,t[23]=b):b=t[23],b}function EC(e){let t=(0,$.c)(8),{docName:n}=e,[r,i]=(0,Q.useState)(DC),a,o;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>ee(e=>{i(t=>{if(t.has(e))return t;let n=new Set(t);return n.add(e),n})}),o=[],t[0]=a,t[1]=o):(a=t[0],o=t[1]),(0,Q.useEffect)(a,o),!r.has(n))return null;let s;t[2]===n?s=t[3]:(s=function(){Et(n)?.abort(),i(e=>{if(!e.has(n))return e;let t=new Set(e);return t.delete(n),t})},t[2]=n,t[3]=s);let c=s,l;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`A67Uwj`})}),t[4]=l):l=t[4];let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(J,{id:`dEgA5A`}),t[5]=u):u=t[5];let d;return t[6]===c?d=t[7]:(d=(0,Z.jsxs)(`div`,{className:`absolute inset-x-0 bottom-8 z-20 flex justify-center text-xs text-muted-foreground`,children:[l,(0,Z.jsx)(Jr,{variant:`link`,size:`sm`,className:`h-auto px-2 py-0 text-xs`,onClick:c,children:u})]}),t[6]=c,t[7]=d),d}function DC(){return new Set}function OC(e){let t=(0,$.c)(20),{nav:n}=e,{state:r,refetch:i}=Xr(n),a=(0,Q.useRef)(null),o=n.branch,s,c;t[0]===r.phase?(s=t[1],c=t[2]):(s=()=>{r.phase===`resolved`&&a.current?.querySelector(`button`)?.focus()},c=[r.phase],t[0]=r.phase,t[1]=s,t[2]=c),(0,Q.useEffect)(s,c);let l;t[3]===n.path?l=t[4]:(l=function(){window.location.hash=vl(Qr(n.path))},t[3]=n.path,t[4]=l);let u=l,d;t[5]!==o||t[6]!==n.kind?(d=function(e){$r.arm({kind:n.kind,path:e,branch:o}),window.location.hash=n.kind===`folder`?vl(e):El(e)},t[5]=o,t[6]=n.kind,t[7]=d):d=t[7];let f=d,p=r.phase===`pending`?`polite`:void 0,m=r.phase===`resolved`?r.resolution.verdict:void 0,h=r.phase===`pending`?`flex h-full flex-col items-center justify-center gap-3 p-8 text-center text-sm text-muted-foreground`:`flex h-full flex-col items-center justify-center gap-6 p-8 text-center`,g;t[8]!==u||t[9]!==n||t[10]!==f||t[11]!==i||t[12]!==r?(g=(0,Z.jsx)(ti,{nav:n,state:r,onBrowseFolder:u,onOpenRenamed:f,onEnableAutoSync:u,onSyncCompleted:i}),t[8]=u,t[9]=n,t[10]=f,t[11]=i,t[12]=r,t[13]=g):g=t[13];let _;return t[14]!==r.phase||t[15]!==p||t[16]!==m||t[17]!==h||t[18]!==g?(_=(0,Z.jsx)(`div`,{ref:a,role:`status`,"aria-live":p,"data-testid":`share-receive-miss-panel`,"data-phase":r.phase,"data-verdict":m,className:h,children:g}),t[14]=r.phase,t[15]=p,t[16]=m,t[17]=h,t[18]=g,t[19]=_):_=t[19],_}function kC(e){let t=(0,$.c)(24),{fileName:n,text:r}=e,i,a,o,s;if(t[0]!==r){let e=fn(r).body;s=ji,i=tt,a=!1,o=li().parseWithFallback(e),t[0]=r,t[1]=i,t[2]=a,t[3]=o,t[4]=s}else i=t[1],a=t[2],o=t[3],s=t[4];let c;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(c={attributes:{class:`pt-4 pb-4`}},t[5]=c):c=t[5];let l;t[6]!==i||t[7]!==a||t[8]!==o?(l={extensions:i,editable:a,content:o,editorProps:c},t[6]=i,t[7]=a,t[8]=o,t[9]=l):l=t[9];let u;t[10]===r?u=t[11]:(u=[r],t[10]=r,t[11]=u);let d=s(l,u),[f]=(0,Q.useState)(AC),p=(0,Q.useRef)(null),m,h;t[12]===f?(m=t[13],h=t[14]):(m=()=>{let e=p.current;if(e)return e.appendChild(f),()=>{f.parentNode===e&&e.removeChild(f)}},h=[f],t[12]=f,t[13]=m,t[14]=h),(0,Q.useLayoutEffect)(m,h);let g;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(`div`,{className:`editor-doc-scroll min-h-0 flex-1 overflow-auto`,children:(0,Z.jsx)(`div`,{className:`tiptap-editor`,children:(0,Z.jsx)(`div`,{ref:p,style:{display:`contents`}})})}),t[15]=g):g=t[15];let _;t[16]===d?_=t[17]:(_=(0,Z.jsx)(xi,{editor:d,className:`tiptap-editor-portal-content h-full`}),t[16]=d,t[17]=_);let v;t[18]!==f||t[19]!==_?(v=(0,Ed.createPortal)(_,f),t[18]=f,t[19]=_,t[20]=v):v=t[20];let y;return t[21]!==n||t[22]!==v?(y=(0,Z.jsxs)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":n,"data-skill-markdown-viewer":``,"data-skill-markdown-viewer-state":`loaded`,children:[g,v]}),t[21]=n,t[22]=v,t[23]=y):y=t[23],y}function AC(){let e=document.createElement(`div`);return e.style.display=`contents`,e}var jC=`data-skill-markdown`;function MC(e){let t=(0,$.c)(12),{scope:n,name:r,path:i,fileName:a}=e,o;t[0]!==r||t[1]!==i||t[2]!==n?(o={loadText:e=>Tc({scope:n,name:r,path:i},e)},t[0]=r,t[1]=i,t[2]=n,t[3]=o):o=t[3];let s=Qb(o);if(s.status===`loading`){let e;return t[4]===a?e=t[5]:(e=(0,Z.jsx)($b,{fileName:a,dataAttr:jC}),t[4]=a,t[5]=e),e}if(s.status===`error`){let e;return t[6]!==s.message||t[7]!==a?(e=(0,Z.jsx)(ex,{fileName:a,dataAttr:jC,message:s.message}),t[6]=s.message,t[7]=a,t[8]=e):e=t[8],e}let c;return t[9]!==s.content||t[10]!==a?(c=(0,Z.jsx)(kC,{fileName:a,text:s.content}),t[9]=s.content,t[10]=a,t[11]=c):c=t[11],c}var NC=new Set([`md`,`mdx`]);function PC(e){let t=(0,$.c)(19),{scope:n,name:r,path:i}=e,a;t[0]===i?a=t[1]:(a=i.split(`/`).pop()??i,t[0]=i,t[1]=a);let o=a,s=o.lastIndexOf(`.`),c,l;if(t[2]!==s||t[3]!==o?(c=s>=0?o.slice(s+1).toLowerCase():``,l=NC.has(c),t[2]=s,t[3]=o,t[4]=c,t[5]=l):(c=t[4],l=t[5]),l){let e;return t[6]!==o||t[7]!==r||t[8]!==i||t[9]!==n?(e=(0,Z.jsx)(MC,{scope:n,name:r,path:i,fileName:o}),t[6]=o,t[7]=r,t[8]=i,t[9]=n,t[10]=e):e=t[10],e}let u;t[11]!==r||t[12]!==i||t[13]!==n?(u=e=>Tc({scope:n,name:r,path:i},e),t[11]=r,t[12]=i,t[13]=n,t[14]=u):u=t[14];let d;return t[15]!==c||t[16]!==o||t[17]!==u?(d=(0,Z.jsx)(rx,{fileName:o,extension:c,loadText:u}),t[15]=c,t[16]=o,t[17]=u,t[18]=d):d=t[18],d}function FC(e){let t=null,n=()=>(t===null&&(t=e(),t.catch(()=>{})),t),r=(0,Q.lazy)(n);return r.preload=n,r}var IC=FC(()=>n(()=>import(`./SettingsDialogBody-DLKGYz4m.js`).then(e=>({default:e.SettingsDialogBody})),__vite__mapDeps([79,1,80,13,7,16,34,10,3,11,36,37,55,40,56,6,59,2,44,45,46,47,48,49,50,51,52,53,54,21,12,57,58,39,33,35,20,15,4,60,17,61,62,19,63,64,65,66,32,38,67,68,69,70,71,72,73,74,81,82,18,83,84,85,86,31,87,88,76,89,42,90,14]),import.meta.url));function LC(e){let t=(0,$.c)(9),{error:n}=e,{_:r}=kt(),i;t[0]!==r||t[1]!==n?(i=n instanceof Error&&/dynamically imported module|Failed to fetch/i.test(n.message)?r({id:`Y8ViJx`}):r({id:`3h5zMp`}),t[0]=r,t[1]=n,t[2]=i):i=t[2];let a=i,o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(`h3`,{id:`settings-body-error-title`,className:`font-heading text-base leading-none font-medium`,children:(0,Z.jsx)(J,{id:`hwFOFD`})}),t[3]=o):o=t[3];let s;t[4]===a?s=t[5]:(s=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[o,(0,Z.jsx)(`p`,{className:`max-w-xs text-sm text-muted-foreground`,children:a})]}),t[4]=a,t[5]=s);let c;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(Jr,{variant:`default`,onClick:RC,children:(0,Z.jsx)(J,{id:`HpK_8d`})}),t[6]=c):c=t[6];let l;return t[7]===s?l=t[8]:(l=(0,Z.jsxs)(`div`,{role:`alert`,"aria-labelledby":`settings-body-error-title`,"data-slot":`settings-body-error-boundary`,className:`flex h-full flex-col items-center justify-center gap-5 p-8 text-center`,children:[s,c]}),t[7]=s,t[8]=l),l}function RC(){return window.location.reload()}function zC(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(h,{fallbackRender:VC,onError:BC,children:n}),t[0]=n,t[1]=r),r}function BC(e,t){console.error(`[SettingsDialogErrorBoundary] rendered fallback for Settings body`,e,t.componentStack)}function VC(e){return(0,Z.jsx)(LC,{...e})}function HC(e){return`https://github.com/inkeep/open-knowledge/releases/tag/v${encodeURIComponent(e)}`}function UC(e){let t=(0,$.c)(104),{open:n,onOpenChange:r}=e,{_:i}=kt(),{collabUrl:a}=Ye(),{userBinding:o,userSynced:s,okignoreBinding:c,okignoreSynced:l}=au(),{desktopPresent:u}=Eo(),[d,f]=(0,Q.useState)(`preferences`),p,m;t[0]===n?(p=t[1],m=t[2]):(p=()=>{n&&f(`preferences`)},m=[n],t[0]=n,t[1]=p,t[2]=m),(0,Q.useEffect)(p,m);let h=a!==null,g=typeof window<`u`&&window.okDesktop!=null,_;t[3]===i?_=t[4]:(_=i({id:`7PzzBU`}),t[3]=i,t[4]=_);let v;t[5]===i?v=t[6]:(v=i({id:`Q6hhn8`}),t[5]=i,t[6]=v);let y;t[7]===v?y=t[8]:(y={id:`preferences`,label:v},t[7]=v,t[8]=y);let b;t[9]===i?b=t[10]:(b=i({id:`4KmEoC`}),t[9]=i,t[10]=b);let x;t[11]===b?x=t[12]:(x={id:`hotkeys`,label:b},t[11]=b,t[12]=x);let S;t[13]===i?S=t[14]:(S=i({id:`AeXO77`}),t[13]=i,t[14]=S);let C;t[15]===S?C=t[16]:(C={id:`account`,label:S},t[15]=S,t[16]=C);let w;t[17]===i?w=t[18]:(w=g?[{id:`ai-tools`,label:i({id:`_5qBNl`})}]:[],t[17]=i,t[18]=w);let T;t[19]!==w||t[20]!==y||t[21]!==x||t[22]!==C?(T=[y,x,C,...w],t[19]=w,t[20]=y,t[21]=x,t[22]=C,t[23]=T):T=t[23];let E;t[24]!==T||t[25]!==_?(E={id:`user`,label:_,enabled:!0,items:T},t[24]=T,t[25]=_,t[26]=E):E=t[26];let D;t[27]===i?D=t[28]:(D=i({id:`ZWyHmq`}),t[27]=i,t[28]=D);let O;t[29]===i?O=t[30]:(O=i({id:`Nu4DdT`}),t[29]=i,t[30]=O);let k;t[31]===O?k=t[32]:(k={id:`sync`,label:O},t[31]=O,t[32]=k);let A;t[33]===i?A=t[34]:(A=i({id:`A1taO8`}),t[33]=i,t[34]=A);let j;t[35]===A?j=t[36]:(j={id:`search`,label:A},t[35]=A,t[36]=j);let M,N;t[37]===i?(M=t[38],N=t[39]):(M=g?[{id:`terminal`,label:i({id:`ALhMYW`})}]:[],N=g?[{id:`project-ai-tools`,label:i({id:`crqzW5`})}]:[],t[37]=i,t[38]=M,t[39]=N);let P;t[40]===i?P=t[41]:(P=i({id:`iTylMl`}),t[40]=i,t[41]=P);let F;t[42]===P?F=t[43]:(F={id:`project-templates`,label:P},t[42]=P,t[43]=F);let I;t[44]===i?I=t[45]:(I=i({id:`PCSkw2`}),t[44]=i,t[45]=I);let L;t[46]===I?L=t[47]:(L={id:`skills`,label:I},t[46]=I,t[47]=L);let R;t[48]===i?R=t[49]:(R=i({id:`3zyg_A`}),t[48]=i,t[49]=R);let z;t[50]===R?z=t[51]:(z={id:`okignore`,label:R},t[50]=R,t[51]=z);let B;t[52]===i?B=t[53]:(B=i({id:`cs4mps`}),t[52]=i,t[53]=B);let V;t[54]===B?V=t[55]:(V={id:`sharing`,label:B},t[54]=B,t[55]=V);let H;t[56]!==k||t[57]!==j||t[58]!==M||t[59]!==N||t[60]!==F||t[61]!==L||t[62]!==z||t[63]!==V?(H=[k,j,...M,...N,F,L,z,V],t[56]=k,t[57]=j,t[58]=M,t[59]=N,t[60]=F,t[61]=L,t[62]=z,t[63]=V,t[64]=H):H=t[64];let U;t[65]!==h||t[66]!==D||t[67]!==H?(U={id:`project`,label:D,enabled:h,items:H},t[65]=h,t[66]=D,t[67]=H,t[68]=U):U=t[68];let W;t[69]===i?W=t[70]:(W=i({id:`nbfdhU`}),t[69]=i,t[70]=W);let G;t[71]!==i||t[72]!==u?(G=[],t[71]=i,t[72]=u,t[73]=G):G=t[73];let K;t[74]!==W||t[75]!==G?(K={id:`integrations`,label:W,enabled:!0,items:G},t[74]=W,t[75]=G,t[76]=K):K=t[76];let ee;t[77]!==E||t[78]!==U||t[79]!==K?(ee=[E,U,K],t[77]=E,t[78]=U,t[79]=K,t[80]=ee):ee=t[80];let te=ee,ne;t[81]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Z.jsx)(Ps,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`Tz0i8g`})}),t[81]=ne):ne=t[81];let re;t[82]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Z.jsx)(Ns,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`RDrXh4`})}),t[82]=re):re=t[82];let ie;t[83]!==d||t[84]!==te?(ie=(0,Z.jsx)(WC,{groups:te,activeId:d,onSelect:f}),t[83]=d,t[84]=te,t[85]=ie):ie=t[85];let q;t[86]===i?q=t[87]:(q=i({id:`OXb_Df`}),t[86]=i,t[87]=q);let ae;t[88]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,Z.jsx)(qC,{}),t[88]=ae):ae=t[88];let oe=s?o:null,se;t[89]!==d||t[90]!==c||t[91]!==l||t[92]!==oe?(se=(0,Z.jsx)(zC,{children:(0,Z.jsx)(Q.Suspense,{fallback:ae,children:(0,Z.jsx)(IC,{activeId:d,userBinding:oe,okignoreBinding:c,okignoreSynced:l})})}),t[89]=d,t[90]=c,t[91]=l,t[92]=oe,t[93]=se):se=t[93];let ce;t[94]!==q||t[95]!==se?(ce=(0,Z.jsx)(`section`,{"aria-label":q,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain subtle-scrollbar p-6`,tabIndex:0,children:se}),t[94]=q,t[95]=se,t[96]=ce):ce=t[96];let le;t[97]!==ie||t[98]!==ce?(le=(0,Z.jsxs)(Fs,{className:`flex h-[700px] max-h-[calc(100dvh-4rem)] w-[900px] max-w-[calc(100%-2rem)] flex-col gap-0 overflow-hidden p-0 sm:grid sm:grid-cols-[220px_1fr] sm:max-w-[min(900px,calc(100%-2rem))]`,"data-testid":`settings-dialog`,children:[ne,re,ie,ce]}),t[97]=ie,t[98]=ce,t[99]=le):le=t[99];let ue;return t[100]!==r||t[101]!==n||t[102]!==le?(ue=(0,Z.jsx)(zs,{open:n,onOpenChange:r,children:le}),t[100]=r,t[101]=n,t[102]=le,t[103]=ue):ue=t[103],ue}function WC(e){let t=(0,$.c)(13),{groups:n,activeId:r,onSelect:i}=e,{_:a}=kt(),o;t[0]===a?o=t[1]:(o=a({id:`y1t8bQ`}),t[0]=a,t[1]=o);let s;if(t[2]!==r||t[3]!==n||t[4]!==i){let e;t[6]!==r||t[7]!==i?(e=e=>(0,Z.jsx)(KC,{group:e,activeId:r,onSelect:i},e.id),t[6]=r,t[7]=i,t[8]=e):e=t[8],s=n.map(e),t[2]=r,t[3]=n,t[4]=i,t[5]=s}else s=t[5];let c;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(GC,{}),t[9]=c):c=t[9];let l;return t[10]!==o||t[11]!==s?(l=(0,Z.jsxs)(`nav`,{"aria-label":o,className:`flex shrink-0 gap-x-3 overflow-x-auto overscroll-contain subtle-scrollbar scroll-fade-mask-x-max-sm border-b bg-muted/30 px-3 py-2 max-sm:pt-10 sm:h-full sm:flex-col sm:gap-0 sm:overflow-x-visible sm:overflow-y-auto sm:border-r sm:border-b-0 sm:py-4`,children:[s,c]}),t[10]=o,t[11]=s,t[12]=l):l=t[12],l}function GC(){let e=(0,$.c)(4),t=typeof window<`u`?window.okDesktop??null:null,n=t?.appVersion;if(!t||!n)return null;let r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=HC(n),e[0]=r):r=e[0];let i=r,a;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsxs)(`p`,{className:`whitespace-nowrap font-mono text-xs text-muted-foreground/70`,"data-testid":`settings-sidebar-version`,children:[`v`,n]}),e[1]=a):a=e[1];let o;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>{t.shell.openExternal(i)},e[2]=o):o=e[2];let s;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsxs)(`div`,{className:`ml-auto shrink-0 px-2 sm:ml-0 sm:mt-auto sm:pt-3`,children:[a,(0,Z.jsxs)(`button`,{type:`button`,onClick:o,"data-testid":`settings-sidebar-release-notes`,className:X(`mt-0.5 inline-flex items-center gap-1 whitespace-nowrap rounded text-xs text-muted-foreground transition-colors hover:text-foreground`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`),children:[(0,Z.jsx)(J,{id:`_PACVa`}),(0,Z.jsx)(Hi,{className:`size-3`,"aria-hidden":`true`})]})]}),e[3]=s):s=e[3],s}function KC(e){let t=(0,$.c)(28),{group:n,activeId:r,onSelect:i}=e;if(n.items.length===0)return null;let a=`settings-group-${n.id}`,o=`${a}-caption`,s=n.enabled?void 0:o,c=n.enabled?`text-muted-foreground/80`:`text-muted-foreground/50`,l;t[0]===c?l=t[1]:(l=X(`shrink-0 whitespace-nowrap px-2 text-xs font-semibold uppercase tracking-wide font-mono sm:mb-1`,c),t[0]=c,t[1]=l);let u;t[2]!==n.label||t[3]!==a||t[4]!==s||t[5]!==l?(u=(0,Z.jsx)(`h3`,{id:a,"aria-describedby":s,className:l,children:n.label}),t[2]=n.label,t[3]=a,t[4]=s,t[5]=l,t[6]=u):u=t[6];let d;t[7]!==o||t[8]!==n.enabled?(d=n.enabled?null:(0,Z.jsx)(`p`,{id:o,className:`px-2 text-xs italic text-muted-foreground/60 sm:mb-1`,children:(0,Z.jsx)(J,{id:`JWsZlx`})}),t[7]=o,t[8]=n.enabled,t[9]=d):d=t[9];let f;if(t[10]!==r||t[11]!==o||t[12]!==n.enabled||t[13]!==n.items||t[14]!==i){let e;t[16]!==r||t[17]!==o||t[18]!==n.enabled||t[19]!==i?(e=e=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`button`,{type:`button`,"aria-current":r===e.id?`page`:void 0,"aria-disabled":n.enabled?void 0:!0,"aria-describedby":n.enabled?void 0:o,tabIndex:n.enabled?0:-1,disabled:!n.enabled,onClick:()=>n.enabled&&i(e.id),"data-testid":`settings-sidebar-item-${e.id}`,className:X(`w-auto whitespace-nowrap rounded px-2 py-1.5 text-left text-sm transition-colors sm:w-full`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,`disabled:cursor-not-allowed disabled:opacity-50`,r===e.id&&n.enabled?`bg-accent text-accent-foreground`:`hover:bg-accent/50`),children:e.label})},e.id),t[16]=r,t[17]=o,t[18]=n.enabled,t[19]=i,t[20]=e):e=t[20],f=n.items.map(e),t[10]=r,t[11]=o,t[12]=n.enabled,t[13]=n.items,t[14]=i,t[15]=f}else f=t[15];let p;t[21]!==a||t[22]!==f?(p=(0,Z.jsx)(`ul`,{"aria-labelledby":a,className:`flex gap-1 sm:block sm:space-y-0.5`,children:f}),t[21]=a,t[22]=f,t[23]=p):p=t[23];let m;return t[24]!==u||t[25]!==d||t[26]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 sm:mb-4 sm:block`,children:[u,d,p]}),t[24]=u,t[25]=d,t[26]=p,t[27]=m):m=t[27],m}function qC(){let e=(0,$.c)(4),t,n,r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`GsBUCk`})}),n=(0,Z.jsx)(Ka,{className:`h-5 w-32`}),r=(0,Z.jsx)(Ka,{className:`h-4 w-64`}),e[0]=t,e[1]=n,e[2]=r):(t=e[0],n=e[1],r=e[2]);let i;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"aria-busy":`true`,className:`space-y-3`,"data-testid":`settings-content-skeleton`,children:[t,n,r,(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(Ka,{className:`h-9 w-full`}),(0,Z.jsx)(Ka,{className:`h-9 w-full`})]})]}),e[3]=i):i=e[3],i}function JC(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 h-full w-full aria-[orientation=vertical]:flex-col`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(zb,{"data-slot":`resizable-panel-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function YC(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)(Ub,{"data-slot":`resizable-panel`,...n}),t[2]=n,t[3]=r),r}function XC(e){let t=(0,$.c)(12),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({withHandle:i,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=X(`relative flex w-px items-center justify-center bg-border ring-offset-background after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-ring focus-visible:outline-hidden aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:translate-x-0 aria-[orientation=horizontal]:after:-translate-y-1/2 [&[aria-orientation=horizontal]>div]:rotate-90`,n),t[4]=n,t[5]=a);let o;t[6]===i?o=t[7]:(o=i&&(0,Z.jsx)(`div`,{className:`z-10 flex h-6 w-1 shrink-0 rounded-lg bg-border`}),t[6]=i,t[7]=o);let s;return t[8]!==r||t[9]!==a||t[10]!==o?(s=(0,Z.jsx)(qb,{"data-slot":`resizable-handle`,className:a,...r,children:o}),t[8]=r,t[9]=a,t[10]=o,t[11]=s):s=t[11],s}function ZC(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/input-group relative flex h-8 w-full min-w-0 items-center rounded-lg border border-input transition-colors outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-disabled:bg-input/50 has-disabled:opacity-50 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-disabled:bg-input/80 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`input-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var QC=qr(`flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4`,{variants:{align:{"inline-start":`order-first pl-2 has-[>button]:ml-[-0.3rem] has-[>kbd]:ml-[-0.15rem]`,"inline-end":`order-last pr-2 has-[>button]:mr-[-0.3rem] has-[>kbd]:mr-[-0.15rem]`,"block-start":`order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2`,"block-end":`order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2`}},defaultVariants:{align:`inline-start`}});function $C(e){let t=(0,$.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,align:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`inline-start`:i,o;t[4]!==a||t[5]!==n?(o=X(QC({align:a}),n),t[4]=a,t[5]=n,t[6]=o):o=t[6];let s;return t[7]!==a||t[8]!==r||t[9]!==o?(s=(0,Z.jsx)(`div`,{"data-slot":`input-group-addon`,"data-align":a,className:o,onMouseDown:ew,...r}),t[7]=a,t[8]=r,t[9]=o,t[10]=s):s=t[10],s}function ew(e){e.target.closest(`button`)||(e.preventDefault(),e.currentTarget.parentElement?.querySelector(`input`)?.focus())}qr(`flex items-center gap-2 text-sm shadow-none`,{variants:{size:{xs:`h-6 gap-1 rounded-[calc(var(--radius)-3px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5`,sm:``,"icon-xs":`size-6 rounded-[calc(var(--radius)-3px)] p-0 has-[>svg]:p-0`,"icon-sm":`size-8 p-0 has-[>svg]:p-0`}},defaultVariants:{size:`xs`}});function tw(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 items-center gap-2 text-sm text-muted-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`span`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function nw(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 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Uc,{"data-slot":`input-group-control`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function rw(e){let t=(0,$.c)(119),{findInputRef:n,query:r,replacement:i,replaceOpen:a,caseSensitive:o,wholeWord:s,current:c,total:l,onQueryChange:u,onReplacementChange:d,onReplaceOpenChange:f,onCaseSensitiveChange:p,onWholeWordChange:m,onNext:h,onPrevious:g,onReplaceCurrent:_,onReplaceAll:v,onClose:y}=e,{_:b}=kt(),x=r.length>0,S=l>0,C;t[0]!==b||t[1]!==c||t[2]!==S||t[3]!==x||t[4]!==l?(C=x?S?`${c} / ${l}`:b({id:`Ev2r9A`}):``,t[0]=b,t[1]=c,t[2]=S,t[3]=x,t[4]=l,t[5]=C):C=t[5];let w=C,T;t[6]!==y||t[7]!==h||t[8]!==g?(T=function(e){e.key===`Enter`?(e.preventDefault(),e.shiftKey?g():h()):e.key===`Escape`&&(e.preventDefault(),y())},t[6]=y,t[7]=h,t[8]=g,t[9]=T):T=t[9];let E=T,D;t[10]!==y||t[11]!==_?(D=function(e){e.key===`Enter`?(e.preventDefault(),_()):e.key===`Escape`&&(e.preventDefault(),y())},t[10]=y,t[11]=_,t[12]=D):D=t[12];let O=D,k;t[13]===b?k=t[14]:(k=b({id:`MVxpbf`}),t[13]=b,t[14]=k);let A;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(`label`,{className:`sr-only`,htmlFor:`ok-find-input`,children:(0,Z.jsx)(J,{id:`KujtjC`})}),t[15]=A):A=t[15];let j;t[16]===u?j=t[17]:(j=e=>u(e.target.value),t[16]=u,t[17]=j);let M;t[18]===b?M=t[19]:(M=b({id:`KujtjC`}),t[18]=b,t[19]=M);let P;t[20]!==n||t[21]!==E||t[22]!==r||t[23]!==j||t[24]!==M?(P=(0,Z.jsx)(nw,{ref:n,id:`ok-find-input`,value:r,onChange:j,onKeyDown:E,placeholder:M,autoComplete:`off`,spellCheck:!1,className:`h-7 px-2 text-sm`}),t[20]=n,t[21]=E,t[22]=r,t[23]=j,t[24]=M,t[25]=P):P=t[25];let F;t[26]===b?F=t[27]:(F=b({id:`-8PP0T`}),t[26]=b,t[27]=F);let I;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(kd,{"aria-hidden":`true`}),t[28]=I):I=t[28];let L;t[29]!==o||t[30]!==p||t[31]!==F?(L=(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(Lc,{type:`button`,variant:`segmented`,size:`sm`,"aria-label":F,pressed:o,onPressedChange:p,className:`size-6 min-w-6 px-0`,children:I})}),t[29]=o,t[30]=p,t[31]=F,t[32]=L):L=t[32];let R;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Z.jsx)(Es,{side:`bottom`,children:(0,Z.jsx)(J,{id:`-8PP0T`})}),t[33]=R):R=t[33];let z;t[34]===L?z=t[35]:(z=(0,Z.jsxs)(Os,{children:[L,R]}),t[34]=L,t[35]=z);let B;t[36]===b?B=t[37]:(B=b({id:`_7UQ7y`}),t[36]=b,t[37]=B);let V;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Z.jsx)(qf,{"aria-hidden":`true`}),t[38]=V):V=t[38];let H;t[39]!==m||t[40]!==B||t[41]!==s?(H=(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(Lc,{type:`button`,variant:`segmented`,size:`sm`,"aria-label":B,pressed:s,onPressedChange:m,className:`size-6 min-w-6 px-0`,children:V})}),t[39]=m,t[40]=B,t[41]=s,t[42]=H):H=t[42];let U;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(Es,{side:`bottom`,children:(0,Z.jsx)(J,{id:`_7UQ7y`})}),t[43]=U):U=t[43];let W;t[44]===H?W=t[45]:(W=(0,Z.jsxs)(Os,{children:[H,U]}),t[44]=H,t[45]=W);let G;t[46]!==z||t[47]!==W?(G=(0,Z.jsxs)($C,{align:`inline-end`,className:`gap-0.5`,children:[z,W]}),t[46]=z,t[47]=W,t[48]=G):G=t[48];let K;t[49]!==G||t[50]!==P?(K=(0,Z.jsxs)(ZC,{className:`h-7 w-56 rounded-[min(var(--radius-md),12px)]`,children:[P,G]}),t[49]=G,t[50]=P,t[51]=K):K=t[51];let ee;t[52]===w?ee=t[53]:(ee=(0,Z.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`min-w-14 px-1 text-right text-muted-foreground text-xs tabular-nums shrink-0`,children:w}),t[52]=w,t[53]=ee);let te;t[54]===b?te=t[55]:(te=b({id:`oqB2ez`}),t[54]=b,t[55]=te);let ne=!S,re;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Z.jsx)(N,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[56]=re):re=t[56];let ie;t[57]!==g||t[58]!==te||t[59]!==ne?(ie=(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(Jr,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":te,disabled:ne,onClick:g,children:re})}),t[57]=g,t[58]=te,t[59]=ne,t[60]=ie):ie=t[60];let q;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,Z.jsx)(Es,{side:`bottom`,children:(0,Z.jsx)(J,{id:`oqB2ez`})}),t[61]=q):q=t[61];let ae;t[62]===ie?ae=t[63]:(ae=(0,Z.jsxs)(Os,{children:[ie,q]}),t[62]=ie,t[63]=ae);let oe;t[64]===b?oe=t[65]:(oe=b({id:`SiUUCS`}),t[64]=b,t[65]=oe);let se=!S,ce;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(ce=(0,Z.jsx)(ea,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[66]=ce):ce=t[66];let le;t[67]!==h||t[68]!==oe||t[69]!==se?(le=(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(Jr,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":oe,disabled:se,onClick:h,children:ce})}),t[67]=h,t[68]=oe,t[69]=se,t[70]=le):le=t[70];let ue;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(ue=(0,Z.jsx)(Es,{side:`bottom`,children:(0,Z.jsx)(J,{id:`SiUUCS`})}),t[71]=ue):ue=t[71];let de;t[72]===le?de=t[73]:(de=(0,Z.jsxs)(Os,{children:[le,ue]}),t[72]=le,t[73]=de);let fe=a?`secondary`:`ghost`,pe;t[74]!==b||t[75]!==a?(pe=b(a?{id:`UkQGhd`}:{id:`1RluQD`}),t[74]=b,t[75]=a,t[76]=pe):pe=t[76];let me=a?`ok-replace-input`:void 0,he;t[77]!==f||t[78]!==a?(he=()=>f(!a),t[77]=f,t[78]=a,t[79]=he):he=t[79];let ge;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,Z.jsx)(wf,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[80]=ge):ge=t[80];let _e;t[81]!==a||t[82]!==fe||t[83]!==pe||t[84]!==me||t[85]!==he?(_e=(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(Jr,{type:`button`,variant:fe,size:`icon-sm`,"aria-label":pe,"aria-expanded":a,"aria-controls":me,onClick:he,children:ge})}),t[81]=a,t[82]=fe,t[83]=pe,t[84]=me,t[85]=he,t[86]=_e):_e=t[86];let ve;t[87]===a?ve=t[88]:(ve=(0,Z.jsx)(Es,{side:`bottom`,children:a?(0,Z.jsx)(J,{id:`UkQGhd`}):(0,Z.jsx)(J,{id:`1RluQD`})}),t[87]=a,t[88]=ve);let ye;t[89]!==_e||t[90]!==ve?(ye=(0,Z.jsxs)(Os,{children:[_e,ve]}),t[89]=_e,t[90]=ve,t[91]=ye):ye=t[91];let be;t[92]!==b||t[93]!==O||t[94]!==S||t[95]!==v||t[96]!==_||t[97]!==d||t[98]!==a||t[99]!==i?(be=a?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`label`,{className:`sr-only`,htmlFor:`ok-replace-input`,children:(0,Z.jsx)(J,{id:`fqSfXY`})}),(0,Z.jsx)(Uc,{id:`ok-replace-input`,value:i,onChange:e=>d(e.target.value),onKeyDown:O,placeholder:b({id:`fqSfXY`}),autoComplete:`off`,spellCheck:!1,className:`h-7 w-48 rounded-[min(var(--radius-md),12px)] px-2 text-sm shadow-none focus-visible:ring-2`}),(0,Z.jsxs)(Os,{children:[(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(Jr,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":b({id:`bS_boY`}),disabled:!S,onClick:_,children:(0,Z.jsx)(wf,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(Es,{side:`bottom`,children:(0,Z.jsx)(J,{id:`bS_boY`})})]}),(0,Z.jsxs)(Os,{children:[(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(Jr,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":b({id:`dr1vFs`}),disabled:!S,onClick:v,children:(0,Z.jsx)(Cf,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(Es,{side:`bottom`,children:(0,Z.jsx)(J,{id:`dr1vFs`})})]})]}):null,t[92]=b,t[93]=O,t[94]=S,t[95]=v,t[96]=_,t[97]=d,t[98]=a,t[99]=i,t[100]=be):be=t[100];let xe;t[101]===b?xe=t[102]:(xe=b({id:`wJo9oS`}),t[101]=b,t[102]=xe);let Se;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(Se=(0,Z.jsx)(gs,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[103]=Se):Se=t[103];let Ce;t[104]!==y||t[105]!==xe?(Ce=(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(Jr,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":xe,onClick:y,children:Se})}),t[104]=y,t[105]=xe,t[106]=Ce):Ce=t[106];let we;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(we=(0,Z.jsx)(Es,{side:`bottom`,children:(0,Z.jsx)(J,{id:`yz7wBu`})}),t[107]=we):we=t[107];let Te;t[108]===Ce?Te=t[109]:(Te=(0,Z.jsxs)(Os,{children:[Ce,we]}),t[108]=Ce,t[109]=Te);let Ee;return t[110]!==K||t[111]!==ee||t[112]!==ae||t[113]!==de||t[114]!==k||t[115]!==ye||t[116]!==be||t[117]!==Te?(Ee=(0,Z.jsxs)(`search`,{"data-testid":`find-replace-bar`,"aria-label":k,className:`pointer-events-auto flex max-w-[min(calc(100vw-1rem),720px)] touch-manipulation items-center gap-1 rounded-[calc(var(--radius)+2px)] border border-input bg-popover/95 p-1 text-popover-foreground shadow-md shadow-black/10 backdrop-blur`,children:[A,K,ee,ae,de,ye,be,Te]}),t[110]=K,t[111]=ee,t[112]=ae,t[113]=de,t[114]=k,t[115]=ye,t[116]=be,t[117]=Te,t[118]=Ee):Ee=t[118],Ee}var iw={current:0,total:0},aw=120,ow=100;function sw(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=()=>e?u(e):null,t[0]=e,t[1]=n),(0,Q.useSyncExternalStore)(P,n,cw)}function cw(){return null}function lw(e){if(!e||e.isDestroyed)return null;let{from:t,to:n,empty:r}=e.state.selection;if(r)return null;let i=e.state.doc.textBetween(t,n,`
24
+ `).trim(),mentions:t}}function Gx(e){let{instruction:t,mentions:n}=Wx(e);return t===``&&n.length===0}function Kx(e){let t=e?.content;return!Array.isArray(t)||t.length===0?!1:t.some(e=>Array.isArray(e.content)&&e.content.length>0)}function qx(e){let t=(0,$.c)(29),{ref:n,ariaLabel:r,onEmptyChange:i,onContentChange:a,onMentionsChange:o,onSubmit:s,className:c,placeholder:l,initialDoc:u}=e,d=(0,Q.useRef)(i),f=(0,Q.useRef)(a),p=(0,Q.useRef)(o),m=(0,Q.useRef)(s),h;t[0]!==a||t[1]!==i||t[2]!==o||t[3]!==s?(h=()=>{d.current=i,f.current=a,p.current=o,m.current=s},t[0]=a,t[1]=i,t[2]=o,t[3]=s,t[4]=h):h=t[4],(0,Q.useEffect)(h);let g;t[5]===l?g=t[6]:(g=Vx({placeholder:l}),t[5]=l,t[6]=g);let _=u??void 0,v;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(v=X(`composer-prosemirror py-1 outline-none`),t[7]=v):v=t[7];let y;t[8]===r?y=t[9]:(y={role:`textbox`,"aria-label":r,"aria-multiline":`true`,class:v},t[8]=r,t[9]=y);let b;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(b=(e,t)=>t.key===`Escape`?Nx.getState(e.state)?.active?!1:(e.dom.blur(),!0):t.key===`Enter`&&!t.shiftKey&&!t.isComposing&&!e.composing?Nx.getState(e.state)?.active?!1:(m.current(),!0):!1,t[10]=b):b=t[10];let x;t[11]===y?x=t[12]:(x={attributes:y,handleKeyDown:b},t[11]=y,t[12]=x);let S;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(S=e=>{let{editor:t}=e;d.current(Gx(t)),f.current?.(t.getJSON()),p.current?.(Wx(t).mentions)},t[13]=S):S=t[13];let C;t[14]!==g||t[15]!==_||t[16]!==x?(C={extensions:g,content:_,immediatelyRender:!0,editorProps:x,onUpdate:S},t[14]=g,t[15]=_,t[16]=x,t[17]=C):C=t[17];let w=ji(C),T;t[18]!==w||t[19]!==u?(T=()=>{w&&(Gx(w)&&Kx(u)&&(console.warn(`composer draft was incompatible with the current schema — clearing it`),wx()),d.current(Gx(w)),p.current?.(Wx(w).mentions))},t[18]=w,t[19]=u,t[20]=T):T=t[20];let E;t[21]===w?E=t[22]:(E=[w],t[21]=w,t[22]=E),(0,Q.useEffect)(T,E);let D,O;t[23]===w?(D=t[24],O=t[25]):(D=()=>({focus:()=>w?.commands.focus(),blur:()=>w?.commands.blur(),clear:()=>w?.commands.clearContent(!0),setText:e=>{w&&(w.commands.setContent(e),f.current?.(w.getJSON()),p.current?.(Wx(w).mentions))},getContent:()=>w?Wx(w):{instruction:``,mentions:[]}}),O=[w],t[23]=w,t[24]=D,t[25]=O),(0,Q.useImperativeHandle)(n,D,O);let k;return t[26]!==c||t[27]!==w?(k=(0,Z.jsx)(xi,{editor:w,className:c}),t[26]=c,t[27]=w,t[28]=k):k=t[28],k}function Jx(e,t,n){return e.trim().length>0||t.length>0||n}var Yx=new Set(ca.map(e=>e.id));function Xx(e){return typeof e==`string`&&Yx.has(e)}function Zx(e){try{let t=g_(e);return Xx(t)?t:null}catch{return null}}function Qx(e,t){__(e,t)}function $x(e){let{lastUsed:t,states:n}=e;return t&&n[t]?.installed===!0?t:ca.find(e=>n[e.id]?.installed===!0)?.id??null}function eS(e){let t=(0,$.c)(28),{scenario:n,className:r}=e,{_:i}=kt(),{states:a,refresh:o}=ya(),{dispatch:s}=Da(),c=ua(),l=Ta(),[u,d]=(0,Q.useState)(rS),f=(0,Q.useRef)(!1),[p,m]=(0,Q.useState)(null),h=p!==null&&l!==null,g=(0,Q.useRef)(null),[_]=(0,Q.useState)(nS),[v,y]=(0,Q.useState)(!0),[b,x]=(0,Q.useState)(!1),S;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(S=function(e){y(e),e||x(!1)},t[0]=S):S=t[0];let C=S,w=lx(n),T;t[1]===a?T=t[2]:(T=e=>a[e.id]?.installed===!0,t[1]=a,t[2]=T);let E=ca.filter(T),D;t[3]===a?D=t[4]:(D=ca.every(e=>a[e.id]?.installed!=null),t[3]=a,t[4]=D);let O=D,k=O&&E.length===0,A,j;t[5]!==O||t[6]!==a?(A=()=>{if(!O||f.current)return;let e=$x({lastUsed:Zx(),states:a});d(t=>e===t?t:e)},j=[O,a],t[5]=O,t[6]=a,t[7]=A,t[8]=j):(A=t[7],j=t[8]),(0,Q.useEffect)(A,j);let M=function(e){f.current=!0,m(null),d(e),Qx(e)},N=function(e){f.current=!0,m(e)},P=function(){if(l===null||p===null)return;let{instruction:e,mentions:t}=g.current?.getContent()??{instruction:``,mentions:[]};if(!Jx(e,t,!1)){x(!0);return}let r=ha({workspace:c,description:e,scenario:n,mentions:t});r!==null&&(l.launchInTerminal(r,p),g.current?.clear(),wx())},F=function(e){let{instruction:t,mentions:r}=g.current?.getContent()??{instruction:``,mentions:[]};if(!Jx(t,r,!1)){x(!0);return}Qx(e);let i=ha({workspace:c,description:t,scenario:n,mentions:r});i!==null&&(s(e,i),g.current?.clear(),wx())},I=function(){h?P():u!==null&&F(u)},L=function(e){g.current?.setText(e),g.current?.focus()};if(k){let e;t[9]===r?e=t[10]:(e=X(`flex w-full flex-wrap items-center justify-between gap-3 rounded-2xl border border-border/60 bg-card px-4 py-3`,r),t[9]=r,t[10]=e);let n;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(jo,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`}),t[11]=n):n=t[11];let i;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[n,(0,Z.jsx)(`span`,{className:`text-1sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`3IseAk`})})]}),t[12]=i):i=t[12];let a;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:ca.map(tS)}),t[13]=a):a=t[13];let o;return t[14]===e?o=t[15]:(o=(0,Z.jsxs)(`div`,{className:e,"data-testid":`create-no-agents`,children:[i,a]}),t[14]=e,t[15]=o),o}let R=E.length>0,z=l!==null,B;t[16]===r?B=t[17]:(B=X(`flex w-full flex-col gap-3`,r),t[16]=r,t[17]=B);let V;t[18]===i?V=t[19]:(V=i({id:`7hctf2`}),t[18]=i,t[19]=V);let H;t[20]===i?H=t[21]:(H=i({id:`0jD-Gn`}),t[20]=i,t[21]=H);let U;t[22]!==v||t[23]!==b?(U=b&&v?(0,Z.jsx)(`p`,{role:`alert`,className:`text-1sm text-destructive`,"data-testid":`create-input-required`,children:(0,Z.jsx)(J,{id:`1FLarN`})}):(0,Z.jsx)(`span`,{}),t[22]=v,t[23]=b,t[24]=U):U=t[24];let W=u===null?(0,Z.jsx)(Jr,{type:`button`,variant:`outline`,disabled:!0,className:`gap-1.5`,"data-testid":`create-with-agent`,children:(0,Z.jsx)(J,{id:`hYgDIe`})}):(0,Z.jsxs)(Ox,{children:[(0,Z.jsx)(Jr,{type:`button`,onClick:()=>h?P():F(u),variant:`outline`,className:`gap-1.5`,"data-testid":`create-with-agent`,children:h&&p!==null?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ma,{id:pa(p),"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(J,{id:`4rjwLG`,values:{0:zr[p].displayName}})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ma,{id:u,"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(J,{id:`9dw5bW`,values:{0:la(u)}})]})}),(0,Z.jsxs)(Ec,{onOpenChange:e=>{e&&o()},children:[(0,Z.jsx)(ic,{asChild:!0,children:(0,Z.jsx)(Jr,{type:`button`,"aria-label":i({id:`nskygk`}),size:`icon`,variant:`outline`,"data-testid":`create-with-agent-menu`,children:(0,Z.jsx)(ea,{"aria-hidden":`true`,className:`size-3.5`})})}),(0,Z.jsxs)(bc,{align:`end`,className:`min-w-[200px]`,children:[z?(0,Z.jsxs)(yc,{"aria-label":i({id:`ALhMYW`}),children:[(0,Z.jsx)(kc,{children:(0,Z.jsx)(J,{id:`ALhMYW`})}),wa.map(e=>{let{displayName:t}=zr[e];return(0,Z.jsxs)(vc,{onSelect:()=>N(e),"data-testid":`create-with-cli-${e}`,"aria-label":i({id:`QYfQdv`,values:{displayName:t}}),children:[(0,Z.jsx)(ma,{id:pa(e),"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:t}),p===e?(0,Z.jsx)($i,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e)})]}):null,R?(0,Z.jsxs)(Z.Fragment,{children:[z?(0,Z.jsx)(mc,{}):null,(0,Z.jsxs)(yc,{"aria-label":i({id:`BBqGS9`}),children:[(0,Z.jsx)(kc,{children:(0,Z.jsx)(J,{id:`BBqGS9`})}),E.map(e=>(0,Z.jsxs)(vc,{onSelect:()=>M(e.id),"data-testid":`create-agent-option-${e.id}`,children:[(0,Z.jsx)(ma,{id:e.id,"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:e.displayName}),!h&&e.id===u?(0,Z.jsx)($i,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.id))]})]}):null]})]})]}),G;return t[25]!==W||t[26]!==U?(G=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 px-3 pb-3`,children:[U,W]}),t[25]=W,t[26]=U,t[27]=G):G=t[27],(0,Z.jsxs)(`div`,{className:B,children:[(0,Z.jsxs)(`div`,{onMouseDown:e=>Ex(e,g),className:`flex w-full cursor-text flex-col rounded-2xl border border-border/60 bg-card shadow-sm transition-colors focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50`,children:[(0,Z.jsx)(qx,{ref:g,ariaLabel:V,placeholder:H,onEmptyChange:C,onContentChange:Cx,onSubmit:I,initialDoc:_,className:`max-h-96 overflow-y-auto px-4 py-3 text-sm leading-relaxed subtle-scrollbar [&_.ProseMirror]:min-h-16`}),G]}),n!==`existing-repo`&&w.length>0?(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-1sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`I5685_`})}),w.map(e=>{let t=e.icon;return(0,Z.jsxs)(Jr,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>L(e.prompt),className:`gap-1.5 rounded-md font-normal text-muted-foreground hover:text-foreground`,"data-testid":`create-suggestion-${e.id}`,children:[(0,Z.jsx)(t,{className:`size-3.5`,"aria-hidden":`true`}),e.label]},e.id)})]}):null]})}function tS(e){return(0,Z.jsxs)(Jr,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void sa(e),className:`gap-1.5`,"data-testid":`install-agent-${e.id}`,children:[(0,Z.jsx)(ma,{id:e.id,"aria-hidden":`true`,className:`size-3.5`}),e.displayName,(0,Z.jsx)(Hi,{"aria-hidden":`true`,className:`size-3`})]},e.id)}function nS(){return Sx().doc??void 0}function rS(){return Zx()}var iS=3100,aS=3;function oS(e,t,n){let r=n?.windowMs??600,i=n?.maxLevel??aS;if(e===0||t>=r)return 1;let a=e+1;return a>i?i:a}var sS={0:{count:0,startRadius:0,baseDistance:0,distanceVariance:0,sizeMin:0,sizeMax:0,maxDelay:0,durationMin:0,durationMax:0},1:{count:0,startRadius:0,baseDistance:0,distanceVariance:0,sizeMin:0,sizeMax:0,maxDelay:0,durationMin:0,durationMax:0},2:{count:0,startRadius:0,baseDistance:0,distanceVariance:0,sizeMin:0,sizeMax:0,maxDelay:0,durationMin:0,durationMax:0},3:{count:16,startRadius:11,baseDistance:7,distanceVariance:3,sizeMin:.45,sizeMax:1.2,maxDelay:500,durationMin:1100,durationMax:2400}},cS=[`var(--color-azure-blue)`,`var(--color-sky-blue)`,`var(--color-violet-300)`,`var(--color-orange-light)`,`var(--color-crystal-blue)`,`var(--color-white-cream)`];function lS(e,t={}){let n=t.rng??Math.random,r=t.colors??cS,i=sS[e];if(i.count===0||r.length===0)return[];let a=[],o=Math.PI*2/i.count;for(let e=0;e<i.count;e++){let t=e*o+(n()-.5)*o*.7,s=i.baseDistance+(n()-.5)*2*i.distanceVariance,c=i.sizeMin+n()*(i.sizeMax-i.sizeMin),l=n()*i.maxDelay,u=i.durationMin+n()*(i.durationMax-i.durationMin),d=Math.floor(n()*r.length),f=Math.cos(t),p=Math.sin(t);a.push({id:e,dx:f*s,dy:p*s,originDx:f*i.startRadius,originDy:p*i.startRadius,size:c,color:r[d]??`currentColor`,delay:l,duration:u})}return a}var uS=1.8,dS=90,fS=16,pS=380,mS=.025,hS=.1,gS=.18,_S=400,vS=9.2736,yS=18.1799,bS=14.5244,xS={1:{halfWidth:1.5,apexLift:2.2},2:{halfWidth:1.4,apexLift:2.6},3:{halfWidth:1.25,apexLift:3}};function SS(e,t){let{halfWidth:n,apexLift:r}=xS[t];return`M${e-n} ${bS+.3} Q${e} ${bS-r}, ${e+n} ${bS+.3}`}function CS(e){let t=1.5,n=.3;return`M${e-t} ${bS-n} Q${e} ${bS+1.4}, ${e+t} ${bS-n}`}var wS=15,TS=15;function ES(e){return{fill:e.color,"--fx-tx":`${e.dx}px`,"--fx-ty":`${e.dy}px`,"--fx-delay":`${e.delay}ms`,"--fx-duration":`${e.duration}ms`}}function DS(e){let t=(0,$.c)(71),{size:n,className:r,trackMouse:i,variant:a,celebrateSignal:o}=e,s=n===void 0?48:n,c=i===void 0?!0:i,l=a===void 0?`default`:a,u=o===void 0?0:o,d=(0,Q.useRef)(null),f=(0,Q.useRef)(null),p=(0,Q.useRef)(null),m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m={x:0,y:0},t[0]=m):m=t[0];let h=(0,Q.useRef)(m),[g,_]=(0,Q.useState)(0),[v,y]=(0,Q.useState)(0),b;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(b=[],t[1]=b):b=t[1];let[x,S]=(0,Q.useState)(b),C=(0,Q.useRef)(0),w=(0,Q.useRef)(void 0),T=l===`sleeping`,E;t[2]!==g||t[3]!==T?(E=function(){if(T)return;let e=typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now(),t=C.current===0?1/0:e-C.current;C.current=e;let n=oS(g,t);_(n),y(jS),S(lS(n)),clearTimeout(w.current),w.current=setTimeout(()=>{_(0),S([])},iS)},t[2]=g,t[3]=T,t[4]=E):E=t[4];let D=E,O,k;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(O=()=>()=>clearTimeout(w.current),k=[],t[5]=O,t[6]=k):(O=t[5],k=t[6]),(0,Q.useEffect)(O,k);let A,j;t[7]!==u||t[8]!==T?(A=()=>{u===0||T||(_(3),y(AS),S(lS(3)),clearTimeout(w.current),w.current=setTimeout(()=>{_(0),S([])},iS))},j=[u,T],t[7]=u,t[8]=T,t[9]=A,t[10]=j):(A=t[9],j=t[10]),(0,Q.useEffect)(A,j);let M,N;t[11]!==T||t[12]!==c?(M=()=>{if(!c||T||window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)return;let e=0,t=0,n=!1,r=0,i=0,a=0,o=0,s=0,l=function(){s===0&&(s=requestAnimationFrame(m))},u=function(r){e=r.clientX,t=r.clientY,n=!0,l()};function m(){s=0;let c=f.current,u=d.current;if(!c||!u){l();return}let m=n;n=!1;let g=c.getBoundingClientRect(),_=g.left+g.width/2,v=g.top+g.height*.48,y=e-_,b=t-v,x=Math.hypot(y,b),S=Math.max(-1,Math.min(1,y/pS)),C=-Math.max(-1,Math.min(1,b/pS))*fS,w=S*fS,T=0,E=0;if(x>=1){let e=Math.min(x/dS,1)*uS;T=y/x*e,E=b/x*e}let D=Math.abs(C-r)<.01&&Math.abs(w-i)<.01&&Math.abs(T-a)<.01&&Math.abs(E-o)<.01;if(!m&&D)return;l(),r+=(C-r)*hS,i+=(w-i)*hS,u.style.transform=`perspective(${_S}px) rotateX(${r.toFixed(3)}deg) rotateY(${i.toFixed(3)}deg)`,a+=(T-a)*gS,o+=(E-o)*gS;let O=i*mS,k=-r*mS,A=a+O,j=o+k;h.current.x=A,h.current.y=j,p.current?.setAttribute(`transform`,`translate(${A.toFixed(3)} ${j.toFixed(3)})`)}return document.addEventListener(`mousemove`,u,{passive:!0}),l(),()=>{document.removeEventListener(`mousemove`,u),s!==0&&cancelAnimationFrame(s),s=0,d.current&&(d.current.style.transform=``),h.current={x:0,y:0},p.current?.removeAttribute(`transform`)}},N=[c,T],t[11]=T,t[12]=c,t[13]=M,t[14]=N):(M=t[13],N=t[14]),(0,Q.useEffect)(M,N);let P;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(P=()=>{let e=p.current;if(!e)return;let{x:t,y:n}=h.current;e.setAttribute(`transform`,`translate(${t.toFixed(3)} ${n.toFixed(3)})`)},t[15]=P):P=t[15],(0,Q.useLayoutEffect)(P);let F=g>0,I=F?g:1,L=F?`ok-blob-clicked-${g}`:null,R;t[16]===r?R=t[17]:(R=X(`ok-blob-3d-wrapper`,r),t[16]=r,t[17]=R);let z=T?`cursor-default`:`cursor-pointer`,B=`body-${v}`,V=T&&`ok-blob-sleeping`,H;t[18]!==L||t[19]!==V?(H=X(`ok-blob-group`,V,L),t[18]=L,t[19]=V,t[20]=H):H=t[20];let U;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(`path`,{d:`M25.2339 6.78134C25.5199 7.35734 25.8179 8.47234 26.0179 9.07834C26.0189 9.08234 26.0209 9.08634 26.0219 9.09134C26.0229 9.09534 26.0249 9.10034 26.0259 9.10434C26.0539 9.19734 26.0949 9.29533 26.1519 9.41633C26.2919 9.71133 26.5269 10.1173 27.1299 11.1683C27.3259 11.4643 27.5209 11.7693 27.7119 12.0903C29.9739 15.1623 29.3259 20.1913 27.0469 22.9153C26.7779 23.2953 26.4869 23.6043 26.1889 23.8863C26.1519 23.9253 26.1129 23.9643 26.0729 24.0033C25.3159 24.7543 24.2949 25.4673 23.6129 25.8323C22.7469 26.2983 22.1349 26.5483 21.6299 26.7463C20.3649 27.3063 19.0609 27.7733 17.6569 28.0423C15.9649 28.3513 14.1939 28.4433 12.4569 28.1373C11.4779 27.9663 10.5119 27.6663 9.60891 27.2493C8.77491 26.8663 7.99192 26.3853 7.26992 25.8403C6.83592 25.5393 6.43893 25.2343 6.08093 24.9383C5.57893 24.5223 5.15993 24.1263 4.83493 23.7793C4.04993 22.9443 3.31593 21.8893 2.80893 21.0953C2.72593 20.9663 2.64792 20.8433 2.57592 20.7293C2.56192 20.7093 2.54793 20.6893 2.53393 20.6703C2.08593 20.0263 1.71892 19.3293 1.43792 18.5993C1.42892 18.5453 1.42093 18.4903 1.41293 18.4353C1.32093 17.7443 1.08292 16.9423 1.01092 15.6333C0.984921 15.0653 0.998928 14.4013 1.12393 13.6353C1.20693 13.1413 1.31993 12.9023 1.40893 12.7113C1.43593 12.6543 1.46193 12.6023 1.48593 12.5483C1.56793 12.3653 1.59392 12.1563 1.63592 11.9083C1.68992 11.5883 1.76992 11.1943 2.04592 10.7553C2.94392 9.37934 3.36792 8.81934 3.66592 8.33934C3.75592 8.20334 3.84292 8.08134 3.94192 7.96634C4.21592 7.64634 4.67693 7.29534 5.10293 7.05734C5.16693 7.02234 5.23093 6.98834 5.29193 6.95534C5.62993 6.77834 6.22592 6.30135 6.66992 5.92035C6.83692 5.77635 7.08193 5.60735 7.37393 5.40935C7.67393 5.20535 8.02593 4.96934 8.39193 4.70234C9.32093 4.02634 9.84091 3.69134 10.2599 3.42334C10.3799 3.34734 10.4919 3.27734 10.6049 3.20834C10.9609 2.98834 11.4149 2.73034 11.8869 2.48634C12.4519 2.19334 13.0469 1.92133 13.5089 1.72233C14.7399 1.30233 16.0539 1.01333 17.4169 1.00033C18.1169 0.991333 18.7939 1.16534 19.2389 1.43034C19.6869 1.69534 19.8689 2.00335 19.8039 2.23935C19.7379 2.47835 19.4399 2.63634 19.0109 2.74734C18.5789 2.85634 18.0469 2.92035 17.4889 2.96135C16.3639 3.04235 15.2399 3.36435 14.1499 3.80835C12.8199 4.35135 11.5379 5.07133 10.2719 5.84733C9.38691 6.39133 8.51192 6.97334 7.63592 7.56834C7.54492 7.63034 7.45492 7.69135 7.36492 7.75235C6.97392 8.06635 6.58293 8.38134 6.22293 8.66334C5.97893 8.85734 5.76793 9.04834 5.59393 9.21434C5.26893 9.52334 5.02393 9.74334 4.81893 9.93934C4.67793 10.0753 4.55793 10.2013 4.45593 10.3443C4.40093 10.4213 4.32992 10.5273 4.24792 10.6593C3.90492 11.1933 3.44493 12.1693 3.15393 13.1173C3.01893 13.5363 2.87991 14.0343 2.79391 14.5253C2.66591 15.2253 2.65594 15.9053 2.71994 16.2373C2.82794 16.8193 2.95593 17.4833 3.14093 18.0553C3.31293 18.6003 3.52991 19.0583 3.70791 19.2823C3.81591 19.4183 3.90394 19.5473 3.99594 19.6913C4.09394 19.8413 4.19191 20.0073 4.31091 20.2033C4.47891 20.4803 4.68592 20.8163 5.00192 21.2493C5.36492 21.7463 5.61793 22.1043 5.83493 22.4023C6.14493 22.8243 6.38591 23.1343 6.83691 23.5033C7.33891 23.9113 7.86593 24.3113 8.26693 24.6393C8.44893 24.7883 8.66993 24.9443 8.90493 25.0963C9.21593 25.2963 9.55192 25.4893 9.85592 25.6703C10.1059 25.8203 10.3059 25.9633 10.4869 26.0863C10.5429 26.1243 10.5979 26.1603 10.6519 26.1943C10.8699 26.2803 11.0929 26.3593 11.3159 26.4283C11.3539 26.4323 11.3949 26.4353 11.4369 26.4393C11.6509 26.4573 11.9089 26.4733 12.2209 26.5133C12.7169 26.5753 13.1399 26.6603 13.6019 26.7243C13.9589 26.7733 14.3409 26.8083 14.7729 26.7893C15.0729 26.7753 15.4069 26.7353 15.7389 26.6813C16.2349 26.6023 16.7179 26.4943 17.0569 26.4473C17.1499 26.4343 17.2359 26.4343 17.3209 26.4373C17.3489 26.4393 17.3799 26.4413 17.4109 26.4433C17.4119 26.4433 17.4119 26.4433 17.4129 26.4433C17.4199 26.4433 17.4279 26.4443 17.4349 26.4443C18.2329 26.2413 19.0259 25.9433 19.7959 25.5983C19.8609 25.5633 19.9259 25.5273 19.9899 25.4913C20.3059 25.3173 20.6049 25.1383 20.7869 24.9943C20.9829 24.8393 21.5189 24.5373 22.0579 24.1853C22.4109 23.9553 22.7649 23.7053 23.0369 23.4833C23.1949 23.3553 23.3689 23.2693 23.5479 23.1773C23.7129 23.0923 23.8809 23.0013 24.0349 22.8653C24.1109 22.7983 24.1869 22.7173 24.2639 22.6303C24.3309 22.5563 24.4039 22.4723 24.4759 22.3923C24.5459 22.3153 24.7199 22.1723 24.9139 21.9793C25.0079 21.8863 25.1059 21.7783 25.1909 21.6713C25.2199 21.6323 25.2489 21.5943 25.2769 21.5553C25.5919 21.0403 25.8779 20.5003 26.1019 19.9653C26.1299 19.8403 26.1379 19.7293 26.1279 19.6373C26.1199 19.5703 26.1029 19.5113 26.0839 19.4503C26.0599 19.3643 26.0329 19.2773 26.0239 19.1723C26.0169 19.0893 26.0309 19.0043 26.0629 18.9543C26.0779 18.9323 26.0969 18.9143 26.1129 18.8993C26.1329 18.8823 26.1499 18.8673 26.1569 18.8443C26.1609 18.8273 26.1579 18.8073 26.1529 18.7833C26.1459 18.7443 26.1369 18.6943 26.1539 18.6293C26.2189 18.3853 26.2869 18.1103 26.3319 17.8383C26.3829 17.5393 26.4049 17.2433 26.3949 17.0123C26.3849 16.7493 26.3909 16.3823 26.3469 16.0003C26.3179 15.7343 26.2659 15.4663 26.1979 15.2383C26.1319 15.0143 26.0219 14.7913 25.9039 14.5783C25.7629 14.3223 25.6119 14.0783 25.5169 13.8453C25.4969 13.7983 25.4999 13.7263 25.4999 13.6323C25.5009 13.5673 25.4999 13.4913 25.4919 13.4083C25.3239 13.1243 25.1459 12.8423 24.9589 12.5483C24.9479 12.5413 24.9369 12.5333 24.9249 12.5263C24.6689 12.3503 24.3139 12.1173 24.0769 11.5503C24.0179 11.4063 24.0069 11.2983 23.9969 11.1993C23.9859 11.1013 23.9799 11.0183 23.9289 10.9093C23.8709 10.7853 23.7759 10.6583 23.6709 10.4993C23.5849 10.3703 23.4899 10.2133 23.4199 10.0423C23.3819 9.95134 23.3509 9.85734 23.3329 9.75934C23.3299 9.74334 23.3269 9.72534 23.3229 9.70634C23.2899 9.52734 23.2439 9.26534 23.2409 8.98634C23.0209 8.24434 22.8339 7.48833 22.6519 6.77633C22.3429 5.57133 22.0519 4.54234 21.3329 3.95434C20.9839 3.65334 20.5689 3.35433 20.2459 3.05433C19.9259 2.75633 19.7449 2.47534 19.8019 2.23834C19.8639 2.00634 20.1589 1.82934 20.6659 1.80534C21.1699 1.78334 21.8699 1.93235 22.5209 2.39235C23.6159 3.14235 24.2029 4.38334 24.5599 5.35734C24.5829 5.40834 24.6049 5.46034 24.6259 5.51234C24.7849 5.89434 24.9529 6.22834 25.1199 6.55534C25.1579 6.63034 25.1969 6.70834 25.2339 6.78134Z`,className:`ok-blob-body`}),t[21]=U):U=t[21];let W=(F||T)&&`ok-blob-eye-hidden`,G;t[22]===W?G=t[23]:(G=X(`ok-blob-eye`,W),t[22]=W,t[23]=G);let K;t[24]===G?K=t[25]:(K=(0,Z.jsx)(`ellipse`,{cx:vS,cy:bS,rx:1.2722,ry:1.9083,className:G}),t[24]=G,t[25]=K);let ee=(F||T)&&`ok-blob-eye-hidden`,te;t[26]===ee?te=t[27]:(te=X(`ok-blob-eye ok-blob-eye-right`,ee),t[26]=ee,t[27]=te);let ne;t[28]===te?ne=t[29]:(ne=(0,Z.jsx)(`ellipse`,{cx:yS,cy:bS,rx:1.2722,ry:1.9083,className:te}),t[28]=te,t[29]=ne);let re;t[30]===I?re=t[31]:(re=SS(vS,I),t[30]=I,t[31]=re);let ie=(!F||T)&&`ok-blob-eye-hidden`,q;t[32]===ie?q=t[33]:(q=X(`ok-blob-happy-eye`,ie),t[32]=ie,t[33]=q);let ae;t[34]!==re||t[35]!==q?(ae=(0,Z.jsx)(`path`,{d:re,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:q}),t[34]=re,t[35]=q,t[36]=ae):ae=t[36];let oe;t[37]===I?oe=t[38]:(oe=SS(yS,I),t[37]=I,t[38]=oe);let se=(!F||T)&&`ok-blob-eye-hidden`,ce;t[39]===se?ce=t[40]:(ce=X(`ok-blob-happy-eye`,se),t[39]=se,t[40]=ce);let le;t[41]!==oe||t[42]!==ce?(le=(0,Z.jsx)(`path`,{d:oe,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:ce}),t[41]=oe,t[42]=ce,t[43]=le):le=t[43];let ue;t[44]===T?ue=t[45]:(ue=T?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`path`,{d:CS(vS),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`}),(0,Z.jsx)(`path`,{d:CS(yS),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`})]}):null,t[44]=T,t[45]=ue);let de;t[46]!==K||t[47]!==ne||t[48]!==ae||t[49]!==le||t[50]!==ue?(de=(0,Z.jsxs)(`g`,{ref:p,children:[K,ne,ae,le,ue]}),t[46]=K,t[47]=ne,t[48]=ae,t[49]=le,t[50]=ue,t[51]=de):de=t[51];let fe;t[52]!==B||t[53]!==H||t[54]!==de?(fe=(0,Z.jsxs)(`g`,{className:H,children:[U,de]},B),t[52]=B,t[53]=H,t[54]=de,t[55]=fe):fe=t[55];let pe;t[56]===T?pe=t[57]:(pe=T?(0,Z.jsxs)(`g`,{children:[(0,Z.jsx)(`text`,{x:21,y:7,className:`ok-blob-z ok-blob-z-1`,children:`z`}),(0,Z.jsx)(`text`,{x:26,y:2,className:`ok-blob-z ok-blob-z-2`,children:`z`})]}):null,t[56]=T,t[57]=pe);let me;t[58]!==v||t[59]!==x?(me=x.length>0&&(0,Z.jsx)(`g`,{children:x.map(OS)},`firework-${v}`),t[58]=v,t[59]=x,t[60]=me):me=t[60];let he;t[61]!==D||t[62]!==s||t[63]!==z||t[64]!==fe||t[65]!==pe||t[66]!==me?(he=(0,Z.jsxs)(`svg`,{ref:f,width:s,height:s,viewBox:`0 0 30 30`,fill:`none`,overflow:`visible`,xmlns:`http://www.w3.org/2000/svg`,className:z,"aria-hidden":`true`,onClick:D,onMouseDown:kS,children:[fe,pe,me]}),t[61]=D,t[62]=s,t[63]=z,t[64]=fe,t[65]=pe,t[66]=me,t[67]=he):he=t[67];let ge;return t[68]!==R||t[69]!==he?(ge=(0,Z.jsx)(`span`,{ref:d,className:R,children:he}),t[68]=R,t[69]=he,t[70]=ge):ge=t[70],ge}function OS(e){return(0,Z.jsx)(`circle`,{cx:wS+e.originDx,cy:TS+e.originDy,r:e.size,className:`ok-blob-firework`,style:ES(e)},e.id)}function kS(e){return e.preventDefault()}function AS(e){return e+1}function jS(e){return e+1}function MS(e){let t=(0,$.c)(12),{title:n,subtitle:r,celebrateSignal:i}=e,a;t[0]===i?a=t[1]:(a=(0,Z.jsx)(DS,{size:64,celebrateSignal:i}),t[0]=i,t[1]=a);let o;t[2]===n?o=t[3]:(o=(0,Z.jsx)(`h2`,{className:`text-2xl font-light tracking-tighter text-balance`,children:n}),t[2]=n,t[3]=o);let s;t[4]===r?s=t[5]:(s=r?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r}):null,t[4]=r,t[5]=s);let c;t[6]!==o||t[7]!==s?(c=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8];let l;return t[9]!==a||t[10]!==c?(l=(0,Z.jsxs)(`div`,{className:`flex flex-col items-start gap-3 @md/emptystate:flex-row @md/emptystate:items-center @md/emptystate:gap-4`,children:[a,c]}),t[9]=a,t[10]=c,t[11]=l):l=t[11],l}function NS({isOnboarding:e,isEmbedded:t}){return e?{title:{id:`6h4zVU`},subtitle:t?{id:`vGeNNQ`}:{id:`qpQwGC`}}:{title:{id:`FOGD7m`},subtitle:t?{id:`3DTatP`}:{id:`MqQoV-`}}}var PS=`open-knowledge:create-top-level-file`;function FS(e={}){window.dispatchEvent(new CustomEvent(PS,{detail:e}))}function IS(e){let t=t=>{let n=t.detail;e(n??{})};return window.addEventListener(PS,t),()=>window.removeEventListener(PS,t)}function LS(e){let t=(0,$.c)(28),{celebrateSignal:n,onAddStarterPack:r}=e,{_:i}=kt(),a=Po(),{title:o,subtitle:s}=NS({isOnboarding:!1,isEmbedded:a}),c=mo(),l;t[0]!==c.data||t[1]!==c.status?(l=c.status===`ready`?c.data:[],t[0]=c.data,t[1]=c.status,t[2]=l):l=t[2];let u=l,d=c.status===`loading`||c.status===`idle`,f=c.status===`error`,p=MS,m=i(o),h=i(s),g;t[3]!==p||t[4]!==n||t[5]!==m||t[6]!==h?(g=(0,Z.jsx)(p,{title:m,subtitle:h,celebrateSignal:n}),t[3]=p,t[4]=n,t[5]=m,t[6]=h,t[7]=g):g=t[7];let _;t[8]===a?_=t[9]:(_=a?(0,Z.jsx)(ux,{scenario:`existing-repo`}):(0,Z.jsx)(eS,{scenario:`existing-repo`}),t[8]=a,t[9]=_);let v;t[10]!==u||t[11]!==f||t[12]!==d?(v=d||f||u.length>0?(0,Z.jsx)(BS,{templates:u,loading:d,error:f,onSelect:zS}):null,t[10]=u,t[11]=f,t[12]=d,t[13]=v):v=t[13];let y,b;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(nt,{"aria-hidden":`true`,className:`size-3`}),b=(0,Z.jsx)(J,{id:`IajAbS`}),t[14]=y,t[15]=b):(y=t[14],b=t[15]);let x;t[16]===r?x=t[17]:(x=(0,Z.jsxs)(Jr,{onClick:r,variant:`link-muted`,size:`xs`,className:`font-mono text-xs uppercase tracking-wider`,children:[y,b]}),t[16]=r,t[17]=x);let S;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(Jr,{variant:`link-muted`,className:`justify-end`,size:`sm`,onClick:RS,children:(0,Z.jsx)(J,{id:`L4Cdd9`,components:{0:(0,Z.jsx)(vi,{"aria-hidden":`true`,className:`size-3`})}})}),t[18]=S):S=t[18];let C;t[19]===x?C=t[20]:(C=(0,Z.jsxs)(`div`,{className:`-mt-6 flex w-full items-center justify-between gap-4`,children:[x,S]}),t[19]=x,t[20]=C);let w;t[21]!==C||t[22]!==v?(w=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-8`,children:[v,C]}),t[21]=C,t[22]=v,t[23]=w):w=t[23];let T;return t[24]!==w||t[25]!==g||t[26]!==_?(T=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-8 py-12 max-w-5xl my-auto`,children:[g,_,w]}),t[24]=w,t[25]=g,t[26]=_,t[27]=T):T=t[27],T}function RS(){return FS({initialDir:``})}function zS(e,t){return FS({template:{folder:e,name:t}})}function BS(e){let t=(0,$.c)(25),{templates:n,loading:r,error:i,onSelect:a}=e,{_:o}=kt(),c;t[0]===o?c=t[1]:(c=o({id:`_8quCH`}),t[0]=o,t[1]=c);let l;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`_8quCH`})}),t[2]=l):l=t[2];let u;t[3]!==o||t[4]!==i||t[5]!==r||t[6]!==n?(u=r||i?null:(0,Z.jsx)(s,{className:`text-2xs`,variant:`gray`,"aria-label":o({id:`X7u0xR`,values:{0:n.length}}),children:n.length}),t[3]=o,t[4]=i,t[5]=r,t[6]=n,t[7]=u):u=t[7];let d;t[8]===u?d=t[9]:(d=(0,Z.jsxs)(`header`,{className:`flex items-center gap-2 font-mono text-2xs uppercase tracking-wider text-muted-foreground`,children:[l,u]}),t[8]=u,t[9]=d);let f;t[10]===o?f=t[11]:(f=o({id:`irFGwu`}),t[10]=o,t[11]=f);let p;t[12]!==i||t[13]!==r||t[14]!==a||t[15]!==n?(p=r?(0,Z.jsx)(`p`,{className:`p-4 text-1sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`Hl89Qd`})}):i?(0,Z.jsx)(`p`,{role:`alert`,className:`p-4 text-1sm text-destructive`,children:(0,Z.jsx)(J,{id:`54Y6Fg`})}):n.map(e=>(0,Z.jsx)(VS,{template:e,targetLabel:e.source_folder===``?`/`:`${e.source_folder}/`,onClick:()=>a(e.source_folder,e.name)},`${e.source_folder}/${e.name}`)),t[12]=i,t[13]=r,t[14]=a,t[15]=n,t[16]=p):p=t[16];let m;t[17]!==r||t[18]!==f||t[19]!==p?(m=(0,Z.jsx)(`div`,{className:`w-full overflow-hidden rounded-xl border border-border/60 bg-card`,children:(0,Z.jsx)(`section`,{"aria-busy":r,"aria-label":f,tabIndex:0,className:`subtle-scrollbar scroll-fade-mask flex max-h-[260px] w-full flex-col overflow-y-auto overscroll-contain focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50`,children:p})}),t[17]=r,t[18]=f,t[19]=p,t[20]=m):m=t[20];let h;return t[21]!==c||t[22]!==d||t[23]!==m?(h=(0,Z.jsxs)(`section`,{"aria-label":c,className:`flex w-full flex-col gap-3`,children:[d,m]}),t[21]=c,t[22]=d,t[23]=m,t[24]=h):h=t[24],h}function VS(e){let t=(0,$.c)(24),{template:n,targetLabel:r,onClick:i}=e,{_:a}=kt(),o;t[0]!==n.name||t[1]!==n.title?(o=n.title?.trim()||n.name,t[0]=n.name,t[1]=n.title,t[2]=o):o=t[2];let s=o,c=`${n.name}.md`,l=n.source_folder===``,u;t[3]!==a||t[4]!==s||t[5]!==c||t[6]!==l||t[7]!==r?(u=a(l?{id:`89TtiD`,values:{displayTitle:s,fileName:c}}:{id:`0_J12R`,values:{displayTitle:s,fileName:c,targetLabel:r}}),t[3]=a,t[4]=s,t[5]=c,t[6]=l,t[7]=r,t[8]=u):u=t[8];let d=u,f;t[9]===s?f=t[10]:(f=(0,Z.jsx)(`span`,{className:`truncate text-sm font-medium leading-tight text-foreground/80`,children:s}),t[9]=s,t[10]=f);let p;t[11]===c?p=t[12]:(p=(0,Z.jsx)(`span`,{className:`truncate font-mono text-1sm font-normal text-muted-foreground`,children:c}),t[11]=c,t[12]=p);let m;t[13]!==f||t[14]!==p?(m=(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-2`,children:[f,p]}),t[13]=f,t[14]=p,t[15]=m):m=t[15];let h=`shrink-0 font-mono text-1sm ${l?`text-muted-foreground/70`:`text-muted-foreground`}`,g;t[16]!==h||t[17]!==r?(g=(0,Z.jsx)(`span`,{className:h,children:r}),t[16]=h,t[17]=r,t[18]=g):g=t[18];let _;return t[19]!==d||t[20]!==i||t[21]!==m||t[22]!==g?(_=(0,Z.jsxs)(Jr,{type:`button`,variant:`ghost`,onClick:i,"aria-label":d,className:`group flex h-auto w-full items-center justify-between gap-4 rounded-none p-4 text-left transition-colors hover:bg-muted/50 focus-visible:bg-muted/50`,children:[m,g]}),t[19]=d,t[20]=i,t[21]=m,t[22]=g,t[23]=_):_=t[23],_}function HS(e){let t=(0,$.c)(25),{terminalDock:n}=e,r=n===void 0?null:n,[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(void 0),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(0),f=(0,Q.useRef)(!1),p=(0,Q.useRef)(void 0),m,h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>{let e=!1,t=async function(){try{let{ok:t,body:n}=await sl();if(e)return;let r=t?pn.safeParse(n):null;r?.success?(l(GS(r.data.documents)),f.current=!0):f.current||=(l(1),!0)}catch{!e&&!f.current&&(l(1),f.current=!0)}};t();let n=dl(e=>{e.includes(`files`)&&t()});return()=>{e=!0,n(),clearTimeout(p.current)}},h=[],t[0]=m,t[1]=h):(m=t[0],h=t[1]),(0,Q.useEffect)(m,h);let g;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(g=function(){clearTimeout(p.current),p.current=setTimeout(()=>d(WS),500),sl().then(e=>{let{ok:t,body:n}=e;if(!t)return;let r=pn.safeParse(n);r.success&&l(GS(r.data.documents))}).catch(US)},t[2]=g):g=t[2];let _=g,v=c!==null,y=c===0,b;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(b=function(e){a(e),e||s(void 0)},t[3]=b):b=t[3];let x=b;if(r!==null){let e=r===`bottom`?`justify-end`:`justify-center`,n;t[4]===e?n=t[5]:(n=X(`@container/emptystate flex min-h-0 flex-1 flex-col items-center pb-8 pt-10`,e),t[4]=e,t[5]=n);let i;t[6]!==u||t[7]!==y||t[8]!==v?(i=v?(0,Z.jsx)(KS,{isOnboarding:y,celebrateSignal:u}):null,t[6]=u,t[7]=y,t[8]=v,t[9]=i):i=t[9];let a;t[10]===i?a=t[11]:(a=(0,Z.jsx)(`div`,{className:`flex w-full flex-col items-center px-4 @md/emptystate:px-10 @2xl/emptystate:px-16`,children:i}),t[10]=i,t[11]=a);let o;return t[12]!==n||t[13]!==a?(o=(0,Z.jsx)(`div`,{className:n,children:a}),t[12]=n,t[13]=a,t[14]=o):o=t[14],o}let S;t[15]!==u||t[16]!==y||t[17]!==v?(S=v?y?(0,Z.jsx)(qS,{celebrateSignal:u,onPackSelect:e=>{s(e),a(!0)}}):(0,Z.jsx)(LS,{celebrateSignal:u,onAddStarterPack:()=>{a(!0)}}):null,t[15]=u,t[16]=y,t[17]=v,t[18]=S):S=t[18];let C;t[19]!==o||t[20]!==i?(C=(0,Z.jsx)(Yh,{open:i,onOpenChange:x,onSeedApplied:_,initialPackId:o}),t[19]=o,t[20]=i,t[21]=C):C=t[21];let w;return t[22]!==S||t[23]!==C?(w=(0,Z.jsx)(`div`,{className:`@container/emptystate flex min-h-0 flex-1 flex-col items-center overflow-y-auto subtle-scrollbar`,children:(0,Z.jsxs)(`div`,{className:`flex w-full flex-1 flex-col items-center px-4 @md/emptystate:px-10 @2xl/emptystate:px-16`,children:[S,C]})}),t[22]=S,t[23]=C,t[24]=w):w=t[24],w}function US(){}function WS(e){return e+1}function GS(e){return Xc(e).filter(e=>e.kind===`document`||e.kind===`folder`).length}function KS(e){let t=(0,$.c)(15),{isOnboarding:n,celebrateSignal:r}=e,{_:i}=kt(),a=Po(),o,s,c,l;if(t[0]!==i||t[1]!==a||t[2]!==n){let{title:e,subtitle:r}=NS({isOnboarding:n,isEmbedded:a});l=`w-full max-w-5xl`,o=MS,s=i(e),c=i(r),t[0]=i,t[1]=a,t[2]=n,t[3]=o,t[4]=s,t[5]=c,t[6]=l}else o=t[3],s=t[4],c=t[5],l=t[6];let u;t[7]!==o||t[8]!==r||t[9]!==s||t[10]!==c?(u=(0,Z.jsx)(o,{title:s,subtitle:c,celebrateSignal:r}),t[7]=o,t[8]=r,t[9]=s,t[10]=c,t[11]=u):u=t[11];let d;return t[12]!==l||t[13]!==u?(d=(0,Z.jsx)(`div`,{className:l,children:u}),t[12]=l,t[13]=u,t[14]=d):d=t[14],d}function qS(e){let t=(0,$.c)(29),{celebrateSignal:n,onPackSelect:r}=e,{_:i}=kt(),a=Po(),o,s,c,l;if(t[0]!==i||t[1]!==a){let{title:e,subtitle:n}=NS({isOnboarding:!0,isEmbedded:a});l=`flex w-full flex-col gap-10 py-12 max-w-5xl my-auto`,o=MS,s=i(e),c=i(n),t[0]=i,t[1]=a,t[2]=o,t[3]=s,t[4]=c,t[5]=l}else o=t[2],s=t[3],c=t[4],l=t[5];let u;t[6]!==o||t[7]!==n||t[8]!==s||t[9]!==c?(u=(0,Z.jsx)(o,{title:s,subtitle:c,celebrateSignal:n}),t[6]=o,t[7]=n,t[8]=s,t[9]=c,t[10]=u):u=t[10];let d;t[11]===a?d=t[12]:(d=a?(0,Z.jsx)(ux,{scenario:`new-project`}):(0,Z.jsx)(eS,{scenario:`new-project`}),t[11]=a,t[12]=d);let f;t[13]!==i||t[14]!==a?(f=i(a?{id:`GubkSu`}:{id:`xeXS4P`}),t[13]=i,t[14]=a,t[15]=f):f=t[15];let p;t[16]===f?p=t[17]:(p=(0,Z.jsx)(YS,{label:f}),t[16]=f,t[17]=p);let m;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(m=[`okf`,`entity-vault`],t[18]=m):m=t[18];let h;t[19]===r?h=t[20]:(h=(0,Z.jsx)(Uh,{onPackSelect:r,onCreateBlankFile:JS,collapsedPackIds:m}),t[19]=r,t[20]=h);let g;t[21]!==p||t[22]!==h?(g=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-3`,children:[p,h]}),t[21]=p,t[22]=h,t[23]=g):g=t[23];let _;return t[24]!==g||t[25]!==l||t[26]!==u||t[27]!==d?(_=(0,Z.jsxs)(`div`,{className:l,children:[u,d,g]}),t[24]=g,t[25]=l,t[26]=u,t[27]=d,t[28]=_):_=t[28],_}function JS(){return FS()}function YS(e){let t=(0,$.c)(13),{label:n}=e,{_:r}=kt(),i;t[0]===n?i=t[1]:(i=(0,Z.jsx)(`span`,{className:`font-mono text-2xs uppercase tracking-wider text-muted-foreground whitespace-nowrap`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=r({id:`jAMpHn`}),t[2]=r,t[3]=a);let o;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(ts,{className:`size-3.5`,"aria-hidden":!0}),t[4]=o):o=t[4];let s;t[5]===a?s=t[6]:(s=(0,Z.jsx)(Ts,{className:`text-muted-foreground transition-colors hover:text-foreground`,"aria-label":a,"data-testid":`starter-pack-info`,children:o}),t[5]=a,t[6]=s);let c;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(Es,{className:`max-w-xs`,children:(0,Z.jsx)(`p`,{className:`leading-relaxed wrap-break-word`,children:(0,Z.jsx)(J,{id:`k4CuuV`})})}),t[7]=c):c=t[7];let l;t[8]===s?l=t[9]:(l=(0,Z.jsxs)(Os,{children:[s,c]}),t[8]=s,t[9]=l);let u;return t[10]!==i||t[11]!==l?(u=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[i,l]}),t[10]=i,t[11]=l,t[12]=u):u=t[12],u}function XS(e){return e===``?`.ok/frontmatter.yml`:`${e}/.ok/frontmatter.yml`}function ZS(e){let t=(0,$.c)(70),{folderPath:n,state:r,onChange:i}=e,{_:a}=kt(),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(null);if(r.status===`idle`||r.status===`loading`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card p-4 space-y-3`,children:[(0,Z.jsx)($S,{}),(0,Z.jsx)(Ka,{className:`h-7 w-full`}),(0,Z.jsx)(Ka,{className:`h-7 w-full`}),(0,Z.jsx)(Ka,{className:`h-7 w-full`})]}),t[0]=e):e=t[0],e}if(r.status===`error`){let{message:e}=r,n;return t[1]===e?n=t[2]:(n=(0,Z.jsx)(`section`,{className:`rounded-lg border border-destructive/30 bg-destructive/5 p-4 text-sm text-destructive`,role:`alert`,children:(0,Z.jsx)(J,{id:`lzmtKp`,values:{message:e}})}),t[1]=e,t[2]=n),n}let f;t[3]===r.data.frontmatterLocal?f=t[4]:(f=r.data.frontmatterLocal??{},t[3]=r.data.frontmatterLocal,t[4]=f);let p=f,m;t[5]===r.data.folder.path?m=t[6]:(m=XS(r.data.folder.path),t[5]=r.data.folder.path,t[6]=m);let h=m,g;t[7]===p?g=t[8]:(g=Object.keys(p),t[7]=p,t[8]=g);let _=g,v;t[9]!==a||t[10]!==n||t[11]!==i?(v=async function(e,t){let r=await Go(n,{[e]:t});if(!r.ok){let{error:e}=r;hs.error(a({id:`xXo8FT`,values:{error:e}}));return}i()},t[9]=a,t[10]=n,t[11]=i,t[12]=v):v=t[12];let y=v,b;t[13]!==a||t[14]!==n||t[15]!==i?(b=async function(e){let t=await Go(n,{[e]:null});if(!t.ok){let{error:e}=t;hs.error(a({id:`ZU8VV_`,values:{error:e}}));return}i()},t[13]=a,t[14]=n,t[15]=i,t[16]=b):b=t[16];let x=b,S;t[17]!==y||t[18]!==p?(S=function(e,t){let n=p[e];y(e,Qi(n,t))},t[17]=y,t[18]=p,t[19]=S):S=t[19];let C=S,w;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(w=function(){l({name:``,type:`text`,value:``,error:null}),s(!1)},t[20]=w):w=t[20];let T=w,E;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(E=function(e){l(t=>{if(!t)return t;let n=e===`date`?new Date().toISOString().slice(0,10):qi[e];return{...t,type:e,value:n,error:null}})},t[21]=E):E=t[21];let D=E,O;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(O=function(e){l(t=>t&&{...t,value:e})},t[22]=O):O=t[22];let k=O,A;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(e){l(t=>t&&{...t,name:e,error:null})},t[23]=A):A=t[23];let j=A,M;t[24]!==a||t[25]!==c||t[26]!==n||t[27]!==i||t[28]!==p?(M=async function(e){if(!c)return;let t=e??c.value,r=c.name.trim();if(!r){l({...c,value:t,error:a({id:`8_brI5`})});return}if(Un(t)){l({...c,value:t,error:a({id:`hXUWyd`})});return}if(Object.hasOwn(p,r)){l({...c,value:t,error:a({id:`CTJLpz`,values:{trimmed:r}})});return}let o=await Go(n,{[r]:t});if(!o.ok){l({...c,value:t,error:o.error});return}l(null),i()},t[24]=a,t[25]=c,t[26]=n,t[27]=i,t[28]=p,t[29]=M):M=t[29];let N=M,P;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(P=function(e){d({key:e,draft:e,error:null})},t[30]=P):P=t[30];let F=P,I;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(I=function(e){d(t=>t&&{...t,draft:e,error:null})},t[31]=I):I=t[31];let L=I,R;t[32]!==a||t[33]!==n||t[34]!==i||t[35]!==p||t[36]!==u?(R=async function(){if(!u)return;let e=u.draft.trim();if(!e){d({...u,error:a({id:`8_brI5`})});return}if(e===u.key){d(null);return}if(Object.hasOwn(p,e)){d({...u,error:a({id:`CTJLpz`,values:{trimmed:e}})});return}let t=p[u.key],r=await Go(n,{[u.key]:null,[e]:t});if(!r.ok){d({...u,error:r.error});return}d(null),i()},t[32]=a,t[33]=n,t[34]=i,t[35]=p,t[36]=u,t[37]=R):R=t[37];let z=R,B;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(B=function(){d(null)},t[38]=B):B=t[38];let V=B,H=!o,U;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(U=e=>s(!e),t[39]=U):U=t[39];let W=`size-3 transition-transform ${o?``:`rotate-90`}`,G;t[40]===W?G=t[41]:(G=(0,Z.jsx)(na,{className:W,"aria-hidden":!0}),t[40]=W,t[41]=G);let K;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`vQIVHc`})}),t[42]=K):K=t[42];let ee;t[43]===G?ee=t[44]:(ee=(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:[G,K]}),t[43]=G,t[44]=ee);let te;t[45]===h?te=t[46]:(te=(0,Z.jsx)(`code`,{className:`text-xs text-muted-foreground font-mono cursor-text select-text`,onClick:QS,children:h}),t[45]=h,t[46]=te);let ne;t[47]!==ee||t[48]!==te?(ne=(0,Z.jsxs)(js,{className:`flex w-full cursor-pointer items-center justify-between gap-2 px-3 py-2.5 data-[state=open]:border-b border-border`,children:[ee,te]}),t[47]=ee,t[48]=te,t[49]=ne):ne=t[49];let re;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Z.jsx)(`p`,{className:`px-1 pb-2 text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`hSBIG-`})}),t[50]=re):re=t[50];let ie;t[51]!==c||t[52]!==y||t[53]!==z||t[54]!==_||t[55]!==p||t[56]!==x||t[57]!==u||t[58]!==C?(ie=_.length===0&&!c?(0,Z.jsx)(`p`,{className:`px-1 py-1 text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`4c_a6S`})}):_.map(e=>{let t=p[e];return(0,Z.jsx)(Xi,{keyName:e,value:t,declared:Gi(t,Gr(t)),rename:{state:u?.key===e?u:null,onBegin:()=>F(e),onChangeDraft:L,onCommit:z,onCancel:V},badge:null,onCommit:t=>void y(e,t),onChangeType:t=>C(e,t),onRemove:()=>void x(e)},e)}),t[51]=c,t[52]=y,t[53]=z,t[54]=_,t[55]=p,t[56]=x,t[57]=u,t[58]=C,t[59]=ie):ie=t[59];let q;t[60]!==c||t[61]!==N?(q=c?(0,Z.jsx)(Ji,{draft:c,onChangeName:j,onChangeType:D,onChangeValue:k,onCommit:e=>void N(e),onCancel:()=>l(null)}):(0,Z.jsx)(`div`,{className:`mt-1 flex flex-wrap items-center gap-1`,children:(0,Z.jsxs)(Jr,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`add-property-trigger`,onClick:()=>T(),className:`flex items-center gap-1.5 rounded px-2 py-1 font-medium text-sm hover:bg-muted/50 hover:text-foreground`,children:[(0,Z.jsx)(nt,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`G8t9NN`})})]})}),t[60]=c,t[61]=N,t[62]=q):q=t[62];let ae;t[63]!==ie||t[64]!==q?(ae=(0,Z.jsx)(As,{children:(0,Z.jsxs)(`div`,{className:`px-2 py-2`,children:[re,ie,q]})}),t[63]=ie,t[64]=q,t[65]=ae):ae=t[65];let oe;return t[66]!==H||t[67]!==ne||t[68]!==ae?(oe=(0,Z.jsx)(`section`,{className:`rounded-lg border bg-card`,children:(0,Z.jsxs)(Ms,{open:H,onOpenChange:U,children:[ne,ae]})}),t[66]=H,t[67]=ne,t[68]=ae,t[69]=oe):oe=t[69],oe}function QS(e){return e.stopPropagation()}function $S(){let e=(0,$.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(Kd,{className:`size-4 text-muted-foreground`,"aria-hidden":!0}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[t,(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(J,{id:`vQIVHc`})})]}),e[1]=n):n=e[1],n}function eC(e){let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);return t<60?Gc._({id:`xOTzt5`}):t<3600?Gc._({id:`zbymaY`,values:{0:Math.floor(t/60)}}):t<86400?Gc._({id:`optX0N`,values:{0:Math.floor(t/3600)}}):t<86400*7?Gc._({id:`l1l8sj`,values:{0:Math.floor(t/86400)}}):new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function tC(e){return(e.split(`/`).pop()??e).replace(/\.md$/,``)}function nC(e){let t=e.message,n=t.indexOf(`: `),r=n===-1?t:t.slice(0,n),i=n===-1?``:t.slice(n+2);switch(r){case`template-create`:return{Icon:ro,label:Gc._({id:`QR5SP1`}),detail:tC(i)};case`template-edit`:return{Icon:Lo,label:Gc._({id:`-LHLx7`}),detail:tC(i)};case`template-delete`:return{Icon:as,label:Gc._({id:`_gkGSK`}),detail:tC(i)};case`template-rename`:case`template-move`:{let[e,t]=i.split(` -> `);return{Icon:xd,label:Gc._({id:`KPW5WC`}),detail:`${tC(e??``)} → ${tC(t??i)}`}}case`folder-frontmatter-edit`:return{Icon:Kd,label:Gc._({id:`_tekeB`}),detail:``};case`folder-frontmatter-delete`:return{Icon:Kd,label:Gc._({id:`ZWxfrc`}),detail:``};case`folder-create`:return{Icon:Kd,label:Gc._({id:`ZQLDTl`}),detail:``};default:return{Icon:$d,label:r.replace(/-/g,` `),detail:tC(i)}}}function rC(e){return e.contributors.length>0?e.contributors[0].name:e.author===`openknowledge-service`||e.author===`server`?Gc._({id:`B2DrPb`}):e.author||Gc._({id:`Ef7StM`})}function iC(e){let t=(0,$.c)(15),{folderPath:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=[],t[0]=r):r=t[0];let[i,a]=(0,Q.useState)(r),[o,c]=(0,Q.useState)(!0),[l,u]=(0,Q.useState)(!1),d,f;if(t[1]===n?(d=t[2],f=t[3]):(d=()=>{let e=!1,t=async function(){try{let t=await fetch(`/api/history?folder=${encodeURIComponent(n)}&limit=50`);if(e)return;if(!t.ok){u(!0),c(!1);return}let r=await t.json();if(e)return;a(r.entries??[]),u(!1),c(!1)}catch(t){e||(console.warn(`[FolderTimelineCard] failed to load folder timeline:`,t),u(!0),c(!1))}};c(!0),t();let r=ll(t);return()=>{e=!0,r()}},f=[n],t[1]=n,t[2]=d,t[3]=f),(0,Q.useEffect)(d,f),l||!o&&i.length===0)return null;let p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(J,{id:`XJOV1Y`})}),t[4]=p):p=t[4];let m;t[5]===i.length?m=t[6]:(m=i.length>0?(0,Z.jsx)(s,{className:`text-xs`,variant:`secondary`,children:i.length}):null,t[5]=i.length,t[6]=m);let h;t[7]===m?h=t[8]:(h=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border px-3 py-1`,children:[p,m]}),t[7]=m,t[8]=h);let g;t[9]!==i||t[10]!==o?(g=(0,Z.jsx)(`div`,{className:`px-3 py-2.5`,children:o?(0,Z.jsxs)(`div`,{className:`space-y-2`,role:`status`,"aria-busy":`true`,children:[(0,Z.jsx)(Ka,{className:`h-8 w-full`}),(0,Z.jsx)(Ka,{className:`h-8 w-full`})]}):(0,Z.jsx)(`ul`,{className:`space-y-1`,children:i.map(aC)})}),t[9]=i,t[10]=o,t[11]=g):g=t[11];let _;return t[12]!==h||t[13]!==g?(_=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card`,"data-testid":`folder-timeline-card`,children:[h,g]}),t[12]=h,t[13]=g,t[14]=_):_=t[14],_}function aC(e){let{Icon:t,label:n,detail:r}=nC(e);return(0,Z.jsxs)(`li`,{className:`flex items-center gap-2.5 rounded-md px-2 py-1.5 text-sm`,children:[(0,Z.jsx)(t,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":!0}),(0,Z.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[(0,Z.jsx)(`span`,{className:`text-foreground`,children:n}),r?(0,Z.jsx)(`code`,{className:`ml-1.5 font-mono text-xs text-muted-foreground`,children:r}):null]}),(0,Z.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1 text-xs text-muted-foreground`,children:[(0,Z.jsx)(Kf,{className:`size-3`,"aria-hidden":!0}),rC(e)]}),(0,Z.jsx)(`time`,{className:`shrink-0 text-xs text-muted-foreground/80`,dateTime:e.timestamp,title:new Date(e.timestamp).toLocaleString(),children:eC(e.timestamp)})]},e.sha)}function oC(e){let t=e.split(`/`).pop();return t?`${e}/${t}`:null}function sC(e,t){let n=t.get(`${e}/index`);if(n)return n;let r=oC(e);if(r){let e=t.get(r);if(e)return e}return e.split(`/`).pop()??e}function cC(e,t,n){let r=n.get(e);return r&&r!==e?r:t}function lC(e,t){let n=e===``?``:`${e}/`,r=[...t.folderPaths].filter(e=>e.startsWith(n)).map(e=>({path:e,rel:e.slice(n.length)})).filter(e=>e.rel.length>0&&!e.rel.includes(`/`)).map(({path:e,rel:n})=>({kind:`folder`,path:e,name:n,title:sC(e,t.pageTitles)})),i=[...t.pages].filter(e=>e.startsWith(n)).map(e=>({docName:e,rel:e.slice(n.length)})).filter(e=>e.rel.length>0&&!e.rel.includes(`/`)).map(({docName:e,rel:n})=>{let r=t.pageMeta.get(e);return{kind:`file`,path:e,name:n,title:cC(e,n,t.pageTitles),size:r?.size??0,modified:r?.modified??``}}),a=[...r,...i].sort((e,t)=>e.kind===t.kind?e.title.localeCompare(t.title)||e.name.localeCompare(t.name):e.kind===`folder`?-1:1);return{title:sC(e,t.pageTitles),children:a}}function uC(e){let t=(0,$.c)(41),{folderPath:n,state:r,onChange:i,folderConfigHandle:a}=e,[o,c]=(0,Q.useState)(null),[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(!1);if(r.status===`idle`||r.status===`loading`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card px-3 py-2.5 space-y-3`,children:[(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(J,{id:`-QCLWk`})})}),(0,Z.jsx)(Ka,{className:`h-12 w-full`}),(0,Z.jsx)(Ka,{className:`h-12 w-full`})]}),t[0]=e):e=t[0],e}if(r.status===`error`){let{message:e}=r,n;return t[1]===e?n=t[2]:(n=(0,Z.jsx)(`section`,{className:`rounded-lg border border-destructive/30 bg-destructive/5 p-4 text-sm text-destructive`,role:`alert`,children:(0,Z.jsx)(J,{id:`iDZtvM`,values:{message:e}})}),t[1]=e,t[2]=n),n}let p;t[3]===r.data.folder.templates_available?p=t[4]:(p=r.data.folder.templates_available??[],t[3]=r.data.folder.templates_available,t[4]=p);let m=p,h;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(J,{id:`-QCLWk`})}),t[5]=h):h=t[5];let g;t[6]===m.length?g=t[7]:(g=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[h,(0,Z.jsx)(s,{className:`text-xs`,variant:`secondary`,children:m.length})]}),t[6]=m.length,t[7]=g);let _;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsxs)(Jr,{variant:`ghost`,className:`font-mono uppercase`,size:`sm`,onClick:()=>f(!0),children:[(0,Z.jsx)(nt,{className:`size-3.5`,"aria-hidden":!0}),(0,Z.jsx)(J,{id:`G1Gw0v`})]}),t[8]=_):_=t[8];let v;t[9]===g?v=t[10]:(v=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-border px-3 py-1`,children:[g,_]}),t[9]=g,t[10]=v);let y;t[11]===m?y=t[12]:(y=(0,Z.jsx)(`div`,{className:`px-3 py-2.5`,children:m.length===0?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`MZSBsh`})}):(0,Z.jsx)(`ul`,{className:`space-y-1`,children:m.map(e=>(0,Z.jsx)(Ma,{template:e,onCreate:()=>u(e.name),onEdit:()=>Zo(gt(e.source_folder,e.name)),onDelete:()=>c(e),badge:e.scope===`inherited`?(0,Z.jsx)(Wi,{source:e.source_folder,target:`templates/${e.name}.md`}):void 0},e.path))})}),t[11]=m,t[12]=y);let b;t[13]!==v||t[14]!==y?(b=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card`,children:[v,y]}),t[13]=v,t[14]=y,t[15]=b):b=t[15];let x;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(x=e=>{e||c(null)},t[16]=x):x=t[16];let S;t[17]!==o||t[18]!==i?(S=(0,Z.jsx)(qa,{template:o,onOpenChange:x,onDeleted:i}),t[17]=o,t[18]=i,t[19]=S):S=t[19];let C;t[20]===m?C=t[21]:(C=new Set(m.map(dC)),t[20]=m,t[21]=C);let w;t[22]!==n||t[23]!==i?(w=e=>{i(),Zo(gt(n,e))},t[22]=n,t[23]=i,t[24]=w):w=t[24];let T;t[25]!==n||t[26]!==d||t[27]!==C||t[28]!==w?(T=(0,Z.jsx)(Ia,{folderPath:n,existingNames:C,open:d,onOpenChange:f,onCreated:w}),t[25]=n,t[26]=d,t[27]=C,t[28]=w,t[29]=T):T=t[29];let E=l!==null,D;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(D=e=>{e||u(null)},t[30]=D):D=t[30];let O=l??void 0,k;t[31]!==a||t[32]!==n||t[33]!==E||t[34]!==O?(k=(0,Z.jsx)(xh,{open:E,onOpenChange:D,kind:`file`,initialDir:n,initialTemplate:O,folderConfig:a}),t[31]=a,t[32]=n,t[33]=E,t[34]=O,t[35]=k):k=t[35];let A;return t[36]!==T||t[37]!==k||t[38]!==b||t[39]!==S?(A=(0,Z.jsxs)(Z.Fragment,{children:[b,S,T,k]}),t[36]=T,t[37]=k,t[38]=b,t[39]=S,t[40]=A):A=t[40],A}function dC(e){return e.name}function fC(e){let t=(0,$.c)(14),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,containerClassName:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=X(`relative w-full overflow-x-auto subtle-scrollbar`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=X(`w-full caption-bottom text-sm`,n),t[6]=n,t[7]=o);let s;t[8]!==i||t[9]!==o?(s=(0,Z.jsx)(`table`,{"data-slot":`table`,className:o,...i}),t[8]=i,t[9]=o,t[10]=s):s=t[10];let c;return t[11]!==a||t[12]!==s?(c=(0,Z.jsx)(`div`,{"data-slot":`table-container`,className:a,children:s}),t[11]=a,t[12]=s,t[13]=c):c=t[13],c}function pC(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(`[&_tr]:border-b`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`thead`,{"data-slot":`table-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function mC(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(`[&_tr:last-child]:border-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`tbody`,{"data-slot":`table-body`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function hC(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,noHover:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=(i===void 0?!1:i)&&`hover:bg-transparent`,o;t[4]!==n||t[5]!==a?(o=X(`hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors`,a,n),t[4]=n,t[5]=a,t[6]=o):o=t[6];let s;return t[7]!==r||t[8]!==o?(s=(0,Z.jsx)(`tr`,{"data-slot":`table-row`,className:o,...r}),t[7]=r,t[8]=o,t[9]=s):s=t[9],s}function gC(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,scope:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`col`:i,o;t[4]===n?o=t[5]:(o=X(`font-mono uppercase text-xs text-muted-foreground h-10 px-4 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]`,n),t[4]=n,t[5]=o);let s;return t[6]!==r||t[7]!==a||t[8]!==o?(s=(0,Z.jsx)(`th`,{"data-slot":`table-head`,scope:a,className:o,...r}),t[6]=r,t[7]=a,t[8]=o,t[9]=s):s=t[9],s}function _C(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(`py-3 px-4 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`td`,{"data-slot":`table-cell`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function vC(e){if(!e)return`—`;let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/6e4);if(r<1)return Gc._({id:`xOTzt5`});if(r<60)return Gc._({id:`NRSLBe`,values:{diffMin:r}});let i=Math.floor(r/60);if(i<24)return Gc._({id:`hDKtoF`,values:{diffHrs:i}});let a=Math.floor(i/24);return a<30?Gc._({id:`QDZbvN`,values:{diffDays:a}}):t.toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`numeric`})}function yC(e,t,n){return[...e].sort((e,r)=>{if(e.kind!==r.kind)return e.kind===`folder`?-1:1;let i=0;switch(t){case`name`:i=e.title.localeCompare(r.title)||e.name.localeCompare(r.name);break;case`modified`:{let t=e.kind===`file`?e.modified:``,n=r.kind===`file`?r.modified:``;i=t.localeCompare(n);break}}return n===`asc`?i:-i})}function bC(e){let t=(0,$.c)(10),{label:n,sortKey:r,activeKey:i,activeDir:a,onSort:o}=e,s=i===r,c;t[0]!==o||t[1]!==r?(c=()=>o(r),t[0]=o,t[1]=r,t[2]=c):c=t[2];let l;t[3]!==a||t[4]!==s?(l=s?a===`asc`?(0,Z.jsx)(Ci,{className:`ml-1 size-3`}):(0,Z.jsx)(Ii,{className:`ml-1 size-3`}):(0,Z.jsx)(Sd,{className:`ml-1 size-3 text-muted-foreground/50`}),t[3]=a,t[4]=s,t[5]=l):l=t[5];let u;return t[6]!==n||t[7]!==c||t[8]!==l?(u=(0,Z.jsxs)(Jr,{variant:`ghost`,size:`sm`,className:`-ml-3 h-8 uppercase font-mono`,onClick:c,children:[n,l]}),t[6]=n,t[7]=c,t[8]=l,t[9]=u):u=t[9],u}function xC(e){let t=(0,$.c)(96),{folderPath:n}=e,{_:r}=kt(),{folderPaths:i,loading:a,pages:o,pageTitles:s,pageMeta:c}=ia(),l=vo(n),{state:u,refresh:d}=l,[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(`name`),[g,_]=(0,Q.useState)(`asc`);if(a){let e;t[0]===r?e=t[1]:(e=r({id:`X9VpsP`}),t[0]=r,t[1]=e);let n;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(Ka,{className:`size-5 rounded`}),(0,Z.jsx)(Ka,{className:`h-7 w-48`})]}),(0,Z.jsx)(Ka,{className:`h-9 w-20 rounded-md`})]}),t[2]=n):n=t[2];let i;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(Ka,{className:`h-4 w-16`}),t[3]=i):i=t[3];let a;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsxs)(`div`,{className:`mx-auto flex w-full max-w-4xl flex-col gap-6 px-6 py-8`,children:[n,(0,Z.jsxs)(`div`,{className:`rounded-lg border`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-4 border-b px-4 py-3`,children:[i,(0,Z.jsx)(`div`,{className:`ml-auto`,children:(0,Z.jsx)(Ka,{className:`h-4 w-20`})})]}),[`a`,`b`,`c`,`d`].map(wC)]})]}),t[4]=a):a=t[4];let o;return t[5]===e?o=t[6]:(o=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-start overflow-y-auto subtle-scrollbar`,role:`status`,"aria-busy":`true`,"aria-label":e,children:a}),t[5]=e,t[6]=o),o}let v,y,b,x,S,C,w,T,E,D,O;if(t[7]!==r||t[8]!==u||t[9]!==l||t[10]!==n||t[11]!==i||t[12]!==c||t[13]!==s||t[14]!==o||t[15]!==d||t[16]!==g||t[17]!==m){let e=lC(n,{pages:o,pageTitles:s,pageMeta:c,folderPaths:i}),a=yC(e.children,m,g),f=e.title||(n===``?r({id:`3aeN7X`}):e.title),k;t[29]===m?k=t[30]:(k=function(e){e===m?_(CC):(h(e),_(`asc`))},t[29]=m,t[30]=k);let A=k;O=`flex min-h-0 flex-1 items-start overflow-y-auto subtle-scrollbar`,C=`mx-auto flex w-full max-w-4xl flex-col gap-6 px-6 py-8`;let j;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Z.jsx)(Ro,{className:`size-5 text-muted-foreground`}),t[31]=j):j=t[31];let M=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[j,(0,Z.jsx)(`h1`,{className:`text-2xl font-light tracking-tight`,children:f})]}),N;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsxs)(Jr,{onClick:()=>p(!0),children:[(0,Z.jsx)(nt,{className:`size-4`}),(0,Z.jsx)(J,{id:`isRobC`})]}),t[32]=N):N=t[32],t[33]===M?w=t[34]:(w=(0,Z.jsx)(`div`,{className:`flex flex-col gap-6`,children:(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[M,N]})}),t[33]=M,t[34]=w),t[35]!==u||t[36]!==n||t[37]!==d?(T=(0,Z.jsx)(ZS,{folderPath:n,state:u,onChange:d}),t[35]=u,t[36]=n,t[37]=d,t[38]=T):T=t[38],t[39]!==u||t[40]!==l||t[41]!==n||t[42]!==d?(E=(0,Z.jsx)(uC,{folderPath:n,state:u,onChange:d,folderConfigHandle:l}),t[39]=u,t[40]=l,t[41]=n,t[42]=d,t[43]=E):E=t[43],t[44]===n?D=t[45]:(D=(0,Z.jsx)(iC,{folderPath:n}),t[44]=n,t[45]=D),S=`rounded-lg border`,y=fC;let P=m===`name`?g===`asc`?`ascending`:`descending`:`none`,F;t[46]===r?F=t[47]:(F=r({id:`6YtxFj`}),t[46]=r,t[47]=F);let I;t[48]!==A||t[49]!==g||t[50]!==m||t[51]!==F?(I=(0,Z.jsx)(bC,{label:F,sortKey:`name`,activeKey:m,activeDir:g,onSort:A}),t[48]=A,t[49]=g,t[50]=m,t[51]=F,t[52]=I):I=t[52];let L;t[53]!==P||t[54]!==I?(L=(0,Z.jsx)(gC,{"aria-sort":P,children:I}),t[53]=P,t[54]=I,t[55]=L):L=t[55];let R=m===`modified`?g===`asc`?`ascending`:`descending`:`none`,z;t[56]===r?z=t[57]:(z=r({id:`tgWuMB`}),t[56]=r,t[57]=z);let B;t[58]!==A||t[59]!==g||t[60]!==m||t[61]!==z?(B=(0,Z.jsx)(bC,{label:z,sortKey:`modified`,activeKey:m,activeDir:g,onSort:A}),t[58]=A,t[59]=g,t[60]=m,t[61]=z,t[62]=B):B=t[62];let V;t[63]!==R||t[64]!==B?(V=(0,Z.jsx)(gC,{className:`w-32`,"aria-sort":R,children:B}),t[63]=R,t[64]=B,t[65]=V):V=t[65],t[66]!==L||t[67]!==V?(x=(0,Z.jsx)(pC,{children:(0,Z.jsxs)(hC,{children:[L,V]})}),t[66]=L,t[67]=V,t[68]=x):x=t[68],v=mC,b=a.length?a.map(SC):(0,Z.jsx)(hC,{children:(0,Z.jsx)(_C,{colSpan:2,className:`h-24 text-center text-muted-foreground`,children:(0,Z.jsx)(J,{id:`Pkw7J9`})})}),t[7]=r,t[8]=u,t[9]=l,t[10]=n,t[11]=i,t[12]=c,t[13]=s,t[14]=o,t[15]=d,t[16]=g,t[17]=m,t[18]=v,t[19]=y,t[20]=b,t[21]=x,t[22]=S,t[23]=C,t[24]=w,t[25]=T,t[26]=E,t[27]=D,t[28]=O}else v=t[18],y=t[19],b=t[20],x=t[21],S=t[22],C=t[23],w=t[24],T=t[25],E=t[26],D=t[27],O=t[28];let k;t[69]!==v||t[70]!==b?(k=(0,Z.jsx)(v,{children:b}),t[69]=v,t[70]=b,t[71]=k):k=t[71];let A;t[72]!==y||t[73]!==k||t[74]!==x?(A=(0,Z.jsxs)(y,{children:[x,k]}),t[72]=y,t[73]=k,t[74]=x,t[75]=A):A=t[75];let j;t[76]!==A||t[77]!==S?(j=(0,Z.jsx)(`div`,{className:S,children:A}),t[76]=A,t[77]=S,t[78]=j):j=t[78];let M;t[79]!==j||t[80]!==C||t[81]!==w||t[82]!==T||t[83]!==E||t[84]!==D?(M=(0,Z.jsxs)(`div`,{className:C,children:[w,T,E,D,j]}),t[79]=j,t[80]=C,t[81]=w,t[82]=T,t[83]=E,t[84]=D,t[85]=M):M=t[85];let N;t[86]!==M||t[87]!==O?(N=(0,Z.jsx)(`div`,{className:O,children:M}),t[86]=M,t[87]=O,t[88]=N):N=t[88];let P;t[89]!==f||t[90]!==l||t[91]!==n?(P=(0,Z.jsx)(xh,{open:f,onOpenChange:p,kind:`file`,initialDir:n,folderConfig:l,suggestedName:`index`}),t[89]=f,t[90]=l,t[91]=n,t[92]=P):P=t[92];let F;return t[93]!==N||t[94]!==P?(F=(0,Z.jsxs)(Z.Fragment,{children:[N,P]}),t[93]=N,t[94]=P,t[95]=F):F=t[95],F}function SC(e){return(0,Z.jsxs)(hC,{children:[(0,Z.jsx)(_C,{children:(0,Z.jsxs)(`a`,{href:El(e.path),className:`flex items-center gap-2 rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:[e.kind===`folder`?(0,Z.jsx)(Jd,{className:`size-4 shrink-0 text-muted-foreground`}):(0,Z.jsx)(te,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.title})]})}),(0,Z.jsx)(_C,{className:`text-muted-foreground`,children:e.kind===`file`?vC(e.modified):`—`})]},e.path)}function CC(e){return e===`asc`?`desc`:`asc`}function wC(e){return(0,Z.jsxs)(`div`,{className:`flex items-center gap-3 border-b px-4 py-3 last:border-b-0`,children:[(0,Z.jsx)(Ka,{className:`size-4 rounded`}),(0,Z.jsx)(Ka,{className:`h-4 w-40`}),(0,Z.jsx)(`div`,{className:`ml-auto`,children:(0,Z.jsx)(Ka,{className:`h-4 w-16`})})]},e)}function TC(e){let t=(0,$.c)(24),{docName:n,size:r,limit:i,backNav:a}=e,o=a!==void 0,s=(0,Q.useRef)(null),c=(0,Q.useRef)(null),l,u;t[0]===o?(l=t[1],u=t[2]):(l=()=>{o?s.current?.focus():c.current?.focus()},u=[o],t[0]=o,t[1]=l,t[2]=u),(0,Q.useEffect)(l,u);let d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(`div`,{className:`flex size-16 items-center justify-center rounded-full border bg-muted/40 text-muted-foreground`,children:(0,Z.jsx)(Ud,{className:`size-9`,"aria-hidden":`true`})}),t[3]=d):d=t[3];let f=o?void 0:-1,p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(J,{id:`P3hnm0`}),t[4]=p):p=t[4];let m;t[5]===f?m=t[6]:(m=(0,Z.jsx)(`h2`,{ref:c,id:`large-file-title`,tabIndex:f,className:`text-2xl font-light text-balance outline-none`,children:p}),t[5]=f,t[6]=m);let h;t[7]===r?h=t[8]:(h=Fr(r),t[7]=r,t[8]=h);let g;t[9]===i?g=t[10]:(g=Fr(i),t[9]=i,t[10]=g);let _;t[11]!==n||t[12]!==h||t[13]!==g?(_=(0,Z.jsx)(`p`,{className:`max-w-md text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`GJH-AT`,values:{0:h,1:g,docName:n}})}),t[11]=n,t[12]=h,t[13]=g,t[14]=_):_=t[14];let v;t[15]!==m||t[16]!==_?(v=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[m,_]}),t[15]=m,t[16]=_,t[17]=v):v=t[17];let y;t[18]!==a||t[19]!==o?(y=o?(0,Z.jsxs)(Jr,{ref:s,variant:`default`,onClick:()=>a.onNavigateBack(a.previousDocName),children:[(0,Z.jsx)(Ni,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`CKyk7Q`})]}):null,t[18]=a,t[19]=o,t[20]=y):y=t[20];let b;return t[21]!==v||t[22]!==y?(b=(0,Z.jsxs)(`div`,{role:`status`,"aria-labelledby":`large-file-title`,"data-slot":`large-file-editor-state`,className:`flex h-full flex-col items-center justify-center gap-8 p-8 text-center`,children:[d,v,y]}),t[21]=v,t[22]=y,t[23]=b):b=t[23],b}function EC(e){let t=(0,$.c)(8),{docName:n}=e,[r,i]=(0,Q.useState)(DC),a,o;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>ee(e=>{i(t=>{if(t.has(e))return t;let n=new Set(t);return n.add(e),n})}),o=[],t[0]=a,t[1]=o):(a=t[0],o=t[1]),(0,Q.useEffect)(a,o),!r.has(n))return null;let s;t[2]===n?s=t[3]:(s=function(){Et(n)?.abort(),i(e=>{if(!e.has(n))return e;let t=new Set(e);return t.delete(n),t})},t[2]=n,t[3]=s);let c=s,l;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`A67Uwj`})}),t[4]=l):l=t[4];let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(J,{id:`dEgA5A`}),t[5]=u):u=t[5];let d;return t[6]===c?d=t[7]:(d=(0,Z.jsxs)(`div`,{className:`absolute inset-x-0 bottom-8 z-20 flex justify-center text-xs text-muted-foreground`,children:[l,(0,Z.jsx)(Jr,{variant:`link`,size:`sm`,className:`h-auto px-2 py-0 text-xs`,onClick:c,children:u})]}),t[6]=c,t[7]=d),d}function DC(){return new Set}function OC(e){let t=(0,$.c)(20),{nav:n}=e,{state:r,refetch:i}=Xr(n),a=(0,Q.useRef)(null),o=n.branch,s,c;t[0]===r.phase?(s=t[1],c=t[2]):(s=()=>{r.phase===`resolved`&&a.current?.querySelector(`button`)?.focus()},c=[r.phase],t[0]=r.phase,t[1]=s,t[2]=c),(0,Q.useEffect)(s,c);let l;t[3]===n.path?l=t[4]:(l=function(){window.location.hash=vl(Qr(n.path))},t[3]=n.path,t[4]=l);let u=l,d;t[5]!==o||t[6]!==n.kind?(d=function(e){$r.arm({kind:n.kind,path:e,branch:o}),window.location.hash=n.kind===`folder`?vl(e):El(e)},t[5]=o,t[6]=n.kind,t[7]=d):d=t[7];let f=d,p=r.phase===`pending`?`polite`:void 0,m=r.phase===`resolved`?r.resolution.verdict:void 0,h=r.phase===`pending`?`flex h-full flex-col items-center justify-center gap-3 p-8 text-center text-sm text-muted-foreground`:`flex h-full flex-col items-center justify-center gap-6 p-8 text-center`,g;t[8]!==u||t[9]!==n||t[10]!==f||t[11]!==i||t[12]!==r?(g=(0,Z.jsx)(ti,{nav:n,state:r,onBrowseFolder:u,onOpenRenamed:f,onEnableAutoSync:u,onSyncCompleted:i}),t[8]=u,t[9]=n,t[10]=f,t[11]=i,t[12]=r,t[13]=g):g=t[13];let _;return t[14]!==r.phase||t[15]!==p||t[16]!==m||t[17]!==h||t[18]!==g?(_=(0,Z.jsx)(`div`,{ref:a,role:`status`,"aria-live":p,"data-testid":`share-receive-miss-panel`,"data-phase":r.phase,"data-verdict":m,className:h,children:g}),t[14]=r.phase,t[15]=p,t[16]=m,t[17]=h,t[18]=g,t[19]=_):_=t[19],_}function kC(e){let t=(0,$.c)(24),{fileName:n,text:r}=e,i,a,o,s;if(t[0]!==r){let e=fn(r).body;s=ji,i=tt,a=!1,o=li().parseWithFallback(e),t[0]=r,t[1]=i,t[2]=a,t[3]=o,t[4]=s}else i=t[1],a=t[2],o=t[3],s=t[4];let c;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(c={attributes:{class:`pt-4 pb-4`}},t[5]=c):c=t[5];let l;t[6]!==i||t[7]!==a||t[8]!==o?(l={extensions:i,editable:a,content:o,editorProps:c},t[6]=i,t[7]=a,t[8]=o,t[9]=l):l=t[9];let u;t[10]===r?u=t[11]:(u=[r],t[10]=r,t[11]=u);let d=s(l,u),[f]=(0,Q.useState)(AC),p=(0,Q.useRef)(null),m,h;t[12]===f?(m=t[13],h=t[14]):(m=()=>{let e=p.current;if(e)return e.appendChild(f),()=>{f.parentNode===e&&e.removeChild(f)}},h=[f],t[12]=f,t[13]=m,t[14]=h),(0,Q.useLayoutEffect)(m,h);let g;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(`div`,{className:`editor-doc-scroll min-h-0 flex-1 overflow-auto`,children:(0,Z.jsx)(`div`,{className:`tiptap-editor`,children:(0,Z.jsx)(`div`,{ref:p,style:{display:`contents`}})})}),t[15]=g):g=t[15];let _;t[16]===d?_=t[17]:(_=(0,Z.jsx)(xi,{editor:d,className:`tiptap-editor-portal-content h-full`}),t[16]=d,t[17]=_);let v;t[18]!==f||t[19]!==_?(v=(0,Ed.createPortal)(_,f),t[18]=f,t[19]=_,t[20]=v):v=t[20];let y;return t[21]!==n||t[22]!==v?(y=(0,Z.jsxs)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":n,"data-skill-markdown-viewer":``,"data-skill-markdown-viewer-state":`loaded`,children:[g,v]}),t[21]=n,t[22]=v,t[23]=y):y=t[23],y}function AC(){let e=document.createElement(`div`);return e.style.display=`contents`,e}var jC=`data-skill-markdown`;function MC(e){let t=(0,$.c)(12),{scope:n,name:r,path:i,fileName:a}=e,o;t[0]!==r||t[1]!==i||t[2]!==n?(o={loadText:e=>Tc({scope:n,name:r,path:i},e)},t[0]=r,t[1]=i,t[2]=n,t[3]=o):o=t[3];let s=Qb(o);if(s.status===`loading`){let e;return t[4]===a?e=t[5]:(e=(0,Z.jsx)($b,{fileName:a,dataAttr:jC}),t[4]=a,t[5]=e),e}if(s.status===`error`){let e;return t[6]!==s.message||t[7]!==a?(e=(0,Z.jsx)(ex,{fileName:a,dataAttr:jC,message:s.message}),t[6]=s.message,t[7]=a,t[8]=e):e=t[8],e}let c;return t[9]!==s.content||t[10]!==a?(c=(0,Z.jsx)(kC,{fileName:a,text:s.content}),t[9]=s.content,t[10]=a,t[11]=c):c=t[11],c}var NC=new Set([`md`,`mdx`]);function PC(e){let t=(0,$.c)(19),{scope:n,name:r,path:i}=e,a;t[0]===i?a=t[1]:(a=i.split(`/`).pop()??i,t[0]=i,t[1]=a);let o=a,s=o.lastIndexOf(`.`),c,l;if(t[2]!==s||t[3]!==o?(c=s>=0?o.slice(s+1).toLowerCase():``,l=NC.has(c),t[2]=s,t[3]=o,t[4]=c,t[5]=l):(c=t[4],l=t[5]),l){let e;return t[6]!==o||t[7]!==r||t[8]!==i||t[9]!==n?(e=(0,Z.jsx)(MC,{scope:n,name:r,path:i,fileName:o}),t[6]=o,t[7]=r,t[8]=i,t[9]=n,t[10]=e):e=t[10],e}let u;t[11]!==r||t[12]!==i||t[13]!==n?(u=e=>Tc({scope:n,name:r,path:i},e),t[11]=r,t[12]=i,t[13]=n,t[14]=u):u=t[14];let d;return t[15]!==c||t[16]!==o||t[17]!==u?(d=(0,Z.jsx)(rx,{fileName:o,extension:c,loadText:u}),t[15]=c,t[16]=o,t[17]=u,t[18]=d):d=t[18],d}function FC(e){let t=null,n=()=>(t===null&&(t=e(),t.catch(()=>{})),t),r=(0,Q.lazy)(n);return r.preload=n,r}var IC=FC(()=>n(()=>import(`./SettingsDialogBody-CI2EJgcM.js`).then(e=>({default:e.SettingsDialogBody})),__vite__mapDeps([79,1,80,13,7,16,34,10,3,11,36,37,55,40,56,6,59,2,44,45,46,47,48,49,50,51,52,53,54,21,12,57,58,39,33,35,20,15,4,60,17,61,62,19,63,64,65,66,32,38,67,68,69,70,71,72,73,74,81,82,18,83,84,85,86,31,87,88,76,89,42,90,14]),import.meta.url));function LC(e){let t=(0,$.c)(9),{error:n}=e,{_:r}=kt(),i;t[0]!==r||t[1]!==n?(i=n instanceof Error&&/dynamically imported module|Failed to fetch/i.test(n.message)?r({id:`Y8ViJx`}):r({id:`3h5zMp`}),t[0]=r,t[1]=n,t[2]=i):i=t[2];let a=i,o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(`h3`,{id:`settings-body-error-title`,className:`font-heading text-base leading-none font-medium`,children:(0,Z.jsx)(J,{id:`hwFOFD`})}),t[3]=o):o=t[3];let s;t[4]===a?s=t[5]:(s=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[o,(0,Z.jsx)(`p`,{className:`max-w-xs text-sm text-muted-foreground`,children:a})]}),t[4]=a,t[5]=s);let c;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(Jr,{variant:`default`,onClick:RC,children:(0,Z.jsx)(J,{id:`HpK_8d`})}),t[6]=c):c=t[6];let l;return t[7]===s?l=t[8]:(l=(0,Z.jsxs)(`div`,{role:`alert`,"aria-labelledby":`settings-body-error-title`,"data-slot":`settings-body-error-boundary`,className:`flex h-full flex-col items-center justify-center gap-5 p-8 text-center`,children:[s,c]}),t[7]=s,t[8]=l),l}function RC(){return window.location.reload()}function zC(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(h,{fallbackRender:VC,onError:BC,children:n}),t[0]=n,t[1]=r),r}function BC(e,t){console.error(`[SettingsDialogErrorBoundary] rendered fallback for Settings body`,e,t.componentStack)}function VC(e){return(0,Z.jsx)(LC,{...e})}function HC(e){return`https://github.com/inkeep/open-knowledge/releases/tag/v${encodeURIComponent(e)}`}function UC(e){let t=(0,$.c)(104),{open:n,onOpenChange:r}=e,{_:i}=kt(),{collabUrl:a}=Ye(),{userBinding:o,userSynced:s,okignoreBinding:c,okignoreSynced:l}=au(),{desktopPresent:u}=Eo(),[d,f]=(0,Q.useState)(`preferences`),p,m;t[0]===n?(p=t[1],m=t[2]):(p=()=>{n&&f(`preferences`)},m=[n],t[0]=n,t[1]=p,t[2]=m),(0,Q.useEffect)(p,m);let h=a!==null,g=typeof window<`u`&&window.okDesktop!=null,_;t[3]===i?_=t[4]:(_=i({id:`7PzzBU`}),t[3]=i,t[4]=_);let v;t[5]===i?v=t[6]:(v=i({id:`Q6hhn8`}),t[5]=i,t[6]=v);let y;t[7]===v?y=t[8]:(y={id:`preferences`,label:v},t[7]=v,t[8]=y);let b;t[9]===i?b=t[10]:(b=i({id:`4KmEoC`}),t[9]=i,t[10]=b);let x;t[11]===b?x=t[12]:(x={id:`hotkeys`,label:b},t[11]=b,t[12]=x);let S;t[13]===i?S=t[14]:(S=i({id:`AeXO77`}),t[13]=i,t[14]=S);let C;t[15]===S?C=t[16]:(C={id:`account`,label:S},t[15]=S,t[16]=C);let w;t[17]===i?w=t[18]:(w=g?[{id:`ai-tools`,label:i({id:`_5qBNl`})}]:[],t[17]=i,t[18]=w);let T;t[19]!==w||t[20]!==y||t[21]!==x||t[22]!==C?(T=[y,x,C,...w],t[19]=w,t[20]=y,t[21]=x,t[22]=C,t[23]=T):T=t[23];let E;t[24]!==T||t[25]!==_?(E={id:`user`,label:_,enabled:!0,items:T},t[24]=T,t[25]=_,t[26]=E):E=t[26];let D;t[27]===i?D=t[28]:(D=i({id:`ZWyHmq`}),t[27]=i,t[28]=D);let O;t[29]===i?O=t[30]:(O=i({id:`Nu4DdT`}),t[29]=i,t[30]=O);let k;t[31]===O?k=t[32]:(k={id:`sync`,label:O},t[31]=O,t[32]=k);let A;t[33]===i?A=t[34]:(A=i({id:`A1taO8`}),t[33]=i,t[34]=A);let j;t[35]===A?j=t[36]:(j={id:`search`,label:A},t[35]=A,t[36]=j);let M,N;t[37]===i?(M=t[38],N=t[39]):(M=g?[{id:`terminal`,label:i({id:`ALhMYW`})}]:[],N=g?[{id:`project-ai-tools`,label:i({id:`crqzW5`})}]:[],t[37]=i,t[38]=M,t[39]=N);let P;t[40]===i?P=t[41]:(P=i({id:`iTylMl`}),t[40]=i,t[41]=P);let F;t[42]===P?F=t[43]:(F={id:`project-templates`,label:P},t[42]=P,t[43]=F);let I;t[44]===i?I=t[45]:(I=i({id:`PCSkw2`}),t[44]=i,t[45]=I);let L;t[46]===I?L=t[47]:(L={id:`skills`,label:I},t[46]=I,t[47]=L);let R;t[48]===i?R=t[49]:(R=i({id:`3zyg_A`}),t[48]=i,t[49]=R);let z;t[50]===R?z=t[51]:(z={id:`okignore`,label:R},t[50]=R,t[51]=z);let B;t[52]===i?B=t[53]:(B=i({id:`cs4mps`}),t[52]=i,t[53]=B);let V;t[54]===B?V=t[55]:(V={id:`sharing`,label:B},t[54]=B,t[55]=V);let H;t[56]!==k||t[57]!==j||t[58]!==M||t[59]!==N||t[60]!==F||t[61]!==L||t[62]!==z||t[63]!==V?(H=[k,j,...M,...N,F,L,z,V],t[56]=k,t[57]=j,t[58]=M,t[59]=N,t[60]=F,t[61]=L,t[62]=z,t[63]=V,t[64]=H):H=t[64];let U;t[65]!==h||t[66]!==D||t[67]!==H?(U={id:`project`,label:D,enabled:h,items:H},t[65]=h,t[66]=D,t[67]=H,t[68]=U):U=t[68];let W;t[69]===i?W=t[70]:(W=i({id:`nbfdhU`}),t[69]=i,t[70]=W);let G;t[71]!==i||t[72]!==u?(G=[],t[71]=i,t[72]=u,t[73]=G):G=t[73];let K;t[74]!==W||t[75]!==G?(K={id:`integrations`,label:W,enabled:!0,items:G},t[74]=W,t[75]=G,t[76]=K):K=t[76];let ee;t[77]!==E||t[78]!==U||t[79]!==K?(ee=[E,U,K],t[77]=E,t[78]=U,t[79]=K,t[80]=ee):ee=t[80];let te=ee,ne;t[81]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Z.jsx)(Ps,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`Tz0i8g`})}),t[81]=ne):ne=t[81];let re;t[82]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Z.jsx)(Ns,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`RDrXh4`})}),t[82]=re):re=t[82];let ie;t[83]!==d||t[84]!==te?(ie=(0,Z.jsx)(WC,{groups:te,activeId:d,onSelect:f}),t[83]=d,t[84]=te,t[85]=ie):ie=t[85];let q;t[86]===i?q=t[87]:(q=i({id:`OXb_Df`}),t[86]=i,t[87]=q);let ae;t[88]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,Z.jsx)(qC,{}),t[88]=ae):ae=t[88];let oe=s?o:null,se;t[89]!==d||t[90]!==c||t[91]!==l||t[92]!==oe?(se=(0,Z.jsx)(zC,{children:(0,Z.jsx)(Q.Suspense,{fallback:ae,children:(0,Z.jsx)(IC,{activeId:d,userBinding:oe,okignoreBinding:c,okignoreSynced:l})})}),t[89]=d,t[90]=c,t[91]=l,t[92]=oe,t[93]=se):se=t[93];let ce;t[94]!==q||t[95]!==se?(ce=(0,Z.jsx)(`section`,{"aria-label":q,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain subtle-scrollbar p-6`,tabIndex:0,children:se}),t[94]=q,t[95]=se,t[96]=ce):ce=t[96];let le;t[97]!==ie||t[98]!==ce?(le=(0,Z.jsxs)(Fs,{className:`flex h-[700px] max-h-[calc(100dvh-4rem)] w-[900px] max-w-[calc(100%-2rem)] flex-col gap-0 overflow-hidden p-0 sm:grid sm:grid-cols-[220px_1fr] sm:max-w-[min(900px,calc(100%-2rem))]`,"data-testid":`settings-dialog`,children:[ne,re,ie,ce]}),t[97]=ie,t[98]=ce,t[99]=le):le=t[99];let ue;return t[100]!==r||t[101]!==n||t[102]!==le?(ue=(0,Z.jsx)(zs,{open:n,onOpenChange:r,children:le}),t[100]=r,t[101]=n,t[102]=le,t[103]=ue):ue=t[103],ue}function WC(e){let t=(0,$.c)(13),{groups:n,activeId:r,onSelect:i}=e,{_:a}=kt(),o;t[0]===a?o=t[1]:(o=a({id:`y1t8bQ`}),t[0]=a,t[1]=o);let s;if(t[2]!==r||t[3]!==n||t[4]!==i){let e;t[6]!==r||t[7]!==i?(e=e=>(0,Z.jsx)(KC,{group:e,activeId:r,onSelect:i},e.id),t[6]=r,t[7]=i,t[8]=e):e=t[8],s=n.map(e),t[2]=r,t[3]=n,t[4]=i,t[5]=s}else s=t[5];let c;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(GC,{}),t[9]=c):c=t[9];let l;return t[10]!==o||t[11]!==s?(l=(0,Z.jsxs)(`nav`,{"aria-label":o,className:`flex shrink-0 gap-x-3 overflow-x-auto overscroll-contain subtle-scrollbar scroll-fade-mask-x-max-sm border-b bg-muted/30 px-3 py-2 max-sm:pt-10 sm:h-full sm:flex-col sm:gap-0 sm:overflow-x-visible sm:overflow-y-auto sm:border-r sm:border-b-0 sm:py-4`,children:[s,c]}),t[10]=o,t[11]=s,t[12]=l):l=t[12],l}function GC(){let e=(0,$.c)(4),t=typeof window<`u`?window.okDesktop??null:null,n=t?.appVersion;if(!t||!n)return null;let r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=HC(n),e[0]=r):r=e[0];let i=r,a;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsxs)(`p`,{className:`whitespace-nowrap font-mono text-xs text-muted-foreground/70`,"data-testid":`settings-sidebar-version`,children:[`v`,n]}),e[1]=a):a=e[1];let o;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>{t.shell.openExternal(i)},e[2]=o):o=e[2];let s;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsxs)(`div`,{className:`ml-auto shrink-0 px-2 sm:ml-0 sm:mt-auto sm:pt-3`,children:[a,(0,Z.jsxs)(`button`,{type:`button`,onClick:o,"data-testid":`settings-sidebar-release-notes`,className:X(`mt-0.5 inline-flex items-center gap-1 whitespace-nowrap rounded text-xs text-muted-foreground transition-colors hover:text-foreground`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`),children:[(0,Z.jsx)(J,{id:`_PACVa`}),(0,Z.jsx)(Hi,{className:`size-3`,"aria-hidden":`true`})]})]}),e[3]=s):s=e[3],s}function KC(e){let t=(0,$.c)(28),{group:n,activeId:r,onSelect:i}=e;if(n.items.length===0)return null;let a=`settings-group-${n.id}`,o=`${a}-caption`,s=n.enabled?void 0:o,c=n.enabled?`text-muted-foreground/80`:`text-muted-foreground/50`,l;t[0]===c?l=t[1]:(l=X(`shrink-0 whitespace-nowrap px-2 text-xs font-semibold uppercase tracking-wide font-mono sm:mb-1`,c),t[0]=c,t[1]=l);let u;t[2]!==n.label||t[3]!==a||t[4]!==s||t[5]!==l?(u=(0,Z.jsx)(`h3`,{id:a,"aria-describedby":s,className:l,children:n.label}),t[2]=n.label,t[3]=a,t[4]=s,t[5]=l,t[6]=u):u=t[6];let d;t[7]!==o||t[8]!==n.enabled?(d=n.enabled?null:(0,Z.jsx)(`p`,{id:o,className:`px-2 text-xs italic text-muted-foreground/60 sm:mb-1`,children:(0,Z.jsx)(J,{id:`JWsZlx`})}),t[7]=o,t[8]=n.enabled,t[9]=d):d=t[9];let f;if(t[10]!==r||t[11]!==o||t[12]!==n.enabled||t[13]!==n.items||t[14]!==i){let e;t[16]!==r||t[17]!==o||t[18]!==n.enabled||t[19]!==i?(e=e=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`button`,{type:`button`,"aria-current":r===e.id?`page`:void 0,"aria-disabled":n.enabled?void 0:!0,"aria-describedby":n.enabled?void 0:o,tabIndex:n.enabled?0:-1,disabled:!n.enabled,onClick:()=>n.enabled&&i(e.id),"data-testid":`settings-sidebar-item-${e.id}`,className:X(`w-auto whitespace-nowrap rounded px-2 py-1.5 text-left text-sm transition-colors sm:w-full`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,`disabled:cursor-not-allowed disabled:opacity-50`,r===e.id&&n.enabled?`bg-accent text-accent-foreground`:`hover:bg-accent/50`),children:e.label})},e.id),t[16]=r,t[17]=o,t[18]=n.enabled,t[19]=i,t[20]=e):e=t[20],f=n.items.map(e),t[10]=r,t[11]=o,t[12]=n.enabled,t[13]=n.items,t[14]=i,t[15]=f}else f=t[15];let p;t[21]!==a||t[22]!==f?(p=(0,Z.jsx)(`ul`,{"aria-labelledby":a,className:`flex gap-1 sm:block sm:space-y-0.5`,children:f}),t[21]=a,t[22]=f,t[23]=p):p=t[23];let m;return t[24]!==u||t[25]!==d||t[26]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 sm:mb-4 sm:block`,children:[u,d,p]}),t[24]=u,t[25]=d,t[26]=p,t[27]=m):m=t[27],m}function qC(){let e=(0,$.c)(4),t,n,r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`GsBUCk`})}),n=(0,Z.jsx)(Ka,{className:`h-5 w-32`}),r=(0,Z.jsx)(Ka,{className:`h-4 w-64`}),e[0]=t,e[1]=n,e[2]=r):(t=e[0],n=e[1],r=e[2]);let i;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"aria-busy":`true`,className:`space-y-3`,"data-testid":`settings-content-skeleton`,children:[t,n,r,(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(Ka,{className:`h-9 w-full`}),(0,Z.jsx)(Ka,{className:`h-9 w-full`})]})]}),e[3]=i):i=e[3],i}function JC(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 h-full w-full aria-[orientation=vertical]:flex-col`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(zb,{"data-slot":`resizable-panel-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function YC(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)(Ub,{"data-slot":`resizable-panel`,...n}),t[2]=n,t[3]=r),r}function XC(e){let t=(0,$.c)(12),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({withHandle:i,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=X(`relative flex w-px items-center justify-center bg-border ring-offset-background after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-ring focus-visible:outline-hidden aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:translate-x-0 aria-[orientation=horizontal]:after:-translate-y-1/2 [&[aria-orientation=horizontal]>div]:rotate-90`,n),t[4]=n,t[5]=a);let o;t[6]===i?o=t[7]:(o=i&&(0,Z.jsx)(`div`,{className:`z-10 flex h-6 w-1 shrink-0 rounded-lg bg-border`}),t[6]=i,t[7]=o);let s;return t[8]!==r||t[9]!==a||t[10]!==o?(s=(0,Z.jsx)(qb,{"data-slot":`resizable-handle`,className:a,...r,children:o}),t[8]=r,t[9]=a,t[10]=o,t[11]=s):s=t[11],s}function ZC(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/input-group relative flex h-8 w-full min-w-0 items-center rounded-lg border border-input transition-colors outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-disabled:bg-input/50 has-disabled:opacity-50 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-disabled:bg-input/80 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`input-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var QC=qr(`flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4`,{variants:{align:{"inline-start":`order-first pl-2 has-[>button]:ml-[-0.3rem] has-[>kbd]:ml-[-0.15rem]`,"inline-end":`order-last pr-2 has-[>button]:mr-[-0.3rem] has-[>kbd]:mr-[-0.15rem]`,"block-start":`order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2`,"block-end":`order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2`}},defaultVariants:{align:`inline-start`}});function $C(e){let t=(0,$.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,align:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`inline-start`:i,o;t[4]!==a||t[5]!==n?(o=X(QC({align:a}),n),t[4]=a,t[5]=n,t[6]=o):o=t[6];let s;return t[7]!==a||t[8]!==r||t[9]!==o?(s=(0,Z.jsx)(`div`,{"data-slot":`input-group-addon`,"data-align":a,className:o,onMouseDown:ew,...r}),t[7]=a,t[8]=r,t[9]=o,t[10]=s):s=t[10],s}function ew(e){e.target.closest(`button`)||(e.preventDefault(),e.currentTarget.parentElement?.querySelector(`input`)?.focus())}qr(`flex items-center gap-2 text-sm shadow-none`,{variants:{size:{xs:`h-6 gap-1 rounded-[calc(var(--radius)-3px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5`,sm:``,"icon-xs":`size-6 rounded-[calc(var(--radius)-3px)] p-0 has-[>svg]:p-0`,"icon-sm":`size-8 p-0 has-[>svg]:p-0`}},defaultVariants:{size:`xs`}});function tw(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 items-center gap-2 text-sm text-muted-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`span`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function nw(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 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Uc,{"data-slot":`input-group-control`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function rw(e){let t=(0,$.c)(119),{findInputRef:n,query:r,replacement:i,replaceOpen:a,caseSensitive:o,wholeWord:s,current:c,total:l,onQueryChange:u,onReplacementChange:d,onReplaceOpenChange:f,onCaseSensitiveChange:p,onWholeWordChange:m,onNext:h,onPrevious:g,onReplaceCurrent:_,onReplaceAll:v,onClose:y}=e,{_:b}=kt(),x=r.length>0,S=l>0,C;t[0]!==b||t[1]!==c||t[2]!==S||t[3]!==x||t[4]!==l?(C=x?S?`${c} / ${l}`:b({id:`Ev2r9A`}):``,t[0]=b,t[1]=c,t[2]=S,t[3]=x,t[4]=l,t[5]=C):C=t[5];let w=C,T;t[6]!==y||t[7]!==h||t[8]!==g?(T=function(e){e.key===`Enter`?(e.preventDefault(),e.shiftKey?g():h()):e.key===`Escape`&&(e.preventDefault(),y())},t[6]=y,t[7]=h,t[8]=g,t[9]=T):T=t[9];let E=T,D;t[10]!==y||t[11]!==_?(D=function(e){e.key===`Enter`?(e.preventDefault(),_()):e.key===`Escape`&&(e.preventDefault(),y())},t[10]=y,t[11]=_,t[12]=D):D=t[12];let O=D,k;t[13]===b?k=t[14]:(k=b({id:`MVxpbf`}),t[13]=b,t[14]=k);let A;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(`label`,{className:`sr-only`,htmlFor:`ok-find-input`,children:(0,Z.jsx)(J,{id:`KujtjC`})}),t[15]=A):A=t[15];let j;t[16]===u?j=t[17]:(j=e=>u(e.target.value),t[16]=u,t[17]=j);let M;t[18]===b?M=t[19]:(M=b({id:`KujtjC`}),t[18]=b,t[19]=M);let P;t[20]!==n||t[21]!==E||t[22]!==r||t[23]!==j||t[24]!==M?(P=(0,Z.jsx)(nw,{ref:n,id:`ok-find-input`,value:r,onChange:j,onKeyDown:E,placeholder:M,autoComplete:`off`,spellCheck:!1,className:`h-7 px-2 text-sm`}),t[20]=n,t[21]=E,t[22]=r,t[23]=j,t[24]=M,t[25]=P):P=t[25];let F;t[26]===b?F=t[27]:(F=b({id:`-8PP0T`}),t[26]=b,t[27]=F);let I;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(kd,{"aria-hidden":`true`}),t[28]=I):I=t[28];let L;t[29]!==o||t[30]!==p||t[31]!==F?(L=(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(Lc,{type:`button`,variant:`segmented`,size:`sm`,"aria-label":F,pressed:o,onPressedChange:p,className:`size-6 min-w-6 px-0`,children:I})}),t[29]=o,t[30]=p,t[31]=F,t[32]=L):L=t[32];let R;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Z.jsx)(Es,{side:`bottom`,children:(0,Z.jsx)(J,{id:`-8PP0T`})}),t[33]=R):R=t[33];let z;t[34]===L?z=t[35]:(z=(0,Z.jsxs)(Os,{children:[L,R]}),t[34]=L,t[35]=z);let B;t[36]===b?B=t[37]:(B=b({id:`_7UQ7y`}),t[36]=b,t[37]=B);let V;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Z.jsx)(qf,{"aria-hidden":`true`}),t[38]=V):V=t[38];let H;t[39]!==m||t[40]!==B||t[41]!==s?(H=(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(Lc,{type:`button`,variant:`segmented`,size:`sm`,"aria-label":B,pressed:s,onPressedChange:m,className:`size-6 min-w-6 px-0`,children:V})}),t[39]=m,t[40]=B,t[41]=s,t[42]=H):H=t[42];let U;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(Es,{side:`bottom`,children:(0,Z.jsx)(J,{id:`_7UQ7y`})}),t[43]=U):U=t[43];let W;t[44]===H?W=t[45]:(W=(0,Z.jsxs)(Os,{children:[H,U]}),t[44]=H,t[45]=W);let G;t[46]!==z||t[47]!==W?(G=(0,Z.jsxs)($C,{align:`inline-end`,className:`gap-0.5`,children:[z,W]}),t[46]=z,t[47]=W,t[48]=G):G=t[48];let K;t[49]!==G||t[50]!==P?(K=(0,Z.jsxs)(ZC,{className:`h-7 w-56 rounded-[min(var(--radius-md),12px)]`,children:[P,G]}),t[49]=G,t[50]=P,t[51]=K):K=t[51];let ee;t[52]===w?ee=t[53]:(ee=(0,Z.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`min-w-14 px-1 text-right text-muted-foreground text-xs tabular-nums shrink-0`,children:w}),t[52]=w,t[53]=ee);let te;t[54]===b?te=t[55]:(te=b({id:`oqB2ez`}),t[54]=b,t[55]=te);let ne=!S,re;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Z.jsx)(N,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[56]=re):re=t[56];let ie;t[57]!==g||t[58]!==te||t[59]!==ne?(ie=(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(Jr,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":te,disabled:ne,onClick:g,children:re})}),t[57]=g,t[58]=te,t[59]=ne,t[60]=ie):ie=t[60];let q;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,Z.jsx)(Es,{side:`bottom`,children:(0,Z.jsx)(J,{id:`oqB2ez`})}),t[61]=q):q=t[61];let ae;t[62]===ie?ae=t[63]:(ae=(0,Z.jsxs)(Os,{children:[ie,q]}),t[62]=ie,t[63]=ae);let oe;t[64]===b?oe=t[65]:(oe=b({id:`SiUUCS`}),t[64]=b,t[65]=oe);let se=!S,ce;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(ce=(0,Z.jsx)(ea,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[66]=ce):ce=t[66];let le;t[67]!==h||t[68]!==oe||t[69]!==se?(le=(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(Jr,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":oe,disabled:se,onClick:h,children:ce})}),t[67]=h,t[68]=oe,t[69]=se,t[70]=le):le=t[70];let ue;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(ue=(0,Z.jsx)(Es,{side:`bottom`,children:(0,Z.jsx)(J,{id:`SiUUCS`})}),t[71]=ue):ue=t[71];let de;t[72]===le?de=t[73]:(de=(0,Z.jsxs)(Os,{children:[le,ue]}),t[72]=le,t[73]=de);let fe=a?`secondary`:`ghost`,pe;t[74]!==b||t[75]!==a?(pe=b(a?{id:`UkQGhd`}:{id:`1RluQD`}),t[74]=b,t[75]=a,t[76]=pe):pe=t[76];let me=a?`ok-replace-input`:void 0,he;t[77]!==f||t[78]!==a?(he=()=>f(!a),t[77]=f,t[78]=a,t[79]=he):he=t[79];let ge;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,Z.jsx)(wf,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[80]=ge):ge=t[80];let _e;t[81]!==a||t[82]!==fe||t[83]!==pe||t[84]!==me||t[85]!==he?(_e=(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(Jr,{type:`button`,variant:fe,size:`icon-sm`,"aria-label":pe,"aria-expanded":a,"aria-controls":me,onClick:he,children:ge})}),t[81]=a,t[82]=fe,t[83]=pe,t[84]=me,t[85]=he,t[86]=_e):_e=t[86];let ve;t[87]===a?ve=t[88]:(ve=(0,Z.jsx)(Es,{side:`bottom`,children:a?(0,Z.jsx)(J,{id:`UkQGhd`}):(0,Z.jsx)(J,{id:`1RluQD`})}),t[87]=a,t[88]=ve);let ye;t[89]!==_e||t[90]!==ve?(ye=(0,Z.jsxs)(Os,{children:[_e,ve]}),t[89]=_e,t[90]=ve,t[91]=ye):ye=t[91];let be;t[92]!==b||t[93]!==O||t[94]!==S||t[95]!==v||t[96]!==_||t[97]!==d||t[98]!==a||t[99]!==i?(be=a?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`label`,{className:`sr-only`,htmlFor:`ok-replace-input`,children:(0,Z.jsx)(J,{id:`fqSfXY`})}),(0,Z.jsx)(Uc,{id:`ok-replace-input`,value:i,onChange:e=>d(e.target.value),onKeyDown:O,placeholder:b({id:`fqSfXY`}),autoComplete:`off`,spellCheck:!1,className:`h-7 w-48 rounded-[min(var(--radius-md),12px)] px-2 text-sm shadow-none focus-visible:ring-2`}),(0,Z.jsxs)(Os,{children:[(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(Jr,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":b({id:`bS_boY`}),disabled:!S,onClick:_,children:(0,Z.jsx)(wf,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(Es,{side:`bottom`,children:(0,Z.jsx)(J,{id:`bS_boY`})})]}),(0,Z.jsxs)(Os,{children:[(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(Jr,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":b({id:`dr1vFs`}),disabled:!S,onClick:v,children:(0,Z.jsx)(Cf,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(Es,{side:`bottom`,children:(0,Z.jsx)(J,{id:`dr1vFs`})})]})]}):null,t[92]=b,t[93]=O,t[94]=S,t[95]=v,t[96]=_,t[97]=d,t[98]=a,t[99]=i,t[100]=be):be=t[100];let xe;t[101]===b?xe=t[102]:(xe=b({id:`wJo9oS`}),t[101]=b,t[102]=xe);let Se;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(Se=(0,Z.jsx)(gs,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[103]=Se):Se=t[103];let Ce;t[104]!==y||t[105]!==xe?(Ce=(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(Jr,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":xe,onClick:y,children:Se})}),t[104]=y,t[105]=xe,t[106]=Ce):Ce=t[106];let we;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(we=(0,Z.jsx)(Es,{side:`bottom`,children:(0,Z.jsx)(J,{id:`yz7wBu`})}),t[107]=we):we=t[107];let Te;t[108]===Ce?Te=t[109]:(Te=(0,Z.jsxs)(Os,{children:[Ce,we]}),t[108]=Ce,t[109]=Te);let Ee;return t[110]!==K||t[111]!==ee||t[112]!==ae||t[113]!==de||t[114]!==k||t[115]!==ye||t[116]!==be||t[117]!==Te?(Ee=(0,Z.jsxs)(`search`,{"data-testid":`find-replace-bar`,"aria-label":k,className:`pointer-events-auto flex max-w-[min(calc(100vw-1rem),720px)] touch-manipulation items-center gap-1 rounded-[calc(var(--radius)+2px)] border border-input bg-popover/95 p-1 text-popover-foreground shadow-md shadow-black/10 backdrop-blur`,children:[A,K,ee,ae,de,ye,be,Te]}),t[110]=K,t[111]=ee,t[112]=ae,t[113]=de,t[114]=k,t[115]=ye,t[116]=be,t[117]=Te,t[118]=Ee):Ee=t[118],Ee}var iw={current:0,total:0},aw=120,ow=100;function sw(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=()=>e?u(e):null,t[0]=e,t[1]=n),(0,Q.useSyncExternalStore)(P,n,cw)}function cw(){return null}function lw(e){if(!e||e.isDestroyed)return null;let{from:t,to:n,empty:r}=e.state.selection;if(r)return null;let i=e.state.doc.textBetween(t,n,`
25
25
  `,`
26
26
  `).trim();return i.length===0||i.length>aw||i.includes(`
27
27
  `)?null:i}function uw(e){let t=o(e.state);return{current:t.matches.length===0?0:t.activeIndex+1,total:t.matches.length}}function dw(e,t){return e.current===t.current&&e.total===t.total}function fw(e,t,n){e&&!e.isDestroyed&&(e.commands.clearFindMatches(),e.commands.focus()),t(e=>({...e,open:!1,activeIndex:0})),n(iw)}function pw(e){!e||e.isDestroyed||typeof window>`u`||window.requestAnimationFrame(()=>{if(e.isDestroyed)return;let t=oi(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 mw(e){let t=(0,$.c)(81),{activeDocName:n,isSourceMode:r}=e,i=sw(n),a=(0,Q.useRef)(null),s=(0,Q.useRef)(null),c=(0,Q.useRef)(n),l=(0,Q.useRef)(0),u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u={open:!1,replaceOpen:!1,query:``,replacement:``,caseSensitive:!1,wholeWord:!1,activeIndex:0},t[0]=u):u=t[0];let[d,f]=(0,Q.useState)(u),[p,m]=(0,Q.useState)(iw),h,g;t[1]===n?(h=t[2],g=t[3]):(h=()=>{c.current!==n&&(c.current=n,f(gw))},g=[n],t[1]=n,t[2]=h,t[3]=g),(0,Q.useEffect)(h,g);let _,v;t[4]===d.activeIndex?(_=t[5],v=t[6]):(_=()=>{l.current=d.activeIndex},v=[d.activeIndex],t[4]=d.activeIndex,t[5]=_,t[6]=v),(0,Q.useEffect)(_,v);let y,b;t[7]===i?(y=t[8],b=t[9]):(y=()=>{let e=s.current;e&&e!==i&&!e.isDestroyed&&e.commands.clearFindMatches(),s.current=i},b=[i],t[7]=i,t[8]=y,t[9]=b),(0,Q.useEffect)(y,b);let x,S;t[10]===d.open?(x=t[11],S=t[12]):(x=()=>{if(!d.open||!a.current)return;let e=requestAnimationFrame(()=>{a.current?.focus(),a.current?.select()});return()=>cancelAnimationFrame(e)},S=[d.open],t[10]=d.open,t[11]=x,t[12]=S),(0,Q.useEffect)(x,S);let C,w;t[13]!==d.open||t[14]!==r?(C=()=>{!d.open||!r||f(hw)},w=[d.open,r],t[13]=d.open,t[14]=r,t[15]=C,t[16]=w):(C=t[15],w=t[16]),(0,Q.useEffect)(C,w);let T,E;t[17]!==i||t[18]!==d.caseSensitive||t[19]!==d.open||t[20]!==d.query||t[21]!==d.wholeWord||t[22]!==r?(T=()=>{if(!i||i.isDestroyed){m(iw);return}if(!d.open||r){i.commands.clearFindMatches(),m(iw);return}let e=window.setTimeout(()=>{if(i.isDestroyed)return;i.commands.setFindQuery(d.query,{options:{caseSensitive:d.caseSensitive,wholeWord:d.wholeWord},activeIndex:l.current});let e=uw(i);m(t=>dw(t,e)?t:e)},ow);return()=>window.clearTimeout(e)},E=[i,d.open,d.query,d.caseSensitive,d.wholeWord,r],t[17]=i,t[18]=d.caseSensitive,t[19]=d.open,t[20]=d.query,t[21]=d.wholeWord,t[22]=r,t[23]=T,t[24]=E):(T=t[23],E=t[24]),(0,Q.useEffect)(T,E);let D,O;t[25]!==i||t[26]!==d.open||t[27]!==r?(D=()=>{if(!i||i.isDestroyed||!d.open||r)return;let e=()=>{let e=o(i.state),t=uw(i);m(e=>dw(e,t)?e:t),f(t=>t.activeIndex===e.activeIndex?t:{...t,activeIndex:e.activeIndex})};return i.on(`transaction`,e),()=>{i.off(`transaction`,e)}},O=[i,d.open,r],t[25]=i,t[26]=d.open,t[27]=r,t[28]=D,t[29]=O):(D=t[28],O=t[29]),(0,Q.useEffect)(D,O);let k,A;t[30]!==n||t[31]!==i||t[32]!==d.open||t[33]!==r?(k=()=>{let e=function(e){let t=lw(i);f(n=>({...n,open:!0,replaceOpen:e,query:t??n.query,activeIndex:0}))},t=function(t){if(!(!n||r||t.defaultPrevented)){if(jl(t,`find`)){t.preventDefault(),d.open?fw(i,f,m):e(!1);return}if(jl(t,`replace`)){t.preventDefault(),e(!0);return}if(d.open){let e=jl(t,`find-next`),n=jl(t,`find-previous`);if(e||n){t.preventDefault(),(n?i?.commands.selectPreviousFindMatch():i?.commands.selectNextFindMatch())&&pw(i);return}}t.key===`Escape`&&d.open&&(t.preventDefault(),fw(i,f,m))}};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},A=[n,i,d.open,r],t[30]=n,t[31]=i,t[32]=d.open,t[33]=r,t[34]=k,t[35]=A):(k=t[34],A=t[35]),(0,Q.useEffect)(k,A);let j;t[36]!==i||t[37]!==d.caseSensitive||t[38]!==d.query||t[39]!==d.wholeWord?(j=function(){return!i||i.isDestroyed?!1:(i.commands.setFindQuery(d.query,{options:{caseSensitive:d.caseSensitive,wholeWord:d.wholeWord},activeIndex:l.current}),!0)},t[36]=i,t[37]=d.caseSensitive,t[38]=d.query,t[39]=d.wholeWord,t[40]=j):j=t[40];let M=j,N;t[41]===i?N=t[42]:(N=function(){if(!i||i.isDestroyed)return;let e=o(i.state),t=uw(i);m(e=>dw(e,t)?e:t),f(t=>t.activeIndex===e.activeIndex?t:{...t,activeIndex:e.activeIndex})},t[41]=i,t[42]=N);let P=N,F;t[43]===i?F=t[44]:(F=function(){fw(i,f,m)},t[43]=i,t[44]=F);let I=F,L;t[45]!==M||t[46]!==i||t[47]!==P?(L=function(){!i||i.isDestroyed||(M(),i.commands.selectNextFindMatch()&&pw(i),P())},t[45]=M,t[46]=i,t[47]=P,t[48]=L):L=t[48];let R=L,z;t[49]!==M||t[50]!==i||t[51]!==P?(z=function(){!i||i.isDestroyed||(M(),i.commands.selectPreviousFindMatch()&&pw(i),P())},t[49]=M,t[50]=i,t[51]=P,t[52]=z):z=t[52];let B=z,V;t[53]!==M||t[54]!==i||t[55]!==d.replacement||t[56]!==P?(V=function(){!i||i.isDestroyed||(M(),i.commands.replaceCurrentFindMatch(d.replacement)&&pw(i),P())},t[53]=M,t[54]=i,t[55]=d.replacement,t[56]=P,t[57]=V):V=t[57];let H=V,U;t[58]!==M||t[59]!==i||t[60]!==d.replacement||t[61]!==P?(U=function(){!i||i.isDestroyed||(M(),i.commands.replaceAllFindMatches(d.replacement)&&pw(i),P())},t[58]=M,t[59]=i,t[60]=d.replacement,t[61]=P,t[62]=U):U=t[62];let W=U;if(!d.open||!n||r)return null;let G,K,ee,te,ne;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(G=e=>f(t=>({...t,query:e,activeIndex:0})),K=e=>f(t=>({...t,replacement:e})),ee=e=>f(t=>({...t,replaceOpen:e})),te=e=>f(t=>({...t,caseSensitive:e})),ne=e=>f(t=>({...t,wholeWord:e})),t[63]=G,t[64]=K,t[65]=ee,t[66]=te,t[67]=ne):(G=t[63],K=t[64],ee=t[65],te=t[66],ne=t[67]);let re;return t[68]!==I||t[69]!==d.caseSensitive||t[70]!==d.query||t[71]!==d.replaceOpen||t[72]!==d.replacement||t[73]!==d.wholeWord||t[74]!==p.current||t[75]!==p.total||t[76]!==W||t[77]!==H||t[78]!==R||t[79]!==B?(re=(0,Z.jsx)(`div`,{className:`editor-content-aligned pointer-events-none absolute inset-x-0 top-2 z-30 px-2`,children:(0,Z.jsx)(`div`,{className:`flex justify-end`,children:(0,Z.jsx)(rw,{findInputRef:a,query:d.query,replacement:d.replacement,replaceOpen:d.replaceOpen,caseSensitive:d.caseSensitive,wholeWord:d.wholeWord,current:p.current,total:p.total,onQueryChange:G,onReplacementChange:K,onReplaceOpenChange:ee,onCaseSensitiveChange:te,onWholeWordChange:ne,onNext:R,onPrevious:B,onReplaceCurrent:H,onReplaceAll:W,onClose:I})})}),t[68]=I,t[69]=d.caseSensitive,t[70]=d.query,t[71]=d.replaceOpen,t[72]=d.replacement,t[73]=d.wholeWord,t[74]=p.current,t[75]=p.total,t[76]=W,t[77]=H,t[78]=R,t[79]=B,t[80]=re):re=t[80],re}function hw(e){return{...e,open:!1,activeIndex:0}}function gw(e){return{...e,activeIndex:0}}var _w=300;function vw(e,t){let n=(0,$.c)(4),[r,i]=(0,Q.useState)(fu),a,o;return n[0]!==t||n[1]!==e?(a=()=>{if(!e||!t){i(fu);return}let n=e.document.getText(`source`),r=!1,a=null,o=function(){r||i(pu(n.toString()))};o();let s=function(){a&&clearTimeout(a),a=setTimeout(o,_w)};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 yw(e){return e&&e.document.getMap(`lifecycle`).get(`status`)===`conflict`?`conflict`:null}function bw(e){let t=(0,$.c)(8),{poolEntries:n}=Ye(),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=()=>yw(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(yw(i));let t=()=>s(yw(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 xw(e,t){let n=(0,$.c)(3),r;return n[0]!==e||n[1]!==t?(r=()=>mu(e,t),n[0]=e,n[1]=t,n[2]=r):r=n[2],(0,Q.useSyncExternalStore)(ou,r)}var Sw=`ok-doc-panel-width-v1`;function Cw(e){return Number.isFinite(e)?e<300?300:e>600?600:Math.round(e):320}function ww(e){try{let t=(e??localStorage).getItem(Sw);if(t==null)return 320;let n=Number.parseInt(t,10);return Number.isFinite(n)?Cw(n):320}catch{return 320}}function Tw(e,t){try{(t??localStorage).setItem(Sw,String(Cw(e)))}catch{}}function Ew(){try{return typeof localStorage>`u`?320:ww()}catch{return 320}}var Dw=1024,Ow=1280,kw={left:Dw,right:Ow};function Aw(e,t,n){return e==null?t>=kw[n]?`above`:`below`:`embedded`}function jw(e){return e===`above`?`open`:`collapsed`}var Mw=`ok-sidebar-pins-v2`;function Nw(e){return e===`open`||e===`collapsed`}function Pw(e){return e===`above`||e===`below`||e===`embedded`}function Fw(e){if(typeof e!=`object`||!e)return!1;let t=e;for(let e of Object.keys(t))if(!Pw(e)||!Nw(t[e]))return!1;return!0}function Iw(e){let t=JSON.parse(e);if(typeof t!=`object`||!t)return{};let n=t,r={};return Fw(n.left)&&(r.left=n.left),Fw(n.right)&&(r.right=n.right),r}function Lw(e){try{let t=(e??localStorage).getItem(Mw);return t==null?{}:Iw(t)}catch{return{}}}function Rw(e,t){try{t.setItem(Mw,JSON.stringify(e))}catch{}}function zw(e,t,n){return n[e]?.[t]??jw(t)}function Bw(e,t,n,r){let i=r??localStorage,a=Lw(i);return a[e]={...a[e],[t]:n},Rw(a,i),a}var Vw=`ok-terminal-width-v1`;function Hw(e){return Number.isFinite(e)?e<320?320:Math.round(e):480}function Uw(e){try{let t=(e??localStorage).getItem(Vw);if(t==null)return 480;let n=Number.parseInt(t,10);return Number.isFinite(n)?Hw(n):480}catch{return 480}}function Ww(e,t){try{(t??localStorage).setItem(Vw,String(Hw(e)))}catch{}}function Gw(){try{return typeof localStorage>`u`?480:Uw()}catch{return 480}}function Kw(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`?qw: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 qw(e){return e===`synced`?`synced`:`connected`}function Jw(e){let t=e.lastIndexOf(`/`);return t>=0?e.slice(t+1):e}function Yw(e){let t=(0,$.c)(21),{path:n,onRemove:r}=e,{_:i}=kt(),a,o;t[0]!==i||t[1]!==n?(a=Jw(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)(ft,{path:n,className:`size-3`,showExtensionBadge:!1})}),t[6]=n,t[7]=u);let d;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(gs,{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)(Jr,{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 Xw(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)(Yw,{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 Zw(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,{_}=kt(),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)(Jr,{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)(ea,{"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)(ic,{asChild:!0,children:(0,Z.jsx)(Jr,{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)(yc,{"aria-label":_({id:`ALhMYW`}),children:[(0,Z.jsx)(kc,{children:(0,Z.jsx)(J,{id:`ALhMYW`})}),y?y.map(e=>(0,Z.jsxs)(vc,{onSelect:e.onSelect,"data-testid":C(e.cli),"aria-label":e.ariaLabel,children:[(0,Z.jsx)(ma,{id:pa(e.cli),className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:e.label}),e.selected?(0,Z.jsx)($i,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.cli)):c?(0,Z.jsxs)(vc,{onSelect:c.onSelect,"data-testid":C(`claude`),"aria-label":_({id:`AcK_r0`}),children:[(0,Z.jsx)(ma,{id:pa(`claude`),className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(J,{id:`fcgvCA`})}),c.selected?(0,Z.jsx)($i,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]}):null]}):null,v?(0,Z.jsxs)(Z.Fragment,{children:[b?(0,Z.jsx)(mc,{}):null,(0,Z.jsxs)(yc,{"aria-label":_({id:`BBqGS9`}),children:[(0,Z.jsx)(kc,{children:(0,Z.jsx)(J,{id:`BBqGS9`})}),a.map(e=>(0,Z.jsxs)(vc,{onSelect:()=>s(e),"data-testid":m.option(e.id),children:[(0,Z.jsx)(ma,{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)($i,{"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)(bc,{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)(Ec,{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)(Ox,{children:[w,k]}),t[32]=w,t[33]=k,t[34]=A):A=t[34],A}var Qw=`ok-onboarding-card-v1`,$w={initialized:!1,steps:{file:!1,askedAi:!1},fileBaseline:0,dismissed:!1,completed:!1};function eT(e){return e===!0}function tT(e){if(typeof e!=`object`||!e)return $w;let t=e,n=typeof t.steps==`object`&&t.steps!==null?t.steps:{};return{initialized:eT(t.initialized),steps:{file:eT(n.file),askedAi:eT(n.askedAi)},fileBaseline:typeof t.fileBaseline==`number`&&Number.isFinite(t.fileBaseline)&&t.fileBaseline>=0?t.fileBaseline:0,dismissed:eT(t.dismissed),completed:eT(t.completed)}}function nT(e){try{let t=(e??localStorage).getItem(Qw);return t==null?$w:tT(JSON.parse(t))}catch(e){return console.warn(`[onboarding-card-store] readPersistedState failed (corrupt/privacy/SSR)`,e),$w}}function rT(e,t){try{(t??localStorage).setItem(Qw,JSON.stringify(e))}catch(e){console.warn(`[onboarding-card-store] writePersistedState failed (quota/privacy/SSR)`,e)}}function iT(e){let t=nT(e),n=new Set,r=!1;function i(){for(let e of n)e()}function a(n){t=n,rT(t,e),i()}return{getSnapshot(){return t},subscribe(e){return n.add(e),()=>{n.delete(e)}},activate(e=0){t.initialized||a({...t,initialized:!0,fileBaseline:e})},markStepComplete(e){t.steps[e]||a({...t,steps:{...t.steps,[e]:!0}})},dismiss(){t.dismissed||a({...t,dismissed:!0})},markCompleted(){t.completed||a({...t,completed:!0})},install(){r||(r=!0,t=nT(e),i())}}}var aT=iT();function oT(e){let t=e===void 0?aT:e;return(0,Q.useSyncExternalStore)(t.subscribe,t.getSnapshot,t.getSnapshot)}function sT(){aT.install()}function cT(e){return Xc(e).filter(e=>e.kind===`document`||e.kind===`folder`).length}async function lT(){let e=await fetch(`/api/documents`);if(!e.ok)throw Error(`documents request failed: ${e.status}`);let t=await e.json(),n=pn.safeParse(t);if(!n.success)throw Error(`documents response did not match schema`,{cause:n.error});return cT(n.data.documents)}async function uT(e=aT){let t=e.getSnapshot();if(!(t.steps.file||!t.initialized))try{await lT()>t.fileBaseline&&e.markStepComplete(`file`)}catch(e){console.warn(`[onboarding-signals] file-step count read failed; leaving step incomplete`,e)}}function dT(e=aT){e.getSnapshot().initialized&&e.markStepComplete(`askedAi`)}var fT=5200,pT=500,mT=/\.(md|mdx)$/i;function hT(e,t){return mT.test(e)?e:t?`${e}${t}`:Io(e)}function gT(e){return mT.test(e)?e.replace(mT,``):null}function _T(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName.toUpperCase();return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`}function vT(){let e=(0,$.c)(2),[t,n]=(0,Q.useState)(yT),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 yT(){return typeof window<`u`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function bT(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),fT);return()=>clearTimeout(e)}let e=setTimeout(()=>{i(xT),o(!0)},pT);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 xT(e){return e+1}function ST(e){let t=(0,$.c)(157),{docName:n,surface:r,folderPath:i,dismissed:a,onDismiss:o,onReopen:s}=e,c=a===void 0?!1:a,{_:l}=kt(),d=i!==void 0,f=d?null:n??null,p=r??`wysiwyg`,m=vT(),h=ua(),{pageMeta:g}=ia(),{states:_}=ya(),{dispatch:v}=Da(),y=Ta(),[b]=(0,Q.useState)(NT),[x,S]=(0,Q.useState)(null),C=a_(),[w,T]=(0,Q.useState)(!0),[E,D]=(0,Q.useState)(!1),O=(0,Q.useRef)(null),k=(0,Q.useRef)(null),[A]=(0,Q.useState)(MT),j,M;t[0]!==c||t[1]!==n||t[2]!==d||t[3]!==r?(j=()=>{if(d||n==null)return;let e=document.documentElement,t=AT,i=()=>{r===`wysiwyg`&&requestAnimationFrame(()=>{let e=u(n),t=k.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=k.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`)}},M=[c,r,n,d],t[0]=c,t[1]=n,t[2]=d,t[3]=r,t[4]=j,t[5]=M):(j=t[4],M=t[5]),(0,Q.useEffect)(j,M);let N=(0,Q.useRef)(c),P=(0,Q.useRef)(s),F;t[6]!==c||t[7]!==s?(F=()=>{N.current=c,P.current=s},t[6]=c,t[7]=s,t[8]=F):F=t[8],(0,Q.useEffect)(F);let I,L;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(I=()=>re(()=>{N.current?P.current?.():O.current?.focus()}),L=[],t[9]=I,t[10]=L):(I=t[9],L=t[10]),(0,Q.useEffect)(I,L);let R;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(R=[],t[11]=R):R=t[11],(0,Q.useEffect)(OT,R);let z=(0,Q.useRef)(c),B,V;t[12]===c?(B=t[13],V=t[14]):(B=()=>{let e=z.current;z.current=c,e&&!c&&O.current?.focus()},V=[c],t[12]=c,t[13]=B,t[14]=V),(0,Q.useEffect)(B,V);let H;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(H=[],t[15]=H):H=t[15];let[U,W]=(0,Q.useState)(H),[G,K]=(0,Q.useState)(DT),ee;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(ee=[],t[16]=ee):ee=t[16];let[te,ne]=(0,Q.useState)(ee),ie;t[17]!==n||t[18]!==d||t[19]!==g?(ie=d||n==null?``:hT(n,g.get(n)?.docExt),t[17]=n,t[18]=d,t[19]=g,t[20]=ie):ie=t[20];let q=ie,ae,oe;t[21]!==q||t[22]!==G||t[23]!==d||t[24]!==w?(ae=()=>{d||w||W(e=>{if(G.has(q))return e;let t=gT(q),n=t===null?e:e.filter(e=>e===q||gT(e)!==t);return n.includes(q)?n.length===e.length?e:n:[...n,q]})},oe=[d,w,q,G],t[21]=q,t[22]=G,t[23]=d,t[24]=w,t[25]=ae,t[26]=oe):(ae=t[25],oe=t[26]),(0,Q.useEffect)(ae,oe);let se;t[27]!==G||t[28]!==d||t[29]!==i||t[30]!==te||t[31]!==U?(se=d?i&&!G.has(i)&&!te.includes(i)?[i]:[]:U.filter(e=>!G.has(e)&&!te.includes(e)),t[27]=G,t[28]=d,t[29]=i,t[30]=te,t[31]=U,t[32]=se):se=t[32];let ce=se,le=Yi(f,p),ue=Yi(f,`frontmatter`),[de,fe]=(0,Q.useState)(null),[pe,me]=(0,Q.useState)(!1),he,ge;t[33]===le?(he=t[34],ge=t[35]):(he=()=>{le&&fe(le)},ge=[le],t[33]=le,t[34]=he,t[35]=ge),(0,Q.useEffect)(he,ge);let _e,ve;t[36]===ue?(_e=t[37],ve=t[38]):(_e=()=>{ue&&fe(ue)},ve=[ue],t[36]=ue,t[37]=_e,t[38]=ve),(0,Q.useEffect)(_e,ve);let ye=x??b,be;t[39]!==ye||t[40]!==y?(be=y===null?null:m_(ye),t[39]=ye,t[40]=y,t[41]=be):be=t[41];let xe=be,Se;t[42]!==ye||t[43]!==C||t[44]!==y?(Se=y!==null&&ye===null?y_(null,C):null,t[42]=ye,t[43]=C,t[44]=y,t[45]=Se):Se=t[45];let Ce=xe??Se,we=Ce!==null,Te;t[46]!==ye||t[47]!==we||t[48]!==_?(Te=we?null:v_(_,ye),t[46]=ye,t[47]=we,t[48]=_,t[49]=Te):Te=t[49];let Ee=Te,De=!E&&(!w||de!==null)&&(we||Ee!==null),Oe;t[50]===_?Oe=t[51]:(Oe=ca.filter(e=>_[e.id]?.installed===!0),t[50]=_,t[51]=Oe);let ke=Oe,Ae;t[52]===_?Ae=t[53]:(Ae=ca.some(e=>_[e.id]?.installed==null),t[52]=_,t[53]=Ae);let je=Ae,Me=y===null?void 0:Vn.map(e=>{let{displayName:t}=zr[e];return{cli:e,label:t,ariaLabel:l({id:`QYfQdv`,values:{displayName:t}}),selected:Ce===e,onSelect:()=>Ve(e)}}),Ne;t[54]===l?Ne=t[55]:(Ne=l({id:`KYSocE`}),t[54]=l,t[55]=Ne);let Pe;t[56]===l?Pe=t[57]:(Pe=l({id:`7Ongq0`}),t[56]=l,t[57]=Pe);let Fe;t[58]===l?Fe=t[59]:(Fe=l({id:`HPTPGr`}),t[58]=l,t[59]=Fe);let Ie;t[60]===l?Ie=t[61]:(Ie=l({id:`qiRoLb`}),t[60]=l,t[61]=Ie);let Le;t[62]!==Ne||t[63]!==Pe||t[64]!==Fe||t[65]!==Ie?(Le=[Ne,Pe,Fe,Ie],t[62]=Ne,t[63]=Pe,t[64]=Fe,t[65]=Ie,t[66]=Le):Le=t[66];let Re=bT(Le,!m&&w&&!c),ze;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(ze=e=>{S(e.id),__(e.id)},t[67]=ze):ze=t[67];let Be=ze,Ve=e=>{let t=p_(e);S(t),__(t)},He;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(He=()=>{O.current?.clear(),fe(null),me(!1),W([]),K(new Set),wx()},t[68]=He):He=t[68];let Ue=He,We;t[69]!==l||t[70]!==v||t[71]!==Ee||t[72]!==Ce||t[73]!==y?(We=e=>{if(e===null){hs.error(l({id:`y8B54M`}));return}if(Ce!==null&&y!==null){try{y.launchInTerminal(e,Ce)}catch{hs.error(l({id:`jBVUXo`}));return}dT(),Ue();return}Ee!==null&&(D(!0),v(Ee.id,e).then(ET).finally(()=>{D(!1),Ue()}))},t[69]=l,t[70]=v,t[71]=Ee,t[72]=Ce,t[73]=y,t[74]=We):We=t[74];let Ge=We,Ke;t[75]!==q||t[76]!==De||t[77]!==Ge||t[78]!==n||t[79]!==ce||t[80]!==d||t[81]!==i||t[82]!==g||t[83]!==de||t[84]!==h?(Ke=()=>{if(!De)return;let{instruction:e,mentions:t}=O.current?.getContent()??{instruction:``,mentions:[]};if(d){Ge(ga({docName:null,folderRelativePath:i,workspace:h,instruction:e,mentions:[...new Set([...ce,...t])].filter(e=>e!==i)}));return}let r=de?xu(de):void 0,a=de?.docName??null,o=de?a:ce.includes(q)?n??null:null,s=o===null?null:hT(o,g.get(o)?.docExt),c=[...new Set([...ce,...t])].filter(e=>e!==s);Ge(ga({docName:o,...s===null?{}:{docRelativePath:s},workspace:h,instruction:e,mentions:c,selection:r}))},t[75]=q,t[76]=De,t[77]=Ge,t[78]=n,t[79]=ce,t[80]=d,t[81]=i,t[82]=g,t[83]=de,t[84]=h,t[85]=Ke):Ke=t[85];let qe=Ke;if(c)return null;let Je=``,Ye=``;if(de){let e;t[86]!==g||t[87]!==de?(e=Su(de,hT(de.docName,g.get(de.docName)?.docExt).split(`/`).pop()??``),t[86]=g,t[87]=de,t[88]=e):e=t[88],Je=e;let n;t[89]===de.markdown?n=t[90]:(n=Cu(de.markdown),t[89]=de.markdown,t[90]=n),Ye=n}let Xe;t[91]===Symbol.for(`react.memo_cache_sentinel`)?(Xe=e=>Ex(e,O),t[91]=Xe):Xe=t[91];let Ze;t[92]!==l||t[93]!==d||t[94]!==o?(Ze=d?null:(0,Z.jsx)(Jr,{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)(ea,{className:`size-3.5`,"aria-hidden":!0})}),t[92]=l,t[93]=d,t[94]=o,t[95]=Ze):Ze=t[95];let Qe;t[96]===Symbol.for(`react.memo_cache_sentinel`)?(Qe=e=>K(t=>{let n=new Set(t);return n.add(e),n}),t[96]=Qe):Qe=t[96];let $e;t[97]!==l||t[98]!==Je||t[99]!==Ye||t[100]!==de||t[101]!==pe?($e=de?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`span`,{"data-testid":`composer-selection-pill`,title:Je,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)(Jr,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":l({id:`irrm_E`}),onClick:()=>{fe(null),me(!1)},className:`group/remove relative size-3.5 shrink-0 rounded-sm text-muted-foreground/80 hover:text-foreground`,children:[(0,Z.jsx)(Hf,{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)(gs,{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)(Jr,{type:`button`,variant:`ghost`,"aria-expanded":pe,"aria-label":l(pe?{id:`UaDyeb`}:{id:`eTL5y9`}),onClick:()=>me(TT),"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:Je})})]}),pe&&Ye!==``?(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:Ye}):null]}):null,t[97]=l,t[98]=Je,t[99]=Ye,t[100]=de,t[101]=pe,t[102]=$e):$e=t[102];let et;t[103]!==ce||t[104]!==$e?(et=(0,Z.jsx)(Xw,{files:ce,onRemoveFile:Qe,children:$e}),t[103]=ce,t[104]=$e,t[105]=et):et=t[105];let tt;t[106]===l?tt=t[107]:(tt=l({id:`xWEvuo`}),t[106]=l,t[107]=tt);let nt;t[108]!==A||t[109]!==qe||t[110]!==tt?(nt=(0,Z.jsx)(qx,{ref:O,ariaLabel:tt,onEmptyChange:T,onContentChange:Cx,onMentionsChange:ne,onSubmit:qe,initialDoc:A,className:`max-h-[200px] overflow-y-auto text-base md:text-sm`}),t[108]=A,t[109]=qe,t[110]=tt,t[111]=nt):nt=t[111];let rt;t[112]!==w||t[113]!==m||t[114]!==Re?(rt=w?(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`,!m&&`transition-opacity duration-500 ease-in-out`,Re.visible?`opacity-100`:`opacity-0`),children:Re.text}):null,t[112]=w,t[113]=m,t[114]=Re,t[115]=rt):rt=t[115];let it;t[116]!==nt||t[117]!==rt?(it=(0,Z.jsxs)(`div`,{className:`relative flex-1`,children:[nt,rt]}),t[116]=nt,t[117]=rt,t[118]=it):it=t[118];let at;t[119]!==Ee||t[120]!==Ce?(at=Ce===null?Ee?(0,Z.jsx)(ma,{id:Ee.id,className:`size-4`,"aria-hidden":!0}):null:(0,Z.jsx)(ma,{id:pa(Ce),className:`size-4`,"aria-hidden":!0}),t[119]=Ee,t[120]=Ce,t[121]=at):at=t[121];let ot;t[122]!==Ee||t[123]!==Ce?(ot=(0,Z.jsx)(`span`,{children:Ce===null?Ee?(0,Z.jsx)(J,{id:`nUNZL4`,values:{0:Ee.displayName}}):(0,Z.jsx)(J,{id:`F-vBv0`}):(0,Z.jsx)(J,{id:`ti6aF_`,values:{0:zr[Ce].displayName}})}),t[122]=Ee,t[123]=Ce,t[124]=ot):ot=t[124];let st;t[125]===E?st=t[126]:(st=E?(0,Z.jsx)(ns,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):null,t[125]=E,t[126]=st);let ct;t[127]!==at||t[128]!==ot||t[129]!==st?(ct=(0,Z.jsxs)(Z.Fragment,{children:[at,ot,st]}),t[127]=at,t[128]=ot,t[129]=st,t[130]=ct):ct=t[130];let lt=!De,ut=we?null:Ee?.id??null,dt;t[131]===je?dt=t[132]:(dt=(0,Z.jsx)(`p`,{className:`px-2 py-1.5 text-sm text-muted-foreground`,"aria-live":`polite`,children:je?(0,Z.jsx)(J,{id:`EcR0fl`}):(0,Z.jsx)(J,{id:`l6OXqI`})}),t[131]=je,t[132]=dt);let ft;t[133]===l?ft=t[134]:(ft=l({id:`nskygk`}),t[133]=l,t[134]=ft);let pt;t[135]===Symbol.for(`react.memo_cache_sentinel`)?(pt={primary:`ask-ai-send`,trigger:`ask-ai-agent-trigger`,menu:`ask-ai-agent-menu`,option:wT,terminal:CT},t[135]=pt):pt=t[135];let mt;t[136]!==Me||t[137]!==Be||t[138]!==ke||t[139]!==qe||t[140]!==ct||t[141]!==lt||t[142]!==ut||t[143]!==dt||t[144]!==ft?(mt=(0,Z.jsx)(Zw,{primary:ct,onPrimary:qe,primaryDisabled:lt,installedTargets:ke,selectedTargetId:ut,onSelectTarget:Be,terminals:Me,menuEmptyState:dt,triggerAriaLabel:ft,testIds:pt}),t[136]=Me,t[137]=Be,t[138]=ke,t[139]=qe,t[140]=ct,t[141]=lt,t[142]=ut,t[143]=dt,t[144]=ft,t[145]=mt):mt=t[145];let ht;t[146]!==it||t[147]!==mt?(ht=(0,Z.jsxs)(`div`,{className:`flex items-end gap-2`,children:[it,mt]}),t[146]=it,t[147]=mt,t[148]=ht):ht=t[148];let gt;t[149]!==Ze||t[150]!==et||t[151]!==ht?(gt=(0,Z.jsxs)(`div`,{ref:k,onMouseDown:Xe,className:`pointer-events-auto group relative flex cursor-text flex-col gap-1.5 rounded-2xl border border-border/60 bg-card px-3 py-2 shadow-sm transition-colors focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50`,children:[Ze,et,ht]}),t[149]=Ze,t[150]=et,t[151]=ht,t[152]=gt):gt=t[152];let _t=gt;if(d){let e;return t[153]===_t?e=t[154]:(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:_t})}),t[153]=_t,t[154]=e),e}let vt;return t[155]===_t?vt=t[156]:(vt=(0,Z.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-[var(--conflict-footer-height,0px)] z-20 editor-content-aligned bg-gradient-to-t from-background from-65% via-background to-transparent pt-10 pb-2`,"data-testid":`bottom-composer`,children:_t}),t[155]=_t,t[156]=vt),vt}function CT(e){return e===`claude`?`ask-ai-agent-option-terminal`:`ask-ai-agent-option-terminal-${e}`}function wT(e){return`ask-ai-agent-option-${e}`}function TT(e){return!e}function ET(e){e.ok&&dT()}function DT(){return new Set}function OT(){let e=kT;return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})}function kT(e){jl(e,`open-ask-ai`)&&(_T(e.target)||(e.preventDefault(),C()))}function AT(){let e=[...document.querySelectorAll(`.editor-doc-scroll`)].filter(jT);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 jT(e){let t=e.scrollHeight-e.clientHeight;return t>0&&e.scrollTop>=t-40}function MT(){return Sx().doc??void 0}function NT(){return g_()}function PT(e){return!e.terminalVisible&&!e.isEmbedded&&e.activeDocName!==null}function FT(e){return!e.terminalVisible&&!e.isEmbedded}function IT(e,t={}){let n=oe(e.componentName);return n.name===`*`?t.unregisteredSuffix?`${e.componentName} (unregistered)`:e.componentName:n.displayName??n.name}var LT=200,RT=`Outside any block`;function zT(e){let t=(0,$.c)(5),{editor:n}=e,r=wt(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?BT(n,r):o.current?RT:``,a.current=window.setTimeout(()=>{i.current&&(i.current.textContent=``,i.current.textContent=t),o.current=e,a.current=null},LT),()=>{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 BT(e,t){if(!t||t.ancestorChain.length===0)return``;let n=t.ancestorChain,r=n[n.length-1],i=IT(r,{unregisteredSuffix:!0});if(n.length===1)return`Selected: ${i}`;let a=n[n.length-2],o=IT(a);try{let t=e.state.doc.resolve(r.pos),n=t.index(t.depth),a=t.parent.childCount;return`Selected: ${i}, ${n+1} of ${a} in ${o}`}catch{return`Selected: ${i} in ${o}`}}var VT=!1;function HT(e,t,n,r){let i=e[t];if(typeof i!=`function`){console.warn(`[cold-mount-instrumentation] target missing method "${t}"`);return}e[t]=function(...e){let t=performance.now(),a,o=!1;try{return a=i.apply(this,e),o=!0,a}finally{let e=performance.now()-t,i;if(o&&r)try{i=r(this,a,t,e)}catch(e){i={"instrumentation-error":e instanceof Error?e.message:String(e)}}try{ml(n,{durationMs:Math.round(e*1e3)/1e3,threw:!o,...i},{startTime:t,duration:e})}catch{}}}}function UT(e){return e?.doc?typeof e.doc.nodeSize==`number`?e.doc.nodeSize:e.doc.content&&typeof e.doc.content.size==`number`?e.doc.content.size:null:null}var WT=0,GT=0,KT=0,qT=0,JT=null,YT=[`linkResolutionDecoration$`],XT=new WeakSet,ZT=new WeakSet;function QT(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase()}function $T(){return!1}function eE(){return!$T()}function tE(e,t){if(eE())return t;let n=`ok/cold/nodeview-factory-${QT(e)}`;return function(...r){let i=performance.now();try{return t(...r)}finally{let t=performance.now()-i;ml(n,{nodeType:e,durationMs:Math.round(t*1e3)/1e3},{startTime:i,duration:t})}}}function nE(e){if(eE())return;let t=e.state.plugins;for(let e of t){if(ZT.has(e))continue;let t=e.spec?.key?.key;if(!t||!YT.some(e=>t.startsWith(e)))continue;let n=e.props,r=n.decorations;if(typeof r!=`function`){ZT.add(e);continue}let i=`ok/cold/decoration-${QT(t.replace(/\$\d*$/,``))}`;n.decorations=function(...e){let n=performance.now();try{return r.apply(this,e)}finally{let e=performance.now()-n;ml(i,{pluginKey:t,durationMs:Math.round(e*1e3)/1e3},{startTime:n,duration:e})}},ZT.add(e)}}function rE(e){if(eE())return;let t=e._props?.nodeViews;if(!(!t||typeof t!=`object`))for(let[e,n]of Object.entries(t)){if(typeof n!=`function`||n.__okWrapped===!0)continue;let r=tE(e,n);r.__okWrapped=!0,t[e]=r}}function iE(e){return eE()?e:e.map(e=>{let t=e.name??`unknown`,n=QT(t);return e.extend({onBeforeCreate(){let e=performance.now();try{this.parent?.()}finally{let r=performance.now()-e;ml(`ok/cold/ext-${n}-on-before-create`,{ext:t,hook:`onBeforeCreate`,durationMs:Math.round(r*1e3)/1e3},{startTime:e,duration:r})}},onCreate(){let e=performance.now();try{this.parent?.()}finally{let r=performance.now()-e;ml(`ok/cold/ext-${n}-on-create`,{ext:t,hook:`onCreate`,durationMs:Math.round(r*1e3)/1e3},{startTime:e,duration:r})}},onUpdate(){let e=performance.now();try{this.parent?.()}finally{let r=performance.now()-e;ml(`ok/cold/ext-${n}-on-update`,{ext:t,hook:`onUpdate`,durationMs:Math.round(r*1e3)/1e3},{startTime:e,duration:r})}},onDestroy(){let e=performance.now();try{this.parent?.()}finally{let r=performance.now()-e;ml(`ok/cold/ext-${n}-on-destroy`,{ext:t,hook:`onDestroy`,durationMs:Math.round(r*1e3)/1e3},{startTime:e,duration:r})}}})})}function aE(){if(!VT){VT=!0,HT(bn.prototype,`mount`,`ok/cold/editor-mount`,(e,t,n,r)=>{let i=e;return eE()||(JT=performance.now()),{elementDefault:i.options?.element?.nodeName??null,docSize:UT(i.editorState),durationMs:r}}),HT(bn.prototype,`createView`,`ok/cold/editor-create-view`,e=>{let t=e;return!eE()&&!XT.has(e)&&t.view&&(nE(t.view),rE(t.view),XT.add(e)),{docSize:UT(t.editorState)}}),HT(bn.prototype,`createNodeViews`,`ok/cold/create-node-views`,(e,t,n,r)=>{qT+=1;let i=e;return!eE()&&i.view&&rE(i.view),{docSize:UT(i.view),seq:qT,durationMs:r}}),HT(rr.prototype,`updateState`,`ok/cold/pm-update-state`,(e,t,n,r)=>(GT+=1,{seq:GT,docSize:UT(e.state),durationMs:r})),HT(rr.prototype,`setProps`,`ok/cold/pm-set-props`,(e,t,n,r)=>(KT+=1,{seq:KT,docSize:UT(e.state),durationMs:r})),HT(v.prototype,`_forceRerender`,`ok/cold/force-rerender`,(e,t,n,r)=>{WT+=1;let i=e,a=(()=>{try{return i.type?.toArray?i.type.toArray().length:null}catch{return null}})();return{seq:WT,topLevelYElements:a,durationMs:r}}),HT(Ai.prototype,`init`,`ok/cold/ec-init`,e=>({editorPresent:!!e.props?.editor}));try{typeof PerformanceObserver<`u`&&new PerformanceObserver(e=>{for(let t of e.getEntries()){let e=t.name;if((e===`first-paint`||e===`first-contentful-paint`)&&(ml(e===`first-paint`?`ok/cold/paint-fp`:`ok/cold/paint-fcp`,{entryType:t.entryType,startTime:Math.round(t.startTime*1e3)/1e3},{startTime:t.startTime,duration:0}),!eE()&&e===`first-paint`&&JT!==null)){let e=JT,n=Math.max(0,t.startTime-e);ml(`ok/cold/append-to-paint`,{paintEntryType:t.entryType,durationMs:Math.round(n*1e3)/1e3,paintAt:Math.round(t.startTime*1e3)/1e3},{startTime:e,duration:n}),JT=null}}}).observe({type:`paint`,buffered:!0})}catch{}globalThis.__okColdMountInstrumented=!0}}function oE(){let[e]=(0,Q.useState)(dn);return e}function sE({principal:e,identity:t}){return e&&e.source===`git-config`?{type:`human`,name:Ur(e.display_name),color:Yn(e.id,xn),coeditor:t.coeditor,tabId:t.tabId,principalId:e.id}:e&&e.source===`synthesized`?{type:`human`,name:t.name,color:Yn(e.id,xn),coeditor:t.coeditor,tabId:t.tabId}:{type:`human`,name:t.name,color:t.color,coeditor:t.coeditor,tabId:t.tabId}}function cE(e,t){return e>t}function lE(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 uE=3,dE=6e4;function fE(e,t){let n=0;for(let r of e)t-r<dE&&(n+=1);return n<uE}var pE=new Map;function mE(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 hE(e){let t=We.getState(e);return t?.snapshot!=null||t?.prevSnapshot!=null}function gE(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=We.getState(e)?.binding;if(!t)return;if(typeof t._prosemirrorChanged!=`function`){ml.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=>{cE(i,a)||r(e)}},f=()=>{if(c=!1,!s||o||!cE(i,a)||l!==null&&hE(l.state))return;o=!0;let e=Date.now();for(let[t,n]of pE)n.every(t=>e-t>=dE)&&pE.delete(t);let t=(pE.get(n)??[]).filter(t=>e-t<dE);if(!fE(t,e)){pE.set(n,t),ml.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),pE.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,ml.count(`ok/editor/binding-wedge-recovery-error`,{docName:n}),console.error(`[binding-staleness-guard] wedge recovery threw for "${n}":`,e)}},p=e=>{e.origin!==We&&mE(e,t)&&(i+=1,c||(c=!0,queueMicrotask(f)))};return new Hr({state:{init:()=>null,apply:e=>(lE(e.getMeta(We))&&(a=i,o&&ml.count(`ok/editor/binding-wedge-recovered`,{docName:n}),o=!1),null)},filterTransaction:(e,t)=>!cE(i,a)||hE(t)?!0:e.getMeta(We)!==void 0,view:e=>{let r=t.doc;return r==null?(ml.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 _E(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 vE=class{constructor({editor:e,element:t,view:n,pluginKey:r=`bubbleMenu`,updateDelay:i=250,resizeDelay:a=60,shouldShow:o,appendTo:s,getReferencedVirtualElement:c,options:l}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.floatingUIOptions={strategy:`absolute`,placement:`top`,offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1,onShow:void 0,onHide:void 0,onUpdate:void 0,onDestroy:void 0},this.shouldShow=({view:e,state:t,from:n,to:r})=>{let{doc:i,selection:a}=t,{empty:o}=a,s=!i.textBetween(n,r).length&&$n(t.selection),c=this.element.contains(document.activeElement);return!(!(e.hasFocus()||c)||o||s||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:e})=>{if(this.editor.isDestroyed){this.destroy();return}if(this.preventHide){this.preventHide=!1;return}e?.relatedTarget&&this.element.parentNode?.contains(e.relatedTarget)||e?.relatedTarget!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(e,t)=>{let n=!t?.selection.eq(e.state.selection),r=!t?.doc.eq(e.state.doc);!n&&!r||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(e,n,r,t)},this.updateDelay))},this.updateHandler=(e,t,n,r)=>{let{composing:i}=e;if(!(i||!t&&!n)){if(!this.getShouldShow(r)){this.hide();return}this.show(),this.updatePosition()}},this.transactionHandler=({transaction:e})=>{let t=e.getMeta(this.pluginKey);t===`updatePosition`?this.updatePosition():t&&typeof t==`object`&&t.type===`updateOptions`?this.updateOptions(t.options):t===`hide`?this.hide():t===`show`&&(this.updatePosition(),this.show())},this.editor=e,this.element=t,this.view=n,this.pluginKey=r,this.updateDelay=i,this.resizeDelay=a,this.appendTo=s,this.scrollTarget=l?.scrollTarget??window,this.getReferencedVirtualElement=c,this.floatingUIOptions={...this.floatingUIOptions,...l},this.element.tabIndex=0,o&&(this.shouldShow=o),this.element.addEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener(`dragstart`,this.dragstartHandler),this.editor.on(`focus`,this.focusHandler),this.editor.on(`blur`,this.blurHandler),this.editor.on(`transaction`,this.transactionHandler),window.addEventListener(`resize`,this.resizeHandler),this.scrollTarget.addEventListener(`scroll`,this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(Vs(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(Xs(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(Ws(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(Ys(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(Hs(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(Gs(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(Ks(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(Js(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=Ar(this.view,e.from,e.to),r={getBoundingClientRect:()=>n,getClientRects:()=>[n]};if(e instanceof Pr){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 kn){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():_E(o.getBoundingClientRect(),s.getBoundingClientRect());r={getBoundingClientRect:()=>c,getClientRects:()=>[c]}}return r}updatePosition(){if(!this.isVisible)return;let e=this.virtualElement;e&&Us(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()}},yE=e=>new Hr({key:typeof e.pluginKey==`string`?new Zn(e.pluginKey):e.pluginKey,view:t=>new vE({view:t,...e})});Wn.create({name:`bubbleMenu`,addOptions(){return{element:null,pluginKey:`bubbleMenu`,updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[yE({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 bE=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 Tr(e,{textSerializers:or(this.editor.schema)})}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(Vs(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(Xs(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(Ws(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(Ys(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(Hs(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(Gs(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(Ks(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(Js(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=Ar(this.view,e.from,e.to);Us({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()}},xE=e=>new Hr({key:typeof e.pluginKey==`string`?new Zn(e.pluginKey):e.pluginKey,view:t=>new bE({view:t,...e})});Wn.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?[xE({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 SE(e,t){return e??new Zn(t)}var CE=typeof window<`u`?Q.useLayoutEffect:Q.useEffect,wE=new Set([`left`,`opacity`,`position`,`top`,`visibility`,`width`]),TE=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(`.`)),EE=new Set([`children`,`className`,`style`]),DE=new Set([`tabIndex`]),OE=new Set([`accessKey`,`autoCapitalize`,`contentEditable`,`contextMenu`,`dir`,`draggable`,`enterKeyHint`,`hidden`,`id`,`lang`,`nonce`,`role`,`slot`,`spellCheck`,`tabIndex`,`title`,`translate`]),kE={Blur:`focusout`,DoubleClick:`dblclick`,Focus:`focusin`,MouseEnter:`mouseenter`,MouseLeave:`mouseleave`};function AE(e,t){return/^on[A-Z]/.test(e)&&typeof t==`function`}function jE(e){return e.startsWith(`aria-`)||e.startsWith(`data-`),e}function ME(e){return e.startsWith(`aria-`)||e.startsWith(`data-`)||OE.has(e)}function NE(e){return e.startsWith(`--`)?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function PE(e){let t=e.endsWith(`Capture`),n=(t?e.slice(0,-7):e).slice(2);return{eventName:kE[n]??n.toLowerCase(),options:t?{capture:!0}:void 0}}function FE(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 IE(e){return DE.has(e)}function LE(e,t,n){if(t===`tabIndex`){e.tabIndex=Number(n);return}e[t]=n}function RE(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 zE(e,t){return typeof t!=`number`||t===0||e.startsWith(`--`)||TE.has(e)?String(t):`${t}px`}function BE(e,t){wE.has(t)||e.style.removeProperty(NE(t))}function VE(e,t,n){wE.has(t)||e.style.setProperty(NE(t),zE(t,n))}function HE(e,t,n){new Set([...Object.keys(t),...Object.keys(n)]).forEach(r=>{if(EE.has(r)||!ME(r)||AE(r,t[r])||AE(r,n[r]))return;let i=t[r],a=n[r];if(i===a)return;let o=jE(r);if(a==null||a===!1){IE(r)&&RE(e,r),e.removeAttribute(o);return}if(a===!0){IE(r)&&LE(e,r,!0),e.setAttribute(o,``);return}if(IE(r)){LE(e,r,a);return}e.setAttribute(o,String(a))})}function UE(e,t,n){if(t!==n){if(n){e.className=n;return}e.removeAttribute(`class`)}}function WE(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){BE(e,t);return}VE(e,t,a)}})}function GE(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(!AE(t,n))return;let{eventName:i,options:a}=PE(t),o=t=>{n(FE(e,t))};e.addEventListener(i,o,a),r.push({eventName:i,listener:o,options:a})}),r}function KE(e,t){let n=(0,Q.useRef)({}),r=(0,Q.useRef)([]);CE(()=>{let i=n.current;return UE(e,i.className,t.className),WE(e,i.style,t.style),HE(e,i,t),r.current=GE(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 qE=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)(SE(e,`bubbleMenu`)).current;KE(d.current,l),typeof u==`function`?u(d.current):u&&(u.current=d.current);let{editor:p}=Oi(),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=yE({...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,Ed.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)(SE(e,`floatingMenu`)).current;KE(u.current,c),typeof l==`function`?l(u.current):l&&(l.current=u.current);let{editor:f}=Oi(),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=xE({...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,Ed.createPortal)(s,u.current)});var JE=[{name:`paragraph`,label:`Text`,icon:yf,isActive:e=>e.isActive(`paragraph`)&&!e.isActive(`list`),command:e=>e.chain().focus().setParagraph().run()},{name:`heading1`,label:`Heading 1`,icon:p,isActive:e=>e.isActive(`heading`,{level:1}),command:e=>e.chain().focus().toggleHeading({level:1}).run()},{name:`heading2`,label:`Heading 2`,icon:K,isActive:e=>e.isActive(`heading`,{level:2}),command:e=>e.chain().focus().toggleHeading({level:2}).run()},{name:`heading3`,label:`Heading 3`,icon:St,isActive:e=>e.isActive(`heading`,{level:3}),command:e=>e.chain().focus().toggleHeading({level:3}).run()},{name:`bulletList`,label:`Bullet List`,icon:Ie,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:me,isActive:e=>e.isActive(`list`,{ordered:!0}),command:e=>e.chain().focus().toggleOrderedList().run()},{name:`taskList`,label:`Task List`,icon:Ne,isActive:e=>e.isActive(`listItem`,{checked:!0})||e.isActive(`listItem`,{checked:!1}),command:e=>e.chain().focus().toggleTaskList().run()},{name:`blockquote`,label:`Quote`,icon:Ae,isActive:e=>e.isActive(`blockquote`),command:e=>e.chain().focus().toggleBlockquote().run()},{name:`codeBlock`,label:`Code Block`,icon:Af,isActive:e=>e.isActive(`codeBlock`),command:e=>e.chain().focus().toggleCodeBlock({language:`js`}).run()}];function YE(e){let t=(0,$.c)(18),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:XE},t[0]=n,t[1]=r);let{current:i,activeStates:a}=bi(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)(ea,{className:`size-3 opacity-50`}),t[6]=l):l=t[6];let u;t[7]!==s||t[8]!==c?(u=(0,Z.jsx)(ic,{asChild:!0,children:(0,Z.jsxs)(Jr,{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=JE.map(e=>{let t=e.icon,r=a[e.name];return(0,Z.jsxs)(vc,{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)(bc,{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)(Ec,{children:[u,f]}),t[15]=u,t[16]=f,t[17]=p):p=t[17],p}function XE(e){let t=Object.fromEntries(JE.map(t=>[t.name,t.isActive(e.editor)]));return{current:JE.find(e=>t[e.name])??JE[0],activeStates:t}}var ZE=`0 2px 4px rgba(0, 0, 0, 0.08)`,QE=150,$E=globalThis.ScrollTimeline;function eD(e,t,n,r,i){let a=r-i;if(a<=0)return null;let o=e+n-(t+56);return{startOffset:o,endOffset:o+a,maxShift:a}}var tD=new WeakMap;function nD(e){let t=tD.get(e);if(t){for(let e of t.animations)e.cancel();tD.delete(e)}}function rD(e){for(let t of Array.from(e.cells))nD(t)}var iD=e=>e.cellIndex===0?`3`:`2`;function aD(e,t){return oD(e,t,e=>({transform:`translateY(${e}px)`}))}function oD(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 sD(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 cD(e,t,n){return sD(e,t,{zIndex:`auto`,boxShadow:`none`},{zIndex:n,boxShadow:ZE})}function lD(e,t){return sD(e,t,{opacity:`0`},{opacity:`1`})}function uD(e,t,n,r){let i=iD(e),a=`sd|${n.startOffset}|${n.maxShift}|${r}|${i}`,o=tD.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(aD(n,r),s),l=e.animate(cD(n,r,i),s),u=e.animate(lD(n,r),{...s,pseudoElement:`::before`});tD.set(e,{key:a,animations:[c,l,u]})}function dD(e,t){let n=iD(e),r=`in|${t}|${n}`,i=tD.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:ZE}],{duration:0,fill:`forwards`}),o=e.animate([{opacity:`1`}],{duration:0,fill:`forwards`,pseudoElement:`::before`});tD.set(e,{key:r,animations:[a,o]})}function fD(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=eD(a,i,c.top,c.height,l.height);if(!u){rD(s);continue}if(n){if(o<=0){rD(s);continue}for(let e of Array.from(s.cells))uD(e,n,u,o);continue}let d=Math.max(0,Math.min(a-u.startOffset,u.maxShift));if(d<=0||c.bottom<=i+56){rD(s);continue}for(let e of Array.from(s.cells))dD(e,d)}}var pD=Wn.create({name:`frozenTableHeaders`,addProseMirrorPlugins(){return[new Hr({key:new Zn(`frozenTableHeaders`),view(e){let t=null,n=null,r=null,i=null,a=null,o=!1,s=new Set,c=()=>{o||!t||fD(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()},QE);return}l()};return requestAnimationFrame(()=>{if(!o){if(t=e.dom.closest(`[data-testid="editor-scroll-container"]`),t&&$E)try{n=new $E({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`))rD(t)}}}})]}});function mD(e){return()=>{let t=null;try{t=e.view.dom.closest(`.editor-doc-scroll`)}catch{}let n={top:56,bottom:hD(`--ask-composer-height`)+hD(`--conflict-footer-height`)};return t?{boundary:t,padding:n}:{padding:n}}}function hD(e){let t=Number.parseFloat(document.documentElement.style.getPropertyValue(e));return Number.isFinite(t)?t:0}function gD(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 _D(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:rt(typeof n.src==`string`?n.src:``)}function vD(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 yD(e){let t=(0,$.c)(13),{editor:n}=e,{_:r}=kt(),i;if(t[0]===n?i=t[1]:(i={editor:n,selector:bD},t[0]=n,t[1]=i),bi(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=gD(n);t&&vD(t,_D(n))},t[4]=n,t[5]=o);let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(So,{className:`size-3.5`}),t[6]=s):s=t[6];let c;t[7]!==a||t[8]!==o?(c=(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(Jr,{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)(Es,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(J,{id:`WcWS__`})}),t[10]=l):l=t[10];let u;return t[11]===c?u=t[12]:(u=(0,Z.jsx)(`div`,{className:`flex items-center gap-0.5`,children:(0,Z.jsxs)(Os,{children:[c,l]})}),t[11]=c,t[12]=u),u}function bD(e){return gD(e.editor)}function xD(e){return gD(e)!==null}var SD=`img, .ok-embed, .ok-video`,CD=220,wD=`cubic-bezier(0.23, 1, 0.32, 1)`,TD=`ok-image-align-flip`,ED=.5;function DD(){return typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function OD(){return typeof requestAnimationFrame==`function`}function kD(e){return e?e.querySelector(SD):null}function AD(e,t){if(DD()||!OD()){t();return}let n=kD(e);if(!n){t();return}let r=n.getBoundingClientRect().left;t(),requestAnimationFrame(()=>{let t=kD(e);if(!t)return;for(let e of t.getAnimations())e.id===TD&&e.cancel();let n=r-t.getBoundingClientRect().left;if(Math.abs(n)<ED)return;let i=t.animate([{transform:`translateX(${n}px)`},{transform:`translateX(0)`}],{duration:CD,easing:wD,fill:`none`});i.id=TD})}var jD=[{value:`left`,label:`Align left`,icon:Vf},{value:`center`,label:`Align center`,icon:zf},{value:`right`,label:`Align right`,icon:Bf}];function MD(e){let t=e.state.selection.node;if(!t||t.type.name!==`jsxComponent`)return null;let n=t.attrs.componentName;if(!_t.has(String(n)))return null;let r=(t.attrs.props??{}).align;return r===`left`||r===`right`||r===`center`?r:`center`}function ND(e){let t=(0,$.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:PD},t[0]=n,t[1]=r);let i=bi(r);if(i===null)return null;let a;t[2]!==i||t[3]!==n?(a=jD.map(e=>{let{value:t,label:r,icon:a}=e,o=i===t;return(0,Z.jsxs)(Os,{children:[(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(Jr,{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(!_t.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(Pr.create(u.doc,s)),AD(n.view.nodeDOM(s),()=>{n.view.dispatch(u)})},children:(0,Z.jsx)(a,{className:`size-3.5`})})}),(0,Z.jsx)(Es,{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 PD(e){return MD(e.editor)}function FD(e){return MD(e)!==null}function ID({editor:e}){if(o(e.state).query||e.isActive(`codeBlock`))return!1;if(FD(e)||xD(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 LD(e){throw Error(`Unhandled AddLinkShortcutAction variant: ${JSON.stringify(e)}`)}function RD(e){let{selection:t}=e.state;if(t.empty){if(!e.isActive(`link`))return null;let n=ce(e.state,t.from,`link`);return n===null?null:{kind:`edit-link`,markId:n}}return!ID({editor:e})||FD(e)||xD(e)?null:{kind:`open-popover`}}function zD(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName.toUpperCase();return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`}function BD(e){let t=(0,$.c)(3),{editor:n,shortcutEnabled:r}=e,i=r===void 0?!1:r;if(Po())return null;let a;return t[0]!==n||t[1]!==i?(a=(0,Z.jsx)(VD,{editor:n,shortcutEnabled:i}),t[0]=n,t[1]=i,t[2]=a):a=t[2],a}function VD(e){let t=(0,$.c)(11),{editor:n,shortcutEnabled:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=Or(),t[0]=i):i=t[0];let a=i,o,s;t[1]===r?(o=t[2],s=t[3]):(o=()=>{if(!a)return;let e=e=>{r&&jl(e,`edit-with-ai`)&&(zD(e.target)||(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),C()))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},s=[r,a],t[1]=r,t[2]=o,t[3]=s),(0,Q.useEffect)(o,s);let c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(eo,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),t[4]=c):c=t[4];let l;t[5]===n?l=t[6]:(l=()=>{let e=ui(n),t=Eu(n);requestAnimationFrame(()=>{if(e===null||t.trim()===``){C();return}d(Er({relativePath:Io(e),instruction:``,selectionMarkdown:t,target:`claude-code`}))})},t[5]=n,t[6]=l);let u,f;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(jo,{className:`size-3.5`,"aria-hidden":`true`}),f=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`xWEvuo`})}),t[7]=u,t[8]=f):(u=t[7],f=t[8]);let p;return t[9]===l?p=t[10]:(p=(0,Z.jsxs)(Z.Fragment,{children:[c,(0,Z.jsxs)(Jr,{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:l,children:[u,f]})]}),t[9]=l,t[10]=p),p}function HD(e){let t=e.schema.nodes;return!!(t.footnoteReference&&t.footnoteDefinition)}function UD(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 WD(e){let{$from:t,$to:n}=e.state.selection;return!t.sameParent(n)}function GD(e){let t=(0,$.c)(21),{editor:n}=e,{_:r}=kt(),i;t[0]===n?i=t[1]:(i={editor:n,selector:KD},t[0]=n,t[1]=i);let a=bi(i),o;t[2]!==a||t[3]!==n?(o=()=>{if(a||!HD(n)||n.state.selection.empty||WD(n)||UD(n))return;let{from:e,to:t}=n.state.selection,r=n.state.doc.textBetween(e,t,` `);if(!r.trim())return;let i=Dr(qn(n.state.doc)),o=Xn(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)(ht,{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)(Ts,{asChild:!0,children:(0,Z.jsx)(Jr,{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)(Es,{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)(Os,{children:[d,p]}),t[18]=d,t[19]=p,t[20]=m):m=t[20],m}function KD(e){let t=e.editor;return!!(!HD(t)||t.state.selection.empty||WD(t)||UD(t))}var qD=[{name:`bold`,icon:wd,command:e=>e.chain().focus().toggleBold().run(),isActive:e=>e.isActive(`strong`),shortcutId:`format-bold`},{name:`italic`,icon:ef,command:e=>e.chain().focus().toggleItalic().run(),isActive:e=>e.isActive(`emphasis`),shortcutId:`format-italic`},{name:`underline`,icon:Wf,command:e=>e.chain().focus().toggleUnderline().run(),isActive:e=>e.isActive(`underline`),shortcutId:`format-underline`},{name:`strikethrough`,icon:If,command:e=>e.chain().focus().toggleStrike().run(),isActive:e=>e.isActive(`strike`),shortcutId:`format-strike`},{name:`code`,icon:R,command:e=>e.chain().focus().toggleCode().run(),isActive:e=>e.isActive(`code`),shortcutId:`format-inline-code`},{name:`highlight`,icon:Qd,command:e=>e.chain().focus().toggleHighlight().run(),isActive:e=>e.isActive(`highlight`),shortcutId:`format-highlight`}];function JD(e){let t=(0,$.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:YD},t[0]=n,t[1]=r);let i=bi(r),a;t[2]!==i||t[3]!==n?(a=qD.map(e=>{let t=e.icon,r=i[e.name];return(0,Z.jsxs)(Os,{children:[(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(Jr,{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)(Es,{side:`bottom`,sideOffset:8,children:[(0,Z.jsx)(`span`,{className:`capitalize`,children:e.name}),(0,Z.jsx)(M,{"aria-label":Ml(e.shortcutId),children:Al(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 YD(e){return Object.fromEntries(qD.map(t=>[t.name,t.isActive(e.editor)]))}var XD=`open-knowledge:open-link-edit-popover`;function ZD(e=typeof window>`u`?new EventTarget:window){e.dispatchEvent(new CustomEvent(XD))}function QD(e,t=typeof window>`u`?new EventTarget:window){let n=()=>e();return t.addEventListener(XD,n),()=>t.removeEventListener(XD,n)}function $D(e){return e.state.selection.empty&&e.isActive(`link`)?e.getAttributes(`link`).href??``:``}async function eO(e,t){let n;try{n=await navigator.clipboard.readText()}catch(e){e instanceof DOMException||console.warn(`[link-popover] clipboard pre-fill read failed unexpectedly`,e);return}let r=Dt(n);r!==null&&(t(e=>e===``?r:e),requestAnimationFrame(()=>{let t=e.current;t&&t.value===r&&t.select()}))}function tO(e,t,n,r){let i=$D(e);n(i),r(!0),i===``&&eO(t,n)}function nO(e){let t=(0,$.c)(72),{editor:n,shortcutEnabled:r}=e,i=r===void 0?!1:r,{_:a}=kt(),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(``),u=(0,Q.useRef)(null),{folderPaths:d,loading:f,pages:p}=ia(),m;t[0]===n?m=t[1]:(m=n.state.selection.empty&&n.isActive(`link`),t[0]=n,t[1]=m);let h=m,g;t[2]===n?g=t[3]:(g=n.getAttributes(`link`).href??``,t[2]=n,t[3]=g);let _=g,v,y;t[4]!==n||t[5]!==i?(v=()=>QD(()=>{i&&tO(n,u,l,s)}),y=[i,n],t[4]=n,t[5]=i,t[6]=v,t[7]=y):(v=t[6],y=t[7]),(0,Q.useEffect)(v,y);let b,x;t[8]!==n||t[9]!==i?(b=()=>{let e=e=>{if(!i||!jl(e,`add-link`)||!n.editorView?.hasFocus())return;let t=RD(n);if(t!==null)switch(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),t.kind){case`open-popover`:ZD();return;case`edit-link`:{let{markId:e}=t;fe(e),requestAnimationFrame(()=>{E(n).setActiveNode(e)});return}default:LD(t)}};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},x=[i,n],t[8]=n,t[9]=i,t[10]=b,t[11]=x):(b=t[10],x=t[11]),(0,Q.useEffect)(b,x);let S,C;t[12]===n?(S=t[13],C=t[14]):(S=()=>{let e=function(){n.state.selection.empty&&s(!1)};return n.on(`selectionUpdate`,e),()=>{n.off(`selectionUpdate`,e)}},C=[n],t[12]=n,t[13]=S,t[14]=C),(0,Q.useEffect)(S,C);let w,T;t[15]===o?(w=t[16],T=t[17]):(w=()=>{if(!o)return;let e=!1,t=0,n=r=>{if(e)return;let i=u.current;i&&(i.focus(),document.activeElement===i)||(r<60?t=requestAnimationFrame(()=>n(r+1)):console.warn(`[link-popover] URL input never became focusable`))};return t=requestAnimationFrame(()=>n(0)),()=>{e=!0,cancelAnimationFrame(t)}},T=[o],t[15]=o,t[16]=w,t[17]=T),(0,Q.useEffect)(w,T);let D;t[18]!==n||t[19]!==h||t[20]!==c?(D=function(){c.trim()?n.chain().focus().setLink({href:c.trim()}).run():h&&n.chain().focus().unsetLink().run(),s(!1)},t[18]=n,t[19]=h,t[20]=c,t[21]=D):D=t[21];let O=D,k;t[22]===n?k=t[23]:(k=function(){n.chain().focus().unsetLink().run(),s(!1)},t[22]=n,t[23]=k);let A=k,j;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(j=function(e){l(Ei(e.path,null))},t[24]=j):j=t[24];let N=j,P;t[25]!==O||t[26]!==n?(P=function(e){e.key===`Enter`&&(e.preventDefault(),O()),e.key===`Escape`&&(e.preventDefault(),s(!1),n.chain().focus().run())},t[25]=O,t[26]=n,t[27]=P):P=t[27];let F=P;if(o){let e;t[28]===a?e=t[29]:(e=a({id:`ZsGpr_`}),t[28]=a,t[29]=e);let n;t[30]===a?n=t[31]:(n=a({id:`roAe2K`}),t[30]=a,t[31]=n);let r;t[32]!==d||t[33]!==F||t[34]!==f||t[35]!==p||t[36]!==e||t[37]!==n||t[38]!==c?(r=(0,Z.jsx)(Ue,{ref:u,type:`text`,placeholder:e,value:c,pages:p,folderPaths:d,loading:f,onValueChange:l,onSuggestionSelect:N,onKeyDown:F,"aria-label":n,className:`h-5 w-44 rounded-none border-none bg-transparent px-0 py-0 text-sm placeholder:text-muted-foreground focus-visible:border-transparent focus-visible:ring-0 dark:bg-transparent`}),t[32]=d,t[33]=F,t[34]=f,t[35]=p,t[36]=e,t[37]=n,t[38]=c,t[39]=r):r=t[39];let i;t[40]===a?i=t[41]:(i=a({id:`tP5DDk`}),t[40]=a,t[41]=i);let o;t[42]===O?o=t[43]:(o=()=>{O()},t[42]=O,t[43]=o);let s;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(Ld,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[44]=s):s=t[44];let m;t[45]!==i||t[46]!==o?(m=(0,Z.jsx)(Jr,{variant:`ghost`,size:`icon-xs`,"aria-label":i,onClick:o,children:s}),t[45]=i,t[46]=o,t[47]=m):m=t[47];let g;t[48]!==r||t[49]!==m?(g=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5 rounded-md border bg-background px-2 py-1 focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50`,children:[r,m]}),t[48]=r,t[49]=m,t[50]=g):g=t[50];let v;t[51]!==a||t[52]!==_||t[53]!==h||t[54]!==A?(v=h&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Os,{children:[(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(Jr,{variant:`ghost`,size:`icon-xs`,"aria-label":a({id:`2vIPtm`}),onMouseDown:e=>{e.preventDefault(),_i(_)},children:(0,Z.jsx)(Hi,{className:`size-3.5`})})}),(0,Z.jsx)(Es,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(J,{id:`2vIPtm`})})]}),(0,Z.jsxs)(Os,{children:[(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(Jr,{variant:`ghost`,size:`icon-xs`,"aria-label":a({id:`484LKL`}),onMouseDown:e=>{e.preventDefault(),A()},children:(0,Z.jsx)(as,{className:`size-3.5`})})}),(0,Z.jsx)(Es,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(J,{id:`484LKL`})})]})]}),t[51]=a,t[52]=_,t[53]=h,t[54]=A,t[55]=v):v=t[55];let y;return t[56]!==g||t[57]!==v?(y=(0,Z.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[g,v]}),t[56]=g,t[57]=v,t[58]=y):y=t[58],y}let I;t[59]===a?I=t[60]:(I=a({id:`p0Iq25`}),t[59]=a,t[60]=I);let L=h?`bg-accent text-primary`:`text-accent-foreground`,R;t[61]===n?R=t[62]:(R=e=>{e.preventDefault(),tO(n,u,l,s)},t[61]=n,t[62]=R);let z;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Z.jsx)(nf,{className:`size-3.5`}),t[63]=z):z=t[63];let B;t[64]!==I||t[65]!==L||t[66]!==R?(B=(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(Jr,{variant:`ghost`,size:`icon-xs`,"aria-label":I,className:L,onMouseDown:R,children:z})}),t[64]=I,t[65]=L,t[66]=R,t[67]=B):B=t[67];let V;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Z.jsx)(J,{id:`yzF66j`}),t[68]=V):V=t[68];let H;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Z.jsxs)(Es,{side:`bottom`,sideOffset:8,children:[V,(0,Z.jsx)(M,{children:Al(`add-link`)})]}),t[69]=H):H=t[69];let U;return t[70]===B?U=t[71]:(U=(0,Z.jsxs)(Os,{children:[B,H]}),t[70]=B,t[71]=U),U}function rO(e){let t=(0,$.c)(30),{editor:n,shortcutEnabled:r}=e,i=r===void 0?!0:r,a=(0,Q.useRef)(null),[o,s]=(0,Q.useState)(0),c=(0,Q.useRef)(null),l;t[0]===n?l=t[1]:(l={editor:n,selector:cO},t[0]=n,t[1]=l);let u=bi(l),d;t[2]===n?d=t[3]:(d={editor:n,selector:sO},t[2]=n,t[3]=d);let f=bi(d),p;t[4]!==n.state||t[5]!==n.view?(p=()=>{try{let{from:e,to:t}=n.state.selection;return Ar(n.view,e,t)}catch{return new DOMRect}},t[4]=n.state,t[5]=n.view,t[6]=p):p=t[6];let m;t[7]!==n.view.dom||t[8]!==p?(m={getBoundingClientRect:p,contextElement:n.view.dom},t[7]=n.view.dom,t[8]=p,t[9]=m):m=t[9];let h=m,g;t[10]===n?g=t[11]:(g=mD(n),t[10]=n,t[11]=g);let _=g,v;t[12]!==_||t[13]!==h?(v=()=>{let e=a.current;e&&(c.current?.(),c.current=qs(h,e,()=>{Us(h,e,{placement:`top`,strategy:`fixed`,middleware:[Ws(8),Vs(_),Xs({padding:8}),Ks(_)]}).then(t=>{let{x:n,y:r,middlewareData:i}=t;e.isConnected&&(e.style.position=`fixed`,e.style.left=`${n}px`,e.style.top=`${r}px`,e.style.visibility=i.hide?.referenceHidden?`hidden`:`visible`)}).catch(oO)}))},t[12]=_,t[13]=h,t[14]=v):v=t[14];let y=v,b;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(b=()=>{c.current?.(),c.current=null,s(aO)},t[15]=b):b=t[15];let x=b,S;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(S={padding:8},t[16]=S):S=t[16];let C;t[17]!==_||t[18]!==y?(C={onShow:y,onHide:x,strategy:`fixed`,flip:_,shift:S,hide:_},t[17]=_,t[18]=y,t[19]=C):C=t[19];let w;t[20]!==n||t[21]!==f||t[22]!==u||t[23]!==i||t[24]!==o?(w=u?(0,Z.jsx)(ND,{editor:n},`${o}-img-align`):f?(0,Z.jsx)(yD,{editor:n},`${o}-file`):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(YE,{editor:n}),(0,Z.jsx)(eo,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(JD,{editor:n},o),(0,Z.jsx)(eo,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(nO,{editor:n,shortcutEnabled:i},`${o}-link`),(0,Z.jsx)(GD,{editor:n},`${o}-footnote`),(0,Z.jsx)(BD,{editor:n,shortcutEnabled:i},`${o}-edit-ai`)]}),t[20]=n,t[21]=f,t[22]=u,t[23]=i,t[24]=o,t[25]=w):w=t[25];let T;return t[26]!==n||t[27]!==C||t[28]!==w?(T=(0,Z.jsx)(qE,{ref:a,editor:n,"data-testid":`bubble-menu-bar`,appendTo:iO,shouldShow:ID,updateDelay:250,options:C,className:`z-50 flex items-center gap-0.5 rounded-lg border bg-background p-1 shadow-md`,children:w}),t[26]=n,t[27]=C,t[28]=w,t[29]=T):T=t[29],T}function iO(){return document.body}function aO(e){return e+1}function oO(){}function sO(e){return xD(e.editor)}function cO(e){return FD(e.editor)}function lO(e,t){return(n,r)=>{let i=r,a=Uu(i.dataTransfer);return a?(i.preventDefault(),t?.(a),!0):e(n,i)}}function uO(e,t){let n=ju(e);t(n.target,{tabBehavior:`append`}),yl(n.hash)}var dO=5,fO=1;function pO(e){let t=(0,$.c)(14),{editor:n,axis:r,anchor:i,onClickGesture:a}=e,o=(0,Q.useRef)(null),s=(0,Q.useRef)(null),c=(0,Q.useRef)(a),l,u;t[0]===a?(l=t[1],u=t[2]):(l=()=>{c.current=a},u=[a],t[0]=a,t[1]=l,t[2]=u),(0,Q.useEffect)(l,u);let d,f;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>()=>{s.current?.abort(),s.current=null,o.current=null,document.body.style.cursor=``,document.body.style.userSelect=``},f=[],t[3]=d,t[4]=f):(d=t[3],f=t[4]),(0,Q.useEffect)(d,f);let[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(null),_;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(_=e=>!(e&&o.current!==null),t[5]=_):_=t[5];let v=_,y;t[6]!==i||t[7]!==r||t[8]!==n?(y=e=>{if(e.button!==0)return;s.current?.abort(),o.current={startX:e.clientX,startY:e.clientY,isDragging:!1,lastTarget:null};let t=new AbortController;s.current=t;let{signal:a}=t,l=e=>{let t=o.current;if(!t)return;if(!t.isDragging){let n=e.clientX-t.startX,r=e.clientY-t.startY;if(Math.hypot(n,r)<dO)return;t.isDragging=!0,m(!0),document.body.style.cursor=`grabbing`,document.body.style.userSelect=`none`}let n=mO(i,r,e.clientX,e.clientY);t.lastTarget=n,g(n)},u=()=>{t.abort(),s.current===t&&(s.current=null),document.body.style.cursor=``,document.body.style.userSelect=``;let e=o.current;o.current=null,m(!1),g(null),e&&(e.isDragging&&e.lastTarget?vO(n,i,r,e.lastTarget.index):e.isDragging||c.current())};document.addEventListener(`pointermove`,l,{signal:a}),document.addEventListener(`pointerup`,u,{signal:a}),document.addEventListener(`pointercancel`,u,{signal:a})},t[6]=i,t[7]=r,t[8]=n,t[9]=y):y=t[9];let b=y,x;return t[10]!==h||t[11]!==p||t[12]!==b?(x={onPointerDown:b,shouldAllowOpen:v,isDragging:p,indicator:h},t[10]=h,t[11]=p,t[12]=b,t[13]=x):x=t[13],x}function mO(e,t,n,r){let i=e.closest(`table`);if(!i)return null;let a=i.getBoundingClientRect();if(t===`row`){let e=Array.from(i.rows);if(e.length===0)return null;for(let t=0;t<e.length;t++){let n=e[t].getBoundingClientRect();if(r<n.top)return{index:fO,rect:gO(a,hO(e,0,n.top))};if(r<=n.bottom){let i=r>=n.top+n.height/2,o=i?t+1:t,s=Math.max(fO,o);return{index:s,rect:gO(a,s===o?i?n.bottom:n.top:hO(e,0,n.top))}}}let t=e[e.length-1].getBoundingClientRect();return{index:e.length,rect:gO(a,t.bottom)}}let o=i.rows[0];if(!o)return null;let s=Array.from(o.cells);if(s.length===0)return null;for(let e=0;e<s.length;e++){let t=s[e].getBoundingClientRect();if(n<t.left)return{index:0,rect:_O(a,t.left)};if(n<=t.right){let r=n>=t.left+t.width/2,i=r?t.right:t.left;return{index:r?e+1:e,rect:_O(a,i)}}}let c=s[s.length-1].getBoundingClientRect();return{index:s.length,rect:_O(a,c.right)}}function hO(e,t,n){let r=e[t];return r?r.getBoundingClientRect().bottom:n}function gO(e,t){return{left:e.left,top:t-1,width:e.width,height:2}}function _O(e,t){return{left:t-1,top:e.top,width:2,height:e.height}}function vO(e,t,n,r){let i=n===`row`?yO(t):t.cellIndex;if(i<0||n===`row`&&(i<fO||r<fO)||r===i||r===i+1)return;let{state:a,view:o}=e,s=bO(a.selection.$from);if(s<0){console.warn(`[table-drag-reorder] no table found at selection depth`);return}let c=a.doc.nodeAt(s);if(!c){console.warn(`[table-drag-reorder] nodeAt returned null at tablePos`,s);return}let l=a.tr;CO(l,s,c,n===`row`?xO(c,i,r):SO(c,i,r)),o.dispatch(l)}function yO(e){let t=e.parentElement,n=t?.closest(`table`);return n?Array.prototype.indexOf.call(n.rows,t):-1}function bO(e){for(let t=e.depth;t>0;t--)if(e.node(t).type.spec.tableRole===`table`)return e.before(t);return-1}function xO(e,t,n){let r=[];e.forEach(e=>{r.push(e)});let[i]=r.splice(t,1),a=n>t?n-1:n;return r.splice(a,0,i),e.type.create(e.attrs,r,e.marks)}function SO(e,t,n){let r=n>t?n-1:n,i=[];return e.forEach(e=>{let n=[];e.forEach(e=>{n.push(e)});let[a]=n.splice(t,1);n.splice(r,0,a),i.push(e.type.create(e.attrs,n,e.marks))}),e.type.create(e.attrs,i,e.marks)}function CO(e,t,n,r){e.replaceRangeWith(t,t+n.nodeSize,r)}function wO(e){return[...e?[{label:`Toggle header column`,icon:Fd,run:e=>e.chain().focus().toggleHeaderColumn().run()}]:[],{label:`Insert column left`,icon:Ni,run:e=>e.chain().focus().addColumnBefore().run()},{label:`Insert column right`,icon:vi,run:e=>e.chain().focus().addColumnAfter().run()},{label:`Delete column`,icon:as,separatorBefore:!0,run:e=>e.chain().focus().deleteColumn().run()},{label:`Delete table`,icon:Yd,run:e=>e.chain().focus().deleteTable().run()}]}function TO(e){return[...e?[{label:`Toggle header row`,icon:Lf,run:e=>e.chain().focus().toggleHeaderRow().run()}]:[],{label:`Insert row above`,icon:Ci,run:e=>e.chain().focus().addRowBefore().run()},{label:`Insert row below`,icon:Ii,run:e=>e.chain().focus().addRowAfter().run()},{label:`Delete row`,icon:as,separatorBefore:!0,run:e=>e.chain().focus().deleteRow().run()},{label:`Delete table`,icon:Yd,run:e=>e.chain().focus().deleteTable().run()}]}function EO(e){if(!e.isEditable||o(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 s=a.closest(`table`),c=a.closest(`tr`),l=a.closest(`.ProseMirror`);if(!s||!c||!l)return null;let u=Array.prototype.indexOf.call(s.rows,c),d=a.cellIndex,f=s.rows[0]?.cells[d],p=s.rows[u]?.cells[0];return!f||!p?null:{columnAnchor:f,rowAnchor:p,isFirstColumn:d===0,isFirstRow:u===0}}function DO(e){let t=(0,$.c)(37),{editor:n,anchor:r,axis:i,items:a}=e,o=(0,Q.useRef)(null),[s,c]=(0,Q.useState)(!1),l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>c(!0),t[0]=l):l=t[0];let u;t[1]!==r||t[2]!==i||t[3]!==n?(u={editor:n,axis:i,anchor:r,onClickGesture:l},t[1]=r,t[2]=i,t[3]=n,t[4]=u):u=t[4];let d=pO(u),f,p;t[5]!==r||t[6]!==i?(f=()=>{let e=o.current;if(!e)return;let t=i===`column`?`top`:`left`,n=i===`column`?-14:-6;return qs(r,e,()=>{Us(r,e,{strategy:`absolute`,placement:t,middleware:[Ws(n)]}).then(t=>{let{x:n,y:r}=t;e.style.left=`${n}px`,e.style.top=`${r}px`,e.style.opacity=`1`}).catch(OO)})},p=[r,i],t[5]=r,t[6]=i,t[7]=f,t[8]=p):(f=t[7],p=t[8]),(0,Q.useEffect)(f,p);let m=i===`column`?zd:lo,h;t[9]===d?h=t[10]:(h=e=>{d.shouldAllowOpen(e)&&c(e)},t[9]=d,t[10]=h);let g=i===`column`?`h-3 w-7 rounded-full p-0 text-gray-700 dark:text-muted-foreground bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 hover:text-foreground dark:hover:bg-gray-600 dark:hover:text-gray-100 relative cursor-grab before:absolute before:-inset-[6px] before:content-[""]`:`h-7 w-3 rounded-full p-0 text-gray-700 dark:text-muted-foreground bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 hover:text-foreground dark:hover:bg-gray-600 dark:hover:text-gray-100 relative cursor-grab before:absolute before:-inset-[6px] before:content-[""]`,_=i===`column`?`Column options`:`Row options`,v;t[11]===m?v=t[12]:(v=(0,Z.jsx)(m,{className:`size-3.5`,"aria-hidden":!0}),t[11]=m,t[12]=v);let y;t[13]!==d.onPointerDown||t[14]!==g||t[15]!==_||t[16]!==v?(y=(0,Z.jsx)(ic,{asChild:!0,children:(0,Z.jsx)(Jr,{variant:`secondary`,onPointerDown:d.onPointerDown,className:g,"aria-label":_,children:v})}),t[13]=d.onPointerDown,t[14]=g,t[15]=_,t[16]=v,t[17]=y):y=t[17];let b=i===`column`?`center`:`start`,x=i===`column`?`bottom`:`right`,S;if(t[18]!==n||t[19]!==a){let e;t[21]===n?e=t[22]:(e=e=>(0,Z.jsxs)(Q.Fragment,{children:[e.separatorBefore&&(0,Z.jsx)(mc,{}),(0,Z.jsxs)(vc,{onSelect:()=>e.run(n),children:[(0,Z.jsx)(e.icon,{"aria-hidden":!0}),e.label]})]},e.label),t[21]=n,t[22]=e),S=a.map(e),t[18]=n,t[19]=a,t[20]=S}else S=t[20];let C;t[23]!==b||t[24]!==x||t[25]!==S?(C=(0,Z.jsx)(bc,{align:b,side:x,className:`w-auto min-w-44 whitespace-nowrap`,children:S}),t[23]=b,t[24]=x,t[25]=S,t[26]=C):C=t[26];let w;t[27]!==s||t[28]!==C||t[29]!==h||t[30]!==y?(w=(0,Z.jsx)(`div`,{ref:o,"data-testid":`table-cell-handle`,className:`absolute left-0 top-0 z-10 opacity-0`,children:(0,Z.jsxs)(Ec,{open:s,onOpenChange:h,children:[y,C]})}),t[27]=s,t[28]=C,t[29]=h,t[30]=y,t[31]=w):w=t[31];let T;t[32]===d.indicator?T=t[33]:(T=d.indicator&&(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none fixed z-50 bg-primary`,style:{left:d.indicator.rect.left,top:d.indicator.rect.top,width:d.indicator.rect.width,height:d.indicator.rect.height}}),t[32]=d.indicator,t[33]=T);let E;return t[34]!==w||t[35]!==T?(E=(0,Z.jsxs)(Z.Fragment,{children:[w,T]}),t[34]=w,t[35]=T,t[36]=E):E=t[36],E}function OO(){}function kO(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=EO(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=wO(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)(DO,{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=TO(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)(DO,{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 AO(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=We.getState(e.state)?.binding;if(!t){ml.count(`ok/editor/walk-currency-disarmed`,{docName:n,reason:`no-binding`}),s(`no ySync binding on "${n}"`);return}if(typeof t._forceRerender!=`function`){ml.count(`ok/editor/walk-currency-disarmed`,{docName:n,reason:`no-force-rerender`}),s(`ySync binding on "${n}" exposes no _forceRerender`);return}ml.count(`ok/editor/pattern-d-stale-prewarm`,{docName:n}),t._forceRerender()};return Wn.create({name:`walkCurrency`,onBeforeCreate(){t.observeDeep(o),i=!0},onDestroy(){c()},addProseMirrorPlugins(){return[new Hr({view:e=>(a||(a=!0,c(),r&&l(e)),{})})]}})}var jO=new WeakMap;function MO(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=tr(e.color),n.textContent=e.name,t.append(n),t}var NO={state:`idle`,count:0,lastFiredAt:null,position:`append`,lastAgentId:null},PO=100,FO=100,IO=3,LO=250;function RO(e){return`contentComponent`in e&&`isEditorContentInitialized`in e}function zO(e,t){let n=oi(e);if(!n||t.contains(n.dom))return!1;if(!RO(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 BO(){let e=new Cr({extensions:Qn});return{mdManager:e,text:y({mdManager:e}),html:B({mdManager:e}),paste:W({mdManager:e}),drop:A({mdManager:e})}}function VO(e,t){return t?{collaboration:Ve.configure({document:e.document,ySyncOptions:{mapping:t}}),guard:[AO({fragment:e.document.getXmlFragment(`default`),docName:e.configuration.name??``})]}:{collaboration:Ve.configure({document:e.document}),guard:[]}}function HO(e){let{provider:t,placeholder:n,prebuiltMapping:r,onWedged:i}=e,{collaboration:a,guard:o}=VO(t,r);return[...tt.map(e=>e.name===`link`||e.name===`wikiLink`||e.name===`jsxComponent`?e.configure({docName:t.configuration.name??``}):e),kx.configure({placeholder:n??`Type '/' for commands`,showOnlyCurrent:!0}),a,Wn.create({name:`imageUploadDecoration`,addProseMirrorPlugins(){return[H]}}),Wn.create({name:`collaborationCursor`,addProseMirrorPlugins(){let e=t.awareness;if(!e)throw Error(`[TiptapEditor] HocuspocusProvider has no awareness instance — cursor plugin cannot initialize`);return[z(e,{cursorBuilder:MO})]}}),Wn.create({name:`bindingStalenessGuard`,addProseMirrorPlugins(){return[gE({fragment:t.document.getXmlFragment(`default`),docName:t.configuration.name??``,onWedged:i??(()=>{})})]}}),...o,pD]}function UO(e){let{provider:t,clipboard:n,ctorStart:r}=e;return{onBeforeCreate:({editor:e})=>{jO.set(e,r)},onCreate:({editor:e})=>{n.html.setView(e.view);let r=jO.get(e);if(jO.delete(e),r==null)return;let i=performance.now();ml(`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:lO(n.drop,e.onSidebarDrop)},extensions:iE(HO(e))}}function WO(e){let{provider:t,placeholder:n,clipboard:r,ctorStart:i,onWedged:a,onSidebarDrop:o}=e,s=t.document.getXmlFragment(`default`),c=new Map,l=UO({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}=g(s,t.schema);r.forEach((e,t)=>{c.set(t,e)}),t.options.content=n.toJSON()},element:null}}var GO=e=>{let t=(0,$.c)(24),{provider:n,placeholder:r,isSourceMode:i,portalTarget:a}=e,o=(0,Q.useRef)(null),s=(0,Q.useRef)(NO),c=oE(),{principal:l,activeDocName:u,recycleDocument:d,openTarget:f}=Ye(),p=n.configuration.name??``,[m]=(0,Q.useState)(BO),h;t[0]!==m||t[1]!==p||t[2]!==f||t[3]!==r||t[4]!==n||t[5]!==d?(h=()=>()=>({editor:new bn(WO({provider:n,placeholder:r,clipboard:m,ctorStart:performance.now(),onWedged:e=>{let{externalSeq:t,appliedSeq:n}=e;ml(`ok/editor/binding-wedge-recycle`,{docName:p,externalSeq:t,appliedSeq:n}),d(p)},onSidebarDrop:e=>{uO(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=xt(p)??crypto.randomUUID();_=Q.use,v=Ct({docName:p,mountId:r,construct:g,sizeStats:e}),t[7]=g,t[8]=p,t[9]=n.document,t[10]=_,t[11]=v}else _=t[10],v=t[11];let y=_(v),b=y.editor,x,S;t[12]===y?(x=t[13],S=t[14]):(x=()=>()=>{Le(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)(KO,{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},KO=e=>{let t=(0,$.c)(98),{provider:n,isSourceMode:r,docName:i,activeDocName:a,identity:o,principal:s,editor:c,wrapperRef:l,flashStateRef:u,portalTarget:d}=e,f=(0,Q.useRef)(null),[p,m]=(0,Q.useState)(0),h,g;t[0]===d?(h=t[1],g=t[2]):(h=()=>{let e=f.current;if(e)return e.appendChild(d),()=>{d.parentNode===e&&e.removeChild(d)}},g=[d],t[0]=d,t[1]=h,t[2]=g),(0,Q.useLayoutEffect)(h,g);let _,v;t[3]!==c||t[4]!==d?(_=()=>{zO(c,d)&&m(qO)},v=[c,d],t[3]=c,t[4]=d,t[5]=_,t[6]=v):(_=t[5],v=t[6]),(0,Q.useEffect)(_,v);let y;t[7]!==c||t[8]!==n.configuration.name?(y=()=>(ki(c,n.configuration.name??null),()=>{ki(c,null)}),t[7]=c,t[8]=n.configuration.name,t[9]=y):y=t[9];let b;t[10]!==c||t[11]!==n?(b=[c,n],t[10]=c,t[11]=n,t[12]=b):b=t[12],(0,Q.useEffect)(y,b);let x;t[13]!==c||t[14]!==n.configuration.name?(x=()=>{let e=n.configuration.name;if(e)return He(e,c),()=>I(e,c)},t[13]=c,t[14]=n.configuration.name,t[15]=x):x=t[15];let S;t[16]!==c||t[17]!==n?(S=[c,n],t[16]=c,t[17]=n,t[18]=S):S=t[18],(0,Q.useEffect)(x,S);let C;t[19]!==c||t[20]!==n.configuration.name?(C=()=>{let e=n.configuration.name;if(!e)return;let t=null,r=()=>{t=null,du(e,`wysiwyg`,lu(c)),wu(e,`wysiwyg`,Tu(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),du(e,`wysiwyg`,null),wu(e,`wysiwyg`,null)}},t[19]=c,t[20]=n.configuration.name,t[21]=C):C=t[21];let w;t[22]!==c||t[23]!==n?(w=[c,n],t[22]=c,t[23]=n,t[24]=w):w=t[24],(0,Q.useEffect)(C,w);let T;t[25]!==c||t[26]!==n.configuration.name?(T=()=>{},t[25]=c,t[26]=n.configuration.name,t[27]=T):T=t[27];let D;t[28]!==c||t[29]!==n?(D=[c,n],t[28]=c,t[29]=n,t[30]=D):D=t[30],(0,Q.useEffect)(T,D);let O,k;t[31]===c?(O=t[32],k=t[33]):(O=()=>{let e=JO,t=null,n=()=>{if(t||c.isDestroyed)return;let n=oi(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 oi(c)?n():c.on(`create`,n),()=>{c.off(`create`,n),r()}},k=[c],t[31]=c,t[32]=O,t[33]=k),(0,Q.useEffect)(O,k);let A,j;t[34]!==i||t[35]!==c?(A=()=>{let e=!1,t=()=>{if(e||c.isDestroyed||!oi(c))return;e=!0;let t=Pe(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})),ml(`ok/editor/selection-restore-failed`,{docName:i,message:n})}je(i)};if(oi(c)){t();return}return c.on(`create`,t),()=>{c.off(`create`,t)}},j=[c,i],t[34]=i,t[35]=c,t[36]=A,t[37]=j):(A=t[36],j=t[37]),(0,Q.useEffect)(A,j);let M,N;t[38]!==u||t[39]!==n.document||t[40]!==l?(M=()=>{let e=n.document.getMap(`agent-flash`),t=Date.now(),r=0,i=null,a=null,o=null,s=()=>{let t=null;for(let[,n]of e.entries()){let e=n;e.timestamp&&(!t||e.timestamp>t.timestamp)&&(t={agentId:e.agentId??`unknown`,timestamp:e.timestamp,type:e.type??`insert`,description:e.description})}return t},c=e=>{u.current=e;let t=l.current;t&&(t.setAttribute(`data-agent-flash-state`,e.state),t.setAttribute(`data-agent-flash-count`,String(e.count)),t.setAttribute(`data-agent-flash-position`,e.position),t.setAttribute(`data-agent-flash-agent-id`,e.lastAgentId??``))},d=()=>{let e=s(),t=e?.description?.toLowerCase().includes(`prepend`)?`prepend`:`append`,n={state:`editing`,count:(u.current?.count??0)+1,lastFiredAt:Date.now(),position:t,lastAgentId:e?.agentId??null};c(n),document.dispatchEvent(new CustomEvent(`agent-flash`,{detail:n})),a&&clearTimeout(a),o&&clearTimeout(o),a=window.setTimeout(()=>{let e={...n,state:`settled`};c(e),document.dispatchEvent(new CustomEvent(`agent-flash-end`,{detail:e})),o=window.setTimeout(()=>{c({...e,state:`idle`})},300)},cr)};c(NO);let f=()=>{if(xr(e),!zn(e,t)||document.visibilityState!==`visible`)return;let n=Date.now();if(t=n,n-r<500){if(!i){let e=500-(n-r);i=window.setTimeout(()=>{i=null,r=Date.now(),d()},e)}return}r=n,d()};e.observe(f);let p=()=>{document.visibilityState===`visible`?zn(e,t)&&(t=Date.now(),r=Date.now(),d()):t=Date.now()};return document.addEventListener(`visibilitychange`,p),()=>{e.unobserve(f),document.removeEventListener(`visibilitychange`,p),i&&clearTimeout(i),a&&clearTimeout(a),o&&clearTimeout(o)}},N=[n.document,u,l],t[38]=u,t[39]=n.document,t[40]=l,t[41]=M,t[42]=N):(M=t[41],N=t[42]),(0,Q.useEffect)(M,N);let P,F;t[43]!==a||t[44]!==i||t[45]!==c||t[46]!==n?(P=()=>{let e=0,t,r=null,o=null,s=null,l=function(){if(e<PO){e+=1,t=window.setTimeout(p,FO);return}r=null,o=null,e=0},u=function(e){let t=oi(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=IO,o=()=>{t=void 0,!(i!==a||window.location.hash!==n)&&(d(e),--r,r>0&&(t=window.setTimeout(o,LO)))};t=window.setTimeout(o,LO)};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=Dl(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)}},F=[n,c,i,a],t[43]=a,t[44]=i,t[45]=c,t[46]=n,t[47]=P,t[48]=F):(P=t[47],F=t[48]),(0,Q.useEffect)(P,F);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=oi(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(su,e),()=>window.removeEventListener(su,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:sE({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,H;t[66]!==c||t[67]!==r?(V=()=>(pi(c,r),()=>{pi(c,!1)}),H=[c,r],t[66]=c,t[67]=r,t[68]=V,t[69]=H):(V=t[68],H=t[69]),(0,Q.useEffect)(V,H);let U;t[70]!==a||t[71]!==i||t[72]!==c||t[73]!==r?(U=!r&&(0,Z.jsx)(rO,{editor:c,shortcutEnabled:i===a}),t[70]=a,t[71]=i,t[72]=c,t[73]=r,t[74]=U):U=t[74];let W;t[75]!==c||t[76]!==r?(W=!r&&(0,Z.jsx)(kO,{editor:c}),t[75]=c,t[76]=r,t[77]=W):W=t[77];let G;t[78]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,Z.jsx)(`div`,{ref:f,style:{display:`contents`}}),t[78]=G):G=t[78];let K;t[79]!==c||t[80]!==p?(K=(0,Z.jsx)(xi,{editor:c,className:`tiptap-editor-portal-content h-full`},p),t[79]=c,t[80]=p,t[81]=K):K=t[81];let ee;t[82]!==d||t[83]!==K?(ee=(0,Ed.createPortal)(K,d),t[82]=d,t[83]=K,t[84]=ee):ee=t[84];let te;t[85]===c?te=t[86]:(te=(0,Z.jsx)(zT,{editor:c}),t[85]=c,t[86]=te);let ne;t[87]===c?ne=t[88]:(ne=E(c),t[87]=c,t[88]=ne);let re;t[89]===ne.store?re=t[90]:(re=(0,Z.jsx)(ue,{store:ne.store}),t[89]=ne.store,t[90]=re);let ie;return t[91]!==U||t[92]!==W||t[93]!==ee||t[94]!==te||t[95]!==re||t[96]!==l?(ie=(0,Z.jsxs)(`div`,{ref:l,className:`tiptap-editor h-full`,"data-agent-flash-state":`idle`,"data-agent-flash-count":`0`,"data-agent-flash-position":`append`,"data-agent-flash-agent-id":``,children:[U,W,G,ee,te,re]}),t[91]=U,t[92]=W,t[93]=ee,t[94]=te,t[95]=re,t[96]=l,t[97]=ie):ie=t[97],ie};function qO(e){return e+1}function JO(){return fi()}var YO=null;function XO(e){let t=(0,$.c)(3),n=(0,Q.useRef)(null),r,i;return t[0]===e?(r=t[1],i=t[2]):(r=()=>{if(!e)return;let t=n.current;if(!t)return;let r={};YO=r;let i=document.documentElement,a=null,o=()=>{if(YO!==r)return;let e=`${t.offsetHeight}px`;e!==a&&(a=e,i.style.setProperty(`--conflict-footer-height`,e))};o();let s=new ResizeObserver(o);return s.observe(t),()=>{s.disconnect(),YO===r&&(YO=null,i.style.removeProperty(`--conflict-footer-height`))}},i=[e],t[0]=e,t[1]=r,t[2]=i),(0,Q.useEffect)(r,i),n}var ZO=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 QO(e,t,n,r,i,a){if(e==r)return[];let o=ck(e,t,n,r,i,a),s=lk(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 ZO(t,n,i,a)];if(c>l){let o=e.slice(t,n).indexOf(r.slice(i,a));if(o>-1)return[new ZO(t,t+o,i,i),new ZO(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 ZO(t,t,i,i+o),new ZO(n,n,i+o+c,a)]}if(c==1||l==1)return[new ZO(t,n,i,a)];let u=dk(e,t,n,r,i,a);if(u){let[o,s,c]=u;return QO(e,t,o,r,i,s).concat(QO(e,o+c,n,r,s+c,a))}return nk(e,t,n,r,i,a)}var $O=1e9,ek=0,tk=!1;function nk(e,t,n,r,i,a){let o=n-t,s=a-i;if($O<1e9&&Math.min(o,s)>$O*16||ek>0&&Date.now()>ek)return Math.min(o,s)>$O*64?[new ZO(t,n,i,a)]:fk(e,t,n,r,i,a);let c=Math.ceil((o+s)/2);ik.reset(c),ak.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:ak,f=d?null:ik;for(let p=0;p<c;p++){if(p>$O||ek>0&&!(p&63)&&Date.now()>ek)return fk(e,t,n,r,i,a);let m=ik.advance(p,o,s,c,d,!1,l)||ak.advance(p,o,s,c,f,!0,u);if(m)return ok(e,t,n,t+m[0],r,i,a,i+m[1])}return[new ZO(t,n,i,a)]}var rk=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}},ik=new rk,ak=new rk;function ok(e,t,n,r,i,a,o,s){let c=!1;return!Dk(e,r)&&++r==n&&(c=!0),!Dk(i,s)&&++s==o&&(c=!0),c?[new ZO(t,n,a,o)]:QO(e,t,r,i,a,s).concat(QO(e,r,n,i,s,o))}function sk(e,t){let n=1,r=Math.min(e,t);for(;n<r;)n<<=1;return n}function ck(e,t,n,r,i,a){if(t==n||t==a||e.charCodeAt(t)!=r.charCodeAt(i))return 0;let o=sk(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-+!Dk(e,s);o>>=1}else if(i==n||l==a)return i-t;else s=i,c=l}}function lk(e,t,n,r,i,a){if(t==n||i==a||e.charCodeAt(n-1)!=r.charCodeAt(a-1))return 0;let o=sk(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-+!Dk(e,s);o>>=1}else if(a==t||l==i)return n-a;else s=a,c=l}}function uk(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;;){Dk(e,s)||s++;let u=s+o;if(Dk(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=ck(e,u,n,r,i+f+d.length,a),c=lk(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 dk(e,t,n,r,i,a){let o=n-t,s=a-i;if(o<s){let o=dk(r,i,a,e,t,n);return o&&[o[1],o[0],o[2]]}return o<4||s*2<o?null:uk(e,t,n,r,i,a,Math.floor(o/4),-1)}function fk(e,t,n,r,i,a){tk=!0;let o=n-t,s=a-i,c;if(o<s){let s=uk(r,i,a,e,t,n,Math.floor(o/6),50);c=s&&[s[1],s[0],s[2]]}else c=uk(e,t,n,r,i,a,Math.floor(s/6),50);if(!c)return[new ZO(t,n,i,a)];let[l,u,d]=c;return QO(e,t,l,r,i,u).concat(QO(e,l+d,n,r,u+d,a))}function pk(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 ZO(r.fromA,i.toA,r.fromB,i.toB),e.splice(n--,1))}}function mk(e,t,n){for(;;){pk(n,1);let r=!1;for(let i=0;i<n.length;i++){let a=n[i],o,s;(o=ck(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new ZO(a.fromA+o,a.toA,a.fromB+o,a.toB)),(s=lk(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new ZO(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 ZO(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 ZO(a.fromA+d,a.toA+d,a.fromB+d,a.toB+d),r=!0)}if(!r)break}return n}function hk(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=Sk(t,a.fromA,l),f=xk(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 ZO(d,d+o,a.fromB-p,a.toB-p),d=a.fromA,f=xk(t,a.toA,c-a.toA)):l>m&&t.slice(a.toA,f)==u.slice(h,h+m)&&(a=e[i]=new ZO(f-o,f,a.fromB+m,a.toB+m),f=a.toA,d=Sk(t,a.fromA,a.fromA-r)),p=a.fromA-d,m=f-a.toA}if(p||m)a=e[i]=new ZO(a.fromA-p,a.toA+m,a.fromB-p,a.toB+m);else if(!o){let t=wk(n,a.fromB,a.toB),r,o=t<0?-1:Ck(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=wk(t,a.fromA,a.toA),r,o=n<0?-1:Ck(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 pk(e,3),e}var gk;try{gk=RegExp(`[\\p{Alphabetic}\\p{Number}]`,`u`)}catch{}function _k(e){return e>48&&e<58||e>64&&e<91||e>96&&e<123}function vk(e,t){if(t==e.length)return 0;let n=e.charCodeAt(t);return n<192?+!!_k(n):gk?!Tk(n)||t==e.length-1?+!!gk.test(String.fromCharCode(n)):gk.test(e.slice(t,t+2))?2:0:0}function yk(e,t){if(!t)return 0;let n=e.charCodeAt(t-1);return n<192?+!!_k(n):gk?!Ek(n)||t==1?+!!gk.test(String.fromCharCode(n)):gk.test(e.slice(t-2,t))?2:0:0}var bk=8;function xk(e,t,n){if(t==e.length||!yk(e,t))return t;for(let r=t,i=t+n,a=0;a<bk;a++){let t=vk(e,r);if(!t||r+t>i)return r;r+=t}return t}function Sk(e,t,n){if(!t||!vk(e,t))return t;for(let r=t,i=t-n,a=0;a<bk;a++){let t=yk(e,r);if(!t||r-t<i)return r;r-=t}return t}function Ck(e,t,n){for(;t!=n;t--)if(e.charCodeAt(t-1)==10)return t;return-1}function wk(e,t,n){for(;t!=n;t++)if(e.charCodeAt(t)==10)return t;return-1}var Tk=e=>e>=55296&&e<=56319,Ek=e=>e>=56320&&e<=57343;function Dk(e,t){return!t||t==e.length||!Tk(e.charCodeAt(t-1))||!Ek(e.charCodeAt(t))}function Ok(e,t,n){let r=n?.override;return r?r(e,t):($O=(n?.scanLimit??1e9)>>1,ek=n?.timeout?Date.now()+n.timeout:0,tk=!1,mk(e,t,QO(e,0,e.length,t,0,t.length)))}function kk(){return!tk}function Ak(e,t,n){return hk(Ok(e,t,n),e,t)}var jk=ql.define({combine:e=>e[0]}),Mk=Jl.define(),Nk=ql.define(),Pk=Hl.define({create(e){return null},update(e,t){for(let n of t.effects)n.is(Mk)&&(e=n.value);for(let n of t.state.facet(Nk))e=n(e,t);return e}});function Fk(e){let t=e.field(Pk,!1);if(!t)return null;let n=e.facet(jk);return{chunks:t,side:n?n.side:null}}var Ik=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 zk(Ak(e.toString(),t.toString(),n),e,t,0,0,kk())}static updateA(e,t,n,r,i){return Uk(Hk(e,r,!0,n.length),e,t,n,i)}static updateB(e,t,n,r,i){return Uk(Hk(e,r,!1,t.length),e,t,n,i)}};function Lk(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 Rk(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 zk(e,t,n,r,i,a){let o=[];for(let s=0;s<e.length;s++){let c=e[s],[l,u]=Lk(c.fromA+r,c.fromB+i,t,n),[d,f]=Rk(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]=Lk(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]=Rk(a.toA+r,a.toB+i,t,n),s++}o.push(new Ik(p,l,Math.max(l,d),u,Math.max(u,f),a))}return o}var Bk=1e3;function Vk(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 Hk(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>Bk&&([l,d]=Vk(e,a-Bk,n,!0)),o<t.length-Bk&&([u,f]=Vk(e,o+Bk,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 Uk(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=Ak(n.sliceString(d,p),r.sliceString(f,m),i);for(let e of zk(h,n,r,d,f,kk()))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 Wk={scanLimit:500},Gk=Yl.fromClass(class{constructor(e){({deco:this.deco,gutter:this.gutter}=tA(e))}update(e){(e.docChanged||e.viewportChanged||qk(e.startState,e.state)||Jk(e.startState,e.state))&&({deco:this.deco,gutter:this.gutter}=tA(e.view))}},{decorations:e=>e.deco}),Kk=zl.low($l({class:`cm-changeGutter`,markers:e=>e.plugin(Gk)?.gutter||tu.empty}));function qk(e,t){return e.field(Pk,!1)!=t.field(Pk,!1)}function Jk(e,t){return e.facet(jk)!=t.facet(jk)}var Yk=Gl.line({class:`cm-changedLine`}),Xk=Gl.mark({class:`cm-changedText`}),Zk=Gl.mark({tagName:`ins`,class:`cm-insertedLine`}),Qk=Gl.mark({tagName:`del`,class:`cm-deletedLine`}),$k=new class extends Ql{constructor(){super(...arguments),this.elementClass=`cm-changedLineGutter`}};function eA(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,Yk),i.add(o,s,n?Qk:Zk),a&&a.add(o,o,$k);for(let l=t.iterRange(o,s-1),u=o;!l.next().done;){if(l.lineBreak){u++,i.add(u,u,Yk),a&&a.add(u,u,$k);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,Xk),s<t)c++;else break}u=t}}}function tA(e){let t=e.state.field(Pk),{side:n,highlightChanges:r,markGutter:i,overrideChunk:a}=e.state.facet(jk),o=n==`a`,s=new Kl,c=i?new Kl: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))&&eA(n,e.state.doc,o,r,s,c)}return{deco:s.finish(),gutter:c&&c.finish()}}var nA=class extends Rl{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}},rA=Jl.define({map:(e,t)=>e.map(t)}),iA=Hl.define({create:()=>Gl.none,update:(e,t)=>{for(let e of t.effects)if(e.is(rA))return e.value;return e.map(t.changes)},provide:e=>Zl.decorations.from(e)}),aA=.01;function oA(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 sA(e,t,n){let r=new Kl,i=new Kl,a=e.state.field(iA).iter(),o=t.state.field(iA).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<-aA?(l-=n,r.add(s,s,Gl.widget({widget:new nA(-n),block:!0,side:-1}))):n>aA&&(u+=n,i.add(c,c,Gl.widget({widget:new nA(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<aA?r.add(e.state.doc.length,e.state.doc.length,Gl.widget({widget:new nA(-p),block:!0,side:1})):p>aA&&i.add(t.state.doc.length,t.state.doc.length,Gl.widget({widget:new nA(p),block:!0,side:1}));let m=r.finish(),h=i.finish();oA(m,e.state.field(iA))||e.dispatch({effects:rA.of(m)}),oA(h,t.state.field(iA))||t.dispatch({effects:rA.of(h)})}var cA=Jl.define({map:(e,t)=>t.mapPos(e)}),lA=class extends Rl{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:cA.of(n)});let{side:r,sibling:i}=e.state.facet(jk);i&&i().dispatch({effects:cA.of(uA(n,e.state.field(Pk),r==`a`))})}),t}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return`collapsed-unchanged-code`}};function uA(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 dA=Hl.define({create(e){return Gl.none},update(e,t){e=e.map(t.changes);for(let n of t.effects)n.is(cA)&&(e=e.update({filter:e=>e!=n.value}));return e},provide:e=>Zl.decorations.from(e)});function fA({margin:e=3,minSize:t=4}){return dA.init(n=>pA(n,e,t))}function pA(e,t,n){let r=new Kl,i=e.facet(jk).side==`a`,a=e.field(Pk),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,Gl.replace({widget:new lA(d),block:!0})),!c)break;o=e.doc.lineAt(Math.min(e.doc.length,i?c.toA:c.toB)).number}return r.finish()}var mA=Zl.styleModule.of(new eu({".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`}})),hA=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`}}),gA=new Xl,_A=new Xl,vA=class{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig||Wk;let t=[zl.low(Gk),hA,mA,iA,Zl.updateListener.of(e=>{this.measuring<0&&(e.heightChanged||e.viewportChanged)&&!e.transactions.some(e=>e.effects.some(e=>e.is(rA)))&&this.measure()})],n=[jk.of({side:`a`,sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&n.push(Kk);let r=Vl.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],Zl.editorAttributes.of({class:`cm-merge-a`}),_A.of(n),t]}),i=[jk.of({side:`b`,sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&i.push(Kk);let a=Vl.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],Zl.editorAttributes.of({class:`cm-merge-b`}),_A.of(i),t]});this.chunks=Ik.build(r.doc,a.doc,this.diffConf);let o=[Pk.init(()=>this.chunks),gA.of(e.collapseUnchanged?fA(e.collapseUnchanged):[])];r=r.update({effects:Jl.appendConfig.of(o)}).state,a=a.update({effects:Jl.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),Bl.empty(e[0].startState.doc.length));this.chunks=t==this.a?Ik.updateA(this.chunks,n.newDoc,this.b.state.doc,r,this.diffConf):Ik.updateB(this.chunks,this.a.state.doc,n.newDoc,r,this.diffConf),t.update([...e,n.state.update({effects:Mk.of(this.chunks)})]);let i=t==this.a?this.b:this.a;i.update([i.state.update({effects:Mk.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(jk),o=n?e.gutter!==!1:r.markGutter,s=t?e.highlightChanges!==!1:r.highlightChanges;i.push(_A.reconfigure([jk.of({side:`a`,sibling:()=>this.b,highlightChanges:s,markGutter:o}),o?Kk:[]])),a.push(_A.reconfigure([jk.of({side:`b`,sibling:()=>this.a,highlightChanges:s,markGutter:o}),o?Kk:[]]))}if(r){let t=gA.reconfigure(e.collapseUnchanged?fA(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(){sA(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=yA(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=yA(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 yA(e){let t=e.nextSibling;return e.remove(),t}var bA=new class extends Ql{constructor(){super(...arguments),this.elementClass=`cm-deletedLineGutter`}},xA=zl.low($l({class:`cm-changeGutter`,markers:e=>e.plugin(Gk)?.gutter||tu.empty,widgetMarker:(e,t)=>t instanceof EA?bA:null}));function SA(e){let t=typeof e.original==`string`?Wl.of(e.original.split(/\r?\n/)):e.original,n=e.diffConfig||Wk;return[zl.low(Gk),jA,hA,Zl.editorAttributes.of({class:`cm-merge-b`}),Nk.of((e,t)=>{let r=t.effects.find(e=>e.is(CA));return r&&(e=Ik.updateA(e,r.value.doc,t.startState.doc,r.value.changes,n)),t.docChanged&&(e=Ik.updateB(e,t.state.field(wA),t.newDoc,t.changes,n)),e}),jk.of({highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1,syntaxHighlightDeletions:e.syntaxHighlightDeletions!==!1,syntaxHighlightDeletionsMaxLength:3e3,mergeControls:e.mergeControls??!0,overrideChunk:e.allowInlineDiffs?LA:void 0,side:`b`}),wA.init(()=>t),e.gutter===!1?[]:xA,e.collapseUnchanged?fA(e.collapseUnchanged):[],Pk.init(e=>Ik.build(t,e.doc,n))]}var CA=Jl.define(),wA=Hl.define({create:()=>Wl.empty,update(e,t){for(let n of t.effects)n.is(CA)&&(e=n.value.doc);return e}}),TA=new WeakMap,EA=class extends Rl{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 DA(e,t,n){let r=TA.get(t.changes);if(r)return r;let i=Gl.widget({block:!0,side:-1,widget:new EA(r=>{let{highlightChanges:i,syntaxHighlightDeletions:a,syntaxHighlightDeletionsMaxLength:o,mergeControls:s}=e.facet(jk),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(),OA(r,r.posAtDOM(c))},i=e=>{e.preventDefault(),kA(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(wA).sliceString(t.fromA,t.endA),u=a&&e.facet(nu),d=h(),f=t.changes,p=0,m=!1;function h(){let e=c.appendChild(document.createElement(`div`));return e.className=`cm-deletedLine`,e.appendChild(document.createElement(`del`))}function g(e,t,n){for(let r=e;r<t;){if(l.charAt(r)==`
28
28
  `){d.firstChild||d.appendChild(document.createElement(`br`)),d=h(),r++;continue}let e=t,a=n+(m?` cm-deletedText`:``),o=!1,s=l.indexOf(`
29
- `,r);if(s>-1&&s<t&&(e=s),i&&p<f.length){let t=Math.max(0,m?f[p].toA:f[p].fromA);t<=e&&(e=t,m&&p++,o=!0)}if(e>r){let t=document.createTextNode(l.slice(r,e));if(a){let e=d.appendChild(document.createElement(`span`));e.className=a,e.appendChild(t)}else d.appendChild(t);r=e}o&&(m=!m)}}if(u&&t.toA-t.fromA<=o){let t=u.parser.parse(l),n=0;Ul(t,{style:t=>ru(e,t)},(e,t,r)=>{e>n&&g(n,e,``),g(e,t,r),n=t}),g(n,l.length,``)}else g(0,l.length,``);return d.firstChild||d.appendChild(document.createElement(`br`)),c})});return TA.set(t.changes,i),i}function OA(e,t){let{state:n}=e,r=t??n.selection.main.head,i=e.state.field(Pk).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(wA);i.fromB!=i.toB&&i.toA<=o.length&&(a+=e.state.lineBreak);let s=Bl.of({from:i.fromA,to:Math.min(o.length,i.toA),insert:a},o.length);return e.dispatch({effects:CA.of({doc:s.apply(o),changes:s}),userEvent:`accept`}),!0}function kA(e,t){let{state:n}=e,r=t??n.selection.main.head,i=n.field(Pk).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=n.field(wA).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 AA(e){let t=new Kl;for(let n of e.field(Pk)){let r=e.facet(jk).overrideChunk&&NA(e,n);t.add(n.fromB,n.fromB,DA(e,n,!!r))}return t.finish()}var jA=Hl.define({create:e=>AA(e),update(e,t){return t.state.field(Pk,!1)==t.startState.field(Pk,!1)?e:AA(t.state)},provide:e=>Zl.decorations.from(e)}),MA=new WeakMap;function NA(e,t){let n=MA.get(t);if(n!==void 0)return n;n=null;let r=e.field(wA),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(Gl.widget({widget:new PA(t),side:-1}).range(s+n.fromB))}n.fromB<n.toB&&e.push(Xk.range(s+n.fromB,s+n.toB))}i<t.endA-t.fromA-a*2&&(n=e)}return MA.set(t,n),n}var PA=class extends Rl{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}},FA=new class extends Ql{constructor(){super(...arguments),this.elementClass=`cm-inlineChangedLineGutter`}},IA=Gl.line({class:`cm-inlineChangedLine`});function LA(e,t,n,r){let i=NA(e,t),a=0;if(!i)return!1;for(let o=e.doc.lineAt(t.fromB);;){for(r&&r.add(o.from,o.from,FA),n.add(o.from,o.from,IA);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 RA=si({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),zA=mi({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),BA=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 VA({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 HA(e){let t=(0,$.c)(33),{oldContent:n,newContent:r,layout:i,conflictMode:a,previewMode:o,oursOverride:s,onResolve:c,onAbort:l}=e,{_:u}=kt(),d=s??r,f=(0,Q.useRef)(null),p=(0,Q.useRef)(null),m=(0,Q.useRef)(0),{resolvedTheme:h}=sn(),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=XO(a===!0),w;t[1]!==l||t[2]!==c?(w=()=>{g.current=c,_.current=l},t[1]=l,t[2]=c,t[3]=w):w=t[3],(0,Q.useEffect)(w);let T,E;t[4]!==a||t[5]!==d||t[6]!==i||t[7]!==n||t[8]!==o||t[9]!==h?(T=()=>{let e=f.current;if(!e)return;S([]);let t=new Map,r=!1,s=e=>{r||!t.delete(e)||S(t=>t.filter(t=>t.id!==e))},c=new MutationObserver(()=>{for(let[n,r]of t)e.contains(r)||s(n)});c.observe(e,{childList:!0,subtree:!0});let l=h===`dark`?RA:zA,u=[Zl.editable.of(!1),Vl.readOnly.of(!0)],g=[bu,iu(),...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=VA({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:[bu,iu(),Zl.editable.of(!1),l,BA,Zl.lineWrapping,SA({original:n,highlightChanges:!0,gutter:!0,mergeControls:i,collapseUnchanged:{margin:3,minSize:4}}),Zl.updateListener.of(e=>{let t=Fk(e.state);y(t?t.chunks.length:0)})],parent:e});p.current=a;let o=Fk(a.state);y(o?o.chunks.length:0)}else i===`split`?p.current=new vA({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,SA({original:n,highlightChanges:!0,gutter:!0,mergeControls:!1,collapseUnchanged:{margin:3,minSize:4}})],parent:e});return()=>{r=!0,c.disconnect(),p.current&&=(p.current.destroy(),null)}},E=[n,d,i,h,a,o],t[4]=a,t[5]=d,t[6]=i,t[7]=n,t[8]=o,t[9]=h,t[10]=T,t[11]=E):(T=t[10],E=t[11]),(0,Q.useEffect)(T,E);let D;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(D=function(){let e=p.current;!e||!(e instanceof Zl)||g.current?.(e.state.doc.toString())},t[12]=D):D=t[12];let O=D,k;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(k=function(){let e=p.current;!e||!(e instanceof Zl)||ci(e)},t[13]=k):k=t[13];let A=k,j=v===0,M;t[14]!==u||t[15]!==v?(M=v===null?``:v===0?u({id:`lPzyrU`}):Gc._({id:`8FqTCr`,values:{chunksRemaining:v}}),t[14]=u,t[15]=v,t[16]=M):M=t[16];let N=M,P;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(`div`,{ref:f,className:`diff-view min-h-0 flex-1 overflow-y-auto subtle-scrollbar`}),t[17]=P):P=t[17];let F;if(t[18]!==u||t[19]!==x){let e;t[21]===u?e=t[22]:(e=e=>(0,Ed.createPortal)((0,Z.jsx)(Jr,{type:`button`,variant:e.type===`accept`?`default`:`destructive`,size:`xs`,onClick:t=>{e.action(t.nativeEvent)},children:e.type===`accept`?u({id:`g3UF2V`}):u({id:`1t_NnN`})}),e.host,e.id),t[21]=u,t[22]=e),F=x.map(e),t[18]=u,t[19]=x,t[20]=F}else F=t[20];let I;t[23]!==j||t[24]!==C||t[25]!==a||t[26]!==N||t[27]!==l||t[28]!==c?(I=a&&(0,Z.jsxs)(`div`,{ref:C,className:`flex items-center justify-between gap-2 px-3 py-2 border-t shrink-0`,children:[(0,Z.jsx)(`span`,{className:`text-xs ${j?`text-emerald-600 dark:text-emerald-400`:`text-muted-foreground`}`,children:N}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[l&&(0,Z.jsx)(Jr,{className:`uppercase font-mono`,variant:`ghost`,size:`sm`,onClick:l,children:(0,Z.jsx)(J,{id:`XyOUTJ`})}),(0,Z.jsx)(Jr,{className:`uppercase font-mono`,variant:`outline`,size:`sm`,onClick:A,children:`Undo`}),c&&(0,Z.jsx)(Jr,{variant:`default`,size:`sm`,disabled:!j,onClick:O,children:(0,Z.jsx)(J,{id:`Lcehxn`})})]})]}),t[23]=j,t[24]=C,t[25]=a,t[26]=N,t[27]=l,t[28]=c,t[29]=I):I=t[29];let L;return t[30]!==I||t[31]!==F?(L=(0,Z.jsxs)(`div`,{className:`flex flex-col h-full`,children:[P,F,I]}),t[30]=I,t[31]=F,t[32]=L):L=t[32],L}async function UA(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 WA(e,t){return UA(e,`content`,t)}async function GA(e){return UA(e,`mine`)}async function KA(e){return UA(e,`theirs`)}async function qA(e){return UA(e,`delete`)}async function JA(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 YA(e){let t=(0,$.c)(86),{docName:n}=e,{_:r}=kt(),{conflicts:i,loading:a}=Wa(),o;if(t[0]!==i||t[1]!==n){let e;t[3]===n?e=t[4]:(e=e=>_l(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=XO(l?.kind===`delete-modify`||l?.kind===`modify-delete`),g,_;t[5]===n?(g=t[6],_=t[7]):(g=()=>(console.warn(JSON.stringify({event:`editor-area-swap-to-diffview`,"doc.name":n})),()=>{console.warn(JSON.stringify({event:`editor-area-swap-from-diffview`,"doc.name":n}))}),_=[n],t[5]=n,t[6]=g,t[7]=_),(0,Q.useEffect)(g,_);let v=a||s===void 0,y,b;t[8]!==v||t[9]!==c?(y=()=>{if(v)return;let e=!1;return u(null),f(!1),JA(c).then(t=>{e||(t===null?f(!0):u(t))}),()=>{e=!0}},b=[c,v],t[8]=v,t[9]=c,t[10]=y,t[11]=b):(y=t[10],b=t[11]),(0,Q.useEffect)(y,b);let x;t[12]!==r||t[13]!==c?(x=async function(e){let t=await WA(c,e);t.ok||hs.error(r({id:`K-h9cT`,values:{filePath:c}}),{description:t.detail})},t[12]=r,t[13]=c,t[14]=x):x=t[14];let S=x,C;t[15]!==r||t[16]!==c?(C=async function(e){m(!0);let t=await e(c);t.ok||(m(!1),hs.error(r({id:`jPUPvG`,values:{filePath:c}}),{description:t.detail}))},t[15]=r,t[16]=c,t[17]=C):C=t[17];let w=C;if(d){let e;return t[18]===c?e=t[19]:(e=(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`ajz9F8`,values:{filePath:c}})}),t[18]=c,t[19]=e),e}if(l===null){let e;return t[20]===c?e=t[21]:(e=(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`DF1MtZ`,values:{filePath:c}})}),t[20]=c,t[21]=e),e}if(l.kind===`delete-modify`){let e;t[22]===l.theirs?e=t[23]:(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(HA,{oldContent:``,newContent:l.theirs,layout:`unified`,previewMode:!0})}),t[22]=l.theirs,t[23]=e);let n;t[24]===c?n=t[25]:(n={filePath:c},t[24]=c,t[25]=n);let r;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(r={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[26]=r):r=t[26];let i;t[27]===n?i=t[28]:(i=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`V48OUT`,values:n,components:r})}),t[27]=n,t[28]=i);let a;t[29]===w?a=t[30]:(a=()=>void w(qA),t[29]=w,t[30]=a);let o;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(J,{id:`Vlc75q`}),t[31]=o):o=t[31];let s;t[32]!==p||t[33]!==a?(s=(0,Z.jsx)(Jr,{type:`button`,variant:`destructive`,disabled:p,onClick:a,children:o}),t[32]=p,t[33]=a,t[34]=s):s=t[34];let u;t[35]===w?u=t[36]:(u=()=>void w(KA),t[35]=w,t[36]=u);let d;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(J,{id:`3mFsc3`}),t[37]=d):d=t[37];let f;t[38]!==p||t[39]!==u?(f=(0,Z.jsx)(Jr,{type:`button`,variant:`default`,disabled:p,onClick:u,children:d}),t[38]=p,t[39]=u,t[40]=f):f=t[40];let m;t[41]!==s||t[42]!==f?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-3`,children:[s,f]}),t[41]=s,t[42]=f,t[43]=m):m=t[43];let g;t[44]!==h||t[45]!==i||t[46]!==m?(g=(0,Z.jsxs)(`div`,{ref:h,className:`flex flex-shrink-0 flex-wrap items-center justify-between gap-x-6 gap-y-3 border-t px-6 py-4`,children:[i,m]}),t[44]=h,t[45]=i,t[46]=m,t[47]=g):g=t[47];let _;return t[48]!==g||t[49]!==e?(_=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[e,g]}),t[48]=g,t[49]=e,t[50]=_):_=t[50],_}if(l.kind===`modify-delete`){let e;t[51]===l.ours?e=t[52]:(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(HA,{oldContent:``,newContent:l.ours,layout:`unified`,previewMode:!0})}),t[51]=l.ours,t[52]=e);let n;t[53]===c?n=t[54]:(n={filePath:c},t[53]=c,t[54]=n);let r;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(r={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[55]=r):r=t[55];let i;t[56]===n?i=t[57]:(i=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`EhDLBx`,values:n,components:r})}),t[56]=n,t[57]=i);let a;t[58]===w?a=t[59]:(a=()=>void w(GA),t[58]=w,t[59]=a);let o;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(J,{id:`0NA4b3`}),t[60]=o):o=t[60];let s;t[61]!==p||t[62]!==a?(s=(0,Z.jsx)(Jr,{type:`button`,variant:`default`,disabled:p,onClick:a,children:o}),t[61]=p,t[62]=a,t[63]=s):s=t[63];let u;t[64]===w?u=t[65]:(u=()=>void w(qA),t[64]=w,t[65]=u);let d;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(J,{id:`qSxaOz`}),t[66]=d):d=t[66];let f;t[67]!==p||t[68]!==u?(f=(0,Z.jsx)(Jr,{type:`button`,variant:`destructive`,disabled:p,onClick:u,children:d}),t[67]=p,t[68]=u,t[69]=f):f=t[69];let m;t[70]!==s||t[71]!==f?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-3`,children:[s,f]}),t[70]=s,t[71]=f,t[72]=m):m=t[72];let g;t[73]!==h||t[74]!==i||t[75]!==m?(g=(0,Z.jsxs)(`div`,{ref:h,className:`flex flex-shrink-0 flex-wrap items-center justify-between gap-x-6 gap-y-3 border-t px-6 py-4`,children:[i,m]}),t[73]=h,t[74]=i,t[75]=m,t[76]=g):g=t[76];let _;return t[77]!==g||t[78]!==e?(_=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[e,g]}),t[77]=g,t[78]=e,t[79]=_):_=t[79],_}let T;t[80]===S?T=t[81]:(T=e=>void S(e),t[80]=S,t[81]=T);let E;return t[82]!==l.ours||t[83]!==l.theirs||t[84]!==T?(E=(0,Z.jsx)(HA,{oldContent:l.theirs,newContent:l.ours,layout:`unified`,conflictMode:!0,onResolve:T}),t[82]=l.ours,t[83]=l.theirs,t[84]=T,t[85]=E):E=t[85],E}function XA(e){let t=(0,$.c)(2),{docName:n,provider:r,children:i}=e;(0,Q.use)(mt(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 ZA=`__back-nav__`;function QA(e){return e instanceof xe||e instanceof Qe||e instanceof ge||e instanceof Re||e instanceof ct||e instanceof yt?e.docName:null}function $A(e){return e instanceof xe||e instanceof Qe}function ej(e){if(e instanceof xe){let t=e.docName;return{title:Gc._({id:`Jejur6`}),summary:Gc._({id:`jSY41h`,values:{docName:t}})}}if(e instanceof Qe){let t=e.docName;return{title:Gc._({id:`V7QxyT`}),summary:Gc._({id:`xG4tb6`,values:{docName:t}})}}if(e instanceof ge){let t=e.docName;return{title:Gc._({id:`1di5fu`}),summary:Gc._({id:`PQCdtv`,values:{docName:t}})}}if(e instanceof Re){let t=e.docName;return{title:Gc._({id:`wvbc1r`}),summary:Gc._({id:`IX7-sq`,values:{docName:t}})}}if(e instanceof ct)return{title:Gc._({id:`Gfr4fu`}),summary:Gc._({id:`UW2Fg3`})};if(e instanceof yt){let t=e.docName;return{title:Gc._({id:`vv7kpg`}),summary:Gc._({id:`mdKFEy`,values:{docName:t}})}}let t=e instanceof Error&&e.message?e.message:Gc._({id:`W5A0Ly`});return{title:Gc._({id:`29VNqC`}),summary:t}}function tj(e){let t=(0,$.c)(31),{error:n,resetErrorBoundary:r,activeDocName:i,previousDocName:a,onNavigateBack:o}=e,s;t[0]===n?s=t[1]:(s=ej(n),t[0]=n,t[1]=s);let{title:c,summary:l}=s,u=!!a&&!!o,d=(0,Q.useRef)(null),f=typeof window<`u`?window.okDesktop:void 0,p=f&&$A(n)?f:null,m,h;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>{d.current?.focus()},h=[],t[2]=m,t[3]=h):(m=t[2],h=t[3]),(0,Q.useEffect)(m,h);let g;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(DS,{size:80,variant:`sleeping`}),t[4]=g):g=t[4];let _;t[5]===c?_=t[6]:(_=(0,Z.jsx)(`h2`,{id:`document-error-title`,className:`text-2xl font-light tracking-tighter text-balance`,children:c}),t[5]=c,t[6]=_);let v;t[7]===l?v=t[8]:(v=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-muted-foreground`,children:l}),t[7]=l,t[8]=v);let y;t[9]!==_||t[10]!==v?(y=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[_,v]}),t[9]=_,t[10]=v,t[11]=y):y=t[11];let b;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(J,{id:`KDw4GX`}),t[12]=b):b=t[12];let x;t[13]===r?x=t[14]:(x=(0,Z.jsx)(Jr,{ref:d,variant:`default`,onClick:r,children:b}),t[13]=r,t[14]=x);let S;t[15]===p?S=t[16]:(S=p?(0,Z.jsx)(Jr,{variant:`secondary`,onClick:()=>{zg(p).then(rj).catch(nj)},children:(0,Z.jsx)(J,{id:`uaUc6t`})}):null,t[15]=p,t[16]=S);let C;t[17]!==i||t[18]!==u||t[19]!==n||t[20]!==o||t[21]!==a||t[22]!==r?(C=u?(0,Z.jsx)(Jr,{variant:`ghost`,className:`font-mono uppercase`,onClick:()=>{!a||!o||(Ge(QA(n)??i),o(a),r(ZA))},children:(0,Z.jsx)(J,{id:`CKyk7Q`})}):null,t[17]=i,t[18]=u,t[19]=n,t[20]=o,t[21]=a,t[22]=r,t[23]=C):C=t[23];let w;t[24]!==S||t[25]!==C||t[26]!==x?(w=(0,Z.jsxs)(`div`,{className:`mt-1 flex gap-2`,children:[x,S,C]}),t[24]=S,t[25]=C,t[26]=x,t[27]=w):w=t[27];let T;return t[28]!==w||t[29]!==y?(T=(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:[g,y,w]}),t[28]=w,t[29]=y,t[30]=T):T=t[30],T}function nj(){}function rj(e){e.ok||hs.error(e.message,{id:`server-restart-error`,duration:1/0})}function ij(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)(tj,{...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]===ZA){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}: ${ej(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 aj(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=ir(t);return{map:n,keys:hr(t),parseError:r}}function oj(e){let t=(0,$.c)(21),{provider:n}=e,r;t[0]===n?r=t[1]:(r=()=>aj(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=wn(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=Fe(i.map.icon),t[5]=i.map.icon,t[6]=c);let l=c,u;t[7]===i.map.cover?u=t[8]:(u=qe(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)(sj,{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)(cj,{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 sj(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 cj(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 lj=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{ManagedArtifactProperties:e}=await import(`./ManagedArtifactProperties-OmaGINfG.js`);return{ManagedArtifactProperties:e}},__vite__mapDeps([91,1,80,13,7,16,34,10,3,11,36,37,6,59,2,44,45,46,47,48,49,50,51,52,53,54,21,55,40,56,12,57,58,39,33,35,20,15,4,60,17,61,62,19,63,64,65,66,32,38,67,68,69,70,71,72,73,74,82,18,92,81,93,94,42,89]),import.meta.url)).ManagedArtifactProperties})),uj=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{MermaidDocEditor:e}=await import(`./MermaidDocEditor-DmgH_l9s.js`);return{MermaidDocEditor:e}},__vite__mapDeps([95,1,44,2,45,46,11,47,48,49,50,51,52,53,54,21,10,3,55,40,7,56,12,6,13,57,58,39,16,33,34,35,96,97]),import.meta.url)).MermaidDocEditor})),dj=gl(`LARGE_DOC_CHAR_THRESHOLD`,5e5);function fj(e){let t=e.threshold??dj;return e.ytextLength>t?{renderSource:e.isSourceMode||e.visitedSource,renderVisual:!e.isSourceMode||e.visitedVisual,isLarge:!0}:{renderSource:!0,renderVisual:!0,isLarge:!1}}function pj(e){return e.hasEmittedFirstToggle||!e.isLarge?!1:e.renderSource&&e.renderVisual}var mj=gl(`ACTIVITY_MOUNT_LIMIT`,3);function hj(){return n(()=>import(`./SourceEditor-Dli-GA4u.js`),__vite__mapDeps([98,1,44,2,45,46,11,47,48,49,50,51,52,53,54,21,10,3,55,40,7,56,12,6,13,57,58,39,16,33,34,35,96,59,20,15,4,60,17,61,62,19,63,64,65,66,32,36,37,38,67,68,69,70,71,72,73,74,97,99,22,94,90]),import.meta.url)}var gj=(0,Q.lazy)(async()=>({default:(await hj()).SourceEditor}));function _j(e,t,n){if(n<=0)return[];let r=e.filter(e=>!ke(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 vj(e,t){return t.kind===`idle`?null:t.kind===`failed`&&t.failedDocNames.includes(e)?{kind:`failed`,title:Gc._({id:`MTs6g3`}),summary:t.reason===`clear-data-timeout`?Gc._({id:`Sc1bKE`,values:{docName:e}}):Gc._({id:`ovIGrT`,values:{docName:e}}),actionLabel:Gc._({id:`HpK_8d`})}:t.kind===`recovering`&&t.docNames.includes(e)?{kind:`recovering`,title:Gc._({id:`cF9DyA`}),summary:t.phase===`clearing-local-cache`?Gc._({id:`bmC18N`,values:{docName:e}}):Gc._({id:`pAgkuZ`,values:{docName:e}})}:null}function yj(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(hl,{name:`activity-pool`,children:(0,Z.jsx)(bj,{...e})}),t[0]=e,t[1]=n),n}function bj(e){let t=(0,$.c)(15),{activeDocName:n,isSourceMode:r,editorPlaceholder:i,previousDocName:a,onNavigateBack:o,onRecycle:s}=e,{poolEntries:c,serverRestartRecovery:l}=Ye(),{pages:u,loading:d}=ia(),f=_j(c,n,mj),p=(0,Q.useRef)(``),h=f.map(xj).join(`,`),g=(0,Q.useRef)(c),_,v;t[0]===c?(_=t[1],v=t[2]):(_=()=>{g.current=c},v=[c],t[0]=c,t[1]=_,t[2]=v),(0,Q.useLayoutEffect)(_,v),(0,Q.useLayoutEffect)(()=>{if(p.current===h)return;let e=p.current?p.current.split(`,`):[],t=h?h.split(`,`):[],r=e.filter(e=>!t.includes(e)),i=t.filter(t=>!e.includes(t));for(let e of r)m(e);for(let e of i){let t=g.current.find(t=>t.docName===e)?.poolEventId;ne(e,t&&t.length>0?t:crypto.randomUUID())}ml(`ok/activity/mount-list-change`,{active:n,mounted:t,evicted:r}),p.current=h,he(t)},[h,n]);let y;t[3]!==n||t[4]!==i||t[5]!==r||t[6]!==d||t[7]!==o||t[8]!==s||t[9]!==u||t[10]!==a||t[11]!==l?(y=e=>(0,Z.jsx)(Dj,{entry:e,isActive:e.docName===n,isSourceMode:r,editorPlaceholder:i,isNewDoc:!d&&!u.has(e.docName)&&!Dn(e.docName)&&!yn(e.docName),previousDocName:a,onNavigateBack:o,onRecycle:s,serverRestartRecovery:l},e.docName),t[3]=n,t[4]=i,t[5]=r,t[6]=d,t[7]=o,t[8]=s,t[9]=u,t[10]=a,t[11]=l,t[12]=y):y=t[12];let b=f.map(y),x;return t[13]===b?x=t[14]:(x=(0,Z.jsx)(Z.Fragment,{children:b}),t[13]=b,t[14]=x),x}function xj(e){return e.docName}function Sj(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&&ml(`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&&(ml(`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&&ml(`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 Cj(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)(cx,{}),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)(gj,{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 wj(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)(is,{className:`size-5`,"aria-hidden":`true`}):(0,Z.jsx)(ns,{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)(Jr,{type:`button`,onClick:Tj,children:[(0,Z.jsx)(is,{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 Tj(){return window.location.reload()}function Ej(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 Dj(e){let t=(0,$.c)(56),{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a,isNewDoc:o,previousDocName:s,onNavigateBack:c,onRecycle:l,serverRestartRecovery:u}=e,d;t[0]!==n.docName||t[1]!==u?(d=vj(n.docName,u),t[0]=n.docName,t[1]=u,t[2]=d):d=t[2];let f=d,p=bw(n.docName)===`conflict`,m;t[3]===n.docName?m=t[4]:(m=yn(n.docName),t[3]=n.docName,t[4]=m);let h=m,g;t[5]===n.docName?g=t[6]:(g=()=>{let e=document.createElement(`div`);return e.setAttribute(`data-ok-editor-portal`,n.docName),e.style.display=`contents`,e},t[5]=n.docName,t[6]=g);let[_]=(0,Q.useState)(g),v=n.provider.document.getText(`source`).length,[y,b]=(0,Q.useState)(i),[x,S]=(0,Q.useState)(!i),C,w;t[7]!==i||t[8]!==y||t[9]!==x?(C=()=>{i&&!y?b(!0):!i&&!x&&S(!0)},w=[i,y,x],t[7]=i,t[8]=y,t[9]=x,t[10]=C,t[11]=w):(C=t[10],w=t[11]),(0,Q.useEffect)(C,w);let T=fj({ytextLength:v,isSourceMode:i,visitedSource:y,visitedVisual:x}),E=(0,Q.useRef)(``),D=`${T.isLarge}-${T.renderSource}-${T.renderVisual}`,O,k;t[12]!==n.docName||t[13]!==T.isLarge||t[14]!==T.renderSource||t[15]!==T.renderVisual||t[16]!==D||t[17]!==i||t[18]!==v?(O=()=>{E.current!==D&&(E.current=D,T.isLarge&&ml(`ok/activity/defer-mount`,{docName:n.docName,ytextLength:v,isSourceMode:i,renderSource:T.renderSource,renderVisual:T.renderVisual}))},k=[D,T.isLarge,T.renderSource,T.renderVisual,n.docName,v,i],t[12]=n.docName,t[13]=T.isLarge,t[14]=T.renderSource,t[15]=T.renderVisual,t[16]=D,t[17]=i,t[18]=v,t[19]=O,t[20]=k):(O=t[19],k=t[20]),(0,Q.useEffect)(O,k);let A;t[21]===n.docName?A=t[22]:(A=()=>Pe(n.docName),t[21]=n.docName,t[22]=A);let[j]=(0,Q.useState)(A),M=j?.html??null,[N,P]=(0,Q.useState)(!1),F,I;t[23]!==n.docName||t[24]!==T.isLarge||t[25]!==T.renderSource||t[26]!==T.renderVisual||t[27]!==N||t[28]!==i||t[29]!==v?(I=()=>{pj({isLarge:T.isLarge,renderSource:T.renderSource,renderVisual:T.renderVisual,hasEmittedFirstToggle:N})&&(ml(`ok/cold/first-toggle`,{docName:n.docName,mountId:xt(n.docName),ytextLength:v,modeEnteredFirst:i?`source`:`visual`}),P(!0))},F=[N,T.isLarge,T.renderSource,T.renderVisual,n.docName,v,i],t[23]=n.docName,t[24]=T.isLarge,t[25]=T.renderSource,t[26]=T.renderVisual,t[27]=N,t[28]=i,t[29]=v,t[30]=F,t[31]=I):(F=t[30],I=t[31]),(0,Q.useEffect)(I,F);let L=r?`visible`:`hidden`,R=`editor:${n.docName}`,z=j?.scrollTop,B;t[32]!==a||t[33]!==n||t[34]!==T.renderSource||t[35]!==T.renderVisual||t[36]!==r||t[37]!==p||t[38]!==h||t[39]!==o||t[40]!==i||t[41]!==c||t[42]!==l||t[43]!==_||t[44]!==s||t[45]!==f||t[46]!==M?(B=f?(0,Z.jsx)(wj,{view:f}):(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsx)(ij,{activeDocName:n.docName,previousDocName:s,onNavigateBack:c,onRecycle:l,children:(0,Z.jsx)(Q.Suspense,{fallback:M?(0,Z.jsx)(Ej,{html:M}):(0,Z.jsx)(cx,{}),children:(0,Z.jsx)(XA,{docName:n.docName,provider:n.provider,children:p?(0,Z.jsx)(YA,{docName:n.docName,provider:n.provider}):h?(0,Z.jsx)(uj,{docName:n.docName,provider:n.provider,isSourceMode:i}):(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[!i&&(Dn(n.docName)||Ce(n.docName)?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(lj,{docName:n.docName,provider:n.provider})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(oj,{provider:n.provider}),(0,Z.jsx)(Zi,{provider:n.provider})]})),(0,Z.jsxs)(`div`,{className:`relative flex-1`,children:[T.renderSource?(0,Z.jsx)(`div`,{className:i?`h-full`:`ok-mode-hidden h-full`,children:(0,Z.jsx)(Cj,{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a})}):null,T.renderVisual?(0,Z.jsx)(`div`,{className:i?`ok-mode-hidden h-full`:`h-full`,children:(0,Z.jsx)(GO,{provider:n.provider,placeholder:a,isSourceMode:i,portalTarget:_},`${n.docName}-${String(o)}-${n.poolEventId}`)}):null]})]})})})})}),t[32]=a,t[33]=n,t[34]=T.renderSource,t[35]=T.renderVisual,t[36]=r,t[37]=p,t[38]=h,t[39]=o,t[40]=i,t[41]=c,t[42]=l,t[43]=_,t[44]=s,t[45]=f,t[46]=M,t[47]=B):B=t[47];let V;t[48]!==r||t[49]!==z||t[50]!==B?(V=(0,Z.jsx)(Sj,{isActive:r,initialScrollTop:z,children:B}),t[48]=r,t[49]=z,t[50]=B,t[51]=V):V=t[51];let H;return t[52]!==L||t[53]!==R||t[54]!==V?(H=(0,Z.jsx)(Q.Activity,{mode:L,name:R,children:V}),t[52]=L,t[53]=R,t[54]=V,t[55]=H):H=t[55],H}function Oj(e){let t=e.endsWith(`rem`)?`rem`:`px`;return{value:Number.parseFloat(e),unit:t}}function kj(e){let{value:t,unit:n}=Oj(e);return n===`rem`?t*16:t}function Aj(e,t){return`${t===`rem`?e.toFixed(1):Math.round(e)}${t}`}var jj=3600*24*7;function Mj(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?Nj:m,O=g===void 0?jj: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=kj(b),te;t[6]===x?te=t[7]:(te=kj(x),t[6]=x,t[7]=te);let ne=te,re;t[8]!==E||t[9]!==k?(re=function(e){E&&(P.current=!0,j.current=H.current?0:kj(V.current),M.current=e.clientX,I.current=e.clientX,F.current=null,L.current=!1,R.current=0,z.current=0,B.current=k&&A.current?A.current.getBoundingClientRect():null,e.preventDefault())},t[8]=E,t[9]=k,t[10]=re):re=t[10];let ie=re,q,ae;t[11]!==w||t[12]!==v||t[13]!==C||t[14]!==S||t[15]!==T||t[16]!==k||t[17]!==ne||t[18]!==ee||t[19]!==i||t[20]!==a||t[21]!==D||t[22]!==O||t[23]!==h?(q=()=>{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}=Oj(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(ne,t)),u=Aj(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(ne,u)),f=Aj(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)}},ae=[i,a,D,ee,ne,k,C,w,T,S,h,O,v],t[11]=w,t[12]=v,t[13]=C,t[14]=S,t[15]=T,t[16]=k,t[17]=ne,t[18]=ee,t[19]=i,t[20]=a,t[21]=D,t[22]=O,t[23]=h,t[24]=q,t[25]=ae):(q=t[24],ae=t[25]),(0,Q.useEffect)(q,ae);let oe;return t[26]===ie?oe=t[27]:(oe={dragRef:A,isDragging:N,handleMouseDown:ie},t[26]=ie,t[27]=oe),oe}function Nj(){}var Pj=3600*24*7,Fj=`18rem`,Ij=`3rem`,Lj=`app-file-sidebar`,Rj=`14.625rem`,zj=`32rem`,Bj=`sidebar_width`,Vj=/^\d+(?:\.\d+)?(?:rem|px)$/,Hj=Q.createContext(null);function Uj(e){if(typeof document>`u`)return e;let t=document.cookie.split(`; `).find(e=>e.startsWith(`${Bj}=`))?.split(`=`)[1];if(!t)return e;let n;try{n=decodeURIComponent(t)}catch{return e}return Vj.test(n)?n:e}function Wj(){let e=Q.use(Hj);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function Gj(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?Fj:c,[u]=Q.useState(qj),d;t[8]===u?d=t[9]:(d=()=>Aw(u,window.innerWidth,`left`),t[8]=u,t[9]=d);let[f,p]=Q.useState(d),m;t[10]===l?m=t[11]:(m=()=>Uj(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=Lw();return zw(`left`,Aw(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),Bw(`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(Kj)},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: ${Dw}px)`),t=()=>{let e=Aw(u,window.innerWidth,`left`);p(e),C(zw(`left`,e,Lw())===`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(Lj)?.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=>{jl(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":Ij,...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)(Hj.Provider,{value:H,children:K}),t[55]=H,t[56]=K,t[57]=ee):ee=t[57],ee}function Kj(e){return!e}function qj(){return nr()}function Jj(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}=kt(),{state:f,isDraggingRail:p}=Wj();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:Lj,"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 Yj(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}=kt(),{toggleSidebar:o,state:s}=Wj(),c,l,u,d,f,p,m,h;if(t[4]!==a||t[5]!==s){let e=Ml(`toggle-files-sidebar`);c=Jr,l=`trigger`,u=`sidebar-trigger`,d=`ghost`,f=`icon-sm`,p=s===`expanded`,m=Lj,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)(Je,{}):(0,Z.jsx)(mf,{}),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 Xj(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}=kt(),{toggleSidebar:u,setWidth:d,state:f,width:p,setIsDraggingRail:m}=Wj(),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:Rj,maxResizeWidth:zj,setIsDraggingRail:m,widthCookieName:Bj,widthCookieMaxAge:Pj},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}=Mj(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 Zj(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}=Wj(),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 Qj(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 $j(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 eM(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 tM(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 nM(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?Kr:`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 rM(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?Kr:`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 iM(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 aM(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 oM(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 sM=qr(`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 cM(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?Kr:`button`,{state:m}=Wj(),h;t[8]!==n||t[9]!==f||t[10]!==d?(h=X(sM({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)(Ts,{asChild:!0,children:_}),t[20]=_,t[21]=v);let y=m!==`collapsed`,b;t[22]!==y||t[23]!==c?(b=(0,Z.jsx)(Es,{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)(Os,{children:[v,b]}),t[25]=v,t[26]=b,t[27]=x):x=t[27],x}function lM(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?Kr:`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 uM(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 dM(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 fM(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?Kr:`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 pM(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 mM(){let e=await fetch(`/api/server-info`,{signal:AbortSignal.timeout(5e3)});if(!e.ok)return null;let t=await e.json(),n=ar.safeParse(t);return n.success?n.data.currentBranch??null:null}var hM=typeof window>`u`?{getSnapshot:()=>null,subscribe:()=>()=>{}}:pM({fetchBranch:mM,subscribeToEvent:cl}),gM=hM.subscribe,_M=hM.getSnapshot;function vM(){return(0,Q.useSyncExternalStore)(gM,_M,_M)}function yM(){let e=(0,$.c)(6),t=vM(),n=ua(),{state:r}=Wj(),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&&Ba(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 bM(e){let t=(0,$.c)(30),{stats:n,selectionStats:r,showStats:i,composerBadge:a,reserveRightGutter:o}=e,s=i===void 0?!0:i,c=o===void 0?!1:o,{_:l}=kt(),u=yM();if(!s&&u===null&&a==null)return null;let d=r??n,f=r!=null,{words:p,chars:m,tokens:h}=d,g;t[0]!==l||t[1]!==f||t[2]!==s?(g=l(s?f?{id:`Bv5a9_`}:{id:`L1ZE3M`}:{id:`goO4Ll`}),t[0]=l,t[1]=f,t[2]=s,t[3]=g):g=t[3];let _=c&&`pr-12`,v;t[4]===_?v=t[5]:(v=X(`relative flex h-6 shrink-0 items-center justify-between gap-3 bg-background px-3 text-2xs text-muted-foreground`,_),t[4]=_,t[5]=v);let y;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-full h-2 bg-linear-to-t from-background to-transparent`}),t[6]=y):y=t[6];let b;t[7]!==l||t[8]!==a?(b=a?(0,Z.jsxs)(Jr,{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)(jo,{className:`size-3`,"aria-hidden":!0}),l({id:`xWEvuo`}),(0,Z.jsx)(N,{className:`size-3`,"aria-hidden":!0})]}):null,t[7]=l,t[8]=a,t[9]=b):b=t[9];let x;t[10]===u?x=t[11]:(x=u===null?null:(0,Z.jsx)(xM,{identity:u}),t[10]=u,t[11]=x);let S;t[12]===x?S=t[13]:(S=(0,Z.jsx)(`span`,{className:`flex min-w-0 items-center gap-3`,children:x}),t[12]=x,t[13]=S);let C;t[14]!==l||t[15]!==d.chars||t[16]!==d.tokens||t[17]!==d.words||t[18]!==m||t[19]!==f||t[20]!==s||t[21]!==h||t[22]!==p?(C=s?(0,Z.jsxs)(`span`,{className:`flex shrink-0 items-center gap-3`,children:[f?(0,Z.jsx)(`span`,{className:`font-medium text-foreground/70`,"data-testid":`editor-footer-selected-label`,children:l({id:`ylXj1N`})}):null,(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:d.words.toLocaleString()}),` `,(0,Z.jsx)(J,{id:`gljvbT`,values:{words:p}})]}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:d.chars.toLocaleString()}),` `,(0,Z.jsx)(J,{id:`d5rK4X`,values:{chars:m}})]}),(0,Z.jsxs)(`span`,{children:[d.tokens>0?`~`:``,(0,Z.jsx)(`span`,{className:`tabular-nums`,children:d.tokens.toLocaleString()}),` `,(0,Z.jsx)(J,{id:`uynXup`,values:{tokens:h}})]})]}):null,t[14]=l,t[15]=d.chars,t[16]=d.tokens,t[17]=d.words,t[18]=m,t[19]=f,t[20]=s,t[21]=h,t[22]=p,t[23]=C):C=t[23];let w;return t[24]!==C||t[25]!==g||t[26]!==v||t[27]!==b||t[28]!==S?(w=(0,Z.jsxs)(`section`,{"aria-label":g,className:v,children:[y,b,S,C]}),t[24]=C,t[25]=g,t[26]=v,t[27]=b,t[28]=S,t[29]=w):w=t[29],w}function xM(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)(Os,{children:[(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(`span`,{tabIndex:0,className:`truncate`,"data-testid":`editor-footer-project-name`,children:r})}),(0,Z.jsx)(Es,{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)(zo,{"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 SM(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}=kt(),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 CM(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 wM(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 TM(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 EM(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)(na,{}),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 DM=1,OM=2,kM=4;function AM(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=er(n),u=e?e.kind===`template`?e.folder.split(`/`).filter(Boolean):[]:ut(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>kM?[...u.slice(0,DM).map((e,t)=>d(e,t)),{kind:`ellipsis`,hidden:u.slice(DM,-OM)},...u.slice(-OM).map((e,t)=>d(e,u.length-OM+t))]:u.map((e,t)=>d(e,t));a=SM,t[8]===r?c=t[9]:(c=X(`flex min-w-0 items-center`,r),t[8]=r,t[9]=c),i=CM,o=`min-w-0 flex-nowrap gap-1 overflow-hidden text-muted-foreground/70 text-xs`,s=f.map(jM)}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 jM(e,t){let n=e.kind===`segment`?e.key:`ellipsis`;return(0,Z.jsxs)(Q.Fragment,{children:[t>0&&(0,Z.jsx)(EM,{className:`shrink-0 text-muted-foreground/70 [&>svg]:size-3`}),e.kind===`ellipsis`?(0,Z.jsxs)(wM,{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)(zd,{className:`size-3.5`})}),(0,Z.jsx)(`span`,{className:`sr-only`,children:e.hidden.join(` / `)})]}):(0,Z.jsx)(wM,{className:`min-w-0`,children:(0,Z.jsx)(TM,{current:!1,className:`min-w-0 truncate font-normal text-muted-foreground/70`,title:e.value,children:e.value})})]},n)}var MM={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`},NM=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`,...MM,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},PM=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)(NM,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i},FM=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)(NM,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i};function IM(e){let t=(0,$.c)(29),{isSourceMode:n,onModeChange:r,sourceDisabled:i}=e,a=i===void 0?!1:i,{_:o}=kt(),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)(Ts,{children:(0,Z.jsx)(FM,{className:`size-4`})}),t[6]=d):d=t[6];let f;t[7]===u?f=t[8]:(f=(0,Z.jsx)(Ic,{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)(Es,{side:`bottom`,children:(0,Z.jsx)(J,{id:`Mb_20S`})}),t[9]=p):p=t[9];let m;t[10]===f?m=t[11]:(m=(0,Z.jsxs)(Os,{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)(PM,{className:`size-4`}),t[14]=g):g=t[14];let _;t[15]!==a||t[16]!==h?(_=(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(`div`,{children:(0,Z.jsx)(Ic,{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)(Es,{side:`bottom`,children:a?(0,Z.jsx)(J,{id:`G-JBA1`}):(0,Z.jsx)(J,{id:`u6Hp4N`})}),t[18]=a,t[19]=v);let y;t[20]!==_||t[21]!==v?(y=(0,Z.jsxs)(Os,{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)(Rc,{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 LM=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{SkillEditorActions:e}=await import(`./SkillEditorActions-DBG6FPch.js`);return{SkillEditorActions:e}},__vite__mapDeps([100,1,10,3,11,6,7,13,82,20,21,15,16,17,61,62,18,64,66,36,37,65,87,12,83,67,57,71,88,58,40,76,73,56]),import.meta.url)).SkillEditorActions}));function RM(e){let t=(0,$.c)(82),{activeDocName:n,isSourceMode:r,sourceDisabled:i,onModeChange:a,showAddPropertyButton:o,onAddProperty:s,isPanelCollapsed:c,onTogglePanel:l,reserveRightGutter:u}=e,d=u===void 0?!1:u,{_:f}=kt(),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=Al(`toggle-document-panel`),t[0]=p):p=t[0];let m=p,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k;if(t[1]!==f||t[2]!==n||t[3]!==c||t[4]!==r||t[5]!==s||t[6]!==a||t[7]!==l||t[8]!==d||t[9]!==o||t[10]!==i){let e=Ml(`toggle-document-panel`),u;t[26]===n?u=t[27]:(u=n?er(n):null,t[26]=n,t[27]=u);let p=u,m;t[28]===n?m=t[29]:(m=n?Ce(n):null,t[28]=n,t[29]=m);let A=m,j;t[30]!==p||t[31]!==A?(j=p?.kind===`skill`?{scope:p.scope,name:p.name}:A?{scope:`project`,name:A}:null,t[30]=p,t[31]=A,t[32]=j):j=t[32];let M=j;b=`editor-toolbar`,x=`pointer-events-none absolute inset-x-0 top-0 z-10`;let N;t[33]!==n||t[34]!==M?(N=M?null:(0,Z.jsx)(AM,{docName:n}),t[33]=n,t[34]=M,t[35]=N):N=t[35];let P;t[36]===N?P=t[37]:(P=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex min-w-0 items-center`,children:N}),t[36]=N,t[37]=P);let F;t[38]!==r||t[39]!==a||t[40]!==i?(F=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex justify-center`,children:(0,Z.jsx)(IM,{isSourceMode:r,onModeChange:a,sourceDisabled:i})}),t[38]=r,t[39]=a,t[40]=i,t[41]=F):F=t[41],t[42]!==P||t[43]!==F?(S=(0,Z.jsx)(`div`,{className:`editor-content-aligned bg-background py-2`,children:(0,Z.jsxs)(`div`,{className:`grid grid-cols-3 items-center`,children:[P,F]})}),t[42]=P,t[43]=F,t[44]=S):S=t[44];let I=d&&`pr-9`;t[45]===I?_=t[46]:(_=X(`pointer-events-auto absolute top-0 right-0 flex items-center justify-end gap-1 py-2 pr-2`,I),t[45]=I,t[46]=_),t[47]===M?v=t[48]:(v=M?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(LM,{scope:M.scope,name:M.name})}):null,t[47]=M,t[48]=v),t[49]!==f||t[50]!==s||t[51]!==o?(y=o&&(0,Z.jsxs)(Os,{children:[(0,Z.jsx)(Jr,{variant:`ghost`,size:`icon`,"aria-label":f({id:`81H_23`}),onClick:s,"data-testid":`add-properties-button`,asChild:!0,children:(0,Z.jsx)(Ts,{children:(0,Z.jsx)(af,{})})}),(0,Z.jsx)(Es,{side:`bottom`,children:(0,Z.jsx)(J,{id:`81H_23`})})]}),t[49]=f,t[50]=s,t[51]=o,t[52]=y):y=t[52],g=Os,h=Jr,C=``,w=`ghost`,T=`icon`,E=l,D=!c,O=`doc-panel`,k=f(c?{id:`u7H-Wn`,values:{panelShortcutLabel:e}}:{id:`2hpdRq`,values:{panelShortcutLabel:e}}),t[1]=f,t[2]=n,t[3]=c,t[4]=r,t[5]=s,t[6]=a,t[7]=l,t[8]=d,t[9]=o,t[10]=i,t[11]=h,t[12]=g,t[13]=_,t[14]=v,t[15]=y,t[16]=b,t[17]=x,t[18]=S,t[19]=C,t[20]=w,t[21]=T,t[22]=E,t[23]=D,t[24]=O,t[25]=k}else h=t[11],g=t[12],_=t[13],v=t[14],y=t[15],b=t[16],x=t[17],S=t[18],C=t[19],w=t[20],T=t[21],E=t[22],D=t[23],O=t[24],k=t[25];let A;t[53]===c?A=t[54]:(A=(0,Z.jsx)(Ts,{children:c?(0,Z.jsx)(gf,{}):(0,Z.jsx)(hf,{})}),t[53]=c,t[54]=A);let j;t[55]!==h||t[56]!==A||t[57]!==C||t[58]!==w||t[59]!==T||t[60]!==E||t[61]!==D||t[62]!==O||t[63]!==k?(j=(0,Z.jsx)(h,{"data-doc-panel-toggle":C,variant:w,size:T,onClick:E,"aria-expanded":D,"aria-controls":O,"aria-label":k,asChild:!0,children:A}),t[55]=h,t[56]=A,t[57]=C,t[58]=w,t[59]=T,t[60]=E,t[61]=D,t[62]=O,t[63]=k,t[64]=j):j=t[64];let M;t[65]===c?M=t[66]:(M=(0,Z.jsx)(Es,{side:`bottom`,children:c?(0,Z.jsx)(J,{id:`KFdXwz`,values:{panelShortcut:m}}):(0,Z.jsx)(J,{id:`MsuXaI`,values:{panelShortcut:m}})}),t[65]=c,t[66]=M);let N;t[67]!==g||t[68]!==j||t[69]!==M?(N=(0,Z.jsxs)(g,{children:[j,M]}),t[67]=g,t[68]=j,t[69]=M,t[70]=N):N=t[70];let P;t[71]!==_||t[72]!==v||t[73]!==y||t[74]!==N?(P=(0,Z.jsxs)(`div`,{className:_,children:[v,y,N]}),t[71]=_,t[72]=v,t[73]=y,t[74]=N,t[75]=P):P=t[75];let F;t[76]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none h-2 bg-linear-to-b from-background to-transparent`}),t[76]=F):F=t[76];let I;return t[77]!==b||t[78]!==x||t[79]!==S||t[80]!==P?(I=(0,Z.jsxs)(`div`,{"data-testid":b,className:x,children:[S,P,F]}),t[77]=b,t[78]=x,t[79]=S,t[80]=P,t[81]=I):I=t[81],I}function zM(e){let{activeDocName:t,deferredActiveDocName:n,mountResolved:r,syncResolved:i}=e;return t===null||t===n?!1:!(r&&i)}function BM(e){let{currentLayout:t,containerPx:n,pinnedPx:r,residualId:i}=e;if(n<=0||!(i in t))return t;let a={...t},o=0;for(let[e,i]of Object.entries(r)){if(!(e in t))continue;let r=i/n*100;a[e]=r,o+=r}let s=0;for(let[e,n]of Object.entries(t))e===i||e in r||(s+=n);let c=100-o-s;return c<0?t:(a[i]=c,a)}var VM=`ok-terminal-height-v1`,HM=1/3,UM=.5;function WM(e){return Math.max(120,Math.round((Number.isFinite(e)?e:0)*UM))}function GM(e){let t=Number.isFinite(e)?e:0;return t<=0?240:Math.round(t*HM)}function KM(e,t){let n=WM(t);return Number.isFinite(e)?e<120?120:e>n?n:Math.round(e):Math.min(GM(t),n)}function qM(){return typeof window>`u`?0:window.innerHeight}function JM(e,t){try{let n=e??localStorage,r=t??qM(),i=n.getItem(VM);if(i==null)return KM(GM(r),r);let a=Number.parseInt(i,10);return KM(Number.isFinite(a)?a:GM(r),r)}catch{return 240}}function YM(e,t,n){try{let r=t??localStorage,i=n??qM();r.setItem(VM,String(KM(e,i)))}catch{}}function XM(){try{return typeof localStorage>`u`?240:JM()}catch{return 240}}function ZM(e){let t=(0,$.c)(19),{dockPosition:n,onReveal:r,className:i}=e,{_:a}=kt(),o=n===`right`,s;t[0]===a?s=t[1]:(s=a({id:`0SBTff`}),t[0]=a,t[1]=s);let c=s,l=o?`rounded-r-none border-r-0`:`rounded-b-none border-b-0`,u;t[2]!==i||t[3]!==l?(u=X(`absolute z-20 shrink-0 bg-background text-muted-foreground shadow-sm hover:text-foreground`,l,i),t[2]=i,t[3]=l,t[4]=u):u=t[4];let d;t[5]===o?d=t[6]:(d=o?(0,Z.jsx)(ta,{"aria-hidden":`true`}):(0,Z.jsx)(N,{"aria-hidden":`true`}),t[5]=o,t[6]=d);let f;t[7]!==n||t[8]!==c||t[9]!==r||t[10]!==u||t[11]!==d?(f=(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(Jr,{type:`button`,variant:`outline`,size:`icon-sm`,"aria-label":c,"data-terminal-reveal":n,onClick:r,className:u,children:d})}),t[7]=n,t[8]=c,t[9]=r,t[10]=u,t[11]=d,t[12]=f):f=t[12];let p=o?`left`:`top`,m;t[13]!==c||t[14]!==p?(m=(0,Z.jsx)(Es,{side:p,sideOffset:8,children:c}),t[13]=c,t[14]=p,t[15]=m):m=t[15];let h;return t[16]!==f||t[17]!==m?(h=(0,Z.jsxs)(Os,{children:[f,m]}),t[16]=f,t[17]=m,t[18]=h):h=t[18],h}var QM=`terminal-dock-panel`;function $M(e){let t=(0,$.c)(44),{children:n,visible:r,onVisibleChange:i,dockPosition:a,onBottomContainer:o,onEditorRegion:s,onReveal:c}=e,l=a===void 0?`bottom`:a,{resolvedTheme:u}=sn(),d=Gb(),[f,p]=(0,Q.useState)(!r),m;t[0]===u?m=t[1]:(m=Au(u),t[0]=u,t[1]=m);let h=m.background,g=r&&l===`bottom`,_=!r&&l===`bottom`&&c!=null,[v]=(0,Q.useState)(eN),y=(0,Q.useRef)(v),[b,x]=(0,Q.useState)(!1),S=(0,Q.useRef)(!1),C=(0,Q.useRef)(null),w;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(w=function(e){C.current!=null&&clearTimeout(C.current),C.current=setTimeout(()=>{YM(e),C.current=null},100)},t[2]=w):w=t[2];let T=w,E=(0,Q.useRef)(null),D,O;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(D=()=>()=>{C.current!=null&&clearTimeout(C.current),E.current!=null&&(window.removeEventListener(`pointerup`,E.current),E.current=null)},O=[],t[3]=D,t[4]=O):(D=t[3],O=t[4]),(0,Q.useEffect)(D,O);let k,A;t[5]!==g||t[6]!==d?(k=()=>{let e=d.current;e!=null&&(g?e.resize(`${y.current}px`):e.collapse())},A=[g,d],t[5]=g,t[6]=d,t[7]=k,t[8]=A):(k=t[7],A=t[8]),(0,Q.useEffect)(k,A);let j=b||void 0,M;t[9]!==c||t[10]!==_?(M=_&&c?(0,Z.jsx)(ZM,{dockPosition:`bottom`,onReveal:c,className:`right-3 bottom-0`}):null,t[9]=c,t[10]=_,t[11]=M):M=t[11];let N;t[12]!==n||t[13]!==s||t[14]!==M?(N=(0,Z.jsx)(YC,{minSize:`5%`,className:`flex min-h-0 flex-col`,children:(0,Z.jsxs)(`div`,{ref:s,tabIndex:-1,className:`relative flex h-full min-h-0 flex-col outline-none`,children:[n,M]})}),t[12]=n,t[13]=s,t[14]=M,t[15]=N):N=t[15];let P=!g,F;t[16]===g?F=t[17]:(F=()=>{if(!g)return;x(!0),S.current=!0;let e=()=>{x(!1),S.current=!1,window.removeEventListener(`pointerup`,e),E.current=null};E.current=e,window.addEventListener(`pointerup`,e)},t[16]=g,t[17]=F);let I;t[18]!==g||t[19]!==P||t[20]!==F?(I=(0,Z.jsx)(XC,{withHandle:g,disabled:P,onPointerDown:F}),t[18]=g,t[19]=P,t[20]=F,t[21]=I):I=t[21];let L;t[22]===h?L=t[23]:(L={backgroundColor:h},t[22]=h,t[23]=L);let R=g?`${v}px`:0,z;t[24]!==i||t[25]!==r?(z=e=>{let t=e.asPercentage===0;p(t),S.current&&(t&&r?i(!1):!t&&!r&&i(!0),e.inPixels>0&&(y.current=e.inPixels,T(e.inPixels)))},t[24]=i,t[25]=r,t[26]=z):z=t[26];let B=!b&&`transition-[flex-grow] duration-150 ease-out motion-reduce:transition-none motion-reduce:duration-0`,V;t[27]===B?V=t[28]:(V=X(`flex flex-col`,B),t[27]=B,t[28]=V);let H;t[29]===o?H=t[30]:(H=(0,Z.jsx)(`div`,{ref:o,className:`flex min-h-0 flex-1 flex-col overflow-hidden`}),t[29]=o,t[30]=H);let U;t[31]!==f||t[32]!==d||t[33]!==L||t[34]!==R||t[35]!==z||t[36]!==V||t[37]!==H?(U=(0,Z.jsx)(YC,{id:QM,style:L,panelRef:d,defaultSize:R,minSize:`120px`,maxSize:`95%`,collapsible:!0,collapsedSize:0,onResize:z,inert:f,className:V,children:H}),t[31]=f,t[32]=d,t[33]=L,t[34]=R,t[35]=z,t[36]=V,t[37]=H,t[38]=U):U=t[38];let W;return t[39]!==N||t[40]!==I||t[41]!==U||t[42]!==j?(W=(0,Z.jsxs)(JC,{orientation:`vertical`,className:`min-h-0 flex-1`,"data-dragging":j,children:[N,I,U]}),t[39]=N,t[40]=I,t[41]=U,t[42]=j,t[43]=W):W=t[43],W}function eN(){return XM()}var tN=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-9CRsXwpX.js`),__vite__mapDeps([43,1,2,44,45,46,11,47,48,49,50,51,52,53,54,21,10,3,55,40,7,56,12,6,13,57,58,39,16,33,34,35,59,20,15,4,60,17,61,62,19,63,64,65,66,32,36,37,38,67,68,69,70,71,72,73,74,75,76]),import.meta.url)).ActivityModeContent})),nN=`300px`,rN=`600px`,iN=new Set([`doc-panel`,`terminal-column`,`agent-panel`]);function aN(e){let t=(0,$.c)(5),n;t[0]===e?n=t[1]:(n=(0,Z.jsx)(sN,{...e}),t[0]=e,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(oN,{}),t[2]=r):r=t[2];let i;return t[3]===n?i=t[4]:(i=(0,Z.jsx)(hl,{name:`editor-area`,children:(0,Z.jsxs)(Ki,{children:[n,r]})}),t[3]=n,t[4]=i),i}function oN(){let e=(0,$.c)(5),t=Ua(),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)(UC,{open:t.open,onOpenChange:n}),e[2]=t.open,e[3]=n,e[4]=r):r=e[4],r}function sN(e){let t=(0,$.c)(248),{editorMode:n,onModeChange:r,activeTab:i,onActiveTabChange:a,terminalBridge:o,terminalVisible:s,onTerminalVisibleChange:c,terminalDock:l,onTerminalPlacement:u,onRevealTerminal:d}=e,f=s===void 0?!1:s,p=l===void 0?`right`:l,{_:m}=kt(),{resolvedTheme:h}=sn(),g;t[0]===h?g=t[1]:(g=Au(h),t[0]=h,t[1]=g);let _=g.background,{activeDocName:v,activeProvider:y,activeTarget:b,recycleDocument:x,docPanelMode:S,docPanelAgentId:C,docPanelExpandSignal:w}=Ye(),{openDocumentTransition:T}=at(),{requestAddProperty:E}=Ui(),D=vw(y,v),O=xw(v,n===`source`?`source`:`wysiwyg`),k=Kw(y),A=k===`connected`||k===`synced`,j=bw(v)===`conflict`,[M,N]=(0,Q.useState)(!1),P,F;t[2]!==y||t[3]!==M?(P=()=>{y!=null&&!M&&N(!0)},F=[y,M],t[2]=y,t[3]=M,t[4]=P,t[5]=F):(P=t[4],F=t[5]),(0,Q.useEffect)(P,F);let I=(0,Q.useDeferredValue)(v),L=b?.kind===`missing`,R=!!v&&b?.kind!==`folder`,z;t[6]!==m||t[7]!==L?(z=L?m({id:`K-a33w`}):void 0,t[6]=m,t[7]=L,t[8]=z):z=t[8];let B=z,V=(0,Q.useSyncExternalStore)($r.subscribe,$r.getSnapshot,$r.getSnapshot),H;t[9]!==b||t[10]!==V?(H=ri(b,V),t[9]=b,t[10]=V,t[11]=H):H=t[11];let U=H,[W]=(0,Q.useState)(fN),G=W!==null,K;t[12]===W?K=t[13]:(K=()=>Aw(W,window.innerWidth,`right`),t[12]=W,t[13]=K);let[ee,te]=(0,Q.useState)(K),ne=(0,Q.useRef)(ee),re,ie;t[14]===ee?(re=t[15],ie=t[16]):(ie=()=>{ne.current=ee},re=[ee],t[14]=ee,t[15]=re,t[16]=ie),(0,Q.useEffect)(ie,re);let q=Gb(),ae=Gb(),oe;t[17]===ee?oe=t[18]:(oe=()=>zw(`right`,ee,Lw())===`collapsed`,t[17]=ee,t[18]=oe);let[se]=(0,Q.useState)(oe),[ce,le]=(0,Q.useState)(se),ue=(0,Q.useRef)(ce),[de,fe]=(0,Q.useState)(null),[pe,me]=(0,Q.useState)(null),[he,ge]=(0,Q.useState)(null),_e=p===`right`,ve=_e?`right`:`bottom`,ye=o!=null&&_e&&f,xe=o!=null&&!f&&d!=null,Se=xe&&!_e,Ce=xe&&_e,Te=_e&&f&&de!=null,Ee=Te?de:pe,De=(_e?Te:f)&&Ee!=null,Oe,ke;t[19]!==Ee||t[20]!==u||t[21]!==ve||t[22]!==he||t[23]!==De?(Oe=()=>{u?.({container:Ee,isShowing:De,dockPosition:ve,editorRegion:he})},ke=[u,Ee,De,ve,he],t[19]=Ee,t[20]=u,t[21]=ve,t[22]=he,t[23]=De,t[24]=Oe,t[25]=ke):(Oe=t[24],ke=t[25]),(0,Q.useEffect)(Oe,ke);let Ae,je;t[26]===ce?(Ae=t[27],je=t[28]):(Ae=()=>{ue.current=ce},je=[ce],t[26]=ce,t[27]=Ae,t[28]=je),(0,Q.useEffect)(Ae,je);let[Me,Ne]=(0,Q.useState)(!1),Pe=(0,Q.useRef)(!1),[Fe]=(0,Q.useState)(dN),Ie=(0,Q.useRef)(Fe),Le=(0,Q.useRef)(null),Re;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(Re=function(e){Le.current!=null&&clearTimeout(Le.current),Le.current=setTimeout(()=>{Tw(e),Le.current=null},100)},t[29]=Re):Re=t[29];let ze=Re,[Be]=(0,Q.useState)(uN),Ve=(0,Q.useRef)(Be),[He,Ue]=(0,Q.useState)(!1),We=(0,Q.useRef)(!1),Ge=(0,Q.useRef)(null),Ke;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(Ke=function(e){Ge.current!=null&&clearTimeout(Ge.current),Ge.current=setTimeout(()=>{Ww(e),Ge.current=null},100)},t[30]=Ke):Ke=t[30];let qe=Ke,Je,Xe;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(Je=()=>()=>{Le.current!=null&&clearTimeout(Le.current),Ge.current!=null&&clearTimeout(Ge.current)},Xe=[],t[31]=Je,t[32]=Xe):(Je=t[31],Xe=t[32]),(0,Q.useEffect)(Je,Xe);let[Ze,Qe]=(0,Q.useState)(null),$e=(0,Q.useRef)(null),et=Bb(),tt=(0,Q.useRef)(ye),nt,rt;t[33]===ye?(nt=t[34],rt=t[35]):(nt=()=>{tt.current=ye},rt=[ye],t[33]=ye,t[34]=nt,t[35]=rt),(0,Q.useEffect)(nt,rt);let it;t[36]!==q||t[37]!==ae?(it=function(){for(let e of[q,ae]){let t=e.current?.getSize();if(t!=null&&t.asPercentage>1&&t.inPixels>0)return t.inPixels/t.asPercentage*100}let e=$e.current;return e!=null&&e.offsetWidth>0?e.offsetWidth:null},t[36]=q,t[37]=ae,t[38]=it):it=t[38];let ot=it,st;t[39]!==et||t[40]!==ot?(st=function(e){if(Pe.current||We.current)return;let t=et.current;if(t!=null)try{let n=ot();if(n==null)return;let r=t.getLayout(),i=Object.keys(r);if(i.length===0)return;let a=i.find(lN);if(a==null)return;let o={};if(`doc-panel`in r&&(o[`doc-panel`]=e?0:Ie.current),`terminal-column`in r&&(o[`terminal-column`]=Ve.current),Object.keys(o).length===0)return;let s=BM({currentLayout:r,containerPx:n,pinnedPx:o,residualId:a});s!==r&&t.setLayout(s)}catch{}},t[39]=et,t[40]=ot,t[41]=st):st=t[41];let ct=st,lt=(0,Q.useRef)(ct),ut;t[42]===ct?ut=t[43]:(ut=()=>{lt.current=ct},t[42]=ct,t[43]=ut),(0,Q.useEffect)(ut);let dt;t[44]!==ct||t[45]!==q?(dt=function(){tt.current?ct(!1):q.current?.expand()},t[44]=ct,t[45]=q,t[46]=dt):dt=t[46];let ft=dt,pt;t[47]!==ct||t[48]!==ce||t[49]!==q?(pt=function(){if(q.current==null)return;let e=ne.current;ce?(Bw(`right`,e,`open`),tt.current?ct(!1):q.current?.expand()):(Bw(`right`,e,`collapsed`),tt.current?ct(!0):q.current?.collapse())},t[47]=ct,t[48]=ce,t[49]=q,t[50]=pt):pt=t[50];let mt=pt,ht,gt;t[51]!==ct||t[52]!==W||t[53]!==q?(ht=()=>{let e=window.matchMedia(`(min-width: ${Ow}px)`),t=()=>{let e=Aw(W,window.innerWidth,`right`);te(e);let t=zw(`right`,e,Lw())===`collapsed`;le(t),tt.current?ct(t):t?q.current?.collapse():q.current?.expand()};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},gt=[W,q,ct],t[51]=ct,t[52]=W,t[53]=q,t[54]=ht,t[55]=gt):(ht=t[54],gt=t[55]),(0,Q.useEffect)(ht,gt);let _t,vt;t[56]!==Ze||t[57]!==G?(_t=()=>{if(Ze==null||G)return;let e=new ResizeObserver(()=>{lt.current(ue.current)});return e.observe(Ze),()=>e.disconnect()},vt=[Ze,G],t[56]=Ze,t[57]=G,t[58]=_t,t[59]=vt):(_t=t[58],vt=t[59]),(0,Q.useEffect)(_t,vt);let yt,bt;t[60]!==ft||t[61]!==a?(yt=()=>{let e=e=>{a(e),ft()},t=ch();return t&&e(t),uh(t=>{ch(),e(t)})},bt=[a,ft],t[60]=ft,t[61]=a,t[62]=yt,t[63]=bt):(yt=t[62],bt=t[63]),(0,Q.useEffect)(yt,bt);let xt,St;t[64]!==w||t[65]!==ft?(xt=()=>{w!==0&&ft()},St=[w,ft],t[64]=w,t[65]=ft,t[66]=xt,t[67]=St):(xt=t[66],St=t[67]),(0,Q.useEffect)(xt,St);let Ct=(0,Q.useRef)(ye),wt,Tt;t[68]!==ce||t[69]!==ye?(wt=()=>{if(Ct.current===ye)return;Ct.current=ye;let e=ce;queueMicrotask(()=>{lt.current(e)})},Tt=[ye,ce],t[68]=ce,t[69]=ye,t[70]=wt,t[71]=Tt):(wt=t[70],Tt=t[71]),(0,Q.useLayoutEffect)(wt,Tt);let Et,Dt;t[72]===ce?(Et=t[73],Dt=t[74]):(Et=()=>{if(!ce||!document.getElementById(`doc-panel`)?.contains(document.activeElement))return;let e=document.querySelector(`[data-doc-panel-toggle]`);if(e){e.focus();return}document.querySelector(`[data-sidebar="trigger"]`)?.focus()},Dt=[ce],t[72]=ce,t[73]=Et,t[74]=Dt),(0,Q.useLayoutEffect)(Et,Dt);let Ot,At;t[75]===ce?(Ot=t[76],At=t[77]):(Ot=()=>{window.okDesktop!=null&&window.okDesktop.editor.notifyViewMenuStateChanged({docPanelVisible:!ce})},At=[ce],t[75]=ce,t[76]=Ot,t[77]=At),(0,Q.useEffect)(Ot,At);let jt,Mt;t[78]===mt?(jt=t[79],Mt=t[80]):(jt=()=>{if(window.okDesktop!=null)return window.okDesktop.onMenuAction(e=>{e===`toggle-doc-panel`&&mt()})},Mt=[mt],t[78]=mt,t[79]=jt,t[80]=Mt),(0,Q.useEffect)(jt,Mt);let Nt,Pt;t[81]===mt?(Nt=t[82],Pt=t[83]):(Nt=()=>{if(window.okDesktop!=null)return;let e=e=>{jl(e,`toggle-document-panel`)&&(e.preventDefault(),mt())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},Pt=[mt],t[81]=mt,t[82]=Nt,t[83]=Pt),(0,Q.useEffect)(Nt,Pt);let Ft=(0,Q.useRef)(null),[It,Lt]=(0,Q.useState)(null),[Rt,zt]=(0,Q.useState)(!1),Bt=b?.kind===`large-file`?b.docName:v,Vt,Ht;t[84]===Bt?(Vt=t[85],Ht=t[86]):(Vt=()=>{if(Bt&&Bt!==Ft.current){let e=Ft.current;Ft.current=Bt,Lt(e)}},Ht=[Bt],t[84]=Bt,t[85]=Vt,t[86]=Ht),(0,Q.useEffect)(Vt,Ht);let Ut;t[87]===T?Ut=t[88]:(Ut=function(e){let t=El(e);window.location.hash===t?T(e):window.location.hash=t},t[87]=T,t[88]=Ut);let Wt=Ut,Y,Gt=null;if(b?.kind===`large-file`){let e;t[89]!==Wt||t[90]!==It?(e=It?{previousDocName:It,onNavigateBack:Wt}:void 0,t[89]=Wt,t[90]=It,t[91]=e):e=t[91];let n;t[92]!==b.docName||t[93]!==b.limit||t[94]!==b.size||t[95]!==e?(n=(0,Z.jsx)(TC,{docName:b.docName,size:b.size,limit:b.limit,backNav:e}),t[92]=b.docName,t[93]=b.limit,t[94]=b.size,t[95]=e,t[96]=n):n=t[96],Y=n}else if(b?.kind===`folder`){let e;t[97]!==G||t[98]!==f?(e=FT({terminalVisible:f,isEmbedded:G}),t[97]=G,t[98]=f,t[99]=e):e=t[99];let n=e,r;t[100]===b.folderPath?r=t[101]:(r=(0,Z.jsx)(xC,{folderPath:b.folderPath}),t[100]=b.folderPath,t[101]=r);let i;t[102]===n?i=t[103]:(i=n?(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-0 h-2 bg-linear-to-t from-background to-transparent`}):null,t[102]=n,t[103]=i);let a;t[104]!==r||t[105]!==i?(a=(0,Z.jsxs)(`div`,{className:`relative flex min-h-0 flex-1 flex-col`,children:[r,i]}),t[104]=r,t[105]=i,t[106]=a):a=t[106];let o;t[107]!==b.folderPath||t[108]!==n?(o=n?(0,Z.jsx)(ST,{folderPath:b.folderPath}):null,t[107]=b.folderPath,t[108]=n,t[109]=o):o=t[109];let s;if(t[110]!==a||t[111]!==o?(s=(0,Z.jsxs)(`div`,{className:`relative flex h-full min-h-0 flex-col`,children:[a,o]}),t[110]=a,t[111]=o,t[112]=s):s=t[112],Y=s,S===`agent`&&C!==null){let e;t[113]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(XC,{withHandle:!0}),t[113]=e):e=t[113];let n;t[114]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(Z.Fragment,{children:[e,(0,Z.jsx)(YC,{id:`agent-panel`,defaultSize:`25%`,minSize:`300px`,maxSize:`40%`,className:`flex flex-col bg-muted/20`,children:(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(`div`,{role:`status`,"aria-busy":`true`,className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`ONPvOb`})}),children:(0,Z.jsx)(tN,{showBackButton:!1})})})]}),t[114]=n):n=t[114],Gt=n}}else if(b?.kind===`asset`){let e;t[115]!==b.assetPath||t[116]!==b.mediaKind?(e=(0,Z.jsx)(sx,{assetPath:b.assetPath,mediaKind:b.mediaKind},b.assetPath),t[115]=b.assetPath,t[116]=b.mediaKind,t[117]=e):e=t[117],Y=e}else if(b?.kind===`skill-file`){let e=`${b.scope}/${b.name}/${b.path}`,n;t[118]!==b.name||t[119]!==b.path||t[120]!==b.scope||t[121]!==e?(n=(0,Z.jsx)(PC,{scope:b.scope,name:b.name,path:b.path},e),t[118]=b.name,t[119]=b.path,t[120]=b.scope,t[121]=e,t[122]=n):n=t[122],Y=n}else if(U){let e;t[123]===U?e=t[124]:(e=(0,Z.jsx)(OC,{nav:U},U.path),t[123]=U,t[124]=e),Y=e}else if(!y||!v)if((typeof window<`u`?Tl(window.location.hash):null)!==null)if(o!=null&&M){let e;t[125]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(cx,{}),t[125]=e):e=t[125],Y=e;let n;t[126]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(XC,{withHandle:!0,disabled:!0}),t[126]=n):n=t[126];let r=se?0:`${Fe}px`,i;t[127]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`}),t[127]=i):i=t[127];let a;t[128]===r?a=t[129]:(a=(0,Z.jsxs)(Z.Fragment,{children:[n,(0,Z.jsx)(YC,{id:`doc-panel`,defaultSize:r,minSize:nN,maxSize:rN,collapsible:!0,collapsedSize:0,inert:!0,className:`flex flex-col bg-muted/20`,children:i})]}),t[128]=r,t[129]=a),Gt=a}else{let e;return t[130]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(cx,{}),t[130]=e):e=t[130],e}else{let e=f?ve:null,n;t[131]===e?n=t[132]:(n=(0,Z.jsx)(HS,{terminalDock:e}),t[131]=e,t[132]=n),Y=n}else{let e=n===`source`,o=!A,s=ce,c;t[133]!==v||t[134]!==E?(c=function(){v&&E(v)},t[133]=v,t[134]=E,t[135]=c):c=t[135];let l=c,u;t[136]!==v||t[137]!==G||t[138]!==f?(u=PT({terminalVisible:f,isEmbedded:G,activeDocName:v}),t[136]=v,t[137]=G,t[138]=f,t[139]=u):u=t[139];let d=u,p=I??v,m=It??void 0,h;t[140]!==B||t[141]!==e||t[142]!==Wt||t[143]!==x||t[144]!==p||t[145]!==m?(h=(0,Z.jsx)(yj,{activeDocName:p,isSourceMode:e,editorPlaceholder:B,previousDocName:m,onNavigateBack:Wt,onRecycle:x}),t[140]=B,t[141]=e,t[142]=Wt,t[143]=x,t[144]=p,t[145]=m,t[146]=h):h=t[146];let g;t[147]!==v||t[148]!==e?(g=(0,Z.jsx)(mw,{activeDocName:v,isSourceMode:e}),t[147]=v,t[148]=e,t[149]=g):g=t[149];let _;t[150]!==v||t[151]!==I?(_=zM({activeDocName:v,deferredActiveDocName:I,mountResolved:v!==null&&be(v),syncResolved:v!==null&&we(v)})?(0,Z.jsxs)(`div`,{className:`absolute inset-0 z-10 bg-background`,children:[(0,Z.jsx)(cx,{}),v===null?null:(0,Z.jsx)(EC,{docName:v})]}):null,t[150]=v,t[151]=I,t[152]=_):_=t[152];let y;t[153]!==h||t[154]!==g||t[155]!==_?(y=(0,Z.jsxs)(`div`,{className:`relative h-full`,children:[h,g,_]}),t[153]=h,t[154]=g,t[155]=_,t[156]=y):y=t[156];let b;t[157]!==v||t[158]!==j||t[159]!==s||t[160]!==e||t[161]!==r||t[162]!==l||t[163]!==Ce||t[164]!==o||t[165]!==mt?(b=!j&&(0,Z.jsx)(RM,{activeDocName:v,isSourceMode:e,sourceDisabled:o,onModeChange:r,showAddPropertyButton:!e,onAddProperty:l,isPanelCollapsed:s,onTogglePanel:mt,reserveRightGutter:Ce&&s}),t[157]=v,t[158]=j,t[159]=s,t[160]=e,t[161]=r,t[162]=l,t[163]=Ce,t[164]=o,t[165]=mt,t[166]=b):b=t[166];let C;t[167]!==v||t[168]!==Rt||t[169]!==e||t[170]!==d?(C=d?(0,Z.jsx)(ST,{docName:v,surface:e?`source`:`wysiwyg`,dismissed:Rt,onDismiss:()=>zt(!0),onReopen:()=>zt(!1)}):null,t[167]=v,t[168]=Rt,t[169]=e,t[170]=d,t[171]=C):C=t[171];let w;t[172]!==y||t[173]!==b||t[174]!==C?(w=(0,Z.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[y,b,C]}),t[172]=y,t[173]=b,t[174]=C,t[175]=w):w=t[175];let T;t[176]!==Rt||t[177]!==d?(T=d&&Rt?{onReopen:()=>zt(!1)}:null,t[176]=Rt,t[177]=d,t[178]=T):T=t[178];let k;t[179]!==Se||t[180]!==O||t[181]!==R||t[182]!==D||t[183]!==T?(k=(0,Z.jsx)(bM,{stats:D,selectionStats:O,showStats:R,composerBadge:T,reserveRightGutter:Se}),t[179]=Se,t[180]=O,t[181]=R,t[182]=D,t[183]=T,t[184]=k):k=t[184];let M;t[185]!==w||t[186]!==k?(M=(0,Z.jsxs)(`div`,{className:`relative flex h-full flex-col`,children:[w,k]}),t[185]=w,t[186]=k,t[187]=M):M=t[187],Y=M;let N=ye&&ce,P=!ce,F;t[188]===Symbol.for(`react.memo_cache_sentinel`)?(F=()=>{Ne(!0),Pe.current=!0;let e=()=>{Ne(!1),Pe.current=!1,window.removeEventListener(`pointerup`,e)};window.addEventListener(`pointerup`,e)},t[188]=F):F=t[188];let L;t[189]!==ce||t[190]!==P?(L=(0,Z.jsx)(XC,{withHandle:P,disabled:ce,onPointerDown:F}),t[189]=ce,t[190]=P,t[191]=L):L=t[191];let z=se?0:`${Fe}px`,V=N?`0px`:nN,H;t[192]===Symbol.for(`react.memo_cache_sentinel`)?(H=e=>{le(e.asPercentage===0),e.inPixels>0&&Pe.current&&(Ie.current=e.inPixels,ze(e.inPixels))},t[192]=H):H=t[192];let U=!Me&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,W;t[193]===U?W=t[194]:(W=X(`flex flex-col bg-muted/20`,U),t[193]=U,t[194]=W);let K;t[195]!==v||t[196]!==i||t[197]!==S||t[198]!==e||t[199]!==a?(K=(0,Z.jsx)(Xv,{docName:v,isSourceMode:e,activeTab:i,onActiveTabChange:a,mode:S}),t[195]=v,t[196]=i,t[197]=S,t[198]=e,t[199]=a,t[200]=K):K=t[200];let ee;t[201]!==N||t[202]!==ce||t[203]!==q||t[204]!==z||t[205]!==V||t[206]!==W||t[207]!==K?(ee=(0,Z.jsx)(YC,{id:`doc-panel`,panelRef:q,disabled:N,defaultSize:z,minSize:V,maxSize:rN,collapsible:!0,collapsedSize:0,onResize:H,inert:ce,className:W,children:K}),t[201]=N,t[202]=ce,t[203]=q,t[204]=z,t[205]=V,t[206]=W,t[207]=K,t[208]=ee):ee=t[208];let te;t[209]!==L||t[210]!==ee?(te=(0,Z.jsxs)(Z.Fragment,{children:[L,ee]}),t[209]=L,t[210]=ee,t[211]=te):te=t[211],Gt=te}let Kt;t[212]!==d||t[213]!==c||t[214]!==o||t[215]!==ve||t[216]!==f||t[217]!==Y?(Kt=o==null?Y:(0,Z.jsx)($M,{visible:f,onVisibleChange:c??cN,dockPosition:ve,onBottomContainer:me,onEditorRegion:ge,onReveal:d,children:Y}),t[212]=d,t[213]=c,t[214]=o,t[215]=ve,t[216]=f,t[217]=Y,t[218]=Kt):Kt=t[218];let qt=Kt,Jt;t[219]!==Be||t[220]!==He||t[221]!==c||t[222]!==ae||t[223]!==ye||t[224]!==_?(Jt=ye?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(XC,{withHandle:!0,onPointerDown:()=>{Ue(!0),We.current=!0;let e=()=>{Ue(!1),We.current=!1,window.removeEventListener(`pointerup`,e),ae.current?.isCollapsed()&&c?.(!1)};window.addEventListener(`pointerup`,e)}}),(0,Z.jsx)(YC,{id:`terminal-column`,panelRef:ae,style:{backgroundColor:_},defaultSize:`${Be}px`,minSize:`320px`,maxSize:`95%`,collapsible:!0,collapsedSize:0,onResize:e=>{e.inPixels>0&&We.current&&(Ve.current=e.inPixels,qe(e.inPixels))},className:X(`flex flex-col`,!He&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`),children:(0,Z.jsx)(`div`,{ref:fe,className:`flex min-h-0 flex-1 flex-col overflow-hidden`})})]}):null,t[219]=Be,t[220]=He,t[221]=c,t[222]=ae,t[223]=ye,t[224]=_,t[225]=Jt):Jt=t[225];let Yt=Jt,Xt=Gt!=null&&!se||ye,Zt;t[226]===Symbol.for(`react.memo_cache_sentinel`)?(Zt=e=>{Qe(e),$e.current=e},t[226]=Zt):Zt=t[226];let Qt=Me||He||void 0,$t=ye?`5%`:`30%`,en;t[227]===Xt?en=t[228]:(en=Xt?{}:{defaultSize:`100%`},t[227]=Xt,t[228]=en);let tn=!(Me||He)&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,nn;t[229]===tn?nn=t[230]:(nn=X(tn),t[229]=tn,t[230]=nn);let rn;t[231]!==qt||t[232]!==$t||t[233]!==en||t[234]!==nn?(rn=(0,Z.jsx)(YC,{minSize:$t,...en,className:nn,children:qt}),t[231]=qt,t[232]=$t,t[233]=en,t[234]=nn,t[235]=rn):rn=t[235];let an;t[236]!==et||t[237]!==Gt||t[238]!==Qt||t[239]!==rn||t[240]!==Yt?(an=(0,Z.jsxs)(JC,{orientation:`horizontal`,groupRef:et,"data-dragging":Qt,children:[rn,Gt,Yt]}),t[236]=et,t[237]=Gt,t[238]=Qt,t[239]=rn,t[240]=Yt,t[241]=an):an=t[241];let on;t[242]!==d||t[243]!==Ce?(on=Ce?(0,Z.jsx)(ZM,{dockPosition:`right`,onReveal:d,className:`top-2.5 right-0`}):null,t[242]=d,t[243]=Ce,t[244]=on):on=t[244];let cn;return t[245]!==an||t[246]!==on?(cn=(0,Z.jsxs)(`div`,{className:`relative flex min-h-0 flex-1`,ref:Zt,children:[an,on]}),t[245]=an,t[246]=on,t[247]=cn):cn=t[247],cn}function cN(){}function lN(e){return!iN.has(e)}function uN(){return Gw()}function dN(){return Ew()}function fN(){return nr()}function pN(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 mN(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 hN=1e3,gN=!1;function _N(e){return!!(e.localPrincipalId&&e.entryPrincipalId===e.localPrincipalId||!e.localPrincipalId&&e.entryClientId===e.localClientId)}function vN(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:ms(i)?a=i:(a=void 0,gN||(gN=!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`&&(_N({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=mN(i),{current:c,crossDoc:l}=a?us(a,n,Date.now()):{current:[],crossDoc:[]},u=yN,d=c.map(u),f=l.map(u),p=[...s,...d],m=f;o(e=>pN(e.current,p)&&pN(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,hN);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 yN(e){let{agentId:t,entry:n}=e;return{kind:`agent`,agentId:t,presence:n}}var bN=!1,xN=new Set,SN=!1;function CN(){for(let e of xN)e()}function wN(e){bN!==e&&(bN=e,CN())}function TN(){return bN}function EN(e){return xN.add(e),()=>{xN.delete(e)}}function DN(e){let t=[e.onUpdateRelaunching(()=>wN(!0)),e.onUpdateRelaunchFailed(()=>wN(!1))];return()=>{for(let e of t)e()}}function ON(){if(SN||typeof window>`u`)return;let e=window.okDesktop;e&&(SN=!0,DN(e))}function kN(){return(0,Q.useSyncExternalStore)(EN,TN,AN)}function AN(){return!1}var jN=`sync-status`;async function MN(e){try{let t=await zg(e);t.ok||hs.error(t.message,{id:jN,duration:1/0})}catch{}}function NN(e,t){let n=(0,$.c)(6),{_:r}=kt(),i=kN(),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){hs.dismiss(jN);return}o.current=!0;let e=window.okDesktop;hs.warning(r({id:`HGNCsl`}),{id:jN,duration:1/0,...e?{action:{label:r({id:`uaUc6t`}),onClick:()=>{MN(e)}}}:{}})}else o.current&&e===`synced`&&(o.current=!1,hs.success(r({id:`GhjUB_`}),{id:jN,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 PN=4,FN=3,IN={Bird:Cd,Cat:Ad,Dog:Rd,Fish:Wd,Mouse:Sf,Rabbit:xf,Shrimp:Of,Snail:kf,Squirrel:Nf,Turtle:Uf};Object.freeze(Object.keys(IN));function LN(e){if(typeof e.principalId==`string`&&e.principalId.length>0)return{kind:`initials`};let t=e.name.split(` `)[1];return t&&Object.hasOwn(IN,t)?{kind:`animal`,animal:t}:{kind:`initials`}}var RN={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`,bot:`Agent`};function zN(e){let t=(0,$.c)(28),{user:n,mode:r,tabCount:i}=e,{_:a}=kt(),o=LN(n),s=o.kind===`animal`?IN[o.animal]:void 0,c;t[0]===n.name?c=t[1]:(c=yr(n.name),t[0]=n.name,t[1]=c);let l=c,u;t[2]===n.color?u=t[3]:(u=tr(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)(Ts,{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)(Es,{children:m}),t[23]=m,t[24]=b);let x;return t[25]!==y||t[26]!==b?(x=(0,Z.jsxs)(Os,{children:[y,b]}),t[25]=y,t[26]=b,t[27]=x):x=t[27],x}function BN(e){let t=RN[e.icon];return e.displayName||t||Gc._({id:`iEQQyu`})}function VN(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 HN(e){let t=(0,$.c)(33),{participant:n,crossDoc:r,scoped:i,onClickAgent:a}=e,{_:o}=kt(),{activeDocName:s}=Ye(),{presence:c,agentId:l}=n,u=BN(c),d=VN(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)(fs,{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)(fs,{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)(Ts,{asChild:!0,children:D}),t[20]=D,t[21]=O);let k;t[22]===u?k=t[23]:(k=(0,Z.jsx)(`span`,{className:`font-medium`,children:u}),t[22]=u,t[23]=k);let A;t[24]!==r||t[25]!==p?(A=r&&p?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(J,{id:`Wh0im4`,values:{realCurrentDoc:p}})}):null,t[24]=r,t[25]=p,t[26]=A):A=t[26];let j;t[27]!==k||t[28]!==A?(j=(0,Z.jsxs)(Es,{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)(Os,{children:[O,j]}),t[30]=O,t[31]=j,t[32]=M):M=t[32],M}function UN(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?Gc._({id:`9euN0m`,values:{count:n}}):Gc._({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)(se,{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)(zN,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(HN,{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)(ie,{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)(ae,{children:[u,f]}),t[18]=u,t[19]=f,t[20]=p):p=t[20],p}function WN(e,t,n,r){return e.kind===`human`?(0,Z.jsx)(zN,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(HN,{participant:e,crossDoc:n,scoped:r===e.agentId,onClickAgent:t},e.agentId)}function GN(){let e=(0,$.c)(20),{activeProvider:t,activeDocName:n,systemProvider:r,openActivityPanel:i,docPanelMode:a,docPanelAgentId:o}=Ye(),{current:s,crossDoc:c}=vN(t,r,n);if(NN(Kw(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,PN),n;e[6]===s?n=e[7]:(n=s.slice(PN),e[6]=s,e[7]=n);let r=n,u=c.slice(0,FN),d;e[8]===c?d=e[9]:(d=c.slice(FN),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=>WN(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)(UN,{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=>WN(e,p,!0,m)),f.length>0?(0,Z.jsx)(UN,{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 KN(){let e=(0,$.c)(4),[t,n]=(0,Q.useState)(null),r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=window.okDesktop;if(!e)return;let t=!1;return e.state.query().then(e=>{t||n(e.channel)}).catch(qN),()=>{t=!0}},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,Q.useEffect)(r,i);let a;return e[2]===t?a=e[3]:(a={channel:t},e[2]=t,e[3]=a),a}function qN(e){console.warn(`[use-update-channel] bridge.state.query() failed`,e)}function JN(e){let t=(0,$.c)(6),{className:n}=e,{_:r}=kt(),{channel:i}=KN();if(i!==`beta`)return null;let a;t[0]===r?a=t[1]:(a=r({id:`9fhQRL`}),t[0]=r,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(J,{id:`cSCbv3`}),t[2]=o):o=t[2];let c;return t[3]!==n||t[4]!==a?(c=(0,Z.jsx)(s,{variant:`secondary`,"aria-label":a,"data-testid":`beta-badge`,className:n,children:o}),t[3]=n,t[4]=a,t[5]=c):c=t[5],c}function YN(e,t){return t.trim()}function XN(e){return![``,`.`,`..`].includes(e)&&!e.includes(`/`)&&!e.includes(`\\`)&&!e.includes(`\0`)}function ZN(e,t){let n=YN(e.kind,t),r=e.path.split(`/`);return r[r.length-1]=n,r.join(`/`)}function QN(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(ol(e)){let t=s.get(Xu(e.docName,e.docExt));if(t){let n=Qc(t);return{kind:`asset`,path:t,assetExt:n,mediaKind:Hn(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(Zc(e))return{...e,path:aP(e.path,n)};if(el(e)){let t=s.get(e.path);return t&&Kc(t)?{kind:`document`,docName:Iu(t),docExt:Jc(t),size:e.size,modified:e.modified}:{...e,path:t??aP(e.path,n)}}return e})}function $N(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=>ol(e)?!i.has(e.docName)&&!lP(e.docName,n):Zc(e)?!lP(e.path,n):el(e)?!a.has(e.path)&&!lP(e.path,n):!0)}function eP(e,t){if(e.kind!==`asset`||t.some(t=>el(t)&&t.path===e.path))return e;let n=$u(e.path,t);return n?{...e,path:n,name:n.split(`/`).pop()??n}:e}function tP(e,t,n,r=new Date().toISOString()){let i=!1,a=[...e],o=e=>{a.some(t=>oP(t,e))||(a.push(e),i=!0)};if(n.kind===`file`){let s=e.find(e=>ol(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=>Zc(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(ol(i)){let e=cP(i.docName,t.path,n.path);e&&c.has(e)&&o({...i,docName:e,modified:r});continue}if(Zc(i)){let e=sP(i.path,t.path,n.path);e&&o({...i,path:e,modified:r})}}return i?a:e}function nP(e,t){return e?t.find(t=>t.fromDocName===e)?.toDocName??e:null}function rP(e,t,n){return e.flatMap(e=>t===e.toDocName||!n(e.toDocName)?[e.fromDocName]:[e.fromDocName,e.toDocName])}function iP(e,t){let n=e.kind===`file`?Xu(e.path,e.docExt):e.path;return Mo(t.contentDir,n,t.pathSeparator)}function aP(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 oP(e,t){return ol(e)&&ol(t)?e.docName===t.docName:Zc(e)&&Zc(t)||el(e)&&el(t)?e.path===t.path:!1}function sP(e,t,n){return e===t?n:cP(e,t,n)}function cP(e,t,n){return e.startsWith(`${t}/`)?`${n}${e.slice(t.length)}`:null}function lP(e,t){return!!t&&(e===t||e.startsWith(`${t}/`))}function uP(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)(Mp,{"data-slot":`context-menu`,...n}),t[2]=n,t[3]=r),r}function dP(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)(Np,{"data-slot":`context-menu-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function fP(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)(Ip,{"data-slot":`context-menu-group`,...n}),t[2]=n,t[3]=r),r}function pP(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)(Hp,{"data-slot":`context-menu-sub`,...n}),t[2]=n,t[3]=r),r}function mP(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)(Pp,{children:(0,Z.jsx)(Fp,{"data-slot":`context-menu-content`,className:i,...r})}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function hP(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)(Rp,{"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 gP(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)(na,{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)(Up,{"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 _P(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)(Wp,{"data-slot":`context-menu-sub-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function vP(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)(Bp,{children:(0,Z.jsx)($i,{})})}),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)(zp,{"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 yP(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)(Lp,{"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 bP(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)(Vp,{"data-slot":`context-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var xP=`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`,SP=`border-border bg-background text-foreground hover:bg-background focus-visible:bg-background`,CP={start:[Yo.Space],cancel:[Yo.Esc],end:[Yo.Space,Yo.Enter]};function wP(e){return X(xP,e?`opacity-100`:`pointer-events-none opacity-0 group-hover:pointer-events-auto group-hover:opacity-100`)}function TP(e){return e?void 0:-1}function EP({className:e,isDragging:t}){return X(e,t&&SP)}function DP(e){return e.code===Yo.Enter&&e.target===e.currentTarget}function OP({event:e,hasKeyboardActivation:t,isDragging:n}){return e.defaultPrevented?`ignore`:!n&&t&&DP(e)?`activate-tab`:`delegate-sortable`}function kP({activeWidth:e,isDragging:t,outerStyle:n,transform:r,transition:i}){let a=t&&e?e:void 0;return{...n,transform:es.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 AP(e,t){let n=e?.querySelectorAll(t)??[],r=1/0,i=-1/0;for(let e of n){let t=e.getBoundingClientRect();r=Math.min(r,t.left),i=Math.max(i,t.right)}return Number.isFinite(r)&&Number.isFinite(i)?{left:r,right:i}:null}function jP(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 MP=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 Uo(e)},NP=[`.md`,`.mdx`],PP=`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`,FP=`z-10 rounded-t-lg rounded-b-none border-border border-b-0 bg-background text-foreground`,IP=X(FP,`bg-transparent hover:bg-muted focus-visible:bg-muted border-transparent hover:border-border focus-visible:border-border`),LP=`flex h-full min-w-0 flex-1 cursor-pointer items-center overflow-hidden px-3 text-left text-[13px]`;function RP(e){return e.replace(/[^A-Za-z0-9_-]/g,`-`)}function zP(e){let t=El(e);window.location.hash!==t&&(window.location.hash=t)}function BP(e){Math.abs(e.deltaX)>=Math.abs(e.deltaY)||e.currentTarget.scrollWidth<=e.currentTarget.clientWidth||(e.preventDefault(),e.currentTarget.scrollLeft+=e.deltaY)}function VP(e,t){let n=[t,...NP].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 HP(e){return e.metaKey||e.ctrlKey}var UP=1e3;function WP(e,t){return e<0||e>=t?null:e<8?String(e+1):e===t-1?`9`:null}function GP(e,t){return WP(e,t)}function KP(e,t){let n=WP(e,t);if(n)return[`Meta+${n}`,`Control+${n}`].join(` `)}function qP(e,t){if(!HP(e)||e.altKey||e.shiftKey||!/^[1-9]$/.test(e.key))return null;let n=Number(e.key);if(n===9)return t>0?t-1:null;let r=n-1;return r<Math.min(8,t)?r:null}function JP(e){let t=(0,$.c)(3),{value:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=X(wP(!0),`font-mono tabular-nums hover:bg-transparent animate-in fade-in-0 zoom-in-95 duration-150 motion-reduce:animate-none motion-reduce:duration-0`),t[0]=r):r=t[0];let i=`⌘${n}`,a;return t[1]===i?a=t[2]:(a=(0,Z.jsx)(`span`,{"aria-hidden":`true`,"data-testid":`editor-tab-shortcut-hint`,className:r,children:(0,Z.jsx)(M,{className:`text-[10px]`,children:i})}),t[1]=i,t[2]=a),a}function YP(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:_}=Qo(u),v=p.current?.width,y;t[12]!==_||t[13]!==s||t[14]!==v||t[15]!==h||t[16]!==g?(y=kP({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=OP({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=EP({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 XP(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=Ze(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?(_=Ze(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)(dP,{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)(J,{id:`yz7wBu`}),t[18]=x):x=t[18];let S;t[19]!==m||t[20]!==b?(S=(0,Z.jsx)(hP,{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)(J,{id:`omXJcU`}),t[25]=T):T=t[25];let E;t[26]!==C||t[27]!==w?(E=(0,Z.jsx)(hP,{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)(J,{id:`U2Kx6T`}):(0,Z.jsx)(J,{id:`WyXG7w`}),t[32]=l.length,t[33]=k);let A;t[34]!==D||t[35]!==O||t[36]!==k?(A=(0,Z.jsx)(hP,{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)(bP,{}),(0,Z.jsx)(hP,{"data-testid":`editor-tab-context-pin-toggle`,onSelect:()=>m?d(u):c(u),children:m?(0,Z.jsx)(J,{id:`SYfHmN`}):(0,Z.jsx)(J,{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)(mP,{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)(uP,{children:[y,M]}),t[49]=M,t[50]=y,t[51]=N):N=t[51],N}function ZP(e){let t=(0,$.c)(28),{accessibleLabel:n,closeTab:r,forceCloseVisible:i,isActive:a,isPinned:o,shortcutHint:s,tabId:c,unpinTab:l}=e,u=i===void 0?!1:i,d=s===void 0?null:s,{_:f}=kt();if(d){let e;return t[0]===d?e=t[1]:(e=(0,Z.jsx)(JP,{value:d}),t[0]=d,t[1]=e),e}if(o){let e;t[2]!==f||t[3]!==n?(e=f({id:`t18QYR`,values:{accessibleLabel:n}}),t[2]=f,t[3]=n,t[4]=e):e=t[4];let r;t[5]!==c||t[6]!==l?(r=e=>{e.stopPropagation(),l(c)},t[5]=c,t[6]=l,t[7]=r):r=t[7];let i;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(bf,{"aria-hidden":`true`}),t[8]=i):i=t[8];let a;return t[9]!==e||t[10]!==r?(a=(0,Z.jsx)(Jr,{variant:`ghost`,size:`icon-xs`,type:`button`,"aria-label":e,"data-testid":`editor-tab-unpin-button`,className:`mr-1.5 text-primary! hover:bg-primary/10!`,onClick:r,children:i}),t[9]=e,t[10]=r,t[11]=a):a=t[11],a}let p;t[12]!==f||t[13]!==n?(p=f({id:`JLzQi_`,values:{accessibleLabel:n}}),t[12]=f,t[13]=n,t[14]=p):p=t[14];let m=u||a,h;t[15]===m?h=t[16]:(h=wP(m),t[15]=m,t[16]=h);let g;t[17]===a?g=t[18]:(g=TP(a),t[17]=a,t[18]=g);let _;t[19]!==r||t[20]!==c?(_=e=>{e.stopPropagation(),r(c)},t[19]=r,t[20]=c,t[21]=_):_=t[21];let v;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(gs,{"aria-hidden":`true`}),t[22]=v):v=t[22];let y;return t[23]!==p||t[24]!==h||t[25]!==g||t[26]!==_?(y=(0,Z.jsx)(Jr,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":p,"data-testid":`editor-tab-close-button`,className:h,tabIndex:g,onClick:_,children:v}),t[23]=p,t[24]=h,t[25]=g,t[26]=_,t[27]=y):y=t[27],y}function QP(e){let t=(0,$.c)(1),{hasConflict:n}=e;if(!n)return null;let r;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(os,{"aria-hidden":`true`,"data-testid":`editor-tab-conflict-badge`,className:`mr-1 size-3.5 shrink-0 text-amber-500`}),t[0]=r):r=t[0],r}function $P(e){let t=(0,$.c)(27),{accessibleLabel:n,activateTab:r,baseName:i,docName:a,enterRenameMode:o,extension:s,hideDocExtension:c,tabId:l}=e,{_:u}=kt(),d=bw(a)===`conflict`,f;t[0]!==u||t[1]!==n||t[2]!==d?(f=d?u({id:`mVFyH-`,values:{accessibleLabel:n}}):n,t[0]=u,t[1]=n,t[2]=d,t[3]=f):f=t[3];let p=f,m;t[4]!==r||t[5]!==l?(m=()=>{r(l)},t[4]=r,t[5]=l,t[6]=m):m=t[6];let h;t[7]!==a||t[8]!==o||t[9]!==l?(h=e=>{e.preventDefault(),e.stopPropagation(),o(l,a)},t[7]=a,t[8]=o,t[9]=l,t[10]=h):h=t[10];let g;t[11]===d?g=t[12]:(g=(0,Z.jsx)(QP,{hasConflict:d}),t[11]=d,t[12]=g);let _;t[13]===i?_=t[14]:(_=(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:i}),t[13]=i,t[14]=_);let v;t[15]!==s||t[16]!==c?(v=!c&&(0,Z.jsx)(`span`,{className:`shrink-0`,children:s}),t[15]=s,t[16]=c,t[17]=v):v=t[17];let y;t[18]!==_||t[19]!==v?(y=(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center`,children:[_,v]}),t[18]=_,t[19]=v,t[20]=y):y=t[20];let b;return t[21]!==p||t[22]!==m||t[23]!==h||t[24]!==g||t[25]!==y?(b=(0,Z.jsxs)(`button`,{type:`button`,"aria-label":p,title:p,className:LP,onClick:m,onDoubleClick:h,tabIndex:-1,children:[g,y]}),t[21]=p,t[22]=m,t[23]=h,t[24]=g,t[25]=y,t[26]=b):b=t[26],b}function eF(){let e=(0,$.c)(94),{activeDocName:t,activeTabId:n,activeNewTabId:r,activeTarget:i,activateTab:a,activateNewTab:o,closeAndClearForRename:s,closeNewTab:c,closeTab:l,closeTabs:u,getPoolActiveDocName:d,poolHas:p,isNewTabActive:m,newTabIds:h,openNewTab:g,openTabs:_,pinTab:v,pinnedTabIds:y,reopenClosedTab:b,remapTabsForRename:x,reorderTabs:S,unpinTab:C,visibleTabIds:w}=Ye(),{_:T}=kt(),{pageMeta:E}=ia(),D=(0,Q.useRef)(null),[O,k]=(0,Q.useState)(null),[A,j]=(0,Q.useState)(null),[M,N]=(0,Q.useState)(``),[P,F]=(0,Q.useState)(null),[I,L]=(0,Q.useState)(!1),[R,z]=(0,Q.useState)(!1),B=(0,Q.useRef)(null),V=(0,Q.useRef)(!1),H=(0,Q.useRef)(!1),U=(0,Q.useRef)(null),W=(0,Q.useRef)(t),G=(0,Q.useRef)(null),K=(0,Q.useRef)(!1),ee=(0,Q.useRef)(!1),te;e[0]!==n||e[1]!==t||e[2]!==i?(te=n??(i?et(i):t?pt(t):null),e[0]=n,e[1]=t,e[2]=i,e[3]=te):te=e[3];let ne=te,re;e[4]!==r||e[5]!==ne||e[6]!==m||e[7]!==h||e[8]!==_?(re=m?`${r??`__new-tab__`}\u0000${_.join(`\0`)}\u0000${h.join(`\0`)}`:ne?`${ne}\u0000${_.join(`\0`)}`:``,e[4]=r,e[5]=ne,e[6]=m,e[7]=h,e[8]=_,e[9]=re):re=e[9];let ie=re,q,ae;e[10]===t?(q=e[11],ae=e[12]):(q=()=>{W.current=t},ae=[t],e[10]=t,e[11]=q,e[12]=ae),(0,Q.useEffect)(q,ae);let oe,se;e[13]===Symbol.for(`react.memo_cache_sentinel`)?(oe=()=>()=>{G.current!==null&&(window.clearTimeout(G.current),G.current=null)},se=[],e[13]=oe,e[14]=se):(oe=e[13],se=e[14]),(0,Q.useEffect)(oe,se);let ce,le;e[15]===ie?(ce=e[16],le=e[17]):(ce=()=>{ie&&(D.current?.querySelector(`[data-active-tab="true"]`))?.scrollIntoView({block:`nearest`,inline:`nearest`})},le=[ie],e[15]=ie,e[16]=ce,e[17]=le),(0,Q.useEffect)(ce,le);let ue,de;e[18]===A?(ue=e[19],de=e[20]):(ue=()=>{A&&(B.current?.focus(),B.current?.select())},de=[A],e[18]=A,e[19]=ue,e[20]=de),(0,Q.useEffect)(ue,de);let fe,pe;e[21]!==_||e[22]!==A?(fe=()=>{!A||_.includes(A.tabId)||(H.current=!0,U.current=null,j(null),N(``),F(null),L(!1))},pe=[_,A],e[21]=_,e[22]=A,e[23]=fe,e[24]=pe):(fe=e[23],pe=e[24]),(0,Q.useEffect)(fe,pe);let me;e[25]===Symbol.for(`react.memo_cache_sentinel`)?(me=function(e,t){let n=t.split(`/`);H.current=!1,U.current=null,j({docName:t,tabId:e}),N(n[n.length-1]),F(null)},e[25]=me):me=e[25];let he=me,ge=function(){H.current=!0,U.current=null,j(null),N(``),F(null),L(!1)},_e=async function(){if(H.current){H.current=!1;return}if(V.current)return;let e=A?.docName;if(!e){ge();return}let t=YN(`file`,VP(M,E.get(e)?.docExt??`.md`)),n=e.split(`/`),r=n[n.length-1];if(t===r){ge();return}if(t===U.current){B.current?.focus();return}if(!XN(t)){F(T({id:`P8yDjG`})),B.current?.focus();return}let i=ZN({kind:`file`,path:e,name:r},t);V.current=!0,L(!0),F(null);try{let n=await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:`file`,fromPath:e,toPath:i})});if(H.current){L(!1),V.current=!1;return}let r=await Ot(n,`Server error (HTTP ${n.status})`);if(!r.ok){F(r.title),L(!1),V.current=!1,U.current=t,B.current?.focus();return}let a=f(mr,r.body,`rename-path:tab`,{renamed:[],renamedAssets:[]}).renamed,o=W.current,c=nP(o,a);Ee(a);let l=!0;try{let e=rP(a,d(),p);await Promise.all(e.map(e=>s(e))),x(a),ul([`files`,`backlinks`,`graph`])}catch(n){let r=n;l=!1,console.warn(`[EditorTabs] post-rename reconciliation failed`,{err:r,docName:e,newDocName:i,normalized:t}),hs.error(T({id:`MUBR8r`}))}H.current=!0,j(null),N(``),F(null),L(!1),V.current=!1,U.current=null,l&&c&&c!==o&&zP(c)}catch(n){console.warn(`[EditorTabs] rename failed`,{err:n,docName:e,newDocName:i,normalized:t}),F(T({id:`HIb0vl`})),L(!1),V.current=!1,U.current=t,B.current?.focus()}},ve=typeof window<`u`&&window.okDesktop!=null,ye;e[26]===h?ye=e[27]:(ye=new Set(h),e[26]=h,e[27]=ye);let be=ye,xe;e[28]===O?xe=e[29]:(xe=jP(O),e[28]=O,e[29]=xe);let Se;e[30]===xe?Se=e[31]:(Se=[xe],e[30]=xe,e[31]=Se);let Ce=Se,we;e[32]!==c||e[33]!==u||e[34]!==be?(we=function(e){let t=[],n=[];for(let r of e)be.has(r)?n.push(r):t.push(r);t.length>0&&u(t);for(let e of n)c(e)},e[32]=c,e[33]=u,e[34]=be,e[35]=we):we=e[35];let Te=we,De,Oe;e[36]!==o||e[37]!==a||e[38]!==r||e[39]!==ne||e[40]!==m||e[41]!==h||e[42]!==g||e[43]!==b||e[44]!==w?(De=()=>{let e=new Set(h),t=function(){G.current!==null&&(window.clearTimeout(G.current),G.current=null)},n=function(e){K.current!==e&&(K.current=e)},i=function(e){ee.current!==e&&(ee.current=e,z(e))},s=function(){n(!0),!(ee.current||G.current!==null)&&(G.current=window.setTimeout(()=>{G.current=null,K.current&&i(!0)},UP))},c=function(){t(),n(!1),i(!1)},l=function(t){e.has(t)?o(t):a(t)},u=function(e){if(w.length===0)return;let t=m?r:ne,n=t?w.indexOf(t):-1;l(w[((n>=0?n:0)+e+w.length)%w.length])},d=function(e){if(HP(e)&&s(),jl(e,`tab-new`)){e.preventDefault(),g();return}if(jl(e,`tab-reopen-closed`)){e.preventDefault(),b();return}if(jl(e,`tab-next`)){e.preventDefault(),u(1);return}if(jl(e,`tab-previous`)){e.preventDefault(),u(-1);return}let t=qP(e,w.length);t!==null&&(e.preventDefault(),l(w[t]))},f=function(e){!e.metaKey&&!e.ctrlKey&&c()};return window.addEventListener(`keydown`,d,{capture:!0}),window.addEventListener(`keyup`,f,{capture:!0}),window.addEventListener(`blur`,c),document.addEventListener(`visibilitychange`,c),()=>{window.removeEventListener(`keydown`,d,{capture:!0}),window.removeEventListener(`keyup`,f,{capture:!0}),window.removeEventListener(`blur`,c),document.removeEventListener(`visibilitychange`,c)}},Oe=[r,ne,o,a,m,h,g,b,w],e[36]=o,e[37]=a,e[38]=r,e[39]=ne,e[40]=m,e[41]=h,e[42]=g,e[43]=b,e[44]=w,e[45]=De,e[46]=Oe):(De=e[45],Oe=e[46]),(0,Q.useEffect)(De,Oe);let ke;e[47]===Symbol.for(`react.memo_cache_sentinel`)?(ke={activationConstraint:{distance:8}},e[47]=ke):ke=e[47];let Ae;e[48]===Symbol.for(`react.memo_cache_sentinel`)?(Ae={coordinateGetter:Ko,keyboardCodes:CP},e[48]=Ae):Ae=e[48];let je=$o(Bo(Wo,ke),Bo(qo,Ae)),Me=R,Ne;e[49]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=function(){k(AP(D.current,`[data-editor-tab-sortable]`))},e[49]=Ne):Ne=e[49];let Pe=Ne,Fe;e[50]===Symbol.for(`react.memo_cache_sentinel`)?(Fe=function(){k(null)},e[50]=Fe):Fe=e[50];let Ie=Fe,Le;e[51]!==Ie||e[52]!==S||e[53]!==w?(Le=function(e){Ie();let t=String(e.active.id),n=e.over?String(e.over.id):null;if(!n||t===n)return;let r=w.indexOf(t),i=w.indexOf(n);r<0||i<0||r===i||S(Xo([...w],r,i),t)},e[51]=Ie,e[52]=S,e[53]=w,e[54]=Le):Le=e[54];let Re=Le,ze=ve?``:void 0,Ve;e[55]===Symbol.for(`react.memo_cache_sentinel`)?(Ve=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]`,ve&&`[-webkit-app-region:drag]`),e[55]=Ve):Ve=e[55];let He=BP,Ue;e[56]===Symbol.for(`react.memo_cache_sentinel`)?(Ue=X(`flex items-end gap-1`,ve&&`[-webkit-app-region:no-drag]`),e[56]=Ue):Ue=e[56];let We=Ho,Ge=MP,Ke;e[57]===Symbol.for(`react.memo_cache_sentinel`)?(Ke={container:typeof document<`u`?document.body:void 0},e[57]=Ke):Ke=e[57];let qe=Jo,Je;e[58]===w?Je=e[59]:(Je=[...w],e[58]=w,e[59]=Je);let Xe=Vo,Ze=w.map((e,t)=>{let n=R?GP(t,w.length):null,i=KP(t,w.length);if(be.has(e)){let t=e===r;return(0,Z.jsx)(XP,{tabId:e,canPin:!1,openTabs:w,closeTab:c,closeTabs:Te,pinTab:v,pinnedTabIds:y,unpinTab:C,children:(0,Z.jsxs)(YP,{tabId:e,activateFromKeyboard:()=>o(e),"aria-current":t?`page`:void 0,"aria-keyshortcuts":i,"data-active-tab":t?`true`:void 0,className:X(PP,t?FP:IP),onAuxClick:t=>{t.button===1&&(t.preventDefault(),c(e))},onClick:t=>{t.target===t.currentTarget&&o(e)},children:[(0,Z.jsx)(`button`,{type:`button`,"aria-label":T({id:`zLak8b`}),"data-testid":`editor-new-tab-placeholder-button`,className:LP,onClick:()=>o(e),tabIndex:-1,children:(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:(0,Z.jsx)(J,{id:`3YvS-c`})})}),n?(0,Z.jsx)(JP,{value:n}):(0,Z.jsx)(`button`,{type:`button`,"aria-label":T({id:`xCdTnb`}),"data-testid":`editor-new-tab-placeholder-close`,className:wP(Me||t),tabIndex:TP(t),onClick:t=>{t.stopPropagation(),c(e)},children:(0,Z.jsx)(gs,{"aria-hidden":`true`,className:`size-3.5`})})]})},e)}let s=Be(e),u=e===ne,d=y.includes(e);if(s.kind===`folder`){let{baseName:t,label:r,prefix:o}=ut(s.folderPath,`/`),c=`${o}${r}`;return(0,Z.jsx)(XP,{tabId:e,openTabs:w,closeTab:l,closeTabs:Te,pinTab:v,pinnedTabIds:y,unpinTab:C,children:(0,Z.jsxs)(YP,{tabId:e,activateFromKeyboard:()=>a(e),"aria-current":u?`page`:void 0,"aria-keyshortcuts":i,"data-active-tab":u?`true`:void 0,className:X(PP,u?FP:IP),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!d&&l(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":c,title:c,className:LP,onClick:()=>{a(e)},tabIndex:-1,children:[o&&(0,Z.jsx)(`span`,{className:X(`min-w-0 flex-1 truncate`,u&&`text-muted-foreground`),children:o}),(0,Z.jsxs)(`span`,{className:X(`flex min-w-0 items-center`,o?`max-w-[70%] shrink-0`:`flex-1`),children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:t}),(0,Z.jsx)(`span`,{className:`shrink-0`,children:`/`})]})]}),(0,Z.jsx)(ZP,{accessibleLabel:c,closeTab:l,forceCloseVisible:Me,isActive:u,isPinned:d,shortcutHint:n,tabId:e,unpinTab:C})]})},e)}if(s.kind===`asset`||s.kind===`skill-file`){let{baseName:t,label:r,prefix:o}=ut(s.kind===`asset`?s.assetPath:s.path,``),c=`${o}${r}`;return(0,Z.jsx)(XP,{tabId:e,openTabs:w,closeTab:l,closeTabs:Te,pinTab:v,pinnedTabIds:y,unpinTab:C,children:(0,Z.jsxs)(YP,{tabId:e,activateFromKeyboard:()=>a(e),"aria-current":u?`page`:void 0,"aria-keyshortcuts":i,"data-active-tab":u?`true`:void 0,className:X(PP,u?FP:IP),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!d&&l(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":c,className:LP,onClick:()=>{a(e)},tabIndex:-1,children:[o?(0,Z.jsx)(`span`,{className:X(`min-w-0 flex-1 truncate text-muted-foreground/60`,u&&`text-muted-foreground`),children:o}):null,(0,Z.jsx)(`span`,{className:X(`min-w-0 truncate`,o?`max-w-[70%] shrink-0`:`flex-1`),children:t})]}),(0,Z.jsx)(ZP,{accessibleLabel:c,closeTab:l,forceCloseVisible:Me,isActive:u,isPinned:d,shortcutHint:n,tabId:e,unpinTab:C})]})},e)}let f=s.docName,p=E.get(f)?.docExt??`.md`,{baseName:m,extension:h,label:g,prefix:_}=ut(f,p),b=`${_}${g}`,x=p===`.md`||p===`.mdx`,S=A?.tabId===e,D=`editor-tab-rename-error-${RP(f)}`;return(0,Z.jsx)(XP,{disabled:S,tabId:e,openTabs:w,closeTab:l,closeTabs:Te,pinTab:v,pinnedTabIds:y,unpinTab:C,children:(0,Z.jsx)(YP,{tabId:e,activateFromKeyboard:()=>a(e),disabled:S,"aria-current":u?`page`:void 0,"aria-keyshortcuts":i,"data-active-tab":u?`true`:void 0,className:X(PP,u?FP:IP,S&&P&&`border-destructive`),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!d&&l(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:S?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(ZC,{className:`h-full min-w-0 flex-1 rounded-none border-0 bg-transparent dark:bg-transparent`,children:[(0,Z.jsx)(nw,{ref:B,value:M,disabled:I,"aria-label":T({id:`Dw1T_W`,values:{label:g}}),"data-testid":`editor-tab-rename-input`,"aria-invalid":P?!0:void 0,"aria-describedby":P?D:void 0,"aria-busy":I||void 0,title:P??f,className:`h-full min-w-0 px-2 py-0 font-medium text-foreground text-xs selection:bg-primary selection:text-primary-foreground`,onChange:e=>{N(VP(e.target.value,p)),F(null),U.current=null},onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),_e()):e.key===`Escape`&&(e.preventDefault(),ge())},onBlur:_e}),(0,Z.jsx)($C,{align:`inline-end`,"aria-hidden":`true`,className:`pr-2 text-xs`,children:(0,Z.jsx)(tw,{className:`text-muted-foreground/60 text-xs`,children:p})})]}),P?(0,Z.jsx)(`span`,{id:D,role:`alert`,className:`sr-only`,children:P}):null]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($P,{accessibleLabel:b,activateTab:a,baseName:m,docName:f,enterRenameMode:he,extension:h,hideDocExtension:x,tabId:e}),(0,Z.jsx)(ZP,{accessibleLabel:b,closeTab:l,forceCloseVisible:Me,isActive:u,isPinned:d,shortcutHint:n,tabId:e,unpinTab:C})]})})},e)}),Qe;e[60]!==qe||e[61]!==Je||e[62]!==Xe||e[63]!==Ze?(Qe=(0,Z.jsx)(qe,{items:Je,strategy:Xe,children:Ze}),e[60]=qe,e[61]=Je,e[62]=Xe,e[63]=Ze,e[64]=Qe):Qe=e[64];let $e;e[65]!==We||e[66]!==Ie||e[67]!==Re||e[68]!==Pe||e[69]!==je||e[70]!==!1||e[71]!==Ge||e[72]!==Ke||e[73]!==Qe||e[74]!==Ce?($e=(0,Z.jsx)(We,{sensors:je,autoScroll:!1,collisionDetection:Ge,modifiers:Ce,onDragStart:Pe,onDragEnd:Re,onDragCancel:Ie,accessibility:Ke,children:Qe}),e[65]=We,e[66]=Ie,e[67]=Re,e[68]=Pe,e[69]=je,e[70]=!1,e[71]=Ge,e[72]=Ke,e[73]=Qe,e[74]=Ce,e[75]=$e):$e=e[75];let tt;e[76]===T?tt=e[77]:(tt=T({id:`3YvS-c`}),e[76]=T,e[77]=tt);let rt;e[78]===Symbol.for(`react.memo_cache_sentinel`)?(rt=(0,Z.jsx)(nt,{"aria-hidden":`true`}),e[78]=rt):rt=e[78];let it;e[79]!==g||e[80]!==tt?(it=(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(Jr,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":tt,"data-testid":`editor-new-tab-button`,className:`first:mb-3 mb-1.5`,onClick:g,children:rt})}),e[79]=g,e[80]=tt,e[81]=it):it=e[81];let at;e[82]===Symbol.for(`react.memo_cache_sentinel`)?(at=(0,Z.jsx)(Es,{children:(0,Z.jsx)(J,{id:`3YvS-c`})}),e[82]=at):at=e[82];let ot;e[83]===it?ot=e[84]:(ot=(0,Z.jsxs)(Os,{children:[it,at]}),e[83]=it,e[84]=ot);let st;e[85]!==Ue||e[86]!==$e||e[87]!==ot?(st=(0,Z.jsxs)(`div`,{className:Ue,children:[$e,ot]}),e[85]=Ue,e[86]=$e,e[87]=ot,e[88]=st):st=e[88];let ct;return e[89]!==ze||e[90]!==Ve||e[91]!==He||e[92]!==st?(ct=(0,Z.jsx)(`div`,{ref:D,"data-electron-drag":ze,className:Ve,onWheel:He,children:st}),e[89]=ze,e[90]=Ve,e[91]=He,e[92]=st,e[93]=ct):ct=e[93],ct}var tF=(e,t,n)=>{if(e&&`reportValidity`in e){let r=Va(n,t);e.setCustomValidity(r&&r.message||``),e.reportValidity()}},nF=(e,t)=>{for(let n in t.fields){let r=t.fields[n];r&&r.ref&&`reportValidity`in r.ref?tF(r.ref,n,e):r&&r.refs&&r.refs.forEach(t=>tF(t,n,e))}},rF=(e,t)=>{t.shouldUseNativeValidation&&nF(e,t);let n={};for(let r in e){let i=Va(t.fields,r),a=Object.assign(e[r]||{},{ref:i&&i.ref});if(iF(t.names||Object.keys(e),r)){let e=Object.assign({},Va(n,r));so(e,`root`,a),so(n,r,e)}else so(n,r,a)}return n},iF=(e,t)=>{let n=aF(t).replace(/[.*+?^${}()|\\]/g,`\\$&`);return e.some(e=>aF(e).match(`^${n}\\.\\d+`))};function aF(e){return e.replace(/[\[\]]/g,``)}function oF(){return oF=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},oF.apply(null,arguments)}function sF(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}function cF(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]=Na(o,t,n,i,l?[].concat(l,r.message):r.message)}e.shift()}return n}function lF(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(oF({},t,{path:[].concat(r.path,t.path)}))})}),t){var c=n[o].types,l=c&&c[r.code];n[o]=Na(o,t,n,i,l?[].concat(l,r.message):r.message)}e.shift()};e.length;)r();return n}function uF(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(sF(function(){return Promise.resolve(e[n.mode===`sync`?`parse`:`parseAsync`](r,t)).then(function(e){return a.shouldUseNativeValidation&&nF({},a),{errors:{},values:n.raw?Object.assign({},r):e}})},function(e){if(function(e){return Array.isArray(e?.issues)}(e))return{values:{},errors:rF(cF(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(sF(function(){return Promise.resolve((n.mode===`sync`?Kn:Jn)(e,r,t)).then(function(e){return a.shouldUseNativeValidation&&nF({},a),{errors:{},values:n.raw?Object.assign({},r):e}})},function(e){if(function(e){return e instanceof Fn}(e))return{values:{},errors:rF(lF(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 dF=`https://openknowledge.ai/api/subscribe`;async function fF(e,t){try{let n=await fetch(dF,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({email:e,source:t}),signal:AbortSignal.timeout(15e3)});return n.ok?{ok:!0}:n.status===400?{ok:!1,reason:`invalid`}:n.status===503?{ok:!1,reason:`unavailable`}:(console.warn(`[subscribe] action=submit result=http-error status=${n.status}`),{ok:!1,reason:`error`})}catch(e){return console.warn(`[subscribe] action=submit result=network-error message=${e instanceof Error?e.message:String(e)}`),{ok:!1,reason:`error`}}}function pF(e){let t=(0,$.c)(49),{source:n,title:r,description:i,onSuccess:a,onDismiss:o,autoFocus:s,compactSubmit:c,className:l}=e,{_:u}=kt(),[d,f]=(0,Q.useState)(!1),p=(0,Q.useRef)(null),m,h;t[0]===d?(m=t[1],h=t[2]):(m=()=>{d&&p.current?.focus()},h=[d],t[0]=d,t[1]=m,t[2]=h),(0,Q.useEffect)(m,h);let g,_;if(t[3]!==u){let e=Tn({email:En({message:u({id:`Wq6Wcm`})})});_=ja,g=uF(e),t[3]=u,t[4]=g,t[5]=_}else g=t[4],_=t[5];let v;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(v={email:``},t[6]=v):v=t[6];let y;t[7]===g?y=t[8]:(y={resolver:g,defaultValues:v},t[7]=g,t[8]=y);let b=_(y),{isSubmitting:x}=b.formState,S=b.formState.errors.email?.message??b.formState.errors.root?.message,C;t[9]!==u||t[10]!==b||t[11]!==a||t[12]!==n?(C=async function(e){b.clearErrors(`root`);let t=await fF(e.email,n);if(t.ok){f(!0),a?.();return}if(t.reason===`invalid`){b.setError(`email`,{message:u({id:`Wq6Wcm`})});return}if(t.reason===`unavailable`){b.setError(`root`,{message:u({id:`4mLBx9`})});return}b.setError(`root`,{message:u({id:`fWsBTs`})})},t[9]=u,t[10]=b,t[11]=a,t[12]=n,t[13]=C):C=t[13];let w=C,T;t[14]===l?T=t[15]:(T=X(`flex flex-col gap-3`,l),t[14]=l,t[15]=T);let E=d?-1:void 0,D;t[16]!==d||t[17]!==r?(D=d?(0,Z.jsxs)(`span`,{className:`mb-1.5 inline-flex flex-row items-center gap-2`,children:[(0,Z.jsx)($i,{className:`size-4 text-primary`}),(0,Z.jsx)(J,{id:`PIMM5l`})]}):r??(0,Z.jsx)(J,{id:`GzPQ2f`}),t[16]=d,t[17]=r,t[18]=D):D=t[18];let O;t[19]!==D||t[20]!==E?(O=(0,Z.jsx)(`p`,{ref:p,tabIndex:E,className:`text-sm font-medium leading-tight text-foreground focus:outline-none`,children:D}),t[19]=D,t[20]=E,t[21]=O):O=t[21];let k;t[22]!==i||t[23]!==d?(k=d?(0,Z.jsx)(J,{id:`pBROkv`}):i??(0,Z.jsx)(J,{id:`WmPbvm`}),t[22]=i,t[23]=d,t[24]=k):k=t[24];let A;t[25]===k?A=t[26]:(A=(0,Z.jsx)(`p`,{className:`text-1sm text-muted-foreground`,role:`status`,children:k}),t[25]=k,t[26]=A);let j;t[27]!==O||t[28]!==A?(j=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[O,A]}),t[27]=O,t[28]=A,t[29]=j):j=t[29];let M;t[30]!==u||t[31]!==o?(M=o?(0,Z.jsx)(Jr,{type:`button`,variant:`ghost`,size:`icon`,onClick:o,"aria-label":u({id:`yz7wBu`}),className:`-mr-1.5 -mt-1 size-7 shrink-0 text-muted-foreground opacity-60`,children:(0,Z.jsx)(gs,{className:`size-4`})}):null,t[30]=u,t[31]=o,t[32]=M):M=t[32];let N;t[33]!==j||t[34]!==M?(N=(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[j,M]}),t[33]=j,t[34]=M,t[35]=N):N=t[35];let P;t[36]!==u||t[37]!==s||t[38]!==c||t[39]!==S||t[40]!==b||t[41]!==x||t[42]!==w||t[43]!==d?(P=d?null:(0,Z.jsxs)(`form`,{onSubmit:b.handleSubmit(w),className:`flex flex-col gap-2`,noValidate:!0,children:[(0,Z.jsx)(Ga,{control:b.control,name:`email`,render:e=>{let{field:t,fieldState:n}=e;return(0,Z.jsxs)(ZC,{className:`h-10 rounded-xl`,children:[(0,Z.jsx)($C,{className:`pl-2.5`,children:(0,Z.jsx)(cf,{className:`size-4 text-muted-foreground opacity-60`})}),(0,Z.jsx)(nw,{...t,id:t.name,type:`email`,inputMode:`email`,autoComplete:`email`,spellCheck:!1,autoFocus:s,placeholder:u({id:`2hYmUH`}),"aria-invalid":n.invalid,"aria-label":u({id:`ATGYL1`}),"data-testid":`subscribe-email`,className:`placeholder:text-muted-foreground/60`}),(0,Z.jsx)(Jr,{type:`submit`,disabled:x,size:c?`icon`:`default`,className:X(`mr-1 ml-auto text-1sm`,c&&`size-8 shrink-0 rounded-lg`),"data-testid":`subscribe-submit`,children:x?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ns,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`lCC_D5`})})]}):c?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(vi,{className:`size-4`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`EDl9kS`})})]}):(0,Z.jsx)(J,{id:`EDl9kS`})})]})}}),S?(0,Z.jsx)(`p`,{className:`text-sm text-destructive`,role:`alert`,children:S}):null]}),t[36]=u,t[37]=s,t[38]=c,t[39]=S,t[40]=b,t[41]=x,t[42]=w,t[43]=d,t[44]=P):P=t[44];let F;return t[45]!==N||t[46]!==P||t[47]!==T?(F=(0,Z.jsxs)(`div`,{className:T,children:[N,P]}),t[45]=N,t[46]=P,t[47]=T,t[48]=F):F=t[48],F}var mF=`https://github.com/inkeep/open-knowledge`,hF=`https://discord.com/invite/YujKpFN49`,gF=`https://x.com/OpenKnowledge`,_F=`ok-subscribe-card-v1`,vF={subscribed:!1,dismissed:!1,shownVersions:[]};function yF(e,t){return!e.subscribed&&!e.dismissed&&e.shownVersions.length<3&&!e.shownVersions.includes(t)}function bF(e){return e===!0}function xF(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function SF(e){if(typeof e!=`object`||!e)return vF;let t=e;return{subscribed:bF(t.subscribed),dismissed:bF(t.dismissed),shownVersions:xF(t.shownVersions)}}function CF(e){try{let t=(e??localStorage).getItem(_F);return t==null?vF:SF(JSON.parse(t))}catch(e){return console.warn(`[subscribe-card-store] readPersistedState failed (corrupt/privacy/SSR)`,e),vF}}function wF(e,t){try{(t??localStorage).setItem(_F,JSON.stringify(e))}catch(e){console.warn(`[subscribe-card-store] writePersistedState failed (quota/privacy/SSR)`,e)}}function TF(e){let t=CF(e),n=new Set,r=!1;function i(){for(let e of n)e()}function a(n){t=n,wF(t,e),i()}return{getSnapshot(){return t},subscribe(e){return n.add(e),()=>{n.delete(e)}},markSubscribed(){t.subscribed||a({...t,subscribed:!0})},dismiss(){t.dismissed||a({...t,dismissed:!0})},recordShown(e){t.shownVersions.includes(e)||a({...t,shownVersions:[...t.shownVersions,e]})},install(){r||(r=!0,t=CF(e),i())}}}var EF=TF();function DF(){EF.install()}function OF(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 kF(e){let t=(0,$.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`GitHub`}),r=(0,Z.jsx)(`path`,{d:`M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12`}),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 AF(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 jF=[{key:`resources`,heading:{id:`s-MGs7`},links:[{label:{id:`TbjyhA`},href:`https://openknowledge.ai/docs`,icon:F},{label:{id:`PCNIuJ`},href:`${mF}/issues/new`,icon:Md},{label:{id:`On0aF2`},href:`https://openknowledge.ai/`,icon:ra}]},{key:`community`,heading:{id:`chL5IG`},links:[{label:`Discord`,href:hF,icon:OF},{label:`X (Twitter)`,href:gF,icon:AF},{label:`GitHub`,href:mF,icon:kF}]}],MF=`${mF}/releases`,NF=`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 PF(e){if(e<1e3)return String(e);let t=e/1e3;return`${t>=10?Math.round(t):t.toFixed(1)}k`}var FF=e=>{let t=(0,$.c)(12),{count:n}=e,{_:r}=kt(),i,a,o,s;t[0]!==r||t[1]!==n?(i=PF(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)(Pf,{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},IF=e=>{let t=(0,$.c)(15),{link:n,trailing:r}=e,{_:i}=kt(),{label:a,href:o,icon:s}=n,c,l;t[0]===o?(c=t[1],l=t[2]):(c=e=>hu(e,o),l=e=>hu(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:NF,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},LF=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},RF=()=>{let e=(0,$.c)(28),{_:t}=kt(),[n,r]=(0,Q.useState)(!1),[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(null),c,u;e[0]!==n||e[1]!==o?(c=()=>{if(!n||o!==null)return;let e=new AbortController;return Vr({signal:e.signal}).then(e=>{e!==null&&s(e)}),()=>e.abort()},u=[n,o],e[0]=n,e[1]=o,e[2]=c,e[3]=u):(c=e[2],u=e[3]),(0,Q.useEffect)(c,u);let d;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(d=e=>{r(e),e||a(!1)},e[4]=d):d=e[4];let f;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(l,{className:`size-4`}),e[5]=f):f=e[5];let p;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(se,{asChild:!0,children:(0,Z.jsxs)(Jr,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,children:[f,(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`s-MGs7`})})]})})}),e[6]=p):p=e[6];let m;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsxs)(Os,{children:[p,(0,Z.jsx)(Es,{children:(0,Z.jsx)(J,{id:`s-MGs7`})})]}),e[7]=m):m=e[7];let h;e[8]!==t||e[9]!==o?(h=jF.map((e,n)=>(0,Z.jsxs)(`div`,{className:X(n>0&&`mt-3`),children:[(0,Z.jsx)(LF,{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)(IF,{link:e,trailing:e.href===`https://github.com/inkeep/open-knowledge`&&o!==null?(0,Z.jsx)(FF,{count:o}):void 0},e.href))})})]},e.key)),e[8]=t,e[9]=o,e[10]=h):h=e[10];let g;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(LF,{children:(0,Z.jsx)(J,{id:`arUUsK`})}),e[11]=g):g=e[11];let _;e[12]===t?_=e[13]:(_=t({id:`arUUsK`}),e[12]=t,e[13]=_);let v;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(IF,{link:{label:{id:`3ePd3I`},href:MF,icon:lf}}),e[14]=v):v=e[14];let y;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(se,{asChild:!0,children:(0,Z.jsxs)(Jr,{variant:`ghost`,className:X(NF,`h-auto w-full justify-start font-normal`),children:[(0,Z.jsx)(cf,{"aria-hidden":`true`,className:`size-4 shrink-0`}),(0,Z.jsx)(J,{id:`EDl9kS`})]})}),e[15]=y):y=e[15];let b;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(ie,{side:`left`,align:`center`,sideOffset:20,className:`w-80`,children:(0,Z.jsx)(pF,{source:`resources_menu`,autoFocus:!0,onDismiss:()=>a(!1),onSuccess:zF})}),e[16]=b):b=e[16];let x;e[17]===i?x=e[18]:(x=(0,Z.jsxs)(`ul`,{className:`space-y-0.5`,children:[v,(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(ae,{open:i,onOpenChange:a,children:[y,b]})})]}),e[17]=i,e[18]=x);let S;e[19]!==x||e[20]!==_?(S=(0,Z.jsxs)(`div`,{className:`mt-3`,children:[g,(0,Z.jsx)(`nav`,{"aria-label":_,children:x})]}),e[19]=x,e[20]=_,e[21]=S):S=e[21];let C;e[22]!==S||e[23]!==h?(C=(0,Z.jsxs)(ie,{align:`end`,className:`w-56 p-3`,children:[h,S]}),e[22]=S,e[23]=h,e[24]=C):C=e[24];let w;return e[25]!==n||e[26]!==C?(w=(0,Z.jsxs)(ae,{open:n,onOpenChange:d,children:[m,C]}),e[25]=n,e[26]=C,e[27]=w):w=e[27],w};function zF(){return EF.markSubscribed()}var BF=50,VF=()=>{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,IC.preload()},BF))},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=Ya)},l=(0,Z.jsx)(Ef,{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)(Ts,{asChild:!0,children:(0,Z.jsxs)(Jr,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,"data-testid":`header-settings-button`,onMouseEnter:r,onMouseLeave:a,onFocus:r,onBlur:a,onClick:c,children:[l,(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`Tz0i8g`})})]})}),e[6]=u):u=e[6];let d;return e[7]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsxs)(Os,{children:[u,(0,Z.jsx)(Es,{children:(0,Z.jsx)(J,{id:`Tz0i8g`})})]}),e[7]=d):d=e[7],d},HF=`https://openknowledge.ai/docs/features/share`;function UF(e){let t=(0,$.c)(50),{input:n,onClickWhenNoRemote:r}=e,{_:i}=kt(),{status:a}=zi(),[o,s]=(0,Q.useState)(!1),[c,u]=(0,Q.useState)(null),d=(0,Q.useRef)(null),f;t[0]===c?.autoCopyFailed?f=t[1]:(f=()=>{!c?.autoCopyFailed||!d.current||(d.current.focus(),d.current.select())},t[0]=c?.autoCopyFailed,t[1]=f);let p;t[2]===c?p=t[3]:(p=[c],t[2]=c,t[3]=p),(0,Q.useEffect)(f,p);let m=a?.hasRemote===!0,h=n===null,g=ni(c?.freshness,a),_;t[4]!==i||t[5]!==o||t[6]!==m||t[7]!==n||t[8]!==r?(_=async function(){if(!o&&n!==null){s(!0),u(null);try{let e=await La({...n,hasRemote:m,onClickWhenNoRemote:r},{clipboardWrite:Sa,toastSuccess:ZF,toastError:XF,logEvent:YF});e.kind===`copied`?u({url:e.shareUrl,autoCopyFailed:!1,freshness:e.freshness}):e.kind===`clipboard-failed`&&u({url:e.shareUrl,autoCopyFailed:!0,freshness:e.freshness})}catch{hs.error(i({id:`u3YnKw`}))}s(!1)}},t[4]=i,t[5]=o,t[6]=m,t[7]=n,t[8]=r,t[9]=_):_=t[9];let v=_,y=c!==null,b;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(b=e=>{e||u(null)},t[10]=b):b=t[10];let x;t[11]!==i||t[12]!==n?.kind?(x=n?.kind===`folder`?i({id:`WR0y2O`}):i({id:`F4IYWe`}),t[11]=i,t[12]=n?.kind,t[13]=x):x=t[13];let S=o||h,C,T;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(Df,{className:`size-3.5`,"aria-hidden":!0}),T=(0,Z.jsx)(J,{id:`Z8lGw6`}),t[14]=C,t[15]=T):(C=t[14],T=t[15]);let E;t[16]!==v||t[17]!==x||t[18]!==S?(E=(0,Z.jsx)(w,{asChild:!0,children:(0,Z.jsxs)(Jr,{variant:`ghost`,size:`sm`,"aria-label":x,onClick:v,disabled:S,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`share-button`,children:[C,T]})}),t[16]=v,t[17]=x,t[18]=S,t[19]=E):E=t[19];let D=g?`w-96`:`w-80`,O;t[20]===D?O=t[21]:(O=X(`flex flex-col gap-2`,D),t[20]=D,t[21]=O);let k;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Z.jsx)(`p`,{className:`font-mono tracking-wide uppercase text-muted-foreground text-xs`,children:(0,Z.jsx)(J,{id:`Z8lGw6`})}),t[22]=k):k=t[22];let A;t[23]===c?.autoCopyFailed?A=t[24]:(A=c?.autoCopyFailed?(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(J,{id:`ndeI89`})}):null,t[23]=c?.autoCopyFailed,t[24]=A);let j=c?.url??``,M;t[25]===i?M=t[26]:(M=i({id:`5-FeN2`}),t[25]=i,t[26]=M);let N;t[27]!==j||t[28]!==M?(N=(0,Z.jsx)(Uc,{ref:d,readOnly:!0,value:j,onFocus:JF,onClick:qF,onContextMenu:KF,className:`select-all bg-muted font-mono text-xs text-muted-foreground`,"data-testid":`share-button-url`,"aria-label":M}),t[27]=j,t[28]=M,t[29]=N):N=t[29];let P=c?.url??``,F=c?.autoCopyFailed===!1,I;t[30]!==P||t[31]!==F?(I=(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)(L,{copyContent:P,clipboardWrite:Sa,initialCopied:F})})}),t[30]=P,t[31]=F,t[32]=I):I=t[32];let R;t[33]!==N||t[34]!==I?(R=(0,Z.jsxs)(`div`,{className:`relative`,children:[N,I]}),t[33]=N,t[34]=I,t[35]=R):R=t[35];let z=c?.freshness,B=n?.kind??`doc`,V;t[36]!==a||t[37]!==z||t[38]!==B?(V=(0,Z.jsx)(ei,{freshness:z,status:a,kind:B}),t[36]=a,t[37]=z,t[38]=B,t[39]=V):V=t[39];let H;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Z.jsxs)(`a`,{href:HF,target:`_blank`,rel:`noopener noreferrer`,onClick:GF,onAuxClick:WF,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)(l,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(J,{id:`aByJ8j`})]}),t[40]=H):H=t[40];let U;t[41]!==O||t[42]!==A||t[43]!==R||t[44]!==V?(U=(0,Z.jsxs)(ie,{align:`end`,className:O,"data-testid":`share-button-popover`,children:[k,A,R,V,H]}),t[41]=O,t[42]=A,t[43]=R,t[44]=V,t[45]=U):U=t[45];let W;return t[46]!==E||t[47]!==U||t[48]!==y?(W=(0,Z.jsxs)(ae,{open:y,onOpenChange:b,children:[E,U]}),t[46]=E,t[47]=U,t[48]=y,t[49]=W):W=t[49],W}function WF(e){return hu(e,HF)}function GF(e){return hu(e,HF)}function KF(e){return e.currentTarget.select()}function qF(e){return e.currentTarget.select()}function JF(e){return e.currentTarget.select()}function YF(e){return console.log(e)}function XF(e){e!==`Link ready but could not copy to clipboard.`&&hs.error(e)}function ZF(e){return hs.success(e)}function QF(e){let t=(0,$.c)(35),{onSignIn:n,onSetIdentity:r,onOpenSearch:i}=e,{_:a}=kt(),{activeDocName:o,activeTarget:s}=Ye(),c=o?er(o):null,{state:l,isDraggingRail:u}=Wj(),d=_g(),f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f=Al(`toggle-files-sidebar`),t[0]=f):f=t[0];let p=f,m=Al(`command-palette`),[h,g]=(0,Q.useState)(!1),_;bb0:{if(s?.kind===`folder`){let e;t[1]===s.folderPath?e=t[2]:(e=Pa(s.folderPath),t[1]=s.folderPath,t[2]=e),_=e;break bb0}if(o&&!c){let e;t[3]===o?e=t[4]:(e=Ha(o),t[3]=o,t[4]=e),_=e;break bb0}if(!s&&!o){let e;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=Pa(``),t[5]=e):e=t[5],_=e;break bb0}_=null}let v=_,y=typeof window<`u`&&window.okDesktop!=null,b=l===`collapsed`,x=y?``:void 0,S=y&&b&&`pl-[var(--ok-titlebar-reserve-left,1rem)]`,C=y&&!u&&`motion-safe:transition-[padding] motion-safe:duration-200 motion-safe:ease-linear`,w;t[6]!==S||t[7]!==C?(w=X(`flex h-12 shrink-0 items-center bg-muted/35 shadow-[inset_0_-1px_0_var(--border)]`,y&&`[-webkit-app-region:drag]`,S,C),t[6]=S,t[7]=C,t[8]=w):w=t[8];let T=!d&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Os,{children:[(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(Yj,{className:X(`-ml-1 shrink-0 text-muted-foreground`,y&&`[-webkit-app-region:no-drag]`)})}),(0,Z.jsx)(Es,{children:l===`expanded`?(0,Z.jsx)(J,{id:`ZxXhLY`,values:{sidebarShortcut:p}}):(0,Z.jsx)(J,{id:`Zz25kq`,values:{sidebarShortcut:p}})})]}),b&&i&&(0,Z.jsxs)(Os,{children:[(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(Jr,{variant:`ghost`,size:`icon-sm`,onClick:i,"aria-label":a({id:`IN4UX8`,values:{searchShortcut:m}}),"data-telemetry-event":`ok.editor_header.search.click`,className:X(`shrink-0 text-muted-foreground`,y&&`[-webkit-app-region:no-drag]`),children:(0,Z.jsx)(Te,{"aria-hidden":`true`})})}),(0,Z.jsx)(Es,{children:(0,Z.jsx)(J,{id:`IN4UX8`,values:{searchShortcut:m}})})]}),(0,Z.jsx)(eo,{orientation:`vertical`,className:`mr-1 h-4 shrink-0 data-vertical:self-center`}),(0,Z.jsx)(eF,{})]}),E;t[9]===T?E=t[10]:(E=(0,Z.jsx)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1 px-3`,children:T}),t[9]=T,t[10]=E);let D;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(D=X(`flex shrink-0 items-center justify-end gap-2 px-3`,y&&`[&>*]:[-webkit-app-region:no-drag]`),t[11]=D):D=t[11];let O;t[12]!==h||t[13]!==g||t[14]!==v||t[15]!==d?(O=!d&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(UF,{input:v,onClickWhenNoRemote:()=>g(!0)}),(0,Z.jsx)(wo,{open:h,onOpenChange:g})]}),t[12]=h,t[13]=g,t[14]=v,t[15]=d,t[16]=O):O=t[16];let k;t[17]!==r||t[18]!==n?(k=(0,Z.jsx)(to,{onSignIn:n,onSetIdentity:r}),t[17]=r,t[18]=n,t[19]=k):k=t[19];let A,j,M;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(GN,{}),j=(0,Z.jsx)(eo,{orientation:`vertical`,className:`h-4 shrink-0 data-vertical:self-center`}),M=(0,Z.jsx)(JN,{}),t[20]=A,t[21]=j,t[22]=M):(A=t[20],j=t[21],M=t[22]);let N;t[23]===d?N=t[24]:(N=!d&&(0,Z.jsx)(VF,{}),t[23]=d,t[24]=N);let P;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(RF,{}),t[25]=P):P=t[25];let F;t[26]!==O||t[27]!==k||t[28]!==N?(F=(0,Z.jsxs)(`div`,{className:D,children:[O,k,A,j,M,N,P]}),t[26]=O,t[27]=k,t[28]=N,t[29]=F):F=t[29];let I;return t[30]!==F||t[31]!==x||t[32]!==w||t[33]!==E?(I=(0,Z.jsxs)(`header`,{"data-electron-drag":x,className:w,children:[E,F]}),t[30]=F,t[31]=x,t[32]=w,t[33]=E,t[34]=I):I=t[34],I}var $F=`open-knowledge:terminal-launch`;function eI(e,t,n=typeof window>`u`?new EventTarget:window){n.dispatchEvent(new CustomEvent($F,{detail:{prompt:e,cli:t}}))}function tI(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($F,n),()=>t.removeEventListener($F,n)}function nI(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)(om,{"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 rI=qr(`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 iI(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(rI({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)(sm,{"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 aI(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)(cm,{"data-slot":`tabs-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function oI(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)(lm,{"data-slot":`tabs-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var sI=(0,Q.lazy)(()=>n(()=>import(`./TerminalPanel-B5-ikSnl.js`).then(e=>({default:e.TerminalPanel})),__vite__mapDeps([101,1,10,3,11,6,7,13,62,16,40,102,72,33,34,56,103]),import.meta.url));function cI(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}=Co(),f=To(),{_:p}=kt(),m=d&&u===!1,g;t[0]!==p||t[1]!==f?(g=function(){if(f===null){hs.error(p({id:`V_6bJ4`}));return}let e=f(!0);e.ok||hs.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:uI,onError:lI,children:(0,Z.jsx)(Q.Suspense,{fallback:e,children:(0,Z.jsx)(sI,{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)(pI,{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 lI(e,t){console.error(`[TerminalGate] rendered fallback for the terminal panel`,e,t.componentStack)}function uI(e){return(0,Z.jsx)(dI,{...e})}function dI(e){let t=(0,$.c)(15),{error:n}=e,{_:r}=kt(),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)(Jr,{onClick:fI,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 fI(){return window.location.reload()}function pI(e){let t=(0,$.c)(20),{onEnable:n}=e,{_:r}=kt(),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)(Jr,{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 mI(e){let t=(0,$.c)(48),{selected:n,onLaunchSelected:r,onPickCli:i,onPickTerminal:a,className:o}=e,{_:s}=kt(),c=n===`terminal`,l;t[0]!==s||t[1]!==c||t[2]!==n?(l=s(c?{id:`AB4qw9`}:{id:`nP-KFo`,values:{0:zr[n].displayName}}),t[0]=s,t[1]=c,t[2]=n,t[3]=l):l=t[3];let u=l,d;t[4]===o?d=t[5]:(d=X(`flex shrink-0 items-center`,o),t[4]=o,t[5]=d);let f;t[6]!==c||t[7]!==n?(f=c?(0,Z.jsx)(Mf,{"aria-hidden":`true`,className:`size-3.5`}):(0,Z.jsx)(ma,{id:pa(n),className:`size-3.5`,"aria-hidden":`true`}),t[6]=c,t[7]=n,t[8]=f):f=t[8];let p;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(nt,{"aria-hidden":`true`,className:`size-3`}),t[9]=p):p=t[9];let m;t[10]!==r||t[11]!==u||t[12]!==f?(m=(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsxs)(Jr,{type:`button`,variant:`ghost`,size:`xs`,"aria-label":u,"data-testid":`terminal-new-chat`,className:`cursor-pointer gap-0.5 rounded-r-none px-1.5 text-muted-foreground hover:text-foreground`,onClick:r,children:[f,p]})}),t[10]=r,t[11]=u,t[12]=f,t[13]=m):m=t[13];let h;t[14]===u?h=t[15]:(h=(0,Z.jsx)(Es,{side:`bottom`,sideOffset:8,children:u}),t[14]=u,t[15]=h);let g;t[16]!==m||t[17]!==h?(g=(0,Z.jsxs)(Os,{children:[m,h]}),t[16]=m,t[17]=h,t[18]=g):g=t[18];let _;t[19]===s?_=t[20]:(_=s({id:`QJaG-9`}),t[19]=s,t[20]=_);let v;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(ea,{"aria-hidden":`true`,className:`size-3`}),t[21]=v):v=t[21];let y;t[22]===_?y=t[23]:(y=(0,Z.jsx)(ic,{asChild:!0,children:(0,Z.jsx)(Jr,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":_,"data-testid":`terminal-new-chat-menu`,className:`cursor-pointer rounded-l-none text-muted-foreground hover:text-foreground`,children:v})}),t[22]=_,t[23]=y);let b;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(kc,{children:(0,Z.jsx)(J,{id:`hIQkLb`})}),t[24]=b):b=t[24];let x;t[25]!==s||t[26]!==i||t[27]!==n?(x=wa.map(e=>{let{displayName:t}=zr[e];return(0,Z.jsxs)(vc,{onSelect:()=>i(e),"data-testid":`terminal-new-chat-cli-${e}`,"aria-label":s({id:`9mEZeD`,values:{name:t}}),"aria-current":n===e?`true`:void 0,children:[(0,Z.jsx)(ma,{id:pa(e),className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:t}),n===e?(0,Z.jsx)($i,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e)}),t[25]=s,t[26]=i,t[27]=n,t[28]=x):x=t[28];let S;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(mc,{}),t[29]=S):S=t[29];let C=c?`true`:void 0,w;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(Mf,{"aria-hidden":`true`,className:`size-4`}),t[30]=w):w=t[30];let T;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(J,{id:`ALhMYW`})}),t[31]=T):T=t[31];let E;t[32]===c?E=t[33]:(E=c?(0,Z.jsx)($i,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null,t[32]=c,t[33]=E);let D;t[34]!==a||t[35]!==C||t[36]!==E?(D=(0,Z.jsxs)(vc,{onSelect:a,"data-testid":`terminal-new-chat-terminal`,"aria-current":C,children:[w,T,E]}),t[34]=a,t[35]=C,t[36]=E,t[37]=D):D=t[37];let O;t[38]!==x||t[39]!==D?(O=(0,Z.jsxs)(bc,{align:`start`,className:`min-w-[180px]`,children:[b,x,S,D]}),t[38]=x,t[39]=D,t[40]=O):O=t[40];let k;t[41]!==y||t[42]!==O?(k=(0,Z.jsxs)(Ec,{children:[y,O]}),t[41]=y,t[42]=O,t[43]=k):k=t[43];let A;return t[44]!==d||t[45]!==k||t[46]!==g?(A=(0,Z.jsxs)(`div`,{className:d,children:[g,k]}),t[44]=d,t[45]=k,t[46]=g,t[47]=A):A=t[47],A}var hI=`[data-terminal-tab-sortable]`;function gI(e){let t=(0,$.c)(17),{id:n,disabled:r,isActive:i,children:a}=e,o;t[0]!==r||t[1]!==n?(o={id:n,disabled:r},t[0]=r,t[1]=n,t[2]=o):o=t[2];let{setNodeRef:s,listeners:c,rect:l,transform:u,transition:d,isDragging:f}=Qo(o),p=l.current?.width,m;t[3]!==f||t[4]!==p||t[5]!==u||t[6]!==d?(m=kP({activeWidth:p,isDragging:f,transform:u,transition:d}),t[3]=f,t[4]=p,t[5]=u,t[6]=d,t[7]=m):m=t[7];let h=m,g=i?`bg-muted`:`hover:bg-muted/50`,_=f&&`z-10`,v;t[8]!==g||t[9]!==_?(v=X(`group flex shrink-0 cursor-default items-center rounded-md pr-0.5 transition-colors`,g,_),t[8]=g,t[9]=_,t[10]=v):v=t[10];let y;return t[11]!==a||t[12]!==c||t[13]!==s||t[14]!==h||t[15]!==v?(y=(0,Z.jsx)(`div`,{ref:s,"data-terminal-tab-sortable":``,style:h,className:v,...c,children:a}),t[11]=a,t[12]=c,t[13]=s,t[14]=h,t[15]=v,t[16]=y):y=t[16],y}function _I(e){let t=(0,$.c)(84),{sessions:n,activeSessionId:r,onSelect:i,onTabActivate:a,newChatSelected:o,onNewChatLaunch:s,onNewChatPickCli:c,onNewChatPickTerminal:l,onClose:u,onRename:d,onReorder:f,onDragActiveChange:p,dockPosition:m,onToggleDock:h,onCollapse:g,children:_,className:v,draggable:y}=e,{_:b}=kt(),x=m===`right`,[S,C]=(0,Q.useState)(null),[w,T]=(0,Q.useState)(``),E=(0,Q.useRef)(null),D=(0,Q.useRef)(!1),O=d!=null,k,A;t[0]===S?(k=t[1],A=t[2]):(k=()=>{S!=null&&(E.current?.focus(),E.current?.select())},A=[S],t[0]=S,t[1]=k,t[2]=A),(0,Q.useEffect)(k,A);let j,M;t[3]!==S||t[4]!==n?(j=()=>{S!=null&&!n.some(e=>e.id===S)&&(D.current=!1,C(null),T(``))},M=[n,S],t[3]=S,t[4]=n,t[5]=j,t[6]=M):(j=t[5],M=t[6]),(0,Q.useEffect)(j,M);let N=function(e){O&&(D.current=!1,C(e.id),T(e.label))},P;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(P=function(e){let t=typeof CSS<`u`&&CSS.escape?CSS.escape(e):e;queueMicrotask(()=>{document.querySelector(`[role="tab"][data-tab-id="${t}"]`)?.focus()})},t[7]=P):P=t[7];let F=P,I=function(e){D.current||d?.(e,w.trim()),D.current=!1,C(null),T(``),F(e)},L=(0,Q.useRef)(null),[R,z]=(0,Q.useState)(null),B;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(B={activationConstraint:{distance:8}},t[8]=B):B=t[8];let V=$o(Bo(Wo,B)),H=f!=null,U;t[9]===R?U=t[10]:(U=jP(R),t[9]=R,t[10]=U);let W;t[11]===U?W=t[12]:(W=[U],t[11]=U,t[12]=W);let G=W,K;t[13]===p?K=t[14]:(K=function(){z(AP(L.current,hI)),p?.(!0)},t[13]=p,t[14]=K);let ee=K,te;t[15]!==p||t[16]!==f||t[17]!==n?(te=function(e){z(null),p?.(!1);let t=String(e.active.id),r=e.over?String(e.over.id):null;if(!r||t===r)return;let i=n.map(yI),a=i.indexOf(t),o=i.indexOf(r);a<0||o<0||a===o||f?.(Xo(i,a,o))},t[15]=p,t[16]=f,t[17]=n,t[18]=te):te=t[18];let ne=te,re;t[19]===p?re=t[20]:(re=function(){z(null),p?.(!1)},t[19]=p,t[20]=re);let ie=re,q=nI,ae;t[21]===v?ae=t[22]:(ae=X(`flex min-h-0 min-w-0 flex-1 flex-col`,v),t[21]=v,t[22]=ae);let oe=y?``:void 0,se=y&&`h-[62px] [-webkit-app-region:drag] pr-[22px] pl-[calc(var(--ok-titlebar-reserve-left,1rem)+0.75rem)]`,ce;t[23]===se?ce=t[24]:(ce=X(`flex shrink-0 flex-row items-center gap-1 px-1.5 py-1`,se),t[23]=se,t[24]=ce);let le=iI,ue;t[25]===b?ue=t[26]:(ue=b({id:`1MGRQl`}),t[25]=b,t[26]=ue);let de=y&&`[-webkit-app-region:no-drag]`,fe;t[27]===de?fe=t[28]:(fe=X(`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`,de),t[27]=de,t[28]=fe);let pe=Ho,me=MP,he;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(he={container:typeof document<`u`?document.body:void 0},t[29]=he):he=t[29];let ge=Jo,_e;t[30]===n?_e=t[31]:(_e=n.map(vI),t[30]=n,t[31]=_e);let ve=Vo,ye=n.map(e=>{let t=e.id===r;return(0,Z.jsx)(gI,{id:e.id,disabled:!H||S!=null,isActive:t,children:S===e.id?(0,Z.jsx)(ZC,{className:X(`h-7 w-40 rounded-md border-0 bg-transparent dark:bg-transparent`,y&&`[-webkit-app-region:no-drag]`),children:(0,Z.jsx)(nw,{ref:E,value:w,"aria-label":b({id:`0TnCvC`,values:{0:e.label}}),"data-testid":`terminal-tab-rename-input`,className:`h-7 px-2 text-xs`,onChange:e=>T(e.target.value),onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),E.current?.blur()):e.key===`Escape`&&(e.preventDefault(),D.current=!0,E.current?.blur())},onBlur:()=>I(e.id)})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Os,{children:[(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(aI,{value:e.id,"data-tab-id":e.id,onClick:t=>{t.detail>=2||a?.(e.id)},onDoubleClick:()=>N(e),onKeyDown:t=>{t.key===`F2`&&(t.preventDefault(),N(e))},className:X(`h-7 flex-none rounded-md px-2 text-xs`,y&&`[-webkit-app-region:no-drag]`),children:(0,Z.jsx)(`span`,{className:`max-w-40 truncate`,children:e.label})})}),(0,Z.jsx)(Es,{side:`bottom`,sideOffset:8,children:e.label})]}),(0,Z.jsx)(Jr,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":b({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`,y&&`[-webkit-app-region:no-drag]`),onClick:t=>{t.stopPropagation(),u(e.id)},children:(0,Z.jsx)(gs,{"aria-hidden":`true`})})]})},e.id)}),be;t[32]!==ge||t[33]!==_e||t[34]!==ve||t[35]!==ye?(be=(0,Z.jsx)(ge,{items:_e,strategy:ve,children:ye}),t[32]=ge,t[33]=_e,t[34]=ve,t[35]=ye,t[36]=be):be=t[36];let xe;t[37]!==pe||t[38]!==ie||t[39]!==ne||t[40]!==ee||t[41]!==G||t[42]!==V||t[43]!==!1||t[44]!==me||t[45]!==he||t[46]!==be?(xe=(0,Z.jsx)(pe,{sensors:V,autoScroll:!1,collisionDetection:me,modifiers:G,onDragStart:ee,onDragEnd:ne,onDragCancel:ie,accessibility:he,children:be}),t[37]=pe,t[38]=ie,t[39]=ne,t[40]=ee,t[41]=G,t[42]=V,t[43]=!1,t[44]=me,t[45]=he,t[46]=be,t[47]=xe):xe=t[47];let Se;t[48]!==le||t[49]!==ue||t[50]!==fe||t[51]!==xe?(Se=(0,Z.jsx)(le,{variant:`line`,"aria-label":ue,className:fe,children:xe}),t[48]=le,t[49]=ue,t[50]=fe,t[51]=xe,t[52]=Se):Se=t[52];let Ce=y&&`[-webkit-app-region:no-drag]`,we;t[53]===Ce?we=t[54]:(we=X(`shrink-0`,Ce),t[53]=Ce,t[54]=we);let Te;t[55]!==o||t[56]!==s||t[57]!==c||t[58]!==l||t[59]!==we?(Te=(0,Z.jsx)(mI,{selected:o,onLaunchSelected:s,onPickCli:c,onPickTerminal:l,className:we}),t[55]=o,t[56]=s,t[57]=c,t[58]=l,t[59]=we,t[60]=Te):Te=t[60];let Ee;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=(0,Z.jsx)(`div`,{className:`flex-1`}),t[61]=Ee):Ee=t[61];let De;t[62]!==b||t[63]!==h||t[64]!==x?(De=h==null?null:(0,Z.jsxs)(Os,{children:[(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(Jr,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":b(x?{id:`rf6x3F`}:{id:`QNxpRm`}),className:`shrink-0 cursor-pointer text-muted-foreground hover:text-foreground`,onClick:h,children:x?(0,Z.jsx)(pf,{"aria-hidden":`true`}):(0,Z.jsx)(_f,{"aria-hidden":`true`})})}),(0,Z.jsx)(Es,{side:`bottom`,sideOffset:8,children:x?(0,Z.jsx)(J,{id:`rf6x3F`}):(0,Z.jsx)(J,{id:`QNxpRm`})})]}),t[62]=b,t[63]=h,t[64]=x,t[65]=De):De=t[65];let Oe;t[66]!==b||t[67]!==g||t[68]!==x?(Oe=g==null?null:(0,Z.jsxs)(Os,{children:[(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(Jr,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":b({id:`VZGGPK`}),className:`shrink-0 cursor-pointer text-muted-foreground hover:text-foreground`,onClick:g,children:x?(0,Z.jsx)(na,{"aria-hidden":`true`}):(0,Z.jsx)(ea,{"aria-hidden":`true`})})}),(0,Z.jsx)(Es,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(J,{id:`VZGGPK`})})]}),t[66]=b,t[67]=g,t[68]=x,t[69]=Oe):Oe=t[69];let ke;t[70]!==oe||t[71]!==ce||t[72]!==Se||t[73]!==Te||t[74]!==De||t[75]!==Oe?(ke=(0,Z.jsxs)(`div`,{ref:L,"data-electron-drag":oe,className:ce,children:[Se,Te,Ee,De,Oe]}),t[70]=oe,t[71]=ce,t[72]=Se,t[73]=Te,t[74]=De,t[75]=Oe,t[76]=ke):ke=t[76];let Ae;return t[77]!==q||t[78]!==r||t[79]!==_||t[80]!==i||t[81]!==ae||t[82]!==ke?(Ae=(0,Z.jsxs)(q,{value:r,onValueChange:i,className:ae,children:[ke,_]}),t[77]=q,t[78]=r,t[79]=_,t[80]=i,t[81]=ae,t[82]=ke,t[83]=Ae):Ae=t[83],Ae}function vI(e){return e.id}function yI(e){return e.id}function bI(e){return`terminal-session-${e}`}function xI(e){e!==``&&document.querySelector(`[data-terminal-session="${e}"] .xterm-helper-textarea`)?.focus()}function SI(e){return e?.contains(document.activeElement)??!1}function CI(e,t){return t===`window`||SI(e)}function wI(e){let t=(0,$.c)(61),{bridge:n,variant:r,visible:i,onVisibleChange:a,launch:o,installedClis:s,container:c,isShowing:l,onRequestEditorFocus:u,dockPosition:d,onToggleDock:f,onHasSessionsChange:p}=e,m=r===void 0?`dock`:r,h=o===void 0?null:o,{_:g}=kt(),[_]=(0,Q.useState)(FI),v,y;t[0]!==c||t[1]!==_?(v=()=>{_==null||c==null||_.parentElement!==c&&c.appendChild(_)},y=[_,c],t[0]=c,t[1]=_,t[2]=v,t[3]=y):(v=t[2],y=t[3]),(0,Q.useLayoutEffect)(v,y);let b=typeof n.terminal?.list==`function`,x;t[4]!==b||t[5]!==h||t[6]!==i?(x=()=>!b&&i?[{id:bI(1),launch:h,title:null,customLabel:null,ordinal:1,adoptPtyId:null}]:[],t[4]=b,t[5]=h,t[6]=i,t[7]=x):x=t[7];let[S,w]=(0,Q.useState)(x),T;t[8]!==b||t[9]!==i?(T=()=>!b&&i?bI(1):``,t[8]=b,t[9]=i,t[10]=T):T=t[10];let[E,D]=(0,Q.useState)(T),[O,k]=(0,Q.useState)(!b),A=(0,Q.useRef)(!1),j=(0,Q.useRef)(E),M=(0,Q.useRef)(S),N=(0,Q.useRef)(!b&&i?1:0),P=(0,Q.useRef)(i&&h?h.nonce:null),F=(0,Q.useRef)(m===`window`?!1:i),I=(0,Q.useRef)(new Map),L=function(e,t){if(t===null){I.current.delete(e);return}I.current.set(e,t);let r=M.current.find(t=>t.id===e);r!=null&&n.terminal?.setMeta?.(t,{ordinal:r.ordinal,customLabel:r.customLabel})},R=(0,Q.useRef)(0),z=function(e){N.current+=1;let t=bI(N.current);w(n=>[...n,{id:t,launch:e,title:null,customLabel:null,ordinal:N.current,adoptPtyId:null}]),D(t)},[B,V]=(0,Q.useState)(PI),[H,U]=(0,Q.useState)(NI),W;t[11]===s?W=t[12]:(W=s??{},t[11]=s,t[12]=W);let G=y_(B,W),K=H?`terminal`:G,ee=function(e){R.current+=1,z({prompt:null,cli:e,nonce:R.current})},te=function(){H?z(null):ee(G)},ne=function(e){U(!1),O_(!1);let t=p_(e);V(t),__(t),ee(e)},re=function(){U(!0),O_(!0),z(null)},ie;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(ie=function(e,t){let n=t.trim()===``?null:t.trim();w(t=>t.some(t=>t.id===e&&t.title!==n)?t.map(t=>t.id===e?{...t,title:n}:t):t)},t[13]=ie):ie=t[13];let ae=ie,oe=function(e,t){let r=t.trim()===``?null:t.trim();w(t=>t.some(t=>t.id===e&&t.customLabel!==r)?t.map(t=>t.id===e?{...t,customLabel:r}:t):t);let i=I.current.get(e);i!=null&&n.terminal?.setMeta?.(i,{customLabel:r})},se;t[14]===g?se=t[15]:(se=function(e){return e.customLabel??e.title??g({id:`OVjNeX`,values:{0:e.ordinal}})},t[14]=g,t[15]=se);let ce=se,le=(0,Q.useRef)(!1),ue=(0,Q.useRef)(null),de=(0,Q.useRef)(null),fe=function(e){w(t=>{if(e.length!==t.length)return t;let n=new Map(t.map(MI)),r=[];for(let i of e){let e=n.get(i);if(e==null)return t;r.push(e)}return r.every((e,n)=>e===t[n])?t:r});let t=e.map(e=>I.current.get(e)).filter(jI);t.length>0&&n.terminal?.setOrder?.(t)},pe=function(e){let t=M.current,n=t.findIndex(e=>e.id===j.current);if(n<0)return null;let r=n+e;if(r<0||r>=t.length)return null;let i=t.map(AI),[a]=i.splice(n,1);return i.splice(r,0,a),fe(i),{label:ce(t[n]),position:r+1,total:t.length}},me=(0,Q.useRef)(pe),he=(0,Q.useRef)(z),ge=function(e){let t=M.current,n=t.findIndex(t=>t.id===e);if(n===-1)return;let r=t.filter(t=>t.id!==e);if(e===E){let e=(t[n-1]??t[n+1])?.id??``;D(e),e!==``&&queueMicrotask(()=>xI(e))}w(r),r.length===0&&(a(!1),u())},_e=(0,Q.useRef)(kI);(0,Q.useEffect)(()=>{he.current=z,me.current=pe,j.current=E,M.current=S,_e.current=()=>{E!==``&&ge(E)}});let ve;t[16]!==h||t[17]!==O||t[18]!==S.length||t[19]!==i?(ve=[i,h,S.length,O],t[16]=h,t[17]=O,t[18]=S.length,t[19]=i,t[20]=ve):ve=t[20],(0,Q.useEffect)(()=>{if(!O)return;let e=F.current;if(F.current=i,h!=null&&h.nonce!==P.current){P.current=h.nonce,he.current(h);return}i&&!e&&S.length===0&&he.current(null)},ve);let ye;t[21]===n?ye=t[22]:(ye=[n],t[21]=n,t[22]=ye),(0,Q.useEffect)(()=>{if(typeof n.terminal?.list!=`function`||A.current)return;A.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(OI);N.current=Math.max(e.length,...e.map(DI)),w(e),D(e[0]?.id??``)}k(!0)}})(),()=>{e=!0,A.current=!1}},ye);let be;t[23]===n?be=t[24]:(be=[n],t[23]=n,t[24]=be),(0,Q.useEffect)(()=>q(e=>{let t=j.current,r=t===``?void 0:I.current.get(t);r==null?C():(n.terminal.input(r,e),queueMicrotask(()=>xI(t)))}),be);let xe;t[25]!==n||t[26]!==m?(xe=[n,m],t[25]=n,t[26]=m,t[27]=xe):xe=t[27],(0,Q.useEffect)(()=>n.onMenuAction(e=>{e===`new-terminal`?he.current(null):(e===`kill-terminal`||e===`close-active-tab-or-window`&&m===`window`)&&_e.current()}),xe);let Se;t[28]!==_||t[29]!==m?(Se=[_,m],t[28]=_,t[29]=m,t[30]=Se):Se=t[30],(0,Q.useEffect)(()=>{let e=function(e){if(!e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||!/^[1-9]$/.test(e.key)||!CI(_,m))return;let t=M.current[Number(e.key)-1];t!=null&&(e.preventDefault(),e.stopPropagation(),D(t.id),queueMicrotask(()=>xI(t.id)))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},Se);let Ce;t[31]!==g||t[32]!==_||t[33]!==m?(Ce=[_,m,g],t[31]=g,t[32]=_,t[33]=m,t[34]=Ce):Ce=t[34],(0,Q.useEffect)(()=>{let e=function(e){if(!e.metaKey||!e.shiftKey||e.ctrlKey||e.altKey)return;let t=e.key===`ArrowLeft`?-1:+(e.key===`ArrowRight`);if(t===0||!CI(_,m)||le.current)return;let n=e.target;if(n?.tagName===`INPUT`||n?.isContentEditable)return;let r=me.current(t);if(r==null)return;e.preventDefault(),e.stopPropagation(),queueMicrotask(()=>xI(j.current));let i=g({id:`CoHvYd`,values:{0:r.label,1:r.position,2:r.total}});de.current!=null&&window.clearTimeout(de.current),de.current=window.setTimeout(()=>{de.current=null,ue.current!=null&&(ue.current.textContent=i)},60)};return window.addEventListener(`keydown`,e,{capture:!0}),()=>{window.removeEventListener(`keydown`,e,{capture:!0}),de.current!=null&&(window.clearTimeout(de.current),de.current=null)}},Ce);let we;t[35]!==n.editor||t[36]!==S.length?(we=()=>{n.editor.notifyViewMenuStateChanged({terminalLive:S.length>0})},t[35]=n.editor,t[36]=S.length,t[37]=we):we=t[37];let Te;t[38]!==n||t[39]!==S.length?(Te=[n,S.length],t[38]=n,t[39]=S.length,t[40]=Te):Te=t[40],(0,Q.useEffect)(we,Te);let Ee,De;t[41]!==p||t[42]!==S.length?(Ee=()=>{p?.(S.length>0)},De=[p,S.length],t[41]=p,t[42]=S.length,t[43]=Ee,t[44]=De):(Ee=t[43],De=t[44]),(0,Q.useEffect)(Ee,De);let Oe,ke;t[45]!==_||t[46]!==l||t[47]!==u||t[48]!==i?(Oe=()=>{l||i||SI(_)&&u()},ke=[l,i,_,u],t[45]=_,t[46]=l,t[47]=u,t[48]=i,t[49]=Oe,t[50]=ke):(Oe=t[49],ke=t[50]),(0,Q.useLayoutEffect)(Oe,ke);let Ae;t[51]===l?Ae=t[52]:(Ae=[l],t[51]=l,t[52]=Ae),(0,Q.useEffect)(()=>{l&&xI(j.current)},Ae);let je;if(t[53]!==g||t[54]!==S){let e;t[56]===g?e=t[57]:(e=e=>({id:e.id,label:e.customLabel??e.title??g({id:`OVjNeX`,values:{0:e.ordinal}})}),t[56]=g,t[57]=e),je=S.map(e),t[53]=g,t[54]=S,t[55]=je}else je=t[55];let Me=je,Ne=[...S].sort(EI),Pe=S.length>0?(0,Z.jsx)(_I,{sessions:Me,activeSessionId:E,onSelect:D,onTabActivate:TI,newChatSelected:K,onNewChatLaunch:te,onNewChatPickCli:ne,onNewChatPickTerminal:re,onClose:ge,onRename:oe,onReorder:fe,onDragActiveChange:e=>{le.current=e},dockPosition:d,onToggleDock:f,onCollapse:m===`window`?void 0:()=>a(!1),draggable:m===`window`,className:`h-full`,children:Ne.map(e=>(0,Z.jsx)(oI,{value:e.id,forceMount:!0,"data-terminal-session":e.id,className:X(`m-0 flex min-h-0 flex-1 flex-col overflow-hidden data-[state=inactive]:hidden`,m===`window`&&`px-[22px] pb-[22px]`),children:(0,Z.jsx)(cI,{bridge:n,launch:e.launch,adoptPtyId:e.adoptPtyId,onPtyId:t=>L(e.id,t),onTitleChange:t=>ae(e.id,t),onClose:()=>ge(e.id)})},e.id))}):null,Fe;return t[58]!==_||t[59]!==Pe?(Fe=_==null?null:(0,Ed.createPortal)((0,Z.jsxs)(Z.Fragment,{children:[Pe,(0,Z.jsx)(`span`,{ref:ue,"aria-live":`polite`,"aria-atomic":`true`,className:`sr-only`,"data-testid":`terminal-reorder-announcer`})]}),_),t[58]=_,t[59]=Pe,t[60]=Fe):Fe=t[60],Fe}function TI(e){return queueMicrotask(()=>xI(e))}function EI(e,t){return e.ordinal-t.ordinal}function DI(e){return e.ordinal}function OI(e,t){return{id:bI(t+1),launch:null,title:null,customLabel:e.customLabel??null,ordinal:e.ordinal??t+1,adoptPtyId:e.ptyId}}function kI(){}function AI(e){return e.id}function jI(e){return e!=null}function MI(e){return[e.id,e]}function NI(){return k_()}function PI(){return g_()}function FI(){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 II(e){let t=(0,$.c)(74),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{onOpenSearch:r}=n,[i,a]=i_(),[o,s]=(0,Q.useState)(i),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(`auth`),[f,p]=(0,Q.useState)(Gv[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=a_(),[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)(T_),A;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(e){k(e),w_(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??y_(g_(),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?(B=function(){y(!0),!x&&!D_()&&z()},t[8]=x,t[9]=z,t[10]=B):B=t[10];let V=B,H=Ri(),{projectConfig:U,projectLocalConfig:W,projectLocalSynced:G,projectSynced:K}=au(),{activeDocName:ee}=Ye(),te=H?.hasRemote,ne=H?.pushPermission?.checkStatus,re;t[11]!==m||t[12]!==U||t[13]!==W||t[14]!==G||t[15]!==K||t[16]!==te||t[17]!==ne?(re=M_({autoSyncOnboardingDismissed:m,hasRemote:te,projectLocalSynced:G,projectSynced:K,projectLocalConfig:W,projectConfig:U,pushPermissionCheckStatus:ne}),t[11]=m,t[12]=U,t[13]=W,t[14]=G,t[15]=K,t[16]=te,t[17]=ne,t[18]=re):re=t[18];let ie=re,q,ae;t[19]===ee?(q=t[20],ae=t[21]):(q=()=>{let e=function(e){let t=e.detail;t&&ee&&cu(ee,{kind:`raw-mdx`,detail:t}),s(`source`)};return window.addEventListener(Xg,e),()=>window.removeEventListener(Xg,e)},ae=[ee],t[19]=ee,t[20]=q,t[21]=ae),(0,Q.useEffect)(q,ae);let oe,se;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(oe=()=>{let e=window.okDesktop;if(e!=null)return e.onMenuAction(e=>{e===`toggle-terminal`?y(zI):e===`new-terminal`&&y(!0)})},se=[],t[22]=oe,t[23]=se):(oe=t[22],se=t[23]),(0,Q.useEffect)(oe,se);let ce,le;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(ce=()=>{if(window.okDesktop!=null)return;let e=function(e){jl(e,`toggle-terminal-panel`)&&(e.preventDefault(),y(RI))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},le=[],t[24]=ce,t[25]=le):(ce=t[24],le=t[25]),(0,Q.useEffect)(ce,le);let ue,de;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(ue=()=>tI((e,t)=>{y(!0),L.current+=1,D({prompt:e,cli:t,nonce:L.current})}),de=[],t[26]=ue,t[27]=de):(ue=t[26],de=t[27]),(0,Q.useEffect)(ue,de);let fe,pe;t[28]===v?(fe=t[29],pe=t[30]):(fe=()=>{v||D(null)},pe=[v],t[28]=v,t[29]=fe,t[30]=pe),(0,Q.useEffect)(fe,pe);let me,he;t[31]!==C||t[32]!==v?(me=()=>{window.okDesktop!=null&&C&&window.okDesktop.editor.notifyViewMenuStateChanged({terminalVisible:v})},he=[v,C],t[31]=C,t[32]=v,t[33]=me,t[34]=he):(me=t[33],he=t[34]),(0,Q.useEffect)(me,he);let ge,_e;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(ge=()=>{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(LI).finally(()=>{t||w(!0)}),()=>{t=!0}},_e=[],t[35]=ge,t[36]=_e):(ge=t[35],_e=t[36]),(0,Q.useEffect)(ge,_e);let ve,ye;t[37]===v?(ve=t[38],ye=t[39]):(ve=()=>{if(window.okDesktop!=null){if(T.current){T.current=!1;return}v&&Xa()}},ye=[v],t[37]=v,t[38]=ve,t[39]=ye),(0,Q.useEffect)(ve,ye),s_(H?.pausedReason),c_();let be;t[40]===a?be=t[41]:(be=function(e){s(e),a(e)},t[40]=a,t[41]=be);let xe=be,Se,Ce;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(Se=()=>{d(`auth`),l(!0)},Ce=()=>{d(`identity`),l(!0)},t[42]=Se,t[43]=Ce):(Se=t[42],Ce=t[43]);let we;t[44]===r?we=t[45]:(we=(0,Z.jsx)(QF,{onSignIn:Se,onSetIdentity:Ce,onOpenSearch:r}),t[44]=r,t[45]=we);let Te=_?V:void 0,Ee;t[46]!==f||t[47]!==o||t[48]!==xe||t[49]!==Te||t[50]!==O||t[51]!==v?(Ee=(0,Z.jsx)(aN,{editorMode:o,onModeChange:xe,activeTab:f,onActiveTabChange:p,terminalBridge:g,terminalVisible:v,onTerminalVisibleChange:y,terminalDock:O,onTerminalPlacement:I,onRevealTerminal:Te}),t[46]=f,t[47]=o,t[48]=xe,t[49]=Te,t[50]=O,t[51]=v,t[52]=Ee):Ee=t[52];let De;t[53]!==b||t[54]!==O||t[55]!==E||t[56]!==F||t[57]!==v||t[58]!==N?(De=_&&g!=null?(0,Z.jsx)(wI,{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[53]=b,t[54]=O,t[55]=E,t[56]=F,t[57]=v,t[58]=N,t[59]=De):De=t[59];let Oe=u===`identity`,ke;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(ke=()=>{l(!1)},t[60]=ke):ke=t[60];let Ae;t[61]!==c||t[62]!==Oe?(Ae=(0,Z.jsx)(Ja,{open:c,onOpenChange:l,identityPrompt:Oe,onSuccess:ke}),t[61]=c,t[62]=Oe,t[63]=Ae):Ae=t[63];let je;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(je=()=>h(!0),t[64]=je):je=t[64];let Me;t[65]===ie?Me=t[66]:(Me=(0,Z.jsx)(A_,{open:ie,onResolved:je}),t[65]=ie,t[66]=Me);let Ne;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=(0,Z.jsx)(qg,{}),t[67]=Ne):Ne=t[67];let Pe;return t[68]!==we||t[69]!==Ee||t[70]!==De||t[71]!==Ae||t[72]!==Me?(Pe=(0,Z.jsxs)(Z.Fragment,{children:[we,Ee,De,Ae,Me,Ne]}),t[68]=we,t[69]=Ee,t[70]=De,t[71]=Ae,t[72]=Me,t[73]=Pe):Pe=t[73],Pe}function LI(e){console.error(`[terminal] dock-state restore failed; staying hidden:`,e)}function RI(e){return!e}function zI(e){return!e}function BI(e){let t=El(_l(e));typeof window>`u`||window.location.hash!==t&&(window.location.hash=t)}function VI(){let e=(0,$.c)(11),{conflicts:t,loading:n,error:r}=Wa();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)(os,{"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)(os,{"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(HI),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 HI(e){return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(Jr,{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:()=>BI(e.file),children:[(0,Z.jsx)(os,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:e.file})]})},e.file)}var UI=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
29
+ `,r);if(s>-1&&s<t&&(e=s),i&&p<f.length){let t=Math.max(0,m?f[p].toA:f[p].fromA);t<=e&&(e=t,m&&p++,o=!0)}if(e>r){let t=document.createTextNode(l.slice(r,e));if(a){let e=d.appendChild(document.createElement(`span`));e.className=a,e.appendChild(t)}else d.appendChild(t);r=e}o&&(m=!m)}}if(u&&t.toA-t.fromA<=o){let t=u.parser.parse(l),n=0;Ul(t,{style:t=>ru(e,t)},(e,t,r)=>{e>n&&g(n,e,``),g(e,t,r),n=t}),g(n,l.length,``)}else g(0,l.length,``);return d.firstChild||d.appendChild(document.createElement(`br`)),c})});return TA.set(t.changes,i),i}function OA(e,t){let{state:n}=e,r=t??n.selection.main.head,i=e.state.field(Pk).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(wA);i.fromB!=i.toB&&i.toA<=o.length&&(a+=e.state.lineBreak);let s=Bl.of({from:i.fromA,to:Math.min(o.length,i.toA),insert:a},o.length);return e.dispatch({effects:CA.of({doc:s.apply(o),changes:s}),userEvent:`accept`}),!0}function kA(e,t){let{state:n}=e,r=t??n.selection.main.head,i=n.field(Pk).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=n.field(wA).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 AA(e){let t=new Kl;for(let n of e.field(Pk)){let r=e.facet(jk).overrideChunk&&NA(e,n);t.add(n.fromB,n.fromB,DA(e,n,!!r))}return t.finish()}var jA=Hl.define({create:e=>AA(e),update(e,t){return t.state.field(Pk,!1)==t.startState.field(Pk,!1)?e:AA(t.state)},provide:e=>Zl.decorations.from(e)}),MA=new WeakMap;function NA(e,t){let n=MA.get(t);if(n!==void 0)return n;n=null;let r=e.field(wA),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(Gl.widget({widget:new PA(t),side:-1}).range(s+n.fromB))}n.fromB<n.toB&&e.push(Xk.range(s+n.fromB,s+n.toB))}i<t.endA-t.fromA-a*2&&(n=e)}return MA.set(t,n),n}var PA=class extends Rl{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}},FA=new class extends Ql{constructor(){super(...arguments),this.elementClass=`cm-inlineChangedLineGutter`}},IA=Gl.line({class:`cm-inlineChangedLine`});function LA(e,t,n,r){let i=NA(e,t),a=0;if(!i)return!1;for(let o=e.doc.lineAt(t.fromB);;){for(r&&r.add(o.from,o.from,FA),n.add(o.from,o.from,IA);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 RA=si({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),zA=mi({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),BA=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 VA({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 HA(e){let t=(0,$.c)(33),{oldContent:n,newContent:r,layout:i,conflictMode:a,previewMode:o,oursOverride:s,onResolve:c,onAbort:l}=e,{_:u}=kt(),d=s??r,f=(0,Q.useRef)(null),p=(0,Q.useRef)(null),m=(0,Q.useRef)(0),{resolvedTheme:h}=sn(),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=XO(a===!0),w;t[1]!==l||t[2]!==c?(w=()=>{g.current=c,_.current=l},t[1]=l,t[2]=c,t[3]=w):w=t[3],(0,Q.useEffect)(w);let T,E;t[4]!==a||t[5]!==d||t[6]!==i||t[7]!==n||t[8]!==o||t[9]!==h?(T=()=>{let e=f.current;if(!e)return;S([]);let t=new Map,r=!1,s=e=>{r||!t.delete(e)||S(t=>t.filter(t=>t.id!==e))},c=new MutationObserver(()=>{for(let[n,r]of t)e.contains(r)||s(n)});c.observe(e,{childList:!0,subtree:!0});let l=h===`dark`?RA:zA,u=[Zl.editable.of(!1),Vl.readOnly.of(!0)],g=[bu,iu(),...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=VA({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:[bu,iu(),Zl.editable.of(!1),l,BA,Zl.lineWrapping,SA({original:n,highlightChanges:!0,gutter:!0,mergeControls:i,collapseUnchanged:{margin:3,minSize:4}}),Zl.updateListener.of(e=>{let t=Fk(e.state);y(t?t.chunks.length:0)})],parent:e});p.current=a;let o=Fk(a.state);y(o?o.chunks.length:0)}else i===`split`?p.current=new vA({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,SA({original:n,highlightChanges:!0,gutter:!0,mergeControls:!1,collapseUnchanged:{margin:3,minSize:4}})],parent:e});return()=>{r=!0,c.disconnect(),p.current&&=(p.current.destroy(),null)}},E=[n,d,i,h,a,o],t[4]=a,t[5]=d,t[6]=i,t[7]=n,t[8]=o,t[9]=h,t[10]=T,t[11]=E):(T=t[10],E=t[11]),(0,Q.useEffect)(T,E);let D;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(D=function(){let e=p.current;!e||!(e instanceof Zl)||g.current?.(e.state.doc.toString())},t[12]=D):D=t[12];let O=D,k;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(k=function(){let e=p.current;!e||!(e instanceof Zl)||ci(e)},t[13]=k):k=t[13];let A=k,j=v===0,M;t[14]!==u||t[15]!==v?(M=v===null?``:v===0?u({id:`lPzyrU`}):Gc._({id:`8FqTCr`,values:{chunksRemaining:v}}),t[14]=u,t[15]=v,t[16]=M):M=t[16];let N=M,P;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(`div`,{ref:f,className:`diff-view min-h-0 flex-1 overflow-y-auto subtle-scrollbar`}),t[17]=P):P=t[17];let F;if(t[18]!==u||t[19]!==x){let e;t[21]===u?e=t[22]:(e=e=>(0,Ed.createPortal)((0,Z.jsx)(Jr,{type:`button`,variant:e.type===`accept`?`default`:`destructive`,size:`xs`,onClick:t=>{e.action(t.nativeEvent)},children:e.type===`accept`?u({id:`g3UF2V`}):u({id:`1t_NnN`})}),e.host,e.id),t[21]=u,t[22]=e),F=x.map(e),t[18]=u,t[19]=x,t[20]=F}else F=t[20];let I;t[23]!==j||t[24]!==C||t[25]!==a||t[26]!==N||t[27]!==l||t[28]!==c?(I=a&&(0,Z.jsxs)(`div`,{ref:C,className:`flex items-center justify-between gap-2 px-3 py-2 border-t shrink-0`,children:[(0,Z.jsx)(`span`,{className:`text-xs ${j?`text-emerald-600 dark:text-emerald-400`:`text-muted-foreground`}`,children:N}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[l&&(0,Z.jsx)(Jr,{className:`uppercase font-mono`,variant:`ghost`,size:`sm`,onClick:l,children:(0,Z.jsx)(J,{id:`XyOUTJ`})}),(0,Z.jsx)(Jr,{className:`uppercase font-mono`,variant:`outline`,size:`sm`,onClick:A,children:`Undo`}),c&&(0,Z.jsx)(Jr,{variant:`default`,size:`sm`,disabled:!j,onClick:O,children:(0,Z.jsx)(J,{id:`Lcehxn`})})]})]}),t[23]=j,t[24]=C,t[25]=a,t[26]=N,t[27]=l,t[28]=c,t[29]=I):I=t[29];let L;return t[30]!==I||t[31]!==F?(L=(0,Z.jsxs)(`div`,{className:`flex flex-col h-full`,children:[P,F,I]}),t[30]=I,t[31]=F,t[32]=L):L=t[32],L}async function UA(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 WA(e,t){return UA(e,`content`,t)}async function GA(e){return UA(e,`mine`)}async function KA(e){return UA(e,`theirs`)}async function qA(e){return UA(e,`delete`)}async function JA(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 YA(e){let t=(0,$.c)(86),{docName:n}=e,{_:r}=kt(),{conflicts:i,loading:a}=Wa(),o;if(t[0]!==i||t[1]!==n){let e;t[3]===n?e=t[4]:(e=e=>_l(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=XO(l?.kind===`delete-modify`||l?.kind===`modify-delete`),g,_;t[5]===n?(g=t[6],_=t[7]):(g=()=>(console.warn(JSON.stringify({event:`editor-area-swap-to-diffview`,"doc.name":n})),()=>{console.warn(JSON.stringify({event:`editor-area-swap-from-diffview`,"doc.name":n}))}),_=[n],t[5]=n,t[6]=g,t[7]=_),(0,Q.useEffect)(g,_);let v=a||s===void 0,y,b;t[8]!==v||t[9]!==c?(y=()=>{if(v)return;let e=!1;return u(null),f(!1),JA(c).then(t=>{e||(t===null?f(!0):u(t))}),()=>{e=!0}},b=[c,v],t[8]=v,t[9]=c,t[10]=y,t[11]=b):(y=t[10],b=t[11]),(0,Q.useEffect)(y,b);let x;t[12]!==r||t[13]!==c?(x=async function(e){let t=await WA(c,e);t.ok||hs.error(r({id:`K-h9cT`,values:{filePath:c}}),{description:t.detail})},t[12]=r,t[13]=c,t[14]=x):x=t[14];let S=x,C;t[15]!==r||t[16]!==c?(C=async function(e){m(!0);let t=await e(c);t.ok||(m(!1),hs.error(r({id:`jPUPvG`,values:{filePath:c}}),{description:t.detail}))},t[15]=r,t[16]=c,t[17]=C):C=t[17];let w=C;if(d){let e;return t[18]===c?e=t[19]:(e=(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`ajz9F8`,values:{filePath:c}})}),t[18]=c,t[19]=e),e}if(l===null){let e;return t[20]===c?e=t[21]:(e=(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`DF1MtZ`,values:{filePath:c}})}),t[20]=c,t[21]=e),e}if(l.kind===`delete-modify`){let e;t[22]===l.theirs?e=t[23]:(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(HA,{oldContent:``,newContent:l.theirs,layout:`unified`,previewMode:!0})}),t[22]=l.theirs,t[23]=e);let n;t[24]===c?n=t[25]:(n={filePath:c},t[24]=c,t[25]=n);let r;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(r={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[26]=r):r=t[26];let i;t[27]===n?i=t[28]:(i=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`V48OUT`,values:n,components:r})}),t[27]=n,t[28]=i);let a;t[29]===w?a=t[30]:(a=()=>void w(qA),t[29]=w,t[30]=a);let o;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(J,{id:`Vlc75q`}),t[31]=o):o=t[31];let s;t[32]!==p||t[33]!==a?(s=(0,Z.jsx)(Jr,{type:`button`,variant:`destructive`,disabled:p,onClick:a,children:o}),t[32]=p,t[33]=a,t[34]=s):s=t[34];let u;t[35]===w?u=t[36]:(u=()=>void w(KA),t[35]=w,t[36]=u);let d;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(J,{id:`3mFsc3`}),t[37]=d):d=t[37];let f;t[38]!==p||t[39]!==u?(f=(0,Z.jsx)(Jr,{type:`button`,variant:`default`,disabled:p,onClick:u,children:d}),t[38]=p,t[39]=u,t[40]=f):f=t[40];let m;t[41]!==s||t[42]!==f?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-3`,children:[s,f]}),t[41]=s,t[42]=f,t[43]=m):m=t[43];let g;t[44]!==h||t[45]!==i||t[46]!==m?(g=(0,Z.jsxs)(`div`,{ref:h,className:`flex flex-shrink-0 flex-wrap items-center justify-between gap-x-6 gap-y-3 border-t px-6 py-4`,children:[i,m]}),t[44]=h,t[45]=i,t[46]=m,t[47]=g):g=t[47];let _;return t[48]!==g||t[49]!==e?(_=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[e,g]}),t[48]=g,t[49]=e,t[50]=_):_=t[50],_}if(l.kind===`modify-delete`){let e;t[51]===l.ours?e=t[52]:(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(HA,{oldContent:``,newContent:l.ours,layout:`unified`,previewMode:!0})}),t[51]=l.ours,t[52]=e);let n;t[53]===c?n=t[54]:(n={filePath:c},t[53]=c,t[54]=n);let r;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(r={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[55]=r):r=t[55];let i;t[56]===n?i=t[57]:(i=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`EhDLBx`,values:n,components:r})}),t[56]=n,t[57]=i);let a;t[58]===w?a=t[59]:(a=()=>void w(GA),t[58]=w,t[59]=a);let o;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(J,{id:`0NA4b3`}),t[60]=o):o=t[60];let s;t[61]!==p||t[62]!==a?(s=(0,Z.jsx)(Jr,{type:`button`,variant:`default`,disabled:p,onClick:a,children:o}),t[61]=p,t[62]=a,t[63]=s):s=t[63];let u;t[64]===w?u=t[65]:(u=()=>void w(qA),t[64]=w,t[65]=u);let d;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(J,{id:`qSxaOz`}),t[66]=d):d=t[66];let f;t[67]!==p||t[68]!==u?(f=(0,Z.jsx)(Jr,{type:`button`,variant:`destructive`,disabled:p,onClick:u,children:d}),t[67]=p,t[68]=u,t[69]=f):f=t[69];let m;t[70]!==s||t[71]!==f?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-3`,children:[s,f]}),t[70]=s,t[71]=f,t[72]=m):m=t[72];let g;t[73]!==h||t[74]!==i||t[75]!==m?(g=(0,Z.jsxs)(`div`,{ref:h,className:`flex flex-shrink-0 flex-wrap items-center justify-between gap-x-6 gap-y-3 border-t px-6 py-4`,children:[i,m]}),t[73]=h,t[74]=i,t[75]=m,t[76]=g):g=t[76];let _;return t[77]!==g||t[78]!==e?(_=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[e,g]}),t[77]=g,t[78]=e,t[79]=_):_=t[79],_}let T;t[80]===S?T=t[81]:(T=e=>void S(e),t[80]=S,t[81]=T);let E;return t[82]!==l.ours||t[83]!==l.theirs||t[84]!==T?(E=(0,Z.jsx)(HA,{oldContent:l.theirs,newContent:l.ours,layout:`unified`,conflictMode:!0,onResolve:T}),t[82]=l.ours,t[83]=l.theirs,t[84]=T,t[85]=E):E=t[85],E}function XA(e){let t=(0,$.c)(2),{docName:n,provider:r,children:i}=e;(0,Q.use)(mt(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 ZA=`__back-nav__`;function QA(e){return e instanceof xe||e instanceof Qe||e instanceof ge||e instanceof Re||e instanceof ct||e instanceof yt?e.docName:null}function $A(e){return e instanceof xe||e instanceof Qe}function ej(e){if(e instanceof xe){let t=e.docName;return{title:Gc._({id:`Jejur6`}),summary:Gc._({id:`jSY41h`,values:{docName:t}})}}if(e instanceof Qe){let t=e.docName;return{title:Gc._({id:`V7QxyT`}),summary:Gc._({id:`xG4tb6`,values:{docName:t}})}}if(e instanceof ge){let t=e.docName;return{title:Gc._({id:`1di5fu`}),summary:Gc._({id:`PQCdtv`,values:{docName:t}})}}if(e instanceof Re){let t=e.docName;return{title:Gc._({id:`wvbc1r`}),summary:Gc._({id:`IX7-sq`,values:{docName:t}})}}if(e instanceof ct)return{title:Gc._({id:`Gfr4fu`}),summary:Gc._({id:`UW2Fg3`})};if(e instanceof yt){let t=e.docName;return{title:Gc._({id:`vv7kpg`}),summary:Gc._({id:`mdKFEy`,values:{docName:t}})}}let t=e instanceof Error&&e.message?e.message:Gc._({id:`W5A0Ly`});return{title:Gc._({id:`29VNqC`}),summary:t}}function tj(e){let t=(0,$.c)(31),{error:n,resetErrorBoundary:r,activeDocName:i,previousDocName:a,onNavigateBack:o}=e,s;t[0]===n?s=t[1]:(s=ej(n),t[0]=n,t[1]=s);let{title:c,summary:l}=s,u=!!a&&!!o,d=(0,Q.useRef)(null),f=typeof window<`u`?window.okDesktop:void 0,p=f&&$A(n)?f:null,m,h;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>{d.current?.focus()},h=[],t[2]=m,t[3]=h):(m=t[2],h=t[3]),(0,Q.useEffect)(m,h);let g;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(DS,{size:80,variant:`sleeping`}),t[4]=g):g=t[4];let _;t[5]===c?_=t[6]:(_=(0,Z.jsx)(`h2`,{id:`document-error-title`,className:`text-2xl font-light tracking-tighter text-balance`,children:c}),t[5]=c,t[6]=_);let v;t[7]===l?v=t[8]:(v=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-muted-foreground`,children:l}),t[7]=l,t[8]=v);let y;t[9]!==_||t[10]!==v?(y=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[_,v]}),t[9]=_,t[10]=v,t[11]=y):y=t[11];let b;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(J,{id:`KDw4GX`}),t[12]=b):b=t[12];let x;t[13]===r?x=t[14]:(x=(0,Z.jsx)(Jr,{ref:d,variant:`default`,onClick:r,children:b}),t[13]=r,t[14]=x);let S;t[15]===p?S=t[16]:(S=p?(0,Z.jsx)(Jr,{variant:`secondary`,onClick:()=>{zg(p).then(rj).catch(nj)},children:(0,Z.jsx)(J,{id:`uaUc6t`})}):null,t[15]=p,t[16]=S);let C;t[17]!==i||t[18]!==u||t[19]!==n||t[20]!==o||t[21]!==a||t[22]!==r?(C=u?(0,Z.jsx)(Jr,{variant:`ghost`,className:`font-mono uppercase`,onClick:()=>{!a||!o||(Ge(QA(n)??i),o(a),r(ZA))},children:(0,Z.jsx)(J,{id:`CKyk7Q`})}):null,t[17]=i,t[18]=u,t[19]=n,t[20]=o,t[21]=a,t[22]=r,t[23]=C):C=t[23];let w;t[24]!==S||t[25]!==C||t[26]!==x?(w=(0,Z.jsxs)(`div`,{className:`mt-1 flex gap-2`,children:[x,S,C]}),t[24]=S,t[25]=C,t[26]=x,t[27]=w):w=t[27];let T;return t[28]!==w||t[29]!==y?(T=(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:[g,y,w]}),t[28]=w,t[29]=y,t[30]=T):T=t[30],T}function nj(){}function rj(e){e.ok||hs.error(e.message,{id:`server-restart-error`,duration:1/0})}function ij(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)(tj,{...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]===ZA){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}: ${ej(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 aj(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=ir(t);return{map:n,keys:hr(t),parseError:r}}function oj(e){let t=(0,$.c)(21),{provider:n}=e,r;t[0]===n?r=t[1]:(r=()=>aj(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=wn(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=Fe(i.map.icon),t[5]=i.map.icon,t[6]=c);let l=c,u;t[7]===i.map.cover?u=t[8]:(u=qe(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)(sj,{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)(cj,{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 sj(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 cj(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 lj=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{ManagedArtifactProperties:e}=await import(`./ManagedArtifactProperties-BSPBOnr-.js`);return{ManagedArtifactProperties:e}},__vite__mapDeps([91,1,80,13,7,16,34,10,3,11,36,37,6,59,2,44,45,46,47,48,49,50,51,52,53,54,21,55,40,56,12,57,58,39,33,35,20,15,4,60,17,61,62,19,63,64,65,66,32,38,67,68,69,70,71,72,73,74,82,18,92,81,93,94,42,89]),import.meta.url)).ManagedArtifactProperties})),uj=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{MermaidDocEditor:e}=await import(`./MermaidDocEditor-DeLvY3mL.js`);return{MermaidDocEditor:e}},__vite__mapDeps([95,1,44,2,45,46,11,47,48,49,50,51,52,53,54,21,10,3,55,40,7,56,12,6,13,57,58,39,16,33,34,35,96,97]),import.meta.url)).MermaidDocEditor})),dj=gl(`LARGE_DOC_CHAR_THRESHOLD`,5e5);function fj(e){let t=e.threshold??dj;return e.ytextLength>t?{renderSource:e.isSourceMode||e.visitedSource,renderVisual:!e.isSourceMode||e.visitedVisual,isLarge:!0}:{renderSource:!0,renderVisual:!0,isLarge:!1}}function pj(e){return e.hasEmittedFirstToggle||!e.isLarge?!1:e.renderSource&&e.renderVisual}var mj=gl(`ACTIVITY_MOUNT_LIMIT`,3);function hj(){return n(()=>import(`./SourceEditor-9SpbjiWH.js`),__vite__mapDeps([98,1,44,2,45,46,11,47,48,49,50,51,52,53,54,21,10,3,55,40,7,56,12,6,13,57,58,39,16,33,34,35,96,59,20,15,4,60,17,61,62,19,63,64,65,66,32,36,37,38,67,68,69,70,71,72,73,74,97,99,22,94,90]),import.meta.url)}var gj=(0,Q.lazy)(async()=>({default:(await hj()).SourceEditor}));function _j(e,t,n){if(n<=0)return[];let r=e.filter(e=>!ke(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 vj(e,t){return t.kind===`idle`?null:t.kind===`failed`&&t.failedDocNames.includes(e)?{kind:`failed`,title:Gc._({id:`MTs6g3`}),summary:t.reason===`clear-data-timeout`?Gc._({id:`Sc1bKE`,values:{docName:e}}):Gc._({id:`ovIGrT`,values:{docName:e}}),actionLabel:Gc._({id:`HpK_8d`})}:t.kind===`recovering`&&t.docNames.includes(e)?{kind:`recovering`,title:Gc._({id:`cF9DyA`}),summary:t.phase===`clearing-local-cache`?Gc._({id:`bmC18N`,values:{docName:e}}):Gc._({id:`pAgkuZ`,values:{docName:e}})}:null}function yj(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(hl,{name:`activity-pool`,children:(0,Z.jsx)(bj,{...e})}),t[0]=e,t[1]=n),n}function bj(e){let t=(0,$.c)(15),{activeDocName:n,isSourceMode:r,editorPlaceholder:i,previousDocName:a,onNavigateBack:o,onRecycle:s}=e,{poolEntries:c,serverRestartRecovery:l}=Ye(),{pages:u,loading:d}=ia(),f=_j(c,n,mj),p=(0,Q.useRef)(``),h=f.map(xj).join(`,`),g=(0,Q.useRef)(c),_,v;t[0]===c?(_=t[1],v=t[2]):(_=()=>{g.current=c},v=[c],t[0]=c,t[1]=_,t[2]=v),(0,Q.useLayoutEffect)(_,v),(0,Q.useLayoutEffect)(()=>{if(p.current===h)return;let e=p.current?p.current.split(`,`):[],t=h?h.split(`,`):[],r=e.filter(e=>!t.includes(e)),i=t.filter(t=>!e.includes(t));for(let e of r)m(e);for(let e of i){let t=g.current.find(t=>t.docName===e)?.poolEventId;ne(e,t&&t.length>0?t:crypto.randomUUID())}ml(`ok/activity/mount-list-change`,{active:n,mounted:t,evicted:r}),p.current=h,he(t)},[h,n]);let y;t[3]!==n||t[4]!==i||t[5]!==r||t[6]!==d||t[7]!==o||t[8]!==s||t[9]!==u||t[10]!==a||t[11]!==l?(y=e=>(0,Z.jsx)(Dj,{entry:e,isActive:e.docName===n,isSourceMode:r,editorPlaceholder:i,isNewDoc:!d&&!u.has(e.docName)&&!Dn(e.docName)&&!yn(e.docName),previousDocName:a,onNavigateBack:o,onRecycle:s,serverRestartRecovery:l},e.docName),t[3]=n,t[4]=i,t[5]=r,t[6]=d,t[7]=o,t[8]=s,t[9]=u,t[10]=a,t[11]=l,t[12]=y):y=t[12];let b=f.map(y),x;return t[13]===b?x=t[14]:(x=(0,Z.jsx)(Z.Fragment,{children:b}),t[13]=b,t[14]=x),x}function xj(e){return e.docName}function Sj(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&&ml(`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&&(ml(`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&&ml(`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 Cj(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)(cx,{}),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)(gj,{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 wj(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)(is,{className:`size-5`,"aria-hidden":`true`}):(0,Z.jsx)(ns,{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)(Jr,{type:`button`,onClick:Tj,children:[(0,Z.jsx)(is,{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 Tj(){return window.location.reload()}function Ej(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 Dj(e){let t=(0,$.c)(56),{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a,isNewDoc:o,previousDocName:s,onNavigateBack:c,onRecycle:l,serverRestartRecovery:u}=e,d;t[0]!==n.docName||t[1]!==u?(d=vj(n.docName,u),t[0]=n.docName,t[1]=u,t[2]=d):d=t[2];let f=d,p=bw(n.docName)===`conflict`,m;t[3]===n.docName?m=t[4]:(m=yn(n.docName),t[3]=n.docName,t[4]=m);let h=m,g;t[5]===n.docName?g=t[6]:(g=()=>{let e=document.createElement(`div`);return e.setAttribute(`data-ok-editor-portal`,n.docName),e.style.display=`contents`,e},t[5]=n.docName,t[6]=g);let[_]=(0,Q.useState)(g),v=n.provider.document.getText(`source`).length,[y,b]=(0,Q.useState)(i),[x,S]=(0,Q.useState)(!i),C,w;t[7]!==i||t[8]!==y||t[9]!==x?(C=()=>{i&&!y?b(!0):!i&&!x&&S(!0)},w=[i,y,x],t[7]=i,t[8]=y,t[9]=x,t[10]=C,t[11]=w):(C=t[10],w=t[11]),(0,Q.useEffect)(C,w);let T=fj({ytextLength:v,isSourceMode:i,visitedSource:y,visitedVisual:x}),E=(0,Q.useRef)(``),D=`${T.isLarge}-${T.renderSource}-${T.renderVisual}`,O,k;t[12]!==n.docName||t[13]!==T.isLarge||t[14]!==T.renderSource||t[15]!==T.renderVisual||t[16]!==D||t[17]!==i||t[18]!==v?(O=()=>{E.current!==D&&(E.current=D,T.isLarge&&ml(`ok/activity/defer-mount`,{docName:n.docName,ytextLength:v,isSourceMode:i,renderSource:T.renderSource,renderVisual:T.renderVisual}))},k=[D,T.isLarge,T.renderSource,T.renderVisual,n.docName,v,i],t[12]=n.docName,t[13]=T.isLarge,t[14]=T.renderSource,t[15]=T.renderVisual,t[16]=D,t[17]=i,t[18]=v,t[19]=O,t[20]=k):(O=t[19],k=t[20]),(0,Q.useEffect)(O,k);let A;t[21]===n.docName?A=t[22]:(A=()=>Pe(n.docName),t[21]=n.docName,t[22]=A);let[j]=(0,Q.useState)(A),M=j?.html??null,[N,P]=(0,Q.useState)(!1),F,I;t[23]!==n.docName||t[24]!==T.isLarge||t[25]!==T.renderSource||t[26]!==T.renderVisual||t[27]!==N||t[28]!==i||t[29]!==v?(I=()=>{pj({isLarge:T.isLarge,renderSource:T.renderSource,renderVisual:T.renderVisual,hasEmittedFirstToggle:N})&&(ml(`ok/cold/first-toggle`,{docName:n.docName,mountId:xt(n.docName),ytextLength:v,modeEnteredFirst:i?`source`:`visual`}),P(!0))},F=[N,T.isLarge,T.renderSource,T.renderVisual,n.docName,v,i],t[23]=n.docName,t[24]=T.isLarge,t[25]=T.renderSource,t[26]=T.renderVisual,t[27]=N,t[28]=i,t[29]=v,t[30]=F,t[31]=I):(F=t[30],I=t[31]),(0,Q.useEffect)(I,F);let L=r?`visible`:`hidden`,R=`editor:${n.docName}`,z=j?.scrollTop,B;t[32]!==a||t[33]!==n||t[34]!==T.renderSource||t[35]!==T.renderVisual||t[36]!==r||t[37]!==p||t[38]!==h||t[39]!==o||t[40]!==i||t[41]!==c||t[42]!==l||t[43]!==_||t[44]!==s||t[45]!==f||t[46]!==M?(B=f?(0,Z.jsx)(wj,{view:f}):(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsx)(ij,{activeDocName:n.docName,previousDocName:s,onNavigateBack:c,onRecycle:l,children:(0,Z.jsx)(Q.Suspense,{fallback:M?(0,Z.jsx)(Ej,{html:M}):(0,Z.jsx)(cx,{}),children:(0,Z.jsx)(XA,{docName:n.docName,provider:n.provider,children:p?(0,Z.jsx)(YA,{docName:n.docName,provider:n.provider}):h?(0,Z.jsx)(uj,{docName:n.docName,provider:n.provider,isSourceMode:i}):(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[!i&&(Dn(n.docName)||Ce(n.docName)?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(lj,{docName:n.docName,provider:n.provider})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(oj,{provider:n.provider}),(0,Z.jsx)(Zi,{provider:n.provider})]})),(0,Z.jsxs)(`div`,{className:`relative flex-1`,children:[T.renderSource?(0,Z.jsx)(`div`,{className:i?`h-full`:`ok-mode-hidden h-full`,children:(0,Z.jsx)(Cj,{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a})}):null,T.renderVisual?(0,Z.jsx)(`div`,{className:i?`ok-mode-hidden h-full`:`h-full`,children:(0,Z.jsx)(GO,{provider:n.provider,placeholder:a,isSourceMode:i,portalTarget:_},`${n.docName}-${String(o)}-${n.poolEventId}`)}):null]})]})})})})}),t[32]=a,t[33]=n,t[34]=T.renderSource,t[35]=T.renderVisual,t[36]=r,t[37]=p,t[38]=h,t[39]=o,t[40]=i,t[41]=c,t[42]=l,t[43]=_,t[44]=s,t[45]=f,t[46]=M,t[47]=B):B=t[47];let V;t[48]!==r||t[49]!==z||t[50]!==B?(V=(0,Z.jsx)(Sj,{isActive:r,initialScrollTop:z,children:B}),t[48]=r,t[49]=z,t[50]=B,t[51]=V):V=t[51];let H;return t[52]!==L||t[53]!==R||t[54]!==V?(H=(0,Z.jsx)(Q.Activity,{mode:L,name:R,children:V}),t[52]=L,t[53]=R,t[54]=V,t[55]=H):H=t[55],H}function Oj(e){let t=e.endsWith(`rem`)?`rem`:`px`;return{value:Number.parseFloat(e),unit:t}}function kj(e){let{value:t,unit:n}=Oj(e);return n===`rem`?t*16:t}function Aj(e,t){return`${t===`rem`?e.toFixed(1):Math.round(e)}${t}`}var jj=3600*24*7;function Mj(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?Nj:m,O=g===void 0?jj: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=kj(b),te;t[6]===x?te=t[7]:(te=kj(x),t[6]=x,t[7]=te);let ne=te,re;t[8]!==E||t[9]!==k?(re=function(e){E&&(P.current=!0,j.current=H.current?0:kj(V.current),M.current=e.clientX,I.current=e.clientX,F.current=null,L.current=!1,R.current=0,z.current=0,B.current=k&&A.current?A.current.getBoundingClientRect():null,e.preventDefault())},t[8]=E,t[9]=k,t[10]=re):re=t[10];let ie=re,q,ae;t[11]!==w||t[12]!==v||t[13]!==C||t[14]!==S||t[15]!==T||t[16]!==k||t[17]!==ne||t[18]!==ee||t[19]!==i||t[20]!==a||t[21]!==D||t[22]!==O||t[23]!==h?(q=()=>{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}=Oj(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(ne,t)),u=Aj(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(ne,u)),f=Aj(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)}},ae=[i,a,D,ee,ne,k,C,w,T,S,h,O,v],t[11]=w,t[12]=v,t[13]=C,t[14]=S,t[15]=T,t[16]=k,t[17]=ne,t[18]=ee,t[19]=i,t[20]=a,t[21]=D,t[22]=O,t[23]=h,t[24]=q,t[25]=ae):(q=t[24],ae=t[25]),(0,Q.useEffect)(q,ae);let oe;return t[26]===ie?oe=t[27]:(oe={dragRef:A,isDragging:N,handleMouseDown:ie},t[26]=ie,t[27]=oe),oe}function Nj(){}var Pj=3600*24*7,Fj=`18rem`,Ij=`3rem`,Lj=`app-file-sidebar`,Rj=`14.625rem`,zj=`32rem`,Bj=`sidebar_width`,Vj=/^\d+(?:\.\d+)?(?:rem|px)$/,Hj=Q.createContext(null);function Uj(e){if(typeof document>`u`)return e;let t=document.cookie.split(`; `).find(e=>e.startsWith(`${Bj}=`))?.split(`=`)[1];if(!t)return e;let n;try{n=decodeURIComponent(t)}catch{return e}return Vj.test(n)?n:e}function Wj(){let e=Q.use(Hj);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function Gj(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?Fj:c,[u]=Q.useState(qj),d;t[8]===u?d=t[9]:(d=()=>Aw(u,window.innerWidth,`left`),t[8]=u,t[9]=d);let[f,p]=Q.useState(d),m;t[10]===l?m=t[11]:(m=()=>Uj(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=Lw();return zw(`left`,Aw(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),Bw(`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(Kj)},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: ${Dw}px)`),t=()=>{let e=Aw(u,window.innerWidth,`left`);p(e),C(zw(`left`,e,Lw())===`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(Lj)?.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=>{jl(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":Ij,...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)(Hj.Provider,{value:H,children:K}),t[55]=H,t[56]=K,t[57]=ee):ee=t[57],ee}function Kj(e){return!e}function qj(){return nr()}function Jj(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}=kt(),{state:f,isDraggingRail:p}=Wj();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:Lj,"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 Yj(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}=kt(),{toggleSidebar:o,state:s}=Wj(),c,l,u,d,f,p,m,h;if(t[4]!==a||t[5]!==s){let e=Ml(`toggle-files-sidebar`);c=Jr,l=`trigger`,u=`sidebar-trigger`,d=`ghost`,f=`icon-sm`,p=s===`expanded`,m=Lj,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)(Je,{}):(0,Z.jsx)(mf,{}),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 Xj(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}=kt(),{toggleSidebar:u,setWidth:d,state:f,width:p,setIsDraggingRail:m}=Wj(),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:Rj,maxResizeWidth:zj,setIsDraggingRail:m,widthCookieName:Bj,widthCookieMaxAge:Pj},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}=Mj(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 Zj(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}=Wj(),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 Qj(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 $j(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 eM(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 tM(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 nM(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?Kr:`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 rM(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?Kr:`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 iM(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 aM(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 oM(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 sM=qr(`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 cM(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?Kr:`button`,{state:m}=Wj(),h;t[8]!==n||t[9]!==f||t[10]!==d?(h=X(sM({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)(Ts,{asChild:!0,children:_}),t[20]=_,t[21]=v);let y=m!==`collapsed`,b;t[22]!==y||t[23]!==c?(b=(0,Z.jsx)(Es,{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)(Os,{children:[v,b]}),t[25]=v,t[26]=b,t[27]=x):x=t[27],x}function lM(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?Kr:`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 uM(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 dM(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 fM(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?Kr:`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 pM(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 mM(){let e=await fetch(`/api/server-info`,{signal:AbortSignal.timeout(5e3)});if(!e.ok)return null;let t=await e.json(),n=ar.safeParse(t);return n.success?n.data.currentBranch??null:null}var hM=typeof window>`u`?{getSnapshot:()=>null,subscribe:()=>()=>{}}:pM({fetchBranch:mM,subscribeToEvent:cl}),gM=hM.subscribe,_M=hM.getSnapshot;function vM(){return(0,Q.useSyncExternalStore)(gM,_M,_M)}function yM(){let e=(0,$.c)(6),t=vM(),n=ua(),{state:r}=Wj(),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&&Ba(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 bM(e){let t=(0,$.c)(30),{stats:n,selectionStats:r,showStats:i,composerBadge:a,reserveRightGutter:o}=e,s=i===void 0?!0:i,c=o===void 0?!1:o,{_:l}=kt(),u=yM();if(!s&&u===null&&a==null)return null;let d=r??n,f=r!=null,{words:p,chars:m,tokens:h}=d,g;t[0]!==l||t[1]!==f||t[2]!==s?(g=l(s?f?{id:`Bv5a9_`}:{id:`L1ZE3M`}:{id:`goO4Ll`}),t[0]=l,t[1]=f,t[2]=s,t[3]=g):g=t[3];let _=c&&`pr-12`,v;t[4]===_?v=t[5]:(v=X(`relative flex h-6 shrink-0 items-center justify-between gap-3 bg-background px-3 text-2xs text-muted-foreground`,_),t[4]=_,t[5]=v);let y;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-full h-2 bg-linear-to-t from-background to-transparent`}),t[6]=y):y=t[6];let b;t[7]!==l||t[8]!==a?(b=a?(0,Z.jsxs)(Jr,{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)(jo,{className:`size-3`,"aria-hidden":!0}),l({id:`xWEvuo`}),(0,Z.jsx)(N,{className:`size-3`,"aria-hidden":!0})]}):null,t[7]=l,t[8]=a,t[9]=b):b=t[9];let x;t[10]===u?x=t[11]:(x=u===null?null:(0,Z.jsx)(xM,{identity:u}),t[10]=u,t[11]=x);let S;t[12]===x?S=t[13]:(S=(0,Z.jsx)(`span`,{className:`flex min-w-0 items-center gap-3`,children:x}),t[12]=x,t[13]=S);let C;t[14]!==l||t[15]!==d.chars||t[16]!==d.tokens||t[17]!==d.words||t[18]!==m||t[19]!==f||t[20]!==s||t[21]!==h||t[22]!==p?(C=s?(0,Z.jsxs)(`span`,{className:`flex shrink-0 items-center gap-3`,children:[f?(0,Z.jsx)(`span`,{className:`font-medium text-foreground/70`,"data-testid":`editor-footer-selected-label`,children:l({id:`ylXj1N`})}):null,(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:d.words.toLocaleString()}),` `,(0,Z.jsx)(J,{id:`gljvbT`,values:{words:p}})]}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:d.chars.toLocaleString()}),` `,(0,Z.jsx)(J,{id:`d5rK4X`,values:{chars:m}})]}),(0,Z.jsxs)(`span`,{children:[d.tokens>0?`~`:``,(0,Z.jsx)(`span`,{className:`tabular-nums`,children:d.tokens.toLocaleString()}),` `,(0,Z.jsx)(J,{id:`uynXup`,values:{tokens:h}})]})]}):null,t[14]=l,t[15]=d.chars,t[16]=d.tokens,t[17]=d.words,t[18]=m,t[19]=f,t[20]=s,t[21]=h,t[22]=p,t[23]=C):C=t[23];let w;return t[24]!==C||t[25]!==g||t[26]!==v||t[27]!==b||t[28]!==S?(w=(0,Z.jsxs)(`section`,{"aria-label":g,className:v,children:[y,b,S,C]}),t[24]=C,t[25]=g,t[26]=v,t[27]=b,t[28]=S,t[29]=w):w=t[29],w}function xM(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)(Os,{children:[(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(`span`,{tabIndex:0,className:`truncate`,"data-testid":`editor-footer-project-name`,children:r})}),(0,Z.jsx)(Es,{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)(zo,{"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 SM(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}=kt(),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 CM(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 wM(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 TM(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 EM(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)(na,{}),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 DM=1,OM=2,kM=4;function AM(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=er(n),u=e?e.kind===`template`?e.folder.split(`/`).filter(Boolean):[]:ut(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>kM?[...u.slice(0,DM).map((e,t)=>d(e,t)),{kind:`ellipsis`,hidden:u.slice(DM,-OM)},...u.slice(-OM).map((e,t)=>d(e,u.length-OM+t))]:u.map((e,t)=>d(e,t));a=SM,t[8]===r?c=t[9]:(c=X(`flex min-w-0 items-center`,r),t[8]=r,t[9]=c),i=CM,o=`min-w-0 flex-nowrap gap-1 overflow-hidden text-muted-foreground/70 text-xs`,s=f.map(jM)}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 jM(e,t){let n=e.kind===`segment`?e.key:`ellipsis`;return(0,Z.jsxs)(Q.Fragment,{children:[t>0&&(0,Z.jsx)(EM,{className:`shrink-0 text-muted-foreground/70 [&>svg]:size-3`}),e.kind===`ellipsis`?(0,Z.jsxs)(wM,{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)(zd,{className:`size-3.5`})}),(0,Z.jsx)(`span`,{className:`sr-only`,children:e.hidden.join(` / `)})]}):(0,Z.jsx)(wM,{className:`min-w-0`,children:(0,Z.jsx)(TM,{current:!1,className:`min-w-0 truncate font-normal text-muted-foreground/70`,title:e.value,children:e.value})})]},n)}var MM={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`},NM=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`,...MM,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},PM=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)(NM,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i},FM=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)(NM,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i};function IM(e){let t=(0,$.c)(29),{isSourceMode:n,onModeChange:r,sourceDisabled:i}=e,a=i===void 0?!1:i,{_:o}=kt(),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)(Ts,{children:(0,Z.jsx)(FM,{className:`size-4`})}),t[6]=d):d=t[6];let f;t[7]===u?f=t[8]:(f=(0,Z.jsx)(Ic,{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)(Es,{side:`bottom`,children:(0,Z.jsx)(J,{id:`Mb_20S`})}),t[9]=p):p=t[9];let m;t[10]===f?m=t[11]:(m=(0,Z.jsxs)(Os,{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)(PM,{className:`size-4`}),t[14]=g):g=t[14];let _;t[15]!==a||t[16]!==h?(_=(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(`div`,{children:(0,Z.jsx)(Ic,{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)(Es,{side:`bottom`,children:a?(0,Z.jsx)(J,{id:`G-JBA1`}):(0,Z.jsx)(J,{id:`u6Hp4N`})}),t[18]=a,t[19]=v);let y;t[20]!==_||t[21]!==v?(y=(0,Z.jsxs)(Os,{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)(Rc,{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 LM=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{SkillEditorActions:e}=await import(`./SkillEditorActions-CYONKTh4.js`);return{SkillEditorActions:e}},__vite__mapDeps([100,1,10,3,11,6,7,13,82,20,21,15,16,17,61,62,18,64,66,36,37,65,87,12,83,67,57,71,88,58,40,76,73,56]),import.meta.url)).SkillEditorActions}));function RM(e){let t=(0,$.c)(82),{activeDocName:n,isSourceMode:r,sourceDisabled:i,onModeChange:a,showAddPropertyButton:o,onAddProperty:s,isPanelCollapsed:c,onTogglePanel:l,reserveRightGutter:u}=e,d=u===void 0?!1:u,{_:f}=kt(),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=Al(`toggle-document-panel`),t[0]=p):p=t[0];let m=p,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k;if(t[1]!==f||t[2]!==n||t[3]!==c||t[4]!==r||t[5]!==s||t[6]!==a||t[7]!==l||t[8]!==d||t[9]!==o||t[10]!==i){let e=Ml(`toggle-document-panel`),u;t[26]===n?u=t[27]:(u=n?er(n):null,t[26]=n,t[27]=u);let p=u,m;t[28]===n?m=t[29]:(m=n?Ce(n):null,t[28]=n,t[29]=m);let A=m,j;t[30]!==p||t[31]!==A?(j=p?.kind===`skill`?{scope:p.scope,name:p.name}:A?{scope:`project`,name:A}:null,t[30]=p,t[31]=A,t[32]=j):j=t[32];let M=j;b=`editor-toolbar`,x=`pointer-events-none absolute inset-x-0 top-0 z-10`;let N;t[33]!==n||t[34]!==M?(N=M?null:(0,Z.jsx)(AM,{docName:n}),t[33]=n,t[34]=M,t[35]=N):N=t[35];let P;t[36]===N?P=t[37]:(P=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex min-w-0 items-center`,children:N}),t[36]=N,t[37]=P);let F;t[38]!==r||t[39]!==a||t[40]!==i?(F=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex justify-center`,children:(0,Z.jsx)(IM,{isSourceMode:r,onModeChange:a,sourceDisabled:i})}),t[38]=r,t[39]=a,t[40]=i,t[41]=F):F=t[41],t[42]!==P||t[43]!==F?(S=(0,Z.jsx)(`div`,{className:`editor-content-aligned bg-background py-2`,children:(0,Z.jsxs)(`div`,{className:`grid grid-cols-3 items-center`,children:[P,F]})}),t[42]=P,t[43]=F,t[44]=S):S=t[44];let I=d&&`pr-9`;t[45]===I?_=t[46]:(_=X(`pointer-events-auto absolute top-0 right-0 flex items-center justify-end gap-1 py-2 pr-2`,I),t[45]=I,t[46]=_),t[47]===M?v=t[48]:(v=M?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(LM,{scope:M.scope,name:M.name})}):null,t[47]=M,t[48]=v),t[49]!==f||t[50]!==s||t[51]!==o?(y=o&&(0,Z.jsxs)(Os,{children:[(0,Z.jsx)(Jr,{variant:`ghost`,size:`icon`,"aria-label":f({id:`81H_23`}),onClick:s,"data-testid":`add-properties-button`,asChild:!0,children:(0,Z.jsx)(Ts,{children:(0,Z.jsx)(af,{})})}),(0,Z.jsx)(Es,{side:`bottom`,children:(0,Z.jsx)(J,{id:`81H_23`})})]}),t[49]=f,t[50]=s,t[51]=o,t[52]=y):y=t[52],g=Os,h=Jr,C=``,w=`ghost`,T=`icon`,E=l,D=!c,O=`doc-panel`,k=f(c?{id:`u7H-Wn`,values:{panelShortcutLabel:e}}:{id:`2hpdRq`,values:{panelShortcutLabel:e}}),t[1]=f,t[2]=n,t[3]=c,t[4]=r,t[5]=s,t[6]=a,t[7]=l,t[8]=d,t[9]=o,t[10]=i,t[11]=h,t[12]=g,t[13]=_,t[14]=v,t[15]=y,t[16]=b,t[17]=x,t[18]=S,t[19]=C,t[20]=w,t[21]=T,t[22]=E,t[23]=D,t[24]=O,t[25]=k}else h=t[11],g=t[12],_=t[13],v=t[14],y=t[15],b=t[16],x=t[17],S=t[18],C=t[19],w=t[20],T=t[21],E=t[22],D=t[23],O=t[24],k=t[25];let A;t[53]===c?A=t[54]:(A=(0,Z.jsx)(Ts,{children:c?(0,Z.jsx)(gf,{}):(0,Z.jsx)(hf,{})}),t[53]=c,t[54]=A);let j;t[55]!==h||t[56]!==A||t[57]!==C||t[58]!==w||t[59]!==T||t[60]!==E||t[61]!==D||t[62]!==O||t[63]!==k?(j=(0,Z.jsx)(h,{"data-doc-panel-toggle":C,variant:w,size:T,onClick:E,"aria-expanded":D,"aria-controls":O,"aria-label":k,asChild:!0,children:A}),t[55]=h,t[56]=A,t[57]=C,t[58]=w,t[59]=T,t[60]=E,t[61]=D,t[62]=O,t[63]=k,t[64]=j):j=t[64];let M;t[65]===c?M=t[66]:(M=(0,Z.jsx)(Es,{side:`bottom`,children:c?(0,Z.jsx)(J,{id:`KFdXwz`,values:{panelShortcut:m}}):(0,Z.jsx)(J,{id:`MsuXaI`,values:{panelShortcut:m}})}),t[65]=c,t[66]=M);let N;t[67]!==g||t[68]!==j||t[69]!==M?(N=(0,Z.jsxs)(g,{children:[j,M]}),t[67]=g,t[68]=j,t[69]=M,t[70]=N):N=t[70];let P;t[71]!==_||t[72]!==v||t[73]!==y||t[74]!==N?(P=(0,Z.jsxs)(`div`,{className:_,children:[v,y,N]}),t[71]=_,t[72]=v,t[73]=y,t[74]=N,t[75]=P):P=t[75];let F;t[76]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none h-2 bg-linear-to-b from-background to-transparent`}),t[76]=F):F=t[76];let I;return t[77]!==b||t[78]!==x||t[79]!==S||t[80]!==P?(I=(0,Z.jsxs)(`div`,{"data-testid":b,className:x,children:[S,P,F]}),t[77]=b,t[78]=x,t[79]=S,t[80]=P,t[81]=I):I=t[81],I}function zM(e){let{activeDocName:t,deferredActiveDocName:n,mountResolved:r,syncResolved:i}=e;return t===null||t===n?!1:!(r&&i)}function BM(e){let{currentLayout:t,containerPx:n,pinnedPx:r,residualId:i}=e;if(n<=0||!(i in t))return t;let a={...t},o=0;for(let[e,i]of Object.entries(r)){if(!(e in t))continue;let r=i/n*100;a[e]=r,o+=r}let s=0;for(let[e,n]of Object.entries(t))e===i||e in r||(s+=n);let c=100-o-s;return c<0?t:(a[i]=c,a)}var VM=`ok-terminal-height-v1`,HM=1/3,UM=.5;function WM(e){return Math.max(120,Math.round((Number.isFinite(e)?e:0)*UM))}function GM(e){let t=Number.isFinite(e)?e:0;return t<=0?240:Math.round(t*HM)}function KM(e,t){let n=WM(t);return Number.isFinite(e)?e<120?120:e>n?n:Math.round(e):Math.min(GM(t),n)}function qM(){return typeof window>`u`?0:window.innerHeight}function JM(e,t){try{let n=e??localStorage,r=t??qM(),i=n.getItem(VM);if(i==null)return KM(GM(r),r);let a=Number.parseInt(i,10);return KM(Number.isFinite(a)?a:GM(r),r)}catch{return 240}}function YM(e,t,n){try{let r=t??localStorage,i=n??qM();r.setItem(VM,String(KM(e,i)))}catch{}}function XM(){try{return typeof localStorage>`u`?240:JM()}catch{return 240}}function ZM(e){let t=(0,$.c)(19),{dockPosition:n,onReveal:r,className:i}=e,{_:a}=kt(),o=n===`right`,s;t[0]===a?s=t[1]:(s=a({id:`0SBTff`}),t[0]=a,t[1]=s);let c=s,l=o?`rounded-r-none border-r-0`:`rounded-b-none border-b-0`,u;t[2]!==i||t[3]!==l?(u=X(`absolute z-20 shrink-0 bg-background text-muted-foreground shadow-sm hover:text-foreground`,l,i),t[2]=i,t[3]=l,t[4]=u):u=t[4];let d;t[5]===o?d=t[6]:(d=o?(0,Z.jsx)(ta,{"aria-hidden":`true`}):(0,Z.jsx)(N,{"aria-hidden":`true`}),t[5]=o,t[6]=d);let f;t[7]!==n||t[8]!==c||t[9]!==r||t[10]!==u||t[11]!==d?(f=(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(Jr,{type:`button`,variant:`outline`,size:`icon-sm`,"aria-label":c,"data-terminal-reveal":n,onClick:r,className:u,children:d})}),t[7]=n,t[8]=c,t[9]=r,t[10]=u,t[11]=d,t[12]=f):f=t[12];let p=o?`left`:`top`,m;t[13]!==c||t[14]!==p?(m=(0,Z.jsx)(Es,{side:p,sideOffset:8,children:c}),t[13]=c,t[14]=p,t[15]=m):m=t[15];let h;return t[16]!==f||t[17]!==m?(h=(0,Z.jsxs)(Os,{children:[f,m]}),t[16]=f,t[17]=m,t[18]=h):h=t[18],h}var QM=`terminal-dock-panel`;function $M(e){let t=(0,$.c)(44),{children:n,visible:r,onVisibleChange:i,dockPosition:a,onBottomContainer:o,onEditorRegion:s,onReveal:c}=e,l=a===void 0?`bottom`:a,{resolvedTheme:u}=sn(),d=Gb(),[f,p]=(0,Q.useState)(!r),m;t[0]===u?m=t[1]:(m=Au(u),t[0]=u,t[1]=m);let h=m.background,g=r&&l===`bottom`,_=!r&&l===`bottom`&&c!=null,[v]=(0,Q.useState)(eN),y=(0,Q.useRef)(v),[b,x]=(0,Q.useState)(!1),S=(0,Q.useRef)(!1),C=(0,Q.useRef)(null),w;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(w=function(e){C.current!=null&&clearTimeout(C.current),C.current=setTimeout(()=>{YM(e),C.current=null},100)},t[2]=w):w=t[2];let T=w,E=(0,Q.useRef)(null),D,O;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(D=()=>()=>{C.current!=null&&clearTimeout(C.current),E.current!=null&&(window.removeEventListener(`pointerup`,E.current),E.current=null)},O=[],t[3]=D,t[4]=O):(D=t[3],O=t[4]),(0,Q.useEffect)(D,O);let k,A;t[5]!==g||t[6]!==d?(k=()=>{let e=d.current;e!=null&&(g?e.resize(`${y.current}px`):e.collapse())},A=[g,d],t[5]=g,t[6]=d,t[7]=k,t[8]=A):(k=t[7],A=t[8]),(0,Q.useEffect)(k,A);let j=b||void 0,M;t[9]!==c||t[10]!==_?(M=_&&c?(0,Z.jsx)(ZM,{dockPosition:`bottom`,onReveal:c,className:`right-3 bottom-0`}):null,t[9]=c,t[10]=_,t[11]=M):M=t[11];let N;t[12]!==n||t[13]!==s||t[14]!==M?(N=(0,Z.jsx)(YC,{minSize:`5%`,className:`flex min-h-0 flex-col`,children:(0,Z.jsxs)(`div`,{ref:s,tabIndex:-1,className:`relative flex h-full min-h-0 flex-col outline-none`,children:[n,M]})}),t[12]=n,t[13]=s,t[14]=M,t[15]=N):N=t[15];let P=!g,F;t[16]===g?F=t[17]:(F=()=>{if(!g)return;x(!0),S.current=!0;let e=()=>{x(!1),S.current=!1,window.removeEventListener(`pointerup`,e),E.current=null};E.current=e,window.addEventListener(`pointerup`,e)},t[16]=g,t[17]=F);let I;t[18]!==g||t[19]!==P||t[20]!==F?(I=(0,Z.jsx)(XC,{withHandle:g,disabled:P,onPointerDown:F}),t[18]=g,t[19]=P,t[20]=F,t[21]=I):I=t[21];let L;t[22]===h?L=t[23]:(L={backgroundColor:h},t[22]=h,t[23]=L);let R=g?`${v}px`:0,z;t[24]!==i||t[25]!==r?(z=e=>{let t=e.asPercentage===0;p(t),S.current&&(t&&r?i(!1):!t&&!r&&i(!0),e.inPixels>0&&(y.current=e.inPixels,T(e.inPixels)))},t[24]=i,t[25]=r,t[26]=z):z=t[26];let B=!b&&`transition-[flex-grow] duration-150 ease-out motion-reduce:transition-none motion-reduce:duration-0`,V;t[27]===B?V=t[28]:(V=X(`flex flex-col`,B),t[27]=B,t[28]=V);let H;t[29]===o?H=t[30]:(H=(0,Z.jsx)(`div`,{ref:o,className:`flex min-h-0 flex-1 flex-col overflow-hidden`}),t[29]=o,t[30]=H);let U;t[31]!==f||t[32]!==d||t[33]!==L||t[34]!==R||t[35]!==z||t[36]!==V||t[37]!==H?(U=(0,Z.jsx)(YC,{id:QM,style:L,panelRef:d,defaultSize:R,minSize:`120px`,maxSize:`95%`,collapsible:!0,collapsedSize:0,onResize:z,inert:f,className:V,children:H}),t[31]=f,t[32]=d,t[33]=L,t[34]=R,t[35]=z,t[36]=V,t[37]=H,t[38]=U):U=t[38];let W;return t[39]!==N||t[40]!==I||t[41]!==U||t[42]!==j?(W=(0,Z.jsxs)(JC,{orientation:`vertical`,className:`min-h-0 flex-1`,"data-dragging":j,children:[N,I,U]}),t[39]=N,t[40]=I,t[41]=U,t[42]=j,t[43]=W):W=t[43],W}function eN(){return XM()}var tN=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-CxxS8nFq.js`),__vite__mapDeps([43,1,2,44,45,46,11,47,48,49,50,51,52,53,54,21,10,3,55,40,7,56,12,6,13,57,58,39,16,33,34,35,59,20,15,4,60,17,61,62,19,63,64,65,66,32,36,37,38,67,68,69,70,71,72,73,74,75,76]),import.meta.url)).ActivityModeContent})),nN=`300px`,rN=`600px`,iN=new Set([`doc-panel`,`terminal-column`,`agent-panel`]);function aN(e){let t=(0,$.c)(5),n;t[0]===e?n=t[1]:(n=(0,Z.jsx)(sN,{...e}),t[0]=e,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(oN,{}),t[2]=r):r=t[2];let i;return t[3]===n?i=t[4]:(i=(0,Z.jsx)(hl,{name:`editor-area`,children:(0,Z.jsxs)(Ki,{children:[n,r]})}),t[3]=n,t[4]=i),i}function oN(){let e=(0,$.c)(5),t=Ua(),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)(UC,{open:t.open,onOpenChange:n}),e[2]=t.open,e[3]=n,e[4]=r):r=e[4],r}function sN(e){let t=(0,$.c)(248),{editorMode:n,onModeChange:r,activeTab:i,onActiveTabChange:a,terminalBridge:o,terminalVisible:s,onTerminalVisibleChange:c,terminalDock:l,onTerminalPlacement:u,onRevealTerminal:d}=e,f=s===void 0?!1:s,p=l===void 0?`right`:l,{_:m}=kt(),{resolvedTheme:h}=sn(),g;t[0]===h?g=t[1]:(g=Au(h),t[0]=h,t[1]=g);let _=g.background,{activeDocName:v,activeProvider:y,activeTarget:b,recycleDocument:x,docPanelMode:S,docPanelAgentId:C,docPanelExpandSignal:w}=Ye(),{openDocumentTransition:T}=at(),{requestAddProperty:E}=Ui(),D=vw(y,v),O=xw(v,n===`source`?`source`:`wysiwyg`),k=Kw(y),A=k===`connected`||k===`synced`,j=bw(v)===`conflict`,[M,N]=(0,Q.useState)(!1),P,F;t[2]!==y||t[3]!==M?(P=()=>{y!=null&&!M&&N(!0)},F=[y,M],t[2]=y,t[3]=M,t[4]=P,t[5]=F):(P=t[4],F=t[5]),(0,Q.useEffect)(P,F);let I=(0,Q.useDeferredValue)(v),L=b?.kind===`missing`,R=!!v&&b?.kind!==`folder`,z;t[6]!==m||t[7]!==L?(z=L?m({id:`K-a33w`}):void 0,t[6]=m,t[7]=L,t[8]=z):z=t[8];let B=z,V=(0,Q.useSyncExternalStore)($r.subscribe,$r.getSnapshot,$r.getSnapshot),H;t[9]!==b||t[10]!==V?(H=ri(b,V),t[9]=b,t[10]=V,t[11]=H):H=t[11];let U=H,[W]=(0,Q.useState)(fN),G=W!==null,K;t[12]===W?K=t[13]:(K=()=>Aw(W,window.innerWidth,`right`),t[12]=W,t[13]=K);let[ee,te]=(0,Q.useState)(K),ne=(0,Q.useRef)(ee),re,ie;t[14]===ee?(re=t[15],ie=t[16]):(ie=()=>{ne.current=ee},re=[ee],t[14]=ee,t[15]=re,t[16]=ie),(0,Q.useEffect)(ie,re);let q=Gb(),ae=Gb(),oe;t[17]===ee?oe=t[18]:(oe=()=>zw(`right`,ee,Lw())===`collapsed`,t[17]=ee,t[18]=oe);let[se]=(0,Q.useState)(oe),[ce,le]=(0,Q.useState)(se),ue=(0,Q.useRef)(ce),[de,fe]=(0,Q.useState)(null),[pe,me]=(0,Q.useState)(null),[he,ge]=(0,Q.useState)(null),_e=p===`right`,ve=_e?`right`:`bottom`,ye=o!=null&&_e&&f,xe=o!=null&&!f&&d!=null,Se=xe&&!_e,Ce=xe&&_e,Te=_e&&f&&de!=null,Ee=Te?de:pe,De=(_e?Te:f)&&Ee!=null,Oe,ke;t[19]!==Ee||t[20]!==u||t[21]!==ve||t[22]!==he||t[23]!==De?(Oe=()=>{u?.({container:Ee,isShowing:De,dockPosition:ve,editorRegion:he})},ke=[u,Ee,De,ve,he],t[19]=Ee,t[20]=u,t[21]=ve,t[22]=he,t[23]=De,t[24]=Oe,t[25]=ke):(Oe=t[24],ke=t[25]),(0,Q.useEffect)(Oe,ke);let Ae,je;t[26]===ce?(Ae=t[27],je=t[28]):(Ae=()=>{ue.current=ce},je=[ce],t[26]=ce,t[27]=Ae,t[28]=je),(0,Q.useEffect)(Ae,je);let[Me,Ne]=(0,Q.useState)(!1),Pe=(0,Q.useRef)(!1),[Fe]=(0,Q.useState)(dN),Ie=(0,Q.useRef)(Fe),Le=(0,Q.useRef)(null),Re;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(Re=function(e){Le.current!=null&&clearTimeout(Le.current),Le.current=setTimeout(()=>{Tw(e),Le.current=null},100)},t[29]=Re):Re=t[29];let ze=Re,[Be]=(0,Q.useState)(uN),Ve=(0,Q.useRef)(Be),[He,Ue]=(0,Q.useState)(!1),We=(0,Q.useRef)(!1),Ge=(0,Q.useRef)(null),Ke;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(Ke=function(e){Ge.current!=null&&clearTimeout(Ge.current),Ge.current=setTimeout(()=>{Ww(e),Ge.current=null},100)},t[30]=Ke):Ke=t[30];let qe=Ke,Je,Xe;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(Je=()=>()=>{Le.current!=null&&clearTimeout(Le.current),Ge.current!=null&&clearTimeout(Ge.current)},Xe=[],t[31]=Je,t[32]=Xe):(Je=t[31],Xe=t[32]),(0,Q.useEffect)(Je,Xe);let[Ze,Qe]=(0,Q.useState)(null),$e=(0,Q.useRef)(null),et=Bb(),tt=(0,Q.useRef)(ye),nt,rt;t[33]===ye?(nt=t[34],rt=t[35]):(nt=()=>{tt.current=ye},rt=[ye],t[33]=ye,t[34]=nt,t[35]=rt),(0,Q.useEffect)(nt,rt);let it;t[36]!==q||t[37]!==ae?(it=function(){for(let e of[q,ae]){let t=e.current?.getSize();if(t!=null&&t.asPercentage>1&&t.inPixels>0)return t.inPixels/t.asPercentage*100}let e=$e.current;return e!=null&&e.offsetWidth>0?e.offsetWidth:null},t[36]=q,t[37]=ae,t[38]=it):it=t[38];let ot=it,st;t[39]!==et||t[40]!==ot?(st=function(e){if(Pe.current||We.current)return;let t=et.current;if(t!=null)try{let n=ot();if(n==null)return;let r=t.getLayout(),i=Object.keys(r);if(i.length===0)return;let a=i.find(lN);if(a==null)return;let o={};if(`doc-panel`in r&&(o[`doc-panel`]=e?0:Ie.current),`terminal-column`in r&&(o[`terminal-column`]=Ve.current),Object.keys(o).length===0)return;let s=BM({currentLayout:r,containerPx:n,pinnedPx:o,residualId:a});s!==r&&t.setLayout(s)}catch{}},t[39]=et,t[40]=ot,t[41]=st):st=t[41];let ct=st,lt=(0,Q.useRef)(ct),ut;t[42]===ct?ut=t[43]:(ut=()=>{lt.current=ct},t[42]=ct,t[43]=ut),(0,Q.useEffect)(ut);let dt;t[44]!==ct||t[45]!==q?(dt=function(){tt.current?ct(!1):q.current?.expand()},t[44]=ct,t[45]=q,t[46]=dt):dt=t[46];let ft=dt,pt;t[47]!==ct||t[48]!==ce||t[49]!==q?(pt=function(){if(q.current==null)return;let e=ne.current;ce?(Bw(`right`,e,`open`),tt.current?ct(!1):q.current?.expand()):(Bw(`right`,e,`collapsed`),tt.current?ct(!0):q.current?.collapse())},t[47]=ct,t[48]=ce,t[49]=q,t[50]=pt):pt=t[50];let mt=pt,ht,gt;t[51]!==ct||t[52]!==W||t[53]!==q?(ht=()=>{let e=window.matchMedia(`(min-width: ${Ow}px)`),t=()=>{let e=Aw(W,window.innerWidth,`right`);te(e);let t=zw(`right`,e,Lw())===`collapsed`;le(t),tt.current?ct(t):t?q.current?.collapse():q.current?.expand()};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},gt=[W,q,ct],t[51]=ct,t[52]=W,t[53]=q,t[54]=ht,t[55]=gt):(ht=t[54],gt=t[55]),(0,Q.useEffect)(ht,gt);let _t,vt;t[56]!==Ze||t[57]!==G?(_t=()=>{if(Ze==null||G)return;let e=new ResizeObserver(()=>{lt.current(ue.current)});return e.observe(Ze),()=>e.disconnect()},vt=[Ze,G],t[56]=Ze,t[57]=G,t[58]=_t,t[59]=vt):(_t=t[58],vt=t[59]),(0,Q.useEffect)(_t,vt);let yt,bt;t[60]!==ft||t[61]!==a?(yt=()=>{let e=e=>{a(e),ft()},t=ch();return t&&e(t),uh(t=>{ch(),e(t)})},bt=[a,ft],t[60]=ft,t[61]=a,t[62]=yt,t[63]=bt):(yt=t[62],bt=t[63]),(0,Q.useEffect)(yt,bt);let xt,St;t[64]!==w||t[65]!==ft?(xt=()=>{w!==0&&ft()},St=[w,ft],t[64]=w,t[65]=ft,t[66]=xt,t[67]=St):(xt=t[66],St=t[67]),(0,Q.useEffect)(xt,St);let Ct=(0,Q.useRef)(ye),wt,Tt;t[68]!==ce||t[69]!==ye?(wt=()=>{if(Ct.current===ye)return;Ct.current=ye;let e=ce;queueMicrotask(()=>{lt.current(e)})},Tt=[ye,ce],t[68]=ce,t[69]=ye,t[70]=wt,t[71]=Tt):(wt=t[70],Tt=t[71]),(0,Q.useLayoutEffect)(wt,Tt);let Et,Dt;t[72]===ce?(Et=t[73],Dt=t[74]):(Et=()=>{if(!ce||!document.getElementById(`doc-panel`)?.contains(document.activeElement))return;let e=document.querySelector(`[data-doc-panel-toggle]`);if(e){e.focus();return}document.querySelector(`[data-sidebar="trigger"]`)?.focus()},Dt=[ce],t[72]=ce,t[73]=Et,t[74]=Dt),(0,Q.useLayoutEffect)(Et,Dt);let Ot,At;t[75]===ce?(Ot=t[76],At=t[77]):(Ot=()=>{window.okDesktop!=null&&window.okDesktop.editor.notifyViewMenuStateChanged({docPanelVisible:!ce})},At=[ce],t[75]=ce,t[76]=Ot,t[77]=At),(0,Q.useEffect)(Ot,At);let jt,Mt;t[78]===mt?(jt=t[79],Mt=t[80]):(jt=()=>{if(window.okDesktop!=null)return window.okDesktop.onMenuAction(e=>{e===`toggle-doc-panel`&&mt()})},Mt=[mt],t[78]=mt,t[79]=jt,t[80]=Mt),(0,Q.useEffect)(jt,Mt);let Nt,Pt;t[81]===mt?(Nt=t[82],Pt=t[83]):(Nt=()=>{if(window.okDesktop!=null)return;let e=e=>{jl(e,`toggle-document-panel`)&&(e.preventDefault(),mt())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},Pt=[mt],t[81]=mt,t[82]=Nt,t[83]=Pt),(0,Q.useEffect)(Nt,Pt);let Ft=(0,Q.useRef)(null),[It,Lt]=(0,Q.useState)(null),[Rt,zt]=(0,Q.useState)(!1),Bt=b?.kind===`large-file`?b.docName:v,Vt,Ht;t[84]===Bt?(Vt=t[85],Ht=t[86]):(Vt=()=>{if(Bt&&Bt!==Ft.current){let e=Ft.current;Ft.current=Bt,Lt(e)}},Ht=[Bt],t[84]=Bt,t[85]=Vt,t[86]=Ht),(0,Q.useEffect)(Vt,Ht);let Ut;t[87]===T?Ut=t[88]:(Ut=function(e){let t=El(e);window.location.hash===t?T(e):window.location.hash=t},t[87]=T,t[88]=Ut);let Wt=Ut,Y,Gt=null;if(b?.kind===`large-file`){let e;t[89]!==Wt||t[90]!==It?(e=It?{previousDocName:It,onNavigateBack:Wt}:void 0,t[89]=Wt,t[90]=It,t[91]=e):e=t[91];let n;t[92]!==b.docName||t[93]!==b.limit||t[94]!==b.size||t[95]!==e?(n=(0,Z.jsx)(TC,{docName:b.docName,size:b.size,limit:b.limit,backNav:e}),t[92]=b.docName,t[93]=b.limit,t[94]=b.size,t[95]=e,t[96]=n):n=t[96],Y=n}else if(b?.kind===`folder`){let e;t[97]!==G||t[98]!==f?(e=FT({terminalVisible:f,isEmbedded:G}),t[97]=G,t[98]=f,t[99]=e):e=t[99];let n=e,r;t[100]===b.folderPath?r=t[101]:(r=(0,Z.jsx)(xC,{folderPath:b.folderPath}),t[100]=b.folderPath,t[101]=r);let i;t[102]===n?i=t[103]:(i=n?(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-0 h-2 bg-linear-to-t from-background to-transparent`}):null,t[102]=n,t[103]=i);let a;t[104]!==r||t[105]!==i?(a=(0,Z.jsxs)(`div`,{className:`relative flex min-h-0 flex-1 flex-col`,children:[r,i]}),t[104]=r,t[105]=i,t[106]=a):a=t[106];let o;t[107]!==b.folderPath||t[108]!==n?(o=n?(0,Z.jsx)(ST,{folderPath:b.folderPath}):null,t[107]=b.folderPath,t[108]=n,t[109]=o):o=t[109];let s;if(t[110]!==a||t[111]!==o?(s=(0,Z.jsxs)(`div`,{className:`relative flex h-full min-h-0 flex-col`,children:[a,o]}),t[110]=a,t[111]=o,t[112]=s):s=t[112],Y=s,S===`agent`&&C!==null){let e;t[113]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(XC,{withHandle:!0}),t[113]=e):e=t[113];let n;t[114]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(Z.Fragment,{children:[e,(0,Z.jsx)(YC,{id:`agent-panel`,defaultSize:`25%`,minSize:`300px`,maxSize:`40%`,className:`flex flex-col bg-muted/20`,children:(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(`div`,{role:`status`,"aria-busy":`true`,className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`ONPvOb`})}),children:(0,Z.jsx)(tN,{showBackButton:!1})})})]}),t[114]=n):n=t[114],Gt=n}}else if(b?.kind===`asset`){let e;t[115]!==b.assetPath||t[116]!==b.mediaKind?(e=(0,Z.jsx)(sx,{assetPath:b.assetPath,mediaKind:b.mediaKind},b.assetPath),t[115]=b.assetPath,t[116]=b.mediaKind,t[117]=e):e=t[117],Y=e}else if(b?.kind===`skill-file`){let e=`${b.scope}/${b.name}/${b.path}`,n;t[118]!==b.name||t[119]!==b.path||t[120]!==b.scope||t[121]!==e?(n=(0,Z.jsx)(PC,{scope:b.scope,name:b.name,path:b.path},e),t[118]=b.name,t[119]=b.path,t[120]=b.scope,t[121]=e,t[122]=n):n=t[122],Y=n}else if(U){let e;t[123]===U?e=t[124]:(e=(0,Z.jsx)(OC,{nav:U},U.path),t[123]=U,t[124]=e),Y=e}else if(!y||!v)if((typeof window<`u`?Tl(window.location.hash):null)!==null)if(o!=null&&M){let e;t[125]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(cx,{}),t[125]=e):e=t[125],Y=e;let n;t[126]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(XC,{withHandle:!0,disabled:!0}),t[126]=n):n=t[126];let r=se?0:`${Fe}px`,i;t[127]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`}),t[127]=i):i=t[127];let a;t[128]===r?a=t[129]:(a=(0,Z.jsxs)(Z.Fragment,{children:[n,(0,Z.jsx)(YC,{id:`doc-panel`,defaultSize:r,minSize:nN,maxSize:rN,collapsible:!0,collapsedSize:0,inert:!0,className:`flex flex-col bg-muted/20`,children:i})]}),t[128]=r,t[129]=a),Gt=a}else{let e;return t[130]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(cx,{}),t[130]=e):e=t[130],e}else{let e=f?ve:null,n;t[131]===e?n=t[132]:(n=(0,Z.jsx)(HS,{terminalDock:e}),t[131]=e,t[132]=n),Y=n}else{let e=n===`source`,o=!A,s=ce,c;t[133]!==v||t[134]!==E?(c=function(){v&&E(v)},t[133]=v,t[134]=E,t[135]=c):c=t[135];let l=c,u;t[136]!==v||t[137]!==G||t[138]!==f?(u=PT({terminalVisible:f,isEmbedded:G,activeDocName:v}),t[136]=v,t[137]=G,t[138]=f,t[139]=u):u=t[139];let d=u,p=I??v,m=It??void 0,h;t[140]!==B||t[141]!==e||t[142]!==Wt||t[143]!==x||t[144]!==p||t[145]!==m?(h=(0,Z.jsx)(yj,{activeDocName:p,isSourceMode:e,editorPlaceholder:B,previousDocName:m,onNavigateBack:Wt,onRecycle:x}),t[140]=B,t[141]=e,t[142]=Wt,t[143]=x,t[144]=p,t[145]=m,t[146]=h):h=t[146];let g;t[147]!==v||t[148]!==e?(g=(0,Z.jsx)(mw,{activeDocName:v,isSourceMode:e}),t[147]=v,t[148]=e,t[149]=g):g=t[149];let _;t[150]!==v||t[151]!==I?(_=zM({activeDocName:v,deferredActiveDocName:I,mountResolved:v!==null&&be(v),syncResolved:v!==null&&we(v)})?(0,Z.jsxs)(`div`,{className:`absolute inset-0 z-10 bg-background`,children:[(0,Z.jsx)(cx,{}),v===null?null:(0,Z.jsx)(EC,{docName:v})]}):null,t[150]=v,t[151]=I,t[152]=_):_=t[152];let y;t[153]!==h||t[154]!==g||t[155]!==_?(y=(0,Z.jsxs)(`div`,{className:`relative h-full`,children:[h,g,_]}),t[153]=h,t[154]=g,t[155]=_,t[156]=y):y=t[156];let b;t[157]!==v||t[158]!==j||t[159]!==s||t[160]!==e||t[161]!==r||t[162]!==l||t[163]!==Ce||t[164]!==o||t[165]!==mt?(b=!j&&(0,Z.jsx)(RM,{activeDocName:v,isSourceMode:e,sourceDisabled:o,onModeChange:r,showAddPropertyButton:!e,onAddProperty:l,isPanelCollapsed:s,onTogglePanel:mt,reserveRightGutter:Ce&&s}),t[157]=v,t[158]=j,t[159]=s,t[160]=e,t[161]=r,t[162]=l,t[163]=Ce,t[164]=o,t[165]=mt,t[166]=b):b=t[166];let C;t[167]!==v||t[168]!==Rt||t[169]!==e||t[170]!==d?(C=d?(0,Z.jsx)(ST,{docName:v,surface:e?`source`:`wysiwyg`,dismissed:Rt,onDismiss:()=>zt(!0),onReopen:()=>zt(!1)}):null,t[167]=v,t[168]=Rt,t[169]=e,t[170]=d,t[171]=C):C=t[171];let w;t[172]!==y||t[173]!==b||t[174]!==C?(w=(0,Z.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[y,b,C]}),t[172]=y,t[173]=b,t[174]=C,t[175]=w):w=t[175];let T;t[176]!==Rt||t[177]!==d?(T=d&&Rt?{onReopen:()=>zt(!1)}:null,t[176]=Rt,t[177]=d,t[178]=T):T=t[178];let k;t[179]!==Se||t[180]!==O||t[181]!==R||t[182]!==D||t[183]!==T?(k=(0,Z.jsx)(bM,{stats:D,selectionStats:O,showStats:R,composerBadge:T,reserveRightGutter:Se}),t[179]=Se,t[180]=O,t[181]=R,t[182]=D,t[183]=T,t[184]=k):k=t[184];let M;t[185]!==w||t[186]!==k?(M=(0,Z.jsxs)(`div`,{className:`relative flex h-full flex-col`,children:[w,k]}),t[185]=w,t[186]=k,t[187]=M):M=t[187],Y=M;let N=ye&&ce,P=!ce,F;t[188]===Symbol.for(`react.memo_cache_sentinel`)?(F=()=>{Ne(!0),Pe.current=!0;let e=()=>{Ne(!1),Pe.current=!1,window.removeEventListener(`pointerup`,e)};window.addEventListener(`pointerup`,e)},t[188]=F):F=t[188];let L;t[189]!==ce||t[190]!==P?(L=(0,Z.jsx)(XC,{withHandle:P,disabled:ce,onPointerDown:F}),t[189]=ce,t[190]=P,t[191]=L):L=t[191];let z=se?0:`${Fe}px`,V=N?`0px`:nN,H;t[192]===Symbol.for(`react.memo_cache_sentinel`)?(H=e=>{le(e.asPercentage===0),e.inPixels>0&&Pe.current&&(Ie.current=e.inPixels,ze(e.inPixels))},t[192]=H):H=t[192];let U=!Me&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,W;t[193]===U?W=t[194]:(W=X(`flex flex-col bg-muted/20`,U),t[193]=U,t[194]=W);let K;t[195]!==v||t[196]!==i||t[197]!==S||t[198]!==e||t[199]!==a?(K=(0,Z.jsx)(Xv,{docName:v,isSourceMode:e,activeTab:i,onActiveTabChange:a,mode:S}),t[195]=v,t[196]=i,t[197]=S,t[198]=e,t[199]=a,t[200]=K):K=t[200];let ee;t[201]!==N||t[202]!==ce||t[203]!==q||t[204]!==z||t[205]!==V||t[206]!==W||t[207]!==K?(ee=(0,Z.jsx)(YC,{id:`doc-panel`,panelRef:q,disabled:N,defaultSize:z,minSize:V,maxSize:rN,collapsible:!0,collapsedSize:0,onResize:H,inert:ce,className:W,children:K}),t[201]=N,t[202]=ce,t[203]=q,t[204]=z,t[205]=V,t[206]=W,t[207]=K,t[208]=ee):ee=t[208];let te;t[209]!==L||t[210]!==ee?(te=(0,Z.jsxs)(Z.Fragment,{children:[L,ee]}),t[209]=L,t[210]=ee,t[211]=te):te=t[211],Gt=te}let Kt;t[212]!==d||t[213]!==c||t[214]!==o||t[215]!==ve||t[216]!==f||t[217]!==Y?(Kt=o==null?Y:(0,Z.jsx)($M,{visible:f,onVisibleChange:c??cN,dockPosition:ve,onBottomContainer:me,onEditorRegion:ge,onReveal:d,children:Y}),t[212]=d,t[213]=c,t[214]=o,t[215]=ve,t[216]=f,t[217]=Y,t[218]=Kt):Kt=t[218];let qt=Kt,Jt;t[219]!==Be||t[220]!==He||t[221]!==c||t[222]!==ae||t[223]!==ye||t[224]!==_?(Jt=ye?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(XC,{withHandle:!0,onPointerDown:()=>{Ue(!0),We.current=!0;let e=()=>{Ue(!1),We.current=!1,window.removeEventListener(`pointerup`,e),ae.current?.isCollapsed()&&c?.(!1)};window.addEventListener(`pointerup`,e)}}),(0,Z.jsx)(YC,{id:`terminal-column`,panelRef:ae,style:{backgroundColor:_},defaultSize:`${Be}px`,minSize:`320px`,maxSize:`95%`,collapsible:!0,collapsedSize:0,onResize:e=>{e.inPixels>0&&We.current&&(Ve.current=e.inPixels,qe(e.inPixels))},className:X(`flex flex-col`,!He&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`),children:(0,Z.jsx)(`div`,{ref:fe,className:`flex min-h-0 flex-1 flex-col overflow-hidden`})})]}):null,t[219]=Be,t[220]=He,t[221]=c,t[222]=ae,t[223]=ye,t[224]=_,t[225]=Jt):Jt=t[225];let Yt=Jt,Xt=Gt!=null&&!se||ye,Zt;t[226]===Symbol.for(`react.memo_cache_sentinel`)?(Zt=e=>{Qe(e),$e.current=e},t[226]=Zt):Zt=t[226];let Qt=Me||He||void 0,$t=ye?`5%`:`30%`,en;t[227]===Xt?en=t[228]:(en=Xt?{}:{defaultSize:`100%`},t[227]=Xt,t[228]=en);let tn=!(Me||He)&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,nn;t[229]===tn?nn=t[230]:(nn=X(tn),t[229]=tn,t[230]=nn);let rn;t[231]!==qt||t[232]!==$t||t[233]!==en||t[234]!==nn?(rn=(0,Z.jsx)(YC,{minSize:$t,...en,className:nn,children:qt}),t[231]=qt,t[232]=$t,t[233]=en,t[234]=nn,t[235]=rn):rn=t[235];let an;t[236]!==et||t[237]!==Gt||t[238]!==Qt||t[239]!==rn||t[240]!==Yt?(an=(0,Z.jsxs)(JC,{orientation:`horizontal`,groupRef:et,"data-dragging":Qt,children:[rn,Gt,Yt]}),t[236]=et,t[237]=Gt,t[238]=Qt,t[239]=rn,t[240]=Yt,t[241]=an):an=t[241];let on;t[242]!==d||t[243]!==Ce?(on=Ce?(0,Z.jsx)(ZM,{dockPosition:`right`,onReveal:d,className:`top-2.5 right-0`}):null,t[242]=d,t[243]=Ce,t[244]=on):on=t[244];let cn;return t[245]!==an||t[246]!==on?(cn=(0,Z.jsxs)(`div`,{className:`relative flex min-h-0 flex-1`,ref:Zt,children:[an,on]}),t[245]=an,t[246]=on,t[247]=cn):cn=t[247],cn}function cN(){}function lN(e){return!iN.has(e)}function uN(){return Gw()}function dN(){return Ew()}function fN(){return nr()}function pN(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 mN(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 hN=1e3,gN=!1;function _N(e){return!!(e.localPrincipalId&&e.entryPrincipalId===e.localPrincipalId||!e.localPrincipalId&&e.entryClientId===e.localClientId)}function vN(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:ms(i)?a=i:(a=void 0,gN||(gN=!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`&&(_N({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=mN(i),{current:c,crossDoc:l}=a?us(a,n,Date.now()):{current:[],crossDoc:[]},u=yN,d=c.map(u),f=l.map(u),p=[...s,...d],m=f;o(e=>pN(e.current,p)&&pN(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,hN);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 yN(e){let{agentId:t,entry:n}=e;return{kind:`agent`,agentId:t,presence:n}}var bN=!1,xN=new Set,SN=!1;function CN(){for(let e of xN)e()}function wN(e){bN!==e&&(bN=e,CN())}function TN(){return bN}function EN(e){return xN.add(e),()=>{xN.delete(e)}}function DN(e){let t=[e.onUpdateRelaunching(()=>wN(!0)),e.onUpdateRelaunchFailed(()=>wN(!1))];return()=>{for(let e of t)e()}}function ON(){if(SN||typeof window>`u`)return;let e=window.okDesktop;e&&(SN=!0,DN(e))}function kN(){return(0,Q.useSyncExternalStore)(EN,TN,AN)}function AN(){return!1}var jN=`sync-status`;async function MN(e){try{let t=await zg(e);t.ok||hs.error(t.message,{id:jN,duration:1/0})}catch{}}function NN(e,t){let n=(0,$.c)(6),{_:r}=kt(),i=kN(),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){hs.dismiss(jN);return}o.current=!0;let e=window.okDesktop;hs.warning(r({id:`HGNCsl`}),{id:jN,duration:1/0,...e?{action:{label:r({id:`uaUc6t`}),onClick:()=>{MN(e)}}}:{}})}else o.current&&e===`synced`&&(o.current=!1,hs.success(r({id:`GhjUB_`}),{id:jN,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 PN=4,FN=3,IN={Bird:Cd,Cat:Ad,Dog:Rd,Fish:Wd,Mouse:Sf,Rabbit:xf,Shrimp:Of,Snail:kf,Squirrel:Nf,Turtle:Uf};Object.freeze(Object.keys(IN));function LN(e){if(typeof e.principalId==`string`&&e.principalId.length>0)return{kind:`initials`};let t=e.name.split(` `)[1];return t&&Object.hasOwn(IN,t)?{kind:`animal`,animal:t}:{kind:`initials`}}var RN={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`,bot:`Agent`};function zN(e){let t=(0,$.c)(28),{user:n,mode:r,tabCount:i}=e,{_:a}=kt(),o=LN(n),s=o.kind===`animal`?IN[o.animal]:void 0,c;t[0]===n.name?c=t[1]:(c=yr(n.name),t[0]=n.name,t[1]=c);let l=c,u;t[2]===n.color?u=t[3]:(u=tr(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)(Ts,{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)(Es,{children:m}),t[23]=m,t[24]=b);let x;return t[25]!==y||t[26]!==b?(x=(0,Z.jsxs)(Os,{children:[y,b]}),t[25]=y,t[26]=b,t[27]=x):x=t[27],x}function BN(e){let t=RN[e.icon];return e.displayName||t||Gc._({id:`iEQQyu`})}function VN(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 HN(e){let t=(0,$.c)(33),{participant:n,crossDoc:r,scoped:i,onClickAgent:a}=e,{_:o}=kt(),{activeDocName:s}=Ye(),{presence:c,agentId:l}=n,u=BN(c),d=VN(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)(fs,{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)(fs,{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)(Ts,{asChild:!0,children:D}),t[20]=D,t[21]=O);let k;t[22]===u?k=t[23]:(k=(0,Z.jsx)(`span`,{className:`font-medium`,children:u}),t[22]=u,t[23]=k);let A;t[24]!==r||t[25]!==p?(A=r&&p?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(J,{id:`Wh0im4`,values:{realCurrentDoc:p}})}):null,t[24]=r,t[25]=p,t[26]=A):A=t[26];let j;t[27]!==k||t[28]!==A?(j=(0,Z.jsxs)(Es,{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)(Os,{children:[O,j]}),t[30]=O,t[31]=j,t[32]=M):M=t[32],M}function UN(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?Gc._({id:`9euN0m`,values:{count:n}}):Gc._({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)(se,{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)(zN,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(HN,{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)(ie,{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)(ae,{children:[u,f]}),t[18]=u,t[19]=f,t[20]=p):p=t[20],p}function WN(e,t,n,r){return e.kind===`human`?(0,Z.jsx)(zN,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(HN,{participant:e,crossDoc:n,scoped:r===e.agentId,onClickAgent:t},e.agentId)}function GN(){let e=(0,$.c)(20),{activeProvider:t,activeDocName:n,systemProvider:r,openActivityPanel:i,docPanelMode:a,docPanelAgentId:o}=Ye(),{current:s,crossDoc:c}=vN(t,r,n);if(NN(Kw(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,PN),n;e[6]===s?n=e[7]:(n=s.slice(PN),e[6]=s,e[7]=n);let r=n,u=c.slice(0,FN),d;e[8]===c?d=e[9]:(d=c.slice(FN),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=>WN(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)(UN,{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=>WN(e,p,!0,m)),f.length>0?(0,Z.jsx)(UN,{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 KN(){let e=(0,$.c)(4),[t,n]=(0,Q.useState)(null),r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=window.okDesktop;if(!e)return;let t=!1;return e.state.query().then(e=>{t||n(e.channel)}).catch(qN),()=>{t=!0}},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,Q.useEffect)(r,i);let a;return e[2]===t?a=e[3]:(a={channel:t},e[2]=t,e[3]=a),a}function qN(e){console.warn(`[use-update-channel] bridge.state.query() failed`,e)}function JN(e){let t=(0,$.c)(6),{className:n}=e,{_:r}=kt(),{channel:i}=KN();if(i!==`beta`)return null;let a;t[0]===r?a=t[1]:(a=r({id:`9fhQRL`}),t[0]=r,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(J,{id:`cSCbv3`}),t[2]=o):o=t[2];let c;return t[3]!==n||t[4]!==a?(c=(0,Z.jsx)(s,{variant:`secondary`,"aria-label":a,"data-testid":`beta-badge`,className:n,children:o}),t[3]=n,t[4]=a,t[5]=c):c=t[5],c}function YN(e,t){return t.trim()}function XN(e){return![``,`.`,`..`].includes(e)&&!e.includes(`/`)&&!e.includes(`\\`)&&!e.includes(`\0`)}function ZN(e,t){let n=YN(e.kind,t),r=e.path.split(`/`);return r[r.length-1]=n,r.join(`/`)}function QN(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(ol(e)){let t=s.get(Xu(e.docName,e.docExt));if(t){let n=Qc(t);return{kind:`asset`,path:t,assetExt:n,mediaKind:Hn(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(Zc(e))return{...e,path:aP(e.path,n)};if(el(e)){let t=s.get(e.path);return t&&Kc(t)?{kind:`document`,docName:Iu(t),docExt:Jc(t),size:e.size,modified:e.modified}:{...e,path:t??aP(e.path,n)}}return e})}function $N(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=>ol(e)?!i.has(e.docName)&&!lP(e.docName,n):Zc(e)?!lP(e.path,n):el(e)?!a.has(e.path)&&!lP(e.path,n):!0)}function eP(e,t){if(e.kind!==`asset`||t.some(t=>el(t)&&t.path===e.path))return e;let n=$u(e.path,t);return n?{...e,path:n,name:n.split(`/`).pop()??n}:e}function tP(e,t,n,r=new Date().toISOString()){let i=!1,a=[...e],o=e=>{a.some(t=>oP(t,e))||(a.push(e),i=!0)};if(n.kind===`file`){let s=e.find(e=>ol(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=>Zc(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(ol(i)){let e=cP(i.docName,t.path,n.path);e&&c.has(e)&&o({...i,docName:e,modified:r});continue}if(Zc(i)){let e=sP(i.path,t.path,n.path);e&&o({...i,path:e,modified:r})}}return i?a:e}function nP(e,t){return e?t.find(t=>t.fromDocName===e)?.toDocName??e:null}function rP(e,t,n){return e.flatMap(e=>t===e.toDocName||!n(e.toDocName)?[e.fromDocName]:[e.fromDocName,e.toDocName])}function iP(e,t){let n=e.kind===`file`?Xu(e.path,e.docExt):e.path;return Mo(t.contentDir,n,t.pathSeparator)}function aP(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 oP(e,t){return ol(e)&&ol(t)?e.docName===t.docName:Zc(e)&&Zc(t)||el(e)&&el(t)?e.path===t.path:!1}function sP(e,t,n){return e===t?n:cP(e,t,n)}function cP(e,t,n){return e.startsWith(`${t}/`)?`${n}${e.slice(t.length)}`:null}function lP(e,t){return!!t&&(e===t||e.startsWith(`${t}/`))}function uP(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)(Mp,{"data-slot":`context-menu`,...n}),t[2]=n,t[3]=r),r}function dP(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)(Np,{"data-slot":`context-menu-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function fP(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)(Ip,{"data-slot":`context-menu-group`,...n}),t[2]=n,t[3]=r),r}function pP(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)(Hp,{"data-slot":`context-menu-sub`,...n}),t[2]=n,t[3]=r),r}function mP(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)(Pp,{children:(0,Z.jsx)(Fp,{"data-slot":`context-menu-content`,className:i,...r})}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function hP(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)(Rp,{"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 gP(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)(na,{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)(Up,{"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 _P(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)(Wp,{"data-slot":`context-menu-sub-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function vP(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)(Bp,{children:(0,Z.jsx)($i,{})})}),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)(zp,{"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 yP(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)(Lp,{"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 bP(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)(Vp,{"data-slot":`context-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var xP=`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`,SP=`border-border bg-background text-foreground hover:bg-background focus-visible:bg-background`,CP={start:[Yo.Space],cancel:[Yo.Esc],end:[Yo.Space,Yo.Enter]};function wP(e){return X(xP,e?`opacity-100`:`pointer-events-none opacity-0 group-hover:pointer-events-auto group-hover:opacity-100`)}function TP(e){return e?void 0:-1}function EP({className:e,isDragging:t}){return X(e,t&&SP)}function DP(e){return e.code===Yo.Enter&&e.target===e.currentTarget}function OP({event:e,hasKeyboardActivation:t,isDragging:n}){return e.defaultPrevented?`ignore`:!n&&t&&DP(e)?`activate-tab`:`delegate-sortable`}function kP({activeWidth:e,isDragging:t,outerStyle:n,transform:r,transition:i}){let a=t&&e?e:void 0;return{...n,transform:es.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 AP(e,t){let n=e?.querySelectorAll(t)??[],r=1/0,i=-1/0;for(let e of n){let t=e.getBoundingClientRect();r=Math.min(r,t.left),i=Math.max(i,t.right)}return Number.isFinite(r)&&Number.isFinite(i)?{left:r,right:i}:null}function jP(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 MP=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 Uo(e)},NP=[`.md`,`.mdx`],PP=`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`,FP=`z-10 rounded-t-lg rounded-b-none border-border border-b-0 bg-background text-foreground`,IP=X(FP,`bg-transparent hover:bg-muted focus-visible:bg-muted border-transparent hover:border-border focus-visible:border-border`),LP=`flex h-full min-w-0 flex-1 cursor-pointer items-center overflow-hidden px-3 text-left text-[13px]`;function RP(e){return e.replace(/[^A-Za-z0-9_-]/g,`-`)}function zP(e){let t=El(e);window.location.hash!==t&&(window.location.hash=t)}function BP(e){Math.abs(e.deltaX)>=Math.abs(e.deltaY)||e.currentTarget.scrollWidth<=e.currentTarget.clientWidth||(e.preventDefault(),e.currentTarget.scrollLeft+=e.deltaY)}function VP(e,t){let n=[t,...NP].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 HP(e){return e.metaKey||e.ctrlKey}var UP=1e3;function WP(e,t){return e<0||e>=t?null:e<8?String(e+1):e===t-1?`9`:null}function GP(e,t){return WP(e,t)}function KP(e,t){let n=WP(e,t);if(n)return[`Meta+${n}`,`Control+${n}`].join(` `)}function qP(e,t){if(!HP(e)||e.altKey||e.shiftKey||!/^[1-9]$/.test(e.key))return null;let n=Number(e.key);if(n===9)return t>0?t-1:null;let r=n-1;return r<Math.min(8,t)?r:null}function JP(e){let t=(0,$.c)(3),{value:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=X(wP(!0),`font-mono tabular-nums hover:bg-transparent animate-in fade-in-0 zoom-in-95 duration-150 motion-reduce:animate-none motion-reduce:duration-0`),t[0]=r):r=t[0];let i=`⌘${n}`,a;return t[1]===i?a=t[2]:(a=(0,Z.jsx)(`span`,{"aria-hidden":`true`,"data-testid":`editor-tab-shortcut-hint`,className:r,children:(0,Z.jsx)(M,{className:`text-[10px]`,children:i})}),t[1]=i,t[2]=a),a}function YP(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:_}=Qo(u),v=p.current?.width,y;t[12]!==_||t[13]!==s||t[14]!==v||t[15]!==h||t[16]!==g?(y=kP({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=OP({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=EP({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 XP(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=Ze(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?(_=Ze(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)(dP,{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)(J,{id:`yz7wBu`}),t[18]=x):x=t[18];let S;t[19]!==m||t[20]!==b?(S=(0,Z.jsx)(hP,{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)(J,{id:`omXJcU`}),t[25]=T):T=t[25];let E;t[26]!==C||t[27]!==w?(E=(0,Z.jsx)(hP,{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)(J,{id:`U2Kx6T`}):(0,Z.jsx)(J,{id:`WyXG7w`}),t[32]=l.length,t[33]=k);let A;t[34]!==D||t[35]!==O||t[36]!==k?(A=(0,Z.jsx)(hP,{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)(bP,{}),(0,Z.jsx)(hP,{"data-testid":`editor-tab-context-pin-toggle`,onSelect:()=>m?d(u):c(u),children:m?(0,Z.jsx)(J,{id:`SYfHmN`}):(0,Z.jsx)(J,{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)(mP,{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)(uP,{children:[y,M]}),t[49]=M,t[50]=y,t[51]=N):N=t[51],N}function ZP(e){let t=(0,$.c)(28),{accessibleLabel:n,closeTab:r,forceCloseVisible:i,isActive:a,isPinned:o,shortcutHint:s,tabId:c,unpinTab:l}=e,u=i===void 0?!1:i,d=s===void 0?null:s,{_:f}=kt();if(d){let e;return t[0]===d?e=t[1]:(e=(0,Z.jsx)(JP,{value:d}),t[0]=d,t[1]=e),e}if(o){let e;t[2]!==f||t[3]!==n?(e=f({id:`t18QYR`,values:{accessibleLabel:n}}),t[2]=f,t[3]=n,t[4]=e):e=t[4];let r;t[5]!==c||t[6]!==l?(r=e=>{e.stopPropagation(),l(c)},t[5]=c,t[6]=l,t[7]=r):r=t[7];let i;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(bf,{"aria-hidden":`true`}),t[8]=i):i=t[8];let a;return t[9]!==e||t[10]!==r?(a=(0,Z.jsx)(Jr,{variant:`ghost`,size:`icon-xs`,type:`button`,"aria-label":e,"data-testid":`editor-tab-unpin-button`,className:`mr-1.5 text-primary! hover:bg-primary/10!`,onClick:r,children:i}),t[9]=e,t[10]=r,t[11]=a):a=t[11],a}let p;t[12]!==f||t[13]!==n?(p=f({id:`JLzQi_`,values:{accessibleLabel:n}}),t[12]=f,t[13]=n,t[14]=p):p=t[14];let m=u||a,h;t[15]===m?h=t[16]:(h=wP(m),t[15]=m,t[16]=h);let g;t[17]===a?g=t[18]:(g=TP(a),t[17]=a,t[18]=g);let _;t[19]!==r||t[20]!==c?(_=e=>{e.stopPropagation(),r(c)},t[19]=r,t[20]=c,t[21]=_):_=t[21];let v;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(gs,{"aria-hidden":`true`}),t[22]=v):v=t[22];let y;return t[23]!==p||t[24]!==h||t[25]!==g||t[26]!==_?(y=(0,Z.jsx)(Jr,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":p,"data-testid":`editor-tab-close-button`,className:h,tabIndex:g,onClick:_,children:v}),t[23]=p,t[24]=h,t[25]=g,t[26]=_,t[27]=y):y=t[27],y}function QP(e){let t=(0,$.c)(1),{hasConflict:n}=e;if(!n)return null;let r;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(os,{"aria-hidden":`true`,"data-testid":`editor-tab-conflict-badge`,className:`mr-1 size-3.5 shrink-0 text-amber-500`}),t[0]=r):r=t[0],r}function $P(e){let t=(0,$.c)(27),{accessibleLabel:n,activateTab:r,baseName:i,docName:a,enterRenameMode:o,extension:s,hideDocExtension:c,tabId:l}=e,{_:u}=kt(),d=bw(a)===`conflict`,f;t[0]!==u||t[1]!==n||t[2]!==d?(f=d?u({id:`mVFyH-`,values:{accessibleLabel:n}}):n,t[0]=u,t[1]=n,t[2]=d,t[3]=f):f=t[3];let p=f,m;t[4]!==r||t[5]!==l?(m=()=>{r(l)},t[4]=r,t[5]=l,t[6]=m):m=t[6];let h;t[7]!==a||t[8]!==o||t[9]!==l?(h=e=>{e.preventDefault(),e.stopPropagation(),o(l,a)},t[7]=a,t[8]=o,t[9]=l,t[10]=h):h=t[10];let g;t[11]===d?g=t[12]:(g=(0,Z.jsx)(QP,{hasConflict:d}),t[11]=d,t[12]=g);let _;t[13]===i?_=t[14]:(_=(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:i}),t[13]=i,t[14]=_);let v;t[15]!==s||t[16]!==c?(v=!c&&(0,Z.jsx)(`span`,{className:`shrink-0`,children:s}),t[15]=s,t[16]=c,t[17]=v):v=t[17];let y;t[18]!==_||t[19]!==v?(y=(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center`,children:[_,v]}),t[18]=_,t[19]=v,t[20]=y):y=t[20];let b;return t[21]!==p||t[22]!==m||t[23]!==h||t[24]!==g||t[25]!==y?(b=(0,Z.jsxs)(`button`,{type:`button`,"aria-label":p,title:p,className:LP,onClick:m,onDoubleClick:h,tabIndex:-1,children:[g,y]}),t[21]=p,t[22]=m,t[23]=h,t[24]=g,t[25]=y,t[26]=b):b=t[26],b}function eF(){let e=(0,$.c)(94),{activeDocName:t,activeTabId:n,activeNewTabId:r,activeTarget:i,activateTab:a,activateNewTab:o,closeAndClearForRename:s,closeNewTab:c,closeTab:l,closeTabs:u,getPoolActiveDocName:d,poolHas:p,isNewTabActive:m,newTabIds:h,openNewTab:g,openTabs:_,pinTab:v,pinnedTabIds:y,reopenClosedTab:b,remapTabsForRename:x,reorderTabs:S,unpinTab:C,visibleTabIds:w}=Ye(),{_:T}=kt(),{pageMeta:E}=ia(),D=(0,Q.useRef)(null),[O,k]=(0,Q.useState)(null),[A,j]=(0,Q.useState)(null),[M,N]=(0,Q.useState)(``),[P,F]=(0,Q.useState)(null),[I,L]=(0,Q.useState)(!1),[R,z]=(0,Q.useState)(!1),B=(0,Q.useRef)(null),V=(0,Q.useRef)(!1),H=(0,Q.useRef)(!1),U=(0,Q.useRef)(null),W=(0,Q.useRef)(t),G=(0,Q.useRef)(null),K=(0,Q.useRef)(!1),ee=(0,Q.useRef)(!1),te;e[0]!==n||e[1]!==t||e[2]!==i?(te=n??(i?et(i):t?pt(t):null),e[0]=n,e[1]=t,e[2]=i,e[3]=te):te=e[3];let ne=te,re;e[4]!==r||e[5]!==ne||e[6]!==m||e[7]!==h||e[8]!==_?(re=m?`${r??`__new-tab__`}\u0000${_.join(`\0`)}\u0000${h.join(`\0`)}`:ne?`${ne}\u0000${_.join(`\0`)}`:``,e[4]=r,e[5]=ne,e[6]=m,e[7]=h,e[8]=_,e[9]=re):re=e[9];let ie=re,q,ae;e[10]===t?(q=e[11],ae=e[12]):(q=()=>{W.current=t},ae=[t],e[10]=t,e[11]=q,e[12]=ae),(0,Q.useEffect)(q,ae);let oe,se;e[13]===Symbol.for(`react.memo_cache_sentinel`)?(oe=()=>()=>{G.current!==null&&(window.clearTimeout(G.current),G.current=null)},se=[],e[13]=oe,e[14]=se):(oe=e[13],se=e[14]),(0,Q.useEffect)(oe,se);let ce,le;e[15]===ie?(ce=e[16],le=e[17]):(ce=()=>{ie&&(D.current?.querySelector(`[data-active-tab="true"]`))?.scrollIntoView({block:`nearest`,inline:`nearest`})},le=[ie],e[15]=ie,e[16]=ce,e[17]=le),(0,Q.useEffect)(ce,le);let ue,de;e[18]===A?(ue=e[19],de=e[20]):(ue=()=>{A&&(B.current?.focus(),B.current?.select())},de=[A],e[18]=A,e[19]=ue,e[20]=de),(0,Q.useEffect)(ue,de);let fe,pe;e[21]!==_||e[22]!==A?(fe=()=>{!A||_.includes(A.tabId)||(H.current=!0,U.current=null,j(null),N(``),F(null),L(!1))},pe=[_,A],e[21]=_,e[22]=A,e[23]=fe,e[24]=pe):(fe=e[23],pe=e[24]),(0,Q.useEffect)(fe,pe);let me;e[25]===Symbol.for(`react.memo_cache_sentinel`)?(me=function(e,t){let n=t.split(`/`);H.current=!1,U.current=null,j({docName:t,tabId:e}),N(n[n.length-1]),F(null)},e[25]=me):me=e[25];let he=me,ge=function(){H.current=!0,U.current=null,j(null),N(``),F(null),L(!1)},_e=async function(){if(H.current){H.current=!1;return}if(V.current)return;let e=A?.docName;if(!e){ge();return}let t=YN(`file`,VP(M,E.get(e)?.docExt??`.md`)),n=e.split(`/`),r=n[n.length-1];if(t===r){ge();return}if(t===U.current){B.current?.focus();return}if(!XN(t)){F(T({id:`P8yDjG`})),B.current?.focus();return}let i=ZN({kind:`file`,path:e,name:r},t);V.current=!0,L(!0),F(null);try{let n=await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:`file`,fromPath:e,toPath:i})});if(H.current){L(!1),V.current=!1;return}let r=await Ot(n,`Server error (HTTP ${n.status})`);if(!r.ok){F(r.title),L(!1),V.current=!1,U.current=t,B.current?.focus();return}let a=f(mr,r.body,`rename-path:tab`,{renamed:[],renamedAssets:[]}).renamed,o=W.current,c=nP(o,a);Ee(a);let l=!0;try{let e=rP(a,d(),p);await Promise.all(e.map(e=>s(e))),x(a),ul([`files`,`backlinks`,`graph`])}catch(n){let r=n;l=!1,console.warn(`[EditorTabs] post-rename reconciliation failed`,{err:r,docName:e,newDocName:i,normalized:t}),hs.error(T({id:`MUBR8r`}))}H.current=!0,j(null),N(``),F(null),L(!1),V.current=!1,U.current=null,l&&c&&c!==o&&zP(c)}catch(n){console.warn(`[EditorTabs] rename failed`,{err:n,docName:e,newDocName:i,normalized:t}),F(T({id:`HIb0vl`})),L(!1),V.current=!1,U.current=t,B.current?.focus()}},ve=typeof window<`u`&&window.okDesktop!=null,ye;e[26]===h?ye=e[27]:(ye=new Set(h),e[26]=h,e[27]=ye);let be=ye,xe;e[28]===O?xe=e[29]:(xe=jP(O),e[28]=O,e[29]=xe);let Se;e[30]===xe?Se=e[31]:(Se=[xe],e[30]=xe,e[31]=Se);let Ce=Se,we;e[32]!==c||e[33]!==u||e[34]!==be?(we=function(e){let t=[],n=[];for(let r of e)be.has(r)?n.push(r):t.push(r);t.length>0&&u(t);for(let e of n)c(e)},e[32]=c,e[33]=u,e[34]=be,e[35]=we):we=e[35];let Te=we,De,Oe;e[36]!==o||e[37]!==a||e[38]!==r||e[39]!==ne||e[40]!==m||e[41]!==h||e[42]!==g||e[43]!==b||e[44]!==w?(De=()=>{let e=new Set(h),t=function(){G.current!==null&&(window.clearTimeout(G.current),G.current=null)},n=function(e){K.current!==e&&(K.current=e)},i=function(e){ee.current!==e&&(ee.current=e,z(e))},s=function(){n(!0),!(ee.current||G.current!==null)&&(G.current=window.setTimeout(()=>{G.current=null,K.current&&i(!0)},UP))},c=function(){t(),n(!1),i(!1)},l=function(t){e.has(t)?o(t):a(t)},u=function(e){if(w.length===0)return;let t=m?r:ne,n=t?w.indexOf(t):-1;l(w[((n>=0?n:0)+e+w.length)%w.length])},d=function(e){if(HP(e)&&s(),jl(e,`tab-new`)){e.preventDefault(),g();return}if(jl(e,`tab-reopen-closed`)){e.preventDefault(),b();return}if(jl(e,`tab-next`)){e.preventDefault(),u(1);return}if(jl(e,`tab-previous`)){e.preventDefault(),u(-1);return}let t=qP(e,w.length);t!==null&&(e.preventDefault(),l(w[t]))},f=function(e){!e.metaKey&&!e.ctrlKey&&c()};return window.addEventListener(`keydown`,d,{capture:!0}),window.addEventListener(`keyup`,f,{capture:!0}),window.addEventListener(`blur`,c),document.addEventListener(`visibilitychange`,c),()=>{window.removeEventListener(`keydown`,d,{capture:!0}),window.removeEventListener(`keyup`,f,{capture:!0}),window.removeEventListener(`blur`,c),document.removeEventListener(`visibilitychange`,c)}},Oe=[r,ne,o,a,m,h,g,b,w],e[36]=o,e[37]=a,e[38]=r,e[39]=ne,e[40]=m,e[41]=h,e[42]=g,e[43]=b,e[44]=w,e[45]=De,e[46]=Oe):(De=e[45],Oe=e[46]),(0,Q.useEffect)(De,Oe);let ke;e[47]===Symbol.for(`react.memo_cache_sentinel`)?(ke={activationConstraint:{distance:8}},e[47]=ke):ke=e[47];let Ae;e[48]===Symbol.for(`react.memo_cache_sentinel`)?(Ae={coordinateGetter:Ko,keyboardCodes:CP},e[48]=Ae):Ae=e[48];let je=$o(Bo(Wo,ke),Bo(qo,Ae)),Me=R,Ne;e[49]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=function(){k(AP(D.current,`[data-editor-tab-sortable]`))},e[49]=Ne):Ne=e[49];let Pe=Ne,Fe;e[50]===Symbol.for(`react.memo_cache_sentinel`)?(Fe=function(){k(null)},e[50]=Fe):Fe=e[50];let Ie=Fe,Le;e[51]!==Ie||e[52]!==S||e[53]!==w?(Le=function(e){Ie();let t=String(e.active.id),n=e.over?String(e.over.id):null;if(!n||t===n)return;let r=w.indexOf(t),i=w.indexOf(n);r<0||i<0||r===i||S(Xo([...w],r,i),t)},e[51]=Ie,e[52]=S,e[53]=w,e[54]=Le):Le=e[54];let Re=Le,ze=ve?``:void 0,Ve;e[55]===Symbol.for(`react.memo_cache_sentinel`)?(Ve=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]`,ve&&`[-webkit-app-region:drag]`),e[55]=Ve):Ve=e[55];let He=BP,Ue;e[56]===Symbol.for(`react.memo_cache_sentinel`)?(Ue=X(`flex items-end gap-1`,ve&&`[-webkit-app-region:no-drag]`),e[56]=Ue):Ue=e[56];let We=Ho,Ge=MP,Ke;e[57]===Symbol.for(`react.memo_cache_sentinel`)?(Ke={container:typeof document<`u`?document.body:void 0},e[57]=Ke):Ke=e[57];let qe=Jo,Je;e[58]===w?Je=e[59]:(Je=[...w],e[58]=w,e[59]=Je);let Xe=Vo,Ze=w.map((e,t)=>{let n=R?GP(t,w.length):null,i=KP(t,w.length);if(be.has(e)){let t=e===r;return(0,Z.jsx)(XP,{tabId:e,canPin:!1,openTabs:w,closeTab:c,closeTabs:Te,pinTab:v,pinnedTabIds:y,unpinTab:C,children:(0,Z.jsxs)(YP,{tabId:e,activateFromKeyboard:()=>o(e),"aria-current":t?`page`:void 0,"aria-keyshortcuts":i,"data-active-tab":t?`true`:void 0,className:X(PP,t?FP:IP),onAuxClick:t=>{t.button===1&&(t.preventDefault(),c(e))},onClick:t=>{t.target===t.currentTarget&&o(e)},children:[(0,Z.jsx)(`button`,{type:`button`,"aria-label":T({id:`zLak8b`}),"data-testid":`editor-new-tab-placeholder-button`,className:LP,onClick:()=>o(e),tabIndex:-1,children:(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:(0,Z.jsx)(J,{id:`3YvS-c`})})}),n?(0,Z.jsx)(JP,{value:n}):(0,Z.jsx)(`button`,{type:`button`,"aria-label":T({id:`xCdTnb`}),"data-testid":`editor-new-tab-placeholder-close`,className:wP(Me||t),tabIndex:TP(t),onClick:t=>{t.stopPropagation(),c(e)},children:(0,Z.jsx)(gs,{"aria-hidden":`true`,className:`size-3.5`})})]})},e)}let s=Be(e),u=e===ne,d=y.includes(e);if(s.kind===`folder`){let{baseName:t,label:r,prefix:o}=ut(s.folderPath,`/`),c=`${o}${r}`;return(0,Z.jsx)(XP,{tabId:e,openTabs:w,closeTab:l,closeTabs:Te,pinTab:v,pinnedTabIds:y,unpinTab:C,children:(0,Z.jsxs)(YP,{tabId:e,activateFromKeyboard:()=>a(e),"aria-current":u?`page`:void 0,"aria-keyshortcuts":i,"data-active-tab":u?`true`:void 0,className:X(PP,u?FP:IP),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!d&&l(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":c,title:c,className:LP,onClick:()=>{a(e)},tabIndex:-1,children:[o&&(0,Z.jsx)(`span`,{className:X(`min-w-0 flex-1 truncate`,u&&`text-muted-foreground`),children:o}),(0,Z.jsxs)(`span`,{className:X(`flex min-w-0 items-center`,o?`max-w-[70%] shrink-0`:`flex-1`),children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:t}),(0,Z.jsx)(`span`,{className:`shrink-0`,children:`/`})]})]}),(0,Z.jsx)(ZP,{accessibleLabel:c,closeTab:l,forceCloseVisible:Me,isActive:u,isPinned:d,shortcutHint:n,tabId:e,unpinTab:C})]})},e)}if(s.kind===`asset`||s.kind===`skill-file`){let{baseName:t,label:r,prefix:o}=ut(s.kind===`asset`?s.assetPath:s.path,``),c=`${o}${r}`;return(0,Z.jsx)(XP,{tabId:e,openTabs:w,closeTab:l,closeTabs:Te,pinTab:v,pinnedTabIds:y,unpinTab:C,children:(0,Z.jsxs)(YP,{tabId:e,activateFromKeyboard:()=>a(e),"aria-current":u?`page`:void 0,"aria-keyshortcuts":i,"data-active-tab":u?`true`:void 0,className:X(PP,u?FP:IP),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!d&&l(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":c,className:LP,onClick:()=>{a(e)},tabIndex:-1,children:[o?(0,Z.jsx)(`span`,{className:X(`min-w-0 flex-1 truncate text-muted-foreground/60`,u&&`text-muted-foreground`),children:o}):null,(0,Z.jsx)(`span`,{className:X(`min-w-0 truncate`,o?`max-w-[70%] shrink-0`:`flex-1`),children:t})]}),(0,Z.jsx)(ZP,{accessibleLabel:c,closeTab:l,forceCloseVisible:Me,isActive:u,isPinned:d,shortcutHint:n,tabId:e,unpinTab:C})]})},e)}let f=s.docName,p=E.get(f)?.docExt??`.md`,{baseName:m,extension:h,label:g,prefix:_}=ut(f,p),b=`${_}${g}`,x=p===`.md`||p===`.mdx`,S=A?.tabId===e,D=`editor-tab-rename-error-${RP(f)}`;return(0,Z.jsx)(XP,{disabled:S,tabId:e,openTabs:w,closeTab:l,closeTabs:Te,pinTab:v,pinnedTabIds:y,unpinTab:C,children:(0,Z.jsx)(YP,{tabId:e,activateFromKeyboard:()=>a(e),disabled:S,"aria-current":u?`page`:void 0,"aria-keyshortcuts":i,"data-active-tab":u?`true`:void 0,className:X(PP,u?FP:IP,S&&P&&`border-destructive`),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!d&&l(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:S?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(ZC,{className:`h-full min-w-0 flex-1 rounded-none border-0 bg-transparent dark:bg-transparent`,children:[(0,Z.jsx)(nw,{ref:B,value:M,disabled:I,"aria-label":T({id:`Dw1T_W`,values:{label:g}}),"data-testid":`editor-tab-rename-input`,"aria-invalid":P?!0:void 0,"aria-describedby":P?D:void 0,"aria-busy":I||void 0,title:P??f,className:`h-full min-w-0 px-2 py-0 font-medium text-foreground text-xs selection:bg-primary selection:text-primary-foreground`,onChange:e=>{N(VP(e.target.value,p)),F(null),U.current=null},onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),_e()):e.key===`Escape`&&(e.preventDefault(),ge())},onBlur:_e}),(0,Z.jsx)($C,{align:`inline-end`,"aria-hidden":`true`,className:`pr-2 text-xs`,children:(0,Z.jsx)(tw,{className:`text-muted-foreground/60 text-xs`,children:p})})]}),P?(0,Z.jsx)(`span`,{id:D,role:`alert`,className:`sr-only`,children:P}):null]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($P,{accessibleLabel:b,activateTab:a,baseName:m,docName:f,enterRenameMode:he,extension:h,hideDocExtension:x,tabId:e}),(0,Z.jsx)(ZP,{accessibleLabel:b,closeTab:l,forceCloseVisible:Me,isActive:u,isPinned:d,shortcutHint:n,tabId:e,unpinTab:C})]})})},e)}),Qe;e[60]!==qe||e[61]!==Je||e[62]!==Xe||e[63]!==Ze?(Qe=(0,Z.jsx)(qe,{items:Je,strategy:Xe,children:Ze}),e[60]=qe,e[61]=Je,e[62]=Xe,e[63]=Ze,e[64]=Qe):Qe=e[64];let $e;e[65]!==We||e[66]!==Ie||e[67]!==Re||e[68]!==Pe||e[69]!==je||e[70]!==!1||e[71]!==Ge||e[72]!==Ke||e[73]!==Qe||e[74]!==Ce?($e=(0,Z.jsx)(We,{sensors:je,autoScroll:!1,collisionDetection:Ge,modifiers:Ce,onDragStart:Pe,onDragEnd:Re,onDragCancel:Ie,accessibility:Ke,children:Qe}),e[65]=We,e[66]=Ie,e[67]=Re,e[68]=Pe,e[69]=je,e[70]=!1,e[71]=Ge,e[72]=Ke,e[73]=Qe,e[74]=Ce,e[75]=$e):$e=e[75];let tt;e[76]===T?tt=e[77]:(tt=T({id:`3YvS-c`}),e[76]=T,e[77]=tt);let rt;e[78]===Symbol.for(`react.memo_cache_sentinel`)?(rt=(0,Z.jsx)(nt,{"aria-hidden":`true`}),e[78]=rt):rt=e[78];let it;e[79]!==g||e[80]!==tt?(it=(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(Jr,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":tt,"data-testid":`editor-new-tab-button`,className:`first:mb-3 mb-1.5`,onClick:g,children:rt})}),e[79]=g,e[80]=tt,e[81]=it):it=e[81];let at;e[82]===Symbol.for(`react.memo_cache_sentinel`)?(at=(0,Z.jsx)(Es,{children:(0,Z.jsx)(J,{id:`3YvS-c`})}),e[82]=at):at=e[82];let ot;e[83]===it?ot=e[84]:(ot=(0,Z.jsxs)(Os,{children:[it,at]}),e[83]=it,e[84]=ot);let st;e[85]!==Ue||e[86]!==$e||e[87]!==ot?(st=(0,Z.jsxs)(`div`,{className:Ue,children:[$e,ot]}),e[85]=Ue,e[86]=$e,e[87]=ot,e[88]=st):st=e[88];let ct;return e[89]!==ze||e[90]!==Ve||e[91]!==He||e[92]!==st?(ct=(0,Z.jsx)(`div`,{ref:D,"data-electron-drag":ze,className:Ve,onWheel:He,children:st}),e[89]=ze,e[90]=Ve,e[91]=He,e[92]=st,e[93]=ct):ct=e[93],ct}var tF=(e,t,n)=>{if(e&&`reportValidity`in e){let r=Va(n,t);e.setCustomValidity(r&&r.message||``),e.reportValidity()}},nF=(e,t)=>{for(let n in t.fields){let r=t.fields[n];r&&r.ref&&`reportValidity`in r.ref?tF(r.ref,n,e):r&&r.refs&&r.refs.forEach(t=>tF(t,n,e))}},rF=(e,t)=>{t.shouldUseNativeValidation&&nF(e,t);let n={};for(let r in e){let i=Va(t.fields,r),a=Object.assign(e[r]||{},{ref:i&&i.ref});if(iF(t.names||Object.keys(e),r)){let e=Object.assign({},Va(n,r));so(e,`root`,a),so(n,r,e)}else so(n,r,a)}return n},iF=(e,t)=>{let n=aF(t).replace(/[.*+?^${}()|\\]/g,`\\$&`);return e.some(e=>aF(e).match(`^${n}\\.\\d+`))};function aF(e){return e.replace(/[\[\]]/g,``)}function oF(){return oF=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},oF.apply(null,arguments)}function sF(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}function cF(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]=Na(o,t,n,i,l?[].concat(l,r.message):r.message)}e.shift()}return n}function lF(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(oF({},t,{path:[].concat(r.path,t.path)}))})}),t){var c=n[o].types,l=c&&c[r.code];n[o]=Na(o,t,n,i,l?[].concat(l,r.message):r.message)}e.shift()};e.length;)r();return n}function uF(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(sF(function(){return Promise.resolve(e[n.mode===`sync`?`parse`:`parseAsync`](r,t)).then(function(e){return a.shouldUseNativeValidation&&nF({},a),{errors:{},values:n.raw?Object.assign({},r):e}})},function(e){if(function(e){return Array.isArray(e?.issues)}(e))return{values:{},errors:rF(cF(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(sF(function(){return Promise.resolve((n.mode===`sync`?Kn:Jn)(e,r,t)).then(function(e){return a.shouldUseNativeValidation&&nF({},a),{errors:{},values:n.raw?Object.assign({},r):e}})},function(e){if(function(e){return e instanceof Fn}(e))return{values:{},errors:rF(lF(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 dF=`https://openknowledge.ai/api/subscribe`;async function fF(e,t){try{let n=await fetch(dF,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({email:e,source:t}),signal:AbortSignal.timeout(15e3)});return n.ok?{ok:!0}:n.status===400?{ok:!1,reason:`invalid`}:n.status===503?{ok:!1,reason:`unavailable`}:(console.warn(`[subscribe] action=submit result=http-error status=${n.status}`),{ok:!1,reason:`error`})}catch(e){return console.warn(`[subscribe] action=submit result=network-error message=${e instanceof Error?e.message:String(e)}`),{ok:!1,reason:`error`}}}function pF(e){let t=(0,$.c)(49),{source:n,title:r,description:i,onSuccess:a,onDismiss:o,autoFocus:s,compactSubmit:c,className:l}=e,{_:u}=kt(),[d,f]=(0,Q.useState)(!1),p=(0,Q.useRef)(null),m,h;t[0]===d?(m=t[1],h=t[2]):(m=()=>{d&&p.current?.focus()},h=[d],t[0]=d,t[1]=m,t[2]=h),(0,Q.useEffect)(m,h);let g,_;if(t[3]!==u){let e=Tn({email:En({message:u({id:`Wq6Wcm`})})});_=ja,g=uF(e),t[3]=u,t[4]=g,t[5]=_}else g=t[4],_=t[5];let v;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(v={email:``},t[6]=v):v=t[6];let y;t[7]===g?y=t[8]:(y={resolver:g,defaultValues:v},t[7]=g,t[8]=y);let b=_(y),{isSubmitting:x}=b.formState,S=b.formState.errors.email?.message??b.formState.errors.root?.message,C;t[9]!==u||t[10]!==b||t[11]!==a||t[12]!==n?(C=async function(e){b.clearErrors(`root`);let t=await fF(e.email,n);if(t.ok){f(!0),a?.();return}if(t.reason===`invalid`){b.setError(`email`,{message:u({id:`Wq6Wcm`})});return}if(t.reason===`unavailable`){b.setError(`root`,{message:u({id:`4mLBx9`})});return}b.setError(`root`,{message:u({id:`fWsBTs`})})},t[9]=u,t[10]=b,t[11]=a,t[12]=n,t[13]=C):C=t[13];let w=C,T;t[14]===l?T=t[15]:(T=X(`flex flex-col gap-3`,l),t[14]=l,t[15]=T);let E=d?-1:void 0,D;t[16]!==d||t[17]!==r?(D=d?(0,Z.jsxs)(`span`,{className:`mb-1.5 inline-flex flex-row items-center gap-2`,children:[(0,Z.jsx)($i,{className:`size-4 text-primary`}),(0,Z.jsx)(J,{id:`PIMM5l`})]}):r??(0,Z.jsx)(J,{id:`GzPQ2f`}),t[16]=d,t[17]=r,t[18]=D):D=t[18];let O;t[19]!==D||t[20]!==E?(O=(0,Z.jsx)(`p`,{ref:p,tabIndex:E,className:`text-sm font-medium leading-tight text-foreground focus:outline-none`,children:D}),t[19]=D,t[20]=E,t[21]=O):O=t[21];let k;t[22]!==i||t[23]!==d?(k=d?(0,Z.jsx)(J,{id:`pBROkv`}):i??(0,Z.jsx)(J,{id:`WmPbvm`}),t[22]=i,t[23]=d,t[24]=k):k=t[24];let A;t[25]===k?A=t[26]:(A=(0,Z.jsx)(`p`,{className:`text-1sm text-muted-foreground`,role:`status`,children:k}),t[25]=k,t[26]=A);let j;t[27]!==O||t[28]!==A?(j=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[O,A]}),t[27]=O,t[28]=A,t[29]=j):j=t[29];let M;t[30]!==u||t[31]!==o?(M=o?(0,Z.jsx)(Jr,{type:`button`,variant:`ghost`,size:`icon`,onClick:o,"aria-label":u({id:`yz7wBu`}),className:`-mr-1.5 -mt-1 size-7 shrink-0 text-muted-foreground opacity-60`,children:(0,Z.jsx)(gs,{className:`size-4`})}):null,t[30]=u,t[31]=o,t[32]=M):M=t[32];let N;t[33]!==j||t[34]!==M?(N=(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[j,M]}),t[33]=j,t[34]=M,t[35]=N):N=t[35];let P;t[36]!==u||t[37]!==s||t[38]!==c||t[39]!==S||t[40]!==b||t[41]!==x||t[42]!==w||t[43]!==d?(P=d?null:(0,Z.jsxs)(`form`,{onSubmit:b.handleSubmit(w),className:`flex flex-col gap-2`,noValidate:!0,children:[(0,Z.jsx)(Ga,{control:b.control,name:`email`,render:e=>{let{field:t,fieldState:n}=e;return(0,Z.jsxs)(ZC,{className:`h-10 rounded-xl`,children:[(0,Z.jsx)($C,{className:`pl-2.5`,children:(0,Z.jsx)(cf,{className:`size-4 text-muted-foreground opacity-60`})}),(0,Z.jsx)(nw,{...t,id:t.name,type:`email`,inputMode:`email`,autoComplete:`email`,spellCheck:!1,autoFocus:s,placeholder:u({id:`2hYmUH`}),"aria-invalid":n.invalid,"aria-label":u({id:`ATGYL1`}),"data-testid":`subscribe-email`,className:`placeholder:text-muted-foreground/60`}),(0,Z.jsx)(Jr,{type:`submit`,disabled:x,size:c?`icon`:`default`,className:X(`mr-1 ml-auto text-1sm`,c&&`size-8 shrink-0 rounded-lg`),"data-testid":`subscribe-submit`,children:x?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ns,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`lCC_D5`})})]}):c?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(vi,{className:`size-4`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`EDl9kS`})})]}):(0,Z.jsx)(J,{id:`EDl9kS`})})]})}}),S?(0,Z.jsx)(`p`,{className:`text-sm text-destructive`,role:`alert`,children:S}):null]}),t[36]=u,t[37]=s,t[38]=c,t[39]=S,t[40]=b,t[41]=x,t[42]=w,t[43]=d,t[44]=P):P=t[44];let F;return t[45]!==N||t[46]!==P||t[47]!==T?(F=(0,Z.jsxs)(`div`,{className:T,children:[N,P]}),t[45]=N,t[46]=P,t[47]=T,t[48]=F):F=t[48],F}var mF=`https://github.com/inkeep/open-knowledge`,hF=`https://discord.com/invite/YujKpFN49`,gF=`https://x.com/OpenKnowledge`,_F=`ok-subscribe-card-v1`,vF={subscribed:!1,dismissed:!1,shownVersions:[]};function yF(e,t){return!e.subscribed&&!e.dismissed&&e.shownVersions.length<3&&!e.shownVersions.includes(t)}function bF(e){return e===!0}function xF(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function SF(e){if(typeof e!=`object`||!e)return vF;let t=e;return{subscribed:bF(t.subscribed),dismissed:bF(t.dismissed),shownVersions:xF(t.shownVersions)}}function CF(e){try{let t=(e??localStorage).getItem(_F);return t==null?vF:SF(JSON.parse(t))}catch(e){return console.warn(`[subscribe-card-store] readPersistedState failed (corrupt/privacy/SSR)`,e),vF}}function wF(e,t){try{(t??localStorage).setItem(_F,JSON.stringify(e))}catch(e){console.warn(`[subscribe-card-store] writePersistedState failed (quota/privacy/SSR)`,e)}}function TF(e){let t=CF(e),n=new Set,r=!1;function i(){for(let e of n)e()}function a(n){t=n,wF(t,e),i()}return{getSnapshot(){return t},subscribe(e){return n.add(e),()=>{n.delete(e)}},markSubscribed(){t.subscribed||a({...t,subscribed:!0})},dismiss(){t.dismissed||a({...t,dismissed:!0})},recordShown(e){t.shownVersions.includes(e)||a({...t,shownVersions:[...t.shownVersions,e]})},install(){r||(r=!0,t=CF(e),i())}}}var EF=TF();function DF(){EF.install()}function OF(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 kF(e){let t=(0,$.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`GitHub`}),r=(0,Z.jsx)(`path`,{d:`M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12`}),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 AF(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 jF=[{key:`resources`,heading:{id:`s-MGs7`},links:[{label:{id:`TbjyhA`},href:`https://openknowledge.ai/docs`,icon:F},{label:{id:`PCNIuJ`},href:`${mF}/issues/new`,icon:Md},{label:{id:`On0aF2`},href:`https://openknowledge.ai/`,icon:ra}]},{key:`community`,heading:{id:`chL5IG`},links:[{label:`Discord`,href:hF,icon:OF},{label:`X (Twitter)`,href:gF,icon:AF},{label:`GitHub`,href:mF,icon:kF}]}],MF=`${mF}/releases`,NF=`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 PF(e){if(e<1e3)return String(e);let t=e/1e3;return`${t>=10?Math.round(t):t.toFixed(1)}k`}var FF=e=>{let t=(0,$.c)(12),{count:n}=e,{_:r}=kt(),i,a,o,s;t[0]!==r||t[1]!==n?(i=PF(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)(Pf,{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},IF=e=>{let t=(0,$.c)(15),{link:n,trailing:r}=e,{_:i}=kt(),{label:a,href:o,icon:s}=n,c,l;t[0]===o?(c=t[1],l=t[2]):(c=e=>hu(e,o),l=e=>hu(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:NF,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},LF=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},RF=()=>{let e=(0,$.c)(28),{_:t}=kt(),[n,r]=(0,Q.useState)(!1),[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(null),c,u;e[0]!==n||e[1]!==o?(c=()=>{if(!n||o!==null)return;let e=new AbortController;return Vr({signal:e.signal}).then(e=>{e!==null&&s(e)}),()=>e.abort()},u=[n,o],e[0]=n,e[1]=o,e[2]=c,e[3]=u):(c=e[2],u=e[3]),(0,Q.useEffect)(c,u);let d;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(d=e=>{r(e),e||a(!1)},e[4]=d):d=e[4];let f;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(l,{className:`size-4`}),e[5]=f):f=e[5];let p;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(se,{asChild:!0,children:(0,Z.jsxs)(Jr,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,children:[f,(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`s-MGs7`})})]})})}),e[6]=p):p=e[6];let m;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsxs)(Os,{children:[p,(0,Z.jsx)(Es,{children:(0,Z.jsx)(J,{id:`s-MGs7`})})]}),e[7]=m):m=e[7];let h;e[8]!==t||e[9]!==o?(h=jF.map((e,n)=>(0,Z.jsxs)(`div`,{className:X(n>0&&`mt-3`),children:[(0,Z.jsx)(LF,{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)(IF,{link:e,trailing:e.href===`https://github.com/inkeep/open-knowledge`&&o!==null?(0,Z.jsx)(FF,{count:o}):void 0},e.href))})})]},e.key)),e[8]=t,e[9]=o,e[10]=h):h=e[10];let g;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(LF,{children:(0,Z.jsx)(J,{id:`arUUsK`})}),e[11]=g):g=e[11];let _;e[12]===t?_=e[13]:(_=t({id:`arUUsK`}),e[12]=t,e[13]=_);let v;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(IF,{link:{label:{id:`3ePd3I`},href:MF,icon:lf}}),e[14]=v):v=e[14];let y;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(se,{asChild:!0,children:(0,Z.jsxs)(Jr,{variant:`ghost`,className:X(NF,`h-auto w-full justify-start font-normal`),children:[(0,Z.jsx)(cf,{"aria-hidden":`true`,className:`size-4 shrink-0`}),(0,Z.jsx)(J,{id:`EDl9kS`})]})}),e[15]=y):y=e[15];let b;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(ie,{side:`left`,align:`center`,sideOffset:20,className:`w-80`,children:(0,Z.jsx)(pF,{source:`resources_menu`,autoFocus:!0,onDismiss:()=>a(!1),onSuccess:zF})}),e[16]=b):b=e[16];let x;e[17]===i?x=e[18]:(x=(0,Z.jsxs)(`ul`,{className:`space-y-0.5`,children:[v,(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(ae,{open:i,onOpenChange:a,children:[y,b]})})]}),e[17]=i,e[18]=x);let S;e[19]!==x||e[20]!==_?(S=(0,Z.jsxs)(`div`,{className:`mt-3`,children:[g,(0,Z.jsx)(`nav`,{"aria-label":_,children:x})]}),e[19]=x,e[20]=_,e[21]=S):S=e[21];let C;e[22]!==S||e[23]!==h?(C=(0,Z.jsxs)(ie,{align:`end`,className:`w-56 p-3`,children:[h,S]}),e[22]=S,e[23]=h,e[24]=C):C=e[24];let w;return e[25]!==n||e[26]!==C?(w=(0,Z.jsxs)(ae,{open:n,onOpenChange:d,children:[m,C]}),e[25]=n,e[26]=C,e[27]=w):w=e[27],w};function zF(){return EF.markSubscribed()}var BF=50,VF=()=>{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,IC.preload()},BF))},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=Ya)},l=(0,Z.jsx)(Ef,{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)(Ts,{asChild:!0,children:(0,Z.jsxs)(Jr,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,"data-testid":`header-settings-button`,onMouseEnter:r,onMouseLeave:a,onFocus:r,onBlur:a,onClick:c,children:[l,(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`Tz0i8g`})})]})}),e[6]=u):u=e[6];let d;return e[7]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsxs)(Os,{children:[u,(0,Z.jsx)(Es,{children:(0,Z.jsx)(J,{id:`Tz0i8g`})})]}),e[7]=d):d=e[7],d},HF=`https://openknowledge.ai/docs/features/share`;function UF(e){let t=(0,$.c)(50),{input:n,onClickWhenNoRemote:r}=e,{_:i}=kt(),{status:a}=zi(),[o,s]=(0,Q.useState)(!1),[c,u]=(0,Q.useState)(null),d=(0,Q.useRef)(null),f;t[0]===c?.autoCopyFailed?f=t[1]:(f=()=>{!c?.autoCopyFailed||!d.current||(d.current.focus(),d.current.select())},t[0]=c?.autoCopyFailed,t[1]=f);let p;t[2]===c?p=t[3]:(p=[c],t[2]=c,t[3]=p),(0,Q.useEffect)(f,p);let m=a?.hasRemote===!0,h=n===null,g=ni(c?.freshness,a),_;t[4]!==i||t[5]!==o||t[6]!==m||t[7]!==n||t[8]!==r?(_=async function(){if(!o&&n!==null){s(!0),u(null);try{let e=await La({...n,hasRemote:m,onClickWhenNoRemote:r},{clipboardWrite:Sa,toastSuccess:ZF,toastError:XF,logEvent:YF});e.kind===`copied`?u({url:e.shareUrl,autoCopyFailed:!1,freshness:e.freshness}):e.kind===`clipboard-failed`&&u({url:e.shareUrl,autoCopyFailed:!0,freshness:e.freshness})}catch{hs.error(i({id:`u3YnKw`}))}s(!1)}},t[4]=i,t[5]=o,t[6]=m,t[7]=n,t[8]=r,t[9]=_):_=t[9];let v=_,y=c!==null,b;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(b=e=>{e||u(null)},t[10]=b):b=t[10];let x;t[11]!==i||t[12]!==n?.kind?(x=n?.kind===`folder`?i({id:`WR0y2O`}):i({id:`F4IYWe`}),t[11]=i,t[12]=n?.kind,t[13]=x):x=t[13];let S=o||h,C,T;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(Df,{className:`size-3.5`,"aria-hidden":!0}),T=(0,Z.jsx)(J,{id:`Z8lGw6`}),t[14]=C,t[15]=T):(C=t[14],T=t[15]);let E;t[16]!==v||t[17]!==x||t[18]!==S?(E=(0,Z.jsx)(w,{asChild:!0,children:(0,Z.jsxs)(Jr,{variant:`ghost`,size:`sm`,"aria-label":x,onClick:v,disabled:S,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`share-button`,children:[C,T]})}),t[16]=v,t[17]=x,t[18]=S,t[19]=E):E=t[19];let D=g?`w-96`:`w-80`,O;t[20]===D?O=t[21]:(O=X(`flex flex-col gap-2`,D),t[20]=D,t[21]=O);let k;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Z.jsx)(`p`,{className:`font-mono tracking-wide uppercase text-muted-foreground text-xs`,children:(0,Z.jsx)(J,{id:`Z8lGw6`})}),t[22]=k):k=t[22];let A;t[23]===c?.autoCopyFailed?A=t[24]:(A=c?.autoCopyFailed?(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(J,{id:`ndeI89`})}):null,t[23]=c?.autoCopyFailed,t[24]=A);let j=c?.url??``,M;t[25]===i?M=t[26]:(M=i({id:`5-FeN2`}),t[25]=i,t[26]=M);let N;t[27]!==j||t[28]!==M?(N=(0,Z.jsx)(Uc,{ref:d,readOnly:!0,value:j,onFocus:JF,onClick:qF,onContextMenu:KF,className:`select-all bg-muted font-mono text-xs text-muted-foreground`,"data-testid":`share-button-url`,"aria-label":M}),t[27]=j,t[28]=M,t[29]=N):N=t[29];let P=c?.url??``,F=c?.autoCopyFailed===!1,I;t[30]!==P||t[31]!==F?(I=(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)(L,{copyContent:P,clipboardWrite:Sa,initialCopied:F})})}),t[30]=P,t[31]=F,t[32]=I):I=t[32];let R;t[33]!==N||t[34]!==I?(R=(0,Z.jsxs)(`div`,{className:`relative`,children:[N,I]}),t[33]=N,t[34]=I,t[35]=R):R=t[35];let z=c?.freshness,B=n?.kind??`doc`,V;t[36]!==a||t[37]!==z||t[38]!==B?(V=(0,Z.jsx)(ei,{freshness:z,status:a,kind:B}),t[36]=a,t[37]=z,t[38]=B,t[39]=V):V=t[39];let H;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Z.jsxs)(`a`,{href:HF,target:`_blank`,rel:`noopener noreferrer`,onClick:GF,onAuxClick:WF,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)(l,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(J,{id:`aByJ8j`})]}),t[40]=H):H=t[40];let U;t[41]!==O||t[42]!==A||t[43]!==R||t[44]!==V?(U=(0,Z.jsxs)(ie,{align:`end`,className:O,"data-testid":`share-button-popover`,children:[k,A,R,V,H]}),t[41]=O,t[42]=A,t[43]=R,t[44]=V,t[45]=U):U=t[45];let W;return t[46]!==E||t[47]!==U||t[48]!==y?(W=(0,Z.jsxs)(ae,{open:y,onOpenChange:b,children:[E,U]}),t[46]=E,t[47]=U,t[48]=y,t[49]=W):W=t[49],W}function WF(e){return hu(e,HF)}function GF(e){return hu(e,HF)}function KF(e){return e.currentTarget.select()}function qF(e){return e.currentTarget.select()}function JF(e){return e.currentTarget.select()}function YF(e){return console.log(e)}function XF(e){e!==`Link ready but could not copy to clipboard.`&&hs.error(e)}function ZF(e){return hs.success(e)}function QF(e){let t=(0,$.c)(35),{onSignIn:n,onSetIdentity:r,onOpenSearch:i}=e,{_:a}=kt(),{activeDocName:o,activeTarget:s}=Ye(),c=o?er(o):null,{state:l,isDraggingRail:u}=Wj(),d=_g(),f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f=Al(`toggle-files-sidebar`),t[0]=f):f=t[0];let p=f,m=Al(`command-palette`),[h,g]=(0,Q.useState)(!1),_;bb0:{if(s?.kind===`folder`){let e;t[1]===s.folderPath?e=t[2]:(e=Pa(s.folderPath),t[1]=s.folderPath,t[2]=e),_=e;break bb0}if(o&&!c){let e;t[3]===o?e=t[4]:(e=Ha(o),t[3]=o,t[4]=e),_=e;break bb0}if(!s&&!o){let e;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=Pa(``),t[5]=e):e=t[5],_=e;break bb0}_=null}let v=_,y=typeof window<`u`&&window.okDesktop!=null,b=l===`collapsed`,x=y?``:void 0,S=y&&b&&`pl-[var(--ok-titlebar-reserve-left,1rem)]`,C=y&&!u&&`motion-safe:transition-[padding] motion-safe:duration-200 motion-safe:ease-linear`,w;t[6]!==S||t[7]!==C?(w=X(`flex h-12 shrink-0 items-center bg-muted/35 shadow-[inset_0_-1px_0_var(--border)]`,y&&`[-webkit-app-region:drag]`,S,C),t[6]=S,t[7]=C,t[8]=w):w=t[8];let T=!d&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Os,{children:[(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(Yj,{className:X(`-ml-1 shrink-0 text-muted-foreground`,y&&`[-webkit-app-region:no-drag]`)})}),(0,Z.jsx)(Es,{children:l===`expanded`?(0,Z.jsx)(J,{id:`ZxXhLY`,values:{sidebarShortcut:p}}):(0,Z.jsx)(J,{id:`Zz25kq`,values:{sidebarShortcut:p}})})]}),b&&i&&(0,Z.jsxs)(Os,{children:[(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(Jr,{variant:`ghost`,size:`icon-sm`,onClick:i,"aria-label":a({id:`IN4UX8`,values:{searchShortcut:m}}),"data-telemetry-event":`ok.editor_header.search.click`,className:X(`shrink-0 text-muted-foreground`,y&&`[-webkit-app-region:no-drag]`),children:(0,Z.jsx)(Te,{"aria-hidden":`true`})})}),(0,Z.jsx)(Es,{children:(0,Z.jsx)(J,{id:`IN4UX8`,values:{searchShortcut:m}})})]}),(0,Z.jsx)(eo,{orientation:`vertical`,className:`mr-1 h-4 shrink-0 data-vertical:self-center`}),(0,Z.jsx)(eF,{})]}),E;t[9]===T?E=t[10]:(E=(0,Z.jsx)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1 px-3`,children:T}),t[9]=T,t[10]=E);let D;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(D=X(`flex shrink-0 items-center justify-end gap-2 px-3`,y&&`[&>*]:[-webkit-app-region:no-drag]`),t[11]=D):D=t[11];let O;t[12]!==h||t[13]!==g||t[14]!==v||t[15]!==d?(O=!d&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(UF,{input:v,onClickWhenNoRemote:()=>g(!0)}),(0,Z.jsx)(wo,{open:h,onOpenChange:g})]}),t[12]=h,t[13]=g,t[14]=v,t[15]=d,t[16]=O):O=t[16];let k;t[17]!==r||t[18]!==n?(k=(0,Z.jsx)(to,{onSignIn:n,onSetIdentity:r}),t[17]=r,t[18]=n,t[19]=k):k=t[19];let A,j,M;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(GN,{}),j=(0,Z.jsx)(eo,{orientation:`vertical`,className:`h-4 shrink-0 data-vertical:self-center`}),M=(0,Z.jsx)(JN,{}),t[20]=A,t[21]=j,t[22]=M):(A=t[20],j=t[21],M=t[22]);let N;t[23]===d?N=t[24]:(N=!d&&(0,Z.jsx)(VF,{}),t[23]=d,t[24]=N);let P;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(RF,{}),t[25]=P):P=t[25];let F;t[26]!==O||t[27]!==k||t[28]!==N?(F=(0,Z.jsxs)(`div`,{className:D,children:[O,k,A,j,M,N,P]}),t[26]=O,t[27]=k,t[28]=N,t[29]=F):F=t[29];let I;return t[30]!==F||t[31]!==x||t[32]!==w||t[33]!==E?(I=(0,Z.jsxs)(`header`,{"data-electron-drag":x,className:w,children:[E,F]}),t[30]=F,t[31]=x,t[32]=w,t[33]=E,t[34]=I):I=t[34],I}var $F=`open-knowledge:terminal-launch`;function eI(e,t,n=typeof window>`u`?new EventTarget:window){n.dispatchEvent(new CustomEvent($F,{detail:{prompt:e,cli:t}}))}function tI(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($F,n),()=>t.removeEventListener($F,n)}function nI(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)(om,{"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 rI=qr(`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 iI(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(rI({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)(sm,{"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 aI(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)(cm,{"data-slot":`tabs-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function oI(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)(lm,{"data-slot":`tabs-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var sI=(0,Q.lazy)(()=>n(()=>import(`./TerminalPanel-Cc0voOqd.js`).then(e=>({default:e.TerminalPanel})),__vite__mapDeps([101,1,10,3,11,6,7,13,62,16,40,102,72,33,34,56,103]),import.meta.url));function cI(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}=Co(),f=To(),{_:p}=kt(),m=d&&u===!1,g;t[0]!==p||t[1]!==f?(g=function(){if(f===null){hs.error(p({id:`V_6bJ4`}));return}let e=f(!0);e.ok||hs.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:uI,onError:lI,children:(0,Z.jsx)(Q.Suspense,{fallback:e,children:(0,Z.jsx)(sI,{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)(pI,{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 lI(e,t){console.error(`[TerminalGate] rendered fallback for the terminal panel`,e,t.componentStack)}function uI(e){return(0,Z.jsx)(dI,{...e})}function dI(e){let t=(0,$.c)(15),{error:n}=e,{_:r}=kt(),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)(Jr,{onClick:fI,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 fI(){return window.location.reload()}function pI(e){let t=(0,$.c)(20),{onEnable:n}=e,{_:r}=kt(),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)(Jr,{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 mI(e){let t=(0,$.c)(48),{selected:n,onLaunchSelected:r,onPickCli:i,onPickTerminal:a,className:o}=e,{_:s}=kt(),c=n===`terminal`,l;t[0]!==s||t[1]!==c||t[2]!==n?(l=s(c?{id:`AB4qw9`}:{id:`nP-KFo`,values:{0:zr[n].displayName}}),t[0]=s,t[1]=c,t[2]=n,t[3]=l):l=t[3];let u=l,d;t[4]===o?d=t[5]:(d=X(`flex shrink-0 items-center`,o),t[4]=o,t[5]=d);let f;t[6]!==c||t[7]!==n?(f=c?(0,Z.jsx)(Mf,{"aria-hidden":`true`,className:`size-3.5`}):(0,Z.jsx)(ma,{id:pa(n),className:`size-3.5`,"aria-hidden":`true`}),t[6]=c,t[7]=n,t[8]=f):f=t[8];let p;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(nt,{"aria-hidden":`true`,className:`size-3`}),t[9]=p):p=t[9];let m;t[10]!==r||t[11]!==u||t[12]!==f?(m=(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsxs)(Jr,{type:`button`,variant:`ghost`,size:`xs`,"aria-label":u,"data-testid":`terminal-new-chat`,className:`cursor-pointer gap-0.5 rounded-r-none px-1.5 text-muted-foreground hover:text-foreground`,onClick:r,children:[f,p]})}),t[10]=r,t[11]=u,t[12]=f,t[13]=m):m=t[13];let h;t[14]===u?h=t[15]:(h=(0,Z.jsx)(Es,{side:`bottom`,sideOffset:8,children:u}),t[14]=u,t[15]=h);let g;t[16]!==m||t[17]!==h?(g=(0,Z.jsxs)(Os,{children:[m,h]}),t[16]=m,t[17]=h,t[18]=g):g=t[18];let _;t[19]===s?_=t[20]:(_=s({id:`QJaG-9`}),t[19]=s,t[20]=_);let v;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(ea,{"aria-hidden":`true`,className:`size-3`}),t[21]=v):v=t[21];let y;t[22]===_?y=t[23]:(y=(0,Z.jsx)(ic,{asChild:!0,children:(0,Z.jsx)(Jr,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":_,"data-testid":`terminal-new-chat-menu`,className:`cursor-pointer rounded-l-none text-muted-foreground hover:text-foreground`,children:v})}),t[22]=_,t[23]=y);let b;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(kc,{children:(0,Z.jsx)(J,{id:`hIQkLb`})}),t[24]=b):b=t[24];let x;t[25]!==s||t[26]!==i||t[27]!==n?(x=wa.map(e=>{let{displayName:t}=zr[e];return(0,Z.jsxs)(vc,{onSelect:()=>i(e),"data-testid":`terminal-new-chat-cli-${e}`,"aria-label":s({id:`9mEZeD`,values:{name:t}}),"aria-current":n===e?`true`:void 0,children:[(0,Z.jsx)(ma,{id:pa(e),className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:t}),n===e?(0,Z.jsx)($i,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e)}),t[25]=s,t[26]=i,t[27]=n,t[28]=x):x=t[28];let S;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(mc,{}),t[29]=S):S=t[29];let C=c?`true`:void 0,w;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(Mf,{"aria-hidden":`true`,className:`size-4`}),t[30]=w):w=t[30];let T;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(J,{id:`ALhMYW`})}),t[31]=T):T=t[31];let E;t[32]===c?E=t[33]:(E=c?(0,Z.jsx)($i,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null,t[32]=c,t[33]=E);let D;t[34]!==a||t[35]!==C||t[36]!==E?(D=(0,Z.jsxs)(vc,{onSelect:a,"data-testid":`terminal-new-chat-terminal`,"aria-current":C,children:[w,T,E]}),t[34]=a,t[35]=C,t[36]=E,t[37]=D):D=t[37];let O;t[38]!==x||t[39]!==D?(O=(0,Z.jsxs)(bc,{align:`start`,className:`min-w-[180px]`,children:[b,x,S,D]}),t[38]=x,t[39]=D,t[40]=O):O=t[40];let k;t[41]!==y||t[42]!==O?(k=(0,Z.jsxs)(Ec,{children:[y,O]}),t[41]=y,t[42]=O,t[43]=k):k=t[43];let A;return t[44]!==d||t[45]!==k||t[46]!==g?(A=(0,Z.jsxs)(`div`,{className:d,children:[g,k]}),t[44]=d,t[45]=k,t[46]=g,t[47]=A):A=t[47],A}var hI=`[data-terminal-tab-sortable]`;function gI(e){let t=(0,$.c)(17),{id:n,disabled:r,isActive:i,children:a}=e,o;t[0]!==r||t[1]!==n?(o={id:n,disabled:r},t[0]=r,t[1]=n,t[2]=o):o=t[2];let{setNodeRef:s,listeners:c,rect:l,transform:u,transition:d,isDragging:f}=Qo(o),p=l.current?.width,m;t[3]!==f||t[4]!==p||t[5]!==u||t[6]!==d?(m=kP({activeWidth:p,isDragging:f,transform:u,transition:d}),t[3]=f,t[4]=p,t[5]=u,t[6]=d,t[7]=m):m=t[7];let h=m,g=i?`bg-muted`:`hover:bg-muted/50`,_=f&&`z-10`,v;t[8]!==g||t[9]!==_?(v=X(`group flex shrink-0 cursor-default items-center rounded-md pr-0.5 transition-colors`,g,_),t[8]=g,t[9]=_,t[10]=v):v=t[10];let y;return t[11]!==a||t[12]!==c||t[13]!==s||t[14]!==h||t[15]!==v?(y=(0,Z.jsx)(`div`,{ref:s,"data-terminal-tab-sortable":``,style:h,className:v,...c,children:a}),t[11]=a,t[12]=c,t[13]=s,t[14]=h,t[15]=v,t[16]=y):y=t[16],y}function _I(e){let t=(0,$.c)(84),{sessions:n,activeSessionId:r,onSelect:i,onTabActivate:a,newChatSelected:o,onNewChatLaunch:s,onNewChatPickCli:c,onNewChatPickTerminal:l,onClose:u,onRename:d,onReorder:f,onDragActiveChange:p,dockPosition:m,onToggleDock:h,onCollapse:g,children:_,className:v,draggable:y}=e,{_:b}=kt(),x=m===`right`,[S,C]=(0,Q.useState)(null),[w,T]=(0,Q.useState)(``),E=(0,Q.useRef)(null),D=(0,Q.useRef)(!1),O=d!=null,k,A;t[0]===S?(k=t[1],A=t[2]):(k=()=>{S!=null&&(E.current?.focus(),E.current?.select())},A=[S],t[0]=S,t[1]=k,t[2]=A),(0,Q.useEffect)(k,A);let j,M;t[3]!==S||t[4]!==n?(j=()=>{S!=null&&!n.some(e=>e.id===S)&&(D.current=!1,C(null),T(``))},M=[n,S],t[3]=S,t[4]=n,t[5]=j,t[6]=M):(j=t[5],M=t[6]),(0,Q.useEffect)(j,M);let N=function(e){O&&(D.current=!1,C(e.id),T(e.label))},P;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(P=function(e){let t=typeof CSS<`u`&&CSS.escape?CSS.escape(e):e;queueMicrotask(()=>{document.querySelector(`[role="tab"][data-tab-id="${t}"]`)?.focus()})},t[7]=P):P=t[7];let F=P,I=function(e){D.current||d?.(e,w.trim()),D.current=!1,C(null),T(``),F(e)},L=(0,Q.useRef)(null),[R,z]=(0,Q.useState)(null),B;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(B={activationConstraint:{distance:8}},t[8]=B):B=t[8];let V=$o(Bo(Wo,B)),H=f!=null,U;t[9]===R?U=t[10]:(U=jP(R),t[9]=R,t[10]=U);let W;t[11]===U?W=t[12]:(W=[U],t[11]=U,t[12]=W);let G=W,K;t[13]===p?K=t[14]:(K=function(){z(AP(L.current,hI)),p?.(!0)},t[13]=p,t[14]=K);let ee=K,te;t[15]!==p||t[16]!==f||t[17]!==n?(te=function(e){z(null),p?.(!1);let t=String(e.active.id),r=e.over?String(e.over.id):null;if(!r||t===r)return;let i=n.map(yI),a=i.indexOf(t),o=i.indexOf(r);a<0||o<0||a===o||f?.(Xo(i,a,o))},t[15]=p,t[16]=f,t[17]=n,t[18]=te):te=t[18];let ne=te,re;t[19]===p?re=t[20]:(re=function(){z(null),p?.(!1)},t[19]=p,t[20]=re);let ie=re,q=nI,ae;t[21]===v?ae=t[22]:(ae=X(`flex min-h-0 min-w-0 flex-1 flex-col`,v),t[21]=v,t[22]=ae);let oe=y?``:void 0,se=y&&`h-[62px] [-webkit-app-region:drag] pr-[22px] pl-[calc(var(--ok-titlebar-reserve-left,1rem)+0.75rem)]`,ce;t[23]===se?ce=t[24]:(ce=X(`flex shrink-0 flex-row items-center gap-1 px-1.5 py-1`,se),t[23]=se,t[24]=ce);let le=iI,ue;t[25]===b?ue=t[26]:(ue=b({id:`1MGRQl`}),t[25]=b,t[26]=ue);let de=y&&`[-webkit-app-region:no-drag]`,fe;t[27]===de?fe=t[28]:(fe=X(`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`,de),t[27]=de,t[28]=fe);let pe=Ho,me=MP,he;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(he={container:typeof document<`u`?document.body:void 0},t[29]=he):he=t[29];let ge=Jo,_e;t[30]===n?_e=t[31]:(_e=n.map(vI),t[30]=n,t[31]=_e);let ve=Vo,ye=n.map(e=>{let t=e.id===r;return(0,Z.jsx)(gI,{id:e.id,disabled:!H||S!=null,isActive:t,children:S===e.id?(0,Z.jsx)(ZC,{className:X(`h-7 w-40 rounded-md border-0 bg-transparent dark:bg-transparent`,y&&`[-webkit-app-region:no-drag]`),children:(0,Z.jsx)(nw,{ref:E,value:w,"aria-label":b({id:`0TnCvC`,values:{0:e.label}}),"data-testid":`terminal-tab-rename-input`,className:`h-7 px-2 text-xs`,onChange:e=>T(e.target.value),onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),E.current?.blur()):e.key===`Escape`&&(e.preventDefault(),D.current=!0,E.current?.blur())},onBlur:()=>I(e.id)})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Os,{children:[(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(aI,{value:e.id,"data-tab-id":e.id,onClick:t=>{t.detail>=2||a?.(e.id)},onDoubleClick:()=>N(e),onKeyDown:t=>{t.key===`F2`&&(t.preventDefault(),N(e))},className:X(`h-7 flex-none rounded-md px-2 text-xs`,y&&`[-webkit-app-region:no-drag]`),children:(0,Z.jsx)(`span`,{className:`max-w-40 truncate`,children:e.label})})}),(0,Z.jsx)(Es,{side:`bottom`,sideOffset:8,children:e.label})]}),(0,Z.jsx)(Jr,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":b({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`,y&&`[-webkit-app-region:no-drag]`),onClick:t=>{t.stopPropagation(),u(e.id)},children:(0,Z.jsx)(gs,{"aria-hidden":`true`})})]})},e.id)}),be;t[32]!==ge||t[33]!==_e||t[34]!==ve||t[35]!==ye?(be=(0,Z.jsx)(ge,{items:_e,strategy:ve,children:ye}),t[32]=ge,t[33]=_e,t[34]=ve,t[35]=ye,t[36]=be):be=t[36];let xe;t[37]!==pe||t[38]!==ie||t[39]!==ne||t[40]!==ee||t[41]!==G||t[42]!==V||t[43]!==!1||t[44]!==me||t[45]!==he||t[46]!==be?(xe=(0,Z.jsx)(pe,{sensors:V,autoScroll:!1,collisionDetection:me,modifiers:G,onDragStart:ee,onDragEnd:ne,onDragCancel:ie,accessibility:he,children:be}),t[37]=pe,t[38]=ie,t[39]=ne,t[40]=ee,t[41]=G,t[42]=V,t[43]=!1,t[44]=me,t[45]=he,t[46]=be,t[47]=xe):xe=t[47];let Se;t[48]!==le||t[49]!==ue||t[50]!==fe||t[51]!==xe?(Se=(0,Z.jsx)(le,{variant:`line`,"aria-label":ue,className:fe,children:xe}),t[48]=le,t[49]=ue,t[50]=fe,t[51]=xe,t[52]=Se):Se=t[52];let Ce=y&&`[-webkit-app-region:no-drag]`,we;t[53]===Ce?we=t[54]:(we=X(`shrink-0`,Ce),t[53]=Ce,t[54]=we);let Te;t[55]!==o||t[56]!==s||t[57]!==c||t[58]!==l||t[59]!==we?(Te=(0,Z.jsx)(mI,{selected:o,onLaunchSelected:s,onPickCli:c,onPickTerminal:l,className:we}),t[55]=o,t[56]=s,t[57]=c,t[58]=l,t[59]=we,t[60]=Te):Te=t[60];let Ee;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=(0,Z.jsx)(`div`,{className:`flex-1`}),t[61]=Ee):Ee=t[61];let De;t[62]!==b||t[63]!==h||t[64]!==x?(De=h==null?null:(0,Z.jsxs)(Os,{children:[(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(Jr,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":b(x?{id:`rf6x3F`}:{id:`QNxpRm`}),className:`shrink-0 cursor-pointer text-muted-foreground hover:text-foreground`,onClick:h,children:x?(0,Z.jsx)(pf,{"aria-hidden":`true`}):(0,Z.jsx)(_f,{"aria-hidden":`true`})})}),(0,Z.jsx)(Es,{side:`bottom`,sideOffset:8,children:x?(0,Z.jsx)(J,{id:`rf6x3F`}):(0,Z.jsx)(J,{id:`QNxpRm`})})]}),t[62]=b,t[63]=h,t[64]=x,t[65]=De):De=t[65];let Oe;t[66]!==b||t[67]!==g||t[68]!==x?(Oe=g==null?null:(0,Z.jsxs)(Os,{children:[(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(Jr,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":b({id:`VZGGPK`}),className:`shrink-0 cursor-pointer text-muted-foreground hover:text-foreground`,onClick:g,children:x?(0,Z.jsx)(na,{"aria-hidden":`true`}):(0,Z.jsx)(ea,{"aria-hidden":`true`})})}),(0,Z.jsx)(Es,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(J,{id:`VZGGPK`})})]}),t[66]=b,t[67]=g,t[68]=x,t[69]=Oe):Oe=t[69];let ke;t[70]!==oe||t[71]!==ce||t[72]!==Se||t[73]!==Te||t[74]!==De||t[75]!==Oe?(ke=(0,Z.jsxs)(`div`,{ref:L,"data-electron-drag":oe,className:ce,children:[Se,Te,Ee,De,Oe]}),t[70]=oe,t[71]=ce,t[72]=Se,t[73]=Te,t[74]=De,t[75]=Oe,t[76]=ke):ke=t[76];let Ae;return t[77]!==q||t[78]!==r||t[79]!==_||t[80]!==i||t[81]!==ae||t[82]!==ke?(Ae=(0,Z.jsxs)(q,{value:r,onValueChange:i,className:ae,children:[ke,_]}),t[77]=q,t[78]=r,t[79]=_,t[80]=i,t[81]=ae,t[82]=ke,t[83]=Ae):Ae=t[83],Ae}function vI(e){return e.id}function yI(e){return e.id}function bI(e){return`terminal-session-${e}`}function xI(e){e!==``&&document.querySelector(`[data-terminal-session="${e}"] .xterm-helper-textarea`)?.focus()}function SI(e){return e?.contains(document.activeElement)??!1}function CI(e,t){return t===`window`||SI(e)}function wI(e){let t=(0,$.c)(61),{bridge:n,variant:r,visible:i,onVisibleChange:a,launch:o,installedClis:s,container:c,isShowing:l,onRequestEditorFocus:u,dockPosition:d,onToggleDock:f,onHasSessionsChange:p}=e,m=r===void 0?`dock`:r,h=o===void 0?null:o,{_:g}=kt(),[_]=(0,Q.useState)(FI),v,y;t[0]!==c||t[1]!==_?(v=()=>{_==null||c==null||_.parentElement!==c&&c.appendChild(_)},y=[_,c],t[0]=c,t[1]=_,t[2]=v,t[3]=y):(v=t[2],y=t[3]),(0,Q.useLayoutEffect)(v,y);let b=typeof n.terminal?.list==`function`,x;t[4]!==b||t[5]!==h||t[6]!==i?(x=()=>!b&&i?[{id:bI(1),launch:h,title:null,customLabel:null,ordinal:1,adoptPtyId:null}]:[],t[4]=b,t[5]=h,t[6]=i,t[7]=x):x=t[7];let[S,w]=(0,Q.useState)(x),T;t[8]!==b||t[9]!==i?(T=()=>!b&&i?bI(1):``,t[8]=b,t[9]=i,t[10]=T):T=t[10];let[E,D]=(0,Q.useState)(T),[O,k]=(0,Q.useState)(!b),A=(0,Q.useRef)(!1),j=(0,Q.useRef)(E),M=(0,Q.useRef)(S),N=(0,Q.useRef)(!b&&i?1:0),P=(0,Q.useRef)(i&&h?h.nonce:null),F=(0,Q.useRef)(m===`window`?!1:i),I=(0,Q.useRef)(new Map),L=function(e,t){if(t===null){I.current.delete(e);return}I.current.set(e,t);let r=M.current.find(t=>t.id===e);r!=null&&n.terminal?.setMeta?.(t,{ordinal:r.ordinal,customLabel:r.customLabel})},R=(0,Q.useRef)(0),z=function(e){N.current+=1;let t=bI(N.current);w(n=>[...n,{id:t,launch:e,title:null,customLabel:null,ordinal:N.current,adoptPtyId:null}]),D(t)},[B,V]=(0,Q.useState)(PI),[H,U]=(0,Q.useState)(NI),W;t[11]===s?W=t[12]:(W=s??{},t[11]=s,t[12]=W);let G=y_(B,W),K=H?`terminal`:G,ee=function(e){R.current+=1,z({prompt:null,cli:e,nonce:R.current})},te=function(){H?z(null):ee(G)},ne=function(e){U(!1),O_(!1);let t=p_(e);V(t),__(t),ee(e)},re=function(){U(!0),O_(!0),z(null)},ie;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(ie=function(e,t){let n=t.trim()===``?null:t.trim();w(t=>t.some(t=>t.id===e&&t.title!==n)?t.map(t=>t.id===e?{...t,title:n}:t):t)},t[13]=ie):ie=t[13];let ae=ie,oe=function(e,t){let r=t.trim()===``?null:t.trim();w(t=>t.some(t=>t.id===e&&t.customLabel!==r)?t.map(t=>t.id===e?{...t,customLabel:r}:t):t);let i=I.current.get(e);i!=null&&n.terminal?.setMeta?.(i,{customLabel:r})},se;t[14]===g?se=t[15]:(se=function(e){return e.customLabel??e.title??g({id:`OVjNeX`,values:{0:e.ordinal}})},t[14]=g,t[15]=se);let ce=se,le=(0,Q.useRef)(!1),ue=(0,Q.useRef)(null),de=(0,Q.useRef)(null),fe=function(e){w(t=>{if(e.length!==t.length)return t;let n=new Map(t.map(MI)),r=[];for(let i of e){let e=n.get(i);if(e==null)return t;r.push(e)}return r.every((e,n)=>e===t[n])?t:r});let t=e.map(e=>I.current.get(e)).filter(jI);t.length>0&&n.terminal?.setOrder?.(t)},pe=function(e){let t=M.current,n=t.findIndex(e=>e.id===j.current);if(n<0)return null;let r=n+e;if(r<0||r>=t.length)return null;let i=t.map(AI),[a]=i.splice(n,1);return i.splice(r,0,a),fe(i),{label:ce(t[n]),position:r+1,total:t.length}},me=(0,Q.useRef)(pe),he=(0,Q.useRef)(z),ge=function(e){let t=M.current,n=t.findIndex(t=>t.id===e);if(n===-1)return;let r=t.filter(t=>t.id!==e);if(e===E){let e=(t[n-1]??t[n+1])?.id??``;D(e),e!==``&&queueMicrotask(()=>xI(e))}w(r),r.length===0&&(a(!1),u())},_e=(0,Q.useRef)(kI);(0,Q.useEffect)(()=>{he.current=z,me.current=pe,j.current=E,M.current=S,_e.current=()=>{E!==``&&ge(E)}});let ve;t[16]!==h||t[17]!==O||t[18]!==S.length||t[19]!==i?(ve=[i,h,S.length,O],t[16]=h,t[17]=O,t[18]=S.length,t[19]=i,t[20]=ve):ve=t[20],(0,Q.useEffect)(()=>{if(!O)return;let e=F.current;if(F.current=i,h!=null&&h.nonce!==P.current){P.current=h.nonce,he.current(h);return}i&&!e&&S.length===0&&he.current(null)},ve);let ye;t[21]===n?ye=t[22]:(ye=[n],t[21]=n,t[22]=ye),(0,Q.useEffect)(()=>{if(typeof n.terminal?.list!=`function`||A.current)return;A.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(OI);N.current=Math.max(e.length,...e.map(DI)),w(e),D(e[0]?.id??``)}k(!0)}})(),()=>{e=!0,A.current=!1}},ye);let be;t[23]===n?be=t[24]:(be=[n],t[23]=n,t[24]=be),(0,Q.useEffect)(()=>q(e=>{let t=j.current,r=t===``?void 0:I.current.get(t);r==null?C():(n.terminal.input(r,e),queueMicrotask(()=>xI(t)))}),be);let xe;t[25]!==n||t[26]!==m?(xe=[n,m],t[25]=n,t[26]=m,t[27]=xe):xe=t[27],(0,Q.useEffect)(()=>n.onMenuAction(e=>{e===`new-terminal`?he.current(null):(e===`kill-terminal`||e===`close-active-tab-or-window`&&m===`window`)&&_e.current()}),xe);let Se;t[28]!==_||t[29]!==m?(Se=[_,m],t[28]=_,t[29]=m,t[30]=Se):Se=t[30],(0,Q.useEffect)(()=>{let e=function(e){if(!e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||!/^[1-9]$/.test(e.key)||!CI(_,m))return;let t=M.current[Number(e.key)-1];t!=null&&(e.preventDefault(),e.stopPropagation(),D(t.id),queueMicrotask(()=>xI(t.id)))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},Se);let Ce;t[31]!==g||t[32]!==_||t[33]!==m?(Ce=[_,m,g],t[31]=g,t[32]=_,t[33]=m,t[34]=Ce):Ce=t[34],(0,Q.useEffect)(()=>{let e=function(e){if(!e.metaKey||!e.shiftKey||e.ctrlKey||e.altKey)return;let t=e.key===`ArrowLeft`?-1:+(e.key===`ArrowRight`);if(t===0||!CI(_,m)||le.current)return;let n=e.target;if(n?.tagName===`INPUT`||n?.isContentEditable)return;let r=me.current(t);if(r==null)return;e.preventDefault(),e.stopPropagation(),queueMicrotask(()=>xI(j.current));let i=g({id:`CoHvYd`,values:{0:r.label,1:r.position,2:r.total}});de.current!=null&&window.clearTimeout(de.current),de.current=window.setTimeout(()=>{de.current=null,ue.current!=null&&(ue.current.textContent=i)},60)};return window.addEventListener(`keydown`,e,{capture:!0}),()=>{window.removeEventListener(`keydown`,e,{capture:!0}),de.current!=null&&(window.clearTimeout(de.current),de.current=null)}},Ce);let we;t[35]!==n.editor||t[36]!==S.length?(we=()=>{n.editor.notifyViewMenuStateChanged({terminalLive:S.length>0})},t[35]=n.editor,t[36]=S.length,t[37]=we):we=t[37];let Te;t[38]!==n||t[39]!==S.length?(Te=[n,S.length],t[38]=n,t[39]=S.length,t[40]=Te):Te=t[40],(0,Q.useEffect)(we,Te);let Ee,De;t[41]!==p||t[42]!==S.length?(Ee=()=>{p?.(S.length>0)},De=[p,S.length],t[41]=p,t[42]=S.length,t[43]=Ee,t[44]=De):(Ee=t[43],De=t[44]),(0,Q.useEffect)(Ee,De);let Oe,ke;t[45]!==_||t[46]!==l||t[47]!==u||t[48]!==i?(Oe=()=>{l||i||SI(_)&&u()},ke=[l,i,_,u],t[45]=_,t[46]=l,t[47]=u,t[48]=i,t[49]=Oe,t[50]=ke):(Oe=t[49],ke=t[50]),(0,Q.useLayoutEffect)(Oe,ke);let Ae;t[51]===l?Ae=t[52]:(Ae=[l],t[51]=l,t[52]=Ae),(0,Q.useEffect)(()=>{l&&xI(j.current)},Ae);let je;if(t[53]!==g||t[54]!==S){let e;t[56]===g?e=t[57]:(e=e=>({id:e.id,label:e.customLabel??e.title??g({id:`OVjNeX`,values:{0:e.ordinal}})}),t[56]=g,t[57]=e),je=S.map(e),t[53]=g,t[54]=S,t[55]=je}else je=t[55];let Me=je,Ne=[...S].sort(EI),Pe=S.length>0?(0,Z.jsx)(_I,{sessions:Me,activeSessionId:E,onSelect:D,onTabActivate:TI,newChatSelected:K,onNewChatLaunch:te,onNewChatPickCli:ne,onNewChatPickTerminal:re,onClose:ge,onRename:oe,onReorder:fe,onDragActiveChange:e=>{le.current=e},dockPosition:d,onToggleDock:f,onCollapse:m===`window`?void 0:()=>a(!1),draggable:m===`window`,className:`h-full`,children:Ne.map(e=>(0,Z.jsx)(oI,{value:e.id,forceMount:!0,"data-terminal-session":e.id,className:X(`m-0 flex min-h-0 flex-1 flex-col overflow-hidden data-[state=inactive]:hidden`,m===`window`&&`px-[22px] pb-[22px]`),children:(0,Z.jsx)(cI,{bridge:n,launch:e.launch,adoptPtyId:e.adoptPtyId,onPtyId:t=>L(e.id,t),onTitleChange:t=>ae(e.id,t),onClose:()=>ge(e.id)})},e.id))}):null,Fe;return t[58]!==_||t[59]!==Pe?(Fe=_==null?null:(0,Ed.createPortal)((0,Z.jsxs)(Z.Fragment,{children:[Pe,(0,Z.jsx)(`span`,{ref:ue,"aria-live":`polite`,"aria-atomic":`true`,className:`sr-only`,"data-testid":`terminal-reorder-announcer`})]}),_),t[58]=_,t[59]=Pe,t[60]=Fe):Fe=t[60],Fe}function TI(e){return queueMicrotask(()=>xI(e))}function EI(e,t){return e.ordinal-t.ordinal}function DI(e){return e.ordinal}function OI(e,t){return{id:bI(t+1),launch:null,title:null,customLabel:e.customLabel??null,ordinal:e.ordinal??t+1,adoptPtyId:e.ptyId}}function kI(){}function AI(e){return e.id}function jI(e){return e!=null}function MI(e){return[e.id,e]}function NI(){return k_()}function PI(){return g_()}function FI(){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 II(e){let t=(0,$.c)(74),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{onOpenSearch:r}=n,[i,a]=i_(),[o,s]=(0,Q.useState)(i),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(`auth`),[f,p]=(0,Q.useState)(Gv[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=a_(),[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)(T_),A;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(e){k(e),w_(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??y_(g_(),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?(B=function(){y(!0),!x&&!D_()&&z()},t[8]=x,t[9]=z,t[10]=B):B=t[10];let V=B,H=Ri(),{projectConfig:U,projectLocalConfig:W,projectLocalSynced:G,projectSynced:K}=au(),{activeDocName:ee}=Ye(),te=H?.hasRemote,ne=H?.pushPermission?.checkStatus,re;t[11]!==m||t[12]!==U||t[13]!==W||t[14]!==G||t[15]!==K||t[16]!==te||t[17]!==ne?(re=M_({autoSyncOnboardingDismissed:m,hasRemote:te,projectLocalSynced:G,projectSynced:K,projectLocalConfig:W,projectConfig:U,pushPermissionCheckStatus:ne}),t[11]=m,t[12]=U,t[13]=W,t[14]=G,t[15]=K,t[16]=te,t[17]=ne,t[18]=re):re=t[18];let ie=re,q,ae;t[19]===ee?(q=t[20],ae=t[21]):(q=()=>{let e=function(e){let t=e.detail;t&&ee&&cu(ee,{kind:`raw-mdx`,detail:t}),s(`source`)};return window.addEventListener(Xg,e),()=>window.removeEventListener(Xg,e)},ae=[ee],t[19]=ee,t[20]=q,t[21]=ae),(0,Q.useEffect)(q,ae);let oe,se;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(oe=()=>{let e=window.okDesktop;if(e!=null)return e.onMenuAction(e=>{e===`toggle-terminal`?y(zI):e===`new-terminal`&&y(!0)})},se=[],t[22]=oe,t[23]=se):(oe=t[22],se=t[23]),(0,Q.useEffect)(oe,se);let ce,le;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(ce=()=>{if(window.okDesktop!=null)return;let e=function(e){jl(e,`toggle-terminal-panel`)&&(e.preventDefault(),y(RI))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},le=[],t[24]=ce,t[25]=le):(ce=t[24],le=t[25]),(0,Q.useEffect)(ce,le);let ue,de;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(ue=()=>tI((e,t)=>{y(!0),L.current+=1,D({prompt:e,cli:t,nonce:L.current})}),de=[],t[26]=ue,t[27]=de):(ue=t[26],de=t[27]),(0,Q.useEffect)(ue,de);let fe,pe;t[28]===v?(fe=t[29],pe=t[30]):(fe=()=>{v||D(null)},pe=[v],t[28]=v,t[29]=fe,t[30]=pe),(0,Q.useEffect)(fe,pe);let me,he;t[31]!==C||t[32]!==v?(me=()=>{window.okDesktop!=null&&C&&window.okDesktop.editor.notifyViewMenuStateChanged({terminalVisible:v})},he=[v,C],t[31]=C,t[32]=v,t[33]=me,t[34]=he):(me=t[33],he=t[34]),(0,Q.useEffect)(me,he);let ge,_e;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(ge=()=>{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(LI).finally(()=>{t||w(!0)}),()=>{t=!0}},_e=[],t[35]=ge,t[36]=_e):(ge=t[35],_e=t[36]),(0,Q.useEffect)(ge,_e);let ve,ye;t[37]===v?(ve=t[38],ye=t[39]):(ve=()=>{if(window.okDesktop!=null){if(T.current){T.current=!1;return}v&&Xa()}},ye=[v],t[37]=v,t[38]=ve,t[39]=ye),(0,Q.useEffect)(ve,ye),s_(H?.pausedReason),c_();let be;t[40]===a?be=t[41]:(be=function(e){s(e),a(e)},t[40]=a,t[41]=be);let xe=be,Se,Ce;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(Se=()=>{d(`auth`),l(!0)},Ce=()=>{d(`identity`),l(!0)},t[42]=Se,t[43]=Ce):(Se=t[42],Ce=t[43]);let we;t[44]===r?we=t[45]:(we=(0,Z.jsx)(QF,{onSignIn:Se,onSetIdentity:Ce,onOpenSearch:r}),t[44]=r,t[45]=we);let Te=_?V:void 0,Ee;t[46]!==f||t[47]!==o||t[48]!==xe||t[49]!==Te||t[50]!==O||t[51]!==v?(Ee=(0,Z.jsx)(aN,{editorMode:o,onModeChange:xe,activeTab:f,onActiveTabChange:p,terminalBridge:g,terminalVisible:v,onTerminalVisibleChange:y,terminalDock:O,onTerminalPlacement:I,onRevealTerminal:Te}),t[46]=f,t[47]=o,t[48]=xe,t[49]=Te,t[50]=O,t[51]=v,t[52]=Ee):Ee=t[52];let De;t[53]!==b||t[54]!==O||t[55]!==E||t[56]!==F||t[57]!==v||t[58]!==N?(De=_&&g!=null?(0,Z.jsx)(wI,{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[53]=b,t[54]=O,t[55]=E,t[56]=F,t[57]=v,t[58]=N,t[59]=De):De=t[59];let Oe=u===`identity`,ke;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(ke=()=>{l(!1)},t[60]=ke):ke=t[60];let Ae;t[61]!==c||t[62]!==Oe?(Ae=(0,Z.jsx)(Ja,{open:c,onOpenChange:l,identityPrompt:Oe,onSuccess:ke}),t[61]=c,t[62]=Oe,t[63]=Ae):Ae=t[63];let je;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(je=()=>h(!0),t[64]=je):je=t[64];let Me;t[65]===ie?Me=t[66]:(Me=(0,Z.jsx)(A_,{open:ie,onResolved:je}),t[65]=ie,t[66]=Me);let Ne;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=(0,Z.jsx)(qg,{}),t[67]=Ne):Ne=t[67];let Pe;return t[68]!==we||t[69]!==Ee||t[70]!==De||t[71]!==Ae||t[72]!==Me?(Pe=(0,Z.jsxs)(Z.Fragment,{children:[we,Ee,De,Ae,Me,Ne]}),t[68]=we,t[69]=Ee,t[70]=De,t[71]=Ae,t[72]=Me,t[73]=Pe):Pe=t[73],Pe}function LI(e){console.error(`[terminal] dock-state restore failed; staying hidden:`,e)}function RI(e){return!e}function zI(e){return!e}function BI(e){let t=El(_l(e));typeof window>`u`||window.location.hash!==t&&(window.location.hash=t)}function VI(){let e=(0,$.c)(11),{conflicts:t,loading:n,error:r}=Wa();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)(os,{"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)(os,{"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(HI),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 HI(e){return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(Jr,{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:()=>BI(e.file),children:[(0,Z.jsx)(os,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:e.file})]})},e.file)}var UI=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
30
30
  <symbol id="file-tree-icon-chevron" viewBox="0 0 16 16">
31
31
  <path d="M12.4697 5.46973C12.7626 5.17684 13.2374 5.17684 13.5303 5.46973C13.8232 5.76262 13.8232 6.23738 13.5303 6.53028L8.53028 11.5303C8.23738 11.8232 7.76262 11.8232 7.46973 11.5303L2.46973 6.53028C2.17684 6.23738 2.17684 5.76262 2.46973 5.46973C2.76262 5.17684 3.23738 5.17684 3.53028 5.46973L8 9.93946L12.4697 5.46973Z" fill="currentcolor"/>
32
32
  </symbol>
@@ -1999,5 +1999,5 @@ Error generating stack: `+e.message+`
1999
1999
  :host([${sY}]) [data-item-focused="true"] {
2000
2000
  --trees-focus-ring-color: transparent;
2001
2001
  }
2002
- `}\n${fq}\n${pq}`;function lY(e){let t=e.split(`/`).pop()?.replace(/\.md$/i,``).toLowerCase();return!!t&&qJ.has(t)}function uY(e){return e===`darwin`?Gc._({id:`LtSYdi`}):e===`win32`?Gc._({id:`qi1F96`}):Gc._({id:`e1Rn_k`})}function dY(e){let t=(0,$.c)(18),{item:n,workspace:r,onClose:i}=e,{_:a}=kt(),o=typeof window<`u`?window.okDesktop:void 0;if(!o)return null;let s=o.platform,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=uY(s),t[0]=c):c=t[0];let l=c,u,d;t[1]!==a||t[2]!==r?(u=r?null:a({id:`wTcjov`}),d=a(s===`darwin`?u?{id:`FvpFSZ`,values:{hint:u}}:{id:`LtSYdi`}:s===`win32`?u?{id:`o4dcAf`,values:{hint:u}}:{id:`qi1F96`}:u?{id:`zUhPuR`,values:{hint:u}}:{id:`e1Rn_k`}),t[1]=a,t[2]=r,t[3]=u,t[4]=d):(u=t[3],d=t[4]);let f=d,p=!r,m;t[5]!==n||t[6]!==i||t[7]!==r?(m=()=>{if(!r)return;i();let e=Mo(r.contentDir,Pu(n),r.pathSeparator);o.shell.showItemInFolder(e)},t[5]=n,t[6]=i,t[7]=r,t[8]=m):m=t[8];let h,g;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(Ro,{"aria-hidden":`true`}),g=(0,Z.jsx)(`span`,{className:`flex-1`,children:l}),t[9]=h,t[10]=g):(h=t[9],g=t[10]);let _;t[11]===u?_=t[12]:(_=u?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:u}):null,t[11]=u,t[12]=_);let v;return t[13]!==f||t[14]!==p||t[15]!==m||t[16]!==_?(v=(0,Z.jsxs)(vc,{disabled:p,onSelect:m,"aria-label":f,children:[h,g,_]}),t[13]=f,t[14]=p,t[15]=m,t[16]=_,t[17]=v):v=t[17],v}function fY(e,t){return Mu({kind:e.endsWith(`/`)?`directory`:`file`,name:e,path:e},t)}function pY(e){let t=e.match(/\.(md|mdx)$/i);if(!t)return null;let n=t[0].toLowerCase()===`.md`?`.mdx`:`.md`;return`${e.slice(0,-t[0].length)}${n}`}function mY(e,t){let n=pY(e);return n?t.includes(n):!1}function hY(e,t){return e!==t&&e.startsWith(t)}function gY(e,t){let n=[...new Set(e)],r=n.filter(e=>e.endsWith(`/`));return n.filter(e=>!r.some(t=>hY(e,t))).map(e=>fY(e,t))}function _Y(e,t){let n=e.getItem(t)??e.getItem(Ju(t));return n?.isDirectory()?Ju(nd(n.getPath())):t}function vY(e){let t=e.getFocusedPath()??e.getSelectedPaths()[0]??null;return t?_Y(e,t):null}function yY(e,t,n){let r=vY(e);return!r||n.has(r)?null:fY(r,t)}function bY(e,t){let n=e.getSelectedPaths(),r=vY(e);return gY(n.length>0?n.map(t=>_Y(e,t)):r?[r]:[],t)}function xY(e,t){return e===t||e.startsWith(`${t}/`)}function SY(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName;return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`||e.isContentEditable||e.closest(`[contenteditable="true"]`)!==null}function CY(e,t,n){let r=new Set,i=new Set,a=new Set;for(let o of e){if(o.kind===`file`){r.add(o.path);continue}if(o.kind===`asset`){a.add(o.path);continue}i.add(o.path);for(let e of t)ol(e)&&e.docName.startsWith(`${o.path}/`)?r.add(e.docName):el(e)&&e.path.startsWith(`${o.path}/`)&&a.add(e.path);for(let e of n){let t=nd(e);xY(t,o.path)&&i.add(t)}}return{docNames:r,folderPaths:i,assetPaths:a}}function wY(e,t){return e.kind===`file`?t.kind===`file`&&e.path===t.createdPath:e.kind===`asset`?!1:xY(t.createdPath,e.path)}function TY(e){let t=(0,$.c)(71),{item:n,context:r,anyActionBusy:i,workspace:a,handoff:o,model:s,okignoreBinding:c,projectLocalBinding:l,mergedConfig:u,onStartCreating:d,onCreateFromTemplate:f,onDuplicate:p,onDelete:m,onExpandSubtree:h,onCollapseSubtree:g,folderTreePaths:v,isAsset:y,documents:b}=e,{_:x}=kt(),S=Mu(n,b),C=n.kind===`directory`,w=S.kind===`asset`?null:S,T=w!==null&&c!==null,E;t[0]!==x||t[1]!==C?(E=x(C?{id:`5D3Ior`}:{id:`dbhUX1`}),t[0]=x,t[1]=C,t[2]=E):E=t[2];let D=E,O=u?.appearance?.sidebar?.showHiddenFiles??!1,k=l!==null,A;t[3]!==C||t[4]!==n.path?(A=C?nd(n.path):null,t[3]=C,t[4]=n.path,t[5]=A):A=t[5];let j=vo(A),M=j.state.status===`ready`?(j.state.data.folder.templates_available?.length??0)>0:!0,N=s.getSelectedPaths(),P=N.includes(S.treePath)?gY(N,b):[],F=P.length>1?P:[S],I=F.length,L=Gc._({id:`djjdjr`,values:{deleteCount:I}}),R;t[6]!==b||t[7]!==y||t[8]!==C||t[9]!==n||t[10]!==a?(R=y?null:C?da({folderRelativePath:Pu(n),workspace:a}):Ea({docName:td(n.path,b),workspace:a}),t[6]=b,t[7]=y,t[8]=C,t[9]=n,t[10]=a,t[11]=R):R=t[11];let z=R,B;t[12]===r?B=t[13]:(B=()=>r.close({restoreFocus:!1}),t[12]=r,t[13]=B);let V=B,H;t[14]===r?H=t[15]:(H=()=>r.close(),t[14]=r,t[15]=H);let U=H,{status:W}=zi(),G=W?.hasRemote===!0,K;t[16]!==b||t[17]!==y||t[18]!==C||t[19]!==n.path||t[20]!==S?(K=y||S.kind===`asset`?null:C?Pa(nd(n.path)):Ha(td(n.path,b)),t[16]=b,t[17]=y,t[18]=C,t[19]=n.path,t[20]=S,t[21]=K):K=t[21];let ee=K,te=G&&ee!==null,ne;t[22]!==x||t[23]!==G||t[24]!==ee?(ne=()=>{ee&&La({...ee,hasRemote:G,onClickWhenNoRemote:()=>{hs.error(x({id:`WyQxwa`}))}},{clipboardWrite:Sa,toastSuccess:OY,toastError:DY,logEvent:EY})},t[22]=x,t[23]=G,t[24]=ee,t[25]=ne):ne=t[25];let re=ne,ie;t[26]!==te||t[27]!==U||t[28]!==re?(ie=te?(0,Z.jsxs)(vc,{"data-testid":`file-tree-menu-share`,onSelect:()=>{U(),re()},children:[(0,Z.jsx)(Df,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`Z8lGw6`})]}):null,t[26]=te,t[27]=U,t[28]=re,t[29]=ie):ie=t[29];let q=ie,ae;t[30]!==x||t[31]!==l?(ae=e=>{if(l===null)return;let t=l.patch({appearance:{sidebar:{showHiddenFiles:e}}});t.ok||(console.warn(`[FileTree] showHiddenFiles toggle rejected:`,un(t.error)),hs.error(x({id:`P47EWZ`}),{description:un(t.error)}))},t[30]=x,t[31]=l,t[32]=ae):ae=t[32];let oe=ae,se=0,ce=0;if(C){let e=Ju(n.path);for(let t of v)(t===e||t.startsWith(e))&&(se++,aJ(s.getItem(t))?.isExpanded()&&ce++)}let le=C&&ce<se,ue=C&&ce>0,de;t[33]===U?de=t[34]:(de=e=>{e||U()},t[33]=U,t[34]=de);let fe;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(fe=(0,Z.jsx)(ic,{asChild:!0,children:(0,Z.jsx)(`span`,{"aria-hidden":`true`,"data-file-tree-context-menu-root":`true`,className:`block size-px`})}),t[35]=fe):fe=t[35];let pe;t[36]!==x||t[37]!==i||t[38]!==T||t[39]!==k||t[40]!==U||t[41]!==V||t[42]!==L||t[43]!==F||t[44]!==M||t[45]!==oe||t[46]!==o||t[47]!==z||t[48]!==D||t[49]!==y||t[50]!==C||t[51]!==n||t[52]!==s||t[53]!==c||t[54]!==w||t[55]!==g||t[56]!==f||t[57]!==m||t[58]!==p||t[59]!==h||t[60]!==d||t[61]!==q||t[62]!==O||t[63]!==ue||t[64]!==le||t[65]!==S||t[66]!==a?(pe=(0,Z.jsx)(bc,{sideOffset:0,align:`start`,"data-file-tree-context-menu-root":`true`,className:`min-w-52`,children:C?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(vc,{disabled:i,onSelect:()=>{V(),d(`file`,nd(n.path))},children:[(0,Z.jsx)(jf,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`HdkSiO`})]}),M?(0,Z.jsxs)(nc,{children:[(0,Z.jsxs)(hc,{disabled:i,children:[(0,Z.jsx)(ro,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`Uuj_R4`})]}),(0,Z.jsx)(Ac,{children:(0,Z.jsx)(iJ,{parentDir:nd(n.path),onSelectTemplate:e=>{V(),f(nd(n.path),e)},ItemComponent:vc})})]}):null,(0,Z.jsxs)(vc,{disabled:i,onSelect:()=>{V(),d(`folder`,nd(n.path))},children:[(0,Z.jsx)(qd,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`96G6Re`})]}),(0,Z.jsx)(mc,{}),(0,Z.jsx)(dY,{item:n,workspace:a,onClose:U}),(0,Z.jsx)(fa,{input:z,installStates:o.installStates,isElectronHost:o.isElectronHost,dispatch:o.dispatch}),q,(0,Z.jsxs)(nc,{children:[(0,Z.jsxs)(hc,{children:[(0,Z.jsx)(Oo,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`oCZkaG`})]}),(0,Z.jsxs)(Ac,{children:[(0,Z.jsx)(vc,{disabled:!a,onSelect:()=>{a&&(U(),KJ(Mo(a.contentDir,Pu(n),a.pathSeparator),`full`))},children:(0,Z.jsx)(J,{id:`oQA-cA`})}),(0,Z.jsx)(vc,{onSelect:()=>{U(),KJ(Pu(n),`relative`)},children:(0,Z.jsx)(J,{id:`s061i4`})})]})]}),(0,Z.jsx)(mc,{}),(0,Z.jsx)(wc,{checked:O,onCheckedChange:oe,disabled:!k,"data-testid":`file-tree-menu-show-hidden-files`,children:(0,Z.jsx)(J,{id:`XcGbim`})}),le||ue?(0,Z.jsx)(mc,{}):null,le?(0,Z.jsxs)(vc,{onSelect:()=>{U(),h(n.path)},children:[(0,Z.jsx)(Gf,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`OlAl5i`})]}):null,ue?(0,Z.jsxs)(vc,{onSelect:()=>{U(),g(n.path)},children:[(0,Z.jsx)(Gd,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`qvWGzP`})]}):null,(0,Z.jsx)(mc,{}),(0,Z.jsxs)(vc,{disabled:i,onSelect:()=>{S.kind!==`asset`&&(U(),p(S))},children:[(0,Z.jsx)(ko,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`euc6Ns`})]}),(0,Z.jsxs)(vc,{disabled:i,onSelect:()=>{V(),s.startRenaming(n.path)},children:[(0,Z.jsx)(Lo,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`2wxgft`})]}),(0,Z.jsxs)(vc,{"data-testid":`file-tree-menu-hide`,disabled:!T,onSelect:()=>{if(!c||!w)return;U();let e=Aq(w),t=uo(c.current()),n=xo(t,e);if(n===t)return;c.patch(Qa(n));let r=w.path.split(`/`).pop()||w.path;hs.success(x({id:`4xtLTl`,values:{basename:r}}),{description:x({id:`nWv1ja`}),duration:5e3})},children:[(0,Z.jsx)(_,{"aria-hidden":`true`}),D]}),(0,Z.jsxs)(vc,{variant:`destructive`,disabled:i,onSelect:()=>{U(),m(F)},children:[(0,Z.jsx)(as,{"aria-hidden":`true`}),L]})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(dY,{item:n,workspace:a,onClose:U}),!y&&(0,Z.jsx)(fa,{input:z,installStates:o.installStates,isElectronHost:o.isElectronHost,dispatch:o.dispatch}),q,(0,Z.jsxs)(nc,{children:[(0,Z.jsxs)(hc,{children:[(0,Z.jsx)(Oo,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`oCZkaG`})]}),(0,Z.jsxs)(Ac,{children:[(0,Z.jsx)(vc,{disabled:!a,onSelect:()=>{a&&(U(),KJ(Mo(a.contentDir,Pu(n),a.pathSeparator),`full`))},children:(0,Z.jsx)(J,{id:`oQA-cA`})}),(0,Z.jsx)(vc,{onSelect:()=>{U(),KJ(Pu(n),`relative`)},children:(0,Z.jsx)(J,{id:`s061i4`})})]})]}),(0,Z.jsx)(mc,{}),y?null:(0,Z.jsxs)(vc,{disabled:i,onSelect:()=>{U(),p(S)},children:[(0,Z.jsx)(ko,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`euc6Ns`})]}),(0,Z.jsxs)(vc,{disabled:i,onSelect:()=>{V(),s.startRenaming(n.path)},children:[(0,Z.jsx)(Lo,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`2wxgft`})]}),w?(0,Z.jsxs)(vc,{"data-testid":`file-tree-menu-hide`,disabled:!T,onSelect:()=>{if(!c)return;U();let e=Aq(w),t=uo(c.current()),n=xo(t,e);if(n===t)return;c.patch(Qa(n));let r=w.path.split(`/`).pop()||w.path;hs.success(x({id:`OD0FCX`,values:{basename:r}}),{description:x({id:`nWv1ja`}),duration:5e3})},children:[(0,Z.jsx)(_,{"aria-hidden":`true`}),D]}):null,(0,Z.jsxs)(vc,{variant:`destructive`,disabled:i,onSelect:()=>{U(),m(F)},children:[(0,Z.jsx)(as,{"aria-hidden":`true`}),L]})]})}),t[36]=x,t[37]=i,t[38]=T,t[39]=k,t[40]=U,t[41]=V,t[42]=L,t[43]=F,t[44]=M,t[45]=oe,t[46]=o,t[47]=z,t[48]=D,t[49]=y,t[50]=C,t[51]=n,t[52]=s,t[53]=c,t[54]=w,t[55]=g,t[56]=f,t[57]=m,t[58]=p,t[59]=h,t[60]=d,t[61]=q,t[62]=O,t[63]=ue,t[64]=le,t[65]=S,t[66]=a,t[67]=pe):pe=t[67];let me;return t[68]!==de||t[69]!==pe?(me=(0,Z.jsxs)(Ec,{open:!0,modal:!1,onOpenChange:de,children:[fe,pe]}),t[68]=de,t[69]=pe,t[70]=me):me=t[70],me}function EY(e){return console.log(e)}function DY(e){return hs.error(e)}function OY(e){return hs.success(e)}async function kY(e,t,n,r){try{let i=await fetch(`/api/documents?showAll=true&dir=${encodeURIComponent(e)}&depth=1`,{signal:t,headers:vJ});if(yJ(i)){let e=await SJ(i);return{kind:`entries`,entries:rl(e.entries),truncated:e.truncated}}let a=await Ot(i,n);if(!a.ok)return{kind:`http-error`,title:a.title};let o=pn.safeParse(a.body);return o.success?{kind:`entries`,entries:rl(o.data.documents),truncated:o.data.truncated===!0}:{kind:`http-error`,title:r}}catch(e){return e instanceof bJ?{kind:`http-error`,title:e.message}:{kind:`network-error`,cause:e}}}function AY(e){let t=(0,$.c)(360),{ref:n,onContentHeightChange:r}=e,{_:i,i18n:a}=kt(),{activeDocName:o,activeTarget:s,closeTabs:c,closeDocument:l,closeAndClearForRename:u,getPoolActiveDocName:d,poolHas:p,isNewTabActive:m,openTarget:h,prewarm:g,remapTabsForRename:_}=Ye(),{notifySidebarFileSelected:v}=Wj(),{resolvedTheme:y}=sn(),{addPage:b,pageMeta:x}=ia(),S;t[0]===x?S=t[1]:(S=function(e,t){return $c(e,t??x.get(e)?.size)??{kind:`doc`,target:e,docName:e}},t[0]=x,t[1]=S);let C=S,w;t[2]!==b||t[3]!==C||t[4]!==v||t[5]!==h?(w=function(e,t,n){n?.registerPage&&b(e),h(C(e,t),{tabBehavior:`replace-active`}),yl(El(e)),v()},t[2]=b,t[3]=C,t[4]=v,t[5]=h,t[6]=w):w=t[6];let T=w,E;t[7]!==v||t[8]!==h?(E=function(e){let t=vl(e);h({kind:`folder`,target:e,folderPath:e},{tabBehavior:`replace-active`}),yl(t),v()},t[7]=v,t[8]=h,t[9]=E):E=t[9];let D=E,O;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(O=[],t[10]=O):O=t[10];let[k,A]=(0,Q.useState)(O),[j,M]=(0,Q.useState)(!0),[N,P]=(0,Q.useState)(null),[F,I]=(0,Q.useState)(!1),L=kN(),R=(0,Q.useRef)(null),[z,B]=(0,Q.useState)(null),[V,H]=(0,Q.useState)(null),[U,W]=(0,Q.useState)(null),[G,K]=(0,Q.useState)(null),{conflicts:ee}=Wa(),[te,ne]=(0,Q.useState)(null),[re,ie]=(0,Q.useState)(null),[q,ae]=(0,Q.useState)(!1),oe=(0,Q.useRef)(q),se;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(se=new Set,t[11]=se):se=t[11];let ce=(0,Q.useRef)(se),le=(0,Q.useRef)(k),ue=(0,Q.useRef)(x),de=(0,Q.useRef)(null),fe;t[12]!==k||t[13]!==D||t[14]!==T||t[15]!==v||t[16]!==h?(fe=function(e,t){let n=t===void 0?k:t,r=Gq(e,n);if(r.kind===`none`){console.debug(`[FileTree] Dropped selection for unknown docName:`,ed(e));return}if(r.kind===`asset`){h({kind:`asset`,target:r.path,assetPath:r.path,mediaKind:r.mediaKind},{tabBehavior:`replace-active`}),yl(r.hash),v();return}if(r.kind===`folder`){D(r.path);return}let i=n.find(e=>ol(e)&&e.docName===r.path);T(r.path,i?.size,{registerPage:Kc(r.path)})},t[12]=k,t[13]=D,t[14]=T,t[15]=v,t[16]=h,t[17]=fe):fe=t[17];let pe=fe,me;t[18]!==v||t[19]!==h?(me=function(e,t){h({kind:`asset`,target:e,assetPath:e,mediaKind:(t??le.current).find(t=>el(t)&&t.path===e)?.mediaKind??null},{tabBehavior:`replace-active`}),yl(wl(e)),v()},t[18]=v,t[19]=h,t[20]=me):me=t[20];let he=me,ge=(0,Q.useRef)(o),_e;t[21]===k?_e=t[22]:(_e=new Set(k.filter(el).map(rX)),t[21]=k,t[22]=_e);let ye=_e,be=(0,Q.useRef)(ye),xe;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(xe=[],t[23]=xe):xe=t[23];let Se=(0,Q.useRef)(xe),Ce=(0,Q.useRef)(null),we=(0,Q.useRef)(nX),Te=(0,Q.useRef)(null),De=(0,Q.useRef)(null),Oe=(0,Q.useRef)(!1),ke=(0,Q.useRef)(!1),Ae=(0,Q.useRef)(null),je;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(je={row:null,root:null},t[24]=je):je=t[24];let Me=(0,Q.useRef)(je),Ne=(0,Q.useRef)(tX),Pe=(0,Q.useRef)(null),Fe=(0,Q.useRef)(null),Ie;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=new Map,t[25]=Ie):Ie=t[25];let Le=(0,Q.useRef)(Ie),Re;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(Re=new Set,t[26]=Re):Re=t[26];let ze=(0,Q.useRef)(Re),Be;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(Be=new Map,t[27]=Be):Be=t[27];let Ve=(0,Q.useRef)(Be),He=(0,Q.useRef)(0),Ue;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(Ue=new Set,t[28]=Ue):Ue=t[28];let We=(0,Q.useRef)(Ue),Ge=(0,Q.useRef)(eX),Ke=(0,Q.useRef)($Y),qe=(0,Q.useRef)(!1),Je=(0,Q.useRef)(null),Xe=(0,Q.useRef)(null),Ze=(0,Q.useRef)(QY),Qe=(0,Q.useRef)(ZY),$e=(0,Q.useRef)(XY),et=(0,Q.useRef)(YY),tt=(0,Q.useRef)(s),[nt,rt]=(0,Q.useState)(!1),it;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(it=function(){R.current!==null&&(clearTimeout(R.current),R.current=null)},t[29]=it):it=t[29];let at=it,ct;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(ct=function(){at(),I(!1)},t[30]=ct):ct=t[30];let lt=ct,ut;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(ut=function(e){lt(),P(e)},t[31]=ut):ut=t[31];let dt=ut,ft;t[32]===i?ft=t[33]:(ft=function(){if(at(),TN()){P(null),I(!0),R.current=setTimeout(()=>{R.current=null,Je.current?.()},aY);return}I(!1),P(i({id:`34qyH5`}))},t[32]=i,t[33]=ft);let pt=ft,mt=(0,Q.useRef)(!0),ht;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(ht=()=>{if(mt.current){mt.current=!1;return}Je.current?.()},t[34]=ht):ht=t[34];let gt;t[35]===L?gt=t[36]:(gt=[L],t[35]=L,t[36]=gt),(0,Q.useEffect)(ht,gt);let _t,vt;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(_t=()=>at,vt=[],t[37]=_t,t[38]=vt):(_t=t[37],vt=t[38]),(0,Q.useEffect)(_t,vt);let yt,bt;t[39]!==k.length||t[40]!==j?(yt=()=>{if(j||k.length===0)return;let e=Xe.current?.querySelector(nR)?.shadowRoot;if(!e)return;let t=e,n=function(){Ae.current!==null&&clearTimeout(Ae.current),Ae.current=setTimeout(()=>{ke.current=!1,Ae.current=null},0)},r=function(e){if(!(e instanceof DragEvent))return;let t=aX(e),n=t?.dataset.itemPath;if(!n)return;let r=Xq(t.dataset.itemType===`folder`?Ju(n):n,le.current,ue.current);r&&(Ae.current!==null&&(clearTimeout(Ae.current),Ae.current=null),ke.current=!0,e.dataTransfer?.setData(ku,Du(r)))},i=function(e){if(!(e instanceof DragEvent)||!Gu(e))return;let t=sX(e);if(!t){WJ(Me);return}e.preventDefault(),e.stopPropagation(),e.dataTransfer&&(e.dataTransfer.dropEffect=`copy`),GJ(Me,t)},a=function(e){if(!(e instanceof DragEvent)||!Gu(e))return;let n=e.relatedTarget;n instanceof Node&&t.contains(n)||WJ(Me)},o=function(e){if(!(e instanceof DragEvent)||!Gu(e))return;let t=sX(e),n=zu(e);if(!t||n.length===0){WJ(Me);return}e.preventDefault(),e.stopPropagation(),WJ(Me),Ne.current(n,t.parentDir,t.busyPath)};return e.addEventListener(`dragstart`,r,{capture:!0}),e.addEventListener(`dragover`,i,{capture:!0}),e.addEventListener(`dragleave`,a,{capture:!0}),e.addEventListener(`drop`,o,{capture:!0}),e.addEventListener(`dragend`,n,{capture:!0}),window.addEventListener(`drop`,n,!0),window.addEventListener(`dragend`,n,!0),()=>{e.removeEventListener(`dragstart`,r,{capture:!0}),e.removeEventListener(`dragover`,i,{capture:!0}),e.removeEventListener(`dragleave`,a,{capture:!0}),e.removeEventListener(`drop`,o,{capture:!0}),e.removeEventListener(`dragend`,n,{capture:!0}),window.removeEventListener(`drop`,n,!0),window.removeEventListener(`dragend`,n,!0),WJ(Me),Ae.current!==null&&(clearTimeout(Ae.current),Ae.current=null),ke.current=!1}},bt=[k.length,j],t[39]=k.length,t[40]=j,t[41]=yt,t[42]=bt):(yt=t[41],bt=t[42]),(0,Q.useEffect)(yt,bt);let{selectedFilePath:xt,selectedFolderPath:St,navigationPath:Ct}=Wq(s,m?null:o),wt=xt?Xu(xt,k.find(e=>ol(e)&&e.docName===xt)?.docExt):St?Ju(St):s?.kind===`asset`?s.assetPath:null,Tt=q?null:wt,Et=ya().states,{dispatch:Dt}=Da(),At;t[43]!==Dt||t[44]!==Et?(At={installStates:Et,isElectronHost:typeof window<`u`&&window.okDesktop!=null,dispatch:Dt},t[43]=Dt,t[44]=Et,t[45]=At):At=t[45];let jt=At,{okignoreBinding:Mt,projectLocalBinding:Nt,merged:Pt}=au(),Ft=Pt?.appearance?.sidebar?.showHiddenFiles??!1,It;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(It=()=>Pe.current===null,t[46]=It):It=t[46];let Lt=It,Rt;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(Rt=[],t[47]=Rt):Rt=t[47];let zt;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(zt={set:`complete`,spriteSheet:eY,byFileExtension:{md:{name:XJ,viewBox:ot},mdx:{name:XJ,viewBox:ot}}},t[48]=zt):zt=t[48];let Bt;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(Bt={contextMenu:{enabled:!0,triggerMode:`both`,buttonVisibility:`when-needed`}},t[49]=Bt):Bt=t[49];let Vt;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(Vt={canDrag:Lt,canDrop:Lt,onDropComplete:e=>et.current(e),onDropError:JY},t[50]=Vt):Vt=t[50];let Ht,Ut;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(Ht={canRename:Lt,onRename:e=>Qe.current(e),onError:e=>$e.current(e)},Ut=e=>Ze.current(e),t[51]=Ht,t[52]=Ut):(Ht=t[51],Ut=t[52]);let Wt;t[53]===i?Wt=t[54]:(Wt={paths:Rt,initialExpansion:`closed`,fileTreeSearchMode:`hide-non-matches`,initialVisibleRowCount:18,stickyFolders:!0,...uq,icons:zt,unsafeCSS:cY,composition:Bt,dragAndDrop:Vt,renaming:Ht,onSelectionChange:Ut,renderRowDecoration:e=>{let{item:t}=e;if(t.kind===`file`){let e=le.current.find(e=>ol(e)&&Xu(e.docName,e.docExt)===t.path);if(e?.isSymlink){let t=e.targetPath;return{icon:JJ,title:i(t?{id:`JE21eh`,values:{targetPath:t}}:{id:`BQu9Pg`})}}return lY(t.path)?{icon:YJ,title:i({id:`i9toLO`})}:null}let n=le.current.find(e=>Zc(e)&&Ju(e.path)===Ju(t.path));if(n?.isSymlink){let e=n.targetPath;return{icon:JJ,title:i(e?{id:`JE21eh`,values:{targetPath:e}}:{id:`BQu9Pg`})}}return null}},t[53]=i,t[54]=Wt);let{model:Y}=lq(Wt),Gt;t[55]===Y?Gt=t[56]:(Gt=function(e){let t=Y.getItem(e)??Y.getItem(Ju(e));return t?.isDirectory()?Ju(nd(t.getPath())):e},t[55]=Y,t[56]=Gt);let Kt=Gt,qt,Jt;t[57]===k?(qt=t[58],Jt=t[59]):(Jt=Lu(k),qt=Ou(Jt),t[57]=k,t[58]=qt,t[59]=Jt);let Yt=qt,Xt=(0,Q.useRef)(Jt),Zt;t[60]===k?Zt=t[61]:(Zt=Ku(k),t[60]=k,t[61]=Zt);let Qt=Zt,$t=(0,Q.useRef)(Qt),en=St?Yu(Ju(St)).slice(0,-1):Yu(Tt??Ct),tn=en.join(`\0`),nn;t[62]===Y?nn=t[63]:(nn=()=>{let e=new Set;for(let t of $t.current)aJ(Y.getItem(t))?.isExpanded()&&e.add(t);return e},t[62]=Y,t[63]=nn);let rn=nn,an;t[64]===rn?an=t[65]:(an=e=>{let t=new Set(Ku(e??le.current)),n=rn();for(let e of Se.current)n.add(e);return[...n].filter(e=>t.has(e))},t[64]=rn,t[65]=an);let on=an,cn;t[66]!==on||t[67]!==Y?(cn=e=>{let t=Lu(e??le.current);Y.resetPaths(t,{initialExpandedPaths:on(e)})},t[66]=on,t[67]=Y,t[68]=cn):cn=t[68];let ln=cn,un;t[69]!==i||t[70]!==pt?(un=async function(e){let t=He.current,n=new AbortController;Ve.current.set(e,n);let r=await kY(nd(e),n.signal,i({id:`8RtNI0`}),i({id:`HlmZBk`}));if(Ve.current.get(e)===n&&Ve.current.delete(e),n.signal.aborted||t!==He.current)return;if(r.kind===`network-error`){pt(),console.warn(`[FileTree] lazy folder children fetch failed:`,e,r.cause);return}if(r.kind===`http-error`){console.warn(`[FileTree] lazy folder children http error:`,e,r.title),dt(r.title);return}let a=qe.current,o=Xc(r.entries,a);ze.current.add(e),A(t=>TJ(t,e,o,Le.current)),P(null),lt(),r.truncated&&B(r.entries.length)},t[69]=i,t[70]=pt,t[71]=un):un=t[71];let dn=un,fn;t[72]!==rn||t[73]!==dn?(fn=()=>{let e=rn(),t=We.current;We.current=e;for(let n of e){if(t.has(n)||ze.current.has(n)||Ve.current.has(n))continue;let e=nd(n);le.current.find(t=>Zc(t)&&t.path===e)?.hasChildren!==!1&&dn(n)}},t[72]=rn,t[73]=dn,t[74]=fn):fn=t[74];let mn=fn,hn;t[75]!==rn||t[76]!==dn?(hn=()=>{for(let e of rn())ze.current.has(e)||Ve.current.has(e)||dn(e)},t[75]=rn,t[76]=dn,t[77]=hn):hn=t[77];let gn=hn,_n;t[78]!==Y||t[79]!==ln?(_n=(e,t,n,r)=>{let i=r===void 0?[]:r,a=0,o=null;for(let{fromDocName:r,toDocName:i}of n){let n=e.find(e=>ol(e)&&e.docName===r);if(n==null||Y.getItem(i)==null)continue;let s=Xu(i,t.find(e=>ol(e)&&e.docName===i)?.docExt??n.docExt);Y.move(i,s),o=s,a+=1}for(let{toPath:e}of i){let t=Jc(e);if(t===``)continue;let n=e.slice(0,-t.length);Y.getItem(n)!=null&&(Y.getItem(e)??Y.move(n,e),o=e,a+=1)}a!==0&&(ln(t),o!=null&&Y.focusPath(o))},t[78]=Y,t[79]=ln,t[80]=_n):_n=t[80];let vn=_n,yn;t[81]===Symbol.for(`react.memo_cache_sentinel`)?(yn=e=>{Te.current=Wu(e)},t[81]=yn):yn=t[81];let bn=yn,xn;t[82]===Symbol.for(`react.memo_cache_sentinel`)?(xn=e=>be.current.has(e),t[82]=xn):xn=t[82];let Sn=xn,Cn;t[83]!==i||t[84]!==b||t[85]!==D||t[86]!==T||t[87]!==ln?(Cn=async function(e){if(e.kind===`asset`||Pe.current!==null)return;let t=()=>{H(null),Pe.current=null};Pe.current=e.path,H(e.path),P(null);try{let n=await Ot(await fetch(`/api/duplicate-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e.kind,path:e.path})}),i({id:`dw_dUJ`}));if(!n.ok){hs.error(n.title),ln(),t();return}let r=f(Mn,n.body,`duplicate-path`,null);if(r===null){let e=i({id:`67f-3g`});hs.error(e),P(e),ul([`files`,`backlinks`,`graph`]),ln(),t();return}for(let e of r.duplicatedDocNames)b(e);A(t=>{let n=tP(t,e,r);return ln(n),bn(n),n}),ul([`files`,`backlinks`,`graph`]),r.path!==e.path&&(r.kind===`folder`?D(r.path):T(r.path)),hs.success(r.kind===`folder`?i({id:`iilQXA`}):i({id:`A6h5b-`}),{description:r.path}),t()}catch(e){let n=e,r=n instanceof Error?n.message:String(n);console.warn(`[FileTree] duplicate failed:`,n),hs.error(i({id:`EBVbtP`}),{description:r}),ln(),t()}},t[83]=i,t[84]=b,t[85]=D,t[86]=T,t[87]=ln,t[88]=Cn):Cn=t[88];let wn=Cn,Tn=(0,Q.useRef)(wn),En;t[89]===wn?En=t[90]:(En=()=>{Tn.current=wn},t[89]=wn,t[90]=En),(0,Q.useEffect)(En);let Dn=function(e){let t=VJ(e);if(!t||HJ(t))return!1;let n=Y.getFocusedPath()??Y.getSelectedPaths()[0]??null;if(!n||n.endsWith(`/`)||Sn(n))return!1;let r=HJ(n);if(!r)return!1;let i=Ju(t);if(!$t.current.includes(i))return!1;let a=`${t}${r}`;return Xt.current.includes(a)?!1:(ur({sourcePath:n,destinationPath:a,isFolder:!1}),Y.move(n,a),!0)},On;t[91]===Symbol.for(`react.memo_cache_sentinel`)?(On=e=>{let t=e??Ce.current;!t||Ce.current!==t||(t.disposeCommitListener(),Ce.current=null)},t[91]=On):On=t[91];let kn=On,jn;t[92]!==i||t[93]!==kn||t[94]!==l||t[95]!==c||t[96]!==ln?(jn=async function(e,t){let n=t===void 0?{}:t,r=n.updateUi??!0,a=n.restoreLocation??r;kn(e),r&&H(e.renamePath);try{let t=await fetch(`/api/delete-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e.kind,path:e.createdPath})});if(!t.ok&&t.status!==404){let n=e.kind,a=e.createdPath,o=await Ot(t,i({id:`EcM3k7`,values:{kind:n}}));if(o.ok)return;let s=o.title,c=i({id:`YPFBfr`,values:{detail:s,kind:n,createdPath:a}});r?hs.error(c):console.warn(`[FileTree] cleanup pending create failed: ${c}`),r&&(H(null),ln());return}}catch(t){if(console.warn(`[FileTree] cleanup pending create failed:`,t),r){let t=e.kind,n=e.createdPath;hs.error(i({id:`_TDESN`,values:{kind:t,createdPath:n}}))}r&&(H(null),ln());return}r&&(e.kind===`file`?l(e.createdPath):c([st(e.createdPath)],{force:!0})),r&&A(t=>{let n=$N(t,e.kind===`file`?[e.createdPath]:[],e.kind===`folder`?e.createdPath:void 0);return bn(n),n}),ul([`files`,`backlinks`,`graph`]),a&&(window.location.hash=e.previousHash),r&&H(null)},t[92]=i,t[93]=kn,t[94]=l,t[95]=c,t[96]=ln,t[97]=jn):jn=t[97];let Pn=jn,Fn,In;t[98]===Symbol.for(`react.memo_cache_sentinel`)?(Fn=()=>()=>{let e=Ce.current;e&&we.current(e,{restoreLocation:!1,updateUi:!1}).catch(qY)},In=[],t[98]=Fn,t[99]=In):(Fn=t[98],In=t[99]),(0,Q.useEffect)(Fn,In);let Rn;t[100]!==i||t[101]!==pt?(Rn=()=>{let e=!0,t=null,n=_J(async function(){t?.abort();let n=new AbortController;t=n,He.current+=1;for(let e of Ve.current.values())e.abort();Ve.current.clear(),ze.current.clear();try{let t=await fetch(`/api/documents?showAll=true&dir=&depth=1`,{signal:n.signal,headers:vJ});if(yJ(t)){let r=qe.current,i=!1,{entries:a,truncated:o}=await SJ(t,{onBatch:t=>{if(!e||n.signal.aborted)return;let a=Xc(rl(t),r);a.length!==0&&(A(e=>wJ(e,a)),i||(i=!0,P(null),lt(),M(!1)))}});if(!e)return;let s=Xc(rl(a),r);A(e=>TJ(e,``,s,Le.current)),P(null),lt(),B(o?a.length:null),Ke.current()}else{let n=await Ot(t,i({id:`8RtNI0`}));if(!e)return;if(!n.ok)dt(n.title),B(null);else{let e=pn.safeParse(n.body);if(!e.success)dt(i({id:`HlmZBk`})),B(null);else{let t=qe.current,n=Xc(rl(e.data.documents),t);A(e=>TJ(e,``,n,Le.current)),P(null),lt(),B(e.data.truncated===!0?e.data.documents.length:null),Ke.current()}}}}catch(t){let r=t;if(n.signal.aborted)return;e&&(r instanceof bJ?dt(r.message):pt()),console.warn(`[FileTree] fetch failed:`,r)}e&&M(!1)},()=>t?.abort());Je.current=()=>n.request(),n.request();let r=()=>{document.visibilityState===`visible`&&n.request()};window.addEventListener(`focus`,r),window.addEventListener(`visibilitychange`,r);let a=dl(e=>{e.includes(`files`)&&n.request()});return()=>{e=!1,Je.current=null,n.dispose();for(let e of Ve.current.values())e.abort();Ve.current.clear(),window.removeEventListener(`focus`,r),window.removeEventListener(`visibilitychange`,r),a()}},t[100]=i,t[101]=pt,t[102]=Rn):Rn=t[102];let zn;t[103]===i?zn=t[104]:(zn=[i],t[103]=i,t[104]=zn),(0,Q.useEffect)(Rn,zn);let Bn=(0,Q.useRef)(!0),Vn;t[105]===Symbol.for(`react.memo_cache_sentinel`)?(Vn=()=>{if(Bn.current){Bn.current=!1;return}Je.current?.()},t[105]=Vn):Vn=t[105];let Hn;t[106]===Ft?Hn=t[107]:(Hn=[Ft],t[106]=Ft,t[107]=Hn),(0,Q.useEffect)(Vn,Hn);let Un,Wn;t[108]===Symbol.for(`react.memo_cache_sentinel`)?(Un=()=>{let e=!0;return fetch(`/api/workspace`).then(async t=>{let n=await t.json();if(!e||!t.ok)return;let r=f(An,n,`workspace`,null);r&&ie({contentDir:r.contentDir,pathSeparator:r.pathSeparator})}).catch(KY),()=>{e=!1}},Wn=[],t[108]=Un,t[109]=Wn):(Un=t[108],Wn=t[109]),(0,Q.useEffect)(Un,Wn);let Kn;t[110]!==on||t[111]!==Y||t[112]!==Yt?(Kn=()=>{if(Te.current===Yt){Te.current=null;return}Y.resetPaths(Xt.current,{initialExpandedPaths:on()})},t[110]=on,t[111]=Y,t[112]=Yt,t[113]=Kn):Kn=t[113];let qn;t[114]!==Y||t[115]!==Yt?(qn=[Y,Yt],t[114]=Y,t[115]=Yt,t[116]=qn):qn=t[116],(0,Q.useEffect)(Kn,qn),sJ(Y,Tt,tn,Oe,Yt);let Jn,Yn;t[117]!==Y||t[118]!==r?(Jn=()=>{if(!r)return;let e=0,t=0,n=()=>Xe.current?.querySelector(`file-tree-container`)?.shadowRoot?.querySelector(`[data-file-tree-virtualized-list]`)??null,i=()=>{let e=n();if(!e)return;let t=Number.parseFloat(e.style.height);Number.isFinite(t)&&r(t)},a=()=>{cancelAnimationFrame(e),e=requestAnimationFrame(i)},o=new MutationObserver(i),s=()=>{let e=n();e?(o.observe(e,{attributes:!0,attributeFilter:[`style`]}),i()):t=requestAnimationFrame(s)};s();let c=Y.subscribe(a);return window.addEventListener(`resize`,a),()=>{cancelAnimationFrame(e),cancelAnimationFrame(t),o.disconnect(),c(),window.removeEventListener(`resize`,a)}},Yn=[r,Y],t[117]=Y,t[118]=r,t[119]=Jn,t[120]=Yn):(Jn=t[119],Yn=t[120]),(0,Q.useEffect)(Jn,Yn);let Xn;t[121]===Symbol.for(`react.memo_cache_sentinel`)?(Xn=()=>{ae(!1)},t[121]=Xn):Xn=t[121];let Zn;t[122]===wt?Zn=t[123]:(Zn=[wt],t[122]=wt,t[123]=Zn),(0,Q.useEffect)(Xn,Zn);let Qn,$n;t[124]===q?(Qn=t[125],$n=t[126]):(Qn=()=>{oe.current=q;for(let e of ce.current)e()},$n=[q],t[124]=q,t[125]=Qn,t[126]=$n),(0,Q.useEffect)(Qn,$n);let er;t[127]!==Tt||t[128]!==j||t[129]!==Y?(er=()=>{j||!Tt||Hq(Y)},t[127]=Tt,t[128]=j,t[129]=Y,t[130]=er):er=t[130];let tr;t[131]!==tn||t[132]!==Tt||t[133]!==j||t[134]!==Y||t[135]!==Yt?(tr=[Tt,tn,Yt,j,Y],t[131]=tn,t[132]=Tt,t[133]=j,t[134]=Y,t[135]=Yt,t[136]=tr):tr=t[136],(0,Q.useEffect)(er,tr);let nr,rr;t[137]===Y?(nr=t[138],rr=t[139]):(nr=()=>Y.subscribe(()=>{if(!Y.isSearchOpen())for(let e of Se.current){let t=aJ(Y.getItem(e));t&&!t.isExpanded()&&t.expand()}}),rr=[Y],t[137]=Y,t[138]=nr,t[139]=rr),(0,Q.useEffect)(nr,rr);let ir,ar;t[140]===Y?(ir=t[141],ar=t[142]):(ir=()=>Y.subscribe(()=>Ge.current()),ar=[Y],t[140]=Y,t[141]=ir,t[142]=ar),(0,Q.useEffect)(ir,ar);let or,sr;t[143]===Y?(or=t[144],sr=t[145]):(or=()=>Y.onMutation(`remove`,e=>{let t=Ce.current;!t||e.path!==t.renamePath||we.current(t)}),sr=[Y],t[143]=Y,t[144]=or,t[145]=sr),(0,Q.useEffect)(or,sr);let cr;t[146]!==b||t[147]!==u||t[148]!==d||t[149]!==he||t[150]!==D||t[151]!==T||t[152]!==p||t[153]!==vn||t[154]!==_?(cr=async(e,t,n,r,i)=>{let a=t===void 0?[]:t,o=n===void 0?[]:n,s=i===void 0?[]:i,c=r?.docName??ge.current,l=new Map,f=new Map;for(let e of le.current){if(ol(e)){let t=o.find(t=>t.fromPath===Xu(e.docName,e.docExt))?.toPath;t&&l.set(e.docName,t);continue}if(el(e)){let t=o.find(t=>t.fromPath===e.path)?.toPath;t&&Kc(t)&&f.set(e.path,Iu(t))}}let m=c?l.get(c)??null:null,h=r?.folderPath??(tt.current?.kind===`folder`?tt.current.folderPath:null),g=h?ve(h,a):null,v=r?.assetPath??(tt.current?.kind===`asset`?tt.current.assetPath:null),y=v?f.get(v)??null:null,x=m?null:y??nP(c,e),S=m??(v?y?null:o.find(e=>e.fromPath===v)?.toPath??ve(v,a):null);Ee(e);let C=[...rP(e,d(),p),...l.keys()];await Promise.all(C.map(e=>u(e)));for(let t of e)b(t.toDocName);for(let e of f.values())b(e);_(e,a,o);let w=null;A(t=>{let n=QN(t,e,a,o,s);return w=n,vn(t,n,e,o),bn(n),n}),h&&g&&g!==h?D(g):x&&x!==c?(T(x),UJ(x)):S&&(m||S!==v)&&he(S,w??le.current),ul([`files`,`backlinks`,`graph`])},t[146]=b,t[147]=u,t[148]=d,t[149]=he,t[150]=D,t[151]=T,t[152]=p,t[153]=vn,t[154]=_,t[155]=cr):cr=t[155];let lr=cr;async function ur(e){let t=!e.isFolder&&Sn(e.sourcePath),n=t?e.sourcePath:Vu(e.sourcePath,e.isFolder);H(n),P(null);try{let r=qc(e.sourcePath,e.destinationPath,e.isFolder),a=!e.isFolder&&!t&&!Kc(r.destinationPath),o=t||a?r.destinationPath:Vu(r.destinationPath,e.isFolder),s=e.isFolder?{kind:`folder`,fromPath:nd(n),toPath:nd(o)}:t||a?{kind:`asset`,fromPath:n,toPath:o}:{kind:`file`,fromPath:td(n,le.current),toPath:o},c={docName:ge.current,folderPath:tt.current?.kind===`folder`?tt.current.folderPath:null,assetPath:tt.current?.kind===`asset`?tt.current.assetPath:null},l=await Ot(await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(s)}),i({id:`gijbne`}));if(!l.ok){hs.error(l.title),ln();let e=Ce.current;e&&e.renamePath===n?await Pn(e):kn(),H(null);return}let u=f(mr,l.body,`rename-path`,{renamed:[],renamedAssets:[]});try{await lr(u.renamed,e.isFolder?[{fromPath:nd(n),toPath:nd(o)}]:[],u.renamedAssets,c,!e.isFolder&&!t&&!a?u.renamed.flatMap(e=>{let t=Jc(o);return t?[{toDocName:e.toDocName,docExt:t}]:[]}):[])}catch(e){console.warn(`[FileTree] post-rename reconciliation failed`,{err:e,sourceTreePath:n,destinationTreePath:o,renamedCount:u.renamed.length,renamedAssetCount:u.renamedAssets.length}),hs.error(i({id:`dDpCOp`}))}kn(),H(null)}catch(e){console.warn(`[FileTree] rename failed:`,e);let t=i({id:`HIb0vl`});hs.error(t),P(t),ln();let r=Ce.current;r&&r.renamePath===n?await Pn(r):kn(),H(null)}}let fr;t[156]!==i||t[157]!==lr||t[158]!==ln?(fr=async function(e){let t=e.draggedPaths.map(t=>{let n=Hu(t,e.target);return t===n?null:{sourcePath:t,destinationTreePath:n}}).filter(GY);if(t.length!==0){H(t[0]?.sourcePath??null),P(null);try{let e=[],n=[],r=[],a={docName:ge.current,folderPath:tt.current?.kind===`folder`?tt.current.folderPath:null,assetPath:tt.current?.kind===`asset`?tt.current.assetPath:null};for(let a of t){let t=a.sourcePath.endsWith(`/`),o=!t&&Sn(a.sourcePath),s=o?null:td(a.sourcePath,le.current),c=t?{kind:`folder`,fromPath:nd(a.sourcePath),toPath:nd(a.destinationTreePath)}:o?{kind:`asset`,fromPath:a.sourcePath,toPath:a.destinationTreePath}:{kind:`file`,fromPath:s??Iu(a.sourcePath),toPath:s&&Kc(s)?a.destinationTreePath:Iu(a.destinationTreePath)},l=await Ot(await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(c)}),i({id:`dOHMA0`}));if(!l.ok){hs.error(l.title),ln(),H(null);return}let u=f(mr,l.body,`rename-path:drop`,{renamed:[],renamedAssets:[]});e=e.concat(u.renamed),n=n.concat(u.renamedAssets),t&&r.push({fromPath:nd(a.sourcePath),toPath:nd(a.destinationTreePath)})}try{await lr(e,r,n,a)}catch(r){console.warn(`[FileTree] post-move reconciliation failed`,{err:r,operationCount:t.length,renamedCount:e.length,renamedAssetCount:n.length}),hs.error(i({id:`8OxKZy`}))}H(null)}catch(e){console.warn(`[FileTree] move failed:`,e),hs.error(i({id:`HIb0vl`})),ln(),H(null)}}},t[156]=i,t[157]=lr,t[158]=ln,t[159]=fr):fr=t[159];let pr=fr,hr;t[160]!==i||t[161]!==b||t[162]!==ln?(hr=async function(e,t,n){if(e.length===0||Pe.current!==null)return;let r=()=>{Pe.current=null,H(null)};Pe.current=n,H(n),P(null);let a=[],o=0,s=0;for(let n of e){let e=new FormData;e.append(`file`,n),Zu(e,t,n.name||`upload`);try{let r=await Ot(await fetch(`/api/upload`,{method:`POST`,body:e}),i({id:`4Gz2wC`}));if(!r.ok){s+=1,hs.error(r.title,{description:n.name});continue}let c=f(dr,r.body,`upload:drop`,null);if(c===null){s+=1,hs.error(i({id:`4Gz2wC`}),{description:n.name});continue}let l=Nu(t,c);if(c.deduped===!0){s+=1,hs.error(i({id:`4sKwf6`}),{description:l});continue}o+=1;let u=Qu(l,n);u&&a.push(u)}catch(e){let t=e;s+=1,console.warn(`[FileTree] external file upload failed:`,t),hs.error(t instanceof TypeError?i({id:`HIb0vl`}):i({id:`4Gz2wC`}),{description:n.name})}}try{if(a.length>0){for(let e of a)ol(e)&&b(e.docName);A(e=>{let t=new Set(e.map(Ru)),n=!1,r=[...e];for(let e of a){let i=Ru(e);Le.current.set(i,Date.now()),!t.has(i)&&(t.add(i),r.push(e),n=!0)}return n?(ln(r),bn(r),r):e})}o>0&&(ul([`files`,`backlinks`,`graph`]),Je.current?.(),hs.success(Gc._({id:`v75Em9`,values:{uploadedCount:o}}),{description:t||i({id:`RSqaSd`})})),s>0&&P(o>0?Gc._({id:`yH7T4q`,values:{failedCount:s}}):i({id:`4Gz2wC`})),r()}catch(e){let t=e,n=i({id:`VcqWBy`});console.warn(`[FileTree] upload post-upload reconciliation failed:`,t),hs.error(n),P(n),r()}},t[160]=i,t[161]=b,t[162]=ln,t[163]=hr):hr=t[163];let gr=hr,_r;t[164]===Symbol.for(`react.memo_cache_sentinel`)?(_r=function(e){ne({parentDir:e})},t[164]=_r):_r=t[164];let vr=_r,yr;t[165]!==i||t[166]!==b||t[167]!==Pn||t[168]!==kn||t[169]!==Y||t[170]!==D||t[171]!==T||t[172]!==ln||t[173]!==Jt?(yr=async function(e,t,n){if(Pe.current)return;let r=Ce.current;r&&kn(r);try{let r=qu(e,t,[...Jt,...$t.current]);H(r.renamePath),Pe.current=r.renamePath;let a=window.location.hash,o;if(e===`file`){let e=Fu(`file`,r.addPath),t={path:e};n?.template&&(t.template=n.template);let a=await Ot(await fetch(`/api/create-page`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)}),i({id:`fJgQHX`}));if(!a.ok){hs.error(a.title),H(null),Pe.current=null;return}let s=Iu(e),c=f(Ln,a.body,`create-page`,{docName:s}).docName;o=c;let l={kind:`document`,docName:c,docExt:e.toLowerCase().endsWith(`.mdx`)?`.mdx`:`.md`,modified:new Date().toISOString(),size:0};b(c),A(e=>{if(e.some(e=>ol(e)&&e.docName===c))return e;let t=[...e,l];return bn(t),Le.current.set(Ru(l),Date.now()),t}),ul([`files`,`backlinks`,`graph`]),T(c)}else{let e=nd(r.addPath),t=await Ot(await fetch(`/api/create-folder`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e})}),i({id:`K1ckLX`}));if(!t.ok){hs.error(t.title),H(null),Pe.current=null;return}o=f(Br,t.body,`create-folder`,{path:e}).path;let n={kind:`folder`,path:o,modified:new Date().toISOString(),size:0};A(e=>{if(e.some(e=>Zc(e)&&e.path===o))return e;let t=[...e,n];return bn(t),Le.current.set(Ru(n),Date.now()),t}),ul([`files`]),D(o)}let s=!1,c=e=>{if(e.key!==`Enter`)return;let t=Ce.current;!t||t.renamePath!==r.renamePath||queueMicrotask(()=>kn(t))};document.addEventListener(`keydown`,c,!0),Ce.current={kind:e,renamePath:r.renamePath,createdPath:o,previousHash:a,disposeCommitListener:()=>{s||(s=!0,document.removeEventListener(`keydown`,c,!0))}},H(null),Pe.current=null,Y.add(r.addPath),Y.startRenaming(r.renamePath,{removeIfCanceled:!0})}catch(e){console.warn(`[FileTree] create placeholder failed:`,e),hs.error(i({id:`S6l5dv`}));let t=Ce.current;t?await Pn(t):kn(),H(null),Pe.current=null,ln()}},t[165]=i,t[166]=b,t[167]=Pn,t[168]=kn,t[169]=Y,t[170]=D,t[171]=T,t[172]=ln,t[173]=Jt,t[174]=yr):yr=t[174];let br=yr,xr;t[175]===Y?xr=t[176]:(xr=function(e){let t=Ju(e);(0,Q.startTransition)(()=>{for(let e of $t.current)if(e===t||e.startsWith(t)){let t=aJ(Y.getItem(e));t&&t.expand()}})},t[175]=Y,t[176]=xr);let Sr=xr,Cr;t[177]===Y?Cr=t[178]:(Cr=function(e){let t=Ju(e),n=new Set(Se.current);(0,Q.startTransition)(()=>{for(let e of[...$t.current].reverse())if((e===t||e.startsWith(t))&&!n.has(e)){let t=aJ(Y.getItem(e));t&&t.collapse()}})},t[177]=Y,t[178]=Cr);let wr=Cr,Tr;t[179]===Symbol.for(`react.memo_cache_sentinel`)?(Tr=function(){return((Xe.current?.querySelector(`file-tree-container`)?.shadowRoot)?.querySelector(`[aria-selected="true"][data-item-path]`))?.dataset.itemPath??null},t[179]=Tr):Tr=t[179];let Er=Tr,Dr;t[180]!==pe||t[181]!==en||t[182]!==o||t[183]!==s||t[184]!==ye||t[185]!==V||t[186]!==Pn||t[187]!==mn||t[188]!==k||t[189]!==Qt||t[190]!==pr||t[191]!==ur||t[192]!==Kt||t[193]!==x||t[194]!==Dn||t[195]!==gn||t[196]!==Ft||t[197]!==Jt||t[198]!==gr?(Dr=()=>{le.current=k,ue.current=x,ge.current=o,tt.current=s,be.current=ye,Pe.current=V,qe.current=Ft,Xt.current=Jt,$t.current=Qt,Se.current=en,Ge.current=mn,Ke.current=gn,we.current=Pn,Ne.current=(e,t,n)=>{gr(e,t,n)},Ze.current=e=>{if(Oe.current||ke.current||e.length!==1)return;let t=e[0];if(t){ae(!1);let e=Kt(t),n=de.current,r=n!==null&&Iu(n)===Iu(e),i=r?n:e;de.current=null,queueMicrotask(()=>{pe(Kt((r?null:Er())??i),le.current)})}},$e.current=e=>{Dn(e)||hs.error(e)},Qe.current=ur,et.current=pr},t[180]=pe,t[181]=en,t[182]=o,t[183]=s,t[184]=ye,t[185]=V,t[186]=Pn,t[187]=mn,t[188]=k,t[189]=Qt,t[190]=pr,t[191]=ur,t[192]=Kt,t[193]=x,t[194]=Dn,t[195]=gn,t[196]=Ft,t[197]=Jt,t[198]=gr,t[199]=Dr):Dr=t[199],(0,Q.useLayoutEffect)(Dr);let Or,kr;t[200]===Y?(Or=t[201],kr=t[202]):(Or=()=>{let e=e=>{let t=(e.metaKey||e.ctrlKey)&&!e.altKey,n=e.key.toLowerCase(),r=t&&n===`a`,i=t&&!e.shiftKey&&n===`d`,a=t&&!e.shiftKey&&n===`c`,o=t&&!e.shiftKey&&n===`v`,s=!e.altKey&&!e.shiftKey&&(e.metaKey&&!e.ctrlKey&&n===`backspace`||!e.metaKey&&!e.ctrlKey&&n===`delete`);if(!r&&!i&&!a&&!o&&!s||SY(e.target))return;let c=Xe.current,l=e.target,u=document.activeElement,d=l instanceof Node&&c?.contains(l),f=u instanceof Node&&c?.contains(u);if(!d&&!f)return;if(a){let t=yY(Y,le.current,be.current);if(!t)return;Fe.current=t,e.preventDefault(),e.stopPropagation();return}if(o){let t=Fe.current;if(!t)return;Tn.current(t),e.preventDefault(),e.stopPropagation();return}if(i){let t=yY(Y,le.current,be.current);if(!t)return;Tn.current(t),e.preventDefault(),e.stopPropagation();return}if(s){if(Pe.current!==null)return;let t=bY(Y,le.current);if(t.length===0)return;W({targets:t}),e.preventDefault(),e.stopPropagation();return}let p=new Set([...$t.current,...Xt.current]);Oe.current=!0;for(let e of p)e&&Y.getItem(e)?.select();queueMicrotask(()=>{Oe.current=!1}),e.preventDefault(),e.stopPropagation()};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},kr=[Y],t[200]=Y,t[201]=Or,t[202]=kr),(0,Q.useEffect)(Or,kr);let Ar,jr;t[203]!==k.length||t[204]!==j?(Ar=()=>{if(j||k.length===0)return;let e=Xe.current?.querySelector(nR)?.shadowRoot;if(!e)return;let t=WY,n=()=>{for(let n of e.querySelectorAll(`[data-item-path]`)){let e=n.dataset.itemPath;if(!e)continue;let r=t(e);n.title!==r&&(n.title=r)}let n=e.querySelector(`[data-type="context-menu-anchor"]`);if(n){let r=e.querySelector(`[data-item-context-hover="true"][data-item-path]`)?.dataset.itemPath,i=r?t(r):``;n.title!==i&&(n.title=i)}};n();let r=new MutationObserver(n);return r.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`data-item-path`,`data-item-context-hover`]}),()=>r.disconnect()},jr=[j,k.length],t[203]=k.length,t[204]=j,t[205]=Ar,t[206]=jr):(Ar=t[205],jr=t[206]),(0,Q.useEffect)(Ar,jr);let Mr,Nr;t[207]!==k.length||t[208]!==j?(Mr=()=>{if(j||k.length===0)return;let e=Xe.current?.querySelector(nR)?.shadowRoot;if(!e)return;let t=()=>yq(e);t();let n=new MutationObserver(t);return n.observe(e,{subtree:!0,childList:!0,characterData:!0,attributes:!0,attributeFilter:[`data-item-path`]}),()=>n.disconnect()},Nr=[j,k.length],t[207]=k.length,t[208]=j,t[209]=Mr,t[210]=Nr):(Mr=t[209],Nr=t[210]),(0,Q.useEffect)(Mr,Nr);let Pr,Fr;t[211]!==k.length||t[212]!==j?(Pr=()=>{if(j||k.length===0)return;let e=Xe.current?.querySelector(nR)?.shadowRoot;if(!e)return;let t=()=>Lq(e);t();let n=new MutationObserver(t);return n.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`data-item-path`]}),()=>n.disconnect()},Fr=[j,k.length],t[211]=k.length,t[212]=j,t[213]=Pr,t[214]=Fr):(Pr=t[213],Fr=t[214]),(0,Q.useEffect)(Pr,Fr);let Ir;t[215]===Symbol.for(`react.memo_cache_sentinel`)?(Ir={folderCount:0,expandedCount:0},t[215]=Ir):Ir=t[215];let Rr=(0,Q.useRef)(Ir),zr=(0,Q.useRef)(br),Vr=(0,Q.useRef)(vr),Hr;t[216]===br?Hr=t[217]:(Hr=()=>{zr.current=br,Vr.current=vr},t[216]=br,t[217]=Hr),(0,Q.useEffect)(Hr);let Ur,Wr;t[218]===Y?(Ur=t[219],Wr=t[220]):(Ur=()=>({startCreating(e,t){zr.current(e,t)},startCreatingFromTemplate(e){Vr.current(e)},createFromTemplate(e,t){zr.current(`file`,e,{template:t})},expandAll(){(0,Q.startTransition)(()=>{for(let e of $t.current){let t=aJ(Y.getItem(e));t&&t.expand()}})},collapseAll(){let e=new Set(Se.current);(0,Q.startTransition)(()=>{for(let t of[...$t.current].reverse()){if(e.has(t))continue;let n=aJ(Y.getItem(t));n&&n.collapse()}})},getFolderState(){let e=$t.current,t=0;for(let n of e)aJ(Y.getItem(n))?.isExpanded()&&t++;let n=e.length,r=Rr.current;if(r.folderCount===n&&r.expandedCount===t)return r;let i={folderCount:n,expandedCount:t};return Rr.current=i,i},isCreationTargetCleared(){return oe.current},clearCreationTarget(){ae(!0)},subscribe(e){ce.current.add(e);let t=Y.subscribe(e);return()=>{ce.current.delete(e),t()}}}),Wr=[Y],t[218]=Y,t[219]=Ur,t[220]=Wr),(0,Q.useImperativeHandle)(n,Ur,Wr);let Gr;t[221]!==kn||t[222]!==u||t[223]!==c||t[224]!==Y?(Gr=async function(e,t,n){let r=CY(e,le.current,$t.current),i=Ce.current;i&&e.some(e=>wY(e,i))&&(i.kind===`file`?r.docNames.add(i.createdPath):r.folderPaths.add(i.createdPath),kn(i));let a=new Set([...r.docNames,...t]),o=new Set([...r.folderPaths,...n]),s=new Set([...r.assetPaths,...e.filter(UY).map(HY)]);c([...[...a].map(VY),...[...o].map(BY),...[...s].map(zY)],{force:!0}),await Promise.all([...a].map(e=>u(e)));for(let t of e){let e=t.kind===`folder`?Ju(t.path):t.kind===`asset`?t.path:Xu(t.path,t.docExt);Y.getItem(e)&&Y.remove(e,t.kind===`folder`?{recursive:!0}:void 0)}A(e=>{let t=$N(e,[...a],void 0,[...s]);for(let e of o)t=$N(t,[],e);return bn(t),t}),ul([`files`,`backlinks`,`graph`])},t[221]=kn,t[222]=u,t[223]=c,t[224]=Y,t[225]=Gr):Gr=t[225];let Kr=Gr,qr;t[226]!==i||t[227]!==Kr?(qr=async function(e){let t=[],n=[],r=[];for(let a of e){let e=a.kind;H(a.path);let o=await Ot(await fetch(`/api/delete-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e,path:a.path})}),i({id:`7JtSLi`}));if(!o.ok)return r.length>0&&await Kr(r,t,n),hs.error(o.title),!1;let s=f(Lr,o.body,`delete-path`,{deletedDocNames:[]});t.push(...s.deletedDocNames),e===`folder`&&n.push(a.path),r.push(a)}return await Kr(r,t,n),!0},t[226]=i,t[227]=Kr,t[228]=qr):qr=t[228];let Yr=qr,Xr;t[229]===Symbol.for(`react.memo_cache_sentinel`)?(Xr=async function(e,t,n){let r=[],i=[];for(let a of e){H(a.path);let e=iP(a,n),o=await t.shell.trashItem(e);o.ok?r.push(a):i.push({kind:a.kind,path:a.path,name:a.name,reason:Qq(o.reason),detail:o.detail})}return{trashed:r,failed:i}},t[229]=Xr):Xr=t[229];let Zr=Xr,Qr;t[230]===i?Qr=t[231]:(Qr=async function(e){let t=[],n=[],r=[];for(let a of e){let e=a.kind;try{let o=await Ot(await fetch(`/api/trash/cleanup`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e,path:a.path})}),i({id:`DVh_Tb`}));if(!o.ok){console.warn(`[FileTree] trash-cleanup failed`,{target:`${a.kind}:${a.path}`,reason:o.title}),r.push({target:a,reason:o.title});continue}let s=f(Nn,o.body,`trash-cleanup`,{deletedDocNames:[]});t.push(...s.deletedDocNames),e===`folder`&&n.push(a.path)}catch(e){let t=e;console.warn(`[FileTree] trash-cleanup threw`,{target:`${a.kind}:${a.path}`,err:t}),r.push({target:a,reason:i({id:`r4R7AZ`})})}}if(r.length>0){let e=r.length;hs.error(i({id:`IrB5AK`,values:{failedCount:e}}),{description:i({id:`vEJDlt`})})}return r.length===e.length&&e.length>0?null:{deletedDocNames:t,deletedFolderPaths:n}},t[230]=i,t[231]=Qr);let $r=Qr,ei;t[232]!==i||t[233]!==ee||t[234]!==Kr||t[235]!==Yr||t[236]!==$r||t[237]!==ln||t[238]!==re?(ei=async function(e){let t=e.map(e=>eP(e,le.current)),n=t[0];if(!n)return;let r=ee.filter(e=>t.some(t=>{if(t.kind===`file`){let n=`${t.path}${t.docExt??`.md`}`;return e.file===n}return t.kind===`folder`?e.file.startsWith(`${t.path}/`):!1}));if(r.length>0){let e=r.slice(0,3).map(RY),t=r.length>e.length?`, +${r.length-e.length} more`:``;hs.error(`Cannot delete files with unresolved conflicts`,{description:`Resolve the conflict on ${e.join(`, `)}${t} before deleting.`});return}H(n.path),W(null);let a=typeof window<`u`?window.okDesktop:void 0;try{if(a&&re){let{trashed:e,failed:n}=await Zr(t,a,re);if(e.length>0){let t=await $r(e);t?await Kr(e,t.deletedDocNames,t.deletedFolderPaths):await Kr(e,e.filter(LY).map(IY),e.filter(FY).map(PY))}n.length>0&&K({failed:n,originalTargets:[...t]}),H(null)}else{let e=await Yr(t);H(null),e||ln()}}catch(e){let t=e,n=t instanceof Error?t.message:String(t);console.warn(`[FileTree] delete failed:`,t),hs.error(i({id:`0eHrMb`}),{description:n}),H(null),ln()}},t[232]=i,t[233]=ee,t[234]=Kr,t[235]=Yr,t[236]=$r,t[237]=ln,t[238]=re,t[239]=ei):ei=t[239];let ti=ei,ni;t[240]!==i||t[241]!==Yr||t[242]!==ln||t[243]!==G?(ni=async function(){if(!G)return;let e=new Set(G.failed.map(NY)),t=G.originalTargets.filter(t=>e.has(`${t.kind}:${t.path}`));if(K(null),t.length!==0){H(t[0]?.path??null);try{let e=await Yr(t);H(null),e||ln()}catch(e){let t=e,n=t instanceof Error?t.message:String(t);console.warn(`[FileTree] hard-delete fallback failed:`,t),hs.error(i({id:`0eHrMb`}),{description:n}),H(null),ln()}}},t[240]=i,t[241]=Yr,t[242]=ln,t[243]=G,t[244]=ni):ni=t[244];let ri=ni,ii;t[245]!==ti||t[246]!==G?(ii=async function(){if(!G)return;let e=new Set(G.failed.map(MY)),t=G.originalTargets.filter(t=>e.has(`${t.kind}:${t.path}`));K(null),await ti(t)},t[245]=ti,t[246]=G,t[247]=ii):ii=t[247];let ai=ii,oi=(0,Q.useRef)(ti),si;t[248]===ti?si=t[249]:(si=()=>{oi.current=ti},t[248]=ti,t[249]=si),(0,Q.useEffect)(si);let ci,li;t[250]===Symbol.for(`react.memo_cache_sentinel`)?(ci=()=>fJ(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=le.current.find(e=>ol(e)&&e.docName===t);oi.current([{kind:`file`,path:t,name:t.split(`/`).pop()??t,docExt:n?.docExt}]);return}if(e.kind===`folder`){oi.current([{kind:`folder`,path:e.folderPath,name:e.folderPath.split(`/`).pop()??e.folderPath}]);return}if(e.kind===`asset`){oi.current([{kind:`asset`,path:e.assetPath,name:e.assetPath.split(`/`).pop()??e.assetPath}]);return}console.warn(JSON.stringify({event:`file-tree-menu-action-delete-unsupported-kind`,kind:e.kind}))}),li=[],t[250]=ci,t[251]=li):(ci=t[250],li=t[251]),(0,Q.useEffect)(ci,li);let ui,di;t[252]===Symbol.for(`react.memo_cache_sentinel`)?(ui=()=>gJ(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=le.current.find(e=>ol(e)&&e.docName===t);Tn.current({kind:`file`,path:t,name:t.split(`/`).pop()??t,docExt:n?.docExt});return}if(e.kind===`folder`){Tn.current({kind:`folder`,path:e.folderPath,name:e.folderPath.split(`/`).pop()??e.folderPath});return}console.warn(JSON.stringify({event:`file-tree-menu-action-duplicate-unsupported-kind`,kind:e.kind}))}),di=[],t[252]=ui,t[253]=di):(ui=t[252],di=t[253]),(0,Q.useEffect)(ui,di);let fi,pi;t[254]===Y?(fi=t[255],pi=t[256]):(fi=()=>mJ(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=Xu(t,le.current.find(e=>ol(e)&&e.docName===t)?.docExt);Y.startRenaming(n);return}if(e.kind===`folder`){Y.startRenaming(e.folderPath);return}if(e.kind===`asset`){Y.startRenaming(e.assetPath);return}console.warn(JSON.stringify({event:`file-tree-menu-action-rename-unsupported-kind`,kind:e.kind}))}),pi=[Y],t[254]=Y,t[255]=fi,t[256]=pi),(0,Q.useEffect)(fi,pi);let mi;t[257]===Symbol.for(`react.memo_cache_sentinel`)?(mi=function(){let e=De.current;e&&zJ(e),De.current=null},t[257]=mi):mi=t[257];let hi=mi,gi;t[258]===Symbol.for(`react.memo_cache_sentinel`)?(gi=function(e){let t=pY(e);if(!t)return!1;let n=Xe.current?.querySelector(nR)?.shadowRoot;if(!n)return!1;for(let e of n.querySelectorAll(`[data-item-path]`))if(e.dataset.itemPath===t)return!0;return!1},t[258]=gi):gi=t[258];let _i=gi,vi;t[259]===g?vi=t[260]:(vi=function(e){let t=iX(e.nativeEvent);if(!t||t.endsWith(`/`)){hi();return}let n=le.current.find(e=>Ru(e)===t);if(n&&el(n)){hi();return}let r=n&&ol(n)?n.docName:td(t,le.current);if(n&&ol(n)&&Gn(n.size)){hi();return}De.current!==r&&(hi(),De.current=r,RJ(r,e=>g(e)))},t[259]=g,t[260]=vi);let yi=vi,bi;t[261]!==pe||t[262]!==Y||t[263]!==D||t[264]!==T?(bi=function(e){if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=aX(e.nativeEvent);if(!t){cX(e.nativeEvent)&&ae(!0);return}let n=t.getAttribute(`aria-selected`)===`true`,r=t.dataset.itemPath;if(!r)return;let i=t.dataset.itemType===`folder`?Ju(r):r;if(t.dataset.itemType===`folder`){let t=nd(i),r=aJ(Y.getItem(i));if(!n){e.preventDefault(),e.stopPropagation(),r&&!r.isExpanded()&&r.expand(),queueMicrotask(()=>D(t));return}if(Y.getSelectedPaths().length!==1||window.location.hash===vl(t))return;e.preventDefault(),e.stopPropagation(),r&&!r.isExpanded()&&r.expand(),queueMicrotask(()=>D(t));return}if(!n){if(mY(i,Xt.current)||_i(i)){de.current=i,setTimeout(()=>T(i,void 0,{registerPage:!0}),0);return}queueMicrotask(()=>pe(i));return}let a=td(i,le.current);Y.getSelectedPaths().length===1&&window.location.hash!==El(a)&&queueMicrotask(()=>pe(i))},t[261]=pe,t[262]=Y,t[263]=D,t[264]=T,t[265]=bi):bi=t[265];let xi=bi,Si;t[266]===Symbol.for(`react.memo_cache_sentinel`)?(Si=function(e){Gu(e.nativeEvent)&&(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=`copy`,rt(!0))},t[266]=Si):Si=t[266];let Ci=Si,wi;t[267]===Symbol.for(`react.memo_cache_sentinel`)?(wi=function(e){let t=e.relatedTarget;t instanceof Node&&e.currentTarget.contains(t)||rt(!1)},t[267]=wi):wi=t[267];let Ti=wi,Ei;t[268]===gr?Ei=t[269]:(Ei=function(e){if(!Gu(e.nativeEvent))return;let t=zu(e.nativeEvent);t.length!==0&&(e.preventDefault(),e.stopPropagation(),rt(!1),gr(t,``,iY))},t[268]=gr,t[269]=Ei);let Di=Ei;if(j){let e;return t[270]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(uX,{}),t[270]=e):e=t[270],e}let Oi;t[271]!==i||t[272]!==F||t[273]!==L?(Oi=F?i(L?{id:`H-vDm3`}:{id:`09Tv5j`}):null,t[271]=i,t[272]=F,t[273]=L,t[274]=Oi):Oi=t[274];let ki=Oi;if(k.length===0){if(ki!==null){let e;return t[275]===ki?e=t[276]:(e=(0,Z.jsx)(`div`,{className:`flex flex-1 items-center justify-center py-8`,children:(0,Z.jsx)(`span`,{role:`status`,className:`select-none text-sidebar-foreground/50 text-sm`,children:ki})}),t[275]=ki,t[276]=e),e}if(N){let e;return t[277]===N?e=t[278]:(e=(0,Z.jsx)(`div`,{className:`flex flex-1 items-center justify-center py-8`,children:(0,Z.jsx)(`span`,{role:`alert`,className:`select-none text-sidebar-foreground/50 text-sm`,children:N})}),t[277]=N,t[278]=e),e}let e;t[279]===i?e=t[280]:(e=i({id:`5ZB7XC`}),t[279]=i,t[280]=e);let n=nt&&`bg-primary/5 ring-2 ring-primary/70 ring-inset`,r;t[281]===n?r=t[282]:(r=X(`flex flex-1 flex-col items-center justify-center gap-3 rounded-md py-8`,n),t[281]=n,t[282]=r);let a;t[283]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(`span`,{className:`select-none text-sidebar-foreground/30 text-sm`,children:(0,Z.jsx)(J,{id:`xiv-dW`})}),t[283]=a):a=t[283];let o;t[284]===br?o=t[285]:(o=()=>br(`file`,``),t[284]=br,t[285]=o);let s;t[286]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(J,{id:`6ibbCg`}),t[286]=s):s=t[286];let c;t[287]===o?c=t[288]:(c=(0,Z.jsx)(Jr,{variant:`link`,size:`sm`,className:`font-mono uppercase`,onClick:o,children:s}),t[287]=o,t[288]=c);let l;return t[289]!==Di||t[290]!==e||t[291]!==r||t[292]!==c?(l=(0,Z.jsxs)(`section`,{"aria-label":e,className:r,onDragOver:Ci,onDragLeave:Ti,onDrop:Di,children:[a,c]}),t[289]=Di,t[290]=e,t[291]=r,t[292]=c,t[293]=l):l=t[293],l}let Ai=V!==null,ji=U?.targets[0]??null,Mi=null;if(z!==null){let e;if(t[294]!==a.locale||t[295]!==z){let n=new Intl.NumberFormat(a.locale).format(z);e=Gc._({id:`LuoJWu`,values:{truncatedShownCount:z,formattedCount:n}}),t[294]=a.locale,t[295]=z,t[296]=e}else e=t[296];Mi=e}let Ni;t[297]!==N||t[298]!==ki||t[299]!==Mi?(Ni=(N||ki!==null||Mi!==null)&&(0,Z.jsxs)(Z.Fragment,{children:[ki===null?N&&(0,Z.jsx)(fX,{kind:`error`,children:N}):(0,Z.jsx)(fX,{kind:`reconnecting`,children:ki}),Mi!==null&&(0,Z.jsx)(fX,{kind:`info`,children:Mi})]}),t[297]=N,t[298]=ki,t[299]=Mi,t[300]=Ni):Ni=t[300];let Pi;t[301]===y?Pi=t[302]:(Pi=mq(y),t[301]=y,t[302]=Pi);let Fi=q?``:void 0,Ii;t[303]===Fi?Ii=t[304]:(Ii={[sY]:Fi},t[303]=Fi,t[304]=Ii);let Li;t[305]!==Ai||t[306]!==ye||t[307]!==wr||t[308]!==k||t[309]!==Sr||t[310]!==Qt||t[311]!==wn||t[312]!==jt||t[313]!==Pt||t[314]!==Y||t[315]!==Mt||t[316]!==Nt||t[317]!==br||t[318]!==re?(Li=(e,t)=>(0,Z.jsx)(TY,{item:e,context:t,anyActionBusy:Ai,workspace:re,handoff:jt,model:Y,okignoreBinding:Mt,projectLocalBinding:Nt,mergedConfig:Pt,onStartCreating:br,onCreateFromTemplate:(e,t)=>br(`file`,e,{template:t}),onDuplicate:wn,onDelete:e=>W({targets:e}),onExpandSubtree:Sr,onCollapseSubtree:wr,folderTreePaths:Qt,isAsset:ye.has(e.path),documents:k}),t[305]=Ai,t[306]=ye,t[307]=wr,t[308]=k,t[309]=Sr,t[310]=Qt,t[311]=wn,t[312]=jt,t[313]=Pt,t[314]=Y,t[315]=Mt,t[316]=Nt,t[317]=br,t[318]=re,t[319]=Li):Li=t[319];let Ri;t[320]!==xi||t[321]!==yi||t[322]!==Y||t[323]!==Ni||t[324]!==Pi||t[325]!==Ii||t[326]!==Li?(Ri=(0,Z.jsx)(`div`,{ref:Xe,className:`flex min-h-0 flex-1 flex-col`,children:(0,Z.jsx)(cq,{header:Ni,model:Y,style:Pi,...Ii,onClickCapture:xi,onMouseMove:yi,onMouseLeave:hi,renderContextMenu:Li})}),t[320]=xi,t[321]=yi,t[322]=Y,t[323]=Ni,t[324]=Pi,t[325]=Ii,t[326]=Li,t[327]=Ri):Ri=t[327];let zi=!!U,Bi;t[328]===V?Bi=t[329]:(Bi=e=>{!e&&!V&&W(null)},t[328]=V,t[329]=Bi);let Vi;t[330]!==i||t[331]!==V||t[332]!==U||t[333]!==ti||t[334]!==ji?(Vi=U&&ji&&(0,Z.jsx)(xa,{...(()=>{let e=Jq(typeof window<`u`&&window.okDesktop!=null?`electron`:`web`,U.targets);if(e)return{customTitle:e.title,customDescription:``,customDetail:e.detail,customConfirmLabel:e.confirmLabel,customConfirmLabelBusy:e.confirmLabelBusy,children:e.listedTargets?(0,Z.jsx)(`ul`,{className:`flex flex-col gap-1 font-mono text-foreground text-xs`,children:e.listedTargets.map(jY)}):null};let t=U.targets.length,n=ji.name;return{itemName:t===1?ji.kind===`folder`?`${ji.name}/`:ji.kind===`file`?`${ji.name}${ji.docExt??`.md`}`:ji.name:void 0,customTitle:t>1?i({id:`abiHje`}):void 0,customDescription:t>1?i({id:`WMIKXK`,values:{targetCount:t}}):ji.kind===`folder`?i({id:`a5W0q0`,values:{folderName:n}}):void 0}})(),isSubmitting:V!==null,onDelete:()=>ti(U.targets)}),t[330]=i,t[331]=V,t[332]=U,t[333]=ti,t[334]=ji,t[335]=Vi):Vi=t[335];let Hi;t[336]!==zi||t[337]!==Bi||t[338]!==Vi?(Hi=(0,Z.jsx)(zs,{open:zi,onOpenChange:Bi,children:Vi}),t[336]=zi,t[337]=Bi,t[338]=Vi,t[339]=Hi):Hi=t[339];let Ui=!!G,Wi;t[340]===V?Wi=t[341]:(Wi=e=>{!e&&!V&&K(null)},t[340]=V,t[341]=Wi);let Gi;t[342]!==V||t[343]!==ri||t[344]!==ai||t[345]!==G?(Gi=G&&(0,Z.jsx)(nJ,{failedTargets:G.failed,isSubmitting:V!==null,onDeletePermanently:ri,onRetry:ai,onCancel:()=>K(null)}),t[342]=V,t[343]=ri,t[344]=ai,t[345]=G,t[346]=Gi):Gi=t[346];let Ki;t[347]!==Ui||t[348]!==Wi||t[349]!==Gi?(Ki=(0,Z.jsx)(zs,{open:Ui,onOpenChange:Wi,children:Gi}),t[347]=Ui,t[348]=Wi,t[349]=Gi,t[350]=Ki):Ki=t[350];let qi=te!==null,Ji;t[351]===Symbol.for(`react.memo_cache_sentinel`)?(Ji=e=>{e||ne(null)},t[351]=Ji):Ji=t[351];let Yi=te?.parentDir??``,Xi;t[352]!==qi||t[353]!==Yi?(Xi=(0,Z.jsx)(xh,{open:qi,onOpenChange:Ji,kind:`file`,initialDir:Yi,defaultToTemplate:!0}),t[352]=qi,t[353]=Yi,t[354]=Xi):Xi=t[354];let Zi;return t[355]!==Ri||t[356]!==Hi||t[357]!==Ki||t[358]!==Xi?(Zi=(0,Z.jsxs)(Z.Fragment,{children:[Ri,Hi,Ki,Xi]}),t[355]=Ri,t[356]=Hi,t[357]=Ki,t[358]=Xi,t[359]=Zi):Zi=t[359],Zi}function jY(e){return(0,Z.jsx)(`li`,{"data-testid":`delete-target-row`,children:Yq(e)},`${e.kind}:${e.path}`)}function MY(e){return`${e.kind}:${e.path}`}function NY(e){return`${e.kind}:${e.path}`}function PY(e){return e.path}function FY(e){return e.kind===`folder`}function IY(e){return e.path}function LY(e){return e.kind===`file`}function RY(e){return e.file}function zY(e){return Oe(e)}function BY(e){return st(e)}function VY(e){return pt(e)}function HY(e){return e.path}function UY(e){return e.kind===`asset`}function WY(e){return e.endsWith(`/`)?e.slice(0,-1):e}function GY(e){return!!e}function KY(e){console.warn(`[FileTree] /api/workspace fetch failed:`,e)}function qY(e){console.warn(`[FileTree] unmount cleanup failed:`,e)}function JY(e){hs.error(e)}function YY(){}function XY(e){return hs.error(e)}function ZY(){}function QY(){}function $Y(){}function eX(){}function tX(){}async function nX(){}function rX(e){return Ru(e)}function iX(e){return aX(e)?.dataset.itemPath??null}function aX(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.dataset.itemPath)return t;return null}function oX(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.matches(`[data-file-tree-virtualized-root]`))return t;return null}function sX(e){let t=aX(e);if(t){let e=t.dataset.itemPath;if(!e)return null;let n=t.dataset.itemType===`folder`,r=Bu(e,n);return{parentDir:r,row:t,root:null,busyPath:n?Ju(r):e}}return cX(e)?{parentDir:``,row:null,root:oX(e),busyPath:iY}:null}function cX(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.matches(`[data-file-tree-virtualized-scroll]`))return!0;return!1}var lX=[`w-3/4`,`w-2/3`,`w-4/5`,`w-1/2`,`w-3/5`,`w-2/3`];function uX(){let e=(0,$.c)(5),{_:t}=kt(),n;e[0]===t?n=e[1]:(n=t({id:`5Tk8Fb`}),e[0]=t,e[1]=n);let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=lX.map(dX),e[2]=r):r=e[2];let i;return e[3]===n?i=e[4]:(i=(0,Z.jsx)(`div`,{className:`flex flex-1 flex-col gap-1 px-2 py-2`,role:`status`,"aria-busy":`true`,"aria-label":n,children:r}),e[3]=n,e[4]=i),i}function dX(e,t){return(0,Z.jsxs)(`div`,{className:`flex h-6 items-center gap-2`,children:[(0,Z.jsx)(Ka,{className:`h-3 w-3 shrink-0 rounded-sm`}),(0,Z.jsx)(Ka,{className:`h-3 ${e}`})]},t)}function fX(e){let t=(0,$.c)(14),{kind:n,children:r}=e,i=n===`error`?os:n===`reconnecting`?is:ts,a=n===`error`?`alert`:`status`,o=n===`error`?`text-destructive`:`text-muted-foreground`,s;t[0]===o?s=t[1]:(s=X(`mx-2 mb-1 flex items-start gap-1.5 rounded-md bg-muted/50 px-2 py-1.5 text-xs leading-snug`,o),t[0]=o,t[1]=s);let c=n===`reconnecting`&&`animate-spin motion-reduce:animate-none`,l;t[2]===c?l=t[3]:(l=X(`mt-0.5 size-3.5 shrink-0`,c),t[2]=c,t[3]=l);let u;t[4]!==i||t[5]!==l?(u=(0,Z.jsx)(i,{"aria-hidden":`true`,className:l}),t[4]=i,t[5]=l,t[6]=u):u=t[6];let d;t[7]===r?d=t[8]:(d=(0,Z.jsx)(`span`,{className:`min-w-0`,children:r}),t[7]=r,t[8]=d);let f;return t[9]!==a||t[10]!==s||t[11]!==u||t[12]!==d?(f=(0,Z.jsxs)(`span`,{role:a,className:s,children:[u,d]}),t[9]=a,t[10]=s,t[11]=u,t[12]=d,t[13]=f):f=t[13],f}function pX(e){return e?Gc._({id:`wTcjov`}):null}function mX(e){let t=(0,$.c)(23),{_:n}=kt(),r=Po(),i=Ta();if(r)return null;let{input:a,installStates:o,dispatch:s}=e,c=a===null,l,u,d,f,p,m;if(t[0]!==n||t[1]!==s||t[2]!==a||t[3]!==c||t[4]!==o||t[5]!==i){m=Symbol.for(`react.early_return_sentinel`);bb0:{let e=pX(c),r;t[12]===o?r=t[13]:(r=e=>o[e.id]?.installed===!0,t[12]=o,t[13]=r);let h=ca.filter(r),g=h.length>0,_=i!==null;if(!g&&!_){m=null;break bb0}u=pP,t[14]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsxs)(gP,{children:[(0,Z.jsx)(jo,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`O7_W_a`})]}),t[14]=p):p=t[14],l=_P,d=_?(0,Z.jsxs)(fP,{"aria-label":n({id:`ALhMYW`}),children:[(0,Z.jsx)(yP,{children:(0,Z.jsx)(J,{id:`ALhMYW`})}),wa.map(t=>{let{displayName:r}=zr[t];return(0,Z.jsxs)(hP,{onSelect:()=>{a!==null&&i.launchInTerminal(a,t)},disabled:c,"data-testid":`empty-space-open-in-terminal-${t}`,"aria-label":n(e?{id:`AIn2Yv`,values:{displayName:r,hint:e}}:{id:`QYfQdv`,values:{displayName:r}}),children:[(0,Z.jsx)(ma,{id:pa(t),"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:r}),e?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t)})]}):null,f=g?(0,Z.jsxs)(Z.Fragment,{children:[_?(0,Z.jsx)(bP,{}):null,(0,Z.jsxs)(fP,{"aria-label":n({id:`BBqGS9`}),children:[(0,Z.jsx)(yP,{children:(0,Z.jsx)(J,{id:`BBqGS9`})}),h.map(t=>{let r=!c,{displayName:i}=t,o=n(e?{id:`1ZpfyB`,values:{displayName:i,hint:e}}:{id:`WqLq6M`,values:{displayName:i}});return(0,Z.jsxs)(hP,{disabled:!r,onSelect:()=>{a&&s(t.id,a)},"data-testid":`empty-space-open-in-${t.id}`,"aria-label":o,children:[(0,Z.jsx)(ma,{id:t.id,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:t.displayName}),e?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t.id)})]})]}):null}t[0]=n,t[1]=s,t[2]=a,t[3]=c,t[4]=o,t[5]=i,t[6]=l,t[7]=u,t[8]=d,t[9]=f,t[10]=p,t[11]=m}else l=t[6],u=t[7],d=t[8],f=t[9],p=t[10],m=t[11];if(m!==Symbol.for(`react.early_return_sentinel`))return m;let h;t[15]!==l||t[16]!==d||t[17]!==f?(h=(0,Z.jsxs)(l,{children:[d,f]}),t[15]=l,t[16]=d,t[17]=f,t[18]=h):h=t[18];let g;return t[19]!==u||t[20]!==p||t[21]!==h?(g=(0,Z.jsxs)(u,{children:[p,h]}),t[19]=u,t[20]=p,t[21]=h,t[22]=g):g=t[22],g}async function hX(e){try{let t=await e.project.listRecent(),n=e.config.projectPath;if(t.some(e=>e.path!==n))return null;let r=await lT();return e.config.freshlyCreated?r:r===0?0:null}catch(e){return console.warn(`[onboarding-card-visible] fresh-project probe failed; suppressing card`,e),null}}function gX(e){let t=(0,$.c)(4),n=e===void 0?aT:e,{initialized:r,dismissed:i,completed:a}=(0,Q.useSyncExternalStore)(n.subscribe,n.getSnapshot,n.getSnapshot),o=i||a,s=!r&&!o,c,l;return t[0]!==s||t[1]!==n?(c=()=>{if(!s)return;let e=window.okDesktop;if(e==null)return;let t=!1;return hX(e).then(e=>{!t&&e!==null&&n.activate(e)}),()=>{t=!0}},l=[s,n],t[0]=s,t[1]=n,t[2]=c,t[3]=l):(c=t[2],l=t[3]),(0,Q.useEffect)(c,l),r&&!o}function _X(e){let t=(0,$.c)(3),n=e===void 0?aT:e,r,i;t[0]===n?(r=t[1],i=t[2]):(r=()=>{if(n.getSnapshot().steps.file)return;let e=dl(e=>{e.includes(`files`)&&uT(n)});return uT(n),e},i=[n],t[0]=n,t[1]=r,t[2]=i),(0,Q.useEffect)(r,i)}var vX=3,yX=5200,bX=1500,xX=220;function SX(e){let t=(0,$.c)(14),{complete:n,label:r,shortcutId:i}=e,a;t[0]===n?a=t[1]:(a=(0,Z.jsx)(Bs,{checked:n,disabled:!0,"aria-hidden":!0,tabIndex:-1,className:`pointer-events-none opacity-100 disabled:opacity-100`}),t[0]=n,t[1]=a);let o=n?`flex-1 text-muted-foreground/60`:`flex-1`,s;t[2]===n?s=t[3]:(s=n?(0,Z.jsxs)(`span`,{className:`sr-only`,children:[(0,Z.jsx)(J,{id:`Qj4RL5`}),` `]}):null,t[2]=n,t[3]=s);let c;t[4]!==r||t[5]!==o||t[6]!==s?(c=(0,Z.jsxs)(`span`,{className:o,children:[s,r]}),t[4]=r,t[5]=o,t[6]=s,t[7]=c):c=t[7];let l;t[8]===i?l=t[9]:(l=i?(0,Z.jsx)(M,{children:Al(i)}):null,t[8]=i,t[9]=l);let u;return t[10]!==a||t[11]!==c||t[12]!==l?(u=(0,Z.jsxs)(`li`,{className:`flex items-center gap-2 py-0.5 text-sm`,children:[a,c,l]}),t[10]=a,t[11]=c,t[12]=l,t[13]=u):u=t[13],u}function CX(e){let t=(0,$.c)(24),{store:n,lingerMs:r}=e,i=n===void 0?aT:n,a=r===void 0?yX:r,{_:o}=kt(),{steps:s}=oT(i);_X(i);let[c,l]=(0,Q.useState)(0),[u,d]=(0,Q.useState)(!1),f=1+ +!!s.file+ +!!s.askedAi,p=f===vX,m,h;t[0]!==p||t[1]!==a?(m=()=>{if(!p)return;l(TX);let e=setInterval(()=>l(wX),bX),t=setTimeout(()=>{clearInterval(e),d(!0)},a);return()=>{clearInterval(e),clearTimeout(t)}},h=[p,a],t[0]=p,t[1]=a,t[2]=m,t[3]=h):(m=t[2],h=t[3]),(0,Q.useEffect)(m,h);let g,_;t[4]!==u||t[5]!==i?(g=()=>{if(!u)return;let e=setTimeout(()=>i.markCompleted(),xX);return()=>clearTimeout(e)},_=[u,i],t[4]=u,t[5]=i,t[6]=g,t[7]=_):(g=t[6],_=t[7]),(0,Q.useEffect)(g,_);let v;t[8]!==o||t[9]!==p?(v=p?o({id:`7jIIFX`}):``,t[8]=o,t[9]=p,t[10]=v):v=t[10];let y;t[11]===v?y=t[12]:(y=(0,Z.jsx)(`div`,{className:`sr-only`,role:`status`,"aria-live":`polite`,children:v}),t[11]=v,t[12]=y);let b;t[13]!==p||t[14]!==c||t[15]!==f||t[16]!==u||t[17]!==s.askedAi||t[18]!==s.file||t[19]!==i?(b=p?(0,Z.jsxs)(`section`,{"aria-hidden":!0,className:X(`mx-2 mb-1 flex items-center gap-3 rounded-lg border bg-card px-4 py-3 text-card-foreground`,`motion-reduce:animate-none motion-reduce:duration-0`,u?`animate-out fade-out-0 zoom-out-95 fill-mode-forwards duration-200`:`animate-in fade-in-0 zoom-in-95 duration-300`),children:[(0,Z.jsx)(DS,{size:36,celebrateSignal:c}),(0,Z.jsx)(`span`,{className:`font-medium text-sm`,children:(0,Z.jsx)(J,{id:`7jIIFX`})})]}):(0,Z.jsxs)(`section`,{"aria-labelledby":`onboarding-card-heading`,className:`mx-2 mb-1 rounded-lg border bg-card px-4 py-3 text-card-foreground`,children:[(0,Z.jsxs)(`header`,{className:`mb-3 flex items-center justify-between`,children:[(0,Z.jsx)(`h2`,{id:`onboarding-card-heading`,className:`font-medium text-sm`,children:(0,Z.jsx)(J,{id:`Y1QMlM`})}),(0,Z.jsx)(`span`,{className:`text-muted-foreground/60 text-xs tabular-nums`,children:`${f} / ${vX}`})]}),(0,Z.jsxs)(`ul`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(SX,{complete:!0,label:(0,Z.jsx)(J,{id:`4E9jPa`})}),(0,Z.jsx)(SX,{complete:s.file,label:(0,Z.jsx)(J,{id:`6ibbCg`}),shortcutId:`new-item`}),(0,Z.jsx)(SX,{complete:s.askedAi,label:(0,Z.jsx)(J,{id:`xWEvuo`}),shortcutId:`open-ask-ai`})]}),(0,Z.jsx)(`footer`,{className:`-mb-1 mt-2 flex justify-end`,children:(0,Z.jsx)(Jr,{type:`button`,variant:`ghost`,size:`sm`,className:`h-auto px-2 py-1 text-muted-foreground text-xs`,onClick:()=>i.dismiss(),children:(0,Z.jsx)(J,{id:`1QfxQT`})})})]}),t[13]=p,t[14]=c,t[15]=f,t[16]=u,t[17]=s.askedAi,t[18]=s.file,t[19]=i,t[20]=b):b=t[20];let x;return t[21]!==y||t[22]!==b?(x=(0,Z.jsxs)(Z.Fragment,{children:[y,b]}),t[21]=y,t[22]=b,t[23]=x):x=t[23],x}function wX(e){return e+1}function TX(e){return e+1}function EX(){let e=(0,$.c)(1);if(!gX())return null;let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(CX,{}),e[0]=t):t=e[0],t}function DX(e){return e===null?null:e.kind===`local`?e.name:e.ref}function OX(e,t){if(e.length===0)return null;let n=`origin/${e}`;return t.includes(n)?n:t.find(t=>Rr(t)===e)??null}function kX(e){switch(e){case`branch-exists`:return{id:`wzq9Rv`};case`already-checked-out`:return{id:`ljHjfg`};case`path-exists`:return{id:`mYzDD_`};case`invalid-branch`:return{id:`r-OJYm`};case`no-git`:return{id:`CFnavk`};default:return{id:`-zA2E7`}}}function AX(e){let t=(0,$.c)(71),{open:n,onOpenChange:r,bridge:i,currentBranch:a,branches:o,existingWorktreeBranches:s,remoteBranches:c,behindByBranch:l,initialBranchName:u}=e,d=o===void 0?[]:o,f=c===void 0?[]:c,p=u===void 0?``:u,{_:m}=kt(),h=(0,Q.useId)(),g=(0,Q.useId)(),_=(0,Q.useId)(),v=(0,Q.useId)(),y=(0,Q.useId)(),b=(0,Q.useId)(),[x,S]=(0,Q.useState)(``),C;t[0]===a?C=t[1]:(C=a===null?null:{kind:`local`,name:a},t[0]=a,t[1]=C);let[w,T]=(0,Q.useState)(C),[E,D]=(0,Q.useState)(!1),[O,k]=(0,Q.useState)(``),[A,j]=(0,Q.useState)(!1),[M,N]=(0,Q.useState)(null),P=(0,Q.useRef)(null),F=(0,Q.useRef)(null),I,L;t[2]!==a||t[3]!==p||t[4]!==n?(I=()=>{if(!n)return;S(p),T(a===null?null:{kind:`local`,name:a}),D(!1),k(``),j(!1),N(null);let e=requestAnimationFrame(()=>P.current?.focus());return()=>cancelAnimationFrame(e)},L=[n,a,p],t[2]=a,t[3]=p,t[4]=n,t[5]=I,t[6]=L):(I=t[5],L=t[6]),(0,Q.useEffect)(I,L);let R=x.trim(),z=!A&&R.length>0,B=R.length>0&&d.includes(R),V=B?null:OX(R,f),H=V!==null,U=B||H,W=B&&(s?.has(R)??!1),G=d.filter(e=>e.toLowerCase().startsWith(R.toLowerCase())),K=!A&&G.length>0&&!U,ee=(a!==null&&!d.includes(a)?[a,...d]:d).map(FX),te=f.map(PX),ne=DX(w),re=O.trim().toLowerCase(),q=re===``?ee:ee.filter(e=>e.name.toLowerCase().includes(re)),oe=re===``?te:te.filter(e=>e.ref.toLowerCase().includes(re)),ce=re!==``&&q.length===0&&oe.length===0,le=async function(e){if(e.preventDefault(),z){j(!0),N(null);try{let e=H?{branch:R,createBranch:!0,remoteRef:V}:B?{branch:R,createBranch:!1}:{branch:R,createBranch:!0,baseBranch:w?.kind===`local`?w.name:void 0,baseRef:w?.kind===`remote`?w.ref:void 0},t=await i.worktree.create(e);if(!t.ok){N(kX(t.reason)),j(!1);return}cg(),r(!1),await i.project.open({path:t.path,target:`new-window`,entryPoint:`worktree`})}catch(e){console.warn(`[NewWorktreeDialog] worktree create/open failed:`,e),hs.error(m({id:`vAYoCZ`})),j(!1)}}},ue=zs,de;t[7]!==A||t[8]!==r?(de=e=>{A||r(e)},t[7]=A,t[8]=r,t[9]=de):de=t[9];let fe=Fs,pe;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(pe=(0,Z.jsx)(Ps,{children:(0,Z.jsx)(J,{id:`DXd9LM`})}),t[10]=pe):pe=t[10];let me;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,Z.jsxs)(Rs,{children:[pe,(0,Z.jsx)(Ns,{children:(0,Z.jsx)(J,{id:`NEzPEh`})})]}),t[11]=me):me=t[11];let he=Is,ge;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,Z.jsx)(J,{id:`ng2Ibo`}),t[12]=ge):ge=t[12];let _e;t[13]===g?_e=t[14]:(_e=(0,Z.jsx)(Nc,{htmlFor:g,children:ge}),t[13]=g,t[14]=_e);let ve;t[15]===m?ve=t[16]:(ve=m({id:`IX_uXB`}),t[15]=m,t[16]=ve);let ye;t[17]===M?ye=t[18]:(ye=e=>{S(e.target.value),M!==null&&N(null)},t[17]=M,t[18]=ye);let be=M!==null,xe=M===null?y:`${y} ${b}`,Se;t[19]!==x||t[20]!==A||t[21]!==g||t[22]!==ve||t[23]!==ye||t[24]!==be||t[25]!==xe?(Se=(0,Z.jsx)(Uc,{id:g,ref:P,value:x,placeholder:ve,onChange:ye,disabled:A,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-invalid":be,"aria-describedby":xe,"data-testid":`new-worktree-branch`}),t[19]=x,t[20]=A,t[21]=g,t[22]=ve,t[23]=ye,t[24]=be,t[25]=xe,t[26]=Se):Se=t[26];let Ce=R.length>0?(0,Z.jsxs)(`p`,{id:y,className:`flex items-start gap-1.5 text-1sm text-muted-foreground`,"data-testid":W?`new-worktree-mode-existing-worktree`:H?`new-worktree-mode-remote-checkout`:B?`new-worktree-mode-checkout`:`new-worktree-mode-create`,children:[W?(0,Z.jsx)(Ro,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-amber-600 dark:text-amber-400`}):H?(0,Z.jsx)(io,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-violet-600 dark:text-violet-400`}):B?(0,Z.jsx)($i,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-blue-600 dark:text-blue-400`}):(0,Z.jsx)(nt,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-green-600 dark:text-green-400`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1`,children:W?(0,Z.jsx)(J,{id:`QAi7Q9`,values:{trimmed:R},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-words`})}}):H?(0,Z.jsx)(J,{id:`oAGN8p`,values:{remoteCheckoutRef:V,trimmed:R},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-words`}),1:(0,Z.jsx)(`code`,{className:`font-mono break-words`}),2:(0,Z.jsx)(`code`,{className:`font-mono`})}}):B?(0,Z.jsx)(J,{id:`b4VvP-`,values:{trimmed:R},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-words`}),1:(0,Z.jsx)(`code`,{className:`font-mono`})}}):ne===null?(0,Z.jsx)(J,{id:`t4sFKC`,values:{trimmed:R},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-words`}),1:(0,Z.jsx)(`code`,{className:`font-mono`})}}):(0,Z.jsx)(J,{id:`dGAdpH`,values:{trimmed:R,currentBaseLabel:ne},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-words`}),1:(0,Z.jsx)(`code`,{className:`font-mono break-words`}),2:(0,Z.jsx)(`code`,{className:`font-mono`})}})})]}):null,we=K?(0,Z.jsx)(`div`,{className:`max-h-40 overflow-y-auto rounded-md border bg-popover p-1 shadow-xs`,"data-testid":`new-worktree-branch-list`,children:G.map(e=>(0,Z.jsxs)(Jr,{type:`button`,variant:`ghost`,size:`sm`,tabIndex:-1,onClick:()=>{S(e),M!==null&&N(null),P.current?.focus()},"data-testid":`new-worktree-branch-option-${e}`,className:`h-8 w-full justify-start gap-2 font-normal`,children:[(0,Z.jsx)(zo,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left`,children:e})]},e))}):null,Ee=U?null:(0,Z.jsxs)(`div`,{className:`mt-1 flex flex-col gap-2`,children:[(0,Z.jsx)(Nc,{id:v,htmlFor:_,children:(0,Z.jsx)(J,{id:`ZWwYwM`})}),(0,Z.jsxs)(ae,{open:E,onOpenChange:e=>{D(e),e||k(``)},children:[(0,Z.jsx)(se,{asChild:!0,children:(0,Z.jsxs)(Jr,{id:_,type:`button`,variant:`outline`,role:`combobox`,"aria-expanded":E,"aria-haspopup":`listbox`,"aria-labelledby":`${v} ${_}`,"aria-label":m({id:`ZWwYwM`}),disabled:A,"data-testid":`new-worktree-base-trigger`,className:`w-full justify-between font-normal`,children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[w?.kind===`remote`?(0,Z.jsx)(io,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}):(0,Z.jsx)(zo,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate text-left`,children:ne===null?(0,Z.jsx)(J,{id:`EbjWsS`}):ne})]}),(0,Z.jsx)(jd,{"aria-hidden":`true`,className:`ml-2 size-4 shrink-0 opacity-50`})]})}),(0,Z.jsxs)(ie,{align:`start`,className:`w-[var(--radix-popover-trigger-width)] p-1`,onWheel:NX,onTouchMove:MX,onOpenAutoFocus:e=>{e.preventDefault(),F.current?.focus()},children:[(0,Z.jsxs)(ZC,{className:`mb-1 h-8`,children:[(0,Z.jsx)(nw,{ref:F,"aria-label":m({id:`fuJZKk`}),placeholder:m({id:`hQXiDc`}),value:O,onChange:e=>k(e.target.value),onKeyDown:jX,"data-testid":`new-worktree-base-search`}),(0,Z.jsx)($C,{children:(0,Z.jsx)(Te,{"aria-hidden":`true`})})]}),(0,Z.jsxs)(`div`,{role:`listbox`,"aria-label":m({id:`ZWwYwM`}),className:`max-h-56 overflow-y-auto`,"data-testid":`new-worktree-base-list`,children:[ce?(0,Z.jsx)(`p`,{className:`px-2 py-1.5 text-1sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`Sh3Qkg`})}):null,q.map(e=>{let t=e.name,n=l?.get(t);return(0,Z.jsxs)(Jr,{type:`button`,role:`option`,"aria-selected":w?.kind===`local`&&w.name===t,variant:`ghost`,size:`sm`,onClick:()=>{T(e),D(!1),k(``)},"data-testid":`new-worktree-base-option-${t}`,className:`h-8 w-full justify-start gap-2 font-normal`,children:[(0,Z.jsx)(zo,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left`,children:t}),n!==void 0&&n>0?(0,Z.jsx)(`span`,{className:`shrink-0 text-xs text-amber-600 dark:text-amber-400`,"data-testid":`new-worktree-base-behind-${t}`,children:(0,Z.jsx)(J,{id:`6-wLTJ`,values:{behind:n}})}):null]},`local:${t}`)}),oe.map(e=>{let t=e.ref;return(0,Z.jsxs)(Jr,{type:`button`,role:`option`,"aria-selected":w?.kind===`remote`&&w.ref===t,variant:`ghost`,size:`sm`,onClick:()=>{T(e),D(!1),k(``)},"data-testid":`new-worktree-base-option-${t}`,className:`h-8 w-full justify-start gap-2 font-normal`,children:[(0,Z.jsx)(io,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left`,children:t}),(0,Z.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:(0,Z.jsx)(J,{id:`dIYSqk`})})]},`remote:${t}`)})]})]})]})]}),De;t[27]!==m||t[28]!==M||t[29]!==b?(De=M===null?null:(0,Z.jsx)(`p`,{id:b,role:`alert`,className:`text-1sm text-destructive`,"data-testid":`new-worktree-error`,children:m(M)}),t[27]=m,t[28]=M,t[29]=b,t[30]=De):De=t[30];let Oe;t[31]!==h||t[32]!==le||t[33]!==_e||t[34]!==Se||t[35]!==Ce||t[36]!==we||t[37]!==Ee||t[38]!==De?(Oe=(0,Z.jsxs)(`form`,{id:h,onSubmit:le,className:`flex flex-col gap-2`,children:[_e,Se,Ce,we,Ee,De]}),t[31]=h,t[32]=le,t[33]=_e,t[34]=Se,t[35]=Ce,t[36]=we,t[37]=Ee,t[38]=De,t[39]=Oe):Oe=t[39];let ke;t[40]!==he||t[41]!==Oe?(ke=(0,Z.jsx)(he,{children:Oe}),t[40]=he,t[41]=Oe,t[42]=ke):ke=t[42];let Ae;t[43]===r?Ae=t[44]:(Ae=()=>r(!1),t[43]=r,t[44]=Ae);let je;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(je=(0,Z.jsx)(J,{id:`dEgA5A`}),t[45]=je):je=t[45];let Me;t[46]!==A||t[47]!==Ae?(Me=(0,Z.jsx)(Jr,{type:`button`,variant:`outline`,onClick:Ae,disabled:A,"data-testid":`new-worktree-cancel`,children:je}),t[46]=A,t[47]=Ae,t[48]=Me):Me=t[48];let Ne=!z,Pe;t[49]!==A||t[50]!==W||t[51]!==B||t[52]!==H?(Pe=A?(0,Z.jsx)(J,{id:`b4itZn`}):W?(0,Z.jsx)(J,{id:`XV5sC0`}):H?(0,Z.jsx)(J,{id:`XAyxsa`}):B?(0,Z.jsx)(J,{id:`uGaIIS`}):(0,Z.jsx)(J,{id:`iO8V-7`}),t[49]=A,t[50]=W,t[51]=B,t[52]=H,t[53]=Pe):Pe=t[53];let Fe;t[54]!==h||t[55]!==Ne||t[56]!==Pe?(Fe=(0,Z.jsx)(Jr,{type:`submit`,form:h,disabled:Ne,"data-testid":`new-worktree-create`,children:Pe}),t[54]=h,t[55]=Ne,t[56]=Pe,t[57]=Fe):Fe=t[57];let Ie;t[58]!==Me||t[59]!==Fe?(Ie=(0,Z.jsxs)(Ls,{children:[Me,Fe]}),t[58]=Me,t[59]=Fe,t[60]=Ie):Ie=t[60];let Le;t[61]!==fe||t[62]!==me||t[63]!==ke||t[64]!==Ie?(Le=(0,Z.jsxs)(fe,{className:`sm:max-w-md`,"data-testid":`new-worktree-dialog`,children:[me,ke,Ie]}),t[61]=fe,t[62]=me,t[63]=ke,t[64]=Ie,t[65]=Le):Le=t[65];let Re;return t[66]!==ue||t[67]!==n||t[68]!==Le||t[69]!==de?(Re=(0,Z.jsx)(ue,{open:n,onOpenChange:de,children:Le}),t[66]=ue,t[67]=n,t[68]=Le,t[69]=de,t[70]=Re):Re=t[70],Re}function jX(e){return e.stopPropagation()}function MX(e){e.stopPropagation()}function NX(e){e.stopPropagation()}function PX(e){return{kind:`remote`,ref:e}}function FX(e){return{kind:`local`,name:e}}function IX(e){let t=(0,$.c)(51),{bridge:n,recents:r,currentPath:i,query:a,worktreeModel:o,closeMenu:s,guardStaleSelect:c,flyoutPath:l,setFlyoutPath:u,openNewWorktreeWith:d}=e,{_:f}=kt(),p;t[0]!==f||t[1]!==n.project||t[2]!==s?(p=function(e,t){s(),n.project.open({path:e,target:`new-window`,entryPoint:t}).catch(e=>{console.warn(`[RecentProjectsMenu] project.open failed:`,e),hs.error(f({id:`6HCOwA`}))})},t[0]=f,t[1]=n.project,t[2]=s,t[3]=p):p=t[3];let m=p,h;t[4]!==f||t[5]!==n.project||t[6]!==n.worktree?(h=async function(e){try{let t=await n.worktree.create({branch:e,createBranch:!1});if(!t.ok){hs.error(f({id:`teD0H9`}));return}cg(),await n.project.open({path:t.path,target:`new-window`,entryPoint:`worktree`})}catch(e){console.warn(`[RecentProjectsMenu] create/open branch failed:`,e),hs.error(f({id:`LwMxXg`}))}},t[4]=f,t[5]=n.project,t[6]=n.worktree,t[7]=h):h=t[7];let g=h,_;t[8]!==s||t[9]!==i||t[10]!==m?(_=function(e){if(e.path===i){s();return}m(e.path,e.isLinkedWorktree?`worktree`:`recents`)},t[8]=s,t[9]=i,t[10]=m,t[11]=_):_=t[11];let v=_,y;t[12]!==s||t[13]!==g||t[14]!==i||t[15]!==m?(y=function(e){if(e.path!==null){if(e.path===i){s();return}m(e.path,e.isMain?`recents`:`worktree`);return}e.branch!==null&&(s(),g(e.branch))},t[12]=s,t[13]=g,t[14]=i,t[15]=m,t[16]=y):y=t[16];let b=y;if(a!==``){let e;t[17]!==s||t[18]!==g?(e=e=>{s(),g(e)},t[17]=s,t[18]=g,t[19]=e):e=t[19];let n;return t[20]!==i||t[21]!==c||t[22]!==v||t[23]!==a||t[24]!==r||t[25]!==e||t[26]!==o?(n=(0,Z.jsx)(VX,{recents:r,currentPath:i,query:a,worktreeModel:o,onPickEntry:v,onPickBranch:e,guardStaleSelect:c}),t[20]=i,t[21]=c,t[22]=v,t[23]=a,t[24]=r,t[25]=e,t[26]=o,t[27]=n):n=t[27],n}let x;if(t[28]!==s||t[29]!==i||t[30]!==l||t[31]!==c||t[32]!==b||t[33]!==d||t[34]!==m||t[35]!==r||t[36]!==u||t[37]!==o){let e=xg(r),n;t[39]!==s||t[40]!==i||t[41]!==l||t[42]!==c||t[43]!==b||t[44]!==d||t[45]!==m||t[46]!==u||t[47]!==o?(n=e=>(0,Z.jsx)(LX,{group:e,currentPath:i,worktreeModel:o,flyoutOpen:l===e.project.path,setFlyoutOpen:t=>u(n=>t?e.project.path:n===e.project.path?null:n),onPickProject:()=>{if(e.project.path===i){s();return}m(e.project.path,`recents`)},onPickFlyoutEntry:b,guardStaleSelect:c,openNewWorktreeWith:d},e.project.path),t[39]=s,t[40]=i,t[41]=l,t[42]=c,t[43]=b,t[44]=d,t[45]=m,t[46]=u,t[47]=o,t[48]=n):n=t[48],x=e.map(n),t[28]=s,t[29]=i,t[30]=l,t[31]=c,t[32]=b,t[33]=d,t[34]=m,t[35]=r,t[36]=u,t[37]=o,t[38]=x}else x=t[38];let S;return t[49]===x?S=t[50]:(S=(0,Z.jsx)(Z.Fragment,{children:x}),t[49]=x,t[50]=S),S}function LX(e){let t=(0,$.c)(34),{group:n,currentPath:r,worktreeModel:i,flyoutOpen:a,setFlyoutOpen:o,onPickProject:s,onPickFlyoutEntry:c,guardStaleSelect:l,openNewWorktreeWith:u}=e,d=n.project.path===r,f,p;t[0]!==r||t[1]!==n||t[2]!==i?(f=vg(n,i,r),p=f.filter(RX),t[0]=r,t[1]=n,t[2]=i,t[3]=f,t[4]=p):(f=t[3],p=t[4]);let m=p.length;if(m===0){let e;t[5]!==l||t[6]!==s?(e=e=>{l(e)||s()},t[5]=l,t[6]=s,t[7]=e):e=t[7];let r=`project-switcher-recent-${n.project.path}`,i=d?`true`:void 0,a;t[8]!==n.project.name||t[9]!==n.project.path||t[10]!==d?(a=(0,Z.jsx)(WX,{name:n.project.name,path:n.project.path,current:d}),t[8]=n.project.name,t[9]=n.project.path,t[10]=d,t[11]=a):a=t[11];let o;return t[12]!==e||t[13]!==r||t[14]!==i||t[15]!==a?(o=(0,Z.jsx)(vc,{onSelect:e,className:`flex w-full min-w-0 flex-col items-start gap-0.5`,"data-testid":r,"data-current":i,children:a}),t[12]=e,t[13]=r,t[14]=i,t[15]=a,t[16]=o):o=t[16],o}let h;t[17]!==r||t[18]!==n.worktrees||t[19]!==d?(h=d||n.worktrees.some(e=>e.path===r),t[17]=r,t[18]=n.worktrees,t[19]=d,t[20]=h):h=t[20];let g=h,_;return t[21]!==g||t[22]!==r||t[23]!==f||t[24]!==a||t[25]!==n||t[26]!==l||t[27]!==c||t[28]!==s||t[29]!==u||t[30]!==m||t[31]!==o||t[32]!==i?(_=(0,Z.jsx)(zX,{group:n,currentPath:r,containsCurrent:g,worktreeModel:i,flyoutEntries:f,openedWorktreeCount:m,flyoutOpen:a,setFlyoutOpen:o,onPickProject:s,onPickFlyoutEntry:c,guardStaleSelect:l,openNewWorktreeWith:u}),t[21]=g,t[22]=r,t[23]=f,t[24]=a,t[25]=n,t[26]=l,t[27]=c,t[28]=s,t[29]=u,t[30]=m,t[31]=o,t[32]=i,t[33]=_):_=t[33],_}function RX(e){return e.opened&&!e.isMain}function zX(e){let t=(0,$.c)(46),{group:n,currentPath:r,containsCurrent:i,worktreeModel:a,flyoutEntries:o,openedWorktreeCount:s,flyoutOpen:c,setFlyoutOpen:l,onPickProject:u,onPickFlyoutEntry:d,guardStaleSelect:f,openNewWorktreeWith:p}=e,{_:m}=kt(),h=n.project.path===r,g;t[0]!==f||t[1]!==u?(g=e=>{f(e)||u()},t[0]=f,t[1]=u,t[2]=g):g=t[2];let _=g,v,y;t[3]===_?(v=t[4],y=t[5]):(v=e=>{e.target.closest(`[data-project-open]`)!==null&&(e.preventDefault(),_(e.nativeEvent))},y=e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),_(e.nativeEvent))},t[3]=_,t[4]=v,t[5]=y);let b=`project-switcher-group-${n.project.path}`,x=c?`true`:void 0,S=i?`true`:void 0,C;t[6]===n.project.name?C=t[7]:(C=(0,Z.jsx)(`span`,{className:`truncate font-medium text-sm`,"data-project-open":``,title:n.project.name,children:n.project.name}),t[6]=n.project.name,t[7]=C);let w;t[8]===n.project.path?w=t[9]:(w=(0,Z.jsx)(`span`,{className:`truncate text-muted-foreground text-xs`,title:n.project.path,children:n.project.path}),t[8]=n.project.path,t[9]=w);let T;t[10]!==C||t[11]!==w?(T=(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[C,w]}),t[10]=C,t[11]=w,t[12]=T):T=t[12];let E;t[13]!==m||t[14]!==h?(E=h?(0,Z.jsx)($i,{"aria-label":m({id:`Hp1l6f`}),className:`mt-0.5 size-3.5 shrink-0 text-muted-foreground`}):null,t[13]=m,t[14]=h,t[15]=E):E=t[15];let D=`project-switcher-toggle-${n.project.path}`,O;t[16]===s?O=t[17]:(O=(0,Z.jsx)(`span`,{className:`tabular-nums`,children:s}),t[16]=s,t[17]=O);let k;t[18]===s?k=t[19]:(k=(0,Z.jsx)(J,{id:`AKxFtn`,values:{openedWorktreeCount:s}}),t[18]=s,t[19]=k);let A;t[20]!==D||t[21]!==O||t[22]!==k?(A=(0,Z.jsxs)(`span`,{className:`mt-0.5 shrink-0 text-muted-foreground text-xs`,"data-testid":D,children:[O,` `,k]}),t[20]=D,t[21]=O,t[22]=k,t[23]=A):A=t[23];let j;t[24]!==E||t[25]!==A||t[26]!==v||t[27]!==y||t[28]!==b||t[29]!==x||t[30]!==S||t[31]!==T?(j=(0,Z.jsxs)(hc,{onClick:v,onKeyDown:y,className:`flex w-full min-w-0 items-start gap-2`,"data-testid":b,"data-flyout-open":x,"data-current":S,children:[T,E,A]}),t[24]=E,t[25]=A,t[26]=v,t[27]=y,t[28]=b,t[29]=x,t[30]=S,t[31]=T,t[32]=j):j=t[32];let M;t[33]!==o||t[34]!==c||t[35]!==n||t[36]!==f||t[37]!==d||t[38]!==p||t[39]!==a?(M=(0,Z.jsx)(BX,{group:n,open:c,worktreeModel:a,entries:o,onPickFlyoutEntry:d,guardStaleSelect:f,openNewWorktreeWith:p}),t[33]=o,t[34]=c,t[35]=n,t[36]=f,t[37]=d,t[38]=p,t[39]=a,t[40]=M):M=t[40];let N;return t[41]!==c||t[42]!==l||t[43]!==j||t[44]!==M?(N=(0,Z.jsxs)(nc,{open:c,onOpenChange:l,children:[j,M]}),t[41]=c,t[42]=l,t[43]=j,t[44]=M,t[45]=N):N=t[45],N}function BX(e){let t=(0,$.c)(15),{group:n,open:r,worktreeModel:i,entries:a,onPickFlyoutEntry:o,guardStaleSelect:s,openNewWorktreeWith:c}=e,{_:l}=kt(),[u,d]=(0,Q.useState)(``),f=(0,Q.useRef)(null),p=(0,Q.useRef)(null),m,h;t[0]===r?(m=t[1],h=t[2]):(m=()=>{r&&f.current?.focus({preventScroll:!0})},h=[r],t[0]=r,t[1]=m,t[2]=h),(0,Q.useEffect)(m,h);let g=function(){let e=p.current;return e===null?[]:[...e.querySelectorAll(`[role="menuitem"]`)]},_=function(e){g()[e]?.focus()},v=function(e,t){if(e.key===`ArrowDown`){e.preventDefault(),e.stopPropagation();let t=g(),n=t.indexOf(e.currentTarget);_(Math.min(n+1,t.length-1))}else if(e.key===`ArrowUp`){e.preventDefault(),e.stopPropagation();let t=g().indexOf(e.currentTarget);t<=0?f.current?.focus():_(t-1)}else e.key===`Enter`&&(e.preventDefault(),e.stopPropagation(),t())},y;if(t[3]!==a||t[4]!==u){let e=u.trim().toLowerCase();y=e===``?a:a.filter(t=>(t.branch??``).toLowerCase().includes(e)),t[3]=a,t[4]=u,t[5]=y}else y=t[5];let b=y,x=i!==null&&i.mainRoot===n.project.mainRoot,S=u.trim(),C=x&&S.length>0,w;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)($C,{align:`inline-start`,children:(0,Z.jsx)(Te,{"aria-hidden":`true`})}),t[6]=w):w=t[6];let T;t[7]===l?T=t[8]:(T=l({id:`bSD4im`}),t[7]=l,t[8]=T);let E;t[9]===l?E=t[10]:(E=l({id:`Skr_7L`}),t[9]=l,t[10]=E);let D;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(D=e=>d(e.target.value),t[11]=D):D=t[11];let O=b.length===0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(kc,{className:`font-normal text-muted-foreground text-xs`,role:`status`,"aria-live":`polite`,children:l({id:`-uaQnI`})}),C?(0,Z.jsxs)(vc,{onSelect:e=>{s(e)||c(S)},onKeyDown:e=>v(e,()=>c(S)),className:`flex items-center gap-2`,"data-testid":`project-switcher-flyout-create`,children:[(0,Z.jsx)(nt,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm`,title:S,children:(0,Z.jsx)(J,{id:`gHSAWT`,values:{typedName:S},components:{0:(0,Z.jsx)(`span`,{className:`font-medium`}),1:(0,Z.jsx)(`span`,{className:`font-mono`})}})})]}):null]}):b.map(e=>{let t=e.path??`branch:${e.branch}`,n=e.branch??l({id:`D12vtS`});return(0,Z.jsxs)(vc,{onSelect:t=>{s(t)||o(e)},onKeyDown:t=>v(t,()=>o(e)),className:`flex items-center gap-2`,"data-testid":`project-switcher-flyout-entry-${t}`,"data-current":e.isCurrent?`true`:void 0,children:[(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm`,title:n,children:n}),e.isMain?(0,Z.jsx)(`span`,{className:`shrink-0 text-muted-foreground text-xs`,children:l({id:`Bn9-El`})}):e.opened?null:(0,Z.jsx)(`span`,{className:`shrink-0 text-muted-foreground text-xs`,title:l({id:`Dvwa0U`}),children:l({id:`nfoduq`})}),e.isCurrent?(0,Z.jsx)(GX,{}):null]},t)}),k;return t[12]!==p||t[13]!==O?(k=(0,Z.jsx)(`div`,{ref:p,className:`min-h-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-contain subtle-scrollbar`,children:O}),t[12]=p,t[13]=O,t[14]=k):k=t[14],(0,Z.jsx)(jc,{children:(0,Z.jsxs)(Ac,{avoidCollisions:!1,sideOffset:-8,className:`flex max-h-80 w-96 flex-col gap-1 overflow-hidden p-1`,"data-testid":`project-switcher-flyout-${n.project.path}`,children:[(0,Z.jsxs)(ZC,{className:`mb-1 h-8 shrink-0`,children:[w,(0,Z.jsx)(nw,{ref:f,"aria-label":T,placeholder:E,value:u,onChange:D,onKeyDown:e=>{e.key===`ArrowDown`&&(e.preventDefault(),_(0)),e.stopPropagation()},"data-testid":`project-switcher-flyout-search-${n.project.path}`})]}),k]})})}function VX(e){let t=(0,$.c)(41),{recents:n,currentPath:r,query:i,worktreeModel:a,onPickEntry:o,onPickBranch:s,guardStaleSelect:c}=e,{_:l}=kt(),u;t[0]===i?u=t[1]:(u=e=>e.toLowerCase().includes(i),t[0]=i,t[1]=u);let d=u,f,p,m,h;if(t[2]!==l||t[3]!==r||t[4]!==c||t[5]!==d||t[6]!==s||t[7]!==o||t[8]!==n||t[9]!==a){h=Symbol.for(`react.early_return_sentinel`);bb0:{let e;t[14]===d?e=t[15]:(e=e=>!e.isLinkedWorktree&&(d(e.name)||d(e.path)),t[14]=d,t[15]=e);let i=n.filter(e),u;t[16]===d?u=t[17]:(u=e=>e.isLinkedWorktree===!0&&(d(e.branch??``)||d(e.path)),t[16]=d,t[17]=u);let g=n.filter(u),_=new Set(g.map(HX)),v;t[18]===a?.entries?v=t[19]:(v=a?.entries??[],t[18]=a?.entries,t[19]=v);let y=v.filter(e=>e.branch!==null&&d(e.branch)&&(e.worktreePath===null||!_.has(e.worktreePath))&&e.worktreePath!==r);if(i.length===0&&g.length===0&&y.length===0){let e;t[20]===l?e=t[21]:(e=l({id:`pEQFsW`}),t[20]=l,t[21]=e);let n;t[22]===e?n=t[23]:(n=(0,Z.jsx)(kc,{className:`font-normal text-muted-foreground text-xs`,role:`status`,"aria-live":`polite`,children:e}),t[22]=e,t[23]=n),h=n;break bb0}let b;t[24]!==r||t[25]!==c||t[26]!==o?(b=e=>(0,Z.jsx)(vc,{onSelect:t=>{c(t)||o(e)},className:`flex w-full min-w-0 flex-col items-start gap-0.5`,"data-testid":`project-switcher-recent-${e.path}`,children:(0,Z.jsx)(WX,{name:e.name,path:e.path,current:e.path===r})},e.path),t[24]=r,t[25]=c,t[26]=o,t[27]=b):b=t[27],f=i.map(b);let x;t[28]!==r||t[29]!==c||t[30]!==o?(x=e=>(0,Z.jsxs)(vc,{onSelect:t=>{c(t)||o(e)},className:`flex items-start gap-2`,"data-testid":`project-switcher-worktree-${e.path}`,"data-current":e.path===r?`true`:void 0,children:[(0,Z.jsx)(zo,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0`}),(0,Z.jsx)(UX,{branch:e.branch??e.name,project:e.mainRoot===void 0?null:bg(e.mainRoot)})]},e.path),t[28]=r,t[29]=c,t[30]=o,t[31]=x):x=t[31],p=g.map(x);let S;t[32]!==l||t[33]!==c||t[34]!==s||t[35]!==a?(S=e=>(0,Z.jsxs)(vc,{onSelect:t=>{c(t)||e.branch!==null&&s(e.branch)},className:`flex items-start gap-2`,"data-testid":`project-switcher-branch-${e.branch}`,children:[(0,Z.jsx)(zo,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 opacity-40`}),(0,Z.jsx)(UX,{branch:e.branch??``,project:a===null?null:bg(a.mainRoot),hint:l({id:`nfoduq`})})]},`branch:${e.branch}`),t[32]=l,t[33]=c,t[34]=s,t[35]=a,t[36]=S):S=t[36],m=y.map(S)}t[2]=l,t[3]=r,t[4]=c,t[5]=d,t[6]=s,t[7]=o,t[8]=n,t[9]=a,t[10]=f,t[11]=p,t[12]=m,t[13]=h}else f=t[10],p=t[11],m=t[12],h=t[13];if(h!==Symbol.for(`react.early_return_sentinel`))return h;let g;return t[37]!==f||t[38]!==p||t[39]!==m?(g=(0,Z.jsxs)(Z.Fragment,{children:[f,p,m]}),t[37]=f,t[38]=p,t[39]=m,t[40]=g):g=t[40],g}function HX(e){return e.path}function UX(e){let t=(0,$.c)(12),{branch:n,project:r,hint:i}=e,a;t[0]===n?a=t[1]:(a=(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm`,children:n}),t[0]=n,t[1]=a);let o;t[2]===i?o=t[3]:(o=i===void 0?null:(0,Z.jsx)(`span`,{className:`shrink-0 text-muted-foreground text-xs`,children:i}),t[2]=i,t[3]=o);let s;t[4]!==a||t[5]!==o?(s=(0,Z.jsxs)(`span`,{className:`flex w-full min-w-0 items-center gap-1.5`,children:[a,o]}),t[4]=a,t[5]=o,t[6]=s):s=t[6];let c;t[7]===r?c=t[8]:(c=r===null?null:(0,Z.jsx)(`span`,{className:`truncate text-muted-foreground text-xs`,title:r,children:r}),t[7]=r,t[8]=c);let l;return t[9]!==s||t[10]!==c?(l=(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[s,c]}),t[9]=s,t[10]=c,t[11]=l):l=t[11],l}function WX(e){let t=(0,$.c)(15),{name:n,path:r,current:i}=e,a=i&&`font-medium`,o;t[0]===a?o=t[1]:(o=X(`flex w-full items-center gap-1.5`,a),t[0]=a,t[1]=o);let s;t[2]===n?s=t[3]:(s=(0,Z.jsx)(`span`,{className:`truncate font-medium text-sm`,title:n,children:n}),t[2]=n,t[3]=s);let c;t[4]===i?c=t[5]:(c=i?(0,Z.jsx)($i,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}):null,t[4]=i,t[5]=c);let l;t[6]!==o||t[7]!==s||t[8]!==c?(l=(0,Z.jsxs)(`span`,{className:o,children:[s,c]}),t[6]=o,t[7]=s,t[8]=c,t[9]=l):l=t[9];let u;t[10]===r?u=t[11]:(u=(0,Z.jsx)(`span`,{className:`w-full truncate text-muted-foreground text-xs`,title:r,children:r}),t[10]=r,t[11]=u);let d;return t[12]!==l||t[13]!==u?(d=(0,Z.jsxs)(`span`,{className:`flex w-full min-w-0 flex-col gap-0.5`,children:[l,u]}),t[12]=l,t[13]=u,t[14]=d):d=t[14],d}function GX(){let e=(0,$.c)(4),{_:t}=kt(),n;e[0]===t?n=e[1]:(n=t({id:`Hp1l6f`}),e[0]=t,e[1]=n);let r;return e[2]===n?r=e[3]:(r=(0,Z.jsx)($i,{"aria-label":n,className:`size-3.5 shrink-0 text-muted-foreground`}),e[2]=n,e[3]=r),r}var KX=(e,t,n)=>fg(e,t,n,`ProjectSwitcher`),qX=350;function JX(e){let t=(0,$.c)(108),{bridge:n}=e,{_:r}=kt(),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(``),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(``),[g,_]=(0,Q.useState)(null),v=vM(),y=lg(),b=typeof window<`u`&&window.okDesktop!=null,x=(0,Q.useRef)(!1),S=(0,Q.useRef)(!1),C=(0,Q.useRef)(null),w;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(w=e=>{e&&(S.current=!0,C.current!==null&&clearTimeout(C.current),C.current=setTimeout(()=>{S.current=!1},qX)),s(e),e||(l(``),_(null))},t[0]=w):w=t[0];let T=w,E;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(E=e=>!b||!S.current?!1:(e.preventDefault(),!0),t[1]=E):E=t[1];let D=E,O;t[2]!==r||t[3]!==n.project||t[4]!==o?(O=()=>{if(!o)return;let e=!1;return KX(async()=>{let t=await n.project.listRecent();e||a(t)},r({id:`fYKgzG`})),()=>{e=!0}},t[2]=r,t[3]=n.project,t[4]=o,t[5]=O):O=t[5];let k;t[6]!==r||t[7]!==n||t[8]!==o?(k=[o,n,r],t[6]=r,t[7]=n,t[8]=o,t[9]=k):k=t[9],(0,Q.useEffect)(O,k);let A,j;t[10]===n?(A=t[11],j=t[12]):(A=()=>n.onMenuAction(e=>{e===`new-worktree`?(s(!1),_(null),h(``),p(!0)):e===`switch-worktree`&&s(!0)}),j=[n],t[10]=n,t[11]=A,t[12]=j),(0,Q.useEffect)(A,j);let M;t[13]!==r||t[14]!==n.dialog||t[15]!==n.project?(M=()=>{T(!1),KX(async()=>{let e=await n.dialog.openFolder();e&&await n.project.open({path:e,target:`new-window`,entryPoint:`pick-existing`})},r({id:`gmJ0An`}))},t[13]=r,t[14]=n.dialog,t[15]=n.project,t[16]=M):M=t[16];let N=M,P;t[17]!==r||t[18]!==n.navigator?(P=()=>{T(!1),KX(()=>n.navigator.open(),r({id:`jol95m`}))},t[17]=r,t[18]=n.navigator,t[19]=P):P=t[19];let F=P,I;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(I=()=>{T(!1),d(!0)},t[20]=I):I=t[20];let L=I,R;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(R=e=>{T(!1),h(e),p(!0)},t[21]=R):R=t[21];let z=R,B=n.config.projectPath,V;t[22]===c?V=t[23]:(V=c.trim().toLowerCase(),t[22]=c,t[23]=V);let H=V,U=H!==``,W;t[24]===i?W=t[25]:(W=i??[],t[24]=i,t[25]=W);let G=W,K;t[26]!==U||t[27]!==G?(K=U?G.filter(nZ):G,t[26]=U,t[27]=G,t[28]=K):K=t[28];let ee=K,te=U?null:y,ne=v!==null&&`h-auto py-1.5`,re;t[29]===ne?re=t[30]:(re=X(`justify-between text-sidebar-foreground/70 hover:text-sidebar-foreground! data-open:hover:text-sidebar-foreground!`,ne),t[29]=ne,t[30]=re);let ie;t[31]===r?ie=t[32]:(ie=r({id:`zZ_I5K`}),t[31]=r,t[32]=ie);let q;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(q=b?()=>{x.current=!0}:void 0,t[33]=q):q=t[33];let ae;t[34]===o?ae=t[35]:(ae=b?()=>{if(x.current){x.current=!1;return}T(!o)}:void 0,t[34]=o,t[35]=ae);let oe;t[36]===n.config.projectName?oe=t[37]:(oe=(0,Z.jsx)(`span`,{className:`truncate`,children:n.config.projectName}),t[36]=n.config.projectName,t[37]=oe);let se;t[38]===v?se=t[39]:(se=v===null?null:(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1 text-xs text-sidebar-foreground/50 group-hover/menu-button:text-sidebar-foreground`,"data-testid":`project-switcher-branch`,children:[(0,Z.jsx)(zo,{"aria-hidden":`true`,className:`size-3! shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:v})]}),t[38]=v,t[39]=se);let ce;t[40]!==oe||t[41]!==se?(ce=(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[oe,se]}),t[40]=oe,t[41]=se,t[42]=ce):ce=t[42];let le;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,Z.jsx)(jd,{"aria-hidden":`true`,className:`opacity-60`}),t[43]=le):le=t[43];let ue;t[44]!==n.config.projectPath||t[45]!==re||t[46]!==ie||t[47]!==ae||t[48]!==ce?(ue=(0,Z.jsx)(ic,{asChild:!0,children:(0,Z.jsxs)(cM,{className:re,"data-testid":`project-switcher-trigger`,"aria-label":ie,title:n.config.projectPath,onPointerDown:q,onClick:ae,children:[ce,le]})}),t[44]=n.config.projectPath,t[45]=re,t[46]=ie,t[47]=ae,t[48]=ce,t[49]=ue):ue=t[49];let de;t[50]!==r||t[51]!==n||t[52]!==B||t[53]!==g||t[54]!==ee||t[55]!==te||t[56]!==H||t[57]!==i||t[58]!==c?(de=i===null?null:i.length===0?(0,Z.jsx)(kc,{className:`font-normal text-muted-foreground text-xs`,children:(0,Z.jsx)(J,{id:`MUrVEo`})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(ZC,{className:`mb-1 h-8 border-0 shadow-none has-[[data-slot=input-group-control]:focus-visible]:ring-0`,children:[(0,Z.jsx)(nw,{"aria-label":r({id:`blFttG`}),placeholder:r({id:`RVZJWQ`}),value:c,onChange:e=>{e.target.value!==``&&_(null),l(e.target.value)},onKeyDown:tZ,"data-testid":`project-switcher-search`}),(0,Z.jsx)($C,{children:(0,Z.jsx)(Te,{"aria-hidden":`true`})})]}),(0,Z.jsx)(mc,{}),(0,Z.jsx)(`div`,{className:`max-h-64 overflow-x-hidden overflow-y-auto overscroll-contain subtle-scrollbar scroll-fade-mask`,"data-testid":`project-switcher-scroll`,onScroll:()=>{g!==null&&_(null)},children:(0,Z.jsx)(IX,{bridge:n,recents:ee,currentPath:B,query:H,worktreeModel:te,closeMenu:()=>T(!1),guardStaleSelect:D,flyoutPath:g,setFlyoutPath:_,openNewWorktreeWith:z})})]}),t[50]=r,t[51]=n,t[52]=B,t[53]=g,t[54]=ee,t[55]=te,t[56]=H,t[57]=i,t[58]=c,t[59]=de):de=t[59];let fe;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(fe=(0,Z.jsx)(mc,{}),t[60]=fe):fe=t[60];let pe;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(pe=e=>{D(e)||L()},t[61]=pe):pe=t[61];let me;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,Z.jsxs)(vc,{onSelect:pe,"data-testid":`project-switcher-new-project`,children:[(0,Z.jsx)(nt,{"aria-hidden":`true`,className:`text-muted-foreground`}),(0,Z.jsx)(J,{id:`gKi-a_`})]}),t[62]=me):me=t[62];let he;t[63]===F?he=t[64]:(he=e=>{D(e)||F()},t[63]=F,t[64]=he);let ge,_e;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,Z.jsx)(ye,{"aria-hidden":`true`,className:`text-muted-foreground`}),_e=(0,Z.jsx)(J,{id:`xaDWAI`}),t[65]=ge,t[66]=_e):(ge=t[65],_e=t[66]);let ve;t[67]===he?ve=t[68]:(ve=(0,Z.jsxs)(vc,{onSelect:he,"data-testid":`project-switcher-switch-project`,children:[ge,_e]}),t[67]=he,t[68]=ve);let be;t[69]===N?be=t[70]:(be=e=>{D(e)||N()},t[69]=N,t[70]=be);let xe,Se;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(xe=(0,Z.jsx)(Ro,{"aria-hidden":`true`,className:`text-muted-foreground`}),Se=(0,Z.jsx)(J,{id:`PVUn_c`}),t[71]=xe,t[72]=Se):(xe=t[71],Se=t[72]);let Ce;t[73]===be?Ce=t[74]:(Ce=(0,Z.jsxs)(vc,{onSelect:be,"data-testid":`project-switcher-open-folder`,children:[xe,Se]}),t[73]=be,t[74]=Ce);let we;t[75]===v?we=t[76]:(we=v===null?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(mc,{}),(0,Z.jsxs)(vc,{onSelect:e=>{D(e)||(T(!1),h(``),p(!0))},"data-testid":`project-switcher-new-worktree`,children:[(0,Z.jsx)(zo,{"aria-hidden":`true`,className:`text-muted-foreground`}),(0,Z.jsx)(J,{id:`DXd9LM`})]})]}),t[75]=v,t[76]=we);let Ee;t[77]!==de||t[78]!==ve||t[79]!==Ce||t[80]!==we?(Ee=(0,Z.jsxs)(bc,{align:`start`,side:`top`,className:`min-w-[260px]`,"data-testid":`project-switcher-menu`,children:[de,fe,me,ve,Ce,we]}),t[77]=de,t[78]=ve,t[79]=Ce,t[80]=we,t[81]=Ee):Ee=t[81];let De;t[82]!==o||t[83]!==ue||t[84]!==Ee?(De=(0,Z.jsxs)(Ec,{open:o,onOpenChange:T,modal:!1,children:[ue,Ee]}),t[82]=o,t[83]=ue,t[84]=Ee,t[85]=De):De=t[85];let Oe;t[86]!==n||t[87]!==u?(Oe=(0,Z.jsx)(_m,{open:u,onOpenChange:d,bridge:n}),t[86]=n,t[87]=u,t[88]=Oe):Oe=t[88];let ke;t[89]===y?.entries?ke=t[90]:(ke=y?.entries.map(eZ).filter($X),t[89]=y?.entries,t[90]=ke);let Ae;t[91]===y?.entries?Ae=t[92]:(Ae=new Set(y?.entries.filter(QX).map(ZX)),t[91]=y?.entries,t[92]=Ae);let je=y?.remoteBranches,Me;t[93]===y?.entries?Me=t[94]:(Me=new Map(y?.entries.filter(XX).map(YX)),t[93]=y?.entries,t[94]=Me);let Ne;t[95]!==v||t[96]!==n||t[97]!==m||t[98]!==f||t[99]!==ke||t[100]!==Ae||t[101]!==je||t[102]!==Me?(Ne=(0,Z.jsx)(AX,{open:f,onOpenChange:p,bridge:n,currentBranch:v,initialBranchName:m,branches:ke,existingWorktreeBranches:Ae,remoteBranches:je,behindByBranch:Me}),t[95]=v,t[96]=n,t[97]=m,t[98]=f,t[99]=ke,t[100]=Ae,t[101]=je,t[102]=Me,t[103]=Ne):Ne=t[103];let Pe;return t[104]!==De||t[105]!==Oe||t[106]!==Ne?(Pe=(0,Z.jsxs)(Z.Fragment,{children:[De,Oe,Ne]}),t[104]=De,t[105]=Oe,t[106]=Ne,t[107]=Pe):Pe=t[107],Pe}function YX(e){return[e.branch,e.behind]}function XX(e){return e.branch!==null&&e.behind!==void 0}function ZX(e){return e.branch}function QX(e){return e.branch!==null&&e.worktreePath!==null}function $X(e){return e!==null}function eZ(e){return e.branch}function tZ(e){return e.stopPropagation()}function nZ(e){return!e.isLinkedWorktree}function rZ(e,t){let n=e instanceof Error?e:Error(String(e));console.warn(JSON.stringify({event:`jsx-render-failure`,component:`sidebarSearchPill`,rawComponentName:`sidebarSearchPill`,error:String(n),stack:t.componentStack})),Sn(`sidebarSearchPill`)}function iZ(e){let t=(0,$.c)(8),{onClick:n,className:r}=e,i;t[0]===r?i=t[1]:(i=X(`rounded-lg h-9 w-full justify-start gap-2 px-3 font-normal text-muted-foreground`,r),t[0]=r,t[1]=i);let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(Te,{"aria-hidden":`true`}),t[2]=a):a=t[2];let o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(`span`,{className:`flex-1 text-left text-sm`,children:(0,Z.jsx)(J,{id:`A1taO8`})}),t[3]=o):o=t[3];let s;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(M,{className:`text-foreground/70`,children:Al(`command-palette`)}),t[4]=s):s=t[4];let c;return t[5]!==n||t[6]!==i?(c=(0,Z.jsxs)(Jr,{variant:`outline`,onClick:n,"data-telemetry-event":`ok.sidebar.search_pill.click`,className:i,children:[a,o,s]}),t[5]=n,t[6]=i,t[7]=c):c=t[7],c}function aZ(){let e=(0,$.c)(31),{_:t}=kt(),n=_a(),{activeDocName:r}=Ye(),[i,a]=(0,Q.useState)(!1),o=Ca(),s;e[0]!==n.data||e[1]!==n.status?(s=n.status===`ready`?n.data:[],e[0]=n.data,e[1]=n.status,e[2]=s):s=e[2];let c=s,l;e[3]===c?l=e[4]:(l=No(c),e[3]=c,e[4]=l);let u=l,d=Fo(),f;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(f={},e[5]=f):f=e[5];let[p,m]=(0,Q.useState)(f),h;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(nM,{asChild:!0,children:(0,Z.jsxs)(js,{className:`flex w-full items-center gap-1.5`,children:[(0,Z.jsx)(Zd,{className:`size-3.5 shrink-0`}),(0,Z.jsx)(J,{id:`PCSkw2`}),(0,Z.jsx)(na,{className:`size-3.5 shrink-0 text-muted-foreground transition-transform group-data-[state=open]/skills:rotate-90`})]})}),e[6]=h):h=e[6];let g;e[7]===t?g=e[8]:(g=t({id:`MdpSC1`}),e[7]=t,e[8]=g);let _,v;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(_=()=>a(!0),v=(0,Z.jsx)(nt,{}),e[9]=_,e[10]=v):(_=e[9],v=e[10]);let y;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`MdpSC1`})}),e[11]=y):y=e[11];let b;e[12]===g?b=e[13]:(b=(0,Z.jsxs)(rM,{title:g,onClick:_,children:[v,y]}),e[12]=g,e[13]=b);let x;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(fZ,{}),e[14]=x):x=e[14];let S;e[15]!==o||e[16]!==r||e[17]!==u||e[18]!==p||e[19]!==d||e[20]!==c?(S=c.length===0?(0,Z.jsx)(`p`,{className:`px-2 py-1 text-xs text-muted-foreground`,children:(0,Z.jsx)(J,{id:`PdJZ5p`})}):Ao.filter(e=>c.some(t=>t.scope===e)).map(e=>(0,Z.jsxs)(Ms,{className:`group/scope`,open:c.some(t=>t.scope===e&&Rn(t.scope,t.name)===r)||(p[e]??!1),onOpenChange:t=>m(n=>({...n,[e]:t})),children:[(0,Z.jsxs)(js,{className:`flex w-full items-center gap-1 px-2 pt-1 pb-0.5 text-[11px] text-muted-foreground/70 hover:text-muted-foreground`,children:[(0,Z.jsx)(na,{className:`size-3 shrink-0 transition-transform group-data-[state=open]/scope:rotate-90`}),(0,Z.jsx)(`span`,{className:`truncate`,children:d[e]})]}),(0,Z.jsx)(As,{children:(0,Z.jsx)(aM,{className:`pl-2`,children:c.filter(t=>t.scope===e).map(e=>(0,Z.jsx)(sZ,{skill:e,activeDocName:r,actions:o,existingNames:u[e.scope]},`${e.scope}::${e.name}`))})})]},e)),e[15]=o,e[16]=r,e[17]=u,e[18]=p,e[19]=d,e[20]=c,e[21]=S):S=e[21];let C;e[22]===S?C=e[23]:(C=(0,Z.jsx)(As,{children:(0,Z.jsxs)(iM,{children:[x,S]})}),e[22]=S,e[23]=C);let w;e[24]===i?w=e[25]:(w=(0,Z.jsx)(co,{defaultScope:`project`,open:i,onOpenChange:a,onCreated:oZ}),e[24]=i,e[25]=w);let T;return e[26]!==o.dialogs||e[27]!==C||e[28]!==w||e[29]!==b?(T=(0,Z.jsx)(Ms,{className:`group/skills shrink-0`,children:(0,Z.jsxs)(tM,{className:`px-0`,children:[h,b,C,o.dialogs,w]})}),e[26]=o.dialogs,e[27]=C,e[28]=w,e[29]=b,e[30]=T):T=e[30],T}function oZ(e){let{scope:t,name:n}=e;return Zo(Rn(t,n))}function sZ(e){let t=(0,$.c)(50),{skill:n,activeDocName:r,actions:i,existingNames:a}=e,{_:o}=kt(),[s,c]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)(!1),d;t[0]!==n.name||t[1]!==n.scope?(d=Rn(n.scope,n.name),t[0]=n.name,t[1]=n.scope,t[2]=d):d=t[2];let f=r===d,p,m,h;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=e=>{e.preventDefault(),u(!0)},m=(0,Z.jsx)(na,{className:`size-3 shrink-0 text-muted-foreground transition-transform group-data-[state=open]/skill:rotate-90`}),h=(0,Z.jsx)(Zd,{className:`size-3 shrink-0 text-muted-foreground`}),t[3]=p,t[4]=m,t[5]=h):(p=t[3],m=t[4],h=t[5]);let g=n.name,_;t[6]===n.name?_=t[7]:(_=Do(n.name),t[6]=n.name,t[7]=_);let v;t[8]!==n.name||t[9]!==_?(v=(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:g,children:_}),t[8]=n.name,t[9]=_,t[10]=v):v=t[10];let y;t[11]!==o||t[12]!==n.bundledVersion||t[13]!==n.updateAvailable?(y=n.updateAvailable?(0,Z.jsx)(`span`,{title:o({id:`1YJ4Yg`,values:{0:n.bundledVersion?` (${n.bundledVersion})`:``}}),className:`flex items-center`,children:(0,Z.jsx)(is,{className:`size-3 text-primary`,"aria-label":o({id:`CifUuG`})})}):null,t[11]=o,t[12]=n.bundledVersion,t[13]=n.updateAvailable,t[14]=y):y=t[14];let b;t[15]===n.installed?b=t[16]:(b=(0,Z.jsx)(no,{installed:n.installed,subtle:!0,className:`shrink-0`}),t[15]=n.installed,t[16]=b);let x;t[17]!==y||t[18]!==b?(x=(0,Z.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1`,children:[y,b]}),t[17]=y,t[18]=b,t[19]=x):x=t[19];let S;t[20]!==f||t[21]!==x||t[22]!==v?(S=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsxs)(cM,{size:`sm`,isActive:f,className:`h-6 text-[11px]`,onContextMenu:p,children:[m,h,v,x]})}),t[20]=f,t[21]=x,t[22]=v,t[23]=S):S=t[23];let C;t[24]!==o||t[25]!==n.name?(C=o({id:`RlLl3G`,values:{0:n.name}}),t[24]=o,t[25]=n.name,t[26]=C):C=t[26];let w;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(zd,{}),t[27]=w):w=t[27];let T;t[28]===C?T=t[29]:(T=(0,Z.jsx)(ic,{asChild:!0,children:(0,Z.jsx)(lM,{showOnHover:!0,"aria-label":C,children:w})}),t[28]=C,t[29]=T);let E;t[30]!==i||t[31]!==a||t[32]!==n?(E=(0,Z.jsx)(bc,{side:`right`,align:`start`,className:`min-w-52`,children:(0,Z.jsx)(ba,{skill:n,actions:i,existingNames:a})}),t[30]=i,t[31]=a,t[32]=n,t[33]=E):E=t[33];let D;t[34]!==l||t[35]!==T||t[36]!==E?(D=(0,Z.jsxs)(Ec,{open:l,onOpenChange:u,children:[T,E]}),t[34]=l,t[35]=T,t[36]=E,t[37]=D):D=t[37];let O;t[38]!==s||t[39]!==n?(O=s?(0,Z.jsx)(uZ,{skill:n}):null,t[38]=s,t[39]=n,t[40]=O):O=t[40];let k;t[41]===O?k=t[42]:(k=(0,Z.jsx)(As,{children:O}),t[41]=O,t[42]=k);let A;t[43]!==S||t[44]!==D||t[45]!==k?(A=(0,Z.jsxs)(oM,{children:[S,D,k]}),t[43]=S,t[44]=D,t[45]=k,t[46]=A):A=t[46];let j;return t[47]!==s||t[48]!==A?(j=(0,Z.jsx)(Ms,{open:s,onOpenChange:c,className:`group/skill`,children:A}),t[47]=s,t[48]=A,t[49]=j):j=t[49],j}function cZ(e){let t=[];for(let n of e){let e=n.path.split(`/`),r=t;e.forEach((t,i)=>{let a=i===e.length-1,o=r.find(e=>e.name===t);o||(o=a?{name:t,path:n.path,text:n.text}:{name:t,path:e.slice(0,i+1).join(`/`),children:[]},r.push(o)),!a&&o.children&&(r=o.children)})}return lZ(t),t}function lZ(e){e.sort((e,t)=>{let n=+!e.children,r=+!t.children;return n===r?e.name.localeCompare(t.name):n-r});for(let t of e)t.children&&lZ(t.children)}function uZ(e){let t=(0,$.c)(27),{skill:n}=e,{_:r}=kt(),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(!1),{openTarget:c}=Ye(),l;t[0]===c?l=t[1]:(l=function(e){c({kind:`doc`,target:e,docName:e},{tabBehavior:`append`}),yl(El(e))},t[0]=c,t[1]=l);let u=l,d;t[2]!==u||t[3]!==c||t[4]!==n.name||t[5]!==n.scope?(d=function(e){let t=e.lastIndexOf(`.`),r=t>=0?e.slice(t+1).toLowerCase():``;if(n.scope===`project`&&(r===`md`||r===`mdx`)){u(Ke(n.name,e.replace(/\.mdx?$/i,``)));return}c({kind:`skill-file`,target:`${n.scope}/${n.name}/${e}`,scope:n.scope,name:n.name,path:e},{tabBehavior:`replace-active`}),yl(Sl({scope:n.scope,name:n.name,path:e}))},t[2]=u,t[3]=c,t[4]=n.name,t[5]=n.scope,t[6]=d):d=t[6];let f=d,p,m;t[7]!==n.name||t[8]!==n.scope?(p=()=>{let e=!0,t=()=>{Dc(n.scope,n.name).then(t=>{e&&(t.ok?(a(t.files),s(!1)):(a([]),s(!0)))})};t();let r=pl(t);return()=>{e=!1,r()}},m=[n.scope,n.name],t[7]=n.name,t[8]=n.scope,t[9]=p,t[10]=m):(p=t[9],m=t[10]),(0,Q.useEffect)(p,m);let h;if(t[11]!==r||t[12]!==i||t[13]!==o||t[14]!==f||t[15]!==u||t[16]!==n.name||t[17]!==n.scope){let e=i?cZ(i):[],a;t[19]!==u||t[20]!==n.name||t[21]!==n.scope?(a=()=>n.scope===`project`?u(Sr(n.name)):Zo(Rn(n.scope,n.name)),t[19]=u,t[20]=n.name,t[21]=n.scope,t[22]=a):a=t[22];let s,c;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(Di,{className:`size-3 shrink-0 text-muted-foreground`}),c=(0,Z.jsx)(`span`,{className:`truncate`,children:`SKILL.md`}),t[23]=s,t[24]=c):(s=t[23],c=t[24]);let l;t[25]===a?l=t[26]:(l=(0,Z.jsx)(dM,{children:(0,Z.jsxs)(fM,{size:`sm`,onClick:a,className:`text-[11px]`,children:[s,c]})}),t[25]=a,t[26]=l),h=(0,Z.jsxs)(uM,{className:`mr-0 pr-0`,children:[l,i===null?(0,Z.jsx)(dM,{children:(0,Z.jsx)(`span`,{className:`px-2 py-0.5 text-[11px] text-muted-foreground/70`,children:(0,Z.jsx)(J,{id:`yQE2r9`})})}):o?(0,Z.jsx)(dM,{children:(0,Z.jsx)(`span`,{className:`px-2 py-0.5 text-[11px] text-muted-foreground/70`,title:r({id:`3Ijjy1`}),children:(0,Z.jsx)(J,{id:`ZARuZJ`})})}):e.map(e=>(0,Z.jsx)(dZ,{node:e,depth:0,onOpenFile:f},e.path))]}),t[11]=r,t[12]=i,t[13]=o,t[14]=f,t[15]=u,t[16]=n.name,t[17]=n.scope,t[18]=h}else h=t[18];return h}function dZ(e){let t=(0,$.c)(34),{node:n,depth:r,onOpenFile:i}=e,[a,o]=(0,Q.useState)(!1),s=`${r*.6}rem`,c;t[0]===s?c=t[1]:(c={paddingLeft:s},t[0]=s,t[1]=c);let l=c;if(n.children){let e;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(na,{className:`size-3 shrink-0 text-muted-foreground transition-transform group-data-[state=open]/dir:rotate-90`}),t[2]=e):e=t[2];let s;t[3]===n.name?s=t[4]:(s=(0,Z.jsxs)(`span`,{className:`truncate`,children:[n.name,`/`]}),t[3]=n.name,t[4]=s);let c;t[5]!==l||t[6]!==s?(c=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsxs)(fM,{size:`sm`,className:`text-[11px]`,style:l,children:[e,s]})}),t[5]=l,t[6]=s,t[7]=c):c=t[7];let u;if(t[8]!==r||t[9]!==n.children||t[10]!==i){let e;t[12]!==r||t[13]!==i?(e=e=>(0,Z.jsx)(dZ,{node:e,depth:r+1,onOpenFile:i},e.path),t[12]=r,t[13]=i,t[14]=e):e=t[14],u=n.children.map(e),t[8]=r,t[9]=n.children,t[10]=i,t[11]=u}else u=t[11];let d;t[15]===u?d=t[16]:(d=(0,Z.jsx)(As,{children:u}),t[15]=u,t[16]=d);let f;t[17]!==c||t[18]!==d?(f=(0,Z.jsxs)(dM,{children:[c,d]}),t[17]=c,t[18]=d,t[19]=f):f=t[19];let p;return t[20]!==a||t[21]!==f?(p=(0,Z.jsx)(Ms,{open:a,onOpenChange:o,className:`group/dir`,children:f}),t[20]=a,t[21]=f,t[22]=p):p=t[22],p}let u=`skill-file-${n.path}`,d;t[23]!==n.path||t[24]!==i?(d=()=>i(n.path),t[23]=n.path,t[24]=i,t[25]=d):d=t[25];let f;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(Hd,{className:`size-3 shrink-0 text-muted-foreground`}),t[26]=f):f=t[26];let p;t[27]===n.name?p=t[28]:(p=(0,Z.jsx)(`span`,{className:`truncate`,children:n.name}),t[27]=n.name,t[28]=p);let m;return t[29]!==l||t[30]!==u||t[31]!==d||t[32]!==p?(m=(0,Z.jsx)(dM,{children:(0,Z.jsxs)(fM,{size:`sm`,className:`text-[11px]`,style:l,"data-testid":u,onClick:d,children:[f,p]})}),t[29]=l,t[30]=u,t[31]=d,t[32]=p,t[33]=m):m=t[33],m}function fZ(){let e=(0,$.c)(19),[t,n]=(0,Q.useState)(null),[r,i]=(0,Q.useState)(!1),a,o;if(e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>{let e=!1;return xc().then(t=>{e||n(t)}),()=>{e=!0}},o=[],e[0]=a,e[1]=o):(a=e[0],o=e[1]),(0,Q.useEffect)(a,o),!t||t.managed!==null||t.importable===0)return null;let s;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=async e=>{if(i(!0),!await Oc(e)){i(!1);return}n({managed:e,importable:0})},e[2]=s):s=e[2];let c=s,l;e[3]===t.importable?l=e[4]:(l=(0,Z.jsx)(`p`,{className:`mb-2 text-muted-foreground`,children:(0,Z.jsx)(J,{id:`mu1O0q`,values:{0:t.importable}})}),e[3]=t.importable,e[4]=l);let u,d;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>c(!0),d=(0,Z.jsx)(J,{id:`l3s5ri`}),e[5]=u,e[6]=d):(u=e[5],d=e[6]);let f;e[7]===r?f=e[8]:(f=(0,Z.jsx)(Jr,{size:`sm`,className:`h-6 px-2 text-xs`,disabled:r,onClick:u,children:d}),e[7]=r,e[8]=f);let p,m;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(p=()=>c(!1),m=(0,Z.jsx)(J,{id:`PBxg_E`}),e[9]=p,e[10]=m):(p=e[9],m=e[10]);let h;e[11]===r?h=e[12]:(h=(0,Z.jsx)(Jr,{size:`sm`,variant:`ghost`,className:`h-6 px-2 text-xs`,disabled:r,onClick:p,children:m}),e[11]=r,e[12]=h);let g;e[13]!==f||e[14]!==h?(g=(0,Z.jsxs)(`div`,{className:`flex gap-1.5`,children:[f,h]}),e[13]=f,e[14]=h,e[15]=g):g=e[15];let _;return e[16]!==g||e[17]!==l?(_=(0,Z.jsxs)(`div`,{className:`mx-2 mb-1 rounded-md border border-border/60 bg-muted/40 p-2 text-xs`,children:[l,g]}),e[16]=g,e[17]=l,e[18]=_):_=e[18],_}var pZ=`Relaunch`,mZ=`Release notes`,hZ=`Updates paused`,gZ=`Download`,_Z=`Reset to defaults`,vZ=`Relaunching to install the update…`,yZ=`Relaunch failed — please restart manually`;function bZ(e){return`Update to ${e} didn't install.`}var xZ=`Retry`,SZ=`Download manually`,CZ=`Recovery action failed — please try again`;function wZ(e,t){let n=t instanceof Error&&t.message?t.message:``;return n?`${e}: ${n}`:e}function TZ(e){return`Version ${e} ready to install`}function EZ(e){return`Updated to Version ${e}`}function DZ(e){return`Your settings and recent projects were saved by a newer build than this one (v${e}). Reset to defaults to continue.`}var OZ=0,kZ=0,AZ=1,jZ=2,MZ=3,NZ=6e4;function PZ(e,t,n=()=>{},r=NZ,i={isEligible:()=>!1,onShown:()=>{}}){let a=[],o=new Set,s=`update-downloaded`;return a.push(e.onUpdateDownloaded(({version:r})=>{let i=s,a=()=>{t({id:i,body:TZ(r),priority:jZ,action:{label:pZ,onClick:()=>{t({id:i,body:vZ,priority:jZ,dismissible:!1}),e.update.relaunchNow().then(()=>{n(i)},e=>{a(),t({id:`relaunch-error-${r}`,body:wZ(yZ,e),variant:`error`,priority:AZ})})}}})};a()})),a.push(e.onUpdateRelaunching(()=>{t({id:s,body:vZ,priority:jZ,dismissible:!1})})),a.push(e.onUpdateRelaunchFailed(({version:r,message:i,downloadUrl:a})=>{if(a){let i=`install-failed-${r}`,o=()=>{t({id:i,body:bZ(r),variant:`error`,priority:AZ,action:{label:xZ,onClick:()=>{e.update.relaunchNow().then(()=>{n(i)},e=>{console.warn(`[update-notice] install-failed retry rejected`,e),o()})}},secondaryAction:{label:SZ,onClick:()=>{e.shell.openExternal(a)}}})};o();return}t({id:`relaunch-error-${r}`,body:i?`${yZ}: ${i}`:yZ,variant:`error`,priority:AZ})})),a.push(e.onWhatsNew(({version:a,releaseUrl:s})=>{if(i.isEligible(a)){i.onShown(a),t({id:`whats-new-combined-${a}`,body:EZ(a),variant:`success`,priority:MZ,combinedSubscribe:!0,whatsNew:{version:a,releaseUrl:s},action:{label:mZ,onClick:()=>{e.shell.openExternal(s)}}}),e.update.dismissWhatsNew(a);return}let c=`whats-new-${a}`;t({id:c,body:EZ(a),variant:`success`,priority:MZ,action:{label:mZ,onClick:()=>{e.shell.openExternal(s)}},onDismiss:()=>{e.update.dismissWhatsNew(a)}});let l=setTimeout(()=>{o.delete(l),n(c),e.update.dismissWhatsNew(a)},r);o.add(l)})),a.push(e.onWhatsNewDismissed(({version:e})=>{n(`whats-new-${e}`)})),a.push(e.onUpdateStuckHint(({downloadUrl:n})=>{t({id:`update-stuck-hint`,body:hZ,priority:kZ,action:{label:gZ,onClick:()=>{e.shell.openExternal(n)}}})})),()=>{for(let e of a)e();for(let e of o)clearTimeout(e);o.clear()}}function FZ(e,t,n,r=()=>{}){let i=`schema-incompatibility-${t.persistedSchemaVersion}`,a=`schema-incompatibility-error-${t.persistedSchemaVersion}`,o=e=>{r(i),n({id:a,body:wZ(CZ,e),variant:`error`,priority:OZ})};n({id:i,body:DZ(t.currentBuild),priority:OZ,action:{label:_Z,onClick:()=>{e.state.resetIncompatible().then(()=>{r(i)},o)}}})}var IZ=[],LZ=new Set,RZ=!1;function zZ(){for(let e of LZ)e()}function BZ(e){let t=IZ.findIndex(t=>t.id===e.id);if(t===-1)IZ=[...IZ,e];else{let n=IZ.slice();n[t]=e,IZ=n}zZ()}function VZ(e){let t=IZ.filter(t=>t.id!==e);t.length!==IZ.length&&(IZ=t,zZ())}function HZ(){return IZ}function UZ(e){return LZ.add(e),()=>{LZ.delete(e)}}function WZ(){if(RZ||typeof window>`u`)return;let e=window.okDesktop;e&&(RZ=!0,PZ(e,BZ,VZ,void 0,{isEligible:e=>yF(EF.getSnapshot(),e),onShown:e=>EF.recordShown(e)}),e.state.query().then(t=>{t.schemaIncompatibility&&FZ(e,t.schemaIncompatibility,BZ,VZ)},e=>{console.warn(`[update-notices-store] bridge.state.query() failed`,e)}))}var GZ=6e4,KZ=e=>{let t=(0,$.c)(11),{href:n,label:r,icon:i}=e,a,o;t[0]===n?(a=t[1],o=t[2]):(a=e=>hu(e,n),o=e=>hu(e,n),t[0]=n,t[1]=a,t[2]=o);let s;t[3]===i?s=t[4]:(s=(0,Z.jsx)(i,{"aria-hidden":`true`,className:`size-3.5`}),t[3]=i,t[4]=s);let c;return t[5]!==n||t[6]!==r||t[7]!==a||t[8]!==o||t[9]!==s?(c=(0,Z.jsx)(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,onClick:a,onAuxClick:o,"aria-label":r,className:`rounded-md p-1 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,children:s}),t[5]=n,t[6]=r,t[7]=a,t[8]=o,t[9]=s,t[10]=c):c=t[10],c};function qZ(e){let t=(0,$.c)(34),{version:n,onOpenReleaseNotes:r,onClose:i,store:a,autoDismissMs:o}=e,s=a===void 0?EF:a,c=o===void 0?GZ:o,{_:l}=kt(),[u,d]=(0,Q.useState)(!1),f,p;t[0]!==c||t[1]!==i||t[2]!==u?(f=()=>{if(!u)return;let e=setTimeout(i,c);return()=>clearTimeout(e)},p=[u,i,c],t[0]=c,t[1]=i,t[2]=u,t[3]=f,t[4]=p):(f=t[3],p=t[4]),(0,Q.useEffect)(f,p);let m;t[5]===l?m=t[6]:(m=l({id:`GzPQ2f`}),t[5]=l,t[6]=m);let h;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(J,{id:`yLEyuq`}),t[7]=h):h=t[7];let g;t[8]===s?g=t[9]:(g=()=>{s.markSubscribed(),d(!0)},t[8]=s,t[9]=g);let _;t[10]!==i||t[11]!==s?(_=()=>{s.dismiss(),i()},t[10]=i,t[11]=s,t[12]=_):_=t[12];let v;t[13]!==g||t[14]!==_?(v=(0,Z.jsx)(pF,{source:`post_update_card`,compactSubmit:!0,description:h,onSuccess:g,onDismiss:_}),t[13]=g,t[14]=_,t[15]=v):v=t[15];let y;t[16]!==l||t[17]!==u?(y=u?null:(0,Z.jsxs)(`nav`,{"aria-label":l({id:`dbapvC`}),className:`mt-3 flex items-center gap-1.5 text-muted-foreground text-xs`,children:[(0,Z.jsx)(`span`,{className:`mr-0.5`,children:(0,Z.jsx)(J,{id:`9sBe85`})}),(0,Z.jsx)(KZ,{href:gF,label:l({id:`I7Exsw`}),icon:AF}),(0,Z.jsx)(KZ,{href:mF,label:l({id:`zyKa-I`}),icon:kF}),(0,Z.jsx)(KZ,{href:hF,label:l({id:`36aWJD`}),icon:OF})]}),t[16]=l,t[17]=u,t[18]=y):y=t[18];let b;t[19]!==y||t[20]!==v?(b=(0,Z.jsxs)(`div`,{className:`px-3 py-2.5`,children:[v,y]}),t[19]=y,t[20]=v,t[21]=b):b=t[21];let x;t[22]===n?x=t[23]:(x=(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(J,{id:`hLy8b1`,values:{version:n}})}),t[22]=n,t[23]=x);let S;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(J,{id:`_PACVa`}),t[24]=S):S=t[24];let C;t[25]===r?C=t[26]:(C=(0,Z.jsx)(Jr,{variant:`link`,size:`sm`,className:`h-auto p-0 text-muted-foreground text-xs hover:text-foreground`,onClick:r,children:S}),t[25]=r,t[26]=C);let w;t[27]!==x||t[28]!==C?(w=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between border-t bg-muted/30 px-3 py-2.5 space-x-2`,children:[x,C]}),t[27]=x,t[28]=C,t[29]=w):w=t[29];let T;return t[30]!==b||t[31]!==w||t[32]!==m?(T=(0,Z.jsxs)(`section`,{"aria-label":m,className:`mx-1 mb-1 overflow-hidden rounded-lg border bg-card text-card-foreground`,children:[b,w]}),t[30]=b,t[31]=w,t[32]=m,t[33]=T):T=t[33],T}function JZ(e){let t=(0,$.c)(37),{notice:n,onDismiss:r}=e,{_:i}=kt(),a=n.variant===`error`?`border-destructive/60 bg-sidebar-accent/30 text-muted-foreground`:n.variant===`success`?`border-emerald-500/40 bg-emerald-500/10 text-emerald-600 dark:text-emerald-400`:`border-sidebar-border bg-sidebar-accent/30 text-muted-foreground`,o;t[0]!==i||t[1]!==n.dismissible||t[2]!==r?(o=n.dismissible===!1?null:(0,Z.jsx)(Jr,{variant:`ghost`,size:`icon`,className:`size-5 shrink-0 text-muted-foreground hover:text-sidebar-foreground`,"aria-label":i({id:`GUYwCr`}),onClick:r,children:(0,Z.jsx)(gs,{"aria-hidden":`true`,className:`size-3`})}),t[0]=i,t[1]=n.dismissible,t[2]=r,t[3]=o):o=t[3];let s=o,c=`shrink-0 text-xs font-medium underline underline-offset-2 ${n.variant===`success`?`decoration-emerald-500/40`:`decoration-muted-foreground/40`} hover:text-sidebar-foreground hover:decoration-sidebar-foreground`;if(n.secondaryAction){let e=`update-notice-${n.id}`,r=`flex flex-col gap-2 rounded-md border px-2 py-2 text-xs ${a}`,i;t[4]===n.body?i=t[5]:(i=(0,Z.jsx)(`span`,{className:`flex-1 leading-snug`,children:n.body}),t[4]=n.body,t[5]=i);let o;t[6]!==s||t[7]!==i?(o=(0,Z.jsxs)(`div`,{className:`flex items-start gap-2`,children:[i,s]}),t[6]=s,t[7]=i,t[8]=o):o=t[8];let l;t[9]!==c||t[10]!==n.action?(l=n.action?(0,Z.jsx)(`button`,{type:`button`,className:c,onClick:()=>{n.action?.onClick()},children:n.action.label}):null,t[9]=c,t[10]=n.action,t[11]=l):l=t[11];let u;t[12]===n.secondaryAction?u=t[13]:(u=()=>{n.secondaryAction?.onClick()},t[12]=n.secondaryAction,t[13]=u);let d;t[14]!==c||t[15]!==n.secondaryAction.label||t[16]!==u?(d=(0,Z.jsx)(`button`,{type:`button`,className:c,onClick:u,children:n.secondaryAction.label}),t[14]=c,t[15]=n.secondaryAction.label,t[16]=u,t[17]=d):d=t[17];let f;t[18]!==l||t[19]!==d?(f=(0,Z.jsxs)(`div`,{className:`flex gap-3 pl-1`,children:[l,d]}),t[18]=l,t[19]=d,t[20]=f):f=t[20];let p;return t[21]!==e||t[22]!==r||t[23]!==o||t[24]!==f?(p=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":e,className:r,children:[o,f]}),t[21]=e,t[22]=r,t[23]=o,t[24]=f,t[25]=p):p=t[25],p}let l=`update-notice-${n.id}`,u=`flex items-center gap-2 rounded-md border px-2 py-1.5 text-xs ${a}`,d;t[26]===n.body?d=t[27]:(d=(0,Z.jsx)(`span`,{className:`flex-1 leading-snug`,children:n.body}),t[26]=n.body,t[27]=d);let f;t[28]!==c||t[29]!==n.action?(f=n.action?(0,Z.jsx)(`button`,{type:`button`,className:c,onClick:()=>{n.action?.onClick()},children:n.action.label}):null,t[28]=c,t[29]=n.action,t[30]=f):f=t[30];let p;return t[31]!==s||t[32]!==l||t[33]!==u||t[34]!==d||t[35]!==f?(p=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":l,className:u,children:[d,f,s]}),t[31]=s,t[32]=l,t[33]=u,t[34]=d,t[35]=f,t[36]=p):p=t[36],p}function YZ(e){if(e.length===0)return null;let t=e[0];if(!t)return null;for(let n=1;n<e.length;n++){let r=e[n];r&&r.priority<t.priority&&(t=r)}return t}function XZ(){let e=(0,$.c)(15),t=(0,Q.useSyncExternalStore)(UZ,HZ,HZ),n;e[0]===t?n=e[1]:(n=YZ(t),e[0]=t,e[1]=n);let r=n;if(!r)return null;if(r.combinedSubscribe&&r.whatsNew){let t;e[2]===r.action?t=e[3]:(t=()=>r.action?.onClick(),e[2]=r.action,e[3]=t);let n;e[4]===r.id?n=e[5]:(n=()=>VZ(r.id),e[4]=r.id,e[5]=n);let i;return e[6]!==r.whatsNew.version||e[7]!==t||e[8]!==n?(i=(0,Z.jsx)(`div`,{"data-testid":`update-notices-list`,children:(0,Z.jsx)(qZ,{version:r.whatsNew.version,onOpenReleaseNotes:t,onClose:n})}),e[6]=r.whatsNew.version,e[7]=t,e[8]=n,e[9]=i):i=e[9],i}let i;e[10]===r?i=e[11]:(i=()=>{r.onDismiss?.(),VZ(r.id)},e[10]=r,e[11]=i);let a;return e[12]!==r||e[13]!==i?(a=(0,Z.jsx)(`div`,{"data-testid":`update-notices-list`,children:(0,Z.jsx)(JZ,{notice:r,onDismiss:i})}),e[12]=r,e[13]=i,e[14]=a):a=e[14],a}function ZZ(e,t){return e?.kind===`doc`||e?.kind===`folder-index`?Mo(t.contentDir,Io(e.docName),t.pathSeparator):e?.kind===`folder`?Mo(t.contentDir,e.folderPath,t.pathSeparator):e?.kind===`asset`?Mo(t.contentDir,e.assetPath,t.pathSeparator):t.contentDir}function QZ(e){return e?.kind===`doc`||e?.kind===`folder-index`?Io(e.docName):e?.kind===`folder`?e.folderPath:e?.kind===`asset`?e.assetPath:``}function $Z(e,t){return e===null?ka({workspace:t}):e.kind===`folder`?t?da({folderRelativePath:e.folderPath,workspace:t}):null:e.kind===`doc`||e.kind===`folder-index`?Ea({docName:e.docName,workspace:t}):null}var eQ={folderCount:0,expandedCount:0},tQ=`button, [role="button"], [role="menuitem"], input, textarea, select, a[href]`;function nQ(e){return typeof Element>`u`||!(e instanceof Element)?!1:e.closest(tQ)!==null}function rQ(e){let t=(0,$.c)(2),{onOpenSearch:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(hl,{name:`file-sidebar`,children:(0,Z.jsx)(oQ,{onOpenSearch:n})}),t[0]=n,t[1]=r),r}var iQ=e=>{let t=(0,$.c)(15),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({icon:n,label:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=(0,Z.jsx)(n,{"aria-hidden":`true`}),t[4]=n,t[5]=a);let o;t[6]!==r||t[7]!==i||t[8]!==a?(o=(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(Jr,{variant:`ghost`,size:`icon-sm`,"aria-label":r,...i,children:a})}),t[6]=r,t[7]=i,t[8]=a,t[9]=o):o=t[9];let s;t[10]===r?s=t[11]:(s=(0,Z.jsx)(Es,{children:r}),t[10]=r,t[11]=s);let c;return t[12]!==o||t[13]!==s?(c=(0,Z.jsxs)(Os,{children:[o,s]}),t[12]=o,t[13]=s,t[14]=c):c=t[14],c},aQ=e=>{let t=(0,$.c)(15),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({icon:n,label:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=(0,Z.jsx)(n,{"aria-hidden":`true`}),t[4]=n,t[5]=a);let o;t[6]!==r||t[7]!==i||t[8]!==a?(o=(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(ic,{asChild:!0,children:(0,Z.jsx)(Jr,{variant:`ghost`,size:`icon-sm`,"aria-label":r,...i,children:a})})}),t[6]=r,t[7]=i,t[8]=a,t[9]=o):o=t[9];let s;t[10]===r?s=t[11]:(s=(0,Z.jsx)(Es,{children:r}),t[10]=r,t[11]=s);let c;return t[12]!==o||t[13]!==s?(c=(0,Z.jsxs)(Os,{children:[o,s]}),t[12]=o,t[13]=s,t[14]=c):c=t[14],c};function oQ(e){let t=(0,$.c)(208),{onOpenSearch:n}=e,{_:r}=kt(),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(null),{activeDocName:c,activeTarget:l}=Ye(),u;t[0]!==c||t[1]!==l?(u=l?.kind===`folder`||l?.kind===`folder-index`?l.folderPath:al(c),t[0]=c,t[1]=l,t[2]=u):u=t[2];let d=u,[f,p]=(0,Q.useState)(!1),m=f?``:d,g=typeof window<`u`&&window.okDesktop!=null,{state:_,toggleSidebar:v}=Wj(),y=Po(),b=_===`expanded`,x=g&&_===`collapsed`,[S,C]=(0,Q.useState)(eQ),w,T;t[3]===i?(w=t[4],T=t[5]):(w=()=>{if(i===null)return;let e=()=>{C(i.getFolderState()),p(i.isCreationTargetCleared())};return e(),i.subscribe(e)},T=[i],t[3]=i,t[4]=w,t[5]=T),(0,Q.useEffect)(w,T);let E,D;t[6]===i?(E=t[7],D=t[8]):(E=()=>{if(i!==null)return IS(e=>{let t=e.initialDir??``;if(e.template){i.createFromTemplate(e.template.folder,e.template.name);return}i.startCreating(`file`,t)})},D=[i],t[6]=i,t[7]=E,t[8]=D),(0,Q.useEffect)(E,D);let O=S.folderCount>0,k=O&&S.expandedCount===S.folderCount,A=S.expandedCount===0,j=vo(``),M=vo(m===``?null:m),N=m===``?j:M,P=j.state.status===`ready`?(j.state.data.folder.templates_available?.length??0)>0:!0,F=N.state.status===`ready`?(N.state.data.folder.templates_available?.length??0)>0:!0,I=typeof window<`u`?window.okDesktop:void 0,L=ua(),{status:R}=zi(),z=R?.hasRemote===!0,B;t[9]!==r||t[10]!==L?.contentDir?(B=I?.config?.projectName||L?.contentDir.split(`/`).filter(Boolean).pop()||r({id:`sER-bs`}),t[9]=r,t[10]=L?.contentDir,t[11]=B):B=t[11];let V=B,H=ya().states,{dispatch:U}=Da(),W;t[12]===L?W=t[13]:(W=ka({workspace:L}),t[12]=L,t[13]=W);let G=W,{projectLocalBinding:K,merged:ee}=au(),te=ee?.appearance?.sidebar?.showHiddenFiles??!1,ne=O&&!k,re=O&&!A,ie=ne||re,q=dQ,ae;t[14]!==i||t[15]!==L?(ae=()=>{L&&i?.startCreating(`file`,``)},t[14]=i,t[15]=L,t[16]=ae):ae=t[16];let oe=ae,se;t[17]!==i||t[18]!==L?(se=e=>{L&&i?.createFromTemplate(``,e)},t[17]=i,t[18]=L,t[19]=se):se=t[19];let ce=se,le;t[20]!==i||t[21]!==L?(le=()=>{L&&i?.startCreating(`folder`,``)},t[20]=i,t[21]=L,t[22]=le):le=t[22];let ue=le,de;t[23]===L?de=t[24]:(de=()=>{!L||!I||I.shell.showItemInFolder(L.contentDir)},t[23]=L,t[24]=de);let fe=de,pe;t[25]!==r||t[26]!==L?(pe=async()=>{if(L)try{await navigator.clipboard.writeText(L.contentDir),hs.success(r({id:`6_ZOw4`}),{description:L.contentDir})}catch(e){console.warn(`[FileSidebar] clipboard write failed:`,e),hs.error(r({id:`vfRlCI`}))}},t[25]=r,t[26]=L,t[27]=pe):pe=t[27];let me=pe,he;t[28]!==r||t[29]!==z?(he=()=>{La({...Pa(``),hasRemote:z,onClickWhenNoRemote:()=>{hs.error(r({id:`WyQxwa`}))}},{clipboardWrite:Sa,toastSuccess:uQ,toastError:lQ,logEvent:cQ})},t[28]=r,t[29]=z,t[30]=he):he=t[30];let ge=he,_e;t[31]!==r||t[32]!==K?(_e=e=>{if(K===null)return;let t=K.patch({appearance:{sidebar:{showHiddenFiles:e}}});t.ok||(console.warn(`[FileSidebar] showHiddenFiles toggle rejected:`,un(t.error)),hs.error(r({id:`P47EWZ`}),{description:un(t.error)}))},t[31]=r,t[32]=K,t[33]=_e):_e=t[33];let ve=_e,ye;t[34]===i?ye=t[35]:(ye=()=>{i?.expandAll()},t[34]=i,t[35]=ye);let be=ye,xe;t[36]===i?xe=t[37]:(xe=()=>{i?.collapseAll()},t[36]=i,t[37]=xe);let Se=xe,Ce,we;t[38]!==re||t[39]!==ne||t[40]!==te||t[41]!==_?(Ce=()=>{I&&I.editor.notifyViewMenuStateChanged({showHiddenFiles:te,canExpandAll:ne,canCollapseAll:re,sidebarVisible:_===`expanded`})},we=[I,te,ne,re,_],t[38]=re,t[39]=ne,t[40]=te,t[41]=_,t[42]=Ce,t[43]=we):(Ce=t[42],we=t[43]),(0,Q.useEffect)(Ce,we);let Te,Ee;t[44]!==r||t[45]!==l||t[46]!==U||t[47]!==H||t[48]!==m||t[49]!==K||t[50]!==te||t[51]!==v||t[52]!==i||t[53]!==L?(Te=()=>{if(I)return I.onMenuAction(e=>{switch(e){case`new-doc`:if(!L||!i)return;i.startCreating(`file`,m);return;case`new-folder`:if(!L||!i)return;i.startCreating(`folder`,m);return;case`new-from-template`:if(!L||!i)return;i.startCreatingFromTemplate(m);return;case`rename`:if(!l)return;pJ(l);return;case`duplicate`:if(!l)return;hJ(l);return;case`move-to-trash`:if(!l)return;dJ(l);return;case`reveal-in-finder`:{if(!I||!L)return;let e=ZZ(l,L);I.shell.showItemInFolder(e);return}case`send-to-ai`:{let e=ca.filter(e=>H[e.id]?.installed===!0);if(e.length===0){hs.error(r({id:`LKOLNn`}));return}let t=$Z(l,L);if(!t)return;let[n]=e;if(!n)return;U(n.id,t);return}case`copy-full-path`:{if(!L)return;let e=ZZ(l,L);navigator.clipboard.writeText(e).then(()=>hs.success(r({id:`6_ZOw4`}),{description:e})).catch(e=>{console.warn(`[FileSidebar] clipboard write failed:`,e),hs.error(r({id:`vfRlCI`}))});return}case`copy-relative-path`:{let e=QZ(l);if(e===``){hs.error(r({id:`74eHt-`}));return}navigator.clipboard.writeText(e).then(()=>hs.success(r({id:`haHgQj`}),{description:e})).catch(e=>{console.warn(`[FileSidebar] clipboard write failed:`,e),hs.error(r({id:`5QGTaA`}))});return}case`toggle-show-hidden-files`:{if(K===null)return;let e=K.patch({appearance:{sidebar:{showHiddenFiles:!te}}});e.ok||(console.warn(`[FileSidebar] toggle-show-hidden-files rejected:`,un(e.error)),hs.error(r({id:`P47EWZ`}),{description:un(e.error)}));return}case`expand-all-tree`:i?.expandAll();return;case`collapse-all-tree`:i?.collapseAll();return;case`toggle-sidebar`:v();return;case`delete`:case`toggle-source`:case`save-version`:case`version-history`:case`focus-search`:case`focus-command-palette`:case`close-active-tab-or-window`:case`toggle-doc-panel`:return}})},Ee=[I,i,L,l,m,K,te,H,U,v,r],t[44]=r,t[45]=l,t[46]=U,t[47]=H,t[48]=m,t[49]=K,t[50]=te,t[51]=v,t[52]=i,t[53]=L,t[54]=Te,t[55]=Ee):(Te=t[54],Ee=t[55]),(0,Q.useEffect)(Te,Ee);let De=g&&b&&`motion-safe:delay-100`,Oe=x&&`opacity-0`,ke;t[56]!==De||t[57]!==Oe?(ke=X(`flex-row h-12 items-center py-0 px-3`,`justify-between`,g&&`overflow-x-clip`,g&&`motion-safe:transition-opacity motion-safe:duration-100 motion-safe:ease-out`,De,Oe,g&&`[-webkit-app-region:drag]`),t[56]=De,t[57]=Oe,t[58]=ke):ke=t[58];let Ae;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=g?(0,Z.jsx)(`div`,{"aria-hidden":`true`,"data-testid":`sidebar-traffic-light-reserve`,className:`w-[var(--ok-titlebar-reserve-left,0px)] shrink-0 self-stretch`}):null,t[59]=Ae):Ae=t[59];let je;t[60]===b?je=t[61]:(je=b&&!g?(0,Z.jsx)(`span`,{className:`shrink-0 font-mono text-sm uppercase tracking-wider text-sidebar-foreground/50`,children:(0,Z.jsx)(J,{id:`sER-bs`})}):null,t[60]=b,t[61]=je);let Me;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(Me=X(`flex items-center gap-1`,g&&`[&>*]:[-webkit-app-region:no-drag]`),t[62]=Me):Me=t[62];let Ne;t[63]!==r||t[64]!==k||t[65]!==O||t[66]!==A||t[67]!==i?(Ne=O?(0,Z.jsxs)(Ec,{children:[(0,Z.jsx)(aQ,{icon:rf,label:r({id:`Rq1vFD`})}),(0,Z.jsxs)(bc,{align:`end`,className:`min-w-52`,children:[k?null:(0,Z.jsxs)(vc,{onSelect:()=>i?.expandAll(),children:[(0,Z.jsx)(Gf,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`OlAl5i`})]}),A?null:(0,Z.jsxs)(vc,{onSelect:()=>i?.collapseAll(),children:[(0,Z.jsx)(Gd,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`qvWGzP`})]})]})]}):null,t[63]=r,t[64]=k,t[65]=O,t[66]=A,t[67]=i,t[68]=Ne):Ne=t[68];let Pe;t[69]===r?Pe=t[70]:(Pe=r({id:`HdkSiO`}),t[69]=r,t[70]=Pe);let Fe;t[71]!==m||t[72]!==i?(Fe=()=>i?.startCreating(`file`,m),t[71]=m,t[72]=i,t[73]=Fe):Fe=t[73];let Ie;t[74]!==Pe||t[75]!==Fe?(Ie=(0,Z.jsx)(iQ,{icon:jf,label:Pe,onClick:Fe}),t[74]=Pe,t[75]=Fe,t[76]=Ie):Ie=t[76];let Le;t[77]!==r||t[78]!==F||t[79]!==m||t[80]!==i?(Le=F?(0,Z.jsxs)(Ec,{children:[(0,Z.jsx)(aQ,{icon:ro,label:r({id:`Uuj_R4`})}),(0,Z.jsx)(bc,{align:`end`,className:`min-w-52`,children:(0,Z.jsx)(iJ,{parentDir:m,onSelectTemplate:e=>i?.createFromTemplate(m,e),ItemComponent:vc})})]}):null,t[77]=r,t[78]=F,t[79]=m,t[80]=i,t[81]=Le):Le=t[81];let Re;t[82]===r?Re=t[83]:(Re=r({id:`96G6Re`}),t[82]=r,t[83]=Re);let ze;t[84]!==m||t[85]!==i?(ze=()=>i?.startCreating(`folder`,m),t[84]=m,t[85]=i,t[86]=ze):ze=t[86];let Be;t[87]!==Re||t[88]!==ze?(Be=(0,Z.jsx)(iQ,{icon:qd,label:Re,onClick:ze}),t[87]=Re,t[88]=ze,t[89]=Be):Be=t[89];let Ve;t[90]!==Ne||t[91]!==Ie||t[92]!==Le||t[93]!==Be?(Ve=(0,Z.jsxs)(`div`,{"data-testid":`sidebar-toolbar`,className:Me,children:[Ne,Ie,Le,Be]}),t[90]=Ne,t[91]=Ie,t[92]=Le,t[93]=Be,t[94]=Ve):Ve=t[94];let He;t[95]!==ke||t[96]!==je||t[97]!==Ve?(He=(0,Z.jsxs)(Qj,{"data-electron-drag":g?``:void 0,className:ke,children:[Ae,je,Ve]}),t[95]=ke,t[96]=je,t[97]=Ve,t[98]=He):He=t[98];let Ue=g&&b&&`motion-safe:delay-100`,We=x&&`opacity-0`,Ge;t[99]!==Ue||t[100]!==We?(Ge=X(`px-2 pb-2`,g&&`[-webkit-app-region:no-drag]`,g&&`motion-safe:transition-opacity motion-safe:duration-100 motion-safe:ease-out`,Ue,We),t[99]=Ue,t[100]=We,t[101]=Ge):Ge=t[101];let Ke;t[102]===_?Ke=t[103]:(Ke=[_],t[102]=_,t[103]=Ke);let qe;t[104]===n?qe=t[105]:(qe=(0,Z.jsx)(iZ,{onClick:n}),t[104]=n,t[105]=qe);let Je;t[106]!==Ke||t[107]!==qe?(Je=(0,Z.jsx)(h,{fallbackRender:sQ,onError:rZ,resetKeys:Ke,children:qe}),t[106]=Ke,t[107]=qe,t[108]=Je):Je=t[108];let Xe;t[109]!==Ge||t[110]!==Je?(Xe=(0,Z.jsx)(`div`,{className:Ge,children:Je}),t[109]=Ge,t[110]=Je,t[111]=Xe):Xe=t[111];let Ze;t[112]===Symbol.for(`react.memo_cache_sentinel`)?(Ze=(0,Z.jsx)(VI,{}),t[112]=Ze):Ze=t[112];let Qe;t[113]===Symbol.for(`react.memo_cache_sentinel`)?(Qe=(0,Z.jsx)(Ro,{className:`size-3.5 shrink-0`}),t[113]=Qe):Qe=t[113];let $e;t[114]===V?$e=t[115]:($e=(0,Z.jsx)(`span`,{className:`truncate`,children:V}),t[114]=V,t[115]=$e);let et;t[116]===Symbol.for(`react.memo_cache_sentinel`)?(et=(0,Z.jsx)(na,{className:`size-3.5 shrink-0 text-muted-foreground transition-transform group-data-[state=open]/files:rotate-90`}),t[116]=et):et=t[116];let tt;t[117]===$e?tt=t[118]:(tt=(0,Z.jsx)(nM,{asChild:!0,className:`shrink-0`,children:(0,Z.jsxs)(js,{"data-sidebar-root-context":!0,className:`flex w-full items-center gap-1.5`,children:[Qe,$e,et]})}),t[117]=$e,t[118]=tt);let nt=o==null?`50vh`:`${o}px`,rt;t[119]===nt?rt=t[120]:(rt={height:nt},t[119]=nt,t[120]=rt);let it;t[121]===Symbol.for(`react.memo_cache_sentinel`)?(it=(0,Z.jsx)(AY,{ref:a,onContentHeightChange:s}),t[121]=it):it=t[121];let at;t[122]===rt?at=t[123]:(at=(0,Z.jsx)(As,{className:`flex max-h-[70vh] flex-col overflow-hidden`,style:rt,children:it}),t[122]=rt,t[123]=at);let ot;t[124]!==tt||t[125]!==at?(ot=(0,Z.jsx)(Ms,{defaultOpen:!0,className:`group/files flex shrink-0 flex-col`,children:(0,Z.jsxs)(tM,{className:`min-h-0 px-0`,children:[tt,at]})}),t[124]=tt,t[125]=at,t[126]=ot):ot=t[126];let st;t[127]===Symbol.for(`react.memo_cache_sentinel`)?(st=(0,Z.jsx)(aZ,{}),t[127]=st):st=t[127];let ct;t[128]===i?ct=t[129]:(ct=(0,Z.jsx)(`div`,{"aria-hidden":!0,"data-sidebar-empty-deselect":!0,className:`min-h-8 flex-1 cursor-default`,onClick:()=>i?.clearCreationTarget()}),t[128]=i,t[129]=ct);let lt;t[130]!==ot||t[131]!==ct?(lt=(0,Z.jsxs)(eM,{children:[Ze,ot,st,ct]}),t[130]=ot,t[131]=ct,t[132]=lt):lt=t[132];let ut;t[133]===Symbol.for(`react.memo_cache_sentinel`)?(ut=(0,Z.jsxs)($j,{className:`px-0`,children:[(0,Z.jsx)(EX,{}),(0,Z.jsx)(XZ,{}),typeof window<`u`&&window.okDesktop?(0,Z.jsx)(aM,{children:(0,Z.jsx)(oM,{children:(0,Z.jsx)(JX,{bridge:window.okDesktop})})}):null]}),t[133]=ut):ut=t[133];let dt=!(y&&_===`collapsed`),ft;t[134]===dt?ft=t[135]:(ft=(0,Z.jsx)(Xj,{enableToggle:!1,enableDrag:dt}),t[134]=dt,t[135]=ft);let pt;t[136]!==He||t[137]!==Xe||t[138]!==lt||t[139]!==ft?(pt=(0,Z.jsx)(dP,{asChild:!0,children:(0,Z.jsxs)(`div`,{className:`contents`,onContextMenu:q,children:[He,Xe,lt,ut,ft]})}),t[136]=He,t[137]=Xe,t[138]=lt,t[139]=ft,t[140]=pt):pt=t[140];let mt=!L,ht,gt;t[141]===Symbol.for(`react.memo_cache_sentinel`)?(ht=(0,Z.jsx)(jf,{"aria-hidden":`true`}),gt=(0,Z.jsx)(J,{id:`HdkSiO`}),t[141]=ht,t[142]=gt):(ht=t[141],gt=t[142]);let _t;t[143]!==oe||t[144]!==mt?(_t=(0,Z.jsxs)(hP,{disabled:mt,onSelect:oe,"data-testid":`empty-space-menu-new-file`,children:[ht,gt]}),t[143]=oe,t[144]=mt,t[145]=_t):_t=t[145];let vt;t[146]!==ce||t[147]!==P||t[148]!==L?(vt=P?(0,Z.jsxs)(pP,{children:[(0,Z.jsxs)(gP,{disabled:!L,"data-testid":`empty-space-menu-new-from-template`,children:[(0,Z.jsx)(ro,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`Uuj_R4`})]}),(0,Z.jsx)(_P,{children:(0,Z.jsx)(iJ,{parentDir:``,onSelectTemplate:ce,ItemComponent:hP})})]}):null,t[146]=ce,t[147]=P,t[148]=L,t[149]=vt):vt=t[149];let yt=!L,bt,xt;t[150]===Symbol.for(`react.memo_cache_sentinel`)?(bt=(0,Z.jsx)(qd,{"aria-hidden":`true`}),xt=(0,Z.jsx)(J,{id:`96G6Re`}),t[150]=bt,t[151]=xt):(bt=t[150],xt=t[151]);let St;t[152]!==ue||t[153]!==yt?(St=(0,Z.jsxs)(hP,{disabled:yt,onSelect:ue,"data-testid":`empty-space-menu-new-folder`,children:[bt,xt]}),t[152]=ue,t[153]=yt,t[154]=St):St=t[154];let Ct;t[155]===Symbol.for(`react.memo_cache_sentinel`)?(Ct=(0,Z.jsx)(bP,{}),t[155]=Ct):Ct=t[155];let wt;t[156]!==r||t[157]!==fe||t[158]!==L?(wt=I?(0,Z.jsxs)(hP,{disabled:!L,onSelect:fe,"data-testid":`empty-space-menu-reveal-in-finder`,"aria-label":r(L?{id:`LtSYdi`}:{id:`o2yoFu`}),children:[(0,Z.jsx)(Ro,{"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(J,{id:`LtSYdi`})}),L?null:(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(J,{id:`wTcjov`})})]}):null,t[156]=r,t[157]=fe,t[158]=L,t[159]=wt):wt=t[159];let Tt;t[160]!==U||t[161]!==G||t[162]!==H?(Tt=(0,Z.jsx)(mX,{input:G,installStates:H,dispatch:U}),t[160]=U,t[161]=G,t[162]=H,t[163]=Tt):Tt=t[163];let Et;t[164]!==ge||t[165]!==z?(Et=z?(0,Z.jsxs)(hP,{onSelect:ge,"data-testid":`empty-space-menu-share`,children:[(0,Z.jsx)(Df,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`Z8lGw6`})]}):null,t[164]=ge,t[165]=z,t[166]=Et):Et=t[166];let Dt=!L,Ot;t[167]!==r||t[168]!==L?(Ot=r(L?{id:`Up2_7p`}:{id:`U8CD-l`}),t[167]=r,t[168]=L,t[169]=Ot):Ot=t[169];let At;t[170]===Symbol.for(`react.memo_cache_sentinel`)?(At=(0,Z.jsx)(Oo,{"aria-hidden":`true`}),t[170]=At):At=t[170];let jt;t[171]===Symbol.for(`react.memo_cache_sentinel`)?(jt=(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(J,{id:`Up2_7p`})}),t[171]=jt):jt=t[171];let Mt;t[172]===L?Mt=t[173]:(Mt=L?null:(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(J,{id:`wTcjov`})}),t[172]=L,t[173]=Mt);let Nt;t[174]!==me||t[175]!==Dt||t[176]!==Ot||t[177]!==Mt?(Nt=(0,Z.jsxs)(hP,{disabled:Dt,onSelect:me,"data-testid":`empty-space-menu-copy-full-path`,"aria-label":Ot,children:[At,jt,Mt]}),t[174]=me,t[175]=Dt,t[176]=Ot,t[177]=Mt,t[178]=Nt):Nt=t[178];let Pt;t[179]===Symbol.for(`react.memo_cache_sentinel`)?(Pt=(0,Z.jsx)(bP,{}),t[179]=Pt):Pt=t[179];let Ft=K===null,It;t[180]===Symbol.for(`react.memo_cache_sentinel`)?(It=(0,Z.jsx)(J,{id:`XcGbim`}),t[180]=It):It=t[180];let Lt;t[181]!==ve||t[182]!==te||t[183]!==Ft?(Lt=(0,Z.jsx)(vP,{checked:te,onCheckedChange:ve,disabled:Ft,"data-testid":`empty-space-menu-show-hidden-files`,children:It}),t[181]=ve,t[182]=te,t[183]=Ft,t[184]=Lt):Lt=t[184];let Rt;t[185]===ie?Rt=t[186]:(Rt=ie?(0,Z.jsx)(bP,{}):null,t[185]=ie,t[186]=Rt);let zt;t[187]!==be||t[188]!==ne?(zt=ne?(0,Z.jsxs)(hP,{onSelect:be,"data-testid":`empty-space-menu-expand-all`,children:[(0,Z.jsx)(Gf,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`OlAl5i`})]}):null,t[187]=be,t[188]=ne,t[189]=zt):zt=t[189];let Bt;t[190]!==Se||t[191]!==re?(Bt=re?(0,Z.jsxs)(hP,{onSelect:Se,"data-testid":`empty-space-menu-collapse-all`,children:[(0,Z.jsx)(Gd,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`qvWGzP`})]}):null,t[190]=Se,t[191]=re,t[192]=Bt):Bt=t[192];let Vt;t[193]!==_t||t[194]!==vt||t[195]!==St||t[196]!==wt||t[197]!==Tt||t[198]!==Et||t[199]!==Nt||t[200]!==Lt||t[201]!==Rt||t[202]!==zt||t[203]!==Bt?(Vt=(0,Z.jsxs)(mP,{className:`min-w-52`,children:[_t,vt,St,Ct,wt,Tt,Et,Nt,Pt,Lt,Rt,zt,Bt]}),t[193]=_t,t[194]=vt,t[195]=St,t[196]=wt,t[197]=Tt,t[198]=Et,t[199]=Nt,t[200]=Lt,t[201]=Rt,t[202]=zt,t[203]=Bt,t[204]=Vt):Vt=t[204];let Ht;return t[205]!==pt||t[206]!==Vt?(Ht=(0,Z.jsx)(Jj,{variant:`inset`,children:(0,Z.jsxs)(uP,{children:[pt,Vt]})}),t[205]=pt,t[206]=Vt,t[207]=Ht):Ht=t[207],Ht}function sQ(){return null}function cQ(e){return console.log(e)}function lQ(e){return hs.error(e)}function uQ(e){return hs.success(e)}function dQ(e){e.target instanceof Element&&e.target.closest(`[data-sidebar-root-context]`)||nQ(e.target)&&(e.preventDefault(),e.stopPropagation())}var fQ=(0,Q.lazy)(()=>n(()=>import(`./McpConsentDialogBody-ikl9jWLz.js`),__vite__mapDeps([104,1,10,3,11,6,7,81,20,21,15,13,16,63,64,61,62,83,19,31,70,42,105]),import.meta.url));function pQ(){let e=(0,$.c)(1);if(!(0,Q.useSyncExternalStore)(rd.subscribe,hQ,mQ))return null;let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(fQ,{})}),e[0]=t):t=e[0],t}function mQ(){return!1}function hQ(){return rd.getSnapshot()!==null}function gQ(){let e=(0,$.c)(17),t=tn(),{collabUrl:n,setSystemProvider:r,updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c}=Ye(),l;e[0]!==o||e[1]!==s||e[2]!==a||e[3]!==c||e[4]!==i?(l={updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c},e[0]=o,e[1]=s,e[2]=a,e[3]=c,e[4]=i,e[5]=l):l=e[5];let u=(0,Q.useRef)(l),d;e[6]!==o||e[7]!==s||e[8]!==a||e[9]!==c||e[10]!==i?(d=()=>{u.current={updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c}},e[6]=o,e[7]=s,e[8]=a,e[9]=c,e[10]=i,e[11]=d):d=e[11],(0,Q.useEffect)(d);let f,p;return e[12]!==n||e[13]!==t||e[14]!==r?(f=()=>{if(n===null)return;let e=new Fl,i=new Nl({url:n,name:gr,document:e,onStateless:e=>{let{payload:t}=e;b(t,{onServerInfo:e=>{u.current.updateServerInstanceId(e.serverInstanceId),e.currentBranch!==void 0&&u.current.observeBranch(e.currentBranch)},onBranchSwitched:e=>{u.current.onBranchSwitched(e.branch)},onDiskAck:e=>{u.current.observeDiskAck(e.docName,e.sv)},onDerivedView:SQ,onConfigValidationRejected:xQ,onConfigIgnoreNestedError:bQ,onUnknown:yQ})},onClose:vQ,onDisconnect:_Q}),a=dl(e=>{(e.includes(`files`)||e.includes(`backlinks`))&&(t.invalidateQueries({queryKey:[`backlinks`]}),t.invalidateQueries({queryKey:[`forward-links`]})),(e.includes(`files`)||e.includes(`graph`))&&(t.invalidateQueries({queryKey:[`orphans`]}),t.invalidateQueries({queryKey:[`hubs`]}))}),o=j(()=>{u.current.refreshServerInfo()});i.on(`synced`,()=>{ul([`files`,`backlinks`,`graph`]),o()});let s=new Set,c=()=>{if(i.awareness)for(let[e,t]of i.awareness.getStates().entries())s.has(e)||t.user?.type===`agent`&&(s.add(e),console.warn(`[agent-presence] observed stale AwarenessUser.type === 'agent' from clientID ${e} — probably a stale bundled client`))};return i.awareness?.on(`change`,c),r(i),()=>{a(),i.awareness?.off(`change`,c),r(null),i.destroy(),e.destroy()}},p=[t,n,r],e[12]=n,e[13]=t,e[14]=r,e[15]=f,e[16]=p):(f=e[15],p=e[16]),(0,Q.useEffect)(f,p),null}function _Q(){console.warn(`[CC1] __system__ disconnected - derived views may be stale`)}function vQ(e){let{event:t}=e;console.warn(`[CC1] __system__ connection closed:`,t.code,t.reason)}function yQ(e){console.warn(`[CC1] Unparseable stateless payload, skipping:`,e.slice(0,100))}function bQ(e){$a(e)}function xQ(e){go(e)}function SQ(e){ul([e.ch])}function CQ(e){let t=Ce(e);if(t)return{scope:`project`,name:t};let n=er(e);return n?.kind===`skill`?{scope:n.scope,name:n.name}:null}function wQ(e,t){let n=new Set(t.map(e=>`${e.scope}\u0000${e.name}`)),r=[];for(let t of e){let e=CQ(t);if(!e||n.has(`${e.scope}\u0000${e.name}`))continue;let i=e.scope===`project`?`global`:`project`;n.has(`${i}\u0000${e.name}`)?r.push({kind:`retarget`,fromDocName:t,toDocName:Rn(i,e.name)}):r.push({kind:`close`,docName:t})}return r}function TQ(){let e=(0,$.c)(13),{openTabs:t,closeDocument:n}=Ye(),r;e[0]===t?r=e[1]:(r=t.some(DQ),e[0]=t,e[1]=r);let i=r,a;e[2]===i?a=e[3]:(a={enabled:i},e[2]=i,e[3]=a);let o=_a(a),s=(0,Q.useRef)(null),c;e[4]!==n||e[5]!==t||e[6]!==o.data||e[7]!==o.status?(c=()=>{if(o.status!==`ready`)return;let e=o.data,r=`${t.join(``)}\u0002${e.map(EQ).sort().join(``)}`;if(s.current===r)return;s.current=r;let i=wQ(t,e);for(let e of i)e.kind===`retarget`?(Zo(e.toDocName),n(e.fromDocName)):n(e.docName)},e[4]=n,e[5]=t,e[6]=o.data,e[7]=o.status,e[8]=c):c=e[8];let l;e[9]!==n||e[10]!==t||e[11]!==o?(l=[o,t,n],e[9]=n,e[10]=t,e[11]=o,e[12]=l):l=e[12],(0,Q.useEffect)(c,l)}function EQ(e){return`${e.scope}\u0000${e.name}`}function DQ(e){return CQ(e)!==null}var OQ=1e3,kQ=3e4;function AQ(e){let t=e.scheduler??{setTimeout:(e,t)=>globalThis.setTimeout(e,t),clearTimeout:e=>globalThis.clearTimeout(e)},n=e.initialBackoffMs??OQ,r=e.maxBackoffMs??kQ,i=e.rng??Math.random,a=e.createWebSocket??(e=>new WebSocket(e)),o=e.logger??null,s=e.log,c=null,l=null,u=!1,d=n;function f(e,t,n){try{o?o[e](t,n):s?.(t)}catch{}}function p(){if(u)return;l!==null&&t.clearTimeout(l);let e=d;d=Math.min(d*2,r);let n=i(),a=Math.max(1,Math.floor(e*(1-n/2)));f(`debug`,`scheduling reconnect`,{backoffMs:a,ceilMs:e}),l=t.setTimeout(()=>{l=null,m().catch(e=>f(`warn`,`reconnect failed`,{error:String(e)}))},a)}async function m(){if(u)return;let t;try{t=await e.resolveWsUrl()}catch(e){f(`warn`,`resolveWsUrl threw`,{error:String(e)}),p();return}if(!t){p();return}let r=[];e.pid!==void 0&&r.push(`pid=${encodeURIComponent(String(e.pid))}`),e.connectionId&&r.push(`connectionId=${encodeURIComponent(e.connectionId)}`),e.connectionId&&e.displayName!==void 0&&e.clientName!==void 0&&e.colorSeed!==void 0&&(r.push(`displayName=${encodeURIComponent(e.displayName)}`),r.push(`clientName=${encodeURIComponent(e.clientName)}`),r.push(`colorSeed=${encodeURIComponent(e.colorSeed)}`));let i=r.length>0?`?${r.join(`&`)}`:``,o=`${t}/collab/keepalive${i}`;try{c=a(o)}catch(e){f(`warn`,`WebSocket constructor failed`,{url:o,error:String(e)}),c=null,p();return}c.addEventListener(`open`,()=>{f(`info`,`connected`,{url:t}),d=n}),c.addEventListener(`close`,()=>{u||(f(`info`,`disconnected`,{url:t}),c=null,p())}),c.addEventListener(`error`,()=>{f(`debug`,`websocket error observed`,{url:t,readyState:c?.readyState,reason:`error-event`})})}return queueMicrotask(()=>{m().catch(e=>f(`warn`,`initial connect failed`,{error:String(e)}))}),{close:()=>{if(!u&&(u=!0,l!==null&&(t.clearTimeout(l),l=null),c)){try{c.close()}catch{}c=null}},isConnected:()=>c!==null&&c.readyState===1}}function jQ(e){if(e)return e.replace(/\/collab\/?$/,``)}function MQ(){return V(window)!==null}function NQ(e,t){let n=(0,$.c)(5),r=(0,Q.useRef)(e),i=(0,Q.useRef)(t),a,o;n[0]===e?(a=n[1],o=n[2]):(a=()=>{r.current=e},o=[e],n[0]=e,n[1]=a,n[2]=o),(0,Q.useEffect)(a,o);let s,c;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{let e=i.current?.startKeepalive??AQ;if((i.current?.isElectronHost??MQ)())return;let t=e({resolveWsUrl:async()=>jQ(r.current)});return()=>t.close()},c=[],n[3]=s,n[4]=c):(s=n[3],c=n[4]),(0,Q.useEffect)(s,c)}var PQ=(0,Q.lazy)(()=>n(()=>import(`./ShareBranchSwitchDialog-BO-B5Z58.js`).then(e=>({default:e.ShareBranchSwitchDialog})),__vite__mapDeps([106,1,6,7,13,61,15,16,62,69,71,107,108,109,110,10,3,11]),import.meta.url)),FQ=(0,Q.lazy)(()=>n(()=>import(`./ShareReceiveMissDialog-WUihVM0X.js`).then(e=>({default:e.ShareReceiveMissDialog})),__vite__mapDeps([111,1,61,6,7,15,13,16,62,112,86,10,3,11,55,40,56,68,36,31,64,57,70,71,107,88,39,34,42]),import.meta.url)),IQ=`#install-claude-desktop`,LQ=/\.(md|mdx)$/i;function RQ(e){return e===`#settings`||e===IQ}function zQ(e,t){if(!LQ.test(e))return null;for(let n of t){let t=Be(n);if(t.kind===`doc`&&t.docName===e)return{kind:`doc`,target:e,docName:e}}return null}function BQ(e,t,n,r){return[e,t,n,r].map(e=>[...e].sort().join(`\0`)).join(``)}function VQ(){let e=(0,$.c)(26),{clearTarget:t,openTabs:n,syncOpenTabsWithKnownTargets:r,tabSessionLoaded:i}=Ye(),{openTargetTransition:a}=at();TQ();let{assetPaths:o,filePaths:s,folderPaths:c,loading:l,pageMeta:u,pages:d,pagesBySlug:f,pagesByBasename:p}=ia(),m=(0,Q.useRef)(null),h;e[0]!==o||e[1]!==s||e[2]!==c||e[3]!==d?(h=BQ(d,c,o,s),e[0]=o,e[1]=s,e[2]=c,e[3]=d,e[4]=h):h=e[4];let g=h,_,v;e[5]!==o||e[6]!==s||e[7]!==c||e[8]!==l||e[9]!==d||e[10]!==r||e[11]!==i||e[12]!==g?(_=()=>{l||!i||m.current===g||(m.current=g,r({pages:d,folderPaths:c,assetPaths:o,filePaths:s}))},v=[o,s,c,l,d,r,i,g],e[5]=o,e[6]=s,e[7]=c,e[8]=l,e[9]=d,e[10]=r,e[11]=i,e[12]=g,e[13]=_,e[14]=v):(_=e[13],v=e[14]),(0,Q.useEffect)(_,v);let y,b;return e[15]!==t||e[16]!==c||e[17]!==l||e[18]!==n||e[19]!==a||e[20]!==u||e[21]!==d||e[22]!==p||e[23]!==f?(y=()=>{e();function e(){if(RQ(window.location.hash))return;let e=Cl(window.location.hash);if(e){let t=Hn(e.split(`.`).pop()??``);ml(`ok/nav/hash-change`,{docName:null,kind:`asset`}),a({kind:`asset`,target:e,assetPath:e,mediaKind:t});return}let r=bl(window.location.hash);if(r){ml(`ok/nav/hash-change`,{docName:null,kind:`skill-file`}),a({kind:`skill-file`,target:`${r.scope}/${r.name}/${r.path}`,scope:r.scope,name:r.name,path:r.path});return}if(Ol(window.location.hash)){ml(`ok/nav/hash-change`,{docName:null,kind:`folder`}),a({kind:`folder`,target:``,folderPath:``});return}let i=Tl(window.location.hash);if(!i){ml(`ok/nav/hash-change`,{docName:null,kind:`clear`}),t();return}if(l){ml(`ok/nav/hash-change`,{docName:i,kind:`deferred-loading`});return}let o=zQ(i,n)??Yc(i,{pages:d,folderPaths:c,pagesBySlug:f,pagesByBasename:p});if(o.kind===`missing`&&/\/+$/.test(i.trim())){ml(`ok/nav/hash-change`,{docName:i,kind:`deferred-missing-folder`});return}let s=nl(il(o),u);ml(`ok/nav/hash-change`,{docName:i,kind:s.kind}),a(s)}return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},b=[t,c,l,a,n,u,d,f,p],e[15]=t,e[16]=c,e[17]=l,e[18]=n,e[19]=a,e[20]=u,e[21]=d,e[22]=p,e[23]=f,e[24]=y,e[25]=b):(y=e[24],b=e[25]),(0,Q.useEffect)(y,b),null}function HQ(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0],(0,Q.useEffect)(UQ,t),null}function UQ(){let e=KQ;if(!e(window.location.hash))return;let t=new AbortController;return T(t.signal).then(n=>{if(t.signal.aborted||n.status!==`ok`)return;let r=n.config.paneTarget;r?.startsWith(`#/`)&&e(window.location.hash)&&(window.location.hash=r,fetch(`/api/config`,{method:`DELETE`}).catch(GQ))}).catch(WQ),()=>t.abort()}function WQ(){}function GQ(){}function KQ(e){return!RQ(e)&&!Cl(e)&&!Tl(e)&&(e===``||e===`#`||e===`#/`)}function qQ(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0],(0,Q.useEffect)(JQ,t),null}function JQ(){let e=function(e){let t=e.target;Za({target:t,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,key:e.key})&&(e.preventDefault(),window.location.hash!==`#settings`&&(window.location.hash=Ya))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)}function YQ(){let e=(0,$.c)(4),{activeTarget:t}=Ye(),n=typeof window<`u`?window.okDesktop??null:null,r=t?.kind===`doc`||t?.kind===`folder`||t?.kind===`asset`?t.kind:null,i=t?.kind===`doc`?t.docName:t?.kind===`folder`?t.folderPath:t?.kind===`asset`?t.assetPath:null,a,o;return e[0]!==i||e[1]!==r?(a=()=>{if(n){if(r===null){n.editor.notifyActiveTargetChanged({kind:null});return}i!==null&&n.editor.notifyActiveTargetChanged({kind:r,identifier:i})}},o=[n,r,i],e[0]=i,e[1]=r,e[2]=a,e[3]=o):(a=e[2],o=e[3]),(0,Q.useEffect)(a,o),null}function XQ(){let e=(0,$.c)(8),{activeDocName:t,activeTarget:n}=Ye(),[r,i]=(0,Q.useState)(!1),a;e[0]!==t||e[1]!==n?(a=n?.kind===`folder`?n.folderPath:al(t),e[0]=t,e[1]=n,e[2]=a):a=e[2];let o=a,s,c;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{let e=function(e){let t=e.target;yh({target:t,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,key:e.key})&&(e.preventDefault(),i(!0))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},c=[],e[3]=s,e[4]=c):(s=e[3],c=e[4]),(0,Q.useEffect)(s,c);let l;return e[5]!==r||e[6]!==o?(l=(0,Z.jsx)(xh,{open:r,onOpenChange:i,kind:`file`,initialDir:o}),e[5]=r,e[6]=o,e[7]=l):l=e[7],l}function ZQ(e){let t=(0,$.c)(3),{children:n}=e,{collabUrl:r}=Ye();NQ(r);let i;return t[0]!==n||t[1]!==r?(i=(0,Z.jsx)(Ll,{collabUrl:r,children:n}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i}function QQ(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(hl,{name:`app`,children:(0,Z.jsx)(dt,{children:(0,Z.jsx)(ZQ,{children:(0,Z.jsx)(mg,{children:(0,Z.jsx)($Q,{})})})})}),e[0]=t):t=e[0],t}function $Q(){let e=(0,$.c)(25),t=typeof window<`u`?window.okDesktop??null:null,n=typeof window<`u`&&window.okDesktop!=null,[r,i]=(0,Q.useState)(!1),a=_g(),o;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=t?{launchInTerminal:e$}:null,e[0]=o):o=e[0];let s=o,c;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(Wg,{}),e[1]=c):c=e[1];let l,u,d,f,p;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(gQ,{}),u=(0,Z.jsx)(VQ,{}),d=(0,Z.jsx)(HQ,{}),f=(0,Z.jsx)(YQ,{}),p=(0,Z.jsx)(XQ,{}),e[2]=l,e[3]=u,e[4]=d,e[5]=f,e[6]=p):(l=e[2],u=e[3],d=e[4],f=e[5],p=e[6]);let m;e[7]===a?m=e[8]:(m=!a&&(0,Z.jsx)(qQ,{}),e[7]=a,e[8]=m);let h,g,_,v;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(_=!1,v=t?(0,Z.jsx)(Gg,{bridge:t}):null,h=(0,Z.jsx)(pQ,{}),g=t?(0,Z.jsxs)(Q.Suspense,{fallback:null,children:[(0,Z.jsx)(PQ,{bridge:t}),(0,Z.jsx)(FQ,{})]}):null,e[9]=h,e[10]=g,e[11]=_,e[12]=v):(h=e[9],g=e[10],_=e[11],v=e[12]);let y;e[13]===r?y=e[14]:(y=(0,Z.jsx)(Ng,{bridge:t,open:r,onOpenChange:i}),e[13]=r,e[14]=y);let b;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(b=n&&(0,Z.jsx)(`div`,{"aria-hidden":`true`,"data-testid":`editor-window-chrome-drag-strip`,"data-electron-drag":``,className:`pointer-events-none fixed inset-x-0 top-0 z-50 h-2 [-webkit-app-region:drag]`}),e[15]=b):b=e[15];let x;e[16]===a?x=e[17]:(x=!a&&(0,Z.jsx)(rQ,{onOpenSearch:()=>i(!0)}),e[16]=a,e[17]=x);let S;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(Zj,{className:`overflow-hidden h-[calc(100vh-var(--layout-inset-offset))]`,children:(0,Z.jsx)(II,{onOpenSearch:()=>i(!0)})}),e[18]=S):S=e[18];let C;e[19]===x?C=e[20]:(C=(0,Z.jsx)(va,{value:s,children:(0,Z.jsxs)(Gj,{className:`h-screen overflow-hidden`,children:[x,S]})}),e[19]=x,e[20]=C);let w;return e[21]!==y||e[22]!==C||e[23]!==m?(w=(0,Z.jsxs)(Z.Fragment,{children:[c,(0,Z.jsxs)(aa,{children:[l,u,d,f,p,m,_,v,h,g,y,b,C]})]}),e[21]=y,e[22]=C,e[23]=m,e[24]=w):w=e[24],w}function e$(e,t){eI(Oa(e,t),t)}function t$(e){let t=/\/([^/]+?)(?:\.git)?\/?$/.exec(e);return t?t[1]:`repo`}function n$(e){return{async getAuthStatus(){return e.authQueryTransport.status()},async startSignIn(){return e.openSignIn()},async runClone({url:t,branch:n}){let r=await e.bridge.dialog.openFolder();if(!r)return{kind:`cancelled`};let i=t$(t),a=`${r.replace(/\/$/,``)}/${i}`,o=hs.loading(Gc._({id:`GXf9hG`,values:{repoName:i}}),{duration:1/0}),s=typeof n==`string`&&n.length>0?n:null;try{let n=e.cloneTransport.start({url:t,dir:a,branch:s});for await(let e of n.events){if(e.type===`progress`){let t=e.phase,n=Math.round(e.pct);hs.loading(Gc._({id:`GXf9hG`,values:{repoName:i}}),{id:o,description:Gc._({id:`SCzAbA`,values:{phase:t,pct:n}}),duration:1/0});continue}if(e.type===`branch-fallback`){console.log(ad({branch_action:`fallback`,branch:e.branch})),hs.info(Gc._({id:`3JYy1p`,values:{0:e.branch}}),{duration:8e3});continue}if(e.type===`complete`)return hs.success(Gc._({id:`IRv9cH`,values:{repoName:i}}),{id:o,duration:4e3}),{kind:`ok`,dir:e.dir};if(e.type===`error`)return hs.dismiss(o),{kind:`error`,detail:e.message}}return hs.dismiss(o),{kind:`error`,detail:`Clone ended unexpectedly.`}}catch(e){console.warn(`[clone-controller] clone transport threw`,e);let t=e instanceof Error?e.message:`Unknown error`;return hs.dismiss(o),{kind:`error`,detail:t}}}}}function r$(){return{start(e){return za((t,n)=>{(async()=>{try{let r=await fetch(`/api/local-op/clone`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({url:e.url,dir:e.dir||void 0,branch:typeof e.branch==`string`&&e.branch.length>0?e.branch:void 0}),signal:n});if(!r.ok){let e=`Clone failed — check the URL and try again (${r.status})`;try{let t=await r.json(),n=sr.safeParse(t);n.success&&(e=`Clone failed: ${n.data.title}`)}catch{}t({type:`error`,message:e});return}if(!r.body){t({type:`error`,message:`Clone failed — empty response body`});return}let i=r.body.getReader(),a=new TextDecoder,o=``;for(;;){let{done:e,value:r}=await i.read();if(e)break;o+=a.decode(r,{stream:!0});let s=o.split(`
2003
- `);o=s.pop()??``;for(let e of s){if(!e.trim())continue;let n;try{n=JSON.parse(e)}catch{console.warn(`[clone-transport] Dropped unparseable NDJSON line:`,e.slice(0,100));continue}if(n&&typeof n==`object`&&n.type===`error`&&`problem`in n){let e=n.problem;t({type:`error`,message:e?.detail||e?.title||`Unknown error`});break}t(n)}if(n.aborted)break}n.aborted||t({type:`error`,message:`Clone stream ended unexpectedly — check if the clone completed`})}catch(e){if(e instanceof Error&&e.name===`AbortError`)return;t({type:`error`,message:`Clone failed — connection error`})}})()})}}}function i$(e){return{start(t){let n=typeof t.branch==`string`&&t.branch.length>0?t.branch:null;return e.localOp.clone.start({url:t.url,dir:t.dir,branch:n})}}}function a$(e){switch(e){case`receiving`:return{id:`qbfj1f`};case`resolving`:return{id:`adsMWO`};case`checking`:return{id:`1HBhDS`};case`init`:return{id:`LlHqdU`};case`done`:return{id:`bD8I7O`};default:return{id:`25Pw6a`}}}function o$(e){let t=e.trim();if(/^[\w.-]+\/[\w.-]+$/.test(t))return t.split(`/`)[1];try{return new URL(t.replace(/^git@([^:]+):/,`https://$1/`)).pathname.replace(/\.git$/,``).split(`/`).pop()??`repo`}catch{return t.split(`/`).pop()?.replace(/\.git$/,``)??`repo`}}function s$(e){let t=(0,$.c)(100),{open:n,onOpenChange:r,onSignIn:i,onCloneComplete:a,transport:o,authQueryTransport:s,pickParentFolder:c,initialUrl:l}=e,{_:u}=kt(),d;t[0]===o?d=t[1]:(d=o??r$(),t[0]=o,t[1]=d);let f=d,p;t[2]===s?p=t[3]:(p=s??ho(),t[2]=s,t[3]=p);let m=p,h=c!==void 0,[g,_]=(0,Q.useState)(``),[v,y]=(0,Q.useState)(``),[b,x]=(0,Q.useState)(null),[S,C]=(0,Q.useState)(!1),T;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(T=yo(),t[4]=T):T=t[4];let[E,D]=(0,Q.useState)(T),[O,k]=(0,Q.useState)(!1),[A,j]=(0,Q.useState)(!1),[M,N]=(0,Q.useState)(-1),P=(0,Q.useRef)(null),F=(0,Q.useRef)(null),I=(0,Q.useRef)(null),L=(0,Q.useId)(),R;t[5]!==n||t[6]!==m?(R=()=>{if(!n)return;let e=!1;return m.status().then(t=>{fo(t.authenticated),e||D(t.authenticated)}).catch(()=>{e||D(!1)}),()=>{e=!0}},t[5]=n,t[6]=m,t[7]=R):R=t[7];let z;t[8]===n?z=t[9]:(z=[n],t[8]=n,t[9]=z),(0,Q.useEffect)(R,z);let B;t[10]!==E||t[11]!==n||t[12]!==m?(B=()=>{if(!E||!n)return;let e=!1;return C(!0),m.repos().then(t=>{e||(x(t.ok?t.repos:[]),C(!1))}).catch(()=>{e||(x([]),C(!1))}),()=>{e=!0}},t[10]=E,t[11]=n,t[12]=m,t[13]=B):B=t[13];let V;t[14]!==E||t[15]!==n?(V=[E,n],t[14]=E,t[15]=n,t[16]=V):V=t[16],(0,Q.useEffect)(B,V);let H,U;t[17]!==l||t[18]!==n||t[19]!==h?(H=()=>{if(!n||!l||(_(l),h))return;let e=o$(l);e&&y(`~/Documents/${e}`)},U=[n,l,h],t[17]=l,t[18]=n,t[19]=h,t[20]=H,t[21]=U):(H=t[20],U=t[21]),(0,Q.useEffect)(H,U);let W,G;t[22]!==M||t[23]!==L?(W=()=>{M<0||document.getElementById(`${L}-opt-${M}`)?.scrollIntoView({block:`nearest`})},G=[M,L],t[22]=M,t[23]=L,t[24]=W,t[25]=G):(W=t[24],G=t[25]),(0,Q.useEffect)(W,G);let K;t[26]===h?K=t[27]:(K=function(e){if(_(e),j(!0),N(-1),h)return;let t=o$(e);t&&y(`~/Documents/${t}`)},t[26]=h,t[27]=K);let ee=K,te;t[28]===h?te=t[29]:(te=function(e){if(_(e.clone_url),h)return;let t=e.full_name.split(`/`)[1];y(`~/Documents/${t}`)},t[28]=h,t[29]=te);let ne=te,re;t[30]!==u||t[31]!==v||t[32]!==a||t[33]!==r||t[34]!==c||t[35]!==f||t[36]!==g?(re=async function(){let e=g.trim();if(!e){hs.error(u({id:`FTUGgh`}));return}let t=v||``;if(c){k(!0);let n=await c();if(!n){k(!1);return}let r=o$(e);t=`${n.replace(/\/$/,``)}/${r}`}else k(!0);let n=hs.loading(u({id:`2tgFCe`}),{duration:1/0});F.current=n;let i=f.start({url:e,dir:t});P.current=i.cancel;try{let e=i.events[Symbol.asyncIterator](),t=await e.next();for(;!t.done;){let i=t.value;if(i.type===`progress`){let e=u(a$(i.phase));hs.loading(`${e} — ${i.pct}%`,{id:n})}else if(i.type===`complete`){hs.success(u({id:`u_lS4C`}),{id:n}),r(!1),k(!1),P.current=null;let e=`port`in i?i.port:void 0;a?a({port:e,dir:i.dir}):e!==void 0&&(window.location.href=`http://localhost:${e}`);return}else if(i.type===`error`){let e=i.message;hs.error(u({id:`eFJkVt`,values:{cloneError:e}}),{id:n}),k(!1),P.current=null;return}t=await e.next()}hs.error(u({id:`Tz9pJB`}),{id:n}),k(!1),P.current=null}catch(e){console.error(`[CloneDialog] clone iteration failed:`,e),hs.error(u({id:`K9J00P`}),{id:n}),k(!1),P.current=null}},t[30]=u,t[31]=v,t[32]=a,t[33]=r,t[34]=c,t[35]=f,t[36]=g,t[37]=re):re=t[37];let q=re,oe;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(oe=function(){P.current?.(),P.current=null,k(!1),hs.dismiss(F.current??void 0)},t[38]=oe):oe=t[38];let se=oe,ce;t[39]!==O||t[40]!==r||t[41]!==h?(ce=function(e){O||(r(e),e||(_(``),h||y(``),j(!1),N(-1)))},t[39]=O,t[40]=r,t[41]=h,t[42]=ce):ce=t[42];let le=ce,ue;t[43]===ne?ue=t[44]:(ue=function(e){ne(e),j(!1),N(-1),I.current?.focus()},t[43]=ne,t[44]=ue);let de=ue,fe=E===null||S&&b===null,pe;if(t[45]!==b||t[46]!==g){let e=g.trim().toLowerCase(),n;t[48]===b?n=t[49]:(n=b??[],t[48]=b,t[49]=n),pe=n.filter(t=>`${t.full_name} ${t.clone_url}`.toLowerCase().includes(e)),t[45]=b,t[46]=g,t[47]=pe}else pe=t[47];let me=pe,he;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(he=/:\/\/|^git@|\.git$/i,t[50]=he):he=t[50];let ge;t[51]===g?ge=t[52]:(ge=he.test(g.trim()),t[51]=g,t[52]=ge);let _e=ge,ve=E===!0&&b!==null&&me.length===0&&!_e,ye=A&&E!==!1&&!O&&(fe||me.length>0||ve),be=me.length,xe=`${L}-loading`,Se,Ce;t[53]===be?(Se=t[54],Ce=t[55]):(Se=()=>{N(e=>e>=be?be-1:e)},Ce=[be],t[53]=be,t[54]=Se,t[55]=Ce),(0,Q.useEffect)(Se,Ce);let we;t[56]!==M||t[57]!==O||t[58]!==ye||t[59]!==de||t[60]!==me?(we=function(e){if(!O)if(e.key===`ArrowDown`){if(e.preventDefault(),!ye){j(!0);return}N(e=>Math.min(e+1,me.length-1))}else e.key===`ArrowUp`?(e.preventDefault(),N(p$)):e.key===`Enter`?ye&&M>=0&&M<me.length&&(e.preventDefault(),de(me[M])):e.key===`Escape`&&ye&&(e.preventDefault(),e.stopPropagation(),j(!1),N(-1))},t[56]=M,t[57]=O,t[58]=ye,t[59]=de,t[60]=me,t[61]=we):we=t[61];let Te=we,Ee;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=(0,Z.jsx)(Rs,{children:(0,Z.jsx)(Ps,{children:(0,Z.jsx)(J,{id:`VdXv4D`})})}),t[62]=Ee):Ee=t[62];let De;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(De=(0,Z.jsx)(`label`,{htmlFor:`clone-source`,className:`text-sm font-medium`,children:(0,Z.jsx)(J,{id:`IreQBq`})}),t[63]=De):De=t[63];let Oe;t[64]!==u||t[65]!==M||t[66]!==O||t[67]!==Te||t[68]!==ee||t[69]!==E||t[70]!==L||t[71]!==xe||t[72]!==i||t[73]!==ye||t[74]!==fe||t[75]!==b||t[76]!==de||t[77]!==me||t[78]!==g?(Oe=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[De,E===!1?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Uc,{id:`clone-source`,placeholder:u({id:`Xv_ijG`}),value:g,onChange:e=>ee(e.target.value),disabled:O}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-1sm text-muted-foreground`,children:[(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`9oE4C3`})}),(0,Z.jsx)(Jr,{variant:`link`,className:`h-auto p-0`,onClick:()=>i?.(),disabled:O,children:(0,Z.jsx)(J,{id:`3jod3l`})})]})]}):(0,Z.jsxs)(ae,{open:ye,onOpenChange:j,children:[(0,Z.jsx)(w,{asChild:!0,children:(0,Z.jsx)(Uc,{id:`clone-source`,ref:I,role:`combobox`,"aria-expanded":ye,"aria-controls":ye?fe?xe:L:void 0,"aria-activedescendant":M>=0?`${L}-opt-${M}`:void 0,"aria-autocomplete":`list`,autoComplete:`off`,placeholder:u({id:`R0jJzV`}),value:g,onChange:e=>ee(e.target.value),onFocus:()=>j(!0),onKeyDown:Te,disabled:O})}),(0,Z.jsx)(ie,{align:`start`,sideOffset:4,className:`w-(--radix-popover-trigger-width) max-h-56 overflow-y-auto overscroll-y-contain subtle-scrollbar p-0`,onOpenAutoFocus:f$,onCloseAutoFocus:d$,onInteractOutside:e=>{I.current?.contains(e.target)&&e.preventDefault()},onWheel:u$,onTouchMove:l$,children:fe?(0,Z.jsxs)(`output`,{id:xe,className:`flex flex-col gap-1.5 px-3 py-2`,"aria-label":u({id:`8XQRON`}),children:[(0,Z.jsx)(Ka,{className:`h-4 w-2/3`}),(0,Z.jsx)(Ka,{className:`h-4 w-1/2`}),(0,Z.jsx)(Ka,{className:`h-4 w-3/4`}),(0,Z.jsx)(Ka,{className:`h-4 w-2/5`})]}):(0,Z.jsx)(`div`,{id:L,role:`listbox`,"aria-label":u({id:`KX1MZR`}),className:`py-1`,children:me.length===0?(0,Z.jsx)(`div`,{role:`presentation`,className:`px-3 py-2 text-xs text-muted-foreground`,children:b&&b.length===0?(0,Z.jsx)(J,{id:`cOSAfL`}):(0,Z.jsx)(J,{id:`8eW0WQ`})}):me.map((e,t)=>(0,Z.jsxs)(`div`,{id:`${L}-opt-${t}`,role:`option`,tabIndex:-1,"aria-selected":t===M,onMouseDown:c$,onMouseEnter:()=>N(t),onClick:()=>de(e),className:X(`flex cursor-default items-center gap-2 px-3 py-1.5 text-sm`,t===M&&`bg-accent text-accent-foreground`),children:[e.private?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(sf,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`n5n_vi`})})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ra,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`NuH1jp`})})]}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.full_name})]},e.full_name))})})]})]}),t[64]=u,t[65]=M,t[66]=O,t[67]=Te,t[68]=ee,t[69]=E,t[70]=L,t[71]=xe,t[72]=i,t[73]=ye,t[74]=fe,t[75]=b,t[76]=de,t[77]=me,t[78]=g,t[79]=Oe):Oe=t[79];let ke;t[80]!==O||t[81]!==v||t[82]!==h?(ke=!h&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`label`,{htmlFor:`clone-path`,className:`text-sm font-medium`,children:(0,Z.jsx)(J,{id:`Gp_twO`})}),(0,Z.jsx)(Uc,{id:`clone-path`,placeholder:`~/Documents/repo-name`,value:v,onChange:e=>y(e.target.value),disabled:O})]}),t[80]=O,t[81]=v,t[82]=h,t[83]=ke):ke=t[83];let Ae;t[84]!==Oe||t[85]!==ke?(Ae=(0,Z.jsx)(Is,{children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[Oe,ke]})}),t[84]=Oe,t[85]=ke,t[86]=Ae):Ae=t[86];let je;t[87]!==O||t[88]!==q||t[89]!==le||t[90]!==g||t[91]!==h?(je=(0,Z.jsx)(Ls,{children:O?(0,Z.jsx)(Jr,{variant:`outline`,className:`font-mono uppercase`,onClick:se,children:(0,Z.jsx)(J,{id:`dEgA5A`})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Jr,{variant:`outline`,className:`font-mono uppercase`,onClick:()=>le(!1),children:(0,Z.jsx)(J,{id:`dEgA5A`})}),(0,Z.jsx)(Jr,{onClick:()=>void q(),disabled:!g.trim(),"aria-describedby":h?`clone-picker-hint`:void 0,children:(0,Z.jsx)(J,{id:`9UQ730`})}),h&&(0,Z.jsx)(`span`,{id:`clone-picker-hint`,className:`sr-only`,children:(0,Z.jsx)(J,{id:`EvPX7f`})})]})}),t[87]=O,t[88]=q,t[89]=le,t[90]=g,t[91]=h,t[92]=je):je=t[92];let Me;t[93]!==Ae||t[94]!==je?(Me=(0,Z.jsxs)(Fs,{className:`sm:max-w-lg`,children:[Ee,Ae,je]}),t[93]=Ae,t[94]=je,t[95]=Me):Me=t[95];let Ne;return t[96]!==le||t[97]!==n||t[98]!==Me?(Ne=(0,Z.jsx)(zs,{open:n,onOpenChange:le,children:Me}),t[96]=le,t[97]=n,t[98]=Me,t[99]=Ne):Ne=t[99],Ne}function c$(e){return e.preventDefault()}function l$(e){return e.stopPropagation()}function u$(e){return e.stopPropagation()}function d$(e){return e.preventDefault()}function f$(e){return e.preventDefault()}function p$(e){return Math.max(e-1,-1)}var m$=(0,Q.lazy)(()=>n(()=>import(`./ConsentDialogBody-CG9T8kVb.js`),__vite__mapDeps([113,1,6,7,81,20,21,15,13,16,63,64,60,61,62,66,114,83,84,17,18,19,70,73,89]),import.meta.url));function h$(){let e=(0,$.c)(1);if(!(0,Q.useSyncExternalStore)(Hc.subscribe,_$,g$))return null;let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(m$,{})}),e[0]=t):t=e[0],t}function g$(){return!1}function _$(){return Hc.getSnapshot()!==null}function v$(e){let t=(0,$.c)(5),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`OpenKnowledge icon`}),t[0]=n):n=t[0];let r;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsxs)(`g`,{filter:`url(#filter0_d_ok)`,children:[(0,Z.jsx)(`path`,{d:`M66.8902 16.1017C58.2694 3.86669 46.1739 -0.690239 29.9182 2.17749C21.3995 3.67813 13.4602 9.555 8.67934 17.9009C3.93974 26.1701 2.98514 35.6533 6.05714 43.9166C9.31574 52.6868 16.7168 58.4752 24.2299 63.4231C25.7973 64.4562 26.1351 65.7172 26.3551 68.9896C26.5221 71.4625 26.799 75.6011 30.6842 77.7204C31.8176 78.3372 33.0648 78.6515 34.3946 78.6515C37.0796 78.6515 39.4033 77.3649 40.5189 76.7482C47.1049 73.1046 68.8878 59.7147 72.6453 40.4027C74.3444 31.6679 70.9797 21.9019 66.8922 16.1017H66.8902Z`,fill:`white`}),(0,Z.jsx)(`path`,{d:`M37.4214 71.154C28.7888 75.929 36.787 64.0397 27.7458 58.0843C21.6372 54.0616 14.788 49.0568 12.0499 41.6911C6.74463 27.4192 17.5438 10.8473 31.028 8.47262C45.1977 5.97613 54.6946 9.8947 61.6635 19.7844C65.2089 24.8167 67.6013 32.8365 66.3658 39.1828C63.6906 52.9341 49.073 64.7075 37.4214 71.154Z`,fill:`#69A3FF`}),(0,Z.jsx)(`path`,{d:`M52.7244 29.2638C53.4665 28.5217 54.6697 28.5217 55.4119 29.2638V29.2638C56.154 30.0059 56.154 31.2091 55.4119 31.9513L49.2589 38.1042L46.5715 35.4167L52.7244 29.2638Z`,fill:`#D5E5FF`}),(0,Z.jsx)(`path`,{d:`M55.4119 38.8821C56.154 39.6242 56.154 40.8274 55.4119 41.5696V41.5696C54.6698 42.3117 53.4665 42.3117 52.7244 41.5696L46.5715 35.4166L49.259 32.7292L55.4119 38.8821Z`,fill:`#D5E5FF`})]}),t[1]=r):r=t[1];let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(`defs`,{children:(0,Z.jsxs)(`filter`,{id:`filter0_d_ok`,x:`-9.53674e-07`,y:`-0.0799994`,width:`77.3817`,height:`85.8743`,filterUnits:`userSpaceOnUse`,colorInterpolationFilters:`sRGB`,children:[(0,Z.jsx)(`feFlood`,{floodOpacity:`0`,result:`BackgroundImageFix`}),(0,Z.jsx)(`feColorMatrix`,{in:`SourceAlpha`,type:`matrix`,values:`0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0`,result:`hardAlpha`}),(0,Z.jsx)(`feOffset`,{dy:`2.85714`}),(0,Z.jsx)(`feGaussianBlur`,{stdDeviation:`2.14286`}),(0,Z.jsx)(`feComposite`,{in2:`hardAlpha`,operator:`out`}),(0,Z.jsx)(`feColorMatrix`,{type:`matrix`,values:`0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 0`}),(0,Z.jsx)(`feBlend`,{mode:`normal`,in2:`BackgroundImageFix`,result:`effect1_dropShadow_ok`}),(0,Z.jsx)(`feBlend`,{mode:`normal`,in:`SourceGraphic`,in2:`effect1_dropShadow_ok`,result:`shape`})]})}),t[2]=i):i=t[2];let a;return t[3]===e?a=t[4]:(a=(0,Z.jsxs)(`svg`,{role:`img`,"aria-label":`OpenKnowledge icon`,fill:`none`,height:24,width:24,viewBox:`0 0 78 80`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[n,r,i]}),t[3]=e,t[4]=a),a}var y$=(0,Q.lazy)(()=>n(()=>import(`./ShareReceiveDialog-C2putkgB.js`).then(e=>({default:e.ShareReceiveDialog})),__vite__mapDeps([115,1,10,3,11,6,7,13,61,15,16,62,71,108,109,110]),import.meta.url)),b$=(e,t,n)=>dg(e,t,n,`NavigatorApp`);function x$(e,t){return e.filter(e=>e.path!==t)}function S$(e){let t=(0,$.c)(106),{bridge:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=[],t[0]=r):r=t[0];let[i,a]=(0,Q.useState)(r),o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=new Map,t[1]=o):o=t[1];let[s,c]=(0,Q.useState)(o),[l,u]=(0,Q.useState)(!0),[d,f]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(null),[_,v]=(0,Q.useState)(!1),[y,b]=(0,Q.useState)(!1),[x,S]=(0,Q.useState)(void 0),[C,w]=(0,Q.useState)(void 0),[T,E]=(0,Q.useState)(!1),[D,O]=(0,Q.useState)(!1),[k,A]=(0,Q.useState)(null),j=typeof window<`u`&&window.okDesktop!=null,[M,N]=(0,Q.useState)(`auth`),{theme:P}=sn(),{_:F}=kt();Il(n,P??`system`);let I;t[2]!==F||t[3]!==n.project?(I=()=>{let e=!1;return n.project.listRecent().then(async t=>{if(e)return;a(t);let r=t.filter(C$),i=await Promise.all(r.map(async e=>{try{let{currentBranch:t}=await n.project.readHeadBranch(e.path);return[e.path,t]}catch{return[e.path,null]}}));e||c(e=>{let t=new Map(e);for(let[e,n]of i)t.set(e,n);return t})}).catch(t=>{console.error(`[NavigatorApp] listRecent failed:`,t),e||(m(t instanceof Error?t.message:F({id:`fYKgzG`})),f(!0))}).finally(()=>{e||u(!1)}),()=>{e=!0}},t[2]=F,t[3]=n.project,t[4]=I):I=t[4];let L;t[5]!==F||t[6]!==n?(L=[n,F],t[5]=F,t[6]=n,t[7]=L):L=t[7],(0,Q.useEffect)(I,L);let R,z;t[8]===n?(R=t[9],z=t[10]):(R=()=>n.onMenuAction(e=>{e===`new-project`&&b(!0),e===`close-active-tab-or-window`&&window.close()}),z=[n],t[8]=n,t[9]=R,t[10]=z),(0,Q.useEffect)(R,z);let B;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(B=(e,t)=>b$(e,t,m),t[11]=B):B=t[11];let V=B,H;t[12]!==F||t[13]!==n?(H=(e,t,r)=>V(()=>(g(r),D$(n,e,t).finally(()=>g(null))),F({id:`SUOoXn`})),t[12]=F,t[13]=n,t[14]=H):H=t[14];let U=H,W;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(W=()=>v(!0),t[15]=W):W=t[15];let G=W,K;t[16]!==F||t[17]!==n?(K=()=>V(async()=>{let e=await n.dialog.openFolder();e&&(g(O$(e)),await D$(n,e,`pick-existing`).finally(()=>g(null)))},F({id:`gmJ0An`})),t[16]=F,t[17]=n,t[18]=K):K=t[18];let ee=K,te;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(te=()=>b(!0),t[19]=te):te=t[19];let ne=te,re;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(re=(e,t)=>{S(e),w(t),b(!0)},t[20]=re):re=t[20];let ie=re,q;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(q=e=>{b(e),e||(S(void 0),w(void 0))},t[21]=q):q=t[21];let ae=q,oe;t[22]===U?oe=t[23]:(oe=e=>U(e,`recents`,O$(e)),t[22]=U,t[23]=oe);let se=oe,ce;t[24]!==F||t[25]!==n.project?(ce=e=>V(async()=>{await n.project.removeRecent(e),a(t=>x$(t,e)),c(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},F({id:`viwC-K`})),t[24]=F,t[25]=n.project,t[26]=ce):ce=t[26];let le=ce,ue;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(ue=(0,Z.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 top-0 z-10 h-9 ${j?`[-webkit-app-region:drag]`:``}`,"data-electron-drag":j?``:void 0,"data-testid":`nav-chrome-row`}),t[27]=ue):ue=t[27];let de;t[28]!==F||t[29]!==h?(de=h===null?null:(0,Z.jsxs)(`div`,{className:`absolute inset-0 z-20 flex flex-col items-center justify-center gap-3 bg-primary-foreground/85 dark:bg-background/85 backdrop-blur-sm`,"data-testid":`nav-opening-overlay`,role:`status`,"aria-live":`polite`,children:[(0,Z.jsx)(ns,{className:`size-6 animate-spin text-muted-foreground`}),(0,Z.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:F({id:`s0_GnA`,values:{openingLabel:h}})})]}),t[28]=F,t[29]=h,t[30]=de):de=t[30];let fe;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(fe=(0,Z.jsx)(v$,{className:`size-12 shrink-0`}),t[31]=fe):fe=t[31];let pe;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(pe=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`h1`,{className:`font-medium text-xl tracking-tight`,children:`OpenKnowledge`}),(0,Z.jsx)(JN,{})]}),t[32]=pe):pe=t[32];let me;t[33]===n.appVersion?me=t[34]:(me=(0,Z.jsxs)(`header`,{className:`shrink-0 flex-wrap flex items-center gap-2.5`,children:[fe,(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[pe,(0,Z.jsxs)(`p`,{className:`text-muted-foreground text-xs font-mono`,children:[`v`,n.appVersion]})]})]}),t[33]=n.appVersion,t[34]=me);let he;t[35]!==F||t[36]!==l||t[37]!==ee||t[38]!==i||t[39]!==d?(he=l?null:!d&&i.length===0?(0,Z.jsx)(T$,{onPackSelect:ie,onOpenFolder:ee,onClone:G,onCreate:ne}):(0,Z.jsxs)(`section`,{className:`grid shrink-0 sm:grid-cols-3 gap-3`,children:[(0,Z.jsx)(w$,{title:F({id:`wbv9xO`}),description:F({id:`0uTHCg`}),onClick:ne,dataTestId:`nav-create-new`,Icon:nt}),(0,Z.jsx)(w$,{title:F({id:`WPwDin`}),description:F({id:`tUvUfp`}),onClick:ee,dataTestId:`nav-open`,Icon:Ro}),(0,Z.jsx)(w$,{title:F({id:`VdXv4D`}),description:F({id:`JOcPqH`}),onClick:G,dataTestId:`nav-clone`,Icon:kF})]}),t[35]=F,t[36]=l,t[37]=ee,t[38]=i,t[39]=d,t[40]=he):he=t[40];let ge;t[41]===p?ge=t[42]:(ge=p===null?null:(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 rounded-md border border-red-500/30 bg-red-500/10 px-3 py-2`,"data-testid":`nav-error-banner`,role:`alert`,children:[(0,Z.jsx)(`span`,{className:`text-red-700 text-xs dark:text-red-300`,children:p}),(0,Z.jsx)(Jr,{type:`button`,variant:`link`,size:`sm`,onClick:()=>m(null),className:`h-auto p-0 text-red-700 text-xs dark:text-red-300`,"data-testid":`nav-error-dismiss`,children:(0,Z.jsx)(J,{id:`1QfxQT`})})]}),t[41]=p,t[42]=ge);let _e;t[43]!==l||t[44]!==se||t[45]!==le||t[46]!==s||t[47]!==i?(_e=l?(0,Z.jsx)(`section`,{className:`flex shrink-0 flex-col items-center`,children:(0,Z.jsx)(ns,{className:`size-4 animate-spin text-muted-foreground/60`})}):i.length>0?(0,Z.jsxs)(`section`,{className:`flex min-h-0 flex-col`,children:[(0,Z.jsx)(`h2`,{className:`mb-2 shrink-0 font-medium text-muted-foreground font-mono text-xs uppercase tracking-wide`,children:(0,Z.jsx)(J,{id:`CCTop_`})}),(0,Z.jsx)(`ul`,{className:`min-h-0 max-h-48 subtle-scrollbar scroll-fade-mask overflow-y-auto space-y-0.5 -mx-4`,"data-testid":`nav-recent-list`,children:i.map(e=>(0,Z.jsx)(E$,{project:e,branch:s.get(e.path)??null,onOpen:()=>se(e.path),onRemove:()=>le(e.path)},e.path))})]}):null,t[43]=l,t[44]=se,t[45]=le,t[46]=s,t[47]=i,t[48]=_e):_e=t[48];let ve;t[49]!==me||t[50]!==he||t[51]!==ge||t[52]!==_e?(ve=(0,Z.jsx)(`div`,{className:`mx-auto flex h-full w-full max-w-5xl flex-col overflow-hidden px-12 py-12`,children:(0,Z.jsxs)(`div`,{className:`my-auto flex min-h-0 flex-col space-y-10`,children:[me,he,ge,_e]})}),t[49]=me,t[50]=he,t[51]=ge,t[52]=_e,t[53]=ve):ve=t[53];let ye,be;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(ye=(0,Z.jsx)(pQ,{}),be=(0,Z.jsx)(h$,{}),t[54]=ye,t[55]=be):(ye=t[54],be=t[55]);let xe;t[56]!==n||t[57]!==y||t[58]!==x||t[59]!==C?(xe=(0,Z.jsx)(_m,{open:y,onOpenChange:ae,bridge:n,initialPackId:x,packs:C}),t[56]=n,t[57]=y,t[58]=x,t[59]=C,t[60]=xe):xe=t[60];let Se;t[61]===k?Se=t[62]:(Se=e=>{E(e),e||(O(!1),k&&(k(null),A(null)))},t[61]=k,t[62]=Se);let Ce;t[63]===n?Ce=t[64]:(Ce=Fa(n),t[63]=n,t[64]=Ce);let we;t[65]===n?we=t[66]:(we=Ra(n),t[65]=n,t[66]=we);let Te=M===`identity`,Ee;t[67]!==D||t[68]!==k?(Ee=e=>{E(!1),D&&(O(!1),v(!0)),k&&(k({authenticated:!0,host:`github.com`,login:e.login}),A(null))},t[67]=D,t[68]=k,t[69]=Ee):Ee=t[69];let De;t[70]!==T||t[71]!==Se||t[72]!==Ce||t[73]!==we||t[74]!==Te||t[75]!==Ee?(De=(0,Z.jsx)(Ja,{open:T,onOpenChange:Se,transport:Ce,queryTransport:we,identityPrompt:Te,onSuccess:Ee}),t[70]=T,t[71]=Se,t[72]=Ce,t[73]=we,t[74]=Te,t[75]=Ee,t[76]=De):De=t[76];let Oe;t[77]===n?Oe=t[78]:(Oe=i$(n),t[77]=n,t[78]=Oe);let ke;t[79]===n?ke=t[80]:(ke=Ra(n),t[79]=n,t[80]=ke);let Ae;t[81]===n.dialog?Ae=t[82]:(Ae=()=>n.dialog.openFolder(),t[81]=n.dialog,t[82]=Ae);let je;t[83]===Symbol.for(`react.memo_cache_sentinel`)?(je=()=>{v(!1),N(`auth`),O(!0),E(!0)},t[83]=je):je=t[83];let Me;t[84]!==F||t[85]!==n?(Me=e=>{let{dir:t}=e;V(()=>(g(O$(t)),D$(n,t,`pick-existing`).finally(()=>g(null))),F({id:`iSnkwB`}))},t[84]=F,t[85]=n,t[86]=Me):Me=t[86];let Ne;t[87]!==_||t[88]!==Oe||t[89]!==ke||t[90]!==Ae||t[91]!==Me?(Ne=(0,Z.jsx)(s$,{open:_,onOpenChange:v,transport:Oe,authQueryTransport:ke,pickParentFolder:Ae,onSignIn:je,onCloneComplete:Me}),t[87]=_,t[88]=Oe,t[89]=ke,t[90]=Ae,t[91]=Me,t[92]=Ne):Ne=t[92];let Pe;if(t[93]!==n){let e;t[95]===Symbol.for(`react.memo_cache_sentinel`)?(e=()=>new Promise(e=>{A(()=>e),E(!0)}),t[95]=e):e=t[95],Pe=n$({bridge:n,authQueryTransport:Ra(n),cloneTransport:i$(n),openSignIn:e}),t[93]=n,t[94]=Pe}else Pe=t[94];let Fe;t[96]!==n||t[97]!==Pe?(Fe=(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(y$,{bridge:n,cloneController:Pe})}),t[96]=n,t[97]=Pe,t[98]=Fe):Fe=t[98];let Ie;return t[99]!==de||t[100]!==ve||t[101]!==xe||t[102]!==De||t[103]!==Ne||t[104]!==Fe?(Ie=(0,Z.jsxs)(`div`,{className:`relative flex h-screen w-screen flex-col overflow-hidden bg-primary-foreground dark:bg-background text-foreground`,children:[ue,de,ve,ye,be,xe,De,Ne,Fe]}),t[99]=de,t[100]=ve,t[101]=xe,t[102]=De,t[103]=Ne,t[104]=Fe,t[105]=Ie):Ie=t[105],Ie}function C$(e){return!e.missing}function w$(e){let t=(0,$.c)(14),{title:n,description:r,onClick:i,dataTestId:a,Icon:o}=e,s;t[0]===o?s=t[1]:(s=o?(0,Z.jsx)(o,{className:`size-4 shrink-0 text-muted-foreground`}):null,t[0]=o,t[1]=s);let c;t[2]===n?c=t[3]:(c=(0,Z.jsx)(`span`,{className:`font-medium text-gray-700 dark:text-foreground text-sm`,children:n}),t[2]=n,t[3]=c);let l;t[4]!==s||t[5]!==c?(l=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[s,c]}),t[4]=s,t[5]=c,t[6]=l):l=t[6];let u;t[7]===r?u=t[8]:(u=(0,Z.jsx)(`span`,{className:`line-clamp-2 text-muted-foreground text-xs leading-snug`,children:r}),t[7]=r,t[8]=u);let d;return t[9]!==a||t[10]!==i||t[11]!==l||t[12]!==u?(d=(0,Z.jsxs)(Jr,{type:`button`,variant:`outline`,onClick:i,"data-testid":a,className:`h-auto flex-col items-start justify-start gap-1.5 whitespace-normal bg-card px-4 py-3.5 text-left`,children:[l,u]}),t[9]=a,t[10]=i,t[11]=l,t[12]=u,t[13]=d):d=t[13],d}function T$(e){let t=(0,$.c)(31),{onPackSelect:n,onOpenFolder:r,onClone:i,onCreate:a}=e,[o,s]=(0,Q.useState)(null),c,l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>{let e=!1;return(async()=>{try{let t=await Bh().listPacks();if(e)return;t.ok?s(t.packs):(console.error(`[NavigatorApp] listPacks returned error:`,t),s([]))}catch(t){let n=t;if(e)return;console.error(`[NavigatorApp] listPacks failed:`,n),s([])}})(),()=>{e=!0}},l=[],t[0]=c,t[1]=l):(c=t[0],l=t[1]),(0,Q.useEffect)(c,l);let u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(`h2`,{className:`text-xl font-light tracking-tighter text-balance`,children:(0,Z.jsx)(J,{id:`QnjpOq`})}),t[2]=u):u=t[2];let d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-1`,children:[u,(0,Z.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:(0,Z.jsx)(J,{id:`gYuDfu`})})]}),t[3]=d):d=t[3];let f;t[4]!==n||t[5]!==o?(f=e=>n(e,o??[]),t[4]=n,t[5]=o,t[6]=f):f=t[6];let p;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(p=[`okf`,`entity-vault`],t[7]=p):p=t[7];let m;t[8]!==o||t[9]!==f?(m=(0,Z.jsx)(`div`,{className:`-m-1 min-h-0 flex-1 overflow-y-auto subtle-scrollbar p-1`,children:(0,Z.jsx)(Uh,{packs:o,onPackSelect:f,collapsedPackIds:p})}),t[8]=o,t[9]=f,t[10]=m):m=t[10];let h;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(`span`,{className:`text-muted-foreground text-sm`,children:(0,Z.jsx)(J,{id:`S34Vju`})}),t[11]=h):h=t[11];let g,_;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(Ro,{"aria-hidden":`true`,className:`size-3.5`}),g=(0,Z.jsx)(J,{id:`PVUn_c`}),t[12]=g,t[13]=_):(g=t[12],_=t[13]);let v;t[14]===r?v=t[15]:(v=(0,Z.jsxs)(Jr,{type:`button`,variant:`link-muted`,size:`sm`,onClick:r,"data-testid":`nav-first-run-open`,children:[_,g]}),t[14]=r,t[15]=v);let y,b;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(kF,{"aria-hidden":`true`,className:`size-3.5`}),b=(0,Z.jsx)(J,{id:`VdXv4D`}),t[16]=y,t[17]=b):(y=t[16],b=t[17]);let x;t[18]===i?x=t[19]:(x=(0,Z.jsxs)(Jr,{type:`button`,variant:`link-muted`,size:`sm`,onClick:i,"data-testid":`nav-first-run-clone`,children:[y,b]}),t[18]=i,t[19]=x);let S,C;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(nt,{"aria-hidden":`true`,className:`size-3.5`}),C=(0,Z.jsx)(J,{id:`ircigK`}),t[20]=S,t[21]=C):(S=t[20],C=t[21]);let w;t[22]===a?w=t[23]:(w=(0,Z.jsxs)(Jr,{type:`button`,variant:`link-muted`,size:`sm`,onClick:a,"data-testid":`nav-first-run-blank`,children:[S,C]}),t[22]=a,t[23]=w);let T;t[24]!==v||t[25]!==x||t[26]!==w?(T=(0,Z.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-x-3 gap-y-1`,"data-testid":`nav-first-run-secondary`,children:[h,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-1 gap-y-1`,children:[v,x,w]})]}),t[24]=v,t[25]=x,t[26]=w,t[27]=T):T=t[27];let E;return t[28]!==T||t[29]!==m?(E=(0,Z.jsxs)(`section`,{className:`flex min-h-0 shrink flex-col gap-6`,"data-testid":`nav-first-run`,children:[d,m,T]}),t[28]=T,t[29]=m,t[30]=E):E=t[30],E}function E$(e){let t=(0,$.c)(44),{project:n,branch:r,onOpen:i,onRemove:a}=e,{_:o}=kt(),{name:c}=n,l=n.isLinkedWorktree===!0,u=l?n.branch??r:r,d=n.missing,f=n.missing&&`opacity-50`,p;t[0]===f?p=t[1]:(p=X(`h-auto min-w-0 flex-1 justify-between gap-3 py-3.5 pl-4 pr-2 text-left hover:bg-transparent`,f),t[0]=f,t[1]=p);let m;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(Jd,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-muted-foreground`}),t[2]=m):m=t[2];let h;t[3]===n.name?h=t[4]:(h=(0,Z.jsx)(`span`,{className:`truncate font-medium text-sm text-gray-700 dark:text-foreground`,children:n.name}),t[3]=n.name,t[4]=h);let g;t[5]===l?g=t[6]:(g=l?(0,Z.jsxs)(s,{variant:`secondary`,className:`shrink-0 gap-1 rounded-full border-transparent bg-green-600/10 px-2 py-0 font-medium text-2xs text-green-800 dark:bg-green-400/10 dark:text-green-400`,children:[(0,Z.jsx)(zo,{"aria-hidden":`true`,className:`size-2.5`}),(0,Z.jsx)(J,{id:`z-lawV`})]}):null,t[5]=l,t[6]=g);let _;t[7]!==h||t[8]!==g?(_=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[h,g]}),t[7]=h,t[8]=g,t[9]=_):_=t[9];let v=l?n.mainRoot??``:n.path,y;t[10]!==l||t[11]!==n.mainRoot||t[12]!==n.path?(y=l?(0,Z.jsx)(J,{id:`PRnH8G`,values:{0:bg(n.mainRoot??``)}}):n.path,t[10]=l,t[11]=n.mainRoot,t[12]=n.path,t[13]=y):y=t[13];let b;t[14]!==v||t[15]!==y?(b=(0,Z.jsx)(`span`,{className:`truncate w-full text-muted-foreground text-xs`,title:v,children:y}),t[14]=v,t[15]=y,t[16]=b):b=t[16];let x;t[17]!==b||t[18]!==_?(x=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[m,(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1 truncate`,children:[_,b]})]}),t[17]=b,t[18]=_,t[19]=x):x=t[19];let S;t[20]!==n.missing||t[21]!==n.path||t[22]!==u?(S=n.missing?(0,Z.jsx)(s,{className:`text-2xs rounded-sm`,variant:`warning`,children:(0,Z.jsx)(J,{id:`VU3Nrn`})}):u==null?null:(0,Z.jsxs)(`span`,{className:`flex max-w-[40%] items-center gap-1 text-muted-foreground text-xs`,"data-testid":`nav-recent-branch-${n.path}`,children:[(0,Z.jsx)(zo,{"aria-hidden":`true`,className:`size-3 shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate font-mono`,children:u})]}),t[20]=n.missing,t[21]=n.path,t[22]=u,t[23]=S):S=t[23];let C;t[24]!==i||t[25]!==n.missing||t[26]!==x||t[27]!==S||t[28]!==p?(C=(0,Z.jsxs)(Jr,{type:`button`,variant:`ghost`,onClick:i,disabled:d,className:p,children:[x,S]}),t[24]=i,t[25]=n.missing,t[26]=x,t[27]=S,t[28]=p,t[29]=C):C=t[29];let w;t[30]!==o||t[31]!==c?(w=o({id:`hDoLrm`,values:{projectName:c}}),t[30]=o,t[31]=c,t[32]=w):w=t[32];let T;t[33]===o?T=t[34]:(T=o({id:`Es-eZU`}),t[33]=o,t[34]=T);let E=`nav-recent-remove-${n.path}`,D;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsx)(gs,{"aria-hidden":`true`}),t[35]=D):D=t[35];let O;t[36]!==a||t[37]!==w||t[38]!==T||t[39]!==E?(O=(0,Z.jsx)(Jr,{type:`button`,variant:`ghost`,size:`icon-sm`,onClick:a,"aria-label":w,title:T,className:`pointer-events-none mr-2 opacity-0 group-hover:pointer-events-auto group-hover:opacity-100 focus-visible:pointer-events-auto focus-visible:opacity-100`,"data-testid":E,children:D}),t[36]=a,t[37]=w,t[38]=T,t[39]=E,t[40]=O):O=t[40];let k;return t[41]!==C||t[42]!==O?(k=(0,Z.jsxs)(`li`,{className:`group flex items-center justify-between rounded-lg hover:bg-accent`,children:[C,O]}),t[41]=C,t[42]=O,t[43]=k):k=t[43],k}async function D$(e,t,n){await e.project.open({path:t,target:`new-window`,entryPoint:n})}function O$(e){let t=e.split(/[/\\]/).filter(Boolean);return t.length>0?t[t.length-1]??e:e}function k$(e){let t=(0,$.c)(5),{bridge:n}=e,r=n.config.collabUrl?n.config.collabUrl:null,i;t[0]===n?i=t[1]:(i=(0,Z.jsx)(A$,{bridge:n}),t[0]=n,t[1]=i);let a;return t[2]!==r||t[3]!==i?(a=(0,Z.jsx)(Ll,{collabUrl:r,children:i}),t[2]=r,t[3]=i,t[4]=a):a=t[4],a}function A$(e){let t=(0,$.c)(11),{bridge:n}=e,{resolvedTheme:r}=sn(),i=a_(),[a,o]=(0,Q.useState)(null),s;t[0]===r?s=t[1]:(s=Au(r),t[0]=r,t[1]=s);let c;t[2]===s.background?c=t[3]:(c=(0,Z.jsx)(`div`,{ref:o,className:`flex h-screen min-h-0 flex-col`,style:{backgroundColor:s.background}}),t[2]=s.background,t[3]=c);let l;t[4]!==n||t[5]!==a||t[6]!==i?(l=(0,Z.jsx)(wI,{bridge:n,variant:`window`,visible:!0,onVisibleChange:M$,installedClis:i,container:a,isShowing:!0,onRequestEditorFocus:j$}),t[4]=n,t[5]=a,t[6]=i,t[7]=l):l=t[7];let u;return t[8]!==c||t[9]!==l?(u=(0,Z.jsxs)(Z.Fragment,{children:[c,l]}),t[8]=c,t[9]=l,t[10]=u):u=t[10],u}function j$(){}function M$(e){e||window.close()}function N$(e){return e?.config.mode===`terminal`?(0,Z.jsx)(k$,{bridge:e}):e?.config.mode===`navigator`?(0,Z.jsx)(S$,{bridge:e}):(0,Z.jsx)(QQ,{})}var P$=e=>{let t=(0,$.c)(8),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let{theme:r}=sn(),i=r===void 0?`system`:r,a,o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a={success:(0,Z.jsx)(oa,{className:`size-4`}),info:(0,Z.jsx)(ts,{className:`size-4`}),warning:(0,Z.jsx)(os,{className:`size-4`}),error:(0,Z.jsx)(df,{className:`size-4`}),loading:(0,Z.jsx)(ns,{className:`size-4 animate-spin`})},o={"--normal-bg":`var(--popover)`,"--normal-text":`var(--popover-foreground)`,"--normal-border":`var(--border)`,"--border-radius":`var(--radius)`},t[2]=a,t[3]=o):(a=t[2],o=t[3]);let s;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(s={classNames:{toast:`cn-toast`}},t[4]=s):s=t[4];let c;return t[5]!==n||t[6]!==i?(c=(0,Z.jsx)(_s,{theme:i,className:`toaster group`,icons:a,style:o,toastOptions:s,...n}),t[5]=n,t[6]=i,t[7]=c):c=t[7],c},F$=Symbol.for(`ok.client.fetchWrapper`);function I$(e={}){if(typeof window>`u`)return;let t=e.apiOrigin&&e.apiOrigin.length>0?e.apiOrigin:void 0;if(window.fetch[F$])return;let n=window.fetch.bind(window),r=Pl(),i=((e,i)=>{let a=R$(e,t);if(!a.isApi)return n(e,i);if(e instanceof Request){let t=L$(e.headers,r);return n(new Request(a.url,e),{headers:t})}let o=L$(i?.headers,r);return n(a.url,{...i,headers:o})});i[F$]=!0,window.fetch=i}function L$(e,t){let n=new Headers(e);for(let[e,r]of Object.entries(t))n.set(e,r);return n}function R$(e,t){if(typeof e==`string`){if(e.startsWith(`/api/`))return{isApi:!0,url:t?t+e:e};let n=z$(e);return n&&B$(n,t)?{isApi:!0,url:e}:{isApi:!1,url:e}}let n=e instanceof URL?e:z$(e.url,window.location.origin);if(n&&B$(n,t)){let r=e instanceof URL?e.href:e.url;return t&&(n.origin===window.location.origin||n.protocol===`file:`)?{isApi:!0,url:t+n.pathname+n.search+n.hash}:{isApi:!0,url:r}}return{isApi:!1,url:e instanceof URL?e.href:e.url}}function z$(e,t){try{return new URL(e,t)}catch{return null}}function B$(e,t){if(!e.pathname.startsWith(`/api/`))return!1;if(e.origin===window.location.origin||e.protocol===`file:`)return!0;if(t){let n=z$(t);if(n&&e.origin===n.origin)return!0}return!1}var V$={messages:JSON.parse(`{"--T3kB":["Loading preview"],"-3Qbv7":[["count","plural",{"one":["matches ","#"," file"],"other":["matches ","#"," files"]}]],"-3ois8":["Hard break"],"-5jISU":[["0","plural",{"one":["#"," template"],"other":["#"," templates"]}]],"-8PP0T":["Match case"],"-K0AvT":["Disconnect"],"-LHLx7":["edited template"],"-QCLWk":["Templates available"],"-Qw-1t":["GitHub authentication failed. Try signing in again."],"-WFFG2":["Default properties"],"-YV1Uo":["Pattern ",["patternNumber"]],"-g6KIS":["Unrecognized link"],"-gdcIo":["Auto-sync is on — your commits push and remote changes pull on intervals."],"-i7ik4":["Collapse burst ",["burstNumber"]," diff"],"-lCAuQ":["Loading graph"],"-q4abP":["Results capped — this workspace has more files than search can index. A missing file may be a cap artifact, not a typo."],"-r_Kx7":["Create skill"],"-slrNR":["Toggle a task list."],"-uaQnI":["No matching worktrees or branches."],"-wePNM":["Search matches file names, paths, and folders. Open a file to search its body (⌘F)."],"-zA2E7":["Couldn't create the worktree. Try a different name."],"-zy2Nq":["Type"],"0-31GV":["Removing"],"00c7t0":["Ask AI about this code block"],"02P3hL":["Upload failed: ",["message"]],"04RA0-":["Failed to enable sync — ",["detail"]],"04XyCH":["Adds a managed block to ",["0"]],"05n5wS":["Doc mention suggestions"],"06SZfb":["Template \\"",["trimmedTitle"],"\\" created"],"07eGJB":["Couldn't move skill: ",["0"]],"07gHun":["You don't have access to this private repo. Sign in with an account that does."],"07q4Qk":["File sidebar"],"09Tv5j":["Reconnecting…"],"0BB9ID":["No headings yet."],"0BfhAj":["Reset view"],"0E9DR6":["Type to find a doc"],"0Er6-M":["Restarting"],"0Gd0NU":["Shared"],"0LBDjY":["\\"",["0"],"\\" uninstalled — back to a draft"],"0NA4b3":["Keep my version"],"0SBTff":["Show terminal"],"0TnCvC":["Rename ",["0"]],"0YEbfk":["Connect to AI tools"],"0YUS3Q":["Subfolder under current folder"],"0_J12R":["New file from template \\"",["displayTitle"],"\\" (",["fileName"],") in ",["targetLabel"]],"0eHrMb":["Could not complete delete"],"0g7rCZ":["Duplicated to \\"",["0"],"\\""],"0inVGS":["Helps your coding agent recognize OpenKnowledge projects and route reads and writes through it."],"0jD-Gn":["A team knowledge base, a personal wiki, project docs..."],"0kTAXe":["Open source: ",["mirrorSrc"]],"0njBIq":["Setup files include: <0>.ok/</0>, AI-tool MCP configs (<1>.mcp.json</1> and per-tool files), project skills, and <2>.claude/launch.json</2>.<3/><4>Shared</4> commits them to git, so anyone who clones the repo gets the same setup. <5/><6>Local only</6> keeps them out of git (via <7>.git/info/exclude</7>)."],"0rwwOn":["By tag"],"0s8-e8":["Select, enter, or leave block components and fallback source blocks from keyboard boundaries."],"0t0bbC":["Could not save sync preference: ",["detail"]],"0uTHCg":["Start a new OpenKnowledge project."],"0wswKc":["Horizontal rule that divides sections."],"0xnmlQ":["Repository name"],"0yL--g":["Review conflicts"],"12F9WL":["(no id)"],"16D5Zj":["Are you sure you want to delete ",["itemName"],"? This action cannot be undone."],"1AumWo":["Push failed — check the server logs for details."],"1EcCom":[["keyName"]," value"],"1FLarN":["Describe what you want to create to continue"],"1GhYxC":["of ",["totalPages"]],"1HBhDS":["Checking out files"],"1MGRQl":["Terminal sessions"],"1QfxQT":["Dismiss"],"1RluQD":["Show replace"],"1TNIig":["Open"],"1Ta7Fd":["Open ",["basename"]],"1XSMhZ":["Switching to <0>local-only</0> will refuse until they're untracked via<1> git rm --cached</1>."],"1YJ4Yg":["Update available",["0"]],"1ZpfyB":["Open with AI ",["displayName"],", ",["hint"]],"1bDVu5":["Workspace Command Palette"],"1d1F11":["Select all files and folders"],"1di5fu":["Document not found"],"1hvhf0":["The folder on disk and the id agents use to invoke this skill."],"1nke1r":["Open ",["0"]," on GitHub (opens in a new tab)"],"1t_NnN":["Reject"],"2277Tu":["Collapse graph"],"237hSL":["Ended"],"25Pw6a":["Cloning"],"27XW26":["Clone happens in the Project Navigator. Reclick the share link there."],"28B21t":["Agent Skills"],"29VNqC":["Unknown error"],"29XZXN":["Set git identity"],"2B6eYX":["What this checkbox changes"],"2BBAbc":["List"],"2FYpfJ":["More"],"2GT3Hf":["Global"],"2IYGkU":["This doc has unpushed changes. Recipients will see the last pushed version."],"2QM24L":["All tags"],"2RBzMG":["Network error — check your connection and try again"],"2XQ8Ww":["Open preview when agent edits"],"2YOwme":["Restarted — now running v",["appRuntime"],"."],"2YZwPB":["Forward-links response did not match expected shape."],"2bVHbB":["Available in every project on this computer."],"2fkdnR":["Nothing to undo on this file"],"2hYmUH":["my@email.com"],"2hpdRq":["Hide panel (",["panelShortcutLabel"],")"],"2n3oDU":["Project-level pages ordered by inbound link count, up to ",["FULLSCREEN_HUB_LIMIT"]," results."],"2q_Q7x":["Visibility"],"2ryd91":["Failed to rename property"],"2tgFCe":["Starting clone"],"2vIPtm":["Open link in new tab"],"2wxgft":["Rename"],"322lyb":["Highlight tips, warnings, and notes."],"34qyH5":["Could not reach server"],"36WXSC":["Couldn't delete template: ",["error"]],"36aWJD":["Join us on Discord"],"379t2h":["Unified diff"],"38foVZ":["Loading diff"],"3BnyYc":["This doc isn't on GitHub yet. The link won't work until it's pushed."],"3DTatP":["Copy a prompt for your agent, start a blank file, or scaffold from a template."],"3FMvls":["A short line shown under the title in the template list."],"3Fcb0I":["Open graph"],"3HNlwb":["Hello, world!"],"3Ib6FN":["Move down"],"3Ijjy1":["Couldn't load this skill's files."],"3IseAk":["Install an AI agent to create with AI"],"3J7d2N":["Big section heading."],"3JYy1p":["Branch ",["0"]," no longer exists. Cloned to default branch."],"3MnvrL":["Showing top ",["0"]," matches — keep typing to narrow"],"3Mwaly":["Could not initialize ",["0"],"."],"3SDfZl":["<0>Mirror — pick a source.</0> Set <1>src</1> + <2>anchor</2> via the property panel to point at a <3><MirrorSource></3> elsewhere."],"3TCafD":["Stored on this machine."],"3VbwPp":["Open ",["keyName"]," in browser"],"3VsNTI":["Loading document"],"3YvS-c":["New tab"],"3_6U6f":["Connect to GitHub"],"3__SjS":["breadcrumb"],"3a_Bd7":["Open source doc: ",["mirrorSrc"]],"3aeN7X":["All files"],"3cOo2C":["Create a folder from the current document or folder context."],"3ePd3I":["What's new"],"3h5zMp":["Something went wrong loading the settings panel."],"3iyGWF":["Open recent project"],"3jod3l":["Connect GitHub"],"3m2GBo":["Searching docs"],"3mFsc3":["Restore with remote changes"],"3o3tur":["Starter content"],"3oh0nQ":["Nested .okignore error in ",["path"]],"3pU8e-":["Pin tab"],"3wiBAs":["Where should it live?"],"3y6XTb":["Semantic search"],"3zyg_A":["Ignore patterns"],"438Fca":["Cloned successfully, but could not open the project."],"44DSl0":["Already have a git repository? Add it with <0>git remote add origin <url></0> in this project's folder. This page updates automatically once a remote is detected."],"45MZFs":["Commands"],"47EXvY":["This replaces the current skill content with the bundled version ",["0"]," (you have ",["1"],"). Any local edits will be replaced — your current version is saved to history first, so you can restore it."],"484LKL":["Remove link"],"48uGTI":["Failed to load docs. Press Escape and re-open to retry."],"4A3Yzu":["Code block"],"4BITzH":["Error:"],"4CfgPM":["Project folder created, but git init failed. Try again."],"4E9jPa":["Create your first project"],"4Gz2wC":["Failed to upload file"],"4KmEoC":["Hotkeys"],"4NC2Ym":["Move to the next or previous table cell."],"4PYsOz":["Hide Files (",["sidebarShortcutLabel"],")"],"4Sxexw":["Source undo or redo"],"4TzU0n":["Initialize"],"4XL6N4":["Detected from the editors this project is set up for. Adjust to control where every skill installs."],"4buZWd":["Inherited from ",["path"]],"4c_a6S":["Nothing set yet."],"4g19V6":["Failed to update property"],"4hJhzz":["Table"],"4jDd0j":["Anyone can see"],"4mLBx9":["Subscriptions aren't available right now."],"4niEzY":["Sandboxed HTML embed — write HTML, see the rendered preview live."],"4nj6n8":["/api/config returned HTTP ",["code"]],"4rjwLG":["Create with ",["0"]," CLI"],"4sKwf6":["File already exists"],"4uNLmk":["Pulling"],"4v2Yyz":["Select every visible file-tree row when focus is in the Files sidebar."],"4xtLTl":["Hidden folder “",["basename"],"”"],"4zEZS5":["Auto-sync is on for this worktree, inherited from ",["project"],". Change it in Settings → Sync."],"4zGlN_":["Paste image URL or click upload"],"5-FeN2":["Share URL"],"54Y6Fg":["Could not load templates. Try again later."],"56WWtu":["Couldn't load starter packs: ",["error"]],"56xUL1":["Property name"],"57fiu8":["(read-only — edit in source mode for now)"],"5ALjdr":["Move through visual-editor find results from the find field."],"5Ajb15":["The formula <0>c = √(a² + b²)</0> renders inline."],"5ClEAu":["Inline hashtag for cross-doc grouping."],"5D3Ior":["Hide folder"],"5DFPDh":["Started a fresh OpenKnowledge server (v",["appRuntime"],") for this dev session — the server already running for this project was terminated. Connected agents (Claude Code, Codex, Cursor) just lost their OpenKnowledge MCP connection; restart the agent, or toggle its OpenKnowledge MCP server off and on, to reconnect."],"5F5HYj":[["ahead"]," ahead, ",["behind"]," behind"],"5GKMSz":["Indent or outdent the current list item."],"5GRxoA":["Search files, folders, and commands for the current workspace."],"5LXwX8":["This permanently removes ",["path"],". Agents that reference this template by name will fail until it's recreated or replaced by one in a parent folder."],"5OTgC7":["Open and focus the bottom Ask AI prompt composer."],"5OqaJi":["Enter a project name"],"5QGTaA":["Could not copy relative path"],"5SwVv1":["Not installed"],"5Tk8Fb":["Loading files"],"5WDhAk":["Link to a page or external URL."],"5ZB7XC":["File drop zone"],"5e1Dri":["The menu label agents pick this template by (required)."],"5gr_ev":["Becomes the document's content when someone creates a doc from this template. Type <0>",["dateToken"],"</0> or <1>",["userToken"],"</1> to fill in today's date or the author's name automatically."],"5kWklo":["(some may already be hidden by other rules)"],"5lWFkC":["Sign in"],"5mksg0":["Failed to disable semantic search — ",["detail"]],"5qNxOe":[["count","plural",{"one":["#"," item could not be moved to the Trash. Do you want to permanently delete instead?"],"other":["#"," items could not be moved to the Trash. Do you want to permanently delete instead?"]}]],"5wV2qQ":["and more"],"5y_9lO":["Waiting for authorization"],"6-wLTJ":[["behind"]," behind origin"],"62Pc08":["Install for Claude Chat & Cowork (Desktop App)"],"636K3K":["Delete adjacent chip"],"67f-3g":["Duplicate succeeded but the sidebar may be out of date — refresh to resync"],"6Aih4U":["Offline"],"6EKG_c":["What agents match on to decide when to use the skill."],"6HCOwA":["Failed to open."],"6LbUG7":["The repository is private and your GitHub account doesn't have access to it."],"6MnZEC":["Terminal failed to load"],"6O626z":["No headings match \\"",["trimmedAnchorQuery"],"\\""],"6Pxqwv":["No project templates yet. Create one to make it available everywhere in this project. Folder-scoped templates live on each folder's overview page."],"6Uau97":["Skip"],"6V3Ea3":["Copied"],"6VqW-1":["Remove ",["keyName"]],"6WdDG7":["Page"],"6YtxFj":["Name"],"6ZhdPI":["What the agent may read, write, and surface."],"6_ZOw4":["Copied full path"],"6bTTAN":["Invalid input — pick a different folder."],"6cR-PU":["Already open"],"6caB2T":["Connect an existing repository"],"6cuT_1":["Open date picker for ",["keyName"]],"6cyguR":["Connect GitHub to continue."],"6eniID":["Map the architecture"],"6fGjTz":["Show fewer"],"6g2jsp":["Update skill"],"6gRgw8":["Retry"],"6h4zVU":["What would you like to create?"],"6hfDJr":["Server error: ",["status"]],"6ibbCg":["Create your first file"],"6ki7F2":[["0","plural",{"one":["#"," item"],"other":["#"," items"]}]],"6lGV3K":["Show less"],"6m_7We":["Open this settings dialog."],"6q0rnH":["writing"],"6qMe0o":["Draft a technical spec for my project. Start with an overview, then add cross-linked pages for the architecture, the key modules, and the open questions, all linked from a specs index."],"6s7LXO":["Heads up"],"6u9LvN":[["days","plural",{"one":["#"," day ago"],"other":["#"," days ago"]}]],"6vEr3W":["Link target"],"72xhRD":["Diagram view mode"],"74-bX-":["A pull quote stands out from the surrounding text."],"74eHt-":["No file or folder selected"],"75Y1dk":["Horizontal pill strip + active panel below; click a pill to switch panels."],"77SdEP":["Delete ",["itemName"]],"7FamGZ":["Go to line"],"7Fkcej":["+ Add ",["addChildName"]],"7H4UHD":["Documents tagged <0>#",["tagName"],"</0>"],"7JtSLi":["Failed to delete path"],"7KeV5F":["Undo all failed: ",["message"]],"7OhaRy":["Source search"],"7Ongq0":["Condense my AGENTS.md file to less than 40k characters"],"7OwvEL":["Show HTML preview"],"7PNNNs":["This sends content off your machine"],"7PXYaF":["<0>ok</0> won't run in external terminals until you add it later from the File menu. OpenKnowledge's built-in terminal and AI tools keep working."],"7PzzBU":["User"],"7YRrJ9":["Available in the OpenKnowledge desktop app. From a terminal, use<0> ok config-sharing status</0> / <1>share</1> / <2>unshare</2>."],"7_bFEL":["Drag ",["patternText"]," to reorder"],"7apDiJ":["A folder named <0>",["sanitized"],"</0> already has files here. Pick a different name."],"7d1a0d":["Public"],"7hctf2":["Describe the project you want to create"],"7jIIFX":["You're all set up!"],"7qRHf0":["Install for Claude Chat & Cowork"],"7uBlRT":["Copy the focused file-tree item so Paste can duplicate it."],"80c4-P":["Code copied to clipboard"],"81H_23":["Add properties"],"881Uwh":["Delete selected table"],"89TtiD":["New file from template \\"",["displayTitle"],"\\" (",["fileName"],") in the project root"],"8BsGpU":["A key is set, but the embeddings provider rejected it or was unreachable — search fell back to keyword matching. Check the key in <0>Settings → Account</0> and your provider settings."],"8F1i42":["Page not found"],"8FqTCr":[["chunksRemaining","plural",{"one":["#"," unresolved hunk"],"other":["#"," unresolved hunks"]}]],"8Gzz2G":["worktree of ",["worktreeOf"]],"8IP5jY":["Each selected tool gets an OpenKnowledge MCP entry."],"8Jm2EP":["Toggle heading levels 1 through 6."],"8OGgNM":["Open or close visual-editor find."],"8OxKZy":["Move succeeded but the sidebar may be out of date — refresh to resync"],"8PifYj":["Mermaid diagram"],"8PmoQF":["Open the insert menu in an empty or active text position."],"8RtNI0":["Failed to load documents"],"8XQRON":["Loading repositories"],"8_brI5":["Name is required"],"8cS0nH":["Config sharing unavailable: ",["0"],"."],"8cpOa8":["Couldn't disconnect — please try again."],"8cpeU3":["Shared repositories"],"8eW0WQ":["No matching repositories."],"8fRyLo":["Invalid patch payload"],"8fc_3j":["Protected branch — cannot push"],"8m8diM":["No location selected. Use Browse to choose a folder."],"8tjQCz":["Explore"],"8uAWix":["This template lives in a parent folder — deleting it affects every folder beneath it that doesn't define its own version."],"92rbk2":["Mirror loading <0>",["mirrorRef"],"</0>"],"96G6Re":["New folder"],"96w9hU":["Something went wrong opening this file (HTTP ",["status"],")."],"99eR72":["Visual editor table selection"],"9Bd18D":["Failed to load hub pages"],"9NJWgv":["Backlinks"],"9OIqw4":["You don't have write access to this repo."],"9PQysm":["Hide advanced"],"9R7pRC":["No tags match \\"",["trimmed"],"\\". Continue typing to create one."],"9UQ730":["Clone"],"9V0W-R":["Adds the OpenKnowledge skill to the <0>Claude Desktop App</0> so it's available in Chat and Cowork sessions."],"9bCiQ8":["No pages are missing incoming graph links."],"9clcD5":["Open documents tagged #",["chip"]],"9dw5bW":["Create with ",["0"]],"9euN0m":[["count","plural",{"one":["#"," more cross-doc participant"],"other":["#"," more cross-doc participants"]}]],"9fhQRL":["Beta channel"],"9fvog2":["Preview unavailable: ",["errorDetail"]],"9i21pa":["Commits happen automatically"],"9jnjV0":["Embed an audio file with native player controls."],"9mEZeD":[["name"]," CLI"],"9npOH9":["Open file"],"9o1bIV":[["behind"]," behind"],"9oE4C3":["Browse your repos:"],"9sBe85":["Follow us on"],"9tJX8r":["By meaning"],"9zb2WA":["Connecting"],"A1taO8":["Search"],"A50vr3":["Use lowercase letters, digits, and <0>-</0> only."],"A5CYnd":["Broken link"],"A5hiCy":["Create template"],"A67Uwj":["Still loading"],"A6h5b-":["File duplicated"],"AAlr5Y":["No collab server for this worktree — run <0>ok start</0> here, or reopen the project."],"AB4qw9":["New terminal"],"AE7BY3":["The terminal session ended."],"AIn2Yv":[["displayName"]," CLI, ",["hint"]],"AItsE5":["Open it there"],"AKxFtn":[["openedWorktreeCount","plural",{"one":["worktree"],"other":["worktrees"]}]],"ALhMYW":["Terminal"],"AQ-Lfg":["Couldn't load templates"],"AQGtjK":["Commands run with the full access of your macOS user account on this machine. Turn this off to disable the shell."],"ATGYL1":["Email address"],"AVW-K9":["Failed to load orphan pages"],"AWOSPo":["Zoom in"],"AaaESH":["Auto-sync is off for this worktree, inherited from ",["project"],". Change it in Settings → Sync."],"AcK_r0":["Claude CLI"],"AczYxH":["Custom open-knowledge entry — not managed by OpenKnowledge"],"AdcGcG":["Applying your change"],"AddR83":["Could not create project. Try again or pick a different location."],"AeHuzT":["# One pattern per line.\\n# Examples:\\n# drafts/\\n# *.draft.md\\n# !keep.md"],"AeXO77":["Account"],"AiNMQ7":["This project lives only on this computer. Connect it to GitHub to back it up and share it with other people."],"Aif3E7":["Enable semantic search"],"Am78jY":["Drag ",["keyName"]," to reorder"],"Aq-O0x":["status"],"AqnqMJ":["API key set"],"ArBWJf":["Undo last edit"],"AsqRE_":["Default location for new attachments"],"AtBdnD":["Couldn't delete skill: ",["error"]],"B11p-O":["Edit markdown link"],"B2DrPb":["Auto-save"],"B2Srgd":[["packName"]," skill installed."],"B3NAZC":["Open Navigator"],"B4_ipX":[["conflictCount","plural",{"one":["#"," file conflicted"],"other":["#"," files conflicted"]}]],"BAH4qX":["Selected graph item"],"BBqGS9":["Desktop"],"BD0XSC":["Failed to load project templates"],"BEkF-P":[["userName"],", ",["tabCount","plural",{"one":["#"," concurrent tab"],"other":["#"," concurrent tabs"]}]],"BGHHtQ":["Single page"],"BH56dn":["Custom display text"],"BQKHuL":["Restart terminal"],"BQu9Pg":["Symlink"],"BUyQnq":["Couldn't restart the server. Try \`ok start\` in this folder."],"BY-g4_":["Add pattern"],"Bdha5y":["Publishing..."],"BeWTQy":["Loading starter packs"],"BgV29F":["Visual editor find input focused"],"Bn9-El":["default"],"Bv5a9_":["Selection statistics"],"Bx4EXG":["Actions for ",["label"]],"By-7Pn":["Toggle a bullet list."],"BymzO4":["Document outline"],"C37Zkt":["Send to"],"C62P6b":["Editor selection"],"C7XjNB":["Global Skill"],"C9TBvF":["No Outgoing"],"CCTop_":["Recent"],"CFnavk":["This project isn't a git repository, so worktrees aren't available."],"CKyk7Q":["Go back"],"COr1Y7":["Pick <0>openknowledge.skill</0> from your <1>Downloads</1> folder. It enables automatically."],"CSL0l1":["Couldn't clear the key — please try again."],"CTJLpz":["\\"",["trimmed"],"\\" already exists here"],"CU3AiE":["Switching branches"],"CWzc2T":["<0>~/.ok/bin</0> and <1>~/.ok/env.sh</1> stay either way — the app always maintains them."],"CXTwen":["Can't safely edit this project config"],"CXj9C-":["New property name"],"C_WGy8":["This file is too large to open in the built-in text editor (1 MB limit). Use Open file below to open it in another app."],"C_cPoW":["Your GitHub session expired — sign in again to verify push access."],"ChAtFg":["You don't have permission to push to this repo"],"CifUuG":["Update available"],"Ck9XRt":["Couldn't save the key — please try again."],"CmeH9S":["Add property to ",["keyName"]],"CoHvYd":["Moved ",["0"]," to position ",["1"]," of ",["2"]],"CvsD6Y":["via ",["viaTags"]],"D-Oh1s":["How to set up ",["0"]," (opens in browser)"],"D12vtS":["(detached)"],"D2CwBE":["Create a new OpenKnowledge project from the <0>",["0"],"</0> starter pack (",["1","plural",{"one":["#"," folder"],"other":["#"," folders"]}]," and starter templates) in the folder of your choice."],"D4H2N6":["Remove ",["tag"]],"D8OV7J":["Only collaborators"],"DDTdLl":["Code block settings"],"DELNQk":["Collaborators see your in-progress edits as soon as they sync."],"DEWDbv":["Show diagram"],"DF1MtZ":["Loading conflict for ",["filePath"]],"DFfRbX":["Sync status: ",["syncStateLabel"]," — git identity unset"],"DId6MT":["Project-level pages with no outgoing graph edges."],"DJd000":["Activate the previous editor tab."],"DPfwMq":["Done"],"DVh_Tb":["Failed to clean up after trash"],"DXd9LM":["New worktree"],"D_WKe_":["Click an agent's avatar in the presence bar to view their session."],"DbILZA":["No matches. Some files are excluded from search (hidden or ignored files)."],"DeDYLr":["Unrecognized wiki link"],"DgcGrb":[["fileCount","plural",{"one":["file"],"other":["files"]}]],"DhK_hZ":["Moved \\"",["name"],"\\" to ",["0"]," (",["skipped"]," binary file(s) not copied)"],"DhLHEb":["Failed to load activity"],"DiFKSL":["Counting markdown files"],"Dnn2XG":["Automatic"],"DrYM2Z":["Sync disabled"],"DskIkK":["Sign-in stream ended without confirmation — please try again"],"Dub54T":["Preview browsers can't auto-copy. Use Cmd/Ctrl+C on the URL above, or open OK in the desktop app."],"Dvwa0U":["Create a worktree from this branch"],"Dw1T_W":["Rename ",["label"]],"E1Da_b":["This permanently removes ",["0"],". Agents that invoke this skill by name will fail until it's recreated."],"E1_c72":["Task list"],"E1tG2u":["Get Claude Code"],"E2Mv-X":["Copy source"],"E4XYYH":["Enable terminal for this project"],"E5WeIy":["Reopen the most recently closed editor tab."],"E6lrpp":["Manage the GitHub account OpenKnowledge uses to browse and sync your repositories."],"E7BhZn":["Blank note"],"E9bKSA":["Creating"],"EBVbtP":["Could not duplicate item"],"EDl9kS":["Subscribe"],"EDm3wJ":["Loading diff renderer"],"EEYbdt":["Publish"],"EHu0x2":["Syncing"],"EJuO7B":["Connect a GitHub account to browse and sync your repositories."],"EL_YRd":["Mirror of <0>api-spec</0>"],"EOjU5V":["Inline Math Properties"],"ETyvvg":["No language match."],"EVnzPs":["Edit with AI"],"EWX92Z":["Collapse Ask AI"],"EZVxVz":["Replace the active match from the replace field."],"E_BHoD":["Could not move \\"",["targetName"],"\\" to the Trash. Do you want to permanently delete instead?"],"E_tNGD":["Connected as @",["login"]],"Ea1prf":["Choose which editors every skill in this project installs into."],"EarrCe":["Search emoji"],"EbZT7P":["Toggle the left file sidebar."],"EbjWsS":["Current commit"],"EcM3k7":["Failed to clean up pending ",["kind"]],"EcR0fl":["Checking for installed agents"],"EdQY6l":["None"],"EeRZnZ":["Expand burst ",["burstNumber"]," diff"],"Ef7StM":["Unknown"],"EhDLBx":["You modified <0>",["filePath"],"</0> locally, but it was deleted upstream."],"Ehkru0":["Open, navigate, accept, or dismiss CodeMirror completion suggestions."],"EiVgl5":["You don't have permission to push to this repo."],"Eji13z":["Toggle highlight formatting."],"EkH9pt":["Update"],"El7NbA":["Heading 2"],"Emz5BG":["Embeddings are computed only when a search runs and are cached locally under <0>.ok/local</0>."],"EoaQyO":["Append-only log of what changed."],"EqrC_R":["Undo failed: ",["message"]],"EqtBXb":["Visual editor find open"],"ErRi6L":["Template \\"",["label"],"\\" deleted"],"Es-eZU":["Remove from recent projects"],"Ev2r9A":["No results"],"EvPX7f":["Opens a folder picker to choose where to clone the repository."],"Evq3lu":["Orphan mode"],"ExPiRQ":["Move to the next CodeMirror lint diagnostic."],"ExUzM4":["skill \\"",["0"],"\\""],"F-NRCj":["Add property"],"F-vBv0":["Ask"],"F0OA00":["Get ",["displayName"]],"F1T9y_":["Showing top matches — keep typing to narrow"],"F4IYWe":["Share doc"],"F4vEsL":["Sync status: ",["syncStateLabel"]],"F6pfE9":["Active"],"FBknns":["HTML"],"FCAcjR":["Run a real terminal docked inside OpenKnowledge, starting in this project's folder."],"FCxvG5":["First item"],"FEK4oC":["OpenKnowledge will be initialized at <0>",["gitRoot"],"</0> — the parent of your new folder, because it contains a <1>.git</1> folder (one project per git repo)."],"FEqWFL":["Guides your AI agents on how to work here."],"FEr96N":["Theme"],"FNTx6u":["Search \\"",["semanticSubmitQuery"],"\\" by meaning"],"FOGD7m":["Create something great."],"FOyCTr":["Your OpenAI API key, used only to create embeddings of your content for semantic search. Stored once for this machine in <0>~/.ok/secrets.yml</0> (readable only by your user account) and shared across all projects. Turn the feature on per project in This project → Search."],"FRYB1Q":["/api/config returned a malformed body"],"FRqZ9v":["Couldn't update skill: ",["0"]],"FTUGgh":["Enter a repository URL or owner/repo"],"FUMerq":["Could not enable sync: ",["detail"]],"FWQuPE":["This project is running a different, incompatible build of OpenKnowledge than this app (v",["0"],")."],"FXk_zY":["Adds a guided workflow for authoring new Agent Skills."],"FjkaiT":["Zoom out"],"FnMkli":["Sync disabled — you don't have permission to push"],"FqTpiN":["Bird wiki"],"Fqr8BP":["Multi-page PDF viewer with toolbar controls (thumbnails, page nav, zoom)."],"Fsx78O":["Add the <0>ok</0> command to your terminal"],"FvMSms":["Renaming changes the file on disk and the id agents use to pick this template."],"FvpFSZ":["Reveal in Finder, ",["hint"]],"Fxf4jq":["Description (optional)"],"Fy4GgU":["Explain how your codebase works so teammates and AI agents can find their way around. Good for documenting the architecture, the main parts, and the questions new contributors always ask."],"FyW0WO":["Authorize in browser"],"G-JBA1":["Source mode requires a live connection — your edits are saved and will appear when you reconnect."],"G0YZ-I":["Indent or outdent list item"],"G1Gw0v":["New template"],"G1XxbZ":["Checkbox"],"G4-bgo":["Ask AI (from selection)"],"G7-rf8":["Pattern syntax error: ",["message"]],"G7cMuO":["HTML preview"],"G8t9NN":["Add a property"],"GA-UkN":[["keyName"]," type: ",["typeLabel"],". Click to change."],"GDvlUT":["Role"],"GF51cw":["Give the AI tools you use access to read and update your projects. Pick what to set up below, and change it anytime."],"GGsM4y":["Selected in graph"],"GJH-AT":[["docName"]," is ",["0"],". OpenKnowledge currently opens files up to ",["1"],"."],"GK-IRZ":["Undo buttons are disabled — per-session state has been garbage-collected."],"GLxIKR":["How to push manually"],"GN6L5F":["Filename"],"GQDSBN":["Layout options"],"GUYwCr":["Dismiss notice"],"GUqTzn":["Competitor research"],"GXf9hG":["Cloning ",["repoName"],"..."],"G_686w":["Task List"],"G_efLf":["Installed into"],"G_mWXb":["Filter languages"],"GamjcN":["Template saved"],"GemPfn":["Failed to parse forward-links error response (HTTP ",["status"],")"],"Gfr4fu":["Server can't open documents"],"GhjUB_":["Reconnected"],"Gp_twO":["Local path"],"GsBUCk":["Loading settings"],"Gt4gOO":["This folder has unpushed changes. Recipients will see the last pushed version."],"GubkSu":["Use a starter pack"],"GuqOb1":["Failed to load headings"],"Gx0VS1":["e.g. drafts/ or *.draft.md"],"GzPQ2f":["Stay in the loop"],"H-vDm3":["Relaunching to install the update…"],"H0WlWQ":["Grid of rows and columns with a header row."],"H86f9p":["Collapse"],"HAvRAI":[["skillCount","plural",{"one":["skill"],"other":["skills"]}]],"HCn0Ay":["Toggle strikethrough formatting."],"HGNCsl":["Connection lost — keep this tab open, your edits will sync when reconnected"],"HIb0vl":["Network error — please try again"],"HM56Bx":["Creating..."],"HPTPGr":["Create a new spec file for my user story"],"HSh8u_":["Folders"],"HTW0Zw":["One more step: run <0>claude</0> in this project and approve OpenKnowledge once."],"HXFyWD":["Split diff"],"HdkSiO":["New file"],"HfI1dR":["I already have it locally →"],"Hl89Qd":["Loading templates"],"HlmZBk":["Documents response did not match expected shape."],"Hnl9nT":["Set where pasted and dropped files are stored for this project."],"HoWElC":["This ",["targetNoun"]," has been moved, renamed, or deleted in your local copy of branch <0>",["branch"],"</0>. Please commit your changes or enable auto-sync."],"Hp1l6f":["Current"],"HpK_8d":["Reload"],"HptUxX":["Number"],"HqiZvw":["OpenKnowledge stores its configuration and internal files inside a newly created <0>.ok</0> directory in your project root folder."],"Hrz9NY":["Wiki link"],"HyvSqq":["Project Skill"],"I1gRhX":["Failed to rename"],"I5685_":["Try a prompt"],"I5AfhE":["Sync status unavailable — server unreachable."],"I7Exsw":["Follow us on X"],"IA1wNb":["The Claude Desktop App didn't open the file. Is it installed? (",["msg"],")"],"IA6JW2":["Detecting"],"ICoNYz":["You can also manage this in Settings."],"IInnZo":["Conflict"],"IKoTAC":["Keep disabled"],"IN4UX8":["Search (",["searchShortcut"],")"],"IQPyrD":["Missing page — click to create"],"IRv9cH":["Cloned ",["repoName"],"."],"IWGfGF":["Checking your GitHub connection"],"IX7-sq":["Something went wrong opening \\"",["docName"],"\\"."],"IX_uXB":["my-feature"],"IajAbS":["Add a starter pack"],"If0crP":["Open with AI ",["targetDisplayName"],", ",["hint"]],"IgTwLt":["Open this document in the editor and collapse the graph."],"Ik-gP0":["Heading H",["level"],": ",["text"]],"Iq8zdU":["Close terminal"],"IrB5AK":["Server-side cleanup failed for ",["failedCount","plural",{"one":["#"," item"],"other":["#"," items"]}]],"IreQBq":["Repository"],"It9ARY":["Toggle the right document panel."],"Ix0K8o":["Hide external URL nodes"],"J2MgzQ":["Undo all edits on ",["docName"]],"J2Mv98":["Name (e.g. ",["login"],")"],"J2eKUI":["File"],"J3HzPL":["Collapse ",["keyName"]],"J6N5MX":["Couldn't construct the share URL. Try Done and re-share."],"J6mxC1":["A network problem or GitHub outage interrupted the clone."],"JCxGEX":["No disconnected pages. Pages appear here only when they have no incoming and no outgoing graph edges."],"JE21eh":["Symlink to ",["targetPath"]],"JK-Ave":["Hide thumbnails"],"JL3si7":["Updating"],"JLUTgi":["No tags yet — author \`#tagname\` in any doc to populate the index."],"JLzQi_":["Close ",["accessibleLabel"]],"JOcPqH":["Bring a remote repository onto this machine."],"JWsZlx":["Open a project to edit."],"JZ8cO6":["Light, dark, or follow the OS."],"Jejur6":["Couldn't load document"],"Jhj_lh":["Modify the link target, anchor, and display label."],"JkCD2u":["Sync paused — you don't have permission to push to this repo"],"JmfgFc":["(a worktree of ",["0"],")"],"Jqqevv":["System error"],"JtD-Br":["Page link"],"Jw6EC4":["Branch switch failed — try opening the ",["targetNoun"]," manually."],"K-a33w":["Start writing to create this page"],"K-h9cT":["Couldn't save the resolution for ",["filePath"],"."],"K0N7zS":["Config sharing status read failed"],"K1ckLX":["Failed to create folder"],"K6MQQk":["Sync is failing. See the sync status for details."],"K6jjWB":[["packName"]," was already set up. Nothing to do."],"K6jxcj":["Add a key"],"K8-WWn":["Move between table cells"],"K9J00P":["Clone failed — connection error"],"KDuPiY":["Uploading ",["fileName"]],"KDw4GX":["Try again"],"KFdXwz":["Show panel (",["panelShortcut"],")"],"KH5bQi":["Using the <0>OK_EMBEDDINGS_API_KEY</0> environment variable (managed outside OpenKnowledge)."],"KIIamL":["OpenKnowledge will create commits and push them to your remote automatically. If you do not want automatic commits in your git history, you should not enable auto-sync."],"KOZud0":["Build a competitor research knowledge base. Start with an overview page, then add cross-linked pages for each competitor, their products and pricing, and the sources behind every claim."],"KPW5WC":["moved template"],"KQGZuq":["Reused if it already exists, created if not."],"KRJ6xh":["No tags yet. Continue typing to create one."],"KWL_Ih":["Blog post"],"KX1MZR":["Your repositories"],"KYSocE":["Research the extinction of flightless birds"],"KYcZ6Y":["Above"],"KZLdgR":["See <0>#design-docs</0> for the latest specs."],"K_vT1F":["Upstream sync"],"KaFCD3":["Open this link in a new tab and collapse the graph."],"Kf7GG5":["Restarting the server…"],"Kgdbkt":["Switch to local-only refused"],"Kh1n4a":["<",["componentName"],"> isn't a known component. Copy the source to use it elsewhere, or delete the block."],"Khxcyu":["Terminal access isn't enabled for this project."],"KkEAud":["Create a file from the current document or folder context."],"KmydK6":["Bold"],"KnoB--":["Will be saved as <0>",["sanitized"],"</0>."],"Kr3VPS":["Codex will still ask until you run \\"ok init\\" in a terminal for this project."],"KsAPaB":["This branch is checked out in:"],"KszKI_":["Skill level"],"KujtjC":["Find"],"L-rMC9":["Reset to default"],"L1ZE3M":["Document statistics"],"L3CEC1":["this item"],"L4Cdd9":["or create a new file <0/>"],"L6Hhh6":["(root)"],"L8fKuc":["Run this in your terminal"],"L9Y9Om":["Top linked pages"],"LBwUR6":["Branch switch timed out — try opening the ",["targetNoun"]," manually."],"LCUy_N":["Session ended"],"LDuM35":["Replace current match from field"],"LE7t79":["Clone to a new folder"],"LKOLNn":["No AI agents installed"],"LNum6A":[["minutes"]," min ago"],"LRgZAt":[["owner"],"/",["name"]," already exists"],"LXdWeS":["Medium section heading."],"LXfNU-":["Navigation and suggestions"],"LYufDw":["Failed to enable semantic search — ",["detail"]],"LbmLyU":["Can't safely edit this tool's config"],"Lcehxn":["Save resolution"],"LdABLa":["Could not open ",["target"],". Try opening it manually."],"LdKIHS":["Draft a spec"],"LhQlGR":["This project is running an older version of OpenKnowledge (v",["0"],") than this app (v",["1"],")."],"LhWYpm":["Other OK paths are tracked upstream:"],"LiAw2k":["What this changes"],"LlHqdU":["Initializing project"],"Llyqvo":["This usually means one of:"],"LpB85N":["Plain"],"LtI9AS":["Owner"],"LtSYdi":["Reveal in Finder"],"LtiJ5c":["Project skill"],"LuoJWu":[["truncatedShownCount","plural",{"one":["Showing the first item in one folder — the rest of that folder is hidden."],"other":["Showing the first ",["formattedCount"]," items in one folder — the rest of that folder is hidden."]}]],"LwMxXg":["Failed to open worktree."],"M1OfV9":["Next source diagnostic"],"M3ytY_":["This looks like a drive root (e.g., C:\\\\). Scaffolding here will scan an entire drive."],"M5mfAe":["Add tag"],"M9597s":["Preparing share URL..."],"MCjC9A":["Delete ",["deleteDescriptorLabel"]],"MDZSJe":["When the agent runs its scheduled work."],"MGb89P":["Insert, delete, move, copy, and indent source editor lines through CodeMirror's default keymap."],"MHrjPM":["Title"],"MKOVhz":["Enable git auto-sync"],"MQIM_Y":["Couldn't copy. Select the URL above to copy it manually."],"MTs6g3":["Couldn't reconnect after server restart"],"MUBR8r":["Rename succeeded but the tabstrip may be out of date — refresh to resync"],"MUrVEo":["No recent projects."],"MV-Dkb":["Found ",["countDisplay"]," markdown files"],"MVxpbf":["Find and replace"],"MWrUEd":["Undo all"],"MZSBsh":["No templates yet. Add one to give new docs in this folder a ready-made starting point."],"MZoxVx":["Failed to load tags. Press Escape and re-open to retry."],"Mb_20S":["Visual"],"Md709y":["Loading ",["fileName"]],"MdpSC1":["New skill"],"Mh_4hd":["Previous tab"],"Mj8R8K":["Couldn't install skill: ",["0"]],"MmDDWK":["Recently opened"],"MmqnGI":["No global skills yet."],"Mnavhe":[["propPanelDescriptorLabel"]," Properties"],"MqQoV-":["Describe what you want to build, start a blank file, or scaffold from a template."],"MrwYIK":["Toggle a source comment through CodeMirror."],"MsuXaI":["Hide panel (",["panelShortcut"],")"],"My9uXI":["Updated \\"",["display"],"\\" to ",["0"]," — your previous version is in history if you need to restore it."],"N1KkEO":["Jump to last tab"],"N1YYa7":["Loading image"],"N1mdmS":["This file can't be opened in the text editor."],"N2FcBE":["Synced"],"N2S1rs":["Empty"],"N2eHWq":["Code Block"],"N3_ozB":["Hubs"],"N55YNr":["Choose whether this project's OpenKnowledge setup, including its AI-tool connections, is saved with the project so teammates get it too, or kept only on your computer."],"NEzPEh":["Create a new branch, or check out an existing one, in its own window."],"NIWAux":["No docs registered under #",["tagDocsName"],"."],"NJyQi_":["Branch ",["shareBranch"]," no longer exists on the remote."],"NKkZXl":["Initialize and open"],"NNJsn7":["One more step: enable it in Cursor → Settings → Tools & MCP (Cursor leaves project servers off until you turn them on)."],"NOHyEE":["Retry push"],"NORKZU":["Pattern warnings: ",["summary"]],"NQ8llq":["Add item"],"NRSLBe":[["diffMin"],"m ago"],"NSnIUP":["Two-page (even)"],"NUr4kz":["A reusable starting point for new documents in this folder."],"NYUhy5":["Subfolder name"],"N_7kkF":["Read through this codebase and draft a technical spec for the most complex module: an overview, the architecture, key files, and open questions, all linked from a specs index page."],"NcurBF":["Pan down"],"NjrIak":["File: <0>",["fixedName"],".md</0>"],"NkXEFS":["Restore failed — document unchanged"],"NmPNJJ":["Copy code"],"Nn4GgW":["Will be created as <0>",["sanitizedName"],"</0>"],"NnQapF":["Open with AI ",["targetDisplayName"]],"NpC29w":["Create a new list item from the current list item."],"Nu4DdT":["Sync"],"Nu4oKW":["Description"],"NuH1jp":["Public repository"],"Nv3mUj":["Show advanced"],"NvOvTi":["Create in <0>",["dirDisplay"],"</0>"],"Nx7BWE":["Git auto-sync"],"NxW-md":["Resize ",["handleKey"]],"NzFvyK":["Session ended — undo unavailable"],"O0Z2Xr":["Outgoing"],"O2UpM1":["Browse"],"O3oNi5":["Email"],"O4PnDd":["AI tool management is only available in the OpenKnowledge desktop app."],"O6yEPk":["Create a new OpenKnowledge project in the folder of your choice."],"O7_W_a":["Open with AI"],"OD0FCX":["Hidden “",["basename"],"”"],"ODGGlj":["Folder name: ",["detail"]],"OETysD":["No hub pages yet. Hubs appear once pages accumulate inbound graph links."],"OEu_0l":["Failed to load skills: ",["0"]],"OFBmkg":["Search files, commands, projects, and AI handoff actions. With text selected in the visual editor, this chord adds a link instead."],"OJTOUj":["Requires ",["brand"],"."],"OJeiSH":["Failed to add property"],"OLBz-_":["Mermaid diagram failed to render."],"OLIKgw":["Drag item ",["0"]," to reorder"],"ONPvOb":["Loading agent activity"],"ONgEZF":["Loading headings for ",["pageTarget"]],"OOIVJo":["Uninstalled \\"",["0"],"\\" from ",["1"]],"OTF92M":["Label <0>(optional display text)</0>"],"OVjNeX":["Terminal ",["0"]],"OX2Neh":["Inline code"],"OXb_Df":["Settings content"],"OYnx7O":["Path cannot start with \\"/\\""],"OZJeTZ":["Skill"],"OdmsFg":["Failed to delete item"],"OeAl1e":["e.g. assets/uploads"],"OgyJSr":["Local only"],"OiHJdA":["Move through slash, wiki-link, tag, and path suggestions; accept or dismiss the active suggestion."],"Okd2Xv":["Toggle underline formatting."],"OlAl5i":["Expand all"],"OmHTGj":["Disable git auto-sync"],"On0aF2":["Website"],"Oo_WWc":["No pages found"],"Oos8fo":["Copy command"],"OplnBG":["Managing AI tools is unavailable in this build."],"OuY8t9":["Open in current branch"],"OvEjsP":["Copying..."],"OxplNM":["Updated \\"",["0"],"\\": added ",["1"],", removed ",["2"]],"Oxyd5f":["Pick a name"],"OyIC0Q":["Project name"],"P-ye9o":["Could not open folder picker"],"P0HC30":["This ",["targetNoun"]," moved to <0>",["0"],"</0>. Open it there?"],"P3NS4G":["Pattern syntax error (line ",["lineNumber"],"): ",["message"]],"P3hnm0":["File too large to open"],"P47EWZ":["Could not update sidebar settings"],"P6gXB-":["Replace ",["keyName"]],"P6lAT3":["Folder target: ",["linkTitle"],". Click to open the overview."],"P8yDjG":["Name can’t be empty, \\".\\", \\"..\\", or contain / or \\\\"],"PB4upl":["Find previous match"],"PBwmDJ":["Searching by meaning"],"PBxg_E":["Not now"],"PCNIuJ":["File an issue"],"PCSkw2":["Skills"],"PIMM5l":["You're subscribed!"],"PKLY-1":["Opening..."],"PMyJ9C":["No edit session yet"],"PPFQ3o":["Installed \\"",["0"],"\\" into ",["1"]],"PQCdtv":["\\"",["docName"],"\\" doesn't exist."],"PR9FSv":["Move to the next visual-editor find result."],"PRnH8G":["of ",["0"]],"PVUn_c":["Open folder"],"P_bX4O":["How to set up"],"PdA9NZ":[["ahead"]," ahead"],"PdJZ5p":["No skills yet."],"Pgu10b":["Saved as <0>",["slug"],".md</0>"],"PgzIpb":["Move to the previous visual-editor find result."],"PiH3UR":["Copied!"],"PkeYXL":["Expanded graph mode"],"Pkw7J9":["This folder is empty."],"PqYWiC":["Couldn't restart the server automatically. Try running \`ok stop all\` in a terminal, then reopen this project — or restart your computer if it persists."],"PrJYSN":["This folder isn't on GitHub yet. The link won't work until it's pushed."],"PrhzDE":["Pan up"],"Pyp1NA":["Restore to this point?"],"Q5fqMz":["Connection error — try again"],"Q6hhn8":["Preferences"],"Q7W-mC":["Same folder as current file"],"Q8A-U_":["Connected to"],"QAi7Q9":["Branch <0>",["trimmed"],"</0> already has a worktree — it'll open in its own window."],"QDZbvN":[["diffDays"],"d ago"],"QJaG-9":["Choose CLI for new chat"],"QNxpRm":["Dock terminal to the right"],"QOINDn":["empty"],"QQghPu":["Install in Claude Desktop"],"QR5SP1":["created template"],"QYfQdv":[["displayName"]," CLI"],"QcpeeE":["Navigate to ",["docName"]],"QfFBdJ":["The template's filename (without \`.md\`)."],"Qj4RL5":["Completed:"],"QlxHAH":["Showing results for \\"",["semanticResultsLabel"],"\\""],"QnjpOq":["What do you want to build?"],"QqBQu1":["Label <0>(visible link text)</0>"],"Qvls7J":["Eng specs"],"Qw-7Ie":["A simple place to write, with one file per topic and a daily journal. Pick this if you just want to start writing and let the links between notes build up over time."],"QyioBP":["Move up"],"R0cyYB":[["0","plural",{"one":["#"," request blocked by the preview's security policy"],"other":["#"," requests blocked by the preview's security policy"]}]],"R0jJzV":["Paste URL, owner/repo, or search your repos"],"R3y75Z":["Edit source"],"R65q-K":["A real shell is off for this project. Turning it on runs commands with the full access of your macOS user account."],"R9IDFz":["Renames the folder on disk and the id agents use to invoke it."],"RDjuBN":["Setup"],"RDrXh4":["Configure user, project, and integration settings."],"RG4XHV":["Copy ",["0"]," prompt"],"RGCCrg":["Copy share link"],"RGkNeJ":["Initialize a starter pack"],"RJ3a8Z":["Looking for <0>",["lookingForUrl"],"</0>."],"RN62Q8":["We'll build <0>openknowledge.skill</0>, save it to <1>~/Downloads</1>, and open the Claude Desktop App for you."],"RSqaSd":["Project root"],"RVZJWQ":["Search projects..."],"RXNu_r":["Shared via git with everyone working on this project."],"RY6Bq1":["Open shared ",["targetNoun"]],"RaPMZv":["Keyboard shortcuts available in the editor and workspace."],"Rah7yq":["What should the AI do? (optional)"],"RfHNf8":["Open activity panel for ",["tooltipName"]],"RfaEio":["Toggle source comment"],"RgbKEe":["You don't have access to this repository."],"Rj01Fz":["Links"],"RlCInP":["Slash commands"],"RlLl3G":["Actions for ",["0"]],"RmBY0A":["No git remote"],"RnrnTe":["Already set up — ok is available in your terminal"],"RobAKV":["Update the destination and optional section anchor."],"Rq1vFD":["Tree view options"],"RrAIZx":["What config sharing covers"],"Rx5ReQ":["Rename ",["keyName"]],"RyIKxy":["This ",["targetNoun"]," has been moved, renamed, or deleted in your local copy, and that change hasn't synced yet."],"S33tz3":["Not connected"],"S34Vju":["Have something else in mind?"],"S6l5dv":["Could not start creating a new item"],"S9Vnum":["Remove ",["patternText"]],"SCoBBH":["Tag suggestions"],"SCzAbA":[["phase"]," — ",["pct"],"%"],"SEYWYq":["Undo all edits on this file?"],"SFN6dN":["Heading 3"],"STTOnz":[["keyName"]," type: complex value (nested; read-only)"],"SUOoXn":["Failed to open project."],"SVLPt5":[["formatted"]," GitHub stars"],"SXCSQd":["Copied path"],"SYfHmN":["Unpin tab"],"Sc1bKE":["Local collaboration data for \\"",["docName"],"\\" could not be cleared in time. Reload to retry."],"ScwcF2":["A project already exists at this location. Pick a different parent folder."],"SgKLfA":["Not connected to GitHub."],"Sh3Qkg":["No matching branches."],"SiUUCS":["Next match"],"SkMZlS":["Couldn't remove <0>",["targetGitPath"],"</0>: ",["removeGitError"]],"Skr_7L":["Search worktrees"],"Sq8lf2":["Editors to install skills into"],"SrOuyg":["Document panels"],"T-654M":["Loading PDF"],"T0OVm7":["The default branch is protected — pushes need a pull request."],"T67A0Y":["Auto-sync pushes/pulls commits to your git remote on intervals and on save. Toggling on requires confirmation."],"TEEPPF":["Will replace existing OpenKnowledge entry"],"TJnkyf":["ok ui responded but server.lock has no port yet"],"TKQ7K-":["Install"],"TLIO3j":["Toggle italic formatting."],"T_wG4n":["We couldn't check your GitHub connection."],"Ta25TG":["No history yet"],"TbjyhA":["Docs"],"ThmUrC":["Could not finalize project setup. Try again."],"Tjc1pH":["Section <0>(optional heading anchor)</0>"],"TsZmgr":["The file on disk, and the id agents use."],"TwYboS":["Navigate CodeMirror source search results or dismiss the search panel."],"Tz0i8g":["Settings"],"Tz9pJB":["Clone stream ended unexpectedly — check if the clone completed"],"U2Kx6T":["Close all unpinned"],"U2pMtf":["tag-name"],"U3IvM5":["Full guide"],"U5Spo9":["Content directory must be inside the project"],"U8CD-l":["Copy full path, No workspace"],"UBv8UK":["Delete Permanently"],"UDFrWm":["Checking GitHub connection..."],"UL8A9w":["Tag"],"UMrOy2":["Skill \\"",["trimmedName"],"\\" created"],"UPjaXD":["Couldn't duplicate \\"",["0"],"\\": ",["1"]],"UQAp48":["Search templates"],"UQMMvx":["Moved \\"",["name"],"\\" to ",["0"]],"URmyfc":["Details"],"UTNVyS":["Select the full source document."],"UTZ97u":["Selection must be inside the project"],"UVLlMV":["Couldn't reach GitHub. Try again?"],"UW2Fg3":["This project's running server doesn't support live editing. Restart OpenKnowledge to fix."],"UW93oq":["Replace key"],"UYcGIW":["Connecting — waiting for collab server"],"Ua78MH":["no response"],"UaDyeb":["Hide selection preview"],"Uay5NL":["This ",["targetNoun"]," was added to branch <0>",["shareBranch"],"</0> recently. Switch and update to open it."],"Uci-Ph":["Ordered List"],"Ud0Pj9":["<0>Mirror source removed.</0> The doc <1>",["src"],"</1> is no longer available."],"UfW9Kr":["Your search queries and the full text of matching pages are sent to your embeddings provider (OpenAI by default) to compute embeddings."],"UhpfxY":["Pan left"],"UkQGhd":["Hide replace"],"Up2_7p":["Copy full path"],"UuYo7g":["This ",["targetNoun"]," has been moved, renamed, or deleted in your local copy. Please commit your changes or enable auto-sync."],"Uuj_R4":["New from template"],"Uw6ERJ":["Couldn't copy: ",["detail"]],"UyROxs":[["mins","plural",{"one":["#"," min ago"],"other":["#"," min ago"]}]],"V48OUT":["You deleted <0>",["filePath"],"</0> locally, but it was modified upstream."],"V7QxyT":["Connection dropped"],"VAHWL_":["Connected as <0>@",["signedInLogin"],"</0>"],"VBE2dw":["Build and keep track of the world behind your story. A home for your characters, places, factions, and the lore that ties them together, so details stay consistent as you write."],"VIwCaD":["Entry"],"VM7H66":["This file is binary and can't be shown as text."],"VNgKZz":["Advanced settings"],"VU3Nrn":["Missing"],"VUijjF":["Embed an image with optional alt text."],"VYd_YA":["Open an existing project folder from disk."],"VZGGPK":["Collapse terminal"],"VZGh8G":["Fold, unfold, fold all, or unfold all source ranges."],"VZSBXL":["Semantic ranking activates the first time an agent runs a search."],"V_6bJ4":["Terminal settings not loaded yet — try again in a moment."],"V_wltx":["Enter a title for this template."],"VbqhBI":["Already at ",["assetContentPath"]," — reusing."],"VcqWBy":["Upload may have succeeded but the sidebar is out of date — refresh to resync"],"VdXv4D":["Clone from GitHub"],"Vlc75q":["Keep file deleted"],"VsaI0G":[["folderCount","plural",{"one":["folder"],"other":["folders"]}]],"VuxVSP":["Start source completion"],"VvS_k_":["Config sharing is now local-only."],"VxO6wR":["Delete selected files or folders"],"VzGJRl":["Add link"],"W-ntoW":["heading-slug"],"W0i24j":["Object"],"W1qRuM":["This document is already active in the editor. Use Open to collapse the graph."],"W3Xlpc":["Set the auto-sync default for users opening this project for the first time. This setting is committed to your repository."],"W5A0Ly":["An unexpected error occurred."],"W7XJN4":["Can't nest projects. An OpenKnowledge project already exists at <0>",["rootPath"],"</0>. Choose a location outside it, or open that project instead."],"W8vpBM":["starter pack"],"W9_Bub":["Local changes overlap with incoming sync"],"WL6puM":["Path resolves outside project"],"WMIKXK":["Are you sure you want to delete ",["targetCount"]," selected items? Folders and all files inside them will be deleted. This action cannot be undone."],"WPwDin":["Open folder on disk"],"WR0y2O":["Share folder"],"WRNXKp":["Searching"],"WWcqsG":["Start here: what this is and how it's organized."],"WZ-vBy":["Permanently deletes <0>",["targetGitPath"],"</0> and all its git history. Working files stay in place. If the parent git repo is intentional (e.g. you cloned it), cancel and pick a location outside it."],"Waiy-j":["The agent's persona, values, and voice."],"WamGNs":["Failed to load PDF: ",["error"]],"WcWS__":["Download file"],"Wcv-Zi":["Make this knowledge base available as a Claude Skill."],"We7h2I":["📝 or assets/icon.png"],"Weq9zb":["General"],"Wgmlsw":["Fetching"],"Wh0im4":["editing [[",["realCurrentDoc"],"]]"],"WhOsNE":["Strikethrough"],"WmPbvm":["Get product updates in your inbox."],"Wq6Wcm":["Please enter a valid email address."],"WqLq6M":["Open with AI ",["displayName"]],"Wt5W56":["Sync is off — your edits will not sync to the remote repository."],"Wtw22s":["Installing"],"WyQxwa":["Connect this project to GitHub to share."],"WyXG7w":["Close all"],"Wyxs0x":["Path cannot contain \\"..\\""],"X0ttSN":["No tags match \\"",["tagListQuery"],"\\"."],"X7u0xR":[["0"]," templates available"],"X8kjQX":["Re-authenticate with GitHub"],"X9VpsP":["Loading folder contents"],"XAyxsa":["Check out remote branch"],"XDzAnp":["Opens in a new tab"],"XH30C4":["document"],"XJOV1Y":["Activity"],"XPJ0sN":[["settingsDescriptorLabel"]," properties"],"XPqe3B":["Create new tag #",["tagValue"]],"XRuL0i":["Create page"],"XU0OXn":["Enable auto-sync"],"XV5sC0":["Open worktree"],"XW18jo":["Page headings response did not match success schema"],"XYlJJT":["Setting up"],"XcGbim":["Show hidden files"],"Xet9MX":["Failed to load backlinks"],"Xewl6B":["Your local copy is behind. Pull the latest changes, then open the link again."],"XfzqjK":["template \\"",["name"],"\\""],"Xl-UUg":["guides/install or https://example.com"],"XmJfZT":["name"],"XnlF3W":["Add the next matching source selection."],"XnoA1k":["This ",["targetNoun"]," only exists on branch <0>",["shareBranch"],"</0>. You have uncommitted changes that prevent switching. Commit or stash your changes, then open the share link again."],"XopE_I":["Failed to parse backlinks error response (HTTP ",["status"],")"],"XpIZmv":["Fenced code block with monospace text."],"XqNHcm":["Couldn't update skill targets: ",["0"]],"XtRoxT":["Page ",["pageNumber"]],"XuQzrk":["Couldn't restart the server — another process owns it. Quit other OpenKnowledge windows for this project, then try again."],"XvPJaT":["Diff layout"],"Xv_ijG":["https://github.com/owner/repo or owner/repo"],"Xw_maT":["Type a query, then press ↵ to search your pages by meaning."],"XyOUTJ":["Exit merge"],"Xzy0s0":["Remove ",["fullLabel"]," from context"],"Y-Urt2":["Block math equation rendered with KaTeX from a LaTeX source string."],"Y1QMlM":["Get set up"],"Y1kX2z":["OpenKnowledge initializes at <0>",["projectDir"],"</0> — the parent of <1>",["pickedRelative"],"</1> because it contains a <2>.git</2> folder (one .ok/ per git repo). <3>Content directory</3> defaults to <4>.</4> (the whole repo); type a sub-folder to narrow it."],"Y6SK9K":["Show source"],"Y8ViJx":["A newer version may have been deployed since this tab opened."],"YC6_wP":["Edit ",["keyName"]],"YEP3X2":["Delete a table when the active table cell selection covers the full table."],"YGIi_c":["Reinstall"],"YJ1BTp":["A skill with that name already exists."],"YKLP_-":["Template renamed"],"YPFBfr":[["detail"]," - ",["kind"]," \\"",["createdPath"],"\\" still exists on disk"],"YSFv5w":["No git repository — config sharing does not apply here."],"YTLmTM":["Remove the parent <0>.git</0> folder"],"YW7Q86":["Search settings not yet loaded — try again in a moment"],"Y_kL7X":["Customize how the editor looks and behaves."],"YaeyFh":["Pulls may overwrite uncommitted edits in your local files."],"Yea-K5":["Restore to this point"],"Yi0VMG":["Upload ",["keyName"]],"YjhKI5":["Cloning..."],"YlDuro":["Fit height"],"YsEYYS":[["behind","plural",{"one":["#"," commit behind"],"other":["#"," commits behind"]}]],"YwPUUP":["This pack is already set up here."],"YyXtnN":["Underline"],"Z1LF1M":["Sharing a doc needs a GitHub repository. Create one for this project."],"Z2M5XM":["Reason: ",["reason"]," (",["osDetail"],")"],"Z3FXyt":["Loading..."],"Z5HWHd":["On"],"Z5h97D":["Hide files and folders from your knowledge base. Hidden items don’t appear in the file tree, search, or AI tools. <0>Learn more about patterns</0>."],"Z8KDox":["Enter a folder name (e.g. brain)."],"Z8lGw6":["Share"],"ZARuZJ":["Couldn't load files"],"ZBYKxv":["Reverts every change this agent made to <0>",["docName"],"</0> this session (",["burstCount","plural",{"one":["#"," burst"],"other":["#"," bursts"]}],"). Other files and writers are unaffected."],"ZBt4rI":["Instruction for the AI"],"ZLQol-":["You can turn this on later in <0>Settings → Sync</0>."],"ZNK2Tq":["root"],"ZQJ1IV":["Activate the last editor tab."],"ZQLDTl":["created folder"],"ZU8VV_":["Remove failed: ",["error"]],"ZWgr0b":["In a subfolder"],"ZWolSV":["You picked the filesystem root (/). Scaffolding here will scan every file on this machine — make sure that's what you want."],"ZWwYwM":["Base branch"],"ZWxfrc":["cleared folder properties"],"ZWyHmq":["This project"],"ZYtq3m":["Connect the AI tools you use to this specific project. These files live in the project folder, so anyone who opens it gets the same setup."],"Zf0w-R":["Take a piece of writing from a rough idea to a finished draft to something you're ready to share. Good for blog posts, essays, or anything you want to move through clear stages."],"ZgGuA4":[["0","plural",{"one":["File"],"other":["Files"]}]],"ZhhOwV":["Quote"],"ZjtgI-":["Command palette"],"Zon_qG":["Mirror source <0>",["label"],"</0>"],"ZptNUh":["Show ",["hidden"]," more"],"ZsGpr_":["Paste link"],"Zue_jx":["Your GitHub token is missing required scopes. Try signing in again."],"Zul8Ry":["never"],"ZvzbDF":["Add it directly to this project."],"ZxXhLY":["Hide Files (",["sidebarShortcut"],")"],"Zz25kq":["Show Files (",["sidebarShortcut"],")"],"_5qBNl":["AI tools & CLI"],"_6FVBz":["Jump to tab 1-8"],"_7UQ7y":["Whole word"],"_8quCH":["From template"],"_902BE":["This ",["targetNoun"]," was shared from branch <0>",["shareBranch"],"</0>. You're currently on <1>",["currentLabel"],"</1>."],"_BthEY":["Open in ",["shareBranch"]],"_NX6gG":["Managing project AI tools is unavailable in this build."],"_PACVa":["Release notes"],"_PBJRl":["Add at least one letter or number."],"_QwkMu":["No matching paths"],"_RcqUM":["You picked your home directory. OpenKnowledge will index everything in your home tree — large and may surface personal files."],"_TDESN":["Network error - ",["kind"]," \\"",["createdPath"],"\\" still exists on disk"],"_TF8ep":["Failed to render PDF"],"_VRtd7":["Couldn't send the selection — please try again."],"_W-elG":["(inline)"],"_WPP7e":["Read-only copy of a MirrorSource block from another doc. Edit at the source and it updates live."],"_XWY2J":["Terminal disabled"],"_ayOfA":["A knowledge base that follows Google's Open Knowledge Format, a shared way of organizing what you know. Pick this if you want your notes to work well with other tools that understand the format."],"_bth6g":["Claude Code is installed, but OpenKnowledge tools aren't connected to it yet."],"_eguJc":["Uploading"],"_gkGSK":["deleted template"],"_hPpdX":["Skill renamed"],"_pY_Vq":["The repository was moved, renamed, or deleted."],"_qD6mn":["Pick the folder where you've cloned it."],"_rP3HI":[["minutes"],"m ago"],"_tekeB":["updated folder properties"],"_tjopj":["Paste duplicate"],"a-cKXz":["Select all source"],"a3H_MR":["Open and focus the Ask AI composer for the current editor selection."],"a5Gha5":["Local changes blocked the merge"],"a5W0q0":["Are you sure you want to delete ",["folderName"],"/ and all files inside? This action cannot be undone."],"a9OzSn":["No pages found for \\"",["trimmedQuery"],"\\""],"aBgwis":["Scope"],"aByJ8j":["How does sharing work?"],"aE2_XM":["One pattern per line — appended to <0>.okignore</0>."],"aENGMB":["Semantic search adds meaning-based ranking to the search tool so conceptually-related pages surface even without shared keywords."],"aM23Wr":["page-name"],"aOp3hw":["Couldn't move to Trash"],"aWlJai":["Starting sign-in flow"],"a_u4ck":["Loading tags"],"aaE55D":["Clear ",["keyName"]],"aalx4E":["Editing broken MDX source: ",["reason"]],"abiHje":["Delete selected items"],"adsMWO":["Resolving deltas"],"aiArms":["We couldn't clone this repository."],"ajz9F8":["Couldn't load conflict content for ",["filePath"],". Try reloading the page."],"aoa6xA":["network error (is \`ok ui\` running?)"],"arUUsK":["Product updates"],"az8lvo":["Off"],"b3Thhd":["Upload failed"],"b4AQFK":["Open activity panel for ",["tooltipName"],", editing ",["realCurrentDoc"]],"b4VvP-":["Existing branch <0>",["trimmed"],"</0> will be checked out into its own window, under <1>.ok/worktrees/</1>."],"b4itZn":["Working"],"b5aNbi":["The ",["targetNoun"]," could not be opened — try navigating to it manually."],"bBE5tC":["Detected on this machine"],"bBcFK_":["Open emoji picker for ",["keyName"]],"bD8I7O":["Complete"],"bGa3Fk":["Uploading file"],"bH382I":["Edit this HTML — the preview updates live."],"bSD4im":["Search worktrees and branches"],"bS_boY":["Replace current match"],"bUUVED":["Asset"],"bV6DJA":["Who you are, so the agent has your context."],"bWLmRK":["Could not fetch branch. Check your connection."],"ba3vIW":[["templateCount","plural",{"one":["template"],"other":["templates"]}]],"bcDHUM":[["descriptorLabel"]," — render error, source editable below"],"bcjYUA":["Fold or unfold source"],"bkQRMh":["Paragraph"],"blFttG":["Search projects"],"bmC18N":["Clearing local collaboration data for \\"",["docName"],"\\" before reconnecting."],"brCtGB":["History unavailable"],"bultyE":["When enabled, the agent opens or refreshes the preview after each edit. Disable if you manage your own preview window (OK Desktop, a browser tab on another display, etc.)."],"bwil08":["Building <0>openknowledge.skill</0> and opening the Claude Desktop App"],"c1LZZH":["Link copied."],"c5f7sm":["Code block language: ",["currentLabel"],". Click to change."],"c5rF4v":["What is this knowledge base for?"],"c863eW":["Could not switch to ",["shareBranch"],". Try switching manually."],"c8iK2Y":["No templates found."],"c8jBgX":["Checking for updates on GitHub"],"cEoyWz":["Add item to ",["keyName"]],"cF9DyA":["Reconnecting after server restart"],"cIptmH":["In the Claude Desktop App"],"cKjLuT":["(project + user)"],"cOSAfL":["No repositories found on your GitHub account."],"cOrTMo":["Your share link is ready below."],"cRHuuI":["Couldn't copy path"],"cSCbv3":["BETA"],"cUK8lW":[["conflictCount","plural",{"one":["#"," conflict"],"other":["#"," conflicts"]}]],"cUk6TF":["Sync failed — check the server logs for details."],"cV7LOw":["Team Wiki"],"cZGNlb":["Add another pattern"],"cZI5AL":["OK Desktop"],"cZ_8zB":["Stays on this computer."],"cdm00A":["No Incoming"],"cdmk8A":["Uncommitted changes"],"chL5IG":["Community"],"cklVjM":["Timeline"],"cn1sLi":["Couldn't connect OpenKnowledge tools to Claude Code. Please try again."],"cnGeoo":["Delete"],"cqQyPB":["Folder name"],"crqzW5":["AI tools"],"cs4mps":["Config sharing"],"csDS2L":["Available"],"ct2kv5":["No headings in ",["pageTarget"]],"cuA8QW":["Organize specs"],"d1JjXo":["Your local copy of branch <0>",["branch"],"</0> is behind. Pull the latest changes, then open the link again."],"d2uTPx":["Server error (HTTP ",["status"],")"],"d5rK4X":[["chars","plural",{"one":["char"],"other":["chars"]}]],"dD7NPy":["Outline"],"dDpCOp":["Rename succeeded but the sidebar may be out of date — refresh to resync"],"dEgA5A":["Cancel"],"dGAdpH":["New branch <0>",["trimmed"],"</0> will be created from <1>",["currentBaseLabel"],"</1>, in its own worktree under <2>.ok/worktrees/</2>."],"dIYSqk":["remote"],"dJw2_7":["Saved with the project for your team."],"dMsx3p":["Home page and navigation hub."],"dN20LW":["Semantic search is on, but no API key is set — search falls back to keyword matching. Add one in <0>Settings → Account</0> (it's stored once for your whole machine)."],"dNM58w":["Claude Code (claude) isn't installed or on your PATH."],"dOHMA0":["Failed to move"],"dOxPd4":["Footnote"],"dPOFid":["Show or hide terminal"],"dTaauv":["Reason: ",["reason"]],"dUCQo4":["Renamed to \\"",["trimmed"],"\\""],"dUQ7_J":["Add meaning-based ranking to search so conceptually-related pages surface even when they share no keywords. This setting applies only to this computer."],"dURmlQ":["\\"frontmatter\\" is a reserved property name"],"dXWMFn":["Removes this skill from your editors."],"dbapvC":["Follow us on social media"],"dbhUX1":["Hide this file"],"dbtjJh":["(opens in new tab)"],"djc1l9":["More than ",["0"]," requests were blocked by the preview's security policy"],"djjdjr":[["deleteCount","plural",{"one":["Delete"],"other":["Delete ","#"," items"]}]],"dprWmL":["Anchor in this page"],"dr1vFs":["Replace all matches"],"dvGKu2":["Shared auto-sync default"],"dw_3cv":["Rename skill"],"dw_dUJ":["Failed to duplicate path"],"e0NrBM":["Project"],"e1Rn_k":["Open containing folder"],"e1hptq":["Embed a video with native player controls."],"e4GHWP":["Pull"],"e4PbgC":["Duplicate the file-tree item copied from the Files sidebar."],"e8L17t":["A non-empty folder already exists at this path. Pick a different folder."],"e8zRrb":["Show Files"],"eBIT9h":["Paste failed.",["restoreSuffix"]],"eFJkVt":["Clone failed: ",["cloneError"]],"eG8Jsg":["Toggle source tab focus mode"],"eGUbmF":["Copy selected file or folder"],"eJitUk":["Upload from computer"],"eKThTQ":["Failed to reorder"],"eNQGRb":["Inline LaTeX math rendered with KaTeX."],"ePK91l":["Edit"],"eQkgKV":["Installed"],"eQxm13":["Failed to update attachment location — ",["detail"]],"eSu2Xn":["Writes a project-MCP config for each selected tool; Claude also gets <0>.claude/launch.json</0>."],"eTL5y9":["Show selection preview"],"eTsJYJ":["description"],"eVPynQ":["Open <0><1>",["verificationUri"],"</1><2/></0> and enter this code:"],"el312q":["Install skills into"],"emgiet":["Authoritative content; mirrored verbatim everywhere it's referenced."],"eneWvv":["Draft"],"epuNYK":["Mark a block as the source of truth. Mirrors elsewhere update live as you edit it."],"euc6Ns":["Duplicate"],"evs0iw":["Tags matching \\"",["tagListQuery"],"\\""],"f1XQyZ":["Move block"],"f65AOQ":["Start from"],"f8jU-L":[["0"],"/",["1"]," — ",["2"]],"f9lQNJ":["Adds a managed block to"],"fBHvBn":["There's no project folder for this window, so a terminal can't start here."],"fBaTkM":["Toggle the bottom terminal panel."],"fG0X0e":["Install ",["brand"]," →"],"fIgqfQ":["Reinstalling"],"fJgQHX":["Failed to create file"],"fNr-MX":["Disable semantic search"],"fR-Kdc":["(project-level only)"],"fVcm9t":[["0","plural",{"one":["#"," doc"],"other":["#"," docs"]}]],"fWi7pn":["Initialize starter pack"],"fWsBTs":["Something went wrong. Please try again."],"fYKgzG":["Failed to load recent projects."],"fYjgXu":["Unordered list of items."],"f_PkYv":["Restarting closes this project's server. Connected agents (Claude Code, Codex, Cursor) will see their OpenKnowledge MCP connection close unexpectedly — you may need to restart the agent, or toggle its OpenKnowledge MCP server off and on, to reconnect."],"fbdLmk":["Toggle bold formatting."],"fbsiBw":["Something went wrong starting the terminal."],"fcgvCA":["Claude"],"fiMNLl":["Sync settings not yet loaded — try again in a moment"],"fj5YiP":["Downloads a fresh copy from GitHub."],"fnlBN4":["Auto-approve settings not yet loaded — try again in a moment"],"fo0VXg":["Uninstall"],"fqSfXY":["Replace"],"fuJZKk":["Search branches"],"fwhX-N":["Indent or outdent source"],"fxbCNQ":["Synced. The link is up to date."],"g3UF2V":["Accept"],"g4WlQK":["Project AI tool management is only available in the OpenKnowledge desktop app."],"g4XBm0":["Small section heading."],"g58Kwy":["<",["descriptorLabel"],"> failed to render (likely a bad prop). Copy the source to see what went wrong, or delete the block."],"gBbxn_":["Checking sign-in status"],"gGVP4q":["Click <0>+</0> <1/> <2>Create skill</2> <3/> <4>Upload skill</4>."],"gHSAWT":["Create worktree <0>“<1>",["typedName"],"</1>”</0>"],"gITz7o":["Move the cursor or extend selection through CodeMirror's standard source-editor navigation keymap."],"gJR87V":["Could not create the project folder. Pick a different folder."],"gKi-a_":["New project"],"gQV-9w":["Branch switched but the ",["targetNoun"]," could not be opened — try navigating to it manually."],"gUlRQj":["Orphans"],"gYuDfu":["Pick a starter pack to scaffold your project with ready-made folders and templates."],"gYz2ep":["Expires in ",["timeLabel"]],"gbHcbI":["Failed to delete property"],"gfdqcY":["Couldn't apply the change: ",["0"]],"gfohmY":["Connect tools"],"ggm6JX":["This page doesn't exist yet. Open it to create the page in the editor and collapse the graph."],"ggs9f8":["Search files, folders, or commands"],"gijbne":["Failed to rename path"],"gk_-qj":["Couldn't rename template: ",["0"]],"gljvbT":[["words","plural",{"one":["word"],"other":["words"]}]],"glzsS_":["Pan right"],"gmJ0An":["Failed to open folder."],"goO4Ll":["Editor status bar"],"gp3I7-":["Before syncing, set your identity for git commits:"],"gtEbeW":["Highlight"],"gvApb7":["Turn the things you read into clear, trusted articles. Save a source, figure out what it means, then keep the final version so you can rely on it later."],"gwykHF":["This doc hasn't synced to GitHub yet. The link will work after the next sync."],"h-AdvS":["The folders and templates are already here, so there's nothing to add."],"h06R3C":["No pages are missing outgoing graph links."],"h6EvY-":["This will replace the current document content with the version from <0>",["relative"]," (",["absoluteTime"],", ",["entrySha"],")</0> by <1>",["authorName"],"</1>. Your current content is already saved in the timeline — you can restore it anytime."],"h7FzJC":["Link-graph response did not match expected shape."],"h9QFb9":["Skill \\"",["0"],"\\" deleted"],"hBMK4W":["Project templates"],"hCOLSd":["Keep a written record of how your product gets built. A home for proposing ideas, recording decisions, writing specs, and capturing what you learned after something broke."],"hDEaQu":["Connect OpenKnowledge to other tools you use."],"hDKtoF":[["diffHrs"],"h ago"],"hDoLrm":["Remove ",["projectName"]," from recent projects"],"hGmuTc":["Docs tagged #",["tagDocsName"]],"hHMv6l":["Delete block"],"hIQkLb":["New chat"],"hItdtk":["Browse folder"],"hLy8b1":["Updated to Version ",["version"]],"hQXiDc":["Search branches..."],"hSBIG-":["A title, description, tags — anything that describes this folder."],"hSySVc":["Install handoff failed: ",["msg"]],"hXUWyd":["Value is required"],"hXbSxc":["Asset: ",["title"]],"hY8pka":["Select next occurrence"],"hYDc6B":["Name cannot be empty"],"hYgDIe":["Create"],"hZoBHK":["Empty starting content"],"haHgQj":["Copied relative path"],"habOU_":["Failed to update the auto-approve setting — ",["detail"]],"he3ygx":["Copy"],"hjO0Mq":["Add tab"],"hmYd9H":["Keep track of the people and companies you work with and the meetings you have with them. Good for remembering who someone is, how you know them, and what you last talked about."],"hnq8fP":["Remove ",["label"]," from context"],"hpDtUm":["External wiki link"],"hpzRlK":["Reopen closed tab"],"hwFOFD":["Settings failed to load"],"hxBHxQ":["A line with a footnote<0><1>[1]</1></0> and a definition shown below."],"hxEUVJ":["Initialize ",["selectedPackName"]],"hyCxJY":["Open that worktree instead"],"hynz2K":["Download started"],"i-ShMB":["Diagram"],"i1flq_":["Wiki link suggestions"],"i3f2kh":["No matching commands."],"i92eAT":["We'll create a repository and start syncing — no terminal needed."],"i9OyGp":["Undo or redo"],"i9TPUi":["This ",["targetNoun"]," isn't on branch <0>",["branch"],"</0>. It may not have been pushed yet."],"i9toLO":["Agent configuration file"],"iAoh55":["Update \\"",["0"],"\\"?"],"iDZtvM":["Failed to load templates: ",["message"]],"iEQQyu":["Agent"],"iEYxO4":["Show thumbnails"],"iGCs04":["No templates available"],"iH8pgl":["Back"],"iHAJDj":["Resolving default location"],"iKSP5j":["Word wrap"],"iKZkk1":["Property value"],"iMkWoF":["Turn on"],"iNFKkm":["No diff."],"iO8V-7":["Create worktree"],"iOHg1t":["Open embedded URL in new tab"],"iSLIjg":["Connect"],"iSQTsg":["Ordered list"],"iSnkwB":["Failed to open cloned project."],"iTlqm3":[["ahead","plural",{"one":["#"," commit ahead"],"other":["#"," commits ahead"]}]],"iTylMl":["Templates"],"iXTp5j":["Scope: "],"idD8Ev":["Saved"],"ig5vUe":["Failed to load file"],"iilQXA":["Folder duplicated"],"ijLc3m":["Bullet list"],"ilodsp":["Let agents use OpenKnowledge without asking"],"ipn17C":["The <0>type</0> every document created from this template gets (e.g. <1>research-note</1>). Keeps new docs Open Knowledge Format–conformant."],"iqIDv4":["Sync status unavailable"],"iqugog":["Initialize failed: ",["errorDetail"]],"irFGwu":["Template list"],"ircigK":["Blank project"],"irrm_E":["Remove selection"],"isRobC":["New"],"iuTKci":["No edits yet."],"iycx_A":["Pushing"],"j9Vqvc":["inherited"],"jAMpHn":["What is a starter pack?"],"jBVUXo":["Couldn't open the terminal — please try again."],"jEZ6Lf":["provisional"],"jEdF24":["Missing page: ",["linkTitle"],". Click to create."],"jKd3AP":["Could not enable the terminal: ",["0"]],"jPUPvG":["Couldn't resolve the conflict for ",["filePath"],"."],"jRHdCz":["Failed to load PDF"],"jSO1X5":["Inherited templates can't be renamed here — rename it in the folder that owns it."],"jSY41h":["\\"",["docName"],"\\" took too long. Check your connection."],"jTLWxh":["Embed an external page in an inline iframe (docs, demos, Figma, CodeSandbox)."],"jX0IPx":["A skill with this name already exists."],"jZ_E5M":["Fetch failed — check the server logs for details."],"j_Z6g7":["Shared default"],"jbSG8V":["Show Files (",["sidebarShortcutLabel"],")"],"jdGUeI":["Couldn't create template: ",["error"]],"jerqF0":["Loading branch state"],"jhtG3I":[" Your selection has been restored."],"jjtmV_":["First file name"],"jol95m":["Failed to open Project Navigator."],"jtg_8-":["Build a knowledge wiki about the different types of flightless birds. Start with an overview page, then add cross-linked pages for each major group (ratites like ostriches, emus, and kiwis; penguins; and flightless rails), the regions they live in, and a timeline of how flightlessness evolved."],"ju38ms":["This project has no git repository — sharing mode does not apply. Initialize a repo to enable the toggle."],"jwnpdM":["A template named <0>",["trimmedSlug"],"</0> already exists here. Saving creates a local copy that overrides it for this folder."],"k4CuuV":["Ready-made folders and templates to get you started quickly. Select a pack to preview what gets created, then add it to your project."],"kCNU4q":["Indexing your pages — ",["semanticIndexedCount"]," of ",["semanticTotalCount"]," ready. Results may be incomplete."],"kCqCyf":["Open CodeMirror's lint diagnostics panel."],"kFLlsI":["Insert a footnote reference + matching definition stub."],"kLv8d3":["Your copy of branch <0>",["shareBranch"],"</0> has changes that aren't on GitHub. The ",["targetNoun"]," will appear once the branch syncs."],"kNqMMd":["Folder"],"kUn-CN":["Sync off"],"kV2YZv":["Don't see <0>Skills</0>? Enable <1>Settings <2/> Capabilities <3/> Code execution and file creation</1> first."],"kYL1lH":["Agent activity"],"k_pade":["Config sharing is now shared. Commit the OK files to share with your team."],"k_yIIc":["Will be created at: <0>",["targetPreview"],"</0>"],"kdzzOK":["Off — search ranks by keyword only. No content leaves this computer."],"keNFEd":["Set identity"],"khCa4M":["Teaches coding agents in this project to read and write through OpenKnowledge."],"kj9pAE":["Creating page"],"kknhfj":["No changes"],"kmKqZg":["Clusters"],"knjOzA":["Tag value"],"kolRU1":["Do you want to permanently delete instead?"],"kpqWwG":["This ",["targetNoun"]," was removed from branch <0>",["branch"],"</0>."],"ku0yLQ":["Pages are embedded the first time a search needs them."],"ky9Tuc":["Edit ",["0"]," source"],"l17ab4":["Could not write project files. Try a different location."],"l1aQKz":["Visual editor table"],"l1l8sj":[["0"],"d ago"],"l3s5ri":["Import"],"l46MqT":["Next tab"],"l6OXqI":["No installed agents found"],"l6kpzR":["This ",["targetNoun"]," has been moved, renamed, or deleted in your local copy of branch <0>",["branch"],"</0>, and that change hasn't synced yet."],"l8G3S9":["Auto-sync is off — you don't have permission to push to this repo"],"lAiyU_":["Only the current document uses <0>#",["tag"],"</0>."],"lCC_D5":["Subscribing..."],"lGs_bQ":["Page <0>*</0>"],"lHwYMr":["Server error: ",["status"]," ",["statusText"]],"lI0Td2":["Use letters, digits, <0>_</0> and <1>-</1> only."],"lIn9L9":["Disable sync"],"lPzyrU":["All hunks resolved"],"lVWEIL":["Indexed ",["embedded"]," of ",["total"]," pages."],"lWNpNB":["Add cursors or select matching occurrences through CodeMirror."],"lXKZGw":["Heading 1"],"lZAiSP":["Backlinks response did not match expected shape."],"l_FAT6":["Use letters, digits, <0>-</0> or <1>_</1> only."],"l_UFPv":["Properties"],"lb_UU4":["Sync now"],"lbkOif":["Undo or redo visual-editor changes through TipTap collaboration history."],"lhjq3G":["Reset ",["labelText"]," to default"],"ljHjfg":["That branch is already open in another worktree."],"lkYioO":["Show or hide document panel"],"ll2yNl":["Content directory"],"lond3p":["Shows above the code body. Round-trips as \`title=\\"...\\"\` in markdown."],"lrhetp":["+ ",["overflow"]," more"],"ls1N1w":["(missing)"],"lyWa43":["Project-level disconnected pages"],"lzmtKp":["Failed to load folder properties: ",["message"]],"lzwo7p":["Could not open GitHub sign-in. Please try again."],"m16xKo":["Add"],"m2T1Xj":["Tag #",["tagValue"],", ",["uses"]],"m4v3XT":["Undo last edit on ",["docName"]],"m6YGpY":["Active panel content for the selected tab shows here."],"mBltnd":["Path suggestions"],"mGaZwZ":["See the full install guide"],"mHVPm5":["Reconnect required"],"mLAjyL":["Give the AI tools you use access to read and update your projects. Checking a box sets it up right away; unchecking removes it."],"mNY1G6":["Undo all edits"],"mPneVR":["Updated \\"",["display"],"\\" to ",["0"],"."],"mPy9lS":["Organize my existing specs into a linked index grouped by area, and flag any that have drifted out of sync with the current code."],"mU3j1b":["Remove item ",["0"]],"mVFyH-":[["accessibleLabel"]," (conflict)"],"mWVJRX":["Collapsible section with a clickable summary."],"mY8U64":["Teach agents a repeatable task. You can edit the body after creating."],"mYGY3B":["Date"],"mYzDD_":["A worktree folder for that branch already exists."],"mZ1r4i":["Create a document from ",["label"]],"maDWIB":["Mirror source <0>api-spec</0>"],"makN88":["No patterns yet. Type a folder or file name below to start hiding files."],"mdKFEy":["You cancelled loading \\"",["docName"],"\\"."],"mdzKSV":[["nodeCount","plural",{"one":["#"," node"],"other":["#"," nodes"]}]],"mf37rL":["Retrying"],"mg0YGL":["Source multi-cursor and multi-select"],"mk2poV":["e.g. server.ts"],"mmpzAq":["Wrap long lines in the markdown source editor."],"mo22UP":["Toggle inline code formatting."],"mqSwZH":["<0>Mirror anchor not found.</0> No <1>",["mirrorSourceTag"],"</1> exists in <2>",["src"],"</2>."],"msOK6I":["Repositories you've already cloned may keep syncing through git's own saved credentials, even after you disconnect."],"msqUNq":["Ready-made folders and templates to get you started quickly."],"mu1O0q":["Open Knowledge can manage ",["0"]," editor skill(s) for this project. Import moves them into .ok/skills and replaces the .claude, .codex, etc. copies with symlinks — one place to edit, in sync everywhere. If those folders are committed to git, review the change first; symlinks can behave differently on some editors and on Windows."],"mwMF9u":["Open CodeMirror search in source editor mode."],"mxY24F":["Duplicate the focused file-tree item when focus is in the Files sidebar."],"n2lRue":["Commit or stash changes to switch:"],"n5n_vi":["Private repository"],"n6hXUm":["Auto-sync periodically fetches, pulls, and pushes commits to your remote git repository so your edits stay in sync across machines."],"n7aopT":["Editor mode"],"n8DwqQ":["Connects automatically the next time you open this project in a trusted Codex session."],"nCzR-G":["Copy code ",["userCode"]],"nD7Fx9":["This replaces the current skill content with the bundled version ",["0"],". Any local edits will be replaced — your current version is saved to history first, so you can restore it."],"nDT8qt":["Initialized ",["0"]," but could not open it."],"nJq7et":["Couldn't uninstall skill: ",["0"]],"nMSYz5":["This path is on an external volume (/Volumes/...). OpenKnowledge will lose track of files when the drive ejects."],"nNYV3Y":["and ",["remaining"]," more"],"nP-KFo":["New ",["0"]," chat"],"nP76lk":["Applies to all projects on this machine. Claude and Codex, started from the built-in terminal, auto-approve OpenKnowledge's read and write tools (Claude also auto-runs \\"ok open\\"). Deleting, moving, sharing, installing skills, other commands, and non-OpenKnowledge file edits still ask. Cursor, OpenCode, and Pi are unaffected. Best-effort per agent."],"nTwL53":["Open a doc to share its URL."],"nUNZL4":["Ask ",["0"]],"nWv1ja":["Manage hidden files in Settings → Ignore patterns."],"nYKerc":["(user-level only)"],"nYeBmY":[["hours"],"h ago"],"nbfdhU":["Integrations"],"ndeI89":["Use Cmd/Ctrl+C to copy the link below, or open OK in the desktop app."],"ndwmea":["unavailable on this platform"],"neRy3o":["Split list item"],"nfoduq":["create worktree"],"nft48x":["Stored at <0>.ok/templates/</0> in this project. Available in every folder (folder-scoped templates can override by filename)."],"ng2Ibo":["Branch name"],"nh3wwx":["Embeddings provider key"],"njBeMm":["Both"],"njU86j":["Property \\"",["trimmed"],"\\" already exists"],"noH1JX":["Couldn't reach collab server — ",["errorDetail"],". Try <0>ok status</0> or check <1>.ok/local/last-spawn-error.log</1>."],"npcziF":["Install on"],"nqV0Kk":["This folder hasn't synced to GitHub yet. The link will work after the next sync."],"nrGWJ7":["Git identity isn't set — commits use a default author. Set yours so teammates see your name."],"nskygk":["Choose agent"],"nxlOpL":["OpenKnowledge is using this GitHub account."],"ny6vNn":["OpenKnowledge is using a GitHub account provided by the gh CLI. There's no separate OpenKnowledge credential to disconnect."],"nzHlj8":["Close ",["0"]],"nzaV6Q":["Page thumbnails"],"o2yoFu":["Reveal in Finder, No workspace"],"o49mDZ":["Loading timeline history"],"o4dcAf":["Reveal in File Explorer, ",["hint"]],"o5gfs1":["This setting is per-machine and isn't shared with collaborators. It needs an API key set with <0>ok embeddings set-key</0>."],"o9CrsQ":["research-note"],"oAFVKX":["Failed to update the project sync default — ",["detail"]],"oAGN8p":["Remote branch <0>",["remoteCheckoutRef"],"</0> will be checked out as a new local tracking branch <1>",["trimmed"],"</1>, in its own window under <2>.ok/worktrees/</2>."],"oBXkm2":["Delete code block"],"oCHfGC":["Level"],"oCZkaG":["Copy path"],"oJl7eO":["Unknown component: ",["componentName"]," — source editable below"],"oKBnk5":["More requests were blocked."],"oQA-cA":["Full path"],"oS1YpJ":["Open the Project Navigator."],"oXKEsy":["Delete an adjacent wiki-link or tag chip."],"oYepHb":["The terminal is turned off for this project. Turn it back on to run commands here."],"of3tF-":["You picked ~/Documents. OpenKnowledge will index every markdown file under it. If you only want to manage a sub-folder, choose a smaller scope."],"ogAuyr":["Back to document view"],"omXJcU":["Close others"],"optX0N":[["0"],"h ago"],"oqB2ez":["Previous match"],"osRqlv":["Open delete confirmation for the selected file-tree items."],"ot5BRK":["Duplicate selected file or folder"],"otE4aj":["Show external URL nodes"],"ou1hFW":["Toggle an ordered list."],"outYNy":["Duplicate name \\"",["keyName"],"\\""],"ovIGrT":["Local collaboration data for \\"",["docName"],"\\" could not be cleared. Reload to retry."],"p0Iq25":["Insert link"],"p9sdCy":["New ignore pattern"],"pAgkuZ":["Reopening \\"",["docName"],"\\" with a fresh local collaboration cache."],"pBROkv":["Thanks for subscribing. Watch your inbox for product updates."],"pEQFsW":["No matching projects."],"pFagOn":["Source editing"],"pHYP6v":["Open <0>Customize</0> in the sidebar <1/> <2>Skills</2>."],"pRc-Im":["Undone all edits on ",["docName"]],"pTPqMK":["Toggle a fenced code block."],"pWT04I":["Checking..."],"pWbsW6":["Loading docs"],"pZAs1T":["Failed to load outgoing links"],"pajIrl":["Could not turn off the terminal: ",["0"]],"pbwTg6":[["seconds"],"s ago"],"pckX1A":[["0","plural",{"one":["#"," use"],"other":["#"," uses"]}]],"pcqlQu":[["0","plural",{"one":["Folder"],"other":["Folders"]}]],"pgq_xf":[["0"],"/",["1"]," ",["2"]],"phM8Kh":["Found the repo but could not open the project. Please try again."],"pha01Y":["Project-level pages with no incoming graph edges."],"pkAft1":["Search failed."],"pmKdif":["Failed: ",["loadError"]],"pmUArF":["Workspace"],"ppDgFi":["Restart with this app's version"],"psfGPX":["MCP connections"],"pzutoc":["Italic"],"q2kXMG":["Inline Math"],"q4YJl_":["The terminal session ended (exit code ",["0"],")."],"q6-JVU":["Loading pages"],"q7F5am":["title"],"qAQVSD":["Page headings response was not JSON"],"qAhFeg":[["userName"]," · ",["tabCount","plural",{"one":["#"," tab"],"other":["#"," tabs"]}]],"qAx7xG":["Fixed folder in content root"],"qEIFZu":["Key ending in ",["keyHint"]],"qEue6Q":[" or "],"qFWMl-":["View as text"],"qNOgUu":["Edits at the source land here — no copy-paste drift."],"qRZh7J":["Let Tab leave the source editor instead of indenting."],"qSKu2v":["Source navigation and selection"],"qSxaOz":["Accept their deletion"],"qUB_o_":["Auto-sync is off — your edits stay local until you commit and push manually."],"qXg5W9":["File saves to <0>~/Downloads/openknowledge.skill</0>."],"qXsafh":["Publish to GitHub"],"qZv5ZR":["Config sharing toggle failed"],"q_9EcE":["Enable git auto-sync?"],"q_z77Z":["Heading levels"],"qaHyRJ":[["linkCount","plural",{"one":["#"," link"],"other":["#"," links"]}]],"qbfj1f":["Receiving objects"],"qdBUHP":["Couldn't load ",["fileName"]],"qi1F96":["Reveal in File Explorer"],"qiRoLb":["Summarize everything I changed this week"],"qioCwA":["Jump to page ",["pageNumber"]],"qjHMHf":["Failed to disable sync — ",["detail"]],"qo4zCg":["Path cannot contain backslashes"],"qpQwGC":["Describe what you're working on and the agent sets it up for you."],"qvWGzP":["Collapse all"],"qyLmWw":["Source editor search panel"],"r-OJYm":["Enter a valid branch name (no spaces, no leading dot, no \\"..\\")."],"r2huLx":["Undo, redo, or undo selection changes through CodeMirror history."],"r4R7AZ":["Network error during cleanup"],"r51jLC":["File saved & Claude Desktop App opened"],"r871ed":["Your knowledge base is now on GitHub at <0>",["ownerLogin"],"/",["repoName"],"</0>."],"rBc32v":["Couldn't reach the embeddings provider — press ↵ to retry"],"rFw02Q":["Uploading ",["keyName"]],"rJVoVX":["Source find results"],"rNifQd":["Remove property"],"rQAQus":["Couldn't save template: ",["error"]],"rQRrkB":["yesterday"],"rSoi6g":[["displayName"]," (",["bin"],") isn't installed or on your PATH."],"rVgSRB":["Collapse ",["docName"]],"rVxu1k":["No pages link here yet."],"rXz97P":["Numbered list of items."],"rZ9HZq":["To do"],"rZVMkf":["Visual editor replace input focused"],"rageVb":["Custom HTML with a live preview pane (sandboxed iframe)."],"rdU729":["Layout"],"rf6x3F":["Dock terminal to the bottom"],"rfFpcF":["Remove ",["chip"]],"rgPqOw":["Convert the current block to a paragraph."],"riqekz":["Suggestion menu navigation"],"rlUzXK":["Could not validate folder. Please try again."],"roAe2K":["Link URL"],"roiUQQ":["This page doesn't link to anything yet."],"rppgXF":["Disconnecting"],"rssK8c":["Ignore patterns (raw text)"],"rtdR4v":["Show or hide Files"],"rwrPbS":["Component boundary navigation"],"s-MGs7":["Resources"],"s-XOaI":["File name"],"s061i4":["Relative path"],"s0IDhW":["This file could not be found."],"s0J_k9":[["0","plural",{"one":["#"," key"],"other":["#"," keys"]}]],"s0_GnA":["Opening ",["openingLabel"],"…"],"s1c0ja":["Bullet List"],"s3caR3":["Deleting"],"sE7R19":["Could not load templates: ",["templatesError"],". You can still create a blank note."],"sER-bs":["Files"],"sFhaTJ":["Disambiguates similarly-named templates in the menu."],"sHrqDx":["Couldn't rename skill: ",["0"]],"sIGbBZ":["Convert selection to footnote"],"sIxSSP":["Resolve conflict in your terminal"],"sJK6pq":["Permission denied"],"sJWhgo":["Unknown component: ",["unregisteredComponentName"]],"sOxZaS":["Failed to load graph"],"sZ2IOu":["This ",["targetNoun"]," was shared from branch <0>",["shareBranch"],"</0>. It doesn't exist on your current branch (<1>",["currentLabel"],"</1>)."],"saIASg":["Second item"],"saYiIO":["Path cannot contain null bytes"],"seeS6l":["Setup OpenKnowledge in this folder?"],"shNd9t":["Slash command menu"],"skf5Ix":["Indent or outdent source editor lines."],"snrVQ7":["probe failed"],"ssuwjF":["Branch"],"stlgky":["On — your search queries and the text of matching pages are sent to your embeddings provider (OpenAI by default) to compute embeddings."],"sxTdZI":["Loading paths…"],"sxjyRq":["Worktrees"],"sxkWRg":["Advanced"],"t-JXbf":["Notion-style inline row for a downloadable file. Drag-drop also works."],"t18QYR":["Unpin ",["accessibleLabel"]],"t2TkQ3":["Sync paused — resolve conflicts to resume."],"t422_7":["Uninstall everywhere"],"t4sFKC":["New branch <0>",["trimmed"],"</0> will be created from the current commit, in its own worktree under <1>.ok/worktrees/</1>."],"t6w1cq":["Open a blank editor tab."],"tAPZEx":["Below"],"tHKQ6j":["Renaming"],"tP5DDk":["Apply link"],"tUvUfp":["Use a folder you already have."],"tW_yvQ":["Expand ",["docName"]],"t_YqKh":["Remove"],"teD0H9":["Couldn't open a worktree for that branch."],"tfDRzk":["Save"],"tfi40B":["Failed to create page"],"tgWuMB":["Modified"],"thnPBX":["Activate the next editor tab."],"ti6aF_":["Ask ",["0"]," CLI"],"tiWX6q":["Source editor"],"tjXez2":["blog-post"],"toyw51":["Mermaid diagram controls"],"tsiTqO":["Paste your API key"],"tsyExA":["Connect your AI tools to OpenKnowledge"],"u-9fWA":["See <0>Architecture</0> for the system overview."],"u3BOHd":[["fileCount","plural",{"one":["#"," file"],"other":["#"," files"]}]],"u3YnKw":["Could not construct share URL."],"u3wRF-":["Published"],"u6Hp4N":["Markdown"],"u7H-Wn":["Show panel (",["panelShortcutLabel"],")"],"u7U_Ij":["Link the selected text, or edit the link under the caret."],"uA_jXp":["Switch and update branch"],"uCaIdy":["GitHub sign-in is missing or expired. Reconnect to resume syncing."],"uDlyqd":["Document the architecture of this repo: create an overview page that links to a page per major module describing its responsibilities and entry points."],"uF9ruK":["Saving"],"uFOL2y":["No project skills yet. Author one to teach agents a repeatable task scoped to this knowledge base."],"uFQbYd":["Home page and entry point."],"uGaIIS":["Check out worktree"],"uH_S-u":[["loadErrorTitle"],": ",["message"]],"uKRYiW":["Sync status unavailable — server error."],"uL_Wx8":["The terminal stopped unexpectedly."],"uM6jnS":["Restore failed"],"uO9WLl":["Push"],"uQNW00":["Detached HEAD — checkout a branch to resume"],"uQewpR":["Couldn't restart the server — it's running under a different account. Restart your computer to clear it, then reopen this project."],"uWtdQR":["No templates yet. Add one in this folder's Templates section, or in Settings → Templates."],"uWx2ZP":["Last sync"],"u_lS4C":["Clone complete — opening project"],"uaUc6t":["Restart server"],"ubMwcO":["The terminal session ended (signal ",["0"],")."],"ugoTXs":["folder"],"uhJEA2":[["count","plural",{"one":["#"," more participant"],"other":["#"," more participants"]}]],"uksqrP":["Repository not found. It may have been renamed, deleted, or moved."],"un8kBM":["Creating page: ",["linkTitle"],"."],"ur2XSb":["Visual editor"],"uuoHOU":["Command failed."],"uynXup":[["tokens","plural",{"one":["token"],"other":["tokens"]}]],"v-h2hx":["Delete ",["targetGitPath"]],"v2ZW0K":["Enable terminal"],"v41fCm":["File not found"],"v75Em9":[["uploadedCount","plural",{"one":["Uploaded one file"],"other":["Uploaded ",["uploadedCount"]," files"]}]],"v77jrg":["Visual editor selection"],"v7hK0U":["Use lowercase letters, digits, and hyphens only."],"v7lbnC":["Find next match"],"vAYoCZ":["Couldn't open the worktree. Try again."],"vDXqVv":["Insert a markdown hard break."],"vEJDlt":["The file is in your Trash; the file-watcher will reconcile."],"vGeNNQ":["Copy a prompt and paste it into your agent to set up your project."],"vIxrEk":["Fit width"],"vLyv1R":["Hide"],"vQIVHc":["Folder properties"],"vWc9a0":["Type to edit; <0>⌘ Enter</0> saves, <1>Esc</1> cancels."],"vZVeFG":["Upload failed — please try again"],"vbK_ZG":["Files sidebar"],"ve8vEM":["Code expired — please try again"],"vfRlCI":["Could not copy full path"],"vfWA_g":["You picked ~/Desktop. OpenKnowledge will index everything on your desktop."],"vhAnzJ":["Turn on semantic search?"],"viwC-K":["Failed to remove project."],"vppAju":["Where newly added attachments are placed."],"vv7kpg":["Cancelled"],"vvWZnu":["Diff unavailable"],"w3tVpc":["No links yet. Add wiki links or markdown links to build a graph."],"w3vFfL":["Hide Files"],"w4hMYl":["Could not read branch state for this project. Close this dialog and open the share link again."],"w6sBjd":["Terminal settings not yet loaded — try again in a moment"],"w7SsvI":["That folder isn't an OpenKnowledge project yet. Initialize it and open?"],"w7nm4K":["Indented blockquote for citations."],"wDgmsr":["\\"",["0"],"\\" install refreshed (",["1"],")"],"wGSHzy":["Activate one of the first eight editor tabs."],"wJijgU":["Location"],"wJo9oS":["Close find"],"wQp1V3":["Mirror of <0>",["src"],"</0>"],"wT4iQr":["Open visual-editor find with replace controls expanded."],"wTcjov":["No workspace"],"wXO4Tg":[["hrs"],"h ago"],"w_Sphq":["Attachments"],"wbv9xO":["Create new project"],"wbwHYD":["Enable sync"],"wdxz7K":["Source"],"weP6me":["Couldn't load docs — type @ again to retry"],"wlwXUk":["You picked ~/Downloads. Files there are usually transient — consider a stable folder instead."],"wn8EJi":["Skills teach agents repeatable tasks. Author them here; install a skill to project it into your editors' skill folders."],"wndeIl":["Project-level pages with neither incoming nor outgoing graph edges."],"wtcxiD":["Share this setup with your team?"],"wvbc1r":["Couldn't open document"],"wzq9Rv":["A branch with that name already exists. Open its worktree from the switcher instead."],"x-5mJ1":["Install on all"],"x2fr_j":["Graph"],"x3-2ta":[["packName"]," initialized (",["projectEntries","plural",{"one":["#"," entry"],"other":["#"," entries"]}],")"],"x57cJf":["Open link"],"xCJdfg":["Clear"],"xCdTnb":["Close new tab"],"xDBki3":["Heading suggestions"],"xFQRu4":["I already have it locally"],"xG4tb6":["Lost connection to \\"",["docName"],"\\"."],"xHGM4U":["Hide HTML preview"],"xK291b":["Two-page (odd)"],"xNyj3h":["Reinstall for Claude Chat & Cowork"],"xOTzt5":["just now"],"xSVO3J":["What gets created"],"xWEvuo":["Ask AI"],"xXo8FT":["Save failed: ",["error"]],"xYMPyY":["Paste was incomplete — ",["chunksCompleted"]," of ",["totalChunks"]," chunks landed.",["restoreSuffix"]],"xaDWAI":["Switch project"],"xbdtfY":["Markdown source"],"xc4g25":["Parse failed"],"xeXS4P":["Or use a starter pack"],"xeiujy":["Text"],"xhlFsx":["Inherited — set a value here to replace it."],"xiv-dW":["No files yet."],"xloBjn":["Relative Path"],"xnP32l":["No description yet — add one so agents know when to use this skill."],"xrVr_k":["Couldn't create skill: ",["0"]],"xsZhu-":["Page number"],"xzktOa":["Edit wiki link"],"y1t8bQ":["Settings sections"],"y3aU20":["Save changes"],"y46m5r":["The desktop app isn't responding. Refresh and try again."],"y5FUYi":["Suggestion menu open"],"y8B54M":["Couldn't send your prompt — please try again."],"yCX4jp":[" Your selection could not be restored."],"yEJ-sl":["The preview blocks resources that don't meet its security rules (for example plain http:// URLs, or code that uses eval). The content above may render incompletely."],"yFyZMJ":["No pages matched \\"",["semanticQueryText"],"\\" by meaning."],"yH7T4q":[["failedCount","plural",{"one":["1 file failed to upload"],"other":[["failedCount"]," files failed to upload"]}]],"yHikCO":["Open CodeMirror's go-to-line prompt."],"yIPXut":["Preparing search"],"yKu_3Y":["Restore"],"yLEyuq":["Product updates in your inbox."],"yLq4w4":["Separator"],"yMgL_E":["Find field navigation"],"yQE2r9":["Loading"],"yQyglE":["No matching docs"],"yUxR-Q":["Expand ",["keyName"]],"yWSvcf":["Content root"],"yWWThY":["Asset reference"],"yYR6za":["Display text"],"yZmvQ4":["This project's server (v",["0"],") is newer than this app (v",["1"],")."],"y_5CE8":["Item ",["0"]],"yaPGPa":["Open a project to manage its AI tool connections."],"yf5r22":[["keyName"]," type: ",["typeLabel"]," (inherited from folder properties; not editable here)"],"yhdqox":["Installed — ok is available in external terminals. Unchecking removes it; OpenKnowledge's built-in terminal and AI tools keep working."],"yitgD9":["Failed to load skill targets: ",["0"]],"yjExfe":["Branch <0>",["shareBranch"],"</0> is checked out in:"],"ylXj1N":["Selected"],"ymWJLd":["Show ",["0"]," more"],"ynIa4S":["Visual editor list item"],"ypw6My":["Showing top ",["0"]," headings — keep typing to narrow"],"ysxgu8":["project"],"yutJKi":["Checklist with checkboxes."],"yvG-l1":["Open source lint panel"],"yvHDYG":["Claude Desktop"],"yz7wBu":["Close"],"yzF66j":["Link"],"yzGPkm":["Expand graph"],"z-lawV":["worktree"],"z0a2EA":["Diagram from Mermaid source — flowchart, sequence, class, state, ER, gantt, pie."],"z1uNN0":["No emoji found."],"z2JdQ-":["Config sharing unchanged — see details below."],"z2funE":["Full Path"],"z5pqI8":["Cannot upload: no document is open"],"z60Lgn":["Saves the file to <0>~/Downloads/openknowledge.skill</0> and opens the Claude Desktop App. Requires Node.js or Bun on your PATH."],"zAsDLY":["Graph visualization of document links"],"zKxoPm":["Couldn't rename \\"",["0"],"\\": ",["1"]],"zL0LPh":["Global outside text fields"],"zLGXna":["No starter packs available."],"zLak8b":["Activate new tab"],"zQBg2C":["Move the current block up or down one position."],"zUhPuR":["Open containing folder, ",["hint"]],"zXj1rA":["Search by meaning"],"zZ_I5K":["Open project menu"],"zaXlhf":["The properties block at the top of this doc has a formatting error. Switch to source mode to fix it."],"zbymaY":[["0"],"m ago"],"zd00pH":["Copy Path"],"zgSFyG":["External link"],"zkz0Fg":["Set up syncing"],"zlErBl":["Page headings error response did not match RFC 9457"],"zo3Dl7":["Toggle thumbnails"],"zrP8HX":["Frontmatter every document created from this template starts with. Values are YAML — a list is <0>[a, b]</0>; <1>{",["date"],"}</1> fills in on create."],"ztKII6":["Failed to add item"],"zwBp5t":["Private"],"zyKa-I":["Star us on GitHub"]}`)},H$=`en`;Gc.load(H$,V$.messages),Gc.activate(H$);var U$=Symbol.for(`ok.client.logForwarder`),W$=2e3,G$=[`log`,`info`,`warn`,`error`],K$={log:`info`,info:`info`,warn:`warn`,error:`error`};function q$(e){if(typeof e==`string`)return e;if(e instanceof Error)return`${e.name}: ${e.message}`;try{return JSON.stringify(e)??String(e)}catch{return String(e)}}function J$(e){let t=e.message.length+80;if(e.event&&(t+=e.event.length),e.fields)try{t+=JSON.stringify(e.fields).length}catch{}return t}function Y$(e={}){let t=e.windowObj??(typeof window<`u`?window:void 0);if(!t||t.okDesktop)return;let n=t;if(n[U$])return;n[U$]=!0;let r=e.consoleObj??console,i=e.documentObj===void 0?typeof document<`u`?document:null:e.documentObj,a=e.flushIntervalMs??W$,o=e.fetchImpl??n.fetch.bind(n),s=e.now??Date.now,c=[],l=0,u=null,d=!1,f={log:r.log.bind(r),info:r.info.bind(r),warn:r.warn.bind(r),error:r.error.bind(r)};function p(){if(u!==null&&(clearTimeout(u),u=null),c.length===0)return;let e=c.splice(0,100);l=0,d=!0;try{o(`/api/client-logs`,{method:`POST`,headers:{"content-type":`application/json`},keepalive:!0,body:JSON.stringify({entries:e})}).catch(()=>{})}catch{}finally{d=!1}}function m(e){if(c.push(e),l+=J$(e),c.length>100){let e=c.shift();e&&(l-=J$(e))}if(c.length>=100||l>=32768){p();return}u===null&&(u=setTimeout(p,a))}function h(e,t){if(!d)try{let n=hn(t.map(q$).join(` `)),r=t[0],i=typeof r==`string`&&r.length<=32768?r:void 0,a=i?Mr(i):null,o=a?.fields;if(o)try{JSON.stringify(o).length>8192&&(o=void 0)}catch{o=void 0}m({level:e,message:n,ts:s(),...a?.event?{event:a.event}:{},...o?{fields:o}:{}})}catch{}}for(let e of G$)r[e]=(...t)=>{f[e](...t),h(K$[e],t)};let g=e=>{if(d)return;let t=e;h(`error`,[`uncaught error: ${t.message} (${t.filename}:${t.lineno}:${t.colno})`])},_=e=>{d||h(`error`,[`unhandledrejection: ${q$(e.reason)}`])},v=()=>p(),y=()=>{i&&i.visibilityState===`hidden`&&p()};n.addEventListener(`error`,g),n.addEventListener(`unhandledrejection`,_),n.addEventListener(`pagehide`,v),i&&i.addEventListener(`visibilitychange`,y);function b(){for(let e of G$)r[e]=f[e];n.removeEventListener(`error`,g),n.removeEventListener(`unhandledrejection`,_),n.removeEventListener(`pagehide`,v),i&&i.removeEventListener(`visibilitychange`,y),u!==null&&(clearTimeout(u),u=null),c.length=0,delete n[U$]}return{flushNow:p,uninstall:b}}function X$(e,t){return e.branch===void 0||e.branch===null||e.branch===``||t===``||e.multiCandidate!==!0?null:{message:`Opened on branch ${e.branch}`,description:t}}function Z$(e){let t=e.bridge;if(!t)return;let n=e.setHash??(e=>{window.location.hash=e}),r=e.emitToast??((e,t)=>{hs(e,t)});return t.onDeepLink(e=>{let i=e.kind??`doc`,a={kind:i,path:e.doc,branch:e.branch??null};if(e.targetMissing===!0){rs.arm(a);return}$r.arm(a),n(xl(i,e.doc,i===`doc`?e.branch:void 0));let o=X$(e,t.config.projectPath);o!==null&&r(o.message,{description:o.description,duration:3e3})})}var Q$=4e3,$$=1440*60*1e3;function e1(e){let t=e.bridge;if(t&&t.onboarding)return t.onboarding.onToast(e=>{if(e.kind===`ancestor-promote`){hs.success(`Opened existing OpenKnowledge project at ${e.ancestorPath}`,{duration:Q$});return}if(e.kind===`startup-reclaim`){let t=[];if(e.mcp.status===`repaired`){let n=e.mcp.editors.map(e=>ur[e]??e).join(`, `);t.push(`repaired ${n} MCP integration`)}else e.mcp.status===`failed`&&t.push(`MCP auto-repair failed`);e.path.status===`installed`&&t.push(e.path.summary),e.path.status===`failed`&&t.push(`PATH install failed: ${e.path.summary}`);let n=t.length>0?t.join(`; `):`OpenKnowledge integrations checked.`,r=e.mcp.status===`failed`||e.path.status===`failed`,i=e.path.status!==`none`;hs[r?`error`:`success`](n,{duration:r||i?$$:Q$,position:`bottom-left`});return}if(e.kind===`sharing-refused-tracked`){hs.error(`Config sharing unchanged: ${e.tracked.length} OK file(s) tracked upstream — see message below.`,{duration:$$,description:e.remediation});return}if(e.kind===`sharing-no-git`){hs.warning(`Local-only requested but no git repository was created. Switch later via Settings → Config sharing once the project is in a git repo.`,{duration:Q$});return}let t=Vc(e.gitRoot,e.pickedPath)??e.pickedPath;hs.success(`Initialized OpenKnowledge at ${e.gitRoot} — opened parent of ${t} because it contains a .git folder`,{duration:Q$})})}function t1(e){let t=(0,$.c)(18),{body:n,warning:r,restartLabel:i,cancelLabel:a,onRestart:o,onDismiss:s}=e,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(os,{className:`mt-0.5 size-4 shrink-0 text-amber-500`}),t[0]=c):c=t[0];let l;t[1]===n?l=t[2]:(l=(0,Z.jsx)(`p`,{className:`font-medium text-sm`,children:n}),t[1]=n,t[2]=l);let u;t[3]===r?u=t[4]:(u=(0,Z.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:r}),t[3]=r,t[4]=u);let d;t[5]!==o||t[6]!==i?(d=(0,Z.jsx)(Jr,{size:`sm`,onClick:o,children:i}),t[5]=o,t[6]=i,t[7]=d):d=t[7];let f;t[8]!==a||t[9]!==s?(f=(0,Z.jsx)(Jr,{size:`sm`,variant:`ghost`,onClick:s,children:a}),t[8]=a,t[9]=s,t[10]=f):f=t[10];let p;t[11]!==d||t[12]!==f?(p=(0,Z.jsxs)(`div`,{className:`mt-1 flex flex-wrap gap-2`,children:[d,f]}),t[11]=d,t[12]=f,t[13]=p):p=t[13];let m;return t[14]!==l||t[15]!==u||t[16]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex w-full gap-3 rounded-lg border bg-popover p-4 text-popover-foreground shadow-lg`,children:[c,(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:[l,u,p]})]}),t[14]=l,t[15]=u,t[16]=p,t[17]=m):m=t[17],m}function n1(){return Gc._({id:`f_PkYv`})}function r1(e){return e.serverRuntime===e.appRuntime?Gc._({id:`FWQuPE`,values:{0:e.appRuntime}}):e.relation===`older`?Gc._({id:`LhQlGR`,values:{0:e.serverRuntime,1:e.appRuntime}}):Gc._({id:`yZmvQ4`,values:{0:e.serverRuntime,1:e.appRuntime}})}function i1(e){return Gc._({id:`2YOwme`,values:{appRuntime:e}})}function a1(e){return Gc._({id:`5DFPDh`,values:{appRuntime:e}})}function o1(e){return e===`eperm`?Gc._({id:`uQewpR`}):Gc._({id:`PqYWiC`})}async function s1(e){let t=hs.loading(Gc._({id:`Kf7GG5`}),{duration:1/0}),n;try{n=await e.restartServer(e.config.projectPath)}catch{return}hs.dismiss(t),n.ok===!1&&hs.error(o1(n.reason),{duration:1/0})}function c1(e){let t=e.bridge;if(!t)return;let n=t.onServerVersionDrift(e=>{hs.custom(n=>(0,Q.createElement)(t1,{body:r1(e),warning:n1(),restartLabel:Gc._({id:`ppDgFi`}),cancelLabel:Gc._({id:`PBxg_E`}),onRestart:()=>{hs.dismiss(n),s1(t)},onDismiss:()=>hs.dismiss(n)}),{duration:1/0})}),r=t.onServerRestarted(e=>{hs.success(i1(e.appRuntime))}),i=t.onServerReclaimed(e=>{hs.warning(a1(e.appRuntime),{duration:15e3})});return()=>{n(),r(),i()}}function l1(e){let{initialDoc:t}=e;if(!t)return;let n=e.getHash();n!==``&&n!==`#`&&n!==`#/`||e.setHash(El(t))}function u1(){typeof window>`u`||!window.okDesktop||l1({initialDoc:window.okDesktop.config.initialDoc,getHash:()=>window.location.hash,setHash:e=>{window.location.hash=e}})}sd(),n(()=>import(`./telemetry-startup-SAmXunjr.js`).then(e=>e.initStartupTrace()),__vite__mapDeps([116,0,1,2,3,4,38,7]),import.meta.url),I$({apiOrigin:typeof window<`u`?window.okDesktop?.config.apiOrigin:void 0}),Y$(),$T()&&aE(),WZ(),sT(),DF(),ON(),typeof window<`u`&&Z$({bridge:window.okDesktop}),typeof window<`u`&&c1({bridge:window.okDesktop}),typeof window<`u`&&id({bridge:window.okDesktop}),typeof window<`u`&&Bc({bridge:window.okDesktop}),typeof window<`u`&&e1({bridge:window.okDesktop}),typeof window<`u`&&od({bridge:window.okDesktop}),u1();var d1=new gd({defaultOptions:{queries:{retry:1,staleTime:1e4}}}),f1=document.getElementById(`root`);if(!f1)throw Error(`Root element not found`);var p1=typeof window>`u`?void 0:window.okDesktop;(0,Dd.createRoot)(f1).render((0,Z.jsx)(Q.StrictMode,{children:(0,Z.jsx)(At,{i18n:Gc,children:(0,Z.jsx)(qt,{client:d1,children:(0,Z.jsxs)(cn,{attribute:`class`,defaultTheme:`system`,enableSystem:!0,disableTransitionOnChange:!0,storageKey:`ok-theme-v1`,children:[(0,Z.jsx)(Ds,{children:N$(p1)}),(0,Z.jsx)(P$,{richColors:!0,closeButton:!0})]})})})}));
2002
+ `}\n${fq}\n${pq}`;function lY(e){let t=e.split(`/`).pop()?.replace(/\.md$/i,``).toLowerCase();return!!t&&qJ.has(t)}function uY(e){return e===`darwin`?Gc._({id:`LtSYdi`}):e===`win32`?Gc._({id:`qi1F96`}):Gc._({id:`e1Rn_k`})}function dY(e){let t=(0,$.c)(18),{item:n,workspace:r,onClose:i}=e,{_:a}=kt(),o=typeof window<`u`?window.okDesktop:void 0;if(!o)return null;let s=o.platform,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=uY(s),t[0]=c):c=t[0];let l=c,u,d;t[1]!==a||t[2]!==r?(u=r?null:a({id:`wTcjov`}),d=a(s===`darwin`?u?{id:`FvpFSZ`,values:{hint:u}}:{id:`LtSYdi`}:s===`win32`?u?{id:`o4dcAf`,values:{hint:u}}:{id:`qi1F96`}:u?{id:`zUhPuR`,values:{hint:u}}:{id:`e1Rn_k`}),t[1]=a,t[2]=r,t[3]=u,t[4]=d):(u=t[3],d=t[4]);let f=d,p=!r,m;t[5]!==n||t[6]!==i||t[7]!==r?(m=()=>{if(!r)return;i();let e=Mo(r.contentDir,Pu(n),r.pathSeparator);o.shell.showItemInFolder(e)},t[5]=n,t[6]=i,t[7]=r,t[8]=m):m=t[8];let h,g;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(Ro,{"aria-hidden":`true`}),g=(0,Z.jsx)(`span`,{className:`flex-1`,children:l}),t[9]=h,t[10]=g):(h=t[9],g=t[10]);let _;t[11]===u?_=t[12]:(_=u?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:u}):null,t[11]=u,t[12]=_);let v;return t[13]!==f||t[14]!==p||t[15]!==m||t[16]!==_?(v=(0,Z.jsxs)(vc,{disabled:p,onSelect:m,"aria-label":f,children:[h,g,_]}),t[13]=f,t[14]=p,t[15]=m,t[16]=_,t[17]=v):v=t[17],v}function fY(e,t){return Mu({kind:e.endsWith(`/`)?`directory`:`file`,name:e,path:e},t)}function pY(e){let t=e.match(/\.(md|mdx)$/i);if(!t)return null;let n=t[0].toLowerCase()===`.md`?`.mdx`:`.md`;return`${e.slice(0,-t[0].length)}${n}`}function mY(e,t){let n=pY(e);return n?t.includes(n):!1}function hY(e,t){return e!==t&&e.startsWith(t)}function gY(e,t){let n=[...new Set(e)],r=n.filter(e=>e.endsWith(`/`));return n.filter(e=>!r.some(t=>hY(e,t))).map(e=>fY(e,t))}function _Y(e,t){let n=e.getItem(t)??e.getItem(Ju(t));return n?.isDirectory()?Ju(nd(n.getPath())):t}function vY(e){let t=e.getFocusedPath()??e.getSelectedPaths()[0]??null;return t?_Y(e,t):null}function yY(e,t,n){let r=vY(e);return!r||n.has(r)?null:fY(r,t)}function bY(e,t){let n=e.getSelectedPaths(),r=vY(e);return gY(n.length>0?n.map(t=>_Y(e,t)):r?[r]:[],t)}function xY(e,t){return e===t||e.startsWith(`${t}/`)}function SY(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName;return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`||e.isContentEditable||e.closest(`[contenteditable="true"]`)!==null}function CY(e,t,n){let r=new Set,i=new Set,a=new Set;for(let o of e){if(o.kind===`file`){r.add(o.path);continue}if(o.kind===`asset`){a.add(o.path);continue}i.add(o.path);for(let e of t)ol(e)&&e.docName.startsWith(`${o.path}/`)?r.add(e.docName):el(e)&&e.path.startsWith(`${o.path}/`)&&a.add(e.path);for(let e of n){let t=nd(e);xY(t,o.path)&&i.add(t)}}return{docNames:r,folderPaths:i,assetPaths:a}}function wY(e,t){return e.kind===`file`?t.kind===`file`&&e.path===t.createdPath:e.kind===`asset`?!1:xY(t.createdPath,e.path)}function TY(e){let t=(0,$.c)(71),{item:n,context:r,anyActionBusy:i,workspace:a,handoff:o,model:s,okignoreBinding:c,projectLocalBinding:l,mergedConfig:u,onStartCreating:d,onCreateFromTemplate:f,onDuplicate:p,onDelete:m,onExpandSubtree:h,onCollapseSubtree:g,folderTreePaths:v,isAsset:y,documents:b}=e,{_:x}=kt(),S=Mu(n,b),C=n.kind===`directory`,w=S.kind===`asset`?null:S,T=w!==null&&c!==null,E;t[0]!==x||t[1]!==C?(E=x(C?{id:`5D3Ior`}:{id:`dbhUX1`}),t[0]=x,t[1]=C,t[2]=E):E=t[2];let D=E,O=u?.appearance?.sidebar?.showHiddenFiles??!1,k=l!==null,A;t[3]!==C||t[4]!==n.path?(A=C?nd(n.path):null,t[3]=C,t[4]=n.path,t[5]=A):A=t[5];let j=vo(A),M=j.state.status===`ready`?(j.state.data.folder.templates_available?.length??0)>0:!0,N=s.getSelectedPaths(),P=N.includes(S.treePath)?gY(N,b):[],F=P.length>1?P:[S],I=F.length,L=Gc._({id:`djjdjr`,values:{deleteCount:I}}),R;t[6]!==b||t[7]!==y||t[8]!==C||t[9]!==n||t[10]!==a?(R=y?null:C?da({folderRelativePath:Pu(n),workspace:a}):Ea({docName:td(n.path,b),workspace:a}),t[6]=b,t[7]=y,t[8]=C,t[9]=n,t[10]=a,t[11]=R):R=t[11];let z=R,B;t[12]===r?B=t[13]:(B=()=>r.close({restoreFocus:!1}),t[12]=r,t[13]=B);let V=B,H;t[14]===r?H=t[15]:(H=()=>r.close(),t[14]=r,t[15]=H);let U=H,{status:W}=zi(),G=W?.hasRemote===!0,K;t[16]!==b||t[17]!==y||t[18]!==C||t[19]!==n.path||t[20]!==S?(K=y||S.kind===`asset`?null:C?Pa(nd(n.path)):Ha(td(n.path,b)),t[16]=b,t[17]=y,t[18]=C,t[19]=n.path,t[20]=S,t[21]=K):K=t[21];let ee=K,te=G&&ee!==null,ne;t[22]!==x||t[23]!==G||t[24]!==ee?(ne=()=>{ee&&La({...ee,hasRemote:G,onClickWhenNoRemote:()=>{hs.error(x({id:`WyQxwa`}))}},{clipboardWrite:Sa,toastSuccess:OY,toastError:DY,logEvent:EY})},t[22]=x,t[23]=G,t[24]=ee,t[25]=ne):ne=t[25];let re=ne,ie;t[26]!==te||t[27]!==U||t[28]!==re?(ie=te?(0,Z.jsxs)(vc,{"data-testid":`file-tree-menu-share`,onSelect:()=>{U(),re()},children:[(0,Z.jsx)(Df,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`Z8lGw6`})]}):null,t[26]=te,t[27]=U,t[28]=re,t[29]=ie):ie=t[29];let q=ie,ae;t[30]!==x||t[31]!==l?(ae=e=>{if(l===null)return;let t=l.patch({appearance:{sidebar:{showHiddenFiles:e}}});t.ok||(console.warn(`[FileTree] showHiddenFiles toggle rejected:`,un(t.error)),hs.error(x({id:`P47EWZ`}),{description:un(t.error)}))},t[30]=x,t[31]=l,t[32]=ae):ae=t[32];let oe=ae,se=0,ce=0;if(C){let e=Ju(n.path);for(let t of v)(t===e||t.startsWith(e))&&(se++,aJ(s.getItem(t))?.isExpanded()&&ce++)}let le=C&&ce<se,ue=C&&ce>0,de;t[33]===U?de=t[34]:(de=e=>{e||U()},t[33]=U,t[34]=de);let fe;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(fe=(0,Z.jsx)(ic,{asChild:!0,children:(0,Z.jsx)(`span`,{"aria-hidden":`true`,"data-file-tree-context-menu-root":`true`,className:`block size-px`})}),t[35]=fe):fe=t[35];let pe;t[36]!==x||t[37]!==i||t[38]!==T||t[39]!==k||t[40]!==U||t[41]!==V||t[42]!==L||t[43]!==F||t[44]!==M||t[45]!==oe||t[46]!==o||t[47]!==z||t[48]!==D||t[49]!==y||t[50]!==C||t[51]!==n||t[52]!==s||t[53]!==c||t[54]!==w||t[55]!==g||t[56]!==f||t[57]!==m||t[58]!==p||t[59]!==h||t[60]!==d||t[61]!==q||t[62]!==O||t[63]!==ue||t[64]!==le||t[65]!==S||t[66]!==a?(pe=(0,Z.jsx)(bc,{sideOffset:0,align:`start`,"data-file-tree-context-menu-root":`true`,className:`min-w-52`,children:C?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(vc,{disabled:i,onSelect:()=>{V(),d(`file`,nd(n.path))},children:[(0,Z.jsx)(jf,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`HdkSiO`})]}),M?(0,Z.jsxs)(nc,{children:[(0,Z.jsxs)(hc,{disabled:i,children:[(0,Z.jsx)(ro,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`Uuj_R4`})]}),(0,Z.jsx)(Ac,{children:(0,Z.jsx)(iJ,{parentDir:nd(n.path),onSelectTemplate:e=>{V(),f(nd(n.path),e)},ItemComponent:vc})})]}):null,(0,Z.jsxs)(vc,{disabled:i,onSelect:()=>{V(),d(`folder`,nd(n.path))},children:[(0,Z.jsx)(qd,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`96G6Re`})]}),(0,Z.jsx)(mc,{}),(0,Z.jsx)(dY,{item:n,workspace:a,onClose:U}),(0,Z.jsx)(fa,{input:z,installStates:o.installStates,isElectronHost:o.isElectronHost,dispatch:o.dispatch}),q,(0,Z.jsxs)(nc,{children:[(0,Z.jsxs)(hc,{children:[(0,Z.jsx)(Oo,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`oCZkaG`})]}),(0,Z.jsxs)(Ac,{children:[(0,Z.jsx)(vc,{disabled:!a,onSelect:()=>{a&&(U(),KJ(Mo(a.contentDir,Pu(n),a.pathSeparator),`full`))},children:(0,Z.jsx)(J,{id:`oQA-cA`})}),(0,Z.jsx)(vc,{onSelect:()=>{U(),KJ(Pu(n),`relative`)},children:(0,Z.jsx)(J,{id:`s061i4`})})]})]}),(0,Z.jsx)(mc,{}),(0,Z.jsx)(wc,{checked:O,onCheckedChange:oe,disabled:!k,"data-testid":`file-tree-menu-show-hidden-files`,children:(0,Z.jsx)(J,{id:`XcGbim`})}),le||ue?(0,Z.jsx)(mc,{}):null,le?(0,Z.jsxs)(vc,{onSelect:()=>{U(),h(n.path)},children:[(0,Z.jsx)(Gf,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`OlAl5i`})]}):null,ue?(0,Z.jsxs)(vc,{onSelect:()=>{U(),g(n.path)},children:[(0,Z.jsx)(Gd,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`qvWGzP`})]}):null,(0,Z.jsx)(mc,{}),(0,Z.jsxs)(vc,{disabled:i,onSelect:()=>{S.kind!==`asset`&&(U(),p(S))},children:[(0,Z.jsx)(ko,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`euc6Ns`})]}),(0,Z.jsxs)(vc,{disabled:i,onSelect:()=>{V(),s.startRenaming(n.path)},children:[(0,Z.jsx)(Lo,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`2wxgft`})]}),(0,Z.jsxs)(vc,{"data-testid":`file-tree-menu-hide`,disabled:!T,onSelect:()=>{if(!c||!w)return;U();let e=Aq(w),t=uo(c.current()),n=xo(t,e);if(n===t)return;c.patch(Qa(n));let r=w.path.split(`/`).pop()||w.path;hs.success(x({id:`4xtLTl`,values:{basename:r}}),{description:x({id:`nWv1ja`}),duration:5e3})},children:[(0,Z.jsx)(_,{"aria-hidden":`true`}),D]}),(0,Z.jsxs)(vc,{variant:`destructive`,disabled:i,onSelect:()=>{U(),m(F)},children:[(0,Z.jsx)(as,{"aria-hidden":`true`}),L]})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(dY,{item:n,workspace:a,onClose:U}),!y&&(0,Z.jsx)(fa,{input:z,installStates:o.installStates,isElectronHost:o.isElectronHost,dispatch:o.dispatch}),q,(0,Z.jsxs)(nc,{children:[(0,Z.jsxs)(hc,{children:[(0,Z.jsx)(Oo,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`oCZkaG`})]}),(0,Z.jsxs)(Ac,{children:[(0,Z.jsx)(vc,{disabled:!a,onSelect:()=>{a&&(U(),KJ(Mo(a.contentDir,Pu(n),a.pathSeparator),`full`))},children:(0,Z.jsx)(J,{id:`oQA-cA`})}),(0,Z.jsx)(vc,{onSelect:()=>{U(),KJ(Pu(n),`relative`)},children:(0,Z.jsx)(J,{id:`s061i4`})})]})]}),(0,Z.jsx)(mc,{}),y?null:(0,Z.jsxs)(vc,{disabled:i,onSelect:()=>{U(),p(S)},children:[(0,Z.jsx)(ko,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`euc6Ns`})]}),(0,Z.jsxs)(vc,{disabled:i,onSelect:()=>{V(),s.startRenaming(n.path)},children:[(0,Z.jsx)(Lo,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`2wxgft`})]}),w?(0,Z.jsxs)(vc,{"data-testid":`file-tree-menu-hide`,disabled:!T,onSelect:()=>{if(!c)return;U();let e=Aq(w),t=uo(c.current()),n=xo(t,e);if(n===t)return;c.patch(Qa(n));let r=w.path.split(`/`).pop()||w.path;hs.success(x({id:`OD0FCX`,values:{basename:r}}),{description:x({id:`nWv1ja`}),duration:5e3})},children:[(0,Z.jsx)(_,{"aria-hidden":`true`}),D]}):null,(0,Z.jsxs)(vc,{variant:`destructive`,disabled:i,onSelect:()=>{U(),m(F)},children:[(0,Z.jsx)(as,{"aria-hidden":`true`}),L]})]})}),t[36]=x,t[37]=i,t[38]=T,t[39]=k,t[40]=U,t[41]=V,t[42]=L,t[43]=F,t[44]=M,t[45]=oe,t[46]=o,t[47]=z,t[48]=D,t[49]=y,t[50]=C,t[51]=n,t[52]=s,t[53]=c,t[54]=w,t[55]=g,t[56]=f,t[57]=m,t[58]=p,t[59]=h,t[60]=d,t[61]=q,t[62]=O,t[63]=ue,t[64]=le,t[65]=S,t[66]=a,t[67]=pe):pe=t[67];let me;return t[68]!==de||t[69]!==pe?(me=(0,Z.jsxs)(Ec,{open:!0,modal:!1,onOpenChange:de,children:[fe,pe]}),t[68]=de,t[69]=pe,t[70]=me):me=t[70],me}function EY(e){return console.log(e)}function DY(e){return hs.error(e)}function OY(e){return hs.success(e)}async function kY(e,t,n,r){try{let i=await fetch(`/api/documents?showAll=true&dir=${encodeURIComponent(e)}&depth=1`,{signal:t,headers:vJ});if(yJ(i)){let e=await SJ(i);return{kind:`entries`,entries:rl(e.entries),truncated:e.truncated}}let a=await Ot(i,n);if(!a.ok)return{kind:`http-error`,title:a.title};let o=pn.safeParse(a.body);return o.success?{kind:`entries`,entries:rl(o.data.documents),truncated:o.data.truncated===!0}:{kind:`http-error`,title:r}}catch(e){return e instanceof bJ?{kind:`http-error`,title:e.message}:{kind:`network-error`,cause:e}}}function AY(e){let t=(0,$.c)(360),{ref:n,onContentHeightChange:r}=e,{_:i,i18n:a}=kt(),{activeDocName:o,activeTarget:s,closeTabs:c,closeDocument:l,closeAndClearForRename:u,getPoolActiveDocName:d,poolHas:p,isNewTabActive:m,openTarget:h,prewarm:g,remapTabsForRename:_}=Ye(),{notifySidebarFileSelected:v}=Wj(),{resolvedTheme:y}=sn(),{addPage:b,pageMeta:x}=ia(),S;t[0]===x?S=t[1]:(S=function(e,t){return $c(e,t??x.get(e)?.size)??{kind:`doc`,target:e,docName:e}},t[0]=x,t[1]=S);let C=S,w;t[2]!==b||t[3]!==C||t[4]!==v||t[5]!==h?(w=function(e,t,n){n?.registerPage&&b(e),h(C(e,t),{tabBehavior:`replace-active`}),yl(El(e)),v()},t[2]=b,t[3]=C,t[4]=v,t[5]=h,t[6]=w):w=t[6];let T=w,E;t[7]!==v||t[8]!==h?(E=function(e){let t=vl(e);h({kind:`folder`,target:e,folderPath:e},{tabBehavior:`replace-active`}),yl(t),v()},t[7]=v,t[8]=h,t[9]=E):E=t[9];let D=E,O;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(O=[],t[10]=O):O=t[10];let[k,A]=(0,Q.useState)(O),[j,M]=(0,Q.useState)(!0),[N,P]=(0,Q.useState)(null),[F,I]=(0,Q.useState)(!1),L=kN(),R=(0,Q.useRef)(null),[z,B]=(0,Q.useState)(null),[V,H]=(0,Q.useState)(null),[U,W]=(0,Q.useState)(null),[G,K]=(0,Q.useState)(null),{conflicts:ee}=Wa(),[te,ne]=(0,Q.useState)(null),[re,ie]=(0,Q.useState)(null),[q,ae]=(0,Q.useState)(!1),oe=(0,Q.useRef)(q),se;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(se=new Set,t[11]=se):se=t[11];let ce=(0,Q.useRef)(se),le=(0,Q.useRef)(k),ue=(0,Q.useRef)(x),de=(0,Q.useRef)(null),fe;t[12]!==k||t[13]!==D||t[14]!==T||t[15]!==v||t[16]!==h?(fe=function(e,t){let n=t===void 0?k:t,r=Gq(e,n);if(r.kind===`none`){console.debug(`[FileTree] Dropped selection for unknown docName:`,ed(e));return}if(r.kind===`asset`){h({kind:`asset`,target:r.path,assetPath:r.path,mediaKind:r.mediaKind},{tabBehavior:`replace-active`}),yl(r.hash),v();return}if(r.kind===`folder`){D(r.path);return}let i=n.find(e=>ol(e)&&e.docName===r.path);T(r.path,i?.size,{registerPage:Kc(r.path)})},t[12]=k,t[13]=D,t[14]=T,t[15]=v,t[16]=h,t[17]=fe):fe=t[17];let pe=fe,me;t[18]!==v||t[19]!==h?(me=function(e,t){h({kind:`asset`,target:e,assetPath:e,mediaKind:(t??le.current).find(t=>el(t)&&t.path===e)?.mediaKind??null},{tabBehavior:`replace-active`}),yl(wl(e)),v()},t[18]=v,t[19]=h,t[20]=me):me=t[20];let he=me,ge=(0,Q.useRef)(o),_e;t[21]===k?_e=t[22]:(_e=new Set(k.filter(el).map(rX)),t[21]=k,t[22]=_e);let ye=_e,be=(0,Q.useRef)(ye),xe;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(xe=[],t[23]=xe):xe=t[23];let Se=(0,Q.useRef)(xe),Ce=(0,Q.useRef)(null),we=(0,Q.useRef)(nX),Te=(0,Q.useRef)(null),De=(0,Q.useRef)(null),Oe=(0,Q.useRef)(!1),ke=(0,Q.useRef)(!1),Ae=(0,Q.useRef)(null),je;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(je={row:null,root:null},t[24]=je):je=t[24];let Me=(0,Q.useRef)(je),Ne=(0,Q.useRef)(tX),Pe=(0,Q.useRef)(null),Fe=(0,Q.useRef)(null),Ie;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=new Map,t[25]=Ie):Ie=t[25];let Le=(0,Q.useRef)(Ie),Re;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(Re=new Set,t[26]=Re):Re=t[26];let ze=(0,Q.useRef)(Re),Be;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(Be=new Map,t[27]=Be):Be=t[27];let Ve=(0,Q.useRef)(Be),He=(0,Q.useRef)(0),Ue;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(Ue=new Set,t[28]=Ue):Ue=t[28];let We=(0,Q.useRef)(Ue),Ge=(0,Q.useRef)(eX),Ke=(0,Q.useRef)($Y),qe=(0,Q.useRef)(!1),Je=(0,Q.useRef)(null),Xe=(0,Q.useRef)(null),Ze=(0,Q.useRef)(QY),Qe=(0,Q.useRef)(ZY),$e=(0,Q.useRef)(XY),et=(0,Q.useRef)(YY),tt=(0,Q.useRef)(s),[nt,rt]=(0,Q.useState)(!1),it;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(it=function(){R.current!==null&&(clearTimeout(R.current),R.current=null)},t[29]=it):it=t[29];let at=it,ct;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(ct=function(){at(),I(!1)},t[30]=ct):ct=t[30];let lt=ct,ut;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(ut=function(e){lt(),P(e)},t[31]=ut):ut=t[31];let dt=ut,ft;t[32]===i?ft=t[33]:(ft=function(){if(at(),TN()){P(null),I(!0),R.current=setTimeout(()=>{R.current=null,Je.current?.()},aY);return}I(!1),P(i({id:`34qyH5`}))},t[32]=i,t[33]=ft);let pt=ft,mt=(0,Q.useRef)(!0),ht;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(ht=()=>{if(mt.current){mt.current=!1;return}Je.current?.()},t[34]=ht):ht=t[34];let gt;t[35]===L?gt=t[36]:(gt=[L],t[35]=L,t[36]=gt),(0,Q.useEffect)(ht,gt);let _t,vt;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(_t=()=>at,vt=[],t[37]=_t,t[38]=vt):(_t=t[37],vt=t[38]),(0,Q.useEffect)(_t,vt);let yt,bt;t[39]!==k.length||t[40]!==j?(yt=()=>{if(j||k.length===0)return;let e=Xe.current?.querySelector(nR)?.shadowRoot;if(!e)return;let t=e,n=function(){Ae.current!==null&&clearTimeout(Ae.current),Ae.current=setTimeout(()=>{ke.current=!1,Ae.current=null},0)},r=function(e){if(!(e instanceof DragEvent))return;let t=aX(e),n=t?.dataset.itemPath;if(!n)return;let r=Xq(t.dataset.itemType===`folder`?Ju(n):n,le.current,ue.current);r&&(Ae.current!==null&&(clearTimeout(Ae.current),Ae.current=null),ke.current=!0,e.dataTransfer?.setData(ku,Du(r)))},i=function(e){if(!(e instanceof DragEvent)||!Gu(e))return;let t=sX(e);if(!t){WJ(Me);return}e.preventDefault(),e.stopPropagation(),e.dataTransfer&&(e.dataTransfer.dropEffect=`copy`),GJ(Me,t)},a=function(e){if(!(e instanceof DragEvent)||!Gu(e))return;let n=e.relatedTarget;n instanceof Node&&t.contains(n)||WJ(Me)},o=function(e){if(!(e instanceof DragEvent)||!Gu(e))return;let t=sX(e),n=zu(e);if(!t||n.length===0){WJ(Me);return}e.preventDefault(),e.stopPropagation(),WJ(Me),Ne.current(n,t.parentDir,t.busyPath)};return e.addEventListener(`dragstart`,r,{capture:!0}),e.addEventListener(`dragover`,i,{capture:!0}),e.addEventListener(`dragleave`,a,{capture:!0}),e.addEventListener(`drop`,o,{capture:!0}),e.addEventListener(`dragend`,n,{capture:!0}),window.addEventListener(`drop`,n,!0),window.addEventListener(`dragend`,n,!0),()=>{e.removeEventListener(`dragstart`,r,{capture:!0}),e.removeEventListener(`dragover`,i,{capture:!0}),e.removeEventListener(`dragleave`,a,{capture:!0}),e.removeEventListener(`drop`,o,{capture:!0}),e.removeEventListener(`dragend`,n,{capture:!0}),window.removeEventListener(`drop`,n,!0),window.removeEventListener(`dragend`,n,!0),WJ(Me),Ae.current!==null&&(clearTimeout(Ae.current),Ae.current=null),ke.current=!1}},bt=[k.length,j],t[39]=k.length,t[40]=j,t[41]=yt,t[42]=bt):(yt=t[41],bt=t[42]),(0,Q.useEffect)(yt,bt);let{selectedFilePath:xt,selectedFolderPath:St,navigationPath:Ct}=Wq(s,m?null:o),wt=xt?Xu(xt,k.find(e=>ol(e)&&e.docName===xt)?.docExt):St?Ju(St):s?.kind===`asset`?s.assetPath:null,Tt=q?null:wt,Et=ya().states,{dispatch:Dt}=Da(),At;t[43]!==Dt||t[44]!==Et?(At={installStates:Et,isElectronHost:typeof window<`u`&&window.okDesktop!=null,dispatch:Dt},t[43]=Dt,t[44]=Et,t[45]=At):At=t[45];let jt=At,{okignoreBinding:Mt,projectLocalBinding:Nt,merged:Pt}=au(),Ft=Pt?.appearance?.sidebar?.showHiddenFiles??!1,It;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(It=()=>Pe.current===null,t[46]=It):It=t[46];let Lt=It,Rt;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(Rt=[],t[47]=Rt):Rt=t[47];let zt;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(zt={set:`complete`,spriteSheet:eY,byFileExtension:{md:{name:XJ,viewBox:ot},mdx:{name:XJ,viewBox:ot}}},t[48]=zt):zt=t[48];let Bt;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(Bt={contextMenu:{enabled:!0,triggerMode:`both`,buttonVisibility:`when-needed`}},t[49]=Bt):Bt=t[49];let Vt;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(Vt={canDrag:Lt,canDrop:Lt,onDropComplete:e=>et.current(e),onDropError:JY},t[50]=Vt):Vt=t[50];let Ht,Ut;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(Ht={canRename:Lt,onRename:e=>Qe.current(e),onError:e=>$e.current(e)},Ut=e=>Ze.current(e),t[51]=Ht,t[52]=Ut):(Ht=t[51],Ut=t[52]);let Wt;t[53]===i?Wt=t[54]:(Wt={paths:Rt,initialExpansion:`closed`,fileTreeSearchMode:`hide-non-matches`,initialVisibleRowCount:18,stickyFolders:!0,...uq,icons:zt,unsafeCSS:cY,composition:Bt,dragAndDrop:Vt,renaming:Ht,onSelectionChange:Ut,renderRowDecoration:e=>{let{item:t}=e;if(t.kind===`file`){let e=le.current.find(e=>ol(e)&&Xu(e.docName,e.docExt)===t.path);if(e?.isSymlink){let t=e.targetPath;return{icon:JJ,title:i(t?{id:`JE21eh`,values:{targetPath:t}}:{id:`BQu9Pg`})}}return lY(t.path)?{icon:YJ,title:i({id:`i9toLO`})}:null}let n=le.current.find(e=>Zc(e)&&Ju(e.path)===Ju(t.path));if(n?.isSymlink){let e=n.targetPath;return{icon:JJ,title:i(e?{id:`JE21eh`,values:{targetPath:e}}:{id:`BQu9Pg`})}}return null}},t[53]=i,t[54]=Wt);let{model:Y}=lq(Wt),Gt;t[55]===Y?Gt=t[56]:(Gt=function(e){let t=Y.getItem(e)??Y.getItem(Ju(e));return t?.isDirectory()?Ju(nd(t.getPath())):e},t[55]=Y,t[56]=Gt);let Kt=Gt,qt,Jt;t[57]===k?(qt=t[58],Jt=t[59]):(Jt=Lu(k),qt=Ou(Jt),t[57]=k,t[58]=qt,t[59]=Jt);let Yt=qt,Xt=(0,Q.useRef)(Jt),Zt;t[60]===k?Zt=t[61]:(Zt=Ku(k),t[60]=k,t[61]=Zt);let Qt=Zt,$t=(0,Q.useRef)(Qt),en=St?Yu(Ju(St)).slice(0,-1):Yu(Tt??Ct),tn=en.join(`\0`),nn;t[62]===Y?nn=t[63]:(nn=()=>{let e=new Set;for(let t of $t.current)aJ(Y.getItem(t))?.isExpanded()&&e.add(t);return e},t[62]=Y,t[63]=nn);let rn=nn,an;t[64]===rn?an=t[65]:(an=e=>{let t=new Set(Ku(e??le.current)),n=rn();for(let e of Se.current)n.add(e);return[...n].filter(e=>t.has(e))},t[64]=rn,t[65]=an);let on=an,cn;t[66]!==on||t[67]!==Y?(cn=e=>{let t=Lu(e??le.current);Y.resetPaths(t,{initialExpandedPaths:on(e)})},t[66]=on,t[67]=Y,t[68]=cn):cn=t[68];let ln=cn,un;t[69]!==i||t[70]!==pt?(un=async function(e){let t=He.current,n=new AbortController;Ve.current.set(e,n);let r=await kY(nd(e),n.signal,i({id:`8RtNI0`}),i({id:`HlmZBk`}));if(Ve.current.get(e)===n&&Ve.current.delete(e),n.signal.aborted||t!==He.current)return;if(r.kind===`network-error`){pt(),console.warn(`[FileTree] lazy folder children fetch failed:`,e,r.cause);return}if(r.kind===`http-error`){console.warn(`[FileTree] lazy folder children http error:`,e,r.title),dt(r.title);return}let a=qe.current,o=Xc(r.entries,a);ze.current.add(e),A(t=>TJ(t,e,o,Le.current)),P(null),lt(),r.truncated&&B(r.entries.length)},t[69]=i,t[70]=pt,t[71]=un):un=t[71];let dn=un,fn;t[72]!==rn||t[73]!==dn?(fn=()=>{let e=rn(),t=We.current;We.current=e;for(let n of e){if(t.has(n)||ze.current.has(n)||Ve.current.has(n))continue;let e=nd(n);le.current.find(t=>Zc(t)&&t.path===e)?.hasChildren!==!1&&dn(n)}},t[72]=rn,t[73]=dn,t[74]=fn):fn=t[74];let mn=fn,hn;t[75]!==rn||t[76]!==dn?(hn=()=>{for(let e of rn())ze.current.has(e)||Ve.current.has(e)||dn(e)},t[75]=rn,t[76]=dn,t[77]=hn):hn=t[77];let gn=hn,_n;t[78]!==Y||t[79]!==ln?(_n=(e,t,n,r)=>{let i=r===void 0?[]:r,a=0,o=null;for(let{fromDocName:r,toDocName:i}of n){let n=e.find(e=>ol(e)&&e.docName===r);if(n==null||Y.getItem(i)==null)continue;let s=Xu(i,t.find(e=>ol(e)&&e.docName===i)?.docExt??n.docExt);Y.move(i,s),o=s,a+=1}for(let{toPath:e}of i){let t=Jc(e);if(t===``)continue;let n=e.slice(0,-t.length);Y.getItem(n)!=null&&(Y.getItem(e)??Y.move(n,e),o=e,a+=1)}a!==0&&(ln(t),o!=null&&Y.focusPath(o))},t[78]=Y,t[79]=ln,t[80]=_n):_n=t[80];let vn=_n,yn;t[81]===Symbol.for(`react.memo_cache_sentinel`)?(yn=e=>{Te.current=Wu(e)},t[81]=yn):yn=t[81];let bn=yn,xn;t[82]===Symbol.for(`react.memo_cache_sentinel`)?(xn=e=>be.current.has(e),t[82]=xn):xn=t[82];let Sn=xn,Cn;t[83]!==i||t[84]!==b||t[85]!==D||t[86]!==T||t[87]!==ln?(Cn=async function(e){if(e.kind===`asset`||Pe.current!==null)return;let t=()=>{H(null),Pe.current=null};Pe.current=e.path,H(e.path),P(null);try{let n=await Ot(await fetch(`/api/duplicate-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e.kind,path:e.path})}),i({id:`dw_dUJ`}));if(!n.ok){hs.error(n.title),ln(),t();return}let r=f(Mn,n.body,`duplicate-path`,null);if(r===null){let e=i({id:`67f-3g`});hs.error(e),P(e),ul([`files`,`backlinks`,`graph`]),ln(),t();return}for(let e of r.duplicatedDocNames)b(e);A(t=>{let n=tP(t,e,r);return ln(n),bn(n),n}),ul([`files`,`backlinks`,`graph`]),r.path!==e.path&&(r.kind===`folder`?D(r.path):T(r.path)),hs.success(r.kind===`folder`?i({id:`iilQXA`}):i({id:`A6h5b-`}),{description:r.path}),t()}catch(e){let n=e,r=n instanceof Error?n.message:String(n);console.warn(`[FileTree] duplicate failed:`,n),hs.error(i({id:`EBVbtP`}),{description:r}),ln(),t()}},t[83]=i,t[84]=b,t[85]=D,t[86]=T,t[87]=ln,t[88]=Cn):Cn=t[88];let wn=Cn,Tn=(0,Q.useRef)(wn),En;t[89]===wn?En=t[90]:(En=()=>{Tn.current=wn},t[89]=wn,t[90]=En),(0,Q.useEffect)(En);let Dn=function(e){let t=VJ(e);if(!t||HJ(t))return!1;let n=Y.getFocusedPath()??Y.getSelectedPaths()[0]??null;if(!n||n.endsWith(`/`)||Sn(n))return!1;let r=HJ(n);if(!r)return!1;let i=Ju(t);if(!$t.current.includes(i))return!1;let a=`${t}${r}`;return Xt.current.includes(a)?!1:(ur({sourcePath:n,destinationPath:a,isFolder:!1}),Y.move(n,a),!0)},On;t[91]===Symbol.for(`react.memo_cache_sentinel`)?(On=e=>{let t=e??Ce.current;!t||Ce.current!==t||(t.disposeCommitListener(),Ce.current=null)},t[91]=On):On=t[91];let kn=On,jn;t[92]!==i||t[93]!==kn||t[94]!==l||t[95]!==c||t[96]!==ln?(jn=async function(e,t){let n=t===void 0?{}:t,r=n.updateUi??!0,a=n.restoreLocation??r;kn(e),r&&H(e.renamePath);try{let t=await fetch(`/api/delete-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e.kind,path:e.createdPath})});if(!t.ok&&t.status!==404){let n=e.kind,a=e.createdPath,o=await Ot(t,i({id:`EcM3k7`,values:{kind:n}}));if(o.ok)return;let s=o.title,c=i({id:`YPFBfr`,values:{detail:s,kind:n,createdPath:a}});r?hs.error(c):console.warn(`[FileTree] cleanup pending create failed: ${c}`),r&&(H(null),ln());return}}catch(t){if(console.warn(`[FileTree] cleanup pending create failed:`,t),r){let t=e.kind,n=e.createdPath;hs.error(i({id:`_TDESN`,values:{kind:t,createdPath:n}}))}r&&(H(null),ln());return}r&&(e.kind===`file`?l(e.createdPath):c([st(e.createdPath)],{force:!0})),r&&A(t=>{let n=$N(t,e.kind===`file`?[e.createdPath]:[],e.kind===`folder`?e.createdPath:void 0);return bn(n),n}),ul([`files`,`backlinks`,`graph`]),a&&(window.location.hash=e.previousHash),r&&H(null)},t[92]=i,t[93]=kn,t[94]=l,t[95]=c,t[96]=ln,t[97]=jn):jn=t[97];let Pn=jn,Fn,In;t[98]===Symbol.for(`react.memo_cache_sentinel`)?(Fn=()=>()=>{let e=Ce.current;e&&we.current(e,{restoreLocation:!1,updateUi:!1}).catch(qY)},In=[],t[98]=Fn,t[99]=In):(Fn=t[98],In=t[99]),(0,Q.useEffect)(Fn,In);let Rn;t[100]!==i||t[101]!==pt?(Rn=()=>{let e=!0,t=null,n=_J(async function(){t?.abort();let n=new AbortController;t=n,He.current+=1;for(let e of Ve.current.values())e.abort();Ve.current.clear(),ze.current.clear();try{let t=await fetch(`/api/documents?showAll=true&dir=&depth=1`,{signal:n.signal,headers:vJ});if(yJ(t)){let r=qe.current,i=!1,{entries:a,truncated:o}=await SJ(t,{onBatch:t=>{if(!e||n.signal.aborted)return;let a=Xc(rl(t),r);a.length!==0&&(A(e=>wJ(e,a)),i||(i=!0,P(null),lt(),M(!1)))}});if(!e)return;let s=Xc(rl(a),r);A(e=>TJ(e,``,s,Le.current)),P(null),lt(),B(o?a.length:null),Ke.current()}else{let n=await Ot(t,i({id:`8RtNI0`}));if(!e)return;if(!n.ok)dt(n.title),B(null);else{let e=pn.safeParse(n.body);if(!e.success)dt(i({id:`HlmZBk`})),B(null);else{let t=qe.current,n=Xc(rl(e.data.documents),t);A(e=>TJ(e,``,n,Le.current)),P(null),lt(),B(e.data.truncated===!0?e.data.documents.length:null),Ke.current()}}}}catch(t){let r=t;if(n.signal.aborted)return;e&&(r instanceof bJ?dt(r.message):pt()),console.warn(`[FileTree] fetch failed:`,r)}e&&M(!1)},()=>t?.abort());Je.current=()=>n.request(),n.request();let r=()=>{document.visibilityState===`visible`&&n.request()};window.addEventListener(`focus`,r),window.addEventListener(`visibilitychange`,r);let a=dl(e=>{e.includes(`files`)&&n.request()});return()=>{e=!1,Je.current=null,n.dispose();for(let e of Ve.current.values())e.abort();Ve.current.clear(),window.removeEventListener(`focus`,r),window.removeEventListener(`visibilitychange`,r),a()}},t[100]=i,t[101]=pt,t[102]=Rn):Rn=t[102];let zn;t[103]===i?zn=t[104]:(zn=[i],t[103]=i,t[104]=zn),(0,Q.useEffect)(Rn,zn);let Bn=(0,Q.useRef)(!0),Vn;t[105]===Symbol.for(`react.memo_cache_sentinel`)?(Vn=()=>{if(Bn.current){Bn.current=!1;return}Je.current?.()},t[105]=Vn):Vn=t[105];let Hn;t[106]===Ft?Hn=t[107]:(Hn=[Ft],t[106]=Ft,t[107]=Hn),(0,Q.useEffect)(Vn,Hn);let Un,Wn;t[108]===Symbol.for(`react.memo_cache_sentinel`)?(Un=()=>{let e=!0;return fetch(`/api/workspace`).then(async t=>{let n=await t.json();if(!e||!t.ok)return;let r=f(An,n,`workspace`,null);r&&ie({contentDir:r.contentDir,pathSeparator:r.pathSeparator})}).catch(KY),()=>{e=!1}},Wn=[],t[108]=Un,t[109]=Wn):(Un=t[108],Wn=t[109]),(0,Q.useEffect)(Un,Wn);let Kn;t[110]!==on||t[111]!==Y||t[112]!==Yt?(Kn=()=>{if(Te.current===Yt){Te.current=null;return}Y.resetPaths(Xt.current,{initialExpandedPaths:on()})},t[110]=on,t[111]=Y,t[112]=Yt,t[113]=Kn):Kn=t[113];let qn;t[114]!==Y||t[115]!==Yt?(qn=[Y,Yt],t[114]=Y,t[115]=Yt,t[116]=qn):qn=t[116],(0,Q.useEffect)(Kn,qn),sJ(Y,Tt,tn,Oe,Yt);let Jn,Yn;t[117]!==Y||t[118]!==r?(Jn=()=>{if(!r)return;let e=0,t=0,n=()=>Xe.current?.querySelector(`file-tree-container`)?.shadowRoot?.querySelector(`[data-file-tree-virtualized-list]`)??null,i=()=>{let e=n();if(!e)return;let t=Number.parseFloat(e.style.height);Number.isFinite(t)&&r(t)},a=()=>{cancelAnimationFrame(e),e=requestAnimationFrame(i)},o=new MutationObserver(i),s=()=>{let e=n();e?(o.observe(e,{attributes:!0,attributeFilter:[`style`]}),i()):t=requestAnimationFrame(s)};s();let c=Y.subscribe(a);return window.addEventListener(`resize`,a),()=>{cancelAnimationFrame(e),cancelAnimationFrame(t),o.disconnect(),c(),window.removeEventListener(`resize`,a)}},Yn=[r,Y],t[117]=Y,t[118]=r,t[119]=Jn,t[120]=Yn):(Jn=t[119],Yn=t[120]),(0,Q.useEffect)(Jn,Yn);let Xn;t[121]===Symbol.for(`react.memo_cache_sentinel`)?(Xn=()=>{ae(!1)},t[121]=Xn):Xn=t[121];let Zn;t[122]===wt?Zn=t[123]:(Zn=[wt],t[122]=wt,t[123]=Zn),(0,Q.useEffect)(Xn,Zn);let Qn,$n;t[124]===q?(Qn=t[125],$n=t[126]):(Qn=()=>{oe.current=q;for(let e of ce.current)e()},$n=[q],t[124]=q,t[125]=Qn,t[126]=$n),(0,Q.useEffect)(Qn,$n);let er;t[127]!==Tt||t[128]!==j||t[129]!==Y?(er=()=>{j||!Tt||Hq(Y)},t[127]=Tt,t[128]=j,t[129]=Y,t[130]=er):er=t[130];let tr;t[131]!==tn||t[132]!==Tt||t[133]!==j||t[134]!==Y||t[135]!==Yt?(tr=[Tt,tn,Yt,j,Y],t[131]=tn,t[132]=Tt,t[133]=j,t[134]=Y,t[135]=Yt,t[136]=tr):tr=t[136],(0,Q.useEffect)(er,tr);let nr,rr;t[137]===Y?(nr=t[138],rr=t[139]):(nr=()=>Y.subscribe(()=>{if(!Y.isSearchOpen())for(let e of Se.current){let t=aJ(Y.getItem(e));t&&!t.isExpanded()&&t.expand()}}),rr=[Y],t[137]=Y,t[138]=nr,t[139]=rr),(0,Q.useEffect)(nr,rr);let ir,ar;t[140]===Y?(ir=t[141],ar=t[142]):(ir=()=>Y.subscribe(()=>Ge.current()),ar=[Y],t[140]=Y,t[141]=ir,t[142]=ar),(0,Q.useEffect)(ir,ar);let or,sr;t[143]===Y?(or=t[144],sr=t[145]):(or=()=>Y.onMutation(`remove`,e=>{let t=Ce.current;!t||e.path!==t.renamePath||we.current(t)}),sr=[Y],t[143]=Y,t[144]=or,t[145]=sr),(0,Q.useEffect)(or,sr);let cr;t[146]!==b||t[147]!==u||t[148]!==d||t[149]!==he||t[150]!==D||t[151]!==T||t[152]!==p||t[153]!==vn||t[154]!==_?(cr=async(e,t,n,r,i)=>{let a=t===void 0?[]:t,o=n===void 0?[]:n,s=i===void 0?[]:i,c=r?.docName??ge.current,l=new Map,f=new Map;for(let e of le.current){if(ol(e)){let t=o.find(t=>t.fromPath===Xu(e.docName,e.docExt))?.toPath;t&&l.set(e.docName,t);continue}if(el(e)){let t=o.find(t=>t.fromPath===e.path)?.toPath;t&&Kc(t)&&f.set(e.path,Iu(t))}}let m=c?l.get(c)??null:null,h=r?.folderPath??(tt.current?.kind===`folder`?tt.current.folderPath:null),g=h?ve(h,a):null,v=r?.assetPath??(tt.current?.kind===`asset`?tt.current.assetPath:null),y=v?f.get(v)??null:null,x=m?null:y??nP(c,e),S=m??(v?y?null:o.find(e=>e.fromPath===v)?.toPath??ve(v,a):null);Ee(e);let C=[...rP(e,d(),p),...l.keys()];await Promise.all(C.map(e=>u(e)));for(let t of e)b(t.toDocName);for(let e of f.values())b(e);_(e,a,o);let w=null;A(t=>{let n=QN(t,e,a,o,s);return w=n,vn(t,n,e,o),bn(n),n}),h&&g&&g!==h?D(g):x&&x!==c?(T(x),UJ(x)):S&&(m||S!==v)&&he(S,w??le.current),ul([`files`,`backlinks`,`graph`])},t[146]=b,t[147]=u,t[148]=d,t[149]=he,t[150]=D,t[151]=T,t[152]=p,t[153]=vn,t[154]=_,t[155]=cr):cr=t[155];let lr=cr;async function ur(e){let t=!e.isFolder&&Sn(e.sourcePath),n=t?e.sourcePath:Vu(e.sourcePath,e.isFolder);H(n),P(null);try{let r=qc(e.sourcePath,e.destinationPath,e.isFolder),a=!e.isFolder&&!t&&!Kc(r.destinationPath),o=t||a?r.destinationPath:Vu(r.destinationPath,e.isFolder),s=e.isFolder?{kind:`folder`,fromPath:nd(n),toPath:nd(o)}:t||a?{kind:`asset`,fromPath:n,toPath:o}:{kind:`file`,fromPath:td(n,le.current),toPath:o},c={docName:ge.current,folderPath:tt.current?.kind===`folder`?tt.current.folderPath:null,assetPath:tt.current?.kind===`asset`?tt.current.assetPath:null},l=await Ot(await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(s)}),i({id:`gijbne`}));if(!l.ok){hs.error(l.title),ln();let e=Ce.current;e&&e.renamePath===n?await Pn(e):kn(),H(null);return}let u=f(mr,l.body,`rename-path`,{renamed:[],renamedAssets:[]});try{await lr(u.renamed,e.isFolder?[{fromPath:nd(n),toPath:nd(o)}]:[],u.renamedAssets,c,!e.isFolder&&!t&&!a?u.renamed.flatMap(e=>{let t=Jc(o);return t?[{toDocName:e.toDocName,docExt:t}]:[]}):[])}catch(e){console.warn(`[FileTree] post-rename reconciliation failed`,{err:e,sourceTreePath:n,destinationTreePath:o,renamedCount:u.renamed.length,renamedAssetCount:u.renamedAssets.length}),hs.error(i({id:`dDpCOp`}))}kn(),H(null)}catch(e){console.warn(`[FileTree] rename failed:`,e);let t=i({id:`HIb0vl`});hs.error(t),P(t),ln();let r=Ce.current;r&&r.renamePath===n?await Pn(r):kn(),H(null)}}let fr;t[156]!==i||t[157]!==lr||t[158]!==ln?(fr=async function(e){let t=e.draggedPaths.map(t=>{let n=Hu(t,e.target);return t===n?null:{sourcePath:t,destinationTreePath:n}}).filter(GY);if(t.length!==0){H(t[0]?.sourcePath??null),P(null);try{let e=[],n=[],r=[],a={docName:ge.current,folderPath:tt.current?.kind===`folder`?tt.current.folderPath:null,assetPath:tt.current?.kind===`asset`?tt.current.assetPath:null};for(let a of t){let t=a.sourcePath.endsWith(`/`),o=!t&&Sn(a.sourcePath),s=o?null:td(a.sourcePath,le.current),c=t?{kind:`folder`,fromPath:nd(a.sourcePath),toPath:nd(a.destinationTreePath)}:o?{kind:`asset`,fromPath:a.sourcePath,toPath:a.destinationTreePath}:{kind:`file`,fromPath:s??Iu(a.sourcePath),toPath:s&&Kc(s)?a.destinationTreePath:Iu(a.destinationTreePath)},l=await Ot(await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(c)}),i({id:`dOHMA0`}));if(!l.ok){hs.error(l.title),ln(),H(null);return}let u=f(mr,l.body,`rename-path:drop`,{renamed:[],renamedAssets:[]});e=e.concat(u.renamed),n=n.concat(u.renamedAssets),t&&r.push({fromPath:nd(a.sourcePath),toPath:nd(a.destinationTreePath)})}try{await lr(e,r,n,a)}catch(r){console.warn(`[FileTree] post-move reconciliation failed`,{err:r,operationCount:t.length,renamedCount:e.length,renamedAssetCount:n.length}),hs.error(i({id:`8OxKZy`}))}H(null)}catch(e){console.warn(`[FileTree] move failed:`,e),hs.error(i({id:`HIb0vl`})),ln(),H(null)}}},t[156]=i,t[157]=lr,t[158]=ln,t[159]=fr):fr=t[159];let pr=fr,hr;t[160]!==i||t[161]!==b||t[162]!==ln?(hr=async function(e,t,n){if(e.length===0||Pe.current!==null)return;let r=()=>{Pe.current=null,H(null)};Pe.current=n,H(n),P(null);let a=[],o=0,s=0;for(let n of e){let e=new FormData;e.append(`file`,n),Zu(e,t,n.name||`upload`);try{let r=await Ot(await fetch(`/api/upload`,{method:`POST`,body:e}),i({id:`4Gz2wC`}));if(!r.ok){s+=1,hs.error(r.title,{description:n.name});continue}let c=f(dr,r.body,`upload:drop`,null);if(c===null){s+=1,hs.error(i({id:`4Gz2wC`}),{description:n.name});continue}let l=Nu(t,c);if(c.deduped===!0){s+=1,hs.error(i({id:`4sKwf6`}),{description:l});continue}o+=1;let u=Qu(l,n);u&&a.push(u)}catch(e){let t=e;s+=1,console.warn(`[FileTree] external file upload failed:`,t),hs.error(t instanceof TypeError?i({id:`HIb0vl`}):i({id:`4Gz2wC`}),{description:n.name})}}try{if(a.length>0){for(let e of a)ol(e)&&b(e.docName);A(e=>{let t=new Set(e.map(Ru)),n=!1,r=[...e];for(let e of a){let i=Ru(e);Le.current.set(i,Date.now()),!t.has(i)&&(t.add(i),r.push(e),n=!0)}return n?(ln(r),bn(r),r):e})}o>0&&(ul([`files`,`backlinks`,`graph`]),Je.current?.(),hs.success(Gc._({id:`v75Em9`,values:{uploadedCount:o}}),{description:t||i({id:`RSqaSd`})})),s>0&&P(o>0?Gc._({id:`yH7T4q`,values:{failedCount:s}}):i({id:`4Gz2wC`})),r()}catch(e){let t=e,n=i({id:`VcqWBy`});console.warn(`[FileTree] upload post-upload reconciliation failed:`,t),hs.error(n),P(n),r()}},t[160]=i,t[161]=b,t[162]=ln,t[163]=hr):hr=t[163];let gr=hr,_r;t[164]===Symbol.for(`react.memo_cache_sentinel`)?(_r=function(e){ne({parentDir:e})},t[164]=_r):_r=t[164];let vr=_r,yr;t[165]!==i||t[166]!==b||t[167]!==Pn||t[168]!==kn||t[169]!==Y||t[170]!==D||t[171]!==T||t[172]!==ln||t[173]!==Jt?(yr=async function(e,t,n){if(Pe.current)return;let r=Ce.current;r&&kn(r);try{let r=qu(e,t,[...Jt,...$t.current]);H(r.renamePath),Pe.current=r.renamePath;let a=window.location.hash,o;if(e===`file`){let e=Fu(`file`,r.addPath),t={path:e};n?.template&&(t.template=n.template);let a=await Ot(await fetch(`/api/create-page`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)}),i({id:`fJgQHX`}));if(!a.ok){hs.error(a.title),H(null),Pe.current=null;return}let s=Iu(e),c=f(Ln,a.body,`create-page`,{docName:s}).docName;o=c;let l={kind:`document`,docName:c,docExt:e.toLowerCase().endsWith(`.mdx`)?`.mdx`:`.md`,modified:new Date().toISOString(),size:0};b(c),A(e=>{if(e.some(e=>ol(e)&&e.docName===c))return e;let t=[...e,l];return bn(t),Le.current.set(Ru(l),Date.now()),t}),ul([`files`,`backlinks`,`graph`]),T(c)}else{let e=nd(r.addPath),t=await Ot(await fetch(`/api/create-folder`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e})}),i({id:`K1ckLX`}));if(!t.ok){hs.error(t.title),H(null),Pe.current=null;return}o=f(Br,t.body,`create-folder`,{path:e}).path;let n={kind:`folder`,path:o,modified:new Date().toISOString(),size:0};A(e=>{if(e.some(e=>Zc(e)&&e.path===o))return e;let t=[...e,n];return bn(t),Le.current.set(Ru(n),Date.now()),t}),ul([`files`]),D(o)}let s=!1,c=e=>{if(e.key!==`Enter`)return;let t=Ce.current;!t||t.renamePath!==r.renamePath||queueMicrotask(()=>kn(t))};document.addEventListener(`keydown`,c,!0),Ce.current={kind:e,renamePath:r.renamePath,createdPath:o,previousHash:a,disposeCommitListener:()=>{s||(s=!0,document.removeEventListener(`keydown`,c,!0))}},H(null),Pe.current=null,Y.add(r.addPath),Y.startRenaming(r.renamePath,{removeIfCanceled:!0})}catch(e){console.warn(`[FileTree] create placeholder failed:`,e),hs.error(i({id:`S6l5dv`}));let t=Ce.current;t?await Pn(t):kn(),H(null),Pe.current=null,ln()}},t[165]=i,t[166]=b,t[167]=Pn,t[168]=kn,t[169]=Y,t[170]=D,t[171]=T,t[172]=ln,t[173]=Jt,t[174]=yr):yr=t[174];let br=yr,xr;t[175]===Y?xr=t[176]:(xr=function(e){let t=Ju(e);(0,Q.startTransition)(()=>{for(let e of $t.current)if(e===t||e.startsWith(t)){let t=aJ(Y.getItem(e));t&&t.expand()}})},t[175]=Y,t[176]=xr);let Sr=xr,Cr;t[177]===Y?Cr=t[178]:(Cr=function(e){let t=Ju(e),n=new Set(Se.current);(0,Q.startTransition)(()=>{for(let e of[...$t.current].reverse())if((e===t||e.startsWith(t))&&!n.has(e)){let t=aJ(Y.getItem(e));t&&t.collapse()}})},t[177]=Y,t[178]=Cr);let wr=Cr,Tr;t[179]===Symbol.for(`react.memo_cache_sentinel`)?(Tr=function(){return((Xe.current?.querySelector(`file-tree-container`)?.shadowRoot)?.querySelector(`[aria-selected="true"][data-item-path]`))?.dataset.itemPath??null},t[179]=Tr):Tr=t[179];let Er=Tr,Dr;t[180]!==pe||t[181]!==en||t[182]!==o||t[183]!==s||t[184]!==ye||t[185]!==V||t[186]!==Pn||t[187]!==mn||t[188]!==k||t[189]!==Qt||t[190]!==pr||t[191]!==ur||t[192]!==Kt||t[193]!==x||t[194]!==Dn||t[195]!==gn||t[196]!==Ft||t[197]!==Jt||t[198]!==gr?(Dr=()=>{le.current=k,ue.current=x,ge.current=o,tt.current=s,be.current=ye,Pe.current=V,qe.current=Ft,Xt.current=Jt,$t.current=Qt,Se.current=en,Ge.current=mn,Ke.current=gn,we.current=Pn,Ne.current=(e,t,n)=>{gr(e,t,n)},Ze.current=e=>{if(Oe.current||ke.current||e.length!==1)return;let t=e[0];if(t){ae(!1);let e=Kt(t),n=de.current,r=n!==null&&Iu(n)===Iu(e),i=r?n:e;de.current=null,queueMicrotask(()=>{pe(Kt((r?null:Er())??i),le.current)})}},$e.current=e=>{Dn(e)||hs.error(e)},Qe.current=ur,et.current=pr},t[180]=pe,t[181]=en,t[182]=o,t[183]=s,t[184]=ye,t[185]=V,t[186]=Pn,t[187]=mn,t[188]=k,t[189]=Qt,t[190]=pr,t[191]=ur,t[192]=Kt,t[193]=x,t[194]=Dn,t[195]=gn,t[196]=Ft,t[197]=Jt,t[198]=gr,t[199]=Dr):Dr=t[199],(0,Q.useLayoutEffect)(Dr);let Or,kr;t[200]===Y?(Or=t[201],kr=t[202]):(Or=()=>{let e=e=>{let t=(e.metaKey||e.ctrlKey)&&!e.altKey,n=e.key.toLowerCase(),r=t&&n===`a`,i=t&&!e.shiftKey&&n===`d`,a=t&&!e.shiftKey&&n===`c`,o=t&&!e.shiftKey&&n===`v`,s=!e.altKey&&!e.shiftKey&&(e.metaKey&&!e.ctrlKey&&n===`backspace`||!e.metaKey&&!e.ctrlKey&&n===`delete`);if(!r&&!i&&!a&&!o&&!s||SY(e.target))return;let c=Xe.current,l=e.target,u=document.activeElement,d=l instanceof Node&&c?.contains(l),f=u instanceof Node&&c?.contains(u);if(!d&&!f)return;if(a){let t=yY(Y,le.current,be.current);if(!t)return;Fe.current=t,e.preventDefault(),e.stopPropagation();return}if(o){let t=Fe.current;if(!t)return;Tn.current(t),e.preventDefault(),e.stopPropagation();return}if(i){let t=yY(Y,le.current,be.current);if(!t)return;Tn.current(t),e.preventDefault(),e.stopPropagation();return}if(s){if(Pe.current!==null)return;let t=bY(Y,le.current);if(t.length===0)return;W({targets:t}),e.preventDefault(),e.stopPropagation();return}let p=new Set([...$t.current,...Xt.current]);Oe.current=!0;for(let e of p)e&&Y.getItem(e)?.select();queueMicrotask(()=>{Oe.current=!1}),e.preventDefault(),e.stopPropagation()};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},kr=[Y],t[200]=Y,t[201]=Or,t[202]=kr),(0,Q.useEffect)(Or,kr);let Ar,jr;t[203]!==k.length||t[204]!==j?(Ar=()=>{if(j||k.length===0)return;let e=Xe.current?.querySelector(nR)?.shadowRoot;if(!e)return;let t=WY,n=()=>{for(let n of e.querySelectorAll(`[data-item-path]`)){let e=n.dataset.itemPath;if(!e)continue;let r=t(e);n.title!==r&&(n.title=r)}let n=e.querySelector(`[data-type="context-menu-anchor"]`);if(n){let r=e.querySelector(`[data-item-context-hover="true"][data-item-path]`)?.dataset.itemPath,i=r?t(r):``;n.title!==i&&(n.title=i)}};n();let r=new MutationObserver(n);return r.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`data-item-path`,`data-item-context-hover`]}),()=>r.disconnect()},jr=[j,k.length],t[203]=k.length,t[204]=j,t[205]=Ar,t[206]=jr):(Ar=t[205],jr=t[206]),(0,Q.useEffect)(Ar,jr);let Mr,Nr;t[207]!==k.length||t[208]!==j?(Mr=()=>{if(j||k.length===0)return;let e=Xe.current?.querySelector(nR)?.shadowRoot;if(!e)return;let t=()=>yq(e);t();let n=new MutationObserver(t);return n.observe(e,{subtree:!0,childList:!0,characterData:!0,attributes:!0,attributeFilter:[`data-item-path`]}),()=>n.disconnect()},Nr=[j,k.length],t[207]=k.length,t[208]=j,t[209]=Mr,t[210]=Nr):(Mr=t[209],Nr=t[210]),(0,Q.useEffect)(Mr,Nr);let Pr,Fr;t[211]!==k.length||t[212]!==j?(Pr=()=>{if(j||k.length===0)return;let e=Xe.current?.querySelector(nR)?.shadowRoot;if(!e)return;let t=()=>Lq(e);t();let n=new MutationObserver(t);return n.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`data-item-path`]}),()=>n.disconnect()},Fr=[j,k.length],t[211]=k.length,t[212]=j,t[213]=Pr,t[214]=Fr):(Pr=t[213],Fr=t[214]),(0,Q.useEffect)(Pr,Fr);let Ir;t[215]===Symbol.for(`react.memo_cache_sentinel`)?(Ir={folderCount:0,expandedCount:0},t[215]=Ir):Ir=t[215];let Rr=(0,Q.useRef)(Ir),zr=(0,Q.useRef)(br),Vr=(0,Q.useRef)(vr),Hr;t[216]===br?Hr=t[217]:(Hr=()=>{zr.current=br,Vr.current=vr},t[216]=br,t[217]=Hr),(0,Q.useEffect)(Hr);let Ur,Wr;t[218]===Y?(Ur=t[219],Wr=t[220]):(Ur=()=>({startCreating(e,t){zr.current(e,t)},startCreatingFromTemplate(e){Vr.current(e)},createFromTemplate(e,t){zr.current(`file`,e,{template:t})},expandAll(){(0,Q.startTransition)(()=>{for(let e of $t.current){let t=aJ(Y.getItem(e));t&&t.expand()}})},collapseAll(){let e=new Set(Se.current);(0,Q.startTransition)(()=>{for(let t of[...$t.current].reverse()){if(e.has(t))continue;let n=aJ(Y.getItem(t));n&&n.collapse()}})},getFolderState(){let e=$t.current,t=0;for(let n of e)aJ(Y.getItem(n))?.isExpanded()&&t++;let n=e.length,r=Rr.current;if(r.folderCount===n&&r.expandedCount===t)return r;let i={folderCount:n,expandedCount:t};return Rr.current=i,i},isCreationTargetCleared(){return oe.current},clearCreationTarget(){ae(!0)},subscribe(e){ce.current.add(e);let t=Y.subscribe(e);return()=>{ce.current.delete(e),t()}}}),Wr=[Y],t[218]=Y,t[219]=Ur,t[220]=Wr),(0,Q.useImperativeHandle)(n,Ur,Wr);let Gr;t[221]!==kn||t[222]!==u||t[223]!==c||t[224]!==Y?(Gr=async function(e,t,n){let r=CY(e,le.current,$t.current),i=Ce.current;i&&e.some(e=>wY(e,i))&&(i.kind===`file`?r.docNames.add(i.createdPath):r.folderPaths.add(i.createdPath),kn(i));let a=new Set([...r.docNames,...t]),o=new Set([...r.folderPaths,...n]),s=new Set([...r.assetPaths,...e.filter(UY).map(HY)]);c([...[...a].map(VY),...[...o].map(BY),...[...s].map(zY)],{force:!0}),await Promise.all([...a].map(e=>u(e)));for(let t of e){let e=t.kind===`folder`?Ju(t.path):t.kind===`asset`?t.path:Xu(t.path,t.docExt);Y.getItem(e)&&Y.remove(e,t.kind===`folder`?{recursive:!0}:void 0)}A(e=>{let t=$N(e,[...a],void 0,[...s]);for(let e of o)t=$N(t,[],e);return bn(t),t}),ul([`files`,`backlinks`,`graph`])},t[221]=kn,t[222]=u,t[223]=c,t[224]=Y,t[225]=Gr):Gr=t[225];let Kr=Gr,qr;t[226]!==i||t[227]!==Kr?(qr=async function(e){let t=[],n=[],r=[];for(let a of e){let e=a.kind;H(a.path);let o=await Ot(await fetch(`/api/delete-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e,path:a.path})}),i({id:`7JtSLi`}));if(!o.ok)return r.length>0&&await Kr(r,t,n),hs.error(o.title),!1;let s=f(Lr,o.body,`delete-path`,{deletedDocNames:[]});t.push(...s.deletedDocNames),e===`folder`&&n.push(a.path),r.push(a)}return await Kr(r,t,n),!0},t[226]=i,t[227]=Kr,t[228]=qr):qr=t[228];let Yr=qr,Xr;t[229]===Symbol.for(`react.memo_cache_sentinel`)?(Xr=async function(e,t,n){let r=[],i=[];for(let a of e){H(a.path);let e=iP(a,n),o=await t.shell.trashItem(e);o.ok?r.push(a):i.push({kind:a.kind,path:a.path,name:a.name,reason:Qq(o.reason),detail:o.detail})}return{trashed:r,failed:i}},t[229]=Xr):Xr=t[229];let Zr=Xr,Qr;t[230]===i?Qr=t[231]:(Qr=async function(e){let t=[],n=[],r=[];for(let a of e){let e=a.kind;try{let o=await Ot(await fetch(`/api/trash/cleanup`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e,path:a.path})}),i({id:`DVh_Tb`}));if(!o.ok){console.warn(`[FileTree] trash-cleanup failed`,{target:`${a.kind}:${a.path}`,reason:o.title}),r.push({target:a,reason:o.title});continue}let s=f(Nn,o.body,`trash-cleanup`,{deletedDocNames:[]});t.push(...s.deletedDocNames),e===`folder`&&n.push(a.path)}catch(e){let t=e;console.warn(`[FileTree] trash-cleanup threw`,{target:`${a.kind}:${a.path}`,err:t}),r.push({target:a,reason:i({id:`r4R7AZ`})})}}if(r.length>0){let e=r.length;hs.error(i({id:`IrB5AK`,values:{failedCount:e}}),{description:i({id:`vEJDlt`})})}return r.length===e.length&&e.length>0?null:{deletedDocNames:t,deletedFolderPaths:n}},t[230]=i,t[231]=Qr);let $r=Qr,ei;t[232]!==i||t[233]!==ee||t[234]!==Kr||t[235]!==Yr||t[236]!==$r||t[237]!==ln||t[238]!==re?(ei=async function(e){let t=e.map(e=>eP(e,le.current)),n=t[0];if(!n)return;let r=ee.filter(e=>t.some(t=>{if(t.kind===`file`){let n=`${t.path}${t.docExt??`.md`}`;return e.file===n}return t.kind===`folder`?e.file.startsWith(`${t.path}/`):!1}));if(r.length>0){let e=r.slice(0,3).map(RY),t=r.length>e.length?`, +${r.length-e.length} more`:``;hs.error(`Cannot delete files with unresolved conflicts`,{description:`Resolve the conflict on ${e.join(`, `)}${t} before deleting.`});return}H(n.path),W(null);let a=typeof window<`u`?window.okDesktop:void 0;try{if(a&&re){let{trashed:e,failed:n}=await Zr(t,a,re);if(e.length>0){let t=await $r(e);t?await Kr(e,t.deletedDocNames,t.deletedFolderPaths):await Kr(e,e.filter(LY).map(IY),e.filter(FY).map(PY))}n.length>0&&K({failed:n,originalTargets:[...t]}),H(null)}else{let e=await Yr(t);H(null),e||ln()}}catch(e){let t=e,n=t instanceof Error?t.message:String(t);console.warn(`[FileTree] delete failed:`,t),hs.error(i({id:`0eHrMb`}),{description:n}),H(null),ln()}},t[232]=i,t[233]=ee,t[234]=Kr,t[235]=Yr,t[236]=$r,t[237]=ln,t[238]=re,t[239]=ei):ei=t[239];let ti=ei,ni;t[240]!==i||t[241]!==Yr||t[242]!==ln||t[243]!==G?(ni=async function(){if(!G)return;let e=new Set(G.failed.map(NY)),t=G.originalTargets.filter(t=>e.has(`${t.kind}:${t.path}`));if(K(null),t.length!==0){H(t[0]?.path??null);try{let e=await Yr(t);H(null),e||ln()}catch(e){let t=e,n=t instanceof Error?t.message:String(t);console.warn(`[FileTree] hard-delete fallback failed:`,t),hs.error(i({id:`0eHrMb`}),{description:n}),H(null),ln()}}},t[240]=i,t[241]=Yr,t[242]=ln,t[243]=G,t[244]=ni):ni=t[244];let ri=ni,ii;t[245]!==ti||t[246]!==G?(ii=async function(){if(!G)return;let e=new Set(G.failed.map(MY)),t=G.originalTargets.filter(t=>e.has(`${t.kind}:${t.path}`));K(null),await ti(t)},t[245]=ti,t[246]=G,t[247]=ii):ii=t[247];let ai=ii,oi=(0,Q.useRef)(ti),si;t[248]===ti?si=t[249]:(si=()=>{oi.current=ti},t[248]=ti,t[249]=si),(0,Q.useEffect)(si);let ci,li;t[250]===Symbol.for(`react.memo_cache_sentinel`)?(ci=()=>fJ(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=le.current.find(e=>ol(e)&&e.docName===t);oi.current([{kind:`file`,path:t,name:t.split(`/`).pop()??t,docExt:n?.docExt}]);return}if(e.kind===`folder`){oi.current([{kind:`folder`,path:e.folderPath,name:e.folderPath.split(`/`).pop()??e.folderPath}]);return}if(e.kind===`asset`){oi.current([{kind:`asset`,path:e.assetPath,name:e.assetPath.split(`/`).pop()??e.assetPath}]);return}console.warn(JSON.stringify({event:`file-tree-menu-action-delete-unsupported-kind`,kind:e.kind}))}),li=[],t[250]=ci,t[251]=li):(ci=t[250],li=t[251]),(0,Q.useEffect)(ci,li);let ui,di;t[252]===Symbol.for(`react.memo_cache_sentinel`)?(ui=()=>gJ(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=le.current.find(e=>ol(e)&&e.docName===t);Tn.current({kind:`file`,path:t,name:t.split(`/`).pop()??t,docExt:n?.docExt});return}if(e.kind===`folder`){Tn.current({kind:`folder`,path:e.folderPath,name:e.folderPath.split(`/`).pop()??e.folderPath});return}console.warn(JSON.stringify({event:`file-tree-menu-action-duplicate-unsupported-kind`,kind:e.kind}))}),di=[],t[252]=ui,t[253]=di):(ui=t[252],di=t[253]),(0,Q.useEffect)(ui,di);let fi,pi;t[254]===Y?(fi=t[255],pi=t[256]):(fi=()=>mJ(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=Xu(t,le.current.find(e=>ol(e)&&e.docName===t)?.docExt);Y.startRenaming(n);return}if(e.kind===`folder`){Y.startRenaming(e.folderPath);return}if(e.kind===`asset`){Y.startRenaming(e.assetPath);return}console.warn(JSON.stringify({event:`file-tree-menu-action-rename-unsupported-kind`,kind:e.kind}))}),pi=[Y],t[254]=Y,t[255]=fi,t[256]=pi),(0,Q.useEffect)(fi,pi);let mi;t[257]===Symbol.for(`react.memo_cache_sentinel`)?(mi=function(){let e=De.current;e&&zJ(e),De.current=null},t[257]=mi):mi=t[257];let hi=mi,gi;t[258]===Symbol.for(`react.memo_cache_sentinel`)?(gi=function(e){let t=pY(e);if(!t)return!1;let n=Xe.current?.querySelector(nR)?.shadowRoot;if(!n)return!1;for(let e of n.querySelectorAll(`[data-item-path]`))if(e.dataset.itemPath===t)return!0;return!1},t[258]=gi):gi=t[258];let _i=gi,vi;t[259]===g?vi=t[260]:(vi=function(e){let t=iX(e.nativeEvent);if(!t||t.endsWith(`/`)){hi();return}let n=le.current.find(e=>Ru(e)===t);if(n&&el(n)){hi();return}let r=n&&ol(n)?n.docName:td(t,le.current);if(n&&ol(n)&&Gn(n.size)){hi();return}De.current!==r&&(hi(),De.current=r,RJ(r,e=>g(e)))},t[259]=g,t[260]=vi);let yi=vi,bi;t[261]!==pe||t[262]!==Y||t[263]!==D||t[264]!==T?(bi=function(e){if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=aX(e.nativeEvent);if(!t){cX(e.nativeEvent)&&ae(!0);return}let n=t.getAttribute(`aria-selected`)===`true`,r=t.dataset.itemPath;if(!r)return;let i=t.dataset.itemType===`folder`?Ju(r):r;if(t.dataset.itemType===`folder`){let t=nd(i),r=aJ(Y.getItem(i));if(!n){e.preventDefault(),e.stopPropagation(),r&&!r.isExpanded()&&r.expand(),queueMicrotask(()=>D(t));return}if(Y.getSelectedPaths().length!==1||window.location.hash===vl(t))return;e.preventDefault(),e.stopPropagation(),r&&!r.isExpanded()&&r.expand(),queueMicrotask(()=>D(t));return}if(!n){if(mY(i,Xt.current)||_i(i)){de.current=i,setTimeout(()=>T(i,void 0,{registerPage:!0}),0);return}queueMicrotask(()=>pe(i));return}let a=td(i,le.current);Y.getSelectedPaths().length===1&&window.location.hash!==El(a)&&queueMicrotask(()=>pe(i))},t[261]=pe,t[262]=Y,t[263]=D,t[264]=T,t[265]=bi):bi=t[265];let xi=bi,Si;t[266]===Symbol.for(`react.memo_cache_sentinel`)?(Si=function(e){Gu(e.nativeEvent)&&(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=`copy`,rt(!0))},t[266]=Si):Si=t[266];let Ci=Si,wi;t[267]===Symbol.for(`react.memo_cache_sentinel`)?(wi=function(e){let t=e.relatedTarget;t instanceof Node&&e.currentTarget.contains(t)||rt(!1)},t[267]=wi):wi=t[267];let Ti=wi,Ei;t[268]===gr?Ei=t[269]:(Ei=function(e){if(!Gu(e.nativeEvent))return;let t=zu(e.nativeEvent);t.length!==0&&(e.preventDefault(),e.stopPropagation(),rt(!1),gr(t,``,iY))},t[268]=gr,t[269]=Ei);let Di=Ei;if(j){let e;return t[270]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(uX,{}),t[270]=e):e=t[270],e}let Oi;t[271]!==i||t[272]!==F||t[273]!==L?(Oi=F?i(L?{id:`H-vDm3`}:{id:`09Tv5j`}):null,t[271]=i,t[272]=F,t[273]=L,t[274]=Oi):Oi=t[274];let ki=Oi;if(k.length===0){if(ki!==null){let e;return t[275]===ki?e=t[276]:(e=(0,Z.jsx)(`div`,{className:`flex flex-1 items-center justify-center py-8`,children:(0,Z.jsx)(`span`,{role:`status`,className:`select-none text-sidebar-foreground/50 text-sm`,children:ki})}),t[275]=ki,t[276]=e),e}if(N){let e;return t[277]===N?e=t[278]:(e=(0,Z.jsx)(`div`,{className:`flex flex-1 items-center justify-center py-8`,children:(0,Z.jsx)(`span`,{role:`alert`,className:`select-none text-sidebar-foreground/50 text-sm`,children:N})}),t[277]=N,t[278]=e),e}let e;t[279]===i?e=t[280]:(e=i({id:`5ZB7XC`}),t[279]=i,t[280]=e);let n=nt&&`bg-primary/5 ring-2 ring-primary/70 ring-inset`,r;t[281]===n?r=t[282]:(r=X(`flex flex-1 flex-col items-center justify-center gap-3 rounded-md py-8`,n),t[281]=n,t[282]=r);let a;t[283]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(`span`,{className:`select-none text-sidebar-foreground/30 text-sm`,children:(0,Z.jsx)(J,{id:`xiv-dW`})}),t[283]=a):a=t[283];let o;t[284]===br?o=t[285]:(o=()=>br(`file`,``),t[284]=br,t[285]=o);let s;t[286]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(J,{id:`6ibbCg`}),t[286]=s):s=t[286];let c;t[287]===o?c=t[288]:(c=(0,Z.jsx)(Jr,{variant:`link`,size:`sm`,className:`font-mono uppercase`,onClick:o,children:s}),t[287]=o,t[288]=c);let l;return t[289]!==Di||t[290]!==e||t[291]!==r||t[292]!==c?(l=(0,Z.jsxs)(`section`,{"aria-label":e,className:r,onDragOver:Ci,onDragLeave:Ti,onDrop:Di,children:[a,c]}),t[289]=Di,t[290]=e,t[291]=r,t[292]=c,t[293]=l):l=t[293],l}let Ai=V!==null,ji=U?.targets[0]??null,Mi=null;if(z!==null){let e;if(t[294]!==a.locale||t[295]!==z){let n=new Intl.NumberFormat(a.locale).format(z);e=Gc._({id:`LuoJWu`,values:{truncatedShownCount:z,formattedCount:n}}),t[294]=a.locale,t[295]=z,t[296]=e}else e=t[296];Mi=e}let Ni;t[297]!==N||t[298]!==ki||t[299]!==Mi?(Ni=(N||ki!==null||Mi!==null)&&(0,Z.jsxs)(Z.Fragment,{children:[ki===null?N&&(0,Z.jsx)(fX,{kind:`error`,children:N}):(0,Z.jsx)(fX,{kind:`reconnecting`,children:ki}),Mi!==null&&(0,Z.jsx)(fX,{kind:`info`,children:Mi})]}),t[297]=N,t[298]=ki,t[299]=Mi,t[300]=Ni):Ni=t[300];let Pi;t[301]===y?Pi=t[302]:(Pi=mq(y),t[301]=y,t[302]=Pi);let Fi=q?``:void 0,Ii;t[303]===Fi?Ii=t[304]:(Ii={[sY]:Fi},t[303]=Fi,t[304]=Ii);let Li;t[305]!==Ai||t[306]!==ye||t[307]!==wr||t[308]!==k||t[309]!==Sr||t[310]!==Qt||t[311]!==wn||t[312]!==jt||t[313]!==Pt||t[314]!==Y||t[315]!==Mt||t[316]!==Nt||t[317]!==br||t[318]!==re?(Li=(e,t)=>(0,Z.jsx)(TY,{item:e,context:t,anyActionBusy:Ai,workspace:re,handoff:jt,model:Y,okignoreBinding:Mt,projectLocalBinding:Nt,mergedConfig:Pt,onStartCreating:br,onCreateFromTemplate:(e,t)=>br(`file`,e,{template:t}),onDuplicate:wn,onDelete:e=>W({targets:e}),onExpandSubtree:Sr,onCollapseSubtree:wr,folderTreePaths:Qt,isAsset:ye.has(e.path),documents:k}),t[305]=Ai,t[306]=ye,t[307]=wr,t[308]=k,t[309]=Sr,t[310]=Qt,t[311]=wn,t[312]=jt,t[313]=Pt,t[314]=Y,t[315]=Mt,t[316]=Nt,t[317]=br,t[318]=re,t[319]=Li):Li=t[319];let Ri;t[320]!==xi||t[321]!==yi||t[322]!==Y||t[323]!==Ni||t[324]!==Pi||t[325]!==Ii||t[326]!==Li?(Ri=(0,Z.jsx)(`div`,{ref:Xe,className:`flex min-h-0 flex-1 flex-col`,children:(0,Z.jsx)(cq,{header:Ni,model:Y,style:Pi,...Ii,onClickCapture:xi,onMouseMove:yi,onMouseLeave:hi,renderContextMenu:Li})}),t[320]=xi,t[321]=yi,t[322]=Y,t[323]=Ni,t[324]=Pi,t[325]=Ii,t[326]=Li,t[327]=Ri):Ri=t[327];let zi=!!U,Bi;t[328]===V?Bi=t[329]:(Bi=e=>{!e&&!V&&W(null)},t[328]=V,t[329]=Bi);let Vi;t[330]!==i||t[331]!==V||t[332]!==U||t[333]!==ti||t[334]!==ji?(Vi=U&&ji&&(0,Z.jsx)(xa,{...(()=>{let e=Jq(typeof window<`u`&&window.okDesktop!=null?`electron`:`web`,U.targets);if(e)return{customTitle:e.title,customDescription:``,customDetail:e.detail,customConfirmLabel:e.confirmLabel,customConfirmLabelBusy:e.confirmLabelBusy,children:e.listedTargets?(0,Z.jsx)(`ul`,{className:`flex flex-col gap-1 font-mono text-foreground text-xs`,children:e.listedTargets.map(jY)}):null};let t=U.targets.length,n=ji.name;return{itemName:t===1?ji.kind===`folder`?`${ji.name}/`:ji.kind===`file`?`${ji.name}${ji.docExt??`.md`}`:ji.name:void 0,customTitle:t>1?i({id:`abiHje`}):void 0,customDescription:t>1?i({id:`WMIKXK`,values:{targetCount:t}}):ji.kind===`folder`?i({id:`a5W0q0`,values:{folderName:n}}):void 0}})(),isSubmitting:V!==null,onDelete:()=>ti(U.targets)}),t[330]=i,t[331]=V,t[332]=U,t[333]=ti,t[334]=ji,t[335]=Vi):Vi=t[335];let Hi;t[336]!==zi||t[337]!==Bi||t[338]!==Vi?(Hi=(0,Z.jsx)(zs,{open:zi,onOpenChange:Bi,children:Vi}),t[336]=zi,t[337]=Bi,t[338]=Vi,t[339]=Hi):Hi=t[339];let Ui=!!G,Wi;t[340]===V?Wi=t[341]:(Wi=e=>{!e&&!V&&K(null)},t[340]=V,t[341]=Wi);let Gi;t[342]!==V||t[343]!==ri||t[344]!==ai||t[345]!==G?(Gi=G&&(0,Z.jsx)(nJ,{failedTargets:G.failed,isSubmitting:V!==null,onDeletePermanently:ri,onRetry:ai,onCancel:()=>K(null)}),t[342]=V,t[343]=ri,t[344]=ai,t[345]=G,t[346]=Gi):Gi=t[346];let Ki;t[347]!==Ui||t[348]!==Wi||t[349]!==Gi?(Ki=(0,Z.jsx)(zs,{open:Ui,onOpenChange:Wi,children:Gi}),t[347]=Ui,t[348]=Wi,t[349]=Gi,t[350]=Ki):Ki=t[350];let qi=te!==null,Ji;t[351]===Symbol.for(`react.memo_cache_sentinel`)?(Ji=e=>{e||ne(null)},t[351]=Ji):Ji=t[351];let Yi=te?.parentDir??``,Xi;t[352]!==qi||t[353]!==Yi?(Xi=(0,Z.jsx)(xh,{open:qi,onOpenChange:Ji,kind:`file`,initialDir:Yi,defaultToTemplate:!0}),t[352]=qi,t[353]=Yi,t[354]=Xi):Xi=t[354];let Zi;return t[355]!==Ri||t[356]!==Hi||t[357]!==Ki||t[358]!==Xi?(Zi=(0,Z.jsxs)(Z.Fragment,{children:[Ri,Hi,Ki,Xi]}),t[355]=Ri,t[356]=Hi,t[357]=Ki,t[358]=Xi,t[359]=Zi):Zi=t[359],Zi}function jY(e){return(0,Z.jsx)(`li`,{"data-testid":`delete-target-row`,children:Yq(e)},`${e.kind}:${e.path}`)}function MY(e){return`${e.kind}:${e.path}`}function NY(e){return`${e.kind}:${e.path}`}function PY(e){return e.path}function FY(e){return e.kind===`folder`}function IY(e){return e.path}function LY(e){return e.kind===`file`}function RY(e){return e.file}function zY(e){return Oe(e)}function BY(e){return st(e)}function VY(e){return pt(e)}function HY(e){return e.path}function UY(e){return e.kind===`asset`}function WY(e){return e.endsWith(`/`)?e.slice(0,-1):e}function GY(e){return!!e}function KY(e){console.warn(`[FileTree] /api/workspace fetch failed:`,e)}function qY(e){console.warn(`[FileTree] unmount cleanup failed:`,e)}function JY(e){hs.error(e)}function YY(){}function XY(e){return hs.error(e)}function ZY(){}function QY(){}function $Y(){}function eX(){}function tX(){}async function nX(){}function rX(e){return Ru(e)}function iX(e){return aX(e)?.dataset.itemPath??null}function aX(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.dataset.itemPath)return t;return null}function oX(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.matches(`[data-file-tree-virtualized-root]`))return t;return null}function sX(e){let t=aX(e);if(t){let e=t.dataset.itemPath;if(!e)return null;let n=t.dataset.itemType===`folder`,r=Bu(e,n);return{parentDir:r,row:t,root:null,busyPath:n?Ju(r):e}}return cX(e)?{parentDir:``,row:null,root:oX(e),busyPath:iY}:null}function cX(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.matches(`[data-file-tree-virtualized-scroll]`))return!0;return!1}var lX=[`w-3/4`,`w-2/3`,`w-4/5`,`w-1/2`,`w-3/5`,`w-2/3`];function uX(){let e=(0,$.c)(5),{_:t}=kt(),n;e[0]===t?n=e[1]:(n=t({id:`5Tk8Fb`}),e[0]=t,e[1]=n);let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=lX.map(dX),e[2]=r):r=e[2];let i;return e[3]===n?i=e[4]:(i=(0,Z.jsx)(`div`,{className:`flex flex-1 flex-col gap-1 px-2 py-2`,role:`status`,"aria-busy":`true`,"aria-label":n,children:r}),e[3]=n,e[4]=i),i}function dX(e,t){return(0,Z.jsxs)(`div`,{className:`flex h-6 items-center gap-2`,children:[(0,Z.jsx)(Ka,{className:`h-3 w-3 shrink-0 rounded-sm`}),(0,Z.jsx)(Ka,{className:`h-3 ${e}`})]},t)}function fX(e){let t=(0,$.c)(14),{kind:n,children:r}=e,i=n===`error`?os:n===`reconnecting`?is:ts,a=n===`error`?`alert`:`status`,o=n===`error`?`text-destructive`:`text-muted-foreground`,s;t[0]===o?s=t[1]:(s=X(`mx-2 mb-1 flex items-start gap-1.5 rounded-md bg-muted/50 px-2 py-1.5 text-xs leading-snug`,o),t[0]=o,t[1]=s);let c=n===`reconnecting`&&`animate-spin motion-reduce:animate-none`,l;t[2]===c?l=t[3]:(l=X(`mt-0.5 size-3.5 shrink-0`,c),t[2]=c,t[3]=l);let u;t[4]!==i||t[5]!==l?(u=(0,Z.jsx)(i,{"aria-hidden":`true`,className:l}),t[4]=i,t[5]=l,t[6]=u):u=t[6];let d;t[7]===r?d=t[8]:(d=(0,Z.jsx)(`span`,{className:`min-w-0`,children:r}),t[7]=r,t[8]=d);let f;return t[9]!==a||t[10]!==s||t[11]!==u||t[12]!==d?(f=(0,Z.jsxs)(`span`,{role:a,className:s,children:[u,d]}),t[9]=a,t[10]=s,t[11]=u,t[12]=d,t[13]=f):f=t[13],f}function pX(e){return e?Gc._({id:`wTcjov`}):null}function mX(e){let t=(0,$.c)(23),{_:n}=kt(),r=Po(),i=Ta();if(r)return null;let{input:a,installStates:o,dispatch:s}=e,c=a===null,l,u,d,f,p,m;if(t[0]!==n||t[1]!==s||t[2]!==a||t[3]!==c||t[4]!==o||t[5]!==i){m=Symbol.for(`react.early_return_sentinel`);bb0:{let e=pX(c),r;t[12]===o?r=t[13]:(r=e=>o[e.id]?.installed===!0,t[12]=o,t[13]=r);let h=ca.filter(r),g=h.length>0,_=i!==null;if(!g&&!_){m=null;break bb0}u=pP,t[14]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsxs)(gP,{children:[(0,Z.jsx)(jo,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`O7_W_a`})]}),t[14]=p):p=t[14],l=_P,d=_?(0,Z.jsxs)(fP,{"aria-label":n({id:`ALhMYW`}),children:[(0,Z.jsx)(yP,{children:(0,Z.jsx)(J,{id:`ALhMYW`})}),wa.map(t=>{let{displayName:r}=zr[t];return(0,Z.jsxs)(hP,{onSelect:()=>{a!==null&&i.launchInTerminal(a,t)},disabled:c,"data-testid":`empty-space-open-in-terminal-${t}`,"aria-label":n(e?{id:`AIn2Yv`,values:{displayName:r,hint:e}}:{id:`QYfQdv`,values:{displayName:r}}),children:[(0,Z.jsx)(ma,{id:pa(t),"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:r}),e?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t)})]}):null,f=g?(0,Z.jsxs)(Z.Fragment,{children:[_?(0,Z.jsx)(bP,{}):null,(0,Z.jsxs)(fP,{"aria-label":n({id:`BBqGS9`}),children:[(0,Z.jsx)(yP,{children:(0,Z.jsx)(J,{id:`BBqGS9`})}),h.map(t=>{let r=!c,{displayName:i}=t,o=n(e?{id:`1ZpfyB`,values:{displayName:i,hint:e}}:{id:`WqLq6M`,values:{displayName:i}});return(0,Z.jsxs)(hP,{disabled:!r,onSelect:()=>{a&&s(t.id,a)},"data-testid":`empty-space-open-in-${t.id}`,"aria-label":o,children:[(0,Z.jsx)(ma,{id:t.id,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:t.displayName}),e?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t.id)})]})]}):null}t[0]=n,t[1]=s,t[2]=a,t[3]=c,t[4]=o,t[5]=i,t[6]=l,t[7]=u,t[8]=d,t[9]=f,t[10]=p,t[11]=m}else l=t[6],u=t[7],d=t[8],f=t[9],p=t[10],m=t[11];if(m!==Symbol.for(`react.early_return_sentinel`))return m;let h;t[15]!==l||t[16]!==d||t[17]!==f?(h=(0,Z.jsxs)(l,{children:[d,f]}),t[15]=l,t[16]=d,t[17]=f,t[18]=h):h=t[18];let g;return t[19]!==u||t[20]!==p||t[21]!==h?(g=(0,Z.jsxs)(u,{children:[p,h]}),t[19]=u,t[20]=p,t[21]=h,t[22]=g):g=t[22],g}async function hX(e){try{let t=await e.project.listRecent(),n=e.config.projectPath;if(t.some(e=>e.path!==n))return null;let r=await lT();return e.config.freshlyCreated?r:r===0?0:null}catch(e){return console.warn(`[onboarding-card-visible] fresh-project probe failed; suppressing card`,e),null}}function gX(e){let t=(0,$.c)(4),n=e===void 0?aT:e,{initialized:r,dismissed:i,completed:a}=(0,Q.useSyncExternalStore)(n.subscribe,n.getSnapshot,n.getSnapshot),o=i||a,s=!r&&!o,c,l;return t[0]!==s||t[1]!==n?(c=()=>{if(!s)return;let e=window.okDesktop;if(e==null)return;let t=!1;return hX(e).then(e=>{!t&&e!==null&&n.activate(e)}),()=>{t=!0}},l=[s,n],t[0]=s,t[1]=n,t[2]=c,t[3]=l):(c=t[2],l=t[3]),(0,Q.useEffect)(c,l),r&&!o}function _X(e){let t=(0,$.c)(3),n=e===void 0?aT:e,r,i;t[0]===n?(r=t[1],i=t[2]):(r=()=>{if(n.getSnapshot().steps.file)return;let e=dl(e=>{e.includes(`files`)&&uT(n)});return uT(n),e},i=[n],t[0]=n,t[1]=r,t[2]=i),(0,Q.useEffect)(r,i)}var vX=3,yX=5200,bX=1500,xX=220;function SX(e){let t=(0,$.c)(14),{complete:n,label:r,shortcutId:i}=e,a;t[0]===n?a=t[1]:(a=(0,Z.jsx)(Bs,{checked:n,disabled:!0,"aria-hidden":!0,tabIndex:-1,className:`pointer-events-none opacity-100 disabled:opacity-100`}),t[0]=n,t[1]=a);let o=n?`flex-1 text-muted-foreground/60`:`flex-1`,s;t[2]===n?s=t[3]:(s=n?(0,Z.jsxs)(`span`,{className:`sr-only`,children:[(0,Z.jsx)(J,{id:`Qj4RL5`}),` `]}):null,t[2]=n,t[3]=s);let c;t[4]!==r||t[5]!==o||t[6]!==s?(c=(0,Z.jsxs)(`span`,{className:o,children:[s,r]}),t[4]=r,t[5]=o,t[6]=s,t[7]=c):c=t[7];let l;t[8]===i?l=t[9]:(l=i?(0,Z.jsx)(M,{children:Al(i)}):null,t[8]=i,t[9]=l);let u;return t[10]!==a||t[11]!==c||t[12]!==l?(u=(0,Z.jsxs)(`li`,{className:`flex items-center gap-2 py-0.5 text-sm`,children:[a,c,l]}),t[10]=a,t[11]=c,t[12]=l,t[13]=u):u=t[13],u}function CX(e){let t=(0,$.c)(24),{store:n,lingerMs:r}=e,i=n===void 0?aT:n,a=r===void 0?yX:r,{_:o}=kt(),{steps:s}=oT(i);_X(i);let[c,l]=(0,Q.useState)(0),[u,d]=(0,Q.useState)(!1),f=1+ +!!s.file+ +!!s.askedAi,p=f===vX,m,h;t[0]!==p||t[1]!==a?(m=()=>{if(!p)return;l(TX);let e=setInterval(()=>l(wX),bX),t=setTimeout(()=>{clearInterval(e),d(!0)},a);return()=>{clearInterval(e),clearTimeout(t)}},h=[p,a],t[0]=p,t[1]=a,t[2]=m,t[3]=h):(m=t[2],h=t[3]),(0,Q.useEffect)(m,h);let g,_;t[4]!==u||t[5]!==i?(g=()=>{if(!u)return;let e=setTimeout(()=>i.markCompleted(),xX);return()=>clearTimeout(e)},_=[u,i],t[4]=u,t[5]=i,t[6]=g,t[7]=_):(g=t[6],_=t[7]),(0,Q.useEffect)(g,_);let v;t[8]!==o||t[9]!==p?(v=p?o({id:`7jIIFX`}):``,t[8]=o,t[9]=p,t[10]=v):v=t[10];let y;t[11]===v?y=t[12]:(y=(0,Z.jsx)(`div`,{className:`sr-only`,role:`status`,"aria-live":`polite`,children:v}),t[11]=v,t[12]=y);let b;t[13]!==p||t[14]!==c||t[15]!==f||t[16]!==u||t[17]!==s.askedAi||t[18]!==s.file||t[19]!==i?(b=p?(0,Z.jsxs)(`section`,{"aria-hidden":!0,className:X(`mx-2 mb-1 flex items-center gap-3 rounded-lg border bg-card px-4 py-3 text-card-foreground`,`motion-reduce:animate-none motion-reduce:duration-0`,u?`animate-out fade-out-0 zoom-out-95 fill-mode-forwards duration-200`:`animate-in fade-in-0 zoom-in-95 duration-300`),children:[(0,Z.jsx)(DS,{size:36,celebrateSignal:c}),(0,Z.jsx)(`span`,{className:`font-medium text-sm`,children:(0,Z.jsx)(J,{id:`7jIIFX`})})]}):(0,Z.jsxs)(`section`,{"aria-labelledby":`onboarding-card-heading`,className:`mx-2 mb-1 rounded-lg border bg-card px-4 py-3 text-card-foreground`,children:[(0,Z.jsxs)(`header`,{className:`mb-3 flex items-center justify-between`,children:[(0,Z.jsx)(`h2`,{id:`onboarding-card-heading`,className:`font-medium text-sm`,children:(0,Z.jsx)(J,{id:`Y1QMlM`})}),(0,Z.jsx)(`span`,{className:`text-muted-foreground/60 text-xs tabular-nums`,children:`${f} / ${vX}`})]}),(0,Z.jsxs)(`ul`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(SX,{complete:!0,label:(0,Z.jsx)(J,{id:`4E9jPa`})}),(0,Z.jsx)(SX,{complete:s.file,label:(0,Z.jsx)(J,{id:`6ibbCg`}),shortcutId:`new-item`}),(0,Z.jsx)(SX,{complete:s.askedAi,label:(0,Z.jsx)(J,{id:`xWEvuo`}),shortcutId:`open-ask-ai`})]}),(0,Z.jsx)(`footer`,{className:`-mb-1 mt-2 flex justify-end`,children:(0,Z.jsx)(Jr,{type:`button`,variant:`ghost`,size:`sm`,className:`h-auto px-2 py-1 text-muted-foreground text-xs`,onClick:()=>i.dismiss(),children:(0,Z.jsx)(J,{id:`1QfxQT`})})})]}),t[13]=p,t[14]=c,t[15]=f,t[16]=u,t[17]=s.askedAi,t[18]=s.file,t[19]=i,t[20]=b):b=t[20];let x;return t[21]!==y||t[22]!==b?(x=(0,Z.jsxs)(Z.Fragment,{children:[y,b]}),t[21]=y,t[22]=b,t[23]=x):x=t[23],x}function wX(e){return e+1}function TX(e){return e+1}function EX(){let e=(0,$.c)(1);if(!gX())return null;let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(CX,{}),e[0]=t):t=e[0],t}function DX(e){return e===null?null:e.kind===`local`?e.name:e.ref}function OX(e,t){if(e.length===0)return null;let n=`origin/${e}`;return t.includes(n)?n:t.find(t=>Rr(t)===e)??null}function kX(e){switch(e){case`branch-exists`:return{id:`wzq9Rv`};case`already-checked-out`:return{id:`ljHjfg`};case`path-exists`:return{id:`mYzDD_`};case`invalid-branch`:return{id:`r-OJYm`};case`no-git`:return{id:`CFnavk`};default:return{id:`-zA2E7`}}}function AX(e){let t=(0,$.c)(71),{open:n,onOpenChange:r,bridge:i,currentBranch:a,branches:o,existingWorktreeBranches:s,remoteBranches:c,behindByBranch:l,initialBranchName:u}=e,d=o===void 0?[]:o,f=c===void 0?[]:c,p=u===void 0?``:u,{_:m}=kt(),h=(0,Q.useId)(),g=(0,Q.useId)(),_=(0,Q.useId)(),v=(0,Q.useId)(),y=(0,Q.useId)(),b=(0,Q.useId)(),[x,S]=(0,Q.useState)(``),C;t[0]===a?C=t[1]:(C=a===null?null:{kind:`local`,name:a},t[0]=a,t[1]=C);let[w,T]=(0,Q.useState)(C),[E,D]=(0,Q.useState)(!1),[O,k]=(0,Q.useState)(``),[A,j]=(0,Q.useState)(!1),[M,N]=(0,Q.useState)(null),P=(0,Q.useRef)(null),F=(0,Q.useRef)(null),I,L;t[2]!==a||t[3]!==p||t[4]!==n?(I=()=>{if(!n)return;S(p),T(a===null?null:{kind:`local`,name:a}),D(!1),k(``),j(!1),N(null);let e=requestAnimationFrame(()=>P.current?.focus());return()=>cancelAnimationFrame(e)},L=[n,a,p],t[2]=a,t[3]=p,t[4]=n,t[5]=I,t[6]=L):(I=t[5],L=t[6]),(0,Q.useEffect)(I,L);let R=x.trim(),z=!A&&R.length>0,B=R.length>0&&d.includes(R),V=B?null:OX(R,f),H=V!==null,U=B||H,W=B&&(s?.has(R)??!1),G=d.filter(e=>e.toLowerCase().startsWith(R.toLowerCase())),K=!A&&G.length>0&&!U,ee=(a!==null&&!d.includes(a)?[a,...d]:d).map(FX),te=f.map(PX),ne=DX(w),re=O.trim().toLowerCase(),q=re===``?ee:ee.filter(e=>e.name.toLowerCase().includes(re)),oe=re===``?te:te.filter(e=>e.ref.toLowerCase().includes(re)),ce=re!==``&&q.length===0&&oe.length===0,le=async function(e){if(e.preventDefault(),z){j(!0),N(null);try{let e=H?{branch:R,createBranch:!0,remoteRef:V}:B?{branch:R,createBranch:!1}:{branch:R,createBranch:!0,baseBranch:w?.kind===`local`?w.name:void 0,baseRef:w?.kind===`remote`?w.ref:void 0},t=await i.worktree.create(e);if(!t.ok){N(kX(t.reason)),j(!1);return}cg(),r(!1),await i.project.open({path:t.path,target:`new-window`,entryPoint:`worktree`})}catch(e){console.warn(`[NewWorktreeDialog] worktree create/open failed:`,e),hs.error(m({id:`vAYoCZ`})),j(!1)}}},ue=zs,de;t[7]!==A||t[8]!==r?(de=e=>{A||r(e)},t[7]=A,t[8]=r,t[9]=de):de=t[9];let fe=Fs,pe;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(pe=(0,Z.jsx)(Ps,{children:(0,Z.jsx)(J,{id:`DXd9LM`})}),t[10]=pe):pe=t[10];let me;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,Z.jsxs)(Rs,{children:[pe,(0,Z.jsx)(Ns,{children:(0,Z.jsx)(J,{id:`NEzPEh`})})]}),t[11]=me):me=t[11];let he=Is,ge;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,Z.jsx)(J,{id:`ng2Ibo`}),t[12]=ge):ge=t[12];let _e;t[13]===g?_e=t[14]:(_e=(0,Z.jsx)(Nc,{htmlFor:g,children:ge}),t[13]=g,t[14]=_e);let ve;t[15]===m?ve=t[16]:(ve=m({id:`IX_uXB`}),t[15]=m,t[16]=ve);let ye;t[17]===M?ye=t[18]:(ye=e=>{S(e.target.value),M!==null&&N(null)},t[17]=M,t[18]=ye);let be=M!==null,xe=M===null?y:`${y} ${b}`,Se;t[19]!==x||t[20]!==A||t[21]!==g||t[22]!==ve||t[23]!==ye||t[24]!==be||t[25]!==xe?(Se=(0,Z.jsx)(Uc,{id:g,ref:P,value:x,placeholder:ve,onChange:ye,disabled:A,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-invalid":be,"aria-describedby":xe,"data-testid":`new-worktree-branch`}),t[19]=x,t[20]=A,t[21]=g,t[22]=ve,t[23]=ye,t[24]=be,t[25]=xe,t[26]=Se):Se=t[26];let Ce=R.length>0?(0,Z.jsxs)(`p`,{id:y,className:`flex items-start gap-1.5 text-1sm text-muted-foreground`,"data-testid":W?`new-worktree-mode-existing-worktree`:H?`new-worktree-mode-remote-checkout`:B?`new-worktree-mode-checkout`:`new-worktree-mode-create`,children:[W?(0,Z.jsx)(Ro,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-amber-600 dark:text-amber-400`}):H?(0,Z.jsx)(io,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-violet-600 dark:text-violet-400`}):B?(0,Z.jsx)($i,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-blue-600 dark:text-blue-400`}):(0,Z.jsx)(nt,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-green-600 dark:text-green-400`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1`,children:W?(0,Z.jsx)(J,{id:`QAi7Q9`,values:{trimmed:R},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-words`})}}):H?(0,Z.jsx)(J,{id:`oAGN8p`,values:{remoteCheckoutRef:V,trimmed:R},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-words`}),1:(0,Z.jsx)(`code`,{className:`font-mono break-words`}),2:(0,Z.jsx)(`code`,{className:`font-mono`})}}):B?(0,Z.jsx)(J,{id:`b4VvP-`,values:{trimmed:R},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-words`}),1:(0,Z.jsx)(`code`,{className:`font-mono`})}}):ne===null?(0,Z.jsx)(J,{id:`t4sFKC`,values:{trimmed:R},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-words`}),1:(0,Z.jsx)(`code`,{className:`font-mono`})}}):(0,Z.jsx)(J,{id:`dGAdpH`,values:{trimmed:R,currentBaseLabel:ne},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-words`}),1:(0,Z.jsx)(`code`,{className:`font-mono break-words`}),2:(0,Z.jsx)(`code`,{className:`font-mono`})}})})]}):null,we=K?(0,Z.jsx)(`div`,{className:`max-h-40 overflow-y-auto rounded-md border bg-popover p-1 shadow-xs`,"data-testid":`new-worktree-branch-list`,children:G.map(e=>(0,Z.jsxs)(Jr,{type:`button`,variant:`ghost`,size:`sm`,tabIndex:-1,onClick:()=>{S(e),M!==null&&N(null),P.current?.focus()},"data-testid":`new-worktree-branch-option-${e}`,className:`h-8 w-full justify-start gap-2 font-normal`,children:[(0,Z.jsx)(zo,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left`,children:e})]},e))}):null,Ee=U?null:(0,Z.jsxs)(`div`,{className:`mt-1 flex flex-col gap-2`,children:[(0,Z.jsx)(Nc,{id:v,htmlFor:_,children:(0,Z.jsx)(J,{id:`ZWwYwM`})}),(0,Z.jsxs)(ae,{open:E,onOpenChange:e=>{D(e),e||k(``)},children:[(0,Z.jsx)(se,{asChild:!0,children:(0,Z.jsxs)(Jr,{id:_,type:`button`,variant:`outline`,role:`combobox`,"aria-expanded":E,"aria-haspopup":`listbox`,"aria-labelledby":`${v} ${_}`,"aria-label":m({id:`ZWwYwM`}),disabled:A,"data-testid":`new-worktree-base-trigger`,className:`w-full justify-between font-normal`,children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[w?.kind===`remote`?(0,Z.jsx)(io,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}):(0,Z.jsx)(zo,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate text-left`,children:ne===null?(0,Z.jsx)(J,{id:`EbjWsS`}):ne})]}),(0,Z.jsx)(jd,{"aria-hidden":`true`,className:`ml-2 size-4 shrink-0 opacity-50`})]})}),(0,Z.jsxs)(ie,{align:`start`,className:`w-[var(--radix-popover-trigger-width)] p-1`,onWheel:NX,onTouchMove:MX,onOpenAutoFocus:e=>{e.preventDefault(),F.current?.focus()},children:[(0,Z.jsxs)(ZC,{className:`mb-1 h-8`,children:[(0,Z.jsx)(nw,{ref:F,"aria-label":m({id:`fuJZKk`}),placeholder:m({id:`hQXiDc`}),value:O,onChange:e=>k(e.target.value),onKeyDown:jX,"data-testid":`new-worktree-base-search`}),(0,Z.jsx)($C,{children:(0,Z.jsx)(Te,{"aria-hidden":`true`})})]}),(0,Z.jsxs)(`div`,{role:`listbox`,"aria-label":m({id:`ZWwYwM`}),className:`max-h-56 overflow-y-auto`,"data-testid":`new-worktree-base-list`,children:[ce?(0,Z.jsx)(`p`,{className:`px-2 py-1.5 text-1sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`Sh3Qkg`})}):null,q.map(e=>{let t=e.name,n=l?.get(t);return(0,Z.jsxs)(Jr,{type:`button`,role:`option`,"aria-selected":w?.kind===`local`&&w.name===t,variant:`ghost`,size:`sm`,onClick:()=>{T(e),D(!1),k(``)},"data-testid":`new-worktree-base-option-${t}`,className:`h-8 w-full justify-start gap-2 font-normal`,children:[(0,Z.jsx)(zo,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left`,children:t}),n!==void 0&&n>0?(0,Z.jsx)(`span`,{className:`shrink-0 text-xs text-amber-600 dark:text-amber-400`,"data-testid":`new-worktree-base-behind-${t}`,children:(0,Z.jsx)(J,{id:`6-wLTJ`,values:{behind:n}})}):null]},`local:${t}`)}),oe.map(e=>{let t=e.ref;return(0,Z.jsxs)(Jr,{type:`button`,role:`option`,"aria-selected":w?.kind===`remote`&&w.ref===t,variant:`ghost`,size:`sm`,onClick:()=>{T(e),D(!1),k(``)},"data-testid":`new-worktree-base-option-${t}`,className:`h-8 w-full justify-start gap-2 font-normal`,children:[(0,Z.jsx)(io,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left`,children:t}),(0,Z.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:(0,Z.jsx)(J,{id:`dIYSqk`})})]},`remote:${t}`)})]})]})]})]}),De;t[27]!==m||t[28]!==M||t[29]!==b?(De=M===null?null:(0,Z.jsx)(`p`,{id:b,role:`alert`,className:`text-1sm text-destructive`,"data-testid":`new-worktree-error`,children:m(M)}),t[27]=m,t[28]=M,t[29]=b,t[30]=De):De=t[30];let Oe;t[31]!==h||t[32]!==le||t[33]!==_e||t[34]!==Se||t[35]!==Ce||t[36]!==we||t[37]!==Ee||t[38]!==De?(Oe=(0,Z.jsxs)(`form`,{id:h,onSubmit:le,className:`flex flex-col gap-2`,children:[_e,Se,Ce,we,Ee,De]}),t[31]=h,t[32]=le,t[33]=_e,t[34]=Se,t[35]=Ce,t[36]=we,t[37]=Ee,t[38]=De,t[39]=Oe):Oe=t[39];let ke;t[40]!==he||t[41]!==Oe?(ke=(0,Z.jsx)(he,{children:Oe}),t[40]=he,t[41]=Oe,t[42]=ke):ke=t[42];let Ae;t[43]===r?Ae=t[44]:(Ae=()=>r(!1),t[43]=r,t[44]=Ae);let je;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(je=(0,Z.jsx)(J,{id:`dEgA5A`}),t[45]=je):je=t[45];let Me;t[46]!==A||t[47]!==Ae?(Me=(0,Z.jsx)(Jr,{type:`button`,variant:`outline`,onClick:Ae,disabled:A,"data-testid":`new-worktree-cancel`,children:je}),t[46]=A,t[47]=Ae,t[48]=Me):Me=t[48];let Ne=!z,Pe;t[49]!==A||t[50]!==W||t[51]!==B||t[52]!==H?(Pe=A?(0,Z.jsx)(J,{id:`b4itZn`}):W?(0,Z.jsx)(J,{id:`XV5sC0`}):H?(0,Z.jsx)(J,{id:`XAyxsa`}):B?(0,Z.jsx)(J,{id:`uGaIIS`}):(0,Z.jsx)(J,{id:`iO8V-7`}),t[49]=A,t[50]=W,t[51]=B,t[52]=H,t[53]=Pe):Pe=t[53];let Fe;t[54]!==h||t[55]!==Ne||t[56]!==Pe?(Fe=(0,Z.jsx)(Jr,{type:`submit`,form:h,disabled:Ne,"data-testid":`new-worktree-create`,children:Pe}),t[54]=h,t[55]=Ne,t[56]=Pe,t[57]=Fe):Fe=t[57];let Ie;t[58]!==Me||t[59]!==Fe?(Ie=(0,Z.jsxs)(Ls,{children:[Me,Fe]}),t[58]=Me,t[59]=Fe,t[60]=Ie):Ie=t[60];let Le;t[61]!==fe||t[62]!==me||t[63]!==ke||t[64]!==Ie?(Le=(0,Z.jsxs)(fe,{className:`sm:max-w-md`,"data-testid":`new-worktree-dialog`,children:[me,ke,Ie]}),t[61]=fe,t[62]=me,t[63]=ke,t[64]=Ie,t[65]=Le):Le=t[65];let Re;return t[66]!==ue||t[67]!==n||t[68]!==Le||t[69]!==de?(Re=(0,Z.jsx)(ue,{open:n,onOpenChange:de,children:Le}),t[66]=ue,t[67]=n,t[68]=Le,t[69]=de,t[70]=Re):Re=t[70],Re}function jX(e){return e.stopPropagation()}function MX(e){e.stopPropagation()}function NX(e){e.stopPropagation()}function PX(e){return{kind:`remote`,ref:e}}function FX(e){return{kind:`local`,name:e}}function IX(e){let t=(0,$.c)(51),{bridge:n,recents:r,currentPath:i,query:a,worktreeModel:o,closeMenu:s,guardStaleSelect:c,flyoutPath:l,setFlyoutPath:u,openNewWorktreeWith:d}=e,{_:f}=kt(),p;t[0]!==f||t[1]!==n.project||t[2]!==s?(p=function(e,t){s(),n.project.open({path:e,target:`new-window`,entryPoint:t}).catch(e=>{console.warn(`[RecentProjectsMenu] project.open failed:`,e),hs.error(f({id:`6HCOwA`}))})},t[0]=f,t[1]=n.project,t[2]=s,t[3]=p):p=t[3];let m=p,h;t[4]!==f||t[5]!==n.project||t[6]!==n.worktree?(h=async function(e){try{let t=await n.worktree.create({branch:e,createBranch:!1});if(!t.ok){hs.error(f({id:`teD0H9`}));return}cg(),await n.project.open({path:t.path,target:`new-window`,entryPoint:`worktree`})}catch(e){console.warn(`[RecentProjectsMenu] create/open branch failed:`,e),hs.error(f({id:`LwMxXg`}))}},t[4]=f,t[5]=n.project,t[6]=n.worktree,t[7]=h):h=t[7];let g=h,_;t[8]!==s||t[9]!==i||t[10]!==m?(_=function(e){if(e.path===i){s();return}m(e.path,e.isLinkedWorktree?`worktree`:`recents`)},t[8]=s,t[9]=i,t[10]=m,t[11]=_):_=t[11];let v=_,y;t[12]!==s||t[13]!==g||t[14]!==i||t[15]!==m?(y=function(e){if(e.path!==null){if(e.path===i){s();return}m(e.path,e.isMain?`recents`:`worktree`);return}e.branch!==null&&(s(),g(e.branch))},t[12]=s,t[13]=g,t[14]=i,t[15]=m,t[16]=y):y=t[16];let b=y;if(a!==``){let e;t[17]!==s||t[18]!==g?(e=e=>{s(),g(e)},t[17]=s,t[18]=g,t[19]=e):e=t[19];let n;return t[20]!==i||t[21]!==c||t[22]!==v||t[23]!==a||t[24]!==r||t[25]!==e||t[26]!==o?(n=(0,Z.jsx)(VX,{recents:r,currentPath:i,query:a,worktreeModel:o,onPickEntry:v,onPickBranch:e,guardStaleSelect:c}),t[20]=i,t[21]=c,t[22]=v,t[23]=a,t[24]=r,t[25]=e,t[26]=o,t[27]=n):n=t[27],n}let x;if(t[28]!==s||t[29]!==i||t[30]!==l||t[31]!==c||t[32]!==b||t[33]!==d||t[34]!==m||t[35]!==r||t[36]!==u||t[37]!==o){let e=xg(r),n;t[39]!==s||t[40]!==i||t[41]!==l||t[42]!==c||t[43]!==b||t[44]!==d||t[45]!==m||t[46]!==u||t[47]!==o?(n=e=>(0,Z.jsx)(LX,{group:e,currentPath:i,worktreeModel:o,flyoutOpen:l===e.project.path,setFlyoutOpen:t=>u(n=>t?e.project.path:n===e.project.path?null:n),onPickProject:()=>{if(e.project.path===i){s();return}m(e.project.path,`recents`)},onPickFlyoutEntry:b,guardStaleSelect:c,openNewWorktreeWith:d},e.project.path),t[39]=s,t[40]=i,t[41]=l,t[42]=c,t[43]=b,t[44]=d,t[45]=m,t[46]=u,t[47]=o,t[48]=n):n=t[48],x=e.map(n),t[28]=s,t[29]=i,t[30]=l,t[31]=c,t[32]=b,t[33]=d,t[34]=m,t[35]=r,t[36]=u,t[37]=o,t[38]=x}else x=t[38];let S;return t[49]===x?S=t[50]:(S=(0,Z.jsx)(Z.Fragment,{children:x}),t[49]=x,t[50]=S),S}function LX(e){let t=(0,$.c)(34),{group:n,currentPath:r,worktreeModel:i,flyoutOpen:a,setFlyoutOpen:o,onPickProject:s,onPickFlyoutEntry:c,guardStaleSelect:l,openNewWorktreeWith:u}=e,d=n.project.path===r,f,p;t[0]!==r||t[1]!==n||t[2]!==i?(f=vg(n,i,r),p=f.filter(RX),t[0]=r,t[1]=n,t[2]=i,t[3]=f,t[4]=p):(f=t[3],p=t[4]);let m=p.length;if(m===0){let e;t[5]!==l||t[6]!==s?(e=e=>{l(e)||s()},t[5]=l,t[6]=s,t[7]=e):e=t[7];let r=`project-switcher-recent-${n.project.path}`,i=d?`true`:void 0,a;t[8]!==n.project.name||t[9]!==n.project.path||t[10]!==d?(a=(0,Z.jsx)(WX,{name:n.project.name,path:n.project.path,current:d}),t[8]=n.project.name,t[9]=n.project.path,t[10]=d,t[11]=a):a=t[11];let o;return t[12]!==e||t[13]!==r||t[14]!==i||t[15]!==a?(o=(0,Z.jsx)(vc,{onSelect:e,className:`flex w-full min-w-0 flex-col items-start gap-0.5`,"data-testid":r,"data-current":i,children:a}),t[12]=e,t[13]=r,t[14]=i,t[15]=a,t[16]=o):o=t[16],o}let h;t[17]!==r||t[18]!==n.worktrees||t[19]!==d?(h=d||n.worktrees.some(e=>e.path===r),t[17]=r,t[18]=n.worktrees,t[19]=d,t[20]=h):h=t[20];let g=h,_;return t[21]!==g||t[22]!==r||t[23]!==f||t[24]!==a||t[25]!==n||t[26]!==l||t[27]!==c||t[28]!==s||t[29]!==u||t[30]!==m||t[31]!==o||t[32]!==i?(_=(0,Z.jsx)(zX,{group:n,currentPath:r,containsCurrent:g,worktreeModel:i,flyoutEntries:f,openedWorktreeCount:m,flyoutOpen:a,setFlyoutOpen:o,onPickProject:s,onPickFlyoutEntry:c,guardStaleSelect:l,openNewWorktreeWith:u}),t[21]=g,t[22]=r,t[23]=f,t[24]=a,t[25]=n,t[26]=l,t[27]=c,t[28]=s,t[29]=u,t[30]=m,t[31]=o,t[32]=i,t[33]=_):_=t[33],_}function RX(e){return e.opened&&!e.isMain}function zX(e){let t=(0,$.c)(46),{group:n,currentPath:r,containsCurrent:i,worktreeModel:a,flyoutEntries:o,openedWorktreeCount:s,flyoutOpen:c,setFlyoutOpen:l,onPickProject:u,onPickFlyoutEntry:d,guardStaleSelect:f,openNewWorktreeWith:p}=e,{_:m}=kt(),h=n.project.path===r,g;t[0]!==f||t[1]!==u?(g=e=>{f(e)||u()},t[0]=f,t[1]=u,t[2]=g):g=t[2];let _=g,v,y;t[3]===_?(v=t[4],y=t[5]):(v=e=>{e.target.closest(`[data-project-open]`)!==null&&(e.preventDefault(),_(e.nativeEvent))},y=e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),_(e.nativeEvent))},t[3]=_,t[4]=v,t[5]=y);let b=`project-switcher-group-${n.project.path}`,x=c?`true`:void 0,S=i?`true`:void 0,C;t[6]===n.project.name?C=t[7]:(C=(0,Z.jsx)(`span`,{className:`truncate font-medium text-sm`,"data-project-open":``,title:n.project.name,children:n.project.name}),t[6]=n.project.name,t[7]=C);let w;t[8]===n.project.path?w=t[9]:(w=(0,Z.jsx)(`span`,{className:`truncate text-muted-foreground text-xs`,title:n.project.path,children:n.project.path}),t[8]=n.project.path,t[9]=w);let T;t[10]!==C||t[11]!==w?(T=(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[C,w]}),t[10]=C,t[11]=w,t[12]=T):T=t[12];let E;t[13]!==m||t[14]!==h?(E=h?(0,Z.jsx)($i,{"aria-label":m({id:`Hp1l6f`}),className:`mt-0.5 size-3.5 shrink-0 text-muted-foreground`}):null,t[13]=m,t[14]=h,t[15]=E):E=t[15];let D=`project-switcher-toggle-${n.project.path}`,O;t[16]===s?O=t[17]:(O=(0,Z.jsx)(`span`,{className:`tabular-nums`,children:s}),t[16]=s,t[17]=O);let k;t[18]===s?k=t[19]:(k=(0,Z.jsx)(J,{id:`AKxFtn`,values:{openedWorktreeCount:s}}),t[18]=s,t[19]=k);let A;t[20]!==D||t[21]!==O||t[22]!==k?(A=(0,Z.jsxs)(`span`,{className:`mt-0.5 shrink-0 text-muted-foreground text-xs`,"data-testid":D,children:[O,` `,k]}),t[20]=D,t[21]=O,t[22]=k,t[23]=A):A=t[23];let j;t[24]!==E||t[25]!==A||t[26]!==v||t[27]!==y||t[28]!==b||t[29]!==x||t[30]!==S||t[31]!==T?(j=(0,Z.jsxs)(hc,{onClick:v,onKeyDown:y,className:`flex w-full min-w-0 items-start gap-2`,"data-testid":b,"data-flyout-open":x,"data-current":S,children:[T,E,A]}),t[24]=E,t[25]=A,t[26]=v,t[27]=y,t[28]=b,t[29]=x,t[30]=S,t[31]=T,t[32]=j):j=t[32];let M;t[33]!==o||t[34]!==c||t[35]!==n||t[36]!==f||t[37]!==d||t[38]!==p||t[39]!==a?(M=(0,Z.jsx)(BX,{group:n,open:c,worktreeModel:a,entries:o,onPickFlyoutEntry:d,guardStaleSelect:f,openNewWorktreeWith:p}),t[33]=o,t[34]=c,t[35]=n,t[36]=f,t[37]=d,t[38]=p,t[39]=a,t[40]=M):M=t[40];let N;return t[41]!==c||t[42]!==l||t[43]!==j||t[44]!==M?(N=(0,Z.jsxs)(nc,{open:c,onOpenChange:l,children:[j,M]}),t[41]=c,t[42]=l,t[43]=j,t[44]=M,t[45]=N):N=t[45],N}function BX(e){let t=(0,$.c)(15),{group:n,open:r,worktreeModel:i,entries:a,onPickFlyoutEntry:o,guardStaleSelect:s,openNewWorktreeWith:c}=e,{_:l}=kt(),[u,d]=(0,Q.useState)(``),f=(0,Q.useRef)(null),p=(0,Q.useRef)(null),m,h;t[0]===r?(m=t[1],h=t[2]):(m=()=>{r&&f.current?.focus({preventScroll:!0})},h=[r],t[0]=r,t[1]=m,t[2]=h),(0,Q.useEffect)(m,h);let g=function(){let e=p.current;return e===null?[]:[...e.querySelectorAll(`[role="menuitem"]`)]},_=function(e){g()[e]?.focus()},v=function(e,t){if(e.key===`ArrowDown`){e.preventDefault(),e.stopPropagation();let t=g(),n=t.indexOf(e.currentTarget);_(Math.min(n+1,t.length-1))}else if(e.key===`ArrowUp`){e.preventDefault(),e.stopPropagation();let t=g().indexOf(e.currentTarget);t<=0?f.current?.focus():_(t-1)}else e.key===`Enter`&&(e.preventDefault(),e.stopPropagation(),t())},y;if(t[3]!==a||t[4]!==u){let e=u.trim().toLowerCase();y=e===``?a:a.filter(t=>(t.branch??``).toLowerCase().includes(e)),t[3]=a,t[4]=u,t[5]=y}else y=t[5];let b=y,x=i!==null&&i.mainRoot===n.project.mainRoot,S=u.trim(),C=x&&S.length>0,w;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)($C,{align:`inline-start`,children:(0,Z.jsx)(Te,{"aria-hidden":`true`})}),t[6]=w):w=t[6];let T;t[7]===l?T=t[8]:(T=l({id:`bSD4im`}),t[7]=l,t[8]=T);let E;t[9]===l?E=t[10]:(E=l({id:`Skr_7L`}),t[9]=l,t[10]=E);let D;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(D=e=>d(e.target.value),t[11]=D):D=t[11];let O=b.length===0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(kc,{className:`font-normal text-muted-foreground text-xs`,role:`status`,"aria-live":`polite`,children:l({id:`-uaQnI`})}),C?(0,Z.jsxs)(vc,{onSelect:e=>{s(e)||c(S)},onKeyDown:e=>v(e,()=>c(S)),className:`flex items-center gap-2`,"data-testid":`project-switcher-flyout-create`,children:[(0,Z.jsx)(nt,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm`,title:S,children:(0,Z.jsx)(J,{id:`gHSAWT`,values:{typedName:S},components:{0:(0,Z.jsx)(`span`,{className:`font-medium`}),1:(0,Z.jsx)(`span`,{className:`font-mono`})}})})]}):null]}):b.map(e=>{let t=e.path??`branch:${e.branch}`,n=e.branch??l({id:`D12vtS`});return(0,Z.jsxs)(vc,{onSelect:t=>{s(t)||o(e)},onKeyDown:t=>v(t,()=>o(e)),className:`flex items-center gap-2`,"data-testid":`project-switcher-flyout-entry-${t}`,"data-current":e.isCurrent?`true`:void 0,children:[(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm`,title:n,children:n}),e.isMain?(0,Z.jsx)(`span`,{className:`shrink-0 text-muted-foreground text-xs`,children:l({id:`Bn9-El`})}):e.opened?null:(0,Z.jsx)(`span`,{className:`shrink-0 text-muted-foreground text-xs`,title:l({id:`Dvwa0U`}),children:l({id:`nfoduq`})}),e.isCurrent?(0,Z.jsx)(GX,{}):null]},t)}),k;return t[12]!==p||t[13]!==O?(k=(0,Z.jsx)(`div`,{ref:p,className:`min-h-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-contain subtle-scrollbar`,children:O}),t[12]=p,t[13]=O,t[14]=k):k=t[14],(0,Z.jsx)(jc,{children:(0,Z.jsxs)(Ac,{avoidCollisions:!1,sideOffset:-8,className:`flex max-h-80 w-96 flex-col gap-1 overflow-hidden p-1`,"data-testid":`project-switcher-flyout-${n.project.path}`,children:[(0,Z.jsxs)(ZC,{className:`mb-1 h-8 shrink-0`,children:[w,(0,Z.jsx)(nw,{ref:f,"aria-label":T,placeholder:E,value:u,onChange:D,onKeyDown:e=>{e.key===`ArrowDown`&&(e.preventDefault(),_(0)),e.stopPropagation()},"data-testid":`project-switcher-flyout-search-${n.project.path}`})]}),k]})})}function VX(e){let t=(0,$.c)(41),{recents:n,currentPath:r,query:i,worktreeModel:a,onPickEntry:o,onPickBranch:s,guardStaleSelect:c}=e,{_:l}=kt(),u;t[0]===i?u=t[1]:(u=e=>e.toLowerCase().includes(i),t[0]=i,t[1]=u);let d=u,f,p,m,h;if(t[2]!==l||t[3]!==r||t[4]!==c||t[5]!==d||t[6]!==s||t[7]!==o||t[8]!==n||t[9]!==a){h=Symbol.for(`react.early_return_sentinel`);bb0:{let e;t[14]===d?e=t[15]:(e=e=>!e.isLinkedWorktree&&(d(e.name)||d(e.path)),t[14]=d,t[15]=e);let i=n.filter(e),u;t[16]===d?u=t[17]:(u=e=>e.isLinkedWorktree===!0&&(d(e.branch??``)||d(e.path)),t[16]=d,t[17]=u);let g=n.filter(u),_=new Set(g.map(HX)),v;t[18]===a?.entries?v=t[19]:(v=a?.entries??[],t[18]=a?.entries,t[19]=v);let y=v.filter(e=>e.branch!==null&&d(e.branch)&&(e.worktreePath===null||!_.has(e.worktreePath))&&e.worktreePath!==r);if(i.length===0&&g.length===0&&y.length===0){let e;t[20]===l?e=t[21]:(e=l({id:`pEQFsW`}),t[20]=l,t[21]=e);let n;t[22]===e?n=t[23]:(n=(0,Z.jsx)(kc,{className:`font-normal text-muted-foreground text-xs`,role:`status`,"aria-live":`polite`,children:e}),t[22]=e,t[23]=n),h=n;break bb0}let b;t[24]!==r||t[25]!==c||t[26]!==o?(b=e=>(0,Z.jsx)(vc,{onSelect:t=>{c(t)||o(e)},className:`flex w-full min-w-0 flex-col items-start gap-0.5`,"data-testid":`project-switcher-recent-${e.path}`,children:(0,Z.jsx)(WX,{name:e.name,path:e.path,current:e.path===r})},e.path),t[24]=r,t[25]=c,t[26]=o,t[27]=b):b=t[27],f=i.map(b);let x;t[28]!==r||t[29]!==c||t[30]!==o?(x=e=>(0,Z.jsxs)(vc,{onSelect:t=>{c(t)||o(e)},className:`flex items-start gap-2`,"data-testid":`project-switcher-worktree-${e.path}`,"data-current":e.path===r?`true`:void 0,children:[(0,Z.jsx)(zo,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0`}),(0,Z.jsx)(UX,{branch:e.branch??e.name,project:e.mainRoot===void 0?null:bg(e.mainRoot)})]},e.path),t[28]=r,t[29]=c,t[30]=o,t[31]=x):x=t[31],p=g.map(x);let S;t[32]!==l||t[33]!==c||t[34]!==s||t[35]!==a?(S=e=>(0,Z.jsxs)(vc,{onSelect:t=>{c(t)||e.branch!==null&&s(e.branch)},className:`flex items-start gap-2`,"data-testid":`project-switcher-branch-${e.branch}`,children:[(0,Z.jsx)(zo,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 opacity-40`}),(0,Z.jsx)(UX,{branch:e.branch??``,project:a===null?null:bg(a.mainRoot),hint:l({id:`nfoduq`})})]},`branch:${e.branch}`),t[32]=l,t[33]=c,t[34]=s,t[35]=a,t[36]=S):S=t[36],m=y.map(S)}t[2]=l,t[3]=r,t[4]=c,t[5]=d,t[6]=s,t[7]=o,t[8]=n,t[9]=a,t[10]=f,t[11]=p,t[12]=m,t[13]=h}else f=t[10],p=t[11],m=t[12],h=t[13];if(h!==Symbol.for(`react.early_return_sentinel`))return h;let g;return t[37]!==f||t[38]!==p||t[39]!==m?(g=(0,Z.jsxs)(Z.Fragment,{children:[f,p,m]}),t[37]=f,t[38]=p,t[39]=m,t[40]=g):g=t[40],g}function HX(e){return e.path}function UX(e){let t=(0,$.c)(12),{branch:n,project:r,hint:i}=e,a;t[0]===n?a=t[1]:(a=(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm`,children:n}),t[0]=n,t[1]=a);let o;t[2]===i?o=t[3]:(o=i===void 0?null:(0,Z.jsx)(`span`,{className:`shrink-0 text-muted-foreground text-xs`,children:i}),t[2]=i,t[3]=o);let s;t[4]!==a||t[5]!==o?(s=(0,Z.jsxs)(`span`,{className:`flex w-full min-w-0 items-center gap-1.5`,children:[a,o]}),t[4]=a,t[5]=o,t[6]=s):s=t[6];let c;t[7]===r?c=t[8]:(c=r===null?null:(0,Z.jsx)(`span`,{className:`truncate text-muted-foreground text-xs`,title:r,children:r}),t[7]=r,t[8]=c);let l;return t[9]!==s||t[10]!==c?(l=(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[s,c]}),t[9]=s,t[10]=c,t[11]=l):l=t[11],l}function WX(e){let t=(0,$.c)(15),{name:n,path:r,current:i}=e,a=i&&`font-medium`,o;t[0]===a?o=t[1]:(o=X(`flex w-full items-center gap-1.5`,a),t[0]=a,t[1]=o);let s;t[2]===n?s=t[3]:(s=(0,Z.jsx)(`span`,{className:`truncate font-medium text-sm`,title:n,children:n}),t[2]=n,t[3]=s);let c;t[4]===i?c=t[5]:(c=i?(0,Z.jsx)($i,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}):null,t[4]=i,t[5]=c);let l;t[6]!==o||t[7]!==s||t[8]!==c?(l=(0,Z.jsxs)(`span`,{className:o,children:[s,c]}),t[6]=o,t[7]=s,t[8]=c,t[9]=l):l=t[9];let u;t[10]===r?u=t[11]:(u=(0,Z.jsx)(`span`,{className:`w-full truncate text-muted-foreground text-xs`,title:r,children:r}),t[10]=r,t[11]=u);let d;return t[12]!==l||t[13]!==u?(d=(0,Z.jsxs)(`span`,{className:`flex w-full min-w-0 flex-col gap-0.5`,children:[l,u]}),t[12]=l,t[13]=u,t[14]=d):d=t[14],d}function GX(){let e=(0,$.c)(4),{_:t}=kt(),n;e[0]===t?n=e[1]:(n=t({id:`Hp1l6f`}),e[0]=t,e[1]=n);let r;return e[2]===n?r=e[3]:(r=(0,Z.jsx)($i,{"aria-label":n,className:`size-3.5 shrink-0 text-muted-foreground`}),e[2]=n,e[3]=r),r}var KX=(e,t,n)=>fg(e,t,n,`ProjectSwitcher`),qX=350;function JX(e){let t=(0,$.c)(108),{bridge:n}=e,{_:r}=kt(),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(``),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(``),[g,_]=(0,Q.useState)(null),v=vM(),y=lg(),b=typeof window<`u`&&window.okDesktop!=null,x=(0,Q.useRef)(!1),S=(0,Q.useRef)(!1),C=(0,Q.useRef)(null),w;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(w=e=>{e&&(S.current=!0,C.current!==null&&clearTimeout(C.current),C.current=setTimeout(()=>{S.current=!1},qX)),s(e),e||(l(``),_(null))},t[0]=w):w=t[0];let T=w,E;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(E=e=>!b||!S.current?!1:(e.preventDefault(),!0),t[1]=E):E=t[1];let D=E,O;t[2]!==r||t[3]!==n.project||t[4]!==o?(O=()=>{if(!o)return;let e=!1;return KX(async()=>{let t=await n.project.listRecent();e||a(t)},r({id:`fYKgzG`})),()=>{e=!0}},t[2]=r,t[3]=n.project,t[4]=o,t[5]=O):O=t[5];let k;t[6]!==r||t[7]!==n||t[8]!==o?(k=[o,n,r],t[6]=r,t[7]=n,t[8]=o,t[9]=k):k=t[9],(0,Q.useEffect)(O,k);let A,j;t[10]===n?(A=t[11],j=t[12]):(A=()=>n.onMenuAction(e=>{e===`new-worktree`?(s(!1),_(null),h(``),p(!0)):e===`switch-worktree`&&s(!0)}),j=[n],t[10]=n,t[11]=A,t[12]=j),(0,Q.useEffect)(A,j);let M;t[13]!==r||t[14]!==n.dialog||t[15]!==n.project?(M=()=>{T(!1),KX(async()=>{let e=await n.dialog.openFolder();e&&await n.project.open({path:e,target:`new-window`,entryPoint:`pick-existing`})},r({id:`gmJ0An`}))},t[13]=r,t[14]=n.dialog,t[15]=n.project,t[16]=M):M=t[16];let N=M,P;t[17]!==r||t[18]!==n.navigator?(P=()=>{T(!1),KX(()=>n.navigator.open(),r({id:`jol95m`}))},t[17]=r,t[18]=n.navigator,t[19]=P):P=t[19];let F=P,I;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(I=()=>{T(!1),d(!0)},t[20]=I):I=t[20];let L=I,R;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(R=e=>{T(!1),h(e),p(!0)},t[21]=R):R=t[21];let z=R,B=n.config.projectPath,V;t[22]===c?V=t[23]:(V=c.trim().toLowerCase(),t[22]=c,t[23]=V);let H=V,U=H!==``,W;t[24]===i?W=t[25]:(W=i??[],t[24]=i,t[25]=W);let G=W,K;t[26]!==U||t[27]!==G?(K=U?G.filter(nZ):G,t[26]=U,t[27]=G,t[28]=K):K=t[28];let ee=K,te=U?null:y,ne=v!==null&&`h-auto py-1.5`,re;t[29]===ne?re=t[30]:(re=X(`justify-between text-sidebar-foreground/70 hover:text-sidebar-foreground! data-open:hover:text-sidebar-foreground!`,ne),t[29]=ne,t[30]=re);let ie;t[31]===r?ie=t[32]:(ie=r({id:`zZ_I5K`}),t[31]=r,t[32]=ie);let q;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(q=b?()=>{x.current=!0}:void 0,t[33]=q):q=t[33];let ae;t[34]===o?ae=t[35]:(ae=b?()=>{if(x.current){x.current=!1;return}T(!o)}:void 0,t[34]=o,t[35]=ae);let oe;t[36]===n.config.projectName?oe=t[37]:(oe=(0,Z.jsx)(`span`,{className:`truncate`,children:n.config.projectName}),t[36]=n.config.projectName,t[37]=oe);let se;t[38]===v?se=t[39]:(se=v===null?null:(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1 text-xs text-sidebar-foreground/50 group-hover/menu-button:text-sidebar-foreground`,"data-testid":`project-switcher-branch`,children:[(0,Z.jsx)(zo,{"aria-hidden":`true`,className:`size-3! shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:v})]}),t[38]=v,t[39]=se);let ce;t[40]!==oe||t[41]!==se?(ce=(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[oe,se]}),t[40]=oe,t[41]=se,t[42]=ce):ce=t[42];let le;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,Z.jsx)(jd,{"aria-hidden":`true`,className:`opacity-60`}),t[43]=le):le=t[43];let ue;t[44]!==n.config.projectPath||t[45]!==re||t[46]!==ie||t[47]!==ae||t[48]!==ce?(ue=(0,Z.jsx)(ic,{asChild:!0,children:(0,Z.jsxs)(cM,{className:re,"data-testid":`project-switcher-trigger`,"aria-label":ie,title:n.config.projectPath,onPointerDown:q,onClick:ae,children:[ce,le]})}),t[44]=n.config.projectPath,t[45]=re,t[46]=ie,t[47]=ae,t[48]=ce,t[49]=ue):ue=t[49];let de;t[50]!==r||t[51]!==n||t[52]!==B||t[53]!==g||t[54]!==ee||t[55]!==te||t[56]!==H||t[57]!==i||t[58]!==c?(de=i===null?null:i.length===0?(0,Z.jsx)(kc,{className:`font-normal text-muted-foreground text-xs`,children:(0,Z.jsx)(J,{id:`MUrVEo`})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(ZC,{className:`mb-1 h-8 border-0 shadow-none has-[[data-slot=input-group-control]:focus-visible]:ring-0`,children:[(0,Z.jsx)(nw,{"aria-label":r({id:`blFttG`}),placeholder:r({id:`RVZJWQ`}),value:c,onChange:e=>{e.target.value!==``&&_(null),l(e.target.value)},onKeyDown:tZ,"data-testid":`project-switcher-search`}),(0,Z.jsx)($C,{children:(0,Z.jsx)(Te,{"aria-hidden":`true`})})]}),(0,Z.jsx)(mc,{}),(0,Z.jsx)(`div`,{className:`max-h-64 overflow-x-hidden overflow-y-auto overscroll-contain subtle-scrollbar scroll-fade-mask`,"data-testid":`project-switcher-scroll`,onScroll:()=>{g!==null&&_(null)},children:(0,Z.jsx)(IX,{bridge:n,recents:ee,currentPath:B,query:H,worktreeModel:te,closeMenu:()=>T(!1),guardStaleSelect:D,flyoutPath:g,setFlyoutPath:_,openNewWorktreeWith:z})})]}),t[50]=r,t[51]=n,t[52]=B,t[53]=g,t[54]=ee,t[55]=te,t[56]=H,t[57]=i,t[58]=c,t[59]=de):de=t[59];let fe;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(fe=(0,Z.jsx)(mc,{}),t[60]=fe):fe=t[60];let pe;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(pe=e=>{D(e)||L()},t[61]=pe):pe=t[61];let me;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,Z.jsxs)(vc,{onSelect:pe,"data-testid":`project-switcher-new-project`,children:[(0,Z.jsx)(nt,{"aria-hidden":`true`,className:`text-muted-foreground`}),(0,Z.jsx)(J,{id:`gKi-a_`})]}),t[62]=me):me=t[62];let he;t[63]===F?he=t[64]:(he=e=>{D(e)||F()},t[63]=F,t[64]=he);let ge,_e;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,Z.jsx)(ye,{"aria-hidden":`true`,className:`text-muted-foreground`}),_e=(0,Z.jsx)(J,{id:`xaDWAI`}),t[65]=ge,t[66]=_e):(ge=t[65],_e=t[66]);let ve;t[67]===he?ve=t[68]:(ve=(0,Z.jsxs)(vc,{onSelect:he,"data-testid":`project-switcher-switch-project`,children:[ge,_e]}),t[67]=he,t[68]=ve);let be;t[69]===N?be=t[70]:(be=e=>{D(e)||N()},t[69]=N,t[70]=be);let xe,Se;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(xe=(0,Z.jsx)(Ro,{"aria-hidden":`true`,className:`text-muted-foreground`}),Se=(0,Z.jsx)(J,{id:`PVUn_c`}),t[71]=xe,t[72]=Se):(xe=t[71],Se=t[72]);let Ce;t[73]===be?Ce=t[74]:(Ce=(0,Z.jsxs)(vc,{onSelect:be,"data-testid":`project-switcher-open-folder`,children:[xe,Se]}),t[73]=be,t[74]=Ce);let we;t[75]===v?we=t[76]:(we=v===null?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(mc,{}),(0,Z.jsxs)(vc,{onSelect:e=>{D(e)||(T(!1),h(``),p(!0))},"data-testid":`project-switcher-new-worktree`,children:[(0,Z.jsx)(zo,{"aria-hidden":`true`,className:`text-muted-foreground`}),(0,Z.jsx)(J,{id:`DXd9LM`})]})]}),t[75]=v,t[76]=we);let Ee;t[77]!==de||t[78]!==ve||t[79]!==Ce||t[80]!==we?(Ee=(0,Z.jsxs)(bc,{align:`start`,side:`top`,className:`min-w-[260px]`,"data-testid":`project-switcher-menu`,children:[de,fe,me,ve,Ce,we]}),t[77]=de,t[78]=ve,t[79]=Ce,t[80]=we,t[81]=Ee):Ee=t[81];let De;t[82]!==o||t[83]!==ue||t[84]!==Ee?(De=(0,Z.jsxs)(Ec,{open:o,onOpenChange:T,modal:!1,children:[ue,Ee]}),t[82]=o,t[83]=ue,t[84]=Ee,t[85]=De):De=t[85];let Oe;t[86]!==n||t[87]!==u?(Oe=(0,Z.jsx)(_m,{open:u,onOpenChange:d,bridge:n}),t[86]=n,t[87]=u,t[88]=Oe):Oe=t[88];let ke;t[89]===y?.entries?ke=t[90]:(ke=y?.entries.map(eZ).filter($X),t[89]=y?.entries,t[90]=ke);let Ae;t[91]===y?.entries?Ae=t[92]:(Ae=new Set(y?.entries.filter(QX).map(ZX)),t[91]=y?.entries,t[92]=Ae);let je=y?.remoteBranches,Me;t[93]===y?.entries?Me=t[94]:(Me=new Map(y?.entries.filter(XX).map(YX)),t[93]=y?.entries,t[94]=Me);let Ne;t[95]!==v||t[96]!==n||t[97]!==m||t[98]!==f||t[99]!==ke||t[100]!==Ae||t[101]!==je||t[102]!==Me?(Ne=(0,Z.jsx)(AX,{open:f,onOpenChange:p,bridge:n,currentBranch:v,initialBranchName:m,branches:ke,existingWorktreeBranches:Ae,remoteBranches:je,behindByBranch:Me}),t[95]=v,t[96]=n,t[97]=m,t[98]=f,t[99]=ke,t[100]=Ae,t[101]=je,t[102]=Me,t[103]=Ne):Ne=t[103];let Pe;return t[104]!==De||t[105]!==Oe||t[106]!==Ne?(Pe=(0,Z.jsxs)(Z.Fragment,{children:[De,Oe,Ne]}),t[104]=De,t[105]=Oe,t[106]=Ne,t[107]=Pe):Pe=t[107],Pe}function YX(e){return[e.branch,e.behind]}function XX(e){return e.branch!==null&&e.behind!==void 0}function ZX(e){return e.branch}function QX(e){return e.branch!==null&&e.worktreePath!==null}function $X(e){return e!==null}function eZ(e){return e.branch}function tZ(e){return e.stopPropagation()}function nZ(e){return!e.isLinkedWorktree}function rZ(e,t){let n=e instanceof Error?e:Error(String(e));console.warn(JSON.stringify({event:`jsx-render-failure`,component:`sidebarSearchPill`,rawComponentName:`sidebarSearchPill`,error:String(n),stack:t.componentStack})),Sn(`sidebarSearchPill`)}function iZ(e){let t=(0,$.c)(8),{onClick:n,className:r}=e,i;t[0]===r?i=t[1]:(i=X(`rounded-lg h-9 w-full justify-start gap-2 px-3 font-normal text-muted-foreground`,r),t[0]=r,t[1]=i);let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(Te,{"aria-hidden":`true`}),t[2]=a):a=t[2];let o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(`span`,{className:`flex-1 text-left text-sm`,children:(0,Z.jsx)(J,{id:`A1taO8`})}),t[3]=o):o=t[3];let s;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(M,{className:`text-foreground/70`,children:Al(`command-palette`)}),t[4]=s):s=t[4];let c;return t[5]!==n||t[6]!==i?(c=(0,Z.jsxs)(Jr,{variant:`outline`,onClick:n,"data-telemetry-event":`ok.sidebar.search_pill.click`,className:i,children:[a,o,s]}),t[5]=n,t[6]=i,t[7]=c):c=t[7],c}function aZ(){let e=(0,$.c)(31),{_:t}=kt(),n=_a(),{activeDocName:r}=Ye(),[i,a]=(0,Q.useState)(!1),o=Ca(),s;e[0]!==n.data||e[1]!==n.status?(s=n.status===`ready`?n.data:[],e[0]=n.data,e[1]=n.status,e[2]=s):s=e[2];let c=s,l;e[3]===c?l=e[4]:(l=No(c),e[3]=c,e[4]=l);let u=l,d=Fo(),f;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(f={},e[5]=f):f=e[5];let[p,m]=(0,Q.useState)(f),h;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(nM,{asChild:!0,children:(0,Z.jsxs)(js,{className:`flex w-full items-center gap-1.5`,children:[(0,Z.jsx)(Zd,{className:`size-3.5 shrink-0`}),(0,Z.jsx)(J,{id:`PCSkw2`}),(0,Z.jsx)(na,{className:`size-3.5 shrink-0 text-muted-foreground transition-transform group-data-[state=open]/skills:rotate-90`})]})}),e[6]=h):h=e[6];let g;e[7]===t?g=e[8]:(g=t({id:`MdpSC1`}),e[7]=t,e[8]=g);let _,v;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(_=()=>a(!0),v=(0,Z.jsx)(nt,{}),e[9]=_,e[10]=v):(_=e[9],v=e[10]);let y;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`MdpSC1`})}),e[11]=y):y=e[11];let b;e[12]===g?b=e[13]:(b=(0,Z.jsxs)(rM,{title:g,onClick:_,children:[v,y]}),e[12]=g,e[13]=b);let x;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(fZ,{}),e[14]=x):x=e[14];let S;e[15]!==o||e[16]!==r||e[17]!==u||e[18]!==p||e[19]!==d||e[20]!==c?(S=c.length===0?(0,Z.jsx)(`p`,{className:`px-2 py-1 text-xs text-muted-foreground`,children:(0,Z.jsx)(J,{id:`PdJZ5p`})}):Ao.filter(e=>c.some(t=>t.scope===e)).map(e=>(0,Z.jsxs)(Ms,{className:`group/scope`,open:c.some(t=>t.scope===e&&Rn(t.scope,t.name)===r)||(p[e]??!1),onOpenChange:t=>m(n=>({...n,[e]:t})),children:[(0,Z.jsxs)(js,{className:`flex w-full items-center gap-1 px-2 pt-1 pb-0.5 text-[11px] text-muted-foreground/70 hover:text-muted-foreground`,children:[(0,Z.jsx)(na,{className:`size-3 shrink-0 transition-transform group-data-[state=open]/scope:rotate-90`}),(0,Z.jsx)(`span`,{className:`truncate`,children:d[e]})]}),(0,Z.jsx)(As,{children:(0,Z.jsx)(aM,{className:`pl-2`,children:c.filter(t=>t.scope===e).map(e=>(0,Z.jsx)(sZ,{skill:e,activeDocName:r,actions:o,existingNames:u[e.scope]},`${e.scope}::${e.name}`))})})]},e)),e[15]=o,e[16]=r,e[17]=u,e[18]=p,e[19]=d,e[20]=c,e[21]=S):S=e[21];let C;e[22]===S?C=e[23]:(C=(0,Z.jsx)(As,{children:(0,Z.jsxs)(iM,{children:[x,S]})}),e[22]=S,e[23]=C);let w;e[24]===i?w=e[25]:(w=(0,Z.jsx)(co,{defaultScope:`project`,open:i,onOpenChange:a,onCreated:oZ}),e[24]=i,e[25]=w);let T;return e[26]!==o.dialogs||e[27]!==C||e[28]!==w||e[29]!==b?(T=(0,Z.jsx)(Ms,{className:`group/skills shrink-0`,children:(0,Z.jsxs)(tM,{className:`px-0`,children:[h,b,C,o.dialogs,w]})}),e[26]=o.dialogs,e[27]=C,e[28]=w,e[29]=b,e[30]=T):T=e[30],T}function oZ(e){let{scope:t,name:n}=e;return Zo(Rn(t,n))}function sZ(e){let t=(0,$.c)(50),{skill:n,activeDocName:r,actions:i,existingNames:a}=e,{_:o}=kt(),[s,c]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)(!1),d;t[0]!==n.name||t[1]!==n.scope?(d=Rn(n.scope,n.name),t[0]=n.name,t[1]=n.scope,t[2]=d):d=t[2];let f=r===d,p,m,h;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=e=>{e.preventDefault(),u(!0)},m=(0,Z.jsx)(na,{className:`size-3 shrink-0 text-muted-foreground transition-transform group-data-[state=open]/skill:rotate-90`}),h=(0,Z.jsx)(Zd,{className:`size-3 shrink-0 text-muted-foreground`}),t[3]=p,t[4]=m,t[5]=h):(p=t[3],m=t[4],h=t[5]);let g=n.name,_;t[6]===n.name?_=t[7]:(_=Do(n.name),t[6]=n.name,t[7]=_);let v;t[8]!==n.name||t[9]!==_?(v=(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:g,children:_}),t[8]=n.name,t[9]=_,t[10]=v):v=t[10];let y;t[11]!==o||t[12]!==n.bundledVersion||t[13]!==n.updateAvailable?(y=n.updateAvailable?(0,Z.jsx)(`span`,{title:o({id:`1YJ4Yg`,values:{0:n.bundledVersion?` (${n.bundledVersion})`:``}}),className:`flex items-center`,children:(0,Z.jsx)(is,{className:`size-3 text-primary`,"aria-label":o({id:`CifUuG`})})}):null,t[11]=o,t[12]=n.bundledVersion,t[13]=n.updateAvailable,t[14]=y):y=t[14];let b;t[15]===n.installed?b=t[16]:(b=(0,Z.jsx)(no,{installed:n.installed,subtle:!0,className:`shrink-0`}),t[15]=n.installed,t[16]=b);let x;t[17]!==y||t[18]!==b?(x=(0,Z.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1`,children:[y,b]}),t[17]=y,t[18]=b,t[19]=x):x=t[19];let S;t[20]!==f||t[21]!==x||t[22]!==v?(S=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsxs)(cM,{size:`sm`,isActive:f,className:`h-6 text-[11px]`,onContextMenu:p,children:[m,h,v,x]})}),t[20]=f,t[21]=x,t[22]=v,t[23]=S):S=t[23];let C;t[24]!==o||t[25]!==n.name?(C=o({id:`RlLl3G`,values:{0:n.name}}),t[24]=o,t[25]=n.name,t[26]=C):C=t[26];let w;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(zd,{}),t[27]=w):w=t[27];let T;t[28]===C?T=t[29]:(T=(0,Z.jsx)(ic,{asChild:!0,children:(0,Z.jsx)(lM,{showOnHover:!0,"aria-label":C,children:w})}),t[28]=C,t[29]=T);let E;t[30]!==i||t[31]!==a||t[32]!==n?(E=(0,Z.jsx)(bc,{side:`right`,align:`start`,className:`min-w-52`,children:(0,Z.jsx)(ba,{skill:n,actions:i,existingNames:a})}),t[30]=i,t[31]=a,t[32]=n,t[33]=E):E=t[33];let D;t[34]!==l||t[35]!==T||t[36]!==E?(D=(0,Z.jsxs)(Ec,{open:l,onOpenChange:u,children:[T,E]}),t[34]=l,t[35]=T,t[36]=E,t[37]=D):D=t[37];let O;t[38]!==s||t[39]!==n?(O=s?(0,Z.jsx)(uZ,{skill:n}):null,t[38]=s,t[39]=n,t[40]=O):O=t[40];let k;t[41]===O?k=t[42]:(k=(0,Z.jsx)(As,{children:O}),t[41]=O,t[42]=k);let A;t[43]!==S||t[44]!==D||t[45]!==k?(A=(0,Z.jsxs)(oM,{children:[S,D,k]}),t[43]=S,t[44]=D,t[45]=k,t[46]=A):A=t[46];let j;return t[47]!==s||t[48]!==A?(j=(0,Z.jsx)(Ms,{open:s,onOpenChange:c,className:`group/skill`,children:A}),t[47]=s,t[48]=A,t[49]=j):j=t[49],j}function cZ(e){let t=[];for(let n of e){let e=n.path.split(`/`),r=t;e.forEach((t,i)=>{let a=i===e.length-1,o=r.find(e=>e.name===t);o||(o=a?{name:t,path:n.path,text:n.text}:{name:t,path:e.slice(0,i+1).join(`/`),children:[]},r.push(o)),!a&&o.children&&(r=o.children)})}return lZ(t),t}function lZ(e){e.sort((e,t)=>{let n=+!e.children,r=+!t.children;return n===r?e.name.localeCompare(t.name):n-r});for(let t of e)t.children&&lZ(t.children)}function uZ(e){let t=(0,$.c)(27),{skill:n}=e,{_:r}=kt(),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(!1),{openTarget:c}=Ye(),l;t[0]===c?l=t[1]:(l=function(e){c({kind:`doc`,target:e,docName:e},{tabBehavior:`append`}),yl(El(e))},t[0]=c,t[1]=l);let u=l,d;t[2]!==u||t[3]!==c||t[4]!==n.name||t[5]!==n.scope?(d=function(e){let t=e.lastIndexOf(`.`),r=t>=0?e.slice(t+1).toLowerCase():``;if(n.scope===`project`&&(r===`md`||r===`mdx`)){u(Ke(n.name,e.replace(/\.mdx?$/i,``)));return}c({kind:`skill-file`,target:`${n.scope}/${n.name}/${e}`,scope:n.scope,name:n.name,path:e},{tabBehavior:`replace-active`}),yl(Sl({scope:n.scope,name:n.name,path:e}))},t[2]=u,t[3]=c,t[4]=n.name,t[5]=n.scope,t[6]=d):d=t[6];let f=d,p,m;t[7]!==n.name||t[8]!==n.scope?(p=()=>{let e=!0,t=()=>{Dc(n.scope,n.name).then(t=>{e&&(t.ok?(a(t.files),s(!1)):(a([]),s(!0)))})};t();let r=pl(t);return()=>{e=!1,r()}},m=[n.scope,n.name],t[7]=n.name,t[8]=n.scope,t[9]=p,t[10]=m):(p=t[9],m=t[10]),(0,Q.useEffect)(p,m);let h;if(t[11]!==r||t[12]!==i||t[13]!==o||t[14]!==f||t[15]!==u||t[16]!==n.name||t[17]!==n.scope){let e=i?cZ(i):[],a;t[19]!==u||t[20]!==n.name||t[21]!==n.scope?(a=()=>n.scope===`project`?u(Sr(n.name)):Zo(Rn(n.scope,n.name)),t[19]=u,t[20]=n.name,t[21]=n.scope,t[22]=a):a=t[22];let s,c;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(Di,{className:`size-3 shrink-0 text-muted-foreground`}),c=(0,Z.jsx)(`span`,{className:`truncate`,children:`SKILL.md`}),t[23]=s,t[24]=c):(s=t[23],c=t[24]);let l;t[25]===a?l=t[26]:(l=(0,Z.jsx)(dM,{children:(0,Z.jsxs)(fM,{size:`sm`,onClick:a,className:`text-[11px]`,children:[s,c]})}),t[25]=a,t[26]=l),h=(0,Z.jsxs)(uM,{className:`mr-0 pr-0`,children:[l,i===null?(0,Z.jsx)(dM,{children:(0,Z.jsx)(`span`,{className:`px-2 py-0.5 text-[11px] text-muted-foreground/70`,children:(0,Z.jsx)(J,{id:`yQE2r9`})})}):o?(0,Z.jsx)(dM,{children:(0,Z.jsx)(`span`,{className:`px-2 py-0.5 text-[11px] text-muted-foreground/70`,title:r({id:`3Ijjy1`}),children:(0,Z.jsx)(J,{id:`ZARuZJ`})})}):e.map(e=>(0,Z.jsx)(dZ,{node:e,depth:0,onOpenFile:f},e.path))]}),t[11]=r,t[12]=i,t[13]=o,t[14]=f,t[15]=u,t[16]=n.name,t[17]=n.scope,t[18]=h}else h=t[18];return h}function dZ(e){let t=(0,$.c)(34),{node:n,depth:r,onOpenFile:i}=e,[a,o]=(0,Q.useState)(!1),s=`${r*.6}rem`,c;t[0]===s?c=t[1]:(c={paddingLeft:s},t[0]=s,t[1]=c);let l=c;if(n.children){let e;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(na,{className:`size-3 shrink-0 text-muted-foreground transition-transform group-data-[state=open]/dir:rotate-90`}),t[2]=e):e=t[2];let s;t[3]===n.name?s=t[4]:(s=(0,Z.jsxs)(`span`,{className:`truncate`,children:[n.name,`/`]}),t[3]=n.name,t[4]=s);let c;t[5]!==l||t[6]!==s?(c=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsxs)(fM,{size:`sm`,className:`text-[11px]`,style:l,children:[e,s]})}),t[5]=l,t[6]=s,t[7]=c):c=t[7];let u;if(t[8]!==r||t[9]!==n.children||t[10]!==i){let e;t[12]!==r||t[13]!==i?(e=e=>(0,Z.jsx)(dZ,{node:e,depth:r+1,onOpenFile:i},e.path),t[12]=r,t[13]=i,t[14]=e):e=t[14],u=n.children.map(e),t[8]=r,t[9]=n.children,t[10]=i,t[11]=u}else u=t[11];let d;t[15]===u?d=t[16]:(d=(0,Z.jsx)(As,{children:u}),t[15]=u,t[16]=d);let f;t[17]!==c||t[18]!==d?(f=(0,Z.jsxs)(dM,{children:[c,d]}),t[17]=c,t[18]=d,t[19]=f):f=t[19];let p;return t[20]!==a||t[21]!==f?(p=(0,Z.jsx)(Ms,{open:a,onOpenChange:o,className:`group/dir`,children:f}),t[20]=a,t[21]=f,t[22]=p):p=t[22],p}let u=`skill-file-${n.path}`,d;t[23]!==n.path||t[24]!==i?(d=()=>i(n.path),t[23]=n.path,t[24]=i,t[25]=d):d=t[25];let f;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(Hd,{className:`size-3 shrink-0 text-muted-foreground`}),t[26]=f):f=t[26];let p;t[27]===n.name?p=t[28]:(p=(0,Z.jsx)(`span`,{className:`truncate`,children:n.name}),t[27]=n.name,t[28]=p);let m;return t[29]!==l||t[30]!==u||t[31]!==d||t[32]!==p?(m=(0,Z.jsx)(dM,{children:(0,Z.jsxs)(fM,{size:`sm`,className:`text-[11px]`,style:l,"data-testid":u,onClick:d,children:[f,p]})}),t[29]=l,t[30]=u,t[31]=d,t[32]=p,t[33]=m):m=t[33],m}function fZ(){let e=(0,$.c)(19),[t,n]=(0,Q.useState)(null),[r,i]=(0,Q.useState)(!1),a,o;if(e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>{let e=!1;return xc().then(t=>{e||n(t)}),()=>{e=!0}},o=[],e[0]=a,e[1]=o):(a=e[0],o=e[1]),(0,Q.useEffect)(a,o),!t||t.managed!==null||t.importable===0)return null;let s;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=async e=>{if(i(!0),!await Oc(e)){i(!1);return}n({managed:e,importable:0})},e[2]=s):s=e[2];let c=s,l;e[3]===t.importable?l=e[4]:(l=(0,Z.jsx)(`p`,{className:`mb-2 text-muted-foreground`,children:(0,Z.jsx)(J,{id:`mu1O0q`,values:{0:t.importable}})}),e[3]=t.importable,e[4]=l);let u,d;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>c(!0),d=(0,Z.jsx)(J,{id:`l3s5ri`}),e[5]=u,e[6]=d):(u=e[5],d=e[6]);let f;e[7]===r?f=e[8]:(f=(0,Z.jsx)(Jr,{size:`sm`,className:`h-6 px-2 text-xs`,disabled:r,onClick:u,children:d}),e[7]=r,e[8]=f);let p,m;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(p=()=>c(!1),m=(0,Z.jsx)(J,{id:`PBxg_E`}),e[9]=p,e[10]=m):(p=e[9],m=e[10]);let h;e[11]===r?h=e[12]:(h=(0,Z.jsx)(Jr,{size:`sm`,variant:`ghost`,className:`h-6 px-2 text-xs`,disabled:r,onClick:p,children:m}),e[11]=r,e[12]=h);let g;e[13]!==f||e[14]!==h?(g=(0,Z.jsxs)(`div`,{className:`flex gap-1.5`,children:[f,h]}),e[13]=f,e[14]=h,e[15]=g):g=e[15];let _;return e[16]!==g||e[17]!==l?(_=(0,Z.jsxs)(`div`,{className:`mx-2 mb-1 rounded-md border border-border/60 bg-muted/40 p-2 text-xs`,children:[l,g]}),e[16]=g,e[17]=l,e[18]=_):_=e[18],_}var pZ=`Relaunch`,mZ=`Release notes`,hZ=`Updates paused`,gZ=`Download`,_Z=`Reset to defaults`,vZ=`Relaunching to install the update…`,yZ=`Relaunch failed — please restart manually`;function bZ(e){return`Update to ${e} didn't install.`}var xZ=`Retry`,SZ=`Download manually`,CZ=`Recovery action failed — please try again`;function wZ(e,t){let n=t instanceof Error&&t.message?t.message:``;return n?`${e}: ${n}`:e}function TZ(e){return`Version ${e} ready to install`}function EZ(e){return`Updated to Version ${e}`}function DZ(e){return`Your settings and recent projects were saved by a newer build than this one (v${e}). Reset to defaults to continue.`}var OZ=0,kZ=0,AZ=1,jZ=2,MZ=3,NZ=6e4;function PZ(e,t,n=()=>{},r=NZ,i={isEligible:()=>!1,onShown:()=>{}}){let a=[],o=new Set,s=`update-downloaded`;return a.push(e.onUpdateDownloaded(({version:r})=>{let i=s,a=()=>{t({id:i,body:TZ(r),priority:jZ,action:{label:pZ,onClick:()=>{t({id:i,body:vZ,priority:jZ,dismissible:!1}),e.update.relaunchNow().then(()=>{n(i)},e=>{a(),t({id:`relaunch-error-${r}`,body:wZ(yZ,e),variant:`error`,priority:AZ})})}}})};a()})),a.push(e.onUpdateRelaunching(()=>{t({id:s,body:vZ,priority:jZ,dismissible:!1})})),a.push(e.onUpdateRelaunchFailed(({version:r,message:i,downloadUrl:a})=>{if(a){let i=`install-failed-${r}`,o=()=>{t({id:i,body:bZ(r),variant:`error`,priority:AZ,action:{label:xZ,onClick:()=>{e.update.relaunchNow().then(()=>{n(i)},e=>{console.warn(`[update-notice] install-failed retry rejected`,e),o()})}},secondaryAction:{label:SZ,onClick:()=>{e.shell.openExternal(a)}}})};o();return}t({id:`relaunch-error-${r}`,body:i?`${yZ}: ${i}`:yZ,variant:`error`,priority:AZ})})),a.push(e.onWhatsNew(({version:a,releaseUrl:s})=>{if(i.isEligible(a)){i.onShown(a),t({id:`whats-new-combined-${a}`,body:EZ(a),variant:`success`,priority:MZ,combinedSubscribe:!0,whatsNew:{version:a,releaseUrl:s},action:{label:mZ,onClick:()=>{e.shell.openExternal(s)}}}),e.update.dismissWhatsNew(a);return}let c=`whats-new-${a}`;t({id:c,body:EZ(a),variant:`success`,priority:MZ,action:{label:mZ,onClick:()=>{e.shell.openExternal(s)}},onDismiss:()=>{e.update.dismissWhatsNew(a)}});let l=setTimeout(()=>{o.delete(l),n(c),e.update.dismissWhatsNew(a)},r);o.add(l)})),a.push(e.onWhatsNewDismissed(({version:e})=>{n(`whats-new-${e}`)})),a.push(e.onUpdateStuckHint(({downloadUrl:n})=>{t({id:`update-stuck-hint`,body:hZ,priority:kZ,action:{label:gZ,onClick:()=>{e.shell.openExternal(n)}}})})),()=>{for(let e of a)e();for(let e of o)clearTimeout(e);o.clear()}}function FZ(e,t,n,r=()=>{}){let i=`schema-incompatibility-${t.persistedSchemaVersion}`,a=`schema-incompatibility-error-${t.persistedSchemaVersion}`,o=e=>{r(i),n({id:a,body:wZ(CZ,e),variant:`error`,priority:OZ})};n({id:i,body:DZ(t.currentBuild),priority:OZ,action:{label:_Z,onClick:()=>{e.state.resetIncompatible().then(()=>{r(i)},o)}}})}var IZ=[],LZ=new Set,RZ=!1;function zZ(){for(let e of LZ)e()}function BZ(e){let t=IZ.findIndex(t=>t.id===e.id);if(t===-1)IZ=[...IZ,e];else{let n=IZ.slice();n[t]=e,IZ=n}zZ()}function VZ(e){let t=IZ.filter(t=>t.id!==e);t.length!==IZ.length&&(IZ=t,zZ())}function HZ(){return IZ}function UZ(e){return LZ.add(e),()=>{LZ.delete(e)}}function WZ(){if(RZ||typeof window>`u`)return;let e=window.okDesktop;e&&(RZ=!0,PZ(e,BZ,VZ,void 0,{isEligible:e=>yF(EF.getSnapshot(),e),onShown:e=>EF.recordShown(e)}),e.state.query().then(t=>{t.schemaIncompatibility&&FZ(e,t.schemaIncompatibility,BZ,VZ)},e=>{console.warn(`[update-notices-store] bridge.state.query() failed`,e)}))}var GZ=6e4,KZ=e=>{let t=(0,$.c)(11),{href:n,label:r,icon:i}=e,a,o;t[0]===n?(a=t[1],o=t[2]):(a=e=>hu(e,n),o=e=>hu(e,n),t[0]=n,t[1]=a,t[2]=o);let s;t[3]===i?s=t[4]:(s=(0,Z.jsx)(i,{"aria-hidden":`true`,className:`size-3.5`}),t[3]=i,t[4]=s);let c;return t[5]!==n||t[6]!==r||t[7]!==a||t[8]!==o||t[9]!==s?(c=(0,Z.jsx)(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,onClick:a,onAuxClick:o,"aria-label":r,className:`rounded-md p-1 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,children:s}),t[5]=n,t[6]=r,t[7]=a,t[8]=o,t[9]=s,t[10]=c):c=t[10],c};function qZ(e){let t=(0,$.c)(34),{version:n,onOpenReleaseNotes:r,onClose:i,store:a,autoDismissMs:o}=e,s=a===void 0?EF:a,c=o===void 0?GZ:o,{_:l}=kt(),[u,d]=(0,Q.useState)(!1),f,p;t[0]!==c||t[1]!==i||t[2]!==u?(f=()=>{if(!u)return;let e=setTimeout(i,c);return()=>clearTimeout(e)},p=[u,i,c],t[0]=c,t[1]=i,t[2]=u,t[3]=f,t[4]=p):(f=t[3],p=t[4]),(0,Q.useEffect)(f,p);let m;t[5]===l?m=t[6]:(m=l({id:`GzPQ2f`}),t[5]=l,t[6]=m);let h;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(J,{id:`yLEyuq`}),t[7]=h):h=t[7];let g;t[8]===s?g=t[9]:(g=()=>{s.markSubscribed(),d(!0)},t[8]=s,t[9]=g);let _;t[10]!==i||t[11]!==s?(_=()=>{s.dismiss(),i()},t[10]=i,t[11]=s,t[12]=_):_=t[12];let v;t[13]!==g||t[14]!==_?(v=(0,Z.jsx)(pF,{source:`post_update_card`,compactSubmit:!0,description:h,onSuccess:g,onDismiss:_}),t[13]=g,t[14]=_,t[15]=v):v=t[15];let y;t[16]!==l||t[17]!==u?(y=u?null:(0,Z.jsxs)(`nav`,{"aria-label":l({id:`dbapvC`}),className:`mt-3 flex items-center gap-1.5 text-muted-foreground text-xs`,children:[(0,Z.jsx)(`span`,{className:`mr-0.5`,children:(0,Z.jsx)(J,{id:`9sBe85`})}),(0,Z.jsx)(KZ,{href:gF,label:l({id:`I7Exsw`}),icon:AF}),(0,Z.jsx)(KZ,{href:mF,label:l({id:`zyKa-I`}),icon:kF}),(0,Z.jsx)(KZ,{href:hF,label:l({id:`36aWJD`}),icon:OF})]}),t[16]=l,t[17]=u,t[18]=y):y=t[18];let b;t[19]!==y||t[20]!==v?(b=(0,Z.jsxs)(`div`,{className:`px-3 py-2.5`,children:[v,y]}),t[19]=y,t[20]=v,t[21]=b):b=t[21];let x;t[22]===n?x=t[23]:(x=(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(J,{id:`hLy8b1`,values:{version:n}})}),t[22]=n,t[23]=x);let S;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(J,{id:`_PACVa`}),t[24]=S):S=t[24];let C;t[25]===r?C=t[26]:(C=(0,Z.jsx)(Jr,{variant:`link`,size:`sm`,className:`h-auto p-0 text-muted-foreground text-xs hover:text-foreground`,onClick:r,children:S}),t[25]=r,t[26]=C);let w;t[27]!==x||t[28]!==C?(w=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between border-t bg-muted/30 px-3 py-2.5 space-x-2`,children:[x,C]}),t[27]=x,t[28]=C,t[29]=w):w=t[29];let T;return t[30]!==b||t[31]!==w||t[32]!==m?(T=(0,Z.jsxs)(`section`,{"aria-label":m,className:`mx-1 mb-1 overflow-hidden rounded-lg border bg-card text-card-foreground`,children:[b,w]}),t[30]=b,t[31]=w,t[32]=m,t[33]=T):T=t[33],T}function JZ(e){let t=(0,$.c)(37),{notice:n,onDismiss:r}=e,{_:i}=kt(),a=n.variant===`error`?`border-destructive/60 bg-sidebar-accent/30 text-muted-foreground`:n.variant===`success`?`border-emerald-500/40 bg-emerald-500/10 text-emerald-600 dark:text-emerald-400`:`border-sidebar-border bg-sidebar-accent/30 text-muted-foreground`,o;t[0]!==i||t[1]!==n.dismissible||t[2]!==r?(o=n.dismissible===!1?null:(0,Z.jsx)(Jr,{variant:`ghost`,size:`icon`,className:`size-5 shrink-0 text-muted-foreground hover:text-sidebar-foreground`,"aria-label":i({id:`GUYwCr`}),onClick:r,children:(0,Z.jsx)(gs,{"aria-hidden":`true`,className:`size-3`})}),t[0]=i,t[1]=n.dismissible,t[2]=r,t[3]=o):o=t[3];let s=o,c=`shrink-0 text-xs font-medium underline underline-offset-2 ${n.variant===`success`?`decoration-emerald-500/40`:`decoration-muted-foreground/40`} hover:text-sidebar-foreground hover:decoration-sidebar-foreground`;if(n.secondaryAction){let e=`update-notice-${n.id}`,r=`flex flex-col gap-2 rounded-md border px-2 py-2 text-xs ${a}`,i;t[4]===n.body?i=t[5]:(i=(0,Z.jsx)(`span`,{className:`flex-1 leading-snug`,children:n.body}),t[4]=n.body,t[5]=i);let o;t[6]!==s||t[7]!==i?(o=(0,Z.jsxs)(`div`,{className:`flex items-start gap-2`,children:[i,s]}),t[6]=s,t[7]=i,t[8]=o):o=t[8];let l;t[9]!==c||t[10]!==n.action?(l=n.action?(0,Z.jsx)(`button`,{type:`button`,className:c,onClick:()=>{n.action?.onClick()},children:n.action.label}):null,t[9]=c,t[10]=n.action,t[11]=l):l=t[11];let u;t[12]===n.secondaryAction?u=t[13]:(u=()=>{n.secondaryAction?.onClick()},t[12]=n.secondaryAction,t[13]=u);let d;t[14]!==c||t[15]!==n.secondaryAction.label||t[16]!==u?(d=(0,Z.jsx)(`button`,{type:`button`,className:c,onClick:u,children:n.secondaryAction.label}),t[14]=c,t[15]=n.secondaryAction.label,t[16]=u,t[17]=d):d=t[17];let f;t[18]!==l||t[19]!==d?(f=(0,Z.jsxs)(`div`,{className:`flex gap-3 pl-1`,children:[l,d]}),t[18]=l,t[19]=d,t[20]=f):f=t[20];let p;return t[21]!==e||t[22]!==r||t[23]!==o||t[24]!==f?(p=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":e,className:r,children:[o,f]}),t[21]=e,t[22]=r,t[23]=o,t[24]=f,t[25]=p):p=t[25],p}let l=`update-notice-${n.id}`,u=`flex items-center gap-2 rounded-md border px-2 py-1.5 text-xs ${a}`,d;t[26]===n.body?d=t[27]:(d=(0,Z.jsx)(`span`,{className:`flex-1 leading-snug`,children:n.body}),t[26]=n.body,t[27]=d);let f;t[28]!==c||t[29]!==n.action?(f=n.action?(0,Z.jsx)(`button`,{type:`button`,className:c,onClick:()=>{n.action?.onClick()},children:n.action.label}):null,t[28]=c,t[29]=n.action,t[30]=f):f=t[30];let p;return t[31]!==s||t[32]!==l||t[33]!==u||t[34]!==d||t[35]!==f?(p=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":l,className:u,children:[d,f,s]}),t[31]=s,t[32]=l,t[33]=u,t[34]=d,t[35]=f,t[36]=p):p=t[36],p}function YZ(e){if(e.length===0)return null;let t=e[0];if(!t)return null;for(let n=1;n<e.length;n++){let r=e[n];r&&r.priority<t.priority&&(t=r)}return t}function XZ(){let e=(0,$.c)(15),t=(0,Q.useSyncExternalStore)(UZ,HZ,HZ),n;e[0]===t?n=e[1]:(n=YZ(t),e[0]=t,e[1]=n);let r=n;if(!r)return null;if(r.combinedSubscribe&&r.whatsNew){let t;e[2]===r.action?t=e[3]:(t=()=>r.action?.onClick(),e[2]=r.action,e[3]=t);let n;e[4]===r.id?n=e[5]:(n=()=>VZ(r.id),e[4]=r.id,e[5]=n);let i;return e[6]!==r.whatsNew.version||e[7]!==t||e[8]!==n?(i=(0,Z.jsx)(`div`,{"data-testid":`update-notices-list`,children:(0,Z.jsx)(qZ,{version:r.whatsNew.version,onOpenReleaseNotes:t,onClose:n})}),e[6]=r.whatsNew.version,e[7]=t,e[8]=n,e[9]=i):i=e[9],i}let i;e[10]===r?i=e[11]:(i=()=>{r.onDismiss?.(),VZ(r.id)},e[10]=r,e[11]=i);let a;return e[12]!==r||e[13]!==i?(a=(0,Z.jsx)(`div`,{"data-testid":`update-notices-list`,children:(0,Z.jsx)(JZ,{notice:r,onDismiss:i})}),e[12]=r,e[13]=i,e[14]=a):a=e[14],a}function ZZ(e,t){return e?.kind===`doc`||e?.kind===`folder-index`?Mo(t.contentDir,Io(e.docName),t.pathSeparator):e?.kind===`folder`?Mo(t.contentDir,e.folderPath,t.pathSeparator):e?.kind===`asset`?Mo(t.contentDir,e.assetPath,t.pathSeparator):t.contentDir}function QZ(e){return e?.kind===`doc`||e?.kind===`folder-index`?Io(e.docName):e?.kind===`folder`?e.folderPath:e?.kind===`asset`?e.assetPath:``}function $Z(e,t){return e===null?ka({workspace:t}):e.kind===`folder`?t?da({folderRelativePath:e.folderPath,workspace:t}):null:e.kind===`doc`||e.kind===`folder-index`?Ea({docName:e.docName,workspace:t}):null}var eQ={folderCount:0,expandedCount:0},tQ=`button, [role="button"], [role="menuitem"], input, textarea, select, a[href]`;function nQ(e){return typeof Element>`u`||!(e instanceof Element)?!1:e.closest(tQ)!==null}function rQ(e){let t=(0,$.c)(2),{onOpenSearch:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(hl,{name:`file-sidebar`,children:(0,Z.jsx)(oQ,{onOpenSearch:n})}),t[0]=n,t[1]=r),r}var iQ=e=>{let t=(0,$.c)(15),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({icon:n,label:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=(0,Z.jsx)(n,{"aria-hidden":`true`}),t[4]=n,t[5]=a);let o;t[6]!==r||t[7]!==i||t[8]!==a?(o=(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(Jr,{variant:`ghost`,size:`icon-sm`,"aria-label":r,...i,children:a})}),t[6]=r,t[7]=i,t[8]=a,t[9]=o):o=t[9];let s;t[10]===r?s=t[11]:(s=(0,Z.jsx)(Es,{children:r}),t[10]=r,t[11]=s);let c;return t[12]!==o||t[13]!==s?(c=(0,Z.jsxs)(Os,{children:[o,s]}),t[12]=o,t[13]=s,t[14]=c):c=t[14],c},aQ=e=>{let t=(0,$.c)(15),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({icon:n,label:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=(0,Z.jsx)(n,{"aria-hidden":`true`}),t[4]=n,t[5]=a);let o;t[6]!==r||t[7]!==i||t[8]!==a?(o=(0,Z.jsx)(Ts,{asChild:!0,children:(0,Z.jsx)(ic,{asChild:!0,children:(0,Z.jsx)(Jr,{variant:`ghost`,size:`icon-sm`,"aria-label":r,...i,children:a})})}),t[6]=r,t[7]=i,t[8]=a,t[9]=o):o=t[9];let s;t[10]===r?s=t[11]:(s=(0,Z.jsx)(Es,{children:r}),t[10]=r,t[11]=s);let c;return t[12]!==o||t[13]!==s?(c=(0,Z.jsxs)(Os,{children:[o,s]}),t[12]=o,t[13]=s,t[14]=c):c=t[14],c};function oQ(e){let t=(0,$.c)(208),{onOpenSearch:n}=e,{_:r}=kt(),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(null),{activeDocName:c,activeTarget:l}=Ye(),u;t[0]!==c||t[1]!==l?(u=l?.kind===`folder`||l?.kind===`folder-index`?l.folderPath:al(c),t[0]=c,t[1]=l,t[2]=u):u=t[2];let d=u,[f,p]=(0,Q.useState)(!1),m=f?``:d,g=typeof window<`u`&&window.okDesktop!=null,{state:_,toggleSidebar:v}=Wj(),y=Po(),b=_===`expanded`,x=g&&_===`collapsed`,[S,C]=(0,Q.useState)(eQ),w,T;t[3]===i?(w=t[4],T=t[5]):(w=()=>{if(i===null)return;let e=()=>{C(i.getFolderState()),p(i.isCreationTargetCleared())};return e(),i.subscribe(e)},T=[i],t[3]=i,t[4]=w,t[5]=T),(0,Q.useEffect)(w,T);let E,D;t[6]===i?(E=t[7],D=t[8]):(E=()=>{if(i!==null)return IS(e=>{let t=e.initialDir??``;if(e.template){i.createFromTemplate(e.template.folder,e.template.name);return}i.startCreating(`file`,t)})},D=[i],t[6]=i,t[7]=E,t[8]=D),(0,Q.useEffect)(E,D);let O=S.folderCount>0,k=O&&S.expandedCount===S.folderCount,A=S.expandedCount===0,j=vo(``),M=vo(m===``?null:m),N=m===``?j:M,P=j.state.status===`ready`?(j.state.data.folder.templates_available?.length??0)>0:!0,F=N.state.status===`ready`?(N.state.data.folder.templates_available?.length??0)>0:!0,I=typeof window<`u`?window.okDesktop:void 0,L=ua(),{status:R}=zi(),z=R?.hasRemote===!0,B;t[9]!==r||t[10]!==L?.contentDir?(B=I?.config?.projectName||L?.contentDir.split(`/`).filter(Boolean).pop()||r({id:`sER-bs`}),t[9]=r,t[10]=L?.contentDir,t[11]=B):B=t[11];let V=B,H=ya().states,{dispatch:U}=Da(),W;t[12]===L?W=t[13]:(W=ka({workspace:L}),t[12]=L,t[13]=W);let G=W,{projectLocalBinding:K,merged:ee}=au(),te=ee?.appearance?.sidebar?.showHiddenFiles??!1,ne=O&&!k,re=O&&!A,ie=ne||re,q=dQ,ae;t[14]!==i||t[15]!==L?(ae=()=>{L&&i?.startCreating(`file`,``)},t[14]=i,t[15]=L,t[16]=ae):ae=t[16];let oe=ae,se;t[17]!==i||t[18]!==L?(se=e=>{L&&i?.createFromTemplate(``,e)},t[17]=i,t[18]=L,t[19]=se):se=t[19];let ce=se,le;t[20]!==i||t[21]!==L?(le=()=>{L&&i?.startCreating(`folder`,``)},t[20]=i,t[21]=L,t[22]=le):le=t[22];let ue=le,de;t[23]===L?de=t[24]:(de=()=>{!L||!I||I.shell.showItemInFolder(L.contentDir)},t[23]=L,t[24]=de);let fe=de,pe;t[25]!==r||t[26]!==L?(pe=async()=>{if(L)try{await navigator.clipboard.writeText(L.contentDir),hs.success(r({id:`6_ZOw4`}),{description:L.contentDir})}catch(e){console.warn(`[FileSidebar] clipboard write failed:`,e),hs.error(r({id:`vfRlCI`}))}},t[25]=r,t[26]=L,t[27]=pe):pe=t[27];let me=pe,he;t[28]!==r||t[29]!==z?(he=()=>{La({...Pa(``),hasRemote:z,onClickWhenNoRemote:()=>{hs.error(r({id:`WyQxwa`}))}},{clipboardWrite:Sa,toastSuccess:uQ,toastError:lQ,logEvent:cQ})},t[28]=r,t[29]=z,t[30]=he):he=t[30];let ge=he,_e;t[31]!==r||t[32]!==K?(_e=e=>{if(K===null)return;let t=K.patch({appearance:{sidebar:{showHiddenFiles:e}}});t.ok||(console.warn(`[FileSidebar] showHiddenFiles toggle rejected:`,un(t.error)),hs.error(r({id:`P47EWZ`}),{description:un(t.error)}))},t[31]=r,t[32]=K,t[33]=_e):_e=t[33];let ve=_e,ye;t[34]===i?ye=t[35]:(ye=()=>{i?.expandAll()},t[34]=i,t[35]=ye);let be=ye,xe;t[36]===i?xe=t[37]:(xe=()=>{i?.collapseAll()},t[36]=i,t[37]=xe);let Se=xe,Ce,we;t[38]!==re||t[39]!==ne||t[40]!==te||t[41]!==_?(Ce=()=>{I&&I.editor.notifyViewMenuStateChanged({showHiddenFiles:te,canExpandAll:ne,canCollapseAll:re,sidebarVisible:_===`expanded`})},we=[I,te,ne,re,_],t[38]=re,t[39]=ne,t[40]=te,t[41]=_,t[42]=Ce,t[43]=we):(Ce=t[42],we=t[43]),(0,Q.useEffect)(Ce,we);let Te,Ee;t[44]!==r||t[45]!==l||t[46]!==U||t[47]!==H||t[48]!==m||t[49]!==K||t[50]!==te||t[51]!==v||t[52]!==i||t[53]!==L?(Te=()=>{if(I)return I.onMenuAction(e=>{switch(e){case`new-doc`:if(!L||!i)return;i.startCreating(`file`,m);return;case`new-folder`:if(!L||!i)return;i.startCreating(`folder`,m);return;case`new-from-template`:if(!L||!i)return;i.startCreatingFromTemplate(m);return;case`rename`:if(!l)return;pJ(l);return;case`duplicate`:if(!l)return;hJ(l);return;case`move-to-trash`:if(!l)return;dJ(l);return;case`reveal-in-finder`:{if(!I||!L)return;let e=ZZ(l,L);I.shell.showItemInFolder(e);return}case`send-to-ai`:{let e=ca.filter(e=>H[e.id]?.installed===!0);if(e.length===0){hs.error(r({id:`LKOLNn`}));return}let t=$Z(l,L);if(!t)return;let[n]=e;if(!n)return;U(n.id,t);return}case`copy-full-path`:{if(!L)return;let e=ZZ(l,L);navigator.clipboard.writeText(e).then(()=>hs.success(r({id:`6_ZOw4`}),{description:e})).catch(e=>{console.warn(`[FileSidebar] clipboard write failed:`,e),hs.error(r({id:`vfRlCI`}))});return}case`copy-relative-path`:{let e=QZ(l);if(e===``){hs.error(r({id:`74eHt-`}));return}navigator.clipboard.writeText(e).then(()=>hs.success(r({id:`haHgQj`}),{description:e})).catch(e=>{console.warn(`[FileSidebar] clipboard write failed:`,e),hs.error(r({id:`5QGTaA`}))});return}case`toggle-show-hidden-files`:{if(K===null)return;let e=K.patch({appearance:{sidebar:{showHiddenFiles:!te}}});e.ok||(console.warn(`[FileSidebar] toggle-show-hidden-files rejected:`,un(e.error)),hs.error(r({id:`P47EWZ`}),{description:un(e.error)}));return}case`expand-all-tree`:i?.expandAll();return;case`collapse-all-tree`:i?.collapseAll();return;case`toggle-sidebar`:v();return;case`delete`:case`toggle-source`:case`save-version`:case`version-history`:case`focus-search`:case`focus-command-palette`:case`close-active-tab-or-window`:case`toggle-doc-panel`:return}})},Ee=[I,i,L,l,m,K,te,H,U,v,r],t[44]=r,t[45]=l,t[46]=U,t[47]=H,t[48]=m,t[49]=K,t[50]=te,t[51]=v,t[52]=i,t[53]=L,t[54]=Te,t[55]=Ee):(Te=t[54],Ee=t[55]),(0,Q.useEffect)(Te,Ee);let De=g&&b&&`motion-safe:delay-100`,Oe=x&&`opacity-0`,ke;t[56]!==De||t[57]!==Oe?(ke=X(`flex-row h-12 items-center py-0 px-3`,`justify-between`,g&&`overflow-x-clip`,g&&`motion-safe:transition-opacity motion-safe:duration-100 motion-safe:ease-out`,De,Oe,g&&`[-webkit-app-region:drag]`),t[56]=De,t[57]=Oe,t[58]=ke):ke=t[58];let Ae;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=g?(0,Z.jsx)(`div`,{"aria-hidden":`true`,"data-testid":`sidebar-traffic-light-reserve`,className:`w-[var(--ok-titlebar-reserve-left,0px)] shrink-0 self-stretch`}):null,t[59]=Ae):Ae=t[59];let je;t[60]===b?je=t[61]:(je=b&&!g?(0,Z.jsx)(`span`,{className:`shrink-0 font-mono text-sm uppercase tracking-wider text-sidebar-foreground/50`,children:(0,Z.jsx)(J,{id:`sER-bs`})}):null,t[60]=b,t[61]=je);let Me;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(Me=X(`flex items-center gap-1`,g&&`[&>*]:[-webkit-app-region:no-drag]`),t[62]=Me):Me=t[62];let Ne;t[63]!==r||t[64]!==k||t[65]!==O||t[66]!==A||t[67]!==i?(Ne=O?(0,Z.jsxs)(Ec,{children:[(0,Z.jsx)(aQ,{icon:rf,label:r({id:`Rq1vFD`})}),(0,Z.jsxs)(bc,{align:`end`,className:`min-w-52`,children:[k?null:(0,Z.jsxs)(vc,{onSelect:()=>i?.expandAll(),children:[(0,Z.jsx)(Gf,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`OlAl5i`})]}),A?null:(0,Z.jsxs)(vc,{onSelect:()=>i?.collapseAll(),children:[(0,Z.jsx)(Gd,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`qvWGzP`})]})]})]}):null,t[63]=r,t[64]=k,t[65]=O,t[66]=A,t[67]=i,t[68]=Ne):Ne=t[68];let Pe;t[69]===r?Pe=t[70]:(Pe=r({id:`HdkSiO`}),t[69]=r,t[70]=Pe);let Fe;t[71]!==m||t[72]!==i?(Fe=()=>i?.startCreating(`file`,m),t[71]=m,t[72]=i,t[73]=Fe):Fe=t[73];let Ie;t[74]!==Pe||t[75]!==Fe?(Ie=(0,Z.jsx)(iQ,{icon:jf,label:Pe,onClick:Fe}),t[74]=Pe,t[75]=Fe,t[76]=Ie):Ie=t[76];let Le;t[77]!==r||t[78]!==F||t[79]!==m||t[80]!==i?(Le=F?(0,Z.jsxs)(Ec,{children:[(0,Z.jsx)(aQ,{icon:ro,label:r({id:`Uuj_R4`})}),(0,Z.jsx)(bc,{align:`end`,className:`min-w-52`,children:(0,Z.jsx)(iJ,{parentDir:m,onSelectTemplate:e=>i?.createFromTemplate(m,e),ItemComponent:vc})})]}):null,t[77]=r,t[78]=F,t[79]=m,t[80]=i,t[81]=Le):Le=t[81];let Re;t[82]===r?Re=t[83]:(Re=r({id:`96G6Re`}),t[82]=r,t[83]=Re);let ze;t[84]!==m||t[85]!==i?(ze=()=>i?.startCreating(`folder`,m),t[84]=m,t[85]=i,t[86]=ze):ze=t[86];let Be;t[87]!==Re||t[88]!==ze?(Be=(0,Z.jsx)(iQ,{icon:qd,label:Re,onClick:ze}),t[87]=Re,t[88]=ze,t[89]=Be):Be=t[89];let Ve;t[90]!==Ne||t[91]!==Ie||t[92]!==Le||t[93]!==Be?(Ve=(0,Z.jsxs)(`div`,{"data-testid":`sidebar-toolbar`,className:Me,children:[Ne,Ie,Le,Be]}),t[90]=Ne,t[91]=Ie,t[92]=Le,t[93]=Be,t[94]=Ve):Ve=t[94];let He;t[95]!==ke||t[96]!==je||t[97]!==Ve?(He=(0,Z.jsxs)(Qj,{"data-electron-drag":g?``:void 0,className:ke,children:[Ae,je,Ve]}),t[95]=ke,t[96]=je,t[97]=Ve,t[98]=He):He=t[98];let Ue=g&&b&&`motion-safe:delay-100`,We=x&&`opacity-0`,Ge;t[99]!==Ue||t[100]!==We?(Ge=X(`px-2 pb-2`,g&&`[-webkit-app-region:no-drag]`,g&&`motion-safe:transition-opacity motion-safe:duration-100 motion-safe:ease-out`,Ue,We),t[99]=Ue,t[100]=We,t[101]=Ge):Ge=t[101];let Ke;t[102]===_?Ke=t[103]:(Ke=[_],t[102]=_,t[103]=Ke);let qe;t[104]===n?qe=t[105]:(qe=(0,Z.jsx)(iZ,{onClick:n}),t[104]=n,t[105]=qe);let Je;t[106]!==Ke||t[107]!==qe?(Je=(0,Z.jsx)(h,{fallbackRender:sQ,onError:rZ,resetKeys:Ke,children:qe}),t[106]=Ke,t[107]=qe,t[108]=Je):Je=t[108];let Xe;t[109]!==Ge||t[110]!==Je?(Xe=(0,Z.jsx)(`div`,{className:Ge,children:Je}),t[109]=Ge,t[110]=Je,t[111]=Xe):Xe=t[111];let Ze;t[112]===Symbol.for(`react.memo_cache_sentinel`)?(Ze=(0,Z.jsx)(VI,{}),t[112]=Ze):Ze=t[112];let Qe;t[113]===Symbol.for(`react.memo_cache_sentinel`)?(Qe=(0,Z.jsx)(Ro,{className:`size-3.5 shrink-0`}),t[113]=Qe):Qe=t[113];let $e;t[114]===V?$e=t[115]:($e=(0,Z.jsx)(`span`,{className:`truncate`,children:V}),t[114]=V,t[115]=$e);let et;t[116]===Symbol.for(`react.memo_cache_sentinel`)?(et=(0,Z.jsx)(na,{className:`size-3.5 shrink-0 text-muted-foreground transition-transform group-data-[state=open]/files:rotate-90`}),t[116]=et):et=t[116];let tt;t[117]===$e?tt=t[118]:(tt=(0,Z.jsx)(nM,{asChild:!0,className:`shrink-0`,children:(0,Z.jsxs)(js,{"data-sidebar-root-context":!0,className:`flex w-full items-center gap-1.5`,children:[Qe,$e,et]})}),t[117]=$e,t[118]=tt);let nt=o==null?`50vh`:`${o}px`,rt;t[119]===nt?rt=t[120]:(rt={height:nt},t[119]=nt,t[120]=rt);let it;t[121]===Symbol.for(`react.memo_cache_sentinel`)?(it=(0,Z.jsx)(AY,{ref:a,onContentHeightChange:s}),t[121]=it):it=t[121];let at;t[122]===rt?at=t[123]:(at=(0,Z.jsx)(As,{className:`flex max-h-[70vh] flex-col overflow-hidden`,style:rt,children:it}),t[122]=rt,t[123]=at);let ot;t[124]!==tt||t[125]!==at?(ot=(0,Z.jsx)(Ms,{defaultOpen:!0,className:`group/files flex shrink-0 flex-col`,children:(0,Z.jsxs)(tM,{className:`min-h-0 px-0`,children:[tt,at]})}),t[124]=tt,t[125]=at,t[126]=ot):ot=t[126];let st;t[127]===Symbol.for(`react.memo_cache_sentinel`)?(st=(0,Z.jsx)(aZ,{}),t[127]=st):st=t[127];let ct;t[128]===i?ct=t[129]:(ct=(0,Z.jsx)(`div`,{"aria-hidden":!0,"data-sidebar-empty-deselect":!0,className:`min-h-8 flex-1 cursor-default`,onClick:()=>i?.clearCreationTarget()}),t[128]=i,t[129]=ct);let lt;t[130]!==ot||t[131]!==ct?(lt=(0,Z.jsxs)(eM,{children:[Ze,ot,st,ct]}),t[130]=ot,t[131]=ct,t[132]=lt):lt=t[132];let ut;t[133]===Symbol.for(`react.memo_cache_sentinel`)?(ut=(0,Z.jsxs)($j,{className:`px-0`,children:[(0,Z.jsx)(EX,{}),(0,Z.jsx)(XZ,{}),typeof window<`u`&&window.okDesktop?(0,Z.jsx)(aM,{children:(0,Z.jsx)(oM,{children:(0,Z.jsx)(JX,{bridge:window.okDesktop})})}):null]}),t[133]=ut):ut=t[133];let dt=!(y&&_===`collapsed`),ft;t[134]===dt?ft=t[135]:(ft=(0,Z.jsx)(Xj,{enableToggle:!1,enableDrag:dt}),t[134]=dt,t[135]=ft);let pt;t[136]!==He||t[137]!==Xe||t[138]!==lt||t[139]!==ft?(pt=(0,Z.jsx)(dP,{asChild:!0,children:(0,Z.jsxs)(`div`,{className:`contents`,onContextMenu:q,children:[He,Xe,lt,ut,ft]})}),t[136]=He,t[137]=Xe,t[138]=lt,t[139]=ft,t[140]=pt):pt=t[140];let mt=!L,ht,gt;t[141]===Symbol.for(`react.memo_cache_sentinel`)?(ht=(0,Z.jsx)(jf,{"aria-hidden":`true`}),gt=(0,Z.jsx)(J,{id:`HdkSiO`}),t[141]=ht,t[142]=gt):(ht=t[141],gt=t[142]);let _t;t[143]!==oe||t[144]!==mt?(_t=(0,Z.jsxs)(hP,{disabled:mt,onSelect:oe,"data-testid":`empty-space-menu-new-file`,children:[ht,gt]}),t[143]=oe,t[144]=mt,t[145]=_t):_t=t[145];let vt;t[146]!==ce||t[147]!==P||t[148]!==L?(vt=P?(0,Z.jsxs)(pP,{children:[(0,Z.jsxs)(gP,{disabled:!L,"data-testid":`empty-space-menu-new-from-template`,children:[(0,Z.jsx)(ro,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`Uuj_R4`})]}),(0,Z.jsx)(_P,{children:(0,Z.jsx)(iJ,{parentDir:``,onSelectTemplate:ce,ItemComponent:hP})})]}):null,t[146]=ce,t[147]=P,t[148]=L,t[149]=vt):vt=t[149];let yt=!L,bt,xt;t[150]===Symbol.for(`react.memo_cache_sentinel`)?(bt=(0,Z.jsx)(qd,{"aria-hidden":`true`}),xt=(0,Z.jsx)(J,{id:`96G6Re`}),t[150]=bt,t[151]=xt):(bt=t[150],xt=t[151]);let St;t[152]!==ue||t[153]!==yt?(St=(0,Z.jsxs)(hP,{disabled:yt,onSelect:ue,"data-testid":`empty-space-menu-new-folder`,children:[bt,xt]}),t[152]=ue,t[153]=yt,t[154]=St):St=t[154];let Ct;t[155]===Symbol.for(`react.memo_cache_sentinel`)?(Ct=(0,Z.jsx)(bP,{}),t[155]=Ct):Ct=t[155];let wt;t[156]!==r||t[157]!==fe||t[158]!==L?(wt=I?(0,Z.jsxs)(hP,{disabled:!L,onSelect:fe,"data-testid":`empty-space-menu-reveal-in-finder`,"aria-label":r(L?{id:`LtSYdi`}:{id:`o2yoFu`}),children:[(0,Z.jsx)(Ro,{"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(J,{id:`LtSYdi`})}),L?null:(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(J,{id:`wTcjov`})})]}):null,t[156]=r,t[157]=fe,t[158]=L,t[159]=wt):wt=t[159];let Tt;t[160]!==U||t[161]!==G||t[162]!==H?(Tt=(0,Z.jsx)(mX,{input:G,installStates:H,dispatch:U}),t[160]=U,t[161]=G,t[162]=H,t[163]=Tt):Tt=t[163];let Et;t[164]!==ge||t[165]!==z?(Et=z?(0,Z.jsxs)(hP,{onSelect:ge,"data-testid":`empty-space-menu-share`,children:[(0,Z.jsx)(Df,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`Z8lGw6`})]}):null,t[164]=ge,t[165]=z,t[166]=Et):Et=t[166];let Dt=!L,Ot;t[167]!==r||t[168]!==L?(Ot=r(L?{id:`Up2_7p`}:{id:`U8CD-l`}),t[167]=r,t[168]=L,t[169]=Ot):Ot=t[169];let At;t[170]===Symbol.for(`react.memo_cache_sentinel`)?(At=(0,Z.jsx)(Oo,{"aria-hidden":`true`}),t[170]=At):At=t[170];let jt;t[171]===Symbol.for(`react.memo_cache_sentinel`)?(jt=(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(J,{id:`Up2_7p`})}),t[171]=jt):jt=t[171];let Mt;t[172]===L?Mt=t[173]:(Mt=L?null:(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(J,{id:`wTcjov`})}),t[172]=L,t[173]=Mt);let Nt;t[174]!==me||t[175]!==Dt||t[176]!==Ot||t[177]!==Mt?(Nt=(0,Z.jsxs)(hP,{disabled:Dt,onSelect:me,"data-testid":`empty-space-menu-copy-full-path`,"aria-label":Ot,children:[At,jt,Mt]}),t[174]=me,t[175]=Dt,t[176]=Ot,t[177]=Mt,t[178]=Nt):Nt=t[178];let Pt;t[179]===Symbol.for(`react.memo_cache_sentinel`)?(Pt=(0,Z.jsx)(bP,{}),t[179]=Pt):Pt=t[179];let Ft=K===null,It;t[180]===Symbol.for(`react.memo_cache_sentinel`)?(It=(0,Z.jsx)(J,{id:`XcGbim`}),t[180]=It):It=t[180];let Lt;t[181]!==ve||t[182]!==te||t[183]!==Ft?(Lt=(0,Z.jsx)(vP,{checked:te,onCheckedChange:ve,disabled:Ft,"data-testid":`empty-space-menu-show-hidden-files`,children:It}),t[181]=ve,t[182]=te,t[183]=Ft,t[184]=Lt):Lt=t[184];let Rt;t[185]===ie?Rt=t[186]:(Rt=ie?(0,Z.jsx)(bP,{}):null,t[185]=ie,t[186]=Rt);let zt;t[187]!==be||t[188]!==ne?(zt=ne?(0,Z.jsxs)(hP,{onSelect:be,"data-testid":`empty-space-menu-expand-all`,children:[(0,Z.jsx)(Gf,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`OlAl5i`})]}):null,t[187]=be,t[188]=ne,t[189]=zt):zt=t[189];let Bt;t[190]!==Se||t[191]!==re?(Bt=re?(0,Z.jsxs)(hP,{onSelect:Se,"data-testid":`empty-space-menu-collapse-all`,children:[(0,Z.jsx)(Gd,{"aria-hidden":`true`}),(0,Z.jsx)(J,{id:`qvWGzP`})]}):null,t[190]=Se,t[191]=re,t[192]=Bt):Bt=t[192];let Vt;t[193]!==_t||t[194]!==vt||t[195]!==St||t[196]!==wt||t[197]!==Tt||t[198]!==Et||t[199]!==Nt||t[200]!==Lt||t[201]!==Rt||t[202]!==zt||t[203]!==Bt?(Vt=(0,Z.jsxs)(mP,{className:`min-w-52`,children:[_t,vt,St,Ct,wt,Tt,Et,Nt,Pt,Lt,Rt,zt,Bt]}),t[193]=_t,t[194]=vt,t[195]=St,t[196]=wt,t[197]=Tt,t[198]=Et,t[199]=Nt,t[200]=Lt,t[201]=Rt,t[202]=zt,t[203]=Bt,t[204]=Vt):Vt=t[204];let Ht;return t[205]!==pt||t[206]!==Vt?(Ht=(0,Z.jsx)(Jj,{variant:`inset`,children:(0,Z.jsxs)(uP,{children:[pt,Vt]})}),t[205]=pt,t[206]=Vt,t[207]=Ht):Ht=t[207],Ht}function sQ(){return null}function cQ(e){return console.log(e)}function lQ(e){return hs.error(e)}function uQ(e){return hs.success(e)}function dQ(e){e.target instanceof Element&&e.target.closest(`[data-sidebar-root-context]`)||nQ(e.target)&&(e.preventDefault(),e.stopPropagation())}var fQ=(0,Q.lazy)(()=>n(()=>import(`./McpConsentDialogBody-iiKQkaSO.js`),__vite__mapDeps([104,1,10,3,11,6,7,81,20,21,15,13,16,63,64,61,62,83,19,31,70,42,105]),import.meta.url));function pQ(){let e=(0,$.c)(1);if(!(0,Q.useSyncExternalStore)(rd.subscribe,hQ,mQ))return null;let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(fQ,{})}),e[0]=t):t=e[0],t}function mQ(){return!1}function hQ(){return rd.getSnapshot()!==null}function gQ(){let e=(0,$.c)(17),t=tn(),{collabUrl:n,setSystemProvider:r,updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c}=Ye(),l;e[0]!==o||e[1]!==s||e[2]!==a||e[3]!==c||e[4]!==i?(l={updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c},e[0]=o,e[1]=s,e[2]=a,e[3]=c,e[4]=i,e[5]=l):l=e[5];let u=(0,Q.useRef)(l),d;e[6]!==o||e[7]!==s||e[8]!==a||e[9]!==c||e[10]!==i?(d=()=>{u.current={updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c}},e[6]=o,e[7]=s,e[8]=a,e[9]=c,e[10]=i,e[11]=d):d=e[11],(0,Q.useEffect)(d);let f,p;return e[12]!==n||e[13]!==t||e[14]!==r?(f=()=>{if(n===null)return;let e=new Fl,i=new Nl({url:n,name:gr,document:e,onStateless:e=>{let{payload:t}=e;b(t,{onServerInfo:e=>{u.current.updateServerInstanceId(e.serverInstanceId),e.currentBranch!==void 0&&u.current.observeBranch(e.currentBranch)},onBranchSwitched:e=>{u.current.onBranchSwitched(e.branch)},onDiskAck:e=>{u.current.observeDiskAck(e.docName,e.sv)},onDerivedView:SQ,onConfigValidationRejected:xQ,onConfigIgnoreNestedError:bQ,onUnknown:yQ})},onClose:vQ,onDisconnect:_Q}),a=dl(e=>{(e.includes(`files`)||e.includes(`backlinks`))&&(t.invalidateQueries({queryKey:[`backlinks`]}),t.invalidateQueries({queryKey:[`forward-links`]})),(e.includes(`files`)||e.includes(`graph`))&&(t.invalidateQueries({queryKey:[`orphans`]}),t.invalidateQueries({queryKey:[`hubs`]}))}),o=j(()=>{u.current.refreshServerInfo()});i.on(`synced`,()=>{ul([`files`,`backlinks`,`graph`]),o()});let s=new Set,c=()=>{if(i.awareness)for(let[e,t]of i.awareness.getStates().entries())s.has(e)||t.user?.type===`agent`&&(s.add(e),console.warn(`[agent-presence] observed stale AwarenessUser.type === 'agent' from clientID ${e} — probably a stale bundled client`))};return i.awareness?.on(`change`,c),r(i),()=>{a(),i.awareness?.off(`change`,c),r(null),i.destroy(),e.destroy()}},p=[t,n,r],e[12]=n,e[13]=t,e[14]=r,e[15]=f,e[16]=p):(f=e[15],p=e[16]),(0,Q.useEffect)(f,p),null}function _Q(){console.warn(`[CC1] __system__ disconnected - derived views may be stale`)}function vQ(e){let{event:t}=e;console.warn(`[CC1] __system__ connection closed:`,t.code,t.reason)}function yQ(e){console.warn(`[CC1] Unparseable stateless payload, skipping:`,e.slice(0,100))}function bQ(e){$a(e)}function xQ(e){go(e)}function SQ(e){ul([e.ch])}function CQ(e){let t=Ce(e);if(t)return{scope:`project`,name:t};let n=er(e);return n?.kind===`skill`?{scope:n.scope,name:n.name}:null}function wQ(e,t){let n=new Set(t.map(e=>`${e.scope}\u0000${e.name}`)),r=[];for(let t of e){let e=CQ(t);if(!e||n.has(`${e.scope}\u0000${e.name}`))continue;let i=e.scope===`project`?`global`:`project`;n.has(`${i}\u0000${e.name}`)?r.push({kind:`retarget`,fromDocName:t,toDocName:Rn(i,e.name)}):r.push({kind:`close`,docName:t})}return r}function TQ(){let e=(0,$.c)(13),{openTabs:t,closeDocument:n}=Ye(),r;e[0]===t?r=e[1]:(r=t.some(DQ),e[0]=t,e[1]=r);let i=r,a;e[2]===i?a=e[3]:(a={enabled:i},e[2]=i,e[3]=a);let o=_a(a),s=(0,Q.useRef)(null),c;e[4]!==n||e[5]!==t||e[6]!==o.data||e[7]!==o.status?(c=()=>{if(o.status!==`ready`)return;let e=o.data,r=`${t.join(``)}\u0002${e.map(EQ).sort().join(``)}`;if(s.current===r)return;s.current=r;let i=wQ(t,e);for(let e of i)e.kind===`retarget`?(Zo(e.toDocName),n(e.fromDocName)):n(e.docName)},e[4]=n,e[5]=t,e[6]=o.data,e[7]=o.status,e[8]=c):c=e[8];let l;e[9]!==n||e[10]!==t||e[11]!==o?(l=[o,t,n],e[9]=n,e[10]=t,e[11]=o,e[12]=l):l=e[12],(0,Q.useEffect)(c,l)}function EQ(e){return`${e.scope}\u0000${e.name}`}function DQ(e){return CQ(e)!==null}var OQ=1e3,kQ=3e4;function AQ(e){let t=e.scheduler??{setTimeout:(e,t)=>globalThis.setTimeout(e,t),clearTimeout:e=>globalThis.clearTimeout(e)},n=e.initialBackoffMs??OQ,r=e.maxBackoffMs??kQ,i=e.rng??Math.random,a=e.createWebSocket??(e=>new WebSocket(e)),o=e.logger??null,s=e.log,c=null,l=null,u=!1,d=n;function f(e,t,n){try{o?o[e](t,n):s?.(t)}catch{}}function p(){if(u)return;l!==null&&t.clearTimeout(l);let e=d;d=Math.min(d*2,r);let n=i(),a=Math.max(1,Math.floor(e*(1-n/2)));f(`debug`,`scheduling reconnect`,{backoffMs:a,ceilMs:e}),l=t.setTimeout(()=>{l=null,m().catch(e=>f(`warn`,`reconnect failed`,{error:String(e)}))},a)}async function m(){if(u)return;let t;try{t=await e.resolveWsUrl()}catch(e){f(`warn`,`resolveWsUrl threw`,{error:String(e)}),p();return}if(!t){p();return}let r=[];e.pid!==void 0&&r.push(`pid=${encodeURIComponent(String(e.pid))}`),e.connectionId&&r.push(`connectionId=${encodeURIComponent(e.connectionId)}`),e.connectionId&&e.displayName!==void 0&&e.clientName!==void 0&&e.colorSeed!==void 0&&(r.push(`displayName=${encodeURIComponent(e.displayName)}`),r.push(`clientName=${encodeURIComponent(e.clientName)}`),r.push(`colorSeed=${encodeURIComponent(e.colorSeed)}`));let i=r.length>0?`?${r.join(`&`)}`:``,o=`${t}/collab/keepalive${i}`;try{c=a(o)}catch(e){f(`warn`,`WebSocket constructor failed`,{url:o,error:String(e)}),c=null,p();return}c.addEventListener(`open`,()=>{f(`info`,`connected`,{url:t}),d=n}),c.addEventListener(`close`,()=>{u||(f(`info`,`disconnected`,{url:t}),c=null,p())}),c.addEventListener(`error`,()=>{f(`debug`,`websocket error observed`,{url:t,readyState:c?.readyState,reason:`error-event`})})}return queueMicrotask(()=>{m().catch(e=>f(`warn`,`initial connect failed`,{error:String(e)}))}),{close:()=>{if(!u&&(u=!0,l!==null&&(t.clearTimeout(l),l=null),c)){try{c.close()}catch{}c=null}},isConnected:()=>c!==null&&c.readyState===1}}function jQ(e){if(e)return e.replace(/\/collab\/?$/,``)}function MQ(){return V(window)!==null}function NQ(e,t){let n=(0,$.c)(5),r=(0,Q.useRef)(e),i=(0,Q.useRef)(t),a,o;n[0]===e?(a=n[1],o=n[2]):(a=()=>{r.current=e},o=[e],n[0]=e,n[1]=a,n[2]=o),(0,Q.useEffect)(a,o);let s,c;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{let e=i.current?.startKeepalive??AQ;if((i.current?.isElectronHost??MQ)())return;let t=e({resolveWsUrl:async()=>jQ(r.current)});return()=>t.close()},c=[],n[3]=s,n[4]=c):(s=n[3],c=n[4]),(0,Q.useEffect)(s,c)}var PQ=(0,Q.lazy)(()=>n(()=>import(`./ShareBranchSwitchDialog-DCB8oBto.js`).then(e=>({default:e.ShareBranchSwitchDialog})),__vite__mapDeps([106,1,6,7,13,61,15,16,62,69,71,107,108,109,110,10,3,11]),import.meta.url)),FQ=(0,Q.lazy)(()=>n(()=>import(`./ShareReceiveMissDialog-CXxQa4KW.js`).then(e=>({default:e.ShareReceiveMissDialog})),__vite__mapDeps([111,1,61,6,7,15,13,16,62,112,86,10,3,11,55,40,56,68,36,31,64,57,70,71,107,88,39,34,42]),import.meta.url)),IQ=`#install-claude-desktop`,LQ=/\.(md|mdx)$/i;function RQ(e){return e===`#settings`||e===IQ}function zQ(e,t){if(!LQ.test(e))return null;for(let n of t){let t=Be(n);if(t.kind===`doc`&&t.docName===e)return{kind:`doc`,target:e,docName:e}}return null}function BQ(e,t,n,r){return[e,t,n,r].map(e=>[...e].sort().join(`\0`)).join(``)}function VQ(){let e=(0,$.c)(26),{clearTarget:t,openTabs:n,syncOpenTabsWithKnownTargets:r,tabSessionLoaded:i}=Ye(),{openTargetTransition:a}=at();TQ();let{assetPaths:o,filePaths:s,folderPaths:c,loading:l,pageMeta:u,pages:d,pagesBySlug:f,pagesByBasename:p}=ia(),m=(0,Q.useRef)(null),h;e[0]!==o||e[1]!==s||e[2]!==c||e[3]!==d?(h=BQ(d,c,o,s),e[0]=o,e[1]=s,e[2]=c,e[3]=d,e[4]=h):h=e[4];let g=h,_,v;e[5]!==o||e[6]!==s||e[7]!==c||e[8]!==l||e[9]!==d||e[10]!==r||e[11]!==i||e[12]!==g?(_=()=>{l||!i||m.current===g||(m.current=g,r({pages:d,folderPaths:c,assetPaths:o,filePaths:s}))},v=[o,s,c,l,d,r,i,g],e[5]=o,e[6]=s,e[7]=c,e[8]=l,e[9]=d,e[10]=r,e[11]=i,e[12]=g,e[13]=_,e[14]=v):(_=e[13],v=e[14]),(0,Q.useEffect)(_,v);let y,b;return e[15]!==t||e[16]!==c||e[17]!==l||e[18]!==n||e[19]!==a||e[20]!==u||e[21]!==d||e[22]!==p||e[23]!==f?(y=()=>{e();function e(){if(RQ(window.location.hash))return;let e=Cl(window.location.hash);if(e){let t=Hn(e.split(`.`).pop()??``);ml(`ok/nav/hash-change`,{docName:null,kind:`asset`}),a({kind:`asset`,target:e,assetPath:e,mediaKind:t});return}let r=bl(window.location.hash);if(r){ml(`ok/nav/hash-change`,{docName:null,kind:`skill-file`}),a({kind:`skill-file`,target:`${r.scope}/${r.name}/${r.path}`,scope:r.scope,name:r.name,path:r.path});return}if(Ol(window.location.hash)){ml(`ok/nav/hash-change`,{docName:null,kind:`folder`}),a({kind:`folder`,target:``,folderPath:``});return}let i=Tl(window.location.hash);if(!i){ml(`ok/nav/hash-change`,{docName:null,kind:`clear`}),t();return}if(l){ml(`ok/nav/hash-change`,{docName:i,kind:`deferred-loading`});return}let o=zQ(i,n)??Yc(i,{pages:d,folderPaths:c,pagesBySlug:f,pagesByBasename:p});if(o.kind===`missing`&&/\/+$/.test(i.trim())){ml(`ok/nav/hash-change`,{docName:i,kind:`deferred-missing-folder`});return}let s=nl(il(o),u);ml(`ok/nav/hash-change`,{docName:i,kind:s.kind}),a(s)}return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},b=[t,c,l,a,n,u,d,f,p],e[15]=t,e[16]=c,e[17]=l,e[18]=n,e[19]=a,e[20]=u,e[21]=d,e[22]=p,e[23]=f,e[24]=y,e[25]=b):(y=e[24],b=e[25]),(0,Q.useEffect)(y,b),null}function HQ(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0],(0,Q.useEffect)(UQ,t),null}function UQ(){let e=KQ;if(!e(window.location.hash))return;let t=new AbortController;return T(t.signal).then(n=>{if(t.signal.aborted||n.status!==`ok`)return;let r=n.config.paneTarget;r?.startsWith(`#/`)&&e(window.location.hash)&&(window.location.hash=r,fetch(`/api/config`,{method:`DELETE`}).catch(GQ))}).catch(WQ),()=>t.abort()}function WQ(){}function GQ(){}function KQ(e){return!RQ(e)&&!Cl(e)&&!Tl(e)&&(e===``||e===`#`||e===`#/`)}function qQ(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0],(0,Q.useEffect)(JQ,t),null}function JQ(){let e=function(e){let t=e.target;Za({target:t,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,key:e.key})&&(e.preventDefault(),window.location.hash!==`#settings`&&(window.location.hash=Ya))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)}function YQ(){let e=(0,$.c)(4),{activeTarget:t}=Ye(),n=typeof window<`u`?window.okDesktop??null:null,r=t?.kind===`doc`||t?.kind===`folder`||t?.kind===`asset`?t.kind:null,i=t?.kind===`doc`?t.docName:t?.kind===`folder`?t.folderPath:t?.kind===`asset`?t.assetPath:null,a,o;return e[0]!==i||e[1]!==r?(a=()=>{if(n){if(r===null){n.editor.notifyActiveTargetChanged({kind:null});return}i!==null&&n.editor.notifyActiveTargetChanged({kind:r,identifier:i})}},o=[n,r,i],e[0]=i,e[1]=r,e[2]=a,e[3]=o):(a=e[2],o=e[3]),(0,Q.useEffect)(a,o),null}function XQ(){let e=(0,$.c)(8),{activeDocName:t,activeTarget:n}=Ye(),[r,i]=(0,Q.useState)(!1),a;e[0]!==t||e[1]!==n?(a=n?.kind===`folder`?n.folderPath:al(t),e[0]=t,e[1]=n,e[2]=a):a=e[2];let o=a,s,c;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{let e=function(e){let t=e.target;yh({target:t,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,key:e.key})&&(e.preventDefault(),i(!0))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},c=[],e[3]=s,e[4]=c):(s=e[3],c=e[4]),(0,Q.useEffect)(s,c);let l;return e[5]!==r||e[6]!==o?(l=(0,Z.jsx)(xh,{open:r,onOpenChange:i,kind:`file`,initialDir:o}),e[5]=r,e[6]=o,e[7]=l):l=e[7],l}function ZQ(e){let t=(0,$.c)(3),{children:n}=e,{collabUrl:r}=Ye();NQ(r);let i;return t[0]!==n||t[1]!==r?(i=(0,Z.jsx)(Ll,{collabUrl:r,children:n}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i}function QQ(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(hl,{name:`app`,children:(0,Z.jsx)(dt,{children:(0,Z.jsx)(ZQ,{children:(0,Z.jsx)(mg,{children:(0,Z.jsx)($Q,{})})})})}),e[0]=t):t=e[0],t}function $Q(){let e=(0,$.c)(25),t=typeof window<`u`?window.okDesktop??null:null,n=typeof window<`u`&&window.okDesktop!=null,[r,i]=(0,Q.useState)(!1),a=_g(),o;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=t?{launchInTerminal:e$}:null,e[0]=o):o=e[0];let s=o,c;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(Wg,{}),e[1]=c):c=e[1];let l,u,d,f,p;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(gQ,{}),u=(0,Z.jsx)(VQ,{}),d=(0,Z.jsx)(HQ,{}),f=(0,Z.jsx)(YQ,{}),p=(0,Z.jsx)(XQ,{}),e[2]=l,e[3]=u,e[4]=d,e[5]=f,e[6]=p):(l=e[2],u=e[3],d=e[4],f=e[5],p=e[6]);let m;e[7]===a?m=e[8]:(m=!a&&(0,Z.jsx)(qQ,{}),e[7]=a,e[8]=m);let h,g,_,v;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(_=!1,v=t?(0,Z.jsx)(Gg,{bridge:t}):null,h=(0,Z.jsx)(pQ,{}),g=t?(0,Z.jsxs)(Q.Suspense,{fallback:null,children:[(0,Z.jsx)(PQ,{bridge:t}),(0,Z.jsx)(FQ,{})]}):null,e[9]=h,e[10]=g,e[11]=_,e[12]=v):(h=e[9],g=e[10],_=e[11],v=e[12]);let y;e[13]===r?y=e[14]:(y=(0,Z.jsx)(Ng,{bridge:t,open:r,onOpenChange:i}),e[13]=r,e[14]=y);let b;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(b=n&&(0,Z.jsx)(`div`,{"aria-hidden":`true`,"data-testid":`editor-window-chrome-drag-strip`,"data-electron-drag":``,className:`pointer-events-none fixed inset-x-0 top-0 z-50 h-2 [-webkit-app-region:drag]`}),e[15]=b):b=e[15];let x;e[16]===a?x=e[17]:(x=!a&&(0,Z.jsx)(rQ,{onOpenSearch:()=>i(!0)}),e[16]=a,e[17]=x);let S;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(Zj,{className:`overflow-hidden h-[calc(100vh-var(--layout-inset-offset))]`,children:(0,Z.jsx)(II,{onOpenSearch:()=>i(!0)})}),e[18]=S):S=e[18];let C;e[19]===x?C=e[20]:(C=(0,Z.jsx)(va,{value:s,children:(0,Z.jsxs)(Gj,{className:`h-screen overflow-hidden`,children:[x,S]})}),e[19]=x,e[20]=C);let w;return e[21]!==y||e[22]!==C||e[23]!==m?(w=(0,Z.jsxs)(Z.Fragment,{children:[c,(0,Z.jsxs)(aa,{children:[l,u,d,f,p,m,_,v,h,g,y,b,C]})]}),e[21]=y,e[22]=C,e[23]=m,e[24]=w):w=e[24],w}function e$(e,t){eI(Oa(e,t),t)}function t$(e){let t=/\/([^/]+?)(?:\.git)?\/?$/.exec(e);return t?t[1]:`repo`}function n$(e){return{async getAuthStatus(){return e.authQueryTransport.status()},async startSignIn(){return e.openSignIn()},async runClone({url:t,branch:n}){let r=await e.bridge.dialog.openFolder();if(!r)return{kind:`cancelled`};let i=t$(t),a=`${r.replace(/\/$/,``)}/${i}`,o=hs.loading(Gc._({id:`GXf9hG`,values:{repoName:i}}),{duration:1/0}),s=typeof n==`string`&&n.length>0?n:null;try{let n=e.cloneTransport.start({url:t,dir:a,branch:s});for await(let e of n.events){if(e.type===`progress`){let t=e.phase,n=Math.round(e.pct);hs.loading(Gc._({id:`GXf9hG`,values:{repoName:i}}),{id:o,description:Gc._({id:`SCzAbA`,values:{phase:t,pct:n}}),duration:1/0});continue}if(e.type===`branch-fallback`){console.log(ad({branch_action:`fallback`,branch:e.branch})),hs.info(Gc._({id:`3JYy1p`,values:{0:e.branch}}),{duration:8e3});continue}if(e.type===`complete`)return hs.success(Gc._({id:`IRv9cH`,values:{repoName:i}}),{id:o,duration:4e3}),{kind:`ok`,dir:e.dir};if(e.type===`error`)return hs.dismiss(o),{kind:`error`,detail:e.message}}return hs.dismiss(o),{kind:`error`,detail:`Clone ended unexpectedly.`}}catch(e){console.warn(`[clone-controller] clone transport threw`,e);let t=e instanceof Error?e.message:`Unknown error`;return hs.dismiss(o),{kind:`error`,detail:t}}}}}function r$(){return{start(e){return za((t,n)=>{(async()=>{try{let r=await fetch(`/api/local-op/clone`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({url:e.url,dir:e.dir||void 0,branch:typeof e.branch==`string`&&e.branch.length>0?e.branch:void 0}),signal:n});if(!r.ok){let e=`Clone failed — check the URL and try again (${r.status})`;try{let t=await r.json(),n=sr.safeParse(t);n.success&&(e=`Clone failed: ${n.data.title}`)}catch{}t({type:`error`,message:e});return}if(!r.body){t({type:`error`,message:`Clone failed — empty response body`});return}let i=r.body.getReader(),a=new TextDecoder,o=``;for(;;){let{done:e,value:r}=await i.read();if(e)break;o+=a.decode(r,{stream:!0});let s=o.split(`
2003
+ `);o=s.pop()??``;for(let e of s){if(!e.trim())continue;let n;try{n=JSON.parse(e)}catch{console.warn(`[clone-transport] Dropped unparseable NDJSON line:`,e.slice(0,100));continue}if(n&&typeof n==`object`&&n.type===`error`&&`problem`in n){let e=n.problem;t({type:`error`,message:e?.detail||e?.title||`Unknown error`});break}t(n)}if(n.aborted)break}n.aborted||t({type:`error`,message:`Clone stream ended unexpectedly — check if the clone completed`})}catch(e){if(e instanceof Error&&e.name===`AbortError`)return;t({type:`error`,message:`Clone failed — connection error`})}})()})}}}function i$(e){return{start(t){let n=typeof t.branch==`string`&&t.branch.length>0?t.branch:null;return e.localOp.clone.start({url:t.url,dir:t.dir,branch:n})}}}function a$(e){switch(e){case`receiving`:return{id:`qbfj1f`};case`resolving`:return{id:`adsMWO`};case`checking`:return{id:`1HBhDS`};case`init`:return{id:`LlHqdU`};case`done`:return{id:`bD8I7O`};default:return{id:`25Pw6a`}}}function o$(e){let t=e.trim();if(/^[\w.-]+\/[\w.-]+$/.test(t))return t.split(`/`)[1];try{return new URL(t.replace(/^git@([^:]+):/,`https://$1/`)).pathname.replace(/\.git$/,``).split(`/`).pop()??`repo`}catch{return t.split(`/`).pop()?.replace(/\.git$/,``)??`repo`}}function s$(e){let t=(0,$.c)(100),{open:n,onOpenChange:r,onSignIn:i,onCloneComplete:a,transport:o,authQueryTransport:s,pickParentFolder:c,initialUrl:l}=e,{_:u}=kt(),d;t[0]===o?d=t[1]:(d=o??r$(),t[0]=o,t[1]=d);let f=d,p;t[2]===s?p=t[3]:(p=s??ho(),t[2]=s,t[3]=p);let m=p,h=c!==void 0,[g,_]=(0,Q.useState)(``),[v,y]=(0,Q.useState)(``),[b,x]=(0,Q.useState)(null),[S,C]=(0,Q.useState)(!1),T;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(T=yo(),t[4]=T):T=t[4];let[E,D]=(0,Q.useState)(T),[O,k]=(0,Q.useState)(!1),[A,j]=(0,Q.useState)(!1),[M,N]=(0,Q.useState)(-1),P=(0,Q.useRef)(null),F=(0,Q.useRef)(null),I=(0,Q.useRef)(null),L=(0,Q.useId)(),R;t[5]!==n||t[6]!==m?(R=()=>{if(!n)return;let e=!1;return m.status().then(t=>{fo(t.authenticated),e||D(t.authenticated)}).catch(()=>{e||D(!1)}),()=>{e=!0}},t[5]=n,t[6]=m,t[7]=R):R=t[7];let z;t[8]===n?z=t[9]:(z=[n],t[8]=n,t[9]=z),(0,Q.useEffect)(R,z);let B;t[10]!==E||t[11]!==n||t[12]!==m?(B=()=>{if(!E||!n)return;let e=!1;return C(!0),m.repos().then(t=>{e||(x(t.ok?t.repos:[]),C(!1))}).catch(()=>{e||(x([]),C(!1))}),()=>{e=!0}},t[10]=E,t[11]=n,t[12]=m,t[13]=B):B=t[13];let V;t[14]!==E||t[15]!==n?(V=[E,n],t[14]=E,t[15]=n,t[16]=V):V=t[16],(0,Q.useEffect)(B,V);let H,U;t[17]!==l||t[18]!==n||t[19]!==h?(H=()=>{if(!n||!l||(_(l),h))return;let e=o$(l);e&&y(`~/Documents/${e}`)},U=[n,l,h],t[17]=l,t[18]=n,t[19]=h,t[20]=H,t[21]=U):(H=t[20],U=t[21]),(0,Q.useEffect)(H,U);let W,G;t[22]!==M||t[23]!==L?(W=()=>{M<0||document.getElementById(`${L}-opt-${M}`)?.scrollIntoView({block:`nearest`})},G=[M,L],t[22]=M,t[23]=L,t[24]=W,t[25]=G):(W=t[24],G=t[25]),(0,Q.useEffect)(W,G);let K;t[26]===h?K=t[27]:(K=function(e){if(_(e),j(!0),N(-1),h)return;let t=o$(e);t&&y(`~/Documents/${t}`)},t[26]=h,t[27]=K);let ee=K,te;t[28]===h?te=t[29]:(te=function(e){if(_(e.clone_url),h)return;let t=e.full_name.split(`/`)[1];y(`~/Documents/${t}`)},t[28]=h,t[29]=te);let ne=te,re;t[30]!==u||t[31]!==v||t[32]!==a||t[33]!==r||t[34]!==c||t[35]!==f||t[36]!==g?(re=async function(){let e=g.trim();if(!e){hs.error(u({id:`FTUGgh`}));return}let t=v||``;if(c){k(!0);let n=await c();if(!n){k(!1);return}let r=o$(e);t=`${n.replace(/\/$/,``)}/${r}`}else k(!0);let n=hs.loading(u({id:`2tgFCe`}),{duration:1/0});F.current=n;let i=f.start({url:e,dir:t});P.current=i.cancel;try{let e=i.events[Symbol.asyncIterator](),t=await e.next();for(;!t.done;){let i=t.value;if(i.type===`progress`){let e=u(a$(i.phase));hs.loading(`${e} — ${i.pct}%`,{id:n})}else if(i.type===`complete`){hs.success(u({id:`u_lS4C`}),{id:n}),r(!1),k(!1),P.current=null;let e=`port`in i?i.port:void 0;a?a({port:e,dir:i.dir}):e!==void 0&&(window.location.href=`http://localhost:${e}`);return}else if(i.type===`error`){let e=i.message;hs.error(u({id:`eFJkVt`,values:{cloneError:e}}),{id:n}),k(!1),P.current=null;return}t=await e.next()}hs.error(u({id:`Tz9pJB`}),{id:n}),k(!1),P.current=null}catch(e){console.error(`[CloneDialog] clone iteration failed:`,e),hs.error(u({id:`K9J00P`}),{id:n}),k(!1),P.current=null}},t[30]=u,t[31]=v,t[32]=a,t[33]=r,t[34]=c,t[35]=f,t[36]=g,t[37]=re):re=t[37];let q=re,oe;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(oe=function(){P.current?.(),P.current=null,k(!1),hs.dismiss(F.current??void 0)},t[38]=oe):oe=t[38];let se=oe,ce;t[39]!==O||t[40]!==r||t[41]!==h?(ce=function(e){O||(r(e),e||(_(``),h||y(``),j(!1),N(-1)))},t[39]=O,t[40]=r,t[41]=h,t[42]=ce):ce=t[42];let le=ce,ue;t[43]===ne?ue=t[44]:(ue=function(e){ne(e),j(!1),N(-1),I.current?.focus()},t[43]=ne,t[44]=ue);let de=ue,fe=E===null||S&&b===null,pe;if(t[45]!==b||t[46]!==g){let e=g.trim().toLowerCase(),n;t[48]===b?n=t[49]:(n=b??[],t[48]=b,t[49]=n),pe=n.filter(t=>`${t.full_name} ${t.clone_url}`.toLowerCase().includes(e)),t[45]=b,t[46]=g,t[47]=pe}else pe=t[47];let me=pe,he;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(he=/:\/\/|^git@|\.git$/i,t[50]=he):he=t[50];let ge;t[51]===g?ge=t[52]:(ge=he.test(g.trim()),t[51]=g,t[52]=ge);let _e=ge,ve=E===!0&&b!==null&&me.length===0&&!_e,ye=A&&E!==!1&&!O&&(fe||me.length>0||ve),be=me.length,xe=`${L}-loading`,Se,Ce;t[53]===be?(Se=t[54],Ce=t[55]):(Se=()=>{N(e=>e>=be?be-1:e)},Ce=[be],t[53]=be,t[54]=Se,t[55]=Ce),(0,Q.useEffect)(Se,Ce);let we;t[56]!==M||t[57]!==O||t[58]!==ye||t[59]!==de||t[60]!==me?(we=function(e){if(!O)if(e.key===`ArrowDown`){if(e.preventDefault(),!ye){j(!0);return}N(e=>Math.min(e+1,me.length-1))}else e.key===`ArrowUp`?(e.preventDefault(),N(p$)):e.key===`Enter`?ye&&M>=0&&M<me.length&&(e.preventDefault(),de(me[M])):e.key===`Escape`&&ye&&(e.preventDefault(),e.stopPropagation(),j(!1),N(-1))},t[56]=M,t[57]=O,t[58]=ye,t[59]=de,t[60]=me,t[61]=we):we=t[61];let Te=we,Ee;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=(0,Z.jsx)(Rs,{children:(0,Z.jsx)(Ps,{children:(0,Z.jsx)(J,{id:`VdXv4D`})})}),t[62]=Ee):Ee=t[62];let De;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(De=(0,Z.jsx)(`label`,{htmlFor:`clone-source`,className:`text-sm font-medium`,children:(0,Z.jsx)(J,{id:`IreQBq`})}),t[63]=De):De=t[63];let Oe;t[64]!==u||t[65]!==M||t[66]!==O||t[67]!==Te||t[68]!==ee||t[69]!==E||t[70]!==L||t[71]!==xe||t[72]!==i||t[73]!==ye||t[74]!==fe||t[75]!==b||t[76]!==de||t[77]!==me||t[78]!==g?(Oe=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[De,E===!1?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Uc,{id:`clone-source`,placeholder:u({id:`Xv_ijG`}),value:g,onChange:e=>ee(e.target.value),disabled:O}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-1sm text-muted-foreground`,children:[(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`9oE4C3`})}),(0,Z.jsx)(Jr,{variant:`link`,className:`h-auto p-0`,onClick:()=>i?.(),disabled:O,children:(0,Z.jsx)(J,{id:`3jod3l`})})]})]}):(0,Z.jsxs)(ae,{open:ye,onOpenChange:j,children:[(0,Z.jsx)(w,{asChild:!0,children:(0,Z.jsx)(Uc,{id:`clone-source`,ref:I,role:`combobox`,"aria-expanded":ye,"aria-controls":ye?fe?xe:L:void 0,"aria-activedescendant":M>=0?`${L}-opt-${M}`:void 0,"aria-autocomplete":`list`,autoComplete:`off`,placeholder:u({id:`R0jJzV`}),value:g,onChange:e=>ee(e.target.value),onFocus:()=>j(!0),onKeyDown:Te,disabled:O})}),(0,Z.jsx)(ie,{align:`start`,sideOffset:4,className:`w-(--radix-popover-trigger-width) max-h-56 overflow-y-auto overscroll-y-contain subtle-scrollbar p-0`,onOpenAutoFocus:f$,onCloseAutoFocus:d$,onInteractOutside:e=>{I.current?.contains(e.target)&&e.preventDefault()},onWheel:u$,onTouchMove:l$,children:fe?(0,Z.jsxs)(`output`,{id:xe,className:`flex flex-col gap-1.5 px-3 py-2`,"aria-label":u({id:`8XQRON`}),children:[(0,Z.jsx)(Ka,{className:`h-4 w-2/3`}),(0,Z.jsx)(Ka,{className:`h-4 w-1/2`}),(0,Z.jsx)(Ka,{className:`h-4 w-3/4`}),(0,Z.jsx)(Ka,{className:`h-4 w-2/5`})]}):(0,Z.jsx)(`div`,{id:L,role:`listbox`,"aria-label":u({id:`KX1MZR`}),className:`py-1`,children:me.length===0?(0,Z.jsx)(`div`,{role:`presentation`,className:`px-3 py-2 text-xs text-muted-foreground`,children:b&&b.length===0?(0,Z.jsx)(J,{id:`cOSAfL`}):(0,Z.jsx)(J,{id:`8eW0WQ`})}):me.map((e,t)=>(0,Z.jsxs)(`div`,{id:`${L}-opt-${t}`,role:`option`,tabIndex:-1,"aria-selected":t===M,onMouseDown:c$,onMouseEnter:()=>N(t),onClick:()=>de(e),className:X(`flex cursor-default items-center gap-2 px-3 py-1.5 text-sm`,t===M&&`bg-accent text-accent-foreground`),children:[e.private?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(sf,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`n5n_vi`})})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ra,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`NuH1jp`})})]}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.full_name})]},e.full_name))})})]})]}),t[64]=u,t[65]=M,t[66]=O,t[67]=Te,t[68]=ee,t[69]=E,t[70]=L,t[71]=xe,t[72]=i,t[73]=ye,t[74]=fe,t[75]=b,t[76]=de,t[77]=me,t[78]=g,t[79]=Oe):Oe=t[79];let ke;t[80]!==O||t[81]!==v||t[82]!==h?(ke=!h&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`label`,{htmlFor:`clone-path`,className:`text-sm font-medium`,children:(0,Z.jsx)(J,{id:`Gp_twO`})}),(0,Z.jsx)(Uc,{id:`clone-path`,placeholder:`~/Documents/repo-name`,value:v,onChange:e=>y(e.target.value),disabled:O})]}),t[80]=O,t[81]=v,t[82]=h,t[83]=ke):ke=t[83];let Ae;t[84]!==Oe||t[85]!==ke?(Ae=(0,Z.jsx)(Is,{children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[Oe,ke]})}),t[84]=Oe,t[85]=ke,t[86]=Ae):Ae=t[86];let je;t[87]!==O||t[88]!==q||t[89]!==le||t[90]!==g||t[91]!==h?(je=(0,Z.jsx)(Ls,{children:O?(0,Z.jsx)(Jr,{variant:`outline`,className:`font-mono uppercase`,onClick:se,children:(0,Z.jsx)(J,{id:`dEgA5A`})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Jr,{variant:`outline`,className:`font-mono uppercase`,onClick:()=>le(!1),children:(0,Z.jsx)(J,{id:`dEgA5A`})}),(0,Z.jsx)(Jr,{onClick:()=>void q(),disabled:!g.trim(),"aria-describedby":h?`clone-picker-hint`:void 0,children:(0,Z.jsx)(J,{id:`9UQ730`})}),h&&(0,Z.jsx)(`span`,{id:`clone-picker-hint`,className:`sr-only`,children:(0,Z.jsx)(J,{id:`EvPX7f`})})]})}),t[87]=O,t[88]=q,t[89]=le,t[90]=g,t[91]=h,t[92]=je):je=t[92];let Me;t[93]!==Ae||t[94]!==je?(Me=(0,Z.jsxs)(Fs,{className:`sm:max-w-lg`,children:[Ee,Ae,je]}),t[93]=Ae,t[94]=je,t[95]=Me):Me=t[95];let Ne;return t[96]!==le||t[97]!==n||t[98]!==Me?(Ne=(0,Z.jsx)(zs,{open:n,onOpenChange:le,children:Me}),t[96]=le,t[97]=n,t[98]=Me,t[99]=Ne):Ne=t[99],Ne}function c$(e){return e.preventDefault()}function l$(e){return e.stopPropagation()}function u$(e){return e.stopPropagation()}function d$(e){return e.preventDefault()}function f$(e){return e.preventDefault()}function p$(e){return Math.max(e-1,-1)}var m$=(0,Q.lazy)(()=>n(()=>import(`./ConsentDialogBody-CG9T8kVb.js`),__vite__mapDeps([113,1,6,7,81,20,21,15,13,16,63,64,60,61,62,66,114,83,84,17,18,19,70,73,89]),import.meta.url));function h$(){let e=(0,$.c)(1);if(!(0,Q.useSyncExternalStore)(Hc.subscribe,_$,g$))return null;let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(m$,{})}),e[0]=t):t=e[0],t}function g$(){return!1}function _$(){return Hc.getSnapshot()!==null}function v$(e){let t=(0,$.c)(5),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`OpenKnowledge icon`}),t[0]=n):n=t[0];let r;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsxs)(`g`,{filter:`url(#filter0_d_ok)`,children:[(0,Z.jsx)(`path`,{d:`M66.8902 16.1017C58.2694 3.86669 46.1739 -0.690239 29.9182 2.17749C21.3995 3.67813 13.4602 9.555 8.67934 17.9009C3.93974 26.1701 2.98514 35.6533 6.05714 43.9166C9.31574 52.6868 16.7168 58.4752 24.2299 63.4231C25.7973 64.4562 26.1351 65.7172 26.3551 68.9896C26.5221 71.4625 26.799 75.6011 30.6842 77.7204C31.8176 78.3372 33.0648 78.6515 34.3946 78.6515C37.0796 78.6515 39.4033 77.3649 40.5189 76.7482C47.1049 73.1046 68.8878 59.7147 72.6453 40.4027C74.3444 31.6679 70.9797 21.9019 66.8922 16.1017H66.8902Z`,fill:`white`}),(0,Z.jsx)(`path`,{d:`M37.4214 71.154C28.7888 75.929 36.787 64.0397 27.7458 58.0843C21.6372 54.0616 14.788 49.0568 12.0499 41.6911C6.74463 27.4192 17.5438 10.8473 31.028 8.47262C45.1977 5.97613 54.6946 9.8947 61.6635 19.7844C65.2089 24.8167 67.6013 32.8365 66.3658 39.1828C63.6906 52.9341 49.073 64.7075 37.4214 71.154Z`,fill:`#69A3FF`}),(0,Z.jsx)(`path`,{d:`M52.7244 29.2638C53.4665 28.5217 54.6697 28.5217 55.4119 29.2638V29.2638C56.154 30.0059 56.154 31.2091 55.4119 31.9513L49.2589 38.1042L46.5715 35.4167L52.7244 29.2638Z`,fill:`#D5E5FF`}),(0,Z.jsx)(`path`,{d:`M55.4119 38.8821C56.154 39.6242 56.154 40.8274 55.4119 41.5696V41.5696C54.6698 42.3117 53.4665 42.3117 52.7244 41.5696L46.5715 35.4166L49.259 32.7292L55.4119 38.8821Z`,fill:`#D5E5FF`})]}),t[1]=r):r=t[1];let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(`defs`,{children:(0,Z.jsxs)(`filter`,{id:`filter0_d_ok`,x:`-9.53674e-07`,y:`-0.0799994`,width:`77.3817`,height:`85.8743`,filterUnits:`userSpaceOnUse`,colorInterpolationFilters:`sRGB`,children:[(0,Z.jsx)(`feFlood`,{floodOpacity:`0`,result:`BackgroundImageFix`}),(0,Z.jsx)(`feColorMatrix`,{in:`SourceAlpha`,type:`matrix`,values:`0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0`,result:`hardAlpha`}),(0,Z.jsx)(`feOffset`,{dy:`2.85714`}),(0,Z.jsx)(`feGaussianBlur`,{stdDeviation:`2.14286`}),(0,Z.jsx)(`feComposite`,{in2:`hardAlpha`,operator:`out`}),(0,Z.jsx)(`feColorMatrix`,{type:`matrix`,values:`0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 0`}),(0,Z.jsx)(`feBlend`,{mode:`normal`,in2:`BackgroundImageFix`,result:`effect1_dropShadow_ok`}),(0,Z.jsx)(`feBlend`,{mode:`normal`,in:`SourceGraphic`,in2:`effect1_dropShadow_ok`,result:`shape`})]})}),t[2]=i):i=t[2];let a;return t[3]===e?a=t[4]:(a=(0,Z.jsxs)(`svg`,{role:`img`,"aria-label":`OpenKnowledge icon`,fill:`none`,height:24,width:24,viewBox:`0 0 78 80`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[n,r,i]}),t[3]=e,t[4]=a),a}var y$=(0,Q.lazy)(()=>n(()=>import(`./ShareReceiveDialog-Dd0J6bu0.js`).then(e=>({default:e.ShareReceiveDialog})),__vite__mapDeps([115,1,10,3,11,6,7,13,61,15,16,62,71,108,109,110]),import.meta.url)),b$=(e,t,n)=>dg(e,t,n,`NavigatorApp`);function x$(e,t){return e.filter(e=>e.path!==t)}function S$(e){let t=(0,$.c)(106),{bridge:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=[],t[0]=r):r=t[0];let[i,a]=(0,Q.useState)(r),o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=new Map,t[1]=o):o=t[1];let[s,c]=(0,Q.useState)(o),[l,u]=(0,Q.useState)(!0),[d,f]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(null),[_,v]=(0,Q.useState)(!1),[y,b]=(0,Q.useState)(!1),[x,S]=(0,Q.useState)(void 0),[C,w]=(0,Q.useState)(void 0),[T,E]=(0,Q.useState)(!1),[D,O]=(0,Q.useState)(!1),[k,A]=(0,Q.useState)(null),j=typeof window<`u`&&window.okDesktop!=null,[M,N]=(0,Q.useState)(`auth`),{theme:P}=sn(),{_:F}=kt();Il(n,P??`system`);let I;t[2]!==F||t[3]!==n.project?(I=()=>{let e=!1;return n.project.listRecent().then(async t=>{if(e)return;a(t);let r=t.filter(C$),i=await Promise.all(r.map(async e=>{try{let{currentBranch:t}=await n.project.readHeadBranch(e.path);return[e.path,t]}catch{return[e.path,null]}}));e||c(e=>{let t=new Map(e);for(let[e,n]of i)t.set(e,n);return t})}).catch(t=>{console.error(`[NavigatorApp] listRecent failed:`,t),e||(m(t instanceof Error?t.message:F({id:`fYKgzG`})),f(!0))}).finally(()=>{e||u(!1)}),()=>{e=!0}},t[2]=F,t[3]=n.project,t[4]=I):I=t[4];let L;t[5]!==F||t[6]!==n?(L=[n,F],t[5]=F,t[6]=n,t[7]=L):L=t[7],(0,Q.useEffect)(I,L);let R,z;t[8]===n?(R=t[9],z=t[10]):(R=()=>n.onMenuAction(e=>{e===`new-project`&&b(!0),e===`close-active-tab-or-window`&&window.close()}),z=[n],t[8]=n,t[9]=R,t[10]=z),(0,Q.useEffect)(R,z);let B;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(B=(e,t)=>b$(e,t,m),t[11]=B):B=t[11];let V=B,H;t[12]!==F||t[13]!==n?(H=(e,t,r)=>V(()=>(g(r),D$(n,e,t).finally(()=>g(null))),F({id:`SUOoXn`})),t[12]=F,t[13]=n,t[14]=H):H=t[14];let U=H,W;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(W=()=>v(!0),t[15]=W):W=t[15];let G=W,K;t[16]!==F||t[17]!==n?(K=()=>V(async()=>{let e=await n.dialog.openFolder();e&&(g(O$(e)),await D$(n,e,`pick-existing`).finally(()=>g(null)))},F({id:`gmJ0An`})),t[16]=F,t[17]=n,t[18]=K):K=t[18];let ee=K,te;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(te=()=>b(!0),t[19]=te):te=t[19];let ne=te,re;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(re=(e,t)=>{S(e),w(t),b(!0)},t[20]=re):re=t[20];let ie=re,q;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(q=e=>{b(e),e||(S(void 0),w(void 0))},t[21]=q):q=t[21];let ae=q,oe;t[22]===U?oe=t[23]:(oe=e=>U(e,`recents`,O$(e)),t[22]=U,t[23]=oe);let se=oe,ce;t[24]!==F||t[25]!==n.project?(ce=e=>V(async()=>{await n.project.removeRecent(e),a(t=>x$(t,e)),c(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},F({id:`viwC-K`})),t[24]=F,t[25]=n.project,t[26]=ce):ce=t[26];let le=ce,ue;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(ue=(0,Z.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 top-0 z-10 h-9 ${j?`[-webkit-app-region:drag]`:``}`,"data-electron-drag":j?``:void 0,"data-testid":`nav-chrome-row`}),t[27]=ue):ue=t[27];let de;t[28]!==F||t[29]!==h?(de=h===null?null:(0,Z.jsxs)(`div`,{className:`absolute inset-0 z-20 flex flex-col items-center justify-center gap-3 bg-primary-foreground/85 dark:bg-background/85 backdrop-blur-sm`,"data-testid":`nav-opening-overlay`,role:`status`,"aria-live":`polite`,children:[(0,Z.jsx)(ns,{className:`size-6 animate-spin text-muted-foreground`}),(0,Z.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:F({id:`s0_GnA`,values:{openingLabel:h}})})]}),t[28]=F,t[29]=h,t[30]=de):de=t[30];let fe;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(fe=(0,Z.jsx)(v$,{className:`size-12 shrink-0`}),t[31]=fe):fe=t[31];let pe;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(pe=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`h1`,{className:`font-medium text-xl tracking-tight`,children:`OpenKnowledge`}),(0,Z.jsx)(JN,{})]}),t[32]=pe):pe=t[32];let me;t[33]===n.appVersion?me=t[34]:(me=(0,Z.jsxs)(`header`,{className:`shrink-0 flex-wrap flex items-center gap-2.5`,children:[fe,(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[pe,(0,Z.jsxs)(`p`,{className:`text-muted-foreground text-xs font-mono`,children:[`v`,n.appVersion]})]})]}),t[33]=n.appVersion,t[34]=me);let he;t[35]!==F||t[36]!==l||t[37]!==ee||t[38]!==i||t[39]!==d?(he=l?null:!d&&i.length===0?(0,Z.jsx)(T$,{onPackSelect:ie,onOpenFolder:ee,onClone:G,onCreate:ne}):(0,Z.jsxs)(`section`,{className:`grid shrink-0 sm:grid-cols-3 gap-3`,children:[(0,Z.jsx)(w$,{title:F({id:`wbv9xO`}),description:F({id:`0uTHCg`}),onClick:ne,dataTestId:`nav-create-new`,Icon:nt}),(0,Z.jsx)(w$,{title:F({id:`WPwDin`}),description:F({id:`tUvUfp`}),onClick:ee,dataTestId:`nav-open`,Icon:Ro}),(0,Z.jsx)(w$,{title:F({id:`VdXv4D`}),description:F({id:`JOcPqH`}),onClick:G,dataTestId:`nav-clone`,Icon:kF})]}),t[35]=F,t[36]=l,t[37]=ee,t[38]=i,t[39]=d,t[40]=he):he=t[40];let ge;t[41]===p?ge=t[42]:(ge=p===null?null:(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 rounded-md border border-red-500/30 bg-red-500/10 px-3 py-2`,"data-testid":`nav-error-banner`,role:`alert`,children:[(0,Z.jsx)(`span`,{className:`text-red-700 text-xs dark:text-red-300`,children:p}),(0,Z.jsx)(Jr,{type:`button`,variant:`link`,size:`sm`,onClick:()=>m(null),className:`h-auto p-0 text-red-700 text-xs dark:text-red-300`,"data-testid":`nav-error-dismiss`,children:(0,Z.jsx)(J,{id:`1QfxQT`})})]}),t[41]=p,t[42]=ge);let _e;t[43]!==l||t[44]!==se||t[45]!==le||t[46]!==s||t[47]!==i?(_e=l?(0,Z.jsx)(`section`,{className:`flex shrink-0 flex-col items-center`,children:(0,Z.jsx)(ns,{className:`size-4 animate-spin text-muted-foreground/60`})}):i.length>0?(0,Z.jsxs)(`section`,{className:`flex min-h-0 flex-col`,children:[(0,Z.jsx)(`h2`,{className:`mb-2 shrink-0 font-medium text-muted-foreground font-mono text-xs uppercase tracking-wide`,children:(0,Z.jsx)(J,{id:`CCTop_`})}),(0,Z.jsx)(`ul`,{className:`min-h-0 max-h-48 subtle-scrollbar scroll-fade-mask overflow-y-auto space-y-0.5 -mx-4`,"data-testid":`nav-recent-list`,children:i.map(e=>(0,Z.jsx)(E$,{project:e,branch:s.get(e.path)??null,onOpen:()=>se(e.path),onRemove:()=>le(e.path)},e.path))})]}):null,t[43]=l,t[44]=se,t[45]=le,t[46]=s,t[47]=i,t[48]=_e):_e=t[48];let ve;t[49]!==me||t[50]!==he||t[51]!==ge||t[52]!==_e?(ve=(0,Z.jsx)(`div`,{className:`mx-auto flex h-full w-full max-w-5xl flex-col overflow-hidden px-12 py-12`,children:(0,Z.jsxs)(`div`,{className:`my-auto flex min-h-0 flex-col space-y-10`,children:[me,he,ge,_e]})}),t[49]=me,t[50]=he,t[51]=ge,t[52]=_e,t[53]=ve):ve=t[53];let ye,be;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(ye=(0,Z.jsx)(pQ,{}),be=(0,Z.jsx)(h$,{}),t[54]=ye,t[55]=be):(ye=t[54],be=t[55]);let xe;t[56]!==n||t[57]!==y||t[58]!==x||t[59]!==C?(xe=(0,Z.jsx)(_m,{open:y,onOpenChange:ae,bridge:n,initialPackId:x,packs:C}),t[56]=n,t[57]=y,t[58]=x,t[59]=C,t[60]=xe):xe=t[60];let Se;t[61]===k?Se=t[62]:(Se=e=>{E(e),e||(O(!1),k&&(k(null),A(null)))},t[61]=k,t[62]=Se);let Ce;t[63]===n?Ce=t[64]:(Ce=Fa(n),t[63]=n,t[64]=Ce);let we;t[65]===n?we=t[66]:(we=Ra(n),t[65]=n,t[66]=we);let Te=M===`identity`,Ee;t[67]!==D||t[68]!==k?(Ee=e=>{E(!1),D&&(O(!1),v(!0)),k&&(k({authenticated:!0,host:`github.com`,login:e.login}),A(null))},t[67]=D,t[68]=k,t[69]=Ee):Ee=t[69];let De;t[70]!==T||t[71]!==Se||t[72]!==Ce||t[73]!==we||t[74]!==Te||t[75]!==Ee?(De=(0,Z.jsx)(Ja,{open:T,onOpenChange:Se,transport:Ce,queryTransport:we,identityPrompt:Te,onSuccess:Ee}),t[70]=T,t[71]=Se,t[72]=Ce,t[73]=we,t[74]=Te,t[75]=Ee,t[76]=De):De=t[76];let Oe;t[77]===n?Oe=t[78]:(Oe=i$(n),t[77]=n,t[78]=Oe);let ke;t[79]===n?ke=t[80]:(ke=Ra(n),t[79]=n,t[80]=ke);let Ae;t[81]===n.dialog?Ae=t[82]:(Ae=()=>n.dialog.openFolder(),t[81]=n.dialog,t[82]=Ae);let je;t[83]===Symbol.for(`react.memo_cache_sentinel`)?(je=()=>{v(!1),N(`auth`),O(!0),E(!0)},t[83]=je):je=t[83];let Me;t[84]!==F||t[85]!==n?(Me=e=>{let{dir:t}=e;V(()=>(g(O$(t)),D$(n,t,`pick-existing`).finally(()=>g(null))),F({id:`iSnkwB`}))},t[84]=F,t[85]=n,t[86]=Me):Me=t[86];let Ne;t[87]!==_||t[88]!==Oe||t[89]!==ke||t[90]!==Ae||t[91]!==Me?(Ne=(0,Z.jsx)(s$,{open:_,onOpenChange:v,transport:Oe,authQueryTransport:ke,pickParentFolder:Ae,onSignIn:je,onCloneComplete:Me}),t[87]=_,t[88]=Oe,t[89]=ke,t[90]=Ae,t[91]=Me,t[92]=Ne):Ne=t[92];let Pe;if(t[93]!==n){let e;t[95]===Symbol.for(`react.memo_cache_sentinel`)?(e=()=>new Promise(e=>{A(()=>e),E(!0)}),t[95]=e):e=t[95],Pe=n$({bridge:n,authQueryTransport:Ra(n),cloneTransport:i$(n),openSignIn:e}),t[93]=n,t[94]=Pe}else Pe=t[94];let Fe;t[96]!==n||t[97]!==Pe?(Fe=(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(y$,{bridge:n,cloneController:Pe})}),t[96]=n,t[97]=Pe,t[98]=Fe):Fe=t[98];let Ie;return t[99]!==de||t[100]!==ve||t[101]!==xe||t[102]!==De||t[103]!==Ne||t[104]!==Fe?(Ie=(0,Z.jsxs)(`div`,{className:`relative flex h-screen w-screen flex-col overflow-hidden bg-primary-foreground dark:bg-background text-foreground`,children:[ue,de,ve,ye,be,xe,De,Ne,Fe]}),t[99]=de,t[100]=ve,t[101]=xe,t[102]=De,t[103]=Ne,t[104]=Fe,t[105]=Ie):Ie=t[105],Ie}function C$(e){return!e.missing}function w$(e){let t=(0,$.c)(14),{title:n,description:r,onClick:i,dataTestId:a,Icon:o}=e,s;t[0]===o?s=t[1]:(s=o?(0,Z.jsx)(o,{className:`size-4 shrink-0 text-muted-foreground`}):null,t[0]=o,t[1]=s);let c;t[2]===n?c=t[3]:(c=(0,Z.jsx)(`span`,{className:`font-medium text-gray-700 dark:text-foreground text-sm`,children:n}),t[2]=n,t[3]=c);let l;t[4]!==s||t[5]!==c?(l=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[s,c]}),t[4]=s,t[5]=c,t[6]=l):l=t[6];let u;t[7]===r?u=t[8]:(u=(0,Z.jsx)(`span`,{className:`line-clamp-2 text-muted-foreground text-xs leading-snug`,children:r}),t[7]=r,t[8]=u);let d;return t[9]!==a||t[10]!==i||t[11]!==l||t[12]!==u?(d=(0,Z.jsxs)(Jr,{type:`button`,variant:`outline`,onClick:i,"data-testid":a,className:`h-auto flex-col items-start justify-start gap-1.5 whitespace-normal bg-card px-4 py-3.5 text-left`,children:[l,u]}),t[9]=a,t[10]=i,t[11]=l,t[12]=u,t[13]=d):d=t[13],d}function T$(e){let t=(0,$.c)(31),{onPackSelect:n,onOpenFolder:r,onClone:i,onCreate:a}=e,[o,s]=(0,Q.useState)(null),c,l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>{let e=!1;return(async()=>{try{let t=await Bh().listPacks();if(e)return;t.ok?s(t.packs):(console.error(`[NavigatorApp] listPacks returned error:`,t),s([]))}catch(t){let n=t;if(e)return;console.error(`[NavigatorApp] listPacks failed:`,n),s([])}})(),()=>{e=!0}},l=[],t[0]=c,t[1]=l):(c=t[0],l=t[1]),(0,Q.useEffect)(c,l);let u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(`h2`,{className:`text-xl font-light tracking-tighter text-balance`,children:(0,Z.jsx)(J,{id:`QnjpOq`})}),t[2]=u):u=t[2];let d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-1`,children:[u,(0,Z.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:(0,Z.jsx)(J,{id:`gYuDfu`})})]}),t[3]=d):d=t[3];let f;t[4]!==n||t[5]!==o?(f=e=>n(e,o??[]),t[4]=n,t[5]=o,t[6]=f):f=t[6];let p;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(p=[`okf`,`entity-vault`],t[7]=p):p=t[7];let m;t[8]!==o||t[9]!==f?(m=(0,Z.jsx)(`div`,{className:`-m-1 min-h-0 flex-1 overflow-y-auto subtle-scrollbar p-1`,children:(0,Z.jsx)(Uh,{packs:o,onPackSelect:f,collapsedPackIds:p})}),t[8]=o,t[9]=f,t[10]=m):m=t[10];let h;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(`span`,{className:`text-muted-foreground text-sm`,children:(0,Z.jsx)(J,{id:`S34Vju`})}),t[11]=h):h=t[11];let g,_;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(Ro,{"aria-hidden":`true`,className:`size-3.5`}),g=(0,Z.jsx)(J,{id:`PVUn_c`}),t[12]=g,t[13]=_):(g=t[12],_=t[13]);let v;t[14]===r?v=t[15]:(v=(0,Z.jsxs)(Jr,{type:`button`,variant:`link-muted`,size:`sm`,onClick:r,"data-testid":`nav-first-run-open`,children:[_,g]}),t[14]=r,t[15]=v);let y,b;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(kF,{"aria-hidden":`true`,className:`size-3.5`}),b=(0,Z.jsx)(J,{id:`VdXv4D`}),t[16]=y,t[17]=b):(y=t[16],b=t[17]);let x;t[18]===i?x=t[19]:(x=(0,Z.jsxs)(Jr,{type:`button`,variant:`link-muted`,size:`sm`,onClick:i,"data-testid":`nav-first-run-clone`,children:[y,b]}),t[18]=i,t[19]=x);let S,C;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(nt,{"aria-hidden":`true`,className:`size-3.5`}),C=(0,Z.jsx)(J,{id:`ircigK`}),t[20]=S,t[21]=C):(S=t[20],C=t[21]);let w;t[22]===a?w=t[23]:(w=(0,Z.jsxs)(Jr,{type:`button`,variant:`link-muted`,size:`sm`,onClick:a,"data-testid":`nav-first-run-blank`,children:[S,C]}),t[22]=a,t[23]=w);let T;t[24]!==v||t[25]!==x||t[26]!==w?(T=(0,Z.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-x-3 gap-y-1`,"data-testid":`nav-first-run-secondary`,children:[h,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-1 gap-y-1`,children:[v,x,w]})]}),t[24]=v,t[25]=x,t[26]=w,t[27]=T):T=t[27];let E;return t[28]!==T||t[29]!==m?(E=(0,Z.jsxs)(`section`,{className:`flex min-h-0 shrink flex-col gap-6`,"data-testid":`nav-first-run`,children:[d,m,T]}),t[28]=T,t[29]=m,t[30]=E):E=t[30],E}function E$(e){let t=(0,$.c)(44),{project:n,branch:r,onOpen:i,onRemove:a}=e,{_:o}=kt(),{name:c}=n,l=n.isLinkedWorktree===!0,u=l?n.branch??r:r,d=n.missing,f=n.missing&&`opacity-50`,p;t[0]===f?p=t[1]:(p=X(`h-auto min-w-0 flex-1 justify-between gap-3 py-3.5 pl-4 pr-2 text-left hover:bg-transparent`,f),t[0]=f,t[1]=p);let m;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(Jd,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-muted-foreground`}),t[2]=m):m=t[2];let h;t[3]===n.name?h=t[4]:(h=(0,Z.jsx)(`span`,{className:`truncate font-medium text-sm text-gray-700 dark:text-foreground`,children:n.name}),t[3]=n.name,t[4]=h);let g;t[5]===l?g=t[6]:(g=l?(0,Z.jsxs)(s,{variant:`secondary`,className:`shrink-0 gap-1 rounded-full border-transparent bg-green-600/10 px-2 py-0 font-medium text-2xs text-green-800 dark:bg-green-400/10 dark:text-green-400`,children:[(0,Z.jsx)(zo,{"aria-hidden":`true`,className:`size-2.5`}),(0,Z.jsx)(J,{id:`z-lawV`})]}):null,t[5]=l,t[6]=g);let _;t[7]!==h||t[8]!==g?(_=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[h,g]}),t[7]=h,t[8]=g,t[9]=_):_=t[9];let v=l?n.mainRoot??``:n.path,y;t[10]!==l||t[11]!==n.mainRoot||t[12]!==n.path?(y=l?(0,Z.jsx)(J,{id:`PRnH8G`,values:{0:bg(n.mainRoot??``)}}):n.path,t[10]=l,t[11]=n.mainRoot,t[12]=n.path,t[13]=y):y=t[13];let b;t[14]!==v||t[15]!==y?(b=(0,Z.jsx)(`span`,{className:`truncate w-full text-muted-foreground text-xs`,title:v,children:y}),t[14]=v,t[15]=y,t[16]=b):b=t[16];let x;t[17]!==b||t[18]!==_?(x=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[m,(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1 truncate`,children:[_,b]})]}),t[17]=b,t[18]=_,t[19]=x):x=t[19];let S;t[20]!==n.missing||t[21]!==n.path||t[22]!==u?(S=n.missing?(0,Z.jsx)(s,{className:`text-2xs rounded-sm`,variant:`warning`,children:(0,Z.jsx)(J,{id:`VU3Nrn`})}):u==null?null:(0,Z.jsxs)(`span`,{className:`flex max-w-[40%] items-center gap-1 text-muted-foreground text-xs`,"data-testid":`nav-recent-branch-${n.path}`,children:[(0,Z.jsx)(zo,{"aria-hidden":`true`,className:`size-3 shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate font-mono`,children:u})]}),t[20]=n.missing,t[21]=n.path,t[22]=u,t[23]=S):S=t[23];let C;t[24]!==i||t[25]!==n.missing||t[26]!==x||t[27]!==S||t[28]!==p?(C=(0,Z.jsxs)(Jr,{type:`button`,variant:`ghost`,onClick:i,disabled:d,className:p,children:[x,S]}),t[24]=i,t[25]=n.missing,t[26]=x,t[27]=S,t[28]=p,t[29]=C):C=t[29];let w;t[30]!==o||t[31]!==c?(w=o({id:`hDoLrm`,values:{projectName:c}}),t[30]=o,t[31]=c,t[32]=w):w=t[32];let T;t[33]===o?T=t[34]:(T=o({id:`Es-eZU`}),t[33]=o,t[34]=T);let E=`nav-recent-remove-${n.path}`,D;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsx)(gs,{"aria-hidden":`true`}),t[35]=D):D=t[35];let O;t[36]!==a||t[37]!==w||t[38]!==T||t[39]!==E?(O=(0,Z.jsx)(Jr,{type:`button`,variant:`ghost`,size:`icon-sm`,onClick:a,"aria-label":w,title:T,className:`pointer-events-none mr-2 opacity-0 group-hover:pointer-events-auto group-hover:opacity-100 focus-visible:pointer-events-auto focus-visible:opacity-100`,"data-testid":E,children:D}),t[36]=a,t[37]=w,t[38]=T,t[39]=E,t[40]=O):O=t[40];let k;return t[41]!==C||t[42]!==O?(k=(0,Z.jsxs)(`li`,{className:`group flex items-center justify-between rounded-lg hover:bg-accent`,children:[C,O]}),t[41]=C,t[42]=O,t[43]=k):k=t[43],k}async function D$(e,t,n){await e.project.open({path:t,target:`new-window`,entryPoint:n})}function O$(e){let t=e.split(/[/\\]/).filter(Boolean);return t.length>0?t[t.length-1]??e:e}function k$(e){let t=(0,$.c)(5),{bridge:n}=e,r=n.config.collabUrl?n.config.collabUrl:null,i;t[0]===n?i=t[1]:(i=(0,Z.jsx)(A$,{bridge:n}),t[0]=n,t[1]=i);let a;return t[2]!==r||t[3]!==i?(a=(0,Z.jsx)(Ll,{collabUrl:r,children:i}),t[2]=r,t[3]=i,t[4]=a):a=t[4],a}function A$(e){let t=(0,$.c)(11),{bridge:n}=e,{resolvedTheme:r}=sn(),i=a_(),[a,o]=(0,Q.useState)(null),s;t[0]===r?s=t[1]:(s=Au(r),t[0]=r,t[1]=s);let c;t[2]===s.background?c=t[3]:(c=(0,Z.jsx)(`div`,{ref:o,className:`flex h-screen min-h-0 flex-col`,style:{backgroundColor:s.background}}),t[2]=s.background,t[3]=c);let l;t[4]!==n||t[5]!==a||t[6]!==i?(l=(0,Z.jsx)(wI,{bridge:n,variant:`window`,visible:!0,onVisibleChange:M$,installedClis:i,container:a,isShowing:!0,onRequestEditorFocus:j$}),t[4]=n,t[5]=a,t[6]=i,t[7]=l):l=t[7];let u;return t[8]!==c||t[9]!==l?(u=(0,Z.jsxs)(Z.Fragment,{children:[c,l]}),t[8]=c,t[9]=l,t[10]=u):u=t[10],u}function j$(){}function M$(e){e||window.close()}function N$(e){return e?.config.mode===`terminal`?(0,Z.jsx)(k$,{bridge:e}):e?.config.mode===`navigator`?(0,Z.jsx)(S$,{bridge:e}):(0,Z.jsx)(QQ,{})}var P$=e=>{let t=(0,$.c)(8),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let{theme:r}=sn(),i=r===void 0?`system`:r,a,o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a={success:(0,Z.jsx)(oa,{className:`size-4`}),info:(0,Z.jsx)(ts,{className:`size-4`}),warning:(0,Z.jsx)(os,{className:`size-4`}),error:(0,Z.jsx)(df,{className:`size-4`}),loading:(0,Z.jsx)(ns,{className:`size-4 animate-spin`})},o={"--normal-bg":`var(--popover)`,"--normal-text":`var(--popover-foreground)`,"--normal-border":`var(--border)`,"--border-radius":`var(--radius)`},t[2]=a,t[3]=o):(a=t[2],o=t[3]);let s;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(s={classNames:{toast:`cn-toast`}},t[4]=s):s=t[4];let c;return t[5]!==n||t[6]!==i?(c=(0,Z.jsx)(_s,{theme:i,className:`toaster group`,icons:a,style:o,toastOptions:s,...n}),t[5]=n,t[6]=i,t[7]=c):c=t[7],c},F$=Symbol.for(`ok.client.fetchWrapper`);function I$(e={}){if(typeof window>`u`)return;let t=e.apiOrigin&&e.apiOrigin.length>0?e.apiOrigin:void 0;if(window.fetch[F$])return;let n=window.fetch.bind(window),r=Pl(),i=((e,i)=>{let a=R$(e,t);if(!a.isApi)return n(e,i);if(e instanceof Request){let t=L$(e.headers,r);return n(new Request(a.url,e),{headers:t})}let o=L$(i?.headers,r);return n(a.url,{...i,headers:o})});i[F$]=!0,window.fetch=i}function L$(e,t){let n=new Headers(e);for(let[e,r]of Object.entries(t))n.set(e,r);return n}function R$(e,t){if(typeof e==`string`){if(e.startsWith(`/api/`))return{isApi:!0,url:t?t+e:e};let n=z$(e);return n&&B$(n,t)?{isApi:!0,url:e}:{isApi:!1,url:e}}let n=e instanceof URL?e:z$(e.url,window.location.origin);if(n&&B$(n,t)){let r=e instanceof URL?e.href:e.url;return t&&(n.origin===window.location.origin||n.protocol===`file:`)?{isApi:!0,url:t+n.pathname+n.search+n.hash}:{isApi:!0,url:r}}return{isApi:!1,url:e instanceof URL?e.href:e.url}}function z$(e,t){try{return new URL(e,t)}catch{return null}}function B$(e,t){if(!e.pathname.startsWith(`/api/`))return!1;if(e.origin===window.location.origin||e.protocol===`file:`)return!0;if(t){let n=z$(t);if(n&&e.origin===n.origin)return!0}return!1}var V$={messages:JSON.parse(`{"--T3kB":["Loading preview"],"-3Qbv7":[["count","plural",{"one":["matches ","#"," file"],"other":["matches ","#"," files"]}]],"-3ois8":["Hard break"],"-5jISU":[["0","plural",{"one":["#"," template"],"other":["#"," templates"]}]],"-8PP0T":["Match case"],"-K0AvT":["Disconnect"],"-LHLx7":["edited template"],"-QCLWk":["Templates available"],"-Qw-1t":["GitHub authentication failed. Try signing in again."],"-WFFG2":["Default properties"],"-YV1Uo":["Pattern ",["patternNumber"]],"-g6KIS":["Unrecognized link"],"-gdcIo":["Auto-sync is on — your commits push and remote changes pull on intervals."],"-i7ik4":["Collapse burst ",["burstNumber"]," diff"],"-lCAuQ":["Loading graph"],"-q4abP":["Results capped — this workspace has more files than search can index. A missing file may be a cap artifact, not a typo."],"-r_Kx7":["Create skill"],"-slrNR":["Toggle a task list."],"-uaQnI":["No matching worktrees or branches."],"-wePNM":["Search matches file names, paths, and folders. Open a file to search its body (⌘F)."],"-zA2E7":["Couldn't create the worktree. Try a different name."],"-zy2Nq":["Type"],"0-31GV":["Removing"],"00c7t0":["Ask AI about this code block"],"02P3hL":["Upload failed: ",["message"]],"04RA0-":["Failed to enable sync — ",["detail"]],"04XyCH":["Adds a managed block to ",["0"]],"05n5wS":["Doc mention suggestions"],"06SZfb":["Template \\"",["trimmedTitle"],"\\" created"],"07eGJB":["Couldn't move skill: ",["0"]],"07gHun":["You don't have access to this private repo. Sign in with an account that does."],"07q4Qk":["File sidebar"],"09Tv5j":["Reconnecting…"],"0BB9ID":["No headings yet."],"0BfhAj":["Reset view"],"0E9DR6":["Type to find a doc"],"0Er6-M":["Restarting"],"0Gd0NU":["Shared"],"0LBDjY":["\\"",["0"],"\\" uninstalled — back to a draft"],"0NA4b3":["Keep my version"],"0SBTff":["Show terminal"],"0TnCvC":["Rename ",["0"]],"0YEbfk":["Connect to AI tools"],"0YUS3Q":["Subfolder under current folder"],"0_J12R":["New file from template \\"",["displayTitle"],"\\" (",["fileName"],") in ",["targetLabel"]],"0eHrMb":["Could not complete delete"],"0g7rCZ":["Duplicated to \\"",["0"],"\\""],"0inVGS":["Helps your coding agent recognize OpenKnowledge projects and route reads and writes through it."],"0jD-Gn":["A team knowledge base, a personal wiki, project docs..."],"0kTAXe":["Open source: ",["mirrorSrc"]],"0njBIq":["Setup files include: <0>.ok/</0>, AI-tool MCP configs (<1>.mcp.json</1> and per-tool files), project skills, and <2>.claude/launch.json</2>.<3/><4>Shared</4> commits them to git, so anyone who clones the repo gets the same setup. <5/><6>Local only</6> keeps them out of git (via <7>.git/info/exclude</7>)."],"0rwwOn":["By tag"],"0s8-e8":["Select, enter, or leave block components and fallback source blocks from keyboard boundaries."],"0t0bbC":["Could not save sync preference: ",["detail"]],"0uTHCg":["Start a new OpenKnowledge project."],"0wswKc":["Horizontal rule that divides sections."],"0xnmlQ":["Repository name"],"0yL--g":["Review conflicts"],"12F9WL":["(no id)"],"16D5Zj":["Are you sure you want to delete ",["itemName"],"? This action cannot be undone."],"1AumWo":["Push failed — check the server logs for details."],"1EcCom":[["keyName"]," value"],"1FLarN":["Describe what you want to create to continue"],"1GhYxC":["of ",["totalPages"]],"1HBhDS":["Checking out files"],"1MGRQl":["Terminal sessions"],"1QfxQT":["Dismiss"],"1RluQD":["Show replace"],"1TNIig":["Open"],"1Ta7Fd":["Open ",["basename"]],"1XSMhZ":["Switching to <0>local-only</0> will refuse until they're untracked via<1> git rm --cached</1>."],"1YJ4Yg":["Update available",["0"]],"1ZpfyB":["Open with AI ",["displayName"],", ",["hint"]],"1bDVu5":["Workspace Command Palette"],"1d1F11":["Select all files and folders"],"1di5fu":["Document not found"],"1hvhf0":["The folder on disk and the id agents use to invoke this skill."],"1nke1r":["Open ",["0"]," on GitHub (opens in a new tab)"],"1t_NnN":["Reject"],"2277Tu":["Collapse graph"],"237hSL":["Ended"],"25Pw6a":["Cloning"],"27XW26":["Clone happens in the Project Navigator. Reclick the share link there."],"28B21t":["Agent Skills"],"29VNqC":["Unknown error"],"29XZXN":["Set git identity"],"2B6eYX":["What this checkbox changes"],"2BBAbc":["List"],"2FYpfJ":["More"],"2GT3Hf":["Global"],"2IYGkU":["This doc has unpushed changes. Recipients will see the last pushed version."],"2QM24L":["All tags"],"2RBzMG":["Network error — check your connection and try again"],"2XQ8Ww":["Open preview when agent edits"],"2YOwme":["Restarted — now running v",["appRuntime"],"."],"2YZwPB":["Forward-links response did not match expected shape."],"2bVHbB":["Available in every project on this computer."],"2fkdnR":["Nothing to undo on this file"],"2hYmUH":["my@email.com"],"2hpdRq":["Hide panel (",["panelShortcutLabel"],")"],"2n3oDU":["Project-level pages ordered by inbound link count, up to ",["FULLSCREEN_HUB_LIMIT"]," results."],"2q_Q7x":["Visibility"],"2ryd91":["Failed to rename property"],"2tgFCe":["Starting clone"],"2vIPtm":["Open link in new tab"],"2wxgft":["Rename"],"322lyb":["Highlight tips, warnings, and notes."],"34qyH5":["Could not reach server"],"36WXSC":["Couldn't delete template: ",["error"]],"36aWJD":["Join us on Discord"],"379t2h":["Unified diff"],"38foVZ":["Loading diff"],"3BnyYc":["This doc isn't on GitHub yet. The link won't work until it's pushed."],"3DTatP":["Copy a prompt for your agent, start a blank file, or scaffold from a template."],"3FMvls":["A short line shown under the title in the template list."],"3Fcb0I":["Open graph"],"3HNlwb":["Hello, world!"],"3Ib6FN":["Move down"],"3Ijjy1":["Couldn't load this skill's files."],"3IseAk":["Install an AI agent to create with AI"],"3J7d2N":["Big section heading."],"3JYy1p":["Branch ",["0"]," no longer exists. Cloned to default branch."],"3MnvrL":["Showing top ",["0"]," matches — keep typing to narrow"],"3Mwaly":["Could not initialize ",["0"],"."],"3SDfZl":["<0>Mirror — pick a source.</0> Set <1>src</1> + <2>anchor</2> via the property panel to point at a <3><MirrorSource></3> elsewhere."],"3TCafD":["Stored on this machine."],"3VbwPp":["Open ",["keyName"]," in browser"],"3VsNTI":["Loading document"],"3YvS-c":["New tab"],"3_6U6f":["Connect to GitHub"],"3__SjS":["breadcrumb"],"3a_Bd7":["Open source doc: ",["mirrorSrc"]],"3aeN7X":["All files"],"3cOo2C":["Create a folder from the current document or folder context."],"3ePd3I":["What's new"],"3h5zMp":["Something went wrong loading the settings panel."],"3iyGWF":["Open recent project"],"3jod3l":["Connect GitHub"],"3m2GBo":["Searching docs"],"3mFsc3":["Restore with remote changes"],"3o3tur":["Starter content"],"3oh0nQ":["Nested .okignore error in ",["path"]],"3pU8e-":["Pin tab"],"3wiBAs":["Where should it live?"],"3y6XTb":["Semantic search"],"3zyg_A":["Ignore patterns"],"438Fca":["Cloned successfully, but could not open the project."],"44DSl0":["Already have a git repository? Add it with <0>git remote add origin <url></0> in this project's folder. This page updates automatically once a remote is detected."],"45MZFs":["Commands"],"47EXvY":["This replaces the current skill content with the bundled version ",["0"]," (you have ",["1"],"). Any local edits will be replaced — your current version is saved to history first, so you can restore it."],"484LKL":["Remove link"],"48uGTI":["Failed to load docs. Press Escape and re-open to retry."],"4A3Yzu":["Code block"],"4BITzH":["Error:"],"4CfgPM":["Project folder created, but git init failed. Try again."],"4E9jPa":["Create your first project"],"4Gz2wC":["Failed to upload file"],"4KmEoC":["Hotkeys"],"4NC2Ym":["Move to the next or previous table cell."],"4PYsOz":["Hide Files (",["sidebarShortcutLabel"],")"],"4Sxexw":["Source undo or redo"],"4TzU0n":["Initialize"],"4XL6N4":["Detected from the editors this project is set up for. Adjust to control where every skill installs."],"4buZWd":["Inherited from ",["path"]],"4c_a6S":["Nothing set yet."],"4g19V6":["Failed to update property"],"4hJhzz":["Table"],"4jDd0j":["Anyone can see"],"4mLBx9":["Subscriptions aren't available right now."],"4niEzY":["Sandboxed HTML embed — write HTML, see the rendered preview live."],"4nj6n8":["/api/config returned HTTP ",["code"]],"4rjwLG":["Create with ",["0"]," CLI"],"4sKwf6":["File already exists"],"4uNLmk":["Pulling"],"4v2Yyz":["Select every visible file-tree row when focus is in the Files sidebar."],"4xtLTl":["Hidden folder “",["basename"],"”"],"4zEZS5":["Auto-sync is on for this worktree, inherited from ",["project"],". Change it in Settings → Sync."],"4zGlN_":["Paste image URL or click upload"],"5-FeN2":["Share URL"],"54Y6Fg":["Could not load templates. Try again later."],"56WWtu":["Couldn't load starter packs: ",["error"]],"56xUL1":["Property name"],"57fiu8":["(read-only — edit in source mode for now)"],"5ALjdr":["Move through visual-editor find results from the find field."],"5Ajb15":["The formula <0>c = √(a² + b²)</0> renders inline."],"5ClEAu":["Inline hashtag for cross-doc grouping."],"5D3Ior":["Hide folder"],"5DFPDh":["Started a fresh OpenKnowledge server (v",["appRuntime"],") for this dev session — the server already running for this project was terminated. Connected agents (Claude Code, Codex, Cursor) just lost their OpenKnowledge MCP connection; restart the agent, or toggle its OpenKnowledge MCP server off and on, to reconnect."],"5F5HYj":[["ahead"]," ahead, ",["behind"]," behind"],"5GKMSz":["Indent or outdent the current list item."],"5GRxoA":["Search files, folders, and commands for the current workspace."],"5LXwX8":["This permanently removes ",["path"],". Agents that reference this template by name will fail until it's recreated or replaced by one in a parent folder."],"5OTgC7":["Open and focus the bottom Ask AI prompt composer."],"5OqaJi":["Enter a project name"],"5QGTaA":["Could not copy relative path"],"5SwVv1":["Not installed"],"5Tk8Fb":["Loading files"],"5WDhAk":["Link to a page or external URL."],"5ZB7XC":["File drop zone"],"5e1Dri":["The menu label agents pick this template by (required)."],"5gr_ev":["Becomes the document's content when someone creates a doc from this template. Type <0>",["dateToken"],"</0> or <1>",["userToken"],"</1> to fill in today's date or the author's name automatically."],"5kWklo":["(some may already be hidden by other rules)"],"5lWFkC":["Sign in"],"5mksg0":["Failed to disable semantic search — ",["detail"]],"5qNxOe":[["count","plural",{"one":["#"," item could not be moved to the Trash. Do you want to permanently delete instead?"],"other":["#"," items could not be moved to the Trash. Do you want to permanently delete instead?"]}]],"5wV2qQ":["and more"],"5y_9lO":["Waiting for authorization"],"6-wLTJ":[["behind"]," behind origin"],"62Pc08":["Install for Claude Chat & Cowork (Desktop App)"],"636K3K":["Delete adjacent chip"],"67f-3g":["Duplicate succeeded but the sidebar may be out of date — refresh to resync"],"6Aih4U":["Offline"],"6EKG_c":["What agents match on to decide when to use the skill."],"6HCOwA":["Failed to open."],"6LbUG7":["The repository is private and your GitHub account doesn't have access to it."],"6MnZEC":["Terminal failed to load"],"6O626z":["No headings match \\"",["trimmedAnchorQuery"],"\\""],"6Pxqwv":["No project templates yet. Create one to make it available everywhere in this project. Folder-scoped templates live on each folder's overview page."],"6Uau97":["Skip"],"6V3Ea3":["Copied"],"6VqW-1":["Remove ",["keyName"]],"6WdDG7":["Page"],"6YtxFj":["Name"],"6ZhdPI":["What the agent may read, write, and surface."],"6_ZOw4":["Copied full path"],"6bTTAN":["Invalid input — pick a different folder."],"6cR-PU":["Already open"],"6caB2T":["Connect an existing repository"],"6cuT_1":["Open date picker for ",["keyName"]],"6cyguR":["Connect GitHub to continue."],"6eniID":["Map the architecture"],"6fGjTz":["Show fewer"],"6g2jsp":["Update skill"],"6gRgw8":["Retry"],"6h4zVU":["What would you like to create?"],"6hfDJr":["Server error: ",["status"]],"6ibbCg":["Create your first file"],"6ki7F2":[["0","plural",{"one":["#"," item"],"other":["#"," items"]}]],"6lGV3K":["Show less"],"6m_7We":["Open this settings dialog."],"6q0rnH":["writing"],"6qMe0o":["Draft a technical spec for my project. Start with an overview, then add cross-linked pages for the architecture, the key modules, and the open questions, all linked from a specs index."],"6s7LXO":["Heads up"],"6u9LvN":[["days","plural",{"one":["#"," day ago"],"other":["#"," days ago"]}]],"6vEr3W":["Link target"],"72xhRD":["Diagram view mode"],"74-bX-":["A pull quote stands out from the surrounding text."],"74eHt-":["No file or folder selected"],"75Y1dk":["Horizontal pill strip + active panel below; click a pill to switch panels."],"77SdEP":["Delete ",["itemName"]],"7FamGZ":["Go to line"],"7Fkcej":["+ Add ",["addChildName"]],"7H4UHD":["Documents tagged <0>#",["tagName"],"</0>"],"7JtSLi":["Failed to delete path"],"7KeV5F":["Undo all failed: ",["message"]],"7OhaRy":["Source search"],"7Ongq0":["Condense my AGENTS.md file to less than 40k characters"],"7OwvEL":["Show HTML preview"],"7PNNNs":["This sends content off your machine"],"7PXYaF":["<0>ok</0> won't run in external terminals until you add it later from the File menu. OpenKnowledge's built-in terminal and AI tools keep working."],"7PzzBU":["User"],"7YRrJ9":["Available in the OpenKnowledge desktop app. From a terminal, use<0> ok config-sharing status</0> / <1>share</1> / <2>unshare</2>."],"7_bFEL":["Drag ",["patternText"]," to reorder"],"7apDiJ":["A folder named <0>",["sanitized"],"</0> already has files here. Pick a different name."],"7d1a0d":["Public"],"7hctf2":["Describe the project you want to create"],"7jIIFX":["You're all set up!"],"7qRHf0":["Install for Claude Chat & Cowork"],"7uBlRT":["Copy the focused file-tree item so Paste can duplicate it."],"80c4-P":["Code copied to clipboard"],"81H_23":["Add properties"],"881Uwh":["Delete selected table"],"89TtiD":["New file from template \\"",["displayTitle"],"\\" (",["fileName"],") in the project root"],"8BsGpU":["A key is set, but the embeddings provider rejected it or was unreachable — search fell back to keyword matching. Check the key in <0>Settings → Account</0> and your provider settings."],"8F1i42":["Page not found"],"8FqTCr":[["chunksRemaining","plural",{"one":["#"," unresolved hunk"],"other":["#"," unresolved hunks"]}]],"8Gzz2G":["worktree of ",["worktreeOf"]],"8IP5jY":["Each selected tool gets an OpenKnowledge MCP entry."],"8Jm2EP":["Toggle heading levels 1 through 6."],"8OGgNM":["Open or close visual-editor find."],"8OxKZy":["Move succeeded but the sidebar may be out of date — refresh to resync"],"8PifYj":["Mermaid diagram"],"8PmoQF":["Open the insert menu in an empty or active text position."],"8RtNI0":["Failed to load documents"],"8XQRON":["Loading repositories"],"8_brI5":["Name is required"],"8cS0nH":["Config sharing unavailable: ",["0"],"."],"8cpOa8":["Couldn't disconnect — please try again."],"8cpeU3":["Shared repositories"],"8eW0WQ":["No matching repositories."],"8fRyLo":["Invalid patch payload"],"8fc_3j":["Protected branch — cannot push"],"8m8diM":["No location selected. Use Browse to choose a folder."],"8tjQCz":["Explore"],"8uAWix":["This template lives in a parent folder — deleting it affects every folder beneath it that doesn't define its own version."],"92rbk2":["Mirror loading <0>",["mirrorRef"],"</0>"],"96G6Re":["New folder"],"96w9hU":["Something went wrong opening this file (HTTP ",["status"],")."],"99eR72":["Visual editor table selection"],"9Bd18D":["Failed to load hub pages"],"9NJWgv":["Backlinks"],"9OIqw4":["You don't have write access to this repo."],"9PQysm":["Hide advanced"],"9R7pRC":["No tags match \\"",["trimmed"],"\\". Continue typing to create one."],"9UQ730":["Clone"],"9V0W-R":["Adds the OpenKnowledge skill to the <0>Claude Desktop App</0> so it's available in Chat and Cowork sessions."],"9bCiQ8":["No pages are missing incoming graph links."],"9clcD5":["Open documents tagged #",["chip"]],"9dw5bW":["Create with ",["0"]],"9euN0m":[["count","plural",{"one":["#"," more cross-doc participant"],"other":["#"," more cross-doc participants"]}]],"9fhQRL":["Beta channel"],"9fvog2":["Preview unavailable: ",["errorDetail"]],"9i21pa":["Commits happen automatically"],"9jnjV0":["Embed an audio file with native player controls."],"9mEZeD":[["name"]," CLI"],"9npOH9":["Open file"],"9o1bIV":[["behind"]," behind"],"9oE4C3":["Browse your repos:"],"9sBe85":["Follow us on"],"9tJX8r":["By meaning"],"9zb2WA":["Connecting"],"A1taO8":["Search"],"A50vr3":["Use lowercase letters, digits, and <0>-</0> only."],"A5CYnd":["Broken link"],"A5hiCy":["Create template"],"A67Uwj":["Still loading"],"A6h5b-":["File duplicated"],"AAlr5Y":["No collab server for this worktree — run <0>ok start</0> here, or reopen the project."],"AB4qw9":["New terminal"],"AE7BY3":["The terminal session ended."],"AIn2Yv":[["displayName"]," CLI, ",["hint"]],"AItsE5":["Open it there"],"AKxFtn":[["openedWorktreeCount","plural",{"one":["worktree"],"other":["worktrees"]}]],"ALhMYW":["Terminal"],"AQ-Lfg":["Couldn't load templates"],"AQGtjK":["Commands run with the full access of your macOS user account on this machine. Turn this off to disable the shell."],"ATGYL1":["Email address"],"AVW-K9":["Failed to load orphan pages"],"AWOSPo":["Zoom in"],"AaaESH":["Auto-sync is off for this worktree, inherited from ",["project"],". Change it in Settings → Sync."],"AcK_r0":["Claude CLI"],"AczYxH":["Custom open-knowledge entry — not managed by OpenKnowledge"],"AdcGcG":["Applying your change"],"AddR83":["Could not create project. Try again or pick a different location."],"AeHuzT":["# One pattern per line.\\n# Examples:\\n# drafts/\\n# *.draft.md\\n# !keep.md"],"AeXO77":["Account"],"AiNMQ7":["This project lives only on this computer. Connect it to GitHub to back it up and share it with other people."],"Aif3E7":["Enable semantic search"],"Am78jY":["Drag ",["keyName"]," to reorder"],"Aq-O0x":["status"],"AqnqMJ":["API key set"],"ArBWJf":["Undo last edit"],"AsqRE_":["Default location for new attachments"],"AtBdnD":["Couldn't delete skill: ",["error"]],"B11p-O":["Edit markdown link"],"B2DrPb":["Auto-save"],"B2Srgd":[["packName"]," skill installed."],"B3NAZC":["Open Navigator"],"B4_ipX":[["conflictCount","plural",{"one":["#"," file conflicted"],"other":["#"," files conflicted"]}]],"BAH4qX":["Selected graph item"],"BBqGS9":["Desktop"],"BD0XSC":["Failed to load project templates"],"BEkF-P":[["userName"],", ",["tabCount","plural",{"one":["#"," concurrent tab"],"other":["#"," concurrent tabs"]}]],"BGHHtQ":["Single page"],"BH56dn":["Custom display text"],"BQKHuL":["Restart terminal"],"BQu9Pg":["Symlink"],"BUyQnq":["Couldn't restart the server. Try \`ok start\` in this folder."],"BY-g4_":["Add pattern"],"Bdha5y":["Publishing..."],"BeWTQy":["Loading starter packs"],"BgV29F":["Visual editor find input focused"],"Bn9-El":["default"],"Bv5a9_":["Selection statistics"],"Bx4EXG":["Actions for ",["label"]],"By-7Pn":["Toggle a bullet list."],"BymzO4":["Document outline"],"C37Zkt":["Send to"],"C62P6b":["Editor selection"],"C7XjNB":["Global Skill"],"C9TBvF":["No Outgoing"],"CCTop_":["Recent"],"CFnavk":["This project isn't a git repository, so worktrees aren't available."],"CKyk7Q":["Go back"],"COr1Y7":["Pick <0>openknowledge.skill</0> from your <1>Downloads</1> folder. It enables automatically."],"CSL0l1":["Couldn't clear the key — please try again."],"CTJLpz":["\\"",["trimmed"],"\\" already exists here"],"CU3AiE":["Switching branches"],"CWzc2T":["<0>~/.ok/bin</0> and <1>~/.ok/env.sh</1> stay either way — the app always maintains them."],"CXTwen":["Can't safely edit this project config"],"CXj9C-":["New property name"],"C_WGy8":["This file is too large to open in the built-in text editor (1 MB limit). Use Open file below to open it in another app."],"C_cPoW":["Your GitHub session expired — sign in again to verify push access."],"ChAtFg":["You don't have permission to push to this repo"],"CifUuG":["Update available"],"Ck9XRt":["Couldn't save the key — please try again."],"CmeH9S":["Add property to ",["keyName"]],"CoHvYd":["Moved ",["0"]," to position ",["1"]," of ",["2"]],"CvsD6Y":["via ",["viaTags"]],"D-Oh1s":["How to set up ",["0"]," (opens in browser)"],"D12vtS":["(detached)"],"D2CwBE":["Create a new OpenKnowledge project from the <0>",["0"],"</0> starter pack (",["1","plural",{"one":["#"," folder"],"other":["#"," folders"]}]," and starter templates) in the folder of your choice."],"D4H2N6":["Remove ",["tag"]],"D8OV7J":["Only collaborators"],"DDTdLl":["Code block settings"],"DELNQk":["Collaborators see your in-progress edits as soon as they sync."],"DEWDbv":["Show diagram"],"DF1MtZ":["Loading conflict for ",["filePath"]],"DFfRbX":["Sync status: ",["syncStateLabel"]," — git identity unset"],"DId6MT":["Project-level pages with no outgoing graph edges."],"DJd000":["Activate the previous editor tab."],"DPfwMq":["Done"],"DVh_Tb":["Failed to clean up after trash"],"DXd9LM":["New worktree"],"D_WKe_":["Click an agent's avatar in the presence bar to view their session."],"DbILZA":["No matches. Some files are excluded from search (hidden or ignored files)."],"DeDYLr":["Unrecognized wiki link"],"DgcGrb":[["fileCount","plural",{"one":["file"],"other":["files"]}]],"DhK_hZ":["Moved \\"",["name"],"\\" to ",["0"]," (",["skipped"]," binary file(s) not copied)"],"DhLHEb":["Failed to load activity"],"DiFKSL":["Counting markdown files"],"Dnn2XG":["Automatic"],"DrYM2Z":["Sync disabled"],"DskIkK":["Sign-in stream ended without confirmation — please try again"],"Dub54T":["Preview browsers can't auto-copy. Use Cmd/Ctrl+C on the URL above, or open OK in the desktop app."],"Dvwa0U":["Create a worktree from this branch"],"Dw1T_W":["Rename ",["label"]],"E1Da_b":["This permanently removes ",["0"],". Agents that invoke this skill by name will fail until it's recreated."],"E1_c72":["Task list"],"E1tG2u":["Get Claude Code"],"E2Mv-X":["Copy source"],"E4XYYH":["Enable terminal for this project"],"E5WeIy":["Reopen the most recently closed editor tab."],"E6lrpp":["Manage the GitHub account OpenKnowledge uses to browse and sync your repositories."],"E7BhZn":["Blank note"],"E9bKSA":["Creating"],"EBVbtP":["Could not duplicate item"],"EDl9kS":["Subscribe"],"EDm3wJ":["Loading diff renderer"],"EEYbdt":["Publish"],"EHu0x2":["Syncing"],"EJuO7B":["Connect a GitHub account to browse and sync your repositories."],"EL_YRd":["Mirror of <0>api-spec</0>"],"EOjU5V":["Inline Math Properties"],"ETyvvg":["No language match."],"EVnzPs":["Edit with AI"],"EWX92Z":["Collapse Ask AI"],"EZVxVz":["Replace the active match from the replace field."],"E_BHoD":["Could not move \\"",["targetName"],"\\" to the Trash. Do you want to permanently delete instead?"],"E_tNGD":["Connected as @",["login"]],"Ea1prf":["Choose which editors every skill in this project installs into."],"EarrCe":["Search emoji"],"EbZT7P":["Toggle the left file sidebar."],"EbjWsS":["Current commit"],"EcM3k7":["Failed to clean up pending ",["kind"]],"EcR0fl":["Checking for installed agents"],"EdQY6l":["None"],"EeRZnZ":["Expand burst ",["burstNumber"]," diff"],"Ef7StM":["Unknown"],"EhDLBx":["You modified <0>",["filePath"],"</0> locally, but it was deleted upstream."],"Ehkru0":["Open, navigate, accept, or dismiss CodeMirror completion suggestions."],"EiVgl5":["You don't have permission to push to this repo."],"Eji13z":["Toggle highlight formatting."],"EkH9pt":["Update"],"El7NbA":["Heading 2"],"Emz5BG":["Embeddings are computed only when a search runs and are cached locally under <0>.ok/local</0>."],"EoaQyO":["Append-only log of what changed."],"EqrC_R":["Undo failed: ",["message"]],"EqtBXb":["Visual editor find open"],"ErRi6L":["Template \\"",["label"],"\\" deleted"],"Es-eZU":["Remove from recent projects"],"Ev2r9A":["No results"],"EvPX7f":["Opens a folder picker to choose where to clone the repository."],"Evq3lu":["Orphan mode"],"ExPiRQ":["Move to the next CodeMirror lint diagnostic."],"ExUzM4":["skill \\"",["0"],"\\""],"F-NRCj":["Add property"],"F-vBv0":["Ask"],"F0OA00":["Get ",["displayName"]],"F1T9y_":["Showing top matches — keep typing to narrow"],"F4IYWe":["Share doc"],"F4vEsL":["Sync status: ",["syncStateLabel"]],"F6pfE9":["Active"],"FBknns":["HTML"],"FCAcjR":["Run a real terminal docked inside OpenKnowledge, starting in this project's folder."],"FCxvG5":["First item"],"FEK4oC":["OpenKnowledge will be initialized at <0>",["gitRoot"],"</0> — the parent of your new folder, because it contains a <1>.git</1> folder (one project per git repo)."],"FEqWFL":["Guides your AI agents on how to work here."],"FEr96N":["Theme"],"FNTx6u":["Search \\"",["semanticSubmitQuery"],"\\" by meaning"],"FOGD7m":["Create something great."],"FOyCTr":["Your OpenAI API key, used only to create embeddings of your content for semantic search. Stored once for this machine in <0>~/.ok/secrets.yml</0> (readable only by your user account) and shared across all projects. Turn the feature on per project in This project → Search."],"FRYB1Q":["/api/config returned a malformed body"],"FRqZ9v":["Couldn't update skill: ",["0"]],"FTUGgh":["Enter a repository URL or owner/repo"],"FUMerq":["Could not enable sync: ",["detail"]],"FWQuPE":["This project is running a different, incompatible build of OpenKnowledge than this app (v",["0"],")."],"FXk_zY":["Adds a guided workflow for authoring new Agent Skills."],"FjkaiT":["Zoom out"],"FnMkli":["Sync disabled — you don't have permission to push"],"FqTpiN":["Bird wiki"],"Fqr8BP":["Multi-page PDF viewer with toolbar controls (thumbnails, page nav, zoom)."],"Fsx78O":["Add the <0>ok</0> command to your terminal"],"FvMSms":["Renaming changes the file on disk and the id agents use to pick this template."],"FvpFSZ":["Reveal in Finder, ",["hint"]],"Fxf4jq":["Description (optional)"],"Fy4GgU":["Explain how your codebase works so teammates and AI agents can find their way around. Good for documenting the architecture, the main parts, and the questions new contributors always ask."],"FyW0WO":["Authorize in browser"],"G-JBA1":["Source mode requires a live connection — your edits are saved and will appear when you reconnect."],"G0YZ-I":["Indent or outdent list item"],"G1Gw0v":["New template"],"G1XxbZ":["Checkbox"],"G4-bgo":["Ask AI (from selection)"],"G7-rf8":["Pattern syntax error: ",["message"]],"G7cMuO":["HTML preview"],"G8t9NN":["Add a property"],"GA-UkN":[["keyName"]," type: ",["typeLabel"],". Click to change."],"GDvlUT":["Role"],"GF51cw":["Give the AI tools you use access to read and update your projects. Pick what to set up below, and change it anytime."],"GGsM4y":["Selected in graph"],"GJH-AT":[["docName"]," is ",["0"],". OpenKnowledge currently opens files up to ",["1"],"."],"GK-IRZ":["Undo buttons are disabled — per-session state has been garbage-collected."],"GLxIKR":["How to push manually"],"GN6L5F":["Filename"],"GQDSBN":["Layout options"],"GUYwCr":["Dismiss notice"],"GUqTzn":["Competitor research"],"GXf9hG":["Cloning ",["repoName"],"..."],"G_686w":["Task List"],"G_efLf":["Installed into"],"G_mWXb":["Filter languages"],"GamjcN":["Template saved"],"GemPfn":["Failed to parse forward-links error response (HTTP ",["status"],")"],"Gfr4fu":["Server can't open documents"],"GhjUB_":["Reconnected"],"Gp_twO":["Local path"],"GsBUCk":["Loading settings"],"Gt4gOO":["This folder has unpushed changes. Recipients will see the last pushed version."],"GubkSu":["Use a starter pack"],"GuqOb1":["Failed to load headings"],"Gx0VS1":["e.g. drafts/ or *.draft.md"],"GzPQ2f":["Stay in the loop"],"H-vDm3":["Relaunching to install the update…"],"H0WlWQ":["Grid of rows and columns with a header row."],"H86f9p":["Collapse"],"HAvRAI":[["skillCount","plural",{"one":["skill"],"other":["skills"]}]],"HCn0Ay":["Toggle strikethrough formatting."],"HGNCsl":["Connection lost — keep this tab open, your edits will sync when reconnected"],"HIb0vl":["Network error — please try again"],"HM56Bx":["Creating..."],"HPTPGr":["Create a new spec file for my user story"],"HSh8u_":["Folders"],"HTW0Zw":["One more step: run <0>claude</0> in this project and approve OpenKnowledge once."],"HXFyWD":["Split diff"],"HdkSiO":["New file"],"HfI1dR":["I already have it locally →"],"Hl89Qd":["Loading templates"],"HlmZBk":["Documents response did not match expected shape."],"Hnl9nT":["Set where pasted and dropped files are stored for this project."],"HoWElC":["This ",["targetNoun"]," has been moved, renamed, or deleted in your local copy of branch <0>",["branch"],"</0>. Please commit your changes or enable auto-sync."],"Hp1l6f":["Current"],"HpK_8d":["Reload"],"HptUxX":["Number"],"HqiZvw":["OpenKnowledge stores its configuration and internal files inside a newly created <0>.ok</0> directory in your project root folder."],"Hrz9NY":["Wiki link"],"HyvSqq":["Project Skill"],"I1gRhX":["Failed to rename"],"I5685_":["Try a prompt"],"I5AfhE":["Sync status unavailable — server unreachable."],"I7Exsw":["Follow us on X"],"IA1wNb":["The Claude Desktop App didn't open the file. Is it installed? (",["msg"],")"],"IA6JW2":["Detecting"],"ICoNYz":["You can also manage this in Settings."],"IInnZo":["Conflict"],"IKoTAC":["Keep disabled"],"IN4UX8":["Search (",["searchShortcut"],")"],"IQPyrD":["Missing page — click to create"],"IRv9cH":["Cloned ",["repoName"],"."],"IWGfGF":["Checking your GitHub connection"],"IX7-sq":["Something went wrong opening \\"",["docName"],"\\"."],"IX_uXB":["my-feature"],"IajAbS":["Add a starter pack"],"If0crP":["Open with AI ",["targetDisplayName"],", ",["hint"]],"IgTwLt":["Open this document in the editor and collapse the graph."],"Ik-gP0":["Heading H",["level"],": ",["text"]],"Iq8zdU":["Close terminal"],"IrB5AK":["Server-side cleanup failed for ",["failedCount","plural",{"one":["#"," item"],"other":["#"," items"]}]],"IreQBq":["Repository"],"It9ARY":["Toggle the right document panel."],"Ix0K8o":["Hide external URL nodes"],"J2MgzQ":["Undo all edits on ",["docName"]],"J2Mv98":["Name (e.g. ",["login"],")"],"J2eKUI":["File"],"J3HzPL":["Collapse ",["keyName"]],"J6N5MX":["Couldn't construct the share URL. Try Done and re-share."],"J6mxC1":["A network problem or GitHub outage interrupted the clone."],"JCxGEX":["No disconnected pages. Pages appear here only when they have no incoming and no outgoing graph edges."],"JE21eh":["Symlink to ",["targetPath"]],"JK-Ave":["Hide thumbnails"],"JL3si7":["Updating"],"JLUTgi":["No tags yet — author \`#tagname\` in any doc to populate the index."],"JLzQi_":["Close ",["accessibleLabel"]],"JOcPqH":["Bring a remote repository onto this machine."],"JWsZlx":["Open a project to edit."],"JZ8cO6":["Light, dark, or follow the OS."],"Jejur6":["Couldn't load document"],"Jhj_lh":["Modify the link target, anchor, and display label."],"JkCD2u":["Sync paused — you don't have permission to push to this repo"],"JmfgFc":["(a worktree of ",["0"],")"],"Jqqevv":["System error"],"JtD-Br":["Page link"],"Jw6EC4":["Branch switch failed — try opening the ",["targetNoun"]," manually."],"K-a33w":["Start writing to create this page"],"K-h9cT":["Couldn't save the resolution for ",["filePath"],"."],"K0N7zS":["Config sharing status read failed"],"K1ckLX":["Failed to create folder"],"K6MQQk":["Sync is failing. See the sync status for details."],"K6jjWB":[["packName"]," was already set up. Nothing to do."],"K6jxcj":["Add a key"],"K8-WWn":["Move between table cells"],"K9J00P":["Clone failed — connection error"],"KDuPiY":["Uploading ",["fileName"]],"KDw4GX":["Try again"],"KFdXwz":["Show panel (",["panelShortcut"],")"],"KH5bQi":["Using the <0>OK_EMBEDDINGS_API_KEY</0> environment variable (managed outside OpenKnowledge)."],"KIIamL":["OpenKnowledge will create commits and push them to your remote automatically. If you do not want automatic commits in your git history, you should not enable auto-sync."],"KOZud0":["Build a competitor research knowledge base. Start with an overview page, then add cross-linked pages for each competitor, their products and pricing, and the sources behind every claim."],"KPW5WC":["moved template"],"KQGZuq":["Reused if it already exists, created if not."],"KRJ6xh":["No tags yet. Continue typing to create one."],"KWL_Ih":["Blog post"],"KX1MZR":["Your repositories"],"KYSocE":["Research the extinction of flightless birds"],"KYcZ6Y":["Above"],"KZLdgR":["See <0>#design-docs</0> for the latest specs."],"K_vT1F":["Upstream sync"],"KaFCD3":["Open this link in a new tab and collapse the graph."],"Kf7GG5":["Restarting the server…"],"Kgdbkt":["Switch to local-only refused"],"Kh1n4a":["<",["componentName"],"> isn't a known component. Copy the source to use it elsewhere, or delete the block."],"Khxcyu":["Terminal access isn't enabled for this project."],"KkEAud":["Create a file from the current document or folder context."],"KmydK6":["Bold"],"KnoB--":["Will be saved as <0>",["sanitized"],"</0>."],"Kr3VPS":["Codex will still ask until you run \\"ok init\\" in a terminal for this project."],"KsAPaB":["This branch is checked out in:"],"KszKI_":["Skill level"],"KujtjC":["Find"],"L-rMC9":["Reset to default"],"L1ZE3M":["Document statistics"],"L3CEC1":["this item"],"L4Cdd9":["or create a new file <0/>"],"L6Hhh6":["(root)"],"L8fKuc":["Run this in your terminal"],"L9Y9Om":["Top linked pages"],"LBwUR6":["Branch switch timed out — try opening the ",["targetNoun"]," manually."],"LCUy_N":["Session ended"],"LDuM35":["Replace current match from field"],"LE7t79":["Clone to a new folder"],"LKOLNn":["No AI agents installed"],"LNum6A":[["minutes"]," min ago"],"LRgZAt":[["owner"],"/",["name"]," already exists"],"LXdWeS":["Medium section heading."],"LXfNU-":["Navigation and suggestions"],"LYufDw":["Failed to enable semantic search — ",["detail"]],"LbmLyU":["Can't safely edit this tool's config"],"Lcehxn":["Save resolution"],"LdABLa":["Could not open ",["target"],". Try opening it manually."],"LdKIHS":["Draft a spec"],"LhQlGR":["This project is running an older version of OpenKnowledge (v",["0"],") than this app (v",["1"],")."],"LhWYpm":["Other OK paths are tracked upstream:"],"LiAw2k":["What this changes"],"LlHqdU":["Initializing project"],"Llyqvo":["This usually means one of:"],"LpB85N":["Plain"],"LtI9AS":["Owner"],"LtSYdi":["Reveal in Finder"],"LtiJ5c":["Project skill"],"LuoJWu":[["truncatedShownCount","plural",{"one":["Showing the first item in one folder — the rest of that folder is hidden."],"other":["Showing the first ",["formattedCount"]," items in one folder — the rest of that folder is hidden."]}]],"LwMxXg":["Failed to open worktree."],"M1OfV9":["Next source diagnostic"],"M3ytY_":["This looks like a drive root (e.g., C:\\\\). Scaffolding here will scan an entire drive."],"M5mfAe":["Add tag"],"M9597s":["Preparing share URL..."],"MCjC9A":["Delete ",["deleteDescriptorLabel"]],"MDZSJe":["When the agent runs its scheduled work."],"MGb89P":["Insert, delete, move, copy, and indent source editor lines through CodeMirror's default keymap."],"MHrjPM":["Title"],"MKOVhz":["Enable git auto-sync"],"MQIM_Y":["Couldn't copy. Select the URL above to copy it manually."],"MTs6g3":["Couldn't reconnect after server restart"],"MUBR8r":["Rename succeeded but the tabstrip may be out of date — refresh to resync"],"MUrVEo":["No recent projects."],"MV-Dkb":["Found ",["countDisplay"]," markdown files"],"MVxpbf":["Find and replace"],"MWrUEd":["Undo all"],"MZSBsh":["No templates yet. Add one to give new docs in this folder a ready-made starting point."],"MZoxVx":["Failed to load tags. Press Escape and re-open to retry."],"Mb_20S":["Visual"],"Md709y":["Loading ",["fileName"]],"MdpSC1":["New skill"],"Mh_4hd":["Previous tab"],"Mj8R8K":["Couldn't install skill: ",["0"]],"MmDDWK":["Recently opened"],"MmqnGI":["No global skills yet."],"Mnavhe":[["propPanelDescriptorLabel"]," Properties"],"MqQoV-":["Describe what you want to build, start a blank file, or scaffold from a template."],"MrwYIK":["Toggle a source comment through CodeMirror."],"MsuXaI":["Hide panel (",["panelShortcut"],")"],"My9uXI":["Updated \\"",["display"],"\\" to ",["0"]," — your previous version is in history if you need to restore it."],"N1KkEO":["Jump to last tab"],"N1YYa7":["Loading image"],"N1mdmS":["This file can't be opened in the text editor."],"N2FcBE":["Synced"],"N2S1rs":["Empty"],"N2eHWq":["Code Block"],"N3_ozB":["Hubs"],"N55YNr":["Choose whether this project's OpenKnowledge setup, including its AI-tool connections, is saved with the project so teammates get it too, or kept only on your computer."],"NEzPEh":["Create a new branch, or check out an existing one, in its own window."],"NIWAux":["No docs registered under #",["tagDocsName"],"."],"NJyQi_":["Branch ",["shareBranch"]," no longer exists on the remote."],"NKkZXl":["Initialize and open"],"NNJsn7":["One more step: enable it in Cursor → Settings → Tools & MCP (Cursor leaves project servers off until you turn them on)."],"NOHyEE":["Retry push"],"NORKZU":["Pattern warnings: ",["summary"]],"NQ8llq":["Add item"],"NRSLBe":[["diffMin"],"m ago"],"NSnIUP":["Two-page (even)"],"NUr4kz":["A reusable starting point for new documents in this folder."],"NYUhy5":["Subfolder name"],"N_7kkF":["Read through this codebase and draft a technical spec for the most complex module: an overview, the architecture, key files, and open questions, all linked from a specs index page."],"NcurBF":["Pan down"],"NjrIak":["File: <0>",["fixedName"],".md</0>"],"NkXEFS":["Restore failed — document unchanged"],"NmPNJJ":["Copy code"],"Nn4GgW":["Will be created as <0>",["sanitizedName"],"</0>"],"NnQapF":["Open with AI ",["targetDisplayName"]],"NpC29w":["Create a new list item from the current list item."],"Nu4DdT":["Sync"],"Nu4oKW":["Description"],"NuH1jp":["Public repository"],"Nv3mUj":["Show advanced"],"NvOvTi":["Create in <0>",["dirDisplay"],"</0>"],"Nx7BWE":["Git auto-sync"],"NxW-md":["Resize ",["handleKey"]],"NzFvyK":["Session ended — undo unavailable"],"O0Z2Xr":["Outgoing"],"O2UpM1":["Browse"],"O3oNi5":["Email"],"O4PnDd":["AI tool management is only available in the OpenKnowledge desktop app."],"O6yEPk":["Create a new OpenKnowledge project in the folder of your choice."],"O7_W_a":["Open with AI"],"OD0FCX":["Hidden “",["basename"],"”"],"ODGGlj":["Folder name: ",["detail"]],"OETysD":["No hub pages yet. Hubs appear once pages accumulate inbound graph links."],"OEu_0l":["Failed to load skills: ",["0"]],"OFBmkg":["Search files, commands, projects, and AI handoff actions. With text selected in the visual editor, this chord adds a link instead."],"OJTOUj":["Requires ",["brand"],"."],"OJeiSH":["Failed to add property"],"OLBz-_":["Mermaid diagram failed to render."],"OLIKgw":["Drag item ",["0"]," to reorder"],"ONPvOb":["Loading agent activity"],"ONgEZF":["Loading headings for ",["pageTarget"]],"OOIVJo":["Uninstalled \\"",["0"],"\\" from ",["1"]],"OTF92M":["Label <0>(optional display text)</0>"],"OVjNeX":["Terminal ",["0"]],"OX2Neh":["Inline code"],"OXb_Df":["Settings content"],"OYnx7O":["Path cannot start with \\"/\\""],"OZJeTZ":["Skill"],"OdmsFg":["Failed to delete item"],"OeAl1e":["e.g. assets/uploads"],"OgyJSr":["Local only"],"OiHJdA":["Move through slash, wiki-link, tag, and path suggestions; accept or dismiss the active suggestion."],"Okd2Xv":["Toggle underline formatting."],"OlAl5i":["Expand all"],"OmHTGj":["Disable git auto-sync"],"On0aF2":["Website"],"Oo_WWc":["No pages found"],"Oos8fo":["Copy command"],"OplnBG":["Managing AI tools is unavailable in this build."],"OuY8t9":["Open in current branch"],"OvEjsP":["Copying..."],"OxplNM":["Updated \\"",["0"],"\\": added ",["1"],", removed ",["2"]],"Oxyd5f":["Pick a name"],"OyIC0Q":["Project name"],"P-ye9o":["Could not open folder picker"],"P0HC30":["This ",["targetNoun"]," moved to <0>",["0"],"</0>. Open it there?"],"P3NS4G":["Pattern syntax error (line ",["lineNumber"],"): ",["message"]],"P3hnm0":["File too large to open"],"P47EWZ":["Could not update sidebar settings"],"P6gXB-":["Replace ",["keyName"]],"P6lAT3":["Folder target: ",["linkTitle"],". Click to open the overview."],"P8yDjG":["Name can’t be empty, \\".\\", \\"..\\", or contain / or \\\\"],"PB4upl":["Find previous match"],"PBwmDJ":["Searching by meaning"],"PBxg_E":["Not now"],"PCNIuJ":["File an issue"],"PCSkw2":["Skills"],"PIMM5l":["You're subscribed!"],"PKLY-1":["Opening..."],"PMyJ9C":["No edit session yet"],"PPFQ3o":["Installed \\"",["0"],"\\" into ",["1"]],"PQCdtv":["\\"",["docName"],"\\" doesn't exist."],"PR9FSv":["Move to the next visual-editor find result."],"PRnH8G":["of ",["0"]],"PVUn_c":["Open folder"],"P_bX4O":["How to set up"],"PdA9NZ":[["ahead"]," ahead"],"PdJZ5p":["No skills yet."],"Pgu10b":["Saved as <0>",["slug"],".md</0>"],"PgzIpb":["Move to the previous visual-editor find result."],"PiH3UR":["Copied!"],"PkeYXL":["Expanded graph mode"],"Pkw7J9":["This folder is empty."],"PqYWiC":["Couldn't restart the server automatically. Try running \`ok stop all\` in a terminal, then reopen this project — or restart your computer if it persists."],"PrJYSN":["This folder isn't on GitHub yet. The link won't work until it's pushed."],"PrhzDE":["Pan up"],"Pyp1NA":["Restore to this point?"],"Q5fqMz":["Connection error — try again"],"Q6hhn8":["Preferences"],"Q7W-mC":["Same folder as current file"],"Q8A-U_":["Connected to"],"QAi7Q9":["Branch <0>",["trimmed"],"</0> already has a worktree — it'll open in its own window."],"QDZbvN":[["diffDays"],"d ago"],"QJaG-9":["Choose CLI for new chat"],"QNxpRm":["Dock terminal to the right"],"QOINDn":["empty"],"QQghPu":["Install in Claude Desktop"],"QR5SP1":["created template"],"QYfQdv":[["displayName"]," CLI"],"QcpeeE":["Navigate to ",["docName"]],"QfFBdJ":["The template's filename (without \`.md\`)."],"Qj4RL5":["Completed:"],"QlxHAH":["Showing results for \\"",["semanticResultsLabel"],"\\""],"QnjpOq":["What do you want to build?"],"QqBQu1":["Label <0>(visible link text)</0>"],"Qvls7J":["Eng specs"],"Qw-7Ie":["A simple place to write, with one file per topic and a daily journal. Pick this if you just want to start writing and let the links between notes build up over time."],"QyioBP":["Move up"],"R0cyYB":[["0","plural",{"one":["#"," request blocked by the preview's security policy"],"other":["#"," requests blocked by the preview's security policy"]}]],"R0jJzV":["Paste URL, owner/repo, or search your repos"],"R3y75Z":["Edit source"],"R65q-K":["A real shell is off for this project. Turning it on runs commands with the full access of your macOS user account."],"R9IDFz":["Renames the folder on disk and the id agents use to invoke it."],"RDjuBN":["Setup"],"RDrXh4":["Configure user, project, and integration settings."],"RG4XHV":["Copy ",["0"]," prompt"],"RGCCrg":["Copy share link"],"RGkNeJ":["Initialize a starter pack"],"RJ3a8Z":["Looking for <0>",["lookingForUrl"],"</0>."],"RN62Q8":["We'll build <0>openknowledge.skill</0>, save it to <1>~/Downloads</1>, and open the Claude Desktop App for you."],"RSqaSd":["Project root"],"RVZJWQ":["Search projects..."],"RXNu_r":["Shared via git with everyone working on this project."],"RY6Bq1":["Open shared ",["targetNoun"]],"RaPMZv":["Keyboard shortcuts available in the editor and workspace."],"Rah7yq":["What should the AI do? (optional)"],"RfHNf8":["Open activity panel for ",["tooltipName"]],"RfaEio":["Toggle source comment"],"RgbKEe":["You don't have access to this repository."],"Rj01Fz":["Links"],"RlCInP":["Slash commands"],"RlLl3G":["Actions for ",["0"]],"RmBY0A":["No git remote"],"RnrnTe":["Already set up — ok is available in your terminal"],"RobAKV":["Update the destination and optional section anchor."],"Rq1vFD":["Tree view options"],"RrAIZx":["What config sharing covers"],"Rx5ReQ":["Rename ",["keyName"]],"RyIKxy":["This ",["targetNoun"]," has been moved, renamed, or deleted in your local copy, and that change hasn't synced yet."],"S33tz3":["Not connected"],"S34Vju":["Have something else in mind?"],"S6l5dv":["Could not start creating a new item"],"S9Vnum":["Remove ",["patternText"]],"SCoBBH":["Tag suggestions"],"SCzAbA":[["phase"]," — ",["pct"],"%"],"SEYWYq":["Undo all edits on this file?"],"SFN6dN":["Heading 3"],"STTOnz":[["keyName"]," type: complex value (nested; read-only)"],"SUOoXn":["Failed to open project."],"SVLPt5":[["formatted"]," GitHub stars"],"SXCSQd":["Copied path"],"SYfHmN":["Unpin tab"],"Sc1bKE":["Local collaboration data for \\"",["docName"],"\\" could not be cleared in time. Reload to retry."],"ScwcF2":["A project already exists at this location. Pick a different parent folder."],"SgKLfA":["Not connected to GitHub."],"Sh3Qkg":["No matching branches."],"SiUUCS":["Next match"],"SkMZlS":["Couldn't remove <0>",["targetGitPath"],"</0>: ",["removeGitError"]],"Skr_7L":["Search worktrees"],"Sq8lf2":["Editors to install skills into"],"SrOuyg":["Document panels"],"T-654M":["Loading PDF"],"T0OVm7":["The default branch is protected — pushes need a pull request."],"T67A0Y":["Auto-sync pushes/pulls commits to your git remote on intervals and on save. Toggling on requires confirmation."],"TEEPPF":["Will replace existing OpenKnowledge entry"],"TJnkyf":["ok ui responded but server.lock has no port yet"],"TKQ7K-":["Install"],"TLIO3j":["Toggle italic formatting."],"T_wG4n":["We couldn't check your GitHub connection."],"Ta25TG":["No history yet"],"TbjyhA":["Docs"],"ThmUrC":["Could not finalize project setup. Try again."],"Tjc1pH":["Section <0>(optional heading anchor)</0>"],"TsZmgr":["The file on disk, and the id agents use."],"TwYboS":["Navigate CodeMirror source search results or dismiss the search panel."],"Tz0i8g":["Settings"],"Tz9pJB":["Clone stream ended unexpectedly — check if the clone completed"],"U2Kx6T":["Close all unpinned"],"U2pMtf":["tag-name"],"U3IvM5":["Full guide"],"U5Spo9":["Content directory must be inside the project"],"U8CD-l":["Copy full path, No workspace"],"UBv8UK":["Delete Permanently"],"UDFrWm":["Checking GitHub connection..."],"UL8A9w":["Tag"],"UMrOy2":["Skill \\"",["trimmedName"],"\\" created"],"UPjaXD":["Couldn't duplicate \\"",["0"],"\\": ",["1"]],"UQAp48":["Search templates"],"UQMMvx":["Moved \\"",["name"],"\\" to ",["0"]],"URmyfc":["Details"],"UTNVyS":["Select the full source document."],"UTZ97u":["Selection must be inside the project"],"UVLlMV":["Couldn't reach GitHub. Try again?"],"UW2Fg3":["This project's running server doesn't support live editing. Restart OpenKnowledge to fix."],"UW93oq":["Replace key"],"UYcGIW":["Connecting — waiting for collab server"],"Ua78MH":["no response"],"UaDyeb":["Hide selection preview"],"Uay5NL":["This ",["targetNoun"]," was added to branch <0>",["shareBranch"],"</0> recently. Switch and update to open it."],"Uci-Ph":["Ordered List"],"Ud0Pj9":["<0>Mirror source removed.</0> The doc <1>",["src"],"</1> is no longer available."],"UfW9Kr":["Your search queries and the full text of matching pages are sent to your embeddings provider (OpenAI by default) to compute embeddings."],"UhpfxY":["Pan left"],"UkQGhd":["Hide replace"],"Up2_7p":["Copy full path"],"UuYo7g":["This ",["targetNoun"]," has been moved, renamed, or deleted in your local copy. Please commit your changes or enable auto-sync."],"Uuj_R4":["New from template"],"Uw6ERJ":["Couldn't copy: ",["detail"]],"UyROxs":[["mins","plural",{"one":["#"," min ago"],"other":["#"," min ago"]}]],"V48OUT":["You deleted <0>",["filePath"],"</0> locally, but it was modified upstream."],"V7QxyT":["Connection dropped"],"VAHWL_":["Connected as <0>@",["signedInLogin"],"</0>"],"VBE2dw":["Build and keep track of the world behind your story. A home for your characters, places, factions, and the lore that ties them together, so details stay consistent as you write."],"VIwCaD":["Entry"],"VM7H66":["This file is binary and can't be shown as text."],"VNgKZz":["Advanced settings"],"VU3Nrn":["Missing"],"VUijjF":["Embed an image with optional alt text."],"VYd_YA":["Open an existing project folder from disk."],"VZGGPK":["Collapse terminal"],"VZGh8G":["Fold, unfold, fold all, or unfold all source ranges."],"VZSBXL":["Semantic ranking activates the first time an agent runs a search."],"V_6bJ4":["Terminal settings not loaded yet — try again in a moment."],"V_wltx":["Enter a title for this template."],"VbqhBI":["Already at ",["assetContentPath"]," — reusing."],"VcqWBy":["Upload may have succeeded but the sidebar is out of date — refresh to resync"],"VdXv4D":["Clone from GitHub"],"Vlc75q":["Keep file deleted"],"VsaI0G":[["folderCount","plural",{"one":["folder"],"other":["folders"]}]],"VuxVSP":["Start source completion"],"VvS_k_":["Config sharing is now local-only."],"VxO6wR":["Delete selected files or folders"],"VzGJRl":["Add link"],"W-ntoW":["heading-slug"],"W0i24j":["Object"],"W1qRuM":["This document is already active in the editor. Use Open to collapse the graph."],"W3Xlpc":["Set the auto-sync default for users opening this project for the first time. This setting is committed to your repository."],"W5A0Ly":["An unexpected error occurred."],"W7XJN4":["Can't nest projects. An OpenKnowledge project already exists at <0>",["rootPath"],"</0>. Choose a location outside it, or open that project instead."],"W8vpBM":["starter pack"],"W9_Bub":["Local changes overlap with incoming sync"],"WL6puM":["Path resolves outside project"],"WMIKXK":["Are you sure you want to delete ",["targetCount"]," selected items? Folders and all files inside them will be deleted. This action cannot be undone."],"WPwDin":["Open folder on disk"],"WR0y2O":["Share folder"],"WRNXKp":["Searching"],"WWcqsG":["Start here: what this is and how it's organized."],"WZ-vBy":["Permanently deletes <0>",["targetGitPath"],"</0> and all its git history. Working files stay in place. If the parent git repo is intentional (e.g. you cloned it), cancel and pick a location outside it."],"Waiy-j":["The agent's persona, values, and voice."],"WamGNs":["Failed to load PDF: ",["error"]],"WcWS__":["Download file"],"Wcv-Zi":["Make this knowledge base available as a Claude Skill."],"We7h2I":["📝 or assets/icon.png"],"Weq9zb":["General"],"Wgmlsw":["Fetching"],"Wh0im4":["editing [[",["realCurrentDoc"],"]]"],"WhOsNE":["Strikethrough"],"WmPbvm":["Get product updates in your inbox."],"Wq6Wcm":["Please enter a valid email address."],"WqLq6M":["Open with AI ",["displayName"]],"Wt5W56":["Sync is off — your edits will not sync to the remote repository."],"Wtw22s":["Installing"],"WyQxwa":["Connect this project to GitHub to share."],"WyXG7w":["Close all"],"Wyxs0x":["Path cannot contain \\"..\\""],"X0ttSN":["No tags match \\"",["tagListQuery"],"\\"."],"X7u0xR":[["0"]," templates available"],"X8kjQX":["Re-authenticate with GitHub"],"X9VpsP":["Loading folder contents"],"XAyxsa":["Check out remote branch"],"XDzAnp":["Opens in a new tab"],"XH30C4":["document"],"XJOV1Y":["Activity"],"XPJ0sN":[["settingsDescriptorLabel"]," properties"],"XPqe3B":["Create new tag #",["tagValue"]],"XRuL0i":["Create page"],"XU0OXn":["Enable auto-sync"],"XV5sC0":["Open worktree"],"XW18jo":["Page headings response did not match success schema"],"XYlJJT":["Setting up"],"XcGbim":["Show hidden files"],"Xet9MX":["Failed to load backlinks"],"Xewl6B":["Your local copy is behind. Pull the latest changes, then open the link again."],"XfzqjK":["template \\"",["name"],"\\""],"Xl-UUg":["guides/install or https://example.com"],"XmJfZT":["name"],"XnlF3W":["Add the next matching source selection."],"XnoA1k":["This ",["targetNoun"]," only exists on branch <0>",["shareBranch"],"</0>. You have uncommitted changes that prevent switching. Commit or stash your changes, then open the share link again."],"XopE_I":["Failed to parse backlinks error response (HTTP ",["status"],")"],"XpIZmv":["Fenced code block with monospace text."],"XqNHcm":["Couldn't update skill targets: ",["0"]],"XtRoxT":["Page ",["pageNumber"]],"XuQzrk":["Couldn't restart the server — another process owns it. Quit other OpenKnowledge windows for this project, then try again."],"XvPJaT":["Diff layout"],"Xv_ijG":["https://github.com/owner/repo or owner/repo"],"Xw_maT":["Type a query, then press ↵ to search your pages by meaning."],"XyOUTJ":["Exit merge"],"Xzy0s0":["Remove ",["fullLabel"]," from context"],"Y-Urt2":["Block math equation rendered with KaTeX from a LaTeX source string."],"Y1QMlM":["Get set up"],"Y1kX2z":["OpenKnowledge initializes at <0>",["projectDir"],"</0> — the parent of <1>",["pickedRelative"],"</1> because it contains a <2>.git</2> folder (one .ok/ per git repo). <3>Content directory</3> defaults to <4>.</4> (the whole repo); type a sub-folder to narrow it."],"Y6SK9K":["Show source"],"Y8ViJx":["A newer version may have been deployed since this tab opened."],"YC6_wP":["Edit ",["keyName"]],"YEP3X2":["Delete a table when the active table cell selection covers the full table."],"YGIi_c":["Reinstall"],"YJ1BTp":["A skill with that name already exists."],"YKLP_-":["Template renamed"],"YPFBfr":[["detail"]," - ",["kind"]," \\"",["createdPath"],"\\" still exists on disk"],"YSFv5w":["No git repository — config sharing does not apply here."],"YTLmTM":["Remove the parent <0>.git</0> folder"],"YW7Q86":["Search settings not yet loaded — try again in a moment"],"Y_kL7X":["Customize how the editor looks and behaves."],"YaeyFh":["Pulls may overwrite uncommitted edits in your local files."],"Yea-K5":["Restore to this point"],"Yi0VMG":["Upload ",["keyName"]],"YjhKI5":["Cloning..."],"YlDuro":["Fit height"],"YsEYYS":[["behind","plural",{"one":["#"," commit behind"],"other":["#"," commits behind"]}]],"YwPUUP":["This pack is already set up here."],"YyXtnN":["Underline"],"Z1LF1M":["Sharing a doc needs a GitHub repository. Create one for this project."],"Z2M5XM":["Reason: ",["reason"]," (",["osDetail"],")"],"Z3FXyt":["Loading..."],"Z5HWHd":["On"],"Z5h97D":["Hide files and folders from your knowledge base. Hidden items don’t appear in the file tree, search, or AI tools. <0>Learn more about patterns</0>."],"Z8KDox":["Enter a folder name (e.g. brain)."],"Z8lGw6":["Share"],"ZARuZJ":["Couldn't load files"],"ZBYKxv":["Reverts every change this agent made to <0>",["docName"],"</0> this session (",["burstCount","plural",{"one":["#"," burst"],"other":["#"," bursts"]}],"). Other files and writers are unaffected."],"ZBt4rI":["Instruction for the AI"],"ZLQol-":["You can turn this on later in <0>Settings → Sync</0>."],"ZNK2Tq":["root"],"ZQJ1IV":["Activate the last editor tab."],"ZQLDTl":["created folder"],"ZU8VV_":["Remove failed: ",["error"]],"ZWgr0b":["In a subfolder"],"ZWolSV":["You picked the filesystem root (/). Scaffolding here will scan every file on this machine — make sure that's what you want."],"ZWwYwM":["Base branch"],"ZWxfrc":["cleared folder properties"],"ZWyHmq":["This project"],"ZYtq3m":["Connect the AI tools you use to this specific project. These files live in the project folder, so anyone who opens it gets the same setup."],"Zf0w-R":["Take a piece of writing from a rough idea to a finished draft to something you're ready to share. Good for blog posts, essays, or anything you want to move through clear stages."],"ZgGuA4":[["0","plural",{"one":["File"],"other":["Files"]}]],"ZhhOwV":["Quote"],"ZjtgI-":["Command palette"],"Zon_qG":["Mirror source <0>",["label"],"</0>"],"ZptNUh":["Show ",["hidden"]," more"],"ZsGpr_":["Paste link"],"Zue_jx":["Your GitHub token is missing required scopes. Try signing in again."],"Zul8Ry":["never"],"ZvzbDF":["Add it directly to this project."],"ZxXhLY":["Hide Files (",["sidebarShortcut"],")"],"Zz25kq":["Show Files (",["sidebarShortcut"],")"],"_5qBNl":["AI tools & CLI"],"_6FVBz":["Jump to tab 1-8"],"_7UQ7y":["Whole word"],"_8quCH":["From template"],"_902BE":["This ",["targetNoun"]," was shared from branch <0>",["shareBranch"],"</0>. You're currently on <1>",["currentLabel"],"</1>."],"_BthEY":["Open in ",["shareBranch"]],"_NX6gG":["Managing project AI tools is unavailable in this build."],"_PACVa":["Release notes"],"_PBJRl":["Add at least one letter or number."],"_QwkMu":["No matching paths"],"_RcqUM":["You picked your home directory. OpenKnowledge will index everything in your home tree — large and may surface personal files."],"_TDESN":["Network error - ",["kind"]," \\"",["createdPath"],"\\" still exists on disk"],"_TF8ep":["Failed to render PDF"],"_VRtd7":["Couldn't send the selection — please try again."],"_W-elG":["(inline)"],"_WPP7e":["Read-only copy of a MirrorSource block from another doc. Edit at the source and it updates live."],"_XWY2J":["Terminal disabled"],"_ayOfA":["A knowledge base that follows Google's Open Knowledge Format, a shared way of organizing what you know. Pick this if you want your notes to work well with other tools that understand the format."],"_bth6g":["Claude Code is installed, but OpenKnowledge tools aren't connected to it yet."],"_eguJc":["Uploading"],"_gkGSK":["deleted template"],"_hPpdX":["Skill renamed"],"_pY_Vq":["The repository was moved, renamed, or deleted."],"_qD6mn":["Pick the folder where you've cloned it."],"_rP3HI":[["minutes"],"m ago"],"_tekeB":["updated folder properties"],"_tjopj":["Paste duplicate"],"a-cKXz":["Select all source"],"a3H_MR":["Open and focus the Ask AI composer for the current editor selection."],"a5Gha5":["Local changes blocked the merge"],"a5W0q0":["Are you sure you want to delete ",["folderName"],"/ and all files inside? This action cannot be undone."],"a9OzSn":["No pages found for \\"",["trimmedQuery"],"\\""],"aBgwis":["Scope"],"aByJ8j":["How does sharing work?"],"aE2_XM":["One pattern per line — appended to <0>.okignore</0>."],"aENGMB":["Semantic search adds meaning-based ranking to the search tool so conceptually-related pages surface even without shared keywords."],"aM23Wr":["page-name"],"aOp3hw":["Couldn't move to Trash"],"aWlJai":["Starting sign-in flow"],"a_u4ck":["Loading tags"],"aaE55D":["Clear ",["keyName"]],"aalx4E":["Editing broken MDX source: ",["reason"]],"abiHje":["Delete selected items"],"adsMWO":["Resolving deltas"],"aiArms":["We couldn't clone this repository."],"ajz9F8":["Couldn't load conflict content for ",["filePath"],". Try reloading the page."],"aoa6xA":["network error (is \`ok ui\` running?)"],"arUUsK":["Product updates"],"az8lvo":["Off"],"b3Thhd":["Upload failed"],"b4AQFK":["Open activity panel for ",["tooltipName"],", editing ",["realCurrentDoc"]],"b4VvP-":["Existing branch <0>",["trimmed"],"</0> will be checked out into its own window, under <1>.ok/worktrees/</1>."],"b4itZn":["Working"],"b5aNbi":["The ",["targetNoun"]," could not be opened — try navigating to it manually."],"bBE5tC":["Detected on this machine"],"bBcFK_":["Open emoji picker for ",["keyName"]],"bD8I7O":["Complete"],"bGa3Fk":["Uploading file"],"bH382I":["Edit this HTML — the preview updates live."],"bSD4im":["Search worktrees and branches"],"bS_boY":["Replace current match"],"bUUVED":["Asset"],"bV6DJA":["Who you are, so the agent has your context."],"bWLmRK":["Could not fetch branch. Check your connection."],"ba3vIW":[["templateCount","plural",{"one":["template"],"other":["templates"]}]],"bcDHUM":[["descriptorLabel"]," — render error, source editable below"],"bcjYUA":["Fold or unfold source"],"bkQRMh":["Paragraph"],"blFttG":["Search projects"],"bmC18N":["Clearing local collaboration data for \\"",["docName"],"\\" before reconnecting."],"brCtGB":["History unavailable"],"bultyE":["When enabled, the agent opens or refreshes the preview after each edit. Disable if you manage your own preview window (OK Desktop, a browser tab on another display, etc.)."],"bwil08":["Building <0>openknowledge.skill</0> and opening the Claude Desktop App"],"c1LZZH":["Link copied."],"c5f7sm":["Code block language: ",["currentLabel"],". Click to change."],"c5rF4v":["What is this knowledge base for?"],"c863eW":["Could not switch to ",["shareBranch"],". Try switching manually."],"c8iK2Y":["No templates found."],"c8jBgX":["Checking for updates on GitHub"],"cEoyWz":["Add item to ",["keyName"]],"cF9DyA":["Reconnecting after server restart"],"cIptmH":["In the Claude Desktop App"],"cKjLuT":["(project + user)"],"cOSAfL":["No repositories found on your GitHub account."],"cOrTMo":["Your share link is ready below."],"cRHuuI":["Couldn't copy path"],"cSCbv3":["BETA"],"cUK8lW":[["conflictCount","plural",{"one":["#"," conflict"],"other":["#"," conflicts"]}]],"cUk6TF":["Sync failed — check the server logs for details."],"cV7LOw":["Team Wiki"],"cZGNlb":["Add another pattern"],"cZI5AL":["OK Desktop"],"cZ_8zB":["Stays on this computer."],"cdm00A":["No Incoming"],"cdmk8A":["Uncommitted changes"],"chL5IG":["Community"],"cklVjM":["Timeline"],"cn1sLi":["Couldn't connect OpenKnowledge tools to Claude Code. Please try again."],"cnGeoo":["Delete"],"cqQyPB":["Folder name"],"crqzW5":["AI tools"],"cs4mps":["Config sharing"],"csDS2L":["Available"],"ct2kv5":["No headings in ",["pageTarget"]],"cuA8QW":["Organize specs"],"d1JjXo":["Your local copy of branch <0>",["branch"],"</0> is behind. Pull the latest changes, then open the link again."],"d2uTPx":["Server error (HTTP ",["status"],")"],"d5rK4X":[["chars","plural",{"one":["char"],"other":["chars"]}]],"dD7NPy":["Outline"],"dDpCOp":["Rename succeeded but the sidebar may be out of date — refresh to resync"],"dEgA5A":["Cancel"],"dGAdpH":["New branch <0>",["trimmed"],"</0> will be created from <1>",["currentBaseLabel"],"</1>, in its own worktree under <2>.ok/worktrees/</2>."],"dIYSqk":["remote"],"dJw2_7":["Saved with the project for your team."],"dMsx3p":["Home page and navigation hub."],"dN20LW":["Semantic search is on, but no API key is set — search falls back to keyword matching. Add one in <0>Settings → Account</0> (it's stored once for your whole machine)."],"dNM58w":["Claude Code (claude) isn't installed or on your PATH."],"dOHMA0":["Failed to move"],"dOxPd4":["Footnote"],"dPOFid":["Show or hide terminal"],"dTaauv":["Reason: ",["reason"]],"dUCQo4":["Renamed to \\"",["trimmed"],"\\""],"dUQ7_J":["Add meaning-based ranking to search so conceptually-related pages surface even when they share no keywords. This setting applies only to this computer."],"dURmlQ":["\\"frontmatter\\" is a reserved property name"],"dXWMFn":["Removes this skill from your editors."],"dbapvC":["Follow us on social media"],"dbhUX1":["Hide this file"],"dbtjJh":["(opens in new tab)"],"djc1l9":["More than ",["0"]," requests were blocked by the preview's security policy"],"djjdjr":[["deleteCount","plural",{"one":["Delete"],"other":["Delete ","#"," items"]}]],"dprWmL":["Anchor in this page"],"dr1vFs":["Replace all matches"],"dvGKu2":["Shared auto-sync default"],"dw_3cv":["Rename skill"],"dw_dUJ":["Failed to duplicate path"],"e0NrBM":["Project"],"e1Rn_k":["Open containing folder"],"e1hptq":["Embed a video with native player controls."],"e4GHWP":["Pull"],"e4PbgC":["Duplicate the file-tree item copied from the Files sidebar."],"e8L17t":["A non-empty folder already exists at this path. Pick a different folder."],"e8zRrb":["Show Files"],"eBIT9h":["Paste failed.",["restoreSuffix"]],"eFJkVt":["Clone failed: ",["cloneError"]],"eG8Jsg":["Toggle source tab focus mode"],"eGUbmF":["Copy selected file or folder"],"eJitUk":["Upload from computer"],"eKThTQ":["Failed to reorder"],"eNQGRb":["Inline LaTeX math rendered with KaTeX."],"ePK91l":["Edit"],"eQkgKV":["Installed"],"eQxm13":["Failed to update attachment location — ",["detail"]],"eSu2Xn":["Writes a project-MCP config for each selected tool; Claude also gets <0>.claude/launch.json</0>."],"eTL5y9":["Show selection preview"],"eTsJYJ":["description"],"eVPynQ":["Open <0><1>",["verificationUri"],"</1><2/></0> and enter this code:"],"el312q":["Install skills into"],"emgiet":["Authoritative content; mirrored verbatim everywhere it's referenced."],"eneWvv":["Draft"],"epuNYK":["Mark a block as the source of truth. Mirrors elsewhere update live as you edit it."],"euc6Ns":["Duplicate"],"evs0iw":["Tags matching \\"",["tagListQuery"],"\\""],"f1XQyZ":["Move block"],"f65AOQ":["Start from"],"f8jU-L":[["0"],"/",["1"]," — ",["2"]],"f9lQNJ":["Adds a managed block to"],"fBHvBn":["There's no project folder for this window, so a terminal can't start here."],"fBaTkM":["Toggle the bottom terminal panel."],"fG0X0e":["Install ",["brand"]," →"],"fIgqfQ":["Reinstalling"],"fJgQHX":["Failed to create file"],"fNr-MX":["Disable semantic search"],"fR-Kdc":["(project-level only)"],"fVcm9t":[["0","plural",{"one":["#"," doc"],"other":["#"," docs"]}]],"fWi7pn":["Initialize starter pack"],"fWsBTs":["Something went wrong. Please try again."],"fYKgzG":["Failed to load recent projects."],"fYjgXu":["Unordered list of items."],"f_PkYv":["Restarting closes this project's server. Connected agents (Claude Code, Codex, Cursor) will see their OpenKnowledge MCP connection close unexpectedly — you may need to restart the agent, or toggle its OpenKnowledge MCP server off and on, to reconnect."],"fbdLmk":["Toggle bold formatting."],"fbsiBw":["Something went wrong starting the terminal."],"fcgvCA":["Claude"],"fiMNLl":["Sync settings not yet loaded — try again in a moment"],"fj5YiP":["Downloads a fresh copy from GitHub."],"fnlBN4":["Auto-approve settings not yet loaded — try again in a moment"],"fo0VXg":["Uninstall"],"fqSfXY":["Replace"],"fuJZKk":["Search branches"],"fwhX-N":["Indent or outdent source"],"fxbCNQ":["Synced. The link is up to date."],"g3UF2V":["Accept"],"g4WlQK":["Project AI tool management is only available in the OpenKnowledge desktop app."],"g4XBm0":["Small section heading."],"g58Kwy":["<",["descriptorLabel"],"> failed to render (likely a bad prop). Copy the source to see what went wrong, or delete the block."],"gBbxn_":["Checking sign-in status"],"gGVP4q":["Click <0>+</0> <1/> <2>Create skill</2> <3/> <4>Upload skill</4>."],"gHSAWT":["Create worktree <0>“<1>",["typedName"],"</1>”</0>"],"gITz7o":["Move the cursor or extend selection through CodeMirror's standard source-editor navigation keymap."],"gJR87V":["Could not create the project folder. Pick a different folder."],"gKi-a_":["New project"],"gQV-9w":["Branch switched but the ",["targetNoun"]," could not be opened — try navigating to it manually."],"gUlRQj":["Orphans"],"gYuDfu":["Pick a starter pack to scaffold your project with ready-made folders and templates."],"gYz2ep":["Expires in ",["timeLabel"]],"gbHcbI":["Failed to delete property"],"gfdqcY":["Couldn't apply the change: ",["0"]],"gfohmY":["Connect tools"],"ggm6JX":["This page doesn't exist yet. Open it to create the page in the editor and collapse the graph."],"ggs9f8":["Search files, folders, or commands"],"gijbne":["Failed to rename path"],"gk_-qj":["Couldn't rename template: ",["0"]],"gljvbT":[["words","plural",{"one":["word"],"other":["words"]}]],"glzsS_":["Pan right"],"gmJ0An":["Failed to open folder."],"goO4Ll":["Editor status bar"],"gp3I7-":["Before syncing, set your identity for git commits:"],"gtEbeW":["Highlight"],"gvApb7":["Turn the things you read into clear, trusted articles. Save a source, figure out what it means, then keep the final version so you can rely on it later."],"gwykHF":["This doc hasn't synced to GitHub yet. The link will work after the next sync."],"h-AdvS":["The folders and templates are already here, so there's nothing to add."],"h06R3C":["No pages are missing outgoing graph links."],"h6EvY-":["This will replace the current document content with the version from <0>",["relative"]," (",["absoluteTime"],", ",["entrySha"],")</0> by <1>",["authorName"],"</1>. Your current content is already saved in the timeline — you can restore it anytime."],"h7FzJC":["Link-graph response did not match expected shape."],"h9QFb9":["Skill \\"",["0"],"\\" deleted"],"hBMK4W":["Project templates"],"hCOLSd":["Keep a written record of how your product gets built. A home for proposing ideas, recording decisions, writing specs, and capturing what you learned after something broke."],"hDEaQu":["Connect OpenKnowledge to other tools you use."],"hDKtoF":[["diffHrs"],"h ago"],"hDoLrm":["Remove ",["projectName"]," from recent projects"],"hGmuTc":["Docs tagged #",["tagDocsName"]],"hHMv6l":["Delete block"],"hIQkLb":["New chat"],"hItdtk":["Browse folder"],"hLy8b1":["Updated to Version ",["version"]],"hQXiDc":["Search branches..."],"hSBIG-":["A title, description, tags — anything that describes this folder."],"hSySVc":["Install handoff failed: ",["msg"]],"hXUWyd":["Value is required"],"hXbSxc":["Asset: ",["title"]],"hY8pka":["Select next occurrence"],"hYDc6B":["Name cannot be empty"],"hYgDIe":["Create"],"hZoBHK":["Empty starting content"],"haHgQj":["Copied relative path"],"habOU_":["Failed to update the auto-approve setting — ",["detail"]],"he3ygx":["Copy"],"hjO0Mq":["Add tab"],"hmYd9H":["Keep track of the people and companies you work with and the meetings you have with them. Good for remembering who someone is, how you know them, and what you last talked about."],"hnq8fP":["Remove ",["label"]," from context"],"hpDtUm":["External wiki link"],"hpzRlK":["Reopen closed tab"],"hwFOFD":["Settings failed to load"],"hxBHxQ":["A line with a footnote<0><1>[1]</1></0> and a definition shown below."],"hxEUVJ":["Initialize ",["selectedPackName"]],"hyCxJY":["Open that worktree instead"],"hynz2K":["Download started"],"i-ShMB":["Diagram"],"i1flq_":["Wiki link suggestions"],"i3f2kh":["No matching commands."],"i92eAT":["We'll create a repository and start syncing — no terminal needed."],"i9OyGp":["Undo or redo"],"i9TPUi":["This ",["targetNoun"]," isn't on branch <0>",["branch"],"</0>. It may not have been pushed yet."],"i9toLO":["Agent configuration file"],"iAoh55":["Update \\"",["0"],"\\"?"],"iDZtvM":["Failed to load templates: ",["message"]],"iEQQyu":["Agent"],"iEYxO4":["Show thumbnails"],"iGCs04":["No templates available"],"iH8pgl":["Back"],"iHAJDj":["Resolving default location"],"iKSP5j":["Word wrap"],"iKZkk1":["Property value"],"iMkWoF":["Turn on"],"iNFKkm":["No diff."],"iO8V-7":["Create worktree"],"iOHg1t":["Open embedded URL in new tab"],"iSLIjg":["Connect"],"iSQTsg":["Ordered list"],"iSnkwB":["Failed to open cloned project."],"iTlqm3":[["ahead","plural",{"one":["#"," commit ahead"],"other":["#"," commits ahead"]}]],"iTylMl":["Templates"],"iXTp5j":["Scope: "],"idD8Ev":["Saved"],"ig5vUe":["Failed to load file"],"iilQXA":["Folder duplicated"],"ijLc3m":["Bullet list"],"ilodsp":["Let agents use OpenKnowledge without asking"],"ipn17C":["The <0>type</0> every document created from this template gets (e.g. <1>research-note</1>). Keeps new docs Open Knowledge Format–conformant."],"iqIDv4":["Sync status unavailable"],"iqugog":["Initialize failed: ",["errorDetail"]],"irFGwu":["Template list"],"ircigK":["Blank project"],"irrm_E":["Remove selection"],"isRobC":["New"],"iuTKci":["No edits yet."],"iycx_A":["Pushing"],"j9Vqvc":["inherited"],"jAMpHn":["What is a starter pack?"],"jBVUXo":["Couldn't open the terminal — please try again."],"jEZ6Lf":["provisional"],"jEdF24":["Missing page: ",["linkTitle"],". Click to create."],"jKd3AP":["Could not enable the terminal: ",["0"]],"jPUPvG":["Couldn't resolve the conflict for ",["filePath"],"."],"jRHdCz":["Failed to load PDF"],"jSO1X5":["Inherited templates can't be renamed here — rename it in the folder that owns it."],"jSY41h":["\\"",["docName"],"\\" took too long. Check your connection."],"jTLWxh":["Embed an external page in an inline iframe (docs, demos, Figma, CodeSandbox)."],"jX0IPx":["A skill with this name already exists."],"jZ_E5M":["Fetch failed — check the server logs for details."],"j_Z6g7":["Shared default"],"jbSG8V":["Show Files (",["sidebarShortcutLabel"],")"],"jdGUeI":["Couldn't create template: ",["error"]],"jerqF0":["Loading branch state"],"jhtG3I":[" Your selection has been restored."],"jjtmV_":["First file name"],"jol95m":["Failed to open Project Navigator."],"jtg_8-":["Build a knowledge wiki about the different types of flightless birds. Start with an overview page, then add cross-linked pages for each major group (ratites like ostriches, emus, and kiwis; penguins; and flightless rails), the regions they live in, and a timeline of how flightlessness evolved."],"ju38ms":["This project has no git repository — sharing mode does not apply. Initialize a repo to enable the toggle."],"jwnpdM":["A template named <0>",["trimmedSlug"],"</0> already exists here. Saving creates a local copy that overrides it for this folder."],"k4CuuV":["Ready-made folders and templates to get you started quickly. Select a pack to preview what gets created, then add it to your project."],"kCNU4q":["Indexing your pages — ",["semanticIndexedCount"]," of ",["semanticTotalCount"]," ready. Results may be incomplete."],"kCqCyf":["Open CodeMirror's lint diagnostics panel."],"kFLlsI":["Insert a footnote reference + matching definition stub."],"kLv8d3":["Your copy of branch <0>",["shareBranch"],"</0> has changes that aren't on GitHub. The ",["targetNoun"]," will appear once the branch syncs."],"kNqMMd":["Folder"],"kUn-CN":["Sync off"],"kV2YZv":["Don't see <0>Skills</0>? Enable <1>Settings <2/> Capabilities <3/> Code execution and file creation</1> first."],"kYL1lH":["Agent activity"],"k_pade":["Config sharing is now shared. Commit the OK files to share with your team."],"k_yIIc":["Will be created at: <0>",["targetPreview"],"</0>"],"kdzzOK":["Off — search ranks by keyword only. No content leaves this computer."],"keNFEd":["Set identity"],"khCa4M":["Teaches coding agents in this project to read and write through OpenKnowledge."],"kj9pAE":["Creating page"],"kknhfj":["No changes"],"kmKqZg":["Clusters"],"knjOzA":["Tag value"],"kolRU1":["Do you want to permanently delete instead?"],"kpqWwG":["This ",["targetNoun"]," was removed from branch <0>",["branch"],"</0>."],"ku0yLQ":["Pages are embedded the first time a search needs them."],"ky9Tuc":["Edit ",["0"]," source"],"l17ab4":["Could not write project files. Try a different location."],"l1aQKz":["Visual editor table"],"l1l8sj":[["0"],"d ago"],"l3s5ri":["Import"],"l46MqT":["Next tab"],"l6OXqI":["No installed agents found"],"l6kpzR":["This ",["targetNoun"]," has been moved, renamed, or deleted in your local copy of branch <0>",["branch"],"</0>, and that change hasn't synced yet."],"l8G3S9":["Auto-sync is off — you don't have permission to push to this repo"],"lAiyU_":["Only the current document uses <0>#",["tag"],"</0>."],"lCC_D5":["Subscribing..."],"lGs_bQ":["Page <0>*</0>"],"lHwYMr":["Server error: ",["status"]," ",["statusText"]],"lI0Td2":["Use letters, digits, <0>_</0> and <1>-</1> only."],"lIn9L9":["Disable sync"],"lPzyrU":["All hunks resolved"],"lVWEIL":["Indexed ",["embedded"]," of ",["total"]," pages."],"lWNpNB":["Add cursors or select matching occurrences through CodeMirror."],"lXKZGw":["Heading 1"],"lZAiSP":["Backlinks response did not match expected shape."],"l_FAT6":["Use letters, digits, <0>-</0> or <1>_</1> only."],"l_UFPv":["Properties"],"lb_UU4":["Sync now"],"lbkOif":["Undo or redo visual-editor changes through TipTap collaboration history."],"lhjq3G":["Reset ",["labelText"]," to default"],"ljHjfg":["That branch is already open in another worktree."],"lkYioO":["Show or hide document panel"],"ll2yNl":["Content directory"],"lond3p":["Shows above the code body. Round-trips as \`title=\\"...\\"\` in markdown."],"lrhetp":["+ ",["overflow"]," more"],"ls1N1w":["(missing)"],"lyWa43":["Project-level disconnected pages"],"lzmtKp":["Failed to load folder properties: ",["message"]],"lzwo7p":["Could not open GitHub sign-in. Please try again."],"m16xKo":["Add"],"m2T1Xj":["Tag #",["tagValue"],", ",["uses"]],"m4v3XT":["Undo last edit on ",["docName"]],"m6YGpY":["Active panel content for the selected tab shows here."],"mBltnd":["Path suggestions"],"mGaZwZ":["See the full install guide"],"mHVPm5":["Reconnect required"],"mLAjyL":["Give the AI tools you use access to read and update your projects. Checking a box sets it up right away; unchecking removes it."],"mNY1G6":["Undo all edits"],"mPneVR":["Updated \\"",["display"],"\\" to ",["0"],"."],"mPy9lS":["Organize my existing specs into a linked index grouped by area, and flag any that have drifted out of sync with the current code."],"mU3j1b":["Remove item ",["0"]],"mVFyH-":[["accessibleLabel"]," (conflict)"],"mWVJRX":["Collapsible section with a clickable summary."],"mY8U64":["Teach agents a repeatable task. You can edit the body after creating."],"mYGY3B":["Date"],"mYzDD_":["A worktree folder for that branch already exists."],"mZ1r4i":["Create a document from ",["label"]],"maDWIB":["Mirror source <0>api-spec</0>"],"makN88":["No patterns yet. Type a folder or file name below to start hiding files."],"mdKFEy":["You cancelled loading \\"",["docName"],"\\"."],"mdzKSV":[["nodeCount","plural",{"one":["#"," node"],"other":["#"," nodes"]}]],"mf37rL":["Retrying"],"mg0YGL":["Source multi-cursor and multi-select"],"mk2poV":["e.g. server.ts"],"mmpzAq":["Wrap long lines in the markdown source editor."],"mo22UP":["Toggle inline code formatting."],"mqSwZH":["<0>Mirror anchor not found.</0> No <1>",["mirrorSourceTag"],"</1> exists in <2>",["src"],"</2>."],"msOK6I":["Repositories you've already cloned may keep syncing through git's own saved credentials, even after you disconnect."],"msqUNq":["Ready-made folders and templates to get you started quickly."],"mu1O0q":["Open Knowledge can manage ",["0"]," editor skill(s) for this project. Import moves them into .ok/skills and replaces the .claude, .codex, etc. copies with symlinks — one place to edit, in sync everywhere. If those folders are committed to git, review the change first; symlinks can behave differently on some editors and on Windows."],"mwMF9u":["Open CodeMirror search in source editor mode."],"mxY24F":["Duplicate the focused file-tree item when focus is in the Files sidebar."],"n2lRue":["Commit or stash changes to switch:"],"n5n_vi":["Private repository"],"n6hXUm":["Auto-sync periodically fetches, pulls, and pushes commits to your remote git repository so your edits stay in sync across machines."],"n7aopT":["Editor mode"],"n8DwqQ":["Connects automatically the next time you open this project in a trusted Codex session."],"nCzR-G":["Copy code ",["userCode"]],"nD7Fx9":["This replaces the current skill content with the bundled version ",["0"],". Any local edits will be replaced — your current version is saved to history first, so you can restore it."],"nDT8qt":["Initialized ",["0"]," but could not open it."],"nJq7et":["Couldn't uninstall skill: ",["0"]],"nMSYz5":["This path is on an external volume (/Volumes/...). OpenKnowledge will lose track of files when the drive ejects."],"nNYV3Y":["and ",["remaining"]," more"],"nP-KFo":["New ",["0"]," chat"],"nP76lk":["Applies to all projects on this machine. Claude and Codex, started from the built-in terminal, auto-approve OpenKnowledge's read and write tools (Claude also auto-runs \\"ok open\\"). Deleting, moving, sharing, installing skills, other commands, and non-OpenKnowledge file edits still ask. Cursor, OpenCode, and Pi are unaffected. Best-effort per agent."],"nTwL53":["Open a doc to share its URL."],"nUNZL4":["Ask ",["0"]],"nWv1ja":["Manage hidden files in Settings → Ignore patterns."],"nYKerc":["(user-level only)"],"nYeBmY":[["hours"],"h ago"],"nbfdhU":["Integrations"],"ndeI89":["Use Cmd/Ctrl+C to copy the link below, or open OK in the desktop app."],"ndwmea":["unavailable on this platform"],"neRy3o":["Split list item"],"nfoduq":["create worktree"],"nft48x":["Stored at <0>.ok/templates/</0> in this project. Available in every folder (folder-scoped templates can override by filename)."],"ng2Ibo":["Branch name"],"nh3wwx":["Embeddings provider key"],"njBeMm":["Both"],"njU86j":["Property \\"",["trimmed"],"\\" already exists"],"noH1JX":["Couldn't reach collab server — ",["errorDetail"],". Try <0>ok status</0> or check <1>.ok/local/last-spawn-error.log</1>."],"npcziF":["Install on"],"nqV0Kk":["This folder hasn't synced to GitHub yet. The link will work after the next sync."],"nrGWJ7":["Git identity isn't set — commits use a default author. Set yours so teammates see your name."],"nskygk":["Choose agent"],"nxlOpL":["OpenKnowledge is using this GitHub account."],"ny6vNn":["OpenKnowledge is using a GitHub account provided by the gh CLI. There's no separate OpenKnowledge credential to disconnect."],"nzHlj8":["Close ",["0"]],"nzaV6Q":["Page thumbnails"],"o2yoFu":["Reveal in Finder, No workspace"],"o49mDZ":["Loading timeline history"],"o4dcAf":["Reveal in File Explorer, ",["hint"]],"o5gfs1":["This setting is per-machine and isn't shared with collaborators. It needs an API key set with <0>ok embeddings set-key</0>."],"o9CrsQ":["research-note"],"oAFVKX":["Failed to update the project sync default — ",["detail"]],"oAGN8p":["Remote branch <0>",["remoteCheckoutRef"],"</0> will be checked out as a new local tracking branch <1>",["trimmed"],"</1>, in its own window under <2>.ok/worktrees/</2>."],"oBXkm2":["Delete code block"],"oCHfGC":["Level"],"oCZkaG":["Copy path"],"oJl7eO":["Unknown component: ",["componentName"]," — source editable below"],"oKBnk5":["More requests were blocked."],"oQA-cA":["Full path"],"oS1YpJ":["Open the Project Navigator."],"oXKEsy":["Delete an adjacent wiki-link or tag chip."],"oYepHb":["The terminal is turned off for this project. Turn it back on to run commands here."],"of3tF-":["You picked ~/Documents. OpenKnowledge will index every markdown file under it. If you only want to manage a sub-folder, choose a smaller scope."],"ogAuyr":["Back to document view"],"omXJcU":["Close others"],"optX0N":[["0"],"h ago"],"oqB2ez":["Previous match"],"osRqlv":["Open delete confirmation for the selected file-tree items."],"ot5BRK":["Duplicate selected file or folder"],"otE4aj":["Show external URL nodes"],"ou1hFW":["Toggle an ordered list."],"outYNy":["Duplicate name \\"",["keyName"],"\\""],"ovIGrT":["Local collaboration data for \\"",["docName"],"\\" could not be cleared. Reload to retry."],"p0Iq25":["Insert link"],"p9sdCy":["New ignore pattern"],"pAgkuZ":["Reopening \\"",["docName"],"\\" with a fresh local collaboration cache."],"pBROkv":["Thanks for subscribing. Watch your inbox for product updates."],"pEQFsW":["No matching projects."],"pFagOn":["Source editing"],"pHYP6v":["Open <0>Customize</0> in the sidebar <1/> <2>Skills</2>."],"pRc-Im":["Undone all edits on ",["docName"]],"pTPqMK":["Toggle a fenced code block."],"pWT04I":["Checking..."],"pWbsW6":["Loading docs"],"pZAs1T":["Failed to load outgoing links"],"pajIrl":["Could not turn off the terminal: ",["0"]],"pbwTg6":[["seconds"],"s ago"],"pckX1A":[["0","plural",{"one":["#"," use"],"other":["#"," uses"]}]],"pcqlQu":[["0","plural",{"one":["Folder"],"other":["Folders"]}]],"pgq_xf":[["0"],"/",["1"]," ",["2"]],"phM8Kh":["Found the repo but could not open the project. Please try again."],"pha01Y":["Project-level pages with no incoming graph edges."],"pkAft1":["Search failed."],"pmKdif":["Failed: ",["loadError"]],"pmUArF":["Workspace"],"ppDgFi":["Restart with this app's version"],"psfGPX":["MCP connections"],"pzutoc":["Italic"],"q2kXMG":["Inline Math"],"q4YJl_":["The terminal session ended (exit code ",["0"],")."],"q6-JVU":["Loading pages"],"q7F5am":["title"],"qAQVSD":["Page headings response was not JSON"],"qAhFeg":[["userName"]," · ",["tabCount","plural",{"one":["#"," tab"],"other":["#"," tabs"]}]],"qAx7xG":["Fixed folder in content root"],"qEIFZu":["Key ending in ",["keyHint"]],"qEue6Q":[" or "],"qFWMl-":["View as text"],"qNOgUu":["Edits at the source land here — no copy-paste drift."],"qRZh7J":["Let Tab leave the source editor instead of indenting."],"qSKu2v":["Source navigation and selection"],"qSxaOz":["Accept their deletion"],"qUB_o_":["Auto-sync is off — your edits stay local until you commit and push manually."],"qXg5W9":["File saves to <0>~/Downloads/openknowledge.skill</0>."],"qXsafh":["Publish to GitHub"],"qZv5ZR":["Config sharing toggle failed"],"q_9EcE":["Enable git auto-sync?"],"q_z77Z":["Heading levels"],"qaHyRJ":[["linkCount","plural",{"one":["#"," link"],"other":["#"," links"]}]],"qbfj1f":["Receiving objects"],"qdBUHP":["Couldn't load ",["fileName"]],"qi1F96":["Reveal in File Explorer"],"qiRoLb":["Summarize everything I changed this week"],"qioCwA":["Jump to page ",["pageNumber"]],"qjHMHf":["Failed to disable sync — ",["detail"]],"qo4zCg":["Path cannot contain backslashes"],"qpQwGC":["Describe what you're working on and the agent sets it up for you."],"qvWGzP":["Collapse all"],"qyLmWw":["Source editor search panel"],"r-OJYm":["Enter a valid branch name (no spaces, no leading dot, no \\"..\\")."],"r2huLx":["Undo, redo, or undo selection changes through CodeMirror history."],"r4R7AZ":["Network error during cleanup"],"r51jLC":["File saved & Claude Desktop App opened"],"r871ed":["Your knowledge base is now on GitHub at <0>",["ownerLogin"],"/",["repoName"],"</0>."],"rBc32v":["Couldn't reach the embeddings provider — press ↵ to retry"],"rFw02Q":["Uploading ",["keyName"]],"rJVoVX":["Source find results"],"rNifQd":["Remove property"],"rQAQus":["Couldn't save template: ",["error"]],"rQRrkB":["yesterday"],"rSoi6g":[["displayName"]," (",["bin"],") isn't installed or on your PATH."],"rVgSRB":["Collapse ",["docName"]],"rVxu1k":["No pages link here yet."],"rXz97P":["Numbered list of items."],"rZ9HZq":["To do"],"rZVMkf":["Visual editor replace input focused"],"rageVb":["Custom HTML with a live preview pane (sandboxed iframe)."],"rdU729":["Layout"],"rf6x3F":["Dock terminal to the bottom"],"rfFpcF":["Remove ",["chip"]],"rgPqOw":["Convert the current block to a paragraph."],"riqekz":["Suggestion menu navigation"],"rlUzXK":["Could not validate folder. Please try again."],"roAe2K":["Link URL"],"roiUQQ":["This page doesn't link to anything yet."],"rppgXF":["Disconnecting"],"rssK8c":["Ignore patterns (raw text)"],"rtdR4v":["Show or hide Files"],"rwrPbS":["Component boundary navigation"],"s-MGs7":["Resources"],"s-XOaI":["File name"],"s061i4":["Relative path"],"s0IDhW":["This file could not be found."],"s0J_k9":[["0","plural",{"one":["#"," key"],"other":["#"," keys"]}]],"s0_GnA":["Opening ",["openingLabel"],"…"],"s1c0ja":["Bullet List"],"s3caR3":["Deleting"],"sE7R19":["Could not load templates: ",["templatesError"],". You can still create a blank note."],"sER-bs":["Files"],"sFhaTJ":["Disambiguates similarly-named templates in the menu."],"sHrqDx":["Couldn't rename skill: ",["0"]],"sIGbBZ":["Convert selection to footnote"],"sIxSSP":["Resolve conflict in your terminal"],"sJK6pq":["Permission denied"],"sJWhgo":["Unknown component: ",["unregisteredComponentName"]],"sOxZaS":["Failed to load graph"],"sZ2IOu":["This ",["targetNoun"]," was shared from branch <0>",["shareBranch"],"</0>. It doesn't exist on your current branch (<1>",["currentLabel"],"</1>)."],"saIASg":["Second item"],"saYiIO":["Path cannot contain null bytes"],"seeS6l":["Setup OpenKnowledge in this folder?"],"shNd9t":["Slash command menu"],"skf5Ix":["Indent or outdent source editor lines."],"snrVQ7":["probe failed"],"ssuwjF":["Branch"],"stlgky":["On — your search queries and the text of matching pages are sent to your embeddings provider (OpenAI by default) to compute embeddings."],"sxTdZI":["Loading paths…"],"sxjyRq":["Worktrees"],"sxkWRg":["Advanced"],"t-JXbf":["Notion-style inline row for a downloadable file. Drag-drop also works."],"t18QYR":["Unpin ",["accessibleLabel"]],"t2TkQ3":["Sync paused — resolve conflicts to resume."],"t422_7":["Uninstall everywhere"],"t4sFKC":["New branch <0>",["trimmed"],"</0> will be created from the current commit, in its own worktree under <1>.ok/worktrees/</1>."],"t6w1cq":["Open a blank editor tab."],"tAPZEx":["Below"],"tHKQ6j":["Renaming"],"tP5DDk":["Apply link"],"tUvUfp":["Use a folder you already have."],"tW_yvQ":["Expand ",["docName"]],"t_YqKh":["Remove"],"teD0H9":["Couldn't open a worktree for that branch."],"tfDRzk":["Save"],"tfi40B":["Failed to create page"],"tgWuMB":["Modified"],"thnPBX":["Activate the next editor tab."],"ti6aF_":["Ask ",["0"]," CLI"],"tiWX6q":["Source editor"],"tjXez2":["blog-post"],"toyw51":["Mermaid diagram controls"],"tsiTqO":["Paste your API key"],"tsyExA":["Connect your AI tools to OpenKnowledge"],"u-9fWA":["See <0>Architecture</0> for the system overview."],"u3BOHd":[["fileCount","plural",{"one":["#"," file"],"other":["#"," files"]}]],"u3YnKw":["Could not construct share URL."],"u3wRF-":["Published"],"u6Hp4N":["Markdown"],"u7H-Wn":["Show panel (",["panelShortcutLabel"],")"],"u7U_Ij":["Link the selected text, or edit the link under the caret."],"uA_jXp":["Switch and update branch"],"uCaIdy":["GitHub sign-in is missing or expired. Reconnect to resume syncing."],"uDlyqd":["Document the architecture of this repo: create an overview page that links to a page per major module describing its responsibilities and entry points."],"uF9ruK":["Saving"],"uFOL2y":["No project skills yet. Author one to teach agents a repeatable task scoped to this knowledge base."],"uFQbYd":["Home page and entry point."],"uGaIIS":["Check out worktree"],"uH_S-u":[["loadErrorTitle"],": ",["message"]],"uKRYiW":["Sync status unavailable — server error."],"uL_Wx8":["The terminal stopped unexpectedly."],"uM6jnS":["Restore failed"],"uO9WLl":["Push"],"uQNW00":["Detached HEAD — checkout a branch to resume"],"uQewpR":["Couldn't restart the server — it's running under a different account. Restart your computer to clear it, then reopen this project."],"uWtdQR":["No templates yet. Add one in this folder's Templates section, or in Settings → Templates."],"uWx2ZP":["Last sync"],"u_lS4C":["Clone complete — opening project"],"uaUc6t":["Restart server"],"ubMwcO":["The terminal session ended (signal ",["0"],")."],"ugoTXs":["folder"],"uhJEA2":[["count","plural",{"one":["#"," more participant"],"other":["#"," more participants"]}]],"uksqrP":["Repository not found. It may have been renamed, deleted, or moved."],"un8kBM":["Creating page: ",["linkTitle"],"."],"ur2XSb":["Visual editor"],"uuoHOU":["Command failed."],"uynXup":[["tokens","plural",{"one":["token"],"other":["tokens"]}]],"v-h2hx":["Delete ",["targetGitPath"]],"v2ZW0K":["Enable terminal"],"v41fCm":["File not found"],"v75Em9":[["uploadedCount","plural",{"one":["Uploaded one file"],"other":["Uploaded ",["uploadedCount"]," files"]}]],"v77jrg":["Visual editor selection"],"v7hK0U":["Use lowercase letters, digits, and hyphens only."],"v7lbnC":["Find next match"],"vAYoCZ":["Couldn't open the worktree. Try again."],"vDXqVv":["Insert a markdown hard break."],"vEJDlt":["The file is in your Trash; the file-watcher will reconcile."],"vGeNNQ":["Copy a prompt and paste it into your agent to set up your project."],"vIxrEk":["Fit width"],"vLyv1R":["Hide"],"vQIVHc":["Folder properties"],"vWc9a0":["Type to edit; <0>⌘ Enter</0> saves, <1>Esc</1> cancels."],"vZVeFG":["Upload failed — please try again"],"vbK_ZG":["Files sidebar"],"ve8vEM":["Code expired — please try again"],"vfRlCI":["Could not copy full path"],"vfWA_g":["You picked ~/Desktop. OpenKnowledge will index everything on your desktop."],"vhAnzJ":["Turn on semantic search?"],"viwC-K":["Failed to remove project."],"vppAju":["Where newly added attachments are placed."],"vv7kpg":["Cancelled"],"vvWZnu":["Diff unavailable"],"w3tVpc":["No links yet. Add wiki links or markdown links to build a graph."],"w3vFfL":["Hide Files"],"w4hMYl":["Could not read branch state for this project. Close this dialog and open the share link again."],"w6sBjd":["Terminal settings not yet loaded — try again in a moment"],"w7SsvI":["That folder isn't an OpenKnowledge project yet. Initialize it and open?"],"w7nm4K":["Indented blockquote for citations."],"wDgmsr":["\\"",["0"],"\\" install refreshed (",["1"],")"],"wGSHzy":["Activate one of the first eight editor tabs."],"wJijgU":["Location"],"wJo9oS":["Close find"],"wQp1V3":["Mirror of <0>",["src"],"</0>"],"wT4iQr":["Open visual-editor find with replace controls expanded."],"wTcjov":["No workspace"],"wXO4Tg":[["hrs"],"h ago"],"w_Sphq":["Attachments"],"wbv9xO":["Create new project"],"wbwHYD":["Enable sync"],"wdxz7K":["Source"],"weP6me":["Couldn't load docs — type @ again to retry"],"wlwXUk":["You picked ~/Downloads. Files there are usually transient — consider a stable folder instead."],"wn8EJi":["Skills teach agents repeatable tasks. Author them here; install a skill to project it into your editors' skill folders."],"wndeIl":["Project-level pages with neither incoming nor outgoing graph edges."],"wtcxiD":["Share this setup with your team?"],"wvbc1r":["Couldn't open document"],"wzq9Rv":["A branch with that name already exists. Open its worktree from the switcher instead."],"x-5mJ1":["Install on all"],"x2fr_j":["Graph"],"x3-2ta":[["packName"]," initialized (",["projectEntries","plural",{"one":["#"," entry"],"other":["#"," entries"]}],")"],"x57cJf":["Open link"],"xCJdfg":["Clear"],"xCdTnb":["Close new tab"],"xDBki3":["Heading suggestions"],"xFQRu4":["I already have it locally"],"xG4tb6":["Lost connection to \\"",["docName"],"\\"."],"xHGM4U":["Hide HTML preview"],"xK291b":["Two-page (odd)"],"xNyj3h":["Reinstall for Claude Chat & Cowork"],"xOTzt5":["just now"],"xSVO3J":["What gets created"],"xWEvuo":["Ask AI"],"xXo8FT":["Save failed: ",["error"]],"xYMPyY":["Paste was incomplete — ",["chunksCompleted"]," of ",["totalChunks"]," chunks landed.",["restoreSuffix"]],"xaDWAI":["Switch project"],"xbdtfY":["Markdown source"],"xc4g25":["Parse failed"],"xeXS4P":["Or use a starter pack"],"xeiujy":["Text"],"xhlFsx":["Inherited — set a value here to replace it."],"xiv-dW":["No files yet."],"xloBjn":["Relative Path"],"xnP32l":["No description yet — add one so agents know when to use this skill."],"xrVr_k":["Couldn't create skill: ",["0"]],"xsZhu-":["Page number"],"xzktOa":["Edit wiki link"],"y1t8bQ":["Settings sections"],"y3aU20":["Save changes"],"y46m5r":["The desktop app isn't responding. Refresh and try again."],"y5FUYi":["Suggestion menu open"],"y8B54M":["Couldn't send your prompt — please try again."],"yCX4jp":[" Your selection could not be restored."],"yEJ-sl":["The preview blocks resources that don't meet its security rules (for example plain http:// URLs, or code that uses eval). The content above may render incompletely."],"yFyZMJ":["No pages matched \\"",["semanticQueryText"],"\\" by meaning."],"yH7T4q":[["failedCount","plural",{"one":["1 file failed to upload"],"other":[["failedCount"]," files failed to upload"]}]],"yHikCO":["Open CodeMirror's go-to-line prompt."],"yIPXut":["Preparing search"],"yKu_3Y":["Restore"],"yLEyuq":["Product updates in your inbox."],"yLq4w4":["Separator"],"yMgL_E":["Find field navigation"],"yQE2r9":["Loading"],"yQyglE":["No matching docs"],"yUxR-Q":["Expand ",["keyName"]],"yWSvcf":["Content root"],"yWWThY":["Asset reference"],"yYR6za":["Display text"],"yZmvQ4":["This project's server (v",["0"],") is newer than this app (v",["1"],")."],"y_5CE8":["Item ",["0"]],"yaPGPa":["Open a project to manage its AI tool connections."],"yf5r22":[["keyName"]," type: ",["typeLabel"]," (inherited from folder properties; not editable here)"],"yhdqox":["Installed — ok is available in external terminals. Unchecking removes it; OpenKnowledge's built-in terminal and AI tools keep working."],"yitgD9":["Failed to load skill targets: ",["0"]],"yjExfe":["Branch <0>",["shareBranch"],"</0> is checked out in:"],"ylXj1N":["Selected"],"ymWJLd":["Show ",["0"]," more"],"ynIa4S":["Visual editor list item"],"ypw6My":["Showing top ",["0"]," headings — keep typing to narrow"],"ysxgu8":["project"],"yutJKi":["Checklist with checkboxes."],"yvG-l1":["Open source lint panel"],"yvHDYG":["Claude Desktop"],"yz7wBu":["Close"],"yzF66j":["Link"],"yzGPkm":["Expand graph"],"z-lawV":["worktree"],"z0a2EA":["Diagram from Mermaid source — flowchart, sequence, class, state, ER, gantt, pie."],"z1uNN0":["No emoji found."],"z2JdQ-":["Config sharing unchanged — see details below."],"z2funE":["Full Path"],"z5pqI8":["Cannot upload: no document is open"],"z60Lgn":["Saves the file to <0>~/Downloads/openknowledge.skill</0> and opens the Claude Desktop App. Requires Node.js or Bun on your PATH."],"zAsDLY":["Graph visualization of document links"],"zKxoPm":["Couldn't rename \\"",["0"],"\\": ",["1"]],"zL0LPh":["Global outside text fields"],"zLGXna":["No starter packs available."],"zLak8b":["Activate new tab"],"zQBg2C":["Move the current block up or down one position."],"zUhPuR":["Open containing folder, ",["hint"]],"zXj1rA":["Search by meaning"],"zZ_I5K":["Open project menu"],"zaXlhf":["The properties block at the top of this doc has a formatting error. Switch to source mode to fix it."],"zbymaY":[["0"],"m ago"],"zd00pH":["Copy Path"],"zgSFyG":["External link"],"zkz0Fg":["Set up syncing"],"zlErBl":["Page headings error response did not match RFC 9457"],"zo3Dl7":["Toggle thumbnails"],"zrP8HX":["Frontmatter every document created from this template starts with. Values are YAML — a list is <0>[a, b]</0>; <1>{",["date"],"}</1> fills in on create."],"ztKII6":["Failed to add item"],"zwBp5t":["Private"],"zyKa-I":["Star us on GitHub"]}`)},H$=`en`;Gc.load(H$,V$.messages),Gc.activate(H$);var U$=Symbol.for(`ok.client.logForwarder`),W$=2e3,G$=[`log`,`info`,`warn`,`error`],K$={log:`info`,info:`info`,warn:`warn`,error:`error`};function q$(e){if(typeof e==`string`)return e;if(e instanceof Error)return`${e.name}: ${e.message}`;try{return JSON.stringify(e)??String(e)}catch{return String(e)}}function J$(e){let t=e.message.length+80;if(e.event&&(t+=e.event.length),e.fields)try{t+=JSON.stringify(e.fields).length}catch{}return t}function Y$(e={}){let t=e.windowObj??(typeof window<`u`?window:void 0);if(!t||t.okDesktop)return;let n=t;if(n[U$])return;n[U$]=!0;let r=e.consoleObj??console,i=e.documentObj===void 0?typeof document<`u`?document:null:e.documentObj,a=e.flushIntervalMs??W$,o=e.fetchImpl??n.fetch.bind(n),s=e.now??Date.now,c=[],l=0,u=null,d=!1,f={log:r.log.bind(r),info:r.info.bind(r),warn:r.warn.bind(r),error:r.error.bind(r)};function p(){if(u!==null&&(clearTimeout(u),u=null),c.length===0)return;let e=c.splice(0,100);l=0,d=!0;try{o(`/api/client-logs`,{method:`POST`,headers:{"content-type":`application/json`},keepalive:!0,body:JSON.stringify({entries:e})}).catch(()=>{})}catch{}finally{d=!1}}function m(e){if(c.push(e),l+=J$(e),c.length>100){let e=c.shift();e&&(l-=J$(e))}if(c.length>=100||l>=32768){p();return}u===null&&(u=setTimeout(p,a))}function h(e,t){if(!d)try{let n=hn(t.map(q$).join(` `)),r=t[0],i=typeof r==`string`&&r.length<=32768?r:void 0,a=i?Mr(i):null,o=a?.fields;if(o)try{JSON.stringify(o).length>8192&&(o=void 0)}catch{o=void 0}m({level:e,message:n,ts:s(),...a?.event?{event:a.event}:{},...o?{fields:o}:{}})}catch{}}for(let e of G$)r[e]=(...t)=>{f[e](...t),h(K$[e],t)};let g=e=>{if(d)return;let t=e;h(`error`,[`uncaught error: ${t.message} (${t.filename}:${t.lineno}:${t.colno})`])},_=e=>{d||h(`error`,[`unhandledrejection: ${q$(e.reason)}`])},v=()=>p(),y=()=>{i&&i.visibilityState===`hidden`&&p()};n.addEventListener(`error`,g),n.addEventListener(`unhandledrejection`,_),n.addEventListener(`pagehide`,v),i&&i.addEventListener(`visibilitychange`,y);function b(){for(let e of G$)r[e]=f[e];n.removeEventListener(`error`,g),n.removeEventListener(`unhandledrejection`,_),n.removeEventListener(`pagehide`,v),i&&i.removeEventListener(`visibilitychange`,y),u!==null&&(clearTimeout(u),u=null),c.length=0,delete n[U$]}return{flushNow:p,uninstall:b}}function X$(e,t){return e.branch===void 0||e.branch===null||e.branch===``||t===``||e.multiCandidate!==!0?null:{message:`Opened on branch ${e.branch}`,description:t}}function Z$(e){let t=e.bridge;if(!t)return;let n=e.setHash??(e=>{window.location.hash=e}),r=e.emitToast??((e,t)=>{hs(e,t)});return t.onDeepLink(e=>{let i=e.kind??`doc`,a={kind:i,path:e.doc,branch:e.branch??null};if(e.targetMissing===!0){rs.arm(a);return}$r.arm(a),n(xl(i,e.doc,i===`doc`?e.branch:void 0));let o=X$(e,t.config.projectPath);o!==null&&r(o.message,{description:o.description,duration:3e3})})}var Q$=4e3,$$=1440*60*1e3;function e1(e){let t=e.bridge;if(t&&t.onboarding)return t.onboarding.onToast(e=>{if(e.kind===`ancestor-promote`){hs.success(`Opened existing OpenKnowledge project at ${e.ancestorPath}`,{duration:Q$});return}if(e.kind===`startup-reclaim`){let t=[];if(e.mcp.status===`repaired`){let n=e.mcp.editors.map(e=>ur[e]??e).join(`, `);t.push(`repaired ${n} MCP integration`)}else e.mcp.status===`failed`&&t.push(`MCP auto-repair failed`);e.path.status===`installed`&&t.push(e.path.summary),e.path.status===`failed`&&t.push(`PATH install failed: ${e.path.summary}`);let n=t.length>0?t.join(`; `):`OpenKnowledge integrations checked.`,r=e.mcp.status===`failed`||e.path.status===`failed`,i=e.path.status!==`none`;hs[r?`error`:`success`](n,{duration:r||i?$$:Q$,position:`bottom-left`});return}if(e.kind===`sharing-refused-tracked`){hs.error(`Config sharing unchanged: ${e.tracked.length} OK file(s) tracked upstream — see message below.`,{duration:$$,description:e.remediation});return}if(e.kind===`sharing-no-git`){hs.warning(`Local-only requested but no git repository was created. Switch later via Settings → Config sharing once the project is in a git repo.`,{duration:Q$});return}let t=Vc(e.gitRoot,e.pickedPath)??e.pickedPath;hs.success(`Initialized OpenKnowledge at ${e.gitRoot} — opened parent of ${t} because it contains a .git folder`,{duration:Q$})})}function t1(e){let t=(0,$.c)(18),{body:n,warning:r,restartLabel:i,cancelLabel:a,onRestart:o,onDismiss:s}=e,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(os,{className:`mt-0.5 size-4 shrink-0 text-amber-500`}),t[0]=c):c=t[0];let l;t[1]===n?l=t[2]:(l=(0,Z.jsx)(`p`,{className:`font-medium text-sm`,children:n}),t[1]=n,t[2]=l);let u;t[3]===r?u=t[4]:(u=(0,Z.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:r}),t[3]=r,t[4]=u);let d;t[5]!==o||t[6]!==i?(d=(0,Z.jsx)(Jr,{size:`sm`,onClick:o,children:i}),t[5]=o,t[6]=i,t[7]=d):d=t[7];let f;t[8]!==a||t[9]!==s?(f=(0,Z.jsx)(Jr,{size:`sm`,variant:`ghost`,onClick:s,children:a}),t[8]=a,t[9]=s,t[10]=f):f=t[10];let p;t[11]!==d||t[12]!==f?(p=(0,Z.jsxs)(`div`,{className:`mt-1 flex flex-wrap gap-2`,children:[d,f]}),t[11]=d,t[12]=f,t[13]=p):p=t[13];let m;return t[14]!==l||t[15]!==u||t[16]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex w-full gap-3 rounded-lg border bg-popover p-4 text-popover-foreground shadow-lg`,children:[c,(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:[l,u,p]})]}),t[14]=l,t[15]=u,t[16]=p,t[17]=m):m=t[17],m}function n1(){return Gc._({id:`f_PkYv`})}function r1(e){return e.serverRuntime===e.appRuntime?Gc._({id:`FWQuPE`,values:{0:e.appRuntime}}):e.relation===`older`?Gc._({id:`LhQlGR`,values:{0:e.serverRuntime,1:e.appRuntime}}):Gc._({id:`yZmvQ4`,values:{0:e.serverRuntime,1:e.appRuntime}})}function i1(e){return Gc._({id:`2YOwme`,values:{appRuntime:e}})}function a1(e){return Gc._({id:`5DFPDh`,values:{appRuntime:e}})}function o1(e){return e===`eperm`?Gc._({id:`uQewpR`}):Gc._({id:`PqYWiC`})}async function s1(e){let t=hs.loading(Gc._({id:`Kf7GG5`}),{duration:1/0}),n;try{n=await e.restartServer(e.config.projectPath)}catch{return}hs.dismiss(t),n.ok===!1&&hs.error(o1(n.reason),{duration:1/0})}function c1(e){let t=e.bridge;if(!t)return;let n=t.onServerVersionDrift(e=>{hs.custom(n=>(0,Q.createElement)(t1,{body:r1(e),warning:n1(),restartLabel:Gc._({id:`ppDgFi`}),cancelLabel:Gc._({id:`PBxg_E`}),onRestart:()=>{hs.dismiss(n),s1(t)},onDismiss:()=>hs.dismiss(n)}),{duration:1/0})}),r=t.onServerRestarted(e=>{hs.success(i1(e.appRuntime))}),i=t.onServerReclaimed(e=>{hs.warning(a1(e.appRuntime),{duration:15e3})});return()=>{n(),r(),i()}}function l1(e){let{initialDoc:t}=e;if(!t)return;let n=e.getHash();n!==``&&n!==`#`&&n!==`#/`||e.setHash(El(t))}function u1(){typeof window>`u`||!window.okDesktop||l1({initialDoc:window.okDesktop.config.initialDoc,getHash:()=>window.location.hash,setHash:e=>{window.location.hash=e}})}sd(),n(()=>import(`./telemetry-startup-SAmXunjr.js`).then(e=>e.initStartupTrace()),__vite__mapDeps([116,0,1,2,3,4,38,7]),import.meta.url),I$({apiOrigin:typeof window<`u`?window.okDesktop?.config.apiOrigin:void 0}),Y$(),$T()&&aE(),WZ(),sT(),DF(),ON(),typeof window<`u`&&Z$({bridge:window.okDesktop}),typeof window<`u`&&c1({bridge:window.okDesktop}),typeof window<`u`&&id({bridge:window.okDesktop}),typeof window<`u`&&Bc({bridge:window.okDesktop}),typeof window<`u`&&e1({bridge:window.okDesktop}),typeof window<`u`&&od({bridge:window.okDesktop}),u1();var d1=new gd({defaultOptions:{queries:{retry:1,staleTime:1e4}}}),f1=document.getElementById(`root`);if(!f1)throw Error(`Root element not found`);var p1=typeof window>`u`?void 0:window.okDesktop;(0,Dd.createRoot)(f1).render((0,Z.jsx)(Q.StrictMode,{children:(0,Z.jsx)(At,{i18n:Gc,children:(0,Z.jsx)(qt,{client:d1,children:(0,Z.jsxs)(cn,{attribute:`class`,defaultTheme:`system`,enableSystem:!0,disableTransitionOnChange:!0,storageKey:`ok-theme-v1`,children:[(0,Z.jsx)(Ds,{children:N$(p1)}),(0,Z.jsx)(P$,{richColors:!0,closeButton:!0})]})})})}));