@inkeep/open-knowledge 0.59.0 → 0.59.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 (30) hide show
  1. package/dist/{acp-harness-probe-xzAQCzjU.mjs → acp-harness-probe-O0q8aU8X.mjs} +2 -2
  2. package/dist/cli.mjs +6 -6
  3. package/dist/constants-Cse_DIPH.mjs +2 -0
  4. package/dist/index.d.mts +2 -1
  5. package/dist/index.mjs +1 -1
  6. package/dist/{init-BN8pAiK3.mjs → init-BhkHgR4f.mjs} +3 -3
  7. package/dist/init-DSshm4fT.mjs +1 -0
  8. package/dist/{launch-json-removal-Bpcw3c_v.mjs → launch-json-removal-CSS5TqtX.mjs} +2 -2
  9. package/dist/{loader-CB_irZF8.mjs → loader-BmsoUf-Y.mjs} +2 -2
  10. package/dist/loader-DpunvK6C.mjs +1 -0
  11. package/dist/preview-3L4aNUPd.mjs +1 -0
  12. package/dist/{preview-D6pqyrS9.mjs → preview-CkPBDUKR.mjs} +2 -2
  13. package/dist/public/assets/FeedbackForm-BtLPXHiG.js +1 -0
  14. package/dist/public/assets/{SettingsDialogBody-B1Tc9Esn.js → SettingsDialogBody-CPUeqHjC.js} +5 -5
  15. package/dist/public/assets/{index-C_vI7csr.js → index-CMPB5OpS.js} +3 -3
  16. package/dist/public/index.html +1 -1
  17. package/dist/{repair-launch-json-CjC0taSR.mjs → repair-launch-json-BGtjnLYt.mjs} +2 -2
  18. package/dist/{repair-mcp-configs-D3atc1q5.mjs → repair-mcp-configs-GF6naqdn.mjs} +2 -2
  19. package/dist/src-CyPkYcKb.mjs +1 -0
  20. package/dist/{src-CSHSM5Bt.mjs → src-D3qtgHJv.mjs} +2 -2
  21. package/dist/start-CQF2U_r5.mjs +1 -0
  22. package/dist/{start-D8daPCuF.mjs → start-Dz_T3a-9.mjs} +2 -2
  23. package/package.json +4 -4
  24. package/dist/constants-CCCNmGNF.mjs +0 -2
  25. package/dist/init-BdBh-tlq.mjs +0 -1
  26. package/dist/loader-CKHTawsS.mjs +0 -1
  27. package/dist/preview-VZZ_gYOh.mjs +0 -1
  28. package/dist/public/assets/FeedbackForm-DqB5YXD8.js +0 -1
  29. package/dist/src-fJtWkvBq.mjs +0 -1
  30. package/dist/start-CLw0xGYU.mjs +0 -1
@@ -1,7 +1,7 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./telemetry-impl-T0tYRMlO.js","./chunk-CYidjpOJ.js","./preload-helper-Chd9yIcd.js","./trace-api-CUqficfR.js","./propagation-api-BofsoinJ.js","./context-api-BbWWFleV.js","./status-BO9JLhw4.js","./ReportBugDialogBody-DWbWOZyj.js","./dist-D-YCgpuS2.js","./lib-CGuuJXlL.js","./html-void-elements-Biw85x38.js","./lib-BoSom6iA.js","./markdownit-BZnioq-C.js","./w3c-keyname-DlL_314g.js","./dist-Nvb76hAm.js","./jsx-runtime-BUgB2tll.js","./react-f2sANaYj.js","./checkbox-Bi7zk4c5.js","./dist-DsLZcVyZ.js","./dist-mv8e6dBX.js","./react-dom-DPxgxlDT.js","./dist-Cm417ZCm.js","./dist-DJUH3LhV.js","./check-Bzwwm-o4.js","./createLucideIcon-CAkY8Blx.js","./minus-HJRULrSt.js","./compiler-runtime-BfE3aGVn.js","./utils-CPqDy6Hr.js","./bundle-mjs-SHeFpKGC.js","./button-CA0dewJJ.js","./circle-alert-CKGYtHdt.js","./spinner-DmibE6UV.js","./bug-report-send-manager-BSek0xNK.js","./BugReportHistory-S9E6kj8a.js","./collapsible-COrqeoHr.js","./chevron-down-xENV92Te.js","./folder-open-5aQb9yif.js","./trash-2-BVoWHmfV.js","./badge-Cl2jI51n.js","./platform-labels-DLZgi41O.js","./dist-BgXDUIPy.js","./triangle-alert-CJVfCxE0.js","./dialog-DD-GTVf9.js","./dist-tGYv04VD.js","./dist-BvwnbioL.js","./es2015-wpLRKwCl.js","./x-wQUDJS55.js","./textarea-BoMa_3jF.js","./BugReportHistoryDialog-DwoT3Jcu.js","./GraphPanel-BtrVMm8t.js","./toggle-group-BlEg4yJE.js","./dist-gTGB_-tT.js","./dist-BcWdMddd.js","./tooltip-DPvMEqsq.js","./dist-CSCWMTfQ.js","./floating-ui.dom-Dk5WJYh0.js","./useQuery-ZeEDLtxh.js","./min-Ql-sNLj-.js","./src-BJDBXEob.js","./colors-BIZ_qOvP.js","./ordinal-Bq2DRwIk.js","./init-DhAw_POV.js","./isObject-Cpi_qscz.js","./now-MQcmaMyW.js","./arrow-up-right-CXMA4cr5.js","./prop-types-BVaTR3_y.js","./navigation-targets-qlO1sI42.js","./file-tree-utils-nnyAUsjj.js","./doc-paths-DE9vBhOK.js","./known-skill-dirs-HlTud59O.js","./skill-scope-OQtLZpCt.js","./documents-events-CnBTU3j1.js","./documents-fetch-mA-Z25Lh.js","./parse-api-error-DcnXKbfT.js","./startup-marks-C5Xa1Jli.js","./target-navigation-intent-KEG2qMbq.js","./dist-PQ5KMVDh.js","./panel-DNPki55m.js","./external-link-Dzk3biRr.js","./overlay-layers-Bj-TVfKw.js","./ActivityModeContent-6TuvNchN.js","./DocumentContext-Ho6Oz_RK.js","./cm-theme-Cv1HvKYn.js","./dist-SEJoL7zW.js","./dist-B06p9eoe.js","./dist-CZp4Rvlf.js","./dist-CFiTpOJs.js","./dist-D_TqJyuw.js","./dist-BmEWZ9WX.js","./dist-Cj14vWds.js","./dist-eFrrX_Hg.js","./dist-CSBwCzP3.js","./stex-D2L90EPe.js","./config-provider-BJ0PFBhp.js","./dist-DTX2HxC82.js","./client-version-BDca_sFT.js","./use-apply-config-color-theme-D0wRK0ZW.js","./config-context-BH8hj2sg.js","./i18n-DM5acF0c.js","./messages-S_TS2Rak.js","./select-fWSYgcDA.js","./switch-BeP1gMN6.js","./CodeMirrorPropInput-o8957ZTB.js","./asset-dispatch-BxzFY-y9.js","./git-branch-BEl3Boky.js","./Mermaid-D6W1JO-s.js","./chevron-right-BVvjaUfh.js","./eye-DIJifYDY.js","./hash-26j3E552.js","./info-CqQMSCez.js","./paperclip-C-okgtwN.js","./local-menu-action-bus-aAi23OVU.js","./file-tree-rename-validation-CKWI2fGj.js","./input-DikXDeKw.js","./popover-C7NTz6uK.js","./dist-SCAXxKci.js","./skills-api-DRFuTY_1.js","./use-collab-url-CiDW3MCC.js","./DocumentContext-B0sQn39F.css","./undo-2-CXHp9Ngg.js","./agent-diff-store-DaX8UuW_.js","./cursor-2VSK5BUh.js","./copilot-DMpTxujg.js","./timeline-diff-store-ym5Oz1UF.js","./use-activity-panel-mMKkkTYa.js","./agent-presence-B4IC4MV9.js","./lru-string-cache-RKsSPPlq.js","./ImportSkillDialog-B_0sfIcE.js","./label-Bbz2bT-a.js","./radio-group-BsZGGl8l.js","./use-open-skill-B79LJXQC.js","./use-popular-skills-BA6oApoS.js","./SkillCostValue-Bs-xte7N.js","./skeleton-BZIHOzZH.js","./open-managed-artifact-tab-VyuGTCnG.js","./input-group-DroArAL7.js","./tabs-BuseO5Xi.js","./dist-pKYOq3XC2.js","./SettingsDialogBody-B1Tc9Esn.js","./sortable.esm-DK-jMveF.js","./alert-dialog-ZBAB0rfs.js","./terminal-cli-display-CCSh-Jc6.js","./dropdown-menu-DRIarAms.js","./dist-Be8lWZxP2.js","./separator-BmK42_9U.js","./EnableSyncConfirmDialog-Dm2W_Er1.js","./RegisteredAgentIcon-D_jDwJpu.js","./lint-plugin-meta-C15NfeTq.js","./auth-state-cache-CageXkmw.js","./download-Bdmlj4Jo.js","./SkillInstallMenu-C2zTs1fO.js","./mascot-outline-CtS592mc.js","./folder-config-api-EXd1lZ_b.js","./refresh-cw-D41gUk_B.js","./field-C1cHfxiy.js","./use-workspace-DVCCGDFQ.js","./sun-D7hLUh5f.js","./square-pen-BlKNuUz7.js","./terminal-CmHqE3At.js","./form-L2L52iP2.js","./ConfigSharingInfoTooltip-CoNRTCRq.js","./terminal-command-events-z-N381nZ.js","./markdownlint-rule-browser-BbEsW_tn.js","./tag-pill-input-DumpKpru.js","./lint-config-client-DIrSdYtN.js","./use-terminal-enabled-CsGI4-0e.js","./terminal-telemetry-eQnofItG.js","./use-settings-route-B3k5Qle8.js","./schema-fields-view-intent-BnNbMz7K.js","./tool-list-format-ClHRkCD9.js","./ManagedArtifactProperties-CN0VAhWo.js","./ManagedArtifactProperties-D7qkm6V7.js","./PropertyDisplayRow-yHZx0-1B.js","./format-CyaLi0or.js","./braces-okUwnkYm.js","./comment-chips-CYb8vcSY.js","./selection-context-CF-A4hVF.js","./MermaidDocEditor-D9yLvQft.js","./dist-DwHSSQIa2.js","./dist-ChGC604M.js","./src-CYEDD64p.js","./ExcalidrawDocEditor-CHSxzurU.js","./chunk-K2UTITRG-ftmlUynM.js","./chunk-SRAX5OIU-B5oxcigO.js","./chunk-ZUYEQ4TG-DLAN927O.js","./chunk-6U3AYISY-BB_UpEhs.js","./chunk-Z3N5DIM6-C_zLdJk1.js","./ExcalidrawDocEditor-D_O2bRP1.css","./TextDocEditor-DDUuGlvR.js","./text-viewer-languages-DvQwv9NL.js","./SourceEditor-D9yflzSG.js","./typing-burst-detector-DP5cTWmB.js","./wrench-JX3g_hHJ.js","./SkillToolbarControls-PSAJSV0Q.js","./skill-actions-CJiMCR8W.js","./DiffView-DrIxcON3.js","./list-plus-1_iMFVqs.js","./workspace-paths-CD0W1etA.js","./SkillOriginInline-BJlf8YEB.js","./use-skill-origin-CDBZUwtC.js","./SlidesToolbarControls-C4JBBO9d.js","./SkillEditBanner-B-XDCF2M.js","./SkillModeBanner-BRFTW7Zd.js","./LintConfigEditor-BDD9SVg9.js","./EditorModeToggle-BhI-tjjV.js","./useLintConfigViewMode-BHa7i7v4.js","./SchemaConfigEditor-Bi7Ac_wP.js","./case-sensitive-B9mhUnHr.js","./TimelineDiffPane-BYuBovfq.js","./use-timeline-entry-diff-BnOxPTYG.js","./libesm-CmFxXX9W.js","./panel-right-open-BXE3r3dB.js","./AgentDiffPane-BJYlf10_.js","./AppMenubar-DyQIJHsv.js","./app-menubar-gate-Dyq1r1xM.js","./AgentThreadClientBinder-Gj3tQef3.js","./thread-client-BprEkf79.js","./SessionsHost-ig-ZUS_G.js","./history-BteF85_l.js","./terminal-launch-events-DTObZvXP.js","./thread-draft-staging-X5TsXt3q.js","./McpConsentDialogBody-BSiShHJk.js","./ok-Bg0dAnDm.js","./ShareBranchSwitchDialog-Bsa1pw1-.js","./miss-dialog-store-CdkrAlK3.js","./share-metadata-rows-DPgPU-ev.js","./auth-prompt-store-vAFATIFt.js","./desktop-bridge-types-rBjHIYSI.js","./receive-store-C6fRYFtF.js","./ShareReceiveMissDialog-CCUROvjR.js","./pending-receive-nav-store-_W8qjGOQ.js","./ConsentDialogBody-BfCsFhH5.js","./project-paths-BLMG_Bwq.js","./ShareReceiveDialog-FD8hxYdI.js","./TerminalWindowApp-fOsj00la.js","./use-live-xterm-theme-91IeCxiL.js","./use-installed-clis-t29XGX_x.js","./telemetry-startup-cht6PIz2.js"])))=>i.map(i=>d[i]);
2
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./globals-B-XcoN9E.js";import{t as n}from"./preload-helper-Chd9yIcd.js";import{t as r}from"./jsx-runtime-BUgB2tll.js";import{$ as i,$n as a,$t as o,A as s,An as c,Ar as l,B as u,Bn as d,Br as f,Bt as p,C as m,Cn as h,Cr as g,Ct as _,Dn as v,Dr as y,E as b,En as x,Er as S,Et as C,F as w,Fr as T,Ft as E,Gn as D,Gr as O,Gt as k,H as A,Hn as j,Hr as M,Ht as N,I as P,Ir as F,It as I,J as L,Jn as R,Jt as z,K as B,Kn as V,Kt as H,L as U,Ln as ee,Lr as W,Lt as te,Mn as G,Mr as K,Mt as q,N as ne,Nn as re,Nr as J,Nt as ie,O as ae,On as oe,Or as se,P as ce,Pr as le,Pt as ue,Q as de,Qn as fe,R as pe,Rn as me,Rr as he,Rt as ge,S as _e,Sn as ve,Sr as ye,St as be,T as xe,Tn as Se,Tr as Ce,Tt as we,Un as Te,Ur as Ee,Ut as De,Vn as Oe,Vr as ke,Vt as Ae,Wn as je,Wr as Me,Wt as Ne,X as Pe,Xn as Fe,Xt as Ie,Y as Le,Yn as Re,Yt as ze,Z as Be,Zt as Ve,_ as He,_n as Ue,_r as We,_t as Ge,a as Ke,an as qe,ar as Je,b as Ye,bn as Xe,br as Ze,bt as Qe,c as $e,cn as et,cr as tt,ct as nt,d as rt,dn as it,dt as at,en as ot,er as st,et as ct,f as lt,fn as ut,fr as dt,ft,g as pt,gn as mt,gr as ht,gt,h as _t,hn as vt,hr as yt,ht as bt,i as xt,in as St,ir as Ct,it as wt,j as Tt,jn as Et,jr as Dt,jt as Ot,k as kt,kr as At,l as jt,ln as Mt,lr as Nt,lt as Pt,m as Ft,mr as It,n as Lt,nr as Rt,o as zt,ot as Bt,p as Vt,pn as Ht,pr as Ut,q as Wt,qn as Gt,qt as Kt,r as qt,rn as Jt,rr as Yt,s as Xt,sr as Zt,t as Qt,tt as $t,u as en,ur as tn,ut as nn,v as rn,vn as an,wn as on,wr as sn,wt as cn,x as ln,xn as un,xr as dn,xt as fn,y as pn,yn as mn,yr as hn,yt as gn,zn as _n,zr as vn,zt as yn}from"./DocumentContext-Ho6Oz_RK.js";import{t as bn}from"./react-f2sANaYj.js";import{n as Y,r as xn,t as Sn}from"./dist-Nvb76hAm.js";import{_ as Cn,a as wn,c as Tn,d as En,f as Dn,g as On,h as kn,i as An,l as jn,m as Mn,n as Nn,o as Pn,p as Fn,r as In,s as Ln,t as Rn,u as zn,v as Bn,y as Vn}from"./useQuery-ZeEDLtxh.js";import{n as Hn,t as Un}from"./dist-PQ5KMVDh.js";import{t as Wn}from"./react-dom-DPxgxlDT.js";import{t as Gn}from"./compiler-runtime-BfE3aGVn.js";import{i as Kn,n as qn,o as Jn,r as Yn,s as Xn,t as Zn}from"./local-menu-action-bus-aAi23OVU.js";import{t as Qn}from"./utils-CPqDy6Hr.js";import{C as $n,S as er,_ as tr,b as nr,f as rr,h as ir,i as ar,n as or,r as sr,t as cr,v as lr,w as ur,x as dr,y as fr}from"./SkillInstallMenu-C2zTs1fO.js";import{t as pr}from"./overlay-layers-Bj-TVfKw.js";import{n as mr,r as hr,t as X}from"./button-CA0dewJJ.js";import{t as gr}from"./dist-mv8e6dBX.js";import{i as _r,n as vr,r as yr,t as br}from"./tooltip-DPvMEqsq.js";import{n as xr,r as Sr,t as Cr}from"./collapsible-COrqeoHr.js";import{a as wr,c as Tr,i as Er,l as Dr,o as Or,r as kr,s as Ar,t as jr}from"./alert-dialog-ZBAB0rfs.js";import{$ as Mr,F as Nr,M as Pr,P as Fr,Q as Ir,S as Lr,T as Rr,U as zr,X as Br,_ as Vr,at as Hr,ct as Ur,et as Wr,j as Gr,k as Kr,m as qr,q as Jr,rt as Yr,st as Xr,tt as Zr,x as Qr}from"./CodeMirrorPropInput-o8957ZTB.js";import{t as $r}from"./checkbox-Bi7zk4c5.js";import{a as ei,d as ti,i as ni,l as ri,n as ii,o as ai,r as oi,s as si,t as ci,u as li}from"./floating-ui.dom-Dk5WJYh0.js";import{A as ui,C as di,M as fi,N as pi,O as mi,T as hi,_ as gi,a as _i,c as vi,d as yi,f as bi,g as xi,h as Si,i as Ci,j as wi,l as Ti,m as Ei,n as Di,o as Oi,p as ki,r as Ai,s as ji}from"./terminal-cli-display-CCSh-Jc6.js";import{a as Mi,c as Ni,d as Pi,f as Fi,i as Ii,l as Li,m as Ri,n as zi,o as Bi,p as Vi,r as Hi,s as Ui,t as Wi,u as Gi}from"./dropdown-menu-DRIarAms.js";import{t as Ki}from"./label-Bbz2bT-a.js";import{c as qi,l as Ji}from"./select-fWSYgcDA.js";import{S as Yi,_ as Xi,b as Zi,f as Qi,g as $i,h as ea,m as ta,o as na,p as ra,t as ia,v as aa,y as oa}from"./progress-CW78SPzw.js";import{n as sa,t as ca}from"./radio-group-BsZGGl8l.js";import{n as la,t as ua}from"./separator-BmK42_9U.js";import{n as da,r as fa,t as pa}from"./toggle-group-BlEg4yJE.js";import{i as ma,n as ha,o as ga,r as _a}from"./terminal-telemetry-eQnofItG.js";import{$r as va,Aa as ya,B as ba,Ba as xa,Br as Sa,Bs as Ca,Bt as wa,C as Ta,Ca as Ea,Ci as Da,Co as Oa,Cs as ka,Dr as Aa,Ds as ja,E as Ma,Eo as Na,F as Pa,Fa,Fi as Ia,Fn as La,Fo as Ra,Gr as za,Hi as Ba,Ho as Va,Hr as Ha,Hs as Ua,Ia as Wa,Io as Ga,Ir as Ka,Jr as qa,Js as Ja,Ks as Ya,Lo as Xa,Ls as Za,M as Qa,Mi as $a,Mn as eo,Mt as to,Nn as no,No as ro,O as io,Oa as ao,Oo as oo,Ot as so,P as co,Pa as lo,Pi as uo,R as fo,Ra as po,Ro as mo,Sr as ho,St as go,Ti as _o,To as vo,Tr as yo,Ua as bo,Un as xo,Us as So,Vn as Co,Vo as wo,Vs as To,Wi as Eo,Wn as Do,Ws as Oo,Xs as ko,Xt as Ao,Yn as jo,Ys as Mo,Zi as No,_ as Po,_i as Fo,bi as Io,bo as Lo,br as Ro,bs as zo,ca as Bo,ci as Vo,co as Ho,cr as Uo,dt as Wo,eo as Go,fr as Ko,gn as qo,hr as Jo,ht as Yo,in as Xo,ir as Zo,it as Qo,j as $o,jo as es,jt as ts,ks as ns,la as rs,ln as is,lr as as,mi as os,n as ss,na as cs,ni as ls,nr as us,nt as ds,oa as fs,oo as ps,pi as ms,qi as hs,qs as gs,ra as _s,rr as vs,rt as ys,s as bs,so as xs,sr as Ss,t as Cs,tn as ws,to as Ts,tr as Es,ui as Ds,v as Os,vo as ks,vr as As,vs as js,w as Ms,wa as Ns,wi as Ps,xi as Fs,xo as Is,xs as Ls,yo as Rs,yr as zs,za as Bs,zi as Vs,zo as Hs}from"./dist-D-YCgpuS2.js";import{n as Us,t as Ws}from"./dist-DTX2HxC82.js";import{_ as Gs,b as Ks,c as qs,f as Js,h as Ys,i as Xs,m as Zs,n as Qs,p as $s,r as ec,s as tc,t as nc,v as rc}from"./use-settings-route-B3k5Qle8.js";import{t as ic}from"./dist-BgXDUIPy.js";import{_ as ac,a as oc,d as sc,g as cc,h as lc,o as uc,s as dc,v as fc,y as pc}from"./documents-events-CnBTU3j1.js";import{A as mc,C as hc,D as gc,E as _c,F as vc,I as yc,N as bc,P as xc,R as Sc,S as Cc,a as wc,b as Tc,c as Ec,d as Dc,f as Oc,g as kc,h as Ac,k as jc,l as Mc,m as Nc,n as Pc,o as Fc,p as Ic,r as Lc,t as Rc,u as zc,v as Bc,w as Vc,x as Hc}from"./terminal-launch-events-DTObZvXP.js";import{n as Uc,t as Wc}from"./history-BteF85_l.js";import{n as Gc,r as Kc}from"./config-context-BH8hj2sg.js";import{t as qc}from"./parse-api-error-DcnXKbfT.js";import{C as Jc,E as Yc,S as Xc,T as Zc,_ as Qc,b as $c,c as el,d as tl,f as nl,g as rl,h as il,i as al,l as ol,m as sl,n as cl,o as ll,p as ul,r as dl,s as fl,t as pl,u as ml,v as hl,w as gl,x as _l,y as vl}from"./skill-actions-CJiMCR8W.js";import{n as yl,t as bl}from"./workspace-paths-CD0W1etA.js";import{t as xl}from"./use-workspace-DVCCGDFQ.js";import{t as Sl}from"./createLucideIcon-CAkY8Blx.js";import{t as Cl}from"./git-branch-BEl3Boky.js";import{c as wl,g as Tl,l as El,m as Dl,p as Ol,u as kl}from"./EnableSyncConfirmDialog-Dm2W_Er1.js";import{c as Al,l as jl,o as Ml,s as Nl,t as Pl}from"./Mermaid-D6W1JO-s.js";import{t as Fl}from"./arrow-up-right-CXMA4cr5.js";import{r as Il,t as Ll}from"./RegisteredAgentIcon-D_jDwJpu.js";import{_ as Rl,a as zl,f as Bl,g as Vl,i as Hl,l as Ul,m as Wl,n as Gl,t as Kl,v as ql}from"./PropertyDisplayRow-yHZx0-1B.js";import{t as Jl}from"./case-sensitive-B9mhUnHr.js";import{t as Yl}from"./check-Bzwwm-o4.js";import{t as Xl}from"./chevron-left-B1wYSm9K.js";import{t as Zl}from"./chevron-down-xENV92Te.js";import{t as Ql}from"./chevron-right-BVvjaUfh.js";import{A as $l,B as eu,C as tu,D as nu,E as ru,F as iu,H as au,I as ou,N as su,P as cu,R as lu,T as uu,V as du,_ as fu,a as pu,b as mu,c as hu,f as gu,g as _u,h as vu,j as yu,k as bu,l as xu,m as Su,n as Cu,o as wu,p as Tu,r as Eu,s as Du,t as Ou,u as ku,v as Au,x as ju,z as Mu}from"./typing-burst-detector-DP5cTWmB.js";import{n as Nu,t as Pu}from"./lint-plugin-meta-C15NfeTq.js";import{t as Fu}from"./circle-alert-CKGYtHdt.js";import{a as Iu,i as Lu,n as Ru,o as zu,r as Bu,s as Vu}from"./prop-types-BVaTR3_y.js";import{$ as Hu,A as Uu,C as Wu,D as Gu,F as Ku,G as qu,H as Ju,I as Yu,J as Xu,K as Zu,L as Qu,M as $u,Q as ed,R as td,S as nd,U as rd,V as id,W as ad,X as od,Y as sd,Z as cd,a as ld,b as ud,c as dd,f as fd,h as pd,j as md,n as hd,q as gd,r as _d,t as vd,u as yd,x as bd,y as xd,z as Sd}from"./auth-state-cache-CageXkmw.js";import{t as Cd}from"./download-Bdmlj4Jo.js";import{t as wd}from"./eye-DIJifYDY.js";import{a as Td,c as Ed,i as Dd,n as Od,o as kd,r as Ad,s as jd,t as Md}from"./pending-receive-nav-store-_W8qjGOQ.js";import{_ as Nd,a as Pd,c as Fd,d as Id,f as Ld,g as Rd,h as zd,i as Bd,l as Vd,m as Hd,o as Ud,p as Wd,s as Gd,u as Kd,v as qd}from"./ManagedArtifactProperties-D7qkm6V7.js";import{t as Jd}from"./folder-open-5aQb9yif.js";import{a as Yd,i as Xd,n as Zd,o as Qd,r as $d,t as ef}from"./use-open-skill-B79LJXQC.js";import{i as tf,n as nf}from"./folder-config-api-EXd1lZ_b.js";import{t as rf}from"./hash-26j3E552.js";import{n as af,t as of}from"./target-navigation-intent-KEG2qMbq.js";import{t as sf}from"./info-CqQMSCez.js";import{t as cf}from"./spinner-DmibE6UV.js";import{a as lf,n as uf,t as df}from"./bug-report-send-manager-BSek0xNK.js";import{n as ff,t as pf}from"./miss-dialog-store-CdkrAlK3.js";import{_ as mf,a as hf,b as gf,c as _f,d as vf,f as yf,g as bf,i as xf,l as Sf,m as Cf,n as wf,o as Tf,p as Ef,r as Df,s as Of,t as kf,u as Af,v as jf,y as Mf}from"./comment-chips-CYb8vcSY.js";import{i as Nf,n as Pf,r as Ff,t as If}from"./use-popular-skills-BA6oApoS.js";import{n as Lf,t as Rf}from"./panel-right-open-BXE3r3dB.js";import{t as zf}from"./paperclip-C-okgtwN.js";import{t as Bf}from"./refresh-cw-D41gUk_B.js";import{t as Vf}from"./square-pen-BlKNuUz7.js";import{t as Hf}from"./trash-2-BVoWHmfV.js";import{t as Uf}from"./triangle-alert-CJVfCxE0.js";import{t as Wf}from"./undo-2-CXHp9Ngg.js";import{t as Gf}from"./x-wQUDJS55.js";import{C as Kf,S as qf,T as Jf,_ as Yf,a as Xf,b as Zf,c as Qf,d as $f,f as ep,g as tp,h as np,i as rp,m as ip,p as ap,s as op,u as sp,v as cp,w as lp,x as up,y as dp}from"./doc-paths-DE9vBhOK.js";import{a as fp,c as pp,d as mp,f as hp,i as gp,l as _p,o as vp,s as yp,t as bp,u as xp}from"./skill-scope-OQtLZpCt.js";import{a as Sp,n as Cp,o as wp,r as Tp,s as Ep,t as Dp}from"./field-C1cHfxiy.js";import{t as Op}from"./input-DikXDeKw.js";import{a as kp,i as Ap,n as jp,r as Mp}from"./project-paths-BLMG_Bwq.js";import{a as Np,c as Pp,i as Fp,n as Ip,o as Lp,r as Rp,s as zp,t as Bp}from"./dialog-DD-GTVf9.js";import{t as Vp}from"./tool-list-format-ClHRkCD9.js";import"./i18n-DM5acF0c.js";import{n as Hp,r as Up,t as Wp}from"./file-tree-rename-validation-CKWI2fGj.js";import{a as Gp,c as Kp,d as qp,i as Jp,l as Yp,n as Xp,o as Zp,s as Qp,u as $p}from"./file-tree-utils-nnyAUsjj.js";import{E as em,J as tm,K as nm,M as rm,_ as im,a as am,c as om,f as sm,g as cm,h as lm,j as um,l as dm,n as fm,o as pm,p as mm,q as hm,r as gm,s as _m,v as vm,x as ym}from"./navigation-targets-qlO1sI42.js";import{t as bm}from"./documents-fetch-mA-Z25Lh.js";import{a as xm,i as Sm,o as Cm}from"./startup-marks-C5Xa1Jli.js";import{t as wm}from"./badge-Cl2jI51n.js";import{i as Tm,n as Em,r as Dm,t as Om}from"./popover-C7NTz6uK.js";import{F as km,O as Am,d as jm,f as Mm,g as Nm,h as Pm,i as Fm,j as Im,l as Lm,o as Rm,u as zm,v as Bm,x as Vm}from"./skills-api-DRFuTY_1.js";import{c as Hm,f as Um,i as Wm,n as Gm,o as Km,r as qm,t as Jm}from"./config-provider-BJ0PFBhp.js";import{i as Ym,r as Xm,t as Zm}from"./use-collab-url-CiDW3MCC.js";import{n as Qm,t as $m}from"./client-version-BDca_sFT.js";import{n as eh,t as th}from"./external-link-Dzk3biRr.js";import{t as nh}from"./asset-dispatch-BxzFY-y9.js";import{i as rh,n as ih,r as ah,t as oh}from"./auth-prompt-store-vAFATIFt.js";import{c as sh,i as ch,l as lh,n as uh,r as dh,s as fh,t as ph}from"./selection-context-CF-A4hVF.js";import{t as mh}from"./use-installed-clis-t29XGX_x.js";import{a as hh,c as gh,i as _h,n as vh,o as yh,r as bh,s as xh,t as Sh}from"./panel-DNPki55m.js";import{t as Ch}from"./skeleton-BZIHOzZH.js";import{c as wh,i as Th,l as Eh,r as Dh}from"./lint-config-client-DIrSdYtN.js";import{a as Oh,o as kh,t as Ah}from"./agent-diff-store-DaX8UuW_.js";import{n as jh,r as Mh,t as Nh}from"./timeline-diff-store-ym5Oz1UF.js";import{a as Ph,c as Fh,i as Ih,n as Lh,o as Rh,r as zh,s as Bh,t as Vh}from"./EditorModeToggle-BhI-tjjV.js";import{a as Hh,c as Uh,d as Wh,g as Gh,h as Kh,i as qh,m as Jh,n as Yh,p as Xh,r as Zh,s as Qh,t as $h,u as eg}from"./sortable.esm-DK-jMveF.js";import{t as tg}from"./textarea-BoMa_3jF.js";import{t as ng}from"./open-managed-artifact-tab-VyuGTCnG.js";import{t as rg}from"./SkillCostValue-Bs-xte7N.js";import{t as ig}from"./SkillModeBanner-BRFTW7Zd.js";import{t as ag}from"./use-skill-origin-CDBZUwtC.js";import{n as og,r as sg,t as cg}from"./input-group-DroArAL7.js";import{n as lg,t as ug}from"./DiffView-DrIxcON3.js";import{A as dg,C as fg,D as pg,E as mg,O as hg,S as gg,T as _g,_ as vg,a as yg,b as bg,c as xg,d as Sg,f as Cg,g as wg,h as Tg,i as Eg,j as Dg,k as Og,l as kg,m as Ag,n as jg,o as Mg,p as Ng,r as Pg,s as Fg,t as Ig,u as Lg,v as Rg,w as zg,x as Bg,y as Vg}from"./file-tree-adapter-B0KaetQt.js";import{n as Hg,r as Ug}from"./platform-labels-DLZgi41O.js";import{t as Wg}from"./use-live-xterm-theme-91IeCxiL.js";import{t as Gg}from"./app-menubar-gate-Dyq1r1xM.js";import{n as Kg,r as qg}from"./agent-presence-B4IC4MV9.js";import{a as Jg,c as Yg,d as Xg,f as Zg,i as Qg,l as $g,m as e_,n as t_,o as n_,s as r_,t as i_,u as a_}from"./form-L2L52iP2.js";import{n as o_}from"./terminal-command-events-z-N381nZ.js";import{n as s_,r as c_,t as l_}from"./ok-Bg0dAnDm.js";import{a as u_,t as d_}from"./receive-store-C6fRYFtF.js";function f_(){({BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_APP_VERSION:`0.58.9`})?.VITE_OTEL_ENABLED===`true`&&n(()=>import(`./telemetry-impl-T0tYRMlO.js`).then(e=>e.install()),__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url)}var p_=class extends wn{#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||m_(),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=Pn({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),Tn.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function m_(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var h_=class extends Vn{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 p_({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=g_(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=g_(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=g_(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=g_(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){Tn.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=>Dn(t,e))}findAll(e={}){return this.getAll().filter(t=>Dn(e,t))}notify(e){Tn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return Tn.batch(()=>Promise.all(e.map(e=>e.continue().catch(Mn))))}};function g_(e){return e.options.scope?.id}var __=class extends Vn{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??En(r,t),a=this.get(i);return a||(a=new An({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(){Tn.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=>Fn(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Fn(e,t)):t}notify(e){Tn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Tn.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Tn.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},v_=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new __,this.#t=e.mutationCache||new h_,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=Bn.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Ln.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(On(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=jn(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return Tn.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;Tn.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return Tn.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=Tn.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(Mn).catch(Mn)}invalidateQueries(e,t={}){return Tn.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=Tn.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(Mn)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(Mn)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(On(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Mn).catch(Mn)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Mn).catch(Mn)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return Ln.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(zn(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{kn(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(zn(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{kn(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||=En(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===Cn&&(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()}},Z=r(),Q=e(bn(),1),y_=t(),$=Gn(),b_=`button, a[href], input, textarea, select, [contenteditable="true"], [role="button"], [role="menuitem"]`;function x_(){if(typeof document>`u`)return!1;let e=document.activeElement;return!e||e===document.body?!1:e instanceof Element&&e.matches(b_)}function S_(e={}){return pr()?!1:e.allowWhileFocused?!0:!x_()}var C_=e(Wn(),1),w_=`ok-blob-mascot`;function T_(e){if(typeof document>`u`){e();return}let t=document.startViewTransition,n=typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;if(typeof t!=`function`||n){e();return}t.call(document,()=>{(0,C_.flushSync)(e)})}var E_=64*.055,D_=.1875,O_=2400,k_=310;k_**2/(2*O_);var A_=580**2/(2*O_),j_=2*580/O_,M_=.09,N_=j_+.1,P_=.5,F_=1.3,I_=3200,L_=14,R_=j_*2.4,z_=j_*1.35,B_=.9,V_=.3,H_=14e3;function U_(e,t,n){return e+(t-e)*n}function W_(e){return Math.min(1,Math.max(0,e/H_))}function G_(e){return U_(R_,z_,W_(e))}function K_(e){return e<=iv?0:U_(nv,rv,W_(e))}var q_=38,J_=52,Y_=12,X_=20,Z_=34,Q_=14,$_=18,ev=22,tv=30,nv=.15,rv=.45,iv=900,av=240,ov=.05,sv=1/120,cv=12;function lv(){return{phase:`idle`,y:0,vy:0,dwell:0,jumpBuffer:0,jumping:!1,ducking:!1,speed:260,distance:0,obstacles:[],spawnCountdown:260*G_(0),nextObstacleId:0}}function uv(e){Object.assign(e,lv(),{phase:`running`})}function dv(e){return e.phase===`running`?e.jumping?(e.jumpBuffer=N_,!1):(e.vy=580,e.dwell=0,e.jumpBuffer=0,e.jumping=!0,!0):!1}function fv(e,t){e.phase===`running`&&(e.ducking=t)}function pv(e){return e.ducking&&e.y===0}function mv(e){return Math.floor(e.distance/cv)}function hv(e){if(pv(e))return{scaleX:F_,scaleY:P_};if(e.y===0&&e.dwell>0){let t=.28*(1-(1-e.dwell/M_));return{scaleX:1+t*.8,scaleY:1-t}}let t=.22*Math.min(Math.abs(e.vy)/580,1);return{scaleX:1-t*.7,scaleY:1+t}}function gv(e){let t=pv(e),n=64*(t?F_:1),r=64*(t?P_:1),i=n*D_,a=r*D_,o=28-(n-64)/2;return{left:o+i,right:o+n-i,bottom:e.y+a,top:e.y+r-a}}function _v(e,t){let n=gv(e);return n.left<t.x+t.width&&n.right>t.x&&n.bottom<t.y+t.height&&n.top>t.y}function vv(e,t,n){let r=n()<K_(e.distance),[i,a,o,s,c]=r?[ev,tv,Q_,$_,Z_]:[Y_,X_,q_,J_,0];e.obstacles.push({id:e.nextObstacleId,kind:r?`overhead`:`ground`,x:t,y:c,width:i+n()*(a-i),height:o+n()*(s-o)}),e.nextObstacleId+=1;let l=U_(B_,V_,W_(e.distance));e.spawnCountdown=e.speed*(G_(e.distance)+n()*l)}function yv(e,t,n,r){if(e.jumpBuffer=Math.max(0,e.jumpBuffer-t),e.y>0||e.vy>0){let n=e.ducking?O_+I_:O_;e.vy-=n*t,e.y+=e.vy*t,e.y<=0&&(e.y=0,e.vy=0,e.jumping=!1,e.jumpBuffer>0?(e.vy=580,e.jumpBuffer=0,e.jumping=!0):e.dwell=M_)}else e.ducking?e.dwell=0:(e.dwell-=t,e.dwell<=0&&(e.dwell=0,e.vy=k_));e.speed=Math.min(620,e.speed+L_*t);let i=e.speed*t;e.distance+=i;for(let t of e.obstacles)t.x-=i;e.obstacles=e.obstacles.filter(e=>e.x+e.width>0),e.spawnCountdown-=i,e.spawnCountdown<=0&&vv(e,n,r);for(let t of e.obstacles)if(_v(e,t)){e.phase=`over`;return}}function bv(e,t,n,r=Math.random){if(e.phase!==`running`)return e;let i=Math.max(n,av),a=Math.min(Math.max(t,0),ov);for(;a>0;){let t=Math.min(a,sv);if(a-=t,yv(e,t,i,r),e.phase!==`running`)break}return e}var xv=`ok-blob-runner-best`;function Sv(){try{return typeof localStorage>`u`?null:localStorage}catch{return null}}function Cv(e=Sv()){if(!e)return 0;try{let t=Number(e.getItem(xv));return Number.isFinite(t)&&t>0?Math.floor(t):0}catch{return 0}}function wv(e,t=Sv()){if(!(!t||!Number.isFinite(e)||e<=0))try{t.setItem(xv,String(Math.floor(e)))}catch{}}function Tv(e,t,n){let r=n?.windowMs??4e3;return e<=0||t>=r?1:e+1}var Ev=Math.ceil(A_+64+8),Dv=Array.from({length:24},(e,t)=>`obstacle-slot-${t}`),Ov=300,kv=4,Av=.45;function jv(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(O,{className:`h-4 min-w-4 px-1.5 align-middle text-[10px]`,children:n}),t[0]=n,t[1]=r),r}function Mv(e){let t=(0,$.c)(48),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{autoStart:r}=n,i=r===void 0?!1:r,a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=lv(),t[2]=a):a=t[2];let o=(0,Q.useRef)(a),s=(0,Q.useRef)(null),c=(0,Q.useRef)(null),l=(0,Q.useRef)(null),u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=[],t[3]=u):u=t[3];let d=(0,Q.useRef)(u),[f,p]=(0,Q.useState)(`idle`),[m,h]=(0,Q.useState)(0),[g,_]=(0,Q.useState)(Fv),v=(0,Q.useRef)(g),[y,b]=(0,Q.useState)(0),[x,S]=(0,Q.useState)(!1),[C]=(0,Q.useState)(Pv),w,T;t[4]!==i||t[5]!==C?(w=()=>{if(!i||C)return;let e=setTimeout(()=>{uv(o.current),p(`running`)},Ov);return()=>clearTimeout(e)},T=[i,C],t[4]=i,t[5]=C,t[6]=w,t[7]=T):(w=t[6],T=t[7]),(0,Q.useEffect)(w,T);let E,D;t[8]===f?(E=t[9],D=t[10]):(E=()=>{if(f!==`running`)return;let e=0,t=performance.now(),n=function(){let e=o.current;if(c.current){let{scaleX:t,scaleY:n}=hv(e);c.current.style.transform=`translateY(${E_-e.y}px) scale(${t.toFixed(4)}, ${n.toFixed(4)})`}for(let t=0;t<24;t++){let n=d.current[t];if(!n)continue;let r=e.obstacles[t];if(!r){n.style.opacity=`0`;continue}n.style.opacity=`1`,n.style.width=`${r.width}px`,n.style.height=`${r.height}px`,n.style.bottom=`${r.y}px`,n.style.borderRadius=r.kind===`overhead`?`9999px`:`3px`,n.style.transform=`translateX(${r.x}px)`}l.current&&(l.current.textContent=String(mv(e)).padStart(kv,`0`))};function r(i){let a=o.current;if(bv(a,(i-t)/1e3,s.current?.clientWidth??0),t=i,n(),a.phase===`over`){let e=mv(a),t=e>v.current;h(e),t&&(v.current=e,wv(e),_(e),S(!0),b(Nv)),p(`over`);return}e=requestAnimationFrame(r)}return e=requestAnimationFrame(r),()=>cancelAnimationFrame(e)},D=[f],t[8]=f,t[9]=E,t[10]=D),(0,Q.useEffect)(E,D);let O,k;t[11]===C?(O=t[12],k=t[13]):(k=()=>{if(C)return;let e=function(){uv(o.current),S(!1),p(`running`)},t=function(t){let n=o.current;if(t.key===`ArrowDown`){if(!S_({allowWhileFocused:!0}))return;t.preventDefault(),fv(n,!0);return}t.key!==` `&&t.key!==`ArrowUp`||S_({allowWhileFocused:t.key===`ArrowUp`})&&(t.preventDefault(),n.phase===`running`?dv(n):e())},n=function(e){e.key===`ArrowDown`&&fv(o.current,!1)};return window.addEventListener(`keydown`,t),window.addEventListener(`keyup`,n),()=>{window.removeEventListener(`keydown`,t),window.removeEventListener(`keyup`,n)}},O=[C],t[11]=C,t[12]=O,t[13]=k),(0,Q.useEffect)(k,O);let A;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(e){x_()&&document.activeElement.blur();let t=o.current;if(t.phase!==`running`){uv(t),S(!1),p(`running`);return}let n=e.currentTarget.getBoundingClientRect();if(e.clientY-n.top>n.height*(1-Av)){fv(t,!0),e.currentTarget.setPointerCapture?.(e.pointerId);return}dv(t)},t[14]=A):A=t[14];let j=A,M;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(M=function(){fv(o.current,!1)},t[15]=M):M=t[15];let N=M;if(C){let e;return t[16]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(ur,{size:64,variant:`sleeping`}),t[16]=e):e=t[16],e}let P=f!==`running`&&!x,F;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(F={height:Ev},t[17]=F):F=t[17];let I;t[18]===i?I=t[19]:(I={left:28,transform:`translateY(${E_}px)`,...i?{viewTransitionName:w_}:{}},t[18]=i,t[19]=I);let L=P?`sleeping`:`default`,R;t[20]!==y||t[21]!==L?(R=(0,Z.jsx)(ur,{size:64,trackMouse:!1,variant:L,celebrateSignal:y}),t[20]=y,t[21]=L,t[22]=R):R=t[22];let z;t[23]!==I||t[24]!==R?(z=(0,Z.jsx)(`div`,{ref:c,className:`absolute bottom-0 flex origin-bottom will-change-transform`,style:I,children:R}),t[23]=I,t[24]=R,t[25]=z):z=t[25];let B;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(B=Dv.map((e,t)=>(0,Z.jsx)(`div`,{"data-slot":`ok-blob-runner-obstacle`,ref:e=>{d.current[t]=e},className:`absolute bottom-0 left-0 rounded-sm bg-muted-foreground/70 will-change-transform`,style:{opacity:0}},e)),t[26]=B):B=t[26];let V;t[27]!==z||t[28]!==B?(V=(0,Z.jsxs)(`div`,{ref:s,"data-slot":`ok-blob-runner-track`,className:`relative w-full cursor-pointer overflow-hidden border-b border-dashed border-border`,style:F,onPointerDown:j,onPointerUp:N,onPointerCancel:N,onPointerLeave:N,children:[z,B]}),t[27]=z,t[28]=B,t[29]=V):V=t[29];let H;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(H={left:28},t[30]=H):H=t[30];let U;t[31]!==x||t[32]!==g?(U=g>0?(0,Z.jsxs)(`span`,{className:x?`text-muted-foreground`:void 0,children:[(0,Z.jsx)(Y,{id:`9GbR5F`}),` `,String(g).padStart(kv,`0`)]}):null,t[31]=x,t[32]=g,t[33]=U):U=t[33];let ee=String(m),W;t[34]===ee?W=t[35]:(W=ee.padStart(kv,`0`),t[34]=ee,t[35]=W);let te;t[36]===W?te=t[37]:(te=(0,Z.jsx)(`span`,{ref:l,children:W}),t[36]=W,t[37]=te);let G;t[38]!==U||t[39]!==te?(G=(0,Z.jsx)(`div`,{className:`relative mt-1.5 h-5`,children:(0,Z.jsxs)(`div`,{"data-slot":`ok-blob-runner-score`,className:`absolute top-0 flex gap-3 font-mono text-xs tabular-nums text-muted-foreground/60`,style:H,children:[U,te]})}),t[38]=U,t[39]=te,t[40]=G):G=t[40];let K;t[41]!==x||t[42]!==f?(K=(0,Z.jsx)(`p`,{"data-slot":`ok-blob-runner-hint`,className:`mt-2 text-center font-mono text-[11px] uppercase tracking-wide text-muted-foreground/60`,children:f===`over`?x?(0,Z.jsx)(Y,{id:`ai40UJ`,components:{0:(0,Z.jsx)(jv,{})}}):(0,Z.jsx)(Y,{id:`uY5Z7P`,components:{0:(0,Z.jsx)(jv,{})}}):f===`running`?(0,Z.jsx)(Y,{id:`pI_bKs`,components:{0:(0,Z.jsx)(jv,{}),1:(0,Z.jsx)(jv,{})}}):(0,Z.jsx)(Y,{id:`7a0YcF`,components:{0:(0,Z.jsx)(jv,{})}})}),t[41]=x,t[42]=f,t[43]=K):K=t[43];let q;return t[44]!==V||t[45]!==G||t[46]!==K?(q=(0,Z.jsxs)(`div`,{"aria-hidden":`true`,"data-slot":`ok-blob-runner`,className:`w-full select-none animate-in fade-in-0 slide-in-from-bottom-2 duration-300 motion-reduce:animate-none`,children:[V,G,K]}),t[44]=V,t[45]=G,t[46]=K,t[47]=q):q=t[47],q}function Nv(e){return e+1}function Pv(){return typeof window<`u`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function Fv(){return Cv()}var Iv=80;function Lv(e){let t=(0,$.c)(9),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{keyboard:r}=n,i=r===void 0?!0:r,[a,o]=(0,Q.useState)(!1),s=(0,Q.useRef)(!1),[c]=(0,Q.useState)(Rv),l,u;if(t[2]!==i||t[3]!==c?(l=()=>{if(c||!i)return;let e=function(e){s.current||e.key!==` `&&e.key!==`ArrowUp`||S_({allowWhileFocused:e.key===`ArrowUp`})&&(e.preventDefault(),s.current=!0,T_(()=>o(!0)))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},u=[c,i],t[2]=i,t[3]=c,t[4]=l,t[5]=u):(l=t[4],u=t[5]),(0,Q.useEffect)(l,u),a){let e;return t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Mv,{autoStart:!0}),t[6]=e):e=t[6],e}if(c){let e;return t[7]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(ur,{size:Iv,variant:`sleeping`}),t[7]=e):e=t[7],e}let d;return t[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(`div`,{"aria-hidden":`true`,"data-slot":`ok-blob-runner-easter-egg`,className:`cursor-pointer select-none transition-opacity duration-200`,style:{viewTransitionName:w_},onPointerDown:()=>{x_()&&document.activeElement.blur(),s.current=!0,T_(()=>o(!0))},children:(0,Z.jsx)(ur,{size:Iv,variant:`sleeping`})}),t[8]=d):d=t[8],d}function Rv(){return typeof window<`u`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}var zv=(0,Q.lazy)(()=>n(()=>import(`./ReportBugDialogBody-DWbWOZyj.js`),__vite__mapDeps([7,1,8,2,3,6,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,4,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47]),import.meta.url)),Bv=1200,Vv=`[cmdk-root],[data-radix-popper-content-wrapper]`,Hv=500;function Uv(e){let t=(0,$.c)(9),[n,r]=(0,Q.useState)(e.open),[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(!1),u=(0,Q.useRef)(0);e.open&&!n&&r(!0);let d,f;if(t[0]!==e.crashInvite||t[1]!==e.open?(d=()=>{if(!e.open){a(!1);return}let t=u.current+=1;l(!1);let n=window.okDesktop?.bugReport?.crashDumpAvailability;e.crashInvite===void 0&&typeof n==`function`&&n().then(e=>{u.current===t&&l(e.available)}).catch(Wv);let r=window.okDesktop?.bugReport?.captureScreenshot;if(typeof r!=`function`||e.crashInvite!==void 0){s(null),a(!0);return}s(null);let i=!1,o=e=>{i||u.current!==t||(i=!0,s(e),a(!0))},c=setTimeout(()=>o(null),Bv),d=performance.now(),f=0,p=()=>{if(u.current!==t)return;let e=performance.now()-d>=Hv;if(document.querySelector(Vv)!==null&&!e){f=requestAnimationFrame(p);return}f=requestAnimationFrame(()=>{u.current===t&&r().then(o).catch(()=>o(null))})};return f=requestAnimationFrame(p),()=>{u.current+=1,clearTimeout(c),cancelAnimationFrame(f)}},f=[e.open,e.crashInvite],t[0]=e.crashInvite,t[1]=e.open,t[2]=d,t[3]=f):(d=t[2],f=t[3]),(0,Q.useEffect)(d,f),!n)return null;let p=e.open&&i,m;return t[4]!==c||t[5]!==e||t[6]!==o||t[7]!==p?(m=(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(zv,{...e,open:p,screenshot:o,crashDumpAvailable:c})}),t[4]=c,t[5]=e,t[6]=o,t[7]=p,t[8]=m):m=t[8],m}function Wv(e){console.warn(`[bug-report] crash-dump availability probe failed:`,e)}var Gv=new WeakMap;function Kv(e,t){typeof e!=`object`||!e||typeof t!=`string`||t.trim()===``||Gv.set(e,t)}function qv(e){if(!(typeof e!=`object`||!e))return Gv.get(e)}function Jv(e){let t=(0,$.c)(24),{error:n,resetErrorBoundary:r}=e,{_:i}=xn(),[a,o]=(0,Q.useState)(!1),s=(0,Q.useRef)(null),c=typeof window<`u`?window.okDesktop:void 0,l;t[0]!==i||t[1]!==n?(l=n instanceof Error&&n.message?n.message:i({id:`W5A0Ly`}),t[0]=i,t[1]=n,t[2]=l):l=t[2];let u=l,d,f;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>{s.current?.focus()},f=[],t[3]=d,t[4]=f):(d=t[3],f=t[4]),(0,Q.useEffect)(d,f);let p;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(Lv,{keyboard:!1}),t[5]=p):p=t[5];let m;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(`h1`,{id:`app-error-title`,className:`text-2xl font-light tracking-tighter text-balance`,children:(0,Z.jsx)(Y,{id:`nwtY4N`})}),t[6]=m):m=t[6];let h;t[7]===u?h=t[8]:(h=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[m,(0,Z.jsx)(`p`,{className:`max-w-sm text-sm break-words text-muted-foreground`,children:u})]}),t[7]=u,t[8]=h);let g;t[9]===r?g=t[10]:(g=()=>r(),t[9]=r,t[10]=g);let _;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(Y,{id:`KDw4GX`}),t[11]=_):_=t[11];let v;t[12]===g?v=t[13]:(v=(0,Z.jsx)(X,{ref:s,variant:`default`,onClick:g,children:_}),t[12]=g,t[13]=v);let y;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(y=c?(0,Z.jsx)(X,{variant:`ghost`,className:`font-mono uppercase`,onClick:()=>o(!0),children:(0,Z.jsx)(Y,{id:`ii5mVn`})}):null,t[14]=y):y=t[14];let b;t[15]===v?b=t[16]:(b=(0,Z.jsxs)(`div`,{className:`mt-1 flex gap-2`,children:[v,y]}),t[15]=v,t[16]=b);let x;t[17]!==n||t[18]!==a?(x=c?(0,Z.jsx)(Zv,{children:(0,Z.jsx)(Uv,{open:a,onOpenChange:o,systemWide:c.config.mode===`navigator`,crashContext:{source:`app shell`,errorMessage:n instanceof Error&&n.message?n.message:String(n),componentStack:qv(n)}})}):null,t[17]=n,t[18]=a,t[19]=x):x=t[19];let S;return t[20]!==b||t[21]!==x||t[22]!==h?(S=(0,Z.jsxs)(`div`,{role:`alert`,"aria-labelledby":`app-error-title`,"data-slot":`app-error-boundary`,className:`flex h-screen flex-col items-center justify-center gap-8 p-8 text-center`,children:[p,h,b,x]}),t[20]=b,t[21]=x,t[22]=h,t[23]=S):S=t[23],S}function Yv(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(Xn,{FallbackComponent:Jv,onError:Xv,children:n}),t[0]=n,t[1]=r),r}function Xv(e,t){Kv(e,t.componentStack),Me(e),console.error(`[AppErrorBoundary] app-shell render crash`,e,t.componentStack??``)}function Zv(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(Xn,{fallback:null,onError:Qv,children:n}),t[0]=n,t[1]=r),r}function Qv(e){console.error(`[CrashReportingBoundary] crash-reporting UI render crash`,e)}function $v(){let e=(0,$.c)(5),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={queryKey:[`acp-catalog`],queryFn:ny,staleTime:3e5},e[0]=t):t=e[0];let n=Rn(t),r;e[1]===n.data?.agents?r=e[2]:(r=()=>(wi(_a(n.data?.agents??[]).map(ty)),ey),e[1]=n.data?.agents,e[2]=r);let i;return e[3]===n.data?i=e[4]:(i=[n.data],e[3]=n.data,e[4]=i),(0,Q.useEffect)(r,i),null}function ey(){return wi([])}function ty(e){return{source:e.source,id:e.id,name:e.name,featured:e.featured,...e.iconUrl===void 0?{}:{iconUrl:e.iconUrl}}}function ny(e){let{signal:t}=e;return ma(t)}var ry=Sl(`arrow-up-down`,[[`path`,{d:`m21 16-4 4-4-4`,key:`f6ql7i`}],[`path`,{d:`M17 20V4`,key:`1ejh1v`}],[`path`,{d:`m3 8 4-4 4 4`,key:`11wl7u`}],[`path`,{d:`M7 4v16`,key:`1glfcx`}]]),iy=Sl(`bird`,[[`path`,{d:`M16 7h.01`,key:`1kdx03`}],[`path`,{d:`M3.4 18H12a8 8 0 0 0 8-8V7a4 4 0 0 0-7.28-2.3L2 20`,key:`oj1oa8`}],[`path`,{d:`m20 7 2 .5-2 .5`,key:`12nv4d`}],[`path`,{d:`M10 18v3`,key:`1yea0a`}],[`path`,{d:`M14 17.75V21`,key:`1pymcb`}],[`path`,{d:`M7 18a6 6 0 0 0 3.84-10.61`,key:`1npnn0`}]]),ay=Sl(`blocks`,[[`path`,{d:`M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2`,key:`1ah6g2`}],[`rect`,{x:`14`,y:`2`,width:`8`,height:`8`,rx:`1`,key:`88lufb`}]]),oy=Sl(`bold`,[[`path`,{d:`M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8`,key:`mg9rjx`}]]),sy=Sl(`book-marked`,[[`path`,{d:`M10 2v8l3-3 3 3V2`,key:`sqw3rj`}],[`path`,{d:`M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20`,key:`k3hazp`}]]),cy=Sl(`cat`,[[`path`,{d:`M12 5c.67 0 1.35.09 2 .26 1.78-2 5.03-2.84 6.42-2.26 1.4.58-.42 7-.42 7 .57 1.07 1 2.24 1 3.44C21 17.9 16.97 21 12 21s-9-3-9-7.56c0-1.25.5-2.4 1-3.44 0 0-1.89-6.42-.5-7 1.39-.58 4.72.23 6.5 2.23A9.04 9.04 0 0 1 12 5Z`,key:`x6xyqk`}],[`path`,{d:`M8 14v.5`,key:`1nzgdb`}],[`path`,{d:`M16 14v.5`,key:`1lajdz`}],[`path`,{d:`M11.25 16.25h1.5L12 17l-.75-.75Z`,key:`12kq1m`}]]),ly=Sl(`check-check`,[[`path`,{d:`M18 6 7 17l-5-5`,key:`116fxf`}],[`path`,{d:`m22 10-7.5 7.5L13 16`,key:`ke71qq`}]]),uy=Sl(`circle-dot`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]),dy=Sl(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),fy=Sl(`columns-3`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),py=Sl(`compass`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z`,key:`9ktpf1`}]]),my=Sl(`copy-x`,[[`line`,{x1:`12`,x2:`18`,y1:`12`,y2:`18`,key:`1rg63v`}],[`line`,{x1:`12`,x2:`18`,y1:`18`,y2:`12`,key:`ebkxgr`}],[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),hy=Sl(`corner-down-left`,[[`path`,{d:`M20 4v7a4 4 0 0 1-4 4H4`,key:`6o5b7l`}],[`path`,{d:`m9 10-5 5 5 5`,key:`1kshq7`}]]),gy=Sl(`dog`,[[`path`,{d:`M11.25 16.25h1.5L12 17z`,key:`w7jh35`}],[`path`,{d:`M16 14v.5`,key:`1lajdz`}],[`path`,{d:`M4.42 11.247A13.152 13.152 0 0 0 4 14.556C4 18.728 7.582 21 12 21s8-2.272 8-6.444a11.702 11.702 0 0 0-.493-3.309`,key:`u7s9ue`}],[`path`,{d:`M8 14v.5`,key:`1nzgdb`}],[`path`,{d:`M8.5 8.5c-.384 1.05-1.083 2.028-2.344 2.5-1.931.722-3.576-.297-3.656-1-.113-.994 1.177-6.53 4-7 1.923-.321 3.651.845 3.651 2.235A7.497 7.497 0 0 1 14 5.277c0-1.39 1.844-2.598 3.767-2.277 2.823.47 4.113 6.006 4 7-.08.703-1.725 1.722-3.656 1-1.261-.472-1.855-1.45-2.239-2.5`,key:`v8hric`}]]),_y=Sl(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),vy=Sl(`file-check`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m9 15 2 2 4-4`,key:`1grp1n`}]]),yy=Sl(`file-code-corner`,[[`path`,{d:`M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35`,key:`1wthlu`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m5 16-3 3 3 3`,key:`331omg`}],[`path`,{d:`m9 22 3-3-3-3`,key:`lsp7cz`}]]),by=Sl(`file-exclamation-point`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),xy=Sl(`file-key`,[[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M4 12v6`,key:`bg1pfk`}],[`path`,{d:`M4 14h2`,key:`1sf9f8`}],[`path`,{d:`M9.65 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v4`,key:`d56i0q`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),Sy=Sl(`fish`,[[`path`,{d:`M6.5 12c.94-3.46 4.94-6 8.5-6 3.56 0 6.06 2.54 7 6-.94 3.47-3.44 6-7 6s-7.56-2.53-8.5-6Z`,key:`15baut`}],[`path`,{d:`M18 12v.5`,key:`18hhni`}],[`path`,{d:`M16 17.93a9.77 9.77 0 0 1 0-11.86`,key:`16dt7o`}],[`path`,{d:`M7 10.67C7 8 5.58 5.97 2.73 5.5c-1 1.5-1 5 .23 6.5-1.24 1.5-1.24 5-.23 6.5C5.58 18.03 7 16 7 13.33`,key:`l9di03`}],[`path`,{d:`M10.46 7.26C10.2 5.88 9.17 4.24 8 3h5.8a2 2 0 0 1 1.98 1.67l.23 1.4`,key:`1kjonw`}],[`path`,{d:`m16.01 17.93-.23 1.4A2 2 0 0 1 13.8 21H9.5a5.96 5.96 0 0 0 1.49-3.98`,key:`1zlm23`}]]),Cy=Sl(`fold-vertical`,[[`path`,{d:`M12 22v-6`,key:`6o8u61`}],[`path`,{d:`M12 8V2`,key:`1wkif3`}],[`path`,{d:`M4 12H2`,key:`rhcxmi`}],[`path`,{d:`M10 12H8`,key:`s88cx1`}],[`path`,{d:`M16 12h-2`,key:`10asgb`}],[`path`,{d:`M22 12h-2`,key:`14jgyd`}],[`path`,{d:`m15 19-3-3-3 3`,key:`e37ymu`}],[`path`,{d:`m15 5-3 3-3-3`,key:`19d6lf`}]]),wy=Sl(`folder-cog`,[[`path`,{d:`M10.3 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.98a2 2 0 0 1 1.69.9l.66 1.2A2 2 0 0 0 12 6h8a2 2 0 0 1 2 2v3.3`,key:`128dxu`}],[`path`,{d:`m14.305 19.53.923-.382`,key:`3m78fa`}],[`path`,{d:`m15.228 16.852-.923-.383`,key:`npixar`}],[`path`,{d:`m16.852 15.228-.383-.923`,key:`5xggr7`}],[`path`,{d:`m16.852 20.772-.383.924`,key:`dpfhf9`}],[`path`,{d:`m19.148 15.228.383-.923`,key:`1reyyz`}],[`path`,{d:`m19.53 21.696-.382-.924`,key:`1goivc`}],[`path`,{d:`m20.772 16.852.924-.383`,key:`htqkph`}],[`path`,{d:`m20.772 19.148.924.383`,key:`9w9pjp`}],[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}]]),Ty=Sl(`folder-plus`,[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),Ey=Sl(`gamepad-2`,[[`line`,{x1:`6`,x2:`10`,y1:`11`,y2:`11`,key:`1gktln`}],[`line`,{x1:`8`,x2:`8`,y1:`9`,y2:`13`,key:`qnk9ow`}],[`line`,{x1:`15`,x2:`15.01`,y1:`12`,y2:`12`,key:`krot7o`}],[`line`,{x1:`18`,x2:`18.01`,y1:`10`,y2:`10`,key:`1lcuu1`}],[`path`,{d:`M17.32 5H6.68a4 4 0 0 0-3.978 3.59c-.006.052-.01.101-.017.152C2.604 9.416 2 14.456 2 16a3 3 0 0 0 3 3c1 0 1.5-.5 2-1l1.414-1.414A2 2 0 0 1 9.828 16h4.344a2 2 0 0 1 1.414.586L17 18c.5.5 1 1 2 1a3 3 0 0 0 3-3c0-1.545-.604-6.584-.685-7.258-.007-.05-.011-.1-.017-.151A4 4 0 0 0 17.32 5z`,key:`mfqc10`}]]),Dy=Sl(`grid-2x2-x`,[[`path`,{d:`M12 3v17a1 1 0 0 1-1 1H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v6a1 1 0 0 1-1 1H3`,key:`11za1p`}],[`path`,{d:`m16 16 5 5`,key:`8tpb07`}],[`path`,{d:`m16 21 5-5`,key:`193jll`}]]),Oy=Sl(`hard-drive`,[[`path`,{d:`M10 16h.01`,key:`1bzywj`}],[`path`,{d:`M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`18tbho`}],[`path`,{d:`M21.946 12.013H2.054`,key:`zqlbp7`}],[`path`,{d:`M6 16h.01`,key:`1pmjb7`}]]),ky=Sl(`highlighter`,[[`path`,{d:`m9 11-6 6v3h9l3-3`,key:`1a3l36`}],[`path`,{d:`m22 12-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4`,key:`14a9rk`}]]),Ay=Sl(`italic`,[[`line`,{x1:`19`,x2:`10`,y1:`4`,y2:`4`,key:`15jd3p`}],[`line`,{x1:`14`,x2:`5`,y1:`20`,y2:`20`,key:`bu0au3`}],[`line`,{x1:`15`,x2:`9`,y1:`4`,y2:`20`,key:`uljnxc`}]]),jy=Sl(`library`,[[`path`,{d:`m16 6 4 14`,key:`ji33uf`}],[`path`,{d:`M12 6v14`,key:`1n7gus`}],[`path`,{d:`M8 8v12`,key:`1gg7y9`}],[`path`,{d:`M4 4v16`,key:`6qkkli`}]]),My=Sl(`link`,[[`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`,key:`1cjeqo`}],[`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`,key:`19qd67`}]]),Ny=Sl(`list-collapse`,[[`path`,{d:`M10 5h11`,key:`1hkqpe`}],[`path`,{d:`M10 12h11`,key:`6m4ad9`}],[`path`,{d:`M10 19h11`,key:`14g2nv`}],[`path`,{d:`m3 10 3-3-3-3`,key:`i7pm08`}],[`path`,{d:`m3 20 3-3-3-3`,key:`20gx1n`}]]),Py=Sl(`list-tree`,[[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`M3 10a2 2 0 0 0 2 2h3`,key:`1npucw`}],[`path`,{d:`M3 5v12a2 2 0 0 0 2 2h3`,key:`x1gjn2`}]]),Fy=[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]],Iy=Sl(`lock`,Fy),Ly=Sl(`megaphone`,[[`path`,{d:`M11 6a13 13 0 0 0 8.4-2.8A1 1 0 0 1 21 4v12a1 1 0 0 1-1.6.8A13 13 0 0 0 11 14H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2z`,key:`q8bfy3`}],[`path`,{d:`M6 14a12 12 0 0 0 2.4 7.2 2 2 0 0 0 3.2-2.4A8 8 0 0 1 10 14`,key:`1853fq`}],[`path`,{d:`M8 6v8`,key:`15ugcq`}]]),Ry=Sl(`network`,[[`rect`,{x:`16`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`4q2zg0`}],[`rect`,{x:`2`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`8cvhb9`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`6`,rx:`1`,key:`1egb70`}],[`path`,{d:`M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3`,key:`1jsf9p`}],[`path`,{d:`M12 12V8`,key:`2874zd`}]]),zy=Sl(`octagon-x`,[[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z`,key:`2d38gg`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),By=Sl(`panel-left-open`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m14 9 3 3-3 3`,key:`8010ee`}]]),Vy=Sl(`pen-line`,[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),Hy=Sl(`pilcrow`,[[`path`,{d:`M13 4v16`,key:`8vvj80`}],[`path`,{d:`M17 4v16`,key:`7dpous`}],[`path`,{d:`M19 4H9.5a4.5 4.5 0 0 0 0 9H13`,key:`sh4n9v`}]]),Uy=Sl(`pin`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z`,key:`1nkz8b`}]]),Wy=Sl(`puzzle`,[[`path`,{d:`M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z`,key:`w46dr5`}]]),Gy=Sl(`rabbit`,[[`path`,{d:`M13 16a3 3 0 0 1 2.24 5`,key:`1epib5`}],[`path`,{d:`M18 12h.01`,key:`yjnet6`}],[`path`,{d:`M18 21h-8a4 4 0 0 1-4-4 7 7 0 0 1 7-7h.2L9.6 6.4a1 1 0 1 1 2.8-2.8L15.8 7h.2c3.3 0 6 2.7 6 6v1a2 2 0 0 1-2 2h-1a3 3 0 0 0-3 3`,key:`ue9ozu`}],[`path`,{d:`M20 8.54V4a2 2 0 1 0-4 0v3`,key:`49iql8`}],[`path`,{d:`M7.612 12.524a3 3 0 1 0-1.6 4.3`,key:`1e33i0`}]]),Ky=Sl(`rat`,[[`path`,{d:`M13 22H4a2 2 0 0 1 0-4h12`,key:`bt3f23`}],[`path`,{d:`M13.236 18a3 3 0 0 0-2.2-5`,key:`1tbvmo`}],[`path`,{d:`M16 9h.01`,key:`1bdo4e`}],[`path`,{d:`M16.82 3.94a3 3 0 1 1 3.237 4.868l1.815 2.587a1.5 1.5 0 0 1-1.5 2.1l-2.872-.453a3 3 0 0 0-3.5 3`,key:`9ch7kn`}],[`path`,{d:`M17 4.988a3 3 0 1 0-5.2 2.052A7 7 0 0 0 4 14.015 4 4 0 0 0 8 18`,key:`3s7e9i`}]]),qy=Sl(`replace-all`,[[`path`,{d:`M14 14a1 1 0 0 1 1 1v5a1 1 0 0 1-1 1`,key:`zg1ipl`}],[`path`,{d:`M14 4a1 1 0 0 1 1-1`,key:`dhj8ez`}],[`path`,{d:`M15 10a1 1 0 0 1-1-1`,key:`1mnyi5`}],[`path`,{d:`M19 14a1 1 0 0 1 1 1v5a1 1 0 0 1-1 1`,key:`txt6k4`}],[`path`,{d:`M21 4a1 1 0 0 0-1-1`,key:`sfs9ap`}],[`path`,{d:`M21 9a1 1 0 0 1-1 1`,key:`mp6qeo`}],[`path`,{d:`m3 7 3 3 3-3`,key:`x25e72`}],[`path`,{d:`M6 10V5a2 2 0 0 1 2-2h2`,key:`15xut4`}],[`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1`,key:`1bkyp8`}]]),Jy=Sl(`replace`,[[`path`,{d:`M14 4a1 1 0 0 1 1-1`,key:`dhj8ez`}],[`path`,{d:`M15 10a1 1 0 0 1-1-1`,key:`1mnyi5`}],[`path`,{d:`M21 4a1 1 0 0 0-1-1`,key:`sfs9ap`}],[`path`,{d:`M21 9a1 1 0 0 1-1 1`,key:`mp6qeo`}],[`path`,{d:`m3 7 3 3 3-3`,key:`x25e72`}],[`path`,{d:`M6 10V5a2 2 0 0 1 2-2h2`,key:`15xut4`}],[`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1`,key:`1bkyp8`}]]),Yy=Sl(`shrimp`,[[`path`,{d:`M11 12h.01`,key:`1lr4k6`}],[`path`,{d:`M13 22c.5-.5 1.12-1 2.5-1-1.38 0-2-.5-2.5-1`,key:`fatpdi`}],[`path`,{d:`M14 2a3.28 3.28 0 0 1-3.227 1.798l-6.17-.561A2.387 2.387 0 1 0 4.387 8H15.5a1 1 0 0 1 0 13 1 1 0 0 0 0-5H12a7 7 0 0 1-7-7V8`,key:`kehrqe`}],[`path`,{d:`M14 8a8.5 8.5 0 0 1 0 8`,key:`1imjx2`}],[`path`,{d:`M16 16c2 0 4.5-4 4-6`,key:`z0nejz`}]]),Xy=Sl(`snail`,[[`path`,{d:`M2 13a6 6 0 1 0 12 0 4 4 0 1 0-8 0 2 2 0 0 0 4 0`,key:`hneq2s`}],[`circle`,{cx:`10`,cy:`13`,r:`8`,key:`194lz3`}],[`path`,{d:`M2 21h12c4.4 0 8-3.6 8-8V7a2 2 0 1 0-4 0v6`,key:`ixqyt7`}],[`path`,{d:`M18 3 19.1 5.2`,key:`9tjm43`}],[`path`,{d:`M22 3 20.9 5.2`,key:`j3odrs`}]]),Zy=Sl(`spell-check`,[[`path`,{d:`m6 16 6-12 6 12`,key:`1b4byz`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}],[`path`,{d:`m16 20 2 2 4-4`,key:`13tcca`}]]),Qy=Sl(`square-arrow-out-up-right`,[[`path`,{d:`M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6`,key:`y09zxi`}],[`path`,{d:`m21 3-9 9`,key:`mpx6sq`}],[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}]]),$y=Sl(`square-code`,[[`path`,{d:`m10 9-3 3 3 3`,key:`1oro0q`}],[`path`,{d:`m14 15 3-3-3-3`,key:`bz13h7`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}]]),eb=Sl(`squirrel`,[[`path`,{d:`M15.236 22a3 3 0 0 0-2.2-5`,key:`21bitc`}],[`path`,{d:`M16 20a3 3 0 0 1 3-3h1a2 2 0 0 0 2-2v-2a4 4 0 0 0-4-4V4`,key:`oh0fg0`}],[`path`,{d:`M18 13h.01`,key:`9veqaj`}],[`path`,{d:`M18 6a4 4 0 0 0-4 4 7 7 0 0 0-7 7c0-5 4-5 4-10.5a4.5 4.5 0 1 0-9 0 2.5 2.5 0 0 0 5 0C7 10 3 11 3 17c0 2.8 2.2 5 5 5h10`,key:`980v8a`}]]),tb=Sl(`star`,[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]),nb=Sl(`sticky-note`,[[`path`,{d:`M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z`,key:`1dfntj`}],[`path`,{d:`M15 3v5a1 1 0 0 0 1 1h5`,key:`6s6qgf`}]]),rb=Sl(`strikethrough`,[[`path`,{d:`M16 4H9a3 3 0 0 0-2.83 4`,key:`43sutm`}],[`path`,{d:`M14 12a4 4 0 0 1 0 8H6`,key:`nlfj13`}],[`line`,{x1:`4`,x2:`20`,y1:`12`,y2:`12`,key:`1e0a9i`}]]),ib=Sl(`table-properties`,[[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M21 9H3`,key:`1338ky`}],[`path`,{d:`M21 15H3`,key:`9uk58r`}]]),ab=Sl(`tag`,[[`path`,{d:`M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z`,key:`vktsd0`}],[`circle`,{cx:`7.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`kqv944`}]]),ob=Sl(`telescope`,[[`path`,{d:`m10.065 12.493-6.18 1.318a.934.934 0 0 1-1.108-.702l-.537-2.15a1.07 1.07 0 0 1 .691-1.265l13.504-4.44`,key:`k4qptu`}],[`path`,{d:`m13.56 11.747 4.332-.924`,key:`19l80z`}],[`path`,{d:`m16 21-3.105-6.21`,key:`7oh9d`}],[`path`,{d:`M16.485 5.94a2 2 0 0 1 1.455-2.425l1.09-.272a1 1 0 0 1 1.212.727l1.515 6.06a1 1 0 0 1-.727 1.213l-1.09.272a2 2 0 0 1-2.425-1.455z`,key:`m7xp4m`}],[`path`,{d:`m6.158 8.633 1.114 4.456`,key:`74o979`}],[`path`,{d:`m8 21 3.105-6.21`,key:`1fvxut`}],[`circle`,{cx:`12`,cy:`13`,r:`2`,key:`1c1ljs`}]]),sb=Sl(`text-align-center`,[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M17 12H7`,key:`16if0g`}],[`path`,{d:`M19 19H5`,key:`vjpgq2`}]]),cb=Sl(`text-align-end`,[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M21 19H7`,key:`4cu937`}]]),lb=Sl(`text-align-start`,[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M17 19H3`,key:`z6ezky`}]]),ub=Sl(`text-quote`,[[`path`,{d:`M17 5H3`,key:`1cn7zz`}],[`path`,{d:`M21 12H8`,key:`scolzb`}],[`path`,{d:`M21 19H8`,key:`13qgcb`}],[`path`,{d:`M3 12v7`,key:`1ri8j3`}]]),db=Sl(`thumbs-down`,[[`path`,{d:`M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z`,key:`m61m77`}],[`path`,{d:`M17 14V2`,key:`8ymqnk`}]]),fb=Sl(`thumbs-up`,[[`path`,{d:`M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z`,key:`emmmcr`}],[`path`,{d:`M7 10v12`,key:`1qc93n`}]]),pb=Sl(`turtle`,[[`path`,{d:`m12 10 2 4v3a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-3a8 8 0 1 0-16 0v3a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-3l2-4h4Z`,key:`1lbbv7`}],[`path`,{d:`M4.82 7.9 8 10`,key:`m9wose`}],[`path`,{d:`M15.18 7.9 12 10`,key:`p8dp2u`}],[`path`,{d:`M16.93 10H20a2 2 0 0 1 0 4H2`,key:`12nsm7`}]]),mb=Sl(`underline`,[[`path`,{d:`M6 4v6a6 6 0 0 0 12 0V4`,key:`9kb039`}],[`line`,{x1:`4`,x2:`20`,y1:`20`,y2:`20`,key:`nun2al`}]]),hb=Sl(`unfold-vertical`,[[`path`,{d:`M12 22v-6`,key:`6o8u61`}],[`path`,{d:`M12 8V2`,key:`1wkif3`}],[`path`,{d:`M4 12H2`,key:`rhcxmi`}],[`path`,{d:`M10 12H8`,key:`s88cx1`}],[`path`,{d:`M16 12h-2`,key:`10asgb`}],[`path`,{d:`M22 12h-2`,key:`14jgyd`}],[`path`,{d:`m15 19-3 3-3-3`,key:`11eu04`}],[`path`,{d:`m15 5-3-3-3 3`,key:`itvq4r`}]]),gb=Sl(`user`,[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]),_b=Sl(`whole-word`,[[`circle`,{cx:`7`,cy:`12`,r:`3`,key:`12clwm`}],[`path`,{d:`M10 9v6`,key:`17i7lo`}],[`circle`,{cx:`17`,cy:`12`,r:`3`,key:`gl7c2s`}],[`path`,{d:`M14 7v8`,key:`dl84cr`}],[`path`,{d:`M22 17v1c0 .5-.5 1-1 1H3c-.5 0-1-.5-1-1v-1`,key:`lt2kga`}]]);function vb(e){return wf(e.map(Tf),``)}function yb(){let e=(0,$.c)(9),t=xl(),n=di(),r=pi(),i=fi(),a;if(e[0]!==i||e[1]!==n||e[2]!==r){let t;e[4]===n?t=e[5]:(t=e=>gi(n,e.source,e.id,!0,e.supported),e[4]=n,e[5]=t),a=mi(r.filter(t),i),e[0]=i,e[1]=n,e[2]=r,e[3]=a}else a=e[3];let o=a,s;return e[6]!==o||e[7]!==t?(s=async e=>{let n=e.map(xb);if(n.length===0)return!1;let r=il({docName:null,workspace:t,instruction:vb(n),mentions:[...new Set(n.map(bb))]});return r===null?(Us.error(ic._({id:`3V94ia`})),!1):o===null?(Us.info(ic._({id:`8YymuQ`})),Xs(),!1):(Jc(r,{agent:{source:o.source,id:o.id}}),!0)},e[6]=o,e[7]=t,e[8]=s):s=e[8],s}function bb(e){return bl(e.docName)}function xb(e){return e.payload}function Sb(){let e=(0,$.c)(3),t=yb(),n=Sc(),r=n?.kind===`thread`?n:null,i;return e[0]!==t||e[1]!==r?(i=e=>{if(r===null){Nt({compose:t,threadIds:e});return}Uc(e)},e[0]=t,e[1]=r,e[2]=i):i=e[2],i}var Cb=null;function wb(e){Cb=e}function Tb(){return Cb}function Eb(){let e=(0,$.c)(3),t=Sb(),n,r;return e[0]===t?(n=e[1],r=e[2]):(n=()=>{let e=function(e){if(!rc(e,`send-comment-queue`)||pr())return;let n=Tb();if(n===null)return;let r=n.scope===`doc`?We(n.docName):ht();r.length!==0&&(e.preventDefault(),t(r))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},r=[t],e[0]=t,e[1]=n,e[2]=r),(0,Q.useEffect)(n,r),null}function Db(e){return e.split(`/`).pop()??e}function Ob(e){let t=(0,$.c)(7),{rowCount:n}=e,{_:r}=xn(),i;t[0]===r?i=t[1]:(i=r({id:`--T3kB`}),t[0]=r,t[1]=i);let a;t[2]===n?a=t[3]:(a=(0,Z.jsx)(`ul`,{className:`space-y-2`,children:Array.from({length:n},Ab).map(kb)}),t[2]=n,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,Z.jsx)(`section`,{role:`status`,"aria-busy":`true`,"aria-label":i,children:a}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function kb(e){return(0,Z.jsxs)(`li`,{"aria-hidden":`true`,className:`flex items-center gap-3`,children:[(0,Z.jsx)(`div`,{className:`size-8 shrink-0 animate-pulse rounded-lg bg-muted`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 py-0.5`,children:[(0,Z.jsx)(`span`,{className:`block h-3.5 w-28 animate-pulse rounded bg-muted`}),(0,Z.jsx)(`span`,{className:`mt-2 block h-3 w-4/5 animate-pulse rounded bg-muted`})]})]},`seed-skeleton-${e}`)}function Ab(e,t){return t}function jb(e,t){let n=[];for(let r of t?.folders??[]){let t=`${r.path}/.ok/templates/`,i=e.created.filter(e=>e.kind===`file`&&(e.path.startsWith(t)||e.path.includes(`/${t}`))).map(e=>Db(e.path)),a=i.length,o=e.created.some(e=>e.kind===`folder`&&(e.path===r.path||e.path.endsWith(`/${r.path}`)));(a>0||o)&&n.push({path:r.path,summary:r.summary,templateCount:a,templates:i})}return n}function Mb(e){return e.created.filter(e=>e.kind===`file`&&!e.path.split(`/`).includes(`.ok`)).map(e=>({path:e.path,name:Db(e.path)}))}function Nb(e){let t=(0,$.c)(17),{plan:n,selectedPack:r}=e,{_:i}=xn(),a,o,s,c;if(t[0]!==i||t[1]!==n||t[2]!==r){let e=jb(n,r),l=Mb(n),u=(n.packSkills??[]).filter(Hb),d=(n.requiredPlugins??[]).filter(Vb),f=e.length,p=l.length,m=e.reduce(Bb,0),h=u.length,g=d.length,_={"log.md":i({id:`EoaQyO`}),"USER.md":i({id:`bV6DJA`}),"SOUL.md":i({id:`Waiy-j`}),"ACCESS_POLICY.md":i({id:`6ZhdPI`}),"HEARTBEAT.md":i({id:`MDZSJe`}),"OVERVIEW.md":i({id:`dMsx3p`}),"welcome.md":i({id:`WWcqsG`}),"index.md":i({id:`uFQbYd`})},v=[f>0?{key:`folders`,n:f,label:i({id:`VsaI0G`,values:{folderCount:f}})}:null,p>0?{key:`files`,n:p,label:i({id:`DgcGrb`,values:{fileCount:p}})}:null,m>0?{key:`templates`,n:m,label:i({id:`ba3vIW`,values:{templateCount:m}})}:null,h>0?{key:`skills`,n:h,label:i({id:`HAvRAI`,values:{skillCount:h}})}:null,g>0?{key:`plugins`,n:g,label:i({id:`llXHHh`,values:{pluginCount:g}})}:null].filter(zb),y=e.map(e=>({key:`folder:${e.path}`,icon:Qd,name:`${Db(e.path)}/`,pill:e.templateCount>0?i({id:`-5jISU`,values:{0:e.templateCount}}):void 0,pillTooltip:e.templateCount>0?e.templates:void 0,description:e.summary||void 0})),b=l.map(e=>({key:`file:${e.path}`,icon:Fe,name:e.name,title:e.name,description:_[e.name]})),x=u.map(e=>({key:`skill:${e.name}`,icon:af,name:vp(e.name),title:e.name,description:i({id:`FEqWFL`})})),S={okf:i({id:`uK2peg`})},C=d.map(e=>({key:`plugin:${e.id}`,icon:Wy,name:Pu.find(t=>t.id===e.id)?.label??e.id,title:e.id,description:S[e.id]??i({id:`1ZXkqM`})})),w=[{key:`folders`,label:i({id:`pcqlQu`,values:{0:y.length}}),rows:y},{key:`files`,label:i({id:`ZgGuA4`,values:{0:b.length}}),rows:b},{key:`skill`,label:i({id:`yK1m_z`,values:{0:x.length}}),rows:x},{key:`plugin`,label:i({id:`7wogIQ`,values:{0:C.length}}),rows:C}].filter(Rb);s=`space-y-5`;let T;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(`h3`,{className:`flex items-center gap-1.5 text-xs font-medium uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`xSVO3J`})}),t[7]=T):T=t[7];let E=v.length>0?(0,Z.jsx)(`div`,{className:`flex flex-wrap items-baseline gap-x-2 gap-y-0.5 text-xs`,children:v.map(Lb)}):null;t[8]===E?c=t[9]:(c=(0,Z.jsxs)(`div`,{className:`flex flex-wrap justify-between items-baseline gap-x-2 gap-y-0.5`,children:[T,E]}),t[8]=E,t[9]=c),a=`space-y-5`,o=w.map(Pb),t[0]=i,t[1]=n,t[2]=r,t[3]=a,t[4]=o,t[5]=s,t[6]=c}else a=t[3],o=t[4],s=t[5],c=t[6];let l;t[10]!==a||t[11]!==o?(l=(0,Z.jsx)(`div`,{className:a,children:o}),t[10]=a,t[11]=o,t[12]=l):l=t[12];let u;return t[13]!==s||t[14]!==c||t[15]!==l?(u=(0,Z.jsxs)(`section`,{className:s,children:[c,l]}),t[13]=s,t[14]=c,t[15]=l,t[16]=u):u=t[16],u}function Pb(e){return(0,Z.jsxs)(`div`,{className:`space-y-2.5`,children:[(0,Z.jsxs)(`h4`,{className:`flex items-baseline gap-2 text-xs font-medium uppercase font-mono tracking-wider text-muted-foreground`,children:[(0,Z.jsx)(`span`,{children:e.label}),(0,Z.jsx)(`span`,{className:`text-muted-foreground/50`,children:e.rows.length})]}),(0,Z.jsx)(`ul`,{className:`space-y-4`,children:e.rows.map(Fb)})]},e.key)}function Fb(e){let t=e.icon;return(0,Z.jsxs)(`li`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(`div`,{"aria-hidden":`true`,className:`flex size-8 shrink-0 items-center justify-center rounded-lg border border-border/60`,children:(0,Z.jsx)(t,{className:`size-4 text-muted-foreground`})}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 py-0.5`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`code`,{className:`min-w-0 flex-1 truncate font-mono text-1sm text-foreground/90`,title:e.title,children:e.name}),e.pill?e.pillTooltip&&e.pillTooltip.length>0?(0,Z.jsxs)(br,{children:[(0,Z.jsx)(_r,{className:`shrink-0 cursor-help rounded bg-transparent p-0 font-mono text-2xs uppercase tracking-wide text-muted-foreground transition-colors hover:text-foreground/70 focus-visible:text-foreground/70 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,children:e.pill}),(0,Z.jsx)(vr,{children:(0,Z.jsx)(`ul`,{className:`space-y-0.5 text-left font-mono`,children:e.pillTooltip.map(Ib)})})]}):(0,Z.jsx)(`span`,{className:`shrink-0 font-mono text-2xs uppercase tracking-wide text-muted-foreground`,children:e.pill}):null]}),e.description?(0,Z.jsx)(`p`,{className:`mt-0.5 text-xs leading-relaxed text-muted-foreground`,children:e.description}):null]})]},e.key)}function Ib(e){return(0,Z.jsx)(`li`,{children:e},e)}function Lb(e,t){return(0,Z.jsxs)(Q.Fragment,{children:[t>0?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`text-muted-foreground/50`,children:`·`}):null,(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`text-foreground/80`,children:e.n}),` `,(0,Z.jsx)(`span`,{className:`text-muted-foreground/80`,children:e.label})]})]},e.key)}function Rb(e){return e.rows.length>0}function zb(e){return e!==null}function Bb(e,t){return e+t.templateCount}function Vb(e){return e.pending}function Hb(e){return e.pending}async function Ub(e){let t=await e.json().catch(()=>null),n=go.safeParse(t);if(!n.success)return{kind:`internal`,message:`HTTP ${e.status}`};let r=n.data.detail??n.data.title,i=n.data.type;return i===`urn:ok:error:seed-prerequisite-missing`?{kind:`prerequisite-missing`,message:r}:i===`urn:ok:error:seed-invalid-root`?{kind:`invalid-root`,message:r}:i===`urn:ok:error:no-project-dir`?{kind:`no-project`,message:r}:{kind:`internal`,message:r}}function Wb(){let e=typeof window<`u`?window.okDesktop:void 0;if(e?.seed){let t=e.seed.apply;return{plan:e.seed.plan,apply:async(e,n)=>{let r=await t(e,n);return r.ok&&dc(),r},listPacks:e.seed.listPacks}}return{plan:async e=>{let t=new URLSearchParams;e?.rootDir&&t.set(`rootDir`,e.rootDir),e?.packId&&t.set(`packId`,e.packId);let n=t.toString(),r=await fetch(`/api/seed/plan${n?`?${n}`:``}`);if(!r.ok)return{ok:!1,error:await Ub(r)};let i=await r.json().catch(()=>null);return i?.plan?{ok:!0,plan:i.plan}:{ok:!1,error:{kind:`internal`,message:ic._({id:`5YWCV_`})}}},apply:async(e,t)=>{let n=await fetch(`/api/seed/apply`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({plan:e,packId:t?.packId})});if(!n.ok)return{ok:!1,error:await Ub(n)};let r=await n.json().catch(()=>null);return r?.result?(dc(),{ok:!0,result:r.result}):{ok:!1,error:{kind:`internal`,message:ic._({id:`aXkLuE`})}}},listPacks:async()=>{let e=await fetch(`/api/seed/packs`);if(!e.ok)return{ok:!1,error:{kind:`internal`,message:`HTTP ${e.status}`}};let t=await e.json().catch(()=>null);return!t||!Array.isArray(t.packs)?{ok:!1,error:{kind:`internal`,message:ic._({id:`q-QUC7`})}}:{ok:!0,packs:t.packs}}}}var Gb={"knowledge-base":jy,"software-lifecycle":Cl,"codebase-wiki":sy,"plain-notes":nb,worldbuilding:py,"writing-pipeline":Vy,"entity-vault":Ry,okf:vy};function Kb(e){return Gb[e]??jy}function qb(e){let t=(0,$.c)(69),{onPackSelect:n,onCreateBlankFile:r,collapsedPackIds:i,className:a,packs:o}=e,{_:s}=xn(),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)(!1),m=o===void 0,h,g;t[0]===m?(h=t[1],g=t[2]):(h=()=>{if(!m)return;let e=!1;return(async()=>{try{let t=await Wb().listPacks();if(e)return;t.ok?l(t.packs):d(t.error.message)}catch(t){let n=t;if(e)return;d(n instanceof Error?n.message:String(n))}})(),()=>{e=!0}},g=[m],t[0]=m,t[1]=h,t[2]=g),(0,Q.useEffect)(h,g);let _=m?c:o;if(u!==null){let e;t[3]===a?e=t[4]:(e=Qn(`rounded-md bg-destructive/10 p-4 text-sm text-destructive`,a),t[3]=a,t[4]=e);let n;t[5]===u?n=t[6]:(n=(0,Z.jsx)(Y,{id:`56WWtu`,values:{error:u}}),t[5]=u,t[6]=n);let r;return t[7]!==e||t[8]!==n?(r=(0,Z.jsx)(`div`,{role:`alert`,className:e,children:n}),t[7]=e,t[8]=n,t[9]=r):r=t[9],r}if(_===null){let e;t[10]===a?e=t[11]:(e=Qn(`@container/packgrid w-full max-w-5xl`,a),t[10]=a,t[11]=e);let n;t[12]===s?n=t[13]:(n=s({id:`BeWTQy`}),t[12]=s,t[13]=n);let r;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(`div`,{className:`grid gap-4 @sm/packgrid:grid-cols-2 @2xl/packgrid:grid-cols-3`,children:Array.from({length:Object.keys(Gb).length},Yb).map(Jb)}),t[14]=r):r=t[14];let i;return t[15]!==e||t[16]!==n||t[17]!==r?(i=(0,Z.jsx)(`div`,{role:`status`,className:e,"aria-busy":`true`,"aria-label":n,children:r}),t[15]=e,t[16]=n,t[17]=r,t[18]=i):i=t[18],i}if(_.length===0){let e;t[19]===a?e=t[20]:(e=Qn(`flex w-full max-w-5xl items-center justify-center rounded-2xl border border-dashed border-border/60 bg-muted/20 p-8 text-sm text-muted-foreground`,a),t[19]=a,t[20]=e);let n;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(Y,{id:`zLGXna`}),t[21]=n):n=t[21];let r;return t[22]===e?r=t[23]:(r=(0,Z.jsx)(`div`,{role:`status`,className:e,children:n}),t[22]=e,t[23]=r),r}let v;t[24]===i?v=t[25]:(v=i??[],t[24]=i,t[25]=v);let y;t[26]===v?y=t[27]:(y=new Set(v),t[26]=v,t[27]=y);let b=y,x,S,C,w,T,E,D,O,k;if(t[28]!==a||t[29]!==b||t[30]!==f||t[31]!==r||t[32]!==n||t[33]!==_){let e;t[43]===b?e=t[44]:(e=e=>!b.has(e.id),t[43]=b,t[44]=e);let i=_.filter(e),o;t[45]===b?o=t[46]:(o=e=>b.has(e.id),t[45]=b,t[46]=o),C=_.filter(o),S=C.length>0,w=S||r!=null,t[47]===a?k=t[48]:(k=Qn(`@container/packgrid w-full max-w-5xl`,a),t[47]=a,t[48]=k),x=Cr,T=f,E=p;let s;t[49]===n?s=t[50]:(s=e=>(0,Z.jsx)(Xb,{pack:e,onSelect:()=>n(e.id)},e.id),t[49]=n,t[50]=s);let c=i.map(s);t[51]===c?D=t[52]:(D=(0,Z.jsx)(`div`,{className:`grid gap-4 @sm/packgrid:grid-cols-2 @2xl/packgrid:grid-cols-3`,children:c}),t[51]=c,t[52]=D),O=S?(0,Z.jsx)(xr,{className:`-mx-1 -mb-1 overflow-hidden px-1 pb-1 data-[state=open]:animate-[collapsible-down_150ms_ease-out] data-[state=closed]:animate-[collapsible-up_150ms_ease-in]`,children:(0,Z.jsx)(`div`,{className:Qn(`grid gap-4 @sm/packgrid:grid-cols-2 @2xl/packgrid:grid-cols-3`,`pt-4`),children:C.map(e=>(0,Z.jsx)(Xb,{pack:e,onSelect:()=>n(e.id)},e.id))})}):null,t[28]=a,t[29]=b,t[30]=f,t[31]=r,t[32]=n,t[33]=_,t[34]=x,t[35]=S,t[36]=C,t[37]=w,t[38]=T,t[39]=E,t[40]=D,t[41]=O,t[42]=k}else x=t[34],S=t[35],C=t[36],w=t[37],T=t[38],E=t[39],D=t[40],O=t[41],k=t[42];let A;t[53]!==f||t[54]!==S||t[55]!==C||t[56]!==r||t[57]!==w?(A=w?(0,Z.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center justify-between gap-2`,children:[S?(0,Z.jsx)(Sr,{asChild:!0,children:(0,Z.jsxs)(X,{type:`button`,variant:`link-muted`,size:`sm`,children:[f?(0,Z.jsx)(Y,{id:`6lGV3K`}):(0,Z.jsx)(Y,{id:`ymWJLd`,values:{0:C.length}}),(0,Z.jsx)(Zl,{"aria-hidden":`true`,className:Qn(`size-3.5 transition-transform`,f&&`rotate-180`)})]})}):(0,Z.jsx)(`span`,{}),r?(0,Z.jsx)(X,{type:`button`,variant:`link-muted`,size:`sm`,onClick:r,children:(0,Z.jsx)(Y,{id:`L4Cdd9`,components:{0:(0,Z.jsx)(Nl,{"aria-hidden":`true`,className:`size-3.5`})}})}):null]}):null,t[53]=f,t[54]=S,t[55]=C,t[56]=r,t[57]=w,t[58]=A):A=t[58];let j;t[59]!==x||t[60]!==A||t[61]!==T||t[62]!==E||t[63]!==D||t[64]!==O?(j=(0,Z.jsxs)(x,{open:T,onOpenChange:E,children:[D,O,A]}),t[59]=x,t[60]=A,t[61]=T,t[62]=E,t[63]=D,t[64]=O,t[65]=j):j=t[65];let M;return t[66]!==j||t[67]!==k?(M=(0,Z.jsx)(`div`,{className:k,children:j}),t[66]=j,t[67]=k,t[68]=M):M=t[68],M}function Jb(e){return(0,Z.jsx)(Qb,{},`skeleton-${e}`)}function Yb(e,t){return t}function Xb(e){let t=(0,$.c)(35),{pack:n,onSelect:r}=e,i;t[0]===n.id?i=t[1]:(i=Kb(n.id),t[0]=n.id,t[1]=i);let a=i,o;t[2]===a?o=t[3]:(o=(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`mt-0.5 shrink-0 text-muted-foreground`,children:(0,Z.jsx)(a,{className:`size-3.5`})}),t[2]=a,t[3]=o);let s;t[4]===n.name?s=t[5]:(s=(0,Z.jsx)(`h3`,{className:`min-w-0 wrap-break-word text-sm font-medium leading-tight`,children:n.name}),t[4]=n.name,t[5]=s);let c;t[6]!==o||t[7]!==s?(c=(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-row items-start gap-2`,children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8];let l;t[9]===n.description?l=t[10]:(l=(0,Z.jsx)(`p`,{className:`line-clamp-2 text-1sm leading-relaxed text-muted-foreground`,children:n.description}),t[9]=n.description,t[10]=l);let u;t[11]===n.entryCounts.files?u=t[12]:(u=(0,Z.jsx)(Y,{id:`jlT89F`,values:{0:n.entryCounts.files}}),t[11]=n.entryCounts.files,t[12]=u);let d;t[13]===n.entryCounts.folders?d=t[14]:(d=(0,Z.jsx)(Y,{id:`Ftz_t9`,values:{0:n.entryCounts.folders}}),t[13]=n.entryCounts.folders,t[14]=d);let f;t[15]!==u||t[16]!==d?(f=(0,Z.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[u,` · `,d]}),t[15]=u,t[16]=d,t[17]=f):f=t[17];let p;t[18]!==c||t[19]!==l||t[20]!==f?(p=(0,Z.jsxs)(`div`,{className:`flex w-full min-w-0 flex-col gap-2`,children:[c,l,f]}),t[18]=c,t[19]=l,t[20]=f,t[21]=p):p=t[21];let m;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsxs)(`span`,{className:`mt-auto inline-flex items-center gap-1 text-xs text-muted-foreground transition-colors group-hover:text-foreground`,children:[(0,Z.jsx)(Y,{id:`UIjjFa`}),(0,Z.jsx)(Nl,{"aria-hidden":`true`,className:`size-3.5`})]}),t[22]=m):m=t[22];let h;t[23]!==r||t[24]!==p?(h=(0,Z.jsxs)(`button`,{type:`button`,onClick:r,className:`group flex h-full min-w-0 flex-col items-start gap-4 rounded-2xl border border-border/60 bg-card p-5 text-left transition-[border-color,box-shadow,transform] hover:border-border hover:shadow-sm focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50 active:translate-y-px`,children:[p,m]}),t[23]=r,t[24]=p,t[25]=h):h=t[25];let g=h;if(n.folders.length===0)return g;let _;t[26]===g?_=t[27]:(_=(0,Z.jsx)(_r,{asChild:!0,children:g}),t[26]=g,t[27]=_);let v;t[28]===n.folders?v=t[29]:(v=n.folders.map(Zb),t[28]=n.folders,t[29]=v);let y;t[30]===v?y=t[31]:(y=(0,Z.jsx)(vr,{className:`flex-col items-start gap-1.5`,children:(0,Z.jsx)(`ul`,{className:`flex flex-col gap-1.5 text-left`,children:v})}),t[30]=v,t[31]=y);let b;return t[32]!==_||t[33]!==y?(b=(0,Z.jsxs)(br,{children:[_,y]}),t[32]=_,t[33]=y,t[34]=b):b=t[34],b}function Zb(e){return(0,Z.jsxs)(`li`,{className:`flex flex-col`,children:[(0,Z.jsx)(`span`,{className:`font-mono`,children:e.path}),(0,Z.jsx)(`span`,{className:`opacity-75`,children:e.summary})]},e.path)}function Qb(){let e=(0,$.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`span`,{className:`size-10 animate-pulse rounded-lg bg-muted`,"aria-hidden":`true`,children:(0,Z.jsx)(cf,{"aria-hidden":`true`,className:`size-5 text-muted-foreground opacity-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 h-full min-h-[200px] flex-col items-start gap-4 rounded-xl border border-border/60 bg-card p-6`,children:[t,(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-2`,children:[(0,Z.jsx)(`div`,{className:`h-4 w-1/2 animate-pulse rounded bg-muted`}),(0,Z.jsx)(`div`,{className:`h-3 w-full animate-pulse rounded bg-muted`}),(0,Z.jsx)(`div`,{className:`h-3 w-4/5 animate-pulse rounded bg-muted`})]}),(0,Z.jsx)(`div`,{className:`mt-auto h-3 w-20 animate-pulse rounded bg-muted`})]}),e[1]=n):n=e[1],n}function $b(e){let t=(0,$.c)(39),{choice:n,subfolder:r,placeholder:i,idPrefix:a,onChoiceChange:o,onSubfolderChange:s}=e,c=a===void 0?`seed-root`:a,{_:l}=xn(),u=`${c}-project-root`,d=`${c}-subfolder`,f=`${c}-group-label`,p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(Y,{id:`3wiBAs`}),t[0]=p):p=t[0];let m;t[1]===f?m=t[2]:(m=(0,Z.jsx)(`p`,{id:f,className:`text-sm font-medium`,children:p}),t[1]=f,t[2]=m);let h;t[3]===o?h=t[4]:(h=e=>o(e),t[3]=o,t[4]=h);let g;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(Ep,{children:(0,Z.jsx)(Y,{id:`RSqaSd`})}),t[5]=g):g=t[5];let _;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsxs)(Cp,{children:[g,(0,Z.jsx)(Tp,{className:`text-1sm`,children:(0,Z.jsx)(Y,{id:`ZvzbDF`})})]}),t[6]=_):_=t[6];let v;t[7]===u?v=t[8]:(v=(0,Z.jsxs)(Dp,{orientation:`horizontal`,children:[_,(0,Z.jsx)(sa,{value:`project-root`,id:u})]}),t[7]=u,t[8]=v);let y;t[9]!==u||t[10]!==v?(y=(0,Z.jsx)(wp,{htmlFor:u,children:v}),t[9]=u,t[10]=v,t[11]=y):y=t[11];let b;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(Ep,{children:(0,Z.jsx)(Y,{id:`ZWgr0b`})}),t[12]=b):b=t[12];let x;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(Tp,{className:`nth-last-2:mt-0 text-1sm`,children:(0,Z.jsx)(Y,{id:`KQGZuq`})}),t[13]=x):x=t[13];let S;t[14]!==l||t[15]!==n||t[16]!==s||t[17]!==i||t[18]!==r?(S=n===`subfolder`&&(0,Z.jsx)(Op,{value:r,onChange:e=>s(e.target.value),placeholder:i,"aria-label":l({id:`NYUhy5`}),spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,className:`mt-1.5 font-mono text-xs bg-background`}),t[14]=l,t[15]=n,t[16]=s,t[17]=i,t[18]=r,t[19]=S):S=t[19];let C;t[20]===S?C=t[21]:(C=(0,Z.jsxs)(Cp,{children:[b,x,S]}),t[20]=S,t[21]=C);let w;t[22]===d?w=t[23]:(w=(0,Z.jsx)(sa,{value:`subfolder`,id:d}),t[22]=d,t[23]=w);let T;t[24]!==C||t[25]!==w?(T=(0,Z.jsxs)(Dp,{orientation:`horizontal`,children:[C,w]}),t[24]=C,t[25]=w,t[26]=T):T=t[26];let E;t[27]!==d||t[28]!==T?(E=(0,Z.jsx)(wp,{htmlFor:d,children:T}),t[27]=d,t[28]=T,t[29]=E):E=t[29];let D;t[30]!==n||t[31]!==f||t[32]!==E||t[33]!==h||t[34]!==y?(D=(0,Z.jsxs)(ca,{"aria-labelledby":f,className:`sm:flex`,value:n,onValueChange:h,children:[y,E]}),t[30]=n,t[31]=f,t[32]=E,t[33]=h,t[34]=y,t[35]=D):D=t[35];let O;return t[36]!==D||t[37]!==m?(O=(0,Z.jsxs)(`div`,{className:`space-y-2 py-1`,children:[m,D]}),t[36]=D,t[37]=m,t[38]=O):O=t[38],O}var ex={"knowledge-base":{id:`gvApb7`},"software-lifecycle":{id:`hCOLSd`},"codebase-wiki":{id:`Fy4GgU`},"plain-notes":{id:`Qw-7Ie`},okf:{id:`_ayOfA`},"writing-pipeline":{id:`Zf0w-R`},"entity-vault":{id:`hmYd9H`},worldbuilding:{id:`VBE2dw`}},tx=180,nx=5e3,rx=200;function ix(e,t){if(e===``||t===``)return``;let n=e.includes(`\\`)&&!e.includes(`/`)?`\\`:`/`;return`${e.replace(/[/\\]+$/,``)}${n}${t}`}function ax(e){if(e===``)return``;let t=e.split(/[/\\]/).filter(Boolean);return t.length>0?t[t.length-1]??e:e}function ox(e){let{parent:t,sanitizedName:n,enclosingProject:r,enclosingGit:i,targetState:a}=e;return t===``||n===``?{kind:`idle`}:r===null?i===null?a===`exists-nonempty`?{kind:`block-nonempty`}:{kind:`free`}:{kind:`confirm-git`,gitRoot:i.gitRoot}:{kind:`block-nested`,rootPath:r.rootPath}}function sx(e){let t=e instanceof Error?e.message:String(e);for(let e of Os)if(t.startsWith(`${e}:`)||t.includes(`${e}: `))return e===`nested-project`||e===`target-not-empty`?{reason:e}:{reason:e,message:t};return{reason:`unknown`,message:t}}function cx(e){switch(e.reason){case`nested-project`:return{id:`ScwcF2`};case`target-not-empty`:return{id:`e8L17t`};case`invalid-args`:return{id:`6bTTAN`};case`mkdir-failed`:return{id:`gJR87V`};case`git-init-failed`:return{id:`4CfgPM`};case`init-failed`:return{id:`l17ab4`};case`discovery-failed`:return{id:`ThmUrC`};case`unknown`:return{id:`AddR83`}}}function lx(e){let t=(0,$.c)(191),{open:n,onOpenChange:r,bridge:i,initialPackId:a,packs:o}=e,{_:s}=xn(),c=(0,Q.useId)(),l=(0,Q.useId)(),u=(0,Q.useId)(),d=(0,Q.useId)(),[f,p]=(0,Q.useState)(``),[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(``),[v,y]=(0,Q.useState)(null),[b,x]=(0,Q.useState)(!0),[S,C]=(0,Q.useState)(!1),[w,T]=(0,Q.useState)(`shared`),[E,D]=(0,Q.useState)(!1),[O,k]=(0,Q.useState)(a),[A,j]=(0,Q.useState)(`configure`),[M,N]=(0,Q.useState)(`project-root`),[P,F]=(0,Q.useState)(``),I;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(I={kind:`loading`},t[0]=I):I=t[0];let[L,R]=(0,Q.useState)(I),z;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(z={kind:`idle`},t[1]=z):z=t[1];let[B,V]=(0,Q.useState)(z),[H,U]=(0,Q.useState)(`idle`),[ee,W]=(0,Q.useState)(!1),[te,G]=(0,Q.useState)(null),K;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(K={kind:`idle`},t[2]=K):K=t[2];let[q,ne]=(0,Q.useState)(K),[re,J]=(0,Q.useState)(0),ie;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(ie=new Set,t[3]=ie):ie=t[3];let ae=(0,Q.useRef)(ie),oe=(0,Q.useRef)(null),se=(0,Q.useRef)(null),ce=(0,Q.useRef)(null),le=(0,Q.useRef)(0),ue=(0,Q.useRef)(!0),de,fe;t[4]!==i||t[5]!==a||t[6]!==n?(de=()=>{if(!n)return;ae.current.clear(),G(null),V({kind:`idle`}),U(`idle`),W(!1),_(``),y(null),x(!0),C(!1),T(`shared`),D(!1),ne({kind:`idle`}),k(a),j(`configure`),N(`project-root`),R({kind:`loading`}),ue.current=!0,le.current+=1;let e=!1;i.integrations.status().then(t=>{if(e)return;let n=new Set(t.editors.filter(vx).map(_x));y(t.detectedEditorIds.filter(e=>Ra(e,{userMcpEntryInstalled:n.has(e)})))}).catch(t=>{console.warn(`[CreateProjectDialog] editor-detection probe failed:`,t),e||y([])}),p(``),h(!0),i.fs.defaultProjectsRoot().then(t=>{e||p(t)}).catch(gx).finally(()=>{e||h(!1)});let t=requestAnimationFrame(()=>{ce.current?.focus()});return()=>{e=!0,cancelAnimationFrame(t)}},fe=[n,i,a],t[4]=i,t[5]=a,t[6]=n,t[7]=de,t[8]=fe):(de=t[7],fe=t[8]),(0,Q.useEffect)(de,fe);let pe;t[9]!==O||t[10]!==o?(pe=o?.find(e=>e.id===O),t[9]=O,t[10]=o,t[11]=pe):pe=t[11];let me=pe,he=me?.defaultSubfolder??``,ge;t[12]!==O||t[13]!==he?(ge=()=>{O!==void 0&&F(he)},t[12]=O,t[13]=he,t[14]=ge):ge=t[14];let _e;t[15]!==n||t[16]!==O||t[17]!==he?(_e=[n,O,he],t[15]=n,t[16]=O,t[17]=he,t[18]=_e):_e=t[18],(0,Q.useEffect)(ge,_e);let ve;t[19]===P?ve=t[20]:(ve=P.trim(),t[19]=P,t[20]=ve);let ye=ve,be=me!==void 0&&M===`subfolder`&&ye===``,xe=M===`project-root`?void 0:ye,Se=b&&(v?.length??0)>0,Ce,we;t[21]!==s||t[22]!==n||t[23]!==xe||t[24]!==me||t[25]!==Se||t[26]!==A||t[27]!==be?(Ce=()=>{if(!n||me===void 0||A!==`configure`)return;if(be){R({kind:`error`,message:s({id:`Z8KDox`}),blocking:!0});return}let e=ue.current?0:rx;ue.current=!1;let t=!1,r=setTimeout(()=>{t||(R(hx),Wb().plan({rootDir:xe,packId:me.id,preview:{skillsInstallable:Se}}).then(e=>{if(t)return;if(e.ok){R({kind:`plan`,plan:e.plan});return}let n=e.error.kind===`invalid-root`;n||console.warn(`[CreateProjectDialog] pack preview unavailable:`,e.error),R({kind:`error`,message:n?e.error.message:s({id:`7vxWET`}),blocking:n})}).catch(e=>{t||(console.warn(`[CreateProjectDialog] pack preview plan failed:`,e),R({kind:`error`,message:s({id:`7vxWET`}),blocking:!1}))}))},e);return()=>{t=!0,clearTimeout(r)}},we=[n,A,me,xe,be,Se,s],t[21]=s,t[22]=n,t[23]=xe,t[24]=me,t[25]=Se,t[26]=A,t[27]=be,t[28]=Ce,t[29]=we):(Ce=t[28],we=t[29]),(0,Q.useEffect)(Ce,we);let Te;t[30]!==i||t[31]!==f||t[32]!==g||t[33]!==n?(Te=()=>{if(!n)return;se.current!==null&&clearTimeout(se.current),oe.current!==null&&oe.current.abort();let e=$a(g);if(f===``||e===``){V({kind:`idle`}),U(`idle`);return}let t=f,r=ix(t,e),a=new AbortController;return oe.current=a,se.current=setTimeout(()=>{U(`in-flight`),Promise.all([i.fs.findEnclosingProjectRoot(t),i.fs.findEnclosingGitRoot(t),i.fs.folderState(r)]).then(n=>{let[r,i,o]=n;a.signal.aborted||(U(`idle`),V(ox({parent:t,sanitizedName:e,enclosingProject:r,enclosingGit:i,targetState:o})))}).catch(e=>{a.signal.aborted||(console.warn(`[CreateProjectDialog] cascade probe failed:`,e),U(`idle`),V({kind:`free`}))})},tx),()=>{se.current!==null&&clearTimeout(se.current),a.abort()}},t[30]=i,t[31]=f,t[32]=g,t[33]=n,t[34]=Te):Te=t[34];let Ee;t[35]!==i||t[36]!==f||t[37]!==g||t[38]!==n||t[39]!==re?(Ee=[n,f,g,i,re],t[35]=i,t[36]=f,t[37]=g,t[38]=n,t[39]=re,t[40]=Ee):Ee=t[40],(0,Q.useEffect)(Te,Ee);let De,Oe;t[41]===n?(De=t[42],Oe=t[43]):(De=()=>{if(!n)return;let e=()=>J(mx);return window.addEventListener(`focus`,e),()=>window.removeEventListener(`focus`,e)},Oe=[n],t[41]=n,t[42]=De,t[43]=Oe),(0,Q.useEffect)(De,Oe);let ke=(0,Q.useRef)(`idle`),Ae,je;t[44]===H?(Ae=t[45],je=t[46]):(Ae=()=>{ke.current=H},je=[H],t[44]=H,t[45]=Ae,t[46]=je),(0,Q.useEffect)(Ae,je);let Me,Ne;t[47]!==B.kind||t[48]!==n?(Me=()=>{if(!n||B.kind!==`confirm-git`)return;let e=setInterval(()=>{ke.current!==`in-flight`&&J(px)},nx);return()=>clearInterval(e)},Ne=[n,B.kind],t[47]=B.kind,t[48]=n,t[49]=Me,t[50]=Ne):(Me=t[49],Ne=t[50]),(0,Q.useEffect)(Me,Ne);let Pe;t[51]!==B.gitRoot||t[52]!==B.kind||t[53]!==q.gitRoot||t[54]!==q.kind?(Pe=()=>{if(B.kind!==`confirm-git`){q.kind!==`idle`&&(le.current+=1,ne({kind:`idle`}));return}q.kind===`confirming`&&q.gitRoot!==B.gitRoot&&ne({kind:`idle`}),q.kind===`pending`&&q.gitRoot!==B.gitRoot&&(le.current+=1,ne({kind:`idle`}))},t[51]=B.gitRoot,t[52]=B.kind,t[53]=q.gitRoot,t[54]=q.kind,t[55]=Pe):Pe=t[55];let Fe;t[56]!==B||t[57]!==q?(Fe=[B,q],t[56]=B,t[57]=q,t[58]=Fe):Fe=t[58],(0,Q.useEffect)(Pe,Fe);let Ie;t[59]!==i||t[60]!==B.kind||t[61]!==n?(Ie=()=>{if(!n)return;let e=null;B.kind===`block-nested`?e=`nested`:B.kind===`block-nonempty`?e=`nonempty`:B.kind===`confirm-git`&&(e=`git-confirm`),e!==null&&(ae.current.has(e)||(ae.current.add(e),i.project.recordCreateNewBannerShown(e).catch(fx)))},t[59]=i,t[60]=B.kind,t[61]=n,t[62]=Ie):Ie=t[62];let Le;t[63]!==i||t[64]!==B||t[65]!==n?(Le=[n,B,i],t[63]=i,t[64]=B,t[65]=n,t[66]=Le):Le=t[66],(0,Q.useEffect)(Ie,Le);let Re=g,ze,Be,Ve,He,Ue;t[67]!==B.kind||t[68]!==f||t[69]!==Re?(He=Re===``?``:$a(Re),Be=Re!==``&&He!==Re&&He!==``,Ve=Re!==``&&He===``,ze=B.kind===`block-nonempty`,Ue=f!==``&&He!==``?ix(f,He):``,t[67]=B.kind,t[68]=f,t[69]=Re,t[70]=ze,t[71]=Be,t[72]=Ve,t[73]=He,t[74]=Ue):(ze=t[70],Be=t[71],Ve=t[72],He=t[73],Ue=t[74]);let We=Ue,Ge=!ee&&f!==``&&Re!==``&&He!==``&&!be&&(me===void 0||L.kind!==`error`||!L.blocking)&&H===`idle`&&(B.kind===`free`||B.kind===`confirm-git`),Ke=ee||b&&v===null||Re!==``&&!Ge,qe;t[75]!==i||t[76]!==f?(qe=async function(){try{let e=await i.dialog.openFolder(f===``?void 0:{defaultPath:f});if(e===null)return;p(e),J(dx),G(null)}catch(e){console.warn(`[CreateProjectDialog] dialog.openFolder failed:`,e)}},t[75]=i,t[76]=f,t[77]=qe):qe=t[77];let Je=qe,Ye;t[78]!==s||t[79]!==i||t[80]!==ee||t[81]!==Ge||t[82]!==b||t[83]!==v||t[84]!==f||t[85]!==r||t[86]!==O||t[87]!==xe||t[88]!==Re||t[89]!==He||t[90]!==w?(Ye=async function(e){if(e.preventDefault(),!ee){if(Re.trim()===``){Us.error(s({id:`5OqaJi`})),ce.current?.focus();return}if(Ge){W(!0),G(null);try{await i.project.createNew({parent:f,name:He,editors:b?[...v??[]]:[],sharing:w,packId:O,rootDir:xe}),r(!1)}catch(e){G(sx(e)),W(!1)}}}},t[78]=s,t[79]=i,t[80]=ee,t[81]=Ge,t[82]=b,t[83]=v,t[84]=f,t[85]=r,t[86]=O,t[87]=xe,t[88]=Re,t[89]=He,t[90]=w,t[91]=Ye):Ye=t[91];let Xe=Ye,Ze;t[92]!==ee||t[93]!==r?(Ze=function(e){ee||r(e)},t[92]=ee,t[93]=r,t[94]=Ze):Ze=t[94];let Qe=Ze,$e;t[95]===Symbol.for(`react.memo_cache_sentinel`)?($e=async function(e){ne({kind:`confirming`,gitRoot:e})},t[95]=$e):$e=t[95];let et=$e,tt;t[96]===Symbol.for(`react.memo_cache_sentinel`)?(tt=async function(){ne({kind:`idle`})},t[96]=tt):tt=t[96];let nt=tt,rt;t[97]===i?rt=t[98]:(rt=async function(e){let t=le.current+1;le.current=t,ne({kind:`pending`,gitRoot:e});try{if(await i.fs.removeGitFolder(e),le.current!==t)return;J(ux),ne({kind:`idle`})}catch(e){let n=e;if(le.current!==t)return;let r=n instanceof Error?n.message:String(n);console.error(`[CreateProjectDialog] bridge.fs.removeGitFolder failed:`,n),ne({kind:`error`,message:r})}},t[97]=i,t[98]=rt);let it=rt,at;t[99]!==i||t[100]!==r?(at=async function(e){r(!1);try{await i.project.open({path:e,target:`new-window`,entryPoint:`create-new-nested-redirect`})}catch(e){console.warn(`[CreateProjectDialog] project.open failed:`,e)}},t[99]=i,t[100]=r,t[101]=at):at=t[101];let ot=at,st=Ve||ze||Be?`${u} ${d}`:u,ct=O!==void 0&&(o?.length??0)>0,lt=me?.name,ut=me?ex[me.id]:void 0,dt;t[102]!==s||t[103]!==lt?(dt=s(lt===void 0?{id:`wbv9xO`}:{id:`MPpSAg`,values:{selectedPackName:lt}}),t[102]=s,t[103]=lt,t[104]=dt):dt=t[104];let ft=dt,pt;t[105]!==s||t[106]!==me||t[107]!==ut?(pt=me===void 0?s({id:`O6yEPk`}):ut?s(ut):me.description,t[105]=s,t[106]=me,t[107]=ut,t[108]=pt):pt=t[108];let mt=pt,ht=A===`pick`&&`sm:max-w-3xl`,gt;t[109]===ht?gt=t[110]:(gt=Qn(`sm:max-w-lg`,ht),t[109]=ht,t[110]=gt);let _t;t[111]!==s||t[112]!==A||t[113]!==ft?(_t=A===`pick`?s({id:`tcjTlU`}):ft,t[111]=s,t[112]=A,t[113]=ft,t[114]=_t):_t=t[114];let vt;t[115]===_t?vt=t[116]:(vt=(0,Z.jsx)(Pp,{children:_t}),t[115]=_t,t[116]=vt);let yt;t[117]!==s||t[118]!==mt||t[119]!==A?(yt=A===`pick`?s({id:`b6Fgpe`}):mt,t[117]=s,t[118]=mt,t[119]=A,t[120]=yt):yt=t[120];let bt;t[121]===yt?bt=t[122]:(bt=(0,Z.jsx)(Np,{children:yt}),t[121]=yt,t[122]=bt);let xt;t[123]!==vt||t[124]!==bt?(xt=(0,Z.jsxs)(zp,{children:[vt,bt]}),t[123]=vt,t[124]=bt,t[125]=xt):xt=t[125];let St;t[126]!==s||t[127]!==E||t[128]!==ee||t[129]!==u||t[130]!==B||t[131]!==b||t[132]!==v||t[133]!==c||t[134]!==f||t[135]!==m||t[136]!==g||t[137]!==st||t[138]!==d||t[139]!==l||t[140]!==ze||t[141]!==Je||t[142]!==it||t[143]!==ot||t[144]!==Xe||t[145]!==L||t[146]!==o||t[147]!==q||t[148]!==M||t[149]!==Be||t[150]!==Ve||t[151]!==He||t[152]!==me||t[153]!==w||t[154]!==S||t[155]!==A||t[156]!==P||t[157]!==te||t[158]!==We?(St=A===`pick`?(0,Z.jsx)(Ip,{children:(0,Z.jsx)(qb,{packs:o??null,onPackSelect:e=>{k(e),j(`configure`),ue.current=!0,R({kind:`loading`}),requestAnimationFrame(()=>ce.current?.focus())}})}):(0,Z.jsx)(Ip,{className:`space-y-6`,children:(0,Z.jsxs)(`form`,{id:c,onSubmit:Xe,"data-testid":`create-project-form`,className:`space-y-6`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(Ki,{htmlFor:l,children:(0,Z.jsx)(Y,{id:`OyIC0Q`})}),(0,Z.jsx)(Op,{id:l,ref:ce,value:g,placeholder:s({id:`cV7LOw`}),onChange:e=>_(e.target.value),disabled:ee,autoComplete:`off`,"aria-invalid":Ve||ze,"aria-describedby":st,"data-testid":`create-name`}),Ve?(0,Z.jsx)(`p`,{id:d,role:`alert`,className:`text-1sm text-destructive`,"data-testid":`create-name-error-erased`,children:(0,Z.jsx)(Y,{id:`_PBJRl`})}):ze?(0,Z.jsx)(`p`,{id:d,role:`alert`,className:`text-1sm text-destructive`,"data-testid":`create-name-error-taken`,children:(0,Z.jsx)(Y,{id:`7apDiJ`,values:{sanitized:He},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-all`})}})}):Be?(0,Z.jsx)(`p`,{id:d,role:`status`,"aria-live":`polite`,className:`text-1sm text-muted-foreground`,"data-testid":`create-name-hint-diverged`,children:(0,Z.jsx)(Y,{id:`KnoB--`,values:{sanitized:He},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-all`})}})}):null]}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(Ki,{children:(0,Z.jsx)(Y,{id:`wJijgU`})}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`div`,{className:`min-w-0 flex-1 rounded-md border border-input bg-muted/50 px-2.5 py-1 text-sm text-foreground wrap-break-word`,"data-testid":`create-location-display`,children:f===``?m?(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`iHAJDj`})}):(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`8m8diM`})}):f}),(0,Z.jsx)(X,{type:`button`,variant:`outline`,className:`shrink-0`,disabled:ee,onClick:()=>void Je(),"data-testid":`create-browse`,children:(0,Z.jsx)(Y,{id:`O2UpM1`})})]}),(0,Z.jsx)(`p`,{id:u,className:`text-1sm text-muted-foreground wrap-break-word`,"aria-live":`polite`,"data-testid":`create-target-caption`,children:We===``?null:(0,Z.jsx)(Y,{id:`k_yIIc`,values:{targetPreview:We},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-all`})}})})]}),(0,Z.jsx)(Sx,{cascade:B,onOpenNested:ot,removeGitState:q,onRequestRemoveGit:et,onCancelRemoveGit:nt,onConfirmRemoveGit:it}),me?(0,Z.jsxs)(`div`,{className:`space-y-6`,"data-testid":`create-pack-section`,children:[(0,Z.jsx)($b,{choice:M,subfolder:P,placeholder:me.defaultSubfolder??`subfolder`,idPrefix:`create-seed-root`,onChoiceChange:N,onSubfolderChange:F}),B.kind===`confirm-git`?(0,Z.jsx)(`p`,{className:`text-1sm text-muted-foreground`,"data-testid":`create-pack-promoted-note`,children:(0,Z.jsx)(Y,{id:`-ksoxk`,values:{sanitized:He},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-all`})}})}):null,L.kind===`error`?(0,Z.jsx)(`div`,{role:`alert`,className:`rounded-md bg-destructive/10 p-3 text-sm text-destructive`,"data-testid":`create-pack-preview-error`,children:L.message}):L.kind===`plan`?(0,Z.jsx)(Nb,{plan:L.plan,selectedPack:me}):(0,Z.jsx)(Ob,{rowCount:me.folders.length})]}):null,(0,Z.jsx)(yx,{detectedEditors:v,checked:b,onCheckedChange:x,showDetails:S,onShowDetailsChange:C,disabled:ee}),(0,Z.jsxs)(Cr,{open:E,onOpenChange:D,className:`rounded-md border border-border`,"data-testid":`create-advanced`,children:[(0,Z.jsxs)(Sr,{className:`group flex w-full items-center justify-between gap-2 px-3 py-2 text-sm font-medium hover:bg-muted/50`,"data-testid":`create-advanced-trigger`,children:[(0,Z.jsx)(Y,{id:`VNgKZz`}),(0,Z.jsx)(Ql,{className:`size-4 transition-transform group-data-[state=open]:rotate-90 motion-reduce:transition-none`,"aria-hidden":!0})]}),(0,Z.jsx)(xr,{className:`space-y-6 border-t border-border px-3 py-4`,children:(0,Z.jsx)(kp,{idPrefix:`create`,testIdPrefix:`create-sharing`,value:w,onValueChange:T,disabled:ee})})]}),te===null?null:(0,Z.jsx)(`div`,{role:`alert`,className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,"data-testid":`create-submit-error`,children:s(cx(te))})]})}),t[126]=s,t[127]=E,t[128]=ee,t[129]=u,t[130]=B,t[131]=b,t[132]=v,t[133]=c,t[134]=f,t[135]=m,t[136]=g,t[137]=st,t[138]=d,t[139]=l,t[140]=ze,t[141]=Je,t[142]=it,t[143]=ot,t[144]=Xe,t[145]=L,t[146]=o,t[147]=q,t[148]=M,t[149]=Be,t[150]=Ve,t[151]=He,t[152]=me,t[153]=w,t[154]=S,t[155]=A,t[156]=P,t[157]=te,t[158]=We,t[159]=St):St=t[159];let Ct;t[160]!==ee||t[161]!==ct||t[162]!==A?(Ct=A===`configure`&&ct?(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,className:`me-auto font-mono uppercase`,onClick:()=>j(`pick`),disabled:ee,"data-testid":`create-change-pack`,children:[(0,Z.jsx)(Al,{"aria-hidden":`true`,className:`h-4 w-4`}),(0,Z.jsx)(Y,{id:`uLVNZL`})]}):null,t[160]=ee,t[161]=ct,t[162]=A,t[163]=Ct):Ct=t[163];let wt;t[164]!==r||t[165]!==A?(wt=()=>A===`pick`?j(`configure`):r(!1),t[164]=r,t[165]=A,t[166]=wt):wt=t[166];let Tt;t[167]===A?Tt=t[168]:(Tt=A===`pick`?(0,Z.jsx)(Y,{id:`iH8pgl`}):(0,Z.jsx)(Y,{id:`dEgA5A`}),t[167]=A,t[168]=Tt);let Et;t[169]!==ee||t[170]!==wt||t[171]!==Tt?(Et=(0,Z.jsx)(X,{type:`button`,variant:`outline`,className:`font-mono uppercase`,onClick:wt,disabled:ee,"data-testid":`create-cancel`,children:Tt}),t[169]=ee,t[170]=wt,t[171]=Tt,t[172]=Et):Et=t[172];let Dt;t[173]!==ee||t[174]!==c||t[175]!==A||t[176]!==Ke?(Dt=A===`configure`?(0,Z.jsx)(X,{type:`submit`,form:c,disabled:Ke,"data-testid":`create-submit`,children:ee?(0,Z.jsx)(Y,{id:`E9bKSA`}):(0,Z.jsx)(Y,{id:`hYgDIe`})}):null,t[173]=ee,t[174]=c,t[175]=A,t[176]=Ke,t[177]=Dt):Dt=t[177];let Ot;t[178]!==Ct||t[179]!==Et||t[180]!==Dt?(Ot=(0,Z.jsxs)(Lp,{children:[Ct,Et,Dt]}),t[178]=Ct,t[179]=Et,t[180]=Dt,t[181]=Ot):Ot=t[181];let kt;t[182]!==gt||t[183]!==xt||t[184]!==St||t[185]!==Ot?(kt=(0,Z.jsxs)(Fp,{className:gt,"data-testid":`create-project-dialog`,children:[xt,St,Ot]}),t[182]=gt,t[183]=xt,t[184]=St,t[185]=Ot,t[186]=kt):kt=t[186];let At;return t[187]!==Qe||t[188]!==n||t[189]!==kt?(At=(0,Z.jsx)(Bp,{open:n,onOpenChange:Qe,children:kt}),t[187]=Qe,t[188]=n,t[189]=kt,t[190]=At):At=t[190],At}function ux(e){return e+1}function dx(e){return e+1}function fx(){}function px(e){return e+1}function mx(e){return e+1}function hx(e){return e.kind===`plan`?e:{kind:`loading`}}function gx(e){console.warn(`[CreateProjectDialog] defaultProjectsRoot probe failed:`,e)}function _x(e){return e.id}function vx(e){return e.state===`installed`}function yx(e){let t=(0,$.c)(61),{detectedEditors:n,checked:r,onCheckedChange:i,showDetails:a,onShowDetailsChange:o,disabled:s}=e,{_:c}=xn(),l=(0,Q.useId)(),u=(0,Q.useId)(),d,f,p,m,h,g,_,v;if(t[0]!==c||t[1]!==u||t[2]!==r||t[3]!==l||t[4]!==n||t[5]!==s||t[6]!==i||t[7]!==o||t[8]!==a){v=Symbol.for(`react.early_return_sentinel`);bb0:{let e=n===null?{kind:`probing`,message:c({id:`jWzDfC`})}:n.length===0?{kind:`none`,message:c({id:`aSVmqV`})}:{kind:`ready`,message:``,editors:n},y=e.kind===`ready`?`sr-only`:`rounded-md border border-border px-3 py-2.5 text-1sm text-muted-foreground`,b;t[17]===y?b=t[18]:(b=Qn(y),t[17]=y,t[18]=b);let x=(0,Z.jsx)(`p`,{"aria-live":`polite`,className:b,"data-status":e.kind,"data-testid":`create-editors-status`,children:e.message});if(e.kind!==`ready`){v=x;break bb0}_=x,h=`overflow-hidden rounded-md border border-border`;let S;t[19]!==r||t[20]!==i?(S=()=>i(!r),t[19]=r,t[20]=i,t[21]=S):S=t[21];let C;t[22]!==u||t[23]!==r||t[24]!==s||t[25]!==S?(C=(0,Z.jsx)($r,{id:u,checked:r,onCheckedChange:S,disabled:s,className:`mt-0.5`,"data-testid":`create-editors-checkbox`}),t[22]=u,t[23]=r,t[24]=s,t[25]=S,t[26]=C):C=t[26];let w;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(`span`,{className:`text-1sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`C4HK3A`})}),t[27]=w):w=t[27];let T=(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,Z.jsx)(`span`,{className:`text-sm font-medium text-foreground`,"data-testid":`create-editors-summary`,children:c({id:`j4SmVY`,values:{0:Vp(e.editors.map(xx),ic.locale)}})}),w]});t[28]!==u||t[29]!==C||t[30]!==T?(g=(0,Z.jsxs)(Ki,{htmlFor:u,className:`flex cursor-pointer items-start gap-2.5 px-3 py-2.5 font-normal hover:bg-muted/50`,children:[C,T]}),t[28]=u,t[29]=C,t[30]=T,t[31]=g):g=t[31],p=`border-t border-border`;let E;t[32]!==o||t[33]!==a?(E=()=>o(!a),t[32]=o,t[33]=a,t[34]=E):E=t[34];let D=a&&`rotate-90`,O;t[35]===D?O=t[36]:(O=Qn(`size-3.5 transition-transform motion-reduce:transition-none`,D),t[35]=D,t[36]=O);let k;t[37]===O?k=t[38]:(k=(0,Z.jsx)(Ql,{className:O,"aria-hidden":!0}),t[37]=O,t[38]=k);let A;t[39]===a?A=t[40]:(A=a?(0,Z.jsx)(Y,{id:`VMlRqi`}):(0,Z.jsx)(Y,{id:`LiAw2k`}),t[39]=a,t[40]=A),t[41]!==l||t[42]!==a||t[43]!==E||t[44]!==k||t[45]!==A?(m=(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`sm`,className:`h-auto w-full justify-start gap-1 rounded-none px-3 py-2 text-xs font-normal text-muted-foreground hover:text-foreground`,onClick:E,"aria-expanded":a,"aria-controls":l,"data-testid":`create-editors-details-toggle`,children:[k,A]}),t[41]=l,t[42]=a,t[43]=E,t[44]=k,t[45]=A,t[46]=m):m=t[46],d=l,f=a&&(0,Z.jsx)(`ul`,{className:`flex flex-col gap-1.5 border-t border-border px-3 py-2.5`,"data-testid":`create-editors-details`,children:e.editors.map(bx)})}t[0]=c,t[1]=u,t[2]=r,t[3]=l,t[4]=n,t[5]=s,t[6]=i,t[7]=o,t[8]=a,t[9]=d,t[10]=f,t[11]=p,t[12]=m,t[13]=h,t[14]=g,t[15]=_,t[16]=v}else d=t[9],f=t[10],p=t[11],m=t[12],h=t[13],g=t[14],_=t[15],v=t[16];if(v!==Symbol.for(`react.early_return_sentinel`))return v;let y;t[47]!==d||t[48]!==f?(y=(0,Z.jsx)(`div`,{id:d,children:f}),t[47]=d,t[48]=f,t[49]=y):y=t[49];let b;t[50]!==p||t[51]!==m||t[52]!==y?(b=(0,Z.jsxs)(`div`,{className:p,children:[m,y]}),t[50]=p,t[51]=m,t[52]=y,t[53]=b):b=t[53];let x;t[54]!==b||t[55]!==h||t[56]!==g?(x=(0,Z.jsxs)(`div`,{className:h,children:[g,b]}),t[54]=b,t[55]=h,t[56]=g,t[57]=x):x=t[57];let S;return t[58]!==x||t[59]!==_?(S=(0,Z.jsxs)(Z.Fragment,{children:[_,x]}),t[58]=x,t[59]=_,t[60]=S):S=t[60],S}function bx(e){let t=xs[e],n=Ho[e];return(0,Z.jsxs)(`li`,{className:`flex min-w-0 flex-col`,"data-testid":`create-editor-${e}`,children:[(0,Z.jsx)(`span`,{className:`text-1sm text-foreground`,children:ps[e]}),t!==null&&(0,Z.jsx)(`code`,{className:`text-xs text-muted-foreground break-all`,children:t}),n!==null&&(0,Z.jsx)(`code`,{className:`text-xs text-muted-foreground break-all`,children:`${n}/open-knowledge/`})]},e)}function xx(e){return ps[e]}function Sx(e){let t=(0,$.c)(37),{cascade:n,onOpenNested:r,removeGitState:i,onRequestRemoveGit:a,onCancelRemoveGit:o,onConfirmRemoveGit:s}=e;if(n.kind===`idle`||n.kind===`free`||n.kind===`block-nonempty`)return null;if(n.kind===`block-nested`){let{rootPath:e}=n,i;t[0]===e?i=t[1]:(i=ax(e),t[0]=e,t[1]=i);let a=i,o;t[2]===e?o=t[3]:(o={rootPath:e},t[2]=e,t[3]=o);let s;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(s={0:(0,Z.jsx)(`code`,{className:`font-mono break-all`})},t[4]=s):s=t[4];let c;t[5]===o?c=t[6]:(c=(0,Z.jsx)(`p`,{className:`mb-2`,children:(0,Z.jsx)(Y,{id:`W7XJN4`,values:o,components:s})}),t[5]=o,t[6]=c);let l;t[7]!==r||t[8]!==e?(l=()=>r(e),t[7]=r,t[8]=e,t[9]=l):l=t[9];let u;t[10]===a?u=t[11]:(u=(0,Z.jsx)(Y,{id:`1Ta7Fd`,values:{basename:a}}),t[10]=a,t[11]=u);let d;t[12]!==l||t[13]!==u?(d=(0,Z.jsx)(X,{type:`button`,variant:`outline`,size:`sm`,onClick:l,"data-testid":`create-banner-nested-open`,children:u}),t[12]=l,t[13]=u,t[14]=d):d=t[14];let f;return t[15]!==c||t[16]!==d?(f=(0,Z.jsxs)(`div`,{role:`alert`,className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,"data-testid":`create-banner-nested`,children:[c,d]}),t[15]=c,t[16]=d,t[17]=f):f=t[17],f}if(n.kind===`confirm-git`){let{gitRoot:e}=n,r;if(t[18]!==e){let n;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(n=/\/+$/,t[20]=n):n=t[20],r=e.replace(n,``),t[18]=e,t[19]=r}else r=t[19];let c=`${r}/.git`,l=i.kind===`error`?i.message:null,u;t[21]===e?u=t[22]:(u={gitRoot:e},t[21]=e,t[22]=u);let d;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(d={0:(0,Z.jsx)(`code`,{}),1:(0,Z.jsx)(`code`,{})},t[23]=d):d=t[23];let f;t[24]===u?f=t[25]:(f=(0,Z.jsx)(`p`,{children:(0,Z.jsx)(Y,{id:`FEK4oC`,values:u,components:d})}),t[24]=u,t[25]=f);let p;t[26]!==e||t[27]!==o||t[28]!==s||t[29]!==a||t[30]!==l||t[31]!==i.kind||t[32]!==c?(p=i.kind===`idle`||i.kind===`error`?(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-col gap-1`,children:[(0,Z.jsx)(X,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>a(e),"data-testid":`create-banner-git-remove`,children:(0,Z.jsx)(Y,{id:`YTLmTM`,components:{0:(0,Z.jsx)(`code`,{})}})}),i.kind===`error`?(0,Z.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,"data-testid":`create-banner-git-remove-error`,children:(0,Z.jsx)(Y,{id:`SkMZlS`,values:{targetGitPath:c,removeGitError:l},components:{0:(0,Z.jsx)(`code`,{})}})}):null]}):(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-col gap-2 rounded border border-blue-400/60 bg-white/40 p-2 dark:border-blue-600/60 dark:bg-black/20`,"data-testid":`create-banner-git-remove-confirm`,children:[(0,Z.jsx)(`p`,{className:`text-xs`,children:(0,Z.jsx)(Y,{id:`WZ-vBy`,values:{targetGitPath:c},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-all`})}})}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Z.jsx)(X,{type:`button`,variant:`destructive`,size:`sm`,disabled:i.kind===`pending`,onClick:()=>s(e),"data-testid":`create-banner-git-remove-confirm-button`,children:i.kind===`pending`?(0,Z.jsx)(Y,{id:`0-31GV`}):(0,Z.jsx)(Y,{id:`v-h2hx`,values:{targetGitPath:c}})}),(0,Z.jsx)(X,{type:`button`,variant:`outline`,size:`sm`,disabled:i.kind===`pending`,onClick:o,"data-testid":`create-banner-git-remove-cancel`,children:(0,Z.jsx)(Y,{id:`dEgA5A`})})]})]}),t[26]=e,t[27]=o,t[28]=s,t[29]=a,t[30]=l,t[31]=i.kind,t[32]=c,t[33]=p):p=t[33];let m;return t[34]!==f||t[35]!==p?(m=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`rounded-md border border-blue-300 bg-blue-50 px-3 py-2 text-sm text-blue-900 dark:border-blue-700 dark:bg-blue-950 dark:text-blue-200`,"data-testid":`create-banner-git-confirm`,children:[f,p]}),t[34]=f,t[35]=p,t[36]=m):m=t[36],m}return null}function Cx(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}async function wx(e,t){let n=typeof window<`u`?window.okDesktop:void 0;if(n)try{if((await n.noteWindow.open(e,t)).ok)return;Us.error(ic._({id:`o1veZ6`}))}catch{Us.error(ic._({id:`o1veZ6`}))}}function Tx(e){if(e===null)return`none`;switch(e.kind){case`doc`:case`folder-index`:return`doc`;case`folder`:return`folder`;case`asset`:case`skill-file`:case`large-file`:return`asset`;case`missing`:case`skills`:case`skill-preview`:return`none`}}var Ex={blobRun:{id:`hgf5io`},back:{id:`iH8pgl`},forward:{id:`rxWGWX`},newFile:{id:`HdkSiO`},newFolder:{id:`96G6Re`},openGraph:{id:`3Fcb0I`},openInNewWindow:{id:`E91VZY`},initializeStarterPack:{id:`fWi7pn`},newSkill:{id:`MdpSC1`},newProject:{id:`gKi-a_`},openFolderOnDisk:{id:`WPwDin`},openFileOnDisk:{id:`ka6Eke`},switchProject:{id:`xaDWAI`},openSkills:{id:`PCSkw2`},settings:{id:`Tz0i8g`},installClaudeDesktop:{id:`62Pc08`},reportBug:{id:`cd5EXh`},bugReportHistory:{id:`QHCx0c`},sendFeedback:{id:`RoafuO`},newFromTemplate:{id:`Uuj_R4`},rename:{id:`2wxgft`},duplicate:{id:`euc6Ns`},moveToTrash:{id:`q3TWG7`},revealInFinder:{id:`LtSYdi`},copyFullPath:{id:`Up2_7p`},copyRelativePath:{id:`M6mvVi`},closeTab:{id:`r6ncaO`},newWorktree:{id:`DXd9LM`},switchWorktree:{id:`8Vq20-`},sidebarShow:{id:`151wvk`},sidebarHide:{id:`Q1mtyd`},docPanelShow:{id:`fSRzLo`},docPanelHide:{id:`GSYWCm`},terminalShow:{id:`xi9KGG`},terminalHide:{id:`9xCnv8`},terminalMoveRight:{id:`PrWQiT`},terminalMoveBottom:{id:`Tofsyo`},agentPanelShow:{id:`b4V4nU`},agentPanelHide:{id:`93LBnX`},agentPanelAskSelection:{id:`OlFVNr`},showHiddenFiles:{id:`XcGbim`},showOkFolders:{id:`GHsJb8`},showOnlyMarkdownFiles:{id:`WkTLN7`},showSkillsSection:{id:`WkyP2p`},expandAll:{id:`OlAl5i`},collapseAll:{id:`qvWGzP`},newTerminal:{id:`ZBxvV3`},killTerminal:{id:`5_j-DA`},checkForUpdates:{id:`WMCwmR`},setUpIntegrations:{id:`AhoGwP`},checkSpelling:{id:`ZgJVnp`},openOnGithub:{id:`LeGeTf`}},Dx={win32:{revealInFinder:{id:`qi1F96`},moveToTrash:{id:`o9yN4T`}},linux:{revealInFinder:{id:`e1Rn_k`}}};function Ox(e,t){if(t===`win32`||t===`linux`){let n=Dx[t][e];if(n)return n}return Ex[e]}var kx={"open-blob-run":Ey,"navigate-back":Xl,"navigate-forward":Ql,"new-file":Ur,"new-folder":Ty,"open-graph":Ry,"open-in-new-window":Qy,"initialize-starter-pack":Ff,"new-skill":re,"new-project":Kn,"open-folder":Jd,"open-file":Xr,"switch-project":V,"open-skills":Ff,settings:dr,"install-claude-desktop":Cd,"report-bug":Yt,"bug-report-history":Wc,"send-feedback":gf,"new-from-template":Ur,rename:_n,duplicate:fe,"move-to-trash":Hf,"reveal-in-finder":Jd,"copy-full-path":fe,"copy-relative-path":fe,"close-tab":Gf,"new-worktree":Cl,"switch-worktree":Cl,"toggle-sidebar":d,"toggle-doc-panel":yc,"toggle-terminal":vc,"move-terminal":vc,"toggle-agent-panel":gf,"toggle-show-hidden-files":wd,"toggle-show-ok-folders":Qd,"toggle-show-only-markdown-files":Xr,"toggle-show-skills-section":re,"expand-all-tree":hb,"collapse-all-tree":Cy,"new-terminal":vc,"kill-terminal":vc,"check-for-updates":Bf,"set-up-integrations":ay,"toggle-spell-check":Zy,"open-github":Cx},Ax={"open-blob-run":e=>e.openBlobRun(),"new-file":e=>{e.closePalette(),e.openNewItemDialog(`file`)},"new-folder":e=>{e.closePalette(),e.openNewItemDialog(`folder`)},"open-graph":e=>{e.closePalette(),ke(`graph`)},"open-in-new-window":e=>{e.closePalette(),e.activeDocName&&wx(e.activeDocName,`palette`)},"initialize-starter-pack":e=>{e.closePalette(),e.openSeedDialog()},"new-skill":e=>{e.closePalette(),e.createBlankSkill()},"new-project":e=>{e.closePalette(),e.openCreateProjectDialog()},"open-folder":e=>{let t=e.bridge;t&&e.runAction(async()=>{let e=await t.dialog.openFolder();e&&await t.project.open({path:e,target:`new-window`,entryPoint:`pick-existing`})})},"open-file":e=>{let t=e.bridge;t&&e.runAction(()=>t.project.openFile())},"switch-project":e=>{let t=e.bridge;t&&e.runAction(()=>t.navigator.open(),ic._({id:`jol95m`}))},"open-skills":e=>{e.closePalette(),window.location.hash=tp()},settings:e=>{e.closePalette(),window.location.hash!==`#settings`&&(window.location.hash=nc)},"install-claude-desktop":e=>{e.closePalette(),window.location.hash=`#install-claude-desktop`},"report-bug":e=>{e.closePalette(),e.openReportBugDialog()},"bug-report-history":e=>{e.closePalette(),e.openBugReportHistory()},"send-feedback":e=>{e.closePalette(),e.openFeedbackDialog()},"check-for-updates":e=>e.runAction(async()=>{await e.bridge?.update.checkNow()}),"set-up-integrations":e=>e.runAction(async()=>{await e.bridge?.mcpWiring.reconfigure()}),"toggle-spell-check":e=>e.runAction(async()=>{await e.bridge?.spellcheck.toggle()}),"open-github":e=>e.openExternalUrl(Wo)};function jx(e){return{host:e.bridge===null?`web`:`desktop`,activeTargetKind:e.contextualTargetKind,singleFile:e.singleFile,terminalCapable:e.bridge!==null&&e.bridge.terminal!=null&&e.bridge.config.ptyAvailable===!0,terminalLive:e.viewMenuState.terminalLive===!0,canExpandAll:e.viewMenuState.canExpandAll!==!1,canCollapseAll:e.viewMenuState.canCollapseAll!==!1,hasActiveDoc:e.activeDocName!==null,showInstallSkill:!1}}function Mx(e,t){let n=t.bridge?.platform;if(e.stateToggle){let{overrideKey:r,overrideField:i}=e.stateToggle;if(r!==void 0&&i!==void 0&&t.viewMenuState[i]===!0)return ic._(Ex[r]);let a=t.viewMenuState[e.stateToggle.stateField]===!0?e.stateToggle.hideKey:e.stateToggle.showKey;return ic._(Ox(a,n))}if(e.placementToggle){let r=t.viewMenuState.terminalPlacement===`right`?e.placementToggle.rightKey:e.placementToggle.bottomKey;return ic._(Ox(r,n))}return ic._(Ox(e.labelKey,n))}function Nx(e){let t=e.menuActionId;return e=>e.emitMenuAction(t)}function Px(e){let t=e.palette;if(!t)throw Error(`command ${e.id} has no palette presence`);let n=kx[e.id];if(!n)throw Error(`command ${e.id} has no palette icon`);let r=e.checkField;return{id:e.id,menuActionId:e.menuActionId,label:t=>Mx(e,t),keywords:e.keywords,icon:n,group:t.group,visibility:t.visibility,shortcutId:e.shortcutId,shortcutDesktopOnly:e.shortcutDesktopOnly,checked:r?e=>e.viewMenuState[r]===!0:void 0,available:t=>Uo(e.availability,jx(t)),dispatch:Ax[e.id]??Nx(e)}}var Fx=Po.flatMap(e=>e.palette?[Px(e)]:[]),Ix=`ok-omnibar-recents-v1`,Lx=10;function Rx(e){return typeof e==`object`&&!!e&&(e.kind===`file`||e.kind===`folder`)&&typeof e.path==`string`&&typeof e.lastOpenedAt==`string`}function zx(e){if(e)return e;if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function Bx(e,t){return`${e}:${t}`}function Vx(e){let t=zx(e);if(!t)return[];try{let e=t.getItem(Ix);if(!e)return[];let n=JSON.parse(e);return Array.isArray(n)?n.filter(Rx).slice(0,Lx):[]}catch{return[]}}function Hx(e,t){let n=zx(t);if(n)try{n.setItem(Ix,JSON.stringify(e.slice(0,Lx)))}catch(e){console.warn(`[omnibar] Failed to save recent entries:`,e)}}function Ux(e,t){return[t,...e.filter(e=>e.kind!==t.kind||e.path!==t.path)].slice(0,Lx)}function Wx(e,t){return e.filter(e=>t.has(Bx(e.kind,e.path)))}var Gx=50,Kx=50,qx=``,Jx=null;function Yx(e){return e.trim().toLowerCase()}function Xx(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Zx(e){let t=e.trim();return t?[...new Set(t.split(/\s+/).filter(Boolean))].sort((e,t)=>t.length-e.length):[]}function Qx(e,t,n=new Map,r=new Map,i=new Set){let a=[],o=new Set;for(let t of e){o.add(t);let e=r.get(t),i=e?.modified,s=n.get(t);a.push({kind:`file`,path:t,name:No(t),...s&&{title:s},...e?.docExt&&{docExt:e.docExt},...i&&{modifiedTs:Date.parse(i)}})}for(let e of i)o.has(e)||(o.add(e),a.push({kind:`file`,path:e,name:No(e),bodyIndexed:!1}));for(let e of t)a.push({kind:`folder`,path:e,name:No(e)});return a.sort((e,t)=>{let n=e.path.localeCompare(t.path);return n===0?e.kind===t.kind?0:e.kind===`folder`?-1:1:n}),a}function $x(e){return us({kind:e.kind===`folder`?`folder`:e.bodyIndexed===!1?`file`:`page`,path:e.path,title:e.title??e.name,modifiedTs:e.modifiedTs??0})}function eS(e){return{entries:e,byId:new Map(e.map(e=>[`${e.kind===`folder`?`folder`:e.bodyIndexed===!1?`file`:`page`}:${e.path}`,e])),corpus:Es(e.map($x))}}function tS(e){return e.map(e=>`${e.kind}\u0000${e.path}\u0000${e.title??``}\u0000${e.docExt??``}\u0000${e.modifiedTs??0} ${e.bodyIndexed===!1?`0`:`1`}`).join(``)}function nS(e){let t=tS(e);return Jx&&qx===t?Jx:(qx=t,Jx=eS(e),Jx)}function rS(e,t,n=Gx){return iS(nS(e),t,n)}function iS(e,t,n=Gx){let r=Yx(t);return r?Ia(e.corpus,r,{intent:`omnibar`,limit:n,scopes:[`page`,`folder`,`file`]}).map(t=>e.byId.get(t.document.id)).filter(e=>e!==void 0):e.entries.slice(0,20)}function aS(e,t){let n=Zx(t);if(n.length===0||e.length===0)return[{text:e,match:!1,start:0}];let r=RegExp(`(${n.map(Xx).join(`|`)})`,`gi`),i=[],a=0;for(let t of e.matchAll(r)){let n=t.index??0;n>a&&i.push({text:e.slice(a,n),match:!1,start:a}),i.push({text:t[0],match:!0,start:n}),a=n+t[0].length}return a<e.length&&i.push({text:e.slice(a),match:!1,start:a}),i.length>0?i:[{text:e,match:!1,start:0}]}function oS(e){if(e.kind!==`page`&&e.kind!==`folder`&&e.kind!==`file`||typeof e.path!=`string`)return null;let t=No(e.path);return{kind:e.kind===`folder`?`folder`:`file`,path:e.path,name:t,...e.kind===`file`&&{bodyIndexed:!1},...e.title&&{title:e.title},...e.snippet&&{snippet:e.snippet},...typeof e.score==`number`&&{score:e.score}}}async function sS(e,t={}){let n=e.trim();if(!n)return{entries:[],truncated:!1,ready:!0};let r=await fetch(`/api/search`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({query:n,intent:`full_text`,ranking:t.semantic?`relevance`:`navigation`,scopes:[`page`,`folder`,`content`,`file`],limit:t.limit??Kx,source:`omnibar`,...t.semantic?{semantic:!0}:{}}),signal:t.signal});if(!r.ok){let e=await r.json().catch(()=>null);throw Error(qc(e)??`Search failed with status ${r.status}`)}let i=await r.json();return{entries:(i.results??[]).map(oS).filter(e=>!!e),truncated:i.truncated===!0,ready:i.ready!==!1}}function cS(e,t,n=[]){let r=Yx(t);return r?Yx([e,...n].join(` `)).includes(r):!0}function lS(e,t,n={}){if(e.trim()===``)return`idle`;if(t.length===0)return`empty`;if(n.truncated)return`truncated`;for(let e of t)if(`snippet`in e&&typeof e.snippet==`string`&&e.snippet.length>0)return`content`;return`name-only`}function uS(e){let{query:t,firedQuery:n,status:r,resultCount:i}=e,a=i>0,o=t!==``&&t!==n,s=a&&(r===`loading`||t!==n),c=null;r===`error`&&t!==``?c={kind:`retry`,query:t}:o&&r!==`loading`&&(c={kind:`search`,query:t});let l=null;return r===`loading`?l=`searching`:t===``&&!a?l=`empty`:r===`success`&&!o&&!a&&(l=`no-results`),{submit:c,results:{show:a,dimmed:s,forQuery:a?n:null},notice:l}}var dS=`tag:`;function fS(e,t){if(!e.toLowerCase().startsWith(`tag:`))return{kind:`normal`,query:e};let n=e.slice(4).replace(/^\s+/,``).trim();return n&&t.has(n)?{kind:`tag-docs`,tagName:n}:{kind:`tag-list`,query:n}}function pS(e,t){return St(e,t)}var mS=Jt;async function hS(e){let t=await fetch(`/api/tags/${encodeURIComponent(e)}`);if(!t.ok)throw Error(`/api/tags/${e} responded with ${t.status}`);let n=await t.json();return Array.isArray(n.docs)?n.docs:[]}var gS=(0,Q.lazy)(()=>n(()=>import(`./FeedbackForm-DqB5YXD8.js`).then(e=>({default:e.FeedbackForm})),[],import.meta.url)),_S=e=>{let t=(0,$.c)(11),{open:n,onOpenChange:r,source:i,onSuccess:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(zp,{children:(0,Z.jsx)(Pp,{children:(0,Z.jsx)(Y,{id:`SItQRc`})})}),t[0]=o):o=t[0];let s;t[1]!==r||t[2]!==a?(s=()=>{r(!1),a?.()},t[1]=r,t[2]=a,t[3]=s):s=t[3];let c;t[4]!==i||t[5]!==s?(c=(0,Z.jsxs)(Fp,{children:[o,(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(gS,{source:i,onSuccess:s})})]}),t[4]=i,t[5]=s,t[6]=c):c=t[6];let l;return t[7]!==r||t[8]!==n||t[9]!==c?(l=(0,Z.jsx)(Bp,{open:n,onOpenChange:r,children:c}),t[7]=r,t[8]=n,t[9]=c,t[10]=l):l=t[10],l};async function vS(e){let t={path:e.path};e.template!==void 0&&(t.template=e.template);try{let n=await fetch(`/api/create-page`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)}),r=n.status,i=await yn(n,ic._({id:`d2uTPx`,values:{status:r}}));if(!i.ok)return{ok:!1,error:i.title};let a=Ms.safeParse(i.body);return a.success?{ok:!0,docName:a.data.docName}:{ok:!1,error:e.kind===`folder`?ic._({id:`K1ckLX`}):ic._({id:`fJgQHX`})}}catch(e){return console.warn(`[create-page-request] create failed:`,e),{ok:!1,error:ic._({id:`HIb0vl`})}}}function yS(e,t){window.location.hash=`#/${e}`,t(e),uc([`files`,`backlinks`,`graph`])}function bS(e,t){let n=e?`${e}/`:``;for(let e=1;;e++){let r=`${n}untitled${e===1?``:`-${e}`}`;if(!t.has(r))return r}}var xS=[`.md`,`.mdx`];function SS(e){let t=e.toLowerCase();for(let e of xS)if(t.endsWith(e))return e;return null}var CS={local:0,inherited:1};function wS(e){return[...e].sort((e,t)=>{let n=CS[e.scope]-CS[t.scope];if(n!==0)return n;let r=(e.title??e.name).toLowerCase(),i=(t.title??t.name).toLowerCase();return r.localeCompare(i)})}var TS=`__blank__`;function ES(e){return e.trim()?e.includes(`..`)?`dotdot`:e.startsWith(`/`)?`leading-slash`:e.includes(`\\`)?`backslash`:e.includes(`\0`)?`null-byte`:null:`empty`}function DS(e){switch(e){case`empty`:return{id:`hYDc6B`};case`dotdot`:return{id:`Wyxs0x`};case`leading-slash`:return{id:`OYnx7O`};case`backslash`:return{id:`qo4zCg`};case`null-byte`:return{id:`saYiIO`}}}function OS(e){let t=e.fileName.trim(),n=SS(t)?t:`${t}${e.fileExtension??`.md`}`;if(e.kind===`folder`){let t=(e.folderName??``).trim();return`${e.initialDir?`${e.initialDir}/${t}`:t}/${n}`}return e.initialDir?`${e.initialDir}/${n}`:n}function kS(e,t){return Gs(e.target)?!1:rc(e,`new-item`,t)}function AS(e){let t=e.value.lastIndexOf(`.`);t>0?e.setSelectionRange(0,t):e.select()}function jS(e){let t=(0,$.c)(136),{open:n,onOpenChange:r,kind:i,initialDir:a,suggestedName:o,initialTemplate:s,defaultToTemplate:c,description:l,onCreated:u,folderConfig:d}=e,{_:f}=xn(),{addPage:p}=Lu(),m=ed(d?null:a),h=d??m,[g,_]=(0,Q.useState)(``),[v,y]=(0,Q.useState)(``),[b,x]=(0,Q.useState)(TS),[S,C]=(0,Q.useState)(!1),[w,T]=(0,Q.useState)(null),[E,D]=(0,Q.useState)(!1),[O,k]=(0,Q.useState)(null),A=(0,Q.useId)(),j=(0,Q.useId)(),M=(0,Q.useId)(),N=(0,Q.useId)(),P=(0,Q.useId)(),[F,I]=(0,Q.useState)(!1),L=(0,Q.useRef)(null),R=(0,Q.useRef)(null),z,B;t[0]!==s||t[1]!==i||t[2]!==n||t[3]!==o?(z=()=>{n&&(T(null),k(null),D(!1),y(``),x(i===`file`&&s?s:TS),C(!1),I(!1),_(i===`file`?o??`untitled`:`index`))},B=[n,i,o,s],t[0]=s,t[1]=i,t[2]=n,t[3]=o,t[4]=z,t[5]=B):(z=t[4],B=t[5]),(0,Q.useEffect)(z,B);let V;t[6]!==h.state.data||t[7]!==h.state.status?(V=h.state.status===`ready`?wS(h.state.data.folder.templates_available??[]):[],t[6]=h.state.data,t[7]=h.state.status,t[8]=V):V=t[8];let H=V,U;t[9]!==h.state.data||t[10]!==h.state.status||t[11]!==n||t[12]!==b?(U=()=>{n&&b!==TS&&h.state.status===`ready`&&((h.state.data.folder.templates_available??[]).some(e=>e.name===b)||x(TS))},t[9]=h.state.data,t[10]=h.state.status,t[11]=n,t[12]=b,t[13]=U):U=t[13];let ee;t[14]!==h.state||t[15]!==n||t[16]!==b?(ee=[n,b,h.state],t[14]=h.state,t[15]=n,t[16]=b,t[17]=ee):ee=t[17],(0,Q.useEffect)(U,ee);let W;t[18]!==c||t[19]!==h.state.data||t[20]!==h.state.status||t[21]!==s||t[22]!==n||t[23]!==S?(W=()=>{if(!n||!c||s||S||h.state.status!==`ready`)return;let e=wS(h.state.data.folder.templates_available??[]);e.length>0&&x(e[0].name)},t[18]=c,t[19]=h.state.data,t[20]=h.state.status,t[21]=s,t[22]=n,t[23]=S,t[24]=W):W=t[24];let te;t[25]!==c||t[26]!==h.state||t[27]!==s||t[28]!==n||t[29]!==S?(te=[n,c,s,S,h.state],t[25]=c,t[26]=h.state,t[27]=s,t[28]=n,t[29]=S,t[30]=te):te=t[30],(0,Q.useEffect)(W,te);let G=h.state.status===`loading`||h.state.status===`idle`,K=h.state.status===`error`?h.state.message:null,q=i===`file`&&(H.length>0||!!K),ne;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(ne=function(e){_(e),T(null)},t[31]=ne):ne=t[31];let re=ne,J;t[32]!==g||t[33]!==v||t[34]!==a||t[35]!==i?(J=function(){return OS({kind:i,initialDir:a,fileName:g,folderName:v})},t[32]=g,t[33]=v,t[34]=a,t[35]=i,t[36]=J):J=t[36];let ie=J,ae;t[37]!==f||t[38]!==g||t[39]!==v||t[40]!==i?(ae=function(){if(i===`folder`){let e=ES(v.trim());if(e)return{message:f({id:`ODGGlj`,values:{detail:f(DS(e))}}),field:`folder`}}let e=ES(g.trim());return e?{message:f(DS(e)),field:`file`}:null},t[37]=f,t[38]=g,t[39]=v,t[40]=i,t[41]=ae):ae=t[41];let oe=ae,se;t[42]!==E||t[43]!==g||t[44]!==v||t[45]!==i||t[46]!==G?(se=E||!g.trim()||i===`folder`&&!v.trim()||i===`file`&&G,t[42]=E,t[43]=g,t[44]=v,t[45]=i,t[46]=G,t[47]=se):se=t[47];let ce=se,le;t[48]!==p||t[49]!==ie||t[50]!==oe||t[51]!==i||t[52]!==u||t[53]!==r||t[54]!==b?(le=async function(){let e=oe();if(e){T(e.message),k(e.field);return}D(!0),T(null),k(null);let t=await vS({path:ie(),template:i===`file`&&b!==TS?b:void 0,kind:i});if(D(!1),!t.ok){T(t.error),k(`form`);return}r(!1),yS(t.docName,p),u?.(t.docName)},t[48]=p,t[49]=ie,t[50]=oe,t[51]=i,t[52]=u,t[53]=r,t[54]=b,t[55]=le):le=t[55];let ue=le,de;t[56]!==f||t[57]!==a?(de=a||f({id:`L6Hhh6`}),t[56]=f,t[57]=a,t[58]=de):de=t[58];let fe=de,pe;t[59]===i?pe=t[60]:(pe=(0,Z.jsx)(Pp,{children:i===`file`?(0,Z.jsx)(Y,{id:`HdkSiO`}):(0,Z.jsx)(Y,{id:`96G6Re`})}),t[59]=i,t[60]=pe);let me;t[61]!==l||t[62]!==fe?(me=l??(0,Z.jsx)(Y,{id:`NvOvTi`,values:{dirDisplay:fe},components:{0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})}}),t[61]=l,t[62]=fe,t[63]=me):me=t[63];let he;t[64]===me?he=t[65]:(he=(0,Z.jsx)(Np,{children:me}),t[64]=me,t[65]=he);let ge;t[66]!==pe||t[67]!==he?(ge=(0,Z.jsxs)(zp,{children:[pe,he]}),t[66]=pe,t[67]=he,t[68]=ge):ge=t[68];let _e;t[69]!==b||t[70]!==q||t[71]!==N||t[72]!==F||t[73]!==P||t[74]!==H||t[75]!==K||t[76]!==G?(_e=q&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`span`,{id:N,className:`text-sm font-medium`,children:(0,Z.jsx)(Y,{id:`f65AOQ`})}),K?(0,Z.jsx)(`p`,{role:`alert`,className:`text-1sm text-destructive`,children:(0,Z.jsx)(Y,{id:`sE7R19`,values:{templatesError:K}})}):null,(0,Z.jsx)(NS,{triggerId:P,labelledById:N,open:F,onOpenChange:I,value:b,onValueChange:e=>{x(e),C(!0)},templates:H,loading:G})]}),t[69]=b,t[70]=q,t[71]=N,t[72]=F,t[73]=P,t[74]=H,t[75]=K,t[76]=G,t[77]=_e):_e=t[77];let ve;t[78]!==f||t[79]!==w||t[80]!==O||t[81]!==A||t[82]!==j||t[83]!==v||t[84]!==i?(ve=i===`folder`&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`label`,{className:`text-sm font-medium`,htmlFor:j,children:(0,Z.jsx)(Y,{id:`cqQyPB`})}),(0,Z.jsx)(Op,{ref:R,id:j,value:v,onChange:e=>{y(e.target.value),T(null)},placeholder:`folder-name`,autoFocus:!0,"aria-describedby":w&&(O===`folder`||O===`form`)?A:void 0,"aria-invalid":w&&(O===`folder`||O===`form`)?!0:void 0,onKeyDown:e=>{if(e.key===`Enter`){e.preventDefault();let t=ES(v.trim());if(t){T(f({id:`ODGGlj`,values:{detail:f(DS(t))}})),k(`folder`);return}L.current?.focus()}}})]}),t[78]=f,t[79]=w,t[80]=O,t[81]=A,t[82]=j,t[83]=v,t[84]=i,t[85]=ve):ve=t[85];let ye;t[86]===i?ye=t[87]:(ye=i===`folder`?(0,Z.jsx)(Y,{id:`jjtmV_`}):(0,Z.jsx)(Y,{id:`s-XOaI`}),t[86]=i,t[87]=ye);let be;t[88]!==M||t[89]!==ye?(be=(0,Z.jsx)(`label`,{className:`text-sm font-medium`,htmlFor:M,children:ye}),t[88]=M,t[89]=ye,t[90]=be):be=t[90];let xe;t[91]===Symbol.for(`react.memo_cache_sentinel`)?(xe=e=>re(e.target.value),t[91]=xe):xe=t[91];let Se=i===`file`,Ce=w&&(O===`file`||O===`form`)?A:void 0,we=w&&(O===`file`||O===`form`)?!0:void 0,Te;t[92]!==ue||t[93]!==ce?(Te=e=>{e.key===`Enter`&&!ce&&ue()},t[92]=ue,t[93]=ce,t[94]=Te):Te=t[94];let Ee;t[95]!==M||t[96]!==g||t[97]!==Se||t[98]!==Ce||t[99]!==we||t[100]!==Te?(Ee=(0,Z.jsx)(Op,{ref:L,id:M,value:g,onChange:xe,placeholder:`my-note`,autoFocus:Se,"aria-describedby":Ce,"aria-invalid":we,onFocus:MS,onKeyDown:Te}),t[95]=M,t[96]=g,t[97]=Se,t[98]=Ce,t[99]=we,t[100]=Te,t[101]=Ee):Ee=t[101];let De;t[102]!==w||t[103]!==A?(De=w&&(0,Z.jsx)(`p`,{id:A,role:`alert`,className:`text-1sm text-destructive`,children:w}),t[102]=w,t[103]=A,t[104]=De):De=t[104];let Oe;t[105]!==be||t[106]!==Ee||t[107]!==De?(Oe=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[be,Ee,De]}),t[105]=be,t[106]=Ee,t[107]=De,t[108]=Oe):Oe=t[108];let ke;t[109]!==_e||t[110]!==ve||t[111]!==Oe?(ke=(0,Z.jsxs)(Ip,{className:`space-y-6 pb-1`,children:[_e,ve,Oe]}),t[109]=_e,t[110]=ve,t[111]=Oe,t[112]=ke):ke=t[112];let Ae;t[113]===r?Ae=t[114]:(Ae=()=>r(!1),t[113]=r,t[114]=Ae);let je;t[115]===Symbol.for(`react.memo_cache_sentinel`)?(je=(0,Z.jsx)(Y,{id:`dEgA5A`}),t[115]=je):je=t[115];let Me;t[116]!==E||t[117]!==Ae?(Me=(0,Z.jsx)(X,{variant:`outline`,className:`font-mono uppercase`,onClick:Ae,disabled:E,children:je}),t[116]=E,t[117]=Ae,t[118]=Me):Me=t[118];let Ne;t[119]===E?Ne=t[120]:(Ne=E?(0,Z.jsx)(Y,{id:`E9bKSA`}):(0,Z.jsx)(Y,{id:`hYgDIe`}),t[119]=E,t[120]=Ne);let Pe;t[121]!==ue||t[122]!==ce||t[123]!==Ne?(Pe=(0,Z.jsx)(X,{onClick:ue,disabled:ce,children:Ne}),t[121]=ue,t[122]=ce,t[123]=Ne,t[124]=Pe):Pe=t[124];let Fe;t[125]!==Me||t[126]!==Pe?(Fe=(0,Z.jsxs)(Lp,{children:[Me,Pe]}),t[125]=Me,t[126]=Pe,t[127]=Fe):Fe=t[127];let Ie;t[128]!==ge||t[129]!==ke||t[130]!==Fe?(Ie=(0,Z.jsxs)(Fp,{className:`sm:max-w-md`,"data-ok-layer-spawned":``,children:[ge,ke,Fe]}),t[128]=ge,t[129]=ke,t[130]=Fe,t[131]=Ie):Ie=t[131];let Le;return t[132]!==r||t[133]!==n||t[134]!==Ie?(Le=(0,Z.jsx)(Bp,{open:n,onOpenChange:r,children:Ie}),t[132]=r,t[133]=n,t[134]=Ie,t[135]=Le):Le=t[135],Le}function MS(e){return AS(e.currentTarget)}function NS(e){let t=(0,$.c)(66),{triggerId:n,labelledById:r,open:i,onOpenChange:a,value:o,onValueChange:s,templates:c,loading:l}=e,{_:u}=xn(),d=(0,Q.useId)(),f;if(t[0]!==c||t[1]!==o){let e;t[3]===o?e=t[4]:(e=e=>e.name===o,t[3]=o,t[4]=e),f=c.find(e),t[0]=c,t[1]=o,t[2]=f}else f=t[2];let p=f,m=o===TS,h=i?d:void 0,g=`${r} ${n}`,_;t[5]!==m||t[6]!==l||t[7]!==p?.name||t[8]!==p?.title||t[9]!==o?(_=l?(0,Z.jsx)(Y,{id:`Hl89Qd`}):m?(0,Z.jsx)(Y,{id:`E7BhZn`}):p?.title??p?.name??o,t[5]=m,t[6]=l,t[7]=p?.name,t[8]=p?.title,t[9]=o,t[10]=_):_=t[10];let v;t[11]===_?v=t[12]:(v=(0,Z.jsx)(`span`,{className:`truncate`,children:_}),t[11]=_,t[12]=v);let y;t[13]!==m||t[14]!==l||t[15]!==p?(y=!l&&!m&&p?(0,Z.jsx)(LS,{entry:p}):null,t[13]=m,t[14]=l,t[15]=p,t[16]=y):y=t[16];let b;t[17]!==v||t[18]!==y?(b=(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[v,y]}),t[17]=v,t[18]=y,t[19]=b):b=t[19];let x;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(Nu,{className:`ml-2 size-4 shrink-0 opacity-50`,"aria-hidden":`true`}),t[20]=x):x=t[20];let S;t[21]!==l||t[22]!==i||t[23]!==h||t[24]!==g||t[25]!==b||t[26]!==n?(S=(0,Z.jsx)(Tm,{asChild:!0,children:(0,Z.jsxs)(X,{id:n,type:`button`,variant:`outline`,role:`combobox`,"aria-expanded":i,"aria-haspopup":`listbox`,"aria-controls":h,"aria-labelledby":g,disabled:l,className:`w-full justify-between font-normal`,children:[b,x]})}),t[21]=l,t[22]=i,t[23]=h,t[24]=g,t[25]=b,t[26]=n,t[27]=S):S=t[27];let C;t[28]===u?C=t[29]:(C=u({id:`UQAp48`}),t[28]=u,t[29]=C);let w;t[30]===C?w=t[31]:(w=(0,Z.jsx)(k,{placeholder:C}),t[30]=C,t[31]=w);let T;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(De,{children:(0,Z.jsx)(Y,{id:`c8iK2Y`})}),t[32]=T):T=t[32];let E;if(t[33]!==a||t[34]!==s||t[35]!==c||t[36]!==o){let e;t[38]!==a||t[39]!==s||t[40]!==o?(e=e=>{let t=e.title??e.name,n=e.title&&e.title!==e.name?e.name:void 0,r=`${e.scope}:${e.source_folder}:${e.name}`;return(0,Z.jsxs)(H,{value:r,keywords:[t,e.name,e.description??``,e.scope,e.source_folder??``],onSelect:()=>{s(e.name),a(!1)},className:`items-start gap-3`,children:[(0,Z.jsx)(Yl,{className:Qn(`mt-1 size-4 shrink-0`,o===e.name?`opacity-100`:`opacity-0`),"aria-hidden":`true`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`truncate text-sm font-medium`,children:t}),n?(0,Z.jsx)(`code`,{className:`font-mono text-2xs text-muted-foreground shrink-0`,children:n}):null,(0,Z.jsx)(LS,{entry:e,className:`ml-auto`})]}),e.description?(0,Z.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-xs text-muted-foreground`,children:e.description}):null]})]},r)},t[38]=a,t[39]=s,t[40]=o,t[41]=e):e=t[41],E=c.map(e),t[33]=a,t[34]=s,t[35]=c,t[36]=o,t[37]=E}else E=t[37];let D;t[42]!==a||t[43]!==s?(D=()=>{s(TS),a(!1)},t[42]=a,t[43]=s,t[44]=D):D=t[44];let O=o===TS?`opacity-100`:`opacity-0`,A;t[45]===O?A=t[46]:(A=Qn(`mt-1 size-4 shrink-0`,O),t[45]=O,t[46]=A);let j;t[47]===A?j=t[48]:(j=(0,Z.jsx)(Yl,{className:A,"aria-hidden":`true`}),t[47]=A,t[48]=j);let M;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Z.jsx)(`span`,{className:`text-sm font-medium`,children:(0,Z.jsx)(Y,{id:`E7BhZn`})}),t[49]=M):M=t[49];let N;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[M,(0,Z.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-xs text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`hZoBHK`})})]}),t[50]=N):N=t[50];let P;t[51]!==D||t[52]!==j?(P=(0,Z.jsxs)(H,{value:`Blank note empty`,onSelect:D,className:`items-start gap-3`,children:[j,N]}),t[51]=D,t[52]=j,t[53]=P):P=t[53];let F;t[54]!==d||t[55]!==E||t[56]!==P?(F=(0,Z.jsxs)(Kt,{id:d,className:`subtle-scrollbar`,children:[T,E,P]}),t[54]=d,t[55]=E,t[56]=P,t[57]=F):F=t[57];let I;t[58]!==w||t[59]!==F?(I=(0,Z.jsx)(Dm,{className:`w-[var(--radix-popover-trigger-width)] p-0`,align:`start`,onOpenAutoFocus:IS,onWheel:FS,onTouchMove:PS,children:(0,Z.jsxs)(Ae,{children:[w,F]})}),t[58]=w,t[59]=F,t[60]=I):I=t[60];let L;return t[61]!==a||t[62]!==i||t[63]!==I||t[64]!==S?(L=(0,Z.jsxs)(Om,{open:i,onOpenChange:a,children:[S,I]}),t[61]=a,t[62]=i,t[63]=I,t[64]=S,t[65]=L):L=t[65],L}function PS(e){e.stopPropagation()}function FS(e){e.stopPropagation()}function IS(e){e.preventDefault(),e.currentTarget.querySelector(`[cmdk-input]`)?.focus()}function LS(e){let t=(0,$.c)(7),{entry:n,className:r}=e;if(n.scope===`inherited`){let e;t[0]===r?e=t[1]:(e=Qn(`shrink-0 text-2xs`,r),t[0]=r,t[1]=e);let i;t[2]===n.source_folder?i=t[3]:(i=n.source_folder||(0,Z.jsx)(Y,{id:`ZNK2Tq`}),t[2]=n.source_folder,t[3]=i);let a;return t[4]!==e||t[5]!==i?(a=(0,Z.jsx)(wm,{variant:`gray`,className:e,children:i}),t[4]=e,t[5]=i,t[6]=a):a=t[6],a}return null}var RS=`knowledge-base`;function zS(e){let t=(0,$.c)(69),{open:n,onOpenChange:r,onSeedApplied:i,initialPackId:a}=e,{_:o}=xn(),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s={kind:`loading`},t[0]=s):s=t[0];let[c,l]=(0,Q.useState)(s),[u,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)(a??RS),[m,h]=(0,Q.useState)(`project-root`),[g,_]=(0,Q.useState)(``),[v,y]=(0,Q.useState)(a===void 0?`pick`:`configure`),b=(0,Q.useRef)(!0),x=u?.find(e=>e.id===f),S,C;t[1]!==n||t[2]!==u?(S=()=>{if(!n||u!==null)return;let e=!1;return(async()=>{try{let t=await Wb().listPacks();if(e)return;t.ok?d(t.packs):(d([]),l({kind:`error`,message:t.error.message}))}catch(t){let n=t;if(e)return;d([]),l({kind:`error`,message:n instanceof Error?n.message:String(n)})}})(),()=>{e=!0}},C=[n,u],t[1]=n,t[2]=u,t[3]=S,t[4]=C):(S=t[3],C=t[4]),(0,Q.useEffect)(S,C);let w,T;t[5]!==a||t[6]!==n?(w=()=>{n&&(p(a??RS),h(`project-root`),_(``),y(a===void 0?`pick`:`configure`),l({kind:`loading`}),b.current=!0)},T=[n,a],t[5]=a,t[6]=n,t[7]=w,t[8]=T):(w=t[7],T=t[8]),(0,Q.useEffect)(w,T),(0,Q.useEffect)(()=>{x&&_(x.defaultSubfolder??``)},[x]);let E;t[9]===g?E=t[10]:(E=g.trim(),t[9]=g,t[10]=E);let D=E,O=m===`subfolder`&&D===``,k,A;t[11]!==o||t[12]!==n||t[13]!==u||t[14]!==m||t[15]!==f||t[16]!==v||t[17]!==O||t[18]!==D?(k=()=>{if(!n||v!==`configure`||u===null)return;if(O){l({kind:`error`,message:o({id:`Z8KDox`})});return}let e=m===`project-root`?void 0:D,t=b.current?0:200;b.current=!1;let r=!1,i=setTimeout(()=>{r||(l(VS),Wb().plan({rootDir:e,packId:f}).then(e=>{if(!r){if(!e.ok){l({kind:`error`,message:e.error.message});return}l(Io(e.plan)?{kind:`plan`,plan:e.plan}:{kind:`already-seeded`,plan:e.plan})}}).catch(e=>{r||l({kind:`error`,message:e instanceof Error?e.message:String(e)})}))},t);return()=>{r=!0,clearTimeout(i)}},A=[n,v,u,f,m,D,O,o],t[11]=o,t[12]=n,t[13]=u,t[14]=m,t[15]=f,t[16]=v,t[17]=O,t[18]=D,t[19]=k,t[20]=A):(k=t[19],A=t[20]),(0,Q.useEffect)(k,A);let j=async function(){if(c.kind!==`plan`)return;let e=c.plan;l({kind:`applying`,plan:e});let t;try{t=await Wb().apply(e,{packId:f})}catch(t){let n=t,r=n instanceof Error?n.message:String(n);Us.error(o({id:`iqugog`,values:{errorDetail:r}})),l({kind:`plan`,plan:e});return}if(t.ok){let n=x?.name??o({id:`W8vpBM`}),a=t.result.applied,s=e.packSkills?.some(BS)===!0,c=o(a>0?{id:`x3-2ta`,values:{packName:n,projectEntries:a}}:s?{id:`B2Srgd`,values:{packName:n}}:{id:`K6jjWB`,values:{packName:n}});Us.success(c);for(let e of t.result.packSkillConflicts??[]){let t=e.name,n=e.hosts?.join(`, `);Us.warning(o(n===void 0||n===``?{id:`GifIjR`,values:{conflictName:t}}:{id:`Mv2lM4`,values:{conflictName:t,conflictHosts:n}}))}i?.(),r(!1)}else{let n=t.error.message;Us.error(o({id:`iqugog`,values:{errorDetail:n}})),l({kind:`plan`,plan:e})}},M=a!==void 0,N=x?.name,P=o(v===`configure`&&x?{id:`hxEUVJ`,values:{selectedPackName:N}}:{id:`RGkNeJ`}),F=x?ex[x.id]:void 0,I;t[21]!==o||t[22]!==F||t[23]!==x||t[24]!==v?(I=v===`configure`&&x?F?o(F):x.description:o({id:`msqUNq`}),t[21]=o,t[22]=F,t[23]=x,t[24]=v,t[25]=I):I=t[25];let L=I,R;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(R=function(e){p(e),y(`configure`),b.current=!0},t[26]=R):R=t[26];let z=R,B;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(B=function(){y(`pick`),l({kind:`loading`}),b.current=!0},t[27]=B):B=t[27];let V=B,H;t[28]===P?H=t[29]:(H=(0,Z.jsx)(Pp,{children:P}),t[28]=P,t[29]=H);let U;t[30]===L?U=t[31]:(U=(0,Z.jsx)(Np,{children:L}),t[30]=L,t[31]=U);let ee;t[32]!==H||t[33]!==U?(ee=(0,Z.jsxs)(zp,{children:[H,U]}),t[32]=H,t[33]=U,t[34]=ee):ee=t[34];let W;t[35]!==u||t[36]!==c||t[37]!==m||t[38]!==x||t[39]!==v||t[40]!==g?(W=v===`pick`?(0,Z.jsx)(Ip,{children:(0,Z.jsx)(qb,{packs:u,onPackSelect:z})}):(0,Z.jsxs)(Ip,{className:`space-y-6`,children:[(0,Z.jsx)($b,{choice:m,subfolder:g,placeholder:x?.defaultSubfolder??`subfolder`,onChoiceChange:h,onSubfolderChange:_}),(0,Z.jsx)(HS,{phase:c,selectedPack:x})]}),t[35]=u,t[36]=c,t[37]=m,t[38]=x,t[39]=v,t[40]=g,t[41]=W):W=t[41];let te;t[42]!==M||t[43]!==v?(te=v===`configure`&&!M?(0,Z.jsxs)(X,{className:`me-auto uppercase font-mono`,variant:`ghost`,onClick:V,children:[(0,Z.jsx)(Al,{"aria-hidden":`true`,className:`h-4 w-4`}),(0,Z.jsx)(Y,{id:`iH8pgl`})]}):null,t[42]=M,t[43]=v,t[44]=te):te=t[44];let G;t[45]===r?G=t[46]:(G=()=>r(!1),t[45]=r,t[46]=G);let K;t[47]===c.kind?K=t[48]:(K=c.kind===`already-seeded`||c.kind===`error`?(0,Z.jsx)(Y,{id:`yz7wBu`}):(0,Z.jsx)(Y,{id:`dEgA5A`}),t[47]=c.kind,t[48]=K);let q;t[49]!==G||t[50]!==K?(q=(0,Z.jsx)(X,{className:`uppercase font-mono`,variant:`outline`,onClick:G,children:K}),t[49]=G,t[50]=K,t[51]=q):q=t[51];let ne;t[52]!==j||t[53]!==c.kind||t[54]!==v||t[55]!==O?(ne=v===`configure`&&c.kind===`plan`?(0,Z.jsx)(X,{onClick:j,disabled:O,children:(0,Z.jsx)(Y,{id:`4TzU0n`})}):v===`configure`&&c.kind===`applying`?(0,Z.jsxs)(X,{disabled:!0,children:[(0,Z.jsx)(cf,{"aria-hidden":`true`,className:`h-4 w-4`}),(0,Z.jsx)(Y,{id:`XYlJJT`})]}):null,t[52]=j,t[53]=c.kind,t[54]=v,t[55]=O,t[56]=ne):ne=t[56];let re;t[57]!==te||t[58]!==q||t[59]!==ne?(re=(0,Z.jsxs)(Lp,{children:[te,q,ne]}),t[57]=te,t[58]=q,t[59]=ne,t[60]=re):re=t[60];let J;t[61]!==ee||t[62]!==W||t[63]!==re?(J=(0,Z.jsxs)(Fp,{className:`sm:max-w-4xl`,"data-ok-layer-spawned":``,children:[ee,W,re]}),t[61]=ee,t[62]=W,t[63]=re,t[64]=J):J=t[64];let ie;return t[65]!==r||t[66]!==n||t[67]!==J?(ie=(0,Z.jsx)(Bp,{open:n,onOpenChange:r,children:J}),t[65]=r,t[66]=n,t[67]=J,t[68]=ie):ie=t[68],ie}function BS(e){return e.pending}function VS(e){return e.kind===`plan`||e.kind===`already-seeded`?e:{kind:`loading`}}function HS(e){let t=(0,$.c)(19),{phase:n,selectedPack:r}=e;if(n.kind===`loading`){let e=r?.folders.length??6,n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(Ob,{rowCount:e}),t[0]=e,t[1]=n),n}if(n.kind===`error`){let e;return t[2]===n.message?e=t[3]:(e=(0,Z.jsx)(`div`,{className:`rounded-md bg-destructive/10 p-3 text-sm text-destructive`,children:n.message}),t[2]=n.message,t[3]=e),e}if(n.kind===`already-seeded`){let e;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(`p`,{className:`font-medium`,children:(0,Z.jsx)(Y,{id:`YwPUUP`})}),t[4]=e):e=t[4];let r;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsxs)(`div`,{children:[e,(0,Z.jsx)(`p`,{className:`text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`h-AdvS`})})]}),t[5]=r):r=t[5];let i;return t[6]===n.plan?i=t[7]:(i=(0,Z.jsxs)(`div`,{className:`space-y-3 py-2 text-sm`,children:[r,(0,Z.jsx)(WS,{plan:n.plan})]}),t[6]=n.plan,t[7]=i),i}let i;t[8]!==n.plan||t[9]!==r?(i=Io(n.plan)?(0,Z.jsx)(Nb,{plan:n.plan,selectedPack:r}):null,t[8]=n.plan,t[9]=r,t[10]=i):i=t[10];let a;t[11]===n.plan.warnings?a=t[12]:(a=n.plan.warnings.length>0?(0,Z.jsx)(`div`,{className:`rounded-md bg-warning/10 p-3 text-xs text-warning-foreground`,children:n.plan.warnings.map(US)}):null,t[11]=n.plan.warnings,t[12]=a);let o;t[13]===n.plan?o=t[14]:(o=(0,Z.jsx)(WS,{plan:n.plan}),t[13]=n.plan,t[14]=o);let s;return t[15]!==i||t[16]!==a||t[17]!==o?(s=(0,Z.jsxs)(`div`,{className:`space-y-6 py-1 text-sm`,children:[i,a,o]}),t[15]=i,t[16]=a,t[17]=o,t[18]=s):s=t[18],s}function US(e){return(0,Z.jsx)(`p`,{children:e},e)}function WS(e){let t=(0,$.c)(7),{plan:n}=e,r,i,a;if(t[0]!==n.packSkills){a=Symbol.for(`react.early_return_sentinel`);bb0:{let e=n.packSkills?.filter(KS)??[];if(e.length===0){a=null;break bb0}r=`rounded-md bg-warning/10 p-3 text-xs text-warning-foreground`,i=e.map(GS)}t[0]=n.packSkills,t[1]=r,t[2]=i,t[3]=a}else r=t[1],i=t[2],a=t[3];if(a!==Symbol.for(`react.early_return_sentinel`))return a;let o;return t[4]!==r||t[5]!==i?(o=(0,Z.jsx)(`div`,{className:r,children:i}),t[4]=r,t[5]=i,t[6]=o):o=t[6],o}function GS(e){return(0,Z.jsx)(`p`,{children:(0,Z.jsx)(Y,{id:`CtoghX`,values:{0:e.name}})},e.name)}function KS(e){return e.conflict}var qS=`Describe what this skill does and when to use it.`;function JS(){let e=(0,$.c)(8),{_:t}=xn(),n=km(),r=ef(),[i,a]=(0,Q.useState)(!1),o;e[0]!==t||e[1]!==i||e[2]!==r||e[3]!==n?(o=async function(e,o){let s=e===void 0?`project`:e;if(i)return;let c=_p(n.status===`ready`?n.data:[])[s],l=o?.name?.trim()||`new-skill`;if(!o?.name)for(let e=2;c.has(l);e++)l=`new-skill-${e}`;let u=o?.description?.trim()||`Describe what this skill does and when to use it.`;a(!0);let d=await Am({scope:s,name:l,frontmatter:{name:l,description:u},body:``});if(a(!1),!d.ok){Us.error(t({id:`xrVr_k`,values:{0:d.error}}));return}Us.success(t({id:`Yy90sM`,values:{name:l}})),r(s,l,d.path===void 0?void 0:{path:d.path})},e[0]=t,e[1]=i,e[2]=r,e[3]=n,e[4]=o):o=e[4];let s=o,c;return e[5]!==s||e[6]!==i?(c={createBlank:s,creating:i},e[5]=s,e[6]=i,e[7]=c):c=e[7],c}function YS(){return(0,Q.useSyncExternalStore)(rh,ih,ih)}function XS(e,t){return e instanceof Error&&e.message?e.message:t}async function ZS(e,t,n,r=`action`){try{n(null),await e()}catch(e){console.error(`[${r}] action failed:`,e),n(XS(e,t))}}async function QS(e,t,n=Us,r=`action`){await ZS(e,t,e=>{e!==null&&n.error(e)},r)}var $S=(0,Q.createContext)(!1);function eC(e){let t=(0,$.c)(5),{children:n}=e,[r,i]=(0,Q.useState)(nC),a,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>{if(window.okDesktop)return;let e=new AbortController;return Ym(e.signal).then(t=>{e.signal.aborted||t.status!==`ok`||i(t.config.singleFile)}).catch(tC),()=>e.abort()},o=[],t[0]=a,t[1]=o):(a=t[0],o=t[1]),(0,Q.useEffect)(a,o);let s;return t[2]!==n||t[3]!==r?(s=(0,Z.jsx)($S,{value:r,children:n}),t[2]=n,t[3]=r,t[4]=s):s=t[4],s}function tC(){}function nC(){return typeof window<`u`?window.okDesktop?.config.singleFile??!1:!1}function rC(){return(0,Q.use)($S)}function iC(e){return e.opened?e.isMain?`primary`:`worktree`:`none`}function aC(e,t,n){let r=[],i=new Set,a=new Set,o=t!==null&&t.mainRoot===e.project.mainRoot;e.projectSynthesized||(r.push({branch:e.project.branch??null,path:e.project.path,opened:!0,isMain:!0,isCurrent:e.project.path===n}),i.add(e.project.path),e.project.branch!=null&&a.add(e.project.branch));let s=[...e.worktrees].sort((e,t)=>t.lastOpenedAt.localeCompare(e.lastOpenedAt));for(let e of s)i.has(e.path)||(r.push({branch:e.branch??null,path:e.path,opened:!0,isMain:!1,isCurrent:e.path===n}),i.add(e.path),e.branch!=null&&a.add(e.branch));if(o){let e=t.entries.filter(e=>e.branch!==null&&!a.has(e.branch)&&(e.worktreePath===null||!i.has(e.worktreePath))).sort((e,t)=>(e.branch??``).localeCompare(t.branch??``));for(let t of e)r.push({branch:t.branch,path:t.worktreePath,opened:t.worktreePath!==null,isMain:t.isMain,isCurrent:t.isCurrent}),t.branch!=null&&a.add(t.branch),t.worktreePath!=null&&i.add(t.worktreePath)}return r.sort((e,t)=>oC(e)-oC(t))}function oC(e){return e.isMain?0:e.opened?1:2}function sC(e){let t=e.split(/[/\\]/).filter(e=>e.length>0);return t.length>0?t[t.length-1]??e:e}function cC(e){let t=[],n=new Map;for(let r of e){let e=r.gitCommonDir,i=r.mainRoot;if(e===void 0||i===void 0){t.push({project:r,mainRoot:r.path,worktrees:[]});continue}let a=n.get(e);a===void 0&&(a=t.length,n.set(e,a),t.push({project:null,mainRoot:i,worktrees:[]}));let o=t[a];o!==void 0&&(r.isLinkedWorktree?o.worktrees.push(r):o.project===null&&(o.project=r))}return t.map(e=>{let t=e.project===null;return{project:e.project??{path:e.mainRoot,name:sC(e.mainRoot),lastOpenedAt:``},worktrees:e.worktrees,projectSynthesized:t}})}function lC(e){let t=(0,$.c)(14),{path:n,name:r,onRemoveRecent:i,testIdPrefix:a}=e,{_:o}=xn(),s;t[0]!==o||t[1]!==r?(s=o({id:`Y6PKd1`,values:{name:r}}),t[0]=o,t[1]=r,t[2]=s):s=t[2];let c;t[3]===o?c=t[4]:(c=o({id:`Es-eZU`}),t[3]=o,t[4]=c);let l;t[5]!==i||t[6]!==n?(l=e=>{e.stopPropagation(),i(n)},t[5]=i,t[6]=n,t[7]=l):l=t[7];let u=`${a}-remove-${n}`,d;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Gf,{"aria-hidden":`true`,className:`size-3.5`}),t[8]=d):d=t[8];let f;return t[9]!==s||t[10]!==c||t[11]!==l||t[12]!==u?(f=(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,tabIndex:-1,"aria-hidden":`true`,"aria-label":s,title:c,onClick:l,className:`absolute top-1/2 right-1 size-6 -translate-y-1/2 text-muted-foreground opacity-0 transition-opacity group-hover/recent:opacity-100 focus-visible:opacity-100`,"data-testid":u,children:d}),t[9]=s,t[10]=c,t[11]=l,t[12]=u,t[13]=f):f=t[13],f}function uC(e){let t=(0,$.c)(13),{path:n,onRemoveRecent:r,testIdPrefix:i,children:a}=e,o;t[0]===a?o=t[1]:(o=(0,Z.jsx)(Si,{asChild:!0,children:a}),t[0]=a,t[1]=o);let s;t[2]!==r||t[3]!==n?(s=()=>r(n),t[2]=r,t[3]=n,t[4]=s):s=t[4];let c=`${i}-context-remove-${n}`,l,u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(Gf,{"aria-hidden":`true`}),u=(0,Z.jsx)(Y,{id:`Es-eZU`}),t[5]=l,t[6]=u):(l=t[5],u=t[6]);let d;t[7]!==s||t[8]!==c?(d=(0,Z.jsx)(ji,{children:(0,Z.jsxs)(Ti,{onSelect:s,"data-testid":c,children:[l,u]})}),t[7]=s,t[8]=c,t[9]=d):d=t[9];let f;return t[10]!==o||t[11]!==d?(f=(0,Z.jsxs)(_i,{children:[o,d]}),t[10]=o,t[11]=d,t[12]=f):f=t[12],f}var dC=(0,Q.lazy)(()=>n(()=>import(`./BugReportHistoryDialog-DwoT3Jcu.js`),__vite__mapDeps([48,14,1,15,16,33,34,18,19,20,26,29,28,27,24,35,36,31,32,3,4,37,38,39,40,42,43,44,45,46]),import.meta.url)),fC=3e3,pC=600,mC=20,hC=(e,t,n)=>QS(e,t,n,`CommandPalette`);function gC(e){window.location.assign(ep(e))}function _C(e,t){return e?.kind===`folder`||e?.kind===`folder-index`?e.folderPath:Jp(t)}function vC(e){let t=(0,$.c)(27),{entry:n,query:r,onSelect:i,disabled:a}=e,o=r===void 0?``:r,s=a===void 0?!1:a,c;t[0]===n?c=t[1]:(c=`title`in n&&n.title?n.title:n.path.split(`/`).pop()??n.path,t[0]=n,t[1]=c);let l=c,u=`snippet`in n?n.snippet:void 0,d=`docExt`in n?n.docExt:void 0,f=`bodyIndexed`in n?n.bodyIndexed:void 0,p=`${n.kind} ${n.path}`,m=`command-palette-nav-${n.kind}-${n.path}`,h;t[2]!==f||t[3]!==d||t[4]!==n.kind||t[5]!==n.path?(h=(0,Z.jsx)(Ve,{bodyIndexed:f,className:`mt-0.5 size-4`,docExt:d,kind:n.kind,path:n.path}),t[2]=f,t[3]=d,t[4]=n.kind,t[5]=n.path,t[6]=h):h=t[6];let g;t[7]!==o||t[8]!==l?(g=(0,Z.jsx)(Rl,{className:`truncate font-medium`,children:(0,Z.jsx)(bC,{query:o,text:l})}),t[7]=o,t[8]=l,t[9]=g):g=t[9];let _;t[10]!==n.path||t[11]!==o?(_=(0,Z.jsx)(Rl,{className:`truncate text-muted-foreground text-xs`,children:(0,Z.jsx)(bC,{query:o,text:n.path})}),t[10]=n.path,t[11]=o,t[12]=_):_=t[12];let v;t[13]!==o||t[14]!==u?(v=u?(0,Z.jsx)(Rl,{className:`max-h-10 overflow-hidden text-muted-foreground text-xs leading-relaxed`,children:(0,Z.jsx)(bC,{query:o,text:u})}):null,t[13]=o,t[14]=u,t[15]=v):v=t[15];let y;t[16]!==g||t[17]!==_||t[18]!==v?(y=(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[g,_,v]}),t[16]=g,t[17]=_,t[18]=v,t[19]=y):y=t[19];let b;return t[20]!==s||t[21]!==i||t[22]!==y||t[23]!==p||t[24]!==m||t[25]!==h?(b=(0,Z.jsxs)(H,{value:p,onSelect:i,disabled:s,"data-testid":m,className:`items-start`,children:[h,y]}),t[20]=s,t[21]=i,t[22]=y,t[23]=p,t[24]=m,t[25]=h,t[26]=b):b=t[26],b}function yC(e){let t=(0,$.c)(5),{mode:n,inExclusiveMode:r,paletteModeKind:i}=e;if(r||i!==`normal`||n===`idle`||n===`content`)return null;let a=`command-palette-search-hint-${n}`,o;t[0]===n?o=t[1]:(o=n===`name-only`?(0,Z.jsx)(Y,{id:`GuLeuE`,values:{0:Js(`find`)},components:{0:(0,Z.jsx)(O,{"aria-label":Ys(`find`)})}}):n===`truncated`?(0,Z.jsx)(Y,{id:`-q4abP`}):(0,Z.jsx)(Y,{id:`DbILZA`}),t[0]=n,t[1]=o);let s;return t[2]!==a||t[3]!==o?(s=(0,Z.jsx)(`div`,{"aria-live":`polite`,"data-testid":a,className:`border-t px-3 py-2 text-muted-foreground text-xs`,children:o}),t[2]=a,t[3]=o,t[4]=s):s=t[4],s}function bC(e){let t=(0,$.c)(5),{text:n,query:r}=e,i;t[0]!==r||t[1]!==n?(i=aS(n,r).map(xC),t[0]=r,t[1]=n,t[2]=i):i=t[2];let a;return t[3]===i?a=t[4]:(a=(0,Z.jsx)(Z.Fragment,{children:i}),t[3]=i,t[4]=a),a}function xC(e){let t=`${e.start}:${e.match?`match`:`plain`}`;return e.match?(0,Z.jsx)(`mark`,{className:`rounded-sm bg-primary/10 px-0.5 font-semibold text-primary`,children:e.text},t):(0,Z.jsx)(`span`,{children:e.text},t)}function SC({searchResults:e,fallbackSearchResults:t,searchStatus:n}){return e.length>0?e:n===`success`?[]:t}function CC(e){let t=(0,$.c)(150),{bridge:n,open:r,onOpenChange:i}=e,a=n===void 0?null:n,{_:o}=xn(),s=rC(),[c,l]=(0,Q.useState)(``),d=(0,Q.useDeferredValue)(c),f=d.trim(),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=[],t[0]=p):p=t[0];let[m,h]=(0,Q.useState)(p),[g,_]=(0,Q.useState)(`idle`),[v,y]=(0,Q.useState)(!1),[b,x]=(0,Q.useState)(!1),[S,C]=(0,Q.useState)(!1),w;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(w=[],t[1]=w):w=t[1];let[T,E]=(0,Q.useState)(w),[D,A]=(0,Q.useState)(null),[j,M]=(0,Q.useState)(`idle`),P;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(P=[],t[2]=P):P=t[2];let[F,I]=(0,Q.useState)(P),L;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(L=[],t[3]=L):L=t[3];let[R,B]=(0,Q.useState)(L),[V,U]=(0,Q.useState)(null),[ee,W]=(0,Q.useState)(!1),[te,G]=(0,Q.useState)(!1),[K,q]=(0,Q.useState)(!1),[ne,J]=(0,Q.useState)(!1),[ie,ae]=(0,Q.useState)(!1),[oe,se]=(0,Q.useState)(!1),{createBlank:ce}=JS(),le=Xt(),ue;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(ue=[],t[4]=ue):ue=t[4];let[de,fe]=(0,Q.useState)(ue),[pe,me]=(0,Q.useState)(`idle`),he;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(he=[],t[5]=he):he=t[5];let[ge,_e]=(0,Q.useState)(he),[ve,ye]=(0,Q.useState)(`idle`),be=(0,Q.useRef)(!1),xe=(0,Q.useRef)(null),Se=(0,Q.useRef)(null),Ce=(0,Q.useRef)(null),we=(0,Q.useRef)(null),{activeDocName:Te,activeTarget:Ee}=Ke(),{pages:Oe,pageTitles:ke,pageMeta:Ae,folderPaths:je,filePaths:Me,loading:Pe}=Lu(),Fe=xl(),{states:Ie,refresh:Le}=nr(),{dispatch:Re}=gl(),ze;t[6]===r?ze=t[7]:(ze={enabled:r},t[6]=r,t[7]=ze);let{status:Be,refresh:Ve}=od(ze),He=(Be?.enabled??!1)&&(Be?.keyPresent??!1),Ue=Be?.embedded??0,We=Be?.total??0,Ge=He&&We>0&&Ue<We,qe;t[8]!==S||t[9]!==r||t[10]!==Ve||t[11]!==Ge?(qe=()=>{if(!r||!S||!Ge)return;let e=window.setInterval(()=>Ve(),2500);return()=>window.clearInterval(e)},t[8]=S,t[9]=r,t[10]=Ve,t[11]=Ge,t[12]=qe):qe=t[12];let Je;t[13]!==S||t[14]!==r||t[15]!==Ge?(Je=[r,S,Ge],t[13]=S,t[14]=r,t[15]=Ge,t[16]=Je):Je=t[16],(0,Q.useEffect)(qe,Je);let Ye=hl({docName:Te,workspace:Fe}),Xe=Qx(Oe,je,ke,Ae,Me),Ze=Wx(R,new Set(Xe.map(DC))),Qe=a?.config.projectPath??null,$e=a?F.filter(e=>e.path!==Qe):[],et=YS(),tt=a&&et?et.entries.filter(EC):[],nt;t[17]!==Te||t[18]!==Ee?(nt=_C(Ee,Te),t[17]=Te,t[18]=Ee,t[19]=nt):nt=t[19];let rt=nt,it=f===``?[]:rS(Xe,f,8),at,ot;t[20]!==i||t[21]!==r?(at=()=>{let e=function(e){rc(e,`command-palette`)&&(e.preventDefault(),!(!r&&pr())&&i(!r))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},ot=[i,r],t[20]=i,t[21]=r,t[22]=at,t[23]=ot):(at=t[22],ot=t[23]),(0,Q.useEffect)(at,ot);let st,ct;t[24]!==o||t[25]!==a||t[26]!==r||t[27]!==Le?(st=()=>{if(r){if(B(Vx()),Le(),a){let e=!1;return hC(async()=>{let t=await a.project.listRecent();e||I(t)},o({id:`fYKgzG`})),()=>{e=!0}}return}l(``),fe([]),me(`idle`),be.current=!1,_e([]),ye(`idle`),C(!1),Ce.current?.abort(),Ce.current=null,we.current!==null&&(window.clearTimeout(we.current),we.current=null),E([]),A(null),M(`idle`)},ct=[r,a,Le,o],t[24]=o,t[25]=a,t[26]=r,t[27]=Le,t[28]=st,t[29]=ct):(st=t[28],ct=t[29]),(0,Q.useEffect)(st,ct);let lt;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(lt=()=>{xe.current&&(xe.current.scrollTop=0)},t[30]=lt):lt=t[30];let ut;t[31]===c?ut=t[32]:(ut=[c],t[31]=c,t[32]=ut),(0,Q.useEffect)(lt,ut);let dt=new Set(de.map(TC)),ft=S?{kind:`normal`,query:d}:fS(d,dt),pt=ft.kind!==`normal`,mt=pt||S,ht=ft.kind===`tag-list`?ft.query:``,gt=ft.kind===`tag-docs`?ft.tagName:``,_t=c.trim(),vt=S?uS({query:_t,firedQuery:D,status:j,resultCount:T.length}):null,yt=vt?.submit?.query??``,bt=vt?.results.forQuery??``,xt,St;t[33]!==pt||t[34]!==r?(xt=()=>{if(!r||!pt||be.current)return;be.current=!0,me(`loading`);let e=!1;return mS().then(t=>{e||(fe(t),me(`success`))}).catch(t=>{e||(console.error(`[command-palette-tag] fetch tags failed`,t),fe([]),me(`error`))}),()=>{e=!0}},St=[r,pt],t[33]=pt,t[34]=r,t[35]=xt,t[36]=St):(xt=t[35],St=t[36]),(0,Q.useEffect)(xt,St);let Ct=ft.kind===`tag-docs`?ft.tagName:null;(0,Q.useEffect)(()=>{if(!r||Ct===null){_e([]),ye(`idle`);return}ye(`loading`),_e([]);let e=!1;return hS(Ct).then(t=>{e||(_e(t),ye(`success`))}).catch(t=>{e||(console.error(`[command-palette-tag] fetch tag docs failed`,t),_e([]),ye(`error`))}),()=>{e=!0}},[r,Ct]),(0,Q.useEffect)(()=>{if(!r||!f||mt||Pe){h([]),_(`idle`),y(!1),x(!1);return}let e=!1,t=!1,n=0,i=null,a,o;_(`loading`);let s=()=>e||n>=mC?!1:(n+=1,o=window.setTimeout(l,pC),!0),c=()=>{e||t&&s()||(h([]),_(`error`),y(!1),x(!1))};function l(){let n=new AbortController;i=n,a=window.setTimeout(()=>{n.abort(),c()},fC),sS(f,{signal:n.signal}).then(n=>{let{entries:r,truncated:i,ready:o}=n;if(window.clearTimeout(a),!e){if(!o){t||(t=!0,h([]),y(!1),x(!0),_(`success`)),s()||x(!1);return}h(r),y(i),x(!1),_(`success`)}}).catch(t=>{window.clearTimeout(a),!e&&(t instanceof Error&&t.name===`AbortError`||c())})}return l(),()=>{e=!0,window.clearTimeout(a),window.clearTimeout(o),i?.abort()}},[r,f,mt,Pe]);let wt;t[37]!==o||t[38]!==i?(wt=(e,t)=>{let n=t===void 0?o({id:`uuoHOU`}):t;i(!1),hC(async()=>{await e()},n)},t[37]=o,t[38]=i,t[39]=wt):wt=t[39];let Tt=wt,Et;t[40]!==o||t[41]!==a?(Et=e=>{a&&hC(async()=>{await a.project.removeRecent(e),I(t=>t.filter(t=>t.path!==e))},o({id:`viwC-K`}))},t[40]=o,t[41]=a,t[42]=Et):Et=t[42];let Dt=Et,Ot;t[43]!==o||t[44]!==a||t[45]!==Tt?(Ot=e=>{if(!a)return;let t=e.worktreePath;if(t!==null){Tt(()=>a.project.open({path:t,target:`new-window`,entryPoint:`worktree`}),o({id:`LwMxXg`}));return}let n=e.branch;n!==null&&Tt(async()=>{let e=await a.worktree.create({branch:n,createBranch:!1});if(!e.ok)throw Error(e.reason);ah(),await a.project.open({path:e.path,target:`new-window`,entryPoint:`worktree`})},o({id:`LwMxXg`}))},t[43]=o,t[44]=a,t[45]=Tt,t[46]=Ot):Ot=t[46];let kt=Ot,At;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(At=function(e){let t={kind:e.kind,path:e.path,lastOpenedAt:new Date().toISOString()},n=Ux(Vx(),t);Hx(n),B(n)},t[47]=At):At=t[47];let jt=At,Mt;t[48]===i?Mt=t[49]:(Mt=function(e){i(!1),jt(e),gC(e.path)},t[48]=i,t[49]=Mt);let Nt=Mt,Pt=!mt&&f===``&&Ze.length>0,Ft=SC({searchResults:m,fallbackSearchResults:it,searchStatus:g}),It=!mt&&Ft.length>0,Lt=!mt&&f!==``&&(Pe||b)&&!It,Rt=!mt&&f!==``&&g===`loading`&&!It&&!Lt,zt=!mt&&a!==null&&$e.length>0&&(f===``||$e.some(e=>cS(`${e.name} ${e.path}`,d,[`open recent project`]))),Bt=tt.filter(e=>f===``||cS(e.branch??``,d,[`worktree branch`])),Vt=!mt&&a!==null&&Bt.length>0,Ht=u(),Ut=!mt&&!Ht&&Ye!==null&&(f===``||hi.some(e=>{let t=e.displayName;return cS(o({id:`wHZ58m`,values:{displayName:t}}),d,[e.id,`agent handoff`,`open in`])})),Wt=ft.kind===`tag-list`?pS(de,ft.query):[],Gt=ft.kind===`tag-list`&&pe!==`loading`&&Wt.length===0,qt=ft.kind===`tag-docs`&&ve===`success`&&ge.length===0,Jt=xc(),Yt;t[50]===i?Yt=t[51]:(Yt=e=>{i(!1),Zn(e)},t[50]=i,t[51]=Yt);let Zt=Yt,Qt;t[52]!==a||t[53]!==i?(Qt=e=>{i(!1),eh(e,a?{okDesktop:{shell:a.shell}}:{okDesktop:void 0})},t[52]=a,t[53]=i,t[54]=Qt):Qt=t[54];let $t=Qt,en;t[55]===i?en=t[56]:(en=()=>i(!1),t[55]=i,t[56]=en);let tn;t[57]===U?tn=t[58]:(tn=e=>U(e),t[57]=U,t[58]=tn);let nn;t[59]===W?nn=t[60]:(nn=()=>W(!0),t[59]=W,t[60]=nn);let rn;t[61]===G?rn=t[62]:(rn=()=>G(!0),t[61]=G,t[62]=rn);let an;t[63]===q?an=t[64]:(an=()=>q(!0),t[63]=q,t[64]=an);let on;t[65]===J?on=t[66]:(on=()=>{ae(!0),J(!0)},t[65]=J,t[66]=on);let sn;t[67]===se?sn=t[68]:(sn=()=>se(!0),t[67]=se,t[68]=sn);let cn;t[69]===ce?cn=t[70]:(cn=()=>void ce(`project`),t[69]=ce,t[70]=cn);let ln;t[71]===le?ln=t[72]:(ln=()=>le?.(),t[71]=le,t[72]=ln);let un={bridge:a,singleFile:s,activeDocName:Te,contextualTargetKind:Tx(Ee),viewMenuState:Jt,emitMenuAction:Zt,runAction:Tt,openExternalUrl:$t,closePalette:en,openNewItemDialog:tn,openSeedDialog:nn,openCreateProjectDialog:rn,openReportBugDialog:an,openBugReportHistory:on,openFeedbackDialog:sn,createBlankSkill:cn,openBlobRun:ln},dn=mt?[]:Fx.flatMap(e=>{if(!e.available(un)||e.visibility===`search-only`&&f===``)return[];let t=e.label(un);return cS(t,d,e.keywords)?[{cmd:e,label:t}]:[]}),fn=dn.length>0,pn;t[73]===o?pn=t[74]:(pn=e=>{switch(e){case`commands`:return o({id:`45MZFs`});case`project`:return o({id:`e0NrBM`});case`file`:return o({id:`J2eKUI`});case`view`:return o({id:`jpctdh`});case`terminal`:return o({id:`ALhMYW`});case`app`:return o({id:`IrC12v`})}},t[73]=o,t[74]=pn);let mn=pn,hn=e=>{let t=dn.filter(t=>t.cmd.group===e);return t.length===0?null:(0,Z.jsx)(Ne,{heading:mn(e),children:t.map(e=>{let{cmd:t,label:n}=e,r=t.shortcutId!==void 0&&(t.shortcutDesktopOnly!==!0||a!==null)?Js(t.shortcutId):null;return(0,Z.jsxs)(H,{value:`${n} ${t.keywords.join(` `)}`,onSelect:()=>t.dispatch(un),"data-testid":`command-palette-${t.id}`,children:[(0,Z.jsx)(t.icon,{}),(0,Z.jsx)(`span`,{children:n}),t.checked?.(un)?(0,Z.jsx)(Yl,{className:`ml-auto text-muted-foreground`,"aria-hidden":`true`}):null,r?(0,Z.jsx)(z,{children:r}):null]},t.id)})},e)},gn=mt||Pt||It||Rt||Lt||zt||Ut||fn,_n;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(_n=function(e){l(`${dS}${e}`)},t[75]=_n):_n=t[75];let vn=_n,yn;t[76]===Symbol.for(`react.memo_cache_sentinel`)?(yn=function(){Ce.current?.abort(),Ce.current=null,we.current!==null&&(window.clearTimeout(we.current),we.current=null),E([]),A(null),M(`idle`)},t[76]=yn):yn=t[76];let bn=yn,Sn;t[77]===c?Sn=t[78]:(Sn=function(){C(!0),c.startsWith(`tag:`)&&l(c.slice(dS.length)),bn(),Se.current?.focus()},t[77]=c,t[78]=Sn);let Cn=Sn,wn;t[79]===Symbol.for(`react.memo_cache_sentinel`)?(wn=function(){C(!1),l(``),bn(),Se.current?.focus()},t[79]=wn):wn=t[79];let Tn=wn,En=function(e){let t=e.trim();if(!t||Pe)return;Ce.current?.abort(),we.current!==null&&window.clearTimeout(we.current);let n=new AbortController;Ce.current=n,M(`loading`);let r=!1,i=window.setTimeout(()=>{r=!0,n.abort(),M(`error`)},fC);we.current=i,sS(t,{signal:n.signal,semantic:!0,limit:30}).then(e=>{let{entries:r}=e;Dn(i,n),E(r),A(t),M(`success`)}).catch(e=>{Dn(i,n),!(e instanceof Error&&e.name===`AbortError`&&!r)&&(console.debug(`[semantic-search] fire failed`,{timedOut:r,error:e}),M(`error`))})};function Dn(e,t){window.clearTimeout(e),we.current===e&&(we.current=null),Ce.current===t&&(Ce.current=null)}let On=function(e){!S||e.key!==`Enter`||(vt?.submit?(e.preventDefault(),e.stopPropagation(),En(vt.submit.query)):j===`loading`&&(e.preventDefault(),e.stopPropagation()))},kn;t[80]===S?kn=t[81]:(kn=function(e){S&&(e.preventDefault(),Tn())},t[80]=S,t[81]=kn);let An=kn,jn;t[82]===o?jn=t[83]:(jn=o({id:`1bDVu5`}),t[82]=o,t[83]=jn);let Mn;t[84]===o?Mn=t[85]:(Mn=o({id:`5GRxoA`}),t[84]=o,t[85]=Mn);let Nn;t[86]===Symbol.for(`react.memo_cache_sentinel`)?(Nn={shouldFilter:!1,vimBindings:!1,className:`[&_[cmdk-input-wrapper]_svg]:h-4 [&_[cmdk-input-wrapper]_svg]:w-4 [&_[cmdk-item]_svg]:h-4 [&_[cmdk-item]_svg]:w-4`},t[86]=Nn):Nn=t[86];let Pn;t[87]!==o||t[88]!==S?(Pn=o(S?{id:`zXj1rA`}:{id:`ggs9f8`}),t[87]=o,t[88]=S,t[89]=Pn):Pn=t[89];let Fn;t[90]!==S||t[91]!==pt?(Fn=()=>{S&&(C(!1),bn()),l(pt?``:dS),Se.current?.focus()},t[90]=S,t[91]=pt,t[92]=Fn):Fn=t[92];let In=pt?`border-primary/30 bg-primary/10 text-primary`:`border-border bg-transparent text-muted-foreground hover:bg-accent hover:text-accent-foreground`,Ln;t[93]===In?Ln=t[94]:(Ln=Qn(`inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium transition-colors`,In),t[93]=In,t[94]=Ln);let Rn,zn;t[95]===Symbol.for(`react.memo_cache_sentinel`)?(Rn=(0,Z.jsx)(rf,{className:`size-3.5`}),zn=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(Y,{id:`0rwwOn`})}),t[95]=Rn,t[96]=zn):(Rn=t[95],zn=t[96]);let Bn;t[97]!==pt||t[98]!==Fn||t[99]!==Ln?(Bn=(0,Z.jsxs)(`button`,{type:`button`,onClick:Fn,"data-testid":`command-palette-filter-tag`,"data-active":pt,"aria-pressed":pt,className:Ln,children:[Rn,zn]}),t[97]=pt,t[98]=Fn,t[99]=Ln,t[100]=Bn):Bn=t[100];let Vn;t[101]!==Cn||t[102]!==S||t[103]!==He?(Vn=He?(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>S?Tn():Cn(),"data-testid":`command-palette-filter-semantic`,"data-active":S,"aria-pressed":S,className:Qn(`inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium transition-colors`,S?`border-primary/30 bg-primary/10 text-primary`:`border-border bg-transparent text-muted-foreground hover:bg-accent hover:text-accent-foreground`),children:[(0,Z.jsx)(re,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(Y,{id:`9tJX8r`})})]}):null,t[101]=Cn,t[102]=S,t[103]=He,t[104]=Vn):Vn=t[104];let Hn;t[105]!==Bn||t[106]!==Vn?(Hn=(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-1.5 border-b px-3 py-2`,children:[Bn,Vn]}),t[105]=Bn,t[106]=Vn,t[107]=Hn):Hn=t[107];let Un;t[108]===Lt?Un=t[109]:(Un=Lt?(0,Z.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-6 text-muted-foreground text-sm`,role:`status`,"aria-live":`polite`,"data-testid":`command-palette-search-preparing`,children:[(0,Z.jsx)(cf,{"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(Y,{id:`yIPXut`})]}):null,t[108]=Lt,t[109]=Un);let Wn;t[110]!==It||t[111]!==Rt?(Wn=Rt&&!It?(0,Z.jsx)(De,{children:(0,Z.jsx)(Y,{id:`WRNXKp`})}):null,t[110]=It,t[111]=Rt,t[112]=Wn):Wn=t[112];let Gn=yC,Kn=lS(f,Ft,{truncated:v}),qn;t[113]!==Gn||t[114]!==mt||t[115]!==ft.kind||t[116]!==Kn?(qn=(0,Z.jsx)(Gn,{mode:Kn,inExclusiveMode:mt,paletteModeKind:ft.kind}),t[113]=Gn,t[114]=mt,t[115]=ft.kind,t[116]=Kn,t[117]=qn):qn=t[117];let Jn=V===`file`,Yn;t[118]===U?Yn=t[119]:(Yn=e=>{e||U(null)},t[118]=U,t[119]=Yn);let Xn;t[120]!==rt||t[121]!==Jn||t[122]!==Yn?(Xn=(0,Z.jsx)(jS,{open:Jn,onOpenChange:Yn,kind:`file`,initialDir:rt}),t[120]=rt,t[121]=Jn,t[122]=Yn,t[123]=Xn):Xn=t[123];let $n=V===`folder`,er;t[124]===U?er=t[125]:(er=e=>{e||U(null)},t[124]=U,t[125]=er);let tr;t[126]!==rt||t[127]!==$n||t[128]!==er?(tr=(0,Z.jsx)(jS,{open:$n,onOpenChange:er,kind:`folder`,initialDir:rt}),t[126]=rt,t[127]=$n,t[128]=er,t[129]=tr):tr=t[129];let rr;t[130]!==ee||t[131]!==W?(rr=(0,Z.jsx)(zS,{open:ee,onOpenChange:W}),t[130]=ee,t[131]=W,t[132]=rr):rr=t[132];let ir;t[133]!==a||t[134]!==te||t[135]!==G?(ir=a?(0,Z.jsx)(lx,{open:te,onOpenChange:G,bridge:a}):null,t[133]=a,t[134]=te,t[135]=G,t[136]=ir):ir=t[136];let ar;t[137]!==a||t[138]!==K||t[139]!==q?(ar=a?(0,Z.jsx)(Uv,{open:K,onOpenChange:q}):null,t[137]=a,t[138]=K,t[139]=q,t[140]=ar):ar=t[140];let or;t[141]!==a||t[142]!==ie||t[143]!==ne||t[144]!==J||t[145]!==q?(or=a&&ie?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(dC,{open:ne,onOpenChange:J,onReportABug:()=>{J(!1),q(!0)}})}):null,t[141]=a,t[142]=ie,t[143]=ne,t[144]=J,t[145]=q,t[146]=or):or=t[146];let sr;return t[147]!==oe||t[148]!==se?(sr=(0,Z.jsx)(_S,{open:oe,onOpenChange:se,source:`command_palette`}),t[147]=oe,t[148]=se,t[149]=sr):sr=t[149],(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(N,{open:r,onOpenChange:i,title:jn,description:Mn,className:`sm:max-w-2xl`,commandProps:Nn,onEscapeKeyDown:An,children:[(0,Z.jsx)(k,{ref:Se,value:c,onValueChange:l,onKeyDown:On,placeholder:Pn}),Hn,(0,Z.jsxs)(Kt,{ref:xe,className:`subtle-scrollbar`,children:[S&&vt?(0,Z.jsxs)(Z.Fragment,{children:[Ge?(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 text-muted-foreground text-xs`,role:`status`,"aria-live":`polite`,"data-testid":`command-palette-semantic-indexing`,children:[(0,Z.jsx)(cf,{"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(Y,{id:`kCNU4q`,values:{semanticIndexedCount:Ue,semanticTotalCount:We}})]}):null,vt.submit?(0,Z.jsx)(Ne,{children:(0,Z.jsx)(H,{value:`semantic-submit`,onSelect:()=>En(yt),"data-testid":`command-palette-semantic-submit`,children:vt.submit.kind===`retry`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(re,{}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-amber-700 dark:text-amber-400`,children:(0,Z.jsx)(Y,{id:`w4ZzmQ`})}),(0,Z.jsx)(z,{children:`↵`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(re,{}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:(0,Z.jsx)(Y,{id:`FNTx6u`,values:{semanticSubmitQuery:yt}})}),(0,Z.jsx)(z,{children:`↵`})]})})}):null,vt.notice===`empty`?(0,Z.jsx)(De,{"data-testid":`command-palette-semantic-empty`,children:(0,Z.jsx)(Y,{id:`l5J_HM`,components:{0:(0,Z.jsx)(O,{"aria-label":o({id:`9Vnjc9`})})}})}):null,vt.notice===`searching`?(0,Z.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-6 text-muted-foreground text-sm`,role:`status`,"aria-live":`polite`,"data-testid":`command-palette-semantic-searching`,children:[(0,Z.jsx)(cf,{"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(Y,{id:`PBwmDJ`})]}):null,vt.notice===`no-results`?(0,Z.jsx)(De,{"data-testid":`command-palette-semantic-no-results`,children:(0,Z.jsx)(Y,{id:`yFyZMJ`,values:{semanticQueryText:_t}})}):null,vt.results.show?(0,Z.jsx)(Ne,{heading:vt.results.dimmed?o({id:`QlxHAH`,values:{semanticResultsLabel:bt}}):o({id:`9tJX8r`}),children:(0,Z.jsx)(`div`,{"data-testid":`command-palette-semantic-results`,"data-dimmed":vt.results.dimmed,children:T.map(e=>(0,Z.jsx)(vC,{entry:e,disabled:vt.results.dimmed,onSelect:()=>Nt(e)},Bx(e.kind,e.path)))})}):null]}):null,Un,Wn,gn?null:(0,Z.jsx)(De,{children:g===`error`?(0,Z.jsx)(Y,{id:`pkAft1`}):(0,Z.jsx)(Y,{id:`i3f2kh`})}),ft.kind===`tag-list`?(0,Z.jsxs)(Ne,{heading:ft.query?o({id:`evs0iw`,values:{tagListQuery:ht}}):o({id:`2QM24L`}),children:[pe===`loading`?(0,Z.jsx)(De,{children:(0,Z.jsx)(Y,{id:`a_u4ck`})}):null,pe===`error`?(0,Z.jsx)(De,{children:(0,Z.jsx)(Y,{id:`qTcZZu`,components:{0:(0,Z.jsx)(O,{"aria-label":o({id:`69KLIV`})})}})}):null,Gt?(0,Z.jsx)(De,{children:ft.query?o({id:`X0ttSN`,values:{tagListQuery:ht}}):o({id:`JLUTgi`})}):null,Wt.map(e=>(0,Z.jsxs)(H,{value:`tag ${e.name}`,onSelect:()=>vn(e.name),"data-testid":`command-palette-tag-${e.name}`,children:[(0,Z.jsx)(rf,{}),(0,Z.jsx)(Rl,{className:`min-w-0 flex-1 truncate font-medium`,children:e.name}),(0,Z.jsx)(`span`,{className:`ml-auto shrink-0 text-[11px] text-muted-foreground tabular-nums`,children:(0,Z.jsx)(Y,{id:`fVcm9t`,values:{0:e.count}})})]},`tag:${e.name}`))]}):null,ft.kind===`tag-docs`?(0,Z.jsxs)(Ne,{heading:o({id:`hGmuTc`,values:{tagDocsName:gt}}),children:[ve===`loading`?(0,Z.jsx)(De,{children:(0,Z.jsx)(Y,{id:`pWbsW6`})}):null,ve===`error`?(0,Z.jsx)(De,{children:(0,Z.jsx)(Y,{id:`z_4xza`,components:{0:(0,Z.jsx)(O,{"aria-label":o({id:`69KLIV`})})}})}):null,qt?(0,Z.jsx)(De,{children:o({id:`NIWAux`,values:{tagDocsName:gt}})}):null,ge.map(e=>{let t=e.title||e.docName.split(`/`).pop()||e.docName,n=e.matchingTags.filter(e=>e!==ft.tagName).map(wC).join(`, `);return(0,Z.jsxs)(H,{value:`tag-doc ${e.docName}`,onSelect:()=>{i(!1),gC(e.docName)},"data-testid":`command-palette-tag-doc-${e.docName}`,className:`items-start`,children:[(0,Z.jsx)(Xr,{className:`mt-0.5`}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Z.jsx)(Rl,{className:`truncate font-medium`,children:t}),(0,Z.jsx)(Rl,{className:`truncate text-muted-foreground text-xs`,children:e.docName}),e.matchingTags.length>0&&e.matchingTags.some(e=>e!==ft.tagName)?(0,Z.jsx)(`span`,{className:`truncate text-muted-foreground text-[11px]`,children:(0,Z.jsx)(Y,{id:`CvsD6Y`,values:{viaTags:n}})}):null]})]},`tag-doc:${e.docName}`)})]}):null,Pt?(0,Z.jsx)(Ne,{heading:o({id:`MmDDWK`}),children:Ze.map(e=>(0,Z.jsx)(vC,{entry:e,onSelect:()=>Nt(e)},Bx(e.kind,e.path)))}):null,hn(`commands`),Ut?(0,Z.jsx)(Ne,{heading:o({id:`O7_W_a`}),children:hi.filter(e=>{let t=e.displayName;return cS(o({id:`wHZ58m`,values:{displayName:t}}),d,[e.id,`agent handoff`,`open in`])}).map(e=>{let t=Ie[e.id],n=t.installed===!0&&Ye!==null,r=e.displayName,a=t.installed===null?o({id:`IA6JW2`}):t.installed===!1?o({id:`5SwVv1`}):null,s=o(a?{id:`rl35Vz`,values:{displayName:r,hint:a}}:{id:`wHZ58m`,values:{displayName:r}});return(0,Z.jsxs)(H,{value:`send to ai ${e.displayName} desktop ${e.id} agent open in`,disabled:!n,onSelect:()=>{!n||!Ye||(i(!1),Re(e.id,Ye))},"data-testid":`command-palette-open-in-${e.id}`,"aria-label":s,children:[(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(Y,{id:`wHZ58m`,values:{displayName:r}})}),a?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-auto text-muted-foreground text-xs`,children:a}):null]},e.id)})}):null,hn(`project`),zt&&a?(0,Z.jsx)(Ne,{heading:o({id:`3iyGWF`}),children:$e.filter(e=>cS(`${e.name} ${e.path}`,d,[`open recent project`])).slice(0,10).map(e=>{let t=e.isLinkedWorktree===!0,n=t?Cl:Qd,r=t&&e.mainRoot!==void 0?sC(e.mainRoot):null;return(0,Z.jsx)(uC,{path:e.path,onRemoveRecent:Dt,testIdPrefix:`command-palette-recent`,children:(0,Z.jsxs)(`div`,{className:`group/recent relative flex items-center`,children:[(0,Z.jsxs)(H,{value:`${e.name} ${e.path} recent project`,onSelect:()=>Tt(()=>a.project.open({path:e.path,target:`new-window`,entryPoint:`recents`}),o({id:`SUOoXn`})),"data-testid":`command-palette-recent-${e.path}`,className:`flex-1 items-start pr-8`,children:[(0,Z.jsx)(n,{className:`mt-0.5`}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,Z.jsx)(Rl,{className:`truncate font-medium`,children:e.name}),r===null?null:(0,Z.jsx)(`span`,{className:`truncate text-muted-foreground text-xs`,children:(0,Z.jsx)(Y,{id:`8Gzz2G`,values:{worktreeOf:r}})}),(0,Z.jsx)(Rl,{className:`truncate text-muted-foreground text-xs`,children:e.path})]})]}),(0,Z.jsx)(lC,{path:e.path,name:e.name,onRemoveRecent:Dt,testIdPrefix:`command-palette-recent`})]})},e.path)})}):null,Vt&&a?(0,Z.jsx)(Ne,{heading:o({id:`sxjyRq`}),children:Bt.slice(0,10).map(e=>(0,Z.jsxs)(H,{value:`${e.branch} worktree branch`,onSelect:()=>kt(e),"data-testid":`command-palette-worktree-${e.branch}`,className:`items-start`,children:[(0,Z.jsx)(Cl,{className:`mt-0.5`}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,Z.jsx)(Rl,{className:`truncate font-medium`,children:e.branch}),e.worktreePath===null?(0,Z.jsx)(`span`,{className:`truncate text-muted-foreground text-xs`,children:o({id:`iO8V-7`})}):(0,Z.jsx)(Rl,{className:`truncate text-muted-foreground text-xs`,children:e.worktreePath})]})]},e.branch))}):null,[`file`,`view`,`terminal`,`app`].map(e=>hn(e)),It?(0,Z.jsx)(Ne,{heading:o({id:`A1taO8`}),children:Ft.map(e=>(0,Z.jsx)(vC,{entry:e,query:f,onSelect:()=>Nt(e)},Bx(e.kind,e.path)))}):null]}),qn]}),Xn,tr,rr,ir,ar,or,sr]})}function wC(e){return`#${e}`}function TC(e){return e.name}function EC(e){return e.branch!==null&&!e.isCurrent}function DC(e){return Bx(e.kind,e.path)}var OC=500;function kC(e,t,n){return t?`terminal`:e===null&&n?`retrying`:`hidden`}function AC(e){return e?.kind===`null-collab`}function jC(e){if(e===null)return ic._({id:`Ua78MH`});if(e.kind===`null-collab`)return ic._({id:`tz_FDV`});if(e.code===`network`)return ic._({id:`2L8aeZ`});if(e.code===`invalid-body`)return ic._({id:`FRYB1Q`});let t=e.code;return ic._({id:`4nj6n8`,values:{code:t}})}function MC(){let e=(0,$.c)(31),t=Xt(),{collabUrl:n,collabTerminal:r,collabLastError:i,retryCollab:a}=Ke(),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(null),f=typeof window<`u`?window.okDesktop:void 0,p,m;e[0]!==r||e[1]!==n?(p=()=>{if(n!==null||r){s(!1);return}let e=setTimeout(()=>s(!0),OC);return()=>clearTimeout(e)},m=[n,r],e[0]=r,e[1]=n,e[2]=p,e[3]=m):(p=e[2],m=e[3]),(0,Q.useEffect)(p,m);let h=kC(n,r,o);if(h===`hidden`)return null;if(h===`terminal`){let n;e[4]===i?n=e[5]:(n=AC(i),e[4]=i,e[5]=n);let r=n,o;e[6]===i?o=e[7]:(o=jC(i),e[6]=i,e[7]=o);let s=o,p;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(p=async()=>{if(f){d(null),l(!0);try{let e=await sd(f);e.ok||(d(e.message),l(!1))}catch{l(!1)}}},e[8]=p):p=e[8];let m=p,h;e[9]!==s||e[10]!==r?(h=(0,Z.jsx)(`span`,{children:r?(0,Z.jsx)(Y,{id:`AAlr5Y`,components:{0:(0,Z.jsx)(`code`,{className:`bg-red-100/60 px-1 rounded`})}}):(0,Z.jsx)(Y,{id:`noH1JX`,values:{errorDetail:s},components:{0:(0,Z.jsx)(`code`,{className:`bg-red-100/60 px-1 rounded`}),1:(0,Z.jsx)(`code`,{className:`bg-red-100/60 px-1 rounded`})}})}),e[9]=s,e[10]=r,e[11]=h):h=e[11];let g;e[12]===a?g=e[13]:(g=()=>{d(null),a()},e[12]=a,e[13]=g);let _;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(Y,{id:`6gRgw8`}),e[14]=_):_=e[14];let v;e[15]!==c||e[16]!==g?(v=(0,Z.jsx)(`button`,{type:`button`,onClick:g,disabled:c,className:`bg-red-950 text-red-50 px-2 py-0.5 rounded text-xs font-medium hover:bg-red-900 disabled:opacity-60`,children:_}),e[15]=c,e[16]=g,e[17]=v):v=e[17];let y;e[18]===c?y=e[19]:(y=f?(0,Z.jsx)(`button`,{type:`button`,onClick:m,disabled:c,className:`bg-red-950 text-red-50 px-2 py-0.5 rounded text-xs font-medium hover:bg-red-900 disabled:opacity-60`,children:c?(0,Z.jsx)(Y,{id:`0Er6-M`}):(0,Z.jsx)(Y,{id:`uaUc6t`})}):null,e[18]=c,e[19]=y);let b;e[20]===t?b=e[21]:(b=t?(0,Z.jsx)(`button`,{type:`button`,onClick:t,"aria-label":ic._({id:`MsARMw`}),title:ic._({id:`MsARMw`}),className:`ml-1 flex items-center rounded bg-red-100/60 px-1.5 py-1 transition-colors hover:bg-red-100/90`,children:(0,Z.jsx)(ur,{size:22,trackMouse:!1,variant:`sleeping`})}):null,e[20]=t,e[21]=b);let x;e[22]===u?x=e[23]:(x=u===null?null:(0,Z.jsx)(`span`,{className:`w-full text-red-950 text-xs`,children:u}),e[22]=u,e[23]=x);let S;return e[24]!==b||e[25]!==x||e[26]!==h||e[27]!==v||e[28]!==y?(S=(0,Z.jsxs)(`div`,{role:`alert`,"aria-live":`assertive`,className:`fixed top-0 inset-x-0 z-50 bg-red-500/95 text-red-950 text-sm text-center py-2 px-4 pl-[var(--ok-titlebar-reserve-left,1rem)] shadow-md flex items-center justify-center gap-3 flex-wrap`,children:[h,v,y,b,x]}),e[24]=b,e[25]=x,e[26]=h,e[27]=v,e[28]=y,e[29]=S):S=e[29],S}let g;return e[30]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:`fixed top-0 inset-x-0 z-50 bg-amber-500/95 text-amber-950 text-sm text-center py-2 px-4 pl-[var(--ok-titlebar-reserve-left,1rem)] shadow-md`,children:(0,Z.jsx)(Y,{id:`UYcGIW`})}),e[30]=g):g=e[30],g}function NC(e){let t=(0,$.c)(5),{bridge:n}=e,[r,i]=(0,Q.useState)(!1),a,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>qn(e=>{e===`new-project`&&i(!0)}),o=[],t[0]=a,t[1]=o):(a=t[0],o=t[1]),(0,Q.useEffect)(a,o);let s;return t[2]!==n||t[3]!==r?(s=(0,Z.jsx)(lx,{open:r,onOpenChange:i,bridge:n}),t[2]=n,t[3]=r,t[4]=s):s=t[4],s}function PC(e,t){e.chain().focus().insertContent({type:`text`,text:t}).run()}function FC(e){if(e.isDestroyed)return null;try{let t=e.view.coordsAtPos(e.state.selection.from);return{left:t.left,top:t.top,bottom:t.bottom}}catch{return null}}function IC(){let e=(0,$.c)(29),{_:t}=xn(),[n,r]=(0,Q.useState)(null),i,a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{let e=function(e){let t=e.detail;if(!t?.editor||t.editor.isDestroyed)return;let n=FC(t.editor);n&&r({editor:t.editor,...n})};return document.addEventListener(B,e),()=>document.removeEventListener(B,e)},a=[],e[0]=i,e[1]=a):(i=e[0],a=e[1]),(0,Q.useEffect)(i,a);let o=n?.editor??null,s,c;if(e[2]===o?(s=e[3],c=e[4]):(s=()=>{if(!o)return;let e=function(){let e=o,t=FC(e);r(n=>!n||n.editor!==e?n:t?{...n,...t}:null)};return document.addEventListener(`scroll`,e,{capture:!0,passive:!0}),window.addEventListener(`resize`,e),()=>{document.removeEventListener(`scroll`,e,{capture:!0}),window.removeEventListener(`resize`,e)}},c=[o],e[2]=o,e[3]=s,e[4]=c),(0,Q.useEffect)(s,c),!n)return null;let l;e[5]===n?l=e[6]:(l=function(e){if(!n)return;let{editor:t}=n;r(null),e&&!t.isDestroyed&&t.commands.focus()},e[5]=n,e[6]=l);let u=l,d;e[7]===u?d=e[8]:(d=e=>{e||u(!1)},e[7]=u,e[8]=d);let f=n.bottom-n.top,p;e[9]!==n.left||e[10]!==n.top||e[11]!==f?(p=(0,Z.jsx)(Em,{asChild:!0,children:(0,Z.jsx)(`span`,{"aria-hidden":!0,"data-testid":`emoji-picker-anchor`,className:`pointer-events-none fixed`,style:{left:n.left,top:n.top,height:f}})}),e[9]=n.left,e[10]=n.top,e[11]=f,e[12]=p):p=e[12];let m;e[13]===t?m=e[14]:(m=t({id:`pFPzHA`}),e[13]=t,e[14]=m);let h,g;e[15]===u?(h=e[16],g=e[17]):(g=()=>u(!0),h=()=>u(!1),e[15]=u,e[16]=h,e[17]=g);let _;e[18]===n.editor?_=e[19]:(_=(0,Z.jsx)(Nd,{onSelect:e=>{let t=n.editor;r(null),PC(t,e)}}),e[18]=n.editor,e[19]=_);let v;e[20]!==h||e[21]!==_||e[22]!==m||e[23]!==g?(v=(0,Z.jsx)(Dm,{className:`w-auto p-0`,align:`start`,"aria-label":m,"data-testid":`emoji-picker-popover`,onEscapeKeyDown:g,onInteractOutside:h,children:_}),e[20]=h,e[21]=_,e[22]=m,e[23]=g,e[24]=v):v=e[24];let y;return e[25]!==v||e[26]!==d||e[27]!==p?(y=(0,Z.jsxs)(Om,{open:!0,onOpenChange:d,children:[p,v]}),e[25]=v,e[26]=d,e[27]=p,e[28]=y):y=e[28],y}async function LC(e){let t=await fetch(`/api/tags/${encodeURIComponent(e)}`);if(!t.ok){let e=await t.json().catch(()=>null),n=t.status,r=t.statusText;throw Error(qc(e)??ic._({id:`lHwYMr`,values:{status:n,statusText:r}}))}return(await t.json()).docs??[]}function RC(){let e=(0,$.c)(18),[t,n]=(0,Q.useState)(!1),[r,i]=(0,Q.useState)(null),a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={kind:`idle`},e[0]=a):a=e[0];let[o,s]=(0,Q.useState)(a),c=(0,Q.useRef)(0),l,u;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>{let e=function(e){let t=e.detail;if(!t||typeof t.value!=`string`)return;let r=c.current+=1;i(t.value),n(!0),s({kind:`loading`}),LC(t.value).then(e=>{c.current===r&&s({kind:`ready`,docs:e})}).catch(e=>{c.current===r&&s({kind:`error`,message:e instanceof Error?e.message:String(e)})})};return document.addEventListener(m,e),()=>document.removeEventListener(m,e)},u=[],e[1]=l,e[2]=u):(l=e[1],u=e[2]),(0,Q.useEffect)(l,u);let d;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=function(e){n(!1),window.location.assign(ep(e))},e[3]=d):d=e[3];let f=d,p=r??``,h;e[4]===p?h=e[5]:(h={tagName:p},e[4]=p,e[5]=h);let g;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(g={0:(0,Z.jsx)(`span`,{className:`font-mono break-all`})},e[6]=g):g=e[6];let _;e[7]===h?_=e[8]:(_=(0,Z.jsx)(zp,{children:(0,Z.jsx)(Pp,{children:(0,Z.jsx)(Y,{id:`7H4UHD`,values:h,components:g})})}),e[7]=h,e[8]=_);let v=r??``,y;e[9]!==o||e[10]!==v?(y=(0,Z.jsx)(Ip,{children:(0,Z.jsx)(zC,{fetchState:o,tag:v,onSelectDoc:f})}),e[9]=o,e[10]=v,e[11]=y):y=e[11];let b;e[12]!==_||e[13]!==y?(b=(0,Z.jsxs)(Fp,{children:[_,y]}),e[12]=_,e[13]=y,e[14]=b):b=e[14];let x;return e[15]!==t||e[16]!==b?(x=(0,Z.jsx)(Bp,{open:t,onOpenChange:n,children:b}),e[15]=t,e[16]=b,e[17]=x):x=e[17],x}function zC(e){let t=(0,$.c)(15),{fetchState:n,tag:r,onSelectDoc:i}=e;if(n.kind===`idle`||n.kind===`loading`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(`p`,{className:`text-muted-foreground text-sm`,"data-testid":`tag-dialog-loading`,children:(0,Z.jsx)(Y,{id:`yQE2r9`})}),t[0]=e):e=t[0],e}if(n.kind===`error`){let e;return t[1]===n.message?e=t[2]:(e=(0,Z.jsx)(`p`,{className:`text-destructive text-sm`,"data-testid":`tag-dialog-error`,children:n.message}),t[1]=n.message,t[2]=e),e}if(n.docs.length===0){let e;t[3]===r?e=t[4]:(e={tag:r},t[3]=r,t[4]=e);let n;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(n={0:(0,Z.jsx)(`span`,{className:`font-mono`})},t[5]=n):n=t[5];let i;return t[6]===e?i=t[7]:(i=(0,Z.jsx)(`p`,{className:`text-muted-foreground text-sm`,"data-testid":`tag-dialog-empty`,children:(0,Z.jsx)(Y,{id:`lAiyU_`,values:e,components:n})}),t[6]=e,t[7]=i),i}let a;if(t[8]!==n.docs||t[9]!==i){let e;t[11]===i?e=t[12]:(e=e=>{let t=e.matchingTags??[];return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`button`,{type:`button`,className:`w-full rounded-md px-2 py-1.5 text-left text-sm hover:bg-muted focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-ring`,onClick:()=>i(e.docName),"data-testid":`tag-dialog-row`,children:[(0,Z.jsx)(`span`,{className:`block truncate font-medium`,children:e.title}),e.docName===e.title?null:(0,Z.jsx)(`span`,{className:`block truncate text-xs text-muted-foreground`,children:e.docName}),t.length>0?(0,Z.jsx)(`span`,{className:`mt-1 flex flex-wrap items-center gap-1`,"data-testid":`tag-dialog-row-matches`,children:t.map(BC)}):null]})},e.docName)},t[11]=i,t[12]=e),a=n.docs.map(e),t[8]=n.docs,t[9]=i,t[10]=a}else a=t[10];let o;return t[13]===a?o=t[14]:(o=(0,Z.jsx)(`ul`,{className:`flex flex-col gap-1`,"data-testid":`tag-dialog-list`,children:a}),t[13]=a,t[14]=o),o}function BC(e){return(0,Z.jsxs)(`span`,{"data-testid":`tag-dialog-row-match`,"data-tag":e,className:`tag pointer-events-none text-xs`,children:[`#`,e]},e)}var VC=`raw-mdx-nav`,HC=`ok-editor-mode-v1`,UC=[`wysiwyg`,`source`],WC=`wysiwyg`;function GC(e){return UC.includes(e)}function KC(e=localStorage){try{let t=e.getItem(HC);if(t===null)return WC;if(GC(t))return t;console.warn(`[editor-mode] invalid persisted value, falling back to default`,{raw:t})}catch{}return WC}function qC(e=window,t=localStorage){let n=e.__OK_EDITOR_MODE__;return GC(n)?n:KC(t)}function JC(e,t=localStorage){try{return t.setItem(HC,e),!0}catch(e){return console.warn(`[editor-mode] persist failed`,e),!1}}function YC(){let e=(0,$.c)(3),[t,n]=(0,Q.useState)(qC),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=function(e){n(e),JC(e)},e[0]=r):r=e[0];let i=r,a;return e[1]===t?a=e[2]:(a=[t,i],e[1]=t,e[2]=a),a}function XC(e){let t=(0,$.c)(4),{_:n}=xn(),r=(0,Q.useRef)(!1),i,a;t[0]!==n||t[1]!==e?(i=()=>{e===`no-push-permission`&&!r.current&&(r.current=!0,Us.info(n({id:`JkCD2u`})))},a=[e,n],t[0]=n,t[1]=e,t[2]=i,t[3]=a):(i=t[2],a=t[3]),(0,Q.useEffect)(i,a)}function ZC(e,t){return e===`follow`?(0,Z.jsx)(Y,{id:`Sxx_Zz`,values:{project:t}}):e===`full`?(0,Z.jsx)(Y,{id:`4zEZS5`,values:{project:t}}):(0,Z.jsx)(Y,{id:`AaaESH`,values:{project:t}})}function QC(){let e=(0,$.c)(8),{projectLocalConfig:t,projectLocalSynced:n,projectLocalBinding:r}=Gc(),i=(0,Q.useRef)(!1),a;e[0]!==r||e[1]!==t?.autoSync||e[2]!==n?(a=()=>{if(!n||i.current||r===null)return;let e=t?.autoSync;if(e?.inheritedNoticePending!==!0)return;i.current=!0;let a=typeof e.inheritedFrom==`string`?e.inheritedFrom:``;Us(ZC(Za({mode:e.mode,enabled:e.enabled}),a)),r.patch({autoSync:{inheritedNoticePending:null}})},e[0]=r,e[1]=t?.autoSync,e[2]=n,e[3]=a):a=e[3];let o;e[4]!==r||e[5]!==t||e[6]!==n?(o=[n,t,r],e[4]=r,e[5]=t,e[6]=n,e[7]=o):o=e[7],(0,Q.useEffect)(a,o)}var $C=`ok-terminal-placement-v1`;function ew(e){try{return ms((e??localStorage).getItem($C))}catch{return Ma}}function tw(e,t){try{(t??localStorage).setItem($C,e)}catch{}}var nw=`ok-terminal-right-width-v1`;function rw(e){try{let t=(e??localStorage).getItem(nw);if(t===null||t.trim()===``)return Yo;let n=Number(t);return Number.isFinite(n)?os(n):Yo}catch{return Yo}}function iw(e,t){try{(t??localStorage).setItem(nw,String(os(e)))}catch{}}function aw(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`?ow: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 ow(e){return e===`synced`?`synced`:`connected`}function sw(e){let t=(0,$.c)(36),{open:n,variant:r,onResolved:i}=e,{_:a}=xn(),o=wl(),s;t[0]!==a||t[1]!==i||t[2]!==r||t[3]!==o?(s=function(e){if(o===null){Us.error(a({id:`fiMNLl`}));return}let t=o(e?r===`follow`?`follow`:`full`:`off`);if(!t.ok){let n=t.error;Us.error(a(e?{id:`FUMerq`,values:{detail:n}}:{id:`0t0bbC`,values:{detail:n}}));return}i()},t[0]=a,t[1]=i,t[2]=r,t[3]=o,t[4]=s):s=t[4];let c=s,l;t[5]===r?l=t[6]:(l=(0,Z.jsx)(zp,{children:(0,Z.jsx)(El,{variant:r})}),t[5]=r,t[6]=l);let u;t[7]===r?u=t[8]:(u=(0,Z.jsx)(kl,{variant:r}),t[7]=r,t[8]=u);let d;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(`p`,{className:`mt-3 text-1sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`QYTOaN`,components:{0:(0,Z.jsx)(`span`,{className:`font-medium`})}})}),t[9]=d):d=t[9];let f;t[10]===u?f=t[11]:(f=(0,Z.jsxs)(Ip,{children:[u,d]}),t[10]=u,t[11]=f);let p;t[12]===c?p=t[13]:(p=()=>c(!1),t[12]=c,t[13]=p);let m=o===null,h;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(Y,{id:`IKoTAC`}),t[14]=h):h=t[14];let g;t[15]!==p||t[16]!==m?(g=(0,Z.jsx)(X,{variant:`outline`,className:`uppercase font-mono`,onClick:p,disabled:m,children:h}),t[15]=p,t[16]=m,t[17]=g):g=t[17];let _;t[18]===c?_=t[19]:(_=()=>c(!0),t[18]=c,t[19]=_);let v=o===null,y;t[20]===r?y=t[21]:(y=r===`follow`?(0,Z.jsx)(Y,{id:`U4nTfu`}):(0,Z.jsx)(Y,{id:`XU0OXn`}),t[20]=r,t[21]=y);let b;t[22]!==_||t[23]!==v||t[24]!==y?(b=(0,Z.jsx)(X,{onClick:_,disabled:v,children:y}),t[22]=_,t[23]=v,t[24]=y,t[25]=b):b=t[25];let x;t[26]!==b||t[27]!==g?(x=(0,Z.jsxs)(Lp,{children:[g,b]}),t[26]=b,t[27]=g,t[28]=x):x=t[28];let S;t[29]!==x||t[30]!==l||t[31]!==f?(S=(0,Z.jsxs)(Fp,{className:`sm:max-w-lg`,showCloseButton:!1,children:[l,f,x]}),t[29]=x,t[30]=l,t[31]=f,t[32]=S):S=t[32];let C;return t[33]!==n||t[34]!==S?(C=(0,Z.jsx)(Bp,{open:n,onOpenChange:cw,children:S}),t[33]=n,t[34]=S,t[35]=C):C=t[35],C}function cw(){}function lw(e){if(!(!e.autoSyncOnboardingDismissed&&e.hasRemote===!0&&e.projectLocalSynced===!0&&e.projectSynced===!0&&e.projectLocalConfig!==null&&Za(e.projectLocalConfig.autoSync??void 0)===null&&ns(e.projectConfig?.autoSync?.default)===null))return null;switch(e.pushPermissionCheckStatus){case`allowed`:return`full`;case`denied`:return`follow`;default:return null}}function uw(e){let t=(0,$.c)(57),{primary:n,onPrimary:r,primaryDisabled:i,enabledTargets:a,selectedTargetId:o,onSelectTarget:s,threadAgents:c,onOpenSettings:l,terminal:u,terminals:d,menuEmptyState:f,menuLeading:p,onMenuOpenChange:m,menuAlign:h,triggerAriaLabel:g,testIds:_}=e,v=i===void 0?!1:i,y=h===void 0?`end`:h,{_:b}=xn(),x=a.length>0,S=d&&d.length>0?d:null,C=S!=null||u!=null,w=x||C,T=c!==void 0&&c.length>0,E;t[0]===_?E=t[1]:(E=e=>typeof _.terminal==`function`?_.terminal(e):_.terminal,t[0]=_,t[1]=E);let D=E,O;t[2]!==r||t[3]!==n||t[4]!==v||t[5]!==_.primary?(O=(0,Z.jsx)(X,{type:`button`,variant:`outline`,className:`gap-1.5`,disabled:v,onClick:r,"data-testid":_.primary,children:n}),t[2]=r,t[3]=n,t[4]=v,t[5]=_.primary,t[6]=O):O=t[6];let k;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Z.jsx)(Zl,{"aria-hidden":`true`,className:`size-3.5 text-muted-foreground`}),t[7]=k):k=t[7];let A;t[8]!==_.trigger||t[9]!==g?(A=(0,Z.jsx)(Ri,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`outline`,size:`icon`,"aria-label":g,"data-testid":_.trigger,children:k})}),t[8]=_.trigger,t[9]=g,t[10]=A):A=t[10];let j;t[11]!==w||t[12]!==p||t[13]!==T?(j=p?(0,Z.jsxs)(Z.Fragment,{children:[p,T||w?(0,Z.jsx)(Gi,{}):null]}):null,t[11]=w,t[12]=p,t[13]=T,t[14]=j):j=t[14];let M;t[15]!==b||t[16]!==w||t[17]!==T||t[18]!==_||t[19]!==c?(M=T?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Ii,{"aria-label":b({id:`vPKX2i`}),children:[(0,Z.jsxs)(Bi,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(Y,{id:`RXEbZy`}),(0,Z.jsx)(Ci,{})]}),c?.map(e=>(0,Z.jsxs)(Mi,{onSelect:e.onSelect,"data-testid":_.threadAgent?.(e.key),children:[(0,Z.jsx)(Ll,{agentId:e.id,iconUrl:e.iconUrl,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1 truncate`,children:e.name}),e.selected?(0,Z.jsx)(Yl,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.key))]}),w?(0,Z.jsx)(Gi,{}):null]}):null,t[15]=b,t[16]=w,t[17]=T,t[18]=_,t[19]=c,t[20]=M):M=t[20];let N;t[21]!==b||t[22]!==S||t[23]!==a||t[24]!==w||t[25]!==s||t[26]!==o||t[27]!==x||t[28]!==C||t[29]!==u||t[30]!==D||t[31]!==_?(N=w?(0,Z.jsxs)(Z.Fragment,{children:[C?(0,Z.jsxs)(Ii,{"aria-label":b({id:`ALhMYW`}),children:[(0,Z.jsx)(Bi,{children:(0,Z.jsx)(Y,{id:`ALhMYW`})}),S?S.map(e=>(0,Z.jsxs)(Mi,{onSelect:e.onSelect,"data-testid":D(e.cli),"aria-label":e.ariaLabel,children:[(0,Z.jsx)(Ai,{id:Di(e.cli),className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:e.label}),e.selected?(0,Z.jsx)(Yl,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.cli)):u?(0,Z.jsxs)(Mi,{onSelect:u.onSelect,"data-testid":D(`claude`),"aria-label":b({id:`AcK_r0`}),children:[(0,Z.jsx)(Ai,{id:Di(`claude`),className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(Y,{id:`fcgvCA`})}),u.selected?(0,Z.jsx)(Yl,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]}):null]}):null,x?(0,Z.jsxs)(Z.Fragment,{children:[C?(0,Z.jsx)(Gi,{}):null,(0,Z.jsxs)(Ii,{"aria-label":b({id:`BwKH4d`}),children:[(0,Z.jsxs)(Bi,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(Y,{id:`BwKH4d`}),(0,Z.jsx)(Fl,{"aria-hidden":`true`,className:`size-3`})]}),a.map(e=>(0,Z.jsxs)(Mi,{onSelect:()=>s(e),"data-testid":_.option(e.id),children:[(0,Z.jsx)(Ai,{id:e.id,"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(nl,{displayName:e.displayName})}),o===e.id?(0,Z.jsx)(Yl,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.id))]})]}):null]}):null,t[21]=b,t[22]=S,t[23]=a,t[24]=w,t[25]=s,t[26]=o,t[27]=x,t[28]=C,t[29]=u,t[30]=D,t[31]=_,t[32]=N):N=t[32];let P=!T&&!w?f:null,F;t[33]!==w||t[34]!==T?(F=T||w?(0,Z.jsx)(Gi,{}):null,t[33]=w,t[34]=T,t[35]=F):F=t[35];let I;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(Yn,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}),t[36]=I):I=t[36];let L;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(Y,{id:`jRAGrQ`})}),t[37]=L):L=t[37];let R;t[38]!==l||t[39]!==_.settings?(R=(0,Z.jsxs)(Mi,{onSelect:l,"data-testid":_.settings,children:[I,L]}),t[38]=l,t[39]=_.settings,t[40]=R):R=t[40];let z;t[41]!==y||t[42]!==P||t[43]!==F||t[44]!==R||t[45]!==j||t[46]!==M||t[47]!==N||t[48]!==_.menu?(z=(0,Z.jsxs)(Hi,{align:y,className:`max-h-80 min-w-[200px]`,"data-testid":_.menu,children:[j,M,N,P,F,R]}),t[41]=y,t[42]=P,t[43]=F,t[44]=R,t[45]=j,t[46]=M,t[47]=N,t[48]=_.menu,t[49]=z):z=t[49];let B;t[50]!==m||t[51]!==z||t[52]!==A?(B=(0,Z.jsxs)(Wi,{modal:!1,onOpenChange:m,children:[A,z]}),t[50]=m,t[51]=z,t[52]=A,t[53]=B):B=t[53];let V;return t[54]!==B||t[55]!==O?(V=(0,Z.jsxs)(Zi,{children:[O,B]}),t[54]=B,t[55]=O,t[56]=V):V=t[56],V}function dw(e){let t=(0,$.c)(9),{onStartNewChat:n}=e,{_:r}=xn(),i;t[0]===r?i=t[1]:(i=r({id:`j15ZSH`}),t[0]=r,t[1]=i);let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(Kn,{className:`size-4`}),t[2]=a):a=t[2];let o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(`span`,{className:`flex-1 truncate`,children:(0,Z.jsx)(Y,{id:`vPF04k`})}),t[3]=o):o=t[3];let s;t[4]===n?s=t[5]:(s=(0,Z.jsxs)(Mi,{onSelect:n,className:`gap-2`,"data-testid":`comment-queue-send-new`,children:[a,o]}),t[4]=n,t[5]=s);let c;return t[6]!==i||t[7]!==s?(c=(0,Z.jsx)(Ii,{"aria-label":i,children:s}),t[6]=i,t[7]=s,t[8]=c):c=t[8],c}function fw(){let e=(0,$.c)(12),t=di(),n=pi(),r=fi(),i,a;if(e[0]!==r||e[1]!==t||e[2]!==n){let o;e[5]===t?o=e[6]:(o=e=>gi(t,e.source,e.id,!0,e.supported),e[5]=t,e[6]=o);let s=n.filter(o),c=mi(s,r);a=c,i=s.map(e=>({key:`${e.source}:${e.id}`,id:e.id,name:e.name,...e.iconUrl===void 0?{}:{iconUrl:e.iconUrl},selected:c!==null&&c.source===e.source&&c.id===e.id,onSelect:()=>{ui(e),jc(_c)}})),e[0]=r,e[1]=t,e[2]=n,e[3]=i,e[4]=a}else i=e[3],a=e[4];let o;e[7]===i?o=e[8]:(o={threadAgents:i},e[7]=i,e[8]=o);let s;return e[9]!==a||e[10]!==o?(s={threadAgent:a,rows:o},e[9]=a,e[10]=o,e[11]=s):s=e[11],s}function pw(e){let t=(0,$.c)(49),{threadIds:n,testIdPrefix:r}=e,{_:i}=xn(),a=fw(),o=yb(),s=Sc(),c=s?.kind===`thread`?s:null,l=Sb(),u;t[0]!==c||t[1]!==a.threadAgent?.iconUrl||t[2]!==a.threadAgent?.id?(u=c===null?(0,Z.jsx)(Ll,{agentId:a.threadAgent?.id??``,iconUrl:a.threadAgent?.iconUrl,className:`size-4`}):(0,Z.jsx)(Ll,{agentId:c.agentId,iconUrl:c.iconUrl,className:`size-4`}),t[0]=c,t[1]=a.threadAgent?.iconUrl,t[2]=a.threadAgent?.id,t[3]=u):u=t[3];let d=u,f;t[4]===i?f=t[5]:(f=i({id:`LaskKp`,values:{0:Ys(`send-comment-queue`)}}),t[4]=i,t[5]=f);let p;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(p=Js(`send-comment-queue`),t[6]=p):p=t[6];let m;t[7]===f?m=t[8]:(m=(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 font-sans text-xs leading-none text-muted-foreground`,title:f,children:p}),t[7]=f,t[8]=m);let h;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(h=[],t[9]=h):h=t[9];let g;t[10]===c?g=t[11]:(g=(0,Z.jsx)(`span`,{className:`truncate`,children:c===null?(0,Z.jsx)(Y,{id:`vPF04k`}):(0,Z.jsx)(Y,{id:`sKEgGd`})}),t[10]=c,t[11]=g);let _;t[12]!==d||t[13]!==g?(_=(0,Z.jsxs)(Z.Fragment,{children:[d,g]}),t[12]=d,t[13]=g,t[14]=_):_=t[14];let v;t[15]!==l||t[16]!==n?(v=()=>l(n),t[15]=l,t[16]=n,t[17]=v):v=t[17];let y=n.length===0,b;t[18]!==o||t[19]!==c||t[20]!==n?(b=c===null?void 0:(0,Z.jsx)(dw,{onStartNewChat:()=>void Nt({compose:o,threadIds:n})}),t[18]=o,t[19]=c,t[20]=n,t[21]=b):b=t[21];let x;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(`p`,{className:`px-2 py-1.5 text-sm text-muted-foreground`,"aria-live":`polite`,children:(0,Z.jsx)(Y,{id:`t9Qn8y`})}),t[22]=x):x=t[22];let S;t[23]===i?S=t[24]:(S=i({id:`nbLQ_9`}),t[23]=i,t[24]=S);let C=`${r}-send`,w=`${r}-send-trigger`,T=`${r}-send-menu`,E,D;t[25]===r?(E=t[26],D=t[27]):(E=e=>`${r}-agent-option-${e}`,D=e=>`${r}-agent-option-thread-${e}`,t[25]=r,t[26]=E,t[27]=D);let O=`${r}-agent-option-settings`,k;t[28]===r?k=t[29]:(k=e=>`${r}-agent-option-terminal-${e}`,t[28]=r,t[29]=k);let A;t[30]!==C||t[31]!==w||t[32]!==T||t[33]!==E||t[34]!==D||t[35]!==O||t[36]!==k?(A={primary:C,trigger:w,menu:T,option:E,threadAgent:D,settings:O,terminal:k},t[30]=C,t[31]=w,t[32]=T,t[33]=E,t[34]=D,t[35]=O,t[36]=k,t[37]=A):A=t[37];let j;t[38]!==a.rows||t[39]!==b||t[40]!==S||t[41]!==A||t[42]!==_||t[43]!==v||t[44]!==y?(j=(0,Z.jsx)(uw,{enabledTargets:h,selectedTargetId:null,onSelectTarget:mw,primary:_,onPrimary:v,primaryDisabled:y,menuLeading:b,onOpenSettings:Xs,menuEmptyState:x,triggerAriaLabel:S,testIds:A,...a.rows}),t[38]=a.rows,t[39]=b,t[40]=S,t[41]=A,t[42]=_,t[43]=v,t[44]=y,t[45]=j):j=t[45];let M;return t[46]!==j||t[47]!==m?(M=(0,Z.jsx)(yh,{className:`justify-end`,children:(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[m,j]})}),t[46]=j,t[47]=m,t[48]=M):M=t[48],M}function mw(){}function hw(e){let t=new Map;for(let n of e){let e=t.get(n.docName);e?e.push(n):t.set(n.docName,[n])}return[...t].map(([e,t])=>({docName:e,threads:t}))}function gw(e,t){let n=new Date(e),r=new Date(t),i=n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()&&n.getDate()===r.getDate(),a={hour:`numeric`,minute:`2-digit`};return i?n.toLocaleTimeString(void 0,a):n.getFullYear()===r.getFullYear()?n.toLocaleString(void 0,{month:`short`,day:`numeric`,...a}):n.toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,...a})}function _w(e){let t=(0,$.c)(104),{thread:n,cardRef:r,focused:i,active:a,sending:o}=e,{_:s}=xn(),[c]=(0,Q.useState)(yw),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(!1),p=(0,Q.useRef)(null),m=n.status===`orphaned`,h=n.status===`resolved`,_=(0,Q.useRef)(n.body),v;t[0]===n.body?v=t[1]:(v=()=>{_.current=n.body},t[0]=n.body,t[1]=v),(0,Q.useEffect)(v);let y=(0,Q.useRef)(null),b=(0,Q.useRef)(!1),x,S;t[2]===l?(x=t[3],S=t[4]):(x=()=>{l&&(b.current=!1,y.current=null,p.current?.setText(_.current),p.current?.focusEnd())},S=[l],t[2]=l,t[3]=x,t[4]=S),(0,Q.useEffect)(x,S);let C;t[5]===n.id?C=t[6]:(C=function(e){if(b.current)return;b.current=!0,u(!1);let t=(e??``).trim();t.length===0||t===_.current||tn(n.id,t)},t[5]=n.id,t[6]=C);let w=C,T;t[7]===w?T=t[8]:(T=function(){w(p.current?.getContent().instruction??null)},t[7]=w,t[8]=T);let E=T,D;t[9]===w?D=t[10]:(D=function(){w(null)},t[9]=w,t[10]=D);let O=D,k;t[11]!==O||t[12]!==n.id?(k=function(){O(),tt(n.id)},t[11]=O,t[12]=n.id,t[13]=k):k=t[13];let A=k,j;t[14]!==l||t[15]!==w?(j=()=>{if(l)return()=>{w(y.current)}},t[14]=l,t[15]=w,t[16]=j):j=t[16];let M;t[17]===l?M=t[18]:(M=[l],t[17]=l,t[18]=M),(0,Q.useEffect)(j,M);let N;t[19]===n?N=t[20]:(N=function(e){if(n.anchor===null)return;if(Se(n.docName)===null){hf(n);return}if(n.target.kind===`property`){mf({key:n.target.key,path:n.target.path,quote:e,start:n.anchor.start,end:n.anchor.end}),dt(n.id);return}let t=Se(n.docName);if(!t)return;let r=Cf(t.state.doc,e,n.anchor);r&&(Af(t,r,n.docName),dt(n.id))},t[19]=n,t[20]=N);let P=N,F;t[21]!==n.docName||t[22]!==n.id?(F=function(){let e=Se(n.docName);if(!e)return;let{from:t,to:r,empty:i}=e.state.selection;if(i)return;let a=e.state.doc.textBetween(t,r,` `).trim();a.length>0&&ye(n.id,a,yf(e.state.doc,t,r))},t[21]=n.docName,t[22]=n.id,t[23]=F):F=t[23];let I=F,L=!l&&!h,R,z,B,V;t[24]===n.id?(R=t[25],z=t[26],B=t[27],V=t[28]):(R=()=>g(n.id),z=()=>Je(n.id),B=()=>g(n.id),V=()=>Je(n.id),t[24]=n.id,t[25]=R,t[26]=z,t[27]=B,t[28]=V);let H;t[29]!==L||t[30]!==n.id?(H=e=>{if(!L||e.target?.closest(`button, [role="checkbox"], [role="textbox"], a, input, textarea`))return;let t=window.getSelection();t!==null&&!t.isCollapsed&&t.anchorNode!==null&&e.currentTarget.contains(t.anchorNode)||Dt(n.id)},t[29]=L,t[30]=n.id,t[31]=H):H=t[31];let U=L&&`cursor-pointer`,ee=h&&`opacity-70`,W=a&&`bg-amber-500/10`,te=i&&`ring-2 ring-primary`,G;t[32]!==U||t[33]!==ee||t[34]!==W||t[35]!==te?(G=Qn(`flex flex-col gap-1.5 rounded-lg border p-2.5 transition-[box-shadow,border-color,background-color]`,U,ee,W,te),t[32]=U,t[33]=ee,t[34]=W,t[35]=te,t[36]=G):G=t[36];let K;t[37]!==s||t[38]!==h||t[39]!==o||t[40]!==n.id?(K=!h&&(0,Z.jsx)($r,{checked:o,onCheckedChange:()=>Dt(n.id),"aria-label":s(o?{id:`1jym2J`}:{id:`t7YoBO`})}),t[37]=s,t[38]=h,t[39]=o,t[40]=n.id,t[41]=K):K=t[41];let q;t[42]===n.updatedAt?q=t[43]:(q=new Date(n.updatedAt).toLocaleString(),t[42]=n.updatedAt,t[43]=q);let ne;t[44]!==c||t[45]!==n.updatedAt?(ne=gw(n.updatedAt,c),t[44]=c,t[45]=n.updatedAt,t[46]=ne):ne=t[46];let re;t[47]!==q||t[48]!==ne?(re=(0,Z.jsx)(`span`,{className:`shrink-0 text-[10px] text-muted-foreground`,title:q,children:ne}),t[47]=q,t[48]=ne,t[49]=re):re=t[49];let J;t[50]!==K||t[51]!==re?(J=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[K,re]}),t[50]=K,t[51]=re,t[52]=J):J=t[52];let ie;t[53]===h?ie=t[54]:(ie=h&&(0,Z.jsxs)(wm,{variant:`outline`,className:`gap-1 border-green-600/40 text-green-700 dark:text-green-500`,children:[(0,Z.jsx)(ly,{className:`size-2.5`}),(0,Z.jsx)(Y,{id:`O6H89R`})]}),t[53]=h,t[54]=ie);let ae;t[55]!==s||t[56]!==l||t[57]!==h?(ae=!h&&(0,Z.jsxs)(br,{children:[(0,Z.jsx)(_r,{asChild:!0,children:(0,Z.jsx)(X,{size:`sm`,variant:`ghost`,"aria-label":s({id:`akmOT9`}),"aria-expanded":l,className:Qn(`size-6 p-0`,l?`text-foreground`:`text-muted-foreground hover:text-foreground`),onClick:()=>u(vw),children:(0,Z.jsx)(_n,{className:`size-3.5`})})}),(0,Z.jsx)(vr,{children:(0,Z.jsx)(Y,{id:`akmOT9`})})]}),t[55]=s,t[56]=l,t[57]=h,t[58]=ae):ae=t[58];let oe;t[59]===s?oe=t[60]:(oe=s({id:`X2zUS5`}),t[59]=s,t[60]=oe);let se;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,Z.jsx)(Hf,{className:`size-3.5`}),t[61]=se):se=t[61];let ce;t[62]!==A||t[63]!==oe?(ce=(0,Z.jsx)(_r,{asChild:!0,children:(0,Z.jsx)(X,{size:`sm`,variant:`ghost`,className:`size-6 p-0 text-muted-foreground hover:text-destructive`,"aria-label":oe,onClick:A,children:se})}),t[62]=A,t[63]=oe,t[64]=ce):ce=t[64];let le;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,Z.jsx)(vr,{children:(0,Z.jsx)(Y,{id:`X2zUS5`})}),t[65]=le):le=t[65];let ue;t[66]===ce?ue=t[67]:(ue=(0,Z.jsxs)(br,{children:[ce,le]}),t[66]=ce,t[67]=ue);let de;t[68]!==ie||t[69]!==ae||t[70]!==ue?(de=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[ie,ae,ue]}),t[68]=ie,t[69]=ae,t[70]=ue,t[71]=de):de=t[71];let fe;t[72]!==J||t[73]!==de?(fe=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[J,de]}),t[72]=J,t[73]=de,t[74]=fe):fe=t[74];let pe;t[75]!==m||t[76]!==P||t[77]!==n.anchor||t[78]!==n.target?(pe=m?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-0.5 rounded border-l-2 border-muted-foreground/40 bg-muted/40 px-2 py-1`,children:[n.anchor!==null&&(0,Z.jsxs)(`p`,{className:`truncate text-xs text-muted-foreground line-through`,title:n.anchor.quote,children:[`“`,n.anchor.quote,`”`]}),(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`05F1GY`})})]}):(0,Z.jsxs)(br,{children:[(0,Z.jsx)(_r,{asChild:!0,children:(0,Z.jsx)(`span`,{className:`w-full`,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,disabled:n.anchor===null,onClick:()=>P(n.anchor?.quote??``),className:`h-auto w-full justify-start truncate rounded border-l-2 border-muted-foreground/40 bg-muted/40 px-2 py-1 text-left text-xs font-normal text-muted-foreground hover:bg-muted/70 disabled:opacity-100`,children:(0,Z.jsx)(`span`,{className:`truncate`,children:n.target.kind===`property`?(0,Z.jsxs)(`span`,{className:`font-mono`,children:[xf(n.target.key,n.target.path),`:`,n.anchor===null?``:` “${n.anchor.quote}”`]}):(0,Z.jsxs)(Z.Fragment,{children:[`“`,n.anchor?.quote??``,`”`]})})})})}),(0,Z.jsx)(vr,{children:n.anchor===null?(0,Z.jsx)(Y,{id:`aoT2xX`}):n.target.kind===`property`?(0,Z.jsx)(Y,{id:`FiyNln`}):(0,Z.jsx)(Y,{id:`DpjYd6`})})]}),t[75]=m,t[76]=P,t[77]=n.anchor,t[78]=n.target,t[79]=pe):pe=t[79];let me;t[80]!==s||t[81]!==O||t[82]!==E||t[83]!==d||t[84]!==l||t[85]!==n.body?(me=l?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Z.jsx)(ea,{ref:p,ariaLabel:s({id:`akmOT9`}),placeholder:s({id:`akmOT9`}),onEmptyChange:f,onContentChange:()=>{y.current=p.current?.getContent().instruction??null},onSubmit:E,onEscape:O,className:`max-h-40 overflow-y-auto rounded-md border px-2 py-1 text-sm`}),(0,Z.jsxs)(`div`,{className:`flex items-center justify-end gap-1.5`,children:[(0,Z.jsx)(X,{size:`sm`,variant:`ghost`,onClick:O,children:(0,Z.jsx)(Y,{id:`dEgA5A`})}),(0,Z.jsx)(X,{size:`sm`,onClick:E,disabled:d,"aria-label":s({id:`3W5kYZ`}),children:(0,Z.jsx)(Y,{id:`tfDRzk`})})]})]}):(0,Z.jsx)(`p`,{"data-testid":`thread-comment-body`,className:`text-sm text-foreground/90`,children:n.body}),t[80]=s,t[81]=O,t[82]=E,t[83]=d,t[84]=l,t[85]=n.body,t[86]=me):me=t[86];let he;t[87]!==m||t[88]!==h||t[89]!==I||t[90]!==n.id?(he=m?(0,Z.jsxs)(X,{size:`sm`,variant:`outline`,className:`min-w-0`,onClick:I,children:[(0,Z.jsx)(ff,{className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:(0,Z.jsx)(Y,{id:`QlkiD5`})})]}):(0,Z.jsx)(Z.Fragment,{children:h&&(0,Z.jsx)(`div`,{className:`flex min-w-0 flex-nowrap items-center justify-end gap-1.5`,children:(0,Z.jsxs)(X,{size:`sm`,variant:`outline`,className:`min-w-0`,onClick:()=>dn(n.id),children:[(0,Z.jsx)(la,{className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:(0,Z.jsx)(Y,{id:`M7SqjM`})})]})})}),t[87]=m,t[88]=h,t[89]=I,t[90]=n.id,t[91]=he):he=t[91];let ge;return t[92]!==r||t[93]!==R||t[94]!==z||t[95]!==B||t[96]!==V||t[97]!==H||t[98]!==G||t[99]!==fe||t[100]!==pe||t[101]!==me||t[102]!==he?(ge=(0,Z.jsxs)(`article`,{ref:r,onPointerEnter:R,onPointerLeave:z,onFocusCapture:B,onBlurCapture:V,onClick:H,className:G,children:[fe,pe,me,he]}),t[92]=r,t[93]=R,t[94]=z,t[95]=B,t[96]=V,t[97]=H,t[98]=G,t[99]=fe,t[100]=pe,t[101]=me,t[102]=he,t[103]=ge):ge=t[103],ge}function vw(e){return!e}function yw(){return Date.now()}var bw=20,xw=1600;function Sw(e,t){let{cards:n,frame:r,ring:i,setFocusedId:a}=t;a(()=>e),r.current!==null&&cancelAnimationFrame(r.current);let o=0,s=()=>{r.current=null;let t=n.get(e);if(t){let e=window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches;t.scrollIntoView({block:`center`,behavior:e?`auto`:`smooth`});return}o+=1,!(o>=bw)&&(r.current=requestAnimationFrame(s))};s(),i.current!==null&&window.clearTimeout(i.current),i.current=window.setTimeout(()=>{i.current=null,a(t=>t===e?null:t)},xw)}function Cw(e){let t=(0,$.c)(52),{threads:n,groupByDocument:r,empty:i,testIdPrefix:a,scopeSwitch:o}=e,s=r===void 0?!1:r,{_:c}=xn(),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(null),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=new Map,t[0]=p):p=t[0];let m=(0,Q.useRef)(p),[h,g]=(0,Q.useState)(Mw),_=T(),v=le(),y;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(y=function(e,t){g(n=>{let r=new Set(n);return t?r.delete(e):r.add(e),r})},t[1]=y):y=t[1];let b=y,x=(0,Q.useRef)(null),S=(0,Q.useRef)(null),C;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(C=()=>({cards:m.current,frame:S,ring:x,setFocusedId:f}),t[2]=C):C=t[2];let w=C,E,D;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(E=()=>{let e=e=>Sw(e,w()),t=yt();t!==null&&e(t);let n=At(t=>{t!==null&&e(t)}),r=se(e);return()=>{n(),r(),x.current!==null&&window.clearTimeout(x.current),S.current!==null&&cancelAnimationFrame(S.current)}},D=[],t[3]=E,t[4]=D):(E=t[3],D=t[4]),(0,Q.useEffect)(E,D);let O,k,A,j,M,N,P,F,I;if(t[5]!==c||t[6]!==v||t[7]!==h||t[8]!==i||t[9]!==d||t[10]!==s||t[11]!==o||t[12]!==_||t[13]!==l||t[14]!==a||t[15]!==n){A=n.filter(jw);let e=n.filter(Aw),r=l?n:A,f=s?hw(r):[],p=f.length>0&&f.every(e=>h.has(e.docName)),y;t[25]===_?y=t[26]:(y=e=>_.includes(e.id),t[25]=_,t[26]=y),j=A.filter(y).map(kw);let x=A.map(Ow),S=x.length>0&&j.length===x.length,C;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(C=function(e){return e.threads.filter(Dw).map(Ew)},t[27]=C):C=t[27];let w=C,T;t[28]===_?T=t[29]:(T=function(e){let t=e.filter(e=>_.includes(e)).length;return t===0?!1:t===e.length?!0:`indeterminate`},t[28]=_,t[29]=T);let E=T,D=function(e){return(0,Z.jsx)(_w,{thread:e,sending:_.includes(e.id),active:v===e.id,focused:d===e.id,cardRef:t=>{t?m.current.set(e.id,t):m.current.delete(e.id)}},e.id)};k=Sh;let L;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(gh,{children:(0,Z.jsx)(Y,{id:`VbyRUy`})}),t[30]=L):L=t[30];let R=e.length>0&&(0,Z.jsxs)(br,{children:[(0,Z.jsx)(_r,{asChild:!0,children:(0,Z.jsxs)(X,{size:`sm`,variant:`ghost`,className:`h-6 shrink-0 gap-1 px-1.5 text-muted-foreground`,"aria-label":c(l?{id:`PHHEuH`,values:{0:e.length}}:{id:`gHb5bB`,values:{0:e.length}}),"aria-pressed":l,"data-testid":`${a}-resolved-toggle`,onClick:()=>u(Tw),children:[l?(0,Z.jsx)(uy,{"aria-hidden":`true`,className:`size-3.5`}):(0,Z.jsx)(ly,{"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`text-[11px] tabular-nums`,children:e.length})]})}),(0,Z.jsx)(vr,{children:l?(0,Z.jsx)(Y,{id:`LRLKnQ`}):(0,Z.jsx)(Y,{id:`o7AkQ0`})})]}),z=f.length>1&&(0,Z.jsxs)(br,{children:[(0,Z.jsx)(_r,{asChild:!0,children:(0,Z.jsx)(X,{size:`icon`,variant:`ghost`,className:`size-6 shrink-0 text-muted-foreground`,"aria-label":c(p?{id:`QIrBIx`}:{id:`sR0I-f`}),"data-testid":`${a}-collapse-toggle`,onClick:()=>g(p?new Set:new Set(f.map(ww))),children:p?(0,Z.jsx)(hb,{"aria-hidden":`true`,className:`size-3.5`}):(0,Z.jsx)(Cy,{"aria-hidden":`true`,className:`size-3.5`})})}),(0,Z.jsx)(vr,{children:p?(0,Z.jsx)(Y,{id:`QIrBIx`}):(0,Z.jsx)(Y,{id:`sR0I-f`})})]}),B;t[31]===A.length?B=t[32]:(B=(0,Z.jsx)(bh,{children:A.length}),t[31]=A.length,t[32]=B),t[33]!==R||t[34]!==z||t[35]!==B?(I=(0,Z.jsxs)(xh,{children:[L,(0,Z.jsxs)(`div`,{className:`flex items-center gap-1`,children:[R,z,B]})]}),t[33]=R,t[34]=z,t[35]=B,t[36]=I):I=t[36],M=o,N=A.length>0&&(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 px-4`,children:[(0,Z.jsx)($r,{checked:S,onCheckedChange:()=>sn(x,!S),"aria-label":c(S?{id:`Ns5f4J`}:{id:`8oWgty`}),"data-testid":`${a}-select-all`}),(0,Z.jsxs)(`span`,{className:`text-[11px] text-muted-foreground tabular-nums`,children:[j.length,`/`,x.length]})]}),O=vh,P=`flex flex-col gap-3`,F=r.length===0?(0,Z.jsx)(_h,{children:i}):s?f.map(e=>{let t=w(e),n=E(t);return(0,Z.jsx)(`section`,{"aria-label":e.docName,children:(0,Z.jsxs)(Cr,{open:!h.has(e.docName),onOpenChange:t=>b(e.docName,t),className:`flex flex-col gap-2`,children:[(0,Z.jsxs)(`div`,{className:`group/file flex items-center gap-1.5`,children:[(0,Z.jsx)($r,{checked:n,disabled:t.length===0,onCheckedChange:()=>sn(t,n!==!0),"aria-label":c(n===!0?{id:`T2fvhw`,values:{0:Df(e.docName)}}:{id:`WkQ0Z_`,values:{0:Df(e.docName)}}),"data-testid":`${a}-file-select-${e.docName}`,className:`opacity-0 transition-opacity focus-visible:opacity-100 group-hover/file:opacity-100`}),(0,Z.jsxs)(Sr,{title:e.docName,className:`group flex min-w-0 flex-1 cursor-pointer items-center gap-1.5 rounded text-left text-[11px] text-muted-foreground hover:text-foreground`,children:[(0,Z.jsx)(Xr,{className:`size-3 shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:Df(e.docName)}),(0,Z.jsx)(wm,{variant:`outline`,className:`shrink-0 px-1 py-0 text-[10px] tabular-nums`,children:e.threads.length}),(0,Z.jsx)(Ql,{"aria-hidden":`true`,className:`size-3 shrink-0 transition-transform group-data-[state=open]:rotate-90 motion-reduce:transition-none`})]})]}),(0,Z.jsx)(xr,{className:`flex flex-col gap-2 overflow-hidden data-[state=open]:animate-[collapsible-down_150ms_ease-out] data-[state=closed]:animate-[collapsible-up_150ms_ease-in] motion-reduce:animate-none`,children:e.threads.map(D)})]})},e.docName)}):r.map(D),t[5]=c,t[6]=v,t[7]=h,t[8]=i,t[9]=d,t[10]=s,t[11]=o,t[12]=_,t[13]=l,t[14]=a,t[15]=n,t[16]=O,t[17]=k,t[18]=A,t[19]=j,t[20]=M,t[21]=N,t[22]=P,t[23]=F,t[24]=I}else O=t[16],k=t[17],A=t[18],j=t[19],M=t[20],N=t[21],P=t[22],F=t[23],I=t[24];let L;t[37]!==O||t[38]!==P||t[39]!==F?(L=(0,Z.jsx)(O,{className:P,children:F}),t[37]=O,t[38]=P,t[39]=F,t[40]=L):L=t[40];let R;t[41]!==A.length||t[42]!==j||t[43]!==a?(R=A.length>0&&(0,Z.jsx)(pw,{threadIds:j,testIdPrefix:a}),t[41]=A.length,t[42]=j,t[43]=a,t[44]=R):R=t[44];let z;return t[45]!==k||t[46]!==M||t[47]!==N||t[48]!==L||t[49]!==R||t[50]!==I?(z=(0,Z.jsxs)(k,{children:[I,M,N,L,R]}),t[45]=k,t[46]=M,t[47]=N,t[48]=L,t[49]=R,t[50]=I,t[51]=z):z=t[51],z}function ww(e){return e.docName}function Tw(e){return!e}function Ew(e){return e.id}function Dw(e){return e.status!==`resolved`}function Ow(e){return e.id}function kw(e){return e.id}function Aw(e){return e.status===`resolved`}function jw(e){return e.status!==`resolved`}function Mw(){return new Set}function Nw(e){let t=(0,$.c)(4),{scopeSwitch:n}=e,r=K(),i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(Y,{id:`QzofTX`}),t[0]=i):i=t[0];let a;return t[1]!==n||t[2]!==r?(a=(0,Z.jsx)(Cw,{threads:r,groupByDocument:!0,empty:i,testIdPrefix:`comment-queue`,scopeSwitch:n}),t[1]=n,t[2]=r,t[3]=a):a=t[3],a}function Pw(e){let t=(0,$.c)(7),{docName:n,scopeSwitch:r}=e,i=J(n),a,o;t[0]===n?(a=t[1],o=t[2]):(a=()=>{Ze(n).catch(Fw)},o=[n],t[0]=n,t[1]=a,t[2]=o),(0,Q.useEffect)(a,o);let s;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(Y,{id:`zpfN9p`}),t[3]=s):s=t[3];let c;return t[4]!==r||t[5]!==i?(c=(0,Z.jsx)(Cw,{threads:i,empty:s,testIdPrefix:`comment-doc`,scopeSwitch:r}),t[4]=r,t[5]=i,t[6]=c):c=t[6],c}function Fw(){}function Iw(e){let t=(0,$.c)(3),{docName:n,scopeSwitch:r}=e,i;return t[0]!==n||t[1]!==r?(i=(0,Z.jsx)(Sm,{name:`comments-panel`,children:(0,Z.jsx)(Pw,{docName:n,scopeSwitch:r})}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i}function Lw(e){let t=(0,$.c)(13),{docName:n}=e,[r,i]=(0,Q.useState)(`doc`),a=rC(),o=a?`doc`:r,s,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{let e=F();return e!==null&&i(e),vn(i)},c=[],t[0]=s,t[1]=c):(s=t[0],c=t[1]),(0,Q.useEffect)(s,c);let l,u;t[2]!==n||t[3]!==o?(l=()=>(wb({scope:o,docName:n}),Rw),u=[o,n],t[2]=n,t[3]=o,t[4]=l,t[5]=u):(l=t[4],u=t[5]),(0,Q.useEffect)(l,u);let d;t[6]!==o||t[7]!==a?(d=a?void 0:(0,Z.jsx)(uu,{scope:o,onScopeChange:i}),t[6]=o,t[7]=a,t[8]=d):d=t[8];let f=d,p;return t[9]!==n||t[10]!==o||t[11]!==f?(p=o===`doc`?(0,Z.jsx)(Iw,{docName:n,scopeSwitch:f}):(0,Z.jsx)(Nw,{scopeSwitch:f}),t[9]=n,t[10]=o,t[11]=f,t[12]=p):p=t[12],p}function Rw(){return wb(null)}var zw=!1,Bw=new Set;function Vw(e){if(e!==zw){zw=e;for(let e of Bw)e()}}function Hw(e){return Bw.add(e),()=>{Bw.delete(e)}}function Uw(){return zw}function Ww(){return(0,Q.useSyncExternalStore)(Hw,Uw,Gw)}function Gw(){return!1}var Kw=new Map(ds.map(e=>[e.id,e.alias]));function qw(e){return e.source===`markdownlint`?Kw.get(e.code):void 0}function Jw(e,t,n){return xo({relativePath:bl(e),source:t.source,code:t.code,ruleAlias:qw(t),message:t.message,line:t.range.start.line+1,column:t.range.start.character+1,lineText:n})}function Yw(e){return Co(e===null?null:bl(e))}var Xw=5;async function Zw(e){let t=await fetch(`/api/backlinks?docName=${encodeURIComponent(e)}`),n=await t.json().catch(()=>null);if(!t.ok){let e=go.safeParse(n),r=t.status;throw e.success?Error(e.data.title):new Pr(ic._({id:`XopE_I`,values:{status:r}}),{status:r})}let r=bs.safeParse(n);if(!r.success)throw new Pr(ic._({id:`lZAiSP`}),{status:t.status});return r.data.backlinks}async function Qw(e){let t=await fetch(`/api/forward-links?docName=${encodeURIComponent(e)}`),n=await t.json().catch(()=>null);if(!t.ok){let e=go.safeParse(n),r=t.status;throw e.success?Error(e.data.title):new Pr(ic._({id:`GemPfn`,values:{status:r}}),{status:r})}let r=fo.safeParse(n);if(!r.success)throw new Pr(ic._({id:`2YZwPB`}),{status:t.status});return r.data}function $w(e){let t=e.split(`/`);return t.length<=2?e:`…/${t.slice(-2).join(`/`)}`}function eT(e){window.location.hash=ep(e)}function tT(e){let t=(0,$.c)(9),{title:n,count:r,isLoading:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(Zl,{className:`size-3.5 text-muted-foreground transition-transform group-data-[state=closed]:-rotate-90`}),t[0]=a):a=t[0];let o;t[1]===n?o=t[2]:(o=(0,Z.jsxs)(`span`,{className:`flex items-center gap-2.5`,children:[a,(0,Z.jsx)(gh,{children:n})]}),t[1]=n,t[2]=o);let s;t[3]!==r||t[4]!==i?(s=!i&&(0,Z.jsx)(bh,{children:r}),t[3]=r,t[4]=i,t[5]=s):s=t[5];let c;return t[6]!==o||t[7]!==s?(c=(0,Z.jsxs)(Sr,{className:`group flex w-full cursor-pointer items-center justify-between px-5 py-3 text-left transition-colors hover:bg-muted/40`,children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8],c}function nT(e){let t=(0,$.c)(10),{total:n,expanded:r,onToggle:i}=e;if(n<=Xw)return null;let a=n-Xw,o;t[0]===r?o=t[1]:(o=r?(0,Z.jsx)(Zl,{className:`size-3`}):(0,Z.jsx)(Ql,{className:`size-3`}),t[0]=r,t[1]=o);let s;t[2]!==r||t[3]!==a?(s=r?(0,Z.jsx)(Y,{id:`6fGjTz`}):(0,Z.jsx)(Y,{id:`ZptNUh`,values:{hidden:a}}),t[2]=r,t[3]=a,t[4]=s):s=t[4];let c;return t[5]!==r||t[6]!==i||t[7]!==o||t[8]!==s?(c=(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":r,className:`mt-2 inline-flex cursor-pointer items-center gap-1 px-3 text-xs text-muted-foreground transition-colors hover:text-foreground`,onClick:i,children:[o,s]}),t[5]=r,t[6]=i,t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function rT(e){let t=(0,$.c)(38),{icon:n,iconColorClass:r,rowTooltip:i,title:a,path:o,anchor:s,snippet:c,titleHover:l,ariaLabel:u,href:d,external:f,disabled:p,onClick:m,trailing:h}=e,g=o!==void 0&&o!==a,_=r??`text-muted-foreground`,v;t[0]===_?v=t[1]:(v=Qn(`mt-0.5 shrink-0`,_),t[0]=_,t[1]=v);let y;t[2]!==n||t[3]!==v?(y=(0,Z.jsx)(`span`,{className:v,children:n}),t[2]=n,t[3]=v,t[4]=y):y=t[4];let b=y,x;t[5]!==u||t[6]!==p||t[7]!==f||t[8]!==d||t[9]!==m||t[10]!==a||t[11]!==l?(x=d?(0,Z.jsxs)(`a`,{href:d,target:f?`_blank`:void 0,rel:f?`noopener noreferrer`:void 0,"aria-label":u,title:l,onClick:m,className:`block w-full truncate text-left font-medium text-foreground no-underline outline-none after:absolute after:inset-0 after:rounded-md focus-visible:after:ring-2 focus-visible:after:ring-ring`,children:[a,f?(0,Z.jsxs)(`span`,{className:`sr-only`,children:[` `,(0,Z.jsx)(Y,{id:`dbtjJh`})]}):null]}):(0,Z.jsx)(`button`,{type:`button`,"aria-label":u,title:l,disabled:p,onClick:m,className:Qn(`block w-full truncate text-left font-medium text-foreground no-underline outline-none after:absolute after:inset-0 after:rounded-md focus-visible:after:ring-2 focus-visible:after:ring-ring`,`cursor-pointer bg-transparent p-0 disabled:cursor-not-allowed disabled:opacity-60`),children:a}),t[5]=u,t[6]=p,t[7]=f,t[8]=d,t[9]=m,t[10]=a,t[11]=l,t[12]=x):x=t[12];let S=x,C;t[13]===b?C=t[14]:(C=(0,Z.jsx)(`div`,{className:`mt-px flex items-center`,children:b}),t[13]=b,t[14]=C);let w;t[15]!==s||t[16]!==o||t[17]!==g?(w=g?(0,Z.jsxs)(`div`,{className:`truncate font-mono text-xs text-muted-foreground`,children:[o,s?(0,Z.jsxs)(`span`,{className:`ml-1`,children:[`· #`,s]}):null]}):null,t[15]=s,t[16]=o,t[17]=g,t[18]=w):w=t[18];let T;t[19]===c?T=t[20]:(T=c?(0,Z.jsx)(`p`,{className:`line-clamp-2 text-muted-foreground`,children:c}):null,t[19]=c,t[20]=T);let E;t[21]!==S||t[22]!==w||t[23]!==T?(E=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5 text-1sm`,children:[S,w,T]}),t[21]=S,t[22]=w,t[23]=T,t[24]=E):E=t[24];let D;t[25]===h?D=t[26]:(D=h?(0,Z.jsx)(`div`,{className:`mt-0.5 flex shrink-0 items-center`,children:h}):null,t[25]=h,t[26]=D);let O;t[27]!==C||t[28]!==E||t[29]!==D?(O=(0,Z.jsxs)(`div`,{className:`group relative flex items-start gap-2.5 rounded-md px-3 py-2.5 transition-colors hover:bg-muted/80`,children:[C,E,D]}),t[27]=C,t[28]=E,t[29]=D,t[30]=O):O=t[30];let k=O;if(i){let e;t[31]===k?e=t[32]:(e=(0,Z.jsx)(_r,{asChild:!0,children:k}),t[31]=k,t[32]=e);let n;t[33]===i?n=t[34]:(n=(0,Z.jsx)(vr,{side:`top`,children:i}),t[33]=i,t[34]=n);let r;return t[35]!==e||t[36]!==n?(r=(0,Z.jsxs)(br,{children:[e,n]}),t[35]=e,t[36]=n,t[37]=r):r=t[37],r}return k}function iT(e){let t=(0,$.c)(39),{docName:n}=e,{_:r}=xn(),{folderPaths:i,pages:a,pagesBySlug:o,pagesByBasename:s,loading:c}=Lu(),l,u;t[0]===n?(l=t[1],u=t[2]):(l=[`backlinks`,n],u=()=>Zw(n),t[0]=n,t[1]=l,t[2]=u);let d;t[3]!==n||t[4]!==c||t[5]!==a?(d=!c&&(a.has(n)||Na(n)),t[3]=n,t[4]=c,t[5]=a,t[6]=d):d=t[6];let f;t[7]!==l||t[8]!==u||t[9]!==d?(f={queryKey:l,queryFn:u,enabled:d},t[7]=l,t[8]=u,t[9]=d,t[10]=f):f=t[10];let{data:p,isLoading:m,error:h}=Rn(f),g;t[11]===p?g=t[12]:(g=p===void 0?[]:p,t[11]=p,t[12]=g);let _=g,[v,y]=(0,Q.useState)(!1),[b,x]=(0,Q.useState)(n);b!==n&&(x(n),y(!1));let S;t[13]!==_||t[14]!==v?(S=v?_:_.slice(0,Xw),t[13]=_,t[14]=v,t[15]=S):S=t[15];let C=S,w;t[16]===r?w=t[17]:(w=r({id:`9NJWgv`}),t[16]=r,t[17]=w);let T;t[18]!==_.length||t[19]!==m||t[20]!==w?(T=(0,Z.jsx)(tT,{title:w,count:_.length,isLoading:m}),t[18]=_.length,t[19]=m,t[20]=w,t[21]=T):T=t[21];let E;t[22]!==r||t[23]!==_.length||t[24]!==h||t[25]!==v||t[26]!==i||t[27]!==m||t[28]!==a||t[29]!==s||t[30]!==o||t[31]!==C?(E=h?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(hh,{children:h instanceof Error?h.message:r({id:`Xet9MX`})})}):_.length===0&&!m?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(_h,{children:(0,Z.jsx)(Y,{id:`rVxu1k`})})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`flex flex-col gap-1`,children:C.map((e,t)=>{let n=of(e.source,{pages:a,folderPaths:i,pagesBySlug:o,pagesByBasename:s});return(0,Z.jsx)(rT,{icon:(0,Z.jsx)(Fe,{className:`size-3.5`}),title:e.title,path:$w(e.source),titleHover:e.source,anchor:e.anchor,snippet:e.snippet,href:ep(n.hashDocName,e.anchor)},`${e.source}-${t}`)})}),(0,Z.jsx)(nT,{total:_.length,expanded:v,onToggle:()=>y(aT)})]}),t[22]=r,t[23]=_.length,t[24]=h,t[25]=v,t[26]=i,t[27]=m,t[28]=a,t[29]=s,t[30]=o,t[31]=C,t[32]=E):E=t[32];let D;t[33]!==m||t[34]!==E?(D=(0,Z.jsx)(xr,{children:(0,Z.jsx)(`div`,{className:`px-2 pb-3`,"aria-busy":m,children:E})}),t[33]=m,t[34]=E,t[35]=D):D=t[35];let O;return t[36]!==D||t[37]!==T?(O=(0,Z.jsxs)(Cr,{defaultOpen:!0,children:[T,D]}),t[36]=D,t[37]=T,t[38]=O):O=t[38],O}function aT(e){return!e}function oT(e){let t=(0,$.c)(49),{docName:n}=e,{_:r}=xn(),{addPage:i,folderPaths:a,pages:o,pagesBySlug:c,pagesByBasename:l,loading:u}=Lu(),d,f;t[0]===n?(d=t[1],f=t[2]):(d=[`forward-links`,n],f=()=>Qw(n),t[0]=n,t[1]=d,t[2]=f);let p;t[3]!==n||t[4]!==o||t[5]!==u?(p=!u&&(o.has(n)||Na(n)),t[3]=n,t[4]=o,t[5]=u,t[6]=p):p=t[6];let m;t[7]!==d||t[8]!==f||t[9]!==p?(m={queryKey:d,queryFn:f,enabled:p},t[7]=d,t[8]=f,t[9]=p,t[10]=m):m=t[10];let{data:h,isLoading:g,error:_}=Rn(m),v;t[11]===h?.forwardLinks?v=t[12]:(v=h?.forwardLinks??[],t[11]=h?.forwardLinks,t[12]=v);let y=v,[b,x]=(0,Q.useState)(null),[S,C]=(0,Q.useState)(!1),[w,T]=(0,Q.useState)(n);w!==n&&(T(n),C(!1),x(null));let E;t[13]!==S||t[14]!==y?(E=S?y:y.slice(0,Xw),t[13]=S,t[14]=y,t[15]=E):E=t[15];let D=E,O;t[16]!==r||t[17]!==i||t[18]!==b?(O=async function(e,t){if(!b){x(t);try{await s(e,{addPage:i,onCreated:eT}),x(null)}catch(e){let t=e;Us.error(t instanceof Error?t.message:r({id:`tfi40B`})),x(null)}}},t[16]=r,t[17]=i,t[18]=b,t[19]=O):O=t[19];let k=O,A;t[20]!==r||t[21]!==b||t[22]!==a||t[23]!==k||t[24]!==o||t[25]!==l||t[26]!==c||t[27]!==u?(A=function(e){let{title:t}=e;if(e.kind===`external`){let t=e.title===e.url;return(0,Z.jsx)(rT,{icon:(0,Z.jsx)(Fl,{className:`size-3.5`}),rowTooltip:r({id:`XDzAnp`}),title:e.title,path:t?void 0:e.url,titleHover:e.url,snippet:e.snippet,href:e.url,external:!0},`ext:${e.url}`)}let n=Gr(e.docName,{pages:o,folderPaths:a,pagesBySlug:c,pagesByBasename:l}),i=!u&&n.kind===`create`,s=!u&&n.kind===`navigate`&&n.displayState===`folder`,d=$w(e.docName),f=e.title===e.docName?d:e.title,p=`doc:${e.docName}:${e.anchor??``}`,m=n.kind===`navigate`?n.hashDocName:e.docName,h=n.kind===`navigate`&&n.hash?n.hash:ep(m,e.anchor);if(i&&n.kind===`create`){let i={initialDir:n.initialDir,suggestedName:n.suggestedName};return(0,Z.jsx)(rT,{icon:(0,Z.jsx)(Uf,{className:`size-3.5`}),iconColorClass:`text-amber-600 dark:text-amber-400`,rowTooltip:r(b===p?{id:`kj9pAE`}:{id:`IQPyrD`}),ariaLabel:r(b===p?{id:`un8kBM`,values:{linkTitle:t}}:{id:`jEdF24`,values:{linkTitle:t}}),title:f,path:d,titleHover:e.docName,anchor:e.anchor,snippet:e.snippet,disabled:b!==null,onClick:()=>void k(i,p)},p)}return s&&n.kind===`navigate`?(0,Z.jsx)(rT,{icon:(0,Z.jsx)(Qd,{className:`size-3.5`}),iconColorClass:`text-sky-600 dark:text-sky-400`,ariaLabel:r({id:`P6lAT3`,values:{linkTitle:t}}),title:f,path:d,titleHover:e.docName,anchor:e.anchor,snippet:e.snippet,href:h},p):(0,Z.jsx)(rT,{icon:(0,Z.jsx)(Fe,{className:`size-3.5`}),title:f,path:d,titleHover:e.docName,anchor:e.anchor,snippet:e.snippet,href:h},p)},t[20]=r,t[21]=b,t[22]=a,t[23]=k,t[24]=o,t[25]=l,t[26]=c,t[27]=u,t[28]=A):A=t[28];let j=A,M;t[29]===r?M=t[30]:(M=r({id:`O0Z2Xr`}),t[29]=r,t[30]=M);let N;t[31]!==g||t[32]!==y.length||t[33]!==M?(N=(0,Z.jsx)(tT,{title:M,count:y.length,isLoading:g}),t[31]=g,t[32]=y.length,t[33]=M,t[34]=N):N=t[34];let P;t[35]!==r||t[36]!==_||t[37]!==S||t[38]!==g||t[39]!==y.length||t[40]!==j||t[41]!==D?(P=_?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(hh,{children:_ instanceof Error?_.message:r({id:`pZAs1T`})})}):y.length===0&&!g?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(_h,{children:(0,Z.jsx)(Y,{id:`roiUQQ`})})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`flex flex-col gap-1`,children:D.map(j)}),(0,Z.jsx)(nT,{total:y.length,expanded:S,onToggle:()=>C(sT)})]}),t[35]=r,t[36]=_,t[37]=S,t[38]=g,t[39]=y.length,t[40]=j,t[41]=D,t[42]=P):P=t[42];let F;t[43]!==g||t[44]!==P?(F=(0,Z.jsx)(xr,{children:(0,Z.jsx)(`div`,{className:`px-2 pb-3`,"aria-busy":g,children:P})}),t[43]=g,t[44]=P,t[45]=F):F=t[45];let I;return t[46]!==N||t[47]!==F?(I=(0,Z.jsxs)(Cr,{defaultOpen:!0,children:[N,F]}),t[46]=N,t[47]=F,t[48]=I):I=t[48],I}function sT(e){return!e}function cT(e){let t=(0,$.c)(42),{docName:n}=e,{_:r}=xn(),{pages:i,loading:a}=Lu(),o,s;t[0]===n?(o=t[1],s=t[2]):(o=[`forward-links`,n],s=()=>Qw(n),t[0]=n,t[1]=o,t[2]=s);let c;t[3]!==n||t[4]!==i||t[5]!==a?(c=!a&&(i.has(n)||Na(n)),t[3]=n,t[4]=i,t[5]=a,t[6]=c):c=t[6];let l;t[7]!==o||t[8]!==s||t[9]!==c?(l={queryKey:o,queryFn:s,enabled:c},t[7]=o,t[8]=s,t[9]=c,t[10]=l):l=t[10];let{data:u,isLoading:d,error:f}=Rn(l),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(n);h!==n&&(g(n),m(!1));let _=u?.localTargets,v;t[11]===_?v=t[12]:(v=_??[],t[11]=_,t[12]=v);let y=v,b;t[13]!==p||t[14]!==y?(b=p?y:y.slice(0,Xw),t[13]=p,t[14]=y,t[15]=b):b=t[15];let x=b,S;t[16]===n?S=t[17]:(S=function(e){let t={docName:n,line:e.line+1,column:e.column+1,source:`links`};ou(n,{kind:`lint`,detail:t}),window.dispatchEvent(new CustomEvent(gu,{detail:t}))},t[16]=n,t[17]=S);let C=S,w;t[18]!==r||t[19]!==C?(w=function(e){let t=e.role===`image`,n=e.status===`exact`||e.status===`fallback`,i=e.resolvedTarget??e.href,a=e.status===`missing`?r({id:`VU3Nrn`}):r({id:`XYZ7tp`}),o=n?r(t?{id:`radOpL`,values:{identity:i}}:{id:`6LJJ1v`,values:{identity:i}}):e.status===`missing`?r(t?{id:`vPLUCm`,values:{identity:i}}:{id:`Lrsl_h`,values:{identity:i}}):r(t?{id:`y-LQPF`,values:{identity:i}}:{id:`Y_iImT`,values:{identity:i}});return(0,Z.jsx)(rT,{icon:t?(0,Z.jsx)(Hr,{className:`size-3.5`}):(0,Z.jsx)(Fe,{className:`size-3.5`}),iconColorClass:n?void 0:`text-amber-600 dark:text-amber-400`,title:$w(i),titleHover:i,ariaLabel:o,trailing:n?void 0:(0,Z.jsx)(wm,{variant:`outline`,className:`font-normal text-muted-foreground`,children:a}),onClick:()=>C(e)},`lt:${e.range.start}-${e.range.end}`)},t[18]=r,t[19]=C,t[20]=w):w=t[20];let T=w,E;t[21]===r?E=t[22]:(E=r({id:`U3RIJu`}),t[21]=r,t[22]=E);let D;t[23]!==d||t[24]!==y.length||t[25]!==E?(D=(0,Z.jsx)(tT,{title:E,count:y.length,isLoading:d}),t[23]=d,t[24]=y.length,t[25]=E,t[26]=D):D=t[26];let O;t[27]!==r||t[28]!==f||t[29]!==p||t[30]!==d||t[31]!==_||t[32]!==T||t[33]!==y.length||t[34]!==x?(O=f?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(hh,{children:f instanceof Error?f.message:r({id:`1xui0Q`})})}):_===void 0&&!d?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(_h,{children:(0,Z.jsx)(Y,{id:`g-dkjJ`})})}):y.length===0&&!d?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(_h,{children:(0,Z.jsx)(Y,{id:`pJ7XCo`})})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`flex flex-col gap-1`,children:x.map(T)}),(0,Z.jsx)(nT,{total:y.length,expanded:p,onToggle:()=>m(lT)})]}),t[27]=r,t[28]=f,t[29]=p,t[30]=d,t[31]=_,t[32]=T,t[33]=y.length,t[34]=x,t[35]=O):O=t[35];let k;t[36]!==d||t[37]!==O?(k=(0,Z.jsx)(xr,{children:(0,Z.jsx)(`div`,{className:`px-2 pb-3`,"aria-busy":d,children:O})}),t[36]=d,t[37]=O,t[38]=k):k=t[38];let A;return t[39]!==D||t[40]!==k?(A=(0,Z.jsxs)(Cr,{defaultOpen:!0,children:[D,k]}),t[39]=D,t[40]=k,t[41]=A):A=t[41],A}function lT(e){return!e}function uT(e){let t=(0,$.c)(15),{docName:n,className:r}=e,i=r===void 0?``:r,a;t[0]===n?a=t[1]:(a=(0,Z.jsx)(oT,{docName:n}),t[0]=n,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(ua,{}),t[2]=o):o=t[2];let s;t[3]===n?s=t[4]:(s=(0,Z.jsx)(cT,{docName:n}),t[3]=n,t[4]=s);let c;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(ua,{}),t[5]=c):c=t[5];let l;t[6]===n?l=t[7]:(l=(0,Z.jsx)(iT,{docName:n}),t[6]=n,t[7]=l);let u;t[8]!==a||t[9]!==s||t[10]!==l?(u=(0,Z.jsxs)(vh,{className:`px-0 py-0`,children:[a,o,s,c,l]}),t[8]=a,t[9]=s,t[10]=l,t[11]=u):u=t[11];let d;return t[12]!==i||t[13]!==u?(d=(0,Z.jsx)(Sh,{className:i,children:u}),t[12]=i,t[13]=u,t[14]=d):d=t[14],d}function dT(e){let t=e.setTimer??((e,t)=>setTimeout(e,t)),n=e.clearTimer??(e=>clearTimeout(e)),r=!1,i=!1,a=null,o=null,s=e.baseMs,c=!1,l=n=>{if(!r){if(e.isPaused()){c=!0;return}a=t(u,n)}};async function u(){if(a=null,c=!1,r)return;if(e.isPaused()){c=!0;return}o=new AbortController;let t=o.signal;try{let n=await e.poll(t);if(r)return;n===`ok`?(s=e.baseMs,l(e.baseMs)):(s=Math.min(s*2,e.maxBackoffMs),l(s))}catch{if(r||t.aborted)return;s=Math.min(s*2,e.maxBackoffMs),l(s)}}return{start(){r||i||(i=!0,u())},resume(){r||!e.isPaused()&&c&&a===null&&(c=!1,u())},stop(){r=!0,a!==null&&(n(a),a=null),o?.abort()}}}var fT=1e4,pT=6e4;async function mT(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(hT)),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 hT(e){return e.type===`checkpoint`?e.checkpoint!==null&&Go(e.checkpoint.kind):!0}function gT(e){let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/1e3);if(r<60)return ic._({id:`xOTzt5`});if(r<3600){let e=Math.floor(r/60);return ic._({id:`UyROxs`,values:{mins:e}})}if(r<86400){let e=Math.floor(r/3600);return ic._({id:`wXO4Tg`,values:{hrs:e}})}if(r<86400*2)return ic._({id:`rQRrkB`});let i=Math.floor(r/86400);return i<7?ic._({id:`6u9LvN`,values:{days:i}}):t.toLocaleDateString()}function _T(e){return new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function vT(e){if(e.type===`checkpoint`)return{kind:`recovered`};if(e.type===`upstream`)return{kind:`upstream`};let t=e.message,n=/^rollback: .+ to ([0-9a-f]{7,40})$/.exec(t);if(n)return{kind:`restore`,targetSha7:n[1].slice(0,7)};let r=/^rename: (.+) -> (.+)$/.exec(t);return r?{kind:`rename`,from:r[1],to:r[2]}:t.startsWith(`reconcile: `)?{kind:`reconcile`}:t.startsWith(`import: `)?{kind:`upstream`}:{kind:`edit`}}function yT(e){return e.split(`/`).pop()??e}function bT(e){return e.type===`checkpoint`?ic._({id:`C-twqs`}):e.type===`upstream`?ic._({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`?ic._({id:`B2DrPb`}):e.author}function xT(e){let t=to;return e===t.fileSystem?`file-system`:e===t.service||e===t.gitUpstream?`upstream`:e===t.generator?`generated`:`person`}function ST(e){let t=(0,$.c)(19),{entry:n,isDark:r}=e;if(n.type===`checkpoint`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Wc,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),t[0]=e):e=t[0],e}if(n.type===`upstream`){let e;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Cl,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[1]=e):e=t[1],e}if(n.contributors.length>0){let e=n.contributors[0],i=e.colorSeed??e.name,a;t[2]===i?a=t[3]:(a=Aa(i),t[2]=i,t[3]=a);let o=a,s=r?ss[o]??Cs[o]:Cs[o],c;t[4]!==s||t[5]!==i?(c=s??no(i),t[4]=s,t[5]=i,t[6]=c):c=t[6];let l=c;if(o!==`bot`){let e;t[7]===l?e=t[8]:(e={color:l},t[7]=l,t[8]=e);let n;return t[9]!==o||t[10]!==e?(n=(0,Z.jsx)(kh,{icon:o,width:14,height:14,className:`shrink-0`,style:e}),t[9]=o,t[10]=e,t[11]=n):n=t[11],n}switch(xT(e.name)){case`file-system`:{let e;return t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Oy,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[12]=e):e=t[12],e}case`upstream`:{let e;return t[13]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Tl,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[13]=e):e=t[13],e}case`generated`:{let e;return t[14]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(re,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[14]=e):e=t[14],e}default:{let e;return t[15]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(gb,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[15]=e):e=t[15],e}}}if(n.authorEmail.includes(`agent`)||n.author.includes(`agent`)||n.authorEmail.includes(`cursor`)||n.authorEmail.includes(`claude`)){let e;return t[16]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(re,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[16]=e):e=t[16],e}if(n.author===`openknowledge-server`||n.author===`server`){let e;return t[17]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Tl,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[17]=e):e=t[17],e}let i;return t[18]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(gb,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[18]=i):i=t[18],i}function CT(e){let t=[];for(let n of e.contributors)if(n.summaries)for(let e of n.summaries)t.push(e);return t}function wT(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(ET),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(TT)},children:[r?(0,Z.jsx)(Zl,{className:`size-3`}):(0,Z.jsx)(Ql,{className:`size-3`}),r?(0,Z.jsx)(Y,{id:`vLyv1R`}):(0,Z.jsx)(Y,{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 TT(e){return!e}function ET(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 DT(e){let t=(0,$.c)(36),{descriptor:n,allDocs:r,versionBySha7:i,onJumpToVersion:a}=e,{_:o}=xn();if(n.kind===`restore`){let e,r;t[0]!==o||t[1]!==n.targetSha7||t[2]!==i?(r=i.get(n.targetSha7),e=o(r?{id:`sICrVf`,values:{0:_T(r.timestamp)}}:{id:`i09An-`,values:{0:n.targetSha7}}),t[0]=o,t[1]=n.targetSha7,t[2]=i,t[3]=e,t[4]=r):(e=t[3],r=t[4]);let s=e,c;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(la,{className:`size-3 shrink-0`,"aria-hidden":!0}),t[5]=c):c=t[5];let l;return t[6]!==n.targetSha7||t[7]!==s||t[8]!==a||t[9]!==r?(l=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1 text-xs text-muted-foreground`,children:[c,r?(0,Z.jsx)(`button`,{type:`button`,className:`truncate text-left underline-offset-2 hover:text-foreground hover:underline`,title:s,onClick:e=>{e.stopPropagation(),a(n.targetSha7)},children:s}):(0,Z.jsx)(`span`,{className:`truncate`,title:s,children:s})]}),t[6]=n.targetSha7,t[7]=s,t[8]=a,t[9]=r,t[10]=l):l=t[10],l}if(n.kind===`rename`){let e=`${n.from} → ${n.to}`,r;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(sl,{className:`size-3 shrink-0`,"aria-hidden":!0}),t[11]=r):r=t[11];let i;t[12]!==o||t[13]!==n.from||t[14]!==n.to?(i=o({id:`GkYV_4`,values:{0:yT(n.from),1:yT(n.to)}}),t[12]=o,t[13]=n.from,t[14]=n.to,t[15]=i):i=t[15];let a;t[16]===i?a=t[17]:(a=(0,Z.jsx)(`span`,{className:`truncate`,children:i}),t[16]=i,t[17]=a);let s;return t[18]!==e||t[19]!==a?(s=(0,Z.jsxs)(`p`,{className:`flex items-center gap-1 truncate text-xs text-muted-foreground`,title:e,children:[r,a]}),t[18]=e,t[19]=a,t[20]=s):s=t[20],s}if(n.kind===`reconcile`){let e;t[21]===o?e=t[22]:(e=o({id:`0qyKG6`}),t[21]=o,t[22]=e);let n;return t[23]===e?n=t[24]:(n=(0,Z.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:e}),t[23]=e,t[24]=n),n}if(n.kind===`recovered`)return null;if(r.length>0){let e;t[25]===r?e=t[26]:(e=r.join(`, `),t[25]=r,t[26]=e);let n;t[27]===r?n=t[28]:(n=r.join(`, `),t[27]=r,t[28]=n);let i;return t[29]!==e||t[30]!==n?(i=(0,Z.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,title:e,children:n}),t[29]=e,t[30]=n,t[31]=i):i=t[31],i}if(n.kind===`upstream`)return null;let s;t[32]===o?s=t[33]:(s=o({id:`MRZxAn`}),t[32]=o,t[33]=s);let c;return t[34]===s?c=t[35]:(c=(0,Z.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:s}),t[34]=s,t[35]=c),c}function OT(e){let t=(0,$.c)(122),{entry:n,isDark:r,docName:i,laterEdits:a,onRestoreSuccess:o,versionBySha7:s,onJumpToVersion:c,registerRowRef:l,flashing:u}=e,{_:d}=xn(),f;t[0]===n.timestamp?f=t[1]:(f=gT(n.timestamp),t[0]=n.timestamp,t[1]=f);let p=f,m;t[2]===n?m=t[3]:(m=bT(n),t[2]=n,t[3]=m);let h=m,g;t[4]===n.timestamp?g=t[5]:(g=_T(n.timestamp),t[4]=n.timestamp,t[5]=g);let _=g,v;t[6]===n.contributors?v=t[7]:(v=n.contributors.flatMap(kT),t[6]=n.contributors,t[7]=v);let y=v,b;t[8]===n?b=t[9]:(b=CT(n),t[8]=n,t[9]=b);let x=b,S;t[10]===n?S=t[11]:(S=vT(n),t[10]=n,t[11]=S);let C=S,[w,T]=(0,Q.useState)(!1),[E,D]=(0,Q.useState)(!1),O=(0,Q.useRef)(null),k=Mh(),A=k?.docName===i&&k.sha===n.sha,j,M;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(j=()=>()=>O.current?.abort(),M=[],t[12]=j,t[13]=M):(j=t[12],M=t[13]),(0,Q.useEffect)(j,M);let N;t[14]!==_||t[15]!==h||t[16]!==i||t[17]!==n.parentSha||t[18]!==n.sha||t[19]!==a||t[20]!==p?(N=()=>{Ah(),jh({docName:i,sha:n.sha,parentSha:n.parentSha??null,laterEdits:a,authorName:h,relativeTime:p,absoluteTime:_})},t[14]=_,t[15]=h,t[16]=i,t[17]=n.parentSha,t[18]=n.sha,t[19]=a,t[20]=p,t[21]=N):N=t[21];let P=N,F;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(F=function(){O.current?.abort(),O.current=null,D(!1),T(!1)},t[22]=F):F=t[22];let I=F,L;t[23]!==d||t[24]!==i||t[25]!==n.sha||t[26]!==o?(L=async function(){D(!0);let e=new AbortController;O.current=e;let t=function(){e.signal.aborted||D(!1),O.current===e&&(O.current=null)},r;try{r=await fetch(`/api/rollback`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({docName:i,commitSha:n.sha}),signal:e.signal})}catch(r){let a=r;!e.signal.aborted&&!(a instanceof DOMException&&a.name===`AbortError`)&&(console.error(`[timeline] rollback fetch failed`,{docName:i,sha:n.sha,err:a}),Us.error(d({id:`NkXEFS`}),{duration:4e3})),t();return}if(e.signal.aborted){t();return}if(r.ok)T(!1),o();else{let e=`HTTP ${r.status}`;try{let t=go.safeParse(await r.json());t.success&&(e=t.data.title)}catch{}console.error(`[timeline] rollback failed`,{docName:i,sha:n.sha,status:r.status,detail:e}),Us.error(d({id:`uM6jnS`}),{description:e,duration:6e3})}t()},t[23]=d,t[24]=i,t[25]=n.sha,t[26]=o,t[27]=L):L=t[27];let R=L,z;t[28]!==n||t[29]!==r?(z=(0,Z.jsx)(ST,{entry:n,isDark:r}),t[28]=n,t[29]=r,t[30]=z):z=t[30];let B=z,V=u?`ring-2 ring-ring ring-offset-1 ring-offset-background`:``,H;t[31]===V?H=t[32]:(H=[`flex flex-col rounded-lg transition-shadow`,V],t[31]=V,t[32]=H);let U=H.join(` `),ee=A?`bg-muted`:`hover:bg-muted/80`,W;t[33]===ee?W=t[34]:(W=[`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`,ee],t[33]=ee,t[34]=W);let te=W.join(` `),G;t[35]===P?G=t[36]:(G=e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),P())},t[35]=P,t[36]=G);let K;t[37]===B?K=t[38]:(K=(0,Z.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:B}),t[37]=B,t[38]=K);let q;t[39]===h?q=t[40]:(q=(0,Z.jsx)(`span`,{className:`truncate text-xs text-foreground`,children:h}),t[39]=h,t[40]=q);let ne;t[41]!==n.timestamp||t[42]!==p?(ne=(0,Z.jsx)(`time`,{className:`ml-auto shrink-0 text-xs text-muted-foreground/80`,dateTime:n.timestamp,title:n.timestamp,children:p}),t[41]=n.timestamp,t[42]=p,t[43]=ne):ne=t[43];let re;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`h-3 w-px shrink-0 bg-border`}),t[44]=re):re=t[44];let J;t[45]===d?J=t[46]:(J=d({id:`Yea-K5`}),t[45]=d,t[46]=J);let ie;t[47]!==R||t[48]!==a?(ie=e=>{e.stopPropagation(),a>0?T(!0):R()},t[47]=R,t[48]=a,t[49]=ie):ie=t[49];let ae;t[50]===E?ae=t[51]:(ae=E?(0,Z.jsx)(cf,{"aria-hidden":`true`,className:`size-3`}):(0,Z.jsx)(Wf,{className:`size-3`}),t[50]=E,t[51]=ae);let oe;t[52]!==E||t[53]!==J||t[54]!==ie||t[55]!==ae?(oe=(0,Z.jsx)(_r,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon`,className:`size-5 shrink-0 text-muted-foreground hover:text-destructive`,"data-testid":`timeline-entry-restore`,"aria-label":J,disabled:E,onClick:ie,children:ae})}),t[52]=E,t[53]=J,t[54]=ie,t[55]=ae,t[56]=oe):oe=t[56];let se;t[57]===d?se=t[58]:(se=d({id:`Yea-K5`}),t[57]=d,t[58]=se);let ce;t[59]===se?ce=t[60]:(ce=(0,Z.jsx)(vr,{side:`top`,children:se}),t[59]=se,t[60]=ce);let le;t[61]!==oe||t[62]!==ce?(le=(0,Z.jsxs)(br,{children:[oe,ce]}),t[61]=oe,t[62]=ce,t[63]=le):le=t[63];let ue;t[64]!==q||t[65]!==ne||t[66]!==le?(ue=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[q,ne,re,le]}),t[64]=q,t[65]=ne,t[66]=le,t[67]=ue):ue=t[67];let de;t[68]===x?de=t[69]:(de=x.length>0&&(0,Z.jsx)(wT,{summaries:x}),t[68]=x,t[69]=de);let fe;t[70]!==y||t[71]!==C||t[72]!==c||t[73]!==s?(fe=(0,Z.jsx)(DT,{descriptor:C,allDocs:y,versionBySha7:s,onJumpToVersion:c}),t[70]=y,t[71]=C,t[72]=c,t[73]=s,t[74]=fe):fe=t[74];let pe;t[75]!==ue||t[76]!==de||t[77]!==fe?(pe=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[ue,de,fe]}),t[75]=ue,t[76]=de,t[77]=fe,t[78]=pe):pe=t[78];let me;t[79]!==P||t[80]!==A||t[81]!==te||t[82]!==G||t[83]!==K||t[84]!==pe?(me=(0,Z.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-pressed":A,"data-testid":`timeline-entry-open`,className:te,onClick:P,onKeyDown:G,children:[K,pe]}),t[79]=P,t[80]=A,t[81]=te,t[82]=G,t[83]=K,t[84]=pe,t[85]=me):me=t[85];let he;t[86]!==l||t[87]!==U||t[88]!==me?(he=(0,Z.jsx)(`div`,{ref:l,className:U,children:me}),t[86]=l,t[87]=U,t[88]=me,t[89]=he):he=t[89];let ge;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(ge=e=>{e?T(!0):I()},t[90]=ge):ge=t[90];let _e;t[91]===d?_e=t[92]:(_e=d({id:`n3wx1q`}),t[91]=d,t[92]=_e);let ve;t[93]===_e?ve=t[94]:(ve=(0,Z.jsx)(Pp,{children:_e}),t[93]=_e,t[94]=ve);let ye;t[95]===a?ye=t[96]:(ye=(0,Z.jsx)(Y,{id:`nfPccR`,values:{laterEdits:a}}),t[95]=a,t[96]=ye);let be;t[97]===Symbol.for(`react.memo_cache_sentinel`)?(be=(0,Z.jsx)(Y,{id:`5ZbJFS`}),t[97]=be):be=t[97];let xe;t[98]===ye?xe=t[99]:(xe=(0,Z.jsxs)(Np,{children:[ye,` `,be]}),t[98]=ye,t[99]=xe);let Se;t[100]!==ve||t[101]!==xe?(Se=(0,Z.jsxs)(zp,{children:[ve,xe]}),t[100]=ve,t[101]=xe,t[102]=Se):Se=t[102];let Ce;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=(0,Z.jsx)(X,{variant:`outline`,"data-testid":`timeline-entry-restore-cancel`,onClick:I,children:(0,Z.jsx)(Y,{id:`dEgA5A`})}),t[103]=Ce):Ce=t[103];let we;t[104]===R?we=t[105]:(we=()=>R(),t[104]=R,t[105]=we);let Te;t[106]===E?Te=t[107]:(Te=E?(0,Z.jsx)(cf,{"aria-hidden":`true`,className:`mr-2 size-4`}):null,t[106]=E,t[107]=Te);let Ee;t[108]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=(0,Z.jsx)(Y,{id:`yKu_3Y`}),t[108]=Ee):Ee=t[108];let De;t[109]!==E||t[110]!==we||t[111]!==Te?(De=(0,Z.jsxs)(Lp,{children:[Ce,(0,Z.jsxs)(X,{variant:`destructive`,"data-testid":`timeline-entry-restore-confirm`,disabled:E,onClick:we,children:[Te,Ee]})]}),t[109]=E,t[110]=we,t[111]=Te,t[112]=De):De=t[112];let Oe;t[113]!==Se||t[114]!==De?(Oe=(0,Z.jsxs)(Fp,{children:[Se,De]}),t[113]=Se,t[114]=De,t[115]=Oe):Oe=t[115];let ke;t[116]!==w||t[117]!==Oe?(ke=(0,Z.jsx)(Bp,{open:w,onOpenChange:ge,children:Oe}),t[116]=w,t[117]=Oe,t[118]=ke):ke=t[118];let Ae;return t[119]!==he||t[120]!==ke?(Ae=(0,Z.jsxs)(Z.Fragment,{children:[he,ke]}),t[119]=he,t[120]=ke,t[121]=Ae):Ae=t[121],Ae}function kT(e){return e.docs}function AT(e){let t=(0,$.c)(27),{docName:n}=e,{_:r}=xn(),{resolvedTheme:i}=Hn(),a=i===`dark`,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=[],t[0]=o):o=t[0];let[s,c]=(0,Q.useState)(o),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(null),p=(0,Q.useRef)(new Map),[m,h]=(0,Q.useState)(null),g=(0,Q.useRef)(null),_=new Map;for(let e of s)_.set(e.sha.slice(0,7),e);let v,y;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(v=()=>()=>clearTimeout(g.current??void 0),y=[],t[1]=v,t[2]=y):(v=t[1],y=t[2]),(0,Q.useEffect)(v,y);let b=function(e){let t=_.get(e);t&&(p.current.get(t.sha)?.scrollIntoView({behavior:`smooth`,block:`center`}),h(t.sha),clearTimeout(g.current??void 0),g.current=setTimeout(()=>h(null),1600))},x;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(x=function(){Nh()},t[3]=x):x=t[3];let S=x,C,w;t[4]!==r||t[5]!==n?(C=()=>{if(!n){c([]);return}u(!0);let e=dT({baseMs:fT,maxBackoffMs:pT,isPaused:MT,poll:e=>mT(n,e,{setEntries:c,setError:f,setLoading:u,unavailableMessage:r({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)}},w=[n,r],t[4]=r,t[5]=n,t[6]=C,t[7]=w):(C=t[6],w=t[7]),(0,Q.useEffect)(C,w);let T;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(xh,{children:(0,Z.jsx)(gh,{children:(0,Z.jsx)(Y,{id:`cklVjM`})})}),t[8]=T):T=t[8];let E;t[9]!==r||t[10]!==l?(E=l&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-1 p-2`,role:`status`,"aria-busy":`true`,"aria-label":r({id:`o49mDZ`}),children:[1,2,3].map(jT)}),t[9]=r,t[10]=l,t[11]=E):E=t[11];let D;t[12]!==d||t[13]!==l?(D=!l&&d&&(0,Z.jsx)(`div`,{className:`px-4 py-3`,children:(0,Z.jsx)(`p`,{className:`text-xs text-destructive`,children:d})}),t[12]=d,t[13]=l,t[14]=D):D=t[14];let O;t[15]!==s||t[16]!==d||t[17]!==l?(O=!l&&!d&&s.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)(Y,{id:`Ta25TG`})})}),t[15]=s,t[16]=d,t[17]=l,t[18]=O):O=t[18];let k=!l&&!d&&s.length>0&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-1 p-2`,children:s.map((e,t)=>(0,Z.jsx)(OT,{entry:e,isDark:a,docName:n,laterEdits:t,onRestoreSuccess:S,versionBySha7:_,onJumpToVersion:b,registerRowRef:t=>{t?p.current.set(e.sha,t):p.current.delete(e.sha)},flashing:m===e.sha},e.sha))}),A;t[19]!==E||t[20]!==D||t[21]!==O||t[22]!==k?(A=(0,Z.jsxs)(`div`,{className:`flex-1 overflow-y-auto subtle-scrollbar scroll-fade-mask`,children:[E,D,O,k]}),t[19]=E,t[20]=D,t[21]=O,t[22]=k,t[23]=A):A=t[23];let j;return t[24]!==A||t[25]!==T?(j=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[T,A]}),t[24]=A,t[25]=T,t[26]=j):j=t[26],j}function jT(e){return(0,Z.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-lg px-3 py-2.5`,children:[(0,Z.jsx)(Ch,{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)(Ch,{className:`h-3 w-28`}),(0,Z.jsx)(Ch,{className:`h-3 w-40`})]})]},e)}function MT(){return typeof document<`u`&&document.visibilityState===`hidden`}var NT=`open-knowledge:lint-source-fixed`,PT=Object.freeze({source:`local`,skipStoreHooks:!1,context:Object.freeze({origin:`lint-fix`})});function FT(e,t){let n=e.split(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./telemetry-impl-T0tYRMlO.js","./chunk-CYidjpOJ.js","./preload-helper-Chd9yIcd.js","./trace-api-CUqficfR.js","./propagation-api-BofsoinJ.js","./context-api-BbWWFleV.js","./status-BO9JLhw4.js","./ReportBugDialogBody-DWbWOZyj.js","./dist-D-YCgpuS2.js","./lib-CGuuJXlL.js","./html-void-elements-Biw85x38.js","./lib-BoSom6iA.js","./markdownit-BZnioq-C.js","./w3c-keyname-DlL_314g.js","./dist-Nvb76hAm.js","./jsx-runtime-BUgB2tll.js","./react-f2sANaYj.js","./checkbox-Bi7zk4c5.js","./dist-DsLZcVyZ.js","./dist-mv8e6dBX.js","./react-dom-DPxgxlDT.js","./dist-Cm417ZCm.js","./dist-DJUH3LhV.js","./check-Bzwwm-o4.js","./createLucideIcon-CAkY8Blx.js","./minus-HJRULrSt.js","./compiler-runtime-BfE3aGVn.js","./utils-CPqDy6Hr.js","./bundle-mjs-SHeFpKGC.js","./button-CA0dewJJ.js","./circle-alert-CKGYtHdt.js","./spinner-DmibE6UV.js","./bug-report-send-manager-BSek0xNK.js","./BugReportHistory-S9E6kj8a.js","./collapsible-COrqeoHr.js","./chevron-down-xENV92Te.js","./folder-open-5aQb9yif.js","./trash-2-BVoWHmfV.js","./badge-Cl2jI51n.js","./platform-labels-DLZgi41O.js","./dist-BgXDUIPy.js","./triangle-alert-CJVfCxE0.js","./dialog-DD-GTVf9.js","./dist-tGYv04VD.js","./dist-BvwnbioL.js","./es2015-wpLRKwCl.js","./x-wQUDJS55.js","./textarea-BoMa_3jF.js","./BugReportHistoryDialog-DwoT3Jcu.js","./GraphPanel-BtrVMm8t.js","./toggle-group-BlEg4yJE.js","./dist-gTGB_-tT.js","./dist-BcWdMddd.js","./tooltip-DPvMEqsq.js","./dist-CSCWMTfQ.js","./floating-ui.dom-Dk5WJYh0.js","./useQuery-ZeEDLtxh.js","./min-Ql-sNLj-.js","./src-BJDBXEob.js","./colors-BIZ_qOvP.js","./ordinal-Bq2DRwIk.js","./init-DhAw_POV.js","./isObject-Cpi_qscz.js","./now-MQcmaMyW.js","./arrow-up-right-CXMA4cr5.js","./prop-types-BVaTR3_y.js","./navigation-targets-qlO1sI42.js","./file-tree-utils-nnyAUsjj.js","./doc-paths-DE9vBhOK.js","./known-skill-dirs-HlTud59O.js","./skill-scope-OQtLZpCt.js","./documents-events-CnBTU3j1.js","./documents-fetch-mA-Z25Lh.js","./parse-api-error-DcnXKbfT.js","./startup-marks-C5Xa1Jli.js","./target-navigation-intent-KEG2qMbq.js","./dist-PQ5KMVDh.js","./panel-DNPki55m.js","./external-link-Dzk3biRr.js","./overlay-layers-Bj-TVfKw.js","./ActivityModeContent-6TuvNchN.js","./DocumentContext-Ho6Oz_RK.js","./cm-theme-Cv1HvKYn.js","./dist-SEJoL7zW.js","./dist-B06p9eoe.js","./dist-CZp4Rvlf.js","./dist-CFiTpOJs.js","./dist-D_TqJyuw.js","./dist-BmEWZ9WX.js","./dist-Cj14vWds.js","./dist-eFrrX_Hg.js","./dist-CSBwCzP3.js","./stex-D2L90EPe.js","./config-provider-BJ0PFBhp.js","./dist-DTX2HxC82.js","./client-version-BDca_sFT.js","./use-apply-config-color-theme-D0wRK0ZW.js","./config-context-BH8hj2sg.js","./i18n-DM5acF0c.js","./messages-S_TS2Rak.js","./select-fWSYgcDA.js","./switch-BeP1gMN6.js","./CodeMirrorPropInput-o8957ZTB.js","./asset-dispatch-BxzFY-y9.js","./git-branch-BEl3Boky.js","./Mermaid-D6W1JO-s.js","./chevron-right-BVvjaUfh.js","./eye-DIJifYDY.js","./hash-26j3E552.js","./info-CqQMSCez.js","./paperclip-C-okgtwN.js","./local-menu-action-bus-aAi23OVU.js","./file-tree-rename-validation-CKWI2fGj.js","./input-DikXDeKw.js","./popover-C7NTz6uK.js","./dist-SCAXxKci.js","./skills-api-DRFuTY_1.js","./use-collab-url-CiDW3MCC.js","./DocumentContext-B0sQn39F.css","./undo-2-CXHp9Ngg.js","./agent-diff-store-DaX8UuW_.js","./cursor-2VSK5BUh.js","./copilot-DMpTxujg.js","./timeline-diff-store-ym5Oz1UF.js","./use-activity-panel-mMKkkTYa.js","./agent-presence-B4IC4MV9.js","./lru-string-cache-RKsSPPlq.js","./ImportSkillDialog-B_0sfIcE.js","./label-Bbz2bT-a.js","./radio-group-BsZGGl8l.js","./use-open-skill-B79LJXQC.js","./use-popular-skills-BA6oApoS.js","./SkillCostValue-Bs-xte7N.js","./skeleton-BZIHOzZH.js","./open-managed-artifact-tab-VyuGTCnG.js","./input-group-DroArAL7.js","./tabs-BuseO5Xi.js","./dist-pKYOq3XC2.js","./SettingsDialogBody-CPUeqHjC.js","./sortable.esm-DK-jMveF.js","./alert-dialog-ZBAB0rfs.js","./terminal-cli-display-CCSh-Jc6.js","./dropdown-menu-DRIarAms.js","./dist-Be8lWZxP2.js","./separator-BmK42_9U.js","./EnableSyncConfirmDialog-Dm2W_Er1.js","./RegisteredAgentIcon-D_jDwJpu.js","./lint-plugin-meta-C15NfeTq.js","./auth-state-cache-CageXkmw.js","./download-Bdmlj4Jo.js","./SkillInstallMenu-C2zTs1fO.js","./mascot-outline-CtS592mc.js","./folder-config-api-EXd1lZ_b.js","./refresh-cw-D41gUk_B.js","./field-C1cHfxiy.js","./use-workspace-DVCCGDFQ.js","./sun-D7hLUh5f.js","./square-pen-BlKNuUz7.js","./terminal-CmHqE3At.js","./form-L2L52iP2.js","./ConfigSharingInfoTooltip-CoNRTCRq.js","./terminal-command-events-z-N381nZ.js","./markdownlint-rule-browser-BbEsW_tn.js","./tag-pill-input-DumpKpru.js","./lint-config-client-DIrSdYtN.js","./use-terminal-enabled-CsGI4-0e.js","./terminal-telemetry-eQnofItG.js","./use-settings-route-B3k5Qle8.js","./schema-fields-view-intent-BnNbMz7K.js","./tool-list-format-ClHRkCD9.js","./ManagedArtifactProperties-CN0VAhWo.js","./ManagedArtifactProperties-D7qkm6V7.js","./PropertyDisplayRow-yHZx0-1B.js","./format-CyaLi0or.js","./braces-okUwnkYm.js","./comment-chips-CYb8vcSY.js","./selection-context-CF-A4hVF.js","./MermaidDocEditor-D9yLvQft.js","./dist-DwHSSQIa2.js","./dist-ChGC604M.js","./src-CYEDD64p.js","./ExcalidrawDocEditor-CHSxzurU.js","./chunk-K2UTITRG-ftmlUynM.js","./chunk-SRAX5OIU-B5oxcigO.js","./chunk-ZUYEQ4TG-DLAN927O.js","./chunk-6U3AYISY-BB_UpEhs.js","./chunk-Z3N5DIM6-C_zLdJk1.js","./ExcalidrawDocEditor-D_O2bRP1.css","./TextDocEditor-DDUuGlvR.js","./text-viewer-languages-DvQwv9NL.js","./SourceEditor-D9yflzSG.js","./typing-burst-detector-DP5cTWmB.js","./wrench-JX3g_hHJ.js","./SkillToolbarControls-PSAJSV0Q.js","./skill-actions-CJiMCR8W.js","./DiffView-DrIxcON3.js","./list-plus-1_iMFVqs.js","./workspace-paths-CD0W1etA.js","./SkillOriginInline-BJlf8YEB.js","./use-skill-origin-CDBZUwtC.js","./SlidesToolbarControls-C4JBBO9d.js","./SkillEditBanner-B-XDCF2M.js","./SkillModeBanner-BRFTW7Zd.js","./LintConfigEditor-BDD9SVg9.js","./EditorModeToggle-BhI-tjjV.js","./useLintConfigViewMode-BHa7i7v4.js","./SchemaConfigEditor-Bi7Ac_wP.js","./case-sensitive-B9mhUnHr.js","./TimelineDiffPane-BYuBovfq.js","./use-timeline-entry-diff-BnOxPTYG.js","./libesm-CmFxXX9W.js","./panel-right-open-BXE3r3dB.js","./AgentDiffPane-BJYlf10_.js","./AppMenubar-DyQIJHsv.js","./app-menubar-gate-Dyq1r1xM.js","./AgentThreadClientBinder-Gj3tQef3.js","./thread-client-BprEkf79.js","./SessionsHost-ig-ZUS_G.js","./history-BteF85_l.js","./terminal-launch-events-DTObZvXP.js","./thread-draft-staging-X5TsXt3q.js","./McpConsentDialogBody-BSiShHJk.js","./ok-Bg0dAnDm.js","./ShareBranchSwitchDialog-Bsa1pw1-.js","./miss-dialog-store-CdkrAlK3.js","./share-metadata-rows-DPgPU-ev.js","./auth-prompt-store-vAFATIFt.js","./desktop-bridge-types-rBjHIYSI.js","./receive-store-C6fRYFtF.js","./ShareReceiveMissDialog-CCUROvjR.js","./pending-receive-nav-store-_W8qjGOQ.js","./ConsentDialogBody-BfCsFhH5.js","./project-paths-BLMG_Bwq.js","./ShareReceiveDialog-FD8hxYdI.js","./TerminalWindowApp-fOsj00la.js","./use-live-xterm-theme-91IeCxiL.js","./use-installed-clis-t29XGX_x.js","./telemetry-startup-cht6PIz2.js"])))=>i.map(i=>d[i]);
2
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./globals-B-XcoN9E.js";import{t as n}from"./preload-helper-Chd9yIcd.js";import{t as r}from"./jsx-runtime-BUgB2tll.js";import{$ as i,$n as a,$t as o,A as s,An as c,Ar as l,B as u,Bn as d,Br as f,Bt as p,C as m,Cn as h,Cr as g,Ct as _,Dn as v,Dr as y,E as b,En as x,Er as S,Et as C,F as w,Fr as T,Ft as E,Gn as D,Gr as O,Gt as k,H as A,Hn as j,Hr as M,Ht as N,I as P,Ir as F,It as I,J as L,Jn as R,Jt as z,K as B,Kn as V,Kt as H,L as U,Ln as ee,Lr as W,Lt as te,Mn as G,Mr as K,Mt as q,N as ne,Nn as re,Nr as J,Nt as ie,O as ae,On as oe,Or as se,P as ce,Pr as le,Pt as ue,Q as de,Qn as fe,R as pe,Rn as me,Rr as he,Rt as ge,S as _e,Sn as ve,Sr as ye,St as be,T as xe,Tn as Se,Tr as Ce,Tt as we,Un as Te,Ur as Ee,Ut as De,Vn as Oe,Vr as ke,Vt as Ae,Wn as je,Wr as Me,Wt as Ne,X as Pe,Xn as Fe,Xt as Ie,Y as Le,Yn as Re,Yt as ze,Z as Be,Zt as Ve,_ as He,_n as Ue,_r as We,_t as Ge,a as Ke,an as qe,ar as Je,b as Ye,bn as Xe,br as Ze,bt as Qe,c as $e,cn as et,cr as tt,ct as nt,d as rt,dn as it,dt as at,en as ot,er as st,et as ct,f as lt,fn as ut,fr as dt,ft,g as pt,gn as mt,gr as ht,gt,h as _t,hn as vt,hr as yt,ht as bt,i as xt,in as St,ir as Ct,it as wt,j as Tt,jn as Et,jr as Dt,jt as Ot,k as kt,kr as At,l as jt,ln as Mt,lr as Nt,lt as Pt,m as Ft,mr as It,n as Lt,nr as Rt,o as zt,ot as Bt,p as Vt,pn as Ht,pr as Ut,q as Wt,qn as Gt,qt as Kt,r as qt,rn as Jt,rr as Yt,s as Xt,sr as Zt,t as Qt,tt as $t,u as en,ur as tn,ut as nn,v as rn,vn as an,wn as on,wr as sn,wt as cn,x as ln,xn as un,xr as dn,xt as fn,y as pn,yn as mn,yr as hn,yt as gn,zn as _n,zr as vn,zt as yn}from"./DocumentContext-Ho6Oz_RK.js";import{t as bn}from"./react-f2sANaYj.js";import{n as Y,r as xn,t as Sn}from"./dist-Nvb76hAm.js";import{_ as Cn,a as wn,c as Tn,d as En,f as Dn,g as On,h as kn,i as An,l as jn,m as Mn,n as Nn,o as Pn,p as Fn,r as In,s as Ln,t as Rn,u as zn,v as Bn,y as Vn}from"./useQuery-ZeEDLtxh.js";import{n as Hn,t as Un}from"./dist-PQ5KMVDh.js";import{t as Wn}from"./react-dom-DPxgxlDT.js";import{t as Gn}from"./compiler-runtime-BfE3aGVn.js";import{i as Kn,n as qn,o as Jn,r as Yn,s as Xn,t as Zn}from"./local-menu-action-bus-aAi23OVU.js";import{t as Qn}from"./utils-CPqDy6Hr.js";import{C as $n,S as er,_ as tr,b as nr,f as rr,h as ir,i as ar,n as or,r as sr,t as cr,v as lr,w as ur,x as dr,y as fr}from"./SkillInstallMenu-C2zTs1fO.js";import{t as pr}from"./overlay-layers-Bj-TVfKw.js";import{n as mr,r as hr,t as X}from"./button-CA0dewJJ.js";import{t as gr}from"./dist-mv8e6dBX.js";import{i as _r,n as vr,r as yr,t as br}from"./tooltip-DPvMEqsq.js";import{n as xr,r as Sr,t as Cr}from"./collapsible-COrqeoHr.js";import{a as wr,c as Tr,i as Er,l as Dr,o as Or,r as kr,s as Ar,t as jr}from"./alert-dialog-ZBAB0rfs.js";import{$ as Mr,F as Nr,M as Pr,P as Fr,Q as Ir,S as Lr,T as Rr,U as zr,X as Br,_ as Vr,at as Hr,ct as Ur,et as Wr,j as Gr,k as Kr,m as qr,q as Jr,rt as Yr,st as Xr,tt as Zr,x as Qr}from"./CodeMirrorPropInput-o8957ZTB.js";import{t as $r}from"./checkbox-Bi7zk4c5.js";import{a as ei,d as ti,i as ni,l as ri,n as ii,o as ai,r as oi,s as si,t as ci,u as li}from"./floating-ui.dom-Dk5WJYh0.js";import{A as ui,C as di,M as fi,N as pi,O as mi,T as hi,_ as gi,a as _i,c as vi,d as yi,f as bi,g as xi,h as Si,i as Ci,j as wi,l as Ti,m as Ei,n as Di,o as Oi,p as ki,r as Ai,s as ji}from"./terminal-cli-display-CCSh-Jc6.js";import{a as Mi,c as Ni,d as Pi,f as Fi,i as Ii,l as Li,m as Ri,n as zi,o as Bi,p as Vi,r as Hi,s as Ui,t as Wi,u as Gi}from"./dropdown-menu-DRIarAms.js";import{t as Ki}from"./label-Bbz2bT-a.js";import{c as qi,l as Ji}from"./select-fWSYgcDA.js";import{S as Yi,_ as Xi,b as Zi,f as Qi,g as $i,h as ea,m as ta,o as na,p as ra,t as ia,v as aa,y as oa}from"./progress-CW78SPzw.js";import{n as sa,t as ca}from"./radio-group-BsZGGl8l.js";import{n as la,t as ua}from"./separator-BmK42_9U.js";import{n as da,r as fa,t as pa}from"./toggle-group-BlEg4yJE.js";import{i as ma,n as ha,o as ga,r as _a}from"./terminal-telemetry-eQnofItG.js";import{$r as va,Aa as ya,B as ba,Ba as xa,Br as Sa,Bs as Ca,Bt as wa,C as Ta,Ca as Ea,Ci as Da,Co as Oa,Cs as ka,Dr as Aa,Ds as ja,E as Ma,Eo as Na,F as Pa,Fa,Fi as Ia,Fn as La,Fo as Ra,Gr as za,Hi as Ba,Ho as Va,Hr as Ha,Hs as Ua,Ia as Wa,Io as Ga,Ir as Ka,Jr as qa,Js as Ja,Ks as Ya,Lo as Xa,Ls as Za,M as Qa,Mi as $a,Mn as eo,Mt as to,Nn as no,No as ro,O as io,Oa as ao,Oo as oo,Ot as so,P as co,Pa as lo,Pi as uo,R as fo,Ra as po,Ro as mo,Sr as ho,St as go,Ti as _o,To as vo,Tr as yo,Ua as bo,Un as xo,Us as So,Vn as Co,Vo as wo,Vs as To,Wi as Eo,Wn as Do,Ws as Oo,Xs as ko,Xt as Ao,Yn as jo,Ys as Mo,Zi as No,_ as Po,_i as Fo,bi as Io,bo as Lo,br as Ro,bs as zo,ca as Bo,ci as Vo,co as Ho,cr as Uo,dt as Wo,eo as Go,fr as Ko,gn as qo,hr as Jo,ht as Yo,in as Xo,ir as Zo,it as Qo,j as $o,jo as es,jt as ts,ks as ns,la as rs,ln as is,lr as as,mi as os,n as ss,na as cs,ni as ls,nr as us,nt as ds,oa as fs,oo as ps,pi as ms,qi as hs,qs as gs,ra as _s,rr as vs,rt as ys,s as bs,so as xs,sr as Ss,t as Cs,tn as ws,to as Ts,tr as Es,ui as Ds,v as Os,vo as ks,vr as As,vs as js,w as Ms,wa as Ns,wi as Ps,xi as Fs,xo as Is,xs as Ls,yo as Rs,yr as zs,za as Bs,zi as Vs,zo as Hs}from"./dist-D-YCgpuS2.js";import{n as Us,t as Ws}from"./dist-DTX2HxC82.js";import{_ as Gs,b as Ks,c as qs,f as Js,h as Ys,i as Xs,m as Zs,n as Qs,p as $s,r as ec,s as tc,t as nc,v as rc}from"./use-settings-route-B3k5Qle8.js";import{t as ic}from"./dist-BgXDUIPy.js";import{_ as ac,a as oc,d as sc,g as cc,h as lc,o as uc,s as dc,v as fc,y as pc}from"./documents-events-CnBTU3j1.js";import{A as mc,C as hc,D as gc,E as _c,F as vc,I as yc,N as bc,P as xc,R as Sc,S as Cc,a as wc,b as Tc,c as Ec,d as Dc,f as Oc,g as kc,h as Ac,k as jc,l as Mc,m as Nc,n as Pc,o as Fc,p as Ic,r as Lc,t as Rc,u as zc,v as Bc,w as Vc,x as Hc}from"./terminal-launch-events-DTObZvXP.js";import{n as Uc,t as Wc}from"./history-BteF85_l.js";import{n as Gc,r as Kc}from"./config-context-BH8hj2sg.js";import{t as qc}from"./parse-api-error-DcnXKbfT.js";import{C as Jc,E as Yc,S as Xc,T as Zc,_ as Qc,b as $c,c as el,d as tl,f as nl,g as rl,h as il,i as al,l as ol,m as sl,n as cl,o as ll,p as ul,r as dl,s as fl,t as pl,u as ml,v as hl,w as gl,x as _l,y as vl}from"./skill-actions-CJiMCR8W.js";import{n as yl,t as bl}from"./workspace-paths-CD0W1etA.js";import{t as xl}from"./use-workspace-DVCCGDFQ.js";import{t as Sl}from"./createLucideIcon-CAkY8Blx.js";import{t as Cl}from"./git-branch-BEl3Boky.js";import{c as wl,g as Tl,l as El,m as Dl,p as Ol,u as kl}from"./EnableSyncConfirmDialog-Dm2W_Er1.js";import{c as Al,l as jl,o as Ml,s as Nl,t as Pl}from"./Mermaid-D6W1JO-s.js";import{t as Fl}from"./arrow-up-right-CXMA4cr5.js";import{r as Il,t as Ll}from"./RegisteredAgentIcon-D_jDwJpu.js";import{_ as Rl,a as zl,f as Bl,g as Vl,i as Hl,l as Ul,m as Wl,n as Gl,t as Kl,v as ql}from"./PropertyDisplayRow-yHZx0-1B.js";import{t as Jl}from"./case-sensitive-B9mhUnHr.js";import{t as Yl}from"./check-Bzwwm-o4.js";import{t as Xl}from"./chevron-left-B1wYSm9K.js";import{t as Zl}from"./chevron-down-xENV92Te.js";import{t as Ql}from"./chevron-right-BVvjaUfh.js";import{A as $l,B as eu,C as tu,D as nu,E as ru,F as iu,H as au,I as ou,N as su,P as cu,R as lu,T as uu,V as du,_ as fu,a as pu,b as mu,c as hu,f as gu,g as _u,h as vu,j as yu,k as bu,l as xu,m as Su,n as Cu,o as wu,p as Tu,r as Eu,s as Du,t as Ou,u as ku,v as Au,x as ju,z as Mu}from"./typing-burst-detector-DP5cTWmB.js";import{n as Nu,t as Pu}from"./lint-plugin-meta-C15NfeTq.js";import{t as Fu}from"./circle-alert-CKGYtHdt.js";import{a as Iu,i as Lu,n as Ru,o as zu,r as Bu,s as Vu}from"./prop-types-BVaTR3_y.js";import{$ as Hu,A as Uu,C as Wu,D as Gu,F as Ku,G as qu,H as Ju,I as Yu,J as Xu,K as Zu,L as Qu,M as $u,Q as ed,R as td,S as nd,U as rd,V as id,W as ad,X as od,Y as sd,Z as cd,a as ld,b as ud,c as dd,f as fd,h as pd,j as md,n as hd,q as gd,r as _d,t as vd,u as yd,x as bd,y as xd,z as Sd}from"./auth-state-cache-CageXkmw.js";import{t as Cd}from"./download-Bdmlj4Jo.js";import{t as wd}from"./eye-DIJifYDY.js";import{a as Td,c as Ed,i as Dd,n as Od,o as kd,r as Ad,s as jd,t as Md}from"./pending-receive-nav-store-_W8qjGOQ.js";import{_ as Nd,a as Pd,c as Fd,d as Id,f as Ld,g as Rd,h as zd,i as Bd,l as Vd,m as Hd,o as Ud,p as Wd,s as Gd,u as Kd,v as qd}from"./ManagedArtifactProperties-D7qkm6V7.js";import{t as Jd}from"./folder-open-5aQb9yif.js";import{a as Yd,i as Xd,n as Zd,o as Qd,r as $d,t as ef}from"./use-open-skill-B79LJXQC.js";import{i as tf,n as nf}from"./folder-config-api-EXd1lZ_b.js";import{t as rf}from"./hash-26j3E552.js";import{n as af,t as of}from"./target-navigation-intent-KEG2qMbq.js";import{t as sf}from"./info-CqQMSCez.js";import{t as cf}from"./spinner-DmibE6UV.js";import{a as lf,n as uf,t as df}from"./bug-report-send-manager-BSek0xNK.js";import{n as ff,t as pf}from"./miss-dialog-store-CdkrAlK3.js";import{_ as mf,a as hf,b as gf,c as _f,d as vf,f as yf,g as bf,i as xf,l as Sf,m as Cf,n as wf,o as Tf,p as Ef,r as Df,s as Of,t as kf,u as Af,v as jf,y as Mf}from"./comment-chips-CYb8vcSY.js";import{i as Nf,n as Pf,r as Ff,t as If}from"./use-popular-skills-BA6oApoS.js";import{n as Lf,t as Rf}from"./panel-right-open-BXE3r3dB.js";import{t as zf}from"./paperclip-C-okgtwN.js";import{t as Bf}from"./refresh-cw-D41gUk_B.js";import{t as Vf}from"./square-pen-BlKNuUz7.js";import{t as Hf}from"./trash-2-BVoWHmfV.js";import{t as Uf}from"./triangle-alert-CJVfCxE0.js";import{t as Wf}from"./undo-2-CXHp9Ngg.js";import{t as Gf}from"./x-wQUDJS55.js";import{C as Kf,S as qf,T as Jf,_ as Yf,a as Xf,b as Zf,c as Qf,d as $f,f as ep,g as tp,h as np,i as rp,m as ip,p as ap,s as op,u as sp,v as cp,w as lp,x as up,y as dp}from"./doc-paths-DE9vBhOK.js";import{a as fp,c as pp,d as mp,f as hp,i as gp,l as _p,o as vp,s as yp,t as bp,u as xp}from"./skill-scope-OQtLZpCt.js";import{a as Sp,n as Cp,o as wp,r as Tp,s as Ep,t as Dp}from"./field-C1cHfxiy.js";import{t as Op}from"./input-DikXDeKw.js";import{a as kp,i as Ap,n as jp,r as Mp}from"./project-paths-BLMG_Bwq.js";import{a as Np,c as Pp,i as Fp,n as Ip,o as Lp,r as Rp,s as zp,t as Bp}from"./dialog-DD-GTVf9.js";import{t as Vp}from"./tool-list-format-ClHRkCD9.js";import"./i18n-DM5acF0c.js";import{n as Hp,r as Up,t as Wp}from"./file-tree-rename-validation-CKWI2fGj.js";import{a as Gp,c as Kp,d as qp,i as Jp,l as Yp,n as Xp,o as Zp,s as Qp,u as $p}from"./file-tree-utils-nnyAUsjj.js";import{E as em,J as tm,K as nm,M as rm,_ as im,a as am,c as om,f as sm,g as cm,h as lm,j as um,l as dm,n as fm,o as pm,p as mm,q as hm,r as gm,s as _m,v as vm,x as ym}from"./navigation-targets-qlO1sI42.js";import{t as bm}from"./documents-fetch-mA-Z25Lh.js";import{a as xm,i as Sm,o as Cm}from"./startup-marks-C5Xa1Jli.js";import{t as wm}from"./badge-Cl2jI51n.js";import{i as Tm,n as Em,r as Dm,t as Om}from"./popover-C7NTz6uK.js";import{F as km,O as Am,d as jm,f as Mm,g as Nm,h as Pm,i as Fm,j as Im,l as Lm,o as Rm,u as zm,v as Bm,x as Vm}from"./skills-api-DRFuTY_1.js";import{c as Hm,f as Um,i as Wm,n as Gm,o as Km,r as qm,t as Jm}from"./config-provider-BJ0PFBhp.js";import{i as Ym,r as Xm,t as Zm}from"./use-collab-url-CiDW3MCC.js";import{n as Qm,t as $m}from"./client-version-BDca_sFT.js";import{n as eh,t as th}from"./external-link-Dzk3biRr.js";import{t as nh}from"./asset-dispatch-BxzFY-y9.js";import{i as rh,n as ih,r as ah,t as oh}from"./auth-prompt-store-vAFATIFt.js";import{c as sh,i as ch,l as lh,n as uh,r as dh,s as fh,t as ph}from"./selection-context-CF-A4hVF.js";import{t as mh}from"./use-installed-clis-t29XGX_x.js";import{a as hh,c as gh,i as _h,n as vh,o as yh,r as bh,s as xh,t as Sh}from"./panel-DNPki55m.js";import{t as Ch}from"./skeleton-BZIHOzZH.js";import{c as wh,i as Th,l as Eh,r as Dh}from"./lint-config-client-DIrSdYtN.js";import{a as Oh,o as kh,t as Ah}from"./agent-diff-store-DaX8UuW_.js";import{n as jh,r as Mh,t as Nh}from"./timeline-diff-store-ym5Oz1UF.js";import{a as Ph,c as Fh,i as Ih,n as Lh,o as Rh,r as zh,s as Bh,t as Vh}from"./EditorModeToggle-BhI-tjjV.js";import{a as Hh,c as Uh,d as Wh,g as Gh,h as Kh,i as qh,m as Jh,n as Yh,p as Xh,r as Zh,s as Qh,t as $h,u as eg}from"./sortable.esm-DK-jMveF.js";import{t as tg}from"./textarea-BoMa_3jF.js";import{t as ng}from"./open-managed-artifact-tab-VyuGTCnG.js";import{t as rg}from"./SkillCostValue-Bs-xte7N.js";import{t as ig}from"./SkillModeBanner-BRFTW7Zd.js";import{t as ag}from"./use-skill-origin-CDBZUwtC.js";import{n as og,r as sg,t as cg}from"./input-group-DroArAL7.js";import{n as lg,t as ug}from"./DiffView-DrIxcON3.js";import{A as dg,C as fg,D as pg,E as mg,O as hg,S as gg,T as _g,_ as vg,a as yg,b as bg,c as xg,d as Sg,f as Cg,g as wg,h as Tg,i as Eg,j as Dg,k as Og,l as kg,m as Ag,n as jg,o as Mg,p as Ng,r as Pg,s as Fg,t as Ig,u as Lg,v as Rg,w as zg,x as Bg,y as Vg}from"./file-tree-adapter-B0KaetQt.js";import{n as Hg,r as Ug}from"./platform-labels-DLZgi41O.js";import{t as Wg}from"./use-live-xterm-theme-91IeCxiL.js";import{t as Gg}from"./app-menubar-gate-Dyq1r1xM.js";import{n as Kg,r as qg}from"./agent-presence-B4IC4MV9.js";import{a as Jg,c as Yg,d as Xg,f as Zg,i as Qg,l as $g,m as e_,n as t_,o as n_,s as r_,t as i_,u as a_}from"./form-L2L52iP2.js";import{n as o_}from"./terminal-command-events-z-N381nZ.js";import{n as s_,r as c_,t as l_}from"./ok-Bg0dAnDm.js";import{a as u_,t as d_}from"./receive-store-C6fRYFtF.js";function f_(){({BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_APP_VERSION:`0.58.9`})?.VITE_OTEL_ENABLED===`true`&&n(()=>import(`./telemetry-impl-T0tYRMlO.js`).then(e=>e.install()),__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url)}var p_=class extends wn{#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||m_(),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=Pn({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),Tn.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function m_(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var h_=class extends Vn{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 p_({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=g_(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=g_(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=g_(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=g_(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){Tn.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=>Dn(t,e))}findAll(e={}){return this.getAll().filter(t=>Dn(e,t))}notify(e){Tn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return Tn.batch(()=>Promise.all(e.map(e=>e.continue().catch(Mn))))}};function g_(e){return e.options.scope?.id}var __=class extends Vn{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??En(r,t),a=this.get(i);return a||(a=new An({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(){Tn.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=>Fn(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Fn(e,t)):t}notify(e){Tn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Tn.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Tn.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},v_=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new __,this.#t=e.mutationCache||new h_,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=Bn.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Ln.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(On(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=jn(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return Tn.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;Tn.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return Tn.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=Tn.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(Mn).catch(Mn)}invalidateQueries(e,t={}){return Tn.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=Tn.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(Mn)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(Mn)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(On(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Mn).catch(Mn)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Mn).catch(Mn)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return Ln.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(zn(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{kn(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(zn(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{kn(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||=En(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===Cn&&(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()}},Z=r(),Q=e(bn(),1),y_=t(),$=Gn(),b_=`button, a[href], input, textarea, select, [contenteditable="true"], [role="button"], [role="menuitem"]`;function x_(){if(typeof document>`u`)return!1;let e=document.activeElement;return!e||e===document.body?!1:e instanceof Element&&e.matches(b_)}function S_(e={}){return pr()?!1:e.allowWhileFocused?!0:!x_()}var C_=e(Wn(),1),w_=`ok-blob-mascot`;function T_(e){if(typeof document>`u`){e();return}let t=document.startViewTransition,n=typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;if(typeof t!=`function`||n){e();return}t.call(document,()=>{(0,C_.flushSync)(e)})}var E_=64*.055,D_=.1875,O_=2400,k_=310;k_**2/(2*O_);var A_=580**2/(2*O_),j_=2*580/O_,M_=.09,N_=j_+.1,P_=.5,F_=1.3,I_=3200,L_=14,R_=j_*2.4,z_=j_*1.35,B_=.9,V_=.3,H_=14e3;function U_(e,t,n){return e+(t-e)*n}function W_(e){return Math.min(1,Math.max(0,e/H_))}function G_(e){return U_(R_,z_,W_(e))}function K_(e){return e<=iv?0:U_(nv,rv,W_(e))}var q_=38,J_=52,Y_=12,X_=20,Z_=34,Q_=14,$_=18,ev=22,tv=30,nv=.15,rv=.45,iv=900,av=240,ov=.05,sv=1/120,cv=12;function lv(){return{phase:`idle`,y:0,vy:0,dwell:0,jumpBuffer:0,jumping:!1,ducking:!1,speed:260,distance:0,obstacles:[],spawnCountdown:260*G_(0),nextObstacleId:0}}function uv(e){Object.assign(e,lv(),{phase:`running`})}function dv(e){return e.phase===`running`?e.jumping?(e.jumpBuffer=N_,!1):(e.vy=580,e.dwell=0,e.jumpBuffer=0,e.jumping=!0,!0):!1}function fv(e,t){e.phase===`running`&&(e.ducking=t)}function pv(e){return e.ducking&&e.y===0}function mv(e){return Math.floor(e.distance/cv)}function hv(e){if(pv(e))return{scaleX:F_,scaleY:P_};if(e.y===0&&e.dwell>0){let t=.28*(1-(1-e.dwell/M_));return{scaleX:1+t*.8,scaleY:1-t}}let t=.22*Math.min(Math.abs(e.vy)/580,1);return{scaleX:1-t*.7,scaleY:1+t}}function gv(e){let t=pv(e),n=64*(t?F_:1),r=64*(t?P_:1),i=n*D_,a=r*D_,o=28-(n-64)/2;return{left:o+i,right:o+n-i,bottom:e.y+a,top:e.y+r-a}}function _v(e,t){let n=gv(e);return n.left<t.x+t.width&&n.right>t.x&&n.bottom<t.y+t.height&&n.top>t.y}function vv(e,t,n){let r=n()<K_(e.distance),[i,a,o,s,c]=r?[ev,tv,Q_,$_,Z_]:[Y_,X_,q_,J_,0];e.obstacles.push({id:e.nextObstacleId,kind:r?`overhead`:`ground`,x:t,y:c,width:i+n()*(a-i),height:o+n()*(s-o)}),e.nextObstacleId+=1;let l=U_(B_,V_,W_(e.distance));e.spawnCountdown=e.speed*(G_(e.distance)+n()*l)}function yv(e,t,n,r){if(e.jumpBuffer=Math.max(0,e.jumpBuffer-t),e.y>0||e.vy>0){let n=e.ducking?O_+I_:O_;e.vy-=n*t,e.y+=e.vy*t,e.y<=0&&(e.y=0,e.vy=0,e.jumping=!1,e.jumpBuffer>0?(e.vy=580,e.jumpBuffer=0,e.jumping=!0):e.dwell=M_)}else e.ducking?e.dwell=0:(e.dwell-=t,e.dwell<=0&&(e.dwell=0,e.vy=k_));e.speed=Math.min(620,e.speed+L_*t);let i=e.speed*t;e.distance+=i;for(let t of e.obstacles)t.x-=i;e.obstacles=e.obstacles.filter(e=>e.x+e.width>0),e.spawnCountdown-=i,e.spawnCountdown<=0&&vv(e,n,r);for(let t of e.obstacles)if(_v(e,t)){e.phase=`over`;return}}function bv(e,t,n,r=Math.random){if(e.phase!==`running`)return e;let i=Math.max(n,av),a=Math.min(Math.max(t,0),ov);for(;a>0;){let t=Math.min(a,sv);if(a-=t,yv(e,t,i,r),e.phase!==`running`)break}return e}var xv=`ok-blob-runner-best`;function Sv(){try{return typeof localStorage>`u`?null:localStorage}catch{return null}}function Cv(e=Sv()){if(!e)return 0;try{let t=Number(e.getItem(xv));return Number.isFinite(t)&&t>0?Math.floor(t):0}catch{return 0}}function wv(e,t=Sv()){if(!(!t||!Number.isFinite(e)||e<=0))try{t.setItem(xv,String(Math.floor(e)))}catch{}}function Tv(e,t,n){let r=n?.windowMs??4e3;return e<=0||t>=r?1:e+1}var Ev=Math.ceil(A_+64+8),Dv=Array.from({length:24},(e,t)=>`obstacle-slot-${t}`),Ov=300,kv=4,Av=.45;function jv(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(O,{className:`h-4 min-w-4 px-1.5 align-middle text-[10px]`,children:n}),t[0]=n,t[1]=r),r}function Mv(e){let t=(0,$.c)(48),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{autoStart:r}=n,i=r===void 0?!1:r,a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=lv(),t[2]=a):a=t[2];let o=(0,Q.useRef)(a),s=(0,Q.useRef)(null),c=(0,Q.useRef)(null),l=(0,Q.useRef)(null),u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=[],t[3]=u):u=t[3];let d=(0,Q.useRef)(u),[f,p]=(0,Q.useState)(`idle`),[m,h]=(0,Q.useState)(0),[g,_]=(0,Q.useState)(Fv),v=(0,Q.useRef)(g),[y,b]=(0,Q.useState)(0),[x,S]=(0,Q.useState)(!1),[C]=(0,Q.useState)(Pv),w,T;t[4]!==i||t[5]!==C?(w=()=>{if(!i||C)return;let e=setTimeout(()=>{uv(o.current),p(`running`)},Ov);return()=>clearTimeout(e)},T=[i,C],t[4]=i,t[5]=C,t[6]=w,t[7]=T):(w=t[6],T=t[7]),(0,Q.useEffect)(w,T);let E,D;t[8]===f?(E=t[9],D=t[10]):(E=()=>{if(f!==`running`)return;let e=0,t=performance.now(),n=function(){let e=o.current;if(c.current){let{scaleX:t,scaleY:n}=hv(e);c.current.style.transform=`translateY(${E_-e.y}px) scale(${t.toFixed(4)}, ${n.toFixed(4)})`}for(let t=0;t<24;t++){let n=d.current[t];if(!n)continue;let r=e.obstacles[t];if(!r){n.style.opacity=`0`;continue}n.style.opacity=`1`,n.style.width=`${r.width}px`,n.style.height=`${r.height}px`,n.style.bottom=`${r.y}px`,n.style.borderRadius=r.kind===`overhead`?`9999px`:`3px`,n.style.transform=`translateX(${r.x}px)`}l.current&&(l.current.textContent=String(mv(e)).padStart(kv,`0`))};function r(i){let a=o.current;if(bv(a,(i-t)/1e3,s.current?.clientWidth??0),t=i,n(),a.phase===`over`){let e=mv(a),t=e>v.current;h(e),t&&(v.current=e,wv(e),_(e),S(!0),b(Nv)),p(`over`);return}e=requestAnimationFrame(r)}return e=requestAnimationFrame(r),()=>cancelAnimationFrame(e)},D=[f],t[8]=f,t[9]=E,t[10]=D),(0,Q.useEffect)(E,D);let O,k;t[11]===C?(O=t[12],k=t[13]):(k=()=>{if(C)return;let e=function(){uv(o.current),S(!1),p(`running`)},t=function(t){let n=o.current;if(t.key===`ArrowDown`){if(!S_({allowWhileFocused:!0}))return;t.preventDefault(),fv(n,!0);return}t.key!==` `&&t.key!==`ArrowUp`||S_({allowWhileFocused:t.key===`ArrowUp`})&&(t.preventDefault(),n.phase===`running`?dv(n):e())},n=function(e){e.key===`ArrowDown`&&fv(o.current,!1)};return window.addEventListener(`keydown`,t),window.addEventListener(`keyup`,n),()=>{window.removeEventListener(`keydown`,t),window.removeEventListener(`keyup`,n)}},O=[C],t[11]=C,t[12]=O,t[13]=k),(0,Q.useEffect)(k,O);let A;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(e){x_()&&document.activeElement.blur();let t=o.current;if(t.phase!==`running`){uv(t),S(!1),p(`running`);return}let n=e.currentTarget.getBoundingClientRect();if(e.clientY-n.top>n.height*(1-Av)){fv(t,!0),e.currentTarget.setPointerCapture?.(e.pointerId);return}dv(t)},t[14]=A):A=t[14];let j=A,M;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(M=function(){fv(o.current,!1)},t[15]=M):M=t[15];let N=M;if(C){let e;return t[16]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(ur,{size:64,variant:`sleeping`}),t[16]=e):e=t[16],e}let P=f!==`running`&&!x,F;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(F={height:Ev},t[17]=F):F=t[17];let I;t[18]===i?I=t[19]:(I={left:28,transform:`translateY(${E_}px)`,...i?{viewTransitionName:w_}:{}},t[18]=i,t[19]=I);let L=P?`sleeping`:`default`,R;t[20]!==y||t[21]!==L?(R=(0,Z.jsx)(ur,{size:64,trackMouse:!1,variant:L,celebrateSignal:y}),t[20]=y,t[21]=L,t[22]=R):R=t[22];let z;t[23]!==I||t[24]!==R?(z=(0,Z.jsx)(`div`,{ref:c,className:`absolute bottom-0 flex origin-bottom will-change-transform`,style:I,children:R}),t[23]=I,t[24]=R,t[25]=z):z=t[25];let B;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(B=Dv.map((e,t)=>(0,Z.jsx)(`div`,{"data-slot":`ok-blob-runner-obstacle`,ref:e=>{d.current[t]=e},className:`absolute bottom-0 left-0 rounded-sm bg-muted-foreground/70 will-change-transform`,style:{opacity:0}},e)),t[26]=B):B=t[26];let V;t[27]!==z||t[28]!==B?(V=(0,Z.jsxs)(`div`,{ref:s,"data-slot":`ok-blob-runner-track`,className:`relative w-full cursor-pointer overflow-hidden border-b border-dashed border-border`,style:F,onPointerDown:j,onPointerUp:N,onPointerCancel:N,onPointerLeave:N,children:[z,B]}),t[27]=z,t[28]=B,t[29]=V):V=t[29];let H;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(H={left:28},t[30]=H):H=t[30];let U;t[31]!==x||t[32]!==g?(U=g>0?(0,Z.jsxs)(`span`,{className:x?`text-muted-foreground`:void 0,children:[(0,Z.jsx)(Y,{id:`9GbR5F`}),` `,String(g).padStart(kv,`0`)]}):null,t[31]=x,t[32]=g,t[33]=U):U=t[33];let ee=String(m),W;t[34]===ee?W=t[35]:(W=ee.padStart(kv,`0`),t[34]=ee,t[35]=W);let te;t[36]===W?te=t[37]:(te=(0,Z.jsx)(`span`,{ref:l,children:W}),t[36]=W,t[37]=te);let G;t[38]!==U||t[39]!==te?(G=(0,Z.jsx)(`div`,{className:`relative mt-1.5 h-5`,children:(0,Z.jsxs)(`div`,{"data-slot":`ok-blob-runner-score`,className:`absolute top-0 flex gap-3 font-mono text-xs tabular-nums text-muted-foreground/60`,style:H,children:[U,te]})}),t[38]=U,t[39]=te,t[40]=G):G=t[40];let K;t[41]!==x||t[42]!==f?(K=(0,Z.jsx)(`p`,{"data-slot":`ok-blob-runner-hint`,className:`mt-2 text-center font-mono text-[11px] uppercase tracking-wide text-muted-foreground/60`,children:f===`over`?x?(0,Z.jsx)(Y,{id:`ai40UJ`,components:{0:(0,Z.jsx)(jv,{})}}):(0,Z.jsx)(Y,{id:`uY5Z7P`,components:{0:(0,Z.jsx)(jv,{})}}):f===`running`?(0,Z.jsx)(Y,{id:`pI_bKs`,components:{0:(0,Z.jsx)(jv,{}),1:(0,Z.jsx)(jv,{})}}):(0,Z.jsx)(Y,{id:`7a0YcF`,components:{0:(0,Z.jsx)(jv,{})}})}),t[41]=x,t[42]=f,t[43]=K):K=t[43];let q;return t[44]!==V||t[45]!==G||t[46]!==K?(q=(0,Z.jsxs)(`div`,{"aria-hidden":`true`,"data-slot":`ok-blob-runner`,className:`w-full select-none animate-in fade-in-0 slide-in-from-bottom-2 duration-300 motion-reduce:animate-none`,children:[V,G,K]}),t[44]=V,t[45]=G,t[46]=K,t[47]=q):q=t[47],q}function Nv(e){return e+1}function Pv(){return typeof window<`u`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function Fv(){return Cv()}var Iv=80;function Lv(e){let t=(0,$.c)(9),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{keyboard:r}=n,i=r===void 0?!0:r,[a,o]=(0,Q.useState)(!1),s=(0,Q.useRef)(!1),[c]=(0,Q.useState)(Rv),l,u;if(t[2]!==i||t[3]!==c?(l=()=>{if(c||!i)return;let e=function(e){s.current||e.key!==` `&&e.key!==`ArrowUp`||S_({allowWhileFocused:e.key===`ArrowUp`})&&(e.preventDefault(),s.current=!0,T_(()=>o(!0)))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},u=[c,i],t[2]=i,t[3]=c,t[4]=l,t[5]=u):(l=t[4],u=t[5]),(0,Q.useEffect)(l,u),a){let e;return t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Mv,{autoStart:!0}),t[6]=e):e=t[6],e}if(c){let e;return t[7]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(ur,{size:Iv,variant:`sleeping`}),t[7]=e):e=t[7],e}let d;return t[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(`div`,{"aria-hidden":`true`,"data-slot":`ok-blob-runner-easter-egg`,className:`cursor-pointer select-none transition-opacity duration-200`,style:{viewTransitionName:w_},onPointerDown:()=>{x_()&&document.activeElement.blur(),s.current=!0,T_(()=>o(!0))},children:(0,Z.jsx)(ur,{size:Iv,variant:`sleeping`})}),t[8]=d):d=t[8],d}function Rv(){return typeof window<`u`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}var zv=(0,Q.lazy)(()=>n(()=>import(`./ReportBugDialogBody-DWbWOZyj.js`),__vite__mapDeps([7,1,8,2,3,6,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,4,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47]),import.meta.url)),Bv=1200,Vv=`[cmdk-root],[data-radix-popper-content-wrapper]`,Hv=500;function Uv(e){let t=(0,$.c)(9),[n,r]=(0,Q.useState)(e.open),[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(!1),u=(0,Q.useRef)(0);e.open&&!n&&r(!0);let d,f;if(t[0]!==e.crashInvite||t[1]!==e.open?(d=()=>{if(!e.open){a(!1);return}let t=u.current+=1;l(!1);let n=window.okDesktop?.bugReport?.crashDumpAvailability;e.crashInvite===void 0&&typeof n==`function`&&n().then(e=>{u.current===t&&l(e.available)}).catch(Wv);let r=window.okDesktop?.bugReport?.captureScreenshot;if(typeof r!=`function`||e.crashInvite!==void 0){s(null),a(!0);return}s(null);let i=!1,o=e=>{i||u.current!==t||(i=!0,s(e),a(!0))},c=setTimeout(()=>o(null),Bv),d=performance.now(),f=0,p=()=>{if(u.current!==t)return;let e=performance.now()-d>=Hv;if(document.querySelector(Vv)!==null&&!e){f=requestAnimationFrame(p);return}f=requestAnimationFrame(()=>{u.current===t&&r().then(o).catch(()=>o(null))})};return f=requestAnimationFrame(p),()=>{u.current+=1,clearTimeout(c),cancelAnimationFrame(f)}},f=[e.open,e.crashInvite],t[0]=e.crashInvite,t[1]=e.open,t[2]=d,t[3]=f):(d=t[2],f=t[3]),(0,Q.useEffect)(d,f),!n)return null;let p=e.open&&i,m;return t[4]!==c||t[5]!==e||t[6]!==o||t[7]!==p?(m=(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(zv,{...e,open:p,screenshot:o,crashDumpAvailable:c})}),t[4]=c,t[5]=e,t[6]=o,t[7]=p,t[8]=m):m=t[8],m}function Wv(e){console.warn(`[bug-report] crash-dump availability probe failed:`,e)}var Gv=new WeakMap;function Kv(e,t){typeof e!=`object`||!e||typeof t!=`string`||t.trim()===``||Gv.set(e,t)}function qv(e){if(!(typeof e!=`object`||!e))return Gv.get(e)}function Jv(e){let t=(0,$.c)(24),{error:n,resetErrorBoundary:r}=e,{_:i}=xn(),[a,o]=(0,Q.useState)(!1),s=(0,Q.useRef)(null),c=typeof window<`u`?window.okDesktop:void 0,l;t[0]!==i||t[1]!==n?(l=n instanceof Error&&n.message?n.message:i({id:`W5A0Ly`}),t[0]=i,t[1]=n,t[2]=l):l=t[2];let u=l,d,f;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>{s.current?.focus()},f=[],t[3]=d,t[4]=f):(d=t[3],f=t[4]),(0,Q.useEffect)(d,f);let p;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(Lv,{keyboard:!1}),t[5]=p):p=t[5];let m;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(`h1`,{id:`app-error-title`,className:`text-2xl font-light tracking-tighter text-balance`,children:(0,Z.jsx)(Y,{id:`nwtY4N`})}),t[6]=m):m=t[6];let h;t[7]===u?h=t[8]:(h=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[m,(0,Z.jsx)(`p`,{className:`max-w-sm text-sm break-words text-muted-foreground`,children:u})]}),t[7]=u,t[8]=h);let g;t[9]===r?g=t[10]:(g=()=>r(),t[9]=r,t[10]=g);let _;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(Y,{id:`KDw4GX`}),t[11]=_):_=t[11];let v;t[12]===g?v=t[13]:(v=(0,Z.jsx)(X,{ref:s,variant:`default`,onClick:g,children:_}),t[12]=g,t[13]=v);let y;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(y=c?(0,Z.jsx)(X,{variant:`ghost`,className:`font-mono uppercase`,onClick:()=>o(!0),children:(0,Z.jsx)(Y,{id:`ii5mVn`})}):null,t[14]=y):y=t[14];let b;t[15]===v?b=t[16]:(b=(0,Z.jsxs)(`div`,{className:`mt-1 flex gap-2`,children:[v,y]}),t[15]=v,t[16]=b);let x;t[17]!==n||t[18]!==a?(x=c?(0,Z.jsx)(Zv,{children:(0,Z.jsx)(Uv,{open:a,onOpenChange:o,systemWide:c.config.mode===`navigator`,crashContext:{source:`app shell`,errorMessage:n instanceof Error&&n.message?n.message:String(n),componentStack:qv(n)}})}):null,t[17]=n,t[18]=a,t[19]=x):x=t[19];let S;return t[20]!==b||t[21]!==x||t[22]!==h?(S=(0,Z.jsxs)(`div`,{role:`alert`,"aria-labelledby":`app-error-title`,"data-slot":`app-error-boundary`,className:`flex h-screen flex-col items-center justify-center gap-8 p-8 text-center`,children:[p,h,b,x]}),t[20]=b,t[21]=x,t[22]=h,t[23]=S):S=t[23],S}function Yv(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(Xn,{FallbackComponent:Jv,onError:Xv,children:n}),t[0]=n,t[1]=r),r}function Xv(e,t){Kv(e,t.componentStack),Me(e),console.error(`[AppErrorBoundary] app-shell render crash`,e,t.componentStack??``)}function Zv(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(Xn,{fallback:null,onError:Qv,children:n}),t[0]=n,t[1]=r),r}function Qv(e){console.error(`[CrashReportingBoundary] crash-reporting UI render crash`,e)}function $v(){let e=(0,$.c)(5),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={queryKey:[`acp-catalog`],queryFn:ny,staleTime:3e5},e[0]=t):t=e[0];let n=Rn(t),r;e[1]===n.data?.agents?r=e[2]:(r=()=>(wi(_a(n.data?.agents??[]).map(ty)),ey),e[1]=n.data?.agents,e[2]=r);let i;return e[3]===n.data?i=e[4]:(i=[n.data],e[3]=n.data,e[4]=i),(0,Q.useEffect)(r,i),null}function ey(){return wi([])}function ty(e){return{source:e.source,id:e.id,name:e.name,featured:e.featured,...e.iconUrl===void 0?{}:{iconUrl:e.iconUrl}}}function ny(e){let{signal:t}=e;return ma(t)}var ry=Sl(`arrow-up-down`,[[`path`,{d:`m21 16-4 4-4-4`,key:`f6ql7i`}],[`path`,{d:`M17 20V4`,key:`1ejh1v`}],[`path`,{d:`m3 8 4-4 4 4`,key:`11wl7u`}],[`path`,{d:`M7 4v16`,key:`1glfcx`}]]),iy=Sl(`bird`,[[`path`,{d:`M16 7h.01`,key:`1kdx03`}],[`path`,{d:`M3.4 18H12a8 8 0 0 0 8-8V7a4 4 0 0 0-7.28-2.3L2 20`,key:`oj1oa8`}],[`path`,{d:`m20 7 2 .5-2 .5`,key:`12nv4d`}],[`path`,{d:`M10 18v3`,key:`1yea0a`}],[`path`,{d:`M14 17.75V21`,key:`1pymcb`}],[`path`,{d:`M7 18a6 6 0 0 0 3.84-10.61`,key:`1npnn0`}]]),ay=Sl(`blocks`,[[`path`,{d:`M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2`,key:`1ah6g2`}],[`rect`,{x:`14`,y:`2`,width:`8`,height:`8`,rx:`1`,key:`88lufb`}]]),oy=Sl(`bold`,[[`path`,{d:`M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8`,key:`mg9rjx`}]]),sy=Sl(`book-marked`,[[`path`,{d:`M10 2v8l3-3 3 3V2`,key:`sqw3rj`}],[`path`,{d:`M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20`,key:`k3hazp`}]]),cy=Sl(`cat`,[[`path`,{d:`M12 5c.67 0 1.35.09 2 .26 1.78-2 5.03-2.84 6.42-2.26 1.4.58-.42 7-.42 7 .57 1.07 1 2.24 1 3.44C21 17.9 16.97 21 12 21s-9-3-9-7.56c0-1.25.5-2.4 1-3.44 0 0-1.89-6.42-.5-7 1.39-.58 4.72.23 6.5 2.23A9.04 9.04 0 0 1 12 5Z`,key:`x6xyqk`}],[`path`,{d:`M8 14v.5`,key:`1nzgdb`}],[`path`,{d:`M16 14v.5`,key:`1lajdz`}],[`path`,{d:`M11.25 16.25h1.5L12 17l-.75-.75Z`,key:`12kq1m`}]]),ly=Sl(`check-check`,[[`path`,{d:`M18 6 7 17l-5-5`,key:`116fxf`}],[`path`,{d:`m22 10-7.5 7.5L13 16`,key:`ke71qq`}]]),uy=Sl(`circle-dot`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]),dy=Sl(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),fy=Sl(`columns-3`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),py=Sl(`compass`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z`,key:`9ktpf1`}]]),my=Sl(`copy-x`,[[`line`,{x1:`12`,x2:`18`,y1:`12`,y2:`18`,key:`1rg63v`}],[`line`,{x1:`12`,x2:`18`,y1:`18`,y2:`12`,key:`ebkxgr`}],[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),hy=Sl(`corner-down-left`,[[`path`,{d:`M20 4v7a4 4 0 0 1-4 4H4`,key:`6o5b7l`}],[`path`,{d:`m9 10-5 5 5 5`,key:`1kshq7`}]]),gy=Sl(`dog`,[[`path`,{d:`M11.25 16.25h1.5L12 17z`,key:`w7jh35`}],[`path`,{d:`M16 14v.5`,key:`1lajdz`}],[`path`,{d:`M4.42 11.247A13.152 13.152 0 0 0 4 14.556C4 18.728 7.582 21 12 21s8-2.272 8-6.444a11.702 11.702 0 0 0-.493-3.309`,key:`u7s9ue`}],[`path`,{d:`M8 14v.5`,key:`1nzgdb`}],[`path`,{d:`M8.5 8.5c-.384 1.05-1.083 2.028-2.344 2.5-1.931.722-3.576-.297-3.656-1-.113-.994 1.177-6.53 4-7 1.923-.321 3.651.845 3.651 2.235A7.497 7.497 0 0 1 14 5.277c0-1.39 1.844-2.598 3.767-2.277 2.823.47 4.113 6.006 4 7-.08.703-1.725 1.722-3.656 1-1.261-.472-1.855-1.45-2.239-2.5`,key:`v8hric`}]]),_y=Sl(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),vy=Sl(`file-check`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m9 15 2 2 4-4`,key:`1grp1n`}]]),yy=Sl(`file-code-corner`,[[`path`,{d:`M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35`,key:`1wthlu`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m5 16-3 3 3 3`,key:`331omg`}],[`path`,{d:`m9 22 3-3-3-3`,key:`lsp7cz`}]]),by=Sl(`file-exclamation-point`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),xy=Sl(`file-key`,[[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M4 12v6`,key:`bg1pfk`}],[`path`,{d:`M4 14h2`,key:`1sf9f8`}],[`path`,{d:`M9.65 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v4`,key:`d56i0q`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),Sy=Sl(`fish`,[[`path`,{d:`M6.5 12c.94-3.46 4.94-6 8.5-6 3.56 0 6.06 2.54 7 6-.94 3.47-3.44 6-7 6s-7.56-2.53-8.5-6Z`,key:`15baut`}],[`path`,{d:`M18 12v.5`,key:`18hhni`}],[`path`,{d:`M16 17.93a9.77 9.77 0 0 1 0-11.86`,key:`16dt7o`}],[`path`,{d:`M7 10.67C7 8 5.58 5.97 2.73 5.5c-1 1.5-1 5 .23 6.5-1.24 1.5-1.24 5-.23 6.5C5.58 18.03 7 16 7 13.33`,key:`l9di03`}],[`path`,{d:`M10.46 7.26C10.2 5.88 9.17 4.24 8 3h5.8a2 2 0 0 1 1.98 1.67l.23 1.4`,key:`1kjonw`}],[`path`,{d:`m16.01 17.93-.23 1.4A2 2 0 0 1 13.8 21H9.5a5.96 5.96 0 0 0 1.49-3.98`,key:`1zlm23`}]]),Cy=Sl(`fold-vertical`,[[`path`,{d:`M12 22v-6`,key:`6o8u61`}],[`path`,{d:`M12 8V2`,key:`1wkif3`}],[`path`,{d:`M4 12H2`,key:`rhcxmi`}],[`path`,{d:`M10 12H8`,key:`s88cx1`}],[`path`,{d:`M16 12h-2`,key:`10asgb`}],[`path`,{d:`M22 12h-2`,key:`14jgyd`}],[`path`,{d:`m15 19-3-3-3 3`,key:`e37ymu`}],[`path`,{d:`m15 5-3 3-3-3`,key:`19d6lf`}]]),wy=Sl(`folder-cog`,[[`path`,{d:`M10.3 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.98a2 2 0 0 1 1.69.9l.66 1.2A2 2 0 0 0 12 6h8a2 2 0 0 1 2 2v3.3`,key:`128dxu`}],[`path`,{d:`m14.305 19.53.923-.382`,key:`3m78fa`}],[`path`,{d:`m15.228 16.852-.923-.383`,key:`npixar`}],[`path`,{d:`m16.852 15.228-.383-.923`,key:`5xggr7`}],[`path`,{d:`m16.852 20.772-.383.924`,key:`dpfhf9`}],[`path`,{d:`m19.148 15.228.383-.923`,key:`1reyyz`}],[`path`,{d:`m19.53 21.696-.382-.924`,key:`1goivc`}],[`path`,{d:`m20.772 16.852.924-.383`,key:`htqkph`}],[`path`,{d:`m20.772 19.148.924.383`,key:`9w9pjp`}],[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}]]),Ty=Sl(`folder-plus`,[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),Ey=Sl(`gamepad-2`,[[`line`,{x1:`6`,x2:`10`,y1:`11`,y2:`11`,key:`1gktln`}],[`line`,{x1:`8`,x2:`8`,y1:`9`,y2:`13`,key:`qnk9ow`}],[`line`,{x1:`15`,x2:`15.01`,y1:`12`,y2:`12`,key:`krot7o`}],[`line`,{x1:`18`,x2:`18.01`,y1:`10`,y2:`10`,key:`1lcuu1`}],[`path`,{d:`M17.32 5H6.68a4 4 0 0 0-3.978 3.59c-.006.052-.01.101-.017.152C2.604 9.416 2 14.456 2 16a3 3 0 0 0 3 3c1 0 1.5-.5 2-1l1.414-1.414A2 2 0 0 1 9.828 16h4.344a2 2 0 0 1 1.414.586L17 18c.5.5 1 1 2 1a3 3 0 0 0 3-3c0-1.545-.604-6.584-.685-7.258-.007-.05-.011-.1-.017-.151A4 4 0 0 0 17.32 5z`,key:`mfqc10`}]]),Dy=Sl(`grid-2x2-x`,[[`path`,{d:`M12 3v17a1 1 0 0 1-1 1H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v6a1 1 0 0 1-1 1H3`,key:`11za1p`}],[`path`,{d:`m16 16 5 5`,key:`8tpb07`}],[`path`,{d:`m16 21 5-5`,key:`193jll`}]]),Oy=Sl(`hard-drive`,[[`path`,{d:`M10 16h.01`,key:`1bzywj`}],[`path`,{d:`M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`18tbho`}],[`path`,{d:`M21.946 12.013H2.054`,key:`zqlbp7`}],[`path`,{d:`M6 16h.01`,key:`1pmjb7`}]]),ky=Sl(`highlighter`,[[`path`,{d:`m9 11-6 6v3h9l3-3`,key:`1a3l36`}],[`path`,{d:`m22 12-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4`,key:`14a9rk`}]]),Ay=Sl(`italic`,[[`line`,{x1:`19`,x2:`10`,y1:`4`,y2:`4`,key:`15jd3p`}],[`line`,{x1:`14`,x2:`5`,y1:`20`,y2:`20`,key:`bu0au3`}],[`line`,{x1:`15`,x2:`9`,y1:`4`,y2:`20`,key:`uljnxc`}]]),jy=Sl(`library`,[[`path`,{d:`m16 6 4 14`,key:`ji33uf`}],[`path`,{d:`M12 6v14`,key:`1n7gus`}],[`path`,{d:`M8 8v12`,key:`1gg7y9`}],[`path`,{d:`M4 4v16`,key:`6qkkli`}]]),My=Sl(`link`,[[`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`,key:`1cjeqo`}],[`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`,key:`19qd67`}]]),Ny=Sl(`list-collapse`,[[`path`,{d:`M10 5h11`,key:`1hkqpe`}],[`path`,{d:`M10 12h11`,key:`6m4ad9`}],[`path`,{d:`M10 19h11`,key:`14g2nv`}],[`path`,{d:`m3 10 3-3-3-3`,key:`i7pm08`}],[`path`,{d:`m3 20 3-3-3-3`,key:`20gx1n`}]]),Py=Sl(`list-tree`,[[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`M3 10a2 2 0 0 0 2 2h3`,key:`1npucw`}],[`path`,{d:`M3 5v12a2 2 0 0 0 2 2h3`,key:`x1gjn2`}]]),Fy=[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]],Iy=Sl(`lock`,Fy),Ly=Sl(`megaphone`,[[`path`,{d:`M11 6a13 13 0 0 0 8.4-2.8A1 1 0 0 1 21 4v12a1 1 0 0 1-1.6.8A13 13 0 0 0 11 14H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2z`,key:`q8bfy3`}],[`path`,{d:`M6 14a12 12 0 0 0 2.4 7.2 2 2 0 0 0 3.2-2.4A8 8 0 0 1 10 14`,key:`1853fq`}],[`path`,{d:`M8 6v8`,key:`15ugcq`}]]),Ry=Sl(`network`,[[`rect`,{x:`16`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`4q2zg0`}],[`rect`,{x:`2`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`8cvhb9`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`6`,rx:`1`,key:`1egb70`}],[`path`,{d:`M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3`,key:`1jsf9p`}],[`path`,{d:`M12 12V8`,key:`2874zd`}]]),zy=Sl(`octagon-x`,[[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z`,key:`2d38gg`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),By=Sl(`panel-left-open`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m14 9 3 3-3 3`,key:`8010ee`}]]),Vy=Sl(`pen-line`,[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),Hy=Sl(`pilcrow`,[[`path`,{d:`M13 4v16`,key:`8vvj80`}],[`path`,{d:`M17 4v16`,key:`7dpous`}],[`path`,{d:`M19 4H9.5a4.5 4.5 0 0 0 0 9H13`,key:`sh4n9v`}]]),Uy=Sl(`pin`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z`,key:`1nkz8b`}]]),Wy=Sl(`puzzle`,[[`path`,{d:`M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z`,key:`w46dr5`}]]),Gy=Sl(`rabbit`,[[`path`,{d:`M13 16a3 3 0 0 1 2.24 5`,key:`1epib5`}],[`path`,{d:`M18 12h.01`,key:`yjnet6`}],[`path`,{d:`M18 21h-8a4 4 0 0 1-4-4 7 7 0 0 1 7-7h.2L9.6 6.4a1 1 0 1 1 2.8-2.8L15.8 7h.2c3.3 0 6 2.7 6 6v1a2 2 0 0 1-2 2h-1a3 3 0 0 0-3 3`,key:`ue9ozu`}],[`path`,{d:`M20 8.54V4a2 2 0 1 0-4 0v3`,key:`49iql8`}],[`path`,{d:`M7.612 12.524a3 3 0 1 0-1.6 4.3`,key:`1e33i0`}]]),Ky=Sl(`rat`,[[`path`,{d:`M13 22H4a2 2 0 0 1 0-4h12`,key:`bt3f23`}],[`path`,{d:`M13.236 18a3 3 0 0 0-2.2-5`,key:`1tbvmo`}],[`path`,{d:`M16 9h.01`,key:`1bdo4e`}],[`path`,{d:`M16.82 3.94a3 3 0 1 1 3.237 4.868l1.815 2.587a1.5 1.5 0 0 1-1.5 2.1l-2.872-.453a3 3 0 0 0-3.5 3`,key:`9ch7kn`}],[`path`,{d:`M17 4.988a3 3 0 1 0-5.2 2.052A7 7 0 0 0 4 14.015 4 4 0 0 0 8 18`,key:`3s7e9i`}]]),qy=Sl(`replace-all`,[[`path`,{d:`M14 14a1 1 0 0 1 1 1v5a1 1 0 0 1-1 1`,key:`zg1ipl`}],[`path`,{d:`M14 4a1 1 0 0 1 1-1`,key:`dhj8ez`}],[`path`,{d:`M15 10a1 1 0 0 1-1-1`,key:`1mnyi5`}],[`path`,{d:`M19 14a1 1 0 0 1 1 1v5a1 1 0 0 1-1 1`,key:`txt6k4`}],[`path`,{d:`M21 4a1 1 0 0 0-1-1`,key:`sfs9ap`}],[`path`,{d:`M21 9a1 1 0 0 1-1 1`,key:`mp6qeo`}],[`path`,{d:`m3 7 3 3 3-3`,key:`x25e72`}],[`path`,{d:`M6 10V5a2 2 0 0 1 2-2h2`,key:`15xut4`}],[`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1`,key:`1bkyp8`}]]),Jy=Sl(`replace`,[[`path`,{d:`M14 4a1 1 0 0 1 1-1`,key:`dhj8ez`}],[`path`,{d:`M15 10a1 1 0 0 1-1-1`,key:`1mnyi5`}],[`path`,{d:`M21 4a1 1 0 0 0-1-1`,key:`sfs9ap`}],[`path`,{d:`M21 9a1 1 0 0 1-1 1`,key:`mp6qeo`}],[`path`,{d:`m3 7 3 3 3-3`,key:`x25e72`}],[`path`,{d:`M6 10V5a2 2 0 0 1 2-2h2`,key:`15xut4`}],[`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1`,key:`1bkyp8`}]]),Yy=Sl(`shrimp`,[[`path`,{d:`M11 12h.01`,key:`1lr4k6`}],[`path`,{d:`M13 22c.5-.5 1.12-1 2.5-1-1.38 0-2-.5-2.5-1`,key:`fatpdi`}],[`path`,{d:`M14 2a3.28 3.28 0 0 1-3.227 1.798l-6.17-.561A2.387 2.387 0 1 0 4.387 8H15.5a1 1 0 0 1 0 13 1 1 0 0 0 0-5H12a7 7 0 0 1-7-7V8`,key:`kehrqe`}],[`path`,{d:`M14 8a8.5 8.5 0 0 1 0 8`,key:`1imjx2`}],[`path`,{d:`M16 16c2 0 4.5-4 4-6`,key:`z0nejz`}]]),Xy=Sl(`snail`,[[`path`,{d:`M2 13a6 6 0 1 0 12 0 4 4 0 1 0-8 0 2 2 0 0 0 4 0`,key:`hneq2s`}],[`circle`,{cx:`10`,cy:`13`,r:`8`,key:`194lz3`}],[`path`,{d:`M2 21h12c4.4 0 8-3.6 8-8V7a2 2 0 1 0-4 0v6`,key:`ixqyt7`}],[`path`,{d:`M18 3 19.1 5.2`,key:`9tjm43`}],[`path`,{d:`M22 3 20.9 5.2`,key:`j3odrs`}]]),Zy=Sl(`spell-check`,[[`path`,{d:`m6 16 6-12 6 12`,key:`1b4byz`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}],[`path`,{d:`m16 20 2 2 4-4`,key:`13tcca`}]]),Qy=Sl(`square-arrow-out-up-right`,[[`path`,{d:`M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6`,key:`y09zxi`}],[`path`,{d:`m21 3-9 9`,key:`mpx6sq`}],[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}]]),$y=Sl(`square-code`,[[`path`,{d:`m10 9-3 3 3 3`,key:`1oro0q`}],[`path`,{d:`m14 15 3-3-3-3`,key:`bz13h7`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}]]),eb=Sl(`squirrel`,[[`path`,{d:`M15.236 22a3 3 0 0 0-2.2-5`,key:`21bitc`}],[`path`,{d:`M16 20a3 3 0 0 1 3-3h1a2 2 0 0 0 2-2v-2a4 4 0 0 0-4-4V4`,key:`oh0fg0`}],[`path`,{d:`M18 13h.01`,key:`9veqaj`}],[`path`,{d:`M18 6a4 4 0 0 0-4 4 7 7 0 0 0-7 7c0-5 4-5 4-10.5a4.5 4.5 0 1 0-9 0 2.5 2.5 0 0 0 5 0C7 10 3 11 3 17c0 2.8 2.2 5 5 5h10`,key:`980v8a`}]]),tb=Sl(`star`,[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]),nb=Sl(`sticky-note`,[[`path`,{d:`M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z`,key:`1dfntj`}],[`path`,{d:`M15 3v5a1 1 0 0 0 1 1h5`,key:`6s6qgf`}]]),rb=Sl(`strikethrough`,[[`path`,{d:`M16 4H9a3 3 0 0 0-2.83 4`,key:`43sutm`}],[`path`,{d:`M14 12a4 4 0 0 1 0 8H6`,key:`nlfj13`}],[`line`,{x1:`4`,x2:`20`,y1:`12`,y2:`12`,key:`1e0a9i`}]]),ib=Sl(`table-properties`,[[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M21 9H3`,key:`1338ky`}],[`path`,{d:`M21 15H3`,key:`9uk58r`}]]),ab=Sl(`tag`,[[`path`,{d:`M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z`,key:`vktsd0`}],[`circle`,{cx:`7.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`kqv944`}]]),ob=Sl(`telescope`,[[`path`,{d:`m10.065 12.493-6.18 1.318a.934.934 0 0 1-1.108-.702l-.537-2.15a1.07 1.07 0 0 1 .691-1.265l13.504-4.44`,key:`k4qptu`}],[`path`,{d:`m13.56 11.747 4.332-.924`,key:`19l80z`}],[`path`,{d:`m16 21-3.105-6.21`,key:`7oh9d`}],[`path`,{d:`M16.485 5.94a2 2 0 0 1 1.455-2.425l1.09-.272a1 1 0 0 1 1.212.727l1.515 6.06a1 1 0 0 1-.727 1.213l-1.09.272a2 2 0 0 1-2.425-1.455z`,key:`m7xp4m`}],[`path`,{d:`m6.158 8.633 1.114 4.456`,key:`74o979`}],[`path`,{d:`m8 21 3.105-6.21`,key:`1fvxut`}],[`circle`,{cx:`12`,cy:`13`,r:`2`,key:`1c1ljs`}]]),sb=Sl(`text-align-center`,[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M17 12H7`,key:`16if0g`}],[`path`,{d:`M19 19H5`,key:`vjpgq2`}]]),cb=Sl(`text-align-end`,[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M21 19H7`,key:`4cu937`}]]),lb=Sl(`text-align-start`,[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M17 19H3`,key:`z6ezky`}]]),ub=Sl(`text-quote`,[[`path`,{d:`M17 5H3`,key:`1cn7zz`}],[`path`,{d:`M21 12H8`,key:`scolzb`}],[`path`,{d:`M21 19H8`,key:`13qgcb`}],[`path`,{d:`M3 12v7`,key:`1ri8j3`}]]),db=Sl(`thumbs-down`,[[`path`,{d:`M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z`,key:`m61m77`}],[`path`,{d:`M17 14V2`,key:`8ymqnk`}]]),fb=Sl(`thumbs-up`,[[`path`,{d:`M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z`,key:`emmmcr`}],[`path`,{d:`M7 10v12`,key:`1qc93n`}]]),pb=Sl(`turtle`,[[`path`,{d:`m12 10 2 4v3a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-3a8 8 0 1 0-16 0v3a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-3l2-4h4Z`,key:`1lbbv7`}],[`path`,{d:`M4.82 7.9 8 10`,key:`m9wose`}],[`path`,{d:`M15.18 7.9 12 10`,key:`p8dp2u`}],[`path`,{d:`M16.93 10H20a2 2 0 0 1 0 4H2`,key:`12nsm7`}]]),mb=Sl(`underline`,[[`path`,{d:`M6 4v6a6 6 0 0 0 12 0V4`,key:`9kb039`}],[`line`,{x1:`4`,x2:`20`,y1:`20`,y2:`20`,key:`nun2al`}]]),hb=Sl(`unfold-vertical`,[[`path`,{d:`M12 22v-6`,key:`6o8u61`}],[`path`,{d:`M12 8V2`,key:`1wkif3`}],[`path`,{d:`M4 12H2`,key:`rhcxmi`}],[`path`,{d:`M10 12H8`,key:`s88cx1`}],[`path`,{d:`M16 12h-2`,key:`10asgb`}],[`path`,{d:`M22 12h-2`,key:`14jgyd`}],[`path`,{d:`m15 19-3 3-3-3`,key:`11eu04`}],[`path`,{d:`m15 5-3-3-3 3`,key:`itvq4r`}]]),gb=Sl(`user`,[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]),_b=Sl(`whole-word`,[[`circle`,{cx:`7`,cy:`12`,r:`3`,key:`12clwm`}],[`path`,{d:`M10 9v6`,key:`17i7lo`}],[`circle`,{cx:`17`,cy:`12`,r:`3`,key:`gl7c2s`}],[`path`,{d:`M14 7v8`,key:`dl84cr`}],[`path`,{d:`M22 17v1c0 .5-.5 1-1 1H3c-.5 0-1-.5-1-1v-1`,key:`lt2kga`}]]);function vb(e){return wf(e.map(Tf),``)}function yb(){let e=(0,$.c)(9),t=xl(),n=di(),r=pi(),i=fi(),a;if(e[0]!==i||e[1]!==n||e[2]!==r){let t;e[4]===n?t=e[5]:(t=e=>gi(n,e.source,e.id,!0,e.supported),e[4]=n,e[5]=t),a=mi(r.filter(t),i),e[0]=i,e[1]=n,e[2]=r,e[3]=a}else a=e[3];let o=a,s;return e[6]!==o||e[7]!==t?(s=async e=>{let n=e.map(xb);if(n.length===0)return!1;let r=il({docName:null,workspace:t,instruction:vb(n),mentions:[...new Set(n.map(bb))]});return r===null?(Us.error(ic._({id:`3V94ia`})),!1):o===null?(Us.info(ic._({id:`8YymuQ`})),Xs(),!1):(Jc(r,{agent:{source:o.source,id:o.id}}),!0)},e[6]=o,e[7]=t,e[8]=s):s=e[8],s}function bb(e){return bl(e.docName)}function xb(e){return e.payload}function Sb(){let e=(0,$.c)(3),t=yb(),n=Sc(),r=n?.kind===`thread`?n:null,i;return e[0]!==t||e[1]!==r?(i=e=>{if(r===null){Nt({compose:t,threadIds:e});return}Uc(e)},e[0]=t,e[1]=r,e[2]=i):i=e[2],i}var Cb=null;function wb(e){Cb=e}function Tb(){return Cb}function Eb(){let e=(0,$.c)(3),t=Sb(),n,r;return e[0]===t?(n=e[1],r=e[2]):(n=()=>{let e=function(e){if(!rc(e,`send-comment-queue`)||pr())return;let n=Tb();if(n===null)return;let r=n.scope===`doc`?We(n.docName):ht();r.length!==0&&(e.preventDefault(),t(r))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},r=[t],e[0]=t,e[1]=n,e[2]=r),(0,Q.useEffect)(n,r),null}function Db(e){return e.split(`/`).pop()??e}function Ob(e){let t=(0,$.c)(7),{rowCount:n}=e,{_:r}=xn(),i;t[0]===r?i=t[1]:(i=r({id:`--T3kB`}),t[0]=r,t[1]=i);let a;t[2]===n?a=t[3]:(a=(0,Z.jsx)(`ul`,{className:`space-y-2`,children:Array.from({length:n},Ab).map(kb)}),t[2]=n,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,Z.jsx)(`section`,{role:`status`,"aria-busy":`true`,"aria-label":i,children:a}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function kb(e){return(0,Z.jsxs)(`li`,{"aria-hidden":`true`,className:`flex items-center gap-3`,children:[(0,Z.jsx)(`div`,{className:`size-8 shrink-0 animate-pulse rounded-lg bg-muted`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 py-0.5`,children:[(0,Z.jsx)(`span`,{className:`block h-3.5 w-28 animate-pulse rounded bg-muted`}),(0,Z.jsx)(`span`,{className:`mt-2 block h-3 w-4/5 animate-pulse rounded bg-muted`})]})]},`seed-skeleton-${e}`)}function Ab(e,t){return t}function jb(e,t){let n=[];for(let r of t?.folders??[]){let t=`${r.path}/.ok/templates/`,i=e.created.filter(e=>e.kind===`file`&&(e.path.startsWith(t)||e.path.includes(`/${t}`))).map(e=>Db(e.path)),a=i.length,o=e.created.some(e=>e.kind===`folder`&&(e.path===r.path||e.path.endsWith(`/${r.path}`)));(a>0||o)&&n.push({path:r.path,summary:r.summary,templateCount:a,templates:i})}return n}function Mb(e){return e.created.filter(e=>e.kind===`file`&&!e.path.split(`/`).includes(`.ok`)).map(e=>({path:e.path,name:Db(e.path)}))}function Nb(e){let t=(0,$.c)(17),{plan:n,selectedPack:r}=e,{_:i}=xn(),a,o,s,c;if(t[0]!==i||t[1]!==n||t[2]!==r){let e=jb(n,r),l=Mb(n),u=(n.packSkills??[]).filter(Hb),d=(n.requiredPlugins??[]).filter(Vb),f=e.length,p=l.length,m=e.reduce(Bb,0),h=u.length,g=d.length,_={"log.md":i({id:`EoaQyO`}),"USER.md":i({id:`bV6DJA`}),"SOUL.md":i({id:`Waiy-j`}),"ACCESS_POLICY.md":i({id:`6ZhdPI`}),"HEARTBEAT.md":i({id:`MDZSJe`}),"OVERVIEW.md":i({id:`dMsx3p`}),"welcome.md":i({id:`WWcqsG`}),"index.md":i({id:`uFQbYd`})},v=[f>0?{key:`folders`,n:f,label:i({id:`VsaI0G`,values:{folderCount:f}})}:null,p>0?{key:`files`,n:p,label:i({id:`DgcGrb`,values:{fileCount:p}})}:null,m>0?{key:`templates`,n:m,label:i({id:`ba3vIW`,values:{templateCount:m}})}:null,h>0?{key:`skills`,n:h,label:i({id:`HAvRAI`,values:{skillCount:h}})}:null,g>0?{key:`plugins`,n:g,label:i({id:`llXHHh`,values:{pluginCount:g}})}:null].filter(zb),y=e.map(e=>({key:`folder:${e.path}`,icon:Qd,name:`${Db(e.path)}/`,pill:e.templateCount>0?i({id:`-5jISU`,values:{0:e.templateCount}}):void 0,pillTooltip:e.templateCount>0?e.templates:void 0,description:e.summary||void 0})),b=l.map(e=>({key:`file:${e.path}`,icon:Fe,name:e.name,title:e.name,description:_[e.name]})),x=u.map(e=>({key:`skill:${e.name}`,icon:af,name:vp(e.name),title:e.name,description:i({id:`FEqWFL`})})),S={okf:i({id:`uK2peg`})},C=d.map(e=>({key:`plugin:${e.id}`,icon:Wy,name:Pu.find(t=>t.id===e.id)?.label??e.id,title:e.id,description:S[e.id]??i({id:`1ZXkqM`})})),w=[{key:`folders`,label:i({id:`pcqlQu`,values:{0:y.length}}),rows:y},{key:`files`,label:i({id:`ZgGuA4`,values:{0:b.length}}),rows:b},{key:`skill`,label:i({id:`yK1m_z`,values:{0:x.length}}),rows:x},{key:`plugin`,label:i({id:`7wogIQ`,values:{0:C.length}}),rows:C}].filter(Rb);s=`space-y-5`;let T;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(`h3`,{className:`flex items-center gap-1.5 text-xs font-medium uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`xSVO3J`})}),t[7]=T):T=t[7];let E=v.length>0?(0,Z.jsx)(`div`,{className:`flex flex-wrap items-baseline gap-x-2 gap-y-0.5 text-xs`,children:v.map(Lb)}):null;t[8]===E?c=t[9]:(c=(0,Z.jsxs)(`div`,{className:`flex flex-wrap justify-between items-baseline gap-x-2 gap-y-0.5`,children:[T,E]}),t[8]=E,t[9]=c),a=`space-y-5`,o=w.map(Pb),t[0]=i,t[1]=n,t[2]=r,t[3]=a,t[4]=o,t[5]=s,t[6]=c}else a=t[3],o=t[4],s=t[5],c=t[6];let l;t[10]!==a||t[11]!==o?(l=(0,Z.jsx)(`div`,{className:a,children:o}),t[10]=a,t[11]=o,t[12]=l):l=t[12];let u;return t[13]!==s||t[14]!==c||t[15]!==l?(u=(0,Z.jsxs)(`section`,{className:s,children:[c,l]}),t[13]=s,t[14]=c,t[15]=l,t[16]=u):u=t[16],u}function Pb(e){return(0,Z.jsxs)(`div`,{className:`space-y-2.5`,children:[(0,Z.jsxs)(`h4`,{className:`flex items-baseline gap-2 text-xs font-medium uppercase font-mono tracking-wider text-muted-foreground`,children:[(0,Z.jsx)(`span`,{children:e.label}),(0,Z.jsx)(`span`,{className:`text-muted-foreground/50`,children:e.rows.length})]}),(0,Z.jsx)(`ul`,{className:`space-y-4`,children:e.rows.map(Fb)})]},e.key)}function Fb(e){let t=e.icon;return(0,Z.jsxs)(`li`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(`div`,{"aria-hidden":`true`,className:`flex size-8 shrink-0 items-center justify-center rounded-lg border border-border/60`,children:(0,Z.jsx)(t,{className:`size-4 text-muted-foreground`})}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 py-0.5`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`code`,{className:`min-w-0 flex-1 truncate font-mono text-1sm text-foreground/90`,title:e.title,children:e.name}),e.pill?e.pillTooltip&&e.pillTooltip.length>0?(0,Z.jsxs)(br,{children:[(0,Z.jsx)(_r,{className:`shrink-0 cursor-help rounded bg-transparent p-0 font-mono text-2xs uppercase tracking-wide text-muted-foreground transition-colors hover:text-foreground/70 focus-visible:text-foreground/70 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,children:e.pill}),(0,Z.jsx)(vr,{children:(0,Z.jsx)(`ul`,{className:`space-y-0.5 text-left font-mono`,children:e.pillTooltip.map(Ib)})})]}):(0,Z.jsx)(`span`,{className:`shrink-0 font-mono text-2xs uppercase tracking-wide text-muted-foreground`,children:e.pill}):null]}),e.description?(0,Z.jsx)(`p`,{className:`mt-0.5 text-xs leading-relaxed text-muted-foreground`,children:e.description}):null]})]},e.key)}function Ib(e){return(0,Z.jsx)(`li`,{children:e},e)}function Lb(e,t){return(0,Z.jsxs)(Q.Fragment,{children:[t>0?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`text-muted-foreground/50`,children:`·`}):null,(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`text-foreground/80`,children:e.n}),` `,(0,Z.jsx)(`span`,{className:`text-muted-foreground/80`,children:e.label})]})]},e.key)}function Rb(e){return e.rows.length>0}function zb(e){return e!==null}function Bb(e,t){return e+t.templateCount}function Vb(e){return e.pending}function Hb(e){return e.pending}async function Ub(e){let t=await e.json().catch(()=>null),n=go.safeParse(t);if(!n.success)return{kind:`internal`,message:`HTTP ${e.status}`};let r=n.data.detail??n.data.title,i=n.data.type;return i===`urn:ok:error:seed-prerequisite-missing`?{kind:`prerequisite-missing`,message:r}:i===`urn:ok:error:seed-invalid-root`?{kind:`invalid-root`,message:r}:i===`urn:ok:error:no-project-dir`?{kind:`no-project`,message:r}:{kind:`internal`,message:r}}function Wb(){let e=typeof window<`u`?window.okDesktop:void 0;if(e?.seed){let t=e.seed.apply;return{plan:e.seed.plan,apply:async(e,n)=>{let r=await t(e,n);return r.ok&&dc(),r},listPacks:e.seed.listPacks}}return{plan:async e=>{let t=new URLSearchParams;e?.rootDir&&t.set(`rootDir`,e.rootDir),e?.packId&&t.set(`packId`,e.packId);let n=t.toString(),r=await fetch(`/api/seed/plan${n?`?${n}`:``}`);if(!r.ok)return{ok:!1,error:await Ub(r)};let i=await r.json().catch(()=>null);return i?.plan?{ok:!0,plan:i.plan}:{ok:!1,error:{kind:`internal`,message:ic._({id:`5YWCV_`})}}},apply:async(e,t)=>{let n=await fetch(`/api/seed/apply`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({plan:e,packId:t?.packId})});if(!n.ok)return{ok:!1,error:await Ub(n)};let r=await n.json().catch(()=>null);return r?.result?(dc(),{ok:!0,result:r.result}):{ok:!1,error:{kind:`internal`,message:ic._({id:`aXkLuE`})}}},listPacks:async()=>{let e=await fetch(`/api/seed/packs`);if(!e.ok)return{ok:!1,error:{kind:`internal`,message:`HTTP ${e.status}`}};let t=await e.json().catch(()=>null);return!t||!Array.isArray(t.packs)?{ok:!1,error:{kind:`internal`,message:ic._({id:`q-QUC7`})}}:{ok:!0,packs:t.packs}}}}var Gb={"knowledge-base":jy,"software-lifecycle":Cl,"codebase-wiki":sy,"plain-notes":nb,worldbuilding:py,"writing-pipeline":Vy,"entity-vault":Ry,okf:vy};function Kb(e){return Gb[e]??jy}function qb(e){let t=(0,$.c)(69),{onPackSelect:n,onCreateBlankFile:r,collapsedPackIds:i,className:a,packs:o}=e,{_:s}=xn(),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)(!1),m=o===void 0,h,g;t[0]===m?(h=t[1],g=t[2]):(h=()=>{if(!m)return;let e=!1;return(async()=>{try{let t=await Wb().listPacks();if(e)return;t.ok?l(t.packs):d(t.error.message)}catch(t){let n=t;if(e)return;d(n instanceof Error?n.message:String(n))}})(),()=>{e=!0}},g=[m],t[0]=m,t[1]=h,t[2]=g),(0,Q.useEffect)(h,g);let _=m?c:o;if(u!==null){let e;t[3]===a?e=t[4]:(e=Qn(`rounded-md bg-destructive/10 p-4 text-sm text-destructive`,a),t[3]=a,t[4]=e);let n;t[5]===u?n=t[6]:(n=(0,Z.jsx)(Y,{id:`56WWtu`,values:{error:u}}),t[5]=u,t[6]=n);let r;return t[7]!==e||t[8]!==n?(r=(0,Z.jsx)(`div`,{role:`alert`,className:e,children:n}),t[7]=e,t[8]=n,t[9]=r):r=t[9],r}if(_===null){let e;t[10]===a?e=t[11]:(e=Qn(`@container/packgrid w-full max-w-5xl`,a),t[10]=a,t[11]=e);let n;t[12]===s?n=t[13]:(n=s({id:`BeWTQy`}),t[12]=s,t[13]=n);let r;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(`div`,{className:`grid gap-4 @sm/packgrid:grid-cols-2 @2xl/packgrid:grid-cols-3`,children:Array.from({length:Object.keys(Gb).length},Yb).map(Jb)}),t[14]=r):r=t[14];let i;return t[15]!==e||t[16]!==n||t[17]!==r?(i=(0,Z.jsx)(`div`,{role:`status`,className:e,"aria-busy":`true`,"aria-label":n,children:r}),t[15]=e,t[16]=n,t[17]=r,t[18]=i):i=t[18],i}if(_.length===0){let e;t[19]===a?e=t[20]:(e=Qn(`flex w-full max-w-5xl items-center justify-center rounded-2xl border border-dashed border-border/60 bg-muted/20 p-8 text-sm text-muted-foreground`,a),t[19]=a,t[20]=e);let n;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(Y,{id:`zLGXna`}),t[21]=n):n=t[21];let r;return t[22]===e?r=t[23]:(r=(0,Z.jsx)(`div`,{role:`status`,className:e,children:n}),t[22]=e,t[23]=r),r}let v;t[24]===i?v=t[25]:(v=i??[],t[24]=i,t[25]=v);let y;t[26]===v?y=t[27]:(y=new Set(v),t[26]=v,t[27]=y);let b=y,x,S,C,w,T,E,D,O,k;if(t[28]!==a||t[29]!==b||t[30]!==f||t[31]!==r||t[32]!==n||t[33]!==_){let e;t[43]===b?e=t[44]:(e=e=>!b.has(e.id),t[43]=b,t[44]=e);let i=_.filter(e),o;t[45]===b?o=t[46]:(o=e=>b.has(e.id),t[45]=b,t[46]=o),C=_.filter(o),S=C.length>0,w=S||r!=null,t[47]===a?k=t[48]:(k=Qn(`@container/packgrid w-full max-w-5xl`,a),t[47]=a,t[48]=k),x=Cr,T=f,E=p;let s;t[49]===n?s=t[50]:(s=e=>(0,Z.jsx)(Xb,{pack:e,onSelect:()=>n(e.id)},e.id),t[49]=n,t[50]=s);let c=i.map(s);t[51]===c?D=t[52]:(D=(0,Z.jsx)(`div`,{className:`grid gap-4 @sm/packgrid:grid-cols-2 @2xl/packgrid:grid-cols-3`,children:c}),t[51]=c,t[52]=D),O=S?(0,Z.jsx)(xr,{className:`-mx-1 -mb-1 overflow-hidden px-1 pb-1 data-[state=open]:animate-[collapsible-down_150ms_ease-out] data-[state=closed]:animate-[collapsible-up_150ms_ease-in]`,children:(0,Z.jsx)(`div`,{className:Qn(`grid gap-4 @sm/packgrid:grid-cols-2 @2xl/packgrid:grid-cols-3`,`pt-4`),children:C.map(e=>(0,Z.jsx)(Xb,{pack:e,onSelect:()=>n(e.id)},e.id))})}):null,t[28]=a,t[29]=b,t[30]=f,t[31]=r,t[32]=n,t[33]=_,t[34]=x,t[35]=S,t[36]=C,t[37]=w,t[38]=T,t[39]=E,t[40]=D,t[41]=O,t[42]=k}else x=t[34],S=t[35],C=t[36],w=t[37],T=t[38],E=t[39],D=t[40],O=t[41],k=t[42];let A;t[53]!==f||t[54]!==S||t[55]!==C||t[56]!==r||t[57]!==w?(A=w?(0,Z.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center justify-between gap-2`,children:[S?(0,Z.jsx)(Sr,{asChild:!0,children:(0,Z.jsxs)(X,{type:`button`,variant:`link-muted`,size:`sm`,children:[f?(0,Z.jsx)(Y,{id:`6lGV3K`}):(0,Z.jsx)(Y,{id:`ymWJLd`,values:{0:C.length}}),(0,Z.jsx)(Zl,{"aria-hidden":`true`,className:Qn(`size-3.5 transition-transform`,f&&`rotate-180`)})]})}):(0,Z.jsx)(`span`,{}),r?(0,Z.jsx)(X,{type:`button`,variant:`link-muted`,size:`sm`,onClick:r,children:(0,Z.jsx)(Y,{id:`L4Cdd9`,components:{0:(0,Z.jsx)(Nl,{"aria-hidden":`true`,className:`size-3.5`})}})}):null]}):null,t[53]=f,t[54]=S,t[55]=C,t[56]=r,t[57]=w,t[58]=A):A=t[58];let j;t[59]!==x||t[60]!==A||t[61]!==T||t[62]!==E||t[63]!==D||t[64]!==O?(j=(0,Z.jsxs)(x,{open:T,onOpenChange:E,children:[D,O,A]}),t[59]=x,t[60]=A,t[61]=T,t[62]=E,t[63]=D,t[64]=O,t[65]=j):j=t[65];let M;return t[66]!==j||t[67]!==k?(M=(0,Z.jsx)(`div`,{className:k,children:j}),t[66]=j,t[67]=k,t[68]=M):M=t[68],M}function Jb(e){return(0,Z.jsx)(Qb,{},`skeleton-${e}`)}function Yb(e,t){return t}function Xb(e){let t=(0,$.c)(35),{pack:n,onSelect:r}=e,i;t[0]===n.id?i=t[1]:(i=Kb(n.id),t[0]=n.id,t[1]=i);let a=i,o;t[2]===a?o=t[3]:(o=(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`mt-0.5 shrink-0 text-muted-foreground`,children:(0,Z.jsx)(a,{className:`size-3.5`})}),t[2]=a,t[3]=o);let s;t[4]===n.name?s=t[5]:(s=(0,Z.jsx)(`h3`,{className:`min-w-0 wrap-break-word text-sm font-medium leading-tight`,children:n.name}),t[4]=n.name,t[5]=s);let c;t[6]!==o||t[7]!==s?(c=(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-row items-start gap-2`,children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8];let l;t[9]===n.description?l=t[10]:(l=(0,Z.jsx)(`p`,{className:`line-clamp-2 text-1sm leading-relaxed text-muted-foreground`,children:n.description}),t[9]=n.description,t[10]=l);let u;t[11]===n.entryCounts.files?u=t[12]:(u=(0,Z.jsx)(Y,{id:`jlT89F`,values:{0:n.entryCounts.files}}),t[11]=n.entryCounts.files,t[12]=u);let d;t[13]===n.entryCounts.folders?d=t[14]:(d=(0,Z.jsx)(Y,{id:`Ftz_t9`,values:{0:n.entryCounts.folders}}),t[13]=n.entryCounts.folders,t[14]=d);let f;t[15]!==u||t[16]!==d?(f=(0,Z.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[u,` · `,d]}),t[15]=u,t[16]=d,t[17]=f):f=t[17];let p;t[18]!==c||t[19]!==l||t[20]!==f?(p=(0,Z.jsxs)(`div`,{className:`flex w-full min-w-0 flex-col gap-2`,children:[c,l,f]}),t[18]=c,t[19]=l,t[20]=f,t[21]=p):p=t[21];let m;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsxs)(`span`,{className:`mt-auto inline-flex items-center gap-1 text-xs text-muted-foreground transition-colors group-hover:text-foreground`,children:[(0,Z.jsx)(Y,{id:`UIjjFa`}),(0,Z.jsx)(Nl,{"aria-hidden":`true`,className:`size-3.5`})]}),t[22]=m):m=t[22];let h;t[23]!==r||t[24]!==p?(h=(0,Z.jsxs)(`button`,{type:`button`,onClick:r,className:`group flex h-full min-w-0 flex-col items-start gap-4 rounded-2xl border border-border/60 bg-card p-5 text-left transition-[border-color,box-shadow,transform] hover:border-border hover:shadow-sm focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50 active:translate-y-px`,children:[p,m]}),t[23]=r,t[24]=p,t[25]=h):h=t[25];let g=h;if(n.folders.length===0)return g;let _;t[26]===g?_=t[27]:(_=(0,Z.jsx)(_r,{asChild:!0,children:g}),t[26]=g,t[27]=_);let v;t[28]===n.folders?v=t[29]:(v=n.folders.map(Zb),t[28]=n.folders,t[29]=v);let y;t[30]===v?y=t[31]:(y=(0,Z.jsx)(vr,{className:`flex-col items-start gap-1.5`,children:(0,Z.jsx)(`ul`,{className:`flex flex-col gap-1.5 text-left`,children:v})}),t[30]=v,t[31]=y);let b;return t[32]!==_||t[33]!==y?(b=(0,Z.jsxs)(br,{children:[_,y]}),t[32]=_,t[33]=y,t[34]=b):b=t[34],b}function Zb(e){return(0,Z.jsxs)(`li`,{className:`flex flex-col`,children:[(0,Z.jsx)(`span`,{className:`font-mono`,children:e.path}),(0,Z.jsx)(`span`,{className:`opacity-75`,children:e.summary})]},e.path)}function Qb(){let e=(0,$.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`span`,{className:`size-10 animate-pulse rounded-lg bg-muted`,"aria-hidden":`true`,children:(0,Z.jsx)(cf,{"aria-hidden":`true`,className:`size-5 text-muted-foreground opacity-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 h-full min-h-[200px] flex-col items-start gap-4 rounded-xl border border-border/60 bg-card p-6`,children:[t,(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-2`,children:[(0,Z.jsx)(`div`,{className:`h-4 w-1/2 animate-pulse rounded bg-muted`}),(0,Z.jsx)(`div`,{className:`h-3 w-full animate-pulse rounded bg-muted`}),(0,Z.jsx)(`div`,{className:`h-3 w-4/5 animate-pulse rounded bg-muted`})]}),(0,Z.jsx)(`div`,{className:`mt-auto h-3 w-20 animate-pulse rounded bg-muted`})]}),e[1]=n):n=e[1],n}function $b(e){let t=(0,$.c)(39),{choice:n,subfolder:r,placeholder:i,idPrefix:a,onChoiceChange:o,onSubfolderChange:s}=e,c=a===void 0?`seed-root`:a,{_:l}=xn(),u=`${c}-project-root`,d=`${c}-subfolder`,f=`${c}-group-label`,p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(Y,{id:`3wiBAs`}),t[0]=p):p=t[0];let m;t[1]===f?m=t[2]:(m=(0,Z.jsx)(`p`,{id:f,className:`text-sm font-medium`,children:p}),t[1]=f,t[2]=m);let h;t[3]===o?h=t[4]:(h=e=>o(e),t[3]=o,t[4]=h);let g;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(Ep,{children:(0,Z.jsx)(Y,{id:`RSqaSd`})}),t[5]=g):g=t[5];let _;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsxs)(Cp,{children:[g,(0,Z.jsx)(Tp,{className:`text-1sm`,children:(0,Z.jsx)(Y,{id:`ZvzbDF`})})]}),t[6]=_):_=t[6];let v;t[7]===u?v=t[8]:(v=(0,Z.jsxs)(Dp,{orientation:`horizontal`,children:[_,(0,Z.jsx)(sa,{value:`project-root`,id:u})]}),t[7]=u,t[8]=v);let y;t[9]!==u||t[10]!==v?(y=(0,Z.jsx)(wp,{htmlFor:u,children:v}),t[9]=u,t[10]=v,t[11]=y):y=t[11];let b;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(Ep,{children:(0,Z.jsx)(Y,{id:`ZWgr0b`})}),t[12]=b):b=t[12];let x;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(Tp,{className:`nth-last-2:mt-0 text-1sm`,children:(0,Z.jsx)(Y,{id:`KQGZuq`})}),t[13]=x):x=t[13];let S;t[14]!==l||t[15]!==n||t[16]!==s||t[17]!==i||t[18]!==r?(S=n===`subfolder`&&(0,Z.jsx)(Op,{value:r,onChange:e=>s(e.target.value),placeholder:i,"aria-label":l({id:`NYUhy5`}),spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,className:`mt-1.5 font-mono text-xs bg-background`}),t[14]=l,t[15]=n,t[16]=s,t[17]=i,t[18]=r,t[19]=S):S=t[19];let C;t[20]===S?C=t[21]:(C=(0,Z.jsxs)(Cp,{children:[b,x,S]}),t[20]=S,t[21]=C);let w;t[22]===d?w=t[23]:(w=(0,Z.jsx)(sa,{value:`subfolder`,id:d}),t[22]=d,t[23]=w);let T;t[24]!==C||t[25]!==w?(T=(0,Z.jsxs)(Dp,{orientation:`horizontal`,children:[C,w]}),t[24]=C,t[25]=w,t[26]=T):T=t[26];let E;t[27]!==d||t[28]!==T?(E=(0,Z.jsx)(wp,{htmlFor:d,children:T}),t[27]=d,t[28]=T,t[29]=E):E=t[29];let D;t[30]!==n||t[31]!==f||t[32]!==E||t[33]!==h||t[34]!==y?(D=(0,Z.jsxs)(ca,{"aria-labelledby":f,className:`sm:flex`,value:n,onValueChange:h,children:[y,E]}),t[30]=n,t[31]=f,t[32]=E,t[33]=h,t[34]=y,t[35]=D):D=t[35];let O;return t[36]!==D||t[37]!==m?(O=(0,Z.jsxs)(`div`,{className:`space-y-2 py-1`,children:[m,D]}),t[36]=D,t[37]=m,t[38]=O):O=t[38],O}var ex={"knowledge-base":{id:`gvApb7`},"software-lifecycle":{id:`hCOLSd`},"codebase-wiki":{id:`Fy4GgU`},"plain-notes":{id:`Qw-7Ie`},okf:{id:`_ayOfA`},"writing-pipeline":{id:`Zf0w-R`},"entity-vault":{id:`hmYd9H`},worldbuilding:{id:`VBE2dw`}},tx=180,nx=5e3,rx=200;function ix(e,t){if(e===``||t===``)return``;let n=e.includes(`\\`)&&!e.includes(`/`)?`\\`:`/`;return`${e.replace(/[/\\]+$/,``)}${n}${t}`}function ax(e){if(e===``)return``;let t=e.split(/[/\\]/).filter(Boolean);return t.length>0?t[t.length-1]??e:e}function ox(e){let{parent:t,sanitizedName:n,enclosingProject:r,enclosingGit:i,targetState:a}=e;return t===``||n===``?{kind:`idle`}:r===null?i===null?a===`exists-nonempty`?{kind:`block-nonempty`}:{kind:`free`}:{kind:`confirm-git`,gitRoot:i.gitRoot}:{kind:`block-nested`,rootPath:r.rootPath}}function sx(e){let t=e instanceof Error?e.message:String(e);for(let e of Os)if(t.startsWith(`${e}:`)||t.includes(`${e}: `))return e===`nested-project`||e===`target-not-empty`?{reason:e}:{reason:e,message:t};return{reason:`unknown`,message:t}}function cx(e){switch(e.reason){case`nested-project`:return{id:`ScwcF2`};case`target-not-empty`:return{id:`e8L17t`};case`invalid-args`:return{id:`6bTTAN`};case`mkdir-failed`:return{id:`gJR87V`};case`git-init-failed`:return{id:`4CfgPM`};case`init-failed`:return{id:`l17ab4`};case`discovery-failed`:return{id:`ThmUrC`};case`unknown`:return{id:`AddR83`}}}function lx(e){let t=(0,$.c)(191),{open:n,onOpenChange:r,bridge:i,initialPackId:a,packs:o}=e,{_:s}=xn(),c=(0,Q.useId)(),l=(0,Q.useId)(),u=(0,Q.useId)(),d=(0,Q.useId)(),[f,p]=(0,Q.useState)(``),[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(``),[v,y]=(0,Q.useState)(null),[b,x]=(0,Q.useState)(!0),[S,C]=(0,Q.useState)(!1),[w,T]=(0,Q.useState)(`shared`),[E,D]=(0,Q.useState)(!1),[O,k]=(0,Q.useState)(a),[A,j]=(0,Q.useState)(`configure`),[M,N]=(0,Q.useState)(`project-root`),[P,F]=(0,Q.useState)(``),I;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(I={kind:`loading`},t[0]=I):I=t[0];let[L,R]=(0,Q.useState)(I),z;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(z={kind:`idle`},t[1]=z):z=t[1];let[B,V]=(0,Q.useState)(z),[H,U]=(0,Q.useState)(`idle`),[ee,W]=(0,Q.useState)(!1),[te,G]=(0,Q.useState)(null),K;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(K={kind:`idle`},t[2]=K):K=t[2];let[q,ne]=(0,Q.useState)(K),[re,J]=(0,Q.useState)(0),ie;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(ie=new Set,t[3]=ie):ie=t[3];let ae=(0,Q.useRef)(ie),oe=(0,Q.useRef)(null),se=(0,Q.useRef)(null),ce=(0,Q.useRef)(null),le=(0,Q.useRef)(0),ue=(0,Q.useRef)(!0),de,fe;t[4]!==i||t[5]!==a||t[6]!==n?(de=()=>{if(!n)return;ae.current.clear(),G(null),V({kind:`idle`}),U(`idle`),W(!1),_(``),y(null),x(!0),C(!1),T(`shared`),D(!1),ne({kind:`idle`}),k(a),j(`configure`),N(`project-root`),R({kind:`loading`}),ue.current=!0,le.current+=1;let e=!1;i.integrations.status().then(t=>{if(e)return;let n=new Set(t.editors.filter(vx).map(_x));y(t.detectedEditorIds.filter(e=>Ra(e,{userMcpEntryInstalled:n.has(e)})))}).catch(t=>{console.warn(`[CreateProjectDialog] editor-detection probe failed:`,t),e||y([])}),p(``),h(!0),i.fs.defaultProjectsRoot().then(t=>{e||p(t)}).catch(gx).finally(()=>{e||h(!1)});let t=requestAnimationFrame(()=>{ce.current?.focus()});return()=>{e=!0,cancelAnimationFrame(t)}},fe=[n,i,a],t[4]=i,t[5]=a,t[6]=n,t[7]=de,t[8]=fe):(de=t[7],fe=t[8]),(0,Q.useEffect)(de,fe);let pe;t[9]!==O||t[10]!==o?(pe=o?.find(e=>e.id===O),t[9]=O,t[10]=o,t[11]=pe):pe=t[11];let me=pe,he=me?.defaultSubfolder??``,ge;t[12]!==O||t[13]!==he?(ge=()=>{O!==void 0&&F(he)},t[12]=O,t[13]=he,t[14]=ge):ge=t[14];let _e;t[15]!==n||t[16]!==O||t[17]!==he?(_e=[n,O,he],t[15]=n,t[16]=O,t[17]=he,t[18]=_e):_e=t[18],(0,Q.useEffect)(ge,_e);let ve;t[19]===P?ve=t[20]:(ve=P.trim(),t[19]=P,t[20]=ve);let ye=ve,be=me!==void 0&&M===`subfolder`&&ye===``,xe=M===`project-root`?void 0:ye,Se=b&&(v?.length??0)>0,Ce,we;t[21]!==s||t[22]!==n||t[23]!==xe||t[24]!==me||t[25]!==Se||t[26]!==A||t[27]!==be?(Ce=()=>{if(!n||me===void 0||A!==`configure`)return;if(be){R({kind:`error`,message:s({id:`Z8KDox`}),blocking:!0});return}let e=ue.current?0:rx;ue.current=!1;let t=!1,r=setTimeout(()=>{t||(R(hx),Wb().plan({rootDir:xe,packId:me.id,preview:{skillsInstallable:Se}}).then(e=>{if(t)return;if(e.ok){R({kind:`plan`,plan:e.plan});return}let n=e.error.kind===`invalid-root`;n||console.warn(`[CreateProjectDialog] pack preview unavailable:`,e.error),R({kind:`error`,message:n?e.error.message:s({id:`7vxWET`}),blocking:n})}).catch(e=>{t||(console.warn(`[CreateProjectDialog] pack preview plan failed:`,e),R({kind:`error`,message:s({id:`7vxWET`}),blocking:!1}))}))},e);return()=>{t=!0,clearTimeout(r)}},we=[n,A,me,xe,be,Se,s],t[21]=s,t[22]=n,t[23]=xe,t[24]=me,t[25]=Se,t[26]=A,t[27]=be,t[28]=Ce,t[29]=we):(Ce=t[28],we=t[29]),(0,Q.useEffect)(Ce,we);let Te;t[30]!==i||t[31]!==f||t[32]!==g||t[33]!==n?(Te=()=>{if(!n)return;se.current!==null&&clearTimeout(se.current),oe.current!==null&&oe.current.abort();let e=$a(g);if(f===``||e===``){V({kind:`idle`}),U(`idle`);return}let t=f,r=ix(t,e),a=new AbortController;return oe.current=a,se.current=setTimeout(()=>{U(`in-flight`),Promise.all([i.fs.findEnclosingProjectRoot(t),i.fs.findEnclosingGitRoot(t),i.fs.folderState(r)]).then(n=>{let[r,i,o]=n;a.signal.aborted||(U(`idle`),V(ox({parent:t,sanitizedName:e,enclosingProject:r,enclosingGit:i,targetState:o})))}).catch(e=>{a.signal.aborted||(console.warn(`[CreateProjectDialog] cascade probe failed:`,e),U(`idle`),V({kind:`free`}))})},tx),()=>{se.current!==null&&clearTimeout(se.current),a.abort()}},t[30]=i,t[31]=f,t[32]=g,t[33]=n,t[34]=Te):Te=t[34];let Ee;t[35]!==i||t[36]!==f||t[37]!==g||t[38]!==n||t[39]!==re?(Ee=[n,f,g,i,re],t[35]=i,t[36]=f,t[37]=g,t[38]=n,t[39]=re,t[40]=Ee):Ee=t[40],(0,Q.useEffect)(Te,Ee);let De,Oe;t[41]===n?(De=t[42],Oe=t[43]):(De=()=>{if(!n)return;let e=()=>J(mx);return window.addEventListener(`focus`,e),()=>window.removeEventListener(`focus`,e)},Oe=[n],t[41]=n,t[42]=De,t[43]=Oe),(0,Q.useEffect)(De,Oe);let ke=(0,Q.useRef)(`idle`),Ae,je;t[44]===H?(Ae=t[45],je=t[46]):(Ae=()=>{ke.current=H},je=[H],t[44]=H,t[45]=Ae,t[46]=je),(0,Q.useEffect)(Ae,je);let Me,Ne;t[47]!==B.kind||t[48]!==n?(Me=()=>{if(!n||B.kind!==`confirm-git`)return;let e=setInterval(()=>{ke.current!==`in-flight`&&J(px)},nx);return()=>clearInterval(e)},Ne=[n,B.kind],t[47]=B.kind,t[48]=n,t[49]=Me,t[50]=Ne):(Me=t[49],Ne=t[50]),(0,Q.useEffect)(Me,Ne);let Pe;t[51]!==B.gitRoot||t[52]!==B.kind||t[53]!==q.gitRoot||t[54]!==q.kind?(Pe=()=>{if(B.kind!==`confirm-git`){q.kind!==`idle`&&(le.current+=1,ne({kind:`idle`}));return}q.kind===`confirming`&&q.gitRoot!==B.gitRoot&&ne({kind:`idle`}),q.kind===`pending`&&q.gitRoot!==B.gitRoot&&(le.current+=1,ne({kind:`idle`}))},t[51]=B.gitRoot,t[52]=B.kind,t[53]=q.gitRoot,t[54]=q.kind,t[55]=Pe):Pe=t[55];let Fe;t[56]!==B||t[57]!==q?(Fe=[B,q],t[56]=B,t[57]=q,t[58]=Fe):Fe=t[58],(0,Q.useEffect)(Pe,Fe);let Ie;t[59]!==i||t[60]!==B.kind||t[61]!==n?(Ie=()=>{if(!n)return;let e=null;B.kind===`block-nested`?e=`nested`:B.kind===`block-nonempty`?e=`nonempty`:B.kind===`confirm-git`&&(e=`git-confirm`),e!==null&&(ae.current.has(e)||(ae.current.add(e),i.project.recordCreateNewBannerShown(e).catch(fx)))},t[59]=i,t[60]=B.kind,t[61]=n,t[62]=Ie):Ie=t[62];let Le;t[63]!==i||t[64]!==B||t[65]!==n?(Le=[n,B,i],t[63]=i,t[64]=B,t[65]=n,t[66]=Le):Le=t[66],(0,Q.useEffect)(Ie,Le);let Re=g,ze,Be,Ve,He,Ue;t[67]!==B.kind||t[68]!==f||t[69]!==Re?(He=Re===``?``:$a(Re),Be=Re!==``&&He!==Re&&He!==``,Ve=Re!==``&&He===``,ze=B.kind===`block-nonempty`,Ue=f!==``&&He!==``?ix(f,He):``,t[67]=B.kind,t[68]=f,t[69]=Re,t[70]=ze,t[71]=Be,t[72]=Ve,t[73]=He,t[74]=Ue):(ze=t[70],Be=t[71],Ve=t[72],He=t[73],Ue=t[74]);let We=Ue,Ge=!ee&&f!==``&&Re!==``&&He!==``&&!be&&(me===void 0||L.kind!==`error`||!L.blocking)&&H===`idle`&&(B.kind===`free`||B.kind===`confirm-git`),Ke=ee||b&&v===null||Re!==``&&!Ge,qe;t[75]!==i||t[76]!==f?(qe=async function(){try{let e=await i.dialog.openFolder(f===``?void 0:{defaultPath:f});if(e===null)return;p(e),J(dx),G(null)}catch(e){console.warn(`[CreateProjectDialog] dialog.openFolder failed:`,e)}},t[75]=i,t[76]=f,t[77]=qe):qe=t[77];let Je=qe,Ye;t[78]!==s||t[79]!==i||t[80]!==ee||t[81]!==Ge||t[82]!==b||t[83]!==v||t[84]!==f||t[85]!==r||t[86]!==O||t[87]!==xe||t[88]!==Re||t[89]!==He||t[90]!==w?(Ye=async function(e){if(e.preventDefault(),!ee){if(Re.trim()===``){Us.error(s({id:`5OqaJi`})),ce.current?.focus();return}if(Ge){W(!0),G(null);try{await i.project.createNew({parent:f,name:He,editors:b?[...v??[]]:[],sharing:w,packId:O,rootDir:xe}),r(!1)}catch(e){G(sx(e)),W(!1)}}}},t[78]=s,t[79]=i,t[80]=ee,t[81]=Ge,t[82]=b,t[83]=v,t[84]=f,t[85]=r,t[86]=O,t[87]=xe,t[88]=Re,t[89]=He,t[90]=w,t[91]=Ye):Ye=t[91];let Xe=Ye,Ze;t[92]!==ee||t[93]!==r?(Ze=function(e){ee||r(e)},t[92]=ee,t[93]=r,t[94]=Ze):Ze=t[94];let Qe=Ze,$e;t[95]===Symbol.for(`react.memo_cache_sentinel`)?($e=async function(e){ne({kind:`confirming`,gitRoot:e})},t[95]=$e):$e=t[95];let et=$e,tt;t[96]===Symbol.for(`react.memo_cache_sentinel`)?(tt=async function(){ne({kind:`idle`})},t[96]=tt):tt=t[96];let nt=tt,rt;t[97]===i?rt=t[98]:(rt=async function(e){let t=le.current+1;le.current=t,ne({kind:`pending`,gitRoot:e});try{if(await i.fs.removeGitFolder(e),le.current!==t)return;J(ux),ne({kind:`idle`})}catch(e){let n=e;if(le.current!==t)return;let r=n instanceof Error?n.message:String(n);console.error(`[CreateProjectDialog] bridge.fs.removeGitFolder failed:`,n),ne({kind:`error`,message:r})}},t[97]=i,t[98]=rt);let it=rt,at;t[99]!==i||t[100]!==r?(at=async function(e){r(!1);try{await i.project.open({path:e,target:`new-window`,entryPoint:`create-new-nested-redirect`})}catch(e){console.warn(`[CreateProjectDialog] project.open failed:`,e)}},t[99]=i,t[100]=r,t[101]=at):at=t[101];let ot=at,st=Ve||ze||Be?`${u} ${d}`:u,ct=O!==void 0&&(o?.length??0)>0,lt=me?.name,ut=me?ex[me.id]:void 0,dt;t[102]!==s||t[103]!==lt?(dt=s(lt===void 0?{id:`wbv9xO`}:{id:`MPpSAg`,values:{selectedPackName:lt}}),t[102]=s,t[103]=lt,t[104]=dt):dt=t[104];let ft=dt,pt;t[105]!==s||t[106]!==me||t[107]!==ut?(pt=me===void 0?s({id:`O6yEPk`}):ut?s(ut):me.description,t[105]=s,t[106]=me,t[107]=ut,t[108]=pt):pt=t[108];let mt=pt,ht=A===`pick`&&`sm:max-w-3xl`,gt;t[109]===ht?gt=t[110]:(gt=Qn(`sm:max-w-lg`,ht),t[109]=ht,t[110]=gt);let _t;t[111]!==s||t[112]!==A||t[113]!==ft?(_t=A===`pick`?s({id:`tcjTlU`}):ft,t[111]=s,t[112]=A,t[113]=ft,t[114]=_t):_t=t[114];let vt;t[115]===_t?vt=t[116]:(vt=(0,Z.jsx)(Pp,{children:_t}),t[115]=_t,t[116]=vt);let yt;t[117]!==s||t[118]!==mt||t[119]!==A?(yt=A===`pick`?s({id:`b6Fgpe`}):mt,t[117]=s,t[118]=mt,t[119]=A,t[120]=yt):yt=t[120];let bt;t[121]===yt?bt=t[122]:(bt=(0,Z.jsx)(Np,{children:yt}),t[121]=yt,t[122]=bt);let xt;t[123]!==vt||t[124]!==bt?(xt=(0,Z.jsxs)(zp,{children:[vt,bt]}),t[123]=vt,t[124]=bt,t[125]=xt):xt=t[125];let St;t[126]!==s||t[127]!==E||t[128]!==ee||t[129]!==u||t[130]!==B||t[131]!==b||t[132]!==v||t[133]!==c||t[134]!==f||t[135]!==m||t[136]!==g||t[137]!==st||t[138]!==d||t[139]!==l||t[140]!==ze||t[141]!==Je||t[142]!==it||t[143]!==ot||t[144]!==Xe||t[145]!==L||t[146]!==o||t[147]!==q||t[148]!==M||t[149]!==Be||t[150]!==Ve||t[151]!==He||t[152]!==me||t[153]!==w||t[154]!==S||t[155]!==A||t[156]!==P||t[157]!==te||t[158]!==We?(St=A===`pick`?(0,Z.jsx)(Ip,{children:(0,Z.jsx)(qb,{packs:o??null,onPackSelect:e=>{k(e),j(`configure`),ue.current=!0,R({kind:`loading`}),requestAnimationFrame(()=>ce.current?.focus())}})}):(0,Z.jsx)(Ip,{className:`space-y-6`,children:(0,Z.jsxs)(`form`,{id:c,onSubmit:Xe,"data-testid":`create-project-form`,className:`space-y-6`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(Ki,{htmlFor:l,children:(0,Z.jsx)(Y,{id:`OyIC0Q`})}),(0,Z.jsx)(Op,{id:l,ref:ce,value:g,placeholder:s({id:`cV7LOw`}),onChange:e=>_(e.target.value),disabled:ee,autoComplete:`off`,"aria-invalid":Ve||ze,"aria-describedby":st,"data-testid":`create-name`}),Ve?(0,Z.jsx)(`p`,{id:d,role:`alert`,className:`text-1sm text-destructive`,"data-testid":`create-name-error-erased`,children:(0,Z.jsx)(Y,{id:`_PBJRl`})}):ze?(0,Z.jsx)(`p`,{id:d,role:`alert`,className:`text-1sm text-destructive`,"data-testid":`create-name-error-taken`,children:(0,Z.jsx)(Y,{id:`7apDiJ`,values:{sanitized:He},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-all`})}})}):Be?(0,Z.jsx)(`p`,{id:d,role:`status`,"aria-live":`polite`,className:`text-1sm text-muted-foreground`,"data-testid":`create-name-hint-diverged`,children:(0,Z.jsx)(Y,{id:`KnoB--`,values:{sanitized:He},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-all`})}})}):null]}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(Ki,{children:(0,Z.jsx)(Y,{id:`wJijgU`})}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`div`,{className:`min-w-0 flex-1 rounded-md border border-input bg-muted/50 px-2.5 py-1 text-sm text-foreground wrap-break-word`,"data-testid":`create-location-display`,children:f===``?m?(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`iHAJDj`})}):(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`8m8diM`})}):f}),(0,Z.jsx)(X,{type:`button`,variant:`outline`,className:`shrink-0`,disabled:ee,onClick:()=>void Je(),"data-testid":`create-browse`,children:(0,Z.jsx)(Y,{id:`O2UpM1`})})]}),(0,Z.jsx)(`p`,{id:u,className:`text-1sm text-muted-foreground wrap-break-word`,"aria-live":`polite`,"data-testid":`create-target-caption`,children:We===``?null:(0,Z.jsx)(Y,{id:`k_yIIc`,values:{targetPreview:We},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-all`})}})})]}),(0,Z.jsx)(Sx,{cascade:B,onOpenNested:ot,removeGitState:q,onRequestRemoveGit:et,onCancelRemoveGit:nt,onConfirmRemoveGit:it}),me?(0,Z.jsxs)(`div`,{className:`space-y-6`,"data-testid":`create-pack-section`,children:[(0,Z.jsx)($b,{choice:M,subfolder:P,placeholder:me.defaultSubfolder??`subfolder`,idPrefix:`create-seed-root`,onChoiceChange:N,onSubfolderChange:F}),B.kind===`confirm-git`?(0,Z.jsx)(`p`,{className:`text-1sm text-muted-foreground`,"data-testid":`create-pack-promoted-note`,children:(0,Z.jsx)(Y,{id:`-ksoxk`,values:{sanitized:He},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-all`})}})}):null,L.kind===`error`?(0,Z.jsx)(`div`,{role:`alert`,className:`rounded-md bg-destructive/10 p-3 text-sm text-destructive`,"data-testid":`create-pack-preview-error`,children:L.message}):L.kind===`plan`?(0,Z.jsx)(Nb,{plan:L.plan,selectedPack:me}):(0,Z.jsx)(Ob,{rowCount:me.folders.length})]}):null,(0,Z.jsx)(yx,{detectedEditors:v,checked:b,onCheckedChange:x,showDetails:S,onShowDetailsChange:C,disabled:ee}),(0,Z.jsxs)(Cr,{open:E,onOpenChange:D,className:`rounded-md border border-border`,"data-testid":`create-advanced`,children:[(0,Z.jsxs)(Sr,{className:`group flex w-full items-center justify-between gap-2 px-3 py-2 text-sm font-medium hover:bg-muted/50`,"data-testid":`create-advanced-trigger`,children:[(0,Z.jsx)(Y,{id:`VNgKZz`}),(0,Z.jsx)(Ql,{className:`size-4 transition-transform group-data-[state=open]:rotate-90 motion-reduce:transition-none`,"aria-hidden":!0})]}),(0,Z.jsx)(xr,{className:`space-y-6 border-t border-border px-3 py-4`,children:(0,Z.jsx)(kp,{idPrefix:`create`,testIdPrefix:`create-sharing`,value:w,onValueChange:T,disabled:ee})})]}),te===null?null:(0,Z.jsx)(`div`,{role:`alert`,className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,"data-testid":`create-submit-error`,children:s(cx(te))})]})}),t[126]=s,t[127]=E,t[128]=ee,t[129]=u,t[130]=B,t[131]=b,t[132]=v,t[133]=c,t[134]=f,t[135]=m,t[136]=g,t[137]=st,t[138]=d,t[139]=l,t[140]=ze,t[141]=Je,t[142]=it,t[143]=ot,t[144]=Xe,t[145]=L,t[146]=o,t[147]=q,t[148]=M,t[149]=Be,t[150]=Ve,t[151]=He,t[152]=me,t[153]=w,t[154]=S,t[155]=A,t[156]=P,t[157]=te,t[158]=We,t[159]=St):St=t[159];let Ct;t[160]!==ee||t[161]!==ct||t[162]!==A?(Ct=A===`configure`&&ct?(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,className:`me-auto font-mono uppercase`,onClick:()=>j(`pick`),disabled:ee,"data-testid":`create-change-pack`,children:[(0,Z.jsx)(Al,{"aria-hidden":`true`,className:`h-4 w-4`}),(0,Z.jsx)(Y,{id:`uLVNZL`})]}):null,t[160]=ee,t[161]=ct,t[162]=A,t[163]=Ct):Ct=t[163];let wt;t[164]!==r||t[165]!==A?(wt=()=>A===`pick`?j(`configure`):r(!1),t[164]=r,t[165]=A,t[166]=wt):wt=t[166];let Tt;t[167]===A?Tt=t[168]:(Tt=A===`pick`?(0,Z.jsx)(Y,{id:`iH8pgl`}):(0,Z.jsx)(Y,{id:`dEgA5A`}),t[167]=A,t[168]=Tt);let Et;t[169]!==ee||t[170]!==wt||t[171]!==Tt?(Et=(0,Z.jsx)(X,{type:`button`,variant:`outline`,className:`font-mono uppercase`,onClick:wt,disabled:ee,"data-testid":`create-cancel`,children:Tt}),t[169]=ee,t[170]=wt,t[171]=Tt,t[172]=Et):Et=t[172];let Dt;t[173]!==ee||t[174]!==c||t[175]!==A||t[176]!==Ke?(Dt=A===`configure`?(0,Z.jsx)(X,{type:`submit`,form:c,disabled:Ke,"data-testid":`create-submit`,children:ee?(0,Z.jsx)(Y,{id:`E9bKSA`}):(0,Z.jsx)(Y,{id:`hYgDIe`})}):null,t[173]=ee,t[174]=c,t[175]=A,t[176]=Ke,t[177]=Dt):Dt=t[177];let Ot;t[178]!==Ct||t[179]!==Et||t[180]!==Dt?(Ot=(0,Z.jsxs)(Lp,{children:[Ct,Et,Dt]}),t[178]=Ct,t[179]=Et,t[180]=Dt,t[181]=Ot):Ot=t[181];let kt;t[182]!==gt||t[183]!==xt||t[184]!==St||t[185]!==Ot?(kt=(0,Z.jsxs)(Fp,{className:gt,"data-testid":`create-project-dialog`,children:[xt,St,Ot]}),t[182]=gt,t[183]=xt,t[184]=St,t[185]=Ot,t[186]=kt):kt=t[186];let At;return t[187]!==Qe||t[188]!==n||t[189]!==kt?(At=(0,Z.jsx)(Bp,{open:n,onOpenChange:Qe,children:kt}),t[187]=Qe,t[188]=n,t[189]=kt,t[190]=At):At=t[190],At}function ux(e){return e+1}function dx(e){return e+1}function fx(){}function px(e){return e+1}function mx(e){return e+1}function hx(e){return e.kind===`plan`?e:{kind:`loading`}}function gx(e){console.warn(`[CreateProjectDialog] defaultProjectsRoot probe failed:`,e)}function _x(e){return e.id}function vx(e){return e.state===`installed`}function yx(e){let t=(0,$.c)(61),{detectedEditors:n,checked:r,onCheckedChange:i,showDetails:a,onShowDetailsChange:o,disabled:s}=e,{_:c}=xn(),l=(0,Q.useId)(),u=(0,Q.useId)(),d,f,p,m,h,g,_,v;if(t[0]!==c||t[1]!==u||t[2]!==r||t[3]!==l||t[4]!==n||t[5]!==s||t[6]!==i||t[7]!==o||t[8]!==a){v=Symbol.for(`react.early_return_sentinel`);bb0:{let e=n===null?{kind:`probing`,message:c({id:`jWzDfC`})}:n.length===0?{kind:`none`,message:c({id:`aSVmqV`})}:{kind:`ready`,message:``,editors:n},y=e.kind===`ready`?`sr-only`:`rounded-md border border-border px-3 py-2.5 text-1sm text-muted-foreground`,b;t[17]===y?b=t[18]:(b=Qn(y),t[17]=y,t[18]=b);let x=(0,Z.jsx)(`p`,{"aria-live":`polite`,className:b,"data-status":e.kind,"data-testid":`create-editors-status`,children:e.message});if(e.kind!==`ready`){v=x;break bb0}_=x,h=`overflow-hidden rounded-md border border-border`;let S;t[19]!==r||t[20]!==i?(S=()=>i(!r),t[19]=r,t[20]=i,t[21]=S):S=t[21];let C;t[22]!==u||t[23]!==r||t[24]!==s||t[25]!==S?(C=(0,Z.jsx)($r,{id:u,checked:r,onCheckedChange:S,disabled:s,className:`mt-0.5`,"data-testid":`create-editors-checkbox`}),t[22]=u,t[23]=r,t[24]=s,t[25]=S,t[26]=C):C=t[26];let w;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(`span`,{className:`text-1sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`C4HK3A`})}),t[27]=w):w=t[27];let T=(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,Z.jsx)(`span`,{className:`text-sm font-medium text-foreground`,"data-testid":`create-editors-summary`,children:c({id:`j4SmVY`,values:{0:Vp(e.editors.map(xx),ic.locale)}})}),w]});t[28]!==u||t[29]!==C||t[30]!==T?(g=(0,Z.jsxs)(Ki,{htmlFor:u,className:`flex cursor-pointer items-start gap-2.5 px-3 py-2.5 font-normal hover:bg-muted/50`,children:[C,T]}),t[28]=u,t[29]=C,t[30]=T,t[31]=g):g=t[31],p=`border-t border-border`;let E;t[32]!==o||t[33]!==a?(E=()=>o(!a),t[32]=o,t[33]=a,t[34]=E):E=t[34];let D=a&&`rotate-90`,O;t[35]===D?O=t[36]:(O=Qn(`size-3.5 transition-transform motion-reduce:transition-none`,D),t[35]=D,t[36]=O);let k;t[37]===O?k=t[38]:(k=(0,Z.jsx)(Ql,{className:O,"aria-hidden":!0}),t[37]=O,t[38]=k);let A;t[39]===a?A=t[40]:(A=a?(0,Z.jsx)(Y,{id:`VMlRqi`}):(0,Z.jsx)(Y,{id:`LiAw2k`}),t[39]=a,t[40]=A),t[41]!==l||t[42]!==a||t[43]!==E||t[44]!==k||t[45]!==A?(m=(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`sm`,className:`h-auto w-full justify-start gap-1 rounded-none px-3 py-2 text-xs font-normal text-muted-foreground hover:text-foreground`,onClick:E,"aria-expanded":a,"aria-controls":l,"data-testid":`create-editors-details-toggle`,children:[k,A]}),t[41]=l,t[42]=a,t[43]=E,t[44]=k,t[45]=A,t[46]=m):m=t[46],d=l,f=a&&(0,Z.jsx)(`ul`,{className:`flex flex-col gap-1.5 border-t border-border px-3 py-2.5`,"data-testid":`create-editors-details`,children:e.editors.map(bx)})}t[0]=c,t[1]=u,t[2]=r,t[3]=l,t[4]=n,t[5]=s,t[6]=i,t[7]=o,t[8]=a,t[9]=d,t[10]=f,t[11]=p,t[12]=m,t[13]=h,t[14]=g,t[15]=_,t[16]=v}else d=t[9],f=t[10],p=t[11],m=t[12],h=t[13],g=t[14],_=t[15],v=t[16];if(v!==Symbol.for(`react.early_return_sentinel`))return v;let y;t[47]!==d||t[48]!==f?(y=(0,Z.jsx)(`div`,{id:d,children:f}),t[47]=d,t[48]=f,t[49]=y):y=t[49];let b;t[50]!==p||t[51]!==m||t[52]!==y?(b=(0,Z.jsxs)(`div`,{className:p,children:[m,y]}),t[50]=p,t[51]=m,t[52]=y,t[53]=b):b=t[53];let x;t[54]!==b||t[55]!==h||t[56]!==g?(x=(0,Z.jsxs)(`div`,{className:h,children:[g,b]}),t[54]=b,t[55]=h,t[56]=g,t[57]=x):x=t[57];let S;return t[58]!==x||t[59]!==_?(S=(0,Z.jsxs)(Z.Fragment,{children:[_,x]}),t[58]=x,t[59]=_,t[60]=S):S=t[60],S}function bx(e){let t=xs[e],n=Ho[e];return(0,Z.jsxs)(`li`,{className:`flex min-w-0 flex-col`,"data-testid":`create-editor-${e}`,children:[(0,Z.jsx)(`span`,{className:`text-1sm text-foreground`,children:ps[e]}),t!==null&&(0,Z.jsx)(`code`,{className:`text-xs text-muted-foreground break-all`,children:t}),n!==null&&(0,Z.jsx)(`code`,{className:`text-xs text-muted-foreground break-all`,children:`${n}/open-knowledge/`})]},e)}function xx(e){return ps[e]}function Sx(e){let t=(0,$.c)(37),{cascade:n,onOpenNested:r,removeGitState:i,onRequestRemoveGit:a,onCancelRemoveGit:o,onConfirmRemoveGit:s}=e;if(n.kind===`idle`||n.kind===`free`||n.kind===`block-nonempty`)return null;if(n.kind===`block-nested`){let{rootPath:e}=n,i;t[0]===e?i=t[1]:(i=ax(e),t[0]=e,t[1]=i);let a=i,o;t[2]===e?o=t[3]:(o={rootPath:e},t[2]=e,t[3]=o);let s;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(s={0:(0,Z.jsx)(`code`,{className:`font-mono break-all`})},t[4]=s):s=t[4];let c;t[5]===o?c=t[6]:(c=(0,Z.jsx)(`p`,{className:`mb-2`,children:(0,Z.jsx)(Y,{id:`W7XJN4`,values:o,components:s})}),t[5]=o,t[6]=c);let l;t[7]!==r||t[8]!==e?(l=()=>r(e),t[7]=r,t[8]=e,t[9]=l):l=t[9];let u;t[10]===a?u=t[11]:(u=(0,Z.jsx)(Y,{id:`1Ta7Fd`,values:{basename:a}}),t[10]=a,t[11]=u);let d;t[12]!==l||t[13]!==u?(d=(0,Z.jsx)(X,{type:`button`,variant:`outline`,size:`sm`,onClick:l,"data-testid":`create-banner-nested-open`,children:u}),t[12]=l,t[13]=u,t[14]=d):d=t[14];let f;return t[15]!==c||t[16]!==d?(f=(0,Z.jsxs)(`div`,{role:`alert`,className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,"data-testid":`create-banner-nested`,children:[c,d]}),t[15]=c,t[16]=d,t[17]=f):f=t[17],f}if(n.kind===`confirm-git`){let{gitRoot:e}=n,r;if(t[18]!==e){let n;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(n=/\/+$/,t[20]=n):n=t[20],r=e.replace(n,``),t[18]=e,t[19]=r}else r=t[19];let c=`${r}/.git`,l=i.kind===`error`?i.message:null,u;t[21]===e?u=t[22]:(u={gitRoot:e},t[21]=e,t[22]=u);let d;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(d={0:(0,Z.jsx)(`code`,{}),1:(0,Z.jsx)(`code`,{})},t[23]=d):d=t[23];let f;t[24]===u?f=t[25]:(f=(0,Z.jsx)(`p`,{children:(0,Z.jsx)(Y,{id:`FEK4oC`,values:u,components:d})}),t[24]=u,t[25]=f);let p;t[26]!==e||t[27]!==o||t[28]!==s||t[29]!==a||t[30]!==l||t[31]!==i.kind||t[32]!==c?(p=i.kind===`idle`||i.kind===`error`?(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-col gap-1`,children:[(0,Z.jsx)(X,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>a(e),"data-testid":`create-banner-git-remove`,children:(0,Z.jsx)(Y,{id:`YTLmTM`,components:{0:(0,Z.jsx)(`code`,{})}})}),i.kind===`error`?(0,Z.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,"data-testid":`create-banner-git-remove-error`,children:(0,Z.jsx)(Y,{id:`SkMZlS`,values:{targetGitPath:c,removeGitError:l},components:{0:(0,Z.jsx)(`code`,{})}})}):null]}):(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-col gap-2 rounded border border-blue-400/60 bg-white/40 p-2 dark:border-blue-600/60 dark:bg-black/20`,"data-testid":`create-banner-git-remove-confirm`,children:[(0,Z.jsx)(`p`,{className:`text-xs`,children:(0,Z.jsx)(Y,{id:`WZ-vBy`,values:{targetGitPath:c},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-all`})}})}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Z.jsx)(X,{type:`button`,variant:`destructive`,size:`sm`,disabled:i.kind===`pending`,onClick:()=>s(e),"data-testid":`create-banner-git-remove-confirm-button`,children:i.kind===`pending`?(0,Z.jsx)(Y,{id:`0-31GV`}):(0,Z.jsx)(Y,{id:`v-h2hx`,values:{targetGitPath:c}})}),(0,Z.jsx)(X,{type:`button`,variant:`outline`,size:`sm`,disabled:i.kind===`pending`,onClick:o,"data-testid":`create-banner-git-remove-cancel`,children:(0,Z.jsx)(Y,{id:`dEgA5A`})})]})]}),t[26]=e,t[27]=o,t[28]=s,t[29]=a,t[30]=l,t[31]=i.kind,t[32]=c,t[33]=p):p=t[33];let m;return t[34]!==f||t[35]!==p?(m=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`rounded-md border border-blue-300 bg-blue-50 px-3 py-2 text-sm text-blue-900 dark:border-blue-700 dark:bg-blue-950 dark:text-blue-200`,"data-testid":`create-banner-git-confirm`,children:[f,p]}),t[34]=f,t[35]=p,t[36]=m):m=t[36],m}return null}function Cx(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}async function wx(e,t){let n=typeof window<`u`?window.okDesktop:void 0;if(n)try{if((await n.noteWindow.open(e,t)).ok)return;Us.error(ic._({id:`o1veZ6`}))}catch{Us.error(ic._({id:`o1veZ6`}))}}function Tx(e){if(e===null)return`none`;switch(e.kind){case`doc`:case`folder-index`:return`doc`;case`folder`:return`folder`;case`asset`:case`skill-file`:case`large-file`:return`asset`;case`missing`:case`skills`:case`skill-preview`:return`none`}}var Ex={blobRun:{id:`hgf5io`},back:{id:`iH8pgl`},forward:{id:`rxWGWX`},newFile:{id:`HdkSiO`},newFolder:{id:`96G6Re`},openGraph:{id:`3Fcb0I`},openInNewWindow:{id:`E91VZY`},initializeStarterPack:{id:`fWi7pn`},newSkill:{id:`MdpSC1`},newProject:{id:`gKi-a_`},openFolderOnDisk:{id:`WPwDin`},openFileOnDisk:{id:`ka6Eke`},switchProject:{id:`xaDWAI`},openSkills:{id:`PCSkw2`},settings:{id:`Tz0i8g`},installClaudeDesktop:{id:`62Pc08`},reportBug:{id:`cd5EXh`},bugReportHistory:{id:`QHCx0c`},sendFeedback:{id:`RoafuO`},newFromTemplate:{id:`Uuj_R4`},rename:{id:`2wxgft`},duplicate:{id:`euc6Ns`},moveToTrash:{id:`q3TWG7`},revealInFinder:{id:`LtSYdi`},copyFullPath:{id:`Up2_7p`},copyRelativePath:{id:`M6mvVi`},closeTab:{id:`r6ncaO`},newWorktree:{id:`DXd9LM`},switchWorktree:{id:`8Vq20-`},sidebarShow:{id:`151wvk`},sidebarHide:{id:`Q1mtyd`},docPanelShow:{id:`fSRzLo`},docPanelHide:{id:`GSYWCm`},terminalShow:{id:`xi9KGG`},terminalHide:{id:`9xCnv8`},terminalMoveRight:{id:`PrWQiT`},terminalMoveBottom:{id:`Tofsyo`},agentPanelShow:{id:`b4V4nU`},agentPanelHide:{id:`93LBnX`},agentPanelAskSelection:{id:`OlFVNr`},showHiddenFiles:{id:`XcGbim`},showOkFolders:{id:`GHsJb8`},showOnlyMarkdownFiles:{id:`WkTLN7`},showSkillsSection:{id:`WkyP2p`},expandAll:{id:`OlAl5i`},collapseAll:{id:`qvWGzP`},newTerminal:{id:`ZBxvV3`},killTerminal:{id:`5_j-DA`},checkForUpdates:{id:`WMCwmR`},setUpIntegrations:{id:`AhoGwP`},checkSpelling:{id:`ZgJVnp`},openOnGithub:{id:`LeGeTf`}},Dx={win32:{revealInFinder:{id:`qi1F96`},moveToTrash:{id:`o9yN4T`}},linux:{revealInFinder:{id:`e1Rn_k`}}};function Ox(e,t){if(t===`win32`||t===`linux`){let n=Dx[t][e];if(n)return n}return Ex[e]}var kx={"open-blob-run":Ey,"navigate-back":Xl,"navigate-forward":Ql,"new-file":Ur,"new-folder":Ty,"open-graph":Ry,"open-in-new-window":Qy,"initialize-starter-pack":Ff,"new-skill":re,"new-project":Kn,"open-folder":Jd,"open-file":Xr,"switch-project":V,"open-skills":Ff,settings:dr,"install-claude-desktop":Cd,"report-bug":Yt,"bug-report-history":Wc,"send-feedback":gf,"new-from-template":Ur,rename:_n,duplicate:fe,"move-to-trash":Hf,"reveal-in-finder":Jd,"copy-full-path":fe,"copy-relative-path":fe,"close-tab":Gf,"new-worktree":Cl,"switch-worktree":Cl,"toggle-sidebar":d,"toggle-doc-panel":yc,"toggle-terminal":vc,"move-terminal":vc,"toggle-agent-panel":gf,"toggle-show-hidden-files":wd,"toggle-show-ok-folders":Qd,"toggle-show-only-markdown-files":Xr,"toggle-show-skills-section":re,"expand-all-tree":hb,"collapse-all-tree":Cy,"new-terminal":vc,"kill-terminal":vc,"check-for-updates":Bf,"set-up-integrations":ay,"toggle-spell-check":Zy,"open-github":Cx},Ax={"open-blob-run":e=>e.openBlobRun(),"new-file":e=>{e.closePalette(),e.openNewItemDialog(`file`)},"new-folder":e=>{e.closePalette(),e.openNewItemDialog(`folder`)},"open-graph":e=>{e.closePalette(),ke(`graph`)},"open-in-new-window":e=>{e.closePalette(),e.activeDocName&&wx(e.activeDocName,`palette`)},"initialize-starter-pack":e=>{e.closePalette(),e.openSeedDialog()},"new-skill":e=>{e.closePalette(),e.createBlankSkill()},"new-project":e=>{e.closePalette(),e.openCreateProjectDialog()},"open-folder":e=>{let t=e.bridge;t&&e.runAction(async()=>{let e=await t.dialog.openFolder();e&&await t.project.open({path:e,target:`new-window`,entryPoint:`pick-existing`})})},"open-file":e=>{let t=e.bridge;t&&e.runAction(()=>t.project.openFile())},"switch-project":e=>{let t=e.bridge;t&&e.runAction(()=>t.navigator.open(),ic._({id:`jol95m`}))},"open-skills":e=>{e.closePalette(),window.location.hash=tp()},settings:e=>{e.closePalette(),window.location.hash!==`#settings`&&(window.location.hash=nc)},"install-claude-desktop":e=>{e.closePalette(),window.location.hash=`#install-claude-desktop`},"report-bug":e=>{e.closePalette(),e.openReportBugDialog()},"bug-report-history":e=>{e.closePalette(),e.openBugReportHistory()},"send-feedback":e=>{e.closePalette(),e.openFeedbackDialog()},"check-for-updates":e=>e.runAction(async()=>{await e.bridge?.update.checkNow()}),"set-up-integrations":e=>e.runAction(async()=>{await e.bridge?.mcpWiring.reconfigure()}),"toggle-spell-check":e=>e.runAction(async()=>{await e.bridge?.spellcheck.toggle()}),"open-github":e=>e.openExternalUrl(Wo)};function jx(e){return{host:e.bridge===null?`web`:`desktop`,activeTargetKind:e.contextualTargetKind,singleFile:e.singleFile,terminalCapable:e.bridge!==null&&e.bridge.terminal!=null&&e.bridge.config.ptyAvailable===!0,terminalLive:e.viewMenuState.terminalLive===!0,canExpandAll:e.viewMenuState.canExpandAll!==!1,canCollapseAll:e.viewMenuState.canCollapseAll!==!1,hasActiveDoc:e.activeDocName!==null,showInstallSkill:!1}}function Mx(e,t){let n=t.bridge?.platform;if(e.stateToggle){let{overrideKey:r,overrideField:i}=e.stateToggle;if(r!==void 0&&i!==void 0&&t.viewMenuState[i]===!0)return ic._(Ex[r]);let a=t.viewMenuState[e.stateToggle.stateField]===!0?e.stateToggle.hideKey:e.stateToggle.showKey;return ic._(Ox(a,n))}if(e.placementToggle){let r=t.viewMenuState.terminalPlacement===`right`?e.placementToggle.rightKey:e.placementToggle.bottomKey;return ic._(Ox(r,n))}return ic._(Ox(e.labelKey,n))}function Nx(e){let t=e.menuActionId;return e=>e.emitMenuAction(t)}function Px(e){let t=e.palette;if(!t)throw Error(`command ${e.id} has no palette presence`);let n=kx[e.id];if(!n)throw Error(`command ${e.id} has no palette icon`);let r=e.checkField;return{id:e.id,menuActionId:e.menuActionId,label:t=>Mx(e,t),keywords:e.keywords,icon:n,group:t.group,visibility:t.visibility,shortcutId:e.shortcutId,shortcutDesktopOnly:e.shortcutDesktopOnly,checked:r?e=>e.viewMenuState[r]===!0:void 0,available:t=>Uo(e.availability,jx(t)),dispatch:Ax[e.id]??Nx(e)}}var Fx=Po.flatMap(e=>e.palette?[Px(e)]:[]),Ix=`ok-omnibar-recents-v1`,Lx=10;function Rx(e){return typeof e==`object`&&!!e&&(e.kind===`file`||e.kind===`folder`)&&typeof e.path==`string`&&typeof e.lastOpenedAt==`string`}function zx(e){if(e)return e;if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function Bx(e,t){return`${e}:${t}`}function Vx(e){let t=zx(e);if(!t)return[];try{let e=t.getItem(Ix);if(!e)return[];let n=JSON.parse(e);return Array.isArray(n)?n.filter(Rx).slice(0,Lx):[]}catch{return[]}}function Hx(e,t){let n=zx(t);if(n)try{n.setItem(Ix,JSON.stringify(e.slice(0,Lx)))}catch(e){console.warn(`[omnibar] Failed to save recent entries:`,e)}}function Ux(e,t){return[t,...e.filter(e=>e.kind!==t.kind||e.path!==t.path)].slice(0,Lx)}function Wx(e,t){return e.filter(e=>t.has(Bx(e.kind,e.path)))}var Gx=50,Kx=50,qx=``,Jx=null;function Yx(e){return e.trim().toLowerCase()}function Xx(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Zx(e){let t=e.trim();return t?[...new Set(t.split(/\s+/).filter(Boolean))].sort((e,t)=>t.length-e.length):[]}function Qx(e,t,n=new Map,r=new Map,i=new Set){let a=[],o=new Set;for(let t of e){o.add(t);let e=r.get(t),i=e?.modified,s=n.get(t);a.push({kind:`file`,path:t,name:No(t),...s&&{title:s},...e?.docExt&&{docExt:e.docExt},...i&&{modifiedTs:Date.parse(i)}})}for(let e of i)o.has(e)||(o.add(e),a.push({kind:`file`,path:e,name:No(e),bodyIndexed:!1}));for(let e of t)a.push({kind:`folder`,path:e,name:No(e)});return a.sort((e,t)=>{let n=e.path.localeCompare(t.path);return n===0?e.kind===t.kind?0:e.kind===`folder`?-1:1:n}),a}function $x(e){return us({kind:e.kind===`folder`?`folder`:e.bodyIndexed===!1?`file`:`page`,path:e.path,title:e.title??e.name,modifiedTs:e.modifiedTs??0})}function eS(e){return{entries:e,byId:new Map(e.map(e=>[`${e.kind===`folder`?`folder`:e.bodyIndexed===!1?`file`:`page`}:${e.path}`,e])),corpus:Es(e.map($x))}}function tS(e){return e.map(e=>`${e.kind}\u0000${e.path}\u0000${e.title??``}\u0000${e.docExt??``}\u0000${e.modifiedTs??0} ${e.bodyIndexed===!1?`0`:`1`}`).join(``)}function nS(e){let t=tS(e);return Jx&&qx===t?Jx:(qx=t,Jx=eS(e),Jx)}function rS(e,t,n=Gx){return iS(nS(e),t,n)}function iS(e,t,n=Gx){let r=Yx(t);return r?Ia(e.corpus,r,{intent:`omnibar`,limit:n,scopes:[`page`,`folder`,`file`]}).map(t=>e.byId.get(t.document.id)).filter(e=>e!==void 0):e.entries.slice(0,20)}function aS(e,t){let n=Zx(t);if(n.length===0||e.length===0)return[{text:e,match:!1,start:0}];let r=RegExp(`(${n.map(Xx).join(`|`)})`,`gi`),i=[],a=0;for(let t of e.matchAll(r)){let n=t.index??0;n>a&&i.push({text:e.slice(a,n),match:!1,start:a}),i.push({text:t[0],match:!0,start:n}),a=n+t[0].length}return a<e.length&&i.push({text:e.slice(a),match:!1,start:a}),i.length>0?i:[{text:e,match:!1,start:0}]}function oS(e){if(e.kind!==`page`&&e.kind!==`folder`&&e.kind!==`file`||typeof e.path!=`string`)return null;let t=No(e.path);return{kind:e.kind===`folder`?`folder`:`file`,path:e.path,name:t,...e.kind===`file`&&{bodyIndexed:!1},...e.title&&{title:e.title},...e.snippet&&{snippet:e.snippet},...typeof e.score==`number`&&{score:e.score}}}async function sS(e,t={}){let n=e.trim();if(!n)return{entries:[],truncated:!1,ready:!0};let r=await fetch(`/api/search`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({query:n,intent:`full_text`,ranking:t.semantic?`relevance`:`navigation`,scopes:[`page`,`folder`,`content`,`file`],limit:t.limit??Kx,source:`omnibar`,...t.semantic?{semantic:!0}:{}}),signal:t.signal});if(!r.ok){let e=await r.json().catch(()=>null);throw Error(qc(e)??`Search failed with status ${r.status}`)}let i=await r.json();return{entries:(i.results??[]).map(oS).filter(e=>!!e),truncated:i.truncated===!0,ready:i.ready!==!1}}function cS(e,t,n=[]){let r=Yx(t);return r?Yx([e,...n].join(` `)).includes(r):!0}function lS(e,t,n={}){if(e.trim()===``)return`idle`;if(t.length===0)return`empty`;if(n.truncated)return`truncated`;for(let e of t)if(`snippet`in e&&typeof e.snippet==`string`&&e.snippet.length>0)return`content`;return`name-only`}function uS(e){let{query:t,firedQuery:n,status:r,resultCount:i}=e,a=i>0,o=t!==``&&t!==n,s=a&&(r===`loading`||t!==n),c=null;r===`error`&&t!==``?c={kind:`retry`,query:t}:o&&r!==`loading`&&(c={kind:`search`,query:t});let l=null;return r===`loading`?l=`searching`:t===``&&!a?l=`empty`:r===`success`&&!o&&!a&&(l=`no-results`),{submit:c,results:{show:a,dimmed:s,forQuery:a?n:null},notice:l}}var dS=`tag:`;function fS(e,t){if(!e.toLowerCase().startsWith(`tag:`))return{kind:`normal`,query:e};let n=e.slice(4).replace(/^\s+/,``).trim();return n&&t.has(n)?{kind:`tag-docs`,tagName:n}:{kind:`tag-list`,query:n}}function pS(e,t){return St(e,t)}var mS=Jt;async function hS(e){let t=await fetch(`/api/tags/${encodeURIComponent(e)}`);if(!t.ok)throw Error(`/api/tags/${e} responded with ${t.status}`);let n=await t.json();return Array.isArray(n.docs)?n.docs:[]}var gS=(0,Q.lazy)(()=>n(()=>import(`./FeedbackForm-BtLPXHiG.js`).then(e=>({default:e.FeedbackForm})),[],import.meta.url)),_S=e=>{let t=(0,$.c)(11),{open:n,onOpenChange:r,source:i,onSuccess:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(zp,{children:(0,Z.jsx)(Pp,{children:(0,Z.jsx)(Y,{id:`SItQRc`})})}),t[0]=o):o=t[0];let s;t[1]!==r||t[2]!==a?(s=()=>{r(!1),a?.()},t[1]=r,t[2]=a,t[3]=s):s=t[3];let c;t[4]!==i||t[5]!==s?(c=(0,Z.jsxs)(Fp,{children:[o,(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(gS,{source:i,onSuccess:s})})]}),t[4]=i,t[5]=s,t[6]=c):c=t[6];let l;return t[7]!==r||t[8]!==n||t[9]!==c?(l=(0,Z.jsx)(Bp,{open:n,onOpenChange:r,children:c}),t[7]=r,t[8]=n,t[9]=c,t[10]=l):l=t[10],l};async function vS(e){let t={path:e.path};e.template!==void 0&&(t.template=e.template);try{let n=await fetch(`/api/create-page`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)}),r=n.status,i=await yn(n,ic._({id:`d2uTPx`,values:{status:r}}));if(!i.ok)return{ok:!1,error:i.title};let a=Ms.safeParse(i.body);return a.success?{ok:!0,docName:a.data.docName}:{ok:!1,error:e.kind===`folder`?ic._({id:`K1ckLX`}):ic._({id:`fJgQHX`})}}catch(e){return console.warn(`[create-page-request] create failed:`,e),{ok:!1,error:ic._({id:`HIb0vl`})}}}function yS(e,t){window.location.hash=`#/${e}`,t(e),uc([`files`,`backlinks`,`graph`])}function bS(e,t){let n=e?`${e}/`:``;for(let e=1;;e++){let r=`${n}untitled${e===1?``:`-${e}`}`;if(!t.has(r))return r}}var xS=[`.md`,`.mdx`];function SS(e){let t=e.toLowerCase();for(let e of xS)if(t.endsWith(e))return e;return null}var CS={local:0,inherited:1};function wS(e){return[...e].sort((e,t)=>{let n=CS[e.scope]-CS[t.scope];if(n!==0)return n;let r=(e.title??e.name).toLowerCase(),i=(t.title??t.name).toLowerCase();return r.localeCompare(i)})}var TS=`__blank__`;function ES(e){return e.trim()?e.includes(`..`)?`dotdot`:e.startsWith(`/`)?`leading-slash`:e.includes(`\\`)?`backslash`:e.includes(`\0`)?`null-byte`:null:`empty`}function DS(e){switch(e){case`empty`:return{id:`hYDc6B`};case`dotdot`:return{id:`Wyxs0x`};case`leading-slash`:return{id:`OYnx7O`};case`backslash`:return{id:`qo4zCg`};case`null-byte`:return{id:`saYiIO`}}}function OS(e){let t=e.fileName.trim(),n=SS(t)?t:`${t}${e.fileExtension??`.md`}`;if(e.kind===`folder`){let t=(e.folderName??``).trim();return`${e.initialDir?`${e.initialDir}/${t}`:t}/${n}`}return e.initialDir?`${e.initialDir}/${n}`:n}function kS(e,t){return Gs(e.target)?!1:rc(e,`new-item`,t)}function AS(e){let t=e.value.lastIndexOf(`.`);t>0?e.setSelectionRange(0,t):e.select()}function jS(e){let t=(0,$.c)(136),{open:n,onOpenChange:r,kind:i,initialDir:a,suggestedName:o,initialTemplate:s,defaultToTemplate:c,description:l,onCreated:u,folderConfig:d}=e,{_:f}=xn(),{addPage:p}=Lu(),m=ed(d?null:a),h=d??m,[g,_]=(0,Q.useState)(``),[v,y]=(0,Q.useState)(``),[b,x]=(0,Q.useState)(TS),[S,C]=(0,Q.useState)(!1),[w,T]=(0,Q.useState)(null),[E,D]=(0,Q.useState)(!1),[O,k]=(0,Q.useState)(null),A=(0,Q.useId)(),j=(0,Q.useId)(),M=(0,Q.useId)(),N=(0,Q.useId)(),P=(0,Q.useId)(),[F,I]=(0,Q.useState)(!1),L=(0,Q.useRef)(null),R=(0,Q.useRef)(null),z,B;t[0]!==s||t[1]!==i||t[2]!==n||t[3]!==o?(z=()=>{n&&(T(null),k(null),D(!1),y(``),x(i===`file`&&s?s:TS),C(!1),I(!1),_(i===`file`?o??`untitled`:`index`))},B=[n,i,o,s],t[0]=s,t[1]=i,t[2]=n,t[3]=o,t[4]=z,t[5]=B):(z=t[4],B=t[5]),(0,Q.useEffect)(z,B);let V;t[6]!==h.state.data||t[7]!==h.state.status?(V=h.state.status===`ready`?wS(h.state.data.folder.templates_available??[]):[],t[6]=h.state.data,t[7]=h.state.status,t[8]=V):V=t[8];let H=V,U;t[9]!==h.state.data||t[10]!==h.state.status||t[11]!==n||t[12]!==b?(U=()=>{n&&b!==TS&&h.state.status===`ready`&&((h.state.data.folder.templates_available??[]).some(e=>e.name===b)||x(TS))},t[9]=h.state.data,t[10]=h.state.status,t[11]=n,t[12]=b,t[13]=U):U=t[13];let ee;t[14]!==h.state||t[15]!==n||t[16]!==b?(ee=[n,b,h.state],t[14]=h.state,t[15]=n,t[16]=b,t[17]=ee):ee=t[17],(0,Q.useEffect)(U,ee);let W;t[18]!==c||t[19]!==h.state.data||t[20]!==h.state.status||t[21]!==s||t[22]!==n||t[23]!==S?(W=()=>{if(!n||!c||s||S||h.state.status!==`ready`)return;let e=wS(h.state.data.folder.templates_available??[]);e.length>0&&x(e[0].name)},t[18]=c,t[19]=h.state.data,t[20]=h.state.status,t[21]=s,t[22]=n,t[23]=S,t[24]=W):W=t[24];let te;t[25]!==c||t[26]!==h.state||t[27]!==s||t[28]!==n||t[29]!==S?(te=[n,c,s,S,h.state],t[25]=c,t[26]=h.state,t[27]=s,t[28]=n,t[29]=S,t[30]=te):te=t[30],(0,Q.useEffect)(W,te);let G=h.state.status===`loading`||h.state.status===`idle`,K=h.state.status===`error`?h.state.message:null,q=i===`file`&&(H.length>0||!!K),ne;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(ne=function(e){_(e),T(null)},t[31]=ne):ne=t[31];let re=ne,J;t[32]!==g||t[33]!==v||t[34]!==a||t[35]!==i?(J=function(){return OS({kind:i,initialDir:a,fileName:g,folderName:v})},t[32]=g,t[33]=v,t[34]=a,t[35]=i,t[36]=J):J=t[36];let ie=J,ae;t[37]!==f||t[38]!==g||t[39]!==v||t[40]!==i?(ae=function(){if(i===`folder`){let e=ES(v.trim());if(e)return{message:f({id:`ODGGlj`,values:{detail:f(DS(e))}}),field:`folder`}}let e=ES(g.trim());return e?{message:f(DS(e)),field:`file`}:null},t[37]=f,t[38]=g,t[39]=v,t[40]=i,t[41]=ae):ae=t[41];let oe=ae,se;t[42]!==E||t[43]!==g||t[44]!==v||t[45]!==i||t[46]!==G?(se=E||!g.trim()||i===`folder`&&!v.trim()||i===`file`&&G,t[42]=E,t[43]=g,t[44]=v,t[45]=i,t[46]=G,t[47]=se):se=t[47];let ce=se,le;t[48]!==p||t[49]!==ie||t[50]!==oe||t[51]!==i||t[52]!==u||t[53]!==r||t[54]!==b?(le=async function(){let e=oe();if(e){T(e.message),k(e.field);return}D(!0),T(null),k(null);let t=await vS({path:ie(),template:i===`file`&&b!==TS?b:void 0,kind:i});if(D(!1),!t.ok){T(t.error),k(`form`);return}r(!1),yS(t.docName,p),u?.(t.docName)},t[48]=p,t[49]=ie,t[50]=oe,t[51]=i,t[52]=u,t[53]=r,t[54]=b,t[55]=le):le=t[55];let ue=le,de;t[56]!==f||t[57]!==a?(de=a||f({id:`L6Hhh6`}),t[56]=f,t[57]=a,t[58]=de):de=t[58];let fe=de,pe;t[59]===i?pe=t[60]:(pe=(0,Z.jsx)(Pp,{children:i===`file`?(0,Z.jsx)(Y,{id:`HdkSiO`}):(0,Z.jsx)(Y,{id:`96G6Re`})}),t[59]=i,t[60]=pe);let me;t[61]!==l||t[62]!==fe?(me=l??(0,Z.jsx)(Y,{id:`NvOvTi`,values:{dirDisplay:fe},components:{0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})}}),t[61]=l,t[62]=fe,t[63]=me):me=t[63];let he;t[64]===me?he=t[65]:(he=(0,Z.jsx)(Np,{children:me}),t[64]=me,t[65]=he);let ge;t[66]!==pe||t[67]!==he?(ge=(0,Z.jsxs)(zp,{children:[pe,he]}),t[66]=pe,t[67]=he,t[68]=ge):ge=t[68];let _e;t[69]!==b||t[70]!==q||t[71]!==N||t[72]!==F||t[73]!==P||t[74]!==H||t[75]!==K||t[76]!==G?(_e=q&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`span`,{id:N,className:`text-sm font-medium`,children:(0,Z.jsx)(Y,{id:`f65AOQ`})}),K?(0,Z.jsx)(`p`,{role:`alert`,className:`text-1sm text-destructive`,children:(0,Z.jsx)(Y,{id:`sE7R19`,values:{templatesError:K}})}):null,(0,Z.jsx)(NS,{triggerId:P,labelledById:N,open:F,onOpenChange:I,value:b,onValueChange:e=>{x(e),C(!0)},templates:H,loading:G})]}),t[69]=b,t[70]=q,t[71]=N,t[72]=F,t[73]=P,t[74]=H,t[75]=K,t[76]=G,t[77]=_e):_e=t[77];let ve;t[78]!==f||t[79]!==w||t[80]!==O||t[81]!==A||t[82]!==j||t[83]!==v||t[84]!==i?(ve=i===`folder`&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`label`,{className:`text-sm font-medium`,htmlFor:j,children:(0,Z.jsx)(Y,{id:`cqQyPB`})}),(0,Z.jsx)(Op,{ref:R,id:j,value:v,onChange:e=>{y(e.target.value),T(null)},placeholder:`folder-name`,autoFocus:!0,"aria-describedby":w&&(O===`folder`||O===`form`)?A:void 0,"aria-invalid":w&&(O===`folder`||O===`form`)?!0:void 0,onKeyDown:e=>{if(e.key===`Enter`){e.preventDefault();let t=ES(v.trim());if(t){T(f({id:`ODGGlj`,values:{detail:f(DS(t))}})),k(`folder`);return}L.current?.focus()}}})]}),t[78]=f,t[79]=w,t[80]=O,t[81]=A,t[82]=j,t[83]=v,t[84]=i,t[85]=ve):ve=t[85];let ye;t[86]===i?ye=t[87]:(ye=i===`folder`?(0,Z.jsx)(Y,{id:`jjtmV_`}):(0,Z.jsx)(Y,{id:`s-XOaI`}),t[86]=i,t[87]=ye);let be;t[88]!==M||t[89]!==ye?(be=(0,Z.jsx)(`label`,{className:`text-sm font-medium`,htmlFor:M,children:ye}),t[88]=M,t[89]=ye,t[90]=be):be=t[90];let xe;t[91]===Symbol.for(`react.memo_cache_sentinel`)?(xe=e=>re(e.target.value),t[91]=xe):xe=t[91];let Se=i===`file`,Ce=w&&(O===`file`||O===`form`)?A:void 0,we=w&&(O===`file`||O===`form`)?!0:void 0,Te;t[92]!==ue||t[93]!==ce?(Te=e=>{e.key===`Enter`&&!ce&&ue()},t[92]=ue,t[93]=ce,t[94]=Te):Te=t[94];let Ee;t[95]!==M||t[96]!==g||t[97]!==Se||t[98]!==Ce||t[99]!==we||t[100]!==Te?(Ee=(0,Z.jsx)(Op,{ref:L,id:M,value:g,onChange:xe,placeholder:`my-note`,autoFocus:Se,"aria-describedby":Ce,"aria-invalid":we,onFocus:MS,onKeyDown:Te}),t[95]=M,t[96]=g,t[97]=Se,t[98]=Ce,t[99]=we,t[100]=Te,t[101]=Ee):Ee=t[101];let De;t[102]!==w||t[103]!==A?(De=w&&(0,Z.jsx)(`p`,{id:A,role:`alert`,className:`text-1sm text-destructive`,children:w}),t[102]=w,t[103]=A,t[104]=De):De=t[104];let Oe;t[105]!==be||t[106]!==Ee||t[107]!==De?(Oe=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[be,Ee,De]}),t[105]=be,t[106]=Ee,t[107]=De,t[108]=Oe):Oe=t[108];let ke;t[109]!==_e||t[110]!==ve||t[111]!==Oe?(ke=(0,Z.jsxs)(Ip,{className:`space-y-6 pb-1`,children:[_e,ve,Oe]}),t[109]=_e,t[110]=ve,t[111]=Oe,t[112]=ke):ke=t[112];let Ae;t[113]===r?Ae=t[114]:(Ae=()=>r(!1),t[113]=r,t[114]=Ae);let je;t[115]===Symbol.for(`react.memo_cache_sentinel`)?(je=(0,Z.jsx)(Y,{id:`dEgA5A`}),t[115]=je):je=t[115];let Me;t[116]!==E||t[117]!==Ae?(Me=(0,Z.jsx)(X,{variant:`outline`,className:`font-mono uppercase`,onClick:Ae,disabled:E,children:je}),t[116]=E,t[117]=Ae,t[118]=Me):Me=t[118];let Ne;t[119]===E?Ne=t[120]:(Ne=E?(0,Z.jsx)(Y,{id:`E9bKSA`}):(0,Z.jsx)(Y,{id:`hYgDIe`}),t[119]=E,t[120]=Ne);let Pe;t[121]!==ue||t[122]!==ce||t[123]!==Ne?(Pe=(0,Z.jsx)(X,{onClick:ue,disabled:ce,children:Ne}),t[121]=ue,t[122]=ce,t[123]=Ne,t[124]=Pe):Pe=t[124];let Fe;t[125]!==Me||t[126]!==Pe?(Fe=(0,Z.jsxs)(Lp,{children:[Me,Pe]}),t[125]=Me,t[126]=Pe,t[127]=Fe):Fe=t[127];let Ie;t[128]!==ge||t[129]!==ke||t[130]!==Fe?(Ie=(0,Z.jsxs)(Fp,{className:`sm:max-w-md`,"data-ok-layer-spawned":``,children:[ge,ke,Fe]}),t[128]=ge,t[129]=ke,t[130]=Fe,t[131]=Ie):Ie=t[131];let Le;return t[132]!==r||t[133]!==n||t[134]!==Ie?(Le=(0,Z.jsx)(Bp,{open:n,onOpenChange:r,children:Ie}),t[132]=r,t[133]=n,t[134]=Ie,t[135]=Le):Le=t[135],Le}function MS(e){return AS(e.currentTarget)}function NS(e){let t=(0,$.c)(66),{triggerId:n,labelledById:r,open:i,onOpenChange:a,value:o,onValueChange:s,templates:c,loading:l}=e,{_:u}=xn(),d=(0,Q.useId)(),f;if(t[0]!==c||t[1]!==o){let e;t[3]===o?e=t[4]:(e=e=>e.name===o,t[3]=o,t[4]=e),f=c.find(e),t[0]=c,t[1]=o,t[2]=f}else f=t[2];let p=f,m=o===TS,h=i?d:void 0,g=`${r} ${n}`,_;t[5]!==m||t[6]!==l||t[7]!==p?.name||t[8]!==p?.title||t[9]!==o?(_=l?(0,Z.jsx)(Y,{id:`Hl89Qd`}):m?(0,Z.jsx)(Y,{id:`E7BhZn`}):p?.title??p?.name??o,t[5]=m,t[6]=l,t[7]=p?.name,t[8]=p?.title,t[9]=o,t[10]=_):_=t[10];let v;t[11]===_?v=t[12]:(v=(0,Z.jsx)(`span`,{className:`truncate`,children:_}),t[11]=_,t[12]=v);let y;t[13]!==m||t[14]!==l||t[15]!==p?(y=!l&&!m&&p?(0,Z.jsx)(LS,{entry:p}):null,t[13]=m,t[14]=l,t[15]=p,t[16]=y):y=t[16];let b;t[17]!==v||t[18]!==y?(b=(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[v,y]}),t[17]=v,t[18]=y,t[19]=b):b=t[19];let x;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(Nu,{className:`ml-2 size-4 shrink-0 opacity-50`,"aria-hidden":`true`}),t[20]=x):x=t[20];let S;t[21]!==l||t[22]!==i||t[23]!==h||t[24]!==g||t[25]!==b||t[26]!==n?(S=(0,Z.jsx)(Tm,{asChild:!0,children:(0,Z.jsxs)(X,{id:n,type:`button`,variant:`outline`,role:`combobox`,"aria-expanded":i,"aria-haspopup":`listbox`,"aria-controls":h,"aria-labelledby":g,disabled:l,className:`w-full justify-between font-normal`,children:[b,x]})}),t[21]=l,t[22]=i,t[23]=h,t[24]=g,t[25]=b,t[26]=n,t[27]=S):S=t[27];let C;t[28]===u?C=t[29]:(C=u({id:`UQAp48`}),t[28]=u,t[29]=C);let w;t[30]===C?w=t[31]:(w=(0,Z.jsx)(k,{placeholder:C}),t[30]=C,t[31]=w);let T;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(De,{children:(0,Z.jsx)(Y,{id:`c8iK2Y`})}),t[32]=T):T=t[32];let E;if(t[33]!==a||t[34]!==s||t[35]!==c||t[36]!==o){let e;t[38]!==a||t[39]!==s||t[40]!==o?(e=e=>{let t=e.title??e.name,n=e.title&&e.title!==e.name?e.name:void 0,r=`${e.scope}:${e.source_folder}:${e.name}`;return(0,Z.jsxs)(H,{value:r,keywords:[t,e.name,e.description??``,e.scope,e.source_folder??``],onSelect:()=>{s(e.name),a(!1)},className:`items-start gap-3`,children:[(0,Z.jsx)(Yl,{className:Qn(`mt-1 size-4 shrink-0`,o===e.name?`opacity-100`:`opacity-0`),"aria-hidden":`true`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`truncate text-sm font-medium`,children:t}),n?(0,Z.jsx)(`code`,{className:`font-mono text-2xs text-muted-foreground shrink-0`,children:n}):null,(0,Z.jsx)(LS,{entry:e,className:`ml-auto`})]}),e.description?(0,Z.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-xs text-muted-foreground`,children:e.description}):null]})]},r)},t[38]=a,t[39]=s,t[40]=o,t[41]=e):e=t[41],E=c.map(e),t[33]=a,t[34]=s,t[35]=c,t[36]=o,t[37]=E}else E=t[37];let D;t[42]!==a||t[43]!==s?(D=()=>{s(TS),a(!1)},t[42]=a,t[43]=s,t[44]=D):D=t[44];let O=o===TS?`opacity-100`:`opacity-0`,A;t[45]===O?A=t[46]:(A=Qn(`mt-1 size-4 shrink-0`,O),t[45]=O,t[46]=A);let j;t[47]===A?j=t[48]:(j=(0,Z.jsx)(Yl,{className:A,"aria-hidden":`true`}),t[47]=A,t[48]=j);let M;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Z.jsx)(`span`,{className:`text-sm font-medium`,children:(0,Z.jsx)(Y,{id:`E7BhZn`})}),t[49]=M):M=t[49];let N;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[M,(0,Z.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-xs text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`hZoBHK`})})]}),t[50]=N):N=t[50];let P;t[51]!==D||t[52]!==j?(P=(0,Z.jsxs)(H,{value:`Blank note empty`,onSelect:D,className:`items-start gap-3`,children:[j,N]}),t[51]=D,t[52]=j,t[53]=P):P=t[53];let F;t[54]!==d||t[55]!==E||t[56]!==P?(F=(0,Z.jsxs)(Kt,{id:d,className:`subtle-scrollbar`,children:[T,E,P]}),t[54]=d,t[55]=E,t[56]=P,t[57]=F):F=t[57];let I;t[58]!==w||t[59]!==F?(I=(0,Z.jsx)(Dm,{className:`w-[var(--radix-popover-trigger-width)] p-0`,align:`start`,onOpenAutoFocus:IS,onWheel:FS,onTouchMove:PS,children:(0,Z.jsxs)(Ae,{children:[w,F]})}),t[58]=w,t[59]=F,t[60]=I):I=t[60];let L;return t[61]!==a||t[62]!==i||t[63]!==I||t[64]!==S?(L=(0,Z.jsxs)(Om,{open:i,onOpenChange:a,children:[S,I]}),t[61]=a,t[62]=i,t[63]=I,t[64]=S,t[65]=L):L=t[65],L}function PS(e){e.stopPropagation()}function FS(e){e.stopPropagation()}function IS(e){e.preventDefault(),e.currentTarget.querySelector(`[cmdk-input]`)?.focus()}function LS(e){let t=(0,$.c)(7),{entry:n,className:r}=e;if(n.scope===`inherited`){let e;t[0]===r?e=t[1]:(e=Qn(`shrink-0 text-2xs`,r),t[0]=r,t[1]=e);let i;t[2]===n.source_folder?i=t[3]:(i=n.source_folder||(0,Z.jsx)(Y,{id:`ZNK2Tq`}),t[2]=n.source_folder,t[3]=i);let a;return t[4]!==e||t[5]!==i?(a=(0,Z.jsx)(wm,{variant:`gray`,className:e,children:i}),t[4]=e,t[5]=i,t[6]=a):a=t[6],a}return null}var RS=`knowledge-base`;function zS(e){let t=(0,$.c)(69),{open:n,onOpenChange:r,onSeedApplied:i,initialPackId:a}=e,{_:o}=xn(),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s={kind:`loading`},t[0]=s):s=t[0];let[c,l]=(0,Q.useState)(s),[u,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)(a??RS),[m,h]=(0,Q.useState)(`project-root`),[g,_]=(0,Q.useState)(``),[v,y]=(0,Q.useState)(a===void 0?`pick`:`configure`),b=(0,Q.useRef)(!0),x=u?.find(e=>e.id===f),S,C;t[1]!==n||t[2]!==u?(S=()=>{if(!n||u!==null)return;let e=!1;return(async()=>{try{let t=await Wb().listPacks();if(e)return;t.ok?d(t.packs):(d([]),l({kind:`error`,message:t.error.message}))}catch(t){let n=t;if(e)return;d([]),l({kind:`error`,message:n instanceof Error?n.message:String(n)})}})(),()=>{e=!0}},C=[n,u],t[1]=n,t[2]=u,t[3]=S,t[4]=C):(S=t[3],C=t[4]),(0,Q.useEffect)(S,C);let w,T;t[5]!==a||t[6]!==n?(w=()=>{n&&(p(a??RS),h(`project-root`),_(``),y(a===void 0?`pick`:`configure`),l({kind:`loading`}),b.current=!0)},T=[n,a],t[5]=a,t[6]=n,t[7]=w,t[8]=T):(w=t[7],T=t[8]),(0,Q.useEffect)(w,T),(0,Q.useEffect)(()=>{x&&_(x.defaultSubfolder??``)},[x]);let E;t[9]===g?E=t[10]:(E=g.trim(),t[9]=g,t[10]=E);let D=E,O=m===`subfolder`&&D===``,k,A;t[11]!==o||t[12]!==n||t[13]!==u||t[14]!==m||t[15]!==f||t[16]!==v||t[17]!==O||t[18]!==D?(k=()=>{if(!n||v!==`configure`||u===null)return;if(O){l({kind:`error`,message:o({id:`Z8KDox`})});return}let e=m===`project-root`?void 0:D,t=b.current?0:200;b.current=!1;let r=!1,i=setTimeout(()=>{r||(l(VS),Wb().plan({rootDir:e,packId:f}).then(e=>{if(!r){if(!e.ok){l({kind:`error`,message:e.error.message});return}l(Io(e.plan)?{kind:`plan`,plan:e.plan}:{kind:`already-seeded`,plan:e.plan})}}).catch(e=>{r||l({kind:`error`,message:e instanceof Error?e.message:String(e)})}))},t);return()=>{r=!0,clearTimeout(i)}},A=[n,v,u,f,m,D,O,o],t[11]=o,t[12]=n,t[13]=u,t[14]=m,t[15]=f,t[16]=v,t[17]=O,t[18]=D,t[19]=k,t[20]=A):(k=t[19],A=t[20]),(0,Q.useEffect)(k,A);let j=async function(){if(c.kind!==`plan`)return;let e=c.plan;l({kind:`applying`,plan:e});let t;try{t=await Wb().apply(e,{packId:f})}catch(t){let n=t,r=n instanceof Error?n.message:String(n);Us.error(o({id:`iqugog`,values:{errorDetail:r}})),l({kind:`plan`,plan:e});return}if(t.ok){let n=x?.name??o({id:`W8vpBM`}),a=t.result.applied,s=e.packSkills?.some(BS)===!0,c=o(a>0?{id:`x3-2ta`,values:{packName:n,projectEntries:a}}:s?{id:`B2Srgd`,values:{packName:n}}:{id:`K6jjWB`,values:{packName:n}});Us.success(c);for(let e of t.result.packSkillConflicts??[]){let t=e.name,n=e.hosts?.join(`, `);Us.warning(o(n===void 0||n===``?{id:`GifIjR`,values:{conflictName:t}}:{id:`Mv2lM4`,values:{conflictName:t,conflictHosts:n}}))}i?.(),r(!1)}else{let n=t.error.message;Us.error(o({id:`iqugog`,values:{errorDetail:n}})),l({kind:`plan`,plan:e})}},M=a!==void 0,N=x?.name,P=o(v===`configure`&&x?{id:`hxEUVJ`,values:{selectedPackName:N}}:{id:`RGkNeJ`}),F=x?ex[x.id]:void 0,I;t[21]!==o||t[22]!==F||t[23]!==x||t[24]!==v?(I=v===`configure`&&x?F?o(F):x.description:o({id:`msqUNq`}),t[21]=o,t[22]=F,t[23]=x,t[24]=v,t[25]=I):I=t[25];let L=I,R;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(R=function(e){p(e),y(`configure`),b.current=!0},t[26]=R):R=t[26];let z=R,B;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(B=function(){y(`pick`),l({kind:`loading`}),b.current=!0},t[27]=B):B=t[27];let V=B,H;t[28]===P?H=t[29]:(H=(0,Z.jsx)(Pp,{children:P}),t[28]=P,t[29]=H);let U;t[30]===L?U=t[31]:(U=(0,Z.jsx)(Np,{children:L}),t[30]=L,t[31]=U);let ee;t[32]!==H||t[33]!==U?(ee=(0,Z.jsxs)(zp,{children:[H,U]}),t[32]=H,t[33]=U,t[34]=ee):ee=t[34];let W;t[35]!==u||t[36]!==c||t[37]!==m||t[38]!==x||t[39]!==v||t[40]!==g?(W=v===`pick`?(0,Z.jsx)(Ip,{children:(0,Z.jsx)(qb,{packs:u,onPackSelect:z})}):(0,Z.jsxs)(Ip,{className:`space-y-6`,children:[(0,Z.jsx)($b,{choice:m,subfolder:g,placeholder:x?.defaultSubfolder??`subfolder`,onChoiceChange:h,onSubfolderChange:_}),(0,Z.jsx)(HS,{phase:c,selectedPack:x})]}),t[35]=u,t[36]=c,t[37]=m,t[38]=x,t[39]=v,t[40]=g,t[41]=W):W=t[41];let te;t[42]!==M||t[43]!==v?(te=v===`configure`&&!M?(0,Z.jsxs)(X,{className:`me-auto uppercase font-mono`,variant:`ghost`,onClick:V,children:[(0,Z.jsx)(Al,{"aria-hidden":`true`,className:`h-4 w-4`}),(0,Z.jsx)(Y,{id:`iH8pgl`})]}):null,t[42]=M,t[43]=v,t[44]=te):te=t[44];let G;t[45]===r?G=t[46]:(G=()=>r(!1),t[45]=r,t[46]=G);let K;t[47]===c.kind?K=t[48]:(K=c.kind===`already-seeded`||c.kind===`error`?(0,Z.jsx)(Y,{id:`yz7wBu`}):(0,Z.jsx)(Y,{id:`dEgA5A`}),t[47]=c.kind,t[48]=K);let q;t[49]!==G||t[50]!==K?(q=(0,Z.jsx)(X,{className:`uppercase font-mono`,variant:`outline`,onClick:G,children:K}),t[49]=G,t[50]=K,t[51]=q):q=t[51];let ne;t[52]!==j||t[53]!==c.kind||t[54]!==v||t[55]!==O?(ne=v===`configure`&&c.kind===`plan`?(0,Z.jsx)(X,{onClick:j,disabled:O,children:(0,Z.jsx)(Y,{id:`4TzU0n`})}):v===`configure`&&c.kind===`applying`?(0,Z.jsxs)(X,{disabled:!0,children:[(0,Z.jsx)(cf,{"aria-hidden":`true`,className:`h-4 w-4`}),(0,Z.jsx)(Y,{id:`XYlJJT`})]}):null,t[52]=j,t[53]=c.kind,t[54]=v,t[55]=O,t[56]=ne):ne=t[56];let re;t[57]!==te||t[58]!==q||t[59]!==ne?(re=(0,Z.jsxs)(Lp,{children:[te,q,ne]}),t[57]=te,t[58]=q,t[59]=ne,t[60]=re):re=t[60];let J;t[61]!==ee||t[62]!==W||t[63]!==re?(J=(0,Z.jsxs)(Fp,{className:`sm:max-w-4xl`,"data-ok-layer-spawned":``,children:[ee,W,re]}),t[61]=ee,t[62]=W,t[63]=re,t[64]=J):J=t[64];let ie;return t[65]!==r||t[66]!==n||t[67]!==J?(ie=(0,Z.jsx)(Bp,{open:n,onOpenChange:r,children:J}),t[65]=r,t[66]=n,t[67]=J,t[68]=ie):ie=t[68],ie}function BS(e){return e.pending}function VS(e){return e.kind===`plan`||e.kind===`already-seeded`?e:{kind:`loading`}}function HS(e){let t=(0,$.c)(19),{phase:n,selectedPack:r}=e;if(n.kind===`loading`){let e=r?.folders.length??6,n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(Ob,{rowCount:e}),t[0]=e,t[1]=n),n}if(n.kind===`error`){let e;return t[2]===n.message?e=t[3]:(e=(0,Z.jsx)(`div`,{className:`rounded-md bg-destructive/10 p-3 text-sm text-destructive`,children:n.message}),t[2]=n.message,t[3]=e),e}if(n.kind===`already-seeded`){let e;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(`p`,{className:`font-medium`,children:(0,Z.jsx)(Y,{id:`YwPUUP`})}),t[4]=e):e=t[4];let r;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsxs)(`div`,{children:[e,(0,Z.jsx)(`p`,{className:`text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`h-AdvS`})})]}),t[5]=r):r=t[5];let i;return t[6]===n.plan?i=t[7]:(i=(0,Z.jsxs)(`div`,{className:`space-y-3 py-2 text-sm`,children:[r,(0,Z.jsx)(WS,{plan:n.plan})]}),t[6]=n.plan,t[7]=i),i}let i;t[8]!==n.plan||t[9]!==r?(i=Io(n.plan)?(0,Z.jsx)(Nb,{plan:n.plan,selectedPack:r}):null,t[8]=n.plan,t[9]=r,t[10]=i):i=t[10];let a;t[11]===n.plan.warnings?a=t[12]:(a=n.plan.warnings.length>0?(0,Z.jsx)(`div`,{className:`rounded-md bg-warning/10 p-3 text-xs text-warning-foreground`,children:n.plan.warnings.map(US)}):null,t[11]=n.plan.warnings,t[12]=a);let o;t[13]===n.plan?o=t[14]:(o=(0,Z.jsx)(WS,{plan:n.plan}),t[13]=n.plan,t[14]=o);let s;return t[15]!==i||t[16]!==a||t[17]!==o?(s=(0,Z.jsxs)(`div`,{className:`space-y-6 py-1 text-sm`,children:[i,a,o]}),t[15]=i,t[16]=a,t[17]=o,t[18]=s):s=t[18],s}function US(e){return(0,Z.jsx)(`p`,{children:e},e)}function WS(e){let t=(0,$.c)(7),{plan:n}=e,r,i,a;if(t[0]!==n.packSkills){a=Symbol.for(`react.early_return_sentinel`);bb0:{let e=n.packSkills?.filter(KS)??[];if(e.length===0){a=null;break bb0}r=`rounded-md bg-warning/10 p-3 text-xs text-warning-foreground`,i=e.map(GS)}t[0]=n.packSkills,t[1]=r,t[2]=i,t[3]=a}else r=t[1],i=t[2],a=t[3];if(a!==Symbol.for(`react.early_return_sentinel`))return a;let o;return t[4]!==r||t[5]!==i?(o=(0,Z.jsx)(`div`,{className:r,children:i}),t[4]=r,t[5]=i,t[6]=o):o=t[6],o}function GS(e){return(0,Z.jsx)(`p`,{children:(0,Z.jsx)(Y,{id:`CtoghX`,values:{0:e.name}})},e.name)}function KS(e){return e.conflict}var qS=`Describe what this skill does and when to use it.`;function JS(){let e=(0,$.c)(8),{_:t}=xn(),n=km(),r=ef(),[i,a]=(0,Q.useState)(!1),o;e[0]!==t||e[1]!==i||e[2]!==r||e[3]!==n?(o=async function(e,o){let s=e===void 0?`project`:e;if(i)return;let c=_p(n.status===`ready`?n.data:[])[s],l=o?.name?.trim()||`new-skill`;if(!o?.name)for(let e=2;c.has(l);e++)l=`new-skill-${e}`;let u=o?.description?.trim()||`Describe what this skill does and when to use it.`;a(!0);let d=await Am({scope:s,name:l,frontmatter:{name:l,description:u},body:``});if(a(!1),!d.ok){Us.error(t({id:`xrVr_k`,values:{0:d.error}}));return}Us.success(t({id:`Yy90sM`,values:{name:l}})),r(s,l,d.path===void 0?void 0:{path:d.path})},e[0]=t,e[1]=i,e[2]=r,e[3]=n,e[4]=o):o=e[4];let s=o,c;return e[5]!==s||e[6]!==i?(c={createBlank:s,creating:i},e[5]=s,e[6]=i,e[7]=c):c=e[7],c}function YS(){return(0,Q.useSyncExternalStore)(rh,ih,ih)}function XS(e,t){return e instanceof Error&&e.message?e.message:t}async function ZS(e,t,n,r=`action`){try{n(null),await e()}catch(e){console.error(`[${r}] action failed:`,e),n(XS(e,t))}}async function QS(e,t,n=Us,r=`action`){await ZS(e,t,e=>{e!==null&&n.error(e)},r)}var $S=(0,Q.createContext)(!1);function eC(e){let t=(0,$.c)(5),{children:n}=e,[r,i]=(0,Q.useState)(nC),a,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>{if(window.okDesktop)return;let e=new AbortController;return Ym(e.signal).then(t=>{e.signal.aborted||t.status!==`ok`||i(t.config.singleFile)}).catch(tC),()=>e.abort()},o=[],t[0]=a,t[1]=o):(a=t[0],o=t[1]),(0,Q.useEffect)(a,o);let s;return t[2]!==n||t[3]!==r?(s=(0,Z.jsx)($S,{value:r,children:n}),t[2]=n,t[3]=r,t[4]=s):s=t[4],s}function tC(){}function nC(){return typeof window<`u`?window.okDesktop?.config.singleFile??!1:!1}function rC(){return(0,Q.use)($S)}function iC(e){return e.opened?e.isMain?`primary`:`worktree`:`none`}function aC(e,t,n){let r=[],i=new Set,a=new Set,o=t!==null&&t.mainRoot===e.project.mainRoot;e.projectSynthesized||(r.push({branch:e.project.branch??null,path:e.project.path,opened:!0,isMain:!0,isCurrent:e.project.path===n}),i.add(e.project.path),e.project.branch!=null&&a.add(e.project.branch));let s=[...e.worktrees].sort((e,t)=>t.lastOpenedAt.localeCompare(e.lastOpenedAt));for(let e of s)i.has(e.path)||(r.push({branch:e.branch??null,path:e.path,opened:!0,isMain:!1,isCurrent:e.path===n}),i.add(e.path),e.branch!=null&&a.add(e.branch));if(o){let e=t.entries.filter(e=>e.branch!==null&&!a.has(e.branch)&&(e.worktreePath===null||!i.has(e.worktreePath))).sort((e,t)=>(e.branch??``).localeCompare(t.branch??``));for(let t of e)r.push({branch:t.branch,path:t.worktreePath,opened:t.worktreePath!==null,isMain:t.isMain,isCurrent:t.isCurrent}),t.branch!=null&&a.add(t.branch),t.worktreePath!=null&&i.add(t.worktreePath)}return r.sort((e,t)=>oC(e)-oC(t))}function oC(e){return e.isMain?0:e.opened?1:2}function sC(e){let t=e.split(/[/\\]/).filter(e=>e.length>0);return t.length>0?t[t.length-1]??e:e}function cC(e){let t=[],n=new Map;for(let r of e){let e=r.gitCommonDir,i=r.mainRoot;if(e===void 0||i===void 0){t.push({project:r,mainRoot:r.path,worktrees:[]});continue}let a=n.get(e);a===void 0&&(a=t.length,n.set(e,a),t.push({project:null,mainRoot:i,worktrees:[]}));let o=t[a];o!==void 0&&(r.isLinkedWorktree?o.worktrees.push(r):o.project===null&&(o.project=r))}return t.map(e=>{let t=e.project===null;return{project:e.project??{path:e.mainRoot,name:sC(e.mainRoot),lastOpenedAt:``},worktrees:e.worktrees,projectSynthesized:t}})}function lC(e){let t=(0,$.c)(14),{path:n,name:r,onRemoveRecent:i,testIdPrefix:a}=e,{_:o}=xn(),s;t[0]!==o||t[1]!==r?(s=o({id:`Y6PKd1`,values:{name:r}}),t[0]=o,t[1]=r,t[2]=s):s=t[2];let c;t[3]===o?c=t[4]:(c=o({id:`Es-eZU`}),t[3]=o,t[4]=c);let l;t[5]!==i||t[6]!==n?(l=e=>{e.stopPropagation(),i(n)},t[5]=i,t[6]=n,t[7]=l):l=t[7];let u=`${a}-remove-${n}`,d;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Gf,{"aria-hidden":`true`,className:`size-3.5`}),t[8]=d):d=t[8];let f;return t[9]!==s||t[10]!==c||t[11]!==l||t[12]!==u?(f=(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,tabIndex:-1,"aria-hidden":`true`,"aria-label":s,title:c,onClick:l,className:`absolute top-1/2 right-1 size-6 -translate-y-1/2 text-muted-foreground opacity-0 transition-opacity group-hover/recent:opacity-100 focus-visible:opacity-100`,"data-testid":u,children:d}),t[9]=s,t[10]=c,t[11]=l,t[12]=u,t[13]=f):f=t[13],f}function uC(e){let t=(0,$.c)(13),{path:n,onRemoveRecent:r,testIdPrefix:i,children:a}=e,o;t[0]===a?o=t[1]:(o=(0,Z.jsx)(Si,{asChild:!0,children:a}),t[0]=a,t[1]=o);let s;t[2]!==r||t[3]!==n?(s=()=>r(n),t[2]=r,t[3]=n,t[4]=s):s=t[4];let c=`${i}-context-remove-${n}`,l,u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(Gf,{"aria-hidden":`true`}),u=(0,Z.jsx)(Y,{id:`Es-eZU`}),t[5]=l,t[6]=u):(l=t[5],u=t[6]);let d;t[7]!==s||t[8]!==c?(d=(0,Z.jsx)(ji,{children:(0,Z.jsxs)(Ti,{onSelect:s,"data-testid":c,children:[l,u]})}),t[7]=s,t[8]=c,t[9]=d):d=t[9];let f;return t[10]!==o||t[11]!==d?(f=(0,Z.jsxs)(_i,{children:[o,d]}),t[10]=o,t[11]=d,t[12]=f):f=t[12],f}var dC=(0,Q.lazy)(()=>n(()=>import(`./BugReportHistoryDialog-DwoT3Jcu.js`),__vite__mapDeps([48,14,1,15,16,33,34,18,19,20,26,29,28,27,24,35,36,31,32,3,4,37,38,39,40,42,43,44,45,46]),import.meta.url)),fC=3e3,pC=600,mC=20,hC=(e,t,n)=>QS(e,t,n,`CommandPalette`);function gC(e){window.location.assign(ep(e))}function _C(e,t){return e?.kind===`folder`||e?.kind===`folder-index`?e.folderPath:Jp(t)}function vC(e){let t=(0,$.c)(27),{entry:n,query:r,onSelect:i,disabled:a}=e,o=r===void 0?``:r,s=a===void 0?!1:a,c;t[0]===n?c=t[1]:(c=`title`in n&&n.title?n.title:n.path.split(`/`).pop()??n.path,t[0]=n,t[1]=c);let l=c,u=`snippet`in n?n.snippet:void 0,d=`docExt`in n?n.docExt:void 0,f=`bodyIndexed`in n?n.bodyIndexed:void 0,p=`${n.kind} ${n.path}`,m=`command-palette-nav-${n.kind}-${n.path}`,h;t[2]!==f||t[3]!==d||t[4]!==n.kind||t[5]!==n.path?(h=(0,Z.jsx)(Ve,{bodyIndexed:f,className:`mt-0.5 size-4`,docExt:d,kind:n.kind,path:n.path}),t[2]=f,t[3]=d,t[4]=n.kind,t[5]=n.path,t[6]=h):h=t[6];let g;t[7]!==o||t[8]!==l?(g=(0,Z.jsx)(Rl,{className:`truncate font-medium`,children:(0,Z.jsx)(bC,{query:o,text:l})}),t[7]=o,t[8]=l,t[9]=g):g=t[9];let _;t[10]!==n.path||t[11]!==o?(_=(0,Z.jsx)(Rl,{className:`truncate text-muted-foreground text-xs`,children:(0,Z.jsx)(bC,{query:o,text:n.path})}),t[10]=n.path,t[11]=o,t[12]=_):_=t[12];let v;t[13]!==o||t[14]!==u?(v=u?(0,Z.jsx)(Rl,{className:`max-h-10 overflow-hidden text-muted-foreground text-xs leading-relaxed`,children:(0,Z.jsx)(bC,{query:o,text:u})}):null,t[13]=o,t[14]=u,t[15]=v):v=t[15];let y;t[16]!==g||t[17]!==_||t[18]!==v?(y=(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[g,_,v]}),t[16]=g,t[17]=_,t[18]=v,t[19]=y):y=t[19];let b;return t[20]!==s||t[21]!==i||t[22]!==y||t[23]!==p||t[24]!==m||t[25]!==h?(b=(0,Z.jsxs)(H,{value:p,onSelect:i,disabled:s,"data-testid":m,className:`items-start`,children:[h,y]}),t[20]=s,t[21]=i,t[22]=y,t[23]=p,t[24]=m,t[25]=h,t[26]=b):b=t[26],b}function yC(e){let t=(0,$.c)(5),{mode:n,inExclusiveMode:r,paletteModeKind:i}=e;if(r||i!==`normal`||n===`idle`||n===`content`)return null;let a=`command-palette-search-hint-${n}`,o;t[0]===n?o=t[1]:(o=n===`name-only`?(0,Z.jsx)(Y,{id:`GuLeuE`,values:{0:Js(`find`)},components:{0:(0,Z.jsx)(O,{"aria-label":Ys(`find`)})}}):n===`truncated`?(0,Z.jsx)(Y,{id:`-q4abP`}):(0,Z.jsx)(Y,{id:`DbILZA`}),t[0]=n,t[1]=o);let s;return t[2]!==a||t[3]!==o?(s=(0,Z.jsx)(`div`,{"aria-live":`polite`,"data-testid":a,className:`border-t px-3 py-2 text-muted-foreground text-xs`,children:o}),t[2]=a,t[3]=o,t[4]=s):s=t[4],s}function bC(e){let t=(0,$.c)(5),{text:n,query:r}=e,i;t[0]!==r||t[1]!==n?(i=aS(n,r).map(xC),t[0]=r,t[1]=n,t[2]=i):i=t[2];let a;return t[3]===i?a=t[4]:(a=(0,Z.jsx)(Z.Fragment,{children:i}),t[3]=i,t[4]=a),a}function xC(e){let t=`${e.start}:${e.match?`match`:`plain`}`;return e.match?(0,Z.jsx)(`mark`,{className:`rounded-sm bg-primary/10 px-0.5 font-semibold text-primary`,children:e.text},t):(0,Z.jsx)(`span`,{children:e.text},t)}function SC({searchResults:e,fallbackSearchResults:t,searchStatus:n}){return e.length>0?e:n===`success`?[]:t}function CC(e){let t=(0,$.c)(150),{bridge:n,open:r,onOpenChange:i}=e,a=n===void 0?null:n,{_:o}=xn(),s=rC(),[c,l]=(0,Q.useState)(``),d=(0,Q.useDeferredValue)(c),f=d.trim(),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=[],t[0]=p):p=t[0];let[m,h]=(0,Q.useState)(p),[g,_]=(0,Q.useState)(`idle`),[v,y]=(0,Q.useState)(!1),[b,x]=(0,Q.useState)(!1),[S,C]=(0,Q.useState)(!1),w;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(w=[],t[1]=w):w=t[1];let[T,E]=(0,Q.useState)(w),[D,A]=(0,Q.useState)(null),[j,M]=(0,Q.useState)(`idle`),P;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(P=[],t[2]=P):P=t[2];let[F,I]=(0,Q.useState)(P),L;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(L=[],t[3]=L):L=t[3];let[R,B]=(0,Q.useState)(L),[V,U]=(0,Q.useState)(null),[ee,W]=(0,Q.useState)(!1),[te,G]=(0,Q.useState)(!1),[K,q]=(0,Q.useState)(!1),[ne,J]=(0,Q.useState)(!1),[ie,ae]=(0,Q.useState)(!1),[oe,se]=(0,Q.useState)(!1),{createBlank:ce}=JS(),le=Xt(),ue;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(ue=[],t[4]=ue):ue=t[4];let[de,fe]=(0,Q.useState)(ue),[pe,me]=(0,Q.useState)(`idle`),he;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(he=[],t[5]=he):he=t[5];let[ge,_e]=(0,Q.useState)(he),[ve,ye]=(0,Q.useState)(`idle`),be=(0,Q.useRef)(!1),xe=(0,Q.useRef)(null),Se=(0,Q.useRef)(null),Ce=(0,Q.useRef)(null),we=(0,Q.useRef)(null),{activeDocName:Te,activeTarget:Ee}=Ke(),{pages:Oe,pageTitles:ke,pageMeta:Ae,folderPaths:je,filePaths:Me,loading:Pe}=Lu(),Fe=xl(),{states:Ie,refresh:Le}=nr(),{dispatch:Re}=gl(),ze;t[6]===r?ze=t[7]:(ze={enabled:r},t[6]=r,t[7]=ze);let{status:Be,refresh:Ve}=od(ze),He=(Be?.enabled??!1)&&(Be?.keyPresent??!1),Ue=Be?.embedded??0,We=Be?.total??0,Ge=He&&We>0&&Ue<We,qe;t[8]!==S||t[9]!==r||t[10]!==Ve||t[11]!==Ge?(qe=()=>{if(!r||!S||!Ge)return;let e=window.setInterval(()=>Ve(),2500);return()=>window.clearInterval(e)},t[8]=S,t[9]=r,t[10]=Ve,t[11]=Ge,t[12]=qe):qe=t[12];let Je;t[13]!==S||t[14]!==r||t[15]!==Ge?(Je=[r,S,Ge],t[13]=S,t[14]=r,t[15]=Ge,t[16]=Je):Je=t[16],(0,Q.useEffect)(qe,Je);let Ye=hl({docName:Te,workspace:Fe}),Xe=Qx(Oe,je,ke,Ae,Me),Ze=Wx(R,new Set(Xe.map(DC))),Qe=a?.config.projectPath??null,$e=a?F.filter(e=>e.path!==Qe):[],et=YS(),tt=a&&et?et.entries.filter(EC):[],nt;t[17]!==Te||t[18]!==Ee?(nt=_C(Ee,Te),t[17]=Te,t[18]=Ee,t[19]=nt):nt=t[19];let rt=nt,it=f===``?[]:rS(Xe,f,8),at,ot;t[20]!==i||t[21]!==r?(at=()=>{let e=function(e){rc(e,`command-palette`)&&(e.preventDefault(),!(!r&&pr())&&i(!r))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},ot=[i,r],t[20]=i,t[21]=r,t[22]=at,t[23]=ot):(at=t[22],ot=t[23]),(0,Q.useEffect)(at,ot);let st,ct;t[24]!==o||t[25]!==a||t[26]!==r||t[27]!==Le?(st=()=>{if(r){if(B(Vx()),Le(),a){let e=!1;return hC(async()=>{let t=await a.project.listRecent();e||I(t)},o({id:`fYKgzG`})),()=>{e=!0}}return}l(``),fe([]),me(`idle`),be.current=!1,_e([]),ye(`idle`),C(!1),Ce.current?.abort(),Ce.current=null,we.current!==null&&(window.clearTimeout(we.current),we.current=null),E([]),A(null),M(`idle`)},ct=[r,a,Le,o],t[24]=o,t[25]=a,t[26]=r,t[27]=Le,t[28]=st,t[29]=ct):(st=t[28],ct=t[29]),(0,Q.useEffect)(st,ct);let lt;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(lt=()=>{xe.current&&(xe.current.scrollTop=0)},t[30]=lt):lt=t[30];let ut;t[31]===c?ut=t[32]:(ut=[c],t[31]=c,t[32]=ut),(0,Q.useEffect)(lt,ut);let dt=new Set(de.map(TC)),ft=S?{kind:`normal`,query:d}:fS(d,dt),pt=ft.kind!==`normal`,mt=pt||S,ht=ft.kind===`tag-list`?ft.query:``,gt=ft.kind===`tag-docs`?ft.tagName:``,_t=c.trim(),vt=S?uS({query:_t,firedQuery:D,status:j,resultCount:T.length}):null,yt=vt?.submit?.query??``,bt=vt?.results.forQuery??``,xt,St;t[33]!==pt||t[34]!==r?(xt=()=>{if(!r||!pt||be.current)return;be.current=!0,me(`loading`);let e=!1;return mS().then(t=>{e||(fe(t),me(`success`))}).catch(t=>{e||(console.error(`[command-palette-tag] fetch tags failed`,t),fe([]),me(`error`))}),()=>{e=!0}},St=[r,pt],t[33]=pt,t[34]=r,t[35]=xt,t[36]=St):(xt=t[35],St=t[36]),(0,Q.useEffect)(xt,St);let Ct=ft.kind===`tag-docs`?ft.tagName:null;(0,Q.useEffect)(()=>{if(!r||Ct===null){_e([]),ye(`idle`);return}ye(`loading`),_e([]);let e=!1;return hS(Ct).then(t=>{e||(_e(t),ye(`success`))}).catch(t=>{e||(console.error(`[command-palette-tag] fetch tag docs failed`,t),_e([]),ye(`error`))}),()=>{e=!0}},[r,Ct]),(0,Q.useEffect)(()=>{if(!r||!f||mt||Pe){h([]),_(`idle`),y(!1),x(!1);return}let e=!1,t=!1,n=0,i=null,a,o;_(`loading`);let s=()=>e||n>=mC?!1:(n+=1,o=window.setTimeout(l,pC),!0),c=()=>{e||t&&s()||(h([]),_(`error`),y(!1),x(!1))};function l(){let n=new AbortController;i=n,a=window.setTimeout(()=>{n.abort(),c()},fC),sS(f,{signal:n.signal}).then(n=>{let{entries:r,truncated:i,ready:o}=n;if(window.clearTimeout(a),!e){if(!o){t||(t=!0,h([]),y(!1),x(!0),_(`success`)),s()||x(!1);return}h(r),y(i),x(!1),_(`success`)}}).catch(t=>{window.clearTimeout(a),!e&&(t instanceof Error&&t.name===`AbortError`||c())})}return l(),()=>{e=!0,window.clearTimeout(a),window.clearTimeout(o),i?.abort()}},[r,f,mt,Pe]);let wt;t[37]!==o||t[38]!==i?(wt=(e,t)=>{let n=t===void 0?o({id:`uuoHOU`}):t;i(!1),hC(async()=>{await e()},n)},t[37]=o,t[38]=i,t[39]=wt):wt=t[39];let Tt=wt,Et;t[40]!==o||t[41]!==a?(Et=e=>{a&&hC(async()=>{await a.project.removeRecent(e),I(t=>t.filter(t=>t.path!==e))},o({id:`viwC-K`}))},t[40]=o,t[41]=a,t[42]=Et):Et=t[42];let Dt=Et,Ot;t[43]!==o||t[44]!==a||t[45]!==Tt?(Ot=e=>{if(!a)return;let t=e.worktreePath;if(t!==null){Tt(()=>a.project.open({path:t,target:`new-window`,entryPoint:`worktree`}),o({id:`LwMxXg`}));return}let n=e.branch;n!==null&&Tt(async()=>{let e=await a.worktree.create({branch:n,createBranch:!1});if(!e.ok)throw Error(e.reason);ah(),await a.project.open({path:e.path,target:`new-window`,entryPoint:`worktree`})},o({id:`LwMxXg`}))},t[43]=o,t[44]=a,t[45]=Tt,t[46]=Ot):Ot=t[46];let kt=Ot,At;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(At=function(e){let t={kind:e.kind,path:e.path,lastOpenedAt:new Date().toISOString()},n=Ux(Vx(),t);Hx(n),B(n)},t[47]=At):At=t[47];let jt=At,Mt;t[48]===i?Mt=t[49]:(Mt=function(e){i(!1),jt(e),gC(e.path)},t[48]=i,t[49]=Mt);let Nt=Mt,Pt=!mt&&f===``&&Ze.length>0,Ft=SC({searchResults:m,fallbackSearchResults:it,searchStatus:g}),It=!mt&&Ft.length>0,Lt=!mt&&f!==``&&(Pe||b)&&!It,Rt=!mt&&f!==``&&g===`loading`&&!It&&!Lt,zt=!mt&&a!==null&&$e.length>0&&(f===``||$e.some(e=>cS(`${e.name} ${e.path}`,d,[`open recent project`]))),Bt=tt.filter(e=>f===``||cS(e.branch??``,d,[`worktree branch`])),Vt=!mt&&a!==null&&Bt.length>0,Ht=u(),Ut=!mt&&!Ht&&Ye!==null&&(f===``||hi.some(e=>{let t=e.displayName;return cS(o({id:`wHZ58m`,values:{displayName:t}}),d,[e.id,`agent handoff`,`open in`])})),Wt=ft.kind===`tag-list`?pS(de,ft.query):[],Gt=ft.kind===`tag-list`&&pe!==`loading`&&Wt.length===0,qt=ft.kind===`tag-docs`&&ve===`success`&&ge.length===0,Jt=xc(),Yt;t[50]===i?Yt=t[51]:(Yt=e=>{i(!1),Zn(e)},t[50]=i,t[51]=Yt);let Zt=Yt,Qt;t[52]!==a||t[53]!==i?(Qt=e=>{i(!1),eh(e,a?{okDesktop:{shell:a.shell}}:{okDesktop:void 0})},t[52]=a,t[53]=i,t[54]=Qt):Qt=t[54];let $t=Qt,en;t[55]===i?en=t[56]:(en=()=>i(!1),t[55]=i,t[56]=en);let tn;t[57]===U?tn=t[58]:(tn=e=>U(e),t[57]=U,t[58]=tn);let nn;t[59]===W?nn=t[60]:(nn=()=>W(!0),t[59]=W,t[60]=nn);let rn;t[61]===G?rn=t[62]:(rn=()=>G(!0),t[61]=G,t[62]=rn);let an;t[63]===q?an=t[64]:(an=()=>q(!0),t[63]=q,t[64]=an);let on;t[65]===J?on=t[66]:(on=()=>{ae(!0),J(!0)},t[65]=J,t[66]=on);let sn;t[67]===se?sn=t[68]:(sn=()=>se(!0),t[67]=se,t[68]=sn);let cn;t[69]===ce?cn=t[70]:(cn=()=>void ce(`project`),t[69]=ce,t[70]=cn);let ln;t[71]===le?ln=t[72]:(ln=()=>le?.(),t[71]=le,t[72]=ln);let un={bridge:a,singleFile:s,activeDocName:Te,contextualTargetKind:Tx(Ee),viewMenuState:Jt,emitMenuAction:Zt,runAction:Tt,openExternalUrl:$t,closePalette:en,openNewItemDialog:tn,openSeedDialog:nn,openCreateProjectDialog:rn,openReportBugDialog:an,openBugReportHistory:on,openFeedbackDialog:sn,createBlankSkill:cn,openBlobRun:ln},dn=mt?[]:Fx.flatMap(e=>{if(!e.available(un)||e.visibility===`search-only`&&f===``)return[];let t=e.label(un);return cS(t,d,e.keywords)?[{cmd:e,label:t}]:[]}),fn=dn.length>0,pn;t[73]===o?pn=t[74]:(pn=e=>{switch(e){case`commands`:return o({id:`45MZFs`});case`project`:return o({id:`e0NrBM`});case`file`:return o({id:`J2eKUI`});case`view`:return o({id:`jpctdh`});case`terminal`:return o({id:`ALhMYW`});case`app`:return o({id:`IrC12v`})}},t[73]=o,t[74]=pn);let mn=pn,hn=e=>{let t=dn.filter(t=>t.cmd.group===e);return t.length===0?null:(0,Z.jsx)(Ne,{heading:mn(e),children:t.map(e=>{let{cmd:t,label:n}=e,r=t.shortcutId!==void 0&&(t.shortcutDesktopOnly!==!0||a!==null)?Js(t.shortcutId):null;return(0,Z.jsxs)(H,{value:`${n} ${t.keywords.join(` `)}`,onSelect:()=>t.dispatch(un),"data-testid":`command-palette-${t.id}`,children:[(0,Z.jsx)(t.icon,{}),(0,Z.jsx)(`span`,{children:n}),t.checked?.(un)?(0,Z.jsx)(Yl,{className:`ml-auto text-muted-foreground`,"aria-hidden":`true`}):null,r?(0,Z.jsx)(z,{children:r}):null]},t.id)})},e)},gn=mt||Pt||It||Rt||Lt||zt||Ut||fn,_n;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(_n=function(e){l(`${dS}${e}`)},t[75]=_n):_n=t[75];let vn=_n,yn;t[76]===Symbol.for(`react.memo_cache_sentinel`)?(yn=function(){Ce.current?.abort(),Ce.current=null,we.current!==null&&(window.clearTimeout(we.current),we.current=null),E([]),A(null),M(`idle`)},t[76]=yn):yn=t[76];let bn=yn,Sn;t[77]===c?Sn=t[78]:(Sn=function(){C(!0),c.startsWith(`tag:`)&&l(c.slice(dS.length)),bn(),Se.current?.focus()},t[77]=c,t[78]=Sn);let Cn=Sn,wn;t[79]===Symbol.for(`react.memo_cache_sentinel`)?(wn=function(){C(!1),l(``),bn(),Se.current?.focus()},t[79]=wn):wn=t[79];let Tn=wn,En=function(e){let t=e.trim();if(!t||Pe)return;Ce.current?.abort(),we.current!==null&&window.clearTimeout(we.current);let n=new AbortController;Ce.current=n,M(`loading`);let r=!1,i=window.setTimeout(()=>{r=!0,n.abort(),M(`error`)},fC);we.current=i,sS(t,{signal:n.signal,semantic:!0,limit:30}).then(e=>{let{entries:r}=e;Dn(i,n),E(r),A(t),M(`success`)}).catch(e=>{Dn(i,n),!(e instanceof Error&&e.name===`AbortError`&&!r)&&(console.debug(`[semantic-search] fire failed`,{timedOut:r,error:e}),M(`error`))})};function Dn(e,t){window.clearTimeout(e),we.current===e&&(we.current=null),Ce.current===t&&(Ce.current=null)}let On=function(e){!S||e.key!==`Enter`||(vt?.submit?(e.preventDefault(),e.stopPropagation(),En(vt.submit.query)):j===`loading`&&(e.preventDefault(),e.stopPropagation()))},kn;t[80]===S?kn=t[81]:(kn=function(e){S&&(e.preventDefault(),Tn())},t[80]=S,t[81]=kn);let An=kn,jn;t[82]===o?jn=t[83]:(jn=o({id:`1bDVu5`}),t[82]=o,t[83]=jn);let Mn;t[84]===o?Mn=t[85]:(Mn=o({id:`5GRxoA`}),t[84]=o,t[85]=Mn);let Nn;t[86]===Symbol.for(`react.memo_cache_sentinel`)?(Nn={shouldFilter:!1,vimBindings:!1,className:`[&_[cmdk-input-wrapper]_svg]:h-4 [&_[cmdk-input-wrapper]_svg]:w-4 [&_[cmdk-item]_svg]:h-4 [&_[cmdk-item]_svg]:w-4`},t[86]=Nn):Nn=t[86];let Pn;t[87]!==o||t[88]!==S?(Pn=o(S?{id:`zXj1rA`}:{id:`ggs9f8`}),t[87]=o,t[88]=S,t[89]=Pn):Pn=t[89];let Fn;t[90]!==S||t[91]!==pt?(Fn=()=>{S&&(C(!1),bn()),l(pt?``:dS),Se.current?.focus()},t[90]=S,t[91]=pt,t[92]=Fn):Fn=t[92];let In=pt?`border-primary/30 bg-primary/10 text-primary`:`border-border bg-transparent text-muted-foreground hover:bg-accent hover:text-accent-foreground`,Ln;t[93]===In?Ln=t[94]:(Ln=Qn(`inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium transition-colors`,In),t[93]=In,t[94]=Ln);let Rn,zn;t[95]===Symbol.for(`react.memo_cache_sentinel`)?(Rn=(0,Z.jsx)(rf,{className:`size-3.5`}),zn=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(Y,{id:`0rwwOn`})}),t[95]=Rn,t[96]=zn):(Rn=t[95],zn=t[96]);let Bn;t[97]!==pt||t[98]!==Fn||t[99]!==Ln?(Bn=(0,Z.jsxs)(`button`,{type:`button`,onClick:Fn,"data-testid":`command-palette-filter-tag`,"data-active":pt,"aria-pressed":pt,className:Ln,children:[Rn,zn]}),t[97]=pt,t[98]=Fn,t[99]=Ln,t[100]=Bn):Bn=t[100];let Vn;t[101]!==Cn||t[102]!==S||t[103]!==He?(Vn=He?(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>S?Tn():Cn(),"data-testid":`command-palette-filter-semantic`,"data-active":S,"aria-pressed":S,className:Qn(`inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium transition-colors`,S?`border-primary/30 bg-primary/10 text-primary`:`border-border bg-transparent text-muted-foreground hover:bg-accent hover:text-accent-foreground`),children:[(0,Z.jsx)(re,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(Y,{id:`9tJX8r`})})]}):null,t[101]=Cn,t[102]=S,t[103]=He,t[104]=Vn):Vn=t[104];let Hn;t[105]!==Bn||t[106]!==Vn?(Hn=(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-1.5 border-b px-3 py-2`,children:[Bn,Vn]}),t[105]=Bn,t[106]=Vn,t[107]=Hn):Hn=t[107];let Un;t[108]===Lt?Un=t[109]:(Un=Lt?(0,Z.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-6 text-muted-foreground text-sm`,role:`status`,"aria-live":`polite`,"data-testid":`command-palette-search-preparing`,children:[(0,Z.jsx)(cf,{"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(Y,{id:`yIPXut`})]}):null,t[108]=Lt,t[109]=Un);let Wn;t[110]!==It||t[111]!==Rt?(Wn=Rt&&!It?(0,Z.jsx)(De,{children:(0,Z.jsx)(Y,{id:`WRNXKp`})}):null,t[110]=It,t[111]=Rt,t[112]=Wn):Wn=t[112];let Gn=yC,Kn=lS(f,Ft,{truncated:v}),qn;t[113]!==Gn||t[114]!==mt||t[115]!==ft.kind||t[116]!==Kn?(qn=(0,Z.jsx)(Gn,{mode:Kn,inExclusiveMode:mt,paletteModeKind:ft.kind}),t[113]=Gn,t[114]=mt,t[115]=ft.kind,t[116]=Kn,t[117]=qn):qn=t[117];let Jn=V===`file`,Yn;t[118]===U?Yn=t[119]:(Yn=e=>{e||U(null)},t[118]=U,t[119]=Yn);let Xn;t[120]!==rt||t[121]!==Jn||t[122]!==Yn?(Xn=(0,Z.jsx)(jS,{open:Jn,onOpenChange:Yn,kind:`file`,initialDir:rt}),t[120]=rt,t[121]=Jn,t[122]=Yn,t[123]=Xn):Xn=t[123];let $n=V===`folder`,er;t[124]===U?er=t[125]:(er=e=>{e||U(null)},t[124]=U,t[125]=er);let tr;t[126]!==rt||t[127]!==$n||t[128]!==er?(tr=(0,Z.jsx)(jS,{open:$n,onOpenChange:er,kind:`folder`,initialDir:rt}),t[126]=rt,t[127]=$n,t[128]=er,t[129]=tr):tr=t[129];let rr;t[130]!==ee||t[131]!==W?(rr=(0,Z.jsx)(zS,{open:ee,onOpenChange:W}),t[130]=ee,t[131]=W,t[132]=rr):rr=t[132];let ir;t[133]!==a||t[134]!==te||t[135]!==G?(ir=a?(0,Z.jsx)(lx,{open:te,onOpenChange:G,bridge:a}):null,t[133]=a,t[134]=te,t[135]=G,t[136]=ir):ir=t[136];let ar;t[137]!==a||t[138]!==K||t[139]!==q?(ar=a?(0,Z.jsx)(Uv,{open:K,onOpenChange:q}):null,t[137]=a,t[138]=K,t[139]=q,t[140]=ar):ar=t[140];let or;t[141]!==a||t[142]!==ie||t[143]!==ne||t[144]!==J||t[145]!==q?(or=a&&ie?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(dC,{open:ne,onOpenChange:J,onReportABug:()=>{J(!1),q(!0)}})}):null,t[141]=a,t[142]=ie,t[143]=ne,t[144]=J,t[145]=q,t[146]=or):or=t[146];let sr;return t[147]!==oe||t[148]!==se?(sr=(0,Z.jsx)(_S,{open:oe,onOpenChange:se,source:`command_palette`}),t[147]=oe,t[148]=se,t[149]=sr):sr=t[149],(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(N,{open:r,onOpenChange:i,title:jn,description:Mn,className:`sm:max-w-2xl`,commandProps:Nn,onEscapeKeyDown:An,children:[(0,Z.jsx)(k,{ref:Se,value:c,onValueChange:l,onKeyDown:On,placeholder:Pn}),Hn,(0,Z.jsxs)(Kt,{ref:xe,className:`subtle-scrollbar`,children:[S&&vt?(0,Z.jsxs)(Z.Fragment,{children:[Ge?(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 text-muted-foreground text-xs`,role:`status`,"aria-live":`polite`,"data-testid":`command-palette-semantic-indexing`,children:[(0,Z.jsx)(cf,{"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(Y,{id:`kCNU4q`,values:{semanticIndexedCount:Ue,semanticTotalCount:We}})]}):null,vt.submit?(0,Z.jsx)(Ne,{children:(0,Z.jsx)(H,{value:`semantic-submit`,onSelect:()=>En(yt),"data-testid":`command-palette-semantic-submit`,children:vt.submit.kind===`retry`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(re,{}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-amber-700 dark:text-amber-400`,children:(0,Z.jsx)(Y,{id:`w4ZzmQ`})}),(0,Z.jsx)(z,{children:`↵`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(re,{}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:(0,Z.jsx)(Y,{id:`FNTx6u`,values:{semanticSubmitQuery:yt}})}),(0,Z.jsx)(z,{children:`↵`})]})})}):null,vt.notice===`empty`?(0,Z.jsx)(De,{"data-testid":`command-palette-semantic-empty`,children:(0,Z.jsx)(Y,{id:`l5J_HM`,components:{0:(0,Z.jsx)(O,{"aria-label":o({id:`9Vnjc9`})})}})}):null,vt.notice===`searching`?(0,Z.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-6 text-muted-foreground text-sm`,role:`status`,"aria-live":`polite`,"data-testid":`command-palette-semantic-searching`,children:[(0,Z.jsx)(cf,{"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(Y,{id:`PBwmDJ`})]}):null,vt.notice===`no-results`?(0,Z.jsx)(De,{"data-testid":`command-palette-semantic-no-results`,children:(0,Z.jsx)(Y,{id:`yFyZMJ`,values:{semanticQueryText:_t}})}):null,vt.results.show?(0,Z.jsx)(Ne,{heading:vt.results.dimmed?o({id:`QlxHAH`,values:{semanticResultsLabel:bt}}):o({id:`9tJX8r`}),children:(0,Z.jsx)(`div`,{"data-testid":`command-palette-semantic-results`,"data-dimmed":vt.results.dimmed,children:T.map(e=>(0,Z.jsx)(vC,{entry:e,disabled:vt.results.dimmed,onSelect:()=>Nt(e)},Bx(e.kind,e.path)))})}):null]}):null,Un,Wn,gn?null:(0,Z.jsx)(De,{children:g===`error`?(0,Z.jsx)(Y,{id:`pkAft1`}):(0,Z.jsx)(Y,{id:`i3f2kh`})}),ft.kind===`tag-list`?(0,Z.jsxs)(Ne,{heading:ft.query?o({id:`evs0iw`,values:{tagListQuery:ht}}):o({id:`2QM24L`}),children:[pe===`loading`?(0,Z.jsx)(De,{children:(0,Z.jsx)(Y,{id:`a_u4ck`})}):null,pe===`error`?(0,Z.jsx)(De,{children:(0,Z.jsx)(Y,{id:`qTcZZu`,components:{0:(0,Z.jsx)(O,{"aria-label":o({id:`69KLIV`})})}})}):null,Gt?(0,Z.jsx)(De,{children:ft.query?o({id:`X0ttSN`,values:{tagListQuery:ht}}):o({id:`JLUTgi`})}):null,Wt.map(e=>(0,Z.jsxs)(H,{value:`tag ${e.name}`,onSelect:()=>vn(e.name),"data-testid":`command-palette-tag-${e.name}`,children:[(0,Z.jsx)(rf,{}),(0,Z.jsx)(Rl,{className:`min-w-0 flex-1 truncate font-medium`,children:e.name}),(0,Z.jsx)(`span`,{className:`ml-auto shrink-0 text-[11px] text-muted-foreground tabular-nums`,children:(0,Z.jsx)(Y,{id:`fVcm9t`,values:{0:e.count}})})]},`tag:${e.name}`))]}):null,ft.kind===`tag-docs`?(0,Z.jsxs)(Ne,{heading:o({id:`hGmuTc`,values:{tagDocsName:gt}}),children:[ve===`loading`?(0,Z.jsx)(De,{children:(0,Z.jsx)(Y,{id:`pWbsW6`})}):null,ve===`error`?(0,Z.jsx)(De,{children:(0,Z.jsx)(Y,{id:`z_4xza`,components:{0:(0,Z.jsx)(O,{"aria-label":o({id:`69KLIV`})})}})}):null,qt?(0,Z.jsx)(De,{children:o({id:`NIWAux`,values:{tagDocsName:gt}})}):null,ge.map(e=>{let t=e.title||e.docName.split(`/`).pop()||e.docName,n=e.matchingTags.filter(e=>e!==ft.tagName).map(wC).join(`, `);return(0,Z.jsxs)(H,{value:`tag-doc ${e.docName}`,onSelect:()=>{i(!1),gC(e.docName)},"data-testid":`command-palette-tag-doc-${e.docName}`,className:`items-start`,children:[(0,Z.jsx)(Xr,{className:`mt-0.5`}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Z.jsx)(Rl,{className:`truncate font-medium`,children:t}),(0,Z.jsx)(Rl,{className:`truncate text-muted-foreground text-xs`,children:e.docName}),e.matchingTags.length>0&&e.matchingTags.some(e=>e!==ft.tagName)?(0,Z.jsx)(`span`,{className:`truncate text-muted-foreground text-[11px]`,children:(0,Z.jsx)(Y,{id:`CvsD6Y`,values:{viaTags:n}})}):null]})]},`tag-doc:${e.docName}`)})]}):null,Pt?(0,Z.jsx)(Ne,{heading:o({id:`MmDDWK`}),children:Ze.map(e=>(0,Z.jsx)(vC,{entry:e,onSelect:()=>Nt(e)},Bx(e.kind,e.path)))}):null,hn(`commands`),Ut?(0,Z.jsx)(Ne,{heading:o({id:`O7_W_a`}),children:hi.filter(e=>{let t=e.displayName;return cS(o({id:`wHZ58m`,values:{displayName:t}}),d,[e.id,`agent handoff`,`open in`])}).map(e=>{let t=Ie[e.id],n=t.installed===!0&&Ye!==null,r=e.displayName,a=t.installed===null?o({id:`IA6JW2`}):t.installed===!1?o({id:`5SwVv1`}):null,s=o(a?{id:`rl35Vz`,values:{displayName:r,hint:a}}:{id:`wHZ58m`,values:{displayName:r}});return(0,Z.jsxs)(H,{value:`send to ai ${e.displayName} desktop ${e.id} agent open in`,disabled:!n,onSelect:()=>{!n||!Ye||(i(!1),Re(e.id,Ye))},"data-testid":`command-palette-open-in-${e.id}`,"aria-label":s,children:[(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(Y,{id:`wHZ58m`,values:{displayName:r}})}),a?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-auto text-muted-foreground text-xs`,children:a}):null]},e.id)})}):null,hn(`project`),zt&&a?(0,Z.jsx)(Ne,{heading:o({id:`3iyGWF`}),children:$e.filter(e=>cS(`${e.name} ${e.path}`,d,[`open recent project`])).slice(0,10).map(e=>{let t=e.isLinkedWorktree===!0,n=t?Cl:Qd,r=t&&e.mainRoot!==void 0?sC(e.mainRoot):null;return(0,Z.jsx)(uC,{path:e.path,onRemoveRecent:Dt,testIdPrefix:`command-palette-recent`,children:(0,Z.jsxs)(`div`,{className:`group/recent relative flex items-center`,children:[(0,Z.jsxs)(H,{value:`${e.name} ${e.path} recent project`,onSelect:()=>Tt(()=>a.project.open({path:e.path,target:`new-window`,entryPoint:`recents`}),o({id:`SUOoXn`})),"data-testid":`command-palette-recent-${e.path}`,className:`flex-1 items-start pr-8`,children:[(0,Z.jsx)(n,{className:`mt-0.5`}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,Z.jsx)(Rl,{className:`truncate font-medium`,children:e.name}),r===null?null:(0,Z.jsx)(`span`,{className:`truncate text-muted-foreground text-xs`,children:(0,Z.jsx)(Y,{id:`8Gzz2G`,values:{worktreeOf:r}})}),(0,Z.jsx)(Rl,{className:`truncate text-muted-foreground text-xs`,children:e.path})]})]}),(0,Z.jsx)(lC,{path:e.path,name:e.name,onRemoveRecent:Dt,testIdPrefix:`command-palette-recent`})]})},e.path)})}):null,Vt&&a?(0,Z.jsx)(Ne,{heading:o({id:`sxjyRq`}),children:Bt.slice(0,10).map(e=>(0,Z.jsxs)(H,{value:`${e.branch} worktree branch`,onSelect:()=>kt(e),"data-testid":`command-palette-worktree-${e.branch}`,className:`items-start`,children:[(0,Z.jsx)(Cl,{className:`mt-0.5`}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,Z.jsx)(Rl,{className:`truncate font-medium`,children:e.branch}),e.worktreePath===null?(0,Z.jsx)(`span`,{className:`truncate text-muted-foreground text-xs`,children:o({id:`iO8V-7`})}):(0,Z.jsx)(Rl,{className:`truncate text-muted-foreground text-xs`,children:e.worktreePath})]})]},e.branch))}):null,[`file`,`view`,`terminal`,`app`].map(e=>hn(e)),It?(0,Z.jsx)(Ne,{heading:o({id:`A1taO8`}),children:Ft.map(e=>(0,Z.jsx)(vC,{entry:e,query:f,onSelect:()=>Nt(e)},Bx(e.kind,e.path)))}):null]}),qn]}),Xn,tr,rr,ir,ar,or,sr]})}function wC(e){return`#${e}`}function TC(e){return e.name}function EC(e){return e.branch!==null&&!e.isCurrent}function DC(e){return Bx(e.kind,e.path)}var OC=500;function kC(e,t,n){return t?`terminal`:e===null&&n?`retrying`:`hidden`}function AC(e){return e?.kind===`null-collab`}function jC(e){if(e===null)return ic._({id:`Ua78MH`});if(e.kind===`null-collab`)return ic._({id:`tz_FDV`});if(e.code===`network`)return ic._({id:`2L8aeZ`});if(e.code===`invalid-body`)return ic._({id:`FRYB1Q`});let t=e.code;return ic._({id:`4nj6n8`,values:{code:t}})}function MC(){let e=(0,$.c)(31),t=Xt(),{collabUrl:n,collabTerminal:r,collabLastError:i,retryCollab:a}=Ke(),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(null),f=typeof window<`u`?window.okDesktop:void 0,p,m;e[0]!==r||e[1]!==n?(p=()=>{if(n!==null||r){s(!1);return}let e=setTimeout(()=>s(!0),OC);return()=>clearTimeout(e)},m=[n,r],e[0]=r,e[1]=n,e[2]=p,e[3]=m):(p=e[2],m=e[3]),(0,Q.useEffect)(p,m);let h=kC(n,r,o);if(h===`hidden`)return null;if(h===`terminal`){let n;e[4]===i?n=e[5]:(n=AC(i),e[4]=i,e[5]=n);let r=n,o;e[6]===i?o=e[7]:(o=jC(i),e[6]=i,e[7]=o);let s=o,p;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(p=async()=>{if(f){d(null),l(!0);try{let e=await sd(f);e.ok||(d(e.message),l(!1))}catch{l(!1)}}},e[8]=p):p=e[8];let m=p,h;e[9]!==s||e[10]!==r?(h=(0,Z.jsx)(`span`,{children:r?(0,Z.jsx)(Y,{id:`AAlr5Y`,components:{0:(0,Z.jsx)(`code`,{className:`bg-red-100/60 px-1 rounded`})}}):(0,Z.jsx)(Y,{id:`noH1JX`,values:{errorDetail:s},components:{0:(0,Z.jsx)(`code`,{className:`bg-red-100/60 px-1 rounded`}),1:(0,Z.jsx)(`code`,{className:`bg-red-100/60 px-1 rounded`})}})}),e[9]=s,e[10]=r,e[11]=h):h=e[11];let g;e[12]===a?g=e[13]:(g=()=>{d(null),a()},e[12]=a,e[13]=g);let _;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(Y,{id:`6gRgw8`}),e[14]=_):_=e[14];let v;e[15]!==c||e[16]!==g?(v=(0,Z.jsx)(`button`,{type:`button`,onClick:g,disabled:c,className:`bg-red-950 text-red-50 px-2 py-0.5 rounded text-xs font-medium hover:bg-red-900 disabled:opacity-60`,children:_}),e[15]=c,e[16]=g,e[17]=v):v=e[17];let y;e[18]===c?y=e[19]:(y=f?(0,Z.jsx)(`button`,{type:`button`,onClick:m,disabled:c,className:`bg-red-950 text-red-50 px-2 py-0.5 rounded text-xs font-medium hover:bg-red-900 disabled:opacity-60`,children:c?(0,Z.jsx)(Y,{id:`0Er6-M`}):(0,Z.jsx)(Y,{id:`uaUc6t`})}):null,e[18]=c,e[19]=y);let b;e[20]===t?b=e[21]:(b=t?(0,Z.jsx)(`button`,{type:`button`,onClick:t,"aria-label":ic._({id:`MsARMw`}),title:ic._({id:`MsARMw`}),className:`ml-1 flex items-center rounded bg-red-100/60 px-1.5 py-1 transition-colors hover:bg-red-100/90`,children:(0,Z.jsx)(ur,{size:22,trackMouse:!1,variant:`sleeping`})}):null,e[20]=t,e[21]=b);let x;e[22]===u?x=e[23]:(x=u===null?null:(0,Z.jsx)(`span`,{className:`w-full text-red-950 text-xs`,children:u}),e[22]=u,e[23]=x);let S;return e[24]!==b||e[25]!==x||e[26]!==h||e[27]!==v||e[28]!==y?(S=(0,Z.jsxs)(`div`,{role:`alert`,"aria-live":`assertive`,className:`fixed top-0 inset-x-0 z-50 bg-red-500/95 text-red-950 text-sm text-center py-2 px-4 pl-[var(--ok-titlebar-reserve-left,1rem)] shadow-md flex items-center justify-center gap-3 flex-wrap`,children:[h,v,y,b,x]}),e[24]=b,e[25]=x,e[26]=h,e[27]=v,e[28]=y,e[29]=S):S=e[29],S}let g;return e[30]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:`fixed top-0 inset-x-0 z-50 bg-amber-500/95 text-amber-950 text-sm text-center py-2 px-4 pl-[var(--ok-titlebar-reserve-left,1rem)] shadow-md`,children:(0,Z.jsx)(Y,{id:`UYcGIW`})}),e[30]=g):g=e[30],g}function NC(e){let t=(0,$.c)(5),{bridge:n}=e,[r,i]=(0,Q.useState)(!1),a,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>qn(e=>{e===`new-project`&&i(!0)}),o=[],t[0]=a,t[1]=o):(a=t[0],o=t[1]),(0,Q.useEffect)(a,o);let s;return t[2]!==n||t[3]!==r?(s=(0,Z.jsx)(lx,{open:r,onOpenChange:i,bridge:n}),t[2]=n,t[3]=r,t[4]=s):s=t[4],s}function PC(e,t){e.chain().focus().insertContent({type:`text`,text:t}).run()}function FC(e){if(e.isDestroyed)return null;try{let t=e.view.coordsAtPos(e.state.selection.from);return{left:t.left,top:t.top,bottom:t.bottom}}catch{return null}}function IC(){let e=(0,$.c)(29),{_:t}=xn(),[n,r]=(0,Q.useState)(null),i,a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{let e=function(e){let t=e.detail;if(!t?.editor||t.editor.isDestroyed)return;let n=FC(t.editor);n&&r({editor:t.editor,...n})};return document.addEventListener(B,e),()=>document.removeEventListener(B,e)},a=[],e[0]=i,e[1]=a):(i=e[0],a=e[1]),(0,Q.useEffect)(i,a);let o=n?.editor??null,s,c;if(e[2]===o?(s=e[3],c=e[4]):(s=()=>{if(!o)return;let e=function(){let e=o,t=FC(e);r(n=>!n||n.editor!==e?n:t?{...n,...t}:null)};return document.addEventListener(`scroll`,e,{capture:!0,passive:!0}),window.addEventListener(`resize`,e),()=>{document.removeEventListener(`scroll`,e,{capture:!0}),window.removeEventListener(`resize`,e)}},c=[o],e[2]=o,e[3]=s,e[4]=c),(0,Q.useEffect)(s,c),!n)return null;let l;e[5]===n?l=e[6]:(l=function(e){if(!n)return;let{editor:t}=n;r(null),e&&!t.isDestroyed&&t.commands.focus()},e[5]=n,e[6]=l);let u=l,d;e[7]===u?d=e[8]:(d=e=>{e||u(!1)},e[7]=u,e[8]=d);let f=n.bottom-n.top,p;e[9]!==n.left||e[10]!==n.top||e[11]!==f?(p=(0,Z.jsx)(Em,{asChild:!0,children:(0,Z.jsx)(`span`,{"aria-hidden":!0,"data-testid":`emoji-picker-anchor`,className:`pointer-events-none fixed`,style:{left:n.left,top:n.top,height:f}})}),e[9]=n.left,e[10]=n.top,e[11]=f,e[12]=p):p=e[12];let m;e[13]===t?m=e[14]:(m=t({id:`pFPzHA`}),e[13]=t,e[14]=m);let h,g;e[15]===u?(h=e[16],g=e[17]):(g=()=>u(!0),h=()=>u(!1),e[15]=u,e[16]=h,e[17]=g);let _;e[18]===n.editor?_=e[19]:(_=(0,Z.jsx)(Nd,{onSelect:e=>{let t=n.editor;r(null),PC(t,e)}}),e[18]=n.editor,e[19]=_);let v;e[20]!==h||e[21]!==_||e[22]!==m||e[23]!==g?(v=(0,Z.jsx)(Dm,{className:`w-auto p-0`,align:`start`,"aria-label":m,"data-testid":`emoji-picker-popover`,onEscapeKeyDown:g,onInteractOutside:h,children:_}),e[20]=h,e[21]=_,e[22]=m,e[23]=g,e[24]=v):v=e[24];let y;return e[25]!==v||e[26]!==d||e[27]!==p?(y=(0,Z.jsxs)(Om,{open:!0,onOpenChange:d,children:[p,v]}),e[25]=v,e[26]=d,e[27]=p,e[28]=y):y=e[28],y}async function LC(e){let t=await fetch(`/api/tags/${encodeURIComponent(e)}`);if(!t.ok){let e=await t.json().catch(()=>null),n=t.status,r=t.statusText;throw Error(qc(e)??ic._({id:`lHwYMr`,values:{status:n,statusText:r}}))}return(await t.json()).docs??[]}function RC(){let e=(0,$.c)(18),[t,n]=(0,Q.useState)(!1),[r,i]=(0,Q.useState)(null),a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={kind:`idle`},e[0]=a):a=e[0];let[o,s]=(0,Q.useState)(a),c=(0,Q.useRef)(0),l,u;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>{let e=function(e){let t=e.detail;if(!t||typeof t.value!=`string`)return;let r=c.current+=1;i(t.value),n(!0),s({kind:`loading`}),LC(t.value).then(e=>{c.current===r&&s({kind:`ready`,docs:e})}).catch(e=>{c.current===r&&s({kind:`error`,message:e instanceof Error?e.message:String(e)})})};return document.addEventListener(m,e),()=>document.removeEventListener(m,e)},u=[],e[1]=l,e[2]=u):(l=e[1],u=e[2]),(0,Q.useEffect)(l,u);let d;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=function(e){n(!1),window.location.assign(ep(e))},e[3]=d):d=e[3];let f=d,p=r??``,h;e[4]===p?h=e[5]:(h={tagName:p},e[4]=p,e[5]=h);let g;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(g={0:(0,Z.jsx)(`span`,{className:`font-mono break-all`})},e[6]=g):g=e[6];let _;e[7]===h?_=e[8]:(_=(0,Z.jsx)(zp,{children:(0,Z.jsx)(Pp,{children:(0,Z.jsx)(Y,{id:`7H4UHD`,values:h,components:g})})}),e[7]=h,e[8]=_);let v=r??``,y;e[9]!==o||e[10]!==v?(y=(0,Z.jsx)(Ip,{children:(0,Z.jsx)(zC,{fetchState:o,tag:v,onSelectDoc:f})}),e[9]=o,e[10]=v,e[11]=y):y=e[11];let b;e[12]!==_||e[13]!==y?(b=(0,Z.jsxs)(Fp,{children:[_,y]}),e[12]=_,e[13]=y,e[14]=b):b=e[14];let x;return e[15]!==t||e[16]!==b?(x=(0,Z.jsx)(Bp,{open:t,onOpenChange:n,children:b}),e[15]=t,e[16]=b,e[17]=x):x=e[17],x}function zC(e){let t=(0,$.c)(15),{fetchState:n,tag:r,onSelectDoc:i}=e;if(n.kind===`idle`||n.kind===`loading`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(`p`,{className:`text-muted-foreground text-sm`,"data-testid":`tag-dialog-loading`,children:(0,Z.jsx)(Y,{id:`yQE2r9`})}),t[0]=e):e=t[0],e}if(n.kind===`error`){let e;return t[1]===n.message?e=t[2]:(e=(0,Z.jsx)(`p`,{className:`text-destructive text-sm`,"data-testid":`tag-dialog-error`,children:n.message}),t[1]=n.message,t[2]=e),e}if(n.docs.length===0){let e;t[3]===r?e=t[4]:(e={tag:r},t[3]=r,t[4]=e);let n;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(n={0:(0,Z.jsx)(`span`,{className:`font-mono`})},t[5]=n):n=t[5];let i;return t[6]===e?i=t[7]:(i=(0,Z.jsx)(`p`,{className:`text-muted-foreground text-sm`,"data-testid":`tag-dialog-empty`,children:(0,Z.jsx)(Y,{id:`lAiyU_`,values:e,components:n})}),t[6]=e,t[7]=i),i}let a;if(t[8]!==n.docs||t[9]!==i){let e;t[11]===i?e=t[12]:(e=e=>{let t=e.matchingTags??[];return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`button`,{type:`button`,className:`w-full rounded-md px-2 py-1.5 text-left text-sm hover:bg-muted focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-ring`,onClick:()=>i(e.docName),"data-testid":`tag-dialog-row`,children:[(0,Z.jsx)(`span`,{className:`block truncate font-medium`,children:e.title}),e.docName===e.title?null:(0,Z.jsx)(`span`,{className:`block truncate text-xs text-muted-foreground`,children:e.docName}),t.length>0?(0,Z.jsx)(`span`,{className:`mt-1 flex flex-wrap items-center gap-1`,"data-testid":`tag-dialog-row-matches`,children:t.map(BC)}):null]})},e.docName)},t[11]=i,t[12]=e),a=n.docs.map(e),t[8]=n.docs,t[9]=i,t[10]=a}else a=t[10];let o;return t[13]===a?o=t[14]:(o=(0,Z.jsx)(`ul`,{className:`flex flex-col gap-1`,"data-testid":`tag-dialog-list`,children:a}),t[13]=a,t[14]=o),o}function BC(e){return(0,Z.jsxs)(`span`,{"data-testid":`tag-dialog-row-match`,"data-tag":e,className:`tag pointer-events-none text-xs`,children:[`#`,e]},e)}var VC=`raw-mdx-nav`,HC=`ok-editor-mode-v1`,UC=[`wysiwyg`,`source`],WC=`wysiwyg`;function GC(e){return UC.includes(e)}function KC(e=localStorage){try{let t=e.getItem(HC);if(t===null)return WC;if(GC(t))return t;console.warn(`[editor-mode] invalid persisted value, falling back to default`,{raw:t})}catch{}return WC}function qC(e=window,t=localStorage){let n=e.__OK_EDITOR_MODE__;return GC(n)?n:KC(t)}function JC(e,t=localStorage){try{return t.setItem(HC,e),!0}catch(e){return console.warn(`[editor-mode] persist failed`,e),!1}}function YC(){let e=(0,$.c)(3),[t,n]=(0,Q.useState)(qC),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=function(e){n(e),JC(e)},e[0]=r):r=e[0];let i=r,a;return e[1]===t?a=e[2]:(a=[t,i],e[1]=t,e[2]=a),a}function XC(e){let t=(0,$.c)(4),{_:n}=xn(),r=(0,Q.useRef)(!1),i,a;t[0]!==n||t[1]!==e?(i=()=>{e===`no-push-permission`&&!r.current&&(r.current=!0,Us.info(n({id:`JkCD2u`})))},a=[e,n],t[0]=n,t[1]=e,t[2]=i,t[3]=a):(i=t[2],a=t[3]),(0,Q.useEffect)(i,a)}function ZC(e,t){return e===`follow`?(0,Z.jsx)(Y,{id:`Sxx_Zz`,values:{project:t}}):e===`full`?(0,Z.jsx)(Y,{id:`4zEZS5`,values:{project:t}}):(0,Z.jsx)(Y,{id:`AaaESH`,values:{project:t}})}function QC(){let e=(0,$.c)(8),{projectLocalConfig:t,projectLocalSynced:n,projectLocalBinding:r}=Gc(),i=(0,Q.useRef)(!1),a;e[0]!==r||e[1]!==t?.autoSync||e[2]!==n?(a=()=>{if(!n||i.current||r===null)return;let e=t?.autoSync;if(e?.inheritedNoticePending!==!0)return;i.current=!0;let a=typeof e.inheritedFrom==`string`?e.inheritedFrom:``;Us(ZC(Za({mode:e.mode,enabled:e.enabled}),a)),r.patch({autoSync:{inheritedNoticePending:null}})},e[0]=r,e[1]=t?.autoSync,e[2]=n,e[3]=a):a=e[3];let o;e[4]!==r||e[5]!==t||e[6]!==n?(o=[n,t,r],e[4]=r,e[5]=t,e[6]=n,e[7]=o):o=e[7],(0,Q.useEffect)(a,o)}var $C=`ok-terminal-placement-v1`;function ew(e){try{return ms((e??localStorage).getItem($C))}catch{return Ma}}function tw(e,t){try{(t??localStorage).setItem($C,e)}catch{}}var nw=`ok-terminal-right-width-v1`;function rw(e){try{let t=(e??localStorage).getItem(nw);if(t===null||t.trim()===``)return Yo;let n=Number(t);return Number.isFinite(n)?os(n):Yo}catch{return Yo}}function iw(e,t){try{(t??localStorage).setItem(nw,String(os(e)))}catch{}}function aw(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`?ow: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 ow(e){return e===`synced`?`synced`:`connected`}function sw(e){let t=(0,$.c)(36),{open:n,variant:r,onResolved:i}=e,{_:a}=xn(),o=wl(),s;t[0]!==a||t[1]!==i||t[2]!==r||t[3]!==o?(s=function(e){if(o===null){Us.error(a({id:`fiMNLl`}));return}let t=o(e?r===`follow`?`follow`:`full`:`off`);if(!t.ok){let n=t.error;Us.error(a(e?{id:`FUMerq`,values:{detail:n}}:{id:`0t0bbC`,values:{detail:n}}));return}i()},t[0]=a,t[1]=i,t[2]=r,t[3]=o,t[4]=s):s=t[4];let c=s,l;t[5]===r?l=t[6]:(l=(0,Z.jsx)(zp,{children:(0,Z.jsx)(El,{variant:r})}),t[5]=r,t[6]=l);let u;t[7]===r?u=t[8]:(u=(0,Z.jsx)(kl,{variant:r}),t[7]=r,t[8]=u);let d;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(`p`,{className:`mt-3 text-1sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`QYTOaN`,components:{0:(0,Z.jsx)(`span`,{className:`font-medium`})}})}),t[9]=d):d=t[9];let f;t[10]===u?f=t[11]:(f=(0,Z.jsxs)(Ip,{children:[u,d]}),t[10]=u,t[11]=f);let p;t[12]===c?p=t[13]:(p=()=>c(!1),t[12]=c,t[13]=p);let m=o===null,h;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(Y,{id:`IKoTAC`}),t[14]=h):h=t[14];let g;t[15]!==p||t[16]!==m?(g=(0,Z.jsx)(X,{variant:`outline`,className:`uppercase font-mono`,onClick:p,disabled:m,children:h}),t[15]=p,t[16]=m,t[17]=g):g=t[17];let _;t[18]===c?_=t[19]:(_=()=>c(!0),t[18]=c,t[19]=_);let v=o===null,y;t[20]===r?y=t[21]:(y=r===`follow`?(0,Z.jsx)(Y,{id:`U4nTfu`}):(0,Z.jsx)(Y,{id:`XU0OXn`}),t[20]=r,t[21]=y);let b;t[22]!==_||t[23]!==v||t[24]!==y?(b=(0,Z.jsx)(X,{onClick:_,disabled:v,children:y}),t[22]=_,t[23]=v,t[24]=y,t[25]=b):b=t[25];let x;t[26]!==b||t[27]!==g?(x=(0,Z.jsxs)(Lp,{children:[g,b]}),t[26]=b,t[27]=g,t[28]=x):x=t[28];let S;t[29]!==x||t[30]!==l||t[31]!==f?(S=(0,Z.jsxs)(Fp,{className:`sm:max-w-lg`,showCloseButton:!1,children:[l,f,x]}),t[29]=x,t[30]=l,t[31]=f,t[32]=S):S=t[32];let C;return t[33]!==n||t[34]!==S?(C=(0,Z.jsx)(Bp,{open:n,onOpenChange:cw,children:S}),t[33]=n,t[34]=S,t[35]=C):C=t[35],C}function cw(){}function lw(e){if(!(!e.autoSyncOnboardingDismissed&&e.hasRemote===!0&&e.projectLocalSynced===!0&&e.projectSynced===!0&&e.projectLocalConfig!==null&&Za(e.projectLocalConfig.autoSync??void 0)===null&&ns(e.projectConfig?.autoSync?.default)===null))return null;switch(e.pushPermissionCheckStatus){case`allowed`:return`full`;case`denied`:return`follow`;default:return null}}function uw(e){let t=(0,$.c)(57),{primary:n,onPrimary:r,primaryDisabled:i,enabledTargets:a,selectedTargetId:o,onSelectTarget:s,threadAgents:c,onOpenSettings:l,terminal:u,terminals:d,menuEmptyState:f,menuLeading:p,onMenuOpenChange:m,menuAlign:h,triggerAriaLabel:g,testIds:_}=e,v=i===void 0?!1:i,y=h===void 0?`end`:h,{_:b}=xn(),x=a.length>0,S=d&&d.length>0?d:null,C=S!=null||u!=null,w=x||C,T=c!==void 0&&c.length>0,E;t[0]===_?E=t[1]:(E=e=>typeof _.terminal==`function`?_.terminal(e):_.terminal,t[0]=_,t[1]=E);let D=E,O;t[2]!==r||t[3]!==n||t[4]!==v||t[5]!==_.primary?(O=(0,Z.jsx)(X,{type:`button`,variant:`outline`,className:`gap-1.5`,disabled:v,onClick:r,"data-testid":_.primary,children:n}),t[2]=r,t[3]=n,t[4]=v,t[5]=_.primary,t[6]=O):O=t[6];let k;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Z.jsx)(Zl,{"aria-hidden":`true`,className:`size-3.5 text-muted-foreground`}),t[7]=k):k=t[7];let A;t[8]!==_.trigger||t[9]!==g?(A=(0,Z.jsx)(Ri,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`outline`,size:`icon`,"aria-label":g,"data-testid":_.trigger,children:k})}),t[8]=_.trigger,t[9]=g,t[10]=A):A=t[10];let j;t[11]!==w||t[12]!==p||t[13]!==T?(j=p?(0,Z.jsxs)(Z.Fragment,{children:[p,T||w?(0,Z.jsx)(Gi,{}):null]}):null,t[11]=w,t[12]=p,t[13]=T,t[14]=j):j=t[14];let M;t[15]!==b||t[16]!==w||t[17]!==T||t[18]!==_||t[19]!==c?(M=T?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Ii,{"aria-label":b({id:`vPKX2i`}),children:[(0,Z.jsxs)(Bi,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(Y,{id:`RXEbZy`}),(0,Z.jsx)(Ci,{})]}),c?.map(e=>(0,Z.jsxs)(Mi,{onSelect:e.onSelect,"data-testid":_.threadAgent?.(e.key),children:[(0,Z.jsx)(Ll,{agentId:e.id,iconUrl:e.iconUrl,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1 truncate`,children:e.name}),e.selected?(0,Z.jsx)(Yl,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.key))]}),w?(0,Z.jsx)(Gi,{}):null]}):null,t[15]=b,t[16]=w,t[17]=T,t[18]=_,t[19]=c,t[20]=M):M=t[20];let N;t[21]!==b||t[22]!==S||t[23]!==a||t[24]!==w||t[25]!==s||t[26]!==o||t[27]!==x||t[28]!==C||t[29]!==u||t[30]!==D||t[31]!==_?(N=w?(0,Z.jsxs)(Z.Fragment,{children:[C?(0,Z.jsxs)(Ii,{"aria-label":b({id:`ALhMYW`}),children:[(0,Z.jsx)(Bi,{children:(0,Z.jsx)(Y,{id:`ALhMYW`})}),S?S.map(e=>(0,Z.jsxs)(Mi,{onSelect:e.onSelect,"data-testid":D(e.cli),"aria-label":e.ariaLabel,children:[(0,Z.jsx)(Ai,{id:Di(e.cli),className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:e.label}),e.selected?(0,Z.jsx)(Yl,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.cli)):u?(0,Z.jsxs)(Mi,{onSelect:u.onSelect,"data-testid":D(`claude`),"aria-label":b({id:`AcK_r0`}),children:[(0,Z.jsx)(Ai,{id:Di(`claude`),className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(Y,{id:`fcgvCA`})}),u.selected?(0,Z.jsx)(Yl,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]}):null]}):null,x?(0,Z.jsxs)(Z.Fragment,{children:[C?(0,Z.jsx)(Gi,{}):null,(0,Z.jsxs)(Ii,{"aria-label":b({id:`BwKH4d`}),children:[(0,Z.jsxs)(Bi,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(Y,{id:`BwKH4d`}),(0,Z.jsx)(Fl,{"aria-hidden":`true`,className:`size-3`})]}),a.map(e=>(0,Z.jsxs)(Mi,{onSelect:()=>s(e),"data-testid":_.option(e.id),children:[(0,Z.jsx)(Ai,{id:e.id,"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(nl,{displayName:e.displayName})}),o===e.id?(0,Z.jsx)(Yl,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.id))]})]}):null]}):null,t[21]=b,t[22]=S,t[23]=a,t[24]=w,t[25]=s,t[26]=o,t[27]=x,t[28]=C,t[29]=u,t[30]=D,t[31]=_,t[32]=N):N=t[32];let P=!T&&!w?f:null,F;t[33]!==w||t[34]!==T?(F=T||w?(0,Z.jsx)(Gi,{}):null,t[33]=w,t[34]=T,t[35]=F):F=t[35];let I;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(Yn,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}),t[36]=I):I=t[36];let L;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(Y,{id:`jRAGrQ`})}),t[37]=L):L=t[37];let R;t[38]!==l||t[39]!==_.settings?(R=(0,Z.jsxs)(Mi,{onSelect:l,"data-testid":_.settings,children:[I,L]}),t[38]=l,t[39]=_.settings,t[40]=R):R=t[40];let z;t[41]!==y||t[42]!==P||t[43]!==F||t[44]!==R||t[45]!==j||t[46]!==M||t[47]!==N||t[48]!==_.menu?(z=(0,Z.jsxs)(Hi,{align:y,className:`max-h-80 min-w-[200px]`,"data-testid":_.menu,children:[j,M,N,P,F,R]}),t[41]=y,t[42]=P,t[43]=F,t[44]=R,t[45]=j,t[46]=M,t[47]=N,t[48]=_.menu,t[49]=z):z=t[49];let B;t[50]!==m||t[51]!==z||t[52]!==A?(B=(0,Z.jsxs)(Wi,{modal:!1,onOpenChange:m,children:[A,z]}),t[50]=m,t[51]=z,t[52]=A,t[53]=B):B=t[53];let V;return t[54]!==B||t[55]!==O?(V=(0,Z.jsxs)(Zi,{children:[O,B]}),t[54]=B,t[55]=O,t[56]=V):V=t[56],V}function dw(e){let t=(0,$.c)(9),{onStartNewChat:n}=e,{_:r}=xn(),i;t[0]===r?i=t[1]:(i=r({id:`j15ZSH`}),t[0]=r,t[1]=i);let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(Kn,{className:`size-4`}),t[2]=a):a=t[2];let o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(`span`,{className:`flex-1 truncate`,children:(0,Z.jsx)(Y,{id:`vPF04k`})}),t[3]=o):o=t[3];let s;t[4]===n?s=t[5]:(s=(0,Z.jsxs)(Mi,{onSelect:n,className:`gap-2`,"data-testid":`comment-queue-send-new`,children:[a,o]}),t[4]=n,t[5]=s);let c;return t[6]!==i||t[7]!==s?(c=(0,Z.jsx)(Ii,{"aria-label":i,children:s}),t[6]=i,t[7]=s,t[8]=c):c=t[8],c}function fw(){let e=(0,$.c)(12),t=di(),n=pi(),r=fi(),i,a;if(e[0]!==r||e[1]!==t||e[2]!==n){let o;e[5]===t?o=e[6]:(o=e=>gi(t,e.source,e.id,!0,e.supported),e[5]=t,e[6]=o);let s=n.filter(o),c=mi(s,r);a=c,i=s.map(e=>({key:`${e.source}:${e.id}`,id:e.id,name:e.name,...e.iconUrl===void 0?{}:{iconUrl:e.iconUrl},selected:c!==null&&c.source===e.source&&c.id===e.id,onSelect:()=>{ui(e),jc(_c)}})),e[0]=r,e[1]=t,e[2]=n,e[3]=i,e[4]=a}else i=e[3],a=e[4];let o;e[7]===i?o=e[8]:(o={threadAgents:i},e[7]=i,e[8]=o);let s;return e[9]!==a||e[10]!==o?(s={threadAgent:a,rows:o},e[9]=a,e[10]=o,e[11]=s):s=e[11],s}function pw(e){let t=(0,$.c)(49),{threadIds:n,testIdPrefix:r}=e,{_:i}=xn(),a=fw(),o=yb(),s=Sc(),c=s?.kind===`thread`?s:null,l=Sb(),u;t[0]!==c||t[1]!==a.threadAgent?.iconUrl||t[2]!==a.threadAgent?.id?(u=c===null?(0,Z.jsx)(Ll,{agentId:a.threadAgent?.id??``,iconUrl:a.threadAgent?.iconUrl,className:`size-4`}):(0,Z.jsx)(Ll,{agentId:c.agentId,iconUrl:c.iconUrl,className:`size-4`}),t[0]=c,t[1]=a.threadAgent?.iconUrl,t[2]=a.threadAgent?.id,t[3]=u):u=t[3];let d=u,f;t[4]===i?f=t[5]:(f=i({id:`LaskKp`,values:{0:Ys(`send-comment-queue`)}}),t[4]=i,t[5]=f);let p;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(p=Js(`send-comment-queue`),t[6]=p):p=t[6];let m;t[7]===f?m=t[8]:(m=(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 font-sans text-xs leading-none text-muted-foreground`,title:f,children:p}),t[7]=f,t[8]=m);let h;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(h=[],t[9]=h):h=t[9];let g;t[10]===c?g=t[11]:(g=(0,Z.jsx)(`span`,{className:`truncate`,children:c===null?(0,Z.jsx)(Y,{id:`vPF04k`}):(0,Z.jsx)(Y,{id:`sKEgGd`})}),t[10]=c,t[11]=g);let _;t[12]!==d||t[13]!==g?(_=(0,Z.jsxs)(Z.Fragment,{children:[d,g]}),t[12]=d,t[13]=g,t[14]=_):_=t[14];let v;t[15]!==l||t[16]!==n?(v=()=>l(n),t[15]=l,t[16]=n,t[17]=v):v=t[17];let y=n.length===0,b;t[18]!==o||t[19]!==c||t[20]!==n?(b=c===null?void 0:(0,Z.jsx)(dw,{onStartNewChat:()=>void Nt({compose:o,threadIds:n})}),t[18]=o,t[19]=c,t[20]=n,t[21]=b):b=t[21];let x;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(`p`,{className:`px-2 py-1.5 text-sm text-muted-foreground`,"aria-live":`polite`,children:(0,Z.jsx)(Y,{id:`t9Qn8y`})}),t[22]=x):x=t[22];let S;t[23]===i?S=t[24]:(S=i({id:`nbLQ_9`}),t[23]=i,t[24]=S);let C=`${r}-send`,w=`${r}-send-trigger`,T=`${r}-send-menu`,E,D;t[25]===r?(E=t[26],D=t[27]):(E=e=>`${r}-agent-option-${e}`,D=e=>`${r}-agent-option-thread-${e}`,t[25]=r,t[26]=E,t[27]=D);let O=`${r}-agent-option-settings`,k;t[28]===r?k=t[29]:(k=e=>`${r}-agent-option-terminal-${e}`,t[28]=r,t[29]=k);let A;t[30]!==C||t[31]!==w||t[32]!==T||t[33]!==E||t[34]!==D||t[35]!==O||t[36]!==k?(A={primary:C,trigger:w,menu:T,option:E,threadAgent:D,settings:O,terminal:k},t[30]=C,t[31]=w,t[32]=T,t[33]=E,t[34]=D,t[35]=O,t[36]=k,t[37]=A):A=t[37];let j;t[38]!==a.rows||t[39]!==b||t[40]!==S||t[41]!==A||t[42]!==_||t[43]!==v||t[44]!==y?(j=(0,Z.jsx)(uw,{enabledTargets:h,selectedTargetId:null,onSelectTarget:mw,primary:_,onPrimary:v,primaryDisabled:y,menuLeading:b,onOpenSettings:Xs,menuEmptyState:x,triggerAriaLabel:S,testIds:A,...a.rows}),t[38]=a.rows,t[39]=b,t[40]=S,t[41]=A,t[42]=_,t[43]=v,t[44]=y,t[45]=j):j=t[45];let M;return t[46]!==j||t[47]!==m?(M=(0,Z.jsx)(yh,{className:`justify-end`,children:(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[m,j]})}),t[46]=j,t[47]=m,t[48]=M):M=t[48],M}function mw(){}function hw(e){let t=new Map;for(let n of e){let e=t.get(n.docName);e?e.push(n):t.set(n.docName,[n])}return[...t].map(([e,t])=>({docName:e,threads:t}))}function gw(e,t){let n=new Date(e),r=new Date(t),i=n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()&&n.getDate()===r.getDate(),a={hour:`numeric`,minute:`2-digit`};return i?n.toLocaleTimeString(void 0,a):n.getFullYear()===r.getFullYear()?n.toLocaleString(void 0,{month:`short`,day:`numeric`,...a}):n.toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,...a})}function _w(e){let t=(0,$.c)(104),{thread:n,cardRef:r,focused:i,active:a,sending:o}=e,{_:s}=xn(),[c]=(0,Q.useState)(yw),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(!1),p=(0,Q.useRef)(null),m=n.status===`orphaned`,h=n.status===`resolved`,_=(0,Q.useRef)(n.body),v;t[0]===n.body?v=t[1]:(v=()=>{_.current=n.body},t[0]=n.body,t[1]=v),(0,Q.useEffect)(v);let y=(0,Q.useRef)(null),b=(0,Q.useRef)(!1),x,S;t[2]===l?(x=t[3],S=t[4]):(x=()=>{l&&(b.current=!1,y.current=null,p.current?.setText(_.current),p.current?.focusEnd())},S=[l],t[2]=l,t[3]=x,t[4]=S),(0,Q.useEffect)(x,S);let C;t[5]===n.id?C=t[6]:(C=function(e){if(b.current)return;b.current=!0,u(!1);let t=(e??``).trim();t.length===0||t===_.current||tn(n.id,t)},t[5]=n.id,t[6]=C);let w=C,T;t[7]===w?T=t[8]:(T=function(){w(p.current?.getContent().instruction??null)},t[7]=w,t[8]=T);let E=T,D;t[9]===w?D=t[10]:(D=function(){w(null)},t[9]=w,t[10]=D);let O=D,k;t[11]!==O||t[12]!==n.id?(k=function(){O(),tt(n.id)},t[11]=O,t[12]=n.id,t[13]=k):k=t[13];let A=k,j;t[14]!==l||t[15]!==w?(j=()=>{if(l)return()=>{w(y.current)}},t[14]=l,t[15]=w,t[16]=j):j=t[16];let M;t[17]===l?M=t[18]:(M=[l],t[17]=l,t[18]=M),(0,Q.useEffect)(j,M);let N;t[19]===n?N=t[20]:(N=function(e){if(n.anchor===null)return;if(Se(n.docName)===null){hf(n);return}if(n.target.kind===`property`){mf({key:n.target.key,path:n.target.path,quote:e,start:n.anchor.start,end:n.anchor.end}),dt(n.id);return}let t=Se(n.docName);if(!t)return;let r=Cf(t.state.doc,e,n.anchor);r&&(Af(t,r,n.docName),dt(n.id))},t[19]=n,t[20]=N);let P=N,F;t[21]!==n.docName||t[22]!==n.id?(F=function(){let e=Se(n.docName);if(!e)return;let{from:t,to:r,empty:i}=e.state.selection;if(i)return;let a=e.state.doc.textBetween(t,r,` `).trim();a.length>0&&ye(n.id,a,yf(e.state.doc,t,r))},t[21]=n.docName,t[22]=n.id,t[23]=F):F=t[23];let I=F,L=!l&&!h,R,z,B,V;t[24]===n.id?(R=t[25],z=t[26],B=t[27],V=t[28]):(R=()=>g(n.id),z=()=>Je(n.id),B=()=>g(n.id),V=()=>Je(n.id),t[24]=n.id,t[25]=R,t[26]=z,t[27]=B,t[28]=V);let H;t[29]!==L||t[30]!==n.id?(H=e=>{if(!L||e.target?.closest(`button, [role="checkbox"], [role="textbox"], a, input, textarea`))return;let t=window.getSelection();t!==null&&!t.isCollapsed&&t.anchorNode!==null&&e.currentTarget.contains(t.anchorNode)||Dt(n.id)},t[29]=L,t[30]=n.id,t[31]=H):H=t[31];let U=L&&`cursor-pointer`,ee=h&&`opacity-70`,W=a&&`bg-amber-500/10`,te=i&&`ring-2 ring-primary`,G;t[32]!==U||t[33]!==ee||t[34]!==W||t[35]!==te?(G=Qn(`flex flex-col gap-1.5 rounded-lg border p-2.5 transition-[box-shadow,border-color,background-color]`,U,ee,W,te),t[32]=U,t[33]=ee,t[34]=W,t[35]=te,t[36]=G):G=t[36];let K;t[37]!==s||t[38]!==h||t[39]!==o||t[40]!==n.id?(K=!h&&(0,Z.jsx)($r,{checked:o,onCheckedChange:()=>Dt(n.id),"aria-label":s(o?{id:`1jym2J`}:{id:`t7YoBO`})}),t[37]=s,t[38]=h,t[39]=o,t[40]=n.id,t[41]=K):K=t[41];let q;t[42]===n.updatedAt?q=t[43]:(q=new Date(n.updatedAt).toLocaleString(),t[42]=n.updatedAt,t[43]=q);let ne;t[44]!==c||t[45]!==n.updatedAt?(ne=gw(n.updatedAt,c),t[44]=c,t[45]=n.updatedAt,t[46]=ne):ne=t[46];let re;t[47]!==q||t[48]!==ne?(re=(0,Z.jsx)(`span`,{className:`shrink-0 text-[10px] text-muted-foreground`,title:q,children:ne}),t[47]=q,t[48]=ne,t[49]=re):re=t[49];let J;t[50]!==K||t[51]!==re?(J=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[K,re]}),t[50]=K,t[51]=re,t[52]=J):J=t[52];let ie;t[53]===h?ie=t[54]:(ie=h&&(0,Z.jsxs)(wm,{variant:`outline`,className:`gap-1 border-green-600/40 text-green-700 dark:text-green-500`,children:[(0,Z.jsx)(ly,{className:`size-2.5`}),(0,Z.jsx)(Y,{id:`O6H89R`})]}),t[53]=h,t[54]=ie);let ae;t[55]!==s||t[56]!==l||t[57]!==h?(ae=!h&&(0,Z.jsxs)(br,{children:[(0,Z.jsx)(_r,{asChild:!0,children:(0,Z.jsx)(X,{size:`sm`,variant:`ghost`,"aria-label":s({id:`akmOT9`}),"aria-expanded":l,className:Qn(`size-6 p-0`,l?`text-foreground`:`text-muted-foreground hover:text-foreground`),onClick:()=>u(vw),children:(0,Z.jsx)(_n,{className:`size-3.5`})})}),(0,Z.jsx)(vr,{children:(0,Z.jsx)(Y,{id:`akmOT9`})})]}),t[55]=s,t[56]=l,t[57]=h,t[58]=ae):ae=t[58];let oe;t[59]===s?oe=t[60]:(oe=s({id:`X2zUS5`}),t[59]=s,t[60]=oe);let se;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,Z.jsx)(Hf,{className:`size-3.5`}),t[61]=se):se=t[61];let ce;t[62]!==A||t[63]!==oe?(ce=(0,Z.jsx)(_r,{asChild:!0,children:(0,Z.jsx)(X,{size:`sm`,variant:`ghost`,className:`size-6 p-0 text-muted-foreground hover:text-destructive`,"aria-label":oe,onClick:A,children:se})}),t[62]=A,t[63]=oe,t[64]=ce):ce=t[64];let le;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,Z.jsx)(vr,{children:(0,Z.jsx)(Y,{id:`X2zUS5`})}),t[65]=le):le=t[65];let ue;t[66]===ce?ue=t[67]:(ue=(0,Z.jsxs)(br,{children:[ce,le]}),t[66]=ce,t[67]=ue);let de;t[68]!==ie||t[69]!==ae||t[70]!==ue?(de=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[ie,ae,ue]}),t[68]=ie,t[69]=ae,t[70]=ue,t[71]=de):de=t[71];let fe;t[72]!==J||t[73]!==de?(fe=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[J,de]}),t[72]=J,t[73]=de,t[74]=fe):fe=t[74];let pe;t[75]!==m||t[76]!==P||t[77]!==n.anchor||t[78]!==n.target?(pe=m?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-0.5 rounded border-l-2 border-muted-foreground/40 bg-muted/40 px-2 py-1`,children:[n.anchor!==null&&(0,Z.jsxs)(`p`,{className:`truncate text-xs text-muted-foreground line-through`,title:n.anchor.quote,children:[`“`,n.anchor.quote,`”`]}),(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`05F1GY`})})]}):(0,Z.jsxs)(br,{children:[(0,Z.jsx)(_r,{asChild:!0,children:(0,Z.jsx)(`span`,{className:`w-full`,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,disabled:n.anchor===null,onClick:()=>P(n.anchor?.quote??``),className:`h-auto w-full justify-start truncate rounded border-l-2 border-muted-foreground/40 bg-muted/40 px-2 py-1 text-left text-xs font-normal text-muted-foreground hover:bg-muted/70 disabled:opacity-100`,children:(0,Z.jsx)(`span`,{className:`truncate`,children:n.target.kind===`property`?(0,Z.jsxs)(`span`,{className:`font-mono`,children:[xf(n.target.key,n.target.path),`:`,n.anchor===null?``:` “${n.anchor.quote}”`]}):(0,Z.jsxs)(Z.Fragment,{children:[`“`,n.anchor?.quote??``,`”`]})})})})}),(0,Z.jsx)(vr,{children:n.anchor===null?(0,Z.jsx)(Y,{id:`aoT2xX`}):n.target.kind===`property`?(0,Z.jsx)(Y,{id:`FiyNln`}):(0,Z.jsx)(Y,{id:`DpjYd6`})})]}),t[75]=m,t[76]=P,t[77]=n.anchor,t[78]=n.target,t[79]=pe):pe=t[79];let me;t[80]!==s||t[81]!==O||t[82]!==E||t[83]!==d||t[84]!==l||t[85]!==n.body?(me=l?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Z.jsx)(ea,{ref:p,ariaLabel:s({id:`akmOT9`}),placeholder:s({id:`akmOT9`}),onEmptyChange:f,onContentChange:()=>{y.current=p.current?.getContent().instruction??null},onSubmit:E,onEscape:O,className:`max-h-40 overflow-y-auto rounded-md border px-2 py-1 text-sm`}),(0,Z.jsxs)(`div`,{className:`flex items-center justify-end gap-1.5`,children:[(0,Z.jsx)(X,{size:`sm`,variant:`ghost`,onClick:O,children:(0,Z.jsx)(Y,{id:`dEgA5A`})}),(0,Z.jsx)(X,{size:`sm`,onClick:E,disabled:d,"aria-label":s({id:`3W5kYZ`}),children:(0,Z.jsx)(Y,{id:`tfDRzk`})})]})]}):(0,Z.jsx)(`p`,{"data-testid":`thread-comment-body`,className:`text-sm text-foreground/90`,children:n.body}),t[80]=s,t[81]=O,t[82]=E,t[83]=d,t[84]=l,t[85]=n.body,t[86]=me):me=t[86];let he;t[87]!==m||t[88]!==h||t[89]!==I||t[90]!==n.id?(he=m?(0,Z.jsxs)(X,{size:`sm`,variant:`outline`,className:`min-w-0`,onClick:I,children:[(0,Z.jsx)(ff,{className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:(0,Z.jsx)(Y,{id:`QlkiD5`})})]}):(0,Z.jsx)(Z.Fragment,{children:h&&(0,Z.jsx)(`div`,{className:`flex min-w-0 flex-nowrap items-center justify-end gap-1.5`,children:(0,Z.jsxs)(X,{size:`sm`,variant:`outline`,className:`min-w-0`,onClick:()=>dn(n.id),children:[(0,Z.jsx)(la,{className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:(0,Z.jsx)(Y,{id:`M7SqjM`})})]})})}),t[87]=m,t[88]=h,t[89]=I,t[90]=n.id,t[91]=he):he=t[91];let ge;return t[92]!==r||t[93]!==R||t[94]!==z||t[95]!==B||t[96]!==V||t[97]!==H||t[98]!==G||t[99]!==fe||t[100]!==pe||t[101]!==me||t[102]!==he?(ge=(0,Z.jsxs)(`article`,{ref:r,onPointerEnter:R,onPointerLeave:z,onFocusCapture:B,onBlurCapture:V,onClick:H,className:G,children:[fe,pe,me,he]}),t[92]=r,t[93]=R,t[94]=z,t[95]=B,t[96]=V,t[97]=H,t[98]=G,t[99]=fe,t[100]=pe,t[101]=me,t[102]=he,t[103]=ge):ge=t[103],ge}function vw(e){return!e}function yw(){return Date.now()}var bw=20,xw=1600;function Sw(e,t){let{cards:n,frame:r,ring:i,setFocusedId:a}=t;a(()=>e),r.current!==null&&cancelAnimationFrame(r.current);let o=0,s=()=>{r.current=null;let t=n.get(e);if(t){let e=window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches;t.scrollIntoView({block:`center`,behavior:e?`auto`:`smooth`});return}o+=1,!(o>=bw)&&(r.current=requestAnimationFrame(s))};s(),i.current!==null&&window.clearTimeout(i.current),i.current=window.setTimeout(()=>{i.current=null,a(t=>t===e?null:t)},xw)}function Cw(e){let t=(0,$.c)(52),{threads:n,groupByDocument:r,empty:i,testIdPrefix:a,scopeSwitch:o}=e,s=r===void 0?!1:r,{_:c}=xn(),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(null),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=new Map,t[0]=p):p=t[0];let m=(0,Q.useRef)(p),[h,g]=(0,Q.useState)(Mw),_=T(),v=le(),y;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(y=function(e,t){g(n=>{let r=new Set(n);return t?r.delete(e):r.add(e),r})},t[1]=y):y=t[1];let b=y,x=(0,Q.useRef)(null),S=(0,Q.useRef)(null),C;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(C=()=>({cards:m.current,frame:S,ring:x,setFocusedId:f}),t[2]=C):C=t[2];let w=C,E,D;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(E=()=>{let e=e=>Sw(e,w()),t=yt();t!==null&&e(t);let n=At(t=>{t!==null&&e(t)}),r=se(e);return()=>{n(),r(),x.current!==null&&window.clearTimeout(x.current),S.current!==null&&cancelAnimationFrame(S.current)}},D=[],t[3]=E,t[4]=D):(E=t[3],D=t[4]),(0,Q.useEffect)(E,D);let O,k,A,j,M,N,P,F,I;if(t[5]!==c||t[6]!==v||t[7]!==h||t[8]!==i||t[9]!==d||t[10]!==s||t[11]!==o||t[12]!==_||t[13]!==l||t[14]!==a||t[15]!==n){A=n.filter(jw);let e=n.filter(Aw),r=l?n:A,f=s?hw(r):[],p=f.length>0&&f.every(e=>h.has(e.docName)),y;t[25]===_?y=t[26]:(y=e=>_.includes(e.id),t[25]=_,t[26]=y),j=A.filter(y).map(kw);let x=A.map(Ow),S=x.length>0&&j.length===x.length,C;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(C=function(e){return e.threads.filter(Dw).map(Ew)},t[27]=C):C=t[27];let w=C,T;t[28]===_?T=t[29]:(T=function(e){let t=e.filter(e=>_.includes(e)).length;return t===0?!1:t===e.length?!0:`indeterminate`},t[28]=_,t[29]=T);let E=T,D=function(e){return(0,Z.jsx)(_w,{thread:e,sending:_.includes(e.id),active:v===e.id,focused:d===e.id,cardRef:t=>{t?m.current.set(e.id,t):m.current.delete(e.id)}},e.id)};k=Sh;let L;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(gh,{children:(0,Z.jsx)(Y,{id:`VbyRUy`})}),t[30]=L):L=t[30];let R=e.length>0&&(0,Z.jsxs)(br,{children:[(0,Z.jsx)(_r,{asChild:!0,children:(0,Z.jsxs)(X,{size:`sm`,variant:`ghost`,className:`h-6 shrink-0 gap-1 px-1.5 text-muted-foreground`,"aria-label":c(l?{id:`PHHEuH`,values:{0:e.length}}:{id:`gHb5bB`,values:{0:e.length}}),"aria-pressed":l,"data-testid":`${a}-resolved-toggle`,onClick:()=>u(Tw),children:[l?(0,Z.jsx)(uy,{"aria-hidden":`true`,className:`size-3.5`}):(0,Z.jsx)(ly,{"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`text-[11px] tabular-nums`,children:e.length})]})}),(0,Z.jsx)(vr,{children:l?(0,Z.jsx)(Y,{id:`LRLKnQ`}):(0,Z.jsx)(Y,{id:`o7AkQ0`})})]}),z=f.length>1&&(0,Z.jsxs)(br,{children:[(0,Z.jsx)(_r,{asChild:!0,children:(0,Z.jsx)(X,{size:`icon`,variant:`ghost`,className:`size-6 shrink-0 text-muted-foreground`,"aria-label":c(p?{id:`QIrBIx`}:{id:`sR0I-f`}),"data-testid":`${a}-collapse-toggle`,onClick:()=>g(p?new Set:new Set(f.map(ww))),children:p?(0,Z.jsx)(hb,{"aria-hidden":`true`,className:`size-3.5`}):(0,Z.jsx)(Cy,{"aria-hidden":`true`,className:`size-3.5`})})}),(0,Z.jsx)(vr,{children:p?(0,Z.jsx)(Y,{id:`QIrBIx`}):(0,Z.jsx)(Y,{id:`sR0I-f`})})]}),B;t[31]===A.length?B=t[32]:(B=(0,Z.jsx)(bh,{children:A.length}),t[31]=A.length,t[32]=B),t[33]!==R||t[34]!==z||t[35]!==B?(I=(0,Z.jsxs)(xh,{children:[L,(0,Z.jsxs)(`div`,{className:`flex items-center gap-1`,children:[R,z,B]})]}),t[33]=R,t[34]=z,t[35]=B,t[36]=I):I=t[36],M=o,N=A.length>0&&(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 px-4`,children:[(0,Z.jsx)($r,{checked:S,onCheckedChange:()=>sn(x,!S),"aria-label":c(S?{id:`Ns5f4J`}:{id:`8oWgty`}),"data-testid":`${a}-select-all`}),(0,Z.jsxs)(`span`,{className:`text-[11px] text-muted-foreground tabular-nums`,children:[j.length,`/`,x.length]})]}),O=vh,P=`flex flex-col gap-3`,F=r.length===0?(0,Z.jsx)(_h,{children:i}):s?f.map(e=>{let t=w(e),n=E(t);return(0,Z.jsx)(`section`,{"aria-label":e.docName,children:(0,Z.jsxs)(Cr,{open:!h.has(e.docName),onOpenChange:t=>b(e.docName,t),className:`flex flex-col gap-2`,children:[(0,Z.jsxs)(`div`,{className:`group/file flex items-center gap-1.5`,children:[(0,Z.jsx)($r,{checked:n,disabled:t.length===0,onCheckedChange:()=>sn(t,n!==!0),"aria-label":c(n===!0?{id:`T2fvhw`,values:{0:Df(e.docName)}}:{id:`WkQ0Z_`,values:{0:Df(e.docName)}}),"data-testid":`${a}-file-select-${e.docName}`,className:`opacity-0 transition-opacity focus-visible:opacity-100 group-hover/file:opacity-100`}),(0,Z.jsxs)(Sr,{title:e.docName,className:`group flex min-w-0 flex-1 cursor-pointer items-center gap-1.5 rounded text-left text-[11px] text-muted-foreground hover:text-foreground`,children:[(0,Z.jsx)(Xr,{className:`size-3 shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:Df(e.docName)}),(0,Z.jsx)(wm,{variant:`outline`,className:`shrink-0 px-1 py-0 text-[10px] tabular-nums`,children:e.threads.length}),(0,Z.jsx)(Ql,{"aria-hidden":`true`,className:`size-3 shrink-0 transition-transform group-data-[state=open]:rotate-90 motion-reduce:transition-none`})]})]}),(0,Z.jsx)(xr,{className:`flex flex-col gap-2 overflow-hidden data-[state=open]:animate-[collapsible-down_150ms_ease-out] data-[state=closed]:animate-[collapsible-up_150ms_ease-in] motion-reduce:animate-none`,children:e.threads.map(D)})]})},e.docName)}):r.map(D),t[5]=c,t[6]=v,t[7]=h,t[8]=i,t[9]=d,t[10]=s,t[11]=o,t[12]=_,t[13]=l,t[14]=a,t[15]=n,t[16]=O,t[17]=k,t[18]=A,t[19]=j,t[20]=M,t[21]=N,t[22]=P,t[23]=F,t[24]=I}else O=t[16],k=t[17],A=t[18],j=t[19],M=t[20],N=t[21],P=t[22],F=t[23],I=t[24];let L;t[37]!==O||t[38]!==P||t[39]!==F?(L=(0,Z.jsx)(O,{className:P,children:F}),t[37]=O,t[38]=P,t[39]=F,t[40]=L):L=t[40];let R;t[41]!==A.length||t[42]!==j||t[43]!==a?(R=A.length>0&&(0,Z.jsx)(pw,{threadIds:j,testIdPrefix:a}),t[41]=A.length,t[42]=j,t[43]=a,t[44]=R):R=t[44];let z;return t[45]!==k||t[46]!==M||t[47]!==N||t[48]!==L||t[49]!==R||t[50]!==I?(z=(0,Z.jsxs)(k,{children:[I,M,N,L,R]}),t[45]=k,t[46]=M,t[47]=N,t[48]=L,t[49]=R,t[50]=I,t[51]=z):z=t[51],z}function ww(e){return e.docName}function Tw(e){return!e}function Ew(e){return e.id}function Dw(e){return e.status!==`resolved`}function Ow(e){return e.id}function kw(e){return e.id}function Aw(e){return e.status===`resolved`}function jw(e){return e.status!==`resolved`}function Mw(){return new Set}function Nw(e){let t=(0,$.c)(4),{scopeSwitch:n}=e,r=K(),i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(Y,{id:`QzofTX`}),t[0]=i):i=t[0];let a;return t[1]!==n||t[2]!==r?(a=(0,Z.jsx)(Cw,{threads:r,groupByDocument:!0,empty:i,testIdPrefix:`comment-queue`,scopeSwitch:n}),t[1]=n,t[2]=r,t[3]=a):a=t[3],a}function Pw(e){let t=(0,$.c)(7),{docName:n,scopeSwitch:r}=e,i=J(n),a,o;t[0]===n?(a=t[1],o=t[2]):(a=()=>{Ze(n).catch(Fw)},o=[n],t[0]=n,t[1]=a,t[2]=o),(0,Q.useEffect)(a,o);let s;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(Y,{id:`zpfN9p`}),t[3]=s):s=t[3];let c;return t[4]!==r||t[5]!==i?(c=(0,Z.jsx)(Cw,{threads:i,empty:s,testIdPrefix:`comment-doc`,scopeSwitch:r}),t[4]=r,t[5]=i,t[6]=c):c=t[6],c}function Fw(){}function Iw(e){let t=(0,$.c)(3),{docName:n,scopeSwitch:r}=e,i;return t[0]!==n||t[1]!==r?(i=(0,Z.jsx)(Sm,{name:`comments-panel`,children:(0,Z.jsx)(Pw,{docName:n,scopeSwitch:r})}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i}function Lw(e){let t=(0,$.c)(13),{docName:n}=e,[r,i]=(0,Q.useState)(`doc`),a=rC(),o=a?`doc`:r,s,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{let e=F();return e!==null&&i(e),vn(i)},c=[],t[0]=s,t[1]=c):(s=t[0],c=t[1]),(0,Q.useEffect)(s,c);let l,u;t[2]!==n||t[3]!==o?(l=()=>(wb({scope:o,docName:n}),Rw),u=[o,n],t[2]=n,t[3]=o,t[4]=l,t[5]=u):(l=t[4],u=t[5]),(0,Q.useEffect)(l,u);let d;t[6]!==o||t[7]!==a?(d=a?void 0:(0,Z.jsx)(uu,{scope:o,onScopeChange:i}),t[6]=o,t[7]=a,t[8]=d):d=t[8];let f=d,p;return t[9]!==n||t[10]!==o||t[11]!==f?(p=o===`doc`?(0,Z.jsx)(Iw,{docName:n,scopeSwitch:f}):(0,Z.jsx)(Nw,{scopeSwitch:f}),t[9]=n,t[10]=o,t[11]=f,t[12]=p):p=t[12],p}function Rw(){return wb(null)}var zw=!1,Bw=new Set;function Vw(e){if(e!==zw){zw=e;for(let e of Bw)e()}}function Hw(e){return Bw.add(e),()=>{Bw.delete(e)}}function Uw(){return zw}function Ww(){return(0,Q.useSyncExternalStore)(Hw,Uw,Gw)}function Gw(){return!1}var Kw=new Map(ds.map(e=>[e.id,e.alias]));function qw(e){return e.source===`markdownlint`?Kw.get(e.code):void 0}function Jw(e,t,n){return xo({relativePath:bl(e),source:t.source,code:t.code,ruleAlias:qw(t),message:t.message,line:t.range.start.line+1,column:t.range.start.character+1,lineText:n})}function Yw(e){return Co(e===null?null:bl(e))}var Xw=5;async function Zw(e){let t=await fetch(`/api/backlinks?docName=${encodeURIComponent(e)}`),n=await t.json().catch(()=>null);if(!t.ok){let e=go.safeParse(n),r=t.status;throw e.success?Error(e.data.title):new Pr(ic._({id:`XopE_I`,values:{status:r}}),{status:r})}let r=bs.safeParse(n);if(!r.success)throw new Pr(ic._({id:`lZAiSP`}),{status:t.status});return r.data.backlinks}async function Qw(e){let t=await fetch(`/api/forward-links?docName=${encodeURIComponent(e)}`),n=await t.json().catch(()=>null);if(!t.ok){let e=go.safeParse(n),r=t.status;throw e.success?Error(e.data.title):new Pr(ic._({id:`GemPfn`,values:{status:r}}),{status:r})}let r=fo.safeParse(n);if(!r.success)throw new Pr(ic._({id:`2YZwPB`}),{status:t.status});return r.data}function $w(e){let t=e.split(`/`);return t.length<=2?e:`…/${t.slice(-2).join(`/`)}`}function eT(e){window.location.hash=ep(e)}function tT(e){let t=(0,$.c)(9),{title:n,count:r,isLoading:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(Zl,{className:`size-3.5 text-muted-foreground transition-transform group-data-[state=closed]:-rotate-90`}),t[0]=a):a=t[0];let o;t[1]===n?o=t[2]:(o=(0,Z.jsxs)(`span`,{className:`flex items-center gap-2.5`,children:[a,(0,Z.jsx)(gh,{children:n})]}),t[1]=n,t[2]=o);let s;t[3]!==r||t[4]!==i?(s=!i&&(0,Z.jsx)(bh,{children:r}),t[3]=r,t[4]=i,t[5]=s):s=t[5];let c;return t[6]!==o||t[7]!==s?(c=(0,Z.jsxs)(Sr,{className:`group flex w-full cursor-pointer items-center justify-between px-5 py-3 text-left transition-colors hover:bg-muted/40`,children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8],c}function nT(e){let t=(0,$.c)(10),{total:n,expanded:r,onToggle:i}=e;if(n<=Xw)return null;let a=n-Xw,o;t[0]===r?o=t[1]:(o=r?(0,Z.jsx)(Zl,{className:`size-3`}):(0,Z.jsx)(Ql,{className:`size-3`}),t[0]=r,t[1]=o);let s;t[2]!==r||t[3]!==a?(s=r?(0,Z.jsx)(Y,{id:`6fGjTz`}):(0,Z.jsx)(Y,{id:`ZptNUh`,values:{hidden:a}}),t[2]=r,t[3]=a,t[4]=s):s=t[4];let c;return t[5]!==r||t[6]!==i||t[7]!==o||t[8]!==s?(c=(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":r,className:`mt-2 inline-flex cursor-pointer items-center gap-1 px-3 text-xs text-muted-foreground transition-colors hover:text-foreground`,onClick:i,children:[o,s]}),t[5]=r,t[6]=i,t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function rT(e){let t=(0,$.c)(38),{icon:n,iconColorClass:r,rowTooltip:i,title:a,path:o,anchor:s,snippet:c,titleHover:l,ariaLabel:u,href:d,external:f,disabled:p,onClick:m,trailing:h}=e,g=o!==void 0&&o!==a,_=r??`text-muted-foreground`,v;t[0]===_?v=t[1]:(v=Qn(`mt-0.5 shrink-0`,_),t[0]=_,t[1]=v);let y;t[2]!==n||t[3]!==v?(y=(0,Z.jsx)(`span`,{className:v,children:n}),t[2]=n,t[3]=v,t[4]=y):y=t[4];let b=y,x;t[5]!==u||t[6]!==p||t[7]!==f||t[8]!==d||t[9]!==m||t[10]!==a||t[11]!==l?(x=d?(0,Z.jsxs)(`a`,{href:d,target:f?`_blank`:void 0,rel:f?`noopener noreferrer`:void 0,"aria-label":u,title:l,onClick:m,className:`block w-full truncate text-left font-medium text-foreground no-underline outline-none after:absolute after:inset-0 after:rounded-md focus-visible:after:ring-2 focus-visible:after:ring-ring`,children:[a,f?(0,Z.jsxs)(`span`,{className:`sr-only`,children:[` `,(0,Z.jsx)(Y,{id:`dbtjJh`})]}):null]}):(0,Z.jsx)(`button`,{type:`button`,"aria-label":u,title:l,disabled:p,onClick:m,className:Qn(`block w-full truncate text-left font-medium text-foreground no-underline outline-none after:absolute after:inset-0 after:rounded-md focus-visible:after:ring-2 focus-visible:after:ring-ring`,`cursor-pointer bg-transparent p-0 disabled:cursor-not-allowed disabled:opacity-60`),children:a}),t[5]=u,t[6]=p,t[7]=f,t[8]=d,t[9]=m,t[10]=a,t[11]=l,t[12]=x):x=t[12];let S=x,C;t[13]===b?C=t[14]:(C=(0,Z.jsx)(`div`,{className:`mt-px flex items-center`,children:b}),t[13]=b,t[14]=C);let w;t[15]!==s||t[16]!==o||t[17]!==g?(w=g?(0,Z.jsxs)(`div`,{className:`truncate font-mono text-xs text-muted-foreground`,children:[o,s?(0,Z.jsxs)(`span`,{className:`ml-1`,children:[`· #`,s]}):null]}):null,t[15]=s,t[16]=o,t[17]=g,t[18]=w):w=t[18];let T;t[19]===c?T=t[20]:(T=c?(0,Z.jsx)(`p`,{className:`line-clamp-2 text-muted-foreground`,children:c}):null,t[19]=c,t[20]=T);let E;t[21]!==S||t[22]!==w||t[23]!==T?(E=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5 text-1sm`,children:[S,w,T]}),t[21]=S,t[22]=w,t[23]=T,t[24]=E):E=t[24];let D;t[25]===h?D=t[26]:(D=h?(0,Z.jsx)(`div`,{className:`mt-0.5 flex shrink-0 items-center`,children:h}):null,t[25]=h,t[26]=D);let O;t[27]!==C||t[28]!==E||t[29]!==D?(O=(0,Z.jsxs)(`div`,{className:`group relative flex items-start gap-2.5 rounded-md px-3 py-2.5 transition-colors hover:bg-muted/80`,children:[C,E,D]}),t[27]=C,t[28]=E,t[29]=D,t[30]=O):O=t[30];let k=O;if(i){let e;t[31]===k?e=t[32]:(e=(0,Z.jsx)(_r,{asChild:!0,children:k}),t[31]=k,t[32]=e);let n;t[33]===i?n=t[34]:(n=(0,Z.jsx)(vr,{side:`top`,children:i}),t[33]=i,t[34]=n);let r;return t[35]!==e||t[36]!==n?(r=(0,Z.jsxs)(br,{children:[e,n]}),t[35]=e,t[36]=n,t[37]=r):r=t[37],r}return k}function iT(e){let t=(0,$.c)(39),{docName:n}=e,{_:r}=xn(),{folderPaths:i,pages:a,pagesBySlug:o,pagesByBasename:s,loading:c}=Lu(),l,u;t[0]===n?(l=t[1],u=t[2]):(l=[`backlinks`,n],u=()=>Zw(n),t[0]=n,t[1]=l,t[2]=u);let d;t[3]!==n||t[4]!==c||t[5]!==a?(d=!c&&(a.has(n)||Na(n)),t[3]=n,t[4]=c,t[5]=a,t[6]=d):d=t[6];let f;t[7]!==l||t[8]!==u||t[9]!==d?(f={queryKey:l,queryFn:u,enabled:d},t[7]=l,t[8]=u,t[9]=d,t[10]=f):f=t[10];let{data:p,isLoading:m,error:h}=Rn(f),g;t[11]===p?g=t[12]:(g=p===void 0?[]:p,t[11]=p,t[12]=g);let _=g,[v,y]=(0,Q.useState)(!1),[b,x]=(0,Q.useState)(n);b!==n&&(x(n),y(!1));let S;t[13]!==_||t[14]!==v?(S=v?_:_.slice(0,Xw),t[13]=_,t[14]=v,t[15]=S):S=t[15];let C=S,w;t[16]===r?w=t[17]:(w=r({id:`9NJWgv`}),t[16]=r,t[17]=w);let T;t[18]!==_.length||t[19]!==m||t[20]!==w?(T=(0,Z.jsx)(tT,{title:w,count:_.length,isLoading:m}),t[18]=_.length,t[19]=m,t[20]=w,t[21]=T):T=t[21];let E;t[22]!==r||t[23]!==_.length||t[24]!==h||t[25]!==v||t[26]!==i||t[27]!==m||t[28]!==a||t[29]!==s||t[30]!==o||t[31]!==C?(E=h?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(hh,{children:h instanceof Error?h.message:r({id:`Xet9MX`})})}):_.length===0&&!m?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(_h,{children:(0,Z.jsx)(Y,{id:`rVxu1k`})})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`flex flex-col gap-1`,children:C.map((e,t)=>{let n=of(e.source,{pages:a,folderPaths:i,pagesBySlug:o,pagesByBasename:s});return(0,Z.jsx)(rT,{icon:(0,Z.jsx)(Fe,{className:`size-3.5`}),title:e.title,path:$w(e.source),titleHover:e.source,anchor:e.anchor,snippet:e.snippet,href:ep(n.hashDocName,e.anchor)},`${e.source}-${t}`)})}),(0,Z.jsx)(nT,{total:_.length,expanded:v,onToggle:()=>y(aT)})]}),t[22]=r,t[23]=_.length,t[24]=h,t[25]=v,t[26]=i,t[27]=m,t[28]=a,t[29]=s,t[30]=o,t[31]=C,t[32]=E):E=t[32];let D;t[33]!==m||t[34]!==E?(D=(0,Z.jsx)(xr,{children:(0,Z.jsx)(`div`,{className:`px-2 pb-3`,"aria-busy":m,children:E})}),t[33]=m,t[34]=E,t[35]=D):D=t[35];let O;return t[36]!==D||t[37]!==T?(O=(0,Z.jsxs)(Cr,{defaultOpen:!0,children:[T,D]}),t[36]=D,t[37]=T,t[38]=O):O=t[38],O}function aT(e){return!e}function oT(e){let t=(0,$.c)(49),{docName:n}=e,{_:r}=xn(),{addPage:i,folderPaths:a,pages:o,pagesBySlug:c,pagesByBasename:l,loading:u}=Lu(),d,f;t[0]===n?(d=t[1],f=t[2]):(d=[`forward-links`,n],f=()=>Qw(n),t[0]=n,t[1]=d,t[2]=f);let p;t[3]!==n||t[4]!==o||t[5]!==u?(p=!u&&(o.has(n)||Na(n)),t[3]=n,t[4]=o,t[5]=u,t[6]=p):p=t[6];let m;t[7]!==d||t[8]!==f||t[9]!==p?(m={queryKey:d,queryFn:f,enabled:p},t[7]=d,t[8]=f,t[9]=p,t[10]=m):m=t[10];let{data:h,isLoading:g,error:_}=Rn(m),v;t[11]===h?.forwardLinks?v=t[12]:(v=h?.forwardLinks??[],t[11]=h?.forwardLinks,t[12]=v);let y=v,[b,x]=(0,Q.useState)(null),[S,C]=(0,Q.useState)(!1),[w,T]=(0,Q.useState)(n);w!==n&&(T(n),C(!1),x(null));let E;t[13]!==S||t[14]!==y?(E=S?y:y.slice(0,Xw),t[13]=S,t[14]=y,t[15]=E):E=t[15];let D=E,O;t[16]!==r||t[17]!==i||t[18]!==b?(O=async function(e,t){if(!b){x(t);try{await s(e,{addPage:i,onCreated:eT}),x(null)}catch(e){let t=e;Us.error(t instanceof Error?t.message:r({id:`tfi40B`})),x(null)}}},t[16]=r,t[17]=i,t[18]=b,t[19]=O):O=t[19];let k=O,A;t[20]!==r||t[21]!==b||t[22]!==a||t[23]!==k||t[24]!==o||t[25]!==l||t[26]!==c||t[27]!==u?(A=function(e){let{title:t}=e;if(e.kind===`external`){let t=e.title===e.url;return(0,Z.jsx)(rT,{icon:(0,Z.jsx)(Fl,{className:`size-3.5`}),rowTooltip:r({id:`XDzAnp`}),title:e.title,path:t?void 0:e.url,titleHover:e.url,snippet:e.snippet,href:e.url,external:!0},`ext:${e.url}`)}let n=Gr(e.docName,{pages:o,folderPaths:a,pagesBySlug:c,pagesByBasename:l}),i=!u&&n.kind===`create`,s=!u&&n.kind===`navigate`&&n.displayState===`folder`,d=$w(e.docName),f=e.title===e.docName?d:e.title,p=`doc:${e.docName}:${e.anchor??``}`,m=n.kind===`navigate`?n.hashDocName:e.docName,h=n.kind===`navigate`&&n.hash?n.hash:ep(m,e.anchor);if(i&&n.kind===`create`){let i={initialDir:n.initialDir,suggestedName:n.suggestedName};return(0,Z.jsx)(rT,{icon:(0,Z.jsx)(Uf,{className:`size-3.5`}),iconColorClass:`text-amber-600 dark:text-amber-400`,rowTooltip:r(b===p?{id:`kj9pAE`}:{id:`IQPyrD`}),ariaLabel:r(b===p?{id:`un8kBM`,values:{linkTitle:t}}:{id:`jEdF24`,values:{linkTitle:t}}),title:f,path:d,titleHover:e.docName,anchor:e.anchor,snippet:e.snippet,disabled:b!==null,onClick:()=>void k(i,p)},p)}return s&&n.kind===`navigate`?(0,Z.jsx)(rT,{icon:(0,Z.jsx)(Qd,{className:`size-3.5`}),iconColorClass:`text-sky-600 dark:text-sky-400`,ariaLabel:r({id:`P6lAT3`,values:{linkTitle:t}}),title:f,path:d,titleHover:e.docName,anchor:e.anchor,snippet:e.snippet,href:h},p):(0,Z.jsx)(rT,{icon:(0,Z.jsx)(Fe,{className:`size-3.5`}),title:f,path:d,titleHover:e.docName,anchor:e.anchor,snippet:e.snippet,href:h},p)},t[20]=r,t[21]=b,t[22]=a,t[23]=k,t[24]=o,t[25]=l,t[26]=c,t[27]=u,t[28]=A):A=t[28];let j=A,M;t[29]===r?M=t[30]:(M=r({id:`O0Z2Xr`}),t[29]=r,t[30]=M);let N;t[31]!==g||t[32]!==y.length||t[33]!==M?(N=(0,Z.jsx)(tT,{title:M,count:y.length,isLoading:g}),t[31]=g,t[32]=y.length,t[33]=M,t[34]=N):N=t[34];let P;t[35]!==r||t[36]!==_||t[37]!==S||t[38]!==g||t[39]!==y.length||t[40]!==j||t[41]!==D?(P=_?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(hh,{children:_ instanceof Error?_.message:r({id:`pZAs1T`})})}):y.length===0&&!g?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(_h,{children:(0,Z.jsx)(Y,{id:`roiUQQ`})})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`flex flex-col gap-1`,children:D.map(j)}),(0,Z.jsx)(nT,{total:y.length,expanded:S,onToggle:()=>C(sT)})]}),t[35]=r,t[36]=_,t[37]=S,t[38]=g,t[39]=y.length,t[40]=j,t[41]=D,t[42]=P):P=t[42];let F;t[43]!==g||t[44]!==P?(F=(0,Z.jsx)(xr,{children:(0,Z.jsx)(`div`,{className:`px-2 pb-3`,"aria-busy":g,children:P})}),t[43]=g,t[44]=P,t[45]=F):F=t[45];let I;return t[46]!==N||t[47]!==F?(I=(0,Z.jsxs)(Cr,{defaultOpen:!0,children:[N,F]}),t[46]=N,t[47]=F,t[48]=I):I=t[48],I}function sT(e){return!e}function cT(e){let t=(0,$.c)(42),{docName:n}=e,{_:r}=xn(),{pages:i,loading:a}=Lu(),o,s;t[0]===n?(o=t[1],s=t[2]):(o=[`forward-links`,n],s=()=>Qw(n),t[0]=n,t[1]=o,t[2]=s);let c;t[3]!==n||t[4]!==i||t[5]!==a?(c=!a&&(i.has(n)||Na(n)),t[3]=n,t[4]=i,t[5]=a,t[6]=c):c=t[6];let l;t[7]!==o||t[8]!==s||t[9]!==c?(l={queryKey:o,queryFn:s,enabled:c},t[7]=o,t[8]=s,t[9]=c,t[10]=l):l=t[10];let{data:u,isLoading:d,error:f}=Rn(l),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(n);h!==n&&(g(n),m(!1));let _=u?.localTargets,v;t[11]===_?v=t[12]:(v=_??[],t[11]=_,t[12]=v);let y=v,b;t[13]!==p||t[14]!==y?(b=p?y:y.slice(0,Xw),t[13]=p,t[14]=y,t[15]=b):b=t[15];let x=b,S;t[16]===n?S=t[17]:(S=function(e){let t={docName:n,line:e.line+1,column:e.column+1,source:`links`};ou(n,{kind:`lint`,detail:t}),window.dispatchEvent(new CustomEvent(gu,{detail:t}))},t[16]=n,t[17]=S);let C=S,w;t[18]!==r||t[19]!==C?(w=function(e){let t=e.role===`image`,n=e.status===`exact`||e.status===`fallback`,i=e.resolvedTarget??e.href,a=e.status===`missing`?r({id:`VU3Nrn`}):r({id:`XYZ7tp`}),o=n?r(t?{id:`radOpL`,values:{identity:i}}:{id:`6LJJ1v`,values:{identity:i}}):e.status===`missing`?r(t?{id:`vPLUCm`,values:{identity:i}}:{id:`Lrsl_h`,values:{identity:i}}):r(t?{id:`y-LQPF`,values:{identity:i}}:{id:`Y_iImT`,values:{identity:i}});return(0,Z.jsx)(rT,{icon:t?(0,Z.jsx)(Hr,{className:`size-3.5`}):(0,Z.jsx)(Fe,{className:`size-3.5`}),iconColorClass:n?void 0:`text-amber-600 dark:text-amber-400`,title:$w(i),titleHover:i,ariaLabel:o,trailing:n?void 0:(0,Z.jsx)(wm,{variant:`outline`,className:`font-normal text-muted-foreground`,children:a}),onClick:()=>C(e)},`lt:${e.range.start}-${e.range.end}`)},t[18]=r,t[19]=C,t[20]=w):w=t[20];let T=w,E;t[21]===r?E=t[22]:(E=r({id:`U3RIJu`}),t[21]=r,t[22]=E);let D;t[23]!==d||t[24]!==y.length||t[25]!==E?(D=(0,Z.jsx)(tT,{title:E,count:y.length,isLoading:d}),t[23]=d,t[24]=y.length,t[25]=E,t[26]=D):D=t[26];let O;t[27]!==r||t[28]!==f||t[29]!==p||t[30]!==d||t[31]!==_||t[32]!==T||t[33]!==y.length||t[34]!==x?(O=f?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(hh,{children:f instanceof Error?f.message:r({id:`1xui0Q`})})}):_===void 0&&!d?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(_h,{children:(0,Z.jsx)(Y,{id:`g-dkjJ`})})}):y.length===0&&!d?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(_h,{children:(0,Z.jsx)(Y,{id:`pJ7XCo`})})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`flex flex-col gap-1`,children:x.map(T)}),(0,Z.jsx)(nT,{total:y.length,expanded:p,onToggle:()=>m(lT)})]}),t[27]=r,t[28]=f,t[29]=p,t[30]=d,t[31]=_,t[32]=T,t[33]=y.length,t[34]=x,t[35]=O):O=t[35];let k;t[36]!==d||t[37]!==O?(k=(0,Z.jsx)(xr,{children:(0,Z.jsx)(`div`,{className:`px-2 pb-3`,"aria-busy":d,children:O})}),t[36]=d,t[37]=O,t[38]=k):k=t[38];let A;return t[39]!==D||t[40]!==k?(A=(0,Z.jsxs)(Cr,{defaultOpen:!0,children:[D,k]}),t[39]=D,t[40]=k,t[41]=A):A=t[41],A}function lT(e){return!e}function uT(e){let t=(0,$.c)(15),{docName:n,className:r}=e,i=r===void 0?``:r,a;t[0]===n?a=t[1]:(a=(0,Z.jsx)(oT,{docName:n}),t[0]=n,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(ua,{}),t[2]=o):o=t[2];let s;t[3]===n?s=t[4]:(s=(0,Z.jsx)(cT,{docName:n}),t[3]=n,t[4]=s);let c;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(ua,{}),t[5]=c):c=t[5];let l;t[6]===n?l=t[7]:(l=(0,Z.jsx)(iT,{docName:n}),t[6]=n,t[7]=l);let u;t[8]!==a||t[9]!==s||t[10]!==l?(u=(0,Z.jsxs)(vh,{className:`px-0 py-0`,children:[a,o,s,c,l]}),t[8]=a,t[9]=s,t[10]=l,t[11]=u):u=t[11];let d;return t[12]!==i||t[13]!==u?(d=(0,Z.jsx)(Sh,{className:i,children:u}),t[12]=i,t[13]=u,t[14]=d):d=t[14],d}function dT(e){let t=e.setTimer??((e,t)=>setTimeout(e,t)),n=e.clearTimer??(e=>clearTimeout(e)),r=!1,i=!1,a=null,o=null,s=e.baseMs,c=!1,l=n=>{if(!r){if(e.isPaused()){c=!0;return}a=t(u,n)}};async function u(){if(a=null,c=!1,r)return;if(e.isPaused()){c=!0;return}o=new AbortController;let t=o.signal;try{let n=await e.poll(t);if(r)return;n===`ok`?(s=e.baseMs,l(e.baseMs)):(s=Math.min(s*2,e.maxBackoffMs),l(s))}catch{if(r||t.aborted)return;s=Math.min(s*2,e.maxBackoffMs),l(s)}}return{start(){r||i||(i=!0,u())},resume(){r||!e.isPaused()&&c&&a===null&&(c=!1,u())},stop(){r=!0,a!==null&&(n(a),a=null),o?.abort()}}}var fT=1e4,pT=6e4;async function mT(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(hT)),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 hT(e){return e.type===`checkpoint`?e.checkpoint!==null&&Go(e.checkpoint.kind):!0}function gT(e){let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/1e3);if(r<60)return ic._({id:`xOTzt5`});if(r<3600){let e=Math.floor(r/60);return ic._({id:`UyROxs`,values:{mins:e}})}if(r<86400){let e=Math.floor(r/3600);return ic._({id:`wXO4Tg`,values:{hrs:e}})}if(r<86400*2)return ic._({id:`rQRrkB`});let i=Math.floor(r/86400);return i<7?ic._({id:`6u9LvN`,values:{days:i}}):t.toLocaleDateString()}function _T(e){return new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function vT(e){if(e.type===`checkpoint`)return{kind:`recovered`};if(e.type===`upstream`)return{kind:`upstream`};let t=e.message,n=/^rollback: .+ to ([0-9a-f]{7,40})$/.exec(t);if(n)return{kind:`restore`,targetSha7:n[1].slice(0,7)};let r=/^rename: (.+) -> (.+)$/.exec(t);return r?{kind:`rename`,from:r[1],to:r[2]}:t.startsWith(`reconcile: `)?{kind:`reconcile`}:t.startsWith(`import: `)?{kind:`upstream`}:{kind:`edit`}}function yT(e){return e.split(`/`).pop()??e}function bT(e){return e.type===`checkpoint`?ic._({id:`C-twqs`}):e.type===`upstream`?ic._({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`?ic._({id:`B2DrPb`}):e.author}function xT(e){let t=to;return e===t.fileSystem?`file-system`:e===t.service||e===t.gitUpstream?`upstream`:e===t.generator?`generated`:`person`}function ST(e){let t=(0,$.c)(19),{entry:n,isDark:r}=e;if(n.type===`checkpoint`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Wc,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),t[0]=e):e=t[0],e}if(n.type===`upstream`){let e;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Cl,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[1]=e):e=t[1],e}if(n.contributors.length>0){let e=n.contributors[0],i=e.colorSeed??e.name,a;t[2]===i?a=t[3]:(a=Aa(i),t[2]=i,t[3]=a);let o=a,s=r?ss[o]??Cs[o]:Cs[o],c;t[4]!==s||t[5]!==i?(c=s??no(i),t[4]=s,t[5]=i,t[6]=c):c=t[6];let l=c;if(o!==`bot`){let e;t[7]===l?e=t[8]:(e={color:l},t[7]=l,t[8]=e);let n;return t[9]!==o||t[10]!==e?(n=(0,Z.jsx)(kh,{icon:o,width:14,height:14,className:`shrink-0`,style:e}),t[9]=o,t[10]=e,t[11]=n):n=t[11],n}switch(xT(e.name)){case`file-system`:{let e;return t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Oy,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[12]=e):e=t[12],e}case`upstream`:{let e;return t[13]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Tl,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[13]=e):e=t[13],e}case`generated`:{let e;return t[14]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(re,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[14]=e):e=t[14],e}default:{let e;return t[15]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(gb,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[15]=e):e=t[15],e}}}if(n.authorEmail.includes(`agent`)||n.author.includes(`agent`)||n.authorEmail.includes(`cursor`)||n.authorEmail.includes(`claude`)){let e;return t[16]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(re,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[16]=e):e=t[16],e}if(n.author===`openknowledge-server`||n.author===`server`){let e;return t[17]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Tl,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[17]=e):e=t[17],e}let i;return t[18]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(gb,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[18]=i):i=t[18],i}function CT(e){let t=[];for(let n of e.contributors)if(n.summaries)for(let e of n.summaries)t.push(e);return t}function wT(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(ET),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(TT)},children:[r?(0,Z.jsx)(Zl,{className:`size-3`}):(0,Z.jsx)(Ql,{className:`size-3`}),r?(0,Z.jsx)(Y,{id:`vLyv1R`}):(0,Z.jsx)(Y,{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 TT(e){return!e}function ET(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 DT(e){let t=(0,$.c)(36),{descriptor:n,allDocs:r,versionBySha7:i,onJumpToVersion:a}=e,{_:o}=xn();if(n.kind===`restore`){let e,r;t[0]!==o||t[1]!==n.targetSha7||t[2]!==i?(r=i.get(n.targetSha7),e=o(r?{id:`sICrVf`,values:{0:_T(r.timestamp)}}:{id:`i09An-`,values:{0:n.targetSha7}}),t[0]=o,t[1]=n.targetSha7,t[2]=i,t[3]=e,t[4]=r):(e=t[3],r=t[4]);let s=e,c;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(la,{className:`size-3 shrink-0`,"aria-hidden":!0}),t[5]=c):c=t[5];let l;return t[6]!==n.targetSha7||t[7]!==s||t[8]!==a||t[9]!==r?(l=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1 text-xs text-muted-foreground`,children:[c,r?(0,Z.jsx)(`button`,{type:`button`,className:`truncate text-left underline-offset-2 hover:text-foreground hover:underline`,title:s,onClick:e=>{e.stopPropagation(),a(n.targetSha7)},children:s}):(0,Z.jsx)(`span`,{className:`truncate`,title:s,children:s})]}),t[6]=n.targetSha7,t[7]=s,t[8]=a,t[9]=r,t[10]=l):l=t[10],l}if(n.kind===`rename`){let e=`${n.from} → ${n.to}`,r;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(sl,{className:`size-3 shrink-0`,"aria-hidden":!0}),t[11]=r):r=t[11];let i;t[12]!==o||t[13]!==n.from||t[14]!==n.to?(i=o({id:`GkYV_4`,values:{0:yT(n.from),1:yT(n.to)}}),t[12]=o,t[13]=n.from,t[14]=n.to,t[15]=i):i=t[15];let a;t[16]===i?a=t[17]:(a=(0,Z.jsx)(`span`,{className:`truncate`,children:i}),t[16]=i,t[17]=a);let s;return t[18]!==e||t[19]!==a?(s=(0,Z.jsxs)(`p`,{className:`flex items-center gap-1 truncate text-xs text-muted-foreground`,title:e,children:[r,a]}),t[18]=e,t[19]=a,t[20]=s):s=t[20],s}if(n.kind===`reconcile`){let e;t[21]===o?e=t[22]:(e=o({id:`0qyKG6`}),t[21]=o,t[22]=e);let n;return t[23]===e?n=t[24]:(n=(0,Z.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:e}),t[23]=e,t[24]=n),n}if(n.kind===`recovered`)return null;if(r.length>0){let e;t[25]===r?e=t[26]:(e=r.join(`, `),t[25]=r,t[26]=e);let n;t[27]===r?n=t[28]:(n=r.join(`, `),t[27]=r,t[28]=n);let i;return t[29]!==e||t[30]!==n?(i=(0,Z.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,title:e,children:n}),t[29]=e,t[30]=n,t[31]=i):i=t[31],i}if(n.kind===`upstream`)return null;let s;t[32]===o?s=t[33]:(s=o({id:`MRZxAn`}),t[32]=o,t[33]=s);let c;return t[34]===s?c=t[35]:(c=(0,Z.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:s}),t[34]=s,t[35]=c),c}function OT(e){let t=(0,$.c)(122),{entry:n,isDark:r,docName:i,laterEdits:a,onRestoreSuccess:o,versionBySha7:s,onJumpToVersion:c,registerRowRef:l,flashing:u}=e,{_:d}=xn(),f;t[0]===n.timestamp?f=t[1]:(f=gT(n.timestamp),t[0]=n.timestamp,t[1]=f);let p=f,m;t[2]===n?m=t[3]:(m=bT(n),t[2]=n,t[3]=m);let h=m,g;t[4]===n.timestamp?g=t[5]:(g=_T(n.timestamp),t[4]=n.timestamp,t[5]=g);let _=g,v;t[6]===n.contributors?v=t[7]:(v=n.contributors.flatMap(kT),t[6]=n.contributors,t[7]=v);let y=v,b;t[8]===n?b=t[9]:(b=CT(n),t[8]=n,t[9]=b);let x=b,S;t[10]===n?S=t[11]:(S=vT(n),t[10]=n,t[11]=S);let C=S,[w,T]=(0,Q.useState)(!1),[E,D]=(0,Q.useState)(!1),O=(0,Q.useRef)(null),k=Mh(),A=k?.docName===i&&k.sha===n.sha,j,M;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(j=()=>()=>O.current?.abort(),M=[],t[12]=j,t[13]=M):(j=t[12],M=t[13]),(0,Q.useEffect)(j,M);let N;t[14]!==_||t[15]!==h||t[16]!==i||t[17]!==n.parentSha||t[18]!==n.sha||t[19]!==a||t[20]!==p?(N=()=>{Ah(),jh({docName:i,sha:n.sha,parentSha:n.parentSha??null,laterEdits:a,authorName:h,relativeTime:p,absoluteTime:_})},t[14]=_,t[15]=h,t[16]=i,t[17]=n.parentSha,t[18]=n.sha,t[19]=a,t[20]=p,t[21]=N):N=t[21];let P=N,F;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(F=function(){O.current?.abort(),O.current=null,D(!1),T(!1)},t[22]=F):F=t[22];let I=F,L;t[23]!==d||t[24]!==i||t[25]!==n.sha||t[26]!==o?(L=async function(){D(!0);let e=new AbortController;O.current=e;let t=function(){e.signal.aborted||D(!1),O.current===e&&(O.current=null)},r;try{r=await fetch(`/api/rollback`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({docName:i,commitSha:n.sha}),signal:e.signal})}catch(r){let a=r;!e.signal.aborted&&!(a instanceof DOMException&&a.name===`AbortError`)&&(console.error(`[timeline] rollback fetch failed`,{docName:i,sha:n.sha,err:a}),Us.error(d({id:`NkXEFS`}),{duration:4e3})),t();return}if(e.signal.aborted){t();return}if(r.ok)T(!1),o();else{let e=`HTTP ${r.status}`;try{let t=go.safeParse(await r.json());t.success&&(e=t.data.title)}catch{}console.error(`[timeline] rollback failed`,{docName:i,sha:n.sha,status:r.status,detail:e}),Us.error(d({id:`uM6jnS`}),{description:e,duration:6e3})}t()},t[23]=d,t[24]=i,t[25]=n.sha,t[26]=o,t[27]=L):L=t[27];let R=L,z;t[28]!==n||t[29]!==r?(z=(0,Z.jsx)(ST,{entry:n,isDark:r}),t[28]=n,t[29]=r,t[30]=z):z=t[30];let B=z,V=u?`ring-2 ring-ring ring-offset-1 ring-offset-background`:``,H;t[31]===V?H=t[32]:(H=[`flex flex-col rounded-lg transition-shadow`,V],t[31]=V,t[32]=H);let U=H.join(` `),ee=A?`bg-muted`:`hover:bg-muted/80`,W;t[33]===ee?W=t[34]:(W=[`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`,ee],t[33]=ee,t[34]=W);let te=W.join(` `),G;t[35]===P?G=t[36]:(G=e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),P())},t[35]=P,t[36]=G);let K;t[37]===B?K=t[38]:(K=(0,Z.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:B}),t[37]=B,t[38]=K);let q;t[39]===h?q=t[40]:(q=(0,Z.jsx)(`span`,{className:`truncate text-xs text-foreground`,children:h}),t[39]=h,t[40]=q);let ne;t[41]!==n.timestamp||t[42]!==p?(ne=(0,Z.jsx)(`time`,{className:`ml-auto shrink-0 text-xs text-muted-foreground/80`,dateTime:n.timestamp,title:n.timestamp,children:p}),t[41]=n.timestamp,t[42]=p,t[43]=ne):ne=t[43];let re;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`h-3 w-px shrink-0 bg-border`}),t[44]=re):re=t[44];let J;t[45]===d?J=t[46]:(J=d({id:`Yea-K5`}),t[45]=d,t[46]=J);let ie;t[47]!==R||t[48]!==a?(ie=e=>{e.stopPropagation(),a>0?T(!0):R()},t[47]=R,t[48]=a,t[49]=ie):ie=t[49];let ae;t[50]===E?ae=t[51]:(ae=E?(0,Z.jsx)(cf,{"aria-hidden":`true`,className:`size-3`}):(0,Z.jsx)(Wf,{className:`size-3`}),t[50]=E,t[51]=ae);let oe;t[52]!==E||t[53]!==J||t[54]!==ie||t[55]!==ae?(oe=(0,Z.jsx)(_r,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon`,className:`size-5 shrink-0 text-muted-foreground hover:text-destructive`,"data-testid":`timeline-entry-restore`,"aria-label":J,disabled:E,onClick:ie,children:ae})}),t[52]=E,t[53]=J,t[54]=ie,t[55]=ae,t[56]=oe):oe=t[56];let se;t[57]===d?se=t[58]:(se=d({id:`Yea-K5`}),t[57]=d,t[58]=se);let ce;t[59]===se?ce=t[60]:(ce=(0,Z.jsx)(vr,{side:`top`,children:se}),t[59]=se,t[60]=ce);let le;t[61]!==oe||t[62]!==ce?(le=(0,Z.jsxs)(br,{children:[oe,ce]}),t[61]=oe,t[62]=ce,t[63]=le):le=t[63];let ue;t[64]!==q||t[65]!==ne||t[66]!==le?(ue=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[q,ne,re,le]}),t[64]=q,t[65]=ne,t[66]=le,t[67]=ue):ue=t[67];let de;t[68]===x?de=t[69]:(de=x.length>0&&(0,Z.jsx)(wT,{summaries:x}),t[68]=x,t[69]=de);let fe;t[70]!==y||t[71]!==C||t[72]!==c||t[73]!==s?(fe=(0,Z.jsx)(DT,{descriptor:C,allDocs:y,versionBySha7:s,onJumpToVersion:c}),t[70]=y,t[71]=C,t[72]=c,t[73]=s,t[74]=fe):fe=t[74];let pe;t[75]!==ue||t[76]!==de||t[77]!==fe?(pe=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[ue,de,fe]}),t[75]=ue,t[76]=de,t[77]=fe,t[78]=pe):pe=t[78];let me;t[79]!==P||t[80]!==A||t[81]!==te||t[82]!==G||t[83]!==K||t[84]!==pe?(me=(0,Z.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-pressed":A,"data-testid":`timeline-entry-open`,className:te,onClick:P,onKeyDown:G,children:[K,pe]}),t[79]=P,t[80]=A,t[81]=te,t[82]=G,t[83]=K,t[84]=pe,t[85]=me):me=t[85];let he;t[86]!==l||t[87]!==U||t[88]!==me?(he=(0,Z.jsx)(`div`,{ref:l,className:U,children:me}),t[86]=l,t[87]=U,t[88]=me,t[89]=he):he=t[89];let ge;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(ge=e=>{e?T(!0):I()},t[90]=ge):ge=t[90];let _e;t[91]===d?_e=t[92]:(_e=d({id:`n3wx1q`}),t[91]=d,t[92]=_e);let ve;t[93]===_e?ve=t[94]:(ve=(0,Z.jsx)(Pp,{children:_e}),t[93]=_e,t[94]=ve);let ye;t[95]===a?ye=t[96]:(ye=(0,Z.jsx)(Y,{id:`nfPccR`,values:{laterEdits:a}}),t[95]=a,t[96]=ye);let be;t[97]===Symbol.for(`react.memo_cache_sentinel`)?(be=(0,Z.jsx)(Y,{id:`5ZbJFS`}),t[97]=be):be=t[97];let xe;t[98]===ye?xe=t[99]:(xe=(0,Z.jsxs)(Np,{children:[ye,` `,be]}),t[98]=ye,t[99]=xe);let Se;t[100]!==ve||t[101]!==xe?(Se=(0,Z.jsxs)(zp,{children:[ve,xe]}),t[100]=ve,t[101]=xe,t[102]=Se):Se=t[102];let Ce;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=(0,Z.jsx)(X,{variant:`outline`,"data-testid":`timeline-entry-restore-cancel`,onClick:I,children:(0,Z.jsx)(Y,{id:`dEgA5A`})}),t[103]=Ce):Ce=t[103];let we;t[104]===R?we=t[105]:(we=()=>R(),t[104]=R,t[105]=we);let Te;t[106]===E?Te=t[107]:(Te=E?(0,Z.jsx)(cf,{"aria-hidden":`true`,className:`mr-2 size-4`}):null,t[106]=E,t[107]=Te);let Ee;t[108]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=(0,Z.jsx)(Y,{id:`yKu_3Y`}),t[108]=Ee):Ee=t[108];let De;t[109]!==E||t[110]!==we||t[111]!==Te?(De=(0,Z.jsxs)(Lp,{children:[Ce,(0,Z.jsxs)(X,{variant:`destructive`,"data-testid":`timeline-entry-restore-confirm`,disabled:E,onClick:we,children:[Te,Ee]})]}),t[109]=E,t[110]=we,t[111]=Te,t[112]=De):De=t[112];let Oe;t[113]!==Se||t[114]!==De?(Oe=(0,Z.jsxs)(Fp,{children:[Se,De]}),t[113]=Se,t[114]=De,t[115]=Oe):Oe=t[115];let ke;t[116]!==w||t[117]!==Oe?(ke=(0,Z.jsx)(Bp,{open:w,onOpenChange:ge,children:Oe}),t[116]=w,t[117]=Oe,t[118]=ke):ke=t[118];let Ae;return t[119]!==he||t[120]!==ke?(Ae=(0,Z.jsxs)(Z.Fragment,{children:[he,ke]}),t[119]=he,t[120]=ke,t[121]=Ae):Ae=t[121],Ae}function kT(e){return e.docs}function AT(e){let t=(0,$.c)(27),{docName:n}=e,{_:r}=xn(),{resolvedTheme:i}=Hn(),a=i===`dark`,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=[],t[0]=o):o=t[0];let[s,c]=(0,Q.useState)(o),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(null),p=(0,Q.useRef)(new Map),[m,h]=(0,Q.useState)(null),g=(0,Q.useRef)(null),_=new Map;for(let e of s)_.set(e.sha.slice(0,7),e);let v,y;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(v=()=>()=>clearTimeout(g.current??void 0),y=[],t[1]=v,t[2]=y):(v=t[1],y=t[2]),(0,Q.useEffect)(v,y);let b=function(e){let t=_.get(e);t&&(p.current.get(t.sha)?.scrollIntoView({behavior:`smooth`,block:`center`}),h(t.sha),clearTimeout(g.current??void 0),g.current=setTimeout(()=>h(null),1600))},x;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(x=function(){Nh()},t[3]=x):x=t[3];let S=x,C,w;t[4]!==r||t[5]!==n?(C=()=>{if(!n){c([]);return}u(!0);let e=dT({baseMs:fT,maxBackoffMs:pT,isPaused:MT,poll:e=>mT(n,e,{setEntries:c,setError:f,setLoading:u,unavailableMessage:r({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)}},w=[n,r],t[4]=r,t[5]=n,t[6]=C,t[7]=w):(C=t[6],w=t[7]),(0,Q.useEffect)(C,w);let T;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(xh,{children:(0,Z.jsx)(gh,{children:(0,Z.jsx)(Y,{id:`cklVjM`})})}),t[8]=T):T=t[8];let E;t[9]!==r||t[10]!==l?(E=l&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-1 p-2`,role:`status`,"aria-busy":`true`,"aria-label":r({id:`o49mDZ`}),children:[1,2,3].map(jT)}),t[9]=r,t[10]=l,t[11]=E):E=t[11];let D;t[12]!==d||t[13]!==l?(D=!l&&d&&(0,Z.jsx)(`div`,{className:`px-4 py-3`,children:(0,Z.jsx)(`p`,{className:`text-xs text-destructive`,children:d})}),t[12]=d,t[13]=l,t[14]=D):D=t[14];let O;t[15]!==s||t[16]!==d||t[17]!==l?(O=!l&&!d&&s.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)(Y,{id:`Ta25TG`})})}),t[15]=s,t[16]=d,t[17]=l,t[18]=O):O=t[18];let k=!l&&!d&&s.length>0&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-1 p-2`,children:s.map((e,t)=>(0,Z.jsx)(OT,{entry:e,isDark:a,docName:n,laterEdits:t,onRestoreSuccess:S,versionBySha7:_,onJumpToVersion:b,registerRowRef:t=>{t?p.current.set(e.sha,t):p.current.delete(e.sha)},flashing:m===e.sha},e.sha))}),A;t[19]!==E||t[20]!==D||t[21]!==O||t[22]!==k?(A=(0,Z.jsxs)(`div`,{className:`flex-1 overflow-y-auto subtle-scrollbar scroll-fade-mask`,children:[E,D,O,k]}),t[19]=E,t[20]=D,t[21]=O,t[22]=k,t[23]=A):A=t[23];let j;return t[24]!==A||t[25]!==T?(j=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[T,A]}),t[24]=A,t[25]=T,t[26]=j):j=t[26],j}function jT(e){return(0,Z.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-lg px-3 py-2.5`,children:[(0,Z.jsx)(Ch,{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)(Ch,{className:`h-3 w-28`}),(0,Z.jsx)(Ch,{className:`h-3 w-40`})]})]},e)}function MT(){return typeof document<`u`&&document.visibilityState===`hidden`}var NT=`open-knowledge:lint-source-fixed`,PT=Object.freeze({source:`local`,skipStoreHooks:!1,context:Object.freeze({origin:`lint-fix`})});function FT(e,t){let n=e.split(`
3
3
  `),r=0;for(let e=0;e<t.line&&e<n.length;e+=1)r+=n[e].length+1;let i=n[Math.min(t.line,n.length-1)]?.length??0;return r+Math.min(Math.max(t.character,0),i)}function IT(e){return e.flatMap(e=>e.fixes??[])}function LT(e,t,n){if(t.length===0)return!1;let r=e.document.getText(`source`),i=r.toString(),a=t.map(e=>({from:FT(i,e.range.start),to:FT(i,e.range.end),insert:e.newText})).sort((e,t)=>t.to-e.to||t.from-e.from||e.insert.localeCompare(t.insert)),o=0;return e.document.transact(()=>{let e=1/0,t;for(let n of a){let i=t!==void 0&&n.from===t.from&&n.to===t.to&&n.insert===t.insert;t=n,!(i||n.to>e)&&(n.to>n.from&&r.delete(n.from,n.to-n.from),n.insert.length>0&&r.insert(n.from,n.insert),e=n.from,o+=1)}},PT),o>0&&Pt(n),typeof window<`u`&&window.dispatchEvent(new CustomEvent(NT)),!0}var RT=[{id:`outline`,icon:Py},{id:`links`,icon:je},{id:`graph`,icon:Ry},{id:`timeline`,icon:dy},{id:`problems`,icon:Uf},{id:`comments`,icon:gf}],zT=[`outline`,`problems`,`comments`];function BT(e){let t=0,n=0;for(let r of e)r.severity===`error`?t+=1:n+=1;return{errorCount:t,warningCount:n}}function VT(e){return e===`outline`?ic._({id:`dD7NPy`}):e===`links`?ic._({id:`Rj01Fz`}):e===`graph`?ic._({id:`x2fr_j`}):e===`problems`?ic._({id:`OXdGnd`}):e===`comments`?ic._({id:`VbyRUy`}):ic._({id:`cklVjM`})}function HT(){return n(()=>import(`./GraphPanel-BtrVMm8t.js`),__vite__mapDeps([49,1,8,2,3,6,9,10,11,12,13,40,14,15,16,50,18,19,20,51,52,29,28,26,27,53,54,55,22,44,56,57,58,59,60,61,62,63,24,64,65,66,67,68,69,70,71,72,73,74,75,41,76,77,78,79]),import.meta.url)}var UT=(0,Q.lazy)(async()=>({default:(await HT()).GraphPanel})),WT=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-6TuvNchN.js`),__vite__mapDeps([80,1,40,14,15,16,53,54,55,18,19,20,22,44,26,27,28,81,2,82,83,13,84,85,86,87,88,89,90,91,92,8,3,6,9,10,11,12,93,76,94,95,96,97,98,99,4,5,100,51,45,21,24,23,35,34,43,101,102,36,37,66,67,68,69,70,103,78,72,29,104,105,41,106,30,65,71,73,74,107,108,109,31,25,110,111,46,112,38,42,113,114,115,116,117,118,119,120,121,122,123,124,125,126]),import.meta.url)).ActivityModeContent}));function GT(e){let t=(0,$.c)(48),{docName:n,isSourceMode:r,activeTab:i,onActiveTabChange:a,mode:o,isCollapsed:s}=e,c=s===void 0?!1:s,{_:l}=xn(),{activeProvider:u,activeDocName:d}=Ke(),{data:f}=Eh(n),p=d===n?u:null,m=Rd(p,f?.effective??null),h=tu(n),g=h.findings,_;t[0]!==g||t[1]!==m?(_=[...m,...g],t[0]=g,t[1]=m,t[2]=_):_=t[2];let v=_,y,b;t[3]!==n||t[4]!==m||t[5]!==p?(y=()=>{p!==null&&_u(n,`lint`,BT(m))},b=[n,p,m],t[3]=n,t[4]=m,t[5]=p,t[6]=y,t[7]=b):(y=t[6],b=t[7]),(0,Q.useEffect)(y,b);let x,S;t[8]!==n||t[9]!==g||t[10]!==h.status||t[11]!==p?(x=()=>{p===null||h.status!==`loaded`||_u(n,`links`,BT(g))},S=[n,p,g,h.status],t[8]=n,t[9]=g,t[10]=h.status,t[11]=p,t[12]=x,t[13]=S):(x=t[12],S=t[13]),(0,Q.useEffect)(x,S);let C;t[14]!==n||t[15]!==p?(C=e=>{p!==null&&e.fixes&&e.fixes.length>0&&LT(p,e.fixes,n)},t[14]=n,t[15]=p,t[16]=C):C=t[16];let w=C,T;t[17]!==n||t[18]!==m||t[19]!==p?(T=()=>{p!==null&&LT(p,IT(m),n)},t[17]=n,t[18]=m,t[19]=p,t[20]=T):T=t[20];let E=T,D=fr(),O;t[21]!==n||t[22]!==p?(O=e=>{if(p===null)return;let t=p.document.getText(`source`).toString().split(`
4
- `)[e.range.start.line];Vc(Jw(n,e,t),{submit:!0})},t[21]=n,t[22]=p,t[23]=O):O=t[23];let k=O,A;t[24]===n?A=t[25]:(A=e=>{Vc(Yw(e===`doc`?n:null),{submit:!0})},t[24]=n,t[25]=A);let j=A,M=rC()?RT.filter(qT):RT,N=M.some(e=>e.id===i)?i:`outline`,P=o===`doc`&&M.length>1,F,I;t[26]!==N||t[27]!==c||t[28]!==o?(F=()=>(Vw(!c&&o===`doc`&&N===`comments`),KT),I=[c,o,N],t[26]=N,t[27]=c,t[28]=o,t[29]=F,t[30]=I):(F=t[29],I=t[30]),(0,Q.useEffect)(F,I);let L=P?(0,Z.jsx)(`div`,{className:`flex flex-row items-center justify-center gap-3 p-2`,children:(0,Z.jsx)(pa,{type:`single`,variant:`outline`,value:N,onValueChange:e=>{e&&a(e)},"aria-label":l({id:`SrOuyg`}),children:M.map(e=>{let{id:t,icon:n}=e,r=VT(t),i=t===`problems`&&v.length>0;return(0,Z.jsxs)(br,{children:[(0,Z.jsx)(da,{value:t,role:`tab`,id:`tab-${t}`,"aria-controls":`panel-${t}`,"aria-label":i?l({id:`2m_bmh`,values:{0:v.length,label:r}}):r,asChild:!0,children:(0,Z.jsxs)(_r,{className:`relative`,children:[(0,Z.jsx)(n,{}),i&&(0,Z.jsx)(wm,{variant:`notification`,"aria-hidden":`true`,className:`pointer-events-none absolute -top-0.5 right-0.5 h-3.5 min-w-3.5 rounded-full px-1 font-sans text-[9px] leading-none tabular-nums`,children:v.length>99?`99+`:v.length})]})}),(0,Z.jsx)(vr,{side:`bottom`,children:r})]},t)})})}):null,R;t[31]!==v||t[32]!==n||t[33]!==N||t[34]!==k||t[35]!==E||t[36]!==w||t[37]!==j||t[38]!==r||t[39]!==h.status||t[40]!==p||t[41]!==o||t[42]!==P||t[43]!==D?(R=o===`doc`?(0,Z.jsxs)(`div`,{...P?{role:`tabpanel`,id:`panel-${N}`,"aria-labelledby":`tab-${N}`}:{},className:`min-h-0 flex-1`,children:[N===`outline`&&(0,Z.jsx)(ku,{docName:n,isSourceMode:r}),N===`links`&&(0,Z.jsx)(uT,{docName:n}),N===`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)(Y,{id:`-lCAuQ`})}),children:(0,Z.jsx)(UT,{activeDocName:n})}),N===`timeline`&&(0,Z.jsx)(AT,{docName:n}),N===`comments`&&(0,Z.jsx)(Lw,{docName:n}),N===`problems`&&(0,Z.jsx)(Tu,{docName:n,diagnostics:v,linkFindingsStatus:h.status,onFix:p===null?void 0:w,onAutoFix:p===null?void 0:E,onAskAi:p!==null&&D!==null?k:void 0,onFixWithAi:D===null?void 0:j})]}):(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)(Y,{id:`ONPvOb`})}),children:(0,Z.jsx)(WT,{})})}),t[31]=v,t[32]=n,t[33]=N,t[34]=k,t[35]=E,t[36]=w,t[37]=j,t[38]=r,t[39]=h.status,t[40]=p,t[41]=o,t[42]=P,t[43]=D,t[44]=R):R=t[44];let z;return t[45]!==L||t[46]!==R?(z=(0,Z.jsxs)(Z.Fragment,{children:[L,R]}),t[45]=L,t[46]=R,t[47]=z):z=t[47],z}function KT(){return Vw(!1)}function qT(e){return zT.includes(e.id)}function JT(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function YT(e,t){let n=getComputedStyle(e.ownerDocument.documentElement);return t*parseFloat(n.fontSize)}function XT(e){return e/100*window.innerHeight}function ZT(e){return e/100*window.innerWidth}function QT(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 $T({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=QT(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=YT(t,i);break;case`em`:r=JT(t,i);break;case`vh`:r=XT(i);break;case`vw`:r=ZT(i);break}return r}function eE(e){return parseFloat(e.toFixed(3))}function tE({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 nE(e){let{panels:t}=e,n=tE({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=eE($T({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=eE($T({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=eE($T({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=eE($T({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 rE(e,t=`Assertion error`){if(!e)throw Error(t)}function iE(e,t){return Array.from(t).sort(e===`horizontal`?aE:oE)}function aE(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function oE(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function sE(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function cE(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 lE({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}=cE(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return rE(i,`No rect found`),i}var uE;function dE(){return uE===void 0&&(uE=typeof matchMedia==`function`?!!matchMedia(`(pointer:coarse)`).matches:!1),uE}function fE(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=iE(n,Array.from(t.children).filter(sE).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,lE({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=dE()?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:tE({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 pE=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)}}},mE={cursorFlags:0,state:`inactive`},hE=new pE;function gE(){return mE}function _E(e){return hE.addListener(`change`,e)}function vE(e){let t=mE,n={...mE};n.cursorFlags=e,mE=n,hE.emit(`change`,{prev:t,next:n})}function yE(e){let t=mE;mE=e,hE.emit(`change`,{prev:t,next:e})}var bE=e=>e,xE=()=>{},SE=1,CE=2,wE=4,TE=8,EE=3,DE=12,OE;function kE(){return OE===void 0&&(OE=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(OE=!0)),OE}function AE({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&&kE()){let t=(e&SE)!==0,n=(e&CE)!==0,r=(e&wE)!==0,i=(e&TE)!==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 kE()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var jE=new WeakMap;function ME(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=jE.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&(Object.isExtensible(e.adoptedStyleSheets)?e.adoptedStyleSheets.push(n):e.adoptedStyleSheets=[...e.adoptedStyleSheets,n]));let r=gE();switch(r.state){case`active`:case`hover`:{let e=AE({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}jE.set(e,{prevStyle:t,styleSheet:n})}var NE=new Map,PE=new pE;function FE(e){NE=new Map(NE),NE.delete(e)}function IE(e,t){for(let[t]of NE)if(t.id===e)return t}function LE(e,t){for(let[t,n]of NE)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function RE(){return NE}function zE(e,t){return PE.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function BE(e,t,n){let r=NE.get(e);NE=new Map(NE),NE.set(e,t),PE.emit(`groupChange`,{group:e,isUserInteraction:n?.isUserInteraction===!0,prev:r,next:t})}function VE(e){let t=gE(),n=!1;switch(t.state){case`active`:yE({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&(ME(e),n=!0,t.hitRegions.forEach(e=>{let t=LE(e.group.id,!0);BE(e.group,t,{isUserInteraction:!0})}))}return n}function HE(e){e.defaultPrevented||VE(e.currentTarget)}function UE(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=cE(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 WE(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function GE(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:ZE(e),b:ZE(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();rE(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:XE(YE(n.a)),b:XE(YE(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 KE=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function qE(e){let t=getComputedStyle(QE(e)??e).display;return t===`flex`||t===`inline-flex`}function JE(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||qE(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`||KE.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function YE(e){let t=e.length;for(;t--;){let n=e[t];if(rE(n,`Missing node`),JE(n))return n}return null}function XE(e){return e&&Number(getComputedStyle(e).zIndex)||0}function ZE(e){let t=[];for(;e;)t.push(e),e=QE(e);return t}function QE(e){let{parentNode:t}=e;return WE(t)?t.host:t}function $E(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 eD({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!sE(n)||n.contains(e)||e.contains(n))return!0;if(GE(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if($E(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function tD(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=fE(r),a=UE(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&eD({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function nD(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 rD(e,t,n=0){return Math.abs(eE(e)-eE(t))<=n}function iD(e,t){return rD(e,t)?0:e>t?1:-1}function aD({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(iD(r,c)<0)if(a){let e=(i+c)/2;r=iD(r,e)<0?i:c}else r=c;return r=Math.min(s,r),r=eE(r),r}function oD({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(rD(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;rE(u!=null,`Invalid first pivot index`),rE(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];rE(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(rE(n!=null,`Previous layout not found for panel index ${t}`),rD(n,i)){let t=o-n;iD(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];rE(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(rE(n!=null,`Previous layout not found for panel index ${t}`),rD(n,o)){let t=n-i;iD(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];rE(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&iD(i,c)<0)if(e>0){let t=c-o,n=t/2;iD(i+e,c)<0&&(e=iD(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;iD(i-e,c)<0&&(e=iD(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];rE(e!=null,`Previous layout not found for panel index ${r}`);let a=aD({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];rE(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=aD({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!rD(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(nD(c,l))return i;{let t=e<0?d:u,r=s[t];rE(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=aD({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!rD(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];rE(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=aD({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(rD(i,s)||(t-=s-i,l[r]=s),rD(t,0))break;e>0?r--:r++}}}if(!rD(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 sD(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||iD(e[n],t[n])!==0)return!1;return!0}function cD({layout:e,panelConstraints:t}){let n=Object.values(e),r=[...n];r.length!==t.length&&(e=xD(t),n=Object.values(e),r=[...n]);let i=r.reduce((e,t)=>e+t,0);if(!rD(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];rE(t!=null,`No layout data found for index ${e}`);let n=100/i*t;r[e]=n}let a=0;for(let e=0;e<t.length;e++){let i=n[e];rE(i!=null,`No layout data found for index ${e}`);let o=r[e];rE(o!=null,`No layout data found for index ${e}`);let s=aD({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!rD(a,0))for(let e=0;e<t.length;e++){let n=r[e];rE(n!=null,`No layout data found for index ${e}`);let i=n+a,o=aD({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,rD(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function lD({groupId:e,panelId:t}){let n=()=>{let t=RE();for(let[n,{defaultLayoutDeferred:r,derivedPanelConstraints:i,layout:a,groupSize:o,separatorToPanels:s}]of t)if(n.id===e)return{defaultLayoutDeferred:r,derivedPanelConstraints:i,group:n,groupSize:o,layout:a,separatorToPanels:s};throw Error(`Group ${e} not found`)},r=()=>{let e=n().derivedPanelConstraints.find(e=>e.panelId===t);if(e!==void 0)return e;throw Error(`Panel constraints not found for Panel ${t}`)},i=()=>{let e=n().group.panels.find(e=>e.id===t);if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},a=()=>{let e=n().layout[t];if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},o=({nextSize:e,panels:n,prevLayout:r,derivedPanelConstraints:i})=>{let o=a(),s=n.findIndex(e=>e.id===t),c=s===0,l=s===n.length-1;if(l&&e<o&&(c||n.slice(0,s).every((e,t)=>{let n=i[t];return n?.collapsible&&rD(n.collapsedSize,r[n.panelId])}))){let e=n.slice(0,s).reduce((e,t)=>e+r[t.id],0);return{...r,[t]:eE(100-e)}}return oD({delta:l?o-e:e-o,initialLayout:r,panelConstraints:i,pivotIndices:l?[s-1,s]:[s,s+1],prevLayout:r,trigger:`imperative-api`})},s=e=>{if(e===a())return;let{defaultLayoutDeferred:t,derivedPanelConstraints:r,group:i,groupSize:s,layout:c,separatorToPanels:l}=n(),u=cD({layout:o({nextSize:e,panels:i.panels,prevLayout:c,derivedPanelConstraints:r}),panelConstraints:r});sD(c,u)||BE(i,{defaultLayoutDeferred:t,derivedPanelConstraints:r,groupSize:s,layout:u,separatorToPanels:l})};return{collapse:()=>{let{collapsible:e,collapsedSize:t}=r(),{mutableValues:n}=i(),o=a();e&&o!==t&&(n.expandToSize=o,s(t))},expand:()=>{let{collapsible:e,collapsedSize:t,minSize:n}=r(),{mutableValues:o}=i(),c=a();if(e&&c===t){let e=o.expandToSize??n;e===0&&(e=1),s(e)}},getSize:()=>{let{group:e}=n(),t=a(),{element:r}=i();return{asPercentage:t,inPixels:e.orientation===`horizontal`?r.offsetWidth:r.offsetHeight}},isCollapsed:()=>{let{collapsible:e,collapsedSize:t}=r(),n=a();return e&&rD(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=tE({group:t});s(eE($T({groupSize:a,panelElement:r,styleProp:e})/a*100))}}}function uD(e){e.defaultPrevented||tD(e,RE()).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=lD({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function dD(e){let t=RE();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 fD({groupId:e}){let t=()=>{let t=RE();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=cD({layout:e,panelConstraints:r});return n?o:(sD(o,c)||BE(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function pD(e,t){let n=dD(e),r=LE(n.id,!0),i=n.separators.find(t=>t.element===e);rE(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);rE(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=fD({groupId:n.id}).getLayout(),c=cD({layout:oD({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});sD(s,c)||BE(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels},{isUserInteraction:!0})}function mD(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=dD(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&pD(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&pD(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&pD(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&pD(t,-5);break;case`End`:e.preventDefault(),pD(t,100);break;case`Enter`:{e.preventDefault();let n=dD(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=LE(n.id,!0),o=n.separators.find(e=>e.element===t);rE(o,`Matching separator not found`);let s=a.get(o);rE(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(rE(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];pD(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=dD(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);rE(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(),pD(t,-100);break}}function hD(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=RE(),n=tD(e,t),r=new Map,i=!1;n.forEach(e=>{e.separator&&(i||(i=!0,e.separator.element.focus({focusVisible:!1,preventScroll:!0})));let n=t.get(e.group);n&&r.set(e.group,n.layout)}),yE({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}function gD({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=oD({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(sD(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?SE:CE;break;case`vertical`:s|=d<0?wE:TE;break}}else BE(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&EE:c|=s&EE,t.movementY===0?c|=o&DE:c|=s&DE,vE(c),ME(e)}function _D(e){let t=RE(),n=gE();switch(n.state){case`active`:gD({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function vD(e){if(e.defaultPrevented)return;let t=gE(),n=RE();switch(t.state){case`active`:if(e.buttons===0){yE({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{let t=LE(e.group.id,!0);BE(e.group,t,{isUserInteraction:!0})});return}for(let n of t.hitRegions)if(n.separator){let{element:t}=n.separator;t.hasPointerCapture?.(e.pointerId)||t.setPointerCapture?.(e.pointerId)}gD({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=tD(e,n);r.length===0?t.state!==`inactive`&&yE({cursorFlags:0,state:`inactive`}):yE({cursorFlags:0,hitRegions:r,state:`hover`}),ME(e.currentTarget);break}}}function yD(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(gE().state){case`hover`:yE({cursorFlags:0,state:`inactive`})}}function bD(e){e.defaultPrevented||e.pointerType===`mouse`&&e.button>0||VE(e.currentTarget)&&e.preventDefault()}function xD(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=eE(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=eE((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function SD(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=tE({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:eE(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function CD(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 wD({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=eE(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]=eE((r[e]??0)/a*l);else{let e=eE(l/c.length);for(let t of c)u[t]=e}return u}function TD(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 ED=new Map;function DD(e){let t=!0;rE(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=tE({group:e});if(t===0)return;let n=LE(e.id);if(!n)return;let r=nE(e),i=n.defaultLayoutDeferred?xD(r):n.layout,a=cD({layout:wD({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&sD(n.layout,a)&&CD(n.derivedPanelConstraints,r)&&n.groupSize===t)return;BE(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else SD(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{rE(!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=tE({group:e}),s=nE(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(TD(e.panels,l)||(l=void 0));let u=cD({layout:e.mutableState.layouts[c]??l??xD(s),panelConstraints:s}),d=e.element.ownerDocument;ED.set(d,(ED.get(d)??0)+1);let f=new Map;return fE(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),BE(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{rE(!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`,mD)}),d.addEventListener(`contextmenu`,HE,!0),d.addEventListener(`dblclick`,uD,!0),d.addEventListener(`pointerdown`,hD,!0),d.addEventListener(`pointerleave`,_D),d.addEventListener(`pointermove`,vD),d.addEventListener(`pointerout`,yD),d.addEventListener(`pointerup`,bD,!0),function(){t=!1,ED.set(d,Math.max(0,(ED.get(d)??0)-1)),FE(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,mD)}),ED.get(d)||(d.removeEventListener(`contextmenu`,HE,!0),d.removeEventListener(`dblclick`,uD,!0),d.removeEventListener(`pointerdown`,hD,!0),d.removeEventListener(`pointerleave`,_D),d.removeEventListener(`pointermove`,vD),d.removeEventListener(`pointerout`,yD),d.removeEventListener(`pointerup`,bD,!0)),a.disconnect()}}function OD(){let[e,t]=(0,Q.useState)({});return[e,(0,Q.useCallback)(()=>t({}),[])]}function kD(e){let t=(0,Q.useId)();return`${e??t}`}var AD=typeof window<`u`?Q.useLayoutEffect:Q.useEffect;function jD(e){let t=(0,Q.useRef)(e);return AD(()=>{t.current=e},[e]),(0,Q.useCallback)((...e)=>t.current?.(...e),[t])}function MD(...e){return jD(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t;break}})})}function ND(e){let t=(0,Q.useRef)({...e});return AD(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var PD=(0,Q.createContext)(null);function FD(e,t){let n=(0,Q.useRef)({getLayout:()=>({}),setLayout:bE});(0,Q.useImperativeHandle)(t,()=>n.current,[]),AD(()=>{Object.assign(n.current,fD({groupId:e}))})}function ID({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=jD(e=>{sD(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=jD((e,t)=>{sD(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e,{isUserInteraction:t}))}),_=kD(s),v=(0,Q.useRef)(null),[y,b]=OD(),x=(0,Q.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),S=MD(v,a);FD(_,o);let C=jD((e,t)=>{let r=gE(),i=IE(e),a=LE(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=ND({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=iE(u,[...t.panels,e]),b(),()=>{t.panels=t.panels.filter(t=>t!==e),b()}},registerSeparator:e=>{let t=x.current;return t.separators=iE(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=IE(_),i=LE(_);r&&i&&BE(r,{...i,derivedPanelConstraints:nE(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 AD(()=>{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=DD(r),{defaultLayoutDeferred:o,derivedPanelConstraints:s,layout:c}=LE(r.id,!0);!o&&s.length>0&&(h(c),g(c,!1));let l=zE(_,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=rD(t.collapsedSize,i[t.panelId]),a=rD(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=gE().state!==`active`;h(i),o&&g(i,e.isUserInteraction)});return()=>{E.current=null,a(),l()}},[i,_,g,h,u,y,w]),(0,Q.useEffect)(()=>{let e=E.current;e&&(e.mutableState.defaultLayout=n,e.mutableState.disableCursor=!!r)}),(0,Z.jsx)(PD.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})})}ID.displayName=`Group`;function LD(){return(0,Q.useRef)(null)}function RD(){let e=(0,Q.useContext)(PD);return rE(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function zD(e,t){let{id:n}=RD(),r=(0,Q.useRef)({collapse:xE,expand:xE,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:xE});(0,Q.useImperativeHandle)(t,()=>r.current,[]),AD(()=>{Object.assign(r.current,lD({groupId:n,panelId:e}))})}function BD({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=kD(c),_=ND({disabled:a}),v=(0,Q.useRef)(null),y=MD(v,o),{getPanelStyles:b,id:x,orientation:S,registerPanel:C,updatePanelProps:w}=RD(),T=d!==null,E=jD((e,t,n)=>{d?.(e,c,n)});AD(()=>{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]),zD(g,f);let D=()=>{let e=b(x,g);if(e)return JSON.stringify(e)},O=(0,Q.useSyncExternalStore)(e=>zE(x,e),D,D),k;return k=O?JSON.parse(O):i===void 0?{flexGrow:1}:{flexGrow:void 0,flexShrink:void 0,flexBasis:i},(0,Z.jsx)(`div`,{...m,"data-disabled":a||void 0,"data-panel":!0,"data-testid":g,id:g,ref:y,style:{...VD,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})})}BD.displayName=`Panel`;var VD={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function HD(){return(0,Q.useRef)(null)}function UD({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=cD({layout:oD({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=cD({layout:oD({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function WD({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...s}){let c=kD(a),l=ND({disabled:n,disableDoubleClick:r}),[u,d]=(0,Q.useState)({}),[f,p]=(0,Q.useState)(`inactive`),[m,h]=(0,Q.useState)(!1),g=(0,Q.useRef)(null),_=MD(g,i),{disableCursor:v,id:y,orientation:b,registerSeparator:x,updateSeparatorProps:S}=RD(),C=b===`horizontal`?`vertical`:`horizontal`;AD(()=>{let e=g.current;if(e!==null){let t={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:e,id:c},n=x(t),r=_E(e=>{p(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=zE(y,e=>{let{derivedPanelConstraints:n,layout:r,separatorToPanels:i}=e.next,a=i.get(t);if(a){let e=a[0],t=a.indexOf(e);d(UD({layout:r,panelConstraints:n,panelId:e.id,panelIndex:t}))}});return()=>{r(),i(),n()}}},[y,c,x,l]),(0,Q.useEffect)(()=>{S(c,{disabled:n,disableDoubleClick:r})},[n,r,c,S]);let w;n&&!v&&(w=`not-allowed`);let T;if(n)T=`disabled`;else switch(f){case`active`:T=`active`;break;default:T=m?`focus`:f}return(0,Z.jsx)(`div`,{...s,"aria-controls":u.valueControls,"aria-disabled":n||void 0,"aria-orientation":C,"aria-valuemax":u.valueMax,"aria-valuemin":u.valueMin,"aria-valuenow":u.valueNow,children:e,className:t,"data-separator":T,"data-testid":c,id:c,onBlur:()=>h(!1),onFocus:()=>h(!0),ref:_,role:`separator`,style:{flexBasis:`auto`,cursor:w,...o,flexGrow:0,flexShrink:0,touchAction:`none`},tabIndex:n?void 0:0})}WD.displayName=`Separator`;function GD(e){let t=(0,$.c)(55),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}=xn(),[o,s]=(0,Q.useState)(`diagram`),l=Fh(i),u;t[4]===n?u=t[5]:(u={"data-mermaid-file-viewer-extension":n},t[4]=n,t[5]=u);let d=u;if(l.status===`loading`){let e;return t[6]!==d||t[7]!==r?(e=(0,Z.jsx)(Bh,{fileName:r,dataAttr:`data-mermaid-file-viewer`,extraAttrs:d}),t[6]=d,t[7]=r,t[8]=e):e=t[8],e}if(l.status===`error`){let e=l.message,a;t[9]!==n||t[10]!==l.httpStatus||t[11]!==r||t[12]!==i.assetPath?(a=Ph({assetPath:i.assetPath,fileName:r,extension:n,httpStatus:l.httpStatus}),t[9]=n,t[10]=l.httpStatus,t[11]=r,t[12]=i.assetPath,t[13]=a):a=t[13];let o;return t[14]!==d||t[15]!==l.message||t[16]!==r||t[17]!==a?(o=(0,Z.jsx)(Rh,{fileName:r,dataAttr:`data-mermaid-file-viewer`,extraAttrs:d,message:e,openFile:a}),t[14]=d,t[15]=l.message,t[16]=r,t[17]=a,t[18]=o):o=t[18],o}let f=l.content,p;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(p=e=>{e&&s(e)},t[19]=p):p=t[19];let m;t[20]===a?m=t[21]:(m=a({id:`72xhRD`}),t[20]=a,t[21]=m);let h;t[22]===a?h=t[23]:(h=a({id:`DEWDbv`}),t[22]=a,t[23]=h);let g;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(_r,{children:(0,Z.jsx)(c,{className:`size-4`})}),t[24]=g):g=t[24];let _;t[25]===h?_=t[26]:(_=(0,Z.jsx)(da,{value:`diagram`,"aria-label":h,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,asChild:!0,children:g}),t[25]=h,t[26]=_);let v;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(vr,{side:`bottom`,children:(0,Z.jsx)(Y,{id:`i-ShMB`})}),t[27]=v):v=t[27];let y;t[28]===_?y=t[29]:(y=(0,Z.jsxs)(br,{children:[_,v]}),t[28]=_,t[29]=y);let b;t[30]===a?b=t[31]:(b=a({id:`Y6SK9K`}),t[30]=a,t[31]=b);let x;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(_r,{children:(0,Z.jsx)(st,{className:`size-4`})}),t[32]=x):x=t[32];let S;t[33]===b?S=t[34]:(S=(0,Z.jsx)(da,{value:`source`,"aria-label":b,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,asChild:!0,children:x}),t[33]=b,t[34]=S);let C;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(vr,{side:`bottom`,children:(0,Z.jsx)(Y,{id:`wdxz7K`})}),t[35]=C):C=t[35];let w;t[36]===S?w=t[37]:(w=(0,Z.jsxs)(br,{children:[S,C]}),t[36]=S,t[37]=w);let T;t[38]!==o||t[39]!==w||t[40]!==m||t[41]!==y?(T=(0,Z.jsx)(`div`,{className:`flex shrink-0 items-center justify-center border-b bg-background py-2`,children:(0,Z.jsxs)(pa,{type:`single`,value:o,onValueChange:p,"aria-label":m,variant:`segmented`,size:`sm`,spacing:1,className:`shrink-0 bg-muted p-0.5 data-[size=sm]:rounded-[10px]`,children:[y,w]})}),t[38]=o,t[39]=w,t[40]=m,t[41]=y,t[42]=T):T=t[42];let E;t[43]!==n||t[44]!==r||t[45]!==o||t[46]!==i||t[47]!==f?(E=(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)(Pl,{chart:f,className:`min-h-0 flex-1`})}):(0,Z.jsx)(Ih,{...i,fileName:r,extension:n})}),t[43]=n,t[44]=r,t[45]=o,t[46]=i,t[47]=f,t[48]=E):E=t[48];let D;return t[49]!==d||t[50]!==r||t[51]!==o||t[52]!==T||t[53]!==E?(D=(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,...d,children:[T,E]}),t[49]=d,t[50]=r,t[51]=o,t[52]=T,t[53]=E,t[54]=D):D=t[54],D}function KD(e){return Eo(`/api/asset?path=${encodeURIComponent(e)}`)}function qD(e){return`/api/asset-text?path=${encodeURIComponent(e)}`}function JD(e){let t=(0,$.c)(8),{assetPath:n,mediaKind:r}=e,i;t[0]===n?i=t[1]:(i=(0,Z.jsx)(zh,{entry:{kind:`asset`,path:n},className:`shrink-0 border-b bg-background px-3 py-1.5`}),t[0]=n,t[1]=i);let a;t[2]!==n||t[3]!==r?(a=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(YD,{assetPath:n,mediaKind:r})}),t[2]=n,t[3]=r,t[4]=a):a=t[4];let o;return t[5]!==i||t[6]!==a?(o=(0,Z.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[i,a]}),t[5]=i,t[6]=a,t[7]=o):o=t[7],o}function YD(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=KD(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)(L,{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=qD(n),t[19]=n,t[20]=e),p=(0,Z.jsx)(Ih,{src:e,assetPath:n,fileName:l,extension:f.toLowerCase()},n);break bb0}if(u===`mermaid`){let e;t[21]===n?e=t[22]:(e=qD(n),t[21]=n,t[22]=e),p=(0,Z.jsx)(GD,{src:e,assetPath:n,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)(Pe,{src:s,alt:l,draggable:!1,targetExistence:`exists`,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)(X,{variant:`default`,size:`sm`,onClick:()=>a(!0),"data-testid":`asset-preview-open-as-text`,className:`font-mono uppercase`,children:(0,Z.jsx)(Y,{id:`qFWMl-`})}),(0,Z.jsx)(X,{variant:`outline`,size:`sm`,className:`font-mono uppercase`,onClick:()=>{nh({url:s,projectRelPath:n,ext:f.toLowerCase(),title:l,forceOsDelegation:!1})},children:(0,Z.jsx)(Y,{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 XD(){let e=(0,$.c)(5),{_:t}=xn(),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)(Ch,{className:`h-9 w-2/5 mt-6 mb-5`}),(0,Z.jsx)(Ch,{className:`h-4 w-full`}),(0,Z.jsx)(Ch,{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 ZD(e){let{_:t}=xn();return e===`existing-repo`?[{id:`draft-spec`,icon:yy,label:t({id:`LdKIHS`}),prompt:t({id:`N_7kkF`})},{id:`organize-specs`,icon:Py,label:t({id:`cuA8QW`}),prompt:t({id:`mPy9lS`})},{id:`document-architecture`,icon:Ry,label:t({id:`6eniID`}),prompt:t({id:`uDlyqd`})}]:[{id:`competitor-research`,icon:ob,label:t({id:`GUqTzn`}),prompt:t({id:`KOZud0`})},{id:`eng-specs`,icon:yy,label:t({id:`Qvls7J`}),prompt:t({id:`6qMe0o`})},{id:`bird-wiki`,icon:iy,label:t({id:`FqTpiN`}),prompt:t({id:`jtg_8-`})}]}function QD(e){let t=(0,$.c)(13),{scenario:n,className:r}=e,{_:i}=xn(),a=ZD(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){tr(t).then(()=>{s(e),clearTimeout(c.current),c.current=setTimeout(()=>s(null),1600)}).catch($D)};t[8]===r?d=t[9]:(d=Qn(`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)(X,{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:Qn(`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)(Yl,{className:`size-3.5`,"aria-hidden":`true`}):(0,Z.jsx)(fe,{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 $D(){}function eO(e,t,n){return e.trim().length>0||t.length>0||n}new Set(hi.map(e=>e.id));function tO(e,t){jc(e,t)}function nO(e){let t=(0,$.c)(32),{scenario:n,className:r}=e,{_:i}=xn(),{states:a,refresh:o}=nr(),s=di(),{dispatch:c}=gl(),l=xl(),u=fr(),[d,f]=(0,Q.useState)(iO),p=fi(),m=pi(),h;t[0]===s?h=t[1]:(h=e=>gi(s,e.source,e.id,!0,e.supported),t[0]=s,t[1]=h);let g=m.filter(h),_=mi(g,p),v;t[2]===u?.installedClis?v=t[3]:(v=u?.installedClis??{},t[2]=u?.installedClis,t[3]=v);let y=Cc({sticky:d,effectiveThreadAgent:_,enabledClis:u===null?[]:Hc(s,u.installedClis),enabledDesktopTargets:Tc(s,a),unresolvedDesktopTargets:hc(s,a),installedClis:v,terminalAvailable:u!==null,threadsAvailable:!0,desktopSelectable:!0}),b=y.kind===`thread`,x=y.kind===`cli`?y.cli:null,S=y.kind===`desktop`?y.target:null,C=x!==null,w=(0,Q.useRef)(null),[T]=(0,Q.useState)(rO),[E,D]=(0,Q.useState)(!0),[O,k]=(0,Q.useState)(!1),A;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(e){D(e),e||k(!1)},t[4]=A):A=t[4];let j=A,M=ZD(n),N;t[5]!==s||t[6]!==a?(N=e=>xi(s,e.id,a[e.id]?.installed),t[5]=s,t[6]=a,t[7]=N):N=t[7];let P=hi.filter(N),F=hi.every(e=>a[e.id]?.installed!=null),I=u!==null&&Hc(s,u.installedClis).length>0,L=F&&P.length===0&&g.length===0&&!I,R;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(R=function(e){f(e),jc(e),tO(e)},t[8]=R):R=t[8];let z=R,B;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(B=function(e){f(mc(e)),jc(mc(e))},t[9]=B):B=t[9];let V=B,H;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(H=function(e){ui(e),f(_c),jc(_c)},t[10]=H):H=t[10];let U=H,ee=function(){let{instruction:e,mentions:t}=w.current?.getContent()??{instruction:``,mentions:[]};if(!eO(e,t,!1)){k(!0);return}let r=rl({workspace:l,description:e,scenario:n,mentions:t});r!==null&&(Jc(r,_===null?void 0:{agent:{source:_.source,id:_.id}}),w.current?.clear(),Xi())},W=function(){if(u===null||x===null)return;let{instruction:e,mentions:t}=w.current?.getContent()??{instruction:``,mentions:[]};if(!eO(e,t,!1)){k(!0);return}let r=rl({workspace:l,description:e,scenario:n,mentions:t});r!==null&&(u.launchInTerminal(r,x),w.current?.clear(),Xi())},te=function(e){let{instruction:t,mentions:r}=w.current?.getContent()??{instruction:``,mentions:[]};if(!eO(t,r,!1)){k(!0);return}if(tO(e),a[e]?.installed!==!0){let t=hi.find(t=>t.id===e);t&&Xc(t);return}let i=rl({workspace:l,description:t,scenario:n,mentions:r});i!==null&&(c(e,i),w.current?.clear(),Xi())},G=function(){b?ee():C?W():S!==null&&te(S)},K=function(e){w.current?.setText(e),w.current?.focus()};if(L){let e;t[11]===r?e=t[12]:(e=Qn(`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[11]=r,t[12]=e);let n;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(re,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`}),t[13]=n):n=t[13];let i;t[14]===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)(Y,{id:`XT-L4j`})})]}),t[14]=i):i=t[14];let a;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsxs)(X,{type:`button`,variant:`outline`,size:`sm`,onClick:Xs,className:`gap-1.5`,"data-testid":`create-configure-agents`,children:[(0,Z.jsx)(Yn,{"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(Y,{id:`jRAGrQ`})]}),t[15]=a):a=t[15];let o;return t[16]===e?o=t[17]:(o=(0,Z.jsxs)(`div`,{className:e,"data-testid":`create-no-agents`,children:[i,a]}),t[16]=e,t[17]=o),o}let q=u?Hc(s,u.installedClis):[],ne=P.length>0,J=q.length>0,ie=g.length>0,ae=y.kind!==`none`,oe;t[18]===r?oe=t[19]:(oe=Qn(`flex w-full flex-col gap-3`,r),t[18]=r,t[19]=oe);let se;t[20]!==i||t[21]!==n?(se=i(n===`skill`?{id:`Dut9Ht`}:{id:`7hctf2`}),t[20]=i,t[21]=n,t[22]=se):se=t[22];let ce;t[23]!==i||t[24]!==n?(ce=i(n===`skill`?{id:`eNhWUl`}:{id:`0jD-Gn`}),t[23]=i,t[24]=n,t[25]=ce):ce=t[25];let le;t[26]!==E||t[27]!==O?(le=O&&E?(0,Z.jsx)(`p`,{role:`alert`,className:`text-1sm text-destructive`,"data-testid":`create-input-required`,children:(0,Z.jsx)(Y,{id:`1FLarN`})}):(0,Z.jsx)(`span`,{}),t[26]=E,t[27]=O,t[28]=le):le=t[28];let ue=ae?(0,Z.jsxs)(Zi,{children:[(0,Z.jsx)(X,{type:`button`,onClick:()=>b?ee():C?W():S===null?void 0:te(S),variant:`outline`,className:`gap-1.5`,"data-testid":`create-with-agent`,children:b&&_!==null?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ll,{agentId:_.id,iconUrl:_.iconUrl,className:`size-3.5`}),(0,Z.jsx)(tl,{agentName:_.name})]}):C&&x!==null?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ai,{id:Di(x),"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(Y,{id:`ti6aF_`,values:{0:Ao[x].displayName}})]}):S===null?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ai,{id:S,"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(ul,{displayName:_l(S)}),(0,Z.jsx)(Fl,{"aria-hidden":`true`,className:`size-3.5`})]})}),(0,Z.jsxs)(Wi,{onOpenChange:e=>{e&&o()},children:[(0,Z.jsx)(Ri,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,"aria-label":i({id:`nskygk`}),size:`icon`,variant:`outline`,"data-testid":`create-with-agent-menu`,children:(0,Z.jsx)(Zl,{"aria-hidden":`true`,className:`size-3.5`})})}),(0,Z.jsxs)(Hi,{align:`end`,className:`max-h-80 min-w-[200px]`,children:[ie?(0,Z.jsxs)(Ii,{"aria-label":i({id:`vPKX2i`}),children:[(0,Z.jsxs)(Bi,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(Y,{id:`RXEbZy`}),(0,Z.jsx)(Ci,{})]}),g.map(e=>(0,Z.jsxs)(Mi,{onSelect:()=>U(e),"data-testid":`create-agent-option-thread-${e.source}:${e.id}`,children:[(0,Z.jsx)(Ll,{agentId:e.id,iconUrl:e.iconUrl,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1 truncate`,children:e.name}),b&&_!==null&&_.source===e.source&&_.id===e.id?(0,Z.jsx)(Yl,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},`${e.source}:${e.id}`))]}):null,ie&&(J||ne)?(0,Z.jsx)(Gi,{}):null,J?(0,Z.jsxs)(Ii,{"aria-label":i({id:`ALhMYW`}),children:[(0,Z.jsx)(Bi,{children:(0,Z.jsx)(Y,{id:`ALhMYW`})}),q.map(e=>{let{displayName:t}=Ao[e];return(0,Z.jsxs)(Mi,{onSelect:()=>V(e),"data-testid":`create-with-cli-${e}`,"aria-label":i({id:`QYfQdv`,values:{displayName:t}}),children:[(0,Z.jsx)(Ai,{id:Di(e),"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:t}),x===e?(0,Z.jsx)(Yl,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e)})]}):null,ne?(0,Z.jsxs)(Z.Fragment,{children:[J?(0,Z.jsx)(Gi,{}):null,(0,Z.jsxs)(Ii,{"aria-label":i({id:`BwKH4d`}),children:[(0,Z.jsxs)(Bi,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(Y,{id:`BwKH4d`}),(0,Z.jsx)(Fl,{"aria-hidden":`true`,className:`size-3`})]}),P.map(e=>(0,Z.jsxs)(Mi,{onSelect:()=>z(e.id),"data-testid":`create-agent-option-${e.id}`,children:[(0,Z.jsx)(Ai,{id:e.id,"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(nl,{displayName:e.displayName})}),!C&&e.id===S?(0,Z.jsx)(Yl,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.id))]})]}):null,(0,Z.jsx)(Gi,{}),(0,Z.jsxs)(Mi,{onSelect:Xs,"data-testid":`create-agent-option-settings`,children:[(0,Z.jsx)(Yn,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(Y,{id:`jRAGrQ`})})]})]})]})]}):(0,Z.jsx)(X,{type:`button`,variant:`outline`,disabled:!0,className:`gap-1.5`,"data-testid":`create-with-agent`,children:(0,Z.jsx)(Y,{id:`hYgDIe`})}),de;return t[29]!==le||t[30]!==ue?(de=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 px-3 pb-3`,children:[le,ue]}),t[29]=le,t[30]=ue,t[31]=de):de=t[31],(0,Z.jsxs)(`div`,{className:oe,children:[(0,Z.jsxs)(`div`,{onMouseDown:e=>ta(e,w),className:`flex w-full cursor-text flex-col rounded-2xl border border-border/60 bg-card shadow-sm transition-colors focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50`,children:[(0,Z.jsx)(ea,{ref:w,ariaLabel:se,placeholder:ce,onEmptyChange:j,onContentChange:oa,onSubmit:G,initialDoc:T,className:`max-h-96 overflow-y-auto px-4 py-3 text-sm leading-relaxed subtle-scrollbar [&_.ProseMirror]:min-h-16`}),de]}),n===`new-project`&&M.length>0?(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-1sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`I5685_`})}),M.map(e=>{let t=e.icon;return(0,Z.jsxs)(X,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>K(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 rO(){return aa().doc??void 0}function iO(){return gc()}function aO(e){let t=(0,$.c)(18),{title:n,subtitle:r,celebrateSignal:i,onRageStreak:a}=e,o=(0,Q.useRef)(0),s=(0,Q.useRef)(null),c;t[0]===a?c=t[1]:(c=function(){let e=typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now(),t=s.current,n=t===null?1/0:e-t;s.current=e;let r=Tv(o.current,n);o.current=r,!(r<6)&&(o.current=0,a?.())},t[0]=a,t[1]=c);let l=a?c:void 0,u;t[2]===a?u=t[3]:(u=a?{viewTransitionName:w_}:void 0,t[2]=a,t[3]=u);let d;t[4]!==i||t[5]!==l||t[6]!==u?(d=(0,Z.jsx)(ur,{size:64,celebrateSignal:i,onRage:l,style:u}),t[4]=i,t[5]=l,t[6]=u,t[7]=d):d=t[7];let f;t[8]===n?f=t[9]:(f=(0,Z.jsx)(`h2`,{className:`text-2xl font-light tracking-tighter text-balance`,children:n}),t[8]=n,t[9]=f);let p;t[10]===r?p=t[11]:(p=r?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r}):null,t[10]=r,t[11]=p);let m;t[12]!==f||t[13]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[f,p]}),t[12]=f,t[13]=p,t[14]=m):m=t[14];let h;return t[15]!==d||t[16]!==m?(h=(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:[d,m]}),t[15]=d,t[16]=m,t[17]=h):h=t[17],h}function oO({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 sO=`open-knowledge:create-top-level-file`;function cO(e={}){window.dispatchEvent(new CustomEvent(sO,{detail:e}))}function lO(e){let t=t=>{let n=t.detail;e(n??{})};return window.addEventListener(sO,t),()=>window.removeEventListener(sO,t)}function uO(e){let t=(0,$.c)(29),{celebrateSignal:n,onAddStarterPack:r,onRageStreak:i}=e,{_:a}=xn(),o=u(),{title:s,subtitle:c}=oO({isOnboarding:!1,isEmbedded:o}),l=cd(),d;t[0]!==l.data||t[1]!==l.status?(d=l.status===`ready`?l.data:[],t[0]=l.data,t[1]=l.status,t[2]=d):d=t[2];let f=d,p=l.status===`loading`||l.status===`idle`,m=l.status===`error`,h=aO,g=a(s),_=a(c),v;t[3]!==h||t[4]!==n||t[5]!==i||t[6]!==g||t[7]!==_?(v=(0,Z.jsx)(h,{title:g,subtitle:_,celebrateSignal:n,onRageStreak:i}),t[3]=h,t[4]=n,t[5]=i,t[6]=g,t[7]=_,t[8]=v):v=t[8];let y;t[9]===o?y=t[10]:(y=o?(0,Z.jsx)(QD,{scenario:`existing-repo`}):(0,Z.jsx)(nO,{scenario:`existing-repo`}),t[9]=o,t[10]=y);let b;t[11]!==f||t[12]!==m||t[13]!==p?(b=p||m||f.length>0?(0,Z.jsx)(pO,{templates:f,loading:p,error:m,onSelect:fO}):null,t[11]=f,t[12]=m,t[13]=p,t[14]=b):b=t[14];let x,S;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(Kn,{"aria-hidden":`true`,className:`size-3`}),S=(0,Z.jsx)(Y,{id:`IajAbS`}),t[15]=x,t[16]=S):(x=t[15],S=t[16]);let C;t[17]===r?C=t[18]:(C=(0,Z.jsxs)(X,{onClick:r,variant:`link-muted`,size:`xs`,className:`font-mono text-xs uppercase tracking-wider`,children:[x,S]}),t[17]=r,t[18]=C);let w;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(X,{variant:`link-muted`,className:`justify-end`,size:`sm`,onClick:dO,children:(0,Z.jsx)(Y,{id:`L4Cdd9`,components:{0:(0,Z.jsx)(Nl,{"aria-hidden":`true`,className:`size-3`})}})}),t[19]=w):w=t[19];let T;t[20]===C?T=t[21]:(T=(0,Z.jsxs)(`div`,{className:`-mt-6 flex w-full items-center justify-between gap-4`,children:[C,w]}),t[20]=C,t[21]=T);let E;t[22]!==T||t[23]!==b?(E=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-8`,children:[b,T]}),t[22]=T,t[23]=b,t[24]=E):E=t[24];let D;return t[25]!==E||t[26]!==v||t[27]!==y?(D=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-8 py-12 max-w-5xl my-auto`,children:[v,y,E]}),t[25]=E,t[26]=v,t[27]=y,t[28]=D):D=t[28],D}function dO(){return cO({initialDir:``})}function fO(e,t){return cO({template:{folder:e,name:t}})}function pO(e){let t=(0,$.c)(25),{templates:n,loading:r,error:i,onSelect:a}=e,{_:o}=xn(),s;t[0]===o?s=t[1]:(s=o({id:`_8quCH`}),t[0]=o,t[1]=s);let c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(Y,{id:`_8quCH`})}),t[2]=c):c=t[2];let l;t[3]!==o||t[4]!==i||t[5]!==r||t[6]!==n?(l=r||i?null:(0,Z.jsx)(wm,{className:`text-2xs`,variant:`gray`,"aria-label":o({id:`X7u0xR`,values:{0:n.length}}),children:n.length}),t[3]=o,t[4]=i,t[5]=r,t[6]=n,t[7]=l):l=t[7];let u;t[8]===l?u=t[9]:(u=(0,Z.jsxs)(`header`,{className:`flex items-center gap-2 font-mono text-2xs uppercase tracking-wider text-muted-foreground`,children:[c,l]}),t[8]=l,t[9]=u);let d;t[10]===o?d=t[11]:(d=o({id:`irFGwu`}),t[10]=o,t[11]=d);let f;t[12]!==i||t[13]!==r||t[14]!==a||t[15]!==n?(f=r?(0,Z.jsx)(`p`,{className:`p-4 text-1sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`Hl89Qd`})}):i?(0,Z.jsx)(`p`,{role:`alert`,className:`p-4 text-1sm text-destructive`,children:(0,Z.jsx)(Y,{id:`54Y6Fg`})}):n.map(e=>(0,Z.jsx)(mO,{template:e,targetLabel:e.source_folder===``?`/`:`${e.source_folder}/`,onClick:()=>a(e.source_folder,e.name)},`${e.source_folder}/${e.name}`)),t[12]=i,t[13]=r,t[14]=a,t[15]=n,t[16]=f):f=t[16];let p;t[17]!==r||t[18]!==d||t[19]!==f?(p=(0,Z.jsx)(`div`,{className:`w-full overflow-hidden rounded-xl border border-border/60 bg-card`,children:(0,Z.jsx)(`section`,{"aria-busy":r,"aria-label":d,tabIndex:0,className:`subtle-scrollbar scroll-fade-mask flex max-h-[260px] w-full flex-col overflow-y-auto overscroll-contain focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50`,children:f})}),t[17]=r,t[18]=d,t[19]=f,t[20]=p):p=t[20];let m;return t[21]!==s||t[22]!==u||t[23]!==p?(m=(0,Z.jsxs)(`section`,{"aria-label":s,className:`flex w-full flex-col gap-3`,children:[u,p]}),t[21]=s,t[22]=u,t[23]=p,t[24]=m):m=t[24],m}function mO(e){let t=(0,$.c)(24),{template:n,targetLabel:r,onClick:i}=e,{_:a}=xn(),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)(X,{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 hO(e){let t=(0,$.c)(27),{terminalOpen:n,agentsOpen:r,onRageStreak:i}=e,a=n===void 0?!1:n,o=r===void 0?!1:r,[s,c]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)(void 0),[d,f]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(0),h=(0,Q.useRef)(!1),g=(0,Q.useRef)(void 0),_,v;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(_=()=>{let e=!1,t=async function(){try{let{ok:t,body:n}=await bm();if(e)return;let r=t?Qa.safeParse(n):null;r?.success?(f(vO(r.data.documents)),h.current=!0):h.current||=(f(1),!0)}catch{!e&&!h.current&&(f(1),h.current=!0)}};t();let n=ac(e=>{e.includes(`files`)&&t()});return()=>{e=!0,n(),clearTimeout(g.current)}},v=[],t[0]=_,t[1]=v):(_=t[0],v=t[1]),(0,Q.useEffect)(_,v);let y;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(y=function(){clearTimeout(g.current),g.current=setTimeout(()=>m(_O),500),bm().then(e=>{let{ok:t,body:n}=e;if(!t)return;let r=Qa.safeParse(n);r.success&&f(vO(r.data.documents))}).catch(gO)},t[2]=y):y=t[2];let b=y,x=d!==null,S=d===0,C;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(C=function(e){c(e),e||u(void 0)},t[3]=C):C=t[3];let w=C;if(a||o){let e=a?`justify-end`:`justify-center`,n;t[4]===e?n=t[5]:(n=Qn(`@container/emptystate flex min-h-0 flex-1 flex-col items-center pb-8 pt-10`,e),t[4]=e,t[5]=n);let r;t[6]!==p||t[7]!==S||t[8]!==x||t[9]!==i?(r=x?(0,Z.jsx)(yO,{isOnboarding:S,celebrateSignal:p,onRageStreak:i}):null,t[6]=p,t[7]=S,t[8]=x,t[9]=i,t[10]=r):r=t[10];let o;t[11]===r?o=t[12]:(o=(0,Z.jsx)(`div`,{className:`flex w-full flex-col items-center px-4 @md/emptystate:px-10 @2xl/emptystate:px-16`,children:r}),t[11]=r,t[12]=o);let s;return t[13]!==o||t[14]!==n?(s=(0,Z.jsx)(`div`,{className:n,children:o}),t[13]=o,t[14]=n,t[15]=s):s=t[15],s}let T;t[16]!==p||t[17]!==S||t[18]!==x||t[19]!==i?(T=x?S?(0,Z.jsx)(bO,{onRageStreak:i,celebrateSignal:p,onPackSelect:e=>{u(e),c(!0)}}):(0,Z.jsx)(uO,{onRageStreak:i,celebrateSignal:p,onAddStarterPack:()=>{c(!0)}}):null,t[16]=p,t[17]=S,t[18]=x,t[19]=i,t[20]=T):T=t[20];let E;t[21]!==l||t[22]!==s?(E=(0,Z.jsx)(zS,{open:s,onOpenChange:w,onSeedApplied:b,initialPackId:l}),t[21]=l,t[22]=s,t[23]=E):E=t[23];let D;return t[24]!==T||t[25]!==E?(D=(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:[T,E]})}),t[24]=T,t[25]=E,t[26]=D):D=t[26],D}function gO(){}function _O(e){return e+1}function vO(e){return Gp(e).filter(e=>e.kind===`document`||e.kind===`folder`).length}function yO(e){let t=(0,$.c)(16),{isOnboarding:n,celebrateSignal:r,onRageStreak:i}=e,{_:a}=xn(),o=u(),s,c,l,d;if(t[0]!==a||t[1]!==o||t[2]!==n){let{title:e,subtitle:r}=oO({isOnboarding:n,isEmbedded:o});d=`w-full max-w-5xl`,s=aO,c=a(e),l=a(r),t[0]=a,t[1]=o,t[2]=n,t[3]=s,t[4]=c,t[5]=l,t[6]=d}else s=t[3],c=t[4],l=t[5],d=t[6];let f;t[7]!==s||t[8]!==r||t[9]!==i||t[10]!==c||t[11]!==l?(f=(0,Z.jsx)(s,{title:c,subtitle:l,celebrateSignal:r,onRageStreak:i}),t[7]=s,t[8]=r,t[9]=i,t[10]=c,t[11]=l,t[12]=f):f=t[12];let p;return t[13]!==d||t[14]!==f?(p=(0,Z.jsx)(`div`,{className:d,children:f}),t[13]=d,t[14]=f,t[15]=p):p=t[15],p}function bO(e){let t=(0,$.c)(30),{celebrateSignal:n,onPackSelect:r,onRageStreak:i}=e,{_:a}=xn(),o=u(),s,c,l,d;if(t[0]!==a||t[1]!==o){let{title:e,subtitle:n}=oO({isOnboarding:!0,isEmbedded:o});d=`flex w-full flex-col gap-10 py-12 max-w-5xl my-auto`,s=aO,c=a(e),l=a(n),t[0]=a,t[1]=o,t[2]=s,t[3]=c,t[4]=l,t[5]=d}else s=t[2],c=t[3],l=t[4],d=t[5];let f;t[6]!==s||t[7]!==n||t[8]!==i||t[9]!==c||t[10]!==l?(f=(0,Z.jsx)(s,{title:c,subtitle:l,celebrateSignal:n,onRageStreak:i}),t[6]=s,t[7]=n,t[8]=i,t[9]=c,t[10]=l,t[11]=f):f=t[11];let p;t[12]===o?p=t[13]:(p=o?(0,Z.jsx)(QD,{scenario:`new-project`}):(0,Z.jsx)(nO,{scenario:`new-project`}),t[12]=o,t[13]=p);let m;t[14]!==a||t[15]!==o?(m=a(o?{id:`GubkSu`}:{id:`xeXS4P`}),t[14]=a,t[15]=o,t[16]=m):m=t[16];let h;t[17]===m?h=t[18]:(h=(0,Z.jsx)(SO,{label:m}),t[17]=m,t[18]=h);let g;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(g=[`okf`,`entity-vault`],t[19]=g):g=t[19];let _;t[20]===r?_=t[21]:(_=(0,Z.jsx)(qb,{onPackSelect:r,onCreateBlankFile:xO,collapsedPackIds:g}),t[20]=r,t[21]=_);let v;t[22]!==h||t[23]!==_?(v=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-3`,children:[h,_]}),t[22]=h,t[23]=_,t[24]=v):v=t[24];let y;return t[25]!==v||t[26]!==d||t[27]!==f||t[28]!==p?(y=(0,Z.jsxs)(`div`,{className:d,children:[f,p,v]}),t[25]=v,t[26]=d,t[27]=f,t[28]=p,t[29]=y):y=t[29],y}function xO(){return cO()}function SO(e){let t=(0,$.c)(13),{label:n}=e,{_:r}=xn(),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)(sf,{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)(_r,{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)(vr,{className:`max-w-xs`,children:(0,Z.jsx)(`p`,{className:`leading-relaxed wrap-break-word`,children:(0,Z.jsx)(Y,{id:`k4CuuV`})})}),t[7]=c):c=t[7];let l;t[8]===s?l=t[9]:(l=(0,Z.jsxs)(br,{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 CO(e){return e===``?`.ok/frontmatter.yml`:`${e}/.ok/frontmatter.yml`}function wO(e){let t=(0,$.c)(70),{folderPath:n,state:r,onChange:i}=e,{_:a}=xn(),[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)(EO,{}),(0,Z.jsx)(Ch,{className:`h-7 w-full`}),(0,Z.jsx)(Ch,{className:`h-7 w-full`}),(0,Z.jsx)(Ch,{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)(Y,{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=CO(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 tf(n,{[e]:t});if(!r.ok){let{error:e}=r;Us.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 tf(n,{[e]:null});if(!t.ok){let{error:e}=t;Us.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,Bl(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):zl[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(vo(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 tf(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 tf(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 ee=`size-3 shrink-0 motion-safe:transition-transform motion-safe:duration-150 motion-safe:ease-[cubic-bezier(0.23,1,0.32,1)] ${o?``:`rotate-90`}`,W;t[40]===ee?W=t[41]:(W=(0,Z.jsx)(Ql,{className:ee,"aria-hidden":!0}),t[40]=ee,t[41]=W);let te;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,Z.jsx)(Y,{id:`vQIVHc`}),t[42]=te):te=t[42];let G;t[43]===W?G=t[44]:(G=(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:[W,te]}),t[43]=W,t[44]=G);let K;t[45]===h?K=t[46]:(K=(0,Z.jsx)(`code`,{className:`text-xs text-muted-foreground font-mono cursor-text select-text break-all`,onClick:TO,children:h}),t[45]=h,t[46]=K);let q;t[47]!==G||t[48]!==K?(q=(0,Z.jsxs)(Sr,{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:[G,K]}),t[47]=G,t[48]=K,t[49]=q):q=t[49];let ne;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Z.jsx)(`p`,{className:`px-1 pb-2 text-sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`hSBIG-`})}),t[50]=ne):ne=t[50];let re;t[51]!==c||t[52]!==y||t[53]!==z||t[54]!==_||t[55]!==p||t[56]!==x||t[57]!==u||t[58]!==C?(re=_.length===0&&!c?(0,Z.jsx)(`p`,{className:`px-1 py-1 text-sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`4c_a6S`})}):_.map(e=>{let t=p[e];return(0,Z.jsx)(Hd,{keyName:e,value:t,declared:Vl(t,Oa(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]=re):re=t[59];let J;t[60]!==c||t[61]!==N?(J=c?(0,Z.jsx)(Wd,{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)(X,{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)(Kn,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(Y,{id:`G8t9NN`})})]})}),t[60]=c,t[61]=N,t[62]=J):J=t[62];let ie;t[63]!==re||t[64]!==J?(ie=(0,Z.jsx)(xr,{children:(0,Z.jsxs)(`div`,{className:`px-2 py-2`,children:[ne,re,J]})}),t[63]=re,t[64]=J,t[65]=ie):ie=t[65];let ae;return t[66]!==H||t[67]!==q||t[68]!==ie?(ae=(0,Z.jsx)(`section`,{className:`rounded-lg border bg-card`,children:(0,Z.jsxs)(Cr,{open:H,onOpenChange:U,children:[q,ie]})}),t[66]=H,t[67]=q,t[68]=ie,t[69]=ae):ae=t[69],ae}function TO(e){return e.stopPropagation()}function EO(){let e=(0,$.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(wy,{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)(Y,{id:`vQIVHc`})})]}),e[1]=n):n=e[1],n}function DO(e){let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);return t<60?ic._({id:`xOTzt5`}):t<3600?ic._({id:`zbymaY`,values:{0:Math.floor(t/60)}}):t<86400?ic._({id:`optX0N`,values:{0:Math.floor(t/3600)}}):t<86400*7?ic._({id:`l1l8sj`,values:{0:Math.floor(t/86400)}}):new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function OO(e){return(e.split(`/`).pop()??e).replace(/\.md$/,``)}function kO(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:er,label:ic._({id:`QR5SP1`}),detail:OO(i)};case`template-edit`:return{Icon:_n,label:ic._({id:`-LHLx7`}),detail:OO(i)};case`template-delete`:return{Icon:Hf,label:ic._({id:`_gkGSK`}),detail:OO(i)};case`template-rename`:case`template-move`:{let[e,t]=i.split(` -> `);return{Icon:sl,label:ic._({id:`KPW5WC`}),detail:`${OO(e??``)} → ${OO(t??i)}`}}case`folder-frontmatter-edit`:return{Icon:wy,label:ic._({id:`_tekeB`}),detail:``};case`folder-frontmatter-delete`:return{Icon:wy,label:ic._({id:`ZWxfrc`}),detail:``};case`folder-create`:return{Icon:wy,label:ic._({id:`ZQLDTl`}),detail:``};default:return{Icon:Wc,label:r.replace(/-/g,` `),detail:OO(i)}}}function AO(e){return e.contributors.length>0?e.contributors[0].name:e.author===`openknowledge-service`||e.author===`server`?ic._({id:`B2DrPb`}):e.author||ic._({id:`Ef7StM`})}function jO(e){let t=(0,$.c)(15),{folderPath:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=[],t[0]=r):r=t[0];let[i,a]=(0,Q.useState)(r),[o,s]=(0,Q.useState)(!0),[c,l]=(0,Q.useState)(!1),u,d;if(t[1]===n?(u=t[2],d=t[3]):(u=()=>{let e=!1,t=async function(){try{let t=await fetch(`/api/history?folder=${encodeURIComponent(n)}&limit=50`);if(e)return;if(!t.ok){l(!0),s(!1);return}let r=await t.json();if(e)return;a(r.entries??[]),l(!1),s(!1)}catch(t){e||(console.warn(`[FolderTimelineCard] failed to load folder timeline:`,t),l(!0),s(!1))}};s(!0),t();let r=pc(t);return()=>{e=!0,r()}},d=[n],t[1]=n,t[2]=u,t[3]=d),(0,Q.useEffect)(u,d),c||!o&&i.length===0)return null;let f;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`XJOV1Y`})}),t[4]=f):f=t[4];let p;t[5]===i.length?p=t[6]:(p=i.length>0?(0,Z.jsx)(wm,{className:`text-xs`,variant:`secondary`,children:i.length}):null,t[5]=i.length,t[6]=p);let m;t[7]===p?m=t[8]:(m=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border px-3 py-1`,children:[f,p]}),t[7]=p,t[8]=m);let h;t[9]!==i||t[10]!==o?(h=(0,Z.jsx)(`div`,{className:`px-3 py-2.5`,children:o?(0,Z.jsxs)(`div`,{className:`space-y-2`,role:`status`,"aria-busy":`true`,children:[(0,Z.jsx)(Ch,{className:`h-8 w-full`}),(0,Z.jsx)(Ch,{className:`h-8 w-full`})]}):(0,Z.jsx)(`ul`,{className:`space-y-1`,children:i.map(MO)})}),t[9]=i,t[10]=o,t[11]=h):h=t[11];let g;return t[12]!==m||t[13]!==h?(g=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card`,"data-testid":`folder-timeline-card`,children:[m,h]}),t[12]=m,t[13]=h,t[14]=g):g=t[14],g}function MO(e){let{Icon:t,label:n,detail:r}=kO(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)(gb,{className:`size-3`,"aria-hidden":!0}),AO(e)]}),(0,Z.jsx)(`time`,{className:`shrink-0 text-xs text-muted-foreground/80`,dateTime:e.timestamp,title:new Date(e.timestamp).toLocaleString(),children:DO(e.timestamp)})]},e.sha)}function NO(e){let t=e.split(`/`).pop();return t?`${e}/${t}`:null}function PO(e,t){let n=t.get(`${e}/index`);if(n)return n;let r=NO(e);if(r){let e=t.get(r);if(e)return e}return e.split(`/`).pop()??e}function FO(e,t,n){let r=n.get(e);return r&&r!==e?r:t}function IO(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:PO(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:FO(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:PO(e,t.pageTitles),children:a}}function LO(e){let t=(0,$.c)(41),{folderPath:n,state:r,onChange:i,folderConfigHandle:a}=e,[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(!1);if(r.status===`idle`||r.status===`loading`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card px-3 py-2.5 space-y-3`,children:[(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`-QCLWk`})})}),(0,Z.jsx)(Ch,{className:`h-12 w-full`}),(0,Z.jsx)(Ch,{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)(Y,{id:`iDZtvM`,values:{message:e}})}),t[1]=e,t[2]=n),n}let f;t[3]===r.data.folder.templates_available?f=t[4]:(f=r.data.folder.templates_available??[],t[3]=r.data.folder.templates_available,t[4]=f);let p=f,m;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`-QCLWk`})}),t[5]=m):m=t[5];let h;t[6]===p.length?h=t[7]:(h=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[m,(0,Z.jsx)(wm,{className:`text-xs`,variant:`secondary`,children:p.length})]}),t[6]=p.length,t[7]=h);let g;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsxs)(X,{variant:`ghost`,className:`font-mono uppercase`,size:`sm`,onClick:()=>d(!0),children:[(0,Z.jsx)(Kn,{className:`size-3.5`,"aria-hidden":!0}),(0,Z.jsx)(Y,{id:`G1Gw0v`})]}),t[8]=g):g=t[8];let _;t[9]===h?_=t[10]:(_=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-border px-3 py-1`,children:[h,g]}),t[9]=h,t[10]=_);let v;t[11]===p?v=t[12]:(v=(0,Z.jsx)(`div`,{className:`px-3 py-2.5`,children:p.length===0?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`MZSBsh`})}):(0,Z.jsx)(`ul`,{className:`space-y-1`,children:p.map(e=>(0,Z.jsx)(id,{template:e,onCreate:()=>l(e.name),onEdit:()=>ng(wo(e.source_folder,e.name)),onDelete:()=>s(e),badge:e.scope===`inherited`?(0,Z.jsx)(zd,{source:e.source_folder,target:`templates/${e.name}.md`}):void 0},e.path))})}),t[11]=p,t[12]=v);let y;t[13]!==_||t[14]!==v?(y=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card`,children:[_,v]}),t[13]=_,t[14]=v,t[15]=y):y=t[15];let b;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(b=e=>{e||s(null)},t[16]=b):b=t[16];let x;t[17]!==o||t[18]!==i?(x=(0,Z.jsx)(Ju,{template:o,onOpenChange:b,onDeleted:i}),t[17]=o,t[18]=i,t[19]=x):x=t[19];let S;t[20]===p?S=t[21]:(S=new Set(p.map(RO)),t[20]=p,t[21]=S);let C;t[22]!==n||t[23]!==i?(C=e=>{i(),ng(wo(n,e))},t[22]=n,t[23]=i,t[24]=C):C=t[24];let w;t[25]!==n||t[26]!==u||t[27]!==S||t[28]!==C?(w=(0,Z.jsx)(rd,{folderPath:n,existingNames:S,open:u,onOpenChange:d,onCreated:C}),t[25]=n,t[26]=u,t[27]=S,t[28]=C,t[29]=w):w=t[29];let T=c!==null,E;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(E=e=>{e||l(null)},t[30]=E):E=t[30];let D=c??void 0,O;t[31]!==a||t[32]!==n||t[33]!==T||t[34]!==D?(O=(0,Z.jsx)(jS,{open:T,onOpenChange:E,kind:`file`,initialDir:n,initialTemplate:D,folderConfig:a}),t[31]=a,t[32]=n,t[33]=T,t[34]=D,t[35]=O):O=t[35];let k;return t[36]!==w||t[37]!==O||t[38]!==y||t[39]!==x?(k=(0,Z.jsxs)(Z.Fragment,{children:[y,x,w,O]}),t[36]=w,t[37]=O,t[38]=y,t[39]=x,t[40]=k):k=t[40],k}function RO(e){return e.name}function zO(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=Qn(`relative w-full overflow-x-auto subtle-scrollbar`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=Qn(`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 BO(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=Qn(`[&_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 VO(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=Qn(`[&_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 HO(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=Qn(`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 UO(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=Qn(`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 WO(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=Qn(`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 GO(e){if(!e)return`—`;let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/6e4);if(r<1)return ic._({id:`xOTzt5`});if(r<60)return ic._({id:`NRSLBe`,values:{diffMin:r}});let i=Math.floor(r/60);if(i<24)return ic._({id:`hDKtoF`,values:{diffHrs:i}});let a=Math.floor(i/24);return a<30?ic._({id:`QDZbvN`,values:{diffDays:a}}):t.toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`numeric`})}function KO(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 qO(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)(Ml,{className:`ml-1 size-3`}):(0,Z.jsx)(jl,{className:`ml-1 size-3`}):(0,Z.jsx)(ry,{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)(X,{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 JO(e){let t=(0,$.c)(96),{folderPath:n}=e,{_:r}=xn(),{folderPaths:i,loading:a,pages:o,pageTitles:s,pageMeta:c}=Lu(),l=ed(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)(Ch,{className:`size-5 rounded`}),(0,Z.jsx)(Ch,{className:`h-7 w-48`})]}),(0,Z.jsx)(Ch,{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)(Ch,{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)(Ch,{className:`h-4 w-20`})})]}),[`a`,`b`,`c`,`d`].map(ZO)]})]}),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=IO(n,{pages:o,pageTitles:s,pageMeta:c,folderPaths:i}),a=KO(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?_(XO):(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)(Jd,{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)(X,{onClick:()=>p(!0),children:[(0,Z.jsx)(Kn,{className:`size-4`}),(0,Z.jsx)(Y,{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)(wO,{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)(LO,{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)(jO,{folderPath:n}),t[44]=n,t[45]=D),S=`rounded-lg border`,y=zO;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)(qO,{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)(UO,{"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)(qO,{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)(UO,{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)(BO,{children:(0,Z.jsxs)(HO,{children:[L,V]})}),t[66]=L,t[67]=V,t[68]=x):x=t[68],v=VO,b=a.length?a.map(YO):(0,Z.jsx)(HO,{children:(0,Z.jsx)(WO,{colSpan:2,className:`h-24 text-center text-muted-foreground`,children:(0,Z.jsx)(Y,{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)(jS,{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 YO(e){return(0,Z.jsxs)(HO,{children:[(0,Z.jsx)(WO,{children:(0,Z.jsxs)(`a`,{href:ep(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)(Qd,{className:`size-4 shrink-0 text-muted-foreground`}):(0,Z.jsx)(Fe,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.title})]})}),(0,Z.jsx)(WO,{className:`text-muted-foreground`,children:e.kind===`file`?GO(e.modified):`—`})]},e.path)}function XO(e){return e===`asc`?`desc`:`asc`}function ZO(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)(Ch,{className:`size-4 rounded`}),(0,Z.jsx)(Ch,{className:`h-4 w-40`}),(0,Z.jsx)(`div`,{className:`ml-auto`,children:(0,Z.jsx)(Ch,{className:`h-4 w-16`})})]},e)}function QO(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=Qn(`flex w-full min-w-0 flex-1 flex-col items-center justify-center gap-4 rounded-xl border-dashed p-6 text-center text-balance`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`empty`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function $O(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=Qn(`flex max-w-sm flex-col items-center gap-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`empty-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var ek=hr(`mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0`,{variants:{variant:{default:`bg-transparent`,icon:`flex size-8 shrink-0 items-center justify-center rounded-lg bg-muted text-foreground [&_svg:not([class*='size-'])]:size-4`}},defaultVariants:{variant:`default`}});function tk(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=Qn(ek({variant:a,className: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)(`div`,{"data-slot":`empty-icon`,"data-variant":a,className:o,...r}),t[7]=r,t[8]=o,t[9]=a,t[10]=s):s=t[10],s}function nk(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?gr:`div`,o;t[4]===n?o=t[5]:(o=Qn(`font-heading text-sm font-medium tracking-tight`,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":`empty-title`,className:o,...r}),t[6]=a,t[7]=r,t[8]=o,t[9]=s):s=t[9],s}function rk(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=Qn(`text-sm/relaxed text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`empty-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function ik(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=Qn(`flex w-full max-w-sm min-w-0 flex-col items-center gap-2.5 text-sm text-balance`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`empty-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function ak(e){let t=(0,$.c)(26),{docName:n,size:r,limit:i,backNav:a}=e,o=a!==void 0,s=(0,Q.useRef)(null),c=(0,Q.useRef)(null),l=(0,Q.useId)(),u,d;t[0]===o?(u=t[1],d=t[2]):(u=()=>{o?s.current?.focus():c.current?.focus()},d=[o],t[0]=o,t[1]=u,t[2]=d),(0,Q.useEffect)(u,d);let f;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(tk,{variant:`icon`,className:`mb-0 size-16 rounded-full border bg-muted/40 text-muted-foreground`,children:(0,Z.jsx)(by,{className:`size-9`,"aria-hidden":`true`})}),t[3]=f):f=t[3];let p=o?void 0:-1,m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(Y,{id:`P3hnm0`}),t[4]=m):m=t[4];let h;t[5]!==p||t[6]!==l?(h=(0,Z.jsx)(nk,{asChild:!0,className:`text-2xl font-light outline-none`,children:(0,Z.jsx)(`h2`,{ref:c,id:l,tabIndex:p,children:m})}),t[5]=p,t[6]=l,t[7]=h):h=t[7];let g;t[8]===r?g=t[9]:(g=As(r),t[8]=r,t[9]=g);let _;t[10]===i?_=t[11]:(_=As(i),t[10]=i,t[11]=_);let v;t[12]!==n||t[13]!==g||t[14]!==_?(v=(0,Z.jsx)(rk,{children:(0,Z.jsx)(Y,{id:`GJH-AT`,values:{0:g,1:_,docName:n}})}),t[12]=n,t[13]=g,t[14]=_,t[15]=v):v=t[15];let y;t[16]!==h||t[17]!==v?(y=(0,Z.jsxs)($O,{className:`max-w-md gap-1`,children:[h,v]}),t[16]=h,t[17]=v,t[18]=y):y=t[18];let b;t[19]!==a||t[20]!==o?(b=o?(0,Z.jsx)(ik,{children:(0,Z.jsxs)(X,{ref:s,variant:`default`,onClick:()=>a.onNavigateBack(a.previousDocName),children:[(0,Z.jsx)(Al,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`CKyk7Q`})]})}):null,t[19]=a,t[20]=o,t[21]=b):b=t[21];let x;return t[22]!==y||t[23]!==b||t[24]!==l?(x=(0,Z.jsxs)(QO,{role:`status`,"aria-labelledby":l,"data-slot":`large-file-editor-state`,className:`h-full gap-8 p-8`,children:[f,y,b]}),t[22]=y,t[23]=b,t[24]=l,t[25]=x):x=t[25],x}function ok(e){let t=(0,$.c)(8),{docName:n}=e,[r,i]=(0,Q.useState)(sk),a,o;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>_(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(){Qe(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)(Y,{id:`A67Uwj`})}),t[4]=l):l=t[4];let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(Y,{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)(X,{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 sk(){return new Set}function ck(e){let t=(0,$.c)(8),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{autoStart:r}=n,i=r===void 0?!1:r,a=(0,Q.useRef)(null),o,s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>{a.current?.focus()},s=[],t[2]=o,t[3]=s):(o=t[2],s=t[3]),(0,Q.useEffect)(o,s);let c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(`h1`,{className:`text-2xl font-light tracking-tighter text-balance`,children:(0,Z.jsx)(Y,{id:`hgf5io`})}),t[4]=c):c=t[4];let l;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1 text-center`,children:[c,(0,Z.jsx)(`p`,{className:`max-w-md text-sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`AUMPjj`})})]}),t[5]=l):l=t[5];let u;return t[6]===i?u=t[7]:(u=(0,Z.jsxs)(`div`,{ref:a,tabIndex:-1,className:`flex h-full w-full flex-col items-center justify-center gap-8 px-6 py-8 outline-none`,children:[l,(0,Z.jsx)(`div`,{className:`w-full`,children:(0,Z.jsx)(Mv,{autoStart:i})})]}),t[6]=i,t[7]=u),u}function lk(e){let t=(0,$.c)(19),{nav:n}=e,{state:r,refetch:i}=kd(n),a=(0,Q.useRef)(null),o,s;t[0]===r.phase?(o=t[1],s=t[2]):(o=()=>{r.phase===`resolved`&&a.current?.querySelector(`button`)?.focus()},s=[r.phase],t[0]=r.phase,t[1]=o,t[2]=s),(0,Q.useEffect)(o,s);let c;t[3]===n.path?c=t[4]:(c=function(){window.location.hash=ap(Td(n.path))},t[3]=n.path,t[4]=c);let l=c,u;t[5]===n?u=t[6]:(u=function(e){Ad.arm(Od(n,e)),window.location.hash=n.kind===`folder`?ap(e):ep(e)},t[5]=n,t[6]=u);let d=u,f=r.phase===`pending`?`polite`:void 0,p=r.phase===`resolved`?r.resolution.verdict:void 0,m=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`,h;t[7]!==l||t[8]!==n||t[9]!==d||t[10]!==i||t[11]!==r?(h=(0,Z.jsx)(Dd,{nav:n,state:r,onBrowseFolder:l,onOpenRenamed:d,onEnableAutoSync:l,onSyncCompleted:i,onPullApplied:i}),t[7]=l,t[8]=n,t[9]=d,t[10]=i,t[11]=r,t[12]=h):h=t[12];let g;return t[13]!==r.phase||t[14]!==f||t[15]!==p||t[16]!==m||t[17]!==h?(g=(0,Z.jsx)(`div`,{ref:a,role:`status`,"aria-live":f,"data-testid":`share-receive-miss-panel`,"data-phase":r.phase,"data-verdict":p,className:m,children:h}),t[13]=r.phase,t[14]=f,t[15]=p,t[16]=m,t[17]=h,t[18]=g):g=t[18],g}var uk=`ok-find`,dk=`ok-find-active`;function fk(e,t){let n=t.toLowerCase();if(n===``)return[];let r=[],i=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(let e=i.nextNode();e!==null;e=i.nextNode()){let t=(e.textContent??``).toLowerCase(),i=t.indexOf(n);for(;i>=0;){let a=document.createRange();a.setStart(e,i),a.setEnd(e,i+n.length),r.push(a),i=t.indexOf(n,i+n.length)}}return r}function pk(e){let t=(0,$.c)(61),{containerRef:n,onClose:r}=e,{_:i}=xn(),a=(0,Q.useRef)(null),[o,s]=(0,Q.useState)(``),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)(0),p,m;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(p=()=>{a.current?.focus()},m=[],t[1]=p,t[2]=m):(p=t[1],m=t[2]),(0,Q.useEffect)(p,m);let h;t[3]!==n||t[4]!==o?(h=()=>{let e=n.current,t=CSS.highlights;if(!e||t===void 0)return;let r=fk(e,o.trim());return u(r),f(0),t.set(uk,new Highlight(...r)),()=>{t.delete(uk),t.delete(dk)}},t[3]=n,t[4]=o,t[5]=h):h=t[5];let g;t[6]===o?g=t[7]:(g=[o],t[6]=o,t[7]=g),(0,Q.useEffect)(h,g);let _,v;t[8]!==d||t[9]!==l?(_=()=>{let e=CSS.highlights;if(e===void 0)return;let t=l[d];if(t===void 0){e.delete(dk);return}e.set(dk,new Highlight(t)),t.startContainer.parentElement?.scrollIntoView({block:`nearest`})},v=[l,d],t[8]=d,t[9]=l,t[10]=_,t[11]=v):(_=t[10],v=t[11]),(0,Q.useEffect)(_,v);let y;t[12]===l.length?y=t[13]:(y=e=>{l.length!==0&&f(t=>(t+e+l.length)%l.length)},t[12]=l.length,t[13]=y);let b=y,x;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(x=e=>s(e.target.value),t[14]=x):x=t[14];let S;t[15]===i?S=t[16]:(S=i({id:`KujtjC`}),t[15]=i,t[16]=S);let C;t[17]===i?C=t[18]:(C=i({id:`BKI4hX`}),t[17]=i,t[18]=C);let w;t[19]!==r||t[20]!==b?(w=e=>{e.key===`Enter`&&b(e.shiftKey?-1:1),e.key===`Escape`&&r()},t[19]=r,t[20]=b,t[21]=w):w=t[21];let T;t[22]!==o||t[23]!==S||t[24]!==C||t[25]!==w?(T=(0,Z.jsx)(Op,{ref:a,value:o,onChange:x,placeholder:S,"aria-label":C,className:`h-7 w-44`,onKeyDown:w}),t[22]=o,t[23]=S,t[24]=C,t[25]=w,t[26]=T):T=t[26];let E;t[27]!==d||t[28]!==l.length||t[29]!==o?(E=o.trim()===``?null:l.length===0?(0,Z.jsx)(Y,{id:`Y9c_nf`}):`${d+1}/${l.length}`,t[27]=d,t[28]=l.length,t[29]=o,t[30]=E):E=t[30];let D;t[31]===E?D=t[32]:(D=(0,Z.jsx)(`span`,{className:`min-w-10 text-center text-muted-foreground text-xs tabular-nums`,children:E}),t[31]=E,t[32]=D);let O;t[33]===b?O=t[34]:(O=()=>b(-1),t[33]=b,t[34]=O);let k;t[35]===i?k=t[36]:(k=i({id:`oqB2ez`}),t[35]=i,t[36]=k);let A;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(Ji,{className:`size-4`,"aria-hidden":!0}),t[37]=A):A=t[37];let j;t[38]!==O||t[39]!==k?(j=(0,Z.jsx)(X,{variant:`ghost`,size:`icon`,className:`size-7`,onClick:O,"aria-label":k,children:A}),t[38]=O,t[39]=k,t[40]=j):j=t[40];let M;t[41]===b?M=t[42]:(M=()=>b(1),t[41]=b,t[42]=M);let N;t[43]===i?N=t[44]:(N=i({id:`SiUUCS`}),t[43]=i,t[44]=N);let P;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(Zl,{className:`size-4`,"aria-hidden":!0}),t[45]=P):P=t[45];let F;t[46]!==M||t[47]!==N?(F=(0,Z.jsx)(X,{variant:`ghost`,size:`icon`,className:`size-7`,onClick:M,"aria-label":N,children:P}),t[46]=M,t[47]=N,t[48]=F):F=t[48];let I;t[49]===i?I=t[50]:(I=i({id:`wJo9oS`}),t[49]=i,t[50]=I);let L;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(Gf,{className:`size-4`,"aria-hidden":!0}),t[51]=L):L=t[51];let R;t[52]!==r||t[53]!==I?(R=(0,Z.jsx)(X,{variant:`ghost`,size:`icon`,className:`size-7`,onClick:r,"aria-label":I,children:L}),t[52]=r,t[53]=I,t[54]=R):R=t[54];let z;return t[55]!==T||t[56]!==D||t[57]!==j||t[58]!==F||t[59]!==R?(z=(0,Z.jsxs)(`div`,{className:`absolute top-2 right-4 z-10 flex items-center gap-1 rounded-md border bg-popover p-1 shadow-md`,children:[T,D,j,F,R]}),t[55]=T,t[56]=D,t[57]=j,t[58]=F,t[59]=R,t[60]=z):z=t[60],z}function mk(e){let t=(0,$.c)(9),{text:n}=e,r;t[0]===n?r=t[1]:(r=Ps(n),t[0]=n,t[1]=r);let{map:i}=r,a,o;if(t[2]!==i||t[3]!==n){o=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Da(n),r=e.length>0?e:Object.keys(i);if(r.length===0){o=null;break bb0}let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(Y,{id:`l_UFPv`}),t[6]=s):s=t[6];let c;t[7]===i?c=t[8]:(c=(e,t)=>{let n=i[e];return n===void 0?null:(0,Z.jsx)(hk,{keyName:e,value:n},`${e}-${t}`)},t[7]=i,t[8]=c),a=(0,Z.jsx)(Gl,{title:s,count:r.length,testId:`readonly-property-panel`,className:`pt-4`,children:r.map(c)})}t[2]=i,t[3]=n,t[4]=a,t[5]=o}else a=t[4],o=t[5];return o===Symbol.for(`react.early_return_sentinel`)?a:o}function hk(e){let t=(0,$.c)(9),{keyName:n,value:r}=e,i=Ul[Oa(r)],a;t[0]===i?a=t[1]:(a=(0,Z.jsx)(i,{className:`size-3.5`}),t[0]=i,t[1]=a);let o;t[2]!==n||t[3]!==r?(o=(0,Z.jsx)(gk,{keyName:n,value:r}),t[2]=n,t[3]=r,t[4]=o):o=t[4];let s;return t[5]!==n||t[6]!==a||t[7]!==o?(s=(0,Z.jsx)(Kl,{icon:a,label:n,testId:`readonly-property-row`,dataKey:n,children:o}),t[5]=n,t[6]=a,t[7]=o,t[8]=s):s=t[8],s}function gk(e){let t=(0,$.c)(8),{keyName:n,value:r}=e;if(Wl(r)){let e;return t[0]!==n||t[1]!==r?(e=(0,Z.jsx)(Hl,{keyName:n,value:r}),t[0]=n,t[1]=r,t[2]=e):e=t[2],e}let i;t[3]===r?i=t[4]:(i=Array.isArray(r)?r.filter(_k).join(`, `):String(r),t[3]=r,t[4]=i);let a=i,o;return t[5]!==a||t[6]!==n?(o=(0,Z.jsx)(`div`,{className:`flex min-h-7 items-center px-2 py-1 text-sm break-words`,"data-testid":`readonly-property-value`,"data-key":n,children:a}),t[5]=a,t[6]=n,t[7]=o):o=t[7],o}function _k(e){return typeof e==`string`}function vk(e){let t=(0,$.c)(38),{fileName:n,text:r,flow:i,linkBaseDocName:a,skillPathLinkDocName:o,onBundlePathClick:s}=e,c=i===void 0?!1:i,l,u,d,f;if(t[0]!==a||t[1]!==s||t[2]!==o||t[3]!==r){let e=Hs(r).body,n;if(t[8]!==a||t[9]!==s||t[10]!==o){let e=a?He.map(e=>e.name===`link`?e.configure({docName:a}):e):He;n=o?[...e,A.configure({docName:o,onBundlePathClick:s})]:e,t[8]=a,t[9]=s,t[10]=o,t[11]=n}else n=t[11];let i=n;f=Wr,l=i,u=!1,d=Rr().parseWithFallback(e),t[0]=a,t[1]=s,t[2]=o,t[3]=r,t[4]=l,t[5]=u,t[6]=d,t[7]=f}else l=t[4],u=t[5],d=t[6],f=t[7];let p;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(p={attributes:{class:`pt-4`}},t[12]=p):p=t[12];let m;t[13]!==l||t[14]!==u||t[15]!==d?(m={extensions:l,editable:u,content:d,editorProps:p},t[13]=l,t[14]=u,t[15]=d,t[16]=m):m=t[16];let h;t[17]!==a||t[18]!==o||t[19]!==r?(h=[r,a,o],t[17]=a,t[18]=o,t[19]=r,t[20]=h):h=t[20];let g=f(m,h),[_]=(0,Q.useState)(yk),v=(0,Q.useRef)(null),y,b;t[21]===_?(y=t[22],b=t[23]):(b=()=>{let e=v.current;if(e)return e.appendChild(_),()=>{_.parentNode===e&&e.removeChild(_)}},y=[_],t[21]=_,t[22]=y,t[23]=b),(0,Q.useLayoutEffect)(b,y);let x;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(`div`,{className:`tiptap-editor`,children:(0,Z.jsx)(`div`,{ref:v,style:{display:`contents`}})}),t[24]=x):x=t[24];let S=x,C;t[25]!==n||t[26]!==c||t[27]!==r?(C=c?(0,Z.jsx)(`article`,{className:`bg-background`,"aria-label":n,"data-skill-markdown-viewer":``,"data-skill-markdown-viewer-state":`loaded`,children:S}):(0,Z.jsx)(`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:(0,Z.jsxs)(`div`,{className:`editor-doc-scroll min-h-0 flex-1 overflow-auto subtle-scrollbar scroll-fade-mask`,children:[(0,Z.jsx)(mk,{text:r}),S]})}),t[25]=n,t[26]=c,t[27]=r,t[28]=C):C=t[28];let w=c?`tiptap-editor-portal-content`:`tiptap-editor-portal-content h-full`,T;t[29]!==g||t[30]!==w?(T=(0,Z.jsx)(Jr,{editor:g,className:w}),t[29]=g,t[30]=w,t[31]=T):T=t[31];let E;t[32]!==_||t[33]!==T?(E=(0,C_.createPortal)(T,_),t[32]=_,t[33]=T,t[34]=E):E=t[34];let D;return t[35]!==C||t[36]!==E?(D=(0,Z.jsxs)(Z.Fragment,{children:[C,E]}),t[35]=C,t[36]=E,t[37]=D):D=t[37],D}function yk(){let e=document.createElement(`div`);return e.style.display=`contents`,e}var bk=`data-skill-markdown`;function xk(e){let t=(0,$.c)(22),{scope:n,name:r,path:i,host:a,fileName:o}=e,s;t[0]!==a||t[1]!==r||t[2]!==i||t[3]!==n?(s={loadText:e=>Bm({scope:n,name:r,path:i,host:a},e)},t[0]=a,t[1]=r,t[2]=i,t[3]=n,t[4]=s):s=t[4];let c=Fh(s);if(c.status===`loading`){let e;return t[5]===o?e=t[6]:(e=(0,Z.jsx)(Bh,{fileName:o,dataAttr:bk}),t[5]=o,t[6]=e),e}if(c.status===`error`){let e;return t[7]!==c.message||t[8]!==o?(e=(0,Z.jsx)(Rh,{fileName:o,dataAttr:bk,message:c.message}),t[7]=c.message,t[8]=o,t[9]=e):e=t[9],e}let l=c.content,u;t[10]!==r||t[11]!==i||t[12]!==n?(u=Ga(n,r,i),t[10]=r,t[11]=i,t[12]=n,t[13]=u):u=t[13];let d;t[14]!==r||t[15]!==n?(d=Xa(n,r),t[14]=r,t[15]=n,t[16]=d):d=t[16];let f;return t[17]!==c.content||t[18]!==o||t[19]!==u||t[20]!==d?(f=(0,Z.jsx)(vk,{fileName:o,text:l,linkBaseDocName:u,skillPathLinkDocName:d}),t[17]=c.content,t[18]=o,t[19]=u,t[20]=d,t[21]=f):f=t[21],f}function Sk(e){let t=(0,$.c)(5),[n,r]=(0,Q.useState)(!1),i;t[0]===e?i=t[1]:(i=()=>{let t=t=>{if(t.defaultPrevented||!(t.metaKey||t.ctrlKey)||t.key.toLowerCase()!==`f`)return;let n=e.current;if(n===null)return;let i=t.target;i instanceof Node&&!n.contains(i)&&Gs(i)||(t.preventDefault(),r(!0))};return window.addEventListener(`keydown`,t,!0),()=>window.removeEventListener(`keydown`,t,!0)},t[0]=e,t[1]=i);let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=[],t[2]=a):a=t[2],(0,Q.useEffect)(i,a);let o;return t[3]===n?o=t[4]:(o={findOpen:n,setFindOpen:r},t[3]=n,t[4]=o),o}var Ck=new Set([`md`,`mdx`]);function wk(e){let t=(0,$.c)(18),{scope:n,name:r,path:i,host:a}=e,{_:o}=xn(),s=(0,Q.useRef)(null),c=(0,Q.useRef)(null),l=(0,Q.useRef)(null),u;t[0]===i?u=t[1]:(u=i.split(`/`).pop()??i,t[0]=i,t[1]=u);let d=u,f=d.lastIndexOf(`.`),p=f>=0?d.slice(f+1).toLowerCase():``,m=Ck.has(p),{findOpen:h,setFindOpen:g}=Sk(m?c:l),_=Ck.has(p)?(0,Z.jsx)(xk,{scope:n,name:r,path:i,host:a,fileName:d}):(0,Z.jsx)(Ih,{fileName:d,extension:p,loadText:e=>Bm({scope:n,name:r,path:i,host:a},e)}),v;t[2]!==h||t[3]!==m||t[4]!==g?(v=m&&h?(0,Z.jsx)(pk,{containerRef:s,onClose:()=>g(!1)}):null,t[2]=h,t[3]=m,t[4]=g,t[5]=v):v=t[5];let y;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(wd,{className:`size-4 shrink-0`,"aria-hidden":!0}),t[6]=y):y=t[6];let b;t[7]!==o||t[8]!==r?(b=o({id:`96pApd`,values:{name:r}}),t[7]=o,t[8]=r,t[9]=b):b=t[9];let x;t[10]===b?x=t[11]:(x=(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5 border-border border-b bg-muted/35 px-3 py-2 text-muted-foreground text-sm`,children:[y,(0,Z.jsx)(`span`,{className:`truncate`,children:b})]}),t[10]=b,t[11]=x);let S;t[12]===_?S=t[13]:(S=(0,Z.jsx)(`div`,{ref:s,className:`min-h-0 flex-1`,children:_}),t[12]=_,t[13]=S);let C;return t[14]!==v||t[15]!==x||t[16]!==S?(C=(0,Z.jsxs)(`div`,{ref:c,className:`relative flex h-full min-h-0 flex-col`,children:[v,x,S]}),t[14]=v,t[15]=x,t[16]=S,t[17]=C):C=t[17],C}var Tk=[`from-[#ff9d6c] to-[#ff7eb3]`,`from-[#8fe0c0] to-[#59c0ff]`,`from-[#c0b0ff] to-[#8fb0ff]`,`from-[#ffd18f] to-[#ff9fb0]`,`from-[#8fb0ff] to-[#c9a8ff]`,`from-[#7fe0a0] to-[#bfe08f]`];function Ek(e){let t=0;for(let n=0;n<e.length;n++)t=t*31+e.charCodeAt(n)|0;return Tk[Math.abs(t)%Tk.length]??Tk[0]}var Dk=`SKILL.md`,Ok=new Map;function kk(e){let t=(0,$.c)(44),{source:n,name:r,subtitle:i,tintKey:a,headerActions:o,headerLine:s,noPreviewFallback:c,banner:l,reserveRightGutter:u,selectedPath:d,scope:f,onBundlePathClick:p,onPreviewMeta:m}=e,h=u===void 0?!1:u,{_:g}=xn(),_=`${n}::${r}`,v;t[0]===_?v=t[1]:(v=()=>Ok.get(_)??null,t[0]=_,t[1]=v);let[y,b]=(0,Q.useState)(v),x;t[2]===_?x=t[3]:(x=()=>Ok.has(_),t[2]=_,t[3]=x);let[S,C]=(0,Q.useState)(x),w=d??Dk,T=(0,Q.useRef)(null),E=(0,Q.useRef)(null),{findOpen:D,setFindOpen:O}=Sk(T),k,A;t[4]!==r||t[5]!==n?(k=()=>{let e=`${n}::${r}`,t=new AbortController;Ok.has(e)||zm({source:n,name:r},t.signal).then(n=>{t.signal.aborted||(n.ok&&(Ok.set(e,n),b(n)),C(!0))});let i=fc(Mk);return()=>{t.abort(),i()}},A=[n,r],t[4]=r,t[5]=n,t[6]=k,t[7]=A):(k=t[6],A=t[7]),(0,Q.useEffect)(k,A);let j,M;t[8]!==m||t[9]!==y?(j=()=>{y&&m?.(y)},M=[y,m],t[8]=m,t[9]=y,t[10]=j,t[11]=M):(j=t[10],M=t[11]),(0,Q.useEffect)(j,M);let N=y?.description,P;if(t[12]!==g||t[13]!==l||t[14]!==N||t[15]!==D||t[16]!==o||t[17]!==s||t[18]!==r||t[19]!==c||t[20]!==p||t[21]!==y||t[22]!==S||t[23]!==h||t[24]!==f||t[25]!==w||t[26]!==O||t[27]!==i||t[28]!==a){let e=y?Nk(y.skillMd):[],n;t[30]===y?n=t[31]:(n=y?Ss(y):null,t[30]=y,t[31]=n);let u=n,d;t[32]!==g||t[33]!==y||t[34]!==w?(d=w===Dk?y?{path:`${y.name} SKILL.md`,content:y.skillMd,md:!0}:null:(()=>{let e=y?.files?.find(e=>e.relPath===w);return e?{path:e.relPath,content:e.content??g({id:`fdeFfN`}),md:e.content!==null&&/\.mdx?$/.test(e.relPath)}:null})(),t[32]=g,t[33]=y,t[34]=w,t[35]=d):d=t[35];let m=d,_;t[36]!==D||t[37]!==O?(_=D?(0,Z.jsx)(pk,{containerRef:E,onClose:()=>O(!1)}):null,t[36]=D,t[37]=O,t[38]=_):_=t[38];let v;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(wd,{className:`size-4`,"aria-hidden":!0}),t[39]=v):v=t[39];let b;t[40]!==o||t[41]!==s||t[42]!==h?(b=(0,Z.jsx)(ig,{icon:v,actions:o,reserveRightGutter:h,children:s}),t[40]=o,t[41]=s,t[42]=h,t[43]=b):b=t[43],P=(0,Z.jsxs)(`div`,{ref:T,className:`relative flex h-full min-h-0 flex-col`,children:[_,b,y?(0,Z.jsxs)(`div`,{ref:E,className:`editor-doc-scroll min-h-0 flex-1 overflow-auto subtle-scrollbar scroll-fade-mask`,children:[w===Dk?l:null,w===Dk?(0,Z.jsx)(`div`,{className:`editor-content-aligned pt-6`,children:(0,Z.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,Z.jsx)(Kl,{icon:(0,Z.jsx)(ql,{className:`size-3.5`}),label:g({id:`XmJfZT`}),children:(0,Z.jsx)(`span`,{className:`font-mono`,children:r})}),N?(0,Z.jsx)(Kl,{icon:(0,Z.jsx)(lb,{className:`size-3.5`}),label:g({id:`eTsJYJ`}),children:(0,Z.jsx)(`p`,{className:`text-foreground/80`,children:N})}):null,(0,Z.jsx)(Kl,{icon:(0,Z.jsx)(ab,{className:`size-3.5`}),label:g({id:`pTyA_t`}),children:e.length>0?(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.map(jk)}):(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`N2S1rs`})})}),u?(0,Z.jsx)(Kl,{icon:(0,Z.jsx)(qd,{className:`size-3.5`}),label:g({id:`WOr-hW`}),children:(0,Z.jsx)(rg,{size:u})}):null]})}):null,m?.md?(0,Z.jsx)(vk,{flow:!0,fileName:m.path,text:m.content,linkBaseDocName:f?Ga(f,r,w===Dk?`SKILL`:w):void 0,skillPathLinkDocName:f?Xa(f,r):void 0,onBundlePathClick:p}):m?(0,Z.jsx)(`div`,{className:`editor-content-aligned`,children:(0,Z.jsx)(`pre`,{className:`overflow-auto whitespace-pre-wrap break-words py-4 font-mono text-xs subtle-scrollbar scroll-fade-mask`,children:m.content})}):null]}):S?(0,Z.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-4`,children:c??(0,Z.jsxs)(`div`,{className:`flex aspect-[2/1] w-full max-w-xl flex-col justify-end rounded-xl bg-gradient-to-br p-5 ${Ek(a)}`,"aria-hidden":!0,children:[(0,Z.jsx)(`span`,{className:`truncate font-semibold text-2xl text-neutral-900`,children:r}),(0,Z.jsx)(`span`,{className:`truncate text-neutral-900/70 text-sm`,children:i})]})}):(0,Z.jsx)(`div`,{className:`editor-doc-scroll min-h-0 flex-1 overflow-auto subtle-scrollbar scroll-fade-mask`,children:(0,Z.jsx)(`div`,{className:`editor-content-aligned pt-6`,children:(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[(0,Z.jsx)(`div`,{className:`h-6 w-2/3 animate-pulse rounded bg-muted`}),[`a`,`b`,`c`,`d`,`e`].map(Ak)]})})})]}),t[12]=g,t[13]=l,t[14]=N,t[15]=D,t[16]=o,t[17]=s,t[18]=r,t[19]=c,t[20]=p,t[21]=y,t[22]=S,t[23]=h,t[24]=f,t[25]=w,t[26]=O,t[27]=i,t[28]=a,t[29]=P}else P=t[29];return P}function Ak(e){return(0,Z.jsx)(`div`,{className:`h-4 w-11/12 animate-pulse rounded bg-muted`},e)}function jk(e){return(0,Z.jsx)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 text-muted-foreground text-xs`,children:e},e)}function Mk(){return Ok.clear()}function Nk(e){try{let{frontmatter:t}=Hs(e);return t?Ko(Va(t)):[]}catch{return[]}}var Pk=hr(`group/alert relative grid w-full gap-0.5 rounded-lg border px-2.5 py-2 text-left text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pe-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-card text-card-foreground`,destructive:`bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current`}},defaultVariants:{variant:`default`}});function Fk(e){let t=(0,$.c)(10),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;t[4]!==n||t[5]!==i?(a=Qn(Pk({variant:i}),n),t[4]=n,t[5]=i,t[6]=a):a=t[6];let o;return t[7]!==r||t[8]!==a?(o=(0,Z.jsx)(`div`,{"data-slot":`alert`,role:`alert`,className:a,...r}),t[7]=r,t[8]=a,t[9]=o):o=t[9],o}function Ik(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=Qn(`font-medium group-has-[>svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`alert-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Lk(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=Qn(`text-balance text-muted-foreground text-sm md:text-pretty [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`alert-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Rk(e){let t=(0,$.c)(43),{bundle:n,source:r,scope:i,onInstalled:a}=e,{_:o}=xn(),[s,c]=(0,Q.useState)(!1);if(n.names.length<=1)return null;let l;t[0]!==o||t[1]!==n.capabilities?.hooks?(l=n.capabilities?.hooks?o({id:`8fDf7j`}):null,t[0]=o,t[1]=n.capabilities?.hooks,t[2]=l):l=t[2];let u;t[3]!==o||t[4]!==n.capabilities?.commands?(u=n.capabilities?.commands?o({id:`9HKBNN`}):null,t[3]=o,t[4]=n.capabilities?.commands,t[5]=u):u=t[5];let d;t[6]!==o||t[7]!==n.capabilities?.mcp?(d=n.capabilities?.mcp?o({id:`8qgfac`}):null,t[6]=o,t[7]=n.capabilities?.mcp,t[8]=d):d=t[8];let f;t[9]!==o||t[10]!==n.capabilities?.agents?(f=n.capabilities?.agents?o({id:`EpZQFw`}):null,t[9]=o,t[10]=n.capabilities?.agents,t[11]=f):f=t[11];let p;t[12]!==l||t[13]!==u||t[14]!==d||t[15]!==f?(p=[l,u,d,f].filter(zk),t[12]=l,t[13]=u,t[14]=d,t[15]=f,t[16]=p):p=t[16];let m=p,h=n.names.length,g=n.plugin,_;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(Ff,{className:`size-4`,"aria-hidden":!0}),t[17]=_):_=t[17];let v;t[18]!==h||t[19]!==g?(v=(0,Z.jsx)(Ik,{children:g?(0,Z.jsx)(Y,{id:`3l32hp`,values:{plugin:g}}):(0,Z.jsx)(Y,{id:`_mcDqU`,values:{count:h}})}),t[18]=h,t[19]=g,t[20]=v):v=t[20];let y;t[21]!==m||t[22]!==h||t[23]!==g||t[24]!==r?(y=(0,Z.jsx)(Lk,{className:`min-w-0`,children:m.length>0?(0,Z.jsx)(Y,{id:`aR4DgO`,values:{0:m.join(`, `),count:h}}):g?(0,Z.jsx)(Y,{id:`zt9ZgM`,values:{count:h}}):(0,Z.jsx)(Y,{id:`wefL17`,values:{source:r,count:h}})}),t[21]=m,t[22]=h,t[23]=g,t[24]=r,t[25]=y):y=t[25];let b;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(X,{variant:`outline`,size:`sm`,"data-testid":`plugin-bundle-pick`,onClick:()=>c(!0),children:(0,Z.jsx)(Y,{id:`XVnIvs`})}),t[26]=b):b=t[26];let x;t[27]===n.repositoryUrl?x=t[28]:(x=n.repositoryUrl?(0,Z.jsx)(X,{variant:`ghost`,size:`sm`,asChild:!0,children:(0,Z.jsxs)(`a`,{href:n.repositoryUrl,target:`_blank`,rel:`noreferrer`,children:[(0,Z.jsx)(Y,{id:`Fhp4Gn`}),(0,Z.jsx)(Fl,{className:`size-3.5`})]})}):null,t[27]=n.repositoryUrl,t[28]=x);let S;t[29]===x?S=t[30]:(S=(0,Z.jsxs)(`div`,{className:`mt-2.5 flex items-center gap-2 group-has-[>svg]/alert:col-start-2`,children:[b,x]}),t[29]=x,t[30]=S);let C;t[31]!==S||t[32]!==v||t[33]!==y?(C=(0,Z.jsxs)(Fk,{role:`note`,className:`my-3 bg-muted/40 px-4 py-3`,children:[_,v,y,S]}),t[31]=S,t[32]=v,t[33]=y,t[34]=C):C=t[34];let w=s?n:null,T;t[35]!==a||t[36]!==i||t[37]!==r||t[38]!==w?(T=(0,Z.jsx)(Sd,{bundle:w,source:r,defaultScope:i,onInstalled:a,onOpenChange:c}),t[35]=a,t[36]=i,t[37]=r,t[38]=w,t[39]=T):T=t[39];let E;return t[40]!==C||t[41]!==T?(E=(0,Z.jsxs)(`div`,{className:`editor-content-aligned`,children:[C,T]}),t[40]=C,t[41]=T,t[42]=E):E=t[42],E}function zk(e){return e!==null}function Bk(e){let t=(0,$.c)(28),{source:n,name:r,initialScope:i,marketplace:a}=e,{_:o}=xn(),[s,c]=(0,Q.useState)(i),[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(null),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=[],t[0]=p):p=t[0];let[m,h]=(0,Q.useState)(p),[g,_]=(0,Q.useState)(!1),v;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(v=[],t[1]=v):v=t[1];let y=(0,Q.useRef)(v),b=(0,Q.useRef)(null),x=(0,Q.useRef)(null),S=(0,Q.useRef)(null),C;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(C=[],t[2]=C):C=t[2];let w=(0,Q.useRef)(C),T=(0,Q.useRef)(!1),E;t[3]!==o||t[4]!==a||t[5]!==r||t[6]!==s||t[7]!==n?(E=async function(){if(b.current)return b.current;if(S.current)return S.current;let e=s,t=Mm({source:n,skill:r,scope:e,install:!1,...a?{marketplace:!0}:{}}).then(t=>t.ok?(b.current=t.name,x.current=e,f(e),u(t.name),t.name):(Us.error(o({id:`oX-rVu`,values:{0:t.error}})),null));S.current=t;let i=await t;return S.current=null,i},t[3]=o,t[4]=a,t[5]=r,t[6]=s,t[7]=n,t[8]=E):E=t[8];let D=E,O;t[9]!==o||t[10]!==D?(O=async function(e){if(y.current=e,w.current=e,h(e),!T.current){for(T.current=!0,_(!0);;){let e=w.current,t=await D(),n=x.current;if(!t||!n)break;let r=await Pm({scope:n,name:t,targets:[...e],linkMode:!0});if(!r.ok){Us.error(o({id:`s-pW_v`,values:{0:r.error}}));break}if(e===w.current){let e=y.current.filter(Vk),t=[...new Set([...e,...r.hosts])];y.current=t,h(t);break}}T.current=!1,_(!1)}},t[9]=o,t[10]=D,t[11]=O):O=t[11];let k=O,A;t[12]===m?A=t[13]:(A=new Set(m),t[12]=m,t[13]=A);let j=m.length>0,M;t[14]!==o||t[15]!==g||t[16]!==k||t[17]!==D||t[18]!==A||t[19]!==j?(M={hostSet:A,installed:j,installing:g,toggleEditor(e,t){if(e===`agents`){if(!t)return;(async()=>{_(!0);let e=await D(),t=x.current;if(e&&t){let n=await Vm({scope:t,name:e,dir:Ts,mode:`copy`});if(n.ok){let e=[...new Set([...y.current,`agents`])];y.current=e,h(e)}else Us.error(o({id:`s-pW_v`,values:{0:n.error}}))}_(!1)})();return}let n=new Set(y.current);t?n.add(e):n.delete(e),k([...n])},installAll(){k([...ar])},linkMode:!0,placeAt(e,t){(async()=>{_(!0);let n=await D(),r=x.current;if(n&&r){let i=await Vm({scope:r,name:n,dir:e,mode:t});i.ok||Us.error(o({id:`s-pW_v`,values:{0:i.error}}))}_(!1)})()}},t[14]=o,t[15]=g,t[16]=k,t[17]=D,t[18]=A,t[19]=j,t[20]=M):M=t[20];let N=M,P=l!==null||g,F;return t[21]!==D||t[22]!==l||t[23]!==d||t[24]!==s||t[25]!==P||t[26]!==N?(F={scope:s,setScope:c,scopeLocked:P,importedName:l,importedScope:d,importNow:D,toggles:N},t[21]=D,t[22]=l,t[23]=d,t[24]=s,t[25]=P,t[26]=N,t[27]=F):F=t[27],F}function Vk(e){return!va(e)}var Hk=`SKILL.md`;function Uk(e){let t=(0,$.c)(12),{scope:n,name:r}=e,i;t[0]!==r||t[1]!==n?(i={scope:n,name:r},t[0]=r,t[1]=n,t[2]=i):i=t[2];let{origin:a,github:o,updateAvailable:s,reimport:c,reimporting:l}=ag(i);if(!a)return null;let u;t[3]===o?u=t[4]:(u=o?(0,Z.jsx)(X,{variant:`ghost`,size:`sm`,className:`px-2`,asChild:!0,children:(0,Z.jsxs)(`a`,{href:o,target:`_blank`,rel:`noreferrer`,children:[(0,Z.jsx)(Y,{id:`wdxz7K`}),(0,Z.jsx)(Fl,{className:`h-3.5 w-3.5`})]})}):null,t[3]=o,t[4]=u);let d;t[5]!==c||t[6]!==l||t[7]!==s?(d=s?(0,Z.jsx)(X,{size:`sm`,onClick:()=>void c(),disabled:l,children:l?(0,Z.jsx)(Y,{id:`JL3si7`}):(0,Z.jsx)(Y,{id:`EkH9pt`})}):null,t[5]=c,t[6]=l,t[7]=s,t[8]=d):d=t[8];let f;return t[9]!==u||t[10]!==d?(f=(0,Z.jsxs)(`div`,{className:`flex gap-1`,children:[u,d]}),t[9]=u,t[10]=d,t[11]=f):f=t[11],f}function Wk(e){let t=(0,$.c)(99),{flavor:n,source:r,name:i,subtitle:a,level:o,reserveRightGutter:s,path:c}=e,l=c??Hk,u=hp(),d=ef(),[f,p]=(0,Q.useState)(null),[m,h]=(0,Q.useState)(!0),g,_;t[0]!==n||t[1]!==i||t[2]!==r?(g=()=>{if(n!==`explore`)return;let e=!1;return Lm({source:r,name:i}).then(t=>{e||t.ok&&p(t)}),()=>{e=!0}},_=[n,r,i],t[0]=n,t[1]=i,t[2]=r,t[3]=g,t[4]=_):(g=t[3],_=t[4]),(0,Q.useEffect)(g,_);let[v,y]=(0,Q.useState)(null),[b,x]=(0,Q.useState)(null),S;t[5]!==n||t[6]!==i||t[7]!==r?(S=n===`explore`?mo(r,i):null,t[5]=n,t[6]=i,t[7]=r,t[8]=S):S=t[8];let C=S,w=n===`explore`?f?.sourceUrl??C?.sourceUrl:v?.repositoryUrl,T=f?.sourceKind??C?.sourceKind,[E,D]=(0,Q.useState)(null),O,k;t[9]!==n||t[10]!==r||t[11]!==T?(O=()=>{if(D(null),n!==`explore`||T!==`site`)return;let e=new AbortController;return Fm(r,e.signal).then(t=>{e.signal.aborted||!t.ok||D(t.skills.map(qk))}),()=>e.abort()},k=[n,T,r],t[9]=n,t[10]=r,t[11]=T,t[12]=O,t[13]=k):(O=t[12],k=t[13]),(0,Q.useEffect)(O,k);let A;t[14]!==b||t[15]!==E?(A=b?{plugin:b.plugin,names:b.bundledSkills,capabilities:b.capabilities,...b.repositoryUrl?{repositoryUrl:b.repositoryUrl}:{}}:E?{plugin:null,names:E}:null,t[14]=b,t[15]=E,t[16]=A):A=t[16];let j=A,M=n===`detected`,N=n===`builtin`,P=n===`foreign`,F=o??`project`,I=n===`explore`,L;t[17]!==i||t[18]!==r||t[19]!==I||t[20]!==F?(L={source:r,name:i,initialScope:F,marketplace:I},t[17]=i,t[18]=r,t[19]=I,t[20]=F,t[21]=L):L=t[21];let R=Bk(L),z=(0,Q.useRef)(!1),[B,V]=(0,Q.useState)(null),H=R.importedName??B,U=R.importedScope??R.scope,{openTabs:ee,closeTab:W}=Ke(),te=km(),G;t[22]!==te||t[23]!==H||t[24]!==U?(G=H!==null&&te.status===`ready`?te.data.find(e=>e.name===H&&e.scope===U):void 0,t[22]=te,t[23]=H,t[24]=U,t[25]=G):G=t[25];let K=(n===`explore`||P||v!==null)&&G!==void 0,q,ne;t[26]!==W||t[27]!==K||t[28]!==H||t[29]!==U||t[30]!==i||t[31]!==d||t[32]!==ee?(q=()=>{if(!K||z.current)return;z.current=!0;let e=ee.filter(e=>{let t=ym(e);return t.kind===`skill-preview`&&t.name===i});d(U,H,{replaceActive:!0,replaceHistory:!0});for(let t of e)W(t)},ne=[K,U,H,d,ee,i,W],t[26]=W,t[27]=K,t[28]=H,t[29]=U,t[30]=i,t[31]=d,t[32]=ee,t[33]=q,t[34]=ne):(q=t[33],ne=t[34]),(0,Q.useEffect)(q,ne);let re;t[35]===a?re=t[36]:(re=a&&a.charAt(0).toUpperCase()+a.slice(1),t[35]=a,t[36]=re);let J=re,ie=u[F],ae;t[37]===i?ae=t[38]:(ae=(0,Z.jsx)(`strong`,{className:`font-medium text-foreground`,children:i}),t[37]=i,t[38]=ae);let oe=ae,se;t[39]===ie?se=t[40]:(se=(0,Z.jsx)(`strong`,{className:`font-medium text-foreground`,children:ie}),t[39]=ie,t[40]=se);let ce=se,le;t[41]===J?le=t[42]:(le=(0,Z.jsx)(`strong`,{className:`font-medium text-foreground`,children:J}),t[41]=J,t[42]=le);let ue=le,de=v?.version?` (v${v.version})`:``,fe;t[43]!==ue||t[44]!==ce||t[45]!==oe||t[46]!==N||t[47]!==M||t[48]!==P||t[49]!==v||t[50]!==de||t[51]!==r?(fe=N?(0,Z.jsx)(Y,{id:`rmorj0`,values:{boldName:oe}}):v?(0,Z.jsx)(Y,{id:`UceXfW`,values:{0:v.plugin,boldName:oe,pluginVersion:de,boldHarness:ue},components:{0:(0,Z.jsx)(`strong`,{className:`font-medium text-foreground`})}}):P?(0,Z.jsx)(Y,{id:`yhYv9j`,values:{boldName:oe,source:r},components:{0:(0,Z.jsx)(`strong`,{className:`font-medium text-foreground`})}}):M?(0,Z.jsx)(Y,{id:`UHwc0P`,values:{boldName:oe,boldHarness:ue,boldLevel:ce}}):(0,Z.jsx)(Y,{id:`fBoO7w`,values:{boldName:oe}}),t[43]=ue,t[44]=ce,t[45]=oe,t[46]=N,t[47]=M,t[48]=P,t[49]=v,t[50]=de,t[51]=r,t[52]=fe):fe=t[52];let pe=fe,me;t[53]!==N||t[54]!==f||t[55]!==M||t[56]!==n||t[57]!==P||t[58]!==i||t[59]!==v||t[60]!==R||t[61]!==u.global||t[62]!==u.project||t[63]!==T||t[64]!==w||t[65]!==F?(me=N?(0,Z.jsx)(Uk,{scope:F,name:i}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`flex gap-1`,children:[f?.skillsUrl?(0,Z.jsx)(X,{variant:`ghost`,size:`sm`,className:`px-2`,asChild:!0,children:(0,Z.jsxs)(`a`,{href:f.skillsUrl,target:`_blank`,rel:`noreferrer`,children:[(0,Z.jsx)(Y,{id:`gN3JX8`}),(0,Z.jsx)(Fl,{className:`h-3.5 w-3.5`})]})}):null,w?(0,Z.jsx)(X,{variant:`ghost`,size:`sm`,className:`px-2`,asChild:!0,children:(0,Z.jsxs)(`a`,{href:w,target:`_blank`,rel:`noreferrer`,children:[n===`explore`&&T===`site`?(0,Z.jsx)(Y,{id:`wdxz7K`}):(0,Z.jsx)(Y,{id:`IreQBq`}),(0,Z.jsx)(Fl,{className:`h-3.5 w-3.5`})]})}):null]}),v||!M?(0,Z.jsxs)(Wi,{children:[(0,Z.jsx)(Ri,{asChild:!0,children:(0,Z.jsx)(X,{size:`sm`,disabled:R.toggles.installing,"data-testid":v?`skill-preview-edit-a-copy`:P?`skill-preview-copy-in`:void 0,children:R.toggles.installing?v||P?(0,Z.jsx)(Y,{id:`Dvr1Sg`}):(0,Z.jsx)(Y,{id:`Wtw22s`}):(0,Z.jsxs)(Z.Fragment,{children:[v?(0,Z.jsx)(Y,{id:`rFL-yb`}):P?(0,Z.jsx)(Y,{id:`XBgr2S`}):(0,Z.jsx)(Y,{id:`TKQ7K-`}),(0,Z.jsx)(Zl,{className:`size-4 opacity-60`,"aria-hidden":!0})]})})}),(0,Z.jsxs)(Hi,{align:`end`,className:cr,children:[(0,Z.jsx)(Bi,{children:(0,Z.jsx)(Y,{id:`oCHfGC`})}),(0,Z.jsxs)(Ni,{value:R.scope,onValueChange:e=>R.setScope(e),children:[(0,Z.jsx)(Li,{value:`project`,disabled:R.scopeLocked,onSelect:Kk,children:u.project}),(0,Z.jsx)(Li,{value:`global`,disabled:R.scopeLocked,onSelect:Gk,children:u.global})]}),(0,Z.jsx)(Gi,{}),(0,Z.jsx)(or,{toggles:R.toggles,skill:{scope:R.scope,name:i}})]})]}):null]}),t[53]=N,t[54]=f,t[55]=M,t[56]=n,t[57]=P,t[58]=i,t[59]=v,t[60]=R,t[61]=u.global,t[62]=u.project,t[63]=T,t[64]=w,t[65]=F,t[66]=me):me=t[66];let he=me,ge;t[67]!==n||t[68]!==o||t[69]!==i||t[70]!==r||t[71]!==a||t[72]!==F?(ge=e=>n===`explore`?(window.location.hash=np({flavor:n,source:r,name:i,subtitle:a,level:o,path:e}),!0):(window.location.hash=ip({scope:F,name:i,path:e}),!0),t[67]=n,t[68]=o,t[69]=i,t[70]=r,t[71]=a,t[72]=F,t[73]=ge):ge=t[73];let _e=ge,ve=a||i,ye;t[74]!==M||t[75]!==n?(ye=e=>{let t=M?e.plugin??null:null;y(e=>e?.provider===t?.provider&&e?.plugin===t?.plugin&&e?.version===t?.version&&e?.marketplace===t?.marketplace&&e?.repositoryUrl===t?.repositoryUrl?e:t),x(n===`explore`?e.pluginBundle??null:null)},t[74]=M,t[75]=n,t[76]=ye):ye=t[76];let be;t[77]!==j||t[78]!==i||t[79]!==R.scope||t[80]!==r?(be=j?(0,Z.jsx)(Rk,{bundle:j,source:r,scope:R.scope,onInstalled:e=>{let t=e.get(i);t!==void 0&&V(t)}}):void 0,t[77]=j,t[78]=i,t[79]=R.scope,t[80]=r,t[81]=be):be=t[81];let xe=N?F:void 0,Se;t[82]!==f||t[83]!==m?(Se=f?.image&&m?(0,Z.jsx)(`img`,{src:f.image,alt:``,className:`max-h-full max-w-full rounded-xl border border-border bg-muted`,onError:()=>h(!1)}):void 0,t[82]=f,t[83]=m,t[84]=Se):Se=t[84];let Ce;return t[85]!==he||t[86]!==pe||t[87]!==i||t[88]!==_e||t[89]!==s||t[90]!==l||t[91]!==r||t[92]!==a||t[93]!==ve||t[94]!==ye||t[95]!==be||t[96]!==xe||t[97]!==Se?(Ce=(0,Z.jsx)(kk,{source:r,name:i,subtitle:a,tintKey:ve,onBundlePathClick:_e,headerActions:he,headerLine:pe,reserveRightGutter:s,selectedPath:l,onPreviewMeta:ye,banner:be,scope:xe,noPreviewFallback:Se}),t[85]=he,t[86]=pe,t[87]=i,t[88]=_e,t[89]=s,t[90]=l,t[91]=r,t[92]=a,t[93]=ve,t[94]=ye,t[95]=be,t[96]=xe,t[97]=Se,t[98]=Ce):Ce=t[98],Ce}function Gk(e){return e.preventDefault()}function Kk(e){return e.preventDefault()}function qk(e){return e.name}var Jk=(0,Q.lazy)(()=>n(()=>import(`./ImportSkillDialog-B_0sfIcE.js`).then(e=>({default:e.ImportSkillDialog})),__vite__mapDeps([127,1,8,2,3,6,9,10,11,12,13,40,14,15,16,100,54,55,18,19,20,22,51,44,45,53,26,27,28,21,24,23,35,128,129,52,56,81,82,83,84,85,86,87,88,89,90,91,92,93,76,94,95,96,97,98,99,4,5,34,43,101,102,36,37,66,67,68,69,70,103,78,72,29,104,105,41,106,30,65,71,73,74,107,108,109,31,25,110,111,46,112,38,42,113,114,115,116,117,118,130,131,132,133,134,135,47,136,137]),import.meta.url)),Yk=6;function Xk(e){let t=(0,$.c)(41),{sessionsDockOpen:n}=e,r=n===void 0?!1:n,{_:i}=xn(),a=u()||r,[o,s]=(0,Q.useState)(null),c=ef(),{createBlank:l}=JS(),{skills:d,isPending:f}=If(),p;t[0]===d?p=t[1]:(p=d.slice(0,Yk),t[0]=d,t[1]=p);let m=p,h=f||m.length>0,g;t[2]===i?g=t[3]:(g=i({id:`ivwdwq`}),t[2]=i,t[3]=g);let _;t[4]===i?_=t[5]:(_=i({id:`6Mbe-P`}),t[4]=i,t[5]=_);let v;t[6]!==g||t[7]!==_?(v=(0,Z.jsx)(aO,{title:g,subtitle:_,celebrateSignal:0}),t[6]=g,t[7]=_,t[8]=v):v=t[8];let y;t[9]===a?y=t[10]:(y=a?null:(0,Z.jsx)(nO,{scenario:`skill`}),t[9]=a,t[10]=y);let b;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(b=()=>s(`upload`),t[11]=b):b=t[11];let x;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`sm`,onClick:b,"data-testid":`skill-source-upload`,className:`gap-1.5 font-normal text-muted-foreground hover:text-foreground`,children:[(0,Z.jsx)(Et,{"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(Y,{id:`mShKiV`})]}),t[12]=x):x=t[12];let S;t[13]===l?S=t[14]:(S=()=>void l(`project`),t[13]=l,t[14]=S);let C,w;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(Ur,{"aria-hidden":`true`,className:`size-3.5`}),w=(0,Z.jsx)(Y,{id:`dJXrT9`}),t[15]=C,t[16]=w):(C=t[15],w=t[16]);let T;t[17]===S?T=t[18]:(T=(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`sm`,onClick:S,"data-testid":`skill-source-new`,className:`gap-1.5 font-normal text-muted-foreground hover:text-foreground`,children:[C,w]}),t[17]=S,t[18]=T);let E;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(E=()=>s(`skills-sh`),t[19]=E):E=t[19];let D;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`sm`,onClick:E,"data-testid":`skill-source-skills-sh`,className:`gap-1.5 font-normal text-muted-foreground hover:text-foreground`,children:[(0,Z.jsx)(py,{"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(Y,{id:`EBS8_X`})]}),t[20]=D):D=t[20];let O;t[21]===T?O=t[22]:(O=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1`,children:[x,T,D]}),t[21]=T,t[22]=O);let k;t[23]!==O||t[24]!==y?(k=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[y,O]}),t[23]=O,t[24]=y,t[25]=k):k=t[25];let A;t[26]!==i||t[27]!==m||t[28]!==f||t[29]!==h?(A=h?(0,Z.jsx)(Pf,{scope:`project`,results:m,pending:f,skeletonCount:Yk,testId:`skills-popular`,loadingLabel:i({id:`JDHcCM`}),label:(0,Z.jsx)(Y,{id:`3v62tp`}),action:f?null:(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>s(`skills-sh`),"data-testid":`skill-popular-browse-all`,className:`h-auto gap-1 py-0.5 font-mono text-2xs uppercase tracking-wider text-muted-foreground hover:text-foreground`,children:[(0,Z.jsx)(Y,{id:`O-m8q9`}),(0,Z.jsx)(Nl,{"aria-hidden":`true`,className:`size-3`})]})}):null,t[26]=i,t[27]=m,t[28]=f,t[29]=h,t[30]=A):A=t[30];let j;t[31]!==k||t[32]!==A||t[33]!==v?(j=(0,Z.jsxs)(`div`,{className:`my-auto w-full max-w-4xl space-y-6`,children:[v,k,A]}),t[31]=k,t[32]=A,t[33]=v,t[34]=j):j=t[34];let M;t[35]!==o||t[36]!==c?(M=o===null?null:(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(Jk,{defaultScope:`project`,defaultTab:o,open:!0,onOpenChange:e=>{e||s(null)},onImported:e=>{let{scope:t,name:n}=e;s(null),c(t,n)}})}),t[35]=o,t[36]=c,t[37]=M):M=t[37];let N;return t[38]!==j||t[39]!==M?(N=(0,Z.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col items-center overflow-auto subtle-scrollbar p-10`,children:[j,M]}),t[38]=j,t[39]=M,t[40]=N):N=t[40],N}function Zk(e){let t=null,n=()=>(t===null&&(t=e(),t.catch(()=>{})),t),r=(0,Q.lazy)(n);return r.preload=n,r}var Qk=Zk(()=>n(()=>import(`./SettingsDialogBody-B1Tc9Esn.js`).then(e=>({default:e.SettingsDialogBody})),__vite__mapDeps([138,1,139,20,16,8,2,3,6,9,10,11,12,13,93,40,76,26,15,94,95,96,97,98,99,14,100,54,55,18,19,22,51,44,45,53,27,28,21,24,23,35,140,43,29,17,25,34,141,142,143,52,106,121,122,38,128,129,144,101,50,56,81,82,83,84,85,86,87,88,89,90,91,92,4,5,102,36,37,66,67,68,69,70,103,78,72,104,105,41,30,65,71,73,74,107,108,109,31,110,111,46,112,42,113,114,115,116,117,118,145,64,146,147,148,149,150,130,151,152,153,154,47,155,156,157,158,159,160,132,161,162,133,163,164,135,165,166,167,134,168,169]),import.meta.url));function $k(e){let t=(0,$.c)(9),{error:n}=e,{_:r}=xn(),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)(Y,{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)(X,{variant:`default`,onClick:eA,children:(0,Z.jsx)(Y,{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 eA(){return window.location.reload()}function tA(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(Xn,{fallbackRender:rA,onError:nA,children:n}),t[0]=n,t[1]=r),r}function nA(e,t){console.error(`[SettingsDialogErrorBoundary] rendered fallback for Settings body`,e,t.componentStack)}function rA(e){return(0,Z.jsx)($k,{...e})}function iA(e=typeof window>`u`?void 0:window.location){return e?.protocol===`file:`}function aA(e){let{groups:t,translate:n}=e,r=[],i=new Set;for(let e of t)if(e.enabled)for(let t of e.items){i.add(t.id),r.push({id:`section:${t.id}`,kind:`section`,sectionId:t.id,label:t.label,context:e.label,keywords:[e.label]});for(let n of t.subsections??[])r.push({id:`subsection:${t.id}:${n.id}`,kind:`field`,sectionId:t.id,label:n.label,context:`${e.label} → ${t.label}`,keywords:[e.label,t.label],targetField:n.anchor})}for(let e of Ku)if(i.has(e.sectionId))for(let t of e.fields){let i=t.path.join(`.`);r.push({id:`field:${e.sectionId}:${i}`,kind:`field`,sectionId:e.sectionId,label:n(t.label),keywords:t.description?[n(t.description)]:[],targetField:i})}if(i.has(`plugin:markdownlint`))for(let e of ds)r.push({id:`rule:${e.id}`,kind:`rule`,sectionId:`plugin:markdownlint`,label:e.name,keywords:[e.id,e.alias,...e.aliases],ruleId:e.id});return r}function oA(e){return`https://github.com/inkeep/open-knowledge/releases/tag/v${encodeURIComponent(e)}`}var sA={"content-rules":{sectionId:`project-preferences`,anchor:`section:content-rules`},terminal:{sectionId:`project-preferences`,anchor:`section:terminal`},sharing:{sectionId:`sync`,anchor:`section:sharing`}};function cA(e){let t=sA[e];return t?{sectionId:t.sectionId,anchor:t.anchor}:{sectionId:e,anchor:null}}function lA(e){return cA(e).sectionId}function uA(e){let t=(0,$.c)(50),{open:n,initialSection:r,onOpenChange:i}=e,a=r===void 0?null:r,{_:o}=xn(),{collabUrl:s}=Ke(),{userBinding:c,userSynced:l,okignoreBinding:u,okignoreSynced:d,projectConfig:f,merged:p}=Gc(),{desktopPresent:m}=td(),h=a??`preferences`,g;t[0]===h?g=t[1]:(g=lA(h),t[0]=h,t[1]=g);let[_,v]=(0,Q.useState)(g),[y,b]=(0,Q.useState)(``),[x,S]=(0,Q.useState)(null),[C,w]=(0,Q.useState)(null),T=(0,Q.useRef)(0),E=(0,Q.useRef)(null),D,O;t[2]!==a||t[3]!==n?(D=()=>{if(n){let e=cA(a??`preferences`);v(e.sectionId),S(e.anchor?{path:e.anchor}:null),b(``)}},O=[n,a],t[2]=a,t[3]=n,t[4]=D,t[5]=O):(D=t[4],O=t[5]),(0,Q.useEffect)(D,O);let k,A;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(k=()=>tc(e=>{let t=cA(e);v(t.sectionId),t.anchor&&S({path:t.anchor})}),A=[],t[6]=k,t[7]=A):(k=t[6],A=t[7]),(0,Q.useEffect)(k,A);let j,M;t[8]===x?(j=t[9],M=t[10]):(j=()=>{if(!x)return;let e=E.current;if(!e)return;let t=null,n=null,r=null,i=null,a=()=>{let r=e.querySelector(`[data-field="${x.path}"]`);return r?(r.scrollIntoView({block:`center`}),r.classList.add(`animate-settings-nav-flash`),t=r,n=setTimeout(()=>r.classList.remove(`animate-settings-nav-flash`),750),!0):!1};return a()||(i=new MutationObserver(()=>{a()&&i?.disconnect()}),i.observe(e,{childList:!0,subtree:!0}),r=setTimeout(()=>i?.disconnect(),4e3)),()=>{i?.disconnect(),n&&clearTimeout(n),r&&clearTimeout(r),t?.classList.remove(`animate-settings-nav-flash`)}},M=[x],t[8]=x,t[9]=j,t[10]=M),(0,Q.useEffect)(j,M);let N=s!==null,P;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(P=Yu(),t[11]=P):P=t[11];let F=P,I;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(I=Qu(),t[12]=I):I=t[12];let L=I,R,z;if(t[13]!==o||t[14]!==m||t[15]!==N||t[16]!==p?.appearance?.colorThemeEnabled||t[17]!==p?.slides?.enabled||t[18]!==f?.contentRules){let e;t[21]===f?.contentRules?e=t[22]:(e=e=>f?.contentRules?.[e.id]?.enabled===!0,t[21]=f?.contentRules,t[22]=e);let n=Pu.filter(e).map(dA),r=p?.appearance?.colorThemeEnabled!==!1,i=p?.slides?.enabled===!0,a=iA();R=[{id:`user`,label:o({id:`7PzzBU`}),enabled:!0,items:[{id:`preferences`,label:o({id:`Q6hhn8`})},{id:`configure-agents`,label:o({id:`jRAGrQ`})},{id:`hotkeys`,label:o({id:`4KmEoC`})},{id:`account`,label:o({id:`AeXO77`})},{id:`user-plugins-manage`,label:o({id:`ohUJJM`})},{id:`user-skills`,label:o({id:`w7LRoP`})},...F?[{id:`ai-tools`,label:o({id:`_5qBNl`})}]:[]]},{id:`project`,label:o({id:`ZWyHmq`}),enabled:N,items:[{id:`project-preferences`,label:o({id:`Q6hhn8`}),subsections:[{id:`attachments`,label:o({id:`w_Sphq`}),anchor:`content.attachmentFolderPath`},{id:`content-rules`,label:o({id:`OPOiKn`}),anchor:`section:content-rules`},...L?[{id:`terminal`,label:o({id:`ALhMYW`}),anchor:`section:terminal`}]:[]]},{id:`sync`,label:o({id:`AznQ2V`}),subsections:[{id:`sharing`,label:o({id:`cs4mps`}),anchor:`section:sharing`}]},{id:`search`,label:o({id:`A1taO8`})},{id:`plugins-manage`,label:o({id:`ohUJJM`})},...a?[]:[{id:`link-previews`,label:o({id:`gh27t1`})}],...F?[{id:`project-ai-tools`,label:o({id:`crqzW5`})}]:[],...F?[{id:`network-access`,label:o({id:`d02jS3`})}]:[],{id:`project-templates`,label:o({id:`iTylMl`})},{id:`skills`,label:o({id:`w7LRoP`})},{id:`okignore`,label:o({id:`3zyg_A`})}]},{id:`plugins`,label:o({id:`ohUJJM`}),enabled:!0,items:[...N?n:[],...r?[{id:`plugin:theme`,label:o({id:`fJ3EbT`})}]:[],...i?[{id:`plugin:slides`,label:o({id:`f14doC`})}]:[]]},{id:`integrations`,label:o({id:`nbfdhU`}),enabled:!0,items:[]}],z=aA({groups:R,translate:o}),t[13]=o,t[14]=m,t[15]=N,t[16]=p?.appearance?.colorThemeEnabled,t[17]=p?.slides?.enabled,t[18]=f?.contentRules,t[19]=R,t[20]=z}else R=t[19],z=t[20];let B=z,V;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(V=function(e){T.current+=1;let t=T.current;v(e.sectionId),e.kind===`field`&&e.targetField?S({path:e.targetField}):e.kind===`rule`&&e.ruleId&&w({query:e.ruleId,nonce:t}),b(``)},t[23]=V):V=t[23];let H=V,U;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(Pp,{className:`sr-only`,children:(0,Z.jsx)(Y,{id:`Tz0i8g`})}),t[24]=U):U=t[24];let ee;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Z.jsx)(Np,{className:`sr-only`,children:(0,Z.jsx)(Y,{id:`RDrXh4`})}),t[25]=ee):ee=t[25];let W;t[26]!==_||t[27]!==R||t[28]!==B||t[29]!==y?(W=(0,Z.jsx)(fA,{groups:R,activeId:_,onSelect:v,entries:B,searchQuery:y,onSearchChange:b,onNavigate:H}),t[26]=_,t[27]=R,t[28]=B,t[29]=y,t[30]=W):W=t[30];let te;t[31]===o?te=t[32]:(te=o({id:`OXb_Df`}),t[31]=o,t[32]=te);let G;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,Z.jsx)(bA,{}),t[33]=G):G=t[33];let K=l?c:null,q;t[34]!==_||t[35]!==u||t[36]!==d||t[37]!==C||t[38]!==K?(q=(0,Z.jsx)(tA,{children:(0,Z.jsx)(Q.Suspense,{fallback:G,children:(0,Z.jsx)(Qk,{activeId:_,userBinding:K,okignoreBinding:u,okignoreSynced:d,markdownlintRuleQuery:C})})}),t[34]=_,t[35]=u,t[36]=d,t[37]=C,t[38]=K,t[39]=q):q=t[39];let ne;t[40]!==te||t[41]!==q?(ne=(0,Z.jsx)(`section`,{ref:E,"aria-label":te,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain subtle-scrollbar p-6`,tabIndex:0,children:q}),t[40]=te,t[41]=q,t[42]=ne):ne=t[42];let re;t[43]!==W||t[44]!==ne?(re=(0,Z.jsxs)(Fp,{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:[U,ee,W,ne]}),t[43]=W,t[44]=ne,t[45]=re):re=t[45];let J;return t[46]!==i||t[47]!==n||t[48]!==re?(J=(0,Z.jsx)(Bp,{open:n,onOpenChange:i,children:re}),t[46]=i,t[47]=n,t[48]=re,t[49]=J):J=t[49],J}function dA(e){return{id:`plugin:${e.id}`,label:e.label}}function fA(e){let t=(0,$.c)(46),{groups:n,activeId:r,onSelect:i,entries:a,searchQuery:o,onSearchChange:s,onNavigate:c}=e,{_:l}=xn(),u,d,f,p,m,h,g,_,v,y;if(t[0]!==l||t[1]!==a||t[2]!==c||t[3]!==s||t[4]!==o){d=o.trim();let e=d===``?[]:a.filter(e=>cS(e.label,d,e.keywords)),n=e.filter(hA),r=e.filter(mA),i=e.filter(pA);t[15]===l?v=t[16]:(v=l({id:`y1t8bQ`}),t[15]=l,t[16]=v),y=`flex shrink-0 gap-x-3 overflow-x-auto overscroll-contain subtle-scrollbar scroll-fade-mask-x-max-sm border-b bg-muted/30 px-3 py-2 max-sm:pt-10 sm:h-full sm:min-h-0 sm:flex-col sm:gap-0 sm:overflow-x-visible sm:border-r sm:border-b-0 sm:py-4`,u=Ae,f=!1,p=`h-auto w-full shrink-0 bg-transparent sm:mb-3 [&_[data-slot=command-input-wrapper]]:h-9 [&_[data-slot=command-input-wrapper]]:rounded-lg [&_[data-slot=command-input-wrapper]]:border [&_[data-slot=command-input-wrapper]]:border-input`,m=`settings-search`;let b;t[17]===l?b=t[18]:(b=l({id:`1DahsC`}),t[17]=l,t[18]=b),t[19]!==s||t[20]!==o||t[21]!==b?(h=(0,Z.jsx)(k,{value:o,onValueChange:s,placeholder:b,className:`py-0`,"data-testid":`settings-search-input`}),t[19]=s,t[20]=o,t[21]=b,t[22]=h):h=t[22];let x=d===``?null:(0,Z.jsx)(Y,{id:`TQJCR6`,values:{0:e.length}});t[23]===x?g=t[24]:(g=(0,Z.jsx)(`span`,{"aria-live":`polite`,className:`sr-only`,"data-testid":`settings-search-result-count`,children:x}),t[23]=x,t[24]=g),_=d===``?null:(0,Z.jsxs)(Kt,{"data-testid":`settings-search-results`,className:`mt-1.5`,children:[(0,Z.jsx)(De,{"data-testid":`settings-search-empty`,children:(0,Z.jsx)(Y,{id:`ljFWEt`})}),n.length>0?(0,Z.jsx)(Ne,{heading:l({id:`R4OWFD`}),children:n.map(e=>(0,Z.jsx)(gA,{entry:e,query:d,onNavigate:c},e.id))}):null,r.length>0?(0,Z.jsx)(Ne,{heading:l({id:`Tz0i8g`}),children:r.map(e=>(0,Z.jsx)(gA,{entry:e,query:d,onNavigate:c},e.id))}):null,i.length>0?(0,Z.jsx)(Ne,{heading:l({id:`v2a04T`}),children:i.map(e=>(0,Z.jsx)(gA,{entry:e,query:d,onNavigate:c},e.id))}):null]}),t[0]=l,t[1]=a,t[2]=c,t[3]=s,t[4]=o,t[5]=u,t[6]=d,t[7]=f,t[8]=p,t[9]=m,t[10]=h,t[11]=g,t[12]=_,t[13]=v,t[14]=y}else u=t[5],d=t[6],f=t[7],p=t[8],m=t[9],h=t[10],g=t[11],_=t[12],v=t[13],y=t[14];let b;t[25]!==u||t[26]!==f||t[27]!==p||t[28]!==m||t[29]!==h||t[30]!==g||t[31]!==_?(b=(0,Z.jsxs)(u,{shouldFilter:f,className:p,"data-testid":m,children:[h,g,_]}),t[25]=u,t[26]=f,t[27]=p,t[28]=m,t[29]=h,t[30]=g,t[31]=_,t[32]=b):b=t[32];let x;t[33]!==r||t[34]!==n||t[35]!==i||t[36]!==d?(x=d===``?n.map(e=>(0,Z.jsx)(yA,{group:e,activeId:r,onSelect:i},e.id)):null,t[33]=r,t[34]=n,t[35]=i,t[36]=d,t[37]=x):x=t[37];let S;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(vA,{}),t[38]=S):S=t[38];let C;t[39]===x?C=t[40]:(C=(0,Z.jsxs)(`div`,{className:`contents subtle-scrollbar sm:flex sm:min-h-0 sm:flex-1 sm:flex-col sm:overflow-y-auto sm:overscroll-contain`,children:[x,S]}),t[39]=x,t[40]=C);let w;return t[41]!==C||t[42]!==v||t[43]!==y||t[44]!==b?(w=(0,Z.jsxs)(`nav`,{"aria-label":v,className:y,children:[b,C]}),t[41]=C,t[42]=v,t[43]=y,t[44]=b,t[45]=w):w=t[45],w}function pA(e){return e.kind===`rule`}function mA(e){return e.kind===`field`}function hA(e){return e.kind===`section`}function gA(e){let t=(0,$.c)(16),{entry:n,query:r,onNavigate:i}=e,a=n.id,o;t[0]!==n||t[1]!==i?(o=()=>i(n),t[0]=n,t[1]=i,t[2]=o):o=t[2];let s=`settings-search-result-${n.id}`,c;t[3]!==n.label||t[4]!==r?(c=aS(n.label,r).map(_A),t[3]=n.label,t[4]=r,t[5]=c):c=t[5];let l;t[6]===c?l=t[7]:(l=(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:c}),t[6]=c,t[7]=l);let u;t[8]===n.context?u=t[9]:(u=n.context===void 0?null:(0,Z.jsx)(`span`,{className:`ms-auto shrink-0 truncate ps-3 text-1sm text-muted-foreground`,children:n.context}),t[8]=n.context,t[9]=u);let d;return t[10]!==n.id||t[11]!==o||t[12]!==s||t[13]!==l||t[14]!==u?(d=(0,Z.jsxs)(H,{value:a,onSelect:o,"data-testid":s,children:[l,u]}),t[10]=n.id,t[11]=o,t[12]=s,t[13]=l,t[14]=u,t[15]=d):d=t[15],d}function _A(e){return e.match?(0,Z.jsx)(`span`,{className:`font-semibold text-foreground`,children:e.text},e.start):(0,Z.jsx)(`span`,{children:e.text},e.start)}function vA(){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=oA(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:Qn(`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)(Y,{id:`_PACVa`}),(0,Z.jsx)(Fl,{className:`size-3`,"aria-hidden":`true`})]})]}),e[3]=s):s=e[3],s}function yA(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=Qn(`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)(Y,{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:Qn(`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 bA(){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)(Y,{id:`GsBUCk`})}),n=(0,Z.jsx)(Ch,{className:`h-5 w-32`}),r=(0,Z.jsx)(Ch,{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)(Ch,{className:`h-9 w-full`}),(0,Z.jsx)(Ch,{className:`h-9 w-full`})]})]}),e[3]=i):i=e[3],i}function xA(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Qn(`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)(ID,{"data-slot":`resizable-panel-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function SA(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)(BD,{"data-slot":`resizable-panel`,...n}),t[2]=n,t[3]=r),r}function CA(e){let t=(0,$.c)(14),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({withHandle:a,className:r,children:n,...i}=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=Qn(`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`,r),t[5]=r,t[6]=o);let s;t[7]===a?s=t[8]:(s=a&&(0,Z.jsx)(`div`,{className:`z-10 flex h-6 w-1 shrink-0 rounded-lg bg-border`}),t[7]=a,t[8]=s);let c;return t[9]!==n||t[10]!==i||t[11]!==o||t[12]!==s?(c=(0,Z.jsxs)(WD,{"data-slot":`resizable-handle`,className:o,...i,children:[s,n]}),t[9]=n,t[10]=i,t[11]=o,t[12]=s,t[13]=c):c=t[13],c}function wA(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}=xn(),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)(Y,{id:`KujtjC`})}),t[15]=A):A=t[15];let j;t[16]===u?j=t[17]:(j=e=>u(e.target.value),t[16]=u,t[17]=j);let M;t[18]===b?M=t[19]:(M=b({id:`KujtjC`}),t[18]=b,t[19]=M);let N;t[20]!==n||t[21]!==E||t[22]!==r||t[23]!==j||t[24]!==M?(N=(0,Z.jsx)(sg,{ref:n,id:`ok-find-input`,value:r,onChange:j,onKeyDown:E,placeholder:M,autoComplete:`off`,spellCheck:!1,className:`h-7 px-2 text-sm`}),t[20]=n,t[21]=E,t[22]=r,t[23]=j,t[24]=M,t[25]=N):N=t[25];let P;t[26]===b?P=t[27]:(P=b({id:`-8PP0T`}),t[26]=b,t[27]=P);let F;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(Jl,{"aria-hidden":`true`}),t[28]=F):F=t[28];let I;t[29]!==o||t[30]!==p||t[31]!==P?(I=(0,Z.jsx)(_r,{asChild:!0,children:(0,Z.jsx)(fa,{type:`button`,variant:`segmented`,size:`sm`,"aria-label":P,pressed:o,onPressedChange:p,className:`size-6 min-w-6 px-0`,children:F})}),t[29]=o,t[30]=p,t[31]=P,t[32]=I):I=t[32];let L;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(vr,{side:`bottom`,children:(0,Z.jsx)(Y,{id:`-8PP0T`})}),t[33]=L):L=t[33];let R;t[34]===I?R=t[35]:(R=(0,Z.jsxs)(br,{children:[I,L]}),t[34]=I,t[35]=R);let z;t[36]===b?z=t[37]:(z=b({id:`_7UQ7y`}),t[36]=b,t[37]=z);let B;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsx)(_b,{"aria-hidden":`true`}),t[38]=B):B=t[38];let V;t[39]!==m||t[40]!==z||t[41]!==s?(V=(0,Z.jsx)(_r,{asChild:!0,children:(0,Z.jsx)(fa,{type:`button`,variant:`segmented`,size:`sm`,"aria-label":z,pressed:s,onPressedChange:m,className:`size-6 min-w-6 px-0`,children:B})}),t[39]=m,t[40]=z,t[41]=s,t[42]=V):V=t[42];let H;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Z.jsx)(vr,{side:`bottom`,children:(0,Z.jsx)(Y,{id:`_7UQ7y`})}),t[43]=H):H=t[43];let U;t[44]===V?U=t[45]:(U=(0,Z.jsxs)(br,{children:[V,H]}),t[44]=V,t[45]=U);let ee;t[46]!==R||t[47]!==U?(ee=(0,Z.jsxs)(og,{align:`inline-end`,className:`gap-0.5`,children:[R,U]}),t[46]=R,t[47]=U,t[48]=ee):ee=t[48];let W;t[49]!==ee||t[50]!==N?(W=(0,Z.jsxs)(cg,{className:`h-7 w-56 rounded-[min(var(--radius-md),12px)]`,children:[N,ee]}),t[49]=ee,t[50]=N,t[51]=W):W=t[51];let te;t[52]===w?te=t[53]:(te=(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]=te);let G;t[54]===b?G=t[55]:(G=b({id:`oqB2ez`}),t[54]=b,t[55]=G);let K=!S,q;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,Z.jsx)(Ji,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[56]=q):q=t[56];let ne;t[57]!==g||t[58]!==G||t[59]!==K?(ne=(0,Z.jsx)(_r,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":G,disabled:K,onClick:g,children:q})}),t[57]=g,t[58]=G,t[59]=K,t[60]=ne):ne=t[60];let re;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Z.jsx)(vr,{side:`bottom`,children:(0,Z.jsx)(Y,{id:`oqB2ez`})}),t[61]=re):re=t[61];let J;t[62]===ne?J=t[63]:(J=(0,Z.jsxs)(br,{children:[ne,re]}),t[62]=ne,t[63]=J);let ie;t[64]===b?ie=t[65]:(ie=b({id:`SiUUCS`}),t[64]=b,t[65]=ie);let ae=!S,oe;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,Z.jsx)(Zl,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[66]=oe):oe=t[66];let se;t[67]!==h||t[68]!==ie||t[69]!==ae?(se=(0,Z.jsx)(_r,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":ie,disabled:ae,onClick:h,children:oe})}),t[67]=h,t[68]=ie,t[69]=ae,t[70]=se):se=t[70];let ce;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(ce=(0,Z.jsx)(vr,{side:`bottom`,children:(0,Z.jsx)(Y,{id:`SiUUCS`})}),t[71]=ce):ce=t[71];let le;t[72]===se?le=t[73]:(le=(0,Z.jsxs)(br,{children:[se,ce]}),t[72]=se,t[73]=le);let ue=a?`secondary`:`ghost`,de;t[74]!==b||t[75]!==a?(de=b(a?{id:`UkQGhd`}:{id:`1RluQD`}),t[74]=b,t[75]=a,t[76]=de):de=t[76];let fe=a?`ok-replace-input`:void 0,pe;t[77]!==f||t[78]!==a?(pe=()=>f(!a),t[77]=f,t[78]=a,t[79]=pe):pe=t[79];let me;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,Z.jsx)(Jy,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[80]=me):me=t[80];let he;t[81]!==a||t[82]!==ue||t[83]!==de||t[84]!==fe||t[85]!==pe?(he=(0,Z.jsx)(_r,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:ue,size:`icon-sm`,"aria-label":de,"aria-expanded":a,"aria-controls":fe,onClick:pe,children:me})}),t[81]=a,t[82]=ue,t[83]=de,t[84]=fe,t[85]=pe,t[86]=he):he=t[86];let ge;t[87]===a?ge=t[88]:(ge=(0,Z.jsx)(vr,{side:`bottom`,children:a?(0,Z.jsx)(Y,{id:`UkQGhd`}):(0,Z.jsx)(Y,{id:`1RluQD`})}),t[87]=a,t[88]=ge);let _e;t[89]!==he||t[90]!==ge?(_e=(0,Z.jsxs)(br,{children:[he,ge]}),t[89]=he,t[90]=ge,t[91]=_e):_e=t[91];let ve;t[92]!==b||t[93]!==O||t[94]!==S||t[95]!==v||t[96]!==_||t[97]!==d||t[98]!==a||t[99]!==i?(ve=a?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`label`,{className:`sr-only`,htmlFor:`ok-replace-input`,children:(0,Z.jsx)(Y,{id:`fqSfXY`})}),(0,Z.jsx)(Op,{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)(br,{children:[(0,Z.jsx)(_r,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":b({id:`bS_boY`}),disabled:!S,onClick:_,children:(0,Z.jsx)(Jy,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(vr,{side:`bottom`,children:(0,Z.jsx)(Y,{id:`bS_boY`})})]}),(0,Z.jsxs)(br,{children:[(0,Z.jsx)(_r,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":b({id:`dr1vFs`}),disabled:!S,onClick:v,children:(0,Z.jsx)(qy,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(vr,{side:`bottom`,children:(0,Z.jsx)(Y,{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]=ve):ve=t[100];let ye;t[101]===b?ye=t[102]:(ye=b({id:`wJo9oS`}),t[101]=b,t[102]=ye);let be;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(be=(0,Z.jsx)(Gf,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[103]=be):be=t[103];let xe;t[104]!==y||t[105]!==ye?(xe=(0,Z.jsx)(_r,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":ye,onClick:y,children:be})}),t[104]=y,t[105]=ye,t[106]=xe):xe=t[106];let Se;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(Se=(0,Z.jsx)(vr,{side:`bottom`,children:(0,Z.jsx)(Y,{id:`yz7wBu`})}),t[107]=Se):Se=t[107];let Ce;t[108]===xe?Ce=t[109]:(Ce=(0,Z.jsxs)(br,{children:[xe,Se]}),t[108]=xe,t[109]=Ce);let we;return t[110]!==W||t[111]!==te||t[112]!==J||t[113]!==le||t[114]!==k||t[115]!==_e||t[116]!==ve||t[117]!==Ce?(we=(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,W,te,J,le,_e,ve,Ce]}),t[110]=W,t[111]=te,t[112]=J,t[113]=le,t[114]=k,t[115]=_e,t[116]=ve,t[117]=Ce,t[118]=we):we=t[118],we}var TA={current:0,total:0},EA=120,DA=100;function OA(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=()=>e?on(e):null,t[0]=e,t[1]=n),(0,Q.useSyncExternalStore)(v,n,kA)}function kA(){return null}function AA(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,`
4
+ `)[e.range.start.line];Vc(Jw(n,e,t),{submit:!0})},t[21]=n,t[22]=p,t[23]=O):O=t[23];let k=O,A;t[24]===n?A=t[25]:(A=e=>{Vc(Yw(e===`doc`?n:null),{submit:!0})},t[24]=n,t[25]=A);let j=A,M=rC()?RT.filter(qT):RT,N=M.some(e=>e.id===i)?i:`outline`,P=o===`doc`&&M.length>1,F,I;t[26]!==N||t[27]!==c||t[28]!==o?(F=()=>(Vw(!c&&o===`doc`&&N===`comments`),KT),I=[c,o,N],t[26]=N,t[27]=c,t[28]=o,t[29]=F,t[30]=I):(F=t[29],I=t[30]),(0,Q.useEffect)(F,I);let L=P?(0,Z.jsx)(`div`,{className:`flex flex-row items-center justify-center gap-3 p-2`,children:(0,Z.jsx)(pa,{type:`single`,variant:`outline`,value:N,onValueChange:e=>{e&&a(e)},"aria-label":l({id:`SrOuyg`}),children:M.map(e=>{let{id:t,icon:n}=e,r=VT(t),i=t===`problems`&&v.length>0;return(0,Z.jsxs)(br,{children:[(0,Z.jsx)(da,{value:t,role:`tab`,id:`tab-${t}`,"aria-controls":`panel-${t}`,"aria-label":i?l({id:`2m_bmh`,values:{0:v.length,label:r}}):r,asChild:!0,children:(0,Z.jsxs)(_r,{className:`relative`,children:[(0,Z.jsx)(n,{}),i&&(0,Z.jsx)(wm,{variant:`notification`,"aria-hidden":`true`,className:`pointer-events-none absolute -top-0.5 right-0.5 h-3.5 min-w-3.5 rounded-full px-1 font-sans text-[9px] leading-none tabular-nums`,children:v.length>99?`99+`:v.length})]})}),(0,Z.jsx)(vr,{side:`bottom`,children:r})]},t)})})}):null,R;t[31]!==v||t[32]!==n||t[33]!==N||t[34]!==k||t[35]!==E||t[36]!==w||t[37]!==j||t[38]!==r||t[39]!==h.status||t[40]!==p||t[41]!==o||t[42]!==P||t[43]!==D?(R=o===`doc`?(0,Z.jsxs)(`div`,{...P?{role:`tabpanel`,id:`panel-${N}`,"aria-labelledby":`tab-${N}`}:{},className:`min-h-0 flex-1`,children:[N===`outline`&&(0,Z.jsx)(ku,{docName:n,isSourceMode:r}),N===`links`&&(0,Z.jsx)(uT,{docName:n}),N===`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)(Y,{id:`-lCAuQ`})}),children:(0,Z.jsx)(UT,{activeDocName:n})}),N===`timeline`&&(0,Z.jsx)(AT,{docName:n}),N===`comments`&&(0,Z.jsx)(Lw,{docName:n}),N===`problems`&&(0,Z.jsx)(Tu,{docName:n,diagnostics:v,linkFindingsStatus:h.status,onFix:p===null?void 0:w,onAutoFix:p===null?void 0:E,onAskAi:p!==null&&D!==null?k:void 0,onFixWithAi:D===null?void 0:j})]}):(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)(Y,{id:`ONPvOb`})}),children:(0,Z.jsx)(WT,{})})}),t[31]=v,t[32]=n,t[33]=N,t[34]=k,t[35]=E,t[36]=w,t[37]=j,t[38]=r,t[39]=h.status,t[40]=p,t[41]=o,t[42]=P,t[43]=D,t[44]=R):R=t[44];let z;return t[45]!==L||t[46]!==R?(z=(0,Z.jsxs)(Z.Fragment,{children:[L,R]}),t[45]=L,t[46]=R,t[47]=z):z=t[47],z}function KT(){return Vw(!1)}function qT(e){return zT.includes(e.id)}function JT(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function YT(e,t){let n=getComputedStyle(e.ownerDocument.documentElement);return t*parseFloat(n.fontSize)}function XT(e){return e/100*window.innerHeight}function ZT(e){return e/100*window.innerWidth}function QT(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 $T({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=QT(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=YT(t,i);break;case`em`:r=JT(t,i);break;case`vh`:r=XT(i);break;case`vw`:r=ZT(i);break}return r}function eE(e){return parseFloat(e.toFixed(3))}function tE({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 nE(e){let{panels:t}=e,n=tE({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=eE($T({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=eE($T({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=eE($T({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=eE($T({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 rE(e,t=`Assertion error`){if(!e)throw Error(t)}function iE(e,t){return Array.from(t).sort(e===`horizontal`?aE:oE)}function aE(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function oE(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function sE(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function cE(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 lE({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}=cE(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return rE(i,`No rect found`),i}var uE;function dE(){return uE===void 0&&(uE=typeof matchMedia==`function`?!!matchMedia(`(pointer:coarse)`).matches:!1),uE}function fE(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=iE(n,Array.from(t.children).filter(sE).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,lE({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=dE()?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:tE({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 pE=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)}}},mE={cursorFlags:0,state:`inactive`},hE=new pE;function gE(){return mE}function _E(e){return hE.addListener(`change`,e)}function vE(e){let t=mE,n={...mE};n.cursorFlags=e,mE=n,hE.emit(`change`,{prev:t,next:n})}function yE(e){let t=mE;mE=e,hE.emit(`change`,{prev:t,next:e})}var bE=e=>e,xE=()=>{},SE=1,CE=2,wE=4,TE=8,EE=3,DE=12,OE;function kE(){return OE===void 0&&(OE=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(OE=!0)),OE}function AE({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&&kE()){let t=(e&SE)!==0,n=(e&CE)!==0,r=(e&wE)!==0,i=(e&TE)!==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 kE()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var jE=new WeakMap;function ME(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=jE.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&(Object.isExtensible(e.adoptedStyleSheets)?e.adoptedStyleSheets.push(n):e.adoptedStyleSheets=[...e.adoptedStyleSheets,n]));let r=gE();switch(r.state){case`active`:case`hover`:{let e=AE({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}jE.set(e,{prevStyle:t,styleSheet:n})}var NE=new Map,PE=new pE;function FE(e){NE=new Map(NE),NE.delete(e)}function IE(e,t){for(let[t]of NE)if(t.id===e)return t}function LE(e,t){for(let[t,n]of NE)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function RE(){return NE}function zE(e,t){return PE.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function BE(e,t,n){let r=NE.get(e);NE=new Map(NE),NE.set(e,t),PE.emit(`groupChange`,{group:e,isUserInteraction:n?.isUserInteraction===!0,prev:r,next:t})}function VE(e){let t=gE(),n=!1;switch(t.state){case`active`:yE({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&(ME(e),n=!0,t.hitRegions.forEach(e=>{let t=LE(e.group.id,!0);BE(e.group,t,{isUserInteraction:!0})}))}return n}function HE(e){e.defaultPrevented||VE(e.currentTarget)}function UE(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=cE(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 WE(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function GE(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:ZE(e),b:ZE(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();rE(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:XE(YE(n.a)),b:XE(YE(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 KE=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function qE(e){let t=getComputedStyle(QE(e)??e).display;return t===`flex`||t===`inline-flex`}function JE(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||qE(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`||KE.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function YE(e){let t=e.length;for(;t--;){let n=e[t];if(rE(n,`Missing node`),JE(n))return n}return null}function XE(e){return e&&Number(getComputedStyle(e).zIndex)||0}function ZE(e){let t=[];for(;e;)t.push(e),e=QE(e);return t}function QE(e){let{parentNode:t}=e;return WE(t)?t.host:t}function $E(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 eD({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!sE(n)||n.contains(e)||e.contains(n))return!0;if(GE(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if($E(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function tD(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=fE(r),a=UE(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&eD({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function nD(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 rD(e,t,n=0){return Math.abs(eE(e)-eE(t))<=n}function iD(e,t){return rD(e,t)?0:e>t?1:-1}function aD({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(iD(r,c)<0)if(a){let e=(i+c)/2;r=iD(r,e)<0?i:c}else r=c;return r=Math.min(s,r),r=eE(r),r}function oD({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(rD(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;rE(u!=null,`Invalid first pivot index`),rE(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];rE(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(rE(n!=null,`Previous layout not found for panel index ${t}`),rD(n,i)){let t=o-n;iD(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];rE(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(rE(n!=null,`Previous layout not found for panel index ${t}`),rD(n,o)){let t=n-i;iD(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];rE(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&iD(i,c)<0)if(e>0){let t=c-o,n=t/2;iD(i+e,c)<0&&(e=iD(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;iD(i-e,c)<0&&(e=iD(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];rE(e!=null,`Previous layout not found for panel index ${r}`);let a=aD({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];rE(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=aD({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!rD(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(nD(c,l))return i;{let t=e<0?d:u,r=s[t];rE(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=aD({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!rD(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];rE(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=aD({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(rD(i,s)||(t-=s-i,l[r]=s),rD(t,0))break;e>0?r--:r++}}}if(!rD(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 sD(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||iD(e[n],t[n])!==0)return!1;return!0}function cD({layout:e,panelConstraints:t}){let n=Object.values(e),r=[...n];r.length!==t.length&&(e=xD(t),n=Object.values(e),r=[...n]);let i=r.reduce((e,t)=>e+t,0);if(!rD(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];rE(t!=null,`No layout data found for index ${e}`);let n=100/i*t;r[e]=n}let a=0;for(let e=0;e<t.length;e++){let i=n[e];rE(i!=null,`No layout data found for index ${e}`);let o=r[e];rE(o!=null,`No layout data found for index ${e}`);let s=aD({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!rD(a,0))for(let e=0;e<t.length;e++){let n=r[e];rE(n!=null,`No layout data found for index ${e}`);let i=n+a,o=aD({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,rD(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function lD({groupId:e,panelId:t}){let n=()=>{let t=RE();for(let[n,{defaultLayoutDeferred:r,derivedPanelConstraints:i,layout:a,groupSize:o,separatorToPanels:s}]of t)if(n.id===e)return{defaultLayoutDeferred:r,derivedPanelConstraints:i,group:n,groupSize:o,layout:a,separatorToPanels:s};throw Error(`Group ${e} not found`)},r=()=>{let e=n().derivedPanelConstraints.find(e=>e.panelId===t);if(e!==void 0)return e;throw Error(`Panel constraints not found for Panel ${t}`)},i=()=>{let e=n().group.panels.find(e=>e.id===t);if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},a=()=>{let e=n().layout[t];if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},o=({nextSize:e,panels:n,prevLayout:r,derivedPanelConstraints:i})=>{let o=a(),s=n.findIndex(e=>e.id===t),c=s===0,l=s===n.length-1;if(l&&e<o&&(c||n.slice(0,s).every((e,t)=>{let n=i[t];return n?.collapsible&&rD(n.collapsedSize,r[n.panelId])}))){let e=n.slice(0,s).reduce((e,t)=>e+r[t.id],0);return{...r,[t]:eE(100-e)}}return oD({delta:l?o-e:e-o,initialLayout:r,panelConstraints:i,pivotIndices:l?[s-1,s]:[s,s+1],prevLayout:r,trigger:`imperative-api`})},s=e=>{if(e===a())return;let{defaultLayoutDeferred:t,derivedPanelConstraints:r,group:i,groupSize:s,layout:c,separatorToPanels:l}=n(),u=cD({layout:o({nextSize:e,panels:i.panels,prevLayout:c,derivedPanelConstraints:r}),panelConstraints:r});sD(c,u)||BE(i,{defaultLayoutDeferred:t,derivedPanelConstraints:r,groupSize:s,layout:u,separatorToPanels:l})};return{collapse:()=>{let{collapsible:e,collapsedSize:t}=r(),{mutableValues:n}=i(),o=a();e&&o!==t&&(n.expandToSize=o,s(t))},expand:()=>{let{collapsible:e,collapsedSize:t,minSize:n}=r(),{mutableValues:o}=i(),c=a();if(e&&c===t){let e=o.expandToSize??n;e===0&&(e=1),s(e)}},getSize:()=>{let{group:e}=n(),t=a(),{element:r}=i();return{asPercentage:t,inPixels:e.orientation===`horizontal`?r.offsetWidth:r.offsetHeight}},isCollapsed:()=>{let{collapsible:e,collapsedSize:t}=r(),n=a();return e&&rD(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=tE({group:t});s(eE($T({groupSize:a,panelElement:r,styleProp:e})/a*100))}}}function uD(e){e.defaultPrevented||tD(e,RE()).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=lD({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function dD(e){let t=RE();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 fD({groupId:e}){let t=()=>{let t=RE();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=cD({layout:e,panelConstraints:r});return n?o:(sD(o,c)||BE(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function pD(e,t){let n=dD(e),r=LE(n.id,!0),i=n.separators.find(t=>t.element===e);rE(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);rE(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=fD({groupId:n.id}).getLayout(),c=cD({layout:oD({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});sD(s,c)||BE(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels},{isUserInteraction:!0})}function mD(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=dD(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&pD(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&pD(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&pD(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&pD(t,-5);break;case`End`:e.preventDefault(),pD(t,100);break;case`Enter`:{e.preventDefault();let n=dD(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=LE(n.id,!0),o=n.separators.find(e=>e.element===t);rE(o,`Matching separator not found`);let s=a.get(o);rE(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(rE(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];pD(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=dD(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);rE(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(),pD(t,-100);break}}function hD(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=RE(),n=tD(e,t),r=new Map,i=!1;n.forEach(e=>{e.separator&&(i||(i=!0,e.separator.element.focus({focusVisible:!1,preventScroll:!0})));let n=t.get(e.group);n&&r.set(e.group,n.layout)}),yE({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}function gD({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=oD({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(sD(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?SE:CE;break;case`vertical`:s|=d<0?wE:TE;break}}else BE(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&EE:c|=s&EE,t.movementY===0?c|=o&DE:c|=s&DE,vE(c),ME(e)}function _D(e){let t=RE(),n=gE();switch(n.state){case`active`:gD({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function vD(e){if(e.defaultPrevented)return;let t=gE(),n=RE();switch(t.state){case`active`:if(e.buttons===0){yE({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{let t=LE(e.group.id,!0);BE(e.group,t,{isUserInteraction:!0})});return}for(let n of t.hitRegions)if(n.separator){let{element:t}=n.separator;t.hasPointerCapture?.(e.pointerId)||t.setPointerCapture?.(e.pointerId)}gD({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=tD(e,n);r.length===0?t.state!==`inactive`&&yE({cursorFlags:0,state:`inactive`}):yE({cursorFlags:0,hitRegions:r,state:`hover`}),ME(e.currentTarget);break}}}function yD(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(gE().state){case`hover`:yE({cursorFlags:0,state:`inactive`})}}function bD(e){e.defaultPrevented||e.pointerType===`mouse`&&e.button>0||VE(e.currentTarget)&&e.preventDefault()}function xD(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=eE(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=eE((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function SD(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=tE({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:eE(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function CD(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 wD({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=eE(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]=eE((r[e]??0)/a*l);else{let e=eE(l/c.length);for(let t of c)u[t]=e}return u}function TD(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 ED=new Map;function DD(e){let t=!0;rE(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=tE({group:e});if(t===0)return;let n=LE(e.id);if(!n)return;let r=nE(e),i=n.defaultLayoutDeferred?xD(r):n.layout,a=cD({layout:wD({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&sD(n.layout,a)&&CD(n.derivedPanelConstraints,r)&&n.groupSize===t)return;BE(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else SD(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{rE(!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=tE({group:e}),s=nE(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(TD(e.panels,l)||(l=void 0));let u=cD({layout:e.mutableState.layouts[c]??l??xD(s),panelConstraints:s}),d=e.element.ownerDocument;ED.set(d,(ED.get(d)??0)+1);let f=new Map;return fE(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),BE(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{rE(!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`,mD)}),d.addEventListener(`contextmenu`,HE,!0),d.addEventListener(`dblclick`,uD,!0),d.addEventListener(`pointerdown`,hD,!0),d.addEventListener(`pointerleave`,_D),d.addEventListener(`pointermove`,vD),d.addEventListener(`pointerout`,yD),d.addEventListener(`pointerup`,bD,!0),function(){t=!1,ED.set(d,Math.max(0,(ED.get(d)??0)-1)),FE(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,mD)}),ED.get(d)||(d.removeEventListener(`contextmenu`,HE,!0),d.removeEventListener(`dblclick`,uD,!0),d.removeEventListener(`pointerdown`,hD,!0),d.removeEventListener(`pointerleave`,_D),d.removeEventListener(`pointermove`,vD),d.removeEventListener(`pointerout`,yD),d.removeEventListener(`pointerup`,bD,!0)),a.disconnect()}}function OD(){let[e,t]=(0,Q.useState)({});return[e,(0,Q.useCallback)(()=>t({}),[])]}function kD(e){let t=(0,Q.useId)();return`${e??t}`}var AD=typeof window<`u`?Q.useLayoutEffect:Q.useEffect;function jD(e){let t=(0,Q.useRef)(e);return AD(()=>{t.current=e},[e]),(0,Q.useCallback)((...e)=>t.current?.(...e),[t])}function MD(...e){return jD(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t;break}})})}function ND(e){let t=(0,Q.useRef)({...e});return AD(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var PD=(0,Q.createContext)(null);function FD(e,t){let n=(0,Q.useRef)({getLayout:()=>({}),setLayout:bE});(0,Q.useImperativeHandle)(t,()=>n.current,[]),AD(()=>{Object.assign(n.current,fD({groupId:e}))})}function ID({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=jD(e=>{sD(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=jD((e,t)=>{sD(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e,{isUserInteraction:t}))}),_=kD(s),v=(0,Q.useRef)(null),[y,b]=OD(),x=(0,Q.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),S=MD(v,a);FD(_,o);let C=jD((e,t)=>{let r=gE(),i=IE(e),a=LE(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=ND({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=iE(u,[...t.panels,e]),b(),()=>{t.panels=t.panels.filter(t=>t!==e),b()}},registerSeparator:e=>{let t=x.current;return t.separators=iE(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=IE(_),i=LE(_);r&&i&&BE(r,{...i,derivedPanelConstraints:nE(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 AD(()=>{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=DD(r),{defaultLayoutDeferred:o,derivedPanelConstraints:s,layout:c}=LE(r.id,!0);!o&&s.length>0&&(h(c),g(c,!1));let l=zE(_,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=rD(t.collapsedSize,i[t.panelId]),a=rD(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=gE().state!==`active`;h(i),o&&g(i,e.isUserInteraction)});return()=>{E.current=null,a(),l()}},[i,_,g,h,u,y,w]),(0,Q.useEffect)(()=>{let e=E.current;e&&(e.mutableState.defaultLayout=n,e.mutableState.disableCursor=!!r)}),(0,Z.jsx)(PD.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})})}ID.displayName=`Group`;function LD(){return(0,Q.useRef)(null)}function RD(){let e=(0,Q.useContext)(PD);return rE(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function zD(e,t){let{id:n}=RD(),r=(0,Q.useRef)({collapse:xE,expand:xE,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:xE});(0,Q.useImperativeHandle)(t,()=>r.current,[]),AD(()=>{Object.assign(r.current,lD({groupId:n,panelId:e}))})}function BD({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=kD(c),_=ND({disabled:a}),v=(0,Q.useRef)(null),y=MD(v,o),{getPanelStyles:b,id:x,orientation:S,registerPanel:C,updatePanelProps:w}=RD(),T=d!==null,E=jD((e,t,n)=>{d?.(e,c,n)});AD(()=>{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]),zD(g,f);let D=()=>{let e=b(x,g);if(e)return JSON.stringify(e)},O=(0,Q.useSyncExternalStore)(e=>zE(x,e),D,D),k;return k=O?JSON.parse(O):i===void 0?{flexGrow:1}:{flexGrow:void 0,flexShrink:void 0,flexBasis:i},(0,Z.jsx)(`div`,{...m,"data-disabled":a||void 0,"data-panel":!0,"data-testid":g,id:g,ref:y,style:{...VD,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})})}BD.displayName=`Panel`;var VD={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function HD(){return(0,Q.useRef)(null)}function UD({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=cD({layout:oD({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=cD({layout:oD({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function WD({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...s}){let c=kD(a),l=ND({disabled:n,disableDoubleClick:r}),[u,d]=(0,Q.useState)({}),[f,p]=(0,Q.useState)(`inactive`),[m,h]=(0,Q.useState)(!1),g=(0,Q.useRef)(null),_=MD(g,i),{disableCursor:v,id:y,orientation:b,registerSeparator:x,updateSeparatorProps:S}=RD(),C=b===`horizontal`?`vertical`:`horizontal`;AD(()=>{let e=g.current;if(e!==null){let t={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:e,id:c},n=x(t),r=_E(e=>{p(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=zE(y,e=>{let{derivedPanelConstraints:n,layout:r,separatorToPanels:i}=e.next,a=i.get(t);if(a){let e=a[0],t=a.indexOf(e);d(UD({layout:r,panelConstraints:n,panelId:e.id,panelIndex:t}))}});return()=>{r(),i(),n()}}},[y,c,x,l]),(0,Q.useEffect)(()=>{S(c,{disabled:n,disableDoubleClick:r})},[n,r,c,S]);let w;n&&!v&&(w=`not-allowed`);let T;if(n)T=`disabled`;else switch(f){case`active`:T=`active`;break;default:T=m?`focus`:f}return(0,Z.jsx)(`div`,{...s,"aria-controls":u.valueControls,"aria-disabled":n||void 0,"aria-orientation":C,"aria-valuemax":u.valueMax,"aria-valuemin":u.valueMin,"aria-valuenow":u.valueNow,children:e,className:t,"data-separator":T,"data-testid":c,id:c,onBlur:()=>h(!1),onFocus:()=>h(!0),ref:_,role:`separator`,style:{flexBasis:`auto`,cursor:w,...o,flexGrow:0,flexShrink:0,touchAction:`none`},tabIndex:n?void 0:0})}WD.displayName=`Separator`;function GD(e){let t=(0,$.c)(55),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}=xn(),[o,s]=(0,Q.useState)(`diagram`),l=Fh(i),u;t[4]===n?u=t[5]:(u={"data-mermaid-file-viewer-extension":n},t[4]=n,t[5]=u);let d=u;if(l.status===`loading`){let e;return t[6]!==d||t[7]!==r?(e=(0,Z.jsx)(Bh,{fileName:r,dataAttr:`data-mermaid-file-viewer`,extraAttrs:d}),t[6]=d,t[7]=r,t[8]=e):e=t[8],e}if(l.status===`error`){let e=l.message,a;t[9]!==n||t[10]!==l.httpStatus||t[11]!==r||t[12]!==i.assetPath?(a=Ph({assetPath:i.assetPath,fileName:r,extension:n,httpStatus:l.httpStatus}),t[9]=n,t[10]=l.httpStatus,t[11]=r,t[12]=i.assetPath,t[13]=a):a=t[13];let o;return t[14]!==d||t[15]!==l.message||t[16]!==r||t[17]!==a?(o=(0,Z.jsx)(Rh,{fileName:r,dataAttr:`data-mermaid-file-viewer`,extraAttrs:d,message:e,openFile:a}),t[14]=d,t[15]=l.message,t[16]=r,t[17]=a,t[18]=o):o=t[18],o}let f=l.content,p;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(p=e=>{e&&s(e)},t[19]=p):p=t[19];let m;t[20]===a?m=t[21]:(m=a({id:`72xhRD`}),t[20]=a,t[21]=m);let h;t[22]===a?h=t[23]:(h=a({id:`DEWDbv`}),t[22]=a,t[23]=h);let g;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(_r,{children:(0,Z.jsx)(c,{className:`size-4`})}),t[24]=g):g=t[24];let _;t[25]===h?_=t[26]:(_=(0,Z.jsx)(da,{value:`diagram`,"aria-label":h,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,asChild:!0,children:g}),t[25]=h,t[26]=_);let v;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(vr,{side:`bottom`,children:(0,Z.jsx)(Y,{id:`i-ShMB`})}),t[27]=v):v=t[27];let y;t[28]===_?y=t[29]:(y=(0,Z.jsxs)(br,{children:[_,v]}),t[28]=_,t[29]=y);let b;t[30]===a?b=t[31]:(b=a({id:`Y6SK9K`}),t[30]=a,t[31]=b);let x;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(_r,{children:(0,Z.jsx)(st,{className:`size-4`})}),t[32]=x):x=t[32];let S;t[33]===b?S=t[34]:(S=(0,Z.jsx)(da,{value:`source`,"aria-label":b,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,asChild:!0,children:x}),t[33]=b,t[34]=S);let C;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(vr,{side:`bottom`,children:(0,Z.jsx)(Y,{id:`wdxz7K`})}),t[35]=C):C=t[35];let w;t[36]===S?w=t[37]:(w=(0,Z.jsxs)(br,{children:[S,C]}),t[36]=S,t[37]=w);let T;t[38]!==o||t[39]!==w||t[40]!==m||t[41]!==y?(T=(0,Z.jsx)(`div`,{className:`flex shrink-0 items-center justify-center border-b bg-background py-2`,children:(0,Z.jsxs)(pa,{type:`single`,value:o,onValueChange:p,"aria-label":m,variant:`segmented`,size:`sm`,spacing:1,className:`shrink-0 bg-muted p-0.5 data-[size=sm]:rounded-[10px]`,children:[y,w]})}),t[38]=o,t[39]=w,t[40]=m,t[41]=y,t[42]=T):T=t[42];let E;t[43]!==n||t[44]!==r||t[45]!==o||t[46]!==i||t[47]!==f?(E=(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)(Pl,{chart:f,className:`min-h-0 flex-1`})}):(0,Z.jsx)(Ih,{...i,fileName:r,extension:n})}),t[43]=n,t[44]=r,t[45]=o,t[46]=i,t[47]=f,t[48]=E):E=t[48];let D;return t[49]!==d||t[50]!==r||t[51]!==o||t[52]!==T||t[53]!==E?(D=(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,...d,children:[T,E]}),t[49]=d,t[50]=r,t[51]=o,t[52]=T,t[53]=E,t[54]=D):D=t[54],D}function KD(e){return Eo(`/api/asset?path=${encodeURIComponent(e)}`)}function qD(e){return`/api/asset-text?path=${encodeURIComponent(e)}`}function JD(e){let t=(0,$.c)(8),{assetPath:n,mediaKind:r}=e,i;t[0]===n?i=t[1]:(i=(0,Z.jsx)(zh,{entry:{kind:`asset`,path:n},className:`shrink-0 border-b bg-background px-3 py-1.5`}),t[0]=n,t[1]=i);let a;t[2]!==n||t[3]!==r?(a=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(YD,{assetPath:n,mediaKind:r})}),t[2]=n,t[3]=r,t[4]=a):a=t[4];let o;return t[5]!==i||t[6]!==a?(o=(0,Z.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[i,a]}),t[5]=i,t[6]=a,t[7]=o):o=t[7],o}function YD(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=KD(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)(L,{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=qD(n),t[19]=n,t[20]=e),p=(0,Z.jsx)(Ih,{src:e,assetPath:n,fileName:l,extension:f.toLowerCase()},n);break bb0}if(u===`mermaid`){let e;t[21]===n?e=t[22]:(e=qD(n),t[21]=n,t[22]=e),p=(0,Z.jsx)(GD,{src:e,assetPath:n,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)(Pe,{src:s,alt:l,draggable:!1,targetExistence:`exists`,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)(X,{variant:`default`,size:`sm`,onClick:()=>a(!0),"data-testid":`asset-preview-open-as-text`,className:`font-mono uppercase`,children:(0,Z.jsx)(Y,{id:`qFWMl-`})}),(0,Z.jsx)(X,{variant:`outline`,size:`sm`,className:`font-mono uppercase`,onClick:()=>{nh({url:s,projectRelPath:n,ext:f.toLowerCase(),title:l,forceOsDelegation:!1})},children:(0,Z.jsx)(Y,{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 XD(){let e=(0,$.c)(5),{_:t}=xn(),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)(Ch,{className:`h-9 w-2/5 mt-6 mb-5`}),(0,Z.jsx)(Ch,{className:`h-4 w-full`}),(0,Z.jsx)(Ch,{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 ZD(e){let{_:t}=xn();return e===`existing-repo`?[{id:`draft-spec`,icon:yy,label:t({id:`LdKIHS`}),prompt:t({id:`N_7kkF`})},{id:`organize-specs`,icon:Py,label:t({id:`cuA8QW`}),prompt:t({id:`mPy9lS`})},{id:`document-architecture`,icon:Ry,label:t({id:`6eniID`}),prompt:t({id:`uDlyqd`})}]:[{id:`competitor-research`,icon:ob,label:t({id:`GUqTzn`}),prompt:t({id:`KOZud0`})},{id:`eng-specs`,icon:yy,label:t({id:`Qvls7J`}),prompt:t({id:`6qMe0o`})},{id:`bird-wiki`,icon:iy,label:t({id:`FqTpiN`}),prompt:t({id:`jtg_8-`})}]}function QD(e){let t=(0,$.c)(13),{scenario:n,className:r}=e,{_:i}=xn(),a=ZD(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){tr(t).then(()=>{s(e),clearTimeout(c.current),c.current=setTimeout(()=>s(null),1600)}).catch($D)};t[8]===r?d=t[9]:(d=Qn(`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)(X,{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:Qn(`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)(Yl,{className:`size-3.5`,"aria-hidden":`true`}):(0,Z.jsx)(fe,{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 $D(){}function eO(e,t,n){return e.trim().length>0||t.length>0||n}new Set(hi.map(e=>e.id));function tO(e,t){jc(e,t)}function nO(e){let t=(0,$.c)(32),{scenario:n,className:r}=e,{_:i}=xn(),{states:a,refresh:o}=nr(),s=di(),{dispatch:c}=gl(),l=xl(),u=fr(),[d,f]=(0,Q.useState)(iO),p=fi(),m=pi(),h;t[0]===s?h=t[1]:(h=e=>gi(s,e.source,e.id,!0,e.supported),t[0]=s,t[1]=h);let g=m.filter(h),_=mi(g,p),v;t[2]===u?.installedClis?v=t[3]:(v=u?.installedClis??{},t[2]=u?.installedClis,t[3]=v);let y=Cc({sticky:d,effectiveThreadAgent:_,enabledClis:u===null?[]:Hc(s,u.installedClis),enabledDesktopTargets:Tc(s,a),unresolvedDesktopTargets:hc(s,a),installedClis:v,terminalAvailable:u!==null,threadsAvailable:!0,desktopSelectable:!0}),b=y.kind===`thread`,x=y.kind===`cli`?y.cli:null,S=y.kind===`desktop`?y.target:null,C=x!==null,w=(0,Q.useRef)(null),[T]=(0,Q.useState)(rO),[E,D]=(0,Q.useState)(!0),[O,k]=(0,Q.useState)(!1),A;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(e){D(e),e||k(!1)},t[4]=A):A=t[4];let j=A,M=ZD(n),N;t[5]!==s||t[6]!==a?(N=e=>xi(s,e.id,a[e.id]?.installed),t[5]=s,t[6]=a,t[7]=N):N=t[7];let P=hi.filter(N),F=hi.every(e=>a[e.id]?.installed!=null),I=u!==null&&Hc(s,u.installedClis).length>0,L=F&&P.length===0&&g.length===0&&!I,R;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(R=function(e){f(e),jc(e),tO(e)},t[8]=R):R=t[8];let z=R,B;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(B=function(e){f(mc(e)),jc(mc(e))},t[9]=B):B=t[9];let V=B,H;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(H=function(e){ui(e),f(_c),jc(_c)},t[10]=H):H=t[10];let U=H,ee=function(){let{instruction:e,mentions:t}=w.current?.getContent()??{instruction:``,mentions:[]};if(!eO(e,t,!1)){k(!0);return}let r=rl({workspace:l,description:e,scenario:n,mentions:t});r!==null&&(Jc(r,_===null?void 0:{agent:{source:_.source,id:_.id}}),w.current?.clear(),Xi())},W=function(){if(u===null||x===null)return;let{instruction:e,mentions:t}=w.current?.getContent()??{instruction:``,mentions:[]};if(!eO(e,t,!1)){k(!0);return}let r=rl({workspace:l,description:e,scenario:n,mentions:t});r!==null&&(u.launchInTerminal(r,x),w.current?.clear(),Xi())},te=function(e){let{instruction:t,mentions:r}=w.current?.getContent()??{instruction:``,mentions:[]};if(!eO(t,r,!1)){k(!0);return}if(tO(e),a[e]?.installed!==!0){let t=hi.find(t=>t.id===e);t&&Xc(t);return}let i=rl({workspace:l,description:t,scenario:n,mentions:r});i!==null&&(c(e,i),w.current?.clear(),Xi())},G=function(){b?ee():C?W():S!==null&&te(S)},K=function(e){w.current?.setText(e),w.current?.focus()};if(L){let e;t[11]===r?e=t[12]:(e=Qn(`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[11]=r,t[12]=e);let n;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(re,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`}),t[13]=n):n=t[13];let i;t[14]===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)(Y,{id:`XT-L4j`})})]}),t[14]=i):i=t[14];let a;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsxs)(X,{type:`button`,variant:`outline`,size:`sm`,onClick:Xs,className:`gap-1.5`,"data-testid":`create-configure-agents`,children:[(0,Z.jsx)(Yn,{"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(Y,{id:`jRAGrQ`})]}),t[15]=a):a=t[15];let o;return t[16]===e?o=t[17]:(o=(0,Z.jsxs)(`div`,{className:e,"data-testid":`create-no-agents`,children:[i,a]}),t[16]=e,t[17]=o),o}let q=u?Hc(s,u.installedClis):[],ne=P.length>0,J=q.length>0,ie=g.length>0,ae=y.kind!==`none`,oe;t[18]===r?oe=t[19]:(oe=Qn(`flex w-full flex-col gap-3`,r),t[18]=r,t[19]=oe);let se;t[20]!==i||t[21]!==n?(se=i(n===`skill`?{id:`Dut9Ht`}:{id:`7hctf2`}),t[20]=i,t[21]=n,t[22]=se):se=t[22];let ce;t[23]!==i||t[24]!==n?(ce=i(n===`skill`?{id:`eNhWUl`}:{id:`0jD-Gn`}),t[23]=i,t[24]=n,t[25]=ce):ce=t[25];let le;t[26]!==E||t[27]!==O?(le=O&&E?(0,Z.jsx)(`p`,{role:`alert`,className:`text-1sm text-destructive`,"data-testid":`create-input-required`,children:(0,Z.jsx)(Y,{id:`1FLarN`})}):(0,Z.jsx)(`span`,{}),t[26]=E,t[27]=O,t[28]=le):le=t[28];let ue=ae?(0,Z.jsxs)(Zi,{children:[(0,Z.jsx)(X,{type:`button`,onClick:()=>b?ee():C?W():S===null?void 0:te(S),variant:`outline`,className:`gap-1.5`,"data-testid":`create-with-agent`,children:b&&_!==null?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ll,{agentId:_.id,iconUrl:_.iconUrl,className:`size-3.5`}),(0,Z.jsx)(tl,{agentName:_.name})]}):C&&x!==null?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ai,{id:Di(x),"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(Y,{id:`ti6aF_`,values:{0:Ao[x].displayName}})]}):S===null?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ai,{id:S,"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(ul,{displayName:_l(S)}),(0,Z.jsx)(Fl,{"aria-hidden":`true`,className:`size-3.5`})]})}),(0,Z.jsxs)(Wi,{onOpenChange:e=>{e&&o()},children:[(0,Z.jsx)(Ri,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,"aria-label":i({id:`nskygk`}),size:`icon`,variant:`outline`,"data-testid":`create-with-agent-menu`,children:(0,Z.jsx)(Zl,{"aria-hidden":`true`,className:`size-3.5`})})}),(0,Z.jsxs)(Hi,{align:`end`,className:`max-h-80 min-w-[200px]`,children:[ie?(0,Z.jsxs)(Ii,{"aria-label":i({id:`vPKX2i`}),children:[(0,Z.jsxs)(Bi,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(Y,{id:`RXEbZy`}),(0,Z.jsx)(Ci,{})]}),g.map(e=>(0,Z.jsxs)(Mi,{onSelect:()=>U(e),"data-testid":`create-agent-option-thread-${e.source}:${e.id}`,children:[(0,Z.jsx)(Ll,{agentId:e.id,iconUrl:e.iconUrl,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1 truncate`,children:e.name}),b&&_!==null&&_.source===e.source&&_.id===e.id?(0,Z.jsx)(Yl,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},`${e.source}:${e.id}`))]}):null,ie&&(J||ne)?(0,Z.jsx)(Gi,{}):null,J?(0,Z.jsxs)(Ii,{"aria-label":i({id:`ALhMYW`}),children:[(0,Z.jsx)(Bi,{children:(0,Z.jsx)(Y,{id:`ALhMYW`})}),q.map(e=>{let{displayName:t}=Ao[e];return(0,Z.jsxs)(Mi,{onSelect:()=>V(e),"data-testid":`create-with-cli-${e}`,"aria-label":i({id:`QYfQdv`,values:{displayName:t}}),children:[(0,Z.jsx)(Ai,{id:Di(e),"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:t}),x===e?(0,Z.jsx)(Yl,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e)})]}):null,ne?(0,Z.jsxs)(Z.Fragment,{children:[J?(0,Z.jsx)(Gi,{}):null,(0,Z.jsxs)(Ii,{"aria-label":i({id:`BwKH4d`}),children:[(0,Z.jsxs)(Bi,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(Y,{id:`BwKH4d`}),(0,Z.jsx)(Fl,{"aria-hidden":`true`,className:`size-3`})]}),P.map(e=>(0,Z.jsxs)(Mi,{onSelect:()=>z(e.id),"data-testid":`create-agent-option-${e.id}`,children:[(0,Z.jsx)(Ai,{id:e.id,"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(nl,{displayName:e.displayName})}),!C&&e.id===S?(0,Z.jsx)(Yl,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.id))]})]}):null,(0,Z.jsx)(Gi,{}),(0,Z.jsxs)(Mi,{onSelect:Xs,"data-testid":`create-agent-option-settings`,children:[(0,Z.jsx)(Yn,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(Y,{id:`jRAGrQ`})})]})]})]})]}):(0,Z.jsx)(X,{type:`button`,variant:`outline`,disabled:!0,className:`gap-1.5`,"data-testid":`create-with-agent`,children:(0,Z.jsx)(Y,{id:`hYgDIe`})}),de;return t[29]!==le||t[30]!==ue?(de=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 px-3 pb-3`,children:[le,ue]}),t[29]=le,t[30]=ue,t[31]=de):de=t[31],(0,Z.jsxs)(`div`,{className:oe,children:[(0,Z.jsxs)(`div`,{onMouseDown:e=>ta(e,w),className:`flex w-full cursor-text flex-col rounded-2xl border border-border/60 bg-card shadow-sm transition-colors focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50`,children:[(0,Z.jsx)(ea,{ref:w,ariaLabel:se,placeholder:ce,onEmptyChange:j,onContentChange:oa,onSubmit:G,initialDoc:T,className:`max-h-96 overflow-y-auto px-4 py-3 text-sm leading-relaxed subtle-scrollbar [&_.ProseMirror]:min-h-16`}),de]}),n===`new-project`&&M.length>0?(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-1sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`I5685_`})}),M.map(e=>{let t=e.icon;return(0,Z.jsxs)(X,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>K(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 rO(){return aa().doc??void 0}function iO(){return gc()}function aO(e){let t=(0,$.c)(18),{title:n,subtitle:r,celebrateSignal:i,onRageStreak:a}=e,o=(0,Q.useRef)(0),s=(0,Q.useRef)(null),c;t[0]===a?c=t[1]:(c=function(){let e=typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now(),t=s.current,n=t===null?1/0:e-t;s.current=e;let r=Tv(o.current,n);o.current=r,!(r<6)&&(o.current=0,a?.())},t[0]=a,t[1]=c);let l=a?c:void 0,u;t[2]===a?u=t[3]:(u=a?{viewTransitionName:w_}:void 0,t[2]=a,t[3]=u);let d;t[4]!==i||t[5]!==l||t[6]!==u?(d=(0,Z.jsx)(ur,{size:64,celebrateSignal:i,onRage:l,style:u}),t[4]=i,t[5]=l,t[6]=u,t[7]=d):d=t[7];let f;t[8]===n?f=t[9]:(f=(0,Z.jsx)(`h2`,{className:`text-2xl font-light tracking-tighter text-balance`,children:n}),t[8]=n,t[9]=f);let p;t[10]===r?p=t[11]:(p=r?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r}):null,t[10]=r,t[11]=p);let m;t[12]!==f||t[13]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[f,p]}),t[12]=f,t[13]=p,t[14]=m):m=t[14];let h;return t[15]!==d||t[16]!==m?(h=(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:[d,m]}),t[15]=d,t[16]=m,t[17]=h):h=t[17],h}function oO({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 sO=`open-knowledge:create-top-level-file`;function cO(e={}){window.dispatchEvent(new CustomEvent(sO,{detail:e}))}function lO(e){let t=t=>{let n=t.detail;e(n??{})};return window.addEventListener(sO,t),()=>window.removeEventListener(sO,t)}function uO(e){let t=(0,$.c)(29),{celebrateSignal:n,onAddStarterPack:r,onRageStreak:i}=e,{_:a}=xn(),o=u(),{title:s,subtitle:c}=oO({isOnboarding:!1,isEmbedded:o}),l=cd(),d;t[0]!==l.data||t[1]!==l.status?(d=l.status===`ready`?l.data:[],t[0]=l.data,t[1]=l.status,t[2]=d):d=t[2];let f=d,p=l.status===`loading`||l.status===`idle`,m=l.status===`error`,h=aO,g=a(s),_=a(c),v;t[3]!==h||t[4]!==n||t[5]!==i||t[6]!==g||t[7]!==_?(v=(0,Z.jsx)(h,{title:g,subtitle:_,celebrateSignal:n,onRageStreak:i}),t[3]=h,t[4]=n,t[5]=i,t[6]=g,t[7]=_,t[8]=v):v=t[8];let y;t[9]===o?y=t[10]:(y=o?(0,Z.jsx)(QD,{scenario:`existing-repo`}):(0,Z.jsx)(nO,{scenario:`existing-repo`}),t[9]=o,t[10]=y);let b;t[11]!==f||t[12]!==m||t[13]!==p?(b=p||m||f.length>0?(0,Z.jsx)(pO,{templates:f,loading:p,error:m,onSelect:fO}):null,t[11]=f,t[12]=m,t[13]=p,t[14]=b):b=t[14];let x,S;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(Kn,{"aria-hidden":`true`,className:`size-3`}),S=(0,Z.jsx)(Y,{id:`IajAbS`}),t[15]=x,t[16]=S):(x=t[15],S=t[16]);let C;t[17]===r?C=t[18]:(C=(0,Z.jsxs)(X,{onClick:r,variant:`link-muted`,size:`xs`,className:`font-mono text-xs uppercase tracking-wider`,children:[x,S]}),t[17]=r,t[18]=C);let w;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(X,{variant:`link-muted`,className:`justify-end`,size:`sm`,onClick:dO,children:(0,Z.jsx)(Y,{id:`L4Cdd9`,components:{0:(0,Z.jsx)(Nl,{"aria-hidden":`true`,className:`size-3`})}})}),t[19]=w):w=t[19];let T;t[20]===C?T=t[21]:(T=(0,Z.jsxs)(`div`,{className:`-mt-6 flex w-full items-center justify-between gap-4`,children:[C,w]}),t[20]=C,t[21]=T);let E;t[22]!==T||t[23]!==b?(E=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-8`,children:[b,T]}),t[22]=T,t[23]=b,t[24]=E):E=t[24];let D;return t[25]!==E||t[26]!==v||t[27]!==y?(D=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-8 py-12 max-w-5xl my-auto`,children:[v,y,E]}),t[25]=E,t[26]=v,t[27]=y,t[28]=D):D=t[28],D}function dO(){return cO({initialDir:``})}function fO(e,t){return cO({template:{folder:e,name:t}})}function pO(e){let t=(0,$.c)(25),{templates:n,loading:r,error:i,onSelect:a}=e,{_:o}=xn(),s;t[0]===o?s=t[1]:(s=o({id:`_8quCH`}),t[0]=o,t[1]=s);let c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(Y,{id:`_8quCH`})}),t[2]=c):c=t[2];let l;t[3]!==o||t[4]!==i||t[5]!==r||t[6]!==n?(l=r||i?null:(0,Z.jsx)(wm,{className:`text-2xs`,variant:`gray`,"aria-label":o({id:`X7u0xR`,values:{0:n.length}}),children:n.length}),t[3]=o,t[4]=i,t[5]=r,t[6]=n,t[7]=l):l=t[7];let u;t[8]===l?u=t[9]:(u=(0,Z.jsxs)(`header`,{className:`flex items-center gap-2 font-mono text-2xs uppercase tracking-wider text-muted-foreground`,children:[c,l]}),t[8]=l,t[9]=u);let d;t[10]===o?d=t[11]:(d=o({id:`irFGwu`}),t[10]=o,t[11]=d);let f;t[12]!==i||t[13]!==r||t[14]!==a||t[15]!==n?(f=r?(0,Z.jsx)(`p`,{className:`p-4 text-1sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`Hl89Qd`})}):i?(0,Z.jsx)(`p`,{role:`alert`,className:`p-4 text-1sm text-destructive`,children:(0,Z.jsx)(Y,{id:`54Y6Fg`})}):n.map(e=>(0,Z.jsx)(mO,{template:e,targetLabel:e.source_folder===``?`/`:`${e.source_folder}/`,onClick:()=>a(e.source_folder,e.name)},`${e.source_folder}/${e.name}`)),t[12]=i,t[13]=r,t[14]=a,t[15]=n,t[16]=f):f=t[16];let p;t[17]!==r||t[18]!==d||t[19]!==f?(p=(0,Z.jsx)(`div`,{className:`w-full overflow-hidden rounded-xl border border-border/60 bg-card`,children:(0,Z.jsx)(`section`,{"aria-busy":r,"aria-label":d,tabIndex:0,className:`subtle-scrollbar scroll-fade-mask flex max-h-[260px] w-full flex-col overflow-y-auto overscroll-contain focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50`,children:f})}),t[17]=r,t[18]=d,t[19]=f,t[20]=p):p=t[20];let m;return t[21]!==s||t[22]!==u||t[23]!==p?(m=(0,Z.jsxs)(`section`,{"aria-label":s,className:`flex w-full flex-col gap-3`,children:[u,p]}),t[21]=s,t[22]=u,t[23]=p,t[24]=m):m=t[24],m}function mO(e){let t=(0,$.c)(24),{template:n,targetLabel:r,onClick:i}=e,{_:a}=xn(),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)(X,{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 hO(e){let t=(0,$.c)(27),{terminalOpen:n,agentsOpen:r,onRageStreak:i}=e,a=n===void 0?!1:n,o=r===void 0?!1:r,[s,c]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)(void 0),[d,f]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(0),h=(0,Q.useRef)(!1),g=(0,Q.useRef)(void 0),_,v;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(_=()=>{let e=!1,t=async function(){try{let{ok:t,body:n}=await bm();if(e)return;let r=t?Qa.safeParse(n):null;r?.success?(f(vO(r.data.documents)),h.current=!0):h.current||=(f(1),!0)}catch{!e&&!h.current&&(f(1),h.current=!0)}};t();let n=ac(e=>{e.includes(`files`)&&t()});return()=>{e=!0,n(),clearTimeout(g.current)}},v=[],t[0]=_,t[1]=v):(_=t[0],v=t[1]),(0,Q.useEffect)(_,v);let y;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(y=function(){clearTimeout(g.current),g.current=setTimeout(()=>m(_O),500),bm().then(e=>{let{ok:t,body:n}=e;if(!t)return;let r=Qa.safeParse(n);r.success&&f(vO(r.data.documents))}).catch(gO)},t[2]=y):y=t[2];let b=y,x=d!==null,S=d===0,C;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(C=function(e){c(e),e||u(void 0)},t[3]=C):C=t[3];let w=C;if(a||o){let e=a?`justify-end`:`justify-center`,n;t[4]===e?n=t[5]:(n=Qn(`@container/emptystate flex min-h-0 flex-1 flex-col items-center pb-8 pt-10`,e),t[4]=e,t[5]=n);let r;t[6]!==p||t[7]!==S||t[8]!==x||t[9]!==i?(r=x?(0,Z.jsx)(yO,{isOnboarding:S,celebrateSignal:p,onRageStreak:i}):null,t[6]=p,t[7]=S,t[8]=x,t[9]=i,t[10]=r):r=t[10];let o;t[11]===r?o=t[12]:(o=(0,Z.jsx)(`div`,{className:`flex w-full flex-col items-center px-4 @md/emptystate:px-10 @2xl/emptystate:px-16`,children:r}),t[11]=r,t[12]=o);let s;return t[13]!==o||t[14]!==n?(s=(0,Z.jsx)(`div`,{className:n,children:o}),t[13]=o,t[14]=n,t[15]=s):s=t[15],s}let T;t[16]!==p||t[17]!==S||t[18]!==x||t[19]!==i?(T=x?S?(0,Z.jsx)(bO,{onRageStreak:i,celebrateSignal:p,onPackSelect:e=>{u(e),c(!0)}}):(0,Z.jsx)(uO,{onRageStreak:i,celebrateSignal:p,onAddStarterPack:()=>{c(!0)}}):null,t[16]=p,t[17]=S,t[18]=x,t[19]=i,t[20]=T):T=t[20];let E;t[21]!==l||t[22]!==s?(E=(0,Z.jsx)(zS,{open:s,onOpenChange:w,onSeedApplied:b,initialPackId:l}),t[21]=l,t[22]=s,t[23]=E):E=t[23];let D;return t[24]!==T||t[25]!==E?(D=(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:[T,E]})}),t[24]=T,t[25]=E,t[26]=D):D=t[26],D}function gO(){}function _O(e){return e+1}function vO(e){return Gp(e).filter(e=>e.kind===`document`||e.kind===`folder`).length}function yO(e){let t=(0,$.c)(16),{isOnboarding:n,celebrateSignal:r,onRageStreak:i}=e,{_:a}=xn(),o=u(),s,c,l,d;if(t[0]!==a||t[1]!==o||t[2]!==n){let{title:e,subtitle:r}=oO({isOnboarding:n,isEmbedded:o});d=`w-full max-w-5xl`,s=aO,c=a(e),l=a(r),t[0]=a,t[1]=o,t[2]=n,t[3]=s,t[4]=c,t[5]=l,t[6]=d}else s=t[3],c=t[4],l=t[5],d=t[6];let f;t[7]!==s||t[8]!==r||t[9]!==i||t[10]!==c||t[11]!==l?(f=(0,Z.jsx)(s,{title:c,subtitle:l,celebrateSignal:r,onRageStreak:i}),t[7]=s,t[8]=r,t[9]=i,t[10]=c,t[11]=l,t[12]=f):f=t[12];let p;return t[13]!==d||t[14]!==f?(p=(0,Z.jsx)(`div`,{className:d,children:f}),t[13]=d,t[14]=f,t[15]=p):p=t[15],p}function bO(e){let t=(0,$.c)(30),{celebrateSignal:n,onPackSelect:r,onRageStreak:i}=e,{_:a}=xn(),o=u(),s,c,l,d;if(t[0]!==a||t[1]!==o){let{title:e,subtitle:n}=oO({isOnboarding:!0,isEmbedded:o});d=`flex w-full flex-col gap-10 py-12 max-w-5xl my-auto`,s=aO,c=a(e),l=a(n),t[0]=a,t[1]=o,t[2]=s,t[3]=c,t[4]=l,t[5]=d}else s=t[2],c=t[3],l=t[4],d=t[5];let f;t[6]!==s||t[7]!==n||t[8]!==i||t[9]!==c||t[10]!==l?(f=(0,Z.jsx)(s,{title:c,subtitle:l,celebrateSignal:n,onRageStreak:i}),t[6]=s,t[7]=n,t[8]=i,t[9]=c,t[10]=l,t[11]=f):f=t[11];let p;t[12]===o?p=t[13]:(p=o?(0,Z.jsx)(QD,{scenario:`new-project`}):(0,Z.jsx)(nO,{scenario:`new-project`}),t[12]=o,t[13]=p);let m;t[14]!==a||t[15]!==o?(m=a(o?{id:`GubkSu`}:{id:`xeXS4P`}),t[14]=a,t[15]=o,t[16]=m):m=t[16];let h;t[17]===m?h=t[18]:(h=(0,Z.jsx)(SO,{label:m}),t[17]=m,t[18]=h);let g;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(g=[`okf`,`entity-vault`],t[19]=g):g=t[19];let _;t[20]===r?_=t[21]:(_=(0,Z.jsx)(qb,{onPackSelect:r,onCreateBlankFile:xO,collapsedPackIds:g}),t[20]=r,t[21]=_);let v;t[22]!==h||t[23]!==_?(v=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-3`,children:[h,_]}),t[22]=h,t[23]=_,t[24]=v):v=t[24];let y;return t[25]!==v||t[26]!==d||t[27]!==f||t[28]!==p?(y=(0,Z.jsxs)(`div`,{className:d,children:[f,p,v]}),t[25]=v,t[26]=d,t[27]=f,t[28]=p,t[29]=y):y=t[29],y}function xO(){return cO()}function SO(e){let t=(0,$.c)(13),{label:n}=e,{_:r}=xn(),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)(sf,{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)(_r,{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)(vr,{className:`max-w-xs`,children:(0,Z.jsx)(`p`,{className:`leading-relaxed wrap-break-word`,children:(0,Z.jsx)(Y,{id:`k4CuuV`})})}),t[7]=c):c=t[7];let l;t[8]===s?l=t[9]:(l=(0,Z.jsxs)(br,{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 CO(e){return e===``?`.ok/frontmatter.yml`:`${e}/.ok/frontmatter.yml`}function wO(e){let t=(0,$.c)(70),{folderPath:n,state:r,onChange:i}=e,{_:a}=xn(),[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)(EO,{}),(0,Z.jsx)(Ch,{className:`h-7 w-full`}),(0,Z.jsx)(Ch,{className:`h-7 w-full`}),(0,Z.jsx)(Ch,{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)(Y,{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=CO(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 tf(n,{[e]:t});if(!r.ok){let{error:e}=r;Us.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 tf(n,{[e]:null});if(!t.ok){let{error:e}=t;Us.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,Bl(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):zl[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(vo(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 tf(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 tf(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 ee=`size-3 shrink-0 motion-safe:transition-transform motion-safe:duration-150 motion-safe:ease-[cubic-bezier(0.23,1,0.32,1)] ${o?``:`rotate-90`}`,W;t[40]===ee?W=t[41]:(W=(0,Z.jsx)(Ql,{className:ee,"aria-hidden":!0}),t[40]=ee,t[41]=W);let te;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,Z.jsx)(Y,{id:`vQIVHc`}),t[42]=te):te=t[42];let G;t[43]===W?G=t[44]:(G=(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:[W,te]}),t[43]=W,t[44]=G);let K;t[45]===h?K=t[46]:(K=(0,Z.jsx)(`code`,{className:`text-xs text-muted-foreground font-mono cursor-text select-text break-all`,onClick:TO,children:h}),t[45]=h,t[46]=K);let q;t[47]!==G||t[48]!==K?(q=(0,Z.jsxs)(Sr,{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:[G,K]}),t[47]=G,t[48]=K,t[49]=q):q=t[49];let ne;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Z.jsx)(`p`,{className:`px-1 pb-2 text-sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`hSBIG-`})}),t[50]=ne):ne=t[50];let re;t[51]!==c||t[52]!==y||t[53]!==z||t[54]!==_||t[55]!==p||t[56]!==x||t[57]!==u||t[58]!==C?(re=_.length===0&&!c?(0,Z.jsx)(`p`,{className:`px-1 py-1 text-sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`4c_a6S`})}):_.map(e=>{let t=p[e];return(0,Z.jsx)(Hd,{keyName:e,value:t,declared:Vl(t,Oa(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]=re):re=t[59];let J;t[60]!==c||t[61]!==N?(J=c?(0,Z.jsx)(Wd,{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)(X,{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)(Kn,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(Y,{id:`G8t9NN`})})]})}),t[60]=c,t[61]=N,t[62]=J):J=t[62];let ie;t[63]!==re||t[64]!==J?(ie=(0,Z.jsx)(xr,{children:(0,Z.jsxs)(`div`,{className:`px-2 py-2`,children:[ne,re,J]})}),t[63]=re,t[64]=J,t[65]=ie):ie=t[65];let ae;return t[66]!==H||t[67]!==q||t[68]!==ie?(ae=(0,Z.jsx)(`section`,{className:`rounded-lg border bg-card`,children:(0,Z.jsxs)(Cr,{open:H,onOpenChange:U,children:[q,ie]})}),t[66]=H,t[67]=q,t[68]=ie,t[69]=ae):ae=t[69],ae}function TO(e){return e.stopPropagation()}function EO(){let e=(0,$.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(wy,{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)(Y,{id:`vQIVHc`})})]}),e[1]=n):n=e[1],n}function DO(e){let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);return t<60?ic._({id:`xOTzt5`}):t<3600?ic._({id:`zbymaY`,values:{0:Math.floor(t/60)}}):t<86400?ic._({id:`optX0N`,values:{0:Math.floor(t/3600)}}):t<86400*7?ic._({id:`l1l8sj`,values:{0:Math.floor(t/86400)}}):new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function OO(e){return(e.split(`/`).pop()??e).replace(/\.md$/,``)}function kO(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:er,label:ic._({id:`QR5SP1`}),detail:OO(i)};case`template-edit`:return{Icon:_n,label:ic._({id:`-LHLx7`}),detail:OO(i)};case`template-delete`:return{Icon:Hf,label:ic._({id:`_gkGSK`}),detail:OO(i)};case`template-rename`:case`template-move`:{let[e,t]=i.split(` -> `);return{Icon:sl,label:ic._({id:`KPW5WC`}),detail:`${OO(e??``)} → ${OO(t??i)}`}}case`folder-frontmatter-edit`:return{Icon:wy,label:ic._({id:`_tekeB`}),detail:``};case`folder-frontmatter-delete`:return{Icon:wy,label:ic._({id:`ZWxfrc`}),detail:``};case`folder-create`:return{Icon:wy,label:ic._({id:`ZQLDTl`}),detail:``};default:return{Icon:Wc,label:r.replace(/-/g,` `),detail:OO(i)}}}function AO(e){return e.contributors.length>0?e.contributors[0].name:e.author===`openknowledge-service`||e.author===`server`?ic._({id:`B2DrPb`}):e.author||ic._({id:`Ef7StM`})}function jO(e){let t=(0,$.c)(15),{folderPath:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=[],t[0]=r):r=t[0];let[i,a]=(0,Q.useState)(r),[o,s]=(0,Q.useState)(!0),[c,l]=(0,Q.useState)(!1),u,d;if(t[1]===n?(u=t[2],d=t[3]):(u=()=>{let e=!1,t=async function(){try{let t=await fetch(`/api/history?folder=${encodeURIComponent(n)}&limit=50`);if(e)return;if(!t.ok){l(!0),s(!1);return}let r=await t.json();if(e)return;a(r.entries??[]),l(!1),s(!1)}catch(t){e||(console.warn(`[FolderTimelineCard] failed to load folder timeline:`,t),l(!0),s(!1))}};s(!0),t();let r=pc(t);return()=>{e=!0,r()}},d=[n],t[1]=n,t[2]=u,t[3]=d),(0,Q.useEffect)(u,d),c||!o&&i.length===0)return null;let f;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`XJOV1Y`})}),t[4]=f):f=t[4];let p;t[5]===i.length?p=t[6]:(p=i.length>0?(0,Z.jsx)(wm,{className:`text-xs`,variant:`secondary`,children:i.length}):null,t[5]=i.length,t[6]=p);let m;t[7]===p?m=t[8]:(m=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border px-3 py-1`,children:[f,p]}),t[7]=p,t[8]=m);let h;t[9]!==i||t[10]!==o?(h=(0,Z.jsx)(`div`,{className:`px-3 py-2.5`,children:o?(0,Z.jsxs)(`div`,{className:`space-y-2`,role:`status`,"aria-busy":`true`,children:[(0,Z.jsx)(Ch,{className:`h-8 w-full`}),(0,Z.jsx)(Ch,{className:`h-8 w-full`})]}):(0,Z.jsx)(`ul`,{className:`space-y-1`,children:i.map(MO)})}),t[9]=i,t[10]=o,t[11]=h):h=t[11];let g;return t[12]!==m||t[13]!==h?(g=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card`,"data-testid":`folder-timeline-card`,children:[m,h]}),t[12]=m,t[13]=h,t[14]=g):g=t[14],g}function MO(e){let{Icon:t,label:n,detail:r}=kO(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)(gb,{className:`size-3`,"aria-hidden":!0}),AO(e)]}),(0,Z.jsx)(`time`,{className:`shrink-0 text-xs text-muted-foreground/80`,dateTime:e.timestamp,title:new Date(e.timestamp).toLocaleString(),children:DO(e.timestamp)})]},e.sha)}function NO(e){let t=e.split(`/`).pop();return t?`${e}/${t}`:null}function PO(e,t){let n=t.get(`${e}/index`);if(n)return n;let r=NO(e);if(r){let e=t.get(r);if(e)return e}return e.split(`/`).pop()??e}function FO(e,t,n){let r=n.get(e);return r&&r!==e?r:t}function IO(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:PO(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:FO(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:PO(e,t.pageTitles),children:a}}function LO(e){let t=(0,$.c)(41),{folderPath:n,state:r,onChange:i,folderConfigHandle:a}=e,[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(!1);if(r.status===`idle`||r.status===`loading`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card px-3 py-2.5 space-y-3`,children:[(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`-QCLWk`})})}),(0,Z.jsx)(Ch,{className:`h-12 w-full`}),(0,Z.jsx)(Ch,{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)(Y,{id:`iDZtvM`,values:{message:e}})}),t[1]=e,t[2]=n),n}let f;t[3]===r.data.folder.templates_available?f=t[4]:(f=r.data.folder.templates_available??[],t[3]=r.data.folder.templates_available,t[4]=f);let p=f,m;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`-QCLWk`})}),t[5]=m):m=t[5];let h;t[6]===p.length?h=t[7]:(h=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[m,(0,Z.jsx)(wm,{className:`text-xs`,variant:`secondary`,children:p.length})]}),t[6]=p.length,t[7]=h);let g;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsxs)(X,{variant:`ghost`,className:`font-mono uppercase`,size:`sm`,onClick:()=>d(!0),children:[(0,Z.jsx)(Kn,{className:`size-3.5`,"aria-hidden":!0}),(0,Z.jsx)(Y,{id:`G1Gw0v`})]}),t[8]=g):g=t[8];let _;t[9]===h?_=t[10]:(_=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-border px-3 py-1`,children:[h,g]}),t[9]=h,t[10]=_);let v;t[11]===p?v=t[12]:(v=(0,Z.jsx)(`div`,{className:`px-3 py-2.5`,children:p.length===0?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`MZSBsh`})}):(0,Z.jsx)(`ul`,{className:`space-y-1`,children:p.map(e=>(0,Z.jsx)(id,{template:e,onCreate:()=>l(e.name),onEdit:()=>ng(wo(e.source_folder,e.name)),onDelete:()=>s(e),badge:e.scope===`inherited`?(0,Z.jsx)(zd,{source:e.source_folder,target:`templates/${e.name}.md`}):void 0},e.path))})}),t[11]=p,t[12]=v);let y;t[13]!==_||t[14]!==v?(y=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card`,children:[_,v]}),t[13]=_,t[14]=v,t[15]=y):y=t[15];let b;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(b=e=>{e||s(null)},t[16]=b):b=t[16];let x;t[17]!==o||t[18]!==i?(x=(0,Z.jsx)(Ju,{template:o,onOpenChange:b,onDeleted:i}),t[17]=o,t[18]=i,t[19]=x):x=t[19];let S;t[20]===p?S=t[21]:(S=new Set(p.map(RO)),t[20]=p,t[21]=S);let C;t[22]!==n||t[23]!==i?(C=e=>{i(),ng(wo(n,e))},t[22]=n,t[23]=i,t[24]=C):C=t[24];let w;t[25]!==n||t[26]!==u||t[27]!==S||t[28]!==C?(w=(0,Z.jsx)(rd,{folderPath:n,existingNames:S,open:u,onOpenChange:d,onCreated:C}),t[25]=n,t[26]=u,t[27]=S,t[28]=C,t[29]=w):w=t[29];let T=c!==null,E;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(E=e=>{e||l(null)},t[30]=E):E=t[30];let D=c??void 0,O;t[31]!==a||t[32]!==n||t[33]!==T||t[34]!==D?(O=(0,Z.jsx)(jS,{open:T,onOpenChange:E,kind:`file`,initialDir:n,initialTemplate:D,folderConfig:a}),t[31]=a,t[32]=n,t[33]=T,t[34]=D,t[35]=O):O=t[35];let k;return t[36]!==w||t[37]!==O||t[38]!==y||t[39]!==x?(k=(0,Z.jsxs)(Z.Fragment,{children:[y,x,w,O]}),t[36]=w,t[37]=O,t[38]=y,t[39]=x,t[40]=k):k=t[40],k}function RO(e){return e.name}function zO(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=Qn(`relative w-full overflow-x-auto subtle-scrollbar`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=Qn(`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 BO(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=Qn(`[&_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 VO(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=Qn(`[&_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 HO(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=Qn(`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 UO(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=Qn(`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 WO(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=Qn(`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 GO(e){if(!e)return`—`;let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/6e4);if(r<1)return ic._({id:`xOTzt5`});if(r<60)return ic._({id:`NRSLBe`,values:{diffMin:r}});let i=Math.floor(r/60);if(i<24)return ic._({id:`hDKtoF`,values:{diffHrs:i}});let a=Math.floor(i/24);return a<30?ic._({id:`QDZbvN`,values:{diffDays:a}}):t.toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`numeric`})}function KO(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 qO(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)(Ml,{className:`ml-1 size-3`}):(0,Z.jsx)(jl,{className:`ml-1 size-3`}):(0,Z.jsx)(ry,{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)(X,{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 JO(e){let t=(0,$.c)(96),{folderPath:n}=e,{_:r}=xn(),{folderPaths:i,loading:a,pages:o,pageTitles:s,pageMeta:c}=Lu(),l=ed(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)(Ch,{className:`size-5 rounded`}),(0,Z.jsx)(Ch,{className:`h-7 w-48`})]}),(0,Z.jsx)(Ch,{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)(Ch,{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)(Ch,{className:`h-4 w-20`})})]}),[`a`,`b`,`c`,`d`].map(ZO)]})]}),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=IO(n,{pages:o,pageTitles:s,pageMeta:c,folderPaths:i}),a=KO(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?_(XO):(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)(Jd,{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)(X,{onClick:()=>p(!0),children:[(0,Z.jsx)(Kn,{className:`size-4`}),(0,Z.jsx)(Y,{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)(wO,{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)(LO,{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)(jO,{folderPath:n}),t[44]=n,t[45]=D),S=`rounded-lg border`,y=zO;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)(qO,{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)(UO,{"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)(qO,{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)(UO,{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)(BO,{children:(0,Z.jsxs)(HO,{children:[L,V]})}),t[66]=L,t[67]=V,t[68]=x):x=t[68],v=VO,b=a.length?a.map(YO):(0,Z.jsx)(HO,{children:(0,Z.jsx)(WO,{colSpan:2,className:`h-24 text-center text-muted-foreground`,children:(0,Z.jsx)(Y,{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)(jS,{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 YO(e){return(0,Z.jsxs)(HO,{children:[(0,Z.jsx)(WO,{children:(0,Z.jsxs)(`a`,{href:ep(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)(Qd,{className:`size-4 shrink-0 text-muted-foreground`}):(0,Z.jsx)(Fe,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.title})]})}),(0,Z.jsx)(WO,{className:`text-muted-foreground`,children:e.kind===`file`?GO(e.modified):`—`})]},e.path)}function XO(e){return e===`asc`?`desc`:`asc`}function ZO(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)(Ch,{className:`size-4 rounded`}),(0,Z.jsx)(Ch,{className:`h-4 w-40`}),(0,Z.jsx)(`div`,{className:`ml-auto`,children:(0,Z.jsx)(Ch,{className:`h-4 w-16`})})]},e)}function QO(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=Qn(`flex w-full min-w-0 flex-1 flex-col items-center justify-center gap-4 rounded-xl border-dashed p-6 text-center text-balance`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`empty`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function $O(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=Qn(`flex max-w-sm flex-col items-center gap-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`empty-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var ek=hr(`mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0`,{variants:{variant:{default:`bg-transparent`,icon:`flex size-8 shrink-0 items-center justify-center rounded-lg bg-muted text-foreground [&_svg:not([class*='size-'])]:size-4`}},defaultVariants:{variant:`default`}});function tk(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=Qn(ek({variant:a,className: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)(`div`,{"data-slot":`empty-icon`,"data-variant":a,className:o,...r}),t[7]=r,t[8]=o,t[9]=a,t[10]=s):s=t[10],s}function nk(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?gr:`div`,o;t[4]===n?o=t[5]:(o=Qn(`font-heading text-sm font-medium tracking-tight`,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":`empty-title`,className:o,...r}),t[6]=a,t[7]=r,t[8]=o,t[9]=s):s=t[9],s}function rk(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=Qn(`text-sm/relaxed text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`empty-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function ik(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=Qn(`flex w-full max-w-sm min-w-0 flex-col items-center gap-2.5 text-sm text-balance`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`empty-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function ak(e){let t=(0,$.c)(26),{docName:n,size:r,limit:i,backNav:a}=e,o=a!==void 0,s=(0,Q.useRef)(null),c=(0,Q.useRef)(null),l=(0,Q.useId)(),u,d;t[0]===o?(u=t[1],d=t[2]):(u=()=>{o?s.current?.focus():c.current?.focus()},d=[o],t[0]=o,t[1]=u,t[2]=d),(0,Q.useEffect)(u,d);let f;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(tk,{variant:`icon`,className:`mb-0 size-16 rounded-full border bg-muted/40 text-muted-foreground`,children:(0,Z.jsx)(by,{className:`size-9`,"aria-hidden":`true`})}),t[3]=f):f=t[3];let p=o?void 0:-1,m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(Y,{id:`P3hnm0`}),t[4]=m):m=t[4];let h;t[5]!==p||t[6]!==l?(h=(0,Z.jsx)(nk,{asChild:!0,className:`text-2xl font-light outline-none`,children:(0,Z.jsx)(`h2`,{ref:c,id:l,tabIndex:p,children:m})}),t[5]=p,t[6]=l,t[7]=h):h=t[7];let g;t[8]===r?g=t[9]:(g=As(r),t[8]=r,t[9]=g);let _;t[10]===i?_=t[11]:(_=As(i),t[10]=i,t[11]=_);let v;t[12]!==n||t[13]!==g||t[14]!==_?(v=(0,Z.jsx)(rk,{children:(0,Z.jsx)(Y,{id:`GJH-AT`,values:{0:g,1:_,docName:n}})}),t[12]=n,t[13]=g,t[14]=_,t[15]=v):v=t[15];let y;t[16]!==h||t[17]!==v?(y=(0,Z.jsxs)($O,{className:`max-w-md gap-1`,children:[h,v]}),t[16]=h,t[17]=v,t[18]=y):y=t[18];let b;t[19]!==a||t[20]!==o?(b=o?(0,Z.jsx)(ik,{children:(0,Z.jsxs)(X,{ref:s,variant:`default`,onClick:()=>a.onNavigateBack(a.previousDocName),children:[(0,Z.jsx)(Al,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(Y,{id:`CKyk7Q`})]})}):null,t[19]=a,t[20]=o,t[21]=b):b=t[21];let x;return t[22]!==y||t[23]!==b||t[24]!==l?(x=(0,Z.jsxs)(QO,{role:`status`,"aria-labelledby":l,"data-slot":`large-file-editor-state`,className:`h-full gap-8 p-8`,children:[f,y,b]}),t[22]=y,t[23]=b,t[24]=l,t[25]=x):x=t[25],x}function ok(e){let t=(0,$.c)(8),{docName:n}=e,[r,i]=(0,Q.useState)(sk),a,o;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>_(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(){Qe(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)(Y,{id:`A67Uwj`})}),t[4]=l):l=t[4];let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(Y,{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)(X,{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 sk(){return new Set}function ck(e){let t=(0,$.c)(8),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{autoStart:r}=n,i=r===void 0?!1:r,a=(0,Q.useRef)(null),o,s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>{a.current?.focus()},s=[],t[2]=o,t[3]=s):(o=t[2],s=t[3]),(0,Q.useEffect)(o,s);let c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(`h1`,{className:`text-2xl font-light tracking-tighter text-balance`,children:(0,Z.jsx)(Y,{id:`hgf5io`})}),t[4]=c):c=t[4];let l;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1 text-center`,children:[c,(0,Z.jsx)(`p`,{className:`max-w-md text-sm text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`AUMPjj`})})]}),t[5]=l):l=t[5];let u;return t[6]===i?u=t[7]:(u=(0,Z.jsxs)(`div`,{ref:a,tabIndex:-1,className:`flex h-full w-full flex-col items-center justify-center gap-8 px-6 py-8 outline-none`,children:[l,(0,Z.jsx)(`div`,{className:`w-full`,children:(0,Z.jsx)(Mv,{autoStart:i})})]}),t[6]=i,t[7]=u),u}function lk(e){let t=(0,$.c)(19),{nav:n}=e,{state:r,refetch:i}=kd(n),a=(0,Q.useRef)(null),o,s;t[0]===r.phase?(o=t[1],s=t[2]):(o=()=>{r.phase===`resolved`&&a.current?.querySelector(`button`)?.focus()},s=[r.phase],t[0]=r.phase,t[1]=o,t[2]=s),(0,Q.useEffect)(o,s);let c;t[3]===n.path?c=t[4]:(c=function(){window.location.hash=ap(Td(n.path))},t[3]=n.path,t[4]=c);let l=c,u;t[5]===n?u=t[6]:(u=function(e){Ad.arm(Od(n,e)),window.location.hash=n.kind===`folder`?ap(e):ep(e)},t[5]=n,t[6]=u);let d=u,f=r.phase===`pending`?`polite`:void 0,p=r.phase===`resolved`?r.resolution.verdict:void 0,m=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`,h;t[7]!==l||t[8]!==n||t[9]!==d||t[10]!==i||t[11]!==r?(h=(0,Z.jsx)(Dd,{nav:n,state:r,onBrowseFolder:l,onOpenRenamed:d,onEnableAutoSync:l,onSyncCompleted:i,onPullApplied:i}),t[7]=l,t[8]=n,t[9]=d,t[10]=i,t[11]=r,t[12]=h):h=t[12];let g;return t[13]!==r.phase||t[14]!==f||t[15]!==p||t[16]!==m||t[17]!==h?(g=(0,Z.jsx)(`div`,{ref:a,role:`status`,"aria-live":f,"data-testid":`share-receive-miss-panel`,"data-phase":r.phase,"data-verdict":p,className:m,children:h}),t[13]=r.phase,t[14]=f,t[15]=p,t[16]=m,t[17]=h,t[18]=g):g=t[18],g}var uk=`ok-find`,dk=`ok-find-active`;function fk(e,t){let n=t.toLowerCase();if(n===``)return[];let r=[],i=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(let e=i.nextNode();e!==null;e=i.nextNode()){let t=(e.textContent??``).toLowerCase(),i=t.indexOf(n);for(;i>=0;){let a=document.createRange();a.setStart(e,i),a.setEnd(e,i+n.length),r.push(a),i=t.indexOf(n,i+n.length)}}return r}function pk(e){let t=(0,$.c)(61),{containerRef:n,onClose:r}=e,{_:i}=xn(),a=(0,Q.useRef)(null),[o,s]=(0,Q.useState)(``),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)(0),p,m;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(p=()=>{a.current?.focus()},m=[],t[1]=p,t[2]=m):(p=t[1],m=t[2]),(0,Q.useEffect)(p,m);let h;t[3]!==n||t[4]!==o?(h=()=>{let e=n.current,t=CSS.highlights;if(!e||t===void 0)return;let r=fk(e,o.trim());return u(r),f(0),t.set(uk,new Highlight(...r)),()=>{t.delete(uk),t.delete(dk)}},t[3]=n,t[4]=o,t[5]=h):h=t[5];let g;t[6]===o?g=t[7]:(g=[o],t[6]=o,t[7]=g),(0,Q.useEffect)(h,g);let _,v;t[8]!==d||t[9]!==l?(_=()=>{let e=CSS.highlights;if(e===void 0)return;let t=l[d];if(t===void 0){e.delete(dk);return}e.set(dk,new Highlight(t)),t.startContainer.parentElement?.scrollIntoView({block:`nearest`})},v=[l,d],t[8]=d,t[9]=l,t[10]=_,t[11]=v):(_=t[10],v=t[11]),(0,Q.useEffect)(_,v);let y;t[12]===l.length?y=t[13]:(y=e=>{l.length!==0&&f(t=>(t+e+l.length)%l.length)},t[12]=l.length,t[13]=y);let b=y,x;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(x=e=>s(e.target.value),t[14]=x):x=t[14];let S;t[15]===i?S=t[16]:(S=i({id:`KujtjC`}),t[15]=i,t[16]=S);let C;t[17]===i?C=t[18]:(C=i({id:`BKI4hX`}),t[17]=i,t[18]=C);let w;t[19]!==r||t[20]!==b?(w=e=>{e.key===`Enter`&&b(e.shiftKey?-1:1),e.key===`Escape`&&r()},t[19]=r,t[20]=b,t[21]=w):w=t[21];let T;t[22]!==o||t[23]!==S||t[24]!==C||t[25]!==w?(T=(0,Z.jsx)(Op,{ref:a,value:o,onChange:x,placeholder:S,"aria-label":C,className:`h-7 w-44`,onKeyDown:w}),t[22]=o,t[23]=S,t[24]=C,t[25]=w,t[26]=T):T=t[26];let E;t[27]!==d||t[28]!==l.length||t[29]!==o?(E=o.trim()===``?null:l.length===0?(0,Z.jsx)(Y,{id:`Y9c_nf`}):`${d+1}/${l.length}`,t[27]=d,t[28]=l.length,t[29]=o,t[30]=E):E=t[30];let D;t[31]===E?D=t[32]:(D=(0,Z.jsx)(`span`,{className:`min-w-10 text-center text-muted-foreground text-xs tabular-nums`,children:E}),t[31]=E,t[32]=D);let O;t[33]===b?O=t[34]:(O=()=>b(-1),t[33]=b,t[34]=O);let k;t[35]===i?k=t[36]:(k=i({id:`oqB2ez`}),t[35]=i,t[36]=k);let A;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(Ji,{className:`size-4`,"aria-hidden":!0}),t[37]=A):A=t[37];let j;t[38]!==O||t[39]!==k?(j=(0,Z.jsx)(X,{variant:`ghost`,size:`icon`,className:`size-7`,onClick:O,"aria-label":k,children:A}),t[38]=O,t[39]=k,t[40]=j):j=t[40];let M;t[41]===b?M=t[42]:(M=()=>b(1),t[41]=b,t[42]=M);let N;t[43]===i?N=t[44]:(N=i({id:`SiUUCS`}),t[43]=i,t[44]=N);let P;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(Zl,{className:`size-4`,"aria-hidden":!0}),t[45]=P):P=t[45];let F;t[46]!==M||t[47]!==N?(F=(0,Z.jsx)(X,{variant:`ghost`,size:`icon`,className:`size-7`,onClick:M,"aria-label":N,children:P}),t[46]=M,t[47]=N,t[48]=F):F=t[48];let I;t[49]===i?I=t[50]:(I=i({id:`wJo9oS`}),t[49]=i,t[50]=I);let L;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(Gf,{className:`size-4`,"aria-hidden":!0}),t[51]=L):L=t[51];let R;t[52]!==r||t[53]!==I?(R=(0,Z.jsx)(X,{variant:`ghost`,size:`icon`,className:`size-7`,onClick:r,"aria-label":I,children:L}),t[52]=r,t[53]=I,t[54]=R):R=t[54];let z;return t[55]!==T||t[56]!==D||t[57]!==j||t[58]!==F||t[59]!==R?(z=(0,Z.jsxs)(`div`,{className:`absolute top-2 right-4 z-10 flex items-center gap-1 rounded-md border bg-popover p-1 shadow-md`,children:[T,D,j,F,R]}),t[55]=T,t[56]=D,t[57]=j,t[58]=F,t[59]=R,t[60]=z):z=t[60],z}function mk(e){let t=(0,$.c)(9),{text:n}=e,r;t[0]===n?r=t[1]:(r=Ps(n),t[0]=n,t[1]=r);let{map:i}=r,a,o;if(t[2]!==i||t[3]!==n){o=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Da(n),r=e.length>0?e:Object.keys(i);if(r.length===0){o=null;break bb0}let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(Y,{id:`l_UFPv`}),t[6]=s):s=t[6];let c;t[7]===i?c=t[8]:(c=(e,t)=>{let n=i[e];return n===void 0?null:(0,Z.jsx)(hk,{keyName:e,value:n},`${e}-${t}`)},t[7]=i,t[8]=c),a=(0,Z.jsx)(Gl,{title:s,count:r.length,testId:`readonly-property-panel`,className:`pt-4`,children:r.map(c)})}t[2]=i,t[3]=n,t[4]=a,t[5]=o}else a=t[4],o=t[5];return o===Symbol.for(`react.early_return_sentinel`)?a:o}function hk(e){let t=(0,$.c)(9),{keyName:n,value:r}=e,i=Ul[Oa(r)],a;t[0]===i?a=t[1]:(a=(0,Z.jsx)(i,{className:`size-3.5`}),t[0]=i,t[1]=a);let o;t[2]!==n||t[3]!==r?(o=(0,Z.jsx)(gk,{keyName:n,value:r}),t[2]=n,t[3]=r,t[4]=o):o=t[4];let s;return t[5]!==n||t[6]!==a||t[7]!==o?(s=(0,Z.jsx)(Kl,{icon:a,label:n,testId:`readonly-property-row`,dataKey:n,children:o}),t[5]=n,t[6]=a,t[7]=o,t[8]=s):s=t[8],s}function gk(e){let t=(0,$.c)(8),{keyName:n,value:r}=e;if(Wl(r)){let e;return t[0]!==n||t[1]!==r?(e=(0,Z.jsx)(Hl,{keyName:n,value:r}),t[0]=n,t[1]=r,t[2]=e):e=t[2],e}let i;t[3]===r?i=t[4]:(i=Array.isArray(r)?r.filter(_k).join(`, `):String(r),t[3]=r,t[4]=i);let a=i,o;return t[5]!==a||t[6]!==n?(o=(0,Z.jsx)(`div`,{className:`flex min-h-7 items-center px-2 py-1 text-sm break-words`,"data-testid":`readonly-property-value`,"data-key":n,children:a}),t[5]=a,t[6]=n,t[7]=o):o=t[7],o}function _k(e){return typeof e==`string`}function vk(e){let t=(0,$.c)(38),{fileName:n,text:r,flow:i,linkBaseDocName:a,skillPathLinkDocName:o,onBundlePathClick:s}=e,c=i===void 0?!1:i,l,u,d,f;if(t[0]!==a||t[1]!==s||t[2]!==o||t[3]!==r){let e=Hs(r).body,n;if(t[8]!==a||t[9]!==s||t[10]!==o){let e=a?He.map(e=>e.name===`link`?e.configure({docName:a}):e):He;n=o?[...e,A.configure({docName:o,onBundlePathClick:s})]:e,t[8]=a,t[9]=s,t[10]=o,t[11]=n}else n=t[11];let i=n;f=Wr,l=i,u=!1,d=Rr().parseWithFallback(e),t[0]=a,t[1]=s,t[2]=o,t[3]=r,t[4]=l,t[5]=u,t[6]=d,t[7]=f}else l=t[4],u=t[5],d=t[6],f=t[7];let p;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(p={attributes:{class:`pt-4`}},t[12]=p):p=t[12];let m;t[13]!==l||t[14]!==u||t[15]!==d?(m={extensions:l,editable:u,content:d,editorProps:p},t[13]=l,t[14]=u,t[15]=d,t[16]=m):m=t[16];let h;t[17]!==a||t[18]!==o||t[19]!==r?(h=[r,a,o],t[17]=a,t[18]=o,t[19]=r,t[20]=h):h=t[20];let g=f(m,h),[_]=(0,Q.useState)(yk),v=(0,Q.useRef)(null),y,b;t[21]===_?(y=t[22],b=t[23]):(b=()=>{let e=v.current;if(e)return e.appendChild(_),()=>{_.parentNode===e&&e.removeChild(_)}},y=[_],t[21]=_,t[22]=y,t[23]=b),(0,Q.useLayoutEffect)(b,y);let x;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(`div`,{className:`tiptap-editor`,children:(0,Z.jsx)(`div`,{ref:v,style:{display:`contents`}})}),t[24]=x):x=t[24];let S=x,C;t[25]!==n||t[26]!==c||t[27]!==r?(C=c?(0,Z.jsx)(`article`,{className:`bg-background`,"aria-label":n,"data-skill-markdown-viewer":``,"data-skill-markdown-viewer-state":`loaded`,children:S}):(0,Z.jsx)(`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:(0,Z.jsxs)(`div`,{className:`editor-doc-scroll min-h-0 flex-1 overflow-auto subtle-scrollbar scroll-fade-mask`,children:[(0,Z.jsx)(mk,{text:r}),S]})}),t[25]=n,t[26]=c,t[27]=r,t[28]=C):C=t[28];let w=c?`tiptap-editor-portal-content`:`tiptap-editor-portal-content h-full`,T;t[29]!==g||t[30]!==w?(T=(0,Z.jsx)(Jr,{editor:g,className:w}),t[29]=g,t[30]=w,t[31]=T):T=t[31];let E;t[32]!==_||t[33]!==T?(E=(0,C_.createPortal)(T,_),t[32]=_,t[33]=T,t[34]=E):E=t[34];let D;return t[35]!==C||t[36]!==E?(D=(0,Z.jsxs)(Z.Fragment,{children:[C,E]}),t[35]=C,t[36]=E,t[37]=D):D=t[37],D}function yk(){let e=document.createElement(`div`);return e.style.display=`contents`,e}var bk=`data-skill-markdown`;function xk(e){let t=(0,$.c)(22),{scope:n,name:r,path:i,host:a,fileName:o}=e,s;t[0]!==a||t[1]!==r||t[2]!==i||t[3]!==n?(s={loadText:e=>Bm({scope:n,name:r,path:i,host:a},e)},t[0]=a,t[1]=r,t[2]=i,t[3]=n,t[4]=s):s=t[4];let c=Fh(s);if(c.status===`loading`){let e;return t[5]===o?e=t[6]:(e=(0,Z.jsx)(Bh,{fileName:o,dataAttr:bk}),t[5]=o,t[6]=e),e}if(c.status===`error`){let e;return t[7]!==c.message||t[8]!==o?(e=(0,Z.jsx)(Rh,{fileName:o,dataAttr:bk,message:c.message}),t[7]=c.message,t[8]=o,t[9]=e):e=t[9],e}let l=c.content,u;t[10]!==r||t[11]!==i||t[12]!==n?(u=Ga(n,r,i),t[10]=r,t[11]=i,t[12]=n,t[13]=u):u=t[13];let d;t[14]!==r||t[15]!==n?(d=Xa(n,r),t[14]=r,t[15]=n,t[16]=d):d=t[16];let f;return t[17]!==c.content||t[18]!==o||t[19]!==u||t[20]!==d?(f=(0,Z.jsx)(vk,{fileName:o,text:l,linkBaseDocName:u,skillPathLinkDocName:d}),t[17]=c.content,t[18]=o,t[19]=u,t[20]=d,t[21]=f):f=t[21],f}function Sk(e){let t=(0,$.c)(5),[n,r]=(0,Q.useState)(!1),i;t[0]===e?i=t[1]:(i=()=>{let t=t=>{if(t.defaultPrevented||!(t.metaKey||t.ctrlKey)||t.key.toLowerCase()!==`f`)return;let n=e.current;if(n===null)return;let i=t.target;i instanceof Node&&!n.contains(i)&&Gs(i)||(t.preventDefault(),r(!0))};return window.addEventListener(`keydown`,t,!0),()=>window.removeEventListener(`keydown`,t,!0)},t[0]=e,t[1]=i);let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=[],t[2]=a):a=t[2],(0,Q.useEffect)(i,a);let o;return t[3]===n?o=t[4]:(o={findOpen:n,setFindOpen:r},t[3]=n,t[4]=o),o}var Ck=new Set([`md`,`mdx`]);function wk(e){let t=(0,$.c)(18),{scope:n,name:r,path:i,host:a}=e,{_:o}=xn(),s=(0,Q.useRef)(null),c=(0,Q.useRef)(null),l=(0,Q.useRef)(null),u;t[0]===i?u=t[1]:(u=i.split(`/`).pop()??i,t[0]=i,t[1]=u);let d=u,f=d.lastIndexOf(`.`),p=f>=0?d.slice(f+1).toLowerCase():``,m=Ck.has(p),{findOpen:h,setFindOpen:g}=Sk(m?c:l),_=Ck.has(p)?(0,Z.jsx)(xk,{scope:n,name:r,path:i,host:a,fileName:d}):(0,Z.jsx)(Ih,{fileName:d,extension:p,loadText:e=>Bm({scope:n,name:r,path:i,host:a},e)}),v;t[2]!==h||t[3]!==m||t[4]!==g?(v=m&&h?(0,Z.jsx)(pk,{containerRef:s,onClose:()=>g(!1)}):null,t[2]=h,t[3]=m,t[4]=g,t[5]=v):v=t[5];let y;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(wd,{className:`size-4 shrink-0`,"aria-hidden":!0}),t[6]=y):y=t[6];let b;t[7]!==o||t[8]!==r?(b=o({id:`96pApd`,values:{name:r}}),t[7]=o,t[8]=r,t[9]=b):b=t[9];let x;t[10]===b?x=t[11]:(x=(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5 border-border border-b bg-muted/35 px-3 py-2 text-muted-foreground text-sm`,children:[y,(0,Z.jsx)(`span`,{className:`truncate`,children:b})]}),t[10]=b,t[11]=x);let S;t[12]===_?S=t[13]:(S=(0,Z.jsx)(`div`,{ref:s,className:`min-h-0 flex-1`,children:_}),t[12]=_,t[13]=S);let C;return t[14]!==v||t[15]!==x||t[16]!==S?(C=(0,Z.jsxs)(`div`,{ref:c,className:`relative flex h-full min-h-0 flex-col`,children:[v,x,S]}),t[14]=v,t[15]=x,t[16]=S,t[17]=C):C=t[17],C}var Tk=[`from-[#ff9d6c] to-[#ff7eb3]`,`from-[#8fe0c0] to-[#59c0ff]`,`from-[#c0b0ff] to-[#8fb0ff]`,`from-[#ffd18f] to-[#ff9fb0]`,`from-[#8fb0ff] to-[#c9a8ff]`,`from-[#7fe0a0] to-[#bfe08f]`];function Ek(e){let t=0;for(let n=0;n<e.length;n++)t=t*31+e.charCodeAt(n)|0;return Tk[Math.abs(t)%Tk.length]??Tk[0]}var Dk=`SKILL.md`,Ok=new Map;function kk(e){let t=(0,$.c)(44),{source:n,name:r,subtitle:i,tintKey:a,headerActions:o,headerLine:s,noPreviewFallback:c,banner:l,reserveRightGutter:u,selectedPath:d,scope:f,onBundlePathClick:p,onPreviewMeta:m}=e,h=u===void 0?!1:u,{_:g}=xn(),_=`${n}::${r}`,v;t[0]===_?v=t[1]:(v=()=>Ok.get(_)??null,t[0]=_,t[1]=v);let[y,b]=(0,Q.useState)(v),x;t[2]===_?x=t[3]:(x=()=>Ok.has(_),t[2]=_,t[3]=x);let[S,C]=(0,Q.useState)(x),w=d??Dk,T=(0,Q.useRef)(null),E=(0,Q.useRef)(null),{findOpen:D,setFindOpen:O}=Sk(T),k,A;t[4]!==r||t[5]!==n?(k=()=>{let e=`${n}::${r}`,t=new AbortController;Ok.has(e)||zm({source:n,name:r},t.signal).then(n=>{t.signal.aborted||(n.ok&&(Ok.set(e,n),b(n)),C(!0))});let i=fc(Mk);return()=>{t.abort(),i()}},A=[n,r],t[4]=r,t[5]=n,t[6]=k,t[7]=A):(k=t[6],A=t[7]),(0,Q.useEffect)(k,A);let j,M;t[8]!==m||t[9]!==y?(j=()=>{y&&m?.(y)},M=[y,m],t[8]=m,t[9]=y,t[10]=j,t[11]=M):(j=t[10],M=t[11]),(0,Q.useEffect)(j,M);let N=y?.description,P;if(t[12]!==g||t[13]!==l||t[14]!==N||t[15]!==D||t[16]!==o||t[17]!==s||t[18]!==r||t[19]!==c||t[20]!==p||t[21]!==y||t[22]!==S||t[23]!==h||t[24]!==f||t[25]!==w||t[26]!==O||t[27]!==i||t[28]!==a){let e=y?Nk(y.skillMd):[],n;t[30]===y?n=t[31]:(n=y?Ss(y):null,t[30]=y,t[31]=n);let u=n,d;t[32]!==g||t[33]!==y||t[34]!==w?(d=w===Dk?y?{path:`${y.name} SKILL.md`,content:y.skillMd,md:!0}:null:(()=>{let e=y?.files?.find(e=>e.relPath===w);return e?{path:e.relPath,content:e.content??g({id:`fdeFfN`}),md:e.content!==null&&/\.mdx?$/.test(e.relPath)}:null})(),t[32]=g,t[33]=y,t[34]=w,t[35]=d):d=t[35];let m=d,_;t[36]!==D||t[37]!==O?(_=D?(0,Z.jsx)(pk,{containerRef:E,onClose:()=>O(!1)}):null,t[36]=D,t[37]=O,t[38]=_):_=t[38];let v;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(wd,{className:`size-4`,"aria-hidden":!0}),t[39]=v):v=t[39];let b;t[40]!==o||t[41]!==s||t[42]!==h?(b=(0,Z.jsx)(ig,{icon:v,actions:o,reserveRightGutter:h,children:s}),t[40]=o,t[41]=s,t[42]=h,t[43]=b):b=t[43],P=(0,Z.jsxs)(`div`,{ref:T,className:`relative flex h-full min-h-0 flex-col`,children:[_,b,y?(0,Z.jsxs)(`div`,{ref:E,className:`editor-doc-scroll min-h-0 flex-1 overflow-auto subtle-scrollbar scroll-fade-mask`,children:[w===Dk?l:null,w===Dk?(0,Z.jsx)(`div`,{className:`editor-content-aligned pt-6`,children:(0,Z.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,Z.jsx)(Kl,{icon:(0,Z.jsx)(ql,{className:`size-3.5`}),label:g({id:`XmJfZT`}),children:(0,Z.jsx)(`span`,{className:`font-mono`,children:r})}),N?(0,Z.jsx)(Kl,{icon:(0,Z.jsx)(lb,{className:`size-3.5`}),label:g({id:`eTsJYJ`}),children:(0,Z.jsx)(`p`,{className:`text-foreground/80`,children:N})}):null,(0,Z.jsx)(Kl,{icon:(0,Z.jsx)(ab,{className:`size-3.5`}),label:g({id:`pTyA_t`}),children:e.length>0?(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.map(jk)}):(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:(0,Z.jsx)(Y,{id:`N2S1rs`})})}),u?(0,Z.jsx)(Kl,{icon:(0,Z.jsx)(qd,{className:`size-3.5`}),label:g({id:`WOr-hW`}),children:(0,Z.jsx)(rg,{size:u})}):null]})}):null,m?.md?(0,Z.jsx)(vk,{flow:!0,fileName:m.path,text:m.content,linkBaseDocName:f?Ga(f,r,w===Dk?`SKILL`:w):void 0,skillPathLinkDocName:f?Xa(f,r):void 0,onBundlePathClick:p}):m?(0,Z.jsx)(`div`,{className:`editor-content-aligned`,children:(0,Z.jsx)(`pre`,{className:`overflow-auto whitespace-pre-wrap break-words py-4 font-mono text-xs subtle-scrollbar scroll-fade-mask`,children:m.content})}):null]}):S?(0,Z.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-4`,children:c??(0,Z.jsxs)(`div`,{className:`flex aspect-[2/1] w-full max-w-xl flex-col justify-end rounded-xl bg-gradient-to-br p-5 ${Ek(a)}`,"aria-hidden":!0,children:[(0,Z.jsx)(`span`,{className:`truncate font-semibold text-2xl text-neutral-900`,children:r}),(0,Z.jsx)(`span`,{className:`truncate text-neutral-900/70 text-sm`,children:i})]})}):(0,Z.jsx)(`div`,{className:`editor-doc-scroll min-h-0 flex-1 overflow-auto subtle-scrollbar scroll-fade-mask`,children:(0,Z.jsx)(`div`,{className:`editor-content-aligned pt-6`,children:(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[(0,Z.jsx)(`div`,{className:`h-6 w-2/3 animate-pulse rounded bg-muted`}),[`a`,`b`,`c`,`d`,`e`].map(Ak)]})})})]}),t[12]=g,t[13]=l,t[14]=N,t[15]=D,t[16]=o,t[17]=s,t[18]=r,t[19]=c,t[20]=p,t[21]=y,t[22]=S,t[23]=h,t[24]=f,t[25]=w,t[26]=O,t[27]=i,t[28]=a,t[29]=P}else P=t[29];return P}function Ak(e){return(0,Z.jsx)(`div`,{className:`h-4 w-11/12 animate-pulse rounded bg-muted`},e)}function jk(e){return(0,Z.jsx)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 text-muted-foreground text-xs`,children:e},e)}function Mk(){return Ok.clear()}function Nk(e){try{let{frontmatter:t}=Hs(e);return t?Ko(Va(t)):[]}catch{return[]}}var Pk=hr(`group/alert relative grid w-full gap-0.5 rounded-lg border px-2.5 py-2 text-left text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pe-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-card text-card-foreground`,destructive:`bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current`}},defaultVariants:{variant:`default`}});function Fk(e){let t=(0,$.c)(10),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;t[4]!==n||t[5]!==i?(a=Qn(Pk({variant:i}),n),t[4]=n,t[5]=i,t[6]=a):a=t[6];let o;return t[7]!==r||t[8]!==a?(o=(0,Z.jsx)(`div`,{"data-slot":`alert`,role:`alert`,className:a,...r}),t[7]=r,t[8]=a,t[9]=o):o=t[9],o}function Ik(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=Qn(`font-medium group-has-[>svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`alert-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Lk(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=Qn(`text-balance text-muted-foreground text-sm md:text-pretty [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`alert-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Rk(e){let t=(0,$.c)(43),{bundle:n,source:r,scope:i,onInstalled:a}=e,{_:o}=xn(),[s,c]=(0,Q.useState)(!1);if(n.names.length<=1)return null;let l;t[0]!==o||t[1]!==n.capabilities?.hooks?(l=n.capabilities?.hooks?o({id:`8fDf7j`}):null,t[0]=o,t[1]=n.capabilities?.hooks,t[2]=l):l=t[2];let u;t[3]!==o||t[4]!==n.capabilities?.commands?(u=n.capabilities?.commands?o({id:`9HKBNN`}):null,t[3]=o,t[4]=n.capabilities?.commands,t[5]=u):u=t[5];let d;t[6]!==o||t[7]!==n.capabilities?.mcp?(d=n.capabilities?.mcp?o({id:`8qgfac`}):null,t[6]=o,t[7]=n.capabilities?.mcp,t[8]=d):d=t[8];let f;t[9]!==o||t[10]!==n.capabilities?.agents?(f=n.capabilities?.agents?o({id:`EpZQFw`}):null,t[9]=o,t[10]=n.capabilities?.agents,t[11]=f):f=t[11];let p;t[12]!==l||t[13]!==u||t[14]!==d||t[15]!==f?(p=[l,u,d,f].filter(zk),t[12]=l,t[13]=u,t[14]=d,t[15]=f,t[16]=p):p=t[16];let m=p,h=n.names.length,g=n.plugin,_;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(Ff,{className:`size-4`,"aria-hidden":!0}),t[17]=_):_=t[17];let v;t[18]!==h||t[19]!==g?(v=(0,Z.jsx)(Ik,{children:g?(0,Z.jsx)(Y,{id:`3l32hp`,values:{plugin:g}}):(0,Z.jsx)(Y,{id:`_mcDqU`,values:{count:h}})}),t[18]=h,t[19]=g,t[20]=v):v=t[20];let y;t[21]!==m||t[22]!==h||t[23]!==g||t[24]!==r?(y=(0,Z.jsx)(Lk,{className:`min-w-0`,children:m.length>0?(0,Z.jsx)(Y,{id:`aR4DgO`,values:{0:m.join(`, `),count:h}}):g?(0,Z.jsx)(Y,{id:`zt9ZgM`,values:{count:h}}):(0,Z.jsx)(Y,{id:`wefL17`,values:{source:r,count:h}})}),t[21]=m,t[22]=h,t[23]=g,t[24]=r,t[25]=y):y=t[25];let b;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(X,{variant:`outline`,size:`sm`,"data-testid":`plugin-bundle-pick`,onClick:()=>c(!0),children:(0,Z.jsx)(Y,{id:`XVnIvs`})}),t[26]=b):b=t[26];let x;t[27]===n.repositoryUrl?x=t[28]:(x=n.repositoryUrl?(0,Z.jsx)(X,{variant:`ghost`,size:`sm`,asChild:!0,children:(0,Z.jsxs)(`a`,{href:n.repositoryUrl,target:`_blank`,rel:`noreferrer`,children:[(0,Z.jsx)(Y,{id:`Fhp4Gn`}),(0,Z.jsx)(Fl,{className:`size-3.5`})]})}):null,t[27]=n.repositoryUrl,t[28]=x);let S;t[29]===x?S=t[30]:(S=(0,Z.jsxs)(`div`,{className:`mt-2.5 flex items-center gap-2 group-has-[>svg]/alert:col-start-2`,children:[b,x]}),t[29]=x,t[30]=S);let C;t[31]!==S||t[32]!==v||t[33]!==y?(C=(0,Z.jsxs)(Fk,{role:`note`,className:`my-3 bg-muted/40 px-4 py-3`,children:[_,v,y,S]}),t[31]=S,t[32]=v,t[33]=y,t[34]=C):C=t[34];let w=s?n:null,T;t[35]!==a||t[36]!==i||t[37]!==r||t[38]!==w?(T=(0,Z.jsx)(Sd,{bundle:w,source:r,defaultScope:i,onInstalled:a,onOpenChange:c}),t[35]=a,t[36]=i,t[37]=r,t[38]=w,t[39]=T):T=t[39];let E;return t[40]!==C||t[41]!==T?(E=(0,Z.jsxs)(`div`,{className:`editor-content-aligned`,children:[C,T]}),t[40]=C,t[41]=T,t[42]=E):E=t[42],E}function zk(e){return e!==null}function Bk(e){let t=(0,$.c)(28),{source:n,name:r,initialScope:i,marketplace:a}=e,{_:o}=xn(),[s,c]=(0,Q.useState)(i),[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(null),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=[],t[0]=p):p=t[0];let[m,h]=(0,Q.useState)(p),[g,_]=(0,Q.useState)(!1),v;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(v=[],t[1]=v):v=t[1];let y=(0,Q.useRef)(v),b=(0,Q.useRef)(null),x=(0,Q.useRef)(null),S=(0,Q.useRef)(null),C;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(C=[],t[2]=C):C=t[2];let w=(0,Q.useRef)(C),T=(0,Q.useRef)(!1),E;t[3]!==o||t[4]!==a||t[5]!==r||t[6]!==s||t[7]!==n?(E=async function(){if(b.current)return b.current;if(S.current)return S.current;let e=s,t=Mm({source:n,skill:r,scope:e,install:!1,...a?{marketplace:!0}:{}}).then(t=>t.ok?(b.current=t.name,x.current=e,f(e),u(t.name),t.name):(Us.error(o({id:`oX-rVu`,values:{0:t.error}})),null));S.current=t;let i=await t;return S.current=null,i},t[3]=o,t[4]=a,t[5]=r,t[6]=s,t[7]=n,t[8]=E):E=t[8];let D=E,O;t[9]!==o||t[10]!==D?(O=async function(e){if(y.current=e,w.current=e,h(e),!T.current){for(T.current=!0,_(!0);;){let e=w.current,t=await D(),n=x.current;if(!t||!n)break;let r=await Pm({scope:n,name:t,targets:[...e],linkMode:!0});if(!r.ok){Us.error(o({id:`s-pW_v`,values:{0:r.error}}));break}if(e===w.current){let e=y.current.filter(Vk),t=[...new Set([...e,...r.hosts])];y.current=t,h(t);break}}T.current=!1,_(!1)}},t[9]=o,t[10]=D,t[11]=O):O=t[11];let k=O,A;t[12]===m?A=t[13]:(A=new Set(m),t[12]=m,t[13]=A);let j=m.length>0,M;t[14]!==o||t[15]!==g||t[16]!==k||t[17]!==D||t[18]!==A||t[19]!==j?(M={hostSet:A,installed:j,installing:g,toggleEditor(e,t){if(e===`agents`){if(!t)return;(async()=>{_(!0);let e=await D(),t=x.current;if(e&&t){let n=await Vm({scope:t,name:e,dir:Ts,mode:`copy`});if(n.ok){let e=[...new Set([...y.current,`agents`])];y.current=e,h(e)}else Us.error(o({id:`s-pW_v`,values:{0:n.error}}))}_(!1)})();return}let n=new Set(y.current);t?n.add(e):n.delete(e),k([...n])},installAll(){k([...ar])},linkMode:!0,placeAt(e,t){(async()=>{_(!0);let n=await D(),r=x.current;if(n&&r){let i=await Vm({scope:r,name:n,dir:e,mode:t});i.ok||Us.error(o({id:`s-pW_v`,values:{0:i.error}}))}_(!1)})()}},t[14]=o,t[15]=g,t[16]=k,t[17]=D,t[18]=A,t[19]=j,t[20]=M):M=t[20];let N=M,P=l!==null||g,F;return t[21]!==D||t[22]!==l||t[23]!==d||t[24]!==s||t[25]!==P||t[26]!==N?(F={scope:s,setScope:c,scopeLocked:P,importedName:l,importedScope:d,importNow:D,toggles:N},t[21]=D,t[22]=l,t[23]=d,t[24]=s,t[25]=P,t[26]=N,t[27]=F):F=t[27],F}function Vk(e){return!va(e)}var Hk=`SKILL.md`;function Uk(e){let t=(0,$.c)(12),{scope:n,name:r}=e,i;t[0]!==r||t[1]!==n?(i={scope:n,name:r},t[0]=r,t[1]=n,t[2]=i):i=t[2];let{origin:a,github:o,updateAvailable:s,reimport:c,reimporting:l}=ag(i);if(!a)return null;let u;t[3]===o?u=t[4]:(u=o?(0,Z.jsx)(X,{variant:`ghost`,size:`sm`,className:`px-2`,asChild:!0,children:(0,Z.jsxs)(`a`,{href:o,target:`_blank`,rel:`noreferrer`,children:[(0,Z.jsx)(Y,{id:`wdxz7K`}),(0,Z.jsx)(Fl,{className:`h-3.5 w-3.5`})]})}):null,t[3]=o,t[4]=u);let d;t[5]!==c||t[6]!==l||t[7]!==s?(d=s?(0,Z.jsx)(X,{size:`sm`,onClick:()=>void c(),disabled:l,children:l?(0,Z.jsx)(Y,{id:`JL3si7`}):(0,Z.jsx)(Y,{id:`EkH9pt`})}):null,t[5]=c,t[6]=l,t[7]=s,t[8]=d):d=t[8];let f;return t[9]!==u||t[10]!==d?(f=(0,Z.jsxs)(`div`,{className:`flex gap-1`,children:[u,d]}),t[9]=u,t[10]=d,t[11]=f):f=t[11],f}function Wk(e){let t=(0,$.c)(99),{flavor:n,source:r,name:i,subtitle:a,level:o,reserveRightGutter:s,path:c}=e,l=c??Hk,u=hp(),d=ef(),[f,p]=(0,Q.useState)(null),[m,h]=(0,Q.useState)(!0),g,_;t[0]!==n||t[1]!==i||t[2]!==r?(g=()=>{if(n!==`explore`)return;let e=!1;return Lm({source:r,name:i}).then(t=>{e||t.ok&&p(t)}),()=>{e=!0}},_=[n,r,i],t[0]=n,t[1]=i,t[2]=r,t[3]=g,t[4]=_):(g=t[3],_=t[4]),(0,Q.useEffect)(g,_);let[v,y]=(0,Q.useState)(null),[b,x]=(0,Q.useState)(null),S;t[5]!==n||t[6]!==i||t[7]!==r?(S=n===`explore`?mo(r,i):null,t[5]=n,t[6]=i,t[7]=r,t[8]=S):S=t[8];let C=S,w=n===`explore`?f?.sourceUrl??C?.sourceUrl:v?.repositoryUrl,T=f?.sourceKind??C?.sourceKind,[E,D]=(0,Q.useState)(null),O,k;t[9]!==n||t[10]!==r||t[11]!==T?(O=()=>{if(D(null),n!==`explore`||T!==`site`)return;let e=new AbortController;return Fm(r,e.signal).then(t=>{e.signal.aborted||!t.ok||D(t.skills.map(qk))}),()=>e.abort()},k=[n,T,r],t[9]=n,t[10]=r,t[11]=T,t[12]=O,t[13]=k):(O=t[12],k=t[13]),(0,Q.useEffect)(O,k);let A;t[14]!==b||t[15]!==E?(A=b?{plugin:b.plugin,names:b.bundledSkills,capabilities:b.capabilities,...b.repositoryUrl?{repositoryUrl:b.repositoryUrl}:{}}:E?{plugin:null,names:E}:null,t[14]=b,t[15]=E,t[16]=A):A=t[16];let j=A,M=n===`detected`,N=n===`builtin`,P=n===`foreign`,F=o??`project`,I=n===`explore`,L;t[17]!==i||t[18]!==r||t[19]!==I||t[20]!==F?(L={source:r,name:i,initialScope:F,marketplace:I},t[17]=i,t[18]=r,t[19]=I,t[20]=F,t[21]=L):L=t[21];let R=Bk(L),z=(0,Q.useRef)(!1),[B,V]=(0,Q.useState)(null),H=R.importedName??B,U=R.importedScope??R.scope,{openTabs:ee,closeTab:W}=Ke(),te=km(),G;t[22]!==te||t[23]!==H||t[24]!==U?(G=H!==null&&te.status===`ready`?te.data.find(e=>e.name===H&&e.scope===U):void 0,t[22]=te,t[23]=H,t[24]=U,t[25]=G):G=t[25];let K=(n===`explore`||P||v!==null)&&G!==void 0,q,ne;t[26]!==W||t[27]!==K||t[28]!==H||t[29]!==U||t[30]!==i||t[31]!==d||t[32]!==ee?(q=()=>{if(!K||z.current)return;z.current=!0;let e=ee.filter(e=>{let t=ym(e);return t.kind===`skill-preview`&&t.name===i});d(U,H,{replaceActive:!0,replaceHistory:!0});for(let t of e)W(t)},ne=[K,U,H,d,ee,i,W],t[26]=W,t[27]=K,t[28]=H,t[29]=U,t[30]=i,t[31]=d,t[32]=ee,t[33]=q,t[34]=ne):(q=t[33],ne=t[34]),(0,Q.useEffect)(q,ne);let re;t[35]===a?re=t[36]:(re=a&&a.charAt(0).toUpperCase()+a.slice(1),t[35]=a,t[36]=re);let J=re,ie=u[F],ae;t[37]===i?ae=t[38]:(ae=(0,Z.jsx)(`strong`,{className:`font-medium text-foreground`,children:i}),t[37]=i,t[38]=ae);let oe=ae,se;t[39]===ie?se=t[40]:(se=(0,Z.jsx)(`strong`,{className:`font-medium text-foreground`,children:ie}),t[39]=ie,t[40]=se);let ce=se,le;t[41]===J?le=t[42]:(le=(0,Z.jsx)(`strong`,{className:`font-medium text-foreground`,children:J}),t[41]=J,t[42]=le);let ue=le,de=v?.version?` (v${v.version})`:``,fe;t[43]!==ue||t[44]!==ce||t[45]!==oe||t[46]!==N||t[47]!==M||t[48]!==P||t[49]!==v||t[50]!==de||t[51]!==r?(fe=N?(0,Z.jsx)(Y,{id:`rmorj0`,values:{boldName:oe}}):v?(0,Z.jsx)(Y,{id:`UceXfW`,values:{0:v.plugin,boldName:oe,pluginVersion:de,boldHarness:ue},components:{0:(0,Z.jsx)(`strong`,{className:`font-medium text-foreground`})}}):P?(0,Z.jsx)(Y,{id:`yhYv9j`,values:{boldName:oe,source:r},components:{0:(0,Z.jsx)(`strong`,{className:`font-medium text-foreground`})}}):M?(0,Z.jsx)(Y,{id:`UHwc0P`,values:{boldName:oe,boldHarness:ue,boldLevel:ce}}):(0,Z.jsx)(Y,{id:`fBoO7w`,values:{boldName:oe}}),t[43]=ue,t[44]=ce,t[45]=oe,t[46]=N,t[47]=M,t[48]=P,t[49]=v,t[50]=de,t[51]=r,t[52]=fe):fe=t[52];let pe=fe,me;t[53]!==N||t[54]!==f||t[55]!==M||t[56]!==n||t[57]!==P||t[58]!==i||t[59]!==v||t[60]!==R||t[61]!==u.global||t[62]!==u.project||t[63]!==T||t[64]!==w||t[65]!==F?(me=N?(0,Z.jsx)(Uk,{scope:F,name:i}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`flex gap-1`,children:[f?.skillsUrl?(0,Z.jsx)(X,{variant:`ghost`,size:`sm`,className:`px-2`,asChild:!0,children:(0,Z.jsxs)(`a`,{href:f.skillsUrl,target:`_blank`,rel:`noreferrer`,children:[(0,Z.jsx)(Y,{id:`gN3JX8`}),(0,Z.jsx)(Fl,{className:`h-3.5 w-3.5`})]})}):null,w?(0,Z.jsx)(X,{variant:`ghost`,size:`sm`,className:`px-2`,asChild:!0,children:(0,Z.jsxs)(`a`,{href:w,target:`_blank`,rel:`noreferrer`,children:[n===`explore`&&T===`site`?(0,Z.jsx)(Y,{id:`wdxz7K`}):(0,Z.jsx)(Y,{id:`IreQBq`}),(0,Z.jsx)(Fl,{className:`h-3.5 w-3.5`})]})}):null]}),v||!M?(0,Z.jsxs)(Wi,{children:[(0,Z.jsx)(Ri,{asChild:!0,children:(0,Z.jsx)(X,{size:`sm`,disabled:R.toggles.installing,"data-testid":v?`skill-preview-edit-a-copy`:P?`skill-preview-copy-in`:void 0,children:R.toggles.installing?v||P?(0,Z.jsx)(Y,{id:`Dvr1Sg`}):(0,Z.jsx)(Y,{id:`Wtw22s`}):(0,Z.jsxs)(Z.Fragment,{children:[v?(0,Z.jsx)(Y,{id:`rFL-yb`}):P?(0,Z.jsx)(Y,{id:`XBgr2S`}):(0,Z.jsx)(Y,{id:`TKQ7K-`}),(0,Z.jsx)(Zl,{className:`size-4 opacity-60`,"aria-hidden":!0})]})})}),(0,Z.jsxs)(Hi,{align:`end`,className:cr,children:[(0,Z.jsx)(Bi,{children:(0,Z.jsx)(Y,{id:`oCHfGC`})}),(0,Z.jsxs)(Ni,{value:R.scope,onValueChange:e=>R.setScope(e),children:[(0,Z.jsx)(Li,{value:`project`,disabled:R.scopeLocked,onSelect:Kk,children:u.project}),(0,Z.jsx)(Li,{value:`global`,disabled:R.scopeLocked,onSelect:Gk,children:u.global})]}),(0,Z.jsx)(Gi,{}),(0,Z.jsx)(or,{toggles:R.toggles,skill:{scope:R.scope,name:i}})]})]}):null]}),t[53]=N,t[54]=f,t[55]=M,t[56]=n,t[57]=P,t[58]=i,t[59]=v,t[60]=R,t[61]=u.global,t[62]=u.project,t[63]=T,t[64]=w,t[65]=F,t[66]=me):me=t[66];let he=me,ge;t[67]!==n||t[68]!==o||t[69]!==i||t[70]!==r||t[71]!==a||t[72]!==F?(ge=e=>n===`explore`?(window.location.hash=np({flavor:n,source:r,name:i,subtitle:a,level:o,path:e}),!0):(window.location.hash=ip({scope:F,name:i,path:e}),!0),t[67]=n,t[68]=o,t[69]=i,t[70]=r,t[71]=a,t[72]=F,t[73]=ge):ge=t[73];let _e=ge,ve=a||i,ye;t[74]!==M||t[75]!==n?(ye=e=>{let t=M?e.plugin??null:null;y(e=>e?.provider===t?.provider&&e?.plugin===t?.plugin&&e?.version===t?.version&&e?.marketplace===t?.marketplace&&e?.repositoryUrl===t?.repositoryUrl?e:t),x(n===`explore`?e.pluginBundle??null:null)},t[74]=M,t[75]=n,t[76]=ye):ye=t[76];let be;t[77]!==j||t[78]!==i||t[79]!==R.scope||t[80]!==r?(be=j?(0,Z.jsx)(Rk,{bundle:j,source:r,scope:R.scope,onInstalled:e=>{let t=e.get(i);t!==void 0&&V(t)}}):void 0,t[77]=j,t[78]=i,t[79]=R.scope,t[80]=r,t[81]=be):be=t[81];let xe=N?F:void 0,Se;t[82]!==f||t[83]!==m?(Se=f?.image&&m?(0,Z.jsx)(`img`,{src:f.image,alt:``,className:`max-h-full max-w-full rounded-xl border border-border bg-muted`,onError:()=>h(!1)}):void 0,t[82]=f,t[83]=m,t[84]=Se):Se=t[84];let Ce;return t[85]!==he||t[86]!==pe||t[87]!==i||t[88]!==_e||t[89]!==s||t[90]!==l||t[91]!==r||t[92]!==a||t[93]!==ve||t[94]!==ye||t[95]!==be||t[96]!==xe||t[97]!==Se?(Ce=(0,Z.jsx)(kk,{source:r,name:i,subtitle:a,tintKey:ve,onBundlePathClick:_e,headerActions:he,headerLine:pe,reserveRightGutter:s,selectedPath:l,onPreviewMeta:ye,banner:be,scope:xe,noPreviewFallback:Se}),t[85]=he,t[86]=pe,t[87]=i,t[88]=_e,t[89]=s,t[90]=l,t[91]=r,t[92]=a,t[93]=ve,t[94]=ye,t[95]=be,t[96]=xe,t[97]=Se,t[98]=Ce):Ce=t[98],Ce}function Gk(e){return e.preventDefault()}function Kk(e){return e.preventDefault()}function qk(e){return e.name}var Jk=(0,Q.lazy)(()=>n(()=>import(`./ImportSkillDialog-B_0sfIcE.js`).then(e=>({default:e.ImportSkillDialog})),__vite__mapDeps([127,1,8,2,3,6,9,10,11,12,13,40,14,15,16,100,54,55,18,19,20,22,51,44,45,53,26,27,28,21,24,23,35,128,129,52,56,81,82,83,84,85,86,87,88,89,90,91,92,93,76,94,95,96,97,98,99,4,5,34,43,101,102,36,37,66,67,68,69,70,103,78,72,29,104,105,41,106,30,65,71,73,74,107,108,109,31,25,110,111,46,112,38,42,113,114,115,116,117,118,130,131,132,133,134,135,47,136,137]),import.meta.url)),Yk=6;function Xk(e){let t=(0,$.c)(41),{sessionsDockOpen:n}=e,r=n===void 0?!1:n,{_:i}=xn(),a=u()||r,[o,s]=(0,Q.useState)(null),c=ef(),{createBlank:l}=JS(),{skills:d,isPending:f}=If(),p;t[0]===d?p=t[1]:(p=d.slice(0,Yk),t[0]=d,t[1]=p);let m=p,h=f||m.length>0,g;t[2]===i?g=t[3]:(g=i({id:`ivwdwq`}),t[2]=i,t[3]=g);let _;t[4]===i?_=t[5]:(_=i({id:`6Mbe-P`}),t[4]=i,t[5]=_);let v;t[6]!==g||t[7]!==_?(v=(0,Z.jsx)(aO,{title:g,subtitle:_,celebrateSignal:0}),t[6]=g,t[7]=_,t[8]=v):v=t[8];let y;t[9]===a?y=t[10]:(y=a?null:(0,Z.jsx)(nO,{scenario:`skill`}),t[9]=a,t[10]=y);let b;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(b=()=>s(`upload`),t[11]=b):b=t[11];let x;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`sm`,onClick:b,"data-testid":`skill-source-upload`,className:`gap-1.5 font-normal text-muted-foreground hover:text-foreground`,children:[(0,Z.jsx)(Et,{"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(Y,{id:`mShKiV`})]}),t[12]=x):x=t[12];let S;t[13]===l?S=t[14]:(S=()=>void l(`project`),t[13]=l,t[14]=S);let C,w;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(Ur,{"aria-hidden":`true`,className:`size-3.5`}),w=(0,Z.jsx)(Y,{id:`dJXrT9`}),t[15]=C,t[16]=w):(C=t[15],w=t[16]);let T;t[17]===S?T=t[18]:(T=(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`sm`,onClick:S,"data-testid":`skill-source-new`,className:`gap-1.5 font-normal text-muted-foreground hover:text-foreground`,children:[C,w]}),t[17]=S,t[18]=T);let E;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(E=()=>s(`skills-sh`),t[19]=E):E=t[19];let D;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`sm`,onClick:E,"data-testid":`skill-source-skills-sh`,className:`gap-1.5 font-normal text-muted-foreground hover:text-foreground`,children:[(0,Z.jsx)(py,{"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(Y,{id:`EBS8_X`})]}),t[20]=D):D=t[20];let O;t[21]===T?O=t[22]:(O=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1`,children:[x,T,D]}),t[21]=T,t[22]=O);let k;t[23]!==O||t[24]!==y?(k=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[y,O]}),t[23]=O,t[24]=y,t[25]=k):k=t[25];let A;t[26]!==i||t[27]!==m||t[28]!==f||t[29]!==h?(A=h?(0,Z.jsx)(Pf,{scope:`project`,results:m,pending:f,skeletonCount:Yk,testId:`skills-popular`,loadingLabel:i({id:`JDHcCM`}),label:(0,Z.jsx)(Y,{id:`3v62tp`}),action:f?null:(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>s(`skills-sh`),"data-testid":`skill-popular-browse-all`,className:`h-auto gap-1 py-0.5 font-mono text-2xs uppercase tracking-wider text-muted-foreground hover:text-foreground`,children:[(0,Z.jsx)(Y,{id:`O-m8q9`}),(0,Z.jsx)(Nl,{"aria-hidden":`true`,className:`size-3`})]})}):null,t[26]=i,t[27]=m,t[28]=f,t[29]=h,t[30]=A):A=t[30];let j;t[31]!==k||t[32]!==A||t[33]!==v?(j=(0,Z.jsxs)(`div`,{className:`my-auto w-full max-w-4xl space-y-6`,children:[v,k,A]}),t[31]=k,t[32]=A,t[33]=v,t[34]=j):j=t[34];let M;t[35]!==o||t[36]!==c?(M=o===null?null:(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(Jk,{defaultScope:`project`,defaultTab:o,open:!0,onOpenChange:e=>{e||s(null)},onImported:e=>{let{scope:t,name:n}=e;s(null),c(t,n)}})}),t[35]=o,t[36]=c,t[37]=M):M=t[37];let N;return t[38]!==j||t[39]!==M?(N=(0,Z.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col items-center overflow-auto subtle-scrollbar p-10`,children:[j,M]}),t[38]=j,t[39]=M,t[40]=N):N=t[40],N}function Zk(e){let t=null,n=()=>(t===null&&(t=e(),t.catch(()=>{})),t),r=(0,Q.lazy)(n);return r.preload=n,r}var Qk=Zk(()=>n(()=>import(`./SettingsDialogBody-CPUeqHjC.js`).then(e=>({default:e.SettingsDialogBody})),__vite__mapDeps([138,1,139,20,16,8,2,3,6,9,10,11,12,13,93,40,76,26,15,94,95,96,97,98,99,14,100,54,55,18,19,22,51,44,45,53,27,28,21,24,23,35,140,43,29,17,25,34,141,142,143,52,106,121,122,38,128,129,144,101,50,56,81,82,83,84,85,86,87,88,89,90,91,92,4,5,102,36,37,66,67,68,69,70,103,78,72,104,105,41,30,65,71,73,74,107,108,109,31,110,111,46,112,42,113,114,115,116,117,118,145,64,146,147,148,149,150,130,151,152,153,154,47,155,156,157,158,159,160,132,161,162,133,163,164,135,165,166,167,134,168,169]),import.meta.url));function $k(e){let t=(0,$.c)(9),{error:n}=e,{_:r}=xn(),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)(Y,{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)(X,{variant:`default`,onClick:eA,children:(0,Z.jsx)(Y,{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 eA(){return window.location.reload()}function tA(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(Xn,{fallbackRender:rA,onError:nA,children:n}),t[0]=n,t[1]=r),r}function nA(e,t){console.error(`[SettingsDialogErrorBoundary] rendered fallback for Settings body`,e,t.componentStack)}function rA(e){return(0,Z.jsx)($k,{...e})}function iA(e=typeof window>`u`?void 0:window.location){return e?.protocol===`file:`}function aA(e){let{groups:t,translate:n}=e,r=[],i=new Set;for(let e of t)if(e.enabled)for(let t of e.items){i.add(t.id),r.push({id:`section:${t.id}`,kind:`section`,sectionId:t.id,label:t.label,context:e.label,keywords:[e.label]});for(let n of t.subsections??[])r.push({id:`subsection:${t.id}:${n.id}`,kind:`field`,sectionId:t.id,label:n.label,context:`${e.label} → ${t.label}`,keywords:[e.label,t.label],targetField:n.anchor})}for(let e of Ku)if(i.has(e.sectionId))for(let t of e.fields){let i=t.path.join(`.`);r.push({id:`field:${e.sectionId}:${i}`,kind:`field`,sectionId:e.sectionId,label:n(t.label),keywords:t.description?[n(t.description)]:[],targetField:i})}if(i.has(`plugin:markdownlint`))for(let e of ds)r.push({id:`rule:${e.id}`,kind:`rule`,sectionId:`plugin:markdownlint`,label:e.name,keywords:[e.id,e.alias,...e.aliases],ruleId:e.id});return r}function oA(e){return`https://github.com/inkeep/open-knowledge/releases/tag/v${encodeURIComponent(e)}`}var sA={"content-rules":{sectionId:`project-preferences`,anchor:`section:content-rules`},terminal:{sectionId:`project-preferences`,anchor:`section:terminal`},sharing:{sectionId:`sync`,anchor:`section:sharing`}};function cA(e){let t=sA[e];return t?{sectionId:t.sectionId,anchor:t.anchor}:{sectionId:e,anchor:null}}function lA(e){return cA(e).sectionId}function uA(e){let t=(0,$.c)(50),{open:n,initialSection:r,onOpenChange:i}=e,a=r===void 0?null:r,{_:o}=xn(),{collabUrl:s}=Ke(),{userBinding:c,userSynced:l,okignoreBinding:u,okignoreSynced:d,projectConfig:f,merged:p}=Gc(),{desktopPresent:m}=td(),h=a??`preferences`,g;t[0]===h?g=t[1]:(g=lA(h),t[0]=h,t[1]=g);let[_,v]=(0,Q.useState)(g),[y,b]=(0,Q.useState)(``),[x,S]=(0,Q.useState)(null),[C,w]=(0,Q.useState)(null),T=(0,Q.useRef)(0),E=(0,Q.useRef)(null),D,O;t[2]!==a||t[3]!==n?(D=()=>{if(n){let e=cA(a??`preferences`);v(e.sectionId),S(e.anchor?{path:e.anchor}:null),b(``)}},O=[n,a],t[2]=a,t[3]=n,t[4]=D,t[5]=O):(D=t[4],O=t[5]),(0,Q.useEffect)(D,O);let k,A;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(k=()=>tc(e=>{let t=cA(e);v(t.sectionId),t.anchor&&S({path:t.anchor})}),A=[],t[6]=k,t[7]=A):(k=t[6],A=t[7]),(0,Q.useEffect)(k,A);let j,M;t[8]===x?(j=t[9],M=t[10]):(j=()=>{if(!x)return;let e=E.current;if(!e)return;let t=null,n=null,r=null,i=null,a=()=>{let r=e.querySelector(`[data-field="${x.path}"]`);return r?(r.scrollIntoView({block:`center`}),r.classList.add(`animate-settings-nav-flash`),t=r,n=setTimeout(()=>r.classList.remove(`animate-settings-nav-flash`),750),!0):!1};return a()||(i=new MutationObserver(()=>{a()&&i?.disconnect()}),i.observe(e,{childList:!0,subtree:!0}),r=setTimeout(()=>i?.disconnect(),4e3)),()=>{i?.disconnect(),n&&clearTimeout(n),r&&clearTimeout(r),t?.classList.remove(`animate-settings-nav-flash`)}},M=[x],t[8]=x,t[9]=j,t[10]=M),(0,Q.useEffect)(j,M);let N=s!==null,P;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(P=Yu(),t[11]=P):P=t[11];let F=P,I;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(I=Qu(),t[12]=I):I=t[12];let L=I,R,z;if(t[13]!==o||t[14]!==m||t[15]!==N||t[16]!==p?.appearance?.colorThemeEnabled||t[17]!==p?.slides?.enabled||t[18]!==f?.contentRules){let e;t[21]===f?.contentRules?e=t[22]:(e=e=>f?.contentRules?.[e.id]?.enabled===!0,t[21]=f?.contentRules,t[22]=e);let n=Pu.filter(e).map(dA),r=p?.appearance?.colorThemeEnabled!==!1,i=p?.slides?.enabled===!0,a=iA();R=[{id:`user`,label:o({id:`7PzzBU`}),enabled:!0,items:[{id:`preferences`,label:o({id:`Q6hhn8`})},{id:`configure-agents`,label:o({id:`jRAGrQ`})},{id:`hotkeys`,label:o({id:`4KmEoC`})},{id:`account`,label:o({id:`AeXO77`})},{id:`user-plugins-manage`,label:o({id:`ohUJJM`})},{id:`user-skills`,label:o({id:`w7LRoP`})},...F?[{id:`ai-tools`,label:o({id:`_5qBNl`})}]:[]]},{id:`project`,label:o({id:`ZWyHmq`}),enabled:N,items:[{id:`project-preferences`,label:o({id:`Q6hhn8`}),subsections:[{id:`attachments`,label:o({id:`w_Sphq`}),anchor:`content.attachmentFolderPath`},{id:`content-rules`,label:o({id:`OPOiKn`}),anchor:`section:content-rules`},...L?[{id:`terminal`,label:o({id:`ALhMYW`}),anchor:`section:terminal`}]:[]]},{id:`sync`,label:o({id:`AznQ2V`}),subsections:[{id:`sharing`,label:o({id:`cs4mps`}),anchor:`section:sharing`}]},{id:`search`,label:o({id:`A1taO8`})},{id:`plugins-manage`,label:o({id:`ohUJJM`})},...a?[]:[{id:`link-previews`,label:o({id:`gh27t1`})}],...F?[{id:`project-ai-tools`,label:o({id:`crqzW5`})}]:[],...F?[{id:`network-access`,label:o({id:`d02jS3`})}]:[],{id:`project-templates`,label:o({id:`iTylMl`})},{id:`skills`,label:o({id:`w7LRoP`})},{id:`okignore`,label:o({id:`3zyg_A`})}]},{id:`plugins`,label:o({id:`ohUJJM`}),enabled:!0,items:[...N?n:[],...r?[{id:`plugin:theme`,label:o({id:`fJ3EbT`})}]:[],...i?[{id:`plugin:slides`,label:o({id:`f14doC`})}]:[]]},{id:`integrations`,label:o({id:`nbfdhU`}),enabled:!0,items:[]}],z=aA({groups:R,translate:o}),t[13]=o,t[14]=m,t[15]=N,t[16]=p?.appearance?.colorThemeEnabled,t[17]=p?.slides?.enabled,t[18]=f?.contentRules,t[19]=R,t[20]=z}else R=t[19],z=t[20];let B=z,V;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(V=function(e){T.current+=1;let t=T.current;v(e.sectionId),e.kind===`field`&&e.targetField?S({path:e.targetField}):e.kind===`rule`&&e.ruleId&&w({query:e.ruleId,nonce:t}),b(``)},t[23]=V):V=t[23];let H=V,U;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(Pp,{className:`sr-only`,children:(0,Z.jsx)(Y,{id:`Tz0i8g`})}),t[24]=U):U=t[24];let ee;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Z.jsx)(Np,{className:`sr-only`,children:(0,Z.jsx)(Y,{id:`RDrXh4`})}),t[25]=ee):ee=t[25];let W;t[26]!==_||t[27]!==R||t[28]!==B||t[29]!==y?(W=(0,Z.jsx)(fA,{groups:R,activeId:_,onSelect:v,entries:B,searchQuery:y,onSearchChange:b,onNavigate:H}),t[26]=_,t[27]=R,t[28]=B,t[29]=y,t[30]=W):W=t[30];let te;t[31]===o?te=t[32]:(te=o({id:`OXb_Df`}),t[31]=o,t[32]=te);let G;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,Z.jsx)(bA,{}),t[33]=G):G=t[33];let K=l?c:null,q;t[34]!==_||t[35]!==u||t[36]!==d||t[37]!==C||t[38]!==K?(q=(0,Z.jsx)(tA,{children:(0,Z.jsx)(Q.Suspense,{fallback:G,children:(0,Z.jsx)(Qk,{activeId:_,userBinding:K,okignoreBinding:u,okignoreSynced:d,markdownlintRuleQuery:C})})}),t[34]=_,t[35]=u,t[36]=d,t[37]=C,t[38]=K,t[39]=q):q=t[39];let ne;t[40]!==te||t[41]!==q?(ne=(0,Z.jsx)(`section`,{ref:E,"aria-label":te,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain subtle-scrollbar p-6`,tabIndex:0,children:q}),t[40]=te,t[41]=q,t[42]=ne):ne=t[42];let re;t[43]!==W||t[44]!==ne?(re=(0,Z.jsxs)(Fp,{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:[U,ee,W,ne]}),t[43]=W,t[44]=ne,t[45]=re):re=t[45];let J;return t[46]!==i||t[47]!==n||t[48]!==re?(J=(0,Z.jsx)(Bp,{open:n,onOpenChange:i,children:re}),t[46]=i,t[47]=n,t[48]=re,t[49]=J):J=t[49],J}function dA(e){return{id:`plugin:${e.id}`,label:e.label}}function fA(e){let t=(0,$.c)(46),{groups:n,activeId:r,onSelect:i,entries:a,searchQuery:o,onSearchChange:s,onNavigate:c}=e,{_:l}=xn(),u,d,f,p,m,h,g,_,v,y;if(t[0]!==l||t[1]!==a||t[2]!==c||t[3]!==s||t[4]!==o){d=o.trim();let e=d===``?[]:a.filter(e=>cS(e.label,d,e.keywords)),n=e.filter(hA),r=e.filter(mA),i=e.filter(pA);t[15]===l?v=t[16]:(v=l({id:`y1t8bQ`}),t[15]=l,t[16]=v),y=`flex shrink-0 gap-x-3 overflow-x-auto overscroll-contain subtle-scrollbar scroll-fade-mask-x-max-sm border-b bg-muted/30 px-3 py-2 max-sm:pt-10 sm:h-full sm:min-h-0 sm:flex-col sm:gap-0 sm:overflow-x-visible sm:border-r sm:border-b-0 sm:py-4`,u=Ae,f=!1,p=`h-auto w-full shrink-0 bg-transparent sm:mb-3 [&_[data-slot=command-input-wrapper]]:h-9 [&_[data-slot=command-input-wrapper]]:rounded-lg [&_[data-slot=command-input-wrapper]]:border [&_[data-slot=command-input-wrapper]]:border-input`,m=`settings-search`;let b;t[17]===l?b=t[18]:(b=l({id:`1DahsC`}),t[17]=l,t[18]=b),t[19]!==s||t[20]!==o||t[21]!==b?(h=(0,Z.jsx)(k,{value:o,onValueChange:s,placeholder:b,className:`py-0`,"data-testid":`settings-search-input`}),t[19]=s,t[20]=o,t[21]=b,t[22]=h):h=t[22];let x=d===``?null:(0,Z.jsx)(Y,{id:`TQJCR6`,values:{0:e.length}});t[23]===x?g=t[24]:(g=(0,Z.jsx)(`span`,{"aria-live":`polite`,className:`sr-only`,"data-testid":`settings-search-result-count`,children:x}),t[23]=x,t[24]=g),_=d===``?null:(0,Z.jsxs)(Kt,{"data-testid":`settings-search-results`,className:`mt-1.5`,children:[(0,Z.jsx)(De,{"data-testid":`settings-search-empty`,children:(0,Z.jsx)(Y,{id:`ljFWEt`})}),n.length>0?(0,Z.jsx)(Ne,{heading:l({id:`R4OWFD`}),children:n.map(e=>(0,Z.jsx)(gA,{entry:e,query:d,onNavigate:c},e.id))}):null,r.length>0?(0,Z.jsx)(Ne,{heading:l({id:`Tz0i8g`}),children:r.map(e=>(0,Z.jsx)(gA,{entry:e,query:d,onNavigate:c},e.id))}):null,i.length>0?(0,Z.jsx)(Ne,{heading:l({id:`v2a04T`}),children:i.map(e=>(0,Z.jsx)(gA,{entry:e,query:d,onNavigate:c},e.id))}):null]}),t[0]=l,t[1]=a,t[2]=c,t[3]=s,t[4]=o,t[5]=u,t[6]=d,t[7]=f,t[8]=p,t[9]=m,t[10]=h,t[11]=g,t[12]=_,t[13]=v,t[14]=y}else u=t[5],d=t[6],f=t[7],p=t[8],m=t[9],h=t[10],g=t[11],_=t[12],v=t[13],y=t[14];let b;t[25]!==u||t[26]!==f||t[27]!==p||t[28]!==m||t[29]!==h||t[30]!==g||t[31]!==_?(b=(0,Z.jsxs)(u,{shouldFilter:f,className:p,"data-testid":m,children:[h,g,_]}),t[25]=u,t[26]=f,t[27]=p,t[28]=m,t[29]=h,t[30]=g,t[31]=_,t[32]=b):b=t[32];let x;t[33]!==r||t[34]!==n||t[35]!==i||t[36]!==d?(x=d===``?n.map(e=>(0,Z.jsx)(yA,{group:e,activeId:r,onSelect:i},e.id)):null,t[33]=r,t[34]=n,t[35]=i,t[36]=d,t[37]=x):x=t[37];let S;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(vA,{}),t[38]=S):S=t[38];let C;t[39]===x?C=t[40]:(C=(0,Z.jsxs)(`div`,{className:`contents subtle-scrollbar sm:flex sm:min-h-0 sm:flex-1 sm:flex-col sm:overflow-y-auto sm:overscroll-contain`,children:[x,S]}),t[39]=x,t[40]=C);let w;return t[41]!==C||t[42]!==v||t[43]!==y||t[44]!==b?(w=(0,Z.jsxs)(`nav`,{"aria-label":v,className:y,children:[b,C]}),t[41]=C,t[42]=v,t[43]=y,t[44]=b,t[45]=w):w=t[45],w}function pA(e){return e.kind===`rule`}function mA(e){return e.kind===`field`}function hA(e){return e.kind===`section`}function gA(e){let t=(0,$.c)(16),{entry:n,query:r,onNavigate:i}=e,a=n.id,o;t[0]!==n||t[1]!==i?(o=()=>i(n),t[0]=n,t[1]=i,t[2]=o):o=t[2];let s=`settings-search-result-${n.id}`,c;t[3]!==n.label||t[4]!==r?(c=aS(n.label,r).map(_A),t[3]=n.label,t[4]=r,t[5]=c):c=t[5];let l;t[6]===c?l=t[7]:(l=(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:c}),t[6]=c,t[7]=l);let u;t[8]===n.context?u=t[9]:(u=n.context===void 0?null:(0,Z.jsx)(`span`,{className:`ms-auto shrink-0 truncate ps-3 text-1sm text-muted-foreground`,children:n.context}),t[8]=n.context,t[9]=u);let d;return t[10]!==n.id||t[11]!==o||t[12]!==s||t[13]!==l||t[14]!==u?(d=(0,Z.jsxs)(H,{value:a,onSelect:o,"data-testid":s,children:[l,u]}),t[10]=n.id,t[11]=o,t[12]=s,t[13]=l,t[14]=u,t[15]=d):d=t[15],d}function _A(e){return e.match?(0,Z.jsx)(`span`,{className:`font-semibold text-foreground`,children:e.text},e.start):(0,Z.jsx)(`span`,{children:e.text},e.start)}function vA(){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=oA(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:Qn(`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)(Y,{id:`_PACVa`}),(0,Z.jsx)(Fl,{className:`size-3`,"aria-hidden":`true`})]})]}),e[3]=s):s=e[3],s}function yA(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=Qn(`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)(Y,{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:Qn(`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 bA(){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)(Y,{id:`GsBUCk`})}),n=(0,Z.jsx)(Ch,{className:`h-5 w-32`}),r=(0,Z.jsx)(Ch,{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)(Ch,{className:`h-9 w-full`}),(0,Z.jsx)(Ch,{className:`h-9 w-full`})]})]}),e[3]=i):i=e[3],i}function xA(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Qn(`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)(ID,{"data-slot":`resizable-panel-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function SA(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)(BD,{"data-slot":`resizable-panel`,...n}),t[2]=n,t[3]=r),r}function CA(e){let t=(0,$.c)(14),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({withHandle:a,className:r,children:n,...i}=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=Qn(`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`,r),t[5]=r,t[6]=o);let s;t[7]===a?s=t[8]:(s=a&&(0,Z.jsx)(`div`,{className:`z-10 flex h-6 w-1 shrink-0 rounded-lg bg-border`}),t[7]=a,t[8]=s);let c;return t[9]!==n||t[10]!==i||t[11]!==o||t[12]!==s?(c=(0,Z.jsxs)(WD,{"data-slot":`resizable-handle`,className:o,...i,children:[s,n]}),t[9]=n,t[10]=i,t[11]=o,t[12]=s,t[13]=c):c=t[13],c}function wA(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}=xn(),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)(Y,{id:`KujtjC`})}),t[15]=A):A=t[15];let j;t[16]===u?j=t[17]:(j=e=>u(e.target.value),t[16]=u,t[17]=j);let M;t[18]===b?M=t[19]:(M=b({id:`KujtjC`}),t[18]=b,t[19]=M);let N;t[20]!==n||t[21]!==E||t[22]!==r||t[23]!==j||t[24]!==M?(N=(0,Z.jsx)(sg,{ref:n,id:`ok-find-input`,value:r,onChange:j,onKeyDown:E,placeholder:M,autoComplete:`off`,spellCheck:!1,className:`h-7 px-2 text-sm`}),t[20]=n,t[21]=E,t[22]=r,t[23]=j,t[24]=M,t[25]=N):N=t[25];let P;t[26]===b?P=t[27]:(P=b({id:`-8PP0T`}),t[26]=b,t[27]=P);let F;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(Jl,{"aria-hidden":`true`}),t[28]=F):F=t[28];let I;t[29]!==o||t[30]!==p||t[31]!==P?(I=(0,Z.jsx)(_r,{asChild:!0,children:(0,Z.jsx)(fa,{type:`button`,variant:`segmented`,size:`sm`,"aria-label":P,pressed:o,onPressedChange:p,className:`size-6 min-w-6 px-0`,children:F})}),t[29]=o,t[30]=p,t[31]=P,t[32]=I):I=t[32];let L;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(vr,{side:`bottom`,children:(0,Z.jsx)(Y,{id:`-8PP0T`})}),t[33]=L):L=t[33];let R;t[34]===I?R=t[35]:(R=(0,Z.jsxs)(br,{children:[I,L]}),t[34]=I,t[35]=R);let z;t[36]===b?z=t[37]:(z=b({id:`_7UQ7y`}),t[36]=b,t[37]=z);let B;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsx)(_b,{"aria-hidden":`true`}),t[38]=B):B=t[38];let V;t[39]!==m||t[40]!==z||t[41]!==s?(V=(0,Z.jsx)(_r,{asChild:!0,children:(0,Z.jsx)(fa,{type:`button`,variant:`segmented`,size:`sm`,"aria-label":z,pressed:s,onPressedChange:m,className:`size-6 min-w-6 px-0`,children:B})}),t[39]=m,t[40]=z,t[41]=s,t[42]=V):V=t[42];let H;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Z.jsx)(vr,{side:`bottom`,children:(0,Z.jsx)(Y,{id:`_7UQ7y`})}),t[43]=H):H=t[43];let U;t[44]===V?U=t[45]:(U=(0,Z.jsxs)(br,{children:[V,H]}),t[44]=V,t[45]=U);let ee;t[46]!==R||t[47]!==U?(ee=(0,Z.jsxs)(og,{align:`inline-end`,className:`gap-0.5`,children:[R,U]}),t[46]=R,t[47]=U,t[48]=ee):ee=t[48];let W;t[49]!==ee||t[50]!==N?(W=(0,Z.jsxs)(cg,{className:`h-7 w-56 rounded-[min(var(--radius-md),12px)]`,children:[N,ee]}),t[49]=ee,t[50]=N,t[51]=W):W=t[51];let te;t[52]===w?te=t[53]:(te=(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]=te);let G;t[54]===b?G=t[55]:(G=b({id:`oqB2ez`}),t[54]=b,t[55]=G);let K=!S,q;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,Z.jsx)(Ji,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[56]=q):q=t[56];let ne;t[57]!==g||t[58]!==G||t[59]!==K?(ne=(0,Z.jsx)(_r,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":G,disabled:K,onClick:g,children:q})}),t[57]=g,t[58]=G,t[59]=K,t[60]=ne):ne=t[60];let re;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Z.jsx)(vr,{side:`bottom`,children:(0,Z.jsx)(Y,{id:`oqB2ez`})}),t[61]=re):re=t[61];let J;t[62]===ne?J=t[63]:(J=(0,Z.jsxs)(br,{children:[ne,re]}),t[62]=ne,t[63]=J);let ie;t[64]===b?ie=t[65]:(ie=b({id:`SiUUCS`}),t[64]=b,t[65]=ie);let ae=!S,oe;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,Z.jsx)(Zl,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[66]=oe):oe=t[66];let se;t[67]!==h||t[68]!==ie||t[69]!==ae?(se=(0,Z.jsx)(_r,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":ie,disabled:ae,onClick:h,children:oe})}),t[67]=h,t[68]=ie,t[69]=ae,t[70]=se):se=t[70];let ce;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(ce=(0,Z.jsx)(vr,{side:`bottom`,children:(0,Z.jsx)(Y,{id:`SiUUCS`})}),t[71]=ce):ce=t[71];let le;t[72]===se?le=t[73]:(le=(0,Z.jsxs)(br,{children:[se,ce]}),t[72]=se,t[73]=le);let ue=a?`secondary`:`ghost`,de;t[74]!==b||t[75]!==a?(de=b(a?{id:`UkQGhd`}:{id:`1RluQD`}),t[74]=b,t[75]=a,t[76]=de):de=t[76];let fe=a?`ok-replace-input`:void 0,pe;t[77]!==f||t[78]!==a?(pe=()=>f(!a),t[77]=f,t[78]=a,t[79]=pe):pe=t[79];let me;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,Z.jsx)(Jy,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[80]=me):me=t[80];let he;t[81]!==a||t[82]!==ue||t[83]!==de||t[84]!==fe||t[85]!==pe?(he=(0,Z.jsx)(_r,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:ue,size:`icon-sm`,"aria-label":de,"aria-expanded":a,"aria-controls":fe,onClick:pe,children:me})}),t[81]=a,t[82]=ue,t[83]=de,t[84]=fe,t[85]=pe,t[86]=he):he=t[86];let ge;t[87]===a?ge=t[88]:(ge=(0,Z.jsx)(vr,{side:`bottom`,children:a?(0,Z.jsx)(Y,{id:`UkQGhd`}):(0,Z.jsx)(Y,{id:`1RluQD`})}),t[87]=a,t[88]=ge);let _e;t[89]!==he||t[90]!==ge?(_e=(0,Z.jsxs)(br,{children:[he,ge]}),t[89]=he,t[90]=ge,t[91]=_e):_e=t[91];let ve;t[92]!==b||t[93]!==O||t[94]!==S||t[95]!==v||t[96]!==_||t[97]!==d||t[98]!==a||t[99]!==i?(ve=a?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`label`,{className:`sr-only`,htmlFor:`ok-replace-input`,children:(0,Z.jsx)(Y,{id:`fqSfXY`})}),(0,Z.jsx)(Op,{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)(br,{children:[(0,Z.jsx)(_r,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":b({id:`bS_boY`}),disabled:!S,onClick:_,children:(0,Z.jsx)(Jy,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(vr,{side:`bottom`,children:(0,Z.jsx)(Y,{id:`bS_boY`})})]}),(0,Z.jsxs)(br,{children:[(0,Z.jsx)(_r,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":b({id:`dr1vFs`}),disabled:!S,onClick:v,children:(0,Z.jsx)(qy,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(vr,{side:`bottom`,children:(0,Z.jsx)(Y,{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]=ve):ve=t[100];let ye;t[101]===b?ye=t[102]:(ye=b({id:`wJo9oS`}),t[101]=b,t[102]=ye);let be;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(be=(0,Z.jsx)(Gf,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[103]=be):be=t[103];let xe;t[104]!==y||t[105]!==ye?(xe=(0,Z.jsx)(_r,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":ye,onClick:y,children:be})}),t[104]=y,t[105]=ye,t[106]=xe):xe=t[106];let Se;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(Se=(0,Z.jsx)(vr,{side:`bottom`,children:(0,Z.jsx)(Y,{id:`yz7wBu`})}),t[107]=Se):Se=t[107];let Ce;t[108]===xe?Ce=t[109]:(Ce=(0,Z.jsxs)(br,{children:[xe,Se]}),t[108]=xe,t[109]=Ce);let we;return t[110]!==W||t[111]!==te||t[112]!==J||t[113]!==le||t[114]!==k||t[115]!==_e||t[116]!==ve||t[117]!==Ce?(we=(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,W,te,J,le,_e,ve,Ce]}),t[110]=W,t[111]=te,t[112]=J,t[113]=le,t[114]=k,t[115]=_e,t[116]=ve,t[117]=Ce,t[118]=we):we=t[118],we}var TA={current:0,total:0},EA=120,DA=100;function OA(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=()=>e?on(e):null,t[0]=e,t[1]=n),(0,Q.useSyncExternalStore)(v,n,kA)}function kA(){return null}function AA(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,`
5
5
  `,`
6
6
  `).trim();return i.length===0||i.length>EA||i.includes(`
7
7
  `)?null:i}function jA(e){let t=Bt(e.state);return{current:t.matches.length===0?0:t.activeIndex+1,total:t.matches.length}}function MA(e,t){return e.current===t.current&&e.total===t.total}function NA(e,t,n){e&&!e.isDestroyed&&(e.commands.clearFindMatches(),e.commands.focus()),t(e=>({...e,open:!1,activeIndex:0})),n(TA)}function PA(e){!e||e.isDestroyed||typeof window>`u`||window.requestAnimationFrame(()=>{if(e.isDestroyed)return;let t=Yr(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 FA(e){let t=(0,$.c)(81),{activeDocName:n,isSourceMode:r}=e,i=OA(n),a=(0,Q.useRef)(null),o=(0,Q.useRef)(null),s=(0,Q.useRef)(n),c=(0,Q.useRef)(0),l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l={open:!1,replaceOpen:!1,query:``,replacement:``,caseSensitive:!1,wholeWord:!1,activeIndex:0},t[0]=l):l=t[0];let[u,d]=(0,Q.useState)(l),[f,p]=(0,Q.useState)(TA),m,h;t[1]===n?(m=t[2],h=t[3]):(m=()=>{s.current!==n&&(s.current=n,d(LA))},h=[n],t[1]=n,t[2]=m,t[3]=h),(0,Q.useEffect)(m,h);let g,_;t[4]===u.activeIndex?(g=t[5],_=t[6]):(g=()=>{c.current=u.activeIndex},_=[u.activeIndex],t[4]=u.activeIndex,t[5]=g,t[6]=_),(0,Q.useEffect)(g,_);let v,y;t[7]===i?(v=t[8],y=t[9]):(v=()=>{let e=o.current;e&&e!==i&&!e.isDestroyed&&e.commands.clearFindMatches(),o.current=i},y=[i],t[7]=i,t[8]=v,t[9]=y),(0,Q.useEffect)(v,y);let b,x;t[10]===u.open?(b=t[11],x=t[12]):(b=()=>{if(!u.open||!a.current)return;let e=requestAnimationFrame(()=>{a.current?.focus(),a.current?.select()});return()=>cancelAnimationFrame(e)},x=[u.open],t[10]=u.open,t[11]=b,t[12]=x),(0,Q.useEffect)(b,x);let S,C;t[13]!==u.open||t[14]!==r?(S=()=>{!u.open||!r||d(IA)},C=[u.open,r],t[13]=u.open,t[14]=r,t[15]=S,t[16]=C):(S=t[15],C=t[16]),(0,Q.useEffect)(S,C);let w,T;t[17]!==i||t[18]!==u.caseSensitive||t[19]!==u.open||t[20]!==u.query||t[21]!==u.wholeWord||t[22]!==r?(w=()=>{if(!i||i.isDestroyed){p(TA);return}if(!u.open||r){i.commands.clearFindMatches(),p(TA);return}let e=window.setTimeout(()=>{if(i.isDestroyed)return;i.commands.setFindQuery(u.query,{options:{caseSensitive:u.caseSensitive,wholeWord:u.wholeWord},activeIndex:c.current});let e=jA(i);p(t=>MA(t,e)?t:e)},DA);return()=>window.clearTimeout(e)},T=[i,u.open,u.query,u.caseSensitive,u.wholeWord,r],t[17]=i,t[18]=u.caseSensitive,t[19]=u.open,t[20]=u.query,t[21]=u.wholeWord,t[22]=r,t[23]=w,t[24]=T):(w=t[23],T=t[24]),(0,Q.useEffect)(w,T);let E,D;t[25]!==i||t[26]!==u.open||t[27]!==r?(E=()=>{if(!i||i.isDestroyed||!u.open||r)return;let e=()=>{let e=Bt(i.state),t=jA(i);p(e=>MA(e,t)?e:t),d(t=>t.activeIndex===e.activeIndex?t:{...t,activeIndex:e.activeIndex})};return i.on(`transaction`,e),()=>{i.off(`transaction`,e)}},D=[i,u.open,r],t[25]=i,t[26]=u.open,t[27]=r,t[28]=E,t[29]=D):(E=t[28],D=t[29]),(0,Q.useEffect)(E,D);let O,k;t[30]!==n||t[31]!==i||t[32]!==u.open||t[33]!==r?(O=()=>{let e=function(e){let t=AA(i);d(n=>({...n,open:!0,replaceOpen:e,query:t??n.query,activeIndex:0}))},t=function(t){if(!(!n||r||t.defaultPrevented)&&!pr()){if(rc(t,`find`)){t.preventDefault(),u.open?NA(i,d,p):e(!1);return}if(rc(t,`replace`)){t.preventDefault(),e(!0);return}if(u.open){let e=rc(t,`find-next`),n=rc(t,`find-previous`);if(e||n){t.preventDefault(),(n?i?.commands.selectPreviousFindMatch():i?.commands.selectNextFindMatch())&&PA(i);return}}t.key===`Escape`&&u.open&&(t.preventDefault(),NA(i,d,p))}};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},k=[n,i,u.open,r],t[30]=n,t[31]=i,t[32]=u.open,t[33]=r,t[34]=O,t[35]=k):(O=t[34],k=t[35]),(0,Q.useEffect)(O,k);let A;t[36]!==i||t[37]!==u.caseSensitive||t[38]!==u.query||t[39]!==u.wholeWord?(A=function(){return!i||i.isDestroyed?!1:(i.commands.setFindQuery(u.query,{options:{caseSensitive:u.caseSensitive,wholeWord:u.wholeWord},activeIndex:c.current}),!0)},t[36]=i,t[37]=u.caseSensitive,t[38]=u.query,t[39]=u.wholeWord,t[40]=A):A=t[40];let j=A,M;t[41]===i?M=t[42]:(M=function(){if(!i||i.isDestroyed)return;let e=Bt(i.state),t=jA(i);p(e=>MA(e,t)?e:t),d(t=>t.activeIndex===e.activeIndex?t:{...t,activeIndex:e.activeIndex})},t[41]=i,t[42]=M);let N=M,P;t[43]===i?P=t[44]:(P=function(){NA(i,d,p)},t[43]=i,t[44]=P);let F=P,I;t[45]!==j||t[46]!==i||t[47]!==N?(I=function(){!i||i.isDestroyed||(j(),i.commands.selectNextFindMatch()&&PA(i),N())},t[45]=j,t[46]=i,t[47]=N,t[48]=I):I=t[48];let L=I,R;t[49]!==j||t[50]!==i||t[51]!==N?(R=function(){!i||i.isDestroyed||(j(),i.commands.selectPreviousFindMatch()&&PA(i),N())},t[49]=j,t[50]=i,t[51]=N,t[52]=R):R=t[52];let z=R,B;t[53]!==j||t[54]!==i||t[55]!==u.replacement||t[56]!==N?(B=function(){!i||i.isDestroyed||(j(),i.commands.replaceCurrentFindMatch(u.replacement)&&PA(i),N())},t[53]=j,t[54]=i,t[55]=u.replacement,t[56]=N,t[57]=B):B=t[57];let V=B,H;t[58]!==j||t[59]!==i||t[60]!==u.replacement||t[61]!==N?(H=function(){!i||i.isDestroyed||(j(),i.commands.replaceAllFindMatches(u.replacement)&&PA(i),N())},t[58]=j,t[59]=i,t[60]=u.replacement,t[61]=N,t[62]=H):H=t[62];let U=H;if(!u.open||!n||r)return null;let ee,W,te,G,K;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(ee=e=>d(t=>({...t,query:e,activeIndex:0})),W=e=>d(t=>({...t,replacement:e})),te=e=>d(t=>({...t,replaceOpen:e})),G=e=>d(t=>({...t,caseSensitive:e})),K=e=>d(t=>({...t,wholeWord:e})),t[63]=ee,t[64]=W,t[65]=te,t[66]=G,t[67]=K):(ee=t[63],W=t[64],te=t[65],G=t[66],K=t[67]);let q;return t[68]!==F||t[69]!==u.caseSensitive||t[70]!==u.query||t[71]!==u.replaceOpen||t[72]!==u.replacement||t[73]!==u.wholeWord||t[74]!==f.current||t[75]!==f.total||t[76]!==U||t[77]!==V||t[78]!==L||t[79]!==z?(q=(0,Z.jsx)(`div`,{className:`editor-content-aligned pointer-events-none absolute inset-x-0 top-2 z-30 px-2`,children:(0,Z.jsx)(`div`,{className:`flex justify-end`,children:(0,Z.jsx)(wA,{findInputRef:a,query:u.query,replacement:u.replacement,replaceOpen:u.replaceOpen,caseSensitive:u.caseSensitive,wholeWord:u.wholeWord,current:f.current,total:f.total,onQueryChange:ee,onReplacementChange:W,onReplaceOpenChange:te,onCaseSensitiveChange:G,onWholeWordChange:K,onNext:L,onPrevious:z,onReplaceCurrent:V,onReplaceAll:U,onClose:F})})}),t[68]=F,t[69]=u.caseSensitive,t[70]=u.query,t[71]=u.replaceOpen,t[72]=u.replacement,t[73]=u.wholeWord,t[74]=f.current,t[75]=f.total,t[76]=U,t[77]=V,t[78]=L,t[79]=z,t[80]=q):q=t[80],q}function IA(e){return{...e,open:!1,activeIndex:0}}function LA(e){return{...e,activeIndex:0}}var RA=300;function zA(e,t){let n=(0,$.c)(4),[r,i]=(0,Q.useState)(Du),a,o;return n[0]!==t||n[1]!==e?(a=()=>{if(!e||!t){i(Du);return}let n=e.document.getText(`source`),r=!1,a=null,o=function(){r||i(hu(n.toString()))};o();let s=function(){a&&clearTimeout(a),a=setTimeout(o,RA)};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 BA(e){return e&&e.document.getMap(`lifecycle`).get(`status`)===`conflict`?`conflict`:null}function VA(e){let t=(0,$.c)(8),{poolEntries:n}=Ke(),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=()=>BA(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(BA(i));let t=()=>s(BA(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 HA(e,t){let n=(0,$.c)(3),r;return n[0]!==e||n[1]!==t?(r=()=>Cu(e,t),n[0]=e,n[1]=t,n[2]=r):r=n[2],(0,Q.useSyncExternalStore)(wu,r)}var UA=`ok-terminal-width-v1`;function WA(e){return Number.isFinite(e)?e<320?320:Math.round(e):480}function GA(e){try{let t=(e??localStorage).getItem(UA);if(t==null)return 480;let n=Number.parseInt(t,10);return Number.isFinite(n)?WA(n):480}catch{return 480}}function KA(e,t){try{(t??localStorage).setItem(UA,String(WA(e)))}catch{}}function qA(){try{return typeof localStorage>`u`?480:GA()}catch{return 480}}var JA=`ok-doc-panel-width-v1`;function YA(e){return Number.isFinite(e)?e<300?300:e>600?600:Math.round(e):320}function XA(e){try{let t=(e??localStorage).getItem(JA);if(t==null)return 320;let n=Number.parseInt(t,10);return Number.isFinite(n)?YA(n):320}catch{return 320}}function ZA(e,t){try{(t??localStorage).setItem(JA,String(YA(e)))}catch{}}function QA(){try{return typeof localStorage>`u`?320:XA()}catch{return 320}}var $A=1024,ej=1280,tj={left:$A,right:ej};function nj(e,t,n){return e==null?t>=tj[n]?`above`:`below`:`embedded`}function rj(e){return e===`above`?`open`:`collapsed`}var ij=`ok-sidebar-pins-v2`;function aj(e){return e===`open`||e===`collapsed`}function oj(e){return e===`above`||e===`below`||e===`embedded`}function sj(e){if(typeof e!=`object`||!e)return!1;let t=e;for(let e of Object.keys(t))if(!oj(e)||!aj(t[e]))return!1;return!0}function cj(e){let t=JSON.parse(e);if(typeof t!=`object`||!t)return{};let n=t,r={};return sj(n.left)&&(r.left=n.left),sj(n.right)&&(r.right=n.right),r}function lj(e){try{let t=(e??localStorage).getItem(ij);return t==null?{}:cj(t)}catch{return{}}}function uj(e,t){try{t.setItem(ij,JSON.stringify(e))}catch{}}function dj(e,t,n){return n[e]?.[t]??rj(t)}function fj(e,t,n,r){let i=r??localStorage,a=lj(i);return a[e]={...a[e],[t]:n},uj(a,i),a}var pj=`ok-onboarding-card-v1`,mj={initialized:!1,steps:{file:!1,askedAi:!1},fileBaseline:0,dismissed:!1,completed:!1};function hj(e){return e===!0}function gj(e){if(typeof e!=`object`||!e)return mj;let t=e,n=typeof t.steps==`object`&&t.steps!==null?t.steps:{};return{initialized:hj(t.initialized),steps:{file:hj(n.file),askedAi:hj(n.askedAi)},fileBaseline:typeof t.fileBaseline==`number`&&Number.isFinite(t.fileBaseline)&&t.fileBaseline>=0?t.fileBaseline:0,dismissed:hj(t.dismissed),completed:hj(t.completed)}}function _j(e){try{let t=(e??localStorage).getItem(pj);return t==null?mj:gj(JSON.parse(t))}catch(e){return console.warn(`[onboarding-card-store] readPersistedState failed (corrupt/privacy/SSR)`,e),mj}}function vj(e,t){try{(t??localStorage).setItem(pj,JSON.stringify(e))}catch(e){console.warn(`[onboarding-card-store] writePersistedState failed (quota/privacy/SSR)`,e)}}function yj(e){let t=_j(e),n=new Set,r=!1;function i(){for(let e of n)e()}function a(n){t=n,vj(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=_j(e),i())}}}var bj=yj();function xj(e){let t=e===void 0?bj:e;return(0,Q.useSyncExternalStore)(t.subscribe,t.getSnapshot,t.getSnapshot)}function Sj(){bj.install()}function Cj(e){return Gp(e).filter(e=>e.kind===`document`||e.kind===`folder`).length}async function wj(){let e=await fetch(`/api/documents`);if(!e.ok)throw Error(`documents request failed: ${e.status}`);let t=await e.json(),n=Qa.safeParse(t);if(!n.success)throw Error(`documents response did not match schema`,{cause:n.error});return Cj(n.data.documents)}async function Tj(e=bj){let t=e.getSnapshot();if(!(t.steps.file||!t.initialized))try{await wj()>t.fileBaseline&&e.markStepComplete(`file`)}catch(e){console.warn(`[onboarding-signals] file-step count read failed; leaving step incomplete`,e)}}function Ej(e=bj){e.getSnapshot().initialized&&e.markStepComplete(`askedAi`)}var Dj=`open-knowledge:open-ask-ai-composer`;function Oj(e=typeof window>`u`?new EventTarget:window){e.dispatchEvent(new CustomEvent(Dj))}function kj(e,t=typeof window>`u`?new EventTarget:window){let n=()=>e();return t.addEventListener(Dj,n),()=>t.removeEventListener(Dj,n)}var Aj=5200,jj=500,Mj=/\.(md|mdx)$/i;function Nj(e,t){return Mj.test(e)?e:t?`${e}${t}`:bl(e)}function Pj(e){return Mj.test(e)?e.replace(Mj,``):null}function Fj(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName.toUpperCase();return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`}function Ij(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),Aj);return()=>clearTimeout(e)}let e=setTimeout(()=>{i(Lj),o(!0)},jj);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 Lj(e){return e+1}function Rj(e){let t=(0,$.c)(105),{docName:n,surface:r,folderPath:i,dismissed:a,onDismiss:o,onReopen:s}=e,c=a===void 0?!1:a,{_:l}=xn(),u=i!==void 0,d=u?null:n??null,f=r??`wysiwyg`,p=Qi(),m=xl(),{pageMeta:h}=Lu(),{states:g,refresh:_}=nr(),v=di(),{dispatch:b}=gl(),x=fr(),[S]=(0,Q.useState)(Zj),[C,w]=(0,Q.useState)(null),[T,E]=(0,Q.useState)(!0),[D,O]=(0,Q.useState)(!1),k=(0,Q.useRef)(null),A=(0,Q.useRef)(null),[j]=(0,Q.useState)(Xj),M,N;t[0]!==c||t[1]!==n||t[2]!==u||t[3]!==r?(M=()=>{if(u||n==null)return;let e=document.documentElement,t=()=>{if(Mt(n))return;let e=[...document.querySelectorAll(`.editor-doc-scroll`)].filter(Yj);if(e.length===0)return;let t=!1,r=()=>{t=!0};window.addEventListener(`wheel`,r,{passive:!0}),window.addEventListener(`touchstart`,r,{passive:!0});let i=performance.now(),a=()=>{if(Mt(n)&&(t=!0),t||performance.now()-i>=300){window.removeEventListener(`wheel`,r),window.removeEventListener(`touchstart`,r);return}for(let t of e)t.scrollTop=t.scrollHeight-t.clientHeight;requestAnimationFrame(a)};requestAnimationFrame(a)},i=()=>{r===`wysiwyg`&&requestAnimationFrame(()=>{if(Mt(n))return;let e=on(n),t=A.current;if(!(!e||e.isDestroyed||!t))try{let n=e.view,r=n.coordsAtPos(e.state.selection.head).bottom-(t.getBoundingClientRect().top-28);if(r<=0)return;let i=n.dom.closest(`.editor-doc-scroll`);i instanceof HTMLElement&&(i.scrollTop+=r)}catch{}})},a=A.current;if(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`)}},N=[c,r,n,u],t[0]=c,t[1]=n,t[2]=u,t[3]=r,t[4]=M,t[5]=N):(M=t[4],N=t[5]),(0,Q.useEffect)(M,N);let P=(0,Q.useRef)(c),F=(0,Q.useRef)(s),I;t[6]!==c||t[7]!==s?(I=()=>{P.current=c,F.current=s},t[6]=c,t[7]=s,t[8]=I):I=t[8],(0,Q.useEffect)(I);let L,R;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(L=()=>kj(()=>{P.current?F.current?.():k.current?.focus()}),R=[],t[9]=L,t[10]=R):(L=t[9],R=t[10]),(0,Q.useEffect)(L,R);let z;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(z=[],t[11]=z):z=t[11],(0,Q.useEffect)(qj,z);let B=(0,Q.useRef)(c),V,H;t[12]===c?(V=t[13],H=t[14]):(V=()=>{let e=B.current;B.current=c,e&&!c&&k.current?.focus()},H=[c],t[12]=c,t[13]=V,t[14]=H),(0,Q.useEffect)(V,H);let U;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(U=[],t[15]=U):U=t[15];let[ee,W]=(0,Q.useState)(U),[te,G]=(0,Q.useState)(Kj),K=Of(),q=_f(),[ne,re]=(0,Q.useState)(!0),J=K>0&&ne,ie;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(ie=[],t[16]=ie):ie=t[16];let[ae,oe]=(0,Q.useState)(ie),se;t[17]!==n||t[18]!==u||t[19]!==h?(se=u||n==null?``:Nj(n,h.get(n)?.docExt),t[17]=n,t[18]=u,t[19]=h,t[20]=se):se=t[20];let ce=se,le,ue;t[21]!==ce||t[22]!==te||t[23]!==u||t[24]!==T?(le=()=>{u||T||W(e=>{if(te.has(ce))return e;let t=Pj(ce),n=t===null?e:e.filter(e=>e===ce||Pj(e)!==t);return n.includes(ce)?n.length===e.length?e:n:[...n,ce]})},ue=[u,T,ce,te],t[21]=ce,t[22]=te,t[23]=u,t[24]=T,t[25]=le,t[26]=ue):(le=t[25],ue=t[26]),(0,Q.useEffect)(le,ue);let de=u?i&&!te.has(i)&&!ae.includes(i)?[i]:[]:ee.filter(e=>!te.has(e)&&!ae.includes(e)),fe=Fd(d,f),pe=Fd(d,`frontmatter`),[me,he]=(0,Q.useState)(null),[ge,_e]=(0,Q.useState)(!1),ve,ye;t[27]===fe?(ve=t[28],ye=t[29]):(ve=()=>{fe&&he(fe)},ye=[fe],t[27]=fe,t[28]=ve,t[29]=ye),(0,Q.useEffect)(ve,ye);let be,xe;t[30]===pe?(be=t[31],xe=t[32]):(be=()=>{pe&&he(pe)},xe=[pe],t[30]=pe,t[31]=be,t[32]=xe),(0,Q.useEffect)(be,xe);let Se,Ce;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(Se=()=>y(()=>{he(null),_e(!1),re(!0)}),Ce=[],t[33]=Se,t[34]=Ce):(Se=t[33],Ce=t[34]),(0,Q.useEffect)(Se,Ce);let we=fi(),Te=pi(),Ee;t[35]===v?Ee=t[36]:(Ee=e=>gi(v,e.source,e.id,!0,e.supported),t[35]=v,t[36]=Ee);let De=Te.filter(Ee),Oe=mi(De,we),ke;t[37]===x?.installedClis?ke=t[38]:(ke=x?.installedClis??{},t[37]=x?.installedClis,t[38]=ke);let Ae=Cc({sticky:C??S,effectiveThreadAgent:Oe,enabledClis:x===null?[]:Hc(v,x.installedClis),enabledDesktopTargets:Tc(v,g),unresolvedDesktopTargets:hc(v,g),installedClis:ke,terminalAvailable:x!==null,threadsAvailable:!0,desktopSelectable:!0}),je=Ae.kind===`thread`,Me=Ae.kind===`cli`?Ae.cli:null,Ne=Me!==null,Pe=Ae.kind===`desktop`?hi.find(e=>e.id===Ae.target)??null:null,Fe=!D&&(!T||me!==null||J)&&(Ne||Pe!==null||je),Ie;t[39]!==v||t[40]!==g?(Ie=hi.filter(e=>xi(v,e.id,g[e.id]?.installed)),t[39]=v,t[40]=g,t[41]=Ie):Ie=t[41];let Le=Ie,Re;t[42]===g?Re=t[43]:(Re=hi.some(e=>g[e.id]?.installed==null),t[42]=g,t[43]=Re);let ze=Re,Be=x===null?void 0:Hc(v,x.installedClis).map(e=>{let{displayName:t}=Ao[e];return{cli:e,label:t,ariaLabel:l({id:`QYfQdv`,values:{displayName:t}}),selected:Me===e,onSelect:()=>Ge(e)}}),Ve;t[44]!==l||t[45]!==J?(Ve=J?[l({id:`NeQ_0G`})]:[l({id:`KYSocE`}),l({id:`7Ongq0`}),l({id:`HPTPGr`}),l({id:`qiRoLb`})],t[44]=l,t[45]=J,t[46]=Ve):Ve=t[46];let He=Ij(Ve,!p&&T&&!c&&!J),Ue;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(Ue=e=>{w(e.id),jc(e.id)},t[47]=Ue):Ue=t[47];let We=Ue,Ge=e=>{let t=mc(e);w(t),jc(t)},Ke;if(t[48]===Symbol.for(`react.memo_cache_sentinel`)){let e=()=>{w(_c),jc(_c)};Ke=t=>{ui(t),e()},t[48]=Ke}else Ke=t[48];let qe=Ke,Je=()=>{k.current?.clear(),he(null),_e(!1),W([]),G(new Set),re(!0),Xi()},Ye=async(e,t)=>{let n=t===void 0?!0:t,r=()=>{n&&Je()};if(e===null)return Us.error(l({id:`y8B54M`})),!1;if(je)return Jc(e,Oe===null?void 0:{agent:{source:Oe.source,id:Oe.id}}),Ej(),r(),!0;if(Me!==null&&x!==null){try{x.launchInTerminal(e,Me)}catch{return Us.error(l({id:`jBVUXo`})),!1}return Ej(),r(),!0}if(Pe===null)return Us.error(l({id:`teFjfG`})),!1;if(g[Pe.id]?.installed!==!0)return Xc(Pe),Us.info(l({id:`L1BQTH`,values:{0:Pe.displayName}})),r(),!1;O(!0);let i=await b(Pe.id,e).finally(()=>{O(!1),r()});return i.ok&&Ej(),i.ok},Xe=()=>{let{instruction:e,mentions:t}=k.current?.getContent()??{instruction:``,mentions:[]};if(u)return il({docName:null,folderRelativePath:i,workspace:m,instruction:e,mentions:[...new Set([...de,...t])].filter(e=>e!==i)});let r=me?sh(me):void 0,a=me?.docName??null,o=me?a:de.includes(ce)?n??null:null,s=o===null?null:Nj(o,h.get(o)?.docExt),c=[...new Set([...de,...t])].filter(e=>e!==s);return il({docName:o,...s===null?{}:{docRelativePath:s},workspace:m,instruction:e,mentions:c,selection:r})},Ze=()=>{if(Fe){if(J){Qe().catch(Gj);return}Ye(Xe())}},Qe=async()=>{let{instruction:e,mentions:t}=k.current?.getContent()??{instruction:``,mentions:[]};(await Nt({compose:async n=>{let r=il({docName:null,workspace:m,instruction:wf(n.map(Wj),e,me?{docName:me.docName,markdown:me.markdown}:void 0),mentions:[...new Set([...n.map(Uj),...de,...t])]});return r===null?(Us.error(l({id:`253MN6`})),!1):Ye(r,!1)}})).length>0&&Je()};if(c)return null;let $e=``,et=``;if(me){let e;t[49]!==h||t[50]!==me?(e=ch(me,Nj(me.docName,h.get(me.docName)?.docExt).split(`/`).pop()??``),t[49]=h,t[50]=me,t[51]=e):e=t[51],$e=e;let n;t[52]===me.markdown?n=t[53]:(n=uh(me.markdown),t[52]=me.markdown,t[53]=n),et=n}let tt;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(tt=e=>ta(e,k),t[54]=tt):tt=t[54];let nt;t[55]!==l||t[56]!==u||t[57]!==o?(nt=u?null:(0,Z.jsx)(X,{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)(Zl,{className:`size-3.5`,"aria-hidden":!0})}),t[55]=l,t[56]=u,t[57]=o,t[58]=nt):nt=t[58];let rt;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(rt=e=>G(t=>{let n=new Set(t);return n.add(e),n}),t[59]=rt):rt=t[59];let it;t[60]!==l||t[61]!==$e||t[62]!==et||t[63]!==me||t[64]!==ge?(it=me?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`span`,{"data-testid":`composer-selection-pill`,title:$e,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)(X,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":l({id:`irrm_E`}),onClick:()=>{he(null),_e(!1)},className:`group/remove relative size-3.5 shrink-0 rounded-sm text-muted-foreground/80 hover:text-foreground`,children:[(0,Z.jsx)(ub,{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)(Gf,{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)(X,{type:`button`,variant:`ghost`,"aria-expanded":ge,"aria-label":l(ge?{id:`UaDyeb`}:{id:`eTL5y9`}),onClick:()=>_e(Hj),"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:$e})})]}),ge&&et!==``?(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:et}):null]}):null,t[60]=l,t[61]=$e,t[62]=et,t[63]=me,t[64]=ge,t[65]=it):it=t[65];let at;t[66]!==ne||t[67]!==K||t[68]!==q?(at=K>0&&(0,Z.jsx)(kf,{count:K,docs:q,attached:ne,onAttach:()=>re(!0),onDismiss:()=>re(!1)}),t[66]=ne,t[67]=K,t[68]=q,t[69]=at):at=t[69];let ot;t[70]===l?ot=t[71]:(ot=l({id:`xWEvuo`}),t[70]=l,t[71]=ot);let st;t[72]!==T||t[73]!==p||t[74]!==He?(st=T?(0,Z.jsx)(`div`,{"aria-hidden":!0,className:Qn(`pointer-events-none absolute inset-0 truncate px-0 py-1 text-base text-muted-foreground/60 md:text-sm`,!p&&`transition-opacity duration-500 ease-in-out`,He.visible?`opacity-100`:`opacity-0`),children:He.text}):null,t[72]=T,t[73]=p,t[74]=He,t[75]=st):st=t[75];let ct=uw,lt=je?(0,Z.jsx)(Ll,{agentId:Oe?.id??``,iconUrl:Oe?.iconUrl,className:`size-4`}):Me===null?Pe?(0,Z.jsx)(Ai,{id:Pe.id,className:`size-4`,"aria-hidden":!0}):null:(0,Z.jsx)(Ai,{id:Di(Me),className:`size-4`,"aria-hidden":!0}),ut=je?Oe===null?(0,Z.jsx)(Y,{id:`an0aL5`}):(0,Z.jsx)(tl,{agentName:Oe.name}):Me===null?Pe?(0,Z.jsx)(ul,{displayName:Pe.displayName}):(0,Z.jsx)(Y,{id:`F-vBv0`}):(0,Z.jsx)(Y,{id:`ti6aF_`,values:{0:Ao[Me].displayName}}),dt;t[76]===ut?dt=t[77]:(dt=(0,Z.jsx)(`span`,{children:ut}),t[76]=ut,t[77]=dt);let ft=Pe?(0,Z.jsx)(Fl,{"aria-hidden":!0,className:`size-3.5`}):null,pt;t[78]===D?pt=t[79]:(pt=D?(0,Z.jsx)(cf,{className:`size-3.5`,"aria-hidden":!0}):null,t[78]=D,t[79]=pt);let mt;t[80]!==lt||t[81]!==dt||t[82]!==ft||t[83]!==pt?(mt=(0,Z.jsxs)(Z.Fragment,{children:[lt,dt,ft,pt]}),t[80]=lt,t[81]=dt,t[82]=ft,t[83]=pt,t[84]=mt):mt=t[84];let ht=!Fe,gt=Ne?null:Pe?.id??null,_t=De.map(e=>({key:`${e.source}:${e.id}`,id:e.id,name:e.name,...e.iconUrl===void 0?{}:{iconUrl:e.iconUrl},selected:je&&Oe!==null&&Oe.source===e.source&&Oe.id===e.id,onSelect:()=>qe(e)})),vt;t[85]===_?vt=t[86]:(vt=e=>{e&&_()},t[85]=_,t[86]=vt);let yt;t[87]===ze?yt=t[88]:(yt=(0,Z.jsx)(`p`,{className:`px-2 py-1.5 text-sm text-muted-foreground`,"aria-live":`polite`,children:ze?(0,Z.jsx)(Y,{id:`CPmYSG`}):(0,Z.jsx)(Y,{id:`t9Qn8y`})}),t[87]=ze,t[88]=yt);let bt;t[89]===l?bt=t[90]:(bt=l({id:`nskygk`}),t[89]=l,t[90]=bt);let xt;t[91]===Symbol.for(`react.memo_cache_sentinel`)?(xt={primary:`ask-ai-send`,trigger:`ask-ai-agent-trigger`,menu:`ask-ai-agent-menu`,option:Vj,threadAgent:Bj,settings:`ask-ai-agent-option-settings`,terminal:zj},t[91]=xt):xt=t[91];let St;t[92]!==ct||t[93]!==Be||t[94]!==Le||t[95]!==We||t[96]!==Ze||t[97]!==mt||t[98]!==ht||t[99]!==gt||t[100]!==_t||t[101]!==vt||t[102]!==yt||t[103]!==bt?(St=(0,Z.jsx)(ct,{primary:mt,onPrimary:Ze,primaryDisabled:ht,enabledTargets:Le,selectedTargetId:gt,onSelectTarget:We,threadAgents:_t,onOpenSettings:Xs,onMenuOpenChange:vt,terminals:Be,menuEmptyState:yt,triggerAriaLabel:bt,testIds:xt}),t[92]=ct,t[93]=Be,t[94]=Le,t[95]=We,t[96]=Ze,t[97]=mt,t[98]=ht,t[99]=gt,t[100]=_t,t[101]=vt,t[102]=yt,t[103]=bt,t[104]=St):St=t[104];let Ct=(0,Z.jsxs)(`div`,{ref:A,onMouseDown:tt,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:[nt,(0,Z.jsxs)(ra,{files:de,onRemoveFile:rt,children:[it,at]}),(0,Z.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,Z.jsxs)(`div`,{className:`relative flex-1`,children:[(0,Z.jsx)(ea,{ref:k,ariaLabel:ot,onEmptyChange:E,onContentChange:oa,onMentionsChange:oe,onSubmit:Ze,initialDoc:j,className:`max-h-[200px] overflow-y-auto text-base md:text-sm`}),st]}),St]})]});return u?(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:Ct})}):(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:Ct})}function zj(e){return e===`claude`?`ask-ai-agent-option-terminal`:`ask-ai-agent-option-terminal-${e}`}function Bj(e){return`ask-ai-agent-option-thread-${e}`}function Vj(e){return`ask-ai-agent-option-${e}`}function Hj(e){return!e}function Uj(e){return bl(e.payload.docName)}function Wj(e){return Tf(e.payload)}function Gj(e){console.warn(`[comments] queued-comment send rejected unexpectedly`,e)}function Kj(){return new Set}function qj(){let e=Jj;return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})}function Jj(e){rc(e,`open-ask-ai`)&&(pr()||Fj(e.target)||(e.preventDefault(),Oj()))}function Yj(e){let t=e.scrollHeight-e.clientHeight;return t>0&&e.scrollTop>=t-40}function Xj(){return aa().doc??void 0}function Zj(){return gc()}function Qj(e){return!e.terminalVisible&&!e.agentsVisible&&!e.isEmbedded&&e.activeDocName!==null}function $j(e){return!e.terminalVisible&&!e.agentsVisible&&!e.isEmbedded}function eM(e,t={}){let n=Wt(e.componentName);return n.name===`*`?t.unregisteredSuffix?`${e.componentName} (unregistered)`:e.componentName:n.displayName??n.name}var tM=200,nM=`Outside any block`;function rM(e){let t=(0,$.c)(5),{editor:n}=e,r=b(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?iM(n,r):o.current?nM:``,a.current=window.setTimeout(()=>{i.current&&(i.current.textContent=``,i.current.textContent=t),o.current=e,a.current=null},tM),()=>{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 iM(e,t){if(!t||t.ancestorChain.length===0)return``;let n=t.ancestorChain,r=n[n.length-1],i=eM(r,{unregisteredSuffix:!0});if(n.length===1)return`Selected: ${i}`;let a=n[n.length-2],o=eM(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 aM=new xa(`okCommentAnchors`);function oM(e,t){e.isDestroyed||e.view.dispatch(e.state.tr.setMeta(aM,{draft:t}))}function sM(e){dt(e)}function cM(){yt()!==null&&dt(null)}function lM(e,t,n){let r=[],i=hn(e).filter(e=>e.status===`open`&&e.target.kind===`body`&&e.anchor!==null);if(i.length>0){let e=Ef(t);for(let t of i){if(t.anchor===null)continue;let n=e(t.anchor.quote,t.anchor);n!==null&&r.push({id:t.id,from:n.from,to:n.to})}}return n!==null&&n.from<n.to&&r.push({id:null,from:n.from,to:n.to}),r}function uM(e,t,n){let r=lM(e,t,n);if(r.length===0)return Fa.empty;let i=Mf(r,It()).map(e=>lo.inline(e.from,e.to,e.threadId===null?{style:e.style}:{style:e.style,"data-comment-thread":e.threadId}));return Fa.create(t,i)}function dM(e,t){return typeof t==`object`&&t&&`draft`in t?`draft`:e.docChanged?`rebuild`:t===void 0?`reuse`:`rebuild`}function fM(e){return new Bs({key:aM,state:{init:(t,n)=>({draft:null,decorations:uM(e,n.doc,null)}),apply(t,n,r,i){let a=t.getMeta(aM);switch(dM(t,a)){case`reuse`:return n;case`draft`:{let t=a.draft;return{draft:t,decorations:uM(e,i.doc,t)}}default:{let r=n.draft===null?null:{from:t.mapping.map(n.draft.from),to:t.mapping.map(n.draft.to)};return{draft:r,decorations:uM(e,i.doc,r)}}}}},props:{decorations(e){return aM.getState(e)?.decorations},handleClick(t,n){let r=null;for(let i of lM(e,t.state.doc,null))i.id!==null&&(n<i.from||n>i.to||(r===null||i.to-i.from<r.to-r.from)&&(r=i));return r?.id==null?(cM(),!1):(sM(r.id),!1)}}})}function pM(e){let t=(0,$.c)(4),{editor:n,docName:r}=e,i,a;return t[0]!==r||t[1]!==n?(i=()=>{let e=!1;queueMicrotask(()=>{e||n.isDestroyed||(n.registerPlugin(fM(r)),Ze(r).then(()=>{e||n.isDestroyed||n.view.dispatch(n.state.tr.setMeta(aM,{refresh:!0}))}).catch(hM))});let t=()=>{if(e||n.isDestroyed)return;let t=n.editorView;t&&t.dispatch(t.state.tr.setMeta(aM,{refresh:!0}))},i=Ce(t),a=S(t),o=mM;return document.addEventListener(`keydown`,o),()=>{e=!0,i(),a(),document.removeEventListener(`keydown`,o),n.isDestroyed||n.unregisterPlugin(aM)}},a=[n,r],t[0]=r,t[1]=n,t[2]=i,t[3]=a):(i=t[2],a=t[3]),(0,Q.useEffect)(i,a),null}function mM(e){e.key===`Escape`&&cM()}function hM(){}var gM=34,_M=30,vM=4;function yM(e,t){return{top:e.top+t,height:Math.max(0,e.height-t)}}var bM=260;function xM(e,t){let n=Math.min(e.right,t);return n-e.left<bM?null:n-gM}function SM(e){let t=e.parentElement;for(;t;){if(getComputedStyle(t).overflowX!==`visible`)return t.getBoundingClientRect().right;t=t.parentElement}return window.innerWidth}function CM(e,t,n){let r=[...e].sort((e,t)=>e.y-t.y),i=t+n-_M,a=[],o=t-vM;for(let e of r){let r=e.y<t||e.y>t+n,s=e.y-_M/2,c=Math.min(i,Math.max(s,o+vM,t));a.push({id:e.id,top:c,offscreen:r}),o=c+_M}return a}function wM(e){let t=(0,$.c)(29),{editor:n,docName:r}=e,{_:i}=xn(),a=J(r),o=le(),[s,c]=(0,Q.useState)(null),l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=[],t[0]=l):l=t[0];let[u,d]=(0,Q.useState)(l),f,p;t[1]!==n||t[2]!==a?(f=()=>{let e=Yr(n);if(!e)return;let t=Sf(e.dom);if(!t)return;let r=a.filter(TM),i=()=>{let i=t.getBoundingClientRect(),a=[];if(r.length>0){let t=Ef(n.state.doc);for(let n of r){let r;if(n.target.kind===`property`){let e=bf(n.target.key);if(e===null)continue;r=e.top+e.height/2}else{if(n.anchor===null)continue;let i=t(n.anchor.quote,n.anchor);if(i===null)continue;try{r=e.coordsAtPos(i.from).top}catch{continue}}a.push({id:n.id,y:r})}}let o=xM(i,SM(t));if(o===null){c(null),d([]);return}let s=yM(i,vf(t));c({top:s.top,height:s.height,left:o}),d(CM(a,s.top,s.height))};i();let o=0,s=()=>{o===0&&(o=requestAnimationFrame(()=>{o=0,i()}))};window.addEventListener(`resize`,s),t.addEventListener(`scroll`,s,{passive:!0});let l=new ResizeObserver(s);return l.observe(t),n.on(`update`,s),()=>{o!==0&&cancelAnimationFrame(o),window.removeEventListener(`resize`,s),t.removeEventListener(`scroll`,s),l.disconnect(),n.off(`update`,s)}},p=[n,a],t[1]=n,t[2]=a,t[3]=f,t[4]=p):(f=t[3],p=t[4]),(0,Q.useEffect)(f,p);let m;t[5]!==o||t[6]!==n||t[7]!==a?(m=function(e){if(o===e){dt(null);return}let t=a.find(t=>t.id===e);if(t?.target.kind===`property`)t.anchor!==null&&mf({key:t.target.key,path:t.target.path,quote:t.anchor.quote,start:t.anchor.start,end:t.anchor.end})||jf(t.target.key);else if(t&&t.anchor!==null){let e=Cf(n.state.doc,t.anchor.quote,t.anchor);e&&Af(n,e,t.docName)}dt(e)},t[5]=o,t[6]=n,t[7]=a,t[8]=m):m=t[8];let h=m;if(s===null||u.length===0)return null;let _;t[9]!==s.height||t[10]!==s.left||t[11]!==s.top?(_={top:s.top,height:s.height,left:s.left,width:gM},t[9]=s.height,t[10]=s.left,t[11]=s.top,t[12]=_):_=t[12];let v;if(t[13]!==i||t[14]!==o||t[15]!==h||t[16]!==u||t[17]!==s.top||t[18]!==a){let e;t[20]!==i||t[21]!==o||t[22]!==h||t[23]!==s.top||t[24]!==a?(e=e=>{let t=a.find(t=>t.id===e.id);if(!t)return null;let n=e.id===o;return(0,Z.jsx)(X,{type:`button`,variant:`ghost`,"aria-label":i(n?{id:`M92_0q`}:{id:`ojGc_T`}),className:Qn(`pointer-events-auto absolute left-0 size-7 rounded-full border bg-background p-0 shadow-sm transition-colors hover:bg-muted`,e.offscreen&&`opacity-40 hover:opacity-100`,n&&`border-amber-500 bg-amber-50`),style:{top:e.top-s.top},"data-comment-thread":t.id,onClick:()=>h(t.id),onPointerEnter:()=>g(t.id),onPointerLeave:()=>Je(t.id),children:(0,Z.jsx)(gf,{className:`size-3.5 text-amber-500`})},e.id)},t[20]=i,t[21]=o,t[22]=h,t[23]=s.top,t[24]=a,t[25]=e):e=t[25],v=u.map(e),t[13]=i,t[14]=o,t[15]=h,t[16]=u,t[17]=s.top,t[18]=a,t[19]=v}else v=t[19];let y;return t[26]!==_||t[27]!==v?(y=(0,C_.createPortal)((0,Z.jsx)(`div`,{className:`pointer-events-none fixed z-30`,style:_,children:v}),document.body),t[26]=_,t[27]=v,t[28]=y):y=t[28],y}function TM(e){return e.status===`open`&&(e.target.kind===`property`||e.anchor!==null)}function EM(e){let t=1/0,n=-1/0;for(let r of e.ranges)r.$from.pos<t&&(t=r.$from.pos),r.$to.pos>n&&(n=r.$to.pos);return!Number.isFinite(t)||!Number.isFinite(n)?{from:e.from,to:e.to}:{from:t,to:n}}function DM(e){let t=(0,$.c)(54),{editor:n,docName:r,shortcutEnabled:i}=e,{_:a}=xn(),[o,s]=(0,Q.useState)(null),[c,u]=(0,Q.useState)(!0),d=Ww(),f=(0,Q.useRef)(null),p=(0,Q.useRef)(null),m,h;t[0]!==n||t[1]!==i?(m=()=>{if(!i)return;let e=e=>{if(!rc(e,`add-comment`))return;let t=e.target;t instanceof HTMLElement&&/^(INPUT|TEXTAREA|SELECT)$/.test(t.tagName)||n.state.selection.empty||(e.preventDefault(),Ut())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},h=[i,n],t[0]=n,t[1]=i,t[2]=m,t[3]=h):(m=t[2],h=t[3]),(0,Q.useEffect)(m,h);let g,_;t[4]===n?(g=t[5],_=t[6]):(g=()=>l(()=>{let{selection:e}=n.state;if(e.empty)return;let{from:t,to:r}=EM(e);if(r-t<1)return;let i=La(n.state.doc,t,r).trim();if(i.length===0)return;let{prefix:a,suffix:o}=yf(n.state.doc,t,r);s({from:t,to:r,quote:i,prefix:a,suffix:o}),oM(n,{from:t,to:r})}),_=[n],t[4]=n,t[5]=g,t[6]=_),(0,Q.useEffect)(g,_);let v,y;t[7]!==o||t[8]!==n?(v=()=>{if(o===null)return;let e=p.current;if(!e)return;let t=Yr(n);if(!t)return;let r={getBoundingClientRect:()=>{try{return ya(t,o.from,o.to)}catch{return new DOMRect}},contextElement:t.dom};return oi(r,e,()=>{ni(r,e,{placement:`bottom-start`,strategy:`fixed`,middleware:[ri(8),ei(),li({padding:8})]}).then(t=>{let{x:n,y:r}=t;e.style.position=`fixed`,e.style.left=`${n}px`,e.style.top=`${r}px`})})},y=[o,n],t[7]=o,t[8]=n,t[9]=v,t[10]=y):(v=t[9],y=t[10]),(0,Q.useEffect)(v,y);let b,x;t[11]===o?(b=t[12],x=t[13]):(b=()=>{o!==null&&f.current?.focus()},x=[o],t[11]=o,t[12]=b,t[13]=x),(0,Q.useEffect)(b,x);let S;t[14]===n?S=t[15]:(S=function(){f.current?.clear(),u(!0),s(null),oM(n,null)},t[14]=n,t[15]=S);let C=S,w;t[16]!==o||t[17]!==C?(w=()=>{if(o===null)return;let e=e=>{let t=p.current;if(t===null)return;let n=e.target;n instanceof Node&&(t.contains(n)||n instanceof Element&&n.closest(`[data-suggestion-popup]`)!==null||C())};return document.addEventListener(`pointerdown`,e,!0),()=>document.removeEventListener(`pointerdown`,e,!0)},t[16]=o,t[17]=C,t[18]=w):w=t[18],(0,Q.useEffect)(w);let T;t[19]!==o||t[20]!==r||t[21]!==n||t[22]!==C?(T=function(){if(o===null)return;let e=f.current?.getContent().instruction.trim()??``;e.length!==0&&(Zt({docName:r,quote:o.quote,prefix:o.prefix,suffix:o.suffix,body:e}),n.isDestroyed||n.commands.setTextSelection(Math.min(o.to,n.state.doc.content.size)),C())},t[19]=o,t[20]=r,t[21]=n,t[22]=C,t[23]=T):T=t[23];let E=T;if(o===null)return null;let D;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(D={position:`fixed`,top:0,left:0},t[24]=D):D=t[24];let O;t[25]===a?O=t[26]:(O=a({id:`vYOUOk`}),t[25]=a,t[26]=O);let k;t[27]===a?k=t[28]:(k=a({id:`vYOUOk`}),t[27]=a,t[28]=k);let A;t[29]!==E||t[30]!==C||t[31]!==O||t[32]!==k?(A=(0,Z.jsx)(ea,{ref:f,ariaLabel:O,placeholder:k,onEmptyChange:u,onSubmit:E,onEscape:C,className:`max-h-40 min-h-16 overflow-y-auto rounded-md border px-2 py-1 text-sm`}),t[29]=E,t[30]=C,t[31]=O,t[32]=k,t[33]=A):A=t[33];let j=d?`justify-end`:`justify-between`,M;t[34]===j?M=t[35]:(M=Qn(`flex items-center gap-1.5`,j),t[34]=j,t[35]=M);let N;t[36]!==d||t[37]!==r?(N=d?null:(0,Z.jsx)(X,{size:`sm`,variant:`ghost`,onClick:()=>W(`doc`,r),className:`px-2 text-muted-foreground hover:text-foreground`,children:(0,Z.jsx)(Y,{id:`Dd6j2Q`})}),t[36]=d,t[37]=r,t[38]=N):N=t[38];let P;t[39]===a?P=t[40]:(P=a({id:`ffH3Rt`}),t[39]=a,t[40]=P);let F,I;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(Y,{id:`hqVQbT`}),I=(0,Z.jsx)(`span`,{className:`ml-0.5 text-[11px] tracking-normal normal-case text-primary-foreground/75`,children:`⏎`}),t[41]=F,t[42]=I):(F=t[41],I=t[42]);let L;t[43]!==c||t[44]!==E||t[45]!==P?(L=(0,Z.jsxs)(X,{size:`sm`,onClick:E,disabled:c,"aria-label":P,children:[F,I]}),t[43]=c,t[44]=E,t[45]=P,t[46]=L):L=t[46];let R;t[47]!==M||t[48]!==N||t[49]!==L?(R=(0,Z.jsxs)(`div`,{className:M,children:[N,L]}),t[47]=M,t[48]=N,t[49]=L,t[50]=R):R=t[50];let z;return t[51]!==A||t[52]!==R?(z=(0,C_.createPortal)((0,Z.jsxs)(`div`,{ref:p,className:`z-[60] flex w-80 flex-col gap-2 rounded-lg border bg-popover p-3 text-popover-foreground shadow-md`,style:D,"data-testid":`comment-composer`,children:[A,R]}),document.body),t[51]=A,t[52]=R,t[53]=z):z=t[53],z}function OM(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(Xn,{fallbackRender:kM,children:n}),t[0]=n,t[1]=r),r}function kM(){return null}var AM=!1;function jM(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{xm(n,{durationMs:Math.round(e*1e3)/1e3,threw:!o,...i},{startTime:t,duration:e})}catch{}}}}function MM(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 NM=0,PM=0,FM=0,IM=0,LM=null,RM=[`linkResolutionDecoration$`],zM=new WeakSet,BM=new WeakSet;function VM(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase()}function HM(){return!1}function UM(){return!HM()}function WM(e,t){if(UM())return t;let n=`ok/cold/nodeview-factory-${VM(e)}`;return function(...r){let i=performance.now();try{return t(...r)}finally{let t=performance.now()-i;xm(n,{nodeType:e,durationMs:Math.round(t*1e3)/1e3},{startTime:i,duration:t})}}}function GM(e){if(UM())return;let t=e.state.plugins;for(let e of t){if(BM.has(e))continue;let t=e.spec?.key?.key;if(!t||!RM.some(e=>t.startsWith(e)))continue;let n=e.props,r=n.decorations;if(typeof r!=`function`){BM.add(e);continue}let i=`ok/cold/decoration-${VM(t.replace(/\$\d*$/,``))}`;n.decorations=function(...e){let n=performance.now();try{return r.apply(this,e)}finally{let e=performance.now()-n;xm(i,{pluginKey:t,durationMs:Math.round(e*1e3)/1e3},{startTime:n,duration:e})}},BM.add(e)}}function KM(e){if(UM())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=WM(e,n);r.__okWrapped=!0,t[e]=r}}function qM(e){return UM()?e:e.map(e=>{let t=e.name??`unknown`,n=VM(t);return e.extend({onBeforeCreate(){let e=performance.now();try{this.parent?.()}finally{let r=performance.now()-e;xm(`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;xm(`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;xm(`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;xm(`ok/cold/ext-${n}-on-destroy`,{ext:t,hook:`onDestroy`,durationMs:Math.round(r*1e3)/1e3},{startTime:e,duration:r})}}})})}function JM(){if(!AM){AM=!0,jM(Bo.prototype,`mount`,`ok/cold/editor-mount`,(e,t,n,r)=>{let i=e;return UM()||(LM=performance.now()),{elementDefault:i.options?.element?.nodeName??null,docSize:MM(i.editorState),durationMs:r}}),jM(Bo.prototype,`createView`,`ok/cold/editor-create-view`,e=>{let t=e;return!UM()&&!zM.has(e)&&t.view&&(GM(t.view),KM(t.view),zM.add(e)),{docSize:MM(t.editorState)}}),jM(Bo.prototype,`createNodeViews`,`ok/cold/create-node-views`,(e,t,n,r)=>{IM+=1;let i=e;return!UM()&&i.view&&KM(i.view),{docSize:MM(i.view),seq:IM,durationMs:r}}),jM(Wa.prototype,`updateState`,`ok/cold/pm-update-state`,(e,t,n,r)=>(PM+=1,{seq:PM,docSize:MM(e.state),durationMs:r})),jM(Wa.prototype,`setProps`,`ok/cold/pm-set-props`,(e,t,n,r)=>(FM+=1,{seq:FM,docSize:MM(e.state),durationMs:r})),jM(Ot.prototype,`_forceRerender`,`ok/cold/force-rerender`,(e,t,n,r)=>{NM+=1;let i=e,a=(()=>{try{return i.type?.toArray?i.type.toArray().length:null}catch{return null}})();return{seq:NM,topLevelYElements:a,durationMs:r}}),jM(Br.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`)&&(xm(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}),!UM()&&e===`first-paint`&&LM!==null)){let e=LM,n=Math.max(0,t.startTime-e);xm(`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}),LM=null}}}).observe({type:`paint`,buffered:!0})}catch{}globalThis.__okColdMountInstrumented=!0}}function YM(){let[e]=(0,Q.useState)(ho);return e}var XM=class{awareness=null;started=!1;renewIntervalMs;now;constructor(e,t={}){this.ticker=e,this.renewIntervalMs=t.renewIntervalMs??15e3,this.now=t.now??(()=>Date.now())}start(){this.started||(this.started=!0,this.ticker.start(()=>this.renewIfStale()))}stop(){this.started&&(this.started=!1,this.ticker.stop(),this.awareness=null)}setAwareness(e){this.awareness=e}clearAwareness(e){this.awareness===e&&(this.awareness=null)}renewIfStale(){let e=this.awareness;if(e===null)return;let t=e.getLocalState();if(t===null)return;let n=e.meta.get(e.clientID)?.lastUpdated??0;this.now()-n>=this.renewIntervalMs&&e.setLocalState(t)}},ZM=class{worker=null;start(e){typeof Worker>`u`||this.worker!==null||(this.worker=new Worker(new URL(``+new URL(`awareness-heartbeat.worker-BYkbsKQ2.js`,import.meta.url).href,``+import.meta.url),{type:`module`}),this.worker.onmessage=t=>{t.data===`tick`&&e()},this.worker.postMessage(`start`))}stop(){this.worker!==null&&(this.worker.postMessage(`stop`),this.worker.terminate(),this.worker=null)}},QM=null;function $M(){return QM===null&&(QM=new XM(new ZM)),QM}function eN({principal:e,identity:t}){return e&&e.source===`git-config`?{type:`human`,name:zs(e.display_name),color:no(e.id,ba),coeditor:t.coeditor,tabId:t.tabId,principalId:e.id}:e&&e.source===`synthesized`?{type:`human`,name:t.name,color:no(e.id,ba),coeditor:t.coeditor,tabId:t.tabId}:{type:`human`,name:t.name,color:t.color,coeditor:t.coeditor,tabId:t.tabId}}function tN(e,t){return e>t}function nN(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 rN=3,iN=6e4;function aN(e,t){let n=0;for(let r of e)t-r<iN&&(n+=1);return n<rN}var oN=new Map;function sN(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 cN(e){let t=ue.getState(e);return t?.snapshot!=null||t?.prevSnapshot!=null}function lN(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=ue.getState(e)?.binding;if(!t)return;if(typeof t._prosemirrorChanged!=`function`){xm.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=>{tN(i,a)||r(e)}},f=()=>{if(c=!1,!s||o||!tN(i,a)||l!==null&&cN(l.state))return;o=!0;let e=Date.now();for(let[t,n]of oN)n.every(t=>e-t>=iN)&&oN.delete(t);let t=(oN.get(n)??[]).filter(t=>e-t<iN);if(!aN(t,e)){oN.set(n,t),xm.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),oN.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,xm.count(`ok/editor/binding-wedge-recovery-error`,{docName:n}),console.error(`[binding-staleness-guard] wedge recovery threw for "${n}":`,e)}},p=e=>{e.origin!==ue&&sN(e,t)&&(i+=1,c||(c=!0,queueMicrotask(f)))};return new Bs({state:{init:()=>null,apply:e=>(nN(e.getMeta(ue))&&(a=i,o&&xm.count(`ok/editor/binding-wedge-recovered`,{docName:n}),o=!1),null)},filterTransaction:(e,t)=>!tN(i,a)||cN(t)?!0:e.getMeta(ue)!==void 0,view:e=>{let r=t.doc;return r==null?(xm.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 uN(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 dN=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&&ao(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(ei(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(li(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(ri(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(ci(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(ti(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(ii(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(ai(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(si(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=ya(this.view,e.from,e.to),r={getBoundingClientRect:()=>n,getClientRects:()=>[n]};if(e instanceof po){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 cs){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():uN(o.getBoundingClientRect(),s.getBoundingClientRect());r={getBoundingClientRect:()=>c,getClientRects:()=>[c]}}return r}updatePosition(){if(!this.isVisible)return;let e=this.virtualElement;e&&ni(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()}},fN=e=>new Bs({key:typeof e.pluginKey==`string`?new xa(e.pluginKey):e.pluginKey,view:t=>new dN({view:t,...e})});rs.create({name:`bubbleMenu`,addOptions(){return{element:null,pluginKey:`bubbleMenu`,updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[fN({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 pN=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 Ea(e,{textSerializers:Ns(this.editor.schema)})}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(ei(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(li(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(ri(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(ci(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(ti(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(ii(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(ai(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(si(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=ya(this.view,e.from,e.to);ni({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()}},mN=e=>new Bs({key:typeof e.pluginKey==`string`?new xa(e.pluginKey):e.pluginKey,view:t=>new pN({view:t,...e})});rs.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?[mN({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 hN(e,t){return e??new xa(t)}var gN=typeof window<`u`?Q.useLayoutEffect:Q.useEffect,_N=new Set([`left`,`opacity`,`position`,`top`,`visibility`,`width`]),vN=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(`.`)),yN=new Set([`children`,`className`,`style`]),bN=new Set([`tabIndex`]),xN=new Set([`accessKey`,`autoCapitalize`,`contentEditable`,`contextMenu`,`dir`,`draggable`,`enterKeyHint`,`hidden`,`id`,`lang`,`nonce`,`role`,`slot`,`spellCheck`,`tabIndex`,`title`,`translate`]),SN={Blur:`focusout`,DoubleClick:`dblclick`,Focus:`focusin`,MouseEnter:`mouseenter`,MouseLeave:`mouseleave`};function CN(e,t){return/^on[A-Z]/.test(e)&&typeof t==`function`}function wN(e){return e.startsWith(`aria-`)||e.startsWith(`data-`),e}function TN(e){return e.startsWith(`aria-`)||e.startsWith(`data-`)||xN.has(e)}function EN(e){return e.startsWith(`--`)?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function DN(e){let t=e.endsWith(`Capture`),n=(t?e.slice(0,-7):e).slice(2);return{eventName:SN[n]??n.toLowerCase(),options:t?{capture:!0}:void 0}}function ON(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 kN(e){return bN.has(e)}function AN(e,t,n){if(t===`tabIndex`){e.tabIndex=Number(n);return}e[t]=n}function jN(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 MN(e,t){return typeof t!=`number`||t===0||e.startsWith(`--`)||vN.has(e)?String(t):`${t}px`}function NN(e,t){_N.has(t)||e.style.removeProperty(EN(t))}function PN(e,t,n){_N.has(t)||e.style.setProperty(EN(t),MN(t,n))}function FN(e,t,n){new Set([...Object.keys(t),...Object.keys(n)]).forEach(r=>{if(yN.has(r)||!TN(r)||CN(r,t[r])||CN(r,n[r]))return;let i=t[r],a=n[r];if(i===a)return;let o=wN(r);if(a==null||a===!1){kN(r)&&jN(e,r),e.removeAttribute(o);return}if(a===!0){kN(r)&&AN(e,r,!0),e.setAttribute(o,``);return}if(kN(r)){AN(e,r,a);return}e.setAttribute(o,String(a))})}function IN(e,t,n){if(t!==n){if(n){e.className=n;return}e.removeAttribute(`class`)}}function LN(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){NN(e,t);return}PN(e,t,a)}})}function RN(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(!CN(t,n))return;let{eventName:i,options:a}=DN(t),o=t=>{n(ON(e,t))};e.addEventListener(i,o,a),r.push({eventName:i,listener:o,options:a})}),r}function zN(e,t){let n=(0,Q.useRef)({}),r=(0,Q.useRef)([]);gN(()=>{let i=n.current;return IN(e,i.className,t.className),LN(e,i.style,t.style),FN(e,i,t),r.current=RN(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 BN=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)(hN(e,`bubbleMenu`)).current;zN(d.current,l),typeof u==`function`?u(d.current):u&&(u.current=d.current);let{editor:p}=Mr(),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=fN({...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,C_.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)(hN(e,`floatingMenu`)).current;zN(u.current,c),typeof l==`function`?l(u.current):l&&(l.current=u.current);let{editor:f}=Mr(),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=mN({...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,C_.createPortal)(s,u.current)});function VN(){let e=(0,$.c)(9),{_:t}=xn(),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(ua,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),e[0]=n):n=e[0];let r;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(_r,{asChild:!0,children:(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`comment-bubble-button`,className:`gap-1 px-2 text-sm font-medium text-accent-foreground/80`,onClick:HN,children:[(0,Z.jsx)(re,{className:`size-3.5`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(Y,{id:`NBdIgR`})})]})}),e[1]=r):r=e[1];let i;e[2]===t?i=e[3]:(i=t({id:`58qIOK`}),e[2]=t,e[3]=i);let a;e[4]===i?a=e[5]:(a=(0,Z.jsx)(`span`,{children:i}),e[4]=i,e[5]=a);let o;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(O,{"aria-label":Ys(`add-comment`),children:Js(`add-comment`)}),e[6]=o):o=e[6];let s;return e[7]===a?s=e[8]:(s=(0,Z.jsxs)(Z.Fragment,{children:[n,(0,Z.jsxs)(br,{children:[r,(0,Z.jsxs)(vr,{side:`bottom`,sideOffset:8,children:[a,o]})]})]}),e[7]=a,e[8]=s),s}function HN(){return Ut()}var UN=[{name:`paragraph`,label:{id:`xeiujy`},icon:Hy,isActive:e=>e.isActive(`paragraph`)&&!e.isActive(`list`),command:e=>e.chain().focus().setParagraph().run()},{name:`heading1`,label:{id:`lXKZGw`},icon:Re,isActive:e=>e.isActive(`heading`,{level:1}),command:e=>e.chain().focus().toggleHeading({level:1}).run()},{name:`heading2`,label:{id:`El7NbA`},icon:R,isActive:e=>e.isActive(`heading`,{level:2}),command:e=>e.chain().focus().toggleHeading({level:2}).run()},{name:`heading3`,label:{id:`SFN6dN`},icon:Gt,isActive:e=>e.isActive(`heading`,{level:3}),command:e=>e.chain().focus().toggleHeading({level:3}).run()},{name:`bulletList`,label:{id:`s1c0ja`},icon:Oe,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:{id:`Uci-Ph`},icon:Te,isActive:e=>e.isActive(`list`,{ordered:!0}),command:e=>e.chain().focus().toggleOrderedList().run()},{name:`taskList`,label:{id:`G_686w`},icon:j,isActive:e=>e.isActive(`listItem`,{checked:!0})||e.isActive(`listItem`,{checked:!1}),command:e=>e.chain().focus().toggleTaskList().run()},{name:`blockquote`,label:{id:`ZhhOwV`},icon:me,isActive:e=>e.isActive(`blockquote`),command:e=>e.chain().focus().toggleBlockquote().run()},{name:`codeBlock`,label:{id:`N2eHWq`},icon:$y,isActive:e=>e.isActive(`codeBlock`),command:e=>e.chain().focus().toggleCodeBlock({language:`js`}).run()}];function WN(e){let t=(0,$.c)(22),{editor:n}=e,{_:r}=xn(),i;t[0]===n?i=t[1]:(i={editor:n,selector:GN},t[0]=n,t[1]=i);let{current:a,activeStates:o}=Zr(i),s=a.icon,c;t[2]===s?c=t[3]:(c=(0,Z.jsx)(s,{className:`size-3.5`}),t[2]=s,t[3]=c);let l;t[4]!==r||t[5]!==a.label?(l=r(a.label),t[4]=r,t[5]=a.label,t[6]=l):l=t[6];let u;t[7]===l?u=t[8]:(u=(0,Z.jsx)(`span`,{children:l}),t[7]=l,t[8]=u);let d;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Zl,{className:`size-3 opacity-50`}),t[9]=d):d=t[9];let f;t[10]!==c||t[11]!==u?(f=(0,Z.jsx)(Ri,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,size:`sm`,className:`gap-1 px-2 text-sm font-medium text-accent-foreground/80`,children:[c,u,d]})}),t[10]=c,t[11]=u,t[12]=f):f=t[12];let p;t[13]!==r||t[14]!==o||t[15]!==n?(p=UN.map(e=>{let t=e.icon,i=o[e.name];return(0,Z.jsxs)(Mi,{className:i?`bg-accent text-accent-foreground`:``,onSelect:()=>{e.command(n)},children:[(0,Z.jsx)(t,{className:`size-4`}),(0,Z.jsx)(`span`,{children:r(e.label)})]},e.name)}),t[13]=r,t[14]=o,t[15]=n,t[16]=p):p=t[16];let m;t[17]===p?m=t[18]:(m=(0,Z.jsx)(Hi,{align:`start`,sideOffset:8,className:`w-44 max-h-(--radix-dropdown-menu-content-available-height) overflow-y-auto subtle-scrollbar`,children:p}),t[17]=p,t[18]=m);let h;return t[19]!==f||t[20]!==m?(h=(0,Z.jsxs)(Wi,{children:[f,m]}),t[19]=f,t[20]=m,t[21]=h):h=t[21],h}function GN(e){let t=Object.fromEntries(UN.map(t=>[t.name,t.isActive(e.editor)]));return{current:UN.find(e=>t[e.name])??UN[0],activeStates:t}}function KN(e){return()=>{let t=null;try{t=e.view.dom.closest(`.editor-doc-scroll`)}catch{}let n={top:au(),bottom:qN(`--ask-composer-height`)+qN(`--conflict-footer-height`)};return t?{boundary:t,padding:n}:{padding:n}}}function qN(e){let t=Number.parseFloat(document.documentElement.style.getPropertyValue(e));return Number.isFinite(t)?t:0}function JN(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 YN(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:Be(typeof n.src==`string`?n.src:``)}function XN(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 ZN(e){let t=(0,$.c)(13),{editor:n}=e,{_:r}=xn(),i;if(t[0]===n?i=t[1]:(i={editor:n,selector:QN},t[0]=n,t[1]=i),Zr(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=JN(n);t&&XN(t,YN(n))},t[4]=n,t[5]=o);let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(Cd,{className:`size-3.5`}),t[6]=s):s=t[6];let c;t[7]!==a||t[8]!==o?(c=(0,Z.jsx)(_r,{asChild:!0,children:(0,Z.jsx)(X,{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)(vr,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(Y,{id:`WcWS__`})}),t[10]=l):l=t[10];let u;return t[11]===c?u=t[12]:(u=(0,Z.jsx)(`div`,{className:`flex items-center gap-0.5`,children:(0,Z.jsxs)(br,{children:[c,l]})}),t[11]=c,t[12]=u),u}function QN(e){return JN(e.editor)}function $N(e){return JN(e)!==null}var eP=`img, .ok-embed, .ok-video`,tP=220,nP=`cubic-bezier(0.23, 1, 0.32, 1)`,rP=`ok-image-align-flip`,iP=.5;function aP(){return typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function oP(){return typeof requestAnimationFrame==`function`}function sP(e){return e?e.querySelector(eP):null}function cP(e,t){if(aP()||!oP()){t();return}let n=sP(e);if(!n){t();return}let r=n.getBoundingClientRect().left;t(),requestAnimationFrame(()=>{let t=sP(e);if(!t)return;for(let e of t.getAnimations())e.id===rP&&e.cancel();let n=r-t.getBoundingClientRect().left;if(Math.abs(n)<iP)return;let i=t.animate([{transform:`translateX(${n}px)`},{transform:`translateX(0)`}],{duration:tP,easing:nP,fill:`none`});i.id=rP})}var lP=[{value:`left`,label:{id:`IR6Txi`},icon:lb},{value:`center`,label:{id:`8nOdkO`},icon:sb},{value:`right`,label:{id:`pd0UH2`},icon:cb}];function uP(e){let t=e.state.selection.node;if(!t||t.type.name!==`jsxComponent`)return null;let n=t.attrs.componentName;if(!xe.has(String(n)))return null;let r=(t.attrs.props??{}).align;return r===`left`||r===`right`||r===`center`?r:`center`}function dP(e){let t=(0,$.c)(8),{editor:n}=e,{_:r}=xn(),i;t[0]===n?i=t[1]:(i={editor:n,selector:fP},t[0]=n,t[1]=i);let a=Zr(i);if(a===null)return null;let o;t[2]!==r||t[3]!==a||t[4]!==n?(o=lP.map(e=>{let{value:t,label:i,icon:o}=e,s=a===t;return(0,Z.jsxs)(br,{children:[(0,Z.jsx)(_r,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":r(i),"aria-pressed":s,className:s?`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(!xe.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(po.create(u.doc,s)),cP(n.view.nodeDOM(s),()=>{n.view.dispatch(u)})},children:(0,Z.jsx)(o,{className:`size-3.5`})})}),(0,Z.jsx)(vr,{side:`bottom`,sideOffset:8,children:r(i)})]},t)}),t[2]=r,t[3]=a,t[4]=n,t[5]=o):o=t[5];let s;return t[6]===o?s=t[7]:(s=(0,Z.jsx)(`div`,{className:`flex items-center gap-0.5`,children:o}),t[6]=o,t[7]=s),s}function fP(e){return uP(e.editor)}function pP(e){return uP(e)!==null}function mP({editor:e}){if(Bt(e.state).query||e.isActive(`codeBlock`))return!1;if(pP(e)||$N(e))return!0;if(e.state.selection.empty)return!1;let{from:t,to:n}=e.state.selection;return!!La(e.state.doc,t,n,` `,{inlineOnly:!0}).trim()}function hP(e){throw Error(`Unhandled AddLinkShortcutAction variant: ${JSON.stringify(e)}`)}function gP(e){let{selection:t}=e.state;if(t.empty){if(!e.isActive(`link`))return null;let n=ct(e.state,t.from,`link`);return n===null?null:{kind:`edit-link`,markId:n}}return!mP({editor:e})||pP(e)||$N(e)?null:{kind:`open-popover`}}function _P(e){let t=e.schema.nodes;return!!(t.footnoteReference&&t.footnoteDefinition)}function vP(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 yP(e){let{$from:t,$to:n}=e.state.selection;return!t.sameParent(n)}function bP(e){let t=(0,$.c)(21),{editor:n}=e,{_:r}=xn(),i;t[0]===n?i=t[1]:(i={editor:n,selector:xP},t[0]=n,t[1]=i);let a=Zr(i),o;t[2]!==a||t[3]!==n?(o=()=>{if(a||!_P(n)||n.state.selection.empty||yP(n)||vP(n))return;let{from:e,to:t}=n.state.selection,r=n.state.doc.textBetween(e,t,` `);if(!r.trim())return;let i=Vo(eo(n.state.doc)),o=Jo(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)(G,{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)(_r,{asChild:!0,children:(0,Z.jsx)(X,{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)(vr,{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)(br,{children:[d,p]}),t[18]=d,t[19]=p,t[20]=m):m=t[20],m}function xP(e){let t=e.editor;return!!(!_P(t)||t.state.selection.empty||yP(t)||vP(t))}var SP=[{name:`bold`,icon:oy,command:e=>e.chain().focus().toggleBold().run(),isActive:e=>e.isActive(`strong`),shortcutId:`format-bold`},{name:`italic`,icon:Ay,command:e=>e.chain().focus().toggleItalic().run(),isActive:e=>e.isActive(`emphasis`),shortcutId:`format-italic`},{name:`underline`,icon:mb,command:e=>e.chain().focus().toggleUnderline().run(),isActive:e=>e.isActive(`underline`),shortcutId:`format-underline`},{name:`strikethrough`,icon:rb,command:e=>e.chain().focus().toggleStrike().run(),isActive:e=>e.isActive(`strike`),shortcutId:`format-strike`},{name:`code`,icon:st,command:e=>e.chain().focus().toggleCode().run(),isActive:e=>e.isActive(`code`),shortcutId:`format-inline-code`},{name:`highlight`,icon:ky,command:e=>e.chain().focus().toggleHighlight().run(),isActive:e=>e.isActive(`highlight`),shortcutId:`format-highlight`}];function CP(e){let t=(0,$.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:wP},t[0]=n,t[1]=r);let i=Zr(r),a;t[2]!==i||t[3]!==n?(a=SP.map(e=>{let t=e.icon,r=i[e.name];return(0,Z.jsxs)(br,{children:[(0,Z.jsx)(_r,{asChild:!0,children:(0,Z.jsx)(X,{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)(vr,{side:`bottom`,sideOffset:8,children:[(0,Z.jsx)(`span`,{className:`capitalize`,children:e.name}),(0,Z.jsx)(O,{"aria-label":Ys(e.shortcutId),children:Js(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 wP(e){return Object.fromEntries(SP.map(t=>[t.name,t.isActive(e.editor)]))}var TP=`open-knowledge:open-link-edit-popover`;function EP(e=typeof window>`u`?new EventTarget:window){e.dispatchEvent(new CustomEvent(TP))}function DP(e,t=typeof window>`u`?new EventTarget:window){let n=()=>e();return t.addEventListener(TP,n),()=>t.removeEventListener(TP,n)}function OP(e){return e.state.selection.empty&&e.isActive(`link`)?e.getAttributes(`link`).href??``:``}async function kP(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=w(n);r!==null&&(t(e=>e===``?r:e),requestAnimationFrame(()=>{let t=e.current;t&&t.value===r&&t.select()}))}function AP(e,t,n,r){let i=OP(e);n(i),r(!0),i===``&&kP(t,n)}function jP(e){let t=(0,$.c)(72),{editor:n,shortcutEnabled:r}=e,i=r===void 0?!1:r,{_:a}=xn(),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(``),u=(0,Q.useRef)(null),{folderPaths:d,loading:f,pages:p}=Lu(),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=()=>DP(()=>{i&&AP(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||!rc(e,`add-link`)||!n.editorView?.hasFocus())return;let t=gP(n);if(t!==null)switch(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),t.kind){case`open-popover`:EP();return;case`edit-link`:{let{markId:e}=t;$t(e),requestAnimationFrame(()=>{de(n).setActiveNode(e)});return}default:hP(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 E;t[18]!==n||t[19]!==h||t[20]!==c?(E=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]=E):E=t[21];let D=E,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(qr(e.path,null))},t[24]=j):j=t[24];let M=j,N;t[25]!==D||t[26]!==n?(N=function(e){e.key===`Enter`&&(e.preventDefault(),D()),e.key===`Escape`&&(e.preventDefault(),s(!1),n.chain().focus().run())},t[25]=D,t[26]=n,t[27]=N):N=t[27];let P=N;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]!==P||t[34]!==f||t[35]!==p||t[36]!==e||t[37]!==n||t[38]!==c?(r=(0,Z.jsx)(kt,{ref:u,type:`text`,placeholder:e,value:c,pages:p,folderPaths:d,loading:f,onValueChange:l,onSuggestionSelect:M,onKeyDown:P,"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]=P,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]===D?o=t[43]:(o=()=>{D()},t[42]=D,t[43]=o);let s;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(hy,{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)(X,{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)(br,{children:[(0,Z.jsx)(_r,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":a({id:`2vIPtm`}),onMouseDown:e=>{e.preventDefault(),Vr(_)},children:(0,Z.jsx)(Fl,{className:`size-3.5`})})}),(0,Z.jsx)(vr,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(Y,{id:`2vIPtm`})})]}),(0,Z.jsxs)(br,{children:[(0,Z.jsx)(_r,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":a({id:`484LKL`}),onMouseDown:e=>{e.preventDefault(),A()},children:(0,Z.jsx)(Hf,{className:`size-3.5`})})}),(0,Z.jsx)(vr,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(Y,{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 F;t[59]===a?F=t[60]:(F=a({id:`p0Iq25`}),t[59]=a,t[60]=F);let I=h?`bg-accent text-primary`:`text-accent-foreground`,L;t[61]===n?L=t[62]:(L=e=>{e.preventDefault(),AP(n,u,l,s)},t[61]=n,t[62]=L);let R;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Z.jsx)(My,{className:`size-3.5`}),t[63]=R):R=t[63];let z;t[64]!==F||t[65]!==I||t[66]!==L?(z=(0,Z.jsx)(_r,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":F,className:I,onMouseDown:L,children:R})}),t[64]=F,t[65]=I,t[66]=L,t[67]=z):z=t[67];let B;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsx)(Y,{id:`yzF66j`}),t[68]=B):B=t[68];let V;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Z.jsxs)(vr,{side:`bottom`,sideOffset:8,children:[B,(0,Z.jsx)(O,{children:Js(`add-link`)})]}),t[69]=V):V=t[69];let H;return t[70]===z?H=t[71]:(H=(0,Z.jsxs)(br,{children:[z,V]}),t[70]=z,t[71]=H),H}function MP(e){let t=(0,$.c)(18),{editor:n}=e,{_:r}=xn(),i;t[0]===n?i=t[1]:(i=()=>{let e=Fr(n),t=Qr(n);e===null||!t||nu({editor:n,docName:e,ytext:t.getText(`source`)})},t[0]=n,t[1]=i);let a=i,o;t[2]===r?o=t[3]:(o=r({id:`M0jOcG`}),t[2]=r,t[3]=o);let s;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(Lh,{className:`size-3.5`,"aria-hidden":`true`}),t[4]=s):s=t[4];let c;t[5]!==a||t[6]!==o?(c=(0,Z.jsx)(_r,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-xs`,"data-testid":`view-in-source-bubble-button`,className:`text-accent-foreground/80`,"aria-label":o,onMouseDown:NP,onClick:a,children:s})}),t[5]=a,t[6]=o,t[7]=c):c=t[7];let l;t[8]===r?l=t[9]:(l=r({id:`M0jOcG`}),t[8]=r,t[9]=l);let u;t[10]===l?u=t[11]:(u=(0,Z.jsx)(`span`,{children:l}),t[10]=l,t[11]=u);let d;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(O,{"aria-label":Ys(`view-source-at-cursor`),children:Js(`view-source-at-cursor`)}),t[12]=d):d=t[12];let f;t[13]===u?f=t[14]:(f=(0,Z.jsxs)(vr,{side:`bottom`,sideOffset:8,children:[u,d]}),t[13]=u,t[14]=f);let p;return t[15]!==c||t[16]!==f?(p=(0,Z.jsxs)(br,{children:[c,f]}),t[15]=c,t[16]=f,t[17]=p):p=t[17],p}function NP(e){return e.preventDefault()}function PP(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:zP},t[0]=n,t[1]=l);let u=Zr(l),d;t[2]===n?d=t[3]:(d={editor:n,selector:RP},t[2]=n,t[3]=d);let f=Zr(d),p;t[4]!==n.state||t[5]!==n.view?(p=()=>{try{let{from:e,to:t}=n.state.selection;return ya(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=KN(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=oi(h,e,()=>{ni(h,e,{placement:`top`,strategy:`fixed`,middleware:[ri(8),ei(_),li({padding:8}),ai(_)]}).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(LP)}))},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(IP)},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)(dP,{editor:n},`${o}-img-align`):f?(0,Z.jsx)(ZN,{editor:n},`${o}-file`):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(WN,{editor:n}),(0,Z.jsx)(ua,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(CP,{editor:n},o),(0,Z.jsx)(ua,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(jP,{editor:n,shortcutEnabled:i},`${o}-link`),(0,Z.jsx)(bP,{editor:n},`${o}-footnote`),(0,Z.jsx)(MP,{editor:n},`${o}-view-source`),(0,Z.jsx)(VN,{},`${o}-comment`)]}),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)(BN,{ref:a,editor:n,"data-testid":`bubble-menu-bar`,appendTo:FP,shouldShow:mP,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 FP(){return document.body}function IP(e){return e+1}function LP(){}function RP(e){return $N(e.editor)}function zP(e){return pP(e.editor)}var BP=new xa(`bareHtmlImageDecoration`);function VP(e){let t=[],n=0;for(;n<e.length;){let r=e.indexOf(`<img`,n);if(r===-1)break;let i=e[r+4];if(i!==`>`&&i!==void 0&&!/\s/.test(i)){n=r+4;continue}let a=null,o=r+4;for(;o<e.length;o+=1){let t=e[o];if(a!==null)t===a&&(a=null);else if(t===`"`||t===`'`)a=t;else if(t===`>`)break;else if(t===`<`)break}e[o]===`>`&&t.push({index:r,raw:e.slice(r,o+1)}),n=Math.max(r+4,o+1)}return t}function HP(e,t){let n=e.getAttribute(`src`);if(n===null||_o(n,t)===null)return null;let r=e.getAttribute(`loading`),i=e.getAttribute(`decoding`),a=e.getAttribute(`fetchpriority`),o=e.getAttribute(`crossorigin`),s=e.getAttribute(`referrerpolicy`);return{src:Ds(n,t),alt:e.getAttribute(`alt`)??``,width:e.getAttribute(`width`)??void 0,height:e.getAttribute(`height`)??void 0,title:e.getAttribute(`title`)??void 0,srcset:e.getAttribute(`srcset`)??void 0,sizes:e.getAttribute(`sizes`)??void 0,loading:r===`eager`||r===`lazy`?r:void 0,decoding:i===`sync`||i===`async`||i===`auto`?i:void 0,fetchpriority:a===`high`||a===`low`||a===`auto`?a:void 0,crossorigin:o===``||o===`anonymous`||o===`use-credentials`?o:void 0,referrerpolicy:s===``||s===`no-referrer`||s===`no-referrer-when-downgrade`||s===`origin`||s===`origin-when-cross-origin`||s===`same-origin`||s===`strict-origin`||s===`strict-origin-when-cross-origin`||s===`unsafe-url`?s:void 0}}function UP(e,t){if(!e.startsWith(`<img`)||e.endsWith(`/>`))return null;let n=document.createElement(`template`);if(n.innerHTML=e,n.content.childNodes.length!==1)return null;let r=n.content.firstElementChild;return r instanceof HTMLImageElement?HP(r,t):null}function WP(e,t){return t?.type.spec.code===!0||t?.type.name.toLowerCase().includes(`codeblock`)?!0:e.marks.some(e=>[`code`,`escapeMark`,`sourceLiteral`].includes(e.type.name))}function GP(e,t){let n=[];return e.descendants((e,r,i)=>{if(!(!e.isText||e.text===void 0||WP(e,i)))for(let i of VP(e.text)){let e=UP(i.raw,t);if(e===null)continue;let a=r+i.index;n.push({...i,from:a,to:a+i.raw.length,props:e})}}),n}function KP(e,t,n){let r=[];for(let i of GP(e,n)){let{from:e,to:n,props:a}=i,o=null;r.push(lo.inline(e,n,{"aria-hidden":`true`,class:`hidden ok-bare-html-image-source`}),lo.widget(e,()=>(o=new Ir(Le,{editor:t,props:a,as:`span`,className:`ok-bare-html-image-render`}),o.element.setAttribute(`contenteditable`,`false`),o.element),{side:-1,key:`${e}:${i.raw}`,destroy:()=>o?.destroy()}))}return Fa.create(e,r)}function qP(e){return rs.create({name:`bareHtmlImageDecoration`,addProseMirrorPlugins(){let t=this.editor;return[new Bs({key:BP,state:{init:(n,r)=>KP(r.doc,t,e),apply:(n,r)=>n.docChanged?KP(n.doc,t,e):r.map(n.mapping,n.doc)},props:{decorations:e=>BP.getState(e)??Fa.empty}})]}})}var JP=`0 2px 4px rgba(0, 0, 0, 0.08)`,YP=150,XP=globalThis.ScrollTimeline;function ZP(e,t,n,r,i){let a=r-i;if(a<=0)return null;let o=e+n-(t+au());return{startOffset:o,endOffset:o+a,maxShift:a}}var QP=new WeakMap;function $P(e){let t=QP.get(e);if(t){for(let e of t.animations)e.cancel();QP.delete(e)}}function eF(e){for(let t of Array.from(e.cells))$P(t)}var tF=e=>e.cellIndex===0?`3`:`2`;function nF(e,t){return rF(e,t,e=>({transform:`translateY(${e}px)`}))}function rF(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 iF(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 aF(e,t,n){return iF(e,t,{zIndex:`auto`,boxShadow:`none`},{zIndex:n,boxShadow:JP})}function oF(e,t){return iF(e,t,{opacity:`0`},{opacity:`1`})}function sF(e,t,n,r){let i=tF(e),a=`sd|${n.startOffset}|${n.maxShift}|${r}|${i}`,o=QP.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(nF(n,r),s),l=e.animate(aF(n,r,i),s),u=e.animate(oF(n,r),{...s,pseudoElement:`::before`});QP.set(e,{key:a,animations:[c,l,u]})}function cF(e,t){let n=tF(e),r=`in|${t}|${n}`,i=QP.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:JP}],{duration:0,fill:`forwards`}),o=e.animate([{opacity:`1`}],{duration:0,fill:`forwards`,pseudoElement:`::before`});QP.set(e,{key:r,animations:[a,o]})}function lF(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=ZP(a,i,c.top,c.height,l.height);if(!u){eF(s);continue}if(n){if(o<=0){eF(s);continue}for(let e of Array.from(s.cells))sF(e,n,u,o);continue}let d=Math.max(0,Math.min(a-u.startOffset,u.maxShift));if(d<=0||c.bottom<=i+au()){eF(s);continue}for(let e of Array.from(s.cells))cF(e,d)}}var uF=rs.create({name:`frozenTableHeaders`,addProseMirrorPlugins(){return[new Bs({key:new xa(`frozenTableHeaders`),view(e){let t=null,n=null,r=null,i=null,a=null,o=!1,s=new Set,c=()=>{o||!t||lF(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()},YP);return}l()};return requestAnimationFrame(()=>{if(!o){if(t=e.dom.closest(`[data-testid="editor-scroll-container"]`),t&&XP)try{n=new XP({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`))eF(t)}}}})]}}),dF=new xa(`markdownLintDecorations`),fF=`ok-lint-block`,pF=`ok-lint-block-error`,mF=`ok-lint-block-atom`,hF=400;function gF(e){return e.source===`frontmatter`}function _F(e,t,n){let r=new Map;if(t.length===0)return r;let{spans:i,fmLineCount:a}=du(e,n);for(let e of t){if(gF(e))continue;let t=e.range.start.line+1;if(a>0&&t<=a)continue;let n=lu(i,t);if(n===null)continue;let o=r.get(n);o?o.push(e):r.set(n,[e])}return r}var vF=`data-ok-lint`,yF=`data-ok-lint-fixable`;function bF(e,t){let n=new Map;if(t.size===0)return{set:Fa.empty,fixesByOffset:n};let r=[],i=0;return e.forEach((e,a)=>{let o=t.get(i);if(i+=1,!o||o.length===0)return;let s=o.some(e=>e.severity===`error`),c=o.map(e=>`${e.source}/${e.code}: ${e.message}`).join(`